koboyo 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/assets/editor/assets/ContextMenuTrigger-CXUL1E23.js +1 -0
- package/assets/editor/assets/DialogDescription-Ddhk2rmF.js +1 -0
- package/assets/editor/assets/DialogRoot-DUeVfNhS.js +1 -0
- package/assets/editor/assets/DialogTitle-D5au2NAn.js +1 -0
- package/assets/editor/assets/FloatingPortalLite-HnWQWrLk.js +1 -0
- package/assets/editor/assets/{IconAlertTriangle-CxPhYpe-.js → IconAlertTriangle-B33xznYN.js} +1 -1
- package/assets/editor/assets/{IconArrowLeft-DFk3Krim.js → IconArrowLeft-B4Zcy-Fc.js} +1 -1
- package/assets/editor/assets/IconChevronLeft-D7e7QC0h.js +1 -0
- package/assets/editor/assets/IconChevronRight-csfMBSUs.js +1 -0
- package/assets/editor/assets/{IconCode-hd05zxU4.js → IconCode-CHIz1nCU.js} +1 -1
- package/assets/editor/assets/IconCornerDownRight-DDiBMO4O.js +1 -0
- package/assets/editor/assets/{IconEraser-DlZQe3-r.js → IconEraser-CYfXj27R.js} +1 -1
- package/assets/editor/assets/{IconFocusCentered-C5PcDeR0.js → IconFocusCentered-Cn8rbfRI.js} +1 -1
- package/assets/editor/assets/IconHelp-4FIVl1rh.js +2 -0
- package/assets/editor/assets/{IconLink-ze4g4Lrj.js → IconLink-VS5p9Ytk.js} +1 -1
- package/assets/editor/assets/IconLoader2-CzCTn-Sn.js +1 -0
- package/assets/editor/assets/IconMinus-BcaDLts8.js +1 -0
- package/assets/editor/assets/{IconMoodSmile-Bic_fw54.js → IconMoodSmile-CSZ5p_Hy.js} +1 -1
- package/assets/editor/assets/{IconPencil-C5Y-Y4dC.js → IconPencil-D_pQsAyv.js} +1 -1
- package/assets/editor/assets/{IconPhoto-CR36IK-b.js → IconPhoto-5zuCDtnR.js} +1 -1
- package/assets/editor/assets/{IconPlayerPlayFilled-D4OODBX7.js → IconPlayerPlayFilled-DVAWmYt7.js} +1 -1
- package/assets/editor/assets/{IconPlayerStopFilled-BUbX6ZO5.js → IconPlayerStopFilled-D4qdct2R.js} +1 -1
- package/assets/editor/assets/IconPlus-D4tAoi-A.js +1 -0
- package/assets/editor/assets/{IconPresentation-DCrY3PKL.js → IconPresentation-BMKzt7fv.js} +1 -1
- package/assets/editor/assets/IconReplace-CYUD1RLF.js +1 -0
- package/assets/editor/assets/{IconSearch-C1K0_Pq_.js → IconSearch-CCpMt02s.js} +1 -1
- package/assets/editor/assets/{IconSparkles-WDcg8BA9.js → IconSparkles-CnCp3BCQ.js} +1 -1
- package/assets/editor/assets/{IconTrash-DbN_RxB7.js → IconTrash-C8w6ThWx.js} +1 -1
- package/assets/editor/assets/{IconUsers-Bwnyj4mm.js → IconUsers-Dp85N225.js} +1 -1
- package/assets/editor/assets/IconX-KrRqxr2j.js +1 -0
- package/assets/editor/assets/MenuSubmenuTrigger-BFlIkXYg.js +1 -0
- package/assets/editor/assets/PopoverPopup-1zO38CRl.js +1 -0
- package/assets/editor/assets/asset-glyph-DjBHkQcP.js +1 -0
- package/assets/editor/assets/billing-BSXr-z2r.js +1 -0
- package/assets/editor/assets/build-pips-BRf3pMnt.js +1 -0
- package/assets/editor/assets/build-visibility-CAmmsnmF.js +1 -0
- package/assets/editor/assets/builders-DrWdKwLQ.js +1 -0
- package/assets/editor/assets/{chart-Z4HQx-0h.js → chart-CKIxcbcM.js} +4 -4
- package/assets/editor/assets/{chrome-layout-B8YmHznO.js → chrome-layout-D5dql-y4.js} +1 -1
- package/assets/editor/assets/code-panel-BFikzGNv.js +18 -0
- package/assets/editor/assets/color-swatches-CZKb4DxX.js +1 -0
- package/assets/editor/assets/command-palette-Uat68wmJ.js +1 -0
- package/assets/editor/assets/config-D8b1QyEk.js +1 -0
- package/assets/editor/assets/connector-labels-DqVssnYz.js +2 -0
- package/assets/editor/assets/copy-image-dialog-C0fXdR1a.js +1 -0
- package/assets/editor/assets/core-C1TxysMz.js +1 -0
- package/assets/editor/assets/createReactComponent-C51FAx3B.js +1 -0
- package/assets/editor/assets/diagram-fingerprint-B-HB8UbR.js +3 -0
- package/assets/editor/assets/dialog-DnXgEbpz.js +1 -0
- package/assets/editor/assets/{edit-BJ_kibk8.js → edit-B4DMFSZr.js} +1 -1
- package/assets/editor/assets/editor-DAJETlQW.js +1 -0
- package/assets/editor/assets/{elk-api-DnfklSaw.js → elk-api-C4wlHVIw.js} +1 -1
- package/assets/editor/assets/{elk-worker-loader-CC-I9MmI.js → elk-worker-loader-BCdkmVMX.js} +1 -1
- package/assets/editor/assets/embed-input-D77Udvni.js +1 -0
- package/assets/editor/assets/export-FQTXirjn.js +2 -0
- package/assets/editor/assets/export-dialog-KYLeNY3G.js +1 -0
- package/assets/editor/assets/export-u442sUQs.js +6 -0
- package/assets/editor/assets/flow-layer-B4Q8rktl.js +1 -0
- package/assets/editor/assets/flow-panel-DbnavW4w.js +1 -0
- package/assets/editor/assets/flow-stage-CSTrNMZF.js +1 -0
- package/assets/editor/assets/{flow-start-BKN48uke.js → flow-start-ByhFxEeV.js} +1 -1
- package/assets/editor/assets/{flows-GGbkNqs8.js → flows-CGl4r-xb.js} +2 -2
- package/assets/editor/assets/{frames-CRP8oPP8.js → frames-DRSLvE9E.js} +1 -1
- package/assets/editor/assets/generate-DHP90nDk.js +26 -0
- package/assets/editor/assets/icon-picker-DIkw2xYL.js +1 -0
- package/assets/editor/assets/image-library-BmoSPV9c.js +1 -0
- package/assets/editor/assets/{index-e23lIFZB.css → index-DBrN0u0i.css} +1 -1
- package/assets/editor/assets/index-DFwoT1_W.js +25 -0
- package/assets/editor/assets/jsx-runtime-DKdBMi_L.js +1 -0
- package/assets/editor/assets/layout-offthread-JPTCbsLL.js +18 -0
- package/assets/editor/assets/{layout.worker-BIE1_z0S.js → layout.worker-CekYkaxO.js} +2 -2
- package/assets/editor/assets/menu-4xb5HtA1.js +1 -0
- package/assets/editor/assets/mermaid-paste-2cCwweY0.js +1 -0
- package/assets/editor/assets/panel-controls-B0Ccd0XF.js +1 -0
- package/assets/editor/assets/{panel-shell-CG2aq4Ia.js → panel-shell-COqmheb-.js} +1 -1
- package/assets/editor/assets/plan-D4Jyzo5X.js +1 -0
- package/assets/editor/assets/presentation-DNmdm11D.js +1 -0
- package/assets/editor/assets/presenter-keys-DLNIsrm5.js +1 -0
- package/assets/editor/assets/{jsx-runtime-2Zwg-L3c.js → react-lCSYwAWP.js} +1 -1
- package/assets/editor/assets/reflow-C6bvnSVm.js +1 -0
- package/assets/editor/assets/registry-d5KleeyB.js +1 -0
- package/assets/editor/assets/renderer-environment-D3n3hbug.js +1 -0
- package/assets/editor/assets/rich-paste-route-Bx69sREx.js +1 -0
- package/assets/editor/assets/ride-overlay-C1TrM7Ki.js +1 -0
- package/assets/editor/assets/selection-overlay-primitives-CfOaP5_G.js +1 -0
- package/assets/editor/assets/shape-meta-YgfIm0bQ.js +1 -0
- package/assets/editor/assets/shape-render-DZscezZk.js +1 -0
- package/assets/editor/assets/shapes-D5w8NTQQ.js +11 -0
- package/assets/editor/assets/sign-in-dialog-tmQEB2bx.js +1 -0
- package/assets/editor/assets/slide-notes-dialog-43EMJFJV.js +1 -0
- package/assets/editor/assets/slides-DDNzjFz9.js +5 -0
- package/assets/editor/assets/slides-panel-DANnu_nw.js +26 -0
- package/assets/editor/assets/text-breaks-DhCXtQrJ.js +7 -0
- package/assets/editor/assets/{theme-palette-D1nbDFBC.js → theme-palette-DEq19D0h.js} +1 -1
- package/assets/editor/assets/tidy-browser-BdlwTfCT.js +1 -0
- package/assets/editor/assets/tidy-scope-REEad7oC.js +1 -0
- package/assets/editor/assets/toast-Czv_DJ-4.js +1 -0
- package/assets/editor/assets/{tool-catalog-CHq6TJ2q.js → tool-catalog-CIjdZm_C.js} +1 -1
- package/assets/editor/assets/tool-drawer-B-Ys7Rsn.js +1 -0
- package/assets/editor/assets/tooltip-CKCG8vcp.js +1 -0
- package/assets/editor/assets/tree-BWJsAqkV.js +1 -0
- package/assets/editor/assets/upgrade-dialog-DhSZnDpx.js +1 -0
- package/assets/editor/assets/use-drag-reorder-ye8-kpyR.js +1 -0
- package/assets/editor/assets/use-export-command-BR-A4kAa.js +2 -0
- package/assets/editor/assets/use-grid-keyboard-nav-B0jjlh8Q.js +0 -0
- package/assets/editor/assets/use-icon-node-uhKPP4Ki.js +1 -0
- package/assets/editor/assets/use-key-held-DaUTxGze.js +1 -0
- package/assets/editor/assets/use-recent-list-DuazDypH.js +1 -0
- package/assets/editor/assets/useAnchoredPopupScrollLock-i8D5Dm1d.js +1 -0
- package/assets/editor/assets/useBaseUiId-D2RfU0uY.js +1 -0
- package/assets/editor/assets/useButton-CLQYGhRJ.js +1 -0
- package/assets/editor/assets/useControlled-BE8zdmih.js +1 -0
- package/assets/editor/assets/usePositioner-AtbrPc7w.js +1 -0
- package/assets/editor/assets/useScrollLock-CQpr0n6U.js +1 -0
- package/assets/editor/assets/useTriggerFocusGuards-Mibi8yYw.js +1 -0
- package/assets/editor/assets/useValueChanged-SqLfIDi5.js +1 -0
- package/assets/editor/assets/web-card-BTru0lge.js +1 -0
- package/assets/editor/assets/web-card-font-BbZEq3En.js +1 -0
- package/assets/editor/assets/web-controls-BjBov-C2.js +1 -0
- package/assets/editor/assets/web-embed-dialog-sT-1yK5o.js +1 -0
- package/assets/editor/assets/web-embed-url-CHu4SU82.js +1 -0
- package/assets/editor/assets/web-embeds-I3saJ_yp.js +1 -0
- package/assets/editor/assets/web-html-dialog-B5Hb3RGw.js +1 -0
- package/assets/editor/assets/web-runtime-wPi8lWzO.js +1 -0
- package/assets/editor/assets/web-widget-limits-DeMquLIR.js +1 -0
- package/assets/editor/assets/web-widgets-DsFUBhiq.js +325 -0
- package/assets/editor/assets/widget-source-C3N9ZKTz.js +2 -0
- package/assets/editor/assets/widget-target-C9a207gT.js +1 -0
- package/assets/editor/index.html +79 -69
- package/dist/koboyo.js +600 -225
- package/package.json +5 -5
- package/skills/koboyo/SKILL.md +27 -2
- package/skills/koboyo/references/architecture.md +1 -1
- package/skills/koboyo/references/bpmn.md +1 -1
- package/skills/koboyo/references/chart.md +1 -1
- package/skills/koboyo/references/cycle.md +1 -1
- package/skills/koboyo/references/erd.md +1 -1
- package/skills/koboyo/references/flowchart.md +1 -1
- package/skills/koboyo/references/funnel.md +1 -1
- package/skills/koboyo/references/gantt.md +1 -1
- package/skills/koboyo/references/gitgraph.md +1 -1
- package/skills/koboyo/references/journey.md +1 -1
- package/skills/koboyo/references/matrix.md +1 -1
- package/skills/koboyo/references/mindmap.md +1 -1
- package/skills/koboyo/references/orgchart.md +1 -1
- package/skills/koboyo/references/pyramid.md +1 -1
- package/skills/koboyo/references/sankey.md +1 -1
- package/skills/koboyo/references/sequence.md +1 -1
- package/skills/koboyo/references/statemachine.md +1 -1
- package/skills/koboyo/references/timeline.md +1 -1
- package/skills/koboyo/references/venn.md +1 -1
- package/skills/koboyo/references/wireframe.md +1 -1
- package/assets/editor/assets/DialogDescription-ZtZCUsfy.js +0 -1
- package/assets/editor/assets/DialogRoot-mHGRFW9m.js +0 -1
- package/assets/editor/assets/DialogTitle-CFhr-gP9.js +0 -1
- package/assets/editor/assets/FloatingPortalLite-Bf0q6fmL.js +0 -1
- package/assets/editor/assets/IconChevronLeft-BR0iwdRI.js +0 -1
- package/assets/editor/assets/IconChevronRight-DBDnxPYT.js +0 -1
- package/assets/editor/assets/IconCornerDownRight-BerbioFY.js +0 -1
- package/assets/editor/assets/IconHelp-DKNacRqS.js +0 -2
- package/assets/editor/assets/IconLoader2-BQaF1LKo.js +0 -1
- package/assets/editor/assets/IconMinus-y4ejub-s.js +0 -1
- package/assets/editor/assets/IconPlus-BbmieIBT.js +0 -1
- package/assets/editor/assets/IconX-AlbPkO_g.js +0 -1
- package/assets/editor/assets/MenuSubmenuTrigger-CpN67g09.js +0 -1
- package/assets/editor/assets/PopoverPopup-BqGWd_uB.js +0 -1
- package/assets/editor/assets/asset-glyph-B3c--Mx2.js +0 -1
- package/assets/editor/assets/billing-C-BNGM3Z.js +0 -1
- package/assets/editor/assets/build-pips-q_Fq10ov.js +0 -1
- package/assets/editor/assets/build-visibility-E1mHeDCW.js +0 -1
- package/assets/editor/assets/builders-DbF28yId.js +0 -1
- package/assets/editor/assets/code-panel-BfsykjSz.js +0 -43
- package/assets/editor/assets/command-palette-BjFnQHnz.js +0 -1
- package/assets/editor/assets/config-a_lz-57R.js +0 -1
- package/assets/editor/assets/connector-labels-vVnYQJRz.js +0 -2
- package/assets/editor/assets/copy-image-dialog-CCY_6fM4.js +0 -1
- package/assets/editor/assets/core-CBnmD9hT.js +0 -1
- package/assets/editor/assets/createReactComponent-9UsI5fmM.js +0 -1
- package/assets/editor/assets/diagram-fingerprint-CsqZK4xZ.js +0 -3
- package/assets/editor/assets/dialog-B32krrce.js +0 -1
- package/assets/editor/assets/editor-B0tARd79.js +0 -1
- package/assets/editor/assets/export-ChP0k5F5.js +0 -2
- package/assets/editor/assets/export-DEFKKRRi.js +0 -6
- package/assets/editor/assets/export-dialog-DPg1uzX5.js +0 -1
- package/assets/editor/assets/flow-layer-B7mlx0G4.js +0 -1
- package/assets/editor/assets/flow-panel-DoK6VIJ4.js +0 -1
- package/assets/editor/assets/flow-stage-fiF5Nggn.js +0 -1
- package/assets/editor/assets/icon-picker-NboB5Fvv.js +0 -1
- package/assets/editor/assets/image-library-Bb6bV6eK.js +0 -1
- package/assets/editor/assets/index-mhi0Z6gG.js +0 -24
- package/assets/editor/assets/layout-offthread-BwetpTFH.js +0 -18
- package/assets/editor/assets/menu-BPrc8Ara.js +0 -1
- package/assets/editor/assets/panel-controls-DYZ7QFT5.js +0 -1
- package/assets/editor/assets/plan-jQm1jDpt.js +0 -1
- package/assets/editor/assets/presentation-BavfNtxp.js +0 -1
- package/assets/editor/assets/presenter-keys-DVQcBdy1.js +0 -1
- package/assets/editor/assets/reflow-Cv75wPSh.js +0 -1
- package/assets/editor/assets/registry-DCgwH8wI.js +0 -1
- package/assets/editor/assets/renderer-environment-DmWXvuT4.js +0 -1
- package/assets/editor/assets/ride-overlay-DhygYdx1.js +0 -1
- package/assets/editor/assets/selection-overlay-primitives-hWJ1xjF7.js +0 -1
- package/assets/editor/assets/shape-meta-BpwsiB82.js +0 -1
- package/assets/editor/assets/sign-in-dialog-DRooo5xw.js +0 -1
- package/assets/editor/assets/slide-notes-dialog-DLdTmd7_.js +0 -1
- package/assets/editor/assets/slides-D9bnXqtf.js +0 -15
- package/assets/editor/assets/slides-panel-hozTMSMk.js +0 -26
- package/assets/editor/assets/text-breaks-YU-ymaF9.js +0 -7
- package/assets/editor/assets/tidy-browser-BwodBnAH.js +0 -1
- package/assets/editor/assets/tidy-scope-BgBSUklT.js +0 -1
- package/assets/editor/assets/toast-Nu_fiCd9.js +0 -1
- package/assets/editor/assets/tool-drawer-DEEqsKSN.js +0 -1
- package/assets/editor/assets/tooltip-DgEojto1.js +0 -1
- package/assets/editor/assets/tree-BbSzMkPL.js +0 -1
- package/assets/editor/assets/upgrade-dialog-DpZeaLDB.js +0 -1
- package/assets/editor/assets/use-drag-reorder-CTTvTwza.js +0 -1
- package/assets/editor/assets/use-export-command-CPc7qug1.js +0 -2
- package/assets/editor/assets/use-grid-keyboard-nav-B88Qw-cQ.js +0 -0
- package/assets/editor/assets/use-icon-node-DJZFjABX.js +0 -1
- package/assets/editor/assets/use-key-held-38H1v73f.js +0 -1
- package/assets/editor/assets/use-recent-list-BEG0iBIm.js +0 -1
- package/assets/editor/assets/useAnchoredPopupScrollLock-BGKchwpi.js +0 -1
- package/assets/editor/assets/useBaseUiId-C0Zm5sUV.js +0 -1
- package/assets/editor/assets/useButton-D3eS7fh5.js +0 -1
- package/assets/editor/assets/useControlled-C5xhvPXX.js +0 -1
- package/assets/editor/assets/usePositioner-DA3aR0-T.js +0 -1
- package/assets/editor/assets/useScrollLock-B7mQdXyv.js +0 -1
- package/assets/editor/assets/useValueChanged-p8z-93L4.js +0 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rich-paste-route-Bx69sREx.js","assets/web-widget-limits-DeMquLIR.js","assets/web-embeds-I3saJ_yp.js","assets/web-embed-url-CHu4SU82.js","assets/embed-input-D77Udvni.js","assets/tidy-browser-BdlwTfCT.js","assets/style-BENGW2ZV.js","assets/shapes-D5w8NTQQ.js","assets/slides-DDNzjFz9.js","assets/elk-worker-loader-BCdkmVMX.js","assets/rolldown-runtime-aKtaBQYM.js","assets/preload-helper-Czpn1I53.js","assets/text-breaks-DhCXtQrJ.js","assets/web-card-font-BbZEq3En.js","assets/blob-CTPsKWYv.js","assets/icons-DzW1j-r3.js","assets/icon-sources-CZI1h18s.js","assets/theme-palette-DEq19D0h.js","assets/tidy-scope-REEad7oC.js","assets/asset-glyph-DjBHkQcP.js","assets/shape-meta-YgfIm0bQ.js","assets/layout-offthread-JPTCbsLL.js","assets/reflow-C6bvnSVm.js","assets/registry-d5KleeyB.js","assets/builders-DrWdKwLQ.js","assets/widget-source-C3N9ZKTz.js","assets/react-lCSYwAWP.js","assets/color-swatches-CZKb4DxX.js","assets/mermaid-paste-2cCwweY0.js","assets/generate-DHP90nDk.js","assets/diagram-fingerprint-B-HB8UbR.js","assets/icon-catalog-CbUlEKtK.js","assets/web-runtime-wPi8lWzO.js","assets/jsx-runtime-DKdBMi_L.js","assets/editor-DAJETlQW.js","assets/createReactComponent-C51FAx3B.js","assets/web-controls-BjBov-C2.js","assets/tooltip-CKCG8vcp.js","assets/useScrollLock-CQpr0n6U.js","assets/usePositioner-AtbrPc7w.js","assets/FloatingPortalLite-HnWQWrLk.js","assets/keys-DrjiT9FL.js","assets/useBaseUiId-D2RfU0uY.js","assets/panel-controls-B0Ccd0XF.js","assets/useButton-CLQYGhRJ.js","assets/useTriggerFocusGuards-Mibi8yYw.js","assets/useValueChanged-SqLfIDi5.js","assets/IconMinus-BcaDLts8.js","assets/IconPlus-D4tAoi-A.js","assets/PopoverPopup-1zO38CRl.js","assets/useAnchoredPopupScrollLock-i8D5Dm1d.js","assets/surface-Dke4SWpE.js","assets/chrome-C2RCq3SI.js","assets/IconCode-CHIz1nCU.js","assets/IconReplace-CYUD1RLF.js","assets/IconPlayerPlayFilled-DVAWmYt7.js","assets/shape-render-DZscezZk.js","assets/config-D8b1QyEk.js","assets/web-card-BTru0lge.js","assets/web-widgets-DsFUBhiq.js","assets/widget-target-C9a207gT.js","assets/slides-panel-DANnu_nw.js","assets/menu-4xb5HtA1.js","assets/renderer-environment-D3n3hbug.js","assets/IconTrash-C8w6ThWx.js","assets/IconArrowLeft-B4Zcy-Fc.js","assets/IconPlayerStopFilled-D4qdct2R.js","assets/IconChevronLeft-D7e7QC0h.js","assets/IconChevronRight-csfMBSUs.js","assets/ContextMenuTrigger-CXUL1E23.js","assets/toast-Czv_DJ-4.js","assets/build-visibility-CAmmsnmF.js","assets/dom-PAoZruqo.js","assets/IconPencil-D_pQsAyv.js","assets/use-drag-reorder-ye8-kpyR.js","assets/IconSparkles-CnCp3BCQ.js","assets/IconX-KrRqxr2j.js","assets/use-export-command-BR-A4kAa.js","assets/lazy-module-DkWvu4va.js","assets/clipboard-CO7YHov7.js","assets/plan-D4Jyzo5X.js","assets/edit-B4DMFSZr.js","assets/DialogRoot-DUeVfNhS.js","assets/DialogTitle-D5au2NAn.js","assets/chrome-layout-D5dql-y4.js","assets/panel-shell-COqmheb-.js","assets/export-u442sUQs.js","assets/chart-CKIxcbcM.js","assets/frames-DRSLvE9E.js","assets/connector-labels-DqVssnYz.js","assets/code-panel-BFikzGNv.js","assets/IconAlertTriangle-B33xznYN.js","assets/storage-CvDRYh5V.js","assets/dialog-DnXgEbpz.js","assets/flows-CGl4r-xb.js","assets/core-C1TxysMz.js","assets/flow-panel-DbnavW4w.js","assets/editable-target-BTLnvKNi.js","assets/flow-start-ByhFxEeV.js","assets/tree-BWJsAqkV.js","assets/IconCornerDownRight-DDiBMO4O.js","assets/IconLink-VS5p9Ytk.js","assets/MenuSubmenuTrigger-BFlIkXYg.js","assets/flow-layer-B4Q8rktl.js","assets/use-key-held-DaUTxGze.js","assets/selection-overlay-primitives-CfOaP5_G.js","assets/IconFocusCentered-Cn8rbfRI.js","assets/flow-stage-CSTrNMZF.js","assets/presentation-DNmdm11D.js","assets/presenter-keys-DLNIsrm5.js","assets/web-embed-dialog-sT-1yK5o.js","assets/DialogDescription-Ddhk2rmF.js","assets/web-html-dialog-B5Hb3RGw.js","assets/slide-notes-dialog-43EMJFJV.js","assets/icon-picker-DIkw2xYL.js","assets/use-grid-keyboard-nav-B0jjlh8Q.js","assets/use-icon-node-uhKPP4Ki.js","assets/use-recent-list-DuazDypH.js","assets/image-library-BmoSPV9c.js","assets/IconLoader2-CzCTn-Sn.js","assets/IconSearch-CCpMt02s.js","assets/tool-drawer-B-Ys7Rsn.js","assets/tool-catalog-CIjdZm_C.js","assets/IconEraser-CYfXj27R.js","assets/IconMoodSmile-CSZ5p_Hy.js","assets/IconPhoto-5zuCDtnR.js","assets/command-palette-Uat68wmJ.js","assets/export-dialog-KYLeNY3G.js","assets/export-options-CJwykdP5.js","assets/copy-image-dialog-C0fXdR1a.js","assets/build-pips-BRf3pMnt.js","assets/upgrade-dialog-DhSZnDpx.js","assets/useControlled-BE8zdmih.js","assets/billing-BSXr-z2r.js","assets/IconUsers-Dp85N225.js","assets/sign-in-dialog-tmQEB2bx.js","assets/IconPresentation-BMKzt7fv.js","assets/excalidraw-BwgRIDi9.js","assets/shared-DjLCTIA9.js","assets/tldraw-CE87oKyq.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-aKtaBQYM.js";import{t as r}from"./react-lCSYwAWP.js";import{E as i,Fn as a,G as o,U as s,X as c,c as l,dt as u,ht as d,jn as f,ot as p,pt as m,w as h}from"./useScrollLock-CQpr0n6U.js";import{n as g,r as _,t as v}from"./toast-Czv_DJ-4.js";import{t as y}from"./jsx-runtime-DKdBMi_L.js";import{t as b}from"./useButton-CLQYGhRJ.js";import{n as x,t as S}from"./tooltip-CKCG8vcp.js";import{a as C,i as w,r as T}from"./useTriggerFocusGuards-Mibi8yYw.js";import{C as E,_ as D,b as O,c as k,d as A,f as j,g as ee,h as M,i as N,m as P,n as F,o as I,p as te,r as ne,t as L,w as R,y as z}from"./menu-4xb5HtA1.js";import{i as B,n as re,r as ie,t as ae}from"./config-D8b1QyEk.js";import{A as oe,C as se,D as ce,E as le,M as ue,O as de,T as fe,_ as pe,a as V,c as me,f as he,g as ge,h as _e,i as ve,j as ye,k as be,l as xe,m as Se,n as Ce,o as H,p as we,r as Te,s as U,t as Ee,u as De,v as Oe,w as ke,y as Ae}from"./editor-DAJETlQW.js";import{a as je,c as Me,d as Ne,f as Pe,h as Fe,i as Ie,l as Le,m as Re,n as ze,o as Be,p as Ve,s as He,u as Ue}from"./reflow-C6bvnSVm.js";import{i as We}from"./web-widget-limits-DeMquLIR.js";import{$ as Ge,A as Ke,B as qe,C as Je,E as Ye,G as Xe,H as Ze,I as Qe,J as $e,K as et,N as tt,O as nt,Q as rt,R as it,T as at,U as ot,V as st,W as ct,X as lt,Y as ut,Z as dt,_ as ft,a as pt,at as mt,d as ht,f as gt,g as _t,h as vt,i as yt,it as bt,j as xt,k as St,l as Ct,m as wt,n as Tt,ot as Et,p as Dt,q as Ot,r as kt,s as At,t as jt,u as Mt,v as Nt,y as Pt,z as Ft}from"./style-BENGW2ZV.js";import{$ as It,A as Lt,B as Rt,Bt as zt,C as Bt,Ct as Vt,D as Ht,Dn as Ut,Dt as Wt,E as Gt,En as Kt,Et as qt,F as Jt,G as Yt,H as Xt,It as Zt,J as Qt,Jt as $t,Kt as en,L as tn,Lt as nn,M as rn,N as an,O as on,Ot as sn,P as cn,Qt as ln,Rt as un,Sn as dn,St as fn,T as pn,Tt as mn,U as hn,Ut as gn,V as _n,Vt as vn,Wt as yn,Xt as bn,Zt as xn,_ as Sn,_n as Cn,a as wn,at as Tn,b as En,bt as Dn,c as On,cn as kn,ct as An,en as jn,et as Mn,f as Nn,fn as Pn,g as Fn,gt as In,h as Ln,hn as Rn,i as zn,it as Bn,j as W,jt as Vn,k as Hn,l as Un,ln as Wn,lt as Gn,m as Kn,mn as qn,mt as Jn,n as Yn,o as Xn,on as Zn,ot as Qn,p as $n,pn as er,q as tr,qt as nr,r as rr,s as ir,sn as ar,st as or,t as sr,u as cr,un as lr,ut as ur,v as dr,vn as fr,w as pr,x as mr,xt as hr,y as gr,yn as _r,z as vr,zt as yr}from"./shapes-D5w8NTQQ.js";import{$ as br,A as xr,At as Sr,C as Cr,F as wr,G as Tr,It as Er,K as Dr,L as Or,Lt as kr,M as Ar,Mt as jr,N as Mr,Q as Nr,R as Pr,Rt as Fr,T as Ir,V as Lr,W as Rr,X as zr,Y as Br,_ as Vr,at as Hr,b as Ur,bt as Wr,et as Gr,g as Kr,ht as qr,i as Jr,j as Yr,jt as Xr,k as Zr,kt as Qr,l as $r,nt as ei,o as ti,pt as ni,q as ri,t as ii,ut as ai,v as oi,w as G,x as si,y as ci}from"./slides-DDNzjFz9.js";import{a as li,d as ui,f as di,i as fi,l as pi,m as mi,o as hi,p as gi,r as _i,s as vi,t as yi,u as bi,z as xi}from"./registry-d5KleeyB.js";import{n as Si,t as Ci}from"./renderer-environment-D3n3hbug.js";import{t as wi}from"./preload-helper-Czpn1I53.js";import{n as Ti,t as Ei}from"./elk-worker-loader-BCdkmVMX.js";import{c as Di,d as Oi,i as ki,l as Ai,n as ji,o as Mi,p as Ni,r as Pi}from"./text-breaks-DhCXtQrJ.js";import{t as Fi}from"./blob-CTPsKWYv.js";import{i as Ii,r as Li}from"./icon-sources-CZI1h18s.js";import{t as Ri}from"./icons-DzW1j-r3.js";import{r as zi,t as Bi}from"./dom-PAoZruqo.js";import{_ as Vi,a as Hi,c as Ui,d as Wi,f as Gi,g as Ki,h as qi,i as Ji,l as Yi,m as Xi,n as Zi,o as Qi,p as $i,r as ea,s as ta,t as na,u as ra,v as ia,y as aa}from"./selection-overlay-primitives-CfOaP5_G.js";import{a as oa,c as sa}from"./export-options-CJwykdP5.js";import{_ as ca,a as la,c as ua,d as da,f as fa,g as pa,h as ma,i as ha,l as ga,m as _a,n as va,o as ya,p as ba,r as xa,s as Sa,t as Ca,u as wa,v as Ta,y as Ea}from"./panel-controls-B0Ccd0XF.js";import{a as Da,i as Oa,o as ka,r as Aa,s as ja,t as Ma,u as Na}from"./presenter-keys-DLNIsrm5.js";import{a as Pa,c as Fa,i as Ia,n as La,o as Ra,t as za}from"./IconHelp-4FIVl1rh.js";import{i as Ba,n as Va,r as Ha}from"./lazy-module-DkWvu4va.js";import{n as Ua}from"./tidy-scope-REEad7oC.js";import{r as Wa}from"./clipboard-CO7YHov7.js";import{A as Ga,C as Ka,D as qa,E as Ja,F as Ya,M as Xa,N as Za,O as Qa,P as $a,S as eo,T as to,_ as no,a as ro,b as io,c as ao,d as K,f as oo,g as so,h as co,i as lo,j as uo,k as fo,l as po,m as mo,n as ho,o as go,p as _o,r as vo,s as yo,u as bo,v as xo,w as So,x as Co,y as wo}from"./chart-CKIxcbcM.js";import{a as To,c as Eo,d as Do,i as Oo,l as ko,n as Ao,r as jo,s as Mo,t as No,u as Po}from"./frames-DRSLvE9E.js";import{a as Fo,i as Io,n as Lo,o as Ro,t as zo}from"./diagram-fingerprint-B-HB8UbR.js";import{t as Bo}from"./editable-target-BTLnvKNi.js";import{n as Vo,t as Ho}from"./use-key-held-DaUTxGze.js";import{t as q}from"./createReactComponent-C51FAx3B.js";import{C as Uo,E as Wo,S as Go,T as Ko,_ as qo,a as Jo,b as Yo,c as Xo,d as Zo,f as Qo,g as $o,h as es,i as ts,l as ns,m as rs,o as is,p as as,r as os,s as ss,t as cs,u as ls,v as us,w as ds,x as fs,y as ps}from"./tool-catalog-CIjdZm_C.js";import{t as ms}from"./IconAlertTriangle-B33xznYN.js";import{a as hs,n as gs,r as _s}from"./flow-start-ByhFxEeV.js";import{n as vs,r as ys,t as bs}from"./IconTrash-C8w6ThWx.js";import{t as xs}from"./IconArrowLeft-B4Zcy-Fc.js";import{n as Ss,r as Cs,t as ws}from"./IconPresentation-BMKzt7fv.js";import{n as Ts}from"./useValueChanged-SqLfIDi5.js";import{t as Es}from"./IconChevronRight-csfMBSUs.js";import{t as Ds}from"./IconCode-CHIz1nCU.js";import{a as Os,c as ks,d as As,f as js,i as Ms,l as Ns,n as Ps,o as Fs,r as Is,s as Ls,t as Rs,u as zs}from"./ContextMenuTrigger-CXUL1E23.js";import{n as Bs,r as Vs,t as Hs}from"./useControlled-BE8zdmih.js";import{t as Us}from"./IconEraser-CYfXj27R.js";import{n as Ws,t as Gs}from"./IconReplace-CYUD1RLF.js";import{t as Ks}from"./IconFocusCentered-Cn8rbfRI.js";import{a as qs,l as Js,n as Ys,o as Xs,r as Zs,t as Qs}from"./billing-BSXr-z2r.js";import{t as $s}from"./IconLink-VS5p9Ytk.js";import{t as ec}from"./IconLoader2-CzCTn-Sn.js";import{t as tc}from"./IconMinus-BcaDLts8.js";import{t as nc}from"./IconPencil-D_pQsAyv.js";import{t as rc}from"./IconPhoto-5zuCDtnR.js";import{t as ic}from"./IconPlus-D4tAoi-A.js";import{n as ac,r as oc,t as sc}from"./MenuSubmenuTrigger-BFlIkXYg.js";import{t as cc}from"./IconSearch-CCpMt02s.js";import{t as lc}from"./IconSparkles-CnCp3BCQ.js";import{t as uc}from"./IconX-KrRqxr2j.js";import{t as dc}from"./IconPlayerPlayFilled-DVAWmYt7.js";import{S as fc,_ as pc,a as mc,d as hc,f as gc,g as _c,h as vc,i as yc,l as bc,m as xc,n as Sc,o as Cc,r as wc,t as Tc}from"./PopoverPopup-1zO38CRl.js";import{n as Ec,t as Dc}from"./keys-DrjiT9FL.js";import{n as Oc,t as kc}from"./storage-CvDRYh5V.js";import{a as Ac,r as jc,t as Mc}from"./core-C1TxysMz.js";import{t as Nc}from"./use-export-command-BR-A4kAa.js";import{a as Pc,i as Fc,n as Ic,r as Lc,t as Rc}from"./shape-render-DZscezZk.js";import{i as zc,n as Bc,o as Vc,t as Hc}from"./asset-glyph-DjBHkQcP.js";import{t as Uc}from"./useBaseUiId-D2RfU0uY.js";import{n as Wc,t as Gc}from"./surface-Dke4SWpE.js";import{_ as Kc,d as qc}from"./plan-D4Jyzo5X.js";import{a as Jc,c as Yc,i as Xc,l as Zc,n as Qc,o as $c,r as el,s as tl,t as nl,u as rl}from"./chrome-C2RCq3SI.js";import{t as il}from"./widget-target-C9a207gT.js";import{a as al,i as ol,n as sl,o as cl,r as ll,t as ul}from"./DialogRoot-DUeVfNhS.js";import{n as dl,t as fl}from"./DialogTitle-D5au2NAn.js";import{t as pl}from"./DialogDescription-Ddhk2rmF.js";import{n as ml,r as hl,t as gl}from"./dialog-DnXgEbpz.js";import{i as _l,n as vl,r as yl,t as bl}from"./use-icon-node-uhKPP4Ki.js";import{n as xl}from"./chrome-layout-D5dql-y4.js";import{t as Sl}from"./panel-shell-COqmheb-.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var Cl=n((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0<n;){var r=n-1>>>1,a=e[r];if(0<i(a,t))e[r]=t,e[n]=a,n=r;else break a}}function n(e){return e.length===0?null:e[0]}function r(e){if(e.length===0)return null;var t=e[0],n=e.pop();if(n!==t){e[0]=n;a:for(var r=0,a=e.length,o=a>>>1;r<o;){var s=2*(r+1)-1,c=e[s],l=s+1,u=e[l];if(0>i(c,n))l<a&&0>i(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(l<a&&0>i(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(e.unstable_now=void 0,typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=!1,_=typeof setTimeout==`function`?setTimeout:null,v=typeof clearTimeout==`function`?clearTimeout:null,y=typeof setImmediate<`u`?setImmediate:null;function b(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function x(e){if(h=!1,b(e),!m)if(n(c)!==null)m=!0,S||(S=!0,O());else{var t=n(l);t!==null&&j(x,t.startTime-e)}}var S=!1,C=-1,w=5,T=-1;function E(){return g?!0:!(e.unstable_now()-T<w)}function D(){if(g=!1,S){var t=e.unstable_now();T=t;var i=!0;try{a:{m=!1,h&&(h=!1,v(C),C=-1),p=!0;var a=f;try{b:{for(b(t),d=n(c);d!==null&&!(d.expirationTime>t&&E());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=t);if(t=e.unstable_now(),typeof s==`function`){d.callback=s,b(t),i=!0;break b}d===n(c)&&r(c),b(t)}else r(c);d=n(c)}if(d!==null)i=!0;else{var u=n(l);u!==null&&j(x,u.startTime-t),i=!1}}break a}finally{d=null,f=a,p=!1}i=void 0}}finally{i?O():S=!1}}}var O;if(typeof y==`function`)O=function(){y(D)};else if(typeof MessageChannel<`u`){var k=new MessageChannel,A=k.port2;k.port1.onmessage=D,O=function(){A.postMessage(null)}}else O=function(){_(D,0)};function j(t,n){C=_(function(){t(e.unstable_now())},n)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(e){e.callback=null},e.unstable_forceFrameRate=function(e){0>e||125<e?console.error(`forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported`):w=0<e?Math.floor(1e3/e):5},e.unstable_getCurrentPriorityLevel=function(){return f},e.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var n=f;f=t;try{return e()}finally{f=n}},e.unstable_requestPaint=function(){g=!0},e.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var n=f;f=e;try{return t()}finally{f=n}},e.unstable_scheduleCallback=function(r,i,a){var o=e.unstable_now();switch(typeof a==`object`&&a?(a=a.delay,a=typeof a==`number`&&0<a?o+a:o):a=o,r){case 1:var s=-1;break;case 2:s=250;break;case 5:s=1073741823;break;case 4:s=1e4;break;default:s=5e3}return s=a+s,r={id:u++,callback:i,priorityLevel:r,startTime:a,expirationTime:s,sortIndex:-1},a>o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(v(C),C=-1):h=!0,j(x,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,S||(S=!0,O()))),r},e.unstable_shouldYield=E,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),wl=n(((e,t)=>{t.exports=Cl()})),Tl=n((e=>{var t=wl(),n=r(),i=a();function o(e){var t=`https://react.dev/errors/`+e;if(1<arguments.length){t+=`?args[]=`+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)t+=`&args[]=`+encodeURIComponent(arguments[n])}return`Minified React error #`+e+`; visit `+t+` for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`}function s(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function c(e){var t=e,n=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,t.flags&4098&&(n=t.return),e=t.return;while(e)}return t.tag===3?n:null}function l(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function u(e){if(e.tag===31){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function d(e){if(c(e)!==e)throw Error(o(188))}function f(e){var t=e.alternate;if(!t){if(t=c(e),t===null)throw Error(o(188));return t===e?e:null}for(var n=e,r=t;;){var i=n.return;if(i===null)break;var a=i.alternate;if(a===null){if(r=i.return,r!==null){n=r;continue}break}if(i.child===a.child){for(a=i.child;a;){if(a===n)return d(i),e;if(a===r)return d(i),t;a=a.sibling}throw Error(o(188))}if(n.return!==r.return)n=i,r=a;else{for(var s=!1,l=i.child;l;){if(l===n){s=!0,n=i,r=a;break}if(l===r){s=!0,r=i,n=a;break}l=l.sibling}if(!s){for(l=a.child;l;){if(l===n){s=!0,n=a,r=i;break}if(l===r){s=!0,r=a,n=i;break}l=l.sibling}if(!s)throw Error(o(189))}}if(n.alternate!==r)throw Error(o(190))}if(n.tag!==3)throw Error(o(188));return n.stateNode.current===n?e:t}function p(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=p(e),t!==null)return t;e=e.sibling}return null}var m=Object.assign,h=Symbol.for(`react.element`),g=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.memo_cache_sentinel`),A=Symbol.iterator;function j(e){return typeof e!=`object`||!e?null:(e=A&&e[A]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function M(e){if(e==null)return null;if(typeof e==`function`)return e.$$typeof===ee?null:e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case v:return`Fragment`;case b:return`Profiler`;case y:return`StrictMode`;case w:return`Suspense`;case T:return`SuspenseList`;case O:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case _:return`Portal`;case S:return e.displayName||`Context`;case x:return(e._context.displayName||`Context`)+`.Consumer`;case C:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case E:return t=e.displayName||null,t===null?M(e.type)||`Memo`:t;case D:t=e._payload,e=e._init;try{return M(e(t))}catch{}}return null}var N=Array.isArray,P=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I={pending:!1,data:null,method:null,action:null},te=[],ne=-1;function L(e){return{current:e}}function R(e){0>ne||(e.current=te[ne],te[ne]=null,ne--)}function z(e,t){ne++,te[ne]=e.current,e.current=t}var B=L(null),re=L(null),ie=L(null),ae=L(null);function oe(e,t){switch(z(ie,t),z(re,e),z(B,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Gd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Gd(t),e=Kd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}R(B),z(B,e)}function se(){R(B),R(re),R(ie)}function ce(e){e.memoizedState!==null&&z(ae,e);var t=B.current,n=Kd(t,e.type);t!==n&&(z(re,e),z(B,n))}function le(e){re.current===e&&(R(B),R(re)),ae.current===e&&(R(ae),np._currentValue=I)}var ue,de;function fe(e){if(ue===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ue=t&&t[1]||``,de=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+ue+e+de}var pe=!1;function V(e,t){if(!e||pe)return``;pe=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var n=function(){throw Error()};if(Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect==`object`&&Reflect.construct){try{Reflect.construct(n,[])}catch(e){var r=e}Reflect.construct(e,[],n)}else{try{n.call()}catch(e){r=e}e.call(n.prototype)}}else{try{throw Error()}catch(e){r=e}(n=e())&&typeof n.catch==`function`&&n.catch(function(){})}}catch(e){if(e&&r&&typeof e.stack==`string`)return[e.stack,r.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName=`DetermineComponentFrameRoot`;var i=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,`name`);i&&i.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:`DetermineComponentFrameRoot`});var a=r.DetermineComponentFrameRoot(),o=a[0],s=a[1];if(o&&s){var c=o.split(`
|
|
5
|
+
`),l=s.split(`
|
|
6
|
+
`);for(i=r=0;r<c.length&&!c[r].includes(`DetermineComponentFrameRoot`);)r++;for(;i<l.length&&!l[i].includes(`DetermineComponentFrameRoot`);)i++;if(r===c.length||i===l.length)for(r=c.length-1,i=l.length-1;1<=r&&0<=i&&c[r]!==l[i];)i--;for(;1<=r&&0<=i;r--,i--)if(c[r]!==l[i]){if(r!==1||i!==1)do if(r--,i--,0>i||c[r]!==l[i]){var u=`
|
|
7
|
+
`+c[r].replace(` at new `,` at `);return e.displayName&&u.includes(`<anonymous>`)&&(u=u.replace(`<anonymous>`,e.displayName)),u}while(1<=r&&0<=i);break}}}finally{pe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?fe(n):``}function me(e,t){switch(e.tag){case 26:case 27:case 5:return fe(e.type);case 16:return fe(`Lazy`);case 13:return e.child!==t&&t!==null?fe(`Suspense Fallback`):fe(`Suspense`);case 19:return fe(`SuspenseList`);case 0:case 15:return V(e.type,!1);case 11:return V(e.type.render,!1);case 1:return V(e.type,!0);case 31:return fe(`Activity`);default:return``}}function he(e){try{var t=``,n=null;do t+=me(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var ge=Object.prototype.hasOwnProperty,_e=t.unstable_scheduleCallback,ve=t.unstable_cancelCallback,ye=t.unstable_shouldYield,be=t.unstable_requestPaint,xe=t.unstable_now,Se=t.unstable_getCurrentPriorityLevel,Ce=t.unstable_ImmediatePriority,H=t.unstable_UserBlockingPriority,we=t.unstable_NormalPriority,Te=t.unstable_LowPriority,U=t.unstable_IdlePriority,Ee=t.log,De=t.unstable_setDisableYieldValue,Oe=null,ke=null;function Ae(e){if(typeof Ee==`function`&&De(e),ke&&typeof ke.setStrictMode==`function`)try{ke.setStrictMode(Oe,e)}catch{}}var je=Math.clz32?Math.clz32:Pe,Me=Math.log,Ne=Math.LN2;function Pe(e){return e>>>=0,e===0?32:31-(Me(e)/Ne|0)|0}var Fe=256,Ie=262144,Le=4194304;function Re(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ze(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s===0?(s=r&~a,s===0?o===0?n||(n=r&~e,n!==0&&(i=Re(n))):i=Re(o):i=Re(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=Re(n))):i=Re(o)):i=Re(r)),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&n&4194048)?t:i}function Be(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Ve(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function He(){var e=Le;return Le<<=1,!(Le&62914560)&&(Le=4194304),e}function Ue(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function We(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Ge(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,c=e.expirationTimes,l=e.hiddenUpdates;for(n=o&~n;0<n;){var u=31-je(n),d=1<<u;s[u]=0,c[u]=-1;var f=l[u];if(f!==null)for(l[u]=null,u=0;u<f.length;u++){var p=f[u];p!==null&&(p.lane&=-536870913)}n&=~d}r!==0&&Ke(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function Ke(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-je(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function qe(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-je(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function Je(e,t){var n=t&-t;return n=n&42?1:Ye(n),(n&(e.suspendedLanes|t))===0?n:0}function Ye(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Xe(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function Ze(){var e=F.p;return e===0?(e=window.event,e===void 0?32:vp(e.type)):e}function Qe(e,t){var n=F.p;try{return F.p=e,t()}finally{F.p=n}}var $e=Math.random().toString(36).slice(2),et=`__reactFiber$`+$e,tt=`__reactProps$`+$e,nt=`__reactContainer$`+$e,rt=`__reactEvents$`+$e,it=`__reactListeners$`+$e,at=`__reactHandles$`+$e,ot=`__reactResources$`+$e,st=`__reactMarker$`+$e;function ct(e){delete e[et],delete e[tt],delete e[rt],delete e[it],delete e[at]}function lt(e){var t=e[et];if(t)return t;for(var n=e.parentNode;n;){if(t=n[nt]||n[et]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=hf(e);e!==null;){if(n=e[et])return n;e=hf(e)}return t}e=n,n=e.parentNode}return null}function ut(e){if(e=e[et]||e[nt]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function dt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(o(33))}function ft(e){var t=e[ot];return t||=e[ot]={hoistableStyles:new Map,hoistableScripts:new Map},t}function pt(e){e[st]=!0}var mt=new Set,ht={};function gt(e,t){_t(e,t),_t(e+`Capture`,t)}function _t(e,t){for(ht[e]=t,e=0;e<t.length;e++)mt.add(t[e])}var vt=RegExp(`^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`),yt={},bt={};function xt(e){return ge.call(bt,e)?!0:ge.call(yt,e)?!1:vt.test(e)?bt[e]=!0:(yt[e]=!0,!1)}function St(e,t,n){if(xt(t))if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:e.removeAttribute(t);return;case`boolean`:var r=t.toLowerCase().slice(0,5);if(r!==`data-`&&r!==`aria-`){e.removeAttribute(t);return}}e.setAttribute(t,``+n)}}function Ct(e,t,n){if(n===null)e.removeAttribute(t);else{switch(typeof n){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(t);return}e.setAttribute(t,``+n)}}function wt(e,t,n,r){if(r===null)e.removeAttribute(n);else{switch(typeof r){case`undefined`:case`function`:case`symbol`:case`boolean`:e.removeAttribute(n);return}e.setAttributeNS(t,n,``+r)}}function Tt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Et(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Dt(e,t,n){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&r!==void 0&&typeof r.get==`function`&&typeof r.set==`function`){var i=r.get,a=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){n=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return n},setValue:function(e){n=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function Ot(e){if(!e._valueTracker){var t=Et(e)?`checked`:`value`;e._valueTracker=Dt(e,t,``+e[t])}}function kt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Et(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function At(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}var jt=/[\n"\\]/g;function Mt(e){return e.replace(jt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Nt(e,t,n,r,i,a,o,s){e.name=``,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`?e.type=o:e.removeAttribute(`type`),t==null?o!==`submit`&&o!==`reset`||e.removeAttribute(`value`):o===`number`?(t===0&&e.value===``||e.value!=t)&&(e.value=``+Tt(t)):e.value!==``+Tt(t)&&(e.value=``+Tt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ft(e,o,Tt(n)):Ft(e,o,Tt(t)),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!=`function`&&typeof i!=`symbol`),s!=null&&typeof s!=`function`&&typeof s!=`symbol`&&typeof s!=`boolean`?e.name=``+Tt(s):e.removeAttribute(`name`)}function Pt(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!=`function`&&typeof a!=`symbol`&&typeof a!=`boolean`&&(e.type=a),t!=null||n!=null){if(!(a!==`submit`&&a!==`reset`||t!=null)){Ot(e);return}n=n==null?``:``+Tt(n),t=t==null?n:``+Tt(t),s||t===e.value||(e.value=t),e.defaultValue=t}r??=i,r=typeof r!=`function`&&typeof r!=`symbol`&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!=`function`&&typeof o!=`symbol`&&typeof o!=`boolean`&&(e.name=o),Ot(e)}function Ft(e,t,n){t===`number`&&At(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function It(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i<n.length;i++)t[`$`+n[i]]=!0;for(n=0;n<e.length;n++)i=t.hasOwnProperty(`$`+e[n].value),e[n].selected!==i&&(e[n].selected=i),i&&r&&(e[n].defaultSelected=!0)}else{for(n=``+Tt(n),t=null,i=0;i<e.length;i++){if(e[i].value===n){e[i].selected=!0,r&&(e[i].defaultSelected=!0);return}t!==null||e[i].disabled||(t=e[i])}t!==null&&(t.selected=!0)}}function Lt(e,t,n){if(t!=null&&(t=``+Tt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Tt(n)}function Rt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(o(92));if(N(r)){if(1<r.length)throw Error(o(93));r=r[0]}n=r}n??=``,t=n}n=Tt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),Ot(e)}function zt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Bt=new Set(`animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp`.split(` `));function Vt(e,t,n){var r=t.indexOf(`--`)===0;n==null||typeof n==`boolean`||n===``?r?e.setProperty(t,``):t===`float`?e.cssFloat=``:e[t]=``:r?e.setProperty(t,n):typeof n!=`number`||n===0||Bt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Ht(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(o(62));if(e=e.style,n!=null){for(var r in n)!n.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf(`--`)===0?e.setProperty(r,``):r===`float`?e.cssFloat=``:e[r]=``);for(var i in t)r=t[i],t.hasOwnProperty(i)&&n[i]!==r&&Vt(e,i,r)}else for(var a in t)t.hasOwnProperty(a)&&Vt(e,a,t[a])}function Ut(e){if(e.indexOf(`-`)===-1)return!1;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Wt=new Map([[`acceptCharset`,`accept-charset`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`],[`crossOrigin`,`crossorigin`],[`accentHeight`,`accent-height`],[`alignmentBaseline`,`alignment-baseline`],[`arabicForm`,`arabic-form`],[`baselineShift`,`baseline-shift`],[`capHeight`,`cap-height`],[`clipPath`,`clip-path`],[`clipRule`,`clip-rule`],[`colorInterpolation`,`color-interpolation`],[`colorInterpolationFilters`,`color-interpolation-filters`],[`colorProfile`,`color-profile`],[`colorRendering`,`color-rendering`],[`dominantBaseline`,`dominant-baseline`],[`enableBackground`,`enable-background`],[`fillOpacity`,`fill-opacity`],[`fillRule`,`fill-rule`],[`floodColor`,`flood-color`],[`floodOpacity`,`flood-opacity`],[`fontFamily`,`font-family`],[`fontSize`,`font-size`],[`fontSizeAdjust`,`font-size-adjust`],[`fontStretch`,`font-stretch`],[`fontStyle`,`font-style`],[`fontVariant`,`font-variant`],[`fontWeight`,`font-weight`],[`glyphName`,`glyph-name`],[`glyphOrientationHorizontal`,`glyph-orientation-horizontal`],[`glyphOrientationVertical`,`glyph-orientation-vertical`],[`horizAdvX`,`horiz-adv-x`],[`horizOriginX`,`horiz-origin-x`],[`imageRendering`,`image-rendering`],[`letterSpacing`,`letter-spacing`],[`lightingColor`,`lighting-color`],[`markerEnd`,`marker-end`],[`markerMid`,`marker-mid`],[`markerStart`,`marker-start`],[`overlinePosition`,`overline-position`],[`overlineThickness`,`overline-thickness`],[`paintOrder`,`paint-order`],[`panose-1`,`panose-1`],[`pointerEvents`,`pointer-events`],[`renderingIntent`,`rendering-intent`],[`shapeRendering`,`shape-rendering`],[`stopColor`,`stop-color`],[`stopOpacity`,`stop-opacity`],[`strikethroughPosition`,`strikethrough-position`],[`strikethroughThickness`,`strikethrough-thickness`],[`strokeDasharray`,`stroke-dasharray`],[`strokeDashoffset`,`stroke-dashoffset`],[`strokeLinecap`,`stroke-linecap`],[`strokeLinejoin`,`stroke-linejoin`],[`strokeMiterlimit`,`stroke-miterlimit`],[`strokeOpacity`,`stroke-opacity`],[`strokeWidth`,`stroke-width`],[`textAnchor`,`text-anchor`],[`textDecoration`,`text-decoration`],[`textRendering`,`text-rendering`],[`transformOrigin`,`transform-origin`],[`underlinePosition`,`underline-position`],[`underlineThickness`,`underline-thickness`],[`unicodeBidi`,`unicode-bidi`],[`unicodeRange`,`unicode-range`],[`unitsPerEm`,`units-per-em`],[`vAlphabetic`,`v-alphabetic`],[`vHanging`,`v-hanging`],[`vIdeographic`,`v-ideographic`],[`vMathematical`,`v-mathematical`],[`vectorEffect`,`vector-effect`],[`vertAdvY`,`vert-adv-y`],[`vertOriginX`,`vert-origin-x`],[`vertOriginY`,`vert-origin-y`],[`wordSpacing`,`word-spacing`],[`writingMode`,`writing-mode`],[`xmlnsXlink`,`xmlns:xlink`],[`xHeight`,`x-height`]]),Gt=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Kt(e){return Gt.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function qt(){}var Jt=null;function Yt(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Xt=null,Zt=null;function Qt(e){var t=ut(e);if(t&&(e=t.stateNode)){var n=e[tt]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Nt(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,n.type===`radio`&&t!=null){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll(`input[name="`+Mt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var i=r[tt]||null;if(!i)throw Error(o(90));Nt(r,i.value,i.defaultValue,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&kt(r)}break a;case`textarea`:Lt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&It(e,!!n.multiple,t,!1)}}}var $t=!1;function en(e,t,n){if($t)return e(t,n);$t=!0;try{return e(t)}finally{if($t=!1,(Xt!==null||Zt!==null)&&(Su(),Xt&&(t=Xt,e=Zt,Zt=Xt=null,Qt(t),e)))for(t=0;t<e.length;t++)Qt(e[t])}}function tn(e,t){var n=e.stateNode;if(n===null)return null;var r=n[tt]||null;if(r===null)return null;n=r[t];a:switch(t){case`onClick`:case`onClickCapture`:case`onDoubleClick`:case`onDoubleClickCapture`:case`onMouseDown`:case`onMouseDownCapture`:case`onMouseMove`:case`onMouseMoveCapture`:case`onMouseUp`:case`onMouseUpCapture`:case`onMouseEnter`:(r=!r.disabled)||(e=e.type,r=!(e===`button`||e===`input`||e===`select`||e===`textarea`)),e=!r;break a;default:e=!1}if(e)return null;if(n&&typeof n!=`function`)throw Error(o(231,t,typeof n));return n}var nn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),rn=!1;if(nn)try{var an={};Object.defineProperty(an,"passive",{get:function(){rn=!0}}),window.addEventListener(`test`,an,an),window.removeEventListener(`test`,an,an)}catch{rn=!1}var on=null,sn=null,cn=null;function ln(){if(cn)return cn;var e,t=sn,n=t.length,r,i=`value`in on?on.value:on.textContent,a=i.length;for(e=0;e<n&&t[e]===i[e];e++);var o=n-e;for(r=1;r<=o&&t[n-r]===i[a-r];r++);return cn=i.slice(e,1<r?1-r:void 0)}function un(e){var t=e.keyCode;return`charCode`in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function dn(){return!0}function fn(){return!1}function pn(e){function t(t,n,r,i,a){for(var o in this._reactName=t,this._targetInst=r,this.type=n,this.nativeEvent=i,this.target=a,this.currentTarget=null,e)e.hasOwnProperty(o)&&(t=e[o],this[o]=t?t(i):i[o]);return this.isDefaultPrevented=(i.defaultPrevented==null?!1===i.returnValue:i.defaultPrevented)?dn:fn,this.isPropagationStopped=fn,this}return m(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():typeof e.returnValue!=`unknown`&&(e.returnValue=!1),this.isDefaultPrevented=dn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=dn)},persist:function(){},isPersistent:dn}),t}var mn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},hn=pn(mn),gn=m({},mn,{view:0,detail:0}),_n=pn(gn),vn,yn,bn,xn=m({},gn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mn,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return`movementX`in e?e.movementX:(e!==bn&&(bn&&e.type===`mousemove`?(vn=e.screenX-bn.screenX,yn=e.screenY-bn.screenY):yn=vn=0,bn=e),vn)},movementY:function(e){return`movementY`in e?e.movementY:yn}}),Sn=pn(xn),Cn=pn(m({},xn,{dataTransfer:0})),wn=pn(m({},gn,{relatedTarget:0})),Tn=pn(m({},mn,{animationName:0,elapsedTime:0,pseudoElement:0})),En=pn(m({},mn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Dn=pn(m({},mn,{data:0})),On={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},kn={8:`Backspace`,9:`Tab`,12:`Clear`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,19:`Pause`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,45:`Insert`,46:`Delete`,112:`F1`,113:`F2`,114:`F3`,115:`F4`,116:`F5`,117:`F6`,118:`F7`,119:`F8`,120:`F9`,121:`F10`,122:`F11`,123:`F12`,144:`NumLock`,145:`ScrollLock`,224:`Meta`},An={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function jn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=An[e])?!!t[e]:!1}function Mn(){return jn}var Nn=pn(m({},gn,{key:function(e){if(e.key){var t=On[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=un(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?kn[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mn,charCode:function(e){return e.type===`keypress`?un(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?un(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Pn=pn(m({},xn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Fn=pn(m({},gn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mn})),In=pn(m({},mn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Ln=pn(m({},xn,{deltaX:function(e){return`deltaX`in e?e.deltaX:`wheelDeltaX`in e?-e.wheelDeltaX:0},deltaY:function(e){return`deltaY`in e?e.deltaY:`wheelDeltaY`in e?-e.wheelDeltaY:`wheelDelta`in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0})),Rn=pn(m({},mn,{newState:0,oldState:0})),zn=[9,13,27,32],Bn=nn&&`CompositionEvent`in window,W=null;nn&&`documentMode`in document&&(W=document.documentMode);var Vn=nn&&`TextEvent`in window&&!W,Hn=nn&&(!Bn||W&&8<W&&11>=W),Un=` `,Wn=!1;function Gn(e,t){switch(e){case`keyup`:return zn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function Kn(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var qn=!1;function Jn(e,t){switch(e){case`compositionend`:return Kn(t);case`keypress`:return t.which===32?(Wn=!0,Un):null;case`textInput`:return e=t.data,e===Un&&Wn?null:e;default:return null}}function Yn(e,t){if(qn)return e===`compositionend`||!Bn&&Gn(e,t)?(e=ln(),cn=sn=on=null,qn=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case`compositionend`:return Hn&&t.locale!==`ko`?null:t.data;default:return null}}var Xn={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Zn(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!Xn[e.type]:t===`textarea`}function Qn(e,t,n,r){Xt?Zt?Zt.push(r):Zt=[r]:Xt=r,t=kd(t,`onChange`),0<t.length&&(n=new hn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var $n=null,er=null;function tr(e){Sd(e,0)}function nr(e){if(kt(dt(e)))return e}function rr(e,t){if(e===`change`)return t}var ir=!1;if(nn){var ar;if(nn){var or=`oninput`in document;if(!or){var sr=document.createElement(`div`);sr.setAttribute(`oninput`,`return;`),or=typeof sr.oninput==`function`}ar=or}else ar=!1;ir=ar&&(!document.documentMode||9<document.documentMode)}function cr(){$n&&($n.detachEvent(`onpropertychange`,lr),er=$n=null)}function lr(e){if(e.propertyName===`value`&&nr(er)){var t=[];Qn(t,er,e,Yt(e)),en(tr,t)}}function ur(e,t,n){e===`focusin`?(cr(),$n=t,er=n,$n.attachEvent(`onpropertychange`,lr)):e===`focusout`&&cr()}function dr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return nr(er)}function fr(e,t){if(e===`click`)return nr(t)}function pr(e,t){if(e===`input`||e===`change`)return nr(t)}function mr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var hr=typeof Object.is==`function`?Object.is:mr;function gr(e,t){if(hr(e,t))return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var i=n[r];if(!ge.call(t,i)||!hr(e[i],t[i]))return!1}return!0}function _r(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vr(e,t){var n=_r(e);e=0;for(var r;n;){if(n.nodeType===3){if(r=e+n.textContent.length,e<=t&&r>=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=_r(n)}}function yr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?yr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function br(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=At(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=At(e.document)}return t}function xr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}var Sr=nn&&`documentMode`in document&&11>=document.documentMode,Cr=null,wr=null,Tr=null,Er=!1;function Dr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Er||Cr==null||Cr!==At(r)||(r=Cr,`selectionStart`in r&&xr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Tr&&gr(Tr,r)||(Tr=r,r=kd(wr,`onSelect`),0<r.length&&(t=new hn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=Cr)))}function Or(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var kr={animationend:Or(`Animation`,`AnimationEnd`),animationiteration:Or(`Animation`,`AnimationIteration`),animationstart:Or(`Animation`,`AnimationStart`),transitionrun:Or(`Transition`,`TransitionRun`),transitionstart:Or(`Transition`,`TransitionStart`),transitioncancel:Or(`Transition`,`TransitionCancel`),transitionend:Or(`Transition`,`TransitionEnd`)},Ar={},jr={};nn&&(jr=document.createElement(`div`).style,`AnimationEvent`in window||(delete kr.animationend.animation,delete kr.animationiteration.animation,delete kr.animationstart.animation),`TransitionEvent`in window||delete kr.transitionend.transition);function Mr(e){if(Ar[e])return Ar[e];if(!kr[e])return e;var t=kr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in jr)return Ar[e]=t[n];return e}var Nr=Mr(`animationend`),Pr=Mr(`animationiteration`),Fr=Mr(`animationstart`),Ir=Mr(`transitionrun`),Lr=Mr(`transitionstart`),Rr=Mr(`transitioncancel`),zr=Mr(`transitionend`),Br=new Map,Vr=`abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel`.split(` `);Vr.push(`scrollEnd`);function Hr(e,t){Br.set(e,t),gt(t,[e])}var Ur=typeof reportError==`function`?reportError:function(e){if(typeof window==`object`&&typeof window.ErrorEvent==`function`){var t=new window.ErrorEvent(`error`,{bubbles:!0,cancelable:!0,message:typeof e==`object`&&e&&typeof e.message==`string`?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process==`object`&&typeof process.emit==`function`){process.emit(`uncaughtException`,e);return}console.error(e)},Wr=[],Gr=0,Kr=0;function qr(){for(var e=Gr,t=Kr=Gr=0;t<e;){var n=Wr[t];Wr[t++]=null;var r=Wr[t];Wr[t++]=null;var i=Wr[t];Wr[t++]=null;var a=Wr[t];if(Wr[t++]=null,r!==null&&i!==null){var o=r.pending;o===null?i.next=i:(i.next=o.next,o.next=i),r.pending=i}a!==0&&Zr(n,i,a)}}function Jr(e,t,n,r){Wr[Gr++]=e,Wr[Gr++]=t,Wr[Gr++]=n,Wr[Gr++]=r,Kr|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Yr(e,t,n,r){return Jr(e,t,n,r),Qr(e)}function Xr(e,t){return Jr(e,null,null,t),Qr(e)}function Zr(e,t,n){e.lanes|=n;var r=e.alternate;r!==null&&(r.lanes|=n);for(var i=!1,a=e.return;a!==null;)a.childLanes|=n,r=a.alternate,r!==null&&(r.childLanes|=n),a.tag===22&&(e=a.stateNode,e===null||e._visibility&1||(i=!0)),e=a,a=a.return;return e.tag===3?(a=e.stateNode,i&&t!==null&&(i=31-je(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function Qr(e){if(50<pu)throw pu=0,mu=null,Error(o(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var $r={};function ei(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ti(e,t,n,r){return new ei(e,t,n,r)}function ni(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ri(e,t){var n=e.alternate;return n===null?(n=ti(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&65011712,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n.refCleanup=e.refCleanup,n}function ii(e,t){e.flags&=65011714;var n=e.alternate;return n===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=n.childLanes,e.lanes=n.lanes,e.child=n.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=n.memoizedProps,e.memoizedState=n.memoizedState,e.updateQueue=n.updateQueue,e.type=n.type,t=n.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function ai(e,t,n,r,i,a){var s=0;if(r=e,typeof e==`function`)ni(e)&&(s=1);else if(typeof e==`string`)s=qf(e,n,B.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case O:return e=ti(31,n,t,i),e.elementType=O,e.lanes=a,e;case v:return oi(n.children,i,a,t);case y:s=8,i|=24;break;case b:return e=ti(12,n,t,i|2),e.elementType=b,e.lanes=a,e;case w:return e=ti(13,n,t,i),e.elementType=w,e.lanes=a,e;case T:return e=ti(19,n,t,i),e.elementType=T,e.lanes=a,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case S:s=10;break a;case x:s=9;break a;case C:s=11;break a;case E:s=14;break a;case D:s=16,r=null;break a}s=29,n=Error(o(130,e===null?`null`:typeof e,``)),r=null}return t=ti(s,n,t,i),t.elementType=e,t.type=r,t.lanes=a,t}function oi(e,t,n,r){return e=ti(7,e,r,t),e.lanes=n,e}function G(e,t,n){return e=ti(6,e,null,t),e.lanes=n,e}function si(e){var t=ti(18,null,null,0);return t.stateNode=e,t}function ci(e,t,n){return t=ti(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var li=new WeakMap;function ui(e,t){if(typeof e==`object`&&e){var n=li.get(e);return n===void 0?(t={value:e,source:t,stack:he(t)},li.set(e,t),t):n}return{value:e,source:t,stack:he(t)}}var di=[],fi=0,pi=null,mi=0,hi=[],gi=0,_i=null,vi=1,yi=``;function bi(e,t){di[fi++]=mi,di[fi++]=pi,pi=e,mi=t}function xi(e,t,n){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,_i=e;var r=vi;e=yi;var i=32-je(r)-1;r&=~(1<<i),n+=1;var a=32-je(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,vi=1<<32-je(t)+i|n<<i|r,yi=a+e}else vi=1<<a|n<<i|r,yi=e}function Si(e){e.return!==null&&(bi(e,1),xi(e,1,0))}function Ci(e){for(;e===pi;)pi=di[--fi],di[fi]=null,mi=di[--fi],di[fi]=null;for(;e===_i;)_i=hi[--gi],hi[gi]=null,yi=hi[--gi],hi[gi]=null,vi=hi[--gi],hi[gi]=null}function wi(e,t){hi[gi++]=vi,hi[gi++]=yi,hi[gi++]=_i,vi=t.id,yi=t.overflow,_i=e}var Ti=null,Ei=null,Di=!1,Oi=null,ki=!1,Ai=Error(o(519));function ji(e){throw Li(ui(Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Ai}function Mi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[et]=e,t[tt]=r,n){case`dialog`:Y(`cancel`,t),Y(`close`,t);break;case`iframe`:case`object`:case`embed`:Y(`load`,t);break;case`video`:case`audio`:for(n=0;n<bd.length;n++)Y(bd[n],t);break;case`source`:Y(`error`,t);break;case`img`:case`image`:case`link`:Y(`error`,t),Y(`load`,t);break;case`details`:Y(`toggle`,t);break;case`input`:Y(`invalid`,t),Pt(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Y(`invalid`,t);break;case`textarea`:Y(`invalid`,t),Rt(t,r.value,r.defaultValue,r.children)}n=r.children,typeof n!=`string`&&typeof n!=`number`&&typeof n!=`bigint`||t.textContent===``+n||!0===r.suppressHydrationWarning||Fd(t.textContent,n)?(r.popover!=null&&(Y(`beforetoggle`,t),Y(`toggle`,t)),r.onScroll!=null&&Y(`scroll`,t),r.onScrollEnd!=null&&Y(`scrollend`,t),r.onClick!=null&&(t.onclick=qt),t=!0):t=!1,t||ji(e,!0)}function Ni(e){for(Ti=e.return;Ti;)switch(Ti.tag){case 5:case 31:case 13:ki=!1;return;case 27:case 3:ki=!0;return;default:Ti=Ti.return}}function Pi(e){if(e!==Ti)return!1;if(!Di)return Ni(e),Di=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||qd(e.type,e.memoizedProps)),n=!n),n&&Ei&&ji(e),Ni(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ei=mf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(317));Ei=mf(e)}else t===27?(t=Ei,tf(e.type)?(e=pf,pf=null,Ei=e):Ei=t):Ei=Ti?ff(e.stateNode.nextSibling):null;return!0}function Fi(){Ei=Ti=null,Di=!1}function Ii(){var e=Oi;return e!==null&&($l===null?$l=e:$l.push.apply($l,e),Oi=null),e}function Li(e){Oi===null?Oi=[e]:Oi.push(e)}var Ri=L(null),zi=null,Bi=null;function Vi(e,t,n){z(Ri,t._currentValue),t._currentValue=n}function Hi(e){e._currentValue=Ri.current,R(Ri)}function Ui(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Wi(e,t,n,r){var i=e.child;for(i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){var s=i.child;a=a.firstContext;a:for(;a!==null;){var c=a;a=i;for(var l=0;l<t.length;l++)if(c.context===t[l]){a.lanes|=n,c=a.alternate,c!==null&&(c.lanes|=n),Ui(a.return,n,e),r||(s=null);break a}a=c.next}}else if(i.tag===18){if(s=i.return,s===null)throw Error(o(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),Ui(s,n,e),s=null}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}}function Gi(e,t,n,r){e=null;for(var i=t,a=!1;i!==null;){if(!a){if(i.flags&524288)a=!0;else if(i.flags&262144)break}if(i.tag===10){var s=i.alternate;if(s===null)throw Error(o(387));if(s=s.memoizedProps,s!==null){var c=i.type;hr(i.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(i===ae.current){if(s=i.alternate,s===null)throw Error(o(387));s.memoizedState.memoizedState!==i.memoizedState.memoizedState&&(e===null?e=[np]:e.push(np))}i=i.return}e!==null&&Wi(t,e,n,r),t.flags|=262144}function Ki(e){for(e=e.firstContext;e!==null;){if(!hr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function qi(e){zi=e,Bi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Ji(e){return Xi(zi,e)}function Yi(e,t){return zi===null&&qi(e),Xi(e,t)}function Xi(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},Bi===null){if(e===null)throw Error(o(308));Bi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Bi=Bi.next=t;return n}var Zi=typeof AbortController<`u`?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(t,n){e.push(n)}};this.abort=function(){t.aborted=!0,e.forEach(function(e){return e()})}},Qi=t.unstable_scheduleCallback,$i=t.unstable_NormalPriority,ea={$$typeof:S,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function ta(){return{controller:new Zi,data:new Map,refCount:0}}function na(e){e.refCount--,e.refCount===0&&Qi($i,function(){e.controller.abort()})}var ra=null,ia=0,aa=0,oa=null;function sa(e,t){if(ra===null){var n=ra=[];ia=0,aa=md(),oa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ia++,t.then(ca,ca),t}function ca(){if(--ia===0&&ra!==null){oa!==null&&(oa.status=`fulfilled`);var e=ra;ra=null,aa=0,oa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function la(e,t){var n=[],r={status:`pending`,value:null,reason:null,then:function(e){n.push(e)}};return e.then(function(){r.status=`fulfilled`,r.value=t;for(var e=0;e<n.length;e++)(0,n[e])(t)},function(e){for(r.status=`rejected`,r.reason=e,e=0;e<n.length;e++)(0,n[e])(void 0)}),r}var ua=P.S;P.S=function(e,t){nu=xe(),typeof t==`object`&&t&&typeof t.then==`function`&&sa(e,t),ua!==null&&ua(e,t)};var da=L(null);function fa(){var e=da.current;return e===null?Ll.pooledCache:e}function pa(e,t){t===null?z(da,da.current):z(da,t.pool)}function ma(){var e=fa();return e===null?null:{parent:ea._currentValue,pool:e}}var ha=Error(o(460)),ga=Error(o(474)),_a=Error(o(542)),va={then:function(){}};function ya(e){return e=e.status,e===`fulfilled`||e===`rejected`}function ba(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(qt,qt),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e;default:if(typeof t.status==`string`)t.then(qt,qt);else{if(e=Ll,e!==null&&100<e.shellSuspendCounter)throw Error(o(482));e=t,e.status=`pending`,e.then(function(e){if(t.status===`pending`){var n=t;n.status=`fulfilled`,n.value=e}},function(e){if(t.status===`pending`){var n=t;n.status=`rejected`,n.reason=e}})}switch(t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,wa(e),e}throw Sa=t,ha}}function xa(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Sa=e,ha):e}}var Sa=null;function Ca(){if(Sa===null)throw Error(o(459));var e=Sa;return Sa=null,e}function wa(e){if(e===ha||e===_a)throw Error(o(483))}var Ta=null,Ea=0;function Da(e){var t=Ea;return Ea+=1,Ta===null&&(Ta=[]),ba(Ta,e,t)}function Oa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function ka(e,t){throw t.$$typeof===h?Error(o(525)):(e=Object.prototype.toString.call(t),Error(o(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Aa(e){function t(t,n){if(e){var r=t.deletions;r===null?(t.deletions=[n],t.flags|=16):r.push(n)}}function n(n,r){if(!e)return null;for(;r!==null;)t(n,r),r=r.sibling;return null}function r(e){for(var t=new Map;e!==null;)e.key===null?t.set(e.index,e):t.set(e.key,e),e=e.sibling;return t}function i(e,t){return e=ri(e,t),e.index=0,e.sibling=null,e}function a(t,n,r){return t.index=r,e?(r=t.alternate,r===null?(t.flags|=67108866,n):(r=r.index,r<n?(t.flags|=67108866,n):r)):(t.flags|=1048576,n)}function s(t){return e&&t.alternate===null&&(t.flags|=67108866),t}function c(e,t,n,r){return t===null||t.tag!==6?(t=G(n,e.mode,r),t.return=e,t):(t=i(t,n),t.return=e,t)}function l(e,t,n,r){var a=n.type;return a===v?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===a||typeof a==`object`&&a&&a.$$typeof===D&&xa(a)===t.type)?(t=i(t,n.props),Oa(t,n),t.return=e,t):(t=ai(n.type,n.key,n.props,null,e.mode,r),Oa(t,n),t.return=e,t)}function u(e,t,n,r){return t===null||t.tag!==4||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?(t=ci(n,e.mode,r),t.return=e,t):(t=i(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,a){return t===null||t.tag!==7?(t=oi(n,e.mode,r,a),t.return=e,t):(t=i(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=G(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case g:return n=ai(t.type,t.key,t.props,null,e.mode,n),Oa(n,t),n.return=e,n;case _:return t=ci(t,e.mode,n),t.return=e,t;case D:return t=xa(t),f(e,t,n)}if(N(t)||j(t))return t=oi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Da(t),n);if(t.$$typeof===S)return f(e,Yi(e,t),n);ka(e,t)}return null}function p(e,t,n,r){var i=t===null?null:t.key;if(typeof n==`string`&&n!==``||typeof n==`number`||typeof n==`bigint`)return i===null?c(e,t,``+n,r):null;if(typeof n==`object`&&n){switch(n.$$typeof){case g:return n.key===i?l(e,t,n,r):null;case _:return n.key===i?u(e,t,n,r):null;case D:return n=xa(n),p(e,t,n,r)}if(N(n)||j(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Da(n),r);if(n.$$typeof===S)return p(e,t,Yi(e,n),r);ka(e,n)}return null}function m(e,t,n,r,i){if(typeof r==`string`&&r!==``||typeof r==`number`||typeof r==`bigint`)return e=e.get(n)||null,c(t,e,``+r,i);if(typeof r==`object`&&r){switch(r.$$typeof){case g:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case _:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case D:return r=xa(r),m(e,t,n,r,i)}if(N(r)||j(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Da(r),i);if(r.$$typeof===S)return m(e,t,n,Yi(t,r),i);ka(t,r)}return null}function h(i,o,s,c){for(var l=null,u=null,d=o,h=o=0,g=null;d!==null&&h<s.length;h++){d.index>h?(g=d,d=null):g=d.sibling;var _=p(i,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(i,d),o=a(_,o,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Di&&bi(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(o=a(d,o,h),u===null?l=d:u.sibling=d,u=d);return Di&&bi(i,h),l}for(d=r(d);h<s.length;h++)g=m(d,i,h,s[h],c),g!==null&&(e&&g.alternate!==null&&d.delete(g.key===null?h:g.key),o=a(g,o,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Di&&bi(i,h),l}function y(i,s,c,l){if(c==null)throw Error(o(151));for(var u=null,d=null,h=s,g=s=0,_=null,v=c.next();h!==null&&!v.done;g++,v=c.next()){h.index>g?(_=h,h=null):_=h.sibling;var y=p(i,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(i,h),s=a(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(i,h),Di&&bi(i,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(i,v.value,l),v!==null&&(s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return Di&&bi(i,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,i,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=a(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(i,e)}),Di&&bi(i,g),u}function b(e,r,a,c){if(typeof a==`object`&&a&&a.type===v&&a.key===null&&(a=a.props.children),typeof a==`object`&&a){switch(a.$$typeof){case g:a:{for(var l=a.key;r!==null;){if(r.key===l){if(l=a.type,l===v){if(r.tag===7){n(e,r.sibling),c=i(r,a.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===D&&xa(l)===r.type){n(e,r.sibling),c=i(r,a.props),Oa(c,a),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}a.type===v?(c=oi(a.props.children,e.mode,c,a.key),c.return=e,e=c):(c=ai(a.type,a.key,a.props,null,e.mode,c),Oa(c,a),c.return=e,e=c)}return s(e);case _:a:{for(l=a.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===a.containerInfo&&r.stateNode.implementation===a.implementation){n(e,r.sibling),c=i(r,a.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=ci(a,e.mode,c),c.return=e,e=c}return s(e);case D:return a=xa(a),b(e,r,a,c)}if(N(a))return h(e,r,a,c);if(j(a)){if(l=j(a),typeof l!=`function`)throw Error(o(150));return a=l.call(a),y(e,r,a,c)}if(typeof a.then==`function`)return b(e,r,Da(a),c);if(a.$$typeof===S)return b(e,r,Yi(e,a),c);ka(e,a)}return typeof a==`string`&&a!==``||typeof a==`number`||typeof a==`bigint`?(a=``+a,r!==null&&r.tag===6?(n(e,r.sibling),c=i(r,a),c.return=e,e=c):(n(e,r),c=G(a,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ea=0;var i=b(e,t,n,r);return Ta=null,i}catch(t){if(t===ha||t===_a)throw t;var a=ti(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var ja=Aa(!0),Ma=Aa(!1),Na=!1;function Pa(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fa(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function Ia(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function La(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,Il&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Qr(e),Zr(e,null,n),t}return Jr(e,r,t,n),Qr(e)}function Ra(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194048)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}function za(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var Ba=!1;function Va(){if(Ba){var e=oa;if(e!==null)throw e}}function Ha(e,t,n,r){Ba=!1;var i=e.updateQueue;Na=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane&-536870913,p=f!==s.lane;if(p?(zl&f)===f:(r&f)===f){f!==0&&f===aa&&(Ba=!0),u!==null&&(u=u.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});a:{var h=e,g=s;f=t;var _=n;switch(g.tag){case 1:if(h=g.payload,typeof h==`function`){d=h.call(_,d,f);break a}d=h;break a;case 3:h.flags=h.flags&-65537|128;case 0:if(h=g.payload,f=typeof h==`function`?h.call(_,d,f):h,f==null)break a;d=m({},d,f);break a;case 2:Na=!0}}f=s.callback,f!==null&&(e.flags|=64,p&&(e.flags|=8192),p=i.callbacks,p===null?i.callbacks=[f]:p.push(f))}else p={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;p=s,s=p.next,p.next=null,i.lastBaseUpdate=p,i.shared.pending=null}}while(1);u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,a===null&&(i.shared.lanes=0),ql|=o,e.lanes=o,e.memoizedState=d}}function Ua(e,t){if(typeof e!=`function`)throw Error(o(191,e));e.call(t)}function Wa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ua(n[e],t)}var Ga=L(null),Ka=L(0);function qa(e,t){e=Gl,z(Ka,e),z(Ga,t),Gl=e|t.baseLanes}function Ja(){z(Ka,Gl),z(Ga,Ga.current)}function Ya(){Gl=Ka.current,R(Ga),R(Ka)}var Xa=L(null),Za=null;function Qa(e){var t=e.alternate;z(ro,ro.current&1),z(Xa,e),Za===null&&(t===null||Ga.current!==null||t.memoizedState!==null)&&(Za=e)}function $a(e){z(ro,ro.current),z(Xa,e),Za===null&&(Za=e)}function eo(e){e.tag===22?(z(ro,ro.current),z(Xa,e),Za===null&&(Za=e)):to(e)}function to(){z(ro,ro.current),z(Xa,Xa.current)}function no(e){R(Xa),Za===e&&(Za=null),R(ro)}var ro=L(0);function io(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||lf(n)||uf(n)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder===`forwards`||t.memoizedProps.revealOrder===`backwards`||t.memoizedProps.revealOrder===`unstable_legacy-backwards`||t.memoizedProps.revealOrder===`together`)){if(t.flags&128)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var ao=0,K=null,oo=null,so=null,co=!1,lo=!1,uo=!1,fo=0,po=0,mo=null,ho=0;function go(){throw Error(o(321))}function _o(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!hr(e[n],t[n]))return!1;return!0}function vo(e,t,n,r,i,a){return ao=a,K=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,P.H=e===null||e.memoizedState===null?Ps:Fs,uo=!1,a=n(r,i),uo=!1,lo&&(a=bo(t,n,r,i)),yo(e),a}function yo(e){P.H=Ns;var t=oo!==null&&oo.next!==null;if(ao=0,so=oo=K=null,co=!1,po=0,mo=null,t)throw Error(o(300));e===null||Qs||(e=e.dependencies,e!==null&&Ki(e)&&(Qs=!0))}function bo(e,t,n,r){K=e;var i=0;do{if(lo&&(mo=null),po=0,lo=!1,25<=i)throw Error(o(301));if(i+=1,so=oo=null,e.updateQueue!=null){var a=e.updateQueue;a.lastEffect=null,a.events=null,a.stores=null,a.memoCache!=null&&(a.memoCache.index=0)}P.H=Is,a=t(n,r)}while(lo);return a}function xo(){var e=P.H,t=e.useState()[0];return t=typeof t.then==`function`?Oo(t):t,e=e.useState()[0],(oo===null?null:oo.memoizedState)!==e&&(K.flags|=1024),t}function So(){var e=fo!==0;return fo=0,e}function Co(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function wo(e){if(co){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}co=!1}ao=0,so=oo=K=null,lo=!1,po=fo=0,mo=null}function To(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return so===null?K.memoizedState=so=e:so=so.next=e,so}function Eo(){if(oo===null){var e=K.alternate;e=e===null?null:e.memoizedState}else e=oo.next;var t=so===null?K.memoizedState:so.next;if(t!==null)so=t,oo=e;else{if(e===null)throw K.alternate===null?Error(o(467)):Error(o(310));oo=e,e={memoizedState:oo.memoizedState,baseState:oo.baseState,baseQueue:oo.baseQueue,queue:oo.queue,next:null},so===null?K.memoizedState=so=e:so=so.next=e}return so}function Do(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Oo(e){var t=po;return po+=1,mo===null&&(mo=[]),e=ba(mo,e,t),t=K,(so===null?t.memoizedState:so.next)===null&&(t=t.alternate,P.H=t===null||t.memoizedState===null?Ps:Fs),e}function ko(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return Oo(e);if(e.$$typeof===S)return Ji(e)}throw Error(o(438,String(e)))}function Ao(e){var t=null,n=K.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=K.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(e){return e.slice()}),index:0})))}if(t??={data:[],index:0},n===null&&(n=Do(),K.updateQueue=n),n.memoCache=t,n=t.data[t.index],n===void 0)for(n=t.data[t.index]=Array(e),r=0;r<e;r++)n[r]=k;return t.index++,n}function jo(e,t){return typeof t==`function`?t(e):t}function Mo(e){return No(Eo(),oo,e)}function No(e,t,n){var r=e.queue;if(r===null)throw Error(o(311));r.lastRenderedReducer=n;var i=e.baseQueue,a=r.pending;if(a!==null){if(i!==null){var s=i.next;i.next=a.next,a.next=s}t.baseQueue=i=a,r.pending=null}if(a=e.baseState,i===null)e.memoizedState=a;else{t=i.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(ao&f)===f:(zl&f)===f){var p=u.revertLane;if(p===0)l!==null&&(l=l.next={lane:0,revertLane:0,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null}),f===aa&&(d=!0);else if((ao&p)===p){u=u.next,p===aa&&(d=!0);continue}else f={lane:0,revertLane:u.revertLane,gesture:null,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=f,s=a):l=l.next=f,K.lanes|=p,ql|=p;f=u.action,uo&&n(a,f),a=u.hasEagerState?u.eagerState:n(a,f)}else p={lane:f,revertLane:u.revertLane,gesture:u.gesture,action:u.action,hasEagerState:u.hasEagerState,eagerState:u.eagerState,next:null},l===null?(c=l=p,s=a):l=l.next=p,K.lanes|=f,ql|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=a:l.next=c,!hr(a,e.memoizedState)&&(Qs=!0,d&&(n=oa,n!==null)))throw n;e.memoizedState=a,e.baseState=s,e.baseQueue=l,r.lastRenderedState=a}return i===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function Po(e){var t=Eo(),n=t.queue;if(n===null)throw Error(o(311));n.lastRenderedReducer=e;var r=n.dispatch,i=n.pending,a=t.memoizedState;if(i!==null){n.pending=null;var s=i=i.next;do a=e(a,s.action),s=s.next;while(s!==i);hr(a,t.memoizedState)||(Qs=!0),t.memoizedState=a,t.baseQueue===null&&(t.baseState=a),n.lastRenderedState=a}return[a,r]}function Fo(e,t,n){var r=K,i=Eo(),a=Di;if(a){if(n===void 0)throw Error(o(407));n=n()}else n=t();var s=!hr((oo||i).memoizedState,n);if(s&&(i.memoizedState=n,Qs=!0),i=i.queue,as(Ro.bind(null,r,i,e),[e]),i.getSnapshot!==t||s||so!==null&&so.memoizedState.tag&1){if(r.flags|=2048,es(9,{destroy:void 0},Lo.bind(null,r,i,n,t),null),Ll===null)throw Error(o(349));a||ao&127||Io(r,t,n)}return n}function Io(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=K.updateQueue,t===null?(t=Do(),K.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function Lo(e,t,n,r){t.value=n,t.getSnapshot=r,zo(t)&&Bo(e)}function Ro(e,t,n){return n(function(){zo(t)&&Bo(e)})}function zo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!hr(e,n)}catch{return!0}}function Bo(e){var t=Xr(e,2);t!==null&&_u(t,e,2)}function Vo(e){var t=To();if(typeof e==`function`){var n=e;if(e=n(),uo){Ae(!0);try{n()}finally{Ae(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:e},t}function Ho(e,t,n,r){return e.baseState=n,No(e,oo,typeof r==`function`?r:jo)}function q(e,t,n,r,i){if(As(e))throw Error(o(485));if(e=t.action,e!==null){var a={payload:i,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){a.listeners.push(e)}};P.T===null?a.isTransition=!1:n(!0),r(a),n=t.pending,n===null?(a.next=t.pending=a,Uo(t,a)):(a.next=n.next,t.pending=n.next=a)}}function Uo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=P.T,o={};P.T=o;try{var s=n(i,r),c=P.S;c!==null&&c(o,s),Wo(e,t,s)}catch(n){Ko(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),P.T=a}}else try{a=n(i,r),Wo(e,t,a)}catch(n){Ko(e,t,n)}}function Wo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Go(e,t,n)},function(n){return Ko(e,t,n)}):Go(e,t,n)}function Go(e,t,n){t.status=`fulfilled`,t.value=n,qo(t),e.state=n,t=e.pending,t!==null&&(n=t.next,n===t?e.pending=null:(n=n.next,t.next=n,Uo(e,n)))}function Ko(e,t,n){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status=`rejected`,t.reason=n,qo(t),t=t.next;while(t!==r)}e.action=null}function qo(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Jo(e,t){return t}function Yo(e,t){if(Di){var n=Ll.formState;if(n!==null){a:{var r=K;if(Di){if(Ei){b:{for(var i=Ei,a=ki;i.nodeType!==8;){if(!a){i=null;break b}if(i=ff(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ei=ff(i.nextSibling),r=i.data===`F!`;break a}}ji(r)}r=!1}r&&(t=n[0])}}return n=To(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Jo,lastRenderedState:t},n.queue=r,n=Ds.bind(null,K,r),r.dispatch=n,r=Vo(!1),a=ks.bind(null,K,!1,r.queue),r=To(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=q.bind(null,K,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function Xo(e){return Zo(Eo(),oo,e)}function Zo(e,t,n){if(t=No(e,t,Jo)[0],e=Mo(jo)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=Oo(t)}catch(e){throw e===ha?_a:e}else r=t;t=Eo();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(K.flags|=2048,es(9,{destroy:void 0},Qo.bind(null,i,n),null)),[r,a,e]}function Qo(e,t){e.action=t}function $o(e){var t=Eo(),n=oo;if(n!==null)return Zo(t,n,e);Eo(),t=t.memoizedState,n=Eo();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function es(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=K.updateQueue,t===null&&(t=Do(),K.updateQueue=t),n=t.lastEffect,n===null?t.lastEffect=e.next=e:(r=n.next,n.next=e,e.next=r,t.lastEffect=e),e}function ts(){return Eo().memoizedState}function ns(e,t,n,r){var i=To();K.flags|=e,i.memoizedState=es(1|t,{destroy:void 0},n,r===void 0?null:r)}function rs(e,t,n,r){var i=Eo();r=r===void 0?null:r;var a=i.memoizedState.inst;oo!==null&&r!==null&&_o(r,oo.memoizedState.deps)?i.memoizedState=es(t,a,n,r):(K.flags|=e,i.memoizedState=es(1|t,a,n,r))}function is(e,t){ns(8390656,8,e,t)}function as(e,t){rs(2048,8,e,t)}function os(e){K.flags|=4;var t=K.updateQueue;if(t===null)t=Do(),K.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function ss(e){var t=Eo().memoizedState;return os({ref:t,nextImpl:e}),function(){if(Il&2)throw Error(o(440));return t.impl.apply(void 0,arguments)}}function cs(e,t){return rs(4,2,e,t)}function ls(e,t){return rs(4,4,e,t)}function us(e,t){if(typeof t==`function`){e=e();var n=t(e);return function(){typeof n==`function`?n():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function ds(e,t,n){n=n==null?null:n.concat([e]),rs(4,4,us.bind(null,t,e),n)}function fs(){}function ps(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&_o(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ms(e,t){var n=Eo();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&_o(t,r[1]))return r[0];if(r=e(),uo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r}function hs(e,t,n){return n===void 0||ao&1073741824&&!(zl&261930)?e.memoizedState=t:(e.memoizedState=n,e=gu(),K.lanes|=e,ql|=e,n)}function gs(e,t,n,r){return hr(n,t)?n:Ga.current===null?!(ao&42)||ao&1073741824&&!(zl&261930)?(Qs=!0,e.memoizedState=n):(e=gu(),K.lanes|=e,ql|=e,t):(e=hs(e,n,r),hr(e,t)||(Qs=!0),e)}function _s(e,t,n,r,i){var a=F.p;F.p=a!==0&&8>a?a:8;var o=P.T,s={};P.T=s,ks(e,!1,t,n);try{var c=i(),l=P.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Os(e,t,la(c,r),hu(e)):Os(e,t,r,hu(e))}catch(n){Os(e,t,{then:function(){},status:`rejected`,reason:n},hu())}finally{F.p=a,o!==null&&s.types!==null&&(o.types=s.types),P.T=o}}function vs(){}function ys(e,t,n,r){if(e.tag!==5)throw Error(o(476));var i=bs(e).queue;_s(e,i,t,I,n===null?vs:function(){return xs(e),n(r)})}function bs(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:I,baseState:I,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:I},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jo,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function xs(e){var t=bs(e);t.next===null&&(t=e.alternate.memoizedState),Os(e,t.next.queue,{},hu())}function Ss(){return Ji(np)}function Cs(){return Eo().memoizedState}function ws(){return Eo().memoizedState}function Ts(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=hu();e=Ia(n);var r=La(t,e,n);r!==null&&(_u(r,t,n),Ra(r,t,n)),t={cache:ta()},e.payload=t;return}t=t.return}}function Es(e,t,n){var r=hu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},As(e)?js(t,n):(n=Yr(e,t,n,r),n!==null&&(_u(n,e,r),Ms(n,t,r)))}function Ds(e,t,n){Os(e,t,n,hu())}function Os(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(As(e))js(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,hr(s,o))return Jr(e,t,i,0),Ll===null&&qr(),!1}catch{}if(n=Yr(e,t,i,r),n!==null)return _u(n,e,r),Ms(n,t,r),!0}return!1}function ks(e,t,n,r){if(r={lane:2,revertLane:md(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},As(e)){if(t)throw Error(o(479))}else t=Yr(e,n,r,2),t!==null&&_u(t,e,2)}function As(e){var t=e.alternate;return e===K||t!==null&&t===K}function js(e,t){lo=co=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ms(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,qe(e,n)}}var Ns={readContext:Ji,use:ko,useCallback:go,useContext:go,useEffect:go,useImperativeHandle:go,useLayoutEffect:go,useInsertionEffect:go,useMemo:go,useReducer:go,useRef:go,useState:go,useDebugValue:go,useDeferredValue:go,useTransition:go,useSyncExternalStore:go,useId:go,useHostTransitionStatus:go,useFormState:go,useActionState:go,useOptimistic:go,useMemoCache:go,useCacheRefresh:go};Ns.useEffectEvent=go;var Ps={readContext:Ji,use:ko,useCallback:function(e,t){return To().memoizedState=[e,t===void 0?null:t],e},useContext:Ji,useEffect:is,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ns(4194308,4,us.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ns(4194308,4,e,t)},useInsertionEffect:function(e,t){ns(4,2,e,t)},useMemo:function(e,t){var n=To();t=t===void 0?null:t;var r=e();if(uo){Ae(!0);try{e()}finally{Ae(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=To();if(n!==void 0){var i=n(t);if(uo){Ae(!0);try{n(t)}finally{Ae(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=Es.bind(null,K,e),[r.memoizedState,e]},useRef:function(e){var t=To();return e={current:e},t.memoizedState=e},useState:function(e){e=Vo(e);var t=e.queue,n=Ds.bind(null,K,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:fs,useDeferredValue:function(e,t){return hs(To(),e,t)},useTransition:function(){var e=Vo(!1);return e=_s.bind(null,K,e.queue,!0,!1),To().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=K,i=To();if(Di){if(n===void 0)throw Error(o(407));n=n()}else{if(n=t(),Ll===null)throw Error(o(349));zl&127||Io(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,is(Ro.bind(null,r,a,e),[e]),r.flags|=2048,es(9,{destroy:void 0},Lo.bind(null,r,a,n,t),null),n},useId:function(){var e=To(),t=Ll.identifierPrefix;if(Di){var n=yi,r=vi;n=(r&~(1<<32-je(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=fo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=ho++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ss,useFormState:Yo,useActionState:Yo,useOptimistic:function(e){var t=To();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=ks.bind(null,K,!0,n),n.dispatch=t,[e,t]},useMemoCache:Ao,useCacheRefresh:function(){return To().memoizedState=Ts.bind(null,K)},useEffectEvent:function(e){var t=To(),n={impl:e};return t.memoizedState=n,function(){if(Il&2)throw Error(o(440));return n.impl.apply(void 0,arguments)}}},Fs={readContext:Ji,use:ko,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Mo,useRef:ts,useState:function(){return Mo(jo)},useDebugValue:fs,useDeferredValue:function(e,t){return gs(Eo(),oo.memoizedState,e,t)},useTransition:function(){var e=Mo(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:Cs,useHostTransitionStatus:Ss,useFormState:Xo,useActionState:Xo,useOptimistic:function(e,t){return Ho(Eo(),oo,e,t)},useMemoCache:Ao,useCacheRefresh:ws};Fs.useEffectEvent=ss;var Is={readContext:Ji,use:ko,useCallback:ps,useContext:Ji,useEffect:as,useImperativeHandle:ds,useInsertionEffect:cs,useLayoutEffect:ls,useMemo:ms,useReducer:Po,useRef:ts,useState:function(){return Po(jo)},useDebugValue:fs,useDeferredValue:function(e,t){var n=Eo();return oo===null?hs(n,e,t):gs(n,oo.memoizedState,e,t)},useTransition:function(){var e=Po(jo)[0],t=Eo().memoizedState;return[typeof e==`boolean`?e:Oo(e),t]},useSyncExternalStore:Fo,useId:Cs,useHostTransitionStatus:Ss,useFormState:$o,useActionState:$o,useOptimistic:function(e,t){var n=Eo();return oo===null?(n.baseState=e,[e,n.queue.dispatch]):Ho(n,oo,e,t)},useMemoCache:Ao,useCacheRefresh:ws};Is.useEffectEvent=ss;function Ls(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:m({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Rs={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ia(r);i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(_u(t,e,r),Ra(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=hu(),i=Ia(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=La(e,i,r),t!==null&&(_u(t,e,r),Ra(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=hu(),r=Ia(n);r.tag=2,t!=null&&(r.callback=t),t=La(e,r,n),t!==null&&(_u(t,e,n),Ra(t,e,n))}};function zs(e,t,n,r,i,a,o){return e=e.stateNode,typeof e.shouldComponentUpdate==`function`?e.shouldComponentUpdate(r,a,o):t.prototype&&t.prototype.isPureReactComponent?!gr(n,r)||!gr(i,a):!0}function Bs(e,t,n,r){e=t.state,typeof t.componentWillReceiveProps==`function`&&t.componentWillReceiveProps(n,r),typeof t.UNSAFE_componentWillReceiveProps==`function`&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&Rs.enqueueReplaceState(t,t.state,null)}function Vs(e,t){var n=t;if(`ref`in t)for(var r in n={},t)r!==`ref`&&(n[r]=t[r]);if(e=e.defaultProps)for(var i in n===t&&(n=m({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function Hs(e){Ur(e)}function Us(e){console.error(e)}function Ws(e){Ur(e)}function Gs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Ks(e,t,n){try{var r=e.onCaughtError;r(n.value,{componentStack:n.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(e){setTimeout(function(){throw e})}}function qs(e,t,n){return n=Ia(n),n.tag=3,n.payload={element:null},n.callback=function(){Gs(e,t)},n}function Js(e){return e=Ia(e),e.tag=3,e}function Ys(e,t,n,r){var i=n.type.getDerivedStateFromError;if(typeof i==`function`){var a=r.value;e.payload=function(){return i(a)},e.callback=function(){Ks(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Ks(t,n,r),typeof i!=`function`&&(au===null?au=new Set([this]):au.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function Xs(e,t,n,r,i){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Gi(t,n,i,!0),n=Xa.current,n!==null){switch(n.tag){case 31:case 13:return Za===null?ku():n.alternate===null&&Kl===0&&(Kl=3),n.flags&=-257,n.flags|=65536,n.lanes=i,r===va?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Ju(e,r,i)),!1;case 22:return n.flags|=65536,r===va?n.flags|=16384:(t=n.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},n.updateQueue=t):(n=t.retryQueue,n===null?t.retryQueue=new Set([r]):n.add(r)),Ju(e,r,i)),!1}throw Error(o(435,n.tag))}return Ju(e,r,i),ku(),!1}if(Di)return t=Xa.current,t===null?(r!==Ai&&(t=Error(o(423),{cause:r}),Li(ui(t,n))),e=e.current.alternate,e.flags|=65536,i&=-i,e.lanes|=i,r=ui(r,n),i=qs(e.stateNode,r,i),za(e,i),Kl!==4&&(Kl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=i,r!==Ai&&(e=Error(o(422),{cause:r}),Li(ui(e,n)))),!1;var a=Error(o(520),{cause:r});if(a=ui(a,n),Ql===null?Ql=[a]:Ql.push(a),Kl!==4&&(Kl=2),t===null)return!0;r=ui(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=i&-i,n.lanes|=e,e=qs(n.stateNode,r,e),za(n,e),!1;case 1:if(t=n.type,a=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||a!==null&&typeof a.componentDidCatch==`function`&&(au===null||!au.has(a))))return n.flags|=65536,i&=-i,n.lanes|=i,i=Js(i),Ys(i,e,n,r),za(n,i),!1}n=n.return}while(n!==null);return!1}var Zs=Error(o(461)),Qs=!1;function $s(e,t,n,r){t.child=e===null?Ma(t,null,n,r):ja(t,e.child,n,r)}function ec(e,t,n,r,i){n=n.render;var a=t.ref;if(`ref`in r){var o={};for(var s in r)s!==`ref`&&(o[s]=r[s])}else o=r;return qi(t),r=vo(e,t,n,o,a,i),s=So(),e!==null&&!Qs?(Co(e,t,i),wc(e,t,i)):(Di&&s&&Si(t),t.flags|=1,$s(e,t,r,i),t.child)}function tc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!ni(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,nc(e,t,a,r,i)):(e=ai(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!Tc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?gr:n,n(o,r)&&e.ref===t.ref)return wc(e,t,i)}return t.flags|=1,e=ri(a,r),e.ref=t.ref,e.return=t,t.child=e}function nc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(gr(a,r)&&e.ref===t.ref)if(Qs=!1,t.pendingProps=r=a,Tc(e,i))e.flags&131072&&(Qs=!0);else return t.lanes=e.lanes,wc(e,t,i)}return uc(e,t,n,r,i)}function rc(e,t,n,r){var i=r.children,a=e===null?null:e.memoizedState;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode===`hidden`){if(t.flags&128){if(a=a===null?n:a.baseLanes|n,e!==null){for(r=t.child=e.child,i=0;r!==null;)i=i|r.lanes|r.childLanes,r=r.sibling;r=i&~a}else r=0,t.child=null;return ac(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&pa(t,a===null?null:a.cachePool),a===null?Ja():qa(t,a),eo(t);else return r=t.lanes=536870912,ac(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&pa(t,null),Ja(),to(t)):(pa(t,a.cachePool),qa(t,a),to(t),t.memoizedState=null);return $s(e,t,i,n),t.child}function ic(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function ac(e,t,n,r,i){var a=fa();return a=a===null?null:{parent:ea._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&pa(t,null),Ja(),eo(t),e!==null&&Gi(e,t,r,!0),t.childLanes=i,null}function oc(e,t){return t=yc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function sc(e,t,n){return ja(t,e.child,null,n),e=oc(t,t.pendingProps),e.flags|=2,no(t),t.memoizedState=null,e}function cc(e,t,n){var r=t.pendingProps,i=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Di){if(r.mode===`hidden`)return e=oc(t,r),t.lanes=536870912,ic(null,e);if($a(t),(e=Ei)?(e=cf(e,ki),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return t.lanes=536870912,null}return oc(t,r)}var a=e.memoizedState;if(a!==null){var s=a.dehydrated;if($a(t),i)if(t.flags&256)t.flags&=-257,t=sc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(o(558));else if(Qs||Gi(e,t,n,!1),i=(n&e.childLanes)!==0,Qs||i){if(r=Ll,r!==null&&(s=Je(r,n),s!==0&&s!==a.retryLane))throw a.retryLane=s,Xr(e,s),_u(r,e,s),Zs;ku(),t=sc(e,t,n)}else e=a.treeContext,Ei=ff(s.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=oc(t,r),t.flags|=4096;return t}return e=ri(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function lc(e,t){var n=t.ref;if(n===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof n!=`function`&&typeof n!=`object`)throw Error(o(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function uc(e,t,n,r,i){return qi(t),n=vo(e,t,n,r,void 0,i),r=So(),e!==null&&!Qs?(Co(e,t,i),wc(e,t,i)):(Di&&r&&Si(t),t.flags|=1,$s(e,t,n,i),t.child)}function dc(e,t,n,r,i,a){return qi(t),t.updateQueue=null,n=bo(t,r,n,i),yo(e),r=So(),e!==null&&!Qs?(Co(e,t,a),wc(e,t,a)):(Di&&r&&Si(t),t.flags|=1,$s(e,t,n,a),t.child)}function fc(e,t,n,r,i){if(qi(t),t.stateNode===null){var a=$r,o=n.contextType;typeof o==`object`&&o&&(a=Ji(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Rs,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Pa(t),o=n.contextType,a.context=typeof o==`object`&&o?Ji(o):$r,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Ls(t,n,o,r),a.state=t.memoizedState),typeof n.getDerivedStateFromProps==`function`||typeof a.getSnapshotBeforeUpdate==`function`||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(o=a.state,typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount(),o!==a.state&&Rs.enqueueReplaceState(a,a.state,null),Ha(t,r,a,i),Va(),a.state=t.memoizedState),typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!0}else if(e===null){a=t.stateNode;var s=t.memoizedProps,c=Vs(n,s);a.props=c;var l=a.context,u=n.contextType;o=$r,typeof u==`object`&&u&&(o=Ji(u));var d=n.getDerivedStateFromProps;u=typeof d==`function`||typeof a.getSnapshotBeforeUpdate==`function`,s=t.pendingProps!==s,u||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(s||l!==o)&&Bs(t,a,r,o),Na=!1;var f=t.memoizedState;a.state=f,Ha(t,r,a,i),Va(),l=t.memoizedState,s||f!==l||Na?(typeof d==`function`&&(Ls(t,n,d,r),l=t.memoizedState),(c=Na||zs(t,n,c,r,f,l,o))?(u||typeof a.UNSAFE_componentWillMount!=`function`&&typeof a.componentWillMount!=`function`||(typeof a.componentWillMount==`function`&&a.componentWillMount(),typeof a.UNSAFE_componentWillMount==`function`&&a.UNSAFE_componentWillMount()),typeof a.componentDidMount==`function`&&(t.flags|=4194308)):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=l),a.props=r,a.state=l,a.context=o,r=c):(typeof a.componentDidMount==`function`&&(t.flags|=4194308),r=!1)}else{a=t.stateNode,Fa(e,t),o=t.memoizedProps,u=Vs(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=$r,typeof l==`object`&&l&&(c=Ji(l)),s=n.getDerivedStateFromProps,(l=typeof s==`function`||typeof a.getSnapshotBeforeUpdate==`function`)||typeof a.UNSAFE_componentWillReceiveProps!=`function`&&typeof a.componentWillReceiveProps!=`function`||(o!==d||f!==c)&&Bs(t,a,r,c),Na=!1,f=t.memoizedState,a.state=f,Ha(t,r,a,i),Va();var p=t.memoizedState;o!==d||f!==p||Na||e!==null&&e.dependencies!==null&&Ki(e.dependencies)?(typeof s==`function`&&(Ls(t,n,s,r),p=t.memoizedState),(u=Na||zs(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Ki(e.dependencies))?(l||typeof a.UNSAFE_componentWillUpdate!=`function`&&typeof a.componentWillUpdate!=`function`||(typeof a.componentWillUpdate==`function`&&a.componentWillUpdate(r,p,c),typeof a.UNSAFE_componentWillUpdate==`function`&&a.UNSAFE_componentWillUpdate(r,p,c)),typeof a.componentDidUpdate==`function`&&(t.flags|=4),typeof a.getSnapshotBeforeUpdate==`function`&&(t.flags|=1024)):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=c,r=u):(typeof a.componentDidUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=4),typeof a.getSnapshotBeforeUpdate!=`function`||o===e.memoizedProps&&f===e.memoizedState||(t.flags|=1024),r=!1)}return a=r,lc(e,t),r=(t.flags&128)!=0,a||r?(a=t.stateNode,n=r&&typeof n.getDerivedStateFromError!=`function`?null:a.render(),t.flags|=1,e!==null&&r?(t.child=ja(t,e.child,null,i),t.child=ja(t,null,n,i)):$s(e,t,n,i),t.memoizedState=a.state,e=t.child):e=wc(e,t,i),e}function pc(e,t,n,r){return Fi(),t.flags|=256,$s(e,t,n,r),t.child}var mc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function hc(e){return{baseLanes:e,cachePool:ma()}}function gc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=Xl),e}function _c(e,t,n){var r=t.pendingProps,i=!1,a=(t.flags&128)!=0,s;if((s=a)||(s=e!==null&&e.memoizedState===null?!1:(ro.current&2)!=0),s&&(i=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Di){if(i?Qa(t):to(t),(e=Ei)?(e=cf(e,ki),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:_i===null?null:{id:vi,overflow:yi},retryLane:536870912,hydrationErrors:null},n=si(e),n.return=t,t.child=n,Ti=t,Ei=null)):e=null,e===null)throw ji(t);return uf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,i?(to(t),i=t.mode,c=yc({mode:`hidden`,children:c},i),r=oi(r,i,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(null,r)):(Qa(t),vc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(a)t.flags&256?(Qa(t),t.flags&=-257,t=bc(e,t,n)):t.memoizedState===null?(to(t),c=r.fallback,i=t.mode,r=yc({mode:`visible`,children:r.children},i),c=oi(c,i,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,ja(t,e.child,null,n),r=t.child,r.memoizedState=hc(n),r.childLanes=gc(e,s,n),t.memoizedState=mc,t=ic(null,r)):(to(t),t.child=e.child,t.flags|=128,t=null);else if(Qa(t),uf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(o(419)),r.stack=``,r.digest=s,Li({value:r,source:null,stack:null}),t=bc(e,t,n)}else if(Qs||Gi(e,t,n,!1),s=(n&e.childLanes)!==0,Qs||s){if(s=Ll,s!==null&&(r=Je(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,Xr(e,r),_u(s,e,r),Zs;lf(c)||ku(),t=bc(e,t,n)}else lf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ei=ff(c.nextSibling),Ti=t,Di=!0,Oi=null,ki=!1,e!==null&&wi(t,e),t=vc(t,r.children),t.flags|=4096);return t}return i?(to(t),c=r.fallback,i=t.mode,l=e.child,u=l.sibling,r=ri(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=oi(c,i,n,null),c.flags|=2):c=ri(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,ic(null,r),r=t.child,c=e.child.memoizedState,c===null?c=hc(n):(i=c.cachePool,i===null?i=ma():(l=ea._currentValue,i=i.parent===l?i:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:i}),r.memoizedState=c,r.childLanes=gc(e,s,n),t.memoizedState=mc,ic(e.child,r)):(Qa(t),n=e.child,e=n.sibling,n=ri(n,{mode:`visible`,children:r.children}),n.return=t,n.sibling=null,e!==null&&(s=t.deletions,s===null?(t.deletions=[e],t.flags|=16):s.push(e)),t.child=n,t.memoizedState=null,n)}function vc(e,t){return t=yc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function yc(e,t){return e=ti(22,e,null,t),e.lanes=0,e}function bc(e,t,n){return ja(t,e.child,null,n),e=vc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function xc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Ui(e.return,t,n)}function Sc(e,t,n,r,i,a){var o=e.memoizedState;o===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:i,treeForkCount:a}:(o.isBackwards=t,o.rendering=null,o.renderingStartTime=0,o.last=r,o.tail=n,o.tailMode=i,o.treeForkCount=a)}function Cc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=ro.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,z(ro,o),$s(e,t,r,n),r=Di?mi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&xc(e,n,t);else if(e.tag===19)xc(e,n,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break a;for(;e.sibling===null;){if(e.return===null||e.return===t)break a;e=e.return}e.sibling.return=e.return,e=e.sibling}switch(i){case`forwards`:for(n=t.child,i=null;n!==null;)e=n.alternate,e!==null&&io(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Sc(t,!1,i,n,a,r);break;case`backwards`:case`unstable_legacy-backwards`:for(n=null,i=t.child,t.child=null;i!==null;){if(e=i.alternate,e!==null&&io(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Sc(t,!0,n,null,a,r);break;case`together`:Sc(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function wc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),ql|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Gi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(o(153));if(t.child!==null){for(e=t.child,n=ri(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ri(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function Tc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Ki(e))):!0}function Ec(e,t,n){switch(t.tag){case 3:oe(t,t.stateNode.containerInfo),Vi(t,ea,e.memoizedState.cache),Fi();break;case 27:case 5:ce(t);break;case 4:oe(t,t.stateNode.containerInfo);break;case 10:Vi(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,$a(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(Qa(t),e=wc(e,t,n),e===null?null:e.sibling):_c(e,t,n):(Qa(t),t.flags|=128,null);Qa(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Gi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Cc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),z(ro,ro.current),r)break;return null;case 22:return t.lanes=0,rc(e,t,n,t.pendingProps);case 24:Vi(t,ea,e.memoizedState.cache)}return wc(e,t,n)}function Dc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)Qs=!0;else{if(!Tc(e,n)&&!(t.flags&128))return Qs=!1,Ec(e,t,n);Qs=!!(e.flags&131072)}else Qs=!1,Di&&t.flags&1048576&&xi(t,mi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=xa(t.elementType),t.type=e,typeof e==`function`)ni(e)?(r=Vs(e,r),t.tag=1,t=fc(null,t,e,r,n)):(t.tag=0,t=uc(null,t,e,r,n));else{if(e!=null){var i=e.$$typeof;if(i===C){t.tag=11,t=ec(null,t,e,r,n);break a}else if(i===E){t.tag=14,t=tc(null,t,e,r,n);break a}}throw t=M(e)||e,Error(o(306,t,``))}}return t;case 0:return uc(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,i=Vs(r,t.pendingProps),fc(e,t,r,i,n);case 3:a:{if(oe(t,t.stateNode.containerInfo),e===null)throw Error(o(387));r=t.pendingProps;var a=t.memoizedState;i=a.element,Fa(e,t),Ha(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Vi(t,ea,r),r!==a.cache&&Wi(t,[ea],n,!0),Va(),r=s.element,a.isDehydrated)if(a={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=a,t.memoizedState=a,t.flags&256){t=pc(e,t,r,n);break a}else if(r!==i){i=ui(Error(o(424)),t),Li(i),t=pc(e,t,r,n);break a}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName===`HTML`?e.ownerDocument.body:e}for(Ei=ff(e.firstChild),Ti=t,Di=!0,Oi=null,ki=!0,n=Ma(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Fi(),r===i){t=wc(e,t,n);break a}$s(e,t,r,n)}t=t.child}return t;case 26:return lc(e,t),e===null?(n=Nf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Di||(n=t.type,e=t.pendingProps,r=Wd(ie.current).createElement(n),r[et]=t,r[tt]=e,Rd(r,n,e),pt(r),t.stateNode=r):t.memoizedState=Nf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ce(t),e===null&&Di&&(r=t.stateNode=gf(t.type,t.pendingProps,ie.current),Ti=t,ki=!0,i=Ei,tf(t.type)?(pf=i,Ei=ff(r.firstChild)):Ei=i),$s(e,t,t.pendingProps.children,n),lc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Di&&((i=r=Ei)&&(r=of(r,t.type,t.pendingProps,ki),r===null?i=!1:(t.stateNode=r,Ti=t,Ei=ff(r.firstChild),ki=!1,i=!0)),i||ji(t)),ce(t),i=t.type,a=t.pendingProps,s=e===null?null:e.memoizedProps,r=a.children,qd(i,a)?r=null:s!==null&&qd(i,s)&&(t.flags|=32),t.memoizedState!==null&&(i=vo(e,t,xo,null,null,n),np._currentValue=i),lc(e,t),$s(e,t,r,n),t.child;case 6:return e===null&&Di&&((e=n=Ei)&&(n=sf(n,t.pendingProps,ki),n===null?e=!1:(t.stateNode=n,Ti=t,Ei=null,e=!0)),e||ji(t)),null;case 13:return _c(e,t,n);case 4:return oe(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=ja(t,null,r,n):$s(e,t,r,n),t.child;case 11:return ec(e,t,t.type,t.pendingProps,n);case 7:return $s(e,t,t.pendingProps,n),t.child;case 8:return $s(e,t,t.pendingProps.children,n),t.child;case 12:return $s(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Vi(t,t.type,r.value),$s(e,t,r.children,n),t.child;case 9:return i=t.type._context,r=t.pendingProps.children,qi(t),i=Ji(i),r=r(i),t.flags|=1,$s(e,t,r,n),t.child;case 14:return tc(e,t,t.type,t.pendingProps,n);case 15:return nc(e,t,t.type,t.pendingProps,n);case 19:return Cc(e,t,n);case 31:return cc(e,t,n);case 22:return rc(e,t,n,t.pendingProps);case 24:return qi(t),r=Ji(ea),e===null?(i=fa(),i===null&&(i=Ll,a=ta(),i.pooledCache=a,a.refCount++,a!==null&&(i.pooledCacheLanes|=n),i=a),t.memoizedState={parent:r,cache:i},Pa(t),Vi(t,ea,i)):((e.lanes&n)!==0&&(Fa(e,t),Ha(t,null,null,n),Va()),i=e.memoizedState,a=t.memoizedState,i.parent===r?(r=a.cache,Vi(t,ea,r),r!==i.cache&&Wi(t,[ea],n,!0)):(i={parent:r,cache:r},t.memoizedState=i,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=i),Vi(t,ea,r))),$s(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(o(156,t.tag))}function Oc(e){e.flags|=4}function kc(e,t,n,r,i){if((t=(e.mode&32)!=0)&&(t=!1),t){if(e.flags|=16777216,(i&335544128)===i)if(e.stateNode.complete)e.flags|=8192;else if(Eu())e.flags|=8192;else throw Sa=va,ga}else e.flags&=-16777217}function Ac(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Jf(t))if(Eu())e.flags|=8192;else throw Sa=va,ga}function jc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:He(),e.lanes|=t,Zl|=t)}function Mc(e,t){if(!Di)switch(e.tailMode){case`hidden`:t=e.tail;for(var n=null;t!==null;)t.alternate!==null&&(n=t),t=t.sibling;n===null?e.tail=null:n.sibling=null;break;case`collapsed`:n=e.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function Nc(e){var t=e.alternate!==null&&e.alternate.child===e.child,n=0,r=0;if(t)for(var i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags&65011712,r|=i.flags&65011712,i.return=e,i=i.sibling;else for(i=e.child;i!==null;)n|=i.lanes|i.childLanes,r|=i.subtreeFlags,r|=i.flags,i.return=e,i=i.sibling;return e.subtreeFlags|=r,e.childLanes=n,t}function Pc(e,t,n){var r=t.pendingProps;switch(Ci(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Nc(t),null;case 1:return Nc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Hi(ea),se(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Pi(t)?Oc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ii())),Nc(t),null;case 26:var i=t.type,a=t.memoizedState;return e===null?(Oc(t),a===null?(Nc(t),kc(t,i,null,r,n)):(Nc(t),Ac(t,a))):a?a===e.memoizedState?(Nc(t),t.flags&=-16777217):(Oc(t),Nc(t),Ac(t,a)):(e=e.memoizedProps,e!==r&&Oc(t),Nc(t),kc(t,i,e,r,n)),null;case 27:if(le(t),n=ie.current,i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Nc(t),null}e=B.current,Pi(t)?Mi(t,e):(e=gf(i,r,n),t.stateNode=e,Oc(t))}return Nc(t),null;case 5:if(le(t),i=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(!r){if(t.stateNode===null)throw Error(o(166));return Nc(t),null}if(a=B.current,Pi(t))Mi(t,a);else{var s=Wd(ie.current);switch(a){case 1:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case 2:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;default:switch(i){case`svg`:a=s.createElementNS(`http://www.w3.org/2000/svg`,i);break;case`math`:a=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,i);break;case`script`:a=s.createElement(`div`),a.innerHTML=`<script><\/script>`,a=a.removeChild(a.firstChild);break;case`select`:a=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is==`string`?s.createElement(i,{is:r.is}):s.createElement(i)}}a[et]=t,a[tt]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)a.appendChild(s.stateNode);else if(s.tag!==4&&s.tag!==27&&s.child!==null){s.child.return=s,s=s.child;continue}if(s===t)break a;for(;s.sibling===null;){if(s.return===null||s.return===t)break a;s=s.return}s.sibling.return=s.return,s=s.sibling}t.stateNode=a;a:switch(Rd(a,i,r),i){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Oc(t)}}return Nc(t),kc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Oc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(o(166));if(e=ie.current,Pi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=Ti,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[et]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||Fd(e.nodeValue,n)),e||ji(t,!0)}else e=Wd(e).createTextNode(r),e[et]=t,t.stateNode=e}return Nc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Pi(t),n!==null){if(e===null){if(!r)throw Error(o(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(o(557));e[et]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),e=!1}else n=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(no(t),t):(no(t),null);if(t.flags&128)throw Error(o(558))}return Nc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=Pi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(o(318));if(i=t.memoizedState,i=i===null?null:i.dehydrated,!i)throw Error(o(317));i[et]=t}else Fi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Nc(t),i=!1}else i=Ii(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(no(t),t):(no(t),null)}return no(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),jc(t,t.updateQueue),Nc(t),null);case 4:return se(),e===null&&Td(t.stateNode.containerInfo),Nc(t),null;case 10:return Hi(t.type),Nc(t),null;case 19:if(R(ro),r=t.memoizedState,r===null)return Nc(t),null;if(i=(t.flags&128)!=0,a=r.rendering,a===null)if(i)Mc(r,!1);else{if(Kl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(a=io(e),a!==null){for(t.flags|=128,Mc(r,!1),e=a.updateQueue,t.updateQueue=e,jc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)ii(n,e),n=n.sibling;return z(ro,ro.current&1|2),Di&&bi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&xe()>ru&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304)}else{if(!i)if(e=io(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,jc(t,e),Mc(r,!0),r.tail===null&&r.tailMode===`hidden`&&!a.alternate&&!Di)return Nc(t),null}else 2*xe()-r.renderingStartTime>ru&&n!==536870912&&(t.flags|=128,i=!0,Mc(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e===null?t.child=a:e.sibling=a,r.last=a)}return r.tail===null?(Nc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=xe(),e.sibling=null,n=ro.current,z(ro,i?n&1|2:n&1),Di&&bi(t,r.treeForkCount),e);case 22:case 23:return no(t),Ya(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Nc(t),t.subtreeFlags&6&&(t.flags|=8192)):Nc(t),n=t.updateQueue,n!==null&&jc(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&R(da),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Hi(ea),Nc(t),null;case 25:return null;case 30:return null}throw Error(o(156,t.tag))}function Fc(e,t){switch(Ci(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Hi(ea),se(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return le(t),null;case 31:if(t.memoizedState!==null){if(no(t),t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(no(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(o(340));Fi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return R(ro),null;case 4:return se(),null;case 10:return Hi(t.type),null;case 22:case 23:return no(t),Ya(),e!==null&&R(da),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Hi(ea),null;case 25:return null;default:return null}}function Ic(e,t){switch(Ci(t),t.tag){case 3:Hi(ea),se();break;case 26:case 27:case 5:le(t);break;case 4:se();break;case 31:t.memoizedState!==null&&no(t);break;case 13:no(t);break;case 19:R(ro);break;case 10:Hi(t.type);break;case 22:case 23:no(t),Ya(),e!==null&&R(da);break;case 24:Hi(ea)}}function Lc(e,t){try{var n=t.updateQueue,r=n===null?null:n.lastEffect;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(e){qu(t,t.return,e)}}function Rc(e,t,n){try{var r=t.updateQueue,i=r===null?null:r.lastEffect;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var c=n,l=s;try{l()}catch(e){qu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){qu(t,t.return,e)}}function zc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Wa(t,n)}catch(t){qu(e,e.return,t)}}}function Bc(e,t,n){n.props=Vs(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){qu(e,t,n)}}function Vc(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n==`function`?e.refCleanup=n(r):n.current=r}}catch(n){qu(e,t,n)}}function Hc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){qu(e,t,n)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n==`function`)try{n(null)}catch(n){qu(e,t,n)}else n.current=null}function Uc(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{a:switch(t){case`button`:case`input`:case`select`:case`textarea`:n.autoFocus&&r.focus();break a;case`img`:n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(t){qu(e,e.return,t)}}function Wc(e,t,n){try{var r=e.stateNode;zd(r,e.type,n,t),r[tt]=t}catch(t){qu(e,e.return,t)}}function Gc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&tf(e.type)||e.tag===4}function Kc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Gc(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&tf(e.type)||e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function qc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName===`HTML`?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=qt));else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(qc(e,t,n),e=e.sibling;e!==null;)qc(e,t,n),e=e.sibling}function Jc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&tf(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Jc(e,t,n),e=e.sibling;e!==null;)Jc(e,t,n),e=e.sibling}function Yc(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Rd(t,r,n),t[et]=e,t[tt]=n}catch(t){qu(e,e.return,t)}}var Xc=!1,Zc=!1,Qc=!1,$c=typeof WeakSet==`function`?WeakSet:Set,el=null;function tl(e,t){if(e=e.containerInfo,Hd=dp,e=br(e),xr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||i!==0&&f.nodeType!==3||(c=s+i),f!==a||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===i&&(c=s),p===a&&++d===r&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(Ud={focusedElem:e,selectionRange:n},dp=!1,el=t;el!==null;)if(t=el,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,el=e;else for(;el!==null;){switch(t=el,a=t.alternate,e=t.flags,t.tag){case 0:if(e&4&&(e=t.updateQueue,e=e===null?null:e.events,e!==null))for(n=0;n<e.length;n++)i=e[n],i.ref.impl=i.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&a!==null){e=void 0,n=t,i=a.memoizedProps,a=a.memoizedState,r=n.stateNode;try{var h=Vs(n.type,i);e=r.getSnapshotBeforeUpdate(h,a),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){qu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)af(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:af(e);break;default:e.textContent=``}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if(e&1024)throw Error(o(163))}if(e=t.sibling,e!==null){e.return=t.return,el=e;break}el=t.return}}function nl(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:_l(e,n),r&4&&Lc(5,n);break;case 1:if(_l(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){qu(n,n.return,e)}else{var i=Vs(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){qu(n,n.return,e)}}r&64&&zc(n),r&512&&Vc(n,n.return);break;case 3:if(_l(e,n),r&64&&(e=n.updateQueue,e!==null)){if(t=null,n.child!==null)switch(n.child.tag){case 27:case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}try{Wa(e,t)}catch(e){qu(n,n.return,e)}}break;case 27:t===null&&r&4&&Yc(n);case 26:case 5:_l(e,n),t===null&&r&4&&Uc(n),r&512&&Vc(n,n.return);break;case 12:_l(e,n);break;case 31:_l(e,n),r&4&&cl(e,n);break;case 13:_l(e,n),r&4&&ll(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=Zu.bind(null,n),df(e,n))));break;case 22:if(r=n.memoizedState!==null||Xc,!r){t=t!==null&&t.memoizedState!==null||Zc,i=Xc;var a=Zc;Xc=r,(Zc=t)&&!a?yl(e,n,(n.subtreeFlags&8772)!=0):_l(e,n),Xc=i,Zc=a}break;case 30:break;default:_l(e,n)}}function rl(e){var t=e.alternate;t!==null&&(e.alternate=null,rl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&ct(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var il=null,al=!1;function ol(e,t,n){for(n=n.child;n!==null;)sl(e,t,n),n=n.sibling}function sl(e,t,n){if(ke&&typeof ke.onCommitFiberUnmount==`function`)try{ke.onCommitFiberUnmount(Oe,n)}catch{}switch(n.tag){case 26:Zc||Hc(n,t),ol(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:Zc||Hc(n,t);var r=il,i=al;tf(n.type)&&(il=n.stateNode,al=!1),ol(e,t,n),_f(n.stateNode),il=r,al=i;break;case 5:Zc||Hc(n,t);case 6:if(r=il,i=al,il=null,ol(e,t,n),il=r,al=i,il!==null)if(al)try{(il.nodeType===9?il.body:il.nodeName===`HTML`?il.ownerDocument.body:il).removeChild(n.stateNode)}catch(e){qu(n,t,e)}else try{il.removeChild(n.stateNode)}catch(e){qu(n,t,e)}break;case 18:il!==null&&(al?(e=il,nf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Lp(e)):nf(il,n.stateNode));break;case 4:r=il,i=al,il=n.stateNode.containerInfo,al=!0,ol(e,t,n),il=r,al=i;break;case 0:case 11:case 14:case 15:Rc(2,n,t),Zc||Rc(4,n,t),ol(e,t,n);break;case 1:Zc||(Hc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Bc(n,t,r)),ol(e,t,n);break;case 21:ol(e,t,n);break;case 22:Zc=(r=Zc)||n.memoizedState!==null,ol(e,t,n),Zc=r;break;default:ol(e,t,n)}}function cl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Lp(e)}catch(e){qu(t,t.return,e)}}}function ll(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Lp(e)}catch(e){qu(t,t.return,e)}}function ul(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new $c),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new $c),t;default:throw Error(o(435,e.tag))}}function dl(e,t){var n=ul(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=Qu.bind(null,e,t);t.then(r,r)}})}function fl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r],a=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(tf(c.type)){il=c.stateNode,al=!1;break a}break;case 5:il=c.stateNode,al=!1;break a;case 3:case 4:il=c.stateNode.containerInfo,al=!0;break a}c=c.return}if(il===null)throw Error(o(160));sl(a,s,i),il=null,al=!1,a=i.alternate,a!==null&&(a.return=null),i.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)ml(t,e),t=t.sibling}var pl=null;function ml(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:fl(t,e),hl(e),r&4&&(Rc(3,e,e.return),Lc(3,e),Rc(5,e,e.return));break;case 1:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&64&&Xc&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(n=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=n===null?r:n.concat(r))));break;case 26:var i=pl;if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),r&4){var a=n===null?null:n.memoizedState;if(r=e.memoizedState,n===null)if(r===null)if(e.stateNode===null){a:{r=e.type,n=e.memoizedProps,i=i.ownerDocument||i;b:switch(r){case`title`:a=i.getElementsByTagName(`title`)[0],(!a||a[st]||a[et]||a.namespaceURI===`http://www.w3.org/2000/svg`||a.hasAttribute(`itemprop`))&&(a=i.createElement(r),i.head.insertBefore(a,i.querySelector(`head > title`))),Rd(a,r,n),a[et]=e,pt(a),r=a;break a;case`link`:var s=Gf(`link`,`href`,i).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&a.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&a.getAttribute(`title`)===(n.title==null?null:n.title)&&a.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}a=i.createElement(r),Rd(a,r,n),i.head.appendChild(a);break;case`meta`:if(s=Gf(`meta`,`content`,i).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(a=s[c],a.getAttribute(`content`)===(n.content==null?null:``+n.content)&&a.getAttribute(`name`)===(n.name==null?null:n.name)&&a.getAttribute(`property`)===(n.property==null?null:n.property)&&a.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&a.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}a=i.createElement(r),Rd(a,r,n),i.head.appendChild(a);break;default:throw Error(o(468,r))}a[et]=e,pt(a),r=a}e.stateNode=r}else Kf(i,e.type,e.stateNode);else e.stateNode=Bf(i,r,e.memoizedProps);else a===r?r===null&&e.stateNode!==null&&Wc(e,e.memoizedProps,n.memoizedProps):(a===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):a.count--,r===null?Kf(i,e.type,e.stateNode):Bf(i,r,e.memoizedProps))}break;case 27:fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),n!==null&&r&4&&Wc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(fl(t,e),hl(e),r&512&&(Zc||n===null||Hc(n,n.return)),e.flags&32){i=e.stateNode;try{zt(i,``)}catch(t){qu(e,e.return,t)}}r&4&&e.stateNode!=null&&(i=e.memoizedProps,Wc(e,i,n===null?i:n.memoizedProps)),r&1024&&(Qc=!0);break;case 6:if(fl(t,e),hl(e),r&4){if(e.stateNode===null)throw Error(o(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){qu(e,e.return,t)}}break;case 3:if(Wf=null,i=pl,pl=bf(t.containerInfo),fl(t,e),pl=i,hl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Lp(t.containerInfo)}catch(t){qu(e,e.return,t)}Qc&&(Qc=!1,gl(e));break;case 4:r=pl,pl=bf(e.stateNode.containerInfo),fl(t,e),hl(e),pl=r;break;case 12:fl(t,e),hl(e);break;case 31:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 13:fl(t,e),hl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(tu=xe()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 22:i=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=Xc,d=Zc;if(Xc=u||i,Zc=d||l,fl(t,e),Zc=d,Xc=u,hl(e),r&8192)a:for(t=e.stateNode,t._visibility=i?t._visibility&-2:t._visibility|1,i&&(n===null||l||Xc||Zc||vl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(a=l.stateNode,i)s=a.style,typeof s.setProperty==`function`?s.setProperty(`display`,`none`,`important`):s.display=`none`;else{c=l.stateNode;var f=l.memoizedProps.style,p=f!=null&&f.hasOwnProperty(`display`)?f.display:null;c.style.display=p==null||typeof p==`boolean`?``:(``+p).trim()}}catch(e){qu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=i?``:l.memoizedProps}catch(e){qu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;i?rf(m,!0):rf(l.stateNode,!1)}catch(e){qu(l,l.return,e)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break a;for(;t.sibling===null;){if(t.return===null||t.return===e)break a;n===t&&(n=null),t=t.return}n===t&&(n=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(n=r.retryQueue,n!==null&&(r.retryQueue=null,dl(e,n))));break;case 19:fl(t,e),hl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,dl(e,r)));break;case 30:break;case 21:break;default:fl(t,e),hl(e)}}function hl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Gc(r)){n=r;break}r=r.return}if(n==null)throw Error(o(160));switch(n.tag){case 27:var i=n.stateNode;Jc(e,Kc(e),i);break;case 5:var a=n.stateNode;n.flags&32&&(zt(a,``),n.flags&=-33),Jc(e,Kc(e),a);break;case 3:case 4:var s=n.stateNode.containerInfo;qc(e,Kc(e),s);break;default:throw Error(o(161))}}catch(t){qu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function gl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;gl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function _l(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)nl(e,t.alternate,t),t=t.sibling}function vl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Rc(4,t,t.return),vl(t);break;case 1:Hc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Bc(t,t.return,n),vl(t);break;case 27:_f(t.stateNode);case 26:case 5:Hc(t,t.return),vl(t);break;case 22:t.memoizedState===null&&vl(t);break;case 30:vl(t);break;default:vl(t)}e=e.sibling}}function yl(e,t,n){for(n&&=(t.subtreeFlags&8772)!=0,t=t.child;t!==null;){var r=t.alternate,i=e,a=t,o=a.flags;switch(a.tag){case 0:case 11:case 15:yl(i,a,n),Lc(4,a);break;case 1:if(yl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){qu(r,r.return,e)}if(r=a,i=r.updateQueue,i!==null){var s=r.stateNode;try{var c=i.shared.hiddenCallbacks;if(c!==null)for(i.shared.hiddenCallbacks=null,i=0;i<c.length;i++)Ua(c[i],s)}catch(e){qu(r,r.return,e)}}n&&o&64&&zc(a),Vc(a,a.return);break;case 27:Yc(a);case 26:case 5:yl(i,a,n),n&&r===null&&o&4&&Uc(a),Vc(a,a.return);break;case 12:yl(i,a,n);break;case 31:yl(i,a,n),n&&o&4&&cl(i,a);break;case 13:yl(i,a,n),n&&o&4&&ll(i,a);break;case 22:a.memoizedState===null&&yl(i,a,n),Vc(a,a.return);break;case 30:break;default:yl(i,a,n)}t=t.sibling}}function bl(e,t){var n=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==n&&(e!=null&&e.refCount++,n!=null&&na(n))}function xl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e))}function Sl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Cl(e,t,n,r),t=t.sibling}function Cl(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Sl(e,t,n,r),i&2048&&Lc(9,t);break;case 1:Sl(e,t,n,r);break;case 3:Sl(e,t,n,r),i&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&na(e)));break;case 12:if(i&2048){Sl(e,t,n,r),e=t.stateNode;try{var a=t.memoizedProps,o=a.id,s=a.onPostCommit;typeof s==`function`&&s(o,t.alternate===null?`mount`:`update`,e.passiveEffectDuration,-0)}catch(e){qu(t,t.return,e)}}else Sl(e,t,n,r);break;case 31:Sl(e,t,n,r);break;case 13:Sl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Sl(e,t,n,r):(a._visibility|=2,Tl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Sl(e,t,n,r):El(e,t),i&2048&&bl(o,t);break;case 24:Sl(e,t,n,r),i&2048&&xl(t.alternate,t);break;default:Sl(e,t,n,r)}}function Tl(e,t,n,r,i){for(i&&=(t.subtreeFlags&10256)!=0||!1,t=t.child;t!==null;){var a=e,o=t,s=n,c=r,l=o.flags;switch(o.tag){case 0:case 11:case 15:Tl(a,o,s,c,i),Lc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Tl(a,o,s,c,i)):u._visibility&2?Tl(a,o,s,c,i):El(a,o),i&&l&2048&&bl(o.alternate,o);break;case 24:Tl(a,o,s,c,i),i&&l&2048&&xl(o.alternate,o);break;default:Tl(a,o,s,c,i)}t=t.sibling}}function El(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var n=e,r=t,i=r.flags;switch(r.tag){case 22:El(n,r),i&2048&&bl(r.alternate,r);break;case 24:El(n,r),i&2048&&xl(r.alternate,r);break;default:El(n,r)}t=t.sibling}}var J=8192;function Dl(e,t,n){if(e.subtreeFlags&J)for(e=e.child;e!==null;)Ol(e,t,n),e=e.sibling}function Ol(e,t,n){switch(e.tag){case 26:Dl(e,t,n),e.flags&J&&e.memoizedState!==null&&Yf(n,pl,e.memoizedState,e.memoizedProps);break;case 5:Dl(e,t,n);break;case 3:case 4:var r=pl;pl=bf(e.stateNode.containerInfo),Dl(e,t,n),pl=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=J,J=16777216,Dl(e,t,n),J=r):Dl(e,t,n));break;default:Dl(e,t,n)}}function kl(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function Al(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)jl(e),e=e.sibling}function jl(e){switch(e.tag){case 0:case 11:case 15:Al(e),e.flags&2048&&Rc(9,e,e.return);break;case 3:Al(e);break;case 12:Al(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Ml(e)):Al(e);break;default:Al(e)}}function Ml(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];el=r,Nl(r,e)}kl(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Rc(8,t,t.return),Ml(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Ml(t));break;default:Ml(t)}e=e.sibling}}function Nl(e,t){for(;el!==null;){var n=el;switch(n.tag){case 0:case 11:case 15:Rc(8,n,t);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var r=n.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:na(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,el=r;else a:for(n=e;el!==null;){r=el;var i=r.sibling,a=r.return;if(rl(r),r===n){el=null;break a}if(i!==null){i.return=a,el=i;break a}el=a}}}var Pl={getCacheForType:function(e){var t=Ji(ea),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return Ji(ea).controller.signal}},Fl=typeof WeakMap==`function`?WeakMap:Map,Il=0,Ll=null,Rl=null,zl=0,Bl=0,Vl=null,Hl=!1,Ul=!1,Wl=!1,Gl=0,Kl=0,ql=0,Jl=0,Yl=0,Xl=0,Zl=0,Ql=null,$l=null,eu=!1,tu=0,nu=0,ru=1/0,iu=null,au=null,ou=0,su=null,cu=null,lu=0,uu=0,du=null,fu=null,pu=0,mu=null;function hu(){return Il&2&&zl!==0?zl&-zl:P.T===null?Ze():md()}function gu(){if(Xl===0)if(!(zl&536870912)||Di){var e=Ie;Ie<<=1,!(Ie&3932160)&&(Ie=262144),Xl=e}else Xl=536870912;return e=Xa.current,e!==null&&(e.flags|=32),Xl}function _u(e,t,n){(e===Ll&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)&&(wu(e,0),xu(e,zl,Xl,!1)),We(e,n),(!(Il&2)||e!==Ll)&&(e===Ll&&(!(Il&2)&&(Jl|=n),Kl===4&&xu(e,zl,Xl,!1)),od(e))}function vu(e,t,n){if(Il&6)throw Error(o(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Be(e,t),i=r?Mu(e,t):Au(e,t,!0),a=r;do{if(i===0){Ul&&!r&&xu(e,t,0,!1);break}else{if(n=e.current.alternate,a&&!bu(n)){i=Au(e,t,!1),a=!1;continue}if(i===2){if(a=t,e.errorRecoveryDisabledLanes&a)var s=0;else s=e.pendingLanes&-536870913,s=s===0?s&536870912?536870912:0:s;if(s!==0){t=s;a:{var c=e;i=Ql;var l=c.current.memoizedState.isDehydrated;if(l&&(wu(c,s).flags|=256),s=Au(c,s,!1),s!==2){if(Wl&&!l){c.errorRecoveryDisabledLanes|=a,Jl|=a,i=4;break a}a=$l,$l=i,a!==null&&($l===null?$l=a:$l.push.apply($l,a))}i=s}if(a=!1,i!==2)continue}}if(i===1){wu(e,0),xu(e,t,0,!0);break}a:{switch(r=e,a=i,a){case 0:case 1:throw Error(o(345));case 4:if((t&4194048)!==t)break;case 6:xu(r,t,Xl,!Hl);break a;case 2:$l=null;break;case 3:case 5:break;default:throw Error(o(329))}if((t&62914560)===t&&(i=tu+300-xe(),10<i)){if(xu(r,t,Xl,!Hl),ze(r,0,!0)!==0)break a;lu=t,r.timeoutHandle=Xd(yu.bind(null,r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,a,`Throttled`,-0,0),i);break a}yu(r,n,$l,iu,eu,t,Xl,Jl,Zl,Hl,a,null,-0,0)}}break}while(1);od(e)}function yu(e,t,n,r,i,a,o,s,c,l,u,d,f,p){if(e.timeoutHandle=-1,d=t.subtreeFlags,d&8192||(d&16785408)==16785408){d={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:qt},Ol(t,a,d);var m=(a&62914560)===a?tu-xe():(a&4194048)===a?nu-xe():0;if(m=Zf(d,m),m!==null){lu=a,e.cancelPendingCommit=m(zu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),xu(e,a,o,!l);return}}zu(e,t,a,n,r,i,o,s,c)}function bu(e){for(var t=e;;){var n=t.tag;if((n===0||n===11||n===15)&&t.flags&16384&&(n=t.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var r=0;r<n.length;r++){var i=n[r],a=i.getSnapshot;i=i.value;try{if(!hr(a(),i))return!1}catch{return!1}}if(n=t.child,t.subtreeFlags&16384&&n!==null)n.return=t,t=n;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function xu(e,t,n,r){t&=~Yl,t&=~Jl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-je(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&Ke(e,n,t)}function Su(){return Il&6?!0:(sd(0,!1),!1)}function Cu(){if(Rl!==null){if(Bl===0)var e=Rl.return;else e=Rl,Bi=zi=null,wo(e),Ta=null,Ea=0,e=Rl;for(;e!==null;)Ic(e.alternate,e),e=e.return;Rl=null}}function wu(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,Zd(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),lu=0,Cu(),Ll=e,Rl=n=ri(e.current,null),zl=t,Bl=0,Vl=null,Hl=!1,Ul=Be(e,t),Wl=!1,Zl=Xl=Yl=Jl=ql=Kl=0,$l=Ql=null,eu=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-je(r),a=1<<i;t|=e[i],r&=~a}return Gl=t,qr(),n}function Tu(e,t){K=null,P.H=Ns,t===ha||t===_a?(t=Ca(),Bl=3):t===ga?(t=Ca(),Bl=4):Bl=t===Zs?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Vl=t,Rl===null&&(Kl=1,Gs(e,ui(t,e.current)))}function Eu(){var e=Xa.current;return e===null?!0:(zl&4194048)===zl?Za===null:(zl&62914560)===zl||zl&536870912?e===Za:!1}function Du(){var e=P.H;return P.H=Ns,e===null?Ns:e}function Ou(){var e=P.A;return P.A=Pl,e}function ku(){Kl=4,Hl||(zl&4194048)!==zl&&Xa.current!==null||(Ul=!0),!(ql&134217727)&&!(Jl&134217727)||Ll===null||xu(Ll,zl,Xl,!1)}function Au(e,t,n){var r=Il;Il|=2;var i=Du(),a=Ou();(Ll!==e||zl!==t)&&(iu=null,wu(e,t)),t=!1;var o=Kl;a:do try{if(Bl!==0&&Rl!==null){var s=Rl,c=Vl;switch(Bl){case 8:Cu(),o=6;break a;case 3:case 2:case 9:case 6:Xa.current===null&&(t=!0);var l=Bl;if(Bl=0,Vl=null,Iu(e,s,c,l),n&&Ul){o=0;break a}break;default:l=Bl,Bl=0,Vl=null,Iu(e,s,c,l)}}ju(),o=Kl;break}catch(t){Tu(e,t)}while(1);return t&&e.shellSuspendCounter++,Bi=zi=null,Il=r,P.H=i,P.A=a,Rl===null&&(Ll=null,zl=0,qr()),o}function ju(){for(;Rl!==null;)Pu(Rl)}function Mu(e,t){var n=Il;Il|=2;var r=Du(),i=Ou();Ll!==e||zl!==t?(iu=null,ru=xe()+500,wu(e,t)):Ul=Be(e,t);a:do try{if(Bl!==0&&Rl!==null){t=Rl;var a=Vl;b:switch(Bl){case 1:Bl=0,Vl=null,Iu(e,t,a,1);break;case 2:case 9:if(ya(a)){Bl=0,Vl=null,Fu(t);break}t=function(){Bl!==2&&Bl!==9||Ll!==e||(Bl=7),od(e)},a.then(t,t);break a;case 3:Bl=7;break a;case 4:Bl=5;break a;case 7:ya(a)?(Bl=0,Vl=null,Fu(t)):(Bl=0,Vl=null,Iu(e,t,a,7));break;case 5:var s=null;switch(Rl.tag){case 26:s=Rl.memoizedState;case 5:case 27:var c=Rl;if(s?Jf(s):c.stateNode.complete){Bl=0,Vl=null;var l=c.sibling;if(l!==null)Rl=l;else{var u=c.return;u===null?Rl=null:(Rl=u,Lu(u))}break b}}Bl=0,Vl=null,Iu(e,t,a,5);break;case 6:Bl=0,Vl=null,Iu(e,t,a,6);break;case 8:Cu(),Kl=6;break a;default:throw Error(o(462))}}Nu();break}catch(t){Tu(e,t)}while(1);return Bi=zi=null,P.H=r,P.A=i,Il=n,Rl===null?(Ll=null,zl=0,qr(),Kl):0}function Nu(){for(;Rl!==null&&!ye();)Pu(Rl)}function Pu(e){var t=Dc(e.alternate,e,Gl);e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Fu(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=dc(n,t,t.pendingProps,t.type,void 0,zl);break;case 11:t=dc(n,t,t.pendingProps,t.type.render,t.ref,zl);break;case 5:wo(t);default:Ic(n,t),t=Rl=ii(t,Gl),t=Dc(n,t,Gl)}e.memoizedProps=e.pendingProps,t===null?Lu(e):Rl=t}function Iu(e,t,n,r){Bi=zi=null,wo(t),Ta=null,Ea=0;var i=t.return;try{if(Xs(e,i,t,n,zl)){Kl=1,Gs(e,ui(n,e.current)),Rl=null;return}}catch(t){if(i!==null)throw Rl=i,t;Kl=1,Gs(e,ui(n,e.current)),Rl=null;return}t.flags&32768?(Di||r===1?e=!0:Ul||zl&536870912?e=!1:(Hl=e=!0,(r===2||r===9||r===3||r===6)&&(r=Xa.current,r!==null&&r.tag===13&&(r.flags|=16384))),Ru(t,e)):Lu(t)}function Lu(e){var t=e;do{if(t.flags&32768){Ru(t,Hl);return}e=t.return;var n=Pc(t.alternate,t,Gl);if(n!==null){Rl=n;return}if(t=t.sibling,t!==null){Rl=t;return}Rl=t=e}while(t!==null);Kl===0&&(Kl=5)}function Ru(e,t){do{var n=Fc(e.alternate,e);if(n!==null){n.flags&=32767,Rl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Rl=e;return}Rl=e=n}while(e!==null);Kl=6,Rl=null}function zu(e,t,n,r,i,a,s,c,l){e.cancelPendingCommit=null;do Wu();while(ou!==0);if(Il&6)throw Error(o(327));if(t!==null){if(t===e.current)throw Error(o(177));if(a=t.lanes|t.childLanes,a|=Kr,Ge(e,n,a,s,c,l),e===Ll&&(Rl=Ll=null,zl=0),cu=t,su=e,lu=n,uu=a,du=i,fu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,$u(we,function(){return Gu(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=P.T,P.T=null,i=F.p,F.p=2,s=Il,Il|=4;try{tl(e,t,n)}finally{Il=s,F.p=i,P.T=r}}ou=1,Bu(),Vu(),Hu()}}function Bu(){if(ou===1){ou=0;var e=su,t=cu,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Il;Il|=4;try{ml(t,e);var a=Ud,o=br(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&yr(s.ownerDocument.documentElement,s)){if(c!==null&&xr(s)){var l=c.start,u=c.end;if(u===void 0&&(u=l),`selectionStart`in s)s.selectionStart=l,s.selectionEnd=Math.min(u,s.value.length);else{var d=s.ownerDocument||document,f=d&&d.defaultView||window;if(f.getSelection){var p=f.getSelection(),m=s.textContent.length,h=Math.min(c.start,m),g=c.end===void 0?h:Math.min(c.end,m);!p.extend&&h>g&&(o=g,g=h,h=o);var _=vr(s,h),v=vr(s,g);if(_&&v&&(p.rangeCount!==1||p.anchorNode!==_.node||p.anchorOffset!==_.offset||p.focusNode!==v.node||p.focusOffset!==v.offset)){var y=d.createRange();y.setStart(_.node,_.offset),p.removeAllRanges(),h>g?(p.addRange(y),p.extend(v.node,v.offset)):(y.setEnd(v.node,v.offset),p.addRange(y))}}}}for(d=[],p=s;p=p.parentNode;)p.nodeType===1&&d.push({element:p,left:p.scrollLeft,top:p.scrollTop});for(typeof s.focus==`function`&&s.focus(),s=0;s<d.length;s++){var b=d[s];b.element.scrollLeft=b.left,b.element.scrollTop=b.top}}dp=!!Hd,Ud=Hd=null}finally{Il=i,F.p=r,P.T=n}}e.current=t,ou=2}}function Vu(){if(ou===2){ou=0;var e=su,t=cu,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=P.T,P.T=null;var r=F.p;F.p=2;var i=Il;Il|=4;try{nl(e,t.alternate,t)}finally{Il=i,F.p=r,P.T=n}}ou=3}}function Hu(){if(ou===4||ou===3){ou=0,be();var e=su,t=cu,n=lu,r=fu;t.subtreeFlags&10256||t.flags&10256?ou=5:(ou=0,cu=su=null,Uu(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(au=null),Xe(n),t=t.stateNode,ke&&typeof ke.onCommitFiberRoot==`function`)try{ke.onCommitFiberRoot(Oe,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=P.T,i=F.p,F.p=2,P.T=null;try{for(var a=e.onRecoverableError,o=0;o<r.length;o++){var s=r[o];a(s.value,{componentStack:s.stack})}}finally{P.T=t,F.p=i}}lu&3&&Wu(),od(e),i=e.pendingLanes,n&261930&&i&42?e===mu?pu++:(pu=0,mu=e):pu=0,sd(0,!1)}}function Uu(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,na(t)))}function Wu(){return Bu(),Vu(),Hu(),Gu()}function Gu(){if(ou!==5)return!1;var e=su,t=uu;uu=0;var n=Xe(lu),r=P.T,i=F.p;try{F.p=32>n?32:n,P.T=null,n=du,du=null;var a=su,s=lu;if(ou=0,cu=su=null,lu=0,Il&6)throw Error(o(331));var c=Il;if(Il|=4,jl(a.current),Cl(a,a.current,s,n),Il=c,sd(0,!1),ke&&typeof ke.onPostCommitFiberRoot==`function`)try{ke.onPostCommitFiberRoot(Oe,a)}catch{}return!0}finally{F.p=i,P.T=r,Uu(e,t)}}function Ku(e,t,n){t=ui(n,t),t=qs(e.stateNode,t,2),e=La(e,t,2),e!==null&&(We(e,2),od(e))}function qu(e,t,n){if(e.tag===3)Ku(e,e,n);else for(;t!==null;){if(t.tag===3){Ku(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(au===null||!au.has(r))){e=ui(n,e),n=Js(2),r=La(t,n,2),r!==null&&(Ys(n,r,t,e),We(r,2),od(r));break}}t=t.return}}function Ju(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Fl;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(Wl=!0,i.add(n),e=Yu.bind(null,e,t,n),t.then(e,e))}function Yu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Ll===e&&(zl&n)===n&&(Kl===4||Kl===3&&(zl&62914560)===zl&&300>xe()-tu?!(Il&2)&&wu(e,0):Yl|=n,Zl===zl&&(Zl=0)),od(e)}function Xu(e,t){t===0&&(t=He()),e=Xr(e,t),e!==null&&(We(e,t),od(e))}function Zu(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),Xu(e,n)}function Qu(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(o(314))}r!==null&&r.delete(t),Xu(e,n)}function $u(e,t){return _e(e,t)}var ed=null,td=null,nd=!1,rd=!1,id=!1,ad=0;function od(e){e!==td&&e.next===null&&(td===null?ed=td=e:td=td.next=e),rd=!0,nd||(nd=!0,pd())}function sd(e,t){if(!id&&rd){id=!0;do for(var n=!1,r=ed;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-je(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,fd(r,a))}else a=zl,a=ze(r,r===Ll?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Be(r,a)||(n=!0,fd(r,a));r=r.next}while(n);id=!1}}function cd(){ld()}function ld(){rd=nd=!1;var e=0;ad!==0&&Yd()&&(e=ad);for(var t=xe(),n=null,r=ed;r!==null;){var i=r.next,a=ud(r,t);a===0?(r.next=null,n===null?ed=i:n.next=i,i===null&&(td=n)):(n=r,(e!==0||a&3)&&(rd=!0)),r=i}ou!==0&&ou!==5||sd(e,!1),ad!==0&&(ad=0)}function ud(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-je(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Ve(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Ll,n=zl,n=ze(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Bl===2||Bl===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&ve(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Be(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&ve(r),Xe(n)){case 2:case 8:n=H;break;case 32:n=we;break;case 268435456:n=U;break;default:n=we}return r=dd.bind(null,e),n=_e(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&ve(r),e.callbackPriority=2,e.callbackNode=null,2}function dd(e,t){if(ou!==0&&ou!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(Wu()&&e.callbackNode!==n)return null;var r=zl;return r=ze(e,e===Ll?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(vu(e,r,t),ud(e,xe()),e.callbackNode!=null&&e.callbackNode===n?dd.bind(null,e):null)}function fd(e,t){if(Wu())return null;vu(e,t,!0)}function pd(){$d(function(){Il&6?_e(Ce,cd):ld()})}function md(){if(ad===0){var e=aa;e===0&&(e=Fe,Fe<<=1,!(Fe&261888)&&(Fe=256)),ad=e}return ad}function hd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:Kt(``+e)}function gd(e,t){var n=t.ownerDocument.createElement(`input`);return n.name=t.name,n.value=t.value,e.id&&n.setAttribute(`form`,e.id),t.parentNode.insertBefore(n,t),e=new FormData(e),n.parentNode.removeChild(n),e}function _d(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=hd((i[tt]||null).action),o=r.submitter;o&&(t=(t=o[tt]||null)?hd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new hn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(ad!==0){var e=o?gd(i,o):new FormData(i);ys(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?gd(i,o):new FormData(i),ys(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var vd=0;vd<Vr.length;vd++){var yd=Vr[vd];Hr(yd.toLowerCase(),`on`+(yd[0].toUpperCase()+yd.slice(1)))}Hr(Nr,`onAnimationEnd`),Hr(Pr,`onAnimationIteration`),Hr(Fr,`onAnimationStart`),Hr(`dblclick`,`onDoubleClick`),Hr(`focusin`,`onFocus`),Hr(`focusout`,`onBlur`),Hr(Ir,`onTransitionRun`),Hr(Lr,`onTransitionStart`),Hr(Rr,`onTransitionCancel`),Hr(zr,`onTransitionEnd`),_t(`onMouseEnter`,[`mouseout`,`mouseover`]),_t(`onMouseLeave`,[`mouseout`,`mouseover`]),_t(`onPointerEnter`,[`pointerout`,`pointerover`]),_t(`onPointerLeave`,[`pointerout`,`pointerover`]),gt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),gt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),gt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),gt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),gt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var bd=`abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting`.split(` `),xd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(bd));function Sd(e,t){t=(t&4)!=0;for(var n=0;n<e.length;n++){var r=e[n],i=r.event;r=r.listeners;a:{var a=void 0;if(t)for(var o=r.length-1;0<=o;o--){var s=r[o],c=s.instance,l=s.currentTarget;if(s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}else for(o=0;o<r.length;o++){if(s=r[o],c=s.instance,l=s.currentTarget,s=s.listener,c!==a&&i.isPropagationStopped())break a;a=s,i.currentTarget=l;try{a(i)}catch(e){Ur(e)}i.currentTarget=null,a=c}}}}function Y(e,t){var n=t[rt];n===void 0&&(n=t[rt]=new Set);var r=e+`__bubble`;n.has(r)||(Ed(t,e,2,!1),n.add(r))}function Cd(e,t,n){var r=0;t&&(r|=4),Ed(n,e,r,t)}var wd=`_reactListening`+Math.random().toString(36).slice(2);function Td(e){if(!e[wd]){e[wd]=!0,mt.forEach(function(t){t!==`selectionchange`&&(xd.has(t)||Cd(t,!1,e),Cd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[wd]||(t[wd]=!0,Cd(`selectionchange`,!1,t))}}function Ed(e,t,n,r){switch(vp(t)){case 2:var i=fp;break;case 8:i=pp;break;default:i=mp}n=i.bind(null,t,n,e),i=void 0,!rn||t!==`touchstart`&&t!==`touchmove`&&t!==`wheel`||(i=!0),r?i===void 0?e.addEventListener(t,n,!0):e.addEventListener(t,n,{capture:!0,passive:i}):i===void 0?e.addEventListener(t,n,!1):e.addEventListener(t,n,{passive:i})}function Dd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var s=r.stateNode.containerInfo;if(s===i)break;if(o===4)for(o=r.return;o!==null;){var l=o.tag;if((l===3||l===4)&&o.stateNode.containerInfo===i)return;o=o.return}for(;s!==null;){if(o=lt(s),o===null)return;if(l=o.tag,l===5||l===6||l===26||l===27){r=a=o;continue a}s=s.parentNode}}r=r.return}en(function(){var r=a,i=Yt(n),o=[];a:{var s=Br.get(e);if(s!==void 0){var l=hn,u=e;switch(e){case`keypress`:if(un(n)===0)break a;case`keydown`:case`keyup`:l=Nn;break;case`focusin`:u=`focus`,l=wn;break;case`focusout`:u=`blur`,l=wn;break;case`beforeblur`:case`afterblur`:l=wn;break;case`click`:if(n.button===2)break a;case`auxclick`:case`dblclick`:case`mousedown`:case`mousemove`:case`mouseup`:case`mouseout`:case`mouseover`:case`contextmenu`:l=Sn;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=Cn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Fn;break;case Nr:case Pr:case Fr:l=Tn;break;case zr:l=In;break;case`scroll`:case`scrollend`:l=_n;break;case`wheel`:l=Ln;break;case`copy`:case`cut`:case`paste`:l=En;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Pn;break;case`toggle`:case`beforetoggle`:l=Rn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?s===null?null:s+`Capture`:s;d=[];for(var m=r,h;m!==null;){var g=m;if(h=g.stateNode,g=g.tag,g!==5&&g!==26&&g!==27||h===null||p===null||(g=tn(m,p),g!=null&&d.push(Od(m,g,h))),f)break;m=m.return}0<d.length&&(s=new l(s,u,null,n,i),o.push({event:s,listeners:d}))}}if(!(t&7)){a:{if(s=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,s&&n!==Jt&&(u=n.relatedTarget||n.fromElement)&&(lt(u)||u[nt]))break a;if((l||s)&&(s=i.window===i?i:(s=i.ownerDocument)?s.defaultView||s.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?lt(u):null,u!==null&&(f=c(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=Sn,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Pn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?s:dt(l),h=u==null?s:dt(u),s=new d(g,m+`leave`,l,n,i),s.target=f,s.relatedTarget=h,g=null,lt(i)===r&&(d=new d(p,m+`enter`,u,n,i),d.target=h,d.relatedTarget=f,g=d),f=g,l&&u)b:{for(d=Ad,p=l,m=u,h=0,g=p;g;g=d(g))h++;g=0;for(var _=m;_;_=d(_))g++;for(;0<h-g;)p=d(p),h--;for(;0<g-h;)m=d(m),g--;for(;h--;){if(p===m||m!==null&&p===m.alternate){d=p;break b}p=d(p),m=d(m)}d=null}else d=null;l!==null&&jd(o,s,l,d,!1),u!==null&&f!==null&&jd(o,f,u,d,!0)}}a:{if(s=r?dt(r):window,l=s.nodeName&&s.nodeName.toLowerCase(),l===`select`||l===`input`&&s.type===`file`)var v=rr;else if(Zn(s))if(ir)v=pr;else{v=dr;var y=ur}else l=s.nodeName,!l||l.toLowerCase()!==`input`||s.type!==`checkbox`&&s.type!==`radio`?r&&Ut(r.elementType)&&(v=rr):v=fr;if(v&&=v(e,r)){Qn(o,v,n,i);break a}y&&y(e,s,r),e===`focusout`&&r&&s.type===`number`&&r.memoizedProps.value!=null&&Ft(s,`number`,s.value)}switch(y=r?dt(r):window,e){case`focusin`:(Zn(y)||y.contentEditable===`true`)&&(Cr=y,wr=r,Tr=null);break;case`focusout`:Tr=wr=Cr=null;break;case`mousedown`:Er=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Er=!1,Dr(o,n,i);break;case`selectionchange`:if(Sr)break;case`keydown`:case`keyup`:Dr(o,n,i)}var b;if(Bn)b:{switch(e){case`compositionstart`:var x=`onCompositionStart`;break b;case`compositionend`:x=`onCompositionEnd`;break b;case`compositionupdate`:x=`onCompositionUpdate`;break b}x=void 0}else qn?Gn(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Hn&&n.locale!==`ko`&&(qn||x!==`onCompositionStart`?x===`onCompositionEnd`&&qn&&(b=ln()):(on=i,sn=`value`in on?on.value:on.textContent,qn=!0)),y=kd(r,x),0<y.length&&(x=new Dn(x,e,null,n,i),o.push({event:x,listeners:y}),b?x.data=b:(b=Kn(n),b!==null&&(x.data=b)))),(b=Vn?Jn(e,n):Yn(e,n))&&(x=kd(r,`onBeforeInput`),0<x.length&&(y=new Dn(`onBeforeInput`,`beforeinput`,null,n,i),o.push({event:y,listeners:x}),y.data=b)),_d(o,e,r,n,i)}Sd(o,t)})}function Od(e,t,n){return{instance:e,listener:t,currentTarget:n}}function kd(e,t){for(var n=t+`Capture`,r=[];e!==null;){var i=e,a=i.stateNode;if(i=i.tag,i!==5&&i!==26&&i!==27||a===null||(i=tn(e,n),i!=null&&r.unshift(Od(e,i,a)),i=tn(e,t),i!=null&&r.push(Od(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Ad(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function jd(e,t,n,r,i){for(var a=t._reactName,o=[];n!==null&&n!==r;){var s=n,c=s.alternate,l=s.stateNode;if(s=s.tag,c!==null&&c===r)break;s!==5&&s!==26&&s!==27||l===null||(c=l,i?(l=tn(n,a),l!=null&&o.unshift(Od(n,l,c))):i||(l=tn(n,a),l!=null&&o.push(Od(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Md=/\r\n?/g,Nd=/\u0000|\uFFFD/g;function Pd(e){return(typeof e==`string`?e:``+e).replace(Md,`
|
|
10
|
+
`).replace(Nd,``)}function Fd(e,t){return t=Pd(t),Pd(e)===t}function Id(e,t,n,r,i,a){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&zt(e,``+r);break;case`className`:Ct(e,`class`,r);break;case`tabIndex`:Ct(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:Ct(e,n,r);break;case`style`:Ht(e,r,a);break;case`data`:if(t!==`object`){Ct(e,`data`,r);break}case`src`:case`href`:if(r===``&&(t!==`a`||n!==`href`)){e.removeAttribute(n);break}if(r==null||typeof r==`function`||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`action`:case`formAction`:if(typeof r==`function`){e.setAttribute(n,`javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')`);break}else typeof a==`function`&&(n===`formAction`?(t!==`input`&&Id(e,t,`name`,i.name,i,null),Id(e,t,`formEncType`,i.formEncType,i,null),Id(e,t,`formMethod`,i.formMethod,i,null),Id(e,t,`formTarget`,i.formTarget,i,null)):(Id(e,t,`encType`,i.encType,i,null),Id(e,t,`method`,i.method,i,null),Id(e,t,`target`,i.target,i,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=Kt(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`onScroll`:r!=null&&Y(`scroll`,e);break;case`onScrollEnd`:r!=null&&Y(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`multiple`:e.multiple=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`muted`:e.muted=r&&typeof r!=`function`&&typeof r!=`symbol`;break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`defaultValue`:case`defaultChecked`:case`innerHTML`:case`ref`:break;case`autoFocus`:break;case`xlinkHref`:if(r==null||typeof r==`function`||typeof r==`boolean`||typeof r==`symbol`){e.removeAttribute(`xlink:href`);break}n=Kt(``+r),e.setAttributeNS(`http://www.w3.org/1999/xlink`,`xlink:href`,n);break;case`contentEditable`:case`spellCheck`:case`draggable`:case`value`:case`autoReverse`:case`externalResourcesRequired`:case`focusable`:case`preserveAlpha`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``+r):e.removeAttribute(n);break;case`inert`:case`allowFullScreen`:case`async`:case`autoPlay`:case`controls`:case`default`:case`defer`:case`disabled`:case`disablePictureInPicture`:case`disableRemotePlayback`:case`formNoValidate`:case`hidden`:case`loop`:case`noModule`:case`noValidate`:case`open`:case`playsInline`:case`readOnly`:case`required`:case`reversed`:case`scoped`:case`seamless`:case`itemScope`:r&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,``):e.removeAttribute(n);break;case`capture`:case`download`:!0===r?e.setAttribute(n,``):!1!==r&&r!=null&&typeof r!=`function`&&typeof r!=`symbol`?e.setAttribute(n,r):e.removeAttribute(n);break;case`cols`:case`rows`:case`size`:case`span`:r!=null&&typeof r!=`function`&&typeof r!=`symbol`&&!isNaN(r)&&1<=r?e.setAttribute(n,r):e.removeAttribute(n);break;case`rowSpan`:case`start`:r==null||typeof r==`function`||typeof r==`symbol`||isNaN(r)?e.removeAttribute(n):e.setAttribute(n,r);break;case`popover`:Y(`beforetoggle`,e),Y(`toggle`,e),St(e,`popover`,r);break;case`xlinkActuate`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:wt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:wt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:St(e,`is`,r);break;case`innerText`:case`textContent`:break;default:(!(2<n.length)||n[0]!==`o`&&n[0]!==`O`||n[1]!==`n`&&n[1]!==`N`)&&(n=Wt.get(n)||n,St(e,n,r))}}function Ld(e,t,n,r,i,a){switch(n){case`style`:Ht(e,r,a);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(o(61));if(n=r.__html,n!=null){if(i.children!=null)throw Error(o(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?zt(e,r):(typeof r==`number`||typeof r==`bigint`)&&zt(e,``+r);break;case`onScroll`:r!=null&&Y(`scroll`,e);break;case`onScrollEnd`:r!=null&&Y(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=qt);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!ht.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(i=n.endsWith(`Capture`),t=n.slice(2,i?n.length-7:void 0),a=e[tt]||null,a=a==null?null:a[n],typeof a==`function`&&e.removeEventListener(t,a,i),typeof r==`function`)){typeof a!=`function`&&a!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,i);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):St(e,n,r)}}}function Rd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Y(`error`,e),Y(`load`,e);var r=!1,i=!1,a;for(a in n)if(n.hasOwnProperty(a)){var s=n[a];if(s!=null)switch(a){case`src`:r=!0;break;case`srcSet`:i=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Id(e,t,a,s,n,null)}}i&&Id(e,t,`srcSet`,n.srcSet,n,null),r&&Id(e,t,`src`,n.src,n,null);return;case`input`:Y(`invalid`,e);var c=a=s=i=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:i=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:a=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(o(137,t));break;default:Id(e,t,r,d,n,null)}}Pt(e,a,c,l,u,s,i,!1);return;case`select`:for(i in Y(`invalid`,e),r=s=a=null,n)if(n.hasOwnProperty(i)&&(c=n[i],c!=null))switch(i){case`value`:a=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Id(e,t,i,c,n,null)}t=a,n=s,e.multiple=!!r,t==null?n!=null&&It(e,!!r,n,!0):It(e,!!r,t,!1);return;case`textarea`:for(s in Y(`invalid`,e),a=i=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:i=c;break;case`children`:a=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(o(91));break;default:Id(e,t,s,c,n,null)}Rt(e,r,i,a);return;case`option`:for(l in n)if(n.hasOwnProperty(l)&&(r=n[l],r!=null))switch(l){case`selected`:e.selected=r&&typeof r!=`function`&&typeof r!=`symbol`;break;default:Id(e,t,l,r,n,null)}return;case`dialog`:Y(`beforetoggle`,e),Y(`toggle`,e),Y(`cancel`,e),Y(`close`,e);break;case`iframe`:case`object`:Y(`load`,e);break;case`video`:case`audio`:for(r=0;r<bd.length;r++)Y(bd[r],e);break;case`image`:Y(`error`,e),Y(`load`,e);break;case`details`:Y(`toggle`,e);break;case`embed`:case`source`:case`link`:Y(`error`,e),Y(`load`,e);case`area`:case`base`:case`br`:case`col`:case`hr`:case`keygen`:case`meta`:case`param`:case`track`:case`wbr`:case`menuitem`:for(u in n)if(n.hasOwnProperty(u)&&(r=n[u],r!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:throw Error(o(137,t));default:Id(e,t,u,r,n,null)}return;default:if(Ut(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Ld(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Id(e,t,c,r,n,null))}function zd(e,t,n,r){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`input`:var i=null,a=null,s=null,c=null,l=null,u=null,d=null;for(m in n){var f=n[m];if(n.hasOwnProperty(m)&&f!=null)switch(m){case`checked`:break;case`value`:break;case`defaultValue`:l=f;default:r.hasOwnProperty(m)||Id(e,t,m,null,r,f)}}for(var p in r){var m=r[p];if(f=n[p],r.hasOwnProperty(p)&&(m!=null||f!=null))switch(p){case`type`:a=m;break;case`name`:i=m;break;case`checked`:u=m;break;case`defaultChecked`:d=m;break;case`value`:s=m;break;case`defaultValue`:c=m;break;case`children`:case`dangerouslySetInnerHTML`:if(m!=null)throw Error(o(137,t));break;default:m!==f&&Id(e,t,p,m,r,f)}}Nt(e,s,c,l,u,d,a,i);return;case`select`:for(a in m=s=c=p=null,n)if(l=n[a],n.hasOwnProperty(a)&&l!=null)switch(a){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(a)||Id(e,t,a,null,r,l)}for(i in r)if(a=r[i],l=n[i],r.hasOwnProperty(i)&&(a!=null||l!=null))switch(i){case`value`:p=a;break;case`defaultValue`:c=a;break;case`multiple`:s=a;default:a!==l&&Id(e,t,i,a,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?It(e,!!n,n?[]:``,!1):It(e,!!n,t,!0)):It(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(i=n[c],n.hasOwnProperty(c)&&i!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Id(e,t,c,null,r,i)}for(s in r)if(i=r[s],a=n[s],r.hasOwnProperty(s)&&(i!=null||a!=null))switch(s){case`value`:p=i;break;case`defaultValue`:m=i;break;case`children`:break;case`dangerouslySetInnerHTML`:if(i!=null)throw Error(o(91));break;default:i!==a&&Id(e,t,s,i,r,a)}Lt(e,p,m);return;case`option`:for(var h in n)if(p=n[h],n.hasOwnProperty(h)&&p!=null&&!r.hasOwnProperty(h))switch(h){case`selected`:e.selected=!1;break;default:Id(e,t,h,null,r,p)}for(l in r)if(p=r[l],m=n[l],r.hasOwnProperty(l)&&p!==m&&(p!=null||m!=null))switch(l){case`selected`:e.selected=p&&typeof p!=`function`&&typeof p!=`symbol`;break;default:Id(e,t,l,p,r,m)}return;case`img`:case`link`:case`area`:case`base`:case`br`:case`col`:case`embed`:case`hr`:case`keygen`:case`meta`:case`param`:case`source`:case`track`:case`wbr`:case`menuitem`:for(var g in n)p=n[g],n.hasOwnProperty(g)&&p!=null&&!r.hasOwnProperty(g)&&Id(e,t,g,null,r,p);for(u in r)if(p=r[u],m=n[u],r.hasOwnProperty(u)&&p!==m&&(p!=null||m!=null))switch(u){case`children`:case`dangerouslySetInnerHTML`:if(p!=null)throw Error(o(137,t));break;default:Id(e,t,u,p,r,m)}return;default:if(Ut(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Ld(e,t,_,void 0,r,p);for(d in r)p=r[d],m=n[d],!r.hasOwnProperty(d)||p===m||p===void 0&&m===void 0||Ld(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Id(e,t,v,null,r,p);for(f in r)p=r[f],m=n[f],!r.hasOwnProperty(f)||p===m||p==null&&m==null||Id(e,t,f,p,r,m)}function Bd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Vd(){if(typeof performance.getEntriesByType==`function`){for(var e=0,t=0,n=performance.getEntriesByType(`resource`),r=0;r<n.length;r++){var i=n[r],a=i.transferSize,o=i.initiatorType,s=i.duration;if(a&&s&&Bd(o)){for(o=0,s=i.responseEnd,r+=1;r<n.length;r++){var c=n[r],l=c.startTime;if(l>s)break;var u=c.transferSize,d=c.initiatorType;u&&Bd(d)&&(c=c.responseEnd,o+=u*(c<s?1:(s-l)/(c-l)))}if(--r,t+=8*(a+o)/(i.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e==`number`)?e:5}var Hd=null,Ud=null;function Wd(e){return e.nodeType===9?e:e.ownerDocument}function Gd(e){switch(e){case`http://www.w3.org/2000/svg`:return 1;case`http://www.w3.org/1998/Math/MathML`:return 2;default:return 0}}function Kd(e,t){if(e===0)switch(t){case`svg`:return 1;case`math`:return 2;default:return 0}return e===1&&t===`foreignObject`?0:e}function qd(e,t){return e===`textarea`||e===`noscript`||typeof t.children==`string`||typeof t.children==`number`||typeof t.children==`bigint`||typeof t.dangerouslySetInnerHTML==`object`&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Jd=null;function Yd(){var e=window.event;return e&&e.type===`popstate`?e===Jd?!1:(Jd=e,!0):(Jd=null,!1)}var Xd=typeof setTimeout==`function`?setTimeout:void 0,Zd=typeof clearTimeout==`function`?clearTimeout:void 0,Qd=typeof Promise==`function`?Promise:void 0,$d=typeof queueMicrotask==`function`?queueMicrotask:Qd===void 0?Xd:function(e){return Qd.resolve(null).then(e).catch(ef)};function ef(e){setTimeout(function(){throw e})}function tf(e){return e===`head`}function nf(e,t){var n=t,r=0;do{var i=n.nextSibling;if(e.removeChild(n),i&&i.nodeType===8)if(n=i.data,n===`/$`||n===`/&`){if(r===0){e.removeChild(i),Lp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)_f(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,_f(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[st]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&_f(e.ownerDocument.body);n=i}while(n);Lp(t)}function rf(e,t){var n=e;e=0;do{var r=n.nextSibling;if(n.nodeType===1?t?(n._stashedDisplay=n.style.display,n.style.display=`none`):(n.style.display=n._stashedDisplay||``,n.getAttribute(`style`)===``&&n.removeAttribute(`style`)):n.nodeType===3&&(t?(n._stashedText=n.nodeValue,n.nodeValue=``):n.nodeValue=n._stashedText||``),r&&r.nodeType===8)if(n=r.data,n===`/$`){if(e===0)break;e--}else n!==`$`&&n!==`$?`&&n!==`$~`&&n!==`$!`||e++;n=r}while(n)}function af(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var n=t;switch(t=t.nextSibling,n.nodeName){case`HTML`:case`HEAD`:case`BODY`:af(n),ct(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function of(e,t,n,r){for(;e.nodeType===1;){var i=n;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!==`INPUT`||e.type!==`hidden`))break}else if(!r)if(t===`input`&&e.type===`hidden`){var a=i.name==null?null:``+i.name;if(i.type===`hidden`&&e.getAttribute(`name`)===a)return e}else return e;else if(!e[st])switch(t){case`meta`:if(!e.hasAttribute(`itemprop`))break;return e;case`link`:if(a=e.getAttribute(`rel`),a===`stylesheet`&&e.hasAttribute(`data-precedence`)||a!==i.rel||e.getAttribute(`href`)!==(i.href==null||i.href===``?null:i.href)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin)||e.getAttribute(`title`)!==(i.title==null?null:i.title))break;return e;case`style`:if(e.hasAttribute(`data-precedence`))break;return e;case`script`:if(a=e.getAttribute(`src`),(a!==(i.src==null?null:i.src)||e.getAttribute(`type`)!==(i.type==null?null:i.type)||e.getAttribute(`crossorigin`)!==(i.crossOrigin==null?null:i.crossOrigin))&&a&&e.hasAttribute(`async`)&&!e.hasAttribute(`itemprop`))break;return e;default:return e}if(e=ff(e.nextSibling),e===null)break}return null}function sf(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=ff(e.nextSibling),e===null))return null;return e}function cf(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=ff(e.nextSibling),e===null))return null;return e}function lf(e){return e.data===`$?`||e.data===`$~`}function uf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function df(e,t){var n=e.ownerDocument;if(e.data===`$~`)e._reactRetry=t;else if(e.data!==`$?`||n.readyState!==`loading`)t();else{var r=function(){t(),n.removeEventListener(`DOMContentLoaded`,r)};n.addEventListener(`DOMContentLoaded`,r),e._reactRetry=r}}function ff(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t===`$`||t===`$!`||t===`$?`||t===`$~`||t===`&`||t===`F!`||t===`F`)break;if(t===`/$`||t===`/&`)return null}}return e}var pf=null;function mf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return ff(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function hf(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`$`||n===`$!`||n===`$?`||n===`$~`||n===`&`){if(t===0)return e;t--}else n!==`/$`&&n!==`/&`||t++}e=e.previousSibling}return null}function gf(e,t,n){switch(t=Wd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(o(452));return e;case`head`:if(e=t.head,!e)throw Error(o(453));return e;case`body`:if(e=t.body,!e)throw Error(o(454));return e;default:throw Error(o(451))}}function _f(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);ct(e)}var vf=new Map,yf=new Set;function bf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var xf=F.d;F.d={f:Sf,r:Cf,D:Ef,C:Df,L:Of,m:kf,X:jf,S:Af,M:Mf};function Sf(){var e=xf.f(),t=Su();return e||t}function Cf(e){var t=ut(e);t!==null&&t.tag===5&&t.type===`form`?xs(t):xf.r(e)}var wf=typeof document>`u`?null:document;function Tf(e,t,n){var r=wf;if(r&&typeof t==`string`&&t){var i=Mt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),yf.has(i)||(yf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Rd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function Ef(e){xf.D(e),Tf(`dns-prefetch`,e,null)}function Df(e,t){xf.C(e,t),Tf(`preconnect`,e,t)}function Of(e,t,n){xf.L(e,t,n);var r=wf;if(r&&e&&t){var i=`link[rel="preload"][as="`+Mt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Mt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Mt(n.imageSizes)+`"]`)):i+=`[href="`+Mt(e)+`"]`;var a=i;switch(t){case`style`:a=Pf(e);break;case`script`:a=Rf(e)}vf.has(a)||(e=m({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),vf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(Ff(a))||t===`script`&&r.querySelector(zf(a))||(t=r.createElement(`link`),Rd(t,`link`,e),pt(t),r.head.appendChild(t)))}}function kf(e,t){xf.m(e,t);var n=wf;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Mt(r)+`"][href="`+Mt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Rf(e)}if(!vf.has(a)&&(e=m({rel:`modulepreload`,href:e},t),vf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(zf(a)))return}r=n.createElement(`link`),Rd(r,`link`,e),pt(r),n.head.appendChild(r)}}}function Af(e,t,n){xf.S(e,t,n);var r=wf;if(r&&e){var i=ft(r).hoistableStyles,a=Pf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(Ff(a)))s.loading=5;else{e=m({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=vf.get(a))&&Hf(e,n);var c=o=r.createElement(`link`);pt(c),Rd(c,`link`,e),c._p=new Promise(function(e,t){c.onload=e,c.onerror=t}),c.addEventListener(`load`,function(){s.loading|=1}),c.addEventListener(`error`,function(){s.loading|=2}),s.loading|=4,Vf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function jf(e,t){xf.X(e,t);var n=wf;if(n&&e){var r=ft(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),pt(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Mf(e,t){xf.M(e,t);var n=wf;if(n&&e){var r=ft(n).hoistableScripts,i=Rf(e),a=r.get(i);a||(a=n.querySelector(zf(i)),a||(e=m({src:e,async:!0,type:`module`},t),(t=vf.get(i))&&Uf(e,t),a=n.createElement(`script`),pt(a),Rd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Nf(e,t,n,r){var i=(i=ie.current)?bf(i):null;if(!i)throw Error(o(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Pf(n.href),n=ft(i).hoistableStyles,r=n.get(t),r||(r={type:`style`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};case`link`:if(n.rel===`stylesheet`&&typeof n.href==`string`&&typeof n.precedence==`string`){e=Pf(n.href);var a=ft(i).hoistableStyles,s=a.get(e);if(s||(i=i.ownerDocument||i,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},a.set(e,s),(a=i.querySelector(Ff(e)))&&!a._p&&(s.instance=a,s.state.loading=5),vf.has(e)||(n={rel:`preload`,as:`style`,href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},vf.set(e,n),a||Lf(i,e,n,s.state))),t&&r===null)throw Error(o(528,``));return s}if(t&&r!==null)throw Error(o(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Rf(n),n=ft(i).hoistableScripts,r=n.get(t),r||(r={type:`script`,instance:null,count:0,state:null},n.set(t,r)),r):{type:`void`,instance:null,count:0,state:null};default:throw Error(o(444,e))}}function Pf(e){return`href="`+Mt(e)+`"`}function Ff(e){return`link[rel="stylesheet"][`+e+`]`}function If(e){return m({},e,{"data-precedence":e.precedence,precedence:null})}function Lf(e,t,n,r){e.querySelector(`link[rel="preload"][as="style"][`+t+`]`)?r.loading=1:(t=e.createElement(`link`),r.preload=t,t.addEventListener(`load`,function(){return r.loading|=1}),t.addEventListener(`error`,function(){return r.loading|=2}),Rd(t,`link`,n),pt(t),e.head.appendChild(t))}function Rf(e){return`[src="`+Mt(e)+`"]`}function zf(e){return`script[async]`+e}function Bf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Mt(n.href)+`"]`);if(r)return t.instance=r,pt(r),r;var i=m({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),pt(r),Rd(r,`style`,i),Vf(r,n.precedence,e),t.instance=r;case`stylesheet`:i=Pf(n.href);var a=e.querySelector(Ff(i));if(a)return t.state.loading|=4,t.instance=a,pt(a),a;r=If(n),(i=vf.get(i))&&Hf(r,i),a=(e.ownerDocument||e).createElement(`link`),pt(a);var s=a;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Rd(a,`link`,r),t.state.loading|=4,Vf(a,n.precedence,e),t.instance=a;case`script`:return a=Rf(n.src),(i=e.querySelector(zf(a)))?(t.instance=i,pt(i),i):(r=n,(i=vf.get(a))&&(r=m({},n),Uf(r,i)),e=e.ownerDocument||e,i=e.createElement(`script`),pt(i),Rd(i,`link`,r),e.head.appendChild(i),t.instance=i);case`void`:return null;default:throw Error(o(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Vf(r,n.precedence,e));return t.instance}function Vf(e,t,n){for(var r=n.querySelectorAll(`link[rel="stylesheet"][data-precedence],style[data-precedence]`),i=r.length?r[r.length-1]:null,a=i,o=0;o<r.length;o++){var s=r[o];if(s.dataset.precedence===t)a=s;else if(a!==i)break}a?a.parentNode.insertBefore(e,a.nextSibling):(t=n.nodeType===9?n.head:n,t.insertBefore(e,t.firstChild))}function Hf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function Uf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Wf=null;function Gf(e,t,n){if(Wf===null){var r=new Map,i=Wf=new Map;i.set(n,r)}else i=Wf,r=i.get(n),r||(r=new Map,i.set(n,r));if(r.has(e))return r;for(r.set(e,null),n=n.getElementsByTagName(e),i=0;i<n.length;i++){var a=n[i];if(!(a[st]||a[et]||e===`link`&&a.getAttribute(`rel`)===`stylesheet`)&&a.namespaceURI!==`http://www.w3.org/2000/svg`){var o=a.getAttribute(t)||``;o=e+o;var s=r.get(o);s?s.push(a):r.set(o,[a])}}return r}function Kf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function qf(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case`meta`:case`title`:return!0;case`style`:if(typeof t.precedence!=`string`||typeof t.href!=`string`||t.href===``)break;return!0;case`link`:if(typeof t.rel!=`string`||typeof t.href!=`string`||t.href===``||t.onLoad||t.onError)break;switch(t.rel){case`stylesheet`:return e=t.disabled,typeof t.precedence==`string`&&e==null;default:return!0}case`script`:if(t.async&&typeof t.async!=`function`&&typeof t.async!=`symbol`&&!t.onLoad&&!t.onError&&t.src&&typeof t.src==`string`)return!0}return!1}function Jf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function Yf(e,t,n,r){if(n.type===`stylesheet`&&(typeof r.media!=`string`||!1!==matchMedia(r.media).matches)&&!(n.state.loading&4)){if(n.instance===null){var i=Pf(r.href),a=t.querySelector(Ff(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=Qf.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,pt(a);return}a=t.ownerDocument||t,r=If(r),(i=vf.get(i))&&Hf(r,i),a=a.createElement(`link`),pt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Rd(a,`link`,r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&!(n.state.loading&3)&&(e.count++,n=Qf.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var Xf=0;function Zf(e,t){return e.stylesheets&&e.count===0&&ep(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&Xf===0&&(Xf=62500*Vd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ep(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>Xf?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ep(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var $f=null;function ep(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,$f=new Map,t.forEach(tp,e),$f=null,Qf.call(e))}function tp(e,t){if(!(t.state.loading&4)){var n=$f.get(e);if(n)var r=n.get(null);else{n=new Map,$f.set(e,n);for(var i=e.querySelectorAll(`link[data-precedence],style[data-precedence]`),a=0;a<i.length;a++){var o=i[a];(o.nodeName===`LINK`||o.getAttribute(`media`)!==`not all`)&&(n.set(o.dataset.precedence,o),r=o)}r&&n.set(null,r)}i=t.instance,o=i.getAttribute(`data-precedence`),a=n.get(o)||r,a===r&&n.set(null,i),n.set(o,i),this.count++,r=Qf.bind(this),i.addEventListener(`load`,r),i.addEventListener(`error`,r),a?a.parentNode.insertBefore(i,a.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(i,e.firstChild)),t.state.loading|=4}}var np={$$typeof:S,Provider:null,Consumer:null,_currentValue:I,_currentValue2:I,_threadCount:0};function rp(e,t,n,r,i,a,o,s,c){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ue(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ue(0),this.hiddenUpdates=Ue(null),this.identifierPrefix=r,this.onUncaughtError=i,this.onCaughtError=a,this.onRecoverableError=o,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=c,this.incompleteTransitions=new Map}function ip(e,t,n,r,i,a,o,s,c,l,u,d){return e=new rp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ti(3,null,null,t),e.current=a,a.stateNode=e,t=ta(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Pa(a),e}function ap(e){return e?(e=$r,e):$r}function op(e,t,n,r,i,a){i=ap(i),r.context===null?r.context=i:r.pendingContext=i,r=Ia(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=La(e,r,t),n!==null&&(_u(n,e,t),Ra(n,e,t))}function sp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function cp(e,t){sp(e,t),(e=e.alternate)&&sp(e,t)}function lp(e){if(e.tag===13||e.tag===31){var t=Xr(e,67108864);t!==null&&_u(t,e,67108864),cp(e,67108864)}}function up(e){if(e.tag===13||e.tag===31){var t=hu();t=Ye(t);var n=Xr(e,t);n!==null&&_u(n,e,t),cp(e,t)}}var dp=!0;function fp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=2,mp(e,t,n,r)}finally{F.p=a,P.T=i}}function pp(e,t,n,r){var i=P.T;P.T=null;var a=F.p;try{F.p=8,mp(e,t,n,r)}finally{F.p=a,P.T=i}}function mp(e,t,n,r){if(dp){var i=hp(r);if(i===null)Dd(e,t,r,gp,n),Dp(e,r);else if(kp(i,e,t,n,r))r.stopPropagation();else if(Dp(e,r),t&4&&-1<Ep.indexOf(e)){for(;i!==null;){var a=ut(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=Re(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-je(o);s.entanglements[1]|=c,o&=~c}od(a),!(Il&6)&&(ru=xe()+500,sd(0,!1))}}break;case 31:case 13:s=Xr(a,2),s!==null&&_u(s,a,2),Su(),cp(a,2)}if(a=hp(r),a===null&&Dd(e,t,r,gp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else Dd(e,t,r,null,n)}}function hp(e){return e=Yt(e),_p(e)}var gp=null;function _p(e){if(gp=null,e=lt(e),e!==null){var t=c(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=l(t),e!==null)return e;e=null}else if(n===31){if(e=u(t),e!==null)return e;e=null}else if(n===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return gp=e,null}function vp(e){switch(e){case`beforetoggle`:case`cancel`:case`click`:case`close`:case`contextmenu`:case`copy`:case`cut`:case`auxclick`:case`dblclick`:case`dragend`:case`dragstart`:case`drop`:case`focusin`:case`focusout`:case`input`:case`invalid`:case`keydown`:case`keypress`:case`keyup`:case`mousedown`:case`mouseup`:case`paste`:case`pause`:case`play`:case`pointercancel`:case`pointerdown`:case`pointerup`:case`ratechange`:case`reset`:case`resize`:case`seeked`:case`submit`:case`toggle`:case`touchcancel`:case`touchend`:case`touchstart`:case`volumechange`:case`change`:case`selectionchange`:case`textInput`:case`compositionstart`:case`compositionend`:case`compositionupdate`:case`beforeblur`:case`afterblur`:case`beforeinput`:case`blur`:case`fullscreenchange`:case`focus`:case`hashchange`:case`popstate`:case`select`:case`selectstart`:return 2;case`drag`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`mousemove`:case`mouseout`:case`mouseover`:case`pointermove`:case`pointerout`:case`pointerover`:case`scroll`:case`touchmove`:case`wheel`:case`mouseenter`:case`mouseleave`:case`pointerenter`:case`pointerleave`:return 8;case`message`:switch(Se()){case Ce:return 2;case H:return 8;case we:case Te:return 32;case U:return 268435456;default:return 32}default:return 32}}var yp=!1,bp=null,xp=null,Sp=null,Cp=new Map,wp=new Map,Tp=[],Ep=`mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset`.split(` `);function Dp(e,t){switch(e){case`focusin`:case`focusout`:bp=null;break;case`dragenter`:case`dragleave`:xp=null;break;case`mouseover`:case`mouseout`:Sp=null;break;case`pointerover`:case`pointerout`:Cp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:wp.delete(t.pointerId)}}function Op(e,t,n,r,i,a){return e===null||e.nativeEvent!==a?(e={blockedOn:t,domEventName:n,eventSystemFlags:r,nativeEvent:a,targetContainers:[i]},t!==null&&(t=ut(t),t!==null&&lp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function kp(e,t,n,r,i){switch(t){case`focusin`:return bp=Op(bp,e,t,n,r,i),!0;case`dragenter`:return xp=Op(xp,e,t,n,r,i),!0;case`mouseover`:return Sp=Op(Sp,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Cp.set(a,Op(Cp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,wp.set(a,Op(wp.get(a)||null,e,t,n,r,i)),!0}return!1}function Ap(e){var t=lt(e.target);if(t!==null){var n=c(t);if(n!==null){if(t=n.tag,t===13){if(t=l(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){up(n)});return}}else if(t===31){if(t=u(n),t!==null){e.blockedOn=t,Qe(e.priority,function(){up(n)});return}}else if(t===3&&n.stateNode.current.memoizedState.isDehydrated){e.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}e.blockedOn=null}function jp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=hp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);Jt=r,n.target.dispatchEvent(r),Jt=null}else return t=ut(n),t!==null&&lp(t),e.blockedOn=n,!1;t.shift()}return!0}function Mp(e,t,n){jp(e)&&n.delete(t)}function Np(){yp=!1,bp!==null&&jp(bp)&&(bp=null),xp!==null&&jp(xp)&&(xp=null),Sp!==null&&jp(Sp)&&(Sp=null),Cp.forEach(Mp),wp.forEach(Mp)}function Pp(e,n){e.blockedOn===n&&(e.blockedOn=null,yp||(yp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Np)))}var Fp=null;function Ip(e){Fp!==e&&(Fp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Fp===e&&(Fp=null);for(var t=0;t<e.length;t+=3){var n=e[t],r=e[t+1],i=e[t+2];if(typeof r!=`function`){if(_p(r||n)===null)continue;break}var a=ut(n);a!==null&&(e.splice(t,3),t-=3,ys(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Lp(e){function t(t){return Pp(t,e)}bp!==null&&Pp(bp,e),xp!==null&&Pp(xp,e),Sp!==null&&Pp(Sp,e),Cp.forEach(t),wp.forEach(t);for(var n=0;n<Tp.length;n++){var r=Tp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Tp.length&&(n=Tp[0],n.blockedOn===null);)Ap(n),n.blockedOn===null&&Tp.shift();if(n=(e.ownerDocument||e).$$reactFormReplay,n!=null)for(r=0;r<n.length;r+=3){var i=n[r],a=n[r+1],o=i[tt]||null;if(typeof a==`function`)o||Ip(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[tt]||null)s=o.formAction;else if(_p(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Ip(n)}}}function Rp(){function e(e){e.canIntercept&&e.info===`react-transition`&&e.intercept({handler:function(){return new Promise(function(e){return i=e})},focusReset:`manual`,scroll:`manual`})}function t(){i!==null&&(i(),i=null),r||setTimeout(n,20)}function n(){if(!r&&!navigation.transition){var e=navigation.currentEntry;e&&e.url!=null&&navigation.navigate(e.url,{state:e.getState(),info:`react-transition`,history:`replace`})}}if(typeof navigation==`object`){var r=!1,i=null;return navigation.addEventListener(`navigate`,e),navigation.addEventListener(`navigatesuccess`,t),navigation.addEventListener(`navigateerror`,t),setTimeout(n,100),function(){r=!0,navigation.removeEventListener(`navigate`,e),navigation.removeEventListener(`navigatesuccess`,t),navigation.removeEventListener(`navigateerror`,t),i!==null&&(i(),i=null)}}}function zp(e){this._internalRoot=e}Bp.prototype.render=zp.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(o(409));var n=t.current;op(n,hu(),e,t,null,null)},Bp.prototype.unmount=zp.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;op(e.current,2,null,e,null,null),Su(),t[nt]=null}};function Bp(e){this._internalRoot=e}Bp.prototype.unstable_scheduleHydration=function(e){if(e){var t=Ze();e={blockedOn:null,target:e,priority:t};for(var n=0;n<Tp.length&&t!==0&&t<Tp[n].priority;n++);Tp.splice(n,0,e),n===0&&Ap(e)}};var Vp=n.version;if(Vp!==`19.2.7`)throw Error(o(527,Vp,`19.2.7`));F.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(o(188)):(e=Object.keys(e).join(`,`),Error(o(268,e)));return e=f(t),e=e===null?null:p(e),e=e===null?null:e.stateNode,e};var Hp={bundleType:0,version:`19.2.7`,rendererPackageName:`react-dom`,currentDispatcherRef:P,reconcilerVersion:`19.2.7`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var X=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!X.isDisabled&&X.supportsFiber)try{Oe=X.inject(Hp),ke=X}catch{}}e.createRoot=function(e,t){if(!s(e))throw Error(o(299));var n=!1,r=``,i=Hs,a=Us,c=Ws;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(i=t.onUncaughtError),t.onCaughtError!==void 0&&(a=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=ip(e,1,!1,null,null,n,r,null,i,a,c,Rp),e[nt]=t.current,Td(e),new zp(t)}})),El=n(((e,t)=>{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=Tl()})),J=e(r(),1),Dl=El(),Ol=class extends Error{status;diagnostics;constructor(e,t,n=[]){super(t),this.status=e,this.diagnostics=n}};async function kl(e,t,n,r){let i=await fetch(t,{method:e,credentials:`same-origin`,cache:`no-store`,headers:n===void 0?void 0:{"content-type":`application/json`},body:n===void 0?void 0:JSON.stringify(n),signal:r}),a=await i.json().catch(()=>({}));if(!i.ok)throw new Ol(i.status,typeof a.error==`string`?a.error:`The server answered ${i.status}.`,Array.isArray(a.diagnostics)?a.diagnostics:[]);return a}function Al(e){return`/api/files/${encodeURIComponent(e)}`}async function jl(e){return(await kl(`POST`,`/api/session`,{token:e})).session}function Ml(e){return kl(`GET`,Al(e))}var Nl=6e4;function Pl(e){return new TextEncoder().encode(e).length<=Nl}function Fl(e){return Pl(JSON.stringify(e))}async function Il(e,t,n={keepalive:!1}){let r=JSON.stringify(t),i;try{i=await fetch(Al(e),{method:`PUT`,credentials:`same-origin`,headers:{"content-type":`application/json`},body:r,keepalive:n.keepalive&&Pl(r)})}catch{throw Error(`koboyo isn't answering`)}let a=await i.json().catch(()=>({}));if(i.ok)return{kind:`saved`,revision:a.revision};if(i.status===409){let e=a;return{kind:`conflict`,revision:e.revision,document:e.document}}if(i.status>=500)throw Error(typeof a.error==`string`?a.error:`koboyo could not save`);return{kind:`rejected`,message:typeof a.error==`string`?a.error:`The board could not be saved.`}}async function Ll(e,t){return(await kl(`POST`,`${Al(e)}/code`,{choice:t})).code}async function Rl(e,t,n=null){await kl(`POST`,`/api/send`,{file:e,note:t,chosen:n})}function zl(e,t){return kl(`POST`,`/api/cloud`,e,t)}function Bl(e){return kl(`POST`,`/api/cloud/sign-in`,{},e)}var Vl={list(e){return kl(`GET`,`${Al(e)}/comments`)},create(e,t,n,r){return kl(`POST`,`${Al(e)}/comments`,{id:t,body:n,anchor:r})},reply(e,t,n,r){return kl(`POST`,`${Al(e)}/comments/${encodeURIComponent(t)}/replies`,{id:n,body:r})},update(e,t,n){return kl(`PATCH`,`${Al(e)}/comments/${encodeURIComponent(t)}`,{body:n})},move(e,t,n){return kl(`PUT`,`${Al(e)}/comments/${encodeURIComponent(t)}/anchor`,{anchor:n})},resolve(e,t,n){return kl(`PUT`,`${Al(e)}/comments/${encodeURIComponent(t)}/resolved`,{resolved:n})},remove(e,t){return kl(`DELETE`,`${Al(e)}/comments/${encodeURIComponent(t)}`)}};function Hl(e){return kl(`GET`,`/api/links/resolve?url=${encodeURIComponent(e)}`).then(e=>e.url).catch(()=>null)}function Ul(e){return{x:e.x+e.width+48,y:e.y}}function Wl(e,t,n){if(e.length===0)return[];let r=Math.ceil(Math.sqrt(e.length)),i=Math.max(...e.map(e=>e.width)),a=[],o=t.y;for(let s=0;s*r<e.length;s+=1){let c=e.slice(s*r,s*r+r),l=0;c.forEach((e,r)=>{a.push({x:t.x+r*(i+n),y:o}),l=Math.max(l,e.height)}),o+=l+n}return a}function Gl(e,t,n,r=188){let i=cn(e),a={right:{x:i.width+r,y:0},left:{x:-(i.width+r),y:0},down:{x:0,y:i.height+r},up:{x:0,y:-(i.height+r)}}[t],o=t===`left`||t===`right`?{x:0,y:i.height+r}:{x:i.width+r,y:0},s=i.x+a.x,c=i.y+a.y,l=n.filter(t=>t.id!==e.id&&(Rt(t)&&t.type!==`figure`||t.type===`table`)),u=()=>l.some(e=>{let t=cn(e);return s-24<t.x+t.width&&s+i.width+24>t.x&&c-24<t.y+t.height&&c+i.height+24>t.y});for(let e=0;e<50&&u();e+=1)s+=o.x,c+=o.y;return{x:s,y:c,width:i.width,height:i.height}}function Kl(e){return e.type===`arrow`?!e.startBinding&&!e.endBinding:e.type!==`polygon`||e.band==null}function ql(e,t,n){let r=e.filter(Kl);if(r.length<2)return e;let i=r.map(e=>cn(e,n)),a=Ge(i.flatMap(e=>[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y+e.height}])),o=a.x,s=a.x+a.width,c=a.y,l=a.y+a.height,u=(o+s)/2,d=(c+l)/2,f=new Map(r.map((e,n)=>{let r=i[n],a=0,f=0;switch(t){case`left`:a=o-r.x;break;case`right`:a=s-(r.x+r.width);break;case`center-h`:a=u-(r.x+r.width/2);break;case`top`:f=c-r.y;break;case`bottom`:f=l-(r.y+r.height);break;case`middle`:f=d-(r.y+r.height/2);break}return[e.id,Ln(e,{x:a,y:f})]}));return e.map(e=>f.get(e.id)??e)}function Jl(e,t,n){let r=e.filter(Kl);if(r.length<3)return e;let i=t===`horizontal`,a=r.map(e=>({shape:e,b:cn(e,n)}));a.sort((e,t)=>i?e.b.x-t.b.x:e.b.y-t.b.y);let o=e=>i?e.width:e.height,s=e=>i?e.x:e.y,c=s(a[0].b),l=a[a.length-1].b,u=s(l)+o(l),d=a.reduce((e,t)=>e+o(t.b),0),f=(u-c-d)/(a.length-1),p=new Map,m=c;for(let e of a){let t=m-s(e.b);p.set(e.shape.id,Ln(e.shape,i?{x:t,y:0}:{x:0,y:t})),m+=o(e.b)+f}return e.map(e=>p.get(e.id)??e)}function Yl(e,t){return{x:t.x,y:t.y,width:t.width,height:t.height,align:`center`,valign:`middle`,fontSize:e.fontSize}}var Xl={input:(e,t,n)=>({...n,x:t.x+12,width:t.width-24,align:`left`}),search:(e,t,n)=>{let r=ni(t);return{...n,x:t.x+r,width:t.width-r-12,align:`left`}},dropdown:(e,t,n)=>({...n,x:t.x+12,width:t.width-12-30,align:`left`}),checkbox:(e,t,n)=>({...n,x:t.x+32,width:t.width-32,align:`left`}),radio:(e,t,n)=>({...n,x:t.x+32,width:t.width-32,align:`left`}),toggle:(e,t,n)=>{let r=Wr(t);return{...n,x:t.x+r,width:Math.max(40,t.width-r),align:`left`}},slider:(e,t,n)=>({...n,y:t.y+2,height:e.fontSize*1.4,align:`left`,valign:`top`,fontSize:e.fontSize*.7}),heading:(e,t,n)=>({...n,align:`left`,fontSize:e.fontSize*ei}),badge:(e,t,n)=>({...n,fontSize:e.fontSize*Gr}),statusbar:(e,t,n)=>({...n,x:t.x+8,width:Math.max(40,t.width/2),align:`left`,fontSize:e.fontSize*Hr}),image:(e,t,n)=>({...n,y:t.y+t.height/2,height:t.height/2,fontSize:e.fontSize*.8}),paragraph:(e,t,n)=>({...n,align:`left`,valign:`top`,fontSize:e.fontSize*.9}),textarea:(e,t,n)=>({...n,x:t.x+12,y:t.y+12,width:t.width-24,height:t.height-24,align:`left`,valign:`top`,fontSize:e.fontSize*.9}),stepbadge:(e,t,n)=>{let r=Math.min(t.width,t.height)/2;return{...n,fontSize:r*.95}},stepper:(e,t,n)=>{let r=qr(t);return{...n,x:t.x+r,width:Math.max(20,t.width-r*2)}},alert:(e,t,n)=>{let r=ai(t);return{...n,x:t.x+r,width:Math.max(40,t.width-r-12),align:`left`}},card:(e,t,n,r)=>{let i=r===`body`?pi(e).body:pi(e).title;return{...n,x:i.x,y:i.y,width:i.width,height:i.height,align:`left`,valign:`top`,fontSize:i.fontSize}},modal:(e,t,n,r)=>{let i=di(t);if(r===`primary`||r===`secondary`){let i=bi(t),a=i?i[r]:null;if(a)return{...n,x:a.x,y:a.y,width:a.width,height:a.height,align:`center`,valign:`middle`,fontSize:e.fontSize*.82}}if(r===`body`){let r=t.y+i+10,a=t.y+t.height-ui(t);return{...n,x:t.x+12,y:r,width:t.width-24,height:Math.max(e.fontSize,a-r),align:`left`,valign:`top`,fontSize:e.fontSize*.92}}return{...n,x:t.x+12,y:t.y,width:Math.max(40,t.width-24-24),height:i,align:`left`}},entity:(e,t,n,r)=>{let i=r===`body`?Lr(e).body:Lr(e).title;return{...n,x:i.x,y:i.y,width:i.width,height:i.height,align:r===`body`?`left`:`center`,valign:r===`body`?`top`:`middle`,fontSize:i.fontSize,lineHeight:wr}},breadcrumbs:(e,t,n)=>({...n,align:`left`}),lifeline:(e,t,n)=>({...n,height:zr(e)}),fragment:(e,t,n)=>({...n,x:t.x+12,y:t.y+e.fontSize*Or,width:Math.max(e.fontSize*3,t.width-24),height:Tr(e),align:`left`,valign:`middle`,fontSize:e.fontSize}),tooltip:(e,t,n)=>({...n,height:t.height-8})};function Zl(e,t=`label`){let n=W(e),r=Yl(e,n);return Xl[e.kind]?.(e,n,r,t)??r}function Ql(e){return e===`card`||e===`modal`||e===`entity`}var $l=500;function eu(e){let t=()=>e.temporal.getState(),n=null,r=null;e.historyGate.holding=()=>{if(n===null)return!1;let e=t().pastStates;return(e.length>0?e[e.length-1]:null)!==r};let i=[],a=new Map,o=new WeakMap;function s(){if(i.length===0)return;let n=i,a=e=>{let t=o.get(e);if(t===void 0||!e.shapes)return e;let r=e.shapes;for(let e=t;e<n.length;e+=1){let t=n[e].filter(e=>e.o!==`put`||oe(e.shape));r=fe(r,t)}return{...e,shapes:r}},{pastStates:s,futureStates:c}=t(),u=s.map(a),d=r===null?-1:s.indexOf(r);d!==-1&&(r=u[d]);let f=l===null?-1:s.indexOf(l);l=f===-1?null:u[f],e.temporal.setState({pastStates:u,futureStates:c.map(a)}),i=[],o=new WeakMap}let c=!1,l=null,u=0,d=0;function f(){a=new Map;let e=t().pastStates;n=e.length,r=e.length>0?e[e.length-1]:null}function p(){let t=e.getState(),{shapes:n,activeGroupId:r,selectedIds:i,lockRevealId:a}=t;r&&!n.some(e=>e.groupId===r)&&t.setActiveGroupId(null);let o=new Set(n.map(e=>e.id));[...i].some(e=>!o.has(e))&&t.setSelectedIds(new Set([...i].filter(e=>o.has(e)))),a&&!o.has(a)&&t.setLockRevealId(null)}function m(){if(n===null)return;let i=r;n=null,r=null;let a=t().pastStates,o;if(i===null)o=+(a.length>0);else{let e=a.indexOf(i);o=e===-1?1:e+2}a.length>o&&e.temporal.setState({pastStates:a.slice(0,o),futureStates:[]})}function h(){m()}function g(){n!==null&&m(),f()}function _(e){if(d>0)return e();g(),d+=1;try{return e()}finally{--d,h()}}function v(){let e=t().pastStates;return e.length>0?e[e.length-1]:null}function y(t){if(u>0)return t();if(!c)throw Error(`The user stopped this turn, so nothing was applied.`);if(e.getState().viewMode)throw Error(`The board is in view mode, so nothing was changed.`);let i=n===null?null:a;i&&m();let o=l!==null&&v()===l;f();let s=r;u=1;try{return t()}finally{u=0,m(),b(o,s),i&&(f(),a=i)}}function b(n,r){let i=t().pastStates;if(!(i.length>0&&i[i.length-1]!==r))return;let a=n?i.indexOf(l):-1;if(a!==-1&&a===i.length-2){e.temporal.setState({pastStates:i.slice(0,a+1)});return}l=i[i.length-1]}function x(n,r){if(e.getState().viewModeLocked)return 0;m(),l=null,s();let i=0;for(let e=0;e<r;e+=1){let e=t();if(n===`undo`){if(e.pastStates.length===0)break;e.undo()}else{if(e.futureStates.length===0)break;e.redo()}i+=1}return p(),i}function S(e,t){if(!c)throw Error(`The user stopped this turn, so nothing was applied.`);return x(e,t)}return{undo(){x(`undo`,1)},redo(){x(`redo`,1)},stepHistory:x,beginTransaction:g,endTransaction:h,withTransaction:_,async withTransactionAsync(e){g();try{return await e()}finally{h()}},beginAiTurn(){c=!0,l=null},endAiTurn(){c=!1,l=null},ai:{withTransaction:y,stepHistory:S},runWithoutHistory(e){let n=t();n.pause();try{e()}finally{n.resume()}},remoteEditsDuringGesture:()=>a,applyRemote(r){if(r.length===0)return;let c=t(),l=i.length;for(let e of[...c.pastStates,...c.futureStates])o.has(e)||o.set(e,l);i.push(r);for(let e of r){if(e.o===`put`){a.set(e.shape.id,`all`);continue}if(e.o!==`set`)continue;let t=a.get(e.id);if(t===`all`)continue;let n=t??new Set;for(let t of[...Object.keys(e.props),...e.unset??[]])n.add(t);a.set(e.id,n)}c.pause();try{e.getState().applyRemoteOps(r)}finally{c.resume()}i.length>$l&&n===null&&s()}}}function tu(e){let t=!1,n=()=>{t=document.querySelector(`[data-panel-popup][data-open][data-editor-runtime-id="${e}"]`)!==null};return{install(){return window.addEventListener(`pointerdown`,n,!0),window.addEventListener(`keydown`,n,!0),()=>{window.removeEventListener(`pointerdown`,n,!0),window.removeEventListener(`keydown`,n,!0)}},openAtEvent:()=>t}}function nu(){let e=!1,t=0,n=()=>{t!==0&&(cancelAnimationFrame(t),t=0)};return{guard(){e=!0,n(),t=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>{t=0,e=!1})})},isGuarded:()=>e,release(){n(),e=!1},dispose(){n(),e=!1}}}var ru=800;function iu(){let e=null;return{note(t){e={...t,at:performance.now()}},take(){let t=e;return e=null,!t||performance.now()-t.at>ru?null:{x:t.x,y:t.y}}}}function au(e,t){let n=e.ownerDocument,r=null;if(typeof n.caretPositionFromPoint==`function`){let e=n.caretPositionFromPoint(t.x,t.y);e&&(r=n.createRange(),r.setStart(e.offsetNode,e.offset))}else typeof n.caretRangeFromPoint==`function`&&(r=n.caretRangeFromPoint(t.x,t.y));return!r||!e.contains(r.startContainer)?null:(r.collapse(!0),r)}var ou=320;function su(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}var cu={requestFrame:e=>requestAnimationFrame(e),cancelFrame:e=>cancelAnimationFrame(e),now:()=>performance.now(),addPointerDownListener:e=>(window.addEventListener(`pointerdown`,e,{capture:!0}),()=>window.removeEventListener(`pointerdown`,e,{capture:!0}))};function lu(e=cu){let t=0,n=null,r=()=>{e.cancelFrame(t),n?.(),n=null};return{animate:(i,a,o,s=ou)=>{if(r(),s<=0){o(a);return}let c=e.now();n=e.addPointerDownListener(r);let l=r=>{let u=Xe((r-c)/s),d=su(u);o({x:i.x+(a.x-i.x)*d,y:i.y+(a.y-i.y)*d,zoom:i.zoom+(a.zoom-i.zoom)*d}),u<1?t=e.requestFrame(l):(n?.(),n=null)};t=e.requestFrame(l)},cancel:r,isAnimating:()=>n!==null}}function uu(){let e=null;return{recordFreedSpace(t){e=t},takeFreedSpace(t){return du(e,t,()=>{e=null})}}}function du(e,t,n){return n(),e?t.some(t=>t.type===`arrow`||t.type===`line`||t.type===`draw`?!1:ot(W(t),e))?null:{x:e.x,y:e.y}:null}function fu(){return{labelHeights:new Map,labelWidths:new Map}}function pu(e,t){let n=(n,r)=>{let i=e.current?.querySelector(r);return i instanceof HTMLElement?{width:i.offsetWidth,height:i.offsetHeight}:(t.add(n),null)};return{textBounds:e=>n(e,zi(e)),iconLabelBounds:e=>n(e,Bi(`data-icon-label`,e))}}var mu=0;function hu(e){mu+=1;let t=`editor-runtime-${mu}`,n={current:null},r=new Set,i=pu(n,r),a=Ce(e,i),o=nu(),s=lu();return{id:t,store:a,history:eu(a),popupGuard:tu(t),textEditGuard:o,editEntry:iu(),viewportAnimation:s,placement:uu(),measurements:fu(),measurementRoot:n,measurement:i,measureMisses:r,dispose:()=>{s.cancel(),o.dispose()}}}function gu(e,t,n={}){return{id:Yn(),type:`text`,x:e.x,y:e.y,text:``,fontSize:t.fontSize,fontFamily:t.fontFamily,rotation:0,color:t.color===`transparent`?ur:t.color,opacity:t.opacity,...n}}function _u(e,t){return t.lockId?e.filter(e=>e.lockId===t.lockId):[t]}function vu(e,t){let n=t?xr(e,t):void 0;return n&&n.locked?_u(e,n):[]}function yu(e){return tn[e.type].hit===`stroke`}var bu=16;function xu(e){if(!yu(e))return null;if(e.type===`arrow`){if(e.bendStyle===`elbow`)return Wn(e);let t=ar(e);return t?Array.from({length:17},(e,n)=>t.pointAt(n/bu)):[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]}return e.type===`draw`||e.type===`line`?e.points:null}function Su(e){return e.type===`draw`?gn(e)/2:(`strokeWidth`in e?e.strokeWidth??0:0)/2}function Cu(e){return Su(e)}function wu(e,t){let n=xu(e);if(!n||n.length<2)return!1;let r=Su(e);for(let e=0;e<n.length-1;e+=1)if(mt(n[e],n[e+1],t,r))return!0;return!1}function Tu(e,t,n=16/2){let r=xu(e);if(!r||r.length<2)return!1;let i=n+Su(e);for(let e=0;e<r.length-1;e+=1)if(rt(t,r[e],r[e+1])<=i)return!0;return!1}function Eu(e){return e.length>0&&e.every(yu)}var Du=.5;function Ou(e,t,n){let r=[...e].reverse().find(e=>{if(!_n(e))return!1;let{body:r,toLocal:i}=aa(e,n),a=i(t);return Math.abs(a.x-(r.x+r.width/2))<=r.width*Du/2&&Math.abs(a.y-(r.y+r.height/2))<=r.height*Du/2});return r?{kind:`label`,id:r.id}:e.some(e=>ia(e,t,n))?{kind:`shape`}:{kind:`empty`}}function ku(e,t){return Eu(e)?null:Bt(e,t)}function Au(e,t,n,r){let{shapes:i,selectedIds:a,activeGroupId:o,lockRevealId:s}=e,c=ku(vu(i,s),r);if(c&&dt(t,c))return null;let l=ku(sa(i,a),r);if(l&&dt(t,l))return null;if(n?.locked)return{lockRevealId:n.id,selectedIds:new Set};if(!n)return{lockRevealId:null,selectedIds:new Set};let u=n.groupId&&n.groupId!==o?i.filter(e=>e.groupId===n.groupId).map(e=>e.id):[n.id];return{lockRevealId:null,selectedIds:new Set(u)}}function ju(){let{notify:e}=_(),t=U(),n=H(e=>e.limitNotice);(0,J.useEffect)(()=>{n&&(e(n.message),t.getState().clearLimitNotice())},[n,e,t]);let r=H(e=>e.opaqueShapes),i=(0,J.useRef)(null);(0,J.useEffect)(()=>{r.length===0||i.current===r||(i.current=r,e(r.length===1?`One shape here was made in a newer version of Koboyo. It is kept and saved, but this version can't show or edit it.`:`${r.length} shapes here were made in a newer version of Koboyo. They are kept and saved, but this version can't show or edit them.`))},[r,e]),(0,J.useEffect)(()=>{let n=ke(t.getState().shapes.length,`resume`);n&&e(n.message)},[])}function Mu(e){let{onDocumentChange:t,onViewportChange:n,onPreferencesChange:r}=e,i=U();(0,J.useEffect)(()=>i.subscribe((e,i)=>{t&&e.shapes!==i.shapes&&t({version:_e,shapes:e.shapes}),n&&e.viewport!==i.viewport&&e.presentingIndex===null&&n(e.viewport),r&&(e.showGrid!==i.showGrid||e.snapEnabled!==i.snapEnabled||e.presentationAnimation!==i.presentationAnimation||e.showZoomIndicator!==i.showZoomIndicator||e.theme!==i.theme)&&r({showGrid:e.showGrid,snapEnabled:e.snapEnabled,presentationAnimation:e.presentationAnimation,showZoomIndicator:e.showZoomIndicator,theme:e.theme})}),[i,t,n,r])}function Nu(e,t){return e*t>=5}function Pu(e){let t=new Set;for(let n of e){let e=`fontSize`in n?n.fontSize:void 0;t.add(typeof e==`number`?e:20)}return[...t].sort((e,t)=>e-t)}function Fu(e,t){return e.filter(e=>Nu(e,t)).join(`,`)}var Iu=5/20;function Lu(e,t,n){let r=Jr(e);if(r.length>0)return si(W(r.find(e=>!e.slideSkipped)??r[0],n),t);let i=Bt(e,n);if(i===null)return null;let a=si(i,t);if(a.zoom>=Iu)return a;let o=Iu;return{zoom:o,x:t.width/2-(i.x+i.width/2)*o,y:t.height/2-(i.y+i.height/2)*o}}function Ru(e,t){let{publicShare:n}=B(),r=V();(0,J.useLayoutEffect)(()=>{let i=e.current;if(!i)return;let{store:a,measurement:o}=r,{shapes:s,setViewport:c,fitToBounds:l}=a.getState(),u=i.getBoundingClientRect(),d={width:u.width,height:u.height},f={x:u.width/2,y:u.height/2},p=Bt(s,o);if(p===null){t||c(e=>({...e,x:f.x,y:f.y}));return}if(n&&!t){let e=Lu(s,d,o);e&&c(()=>e);return}let m=a.getState().viewport,h=t?m:{...m,...f};if(Ze(p,{x:-h.x/h.zoom,y:-h.y/h.zoom,width:u.width/h.zoom,height:u.height/h.zoom})){t||c(e=>({...e,x:f.x,y:f.y}));return}l(p,d)},[e,t,n,r])}function zu(e,t,n){for(let r of document.elementsFromPoint(t,n)){let t=r.closest(`[data-shape-id]`)?.getAttribute(`data-shape-id`);if(t)return xr(e,t)??null}return null}var Bu=[`Shift`,`Meta`,`Alt`,`Control`],Vu=1e3,Hu=`keydown`,Uu=typeof navigator==`object`?navigator.platform:``,Wu=/Mac|iPod|iPhone|iPad/.test(Uu)?`Meta`:`Control`,Gu=Uu===`Win32`?[`Control`,`Alt`]:[`Alt`];function Ku(e){return!!(e.key&&e.code&&e.getModifierState)}function qu(e){let t=e.target;return e.repeat||e.isComposing||t!==e.currentTarget&&t.matches(`[contenteditable],input,select,textarea`)}function Ju(e,t){return typeof e.getModifierState==`function`?e.getModifierState(t)||Gu.includes(t)&&e.getModifierState(`AltGraph`):!1}function Yu(e){return e.trim().split(` `).map(e=>{let t=e.split(/(?<=\w|\])\+/),n=t.pop(),r=n.match(/^\((.+)\)$/),i=r?RegExp(`^(?:${r[1]})$`,`iv`):n,a=[],o=[];for(let e of t){let t=e.match(/^\[(.*)\]$/),n=t?.[1]??e;n=n===`$mod`?Wu:n,t?o.push(n):a.push(n)}return[a,o,i]})}function Xu(e,[t,n,r]){let i=t.includes(`AltGraph`);return!((r instanceof RegExp?!(r.test(e.key)||r.test(e.code)):r.toUpperCase()!==e.key.toUpperCase()&&r!==e.code)||t.find(t=>!Ju(e,t))||Bu.find(a=>!t.includes(a)&&!n.includes(a)&&r!==a&&Ju(e,a)&&!(i&&Gu.includes(a))))}function Zu(e,t={}){let n=t.timeout??Vu,r=t.ignore??qu,i=Object.keys(e).map(t=>[t,Yu(t),e[t]]),a=new Map,o=null;return e=>{if(!Ku(e)||r(e))return;let t=[];for(let[n,r,o]of i){let[i,...s]=a.get(n)||r;if(!Xu(e,i))Ju(e,e.key)||a.delete(n);else if(s.length>0)a.set(n,s),t.push(n);else if(a.delete(n),t.length)console.warn(`tinykeys: Conflict found, "${n}" did not fire, waiting for:`,t);else{o(e);break}}o&&clearTimeout(o),o=setTimeout(()=>a.clear(),n)}}function Qu(e,t,n={}){let r=n.event??Hu,i=Zu(t,n);return e.addEventListener(r,i,n.capture),()=>{e.removeEventListener(r,i,n.capture)}}var $u=`infinite-canvas/clipboard`,ed=1,td=`data-infinite-canvas-clipboard`;function nd(e,t){return JSON.stringify({type:$u,version:1,copyId:t,shapes:e})}function rd(e){if(!e)return null;let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`)return null;let n=t;if(n.type!==$u||n.version!==ed||!Array.isArray(n.shapes)||n.shapes.length===0)return null;let r=ge({version:_e,shapes:n.shapes});return r.status===`valid`?{copyId:typeof n.copyId==`string`?n.copyId:``,shapes:Ae(r.document,r.opaque).shapes}:null}function id(e){if(!e)return null;let t=e.match(RegExp(`${td}="([^"]*)"`));return t?rd(sd(t[1])):null}function ad(e){let t=[];for(let n of e){let e=n,r=od(typeof e.text==`string`?e.text:typeof e.label==`string`?e.label:``).trim();r&&t.push(r)}return t.join(`
|
|
11
|
+
`)}function od(e){return sd(e.replace(/<br\s*\/?>/gi,`
|
|
12
|
+
`).replace(/<\/(p|div|li|h[1-6])>/gi,`
|
|
13
|
+
`).replace(/<[^>]+>/g,``).replace(/ /g,` `))}function sd(e){return e.replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/&/g,`&`)}async function cd(e,t){let n=nd(e,t),r=ad(e),i=`<div ${td}="${ye(n)}">${ye(r)}</div>`;try{await Wa(r,i)}catch{}}var ld=`http://www.w3.org/2000/svg`,ud=5e5,dd=300,fd=150,pd={"":1,px:1,pt:96/72,pc:16,in:96,cm:96/2.54,mm:96/25.4};function md(e){if(!e||e.length>ud)return!1;let t=e.search(/<svg[\s>]/i);if(t===-1)return!1;let n=e.slice(0,t).trim();return n&&!/^(?:<\?xml[^>]*\?>|<!DOCTYPE[^>]*>|<!--[\s\S]*?-->|\s)+$/i.test(n)?!1:/<\/svg\s*>\s*$/i.test(e)}function hd(e){let t=Cd(e.viewBox),n=Y(e.width),r=Y(e.height);return t&&(n&&!r?r=n*(t.height/t.width):r&&!n&&(n=r*(t.width/t.height))),{width:wd(n??t?.width??dd),height:wd(r??t?.height??fd)}}function gd(e){let t=e.trim();if(!md(t))return null;let n=yd(t);if(!n)return null;bd(n);let r=hd({width:n.getAttribute(`width`),height:n.getAttribute(`height`),viewBox:n.getAttribute(`viewBox`)});return n.getAttribute(`viewBox`)||n.setAttribute(`viewBox`,`0 0 ${r.width} ${r.height}`),n.setAttribute(`width`,String(r.width)),n.setAttribute(`height`,String(r.height)),n.setAttribute(`xmlns`,ld),{markup:new XMLSerializer().serializeToString(n),width:r.width,height:r.height}}function _d(e){let t=new TextEncoder().encode(e),n=``;for(let e=0;e<t.length;e+=8192)n+=String.fromCharCode(...t.subarray(e,e+8192));return`data:image/svg+xml;base64,${btoa(n)}`}function vd(e){let t=gd(e);return t?new File([t.markup],`pasted.svg`,{type:`image/svg+xml`}):null}function yd(e){let t=e;/\sxmlns\s*=/i.test(t)||(t=t.replace(/<svg\b/i,`<svg xmlns="${ld}"`)),/\sxlink:/i.test(t)&&!/\sxmlns:xlink\s*=/i.test(t)&&(t=t.replace(/<svg\b/i,`<svg xmlns:xlink="http://www.w3.org/1999/xlink"`));let n;try{n=new DOMParser().parseFromString(t,`image/svg+xml`)}catch{return null}if(n.getElementsByTagName(`parsererror`).length>0)return null;let r=n.documentElement;return r.namespaceURI!==ld||r.localName.toLowerCase()!==`svg`?null:r}function bd(e){for(let t of[...e.querySelectorAll(`script`)])t.remove();let t=e=>{for(let t of[...e.attributes]){let n=t.name.toLowerCase();(n.startsWith(`on`)||xd(n)&&Sd(t.value))&&e.removeAttribute(t.name)}for(let n of e.children)t(n)};t(e)}function xd(e){return e===`href`||e===`xlink:href`||e===`src`}function Sd(e){let t=e.trim().toLowerCase();return t.startsWith(`javascript:`)||t.startsWith(`vbscript:`)||t.startsWith(`data:text/html`)}function Y(e){if(!e)return null;let t=/^\s*([+-]?(?:\d+\.?\d*|\.\d+))\s*([a-z%]*)\s*$/i.exec(e);if(!t)return null;let n=pd[t[2].toLowerCase()];if(n===void 0)return null;let r=Number(t[1])*n;return r>0?r:null}function Cd(e){if(!e)return null;let t=e.trim().split(/[\s,]+/).map(Number);if(t.length!==4||t.some(e=>!Number.isFinite(e)))return null;let[,,n,r]=t;return n<=0||r<=0?null:{width:n,height:r}}function wd(e){return Math.max(1,Math.round(e*100)/100)}var Td=new Set([`image/heic`,`image/heif`,`image/heic-sequence`,`image/heif-sequence`]),Ed=/\.(heic|heif|hif)$/i,Dd=`image/heic`;function Od(e){let t=e.type.toLowerCase();return Td.has(t)?!0:Ed.test(e.name)?!t.startsWith(`image/`):!1}async function kd(e,t){try{return await createImageBitmap(e)}catch{}if(!t)return null;try{return await t(e)}catch(e){return console.warn(`[koboyo] HEIC decode failed: ${String(e)}`),null}}var Ad=new Set([`image/svg+xml`,`image/gif`]);function jd(e){return e.type.startsWith(`image/`)||Od(e)}function Md(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`Failed to decode image`)),r.src=e})}function Nd(e,t){let n=Math.max(1,Math.round(e.width)),r=Math.max(1,Math.round(e.height)),i={width:n,height:r,encodeAs:null};if(Ad.has(e.type))return i;let a=Math.min(1,t.maxEdge/Math.max(n,r));if(a>=1&&e.bytes<t.minBytes&&!Td.has(e.type))return i;let o=e.type===`image/png`&&t.keepPng===`always`?`image/png`:`image/jpeg`;return{width:Math.max(1,Math.round(n*a)),height:Math.max(1,Math.round(r*a)),encodeAs:o}}function Pd(e){let t=e.slice(e.indexOf(`,`)+1);return Math.floor(t.length*3/4)}function Fd(e,t,n){try{let{data:r}=e.getImageData(0,0,t,n);for(let e=3;e<r.length;e+=4)if(r[e]<255)return!0;return!1}catch{return!0}}async function Id(e,t,n){let r=Od(e)?await Rd(e,n):await Ld(e);if(!r)return null;try{return zd(r,t)}finally{typeof ImageBitmap<`u`&&r.pixels instanceof ImageBitmap&&r.pixels.close()}}async function Ld(e){let t,n;try{t=await Fi(e),n=await Md(t)}catch{return null}return{pixels:n,width:n.naturalWidth||1,height:n.naturalHeight||1,bytes:e.size,type:e.type||`image/png`,original:t}}async function Rd(e,t){let n=await kd(e,t);return n?{pixels:n,width:n.width||1,height:n.height||1,bytes:e.size,type:Dd,original:null}:null}function zd(e,t){let n=e.original,r=Nd(e,t),i=()=>n===null?null:{url:n,mediaType:e.type,width:e.width,height:e.height};if(!r.encodeAs)return i();try{let a=document.createElement(`canvas`);a.width=r.width,a.height=r.height;let o=a.getContext(`2d`);if(!o)return i();o.imageSmoothingEnabled=!0,o.imageSmoothingQuality=`high`,o.drawImage(e.pixels,0,0,r.width,r.height);let s=r.encodeAs===`image/jpeg`&&t.keepPng===`when-transparent`&&Fd(o,r.width,r.height)?`image/png`:r.encodeAs,c=s===`image/png`?a.toDataURL(`image/png`):a.toDataURL(`image/jpeg`,t.quality),l=r.width===e.width&&r.height===e.height;return n!==null&&l&&Pd(c)>=Pd(n)?i():{url:c,mediaType:s,width:r.width,height:r.height}}catch{return i()}}var Bd=[/^(<!doctype\s+html\b|<html[\s>])/i,/<iframe\b/i,/^https:\/\/\S+$/i,/^-?\d{1,3}\.\d+\s*,\s*-?\d{1,3}\.\d+$/,/#[0-9a-f]{3}|\b(rgba?|hsla?|oklch)\(/i,/^(%%[^\n]*\n\s*)*(flowchart|graph|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|mindmap|timeline|journey|pie|gitGraph)\b/,/^\[/];function Vd(e){let t=e.trim();return t!==``&&Bd.some(e=>e.test(t))}function Hd(e,t){let n=Ja(e);if(n)return n;let r=qa(t);if(r)return r;let i=to(t);return i&&i.length>1?i:null}function Ud(e,t,n,r){let i=Hd(e.html,e.plainText);if(i){r(),t.pasteGrid(i);return}if(e.imageFile){r(),t.addImageFromFile(e.imageFile);return}if(e.hasFiles){r(),n(`Unsupported file type`);return}let a=e.plainText.trim();if(a){r(),t.pasteText(a);return}if(t.hasClipboard()){r(),t.pasteClipboard();return}n(`Nothing to paste`)}function Wd(e){if(e?.items){for(let t of e.items)if(t.type.startsWith(`image/`))return t.getAsFile()}return e?[...e.files].find(jd)??null:null}var Gd=()=>{};async function Kd(e,t,n){let r=null;try{r=await wi(()=>import(`./rich-paste-route-Bx69sREx.js`),__vite__mapDeps([0,1,2,3,4]))}catch{r=null}r&&await r.pasteRichText(e,Ja(e.html)!==null,t,n)||Ud(e,t,n,Gd)}function qd(e,t,n){let r=e.clipboardData,i=id(r?.getData(`text/html`)??``)??rd(r?.getData(`text/plain`)??``);if(i){e.preventDefault(),i.copyId===t.clipboardCopyId()&&t.hasClipboard()?t.pasteClipboard():t.pasteExternal(i.shapes,i.copyId);return}let a=r?.getData(`text/plain`)??``,o=vd(a);if(o){e.preventDefault(),t.addImageFromFile(o);return}let s={plainText:a,html:r?.getData(`text/html`)??``,imageFile:Wd(r),hasFiles:!!(r&&r.files.length>0)};if(Vd(a)){e.preventDefault(),Kd(s,t,n);return}Ud(s,t,n,()=>e.preventDefault())}function Jd(e){if(e.type===`line`)return e.points;if(e.type===`arrow`){let t=e.elbowPoints??e.elbowRoute;return e.bendStyle===`elbow`&&t&&t.length>=2?t:[{x:e.x,y:e.y},{x:e.x2,y:e.y2}]}return null}function Yd(e){return e.type===`line`||e.type===`arrow`&&e.bendStyle!==`elbow`&&!e.bend}function Xd(e,t){let n=[];for(let r of e){if(r.id===t||r.type===`draw`)continue;if(r.type===`line`){let e=r.points.length-1;r.points.forEach((t,i)=>{n.push({point:t,attach:{shapeId:r.id,seg:i===e?e-1:i,t:+(i===e)}})});continue}if(r.type===`arrow`){n.push({point:{x:r.x,y:r.y},attach:{shapeId:r.id,seg:0,t:0}},{point:{x:r.x2,y:r.y2},attach:{shapeId:r.id,seg:0,t:1}});continue}let{body:e,toWorld:i}=aa(r),a=[e.x,e.x+e.width/2,e.x+e.width],o=[e.y,e.y+e.height/2,e.y+e.height];for(let e of a)for(let t of o)n.push({point:i({x:e,y:t}),attach:null})}return n}function Zd(e,t){let n=[];for(let r of e){if(r.id===t||r.type!==`line`&&r.type!==`arrow`||r.type===`arrow`&&r.bendStyle!==`elbow`&&r.bend)continue;let e=Jd(r);if(!e)continue;let i=Yd(r);for(let t=0;t<e.length-1;t+=1)n.push({a:e[t],b:e[t+1],attach:i?{shapeId:r.id,seg:t,t:0}:null})}return n}var Qd=256,$d=4;function ef(e,t){return`${e},${t}`}function tf(e){let t=new Map;return e.forEach((e,n)=>{let r=ef(Math.floor(e.point.x/Qd),Math.floor(e.point.y/Qd)),i=t.get(r);i?i.push(n):t.set(r,[n])}),t}function nf(e,t,n){let r=Math.floor((t.x-n)/Qd),i=Math.floor((t.x+n)/Qd),a=Math.floor((t.y-n)/Qd),o=Math.floor((t.y+n)/Qd);if(!Number.isFinite(r+i+a+o)||i-r>$d||o-a>$d)return e.points;e.grid??=tf(e.points);let s=[];for(let t=r;t<=i;t+=1)for(let n=a;n<=o;n+=1){let r=e.grid.get(ef(t,n));for(let e of r??[])s.push(e)}return s.sort((e,t)=>e-t),s.map(t=>e.points[t])}var rf=null;function af(e,t,n){if(e===t)return!0;if(e.length!==t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[r]&&(e[r].id!==n||t[r].id!==n))return!1;return!0}function of(e,t){return rf&&rf.excludeId===t&&af(rf.shapes,e,t)||(rf={shapes:e,excludeId:t,points:Xd(e,t),grid:null,segments:null}),rf}function sf(e,t,n){let r=null,i=n;for(let n of t){let t=$e(e,n.point);t<=i&&(r={point:n.point,attach:n.attach},i=t)}return r}function cf(e,t,n){let r=null,i=n;for(let n of t){let t=et(e,n.a,n.b),a=$e(e,t);if(a<=i){let e=$e(n.a,n.b);r={point:t,attach:n.attach&&e?{...n.attach,t:$e(n.a,t)/e}:null},i=a}}return r}function lf(e,t,n,r,i){let a=of(t,r),o=sf(e,nf(a,e,n),n);if(i){let t=o?$e(e,o.point):n;for(let n of i){let r=$e(e,n);r<=t&&(o={point:n,attach:null},t=r)}}return o||(a.segments??=Zd(t,r),cf(e,a.segments,n))}function uf(e,t,n){return{...hi(n,e,{fontFamily:t.fontFamily,color:t.color,opacity:t.opacity}),width:0,height:0}}function df(e,t,n){return{id:Yn(),type:`icon`,x:e.x,y:e.y,width:0,height:0,rotation:0,source:n.source,name:n.name,label:``,fontSize:24,fontFamily:t.fontFamily,color:t.color,strokeWidth:3,opacity:t.opacity}}function ff(e,t,n){return{id:Yn(),type:`rectangle`,kind:n,x:e.x,y:e.y,width:0,height:0,rotation:0,label:``,fontSize:t.fontSize,fontFamily:t.fontFamily,textAlign:t.textAlign,textVAlign:t.textVAlign,textPadding:t.textPadding,color:t.color,fill:t.fill,fillStyle:t.fillStyle,stroke:t.stroke===`auto`?void 0:t.stroke,shadow:t.shadow||void 0,strokeWidth:t.strokeWidth,dash:t.dash,opacity:t.opacity}}function pf(e,t,n){return{id:Yn(),type:`figure`,...n===`simple`?{}:{kind:n},...Mo(n)?{lanes:[...No]}:{},...n===`boundary`?{dash:`dashed`}:{},x:e.x,y:e.y,width:0,height:0,rotation:0,label:jo[n],fontSize:t.fontSize,fontFamily:t.fontFamily,color:kt,opacity:t.opacity}}function mf(e,t,n){return{...Ro(e,{fontFamily:t.fontFamily,color:kt,opacity:t.opacity},n),width:0,height:0}}function hf(e,t,n=!1){return{id:Yn(),type:`draw`,points:[e],color:t.color,strokeWidth:t.strokeWidth,...n?{highlighter:!0}:{},opacity:t.opacity}}function gf(e,t=!0){return{label:``,fontSize:e.fontSize,fontFamily:e.fontFamily,color:e.color,strokeWidth:e.strokeWidth,dash:e.dash,startArrow:t&&e.startArrow,endArrow:t&&e.endArrow,startHead:e.startHead,endHead:e.endHead,opacity:e.opacity}}function _f(e){return{bend:0,bendAlong:0,bow:0,bendStyle:e.bendStyle}}function vf(e){let{world:t,style:n,tool:r,shapes:i,zoom:a,alt:o,measurement:s}=e,c=Pe(i,t,void 0,s),l=r===`line`,u=t,d=null;if(!c&&!o){let e=lf(t,i,10/a);e&&(u=e.point,e.attach&&(d={kind:`path`,...e.attach}))}return{id:Yn(),type:`arrow`,x:u.x,y:u.y,x2:u.x,y2:u.y,..._f(n),startBinding:c&&!o?Be(c,t,s):d,endBinding:null,...gf(n,!l)}}var yf={rectangle:e=>ff(e.world,e.style,e.shapeKind),figure:e=>pf(e.world,e.style,e.frameKind),chart:e=>mf(e.world,e.style,e.chartKind),arrow:e=>vf({world:e.world,style:e.style,tool:`arrow`,shapes:e.shapes,zoom:e.zoom,alt:e.alt,measurement:e.measurement}),line:e=>vf({world:e.world,style:e.style,tool:`line`,shapes:e.shapes,zoom:e.zoom,alt:e.alt,measurement:e.measurement}),draw:e=>hf(e.world,e.style),highlight:e=>hf(e.world,e.style,!0)},bf={table:{build:(e,t)=>eo(Array.from({length:3},()=>[``,``,``]),e,{fontSize:t.fontSize,fontFamily:t.fontFamily,color:kt,opacity:t.opacity}),edit:!1},sticky:{build:Ai,edit:!0},text:{build:gu,edit:!0,untracked:!0}},xf=[`right`,`down`,`left`,`up`];function Sf(e,t){let n=Math.round(an(e)/90);return xf[((xf.indexOf(t)+n)%4+4)%4]}function Cf(e,t){let n=e.find(e=>t.has(e.id)&&(e.type===`rectangle`||e.type===`icon`));return!n||t.size!==1?null:n}function wf(e){let{shapes:t,selectedIds:n}=e.getState();return Cf(t,n)!==null}function Tf(e,t,n,r,i){let a=e.getState().style,o=W(t),s=W(n),c={x:o.x+o.width/2,y:o.y+o.height/2},l={x:s.x+s.width/2,y:s.y+s.height/2};return{id:Yn(),type:`arrow`,x:c.x,y:c.y,x2:(r??l).x,y2:(r??l).y,..._f(a),startBinding:Be(t,c),endBinding:r?Be(n,r,i):Be(n,l),...gf(a)}}function Ef(e,t,n){let r=e.getState();r.addMany([n,Tf(e,t,n)]),r.setSelectedIds(new Set([n.id]))}function Df(e,t,n,r,i){let a=e.getState();a.addMany([Tf(e,t,n,r,i)]),a.setSelectedIds(new Set([n.id]))}function Of(e,t,n){let{shapes:r,selectedIds:i}=e.getState(),a=Cf(r,i);if(!a)return!1;let o=W(a),s=Gt(a,n),c=Gl(a,t,r),l=o.x-s.x,u=o.y-s.y;return Ef(e,a,{...a,id:Yn(),x:c.x+l,y:c.y+u,rotation:0,label:``}),!0}function kf(e,t,n){let{shapes:r,selectedIds:i}=e.getState(),a=Cf(r,i);if(!a)return;let o=Pe(r,t,a.id,n);if(o){Df(e,a,o,t,n);return}let s=W(a);Ef(e,a,{...a,id:Yn(),x:t.x-s.width/2,y:t.y-s.height/2,rotation:0,label:``})}function Af(e,t,n){let{shapes:r,selectedIds:i}=e.getState(),a=Cf(r,i);return a?Pe(r,t,a.id,n):null}function jf(e,t){let{shapes:n,selectedIds:r}=e.getState(),i=Cf(n,r);return i?Gl(i,t,n):null}var Mf=q(`outline`,`activity`,`Activity`,[[`path`,{d:`M3 12h4l3 8l4 -16l3 8h4`,key:`svg-0`}]]),Nf=q(`outline`,`arrow-bar-to-down`,`ArrowBarToDown`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M12 14l0 -10`,key:`svg-1`}],[`path`,{d:`M12 14l4 -4`,key:`svg-2`}],[`path`,{d:`M12 14l-4 -4`,key:`svg-3`}]]),Pf=q(`outline`,`arrow-bar-to-up`,`ArrowBarToUp`,[[`path`,{d:`M12 10l0 10`,key:`svg-0`}],[`path`,{d:`M12 10l4 4`,key:`svg-1`}],[`path`,{d:`M12 10l-4 4`,key:`svg-2`}],[`path`,{d:`M4 4l16 0`,key:`svg-3`}]]),Ff=q(`outline`,`arrow-forward-up`,`ArrowForwardUp`,[[`path`,{d:`M15 14l4 -4l-4 -4`,key:`svg-0`}],[`path`,{d:`M19 10h-11a4 4 0 1 0 0 8h1`,key:`svg-1`}]]),If=q(`outline`,`at`,`At`,[[`path`,{d:`M8 12a4 4 0 1 0 8 0a4 4 0 1 0 -8 0`,key:`svg-0`}],[`path`,{d:`M16 12v1.5a2.5 2.5 0 0 0 5 0v-1.5a9 9 0 1 0 -5.5 8.28`,key:`svg-1`}]]),Lf=q(`outline`,`ban`,`Ban`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M5.7 5.7l12.6 12.6`,key:`svg-1`}]]),Rf=q(`outline`,`bell-off`,`BellOff`,[[`path`,{d:`M9.346 5.353c.21 -.129 .428 -.246 .654 -.353a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3m-1 3h-13a4 4 0 0 0 2 -3v-3a6.996 6.996 0 0 1 1.273 -3.707`,key:`svg-0`}],[`path`,{d:`M9 17v1a3 3 0 0 0 6 0v-1`,key:`svg-1`}],[`path`,{d:`M3 3l18 18`,key:`svg-2`}]]),zf=q(`outline`,`bell`,`Bell`,[[`path`,{d:`M10 5a2 2 0 1 1 4 0a7 7 0 0 1 4 6v3a4 4 0 0 0 2 3h-16a4 4 0 0 0 2 -3v-3a7 7 0 0 1 4 -6`,key:`svg-0`}],[`path`,{d:`M9 17v1a3 3 0 0 0 6 0v-1`,key:`svg-1`}]]),Bf=q(`outline`,`bold`,`Bold`,[[`path`,{d:`M7 5h6a3.5 3.5 0 0 1 0 7h-6l0 -7`,key:`svg-0`}],[`path`,{d:`M13 12h1a3.5 3.5 0 0 1 0 7h-7v-7`,key:`svg-1`}]]),Vf=q(`outline`,`border-corner-rounded`,`BorderCornerRounded`,[[`path`,{d:`M4 20v-10a6 6 0 0 1 6 -6h10`,key:`svg-0`}]]),Hf=q(`outline`,`border-corner-square`,`BorderCornerSquare`,[[`path`,{d:`M4 20v-15a1 1 0 0 1 1 -1h15`,key:`svg-0`}]]),Uf=q(`outline`,`box-align-top-left`,`BoxAlignTopLeft`,[[`path`,{d:`M11 5v5a1 1 0 0 1 -1 1h-5a1 1 0 0 1 -1 -1v-5a1 1 0 0 1 1 -1h5a1 1 0 0 1 1 1`,key:`svg-0`}],[`path`,{d:`M15 4h-.01`,key:`svg-1`}],[`path`,{d:`M20 4h-.01`,key:`svg-2`}],[`path`,{d:`M20 9h-.01`,key:`svg-3`}],[`path`,{d:`M20 15h-.01`,key:`svg-4`}],[`path`,{d:`M4 15h-.01`,key:`svg-5`}],[`path`,{d:`M20 20h-.01`,key:`svg-6`}],[`path`,{d:`M15 20h-.01`,key:`svg-7`}],[`path`,{d:`M9 20h-.01`,key:`svg-8`}],[`path`,{d:`M4 20h-.01`,key:`svg-9`}]]),Wf=q(`outline`,`chart-radar`,`ChartRadar`,[[`path`,{d:`M12 3l9.5 7l-3.5 11h-12l-3.5 -11l9.5 -7`,key:`svg-0`}],[`path`,{d:`M12 7.5l5.5 4l-2.5 5.5h-6.5l-2 -5.5l5.5 -4`,key:`svg-1`}],[`path`,{d:`M2.5 10l9.5 3l9.5 -3`,key:`svg-2`}],[`path`,{d:`M12 3v10l6 8`,key:`svg-3`}],[`path`,{d:`M6 21l6 -8`,key:`svg-4`}]]),Gf=q(`outline`,`chevron-up`,`ChevronUp`,[[`path`,{d:`M6 15l6 -6l6 6`,key:`svg-0`}]]),Kf=q(`outline`,`clipboard`,`Clipboard`,[[`path`,{d:`M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2`,key:`svg-0`}],[`path`,{d:`M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2`,key:`svg-1`}]]),qf=q(`outline`,`clock`,`Clock`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0`,key:`svg-0`}],[`path`,{d:`M12 7v5l3 3`,key:`svg-1`}]]),Jf=q(`outline`,`cloud-upload`,`CloudUpload`,[[`path`,{d:`M7 18a4.6 4.4 0 0 1 0 -9a5 4.5 0 0 1 11 2h1a3.5 3.5 0 0 1 0 7h-1`,key:`svg-0`}],[`path`,{d:`M9 15l3 -3l3 3`,key:`svg-1`}],[`path`,{d:`M12 12l0 9`,key:`svg-2`}]]),Yf=q(`outline`,`dimensions`,`Dimensions`,[[`path`,{d:`M3 5h11`,key:`svg-0`}],[`path`,{d:`M12 7l2 -2l-2 -2`,key:`svg-1`}],[`path`,{d:`M5 3l-2 2l2 2`,key:`svg-2`}],[`path`,{d:`M19 10v11`,key:`svg-3`}],[`path`,{d:`M17 19l2 2l2 -2`,key:`svg-4`}],[`path`,{d:`M21 12l-2 -2l-2 2`,key:`svg-5`}],[`path`,{d:`M3 12a2 2 0 0 1 2 -2h7a2 2 0 0 1 2 2v7a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2l0 -7`,key:`svg-6`}]]),Xf=q(`outline`,`dots-vertical`,`DotsVertical`,[[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}]]),Zf=q(`outline`,`file-export`,`FileExport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M11.5 21h-4.5a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v5m-5 6h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),Qf=q(`outline`,`file-import`,`FileImport`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M5 13v-8a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-5.5m-9.5 -2h7m-3 -3l3 3l-3 3`,key:`svg-1`}]]),$f=q(`outline`,`file-vector`,`FileVector`,[[`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`,key:`svg-0`}],[`path`,{d:`M8 16.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0 -3 0`,key:`svg-1`}],[`path`,{d:`M13 12.5a1.5 1.5 0 1 0 3 0a1.5 1.5 0 1 0 -3 0`,key:`svg-2`}],[`path`,{d:`M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2`,key:`svg-3`}],[`path`,{d:`M9.5 15a2.5 2.5 0 0 1 2.5 -2.5h1`,key:`svg-4`}]]),ep=q(`outline`,`folder-open`,`FolderOpen`,[[`path`,{d:`M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2`,key:`svg-0`}]]),tp=q(`outline`,`folder-share`,`FolderShare`,[[`path`,{d:`M13 19h-8a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v4`,key:`svg-0`}],[`path`,{d:`M16 22l5 -5`,key:`svg-1`}],[`path`,{d:`M21 21.5v-4.5h-4.5`,key:`svg-2`}]]),np=q(`outline`,`git-fork`,`GitFork`,[[`path`,{d:`M10 18a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M5 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M15 6a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-2`}],[`path`,{d:`M7 8v2a2 2 0 0 0 2 2h6a2 2 0 0 0 2 -2v-2`,key:`svg-3`}],[`path`,{d:`M12 12l0 4`,key:`svg-4`}]]),rp=q(`outline`,`grid-dots`,`GridDots`,[[`path`,{d:`M4 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-0`}],[`path`,{d:`M11 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M18 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-2`}],[`path`,{d:`M4 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-3`}],[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-4`}],[`path`,{d:`M18 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-5`}],[`path`,{d:`M4 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-6`}],[`path`,{d:`M11 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-7`}],[`path`,{d:`M18 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-8`}]]),ip=q(`outline`,`hand-finger`,`HandFinger`,[[`path`,{d:`M8 13v-8.5a1.5 1.5 0 0 1 3 0v7.5`,key:`svg-0`}],[`path`,{d:`M11 11.5v-2a1.5 1.5 0 1 1 3 0v2.5`,key:`svg-1`}],[`path`,{d:`M14 10.5a1.5 1.5 0 0 1 3 0v1.5`,key:`svg-2`}],[`path`,{d:`M17 11.5a1.5 1.5 0 0 1 3 0v4.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47`,key:`svg-3`}]]),ap=q(`outline`,`italic`,`Italic`,[[`path`,{d:`M11 5l6 0`,key:`svg-0`}],[`path`,{d:`M7 19l6 0`,key:`svg-1`}],[`path`,{d:`M14 5l-4 14`,key:`svg-2`}]]),op=q(`outline`,`layout-align-bottom`,`LayoutAlignBottom`,[[`path`,{d:`M4 20l16 0`,key:`svg-0`}],[`path`,{d:`M9 6a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),sp=q(`outline`,`layout-align-center`,`LayoutAlignCenter`,[[`path`,{d:`M12 4l0 5`,key:`svg-0`}],[`path`,{d:`M12 15l0 5`,key:`svg-1`}],[`path`,{d:`M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}]]),cp=q(`outline`,`layout-align-left`,`LayoutAlignLeft`,[[`path`,{d:`M4 4l0 16`,key:`svg-0`}],[`path`,{d:`M8 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),lp=q(`outline`,`layout-align-middle`,`LayoutAlignMiddle`,[[`path`,{d:`M4 12l5 0`,key:`svg-0`}],[`path`,{d:`M15 12l5 0`,key:`svg-1`}],[`path`,{d:`M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-2`}]]),up=q(`outline`,`layout-align-right`,`LayoutAlignRight`,[[`path`,{d:`M20 4l0 16`,key:`svg-0`}],[`path`,{d:`M4 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-1`}]]),dp=q(`outline`,`layout-align-top`,`LayoutAlignTop`,[[`path`,{d:`M4 4l16 0`,key:`svg-0`}],[`path`,{d:`M9 10a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-1`}]]),fp=q(`outline`,`layout-board-split`,`LayoutBoardSplit`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 12h8`,key:`svg-1`}],[`path`,{d:`M12 15h8`,key:`svg-2`}],[`path`,{d:`M12 9h8`,key:`svg-3`}],[`path`,{d:`M12 4v16`,key:`svg-4`}]]),pp=q(`outline`,`layout-board`,`LayoutBoard`,[[`path`,{d:`M4 6a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2l0 -12`,key:`svg-0`}],[`path`,{d:`M4 9h8`,key:`svg-1`}],[`path`,{d:`M12 15h8`,key:`svg-2`}],[`path`,{d:`M12 4v16`,key:`svg-3`}]]),mp=q(`outline`,`layout-distribute-horizontal`,`LayoutDistributeHorizontal`,[[`path`,{d:`M4 4l16 0`,key:`svg-0`}],[`path`,{d:`M4 20l16 0`,key:`svg-1`}],[`path`,{d:`M6 11a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -2`,key:`svg-2`}]]),hp=q(`outline`,`layout-distribute-vertical`,`LayoutDistributeVertical`,[[`path`,{d:`M4 4l0 16`,key:`svg-0`}],[`path`,{d:`M20 4l0 16`,key:`svg-1`}],[`path`,{d:`M9 8a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2l0 -8`,key:`svg-2`}]]),gp=q(`outline`,`layout-grid-add`,`LayoutGridAdd`,[[`path`,{d:`M4 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-0`}],[`path`,{d:`M14 5a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-1`}],[`path`,{d:`M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-2`}],[`path`,{d:`M14 17h6m-3 -3v6`,key:`svg-3`}]]),_p=q(`outline`,`list-check`,`ListCheck`,[[`path`,{d:`M3.5 5.5l1.5 1.5l2.5 -2.5`,key:`svg-0`}],[`path`,{d:`M3.5 11.5l1.5 1.5l2.5 -2.5`,key:`svg-1`}],[`path`,{d:`M3.5 17.5l1.5 1.5l2.5 -2.5`,key:`svg-2`}],[`path`,{d:`M11 6l9 0`,key:`svg-3`}],[`path`,{d:`M11 12l9 0`,key:`svg-4`}],[`path`,{d:`M11 18l9 0`,key:`svg-5`}]]),vp=q(`outline`,`lock-open`,`LockOpen`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-5a4 4 0 0 1 8 0`,key:`svg-2`}]]),yp=q(`outline`,`lock`,`Lock`,[[`path`,{d:`M5 13a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v6a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-6`,key:`svg-0`}],[`path`,{d:`M11 16a1 1 0 1 0 2 0a1 1 0 0 0 -2 0`,key:`svg-1`}],[`path`,{d:`M8 11v-4a4 4 0 1 1 8 0v4`,key:`svg-2`}]]),bp=q(`outline`,`login-2`,`Login2`,[[`path`,{d:`M9 8v-2a2 2 0 0 1 2 -2h7a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-7a2 2 0 0 1 -2 -2v-2`,key:`svg-0`}],[`path`,{d:`M3 12h13l-3 -3`,key:`svg-1`}],[`path`,{d:`M13 15l3 -3`,key:`svg-2`}]]),xp=q(`outline`,`logout`,`Logout`,[[`path`,{d:`M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2`,key:`svg-0`}],[`path`,{d:`M9 12h12l-3 -3`,key:`svg-1`}],[`path`,{d:`M18 15l3 -3`,key:`svg-2`}]]),Sp=q(`outline`,`maximize`,`Maximize`,[[`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`,key:`svg-0`}],[`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`,key:`svg-1`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`,key:`svg-2`}],[`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`,key:`svg-3`}]]),Cp=q(`outline`,`message-circle`,`MessageCircle`,[[`path`,{d:`M3 20l1.3 -3.9c-2.324 -3.437 -1.426 -7.872 2.1 -10.374c3.526 -2.501 8.59 -2.296 11.845 .48c3.255 2.777 3.695 7.266 1.029 10.501c-2.666 3.235 -7.615 4.215 -11.574 2.293l-4.7 1`,key:`svg-0`}]]),wp=q(`outline`,`message-off`,`MessageOff`,[[`path`,{d:`M8 9h1m4 0h3`,key:`svg-0`}],[`path`,{d:`M8 13h5`,key:`svg-1`}],[`path`,{d:`M8 4h10a3 3 0 0 1 3 3v8c0 .577 -.163 1.116 -.445 1.573m-2.555 1.427h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8c0 -1.085 .576 -2.036 1.439 -2.562`,key:`svg-2`}],[`path`,{d:`M3 3l18 18`,key:`svg-3`}]]),Tp=q(`outline`,`messages`,`Messages`,[[`path`,{d:`M21 14l-3 -3h-7a1 1 0 0 1 -1 -1v-6a1 1 0 0 1 1 -1h9a1 1 0 0 1 1 1v10`,key:`svg-0`}],[`path`,{d:`M14 15v2a1 1 0 0 1 -1 1h-7l-3 3v-10a1 1 0 0 1 1 -1h2`,key:`svg-1`}]]),Ep=q(`outline`,`mood-plus`,`MoodPlus`,[[`path`,{d:`M20.985 12.528a9 9 0 1 0 -8.45 8.456`,key:`svg-0`}],[`path`,{d:`M16 19h6`,key:`svg-1`}],[`path`,{d:`M19 16v6`,key:`svg-2`}],[`path`,{d:`M9 10h.01`,key:`svg-3`}],[`path`,{d:`M15 10h.01`,key:`svg-4`}],[`path`,{d:`M9.5 15c.658 .64 1.56 1 2.5 1s1.842 -.36 2.5 -1`,key:`svg-5`}]]),Dp=q(`outline`,`moon`,`Moon`,[[`path`,{d:`M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454l0 .008`,key:`svg-0`}]]),Op=q(`outline`,`pilcrow`,`Pilcrow`,[[`path`,{d:`M13 4v16`,key:`svg-0`}],[`path`,{d:`M17 4v16`,key:`svg-1`}],[`path`,{d:`M19 4h-9.5a4.5 4.5 0 0 0 0 9h3.5`,key:`svg-2`}]]),kp=q(`outline`,`rectangle-vertical`,`RectangleVertical`,[[`path`,{d:`M5 5a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2l0 -14`,key:`svg-0`}]]),Ap=q(`outline`,`select-all`,`SelectAll`,[[`path`,{d:`M8 9a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1l0 -6`,key:`svg-0`}],[`path`,{d:`M12 20v.01`,key:`svg-1`}],[`path`,{d:`M16 20v.01`,key:`svg-2`}],[`path`,{d:`M8 20v.01`,key:`svg-3`}],[`path`,{d:`M4 20v.01`,key:`svg-4`}],[`path`,{d:`M4 16v.01`,key:`svg-5`}],[`path`,{d:`M4 12v.01`,key:`svg-6`}],[`path`,{d:`M4 8v.01`,key:`svg-7`}],[`path`,{d:`M4 4v.01`,key:`svg-8`}],[`path`,{d:`M8 4v.01`,key:`svg-9`}],[`path`,{d:`M12 4v.01`,key:`svg-10`}],[`path`,{d:`M16 4v.01`,key:`svg-11`}],[`path`,{d:`M20 4v.01`,key:`svg-12`}],[`path`,{d:`M20 8v.01`,key:`svg-13`}],[`path`,{d:`M20 12v.01`,key:`svg-14`}],[`path`,{d:`M20 16v.01`,key:`svg-15`}],[`path`,{d:`M20 20v.01`,key:`svg-16`}]]),jp=q(`outline`,`send`,`Send`,[[`path`,{d:`M10 14l11 -11`,key:`svg-0`}],[`path`,{d:`M21 3l-6.5 18a.55 .55 0 0 1 -1 0l-3.5 -7l-7 -3.5a.55 .55 0 0 1 0 -1l18 -6.5`,key:`svg-1`}]]),Mp=q(`outline`,`shadow`,`Shadow`,[[`path`,{d:`M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`,key:`svg-0`}],[`path`,{d:`M13 12h5`,key:`svg-1`}],[`path`,{d:`M13 15h4`,key:`svg-2`}],[`path`,{d:`M13 18h1`,key:`svg-3`}],[`path`,{d:`M13 9h4`,key:`svg-4`}],[`path`,{d:`M13 6h1`,key:`svg-5`}]]),Np=q(`outline`,`share-2`,`Share2`,[[`path`,{d:`M8 9h-1a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-8a2 2 0 0 0 -2 -2h-1`,key:`svg-0`}],[`path`,{d:`M12 14v-11`,key:`svg-1`}],[`path`,{d:`M9 6l3 -3l3 3`,key:`svg-2`}]]),Pp=q(`outline`,`skateboard`,`Skateboard`,[[`path`,{d:`M5 15a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-0`}],[`path`,{d:`M15 15a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`,key:`svg-1`}],[`path`,{d:`M3 9a2 1 0 0 0 2 1h14a2 1 0 0 0 2 -1`,key:`svg-2`}]]),Fp=q(`outline`,`square-dot`,`SquareDot`,[[`path`,{d:`M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14`,key:`svg-0`}],[`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-1`}]]),Ip=q(`outline`,`strikethrough`,`Strikethrough`,[[`path`,{d:`M5 12l14 0`,key:`svg-0`}],[`path`,{d:`M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5`,key:`svg-1`}]]),Lp=q(`outline`,`triangle-square-circle`,`TriangleSquareCircle`,[[`path`,{d:`M12 3l-4 7h8l-4 -7`,key:`svg-0`}],[`path`,{d:`M14 17a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`,key:`svg-1`}],[`path`,{d:`M4 15a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1l0 -4`,key:`svg-2`}]]),Rp=q(`outline`,`underline`,`Underline`,[[`path`,{d:`M7 5v5a5 5 0 0 0 10 0v-5`,key:`svg-0`}],[`path`,{d:`M5 19h14`,key:`svg-1`}]]),zp=q(`outline`,`user`,`User`,[[`path`,{d:`M8 7a4 4 0 1 0 8 0a4 4 0 0 0 -8 0`,key:`svg-0`}],[`path`,{d:`M6 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`,key:`svg-1`}]]),Bp=q(`outline`,`vector-bezier-2`,`VectorBezier2`,[[`path`,{d:`M3 4a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-0`}],[`path`,{d:`M17 18a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}],[`path`,{d:`M7 5l7 0`,key:`svg-2`}],[`path`,{d:`M10 19l7 0`,key:`svg-3`}],[`path`,{d:`M8 19a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-4`}],[`path`,{d:`M14 5a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`,key:`svg-5`}],[`path`,{d:`M7 5.5a5 6.5 0 0 1 5 6.5a5 6.5 0 0 0 5 6.5`,key:`svg-6`}]]),Vp=q(`outline`,`vector-triangle`,`VectorTriangle`,[[`path`,{d:`M10 5a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-0`}],[`path`,{d:`M3 18a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-1`}],[`path`,{d:`M17 18a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1l0 -2`,key:`svg-2`}],[`path`,{d:`M6.5 17.1l5 -9.1`,key:`svg-3`}],[`path`,{d:`M17.5 17.1l-5 -9.1`,key:`svg-4`}],[`path`,{d:`M7 19l10 0`,key:`svg-5`}]]),Hp=q(`outline`,`zoom-scan`,`ZoomScan`,[[`path`,{d:`M8 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0`,key:`svg-0`}],[`path`,{d:`M16 16l-2.5 -2.5`,key:`svg-1`}],[`path`,{d:`M3 7v-2a2 2 0 0 1 2 -2h2`,key:`svg-2`}],[`path`,{d:`M3 17v2a2 2 0 0 0 2 2h2`,key:`svg-3`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`svg-4`}],[`path`,{d:`M17 21h2a2 2 0 0 0 2 -2v-2`,key:`svg-5`}]]),X={palette:{chord:`$mod+k`,viewSafe:!0},toolDrawer:{chord:`/`},bold:{chord:`$mod+b`},italic:{chord:`$mod+i`},underline:{chord:`$mod+u`},strikethrough:{chord:`$mod+Shift+x`},eyedropper:{chord:`Shift+KeyI`},imageLibrary:{chord:`Shift+KeyS`},copy:{chord:`$mod+c`,viewSafe:!0},cut:{chord:`$mod+x`},pasteAsText:{chord:`$mod+Shift+v`},copyPng:{chord:`$mod+Shift+c`,viewSafe:!0},duplicate:{chord:`$mod+d`},undo:{chord:`$mod+z`},redo:{chord:`$mod+Shift+z`},redoAlt:{chord:`$mod+y`},save:{chord:`$mod+s`},print:{chord:`$mod+p`,viewSafe:!0},open:{chord:`$mod+o`},selectAll:{chord:`$mod+a`,viewSafe:!0},lock:{chord:`$mod+Shift+KeyL`},group:{chord:`$mod+g`},ungroup:{chord:`$mod+Shift+g`},flipHorizontal:{chord:`Shift+KeyH`},flipVertical:{chord:`Shift+KeyV`},sendBackward:{chord:`$mod+BracketLeft`},bringForward:{chord:`$mod+BracketRight`},sendToBack:{chord:`$mod+Alt+BracketLeft`},bringToFront:{chord:`$mod+Alt+BracketRight`},copyStyles:{chord:`$mod+Alt+KeyC`},pasteStyles:{chord:`$mod+Alt+KeyV`},present:{chord:`$mod+Alt+KeyP`,viewSafe:!0},presentFromStart:{chord:`$mod+Shift+Alt+KeyP`,viewSafe:!0},alignLeft:{chord:`Alt+KeyL`},alignCenter:{chord:`Alt+KeyC`},alignRight:{chord:`Alt+KeyR`},alignTop:{chord:`Alt+KeyT`},alignMiddle:{chord:`Alt+KeyM`},alignBottom:{chord:`Alt+KeyB`},tidy:{chord:`Alt+KeyU`},zoomIn:{chord:`$mod+Equal`,viewSafe:!0,gestureSafe:!0},zoomInPlus:{chord:`$mod+Shift+Equal`,viewSafe:!0,gestureSafe:!0},zoomOut:{chord:`$mod+Minus`,viewSafe:!0,gestureSafe:!0},resetZoom:{chord:`$mod+Digit0`,viewSafe:!0,gestureSafe:!0},zoomToFit:{chord:`$mod+Digit1`,viewSafe:!0,gestureSafe:!0},toolLock:{chord:`$mod+Period`},zen:{chord:`Alt+KeyZ`,viewSafe:!0,gestureSafe:!0},ride:{chord:`Shift+KeyR`,viewSafe:!0},aiPanel:{chord:`Alt+KeyA`},slidesPanel:{chord:`Alt+KeyS`},codePanel:{chord:`Alt+KeyD`},connectRight:{chord:`Tab`},connectBelow:{chord:`Shift+Tab`}};function Z(e){return Dc(X[e].chord)}function Up(e,t,n){let r=new Set,i=new Set(t);for(let t of e)t.groupId&&t.groupId!==n&&i.has(t.id)&&r.add(t.groupId);if(r.size===0)return i;for(let t of e)t.groupId&&r.has(t.groupId)&&!t.locked&&i.add(t.id);return i}var Wp=`Grouped as one — nested groups aren't supported`;function Gp(e,t){return e.some(e=>t.has(e.id)&&e.groupId!==void 0)}function Kp(e,t){return e.length>1&&e[0].groupId!==void 0&&e[0].groupId!==t&&e.every(t=>t.groupId===e[0].groupId)}function qp(e){if(e.selectedIds.size===0)return;let t=xe(e.editSession);t&&e.selectedIds.has(t)&&e.endEdit(),e.removeShapes(e.selectedIds),e.setSelectedIds(new Set)}function Jp(){let e=window.getSelection();if(!e||e.isCollapsed)return!1;let t=e.anchorNode;return!!(t instanceof Element?t:t?.parentElement)?.closest(`.select-text`)}var Yp=e=>tn[e.type].textField===`label`?`label`:`text`;function Xp(e,t){if(e.editSession.kind!==`none`)return;let n=e.shapes.filter(t=>e.selectedIds.has(t.id)&&tn[t.type].edit===`text`);if(n.length===0)return;let r=e=>e[Yp(e)],i=!n.every(e=>Mn(typeof r(e)==`string`?r(e):``,t));e.replaceMany(n.map(e=>{let n=Yp(e),a=r(e);return{...e,[n]:tr(typeof a==`string`?a:``,t,i)}}))}function Zp(e,t){if(t||e.shapes.length===0)return;let n=ti(Jr(e.shapes)).length>0;e.setExportDialog(oa({hasSlides:n}))}function Qp(e){e.setTool(`select`),e.setSelectedIds(new Set(e.shapes.filter(e=>!e.locked).map(e=>e.id))),e.setLockRevealId(null)}function $p(e,t){if(e.selectedIds.size<2)return;let n=Gp(e.shapes,e.selectedIds);e.group(e.selectedIds),n&&t(Wp)}function em(e){e.ungroup(e.selectedIds),e.setActiveGroupId(null)}function tm(e){let t=e.metaKey||e.ctrlKey;if(t&&!e.shiftKey)return null;let n=e.shiftKey?t?100:10:1,r=0,i=0;return e.key===`ArrowUp`?i=-n:e.key===`ArrowDown`?i=n:e.key===`ArrowLeft`?r=-n:e.key===`ArrowRight`&&(r=n),{dx:r,dy:i}}function nm(e){if(e.lockRevealId){e.setLockRevealId(null);return}if(e.pendingIcon||e.pendingControl){e.setPendingIcon(null),e.setPendingControl(null),e.setTool(`select`);return}if(De(e.editSession)){e.endEdit();return}if(e.animateSlideId){e.setAnimateSlideId(null);return}if(e.activeGroupId){let t=e.shapes.filter(t=>t.groupId===e.activeGroupId).map(e=>e.id);e.setActiveGroupId(null),e.setSelectedIds(new Set(t));return}e.setSelectedIds(new Set),e.endEdit(),e.setTool(`select`)}var rm=new Set(Object.values(X).filter(e=>e.gestureSafe).map(e=>e.chord)),im=new Set([X.connectRight.chord,X.connectBelow.chord]),am=new Set([...Object.values(X),...Object.values(ns)].filter(e=>e.viewSafe).map(e=>e.chord));function om(e){let t=(0,J.useRef)(e);t.current=e;let{notify:n}=_(),{ai:r,embed:i}=B(),a=i!==void 0,o=V(),s=o.store,{undo:c,redo:l}=o.history,u=o.popupGuard;(0,J.useEffect)(()=>{let e=()=>s.getState(),i=()=>e().viewMode;function d(){e().endEdit()}let f=n=>r=>{r.preventDefault(),e().selectedIds.size>=2&&t.current.align(n)},p=t=>n=>{n.preventDefault(),Xp(e(),t)},m={[X.palette.chord]:t=>{t.preventDefault();let n=e();n.setPaletteOpen(!n.paletteOpen)},[X.toolDrawer.chord]:t=>{t.preventDefault();let n=e();n.setToolDrawerOpen(!n.toolDrawerOpen)},[X.bold.chord]:p(`strong`),[X.italic.chord]:p(`em`),[X.underline.chord]:p(`u`),[X.strikethrough.chord]:p(`s`),[X.eyedropper.chord]:e=>{e.preventDefault(),t.current.eyedrop()},[X.imageLibrary.chord]:t=>{t.preventDefault(),e().setImageLibraryOpen(!0),e().setIconPickerOpen(!1)},[X.copy.chord]:e=>{Jp()||(e.preventDefault(),t.current.copySelection())},[X.cut.chord]:e=>{Jp()||(e.preventDefault(),t.current.cutSelection())},[X.pasteAsText.chord]:e=>{e.preventDefault(),t.current.pasteAsText()},[X.copyPng.chord]:e=>{e.preventDefault(),t.current.copyPng()},[X.duplicate.chord]:e=>{e.preventDefault(),t.current.duplicate()},[X.undo.chord]:n=>{if(n.preventDefault(),e().polyDraft){t.current.removeLastPolylinePoint();return}d(),c()},[X.redo.chord]:e=>{e.preventDefault(),d(),l()},[X.redoAlt.chord]:e=>{e.preventDefault(),d(),l()},[X.save.chord]:e=>{e.preventDefault(),t.current.saveNow()},[X.print.chord]:t=>{t.preventDefault(),Zp(e(),a)},[X.open.chord]:e=>{e.preventDefault(),t.current.openFile()},[X.selectAll.chord]:t=>{t.preventDefault(),Qp(e())},[X.lock.chord]:e=>{e.preventDefault(),t.current.toggleLock()},[X.group.chord]:t=>{t.preventDefault(),$p(e(),n)},[X.ungroup.chord]:t=>{t.preventDefault(),em(e())},[X.flipHorizontal.chord]:e=>{e.preventDefault(),t.current.flip(`horizontal`)},[X.flipVertical.chord]:e=>{e.preventDefault(),t.current.flip(`vertical`)},[X.sendBackward.chord]:e=>{e.preventDefault(),t.current.reorder(`backward`)},[X.bringForward.chord]:e=>{e.preventDefault(),t.current.reorder(`forward`)},[X.sendToBack.chord]:e=>{e.preventDefault(),t.current.reorder(`back`)},[X.bringToFront.chord]:e=>{e.preventDefault(),t.current.reorder(`front`)},[X.copyStyles.chord]:e=>{e.preventDefault(),t.current.copyStyles()},[X.present.chord]:e=>{e.preventDefault(),t.current.startPresentation()},[X.presentFromStart.chord]:e=>{e.preventDefault(),t.current.startPresentation(`beginning`)},[X.pasteStyles.chord]:e=>{e.preventDefault(),t.current.pasteStyles()},[X.alignLeft.chord]:f(`left`),[X.alignCenter.chord]:f(`center-h`),[X.alignRight.chord]:f(`right`),[X.alignTop.chord]:f(`top`),[X.alignMiddle.chord]:f(`middle`),[X.alignBottom.chord]:f(`bottom`),[X.tidy.chord]:n=>{n.preventDefault();let r=e();Ua(r.shapes,r.selectedIds)&&t.current.tidy()},[X.zoomIn.chord]:e=>{e.preventDefault(),t.current.zoomIn()},[X.zoomInPlus.chord]:e=>{e.preventDefault(),t.current.zoomIn()},[X.zoomOut.chord]:e=>{e.preventDefault(),t.current.zoomOut()},[X.resetZoom.chord]:e=>{e.preventDefault(),t.current.resetZoom()},[X.zoomToFit.chord]:e=>{e.preventDefault(),t.current.zoomToFit()},[X.toolLock.chord]:t=>{t.preventDefault(),e().setToolLock(e=>!e)},[X.zen.chord]:t=>{t.preventDefault(),e().setZenMode(e=>!e)},[X.ride.chord]:t=>{t.preventDefault(),e().setRideMode(e=>!e)},[X.aiPanel.chord]:t=>{t.preventDefault(),r&&e().setAiOpen(e=>!e)},[X.slidesPanel.chord]:t=>{t.preventDefault(),e().setSlidesOpen(e=>!e)},[X.codePanel.chord]:t=>{t.preventDefault(),e().setCodeOpen(e=>!e)},[ns.ellipse.chord]:()=>{t.current.selectTool(`rectangle`),e().setShapeKind(`ellipse`)},[ns.comment.chord]:e=>{e.preventDefault(),t.current.addComment()},[ns.stepbadge.chord]:e=>{e.preventDefault(),t.current.insertControl(`stepbadge`)},[X.connectRight.chord]:e=>{Ho(e.target)||Of(s,`right`,o.measurement)&&e.preventDefault()},[X.connectBelow.chord]:e=>{Ho(e.target)||Of(s,`down`,o.measurement)&&e.preventDefault()}};for(let[n,r]of Object.entries(Xo))m[n]=n=>{n.preventDefault(),!e().animateSlideId&&(t.current.selectTool(r),r===`rectangle`&&e().setShapeKind(`rectangle`),r===`figure`&&e().setFrameKind(`simple`))};for(let[e,t]of Object.entries(m))am.has(e)||(m[e]=n=>{if(i()){im.has(e)||n.preventDefault();return}t(n)});for(let[t,n]of Object.entries(m))rm.has(t)||t in Xo||(m[t]=r=>{if(me(e())){im.has(t)||r.preventDefault();return}n(r)});let h=Qu(window,m,{ignore:t=>t.repeat||t.isComposing||Bo(t.target)||e().presentingIndex!==null||e().flowPlay!==null});function g(n){if(Bo(n.target)||e().presentingIndex!==null||e().flowPlay!==null||me(e()))return;let r=t.current,a=e();if(a.polyDraft){if(n.key===`Delete`||n.key===`Backspace`){n.preventDefault(),r.removeLastPolylinePoint();return}if(n.key===`Enter`){n.preventDefault(),r.commitPolyline();return}if(n.key===`Escape`){n.preventDefault(),r.cancelPolyline();return}}if(n.key===`Delete`||n.key===`Backspace`){n.preventDefault(),i()||qp(e());return}if(!u.openAtEvent()){if(n.key.startsWith(`Arrow`)){if(n.target instanceof HTMLInputElement||i())return;let e=tm(n);if(!e)return;r.nudgeSelection(e.dx,e.dy),n.preventDefault();return}if(n.key===`Escape`){nm(a);return}if(n.key===`Enter`){if(Ho(n.target))return;if(a.editSession.kind===`crop`){a.endEdit(),n.preventDefault();return}a.selectedIds.size>0&&a.editSession.kind===`none`&&!i()&&(r.editSelection(),n.preventDefault())}}}function _(r){Bo(r.target)||e().presentingIndex!==null||i()||me(e())||qd(r,t.current,n)}return window.addEventListener(`keydown`,g),window.addEventListener(`paste`,_),()=>{h(),window.removeEventListener(`keydown`,g),window.removeEventListener(`paste`,_)}},[s,c,l,u,n,o.measurement,r,a])}function sm(){let e=B().embed?.askAbout,t=U(),{notify:n}=_(),r=(0,J.useCallback)(()=>{if(!e)return;let{shapes:r,selectedIds:i}=t.getState(),a=sa(r,i);a.length!==0&&e.run(a).then(n,()=>n(`Couldn't reach the chat. Try again.`))},[e,t,n]),i=e?.label;return(0,J.useMemo)(()=>i===void 0?null:{label:i,run:r},[i,r])}var cm=(e,t)=>e.length===t.length&&e.every((e,n)=>e.flowId===t[n].flowId&&e.name===t[n].name&&e.frameId===t[n].frameId);function lm(e){let t=(0,J.useRef)(e);t.current=e;let n=H(e=>e.shapes.length>0),r=H(e=>e.selectedIds.size>0),i=Ms(),a=H(e=>e.zenMode),o=H(e=>e.rideMode),s=H(e=>e.viewMode),c=H(e=>e.viewModeLocked),{ai:l,embed:u}=B(),d=sm(),f=U(),p=ve(e=>[e.shapes],e=>Zr(e).some(e=>e.slideOrder!==void 0&&!e.slideSkipped)),m=ve(e=>[e.shapes],e=>jc(e).flatMap(e=>(e.flows??[]).map(t=>({frameId:e.id,flowId:t.id,name:t.name}))),cm);return(0,J.useMemo)(()=>{let e=()=>f.getState(),h=[];for(let t of m)h.push({id:`play-flow-${t.flowId}`,group:`Panels`,label:`Play flow: ${t.name}`,keywords:`flow walkthrough steps walk through play`,icon:oc,run:()=>e().setFlowPlay({frameId:t.frameId,flowId:t.flowId,step:0})});if(s||h.push({id:`paste`,group:`Edit`,label:`Paste`,hint:`⌘V`,icon:Kf,run:()=>t.current.pasteClipboard()},{id:`paste-text`,group:`Edit`,label:`Paste as plain text`,hint:Z(`pasteAsText`),keywords:`unformatted strip`,icon:Kf,run:()=>void t.current.pasteAsText()}),n&&(h.push({id:`select-all`,group:`Edit`,label:`Select all`,hint:Z(`selectAll`),icon:Ap,run:()=>t.current.selectAll()}),s||h.push({id:`clear-canvas`,group:`Edit`,label:`Clear canvas`,keywords:`reset delete all empty wipe erase`,icon:bs,run:()=>t.current.clearCanvas()})),!s){h.push({id:`new-slide`,group:`Panels`,label:`New slide`,keywords:`add create deck`,icon:fp,run:()=>{e().setSlidesOpen(!0),e().setSlidePickerOpen(!0)}});let t=Jr(e().shapes),n=ii(t,e().viewport,{width:window.innerWidth,height:window.innerHeight}),r=t[Math.max(0,n)];r&&h.push({id:`animate-slide`,group:`Panels`,label:`Animate slide`,keywords:`build steps reveal appear order animation`,icon:lc,run:()=>e().setAnimateSlideId(r.id)})}return h.push({id:`slides`,group:`Panels`,label:`Slides panel`,keywords:`deck`,icon:fp,run:()=>e().setSlidesOpen(!0)},{id:`present`,group:`Panels`,label:`Present from current slide`,hint:Z(`present`),keywords:`present slides play deck fullscreen slideshow here`,icon:E,run:()=>t.current.startPresentation(`current`)},{id:`present-beginning`,group:`Panels`,label:`Present from beginning`,hint:Z(`presentFromStart`),keywords:`present slides play deck fullscreen slideshow start first`,icon:E,run:()=>t.current.startPresentation(`beginning`)}),s||h.push({id:`code`,group:`Panels`,label:`Diagram as code`,keywords:`dsl mermaid`,icon:Ds,run:()=>e().setCodeOpen(!0)}),l&&!s&&(h.push({id:`ai`,group:`Panels`,label:`AI assistant`,keywords:`chat ask`,icon:lc,run:()=>e().setAiOpen(!0)},{id:`ask-ai`,group:`AI`,label:`Ask AI…`,keywords:`assistant chat question help`,icon:lc,run:()=>e().askAi(``,!1)},{id:`ai-diagram`,group:`AI`,label:`Generate diagram with AI`,keywords:`assistant architecture flowchart create`,icon:lc,run:()=>e().askAi(`Draw a diagram of `,!1)},{id:`ai-deck`,group:`AI`,label:`Generate slides with AI`,keywords:`assistant deck presentation create`,icon:lc,run:()=>e().askAi(`Create a short deck about `,!1)}),r&&h.push({id:`ai-explain`,group:`AI`,label:`Explain selection with AI`,keywords:`assistant what is this describe`,icon:lc,run:()=>e().askAi(`Explain what the selected shapes are and how they connect. If the labels alone don't tell the story, look at the canvas first.`,!0)},{id:`ai-tidy`,group:`AI`,label:`Tidy selection with AI`,keywords:`assistant clean up layout arrange`,icon:lc,run:()=>e().askAi(`Tidy up the selection. If it's a diagram, re-lay it out and fix the arrows; otherwise align and space the shapes cleanly. Don't change colours, fonts or styling.`,!0)})),h.push({id:`zoom-fit`,group:`View`,label:`Zoom to fit`,hint:Z(`zoomToFit`),icon:Hp,run:()=>t.current.zoomToFit()},{id:`zoom-reset`,group:`View`,label:`Reset zoom to 100%`,hint:Z(`resetZoom`),icon:Ks,run:()=>t.current.resetZoom()},{id:`back-to-content`,group:`View`,label:`Back to content`,icon:Ks,run:()=>t.current.backToContent()},{id:`toggle-grid`,group:`View`,label:`Toggle grid`,icon:rp,run:()=>t.current.toggleGrid()},{id:`theme`,group:`View`,label:i===`dark`?`Light mode`:`Dark mode`,keywords:`theme dark light appearance toggle`,icon:Dp,run:()=>e().setTheme(i===`dark`?`light`:`dark`)},{id:`zen-mode`,group:`View`,label:a?`Exit zen mode`:`Zen mode`,hint:Z(`zen`),keywords:`distraction free focus hide chrome ui`,icon:As,run:()=>e().setZenMode(e=>!e)},{id:`ride-mode`,group:`View`,label:o?`Stop riding`:`Ride the canvas`,hint:Z(`ride`),keywords:`line rider bike physics play game fun`,icon:Pp,run:()=>e().setRideMode(e=>!e)},...c?[]:[{id:`view-mode`,group:`View`,label:s?`Exit view mode`:`View mode (read-only)`,keywords:`read only lock viewer inspect`,icon:zs,run:()=>e().setViewMode(e=>!e)}]),r&&h.push({id:`zoom-selection`,group:`View`,label:`Zoom to selection`,keywords:`fit frame`,icon:Hp,run:()=>t.current.zoomToSelection()}),r&&d&&h.push({id:`ask-host`,group:`AI`,label:d.label,keywords:`assistant chat explain question`,icon:Cp,run:d.run}),u?(h.push({id:`open-in-app`,group:`Export`,label:u.openInApp.label,keywords:`export download png svg pdf share present save file open`,icon:Ws,run:u.openInApp.run}),h):(n&&h.push({id:`export-png`,group:`Export`,label:`Export as PNG…`,icon:rc,run:()=>e().setExportDialog({format:`png`})},{id:`export-svg`,group:`Export`,label:`Export as SVG…`,icon:$f,run:()=>e().setExportDialog({format:`svg`})}),p&&h.push({id:`export-pdf`,group:`Export`,label:`Export slides as PDF…`,keywords:`deck presentation print download`,icon:ks,run:()=>e().setExportDialog({format:`pdf`})}),h)},[n,r,i,a,o,s,c,l,f,p,u,d,m])}var um=()=>wi(()=>import(`./tidy-browser-BdlwTfCT.js`),__vite__mapDeps([5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]));function dm(){Va(um)}function fm(){return Ba(um)!==void 0}async function pm(e,t,n){return(await Ha(um)).tidyInBrowser(e,t,n)}var mm=24,hm=38,gm=16,_m=220;function vm(e){let t=[];for(let n of e){let e=`fill`in n?n.fill:void 0;typeof e==`string`&&e&&e!==`transparent`&&!t.includes(e)&&t.push(e)}return t}function ym(e){return vm(e).length>=2}function bm(e){let t=vm(e),n=Bt(e);if(t.length<2||!n)return[];let r=Yn(),{x:i,y:a}=Ul(n),o=[rr({x:i,y:a,width:_m,height:gm*2+t.length*hm,fill:`#ffffff`,fillStyle:`pastel`,groupId:r})];return t.forEach((e,t)=>{let n=a+gm+t*hm;o.push(rr({x:i+gm,y:n,width:mm,height:mm,fill:e,fillStyle:`pastel`,groupId:r}),{id:Yn(),type:`text`,x:i+gm+mm+12,y:n+2,text:`Theme ${t+1}`,fontSize:18,fontFamily:At,rotation:0,color:pt,opacity:1,groupId:r})}),o}var xm=16;function Sm(e){if(e.length<2)return[];let t=[...e].sort(Di),n=Ge(t),r=Wl(t,{x:n.x,y:n.y},xm),i=Yn();return t.map((e,t)=>({...e,x:r[t].x,y:r[t].y,groupId:i}))}var Cm=16,wm=16;function Tm(e){return Qn(e.text).replace(/\s+/g,` `).trim()}function Em(e){if(e.length<1)return null;let t=[...e].sort(Di),n=t.map(Tm).filter(e=>e.length>0),r=Bt(t);return!r||n.length===0?null:{card:rr({...Ul(r),width:340,height:Math.max(140,n.length*18*1.6+Cm*2),label:Qt(n),fontSize:18,fontFamily:t[0].fontFamily,textAlign:`left`,textVAlign:`top`,textPadding:Cm,fill:`#ffffff`,fillStyle:`pastel`}),removeIds:t.map(e=>e.id)}}function Dm(e){return Qn(e.type===`rectangle`?e.label:e.text).split(`
|
|
14
|
+
`).map(e=>e.trim()).filter(e=>e.length>0).length}function Om(e){let t=Qn(e.type===`rectangle`?e.label:e.text).split(`
|
|
15
|
+
`).map(e=>e.replace(/\s+/g,` `).trim()).filter(e=>e.length>0);if(t.length<1)return[];let n=W(e),r=Wl(t.map(()=>({width:180,height:180})),{x:n.x,y:n.y},wm),i=Yn();return t.map((t,n)=>({id:Yn(),type:`sticky`,x:r[n].x,y:r[n].y,width:180,height:180,rotation:0,text:t,fontSize:16,fontFamily:e.fontFamily,fill:Mi,opacity:1,groupId:i}))}function km(e,t,n={}){let r=Kr(e,t,n.measurement),i=Up(e,r.map(e=>e.id),n.activeGroupId??null),a=new Set(r.map(e=>e.id)),o=[...r,...e.filter(e=>i.has(e.id)&&!a.has(e.id))];return n.includeLocked?o:o.filter(e=>!e.locked)}function Am(e){return e.shapes.filter(t=>t.type===`figure`&&e.selectedIds.has(t.id)&&(t.kind??`simple`)===`simple`&&!t.groupId&&t.slideOrder===void 0&&!oi(e.shapes,t))}function jm(e){return e.shapes.filter(t=>t.type===`figure`&&e.selectedIds.has(t.id)&&t.slideOrder!==void 0)}function Mm(e){return e.shapes.filter(t=>t.type===`sticky`&&e.selectedIds.has(t.id))}function Nm(e){let t=sa(e.shapes,e.selectedIds);if(t.length!==1)return null;let n=t[0];return n.type!==`rectangle`&&n.type!==`text`?null:Dm(n)>=2?n:null}function Pm(e){let{replaceMany:t,removeShapes:n,addShape:r,addMany:i,setSelectedIds:a,setLockRevealId:o}=e,s=V(),{beginTransaction:c,endTransaction:l}=s.history,{measurement:u,store:d}=s,[f,p]=(0,J.useState)(`idle`),m=(0,J.useCallback)(()=>{fm()||p(`loading`);let{shapes:e,selectedIds:n}=d.getState();pm({selection:!0},e,n).then(e=>{p(`idle`),e.length!==0&&(t(e),a(new Set(e.map(e=>e.id))))},()=>{p(`failed`)})},[d,t,a]),h=(0,J.useMemo)(()=>({status:f,retry:m}),[f,m]),g=(0,J.useCallback)(()=>{let e=d.getState(),n=Am(e);if(n.length===0)return;let r=se(e.shapes);t(n.map(e=>({...e,slideOrder:r++}))),a(new Set(n.map(e=>e.id)))},[d,t,a]),_=(0,J.useCallback)(()=>{let e=d.getState(),n=jm(e);if(n.length===0)return;let r=new Set(n.map(e=>e.id)),i=n.map(e=>({...e,slideOrder:void 0})),a=Jr(e.shapes).filter(e=>!r.has(e.id)).map((e,t)=>({...e,slideOrder:t}));t([...i,...a])},[d,t]),v=(0,J.useCallback)(()=>{let e=Sm(Mm(d.getState()));e.length!==0&&(t(e),a(new Set(e.map(e=>e.id))))},[d,t,a]),y=(0,J.useCallback)(()=>{let e=Em(Mm(d.getState()));e&&(c(),n(new Set(e.removeIds)),r(e.card),l(),a(new Set([e.card.id])))},[d,n,r,a,c,l]),b=(0,J.useCallback)(()=>{let e=Nm(d.getState());if(!e)return;let t=Om(e);t.length!==0&&(c(),n(new Set([e.id])),i(t),l(),a(new Set(t.map(e=>e.id))))},[d,n,i,a,c,l]),x=(0,J.useCallback)(()=>{let{shapes:e,selectedIds:t}=d.getState(),n=bm(sa(e,t));n.length!==0&&(c(),i(n),l(),a(new Set(n.map(e=>e.id))))},[d,i,a,c,l]),S=(0,J.useCallback)(()=>{let e=d.getState(),n=sa(e.shapes,e.selectedIds);if(n.length===0)return;let r=km(e.shapes,n,{activeGroupId:e.activeGroupId,measurement:u});if(r.length===0)return;let i=r.length>1?Yn():void 0;t(r.map(e=>({...e,locked:!0,lockId:i}))),a(new Set),o(n[0].id)},[d,u,t,a,o]),C=(0,J.useCallback)(()=>{let{shapes:e,lockRevealId:n}=d.getState(),r=n?xr(e,n):void 0;if(!r||!r.locked)return;let i=_u(e,r);t(i.map(e=>({...e,locked:!1,lockId:void 0}))),o(null),a(new Set(i.map(e=>e.id)))},[d,t,o,a]),w=(0,J.useCallback)(()=>{if(d.getState().lockRevealId){C();return}S()},[d,S,C]),T=(0,J.useCallback)(()=>{let e=d.getState(),t=Bt(sa(e.shapes,e.selectedIds));if(!t)return;let n={id:Yn(),type:`figure`,...ut(t,24),rotation:0,label:`Frame`,fontSize:e.style.fontSize,fontFamily:e.style.fontFamily,color:kt,opacity:1};e.addShapeBehind(n,e.selectedIds),a(new Set([n.id]))},[d,a]);return(0,J.useMemo)(()=>({tidySelection:m,tidyState:h,addFramesToSlides:g,removeFramesFromSlides:_,clusterSelectedStickies:v,convertStickiesToOutline:y,convertOutlineToStickies:b,addColorLegend:x,lockSelection:S,unlockReveal:C,toggleLock:w,wrapSelectionInFrame:T}),[m,h,g,_,v,y,b,x,S,C,w,T])}function Fm(e){return e.kind===`html`?typeof e.html==`string`?e.html.length>0:!!e.htmlSrc:!1}function Im(e){let{selection:t,documents:n,tools:r,paste:i,structure:a,tables:o,zoom:s,comments:c,ai:l,embedFrame:u,pasteTargetRef:d}=e,f=U(),p=V(),m=Nc(),{notify:h}=_(),g=B().embed?.openInApp??null,v=sm();return()=>{let e=f.getState(),{shapes:_,selectedIds:y,viewMode:b,showGrid:x,snapEnabled:S,presentationAnimation:C,showZoomIndicator:w,setExportDialog:T,group:E,ungroup:D,setActiveGroupId:O,setCodeOpen:k,askAi:A}=e,j=sa(_,y),ee=Kp(j,e.activeGroupId),M=j.length===1?j[0]:void 0,N=n.exportTargets;return{readOnly:b,hasSelection:j.length>0,hasClipboard:i.hasClipboard(),hasStyleClipboard:i.hasStyleClipboard(),canGroup:j.length>=2&&!ee,canAlign:j.length>=2,canDistribute:j.length>=3,onAlign:t.alignSelection,onDistribute:t.distributeSelection,canUngroup:j.some(e=>e.groupId!==void 0),canSelectAll:_.length>0,onCut:i.cutSelection,onCopy:i.copySelection,onDuplicate:i.duplicateSelection,onPaste:()=>i.pasteClipboard(d.current??void 0),canComment:c.available,onAddComment:()=>c.addComment(d.current??void 0),onWrapInFrame:a.wrapSelectionInFrame,onCopyStyles:i.copyStyles,onPasteStyles:i.pasteStyles,onSendBackward:()=>t.reorderSelection(`backward`),onBringForward:()=>t.reorderSelection(`forward`),onSendToBack:()=>t.reorderSelection(`back`),onBringToFront:()=>t.reorderSelection(`front`),onFlipHorizontal:()=>t.flipSelection(`horizontal`),onFlipVertical:()=>t.flipSelection(`vertical`),onGroup:()=>{let e=Gp(_,y);E(y),e&&h(Wp)},onUngroup:()=>{D(y),O(null)},onSelectAll:t.selectAll,onDelete:t.deleteSelection,isLocked:vu(_,e.lockRevealId).length>0,onLock:a.lockSelection,onUnlock:a.unlockReveal,canOpenWebLink:M?.type===`web`&&M.kind===`embed`&&Vn(M.url)!==null,onOpenWebLink:()=>{let e=M?.type===`web`?Vn(M.url):null;e&&window.open(e,`_blank`,`noopener,noreferrer`)},canCopyWebHtml:M?.type===`web`&&Fm(M),onCopyWebHtml:()=>{M?.type!==`web`||!Fm(M)||wi(()=>import(`./widget-source-C3N9ZKTz.js`).then(e=>e.i).then(e=>{let t=e.widgetSourceOf(M);return t?`html`in t?t.html:e.loadWidgetSource(t.src):null}),__vite__mapDeps([25,10,26,11])).then(e=>{if(e===null)throw Error(`source unavailable`);return navigator.clipboard.writeText(e)}).then(()=>h(`Copied HTML`),()=>h(`Couldn't copy the HTML`))},isTable:j.length===1&&j[0].type===`table`,onCopyCsv:o.copyTableCsv,onConvertToChart:o.convertTableToChart,isChart:j.length===1&&j[0].type===`chart`,onConvertToTable:o.convertChartToTable,canEditAsCode:j.length===1&&(j[0].type===`figure`||j[0].type===`chart`)&&typeof j[0].code==`string`&&j[0].code.trim().length>0,onEditAsCode:()=>k(!0),canResetArrowRoute:j.length===1&&j[0].type===`arrow`&&j[0].bendStyle===`elbow`&&(j[0].elbowMid!==void 0||j[0].elbowPoints!==void 0),onResetArrowRoute:()=>{j.length===1&&t.resetArrowBend(j[0].id)},canTidy:Ua(_,y),onTidy:a.tidySelection,onMenuOpen:()=>{let e=f.getState();Ua(e.shapes,e.selectedIds)&&dm()},canCluster:j.filter(e=>e.type===`sticky`).length>=2,onCluster:a.clusterSelectedStickies,canToOutline:Mm(e).length>=2,onToOutline:a.convertStickiesToOutline,canToStickies:Nm(e)!==null,onToStickies:a.convertOutlineToStickies,canColorLegend:ym(j),onColorLegend:a.addColorLegend,canAddToSlides:Am(e).length>0,onAddToSlides:a.addFramesToSlides,canRemoveFromSlides:jm(e).length>0,onRemoveFromSlides:a.removeFramesFromSlides,canAddFlow:j.length>0&&!b,onAddFlow:()=>{let e=Mc(_,j);if(e){_s(p,e.id);return}a.wrapSelectionInFrame();let[t]=f.getState().selectedIds;t&&_s(p,t)},canEmbedFrame:u!==null&&j.length===1&&j[0].type===`figure`,onEmbedFrame:()=>{u&&j.length===1&&u(j[0].id)},canExport:_.length>0,onExportPng:()=>T({format:`png`,scope:j.length>0?`selection`:`board`}),onExportSvg:()=>T({format:`svg`,scope:j.length>0?`selection`:`board`}),onCopyPng:()=>void m(`copyPng`,N()),onCopySvg:()=>void m(`copySvg`,N()),openInApp:g,askHost:j.length>0?v:null,canAskAi:l&&j.length>0,onAskExplain:()=>A(j.length===1?`Explain what this is and its role on the board. If the labels alone don't tell the story, look at the canvas first.`:`Explain what the selected shapes are and how they connect. If the labels alone don't tell the story, look at the canvas first.`,!0),onAskFeedback:()=>A(`Review the selection as a critical colleague: point out missing pieces, unclear names, and confusing or ambiguous flows. If a frame is selected, review what's inside it. Don't change anything; answer in text.`,!0),onAskTidy:()=>A(`Tidy up the selection. If it's a diagram, re-lay it out and fix the arrows; otherwise align and space the shapes cleanly. Then look at the result and fix anything still off (overlaps, stray labels, spacing). Don't change colours, fonts or styling.`,!0),onAskProofread:()=>A(`Fix any spelling or grammar mistakes in the text of the selected shapes; if a frame is selected, check the shapes inside it too. Keep the wording, formatting and meaning otherwise, and leave text that has no mistakes untouched. If nothing needs fixing, just say so.`,!0),onAskIcons:()=>A(`Add fitting icons to the selected shapes that represent recognizable things (services, products, people); if a frame is selected, work on the shapes inside it. Leave the rest alone.`,!0),onAskRestyle:()=>A(`Restyle the selected shapes: `,!1),onAskCustom:()=>A(``,!1),showGrid:x,onToggleGrid:r.toggleGrid,snapEnabled:S,onToggleSnap:r.toggleSnap,presentationAnimation:C,onTogglePresentationAnimation:r.togglePresentationAnimation,showZoomIndicator:w,onToggleShowZoomIndicator:r.toggleShowZoomIndicator,onZoomToFit:s.zoomToFit,onResetZoom:s.resetZoomCentered,onZoomToSelection:s.zoomToSelection,canClear:_.length>0,onClear:n.clearCanvas}}}function Lm(e){let{containerRef:t,fitToBounds:n,zoomIn:r,zoomOut:i,resetZoom:a}=e,o=V(),s=o.store,c=o.measurement,l=(0,J.useCallback)(()=>{let e=s.getState();return sa(e.shapes,e.selectedIds)},[s]),u=(0,J.useCallback)(()=>{let e=t.current;if(!e)return;let r={width:e.clientWidth,height:e.clientHeight},i=l(),a=i.length>0?i:s.getState().shapes;n(Bt(a,c),r)},[t,s,l,n,c]),d=(0,J.useCallback)(()=>{let e=t.current,r=l();!e||r.length===0||n(Bt(r,c),{width:e.clientWidth,height:e.clientHeight})},[t,l,n,c]),f=(0,J.useCallback)(()=>{let e=t.current;e&&n(Bt(s.getState().shapes,c),{width:e.clientWidth,height:e.clientHeight})},[t,s,n,c]),p=(0,J.useCallback)(()=>{let e=t.current?.getBoundingClientRect();return{x:(e?.width??0)/2,y:(e?.height??0)/2}},[t]),m=(0,J.useCallback)(()=>r(p()),[r,p]),h=(0,J.useCallback)(()=>i(p()),[i,p]),g=(0,J.useCallback)(()=>a(p()),[a,p]);return(0,J.useMemo)(()=>({zoomToFit:u,zoomToSelection:d,backToContent:f,zoomInCentered:m,zoomOutCentered:h,resetZoomCentered:g}),[u,d,f,m,h,g])}function Rm(e,t,n){for(let r=e.length-1;r>=0;--r){let i=e[r];if(i.locked)continue;let a=cn(i,n);if(!(a.width<=0||a.height<=0)){if(yu(i)){if(Tu(i,t))return i;continue}if(ia(i,t,n))return i}}return null}function zm(e,t,n){let r=Rm(e,t,n);if(!r)return{kind:`point`,x:t.x,y:t.y};let{footprint:i,toLocal:a}=aa(r,n),o=a(t);return{kind:`shape`,shapeId:r.id,fx:i.width>0?(o.x-i.x)/i.width:.5,fy:i.height>0?(o.y-i.y)/i.height:.5}}function Bm(e,t,n){if(e.kind===`point`)return{x:e.x,y:e.y};let r=t.get(e.shapeId);if(!r)return null;let{footprint:i,toWorld:a}=aa(r,n);return a({x:i.x+e.fx*i.width,y:i.y+e.fy*i.height})}function Vm(){let e=U(),t=V(),n=ie()!==null,r=(0,J.useCallback)(()=>{if(!n)return;let t=e.getState(),r=sa(t.shapes,t.selectedIds)[0];r&&t.setCommentDraft({kind:`shape`,shapeId:r.id,fx:1,fy:0})},[n,e]),i=(0,J.useCallback)(r=>{if(!n)return;let i=e.getState();i.setCommentDraft(zm(i.shapes,r,t.measurement))},[n,t,e]),a=(0,J.useCallback)(t=>{if(e.getState().selectedIds.size>0){r();return}t&&i(t)},[i,r,e]);return(0,J.useMemo)(()=>({available:n,addComment:a,commentAt:i,commentOnSelection:r}),[n,a,i,r])}var Hm=[`startArrow`,`endArrow`,`startHead`,`endHead`,`flow`],Um=[`lineHeight`,`letterSpacing`],Wm={rectangle:[`fillStyle`,`stroke`,`shadow`,`corner`,`textAlign`,`textVAlign`,`textPadding`,`labelColor`,...Um],text:[`textAlign`,`textVAlign`,...Um],sticky:Um,image:[`corner`],polygon:[`smooth`],arrow:[`bendStyle`],table:[`background`],figure:[`fill`,`strokeWidth`,`dash`],control:[`fill`]};function Gm(e){let t=tn[e],n=new Set([`opacity`,...Wm[e]??[]]);return t.color&&n.add(`color`),t.fill&&n.add(`fill`),t.stroke&&n.add(`strokeWidth`),t.dash&&n.add(`dash`),t.font!==`none`&&(n.add(`fontSize`),n.add(`fontFamily`)),t.arrowEnds&&Hm.forEach(e=>n.add(e)),n}var Km=Object.fromEntries(Object.keys(tn).map(e=>[e,Gm(e)]));function qm(e,t){for(let n of e)if(Km[n].has(t))return!0;return!1}function Jm(e){return e.type===`rectangle`||e.type===`image`}function Ym(e){return e.type===`rectangle`?xn(e.kind):`sharp`}function Xm(e){return e.type===`text`?{...e,text:An(e.text)}:(e.type===`rectangle`||e.type===`icon`||e.type===`arrow`||e.type===`line`)&&e.label?{...e,label:An(e.label)}:e}var Zm=[`fill`,`fillStyle`,`stroke`,`labelColor`];function Qm(e,t){let n=e;n.type===`rectangle`&&n.fillStyle===`outline`&&Zm.some(e=>t[e]!==void 0)&&(n={...n,...tt(n.fill,n.labelColor)});let r=Km[n.type],i={};for(let e of Object.keys(t)){let a=t[e];a===void 0||!r.has(e)||e===`background`||(i[e]=$m(n,e,a))}return Object.keys(i).length===0?n:(`shadow`in i&&!(`fillStyle`in i)&&n.type===`rectangle`&&n.fillStyle===`shadow`&&(i.fillStyle=`bold`),`bendStyle`in i&&Object.assign(i,{bend:0,bendAlong:0,bow:0,bowAlong:0,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}),n={...n,...i},`color`in i||`labelColor`in i?Xm(n):n)}function $m(e,t,n){return t===`stroke`||t===`labelColor`?n===`auto`?void 0:n:t===`shadow`||t===`smooth`?n||void 0:t===`corner`&&Jm(e)&&n===Ym(e)?void 0:n}function eh(e,t){if(vr(e)){let n=e.fill;return n&&n!==`transparent`?{fill:t}:{color:t}}return e.type===`rectangle`&&e.kind===`fork-join`?{color:t}:Yt(e)?{fill:t}:{color:t}}function th(e,t){if(!e)return t;let n=Km[e.type],r=e,i={};for(let a of Object.keys(nh))i[a]=n.has(a)?r[a]??rh(e,a,t):t[a];if(e.type===`rectangle`&&e.fillStyle===`outline`){let t=tt(e.fill,e.labelColor);i.fill=t.fill,i.fillStyle=t.fillStyle??i.fillStyle,i.stroke=t.stroke??`auto`,i.labelColor=t.labelColor??`auto`}return i}var nh={color:!0,fill:!0,fillStyle:!0,stroke:!0,shadow:!0,strokeWidth:!0,dash:!0,opacity:!0,corner:!0,fontSize:!0,fontFamily:!0,textAlign:!0,textVAlign:!0,textPadding:!0,lineHeight:!0,letterSpacing:!0,labelColor:!0,startArrow:!0,endArrow:!0,startHead:!0,endHead:!0,flow:!0,bendStyle:!0,background:!0,smooth:!0};function rh(e,t,n){switch(t){case`fill`:return`transparent`;case`fillStyle`:return St;case`stroke`:case`labelColor`:return`auto`;case`shadow`:return e.type===`rectangle`&&e.fillStyle===`shadow`;case`corner`:return Jm(e)?Ym(e):void 0;case`strokeWidth`:case`dash`:return e.type===`figure`?hn(e)[t]:void 0;case`fontSize`:case`fontFamily`:return n[t];case`textAlign`:return e.type===`rectangle`?`center`:`left`;case`textVAlign`:return e.type===`rectangle`?`middle`:`top`;case`textPadding`:return 6;case`startHead`:case`endHead`:return`arrow`;case`flow`:return!1;default:return}}var ih=t({clipboardCopyId:()=>Dh,copySelection:()=>yh,copyStyles:()=>wh,cutSelection:()=>bh,duplicateSelection:()=>Ch,hasClipboard:()=>Eh,hasStyleClipboard:()=>Oh,noteDuplication:()=>mh,noteMove:()=>hh,pasteClipboard:()=>xh,pasteExternal:()=>Sh,pasteStyles:()=>Th});function ah(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}var oh=24,sh=[],ch=``,lh=null,uh=null;function dh(e){return lh?.deref()===e}var fh=null;function ph(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function mh(e,t){fh={ids:new Set(e),offset:t}}function hh(e,t){!fh||!ph(fh.ids,e)||(fh={ids:e,offset:{x:fh.offset.x+t.x,y:fh.offset.y+t.y}})}function gh(e,t,n){let r=e.getState(),{activeGroupId:i}=r,a=sr(t,n),o=i&&t.every(e=>e.groupId===i)?a.map(e=>({...e,groupId:i})):a;return r.addMany(o),r.setSelectedIds(new Set(o.map(e=>e.id))),o}function _h(e,t,n){let{shapes:r,selectedIds:i,activeGroupId:a}=e.getState();return km(r,sa(r,i),{activeGroupId:a,measurement:t,includeLocked:n})}function vh(e,t){let n=Yn();sh=t,ch=n,lh=new WeakRef(e),cd(t,n)}function yh(e,t){let n=_h(e,t,!0);n.length!==0&&vh(e,n)}function bh(e,t){let n=_h(e,t,!1);if(n.length===0)return;vh(e,n);let r=e.getState();r.removeShapes(new Set(n.map(e=>e.id))),r.setSelectedIds(new Set)}function xh(e,t,n){if(sh.length===0)return;if(!dh(e)){let r=t??(n?{x:n.x+n.width/2,y:n.y+n.height/2}:null);Sh(e,sh,ch,r);return}let r={x:oh,y:oh},i=Bt(sh);t&&i?r={x:t.x-(i.x+i.width/2),y:t.y-(i.y+i.height/2)}:!t&&i&&n&&!ah(i,n)&&(r={x:n.x+n.width/2-(i.x+i.width/2),y:n.y+n.height/2-(i.y+i.height/2)}),sh=gh(e,sh,r)}function Sh(e,t,n,r){if(t.length===0)return;let i={x:oh,y:oh},a=Bt(t);a&&r&&(i={x:r.x-(a.x+a.width/2),y:r.y-(a.y+a.height/2)}),sh=gh(e,t,i),ch=n,lh=new WeakRef(e)}function Ch(e,t){let n=_h(e,t,!0);if(n.length===0)return;let r=new Set(n.map(e=>e.id)),i=fh&&ph(fh.ids,r)?fh.offset:{x:oh,y:oh},a=gh(e,n,i);fh={ids:new Set(a.map(e=>e.id)),offset:i}}function wh(e){let{shapes:t,selectedIds:n,style:r}=e.getState(),i=t.find(e=>n.has(e.id));i&&(uh=th(i,r))}function Th(e){if(!uh)return;let t=uh,n=e.getState(),r=sa(n.shapes,n.selectedIds).map(e=>Qm(e,t));r.length>0&&n.replaceMany(r)}function Eh(){return sh.length>0}function Dh(){return ch}function Oh(){return uh!==null}var kh=0;function Ah(e){let t=kh;kh=(t+1)%8;let n=t*24;return{x:e.x+n,y:e.y+n}}function jh(e,t,n){let r=e.getState(),i=Ah(n),a=eo(t,i,{fontSize:r.style.fontSize,fontFamily:r.style.fontFamily,color:kt,opacity:1}),o=Za(a),s={...a,x:i.x-o.width/2,y:i.y-o.height/2};r.addShape(s),r.setSelectedIds(new Set([s.id]))}function Mh(e,t,n,r){let i=e.getState(),a=Ah(r),o=Ro({x:0,y:0},{fontFamily:i.style.fontFamily,color:kt,opacity:1}),s={...o,chartType:n,cells:So(t),x:a.x-o.width/2,y:a.y-o.height/2};i.addShape(s),i.setSelectedIds(new Set([s.id]))}function Nh(e,t,n){if(co(t)){e.getState().setPasteChoiceGrid(t);return}jh(e,t,n)}function Ph(e,t,n){let r=e.getState(),i=r.pasteChoiceGrid;if(r.setPasteChoiceGrid(null),i){if(t===`table`){jh(e,i,n);return}Mh(e,i,t,n)}}function Fh(e){for(let t of e.split(/\r?\n/)){let e=t.trim();if(e.length>0&&!e.startsWith(`#`))return e}return null}function Ih(e,t){return{id:Yn(),type:`web`,kind:`embed`,x:Math.round(t.x-e.width/2),y:Math.round(t.y-e.height/2),width:e.width,height:e.height,rotation:0,label:``,url:e.canonical,keepAspect:e.keepAspect||void 0,opacity:1}}var Lh={width:800,height:600};function Rh(e){return(/<title[^>]*>([\s\S]*?)<\/title>/i.exec(e)?.[1]??``).replace(/\s+/g,` `).trim().slice(0,200)}function zh(e,t){let n=Rh(e);return{id:Yn(),type:`web`,kind:`html`,x:Math.round(t.x-Lh.width/2),y:Math.round(t.y-Lh.height/2),width:Lh.width,height:Lh.height,rotation:0,label:n.length>0?n:`HTML widget`,html:e,opacity:1}}function Bh(e){let{containerRef:t,addShape:n,setSelectedIds:r}=e,i=U(),{measurement:a}=V(),o=(0,J.useCallback)(()=>{let e=t.current?.getBoundingClientRect();return e?Cr({x:e.width/2,y:e.height/2},i.getState().viewport):{x:0,y:0}},[t,i]),s=(0,J.useCallback)(()=>{let e=t.current?.getBoundingClientRect();if(!e)return;let n=i.getState().viewport,r=Cr({x:0,y:0},n),a=Cr({x:e.width,y:e.height},n);return{x:r.x,y:r.y,width:a.x-r.x,height:a.y-r.y}},[t,i]),c=H(e=>e.pasteChoiceGrid)!==null,l=(0,J.useCallback)(e=>Nh(i,e,o()),[i,o]),u=(0,J.useCallback)(e=>Ph(i,e,o()),[i,o]),{hasClipboard:d,clipboardCopyId:f,hasStyleClipboard:p}=ih,m=(0,J.useCallback)(()=>yh(i,a),[i,a]),h=(0,J.useCallback)(()=>bh(i,a),[i,a]),g=(0,J.useCallback)(()=>wh(i),[i]),_=(0,J.useCallback)(()=>Th(i),[i]),v=(0,J.useCallback)(()=>Ch(i,a),[i,a]),y=(0,J.useCallback)(e=>xh(i,e,s()),[i,s]),b=(0,J.useCallback)((e,t)=>Sh(i,e,t,o()),[i,o]),x=(0,J.useCallback)(e=>{let t=e.trim();if(!t)return;let a=gu(o(),i.getState().style,{text:t});n(a),r(new Set([a.id]))},[i,o,n,r]),S=(0,J.useCallback)(e=>{let t=Ih(e,o());n(t),r(new Set([t.id]))},[o,n,r]),C=(0,J.useCallback)(e=>{let t=zh(e,o());n(t),r(new Set([t.id]))},[o,n,r]),w=(0,J.useCallback)(e=>{let t=o();wi(()=>import(`./color-swatches-CZKb4DxX.js`).then(n=>{let a=i.getState();if(a.viewMode)return;let o=n.createColorSwatches(e,t,a.style);a.addMany(o),r(new Set(o.map(e=>e.id)))},()=>{}),__vite__mapDeps([27,7,6]))},[i,o,r]),T=(0,J.useCallback)(e=>{let t=o();wi(()=>import(`./mermaid-paste-2cCwweY0.js`).then(n=>n.mermaidPasteShapes(e,t)),__vite__mapDeps([28,7,6,21,22,8,23,9,10,11,12,13,14,15,16,17,24,29,30,20,31])).catch(()=>null).then(t=>{if(i.getState().viewMode)return;if(!t||t.shapes.length===0){x(e);return}i.getState().addMany(t.shapes);let n=t.primaryId?[t.primaryId]:t.shapes.map(e=>e.id);r(new Set(n))})},[i,o,x,r]),E=(0,J.useCallback)(async()=>{let e=``;try{e=await navigator.clipboard.readText()}catch{return}x(e)},[x]);return(0,J.useMemo)(()=>({viewportCenterWorld:o,viewportBoundsWorld:s,pasteChoiceOpen:c,pasteGrid:l,resolvePasteChoice:u,copySelection:m,cutSelection:h,copyStyles:g,pasteStyles:_,duplicateSelection:v,hasClipboard:d,clipboardCopyId:f,hasStyleClipboard:p,pasteClipboard:y,pasteExternal:b,pasteText:x,pasteEmbed:S,pasteHtmlWidget:C,pasteColors:w,pasteMermaid:T,pasteAsText:E}),[o,s,c,l,u,m,h,g,_,v,d,f,p,y,b,x,S,C,w,T,E])}function Vh(){return new Map}var Hh=Vh();function Uh(e,t=``){return`${t?`${t} `:``}16px ${e}`}var Wh=[`bold`,`italic`,`italic bold`];function Gh(e,t,n){let r=t.map(t=>{let r=n.get(t);if(r)return r;let i=e.load(t).catch(e=>{throw n.delete(t),e});return n.set(t,i),i});return Promise.all(r).then(()=>void 0,()=>void 0)}function Kh(e){let t=Ni(e).families;return Ct.map(e=>e.value).filter(e=>t.has(Oi(e)))}function qh(e,t,n){return Gh(e,[Uh(t),...Wh.map(e=>Uh(t,e))],n)}function Jh(e){let t=window;if(t.requestIdleCallback){let n=t.requestIdleCallback(e);return()=>{t.cancelIdleCallback?.(n)}}let n=window.setTimeout(e,200);return()=>{window.clearTimeout(n)}}var Yh=Uh(At);function Xh(e){return Array.from(new Set([At,...Kh(e.getState().shapes)]))}function Zh(){let[e,t]=(0,J.useState)(!1),n=U();return(0,J.useEffect)(()=>{if(typeof document>`u`||!(`fonts`in document)){t(!0);return}let e=!1,r=()=>{},i=Xh(n),a=i.map(e=>Uh(e)),o=i.flatMap(e=>Wh.map(t=>Uh(e,t))),s=()=>{e||(t(!0),r=Jh(()=>{Gh(document.fonts,o,Hh)}))};return Gh(document.fonts,[Yh,...a],Hh).then(s,s),()=>{e=!0,r()}},[n]),e}function Qh(){let e=Ms();(0,J.useEffect)(()=>{let t=document.documentElement;t.classList.toggle(`dark`,e===`dark`),t.style.colorScheme=e,document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,e===`dark`?`#1c1c1f`:`#ffffff`)},[e])}var $h=`(max-width: 639px)`,eg=`(max-width: 1023px)`,tg=`(pointer: coarse)`;function ng(e,t){return e.matches?`phone`:t.matches?`tablet`:`desktop`}function rg(){let e=U();(0,J.useEffect)(()=>{let t=window.matchMedia($h),n=window.matchMedia(eg),r=window.matchMedia(tg),{setDeviceMode:i,setCoarsePointer:a}=e.getState(),o=()=>{i(ng(t,n)),a(r.matches)};o();for(let e of[t,n,r])e.addEventListener(`change`,o);return()=>{for(let e of[t,n,r])e.removeEventListener(`change`,o)}},[e])}function ig(){let{uploadImage:e}=B(),{store:t,history:n}=V(),{runWithoutHistory:r}=n,i=(0,J.useRef)(new Map);(0,J.useEffect)(()=>{if(!e)return;let n=i.current,a=(e,n)=>{let i=t.getState(),a=Mr(i.shapes,`image`).filter(t=>t.src===e);a.length!==0&&r(()=>{for(let e of a)i.updateShape(e.id,{src:n})})},o=t=>{for(let r of Mr(t,`image`)){if(!r.src.startsWith(`data:`))continue;let t=r.src,i=n.get(t);if(!(i===`pending`||i===`failed`)){if(typeof i==`string`){a(t,i);continue}n.set(t,`pending`),e(t).then(e=>{n.set(t,e),a(t,e)},()=>{n.set(t,`failed`)})}}};return o(t.getState().shapes),t.subscribe((e,t)=>{e.shapes!==t.shapes&&o(e.shapes)})},[e,t,r])}var ag=()=>wi(()=>import(`./web-runtime-wPi8lWzO.js`),__vite__mapDeps([32,10,26,33,34,22,6,7,8,3,1,13,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,25,11,55,56,57,2,4,58,59,60])),og=new Set;function sg(e){return og.add(e),()=>{og.delete(e)}}function cg(){return Ba(ag)}function lg(){return Ha(ag).then(e=>{for(let e of og)e();return e})}function ug(){lg().catch(()=>{})}function dg(){}function fg(e){let t=(0,J.useSyncExternalStore)(sg,cg,dg);return(0,J.useEffect)(()=>{e&&!t&&ug()},[e,t]),t}function pg(e){let{shape:t,unit:n,world:r,event:i,env:a,started:o,root:s,runtime:c}=e;if(t?.type!==`web`||!s||n.size!==1||!n.has(t.id)||i.shiftKey||i.metaKey||i.ctrlKey)return null;let l=c?.webMount(t,a);if(!c||!l)return null;let u=c.needsStart(l,a)&&!o;return u&&l.kind===`html`?null:{id:t.id,pagePoint:{x:r.x-t.x,y:r.y-t.y},clientX:i.clientX,clientY:i.clientY,replay:l.kind===`html`,start:u,root:s}}function mg(e,t,n,r,i){let a=Math.hypot(r.clientX-n.clientX,r.clientY-n.clientY);if(i||a>4)return;let o=t.liveWebIds.has(n.id);if(t.setSelectedIds(new Set([n.id])),n.start&&t.startWeb(n.id),t.beginInteract(n.id),!n.replay||!o)return;let s=e?.findWidgetFrame(n.id,n.root);!e||!s||e.sendWidgetClick(s,n.pagePoint.x,n.pagePoint.y)}var hg=120,gg=50,_g=9,vg=2;function yg(e){return e.length<2?``:en(nr(e.map(e=>[e.x,e.y]),{size:_g,thinning:0,smoothing:.5,streamline:.32,simulatePressure:!1,start:{taper:60,cap:!0},end:{taper:0,cap:!0}}))}function bg(){let e=U(),t=(0,J.useRef)([]),n=(0,J.useRef)(!1),r=(0,J.useRef)(``);(0,J.useEffect)(()=>{let n=0,i=()=>{let a=performance.now()-hg,o=t.current;for(;o.length>0&&o[0].t<a;)o.shift();let s=0;for(let e=o.length-1;e>0;--e)if(s+=Math.hypot(o[e].x-o[e-1].x,o[e].y-o[e-1].y),s>gg){o.splice(0,e);break}let c=yg(o);c!==r.current&&(r.current=c,e.getState().setEraserTrail(c)),n=requestAnimationFrame(i)};return n=requestAnimationFrame(i),()=>cancelAnimationFrame(n)},[e]);function i(e){n.current=!0,t.current.push({x:e.x,y:e.y,t:performance.now()})}function a(e){if(!n.current)return;let r=t.current,i=r[r.length-1];(!i||Math.abs(e.x-i.x)>=vg||Math.abs(e.y-i.y)>=vg)&&r.push({x:e.x,y:e.y,t:performance.now()})}function o(){n.current=!1}return{start:i,move:a,end:o}}var xg={move(e,t,n){let r=t.getState();if(!e.moved){let t=Math.hypot(n.clientX-e.startX,n.clientY-e.startY);if(t<4&&e.button===2)return;e.moved=t>=4,r.setIsPanning(!0)}let i=e.viewportX+(n.clientX-e.startX),a=e.viewportY+(n.clientY-e.startY);r.setViewport(e=>({...e,x:i,y:a}))},end(e,t,n){if(e.button===2){if(!e.menuSwallowed){t.suppressNextMenu.current=e.moved;return}e.moved||document.elementFromPoint(n.clientX,n.clientY)?.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,view:window,clientX:n.clientX,clientY:n.clientY,button:2}))}}};function Sg(e){if(tn[e.type].hit===`outline`){let t=W(e);return[{x:t.x,y:t.y},{x:t.x+t.width,y:t.y},{x:t.x+t.width,y:t.y+t.height},{x:t.x,y:t.y+t.height},{x:t.x,y:t.y}]}return xu(e)}function Cg(e,t,n){let r=1/0;for(let i=0;i<n.length-1;i+=1){let a=n[i],o=n[i+1];if(r=Math.min(r,rt(e,a,o),rt(t,a,o),rt(a,e,t),rt(o,e,t)),r===0)return 0}return r}function wg(e,t,n,r,i){if(!pn(e)){let i=`strokeWidth`in e?e.strokeWidth??0:0,a=r+(e.type===`draw`?gn(e):i)+1;if(!Ze(ut(pr(e),a),Ge([t,n])))return!1}let a=Sg(e);if(a){if(a.length<2)return!1;let i=e.type===`draw`?gn(e):`strokeWidth`in e?e.strokeWidth??0:0;return Cg(t,n,a)<=r+i/2}let o=aa(e,i);return mt(o.toLocal(t),o.toLocal(n),o.footprint,r)}var Tg=.5;function Eg(e,t){return t===`x`?[e.x,e.x+e.width/2,e.x+e.width]:[e.y,e.y+e.height/2,e.y+e.height]}function Dg(e,t,n){let[r,i,a]=Eg(e,t),[o,s,c]=Eg(e,t===`x`?`y`:`x`);return Math.abs(r-n)<=Tg||Math.abs(a-n)<=Tg?[o,c]:Math.abs(i-n)<=Tg?[s]:[]}function Og(e,t,n,r=[]){let i=[...n.flatMap(n=>Dg(n,e,t)),...r],a=n.flatMap(t=>{let[n,,r]=Eg(t,e===`x`?`y`:`x`);return[n,r]});return{axis:e,pos:t,start:Math.min(...a,...r),end:Math.max(...a,...r),marks:i}}function kg(e,t,n,r){let i=null;for(let a of t)for(let t of Eg(a,n))for(let n of e){let e=t-n;Math.abs(e)<=r&&(!i||Math.abs(e)<Math.abs(i.delta))&&(i={delta:e,pos:t,target:a})}return i}function Ag(e,t,n){let r=kg(Eg(e,`x`),t,`x`,n),i=kg(Eg(e,`y`),t,`y`,n),a=r?r.delta:0,o=i?i.delta:0,s={x:e.x+a,y:e.y+o,width:e.width,height:e.height},c=[];if(r){let e=Math.abs(s.x-r.target.x)<=Tg,t=Math.abs(s.x+s.width-(r.target.x+r.target.width))<=Tg;e&&t?(c.push(Og(`x`,s.x,[s,r.target])),c.push(Og(`x`,s.x+s.width,[s,r.target]))):c.push(Og(`x`,r.pos,[s,r.target]))}if(i){let e=Math.abs(s.y-i.target.y)<=Tg,t=Math.abs(s.y+s.height-(i.target.y+i.target.height))<=Tg;e&&t?(c.push(Og(`y`,s.y,[s,i.target])),c.push(Og(`y`,s.y+s.height,[s,i.target]))):c.push(Og(`y`,i.pos,[s,i.target]))}return{dx:a,dy:o,guides:c}}function jg(e,t,n){let r=kg([e.x],t,`x`,n),i=kg([e.y],t,`y`,n),a=r?r.pos:e.x,o=i?i.pos:e.y,s=[];return r&&s.push(Og(`x`,r.pos,[r.target],[o])),i&&s.push(Og(`y`,i.pos,[i.target],[a])),{point:{x:a,y:o},guides:s}}var Mg=32;function Ng(e,t,n,r){let i=r===`x`?`x`:`y`,a=r===`x`?`width`:`height`,o=r===`x`?`y`:`x`,s=r===`x`?`height`:`width`,c=e=>e[i],l=e=>e[i]+e[a],u=e=>e[o],d=e=>e[o]+e[s],f=(e,t)=>Math.min(d(e),d(t))-Math.max(u(e),u(t)),p=t.filter(t=>f(e,t)>0),m=c(e),h=e[a];if(p.length>Mg){let e=m+h/2;p=p.map(t=>({t,dist:Math.abs(c(t)+t[a]/2-e)})).sort((e,t)=>e.dist-t.dist).slice(0,Mg).map(e=>e.t)}let g=null,_=n,v=(t,n,i)=>{let a=t-m,o=Math.abs(a);o>_||(g={delta:a,guide:{kind:`gap`,axis:r,cross:(Math.max(u(e),...n.map(u))+Math.min(d(e),...n.map(d)))/2,bars:i}},_=o)};for(let e of p)for(let t of p){if(e===t||l(e)>c(t))continue;let n=(c(t)-l(e)-h)/2;if(n>=-.01){let r=l(e)+n;v(r,[e,t],[{from:l(e),to:r},{from:r+h,to:c(t)}])}if(f(e,t)>0){let n=c(t)-l(e),r=l(t)+n;v(r,[e,t],[{from:l(e),to:c(t)},{from:l(t),to:r}]);let i=c(e)-n-h;v(i,[e,t],[{from:i+h,to:c(e)},{from:l(e),to:c(t)}])}}return g}function Pg(e,t,n){let r=Ng(e,t,n,`x`),i=Ng(e,t,n,`y`),a=[];return r&&a.push(r.guide),i&&a.push(i.guide),{dx:r?r.delta:0,dy:i?i.delta:0,snappedX:r!==null,snappedY:i!==null,guides:a}}var Fg=Math.PI/12;function Ig(e,t){let n=e.x+e.width/2;t.includes(`w`)?n=e.x:t.includes(`e`)&&(n=e.x+e.width);let r=e.y+e.height/2;return t.includes(`n`)?r=e.y:t.includes(`s`)&&(r=e.y+e.height),{x:n,y:r}}function Lg(e,t,n,r,i){if(e.type===`arrow`)return null;let a;a=e.type===`text`&&r?r.box:e.type===`icon`&&i?i:W(e);let o=an(e)*Math.PI/180,s=o?Lt(n,rn(e),-o):n,c=Ig(a,t);return{x:s.x-c.x,y:s.y-c.y}}function Rg(e,t,n){return Cr({x:e.clientX-t.left,y:e.clientY-t.top},n)}function zg(e,t){return{x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}}function Bg(e,t){return e.x<=t.x&&e.y<=t.y&&e.x+e.width>=t.x+t.width&&e.y+e.height>=t.y+t.height}function Vg(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i),o=Math.round(Math.atan2(i,r)/n)*n;return{x:e.x+Math.cos(o)*a,y:e.y+Math.sin(o)*a}}function Hg(e,t,n,r,i,a){let o=n,s;if(!r.shift&&!r.alt&&!r.noSnap){let t=i(new Set([e.id])),n=jg(o,t,a);o=n.point,s=n.guides}let c=o.x-t.startWorld.x,l=o.y-t.startWorld.y;if(r.shift){let e=Math.max(Math.abs(c),Math.abs(l));c=(c<0?-1:1)*e,l=(l<0?-1:1)*e}return r.alt?{draft:{...e,x:t.startWorld.x-c,y:t.startWorld.y-l,width:c*2,height:l*2},guides:s}:{draft:{...e,width:c,height:l},guides:s}}function Ug(e,t,n){let r=Math.abs(e.x-t.x),i=Math.abs(e.y-t.y);return i<=r&&i<=n?{point:{x:e.x,y:t.y},guide:{axis:`y`,pos:t.y,start:Math.min(t.x,e.x),end:Math.max(t.x,e.x)}}:r<=n?{point:{x:t.x,y:e.y},guide:{axis:`x`,pos:t.x,start:Math.min(t.y,e.y),end:Math.max(t.y,e.y)}}:{point:e,guide:null}}function Wg(e,t,n,r,i,a){let o=Pe(n,e,i.excludeId,a);o&&i.forbidNode?.(o)&&(o=null);let s=t.shift?Vg(i.anchor,e,Fg):e,c=e,l=null,u=null,d=[];if(o)c=t.shift&&Pe(n,s,i.excludeId,a)===o?s:e;else{let f=lf(s,n,r/6*10,i.excludeId);if(f)if(c=f.point,l=f.point,f.attach)je(n,i.excludeId,f.attach.shapeId)||(u={kind:`path`,...f.attach});else{let e=Pe(n,f.point,i.excludeId,a);e&&!i.forbidNode?.(e)&&(o=e,l=null)}else if(t.shift)c=s;else{let t=Ug(e,i.otherRef(),r);c=t.point,t.guide&&(d=[t.guide])}}return{point:c,node:o,attach:u,snapDot:l,guides:d}}function Gg(e,t,n,r,i,a,o,s){if(e.type===`rectangle`||e.type===`figure`||e.type===`chart`||e.type===`control`)return Hg(e,t,n,r,a,o);if(e.type===`icon`){let r=n.x-t.startWorld.x,i=n.y-t.startWorld.y,a=Xn(Math.max(Math.abs(r),Math.abs(i)),Bc(e.source,e.name));return{draft:{...e,x:r<0?t.startWorld.x-a.width:t.startWorld.x,y:i<0?t.startWorld.y-a.height:t.startWorld.y,width:a.width,height:a.height}}}if(e.type===`draw`)return{draft:{...e,points:[...e.points,n]}};if(e.type===`arrow`){if(r.alt){let i=r.shift?Vg(t.startWorld,n,Fg):n;return{draft:{...e,x2:i.x,y2:i.y},guides:[],bindTarget:null,snapDot:null}}let{point:a,node:c,snapDot:l,guides:u}=Wg(n,r,i,o,{excludeId:e.id,anchor:t.startWorld,otherRef:()=>Ie(e,i,void 0,s).start},s);return{draft:{...e,x2:a.x,y2:a.y},guides:u,bindTarget:c?{id:c.id,point:He(c,a,s)}:null,snapDot:l}}return{draft:e}}function Kg(e,t){if(e.length===1){let n=W(e[0],t);return{x:n.x+n.width/2,y:n.y+n.height/2}}let n=Bt(e,t);return n?{x:n.x+n.width/2,y:n.y+n.height/2}:null}function qg(e,t,n){let r=Math.atan2(t.y-e.center.y,t.x-e.center.x)-e.startAngle;if(!n.shift)return r;let i=e.frameAngle*Math.PI/180;return Math.round((i+r)/Fg)*Fg-i}function Jg(e,t,n){let r=qg(e,t,n);return{shapes:e.originals.map(t=>dr(t,e.center,r))}}var Yg={move(e,t,n){let r=t.getState(),i=Rg(n,e.rect,r.viewport),a=5/r.viewport.zoom,o=!1;for(let n of r.shapes)e.ids.has(n.id)||n.locked||wg(n,e.last,i,a,t.measurement)&&(e.ids.add(n.id),o=!0);e.last=i,t.eraserTrail.move({x:n.clientX,y:n.clientY}),o&&r.setErasingIds(new Set(e.ids))},end(e,t){let n=t.getState();e.ids.size>0&&(n.removeShapes(e.ids),n.setSelectedIds(new Set([...n.selectedIds].filter(t=>!e.ids.has(t))))),t.getState().setErasingIds(new Set),t.eraserTrail.end()}},Xg=3,Zg={width:Io.width/2,height:Io.height/2},Qg=new Set([`image`,`avatar`,`divider`,`progress`,`slider`,`scrollbar`,`rating`,`lifeline`]);function $g(e){return e.type===`chart`?Zg:e.type===`control`&&!Qg.has(e.kind)?_i[e.kind]:null}function e_(e){if(e.type!==`control`&&e.type!==`chart`)return!0;let t=$g(e);return!t||Math.abs(e.width)>=t.width&&Math.abs(e.height)>=t.height}function t_(e,t,n=!1,r){if(e.type===`draw`)return e.points.length>=2?e:null;if(e.type===`rectangle`){if(Math.abs(e.width)<Xg&&Math.abs(e.height)<Xg){let t=wn(e.kind);return{...e,width:t.width,height:t.height}}return e}if(e.type===`icon`)return e.width<Xg&&e.height<Xg?{...e,...zc(e.source,e.name)}:e;if(e.type===`figure`){if(Math.abs(e.width)<Xg&&Math.abs(e.height)<Xg){let t=Ao[e.kind??`simple`];return{...e,width:t.width,height:t.height}}return e}if(e.type===`control`||e.type===`chart`){let t=W(e);if(e.type===`chart`&&t.width<Xg&&t.height<Xg){let n=Fo(e.chartType);return{...e,x:t.x,y:t.y,width:n.width,height:n.height}}let n=$g(e);if(n)return{...e,x:t.x,y:t.y,width:Math.max(t.width,n.width),height:Math.max(t.height,n.height)};if(e.type===`control`&&t.width<Xg&&t.height<Xg){let n=_i[e.kind];return{...e,x:t.x,y:t.y,width:n.width,height:n.height}}return e}if(e.type===`arrow`){if(Math.hypot(e.x2-e.x,e.y2-e.y)<Xg)return null;let i={x:e.x2,y:e.y2},a=n?null:Pe(t,i,e.id,r),o=n?null:e.startBinding,s=a?Be(a,i,r):null;if(!a&&!n){let n=lf(i,t,.01,e.id);n?.attach&&(s={kind:`path`,...n.attach})}return o&&s&&o.shapeId===s.shapeId&&!Ue(o)&&(o=null,s=null),{...e,startBinding:o,endBinding:s}}return e}var n_={x:0,y:0},r_=1e-6;function i_(e){return e*Math.PI/180}function a_(e){let t=((e+180)%360+360)%360-180,n=t===-180?180:t;return Math.abs(n)<r_?0:n}function o_(e,t,n,r){if(!e||e.selection!==t||n.length<2||e.shapes.length!==n.length)return null;let i=new Map(e.shapes.map(e=>[e.id,e]));for(let e of n){let t=i.get(e.id);if(!t||!r&&t!==e)return null}return e.angle}function s_(e,t,n){let r=a_(n);return t.length<2||r===0?null:{angle:r,selection:e,shapes:t}}function c_(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function l_(e){return Ge(e)}function u_(e,t,n){if(e.type===`arrow`||e.type===`draw`||e.type===`line`||e.type===`polygon`)return cn(dr(e,n_,-t),n);let r=W(e,n),i={x:r.x+r.width/2,y:r.y+r.height/2},a=i_(an(e));return l_(c_(Gt(e,n)).map(e=>Lt(Lt(e,i,a),n_,-t)))}function d_(e,t,n){if(e.length===0)return null;let r=i_(t),i=l_(e.map(e=>u_(e,r,n)).flatMap(c_)),a=Lt({x:i.x+i.width/2,y:i.y+i.height/2},n_,r);return{bounds:{x:a.x-i.width/2,y:a.y-i.height/2,width:i.width,height:i.height},angle:t}}function f_(e,t){return Lt(e,t.pivot,-i_(t.angle))}function p_(e,t,n,r,i){let a=i_(t.angle);return dr(gr(dr(e,t.pivot,-a),n,r,i),t.pivot,a)}function m_(e,t,n){return{world:Rg(n,e.rect,t.viewport),snapDist:6/t.viewport.zoom,mods:{shift:n.shiftKey,alt:n.altKey,noSnap:!t.snapEnabled||n.metaKey||n.ctrlKey}}}function h_(e,t,n){return n.size===0?t:t.map(t=>{let r=n.get(t.id),i=xr(e.shapes,t.id);if(!r||r===`all`||!i)return t;let a={...t},o=i;for(let e of r)e in o?a[e]=o[e]:delete a[e];return a})}function g_(e,t,n){let r=e.getState(),i=Jt(t),a=h_(r,i,e.remoteEdits());a.length!==0&&r.replaceMany(a,a===i?n:void 0)}function __(e,t){let n=e.getState();t.shape&&Ht(t.shape)&&n.replaceShape(h_(n,[t.shape],e.remoteEdits())[0]),t.shapes&&g_(e,t.shapes),t.guides&&n.setSnapGuides(t.guides),`bindTarget`in t&&n.setBindTarget(t.bindTarget??null),`snapDot`in t&&n.setSnapDot(t.snapDot??null)}function v_(e){let t=o_(e.selectionFrame,e.selectedIds,sa(e.shapes,e.selectedIds),!1);return t===null&&e.selectionFrame&&e.setSelectionFrame(null),t}function y_(e,t){let n=sa(e.shapes,e.selectedIds);if(t.kind===`rotate`){let r=n.length===t.originals.length&&t.originals.every(t=>e.selectedIds.has(t.id)),i=(t.turned??0)*180/Math.PI,a=r?s_(e.selectedIds,n,t.frameAngle+i):null;(a||e.selectionFrame)&&e.setSelectionFrame(a);return}if(t.kind!==`group-resize`&&t.kind!==`move`||!e.selectionFrame)return;let r=o_(e.selectionFrame,e.selectedIds,n,!0);e.setSelectionFrame(r===null?null:s_(e.selectedIds,n,r))}var b_={move(e,t,n){let r=t.draft.current;if(!r)return;let i=t.getState(),{world:a,mods:o,snapDist:s}=m_(e,i,n),c=Gg(r,e,a,o,i.shapes,t.snapTargets,s,t.measurement);t.writeDraft(c.draft),c.guides&&i.setSnapGuides(c.guides),`bindTarget`in c&&i.setBindTarget(c.bindTarget??null),`snapDot`in c&&i.setSnapDot(c.snapDot??null)},end(e,t,n){let r=t.draft.current;t.writeDraft(null);let i=t.getState(),a=r?t_(r,i.shapes,n.altKey,t.measurement):null;a&&(i.addShape(a),a.type!==`draw`&&(i.setSelectedIds(new Set([a.id])),i.releaseTool(),a.type===`icon`&&i.setPendingIcon(null),a.type===`control`&&i.setPendingControl(null)))}};function x_(e,t,n,r,i,a,o){if(t.handle===`start`||t.handle===`end`){let s=t.handle===`start`?e.endBinding:e.startBinding,c=t.handle===`start`?{x:e.x2,y:e.y2}:{x:e.x,y:e.y},{point:l,node:u,attach:d,snapDot:f,guides:p}=r.alt?{point:n,node:null,attach:null,snapDot:null,guides:[]}:Wg(n,r,i,a,{excludeId:e.id,anchor:c,otherRef:()=>{let n=Ie(e,i,void 0,o);return t.handle===`start`?n.end:n.start},forbidNode:e=>s!=null&&s.shapeId===e.id||Pe([e],c,void 0,o)===e},o),m=u?{id:u.id,point:He(u,l,o)}:null,h=u?Be(u,l,o):d,g=t.handle===`start`?{...e,x:l.x,y:l.y,startBinding:h}:{...e,x2:l.x,y2:l.y,endBinding:h};return g.bendStyle===`elbow`&&g.elbowPoints&&(g=Re(g,i,void 0,o)),{shape:g,bindTarget:m,snapDot:f,guides:p}}if(t.handle===`bend`){if(e.bendStyle===`elbow`&&t.elbowSegment!=null&&t.elbowBase)return S_(e,t,n,a);if(e.bendStyle===`elbow`){let t=Le(e,i,void 0,o),r=t.midHandle,s=r?.axis===`x`?t.midXRange:t.midYRange;if(!r||!s)return null;let c=r.axis===`x`?n.x:n.y,l=a/6*10,u=(s.lo+s.hi)/2,d=Math.abs(c-u)<=l?u:c,f=s.hi-s.lo,p=f===0?.5:Xe((d-s.lo)/f);return{shape:{...e,elbowMid:p}}}let r=a/6*10;if(e.startBinding||e.endBinding){let t=Ie(e,i,void 0,o),a=Cn(t.start,t.end,n),s=_r(a.bowAlong,$e(t.start,t.end),r);return{shape:{...e,bow:a.bow,bowAlong:s}}}let s=Rn(e,n),c=Math.hypot(e.x2-e.x,e.y2-e.y),l=_r(s.bendAlong,c,r);return{shape:{...e,bend:s.bend,bendAlong:l,bow:s.bend,bowAlong:l}}}return null}function S_(e,t,n,r){let i=t.elbowBase,a=t.elbowSegment,o=i[a],s=i[a+1];if(!o||!s)return null;let c=Math.abs(s.y-o.y)<=Math.abs(s.x-o.x),l=c?n.y:n.x,u=r/6*10,d=[c?o.y:o.x];a>=1&&d.push(c?i[a-1].y:i[a-1].x),a+2<i.length&&d.push(c?i[a+2].y:i[a+2].x);for(let e of d)if(Math.abs(l-e)<=u){l=e;break}let f=dn(i,a,l);return f?f.length<3?{shape:{...e,elbowMid:void 0,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0}}:{shape:{...e,elbowMid:void 0,elbowPoints:f,elbowRoute:f,elbowMidHandle:void 0}}:null}var C_=.05,w_=.95;function T_(e,t,n,r){let i={x:t.x-n.x,y:t.y-n.y},a=ct(e.type===`arrow`?Pn(e,i):Ot(e.points,i),C_,w_),o={...e,labelAlong:a},s=o.type===`arrow`?er(o):kr(o.points,a),c=e.type===`arrow`?er({...e,labelAlong:void 0}):kr(e.points),l=r/6*10;return $e(s,c)<=l?{shape:{...e,labelAlong:void 0}}:{shape:o}}function E_(e){return e.type===`arrow`?er(e):kr(e.points,e.labelAlong)}var D_=.02,O_=16,k_={width:80,height:60},A_=20;function j_(e){return{hasX:e.includes(`e`)||e.includes(`w`),hasY:e.includes(`n`)||e.includes(`s`)}}function M_(e){if(e.type===`rectangle`||e.type===`figure`||e.type===`chart`)return{x:!0,y:!0};if(e.type===`web`)return e.keepAspect?{x:!1,y:!1}:{x:!0,y:!0};if(e.type===`table`)return{x:!0,y:!1};if(e.type===`control`){let t=yi[e.kind];return t.resize===`width`?{x:!0,y:!1}:t.resize===`height`?{x:!1,y:!0}:t.resize===`free`?{x:!0,y:!0}:{x:!1,y:!1}}return{x:!1,y:!1}}function N_(e,t){let n=e.x+e.width/2;t.includes(`w`)?n=e.x+e.width:t.includes(`e`)&&(n=e.x);let r=e.y+e.height/2;return t.includes(`n`)?r=e.y+e.height:t.includes(`s`)&&(r=e.y),{x:n,y:r}}function P_(e,t,n,r){if(e.type===`arrow`||e.type===`draw`||e.type===`polygon`||e.type===`line`)return e;let i=W(e),a=N_(i,t),o={x:i.x+i.width/2,y:i.y+i.height/2},s=Lt(a,n,r),c=Lt(a,o,r);return{...e,x:e.x+(s.x-c.x),y:e.y+(s.y-c.y)}}function F_(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2;return{x:e.flipX?2*r-(t.x+t.width):t.x,y:e.flipY?2*i-(t.y+t.height):t.y,width:t.width,height:t.height}}function I_(e,t,n){let r=e.original,i=e.startBounds,a=F_(r,e.imageBox,i),o=e.handle,s=an(r)*Math.PI/180,c=rn(r),l=s?Lt(t,c,-s):t,{hasX:u,hasY:d}=j_(o),f=u&&d,p=Fn(i,o,l);if(n.alt){let e=i.x+i.width/2,t=i.y+i.height/2,n=p.x,r=p.x+p.width,a=p.y,s=p.y+p.height;if(u){let t=Math.abs((o.includes(`w`)?p.x:r)-e);n=e-t,r=e+t}if(d){let e=Math.abs((o.includes(`n`)?p.y:s)-t);a=t-e,s=t+e}p={x:n,y:a,width:r-n,height:s-a}}if(n.shift&&f){let e=(i.width||1)/(i.height||1),t=p.width,r=p.height;if(t/e>=r?r=t/e:t=r*e,n.alt){let e=i.x+i.width/2,n=i.y+i.height/2;p={x:e-t/2,y:n-r/2,width:t,height:r}}else{let e=o.includes(`w`),n=o.includes(`n`),i=e?p.x+p.width:p.x,a=n?p.y+p.height:p.y;p={x:e?i-t:i,y:n?a-r:a,width:t,height:r}}}let m=Math.max(a.x,Math.min(p.x,a.x+a.width)),h=Math.max(a.x,Math.min(p.x+p.width,a.x+a.width)),g=Math.max(a.y,Math.min(p.y,a.y+a.height)),_=Math.max(a.y,Math.min(p.y+p.height,a.y+a.height)),v={x:Math.min(m,h),y:Math.min(g,_),width:Math.max(8,Math.abs(h-m)),height:Math.max(8,Math.abs(_-g))},y={x:0,y:0,width:1,height:1};if(a.width>0&&a.height>0){let e=v.width/a.width,t=v.height/a.height,n=(v.x-a.x)/a.width,i=(v.y-a.y)/a.height;y={x:r.flipX?1-n-e:n,y:r.flipY?1-i-t:i,width:e,height:t}}let b={x:v.x+v.width/2,y:v.y+v.height/2},x=s?Lt(b,c,s):b;return{shape:{...r,x:x.x-v.width/2,y:x.y-v.height/2,width:v.width,height:v.height,crop:y}}}function L_(e,t,n){if(e.type!==`rectangle`)return e;let r=xr(t,e.id);return r?.type===`rectangle`?j_(n).hasY?{...e,minHeight:r.minHeight,autoHeightFrom:void 0}:{...e,minHeight:r.minHeight,height:r.height,autoHeightFrom:r.autoHeightFrom}:e}function R_(e,t,n,r,i,a,o){let s=L_(e.original,r,e.handle);if(e.labelDrag&&(s.type===`arrow`||s.type===`line`))return T_(s,t,e.grabOffset??{x:0,y:0},a);if((s.type===`line`||s.type===`polygon`)&&e.lineVertex!=null)return z_(s,e.lineVertex,t,n,r,i,a);if(s.type===`arrow`)return x_(s,e,t,n,r,a,o);let c=an(s)*Math.PI/180,l=rn(s),u=e.grabOffset??{x:0,y:0},d={x:t.x-u.x,y:t.y-u.y},f;if(!c&&!n.shift&&!n.alt&&!n.noSnap){let t=j_(e.handle),n=M_(s),r=t.hasX&&n.x,o=t.hasY&&n.y;if(r||o){let e=jg(d,i(new Set([s.id])),a);d={x:r?e.point.x:d.x,y:o?e.point.y:d.y},f=e.guides.filter(e=>e.axis===`x`&&r||e.axis===`y`&&o)}}let p=Lt(t,l,-c),m=c?{x:p.x-u.x,y:p.y-u.y}:d;if(n.alt&&(s.type===`rectangle`||s.type===`image`))return{shape:B_(s,e,m,l,n)};let h=U_(s,e,m,n);return h?{shape:c?P_(h,e.handle,l,c):h,guides:f}:null}function z_(e,t,n,r,i,a,o){let s=n,c=null,l;if(r.shift){let r=e.points[t-1]??e.points[t+1];r&&(s=Vg(r,n,Fg))}else{if(!r.alt){let r=e.points.filter((e,n)=>n!==t),a=lf(n,i,o/6*10,e.id,r);a&&(s=a.point,c=a.point)}if(!c&&!r.noSnap){let t=jg(n,a(new Set([e.id])),o);s=t.point,l=t.guides}}return{shape:{...e,points:e.points.map((e,n)=>n===t?s:e)},guides:l,snapDot:c}}function B_(e,t,n,r,i){let a=W(e),{hasX:o,hasY:s}=j_(t.handle),c=o?Math.abs(n.x-r.x):a.width/2,l=s?Math.abs(n.y-r.y):a.height/2;if(e.type===`image`||i.shift&&o&&s){let e=(a.width||1)/(a.height||1);o&&s?c/e>=l?l=c/e:c=l*e:o?l=c/e:c=l*e}return{...e,x:r.x-c,y:r.y-l,width:c*2,height:l*2}}function V_(e,t,n,r){let i=(e.width||1)/(e.height||1),a=j_(t);if(a.hasX&&a.hasY){let r=N_(e,t),a=Kn(t),o=Math.max(D_,Nn(n.x,r.x,a.x)/(e.width||1),Nn(n.y,r.y,a.y)/(e.height||1)),s=(e.width||1)*o,c=s/i;return{x:a.x===1?r.x:r.x-s,y:a.y===1?r.y:r.y-c,width:s,height:c}}let o=Fn(e,t,n,r);if(a.hasX){let t=o.width,n=t/i;return{x:o.x,y:e.y+e.height/2-n/2,width:t,height:n}}let s=o.height,c=s*i;return{x:e.x+e.width/2-c/2,y:o.y,width:c,height:s}}function H_(e,t,n,r){let i=t.iconFootprint??W(e),a=W(e),{hasX:o,hasY:s}=j_(t.handle),c;if(r.alt){let e=i.x+i.width/2,t=i.y+i.height/2,r=Math.abs(n.x-e)*2/i.width,a=Math.abs(n.y-t)*2/i.height;c=o&&s?Math.max(r,a):o?r:a}else{let e=N_(i,t.handle),r=Kn(t.handle),a=Nn(n.x,e.x,r.x)/i.width,l=Nn(n.y,e.y,r.y)/i.height;c=o&&s?Math.max(a,l):o?a:l}let l=Math.max(a.width,a.height),u=Math.max(O_,l*c),d=l?u/l:1,f=i.width*d,p=i.height*d,m,h;if(r.alt)m=i.x+i.width/2-f/2,h=i.y+i.height/2-p/2;else{let e=N_(i,t.handle);m=o?t.handle.includes(`w`)?e.x-f:e.x:i.x+i.width/2-f/2,h=s?t.handle.includes(`n`)?e.y-p:e.y:i.y+i.height/2-p/2}return{...e,x:m+(a.x-i.x)*d,y:h+(a.y-i.y)*d,width:a.width*d,height:a.height*d,fontSize:Math.max(6,Math.round((e.fontSize??36)*d))}}function U_(e,t,n,r){if(e.type===`image`)return{...e,...V_(W(e),t.handle,n)};if(e.type===`rectangle`){let i=j_(t.handle);return r.shift&&i.hasX&&i.hasY?{...e,...V_(W(e),t.handle,n)}:{...e,...Fn(W(e),t.handle,n,{height:e.minHeight??0})}}if(e.type===`icon`)return H_(e,t,n,r);if(e.type===`web`){let i=j_(t.handle),a=e.keepAspect===!0||r.shift&&i.hasX&&i.hasY,o=W(e);return{...e,...a?V_(o,t.handle,n,k_):Fn(o,t.handle,n,k_)}}if(e.type===`figure`)return{...e,...Fn(W(e),t.handle,n)};if(e.type===`table`){let r=W(e),i=Fn(r,t.handle,n),a=r.width?i.width/r.width:1;return{...e,x:i.x,colWidths:e.colWidths.map(e=>Math.max(A_,e*a))}}if(e.type===`chart`){let r=$g(e)??{width:360,height:240};return{...e,...Fn(W(e),t.handle,n,r)}}if(e.type===`control`){let r=W(e),i=yi[e.kind];if(i.resize===`aspect`)return{...e,...V_(r,t.handle,n,{width:24,height:24})};let a=i.resize===`free`?$g(e)??{width:24,height:16}:{width:24,height:16},o=Fn(r,t.handle,n,a);return i.resize===`width`?{...e,x:o.x,y:r.y,width:o.width,height:r.height}:i.resize===`height`?{...e,x:r.x,y:o.y,width:r.width,height:o.height}:e.kind===`lifeline`&&j_(t.handle).hasX?{...e,...o,widthManual:!0}:{...e,...o}}if(e.type===`draw`||e.type===`polygon`||e.type===`line`){let r=W(e),i=Fn(r,t.handle,n),a=r.width?i.width/r.width:1,o=r.height?i.height/r.height:1;return{...e,points:e.points.map(e=>({x:i.x+(e.x-r.x)*a,y:i.y+(e.y-r.y)*o}))}}return e.type===`text`&&t.textStart?Sn(e,t.handle,n,t.textStart,r.alt):null}function W_(e,t,n,r,i){let a=e.startBounds,{hasX:o,hasY:s}=j_(e.handle),c=e.grabOffset??{x:0,y:0},l=e.frame,u=l?f_(t,l):t,d={x:u.x-c.x,y:u.y-c.y},f;if(!l&&!n.shift&&!n.noSnap){let t=new Set(e.originals.map(e=>e.id)),n=jg(d,r(t),i);d={x:o?n.point.x:d.x,y:s?n.point.y:d.y},f=n.guides.filter(e=>e.axis===`x`&&o||e.axis===`y`&&s)}let p=e.handle.includes(`w`)?a.x+a.width:a.x,m=e.handle.includes(`n`)?a.y+a.height:a.y,h=Kn(e.handle),g=o&&a.width?Math.max(D_,Nn(d.x,p,h.x)/a.width):1,_=s&&a.height?Math.max(D_,Nn(d.y,m,h.y)/a.height):1;if(n.shift&&o&&s){let e=Math.max(g,_);g=e,_=e}let v={x:p,y:m};return{shapes:e.originals.map(e=>l?p_(e,l,v,g,_):gr(e,v,g,_)),guides:f}}function G_(e,t,n,r,i,a){let o=e.type===`icon`?cn(e,a):null;return{kind:`resize`,handle:t,original:e,rect:r,textStart:i,iconFootprint:o,grabOffset:Lg(e,t,n,i,o)}}function K_(e,t,n){let r=E_(e);return{kind:`resize`,handle:`bend`,original:e,rect:n,textStart:null,iconFootprint:null,labelDrag:!0,grabOffset:{x:t.x-r.x,y:t.y-r.y}}}function q_(e,t,n){return{kind:`resize`,handle:`bend`,original:e,rect:n,textStart:null,iconFootprint:null,lineVertex:t}}function J_(e,t,n){return{kind:`resize`,handle:`bend`,original:e,rect:n,textStart:null,iconFootprint:null,elbowSegment:t,elbowBase:Wn(e)}}function Y_(e,t,n,r){let i=W(e,r);return{kind:`crop`,original:e,handle:t,imageBox:Un(i,e.crop),startBounds:i,rect:n}}function X_(e,t,n,r,i){let a=sa(e.shapes,e.selectedIds),o=v_(e),s=o===null?null:d_(a,o,i),c=s?.bounds??Bt(a,i);if(!c)return null;let l=s?{pivot:{x:c.x+c.width/2,y:c.y+c.height/2},angle:s.angle}:void 0,u=l?f_(n,l):n,d=Ig(c,t);return{kind:`group-resize`,handle:t,originals:a,startBounds:c,rect:r,grabOffset:{x:u.x-d.x,y:u.y-d.y},frame:l}}function Z_(e,t,n,r){let i=sa(e.shapes,e.selectedIds),a=v_(e),o=a===null?null:d_(i,a,r),s=o?{x:o.bounds.x+o.bounds.width/2,y:o.bounds.y+o.bounds.height/2}:Kg(i,r);return s?{kind:`rotate`,originals:i,center:s,startAngle:Math.atan2(t.y-s.y,t.x-s.x),rect:n,frameAngle:a??0}:null}var Q_={move(e,t,n){let r=t.getState(),{world:i,mods:a}=m_(e,r,n);r.setTransforming(!0),e.turned=qg(e,i,a),__(t,Jg(e,i,a))}},$_={move(e,t,n){let{world:r,mods:i}=m_(e,t.getState(),n);__(t,I_(e,r,i))}},ev={move(e,t,n){let r=t.getState(),{world:i,mods:a,snapDist:o}=m_(e,r,n);r.setTransforming(!0),r.setResizing(!0);let s=R_(e,i,a,r.shapes,t.snapTargets,o,t.measurement);s&&__(t,s)}},tv={move(e,t,n){let r=t.getState(),{world:i,mods:a,snapDist:o}=m_(e,r,n);r.setTransforming(!0),__(t,W_(e,i,a,t.snapTargets,o))}};function nv(e,t){return Bg({x:t.x+8,y:t.y+8,width:t.width-16,height:t.height-16},e)}function rv(e){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x+e.width,y:e.y+e.height},{x:e.x,y:e.y+e.height}]}function iv(e,t){for(let n of[e,t])for(let r=0;r<n.length;r+=1){let i=n[r],a=n[(r+1)%n.length],o={x:a.y-i.y,y:i.x-a.x},s=e=>e.x*o.x+e.y*o.y,c=e.map(s),l=t.map(s);if(Math.max(...c)<Math.min(...l)||Math.max(...l)<Math.min(...c))return!1}return!0}function av(e,t){let n=aa(e,t);return{local:n.footprint,polygon:rv(n.footprint).map(n.toWorld),toLocal:e=>rv(e).map(n.toLocal)}}function ov(e,t,n){let r=av(e,n);if(!iv(r.polygon,rv(t)))return!1;if(!_n(e))return!0;let i=r.toLocal(t),a=i.map(e=>e.x),o=i.map(e=>e.y);return!nv({x:Math.min(...a),y:Math.min(...o),width:Math.max(...a)-Math.min(...a),height:Math.max(...o)-Math.min(...o)},r.local)}function sv(e,t,n,r,i){let a=new Set(n);for(let n of e){let e=cn(n,i),r;r=n.type===`figure`?Bg(t,e):yu(n)?Ze(ut(e,Cu(n)+1),t)&&wu(n,t):an(n)?ot(e,t)&&ov(n,t,i):_n(n)?ot(e,t)&&!nv(t,e):ot(e,t),r&&!n.locked&&a.add(n.id)}return Up(e,a,r)}function cv(e,t){if(t.length<3)return!1;let n=!1;for(let r=0,i=t.length-1;r<t.length;i=r,r+=1){let a=t[r],o=t[i];a.y>e.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(n=!n)}return n}function lv(e,t){return[{x:e.x,y:e.y},{x:e.x+e.width,y:e.y},{x:e.x,y:e.y+e.height},{x:e.x+e.width,y:e.y+e.height}].every(e=>cv(e,t))}function uv(e){return Ge(e)}var dv=192;function fv(e){return Math.max(1,Math.ceil((e-1)/dv))}function pv(e,t){let n=fv(e.length);for(let r=0;r<e.length;r+=n)if(cv(e[r],t))return!0;for(let r=0;r+n<e.length;r+=n)for(let i=0,a=t.length-1;i<t.length;a=i,i+=1)if(Et(e[r],e[r+n],t[a],t[i]))return!0;return!1}function mv(e,t,n,r){let i=new Set(n);if(t.length>=3){let n=uv(t);for(let r of e){if(r.locked)continue;let e;if(r.type===`figure`){let i=cn(r);e=hv(i,n)&&lv(i,t)}else if(yu(r)){let i=Ze(cn(r),n)?xu(r):null;e=i!==null&&pv(i,t)}else{let i=rn(r);e=dt(i,n)&&cv(i,t)}e&&i.add(r.id)}}return Up(e,i,r)}function hv(e,t){return e.x>=t.x&&e.y>=t.y&&e.x+e.width<=t.x+t.width&&e.y+e.height<=t.y+t.height}var gv={move(e,t,n){let r=t.getState(),{world:i}=m_(e,r,n);r.setMarquee({start:e.startWorld,end:i});let a=zg(e.startWorld,i),o=r.viewport.zoom;(a.width*o>4||a.height*o>4)&&(t.moved.current=!0),r.setSelectedIds(sv(r.shapes,a,e.base,r.activeGroupId,t.measurement))}},_v={move(e,t,n){let r=t.getState(),{world:i}=m_(e,r,n);e.points.push(i),r.setLasso([...e.points]),r.setSelectedIds(mv(r.shapes,e.points,e.base,r.activeGroupId))},end(e,t){t.getState().releaseTool()}},vv=new WeakMap;function yv(e,t){let n=vv.get(e);if(n)return n;let r=new Map(e.map(e=>[e.id,e])),i=new Set(r.keys()),a={movingIds:i,originalById:r,sliderIds:new Set(e.filter(e=>Me(e,i)).map(e=>e.id)),rigidIds:ze(e),base:Bt(e,t)};return vv.set(e,a),a}function bv(e,t,n,r,i){let{movingIds:a,originalById:o}=yv(e,i),{position:s,dependents:c}=Yr(t),l=[],u=new Set,d=new Map,f=e=>{let n=s.get(e),r=n===void 0?void 0:t[n],i=o.get(e)??r;i&&d.set(e,i)};for(let e of a)for(let n of c.get(e)??[]){if(u.has(n))continue;u.add(n);let e=s.get(n),r=e===void 0?void 0:t[e],i=o.get(n)??r;if(i?.type!==`arrow`||!i.startBinding||!i.endBinding)continue;let c=a.has(i.startBinding.shapeId);c!==a.has(i.endBinding.shapeId)&&(l.push({arrow:i,startMoving:c,at:e??-1}),f(i.startBinding.shapeId),f(i.endBinding.shapeId))}l.sort((e,t)=>e.at-t.at);let p=null,m=null;for(let{arrow:e,startMoving:a}of l){let o=Ie(e,t,d,i),s=a?o.start:o.end,c=a?o.end:o.start,l={x:s.x+n.x,y:s.y+n.y},u=c.x-l.x,f=c.y-l.y;Math.abs(f)<=Math.abs(u)?Math.abs(f)<=r&&(!m||Math.abs(f)<Math.abs(m.adjust))&&(m={adjust:f,fixed:c,moving:l}):Math.abs(u)<=r&&(!p||Math.abs(u)<Math.abs(p.adjust))&&(p={adjust:u,fixed:c,moving:l})}let h=[],g=p?p.adjust:0,_=m?m.adjust:0;if(m){let e=m.moving.x+g;h.push({axis:`y`,pos:m.fixed.y,start:Math.min(m.fixed.x,e),end:Math.max(m.fixed.x,e)})}if(p){let e=p.moving.y+_;h.push({axis:`x`,pos:p.fixed.x,start:Math.min(p.fixed.y,e),end:Math.max(p.fixed.y,e)})}return{dx:g,dy:_,snappedX:p!==null,snappedY:m!==null,guides:h}}function xv(e,t,n,r,i){let a=Math.abs(e.y2-e.y)<=Math.abs(e.x2-e.x),o=e=>a?(e.y+e.y2)/2:(e.x+e.x2)/2,s=o(e)+(a?t.y:t.x),c=n.filter(t=>t.id!==e.id&&t.type===`arrow`&&Me(t,r)&&Math.abs(t.y2-t.y)<=Math.abs(t.x2-t.x)===a).map(o).sort((e,t)=>e-t);if(c.length===0)return{delta:t,guide:null};let l=[...c];for(let e=0;e<c.length-1;e+=1)l.push((c[e]+c[e+1])/2);let u=null,d=i;for(let e of l){let t=Math.abs(s-e);t<=d&&(u=e,d=t)}if(u===null)return{delta:t,guide:null};let f=u-s;return{delta:a?{x:t.x,y:t.y+f}:{x:t.x+f,y:t.y},guide:a?{axis:`y`,pos:u,start:Math.min(e.x,e.x2),end:Math.max(e.x,e.x2)}:{axis:`x`,pos:u,start:Math.min(e.y,e.y2),end:Math.max(e.y,e.y2)}}}function Sv(e,t,n,r,i,a=[],o){let s={x:t.x-e.startWorld.x,y:t.y-e.startWorld.y},c=Math.abs(s.x)>.01||Math.abs(s.y)>.01,{movingIds:l,sliderIds:u,rigidIds:d,base:f}=yv(e.originals,o),p=u.size>0&&u.size===e.originals.length,m;if(n.shift)Math.abs(s.x)>Math.abs(s.y)?s.y=0:s.x=0;else if(!n.noSnap&&!p){let t=[],n=bv(e.originals,a,s,i,o);s.x+=n.dx,s.y+=n.dy,t.push(...n.guides);let c=n.snappedX,u=n.snappedY,d=r(l);if(f&&d.length>0){let e=()=>({x:f.x+s.x,y:f.y+s.y,width:f.width,height:f.height}),n=Pg(e(),d,i),r=!c&&n.snappedX,a=!u&&n.snappedY;r&&(s.x+=n.dx,c=!0),a&&(s.y+=n.dy,u=!0);for(let e of n.guides)e.axis===`x`&&r&&t.push(e),e.axis===`y`&&a&&t.push(e);let o=Ag(e(),d,i);c||(s.x+=o.dx),u||(s.y+=o.dy);for(let e of o.guides)e.axis===`x`&&!c&&t.push(e),e.axis===`y`&&!u&&t.push(e)}m=t.length>0?t:void 0}else if(!n.shift&&!n.noSnap&&p&&e.originals.length===1){let t=xv(e.originals[0],s,a,l,i);s.x=t.delta.x,s.y=t.delta.y,m=t.guide?[t.guide]:void 0}return{shapes:e.originals.map(e=>Ne(e,s,a,l,o)),guides:m,moved:c,rigidIds:d}}var Cv={pan:xg,erase:Yg,draw:b_,rotate:Q_,crop:$_,resize:ev,"group-resize":tv,marquee:gv,lasso:_v,move:{move(e,t,n){let r=t.getState(),{world:i,mods:a,snapDist:o}=m_(e,r,n);if(!e.armed){let t=r.viewport.zoom,n=(i.x-e.startWorld.x)*t,a=(i.y-e.startWorld.y)*t;if(Math.hypot(n,a)<=(e.slop??3))return;if(e.armed=!0,e.duplicated){let t=sr(e.originals,{x:0,y:0});r.addMany(t),r.setSelectedIds(new Set(t.map(e=>e.id))),e.originals=t}}r.setDragging(!0),r.setTransforming(!0);let s=Sv(e,i,a,t.snapTargets,o,t.getState().shapes,t.measurement);s.moved&&(t.moved.current=!0),s.guides&&r.setSnapGuides(s.guides),g_(t,s.shapes,s.rigidIds)},end(e,t){if(!t.moved.current)return;let n=new Set(e.originals.map(e=>e.id)),r=Bt(e.originals,t.measurement),i=Bt(t.getState().shapes.filter(e=>n.has(e.id)),t.measurement);if(!r||!i)return;let a={x:i.x-r.x,y:i.y-r.y};if(e.duplicated){mh([...n],a);return}hh(n,a)}}};function wv(e){return Cv[e.kind]}function Tv(e,t,n){let r=new Set(e);for(let e of t)n?r.delete(e):r.add(e);return r}function Ev(e,t){let n=(0,J.useRef)(e);return n.current!==e&&!t(n.current,e)&&(n.current=e),n.current}function Dv(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ov(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>Object.is(e[n],t[n]))}function kv(e,t){let n=Cr({x:0,y:0},t);return{x:n.x,y:n.y,width:e.width/t.zoom,height:e.height/t.zoom}}function Av(e){let{writeDraft:t,cancelGesture:n,eraserTrailRef:r}=e,{gestureRef:i,draftRef:a,movedRef:o,pendingToggleRef:s,pendingDrillRef:c,pendingWebRef:l,recentDrillRef:u,suppressNextMenuRef:d}=e.refs,f=V(),p=f.store,{endTransaction:m,remoteEditsDuringGesture:h}=f.history,g=f.popupGuard;(0,J.useEffect)(()=>{let e=null,_=t=>{let n=i.current,{shapes:r,viewport:a}=p.getState();if(n&&e?.gesture===n&&e.viewport===a&&Dv(e.excludeIds,t))return e.bounds;let o=n&&`rect`in n?kv(n.rect,a):null,s=o&&ut(o,Math.max(o.width,o.height)/2),c=[];for(let e of r){if(t.has(e.id)||e.type===`arrow`||s&&!Ze(pr(e),s))continue;let n=cn(e,f.measurement);(!o||Ze(n,o))&&c.push(n)}return n&&(e={gesture:n,excludeIds:t,viewport:a,bounds:c}),c};function v(e){if(i.current){if(e.pointerType!==`touch`&&e.buttons===0){S(e);return}b(e)}}let y={getState:p.getState,measurement:f.measurement,snapTargets:_,draft:a,writeDraft:t,moved:o,eraserTrail:{move:e=>r.current.move(e),end:()=>r.current.end()},remoteEdits:h,suppressNextMenu:d};function b(e){let t=i.current;t&&(t.kind!==`pan`&&t.kind!==`erase`&&p.getState().clearSnapGuides(),wv(t).move(t,y,e))}function x(e,t){let n=s.current;s.current=null,n&&!o.current&&n.wasSelected&&e.setSelectedIds(Tv(e.selectedIds,n.ids,!0));let r=c.current;c.current=null,r&&!o.current&&(e.setSelectedIds(new Set([r.id])),e.setActiveGroupId(r.groupId),u.current=r.id);let i=l.current;l.current=null,i&&mg(cg(),e,i,t,o.current)}function S(e){let t=i.current;i.current=null;let n=p.getState();if(!t){x(n,e),m();return}y_(n,t),n.resetGestureVisuals(),x(n,e),wv(t).end?.(t,y,e),m()}function C(e){if(i.current){if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),n();return}(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`z`&&n()}}function w(){if(l.current=null,!i.current){m();return}n()}function T(){i.current&&n()}window.addEventListener(`pointermove`,v),window.addEventListener(`pointerup`,S),window.addEventListener(`pointercancel`,w),window.addEventListener(`keydown`,C,!0);let E=Vi(T),D=g.install();return()=>{window.removeEventListener(`pointermove`,v),window.removeEventListener(`pointerup`,S),window.removeEventListener(`pointercancel`,w),window.removeEventListener(`keydown`,C,!0),E(),D()}},[t,n,p,m,h,g,f.measurement,r,i,a,o,s,c,l,u,d])}function jv(e){return e.metaKey||e.ctrlKey}function Mv(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!(!_n(r)||r.locked)&&ia(r,t))return r}return null}function Nv(e,t){let n=aa(t);return e.some(e=>e.id===t.id||e.locked||Pv(e,t)?!1:dt(n.toLocal(rn(e)),n.body))}function Pv(e,t){let n=W(e),r=W(t);return n.x<=r.x&&n.y<=r.y&&n.x+n.width>=r.x+r.width&&n.y+n.height>=r.y+r.height}function Fv(e){let t=document.querySelector(zi(e));return t instanceof HTMLElement?{width:t.offsetWidth,height:t.offsetHeight}:null}function Iv(e){return e.target instanceof Element&&!!e.target.closest(`[data-overlay]`)}function Lv(e,t){let n=e.button===0?1:e.button===1?4:2;return t&&(e.buttons&~n)!==0?!1:e.button===0||e.button===1||e.button===2}var Rv=(e,t)=>{let{event:n,state:r}=e;return!e.panMode&&n.button!==1&&n.button!==2?!1:(n.button!==2&&t.setIsPanning(!0),t.gestureRef.current={kind:`pan`,startX:n.clientX,startY:n.clientY,viewportX:r.viewport.x,viewportY:r.viewport.y,button:n.button,moved:!1,menuSwallowed:!1},!0)},zv=(e,t)=>e.state.tool===`comment`?(e.event.preventDefault(),t.gestureRef.current=null,!0):!1,Bv=(e,t)=>{let{event:n,state:r,world:i,rect:a}=e;if(!r.viewMode)return!1;let{shapes:o,selectedIds:s}=r;r.setLockRevealId(null);let c=n.shiftKey,l=jv(n)?null:Mv(o,i);if(l&&!Nv(o,l)){let e=Up(o,[l.id],r.activeGroupId);if(c){let t=s.has(l.id);return r.setSelectedIds(Tv(s,e,t)),!0}return r.setSelectedIds(e),!0}let u=c?s:new Set;return c||(r.setSelectedIds(new Set),r.setActiveGroupId(null)),t.gestureRef.current={kind:`marquee`,startWorld:i,rect:a,base:u},t.setMarquee({start:i,end:i}),!0},Vv=(e,t)=>{let{event:n,state:r,world:i,rect:a}=e;if(r.tool!==`eraser`)return!1;let o=new Set,s=5/r.viewport.zoom;for(let e of r.shapes)!e.locked&&wg(e,i,i,s,t.measurement)&&o.add(e.id);return t.gestureRef.current={kind:`erase`,rect:a,last:i,ids:o},r.setErasingIds(new Set(o)),t.eraserTrailRef.current.start({x:n.clientX,y:n.clientY}),!0},Hv=(e,t)=>{let{event:n,state:r,world:i,rect:a}=e;if(r.tool!==`lasso`)return!1;let o=n.shiftKey?new Set(r.selectedIds):new Set;return t.gestureRef.current={kind:`lasso`,points:[i],rect:a,base:o},t.setLasso([i]),t.movedRef.current=!0,!0};function Uv(e,t,n){t.writeDraft(n),t.gestureRef.current={kind:`draw`,startWorld:e.world,rect:e.rect}}var Wv=[Rv,zv,Bv,Vv,Hv,(e,t)=>{let{state:n,world:r}=e,{pendingControl:i,pendingIcon:a,style:o}=n;return i?i===`heading`?(n.setPendingControl(null),n.placeShape(gu(r,o,{text:`Heading`,fontSize:26,width:240}),{edit:!0}),!0):(Uv(e,t,uf(r,o,i)),!0):a?(Uv(e,t,df(r,o,a)),!0):!1},(e,t)=>{let{event:n,state:r,world:i}=e,a=yf[r.tool];return a?(Uv(e,t,a({world:i,style:r.style,shapeKind:r.shapeKind,frameKind:r.frameKind,chartKind:r.chartKind,shapes:r.shapes,zoom:r.viewport.zoom,alt:n.altKey,measurement:t.measurement})),!0):!1},(e,t)=>{let{event:n,state:r,world:i}=e,a=bf[r.tool];if(!a)return!1;a.edit&&n.preventDefault(),t.gestureRef.current=null;let o=a.build(i,r.style),s=()=>r.placeShape(o,{edit:a.edit});return a.untracked?t.runWithoutHistory(s):s(),!0},(e,t)=>{let{event:n,state:r,world:i}=e;return r.tool!==`polyline`&&r.tool!==`polygon`?!1:(t.handlePolylinePress(i,n,r.shapes,r.viewport.zoom),!0)},(e,t)=>{let{event:n,state:r,world:i,rect:a}=e,{selectedIds:o,shapes:s}=r;if(n.shiftKey||jv(n)||o.size===0)return!1;let c=s.filter(e=>o.has(e.id)),l=Eu(c)?null:Bt(c,t.measurement);return!l||!dt(i,l)?!1:(t.startMove(c,i,a,n.altKey),!0)},(e,t)=>{let{event:n,state:r,world:i,rect:a}=e,{selectedIds:o,shapes:s}=r;r.setLockRevealId(null);let c=n.shiftKey,l=c?o:new Set,u=jv(n)?null:Mv(s,i);if(u&&!Nv(s,u)){let e=Up(s,[u.id],r.activeGroupId);if(c){let c=o.has(u.id),l=Tv(o,e,!1);return r.setSelectedIds(l),t.pendingToggleRef.current={ids:e,wasSelected:c},t.startMove(s.filter(e=>l.has(e.id)),i,a,n.altKey),!0}return r.activeGroupId&&u.groupId!==r.activeGroupId&&r.setActiveGroupId(null),r.setSelectedIds(e),t.startMove(s.filter(t=>e.has(t.id)),i,a,n.altKey),!0}return c||(r.setSelectedIds(new Set),r.setActiveGroupId(null)),t.gestureRef.current={kind:`marquee`,startWorld:i,rect:a,base:l},t.setMarquee({start:i,end:i}),!0}];function Gv(e,t){for(let n of Wv)if(n(e,t))return}function Kv(e){let{setSnapDot:t}=e,n=U(),r=(0,J.useRef)(null),i=(0,J.useCallback)(e=>{r.current=e,n.getState().setPolyDraft(e)},[n]);return{commitPolyline:(0,J.useCallback)((e=!0)=>{let t=r.current;if(!t)return;i(null);let a=Er(t.points),o=n.getState(),s=o.style,c=t.closed;if(a.length<(c?3:2))return;let l=c?{id:Yn(),type:`polygon`,points:a,fill:s.fill,color:s.color,strokeWidth:s.strokeWidth,opacity:s.opacity}:{id:Yn(),type:`line`,points:a,...gf(s)};o.addShape(l),e&&(o.setSelectedIds(new Set([l.id])),o.releaseTool())},[i,n]),removeLastPolylinePoint:(0,J.useCallback)(()=>{let e=r.current;if(!e)return;let t=e.points.slice(0,-1);i(t.length>0?{...e,points:t}:null)},[i]),cancelPolyline:(0,J.useCallback)(()=>{i(null)},[i]),handlePolylinePress:(0,J.useCallback)((e,t,a,o)=>{let s=r.current,c=s?.closed??n.getState().tool===`polygon`,l=e;t.altKey||(l=lf(e,a,10/o,void 0,s?.points.slice(0,-1))?.point??e),i({points:s?[...s.points,l]:[l],cursor:l,closed:c})},[i,n]),handlePolylineHover:(0,J.useCallback)((e,n,a,o)=>{let s=r.current,c=e,l=null;if(!n.altKey){let t=lf(e,a,10/o,void 0,s?.points.slice(0,-1));t&&(c=t.point,l=t.point)}t(l),s&&i({...s,cursor:c})},[t,i])}}function qv(e){let{containerRef:t,panMode:n,pinchingRef:r}=e,i=H(e=>e.tool),a=V(),o=a.store,{beginTransaction:s,endTransaction:c,runWithoutHistory:l}=a.history,u=a.popupGuard,d=Pc(),f=bg(),p=(0,J.useRef)(f);p.current=f;let{setDraft:m,setIsPanning:h,setMarquee:g,setLasso:_,setBindTarget:v,setSnapDot:y,setHoverWorld:b}=o.getState(),x=(0,J.useRef)(null),S=(0,J.useRef)(null),C=(0,J.useRef)(!1),w=(0,J.useRef)(null),T=(0,J.useRef)(null),E=(0,J.useRef)(null),D=(0,J.useRef)(null),O=(0,J.useRef)(!1),k=(0,J.useCallback)(e=>{S.current=e,m(e)},[m]),{commitPolyline:A,removeLastPolylinePoint:j,cancelPolyline:ee,handlePolylinePress:M,handlePolylineHover:N}=Kv({setSnapDot:y}),P=(0,J.useCallback)(()=>{let e=x.current;x.current=null,e?.kind===`erase`&&(o.getState().setErasingIds(new Set),p.current.end()),e&&y_(o.getState(),e),k(null),C.current=!1,w.current=null,T.current=null,E.current=null,o.getState().resetGestureVisuals(),c()},[k,o,c]);(0,J.useEffect)(()=>{b(null),v(null),y(null),i!==`polyline`&&i!==`polygon`&&A(!1)},[i,A,b,v,y]);let F=(0,J.useCallback)((e,t,n,r,i)=>{C.current=!1;let s=o.getState(),c=km(s.shapes,e,{activeGroupId:s.activeGroupId,measurement:a.measurement});c.length!==0&&(v_(s),x.current={kind:`move`,startWorld:t,originals:c,rect:n,duplicated:r,slop:i})},[o,a.measurement]);Av({writeDraft:k,cancelGesture:P,eraserTrailRef:p,refs:{gestureRef:x,draftRef:S,movedRef:C,pendingToggleRef:w,pendingDrillRef:T,pendingWebRef:E,recentDrillRef:D,suppressNextMenuRef:O}});let I=(0,J.useCallback)(e=>{let t=x.current;return t?.kind===`pan`&&t.button===2?(t.menuSwallowed=!0,e.preventDefault(),e.stopPropagation(),!0):O.current?(O.current=!1,e.preventDefault(),e.stopPropagation(),!0):!1},[]),te=(0,J.useCallback)(e=>{if(Iv(e))return;O.current=!1;let i=t.current;if(!i||r.current||!Lv(e,x.current)||u.openAtEvent())return;let c=o.getState(),d=i.getBoundingClientRect();b(null),De(c.editSession)&&c.endEdit(),s(),Gv({event:e,state:c,world:Cr({x:e.clientX-d.left,y:e.clientY-d.top},c.viewport),rect:d,panMode:n},{gestureRef:x,movedRef:C,pendingToggleRef:w,eraserTrailRef:p,writeDraft:k,startMove:F,handlePolylinePress:M,runWithoutHistory:l,setIsPanning:h,setMarquee:g,setLasso:_,measurement:a.measurement})},[t,n,r,F,k,M,o,s,l,u,a.measurement,b,h,g,_]),ne=(0,J.useCallback)(e=>{if(x.current)return;let n=t.current;if(!n)return;let r=o.getState(),i=n.getBoundingClientRect(),s=Cr({x:e.clientX-i.left,y:e.clientY-i.top},r.viewport),{tool:c,pendingIcon:l,pendingControl:u,shapes:d}=r;if(c===`polyline`||c===`polygon`){N(s,e,d,r.viewport.zoom);return}if(c===`rectangle`||c===`chart`||c===`table`||c===`sticky`||c===`figure`||c===`comment`||l||u){b(s);return}if(c===`arrow`||c===`line`){let t=e.altKey?null:Pe(d,s,void 0,a.measurement);v(t?{id:t.id,point:He(t,s,a.measurement)}:null),y(t||e.altKey?null:lf(s,d,10/r.viewport.zoom)?.point??null)}},[t,N,o,b,v,y,a.measurement]),L=(0,J.useCallback)(()=>{b(null),v(null),y(null)},[b,v,y]),R=(0,J.useCallback)(e=>{let n=o.getState();if(n.tool!==`comment`||e.target instanceof Element&&e.target.closest(`[data-overlay]`))return;let r=t.current;if(!r)return;let i=r.getBoundingClientRect(),s=Cr({x:e.clientX-i.left,y:e.clientY-i.top},n.viewport);n.setCommentDraft(zm(n.shapes,s,a.measurement)),n.releaseTool(),b(null)},[t,o,a.measurement,b]),z=(0,J.useCallback)(e=>{let n=t.current;if(!n||r.current||e.button!==0)return null;e.stopPropagation();let i=o.getState(),a=n.getBoundingClientRect();return{store:i,rect:a,world:Cr({x:e.clientX-a.left,y:e.clientY-a.top},i.viewport)}},[t,r,o]),B=(0,J.useCallback)((e,t,n)=>{let r=z(e);if(!r)return;let i=t(r);i&&(s(),x.current=n(i,r))},[z,s]),re=(0,J.useCallback)((e,n)=>{if(jv(n)||o.getState().tool===`comment`)return;let r=z(n);if(!r)return;let{store:i,rect:a,world:c}=r,{shapes:l,selectedIds:u,activeGroupId:f}=i;D.current=null;let p=l.find(t=>t.id===e);if(p?.locked){i.setLockRevealId(p.id),i.setSelectedIds(new Set),i.setActiveGroupId(null),i.endEdit();return}if(i.setLockRevealId(null),i.editSession.kind===`interact`&&i.editSession.shapeId===e)return;let m=Up(l,[e],f);if(E.current=pg({shape:p,unit:m,world:c,event:n,env:d,started:i.startedWebIds.has(e),root:t.current,runtime:cg()}),i.viewMode){if(C.current=!1,n.shiftKey){let t=u.has(e);i.setSelectedIds(Tv(u,m,t));return}i.setSelectedIds(m);return}De(i.editSession)&&i.endEdit(),s();let h=E.current?4:void 0;if(n.shiftKey){let t=u.has(e),r=Tv(u,m,!1);i.setSelectedIds(r);let o=l.filter(e=>r.has(e.id));w.current={ids:m,wasSelected:t},F(o,c,a,n.altKey);return}let g=l.find(t=>t.id===e);f&&g?.groupId!==f&&i.setActiveGroupId(null);let _=[...m].every(e=>u.has(e));_&&!n.altKey&&g?.groupId&&g.groupId!==f&&(T.current={id:e,groupId:g.groupId});let v=_?u:m;_||i.setSelectedIds(v);let y=l.filter(e=>v.has(e.id));F(y,c,a,n.altKey,h)},[o,z,F,s,d,t]),ie=(0,J.useCallback)((e,t)=>{let n=z(t);if(!n)return;let{store:r,rect:i,world:a}=n,o=r.shapes.find(t=>t.id===e);!o||o.locked||r.viewMode||(s(),F([o],a,i,!1))},[z,s,F]),ae=(0,J.useCallback)((e,t,n)=>{B(n,({store:t})=>{let n=t.shapes.find(t=>t.id===e);return n&&!n.locked?n:null},(n,{rect:r,world:i})=>{let o=null;if(n.type===`text`){let t=Fv(e);t&&(o={box:{x:n.x,y:n.y,width:t.width,height:t.height},fontSize:n.fontSize,width:n.width,height:n.height})}return G_(n,t,i,r,o,a.measurement)})},[B,a.measurement]),oe=(0,J.useCallback)((e,t)=>{let n=o.getState(),r=n.shapes.find(t=>t.id===e);if(!r||r.type!==`arrow`&&r.type!==`line`||r.locked||n.viewMode||n.tool===`comment`||jv(t)||t.shiftKey||t.altKey||r.groupId!=null&&r.groupId!==n.activeGroupId){re(e,t);return}let i=z(t);if(!i)return;let{rect:a,world:c}=i;D.current=null,n.setLockRevealId(null),De(n.editSession)&&n.endEdit(),n.selectedIds.has(e)||n.setSelectedIds(new Set([e])),s(),x.current=K_(r,c,a)},[o,z,re,s]),se=(0,J.useCallback)((e,t,n)=>{B(n,({store:t})=>{let n=t.shapes.find(t=>t.id===e);return n?.type===`line`||n?.type===`polygon`?n:null},(e,{rect:n})=>q_(e,t,n))},[B]),ce=(0,J.useCallback)((e,t,n)=>{B(n,({store:t})=>{let n=t.shapes.find(t=>t.id===e);return n?.type===`arrow`&&!n.locked?n:null},(e,{rect:n})=>J_(e,t,n))},[B]),le=(0,J.useCallback)((e,t,n)=>{B(n,({store:t})=>{let n=t.shapes.find(t=>t.id===e);return n?.type===`image`?n:null},(e,{rect:n})=>Y_(e,t,n,a.measurement))},[B,a.measurement]),ue=(0,J.useCallback)((e,t)=>{B(t,({store:t,rect:n,world:r})=>X_(t,e,r,n,a.measurement),e=>e)},[B,a.measurement]),de=(0,J.useCallback)(e=>{B(e,({store:e,rect:t,world:n})=>Z_(e,n,t,a.measurement),e=>e)},[B,a.measurement]),fe=(0,J.useCallback)((e,t)=>{let n=z(t);if(!n)return;let{store:r,rect:i,world:a}=n,o=r.shapes.find(t=>t.id===e);if(!o||o.locked)return;let[c]=sr([o],{x:0,y:0});if(c.type!==`sticky`)return;let l={...c,text:``,height:180};s(),r.addShape(l),r.setSelectedIds(new Set([l.id])),F([l],a,i,!1)},[z,F,s]),pe=(0,J.useCallback)(e=>{if(r.current||o.getState().tool===`comment`)return;D.current=null;let t=zu(o.getState().shapes,e.clientX,e.clientY);if(t&&!t.locked){re(t.id,e);return}if(e.shiftKey||jv(e))return;let n=z(e);if(!n)return;let{store:i,rect:a,world:c}=n,l=i.shapes.filter(e=>i.selectedIds.has(e.id));l.length!==0&&(s(),F(l,c,a,e.altKey))},[r,z,re,F,o,s]),me=(0,J.useCallback)(e=>{if(x.current)return;let t=o.getState(),n=zu(t.shapes,e.clientX,e.clientY);t.setHoveredId(n&&!n.locked?n.id:null)},[o]),he=(0,J.useCallback)(()=>{o.getState().setHoveredId(null)},[o]);return{commitPolyline:A,removeLastPolylinePoint:j,cancelPolyline:ee,cancelGesture:P,onContainerPointerDown:te,onContainerPointerMove:ne,onContainerPointerLeave:L,onContainerClick:R,interceptContextMenu:I,onShapePointerDown:re,onLabelPointerDown:oe,onWebGripPointerDown:ie,selectionGestures:(0,J.useMemo)(()=>({onHandlePointerDown:ae,onLineVertexPointerDown:se,onElbowSegmentPointerDown:ce,onGroupHandlePointerDown:ue,onSelectionPointerDown:pe,onSelectionPointerMove:me,onSelectionPointerLeave:he,onRotateHandlePointerDown:de,onCropHandlePointerDown:le,onStickyDuplicatePointerDown:fe}),[ae,se,ce,ue,pe,me,he,de,le,fe]),recentDrillRef:D}}function Jv(){let e=!1;function t(t){!e||!t.isTrusted||(t.preventDefault(),t.stopImmediatePropagation(),t.type===`click`&&(e=!1))}return window.addEventListener(`mousedown`,t,{capture:!0}),window.addEventListener(`mouseup`,t,{capture:!0}),window.addEventListener(`click`,t,{capture:!0}),{arm:()=>{e=!0},release:()=>{e=!1},dispose:()=>{window.removeEventListener(`mousedown`,t,{capture:!0}),window.removeEventListener(`mouseup`,t,{capture:!0}),window.removeEventListener(`click`,t,{capture:!0})}}}var Yv=300,Xv=35;function Zv(e){(0,J.useEffect)(()=>{let t=null,n=0,r=Jv();function i(i){if(r.release(),i.pointerType!==`touch`||!i.isPrimary){t=null;return}let a=i.target instanceof Element?i.target:null;if(!a||!e.current?.contains(a)||a.closest(`[data-overlay]`)||Bo(a)){t=null;return}let o=performance.now();if(!(t&&o-t.time<=Yv&&Math.hypot(i.clientX-t.x,i.clientY-t.y)<=Xv)){t={time:o,x:i.clientX,y:i.clientY};return}t=null,i.preventDefault(),i.stopPropagation(),n=o+500,r.arm(),document.elementFromPoint(i.clientX,i.clientY)?.dispatchEvent(new MouseEvent(`dblclick`,{bubbles:!0,cancelable:!0,view:window,detail:2,clientX:i.clientX,clientY:i.clientY}))}function a(e){e.isTrusted&&performance.now()<n&&(e.preventDefault(),e.stopImmediatePropagation())}return window.addEventListener(`pointerdown`,i,{capture:!0}),window.addEventListener(`dblclick`,a,{capture:!0}),()=>{window.removeEventListener(`pointerdown`,i,{capture:!0}),window.removeEventListener(`dblclick`,a,{capture:!0}),r.dispose()}},[e])}var Qv=500,$v=10;function ey(e){return(e.tool===`select`||e.tool===`hand`)&&!e.pendingIcon&&!e.pendingControl&&!e.polyDraft&&!e.draft}function ty(e){let t=U();(0,J.useEffect)(()=>{let n=0,r=null,i=Jv(),a=()=>{window.clearTimeout(n),r=null};function o(){if(!r)return;let{x:e,y:t,pointerId:n}=r;r=null,i.arm(),window.dispatchEvent(new PointerEvent(`pointercancel`,{pointerId:n,pointerType:`touch`,isPrimary:!0,bubbles:!0,cancelable:!0,clientX:e,clientY:t})),document.elementFromPoint(e,t)?.dispatchEvent(new MouseEvent(`contextmenu`,{bubbles:!0,cancelable:!0,view:window,clientX:e,clientY:t}))}function s(s){if(i.release(),s.pointerType!==`touch`)return;if(!s.isPrimary){a();return}let c=s.target instanceof Element?s.target:null;if(!c||!e.current?.contains(c)||c.closest(`[data-overlay]`)||Bo(c)||t.getState().presentingIndex!==null||!ey(t.getState())){a();return}window.clearTimeout(n),r={x:s.clientX,y:s.clientY,pointerId:s.pointerId},n=window.setTimeout(o,Qv)}function c(e){!r||e.pointerId!==r.pointerId||Math.hypot(e.clientX-r.x,e.clientY-r.y)>$v&&a()}function l(e){r&&e.pointerId===r.pointerId&&a()}function u(t){let n=t.target instanceof Element?t.target:null;n&&e.current?.contains(n)&&t.stopPropagation()}return window.addEventListener(`pointerdown`,s,{capture:!0}),window.addEventListener(`pointermove`,c,{capture:!0}),window.addEventListener(`pointerup`,l,{capture:!0}),window.addEventListener(`pointercancel`,l,{capture:!0}),window.addEventListener(`touchstart`,u,{capture:!0}),()=>{a(),window.removeEventListener(`pointerdown`,s,{capture:!0}),window.removeEventListener(`pointermove`,c,{capture:!0}),window.removeEventListener(`pointerup`,l,{capture:!0}),window.removeEventListener(`pointercancel`,l,{capture:!0}),window.removeEventListener(`touchstart`,u,{capture:!0}),i.dispose()}},[e,t])}function ny(e,t){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function ry(e,t,n){let r=$e(e.a,e.b),i=$e(t,n),a=r===0?1:i/r,o=Ur(e.viewport.zoom*a),s=Cr(ny(e.a,e.b),e.viewport),c=ny(t,n);return{zoom:o,x:c.x-s.x*o,y:c.y-s.y*o}}function iy(e){let{containerRef:t,pinchingRef:n,onPinchStart:r}=e,i=U();(0,J.useEffect)(()=>{let e=t.current;if(!e)return;let a=new Map,o=null;function s(t){let n=e.getBoundingClientRect();return{x:t.clientX-n.left,y:t.clientY-n.top}}function c(){if(a.size<2)return null;let e=a.values();return[e.next().value,e.next().value]}function l(t){if(t.pointerType!==`touch`||i.getState().presentingIndex!==null)return;let l=t.target;if(!(!(l instanceof Node)||!e.contains(l))&&!(l instanceof Element&&l.closest(`[data-overlay]`))&&(a.set(t.pointerId,s(t)),a.size===2&&!n.current)){let e=c();e&&(n.current=!0,r(),o={a:e[0],b:e[1],viewport:i.getState().viewport})}}function u(e){if(e.pointerType!==`touch`||!a.has(e.pointerId)||(a.set(e.pointerId,s(e)),!o))return;let t=c();if(t){let e=i.getState(),n=ry(o,t[0],t[1]),r=n.zoom!==e.viewport.zoom;e.setViewport(n),r&&e.pulseZoomGesture()}}function d(e){e.pointerType===`touch`&&(a.delete(e.pointerId),a.size<2&&(o=null,n.current=!1))}function f(){a.clear(),o=null,n.current=!1}window.addEventListener(`pointerdown`,l,{capture:!0}),window.addEventListener(`pointermove`,u,{capture:!0}),window.addEventListener(`pointerup`,d,{capture:!0}),window.addEventListener(`pointercancel`,d,{capture:!0});let p=Vi(f);return()=>{window.removeEventListener(`pointerdown`,l,{capture:!0}),window.removeEventListener(`pointermove`,u,{capture:!0}),window.removeEventListener(`pointerup`,d,{capture:!0}),window.removeEventListener(`pointercancel`,d,{capture:!0}),p(),f()}},[t,n,r,i])}function ay(e,t,n){return Math.max(0,e+n-t)}function oy(e,t,n,r){return e-ay(t,n,r)}var sy=24;function cy(){let e=U();(0,J.useEffect)(()=>{let t=window.visualViewport;if(!t)return;let n=null;function r(){let r=t,i=e.getState(),a=i.editSession.kind!==`none`,o=document.querySelector(`[contenteditable="true"]`),s=r.offsetTop+r.height;if(!a||!(o instanceof HTMLElement)){if(n!==null){let e=n;n=null,i.setViewport(t=>({...t,y:e}))}return}let c=o.getBoundingClientRect();ay(c.bottom,s,sy)<=0||(n===null&&(n=i.viewport.y),i.setViewport(e=>({...e,y:oy(e.y,c.bottom,s,sy)})))}return t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r)}},[e])}function ly(e,t,n){return`${e}:${t}:${n}`}function uy(){let{store:e,history:t}=V(),{runWithoutHistory:n}=t,{updateShape:r}=e.getState(),i=(0,J.useRef)(new Map),a=(0,J.useCallback)((t,i)=>{let a=xr(e.getState().shapes,t);if(a?.type===`sticky`){let e=Math.max(180,i);Math.abs(e-a.height)>.5&&n(()=>r(t,{height:e}));return}if(!a||a.type!==`rectangle`)return;let o={};Math.abs((a.minHeight??0)-i)>.5&&(o.minHeight=i);let s=a.autoHeightFrom,c=s!==void 0&&Math.abs(a.height-Math.max(s,a.minHeight??0))<=.5;if(s!==void 0&&!c&&(o.autoHeightFrom=void 0),i>a.height+.5)o.height=i,c||(o.autoHeightFrom=a.height);else if(c&&s!==void 0){let e=Math.max(s,i);Math.abs(e-a.height)>.5&&(o.height=e),e<=s+.5&&(o.autoHeightFrom=void 0)}Object.keys(o).length>0&&n(()=>r(t,o))},[e,r,n]),o=(0,J.useCallback)((t,i)=>{let a=xr(e.getState().shapes,t);if(a?.type!==`control`||a.kind!==`lifeline`)return;let o=Math.max(60,i);if(!(a.widthManual&&a.width>=o-.5)&&Math.abs(o-a.width)>.5){let e=a.x+a.width/2-o/2;n(()=>r(t,{width:o,x:e}))}},[e,r,n]),s=(0,J.useCallback)(t=>{let a=e.getState(),o=xr(a.shapes,t);if(!o||o.type!==`table`)return;let s=i.current,c=a.editSession,l=c.kind===`table-cell`&&c.shapeId===t?c:null,u=Ka(o,(e,n)=>{if(!(!(l?.row===e&&l.col===n)&&!o.cells[e]?.[n]))return s.get(ly(t,e,n))});u.some((e,t)=>Math.abs(e-o.rowHeights[t])>.5)&&n(()=>r(t,{rowHeights:u}))},[e,r,n]);return{onMeasureLabel:a,onMeasureLifelineWidth:o,onMeasureCell:(0,J.useCallback)((e,t,n,r)=>{i.current.set(ly(e,t,n),r),s(e)},[s]),refitRows:s,remapCellHeights:(0,J.useCallback)((e,t,n,r)=>{let a=`${e}:`,o=new Map;for(let[s,c]of i.current){if(!s.startsWith(a)){o.set(s,c);continue}let[i,l]=s.slice(a.length).split(`:`).map(Number),u=t===`row`?i:l;if(u<n){o.set(s,c);continue}if(r<0&&u===n)continue;let d=u+r;o.set(t===`row`?ly(e,d,l):ly(e,i,d),c)}i.current=o},[])}}function dy(e){let{replaceShape:t,endEdit:n}=e,{refitRows:r,remapCellHeights:i}=e,{notify:a}=_(),o=U(),s=(0,J.useCallback)((e,i,a,s)=>{let c=xr(o.getState().shapes,e);if(!c||c.type!==`table`)return;let l=s.trim(),u=o.getState().editSession;if(u.kind===`table-cell`&&u.row===i&&u.col===a&&n(e),(c.cells[i]?.[a]??``)===l)return;let d=c.cells.map((e,t)=>t===i?e.map((e,t)=>t===a?l:e):e);t({...c,cells:d}),r(e)},[o,t,n,r]),c=(0,J.useCallback)((e,n)=>{let r=xr(o.getState().shapes,e);!r||r.type!==`chart`||t({...r,cells:n})},[o,t]),l=(0,J.useCallback)((e,n)=>{let r=o.getState().shapes.find(t=>t.id===e&&t.type===`table`);r&&t(n(r))},[o,t]),u=(0,J.useCallback)((e,t)=>l(e,n=>(i(e,`col`,t,1),no(n,t))),[l,i]),d=(0,J.useCallback)((e,t)=>l(e,n=>{let r=Qa(n,t);return r!==n&&i(e,`col`,t,-1),r}),[l,i]),f=(0,J.useCallback)((e,t)=>l(e,n=>(i(e,`row`,t,1),xo(n,t))),[l,i]),p=(0,J.useCallback)((e,t)=>l(e,n=>{let r=fo(n,t);return r!==n&&i(e,`row`,t,-1),r}),[l,i]),m=(0,J.useCallback)(e=>{let{shapes:t,selectedIds:n}=o.getState();return t.find(t=>t.type===e&&n.has(t.id))},[o]),h=(0,J.useCallback)(()=>{let e=m(`table`);e&&(navigator.clipboard?.writeText(Ya(e)),a(`Copied as CSV`))},[m,a]),g=(0,J.useCallback)(()=>{let e=m(`table`);if(!e)return;let n=Ro({x:e.x,y:e.y},{fontFamily:e.fontFamily,color:e.color,opacity:e.opacity});t({...n,id:e.id,groupId:e.groupId,locked:e.locked,lockId:e.lockId,x:e.x,y:e.y,cells:e.cells})},[m,t]),v=(0,J.useCallback)(()=>{let e=m(`chart`);if(!e)return;let n=eo(e.cells,{x:e.x,y:e.y},{fontSize:o.getState().style.fontSize,fontFamily:e.fontFamily,color:e.color,opacity:e.opacity});t({...n,id:e.id,groupId:e.groupId,locked:e.locked,lockId:e.lockId})},[o,m,t]);return(0,J.useMemo)(()=>({commitCell:s,setChartCells:c,mutateTable:l,insertColumn:u,deleteColumn:d,insertRow:f,deleteRow:p,copyTableCsv:h,convertTableToChart:g,convertChartToTable:v}),[s,c,l,u,d,f,p,h,g,v])}function fy(e){let{updateShape:t,beginLaneEdit:n,endEdit:r,setSelectedIds:i,setActiveGroupId:a}=e,o=U();return{beginEditLane:(0,J.useCallback)((e,t)=>{let r=o.getState(),s=xr(r.shapes,e);if(!(!s||s.type!==`figure`||s.locked)){if(s.groupId&&s.groupId!==r.activeGroupId){a(s.groupId),i(new Set);return}i(new Set([e])),n(e,t)}},[o,a,i,n]),commitLane:(0,J.useCallback)((e,n,i)=>{if(i!==null){let r=xr(o.getState().shapes,e);if(r?.type===`figure`){let a=r.lanes??[],o=i.trim();n<a.length&&o.length>0&&o!==a[n]&&t(e,{lanes:a.map((e,t)=>t===n?o:e)})}}r(e)},[o,t,r]),addLane:(0,J.useCallback)(e=>{let n=xr(o.getState().shapes,e);if(!n||n.type!==`figure`||!Mo(n.kind))return;let r=n.lanes&&n.lanes.length>0?n.lanes:No,i=[...r,`Lane ${r.length+1}`],a=n.laneSizes,s=a&&a.length===r.length?[...a,a.reduce((e,t)=>e+t,0)/a.length]:void 0,c=s?{laneSizes:s}:{};if(Po(n.kind)){t(e,{lanes:i,...c,width:n.width+n.width/r.length});return}t(e,{lanes:i,...c,height:n.height+n.height/r.length})},[o,t]),deleteLane:(0,J.useCallback)((e,n)=>{let r=xr(o.getState().shapes,e);if(!r||r.type!==`figure`||!Mo(r.kind))return;let i=r.lanes&&r.lanes.length>0?r.lanes:No;if(i.length<=2||n>=i.length)return;let a=i.filter((e,t)=>t!==n),s=ko(i.length,r.laneSizes)[n],c=r.laneSizes,l=c&&c.length===i.length?c.filter((e,t)=>t!==n):void 0,u=l?{laneSizes:l}:{};if(Po(r.kind)){t(e,{lanes:a,...u,width:r.width-r.width*s});return}t(e,{lanes:a,...u,height:r.height-r.height*s})},[o,t])}}function py(e){let{replaceMany:t,setStyle:n,setShapeKind:r}=e,i=U(),a=(0,J.useCallback)(e=>{let{shapes:n,selectedIds:r}=i.getState(),a=sa(n,r).map(e);a.length>0&&t(a)},[i,t]),o=(0,J.useCallback)(e=>{let{shapes:r,selectedIds:a,tableSelection:o}=i.getState();if(a.size===0){let t={...e};delete t.bendStyle,Object.keys(t).length>0&&n(e=>({...e,...t}));return}let s=sa(r,a).map(t=>t.type===`table`?Xa(t,o&&o.id===t.id?{axis:o.axis,index:o.index}:null,e):Qm(t,e));s.length>0&&t(s)},[i,t,n]),s=(0,J.useCallback)(e=>{let{shapes:r,selectedIds:a,tableSelection:o}=i.getState(),s=sa(r,a);if(s.length===0){n(t=>({...t,fill:e}));return}let c=s.map(t=>t.type===`table`?Xa(t,o&&o.id===t.id?{axis:o.axis,index:o.index}:null,{background:e}):Qm(t,eh(t,e)));t(c)},[i,t,n]),c=(0,J.useCallback)(e=>{a(t=>t.type===`figure`?{...t,...e}:t)},[a]),l=(0,J.useCallback)(e=>{a(t=>t.type===`control`?{...t,...e}:t)},[a]),u=(0,J.useCallback)(e=>{a(t=>t.type===`rectangle`||t.type===`control`?{...t,link:e||void 0}:t)},[a]),d=(0,J.useCallback)(e=>{a(t=>t.type===`chart`?{...t,...e}:t)},[a]),f=(0,J.useCallback)(e=>{a(t=>t.type===`text`?En(t,e):t)},[a]),p=(0,J.useCallback)(e=>{r(e),a(t=>t.type===`rectangle`?{...t,kind:e}:t)},[r,a]),m=(0,J.useCallback)((e,t)=>{a(n=>n.type===`icon`?{...n,name:e,source:t}:n)},[a]),h=(0,J.useCallback)(e=>{a(t=>t.type===`rectangle`?{...t,titleIcon:e}:t)},[a]);return(0,J.useMemo)(()=>({updateSelected:a,changeStyle:o,applyEyedropper:s,changeFigure:c,changeControl:l,changeLink:u,changeChart:d,changeTextSizing:f,changeShapeKind:p,pickIcon:m,patchBadge:h}),[a,o,s,c,l,u,d,f,p,m,h])}function my(e){(0,J.useEffect)(()=>{let t=window;t.__koboyoTrace&&(t.__koboyoTrace[e]=(t.__koboyoTrace[e]??0)+1)})}var hy=J.createContext(void 0);function gy(){let e=J.useContext(hy);if(e===void 0)throw Error(f(30));return e}var _y=function(e){return e.checked=`data-checked`,e.unchecked=`data-unchecked`,e.disabled=`data-disabled`,e.highlighted=`data-highlighted`,e}({}),vy={checked(e){return e?{[_y.checked]:``}:{[_y.unchecked]:``}},...m},Q=y(),yy=J.forwardRef(function(e,t){let{render:n,className:r,id:i,label:a,nativeButton:o=!1,disabled:l=!1,closeOnClick:u=!1,checked:f,defaultChecked:p,onCheckedChange:m,style:h,...g}=e,_=M({label:a}),v=O(!0),y=Uc(i),{store:b}=z(),x=b.useState(`isActive`,_.index),S=b.useState(`itemProps`),[C,w]=Hs({controlled:f,default:p??!1,name:`MenuCheckboxItem`,state:`checked`}),{getItemProps:T,itemRef:E}=D({closeOnClick:u,disabled:l,highlighted:x,id:y,store:b,nativeButton:o,nodeId:v?.context.nodeId,itemMetadata:ee}),k=J.useMemo(()=>({disabled:l,highlighted:x,checked:C}),[l,x,C]);function A(e){let t=s(c,e.nativeEvent,void 0,{preventUnmountOnClose(){}});m?.(!C,t),!t.isCanceled&&w(e=>!e)}let j=d(`div`,e,{state:k,stateAttributesMapping:vy,props:[S,{role:`menuitemcheckbox`,"aria-checked":C,onClick:A},g,T],ref:[E,t,_.ref]});return(0,Q.jsx)(hy.Provider,{value:k,children:j})}),by=J.forwardRef(function(e,t){let{render:n,className:r,style:a,keepMounted:o=!1,...s}=e,c=gy(),l=J.useRef(null),{transitionStatus:f,setMounted:p}=i(c.checked);return u({open:c.checked,ref:l,onComplete(){c.checked||p(!1)}}),d(`span`,e,{state:{checked:c.checked,disabled:c.disabled,highlighted:c.highlighted,transitionStatus:f},ref:[t,l],stateAttributesMapping:vy,props:{"aria-hidden":!0,...s},enabled:o||c.checked})});function xy(){let e=U(),[t,n]=(0,J.useState)(()=>e.getState().coarsePointer);return(0,J.useEffect)(()=>{if(!t)return;let e,r=()=>{e=window.setTimeout(()=>n(!1),150)};window.addEventListener(`pointerup`,r,{once:!0});let i=window.setTimeout(()=>n(!1),800);return()=>{window.removeEventListener(`pointerup`,r),window.clearTimeout(e),window.clearTimeout(i)}},[t]),t?{pointerEvents:`none`}:void 0}var Sy=`flex cursor-default select-none items-center justify-between gap-6 rounded-lg px-2 py-1.5 text-[13px] text-[var(--chrome-fg-700)] outline-none data-[highlighted]:bg-[var(--chrome-hover)]`;function $(e){let{testId:t,onClick:n,children:r,hint:i}=e;return(0,Q.jsxs)(P,{className:Sy,"data-testid":t,onClick:n,children:[(0,Q.jsx)(`span`,{children:r}),i?(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:Ec(i)}):null]})}function Cy(e){return[{when:e.canOpenWebLink,separatorBefore:!0,testId:`ctx-open-link`,label:`Open link`,onClick:e.onOpenWebLink},{when:e.canCopyWebHtml,separatorBefore:!0,testId:`ctx-copy-html`,label:`Copy HTML`,onClick:e.onCopyWebHtml},{when:e.isTable,separatorBefore:!0,testId:`ctx-copy-csv`,label:`Copy as CSV`,onClick:e.onCopyCsv},{when:e.isTable,testId:`ctx-convert-chart`,label:`Convert to chart`,onClick:e.onConvertToChart},{when:e.isChart,separatorBefore:!0,testId:`ctx-convert-table`,label:`Convert to table`,onClick:e.onConvertToTable},{when:e.canEditAsCode,separatorBefore:!0,testId:`ctx-edit-as-code`,label:`Edit as code`,onClick:e.onEditAsCode},{when:e.canResetArrowRoute,separatorBefore:!0,testId:`ctx-reset-route`,label:`Reset connector route`,onClick:e.onResetArrowRoute},{when:e.canTidy,separatorBefore:!0,testId:`ctx-tidy`,label:`Tidy up layout`,hint:Z(`tidy`),onClick:e.onTidy},{when:e.canCluster,testId:`ctx-cluster`,label:`Cluster sticky notes`,onClick:e.onCluster},{when:e.canToOutline,testId:`ctx-to-outline`,label:`Convert to outline`,onClick:e.onToOutline},{when:e.canToStickies,testId:`ctx-to-stickies`,label:`Convert to sticky notes`,onClick:e.onToStickies},{when:e.canColorLegend,testId:`ctx-color-legend`,label:`Add colour legend`,onClick:e.onColorLegend},{when:e.canAddToSlides,testId:`ctx-add-to-slides`,label:`Add to slides`,onClick:e.onAddToSlides},{when:e.canRemoveFromSlides,testId:`ctx-remove-from-slides`,label:`Remove from slides`,onClick:e.onRemoveFromSlides},{when:e.canAddFlow,testId:`ctx-add-flow`,label:`Add flow`,onClick:e.onAddFlow}]}function wy(e){return(0,Q.jsx)(Q.Fragment,{children:Cy(e.model).filter(e=>e.when).map(e=>(0,Q.jsxs)(J.Fragment,{children:[e.separatorBefore?(0,Q.jsx)(N,{}):null,(0,Q.jsx)($,{testId:e.testId,onClick:e.onClick,hint:e.hint,children:e.label})]},e.testId))})}var Ty=`min-w-[180px] p-1 outline-none ${Wc.popup}`;function Ey(e){let{label:t,testId:n,children:r}=e;return(0,Q.jsxs)(ac,{children:[(0,Q.jsxs)(sc,{className:Sy,"data-testid":n,children:[(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(Es,{size:14,stroke:1.75,className:`text-[var(--chrome-fg-400)]`})]}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`outline-none`,children:(0,Q.jsx)(te,{className:Ty,children:r})})})]})}var Dy=[{type:`left`,label:`Align left`,hint:Z(`alignLeft`)},{type:`center-h`,label:`Align centre`,hint:Z(`alignCenter`)},{type:`right`,label:`Align right`,hint:Z(`alignRight`)},{type:`top`,label:`Align top`,hint:Z(`alignTop`)},{type:`middle`,label:`Align middle`,hint:Z(`alignMiddle`)},{type:`bottom`,label:`Align bottom`,hint:Z(`alignBottom`)}];function Oy(e){let{model:t}=e;return t.canAlign?(0,Q.jsxs)(Ey,{label:`Align`,testId:`ctx-align`,children:[Dy.map(e=>(0,Q.jsx)($,{testId:`ctx-align-${e.type}`,onClick:()=>t.onAlign(e.type),hint:e.hint,children:e.label},e.type)),t.canDistribute?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-distribute-horizontal`,onClick:()=>t.onDistribute(`horizontal`),children:`Distribute horizontally`}),(0,Q.jsx)($,{testId:`ctx-distribute-vertical`,onClick:()=>t.onDistribute(`vertical`),children:`Distribute vertically`})]}):null]}):null}function ky(e){let{model:t}=e;return(0,Q.jsxs)(Ey,{label:`Reorder`,testId:`ctx-reorder`,children:[(0,Q.jsx)($,{testId:`ctx-send-backward`,onClick:t.onSendBackward,hint:Z(`sendBackward`),children:`Send backward`}),(0,Q.jsx)($,{testId:`ctx-bring-forward`,onClick:t.onBringForward,hint:Z(`bringForward`),children:`Bring forward`}),(0,Q.jsx)($,{testId:`ctx-send-back`,onClick:t.onSendToBack,hint:Z(`sendToBack`),children:`Send to back`}),(0,Q.jsx)($,{testId:`ctx-bring-front`,onClick:t.onBringToFront,hint:Z(`bringToFront`),children:`Bring to front`})]})}function Ay(e){let{model:t}=e;return t.canExport?(0,Q.jsxs)(Ey,{label:`Export`,testId:`ctx-export`,children:[t.openInApp?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{testId:`ctx-export-png`,onClick:t.onExportPng,children:`Export as PNG…`}),(0,Q.jsx)($,{testId:`ctx-export-svg`,onClick:t.onExportSvg,children:`Export as SVG…`}),(0,Q.jsx)(N,{})]}),(0,Q.jsx)($,{testId:`ctx-copy-png`,onClick:t.onCopyPng,children:`Copy as PNG`}),(0,Q.jsx)($,{testId:`ctx-copy-svg`,onClick:t.onCopySvg,children:`Copy as SVG`}),t.openInApp?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-open-in-app`,onClick:t.openInApp.run,children:t.openInApp.label})]}):null]}):null}function jy(e){let{model:t}=e;return t.canAskAi?(0,Q.jsxs)(Ey,{label:`Ask AI`,testId:`ctx-ask-ai`,children:[(0,Q.jsx)($,{testId:`ctx-ai-explain`,onClick:t.onAskExplain,children:`Explain this`}),(0,Q.jsx)($,{testId:`ctx-ai-feedback`,onClick:t.onAskFeedback,children:`Give feedback`}),(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-ai-tidy`,onClick:t.onAskTidy,children:`Tidy it up`}),(0,Q.jsx)($,{testId:`ctx-ai-proofread`,onClick:t.onAskProofread,children:`Fix spelling and grammar`}),(0,Q.jsx)($,{testId:`ctx-ai-icons`,onClick:t.onAskIcons,children:`Add icons`}),(0,Q.jsx)($,{testId:`ctx-ai-restyle`,onClick:t.onAskRestyle,children:`Restyle…`}),(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-ai-custom`,onClick:t.onAskCustom,children:`Ask about this…`})]}):null}function My(e){let{model:t,selectAll:n=!0}=e;return(0,Q.jsxs)(Q.Fragment,{children:[n&&t.canSelectAll?(0,Q.jsx)($,{testId:`ctx-select-all`,onClick:t.onSelectAll,hint:Z(`selectAll`),children:`Select all`}):null,(0,Q.jsx)($,{testId:`ctx-zoom-fit`,onClick:t.onZoomToFit,children:`Zoom to fit`}),(0,Q.jsx)($,{testId:`ctx-reset-zoom`,onClick:t.onResetZoom,children:`Zoom to 100%`}),t.canExport?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)(Ay,{model:t})]}):null]})}function Ny(e){let t=xy();return(0,Q.jsx)(te,{"data-overlay":!0,"data-testid":`context-menu`,style:t,className:`min-w-[200px] p-1 outline-none ${Wc.popup}`,children:e.children})}function Py(e){H();let t=e.buildModel();return(0,Q.jsx)(A,{className:`outline-none`,children:(0,Q.jsx)(Ny,{children:t.readOnly?(0,Q.jsxs)(Q.Fragment,{children:[t.canComment?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{testId:`ctx-add-comment`,onClick:t.onAddComment,hint:ls(`comment`),children:t.hasSelection?`Comment on this`:`Add comment here`}),(0,Q.jsx)(N,{})]}):null,t.hasSelection?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{testId:`ctx-copy`,onClick:t.onCopy,hint:Z(`copy`),children:`Copy`}),(0,Q.jsx)($,{testId:`ctx-zoom-selection`,onClick:t.onZoomToSelection,children:`Zoom to selection`}),t.canOpenWebLink?(0,Q.jsx)($,{testId:`ctx-open-link`,onClick:t.onOpenWebLink,children:`Open link`}):null,(0,Q.jsx)(N,{})]}):null,(0,Q.jsx)(My,{model:t})]}):t.isLocked?(0,Q.jsx)($,{testId:`ctx-unlock`,onClick:t.onUnlock,hint:Z(`lock`),children:`Unlock`}):t.hasSelection?(0,Q.jsxs)(Q.Fragment,{children:[t.canComment?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{testId:`ctx-add-comment`,onClick:t.onAddComment,hint:ls(`comment`),children:`Comment on this`}),(0,Q.jsx)(N,{})]}):null,(0,Q.jsx)($,{testId:`ctx-cut`,onClick:t.onCut,hint:Z(`cut`),children:`Cut`}),(0,Q.jsx)($,{testId:`ctx-copy`,onClick:t.onCopy,hint:Z(`copy`),children:`Copy`}),(0,Q.jsx)($,{testId:`ctx-duplicate`,onClick:t.onDuplicate,hint:Z(`duplicate`),children:`Duplicate`}),t.hasClipboard?(0,Q.jsx)($,{testId:`ctx-paste`,onClick:t.onPaste,hint:`⌘V`,children:`Paste here`}):null,t.canAskAi?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)(jy,{model:t})]}):null,t.askHost?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-ask-host`,onClick:t.askHost.run,children:t.askHost.label})]}):null,(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-wrap-frame`,onClick:t.onWrapInFrame,children:`Wrap selection in frame`}),(0,Q.jsx)($,{testId:`ctx-zoom-selection`,onClick:t.onZoomToSelection,children:`Zoom to selection`}),(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-copy-styles`,onClick:t.onCopyStyles,hint:Z(`copyStyles`),children:`Copy styles`}),t.hasStyleClipboard?(0,Q.jsx)($,{testId:`ctx-paste-styles`,onClick:t.onPasteStyles,hint:Z(`pasteStyles`),children:`Paste styles`}):null,(0,Q.jsx)(N,{}),(0,Q.jsx)(Oy,{model:t}),(0,Q.jsx)(ky,{model:t}),(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-flip-h`,onClick:t.onFlipHorizontal,hint:Z(`flipHorizontal`),children:`Flip horizontal`}),(0,Q.jsx)($,{testId:`ctx-flip-v`,onClick:t.onFlipVertical,hint:Z(`flipVertical`),children:`Flip vertical`}),(0,Q.jsx)(wy,{model:t}),t.canGroup||t.canUngroup?(0,Q.jsx)(N,{}):null,t.canGroup?(0,Q.jsx)($,{testId:`ctx-group`,onClick:t.onGroup,hint:Z(`group`),children:`Group`}):null,t.canUngroup?(0,Q.jsx)($,{testId:`ctx-ungroup`,onClick:t.onUngroup,hint:Z(`ungroup`),children:`Ungroup`}):null,(0,Q.jsx)(N,{}),(0,Q.jsx)(Ay,{model:t}),t.canEmbedFrame?(0,Q.jsx)($,{testId:`ctx-embed-frame`,onClick:t.onEmbedFrame,children:`Embed frame…`}):null,(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-lock`,onClick:t.onLock,hint:Z(`lock`),children:`Lock`}),(0,Q.jsx)($,{testId:`ctx-delete`,onClick:t.onDelete,hint:`⌫`,children:`Delete`})]}):(0,Q.jsxs)(Q.Fragment,{children:[t.canComment?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)($,{testId:`ctx-add-comment`,onClick:t.onAddComment,hint:ls(`comment`),children:`Add comment here`}),(0,Q.jsx)(N,{})]}):null,t.hasClipboard?(0,Q.jsx)($,{testId:`ctx-paste`,onClick:t.onPaste,hint:`⌘V`,children:`Paste here`}):null,t.canSelectAll?(0,Q.jsx)($,{testId:`ctx-select-all`,onClick:t.onSelectAll,hint:Z(`selectAll`),children:`Select all`}):null,t.hasClipboard||t.canSelectAll?(0,Q.jsx)(N,{}):null,(0,Q.jsx)(My,{model:t,selectAll:!1}),(0,Q.jsx)(N,{}),(0,Q.jsxs)(yy,{className:Sy,"data-testid":`ctx-grid`,checked:t.showGrid,onCheckedChange:()=>t.onToggleGrid(),children:[(0,Q.jsx)(`span`,{children:`Show grid`}),(0,Q.jsx)(by,{children:(0,Q.jsx)(Ts,{size:14,stroke:2})})]}),(0,Q.jsxs)(yy,{className:Sy,"data-testid":`ctx-snap`,checked:t.snapEnabled,onCheckedChange:()=>t.onToggleSnap(),children:[(0,Q.jsx)(`span`,{children:`Enable snapping`}),(0,Q.jsx)(by,{children:(0,Q.jsx)(Ts,{size:14,stroke:2})})]}),(0,Q.jsxs)(yy,{className:Sy,"data-testid":`ctx-presentation-animation`,checked:t.presentationAnimation,onCheckedChange:()=>t.onTogglePresentationAnimation(),children:[(0,Q.jsx)(`span`,{children:`Presentation animation`}),(0,Q.jsx)(by,{children:(0,Q.jsx)(Ts,{size:14,stroke:2})})]}),(0,Q.jsxs)(yy,{className:Sy,"data-testid":`ctx-zoom-indicator`,checked:t.showZoomIndicator,onCheckedChange:()=>t.onToggleShowZoomIndicator(),children:[(0,Q.jsx)(`span`,{children:`Zoom indicator`}),(0,Q.jsx)(by,{children:(0,Q.jsx)(Ts,{size:14,stroke:2})})]}),t.canClear?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)($,{testId:`ctx-clear-canvas`,onClick:t.onClear,children:`Clear canvas`})]}):null]})})})}function Fy(e){let{buildModel:t,children:n}=e;return(0,Q.jsxs)(Ps,{onOpenChange:e=>{e&&t().onMenuOpen()},children:[(0,Q.jsx)(Rs,{render:(0,Q.jsx)(`div`,{style:{display:`contents`}}),children:n}),(0,Q.jsx)(j,{children:(0,Q.jsx)(Py,{buildModel:t})})]})}function Iy(e,t){return{load:e,pick:t}}var Ly=Iy(()=>wi(()=>import(`./slides-panel-DANnu_nw.js`),__vite__mapDeps([61,10,26,33,37,38,39,40,34,22,6,7,8,3,1,41,42,45,35,46,62,44,50,51,57,63,43,47,48,49,52,64,65,66,67,68,53,69,70,71,72,20,73,74,75,76,55,77,11,78,79,80,81,82,83,84,85,24,86,23,12,13,16,87,88,89,58,2])),e=>e.SlidesPanel),Ry=Iy(()=>wi(()=>import(`./code-panel-BFikzGNv.js`),__vite__mapDeps([90,10,26,38,33,37,39,40,34,22,6,7,8,3,1,41,42,23,63,15,11,16,30,20,35,91,53,76,92,52,82,83,44,93,84,85,21,9,12,13,14,17,24,86,87,88,89,58,2,94,95,29,31])),e=>e.CodePanel),zy=Iy(()=>wi(()=>import(`./flow-panel-DbnavW4w.js`),__vite__mapDeps([96,10,26,33,37,38,39,40,34,22,6,7,8,3,1,41,42,45,35,46,62,44,50,51,57,97,91,98,95,64,99,94,67,68,100,101,73,48,102,74,75,76,55,52,84,85,82])),e=>e.FlowPanel),By=Iy(()=>wi(()=>import(`./flow-panel-DbnavW4w.js`),__vite__mapDeps([96,10,26,33,37,38,39,40,34,22,6,7,8,3,1,41,42,45,35,46,62,44,50,51,57,97,91,98,95,64,99,94,67,68,100,101,73,48,102,74,75,76,55,52,84,85,82])),e=>e.FlowMenuPopup),Vy=Iy(()=>wi(()=>import(`./flow-layer-B4Q8rktl.js`),__vite__mapDeps([103,10,26,33,34,22,6,7,8,3,1,72,97,104,105,23,35,98,95,99,94,67,68,106,101,73,48,76,55,84,107])),e=>e.FlowLayer),Hy=Iy(()=>wi(()=>import(`./presentation-DNmdm11D.js`),__vite__mapDeps([108,10,26,33,34,22,6,7,8,3,1,109,105,23,67,35,68,71,72,20,76,95,80,52,94,107])),e=>e.Presentation),Uy=Iy(()=>wi(()=>import(`./web-embed-dialog-sT-1yK5o.js`),__vite__mapDeps([110,10,26,33,34,22,6,7,8,3,1,91,35,51,82,38,83,44,42,111,93,4,2])),e=>e.WebEmbedDialog),Wy=Iy(()=>wi(()=>import(`./web-html-dialog-B5Hb3RGw.js`),__vite__mapDeps([112,10,26,33,34,22,6,7,8,3,1,36,37,38,39,40,41,42,43,44,45,35,46,47,48,49,50,51,52,53,54,25,11,82,83,111,93,59,60])),e=>e.WebHtmlDialog),Gy=Iy(()=>wi(()=>import(`./slide-notes-dialog-43EMJFJV.js`),__vite__mapDeps([113,10,26,33,34,22,6,7,8,3,1,76,35,82,38,83,44,42])),e=>e.SlideNotesDialog),Ky=()=>wi(()=>import(`./icon-picker-DIkw2xYL.js`),__vite__mapDeps([114,10,26,33,34,22,6,7,8,3,1,11,16,15,49,38,39,50,52,31,115,37,40,41,42,92,116,19,117])),qy=Iy(Ky,e=>e.IconPicker),Jy=Iy(Ky,e=>e.IconPickerContent),Yy=Iy(()=>wi(()=>import(`./image-library-BmoSPV9c.js`),__vite__mapDeps([118,10,26,33,57,34,22,6,7,8,3,1,15,11,16,119,35,120,19,51,82,38,115,37,39,40,41,42,92,116,117])),e=>e.ImageLibraryDialog),Xy=Iy(()=>wi(()=>import(`./tool-drawer-B-Ys7Rsn.js`),__vite__mapDeps([121,10,26,33,57,34,22,6,7,8,3,1,122,88,35,91,123,101,47,124,73,125,120,75,49,38,39,50,41,92,52,126,51,82,117])),e=>e.ToolDrawer),Zy=Iy(()=>wi(()=>import(`./export-dialog-KYLeNY3G.js`),__vite__mapDeps([127,10,26,33,57,34,22,6,7,8,3,1,128,92,76,35,77,70,38,40,63,11,78,79,51,82,83,44,42,93])),e=>e.ExportDialog),Qy=Iy(()=>wi(()=>import(`./copy-image-dialog-C0fXdR1a.js`),__vite__mapDeps([129,10,26,33,34,22,6,7,8,3,1,14,76,35,51,82,38,83,44,42,111,93])),e=>e.CopyImageDialog),$y=Iy(()=>wi(()=>import(`./command-palette-Uat68wmJ.js`),__vite__mapDeps([126,10,26,33,34,22,6,7,8,3,1,120,35,41,51,82,38])),e=>e.CommandPalette),eb=Iy(()=>wi(()=>import(`./build-pips-BRf3pMnt.js`),__vite__mapDeps([130,10,26,33,34,22,6,7,8,3,1,100,35,80,81])),e=>e.BuildPips),tb=Iy(()=>wi(()=>import(`./upgrade-dialog-DhSZnDpx.js`),__vite__mapDeps([131,10,26,38,33,44,57,35,46,132,133,119,73,125,75,134,76,42,51,82,83,111,93])),e=>e.UpgradeDialog),nb=Iy(()=>wi(()=>import(`./sign-in-dialog-tmQEB2bx.js`),__vite__mapDeps([135,10,26,70,38,33,40,57,35,65,136,133,124,75,134,76,51,82,83,44,42,111])),e=>e.SignInDialog);function rb(e){return(0,J.useEffect)(()=>Jh(()=>Pa(tb)),[]),(0,Q.jsx)(Ia,{active:e.open,retain:!0,feature:tb,children:t=>(0,Q.jsx)(t,{...e})})}function ib(e){return(0,J.useEffect)(()=>Jh(()=>Pa(nb)),[]),(0,Q.jsx)(Ia,{active:e.open,retain:!0,feature:nb,children:t=>(0,Q.jsx)(t,{...e})})}var ab=24,ob=16,sb=64;function cb(e){if(!(e>0)||!Number.isFinite(e))return ab;let t=ab*e;for(;t<ob;)t*=2;for(;t>sb;)t/=2;return t}function lb(e){let{viewport:t}=e,n=cb(t.zoom),r=ct(t.zoom*.8,.65,1);return(0,Q.jsx)(`div`,{"aria-hidden":!0,"data-testid":`grid`,className:`pointer-events-none absolute inset-0`,style:{backgroundImage:[`linear-gradient(var(--canvas-paper-tint), var(--canvas-paper-tint))`,`radial-gradient(circle, var(--canvas-dot) ${r}px, transparent ${r+.2}px)`].join(`, `),backgroundSize:`auto, ${n}px ${n}px`,backgroundPosition:`0 0, ${t.x}px ${t.y}px`}})}var ub=(0,J.memo)(lb);function db(){let e=H(e=>e.animateSlideId),t=H(e=>e.hoveredId),n=H(e=>e.shapes);return(0,J.useMemo)(()=>{if(!e||!t||t===e)return null;let r=Jr(n).find(t=>t.id===e);if(!r)return null;let i=$r(n,r),a=i.find(e=>e.id===t);if(!a)return null;let o=a.groupId;return o&&Kc(n,r).has(o)?i.filter(e=>e.groupId===o):[a]},[e,t,n])}function fb(e){let{interactive:t,transforming:n,zoom:r}=e,i=H(e=>e.hoveredId),a=ve(e=>[e.shapes,e.hoveredId],(e,t)=>t?xr(e,t):void 0),o=ve(e=>[e.shapes,a?.groupId],(e,t)=>t?e.filter(e=>e.groupId===t):gb),s=H(e=>e.selectedIds),c=H(e=>e.editSession.kind===`crop`?e.editSession.shapeId:null),l=H(e=>e.activeGroupId),u=H(e=>e.coarsePointer),d=db()?.some(e=>e.id===i)??!1,f=V().measurement;if(u||!i||!t||n||i===c||d||!a||a.locked)return null;if(a.groupId&&a.groupId!==l){let e=o;if(e.every(e=>s.has(e.id)))return(0,Q.jsx)(yb,{shape:a,zoom:r});let t=Bt(e,f);return t?(0,Q.jsx)(pb,{bounds:t,zoom:r}):null}return s.has(i)?null:(0,Q.jsx)(yb,{shape:a,zoom:r})}function pb(e){let{bounds:t,zoom:n}=e;return(0,Q.jsx)(`svg`,{"data-testid":`hover-indicator`,className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`rect`,{x:t.x,y:t.y,width:t.width,height:t.height,rx:4,fill:`none`,stroke:`var(--canvas-selection)`,strokeWidth:1.5/n})})}var mb=new Set([`arrow`,`line`,`draw`]),hb=1e3,gb=[];function _b(e){let{interactive:t,zoom:n,shapes:r}=e,i=H(e=>e.selectedIds),a=H(e=>xe(e.editSession)),o=H(e=>e.activeGroupId),s=H(e=>e.viewMode),c=H(e=>e.transforming);if(!t||c||i.size===0)return null;let l=r.filter(e=>i.has(e.id)&&e.id!==a);return l.length>hb||!s&&(i.size===1&&l.length===1&&!mb.has(l[0].type)||l.length>1&&l[0].groupId&&l[0].groupId!==o&&l.every(e=>e.groupId===l[0].groupId))?null:(0,Q.jsx)(Q.Fragment,{children:l.map(e=>(0,Q.jsx)(yb,{shape:e,zoom:n,testId:`selection-outline`},e.id))})}function vb(e){let{shape:t,stroke:n,strokeWidth:r,strokeOpacity:i,linecap:a}=e,o=V().measurement,s={fill:`none`,stroke:n,strokeWidth:r,...i===void 0?{}:{strokeOpacity:i},style:{pointerEvents:`none`}};if(t.type===`arrow`)return(0,Q.jsx)(`path`,{d:qn(t),strokeLinejoin:`round`,strokeLinecap:a,...s});if(t.type===`line`)return(0,Q.jsx)(`path`,{d:Fr(t.points),strokeLinejoin:`round`,strokeLinecap:`round`,...s});if(t.type===`draw`)return(0,Q.jsx)(`path`,{d:yn(t),strokeLinejoin:`round`,strokeLinecap:`round`,...s});let c=t.type===`icon`?Gt(t,o):W(t,o),l=W(t,o),u=l.x+l.width/2,d=l.y+l.height/2,f=an(t),p=t.type===`rectangle`?(0,Q.jsx)(`path`,{d:ln(t.kind,c,t.corner,{x:t.flipX,y:t.flipY}),strokeLinejoin:`round`,...s}):(0,Q.jsx)(`rect`,{x:c.x,y:c.y,width:c.width,height:c.height,rx:t.type===`image`?2:4,...s});return(0,Q.jsx)(`g`,{transform:f?`rotate(${f} ${u} ${d})`:void 0,children:p})}function yb(e){let{shape:t,zoom:n,testId:r}=e;return(0,Q.jsx)(`svg`,{"data-testid":r??`hover-indicator`,className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(vb,{shape:t,stroke:`var(--canvas-selection)`,strokeWidth:1.5/n})})}function bb(e,t,n,r){return e.map((e,i)=>i===t?e.map((e,t)=>t===n?r:e):e)}function xb(e,t){let n=e[0]?.length??1,r=n=>n===0?`Point ${e.length}`:t?`0.5`:``;return[...e,Array.from({length:n},(e,t)=>r(t))]}function Sb(e){return e.map((e,t)=>[...e,t===0?`Series ${e.length}`:``])}function Cb(e,t){return t===0||e.length<=2?e:e.filter((e,n)=>n!==t)}function wb(e,t){return t===0||(e[0]?.length??0)<=2?e:e.map(e=>e.filter((e,n)=>n!==t))}var Tb=`h-7 w-20 rounded-md border border-[var(--chrome-ring)] bg-[var(--chrome-popup)] px-1.5 text-[12px] text-[var(--chrome-fg-700)] outline-none focus:border-gray-400`;function Eb(e){let{shape:t,viewport:n,onChange:r,onClose:i}=e,{history:a}=V(),o=t.cells,s=o[0]?.length??1,c=t.chartType===`quadrant`,l=(0,J.useRef)(null);(0,J.useEffect)(()=>{function e(e){l.current&&!l.current.contains(e.target)&&i()}return window.addEventListener(`pointerdown`,e,!0),()=>window.removeEventListener(`pointerdown`,e,!0)},[i]);let u=G({x:t.x+t.width,y:t.y},n),d=G({x:t.x,y:t.y},n),f=96+s*84,p=u.x+12+f>window.innerWidth?Math.max(8,d.x-12-f):u.x+12,m=Math.max(8,u.y);return(0,Q.jsxs)(`div`,{ref:l,"data-testid":`chart-data-editor`,"data-overlay":!0,className:`absolute z-10 rounded-xl p-2.5 ${tl}`,style:{left:p,top:m,maxHeight:`60vh`,overflow:`auto`},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center justify-between gap-6`,children:[(0,Q.jsx)(`span`,{className:`text-[12px] text-[var(--chrome-fg-500)]`,children:c?`Quadrant points`:`Chart data`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Done`,onClick:i,className:`flex h-6 w-6 items-center justify-center rounded-md text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-divider)]`,children:(0,Q.jsx)(uc,{size:14,stroke:1.75})})]}),(0,Q.jsx)(`div`,{className:`flex flex-col gap-1`,children:o.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[e.map((e,n)=>(0,Q.jsxs)(`div`,{className:`relative`,children:[t===0&&n>0&&s>2&&!c&&(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove series ${n}`,onClick:()=>r(wb(o,n)),className:`absolute -top-2 right-0 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--chrome-popup)] text-[var(--chrome-fg-400)] ring-1 ring-[var(--chrome-ring)] transition-colors hover:text-[var(--chrome-fg-700)]`,children:(0,Q.jsx)(uc,{size:10,stroke:2})}),(0,Q.jsx)(`input`,{value:e,inputMode:t>0&&n>0?`decimal`:void 0,placeholder:t===0&&n===0?`-`:void 0,onChange:e=>r(bb(o,t,n,e.target.value)),onFocus:a.beginTransaction,onBlur:a.endTransaction,className:t===0||n===0?`${Tb} font-medium text-[var(--chrome-fg-800)]`:Tb})]},n)),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove row ${t}`,onClick:()=>r(Cb(o,t)),disabled:t===0||o.length<=2,className:`flex h-6 w-6 items-center justify-center rounded-md text-[var(--chrome-fg-300)] transition-colors hover:bg-[var(--chrome-divider)] enabled:hover:text-[var(--chrome-fg-700)] disabled:opacity-0`,children:(0,Q.jsx)(uc,{size:13,stroke:1.75})})]},t))}),(0,Q.jsxs)(`div`,{className:`mt-2 flex items-center gap-1 border-t border-[var(--chrome-ring)] pt-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(xb(o,c)),className:`flex h-7 items-center gap-1 rounded-md px-2 text-[12px] text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-divider)]`,children:[(0,Q.jsx)(ic,{size:13,stroke:2}),` `,c?`Point`:`Row`]}),!c&&(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>r(Sb(o)),className:`flex h-7 items-center gap-1 rounded-md px-2 text-[12px] text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-divider)]`,children:[(0,Q.jsx)(ic,{size:13,stroke:2}),` Series`]})]})]})}var Db=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:c=!0,...l}=e,{buttonRef:u,getButtonProps:f}=b({disabled:a,focusableWhenDisabled:!1,native:c}),{store:p}=Cc();return Sc(),d(`button`,e,{ref:[t,u],props:[{onClick(e){p.setOpen(!1,s(o,e.nativeEvent))}},l,f]})}),Ob=4e3,kb=`pending:`;function Ab(e){return e.startsWith(kb)}var jb=[`@`,`+`];function Mb(e){return al(e,`alert-dialog`)}var Nb=J.forwardRef(function(e,t){let{render:n,className:r,style:i,disabled:a=!1,nativeButton:o=!0,id:s,payload:c,handle:u,...m}=e,g=cl(!0),_=u?.store??g?.store;if(!_)throw Error(f(79));let v=Uc(s),y=_.useState(`floatingRootContext`),x=_.useState(`isOpenedByTrigger`,v),S=_.useState(`triggerPopupId`,v),w=J.useRef(null),{registerTrigger:E,isMountedByThisTrigger:D}=h(v,w,_,{payload:c}),{getButtonProps:O,buttonRef:k}=b({disabled:a,native:o}),A=C(y,{enabled:y!=null}),j=T(()=>_.select(`open`),e=>{_.set(`openMethod`,e)}),ee={disabled:a,open:x},M=_.useState(`triggerProps`,D);return d(`button`,e,{state:ee,ref:[k,t,E,w],props:[A.reference,M,j,{[p]:``,id:v,"aria-haspopup":`dialog`,"aria-expanded":x,"aria-controls":S},m,O],stateAttributesMapping:l})});function Pb(e){let{open:t,onOpenChange:n,title:r,description:i,confirmLabel:a,destructive:o,onConfirm:s,testId:c}=e,{pending:l,error:u,run:d}=hl({open:t}),f=o?`bg-red-600 hover:bg-red-700`:`bg-[var(--chrome-accent)] hover:bg-[var(--chrome-accent-hover)]`;function p(){d(()=>s(),{onSuccess:()=>n(!1),errorFor:e=>ml(e,`That didn't work. Try again.`)})}return(0,Q.jsx)(Mb,{open:t,onOpenChange:e=>{l&&!e||n(e)},children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:Wc.dialogBackdrop}),(0,Q.jsxs)(ll,{"data-overlay":!0,"data-testid":c,className:`w-[min(400px,92vw)] p-5 ${Wc.dialogPopup}`,children:[(0,Q.jsx)(fl,{className:`text-[15px] text-[var(--chrome-fg-900)]`,children:r}),(0,Q.jsx)(pl,{className:`mt-2 text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:i}),u&&(0,Q.jsx)(`p`,{role:`alert`,"data-testid":c?`${c}-error`:void 0,className:`mt-3 text-[12px] leading-relaxed text-[var(--chrome-danger)]`,children:u}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(dl,{disabled:l,className:`h-8 rounded-xl bg-[var(--chrome-popup)] px-3.5 text-[13px] text-[var(--chrome-fg-700)] outline-none ring-1 ring-[var(--chrome-ring)] transition-colors hover:bg-[var(--chrome-hover)] disabled:opacity-60`,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":c?`${c}-accept`:void 0,disabled:l,onClick:()=>p(),className:Gc(`h-8 rounded-xl px-3.5 text-[13px] text-white outline-none transition-colors active:scale-[0.97] disabled:opacity-60 disabled:active:scale-100`,f),children:l?`Working…`:a})]})]})]})})}function Fb(e){return e?.type===`web`&&e.kind===`html`}async function Ib(e,t,n){if(e.kind!==`shape`)return e;let r=t.get(e.shapeId);if(!Fb(r)||e.fx<0||e.fx>1||e.fy<0||e.fy>1)return e;let i=n?.findWidgetFrame(r.id);if(!n||!i)return e;let a=await n.probeWidget(i,e.fx*r.width,e.fy*r.height).catch(()=>null);return il(a)?{...e,target:a}:e}async function Lb(e,t,n){if(e.kind!==`shape`||!e.target)return null;let r=n?.findWidgetFrame(t);if(!n||!r)return null;let{selector:i,text:a}=e.target;if(i){let e=await n.locateInWidget(r,i).catch(()=>null);if(e)return e}if(!a)return null;let o=await n.locateTextInWidget(r,a).catch(()=>null);return il(o)?o.box:null}function Rb(e,t,n){if(e.kind!==`shape`||!e.target||t.type!==`web`)return e;let{width:r,height:i}=t;if(r<=0||i<=0)return e;let a=e.target.box,o=a.w>0?(e.fx*r-a.x)/a.w:.5,s=a.h>0?(e.fy*i-a.y)/a.h:.5;return{...e,fx:(n.x+o*n.w)/r,fy:(n.y+s*n.h)/i}}var zb=`hidden`;function Bb(e,t){return!e||!t?null:`${Oc.commentsHidden}:${e}:${t}`}function Vb(e){return!e||kc.getString(e)!==zb}function Hb(e,t){if(e){if(t){kc.remove(e);return}kc.setString(e,zb)}}function Ub(){let e=ie(),t=U(),n=Bb(e?.currentUser?.id,e?.canvasId);(0,J.useEffect)(()=>{if(n)return t.getState().setCommentsVisible(Vb(n)),t.subscribe((e,t)=>{e.commentsVisible!==t.commentsVisible&&Hb(n,e.commentsVisible)})},[n,t])}var Wb=[0,400,1500,4e3],Gb=new WeakMap;function Kb(e){let t=Gb.get(e);if(t!==void 0)return t;let n=e.type===`web`?`${e.htmlSrc??We(e.html??``,0,0)}:${String(e.width)}x${String(e.height)}`:``;return Gb.set(e,n),n}function qb(e,t){let n=H(e=>e.liveWebIds),r=(0,J.useMemo)(()=>{let r=[];for(let i of e??[]){let{anchor:e}=i;if(e.kind!==`shape`||!e.target||!n.has(e.shapeId))continue;let a=t.get(e.shapeId);if(a?.type!==`web`||a.kind!==`html`)continue;let{selector:o,text:s}=e.target;r.push({threadId:i.id,shapeId:a.id,anchor:e,key:`${i.id}|${Kb(a)}|${o}|${s}`})}return r},[e,t,n]),i=r.map(e=>e.key).join(`
|
|
16
|
+
`),a=(0,J.useRef)(r);a.current=r;let[o,s]=(0,J.useState)(()=>new Map),c=(0,J.useRef)(o);return c.current=o,(0,J.useEffect)(()=>{let e=a.current,t=new Map;for(let n of e){let e=c.current.get(n.key);e&&t.set(n.key,e)}if(t.size!==c.current.size&&s(new Map(t)),t.size===e.length)return;let n=!1,r,i=async a=>{let o=e.filter(e=>!t.has(e.key)),c=await Promise.all(o.map(e=>Lb(e.anchor,e.shapeId,cg())));if(n)return;let l=!1;c.forEach((e,n)=>{e&&(t.set(o[n].key,e),l=!0)}),l&&s(new Map(t));let u=Wb[a+1];t.size<e.length&&u!==void 0&&(r=window.setTimeout(()=>void i(a+1),u))};return r=window.setTimeout(()=>void i(0),Wb[0]),()=>{n=!0,window.clearTimeout(r)}},[i]),(0,J.useMemo)(()=>{let e=new Map;for(let t of r){let n=o.get(t.key);n&&e.set(t.threadId,n)}return e},[r,o])}function Jb(e,t){if(t.length===0||!e.includes(`@`))return[{text:e,mention:!1}];let n=[...t].sort((e,t)=>t.length-e.length),r=[],i=``,a=0;for(;a<e.length;){let t=``;if(e[a]===`@`){let r=e.slice(a+1),i=n.find(e=>{if(!r.startsWith(e))return!1;let t=r[e.length];return t===void 0||/\W/.test(t)});i&&(t=`@${i}`)}if(t){i&&=(r.push({text:i,mention:!1}),``),r.push({text:t,mention:!0}),a+=t.length;continue}i+=e[a],a+=1}return i&&r.push({text:i,mention:!1}),r}function Yb(e,t){let n=null;for(let r of jb){let i=e.lastIndexOf(r,t-1);if(i<0)continue;let a=i===0?``:e[i-1];if(a&&!/\s/.test(a))continue;let o=e.slice(i+1,t);/\s/.test(o)||(!n||i>n.at)&&(n={text:o,at:i})}return n}function Xb(e,t){let n=t.trim().toLowerCase();if(!n)return e;let r=e.filter(e=>e.name.toLowerCase().startsWith(n)),i=e.filter(e=>!e.name.toLowerCase().startsWith(n)&&e.name.toLowerCase().includes(n));return[...r,...i]}function Zb(e,t,n,r){let i=`@${n.name} `;return{value:e.slice(0,t.at)+i+e.slice(r),caret:t.at+i.length}}function Qb(e,t){let n=new Set(Jb(e,t.map(e=>e.name)).filter(e=>e.mention).map(e=>e.text.slice(1))),r=t.filter(e=>n.has(e.name)).map(e=>e.userId);return[...new Set(r)]}function $b(e,t){return e.notifications?.unread[t]??0}function ex(e){let t=e.notifications?.unread??{};return e.threads.some(e=>(t[e.id]??0)>0)}function tx(e){let t=ie(),n=t&&e?$b(t,e):0,r=t?.notifications?.markThreadRead;(0,J.useEffect)(()=>{!e||n===0||!r||r(e)},[e,n,r])}function nx(e,t){let n=e.store.getState(),r=new Map(n.shapes.map(e=>[e.id,e])),i=Bm(t.anchor,r,e.measurement);if(!i)return!1;let a=document.querySelector(`[data-canvas-root]`);if(a instanceof HTMLElement){let{viewport:t}=n;e.viewportAnimation.animate(t,{zoom:t.zoom,x:a.clientWidth/2-i.x*t.zoom,y:a.clientHeight/2-i.y*t.zoom},n.setViewport)}return n.setCommentsVisible(!0),n.setOpenThreadId(t.id),!0}function rx(){let e=ie(),t=V(),n=e?.focusThreadId??null,r=e?.loaded??!1,i=e?.threads,a=e?.onFocusHandled;(0,J.useEffect)(()=>{if(!n||!r||!i)return;let e=i.find(e=>e.id===n);e&&nx(t,e),a?.()},[n,r,i,t,a])}function ix(e,t){let n=Math.max(0,t-e),r=Math.floor(n/6e4);if(r<1)return`now`;if(r<60)return`${r}m`;let i=Math.floor(r/60);if(i<24)return`${i}h`;let a=Math.floor(i/24);return a<7?`${a}d`:new Date(e).toLocaleDateString(void 0,{month:`short`,day:`numeric`})}function ax(e){return(e.trim()[0]??`?`).toUpperCase()}function ox(e){let{placeholder:t,submitLabel:n,initialValue:r,autoFocus:i,members:a,onSubmit:o,onCancel:s,cancelLabel:c,testId:l,handleRef:u,confirmDiscard:d}=e,[f,p]=(0,J.useState)(r??``),[m,h]=(0,J.useState)(!1),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(null),[b,x]=(0,J.useState)(0),S=(0,J.useRef)(null),C=(0,J.useRef)(null),w=(0,J.useRef)(!1),T=f.trim()!==(r??``).trim();(0,J.useImperativeHandle)(u,()=>({isDirty:()=>T,discard:()=>p(r??``)})),(0,J.useEffect)(()=>{i&&S.current?.focus()},[i]);let E=f.trim(),D=E.length>Ob,O=E.length>0&&!D,k=a??[],A=v?Xb(k,v.text).slice(0,6):[],j=v!==null&&A.length>0,ee=v!==null&&k.length===0;function M(e,t){y(Yb(e,t)),x(0)}function N(e){let t=S.current;if(!v||!t)return;let n=Zb(f,v,e,t.selectionStart??f.length);t.value=n.value,t.setSelectionRange(n.caret,n.caret),t.focus(),p(n.value),y(null)}async function P(){if(!O||w.current)return;let e=E;w.current=!0,h(!0),_(null),p(``),y(null);try{await o(e)}catch(t){p(e),_(ml(t,`That didn't send. Try again.`))}finally{w.current=!1,h(!1)}}return(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsx)(`div`,{ref:C,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden whitespace-pre-wrap break-words rounded-lg px-3 py-2 text-[13px] leading-relaxed text-transparent`,children:Jb(f,k.map(e=>e.name)).map((e,t)=>e.mention?(0,Q.jsx)(`span`,{"data-testid":`comment-compose-mention`,className:`rounded bg-[var(--chrome-active)] box-decoration-clone`,children:e.text},t):(0,Q.jsx)(`span`,{children:e.text},t))}),(0,Q.jsx)(`textarea`,{ref:S,value:f,rows:2,"data-testid":l,placeholder:t,onChange:e=>{p(e.target.value),M(e.target.value,e.target.selectionStart??0)},onClick:e=>M(e.currentTarget.value,e.currentTarget.selectionStart??0),onBlur:()=>y(null),onScroll:e=>{let t=C.current;t&&(t.scrollTop=e.currentTarget.scrollTop)},onKeyDown:e=>{if(!(e.nativeEvent.isComposing||e.keyCode===229)){if((j||ee)&&e.key===`Escape`){e.preventDefault(),e.stopPropagation(),y(null);return}if(j){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;x(e=>(e+t+A.length)%A.length);return}if(e.key===`Enter`||e.key===`Tab`){e.preventDefault(),N(A[b]);return}}if(ee&&e.key===`Enter`){e.preventDefault(),y(null);return}if(e.key===`Enter`&&!e.shiftKey){e.preventDefault(),P();return}if(e.key===`Escape`&&s){if(e.preventDefault(),e.stopPropagation(),T&&d){d(s);return}s()}}},className:`${gl.field} relative resize-none leading-relaxed`}),(j||ee)&&(0,Q.jsxs)(`div`,{"data-testid":`comment-mention-list`,className:`absolute bottom-full left-0 z-10 mb-1 w-full overflow-hidden rounded-lg bg-[var(--chrome-popup)] py-1 shadow-[0_1px_2px_rgba(0,0,0,0.05),0_4px_12px_rgba(0,0,0,0.06)] ring-1 ring-[var(--chrome-ring)]`,children:[ee&&(0,Q.jsx)(`p`,{"data-testid":`comment-mention-empty`,className:`px-2 py-1.5 text-[13px] text-[var(--chrome-fg-400)]`,children:`No one to mention yet.`}),A.map((e,t)=>(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`comment-mention-option`,onPointerDown:t=>{t.preventDefault(),N(e)},onPointerEnter:()=>x(t),className:`flex w-full items-center gap-2 px-2 py-1.5 text-left text-[13px] text-[var(--chrome-fg-700)] ${t===b?`bg-[var(--chrome-hover)]`:``}`,children:[e.avatarUrl?(0,Q.jsx)(`img`,{src:e.avatarUrl,alt:``,referrerPolicy:`no-referrer`,className:`h-5 w-5 shrink-0 rounded-full object-cover`}):(0,Q.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-[var(--chrome-active)] text-[10px]`,children:ax(e.name)}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name}),e.self&&(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:`(you)`})]},e.userId))]})]}),(g||D)&&(0,Q.jsx)(`p`,{role:`alert`,"data-testid":l?`${l}-error`:void 0,className:gl.error,children:D?`Comments are limited to 4000 characters.`:g}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[k.length>0&&(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Mention someone`,"data-testid":`comment-mention-trigger`,onClick:()=>{let e=S.current;if(!e)return;let t=e.selectionStart??f.length,n=`${t>0&&!/\s/.test(f[t-1]??` `)?` `:``}@`,r=f.slice(0,t)+n+f.slice(t);p(r);let i=t+n.length;requestAnimationFrame(()=>{e.focus(),e.setSelectionRange(i,i),M(r,i)})},className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-[background-color,scale] hover:bg-[var(--chrome-hover)] active:scale-[0.96] coarse:h-11 coarse:w-11 mr-auto h-8 w-8`,children:(0,Q.jsx)(If,{size:16,stroke:1.75})}),s&&(0,Q.jsx)(`button`,{type:`button`,onClick:s,className:gl.cancelButton,children:c??`Cancel`}),(0,Q.jsx)(`button`,{type:`button`,disabled:!O||m,"data-testid":l?`${l}-submit`:void 0,onClick:()=>void P(),className:gl.submitButton,children:n})]})]})}function sx(e){let{author:t,size:n=`md`,testId:r}=e,i=n===`sm`?`h-4 w-4 text-[9px]`:`h-6 w-6 text-[11px]`;return t.avatarUrl?(0,Q.jsx)(`img`,{src:t.avatarUrl,alt:``,"data-testid":r,referrerPolicy:`no-referrer`,className:`${i} shrink-0 rounded-full object-cover`}):(0,Q.jsx)(`span`,{"data-testid":r,className:`${i} flex shrink-0 items-center justify-center rounded-full bg-[var(--chrome-active)] text-[var(--chrome-fg-700)]`,children:ax(t.name)})}function cx(e){let{text:t,names:n}=e;return(0,Q.jsx)(`p`,{className:`whitespace-pre-wrap break-words text-[13px] leading-relaxed text-[var(--chrome-fg-700)]`,children:Jb(t,n).map((e,t)=>e.mention?(0,Q.jsx)(`span`,{"data-testid":`comment-mention`,className:`whitespace-nowrap rounded bg-[var(--chrome-active)] px-0.5 text-[var(--chrome-fg-900)]`,children:e.text},t):(0,Q.jsx)(`span`,{children:e.text},t))})}function lx(e){let{comment:t,isRoot:n,comments:r,names:i,now:a,editing:o,onEdit:s,onEditDone:c,composerRef:l,confirmDiscard:u}=e,[d,f]=(0,J.useState)(!1),p=t.author.id!==null&&t.author.id===r.currentUser?.id,m=!n&&(p||r.canModerate);return o?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2 px-3 py-2`,children:(0,Q.jsx)(ox,{placeholder:`Edit your comment`,submitLabel:`Save`,cancelLabel:`Discard`,initialValue:t.body,members:r.members,autoFocus:!0,testId:`comment-edit`,handleRef:l,confirmDiscard:u,onCancel:c,onSubmit:async e=>{await r.update(t.id,e,Qb(e,r.members)),c()}})}):(0,Q.jsxs)(`div`,{className:`group/comment flex gap-2 px-3 py-2`,"data-testid":`comment-row`,children:[(0,Q.jsx)(sx,{author:t.author}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-1.5`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[13px] text-[var(--chrome-fg-900)]`,children:t.author.name}),(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] text-[var(--chrome-fg-400)]`,children:ix(t.createdAt,a)}),t.editedAt!==null&&(0,Q.jsx)(`span`,{className:`shrink-0 text-[11px] italic text-[var(--chrome-fg-400)]`,children:`edited`})]}),(0,Q.jsx)(cx,{text:t.body,names:i})]}),(p||m)&&(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Comment actions`,"data-testid":`comment-actions`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-[background-color,scale] hover:bg-[var(--chrome-hover)] active:scale-[0.96] coarse:h-11 coarse:w-11 h-6 w-6 shrink-0 opacity-0 coarse:h-8 coarse:w-8 coarse:opacity-100 group-hover/comment:opacity-100 data-[popup-open]:opacity-100`,children:(0,Q.jsx)(R,{size:15,stroke:1.75})})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`end`,sideOffset:4,className:`outline-none`,children:(0,Q.jsxs)(ne,{"data-overlay":!0,className:`min-w-36 p-1`,children:[p&&(0,Q.jsx)(F,{"data-testid":`comment-edit-action`,onClick:s,children:`Edit`}),m&&(0,Q.jsx)(F,{"data-testid":`comment-delete-action`,onClick:()=>f(!0),className:`text-[var(--chrome-danger)]`,children:`Delete`})]})})})]}),(0,Q.jsx)(Pb,{open:d,onOpenChange:f,title:`Delete this comment?`,description:`This reply will be removed. This can't be undone.`,confirmLabel:`Delete`,destructive:!0,testId:`comment-delete-confirm`,onConfirm:()=>r.remove(t.id)})]})}function ux(e,t){let n=e.comments[0];return n?.author.id!=null&&n.author.id===t.currentUser?.id||t.canModerate}function dx(e){let{thread:t,comments:n,onCloseThread:r,onDeleteRequest:i}=e,{notify:a}=_(),o=t.resolvedAt!==null;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{"data-testid":`comment-resolve-action`,onClick:()=>{n.resolve(t.id,!o).catch(e=>a(ml(e,`Couldn't update the thread. Try again.`))),o||r()},children:o?`Reopen thread`:`Resolve thread`}),ux(t,n)&&(0,Q.jsx)(F,{"data-testid":`comment-delete-thread-action`,onClick:i,className:`text-[var(--chrome-danger)]`,children:`Delete thread`})]})}function fx(e){let{open:t,onOpenChange:n,onConfirm:r}=e;return(0,Q.jsx)(Pb,{open:t,onOpenChange:n,title:`Delete this thread?`,description:`The pin and every reply under it will be removed. This can't be undone.`,confirmLabel:`Delete`,destructive:!0,testId:`comment-delete-confirm`,onConfirm:r})}function px(e){let{thread:t,comments:n,onClose:r,now:i,composerRef:a,confirmDiscard:o}=e,[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),p=t.comments.length,m=t.resolvedAt!==null,h=n.members.map(e=>e.name);return(0,Q.jsxs)(`div`,{className:`flex w-[304px] flex-col`,"data-testid":`comment-thread`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-[var(--chrome-divider)] py-1.5 pl-3 pr-1.5`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[12px] text-[var(--chrome-fg-500)]`,children:[m&&(0,Q.jsxs)(`span`,{"data-testid":`comment-resolved-tag`,className:`flex items-center gap-1 text-[var(--chrome-fg-400)]`,children:[(0,Q.jsx)(Ts,{size:13,stroke:2}),`Resolved`]}),(0,Q.jsxs)(`span`,{"data-testid":`comment-count`,children:[p,` `,p===1?`comment`:`comments`]})]}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Thread actions`,"data-testid":`comment-thread-actions`,className:`${Jc} h-7 w-7 coarse:h-9 coarse:w-9`,children:(0,Q.jsx)(R,{size:15,stroke:1.75})})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`end`,sideOffset:4,className:`outline-none`,children:(0,Q.jsx)(ne,{"data-overlay":!0,className:`min-w-40 p-1`,children:(0,Q.jsx)(dx,{thread:t,comments:n,onCloseThread:r,onDeleteRequest:()=>c(!0)})})})})]})]}),(0,Q.jsx)(`div`,{className:`scrollbar-slim max-h-[320px] divide-y divide-[var(--chrome-divider)] overflow-y-auto`,children:t.comments.map((e,t)=>(0,Q.jsx)(lx,{comment:e,editing:d===e.id,onEdit:()=>{u(!1),f(e.id)},onEditDone:()=>f(null),composerRef:d===e.id?a:void 0,confirmDiscard:o,isRoot:t===0,comments:n,names:h,now:i},e.id))}),d===null&&(0,Q.jsx)(`div`,{className:`border-t border-[var(--chrome-divider)] p-2`,children:l?(0,Q.jsx)(ox,{placeholder:m?`Reply and reopen…`:`Reply…`,submitLabel:`Reply`,members:n.members,autoFocus:!0,testId:`comment-reply`,handleRef:a,confirmDiscard:o,onCancel:()=>u(!1),onSubmit:async e=>{await n.reply(t.id,e,Qb(e,n.members)),u(!1)}}):(0,Q.jsx)(`button`,{type:`button`,"data-testid":`comment-reply-open`,onClick:()=>u(!0),className:`w-full rounded-lg px-3 py-2 text-left text-[13px] text-[var(--chrome-fg-400)] outline-none ring-1 ring-[var(--chrome-input)] transition-shadow hover:ring-[var(--chrome-input-hover)]`,children:m?`Reply and reopen…`:`Add a reply…`})}),(0,Q.jsx)(fx,{open:s,onOpenChange:c,onConfirm:()=>n.remove(t.id)})]})}function mx(e){let{members:t,onSubmit:n,onCancel:r,composerRef:i,confirmDiscard:a}=e;return(0,Q.jsxs)(`div`,{className:`flex w-[304px] flex-col`,"data-testid":`comment-draft`,children:[(0,Q.jsx)(`div`,{className:`border-b border-[var(--chrome-divider)] py-1.5 pl-3 pr-1.5 text-[12px] text-[var(--chrome-fg-500)]`,children:`New comment`}),(0,Q.jsx)(`div`,{className:`p-2`,children:(0,Q.jsx)(ox,{placeholder:`Leave a note…`,submitLabel:`Comment`,members:t,autoFocus:!0,testId:`comment-new`,handleRef:i,confirmDiscard:a,onCancel:r,onSubmit:n})})]})}var hx=Wc.popup,gx=6e4,_x=4,vx=new Map;function yx(e,t){let n=G(e,t);return{left:n.x,top:n.y-28}}function bx(e){let{at:t,viewport:n,open:r,onOpenChange:i,label:a,testId:o,muted:s,unread:c,dragging:l,pending:u,movable:d,author:f,badge:p,card:m,menu:h,onPointerDown:g}=e,_=yx(t,n),v=(0,Q.jsxs)(mc,{open:r,onOpenChange:i,children:[(e=>f?(0,Q.jsx)(S,{label:f.name,shortcut:d&&!u?`Drag to move`:void 0,side:`top`,disabled:r||l,testId:`comment-pin-tooltip`,leading:(0,Q.jsx)(sx,{author:f,size:`sm`,testId:`comment-pin-tooltip-avatar`}),children:e}):e)((0,Q.jsx)(ca,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":a,"data-testid":o,"data-resolved":s?`true`:void 0,"data-unread":c?`true`:void 0,"data-pending":u?`true`:void 0,onPointerDown:u||!d?void 0:g,className:`pointer-events-auto absolute flex touch-none items-center justify-center rounded-full rounded-bl-[3px] text-[11px] transition-shadow ${c?`ring-2`:`ring-1`} ${u||!d?`cursor-pointer`:l?`cursor-grabbing`:`cursor-grab`} ${s?`text-[var(--chrome-fg-500)]`:`text-[#1e1e1e]`} ${r?`shadow-[0_3px_10px_rgba(0,0,0,0.20)]`:`shadow-[0_1px_2px_rgba(0,0,0,0.10)] hover:shadow-[0_2px_6px_rgba(0,0,0,0.16)]`} ${c?`ring-[var(--chrome-unread)]`:s?`ring-[var(--chrome-ring)]`:`ring-black/10`}`,style:{left:_.left,top:_.top,width:28,height:28,backgroundColor:s?`var(--chrome-popup)`:xi},children:p})})),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`right`,align:`start`,sideOffset:8,collisionPadding:12,children:(0,Q.jsx)(Tc,{"data-overlay":!0,className:hx,children:m})})})]});return h?(0,Q.jsx)(`div`,{style:{display:`contents`},onContextMenu:e=>e.stopPropagation(),children:(0,Q.jsxs)(Ps,{children:[(0,Q.jsx)(Rs,{render:(0,Q.jsx)(`div`,{style:{display:`contents`}}),children:v}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`outline-none`,children:(0,Q.jsx)(ne,{"data-overlay":!0,"data-testid":`comment-pin-menu`,className:`min-w-40 p-1`,children:h})})})]})}):v}function xx(e){let{at:t,viewport:n}=e,r=yx(t,n);return(0,Q.jsx)(`div`,{"data-testid":`comment-ghost-pin`,className:`pointer-events-none absolute flex items-center justify-center rounded-full rounded-bl-[3px] text-[#1e1e1e] opacity-50 ring-1 ring-black/10`,style:{left:r.left,top:r.top,width:28,height:28,backgroundColor:xi},children:(0,Q.jsx)(as,{size:14,stroke:1.75})})}function Sx(e){let{viewport:t}=e,n=ie(),r=V(),i=U(),a=H(e=>e.shapes),o=H(e=>e.openThreadId),s=H(e=>e.commentDraft),c=H(e=>e.commentsVisible),l=H(e=>e.tool===`comment`?e.hoverWorld:null),u=H(e=>e.presentingIndex!==null),d=H(e=>e.zenMode),[f,p]=(0,J.useState)(()=>Date.now()),[m,h]=(0,J.useState)(null),[g,v]=(0,J.useState)(null),y=(0,J.useRef)({at:null,moved:!1,grab:{x:0,y:0}}),[b,x]=(0,J.useState)(null),S=(0,J.useRef)(null),C=(0,J.useRef)(null),[w,T]=(0,J.useState)(!1),E=(0,J.useRef)(null),[D,O]=(0,J.useState)(null),{notify:k}=_(),A=(0,J.useRef)(null);Ub(),rx(),tx(o);let j=o!==null||s!==null;(0,J.useEffect)(()=>{if(!j)return;p(Date.now());let e=setInterval(()=>p(Date.now()),gx);return()=>clearInterval(e)},[j]);let ee=n!==null&&!u&&!d&&c&&(n.threads.length>0||s!==null),M=(0,J.useMemo)(()=>ee?(Yr(a),{get:e=>xr(a,e)}):vx,[ee,a]),N=qb(ee?n.threads:null,M),P=(0,J.useRef)(null);if((0,J.useEffect)(()=>{if(!s){P.current=null;return}let e=i.getState().shapes;P.current={draft:s,anchor:Ib(s,{get:t=>xr(e,t)},cg())}},[s,i]),(0,J.useEffect)(()=>{if(m===null)return;let e=document.querySelector(`[data-canvas-root]`),t=t=>{let n=e?.getBoundingClientRect(),r=Cr({x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)},i.getState().viewport),{grab:a}=y.current,o={x:r.x-a.x,y:r.y-a.y};y.current={...y.current,at:o,moved:!0},v(o)},a=()=>{let{at:e,moved:t}=y.current;if(y.current={at:null,moved:!1,grab:{x:0,y:0}},t){let e=e=>{e.stopPropagation(),e.preventDefault()};window.addEventListener(`click`,e,{capture:!0,once:!0}),setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),0)}if(h(null),v(null),!t||!e||!n)return;let a=i.getState().shapes,o=zm(a,e,r.measurement);x({id:m,at:e}),Ib(o,{get:e=>xr(a,e)},cg()).then(e=>n.move(m,e)).catch(e=>k(ml(e,`Couldn't move that pin. Try again.`))).finally(()=>x(null))},o=()=>{y.current={at:null,moved:!1,grab:{x:0,y:0}},h(null),v(null)};return window.addEventListener(`pointermove`,t),window.addEventListener(`pointerup`,a),window.addEventListener(`pointercancel`,o),()=>{window.removeEventListener(`pointermove`,t),window.removeEventListener(`pointerup`,a),window.removeEventListener(`pointercancel`,o)}},[m,n,r,i,k]),!n||u||d||!c)return null;let{setOpenThreadId:F,setCommentDraft:I}=i.getState();function te(e,t){if(e?.isDirty()){E.current=t,T(!0);return}t()}let ne=e=>{let t=N.get(e.id),n=t&&e.anchor.kind===`shape`?M.get(e.anchor.shapeId):null;return t&&n?Rb(e.anchor,n,t):e.anchor},L=[];for(let e of n.threads){let t=m===e.id&&g?g:b?.id===e.id?b.at:Bm(ne(e),M,r.measurement);t&&L.push({thread:e,at:t})}let R=s?Bm(s,M,r.measurement):null;R&&(A.current=R);let z=s?R??A.current:null,B=s&&!R&&z?{kind:`point`,x:z.x,y:z.y}:s,re=n.currentUser?.id??null;return(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute inset-0`,"data-overlay":!0,"data-testid":`comment-pins`,children:[l&&!s&&(0,Q.jsx)(xx,{at:l,viewport:t}),L.map(({thread:e,at:r})=>{let a=e.resolvedAt!==null;return(0,Q.jsx)(bx,{at:r,viewport:t,open:o===e.id&&m===null,muted:a,unread:$b(n,e.id)>0,dragging:m===e.id,pending:Ab(e.id),movable:n.canModerate||re!==null&&e.comments[0]?.author.id===re,author:e.comments[0]?.author,menu:Ab(e.id)?void 0:(0,Q.jsx)(dx,{thread:e,comments:n,onCloseThread:()=>F(null),onDeleteRequest:()=>O(e.id)}),onOpenChange:t=>{if(!t){te(C.current,()=>F(null));return}F(e.id)},onPointerDown:t=>{if(t.button!==0)return;let n=document.querySelector(`[data-canvas-root]`)?.getBoundingClientRect(),a=Cr({x:t.clientX-(n?.left??0),y:t.clientY-(n?.top??0)},i.getState().viewport),o=n=>{Math.hypot(n.clientX-t.clientX,n.clientY-t.clientY)<_x||(s(),F(null),y.current={at:r,moved:!1,grab:{x:a.x-r.x,y:a.y-r.y}},h(e.id),v(r))},s=()=>{window.removeEventListener(`pointermove`,o),window.removeEventListener(`pointerup`,s),window.removeEventListener(`pointercancel`,s)};window.addEventListener(`pointermove`,o),window.addEventListener(`pointerup`,s),window.addEventListener(`pointercancel`,s)},label:`Comment thread, ${e.comments.length} ${e.comments.length===1?`comment`:`comments`}`,testId:`comment-pin`,badge:a?(0,Q.jsx)(Ts,{size:14,stroke:2.25,"data-testid":`comment-pin-resolved`}):(0,Q.jsx)(`span`,{"data-testid":`comment-pin-count`,children:e.comments.length}),card:(0,Q.jsx)(px,{thread:e,comments:n,onClose:()=>F(null),now:f,composerRef:C,confirmDiscard:e=>te(C.current,e)})},e.id)}),s&&z&&(0,Q.jsx)(bx,{at:z,viewport:t,open:!0,onOpenChange:e=>{e||te(S.current,()=>I(null))},label:`New comment`,testId:`comment-draft-pin`,badge:(0,Q.jsx)(as,{size:14,stroke:1.75}),card:(0,Q.jsx)(mx,{members:n.members,composerRef:S,confirmDiscard:e=>te(S.current,e),onCancel:()=>I(null),onSubmit:async e=>{let t=P.current,r=B===s&&t?.draft===s?await t.anchor:B??s;await n.createThread({body:e,anchor:r,mentions:Qb(e,n.members)}),I(null)}})}),(0,Q.jsx)(Pb,{open:w,onOpenChange:e=>{T(e),e||(E.current=null)},title:`Discard this comment?`,description:`You've written something that hasn't been posted yet. Discarding throws it away.`,confirmLabel:`Discard`,destructive:!0,testId:`comment-discard-confirm`,onConfirm:()=>{S.current?.discard(),C.current?.discard(),E.current?.(),E.current=null}}),(0,Q.jsx)(fx,{open:D!==null,onOpenChange:e=>{e||O(null)},onConfirm:()=>{D&&n.remove(D).catch(e=>k(ml(e,`Couldn't delete that thread. Try again.`)))}})]})}var Cx=[{value:`table`,label:`Table`,Icon:Zo},{value:`bar`,label:`Bar`,Icon:Go},{value:`line`,label:`Line`,Icon:ps},{value:`pie`,label:`Pie`,Icon:us}];function wx(e){let{onPick:t,onCancel:n}=e;return(0,J.useEffect)(()=>{function e(e){e.key===`Escape`?(e.preventDefault(),n()):e.key===`Enter`&&(e.preventDefault(),t(`table`))}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n,t]),(0,Q.jsx)(`div`,{className:`absolute inset-0 z-20 flex items-center justify-center`,"data-overlay":!0,onPointerDown:n,children:(0,Q.jsxs)(`div`,{"data-testid":`paste-chooser`,className:`rounded-xl p-2.5 ${tl}`,onPointerDown:e=>e.stopPropagation(),children:[(0,Q.jsx)(`div`,{className:`mb-1.5 px-1 text-[12px] text-[var(--chrome-fg-500)]`,children:`Paste as`}),(0,Q.jsx)(`div`,{className:`flex gap-1.5`,children:Cx.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`paste-as-${e.value}`,onClick:()=>t(e.value),className:`flex h-[72px] w-[72px] flex-col items-center justify-center gap-1.5 rounded-lg bg-[var(--chrome-rest)] text-[var(--chrome-fg-600)] transition-colors hover:bg-blue-600/10 hover:text-blue-600`,children:[(0,Q.jsx)(e.Icon,{size:22,stroke:1.5}),(0,Q.jsx)(`span`,{className:`text-[12px]`,children:e.label})]},e.value))})]})})}function Tx(e){let{shape:t,point:n}=e,r=V().measurement,i=t.type===`icon`&&!!t.label,a=i?cn(t,r):W(t,r),o=i?0:an(t),s=a.x+a.width/2,c=a.y+a.height/2;return(0,Q.jsxs)(`g`,{style:{pointerEvents:`none`},children:[(0,Q.jsx)(`rect`,{"data-testid":`bind-highlight`,x:a.x-4,y:a.y-4,width:a.width+8,height:a.height+8,transform:o?`rotate(${o} ${s} ${c})`:void 0,rx:10,fill:`none`,stroke:`var(--canvas-selection)`,strokeWidth:2,strokeDasharray:`4 4`}),(0,Q.jsx)(`circle`,{cx:n.x,cy:n.y,r:5,fill:`var(--canvas-selection)`,stroke:`#fff`,strokeWidth:1.5})]})}var Ex=`--min-world-stroke`,Dx=`--min-world-hit`,Ox=.5;function kx(e){return`max(${e}px, var(${Dx}, 0px))`}function Ax(e){let t=Number(e[`stroke-width`]),n=e.stroke;return!Number.isFinite(t)||t<=0||!n||n===`none`?{}:{strokeWidth:`max(${t}px, var(${Ex}, 0px))`}}var jx=34;function Mx(e){return e.split(/[ ,]+/).reduce((e,t)=>e+(Number(t)||0),0)}function Nx(e){let{node:t,reverse:n,testid:r}=e,i=Mx(String(t.attrs[`stroke-dasharray`]??``));if(!i)return(0,Q.jsx)(Lx,{node:t,testid:r});let a=Math.max(.1,i/jx);return(0,Q.jsx)(`path`,{...Ix(t.attrs,`ink`),style:Ax(t.attrs),"data-testid":r,children:(0,Q.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:n?0:i,to:n?i:0,dur:`${a.toFixed(2)}s`,repeatCount:`indefinite`})})}function Px(e){let{d:t,color:n,strokeWidth:r,startHead:i,endHead:a,reverse:o,testid:s}=e,c=(0,J.useRef)(null),[l,u]=(0,J.useState)(null);(0,J.useEffect)(()=>{let e=c.current;if(!e)return;let t=e.getTotalLength(),n=Kt(r),o=e=>(e?Ut(n,e,t):0)+r*1.5,s=o(i),l=t-o(a);if(!(l>s+1)){u(null);return}let d=[];for(let t=s;t<l;t+=6){let n=e.getPointAtLength(t);d.push(`${n.x.toFixed(1)} ${n.y.toFixed(1)}`)}let f=e.getPointAtLength(l);d.push(`${f.x.toFixed(1)} ${f.y.toFixed(1)}`),u(`M ${d.join(` L `)}`)},[t,r,i,a]);let d=Math.max(14,r*5),f=d+.01,p=Math.max(.1,f/jx);return(0,Q.jsxs)(`g`,{style:{pointerEvents:`none`},children:[(0,Q.jsx)(`path`,{ref:c,d:t,fill:`none`,stroke:`none`}),l&&(0,Q.jsx)(`path`,{"data-testid":s,d:l,fill:`none`,stroke:n,strokeWidth:r*2.2,strokeLinecap:`round`,strokeDasharray:`0.01 ${d}`,children:(0,Q.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:o?0:f,to:o?f:0,dur:`${p.toFixed(2)}s`,repeatCount:`indefinite`})})]})}var Fx={"fill-opacity":`fillOpacity`,"stroke-width":`strokeWidth`,"stroke-opacity":`strokeOpacity`,"stroke-dasharray":`strokeDasharray`,"stroke-linecap":`strokeLinecap`,"stroke-linejoin":`strokeLinejoin`};function Ix(e,t=`keep`,n){let r={};for(let[i,a]of Object.entries(e))r[Fx[i]??i]=typeof a==`string`?mn(i,a,t,Dn,Vt,n):a;return r}function Lx(e){let{node:t,testid:n,fillMode:r,tint:i}=e,a=t.tag;return(0,Q.jsx)(a,{"data-testid":n,...Ix(t.attrs,r,i),style:{pointerEvents:`none`,...Ax(t.attrs)}})}function Rx(e){let{shape:t,interactive:n,selected:r,erasing:i,onPointerDown:a,onBeginEdit:o,onHover:s}=e;my(`shape:${t.id}`);let c=W(t),l=n&&(!_n(t)||!!r),u=(0,J.useMemo)(()=>ao(t),[t]),d=(0,J.useMemo)(()=>{let e=it(t);return e?hr(e):void 0},[t]);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-shape-kind":t.kind,"data-testid":`node`,transform:`translate(${c.x} ${c.y}) rotate(${t.rotation??0} ${c.width/2} ${c.height/2})`,opacity:Ic(t.opacity,i),children:[u.shadow&&(0,Q.jsx)(Lx,{node:u.shadow,testid:`node-shadow`}),u.fill&&(0,Q.jsx)(Lx,{node:u.fill,testid:`node-fill`,fillMode:t.fill===`#ffffff`?`paper`:`keep`,tint:d}),(0,Q.jsx)(`path`,{"data-testid":`node-hit`,d:u.fillPath,fill:`transparent`,stroke:`none`,style:{pointerEvents:l?`all`:`none`},onPointerDown:e=>a(t.id,e),onDoubleClick:()=>n&&o(t.id),...Lc(t.id,s)}),u.strokes.map((e,t)=>(0,Q.jsx)(Lx,{node:e,testid:`node-stroke`,tint:d},t)),(0,Q.jsx)(`path`,{"data-testid":`node-border-hit`,d:u.hitPath,fill:`none`,stroke:`transparent`,strokeWidth:Math.max(16,t.strokeWidth+12),style:{pointerEvents:n?`stroke`:`none`,strokeWidth:kx(Math.max(16,t.strokeWidth+12))},onPointerDown:e=>a(t.id,e),onDoubleClick:()=>n&&o(t.id),...Lc(t.id,s)})]})}var zx=(0,J.memo)(Rx);function Bx(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=W(t),c=po(t);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`sticky`,transform:`translate(${s.x} ${s.y}) rotate(${t.rotation??0} ${s.width/2} ${s.height/2})`,opacity:Ic(t.opacity,r),children:[(0,Q.jsx)(Lx,{node:c.shadow}),(0,Q.jsx)(`rect`,{"data-testid":`sticky-fill`,...c.card.attrs,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)})]})}var Vx=(0,J.memo)(Bx),Hx=14;function Ux(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=W(t),c=an(t),l=s.x+s.width/2,u=s.y+s.height/2,d=(0,J.useMemo)(()=>go(t),[t]);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`figure`,transform:c?`rotate(${c} ${l} ${u})`:void 0,opacity:Ic(t.opacity,r),children:[(0,Q.jsxs)(`g`,{style:{pointerEvents:`none`},children:[(0,Q.jsx)(Lx,{node:d.outline,fillMode:`paper`}),d.chrome.map((e,t)=>(0,Q.jsx)(Lx,{node:e},t))]}),(0,Q.jsx)(`rect`,{"data-testid":`figure-hit`,x:s.x,y:s.y,width:s.width,height:s.height,rx:10,fill:`none`,stroke:`transparent`,strokeWidth:Hx,style:{pointerEvents:n?`stroke`:`none`,strokeWidth:kx(Hx)},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)}),Mo(t.kind)&&(0,Q.jsxs)(`g`,{style:{pointerEvents:n?`all`:`none`},children:[(0,Q.jsx)(`rect`,{"data-testid":`lanes-gutter-hit`,x:s.x,y:s.y,width:Po(t.kind)?s.width:30,height:Po(t.kind)?30:s.height,fill:`transparent`,onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)}),Eo(t.lanes?.length??0,Po(t.kind)?s.width:s.height,t.laneSizes).slice(1,-1).map((e,r)=>Po(t.kind)?(0,Q.jsx)(`rect`,{x:s.x+e-6,y:s.y,width:12,height:s.height,fill:`transparent`,onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)},r):(0,Q.jsx)(`rect`,{x:s.x,y:s.y+e-6,width:s.width,height:12,fill:`transparent`,onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)},r))]})]})}var Wx=(0,J.memo)(Ux);function Gx(e){let{shape:t,path:n,kind:r}=e,i=(0,J.useMemo)(()=>lo(t),[t]),a=t.startArrow&&!t.endArrow;return(0,Q.jsxs)(Q.Fragment,{children:[i.strokes.map((e,n)=>t.flow&&t.dash!==`solid`?(0,Q.jsx)(Nx,{node:e,reverse:a,testid:`${r}-flow`},n):(0,Q.jsx)(Lx,{node:e,testid:`${r}-stroke`},n)),t.flow&&t.dash===`solid`&&(0,Q.jsx)(Px,{d:n,color:Dn(t.color),strokeWidth:t.strokeWidth,startHead:t.startArrow?t.startHead??`arrow`:null,endHead:t.endArrow?t.endHead??`arrow`:null,reverse:a,testid:`${r}-flow`}),i.heads.map((e,t)=>(0,Q.jsx)(Lx,{node:e,fillMode:`ink`,testid:`${r}-head`},`head-${t}`))]})}function Kx(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=qn(t);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`arrow`,opacity:Ic(t.opacity,r),onPointerDown:e=>i(t.id,e),onDoubleClick:e=>{n&&(e.stopPropagation(),a(t.id))},...Lc(t.id,o),children:[(0,Q.jsx)(`path`,{"data-testid":`arrow-path`,d:s,fill:`none`,stroke:`transparent`,strokeWidth:16,style:{pointerEvents:n?`stroke`:`none`,strokeWidth:kx(16)}}),(0,Q.jsx)(Gx,{shape:t,path:s,kind:`arrow`})]})}var qx=(0,J.memo)(Kx);function Jx(e){let{shape:t,interactive:n,cropping:r,erasing:i,onPointerDown:a,onBeginCrop:o,onHover:s}=e,c=W(t),l=c.x+c.width/2,u=c.y+c.height/2,d=Un(c,t.crop),f=On(t.corner,c),p=`imgclip-${t.id}`,m=t.flipX||t.flipY,h=`rotate(${t.rotation??0} ${l} ${u})`+(m?` translate(${l} ${u}) scale(${t.flipX?-1:1} ${t.flipY?-1:1}) translate(${-l} ${-u})`:``);return r?(0,Q.jsxs)(`g`,{transform:h,children:[(0,Q.jsx)(`image`,{href:t.src,x:d.x,y:d.y,width:d.width,height:d.height,preserveAspectRatio:`none`,opacity:.4,style:{pointerEvents:`none`}}),(0,Q.jsx)(`clipPath`,{id:p,children:(0,Q.jsx)(`rect`,{x:c.x,y:c.y,width:c.width,height:c.height,rx:f})}),(0,Q.jsx)(`image`,{href:t.src,x:d.x,y:d.y,width:d.width,height:d.height,preserveAspectRatio:`none`,clipPath:`url(#${p})`,style:{pointerEvents:`none`}})]}):(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`image`,transform:h,opacity:Ic(t.opacity,i),children:[(0,Q.jsx)(`clipPath`,{id:p,children:(0,Q.jsx)(`rect`,{x:c.x,y:c.y,width:c.width,height:c.height,rx:f})}),(0,Q.jsx)(`image`,{"data-testid":`image-hit`,href:t.src,x:d.x,y:d.y,width:d.width,height:d.height,preserveAspectRatio:`none`,clipPath:`url(#${p})`,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>a(t.id,e),onDoubleClick:()=>n&&o(t.id),...Lc(t.id,s)})]})}var Yx=(0,J.memo)(Jx);function Xx(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onHover:a}=e,o=(0,J.useMemo)(()=>ro(t),[t]);return(0,Q.jsx)(`path`,{"data-shape-id":t.id,"data-testid":`draw`,...Ix(o.attrs,`ink`),opacity:Ic(t.opacity,r),"data-highlighter":t.highlighter?``:void 0,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>i(t.id,e),...Lc(t.id,a)})}var Zx=(0,J.memo)(Xx);function Qx(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginVertexEdit:a,onHover:o}=e,s=yo(t.points,t.smooth);return(0,Q.jsx)(`path`,{"data-shape-id":t.id,"data-testid":`polygon`,d:s,fill:t.fill,stroke:t.color,strokeWidth:t.strokeWidth,opacity:Ic(t.opacity,r),style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)})}var $x=(0,J.memo)(Qx);function eS(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=Fr(t.points);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`line`,opacity:Ic(t.opacity,r),onPointerDown:e=>i(t.id,e),onDoubleClick:e=>{n&&(e.stopPropagation(),a(t.id))},...Lc(t.id,o),children:[(0,Q.jsx)(`path`,{"data-testid":`line-path`,d:s,fill:`none`,stroke:`transparent`,strokeWidth:16,strokeLinejoin:`round`,strokeLinecap:`round`,style:{pointerEvents:n?`stroke`:`none`,strokeWidth:kx(16)}}),(0,Q.jsx)(Gx,{shape:t,path:s,kind:`line`})]})}var tS=(0,J.memo)(eS);function nS(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=W(t),c=s.x+s.width/2,l=s.y+s.height/2,u=t.flipX||t.flipY,d=`rotate(${t.rotation??0} ${c} ${l})`+(u?` translate(${c} ${l}) scale(${t.flipX?-1:1} ${t.flipY?-1:1}) translate(${-c} ${-l})`:``);return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`icon`,transform:d,opacity:Ic(t.opacity,r),children:[(0,Q.jsx)(`rect`,{"data-testid":`icon-hit`,x:s.x,y:s.y,width:s.width,height:s.height,fill:`transparent`,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a(t.id),...Lc(t.id,o)}),Li(t.source)?Ii(t.source)?(0,Q.jsx)(rS,{shape:t,bounds:s}):(0,Q.jsx)(`image`,{href:Ri().assetIconUrl(t.source,t.name),x:s.x,y:s.y,width:s.width,height:s.height,style:{pointerEvents:`none`}}):(0,Q.jsx)(aS,{shape:t,bounds:s})]})}function rS(e){let{shape:t,bounds:n}=e,r=yl(t.source,t.name),i=(0,J.useMemo)(()=>({__html:r?.inner??``}),[r?.inner]);if(!r||!(n.width>0)||!(n.height>0))return null;let a=iS(r.viewBox,n),o=cr(t.strokeWidth,n.width)/a,s=`mono-erode-${t.id}`;return(0,Q.jsxs)(`svg`,{x:n.x,y:n.y,width:n.width,height:n.height,viewBox:r.viewBox,fill:`currentColor`,overflow:`visible`,stroke:o>0?`currentColor`:`none`,strokeWidth:o>0?o:void 0,strokeLinejoin:`round`,strokeLinecap:`round`,style:{color:Dn(t.color),pointerEvents:`none`},children:[o<0&&(0,Q.jsx)(`filter`,{id:s,children:(0,Q.jsx)(`feMorphology`,{operator:`erode`,radius:-o/4})}),(0,Q.jsx)(`g`,{filter:o<0?`url(#${s})`:void 0,dangerouslySetInnerHTML:i})]})}function iS(e,t){let n=e.trim().split(/[\s,]+/).map(Number),[,,r,i]=n;return n.length!==4||!(r>0)||!(i>0)?1:Math.min(t.width/r,t.height/i)}function aS(e){let{shape:t,bounds:n}=e,r=_l(t.name);return r?(0,Q.jsx)(bl,{node:r,at:{x:n.x,y:n.y},size:n.width,stroke:Dn(t.color),strokeWidth:ir(t.strokeWidth,n.width),style:{pointerEvents:`none`}}):null}var oS=(0,J.memo)(nS);function sS(e){let{prim:t}=e;return t.kind===`rect`?(0,Q.jsx)(`rect`,{"data-testid":t.testId,x:t.x,y:t.y,width:t.width,height:Math.max(0,t.height),rx:t.rx,fill:Wt(t.fill),style:{pointerEvents:`none`}}):t.kind===`line`?(0,Q.jsx)(`line`,{"data-testid":t.testId,x1:t.x1,y1:t.y1,x2:t.x2,y2:t.y2,stroke:Wt(t.stroke),strokeWidth:t.width,style:{pointerEvents:`none`}}):t.kind===`polyline`?(0,Q.jsx)(`polyline`,{"data-testid":t.testId,points:t.points.map(e=>`${e.x},${e.y}`).join(` `),fill:`none`,stroke:Wt(t.stroke),strokeWidth:t.width,strokeLinecap:`round`,strokeLinejoin:`round`,style:{pointerEvents:`none`}}):t.kind===`path`?(0,Q.jsx)(`path`,{"data-testid":t.testId,d:t.d,fill:sn(t.fill)??`none`,fillOpacity:t.fillOpacity,stroke:sn(t.stroke)??`none`,strokeWidth:t.width,style:{pointerEvents:`none`}}):t.kind===`circle`?(0,Q.jsx)(`circle`,{"data-testid":t.testId,cx:t.cx,cy:t.cy,r:t.r,fill:Wt(t.fill),stroke:sn(t.stroke),strokeWidth:t.width,style:{pointerEvents:`none`}}):(0,Q.jsx)(`text`,{"data-testid":t.testId,x:t.x,y:t.y,fontFamily:t.family,fontSize:t.size,fill:Wt(t.color),textAnchor:t.anchor,dominantBaseline:t.baseline,transform:t.rotate?`rotate(${t.rotate} ${t.x} ${t.y})`:void 0,style:{pointerEvents:`none`},children:t.text})}function cS(e){let{shape:t,mark:n}=e,r=t.fontSize,i=n.label.split(`
|
|
17
|
+
`),a=r*1.3,o=Math.max(...i.map(e=>e.length))*r*.58+12,s=i.length*a+12,c=n.tipX-o/2;c=Math.max(t.x+2,Math.min(c,t.x+t.width-o-2));let l=n.tipY-8-s;return l<t.y&&(l=n.tipY+10),(0,Q.jsxs)(`g`,{"data-testid":`chart-tooltip`,style:{pointerEvents:`none`},children:[(0,Q.jsx)(`rect`,{x:c,y:l,width:o,height:s,rx:6,fill:`#1e1e1e`,opacity:.92}),i.map((e,n)=>(0,Q.jsx)(`text`,{x:c+6,y:l+6+n*a,fontFamily:t.fontFamily,fontSize:r,fill:`#ffffff`,dominantBaseline:`hanging`,children:e},n))]})}function lS(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEdit:a,onHover:o}=e,s=W(t),c=an(t),l=s.x+s.width/2,u=s.y+s.height/2,d=(0,J.useMemo)(()=>vo(t),[t]),[f,p]=(0,J.useState)(null),m=f==null?null:d.marks[f];return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`chart`,transform:c?`rotate(${c} ${l} ${u})`:void 0,opacity:Ic(t.opacity,r),children:[(0,Q.jsx)(`rect`,{x:s.x,y:s.y,width:s.width,height:s.height,rx:4,fill:`var(--paper-bg)`,style:{pointerEvents:`none`}}),d.prims.map((e,t)=>(0,Q.jsx)(sS,{prim:e},t)),(0,Q.jsx)(`rect`,{"data-testid":`chart-hit`,x:s.x,y:s.y,width:s.width,height:s.height,fill:`transparent`,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>n&&a?.(t.id),...Lc(t.id,o)}),n&&d.marks.map((e,n)=>(0,Q.jsx)(`rect`,{x:e.x,y:e.y,width:Math.max(0,e.width),height:Math.max(0,e.height),fill:`transparent`,style:{pointerEvents:`all`},onPointerDown:e=>i(t.id,e),onDoubleClick:()=>a?.(t.id),onPointerEnter:()=>{p(n),o(t.id)},onPointerLeave:()=>{p(e=>e===n?null:e),o(null)}},`mark-${n}`)),m&&(0,Q.jsx)(cS,{shape:t,mark:m})]})}var uS=(0,J.memo)(lS);function dS(e,t,n){return t.kind===`entity`?n===`body`?e.testId===`entity-row`||e.testId===`entity-divider`:e.kind===`text`&&e.testId===`entity-title`:t.kind===`fragment`?e.testId===`fragment-tab`||e.testId===`fragment-label`:e.kind===`text`?t.kind===`modal`?n===`primary`||n===`secondary`?e.testId===`modal-${n}`:e.testId===(n===`body`?`card-body`:`card-title`):t.kind!==`card`||e.testId===(n===`body`?`card-body`:`card-title`):!1}function fS(e,t){if(!Ql(e.kind))return`label`;let n=t.currentTarget.getScreenCTM();if(!n)return`label`;let r=new DOMPoint(t.clientX,t.clientY).matrixTransform(n.inverse()),i=W(e);if(e.kind===`modal`){let e=bi(i);if(e){let t=e=>r.x>=e.x&&r.x<=e.x+e.width&&r.y>=e.y&&r.y<=e.y+e.height;if(t(e.primary))return`primary`;if(t(e.secondary))return`secondary`}}let a=e.kind===`card`?pi(e).body:Zl(e,`body`);return r.y>=a.y?`body`:`label`}var pS=8;function mS(e){let{shape:t,interactive:n,onPointerDown:r,onBeginEdit:i,onHover:a}=e,o=Si(),s=W(t),c=Rr(t,o.text),l=Math.min(pS,s.width/2,s.height/2),u={pointerEvents:n?`all`:`none`},d=e=>r(t.id,e),f=Lc(t.id,a),p=(e,t,n,r,i)=>(0,Q.jsx)(`rect`,{x:e,y:t,width:n,height:r,fill:`transparent`,style:u,onPointerDown:d,...f},i);return(0,Q.jsxs)(Q.Fragment,{children:[p(s.x,s.y,s.width,l,`top`),p(s.x,s.y+s.height-l,s.width,l,`bottom`),p(s.x,s.y,l,s.height,`left`),p(s.x+s.width-l,s.y,l,s.height,`right`),(0,Q.jsx)(`rect`,{"data-testid":`control-hit`,x:s.x,y:s.y,width:c.width,height:c.height,fill:`transparent`,style:u,onPointerDown:d,onDoubleClick:()=>{n&&i(t.id,`label`)},...f})]})}function hS(e){let{shape:t,interactive:n,editingField:r,erasing:i,onPointerDown:a,onBeginEdit:o,onHover:s}=e,c=Si(),l=W(t),u=an(t),d=l.x+l.width/2,f=l.y+l.height/2,p=(0,J.useMemo)(()=>fi(t,c.text),[t,c]).filter(e=>t.kind===`lifeline`&&e.kind===`text`&&e.testId===`lifeline-name`?!1:!r||!dS(e,t,r));return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`control`,"data-control-kind":t.kind,transform:u?`rotate(${u} ${d} ${f})`:void 0,opacity:Ic(t.opacity,i),children:[p.map((e,t)=>(0,Q.jsx)(sS,{prim:e},t)),t.kind===`fragment`?(0,Q.jsx)(mS,{shape:t,interactive:n,onPointerDown:a,onBeginEdit:o,onHover:s}):(0,Q.jsx)(`rect`,{"data-testid":`control-hit`,x:l.x,y:l.y,width:l.width,height:l.height,fill:`transparent`,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>a(t.id,e),onDoubleClick:e=>{n&&li(t.kind)&&o(t.id,fS(t,e))},...Lc(t.id,s)})]})}var gS=(0,J.memo)(hS);function _S(e){let{source:t,name:n,size:r}=e,i=yl(t,n),a=(0,J.useMemo)(()=>({__html:i?.inner??``}),[i?.inner]);return i?(0,Q.jsx)(`svg`,{width:r,height:r,viewBox:i.viewBox,fill:`currentColor`,style:{display:`block`},dangerouslySetInnerHTML:a}):(0,Q.jsx)(`span`,{style:{width:r,height:r}})}function vS(e){let{name:t,source:n,size:r=20}=e,i=_l(Li(n)?``:t);return Li(n)?Ii(n)?(0,Q.jsx)(_S,{source:n,name:t,size:r}):(0,Q.jsx)(`img`,{src:Ri().assetIconUrl(n,t),alt:t,draggable:!1,style:{width:r,height:r}}):i?(0,Q.jsx)(vl,{node:i,size:r}):(0,Q.jsx)(`span`,{style:{width:r,height:r}})}var yS=`[data-caret-safe]`;function bS(e){return e instanceof Element&&e.closest(yS)!==null}function xS(e){return/[A-Za-z0-9]/.test(e)}function SS(e,t,n){if(t<2)return null;let r=(n,r,i,a)=>{let o=n+r,s=t-r;if(s<=o)return null;let c=e.slice(o,s);return c.trim()===``||a&&(xS(n>0?e[n-1]:``)||/\s/.test(c[0])||/\s/.test(c[c.length-1]))?null:{openStart:n,contentStart:o,contentEnd:s,tag:i}};if(n==="`"){let n=e.lastIndexOf("`",t-2);return n<0?null:r(n,1,`code`,!1)}if(n===`=`){if(e[t-2]!==`=`)return null;let n=e.lastIndexOf(`==`,t-3);return n<0?null:r(n,2,`mark`,!1)}if(n===`~`){if(e[t-2]===`~`){let n=e.lastIndexOf(`~~`,t-3);return n<0?null:r(n,2,`s`,!1)}let n=e.lastIndexOf(`~`,t-2);return n<0||e[n-1]===`~`?null:r(n,1,`s`,!1)}if(n===`*`||n===`_`){if(e[t-2]===n){let i=e.lastIndexOf(n+n,t-3);return i<0?null:r(i,2,`strong`,!1)}let i=e.lastIndexOf(n,t-2);return i<0||e[i-1]===n?null:r(i,1,`em`,!0)}return null}function CS(e){let t=window.getSelection()?.anchorNode??null;for(;t&&t!==e;){if(t.nodeType===1){let e=t.tagName;if(e===`UL`||e===`OL`)return t}t=t.parentNode}return null}function wS(e){let t=CS(e);if(t&&t.hasAttribute(`data-checklist`)){t.removeAttribute(`data-checklist`),t.querySelectorAll(`li[data-checked]`).forEach(e=>{e.removeAttribute(`data-checked`)});return}document.execCommand(`insertUnorderedList`)}function TS(e){let t=CS(e);if(t&&t.hasAttribute(`data-checklist`)){document.execCommand(`insertUnorderedList`);return}(!t||t.tagName===`OL`)&&document.execCommand(`insertUnorderedList`),ES(e)}function ES(e){let t=CS(e);t&&t.tagName===`UL`&&t.setAttribute(`data-checklist`,`true`)}function DS(e,t){let n=[...e.querySelectorAll(`ul, ol`)].filter(e=>!e.parentElement?.closest(`ul, ol`)&&t.intersectsNode(e));if(n.length===0)return null;let r=[],i=t.cloneRange();for(let e of n){let n=i.cloneRange();n.setEndBefore(e),n.collapsed||r.push(n);for(let n of e.querySelectorAll(`:scope > li`)){if(!t.intersectsNode(n))continue;let e=document.createRange();e.selectNodeContents(n),n.contains(t.startContainer)&&e.setStart(t.startContainer,t.startOffset),n.contains(t.endContainer)&&e.setEnd(t.endContainer,t.endOffset),e.collapsed||r.push(e)}i=i.cloneRange(),i.setStartAfter(e)}return i.collapsed||r.push(i),r}function OS(e){let t=window.getSelection()?.anchorNode??null;for(;t&&t!==e;){if(t.nodeType===1&&t.tagName===`LI`)return t;t=t.parentNode}return null}function kS(e){let t=window.getSelection(),n=t&&t.rangeCount>0?{node:t.anchorNode,offset:t.anchorOffset}:null,r=t&&t.rangeCount>0?{node:t.focusNode,offset:t.focusOffset}:null;e(),t&&n?.node&&r?.node&&t.setBaseAndExtent(n.node,n.offset,r.node,r.offset)}function AS(e){let t=OS(e);if(!t)return!1;let n=t.previousElementSibling,r=t.parentElement;return!n||n.tagName!==`LI`||!r||kS(()=>{let e=n.lastElementChild;(e&&e.tagName===r.tagName&&e.hasAttribute(`data-checklist`)===r.hasAttribute(`data-checklist`)?e:n.appendChild(r.cloneNode(!1))).appendChild(t)}),!0}function jS(e){let t=OS(e);if(!t)return!1;let n=t.parentElement,r=n?.parentElement;return!n||!r||r.tagName!==`LI`||kS(()=>{if(t.nextElementSibling){let e=n.cloneNode(!1);for(;t.nextElementSibling;)e.appendChild(t.nextElementSibling);t.appendChild(e)}r.after(t),n.firstElementChild||n.remove()}),!0}function MS(e){let t=e;for(;t&&t!==document.body;){if(t.nodeType===1&&t.hasAttribute(`data-rich`))return t;t=t.parentNode}return null}function NS(){let e=window.getSelection();if(!e||e.rangeCount===0||e.isCollapsed)return null;let t=MS(e.anchorNode);return!t||!t.isContentEditable||!t.contains(e.focusNode)?null:{sel:e,range:e.getRangeAt(0),editable:t}}function PS(){let e=window.getSelection();if(!e||e.rangeCount===0||!e.isCollapsed)return null;let t=MS(e.anchorNode);return!t||!t.isContentEditable?null:{sel:e,range:e.getRangeAt(0),editable:t}}function FS(e,t){let n=NS();return{live:n,editable:n?.editable??e,range:n?.range??t}}function IS(e,t){if(e.focus(),!t)return;let n=window.getSelection();n&&(n.removeAllRanges(),n.addRange(t.cloneRange()))}function LS(e,t,n){let r=t;for(;r&&r!==e;){if(r.nodeType===1&&r.tagName.toLowerCase()===n)return r;r=r.parentNode}return null}function RS(e){let t=window.getSelection();if(!t)return;let n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}function zS(e,t,n){if(e.collapsed)return null;let r=document.createElement(t);n?.(r);try{r.appendChild(e.extractContents()),e.insertNode(r)}catch{return null}return r}function BS(e){let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}function VS(e){if(!e.parentNode)return;let t=e.firstChild,n=e.lastChild;BS(e);let r=window.getSelection();if(t&&n&&r){let e=document.createRange();e.setStartBefore(t),e.setEndAfter(n),r.removeAllRanges(),r.addRange(e)}}function HS(e){let t=window.getSelection();if(!t||t.rangeCount===0||!e.contains(t.focusNode))return null;let n=document.createRange();return n.selectNodeContents(e),n.setEnd(t.focusNode,t.focusOffset),n.toString().length}function US(e,t){let n=window.getSelection();if(!n)return;let r=t,i=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e;e=i.nextNode()){let t=(e.nodeValue??``).length;if(r<=t){n.collapse(e,r);return}r-=t}n.collapse(e,e.childNodes.length)}function WS(e,t){let n=window.getSelection();if(!n||!n.isCollapsed||n.rangeCount===0)return!1;let r=n.anchorNode;if(!r||r.nodeType!==3||!e.contains(r))return!1;let i=r.nodeValue??``,a=n.anchorOffset,o=SS(i,a,t);if(!o)return!1;let s=e.ownerDocument,c=r.parentNode;if(!c)return!1;let l=i.slice(0,o.openStart),u=i.slice(o.contentStart,o.contentEnd),d=i.slice(a),f=s.createElement(o.tag);f.textContent=u;let p=s.createTextNode(`\u200B${d}`);c.insertBefore(p,r.nextSibling),c.insertBefore(f,p),l?r.nodeValue=l:c.removeChild(r);let m=s.createRange();return m.setStart(p,1),m.collapse(!0),n.removeAllRanges(),n.addRange(m),!0}function GS(e,t){let n=zS(e,`a`,e=>e.setAttribute(`href`,t));return n?.querySelectorAll(`a`).forEach(BS),n}function KS(e,t,n){let r=LS(e,t.startContainer,`a`),i=LS(e,t.endContainer,`a`);if(r&&r===i)return r.setAttribute(`href`,n),r;let a=DS(e,t);if(!a)return GS(t,n);let o=null;for(let e of a)o=GS(e,n)??o;return o}function qS(e,t,n){let r=e.startContainer.ownerDocument??document,i=r.createElement(`a`);i.setAttribute(`href`,t),i.textContent=n;let a=r.createTextNode(``);return e.insertNode(a),e.insertNode(i),a}function JS(e,t,n){let r=e.parentNode;if(!r)return;let i=document.createRange();i.selectNodeContents(e),i.setEnd(t.startContainer,t.startOffset);let a=document.createRange();a.selectNodeContents(e),a.setStart(t.endContainer,t.endOffset);let o=i.extractContents(),s=a.extractContents();if(o.childNodes.length>0){let t=document.createElement(n);t.appendChild(o),r.insertBefore(t,e)}if(s.childNodes.length>0){let t=document.createElement(n);t.appendChild(s),r.insertBefore(t,e.nextSibling)}VS(e)}function YS(e,t,n){if(t.collapsed)return null;let r=document.createElement(`span`),i=document.createElement(`span`),a=t.cloneRange();a.collapse(!1),a.insertNode(i);let o=t.cloneRange();o.collapse(!0),o.insertNode(r);let s=document.createRange();s.setStartAfter(r),s.setEndBefore(i);let c=s.extractContents();c.querySelectorAll(n).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),s.insertNode(c);let l=document.createRange();return l.setStartAfter(r),l.setEndBefore(i),r.remove(),i.remove(),e.normalize(),l}function XS(e){e.querySelectorAll(`mark, em, i, strong, b, u, s, code, a, span`).forEach(e=>{e.textContent===``&&e.remove()}),e.normalize()}function ZS(e,t,n){let r=n.split(/\r?\n/);for(;r.length>1&&r[r.length-1].trim()===``;)r.pop();let i=LS(e,t.startContainer,`li`),a=[...e.querySelectorAll(`li`)].filter(e=>t.intersectsNode(e));t.deleteContents(),i?.isConnected&&!i.contains(t.startContainer)&&(t.selectNodeContents(i),t.collapse(!1));let o=document.createTextNode(r[0]??``);t.insertNode(o);let s=o;for(let e of r.slice(1)){if(i?.isConnected){let t=document.createElement(`li`);t.textContent=e,(s===o?i:s).after(t),s=t;continue}let t=document.createElement(`br`),n=document.createTextNode(e);s.after(t),t.after(n),s=n}let c=i?.isConnected?i:null;for(let e of a)if(!(e===c||!e.isConnected||e.contains(s))&&e.textContent?.trim()===``){let t=e.parentElement;e.remove(),t&&(t.tagName===`UL`||t.tagName===`OL`)&&!t.querySelector(`li`)&&t.remove()}return XS(e),s}function QS(e,t,n){for(let r of e.querySelectorAll(n))if(t.intersectsNode(r))return!0;return!1}function $S(e,t){let n=window.getSelection();if(!n||n.rangeCount===0||!n.isCollapsed)return;let r=n.getRangeAt(0);if(!e.contains(r.startContainer))return;let i=e.ownerDocument,a=i.createTextNode(``),o=LS(e,r.startContainer,t);if(!o){let e=i.createElement(t);e.appendChild(a),r.insertNode(e),n.collapse(a,1);return}let s=i.createRange();s.selectNodeContents(o),s.setStart(r.startContainer,r.startOffset);let c=s.extractContents(),l=a;for(let e=r.startContainer.nodeType===3?r.startContainer.parentNode:r.startContainer;e&&e!==o;e=e.parentNode){let t=e.cloneNode(!1);t.appendChild(l),l=t}if(o.after(l),(c.textContent??``).replace(/\u200B/g,``)!==``){let e=o.cloneNode(!1);e.appendChild(c),l.after(e)}o.textContent===``&&o.remove(),n.collapse(a,1)}function eC(e,t){let n=window.getSelection();if(!n||n.rangeCount===0)return;let r=n.getRangeAt(0);if(r.collapsed)return;let i=LS(e,r.startContainer,t),a=LS(e,r.endContainer,t),o=!!(i||a||QS(e,r,t)),s=DS(e,r)??[r],c=[];for(let n of s){if(o){let r=LS(e,n.startContainer,t);if(r&&r===LS(e,n.endContainer,t)){JS(r,n,t);continue}let i=YS(e,n,t);i&&c.push(i);continue}let r=zS(n,t);if(r){let e=document.createRange();e.selectNodeContents(r),c.push(e)}}if(c.length===0)return;let l=document.createRange();l.setStart(c[0].startContainer,c[0].startOffset);let u=c[c.length-1];l.setEnd(u.endContainer,u.endOffset),n.removeAllRanges(),n.addRange(l)}var tC=200,nC=1e3;function rC(e){return e===`insertText`||e===`insertCompositionText`?`type`:e===`deleteContentBackward`||e===`deleteContentForward`?`delete`:null}function iC(e,t){let n=[],r=t;for(;r&&r!==e;){let e=r.parentNode;if(!e)return null;n.unshift(Array.prototype.indexOf.call(e.childNodes,r)),r=e}return r===e?n:null}function aC(e,t){let n=e;for(let e of t)n=n?.childNodes[e]??null;return n}function oC(e,t,n){let r=t?iC(e,t):null;return r?{path:r,offset:n}:null}function sC(e){return e.nodeType===3?(e.nodeValue??``).length:e.childNodes.length}function cC(e,t){let n=[],r=[],i=null,a=null;function o(){let t=window.getSelection(),n=t&&t.rangeCount>0&&e.contains(t.anchorNode);return{html:e.innerHTML,anchor:n?oC(e,t.anchorNode,t.anchorOffset):null,focus:n?oC(e,t.focusNode,t.focusOffset):null}}let s=o();function c(e,t,n){return!e||!a||a.kind!==e||n-a.at>nC?!1:!(e===`type`&&/\s$/.test(a.data)&&!/^\s/.test(t))}function l(){let e=i?.kind??null,l=i?.data??``;i=null;let u=o();if(u.html===s.html){s=u;return}let d=performance.now();c(e,l,d)||(n.push(s),n.length>tC&&n.shift()),s=u,r=[],a=e?{kind:e,at:d,data:l}:null,t?.()}let u=new MutationObserver(l);u.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});function d(){u.takeRecords().length>0&&l()}function f(t){e.innerHTML=t.html,u.takeRecords();let n=window.getSelection();if(!n)return;let r=t=>{let n=t?aC(e,t.path):null;return!n||!t?{node:e,offset:e.childNodes.length}:{node:n,offset:Math.min(t.offset,sC(n))}},i=r(t.anchor),a=r(t.focus??t.anchor);n.setBaseAndExtent(i.node,i.offset,a.node,a.offset)}function p(e,n){d();let r=e.pop();r&&(n.push(s),f(r),s=r,a=null,t?.())}function m(e){if(e.inputType===`historyUndo`||e.inputType===`historyRedo`){e.preventDefault(),e.inputType===`historyUndo`?p(n,r):p(r,n);return}d(),i={kind:rC(e.inputType),data:e.data??``}}return e.addEventListener(`beforeinput`,m),{undo:()=>p(n,r),redo:()=>p(r,n),flush:d,absorb(){u.takeRecords(),s=o()},reset(){u.takeRecords(),n.length=0,r=[],a=null,s=o()},dispose(){u.disconnect(),e.removeEventListener(`beforeinput`,m)}}}function lC(e){let t=e.target;if(!t||typeof t.closest!=`function`)return null;let n=t.closest(`li`);return!n||!n.parentElement?.matches(`ul[data-checklist]`)||e.clientX>=n.getBoundingClientRect().left?null:n}function uC(e){e.hasAttribute(`data-checked`)?e.removeAttribute(`data-checked`):e.setAttribute(`data-checked`,`true`)}var dC=new Set([`BR`,`LI`,`UL`,`OL`,`DIV`,`P`]);function fC(e,t,n){let r=``,i=!1,a=e=>{if(i)return;if(e.nodeType===3){if(e===t){r+=(e.nodeValue??``).slice(0,n),i=!0;return}r+=e.nodeValue??``;return}if(e.nodeType!==1)return;let o=dC.has(e.tagName);o&&(r=``),e.childNodes.forEach(a),o&&!i&&(r=``)};return e.childNodes.forEach(a),r.slice(r.lastIndexOf(`
|
|
18
|
+
`)+1)}function pC(e,t){if(!t||t.tagName!==e.tagName||t.hasAttribute(`data-checklist`)!==e.hasAttribute(`data-checklist`))return!1;let n=e=>(e.textContent??``).replace(/\u200B/g,``)===``,r=r=>{for(let i=r(e);i;i=r(i)){if(i===t)return!0;if(!n(i))return!1}return!1};return r(e=>e.previousSibling)||r(e=>e.nextSibling)}function mC(e){let t=e.parentElement;if(!t)return;let n=t.cloneNode(!1);for(;t.firstElementChild&&t.firstElementChild!==e;)n.appendChild(t.firstElementChild);let r=t.cloneNode(!1);for(let t=e.nextElementSibling;t;){let e=t.nextElementSibling;r.appendChild(t),t=e}n.firstElementChild&&t.before(n),r.firstElementChild&&t.after(r),t.removeAttribute(`data-checklist`),e.removeAttribute(`data-checked`)}function hC(e){let t=e,n=e.previousElementSibling;if(pC(e,n)){for(;e.firstChild;)n.appendChild(e.firstChild);e.remove(),t=n}let r=t.nextElementSibling;if(pC(t,r)){for(;r.firstChild;)t.appendChild(r.firstChild);r.remove()}}function gC(e){if(e.key!==` `)return;let t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===0)return;let n=t.anchorNode;if(!n||n.nodeType!==3)return;let r=e.currentTarget,i=OS(r),a=fC(r,n,t.anchorOffset).replace(/\u200B/g,``),o=!i&&a===`1.`,s=!i&&(a===`-`||a===`*`),c=a===`[]`||a===`[ ]`;if(!o&&!s&&!c||t.anchorOffset<a.length||i&&i.parentElement?.hasAttribute(`data-checklist`))return;e.preventDefault();let l=document.createRange();if(l.setStart(n,t.anchorOffset-a.length),l.setEnd(n,t.anchorOffset),t.removeAllRanges(),t.addRange(l),document.execCommand(`delete`),i){TS(r);return}document.execCommand(o?`insertOrderedList`:`insertUnorderedList`),vC(r);let u=OS(r),d=u?.parentElement;if(!u||!d)return;d.hasAttribute(`data-checklist`)!==c&&(u.previousElementSibling||u.nextElementSibling)&&mC(u),c&&ES(r);let f=OS(r)?.parentElement;f&&hC(f)}function _C(e){if(e.key!==`Backspace`)return;let t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===0)return;let n=e.currentTarget,r=OS(n);if(!r||r.previousElementSibling)return;let i=r.parentElement;if(!i||i.tagName!==`UL`&&i.tagName!==`OL`)return;let a=document.createRange();if(a.selectNodeContents(r),a.setEnd(t.anchorNode,t.anchorOffset),!(a.toString().replace(/\u200B/g,``).length>0)){if(e.preventDefault(),i.parentElement?.tagName===`LI`){jS(n);return}document.execCommand(i.tagName===`OL`?`insertOrderedList`:`insertUnorderedList`)}}function vC(e){let t=window.getSelection(),n=OS(e);if(!t||t.rangeCount===0||!n)return;let r=[],i=document.createTreeWalker(n,NodeFilter.SHOW_TEXT);for(let e=i.nextNode();e;e=i.nextNode())r.push(e);let a=!1;for(let e of r)(e.nodeValue??``).includes(``)&&(e.nodeValue=(e.nodeValue??``).replace(/\u200B/g,``),a=!0),e.nodeValue===``&&e.parentNode?.removeChild(e);if(!a)return;n.firstChild||n.appendChild(document.createElement(`br`));let o=document.createRange(),s=n.lastChild;s&&s.nodeType===3?o.setStart(s,(s.nodeValue??``).length):o.setStart(n,0),o.collapse(!0),t.removeAllRanges(),t.addRange(o)}function yC(e){if(e.key!==`Enter`)return;let t=window.getSelection();if(!t||OS(e.currentTarget))return;e.preventDefault();let n=xC(t,e.currentTarget);if(n){let e=document.createTextNode(`
|
|
19
|
+
`);n.parentNode?.insertBefore(e,n.nextSibling);let r=document.createRange();r.setStart(e,e.length),r.collapse(!0),t.removeAllRanges(),t.addRange(r);return}document.execCommand(`insertLineBreak`)}function bC(e){let t=e;for(;t&&t.lastChild;)t=t.lastChild;return t&&t.nodeType===3?t:null}function xC(e,t){let n=e.anchorNode;if(!n||n.nodeType!==3||e.anchorOffset!==(n.nodeValue??``).length)return null;let r=n.parentNode;for(;r&&r!==t;){if(r.nodeType===1){let e=r;if(e.tagName===`SPAN`&&e.style.fontSize)return bC(e)===n?e:null}r=r.parentNode}return null}function SC(e,t,n){if(t.nodeType===3){let e=(t.nodeValue??``).indexOf(`
|
|
20
|
+
`,n);if(e!==-1)return{node:t,offset:e}}let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT);if(t.nodeType===3)r.currentNode=t;else if(n<t.childNodes.length){let e=t.childNodes[n];if(r.currentNode=e,e.nodeType===3){let t=(e.nodeValue??``).indexOf(`
|
|
21
|
+
`);if(t!==-1)return{node:e,offset:t}}}else return{node:e,offset:e.childNodes.length};let i=r.nextNode();for(;i;){let e=(i.nodeValue??``).indexOf(`
|
|
22
|
+
`);if(e!==-1)return{node:i,offset:e};i=r.nextNode()}return{node:e,offset:e.childNodes.length}}var CC=[2,1.5,1.25,1.1];function wC(e){if(e.key!==` `)return!1;let t=window.getSelection();if(!t||!t.isCollapsed||t.rangeCount===0)return!1;let n=t.anchorNode;if(!n||n.nodeType!==3)return!1;let r=e.currentTarget;if(OS(r))return!1;let i=fC(r,n,t.anchorOffset).replace(/\u200B/g,``);if(!/^#+$/.test(i)||t.anchorOffset<i.length)return!1;e.preventDefault();let a=CC[Math.min(i.length,CC.length)-1],o=document.createRange();o.setStart(n,t.anchorOffset-i.length),o.setEnd(n,t.anchorOffset),t.removeAllRanges(),t.addRange(o),document.execCommand(`delete`);let s=parseFloat(getComputedStyle(r).fontSize)||24,c=Math.min(240,Math.round(s*a)),l=document.createElement(`span`);l.style.fontSize=`${c}px`;let u=t.getRangeAt(0),d=SC(r,u.startContainer,u.startOffset),f=document.createRange();f.setStart(u.startContainer,u.startOffset),f.setEnd(d.node,d.offset);let p=document.createRange();if(f.collapsed){let e=document.createTextNode(``);l.appendChild(e),f.insertNode(l),p.setStart(e,1)}else l.appendChild(f.extractContents()),f.insertNode(l),p.selectNodeContents(l);return p.collapse(!0),t.removeAllRanges(),t.addRange(p),!0}var TC=/^(?:(?:https?:\/\/|mailto:)\S+|www\.[\w-]+(?:\.[\w-]+)+\S*)$/i;function EC(e,t){if(!e.hasAttribute(`data-rich`))return!1;let n=window.getSelection();if(!n||!n.isCollapsed||n.rangeCount===0)return!1;let r=n.anchorNode;if(!r||r.nodeType!==3||!e.contains(r)||LS(e,r,`a`))return!1;let i=(r.nodeValue??``).slice(0,n.anchorOffset-t),a=/[^\s\u200B]+$/.exec(i);if(!a)return!1;let o=a[0].replace(/[.,;:!?)\]'"]+$/,``),s=TC.test(o)?Vn(o):null;if(!s)return!1;let c=document.createRange();c.setStart(r,a.index),c.setEnd(r,a.index+o.length);let l=document.createElement(`a`);if(l.setAttribute(`href`,s),l.appendChild(c.extractContents()),c.insertNode(l),t===0&&o.length===a[0].length){let e=document.createTextNode(``);l.after(e),n.collapse(e,1)}return!0}function DC(e,t){if(!e.hasAttribute(`data-rich`))return!1;let n=t.trim();if(!TC.test(n))return!1;let r=Vn(n);if(!r)return!1;let i=window.getSelection();if(!i||i.rangeCount===0||i.isCollapsed)return!1;let a=i.getRangeAt(0);if(!e.contains(a.startContainer)||!e.contains(a.endContainer))return!1;let o=KS(e,a,r);if(!o)return!1;let s=e.ownerDocument.createTextNode(``);o.after(s);let c=e.ownerDocument.createRange();return c.setStart(s,1),c.collapse(!0),i.removeAllRanges(),i.addRange(c),!0}function OC(e){e.preventDefault();let t=e.clipboardData.getData(`text/plain`);if(DC(e.currentTarget,t))return;let n=t.replace(/\r\n?/g,`
|
|
23
|
+
`).split(`
|
|
24
|
+
`),r=OS(e.currentTarget)!==null;n.forEach((e,t)=>{t>0&&document.execCommand(r?`insertParagraph`:`insertLineBreak`),e&&document.execCommand(`insertText`,!1,e)})}function kC(e){let t=e.key===`Backspace`||e.key===`ArrowLeft`,n=e.key===`Delete`||e.key===`ArrowRight`;if(!t&&!n)return!1;let r=window.getSelection();if(!r||!r.isCollapsed||r.rangeCount===0)return!1;let i=r.anchorNode;if(!i||i.nodeType!==3||!e.currentTarget.contains(i))return!1;let a=i,o=r.anchorOffset,s=!1;for(;;){let e=t?o-1:o;if(a.data[e]!==``)break;a.deleteData(e,1),o=e,s=!0}return s&&r.collapse(a,o),s}function AC(e,t){if(e.type===`control`)return t===`body`?`body`:t===`primary`?`primaryLabel`:t===`secondary`?`secondaryLabel`:`label`;let n=tn[e.type].textField;return n===`text-or-delete`?e.type===`text`?`text`:null:n}function jC(e,t,n){let{editSession:r,shapes:i,updateShape:a}=e.store.getState();if(r.kind!==`text`||r.shapeId!==t.shapeId||r.field!==t.field)return!1;let o=xr(i,t.shapeId),s=o?AC(o,t.field):null;return!o||!s||(o[s]??``)===n?!1:(e.history.runWithoutHistory(()=>a(o.id,{[s]:n})),!0)}function MC(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n+=1;let i=0;for(;i<r-n&&e[e.length-1-i]===t[t.length-1-i];)i+=1;return{start:n,end:e.length-i,text:t.slice(n,t.length-i)}}function NC(e,t,n){if(t===e||t===n)return n;if(n===e)return t;let r=MC(e,t),i=MC(e,n),[a,o]=r.start<i.start||r.start===i.start&&r.end<=i.end?[r,i]:[i,r];return a.end>o.start||a.start===o.start&&a.end===o.end?null:e.slice(0,a.start)+a.text+e.slice(a.end,o.start)+o.text+e.slice(o.end)}var PC=500;function FC(e,t){if(t)return e.innerText??``;let n=or(e.innerHTML);return It(n)?n:e.innerText??``}function IC(e){return It(e)?Tn(e):e.trim()===``}function LC(e,t){let n=e.textContent??``,r=HS(e);if(e.innerHTML=t,r===null)return;let i=e.textContent??``,a=0;for(;a<n.length&&a<i.length&&n[a]===i[a];)a+=1;US(e,ct(r<=a?r:r+i.length-n.length,0,i.length))}function RC(e){let{value:t,isEditing:n,interactive:r,onCommit:i,editableRef:a,onPointerDown:o,onClick:s,onDoubleClick:c,plain:l,prose:u,softBreaks:d,...f}=e,p=V(),{store:m,textEditGuard:h}=p,g=(0,J.useRef)(null),_=a??g,v=(0,J.useRef)(t);v.current=t;let y=(0,J.useRef)(null),b=(0,J.useRef)({target:null,origin:``,shared:``,written:!1,remote:!1,timer:0,save:null}),x=d?.width,S=d?.fontSize,C=(0,J.useMemo)(()=>({__html:x===void 0||S===void 0?Bn(t):It(t)?Pi(Bn(t),x,S):ji(t,x,S)}),[t,x,S]);(0,J.useLayoutEffect)(()=>{if(!n)return;let e=a?.current??g.current;if(!e)return;e.innerHTML=Bn(v.current);let t=m.getState().editSession,r=b.current;r.target=t.kind===`text`?{shapeId:t.shapeId,field:t.field}:null,r.origin=v.current,r.shared=v.current,r.written=!1,r.remote=!1;let i=()=>{window.clearTimeout(r.timer),r.timer=0;let t=FC(e,l);!r.target||IC(t)||jC(p,r.target,t)&&(r.written=!0,r.shared=t)};r.save=i;let o=cC(e,()=>{window.clearTimeout(r.timer),r.timer=window.setTimeout(i,PC)});y.current=o;let s=()=>{r.timer!==0&&i()},c=()=>{document.visibilityState===`hidden`&&s()};window.addEventListener(`pagehide`,s,!0),window.addEventListener(`visibilitychange`,c,!0);let d=()=>{window.clearTimeout(r.timer),r.timer=0,window.removeEventListener(`pagehide`,s,!0),window.removeEventListener(`visibilitychange`,c,!0),o.dispose(),y.current=null,r.save=null},f=p.editEntry.take(),h=u?f:null,_=()=>{e.focus();let t=window.getSelection();if(!t)return;let n=h?au(e,h):null;n||(n=document.createRange(),n.selectNodeContents(e)),t.removeAllRanges(),t.addRange(n)};if(m.getState().coarsePointer||f)return _(),d;let x=requestAnimationFrame(_);return()=>{cancelAnimationFrame(x),d()}},[n,m,a,p,l,u]),(0,J.useEffect)(()=>{let e=b.current,r=_.current;if(!n||!r||!e.target||t===e.shared)return;let i=FC(r,l),a=NC(e.shared,i,t);e.shared=t,e.remote=!0,!(a===null||a===i)&&(LC(r,Bn(a)),y.current?.reset(),a!==t&&e.save?.())},[t,n,l,_]);function w(e){if(!(e.nativeEvent.isComposing||e.keyCode===229)&&(Rc(e,h.release),!T(e))){if(e.key===`Tab`){E(e);return}if(kC(e)&&y.current?.absorb(),l){yC(e);return}y.current?.flush(),!wC(e)&&(e.key===`Enter`&&!e.shiftKey&&(EC(e.currentTarget,0),y.current?.flush()),gC(e),_C(e),yC(e))}}function T(e){if(!(e.metaKey||e.ctrlKey)||e.altKey)return!1;let t=e.key.toLowerCase(),n=t===`z`&&e.shiftKey||t===`y`&&!e.shiftKey;return t!==`z`&&!n?!1:(e.preventDefault(),n?y.current?.redo():y.current?.undo(),!0)}function E(e){if(e.preventDefault(),e.stopPropagation(),e.metaKey||e.ctrlKey||e.altKey)return;if(!l){y.current?.flush();let t=e.currentTarget;if(e.shiftKey?jS(t):AS(t))return}let t=m.getState().editSession;if(t.kind!==`text`||t.field!==`label`||!wf(m)||(h.release(),e.currentTarget.blur(),!Of(m,e.shiftKey?`down`:`right`,p.measurement)))return;let[n]=m.getState().selectedIds;n&&m.getState().beginTextEdit(n)}function D(e){let t=lC(e);if(t){e.preventDefault(),e.stopPropagation(),uC(t);return}o?.(e)}function O(e){let t=e.nativeEvent;if(t.inputType===`insertText`&&t.data){l||(y.current?.flush(),t.data===` `?EC(e.currentTarget,1):WS(e.currentTarget,t.data));return}if(t.inputType!==`insertParagraph`)return;let n=window.getSelection()?.anchorNode??null;for(;n&&n!==e.currentTarget;){if(n.nodeType===1&&n.tagName===`LI`){let e=n;e.parentElement?.matches(`ul[data-checklist]`)&&e.removeAttribute(`data-checked`);return}n=n.parentNode}}function k(e){if(r&&lC(e)){e.preventDefault(),e.stopPropagation();return}o?.(e)}function A(e){let n=r?lC(e):null;if(!n){s?.(e);return}e.stopPropagation();let a=e.currentTarget.querySelectorAll(`ul[data-checklist] > li`),o=Gn(t,Array.prototype.indexOf.call(a,n));o!==null&&i(o)}function j(e){if(r&&lC(e)){e.stopPropagation();return}c?.(e)}function ee(e){if(h.isGuarded()||bS(e.relatedTarget))return;let t=b.current;window.clearTimeout(t.timer),t.timer=0,t.written&&t.target&&!t.remote&&(jC(p,t.target,t.origin),t.written=!1),i(FC(e.currentTarget,l))}return n?(0,Q.jsx)(`div`,{...f,ref:_,...l?{}:{"data-rich":!0},translate:`no`,className:`notranslate ${f.className??``}`,contentEditable:!0,suppressContentEditableWarning:!0,spellCheck:!!u,onKeyDown:w,onPointerDown:D,onClick:s,onDoubleClick:c,onInput:O,onPaste:OC,onBlur:ee}):(0,Q.jsx)(`div`,{...f,ref:_,"data-rich":!0,translate:`no`,className:`notranslate ${f.className??``}`,onPointerDown:k,onClick:A,onDoubleClick:j,dangerouslySetInnerHTML:C})}function zC(e,t,n,r,i,a,o=0){let s=V().measurements.labelHeights;(0,J.useEffect)(()=>{let c=e.current;if(!c)return;let l=()=>r(t,c.offsetHeight+n*2+o);if(s.get(t)!==i&&(s.set(t,i),l()),!a)return;let u=new ResizeObserver(l);return u.observe(c),()=>u.disconnect()},[e,t,n,r,i,a,s,o])}function BC(e){return{fontSize:e.fontSize??20,fontFamily:e.fontFamily,fontWeight:nt(e.fontFamily),lineHeight:e.lineHeight,letterSpacing:e.letterSpacing?`${e.letterSpacing}em`:void 0}}function VC(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onBeginEdit:o,onCommitText:s,onMeasure:c,onHover:l}=e,u=(0,J.useRef)(null),d=W(t),f=t.textPadding??6,p={x:t.flipX,y:t.flipY},m=zt(t.kind,d.width,d.height,p),h={x:d.x+m.left,y:d.y+m.top,width:d.width-m.left-m.right,height:d.height-m.top-m.bottom};if(zC(u,t.id,f,c,[t.width,t.height,t.label,t.fontSize,t.fontFamily,t.lineHeight,t.letterSpacing,t.textPadding,t.flipX,t.flipY].join(`|`),n,m.top+m.bottom),!n&&t.label.length===0&&!t.titleIcon)return null;let g=t.fill===`transparent`||t.fill===`#ffffff`||it(t)!==null,_=g?Dn(Qe(t)):Qe(t),v=t.textAlign??`center`,y=t.textVAlign??`middle`,b=t.titleIcon?.placement===`inside`?yr(t.fontSize)+un(t.fontSize):0;return(0,Q.jsxs)(`div`,{className:`absolute flex`,style:{left:h.x,top:h.y,width:h.width,height:h.height,alignItems:y===`top`?`flex-start`:y===`bottom`?`flex-end`:`center`,justifyContent:v===`left`?`flex-start`:v===`right`?`flex-end`:`center`,transform:t.rotation?`rotate(${t.rotation}deg)`:void 0,transformOrigin:`center center`,padding:f,pointerEvents:`none`,opacity:Ic(t.opacity,i)},children:[t.titleIcon&&t.titleIcon.placement!==`inside`&&(()=>{let e=vn(t.kind,h.width,h.height,p);return(0,Q.jsx)(`span`,{className:`absolute flex items-center justify-center rounded-md bg-[var(--canvas-bg)]`,"data-testid":`node-title-icon`,style:{left:e.x-28/2,top:e.y-28/2,width:28,height:28,border:`1.5px solid ${Dn(t.color)}`,color:Dn(t.color)},children:(0,Q.jsx)(vS,{name:t.titleIcon.name,source:t.titleIcon.source,size:18})})})(),t.titleIcon&&t.titleIcon.placement===`inside`&&(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center`,"data-testid":`node-inside-icon`,style:{color:_,marginRight:un(t.fontSize)},children:(0,Q.jsx)(vS,{name:t.titleIcon.name,source:t.titleIcon.source,size:yr(t.fontSize)})}),(0,Q.jsx)(RC,{value:t.label,isEditing:n,interactive:r&&!t.locked,editableRef:u,onCommit:e=>s(t.id,e),"data-testid":`node-label`,softBreaks:{width:h.width-f*2-b,fontSize:t.fontSize},"data-shape-id":t.id,"data-fixed-ink":!g||void 0,onPointerDown:e=>{!n&&r&&a(t.id,e)},onDoubleClick:()=>r&&o(t.id),...Lc(t.id,l),className:`max-w-full whitespace-pre-wrap break-words leading-tight outline-none`,style:{...BC(t),textAlign:v,color:_,cursor:n?`text`:void 0,pointerEvents:n||r?`all`:`none`}})]})}var HC=(0,J.memo)(VC);function UC(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onBeginEdit:a,onCommitText:o,onMeasure:s}=e,c=(0,J.useRef)(null),l=W(t);return zC(c,t.id,14,s,[t.text,t.fontSize,t.fontFamily,t.lineHeight,t.letterSpacing].join(`|`),n),(0,Q.jsx)(`div`,{className:`absolute flex items-center justify-center`,style:{left:l.x,top:l.y,width:l.width,height:l.height,transform:t.rotation?`rotate(${t.rotation}deg)`:void 0,transformOrigin:`center center`,padding:14,pointerEvents:`none`,opacity:Ic(t.opacity,i)},children:(0,Q.jsx)(RC,{value:t.text,isEditing:n,interactive:r&&!t.locked,editableRef:c,onCommit:e=>o(t.id,e),"data-testid":`sticky-text`,prose:!0,softBreaks:{width:l.width-28,fontSize:t.fontSize},"data-shape-id":t.id,"data-fixed-ink":t.fill!==`transparent`||void 0,onDoubleClick:()=>r&&a(t.id),className:`max-w-full whitespace-pre-wrap break-words text-center leading-tight outline-none`,style:{...BC(t),color:t.fill===`transparent`?`var(--canvas-ink)`:qe(t.fill),cursor:n?`text`:void 0,pointerEvents:n?`all`:`none`}})})}var WC=(0,J.memo)(UC),GC={onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation()};function KC(e){let{frame:t,readOnly:n,canStart:r,buttonStyle:i,hover:a}=e,o=V(),s=H(e=>e.lastFlow[t.id]),[c,l]=(0,J.useState)(!1),u=t.flows??[];if(u.length===0)return r?(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`figure-flow-edit`,title:`Walk through this diagram one step at a time`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none opacity-45 transition-opacity hover:opacity-75`,style:i,...GC,onClick:e=>{e.stopPropagation(),_s(o,t.id)},...a,children:[(0,Q.jsx)(oc,{size:13,stroke:1.75}),`Flow`]}):null;let d=Ac(u,s);return(0,Q.jsxs)(`span`,{className:`flex items-center gap-2 whitespace-nowrap leading-none`,"data-testid":`figure-flows`,children:[d&&(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`figure-flow-play`,title:`Play ${d.name}`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none opacity-90 transition-opacity hover:opacity-100`,style:i,...GC,onClick:e=>{e.stopPropagation(),gs(o,t.id,d.id)},...a,children:[(0,Q.jsx)(E,{size:13,stroke:1.75}),d.name]}),(0,Q.jsxs)(k,{onOpenChange:e=>{if(l(e),e){Pa(Vy);return}o.store.getState().setFlowPreview(null)},children:[(0,Q.jsxs)(I,{"data-testid":`figure-flow-menu`,"aria-label":`${u.length===1?`The flow`:`All ${u.length} flows`} on ${t.label||`this diagram`}`,title:`All flows`,className:`flex cursor-pointer items-center gap-0.5 whitespace-nowrap leading-none opacity-60 transition-opacity hover:opacity-100 data-[popup-open]:opacity-100`,style:i,...GC,onPointerEnter:e=>{Pa(By),a.onPointerEnter?.(e)},onPointerLeave:a.onPointerLeave,onFocus:()=>Pa(By),children:[d?u.length:`${u.length} ${u.length===1?`flow`:`flows`}`,(0,Q.jsx)(`svg`,{width:`9`,height:`9`,viewBox:`0 0 9 9`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:`M1.5 3.25 4.5 6.25 7.5 3.25`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.6`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),(0,Q.jsx)(Ia,{active:c,retain:!0,feature:By,children:e=>(0,Q.jsx)(e,{frameId:t.id,readOnly:n})})]})]})}function qC(e){let{shapeId:t,fontFamily:n,color:r,codeStale:i,interactive:a,noun:o,testId:s,staleDotTestId:c,onEditCode:l,onHover:u}=e;return(0,Q.jsxs)(`button`,{type:`button`,"data-testid":s,"data-code-stale":i?`true`:`false`,title:i?`Edited on the canvas since its code was generated, so updating from code would replace those edits`:`Open this ${o}'s code`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none transition-opacity ${i?`opacity-100`:`opacity-70 hover:opacity-100`}`,style:{fontSize:12,fontFamily:n,fontWeight:nt(n),color:i?`#d97706`:Dn(r),pointerEvents:a?`all`:`none`},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),l(t)},...Lc(t,u),children:[i&&(0,Q.jsx)(`span`,{"aria-hidden":!0,"data-testid":c,style:{width:6,height:6,borderRadius:9999,background:`#f59e0b`}}),(0,Q.jsx)(Ds,{size:13,stroke:1.75}),`Edit as code`]})}function JC(e){let{value:t,left:n,top:r,width:i,transform:a,fontFamily:o,color:s,onDone:c}=e,l=(0,J.useRef)(null),u=(0,J.useRef)(!1);return(0,J.useEffect)(()=>{let e=requestAnimationFrame(()=>{l.current?.focus(),l.current?.select()});return()=>cancelAnimationFrame(e)},[]),(0,Q.jsx)(`input`,{ref:l,"data-testid":`lane-title-input`,defaultValue:t,onPointerDown:e=>e.stopPropagation(),onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault(),e.currentTarget.blur();return}e.key===`Escape`&&(e.stopPropagation(),u.current=!0,e.currentTarget.blur())},onBlur:e=>c(u.current?null:e.currentTarget.value),className:`absolute rounded-[4px] bg-[var(--canvas-bg)] px-1.5 py-0.5 text-center leading-none outline-none`,style:{left:n,top:r,transform:a,width:i,fontSize:14,fontFamily:o,fontWeight:nt(o),color:s,pointerEvents:`all`}})}function YC(e){let{shape:t,erasing:n,interactive:r,editingLane:i,onPointerDown:a,onBeginEditLane:o,onCommitLane:s,onHover:c}=e,l=t.lanes??[];if(!Mo(t.kind)||l.length===0)return null;let u=Po(t.kind),d=W(t),f=Eo(l.length,u?d.width:d.height,t.laneSizes),p=e=>(f[e]+f[e+1])/2,m=e=>f[e+1]-f[e];return(0,Q.jsxs)(`div`,{className:`absolute`,style:{left:d.x,top:d.y,width:u?d.width:30,height:u?30:d.height,pointerEvents:`none`,opacity:Ic(t.opacity,n)},children:[l.map((e,n)=>(0,Q.jsx)(`div`,{"data-testid":`figure-lane-title`,"data-shape-id":t.id,onPointerDown:e=>{r&&a(t.id,e)},onDoubleClick:e=>{r&&(e.stopPropagation(),o(t.id,n))},...Lc(t.id,c),className:`absolute overflow-hidden text-ellipsis whitespace-nowrap px-3 text-center leading-none`,style:{left:u?p(n):30/2,top:u?30/2:p(n),width:m(n),boxSizing:`border-box`,transform:u?`translate(-50%, -50%)`:`translate(-50%, -50%) rotate(-90deg)`,fontSize:14,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),opacity:Oo,cursor:`move`,pointerEvents:r&&!t.locked&&i===null?`all`:`none`},children:e},n)),i!==null&&i<l.length&&(0,Q.jsx)(JC,{value:l[i],left:u?p(i):30/2,top:u?30/2:p(i),width:Math.max(80,m(i)-24),transform:u?`translate(-50%, -50%)`:`translate(-50%, -50%) rotate(-90deg)`,fontFamily:t.fontFamily,color:Dn(t.color),onDone:e=>s(t.id,i,e)},i)]})}function XC(e){let{shape:t,isEditing:n,interactive:r,readOnly:i,erasing:a,editingLane:o,codeStale:s,animated:c,nested:l,onPointerDown:u,onBeginEdit:d,onBeginEditLane:f,onCommitText:p,onCommitLane:m,onEditNotes:h,onAnimate:g,onEditCode:_,onPresent:v,onHover:y}=e,b=W(t),x=t.slideOrder!==void 0,S=(t.notes??``).trim().length>0,C=typeof t.code==`string`&&t.code.trim().length>0,w=t.flows??[],T=!i&&!l&&(!x||w.length>0),D={fontSize:12,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),pointerEvents:r?`all`:`none`};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`absolute flex items-end gap-1`,style:{left:b.x,top:b.y-4,pointerEvents:`none`,opacity:Ic(t.opacity,a)},children:[x&&(0,Q.jsx)(`span`,{className:`-translate-y-full`,"data-testid":`figure-slide-indicator`,title:`In the slide deck`,style:{color:Dn(t.color),opacity:.7},children:(0,Q.jsx)(ws,{size:15,stroke:1.75})}),t.titleIcon&&(0,Q.jsx)(`span`,{className:`-translate-y-full`,"data-testid":`figure-title-icon`,style:{color:Dn(t.color)},children:(0,Q.jsx)(vS,{name:t.titleIcon.name,source:t.titleIcon.source,size:15})}),(0,Q.jsx)(RC,{value:t.label,isEditing:n,onCommit:e=>p(t.id,e),"data-testid":`figure-label`,"data-shape-id":t.id,onPointerDown:e=>{!n&&r&&u(t.id,e)},onDoubleClick:e=>{r&&(e.stopPropagation(),d(t.id))},...Lc(t.id,y),className:`-translate-y-full whitespace-nowrap leading-none outline-none`,style:{fontSize:14,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),cursor:n?`text`:`move`,pointerEvents:r?`all`:`none`}})]}),(x||C&&!i||w.length>0||T)&&(0,Q.jsx)(`div`,{className:`absolute`,style:{left:b.x+b.width,top:b.y-4,pointerEvents:`none`,opacity:Ic(t.opacity,a)},children:(0,Q.jsxs)(`div`,{className:`-translate-x-full -translate-y-full flex items-center gap-3 whitespace-nowrap leading-none`,children:[(0,Q.jsx)(KC,{frame:t,readOnly:i,canStart:T,buttonStyle:D,hover:Lc(t.id,y)}),C&&!i&&(0,Q.jsx)(qC,{shapeId:t.id,fontFamily:t.fontFamily,color:t.color,codeStale:s??!1,interactive:r,noun:`diagram`,testId:`figure-edit-code`,staleDotTestId:`figure-code-stale-dot`,onEditCode:_,onHover:y}),x&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[!i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`figure-notes-button`,title:S?t.notes:`Add speaker notes`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none transition-opacity ${S?`opacity-90 hover:opacity-100`:`opacity-45 hover:opacity-75`}`,style:{fontSize:12,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),pointerEvents:r?`all`:`none`},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),h(t.id)},...Lc(t.id,y),children:[S?(0,Q.jsx)(nc,{size:13,stroke:1.75}):(0,Q.jsx)(ic,{size:13,stroke:1.75}),`Speaker notes`]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`figure-animate-button`,"data-animated":c?`true`:`false`,title:c?`This slide builds in steps. Click to edit the order.`:`Set the order this slide's contents appear in`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none transition-opacity ${c?`opacity-90 hover:opacity-100`:`opacity-45 hover:opacity-75`}`,style:{fontSize:12,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),pointerEvents:r?`all`:`none`},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),g(t.id)},...Lc(t.id,y),children:[(0,Q.jsx)(Ls,{size:13,stroke:1.75}),`Animate`]})]}),(0,Q.jsx)(`span`,{className:`h-3 w-px`,style:{background:Dn(t.color),opacity:.25}})]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`figure-present-button`,title:`Present from this slide`,className:`flex cursor-pointer items-center gap-1 whitespace-nowrap leading-none opacity-90 transition-opacity hover:opacity-100`,style:{fontSize:12,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Dn(t.color),pointerEvents:r?`all`:`none`},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),onClick:e=>{e.stopPropagation(),v(t.id)},...Lc(t.id,y),children:[(0,Q.jsx)(E,{size:13,stroke:1.75}),`Present`]})]})]})}),(0,Q.jsx)(YC,{shape:t,erasing:a,interactive:r,editingLane:o,onPointerDown:u,onBeginEditLane:f,onCommitLane:m,onHover:y})]})}var ZC=(0,J.memo)(XC);function QC(e){let{id:t,label:n,point:r,fontSize:i,fontFamily:a,color:o,opacity:s,testId:c,isEditing:l,interactive:u,locked:d,erasing:f,onPointerDown:p,onLabelPointerDown:m,onBeginEdit:h,onCommitText:g,onHover:_}=e;if(!l&&n.length===0)return null;let v=a??At,y=o===`transparent`?`var(--canvas-ink)`:o;return(0,Q.jsx)(RC,{value:n,isEditing:l,interactive:u&&!d,onCommit:e=>g(t,e),"data-testid":c,"data-shape-id":t,onPointerDown:e=>{if(l){e.stopPropagation();return}u&&(m??p)(t,e)},onDoubleClick:e=>{u&&(e.stopPropagation(),h(t))},...Lc(t,_),className:`absolute whitespace-pre rounded-[2px] text-center outline-none`,style:{left:r.x,top:r.y,transform:`translate(-50%, -50%)`,transformOrigin:`center center`,lineHeight:Zt,fontSize:i??20,fontFamily:v,fontWeight:nt(v),color:y,opacity:Ic(s,f),backgroundColor:`var(--canvas-bg)`,padding:`0 10px`,pointerEvents:u||l?`all`:`none`,cursor:l?`text`:u&&!d&&m?`move`:void 0,outline:l?`1.5px solid var(--canvas-selection)`:void 0,outlineOffset:l?3:void 0}})}function $C(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onLabelPointerDown:o,onBeginEdit:s,onCommitText:c,onHover:l}=e;return(0,Q.jsx)(QC,{id:t.id,label:t.label??``,point:er(t),fontSize:t.fontSize,fontFamily:t.fontFamily,color:Dn(t.color),opacity:t.opacity,testId:`arrow-label`,isEditing:n,interactive:r,locked:t.locked,erasing:i,onPointerDown:a,onLabelPointerDown:o,onBeginEdit:s,onCommitText:c,onHover:l})}var ew=(0,J.memo)($C);function tw(e){let{shape:t,text:n,end:r,erasing:i}=e;if(n.length===0)return null;let a=lr(t,r),o=t.fontFamily??At,s=t.color===`transparent`?`var(--canvas-ink)`:t.color;return(0,Q.jsx)(`div`,{"data-testid":`arrow-${r}-label`,"data-shape-id":t.id,className:`absolute whitespace-pre rounded-[2px] text-center`,style:{left:a.x,top:a.y,transform:`translate(-50%, -50%)`,lineHeight:Zt,fontSize:14,fontFamily:o,fontWeight:nt(o),color:s,opacity:Ic(t.opacity,i),backgroundColor:`var(--canvas-bg)`,padding:`0 4px`,pointerEvents:`none`},children:n})}function nw(e){let{shape:t,erasing:n}=e;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(tw,{shape:t,text:t.startLabel??``,end:`start`,erasing:n}),(0,Q.jsx)(tw,{shape:t,text:t.endLabel??``,end:`end`,erasing:n})]})}var rw=(0,J.memo)(nw);function iw(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onLabelPointerDown:o,onBeginEdit:s,onCommitText:c,onHover:l}=e;return(0,Q.jsx)(QC,{id:t.id,label:t.label??``,point:kr(t.points,t.labelAlong),fontSize:t.fontSize,fontFamily:t.fontFamily,color:Dn(t.color),opacity:t.opacity,testId:`line-label`,isEditing:n,interactive:r,locked:t.locked,erasing:i,onPointerDown:a,onLabelPointerDown:o,onBeginEdit:s,onCommitText:c,onHover:l})}var aw=(0,J.memo)(iw),ow=`#8a8f98`;function sw(e){let{shape:t,field:n,onCommitText:r}=e,i=Zl(t,n),a=an(t),o=W(t),s=o.x+o.width/2-i.x,c=o.y+o.height/2-i.y,l=n===`body`?t.body??``:n===`primary`?gi(t):n===`secondary`?mi(t):t.label,u;if(n===`primary`){let e=Jn(In(t.color));u=e?Wt(e):qe(t.color)}else u=n===`body`&&t.kind===`card`?ow:Dn(t.color);return(0,Q.jsx)(`div`,{className:`absolute flex ${i.valign===`top`?`items-start`:`items-center`} ${i.align===`left`?`justify-start`:`justify-center`}`,style:{left:i.x,top:i.y,width:i.width,height:i.height,transform:a?`rotate(${a}deg)`:void 0,transformOrigin:`${s}px ${c}px`},"data-testid":`control-label-editor`,"data-control-field":n,children:(0,Q.jsx)(RC,{value:l,isEditing:!0,interactive:!0,plain:!0,onCommit:e=>r(t.id,e,n),className:`max-w-full whitespace-pre-wrap break-words outline-none ${i.align===`left`?`text-left`:`text-center`}`,style:{fontSize:i.fontSize,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),lineHeight:i.lineHeight,color:u,cursor:`text`,pointerEvents:`all`}})})}var cw=(0,J.memo)(sw);function lw(e,t,n,r,i,a){let o=V().measurements.labelWidths;(0,J.useEffect)(()=>{let s=e.current;if(!s)return;let c=()=>r(t,s.offsetWidth+n*2);if(o.get(t)!==i&&(o.set(t,i),c()),!a)return;let l=new ResizeObserver(c);return l.observe(s),()=>l.disconnect()},[e,t,n,r,i,a,o])}var uw=16;function dw(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onBeginEdit:o,onCommitText:s,onMeasure:c,onHover:l}=e,u=(0,J.useRef)(null),d=W(t);return lw(u,t.id,uw,c,`${t.label}|${t.fontSize}|${t.fontFamily}`,n),(0,Q.jsx)(`div`,{className:`absolute flex items-center justify-center`,style:{left:d.x,top:d.y,width:d.width,height:zr(t),pointerEvents:`none`,opacity:Ic(t.opacity,i)},children:(0,Q.jsx)(RC,{value:t.label,isEditing:n,interactive:r&&!t.locked,editableRef:u,plain:!0,onCommit:e=>s(t.id,e),"data-testid":`lifeline-name`,"data-shape-id":t.id,onPointerDown:e=>{!n&&r&&a(t.id,e)},onDoubleClick:()=>r&&o(t.id),...Lc(t.id,l),className:`whitespace-nowrap leading-none outline-none`,style:{fontSize:t.fontSize,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:Nr(t)??Dn(t.color),cursor:n?`text`:`move`,pointerEvents:n||r?`all`:`none`}})})}var fw=(0,J.memo)(dw);function pw(e,t,n,r){let{store:i,history:a}=V(),{runWithoutHistory:o}=a,s=(0,J.useRef)(null),c=(0,J.useRef)({store:i,runWithoutHistory:o});c.current={store:i,runWithoutHistory:o},(0,J.useEffect)(()=>{let r=e.current;if(!r||!n){s.current=null;return}s.current={width:r.offsetWidth,height:r.offsetHeight};let i=new ResizeObserver(()=>{let e=s.current,i=r.offsetWidth,a=r.offsetHeight;if(!e||e.width===i&&e.height===a)return;s.current={width:i,height:a};let o=n*Math.PI/180,l=Math.cos(o),u=Math.sin(o),d=(e.width-i)/2,f=(e.height-a)/2,p=d*(1-l)+f*u,m=f*(1-l)-d*u;if(Math.abs(p)<.01&&Math.abs(m)<.01)return;let h=c.current.store.getState(),g=xr(h.shapes,t);g?.type===`text`&&c.current.runWithoutHistory(()=>h.updateShape(t,{x:g.x+p,y:g.y+m}))});return i.observe(r),()=>i.disconnect()},[e,t,n,r])}function mw(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onBeginEdit:o,onCommitText:s,onHover:c}=e,l=(0,J.useRef)(null);pw(l,t.id,t.rotation,n);function u(e){if(n){e.stopPropagation();return}r&&a(t.id,e)}let d=t.width!=null,f=t.height!=null,p=t.textVAlign??`top`,m=[t.rotation?`rotate(${t.rotation}deg)`:``,t.flipX?`scaleX(-1)`:``,t.flipY?`scaleY(-1)`:``].filter(Boolean).join(` `);return f?(0,Q.jsx)(`div`,{ref:l,"data-shape-id":t.id,"data-testid":`text-box`,onPointerDown:u,onDoubleClick:()=>r&&o(t.id),onPointerEnter:()=>c(t.id),onPointerLeave:()=>c(null),className:`absolute flex flex-col rounded-[2px]`,style:{left:t.x,top:t.y,width:d?t.width:void 0,minHeight:t.height,justifyContent:p===`top`?`flex-start`:p===`bottom`?`flex-end`:`center`,transform:m||void 0,transformOrigin:`center center`,pointerEvents:r||n?`all`:`none`,opacity:Ic(t.opacity,i),outline:n?`1.5px solid var(--canvas-selection)`:void 0,outlineOffset:n?3:void 0},children:(0,Q.jsx)(RC,{value:t.text,isEditing:n,interactive:r&&!t.locked,onCommit:e=>s(t.id,e),"data-testid":`text`,prose:!0,softBreaks:t.width==null?void 0:{width:t.width,fontSize:t.fontSize},className:`outline-none`,style:{...BC(t),width:d?`100%`:void 0,minWidth:n?void 0:t.fontSize,lineHeight:t.lineHeight??1.15,textAlign:t.textAlign,color:Dn(t.color),whiteSpace:d?`pre-wrap`:`pre`,overflowWrap:d?`break-word`:void 0,cursor:n?`text`:void 0}})}):(0,Q.jsx)(RC,{value:t.text,isEditing:n,interactive:r&&!t.locked,onCommit:e=>s(t.id,e),editableRef:l,"data-shape-id":t.id,"data-testid":`text`,prose:!0,softBreaks:t.width==null?void 0:{width:t.width,fontSize:t.fontSize},onPointerDown:u,onDoubleClick:()=>r&&o(t.id),onPointerEnter:()=>c(t.id),onPointerLeave:()=>c(null),className:`absolute rounded-[2px] outline-none`,style:{...BC(t),left:t.x,top:t.y,lineHeight:t.lineHeight??1.15,textAlign:t.textAlign,color:Dn(t.color),opacity:Ic(t.opacity,i),width:d?t.width:void 0,minWidth:n?void 0:t.fontSize,minHeight:t.fontSize,whiteSpace:d?`pre-wrap`:`pre`,overflowWrap:d?`break-word`:void 0,transform:m||void 0,transformOrigin:`center center`,pointerEvents:r||n?`all`:`none`,cursor:n?`text`:void 0,outline:n?`1.5px solid var(--canvas-selection)`:void 0,outlineOffset:n?3:void 0}})}var hw=(0,J.memo)(mw);function gw(e){let{shape:t,isEditing:n,interactive:r,erasing:i,onPointerDown:a,onBeginEdit:o,onCommitText:s,onHover:c}=e,l=W(t);if(!n&&t.label.length===0)return null;let u=l.x+l.width/2,d=t.fontSize??36,f=Hn(d);return(0,Q.jsx)(`div`,{className:`absolute`,style:{left:u,top:l.y+l.height+f,transform:t.rotation?`translateX(-50%) rotate(${t.rotation}deg)`:`translateX(-50%)`,transformOrigin:`center ${-(l.height/2+f)}px`,opacity:Ic(t.opacity,i),pointerEvents:`none`},children:(0,Q.jsx)(RC,{value:t.label,isEditing:n,interactive:r&&!t.locked,onCommit:e=>s(t.id,e),"data-icon-label":t.id,onPointerDown:e=>{if(n){e.stopPropagation();return}r&&a(t.id,e)},onDoubleClick:()=>r&&o(t.id),...Lc(t.id,c),className:`whitespace-pre text-center leading-tight outline-none`,style:{fontSize:d,fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily),color:t.color===`transparent`?`var(--canvas-ink)`:Dn(t.color),cursor:n?`text`:void 0,pointerEvents:r||n?`all`:`none`}})})}var _w=(0,J.memo)(gw);function vw(e){let{shape:t,interactive:n,erasing:r,codeStale:i,onEditCode:a,onHover:o}=e,s=W(t),c=an(t);return(0,Q.jsx)(`div`,{className:`absolute`,style:{left:s.x+s.width,top:s.y,transform:c?`rotate(${c}deg)`:void 0,transformOrigin:`${-s.width/2}px ${s.height/2}px`,pointerEvents:`none`,opacity:Ic(t.opacity,r)},children:(0,Q.jsx)(`div`,{className:`-translate-x-full -translate-y-full flex items-center whitespace-nowrap pb-1 leading-none`,children:(0,Q.jsx)(qC,{shapeId:t.id,fontFamily:t.fontFamily,color:t.color,codeStale:i,interactive:n,noun:`chart`,testId:`chart-edit-code`,staleDotTestId:`chart-code-stale-dot`,onEditCode:a,onHover:o})})})}function yw(e){let{shape:t,interactive:n,erasing:r,onPointerDown:i,onBeginEditCell:a,onHover:o}=e,{store:s}=V(),c=$a(t),l={pointerEvents:`none`};return(0,Q.jsxs)(`g`,{"data-shape-id":t.id,"data-testid":`table`,opacity:Ic(t.opacity,r),children:[(0,Q.jsx)(`rect`,{x:c.frame.x,y:c.frame.y,width:c.frame.width,height:c.frame.height,rx:2,fill:`var(--paper-bg)`,stroke:so,strokeWidth:1.25,style:l}),c.cellFills.map(e=>(0,Q.jsx)(`rect`,{"data-testid":`table-cell-bg`,x:e.rect.x,y:e.rect.y,width:e.rect.width,height:e.rect.height,fill:fn(e.fill),style:l},e.key)),c.dividers.map(e=>(0,Q.jsx)(`line`,{x1:e.x1,y1:e.y1,x2:e.x2,y2:e.y2,stroke:so,strokeWidth:1,style:l},e.key)),t.cells.flatMap((e,r)=>e.map((e,c)=>{let l=wo(t,r,c);return(0,Q.jsx)(`rect`,{"data-testid":`table-cell-hit`,x:l.x,y:l.y,width:l.width,height:l.height,fill:`transparent`,style:{pointerEvents:n?`all`:`none`},onPointerDown:e=>{s.getState().setTableSelection(null),i(t.id,e)},onDoubleClick:()=>n&&a(t.id,r,c),...Lc(t.id,o)},`hit-${r}-${c}`)}))]})}function bw(e,t,n,r){let i=e.cells.length,a=e.cells[0]?.length??0;if(!(r.metaKey||r.ctrlKey||r.altKey)){if(r.key===`Tab`){let e=t*a+n+(r.shiftKey?-1:1);return e<0||e>=i*a?{row:t,col:n}:{row:Math.floor(e/a),col:e%a}}if(r.key===`Enter`&&!r.shiftKey)return t+1<i?{row:t+1,col:n}:null}}function xw(e){let{shape:t,row:n,col:r,text:i,rect:a,editing:o,erasing:s,onCommit:c,onMeasure:l}=e,{store:u,textEditGuard:d}=V(),f=(0,J.useRef)(null);Fc(f,o);let p=io(t,n,r);return(0,J.useEffect)(()=>{let e=f.current;if(!e)return;let i=()=>l(t.id,n,r,e.offsetHeight+16);i();let a=new ResizeObserver(i);return a.observe(e),()=>a.disconnect()},[l,t.id,n,r,i,a.width,p.fontSize,p.fontFamily,o]),(0,Q.jsx)(`div`,{"data-testid":`table-cell-box`,className:`absolute flex flex-col justify-center overflow-hidden`,style:{left:a.x,top:a.y,width:a.width,height:a.height,padding:8,boxSizing:`border-box`,opacity:Ic(t.opacity,s),pointerEvents:o?`all`:`none`,outline:o?`1.5px solid var(--canvas-selection)`:void 0,outlineOffset:-1},children:(0,Q.jsx)(`div`,{ref:f,"data-testid":`table-cell`,"data-shape-id":t.id,contentEditable:o,suppressContentEditableWarning:!0,spellCheck:!1,onKeyDown:e=>{if(Rc(e,d.release),e.nativeEvent.isComposing)return;let i=bw(t,n,r,e);i!==void 0&&(e.preventDefault(),e.stopPropagation(),d.release(),e.currentTarget.blur(),i&&u.getState().beginTableCellEdit(t.id,i.row,i.col))},onBlur:e=>c(t.id,n,r,e.currentTarget.innerText??``),className:`w-full whitespace-pre-wrap break-words leading-tight outline-none`,style:{fontSize:p.fontSize,fontFamily:p.fontFamily,fontWeight:nt(p.fontFamily),color:Dn(p.color),cursor:o?`text`:void 0},children:o?i:ki(i,a.width-16,p.fontSize)})})}function Sw(e){let{shape:t,editingCell:n,erasing:r,onCommitCell:i,onMeasureCell:a}=e;return(0,Q.jsx)(Q.Fragment,{children:t.cells.flatMap((e,o)=>e.map((e,s)=>{let c=n?.row===o&&n?.col===s;return e.length===0&&!c?null:(0,Q.jsx)(xw,{shape:t,row:o,col:s,text:e,rect:wo(t,o,s),editing:c,erasing:r,onCommit:i,onMeasure:a},`${o}-${s}`)}))})}var Cw=(0,J.memo)(yw),ww=(0,J.memo)(Sw);function Tw(e){let t=fg(!0);if(t)return(0,Q.jsx)(t.WebView,{...e});let{shape:n,interactive:r,interacting:i,erasing:a,onPointerDown:o}=e;return(0,Q.jsx)(`div`,{"data-shape-id":n.id,className:`absolute`,style:{left:n.x,top:n.y,width:n.width,height:n.height,borderRadius:Math.min(12,n.width/8,n.height/8),opacity:Ic(n.opacity,a),pointerEvents:r||i?`auto`:`none`,boxShadow:`0 0 0 1px color-mix(in srgb, var(--canvas-ink) 14%, transparent), 0 1px 3px rgba(0,0,0,0.06)`,background:`var(--paper-bg)`},onPointerDown:e=>o(n.id,e)})}var Ew=(0,J.memo)(Tw),Dw=(0,J.createContext)(null),Ow=Dw.Provider;function kw(){let e=(0,J.useContext)(Dw);if(!e)throw Error(`Shape views render under <Scene>.`);return e}var Aw={arrow:{geometry:(e,t)=>(0,Q.jsx)(qx,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit.kind===`text`,r=(e.label??``).length>0||n,i=(e.startLabel??``).length>0||(e.endLabel??``).length>0;return!r&&!i||!n&&!t.legible(e.fontSize??20)?null:(0,Q.jsxs)(J.Fragment,{children:[r&&(0,Q.jsx)(ew,{shape:e,isEditing:n,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onLabelPointerDown:t.handlers.onLabelPointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onHover:t.handlers.onHover}),i&&(0,Q.jsx)(rw,{shape:e,erasing:t.erasing})]},`label-${e.id}`)}},image:{geometry:(e,t)=>(0,Q.jsx)(Yx,{shape:e,interactive:t.interactive,cropping:t.edit.kind===`crop`,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginCrop:t.handlers.onBeginCrop,onHover:t.handlers.onHover},e.id)},icon:{geometry:(e,t)=>(0,Q.jsx)(oS,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit.kind===`text`;return e.label.length===0&&!n||!n&&!t.legible(e.fontSize)?null:(0,Q.jsx)(_w,{shape:e,isEditing:n,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onHover:t.handlers.onHover},`label-${e.id}`)}},rectangle:{geometry:(e,t)=>(0,Q.jsx)(zx,{shape:e,interactive:t.interactive,selected:t.selected,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit.kind===`text`;return e.label.length===0&&!n&&!e.titleIcon||!n&&!t.legible(e.fontSize)?null:(0,Q.jsx)(HC,{shape:e,isEditing:n,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onMeasure:t.handlers.onMeasureLabel,onHover:t.handlers.onHover},`label-${e.id}`)}},sticky:{geometry:(e,t)=>(0,Q.jsx)(Vx,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit.kind===`text`;return!n&&!t.legible(e.fontSize)?null:(0,Q.jsx)(WC,{shape:e,isEditing:n,interactive:t.interactive,erasing:t.erasing,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onMeasure:t.handlers.onMeasureLabel},`label-${e.id}`)}},draw:{geometry:(e,t)=>(0,Q.jsx)(Zx,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onHover:t.handlers.onHover},e.id)},polygon:{geometry:(e,t)=>(0,Q.jsx)($x,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginVertexEdit:t.handlers.onBeginVertexEdit,onHover:t.handlers.onHover},e.id)},line:{geometry:(e,t)=>(0,Q.jsx)(tS,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit.kind===`text`;return(e.label??``).length===0&&!n||!n&&!t.legible(e.fontSize??20)?null:(0,Q.jsx)(aw,{shape:e,isEditing:n,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onLabelPointerDown:t.handlers.onLabelPointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onHover:t.handlers.onHover},`label-${e.id}`)}},table:{geometry:(e,t)=>(0,Q.jsx)(Cw,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEditCell:t.handlers.onBeginEditCell,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit;return n.kind!==`table-cell`&&!t.legible(e.fontSize)?null:(0,Q.jsx)(ww,{shape:e,editingCell:n.kind===`table-cell`?{row:n.row,col:n.col}:null,erasing:t.erasing,onCommitCell:t.handlers.onCommitCell,onMeasureCell:t.handlers.onMeasureCell},`cells-${e.id}`)}},chart:{geometry:(e,t)=>(0,Q.jsx)(uS,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>t.chromeReadOnly||typeof e.code!=`string`||e.code.trim().length===0?null:(0,Q.jsx)(vw,{shape:e,interactive:t.interactive,erasing:t.erasing,codeStale:t.codeStale,onEditCode:t.handlers.onEditCode,onHover:t.handlers.onHover},`code-${e.id}`)},control:{geometry:(e,t)=>(0,Q.jsx)(gS,{shape:e,interactive:t.interactive,editingField:t.edit.kind===`text`?t.edit.field:null,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{let n=t.edit;return e.kind===`lifeline`?(0,Q.jsx)(fw,{shape:e,isEditing:n.kind===`text`,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onMeasure:t.handlers.onMeasureLifelineWidth,onHover:t.handlers.onHover},`label-${e.id}`):n.kind===`text`?(0,Q.jsx)(cw,{shape:e,field:n.field,onCommitText:t.handlers.onCommitText},`label-${e.id}`):null}},web:{overlay:(e,t)=>(0,Q.jsx)(Ew,{shape:e,interactive:t.interactive,interacting:t.edit.kind===`interact`,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id)},text:{overlay:(e,t)=>(0,Q.jsx)(hw,{shape:e,isEditing:t.edit.kind===`text`,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onCommitText:t.handlers.onCommitText,onHover:t.handlers.onHover},e.id)},figure:{geometry:(e,t)=>(0,Q.jsx)(Wx,{shape:e,interactive:t.interactive,erasing:t.erasing,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onHover:t.handlers.onHover},e.id),overlay:(e,t)=>{if(t.hideFigures&&!t.nested)return null;let n=t.edit;return(0,Q.jsx)(ZC,{shape:e,isEditing:n.kind===`text`,interactive:t.interactive,readOnly:t.chromeReadOnly,erasing:t.erasing,editingLane:n.kind===`lane`?n.lane:null,codeStale:t.codeStale,animated:t.animated,nested:t.nested,onPointerDown:t.handlers.onShapePointerDown,onBeginEdit:t.handlers.onBeginEdit,onBeginEditLane:t.handlers.onBeginEditLane,onCommitText:t.handlers.onCommitText,onCommitLane:t.handlers.onCommitLane,onEditNotes:t.handlers.onEditNotes,onAnimate:t.handlers.onAnimate,onEditCode:t.handlers.onEditCode,onPresent:t.handlers.onPresent,onHover:t.handlers.onHover},`label-${e.id}`)}}};function jw(e,t){return Aw[e.type].geometry?.(e,t)??null}function Mw(e,t){return Aw[e.type].overlay?.(e,t)??null}var Nw={className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`}},Pw=256;function Fw(e){let{shapes:t,editSession:n,interactive:r,erasingIds:i,selectedIds:a,staleCodeFrames:o,animatedSlides:s,nestedIds:c,readOnly:l,zoom:u,hideFigures:d}=e,f=kw(),p=Uw(),m=e=>Nu(e,u),h=l||d;function g(e){return{edit:we(n,e.id),interactive:r,erasing:i.has(e.id),selected:a.has(e.id),codeStale:o.has(e.id),animated:s.has(e.id),nested:c.has(e.id),hideFigures:d,chromeReadOnly:h,legible:m,handlers:f}}let _=[],v=[],y=null;for(let e of t){let t=g(e),n=e.type===`figure`?null:jw(e,t);n&&(y||(y={ids:[],nodes:[]},_.push({group:v.length}),v.push(y)),y.ids.push(e.id),y.nodes.push(n));let r=Mw(e,t);r&&(y=null,_.push({overlay:r}))}let b=p(v.map(e=>e.ids));return(0,Q.jsx)(Q.Fragment,{children:_.map(e=>`overlay`in e?e.overlay:(0,Q.jsx)(`svg`,{...Nw,children:v[e.group].nodes},`chunk-${b[e.group]}`))})}function Iw(e,t,n){return e===t||n.every(n=>e.has(n.id)===t.has(n.id))}var Lw={shapes:`reference`,editSession:`editSession`,interactive:`reference`,erasingIds:`membership`,selectedIds:`membership`,staleCodeFrames:`membership`,animatedSlides:`membership`,nestedIds:`membership`,readOnly:`reference`,zoom:`reference`,hideFigures:`reference`},Rw=Object.keys(Lw);function zw(e,t){for(let n of Rw){let r=Lw[n];if(r===`reference`){if(e[n]!==t[n])return!1;continue}if(r===`membership`){if(!Iw(e[n],t[n],t.shapes))return!1;continue}if(e.editSession!==t.editSession){let n=xe(e.editSession),r=xe(t.editSession);if(t.shapes.some(e=>e.id===n||e.id===r))return!1}}return!0}var Bw=(0,J.memo)(Fw,zw);function Vw(e){let t=(0,J.useRef)([]);return(0,J.useMemo)(()=>{let n=Kw(t.current,e);return t.current=n,n},[e])}function Hw(e,t){let n=new Map,r=new Set,i=e.next;return{keys:t.map(t=>{let a;for(let n of t){let t=e.keyOf.get(n);if(t!==void 0&&!r.has(t)){a=t;break}}a??=String(i++),r.add(a);for(let e of t)n.set(e,a);return a}),state:{keyOf:n,next:i}}}function Uw(){let e=(0,J.useRef)({keyOf:new Map,next:0});return t=>{let{keys:n,state:r}=Hw(e.current,t);return e.current=r,n}}function Ww(e){let t=(0,J.useRef)({keyOfRun:new WeakMap,keyOfId:new Map,next:0});return(0,J.useMemo)(()=>{let n=t.current,r=new Set,i=e.map(e=>{let t=n.keyOfRun.get(e);if(!(t===void 0||r.has(t)))return r.add(t),t});e.forEach((e,t)=>{if(i[t]!==void 0)return;let a;for(let t of e){let e=n.keyOfId.get(t.id);if(e!==void 0&&!r.has(e)){a=e;break}}a??=String(n.next++),r.add(a),i[t]=a,n.keyOfRun.set(e,a);for(let t of e)n.keyOfId.set(t.id,a)});let a=e.reduce((e,t)=>e+t.length,0);return n.keyOfId.size>a*2+Pw&&(n.keyOfId=new Map,e.forEach((e,t)=>{for(let r of e)n.keyOfId.set(r.id,i[t])})),i},[e])}var Gw=Pw/8;function Kw(e,t){let n=new Map;for(let t of e)n.set(t[0],t);let r=[],i=[],a=()=>{for(let e=0;e<i.length;e+=Pw)r.push(i.slice(e,e+Pw));i=[]},o=0;for(;o<t.length;){let e=n.get(t[o]);if(e&&qw(e,t,o)){i.length>0&&i.length<Gw&&i.length+e.length<=Pw?(r.push([...i,...e]),i=[]):(a(),r.push(e)),o+=e.length;continue}i.push(t[o]),o+=1,i.length===Pw&&a()}return a(),r}function qw(e,t,n){if(n+e.length>t.length)return!1;for(let r=0;r<e.length;r+=1)if(e[r]!==t[n+r])return!1;return!0}function Jw(e,t,n){let r=(0,J.useRef)(null);return(0,J.useMemo)(()=>{if(n&&r.current!==null)return r.current;let i=e(t);return r.current=i,i},[e,t,n])}var Yw=e=>new Set(qc(e).keys());function Xw(e){let{shapes:t,draft:n,lineDraft:r,editSession:i,interactive:a,bindTarget:o,snapDot:s,onShapePointerDown:c,onLabelPointerDown:l,onBeginEdit:u,onBeginEditCell:d,onBeginEditLane:f,onBeginCrop:p,onBeginVertexEdit:m,onCommitText:h,onCommitCell:g,onCommitLane:_,onMeasureCell:v,onMeasureLabel:y,onMeasureLifelineWidth:b,onHover:x,zoom:S,hideFigures:C}=e;my(`Scene`);let w=U(),T=(0,J.useCallback)(e=>{let t=w.getState();t.viewMode||t.setNotesEditorId(e)},[w]),E=(0,J.useCallback)(e=>{let t=w.getState();t.viewMode||t.setAnimateSlideId(e)},[w]),D=(0,J.useCallback)(e=>{let t=w.getState();t.viewMode||(t.setSelectedIds(new Set([e])),t.setCodeOpen(!0))},[w]),O=(0,J.useCallback)(e=>{let t=w.getState(),n=Jr(t.shapes).findIndex(t=>t.id===e);n<0||t.setPresentingIndex(n)},[w]),k=H(e=>e.viewMode),A=H(e=>e.erasingIds),j=H(e=>e.selectedIds),ee=H(e=>e.shapes),M=H(e=>e.transforming),N=Jw(Lo,ee,M),P=Jw(Yw,ee,M),F=Jw(ci,ee,M),I=(0,J.useMemo)(()=>C?ci(t):F,[C,t,F]),te=o?xr(t,o.id):void 0,ne=t.filter(e=>e.type===`figure`&&(!C||I.has(e.id))),L=Vw(t),R=Ww(L),z=(0,J.useMemo)(()=>({onShapePointerDown:c,onLabelPointerDown:l,onBeginEdit:u,onBeginEditCell:d,onBeginEditLane:f,onBeginCrop:p,onBeginVertexEdit:m,onCommitText:h,onCommitCell:g,onCommitLane:_,onMeasureCell:v,onMeasureLabel:y,onMeasureLifelineWidth:b,onHover:x,onEditNotes:T,onAnimate:E,onEditCode:D,onPresent:O}),[c,l,u,d,f,p,m,h,g,_,v,y,b,x,T,E,D,O]),B=e=>({...Qw,interactive:a,erasing:A.has(e.id),handlers:z}),re={...Qw,handlers:z};return(0,Q.jsxs)(Ow,{value:z,children:[(0,Q.jsx)(`svg`,{...Nw,children:ne.map(e=>jw(e,B(e)))}),L.map((e,t)=>(0,Q.jsx)(Bw,{shapes:e,editSession:i,interactive:a,erasingIds:A,selectedIds:j,staleCodeFrames:N,animatedSlides:P,nestedIds:I,readOnly:k,zoom:S,hideFigures:C??!1},R[t])),(0,Q.jsxs)(`svg`,{...Nw,children:[n&&Zw(n,re),r&&(0,Q.jsxs)(Q.Fragment,{children:[jw(r,re),r.points.slice(0,-1).map((e,t)=>(0,Q.jsx)(`circle`,{cx:e.x,cy:e.y,r:4,fill:`#fff`,stroke:`var(--canvas-selection)`,strokeWidth:1.5,style:{pointerEvents:`none`}},t))]}),te&&o&&(0,Q.jsx)(Tx,{shape:te,point:o.point}),s&&(0,Q.jsx)(`circle`,{"data-testid":`snap-dot`,cx:s.x,cy:s.y,r:5,fill:`var(--canvas-selection)`,stroke:`#fff`,strokeWidth:1.5,style:{pointerEvents:`none`}})]})]})}function Zw(e,t){return(e.type===`chart`||e.type===`control`)&&!e_(e)?(0,Q.jsx)($w,{shape:e}):jw(e,t)}var Qw={edit:{kind:`none`},interactive:!1,erasing:!1,selected:!1,codeStale:!1,animated:!1,nested:!1,hideFigures:!1,chromeReadOnly:!1,legible:()=>!0};function $w(e){let{shape:t}=e;return(0,Q.jsx)(`rect`,{x:Math.min(t.x,t.x+t.width),y:Math.min(t.y,t.y+t.height),width:Math.abs(t.width),height:Math.abs(t.height),rx:4,fill:`none`,stroke:`var(--canvas-origin)`,strokeWidth:1.5,strokeDasharray:`6 4`,style:{pointerEvents:`none`}})}var eT=(0,J.memo)(Xw),tT=`var(--canvas-origin)`;function nT(e){let t=e.shape,n=t.x,r=t.y,i=t.width,a=t.height;return typeof n!=`number`||typeof r!=`number`||typeof i!=`number`||typeof a!=`number`||!Number.isFinite(n)||!Number.isFinite(r)||!Number.isFinite(i)||!Number.isFinite(a)||i<=0||a<=0?null:{x:n,y:r,width:i,height:a}}function rT(){let e=H(e=>e.opaqueShapes);if(e.length===0)return null;let t=e.map(e=>({id:e.id,bounds:nT(e)})).filter(e=>e.bounds!==null);return t.length===0?null:(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},"data-testid":`opaque-shapes`,"aria-hidden":!0,children:t.map(e=>(0,Q.jsx)(`rect`,{x:e.bounds.x,y:e.bounds.y,width:e.bounds.width,height:e.bounds.height,rx:8,fill:tT,fillOpacity:.04,stroke:tT,strokeOpacity:.35,strokeWidth:1.5,strokeDasharray:`4 6`,strokeLinecap:`round`,strokeLinejoin:`round`},e.id))})}var iT=14,aT=4,oT=14,sT=`var(--canvas-origin)`;function cT(e){let{position:t,onDragStart:n,onHoverChange:r}=e;return(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`quick-connect`,"aria-label":`Add connected node`,onPointerDown:e=>{e.stopPropagation(),n(e)},onPointerEnter:()=>r(!0),onPointerLeave:()=>r(!1),className:`group absolute flex h-[22px] w-[22px] -translate-x-1/2 -translate-y-1/2 items-center justify-center opacity-60 transition-opacity hover:opacity-100`,style:{left:t.x,top:t.y,cursor:`grab`,pointerEvents:`all`},children:[(0,Q.jsx)(`span`,{className:`absolute inset-0 rounded-full bg-[var(--canvas-selection)]/25 opacity-0 transition-opacity group-hover:opacity-100`}),(0,Q.jsx)(`span`,{className:`h-[7px] w-[7px] rounded-full bg-[var(--canvas-selection)]`})]})}function lT(e){let{source:t,name:n,bounds:r}=e;return Li(t)?(0,Q.jsx)(`image`,{"data-testid":`connect-ghost-icon`,href:Ri().assetIconUrl(t,n),x:r.x,y:r.y,width:r.width,height:r.height,opacity:.5}):(0,Q.jsx)(uT,{name:n,bounds:r})}function uT(e){let{name:t,bounds:n}=e,r=_l(t);return r?(0,Q.jsx)(bl,{node:r,at:{x:n.x,y:n.y},size:n.width,stroke:sT,strokeWidth:ir(3,n.width),"data-testid":`connect-ghost-icon`}):null}function dT(e,t,n=6){return bt(ut(e,n),st(e),t)}function fT(e){let t=(0,J.useRef)({inputs:e,answers:new Map});return e.some((e,n)=>e!==t.current.inputs[n])&&(t.current={inputs:e,answers:new Map}),t.current.answers}function pT(e){let{shape:t,viewport:n,onConnectingChange:r}=e,i=U(),a=V().measurement,o=H(e=>e.shapes),s=H(e=>e.style),c=s.strokeWidth,l=`strokeWidth`in t?t.strokeWidth:c,u=H(e=>e.coarsePointer),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[h,g]=(0,J.useState)(null);(0,J.useEffect)(()=>{if(u)return;let e=0,t=null;function n(){e=0,t&&m(t)}function r(r){t={x:r.clientX,y:r.clientY},e===0&&(e=requestAnimationFrame(n))}return document.addEventListener(`pointermove`,r),()=>{document.removeEventListener(`pointermove`,r),e!==0&&cancelAnimationFrame(e)}},[u]),(0,J.useEffect)(()=>{if(!h)return;let e=h;function r(t){m({x:t.clientX,y:t.clientY}),Math.hypot(t.clientX-e.start.x,t.clientY-e.start.y)>aT&&!e.moved&&g({...e,moved:!0})}function o(r){Math.hypot(r.clientX-e.start.x,r.clientY-e.start.y)>aT?kf(i,Cr({x:r.clientX,y:r.clientY},n),a):Of(i,Sf(t,e.direction),a),g(null),f(null)}function s(e){e.key===`Escape`&&(e.preventDefault(),g(null),f(null))}return window.addEventListener(`pointermove`,r),window.addEventListener(`pointerup`,o),window.addEventListener(`keydown`,s),()=>{window.removeEventListener(`pointermove`,r),window.removeEventListener(`pointerup`,o),window.removeEventListener(`keydown`,s)}},[h,n,i,a,t]);let _=!!h?.moved;(0,J.useEffect)(()=>(r(_),()=>r(!1)),[_,r]);let v=fT([o,n,t,a]),y=aa(t,a),{body:b,footprint:x}=y;if(Math.min(b.width,b.height)*n.zoom<24)return null;let S=b.width/2,C=b.height/2,w={x:b.x+S,y:b.y+C},T=G(w,n),E={up:{x:0,y:-C},down:{x:0,y:x.y+x.height-w.y},left:{x:-S,y:0},right:{x:S,y:0}};function D(e){let t=E[e],r=G(y.toWorld({x:w.x+t.x,y:w.y+t.y}),n),i=r.x-T.x,a=r.y-T.y,o=Math.hypot(i,a)||1;return{x:r.x+i/o*iT,y:r.y+a/o*iT}}function O(e){let r=D(e),i=Cr(r,n),s=oT/n.zoom;return o.some(e=>{if(e.id===t.id||e.type!==`rectangle`&&e.type!==`icon`&&e.type!==`image`&&e.type!==`sticky`||!pn(e)&&!dt(i,ut(pr(e),s)))return!1;let o=cn(e,a),c=G({x:o.x,y:o.y},n),l=Math.max(c.x,Math.min(r.x,c.x+o.width*n.zoom)),u=Math.max(c.y,Math.min(r.y,c.y+o.height*n.zoom));return Math.hypot(r.x-l,r.y-u)<oT})}function k(e){let t=v.get(e);if(t!==void 0)return t;let n=O(e);return v.set(e,n),n}let A=null;if(p){let e=y.toLocal(Cr(p,n)),t=e.x-w.x,r=e.y-w.y;A=Math.abs(t)/(S||1)>=Math.abs(r)/(C||1)?t>=0?`right`:`left`:r>=0?`down`:`up`}A&&k(A)&&(A=null);function j(e,r){let i=G({x:e.x,y:e.y},n),o={x:e.x+e.width/2,y:e.y+e.height/2},u=dT(b,o),d=dT(e,w),f=d;if(r){let e=Be(r.target,r.drop,a);u=dT(b,Ve(r.target,e,a)),d=Fe(r.target,e,w,void 0,a),f=`precise`in e&&e.precise?He(r.target,r.drop,a):d}let p=G(u,n),m=G(d,n),h=Math.atan2(m.y-p.y,m.x-p.x),g=Kt(c),_=$e(u,d),v=c*n.zoom,y=(e,t,r,i)=>jr(r,e,t,Ut(g,r,_)*n.zoom).map((e,t)=>(0,Q.jsx)(`path`,{"data-testid":t===0?i:void 0,d:e.d,fill:e.fill===`solid`?sT:`none`,stroke:sT,strokeWidth:v,strokeLinecap:`round`,strokeLinejoin:`round`},`${i??`head`}-${t}`)),x=t.type===`rectangle`?t.kind:`rectangle`,S=t.type===`rectangle`?t.corner:void 0,C=t.type===`rectangle`?{x:t.flipX,y:t.flipY}:void 0,T={x:i.x,y:i.y,width:e.width*n.zoom,height:e.height*n.zoom},E=T.x+T.width/2,D=T.y+T.height/2;return(0,Q.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 h-full w-full`,style:{overflow:`visible`},children:[r?(0,Q.jsx)(`rect`,{"data-testid":`connect-bind-highlight`,x:T.x-4,y:T.y-4,width:T.width+8,height:T.height+8,transform:r.rotation?`rotate(${r.rotation} ${E} ${D})`:void 0,rx:10,fill:`none`,stroke:`var(--canvas-selection)`,strokeWidth:2,strokeDasharray:`4 4`}):t.type===`icon`?(0,Q.jsx)(lT,{source:t.source,name:t.name,bounds:T}):(0,Q.jsx)(`path`,{"data-testid":`connect-ghost-node`,d:jn(x,T,S,C),fill:`none`,stroke:sT,strokeWidth:l*n.zoom,strokeLinejoin:`round`}),(0,Q.jsx)(`line`,{"data-testid":`connect-ghost-link`,x1:p.x,y1:p.y,x2:m.x,y2:m.y,stroke:sT,strokeWidth:v,strokeLinecap:`round`}),s.endArrow&&y(m,h,s.endHead??`arrow`,`connect-ghost-head`),s.startArrow&&y(p,h+Math.PI,s.startHead??`arrow`),r&&(0,Q.jsx)(`circle`,{"data-testid":`connect-bind-dot`,cx:G(f,n).x,cy:G(f,n).y,r:5,fill:`var(--canvas-selection)`,stroke:`#fff`,strokeWidth:1.5})]})}function ee(e){let t=G(dT(b,e),n),r=G(e,n);return(0,Q.jsxs)(`svg`,{className:`pointer-events-none absolute inset-0 h-full w-full`,style:{overflow:`visible`},children:[(0,Q.jsx)(`line`,{"data-testid":`connect-ghost-link`,x1:t.x,y1:t.y,x2:r.x,y2:r.y,stroke:sT,strokeWidth:c*n.zoom,strokeLinecap:`round`}),(0,Q.jsx)(`circle`,{"data-testid":`connect-drag-dot`,cx:r.x,cy:r.y,r:5,fill:sT})]})}let M=null;if(h?.moved&&p){let e=Cr(p,n),t=Af(i,e,a);M=t?j(t.type===`icon`&&t.label?cn(t,a):W(t,a),{rotation:t.type===`icon`&&t.label?0:an(t),target:t,drop:e}):ee(e)}else if(d){let e=jf(i,Sf(t,d));e&&(M=j({x:e.x+(b.x-x.x),y:e.y+(b.y-x.y),width:b.width,height:b.height}))}let N=h?h.direction:A,P=u?h?[h.direction]:[`up`,`down`,`left`,`right`].filter(e=>!k(e)):N?[N]:[];return(0,Q.jsxs)(Q.Fragment,{children:[M,!_&&P.map(e=>(0,Q.jsx)(cT,{position:D(e),onDragStart:t=>g({direction:e,start:{x:t.clientX,y:t.clientY},moved:!1}),onHoverChange:t=>f(t?e:null)},e))]})}function mT(e,t,n){let r=Wn(e),i=[];for(let e=0;e<r.length-1;e+=1){let a=r[e],o=r[e+1];if((Math.abs(o.x-a.x)+Math.abs(o.y-a.y))*t<=20)continue;let s={x:(a.x+o.x)/2,y:(a.y+o.y)/2};if(n&&Math.abs(s.x-n.x)<1&&Math.abs(s.y-n.y)<1)continue;let c=Math.abs(o.y-a.y)<=Math.abs(o.x-a.x);i.push({index:e,mid:s,axis:c?`y`:`x`})}return i}function hT(e){let{shape:t,viewport:n,onHandlePointerDown:r,onElbowSegmentPointerDown:i,onBendReset:a}=e,o=G({x:t.x,y:t.y},n),s=G({x:t.x2,y:t.y2},n),c=t.bendStyle===`elbow`,l=c?kn(t):null,u=l!==null&&l.span*n.zoom>20,d=c?mT(t,n.zoom,l):[];return(0,Q.jsxs)(Q.Fragment,{children:[c?u&&l&&(0,Q.jsx)(Hi,{testId:`elbow-mid-handle`,position:G(l,n),cursor:l.axis===`x`?`ew-resize`:`ns-resize`,round:!0,onPointerDown:e=>r(t.id,`bend`,e),onDoubleClick:()=>a(t.id)}):(0,Q.jsx)(Hi,{testId:`arrow-handle-bend`,position:G(Zn(t),n),cursor:`grab`,round:!0,onPointerDown:e=>r(t.id,`bend`,e),onDoubleClick:()=>a(t.id)}),d.map(e=>(0,Q.jsx)(Hi,{testId:`elbow-segment-handle-${e.index}`,position:G(e.mid,n),cursor:e.axis===`x`?`ew-resize`:`ns-resize`,round:!0,onPointerDown:n=>i(t.id,e.index,n),onDoubleClick:()=>a(t.id)},e.index)),(0,Q.jsx)(Hi,{testId:`arrow-handle-start`,position:o,cursor:`move`,round:!0,onPointerDown:e=>r(t.id,`start`,e)}),(0,Q.jsx)(Hi,{testId:`arrow-handle-end`,position:s,cursor:`move`,round:!0,onPointerDown:e=>r(t.id,`end`,e)})]})}var gT=[{handle:`nw`,corner:`border-t-[3px] border-l-[3px]`,cursor:`nwse-resize`},{handle:`ne`,corner:`border-t-[3px] border-r-[3px]`,cursor:`nesw-resize`},{handle:`sw`,corner:`border-b-[3px] border-l-[3px]`,cursor:`nesw-resize`},{handle:`se`,corner:`border-b-[3px] border-r-[3px]`,cursor:`nwse-resize`}],_T=[{handle:`n`,cursor:`ns-resize`},{handle:`s`,cursor:`ns-resize`},{handle:`w`,cursor:`ew-resize`},{handle:`e`,cursor:`ew-resize`}];function vT(e){let{shape:t,viewport:n,onCrop:r}=e,i=Ki(t),a=G({x:i.x+i.width/2,y:i.y+i.height/2},n),o=i.width*n.zoom,s=i.height*n.zoom;return(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:a.x,top:a.y,width:o,height:s,transform:`translate(-50%, -50%) rotate(${an(t)}deg)`},children:[(0,Q.jsx)(`div`,{className:`absolute inset-0 border border-[var(--canvas-selection)]`}),gT.map(e=>{let n=Yi(e.handle,o,s);return(0,Q.jsx)(`div`,{"data-testid":`crop-${e.handle}`,onPointerDown:n=>r(t.id,e.handle,n),className:`absolute h-4 w-4 -translate-x-1/2 -translate-y-1/2 ${ta} ${e.corner}`,style:{left:n.x,top:n.y,borderColor:`var(--canvas-selection)`,cursor:e.cursor,pointerEvents:`all`}},e.handle)}),_T.map(e=>{let n=Yi(e.handle,o,s),i=e.handle===`w`||e.handle===`e`;return(0,Q.jsx)(`div`,{"data-testid":`crop-${e.handle}`,onPointerDown:n=>r(t.id,e.handle,n),className:`absolute -translate-x-1/2 -translate-y-1/2 rounded bg-[var(--canvas-selection)] ${ta} ${i?`h-6 w-1`:`h-1 w-6`}`,style:{left:n.x,top:n.y,cursor:e.cursor,pointerEvents:`all`}},e.handle)})]})}function yT(e){let{bounds:t,rotation:n,viewport:r,onGroupHandlePointerDown:i,onRotate:a,showHandles:o,outlined:s,isGroup:c,titledTop:l}=e,u=H(e=>e.coarsePointer),d=G({x:t.x,y:t.y},r),f=t.width*r.zoom,p=t.height*r.zoom,m=Math.min(f,p)<24?6:0,h=Math.min(f,p)<16,g=h?na.filter(e=>e.handle===`nw`||e.handle===`se`):na,_=l&&!n?Gi(r.zoom):void 0,v=(e,t)=>n?Xi(e,n):t;return(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:d.x,top:d.y,width:f,height:p,transform:n?`rotate(${n}deg)`:void 0},children:[(0,Q.jsx)(`div`,{"data-testid":`group-box`,"data-rotation":n?Math.round(n*100)/100:void 0,className:`absolute inset-0 border-[1.5px] ${c?`border-dashed border-[var(--canvas-group-selection)]`:`border-[var(--canvas-selection)]`} ${s?``:`invisible`}`}),o&&(0,Q.jsxs)(Q.Fragment,{children:[!h&&(0,Q.jsx)(Qi,{testId:`group-rotate-handle`,position:{x:f+ra(),y:p+ra()},onPointerDown:a}),!u&&Zi.map(e=>(0,Q.jsx)(Ji,{testId:`group-resize-${e.handle}`,edge:e.handle,cursor:v(e.handle,e.cursor),along:e.handle===`n`||e.handle===`s`?f:p,across:e.handle===`n`||e.handle===`s`?p:f,outwardLimit:e.handle===`n`?_:void 0,onPointerDown:t=>i(e.handle,t)},e.handle)),g.map(e=>(0,Q.jsx)(Hi,{testId:`group-resize-${e.handle}`,position:Yi(e.handle,f,p,m),cursor:v(e.handle,e.cursor),minHitTop:_===void 0||!e.handle.startsWith(`n`)?void 0:-_,onPointerDown:t=>i(e.handle,t)},e.handle))]})]})}function bT(){let e=(0,J.useRef)(null),t=(0,J.useCallback)(t=>{let n=e.current;n&&(e.current=null,n.teardown(),n.callbacks.onEnd(t))},[]),n=(0,J.useCallback)((n,r)=>{t(`replace`);let i=n.pointerId;function a(e){e.pointerId===i&&r.onMove(e)}function o(e){e.pointerId===i&&t(e.type===`pointercancel`?`cancel`:`up`)}window.addEventListener(`pointermove`,a),window.addEventListener(`pointerup`,o),window.addEventListener(`pointercancel`,o);let s=Vi(()=>t(`deactivate`));function c(){window.removeEventListener(`pointermove`,a),window.removeEventListener(`pointerup`,o),window.removeEventListener(`pointercancel`,o),s()}e.current={callbacks:r,teardown:c};try{r.onStart?.()}catch(t){throw e.current=null,c(),t}},[t]);return(0,J.useEffect)(()=>()=>t(`unmount`),[t]),n}var xT=2;function ST(e){let{shape:t,viewport:n,onLaneAdd:r,onLaneDelete:i,onLaneEdit:a}=e,{store:o,history:s}=V(),c=bT(),l=t.lanes&&t.lanes.length>0?t.lanes:No,u=Po(t.kind),d=n.zoom,f=G({x:t.x,y:t.y},n),p=30*d,m=u?t.width:t.height,h=Eo(l.length,m,t.laneSizes),g=e=>h[e]*d,_=e=>(h[e+1]-h[e])*d,v=`flex items-center justify-center rounded-md bg-[var(--chrome-popup)] text-[var(--chrome-fg-900)] shadow-sm ring-1 ring-[var(--chrome-ring)] hover:bg-[var(--chrome-hover)]`;function y(e,n){n.stopPropagation(),n.preventDefault();let r=u?n.clientX:n.clientY,i=ko(l.length,t.laneSizes);c(n,{onStart:s.beginTransaction,onMove(n){let a=o.getState(),s=xr(a.shapes,t.id);if(s?.type!==`figure`)return;let c=u?s.width:s.height,l=((u?n.clientX:n.clientY)-r)/a.viewport.zoom,d=Do(i,e-1,l/c);a.replaceShape({...s,laneSizes:d})},onEnd(){s.endTransaction()}})}return(0,Q.jsxs)(Q.Fragment,{children:[l.map((e,n)=>(0,Q.jsx)(`div`,{"data-testid":`lane-gutter-hover`,"data-index":n,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>{e.stopPropagation(),a(t.id,n)},className:`group absolute`,style:u?{left:f.x+g(n),top:f.y+3,width:_(n),height:Math.max(0,p-3),pointerEvents:`all`}:{left:f.x+3,top:f.y+g(n),width:Math.max(0,p-3),height:_(n),pointerEvents:`all`},children:l.length>xT&&(0,Q.jsx)(`button`,{type:`button`,"data-testid":`lane-delete`,"data-index":n,onClick:()=>i(t.id,n),className:`${v} absolute h-5 w-5 opacity-0 transition-opacity group-hover:opacity-100`,style:u?{top:p/2-3,right:8,transform:`translateY(-50%)`}:{left:p/2-3,top:8,transform:`translateX(-50%)`},children:(0,Q.jsx)(uc,{size:12,stroke:2})})},n)),h.slice(1,-1).map((e,n)=>(0,Q.jsx)(`div`,{"data-testid":`lane-resize`,"data-index":n,onPointerDown:e=>y(n+1,e),className:`absolute`,style:u?{left:f.x+e*d-4,top:f.y,width:8,height:t.height*d,cursor:`col-resize`,pointerEvents:`all`}:{left:f.x,top:f.y+e*d-4,width:t.width*d,height:8,cursor:`row-resize`,pointerEvents:`all`}},`resize-${n}`)),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`lane-add`,onPointerDown:e=>e.stopPropagation(),onClick:()=>r(t.id),className:`${v} absolute h-6 w-6 ${u?`-translate-y-1/2`:`-translate-x-1/2`}`,style:u?{left:f.x+t.width*d+10,top:f.y+p/2,pointerEvents:`all`}:{left:f.x+p/2,top:f.y+t.height*d+10,pointerEvents:`all`},children:(0,Q.jsx)(ic,{size:14,stroke:2})})]})}function CT(e){let{shape:t,viewport:n,onLineVertexPointerDown:r}=e;return(0,Q.jsx)(Q.Fragment,{children:t.points.map((e,i)=>(0,Q.jsx)(Hi,{testId:`line-vertex-${i}`,position:G(e,n),cursor:`move`,round:!0,onPointerDown:e=>r(t.id,i,e)},i))})}var wT=[`n`,`e`,`s`,`w`];function TT(e){let{shape:t,viewport:n,onHandlePointerDown:r,onRotate:i,onDuplicate:a,showHandles:o,outlined:s}=e,c=qi(t),l=V().measurement,u=an(t),d=Wi(t,c,n.zoom,l),f=G({x:c.x,y:c.y},n),p=c.width*n.zoom,m=c.height*n.zoom,{edges:h,corners:g}=Ui(t),_=t.type!==`sticky`,v=H(e=>e.coarsePointer)&&g.length>0?[]:h,y=g.length>0&&Math.min(p,m)<24?6:0,b=Math.min(p,m)<16,x=b?g.filter(e=>e.handle===`nw`||e.handle===`se`):g,S=t.type===`figure`?Gi(n.zoom):void 0;return(0,Q.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:f.x,top:f.y,width:p,height:m,transform:u?`rotate(${u}deg)`:void 0,transformOrigin:`${d.x}px ${d.y}px`},children:[(0,Q.jsx)(`div`,{"data-testid":`selection-box`,className:`absolute inset-0 border-[1.5px] border-[var(--canvas-selection)] ${s?``:`invisible`}`}),o&&(0,Q.jsxs)(Q.Fragment,{children:[Xt(t)&&!b&&(0,Q.jsx)(Qi,{testId:`rotate-handle`,position:{x:p+ra(),y:m+ra()},onPointerDown:i}),_&&v.map(e=>(0,Q.jsx)(Ji,{testId:`resize-${e.handle}`,edge:e.handle,cursor:Xi(e.handle,u),along:e.handle===`n`||e.handle===`s`?p:m,across:e.handle===`n`||e.handle===`s`?m:p,inset:g.length===0?0:void 0,outwardLimit:e.handle===`n`?S:void 0,onPointerDown:n=>r(t.id,e.handle,n)},e.handle)),_&&x.map(e=>(0,Q.jsx)(Hi,{testId:`resize-${e.handle}`,position:Yi(e.handle,p,m,y),cursor:Xi(e.handle,u),minHitTop:S===void 0||!e.handle.startsWith(`n`)?void 0:-S,onPointerDown:n=>r(t.id,e.handle,n)},e.handle)),t.type===`sticky`&&wT.map(e=>(0,Q.jsx)(ea,{position:Yi(e,p,m),onPointerDown:e=>a(t.id,e)},e))]})]})}var ET=14;function DT(e){let{shape:t,viewport:n,onInsertColumn:r,onDeleteColumn:i,onInsertRow:a,onDeleteRow:o}=e,{store:s,history:c}=V(),l=H(e=>e.tableSelection),u=H(e=>e.setTableSelection),d=l&&l.id===t.id?l:null,f=(e,n)=>u({id:t.id,axis:e,index:n}),[p,m]=(0,J.useState)(null),h=bT();(0,J.useEffect)(()=>()=>u(null),[u]);let g=n.zoom,_=Za(t),v=G({x:t.x,y:t.y},n),y=Co(t),b=uo(t),x=_.width*g,S=_.height*g;function C(e,t,n){n.preventDefault(),n.stopPropagation(),f(e,t),m({axis:e,index:t,x:n.clientX,y:n.clientY})}function w(e,t,n){n.stopPropagation(),f(e,t)}function T(e,n){n.stopPropagation(),n.preventDefault();let r=n.clientX,i=t.colWidths[e];h(n,{onStart:c.beginTransaction,onMove(n){let a=s.getState(),o=xr(a.shapes,t.id);if(o?.type!==`table`)return;let c=(n.clientX-r)/a.viewport.zoom;a.replaceShape(Ga(o,e,i,c))},onEnd(){c.endTransaction()}})}let E=`absolute flex items-center justify-center border border-[var(--canvas-selection)]/40 bg-[var(--chrome-popup)]`,D=(e,t)=>d?.axis===e&&d.index===t;return(0,Q.jsxs)(Q.Fragment,{children:[t.colWidths.map((e,t)=>(0,Q.jsx)(`div`,{"data-testid":`table-col-header`,"data-index":t,onPointerDown:e=>w(`col`,t,e),onContextMenu:e=>C(`col`,t,e),className:`${E} cursor-pointer ${D(`col`,t)?`bg-[var(--canvas-selection)]/20`:`hover:bg-[var(--canvas-selection)]/10`}`,style:{left:v.x+y[t]*g,top:v.y-ET,width:e*g,height:ET,pointerEvents:`all`}},`col-${t}`)),t.colWidths.map((e,t)=>(0,Q.jsx)(`div`,{"data-testid":`table-col-resize`,"data-index":t,onPointerDown:e=>T(t,e),className:`absolute ${ta}`,style:{left:v.x+y[t+1]*g-3,top:v.y-ET,width:6,height:ET,cursor:`col-resize`,pointerEvents:`all`}},`col-resize-${t}`)),t.rowHeights.map((e,t)=>(0,Q.jsx)(`div`,{"data-testid":`table-row-header`,"data-index":t,onPointerDown:e=>w(`row`,t,e),onContextMenu:e=>C(`row`,t,e),className:`${E} cursor-pointer ${D(`row`,t)?`bg-[var(--canvas-selection)]/20`:`hover:bg-[var(--canvas-selection)]/10`}`,style:{left:v.x-ET,top:v.y+b[t]*g,width:ET,height:e*g,pointerEvents:`all`}},`row-${t}`)),d&&(0,Q.jsx)(`div`,{className:`pointer-events-none absolute bg-[var(--canvas-selection)]/10`,style:d.axis===`col`?{left:v.x+y[d.index]*g,top:v.y,width:t.colWidths[d.index]*g,height:S}:{left:v.x,top:v.y+b[d.index]*g,width:x,height:t.rowHeights[d.index]*g}}),p&&(0,Q.jsx)(OT,{menu:p,onClose:()=>m(null),onInsertBefore:()=>{p.axis===`col`?r(t.id,p.index):a(t.id,p.index)},onInsertAfter:()=>{p.axis===`col`?r(t.id,p.index+1):a(t.id,p.index+1)},onDelete:()=>{p.axis===`col`?i(t.id,p.index):o(t.id,p.index),u(null)}})]})}function OT(e){let{menu:t,onClose:n,onInsertBefore:r,onInsertAfter:i,onDelete:a}=e,o=t.axis===`col`,s=(0,J.useRef)(null),c=`block w-full cursor-pointer rounded-lg px-2.5 py-1.5 text-left text-[13px] text-[var(--chrome-fg-700)] outline-none hover:bg-[var(--chrome-hover)]`;function l(e){e(),n()}return(0,J.useEffect)(()=>{function e(e){s.current?.contains(e.target)||n()}function t(e){e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),n())}return window.addEventListener(`pointerdown`,e,!0),window.addEventListener(`keydown`,t,!0),()=>{window.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`keydown`,t,!0)}},[n]),(0,Q.jsxs)(`div`,{ref:s,"data-testid":`table-header-menu`,onPointerDown:e=>e.stopPropagation(),className:`fixed min-w-[170px] p-1 ${Wc.popup}`,style:{left:t.x,top:t.y,pointerEvents:`all`},children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`table-menu-insert-before`,className:c,onClick:()=>l(r),children:o?`Insert column left`:`Insert row above`}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`table-menu-insert-after`,className:c,onClick:()=>l(i),children:o?`Insert column right`:`Insert row below`}),(0,Q.jsx)(`div`,{className:`mx-1 my-1 h-px bg-[var(--chrome-divider)]`}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`table-menu-delete`,className:c,onClick:()=>l(a),children:o?`Delete column`:`Delete row`})]})}var kT=50;function AT(e,t,n,r,i){let a=o_(t,n,e,r),o=a===null?null:d_(e,a,i),s=e.length>1?o?.bounds??Bt(e,i):null,c=s!==null&&e.some(e=>e.type===`figure`&&Math.abs(W(e).y-s.y)<.5);return{group:s,rotation:o?.angle??0,titledTop:c}}function jT(e){let{shapes:t,viewport:n,gestures:r,onArrowBendReset:i,onSurfaceDoubleClick:a,cropping:o,editingVertices:s,transforming:c,isGroup:l,onTableInsertColumn:u,onTableDeleteColumn:d,onTableInsertRow:f,onTableDeleteRow:p,onLaneAdd:m,onLaneDelete:h,onLaneEdit:g,laneEditing:_}=e,{onHandlePointerDown:v,onLineVertexPointerDown:y,onElbowSegmentPointerDown:b,onGroupHandlePointerDown:x,onSelectionPointerDown:S,onSelectionPointerMove:C,onSelectionPointerLeave:w,onRotateHandlePointerDown:T,onCropHandlePointerDown:E,onStickyDuplicatePointerDown:D}=r,O=V().measurement,k=t.length===1?t[0]:null,A=H(e=>e.selectionFrame),j=H(e=>e.selectedIds),[ee,M]=(0,J.useReducer)(e=>e+1,0),N=(0,J.useRef)(null),P=[t,A,j,c,ee],F;t.length>kT&&N.current!==null&&N.current.key.every((e,t)=>e===P[t])?F=N.current.value:(F=AT(t,A,j,c,O),N.current={key:P,value:F});let{group:I}=F,te=F.rotation,ne=I?G({x:I.x,y:I.y},n):null,L=H(e=>e.resizing),R=!c||k?.type===`text`&&L,[z,B]=(0,J.useState)(!1),re=k?.type===`text`?k.id:null;(0,J.useEffect)(()=>{if(!re)return;let e=document.querySelector(zi(re));if(!(e instanceof HTMLElement))return;let t=new ResizeObserver(()=>M());return t.observe(e),()=>t.disconnect()},[re]);let ie=k?.type===`icon`?k:null;return(0,J.useLayoutEffect)(()=>{ie?.label&&M()},[ie?.id,ie?.label,ie?.fontSize,ie?.fontFamily]),(0,Q.jsxs)(`div`,{"data-selection-overlay":!0,className:`pointer-events-none absolute inset-0`,children:[I&&ne&&(0,Q.jsx)(`div`,{"data-testid":`selection-surface`,onPointerDown:S,onPointerMove:C,onPointerLeave:w,onDoubleClick:a,style:{position:`absolute`,left:ne.x,top:ne.y,width:I.width*n.zoom,height:I.height*n.zoom,transform:te?`rotate(${te}deg)`:void 0,pointerEvents:`all`}}),k&&o&&(0,Q.jsx)(vT,{shape:k,viewport:n,onCrop:E}),k&&!o&&k.type===`arrow`&&!c&&(0,Q.jsx)(hT,{shape:k,viewport:n,onHandlePointerDown:v,onElbowSegmentPointerDown:b,onBendReset:i}),k&&!o&&(k.type===`line`||k.type===`polygon`&&s)&&(0,Q.jsx)(CT,{shape:k,viewport:n,onLineVertexPointerDown:y}),k&&!o&&!s&&k.type!==`arrow`&&k.type!==`line`&&(0,Q.jsx)(TT,{shape:k,viewport:n,onHandlePointerDown:v,onRotate:T,onDuplicate:D,showHandles:!c&&!z,outlined:R}),k&&!o&&k.type===`figure`&&Mo(k.kind)&&!k.locked&&!c&&!_&&(0,Q.jsx)(ST,{shape:k,viewport:n,onLaneAdd:m,onLaneDelete:h,onLaneEdit:g}),k&&!o&&k.type===`table`&&!c&&(0,Q.jsx)(DT,{shape:k,viewport:n,onInsertColumn:u,onDeleteColumn:d,onInsertRow:f,onDeleteRow:p}),k&&!o&&(k.type===`rectangle`||k.type===`icon`)&&!c&&(0,Q.jsx)(pT,{shape:k,viewport:n,onConnectingChange:B}),I&&(0,Q.jsx)(yT,{bounds:I,rotation:te,viewport:n,onGroupHandlePointerDown:x,onRotate:T,showHandles:!c,outlined:R,isGroup:l,titledTop:F.titledTop})]})}function MT(e,t){return t===`start`?e.startBinding:e.endBinding}function NT(e,t){let n=[];for(let r of t)if(r.type===`arrow`)for(let t of[`start`,`end`]){let i=MT(r,t);i&&!Ue(i)&&i.shapeId===e.id&&i.precise&&n.push({arrow:r,end:t,binding:i})}return n}function PT(e){let{shape:t,shapes:n,mode:r,start:i,index:a,delta:o}=e,s=zr(t),c=t.height,l=t.activations??[],u=e=>l.map((t,n)=>n===a?e:t);if(r===`move`){let e=Math.min(Math.max(i.top+o,s),c-i.height),r=e-i.top;if(r===0)return{activations:u(i),arrows:[]};let a=Br(t),l=t.y+i.top,d=l+i.height,f=new Map;for(let e of NT(t,n)){let t=a.y+e.binding.anchor.y*a.height;if(t<l||t>d)continue;let n=Xe(e.binding.anchor.y+r/a.height),i=f.get(e.arrow.id)??e.arrow,o={...e.binding,anchor:{x:e.binding.anchor.x,y:n}};f.set(e.arrow.id,{...i,...e.end===`start`?{startBinding:o}:{endBinding:o}})}return{activations:u({top:e,height:i.height}),arrows:[...f.values()]}}let d=i.top+i.height,f=i.top,p=i.height;return r===`top`?(f=Math.min(Math.max(i.top+o,s),d-12),p=d-f):p=Math.min(Math.max(d+o,i.top+12),c)-f,{activations:u({top:f,height:p}),arrows:[]}}function FT(e,t){let n=[];for(let r of t)if(r.id!==e.id){if(r.type===`control`&&r.kind===`lifeline`){let e=ri(r);if(e.length>0){n.push(...e);continue}}n.push(W(r))}return n}function IT(e,t,n,r){let i=e=>e.filter(e=>e.axis===`y`);if(e===`move`){let e=Ag(t,n,r);return{dy:e.dy,guides:i(e.guides)}}let a=t.x+t.width/2,o=e===`top`?t.y:t.y+t.height,s=jg({x:a,y:o},n,r);return{dy:s.point.y-o,guides:i(s.guides)}}var LT=18,RT=8,zT=3;function BT(e){let{shape:t,viewport:n,setSnapGuides:r}=e,{store:i,history:a}=V(),o=bT(),s=ri(t);if(s.length===0)return null;let c=n.zoom;function l(e,n,s){s.stopPropagation(),s.preventDefault();let c=s.clientY,l=t.activations?.[n]??{top:0,height:0},u=null,d=!1;o(s,{onMove(o){let s=i.getState();if(!d){if(Math.abs(o.clientY-c)<zT)return;d=!0,u=s.shapes,a.beginTransaction()}let f=xr(s.shapes,t.id);if(f?.type!==`control`||!u)return;let p=(o.clientY-c)/s.viewport.zoom,m=p,h=[],g=PT({shape:f,shapes:u,mode:e,start:l,index:n,delta:p}),_=ri({...f,activations:g.activations})[n];if(_){let t=IT(e,_,FT(f,s.shapes),6/s.viewport.zoom);m=p+t.dy,h=t.guides}let{activations:v,arrows:y}=m===p?g:PT({shape:f,shapes:u,mode:e,start:l,index:n,delta:m});r?.(h);let b={...f,activations:v};y.length>0?s.replaceMany([b,...y]):s.replaceShape(b)},onEnd(e){d?(r?.([]),a.endTransaction()):e===`up`&&i.getState().setSelectedIds(new Set([t.id]))}})}return(0,Q.jsx)(Q.Fragment,{children:s.map((e,t)=>{let r=G({x:e.x,y:e.y},n),i=e.width*c,a=e.height*c,o=r.x+i/2;return(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`div`,{"data-testid":`lifeline-activation-move`,onPointerDown:e=>l(`move`,t,e),className:`absolute`,style:{left:o-LT/2,top:r.y,width:LT,height:a,cursor:`move`,pointerEvents:`all`}}),(0,Q.jsx)(`div`,{"data-testid":`lifeline-activation-top`,onPointerDown:e=>l(`top`,t,e),className:`absolute`,style:{left:o-LT/2,top:r.y-RT/2,width:LT,height:RT,cursor:`ns-resize`,pointerEvents:`all`}}),(0,Q.jsx)(`div`,{"data-testid":`lifeline-activation-bottom`,onPointerDown:e=>l(`bottom`,t,e),className:`absolute`,style:{left:o-LT/2,top:r.y+a-RT/2,width:LT,height:RT,cursor:`ns-resize`,pointerEvents:`all`}})]},t)})})}function VT(e){let{viewport:t,setSnapGuides:n}=e,r=ve(e=>[e.shapes],e=>Mr(e,`control`).filter(e=>e.kind===`lifeline`&&(e.activations?.length??0)>0&&!e.locked),Te);return H(e=>e.tool)!==`select`||r.length===0?null:(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0`,children:r.map(e=>(0,Q.jsx)(BT,{shape:e,viewport:t,setSnapGuides:n},e.id))})}function HT(e,t,n){let r=t;for(;r&&r!==e;){if(r.nodeType===1){let e=r;if(e.tagName.toLowerCase()===`span`&&e.style[n])return e}r=r.parentNode}return null}function UT(e,t,n){let r=e.parentNode;if(!r)return e;let i=document.createRange();i.selectNodeContents(e),i.setEnd(t.startContainer,t.startOffset);let a=document.createRange();a.selectNodeContents(e),a.setStart(t.endContainer,t.endOffset);let o=i.extractContents(),s=a.extractContents();if(o.textContent!==``){let t=e.cloneNode(!1);t.appendChild(o),r.insertBefore(t,e)}if(s.textContent!==``){let t=e.cloneNode(!1);t.appendChild(s),r.insertBefore(t,e.nextSibling)}return n(e),e}function WT(e,t,n){let r=window.getSelection(),i=r&&r.rangeCount>0?r.getRangeAt(0):null;if(!i||i.collapsed||!e.contains(i.startContainer))return;let a=HT(e,i.startContainer,t),o=HT(e,i.endContainer,t),s;a&&a===o?s=UT(a,i,n):(s=zS(i,`span`,n),s?.querySelectorAll(`span`).forEach(e=>{e.style[t]=``})),s&&RS(s)}function GT(e,t){WT(e,`fontSize`,e=>{e.style.fontSize=`${t}px`})}function KT(e,t){WT(e,`color`,e=>{e.style.color=t})}var qT=class extends Error{constructor(){super(`Sign in to edit text with AI`),this.name=`RewriteSignInError`}},JT=class extends Error{upgradable;constructor(e,t){super(e),this.name=`RewriteLimitError`,this.upgradable=t}};async function YT(e,t,n,r){let i=await fetch(`${n}/v1-text`,{method:`POST`,credentials:`include`,headers:{"content-type":`application/json`},body:JSON.stringify({text:e,instruction:t,...r?{workspaceId:r}:{}})});if(!i.ok){if(i.status===401)throw new qT;if(i.status===429){let e=await i.json().catch(()=>null);throw new JT(e?.message??`That's a lot of rewrites at once. Try again shortly.`,e?.upgradable===!0)}throw Error(`Rewrite failed: ${i.status}`)}let a=await i.json();if(typeof a.text!=`string`||a.text.length===0)throw Error(`Rewrite returned nothing`);return a.text}var XT=[{id:`fix`,label:`Fix spelling`,instruction:`Fix spelling, grammar and punctuation. Change nothing else.`},{id:`shorten`,label:`Shorten`,instruction:`Shorten this text: keep the meaning, cut the words.`},{id:`simplify`,label:`Simplify`,instruction:`Rewrite this in plain language: everyday words, shorter sentences, no jargon. Keep every point it makes.`},{id:`professional`,label:`Professional`,instruction:`Rewrite this in a professional tone: no emoji, no slang, no exclamation marks. Keep the meaning and the length.`}],ZT=`custom`;function QT(){return(0,Q.jsx)(ec,{size:13,stroke:1.75,className:`animate-spin text-[var(--chrome-fg-500)]`})}function $T(e){let{hidden:t,editableRef:n,lastRange:r,update:i}=e,{apiUrl:a,workspaceId:o}=B(),s=H(e=>e.setTextAiSignInOpen),c=H(e=>e.setTextAiUpgradeOpen),l=re().state.status,[u,d]=(0,J.useState)(null),[f,p]=(0,J.useState)(null),[m,h]=(0,J.useState)(``),[g,_]=(0,J.useState)(!1);(0,J.useEffect)(()=>{t&&(_(!1),h(``),p(null))},[t]);async function v(e){if(u)return;if(l===`guest`){s(!0);return}let{editable:t,range:c}=FS(n.current,r.current);if(!t||!c||c.toString().trim().length===0)return;let f=c.cloneRange();p(null),d(e.id);try{let n=await YT(c.toString(),e.instruction,a??``,o??null);if(!t.isConnected)return;let s=ZS(t,f,n),l=window.getSelection();if(l&&s){let e=document.createRange();e.setStartBefore(s),e.setEndAfter(s),l.removeAllRanges(),l.addRange(e),r.current=e.cloneRange()}t.dispatchEvent(new InputEvent(`input`,{bubbles:!0})),i()}catch(e){if(e instanceof qT){s(!0);return}p(e instanceof JT?{message:e.message,upgradable:e.upgradable}:{message:`Couldn't rewrite`,upgradable:!1})}finally{d(null)}}function y(){let e=n.current;e&&(IS(e,r.current),i())}function b(e){_(e),e||(h(``),y())}function x(){p(null),h(``),_(!1)}return{busy:u,error:f,prompt:m,promptOpen:g,apply:v,openPrompt:b,reset:x,setPrompt:h,openUpgrade:()=>c(!0)}}function eE(e){let{busy:t,error:n,prompt:r,promptOpen:i,onPromptOpenChange:a,onPromptChange:o,onPromptFocusChange:s,onApply:c,onUpgrade:l,onHoldFocus:u}=e,d=r.trim(),f=()=>{d.length===0||t!==null||c({id:ZT,label:`Ask AI`,instruction:d})},p=()=>a(!1);return(0,Q.jsxs)(`div`,{className:`flex w-full flex-col gap-1 pt-0.5`,"data-testid":`format-ai-row`,children:[i?(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-0.5`,children:[(0,Q.jsx)(`input`,{autoFocus:!0,value:r,placeholder:`Ask AI to…`,disabled:t!==null,"data-testid":`format-ai-prompt`,onMouseDown:e=>e.stopPropagation(),onFocus:()=>s(!0),onBlur:()=>s(!1),onChange:e=>o(e.currentTarget.value),onKeyDown:e=>{if(e.key===`Enter`){e.preventDefault(),f();return}if(e.key===`Escape`){e.preventDefault(),p();return}e.stopPropagation()},className:`h-7 min-w-0 flex-1 rounded-lg bg-transparent px-2 text-[11px] text-[var(--chrome-fg-800)] outline-none placeholder:text-[var(--chrome-fg-400)]`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Cancel`,"data-testid":`format-ai-prompt-cancel`,disabled:t!==null,onMouseDown:u,onClick:p,className:`${rl(!1)} h-7 w-7 disabled:text-[var(--chrome-fg-300)]`,children:(0,Q.jsx)(uc,{size:15,stroke:1.75})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Ask AI`,"data-testid":`format-ai-prompt-submit`,disabled:t!==null||d.length===0,onMouseDown:u,onClick:f,className:`${rl(!1)} h-7 w-7 disabled:text-[var(--chrome-fg-300)]`,children:t===ZT?(0,Q.jsx)(QT,{}):(0,Q.jsx)(Ts,{size:15,stroke:1.75})})]}):(0,Q.jsxs)(`div`,{className:`flex w-full items-center gap-0.5`,children:[XT.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"aria-label":e.label,disabled:t!==null,"data-testid":`format-ai-${e.id}`,onMouseDown:u,onClick:()=>c(e),className:`${rl(!1)} relative w-auto px-1.5 disabled:text-[var(--chrome-fg-300)]`,children:[(0,Q.jsx)(`span`,{className:`whitespace-nowrap text-[11px] ${t===e.id?`opacity-0`:``}`,children:e.label}),t===e.id&&(0,Q.jsx)(`span`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsx)(QT,{})})]},e.id)),(0,Q.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-[var(--chrome-divider)]`}),(0,Q.jsx)(`button`,{type:`button`,disabled:t!==null,"data-testid":`format-ai-prompt-open`,onMouseDown:u,onClick:()=>a(!0),className:`${rl(!1)} w-auto px-1.5 disabled:text-[var(--chrome-fg-300)]`,children:(0,Q.jsx)(`span`,{className:`whitespace-nowrap text-[11px]`,children:`Ask AI to…`})})]}),n?.upgradable?(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 pb-0.5`,children:[(0,Q.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-600)]`,children:n.message}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`format-ai-upgrade`,onMouseDown:u,onClick:l,className:`shrink-0 cursor-pointer rounded-lg bg-[var(--chrome-accent)] px-2 py-1 text-[11px] text-white transition-[background-color,scale] hover:bg-[var(--chrome-accent-hover)] active:scale-[0.96]`,children:`Upgrade`})]}):n&&(0,Q.jsx)(`span`,{className:`text-[11px] text-red-600`,"data-testid":`format-ai-error`,children:n.message})]})}function tE(e){let{open:t,setOpen:n,editableRef:r,lastRange:i,textEditGuard:a,update:o}=e,[s,c]=(0,J.useState)(``),l=(0,J.useRef)(null),u=(0,J.useRef)(null);(0,J.useEffect)(()=>{t&&(u.current?.focus(),u.current?.select())},[t]);let d=(0,J.useCallback)(()=>{let{editable:e,range:t}=FS(r.current,i.current);if(!e||!t)return;r.current=e,l.current=t.cloneRange();let o=LS(e,t.startContainer,`a`);c(o?.getAttribute(`href`)??``),a.guard(),n(!0)},[r,i,n,a]);function f(e){let t=l.current;l.current=null,n(!1);let i=r.current;if(!t||!i)return;let c=Vn(s),u=LS(i,t.startContainer,`a`);if(c&&t.collapsed&&!u){let e=qS(t,c,s.trim());i.focus(),window.getSelection()?.collapse(e,1),o();return}if(c?KS(i,t,c):s.trim()===``&&u&&VS(u),i.focus(),e===`end`){a.release(),i.blur();return}o()}function p(){let e=l.current;l.current=null,n(!1);let t=r.current;if(!e||!t)return;let i=LS(t,e.startContainer,`a`);i&&VS(i),t.focus(),o()}function m(){let e=l.current;l.current=null,n(!1);let t=r.current;t&&IS(t,e)}function h(){let e=Vn(s);e&&window.open(e,`_blank`,`noopener,noreferrer`)}return{inputRef:u,value:s,setValue:c,openEditor:d,commit:f,remove:p,close:m,openCurrent:h}}function nE(e){let{inputRef:t,value:n,onChange:r,onCommit:i,onOpen:a,onRemove:o,onCancel:s}=e;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-1`,children:[(0,Q.jsx)(`input`,{ref:t,value:n,placeholder:`example.com`,onMouseDown:e=>e.stopPropagation(),onChange:e=>r(e.currentTarget.value),onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),i(`refocus`)):e.key===`Escape`&&(e.preventDefault(),s())},onBlur:e=>{let t=e.relatedTarget,n=t&&typeof t.closest==`function`&&t.closest(`[data-format-toolbar]`)!==null;i(n?`refocus`:`end`)},className:`h-8 w-44 rounded-lg bg-transparent px-2 text-sm text-[var(--chrome-fg-800)] outline-none placeholder:text-[var(--chrome-fg-400)]`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Open link`,onMouseDown:e=>e.preventDefault(),onClick:a,className:`flex h-8 w-8 items-center justify-center rounded-lg text-[var(--chrome-fg-600)] hover:bg-[var(--chrome-divider)]`,children:(0,Q.jsx)(Ws,{size:16,stroke:1.75})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Remove link`,onMouseDown:e=>e.preventDefault(),onClick:o,className:`flex h-8 w-8 items-center justify-center rounded-lg text-[var(--chrome-fg-600)] hover:bg-[var(--chrome-divider)]`,children:(0,Q.jsx)(bs,{size:16,stroke:1.75})})]})}var rE=Tt.filter(e=>e!==`transparent`),iE={b:`strong`,i:`em`,u:`u`,e:`code`},aE={h:`mark`,x:`s`};function oE(e,t){for(let n=t;n;n=n.parentElement){if(n instanceof HTMLElement&&n.style.color)return qt(n.style.color);if(n===e)return null}return null}function sE(e){let t=/^rgba?\((\d+),\s*(\d+),\s*(\d+)/i.exec(e);if(!t)return null;let n=e=>Number(e).toString(16).padStart(2,`0`);return`#${n(t[1])}${n(t[2])}${n(t[3])}`}var cE=10,lE={bold:!1,italic:!1,underline:!1,strike:!1,code:!1,highlight:!1,link:!1,list:!1,checklist:!1,fontSize:24,color:`rgb(30, 30, 30)`,storedColor:`#1e1e1e`};function uE(e){let{active:t,viewport:n}=e,{ai:r}=B(),{textEditGuard:i}=V(),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(lE),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(null),[p,m]=(0,J.useState)(!1),[h,g]=(0,J.useState)(!1),[_,v]=(0,J.useState)(!1),y=(0,J.useRef)(null),b=(0,J.useRef)(null),x=(0,J.useRef)(null),S=H(e=>e.coarsePointer),C=(0,J.useCallback)((e,t)=>{let n=e.getBoundingClientRect();n.width===0&&n.height===0&&(n=t.getBoundingClientRect()),o(n),u(n.top<58)},[]),w=(0,J.useCallback)(()=>{if(!t){o(null);return}let e=NS();if(!e){!_&&!p&&!h&&(o(null),f(null));return}y.current=e.editable,i.isGuarded()||(b.current=e.range.cloneRange()),C(e.range,e.editable);let n=e.sel.anchorNode,r=n instanceof Element?n:n?.parentElement??null,a=r?getComputedStyle(r):null,s=LS(e.editable,e.sel.anchorNode,`li`),l=s?.parentElement?.matches(`ul[data-checklist]`)??!1;c({bold:LS(e.editable,e.sel.anchorNode,`strong`)!==null||LS(e.editable,e.sel.anchorNode,`b`)!==null,italic:LS(e.editable,e.sel.anchorNode,`em`)!==null||LS(e.editable,e.sel.anchorNode,`i`)!==null,underline:LS(e.editable,e.sel.anchorNode,`u`)!==null,strike:LS(e.editable,e.sel.anchorNode,`s`)!==null,code:LS(e.editable,e.sel.anchorNode,`code`)!==null,highlight:LS(e.editable,e.sel.anchorNode,`mark`)!==null,link:LS(e.editable,e.sel.anchorNode,`a`)!==null,list:s!==null&&!l,checklist:l,fontSize:a&&Math.round(parseFloat(a.fontSize))||24,color:a?a.color:lE.color,storedColor:oE(e.editable,r)??a?.color??lE.color})},[t,_,p,h,i,C]),T=$T({hidden:a===null,editableRef:y,lastRange:b,update:w}),E=tE({open:_,setOpen:v,editableRef:y,lastRange:b,textEditGuard:i,update:w});(0,J.useEffect)(()=>{if(!t){o(null),f(null),m(!1),v(!1),g(!1);return}let e=()=>{_||w()};return document.addEventListener(`selectionchange`,e),()=>document.removeEventListener(`selectionchange`,e)},[t,w,_]),(0,J.useLayoutEffect)(()=>{w()},[w,n]),(0,J.useLayoutEffect)(()=>{let e=x.current;if(!e||!a)return;let t=e.offsetWidth/2,n=a.left+a.width/2;e.style.left=`${ct(n,8+t,window.innerWidth-8-t)}px`});let D=(0,J.useCallback)(e=>{let{live:t,editable:n}=FS(y.current,b.current);if(!n)return;let r=b.current;!t&&r&&IS(n,r),e(n),XS(n),w()},[w]),O=E.openEditor;if((0,J.useEffect)(()=>{if(!t)return;let e=e=>{if(!(e.metaKey||e.ctrlKey)||e.altKey)return;let t=e.key.toLowerCase(),n=e.shiftKey?aE[t]??null:iE[t]??null;if(n){if(e.preventDefault(),NS()){D(e=>eC(e,n));return}let t=PS();t&&($S(t.editable,n),w())}else if(t===`k`&&!e.shiftKey){if(e.preventDefault(),NS()){O();return}let t=PS();t&&(y.current=t.editable,b.current=t.range.cloneRange(),C(t.range,t.editable),O())}};return document.addEventListener(`keydown`,e,!0),()=>document.removeEventListener(`keydown`,e,!0)},[t,D,w,O,C]),!t||!a)return null;function k(e){let t=ct(Math.round(e),8,240);D(e=>{GT(e,t)})}function A(e){D(t=>{KT(t,e)})}return(0,Q.jsx)(`div`,{ref:x,"data-format-toolbar":!0,"data-caret-safe":!0,"data-overlay":!0,onPointerDown:e=>{e.stopPropagation();let t=NS();t&&t.editable===y.current&&(b.current=t.range.cloneRange()),i.guard()},onMouseDown:e=>e.preventDefault(),className:`fixed z-50`,style:{left:a.left+a.width/2,top:l?a.bottom+cE:a.top-cE,transform:`translate(-50%, ${l?`0`:`-100%`})`},children:(0,Q.jsx)(`div`,{className:`flex flex-col items-center gap-1.5 p-1 ${Wc.popup}`,children:_?(0,Q.jsx)(nE,{inputRef:E.inputRef,value:E.value,onChange:E.setValue,onCommit:E.commit,onOpen:E.openCurrent,onRemove:E.remove,onCancel:E.close}):(0,Q.jsxs)(Q.Fragment,{children:[d===`size`&&(0,Q.jsx)(fE,{fontSize:s.fontSize,onApply:k}),d===`color`&&(0,Q.jsx)(pE,{color:s.storedColor,onApply:A,onPopoverOpenChange:m,onGuard:i.guard}),d===`ai`&&(0,Q.jsx)(eE,{busy:T.busy,error:T.error,promptOpen:T.promptOpen,onPromptOpenChange:e=>{e||g(!1),T.openPrompt(e)},onUpgrade:T.openUpgrade,prompt:T.prompt,onPromptChange:T.setPrompt,onPromptFocusChange:g,onApply:e=>void T.apply(e),onHoldFocus:dE}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5`,children:[r&&!S&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mE,{label:`Rewrite with AI`,active:d===`ai`,onMouseDown:dE,onClick:()=>{T.reset(),g(!1),f(e=>e===`ai`?null:`ai`)},children:(0,Q.jsx)(lc,{size:16,stroke:1.75})}),(0,Q.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-[var(--chrome-divider)]`})]}),(0,Q.jsx)(mE,{label:`Font size`,active:d===`size`,onMouseDown:dE,onClick:()=>f(e=>e===`size`?null:`size`),children:(0,Q.jsx)(`span`,{className:`text-[12px] tabular-nums`,"data-testid":`format-size`,children:s.fontSize})}),(0,Q.jsx)(mE,{label:`Text color`,active:d===`color`,onMouseDown:dE,onClick:()=>{m(!1),f(e=>e===`color`?null:`color`)},children:(0,Q.jsxs)(`span`,{className:`flex flex-col items-center leading-none`,children:[(0,Q.jsx)(`span`,{className:`text-[13px] font-medium`,style:{color:s.color},children:`A`}),(0,Q.jsx)(`span`,{className:`mt-[1px] h-[3px] w-3.5 rounded-full`,style:{background:s.color}})]})}),(0,Q.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-[var(--chrome-divider)]`}),(0,Q.jsx)(mE,{label:`Bold`,active:s.bold,onMouseDown:dE,onClick:()=>D(e=>eC(e,`strong`)),children:(0,Q.jsx)(Bf,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Italic`,active:s.italic,onMouseDown:dE,onClick:()=>D(e=>eC(e,`em`)),children:(0,Q.jsx)(ap,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Underline`,active:s.underline,onMouseDown:dE,onClick:()=>D(e=>eC(e,`u`)),children:(0,Q.jsx)(Rp,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Strikethrough`,active:s.strike,onMouseDown:dE,onClick:()=>D(e=>eC(e,`s`)),children:(0,Q.jsx)(Ip,{size:17,stroke:1.75})}),!S&&(0,Q.jsx)(mE,{label:`Code`,active:s.code,onMouseDown:dE,onClick:()=>D(e=>eC(e,`code`)),children:(0,Q.jsx)(Ds,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Highlight`,active:s.highlight,onMouseDown:dE,onClick:()=>D(e=>eC(e,`mark`)),children:(0,Q.jsx)(xc,{size:17,stroke:1.75})}),!S&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(mE,{label:`Link`,active:s.link,onMouseDown:dE,onClick:O,children:(0,Q.jsx)($s,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Bullet list`,active:s.list,onMouseDown:dE,onClick:()=>D(e=>wS(e)),children:(0,Q.jsx)(es,{size:17,stroke:1.75})}),(0,Q.jsx)(mE,{label:`Checklist`,active:s.checklist,onMouseDown:dE,onClick:()=>D(e=>TS(e)),children:(0,Q.jsx)(_p,{size:17,stroke:1.75})})]})]})]})})})}function dE(e){e.preventDefault()}function fE(e){let{fontSize:t,onApply:n}=e;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 px-1 pt-0.5`,"data-testid":`format-size-row`,children:[Mt.map((e,r)=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Font size ${ht[r]}`,"aria-pressed":t===e,"data-testid":`format-size-${e}`,onMouseDown:dE,onClick:()=>n(e),className:rl(t===e),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:ht[r]})},e)),(0,Q.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-[var(--chrome-divider)]`}),(0,Q.jsx)(ba,{value:t,onChange:n,onMouseDown:dE,testId:`format-size`})]})}function pE(e){let{color:t,onApply:n,onPopoverOpenChange:r,onGuard:i}=e;return(0,Q.jsx)(`div`,{className:`px-1 pt-0.5`,"data-testid":`format-color-row`,children:(0,Q.jsx)(Sa,{value:sE(t)??t,colors:rE,onChange:n,testId:`format-color`,customFallback:`#1971c2`,onMouseDown:i,onOpenChange:r})})}function mE(e){let{label:t,active:n,children:r,onMouseDown:i,onClick:a}=e;return(0,Q.jsx)(`button`,{type:`button`,"aria-label":t,"aria-pressed":n,onMouseDown:i,onClick:a,className:rl(!!n),children:r})}function hE(){let e=H(e=>e.textAiSignInOpen),t=H(e=>e.setTextAiSignInOpen),n=H(e=>e.textAiUpgradeOpen),r=H(e=>e.setTextAiUpgradeOpen),{state:i}=re(),a=i.status===`authenticated`?i.usage?.plan??`free`:`free`;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ib,{open:e,onOpenChange:t,title:`Sign in to edit text with AI`,description:`AI text edits are part of Koboyo Pro. Sign in to start your free trial, and your canvas stays exactly where it is.`}),(0,Q.jsx)(rb,{open:n,onOpenChange:r,currentPlan:a,title:`Get more AI text editing`,description:`Move to Pro to keep rewriting, shortening and fixing text as you write — plus a monthly assistant allowance, image generation, and unlimited canvases.`,testId:`text-ai-upgrade-dialog`})]})}var gE=60;function _E(e){return[...e].map(([e,t])=>`${e}\u0000${t.name}\u0000${t.color}`).join(``)}function vE(){let e=V(),t=H(e=>_E(e.remoteCursors)),n=e.store.getState().remoteCursors,r=(0,J.useRef)(new Map),i=(0,J.useRef)(new Map);return(0,J.useEffect)(()=>{if(t===``){i.current.clear();return}let n=0,a=performance.now(),o=t=>{let s=1-Math.exp(-(t-a)/gE);a=t;let{remoteCursors:c,viewport:l}=e.store.getState();for(let[e,t]of c){let n=r.current.get(e);if(!n)continue;let a=i.current.get(e),o=a?{x:a.x+(t.x-a.x)*s,y:a.y+(t.y-a.y)*s}:{x:t.x,y:t.y};i.current.set(e,o);let c=G(o,l);n.style.transform=`translate3d(${c.x}px, ${c.y}px, 0)`}for(let e of i.current.keys())c.has(e)||i.current.delete(e);n=requestAnimationFrame(o)};return n=requestAnimationFrame(o),()=>cancelAnimationFrame(n)},[t,e]),n.size===0?null:(0,Q.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-30 overflow-hidden`,"data-testid":`remote-cursors`,children:[...n].map(([e,t])=>(0,Q.jsxs)(`div`,{ref:t=>{t?r.current.set(e,t):r.current.delete(e)},"data-testid":`remote-cursor`,"data-cursor-name":t.name,className:`absolute top-0 left-0 will-change-transform`,style:{transform:`translate3d(-100px, -100px, 0)`},children:[(0,Q.jsx)(`svg`,{width:`18`,height:`20`,viewBox:`0 0 18 20`,className:`block drop-shadow-sm`,children:(0,Q.jsx)(`path`,{d:`M1.5 1.5 L1.5 16.5 L5.8 12.6 L8.6 18.6 L11.4 17.3 L8.7 11.4 L14.5 11.4 Z`,fill:t.color,stroke:`white`,strokeWidth:`1.5`,strokeLinejoin:`round`})}),(0,Q.jsx)(`div`,{className:`absolute top-4 left-3.5 max-w-40 truncate rounded-md px-1.5 py-0.5 text-[11px] leading-4 font-medium whitespace-nowrap text-white shadow-sm`,style:{backgroundColor:t.color},children:t.name})]},e))})}var yE=`#f24822`;function bE(e){let{guides:t,viewport:n}=e;return t.length===0?null:(0,Q.jsx)(`svg`,{"data-testid":`snap-guides`,className:`pointer-events-none absolute inset-0 h-full w-full`,style:{overflow:`visible`},children:t.map((e,t)=>e.kind===`gap`?(0,Q.jsx)(wE,{guide:e,viewport:n},t):(0,Q.jsx)(CE,{guide:e,viewport:n},t))})}var xE=3.5;function SE(e,t){let n=[...e].sort((e,t)=>e-t),r=[],i=[];for(let e of n)i.length>0&&e-i[i.length-1]>t&&(r.push((i[0]+i[i.length-1])/2),i=[]),i.push(e);return i.length>0&&r.push((i[0]+i[i.length-1])/2),r}function CE(e){let{guide:t,viewport:n}=e,r=e=>G(t.axis===`x`?{x:t.pos,y:e}:{x:e,y:t.pos},n),i=r(t.start),a=r(t.end),o=SE(t.marks??[t.start,t.end],xE*2/n.zoom);return(0,Q.jsxs)(`g`,{"data-testid":`snap-guide-line`,stroke:yE,strokeWidth:1,children:[(0,Q.jsx)(`line`,{x1:i.x,y1:i.y,x2:a.x,y2:a.y}),o.map((e,t)=>{let n=r(e);return(0,Q.jsx)(`path`,{"data-testid":`snap-guide-mark`,d:`M${n.x-xE},${n.y-xE}L${n.x+xE},${n.y+xE}M${n.x-xE},${n.y+xE}L${n.x+xE},${n.y-xE}`},t)})]})}function wE(e){let{guide:t,viewport:n}=e,r=t.axis===`x`,i=(e,t)=>(0,Q.jsx)(`line`,{x1:r?e.x:e.x-4,y1:r?e.y-4:e.y,x2:r?e.x:e.x+4,y2:r?e.y+4:e.y},t);return(0,Q.jsx)(`g`,{stroke:yE,strokeWidth:1,children:t.bars.map((e,a)=>{let o=G(r?{x:e.from,y:t.cross}:{x:t.cross,y:e.from},n),s=G(r?{x:e.to,y:t.cross}:{x:t.cross,y:e.to},n);return(0,Q.jsxs)(`g`,{children:[(0,Q.jsx)(`line`,{x1:o.x,y1:o.y,x2:s.x,y2:s.y}),i(o,`a`),i(s,`b`)]},a)})})}var TE=`var(--canvas-origin)`;function EE(e){let{bounds:t}=e;return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},"data-testid":`ai-ghost`,children:(0,Q.jsxs)(`g`,{className:`animate-pulse`,children:[(0,Q.jsx)(`rect`,{x:t.x,y:t.y,width:t.width,height:t.height,rx:18,fill:TE,fillOpacity:.06,stroke:TE,strokeWidth:2,strokeDasharray:`6 9`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,Q.jsx)(`text`,{x:t.x+t.width/2,y:t.y+t.height/2,textAnchor:`middle`,dominantBaseline:`middle`,fill:`#94a3b8`,fontSize:20,fontFamily:At,children:`Generating…`})]})})}function DE(e){let{tool:t,kind:n,chartKind:r,frameKind:i,at:a,icon:o,control:s}=e;if(s)return(0,Q.jsx)(ME,{kind:s,at:a});if(o)return(0,Q.jsx)(NE,{icon:o,at:a});if(t===`chart`)return(0,Q.jsx)(kE,{at:a,kind:r});if(t===`figure`)return(0,Q.jsx)(OE,{at:a,kind:i});if(t===`table`)return(0,Q.jsx)(jE,{at:a});if(t===`sticky`)return(0,Q.jsx)(AE,{at:a});if(t!==`rectangle`)return null;let c=wn(n);return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`path`,{d:jn(n,{x:a.x,y:a.y,width:c.width,height:c.height}),fill:`none`,stroke:TE,strokeWidth:1.5,strokeLinejoin:`round`})})}function OE(e){let{at:t,kind:n}=e,r=Ao[n],{border:i,details:a}=To(n,{x:t.x,y:t.y,width:r.width,height:r.height});return(0,Q.jsx)(`svg`,{"data-testid":`frame-ghost`,className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:[i,...a].map((e,t)=>(0,Q.jsx)(`path`,{d:e,fill:`none`,stroke:TE,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function kE(e){let{at:t,kind:n}=e,r=(0,J.useMemo)(()=>ho(Ro({x:0,y:0},{fontFamily:At,color:TE,opacity:1},n)),[n]);return(0,Q.jsx)(`svg`,{"data-testid":`chart-ghost`,className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`g`,{opacity:.55,transform:`translate(${t.x} ${t.y})`,children:r.map((e,t)=>(0,Q.jsx)(sS,{prim:e},t))})})}function AE(e){let{at:t}=e;return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`rect`,{x:t.x,y:t.y,width:180,height:180,rx:2,fill:TE,fillOpacity:.15,stroke:TE,strokeWidth:1.5})})}function jE(e){let{at:t}=e,n=[];for(let e=1;e<3;e+=1){let r=t.x+168*e/3;n.push((0,Q.jsx)(`line`,{x1:r,y1:t.y,x2:r,y2:t.y+96},`c${e}`))}for(let e=1;e<3;e+=1){let r=t.y+96*e/3;n.push((0,Q.jsx)(`line`,{x1:t.x,y1:r,x2:t.x+168,y2:r},`r${e}`))}return(0,Q.jsxs)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:[(0,Q.jsx)(`rect`,{x:t.x,y:t.y,width:168,height:96,rx:2,fill:`none`,stroke:TE,strokeWidth:1.5}),(0,Q.jsx)(`g`,{stroke:TE,strokeWidth:1,opacity:.7,children:n})]})}function ME(e){let{kind:t,at:n}=e,r=Si(),i=(0,J.useMemo)(()=>fi(hi(t,{x:0,y:0},{fontFamily:At,color:TE,opacity:1}),r.text),[t,r]);return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`g`,{opacity:.55,transform:`translate(${n.x} ${n.y})`,children:i.map((e,t)=>(0,Q.jsx)(sS,{prim:e},t))})})}function NE(e){let{icon:t,at:n}=e;return Li(t.source)?Ii(t.source)?(0,Q.jsx)(FE,{source:t.source,slug:t.name,at:n}):(0,Q.jsx)(LE,{source:t.source,slug:t.name,at:n,box:PE(t.source)}):(0,Q.jsx)(IE,{name:t.name,at:n})}function PE(e){let t=zn(e);return{width:t,height:t}}function FE(e){let{source:t,slug:n,at:r}=e,i=yl(t,n),a=i?Vc(i.viewBox):null;return(0,Q.jsx)(LE,{source:t,slug:n,at:r,box:Xn(zn(t),a?a.width/a.height:1)})}function IE(e){let{name:t,at:n}=e,r=_l(t);return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:r&&(0,Q.jsx)(bl,{node:r,at:n,size:55,stroke:TE,strokeWidth:ir(3,55),opacity:.7})})}function LE(e){let{source:t,slug:n,at:r,box:i}=e;return(0,Q.jsx)(`svg`,{className:`absolute overflow-visible`,width:1,height:1,style:{pointerEvents:`none`},children:(0,Q.jsx)(`image`,{href:Ri().assetIconUrl(t,n),x:r.x,y:r.y,width:i.width,height:i.height,opacity:.7})})}var RE=5;function zE(e){let{shape:t,viewport:n,measurement:r,className:i,testId:a}=e,o=Ki(t,r),s=G({x:o.x,y:o.y},n),c=an(t),l=Wi(t,o,n.zoom,r);return(0,Q.jsx)(`div`,{"data-testid":a,className:i,style:{left:s.x-RE,top:s.y-RE,width:o.width*n.zoom+RE*2,height:o.height*n.zoom+RE*2,transform:c?`rotate(${c}deg)`:void 0,transformOrigin:`${l.x+RE}px ${l.y+RE}px`}})}function BE(e,t,n){return G($i(e,n),t)}function VE(e){let{interactive:t,transforming:n,revealed:r,viewport:i}=e,a=ve(e=>[e.shapes,e.hoveredId],(e,t)=>t?xr(e,t):void 0);return!t||n||r||!a?.locked?null:(0,Q.jsx)(HE,{shape:a,viewport:i})}function HE(e){let{shape:t,viewport:n}=e,r=V().measurement,i=BE(t,n,r);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(zE,{shape:t,viewport:n,measurement:r,testId:`locked-hover`,className:`pointer-events-none absolute rounded-[4px] border border-dashed border-gray-400/50`}),(0,Q.jsx)(`div`,{className:`pointer-events-none absolute flex h-5 w-5 items-center justify-center rounded bg-[var(--chrome-surface)] text-[var(--chrome-fg-400)] ring-1 ring-[var(--chrome-ring)]`,style:{left:i.x-RE,top:i.y-RE-23},children:(0,Q.jsx)(yp,{size:11,stroke:2})})]})}function UE(e){if(e)return e.type===`rectangle`||e.type===`control`?e.link:void 0}function WE(e){let{link:t,left:n,top:r}=e,i=Vn(t);return i?(0,Q.jsx)(S,{label:i,side:`top`,children:(0,Q.jsx)(`a`,{"data-testid":`link-badge`,href:i,target:`_blank`,rel:`noopener noreferrer`,onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),className:`absolute flex h-6 w-6 items-center justify-center rounded-md bg-[var(--chrome-popup)] text-blue-600 shadow-[0_2px_8px_rgba(0,0,0,0.12)] ring-1 ring-[var(--chrome-ring)] transition-colors hover:bg-blue-50`,style:{left:n,top:r},children:(0,Q.jsx)($s,{size:13,stroke:2})})}):null}function GE(e){let{interactive:t,transforming:n,viewport:r}=e,i=H(e=>e.selectedIds),a=ve(e=>[e.shapes,e.selectedIds],(e,t)=>t.size===1?xr(e,[...t][0]):void 0),o=UE(a);if(!t||n||i.size!==1||!a||!o)return null;let s=BE(a,r);return(0,Q.jsx)(WE,{link:o,left:s.x-RE,top:s.y-RE-28})}function KE(e){let{shapes:t,viewport:n,onUnlock:r}=e,i=V().measurement,a=Bt(t,i);if(!a)return null;let o=t.length===1?BE(t[0],n,i):G({x:a.x,y:a.y},n),s=t.length===1?UE(t[0]):void 0;return(0,Q.jsxs)(Q.Fragment,{children:[t.map(e=>(0,Q.jsx)(zE,{shape:e,viewport:n,measurement:i,testId:`locked-outline`,className:`pointer-events-none absolute rounded-[4px] border border-dashed border-gray-400/60`},e.id)),(0,Q.jsx)(S,{label:`Unlock`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"data-testid":`lock-badge`,"aria-label":`Unlock`,onPointerDown:e=>e.stopPropagation(),onClick:r,className:`absolute flex h-6 w-6 items-center justify-center rounded-md bg-[var(--chrome-popup)] text-[var(--chrome-fg-500)] shadow-[0_2px_8px_rgba(0,0,0,0.12)] ring-1 ring-[var(--chrome-ring)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`,style:{left:o.x-RE,top:o.y-RE-28},children:(0,Q.jsx)(yp,{size:13,stroke:2})})}),s&&(0,Q.jsx)(WE,{link:s,left:o.x-RE+28,top:o.y-RE-28})]})}function qE(e){let{viewport:t}=e,n=V().measurement,r=ve(e=>[e.shapes,e.activeGroupId],(e,t)=>t?Bt(e.filter(e=>e.groupId===t),n):null);if(!r)return null;let i=G({x:r.x,y:r.y},t);return(0,Q.jsx)(`div`,{"data-testid":`entered-group-outline`,className:`pointer-events-none absolute border border-dashed border-[var(--canvas-group-selection)] opacity-50`,style:{left:i.x-6,top:i.y-6,width:r.width*t.zoom+12,height:r.height*t.zoom+12}})}var JE=10,YE=28;function XE(e){let{viewport:t}=e,n=ve(e=>[e.shapes,e.animateSlideId],(e,t)=>t?Jr(e).find(e=>e.id===t):null);if(!n)return null;let r=W(n),i=G({x:r.x-JE,y:r.y-YE},t),a=G({x:r.x+r.width+JE,y:r.y+r.height+JE},t);return(0,Q.jsx)(`div`,{"data-testid":`animate-spotlight`,className:`pointer-events-none absolute rounded-lg`,style:{left:i.x,top:i.y,width:Math.max(0,a.x-i.x),height:Math.max(0,a.y-i.y),boxShadow:`0 0 0 9999px var(--canvas-scrim)`}})}var ZE=7,QE=9,$E=26,eD=.15;function tD(e){let{zoom:t}=e,n=db(),r=V().measurement,i=n?Bt(n,r):null;if(!i)return null;let a=ZE/t,o=$E/t,s=Math.max(i.width,o),c=Math.max(i.height,o);return(0,Q.jsx)(`svg`,{"data-testid":`build-highlight`,className:`pointer-events-none absolute overflow-visible`,width:1,height:1,children:(0,Q.jsx)(`rect`,{x:i.x+i.width/2-s/2-a,y:i.y+i.height/2-c/2-a,width:s+a*2,height:c+a*2,rx:QE/t,fill:`var(--canvas-selection)`,fillOpacity:eD})})}var nD=160;function rD(e){return 1.25**Math.round(Math.log(e)/Math.log(1.25))}function iD(e){let{viewport:t,children:n}=e,[r,i]=(0,J.useState)(!1),a=(0,J.useRef)(t),o=(0,J.useRef)(null),[s,c]=(0,J.useState)(t.zoom);return(0,J.useLayoutEffect)(()=>{let e=window.setTimeout(()=>c(t.zoom),nD);return()=>window.clearTimeout(e)},[t.zoom]),(0,J.useLayoutEffect)(()=>{let e=a.current;if(a.current=t,t.zoom!==e.zoom){o.current!=null&&(window.clearTimeout(o.current),o.current=null),i(!1);return}t.x===e.x&&t.y===e.y||(i(!0),o.current!=null&&window.clearTimeout(o.current),o.current=window.setTimeout(()=>i(!1),nD))},[t]),(0,J.useLayoutEffect)(()=>()=>{o.current!=null&&window.clearTimeout(o.current)},[]),(0,Q.jsx)(`div`,{"data-testid":`world-layer`,className:`absolute left-0 top-0 origin-top-left`,style:{transform:`translate(${t.x}px, ${t.y}px) scale(${t.zoom})`,willChange:r?`transform`:void 0,[Ex]:`${Ox/rD(s)}px`,[Dx]:`${12/rD(s)}px`},children:n})}var aD=16;function oD(e){let{containerRef:t,setViewport:n}=e,r=U();(0,J.useEffect)(()=>{function e(e){e.ctrlKey&&e.preventDefault()}function t(e){e.preventDefault()}return window.addEventListener(`wheel`,e,{passive:!1,capture:!0}),window.addEventListener(`gesturestart`,t),window.addEventListener(`gesturechange`,t),window.addEventListener(`gestureend`,t),()=>{window.removeEventListener(`wheel`,e,{capture:!0}),window.removeEventListener(`gesturestart`,t),window.removeEventListener(`gesturechange`,t),window.removeEventListener(`gestureend`,t)}},[]),(0,J.useEffect)(()=>{let e=t.current;if(!e)return;let i=Oa(e=>{n(t=>{let n=t;return(e.dx!==0||e.dy!==0)&&(n={...n,x:n.x-e.dx,y:n.y-e.dy}),e.anchor&&e.zoomFactor!==1&&(n=Ir(n,Ur(n.zoom*e.zoomFactor),e.anchor)),n}),e.anchor&&e.zoomFactor!==1&&r.getState().pulseZoomGesture()});function a(e){if(e.target instanceof Element&&e.target.closest(`[data-overlay]`))return;if(o.isActive()){e.preventDefault();return}e.preventDefault();let t=e.currentTarget.getBoundingClientRect();if(e.ctrlKey||e.metaKey){let n={x:e.clientX-t.left,y:e.clientY-t.top};i.queue(t=>{t.zoomFactor*=Da(e.deltaY),t.anchor=n});return}let n=e.deltaMode===1?aD:1,r=e.deltaX*n,a=e.deltaY*n;i.queue(t=>{if(e.shiftKey&&r===0){t.dx+=a;return}t.dx+=r,t.dy+=a})}let o=Aa(e,t=>{if(r.getState().presentingIndex!==null||t.target instanceof Element&&t.target.closest(`[data-overlay]`))return;let n=e.getBoundingClientRect();i.queue(e=>{e.zoomFactor*=t.factor,e.anchor={x:t.clientX-n.left,y:t.clientY-n.top}})});return e.addEventListener(`wheel`,a,{passive:!1}),()=>{e.removeEventListener(`wheel`,a),o.stop(),i.cancel()}},[t,n,r])}function sD(e,t){let n=Fu((0,J.useMemo)(()=>Pu(e),[e]),t),r=(0,J.useRef)(null);return(r.current===null||r.current.key!==n)&&(r.current={key:n,zoom:t}),r.current.zoom}function cD(e,t){let n=e.measureMisses;if(n.size===0)return;let{shapes:r,settleBindings:i}=e.store.getState(),{dependents:a}=Yr(r);for(let e of[...n])a.has(e)||n.delete(e);if(n.size===0)return;let o=new Set;for(let r of t)n.has(r.id)&&(r.type===`text`?e.measurement.textBounds(r.id):r.type===`icon`&&r.label&&e.measurement.iconLabelBounds(r.id))&&o.add(r.id);if(o.size!==0){for(let e of o)n.delete(e);e.history.runWithoutHistory(()=>{i(o)})}}function lD(e,t){let n=V(),r=H(e=>e.transforming);(0,J.useEffect)(()=>{r||cD(n,e)},[n,e,t,r])}var uD=.25,dD=uD/2,fD=200,pD=500;function mD(e,t){return t.minX>=e.minX&&t.minY>=e.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function hD(e){let{shapes:t,viewport:n,containerSize:r,selectedIds:i,editingId:a}=e,o=(0,J.useRef)(null),[s,c]=(0,J.useState)(0);return(0,J.useEffect)(()=>{let e=o.current?.computedViewport;if(e===void 0||e===n)return;let t=window.setTimeout(()=>c(e=>e+1),fD);return()=>window.clearTimeout(t)},[n]),(0,J.useMemo)(()=>{let e=r.width>0&&r.height>0?r:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null;if(e==null)return t;let c=Cr({x:0,y:0},n),l=Cr({x:e.width,y:e.height},n),u=l.x-c.x,d=l.y-c.y,f={minX:c.x,minY:c.y,maxX:l.x,maxY:l.y},p=o.current;if(p!==null&&p.nonce===s&&p.shapes===t&&p.selectedIds===i&&p.editingId===a&&p.width===e.width&&p.height===e.height&&mD(p.reuseWindow,f))return p.visible;let m=u*uD,h=d*uD,g=f.minX-m,_=f.minY-h,v=f.maxX+m,y=f.maxY+h,b=i.size<=pD,x=t.filter(e=>{if(b&&i.has(e.id)||e.id===a)return!0;let t=pr(e);return t.x<=v&&t.x+t.width>=g&&t.y<=y&&t.y+t.height>=_});return p!==null&&p.visible.length===x.length&&p.visible.every((e,t)=>e===x[t])&&(x=p.visible),o.current={shapes:t,selectedIds:i,editingId:a,width:e.width,height:e.height,computedViewport:n,nonce:s,reuseWindow:{minX:f.minX-u*dD,minY:f.minY-d*dD,maxX:f.maxX+u*dD,maxY:f.maxY+d*dD},visible:x},x},[t,n,r,i,a,s])}function gD(e){let{containerRef:t,interactive:n,interaction:r,selection:i,panel:a,tables:o,lanes:s,measure:c,pasteChoiceOpen:l,resolvePasteChoice:u,unlockReveal:d}=e;my(`CanvasScene`);let f=U(),p=H(e=>e.viewport),m=H(e=>e.shapes),h=H(e=>e.selectedIds),g=H(e=>e.editSession),_=xe(g),v=H(e=>e.aiGhost),y=H(e=>e.animateSlideId!==null),b=H(e=>e.flowEdit!==null||e.flowPlay!==null||e.flowPreview!==null),x=H(e=>e.tool),S=H(e=>e.shapeKind),C=H(e=>e.chartKind),w=H(e=>e.frameKind),T=H(e=>e.pendingIcon),E=H(e=>e.pendingControl),D=H(e=>e.showGrid),O=H(e=>e.presentingIndex!==null),k=H(e=>e.draft),A=H(e=>e.polyDraft),j=H(e=>e.marquee),ee=H(e=>e.lasso),M=H(e=>e.bindTarget),N=H(e=>e.snapDot),P=H(e=>e.hoverWorld),F=H(e=>e.snapGuides),I=H(e=>e.transforming),te=H(e=>e.eraserTrail),ne=H(e=>e.style),{setViewport:L,endEdit:R,setSnapGuides:z}=f.getState(),B=(0,J.useMemo)(()=>{if(!A)return null;let e=[...A.points,A.cursor],t=A.closed&&e.length>2?[e[0]]:[];return{id:`__line_draft__`,type:`line`,points:[...e,...t],color:ne.color,strokeWidth:ne.strokeWidth,dash:ne.dash,startArrow:!A.closed&&ne.startArrow,endArrow:!A.closed&&ne.endArrow,startHead:ne.startHead,endHead:ne.endHead,opacity:ne.opacity}},[A,ne]),re=a.editingChart;oD({containerRef:t,setViewport:L});let[ie,ae]=(0,J.useState)({width:0,height:0});(0,J.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>ae({width:e.clientWidth,height:e.clientHeight});n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t]);let oe=hD({shapes:m,viewport:p,containerSize:ie,selectedIds:h,editingId:_}),se=fg(!1),ce=sD(oe,p.zoom);lD(oe,ce);let le=j?(()=>{let e=G(j.start,p),t=G(j.end,p);return{left:Math.min(e.x,t.x),top:Math.min(e.y,t.y),width:Math.abs(e.x-t.x),height:Math.abs(e.y-t.y)}})():null,ue=ee&&ee.length>1?ee.map(e=>{let t=G(e,p);return`${t.x},${t.y}`}).join(` `):null;return(0,Q.jsxs)(Q.Fragment,{children:[D&&(0,Q.jsx)(ub,{viewport:p}),(0,Q.jsxs)(iD,{viewport:p,children:[(0,Q.jsx)(rT,{}),(0,Q.jsx)(eT,{shapes:oe,draft:k,lineDraft:B,editSession:g,interactive:n,bindTarget:M,snapDot:N,onShapePointerDown:r.onShapePointerDown,onLabelPointerDown:r.onLabelPointerDown,onBeginEdit:i.beginEdit,onBeginEditCell:i.beginEditCell,onBeginEditLane:s.beginEditLane,onBeginCrop:i.beginCrop,onBeginVertexEdit:i.beginVertexEdit,onCommitText:i.commitText,onCommitCell:o.commitCell,onCommitLane:s.commitLane,onMeasureCell:c.onMeasureCell,onMeasureLabel:c.onMeasureLabel,onMeasureLifelineWidth:c.onMeasureLifelineWidth,onHover:i.onHover,zoom:ce,hideFigures:O}),!O&&(0,Q.jsx)(tD,{zoom:p.zoom}),!O&&(0,Q.jsx)(Ia,{active:y,feature:eb,children:e=>(0,Q.jsx)(e,{zoom:p.zoom})}),(0,Q.jsx)(fb,{interactive:n,transforming:I,zoom:p.zoom}),(0,Q.jsx)(_b,{interactive:n,zoom:p.zoom,shapes:oe}),v&&(0,Q.jsx)(EE,{bounds:v}),P&&!k&&(0,Q.jsx)(DE,{tool:x,kind:S,chartKind:C,frameKind:w,at:P,icon:T,control:E})]}),!O&&(0,Q.jsx)(XE,{viewport:p}),!O&&(0,Q.jsx)(Ia,{active:b,feature:Vy,children:e=>(0,Q.jsx)(e,{viewport:p})}),le&&(0,Q.jsx)(`div`,{className:`pointer-events-none absolute border border-[var(--canvas-selection)] bg-[var(--canvas-selection)]/10`,style:le}),ue&&(0,Q.jsx)(`svg`,{className:`pointer-events-none absolute inset-0 h-full w-full`,"data-testid":`lasso`,children:(0,Q.jsx)(`polygon`,{points:ue,className:`fill-[var(--canvas-selection)]/10 stroke-[var(--canvas-selection)]`,strokeWidth:1,strokeDasharray:`4 3`})}),(0,Q.jsx)(bE,{guides:F,viewport:p}),n&&!O&&(0,Q.jsx)(qE,{viewport:p}),n&&!O&&(0,Q.jsx)(VT,{viewport:p,setSnapGuides:z}),i.showSelection&&(0,Q.jsx)(jT,{shapes:i.selectedShapes,viewport:p,gestures:r.selectionGestures,onArrowBendReset:i.resetArrowBend,onSurfaceDoubleClick:i.editSelection,cropping:g.kind===`crop`&&i.selectedShapes.length===1&&i.selectedShapes[0].id===g.shapeId,editingVertices:g.kind===`vertices`&&i.selectedShapes.length===1&&i.selectedShapes[0].id===g.shapeId,transforming:I,isGroup:i.selectionIsGroup,onTableInsertColumn:o.insertColumn,onTableDeleteColumn:o.deleteColumn,onTableInsertRow:o.insertRow,onTableDeleteRow:o.deleteRow,onLaneAdd:s.addLane,onLaneDelete:s.deleteLane,onLaneEdit:s.beginEditLane,laneEditing:g.kind===`lane`}),se&&(0,Q.jsx)(se.WebLiveBudget,{viewport:p,containerSize:ie}),se&&!O&&(0,Q.jsx)(se.WebInteractChrome,{viewport:p,onGripPointerDown:r.onWebGripPointerDown}),(0,Q.jsx)(uE,{active:n&&Se(g,m),viewport:p}),(0,Q.jsx)(hE,{}),n&&re&&(0,Q.jsx)(Eb,{shape:re,viewport:p,onChange:e=>o.setChartCells(re.id,e),onClose:()=>R(re.id)}),l&&(0,Q.jsx)(wx,{onPick:u,onCancel:()=>u(`table`)}),n&&i.revealedUnit.length>0&&(0,Q.jsx)(KE,{shapes:i.revealedUnit,viewport:p,onUnlock:d}),(0,Q.jsx)(VE,{interactive:n,transforming:I,revealed:i.revealedUnit.length>0,viewport:p}),(0,Q.jsx)(GE,{interactive:n,transforming:I,viewport:p}),(0,Q.jsx)(Sx,{viewport:p}),!O&&(0,Q.jsx)(vE,{}),x===`laser`&&!O&&(0,Q.jsx)(ja,{}),!O&&(0,Q.jsx)(ka,{trail:te}),(0,Q.jsx)(La,{})]})}function _D(e){let{kinds:t,iconsInk:n,iconLabeled:r,shapeKind:i,control:a,chart:o,textSizing:s,selectionCount:c,laneFrame:l}=e,u=t.has(`icon`)&&n,d=i===`fork-join`,f=a?yi[a.kind].fill:!1,p=a?yi[a.kind].font:t.has(`control`),m=(e,n=[])=>qm(new Set([...t].filter(e=>!n.includes(e))),e),h=t.has(`rectangle`)&&!d,g=t.has(`figure`)&&!l,_=h||t.has(`polygon`)||g||f,v=_||t.has(`sticky`),y=h,b=h,x=m(`smooth`),S=m(`background`),C=t.has(`rectangle`)||t.has(`arrow`)||t.has(`draw`)||t.has(`line`)||t.has(`figure`),w=C||u,T=C,E=t.has(`rectangle`)||t.has(`figure`),D=m(`fontSize`,[`control`])||p,O=m(`textAlign`),k=m(`textVAlign`,[`text`])||t.has(`text`)&&s===`fixed`,A=m(`textPadding`),j=t.has(`text`)&&s!=null,ee=m(`lineHeight`),M=m(`labelColor`),N=!!o,P=t.has(`arrow`)||t.has(`text`)||t.has(`draw`)||t.has(`line`)||t.has(`control`)||t.has(`figure`)||u||r||d,F=m(`bendStyle`),I=m(`startArrow`),te=c>=1,ne=c>=2,L=c>=3;return{showShapeKind:t.has(`rectangle`),showCorner:t.has(`rectangle`)&&bn(i)||m(`corner`,[`rectangle`]),showFill:v,showFillStyles:y,showOutline:b,showFillTransparent:_,showBackground:S,showStroke:w,showStrokeStyle:T,showNoBorder:E,showFont:D,showTextAlign:O,showTextVAlign:k,showTextPadding:A,showTextSizing:j,showTextSpacing:ee,showLabelColor:M,showChartType:N,showColor:P,showLineType:F,showArrowheads:I,showSmooth:x,showLayer:te,showAlign:ne,showDistribute:L}}var vD={solid:`border-solid`,dashed:`border-dashed`,dotted:`border-dotted`},yD=24,bD=9;function xD(e,t,n){return e===`none`?[]:jr(e,t,n,bD)}function SD(e){let{pieces:t}=e;return(0,Q.jsx)(Q.Fragment,{children:t.map((e,t)=>(0,Q.jsx)(`path`,{d:e.d,fill:e.fill===`solid`?`currentColor`:e.fill===`white`?`#ffffff`:`none`,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`,strokeLinejoin:`round`},t))})}function CD(e){let{style:t,side:n}=e,r=yD/2,i=n===`end`?{x:yD-5,y:r}:{x:5,y:r},a=n===`end`?{x:5,y:r}:{x:yD-5,y:r},o=n===`end`?0:Math.PI;return(0,Q.jsxs)(`svg`,{width:22,height:22,viewBox:`0 0 ${yD} ${yD}`,"aria-hidden":!0,children:[(0,Q.jsx)(`line`,{x1:a.x,y1:a.y,x2:i.x,y2:i.y,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`}),(0,Q.jsx)(SD,{pieces:xD(t,i,o)})]})}var wD={bar:2,crowOne:6,circle:8,circleOutline:8,cross:8,crowOneOrMany:12,crowZeroOrOne:12,crowZeroOrMany:15},TD=e=>e===`none`?bD:wD[e]??bD;function ED(e){let{start:t,end:n}=e,r=yD/2,i=Math.max(26,4+TD(t)+7+TD(n)+4),a=(e,t)=>{let n=e===`end`?{x:i-4,y:r}:{x:4,y:r};return(0,Q.jsx)(`g`,{opacity:t===`none`?.3:1,children:(0,Q.jsx)(SD,{pieces:xD(t===`none`?`arrow`:t,n,e===`end`?0:Math.PI)})})};return(0,Q.jsxs)(`svg`,{width:i*22/yD,height:22,viewBox:`0 0 ${i} ${yD}`,"aria-hidden":!0,children:[(0,Q.jsx)(`line`,{x1:4,y1:r,x2:i-4,y2:r,stroke:`currentColor`,strokeWidth:1.75,strokeLinecap:`round`}),a(`start`,t),a(`end`,n)]})}function DD(e){let{option:t,side:n,active:r,onClick:i}=e;return(0,Q.jsx)(`button`,{type:`button`,"data-testid":`arrowhead-${n}-${t}`,"aria-pressed":r,onClick:i,className:`flex aspect-square items-center justify-center rounded-lg transition-colors ${Yc(r)}`,children:(0,Q.jsx)(CD,{style:t,side:n})})}function OD(e){let{style:t,onChange:n}=e,r=t.startArrow?t.startHead:`none`,i=t.endArrow?t.endHead:`none`,a=(e,t)=>e&&!Sr.includes(t),[o,s]=(0,J.useState)(a(t.startArrow,t.startHead)||a(t.endArrow,t.endHead));function c(e,t){if(t===`none`){n(e===`end`?{endArrow:!1}:{startArrow:!1});return}n(e===`end`?{endArrow:!0,endHead:t}:{startArrow:!0,startHead:t})}function l(e){let n=e===`end`?t.endArrow:t.startArrow,r=e===`end`?t.endHead:t.startHead,i=[`none`,...Sr,...o?[...Xr,...Qr]:[]];return(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:e===`end`?`End`:`Start`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-5 gap-1.5`,children:i.map(t=>(0,Q.jsx)(DD,{option:t,side:e,active:t===`none`?!n:n&&r===t,onClick:()=>c(e,t)},t))})]})}return(0,Q.jsx)(Ca,{label:`Arrowheads`,caret:!0,trigger:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(ED,{start:r,end:i})}),children:(0,Q.jsxs)(`div`,{className:`w-56 space-y-2`,children:[l(`start`),l(`end`),(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`flex w-full items-center justify-between rounded-md px-1 py-1 text-[12px] text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-rest)]`,children:[(0,Q.jsx)(`span`,{children:`More options`}),(0,Q.jsx)(w,{size:14,stroke:2,className:`transition-transform ${o?`rotate-180`:``}`})]})]})})}var kD=Tt.filter(e=>e!==`transparent`);function AD(e){let{title:t,values:n,labels:r,testPrefix:i,isActive:a,onPick:o}=e;return(0,Q.jsxs)(`div`,{className:`mt-2 space-y-1 border-t border-[var(--chrome-ring)] pt-2`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:t}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:n.map((e,n)=>(0,Q.jsx)(ya,{testId:`${i}-${e}`,ariaLabel:`${t} ${r[n]}`,active:a(e),onClick:()=>o(e),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium tabular-nums`,children:r[n]})},e))})]})}function jD(e){let{value:t,autoColor:n,onChange:r}=e;return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`flex-1 px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Text`}),(0,Q.jsx)(ga,{value:t,autoColor:n,colors:kD,customFallback:`#9c36b5`,testId:`label-color`,ariaLabel:`Text color`,onPick:r})]})}var MD=Tt.filter(e=>e!==`transparent`);function ND(e){let{style:t,onChange:n}=e,r=t.dash===`none`,i=r?`none`:t.stroke??`auto`,a=r?{dash:`solid`}:{};return(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(`span`,{className:`flex-1 px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Outline`}),(0,Q.jsx)(ga,{value:i,autoColor:`var(--canvas-ink)`,noneOption:!0,colors:MD,customFallback:`#1971c2`,testId:`outline`,ariaLabel:`Outline color`,onPick:e=>{if(e===`none`){n({dash:`none`});return}if(e===`auto`){n({stroke:`auto`,...a});return}n({stroke:e,...a})}})]})}function PD(e){let{style:t,showFill:n,showFillStyles:r,showOutline:i,showFillTransparent:a,showSmooth:o,showColor:s,showLabelColor:c,showBackground:l,onChange:u}=e,d=t.fill!==`transparent`&&!Ke.some(e=>e.pastel===t.fill),f=t.fillStyle===`shadow`?`bold`:t.fillStyle,p=t.shadow??t.fillStyle===`shadow`,m=t.background??`transparent`,h=[n,s,c,l].filter(Boolean).length>1,g=h?`Colors`:n?`Fill`:s?`Color`:c?`Text color`:`Background`,_=n?Ft(t.fill,f):null,v=_?_.fill===`none`?`transparent`:_.fill:l?m:null,y=s?t.color:c?t.labelColor??`auto`:null,b=t.fill===`transparent`||t.fill===`#ffffff`,x=`var(--canvas-ink)`;return _&&(x=b?Dn(_.text):_.text),(0,Q.jsx)(Ca,{label:g,caret:!0,trigger:v!==null&&y!==null?da(v,(0,Q.jsx)(`span`,{className:`text-[12px] leading-none`,style:{color:y===`auto`?x:Dn(y)},children:`A`})):da(v??y??`#1e1e1e`),children:(0,Q.jsxs)(`div`,{className:`w-56 space-y-2.5 [&>*+*]:border-t [&>*+*]:border-[var(--chrome-ring)] [&>*+*]:pt-2.5`,children:[n&&(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[h&&!r&&(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Fill`}),r&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Style`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[xt.map(e=>(0,Q.jsx)(`button`,{type:`button`,title:e.hint,"data-testid":`fill-style-${e.value}`,onClick:()=>u({fillStyle:e.value,shadow:p}),className:`flex-1 rounded-md px-0.5 py-1 text-[11px] transition-colors ${Yc(f===e.value)}`,children:e.label},e.value)),(0,Q.jsx)(S,{label:`Drop shadow`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Drop shadow`,"aria-pressed":p,"data-testid":`fill-shadow`,onClick:()=>u({shadow:!p}),className:`ml-1 flex w-8 items-center justify-center rounded-md py-1 transition-colors ${Yc(p)}`,children:(0,Q.jsx)(Mp,{size:14,stroke:1.75})})})]}),(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Color`})]}),o&&(0,Q.jsxs)(`div`,{className:`mb-1 flex items-center gap-1`,children:[(0,Q.jsx)(S,{label:`Rounded outline`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Rounded outline`,"aria-pressed":!!t.smooth,"data-testid":`polygon-smooth`,onClick:()=>u({smooth:!t.smooth}),className:`flex w-8 items-center justify-center rounded-md py-1 transition-colors ${Yc(!!t.smooth)}`,children:(0,Q.jsx)(Bp,{size:14,stroke:1.75})})}),(0,Q.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-500)]`,children:`Rounded`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[a&&(0,Q.jsx)(wa,{hue:`transparent`,fillStyle:f,active:t.fill===`transparent`,onClick:()=>u({fill:`transparent`}),testId:`fill-hue-transparent`}),Ke.map(e=>(0,Q.jsx)(wa,{hue:e.pastel,fillStyle:f,active:t.fill===e.pastel,onClick:()=>u({fill:e.pastel}),testId:`fill-hue-${e.key}`},e.key)),(0,Q.jsx)(ua,{active:d,picked:d?t.fill:`#3b82f6`,onChange:e=>u({fill:e}),baseTestId:`fill`})]})]}),i&&(0,Q.jsx)(ND,{style:t,onChange:u}),s&&(0,Q.jsx)(Sa,{title:h?`Ink`:void 0,value:t.color,onChange:e=>u({color:e}),testId:`color`}),c&&(0,Q.jsx)(jD,{value:t.labelColor??`auto`,autoColor:x,onChange:e=>u({labelColor:e})}),l&&(0,Q.jsx)(Sa,{title:h?`Background`:void 0,value:m,onChange:e=>u({background:e}),testId:`bg`,customFallback:`#ffe8a3`})]})})}var FD=[{value:`bar`,label:`Bar`,Icon:Go},{value:`line`,label:`Line`,Icon:ps},{value:`area`,label:`Area`,Icon:Uo},{value:`scatter`,label:`Scatter`,Icon:fs},{value:`pie`,label:`Pie`,Icon:us},{value:`donut`,label:`Donut`,Icon:qo},{value:`radar`,label:`Radar`,Icon:Wf},{value:`quadrant`,label:`Quadrant`,Icon:Yo}],ID=[{value:`number`,label:`1.2k`},{value:`percent`,label:`%`},{value:`currency`,label:`$`}];function LD(e){return e===`bar`||e===`line`||e===`area`||e===`scatter`}function RD(e){return e!==`pie`&&e!==`donut`&&e!==`quadrant`}function zD(e){let{label:t,on:n,onClick:r}=e;return(0,Q.jsxs)(`button`,{type:`button`,onClick:r,className:`flex w-full items-center justify-between gap-3 rounded-lg px-1.5 py-1 text-[13px] text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-divider)]`,children:[(0,Q.jsx)(`span`,{children:t}),(0,Q.jsx)(`span`,{className:`flex h-4 w-7 items-center rounded-full p-0.5 transition-colors ${n?`bg-[var(--chrome-accent)]`:`bg-[var(--chrome-active)]`}`,children:(0,Q.jsx)(`span`,{className:`h-3 w-3 rounded-full bg-white transition-transform ${n?`translate-x-3`:``}`})})]})}function BD(e){let{placeholder:t,value:n,testId:r,onChange:i,onBlur:a}=e,{history:o}=V();return(0,Q.jsx)(`input`,{value:n,placeholder:t,"data-testid":r,onChange:e=>i(e.target.value),onFocus:o.beginTransaction,onBlur:()=>{o.endTransaction(),a?.()},className:`h-7 w-full rounded-md border border-[var(--chrome-ring)] px-2 text-[12px] text-[var(--chrome-fg-700)] outline-none focus:border-gray-400`})}function VD(e){let{placeholder:t,testId:n,value:r,onChange:i}=e,[a,o]=(0,J.useState)(null);return(0,Q.jsx)(BD,{placeholder:t,testId:n,value:a??r,onChange:e=>{o(e),i(e)},onBlur:()=>o(null)})}function HD(e){let{chart:t,onPatch:n}=e;return(0,Q.jsx)(Ca,{label:`Chart type`,caret:!0,trigger:(0,Q.jsx)((FD.find(e=>e.value===t.chartType)??FD[0]).Icon,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`grid w-40 grid-cols-3 gap-1`,children:FD.map(e=>(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`chart-type-${e.value}`,onClick:()=>n({chartType:e.value,...e.value===`quadrant`?{showTitles:!0}:{}}),className:`flex h-12 flex-col items-center justify-center gap-1 rounded-lg text-[10px] transition-colors ${Zc(t.chartType===e.value)}`,children:[(0,Q.jsx)(e.Icon,{size:18,stroke:1.75}),e.label]},e.value))})})}function UD(e){let{chart:t,onPatch:n}=e,r=mo(t).series,i=(e,r)=>{let i=(t.seriesColors??[]).slice();for(;i.length<=e;)i.push(void 0);i[e]=r,n({seriesColors:i})};return(0,Q.jsx)(Ca,{label:`Series colors`,caret:!0,trigger:(0,Q.jsx)(`span`,{className:`flex items-center -space-x-1`,children:r.slice(0,3).map((e,t)=>(0,Q.jsx)(`span`,{className:`h-3.5 w-3.5 rounded-full ring-1 ring-white`,style:{background:e.color}},t))}),children:(0,Q.jsx)(`div`,{className:`w-56 space-y-2`,children:r.map((e,t)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`span`,{className:`w-14 shrink-0 truncate text-[12px] text-[var(--chrome-fg-600)]`,children:e.name||`Series ${t+1}`}),(0,Q.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:_o.map(n=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":n,onClick:()=>i(t,n),className:`h-5 w-5 rounded-full transition-transform hover:scale-110 ${e.color===n?`ring-2 ring-[var(--chrome-fg-900)] ring-offset-1`:``}`,style:{background:n}},n))})]},t))})})}function WD(e){return(0,Q.jsx)(`div`,{className:`px-0.5 pt-1 text-[11px] text-[var(--chrome-fg-500)]`,children:e.children})}var GD=[{index:1,placeholder:`Top left`},{index:0,placeholder:`Top right`},{index:2,placeholder:`Bottom left`},{index:3,placeholder:`Bottom right`}];function KD(e){let{color:t,label:n,testId:r,onChange:i}=e,a=V();return(0,Q.jsxs)(mc,{children:[(0,Q.jsx)(S,{label:n,children:(0,Q.jsx)(ca,{"aria-label":n,"data-testid":r,className:`h-5 w-5 shrink-0 cursor-pointer rounded-full ring-1 ring-black/20 transition-transform hover:scale-110 data-[popup-open]:scale-110`,style:{background:t}})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`top`,align:`center`,sideOffset:8,className:`outline-none`,children:(0,Q.jsx)(Tc,{"data-overlay":!0,"data-panel-popup":!0,"data-editor-runtime-id":a.id,"data-testid":`${r}-popup`,className:`p-2.5 ${Wc.popup}`,children:(0,Q.jsx)(Sa,{value:t,onChange:i,testId:r,customFallback:t,colors:_o})})})})]})}function qD(e){let{chart:t,onPatch:n}=e,r=t.quadrantLabels??[],i=K(t.xTitle),a=K(t.yTitle),o=(e,t)=>{let i=r.slice();for(;i.length<4;)i.push(``);i[e]=t,n({quadrantLabels:i})},s=(e,r)=>{let i=(t.quadrantColors??[]).slice();for(;i.length<4;)i.push(void 0);i[e]=r,n({quadrantColors:i})},c=e=>t.quadrantColors?.[e]??bo[e],l=t.seriesColors?.[0]??_o[0];return(0,Q.jsxs)(`div`,{className:`w-60 space-y-1`,children:[(0,Q.jsx)(WD,{children:`Title`}),(0,Q.jsx)(BD,{placeholder:`Chart title`,value:t.title??``,onChange:e=>n({title:e,showTitles:!0})}),(0,Q.jsx)(WD,{children:`X-axis (left → right)`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`div`,{className:`flex-1`,children:(0,Q.jsx)(VD,{placeholder:`Low`,testId:`quad-x-low`,value:i.low,onChange:e=>n({xTitle:oo(e,i.high)})})}),(0,Q.jsx)(`div`,{className:`flex-1`,children:(0,Q.jsx)(VD,{placeholder:`High`,testId:`quad-x-high`,value:i.high,onChange:e=>n({xTitle:oo(i.low,e)})})})]}),(0,Q.jsx)(WD,{children:`Y-axis (bottom → top)`}),(0,Q.jsxs)(`div`,{className:`flex gap-1`,children:[(0,Q.jsx)(`div`,{className:`flex-1`,children:(0,Q.jsx)(VD,{placeholder:`Low`,testId:`quad-y-low`,value:a.low,onChange:e=>n({yTitle:oo(e,a.high)})})}),(0,Q.jsx)(`div`,{className:`flex-1`,children:(0,Q.jsx)(VD,{placeholder:`High`,testId:`quad-y-high`,value:a.high,onChange:e=>n({yTitle:oo(a.low,e)})})})]}),(0,Q.jsx)(WD,{children:`Quadrant labels`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-2 gap-1`,children:GD.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(KD,{color:c(e.index),label:`${e.placeholder} color`,testId:`quad-zone-${e.index}`,onChange:t=>s(e.index,t)}),(0,Q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,Q.jsx)(BD,{placeholder:e.placeholder,value:r[e.index]??``,onChange:t=>o(e.index,t)})})]},e.index))}),(0,Q.jsx)(WD,{children:`Point color`}),(0,Q.jsx)(Sa,{value:l,onChange:e=>n({seriesColors:[e]}),testId:`quad-point`,customFallback:l,colors:_o})]})}function JD(e){let{chart:t,onPatch:n}=e,r=t.chartType,i=LD(r),a=!!t.showLegend,o=i?`number`:`percent`;return r===`quadrant`?(0,Q.jsx)(Ca,{label:`Chart options`,caret:!0,trigger:(0,Q.jsx)(Wo,{size:17,stroke:1.75}),children:(0,Q.jsx)(qD,{chart:t,onPatch:n})}):(0,Q.jsx)(Ca,{label:`Chart options`,caret:!0,trigger:(0,Q.jsx)(Wo,{size:17,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`w-56 space-y-1`,children:[r===`bar`&&(0,Q.jsx)(zD,{label:`Horizontal`,on:!!t.horizontal,onClick:()=>n({horizontal:!t.horizontal})}),(r===`bar`||r===`area`)&&(0,Q.jsx)(zD,{label:`Stacked`,on:!!t.stacked,onClick:()=>n({stacked:!t.stacked})}),i&&(0,Q.jsx)(zD,{label:`Value labels`,on:!!t.showValues,onClick:()=>n({showValues:!t.showValues})}),(0,Q.jsx)(zD,{label:`Legend`,on:a,onClick:()=>n({showLegend:!a})}),(0,Q.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-1.5 py-1 text-[13px] text-[var(--chrome-fg-700)]`,children:[(0,Q.jsx)(`span`,{children:`Numbers`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:ID.map(e=>(0,Q.jsx)(ya,{testId:`number-format-${e.value}`,active:(t.numberFormat??o)===e.value,onClick:()=>n({numberFormat:e.value}),children:(0,Q.jsx)(`span`,{className:`px-0.5 text-[11px]`,children:e.label})},e.value))})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5 border-t border-[var(--chrome-ring)] pt-1.5`,children:[(0,Q.jsx)(zD,{label:`Titles`,on:!!t.showTitles,onClick:()=>n({showTitles:!t.showTitles})}),t.showTitles&&(0,Q.jsxs)(`div`,{className:`space-y-1.5 px-1.5`,children:[(0,Q.jsx)(BD,{placeholder:`Chart title`,value:t.title??``,onChange:e=>n({title:e})}),i&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(BD,{placeholder:`X-axis title`,value:t.xTitle??``,onChange:e=>n({xTitle:e})}),(0,Q.jsx)(BD,{placeholder:`Y-axis title`,value:t.yTitle??``,onChange:e=>n({yTitle:e})})]})]})]})]})})}function YD(e){return RD(e.chartType)&&mo(e).series.length>0}function XD(e){return yi[e.kind].value!==void 0}function ZD(e){let{control:t,onPatch:n}=e,{history:r}=V(),i=pa(r),a=yi[t.kind].value;if(a===`range`){let e=Math.round((t.value??.5)*100);return(0,Q.jsx)(Ca,{label:t.kind===`slider`?`Slider value`:`Fill level`,caret:!0,trigger:(0,Q.jsx)(Wo,{size:18,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`flex w-44 items-center gap-2 px-1`,children:[(0,Q.jsx)(`input`,{type:`range`,min:0,max:100,value:e,"data-testid":`control-value-slider`,onChange:e=>n({value:Number(e.target.value)/100}),...i,className:`h-1 flex-1 cursor-pointer accent-[var(--chrome-fg-600)]`}),(0,Q.jsxs)(`span`,{className:`w-9 text-right text-[12px] text-[var(--chrome-fg-500)]`,children:[e,`%`]})]})})}if(a===`alert`){let e=Math.max(0,Math.min(vi.length-1,Math.round(t.value??0)));return(0,Q.jsx)(Ca,{label:`Alert type`,caret:!0,trigger:(0,Q.jsx)(ms,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`flex w-44 flex-col gap-1`,children:vi.map((t,r)=>(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`control-alert-${t.key}`,onClick:()=>n({value:r}),className:`flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12px] transition-colors ${Zc(r===e)}`,children:[(0,Q.jsx)(`span`,{className:`h-3 w-3 shrink-0 rounded-full`,style:{backgroundColor:t.ink}}),t.label]},t.key))})})}if(a===`stars`){let e=ct(Math.round(t.value??3),0,5);return(0,Q.jsx)(Ca,{label:`Rating`,caret:!0,trigger:(0,Q.jsx)(_p,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`flex w-44 items-center gap-1 px-1`,children:[1,2,3,4,5].map(t=>(0,Q.jsx)(`button`,{type:`button`,"data-testid":`control-rating-${t}`,onClick:()=>n({value:t}),className:`flex-1 rounded-lg px-1.5 py-1.5 text-[12px] transition-colors ${Zc(t<=e)}`,children:t},t))})})}if(a===`index`){let e=t.label.split(` | `).map(e=>e.trim()).filter(e=>e.length>0),r=Math.max(0,Math.min(e.length-1,Math.round(t.value??0)));return(0,Q.jsx)(Ca,{label:`Active item`,caret:!0,trigger:(0,Q.jsx)(_p,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`flex w-44 flex-col gap-1`,children:e.map((e,t)=>(0,Q.jsx)(`button`,{type:`button`,"data-testid":`control-active-${t}`,onClick:()=>n({value:t}),className:`truncate rounded-lg px-2.5 py-1.5 text-left text-[12px] transition-colors ${Zc(t===r)}`,children:e},`${e}-${t}`))})})}if(a===`operator`){let e=t.label.trim().split(/\s+/)[0]?.toLowerCase()??``;return(0,Q.jsx)(Ca,{label:`Operator`,caret:!0,trigger:(0,Q.jsx)(ds,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`grid w-44 grid-cols-2 gap-1`,children:Pr.map(r=>(0,Q.jsx)(`button`,{type:`button`,"data-testid":`control-operator-${r}`,onClick:()=>n({label:Dr(t.label,r)}),className:`rounded-lg px-2.5 py-1.5 text-left text-[12px] transition-colors ${Zc(r===e)}`,children:r},r))})})}if(a===`activation`){let e=[...t.activations??[]].sort((e,t)=>e.top-t.top);return(0,Q.jsx)(Ca,{label:`Activation bars`,caret:!0,testId:`control-activation`,trigger:(0,Q.jsx)(kp,{size:18,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`flex w-44 flex-col gap-1`,children:[e.map((t,r)=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsxs)(`span`,{className:`flex-1 truncate px-2.5 py-1.5 text-left text-[12px] text-[var(--chrome-fg-600)]`,children:[`Bar `,r+1]}),(0,Q.jsx)(S,{label:`Remove bar`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"data-testid":`control-activation-remove-${r}`,onClick:()=>n({activations:e.length===1?void 0:e.filter((e,t)=>t!==r)}),className:`rounded-lg p-1.5 transition-colors ${Zc(!1)}`,children:(0,Q.jsx)(uc,{size:14,stroke:1.75})})})]},`${t.top}-${r}`)),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`control-activation-add`,onClick:()=>n({activations:[...e,br(t)].sort((e,t)=>e.top-t.top)}),className:`flex items-center gap-2 rounded-lg px-2.5 py-1.5 text-left text-[12px] transition-colors ${Zc(!1)}`,children:[(0,Q.jsx)(ic,{size:14,stroke:1.75}),`Add bar`]})]})})}let o=(t.value??0)>=.5;return(0,Q.jsx)(S,{label:t.kind===`toggle`?`On / off`:`Checked`,side:`top`,children:(0,Q.jsx)(`span`,{children:(0,Q.jsx)(ya,{testId:`control-checked`,active:o,onClick:()=>n({value:+!o}),children:(0,Q.jsx)(_p,{size:18,stroke:1.75})})})})}function QD(){my(`SelectionStats`);let e=U(),t=V(),n=H(e=>e.shapes),r=H(e=>e.selectedIds),{replaceMany:i}=e.getState(),a=(0,J.useMemo)(()=>sa(n,r),[n,r]),o=(0,J.useMemo)(()=>Bt(a,t.measurement),[a,t]);if(!o||a.length===0)return null;let s=a.length===1&&on(a[0])?an(a[0]):null,c=s!==null&&s%360!=0?a[0]:null,l=c?W(c,t.measurement):o,u=e=>{if(e.x!==void 0||e.y!==void 0){let r={x:(e.x??o.x)-o.x,y:(e.y??o.y)-o.y},s=new Set(a.map(e=>e.id));i(a.map(e=>Ne(e,r,n,s,t.measurement)));return}if(e.width!==void 0||e.height!==void 0){let t=l.width>0?Math.max(1,e.width??l.width)/l.width:1,n=l.height>0?Math.max(1,e.height??l.height)/l.height:1,r=c?{x:l.x+l.width/2,y:l.y+l.height/2}:{x:o.x,y:o.y};i(a.map(e=>gr(e,r,t,n)));return}if(e.angle!==void 0&&a.length===1){let t=a[0],n=(e.angle-an(t))*Math.PI/180,r=dr(t,rn(t),n);i([`rotation`in r?{...r,rotation:e.angle}:r])}};return(0,Q.jsx)(Ca,{label:`Position and size`,caret:!0,trigger:(0,Q.jsx)(Yf,{size:18,stroke:1.75}),children:(0,Q.jsx)(`div`,{className:`flex flex-col gap-1.5`,"data-testid":`stats-popover`,children:(0,Q.jsxs)(`div`,{className:`grid grid-cols-2 gap-1.5`,children:[(0,Q.jsx)(ma,{label:`X`,testId:`stat-x`,value:o.x,onCommit:e=>u({x:e})}),(0,Q.jsx)(ma,{label:`Y`,testId:`stat-y`,value:o.y,onCommit:e=>u({y:e})}),(0,Q.jsx)(ma,{label:`W`,testId:`stat-w`,value:l.width,onCommit:e=>u({width:e})}),(0,Q.jsx)(ma,{label:`H`,testId:`stat-h`,value:l.height,onCommit:e=>u({height:e})}),s!==null&&(0,Q.jsx)(ma,{label:`R`,testId:`stat-angle`,value:(s%360+360)%360,onCommit:e=>u({angle:e})})]})})})}function $D(e){let{value:t,onChange:n}=e,r=V(),[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(t),c=fa();function l(){o.trim()!==t&&n(o.trim()||void 0)}function u(){let e=Vn(o.trim());e&&window.open(e,`_blank`,`noopener,noreferrer`)}return(0,Q.jsxs)(mc,{open:i,onOpenChange:e=>{if(a(e),e){s(t);return}l(),c.restore()},children:[(0,Q.jsx)(S,{label:`Link`,children:(0,Q.jsx)(ca,{"aria-label":`Link`,"data-testid":`link-control`,onPointerDown:c.onPointerDown,onMouseDown:c.onMouseDown,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg transition-colors hover:bg-[var(--chrome-hover)] data-[popup-open]:bg-[var(--chrome-hover)] ${t?`text-[var(--chrome-fg-900)]`:`text-[var(--chrome-fg-500)]`}`,children:(0,Q.jsx)($s,{size:18,stroke:1.75})})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{sideOffset:8,side:`top`,children:(0,Q.jsx)(Tc,{"data-panel-popup":!0,"data-editor-runtime-id":r.id,"data-caret-safe":!0,...c.focusProps,onPointerDown:c.onPointerDown,onMouseDown:c.onMouseDown,children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 p-1.5 ${Wc.popup}`,children:[(0,Q.jsx)(`input`,{"data-testid":`link-input`,value:o,autoFocus:!0,placeholder:`https://…`,onChange:e=>s(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(l(),a(!1))},className:`h-8 w-56 rounded-lg px-2 text-[13px] text-[var(--chrome-fg-900)] outline-none ring-1 ring-[var(--chrome-ring)] focus:ring-black/25`}),(0,Q.jsx)(S,{label:`Open link`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Open link`,"data-testid":`link-open`,disabled:!o.trim(),onClick:u,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-hover)] disabled:text-[var(--chrome-fg-300)]`,children:(0,Q.jsx)(Ws,{size:18,stroke:1.75})})})]})})})})]})}function eO(){return(0,Q.jsx)(`div`,{"data-testid":`icon-picker-loading`,className:`flex w-[min(380px,calc(100vw-1rem))] items-center justify-center text-[12px] text-[var(--chrome-fg-500)] ${Wc.popup}`,style:{height:`min(70vh, 560px)`},children:`Loading icons…`})}function tO(e){let{icon:t,onPick:n}=e,r=V(),[i,a]=(0,J.useState)(!1),o=fa();return t.source===`drawnicons`?(0,Q.jsx)(nO,{icon:t,onPick:n}):(0,Q.jsxs)(mc,{open:i,onOpenChange:e=>{a(e),e||o.restore()},children:[(0,Q.jsx)(S,{label:`Icon`,children:(0,Q.jsxs)(ca,{"aria-label":`Icon`,"data-testid":`icon-switcher`,onPointerDown:o.onPointerDown,onMouseDown:o.onMouseDown,onPointerEnter:()=>Pa(Jy),className:`flex h-8 cursor-pointer items-center justify-center gap-1 rounded-lg px-2 text-[var(--chrome-fg-900)] transition-colors hover:bg-[var(--chrome-hover)] data-[popup-open]:bg-[var(--chrome-hover)]`,children:[(0,Q.jsx)(vS,{name:t.name,source:t.source}),(0,Q.jsx)(bc,{})]})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`top`,align:`start`,sideOffset:8,children:(0,Q.jsx)(Tc,{"data-panel-popup":!0,"data-editor-runtime-id":r.id,"data-caret-safe":!0,...o.focusProps,onPointerDown:o.onPointerDown,onMouseDown:o.onMouseDown,children:(0,Q.jsx)(Ia,{active:i,feature:Jy,fallback:(0,Q.jsx)(eO,{}),children:e=>(0,Q.jsx)(e,{onPick:(e,t)=>{n(e,t),a(!1)}})})})})})]})}function nO(e){let{icon:t,onPick:n}=e,[r,i]=(0,J.useState)(!1);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(S,{label:`Image`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Image`,"data-testid":`icon-switcher`,onPointerEnter:()=>Pa(Yy),onClick:()=>i(!0),className:`flex h-8 cursor-pointer items-center justify-center gap-1 rounded-lg px-2 text-[var(--chrome-fg-900)] transition-colors hover:bg-[var(--chrome-hover)] aria-expanded:bg-[var(--chrome-hover)]`,"aria-expanded":r,children:[(0,Q.jsx)(vS,{name:t.name,source:t.source}),(0,Q.jsx)(bc,{})]})}),(0,Q.jsx)(Ia,{active:r,feature:Yy,children:e=>(0,Q.jsx)(e,{open:!0,onOpenChange:i,onPick:n})})]})}function rO(e){let{icon:t,label:n,testId:r,placement:i,onPick:a,onRemove:o,onPlacement:s}=e,c=V(),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),p=fa(),m=[{value:`hanging`,label:`Hang icon on the border`,glyph:Uf},{value:`inside`,label:`Icon inside, before the label`,glyph:Fp}],h=`flex w-full cursor-pointer items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[12px] text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)]`;return(0,Q.jsxs)(mc,{open:l,onOpenChange:e=>{u(e),e||(f(!1),p.restore())},children:[(0,Q.jsx)(S,{label:n,children:(0,Q.jsxs)(ca,{"aria-label":n,"data-testid":r,onPointerDown:p.onPointerDown,onMouseDown:p.onMouseDown,onPointerEnter:()=>Pa(Jy),className:`flex h-8 cursor-pointer items-center justify-center gap-1 rounded-lg px-2 text-[var(--chrome-fg-900)] transition-colors hover:bg-[var(--chrome-hover)] data-[popup-open]:bg-[var(--chrome-hover)]`,children:[t?(0,Q.jsx)(vS,{name:t.name,source:t.source}):(0,Q.jsx)(Ep,{size:18,stroke:1.75,className:`text-[var(--chrome-fg-500)]`}),(0,Q.jsx)(bc,{})]})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`top`,align:`start`,sideOffset:8,children:(0,Q.jsx)(Tc,{"data-panel-popup":!0,"data-editor-runtime-id":c.id,"data-caret-safe":!0,...p.focusProps,onPointerDown:p.onPointerDown,onMouseDown:p.onMouseDown,children:!t||d?(0,Q.jsx)(Ia,{active:l&&(!t||d),feature:Jy,fallback:(0,Q.jsx)(eO,{}),children:e=>(0,Q.jsx)(e,{onPick:(e,t)=>{a(e,t),u(!1),f(!1)}})}):(0,Q.jsxs)(`div`,{className:`flex w-44 flex-col p-1.5 ${Wc.popup}`,children:[s&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:`px-1.5 pb-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Position`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:m.map(({value:e,label:t,glyph:n})=>(0,Q.jsx)(ya,{testId:`icon-placement-${e}`,ariaLabel:t,active:(i??`hanging`)===e,onClick:()=>s(e),children:(0,Q.jsx)(n,{size:18,stroke:1.75})},e))}),(0,Q.jsx)(`div`,{className:`my-1.5 h-px bg-[var(--chrome-divider)]`})]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`icon-change`,onClick:()=>f(!0),className:h,children:[(0,Q.jsx)(Gs,{size:14,stroke:1.75}),`Change icon`]}),(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`icon-remove`,onClick:()=>{o(),u(!1)},className:h,children:[(0,Q.jsx)(bs,{size:14,stroke:1.75}),`Remove icon`]})]})})},!t||d?`picker`:`menu`)})]})}var iO=[{value:`sharp`,label:`Sharp corners`,Icon:Hf},{value:`rounded`,label:`Rounded corners`,Icon:Vf}];function aO(e){return ct(Math.round(e*.85),1,7)}function oO(e){let{corner:t}=e;return(0,Q.jsx)(t===`rounded`?Vf:Hf,{size:16,stroke:1.75})}function sO(e){return e===`none`?`border-solid`:vD[e]}function cO(e){typeof document>`u`||!(`fonts`in document)||qh(document.fonts,e,Hh)}var lO=[{value:`curved`,label:`Curved`},{value:`elbow`,label:`Elbow`}],uO=[{value:`left`,label:`Align text left`},{value:`center`,label:`Align text center`},{value:`right`,label:`Align text right`}],dO=[{value:`top`,label:`Align text top`},{value:`middle`,label:`Align text middle`},{value:`bottom`,label:`Align text bottom`}];function fO(e){let{figure:t,icon:n,onFigurePatch:r,onPickIcon:i}=e;return n?(0,Q.jsx)(tO,{icon:n,onPick:i}):t?(0,Q.jsx)(rO,{icon:t.titleIcon??null,label:`Frame icon`,testId:`icon-switcher`,onPick:(e,t)=>r({titleIcon:{name:e,source:t}}),onRemove:()=>r({titleIcon:void 0})}):null}function pO(e){let{badge:t,onBadgePatch:n}=e;return(0,Q.jsx)(rO,{icon:t??null,label:`Badge icon`,testId:`badge-switcher`,placement:t?.placement,onPick:(e,r)=>n({name:e,source:r,placement:t?.placement}),onRemove:()=>n(void 0),onPlacement:t?e=>n({...t,placement:e}):void 0})}function mO(e){let{shapeKind:t,onShapeKind:n}=e;return(0,Q.jsx)(Ca,{label:`Shape`,caret:!0,closeOnPick:H(e=>e.coarsePointer),trigger:(0,Q.jsx)(vc,{kind:t}),children:(0,Q.jsx)(`div`,{className:`grid w-72 grid-cols-7 gap-1`,children:$t.map(e=>(0,Q.jsx)(`button`,{type:`button`,"aria-label":e,"data-testid":`kind-${e}`,onClick:()=>n(e),className:`flex h-10 items-center justify-center rounded-lg transition-colors ${Zc(t===e)}`,children:(0,Q.jsx)(vc,{kind:e,size:20})},e))})})}function hO(e){let{control:t,onControlPatch:n}=e;return t?(0,Q.jsx)(ZD,{control:t,onPatch:n}):null}function gO(e){let{chart:t,onChartPatch:n}=e;return t?(0,Q.jsx)(HD,{chart:t,onPatch:n}):null}function _O(e){let{chart:t,onChartPatch:n}=e;return t?(0,Q.jsx)(UD,{chart:t,onPatch:n}):null}function vO(e){let{chart:t,onChartPatch:n}=e;return t?(0,Q.jsx)(JD,{chart:t,onPatch:n}):null}function yO(e){let{style:t,onChange:n,showFill:r,showFillStyles:i,showOutline:a,showFillTransparent:o,showSmooth:s,showBackground:c,showLabelColor:l,showColor:u}=e;return(0,Q.jsx)(PD,{style:t,showFill:r,showFillStyles:i,showOutline:a,showFillTransparent:o,showSmooth:s,showColor:u,showLabelColor:l,showBackground:c,onChange:n})}function bO(e){let{style:t,shapeKind:n,onChange:r,showCorner:i,showStroke:a,showStrokeStyle:o,showNoBorder:s,showArrowheads:c}=e,l=a||o,{history:u}=V();return(0,Q.jsx)(Ca,{label:l?`Stroke`:`Corners`,caret:!0,trigger:(0,Q.jsx)(`span`,{className:`flex w-5 items-center justify-center`,children:l?t.flow&&o?(0,Q.jsx)(Mf,{size:16,stroke:1.75}):t.dash===`none`&&o?(0,Q.jsx)(Lf,{size:16,stroke:1.75}):(0,Q.jsx)(`span`,{className:`w-5 border-[var(--chrome-fg-800)] ${o?sO(t.dash):`border-solid`}`,style:{borderTopWidth:aO(t.strokeWidth)}}):(0,Q.jsx)(oO,{corner:t.corner})}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[a&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Width`}),(0,Q.jsx)(`div`,{className:`flex w-44 items-center gap-2`,children:Je.map((e,n)=>(0,Q.jsx)(ya,{testId:`stroke-width-${e}`,active:t.strokeWidth===e,onClick:()=>r({strokeWidth:e}),children:(0,Q.jsx)(`span`,{className:`w-5 rounded-full bg-current`,style:{height:1+n*2}})},e))}),(0,Q.jsx)(`div`,{className:`flex w-44 items-center`,children:(0,Q.jsx)(_a,{value:t.strokeWidth,onChange:e=>r({strokeWidth:e}),min:.25,max:64,step:.25,precision:2,label:`Stroke width`,fullWidth:!0,testId:`stroke-width-custom`,onNudgeStart:u.beginTransaction,onNudgeEnd:u.endTransaction})})]}),o&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Style`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 ${s||c?`w-44`:`w-32`}`,children:[yt.map(e=>(0,Q.jsx)(ya,{testId:`dash-${e}`,active:t.dash===e&&!t.flow,onClick:()=>r({dash:e,flow:!1}),children:(0,Q.jsx)(`span`,{className:`w-5 border-t-2 border-current ${vD[e]}`})},e)),c&&(0,Q.jsx)(ya,{testId:`dash-flow`,ariaLabel:`Animated flow`,active:t.flow??!1,onClick:()=>r({dash:`dashed`,flow:!0}),children:(0,Q.jsx)(Mf,{size:16,stroke:1.75})}),s&&(0,Q.jsx)(ya,{testId:`dash-none`,active:t.dash===`none`,onClick:()=>r({dash:`none`,flow:!1}),children:(0,Q.jsx)(Lf,{size:16,stroke:1.75})})]})]}),i&&(0,Q.jsxs)(`div`,{className:`space-y-1`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Corners`}),(0,Q.jsx)(`div`,{className:`flex w-44 items-center gap-2`,children:iO.map(e=>(0,Q.jsx)(ya,{testId:`corner-${e.value}`,ariaLabel:e.label,active:(t.corner??xn(n))===e.value,onClick:()=>r({corner:e.value}),children:(0,Q.jsx)(e.Icon,{size:16,stroke:1.75})},e.value))})]})]})})}function xO(e){let{style:t,onChange:n,showLineType:r,showArrowheads:i}=e;return(0,Q.jsxs)(Q.Fragment,{children:[r&&(0,Q.jsx)(Ca,{label:`Line type`,caret:!0,trigger:(0,Q.jsx)(pc,{bend:t.bendStyle,size:20}),children:(0,Q.jsx)(`div`,{className:`flex w-28 items-center gap-2`,children:lO.map(e=>(0,Q.jsx)(ya,{testId:`bend-style-${e.value}`,ariaLabel:e.label,active:t.bendStyle===e.value,onClick:()=>n({bendStyle:e.value}),children:(0,Q.jsx)(pc,{bend:e.value,size:24})},e.value))})}),i&&(0,Q.jsx)(OD,{style:t,onChange:n})]})}function SO(e){let{style:t,chart:n,onChange:r}=e,{history:i}=V();return(0,Q.jsx)(Ca,{label:`Font`,caret:!0,trigger:(0,Q.jsx)(`span`,{style:{fontFamily:t.fontFamily,fontWeight:nt(t.fontFamily)},children:`Aa`}),children:(0,Q.jsxs)(`div`,{className:`w-48`,children:[(0,Q.jsx)(`div`,{className:`-mx-1 flex flex-col px-1`,children:Ct.map(e=>(0,Q.jsx)(`button`,{type:`button`,onPointerEnter:()=>cO(e.value),onFocus:()=>cO(e.value),onClick:()=>{cO(e.value),r({fontFamily:e.value})},style:{fontFamily:e.value,fontWeight:nt(e.value)},className:`flex h-9 shrink-0 items-center rounded-lg px-3 text-base transition-colors ${Zc(t.fontFamily===e.value)}`,children:e.label},e.value))}),(0,Q.jsxs)(`div`,{className:`mt-2 space-y-2 border-t border-[var(--chrome-ring)] pt-2`,children:[(0,Q.jsx)(ba,{value:t.fontSize,onChange:e=>r({fontSize:e}),onNudgeStart:i.beginTransaction,onNudgeEnd:i.endTransaction}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:(n?jt:Mt).map((e,n)=>(0,Q.jsx)(ya,{testId:`font-size-${e}`,active:t.fontSize===e,onClick:()=>r({fontSize:e}),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:ht[n]})},e))})]})]})})}function CO(e){let{style:t,textSizing:n,onChange:r,onTextSizing:i,showTextAlign:a,showTextVAlign:o,showTextPadding:s,showTextSizing:c,showTextSpacing:l}=e;return(0,Q.jsx)(Ca,{label:`Text layout`,caret:!0,trigger:(0,Q.jsx)(Op,{size:18,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`flex w-44 flex-col gap-1`,children:[a&&(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:uO.map(e=>(0,Q.jsx)(ya,{testId:`text-align-${e.value}`,ariaLabel:e.label,active:t.textAlign===e.value,onClick:()=>r({textAlign:e.value}),children:(0,Q.jsx)(fc,{type:e.value,size:20,stroke:1.75})},e.value))}),o&&(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:dO.map(e=>(0,Q.jsx)(ya,{testId:`text-valign-${e.value}`,ariaLabel:e.label,active:t.textVAlign===e.value,onClick:()=>r({textVAlign:e.value}),children:(0,Q.jsx)(fc,{type:e.value,size:20,stroke:1.75})},e.value))}),s&&(0,Q.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-[var(--chrome-ring)] pt-2`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Padding`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-1`,children:at.map((e,n)=>(0,Q.jsx)(ya,{testId:`text-padding-${e}`,ariaLabel:`Text padding ${Ye[n]}`,active:t.textPadding===e,onClick:()=>r({textPadding:e}),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:Ye[n]})},e))})]}),c&&(0,Q.jsxs)(`div`,{className:`mt-1 space-y-1 border-t border-[var(--chrome-ring)] pt-2`,children:[(0,Q.jsx)(`div`,{className:`px-1 text-[11px] text-[var(--chrome-fg-500)]`,children:`Sizing`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(ya,{testId:`text-sizing-auto-width`,ariaLabel:`Auto width`,active:n===`auto-width`,onClick:()=>i(`auto-width`),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:`Auto width`})}),(0,Q.jsx)(ya,{testId:`text-sizing-auto-height`,ariaLabel:`Auto height`,active:n!==`auto-width`,onClick:()=>i(`auto-height`),children:(0,Q.jsx)(`span`,{className:`text-[11px] font-medium`,children:`Auto height`})})]})]}),l&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(AD,{title:`Line height`,values:Nt,labels:Pt,testPrefix:`line-height`,isActive:e=>t.lineHeight===e,onPick:e=>r({lineHeight:e})}),(0,Q.jsx)(AD,{title:`Letter spacing`,values:_t,labels:ft,testPrefix:`letter-spacing`,isActive:e=>(t.letterSpacing??0)===e,onPick:e=>r({letterSpacing:e})})]})]})})}function wO(e){let{style:t,onChange:n}=e,r=pa(V().history);return(0,Q.jsx)(Ca,{label:`Opacity`,trigger:(0,Q.jsxs)(`span`,{className:`text-[13px] tabular-nums text-[var(--chrome-fg-900)]`,children:[Math.round(t.opacity*100),`%`]}),children:(0,Q.jsx)(`input`,{type:`range`,"data-testid":`opacity-range`,min:.1,max:1,step:.05,value:t.opacity,onChange:e=>n({opacity:Number(e.target.value)}),...r,className:`h-1.5 w-40 cursor-pointer accent-[var(--chrome-fg-600)]`})})}function TO(){return(0,Q.jsx)(QD,{})}function EO(e){let{onReorder:t}=e;return(0,Q.jsx)(Ca,{label:`Layer`,caret:!0,trigger:(0,Q.jsx)(Os,{size:18,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(la,{action:`front`,label:`Bring to front`,onReorder:t,Icon:Pf}),(0,Q.jsx)(la,{action:`forward`,label:`Bring forward`,onReorder:t,Icon:vs}),(0,Q.jsx)(la,{action:`backward`,label:`Send backward`,onReorder:t,Icon:ys}),(0,Q.jsx)(la,{action:`back`,label:`Send to back`,onReorder:t,Icon:Nf})]})})}function DO(e){let{link:t,onLink:n}=e;return(0,Q.jsx)($D,{value:t??``,onChange:n??(()=>{})})}function OO(e){let t=fg(e.web!==void 0);return!e.web||!t?null:(0,Q.jsx)(t.WebControls,{web:e.web})}function kO(e){let{onAlign:t,onDistribute:n,showDistribute:r}=e;return(0,Q.jsx)(Ca,{label:`Align`,caret:!0,trigger:(0,Q.jsx)(sp,{size:18,stroke:1.75}),children:(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(va,{type:`left`,onAlign:t,Icon:cp}),(0,Q.jsx)(va,{type:`center-h`,onAlign:t,Icon:sp}),(0,Q.jsx)(va,{type:`right`,onAlign:t,Icon:up}),(0,Q.jsx)(va,{type:`top`,onAlign:t,Icon:dp}),(0,Q.jsx)(va,{type:`middle`,onAlign:t,Icon:lp}),(0,Q.jsx)(va,{type:`bottom`,onAlign:t,Icon:op})]}),r&&(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Q.jsx)(xa,{axis:`horizontal`,onDistribute:n,Icon:hp}),(0,Q.jsx)(xa,{axis:`vertical`,onDistribute:n,Icon:mp})]})]})})}var AO=[{key:`icon`,visible:e=>!!e.icon||!!e.figure,Component:fO},{key:`badge`,visible:e=>e.badge!==void 0,Component:pO},{key:`web`,visible:e=>e.web!==void 0,Component:OO},{key:`shape`,visible:e=>e.showShapeKind,Component:mO},{key:`controlValue`,visible:e=>!!e.control&&XD(e.control),Component:hO},{key:`chartType`,visible:e=>e.showChartType,Component:gO},{key:`chartColors`,visible:e=>!!e.chart&&YD(e.chart),Component:_O},{key:`chartOptions`,visible:e=>e.showChartType,Component:vO},{key:`color`,visible:e=>e.showColor||e.showLabelColor||e.showBackground||e.showFill,Component:yO},{key:`stroke`,visible:e=>e.showStroke||e.showStrokeStyle||e.showCorner,Component:bO},{key:`line`,visible:e=>e.showLineType||e.showArrowheads,Component:xO},{key:`font`,visible:e=>e.showFont,Component:SO},{key:`textLayout`,visible:e=>e.showTextAlign||e.showTextSpacing||e.showTextSizing,Component:CO},{key:`opacity`,visible:()=>!0,Component:wO},{key:`stats`,visible:e=>e.selectionCount>=1,Component:TO},{key:`layer`,visible:e=>e.showLayer,Component:EO},{key:`link`,visible:e=>e.link!==void 0&&!!e.onLink,Component:DO},{key:`align`,visible:e=>e.showAlign,Component:kO}];function jO(e){my(`PropertiesPanel`);let{kinds:t,iconsInk:n,iconLabeled:r,selectionCount:i,shapeKind:a,chart:o,control:s,figure:c}=e,{textSizing:l,onDelete:u,onDuplicate:d}=e,f=H(e=>e.deviceMode===`phone`),p=fa(),m=_D({kinds:t,iconsInk:n,iconLabeled:r,shapeKind:a,control:s,chart:o,textSizing:l,selectionCount:i,laneFrame:c?Mo(c.kind):!1}),h={...e,...m},g=AO.filter(e=>e.visible(h)).map(e=>({key:e.key,node:(0,Q.jsx)(e.Component,{...h})}));if(f){let e=g.filter(e=>!NO.has(e.key)),t=g.filter(e=>NO.has(e.key));return(0,Q.jsxs)(`div`,{className:`absolute bottom-[max(4.5rem,calc(env(safe-area-inset-bottom)+4rem))] left-2 flex items-center gap-0.5 rounded-xl p-1 ${tl}`,"data-overlay":!0,"data-caret-safe":!0,"data-testid":`properties-panel`,onPointerDown:e=>{e.stopPropagation(),p.onPointerDown()},onMouseDown:p.onMouseDown,onDoubleClick:e=>e.stopPropagation(),children:[e.length>0&&(0,Q.jsx)(PO,{label:`Style`,testId:`style`,icon:(0,Q.jsx)(Ta,{size:17,stroke:1.75}),groups:e}),t.length>0&&(0,Q.jsx)(PO,{label:`More options`,testId:`more-options`,icon:(0,Q.jsx)(R,{size:17,stroke:1.75}),groups:t}),(0,Q.jsx)(`div`,{className:Xc}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Duplicate`,"data-testid":`selection-duplicate`,onClick:d,className:rl(!1),children:(0,Q.jsx)(js,{size:16,stroke:1.75})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Delete`,"data-testid":`selection-delete`,onClick:u,className:rl(!1),children:(0,Q.jsx)(bs,{size:16,stroke:1.75})})]})}return(0,Q.jsx)(`div`,{className:`absolute bottom-4 left-1/2 flex max-w-[calc(100vw-1rem)] -translate-x-1/2 items-center gap-0.5 overflow-x-auto rounded-xl p-1 [&>*]:shrink-0 ${tl}`,"data-overlay":!0,"data-caret-safe":!0,"data-testid":`properties-panel`,onPointerDown:e=>{e.stopPropagation(),p.onPointerDown()},onMouseDown:p.onMouseDown,onDoubleClick:e=>e.stopPropagation(),children:g.map((e,t)=>(0,Q.jsxs)(J.Fragment,{children:[t>0&&(0,Q.jsx)(ha,{}),e.node]},e.key))})}var MO=(0,J.memo)(jO),NO=new Set([`align`,`layer`,`stats`,`link`]);function PO(e){let{label:t,testId:n,icon:r,groups:i}=e,a=fa();return(0,Q.jsxs)(mc,{onOpenChange:e=>{e||a.restore()},children:[(0,Q.jsx)(ca,{"aria-label":t,"data-testid":`${n}-open`,onPointerDown:a.onPointerDown,onMouseDown:a.onMouseDown,className:`${rl(!1)} data-[popup-open]:bg-[var(--chrome-hover)]`,children:r}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`top`,align:`start`,sideOffset:8,collisionPadding:8,children:(0,Q.jsx)(Tc,{"data-overlay":!0,"data-testid":`${n}-island`,"data-caret-safe":!0,...a.focusProps,onPointerDown:a.onPointerDown,onMouseDown:a.onMouseDown,className:`flex max-h-[60dvh] max-w-[min(92vw,420px)] flex-col gap-1.5 overflow-y-auto p-1.5 ${Wc.popup}`,children:i.map((e,t)=>(0,Q.jsxs)(J.Fragment,{children:[t>0&&(0,Q.jsx)(`div`,{className:`h-px shrink-0 bg-[var(--chrome-divider)]`}),(0,Q.jsx)(`div`,{className:`flex items-center gap-0.5 overflow-x-auto [&>*]:shrink-0`,children:e.node})]},e.key))})})})]})}var FO=18;function IO(e,t){let n=ns[t];return{id:e,label:n.label,shortcut:ls(t),icon:n.icon??Qo}}var LO=[IO(`select`,`select`),IO(`hand`,`hand`)],RO=[IO(`arrow`,`arrow`),IO(`line`,`line`),IO(`polyline`,`polyline`),IO(`polygon`,`polygon`)],zO=IO(`rectangle`,`rectangle`),BO=IO(`rectangle`,`ellipse`),VO=IO(`draw`,`draw`),HO=IO(`eraser`,`eraser`),UO=[IO(`text`,`text`),VO],WO=IO(`comment`,`comment`),GO=[IO(`image`,`image`),IO(`icon`,`icon`)],KO=[IO(`lasso`,`lasso`),IO(`laser`,`laser`),HO,{...IO(`highlight`,`highlight`),testid:`tool-highlight`},IO(`sticky`,`sticky`)];function qO(e){return ts.find(t=>t.value===e)?.icon??Zo}var JO=[{kind:`stepbadge`,label:ns.stepbadge.label,icon:ns.stepbadge.icon,shortcut:ls(`stepbadge`)},{kind:`entity`,label:`Class / entity`,icon:gc},{kind:`lifeline`,label:`Lifeline`,icon:_c},{kind:`fragment`,label:`Fragment`,icon:ds}];function YO(e){return`relative ${rl(e)}`}function XO(e){let{label:t,shortcut:n,children:r}=e;return(0,Q.jsx)(S,{label:t,shortcut:n,side:H(e=>e.deviceMode===`phone`)?`top`:`right`,sideOffset:10,children:r})}function ZO(e){let{tool:t,active:n,onSelect:r}=e,i=t.icon;return(0,Q.jsx)(XO,{label:t.label,shortcut:t.shortcut,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":t.label,"aria-pressed":n,onClick:r,className:YO(n),children:(0,Q.jsx)(i,{size:FO,stroke:1.75})})})}function QO(e){let{label:t,shortcut:n,active:r,icon:i,children:a}=e,[o,s]=(0,J.useState)(!1),c=H(e=>e.deviceMode===`phone`);return(0,Q.jsxs)(mc,{open:o,onOpenChange:s,children:[(0,Q.jsx)(XO,{label:t,shortcut:n,children:(0,Q.jsx)(ca,{render:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":t,"aria-pressed":r,className:r?YO(!0):`${YO(!1)} data-[popup-open]:bg-[var(--chrome-hover)]`,children:[i,(0,Q.jsx)(hc,{})]})})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:c?`top`:`right`,align:`start`,sideOffset:10,collisionPadding:8,children:(0,Q.jsx)(Tc,{"data-overlay":!0,className:`scrollbar-slim max-h-[var(--available-height)] overflow-y-auto p-1 ${Wc.popup}`,children:a(()=>s(!1))})})})]})}function $O(e){my(`Toolbar`);let{tool:t,shapeKind:n,chartKind:r,frameKind:i,onToolChange:a,onShapeKind:o,onChartKind:s,onFrameKind:c,onInsertControl:l,commentsAvailable:u,toolLock:d,onToggleToolLock:f}=e,p=U(),m=H(e=>e.deviceMode===`phone`),h=m?`flex flex-row gap-0.5`:`flex flex-col gap-0.5`,g=m?`mx-0.5 my-1.5 w-px shrink-0 self-stretch bg-[var(--chrome-divider)]`:el;function _(e){a(e)}function v(e){a(`rectangle`),o(e)}function y(e){a(`figure`),c(e)}function b(e){if(e===`table`){a(`table`);return}a(`chart`),s(e)}function C(e){return e===`table`?t===`table`:t===`chart`&&r===e}let w=t===`rectangle`&&Jo.includes(n),T=t===`chart`||t===`table`,E=qO(t===`table`?`table`:r),D=RO.find(e=>e.id===t),O=!!D,k=(D??RO[0]).icon,A=(is.find(e=>e.kind===i)??is[0]).icon,j=KO.find(e=>e.id===t),ee=t===`figure`||!!j,M=t===`figure`?A:j?.icon??gp,N=m&&t===`rectangle`&&n===`ellipse`,P=(0,Q.jsx)(QO,{label:`More shapes`,active:w||N,icon:w||N?(0,Q.jsx)(vc,{kind:n,size:FO}):(0,Q.jsx)(Lp,{size:FO,stroke:1.75}),children:e=>(0,Q.jsxs)(`div`,{className:`grid gap-1 ${m?`grid-cols-5`:`grid-cols-4`}`,children:[m&&(0,Q.jsx)(S,{label:`Ellipse`,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Ellipse`,onClick:()=>{v(`ellipse`),e()},className:rl(N),children:(0,Q.jsx)($o,{size:18,stroke:1.75})})}),Jo.map(r=>(0,Q.jsx)(S,{label:ss[r],side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":ss[r],onClick:()=>{v(r),e()},className:rl(t===`rectangle`&&n===r),children:(0,Q.jsx)(vc,{kind:r,size:18})})},r)),JO.map(t=>(0,Q.jsx)(S,{label:t.label,shortcut:t.shortcut,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":t.label,"data-testid":`control-tool-${t.kind}`,onClick:()=>{l(t.kind),e()},className:rl(!1),children:(0,Q.jsx)(t.icon,{size:18,stroke:1.75})})},t.kind))]})}),F=(0,Q.jsx)(QO,{label:`Connector`,active:O,icon:(0,Q.jsx)(k,{size:FO,stroke:1.75}),children:e=>(0,Q.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:RO.map(n=>(0,Q.jsx)(S,{label:n.label,shortcut:n.shortcut,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":n.label,onClick:()=>{_(n.id),e()},className:rl(t===n.id),children:(0,Q.jsx)(n.icon,{size:18,stroke:1.75})})},n.id))})}),I=LO.map(e=>(0,Q.jsx)(ZO,{tool:e,active:t===e.id,onSelect:()=>_(e.id)},e.id));return(0,Q.jsx)(x,{delay:0,children:(0,Q.jsx)(`div`,{className:m?`absolute inset-x-0 bottom-0 px-1 pb-[max(0.5rem,env(safe-area-inset-bottom))]`:`absolute left-4 top-[calc(3.5rem+var(--koboyo-host-inset-top))]`,"data-overlay":!0,"data-canvas-toolbar":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(`div`,{className:m?`flex flex-row items-center overflow-x-auto touch-pan-x rounded-xl p-0.5 ${tl}`:`flex max-h-[calc(100dvh-72px)] flex-col gap-0.5 overflow-y-auto ${$c}`,children:[m&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:h,children:I}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsxs)(`div`,{className:h,children:[(0,Q.jsx)(ZO,{tool:VO,active:t===`draw`,onSelect:()=>_(`draw`)}),(0,Q.jsx)(ZO,{tool:HO,active:t===`eraser`,onSelect:()=>_(`eraser`)})]}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsxs)(`div`,{className:h,children:[(0,Q.jsx)(ZO,{tool:zO,active:t===`rectangle`&&n===`rectangle`,onSelect:()=>v(`rectangle`)}),P,F]}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsx)(S,{label:`All tools`,shortcut:`/`,side:`top`,sideOffset:10,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`All tools`,"data-testid":`all-tools`,onClick:()=>p.getState().setToolDrawerOpen(!0),className:YO(!1),children:(0,Q.jsx)(gp,{size:FO,stroke:1.75})})})]}),!m&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:h,children:I}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsxs)(`div`,{className:h,children:[(0,Q.jsx)(ZO,{tool:zO,active:t===`rectangle`&&n===`rectangle`,onSelect:()=>v(`rectangle`)}),(0,Q.jsx)(ZO,{tool:BO,active:t===`rectangle`&&n===`ellipse`,onSelect:()=>v(`ellipse`)}),P]}),F,(0,Q.jsx)(`div`,{className:g}),(0,Q.jsx)(`div`,{className:h,children:UO.map(e=>(0,Q.jsx)(ZO,{tool:e,active:t===e.id,onSelect:()=>_(e.id)},e.id))}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsxs)(`div`,{className:h,children:[GO.map(e=>(0,Q.jsx)(ZO,{tool:e,active:t===e.id,onSelect:()=>_(e.id)},e.id)),(0,Q.jsx)(XO,{label:`Web embed`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Web embed`,"data-testid":`toolbar-web-embed`,onClick:()=>{_(`select`),p.getState().setWebEmbedDialog({mode:`insert`})},className:YO(!1),children:(0,Q.jsx)(Ko,{size:FO,stroke:1.75})})}),(0,Q.jsx)(QO,{label:`Table & charts`,shortcut:ls(`chart`),active:T,icon:(0,Q.jsx)(E,{size:FO,stroke:1.75}),children:e=>(0,Q.jsx)(`div`,{className:`grid grid-cols-3 gap-1`,children:ts.map(t=>(0,Q.jsx)(S,{label:t.label,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":t.label,onClick:()=>{b(t.value),e()},className:rl(C(t.value)),children:(0,Q.jsx)(t.icon,{size:18,stroke:1.75})})},t.value))})})]}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsx)(QO,{label:`More controls`,active:ee,icon:(0,Q.jsx)(M,{size:FO,stroke:1.75}),children:e=>(0,Q.jsxs)(`div`,{className:`w-52`,children:[(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-1.5 text-[11px] text-[var(--chrome-fg-400)]`,children:`Frames`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:is.map(n=>(0,Q.jsx)(S,{label:jo[n.kind],shortcut:n.kind===`simple`?ls(`figure`):void 0,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":jo[n.kind],onClick:()=>{y(n.kind),e()},className:rl(t===`figure`&&i===n.kind),children:(0,Q.jsx)(n.icon,{size:18,stroke:1.75})})},n.kind))}),(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] text-[var(--chrome-fg-400)]`,children:`Tools`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:KO.map(n=>(0,Q.jsx)(S,{label:n.label,shortcut:n.shortcut,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":n.label,"data-testid":n.testid,onClick:()=>{_(n.id),e()},className:rl(t===n.id),children:(0,Q.jsx)(n.icon,{size:18,stroke:1.75})})},n.id))}),(0,Q.jsx)(`div`,{className:`px-2 pb-1 pt-2 text-[11px] text-[var(--chrome-fg-400)]`,children:`Wireframe`}),(0,Q.jsx)(`div`,{className:`grid grid-cols-5 gap-1`,children:os.map(t=>(0,Q.jsx)(S,{label:t.label,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":t.label,"data-testid":`control-tool-${t.kind}`,onClick:()=>{l(t.kind),e()},className:rl(!1),children:(0,Q.jsx)(t.icon,{size:18,stroke:1.75})})},t.kind))})]})}),u&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`div`,{className:g}),(0,Q.jsx)(ZO,{tool:WO,active:t===`comment`,onSelect:()=>_(`comment`)})]}),(0,Q.jsx)(`div`,{className:g}),(0,Q.jsx)(S,{label:`Keep tool active`,shortcut:Z(`toolLock`),side:`right`,sideOffset:10,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Keep tool active`,"aria-pressed":d,onClick:f,className:YO(d),children:d?(0,Q.jsx)(yp,{size:FO,stroke:1.75}):(0,Q.jsx)(vp,{size:FO,stroke:1.75})})})]})]})})})}var ek=(0,J.memo)($O),tk=`.kby`,nk=`koboyo`,rk=`application/json`;function ik(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.format===nk&&Array.isArray(t.shapes)&&typeof t.viewport==`object`&&t.viewport!==null}function ak(e,t){let n={format:nk,version:_e,shapes:e.shapes,viewport:e.viewport},r=new Blob([JSON.stringify(n)],{type:rk}),i=URL.createObjectURL(r),a=window.document.createElement(`a`);a.href=i,a.download=`${ok(t)}${tk}`,a.rel=`noopener`,window.document.body.appendChild(a),a.click(),a.remove(),setTimeout(()=>URL.revokeObjectURL(i),1e3)}function ok(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)||`untitled`}var sk={excalidraw:`Excalidraw`,tldraw:`tldraw`};function ck(e){if(e.format===`koboyo`)return`Opened file`;let t=`Imported ${sk[e.format]} board`;if(e.skipped===0)return t;let n=e.skipped===1?`element`:`elements`;return`${t}. ${e.skipped} unsupported ${n} skipped.`}function lk(e){let t=e.format===`koboyo`?`Added the file`:`Added the ${sk[e.format]} board`;if(e.skipped===0)return`${t} next to your canvas`;let n=e.skipped===1?`element`:`elements`;return`${t} next to your canvas. ${e.skipped} unsupported ${n} skipped.`}function uk(e,t){if(e.length===0)throw Error(`That file has nothing we can import`);dk(e);let n=ge({version:_e,shapes:e});if(n.status!==`valid`)throw Error(t);return n.document.shapes}function dk(e){let t=ke(e.length,`open`);if(t?.kind===`block`)throw Error(t.message)}async function fk(e){let t;try{t=JSON.parse(await e.text())}catch{throw Error(`That file isn't a supported board file.`)}if(ik(t)){dk(t.shapes);let e=ge({version:t.version,shapes:t.shapes});if(e.status===`unsupported-version`)throw Error(`This board was saved by a newer version of Koboyo and can't be opened here.`);if(e.status===`invalid`)throw Error(`That board file is damaged and couldn't be opened.`);return{shapes:e.document.shapes,viewport:pe(t.viewport),format:`koboyo`,skipped:0}}let[{importExcalidraw:n,isExcalidrawData:r},{importTldraw:i,isTldrawData:a}]=await Promise.all([wi(()=>import(`./excalidraw-BwgRIDi9.js`),__vite__mapDeps([137,6,138])),wi(()=>import(`./tldraw-CE87oKyq.js`),__vite__mapDeps([139,6,138]))]);if(r(t)){let e=n(t);return{shapes:uk(e.shapes,`That Excalidraw file couldn't be imported.`),viewport:null,format:`excalidraw`,skipped:e.skipped}}if(a(t)){let e=i(t);return{shapes:uk(e.shapes,`That tldraw file couldn't be imported.`),viewport:null,format:`tldraw`,skipped:e.skipped}}throw Error(`That file isn't a supported board file.`)}function pk(e){let{pending:t,error:n,errorTestId:r,submitTestId:i,submitLabel:a,submitDisabled:o,cancelDisabled:s,leading:c}=e;return(0,Q.jsxs)(Q.Fragment,{children:[n&&(0,Q.jsx)(`p`,{"data-testid":r,className:gl.error,children:n}),(0,Q.jsxs)(`div`,{className:gl.actions,children:[c&&(0,Q.jsx)(`div`,{className:`mr-auto flex items-center`,children:c}),(0,Q.jsx)(dl,{className:gl.cancelButton,disabled:s,children:`Cancel`}),(0,Q.jsx)(`button`,{type:`submit`,"data-testid":i,disabled:t||o,className:gl.submitButton,children:t?`Saving…`:a})]})]})}var mk=`__new__`;function hk(e){let{open:t,onOpenChange:n,title:r,description:i,submitLabel:a,initialName:o,initialDescription:s,destination:c,onSubmit:l,onDelete:u}=e,[d,f]=(0,J.useState)(o??``),[p,m]=(0,J.useState)(s??``),[h,g]=(0,J.useState)(``),[_,v]=(0,J.useState)(``),{pending:y,error:b,run:x}=hl({open:t}),[S,C]=(0,J.useState)(!1),T=c!=null&&(c.workspaces.length===0||h===mk),E=(0,J.useRef)({initialName:o,initialDescription:s,destination:c});E.current={initialName:o,initialDescription:s,destination:c},(0,J.useEffect)(()=>{if(!t)return;C(!1);let e=E.current;if(f(e.initialName??``),m(e.initialDescription??``),e.destination){let t=e.destination.workspaces.filter(e=>!e.full),n=t.find(t=>t.id===e.destination?.initialWorkspaceId);g(n?.id??t[0]?.id??mk),v(``)}},[t]);let D=!T||_.trim().length>0;function O(){!u||y||x(()=>u(),{onSuccess:()=>n(!1),errorFor:e=>ml(e,`That didn't delete. Try again.`)})}function k(e){e.preventDefault();let t=d.trim();if(!t||y||!D)return;let r=c?T?{kind:`new`,workspaceName:_.trim()}:{kind:`existing`,workspaceId:h}:void 0;x(()=>l({name:t,description:p.trim()||null},r),{onSuccess:()=>n(!1),errorFor:e=>ml(e,`That didn't save. Check your connection and try again.`)})}return(0,Q.jsx)(ul,{open:t,onOpenChange:n,children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:Wc.dialogBackdrop}),(0,Q.jsxs)(ll,{"data-overlay":!0,"data-testid":`canvas-meta-dialog`,className:`w-[min(420px,92vw)] p-5 ${Wc.dialogPopup}`,children:[(0,Q.jsx)(fl,{className:gl.title,children:S?`Delete canvas?`:r}),!S&&(0,Q.jsx)(pl,{className:Gc(`mt-1`,gl.description),children:i}),S?(0,Q.jsxs)(`div`,{"data-testid":`canvas-meta-delete-confirm`,className:`mt-4 flex flex-col gap-3`,children:[(0,Q.jsxs)(`p`,{className:`text-[13px] leading-relaxed text-[var(--chrome-fg-700)]`,children:[`Move “`,o||`this canvas`,`” to the trash? Everyone in the workspace loses access, and you can restore it from Trash for 30 days.`]}),b&&(0,Q.jsx)(`p`,{"data-testid":`canvas-meta-error`,className:gl.error,children:b}),(0,Q.jsxs)(`div`,{className:gl.actions,children:[(0,Q.jsx)(`button`,{type:`button`,"data-testid":`canvas-meta-delete-back`,disabled:y,onClick:()=>C(!1),className:gl.cancelButton,children:`Back`}),(0,Q.jsx)(`button`,{type:`button`,"data-testid":`canvas-meta-delete-accept`,disabled:y,onClick:O,className:gl.dangerButton,children:y?`Deleting…`:`Move to trash`})]})]}):(0,Q.jsxs)(`form`,{className:`mt-4 flex flex-col gap-3`,onSubmit:k,children:[(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:gl.label,children:`Name`}),(0,Q.jsx)(`input`,{"data-testid":`canvas-meta-name`,className:gl.field,value:d,maxLength:120,placeholder:`Untitled canvas`,autoFocus:!0,onChange:e=>f(e.target.value)})]}),c&&c.workspaces.length>0&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:gl.label,children:`Workspace`}),(0,Q.jsxs)(`div`,{className:`relative`,children:[(0,Q.jsxs)(`select`,{"data-testid":`canvas-meta-workspace`,className:gl.select,value:h,onChange:e=>g(e.target.value),children:[c.workspaces.map(e=>(0,Q.jsx)(`option`,{value:e.id,disabled:e.full,children:e.full?`${e.name} (Full)`:e.name},e.id)),(0,Q.jsx)(`option`,{value:mk,children:`New workspace…`})]}),(0,Q.jsx)(w,{size:16,stroke:1.75,className:gl.selectChevron})]}),c.workspaces.some(e=>e.full)&&(0,Q.jsx)(`span`,{"data-testid":`canvas-meta-workspace-full-hint`,className:`text-[12px] leading-relaxed text-[var(--chrome-fg-400)]`,children:`A full workspace needs an upgrade or a free slot before it can take another canvas.`})]}),T&&(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:gl.label,children:c&&c.workspaces.length>0?`New workspace name`:`Save to a new workspace`}),(0,Q.jsx)(`input`,{"data-testid":`canvas-meta-workspace-name`,className:gl.field,value:_,maxLength:60,placeholder:`Acme, Design team, …`,onChange:e=>v(e.target.value)}),(0,Q.jsx)(`span`,{className:`text-[12px] leading-relaxed text-[var(--chrome-fg-400)]`,children:`Name it after the people who'll work in it. You can invite them later.`})]}),(0,Q.jsxs)(`label`,{className:`flex flex-col gap-1.5`,children:[(0,Q.jsx)(`span`,{className:gl.label,children:`Description`}),(0,Q.jsx)(`textarea`,{"data-testid":`canvas-meta-description`,className:`${gl.field} min-h-[64px] resize-none`,value:p,maxLength:500,placeholder:`What is this canvas about? (optional)`,rows:3,onChange:e=>m(e.target.value)})]}),(0,Q.jsx)(pk,{pending:y,error:b,errorTestId:`canvas-meta-error`,submitTestId:`canvas-meta-submit`,submitLabel:a,submitDisabled:d.trim().length===0||!D,leading:u?(0,Q.jsx)(`button`,{type:`button`,"data-testid":`canvas-meta-delete`,disabled:y,onClick:()=>C(!0),className:gl.dangerTextButton,children:`Delete canvas`}):void 0})]})]})]})})}var gk=`${tk},.excalidraw,.tldr,application/json`,_k=`.excalidraw,.tldr,application/json`;function vk(e,t){return(e?.trim()||t).charAt(0).toUpperCase()}function yk(e){let{onLoadDocument:t,ref:n}=e,r=re(),{notify:i}=_(),a=B(),o=U(),s=H(e=>e.shapes.length===0),c=ve(e=>[e.shapes],e=>Zr(e).some(bk)),l=H(e=>e.setExportDialog),u=Ms(),d=H(e=>e.setTheme),f=H(e=>e.zenMode),p=H(e=>e.setZenMode),m=H(e=>e.viewMode),h=H(e=>e.setViewMode),g=H(e=>e.viewModeLocked),v=(0,J.useRef)(null),[y,b]=(0,J.useState)(null),[x,S]=(0,J.useState)(!1),C=r.state.status===`authenticated`?r.state.user:null,w=C!=null&&a.onNewCanvas!=null;function T(e){let t=v.current;t&&(t.accept=e,t.click())}function E(e){if(s){T(e);return}b(e)}(0,J.useImperativeHandle)(n,()=>({openFile:()=>{a.embed||E(gk)}}));async function D(e){try{let n=await fk(e);if(t(n)!==`loaded`)return;i(ck(n))}catch(e){i(e instanceof Error?e.message:`Couldn't open that file`)}}function O(){let{shapes:e,viewport:t}=o.getState();ak({shapes:e,viewport:t},`untitled`),i(`Saved ${tk} file`)}return(0,Q.jsxs)(`div`,{className:`absolute left-4 top-[var(--chrome-top)]`,"data-overlay":!0,"data-testid":`main-menu`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(`input`,{ref:v,type:`file`,accept:gk,className:`hidden`,onChange:e=>{let t=e.target.files?.[0];t&&D(t),e.target.value=``}}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":C?`Menu & account`:`Menu`,"data-testid":`main-menu-button`,className:`flex h-8 w-10 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:text-[var(--chrome-fg-900)] data-[popup-open]:text-[var(--chrome-fg-900)] coarse:h-11 coarse:w-12 ${tl}`,children:C?C.avatarUrl?(0,Q.jsx)(`img`,{src:C.avatarUrl,alt:``,referrerPolicy:`no-referrer`,"data-testid":`main-menu-avatar`,className:`h-6 w-6 rounded-full object-cover`}):(0,Q.jsx)(`span`,{"data-testid":`main-menu-avatar`,className:`flex h-6 w-6 items-center justify-center rounded-full bg-[var(--chrome-active)] text-[11px] text-[var(--chrome-fg-700)]`,children:vk(C.name,C.email)}):(0,Q.jsx)(rs,{size:17,stroke:1.75})})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`start`,sideOffset:8,className:`outline-none`,children:(0,Q.jsxs)(te,{"data-overlay":!0,"data-testid":`main-menu-popup`,className:Sk,children:[C&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`div`,{className:`flex flex-col px-2 py-1.5`,children:[C.name&&(0,Q.jsx)(`span`,{className:`truncate text-[13px] text-[var(--chrome-fg-800)]`,children:C.name}),(0,Q.jsx)(`span`,{className:`truncate text-[12px] text-[var(--chrome-fg-500)]`,children:C.email})]}),(0,Q.jsx)(N,{})]}),(w||C&&a.onShowCanvases)&&(0,Q.jsxs)(Q.Fragment,{children:[w&&(0,Q.jsx)(L,{testId:`menu-new-canvas`,icon:(0,Q.jsx)(ic,{size:16,stroke:1.75}),onClick:()=>S(!0),children:`New canvas…`}),C&&a.onShowCanvases&&(0,Q.jsx)(L,{testId:`menu-my-canvases`,icon:(0,Q.jsx)(Bs,{size:16,stroke:1.75}),onClick:a.onShowCanvases,children:`My canvases`}),(0,Q.jsx)(N,{})]}),a.embed?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{testId:`menu-open-in-app`,icon:(0,Q.jsx)(Ws,{size:16,stroke:1.75}),onClick:a.embed.openInApp.run,children:a.embed.openInApp.label}),(0,Q.jsx)(N,{})]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{testId:`menu-open`,icon:(0,Q.jsx)(ep,{size:16,stroke:1.75}),onClick:()=>E(gk),disabled:m,children:`Open…`}),(0,Q.jsx)(L,{testId:`menu-import`,icon:(0,Q.jsx)(Qf,{size:16,stroke:1.75}),onClick:()=>E(_k),disabled:m,children:`Import…`}),(0,Q.jsx)(L,{testId:`menu-save`,icon:(0,Q.jsx)(Vs,{size:16,stroke:1.75}),onClick:O,disabled:s,children:`Save`}),(0,Q.jsx)(N,{}),(0,Q.jsxs)(Ck,{testId:`menu-export`,icon:(0,Q.jsx)(Zf,{size:16,stroke:1.75}),label:`Export`,children:[(0,Q.jsx)(L,{testId:`menu-export-png`,icon:(0,Q.jsx)(Fs,{size:16,stroke:1.75}),onClick:()=>l({format:`png`}),disabled:s,children:`PNG image…`}),(0,Q.jsx)(L,{testId:`menu-export-svg`,icon:(0,Q.jsx)(Ns,{size:16,stroke:1.75}),onClick:()=>l({format:`svg`}),disabled:s,children:`SVG image…`}),(0,Q.jsx)(L,{testId:`menu-export-pdf`,icon:(0,Q.jsx)(ks,{size:16,stroke:1.75}),onClick:()=>l({format:`pdf`}),disabled:!c,children:`Slides as PDF…`})]})]}),(0,Q.jsxs)(Ck,{testId:`menu-view`,icon:(0,Q.jsx)(Wo,{size:16,stroke:1.75}),label:`View`,children:[(0,Q.jsxs)(yy,{className:Wc.menuItem,"data-testid":`menu-dark-mode`,closeOnClick:!1,checked:u===`dark`,onCheckedChange:e=>d(e?`dark`:`light`),children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-600)]`,children:(0,Q.jsx)(Dp,{size:16,stroke:1.75})}),(0,Q.jsx)(`span`,{children:`Dark mode`}),(0,Q.jsx)(by,{className:`ml-auto`,children:(0,Q.jsx)(Ts,{size:15,stroke:2})})]}),(0,Q.jsxs)(yy,{className:Wc.menuItem,"data-testid":`menu-zen-mode`,closeOnClick:!0,checked:f,onCheckedChange:e=>p(e),children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-600)]`,children:(0,Q.jsx)(As,{size:16,stroke:1.75})}),(0,Q.jsx)(`span`,{children:`Zen mode`}),(0,Q.jsx)(by,{className:`ml-auto`,children:(0,Q.jsx)(Ts,{size:15,stroke:2})})]}),(0,Q.jsxs)(yy,{className:Wc.menuItem,"data-testid":`menu-view-mode`,closeOnClick:!0,disabled:g,checked:m,onCheckedChange:e=>h(e),children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-600)]`,children:(0,Q.jsx)(zs,{size:16,stroke:1.75})}),(0,Q.jsx)(`span`,{children:`View only`}),(0,Q.jsx)(by,{className:`ml-auto`,children:(0,Q.jsx)(Ts,{size:15,stroke:2})})]})]}),C&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsx)(L,{testId:`account-logout`,icon:(0,Q.jsx)(xp,{size:16,stroke:1.75}),onClick:()=>{r.logout().catch(e=>{i(e instanceof Error&&e.message?e.message:`Couldn't log out. Try again.`)})},children:`Log out`})]})]})})})]}),w&&a.onNewCanvas&&(0,Q.jsx)(hk,{open:x,onOpenChange:S,title:`New canvas`,description:`Name the canvas you're about to start, and choose where it lives.`,submitLabel:`Create`,destination:a.saveDestination,onSubmit:a.onNewCanvas}),(0,Q.jsx)(Mb,{open:y!==null,onOpenChange:e=>{e||b(null)},children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:Wc.dialogBackdrop}),(0,Q.jsxs)(ll,{"data-overlay":!0,"data-testid":`open-confirm`,className:`w-[min(400px,92vw)] p-5 ${Wc.dialogPopup}`,children:[(0,Q.jsx)(fl,{className:`text-[15px] text-[var(--chrome-fg-900)]`,children:`Open a file?`}),(0,Q.jsxs)(pl,{className:`mt-2 text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:[`Opening a file replaces everything currently on the canvas. This can be undone with`,` `,Ec(Z(`undo`)),`.`]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(dl,{className:`h-8 rounded-full px-3.5 text-[13px] text-[var(--chrome-fg-600)] outline-none transition-colors hover:bg-[var(--chrome-divider)]`,children:`Cancel`}),(0,Q.jsx)(dl,{"data-testid":`open-confirm-accept`,onClick:()=>{y&&T(y)},className:`h-8 rounded-full bg-[var(--chrome-accent)] px-3.5 text-[13px] text-white outline-none transition-colors hover:bg-[var(--chrome-accent-hover)]`,children:`Open file`})]})]})]})})]})}function bk(e){return e.type===`figure`&&e.slideOrder!==void 0&&!e.slideSkipped}var xk=(0,J.memo)(yk),Sk=`min-w-[180px] p-1 outline-none ${Wc.popup}`;function Ck(e){let{testId:t,icon:n,label:r,children:i}=e;return(0,Q.jsxs)(ac,{children:[(0,Q.jsxs)(sc,{className:Wc.menuItem,"data-testid":t,children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:n}),(0,Q.jsx)(`span`,{children:r}),(0,Q.jsx)(Es,{size:14,stroke:1.75,className:`ml-auto text-[var(--chrome-fg-400)]`})]}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,className:Sk,children:i})})})]})}function wk(e){return typeof e==`object`&&!!e&&e.code===`canvas_limit`}var Tk=Zs(Xs.monthly.amountCents,`usd`);function Ek(e){return new Date(`${Ys}T00:00:00Z`).toLocaleDateString(`en-US`,{month:e,day:`numeric`,timeZone:`UTC`})}function Dk(e){let{boardName:t}=e,n=re(),r=U(),{notify:i}=_(),[a,o]=(0,J.useState)(!1);return n.state.status!==`authenticated`||n.state.user.requiresPlan||n.state.usage?.plan!==`free`||Date.now()>=Qs?null:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`free-plan-notice`,onClick:()=>o(!0),className:`${Qc} bg-[var(--cta-save-bg)] text-[var(--cta-save-fg)] ring-[var(--cta-save-ring)] hover:bg-[var(--cta-save-bg-hover)]`,children:[(0,Q.jsx)(qf,{size:16,stroke:1.75}),(0,Q.jsx)(`span`,{className:`whitespace-nowrap`,children:`Free plan ends ${Ek(`short`)}`})]}),(0,Q.jsx)(ul,{open:a,onOpenChange:o,children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:Wc.dialogBackdrop}),(0,Q.jsxs)(ll,{"data-overlay":!0,"data-testid":`free-plan-dialog`,className:`flex w-[min(420px,92vw)] flex-col gap-6 p-8 ${Wc.dialogPopup}`,children:[(0,Q.jsx)(dl,{"aria-label":`Close`,className:`absolute right-3 top-3 flex h-7 w-7 items-center justify-center rounded-md text-[var(--chrome-fg-400)] outline-none transition-colors hover:bg-[var(--chrome-divider)] hover:text-[var(--chrome-fg-600)]`,children:(0,Q.jsx)(uc,{size:16,stroke:1.75})}),(0,Q.jsx)(`span`,{className:`flex h-10 w-10 items-center justify-center rounded-xl bg-[var(--cta-save-bg)] text-[var(--cta-save-fg)]`,children:(0,Q.jsx)(qf,{size:20,stroke:1.75})}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsx)(fl,{className:`text-[20px] leading-tight text-[var(--chrome-fg-900)]`,children:`Your free plan ends on ${Ek(`long`)}`}),(0,Q.jsx)(pl,{className:`text-[13.5px] leading-relaxed text-[var(--chrome-fg-500)]`,children:`On that day this account is turned off. Download your board first to keep it. You can still draw on Koboyo without signing in, and open your file there.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`free-plan-download`,onClick:()=>{let{shapes:e,viewport:n}=r.getState();ak({shapes:e,viewport:n},t),i(`Saved ${tk} file`)},className:`flex h-11 cursor-pointer items-center justify-center gap-2 rounded-lg bg-[var(--chrome-accent)] px-4 text-[14px] text-white outline-none transition-colors hover:bg-[var(--chrome-accent-hover)]`,children:[(0,Q.jsx)(Vs,{size:16,stroke:1.75}),`Download board`]}),(0,Q.jsx)(`a`,{href:`/start`,className:`flex h-11 items-center justify-center rounded-lg bg-[var(--chrome-popup)] px-4 text-[14px] text-[var(--chrome-fg-800)] outline-none ring-1 ring-[var(--chrome-input)] transition-colors hover:bg-[var(--chrome-hover)]`,children:`Keep it with Pro`})]}),(0,Q.jsx)(`p`,{className:`text-[11.5px] leading-relaxed text-[var(--chrome-fg-400)]`,children:`Pro is free for 14 days, then ${Tk} a month. Cancel any time.`})]})]})})]})}var Ok=Wc.menuItem,kk=`${Ok} text-red-600 data-[highlighted]:bg-red-50`,Ak=`max-h-[min(420px,70vh)] min-w-[200px] max-w-[300px] overflow-y-auto p-1 outline-none ${Wc.popup}`,jk=`shrink-0 text-[var(--chrome-fg-400)]`,Mk=`flex h-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-2 outline-none transition-colors hover:bg-[var(--chrome-hover)] data-[popup-open]:bg-[var(--chrome-hover)]`,Nk=`px-2 py-1.5 text-[12px] text-[var(--chrome-fg-400)]`,Pk=2;function Fk(e,t){let[n,r]=(0,J.useState)({status:`loading`}),i=e.listLevel;return(0,J.useEffect)(()=>{let e=!1;return r({status:`loading`}),i(t).then(t=>{e||r({status:`ready`,...t})},()=>{e||r({status:`error`})}),()=>{e=!0}},[i,t]),n}function Ik(e,t){return n=>{n.metaKey||n.ctrlKey||n.shiftKey||n.button!==0||(n.preventDefault(),e.navigate(t))}}function Lk(e){let t=e.location,n=e.folderId,r=Fk(t,n),i=t.folderHref(n);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(P,{className:Ok,"data-testid":`location-open-level`,render:(0,Q.jsx)(`a`,{href:i}),onClick:Ik(t,i),children:[(0,Q.jsx)(Cs,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.openLabel})]}),(0,Q.jsx)(N,{}),r.status===`loading`&&(0,Q.jsx)(`div`,{className:Nk,children:`Loading…`}),r.status===`error`&&(0,Q.jsx)(`div`,{className:Nk,children:`Couldn't load this folder.`}),r.status===`ready`&&r.entries.length===0&&(0,Q.jsx)(`div`,{className:Nk,children:`Nothing here yet.`}),r.status===`ready`&&r.entries.map(e=>e.kind===`folder`?(0,Q.jsx)(Rk,{location:t,entry:e},`folder:${e.id}`):(0,Q.jsx)(zk,{location:t,entry:e},`canvas:${e.id}`)),r.status===`ready`&&r.more&&(0,Q.jsx)(P,{className:Ok,render:(0,Q.jsx)(`a`,{href:i}),onClick:Ik(t,i),children:(0,Q.jsx)(`span`,{className:`pl-[23px] text-[var(--chrome-fg-500)]`,children:`Show all…`})})]})}function Rk(e){let t=e.location,n=e.entry;return(0,Q.jsxs)(ac,{children:[(0,Q.jsxs)(sc,{className:Ok,"data-testid":`location-folder-entry`,children:[(0,Q.jsx)(Js,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:n.name}),(0,Q.jsx)(Es,{size:14,stroke:1.75,className:jk})]}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`z-50 outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,className:Ak,children:(0,Q.jsx)(Lk,{location:t,folderId:n.id,openLabel:`Open ${n.name}`})})})})]})}function zk(e){let t=e.location,n=e.entry;if(n.id===t.canvasId)return(0,Q.jsxs)(P,{className:Ok,"data-testid":`location-current-canvas`,children:[(0,Q.jsx)(Ts,{size:15,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-700)]`}),(0,Q.jsx)(`span`,{className:`truncate font-medium text-[var(--chrome-fg-900)]`,children:n.name})]});let r=t.canvasHref(n.id);return(0,Q.jsxs)(P,{className:Ok,"data-testid":`location-canvas-entry`,render:(0,Q.jsx)(`a`,{href:r}),onClick:Ik(t,r),children:[(0,Q.jsx)(Vp,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{className:`truncate`,children:n.name})]})}function Bk(){let{notify:e}=_();return t=>{let n=new URL(t,window.location.origin).href;navigator.clipboard.writeText(n).then(()=>e(`Link copied`),()=>e(`Couldn't copy the link.`))}}function Vk(e){let t=e.href,n=Bk();return(0,Q.jsxs)(Ps,{children:[(0,Q.jsx)(Rs,{render:(0,Q.jsx)(`div`,{className:`flex h-full min-w-0`}),children:e.children}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`z-50 outline-none`,children:(0,Q.jsxs)(te,{"data-overlay":!0,"data-testid":e.testId,className:Ak,children:[(0,Q.jsxs)(P,{className:Ok,onClick:()=>window.open(t,`_blank`,`noopener`),children:[(0,Q.jsx)(Ws,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{children:`Open in new tab`})]}),(0,Q.jsxs)(P,{className:Ok,onClick:()=>n(t),children:[(0,Q.jsx)($s,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{children:`Copy link`})]})]})})})]})}function Hk(e){let t=e.location,n=e.folderId,r=e.label;return(0,Q.jsx)(Vk,{href:t.folderHref(n),testId:`${e.testId}-context`,children:(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{"data-testid":e.testId,className:`${Mk} text-[var(--chrome-fg-600)] hover:text-[var(--chrome-fg-900)]`,children:(0,Q.jsx)(`span`,{className:`max-w-[140px] truncate`,children:r})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`start`,sideOffset:8,className:`z-50 outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,"data-testid":`${e.testId}-menu`,className:Ak,children:(0,Q.jsx)(Lk,{location:t,folderId:n,openLabel:`Open ${r}`})})})})]})})}function Uk(e){let t=e.location;return(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{"aria-label":`Show full path`,"data-testid":`location-collapsed`,className:`${Mk} text-[var(--chrome-fg-600)] hover:text-[var(--chrome-fg-900)]`,children:`…`}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`start`,sideOffset:8,className:`z-50 outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,className:Ak,children:e.folders.map((e,n)=>{let r=t.folderHref(e.id);return(0,Q.jsxs)(P,{className:Ok,render:(0,Q.jsx)(`a`,{href:r}),onClick:Ik(t,r),style:{paddingLeft:`${8+n*12}px`},children:[(0,Q.jsx)(Js,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.name})]},e.id)})})})})]})}function Wk(){return(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`hidden select-none px-0.5 text-[12px] text-[var(--chrome-fg-400)] sm:block`,children:`/`})}function Gk(e){let t=e.location,n=t.folderPath,r=n[n.length-1],i=n.length>Pk?n.slice(0,-1):[],a=i.length>0?n.slice(-1):n;return(0,Q.jsxs)(Q.Fragment,{children:[e.onBack&&(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Back to ${r?.name??e.workspaceName}`,"data-testid":`canvas-back-button`,onClick:e.onBack,className:`flex h-full w-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] coarse:w-10`,children:(0,Q.jsx)(xs,{size:16,stroke:1.75})}),(0,Q.jsxs)(`div`,{className:`hidden h-full min-w-0 items-center sm:flex`,children:[(0,Q.jsx)(Hk,{location:t,folderId:null,label:e.workspaceName,testId:`location-workspace`}),i.length>0&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Wk,{}),(0,Q.jsx)(Uk,{location:t,folders:i})]}),a.map(e=>(0,Q.jsxs)(`div`,{className:`flex h-full min-w-0 items-center`,children:[(0,Q.jsx)(Wk,{}),(0,Q.jsx)(Hk,{location:t,folderId:e.id,label:e.name,testId:`location-folder`})]},e.id)),(0,Q.jsx)(Wk,{})]})]})}function Kk(e){let t=e.actions,n=e.Item;function r(t,r,i,a){return(0,Q.jsxs)(n,{className:Ok,"data-testid":`${e.prefix}-${t}`,onClick:a,children:[(0,Q.jsx)(`span`,{className:jk,children:r}),(0,Q.jsx)(`span`,{children:i})]})}return(0,Q.jsxs)(Q.Fragment,{children:[t.onRename&&r(`rename`,(0,Q.jsx)(nc,{size:15,stroke:1.75}),`Rename…`,t.onRename),t.onDuplicate&&r(`duplicate`,(0,Q.jsx)(js,{size:15,stroke:1.75}),`Duplicate`,t.onDuplicate),t.onMove&&r(`move`,(0,Q.jsx)(tp,{size:15,stroke:1.75}),`Move to folder…`,t.onMove),t.onShare&&r(`share`,(0,Q.jsx)(Np,{size:15,stroke:1.75}),`Share…`,t.onShare),r(`copy-link`,(0,Q.jsx)($s,{size:15,stroke:1.75}),`Copy link`,t.onCopyLink),t.onDelete&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(N,{}),(0,Q.jsxs)(n,{className:kk,"data-testid":`${e.prefix}-delete`,onClick:t.onDelete,children:[(0,Q.jsx)(bs,{size:15,stroke:1.75,className:`shrink-0 text-red-400`}),(0,Q.jsx)(`span`,{children:`Move to trash`})]})]})]})}function qk(e){let t=e.name,n=e.onDuplicate,r=e.onDelete,{notify:i}=_(),a=Bk(),[o,s]=(0,J.useState)(!1),c={onRename:e.onRename,onDuplicate:n?()=>{n().catch(()=>i(`Couldn't duplicate “${t}”. Try again.`))}:void 0,onMove:e.onMove,onShare:e.onShare,onCopyLink:()=>a(window.location.pathname),onDelete:r?()=>s(!0):void 0};return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(Ps,{children:[(0,Q.jsx)(Rs,{render:(0,Q.jsx)(`div`,{className:`flex h-full min-w-0`}),children:(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(I,{"data-testid":`canvas-meta-button`,className:`${Mk} text-[var(--chrome-fg-900)]`,children:[(0,Q.jsx)(`span`,{className:`max-w-[260px] truncate`,children:t}),(0,Q.jsx)(w,{size:14,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-500)]`})]}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`start`,sideOffset:8,className:`z-50 outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,"data-testid":`canvas-title-menu`,className:Ak,children:(0,Q.jsx)(Kk,{actions:c,prefix:`canvas-title`,Item:P})})})})]})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{className:`z-50 outline-none`,children:(0,Q.jsx)(te,{"data-overlay":!0,"data-testid":`canvas-title-context`,className:Ak,children:(0,Q.jsx)(Kk,{actions:c,prefix:`canvas-title-ctx`,Item:P})})})})]}),r&&(0,Q.jsx)(Pb,{open:o,onOpenChange:s,title:`Move “${t}” to the trash?`,description:`You can restore it from the trash later.`,confirmLabel:`Move to trash`,destructive:!0,onConfirm:r,testId:`canvas-title-delete-confirm`})]})}function Jk(e){let t=e.hasShapes;return(0,Q.jsxs)(k,{children:[(0,Q.jsxs)(I,{"data-testid":`scratch-title-button`,className:`${Mk} text-[var(--chrome-fg-900)]`,children:[(0,Q.jsx)(`span`,{children:`Scratch`}),(0,Q.jsx)(w,{size:14,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-500)]`})]}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`start`,sideOffset:8,className:`z-50 outline-none`,children:(0,Q.jsxs)(te,{"data-overlay":!0,"data-testid":`scratch-title-menu`,className:Ak,children:[(0,Q.jsxs)(P,{className:Ok,"data-testid":`scratch-save`,disabled:!t,onClick:e.onSave,children:[(0,Q.jsx)(Ss,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{children:`Save to workspace…`})]}),(0,Q.jsxs)(P,{className:Ok,"data-testid":`scratch-download`,disabled:!t,onClick:e.onDownload,children:[(0,Q.jsx)(Vs,{size:15,stroke:1.75,className:jk}),(0,Q.jsx)(`span`,{children:`Download a copy`})]}),(0,Q.jsx)(N,{}),(0,Q.jsxs)(P,{className:kk,"data-testid":`scratch-clear`,disabled:!t,onClick:e.onClear,children:[(0,Q.jsx)(Us,{size:15,stroke:1.75,className:`shrink-0 text-red-400`}),(0,Q.jsx)(`span`,{children:`Clear canvas`})]})]})})})]})}var Yk=4;function Xk(){let e=B(),t=V(),n=H(e=>[...e.lastPeerPointers.keys()].sort().join(`\0`)),r=e.presence??[];if(r.length===0)return null;let i=new Set(n.split(`\0`)),a=e=>{let{lastPeerPointers:n,viewport:r,setViewport:i}=t.store.getState(),a=n.get(e),o=t.measurementRoot.current;!a||!(o instanceof HTMLElement)||t.viewportAnimation.animate(r,{...r,x:o.clientWidth/2-a.x*r.zoom,y:o.clientHeight/2-a.y*r.zoom},i)},o=r.slice(0,Yk),s=r.length-o.length;return(0,Q.jsxs)(`div`,{className:`flex items-center -space-x-1.5`,"data-testid":`presence-avatars`,children:[o.map(e=>{let t=i.has(e.id);return(0,Q.jsx)(S,{label:t?`Go to ${e.name}`:`${e.name} isn't pointing at the canvas`,side:`bottom`,children:(0,Q.jsx)(`button`,{type:`button`,"data-testid":`presence-avatar`,"aria-label":`${e.name} is on this canvas`,"aria-disabled":!t,onClick:()=>a(e.id),className:`flex h-6 w-6 select-none items-center justify-center rounded-full text-[11px] font-medium text-white ring-2 ring-[var(--chrome-surface)] ${t?`cursor-pointer transition-transform hover:z-10 hover:scale-110`:`cursor-default`}`,style:{backgroundColor:e.color},children:(e.name[0]??`?`).toUpperCase()})},e.id)}),s>0&&(0,Q.jsxs)(`span`,{className:`flex h-6 min-w-6 select-none items-center justify-center rounded-full bg-[var(--chrome-hover)] px-1 text-[11px] text-[var(--chrome-fg-600)] ring-2 ring-[var(--chrome-surface)]`,children:[`+`,s]})]})}var Zk={retrying:`Not saved, retrying`,"auth-required":`Sign in to save`,"storage-error":`Not saved on this device`,error:`Not saved`,"too-large":`Too large to save`,conflict:`Saving stopped`,rejected:`Can't be saved`};function Qk(e){let t=e.label,n=e.onClick,r=e.icon;return(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`account-save-button`,onClick:n,className:`${Qc} bg-[var(--cta-save-bg)] text-[var(--cta-save-fg)] ring-[var(--cta-save-ring)] hover:bg-[var(--cta-save-bg-hover)]`,children:[r===`login`&&(0,Q.jsx)(bp,{size:16,stroke:1.75}),!r&&(0,Q.jsx)(Ss,{size:16,stroke:1.75}),(0,Q.jsx)(`span`,{children:$k(t)})]})}function $k(e){let t=e.split(` / `);return t.length===1?e:t.map((e,t)=>(0,Q.jsxs)(J.Fragment,{children:[t>0&&(0,Q.jsx)(`span`,{className:`mx-1 opacity-40`,children:`/`}),e]},e))}function eA(e){let{owner:t}=e,n=t?.name?.trim()??``,r=n?`Created by ${n}`:`Author unknown`;return(0,Q.jsx)(`span`,{"data-testid":`share-owner-avatar`,title:r,"aria-label":r,className:`flex h-full shrink-0 items-center pl-[3px] pr-1`,children:t?.avatarUrl?(0,Q.jsx)(`img`,{src:t.avatarUrl,alt:``,referrerPolicy:`no-referrer`,"data-testid":`share-owner-photo`,className:`h-[22px] w-[22px] rounded-full object-cover`}):(0,Q.jsx)(`span`,{className:`flex h-[22px] w-[22px] items-center justify-center rounded-full bg-[var(--chrome-active)] text-[11px] text-[var(--chrome-fg-700)]`,children:n?n[0]?.toUpperCase():(0,Q.jsx)(zp,{size:13,stroke:1.75})})})}function tA(){my(`AccountButton`);let e=re(),t=B(),n=e.state.status===`authenticated`?e.state.user:null,r=e.state.status===`authenticated`?e.state.usage:void 0,[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(!1),u=U(),{notify:d}=_(),f=H(e=>e.shapes.length>0),p=(0,J.useCallback)(()=>{let e=u.getState();e.loadShapes([]),e.setSelectedIds(new Set),e.endEdit(),e.setLockRevealId(null),d(`Canvas cleared. ${Ec(Z(`undo`))} brings it back.`)},[u,d]),m=(0,J.useCallback)(()=>{let{shapes:e,viewport:t}=u.getState();ak({shapes:e,viewport:t},`scratch`),d(`Saved ${tk} file`)},[u,d]),[h,g]=(0,J.useState)(!1),v=(0,J.useRef)(!1),y=(0,J.useRef)(!1),b=(0,J.useRef)(!1),x=t.onSaveDismissed,S=(0,J.useCallback)(()=>{b.current||(b.current=!0,x?.())},[x]);(0,J.useEffect)(()=>{n&&(a(null),i!==null&&!t.canvasMeta&&t.onSaveCanvas&&g(!0))},[n,i,t.canvasMeta,t.onSaveCanvas]),(0,J.useEffect)(()=>{if(!n){g(!1);return}let e=t.autoSavePrompt===!0&&!v.current&&!t.canvasMeta&&t.onSaveCanvas!=null;if(!(!h&&!e)){if(t.documentEmpty===!0){v.current=!0,h&&S();return}t.saveAtLimit!=null&&(g(!1),v.current=!0,t.saveAtLimit?l(!0):s(!0))}},[h,n,t.documentEmpty,S,t.saveAtLimit,t.autoSavePrompt,t.canvasMeta,t.onSaveCanvas]);let C=(0,J.useRef)(!1);if((0,J.useEffect)(()=>{if(!(t.autoSavePrompt!==!0||y.current||b.current)){if(o||c){C.current=!0;return}C.current&&S()}},[t.autoSavePrompt,o,c,S]),e.state.status===`disabled`&&!t.publicShare||e.state.status===`loading`)return null;let w=t.publicShare?t.canvasMeta??null:n?t.canvasMeta:null,T=t.onSaveCanvas,E=n!=null&&!w&&T!=null,D=w!=null&&t.onEditCanvasMeta!=null,O=qs[r?.plan??`free`],k=w!=null&&t.readOnly!==!0&&t.onOpenShare!=null,A=t.onShowCanvases!=null&&(n!=null||t.canvasMeta!=null);return n&&!E&&!w?null:(0,Q.jsxs)(`div`,{className:`absolute top-[var(--chrome-top)] flex items-center gap-2 ${t.publicShare?`left-4`:`left-16 coarse:left-[4.5rem]`}`,"data-overlay":!0,"data-testid":`account-button`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[t.scratch&&(0,Q.jsxs)(`div`,{className:`flex h-8 items-center rounded-lg p-[3px] text-[13px] coarse:h-11 ${tl}`,children:[A&&t.onShowCanvases&&(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Back to your canvases`,"data-testid":`canvas-back-button`,onClick:t.onShowCanvases,className:`flex h-full w-7 shrink-0 cursor-pointer items-center justify-center rounded-md text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] coarse:w-10`,children:(0,Q.jsx)(xs,{size:16,stroke:1.75})}),(0,Q.jsx)(Jk,{hasShapes:f,onSave:()=>{if(!n){a(`save`);return}if(t.saveAtLimit){l(!0);return}s(!0)},onDownload:m,onClear:p})]}),!w&&!t.scratch&&A&&t.onShowCanvases&&(0,Q.jsxs)(`button`,{type:`button`,"aria-label":t.workspaceName?`Back to ${t.workspaceName}`:`Back to your canvases`,"data-testid":`canvas-back-button`,onClick:t.onShowCanvases,className:`flex h-8 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] coarse:h-11 ${t.workspaceName?`gap-1.5 px-2 coarse:px-3`:`w-8 coarse:w-11`} ${tl}`,children:[(0,Q.jsx)(xs,{size:16,stroke:1.75,className:`shrink-0`}),t.workspaceName&&(0,Q.jsx)(`span`,{className:`hidden max-w-[140px] truncate text-[13px] sm:block`,children:t.workspaceName})]}),!n&&!t.publicShare&&(0,Q.jsx)(Qk,{icon:`login`,label:t.canvasMeta?`Log in to keep saving`:`Log in / Sign up`,onClick:()=>a(`login`)}),E&&(0,Q.jsx)(Qk,{label:t.scratch?`Save to workspace`:`Save your work`,onClick:()=>t.saveAtLimit?l(!0):s(!0)}),w&&(0,Q.jsxs)(`div`,{className:`flex h-8 items-center rounded-lg p-[3px] text-[13px] coarse:h-11 ${tl}`,children:[t.publicShare&&(0,Q.jsx)(eA,{owner:t.shareOwner??null}),t.location&&!t.publicShare?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Gk,{location:t.location,workspaceName:t.workspaceName??`Workspace`,onBack:A?t.onShowCanvases:void 0}),(0,Q.jsx)(qk,{name:w.name,onRename:D?()=>s(!0):void 0,onDuplicate:t.onDuplicateCanvas,onMove:t.onMoveCanvas,onShare:k?t.onOpenShare:void 0,onDelete:t.onDeleteCanvas})]}):(0,Q.jsxs)(Q.Fragment,{children:[A&&t.onShowCanvases&&(0,Q.jsxs)(`button`,{type:`button`,"aria-label":t.workspaceName?`Back to ${t.workspaceName}`:`Back to your canvases`,"data-testid":`canvas-back-button`,onClick:t.onShowCanvases,className:`flex h-full cursor-pointer items-center gap-1.5 rounded-md px-2 text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`,children:[(0,Q.jsx)(xs,{size:16,stroke:1.75,className:`shrink-0`}),t.workspaceName&&(0,Q.jsx)(`span`,{className:`hidden max-w-[140px] truncate sm:block`,children:t.workspaceName})]}),A&&t.onShowCanvases&&t.workspaceName&&(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`hidden select-none px-0.5 text-[12px] text-[var(--chrome-fg-400)] sm:block`,children:`/`}),D?(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`canvas-meta-button`,onClick:()=>s(!0),className:`flex h-full min-w-0 cursor-pointer items-center gap-1.5 rounded-md px-2 text-[var(--chrome-fg-900)] transition-colors hover:bg-[var(--chrome-hover)]`,children:[(0,Q.jsx)(`span`,{className:`max-w-[260px] truncate`,children:w.name}),(0,Q.jsx)(nc,{size:14,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-500)]`})]}):(0,Q.jsx)(`span`,{"data-testid":`canvas-meta-name`,className:`flex h-full min-w-0 items-center px-2 text-[var(--chrome-fg-900)]`,children:(0,Q.jsx)(`span`,{className:`max-w-[260px] truncate`,children:w.name})})]})]}),D&&t.saveStatus&&Zk[t.saveStatus]&&(0,Q.jsx)(`span`,{"aria-live":`polite`,"data-testid":`canvas-save-status`,className:`whitespace-nowrap text-[12px] text-[var(--chrome-fg-500)]`,children:Zk[t.saveStatus]}),k&&(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Share`,"data-testid":`canvas-share-button`,onClick:t.onOpenShare,className:`flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)] coarse:h-11 coarse:w-11 ${tl}`,children:(0,Q.jsx)(Np,{size:16,stroke:1.75})}),(0,Q.jsx)(Dk,{boardName:w?.name??`board`}),(0,Q.jsx)(Xk,{}),(0,Q.jsx)(ib,{open:i!==null,onOpenChange:e=>{e||a(null)},title:i===`login`?`Log in or sign up`:void 0}),E&&T&&(0,Q.jsx)(hk,{open:o,onOpenChange:s,title:`Save your canvas`,description:`Give it a name and choose where it lives.`,submitLabel:`Save`,destination:t.saveDestination,onSubmit:async(e,t)=>{try{await T(e,t),y.current=!0}catch(e){if(wk(e)){l(!0);return}throw e}}}),E&&(0,Q.jsx)(rb,{open:c,onOpenChange:l,currentPlan:O.id,title:`Canvas limit reached`,description:O.canvasLimit===1?`The ${O.label} plan is limited to one canvas. Upgrade for unlimited canvases.`:`Your plan allows ${O.canvasLimit??`your`} canvases. To save this one, upgrade, or free a slot first.`,reassurance:`Don't worry, your work is saved on this device and will be right here when you come back.`,onPurchased:e=>{e!==`credits`&&s(!0)},secondaryLabel:t.onShowCanvases?`Go to dashboard`:void 0,onSecondary:t.onShowCanvases,testId:`canvas-limit-save`}),D&&t.onEditCanvasMeta&&(0,Q.jsx)(hk,{open:o,onOpenChange:s,title:`Edit canvas`,description:`Rename or re-describe this canvas. Links to it keep working.`,submitLabel:`Save`,initialName:w.name,initialDescription:w.description,onSubmit:t.onEditCanvasMeta,onDelete:t.onDeleteCanvas})]})}var nA=(0,J.memo)(tA);function rA(){let e=U(),{undo:t,redo:n}=V().history;return{canUndo:ue(e.temporal,e=>e.pastStates.length>0),canRedo:ue(e.temporal,e=>e.futureStates.length>0),undo:t,redo:n}}var iA={panel:`h-10 coarse:h-11`,pill:`h-8 coarse:h-11`};function aA(e={}){let t=e.beside??`pill`,n=B(),r=re(),i=n.onForkCanvas,[a,o]=(0,J.useState)(!1),[s,c]=(0,J.useState)(!1),[l,u]=(0,J.useState)(!1),[d,f]=(0,J.useState)(!1),p=r.state.status===`authenticated`?r.state.user:null,m=qs[(r.state.status===`authenticated`?r.state.usage:void 0)?.plan??`free`];function h(){if(n.forkAtLimit){u(!0);return}c(!0)}if((0,J.useEffect)(()=>{!d||!p||(f(!1),h())},[d,p,n.forkAtLimit]),!i)return null;let g=n.canvasMeta?.name;return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`share-fork`,"aria-label":`Fork this canvas`,title:`Take a copy into your own account`,onClick:()=>{if(!p){f(!0),o(!0);return}h()},onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto flex ${iA[t]} cursor-pointer items-center gap-1.5 rounded-xl bg-[var(--chrome-accent)] px-3 text-[12px] text-white outline-none transition-colors active:scale-[0.97] hover:bg-[var(--chrome-accent-hover)]`,children:[(0,Q.jsx)(np,{size:14,stroke:1.75}),`Fork`]}),(0,Q.jsx)(ib,{open:a,onOpenChange:e=>{o(e),e||f(!1)},title:`Sign in to fork this canvas`,description:`Your copy lands in your own account, where you can edit it freely.`}),(0,Q.jsx)(hk,{open:s,onOpenChange:c,title:`Fork this canvas`,description:`Name your copy and choose where it lives.`,submitLabel:`Fork`,initialName:g?`Copy of ${g}`:void 0,destination:n.saveDestination,onSubmit:async(e,t)=>{try{await i(e,t)}catch(e){if(wk(e)){u(!0);return}throw e}}}),(0,Q.jsx)(rb,{open:l,onOpenChange:u,currentPlan:m.id,title:`Canvas limit reached`,description:m.canvasLimit===1?`The ${m.label} plan is limited to one canvas. Upgrade for unlimited canvases.`:`Your plan allows ${m.canvasLimit??`your`} canvases. To fork this one, upgrade, or free a slot first.`,reassurance:`This canvas isn't going anywhere — the link keeps working, so you can come back and fork it once there's room.`,onPurchased:e=>{e!==`credits`&&c(!0)},secondaryLabel:n.onShowCanvases?`Go to dashboard`:void 0,onSecondary:n.onShowCanvases,testId:`share-fork-limit`})]})}function oA(e){let{onZoomToFit:t}=e,{ai:n,publicShare:r,onForkCanvas:i}=B(),a=ve(e=>[e.shapes,r],(e,t)=>!t||Zr(e).some(e=>e.slideOrder!==void 0)),o=H(e=>e.viewMode),{canUndo:s,canRedo:c,undo:l,redo:u}=rA(),{setSlidesOpen:d,setAiOpen:f,setCodeOpen:p}=U().getState();return(0,Q.jsxs)(`div`,{className:`absolute right-4 top-[var(--chrome-top)] flex flex-col items-end gap-2`,"data-overlay":!0,"data-testid":`mobile-top-bar`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[i!=null&&(0,Q.jsx)(aA,{}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(I,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`More`,"data-testid":`mobile-overflow`,className:`flex h-8 w-10 cursor-pointer items-center justify-center rounded-xl text-[var(--chrome-fg-600)] transition-colors hover:text-[var(--chrome-fg-900)] data-[popup-open]:text-[var(--chrome-fg-900)] coarse:h-11 coarse:w-12 ${tl}`,children:(0,Q.jsx)(Xf,{size:17,stroke:1.75})})}),(0,Q.jsx)(j,{children:(0,Q.jsx)(A,{side:`bottom`,align:`end`,sideOffset:8,className:`outline-none`,children:(0,Q.jsxs)(te,{"data-overlay":!0,"data-testid":`mobile-overflow-popup`,className:`min-w-[190px] p-1 outline-none ${Wc.popup}`,children:[!o&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(L,{testId:`overflow-undo`,icon:(0,Q.jsx)(hs,{size:15,stroke:1.75}),disabled:!s,onClick:()=>l(),children:`Undo`}),(0,Q.jsx)(L,{testId:`overflow-redo`,icon:(0,Q.jsx)(Ff,{size:15,stroke:1.75}),disabled:!c,onClick:()=>u(),children:`Redo`}),(0,Q.jsx)(N,{})]}),(0,Q.jsx)(L,{testId:`overflow-zoom-fit`,icon:(0,Q.jsx)(Ks,{size:15,stroke:1.75}),onClick:t,children:`Zoom to fit`}),(0,Q.jsx)(N,{}),n&&(0,Q.jsx)(L,{testId:`overflow-ai`,icon:(0,Q.jsx)(lc,{size:15,stroke:1.75}),onClick:()=>f(!0),children:`AI assistant`}),a&&(0,Q.jsx)(L,{testId:`overflow-slides`,icon:(0,Q.jsx)(ws,{size:15,stroke:1.75}),onClick:()=>d(!0),children:`Slides`}),!r&&(0,Q.jsx)(L,{testId:`overflow-code`,icon:(0,Q.jsx)(Ds,{size:15,stroke:1.75}),onClick:()=>p(!0),children:`Diagram as code`})]})})})]})]})}function sA(e){let{containerRef:t,onBackToContent:n}=e,r=H(e=>e.shapes),i=H(e=>e.viewport),a=H(e=>e.transforming),o=(0,J.useRef)(r);a||(o.current=r);let s=o.current,[c,l]=(0,J.useState)({width:0,height:0});(0,J.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{l({width:e.clientWidth,height:e.clientHeight})};n();let r=new ResizeObserver(n);return r.observe(e),()=>r.disconnect()},[t]);let u=(0,J.useMemo)(()=>{let e=s.map(pr),t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e)lt(a)&&(t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x+a.width),i=Math.max(i,a.y+a.height));return{boxes:e,bounds:t===1/0?null:{x:t,y:n,width:r-t,height:i-n}}},[s]),d=(0,J.useRef)(0),f=(0,J.useMemo)(()=>{if(u.boxes.length===0||c.width===0||c.height===0)return!1;let e={x:-i.x/i.zoom,y:-i.y/i.zoom,width:c.width/i.zoom,height:c.height/i.zoom};if(!u.bounds||!Ze(e,u.bounds))return!0;let t=u.boxes[d.current];if(t&&Ze(e,t))return!1;let n=u.boxes.findIndex(t=>Ze(e,t));return n===-1?!0:(d.current=n,!1)},[u,i,c]),p=(0,J.useMemo)(()=>{if(!f||!u.bounds)return 0;let e={x:u.bounds.x+u.bounds.width/2,y:u.bounds.y+u.bounds.height/2},t={x:(c.width/2-i.x)/i.zoom,y:(c.height/2-i.y)/i.zoom},n=Math.atan2(e.y-t.y,e.x-t.x);return Math.round(n*180/Math.PI+90)},[u,i,c,f]);return f?(0,Q.jsx)(`div`,{className:`pointer-events-auto`,"data-overlay":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:(0,Q.jsxs)(`button`,{type:`button`,onClick:()=>n(),className:`flex h-9 items-center gap-1.5 rounded-full bg-[var(--chrome-accent)] pl-3 pr-4 text-[13px] text-white transition-colors hover:bg-[var(--chrome-accent-hover)] ${nl}`,children:[(0,Q.jsx)(vs,{size:15,stroke:1.75,className:`text-white/70`,style:{transform:`rotate(${p}deg)`}}),`Back to content`]})}):null}var cA=(0,J.memo)(sA);function lA(e){let{containerRef:t,onZoomIn:n,onZoomOut:r,onReset:i,onZoomToFit:a}=e,o=H(e=>e.viewport.zoom);function s(){let e=t.current;if(!e)return{x:0,y:0};let n=e.getBoundingClientRect();return{x:n.width/2,y:n.height/2}}return(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 ${$c}`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(S,{label:`Zoom out`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Zoom out`,onClick:()=>r(s()),className:`flex h-8 w-8 items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)]`,children:(0,Q.jsx)(tc,{size:16,stroke:1.75})})}),(0,Q.jsx)(S,{label:`Reset to 100%`,side:`top`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":`Reset zoom to 100%`,onClick:()=>i(s()),className:`min-w-[52px] rounded-lg px-2 py-1 text-center text-[13px] font-medium tabular-nums text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-hover)]`,children:[Math.round(o*100),`%`]})}),(0,Q.jsx)(S,{label:`Zoom in`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Zoom in`,onClick:()=>n(s()),className:`flex h-8 w-8 items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)]`,children:(0,Q.jsx)(ic,{size:16,stroke:1.75})})}),(0,Q.jsx)(`span`,{className:`mx-0.5 h-5 w-px bg-[var(--chrome-divider)]`}),(0,Q.jsx)(S,{label:`Zoom to fit`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Zoom to fit`,onClick:()=>a(),className:`flex h-8 w-8 items-center justify-center rounded-lg text-[var(--chrome-fg-600)] transition-colors hover:bg-[var(--chrome-hover)]`,children:(0,Q.jsx)(Sp,{size:15,stroke:1.75})})})]})}var uA=(0,J.memo)(lA);function dA(){let e=H(e=>e.viewport.zoom),t=H(e=>e.zoomGestureNonce),n=H(e=>e.showZoomIndicator),[r,i]=(0,J.useState)(!1),a=(0,J.useRef)(null),o=(0,J.useRef)(t);return(0,J.useEffect)(()=>{if(t!==o.current)return o.current=t,i(!0),a.current&&clearTimeout(a.current),a.current=setTimeout(()=>i(!1),300),()=>{a.current&&clearTimeout(a.current)}},[t]),n?(0,Q.jsxs)(`div`,{"data-testid":`zoom-indicator`,"aria-hidden":!0,className:`pointer-events-none absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-xl px-4 py-2 text-[15px] font-medium tabular-nums text-[var(--chrome-fg-700)] ${tl} ${r?`opacity-100`:`opacity-0`}`,children:[Math.round(e*100),`%`]}):null}var fA=(0,J.memo)(dA),pA={sm:`rounded-md bg-[var(--chrome-hover)] px-2 py-1 text-center text-[11px] leading-none text-[var(--chrome-fg-500)] ring-1 ring-[var(--chrome-ring)]`,md:`rounded-md bg-[var(--chrome-hover)] px-2 py-0.5 font-sans text-[13px] text-[var(--chrome-fg-500)] ring-1 ring-[var(--chrome-ring)]`};function mA(e){return(0,Q.jsx)(`kbd`,{className:pA[e.size??`sm`],children:e.children})}var hA=`M7 18.3895C8.23437 16.6169 11.9752 11.5804 16.3514 8.74789C19.6425 6.61824 22.7512 9.42977 20.3407 12.2607C17.9836 15.0302 14.8214 18.8419 13.4722 20.734C12.0727 22.6957 14.4676 25.0677 16.864 22.8104C18.4663 21.3012 20.1347 19.5658 21.8298 18.2828C24.1193 16.5523 26.0833 18.0809 25.0848 20.0312C24.3614 21.4418 23.8378 22.0639 23.2356 23.2515C22.6317 24.4375 23.2701 25.861 24.1837 25.9822C25.3159 26.1341 26.0329 25.2987 27 23.998`;function gA(e){let{size:t}=e;return(0,Q.jsx)(`svg`,{width:t,height:t,viewBox:`0 0 34 34`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":!0,children:(0,Q.jsx)(`path`,{d:hA,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`})})}function _A(e){let{size:t,className:n,testId:r}=e;return(0,Q.jsx)(`span`,{"data-testid":r,className:`flex shrink-0 items-center justify-center bg-[var(--chrome-fg-900)] text-[var(--chrome-page)] ${n??``}`,style:{width:t,height:t,borderRadius:t*7/34},children:(0,Q.jsx)(gA,{size:t})})}var vA=`"Balsamiq Sans Neue", ui-sans-serif, system-ui, cursive`,yA=2.5;function bA(e,t,n,r,i){let a=1-i;return{x:a*a*a*e.x+3*a*a*i*t.x+3*a*i*i*n.x+i*i*i*r.x,y:a*a*a*e.y+3*a*a*i*t.y+3*a*i*i*n.y+i*i*i*r.y}}function xA(e,t,n,r,i){if(!n||!r)return Math.atan2(t.y-e.y,t.x-e.x);let a=t,o=i;for(let i=1;i<=64;i+=1){let s=bA(e,n,r,t,1-i/64);if(o-=$e(a,s),o<=0)return Math.atan2(t.y-s.y,t.x-s.x);a=s}return Math.atan2(t.y-e.y,t.x-e.x)}function SA(e){let{className:t,width:n,height:r,from:i,to:a,c1:o,c2:s}=e,c=Kt(yA/2.5),l=o&&s?`M ${i.x} ${i.y} C ${o.x} ${o.y}, ${s.x} ${s.y}, ${a.x} ${a.y}`:`M ${i.x} ${i.y} L ${a.x} ${a.y}`,u=fr(a,xA(i,a,o,s,c),c);return(0,Q.jsxs)(`svg`,{className:`absolute text-[var(--chrome-fg-300)] ${t}`,width:n,height:r,viewBox:`0 0 ${n} ${r}`,fill:`none`,stroke:`currentColor`,strokeWidth:yA,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":!0,children:[(0,Q.jsx)(`path`,{d:l}),(0,Q.jsx)(`path`,{d:u})]})}function CA(e){let{icon:t,label:n,shortcut:r,testId:i,onClick:a,onPreload:o}=e;return(0,Q.jsxs)(`button`,{type:`button`,"data-testid":i,onClick:a,onPointerEnter:o,onFocus:o,className:`group flex h-9 cursor-pointer items-center gap-2 rounded-xl bg-[var(--chrome-hover)] px-3 text-[13px] text-[var(--chrome-fg-900)] transition-[background-color,scale] hover:bg-[color-mix(in_srgb,var(--chrome-active)_50%,var(--chrome-hover))] active:scale-[0.97]`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-600)] transition-colors group-hover:text-[var(--chrome-fg-800)]`,children:t}),n,(0,Q.jsx)(`span`,{className:`text-[12px] text-[var(--chrome-fg-500)] transition-colors group-hover:text-[var(--chrome-fg-600)]`,children:Ec(r)})]})}function wA(e){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`absolute whitespace-nowrap text-[19px] leading-none text-[var(--chrome-fg-400)] ${e.labelClass}`,style:{fontFamily:vA},children:e.label}),e.arrow]})}function TA(){let{assistant:e,publicShare:t}=B(),n=ie(),r=U(),i=H(e=>e.shapes.length===0),a=H(e=>e.tool!==`select`),o=H(e=>e.rightPanel!==null),s=H(e=>e.pasteChoiceGrid!==null),c=H(e=>e.commentDraft!==null),l=(n?.threads.length??0)>0,u=H(e=>e.deviceMode===`phone`);return!i||a||o||s||c||l?null:u?(0,Q.jsx)(`div`,{"data-testid":`empty-hint`,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 z-20`,children:(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 px-8 text-center`,children:[(0,Q.jsx)(_A,{size:52,className:`mb-3 opacity-90`,testId:`empty-hint-logo`}),(0,Q.jsx)(`div`,{className:`text-[18px] text-[var(--chrome-fg-400)]`,children:`Double-tap anywhere to add text`}),(0,Q.jsx)(`div`,{className:`text-[14px] text-[var(--chrome-fg-400)]`,children:`or pick a tool from the bar below`})]})})}):(0,Q.jsxs)(`div`,{"data-testid":`empty-hint`,className:`pointer-events-none absolute inset-0 z-20`,children:[(0,Q.jsx)(wA,{labelClass:`left-[145px] top-[calc(136px+var(--koboyo-host-inset-top))]`,label:`Pick a tool from here`,arrow:(0,Q.jsx)(SA,{className:`left-[73px] top-[calc(140px+var(--koboyo-host-inset-top))]`,width:78,height:52,from:{x:61,y:12},to:{x:4,y:44}})}),(0,Q.jsx)(wA,{labelClass:`right-[133px] top-[calc(100px+var(--koboyo-host-inset-top))]`,label:`Slides & Diagrams as Code`,arrow:(0,Q.jsx)(SA,{className:`right-[60px] top-[calc(27px+var(--koboyo-host-inset-top))]`,width:110,height:70,from:{x:7,y:62},c1:{x:30,y:30},c2:{x:70,y:14},to:{x:97,y:14}})}),(0,Q.jsx)(wA,{labelClass:`bottom-[122px] left-[150px]`,label:`Zoom & reset view`,arrow:(0,Q.jsx)(SA,{className:`bottom-[63px] left-[80px]`,width:70,height:80,from:{x:58,y:13},c1:{x:33,y:16},c2:{x:9,y:44},to:{x:9,y:74}})}),(0,Q.jsx)(wA,{labelClass:`bottom-[120px] right-[127px]`,label:`Keyboard shortcuts`,arrow:(0,Q.jsx)(SA,{className:`bottom-[54px] right-[23px]`,width:130,height:90,from:{x:43,y:16},c1:{x:78,y:12},c2:{x:114,y:50},to:{x:114,y:84}})}),(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-center`,children:[(0,Q.jsx)(_A,{size:52,className:`mb-3 opacity-90`,testId:`empty-hint-logo`}),(0,Q.jsx)(`div`,{className:`text-[18px] text-[var(--chrome-fg-400)]`,children:`Double-click anywhere to add text`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-2 gap-y-1.5 text-[14px] text-[var(--chrome-fg-400)]`,children:[(0,Q.jsx)(`span`,{children:`or pick a tool`}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(mA,{size:`md`,children:`R`}),` rectangle`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(mA,{size:`md`,children:`O`}),` ellipse`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(mA,{size:`md`,children:`A`}),` arrow`]}),(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1`,children:[(0,Q.jsx)(mA,{size:`md`,children:`/`}),` all tools`]})]}),(0,Q.jsxs)(`div`,{className:`pointer-events-auto mt-5 flex flex-wrap items-center justify-center gap-2`,"data-overlay":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[e&&(0,Q.jsx)(CA,{icon:(0,Q.jsx)(lc,{size:16,stroke:1.75}),label:`Generate with AI`,shortcut:Z(`aiPanel`),testId:`empty-hint-ai`,onClick:()=>r.getState().setAiOpen(!0),onPreload:()=>Pa(e)}),(0,Q.jsx)(CA,{icon:(0,Q.jsx)(ws,{size:16,stroke:1.75}),label:`Create slides`,shortcut:Z(`slidesPanel`),testId:`empty-hint-slides`,onClick:()=>r.getState().setSlidesOpen(!0),onPreload:()=>Pa(Ly)}),!t&&(0,Q.jsx)(CA,{icon:(0,Q.jsx)(Ds,{size:16,stroke:1.75}),label:`Diagram as code`,shortcut:Z(`codePanel`),testId:`empty-hint-code`,onClick:()=>r.getState().setCodeOpen(!0),onPreload:()=>Pa(Ry)})]})]})})]})}var EA=(0,J.memo)(TA);function DA(){let{canUndo:e,canRedo:t,undo:n,redo:r}=rA();return(0,Q.jsxs)(`div`,{className:`flex items-center gap-0.5 ${$c}`,"data-overlay":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(S,{label:`Undo`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Undo`,disabled:!e,onClick:()=>n(),className:`${Jc} disabled:pointer-events-none disabled:text-[var(--chrome-fg-300)]`,children:(0,Q.jsx)(hs,{size:16,stroke:1.75})})}),(0,Q.jsx)(S,{label:`Redo`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Redo`,disabled:!t,onClick:()=>r(),className:`${Jc} disabled:pointer-events-none disabled:text-[var(--chrome-fg-300)]`,children:(0,Q.jsx)(Ff,{size:16,stroke:1.75})})})]})}var OA=(0,J.memo)(DA);function kA(e){switch(tn[e.type].search){case`label`:return Qn(e.label??``);case`label-and-name`:{let t=e;return`${Qn(t.label??``)}\n${t.name}`}case`text`:return Qn(e.text);case`cells`:return e.cells.flat().map(Qn).join(`
|
|
25
|
+
`);case`none`:return``}}function AA(e,t){let n=t.trim().toLowerCase();return n?e.filter(e=>kA(e).toLowerCase().includes(n)):[]}var jA=80,MA=[],NA=`${Jc} disabled:pointer-events-none disabled:text-[var(--chrome-fg-300)]`;function PA(e){let{containerRef:t}=e,{store:n,viewportAnimation:r}=V(),i=H(e=>e.shapes),a=H(e=>e.searchOpen),o=H(e=>e.setSearchOpen),[s,c]=(0,J.useState)(``),[l,u]=(0,J.useState)(``),[d,f]=(0,J.useState)(0),p=(0,J.useRef)(null),m=(0,J.useMemo)(()=>a?AA(i,l):MA,[a,i,l]),h=m.length,g=Math.min(d,Math.max(0,h-1));(0,J.useEffect)(()=>{function e(e){e.key.toLowerCase()===`f`&&(e.metaKey||e.ctrlKey)&&!e.shiftKey&&!e.altKey&&(e.preventDefault(),o(!0),requestAnimationFrame(()=>p.current?.select()))}return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[o]),(0,J.useEffect)(()=>{a&&p.current?.select()},[a]);function _(e){let i=n.getState();i.setSelectedIds(e.locked?new Set:new Set([e.id]));let a=t.current;if(!a)return;let o={width:a.clientWidth,height:a.clientHeight},s=cn(e),{viewport:c}=i,l=Math.min((o.width-jA*2)/s.width,(o.height-jA*2)/s.height),u=Ur(Math.min(c.zoom,l)),d={zoom:u,x:o.width/2-(s.x+s.width/2)*u,y:o.height/2-(s.y+s.height/2)*u};r.animate(c,d,i.setViewport)}function v(e){u(e),f(0);let t=AA(n.getState().shapes,e);t.length>0&&_(t[0])}function y(e){if(s!==l){v(s);return}if(h===0)return;let t=(g+e+h)%h;f(t),_(m[t])}function b(){o(!1)}return a?(0,Q.jsxs)(`div`,{"data-overlay":!0,"data-testid":`canvas-search`,className:`pointer-events-auto flex items-center gap-0.5 ${$c}`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsx)(cc,{size:16,stroke:1.75,className:`ml-2 shrink-0 text-[var(--chrome-fg-400)]`}),(0,Q.jsx)(`input`,{ref:p,"data-testid":`canvas-search-input`,value:s,onChange:e=>c(e.target.value),onKeyDown:e=>{e.stopPropagation(),e.key===`Enter`&&(e.preventDefault(),y(e.shiftKey?-1:1)),e.key===`Escape`&&b()},placeholder:`Search`,className:`h-8 w-44 bg-transparent px-1.5 text-[13px] text-[var(--chrome-fg-900)] outline-none placeholder:text-[var(--chrome-fg-400)]`}),l.trim()&&(0,Q.jsx)(`span`,{"data-testid":`canvas-search-count`,className:`min-w-9 shrink-0 text-center text-[11px] tabular-nums text-[var(--chrome-fg-500)]`,children:h===0?`0/0`:`${g+1}/${h}`}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Previous match`,disabled:h===0,onClick:()=>y(-1),className:NA,children:(0,Q.jsx)(Gf,{size:16,stroke:1.75})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Next match`,disabled:h===0,onClick:()=>y(1),className:NA,children:(0,Q.jsx)(w,{size:16,stroke:1.75})}),(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Close search`,onClick:b,className:Jc,children:(0,Q.jsx)(uc,{size:16,stroke:1.75})})]}):null}var FA=(0,J.memo)(PA);function IA(e,t){return e.anchor.kind===`point`||Yr(t).position.has(e.anchor.shapeId)}var LA=[];function RA(){let e=ie(),t=V(),{notify:n}=_(),[r,i]=(0,J.useState)(!1),a=H(e=>r?e.shapes:LA),[o,s]=(0,J.useState)(`open`),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(()=>Date.now()),f=(0,J.useRef)(null),[p,m]=(0,J.useState)(!1),h=(0,J.useRef)(null);if(tx(r?c:null),!e||e.threads.length===0)return null;let g=[...e.threads].sort((e,t)=>t.updatedAt-e.updatedAt),v=g.filter(e=>e.resolvedAt===null),y=g.filter(e=>e.resolvedAt!==null),b=o===`open`?v:y,x=c?g.find(e=>e.id===c):void 0;function C(e){if(f.current?.isDirty()){h.current=e,m(!0);return}e()}function w(){i(!1),l(null)}function T(e){w(),nx(t,e)}let E=e.notifications,D=ex(e);function O(){if(!E)return;let e=!E.muted;E.setMuted(e).then(()=>n(e?`Canvas muted. You won't be notified about it.`:`Canvas unmuted. You'll be notified about it again.`)).catch(e=>n(ml(e,`Couldn't change that. Try again.`)))}return(0,Q.jsxs)(mc,{open:r,onOpenChange:e=>{if(e){d(Date.now()),i(!0);return}C(w)},children:[(0,Q.jsx)(S,{label:`All comments`,side:`left`,children:(0,Q.jsx)(ca,{render:(0,Q.jsxs)(`button`,{type:`button`,"aria-label":D?`All comments, new activity`:`All comments`,"data-testid":`comments-list-open`,"data-unread":D?`true`:void 0,className:`relative ${rl(r)}`,children:[(0,Q.jsx)(Tp,{size:17,stroke:1.75}),D&&(0,Q.jsx)(`span`,{"aria-hidden":!0,"data-testid":`comments-unread-dot`,className:`absolute right-1 top-1 h-2 w-2 rounded-full bg-[var(--chrome-unread)] ring-2 ring-[var(--chrome-popup)]`})]})})}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{side:`left`,align:`start`,sideOffset:8,collisionPadding:12,children:(0,Q.jsx)(Tc,{"data-overlay":!0,"data-testid":`comments-list`,className:hx,children:x?(0,Q.jsxs)(`div`,{className:`flex flex-col`,children:[(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`comments-list-back`,onClick:()=>C(()=>l(null)),className:`flex items-center gap-1.5 px-3 pt-2 text-left text-[12px] text-[var(--chrome-fg-500)] hover:text-[var(--chrome-fg-900)]`,children:[(0,Q.jsx)(xs,{size:13,stroke:1.75}),`All comments`]}),(0,Q.jsx)(px,{thread:x,comments:e,onClose:()=>l(null),now:u,composerRef:f,confirmDiscard:e=>C(e)})]}):(0,Q.jsxs)(`div`,{className:`flex w-[304px] flex-col`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-1 border-b border-[var(--chrome-divider)] p-1.5`,children:[(0,Q.jsx)(`div`,{role:`tablist`,className:`flex flex-1 gap-1`,children:[[`open`,`Open`,v.length],[`resolved`,`Resolved`,y.length]].map(([e,t,n])=>(0,Q.jsxs)(`button`,{type:`button`,role:`tab`,"aria-selected":o===e,"data-testid":`comments-list-filter-${e}`,onClick:()=>s(e),className:`flex h-7 cursor-pointer items-center gap-1 rounded-lg px-2.5 text-[12px] text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-hover)] ${o===e?`bg-[var(--chrome-active)]`:``}`,children:[t,(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-400)]`,children:n})]},e))}),E&&(0,Q.jsx)(S,{label:E.muted?`Unmute this canvas`:`Mute this canvas (no notifications about it)`,side:`top`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":E.muted?`Unmute this canvas`:`Mute this canvas`,"aria-pressed":E.muted,"data-testid":`comments-mute-toggle`,onClick:O,className:`flex h-7 w-7 shrink-0 cursor-pointer items-center justify-center rounded-lg text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`,children:E.muted?(0,Q.jsx)(Rf,{size:15,stroke:1.75}):(0,Q.jsx)(zf,{size:15,stroke:1.75})})})]}),(0,Q.jsxs)(`div`,{className:`scrollbar-slim max-h-[360px] overflow-y-auto py-1`,children:[b.length===0&&(0,Q.jsx)(`p`,{className:`px-3 py-3 text-[13px] text-[var(--chrome-fg-400)]`,children:o===`open`?`No open comments.`:`No resolved comments.`}),b.map(t=>{let n=t.comments[0],r=IA(t,a),i=t.comments.length-1,o=$b(e,t.id);return(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`comments-list-row`,"data-detached":r?void 0:`true`,"data-unread":o>0?`true`:void 0,onClick:()=>r?T(t):l(t.id),className:`relative flex w-full flex-col gap-0.5 px-3 py-2 text-left hover:bg-[var(--chrome-hover)] ${o>0?`bg-[var(--chrome-unread-bg)]`:``}`,children:[(0,Q.jsxs)(`span`,{className:`flex items-baseline gap-1.5 text-[12px] text-[var(--chrome-fg-500)]`,children:[(0,Q.jsx)(`span`,{className:`truncate text-[var(--chrome-fg-900)]`,children:n?.author.name}),(0,Q.jsx)(`span`,{className:`shrink-0`,children:ix(t.updatedAt,u)}),i>0&&(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`· `,i,` `,i===1?`reply`:`replies`]}),o>0&&(0,Q.jsxs)(`span`,{"data-testid":`comments-list-row-new`,className:`ml-auto flex shrink-0 items-center gap-1 self-center text-[11px] text-[var(--chrome-unread)]`,children:[i>0&&`${o} new`,(0,Q.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 rounded-full bg-[var(--chrome-unread)]`})]})]}),(0,Q.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-[var(--chrome-fg-700)]`,children:n?.body}),!r&&(0,Q.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-400)]`,children:`Its shape was deleted`})]},t.id)})]})]})})})}),(0,Q.jsx)(Pb,{open:p,onOpenChange:e=>{m(e),e||(h.current=null)},title:`Discard this comment?`,description:`You've written something that hasn't been posted yet. Discarding throws it away.`,confirmLabel:`Discard`,destructive:!0,testId:`comment-discard-confirm`,onConfirm:()=>{f.current?.discard(),h.current?.(),h.current=null}})]})}function zA(){let{assistant:e,publicShare:t,onForkCanvas:n}=B(),r=ve(e=>[e.shapes,t],(e,t)=>!t||Zr(e).some(e=>e.slideOrder!==void 0)),i=H(e=>e.viewMode),a=H(e=>e.rightPanel),o=a===`ai`,s=a===`slides`,c=a===`code`,l=H(e=>e.rightPanel===`flow`),u=ve(e=>[e.shapes,e.viewMode,t],(e,t,n)=>Zr(e).some(e=>(e.flows?.length??0)>0)||!t&&!n&&Zr(e).length>0),d=H(e=>e.animateSlideId!==null),f=ie(),p=f?.threads,m=ve(e=>[e.shapes,p],(e,t)=>t?.some(t=>IA(t,e))??!1),h=H(e=>e.commentsVisible),{setAiOpen:g,setSlidesOpen:_,setCodeOpen:v,setFlowsOpen:y,setCommentsVisible:b}=U().getState(),x=xl(a),C=t&&!e&&!r,w=n!=null;return d&&!w?null:C?(0,Q.jsxs)(`div`,{className:`absolute top-[var(--chrome-top)] flex flex-row-reverse items-start gap-2`,style:{right:x},"data-overlay":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,Q.jsxs)(`a`,{href:`https://koboyo.com`,"aria-label":`Made with Koboyo`,"data-testid":`share-made-with`,className:`flex h-8 items-center gap-1.5 rounded-xl px-2.5 text-[12px] text-[var(--chrome-fg-500)] outline-none transition-colors hover:text-[var(--chrome-fg-900)] ${tl}`,children:[(0,Q.jsx)(_A,{size:14}),`Made with Koboyo`]}),w&&(0,Q.jsx)(aA,{})]}):(0,Q.jsxs)(`div`,{className:`absolute top-[var(--chrome-top)] flex flex-row-reverse items-start gap-2`,style:{right:x},"data-overlay":!0,"data-testid":`right-rail`,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[!d&&(0,Q.jsxs)(`div`,{className:`${$c} flex flex-col`,children:[e&&!i&&(0,Q.jsx)(S,{label:`AI assistant`,side:`left`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`AI assistant`,"data-testid":`ai-open`,onClick:()=>g(!o),onPointerEnter:()=>Pa(e),onFocus:()=>Pa(e),className:rl(o),children:(0,Q.jsx)(lc,{size:17,stroke:1.75})})}),r&&(0,Q.jsx)(S,{label:`Slides`,side:`left`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Slides`,"data-testid":`slides-open`,onClick:()=>_(!s),onPointerEnter:()=>Pa(Ly),onFocus:()=>Pa(Ly),className:rl(s),children:(0,Q.jsx)(ws,{size:17,stroke:1.75})})}),u&&(0,Q.jsx)(S,{label:`Flows`,side:`left`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Flows`,"data-testid":`flows-open`,onClick:()=>y(!l),onPointerEnter:()=>Pa(zy),onFocus:()=>Pa(zy),className:rl(l),children:(0,Q.jsx)(oc,{size:17,stroke:1.75})})}),!t&&!i&&(0,Q.jsx)(S,{label:`Diagram as code`,side:`left`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Diagram as code`,"data-testid":`code-open`,onClick:()=>v(!c),onPointerEnter:()=>Pa(Ry),onFocus:()=>Pa(Ry),className:rl(c),children:(0,Q.jsx)(Ds,{size:17,stroke:1.75})})}),f&&m&&(0,Q.jsx)(S,{label:h?`Hide comments`:`Show comments`,side:`left`,children:(0,Q.jsx)(`button`,{type:`button`,"aria-label":h?`Hide comments`:`Show comments`,"aria-pressed":!h,"data-testid":`comments-toggle`,onClick:()=>b(!h),className:rl(!h),children:h?(0,Q.jsx)(as,{size:17,stroke:1.75}):(0,Q.jsx)(wp,{size:17,stroke:1.75})})}),(0,Q.jsx)(RA,{})]}),w&&(0,Q.jsx)(aA,{beside:`panel`})]})}var BA=(0,J.memo)(zA),VA=[{title:`Tools`,shortcuts:[{keys:`/`,label:`Search all tools`},...Object.entries(ns).map(([e,t])=>({keys:ls(e),label:`help`in t?t.help:t.label})),{keys:Z(`toolLock`),label:`Keep tool active (lock)`}]},{title:`Edit`,shortcuts:[{keys:`⌘C`,label:`Copy`},{keys:`⌘X`,label:`Cut`},{keys:`⌘V`,label:`Paste`},{keys:`⌘⇧V`,label:`Paste as plain text`},{keys:`⌘D`,label:`Duplicate`},{keys:`⌘A`,label:`Select all`},{keys:`⌫`,label:`Delete`},{keys:`⌘Z`,label:`Undo`},{keys:`⌘⇧Z / ⌘Y`,label:`Redo`},{keys:`⌘G`,label:`Group`},{keys:`⌘⇧G`,label:`Ungroup`},{keys:`⌘⇧L`,label:`Lock / unlock`},{keys:`⌘⇧C`,label:`Copy as PNG`},{keys:`⌘B`,label:`Bold text`},{keys:`⌘I`,label:`Italic text`},{keys:`⌘U`,label:`Underline text`},{keys:`⌘⇧X`,label:`Strikethrough text`},{keys:`⇧I`,label:`Pick colour (eyedropper)`},{keys:`⏎`,label:`Edit selected shape`},{keys:`Tab`,label:`Add connected shape`},{keys:`⇧Tab`,label:`Add connected shape below`}]},{title:`Arrange`,shortcuts:[{keys:`⌘]`,label:`Bring forward`},{keys:`⌘[`,label:`Send backward`},{keys:`⌘⌥]`,label:`Bring to front`},{keys:`⌘⌥[`,label:`Send to back`},{keys:`⌘⌥C`,label:`Copy styles`},{keys:`⌘⌥V`,label:`Paste styles`},{keys:`⇧H`,label:`Flip horizontal`},{keys:`⇧V`,label:`Flip vertical`}]},{title:`Align (2+ selected)`,shortcuts:[{keys:`⌥L`,label:`Align left`},{keys:`⌥C`,label:`Align centre`},{keys:`⌥R`,label:`Align right`},{keys:`⌥T`,label:`Align top`},{keys:`⌥M`,label:`Align middle`},{keys:`⌥B`,label:`Align bottom`},{keys:`⌥U`,label:`Tidy up layout`}]},{title:`Move & view`,shortcuts:[{keys:`← ↑ ↓ →`,label:`Nudge 1px`},{keys:`⇧ Arrows`,label:`Nudge 10px`},{keys:`⌘⇧ Arrows`,label:`Nudge 100px`},{keys:`⌘=`,label:`Zoom in`},{keys:`⌘-`,label:`Zoom out`},{keys:`⌘0`,label:`Reset zoom`},{keys:`⌘1`,label:`Zoom to fit`},{keys:`⌘F`,label:`Find on canvas`},{keys:`⌘K`,label:`Command palette`},{keys:`⌥Z`,label:`Zen mode (hide the chrome)`},{keys:`Right-drag`,label:`Pan the canvas`},{keys:`?`,label:`Keyboard shortcuts (this dialog)`}]},{title:`Panels`,shortcuts:[{keys:`⌥A`,label:`AI assistant`},{keys:`⌥S`,label:`Slides`},{keys:`⌥D`,label:`Diagram as code`}]},{title:`File`,shortcuts:[{keys:`⌘S`,label:`Save now (it already saves itself)`},{keys:`⌘O`,label:`Open / import a board file`},{keys:`⌘P`,label:`Print: export slides as PDF, or the board as an image`}]},{title:`Slides`,shortcuts:[{keys:`⌘⌥P`,label:`Present from current slide`},{keys:`⇧⌘⌥P`,label:`Present from beginning`},...Ma.map(e=>({keys:e.help,label:e.label}))]},{title:`Text (while editing)`,shortcuts:[{keys:`⌘B`,label:`Bold`},{keys:`⌘I`,label:`Italic`},{keys:`⌘U`,label:`Underline`},{keys:`⌘⇧X`,label:`Strikethrough`},{keys:`⌘E`,label:`Code`},{keys:`⌘⇧H`,label:`Highlight`},{keys:`⌘K`,label:`Link (at the caret: insert one)`},{keys:`URL + space`,label:`Link a typed URL`},{keys:`- / *`,label:`Bullet list`},{keys:`1.`,label:`Numbered list`},{keys:`[]`,label:`Checklist`},{keys:`# … ####`,label:`Heading (4 levels)`},{keys:`**text**`,label:`Bold (markdown)`},{keys:`*text*`,label:`Italic (markdown)`},{keys:"`text`",label:`Code (markdown)`},{keys:`==text==`,label:`Highlight (markdown)`},{keys:`~~text~~`,label:`Strikethrough (markdown)`},{keys:`⏎`,label:`New line`},{keys:`⌘Z`,label:`Undo typing`},{keys:`Tab / ⇧Tab`,label:`Indent / outdent a list item`},{keys:`Tab`,label:`Next connected shape (on a node's label)`},{keys:`⇧Tab`,label:`Next connected shape below`},{keys:`Esc`,label:`Done editing`}]}];function HA(){let[e,t]=(0,J.useState)(!1),[n,r]=(0,J.useState)(``),i=(0,J.useRef)(null),a=xl(H(e=>e.rightPanel));(0,J.useEffect)(()=>{function e(e){e.key===`?`&&!Bo(e.target)&&(e.preventDefault(),t(!0))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let o=n.trim().toLowerCase(),s=(0,J.useMemo)(()=>o?VA.map(e=>({title:e.title,shortcuts:e.shortcuts.filter(t=>`${t.label} ${t.keys} ${e.title}`.toLowerCase().includes(o))})).filter(e=>e.shortcuts.length>0):VA,[o]);function c(e){t(e),e||r(``)}return(0,Q.jsxs)(ul,{open:e,onOpenChange:c,children:[(0,Q.jsx)(S,{label:`Keyboard shortcuts`,shortcut:`?`,side:`left`,children:(0,Q.jsx)(Nb,{render:(0,Q.jsx)(`button`,{type:`button`,"aria-label":`Keyboard shortcuts`,style:{right:a},className:`absolute bottom-4 flex h-8 w-8 items-center justify-center rounded-xl text-[var(--chrome-fg-500)] transition-colors hover:text-[var(--chrome-fg-900)] ${tl}`,children:(0,Q.jsx)(za,{size:16,stroke:1.75})})})}),(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:`fixed inset-0 bg-gray-900/15`}),(0,Q.jsxs)(ll,{initialFocus:i,"data-overlay":!0,className:`fixed left-1/2 top-[12vh] flex max-h-[76vh] min-h-[340px] w-[min(720px,92vw)] -translate-x-1/2 flex-col overflow-hidden rounded-2xl bg-[var(--chrome-popup)] shadow-[0_24px_70px_rgba(0,0,0,0.22)] outline-none ring-1 ring-[var(--chrome-ring)]`,children:[(0,Q.jsx)(fl,{className:`sr-only`,children:`Keyboard shortcuts`}),(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 border-b border-[var(--chrome-ring)] px-4 py-2.5`,children:[(0,Q.jsx)(cc,{size:16,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-400)]`}),(0,Q.jsx)(`input`,{ref:i,value:n,onChange:e=>r(e.target.value),placeholder:`Search shortcuts…`,"aria-label":`Search shortcuts`,className:`w-full bg-transparent text-[13.5px] text-[var(--chrome-fg-900)] outline-none placeholder:text-[var(--chrome-fg-400)]`}),(0,Q.jsx)(dl,{"aria-label":`Close`,className:`-mr-1 flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-[var(--chrome-fg-400)] outline-none transition-colors hover:bg-[var(--chrome-divider)] hover:text-[var(--chrome-fg-600)]`,children:(0,Q.jsx)(uc,{size:16,stroke:1.75})})]}),(0,Q.jsx)(`div`,{className:`scrollbar-slim flex-1 overflow-y-auto`,children:s.length===0?(0,Q.jsxs)(`div`,{className:`px-5 py-14 text-center text-[13px] text-[var(--chrome-fg-400)]`,children:[`No shortcuts match “`,n.trim(),`”`]}):(0,Q.jsx)(`div`,{className:`columns-1 gap-x-10 px-5 py-5 sm:columns-2`,children:s.map(e=>(0,Q.jsxs)(`section`,{className:`mb-6 break-inside-avoid`,children:[(0,Q.jsx)(`h3`,{className:`mb-3 text-[11px] uppercase tracking-wider text-[var(--chrome-fg-400)]`,children:e.title}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:e.shortcuts.map(e=>(0,Q.jsxs)(`li`,{className:`flex items-center justify-between gap-6 text-[13px]`,children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-600)]`,children:e.label}),(0,Q.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:Ec(e.keys).split(` `).map((e,t)=>e===`/`?(0,Q.jsx)(`span`,{className:`text-[11px] text-[var(--chrome-fg-400)]`,children:`/`},t):(0,Q.jsx)(`kbd`,{className:`rounded-md bg-[var(--chrome-hover)] px-2 py-1 text-center text-[11px] leading-none tabular-nums text-[var(--chrome-fg-500)] ring-1 ring-[var(--chrome-ring)]`,children:e},t))})]},e.label))})]},e.title))})})]})]})]})}var UA=(0,J.memo)(HA);function WA(e){let{width:t,ariaLabel:n,onDismiss:r}=e;return(0,Q.jsx)(Sl,{width:t,testId:`panel-loading`,ariaLabel:n,onDismiss:r,children:(0,Q.jsx)(`div`,{"aria-busy":`true`,className:`flex h-full items-center justify-center text-[12px] text-[var(--chrome-fg-400)]`,children:`Loading…`})})}function GA(e){let{containerRef:t,mainMenuRef:n,loadDocument:r,tools:i,panel:a,styles:o,deleteSelection:s,alignSelection:c,distributeSelection:l,reorderSelection:u,duplicateSelection:d,pasteEmbed:f,zoomToFit:p,backToContent:m,paletteCommands:h}=e;my(`CanvasChrome`);let g=U(),_=B().assistant,v=B(),y=v.readOnly===!0,b=y&&v.readOnlyPill===!1,x=B().publicShare===!0,S=ie()!==null,C=H(e=>e.tool),w=H(e=>e.shapeKind),T=H(e=>e.chartKind),E=H(e=>e.frameKind),D=H(e=>e.toolLock),O=H(e=>e.iconPickerOpen),k=H(e=>e.imageLibraryOpen),A=H(e=>e.setImageLibraryOpen),j=H(e=>e.toolDrawerOpen),ee=H(e=>e.paletteOpen),M=H(e=>e.rightPanel===`slides`),N=H(e=>e.animateSlideId!==null),P=H(e=>e.rightPanel===`ai`),F=H(e=>e.rightPanel===`code`),I=H(e=>e.rightPanel===`flow`),te=H(e=>e.notesEditorId!==null),ne=H(e=>e.exportDialog),L=H(e=>e.imageToCopy),R=H(e=>e.webEmbedDialog!==null),z=H(e=>e.webHtmlEditorId!==null),re=H(e=>e.rideMode),ae=H(e=>e.zenMode)||re,oe=H(e=>e.viewMode),se=H(e=>e.presentingIndex!==null),ce=ve(e=>[e.shapes,x],(e,t)=>!!t&&Zr(e).some(e=>e.slideOrder!==void 0&&!e.slideSkipped));(0,J.useEffect)(()=>{M&&(Pa(Hy),Pa(eb))},[M]);let le=H(e=>e.deviceMode===`phone`),{setShapeKind:ue,setChartKind:de,setFrameKind:fe,setToolLock:pe,setIconPickerOpen:V,setToolDrawerOpen:me,setPaletteOpen:he,setExportDialog:ge,setImageToCopy:_e,setSlidesOpen:ye,setAiOpen:be,setCodeOpen:xe,setZenMode:Se,setViewMode:Ce,setPresentingIndex:we,zoomIn:Te,zoomOut:Ee,resetZoom:De}=g.getState(),Oe=(0,J.useCallback)(()=>pe(e=>!e),[pe]);return(0,Q.jsxs)(Q.Fragment,{children:[!se&&!ae&&(0,Q.jsxs)(Q.Fragment,{children:[!x&&(0,Q.jsx)(xk,{ref:n,onLoadDocument:r}),(0,Q.jsx)(nA,{}),!oe&&!N&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(EA,{}),(0,Q.jsx)(ek,{tool:C,shapeKind:w,chartKind:T,frameKind:E,onToolChange:i.selectTool,onShapeKind:ue,onChartKind:de,onFrameKind:fe,onInsertControl:i.insertControl,commentsAvailable:S,toolLock:D,onToggleToolLock:Oe})]})]}),(0,Q.jsx)(Ia,{active:O,feature:qy,children:e=>(0,Q.jsx)(e,{onPick:i.placeIcon,onClose:()=>V(!1)})}),(0,Q.jsx)(Ia,{active:k,feature:Yy,children:e=>(0,Q.jsx)(e,{open:!0,onOpenChange:e=>A(e),onPick:i.placeIcon})}),(0,Q.jsx)(Ia,{active:j&&!se,feature:Xy,children:e=>(0,Q.jsx)(e,{onPick:i.runTool,onClose:()=>me(!1)})}),a.showPanel&&!se&&!ae&&!oe&&(0,Q.jsx)(MO,{onDelete:s,onDuplicate:d,style:a.displayStyle,kinds:a.panelKinds,iconsInk:a.iconsInk,iconLabeled:a.iconLabeled,selectionCount:a.selectionCount,shapeKind:a.rectangleKind??w,chart:a.chart,control:a.control,figure:a.figure,web:a.web,icon:a.icon,badge:a.hasBadgeSlot?a.badge??null:void 0,link:a.link,onLink:o.changeLink,textSizing:a.textSizingMode,onChange:o.changeStyle,onChartPatch:o.changeChart,onControlPatch:o.changeControl,onFigurePatch:o.changeFigure,onTextSizing:o.changeTextSizing,onShapeKind:o.changeShapeKind,onPickIcon:o.pickIcon,onBadgePatch:o.patchBadge,onAlign:c,onDistribute:l,onReorder:u}),!se&&(0,Q.jsxs)(Q.Fragment,{children:[!ae&&!le&&(0,Q.jsxs)(`div`,{className:`absolute bottom-4 left-4 flex items-center gap-2`,"data-overlay":!0,children:[(0,Q.jsx)(uA,{containerRef:t,onZoomIn:Te,onZoomOut:Ee,onReset:De,onZoomToFit:p}),!oe&&(0,Q.jsx)(OA,{})]}),ce&&!ae&&(0,Q.jsx)(`div`,{className:`absolute bottom-4 left-1/2 -translate-x-1/2`,"data-overlay":!0,children:(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`share-present`,"aria-label":`Present this deck`,title:`Play the deck full-screen`,onClick:()=>we(0),onPointerEnter:()=>Pa(Hy),onFocus:()=>Pa(Hy),onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto flex h-9 cursor-pointer items-center gap-2 rounded-xl px-4 text-[13px] text-[var(--chrome-fg-800)] transition-colors hover:text-[var(--chrome-fg-900)] ${tl}`,children:[(0,Q.jsx)(dc,{size:13}),`Present`]})}),(0,Q.jsxs)(Fa,{children:[(0,Q.jsx)(FA,{containerRef:t}),ae&&!re&&(0,Q.jsxs)(`button`,{type:`button`,"data-testid":`zen-exit`,"data-overlay":!0,title:`Exit zen mode (${Ec(Z(`zen`))})`,onClick:()=>Se(!1),onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto flex h-8 cursor-pointer items-center gap-1.5 rounded-xl px-3 text-[12px] text-[var(--chrome-fg-600)] transition-colors hover:text-[var(--chrome-fg-900)] ${tl}`,children:[(0,Q.jsx)(As,{size:14,stroke:1.75}),`Exit zen`]}),oe&&!ae&&!b&&(0,Q.jsxs)(`div`,{"data-testid":`view-mode-pill`,"data-overlay":!0,onPointerDown:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),className:`pointer-events-auto flex h-8 items-center gap-2 rounded-xl text-[12px] text-[var(--chrome-fg-600)] ${y?`px-3`:`pl-3 pr-1`} ${tl}`,children:[(0,Q.jsx)(zs,{size:14,stroke:1.75}),`View only`,!y&&(0,Q.jsx)(`button`,{type:`button`,"data-testid":`view-mode-exit`,"aria-label":`Exit view mode`,onClick:()=>Ce(!1),className:`flex h-6 cursor-pointer items-center rounded-lg px-2 text-[var(--chrome-fg-500)] transition-colors hover:bg-[var(--chrome-hover)] hover:text-[var(--chrome-fg-900)]`,children:`Exit`})]}),!ae&&(0,Q.jsx)(cA,{containerRef:t,onBackToContent:m})]}),!ae&&(le?(0,Q.jsx)(oA,{onZoomToFit:p}):(0,Q.jsx)(BA,{})),(0,Q.jsx)(Ia,{active:ee,retain:!0,feature:$y,children:e=>(0,Q.jsx)(e,{open:ee,onOpenChange:he,commands:h})}),!ae&&(0,Q.jsx)(Ia,{active:M,feature:Ly,fallback:(0,Q.jsx)(WA,{width:272,ariaLabel:`Slides`,onDismiss:()=>ye(!1)}),children:e=>(0,Q.jsx)(e,{containerRef:t})}),!ae&&(0,Q.jsx)(Ia,{active:I,feature:zy,children:e=>(0,Q.jsx)(e,{})}),(0,Q.jsx)(Ia,{active:te,retain:!0,feature:Gy,children:e=>(0,Q.jsx)(e,{})}),(0,Q.jsx)(Ia,{active:R,retain:!0,feature:Uy,children:e=>(0,Q.jsx)(e,{onInsert:f})}),(0,Q.jsx)(Ia,{active:z,retain:!0,feature:Wy,children:e=>(0,Q.jsx)(e,{})}),(0,Q.jsx)(Ia,{active:ne!==null,feature:Zy,children:e=>ne&&(0,Q.jsx)(e,{request:ne,onClose:()=>ge(null)})}),(0,Q.jsx)(Ia,{active:L!==null,feature:Qy,children:e=>L&&(0,Q.jsx)(e,{image:L,onClose:()=>_e(null)})}),!ae&&(0,Q.jsx)(Ia,{active:F,retain:!0,feature:Ry,fallback:(0,Q.jsx)(WA,{width:360,ariaLabel:`Diagram code`,onDismiss:()=>xe(!1)}),children:e=>(0,Q.jsx)(e,{containerRef:t})}),!ae&&!le&&(0,Q.jsx)(fA,{}),!ae&&!le&&(0,Q.jsx)(UA,{})]}),_&&(0,Q.jsx)(Ia,{active:P,retain:!0,feature:_,fallback:ae||se?null:(0,Q.jsx)(WA,{width:340,ariaLabel:`AI assistant`,onDismiss:()=>be(!1)}),children:e=>(0,Q.jsx)(e,{containerRef:t,hidden:ae||se||oe})}),(0,Q.jsx)(JA,{loadDocument:r}),(0,Q.jsx)(Ia,{active:se,retain:!0,feature:Hy,children:e=>(0,Q.jsx)(e,{containerRef:t})})]})}var KA=(0,J.memo)(GA),qA=160;function JA(e){let{loadDocument:t}=e,n=U(),{measurement:r}=V(),i=H(e=>e.pendingBoard),{notify:a}=_();function o(){let e=n.getState().pendingBoard;n.getState().setPendingBoard(null),e&&t(e)===`loaded`&&a(ck(e))}function s(){let e=n.getState().pendingBoard;if(n.getState().setPendingBoard(null),!e||e.shapes.length===0)return;let t=n.getState(),i=Bt(t.shapes,r),o=Bt(e.shapes,r),s=i&&o?{x:i.x+i.width+qA-o.x,y:i.y-o.y}:{x:0,y:0},c=sr(e.shapes,s),l=t.shapes.length;t.addMany(c),n.getState().shapes.length!==l&&(t.setSelectedIds(new Set(c.map(e=>e.id))),a(lk(e)))}return(0,Q.jsx)(Mb,{open:i!==null,onOpenChange:e=>{e||n.getState().setPendingBoard(null)},children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:Wc.dialogBackdrop}),(0,Q.jsxs)(ll,{"data-overlay":!0,"data-testid":`drop-confirm`,className:`w-[min(400px,92vw)] p-5 ${Wc.dialogPopup}`,children:[(0,Q.jsx)(fl,{className:`text-[15px] text-[var(--chrome-fg-900)]`,children:`Open this file?`}),(0,Q.jsxs)(pl,{className:`mt-2 text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:[`Replace everything on the canvas with it, or add its content next to what's already here. Either can be undone with `,Ec(Z(`undo`)),`.`]}),(0,Q.jsxs)(`div`,{className:`mt-5 flex justify-end gap-2`,children:[(0,Q.jsx)(dl,{className:`h-8 rounded-full px-3.5 text-[13px] text-[var(--chrome-fg-600)] outline-none transition-colors hover:bg-[var(--chrome-divider)]`,children:`Cancel`}),(0,Q.jsx)(dl,{"data-testid":`drop-confirm-add`,onClick:s,className:`h-8 rounded-full px-3.5 text-[13px] text-[var(--chrome-fg-900)] outline-none ring-1 ring-[var(--chrome-ring)] transition-colors hover:bg-[var(--chrome-hover)]`,children:`Add next to canvas`}),(0,Q.jsx)(dl,{"data-testid":`drop-confirm-accept`,onClick:o,className:`h-8 rounded-full bg-[var(--chrome-accent)] px-3.5 text-[13px] text-white outline-none transition-colors hover:bg-[var(--chrome-accent-hover)]`,children:`Replace canvas`})]})]})]})})}var YA=2560,XA=.9,ZA=3e5;async function QA(e,t,n,r,i){let a=await $A(e,i);if(!a)return null;let o=t?t.width/n.zoom:1e3,s=t?t.height/n.zoom:700,c=Math.min(1,o*.8/a.width,s*.8/a.height),l=a.width*c,u=a.height*c,d=r??(t?Cr({x:t.width/2,y:t.height/2},n):{x:0,y:0});return{id:Yn(),type:`image`,x:d.x-l/2,y:d.y-u/2,width:l,height:u,rotation:0,src:a.url,crop:{x:0,y:0,width:1,height:1},opacity:1}}async function $A(e,t){if(e.type===`image/svg+xml`){let t=gd(await e.text().catch(()=>``));if(t)return{url:_d(t.markup),width:t.width,height:t.height}}return Id(e,{maxEdge:YA,quality:XA,minBytes:ZA,keepPng:`when-transparent`},t)}function ej(e,t,n,r,i={}){let a=W(e),o=Math.min(a.width*.4,a.height*.72)/Math.max(t,n);i.noUpscale&&(o=Math.min(o,1));let s=t*o,c=n*o,l=a.width*.06,u=a.height*.06,d=[{x:a.x+a.width-s-l,y:a.y+(a.height-c)/2},{x:a.x+l,y:a.y+(a.height-c)/2},{x:a.x+(a.width-s)/2,y:a.y+a.height-c-u},{x:a.x+(a.width-s)/2,y:a.y+u},{x:a.x+(a.width-s)/2,y:a.y+(a.height-c)/2}],f=Vr(r,e).filter(e=>e.type!==`figure`&&e.type!==`arrow`&&e.type!==`line`&&e.type!==`draw`),p=d.find(e=>!f.some(t=>ot(W(t),{x:e.x,y:e.y,width:s,height:c})))??d[0];return{x:p.x,y:p.y,width:s,height:c}}function tj(e){let{status:t,savedToAccount:n,failed:r}=e;return t===`auth-required`?`Sign in to save. Your work is safe on this device meanwhile.`:t===`conflict`?`Saving is stopped: this canvas changed somewhere else.`:t===`rejected`?`This canvas can't be saved to your account. Your work is safe on this device.`:t===`too-large`?`This canvas is too large to save. Remove images or large shapes.`:t===`storage-error`?`This device's storage is full, so changes aren't kept here.`:r||t===`error`||t===`retrying`?`Not saved yet, still trying. Leave this tab open.`:n?`Saved. This canvas saves itself as you work.`:`Saved on this device. Your sketch saves itself as you work.`}function nj(e){let{containerRef:t}=e,n=U(),r=V(),i=B(),{notify:a}=_(),{addShape:o,loadShapes:s,setViewport:c,fitToBounds:l,setSelectedIds:u,endEdit:d,setLockRevealId:f,setPendingBoard:p}=n.getState(),m=(0,J.useCallback)(()=>{let{shapes:e,selectedIds:t}=n.getState(),i=sa(e,t);return i.length>0?Kr(e,i,r.measurement):e},[n,r.measurement]),h=(0,J.useCallback)(e=>{if(n.getState().viewModeLocked)return a(`This canvas is view only.`),`refused`;let i=ke(e.shapes.length,`open`);if(i?.kind===`block`)return a(i.message),`refused`;if(i?a(i.message):e.skipped>0&&a(ck(e)),s(e.shapes),e.viewport)c(e.viewport);else{let n=t.current;n&&l(Bt(e.shapes,r.measurement),{width:n.clientWidth,height:n.clientHeight})}return u(new Set),d(),i||e.skipped>0?`warned`:`loaded`},[n,t,r.measurement,s,c,l,u,d,a]),g=(0,J.useCallback)((e,r)=>{QA(e,t.current?.getBoundingClientRect()??null,n.getState().viewport,r,i.decodeHeic).then(t=>{if(!t){let t=/\.(\w+)$/.exec(e.name)?.[1]??e.type.split(`/`)[1];a(t?`Unsupported image type (.${t.toLowerCase()})`:`Couldn't read that image`);return}let i=t;if(!r&&t.type===`image`){let e=n.getState(),r=[...e.selectedIds],a=r.length===1?e.shapes.find(e=>e.id===r[0]&&e.type===`figure`):void 0;if(a){let n=ej(a,t.width,t.height,e.shapes,{noUpscale:!0});i={...t,...n}}}o(i),u(new Set([i.id]))})},[t,n,o,u,a,i.decodeHeic]),v=(0,J.useCallback)(e=>{let r=[...e.dataTransfer.files],i=t.current?.getBoundingClientRect(),s=i?Cr({x:e.clientX-i.left,y:e.clientY-i.top},n.getState().viewport):null;if(r.length===0){let t=Fh(e.dataTransfer.getData(`text/uri-list`));if(!t||!s)return;let r=e=>{let r=e.embedFromPaste(t);if(!r||n.getState().viewMode)return;let i=Ih(r,s);o(i),u(new Set([i.id]))},i=cg();if(!i){e.preventDefault(),lg().then(r,()=>{});return}if(!i.embedFromPaste(t))return;e.preventDefault(),r(i);return}if(e.preventDefault(),n.getState().viewMode)return;let c=r.find(e=>/\.(kby|excalidraw|tldr)$/i.test(e.name)||e.type===`application/json`);if(c){fk(c).then(e=>{if(n.getState().shapes.length>0){p(e);return}h(e)===`loaded`&&a(ck(e))}).catch(e=>{a(e instanceof Error?e.message:`Couldn't open that file`)});return}let l=r.filter(jd);if(l.length===0){a(`Unsupported file type`);return}l.forEach((e,t)=>{let n=s?{x:s.x+t*24,y:s.y+t*24}:void 0;g(e,n)})},[t,n,g,o,u,h,p,a]),y=(0,J.useCallback)(e=>{let t=e.dataTransfer.types;(t.includes(`Files`)||t.includes(`text/uri-list`))&&e.preventDefault(),t.includes(`text/uri-list`)&&ug()},[]),b=(0,J.useRef)(i.saveStatus);b.current=i.saveStatus;let x=i.onSaveNow,S=i.canvasMeta!=null,C=(0,J.useCallback)(async()=>{if(!x)return;let e=!1;try{await x()}catch{e=!0}a(tj({status:b.current,savedToAccount:S,failed:e}))},[x,S,a]),w=(0,J.useCallback)(()=>{s([]),u(new Set),d(),f(null)},[s,u,d,f]);return(0,J.useMemo)(()=>({exportTargets:m,loadDocument:h,addImageFromFile:g,onCanvasDrop:v,onCanvasDragOver:y,clearCanvas:w,saveNow:C}),[m,h,g,v,y,w,C])}function rj(e,t,n,r,i){let a=new Map(t.map(e=>[e.id,e])),o=new Map(n.map(e=>[e.id,e]));for(let t of n){let n=a.get(t.id);if(t.type!==`figure`||n?.type!==`figure`)continue;let s={x:t.x-n.x,y:t.y-n.y};if(!(s.x===0&&s.y===0))for(let t of km(e,[n],{activeGroupId:r,measurement:i}))o.has(t.id)||o.set(t.id,Ln(t,s))}return[...o.values()]}function ij(e){let{replaceMany:t,removeShapes:n,setSelectedIds:r,setTool:i,setLockRevealId:a,bringToFront:o,bringForward:s,sendBackward:c,sendToBack:l}=e,u=U(),d=V().measurement,f=(0,J.useCallback)((e,n)=>{let{shapes:r,selectedIds:i,activeGroupId:a}=u.getState(),o=Ar(r,i);if(o.length===0)return;let s=km(r,o,{activeGroupId:a,measurement:d}),c=new Set(s.map(e=>e.id)),l={x:e,y:n};t(s.map(e=>Ne(e,l,r,c,d)),ze(s))},[u,t,d]),p=(0,J.useCallback)(e=>{let n=u.getState(),r=sa(n.shapes,n.selectedIds);t(rj(n.shapes,r,ql(r,e,d),n.activeGroupId,d))},[u,t,d]),m=(0,J.useCallback)(e=>{let n=u.getState(),r=sa(n.shapes,n.selectedIds);t(rj(n.shapes,r,Jl(r,e,d),n.activeGroupId,d))},[u,t,d]),h=(0,J.useCallback)(e=>{let{selectedIds:t}=u.getState();if(t.size===0)return;let n={front:o,forward:s,backward:c,back:l}[e];n(t)},[u,o,s,c,l]),g=(0,J.useCallback)(()=>{let e=u.getState(),t=e.shapes.filter(t=>e.selectedIds.has(t.id)&&!t.locked);t.length!==0&&(n(new Set(t.map(e=>e.id))),r(new Set))},[u,n,r]),_=(0,J.useCallback)(e=>{let{shapes:n,selectedIds:r,activeGroupId:i}=u.getState(),a=sa(n,r);if(a.length===0)return;let o=km(n,a,{activeGroupId:i,measurement:d});t($n(o,e))},[u,t,d]),v=(0,J.useCallback)(()=>{i(`select`);let{shapes:e}=u.getState();r(new Set(e.filter(e=>!e.locked).map(e=>e.id))),a(null)},[u,i,r,a]);return(0,J.useMemo)(()=>({nudgeSelection:f,alignSelection:p,distributeSelection:m,reorderSelection:h,deleteSelection:g,flipSelection:_,selectAll:v}),[f,p,m,h,g,_,v])}var aj=[];function oj(e){let{recentDrillRef:t,interactive:n}=e,r=U(),{history:i}=V(),a=ve(e=>[e.shapes,e.selectedIds],(e,t)=>t.size===0?aj:Ar(e,t),Te),o=H(e=>xe(e.editSession)),s=H(e=>he(e.editSession)),c=H(e=>e.activeGroupId),l=H(e=>e.viewMode),u=Pc(),{addShape:d,replaceShape:f,replaceMany:p,updateShape:m,removeShape:h,removeShapes:g,bringToFront:_,sendToBack:v,bringForward:y,sendBackward:b,setTool:x,setSelectedIds:S,beginTextEdit:C,beginTableCellEdit:w,beginChartDataEdit:T,beginCrop:E,beginVertexEdit:D,beginInteract:O,endEdit:k,setHoveredId:A,setActiveGroupId:j,setLockRevealId:ee}=r.getState(),M=ve(e=>[e.shapes,e.lockRevealId],vu,Te),N=ve(e=>[e.shapes,e.hoveredId],(e,t)=>t?!!xr(e,t)?.locked:!1),P=H(e=>e.editSession.kind===`interact`),F=!s&&!P&&a.length===1&&a[0].id===o,I=n&&a.length>0&&!F&&!l,te=Kp(a,c),ne=(0,J.useCallback)((e,n=`label`)=>{if(t.current===e){t.current=null;return}let a=r.getState();if(a.viewMode)return;let o=xr(a.shapes,e);if(o?.locked){ee(o.id),S(new Set);return}if(o?.groupId&&o.groupId!==a.activeGroupId){j(o.groupId),S(new Set);return}if(S(new Set([e])),o?.type===`web`){let t=cg()?.webMount(o,u)??null;if(!t)return;t.kind===`embed`&&t.embed.video&&a.startWeb(e),O(e);return}if(o?.type===`chart`){T(e);return}if(o?.type===`rectangle`){let t=nn(o);t<o.fontSize&&i.runWithoutHistory(()=>m(e,{fontSize:t}))}C(e,n)},[t,r,i,m,ee,S,j,T,C,O,u]),L=(0,J.useCallback)((e,t,n)=>{r.getState().viewMode||(S(new Set([e])),w(e,t,n))},[r,S,w]),R=(0,J.useCallback)(e=>{r.getState().viewMode||(S(new Set([e])),E(e))},[r,S,E]),z=(0,J.useCallback)(e=>{r.getState().viewMode||(S(new Set([e])),D(e))},[r,S,D]),B=(0,J.useCallback)((e,t,n=`label`)=>{let a=It(t),o=a?Tn(t):t.trim().length===0,s=o?``:a?t:t.trim(),c=o?``:a?t:t.replace(/\n$/,``),l=xr(r.getState().shapes,e),u=t=>{let n=l;Object.entries(t).some(([e,t])=>(n?.[e]??``)!==t)&&m(e,t)};if(l?.type===`control`){u({[AC(l,n)??`label`]:s}),k(e);return}let f=l?tn[l.type].textField:null;if(f===`label`){u({label:s}),k(e);return}if(f===`text`){u({text:s}),k(e);return}if(!l||l.type!==`text`){k(e);return}let p=l.text===``;if(o){p?i.runWithoutHistory(()=>h(e)):h(e),S(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n}),k(e);return}p?(i.runWithoutHistory(()=>h(e)),d({...l,text:c})):l.text!==c&&m(e,{text:c}),S(new Set([e])),k(e)},[r,i,d,h,m,S,k]),re=(0,J.useCallback)(()=>{let{shapes:e,selectedIds:t,activeGroupId:n}=r.getState(),i=e.filter(e=>t.has(e.id)),a=i[0]?.groupId;if(a&&Kp(i,n)){j(a),S(new Set);return}if(i.length!==1)return;let o=i[0],s=tn[o.type].edit;if(s===`crop`){R(o.id);return}if(s===`vertices`){z(o.id);return}if(s===`interact`){ne(o.id);return}if(o.type===`table`){L(o.id,0,0);return}o.type!==`draw`&&ne(o.id)},[r,ne,L,R,z,S,j]),ie=(0,J.useCallback)(e=>{let t=xr(r.getState().shapes,e);if(!(!t||t.type!==`arrow`)){if(t.bendStyle===`elbow`){f({...t,elbowMid:void 0,elbowPoints:void 0,elbowRoute:void 0,elbowMidHandle:void 0});return}f({...t,bend:0,bendAlong:0,bow:0,bowAlong:0})}},[r,f]),ae=(0,J.useCallback)(e=>A(e),[A]),oe=ij({replaceMany:p,removeShapes:g,setSelectedIds:S,setTool:x,setLockRevealId:ee,bringToFront:_,bringForward:y,sendBackward:b,sendToBack:v});return(0,J.useMemo)(()=>({selectedShapes:a,revealedUnit:M,hoveringLocked:N,showSelection:I,selectionIsGroup:te,beginEdit:ne,beginEditCell:L,beginCrop:R,beginVertexEdit:z,commitText:B,editSelection:re,resetArrowBend:ie,onHover:ae,...oe}),[a,M,N,I,te,ne,L,R,z,B,re,ie,ae,oe])}function sj(e,t){return e===void 0||t===void 0?e===t:Ov(e,t)}function cj(e){let{selectedShapes:t}=e,n=H(e=>e.editSession),r=H(e=>e.tool),i=H(e=>e.style),a=r===`line`?`arrow`:r===`polyline`?`line`:r===`highlight`?`draw`:r,o=Ev(new Set(t.length>0?t.map(e=>e.type):a===`rectangle`||a===`arrow`||a===`text`||a===`draw`||a===`line`||a===`polygon`||a===`sticky`?[a]:[]),Dv),s=o.size>0,c=n.kind===`chart-data`?t.find(e=>e.type===`chart`&&e.id===n.shapeId):void 0,l=t.every(e=>e.type!==`icon`||!Li(e.source)||Ii(e.source)),u=t.some(e=>e.type===`icon`&&e.label.trim().length>0),d=t[0],f=t.find(e=>e.type===`text`),p=Ev(th(d,i),Ov),m=t.find(e=>e.type===`icon`),h=d?.type===`rectangle`?d.kind:void 0,g=Ev(d?.type===`rectangle`?d.titleIcon??void 0:void 0,sj),_=d?.type===`rectangle`,v=(d?.type===`rectangle`||d?.type===`control`)&&t.length===1?d.link??``:void 0,y=f?.type===`text`?mr(f):void 0,b=Ev(m?.type===`icon`?{name:m.name,source:m.source}:void 0,sj),x=t.length,S=d?.type===`chart`?d:void 0,C=d?.type===`control`?d:void 0,w=d?.type===`figure`?d:void 0,T=d?.type===`web`&&t.length===1?d:void 0,E=Ev(T?{id:T.id,kind:T.kind,url:T.url,keepAspect:T.keepAspect===!0,html:T.html,htmlSrc:T.htmlSrc}:void 0,sj);return(0,J.useMemo)(()=>({panelKinds:o,showPanel:s,displayStyle:p,iconsInk:l,iconLabeled:u,selectionCount:x,rectangleKind:h,hasBadgeSlot:_,badge:g,link:v,textSizingMode:y,icon:b,chart:S,control:C,figure:w,web:E,editingChart:c}),[o,s,p,l,u,x,h,_,g,v,y,b,S,C,w,E,c])}function lj(e){let{containerRef:t,fileInputRef:n}=e,r=U(),{notify:i}=_(),a=H(e=>e.tool),o=H(e=>e.pendingIcon),s=H(e=>e.pendingControl),{askAi:c,setTool:l,setSelectedIds:u,endEdit:d,setStyle:f,setShapeKind:p,setChartKind:m,setFrameKind:h,setPendingIcon:g,setPendingControl:v,setIconPickerOpen:y,setCommentsVisible:b,setLockRevealId:x,setPresentingIndex:S,setShowGrid:C,setSnapEnabled:w,setPresentationAnimation:T,setShowZoomIndicator:E,setWebEmbedDialog:D}=r.getState(),O=(0,J.useCallback)(e=>{l(`select`),g(null),v(e)},[l,g,v]),k=(0,J.useCallback)(e=>{if(g(null),v(null),x(null),f(()=>{let t={...vt};return(e===`line`||e===`polyline`||e===`polygon`)&&(t.startArrow=!1,t.endArrow=!1),e===`sticky`&&(t.fill=Mi),e===`highlight`&&(t.color=gt,t.opacity=Dt,t.strokeWidth=wt),t}),e===`image`){l(`select`),n.current?.click();return}if(e===`icon`){l(`select`),y(!0);return}l(e),e===`comment`&&b(!0),(uj.has(e)||e===`eraser`||e===`laser`)&&(u(new Set),d())},[n,g,v,x,f,l,y,b,u,d]),A=(0,J.useCallback)(e=>{cs(e,{selectTool:k,setShapeKind:p,setChartKind:m,setFrameKind:h,insertControl:O,askAi:c,openWebEmbed:()=>{l(`select`),D({mode:`insert`})}})},[k,p,m,h,O,c,l,D]),j=(0,J.useCallback)((e,t)=>{y(!1),Hc(t,e,g)},[g,y]),ee=(0,J.useCallback)((e=`current`)=>{let n=r.getState(),a=Jr(n.shapes);if(a.length===0){i(`No slides to present. Draw a frame first`);return}if(a.every(e=>e.slideSkipped)){i(`Every slide is skipped. Unskip one to present`);return}if(e===`beginning`){S(0);return}let o=t.current,s={width:o?.clientWidth??0,height:o?.clientHeight??0};S(Math.max(0,ii(a,n.viewport,s)))},[r,t,S,i]),M=(0,J.useCallback)(()=>{C(e=>!e)},[C]),N=(0,J.useCallback)(()=>{w(e=>!e)},[w]),P=(0,J.useCallback)(()=>{T(e=>!e)},[T]),F=(0,J.useCallback)(()=>{E(e=>!e)},[E]);return(0,J.useMemo)(()=>({tool:a,pendingIcon:o,pendingControl:s,insertControl:O,selectTool:k,runTool:A,placeIcon:j,startPresentation:ee,toggleGrid:M,toggleSnap:N,togglePresentationAnimation:P,toggleShowZoomIndicator:F}),[a,o,s,O,k,A,j,ee,M,N,P,F])}var uj=new Set([`rectangle`,`arrow`,`line`,`polyline`,`polygon`,`text`,`draw`,`highlight`]);function dj(e){let{hasInitialViewport:t,onDocumentChange:n,onViewportChange:r,onPreferencesChange:i}=e,{ai:a,resolveShortLink:o}=B(),s=Nc(),c=U(),l=V(),u=(0,J.useRef)(null),d=(0,J.useRef)(null),f=(0,J.useRef)(null),p=(0,J.useRef)(!1),m=(0,J.useRef)(null),h=Zh();ju();let g=Is(`frame`),_=H(e=>e.embedSignInOpen),v=H(e=>e.setEmbedSignInOpen);(0,J.useEffect)(()=>{let e=l.measurementRoot;return e.current=u.current,()=>{e.current=null}},[l]),(0,J.useEffect)(()=>{let e=l.editEntry;function t(t){t.target instanceof Node&&u.current?.contains(t.target)&&e.note({x:t.clientX,y:t.clientY})}return window.addEventListener(`dblclick`,t,!0),()=>window.removeEventListener(`dblclick`,t,!0)},[l]),(0,J.useEffect)(()=>{h&&l.history.runWithoutHistory(()=>{l.store.getState().remeasureBindings()})},[h,l]);let y=H(e=>e.presentingIndex!==null),b=H(e=>e.viewMode),S=H(e=>e.isPanning),C=H(e=>e.dragging),{addShape:w,addMany:T,replaceShape:E,replaceMany:D,updateShape:O,removeShapes:k,setSelectedIds:A,beginLaneEdit:j,endEdit:ee,setActiveGroupId:M,setStyle:N,setShapeKind:P,setLockRevealId:F,zoomIn:I,zoomOut:te,resetZoom:ne,fitToBounds:L}=c.getState(),R=lj({containerRef:u,fileInputRef:d}),z=Vo(`Space`,{preventDefault:!0}),re=R.tool===`hand`||z,ie=R.tool===`select`&&!re&&!R.pendingIcon&&!R.pendingControl;my(`CanvasBody`);let ae=qv({containerRef:u,panMode:re,pinchingRef:p});iy({containerRef:u,pinchingRef:p,onPinchStart:ae.cancelGesture}),Zv(u),ty(u),cy();let oe=oj({recentDrillRef:ae.recentDrillRef,interactive:ie}),{commitPolyline:se,interceptContextMenu:ce}=ae,{beginEdit:le}=oe,ue=cj({selectedShapes:oe.selectedShapes}),de=nj({containerRef:u}),fe=fy({updateShape:O,beginLaneEdit:j,endEdit:ee,setSelectedIds:A,setActiveGroupId:M}),pe=uy(),me=dy({replaceShape:E,endEdit:ee,refitRows:pe.refitRows,remapCellHeights:pe.remapCellHeights}),he=Pm({replaceMany:D,removeShapes:k,addShape:w,addMany:T,setSelectedIds:A,setLockRevealId:F}),ge=py({replaceMany:D,setStyle:N,setShapeKind:P}),_e=Bh({containerRef:u,addShape:w,setSelectedIds:A}),ve=Vm(),ye=Lm({containerRef:u,fitToBounds:L,zoomIn:I,zoomOut:te,resetZoom:ne}),be=(0,J.useCallback)(e=>{if(R.tool===`polyline`||R.tool===`polygon`){se();return}if(!ie)return;let t=u.current;if(!(e.target instanceof Element)||!t?.contains(e.target)||e.target.closest(`[data-overlay]`)||e.target instanceof Element&&e.target.closest(`[data-shape-id], [data-testid="selection-surface"]`))return;let n=u.current;if(!n)return;let{shapes:r,style:i,viewport:a}=c.getState(),o=n.getBoundingClientRect(),s=Cr({x:e.clientX-o.left,y:e.clientY-o.top},a),d=Ou(r,s,l.measurement);if(d.kind===`label`){le(d.id);return}if(d.kind===`shape`)return;let f=gu({x:s.x,y:s.y-i.fontSize/2},i);l.history.runWithoutHistory(()=>w(f)),le(f.id)},[R.tool,ie,c,l.measurement,l.history,w,le,se]),xe=(0,J.useCallback)(e=>{if(ce(e))return;let t=u.current;if(!t)return;let n=c.getState(),{shapes:r}=n,i=t.getBoundingClientRect(),a=Cr({x:e.clientX-i.left,y:e.clientY-i.top},n.viewport);m.current=a;let o=Au(n,a,Pe(r,a,void 0,l.measurement)??zu(r,e.clientX,e.clientY),l.measurement);o&&(F(o.lockRevealId),A(o.selectedIds))},[ce,c,l.measurement,A,F]);Ru(u,t),Mu({onDocumentChange:n,onViewportChange:r,onPreferencesChange:i}),Qh(),rg(),ig(),om({commitPolyline:ae.commitPolyline,removeLastPolylinePoint:ae.removeLastPolylinePoint,cancelPolyline:ae.cancelPolyline,nudgeSelection:oe.nudgeSelection,copySelection:_e.copySelection,cutSelection:_e.cutSelection,pasteClipboard:_e.pasteClipboard,pasteAsText:()=>void _e.pasteAsText(),pasteText:_e.pasteText,pasteEmbed:_e.pasteEmbed,pasteHtmlWidget:_e.pasteHtmlWidget,pasteColors:_e.pasteColors,applyColor:ge.applyEyedropper,hasSelection:()=>c.getState().selectedIds.size>0,pasteMermaid:_e.pasteMermaid,resolveShortLink:o,selectTool:R.selectTool,insertControl:R.insertControl,addComment:()=>{if(ve.available){if(c.getState().selectedIds.size>0){ve.commentOnSelection();return}R.selectTool(`comment`)}},addImageFromFile:de.addImageFromFile,hasClipboard:_e.hasClipboard,clipboardCopyId:_e.clipboardCopyId,pasteExternal:_e.pasteExternal,pasteGrid:_e.pasteGrid,duplicate:_e.duplicateSelection,flip:oe.flipSelection,reorder:oe.reorderSelection,align:oe.alignSelection,tidy:he.tidySelection,copyStyles:_e.copyStyles,pasteStyles:_e.pasteStyles,toggleLock:he.toggleLock,copyPng:()=>void s(`copyPng`,de.exportTargets()),zoomIn:ye.zoomInCentered,zoomOut:ye.zoomOutCentered,resetZoom:ye.resetZoomCentered,zoomToFit:ye.zoomToFit,startPresentation:R.startPresentation,openFile:()=>f.current?.openFile(),saveNow:()=>void de.saveNow(),editSelection:oe.editSelection,eyedrop:()=>void Ea().then(e=>{e&&ge.applyEyedropper(e)})});let Se=`default`;S?Se=`grabbing`:re?Se=`grab`:C?Se=`move`:uj.has(R.tool)||R.pendingIcon||R.pendingControl||R.tool===`eraser`||R.tool===`comment`?Se=`crosshair`:ie&&oe.hoveringLocked&&oe.revealedUnit.length===0&&(Se=`not-allowed`);let Ce=lm({pasteClipboard:_e.pasteClipboard,pasteAsText:_e.pasteAsText,selectAll:oe.selectAll,clearCanvas:de.clearCanvas,startPresentation:R.startPresentation,zoomToFit:ye.zoomToFit,resetZoom:ye.resetZoomCentered,backToContent:ye.backToContent,toggleGrid:R.toggleGrid,zoomToSelection:ye.zoomToSelection});return(0,Q.jsx)(x,{delay:0,children:(0,Q.jsx)(Fy,{buildModel:Im({selection:oe,documents:de,tools:R,paste:_e,structure:he,tables:me,zoom:ye,comments:ve,ai:a,embedFrame:g,pasteTargetRef:m}),children:(0,Q.jsxs)(`div`,{ref:u,"data-testid":`canvas`,"data-canvas-root":!0,className:`relative h-dvh w-screen touch-none select-none overflow-clip bg-[var(--canvas-bg)]`,style:{cursor:y?Na:Se,contain:`strict`,visibility:h?void 0:`hidden`},onPointerDown:y?void 0:ae.onContainerPointerDown,onPointerMove:y?void 0:ae.onContainerPointerMove,onPointerLeave:y?void 0:ae.onContainerPointerLeave,onClick:y?void 0:ae.onContainerClick,onDoubleClick:y||b?void 0:be,onContextMenu:y?void 0:xe,onDragOver:y||b?void 0:de.onCanvasDragOver,onDrop:y||b?void 0:de.onCanvasDrop,children:[(0,Q.jsx)(`input`,{ref:d,type:`file`,accept:`image/*,.heic,.heif`,className:`hidden`,"data-testid":`canvas-image-input`,onChange:e=>{let t=e.target.files?.[0];t&&de.addImageFromFile(t),e.target.value=``}}),(0,Q.jsx)(gD,{containerRef:u,interactive:ie,interaction:ae,selection:oe,panel:ue,tables:me,lanes:fe,measure:pe,pasteChoiceOpen:_e.pasteChoiceOpen,resolvePasteChoice:_e.resolvePasteChoice,unlockReveal:he.unlockReveal}),(0,Q.jsx)(KA,{containerRef:u,mainMenuRef:f,loadDocument:de.loadDocument,tools:R,panel:ue,styles:ge,deleteSelection:oe.deleteSelection,alignSelection:oe.alignSelection,distributeSelection:oe.distributeSelection,reorderSelection:oe.reorderSelection,duplicateSelection:_e.duplicateSelection,pasteEmbed:_e.pasteEmbed,zoomToFit:ye.zoomToFit,backToContent:ye.backToContent,paletteCommands:Ce}),he.tidyState.status===`loading`?(0,Q.jsx)(Ra,{testId:`tidy-pending`,tone:`pending`,children:`Tidying up…`}):null,he.tidyState.status===`failed`?(0,Q.jsx)(Ra,{testId:`tidy-error`,tone:`error`,action:{label:`Retry`,testId:`tidy-retry`,onClick:he.tidyState.retry},children:`Couldn't load the layout engine`}):null,(0,Q.jsx)(ib,{open:_,onOpenChange:v,title:`Sign in to embed this frame`,description:`Embedding puts a live image of this frame on any page — it updates as you edit. Sign in to save this canvas and get its link.`})]})})})}function fj(){let[e,t]=(0,J.useState)(!0),n=H(e=>e.deviceMode===`phone`);return(0,Q.jsx)(ul,{open:e,onOpenChange:t,children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:`fixed inset-0 z-50 bg-gray-900/15`}),(0,Q.jsx)(ll,{"data-overlay":!0,"data-testid":`icon-library-guide-dialog`,className:`fixed top-1/2 left-1/2 z-50 max-h-[92vh] w-[min(560px,92vw)] -translate-x-1/2 -translate-y-1/2 overflow-y-auto rounded-2xl bg-[var(--chrome-popup)] p-6 outline-none ring-1 ring-[var(--chrome-ring)]`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-center`,children:[(0,Q.jsx)(fl,{className:`text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:`Where the icons live`}),(0,Q.jsx)(`img`,{src:`/icon-picker-guide.webp`,alt:`The canvas toolbar, with the smiley icon button near the bottom marked 1, and the panel it opens marked 2.`,width:1494,height:1208,className:`w-full rounded-xl ring-1 ring-[var(--chrome-ring)]`,draggable:!1}),n?(0,Q.jsx)(pl,{className:`text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:`Follow the steps above to open the icon library, then tap an icon to place it.`}):(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-1.5 gap-y-1 text-[13px] text-[var(--chrome-fg-500)]`,children:[(0,Q.jsx)(`span`,{children:`Follow the steps above, or press`}),(0,Q.jsx)(mA,{children:`Shift`}),(0,Q.jsx)(mA,{children:`S`}),(0,Q.jsx)(`span`,{children:`to search the library.`})]}),(0,Q.jsx)(dl,{className:`mt-3 h-8 rounded-xl bg-[var(--chrome-accent)] px-3.5 text-[13px] text-white outline-none transition-colors hover:bg-[var(--chrome-accent-hover)] active:scale-[0.97]`,children:`Start drawing`})]})})]})})}function pj(e){let{icon:t}=e,[n,r]=(0,J.useState)(!0),i=H(e=>e.deviceMode===`phone`);return(0,Q.jsx)(ul,{open:n,onOpenChange:r,children:(0,Q.jsxs)(sl,{children:[(0,Q.jsx)(ol,{className:`fixed inset-0 z-50 bg-gray-900/15`}),(0,Q.jsx)(ll,{"data-overlay":!0,"data-testid":`icon-welcome-dialog`,className:`fixed left-1/2 top-1/2 z-50 w-[min(400px,92vw)] -translate-x-1/2 -translate-y-1/2 rounded-2xl bg-[var(--chrome-popup)] p-6 outline-none ring-1 ring-[var(--chrome-ring)]`,children:(0,Q.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-center`,children:[Li(t.source)&&(0,Q.jsx)(`div`,{className:`mb-1 grid h-20 w-20 place-items-center rounded-xl bg-[var(--chrome-hover)] ring-1 ring-[var(--chrome-ring)]`,children:(0,Q.jsx)(`img`,{src:Ri().assetIconUrl(t.source,t.name),alt:``,width:52,height:52,draggable:!1})}),(0,Q.jsx)(fl,{className:`text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:`Icon has been selected`}),(0,Q.jsx)(pl,{className:`text-[13px] leading-relaxed text-[var(--chrome-fg-500)]`,children:i?`Your icon is ready to place — tap anywhere on the canvas to drop it, then keep sketching.`:`Your icon is riding the cursor — click anywhere on the canvas to place it, then start drawing with your mouse.`}),!i&&(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-1.5 gap-y-1 text-[13px] text-[var(--chrome-fg-500)]`,children:[(0,Q.jsx)(`span`,{children:`Press`}),(0,Q.jsx)(mA,{children:`Shift`}),(0,Q.jsx)(mA,{children:`S`}),(0,Q.jsx)(`span`,{children:`to search the library for more icons.`})]}),(0,Q.jsx)(dl,{className:`mt-3 h-8 rounded-xl bg-[var(--chrome-accent)] px-3.5 text-[13px] text-white outline-none transition-colors hover:bg-[var(--chrome-accent-hover)] active:scale-[0.97]`,children:`Start drawing`})]})})]})})}var mj=80;function hj(e){let{apiUrl:t,assistant:n,debug:r,canvasMeta:i,saveStatus:a,readOnly:o,readOnlyPill:s,publicShare:c,shareOwner:l,widgetOrigin:u,onSaveCanvas:d,onSaveNow:f,autoSavePrompt:p,documentEmpty:m,onSaveDismissed:h,saveAtLimit:g,saveDestination:_,onForkCanvas:v,forkAtLimit:y,workspaceId:b,workspaceName:x,location:S,onDuplicateCanvas:C,onMoveCanvas:w,onEditCanvasMeta:T,onDeleteCanvas:E,scratch:D,onNewCanvas:O,onShowCanvases:k,onOpenShare:A,onEmbedFrame:j,account:ee,uploadImage:M,decodeHeic:N,searchIcons:P,resolveShortLink:F,embed:I,presence:te,comments:ne}=e,L=t!=null&&n!=null&&o!==!0,R=(0,J.useMemo)(()=>({apiUrl:t,ai:L,assistant:L?n:void 0,canvasMeta:i,saveStatus:a,readOnly:o,readOnlyPill:s,publicShare:c,shareOwner:l,widgetOrigin:u,onSaveCanvas:d,onSaveNow:f,autoSavePrompt:p,documentEmpty:m,onSaveDismissed:h,saveAtLimit:g,saveDestination:_,onForkCanvas:v,forkAtLimit:y,workspaceId:b,workspaceName:x,location:S,onDuplicateCanvas:C,onMoveCanvas:w,onEditCanvasMeta:T,onDeleteCanvas:E,scratch:D,onNewCanvas:O,onShowCanvases:k,onOpenShare:A,onEmbedFrame:j,account:ee,uploadImage:M,decodeHeic:N,searchIcons:P,resolveShortLink:F,embed:I,presence:te,comments:ne}),[t,L,n,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A,j,ee,M,N,P,F,I,te,ne]),[z]=(0,J.useState)(()=>{let t=hu({document:e.initialDocument??null,viewport:e.initialViewport??null,preferences:e.initialPreferences??null});if(e.readOnly&&(t.store.getState().setViewMode(!0),t.store.getState().setViewModeLocked(!0)),e.initialPendingIcon&&!e.readOnly){let{source:n,name:r}=e.initialPendingIcon;Hc(n,r,e=>t.store.getState().setPendingIcon(e))}return e.initialDiagramCode&&!e.readOnly&&(t.store.getState().setCodeOpen(!0),t.store.getState().setCodeSeed(e.initialDiagramCode)),t}),B=z.store,re=(0,J.useRef)(e.readOnly===!0);(0,J.useEffect)(()=>{let e=o===!0;if(re.current===e)return;re.current=e;let t=B.getState();if(e){t.setViewMode(!0),t.setViewModeLocked(!0);return}t.setViewModeLocked(!1),t.setViewMode(!1)},[o,B]);let[ie]=(0,J.useState)(()=>e.environment??Ti({elk:Ei}));(0,J.useEffect)(()=>()=>z.dispose(),[z]),(0,J.useEffect)(()=>{let t=e.bindEditorApi;if(t)return t({loadShapes:e=>B.getState().loadShapes(e),adoptShapes:e=>z.history.applyRemote(le(B.getState().shapes,e)),applyRemote:e=>z.history.applyRemote(e),setRemoteCursors:e=>B.getState().setRemoteCursors(e),revealShapes:e=>{let t=B.getState(),n=new Set(e),r=Bt(t.shapes.filter(e=>n.has(e.id))),i=z.measurementRoot.current;if(!r||!(i instanceof HTMLElement))return;let a={width:i.clientWidth,height:i.clientHeight};z.viewportAnimation.animate(t.viewport,si(r,a,mj),t.setViewport)},onPointerMove:e=>{let t=t=>{if(t.pointerType===`touch`)return;let n=z.measurementRoot.current;if(!(n instanceof HTMLElement))return;let r=n.getBoundingClientRect(),i=t.clientX-r.left,a=t.clientY-r.top;if(i<0||a<0||i>r.width||a>r.height){e(null);return}e(Cr({x:i,y:a},B.getState().viewport))},n=()=>e(null);return window.addEventListener(`pointermove`,t,{passive:!0}),document.documentElement.addEventListener(`pointerleave`,n),window.addEventListener(`blur`,n),()=>{window.removeEventListener(`pointermove`,t),document.documentElement.removeEventListener(`pointerleave`,n),window.removeEventListener(`blur`,n)}}}),()=>t(null)},[e.bindEditorApi,B,z]),(0,J.useEffect)(()=>{if(!r||typeof window>`u`)return;let e=window;return e.__koboyoStore=B,()=>{e.__koboyoStore===B&&delete e.__koboyoStore}},[r,B]);let oe=e.onDocumentChange,se=(0,J.useMemo)(()=>{if(oe)return e=>{oe(Oe(e,B.getState().opaqueShapes))}},[oe,B]);return(0,Q.jsx)(ae,{value:R,children:(0,Q.jsx)(Ci,{value:ie,children:(0,Q.jsxs)(Ee,{value:z,children:[(0,Q.jsx)(dj,{hasInitialViewport:e.initialViewport!=null,onDocumentChange:se,onViewportChange:e.onViewportChange,onPreferencesChange:e.onPreferencesChange}),e.initialPendingIcon&&!e.readOnly&&(0,Q.jsx)(pj,{icon:e.initialPendingIcon}),e.initialIconGuide&&!e.initialPendingIcon&&!e.readOnly&&(0,Q.jsx)(fj,{})]})})})}var gj=400,_j=1e3,vj=1e4;function yj(e,t){return ce(e.shapes)===ce(t.shapes)}function bj(e,t){let n=e,r=null,i=null,a=!1,o=0,s=null,c=!1,l=[];function u(e,n=null){c||t.effects.status(e,n)}function d(e){let t=l;l=[];for(let n of t)n(e)}function f(){r===null&&i===null&&(u(`saved`),d(!0))}function p(e){s?.(),s=t.schedule(e,()=>{s=null,g()})}function m(){return r||(i&&!i.merged?i.document:null)}function h(e,a){let o=m(),s=n.document;if(i&&(i.merged=!0),n={revision:e,document:a},!o){t.effects.adopt(a);return}let c=be(s,o,a).document,l=de(s,a,c);t.effects.adopt(c),l>0&&t.effects.keptLocal(l),r=yj(c,a)?null:c}async function g(e=!1){if(c||i||!r||a)return;let s={document:r,merged:!1};r=null,i=s,u(`saving`);let l;try{l=await t.save(s.document,n.revision,{keepalive:e})}catch(e){if(i=null,s.merged||(r??=s.document),d(!1),!r){f();return}o+=1,u(`offline`,e instanceof Error&&e.message?e.message:null),p(Math.min(_j*2**(o-1),vj));return}if(o=0,i=null,!c){if(l.kind===`saved`)l.revision>n.revision&&(n={revision:l.revision,document:s.document});else if(l.kind===`conflict`)s.merged||(r??=s.document),l.revision>n.revision&&h(l.revision,l.document);else if(s.merged||(r??=s.document),r){a=!0,u(`rejected`,l.message),d(!1);return}if(r){g();return}f()}}return{edit(e){c||(r=e,a=!1,u(`dirty`),p(gj))},remote(e,t,a){c||a||e<=n.revision||(h(e,t),r&&!i&&p(gj))},flush(){if(c||a)return Promise.resolve(!1);if(!r&&!i)return Promise.resolve(!0);let e=new Promise(e=>l.push(e));return s?.(),s=null,g(),e},unsaved(){let e=m();return e?{base:n.document,document:e}:null},leave(){c||i||!r||a||(s?.(),s=null,g(!0))},open(){c=!1,r&&p(gj)},close(){c=!0,s?.(),s=null,d(!1)}}}function xj(e){return`koboyo.local-draft:${e}`}function Sj(e,t,n){return e.setString(xj(t),JSON.stringify(n))}function Cj(e,t){e.remove(xj(t))}function wj(e){return typeof e==`object`&&!!e&&Array.isArray(e.shapes)}function Tj(e,t){let n=e.getString(xj(t));if(!n)return null;try{let e=JSON.parse(n);return!wj(e.base)||!wj(e.document)?null:{base:e.base,document:e.document}}catch{return null}}function Ej(e,t){return ce(e.shapes)===ce(t.shapes)}function Dj(e,t){let n=new Set(e.shapes.map(e=>e.id));return t.shapes.some(e=>n.has(e.id))}function Oj(e,t){if(e.base.shapes.length>0&&!Dj(e.base,t))return null;let n=Ej(e.base,t)?e.document:be(e.base,e.document,t).document;return Ej(n,t)?null:n}var kj=g(),Aj={id:`you`,name:`You`,avatarUrl:null},jj=[];function Mj(){let e=crypto.randomUUID();return{id:e,pending:`${kb}${e}`}}function Nj(e,t,n){return e.map(e=>e.id===t?n(e):e)}function Pj(e,t){return e.comments.some(e=>e.id===t)}function Fj(e){let{file:t,subscribe:n}=e,[r,i]=(0,J.useState)(null),a=(0,J.useCallback)(e=>{i(t=>t!==null&&t.revision>e.revision?t:e)},[]),[o,s]=(0,J.useState)([]),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(0),f=(0,J.useRef)(0),p=(0,J.useRef)(new Set);(0,J.useEffect)(()=>{let e=!0;return l(null),Vl.list(t).then(t=>{e&&a(t)}).catch(t=>{e&&l(t instanceof Error?t.message:String(t))}),()=>{e=!1}},[t,u,a]),(0,J.useEffect)(()=>n(e=>{e.type===`comments`&&e.file===t&&(a({threads:e.threads,revision:e.revision}),l(null))}),[n,t,a]);let m=(0,J.useCallback)(()=>d(e=>e+1),[]),h=(0,J.useCallback)(async(e,t)=>{f.current+=1;let n={id:f.current,apply:e};s(e=>[...e,n]);let r=t();p.current.add(r);try{a(await r)}finally{p.current.delete(r),s(e=>e.filter(e=>e.id!==n.id))}},[a]),g=(0,J.useCallback)(e=>{let n=Date.now(),{id:r,pending:i}=Mj(),a={id:i,anchor:e.anchor,comments:[{id:i,author:Aj,body:e.body,createdAt:n,editedAt:null}],createdAt:n,updatedAt:n,resolvedAt:null};return h(e=>e.some(e=>e.id===r)?e:[...e,a],()=>Vl.create(t,r,e.body,e.anchor))},[h,t]),_=(0,J.useCallback)((e,n)=>{let r=Date.now(),{id:i,pending:a}=Mj();return h(t=>Nj(t,e,e=>Pj(e,i)?e:{...e,comments:[...e.comments,{id:a,author:Aj,body:n,createdAt:r,editedAt:null}],updatedAt:r}),()=>Vl.reply(t,e,i,n))},[h,t]),v=(0,J.useCallback)((e,n)=>{let r=Date.now();return h(t=>t.map(t=>Pj(t,e)?{...t,comments:t.comments.map(t=>t.id===e?{...t,body:n,editedAt:r}:t)}:t),()=>Vl.update(t,e,n))},[h,t]),y=(0,J.useCallback)((e,n)=>h(t=>Nj(t,e,e=>({...e,anchor:n})),()=>Vl.move(t,e,n)),[h,t]),b=(0,J.useCallback)((e,n)=>{let r=Date.now();return h(t=>Nj(t,e,e=>({...e,resolvedAt:n?r:null})),()=>Vl.resolve(t,e,n))},[h,t]),x=(0,J.useCallback)(e=>h(t=>t.flatMap(t=>t.comments[0]?.id===e?[]:Pj(t,e)?[{...t,comments:t.comments.filter(t=>t.id!==e)}]:[t]),()=>Vl.remove(t,e)),[h,t]),S=(0,J.useMemo)(()=>o.reduce((e,t)=>t.apply(e),r?.threads??[]),[r,o]),C=(0,J.useCallback)(async()=>(await Promise.allSettled([...p.current])).every(e=>e.status===`fulfilled`),[]),w=(0,J.useMemo)(()=>({canvasId:`local:${t}`,threads:S,loaded:r!==null,error:c,reload:m,currentUser:Aj,canModerate:!0,members:jj,createThread:g,reply:_,update:v,move:y,resolve:b,remove:x}),[t,S,r,c,m,g,_,v,y,b,x]);return(0,J.useMemo)(()=>({integration:w,settle:C}),[w,C])}function Ij(e){if(!(e.hostname!==`127.0.0.1`||e.port===``))return`http://localhost:${e.port}`}function Lj(e,t){let n=Tj(kc,e);if(!n)return{...t,recovered:null};let r=Oj({base:Rj(n.base),document:Rj(n.document)},t.document);return r||Cj(kc,e),{...t,recovered:r}}function Rj(e){let t=ge(e);return t.status===`valid`?t.document:e}function zj(e,t){if(!t)return!1;let n=e.shapes.find(e=>e.id===t);return n?.type===`figure`&&zo(e.shapes,n)}var Bj=250;function Vj(e,t){let n=Bt(e.shapes);if(!n)return null;let r=si(n,{width:window.innerWidth-t.left,height:window.innerHeight-t.top});return{...r,y:r.y+t.top}}function Hj(e){let{file:t}=e,[n,r]=(0,J.useState)({kind:`loading`}),[i,a]=(0,J.useState)(0);(0,J.useEffect)(()=>{let e=!0;return r({kind:`loading`}),Ml(t.id).then(n=>{e&&r({kind:`ready`,seed:Lj(t.id,{...n,document:Rj(n.document)})})}).catch(t=>{e&&r({kind:`failed`,message:t instanceof Error?t.message:String(t),diagnostics:t instanceof Ol?t.diagnostics:[]})}),()=>{e=!1}},[t.id,i]);let{subscribe:o}=e,s=n.kind===`failed`;return(0,J.useEffect)(()=>{if(s)return o(e=>{(e.type===`code`||e.type===`document`)&&e.file===t.id&&a(e=>e+1)})},[s,o,t.id]),n.kind===`loading`?(0,Q.jsx)(`div`,{className:`absolute inset-0`,"aria-busy":`true`}):n.kind===`failed`?(0,Q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center p-6 pt-[calc(var(--koboyo-host-inset-top)+24px)]`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-[460px] rounded-xl bg-[var(--chrome-popup)] p-5 ring-1 ring-[var(--chrome-ring)]`,children:[(0,Q.jsxs)(`p`,{className:`m-0 text-balance text-[14px] font-medium text-[var(--chrome-fg-900)]`,children:[t.label,` can't be opened yet`]}),(0,Q.jsx)(`p`,{className:`m-0 mt-1.5 text-balance text-[13px] leading-5 text-[var(--chrome-fg-600)]`,children:n.message}),n.diagnostics.length>0&&(0,Q.jsx)(`ul`,{className:`m-0 mt-3 list-none space-y-1 rounded-lg bg-[var(--chrome-rest)] p-3 font-mono text-[12px] text-[var(--chrome-fg-700)]`,children:n.diagnostics.slice(0,8).map(e=>(0,Q.jsxs)(`li`,{children:[e.line>0?`line ${e.line}: `:``,e.message]},`${e.line}:${e.message}`))}),(0,Q.jsx)(`p`,{className:`m-0 mt-3 text-balance text-[12.5px] text-[var(--chrome-fg-500)]`,children:`Fix the file and it opens here by itself.`})]})}):(0,Q.jsx)(Uj,{...e,seed:n.seed})}function Uj(e){let{file:t,client:n,seed:r,onState:i,onViewport:a,subscribe:o}=e,s=(0,J.useMemo)(()=>Ti({elk:Ei}),[]),c=(0,J.useMemo)(()=>Ij(window.location),[]),l=(0,J.useRef)(null),u=(0,J.useRef)(!1),[d]=(0,J.useState)(()=>e.initialViewport??Vj(r.document,e.viewInset)),f=(0,J.useRef)(d),p=(0,J.useRef)(r.recovered??r.document),m=(0,J.useRef)(r.code),[h,g]=(0,J.useState)({status:`saved`,detail:null,handEdited:zj(r.document,r.code.frameId),code:r.code,openComments:0});(0,J.useEffect)(()=>{i(h)},[h,i]);let _=(0,J.useRef)(null),v=(0,J.useCallback)(()=>{_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{_.current=null;let e=zj(p.current,m.current.frameId);g(t=>t.handEdited===e?t:{...t,handEdited:e})},Bj)},[]);(0,J.useEffect)(()=>()=>{_.current&&clearTimeout(_.current)},[]);let y=Fj({file:t.id,subscribe:o}),b=y.integration.threads.filter(e=>e.resolvedAt===null).length;(0,J.useEffect)(()=>{g(e=>e.openComments===b?e:{...e,openComments:b})},[b]);let x=(0,J.useRef)(null);x.current===null&&(x.current=bj({revision:r.revision,document:r.document},{save:async(e,r,i)=>{let a=await Il(t.id,{baseRevision:r,client:n,document:e,viewport:f.current},i);return a.kind===`conflict`?{...a,document:Rj(a.document)}:a},schedule:(e,t)=>{let n=setTimeout(t,e);return()=>clearTimeout(n)},effects:{status:(e,n)=>{e===`saved`&&Cj(kc,t.id),g(t=>t.status===e&&t.detail===n?t:{...t,status:e,detail:n})},adopt:e=>{p.current=e;let t=l.current;if(t){u.current=!0;try{t.adoptShapes(e.shapes)}finally{u.current=!1}}v()},keptLocal:e=>kj.notify(`${t.board} changed while you were editing. Both are combined; your version of ${e===1?`1 shape`:`${e} shapes`} was kept.`)}}));let S=x.current;(0,J.useEffect)(()=>(S.open(),()=>S.close()),[S]);let C=r.recovered,w=(0,J.useRef)(!1);(0,J.useEffect)(()=>{!C||w.current||(w.current=!0,S.edit(C),kj.notify(`Restored edits to ${t.label} that weren't saved when this page last closed.`))},[C,S,t.label]);let T=(0,J.useCallback)(()=>{let e=S.unsaved();e&&Sj(kc,t.id,e)},[S,t.id]);(0,J.useImperativeHandle)(e.handle,()=>({flush:async()=>{let[e,t]=await Promise.all([S.flush(),y.settle()]);return e||T(),e&&t},reveal:e=>{l.current?.revealShapes(e)}}),[S,T,y]),(0,J.useEffect)(()=>o(e=>{if(e.type===`document`&&e.file===t.id){S.remote(e.revision,Rj(e.document),e.client===n);return}e.type===`code`&&e.file===t.id&&(m.current=e.code,g(t=>({...t,code:e.code})),v())}),[o,S,t.id,n,v]);let E=(0,J.useRef)(h);E.current=h,(0,J.useEffect)(()=>{let e=()=>{T(),S.leave()},t=()=>{document.visibilityState===`hidden`&&e()},r=e=>{let t=S.unsaved();if(!t)return;let r=E.current.status;r!==`offline`&&r!==`rejected`&&Fl({baseRevision:0,client:n,document:t.document,viewport:f.current})||e.preventDefault()};return window.addEventListener(`pagehide`,e),window.addEventListener(`beforeunload`,r),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`pagehide`,e),window.removeEventListener(`beforeunload`,r),document.removeEventListener(`visibilitychange`,t)}},[S,T,n]);let D=(0,J.useCallback)(e=>{p.current=e,v(),!u.current&&S.edit(e)},[S,v]),O=(0,J.useCallback)(e=>{l.current=e},[]),k=(0,J.useCallback)(e=>{f.current=e,a(e)},[a]),A=(0,J.useCallback)(async()=>{if(!await S.flush())throw Error(`not saved`)},[S]);return(0,Q.jsx)(hj,{initialDocument:r.recovered??r.document,initialViewport:d,onDocumentChange:D,onViewportChange:k,onSaveNow:A,bindEditorApi:O,environment:s,readOnly:e.readOnly,readOnlyPill:!1,widgetOrigin:c,resolveShortLink:Hl,comments:e.readOnly?void 0:y.integration})}var Wj=`flex h-8 min-w-0 shrink cursor-pointer items-center gap-1.5 rounded-lg px-2.5 text-[13px] font-medium outline-none transition-colors`,Gj=`shrink-0 cursor-pointer rounded-lg px-2.5 py-1.5 text-[13px] font-medium text-[var(--chrome-fg-700)] transition-colors hover:bg-[var(--chrome-hover)]`,Kj=`shrink-0 cursor-pointer rounded-lg bg-[var(--chrome-accent)] px-2.5 py-1.5 text-[13px] font-medium text-white transition-colors hover:bg-[var(--chrome-accent-hover)]`;function qj(e){return(0,Q.jsxs)(mc,{children:[(0,Q.jsx)(ca,{"data-testid":e.testId,className:e.triggerClassName,title:e.title,children:e.trigger}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{sideOffset:8,align:`start`,className:`z-[70]`,children:(0,Q.jsx)(Tc,{className:`${Wc.popup} w-[360px] max-w-[calc(100vw-24px)] p-3.5 text-[13px] leading-5 text-[var(--chrome-fg-700)] outline-none`,children:e.children})})})]})}function Jj(e){return(0,Q.jsxs)(qj,{testId:`agent-note`,title:`${e.agent}: ${e.message}`,triggerClassName:`${Wj} max-w-[340px] font-normal text-[var(--chrome-fg-700)] hover:bg-[var(--chrome-hover)]`,trigger:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(as,{size:15,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`truncate max-md:hidden`,children:e.message})]}),children:[(0,Q.jsxs)(`p`,{className:`m-0 text-[12.5px] font-medium text-[var(--chrome-fg-500)]`,children:[`Note from `,e.agent]}),(0,Q.jsx)(`p`,{className:`m-0 mt-1 whitespace-pre-wrap text-[var(--chrome-fg-900)]`,children:e.message})]})}function Yj(e){return(0,Q.jsxs)(qj,{testId:`agent-choice`,title:e.choice.question,triggerClassName:`${Wj} max-w-[340px] bg-[var(--chrome-accent)] text-white hover:bg-[var(--chrome-accent-hover)]`,trigger:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(_p,{size:15,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.choice.question})]}),children:[(0,Q.jsxs)(`p`,{className:`m-0 text-[12.5px] font-medium text-[var(--chrome-fg-500)]`,children:[e.agent,` asks`]}),(0,Q.jsx)(`p`,{className:`m-0 mt-1 text-balance font-medium text-[var(--chrome-fg-900)]`,children:e.choice.question}),(0,Q.jsx)(`ul`,{className:`m-0 mt-3 list-none space-y-1 p-0`,children:e.choice.options.map(t=>(0,Q.jsxs)(`li`,{"data-testid":`agent-choice-option`,className:`flex items-center gap-2 rounded-lg px-1 py-0.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[var(--chrome-fg-900)]`,children:t.label}),(0,Q.jsx)(`button`,{type:`button`,className:Gj,onClick:()=>e.onReveal(t.frameId),children:`Show`}),(0,Q.jsx)(Db,{className:Kj,disabled:e.picking,onClick:()=>e.onPick(t.frameId),children:`Pick this one`})]},t.frameId))})]})}function Xj(e){return(0,Q.jsxs)(qj,{testId:`code-changed`,triggerClassName:`${Wj} bg-[var(--cta-save-bg)] text-[var(--cta-save-fg)] hover:bg-[var(--cta-save-bg-hover)]`,trigger:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(Ds,{size:15,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[e.file.label,` changed`]})]}),children:[(0,Q.jsxs)(`p`,{className:`m-0 text-balance`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-[var(--chrome-fg-900)]`,children:[`The agent changed `,e.file.label,`.`]}),` `,`You've edited this drawing by hand, so it wasn't replaced.`]}),(0,Q.jsxs)(`div`,{className:`mt-3 flex justify-end gap-1.5`,children:[(0,Q.jsx)(Db,{className:Gj,onClick:e.onKeepMine,children:`Keep my edits`}),(0,Q.jsx)(Db,{className:Kj,onClick:e.onUseAgent,children:`Use the agent's version`})]})]})}function Zj(e){let t=e.errors.length===1?`1 error`:`${e.errors.length} errors`;return(0,Q.jsxs)(qj,{testId:`code-errors`,triggerClassName:`${Wj} text-[var(--chrome-danger)] hover:bg-[var(--chrome-hover)]`,trigger:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(ms,{size:15,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`truncate`,children:t})]}),children:[(0,Q.jsxs)(`p`,{className:`m-0 text-balance`,children:[(0,Q.jsxs)(`span`,{className:`font-medium text-[var(--chrome-fg-900)]`,children:[e.file.label,` has `,e.errors.length===1?`an error`:t]}),`, so the board still shows the last drawing that worked.`]}),(0,Q.jsx)(`ul`,{className:`m-0 mt-2 max-h-[240px] list-none space-y-1 overflow-auto p-0 font-mono text-[12px] text-[var(--chrome-fg-600)]`,children:e.errors.map((e,t)=>(0,Q.jsxs)(`li`,{children:[e.line>0?`line ${e.line}: `:``,e.message]},t))})]})}function Qj(e,t){return e===`sent`?{title:`Sent to ${t}`,body:`You can close this tab.`}:e===`timeout`?{title:`${t} stopped waiting`,body:`The wait timed out. Run koboyo open again to keep editing.`}:{title:`This editor has stopped`,body:`koboyo open is no longer running. Run it again to keep editing.`}}function $j(e){let t=Qj(e.reason,e.agent);return(0,Q.jsx)(`div`,{"data-testid":`ended-card`,role:`status`,className:`absolute inset-0 z-[80] flex items-center justify-center bg-gray-900/10 p-6`,children:(0,Q.jsxs)(`div`,{className:`w-full max-w-[380px] rounded-xl bg-[var(--chrome-popup)] p-5 text-center shadow-[0_1px_2px_rgba(0,0,0,0.05),0_16px_32px_-8px_rgba(0,0,0,0.16)] ring-1 ring-[var(--chrome-ring)]`,children:[e.reason===`sent`&&(0,Q.jsx)(`span`,{className:`mx-auto mb-3 flex h-9 w-9 items-center justify-center rounded-full bg-[var(--chrome-rest)] text-[var(--chrome-fg-700)]`,children:(0,Q.jsx)(Ts,{size:18,stroke:2,"aria-hidden":!0})}),(0,Q.jsx)(`p`,{className:`m-0 text-balance text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:t.title}),(0,Q.jsx)(`p`,{className:`m-0 mt-1.5 text-balance text-[13.5px] leading-5 text-[var(--chrome-fg-600)]`,children:t.body}),e.board&&(0,Q.jsxs)(`p`,{className:`m-0 mt-3 text-balance text-[12.5px] text-[var(--chrome-fg-500)]`,children:[`Your board is saved in `,(0,Q.jsx)(`span`,{className:`font-mono`,children:e.board}),`.`]})]})})}var eM=`flex h-8 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-lg px-3 text-[13px] font-medium outline-none transition-colors disabled:cursor-default disabled:opacity-60`,tM=`${eM} bg-[var(--chrome-accent)] text-white hover:bg-[var(--chrome-accent-hover)]`,nM=`${eM} text-[var(--chrome-fg-700)] hover:bg-[var(--chrome-hover)]`;function rM(e){return(0,Q.jsx)(`p`,{className:`m-0 text-balance text-[13px] font-medium text-[var(--chrome-fg-900)]`,children:e.children})}function iM(e){return(0,Q.jsx)(`p`,{className:`m-0 mt-1 text-balance text-[13px] leading-5 text-[var(--chrome-fg-600)]`,children:e.children})}function aM(e){return(0,Q.jsx)(`div`,{className:`mt-3 flex flex-wrap justify-end gap-1.5`,children:e.children})}function oM(e){let[t,n]=(0,J.useState)(!1),{answer:r}=e;async function i(){try{await navigator.clipboard.writeText(r.url),n(!0),setTimeout(()=>n(!1),1500)}catch{n(!1)}}return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(Ts,{size:15,stroke:2,className:`text-[var(--flow-accent)]`,"aria-hidden":!0}),r.created?`Saved to your Koboyo account`:`Updated on Koboyo`]})}),(0,Q.jsx)(iM,{children:r.created?`A new board${r.workspace?` in ${r.workspace}`:``}. Saving again updates it.`:`The board${r.workspace?` in ${r.workspace}`:``} now matches this one.`}),(0,Q.jsx)(`input`,{readOnly:!0,value:r.url,"aria-label":`Link to the board`,onFocus:e=>e.currentTarget.select(),className:`mt-2.5 block w-full truncate rounded-lg bg-[var(--chrome-rest)] px-2.5 py-1.5 text-[12.5px] text-[var(--chrome-fg-800)] outline-none ring-1 ring-[var(--chrome-input)]`}),(0,Q.jsxs)(aM,{children:[(0,Q.jsxs)(`button`,{type:`button`,className:nM,onClick:()=>void i(),children:[t?(0,Q.jsx)(Ts,{size:15,stroke:2,"aria-hidden":!0}):(0,Q.jsx)(js,{size:15,stroke:1.75,"aria-hidden":!0}),t?`Copied`:`Copy link`]}),(0,Q.jsxs)(`a`,{href:r.url,target:`_blank`,rel:`noopener noreferrer`,className:tM,children:[(0,Q.jsx)(Ws,{size:15,stroke:1.75,"aria-hidden":!0}),`Open`]})]})]})}function sM(e){let[t,n]=(0,J.useState)(e.workspaces[0]?.id??``);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Save to cloud`}),(0,Q.jsx)(iM,{children:e.message}),(0,Q.jsx)(`div`,{role:`radiogroup`,className:`mt-2.5 flex flex-col gap-1`,children:e.workspaces.map(e=>(0,Q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-[13px] text-[var(--chrome-fg-800)] hover:bg-[var(--chrome-hover)]`,children:[(0,Q.jsx)(`input`,{type:`radio`,name:`cloud-workspace`,value:e.id,checked:t===e.id,onChange:()=>n(e.id)}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,Q.jsx)(`span`,{className:`text-[12px] text-[var(--chrome-fg-500)]`,children:e.plan})]},e.id))}),(0,Q.jsx)(aM,{children:(0,Q.jsx)(`button`,{type:`button`,className:tM,disabled:!t,onClick:()=>e.onPick(t),children:`Save here`})})]})}function cM(e){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)({kind:`working`,label:``}),a=(0,J.useRef)(null),{subscribe:o}=e;(0,J.useEffect)(()=>o(e=>{e.type===`sign-in`&&i(t=>t.kind===`signing-in`?{kind:`signing-in`,url:e.url}:t)}),[o]);function s(){a.current?.abort(),a.current=null}async function c(t=`update`,r){s();let o=new AbortController;a.current=o,n(!0),i({kind:`working`,label:`Saving to your Koboyo account…`});try{if(!await e.flush()){i({kind:`error`,message:`Your latest edits aren't saved to disk yet, so nothing was uploaded. Try again.`,mode:t});return}let n=await zl({file:e.file.id,mode:t,workspaceId:r},o.signal);o.signal.aborted||i({kind:`answer`,answer:n,mode:t})}catch(e){o.signal.aborted||i({kind:`error`,message:e instanceof Error?e.message:String(e),mode:t})}}async function l(){s();let e=new AbortController;a.current=e,i({kind:`signing-in`,url:null});try{let t=await Bl(e.signal);if(e.signal.aborted)return;if(t.status===`signed-in`){await c();return}i({kind:`error`,message:t.message,mode:`update`})}catch(t){e.signal.aborted||i({kind:`error`,message:t instanceof Error?t.message:String(t),mode:`update`})}}function u(){if(r.kind===`working`)return(0,Q.jsxs)(`p`,{className:`m-0 flex items-center gap-2 text-[13px] text-[var(--chrome-fg-600)]`,children:[(0,Q.jsx)(ec,{size:15,className:`animate-spin`,"aria-hidden":!0}),r.label]});if(r.kind===`signing-in`)return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Finish signing in in your browser`}),(0,Q.jsxs)(iM,{children:[`Approve koboyo on koboyo.com, and this board saves as soon as you're back.`,r.url&&(0,Q.jsxs)(Q.Fragment,{children:[` `,(0,Q.jsx)(`a`,{href:r.url,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-[var(--chrome-fg-900)] underline underline-offset-2`,children:`Open the sign-in page`}),` `,`if it didn't open.`]})]}),(0,Q.jsx)(aM,{children:(0,Q.jsx)(`button`,{type:`button`,className:nM,onClick:()=>{s(),n(!1)},children:`Cancel`})})]});if(r.kind===`error`)return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Not saved`}),(0,Q.jsx)(iM,{children:r.message}),(0,Q.jsx)(aM,{children:(0,Q.jsx)(`button`,{type:`button`,className:nM,onClick:()=>void c(r.mode),children:`Try again`})})]});let{answer:e,mode:t}=r;switch(e.status){case`saved`:return(0,Q.jsx)(oM,{answer:e});case`signed-out`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Sign in to save to the cloud`}),(0,Q.jsx)(iM,{children:`Save this board to your Koboyo account to get a link you can share. Saving again updates it.`}),(0,Q.jsx)(aM,{children:(0,Q.jsx)(`button`,{type:`button`,className:tM,onClick:()=>void l(),children:`Sign in to Koboyo`})})]});case`plan-required`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Save to cloud is part of Koboyo Pro`}),(0,Q.jsx)(iM,{children:e.message}),e.account&&(0,Q.jsxs)(`p`,{className:`m-0 mt-1.5 text-[12px] text-[var(--chrome-fg-500)]`,children:[`Signed in as `,e.account]}),(0,Q.jsxs)(aM,{children:[(0,Q.jsx)(`button`,{type:`button`,className:nM,onClick:()=>void c(t),children:`I've started it`}),(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:tM,children:`Start free trial`})]})]});case`choose-workspace`:return(0,Q.jsx)(sM,{message:e.message,workspaces:e.workspaces,onPick:e=>void c(t,e)});case`changed`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Changed on koboyo.com`}),(0,Q.jsxs)(iM,{children:[e.message,` `,(0,Q.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-[var(--chrome-fg-900)] underline underline-offset-2`,children:`See it`})]}),(0,Q.jsxs)(aM,{children:[(0,Q.jsx)(`button`,{type:`button`,className:nM,onClick:()=>void c(`new`),children:`Save as new board`}),(0,Q.jsx)(`button`,{type:`button`,className:tM,onClick:()=>void c(`replace`),children:`Replace it`})]})]});case`failed`:case`unavailable`:return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(rM,{children:`Not saved`}),(0,Q.jsx)(iM,{children:e.message}),e.status===`failed`&&(0,Q.jsx)(aM,{children:(0,Q.jsx)(`button`,{type:`button`,className:nM,onClick:()=>void c(t),children:`Try again`})})]})}}return(0,Q.jsxs)(mc,{open:t,onOpenChange:e=>{n(e)},children:[(0,Q.jsxs)(ca,{"data-testid":`save-to-cloud`,className:`${eM} text-[var(--chrome-fg-700)] hover:bg-[var(--chrome-hover)]`,onClick:e=>{e.preventDefault(),!(t&&r.kind===`signing-in`)&&c()},children:[(0,Q.jsx)(Jf,{size:16,stroke:1.75,"aria-hidden":!0}),(0,Q.jsx)(`span`,{className:`max-sm:hidden`,children:`Save to cloud`}),(0,Q.jsx)(`span`,{className:`rounded-md bg-[var(--cta-save-bg)] px-1.5 py-px text-[10.5px] font-semibold uppercase tracking-wide text-[var(--cta-save-fg)]`,children:`Pro`})]}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{sideOffset:8,align:`end`,className:`z-[70]`,children:(0,Q.jsx)(Tc,{"data-testid":`cloud-panel`,className:`${Wc.popup} w-[320px] p-4 outline-none`,children:u()})})})]})}var lM=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform)?`⌘`:`Ctrl+`;function uM(e){let{state:t,connection:n}=e;return t?t.status===`rejected`?(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-[12.5px] text-[var(--chrome-danger)]`,children:[(0,Q.jsx)(ms,{size:14,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[`Not saved: `,t.detail??`the board was refused`]})]}):t.status===`offline`||n===`lost`&&t.status!==`saved`?(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-[12.5px] text-[var(--chrome-danger)]`,children:[(0,Q.jsx)(ms,{size:14,stroke:1.75,className:`shrink-0`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`truncate`,children:[`Not saved: `,t.detail??`koboyo isn't answering`,`. Retrying…`]})]}):null:null}function dM(e){return(0,Q.jsxs)(`span`,{className:`flex shrink-0 items-center gap-1 rounded-full bg-[var(--cta-save-bg)] px-2 py-0.5 text-[12px] font-medium text-[var(--cta-save-fg)]`,title:`You changed the drawing by hand, so ${e.file.label} no longer describes it. If the code changes, you'll be asked before your edits are replaced.`,children:[(0,Q.jsx)(ip,{size:13,stroke:1.75,"aria-hidden":!0}),`Hand-edited`]})}var fM=`flex h-8 shrink-0 cursor-pointer items-center gap-1.5 rounded-lg px-3 text-[13px] font-medium outline-none transition-colors disabled:cursor-default disabled:opacity-60`;function pM(e){let[t,n]=(0,J.useState)(!1),[r,i]=(0,J.useState)(``),{onSend:a}=e;async function o(){await a(r.trim())&&(n(!1),i(``))}let s=(0,J.useRef)(o);return s.current=o,(0,J.useEffect)(()=>{let e=e=>{if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey)||e.defaultPrevented)return;let t=e.target,n=t?.dataset.sendNote!==void 0;(t?.isContentEditable||t?.tagName===`TEXTAREA`||t?.tagName===`INPUT`)&&!n||(e.preventDefault(),s.current())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,Q.jsxs)(mc,{open:t,onOpenChange:n,children:[(0,Q.jsxs)(ca,{"data-testid":`send-back`,className:`${fM} bg-[var(--chrome-accent)] text-white hover:bg-[var(--chrome-accent-hover)]`,children:[(0,Q.jsx)(jp,{size:15,stroke:1.75,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{children:[`Send back to `,e.agent]})]}),(0,Q.jsx)(yc,{children:(0,Q.jsx)(wc,{sideOffset:8,align:`end`,className:`z-[70]`,children:(0,Q.jsxs)(Tc,{className:`${Wc.popup} w-[340px] p-3 outline-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:`send-note`,className:`block px-1 pb-1.5 text-[12.5px] font-medium text-[var(--chrome-fg-700)]`,children:[`Add a note for `,e.agent,` `,(0,Q.jsx)(`span`,{className:`font-normal text-[var(--chrome-fg-500)]`,children:`(optional)`})]}),(0,Q.jsx)(`textarea`,{id:`send-note`,"data-send-note":``,autoFocus:!0,rows:3,maxLength:2e3,value:r,onChange:e=>i(e.target.value),placeholder:`e.g. the cache sits in front of Postgres`,className:`block w-full resize-none rounded-lg bg-[var(--chrome-rest)] px-2.5 py-2 text-[13px] leading-5 text-[var(--chrome-fg-900)] outline-none ring-1 ring-[var(--chrome-input)] placeholder:text-[var(--chrome-fg-400)] focus:ring-[var(--chrome-input-hover)]`}),(0,Q.jsxs)(`div`,{className:`mt-2.5 flex items-center justify-between gap-2 px-1`,children:[(0,Q.jsxs)(`span`,{className:`text-[12px] text-[var(--chrome-fg-500)]`,children:[e.openComments>0&&(0,Q.jsxs)(Q.Fragment,{children:[e.openComments===1?`Your comment goes with it`:`${String(e.openComments)} comments go with it`,` · `]}),lM,`↵ to send`]}),(0,Q.jsx)(`button`,{type:`button`,disabled:e.sending,onClick:()=>void o(),className:`${fM} bg-[var(--chrome-accent)] text-white hover:bg-[var(--chrome-accent-hover)]`,children:e.sending?`Sending…`:`Send`})]})]})})})]})}function mM(e){let{file:t,state:n,ended:r}=e,i=n?.code??null,a=t!==null&&r===null;return(0,Q.jsxs)(`header`,{"data-testid":`host-bar`,"data-save-state":n?.status??`none`,className:`absolute inset-x-0 top-0 z-[60] flex items-center gap-3 border-b border-[var(--chrome-divider)] bg-[var(--chrome-page)] px-3 sm:px-4`,style:{height:48},children:[(0,Q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2.5`,children:[(0,Q.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-[var(--chrome-fg-900)] text-[var(--chrome-page)]`,children:(0,Q.jsx)(gA,{size:18})}),(0,Q.jsx)(`span`,{className:`text-[14px] font-medium tracking-tight text-[var(--chrome-fg-900)] max-sm:hidden`,children:`Koboyo`}),t&&(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-300)]`,"aria-hidden":!0,children:`/`}),(0,Q.jsx)(`span`,{className:`min-w-0 truncate text-[13.5px] text-[var(--chrome-fg-700)]`,title:t.kind===`code`?`${t.label} · edits save to ${t.board}`:t.label,children:t.label})]}),t&&n?.handEdited&&(0,Q.jsx)(dM,{file:t}),a&&i?.agentChanged&&(0,Q.jsx)(Xj,{file:t,onKeepMine:()=>e.onChoose(`mine`),onUseAgent:()=>e.onChoose(`agent`)}),a&&i&&i.errors.length>0&&(0,Q.jsx)(Zj,{file:t,errors:i.errors}),a&&(0,Q.jsx)(uM,{state:n,connection:e.connection})]}),a&&(0,Q.jsxs)(`div`,{className:`flex min-w-0 shrink-0 items-center gap-1.5`,children:[e.waiting&&e.choice&&(0,Q.jsx)(Yj,{agent:e.agent,choice:e.choice,picking:e.sending,onReveal:e.onReveal,onPick:e.onPick}),e.waiting&&e.note&&(0,Q.jsx)(Jj,{agent:e.agent,message:e.note}),(0,Q.jsx)(cM,{file:t,flush:e.flush,subscribe:e.subscribe}),e.waiting&&(0,Q.jsx)(pM,{agent:e.agent,openComments:n?.openComments??0,sending:e.sending,onSend:e.onSend})]})]})}function hM(e){let t=e.lastIndexOf(`/`);return t===-1?{directory:``,name:e}:{directory:e.slice(0,t+1),name:e.slice(t+1)}}function gM(e){return(0,Q.jsxs)(`nav`,{"aria-label":`Diagrams`,className:`scrollbar-slim absolute bottom-0 left-0 z-[50] overflow-y-auto border-r border-[var(--chrome-divider)] bg-[var(--chrome-sidebar)] p-2`,style:{top:48,width:240},children:[(0,Q.jsx)(`p`,{className:`m-0 px-2 pb-1.5 pt-1 text-[12px] font-medium text-[var(--chrome-fg-500)]`,children:e.files.length===1?`1 diagram`:`${e.files.length} diagrams`}),(0,Q.jsx)(`ul`,{className:`m-0 list-none space-y-0.5 p-0`,children:e.files.map(t=>{let n=t.id===e.active,r=hM(t.id),i=t.kind===`code`?Ds:pp;return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`button`,{type:`button`,"aria-current":n?`page`:void 0,onClick:()=>e.onOpen(t.id),title:t.label,className:`flex w-full cursor-pointer items-center gap-2 rounded-lg px-2 py-1.5 text-left text-[13px] transition-colors ${n?`bg-[var(--chrome-active)] text-[var(--chrome-fg-900)]`:`text-[var(--chrome-fg-700)] hover:bg-[var(--chrome-sidebar-hover)]`}`,children:[(0,Q.jsx)(i,{size:15,stroke:1.75,className:`shrink-0 text-[var(--chrome-fg-500)]`,"aria-hidden":!0}),(0,Q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[r.directory&&(0,Q.jsx)(`span`,{className:`text-[var(--chrome-fg-500)]`,children:r.directory}),r.name]})]})},t.id)})})]})}var _M=15e3;function vM(e){let[t,n]=(0,J.useState)(`connecting`),r=(0,J.useRef)(e);return r.current=e,(0,J.useEffect)(()=>{let e=new EventSource(`/api/events`),t=Date.now(),i=!1,a=e=>{e.onopen=()=>{t=Date.now(),n(`open`)},e.onerror=()=>{i||n(`lost`)},e.addEventListener(`ping`,()=>{t=Date.now()}),e.onmessage=n=>{t=Date.now();let a=JSON.parse(n.data);a.type===`shutdown`&&(i=!0,e.close()),r.current(a)}};a(e);let o=setInterval(()=>{i||!e||Date.now()-t<15e3*3||(e.close(),n(`lost`),e=new EventSource(`/api/events`),t=Date.now(),a(e))},_M);return()=>{i=!0,clearInterval(o),e?.close(),e=null}},[]),t}function yM(){let e=new URL(window.location.href),t=e.searchParams.get(`t`);return t!==null&&(e.searchParams.delete(`t`),window.history.replaceState(null,``,`${e.pathname}${e.search}${e.hash}`)),t}function bM(){let[e,t]=(0,J.useState)({kind:`signing-in`});return(0,J.useEffect)(()=>{let e=!0;return jl(yM()).then(n=>{e&&t({kind:`ready`,session:n})}).catch(n=>{e&&t({kind:`refused`,message:n instanceof Error?n.message:String(n)})}),()=>{e=!1}},[]),e.kind===`signing-in`?null:e.kind===`refused`?(0,Q.jsx)(xM,{message:e.message}):(0,Q.jsx)(SM,{initial:e.session})}function xM(e){return(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center bg-[var(--chrome-page)] p-6`,children:(0,Q.jsxs)(`div`,{className:`max-w-[420px] text-center`,children:[(0,Q.jsx)(`p`,{className:`m-0 text-balance text-[15px] font-medium text-[var(--chrome-fg-900)]`,children:`This editor link can't be opened`}),(0,Q.jsx)(`p`,{className:`m-0 mt-2 text-balance text-[13.5px] leading-5 text-[var(--chrome-fg-600)]`,children:e.message})]})})}function SM(e){let[t,n]=(0,J.useState)(e.initial),[r,i]=(0,J.useState)(e.initial.initialFile),[a,o]=(0,J.useState)(null),[s,c]=(0,J.useState)(null),[l,u]=(0,J.useState)(!1),d=(0,J.useMemo)(()=>crypto.randomUUID(),[]),f=(0,J.useRef)(null),p=(0,J.useRef)(new Map),m=(0,J.useRef)(new Set),h=(0,J.useRef)(`Your agent`),g=(0,J.useRef)(!1),_=(0,J.useRef)(e.initial.wait),v=vM((0,J.useCallback)(e=>{if(e.type===`session`){let t=_.current,r=e.session.wait;t.waiting&&!r.waiting&&g.current&&(g.current=!1,t.endsSession||kj.notify(`Sent to ${t.agent}.`)),_.current=r,n(e.session);return}e.type===`shutdown`&&c(e.reason);for(let t of m.current)t(e)},[])),y=(0,J.useCallback)(e=>(m.current.add(e),()=>{m.current.delete(e)}),[]);t.wait.waiting&&(h.current=t.wait.agent);let b=t.files.find(e=>e.id===r)??t.files[0]??null,x=t.wait.waiting&&s===null,S=(0,J.useCallback)(async e=>{if(e!==b?.id){if(!(await f.current?.flush()??!0)){kj.notify(`Couldn't save ${b?.label??`this file`}, so it stays open. Your edits are kept in this browser.`);return}o(null),i(e)}},[b?.id,b?.label]),C=(0,J.useCallback)(async(e,t=null)=>{if(!x||l)return!1;u(!0);try{return await f.current?.flush()??!0?(g.current=!0,await Rl(b?.id??null,e,t),!0):(kj.notify(`Your latest edits aren't saved yet, so nothing was sent.`),!1)}catch(e){return g.current=!1,kj.notify(e instanceof Error?e.message:String(e)),!1}finally{u(!1)}},[x,l,b?.id]),w=(0,J.useCallback)(async()=>await f.current?.flush()??!0,[]),T=(0,J.useCallback)(async e=>{if(b)try{await f.current?.flush();let t=await Ll(b.id,e);o(e=>e&&{...e,code:t})}catch(e){kj.notify(e instanceof Error?e.message:String(e))}},[b]),E=(0,J.useCallback)(e=>{b&&p.current.set(b.id,e)},[b]),D=t.folder;return(0,J.useEffect)(()=>(document.documentElement.style.setProperty(`--koboyo-host-inset-top`,`48px`),()=>{document.documentElement.style.removeProperty(`--koboyo-host-inset-top`)}),[]),(0,Q.jsxs)(`div`,{className:`fixed inset-0`,children:[(0,Q.jsx)(`div`,{className:`absolute inset-y-0 right-0`,style:{left:D?240:0},children:b?(0,Q.jsx)(Hj,{file:b,client:d,readOnly:s!==null,initialViewport:p.current.get(b.id)??null,viewInset:{left:D?240:0,top:48},onViewport:E,onState:o,subscribe:y,handle:f},b.id):(0,Q.jsx)(`div`,{className:`flex h-full items-center justify-center text-[13.5px] text-[var(--chrome-fg-500)] text-balance px-6 text-center`,children:`No diagrams in this folder yet. Add a .kbd file and it shows up here.`})}),(0,Q.jsx)(mM,{file:b,state:a,connection:v,ended:s,waiting:x,agent:h.current,note:t.wait.waiting?t.wait.message:null,choice:t.wait.waiting?t.wait.choice:null,sending:l,onSend:C,onReveal:e=>f.current?.reveal([e]),onPick:e=>void C(``,e),onChoose:e=>void T(e),flush:w,subscribe:y}),D&&(0,Q.jsx)(gM,{files:t.files,active:b?.id??null,onOpen:e=>void S(e)}),s!==null&&(0,Q.jsx)($j,{reason:s,agent:h.current,board:b?.board??null})]})}function CM(){let e=`<svg xmlns="http://www.w3.org/2000/svg" width="34" height="34" viewBox="0 0 34 34" fill="none"><style>.b{fill:#000}.m{stroke:#fff}@media (prefers-color-scheme:dark){.b{fill:#fff}.m{stroke:#000}}</style><rect class="b" width="34" height="34" rx="7"/><path class="m" d="${hA}" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`,t=document.createElement(`link`);t.rel=`icon`,t.type=`image/svg+xml`,t.href=`data:image/svg+xml,${encodeURIComponent(e)}`,document.head.appendChild(t)}CM();var wM=document.getElementById(`root`);wM&&(0,Dl.createRoot)(wM).render((0,Q.jsx)(J.StrictMode,{children:(0,Q.jsx)(v,{controller:kj,children:(0,Q.jsx)(bM,{})})}));
|