collabmd 0.1.21 → 0.1.25
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 +102 -12
- package/bin/collabmd.js +3 -2
- package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-BHWNpLuY.js +1 -0
- package/dist/client/assets/_basePickBy-CJWegqog.js +1 -0
- package/dist/client/assets/_baseUniq-CFKN1k1n.js +1 -0
- package/dist/client/assets/apl-khHl8vBy.js +1 -0
- package/dist/client/assets/ar-SA-NXDWD63E-DND5MLpM.js +8 -0
- package/dist/client/assets/arc-D1SV2GW0.js +1 -0
- package/dist/client/assets/architecture-PBZL5I3N-0dui3p7-.js +1 -0
- package/dist/client/assets/architectureDiagram-2XIMDMQ5-DXpDe6lq.js +36 -0
- package/dist/client/assets/array-BTHl6o_K.js +1 -0
- package/dist/client/assets/asciiarmor-7xnRhA8w.js +1 -0
- package/dist/client/assets/asn1-_x-T1mFB.js +1 -0
- package/dist/client/assets/asterisk-Ct2NwVUw.js +1 -0
- package/dist/client/assets/az-AZ-MXSORGZV-ILYw2sYr.js +1 -0
- package/dist/client/assets/bg-BG-O6MV2KSF-DmfoZHM8.js +5 -0
- package/dist/client/assets/blockDiagram-WCTKOSBZ-DlJn0Rs1.js +132 -0
- package/dist/client/assets/bn-BD-T2VJNT7N-uYQx1Wph.js +3 -0
- package/dist/client/assets/bn-IN-MMW2ORAC-CmlBLY7g.js +3 -0
- package/dist/client/assets/brainfuck-CAmdgqDN.js +1 -0
- package/dist/client/assets/c4Diagram-IC4MRINW-C6S9MOEW.js +10 -0
- package/dist/client/assets/ca-ES-MKBCGNOG-DWiYvMvF.js +8 -0
- package/dist/client/assets/channel-CVwYcdlk.js +1 -0
- package/dist/client/assets/chunk-27N2SPOM-RxZ2_zJJ.js +34 -0
- package/dist/client/assets/chunk-3PELD44J-BvOh9EJp.js +1 -0
- package/dist/client/assets/chunk-4BX2VUAB-LBTVcC6-.js +1 -0
- package/dist/client/assets/chunk-55IACEB6-T5nuDI6U.js +1 -0
- package/dist/client/assets/chunk-7E7YKBS2-CBNUsbS7.js +1 -0
- package/dist/client/assets/chunk-7R4GIKGN-Dh9p1sbP.js +80 -0
- package/{public/assets/js/chunks/chunk-IR2DOYV4.js → dist/client/assets/chunk-A66AFZZU-D0IDIehU.js} +2 -2
- package/dist/client/assets/chunk-C72U2L5F-DLNOvzEI.js +1 -0
- package/dist/client/assets/chunk-Cq_f4orQ.js +1 -0
- package/dist/client/assets/chunk-EGIJ26TM-BkBsHEWn.js +1 -0
- package/dist/client/assets/chunk-ETSVUAFD-BnK5BhxL.js +12 -0
- package/{public/assets/js/chunks/chunk-U6APNHAF.js → dist/client/assets/chunk-FMBD7UC4-BoiIqhkb.js} +2 -2
- package/dist/client/assets/chunk-GEFDOKGD-CIg-LRSp.js +2 -0
- package/dist/client/assets/chunk-GLR3WWYH-CqGMuOti.js +2 -0
- package/dist/client/assets/chunk-HHEYEP7N-Czb3OX2v.js +1 -0
- package/dist/client/assets/chunk-JSJVCQXG-C6-G93S3.js +1 -0
- package/dist/client/assets/chunk-KX2RTZJC-CJlt0Rne.js +1 -0
- package/dist/client/assets/chunk-KYZI473N-C-ObF5L3.js +53 -0
- package/dist/client/assets/chunk-L3YUKLVL-BzkNNFii.js +1 -0
- package/dist/client/assets/chunk-MX3YWQON-bjcMtEei.js +1 -0
- package/dist/client/assets/chunk-NQ4KR5QH-DY9oh8PD.js +220 -0
- package/dist/client/assets/chunk-O4XLMI2P-CVfnFXq8.js +7 -0
- package/dist/client/assets/chunk-OZEHJAEY-DyD-ywvu.js +1 -0
- package/dist/client/assets/chunk-PQ6SQG4A-BOJs3QbF.js +1 -0
- package/dist/client/assets/chunk-PU5JKC2W-1nkyDxBh.js +70 -0
- package/dist/client/assets/chunk-QZHKN3VN-DU7fMcaP.js +1 -0
- package/dist/client/assets/chunk-R5LLSJPH-D9t4mFiL.js +1 -0
- package/dist/client/assets/chunk-SRAX5OIU-B-Zdxy2r.js +1 -0
- package/dist/client/assets/chunk-WL4C6EOR-Bs95uEnp.js +189 -0
- package/dist/client/assets/chunk-XIRO2GV7-CtwY16Jh.js +1 -0
- package/dist/client/assets/chunk-XPW4576I-CvxG514V.js +32 -0
- package/dist/client/assets/chunk-XZSTWKYB-BNB3Mgw3.js +94 -0
- package/dist/client/assets/chunk-YBOYWFTD-MIDp82ug.js +1 -0
- package/dist/client/assets/chunk-Z5NKEFVG-CIMf1Se5.js +22 -0
- package/dist/client/assets/classDiagram-VBA2DB6C-CBSmkOe7.js +1 -0
- package/dist/client/assets/classDiagram-v2-RAHNMMFH-CJarRy94.js +1 -0
- package/dist/client/assets/clike-BJcwKCE7.js +1 -0
- package/dist/client/assets/clojure-uSRILJfc.js +1 -0
- package/dist/client/assets/clone-CMmi3x0H.js +1 -0
- package/dist/client/assets/cmake-j5-7WxMz.js +1 -0
- package/dist/client/assets/cobol-cnURuZ43.js +1 -0
- package/dist/client/assets/coffeescript-iQD116iO.js +1 -0
- package/dist/client/assets/commonlisp-DGzExN9H.js +1 -0
- package/dist/client/assets/cose-bilkent-S5V4N54A-BKEY00wk.js +1 -0
- package/dist/client/assets/crystal-CnjkM1-q.js +1 -0
- package/dist/client/assets/cs-CZ-V77HGUP7-sLBAF2Iw.js +7 -0
- package/dist/client/assets/css-C-Nv0c9S.js +1 -0
- package/dist/client/assets/cypher-hxitpny2.js +1 -0
- package/dist/client/assets/cytoscape.esm-0xzpJ66h.js +321 -0
- package/dist/client/assets/d-BtdAWoTB.js +1 -0
- package/dist/client/assets/da-DK-I5RFNTM4-B__PLwca.js +2 -0
- package/dist/client/assets/dagre-Cm2w_QpZ.js +1 -0
- package/dist/client/assets/dagre-KLK3FWXG-BddfhbwG.js +4 -0
- package/dist/client/assets/de-CH-WLRDEVBV-D61DKw_9.js +7 -0
- package/dist/client/assets/de-DE-DTI4WUSC-Ba3fBYEU.js +7 -0
- package/dist/client/assets/defaultLocale-PG3Gbk8q.js +1 -0
- package/dist/client/assets/diagram-E7M64L7V-BoyJ8kpo.js +24 -0
- package/dist/client/assets/diagram-IFDJBPK2-DLWembLL.js +43 -0
- package/dist/client/assets/diagram-P4PSJMXO-CPmPa0OC.js +24 -0
- package/dist/client/assets/diff-f_ZkWiYS.js +1 -0
- package/dist/client/assets/dist-BATDm5JF.js +1 -0
- package/dist/client/assets/dist-BDDCA7hC.js +1 -0
- package/dist/client/assets/dist-BEs40fGb.js +1 -0
- package/dist/client/assets/dist-BPyPcaZr.js +1 -0
- package/dist/client/assets/dist-BiNL3fhN.js +1 -0
- package/dist/client/assets/dist-BpEcA20b.js +2 -0
- package/dist/client/assets/dist-BtROnx4-.js +1 -0
- package/dist/client/assets/dist-CCxn5Mk-.js +13 -0
- package/dist/client/assets/dist-CKdaLumK.js +1 -0
- package/dist/client/assets/dist-CNcGnl0T.js +1 -0
- package/dist/client/assets/dist-CPzoLjNz.js +1 -0
- package/dist/client/assets/dist-CQzPpOiH.js +1 -0
- package/dist/client/assets/dist-Cje3pdZH.js +9 -0
- package/dist/client/assets/dist-CnKD4Y92.js +1 -0
- package/dist/client/assets/dist-CxPc5kI6.js +1 -0
- package/dist/client/assets/dist-Czv7DXcw.js +23 -0
- package/dist/client/assets/dist-D4ebIlQB.js +6 -0
- package/dist/client/assets/dist-D7S1mzwR.js +1 -0
- package/dist/client/assets/dist-DFIisyRk.js +1 -0
- package/dist/client/assets/dist-DGbPPlZ8.js +1 -0
- package/dist/client/assets/dist-DL-EaOiC.js +1 -0
- package/dist/client/assets/dist-DhkKj77m.js +1 -0
- package/dist/client/assets/dist-DnpxzfoU.js +1 -0
- package/dist/client/assets/dist-Dy9oGocr.js +11 -0
- package/dist/client/assets/dist-Le-AVwIk.js +1 -0
- package/dist/client/assets/dist-StJm6K24.js +1 -0
- package/dist/client/assets/dist-gCWIHDgw.js +1 -0
- package/dist/client/assets/dist-mDBaykBY.js +1 -0
- package/dist/client/assets/dist-tyxqXzyB.js +1 -0
- package/dist/client/assets/dist-vL71uaef.js +1 -0
- package/dist/client/assets/dockerfile-BmylqEVx.js +1 -0
- package/dist/client/assets/dtd-B6xdyNDx.js +1 -0
- package/dist/client/assets/dylan-BzUoKQTn.js +1 -0
- package/dist/client/assets/ebnf-BlTaNq16.js +1 -0
- package/dist/client/assets/ecl-CffPaRqR.js +1 -0
- package/dist/client/assets/editor-session-DsM3VgQv.js +16 -0
- package/dist/client/assets/eiffel-B66P6crR.js +1 -0
- package/dist/client/assets/el-GR-ZXDJ2OS4-CpEbk42T.js +7 -0
- package/dist/client/assets/elm-DIwllOLv.js +1 -0
- package/dist/client/assets/en-CTDJDZ6K-C36Iqh9O.js +1 -0
- package/dist/client/assets/erDiagram-INFDFZHY-Dwg_AhU2.js +70 -0
- package/dist/client/assets/erlang-DwYA67QU.js +1 -0
- package/dist/client/assets/es-ES-DYQHAD43-Ba-6t0Wr.js +7 -0
- package/dist/client/assets/eu-ES-QDSYU5Y3-CYzUKQ2_.js +7 -0
- package/dist/client/assets/excalidraw-editor-Cs5p0lBn.js +182 -0
- package/dist/client/assets/excalidraw-editor-D8O7A69r.css +1 -0
- package/dist/client/assets/excalidraw-mermaid-stub-BtCKxPxK.js +1 -0
- package/dist/client/assets/excalidraw-mermaid-stub-C1ZaaI05.js +1 -0
- package/dist/client/assets/excalidrawEditor-wgJb2hmP.js +2 -0
- package/dist/client/assets/fa-IR-26LZG4PM-CxLc7ohL.js +9 -0
- package/dist/client/assets/factor-Cc9mS1OI.js +1 -0
- package/dist/client/assets/fcl-DD6dBrvI.js +1 -0
- package/dist/client/assets/fi-FI-6YS4KDE4-DtYLOEJY.js +6 -0
- package/dist/client/assets/flowDiagram-PKNHOUZH-BIJd4wAz.js +162 -0
- package/dist/client/assets/forth-DFLLMv-i.js +1 -0
- package/dist/client/assets/fortran-CNZVMQdQ.js +1 -0
- package/dist/client/assets/fr-FR-BRLLPTZC-9O_U5gdi.js +12 -0
- package/dist/client/assets/ganttDiagram-A5KZAMGK-BiMwicnp.js +292 -0
- package/dist/client/assets/gas-DyiCLKEJ.js +1 -0
- package/dist/client/assets/gherkin-CHgE7bAJ.js +1 -0
- package/dist/client/assets/gitGraph-HDMCJU4V-iPo6Lz4k.js +1 -0
- package/dist/client/assets/gitGraphDiagram-K3NZZRJ6-lk_paRel.js +65 -0
- package/dist/client/assets/github-dark.min-Z5exjX_n.css +1 -0
- package/dist/client/assets/github.min-D2BCvnWf.css +1 -0
- package/dist/client/assets/gl-ES-OKUZTLYG-Bb7TO64O.js +6 -0
- package/dist/client/assets/graphlib-B2nPo9Z4.js +1 -0
- package/dist/client/assets/groovy-BZc3It91.js +1 -0
- package/dist/client/assets/haskell-DJ4hTi3A.js +1 -0
- package/dist/client/assets/haxe-sJjg_lHN.js +1 -0
- package/dist/client/assets/he-IL-26MGYIU7-CQW1igm9.js +8 -0
- package/dist/client/assets/hi-IN-Q4ZOGTP2-BM91ENLs.js +3 -0
- package/dist/client/assets/http-DwAi3Ho1.js +1 -0
- package/dist/client/assets/hu-HU-P2OXPSN5-HiGbsUwM.js +3 -0
- package/dist/client/assets/id-ID-2EIKXYN6-DEG8vRZ2.js +8 -0
- package/dist/client/assets/idl-CCIDRFwr.js +1 -0
- package/dist/client/assets/image-32MOCVDX-viHDtJGM.js +1 -0
- package/dist/client/assets/image-blob-reduce.esm-D4wBfumB.js +2 -0
- package/dist/client/assets/index-B6m_KATZ.css +1 -0
- package/dist/client/assets/index-D20GlrKF.js +2 -0
- package/dist/client/assets/info-3K5VOQVL-DePZHLA4.js +1 -0
- package/dist/client/assets/infoDiagram-LFFYTUFH-CiAT_kJZ.js +2 -0
- package/dist/client/assets/init-Bb7Vx0CW.js +1 -0
- package/dist/client/assets/isArrayLikeObject-DxEG9mY7.js +1 -0
- package/dist/client/assets/isEmpty-DGNCKhlT.js +1 -0
- package/dist/client/assets/ishikawaDiagram-PHBUUO56-CE3HierS.js +70 -0
- package/dist/client/assets/it-IT-4CFKVXI2-DSrGqCKD.js +12 -0
- package/dist/client/assets/ja-JP-MAND2Z4V-OFpEymIv.js +7 -0
- package/dist/client/assets/javascript-BlUxwA0O.js +1 -0
- package/dist/client/assets/javascript-DcX_cm1u.js +1 -0
- package/dist/client/assets/journeyDiagram-4ABVD52K-CzoczPjW.js +139 -0
- package/dist/client/assets/jsx-runtime-DRYOYO9I.js +1 -0
- package/dist/client/assets/julia-BU0qBb1w.js +1 -0
- package/dist/client/assets/kaa-HQRTCXTJ-CpOJ_vn4.js +1 -0
- package/dist/client/assets/kab-KAB-JKIKKTGH-CNPzzJH6.js +4 -0
- package/dist/client/assets/kanban-definition-K7BYSVSG-Cr6iNYl4.js +89 -0
- package/dist/client/assets/katex-DoaSnJ5T.js +261 -0
- package/dist/client/assets/kk-KZ-HXQ63ZFC-CgtjU5JI.js +1 -0
- package/dist/client/assets/km-KH-PKL3LSGX-BAJh8UnF.js +7 -0
- package/dist/client/assets/ko-KR-KXLREZX3-BshOksBX.js +5 -0
- package/dist/client/assets/ku-TR-MJ4IER3X-Bi3YtiD-.js +6 -0
- package/dist/client/assets/line-D2NTyhqv.js +1 -0
- package/dist/client/assets/linear-DntNI0Uj.js +1 -0
- package/dist/client/assets/livescript-uk34VDGK.js +1 -0
- package/dist/client/assets/lt-LT-H6WFQ6FJ-DQ2W0g7h.js +3 -0
- package/dist/client/assets/lua-ClQGOv84.js +1 -0
- package/dist/client/assets/lv-LV-GOCK6SJW-DeqTo8T7.js +4 -0
- package/dist/client/assets/main-DONXLDrC.js +599 -0
- package/dist/client/assets/math-DQo53qzt.js +1 -0
- package/dist/client/assets/mathematica-BDmKpvRN.js +1 -0
- package/dist/client/assets/mbox-T5kA6jAQ.js +1 -0
- package/dist/client/assets/mermaid-parser.core-Bh2Ta9ou.js +4 -0
- package/dist/client/assets/mermaid-runtime-CLtta79D.js +11 -0
- package/dist/client/assets/mindmap-definition-YRQLILUH-DufPyQO8.js +68 -0
- package/dist/client/assets/mirc-DRRKKkcJ.js +1 -0
- package/dist/client/assets/mllike-iZXopbca.js +1 -0
- package/dist/client/assets/modelica-DP8T2DKM.js +1 -0
- package/dist/client/assets/mr-IN-IXVLDMEQ-CnH5Wjc7.js +9 -0
- package/dist/client/assets/mscgen-DXIRw2qg.js +1 -0
- package/dist/client/assets/mumps-BKUS05-y.js +1 -0
- package/dist/client/assets/my-MM-YG6MYTTD-BefEpouO.js +1 -0
- package/dist/client/assets/nb-NO-XGWJISD2-CNRrlrPY.js +8 -0
- package/dist/client/assets/nginx-CzYOtr2G.js +1 -0
- package/dist/client/assets/nl-NL-XVDVCPNC-CuLTw3kL.js +13 -0
- package/dist/client/assets/nn-NO-EMX5MJX5-NHFRnQkl.js +4 -0
- package/dist/client/assets/nsis-YyYYKQIB.js +1 -0
- package/dist/client/assets/ntriples-ZgZuaYbW.js +1 -0
- package/dist/client/assets/oc-FR-ROEINTVO-8kCbAtcr.js +4 -0
- package/dist/client/assets/octave-CnOndUN3.js +1 -0
- package/dist/client/assets/ordinal-BuNU9EgZ.js +1 -0
- package/dist/client/assets/oz-DjW322Rn.js +1 -0
- package/dist/client/assets/pa-IN-ZYN6SUDY-Dh8USSIe.js +4 -0
- package/dist/client/assets/packet-RMMSAZCW-BVw0pEk-.js +1 -0
- package/dist/client/assets/pascal-BdeW5uRX.js +1 -0
- package/dist/client/assets/path-BxyPWlyM.js +1 -0
- package/dist/client/assets/percentages-5DKR754L-RQFE76Sg.js +1 -0
- package/dist/client/assets/perl-_CDvIe1D.js +1 -0
- package/dist/client/assets/pica-BG8AR4mo.js +2 -0
- package/dist/client/assets/pie-UPGHQEXC-ChUWa5qF.js +1 -0
- package/dist/client/assets/pieDiagram-SKSYHLDU--YidSJxi.js +30 -0
- package/dist/client/assets/pig-inWo_B4W.js +1 -0
- package/dist/client/assets/pl-PL-6VTG7PHC-BMbgP62B.js +12 -0
- package/dist/client/assets/powershell-CO5KWJsy.js +1 -0
- package/dist/client/assets/preload-helper-Chd9yIcd.js +1 -0
- package/dist/client/assets/preview-render-compiler-CWBdv5tw.js +1 -0
- package/dist/client/assets/preview-render-profile-BjrQVCWD.js +23 -0
- package/dist/client/assets/preview-render-worker-DbMTa0Y6.js +23 -0
- package/dist/client/assets/properties-CjVp4a6M.js +1 -0
- package/dist/client/assets/protobuf-DybFT2KT.js +1 -0
- package/dist/client/assets/pt-BR-5YFKRR5G-CyrwFw_N.js +6 -0
- package/dist/client/assets/pt-PT-GEIXXZ67-SpK5vaGR.js +8 -0
- package/dist/client/assets/pug-CM36H1hd.js +1 -0
- package/dist/client/assets/puppet-Dw_NDgko.js +1 -0
- package/dist/client/assets/python-2pwcWoy7.js +1 -0
- package/dist/client/assets/q-C47l8kdS.js +1 -0
- package/dist/client/assets/quadrantDiagram-337W2JSQ-n7EIFT_f.js +7 -0
- package/dist/client/assets/quick-switcher-controller-CKrGBgcl.js +5 -0
- package/dist/client/assets/r-BmcXGVZ5.js +1 -0
- package/dist/client/assets/radar-KQ55EAFF-B4gMcoDX.js +1 -0
- package/dist/client/assets/requirementDiagram-Z7DCOOCP-BrquJATD.js +73 -0
- package/dist/client/assets/ro-RO-E2P6TFZI-90dn2iUp.js +12 -0
- package/dist/client/assets/room-zaSnuMv5.js +4 -0
- package/dist/client/assets/rough.esm-C7Rbwqik.js +1 -0
- package/dist/client/assets/roundRect-CDlbNkEg.js +1 -0
- package/dist/client/assets/rpm-Cm0x5xT_.js +1 -0
- package/dist/client/assets/ru-RU-YBIIY43T-Cl52NZnQ.js +10 -0
- package/dist/client/assets/ruby-Dl-I4pxG.js +1 -0
- package/dist/client/assets/runtime-config-loader--hxFvh23.js +1 -0
- package/dist/client/assets/sankeyDiagram-WA2Y5GQK-IpD6lgfO.js +10 -0
- package/dist/client/assets/sas-Bxkg4GVX.js +1 -0
- package/dist/client/assets/scheme-CO3zogua.js +1 -0
- package/dist/client/assets/sequenceDiagram-2WXFIKYE-DxZ6glIZ.js +145 -0
- package/dist/client/assets/shell-gYrTvBTP.js +1 -0
- package/dist/client/assets/si-LK-673C2CI2-DMSUxT-y.js +1 -0
- package/dist/client/assets/sieve-COX4Kn1X.js +1 -0
- package/dist/client/assets/simple-mode-BY9UFVy7.js +1 -0
- package/dist/client/assets/sk-SK-CKZHQ4AP-DUDai5Oe.js +7 -0
- package/dist/client/assets/sl-SI-557H2GWM-BbLeATfl.js +6 -0
- package/dist/client/assets/smalltalk-Dma1z5eE.js +1 -0
- package/dist/client/assets/solr-BvhcdkNH.js +1 -0
- package/dist/client/assets/sparql-gX7W9xeh.js +1 -0
- package/dist/client/assets/spreadsheet-BnlQRxWz.js +1 -0
- package/dist/client/assets/sql-CwA10oIk.js +1 -0
- package/dist/client/assets/src-H0-aBY9y.js +1 -0
- package/dist/client/assets/stateDiagram-RAJIS63D-A-rbDcdL.js +1 -0
- package/dist/client/assets/stateDiagram-v2-FVOUBMTO-CKhOHHLe.js +1 -0
- package/dist/client/assets/stex-DhLUylSV.js +1 -0
- package/dist/client/assets/stylus-9ZGSp3KB.js +1 -0
- package/dist/client/assets/subset-shared.chunk-93a-Md8B.js +1 -0
- package/dist/client/assets/subset-worker.chunk-B7pmUG1o.js +1 -0
- package/dist/client/assets/sv-SE-XOPKKDWS-BBa-AcMf.js +8 -0
- package/dist/client/assets/swift-CurfpLXH.js +1 -0
- package/dist/client/assets/ta-IN-XBH7DQI3-9uR7ADzx.js +6 -0
- package/dist/client/assets/tcl-BPvzXR-t.js +1 -0
- package/dist/client/assets/textile-BUq3vgBH.js +1 -0
- package/dist/client/assets/th-TH-TOCWH3R4-Box9U3ny.js +1 -0
- package/dist/client/assets/tiddlywiki-DRR6E4hS.js +1 -0
- package/dist/client/assets/tiki-C1XMixgx.js +1 -0
- package/dist/client/assets/timeline-definition-YZTLITO2-DuTppHot.js +61 -0
- package/dist/client/assets/toml-BQjoWSzq.js +1 -0
- package/dist/client/assets/tr-TR-GXW6CYY5-BA8pS3C5.js +4 -0
- package/dist/client/assets/treemap-KZPCXAKY-on28XbV_.js +1 -0
- package/dist/client/assets/troff-DbgTp3Cj.js +1 -0
- package/dist/client/assets/ttcn-1OxchGWH.js +1 -0
- package/dist/client/assets/ttcn-cfg-CC8OhyHu.js +1 -0
- package/dist/client/assets/turtle-D1WjVU4-.js +1 -0
- package/dist/client/assets/uk-UA-IJKTNUDG-B6hoHqzM.js +6 -0
- package/dist/client/assets/uz-UZ-TBZZEA4V-CPuftH33.js +1 -0
- package/dist/client/assets/vault-api-client-D7C_m9eq.js +188 -0
- package/dist/client/assets/vault-utils-Js2T-e-h.js +1 -0
- package/dist/client/assets/vb-Bf-XXYNJ.js +1 -0
- package/dist/client/assets/vbscript-HeSyWuOi.js +1 -0
- package/dist/client/assets/velocity-CUkiDsJQ.js +1 -0
- package/dist/client/assets/vennDiagram-LZ73GAT5-J0SBkXj8.js +34 -0
- package/dist/client/assets/verilog-BFxB5RAN.js +1 -0
- package/dist/client/assets/vhdl-BJUXQE-6.js +1 -0
- package/dist/client/assets/vi-VN-MULSGNVB-yRFd9OXl.js +7 -0
- package/dist/client/assets/webidl-advQMGTP.js +1 -0
- package/dist/client/assets/xquery-CNzoFgd7.js +1 -0
- package/dist/client/assets/xychartDiagram-JWTSCODW-Dn9dSYxn.js +7 -0
- package/dist/client/assets/yacas-BsmlDKac.js +1 -0
- package/dist/client/assets/yjs-provider-reset-guard-BcnBGrS9.js +4 -0
- package/dist/client/assets/z80-Bnez4vZ_.js +1 -0
- package/dist/client/assets/zh-CN-MVX3E32U-VzUIXB4K.js +11 -0
- package/dist/client/assets/zh-HK-JNU5RLIE-i0G2jHO_.js +1 -0
- package/dist/client/assets/zh-TW-LENVCA6T-BkHZg3jv.js +9 -0
- package/dist/client/excalidraw-editor.html +31 -0
- package/{public → dist/client}/index.html +135 -222
- package/docker-compose.yml +13 -1
- package/package.json +14 -7
- package/src/client/app/excalidraw-editor-entry.js +4 -0
- package/{public → src/client/app}/excalidraw-editor.html +1 -3
- package/src/client/app/index.html +469 -0
- package/src/client/app/main-entry.js +24 -0
- package/src/client/application/app-shell/git-feature.js +268 -32
- package/src/client/application/app-shell/ui-feature-identity.js +170 -0
- package/src/client/application/app-shell/ui-feature-shell.js +419 -0
- package/src/client/application/app-shell/ui-feature-sidebar.js +98 -0
- package/src/client/application/app-shell/ui-feature-tab-activity.js +128 -0
- package/src/client/application/app-shell/ui-feature-toolbar.js +520 -0
- package/src/client/application/app-shell/ui-feature.js +10 -648
- package/src/client/application/app-shell/workspace-feature.js +46 -0
- package/src/client/application/app-shell-elements.js +4 -0
- package/src/client/application/mermaid-preview-hydrator.js +1 -1
- package/src/client/application/plantuml-preview-hydrator.js +1 -1
- package/src/client/application/workspace-coordinator.js +147 -18
- package/src/client/application/workspace-preview-controller.js +34 -0
- package/src/client/application/workspace-route-controller.js +104 -0
- package/src/client/bootstrap/collabmd-app-shell.js +104 -0
- package/src/client/domain/markdown-formatting.js +197 -52
- package/src/client/domain/markdown-toolbar-actions.js +191 -0
- package/src/client/domain/runtime-paths.js +15 -0
- package/src/client/domain/workspace-request-id.js +7 -0
- package/src/client/excalidraw-editor.js +48 -2
- package/src/client/infrastructure/app-version-monitor.js +114 -0
- package/src/client/infrastructure/auth-client.js +219 -52
- package/src/client/infrastructure/browser-navigation-port.js +20 -0
- package/src/client/infrastructure/editor-collaboration-client.js +4 -0
- package/src/client/infrastructure/editor-session.js +47 -7
- package/src/client/infrastructure/editor-view-adapter.js +122 -58
- package/src/client/infrastructure/runtime-config-loader.js +56 -0
- package/src/client/infrastructure/runtime-config.js +66 -0
- package/src/client/infrastructure/vault-api-client.js +41 -7
- package/src/client/presentation/backlinks-panel.js +42 -9
- package/src/client/presentation/comment-ui/comment-ui-card.js +632 -0
- package/src/client/presentation/comment-ui/comment-ui-layout.js +452 -0
- package/src/client/presentation/comment-ui/comment-ui-render.js +149 -0
- package/src/client/presentation/comment-ui/comment-ui-shared.js +297 -0
- package/src/client/presentation/comment-ui/comment-ui-state.js +268 -0
- package/src/client/presentation/comment-ui-controller.js +13 -1529
- package/src/client/presentation/comments-panel.js +2 -2
- package/src/client/presentation/excalidraw-embed-controller.js +60 -2
- package/src/client/presentation/file-action-controller.js +195 -32
- package/src/client/presentation/file-explorer-controller.js +16 -2
- package/src/client/presentation/file-explorer-view.js +248 -7
- package/src/client/presentation/file-history-view-controller.js +806 -0
- package/src/client/presentation/file-tree-state.js +100 -5
- package/src/client/presentation/git-diff-view-controller.js +718 -121
- package/src/client/presentation/git-panel-controller.js +458 -66
- package/src/client/presentation/layout-controller.js +1 -1
- package/src/client/presentation/toast-controller.js +49 -6
- package/src/client/styles/components/actions.css +89 -0
- package/src/client/styles/components/feedback.css +71 -0
- package/src/client/styles/components/navigation.css +68 -0
- package/src/client/styles/components/scrollbars.css +104 -0
- package/src/client/styles/components/states.css +289 -0
- package/src/client/styles/components/surfaces.css +155 -0
- package/src/client/styles/features/backlinks.css +218 -0
- package/src/client/styles/features/collaboration-chat.css +228 -0
- package/src/client/styles/features/collaboration-dialogs.css +154 -0
- package/src/client/styles/features/collaboration-presence.css +103 -0
- package/src/client/styles/features/collaboration-ui.css +3 -0
- package/src/client/styles/features/comment-card.css +236 -0
- package/src/client/styles/features/comment-markdown.css +127 -0
- package/src/client/styles/features/comment-overlays.css +60 -0
- package/src/client/styles/features/comments-drawer.css +120 -0
- package/src/client/styles/features/comments.css +4 -0
- package/src/client/styles/features/diagram-preview.css +227 -0
- package/src/client/styles/features/diff-commit.css +268 -0
- package/src/client/styles/features/diff-lines.css +160 -0
- package/src/client/styles/features/diff-toolbar.css +98 -0
- package/src/client/styles/features/diff.css +3 -0
- package/src/client/styles/features/embedded-preview.css +218 -0
- package/src/client/styles/features/git-branch.css +155 -0
- package/src/client/styles/features/git-files.css +105 -0
- package/src/client/styles/features/git-history.css +339 -0
- package/src/client/styles/features/git.css +3 -0
- package/src/client/styles/features/media-lightbox.css +157 -0
- package/src/client/styles/features/outline.css +115 -0
- package/src/client/styles/features/preview-content.css +3 -0
- package/src/client/styles/features/preview-markdown.css +201 -0
- package/src/client/styles/features/preview-sidebars.css +2 -0
- package/src/client/styles/features/quick-switcher.css +167 -0
- package/src/client/styles/foundation/themes.css +347 -0
- package/src/client/styles/foundation/tokens.css +66 -0
- package/src/client/styles/foundation/utilities.css +36 -0
- package/src/client/styles/layout/editor-page.css +303 -0
- package/src/client/styles/layout/overlays.css +132 -0
- package/src/client/styles/layout/responsive.css +331 -0
- package/src/client/styles/layout/shell.css +314 -0
- package/src/client/styles/layout/sidebar.css +209 -0
- package/src/client/styles/layout/view-modes.css +92 -0
- package/src/client/styles/overrides/codemirror.css +53 -0
- package/src/client/styles/overrides/highlightjs.css +7 -0
- package/src/client/styles/overrides/vendor.css +2 -0
- package/src/client/styles/primitives/controls.css +277 -0
- package/src/client/styles/style.css +25 -4945
- package/src/server/auth/create-auth-service.js +373 -15
- package/src/server/auth/session-cookie.js +30 -4
- package/src/server/config/build-info.js +76 -0
- package/src/server/config/env.js +130 -6
- package/src/server/create-app-server.js +8 -0
- package/src/server/domain/collaboration/collaboration-room.js +90 -47
- package/src/server/index.js +3 -1
- package/src/server/infrastructure/git/command-runner.js +2 -1
- package/src/server/infrastructure/git/git-service.js +48 -2
- package/src/server/infrastructure/git/history-service.js +683 -0
- package/src/server/infrastructure/git/parsers.js +30 -0
- package/src/server/infrastructure/git/responses.js +73 -0
- package/src/server/infrastructure/http/create-auth-api-handler.js +30 -2
- package/src/server/infrastructure/http/create-git-api-command-handler.js +2 -0
- package/src/server/infrastructure/http/create-git-api-handler.js +2 -0
- package/src/server/infrastructure/http/create-git-api-query-handler.js +61 -0
- package/src/server/infrastructure/http/create-request-handler.js +15 -0
- package/src/server/infrastructure/http/create-static-handler.js +11 -2
- package/src/server/infrastructure/http/create-vault-api-command-handler.js +67 -0
- package/src/server/infrastructure/persistence/path-utils.js +11 -0
- package/src/server/infrastructure/persistence/vault-file-store.js +158 -3
- package/src/server/infrastructure/workspace/workspace-mutation-coordinator.js +84 -3
- package/public/assets/css/base.css +0 -1
- package/public/assets/css/style.css +0 -1
- package/public/assets/js/chunks/CodeMirrorEditor-UCMRAMCV-MAKZFDBE.js +0 -12
- package/public/assets/js/chunks/apl-C5P5JBDI.js +0 -1
- package/public/assets/js/chunks/ar-SA-NXDWD63E-MF6HMEA4.js +0 -8
- package/public/assets/js/chunks/architecture-PBZL5I3N-55LDZ5WS.js +0 -1
- package/public/assets/js/chunks/architectureDiagram-2XIMDMQ5-2VP562X7.js +0 -36
- package/public/assets/js/chunks/asciiarmor-3NCLLELT.js +0 -1
- package/public/assets/js/chunks/asn1-KF4WXU3M.js +0 -1
- package/public/assets/js/chunks/asterisk-EA3VIN65.js +0 -1
- package/public/assets/js/chunks/az-AZ-MXSORGZV-AIGO4TNU.js +0 -1
- package/public/assets/js/chunks/bg-BG-O6MV2KSF-X6AVO2AF.js +0 -5
- package/public/assets/js/chunks/blockDiagram-WCTKOSBZ-KM56WWDE.js +0 -132
- package/public/assets/js/chunks/bn-BD-T2VJNT7N-7OMHRIGC.js +0 -3
- package/public/assets/js/chunks/bn-IN-MMW2ORAC-EPKMNKG7.js +0 -3
- package/public/assets/js/chunks/brainfuck-A3CTQVFD.js +0 -1
- package/public/assets/js/chunks/c4Diagram-IC4MRINW-KX6UEGQZ.js +0 -10
- package/public/assets/js/chunks/ca-ES-MKBCGNOG-U44SUUTN.js +0 -8
- package/public/assets/js/chunks/chunk-2NTQWLZD.js +0 -25
- package/public/assets/js/chunks/chunk-2YRP2AWD.js +0 -1
- package/public/assets/js/chunks/chunk-3BUCGSSJ.js +0 -1
- package/public/assets/js/chunks/chunk-47L7JGE3.js +0 -1
- package/public/assets/js/chunks/chunk-4BCHPULB.js +0 -1
- package/public/assets/js/chunks/chunk-4NKM6YFO.js +0 -161
- package/public/assets/js/chunks/chunk-4WGMPBK5.js +0 -1
- package/public/assets/js/chunks/chunk-55WF6Y2Q.js +0 -1
- package/public/assets/js/chunks/chunk-5QRWYPYT.js +0 -25
- package/public/assets/js/chunks/chunk-775E65SU.js +0 -1
- package/public/assets/js/chunks/chunk-AJRGTECU.js +0 -70
- package/public/assets/js/chunks/chunk-B2J3PHGY.js +0 -1
- package/public/assets/js/chunks/chunk-B4JKB3BC.js +0 -1
- package/public/assets/js/chunks/chunk-CGVY4PKT.js +0 -13
- package/public/assets/js/chunks/chunk-CVTRX3TE.js +0 -220
- package/public/assets/js/chunks/chunk-DW6KK6VF.js +0 -1
- package/public/assets/js/chunks/chunk-E2HMNOQL.js +0 -189
- package/public/assets/js/chunks/chunk-EPTJZP5H.js +0 -7
- package/public/assets/js/chunks/chunk-G7NUGGE7.js +0 -13
- package/public/assets/js/chunks/chunk-GFDM7YCF.js +0 -1
- package/public/assets/js/chunks/chunk-GI7LBIBP.js +0 -1
- package/public/assets/js/chunks/chunk-GXRL27M7.js +0 -1
- package/public/assets/js/chunks/chunk-H6EYDHRW.js +0 -1
- package/public/assets/js/chunks/chunk-HEWVH67U.js +0 -9
- package/public/assets/js/chunks/chunk-HOCBCDA5.js +0 -1
- package/public/assets/js/chunks/chunk-HS2CUOC6.js +0 -1
- package/public/assets/js/chunks/chunk-HUAS4BYI.js +0 -12
- package/public/assets/js/chunks/chunk-HVNNEPP5.js +0 -2
- package/public/assets/js/chunks/chunk-I2GVZI7W.js +0 -38
- package/public/assets/js/chunks/chunk-I6PVWGBN.js +0 -14
- package/public/assets/js/chunks/chunk-IZ3V3F2A.js +0 -1
- package/public/assets/js/chunks/chunk-KPAQHIOI.js +0 -1
- package/public/assets/js/chunks/chunk-M3EW4V74.js +0 -1
- package/public/assets/js/chunks/chunk-MK3AFU3C.js +0 -90
- package/public/assets/js/chunks/chunk-NM6J3ND7.js +0 -1
- package/public/assets/js/chunks/chunk-NO7UPWTU.js +0 -1
- package/public/assets/js/chunks/chunk-OHGDMMWM.js +0 -1
- package/public/assets/js/chunks/chunk-OOT2HALX.js +0 -1
- package/public/assets/js/chunks/chunk-OQLLZFFN.js +0 -1
- package/public/assets/js/chunks/chunk-PF6TP4EI.js +0 -1
- package/public/assets/js/chunks/chunk-PMOZMECZ.js +0 -85
- package/public/assets/js/chunks/chunk-QBGS6DJR.js +0 -1
- package/public/assets/js/chunks/chunk-QF3ZQ6UQ.js +0 -1
- package/public/assets/js/chunks/chunk-QFXMAUW4.js +0 -1
- package/public/assets/js/chunks/chunk-QYKIT2IH.js +0 -41
- package/public/assets/js/chunks/chunk-S75BI2UQ.js +0 -1
- package/public/assets/js/chunks/chunk-SKEZZ3H6.js +0 -1
- package/public/assets/js/chunks/chunk-SO6QBCB6.js +0 -1
- package/public/assets/js/chunks/chunk-TFP6LRYJ.js +0 -53
- package/public/assets/js/chunks/chunk-VOODXHXA.js +0 -1
- package/public/assets/js/chunks/chunk-W7WJUTSA.js +0 -3
- package/public/assets/js/chunks/chunk-WNXFO2F2.js +0 -1
- package/public/assets/js/chunks/chunk-X6EEYWV4.js +0 -6
- package/public/assets/js/chunks/chunk-YVW3ZETS.js +0 -1
- package/public/assets/js/chunks/chunk-ZR2QRTBG.js +0 -339
- package/public/assets/js/chunks/chunk-ZZJX4LQ2.js +0 -1
- package/public/assets/js/chunks/classDiagram-VBA2DB6C-IYW4O2RM.js +0 -1
- package/public/assets/js/chunks/classDiagram-v2-RAHNMMFH-DNKVN2WD.js +0 -1
- package/public/assets/js/chunks/clike-RTBH33GE.js +0 -1
- package/public/assets/js/chunks/clojure-BR2VJ2JI.js +0 -1
- package/public/assets/js/chunks/cmake-2HEWVFEE.js +0 -1
- package/public/assets/js/chunks/cobol-V6EIK6DN.js +0 -1
- package/public/assets/js/chunks/coffeescript-JW3ZOGMD.js +0 -1
- package/public/assets/js/chunks/commonlisp-UCWSIHYK.js +0 -1
- package/public/assets/js/chunks/cose-bilkent-S5V4N54A-QVYRFFNC.js +0 -1
- package/public/assets/js/chunks/crystal-GR4VLC3M.js +0 -1
- package/public/assets/js/chunks/cs-CZ-V77HGUP7-OLBAKFG5.js +0 -7
- package/public/assets/js/chunks/css-C5DVWGB4.js +0 -1
- package/public/assets/js/chunks/cypher-K7FZM5GC.js +0 -1
- package/public/assets/js/chunks/d-CF3QNNH5.js +0 -1
- package/public/assets/js/chunks/da-DK-I5RFNTM4-QJIG2SEZ.js +0 -2
- package/public/assets/js/chunks/dagre-KLK3FWXG-KVNBUDOY.js +0 -4
- package/public/assets/js/chunks/de-CH-WLRDEVBV-4MMJDMVD.js +0 -7
- package/public/assets/js/chunks/de-DE-DTI4WUSC-ML7C46TT.js +0 -7
- package/public/assets/js/chunks/diagram-E7M64L7V-ZP33VRUC.js +0 -24
- package/public/assets/js/chunks/diagram-IFDJBPK2-ZG35YWOD.js +0 -43
- package/public/assets/js/chunks/diagram-P4PSJMXO-ZGIGM7D2.js +0 -24
- package/public/assets/js/chunks/diff-KOMSZU7O.js +0 -1
- package/public/assets/js/chunks/dist-7RQKSOUX.js +0 -7
- package/public/assets/js/chunks/dist-ARWGZ6MN.js +0 -1
- package/public/assets/js/chunks/dist-DPBSGC3Y.js +0 -2
- package/public/assets/js/chunks/dist-E36PJE5M.js +0 -1
- package/public/assets/js/chunks/dist-E5NM7OBW.js +0 -1
- package/public/assets/js/chunks/dist-ERADYPEK.js +0 -1
- package/public/assets/js/chunks/dist-F43RIHBZ.js +0 -1
- package/public/assets/js/chunks/dist-HAB5NIXI.js +0 -1
- package/public/assets/js/chunks/dist-HG23OLRA.js +0 -1
- package/public/assets/js/chunks/dist-IEJXBSDJ.js +0 -1
- package/public/assets/js/chunks/dist-IQA4KVJK.js +0 -1
- package/public/assets/js/chunks/dist-OIQTNVT2.js +0 -3
- package/public/assets/js/chunks/dist-PMZJ734S.js +0 -1
- package/public/assets/js/chunks/dist-RCQFQRLD.js +0 -1
- package/public/assets/js/chunks/dist-RQLC4GVI.js +0 -1
- package/public/assets/js/chunks/dist-RSJGLSKC.js +0 -1
- package/public/assets/js/chunks/dist-SGNQZVVX.js +0 -1
- package/public/assets/js/chunks/dist-VCFTF7Z6.js +0 -1
- package/public/assets/js/chunks/dist-VTO23SHH.js +0 -1
- package/public/assets/js/chunks/dist-XOODBV4L.js +0 -1
- package/public/assets/js/chunks/dist-ZFZNCRZY.js +0 -1
- package/public/assets/js/chunks/dockerfile-XCIKYOSI.js +0 -1
- package/public/assets/js/chunks/dtd-3XFH7W6Z.js +0 -1
- package/public/assets/js/chunks/dylan-3UWPKVOR.js +0 -1
- package/public/assets/js/chunks/ebnf-OLHTL3VN.js +0 -1
- package/public/assets/js/chunks/ecl-43LZ3ZRM.js +0 -1
- package/public/assets/js/chunks/editor-session-EAUBJCHH.js +0 -22
- package/public/assets/js/chunks/eiffel-ISPO2UJF.js +0 -1
- package/public/assets/js/chunks/el-GR-ZXDJ2OS4-WSCEIO6J.js +0 -7
- package/public/assets/js/chunks/elm-CLK576PK.js +0 -1
- package/public/assets/js/chunks/en-CTDJDZ6K-IC3QAUOI.js +0 -1
- package/public/assets/js/chunks/erDiagram-INFDFZHY-ZMS6H2TH.js +0 -70
- package/public/assets/js/chunks/erlang-AVQXQFOT.js +0 -1
- package/public/assets/js/chunks/es-ES-DYQHAD43-XGB5X5IM.js +0 -7
- package/public/assets/js/chunks/eu-ES-QDSYU5Y3-LA3JTIJ2.js +0 -7
- package/public/assets/js/chunks/excalidraw-mermaid-stub-NYXTOJ4H.js +0 -1
- package/public/assets/js/chunks/fa-IR-26LZG4PM-PFALMEDX.js +0 -9
- package/public/assets/js/chunks/factor-CRTVBD6Q.js +0 -1
- package/public/assets/js/chunks/fcl-FX24LKTH.js +0 -1
- package/public/assets/js/chunks/fi-FI-6YS4KDE4-ES5MV6P4.js +0 -6
- package/public/assets/js/chunks/flowDiagram-PKNHOUZH-QD4L5IE5.js +0 -162
- package/public/assets/js/chunks/forth-YKDKCTVS.js +0 -1
- package/public/assets/js/chunks/fortran-UJWC6SLU.js +0 -1
- package/public/assets/js/chunks/fr-FR-BRLLPTZC-VMFE22YV.js +0 -12
- package/public/assets/js/chunks/ganttDiagram-A5KZAMGK-VTMTQESP.js +0 -292
- package/public/assets/js/chunks/gas-MYEMWGRE.js +0 -1
- package/public/assets/js/chunks/gherkin-JWHAU2YG.js +0 -1
- package/public/assets/js/chunks/gitGraph-HDMCJU4V-YPHS74XX.js +0 -1
- package/public/assets/js/chunks/gitGraphDiagram-K3NZZRJ6-Z3EZ634T.js +0 -65
- package/public/assets/js/chunks/gl-ES-OKUZTLYG-GPT42ZHV.js +0 -6
- package/public/assets/js/chunks/groovy-QZIZQIAK.js +0 -1
- package/public/assets/js/chunks/haskell-JR3G7YNW.js +0 -1
- package/public/assets/js/chunks/haxe-TVLAIYEN.js +0 -1
- package/public/assets/js/chunks/he-IL-26MGYIU7-VQ5XQYYY.js +0 -8
- package/public/assets/js/chunks/hi-IN-Q4ZOGTP2-2Z766MXA.js +0 -3
- package/public/assets/js/chunks/http-YXQRE77G.js +0 -1
- package/public/assets/js/chunks/hu-HU-P2OXPSN5-6XDVPGTE.js +0 -3
- package/public/assets/js/chunks/id-ID-2EIKXYN6-J5GWSY2S.js +0 -8
- package/public/assets/js/chunks/idl-RAQGJ6LJ.js +0 -1
- package/public/assets/js/chunks/image-32MOCVDX-JN2EUMQG.js +0 -1
- package/public/assets/js/chunks/image-blob-reduce.esm-K5OWL55S.js +0 -13
- package/public/assets/js/chunks/info-3K5VOQVL-CXJSPNNP.js +0 -1
- package/public/assets/js/chunks/infoDiagram-LFFYTUFH-WQ34MUJA.js +0 -2
- package/public/assets/js/chunks/ishikawaDiagram-PHBUUO56-4IARWKJK.js +0 -70
- package/public/assets/js/chunks/it-IT-4CFKVXI2-NMBWUWFF.js +0 -12
- package/public/assets/js/chunks/ja-JP-MAND2Z4V-GQZYXXOC.js +0 -7
- package/public/assets/js/chunks/javascript-NM7KDJUE.js +0 -1
- package/public/assets/js/chunks/journeyDiagram-4ABVD52K-FJ4LF4SX.js +0 -139
- package/public/assets/js/chunks/julia-LG3BH25B.js +0 -1
- package/public/assets/js/chunks/kaa-HQRTCXTJ-7D6PAKDJ.js +0 -1
- package/public/assets/js/chunks/kab-KAB-JKIKKTGH-TNKFXNAX.js +0 -4
- package/public/assets/js/chunks/kanban-definition-K7BYSVSG-TY4EVYI3.js +0 -89
- package/public/assets/js/chunks/katex-5YJCUCFD.js +0 -261
- package/public/assets/js/chunks/kk-KZ-HXQ63ZFC-T4HCMWED.js +0 -1
- package/public/assets/js/chunks/km-KH-PKL3LSGX-HTLHEJV6.js +0 -7
- package/public/assets/js/chunks/ko-KR-KXLREZX3-QMR52QVI.js +0 -5
- package/public/assets/js/chunks/ku-TR-MJ4IER3X-K5CNY4UO.js +0 -6
- package/public/assets/js/chunks/livescript-4CVWVI4M.js +0 -1
- package/public/assets/js/chunks/lt-LT-H6WFQ6FJ-IW25FAGX.js +0 -3
- package/public/assets/js/chunks/lua-VWGE7DQ7.js +0 -1
- package/public/assets/js/chunks/lv-LV-GOCK6SJW-KTDFW5OH.js +0 -4
- package/public/assets/js/chunks/mathematica-D7APQSEU.js +0 -1
- package/public/assets/js/chunks/mbox-BN3XQBYX.js +0 -1
- package/public/assets/js/chunks/mermaid-runtime-BIFNJ2CT.js +0 -18
- package/public/assets/js/chunks/mindmap-definition-YRQLILUH-5B565RNP.js +0 -68
- package/public/assets/js/chunks/mirc-565WBI76.js +0 -1
- package/public/assets/js/chunks/mllike-VV3KS46B.js +0 -1
- package/public/assets/js/chunks/modelica-EGX44FZV.js +0 -1
- package/public/assets/js/chunks/mr-IN-IXVLDMEQ-PHM5DT7Q.js +0 -9
- package/public/assets/js/chunks/mscgen-GFGTHENT.js +0 -1
- package/public/assets/js/chunks/mumps-POZYWSMI.js +0 -1
- package/public/assets/js/chunks/my-MM-YG6MYTTD-ZHLCMEVA.js +0 -1
- package/public/assets/js/chunks/nb-NO-XGWJISD2-KSDFG6YU.js +0 -8
- package/public/assets/js/chunks/nginx-JUBX55EU.js +0 -1
- package/public/assets/js/chunks/nl-NL-XVDVCPNC-KVF3ZO2R.js +0 -13
- package/public/assets/js/chunks/nn-NO-EMX5MJX5-34QKSHNR.js +0 -4
- package/public/assets/js/chunks/nsis-RC4CREGM.js +0 -1
- package/public/assets/js/chunks/ntriples-4WK6CNVE.js +0 -1
- package/public/assets/js/chunks/oc-FR-ROEINTVO-5GP4AOYO.js +0 -4
- package/public/assets/js/chunks/octave-GOKFN2V7.js +0 -1
- package/public/assets/js/chunks/oz-OQUMNC63.js +0 -1
- package/public/assets/js/chunks/pa-IN-ZYN6SUDY-MVL7O44W.js +0 -4
- package/public/assets/js/chunks/packet-RMMSAZCW-D7XTR5TT.js +0 -1
- package/public/assets/js/chunks/pascal-BBWQWWWD.js +0 -1
- package/public/assets/js/chunks/percentages-5DKR754L-DG7W23CV.js +0 -1
- package/public/assets/js/chunks/perl-KTPJTTAM.js +0 -1
- package/public/assets/js/chunks/pica-6G3NROWT.js +0 -17
- package/public/assets/js/chunks/pie-UPGHQEXC-KGC3O6LN.js +0 -1
- package/public/assets/js/chunks/pieDiagram-SKSYHLDU-KWKRDEZS.js +0 -30
- package/public/assets/js/chunks/pig-IJMBS4FZ.js +0 -1
- package/public/assets/js/chunks/pl-PL-6VTG7PHC-VADRWSX4.js +0 -12
- package/public/assets/js/chunks/powershell-6YGCBHDP.js +0 -1
- package/public/assets/js/chunks/preview-render-compiler-6Y7TKXFJ.js +0 -1
- package/public/assets/js/chunks/properties-5QTD3364.js +0 -1
- package/public/assets/js/chunks/protobuf-LTRWBIK3.js +0 -1
- package/public/assets/js/chunks/pt-BR-5YFKRR5G-HHF4UPO4.js +0 -6
- package/public/assets/js/chunks/pt-PT-GEIXXZ67-TUTAUZJK.js +0 -8
- package/public/assets/js/chunks/pug-U4PV3WLG.js +0 -1
- package/public/assets/js/chunks/puppet-WGYJPR3Y.js +0 -1
- package/public/assets/js/chunks/python-6YGH4S47.js +0 -1
- package/public/assets/js/chunks/q-VIG4IJLI.js +0 -1
- package/public/assets/js/chunks/quadrantDiagram-337W2JSQ-GWQRUFHQ.js +0 -7
- package/public/assets/js/chunks/quick-switcher-controller-A6SKH5HI.js +0 -5
- package/public/assets/js/chunks/r-NVPCXGTR.js +0 -1
- package/public/assets/js/chunks/radar-KQ55EAFF-OPO64DRI.js +0 -1
- package/public/assets/js/chunks/requirementDiagram-Z7DCOOCP-ASW7IPJL.js +0 -73
- package/public/assets/js/chunks/ro-RO-E2P6TFZI-RJFCULYF.js +0 -12
- package/public/assets/js/chunks/roundRect-Z3DX3W5S.js +0 -1
- package/public/assets/js/chunks/rpm-UEA257HD.js +0 -1
- package/public/assets/js/chunks/ru-RU-YBIIY43T-BF27TNVK.js +0 -10
- package/public/assets/js/chunks/ruby-KPQRAJGE.js +0 -1
- package/public/assets/js/chunks/sankeyDiagram-WA2Y5GQK-W6BBWCLW.js +0 -10
- package/public/assets/js/chunks/sas-L7VATVH5.js +0 -1
- package/public/assets/js/chunks/scheme-T2NOWR3P.js +0 -1
- package/public/assets/js/chunks/sequenceDiagram-2WXFIKYE-H4G3ISLN.js +0 -145
- package/public/assets/js/chunks/shell-DLVDUNFA.js +0 -1
- package/public/assets/js/chunks/si-LK-673C2CI2-IOFGU4U2.js +0 -1
- package/public/assets/js/chunks/sieve-BKBZYDBU.js +0 -1
- package/public/assets/js/chunks/sk-SK-CKZHQ4AP-6O5JGN26.js +0 -7
- package/public/assets/js/chunks/sl-SI-557H2GWM-2NEHLV7W.js +0 -6
- package/public/assets/js/chunks/smalltalk-WRJQKJSD.js +0 -1
- package/public/assets/js/chunks/solr-66B3BIDL.js +0 -1
- package/public/assets/js/chunks/sparql-S25Z47JG.js +0 -1
- package/public/assets/js/chunks/spreadsheet-B272EF7Y.js +0 -1
- package/public/assets/js/chunks/sql-BPLIIUYC.js +0 -1
- package/public/assets/js/chunks/stateDiagram-RAJIS63D-OF5XXRUS.js +0 -1
- package/public/assets/js/chunks/stateDiagram-v2-FVOUBMTO-IV2CSQSQ.js +0 -1
- package/public/assets/js/chunks/stex-4IJY64QX.js +0 -1
- package/public/assets/js/chunks/stylus-PJUHLGPT.js +0 -1
- package/public/assets/js/chunks/subset-shared.chunk-4NMWHS4D.js +0 -1
- package/public/assets/js/chunks/subset-worker.chunk-NTLP7Y66.js +0 -1
- package/public/assets/js/chunks/sv-SE-XOPKKDWS-Q2L6KGFV.js +0 -8
- package/public/assets/js/chunks/swift-UYHTO4SX.js +0 -1
- package/public/assets/js/chunks/ta-IN-XBH7DQI3-ISSUGZAK.js +0 -6
- package/public/assets/js/chunks/tcl-OQ5J3VO2.js +0 -1
- package/public/assets/js/chunks/textile-NOGVBEYF.js +0 -1
- package/public/assets/js/chunks/th-TH-TOCWH3R4-TABEAMJA.js +0 -1
- package/public/assets/js/chunks/tiddlywiki-SYTK4QUE.js +0 -1
- package/public/assets/js/chunks/tiki-P7K4ZLOM.js +0 -1
- package/public/assets/js/chunks/timeline-definition-YZTLITO2-HBCANIUC.js +0 -61
- package/public/assets/js/chunks/toml-AUZYRP36.js +0 -1
- package/public/assets/js/chunks/tr-TR-GXW6CYY5-5NQRN52Y.js +0 -4
- package/public/assets/js/chunks/treemap-KZPCXAKY-WYMCT5F7.js +0 -1
- package/public/assets/js/chunks/troff-XFYJNQOJ.js +0 -1
- package/public/assets/js/chunks/ttcn-AK2IXWU6.js +0 -1
- package/public/assets/js/chunks/ttcn-cfg-3IDPIYPU.js +0 -1
- package/public/assets/js/chunks/turtle-OIDMF46P.js +0 -1
- package/public/assets/js/chunks/uk-UA-IJKTNUDG-2IIL3TO5.js +0 -6
- package/public/assets/js/chunks/uz-UZ-TBZZEA4V-X22KVKBP.js +0 -1
- package/public/assets/js/chunks/vb-J6K4XVA2.js +0 -1
- package/public/assets/js/chunks/vbscript-FM7DDZZE.js +0 -1
- package/public/assets/js/chunks/velocity-6KZFEOFD.js +0 -1
- package/public/assets/js/chunks/vennDiagram-LZ73GAT5-EBRF3MZR.js +0 -34
- package/public/assets/js/chunks/verilog-EWWQPMNN.js +0 -1
- package/public/assets/js/chunks/vhdl-CJ3M4IHI.js +0 -1
- package/public/assets/js/chunks/vi-VN-MULSGNVB-TENM65C7.js +0 -7
- package/public/assets/js/chunks/webidl-XVBHXCRV.js +0 -1
- package/public/assets/js/chunks/xquery-7WZOZ4UK.js +0 -1
- package/public/assets/js/chunks/xychartDiagram-JWTSCODW-WIFVRQPR.js +0 -7
- package/public/assets/js/chunks/yacas-MZ2ZZPF3.js +0 -1
- package/public/assets/js/chunks/z80-I447CBF7.js +0 -1
- package/public/assets/js/chunks/zh-CN-MVX3E32U-S5VA2BA5.js +0 -11
- package/public/assets/js/chunks/zh-HK-JNU5RLIE-A4VUKZFV.js +0 -1
- package/public/assets/js/chunks/zh-TW-LENVCA6T-KFB6KHMM.js +0 -9
- package/public/assets/js/excalidraw-editor-7ORML5YA.css +0 -1
- package/public/assets/js/excalidraw-editor-TCIH6GJL.js +0 -347
- package/public/assets/js/excalidraw-editor.css +0 -1
- package/public/assets/js/excalidraw-editor.js +0 -1
- package/public/assets/js/main.js +0 -381
- package/public/assets/js/preview-render-worker.js +0 -30
- /package/{public/assets/js/assets/Assistant-Bold-ZDZZ6JHA.woff2 → dist/client/assets/Assistant-Bold-gm-uSS1B.woff2} +0 -0
- /package/{public/assets/js/assets/Assistant-Medium-DZ25RZU3.woff2 → dist/client/assets/Assistant-Medium-DrcxCXg3.woff2} +0 -0
- /package/{public/assets/js/assets/Assistant-Regular-PLF2XOGW.woff2 → dist/client/assets/Assistant-Regular-DVxZuzxb.woff2} +0 -0
- /package/{public/assets/js/assets/Assistant-SemiBold-CZ5MX6FK.woff2 → dist/client/assets/Assistant-SemiBold-SCI4bEL9.woff2} +0 -0
- /package/{public → src/client}/assets/vendor/highlight/github-dark.min.css +0 -0
- /package/{public → src/client}/assets/vendor/highlight/github.min.css +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ar-SA-NXDWD63E-DND5MLpM.js","./chunk-SRAX5OIU-B-Zdxy2r.js","./chunk-Cq_f4orQ.js","./az-AZ-MXSORGZV-ILYw2sYr.js","./bg-BG-O6MV2KSF-DmfoZHM8.js","./bn-BD-T2VJNT7N-uYQx1Wph.js","./bn-IN-MMW2ORAC-CmlBLY7g.js","./ca-ES-MKBCGNOG-DWiYvMvF.js","./cs-CZ-V77HGUP7-sLBAF2Iw.js","./da-DK-I5RFNTM4-B__PLwca.js","./de-CH-WLRDEVBV-D61DKw_9.js","./de-DE-DTI4WUSC-Ba3fBYEU.js","./el-GR-ZXDJ2OS4-CpEbk42T.js","./en-CTDJDZ6K-C36Iqh9O.js","./chunk-ETSVUAFD-BnK5BhxL.js","./es-ES-DYQHAD43-Ba-6t0Wr.js","./eu-ES-QDSYU5Y3-CYzUKQ2_.js","./fa-IR-26LZG4PM-CxLc7ohL.js","./fi-FI-6YS4KDE4-DtYLOEJY.js","./fr-FR-BRLLPTZC-9O_U5gdi.js","./gl-ES-OKUZTLYG-Bb7TO64O.js","./he-IL-26MGYIU7-CQW1igm9.js","./hi-IN-Q4ZOGTP2-BM91ENLs.js","./hu-HU-P2OXPSN5-HiGbsUwM.js","./id-ID-2EIKXYN6-DEG8vRZ2.js","./it-IT-4CFKVXI2-DSrGqCKD.js","./ja-JP-MAND2Z4V-OFpEymIv.js","./kaa-HQRTCXTJ-CpOJ_vn4.js","./kab-KAB-JKIKKTGH-CNPzzJH6.js","./kk-KZ-HXQ63ZFC-CgtjU5JI.js","./km-KH-PKL3LSGX-BAJh8UnF.js","./ko-KR-KXLREZX3-BshOksBX.js","./ku-TR-MJ4IER3X-Bi3YtiD-.js","./lt-LT-H6WFQ6FJ-DQ2W0g7h.js","./lv-LV-GOCK6SJW-DeqTo8T7.js","./mr-IN-IXVLDMEQ-CnH5Wjc7.js","./my-MM-YG6MYTTD-BefEpouO.js","./nb-NO-XGWJISD2-CNRrlrPY.js","./nl-NL-XVDVCPNC-CuLTw3kL.js","./nn-NO-EMX5MJX5-NHFRnQkl.js","./oc-FR-ROEINTVO-8kCbAtcr.js","./pa-IN-ZYN6SUDY-Dh8USSIe.js","./percentages-5DKR754L-RQFE76Sg.js","./chunk-3PELD44J-BvOh9EJp.js","./pl-PL-6VTG7PHC-BMbgP62B.js","./pt-BR-5YFKRR5G-CyrwFw_N.js","./pt-PT-GEIXXZ67-SpK5vaGR.js","./ro-RO-E2P6TFZI-90dn2iUp.js","./ru-RU-YBIIY43T-Cl52NZnQ.js","./si-LK-673C2CI2-DMSUxT-y.js","./sk-SK-CKZHQ4AP-DUDai5Oe.js","./sl-SI-557H2GWM-BbLeATfl.js","./sv-SE-XOPKKDWS-BBa-AcMf.js","./ta-IN-XBH7DQI3-9uR7ADzx.js","./th-TH-TOCWH3R4-Box9U3ny.js","./tr-TR-GXW6CYY5-BA8pS3C5.js","./uk-UA-IJKTNUDG-B6hoHqzM.js","./uz-UZ-TBZZEA4V-CPuftH33.js","./vi-VN-MULSGNVB-yRFd9OXl.js","./zh-CN-MVX3E32U-VzUIXB4K.js","./zh-HK-JNU5RLIE-i0G2jHO_.js","./zh-TW-LENVCA6T-BkHZg3jv.js","./image-32MOCVDX-viHDtJGM.js","./chunk-27N2SPOM-RxZ2_zJJ.js","./preload-helper-Chd9yIcd.js","./chunk-A66AFZZU-D0IDIehU.js","./CodeMirrorEditor-UCMRAMCV-BHWNpLuY.js","./dist-DhkKj77m.js","./dist-CCxn5Mk-.js","./jsx-runtime-DRYOYO9I.js","./excalidraw-mermaid-stub-C1ZaaI05.js","./excalidraw-mermaid-stub-BtCKxPxK.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{s as e,t}from"./chunk-Cq_f4orQ.js";import{t as n}from"./preload-helper-Chd9yIcd.js";import{t as r}from"./chunk-A66AFZZU-D0IDIehU.js";import{i,n as a,r as o}from"./chunk-SRAX5OIU-B-Zdxy2r.js";import{n as s,t as c}from"./jsx-runtime-DRYOYO9I.js";import{$ as l,$a as u,$i as d,$n as f,$o as p,$r as m,$s as h,$t as g,A as _,Aa as v,Ac as y,Ai as b,An as x,Ao as S,Ar as C,As as w,At as T,B as E,Ba as D,Bc as O,Bi as k,Bn as A,Br as ee,Bs as te,Bt as ne,C as j,Ca as re,Cc as ie,Ci as ae,Cn as oe,Co as se,Cr as ce,Cs as le,Ct as ue,D as de,Da as fe,Dc as pe,Di as me,Dn as he,Do as ge,Dr as _e,Ds as ve,Dt as ye,E as be,Ea as xe,Ec as Se,Ei as Ce,En as M,Eo as N,Er as we,Es as Te,Et as Ee,F as De,Fa as Oe,Fc as ke,Fi as Ae,Fn as je,Fo as Me,Fr as Ne,Fs as Pe,Ft as Fe,G as Ie,Ga as Le,Gi as Re,Gn as ze,Go as Be,Gr as Ve,Gs as He,Gt as Ue,H as We,Ha as Ge,Hc as Ke,Hi as qe,Hn as Je,Ho as Ye,Hr as Xe,Hs as Ze,Ht as Qe,I as $e,Ia as et,Ic as tt,Ii as nt,In as rt,Io as it,Ir as at,Is as ot,It as st,J as ct,Ja as lt,Ji as P,Jn as ut,Jo as dt,Jr as ft,Js as pt,Jt as mt,K as ht,Ka as gt,Ki as _t,Kn as vt,Ko as yt,Kr as bt,Ks as xt,Kt as St,L as Ct,La as wt,Lc as Tt,Li as Et,Ln as Dt,Lo as Ot,Lr as kt,Ls as At,Lt as jt,M as Mt,Ma as Nt,Mc as Pt,Mn as Ft,Mo as It,Mr as Lt,Ms as Rt,Mt as zt,N as Bt,Na as Vt,Nc as Ht,Ni as Ut,Nn as Wt,No as Gt,Nr as Kt,Ns as qt,Nt as Jt,O as Yt,Oa as Xt,Oc as Zt,Oi as Qt,On as $t,Or as en,Os as tn,Ot as nn,P as rn,Pa as an,Pc as on,Pi as sn,Pn as cn,Po as ln,Pr as un,Ps as dn,Pt as fn,Q as pn,Qa as mn,Qi as hn,Qn as gn,Qo as _n,Qr as vn,Qs as yn,Qt as bn,R as xn,Ra as Sn,Rc as Cn,Ri as wn,Rn as Tn,Ro as En,Rr as Dn,Rs as On,Rt as kn,S as An,Sa as jn,Sc as Mn,Si as Nn,Sn as Pn,So as Fn,Sr as In,Ss as Ln,St as Rn,T as zn,Ta as Bn,Tc as Vn,Ti as Hn,Tn as Un,To as Wn,Tr as Gn,Ts as Kn,Tt as qn,U as Jn,Ua as F,Ui as Yn,Un as Xn,Ur as Zn,Us as Qn,Ut as $n,V as er,Va as tr,Vc as nr,Vi as rr,Vn as ir,Vo as ar,Vr as or,Vs as sr,Vt as cr,Wa as lr,Wi as ur,Wn as dr,Wo as fr,Wr as pr,Ws as mr,Wt as hr,X as gr,Xa as _r,Xi as vr,Xn as yr,Xo as br,Xr as xr,Xs as Sr,Xt as Cr,Y as wr,Ya as Tr,Yi as Er,Yn as Dr,Yo as Or,Yr as kr,Ys as Ar,Yt as jr,Za as Mr,Zi as Nr,Zn as Pr,Zo as Fr,Zr as Ir,Zs as Lr,Zt as Rr,_ as zr,_a as Br,_c as Vr,_i as Hr,_n as Ur,_o as Wr,_r as Gr,_s as Kr,_t as I,aa as qr,ac as Jr,ai as Yr,an as Xr,ao as Zr,ar as Qr,as as $r,at as ei,b as ti,ba as ni,bc as ri,bi as ii,bn as ai,bo as oi,br as si,bt as ci,c as li,ca as ui,cc as di,ci as fi,cn as pi,co as mi,cr as L,cs as hi,ct as gi,d as _i,da as vi,dc as yi,di as bi,dn as xi,dr as Si,ds as Ci,dt as wi,ea as Ti,ec as Ei,ei as Di,en as Oi,eo as ki,er as Ai,es as ji,et as Mi,f as Ni,fa as Pi,fc as Fi,fi as Ii,fn as Li,fo as Ri,fr as zi,fs as Bi,ft as Vi,g as Hi,ga as Ui,gc as Wi,gi as Gi,gn as Ki,go as qi,gr as Ji,gs as R,gt as Yi,h as Xi,ha as Zi,hc as Qi,hi as $i,hn as ea,ho as ta,hr as na,ht as ra,i as ia,ia as aa,ic as oa,ii as sa,in as ca,io as la,ir as ua,is as da,it as fa,j as pa,ja as ma,jc as ha,ji as ga,jn as _a,jo as va,jr as ya,js as ba,jt as xa,k as Sa,ka as Ca,kc as wa,ki as Ta,kn as Ea,ko as Da,kr as Oa,ks as ka,kt as Aa,l as ja,la as Ma,lc as Na,li as Pa,ln as Fa,lo as Ia,lr as La,ls as Ra,lt as za,m as Ba,ma as Va,mi as Ha,mn as Ua,mo as Wa,mr as Ga,ms as Ka,mt as qa,n as Ja,na as Ya,nc as Xa,ni as Za,nn as Qa,no as $a,nr as eo,ns as to,nt as no,o as ro,oa as io,oc as ao,oi as oo,on as so,oo as co,or as lo,os as uo,ot as fo,p as z,pa as po,pc as mo,pi as ho,pn as go,po as _o,pr as vo,ps as yo,pt as bo,q as xo,qa as So,qi as Co,qn as wo,qr as To,qs as Eo,qt as Do,r as Oo,ra as ko,rc as Ao,ri as jo,rn as B,ro as Mo,rr as No,rs as Po,rt as Fo,s as Io,sa as Lo,sc as Ro,si as zo,sn as Bo,so as Vo,sr as V,ss as Ho,st as Uo,t as Wo,ta as Go,tc as Ko,ti as qo,tn as Jo,to as Yo,tr as Xo,ts as Zo,tt as Qo,u as $o,ua as es,uc as ts,ui as ns,un as rs,uo as is,ur as as,us as os,ut as ss,v as cs,va as ls,vc as us,vi as ds,vn as fs,vo as ps,vr as ms,vs as hs,vt as gs,w as _s,wa as vs,wc as ys,wi as bs,wn as xs,wo as Ss,wr as Cs,ws,wt as Ts,x as Es,xa as Ds,xc as Os,xi as ks,xn as As,xo as js,xr as Ms,xs as Ns,xt as Ps,y as Fs,ya as Is,yc as Ls,yi as Rs,yn as zs,yo as Bs,yr as Vs,ys as Hs,yt as Us,z as Ws,za as Gs,zc as Ks,zi as qs,zn as Js,zo as Ys,zr as Xs,zs as Zs,zt as Qs}from"./chunk-27N2SPOM-RxZ2_zJJ.js";import{_ as $s}from"./chunk-ETSVUAFD-BnK5BhxL.js";import{r as ec}from"./chunk-3PELD44J-BvOh9EJp.js";import{n as tc}from"./excalidraw-mermaid-stub-BtCKxPxK.js";import{O as nc,n as rc,o as ic,r as ac,t as oc}from"./yjs-provider-reset-guard-BcnBGrS9.js";import{n as sc,t as cc}from"./vault-api-client-D7C_m9eq.js";var lc=t((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&&ee(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&&ee(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 ee(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,ee(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}}}})),uc=t(((e,t)=>{t.exports=lc()})),dc=t((e=>{var t=s();function n(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 r(){}var i={d:{f:r,r:function(){throw Error(n(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for(`react.portal`);function o(e,t,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:r==null?null:``+r,children:e,containerInfo:t,implementation:n}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function l(e,t){if(e===`font`)return``;if(typeof t==`string`)return t===`use-credentials`?t:``}e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,e.createPortal=function(e,t){var r=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)throw Error(n(299));return o(e,t,null,r)},e.flushSync=function(e){var t=c.T,n=i.p;try{if(c.T=null,i.p=2,e)return e()}finally{c.T=t,i.p=n,i.d.f()}},e.preconnect=function(e,t){typeof e==`string`&&(t?(t=t.crossOrigin,t=typeof t==`string`?t===`use-credentials`?t:``:void 0):t=null,i.d.C(e,t))},e.prefetchDNS=function(e){typeof e==`string`&&i.d.D(e)},e.preinit=function(e,t){if(typeof e==`string`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin),a=typeof t.integrity==`string`?t.integrity:void 0,o=typeof t.fetchPriority==`string`?t.fetchPriority:void 0;n===`style`?i.d.S(e,typeof t.precedence==`string`?t.precedence:void 0,{crossOrigin:r,integrity:a,fetchPriority:o}):n===`script`&&i.d.X(e,{crossOrigin:r,integrity:a,fetchPriority:o,nonce:typeof t.nonce==`string`?t.nonce:void 0})}},e.preinitModule=function(e,t){if(typeof e==`string`)if(typeof t==`object`&&t){if(t.as==null||t.as===`script`){var n=l(t.as,t.crossOrigin);i.d.M(e,{crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0})}}else t??i.d.M(e)},e.preload=function(e,t){if(typeof e==`string`&&typeof t==`object`&&t&&typeof t.as==`string`){var n=t.as,r=l(n,t.crossOrigin);i.d.L(e,n,{crossOrigin:r,integrity:typeof t.integrity==`string`?t.integrity:void 0,nonce:typeof t.nonce==`string`?t.nonce:void 0,type:typeof t.type==`string`?t.type:void 0,fetchPriority:typeof t.fetchPriority==`string`?t.fetchPriority:void 0,referrerPolicy:typeof t.referrerPolicy==`string`?t.referrerPolicy:void 0,imageSrcSet:typeof t.imageSrcSet==`string`?t.imageSrcSet:void 0,imageSizes:typeof t.imageSizes==`string`?t.imageSizes:void 0,media:typeof t.media==`string`?t.media:void 0})}},e.preloadModule=function(e,t){if(typeof e==`string`)if(t){var n=l(t.as,t.crossOrigin);i.d.m(e,{as:typeof t.as==`string`&&t.as!==`script`?t.as:void 0,crossOrigin:n,integrity:typeof t.integrity==`string`?t.integrity:void 0})}else i.d.m(e)},e.requestFormReset=function(e){i.d.r(e)},e.unstable_batchedUpdates=function(e,t){return e(t)},e.useFormState=function(e,t,n){return c.H.useFormState(e,t,n)},e.useFormStatus=function(){return c.H.useHostTransitionStatus()},e.version=`19.2.0`})),fc=t(((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=dc()})),pc=t((e=>{var t=uc(),n=s(),r=fc();function i(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 a(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function o(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 c(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 l(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 u(e){if(o(e)!==e)throw Error(i(188))}function d(e){var t=e.alternate;if(!t){if(t=o(e),t===null)throw Error(i(188));return t===e?e:null}for(var n=e,r=t;;){var a=n.return;if(a===null)break;var s=a.alternate;if(s===null){if(r=a.return,r!==null){n=r;continue}break}if(a.child===s.child){for(s=a.child;s;){if(s===n)return u(a),e;if(s===r)return u(a),t;s=s.sibling}throw Error(i(188))}if(n.return!==r.return)n=a,r=s;else{for(var c=!1,l=a.child;l;){if(l===n){c=!0,n=a,r=s;break}if(l===r){c=!0,r=a,n=s;break}l=l.sibling}if(!c){for(l=s.child;l;){if(l===n){c=!0,n=s,r=a;break}if(l===r){c=!0,r=s,n=a;break}l=l.sibling}if(!c)throw Error(i(189))}}if(n.alternate!==r)throw Error(i(190))}if(n.tag!==3)throw Error(i(188));return n.stateNode.current===n?e:t}function f(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=f(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,m=Symbol.for(`react.element`),h=Symbol.for(`react.transitional.element`),g=Symbol.for(`react.portal`),_=Symbol.for(`react.fragment`),v=Symbol.for(`react.strict_mode`),y=Symbol.for(`react.profiler`),b=Symbol.for(`react.consumer`),x=Symbol.for(`react.context`),S=Symbol.for(`react.forward_ref`),C=Symbol.for(`react.suspense`),w=Symbol.for(`react.suspense_list`),T=Symbol.for(`react.memo`),E=Symbol.for(`react.lazy`),D=Symbol.for(`react.activity`),O=Symbol.for(`react.memo_cache_sentinel`),k=Symbol.iterator;function A(e){return typeof e!=`object`||!e?null:(e=k&&e[k]||e[`@@iterator`],typeof e==`function`?e:null)}var ee=Symbol.for(`react.client.reference`);function te(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 _:return`Fragment`;case y:return`Profiler`;case v:return`StrictMode`;case C:return`Suspense`;case w:return`SuspenseList`;case D:return`Activity`}if(typeof e==`object`)switch(e.$$typeof){case g:return`Portal`;case x:return e.displayName||`Context`;case b:return(e._context.displayName||`Context`)+`.Consumer`;case S:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case T:return t=e.displayName||null,t===null?te(e.type)||`Memo`:t;case E:t=e._payload,e=e._init;try{return te(e(t))}catch{}}return null}var ne=Array.isArray,j=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,re=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},ae=[],oe=-1;function se(e){return{current:e}}function ce(e){0>oe||(e.current=ae[oe],ae[oe]=null,oe--)}function le(e,t){oe++,ae[oe]=e.current,e.current=t}var ue=se(null),de=se(null),fe=se(null),pe=se(null);function me(e,t){switch(le(fe,t),le(de,e),le(ue,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Yd(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Yd(t),e=Xd(t,e);else switch(e){case`svg`:e=1;break;case`math`:e=2;break;default:e=0}}ce(ue),le(ue,e)}function he(){ce(ue),ce(de),ce(fe)}function ge(e){e.memoizedState!==null&&le(pe,e);var t=ue.current,n=Xd(t,e.type);t!==n&&(le(de,e),le(ue,n))}function _e(e){de.current===e&&(ce(ue),ce(de)),pe.current===e&&(ce(pe),op._currentValue=ie)}var ve,ye;function be(e){if(ve===void 0)try{throw Error()}catch(e){var t=e.stack.trim().match(/\n( *(at )?)/);ve=t&&t[1]||``,ye=-1<e.stack.indexOf(`
|
|
3
|
+
at`)?` (<anonymous>)`:-1<e.stack.indexOf(`@`)?`@unknown:0:0`:``}return`
|
|
4
|
+
`+ve+e+ye}var xe=!1;function Se(e,t){if(!e||xe)return``;xe=!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{xe=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:``)?be(n):``}function Ce(e,t){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be(`Lazy`);case 13:return e.child!==t&&t!==null?be(`Suspense Fallback`):be(`Suspense`);case 19:return be(`SuspenseList`);case 0:case 15:return Se(e.type,!1);case 11:return Se(e.type.render,!1);case 1:return Se(e.type,!0);case 31:return be(`Activity`);default:return``}}function M(e){try{var t=``,n=null;do t+=Ce(e,n),n=e,e=e.return;while(e);return t}catch(e){return`
|
|
8
|
+
Error generating stack: `+e.message+`
|
|
9
|
+
`+e.stack}}var N=Object.prototype.hasOwnProperty,we=t.unstable_scheduleCallback,Te=t.unstable_cancelCallback,Ee=t.unstable_shouldYield,De=t.unstable_requestPaint,Oe=t.unstable_now,ke=t.unstable_getCurrentPriorityLevel,Ae=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,Me=t.unstable_NormalPriority,Ne=t.unstable_LowPriority,Pe=t.unstable_IdlePriority,Fe=t.log,Ie=t.unstable_setDisableYieldValue,Le=null,Re=null;function ze(e){if(typeof Fe==`function`&&Ie(e),Re&&typeof Re.setStrictMode==`function`)try{Re.setStrictMode(Le,e)}catch{}}var Be=Math.clz32?Math.clz32:Ue,Ve=Math.log,He=Math.LN2;function Ue(e){return e>>>=0,e===0?32:31-(Ve(e)/He|0)|0}var We=256,Ge=262144,Ke=4194304;function qe(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 Je(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=qe(n))):i=qe(o):i=qe(s)):(r=s&~a,r===0?(o&=s,o===0?n||(n=s&~e,n!==0&&(i=qe(n))):i=qe(o)):i=qe(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 Ye(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Xe(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 Ze(){var e=Ke;return Ke<<=1,!(Ke&62914560)&&(Ke=4194304),e}function Qe(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function $e(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function et(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-Be(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&&tt(e,r,0),a!==0&&i===0&&e.tag!==0&&(e.suspendedLanes|=a&~(o&~t))}function tt(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-Be(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|n&261930}function nt(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-Be(n),i=1<<r;i&t|e[r]&t&&(e[r]|=t),n&=~i}}function rt(e,t){var n=t&-t;return n=n&42?1:it(n),(n&(e.suspendedLanes|t))===0?n:0}function it(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 at(e){return e&=-e,2<e?8<e?e&134217727?32:268435456:8:2}function ot(){var e=re.p;return e===0?(e=window.event,e===void 0?32:Sp(e.type)):e}function st(e,t){var n=re.p;try{return re.p=e,t()}finally{re.p=n}}var ct=Math.random().toString(36).slice(2),lt=`__reactFiber$`+ct,P=`__reactProps$`+ct,ut=`__reactContainer$`+ct,dt=`__reactEvents$`+ct,ft=`__reactListeners$`+ct,pt=`__reactHandles$`+ct,mt=`__reactResources$`+ct,ht=`__reactMarker$`+ct;function gt(e){delete e[lt],delete e[P],delete e[dt],delete e[ft],delete e[pt]}function _t(e){var t=e[lt];if(t)return t;for(var n=e.parentNode;n;){if(t=n[ut]||n[lt]){if(n=t.alternate,t.child!==null||n!==null&&n.child!==null)for(e=yf(e);e!==null;){if(n=e[lt])return n;e=yf(e)}return t}e=n,n=e.parentNode}return null}function vt(e){if(e=e[lt]||e[ut]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function yt(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function bt(e){var t=e[mt];return t||=e[mt]={hoistableStyles:new Map,hoistableScripts:new Map},t}function xt(e){e[ht]=!0}var St=new Set,Ct={};function wt(e,t){Tt(e,t),Tt(e+`Capture`,t)}function Tt(e,t){for(Ct[e]=t,e=0;e<t.length;e++)St.add(t[e])}var Et=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]*$`),Dt={},Ot={};function kt(e){return N.call(Ot,e)?!0:N.call(Dt,e)?!1:Et.test(e)?Ot[e]=!0:(Dt[e]=!0,!1)}function At(e,t,n){if(kt(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 jt(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 Mt(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 Nt(e){switch(typeof e){case`bigint`:case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function Pt(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function Ft(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 It(e){if(!e._valueTracker){var t=Pt(e)?`checked`:`value`;e._valueTracker=Ft(e,t,``+e[t])}}function Lt(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=Pt(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function Rt(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 zt=/[\n"\\]/g;function Bt(e){return e.replace(zt,function(e){return`\\`+e.charCodeAt(0).toString(16)+` `})}function Vt(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=``+Nt(t)):e.value!==``+Nt(t)&&(e.value=``+Nt(t)),t==null?n==null?r!=null&&e.removeAttribute(`value`):Ut(e,o,Nt(n)):Ut(e,o,Nt(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=``+Nt(s):e.removeAttribute(`name`)}function Ht(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)){It(e);return}n=n==null?``:``+Nt(n),t=t==null?n:``+Nt(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),It(e)}function Ut(e,t,n){t===`number`&&Rt(e.ownerDocument)===e||e.defaultValue===``+n||(e.defaultValue=``+n)}function Wt(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=``+Nt(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 Gt(e,t,n){if(t!=null&&(t=``+Nt(t),t!==e.value&&(e.value=t),n==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=n==null?``:``+Nt(n)}function Kt(e,t,n,r){if(t==null){if(r!=null){if(n!=null)throw Error(i(92));if(ne(r)){if(1<r.length)throw Error(i(93));r=r[0]}n=r}n??=``,t=n}n=Nt(t),e.defaultValue=n,r=e.textContent,r===n&&r!==``&&r!==null&&(e.value=r),It(e)}function qt(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Jt=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 Yt(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||Jt.has(t)?t===`float`?e.cssFloat=n:e[t]=(``+n).trim():e[t]=n+`px`}function Xt(e,t,n){if(t!=null&&typeof t!=`object`)throw Error(i(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 a in t)r=t[a],t.hasOwnProperty(a)&&n[a]!==r&&Yt(e,a,r)}else for(var o in t)t.hasOwnProperty(o)&&Yt(e,o,t[o])}function Zt(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 Qt=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`]]),$t=/^[\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 en(e){return $t.test(``+e)?`javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')`:e}function tn(){}var nn=null;function rn(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var an=null,on=null;function sn(e){var t=vt(e);if(t&&(e=t.stateNode)){var n=e[P]||null;a:switch(e=t.stateNode,t.type){case`input`:if(Vt(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="`+Bt(``+t)+`"][type="radio"]`),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var a=r[P]||null;if(!a)throw Error(i(90));Vt(r,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(t=0;t<n.length;t++)r=n[t],r.form===e.form&&Lt(r)}break a;case`textarea`:Gt(e,n.value,n.defaultValue);break a;case`select`:t=n.value,t!=null&&Wt(e,!!n.multiple,t,!1)}}}var cn=!1;function ln(e,t,n){if(cn)return e(t,n);cn=!0;try{return e(t)}finally{if(cn=!1,(an!==null||on!==null)&&(Tu(),an&&(t=an,e=on,on=an=null,sn(t),e)))for(t=0;t<e.length;t++)sn(e[t])}}function un(e,t){var n=e.stateNode;if(n===null)return null;var r=n[P]||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(i(231,t,typeof n));return n}var dn=!(typeof window>`u`||window.document===void 0||window.document.createElement===void 0),fn=!1;if(dn)try{var pn={};Object.defineProperty(pn,`passive`,{get:function(){fn=!0}}),window.addEventListener(`test`,pn,pn),window.removeEventListener(`test`,pn,pn)}catch{fn=!1}var mn=null,hn=null,gn=null;function _n(){if(gn)return gn;var e,t=hn,n=t.length,r,i=`value`in mn?mn.value:mn.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 gn=i.slice(e,1<r?1-r:void 0)}function vn(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 yn(){return!0}function bn(){return!1}function xn(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)?yn:bn,this.isPropagationStopped=bn,this}return p(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=yn)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():typeof e.cancelBubble!=`unknown`&&(e.cancelBubble=!0),this.isPropagationStopped=yn)},persist:function(){},isPersistent:yn}),t}var Sn={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Cn=xn(Sn),wn=p({},Sn,{view:0,detail:0}),Tn=xn(wn),En,Dn,On,kn=p({},wn,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Bn,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!==On&&(On&&e.type===`mousemove`?(En=e.screenX-On.screenX,Dn=e.screenY-On.screenY):Dn=En=0,On=e),En)},movementY:function(e){return`movementY`in e?e.movementY:Dn}}),An=xn(kn),jn=xn(p({},kn,{dataTransfer:0})),Mn=xn(p({},wn,{relatedTarget:0})),Nn=xn(p({},Sn,{animationName:0,elapsedTime:0,pseudoElement:0})),Pn=xn(p({},Sn,{clipboardData:function(e){return`clipboardData`in e?e.clipboardData:window.clipboardData}})),Fn=xn(p({},Sn,{data:0})),In={Esc:`Escape`,Spacebar:` `,Left:`ArrowLeft`,Up:`ArrowUp`,Right:`ArrowRight`,Down:`ArrowDown`,Del:`Delete`,Win:`OS`,Menu:`ContextMenu`,Apps:`ContextMenu`,Scroll:`ScrollLock`,MozPrintableKey:`Unidentified`},Ln={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`},Rn={Alt:`altKey`,Control:`ctrlKey`,Meta:`metaKey`,Shift:`shiftKey`};function zn(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Rn[e])?!!t[e]:!1}function Bn(){return zn}var Vn=xn(p({},wn,{key:function(e){if(e.key){var t=In[e.key]||e.key;if(t!==`Unidentified`)return t}return e.type===`keypress`?(e=vn(e),e===13?`Enter`:String.fromCharCode(e)):e.type===`keydown`||e.type===`keyup`?Ln[e.keyCode]||`Unidentified`:``},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Bn,charCode:function(e){return e.type===`keypress`?vn(e):0},keyCode:function(e){return e.type===`keydown`||e.type===`keyup`?e.keyCode:0},which:function(e){return e.type===`keypress`?vn(e):e.type===`keydown`||e.type===`keyup`?e.keyCode:0}})),Hn=xn(p({},kn,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Un=xn(p({},wn,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Bn})),Wn=xn(p({},Sn,{propertyName:0,elapsedTime:0,pseudoElement:0})),Gn=xn(p({},kn,{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})),Kn=xn(p({},Sn,{newState:0,oldState:0})),qn=[9,13,27,32],Jn=dn&&`CompositionEvent`in window,F=null;dn&&`documentMode`in document&&(F=document.documentMode);var Yn=dn&&`TextEvent`in window&&!F,Xn=dn&&(!Jn||F&&8<F&&11>=F),Zn=` `,Qn=!1;function $n(e,t){switch(e){case`keyup`:return qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function er(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var tr=!1;function nr(e,t){switch(e){case`compositionend`:return er(t);case`keypress`:return t.which===32?(Qn=!0,Zn):null;case`textInput`:return e=t.data,e===Zn&&Qn?null:e;default:return null}}function rr(e,t){if(tr)return e===`compositionend`||!Jn&&$n(e,t)?(e=_n(),gn=hn=mn=null,tr=!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 Xn&&t.locale!==`ko`?null:t.data;default:return null}}var ir={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 ar(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t===`input`?!!ir[e.type]:t===`textarea`}function or(e,t,n,r){an?on?on.push(r):on=[r]:an=r,t=Nd(t,`onChange`),0<t.length&&(n=new Cn(`onChange`,`change`,null,n,r),e.push({event:n,listeners:t}))}var sr=null,cr=null;function lr(e){Td(e,0)}function ur(e){if(Lt(yt(e)))return e}function dr(e,t){if(e===`change`)return t}var fr=!1;if(dn){var pr;if(dn){var mr=`oninput`in document;if(!mr){var hr=document.createElement(`div`);hr.setAttribute(`oninput`,`return;`),mr=typeof hr.oninput==`function`}pr=mr}else pr=!1;fr=pr&&(!document.documentMode||9<document.documentMode)}function gr(){sr&&(sr.detachEvent(`onpropertychange`,_r),cr=sr=null)}function _r(e){if(e.propertyName===`value`&&ur(cr)){var t=[];or(t,cr,e,rn(e)),ln(lr,t)}}function vr(e,t,n){e===`focusin`?(gr(),sr=t,cr=n,sr.attachEvent(`onpropertychange`,_r)):e===`focusout`&&gr()}function yr(e){if(e===`selectionchange`||e===`keyup`||e===`keydown`)return ur(cr)}function br(e,t){if(e===`click`)return ur(t)}function xr(e,t){if(e===`input`||e===`change`)return ur(t)}function Sr(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Cr=typeof Object.is==`function`?Object.is:Sr;function wr(e,t){if(Cr(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(!N.call(t,i)||!Cr(e[i],t[i]))return!1}return!0}function Tr(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function Er(e,t){var n=Tr(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=Tr(n)}}function Dr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Dr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Or(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Rt(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=Rt(e.document)}return t}function kr(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 Ar=dn&&`documentMode`in document&&11>=document.documentMode,jr=null,Mr=null,Nr=null,Pr=!1;function Fr(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pr||jr==null||jr!==Rt(r)||(r=jr,`selectionStart`in r&&kr(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}),Nr&&wr(Nr,r)||(Nr=r,r=Nd(Mr,`onSelect`),0<r.length&&(t=new Cn(`onSelect`,`select`,null,t,n),e.push({event:t,listeners:r}),t.target=jr)))}function Ir(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n[`Webkit`+e]=`webkit`+t,n[`Moz`+e]=`moz`+t,n}var Lr={animationend:Ir(`Animation`,`AnimationEnd`),animationiteration:Ir(`Animation`,`AnimationIteration`),animationstart:Ir(`Animation`,`AnimationStart`),transitionrun:Ir(`Transition`,`TransitionRun`),transitionstart:Ir(`Transition`,`TransitionStart`),transitioncancel:Ir(`Transition`,`TransitionCancel`),transitionend:Ir(`Transition`,`TransitionEnd`)},Rr={},zr={};dn&&(zr=document.createElement(`div`).style,`AnimationEvent`in window||(delete Lr.animationend.animation,delete Lr.animationiteration.animation,delete Lr.animationstart.animation),`TransitionEvent`in window||delete Lr.transitionend.transition);function Br(e){if(Rr[e])return Rr[e];if(!Lr[e])return e;var t=Lr[e],n;for(n in t)if(t.hasOwnProperty(n)&&n in zr)return Rr[e]=t[n];return e}var Vr=Br(`animationend`),Hr=Br(`animationiteration`),Ur=Br(`animationstart`),Wr=Br(`transitionrun`),Gr=Br(`transitionstart`),Kr=Br(`transitioncancel`),I=Br(`transitionend`),qr=new Map,Jr=`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(` `);Jr.push(`scrollEnd`);function Yr(e,t){qr.set(e,t),wt(t,[e])}var Xr=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)},Zr=[],Qr=0,$r=0;function ei(){for(var e=Qr,t=$r=Qr=0;t<e;){var n=Zr[t];Zr[t++]=null;var r=Zr[t];Zr[t++]=null;var i=Zr[t];Zr[t++]=null;var a=Zr[t];if(Zr[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&&ii(n,i,a)}}function ti(e,t,n,r){Zr[Qr++]=e,Zr[Qr++]=t,Zr[Qr++]=n,Zr[Qr++]=r,$r|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function ni(e,t,n,r){return ti(e,t,n,r),ai(e)}function ri(e,t){return ti(e,null,null,t),ai(e)}function ii(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-Be(n),e=a.hiddenUpdates,r=e[i],r===null?e[i]=[t]:r.push(t),t.lane=n|536870912),a):null}function ai(e){if(50<gu)throw gu=0,_u=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var oi={};function si(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 ci(e,t,n,r){return new si(e,t,n,r)}function li(e){return e=e.prototype,!(!e||!e.isReactComponent)}function ui(e,t){var n=e.alternate;return n===null?(n=ci(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 di(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 fi(e,t,n,r,a,o){var s=0;if(r=e,typeof e==`function`)li(e)&&(s=1);else if(typeof e==`string`)s=Zf(e,n,ue.current)?26:e===`html`||e===`head`||e===`body`?27:5;else a:switch(e){case D:return e=ci(31,n,t,a),e.elementType=D,e.lanes=o,e;case _:return pi(n.children,a,o,t);case v:s=8,a|=24;break;case y:return e=ci(12,n,t,a|2),e.elementType=y,e.lanes=o,e;case C:return e=ci(13,n,t,a),e.elementType=C,e.lanes=o,e;case w:return e=ci(19,n,t,a),e.elementType=w,e.lanes=o,e;default:if(typeof e==`object`&&e)switch(e.$$typeof){case x:s=10;break a;case b:s=9;break a;case S:s=11;break a;case T:s=14;break a;case E:s=16,r=null;break a}s=29,n=Error(i(130,e===null?`null`:typeof e,``)),r=null}return t=ci(s,n,t,a),t.elementType=e,t.type=r,t.lanes=o,t}function pi(e,t,n,r){return e=ci(7,e,r,t),e.lanes=n,e}function mi(e,t,n){return e=ci(6,e,null,t),e.lanes=n,e}function L(e){var t=ci(18,null,null,0);return t.stateNode=e,t}function hi(e,t,n){return t=ci(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var gi=new WeakMap;function _i(e,t){if(typeof e==`object`&&e){var n=gi.get(e);return n===void 0?(t={value:e,source:t,stack:M(t)},gi.set(e,t),t):n}return{value:e,source:t,stack:M(t)}}var vi=[],yi=0,bi=null,xi=0,Si=[],Ci=0,wi=null,Ti=1,Ei=``;function Di(e,t){vi[yi++]=xi,vi[yi++]=bi,bi=e,xi=t}function Oi(e,t,n){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,wi=e;var r=Ti;e=Ei;var i=32-Be(r)-1;r&=~(1<<i),n+=1;var a=32-Be(t)+i;if(30<a){var o=i-i%5;a=(r&(1<<o)-1).toString(32),r>>=o,i-=o,Ti=1<<32-Be(t)+i|n<<i|r,Ei=a+e}else Ti=1<<a|n<<i|r,Ei=e}function ki(e){e.return!==null&&(Di(e,1),Oi(e,1,0))}function Ai(e){for(;e===bi;)bi=vi[--yi],vi[yi]=null,xi=vi[--yi],vi[yi]=null;for(;e===wi;)wi=Si[--Ci],Si[Ci]=null,Ei=Si[--Ci],Si[Ci]=null,Ti=Si[--Ci],Si[Ci]=null}function ji(e,t){Si[Ci++]=Ti,Si[Ci++]=Ei,Si[Ci++]=wi,Ti=t.id,Ei=t.overflow,wi=e}var Mi=null,Ni=null,Pi=!1,Fi=null,Ii=!1,Li=Error(i(519));function Ri(e){throw Wi(_i(Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?`text`:`HTML`,``)),e)),Li}function zi(e){var t=e.stateNode,n=e.type,r=e.memoizedProps;switch(t[lt]=e,t[P]=r,n){case`dialog`:Ed(`cancel`,t),Ed(`close`,t);break;case`iframe`:case`object`:case`embed`:Ed(`load`,t);break;case`video`:case`audio`:for(n=0;n<Cd.length;n++)Ed(Cd[n],t);break;case`source`:Ed(`error`,t);break;case`img`:case`image`:case`link`:Ed(`error`,t),Ed(`load`,t);break;case`details`:Ed(`toggle`,t);break;case`input`:Ed(`invalid`,t),Ht(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case`select`:Ed(`invalid`,t);break;case`textarea`:Ed(`invalid`,t),Kt(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||zd(t.textContent,n)?(r.popover!=null&&(Ed(`beforetoggle`,t),Ed(`toggle`,t)),r.onScroll!=null&&Ed(`scroll`,t),r.onScrollEnd!=null&&Ed(`scrollend`,t),r.onClick!=null&&(t.onclick=tn),t=!0):t=!1,t||Ri(e,!0)}function Bi(e){for(Mi=e.return;Mi;)switch(Mi.tag){case 5:case 31:case 13:Ii=!1;return;case 27:case 3:Ii=!0;return;default:Mi=Mi.return}}function Vi(e){if(e!==Mi)return!1;if(!Pi)return Bi(e),Pi=!0,!1;var t=e.tag,n;if((n=t!==3&&t!==27)&&((n=t===5)&&(n=e.type,n=!(n!==`form`&&n!==`button`)||Zd(e.type,e.memoizedProps)),n=!n),n&&Ni&&Ri(e),Bi(e),t===13){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=vf(e)}else if(t===31){if(e=e.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(317));Ni=vf(e)}else t===27?(t=Ni,of(e.type)?(e=_f,_f=null,Ni=e):Ni=t):Ni=Mi?gf(e.stateNode.nextSibling):null;return!0}function Hi(){Ni=Mi=null,Pi=!1}function Ui(){var e=Fi;return e!==null&&(nu===null?nu=e:nu.push.apply(nu,e),Fi=null),e}function Wi(e){Fi===null?Fi=[e]:Fi.push(e)}var Gi=se(null),Ki=null,qi=null;function Ji(e,t,n){le(Gi,t._currentValue),t._currentValue=n}function R(e){e._currentValue=Gi.current,ce(Gi)}function Yi(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 Xi(e,t,n,r){var a=e.child;for(a!==null&&(a.return=e);a!==null;){var o=a.dependencies;if(o!==null){var s=a.child;o=o.firstContext;a:for(;o!==null;){var c=o;o=a;for(var l=0;l<t.length;l++)if(c.context===t[l]){o.lanes|=n,c=o.alternate,c!==null&&(c.lanes|=n),Yi(o.return,n,e),r||(s=null);break a}o=c.next}}else if(a.tag===18){if(s=a.return,s===null)throw Error(i(341));s.lanes|=n,o=s.alternate,o!==null&&(o.lanes|=n),Yi(s,n,e),s=null}else s=a.child;if(s!==null)s.return=a;else for(s=a;s!==null;){if(s===e){s=null;break}if(a=s.sibling,a!==null){a.return=s.return,s=a;break}s=s.return}a=s}}function Zi(e,t,n,r){e=null;for(var a=t,o=!1;a!==null;){if(!o){if(a.flags&524288)o=!0;else if(a.flags&262144)break}if(a.tag===10){var s=a.alternate;if(s===null)throw Error(i(387));if(s=s.memoizedProps,s!==null){var c=a.type;Cr(a.pendingProps.value,s.value)||(e===null?e=[c]:e.push(c))}}else if(a===pe.current){if(s=a.alternate,s===null)throw Error(i(387));s.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(e===null?e=[op]:e.push(op))}a=a.return}e!==null&&Xi(t,e,n,r),t.flags|=262144}function Qi(e){for(e=e.firstContext;e!==null;){if(!Cr(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function $i(e){Ki=e,qi=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function ea(e){return na(Ki,e)}function ta(e,t){return Ki===null&&$i(e),na(e,t)}function na(e,t){var n=t._currentValue;if(t={context:t,memoizedValue:n,next:null},qi===null){if(e===null)throw Error(i(308));qi=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else qi=qi.next=t;return n}var ra=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()})}},ia=t.unstable_scheduleCallback,aa=t.unstable_NormalPriority,oa={$$typeof:x,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function sa(){return{controller:new ra,data:new Map,refCount:0}}function ca(e){e.refCount--,e.refCount===0&&ia(aa,function(){e.controller.abort()})}var la=null,ua=0,da=0,fa=null;function pa(e,t){if(la===null){var n=la=[];ua=0,da=_d(),fa={status:`pending`,value:void 0,then:function(e){n.push(e)}}}return ua++,t.then(ma,ma),t}function ma(){if(--ua===0&&la!==null){fa!==null&&(fa.status=`fulfilled`);var e=la;la=null,da=0,fa=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function ha(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 ga=j.S;j.S=function(e,t){au=Oe(),typeof t==`object`&&t&&typeof t.then==`function`&&pa(e,t),ga!==null&&ga(e,t)};var _a=se(null);function va(){var e=_a.current;return e===null?Bl.pooledCache:e}function ya(e,t){t===null?le(_a,_a.current):le(_a,t.pool)}function ba(){var e=va();return e===null?null:{parent:oa._currentValue,pool:e}}var xa=Error(i(460)),Sa=Error(i(474)),Ca=Error(i(542)),wa={then:function(){}};function Ta(e){return e=e.status,e===`fulfilled`||e===`rejected`}function Ea(e,t,n){switch(n=e[n],n===void 0?e.push(t):n!==t&&(t.then(tn,tn),t=n),t.status){case`fulfilled`:return t.value;case`rejected`:throw e=t.reason,Aa(e),e;default:if(typeof t.status==`string`)t.then(tn,tn);else{if(e=Bl,e!==null&&100<e.shellSuspendCounter)throw Error(i(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,Aa(e),e}throw Oa=t,xa}}function Da(e){try{var t=e._init;return t(e._payload)}catch(e){throw typeof e==`object`&&e&&typeof e.then==`function`?(Oa=e,xa):e}}var Oa=null;function ka(){if(Oa===null)throw Error(i(459));var e=Oa;return Oa=null,e}function Aa(e){if(e===xa||e===Ca)throw Error(i(483))}var ja=null,Ma=0;function Na(e){var t=Ma;return Ma+=1,ja===null&&(ja=[]),Ea(ja,e,t)}function Pa(e,t){t=t.props.ref,e.ref=t===void 0?null:t}function Fa(e,t){throw t.$$typeof===m?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e===`[object Object]`?`object with keys {`+Object.keys(t).join(`, `)+`}`:e)))}function Ia(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 a(e,t){return e=ui(e,t),e.index=0,e.sibling=null,e}function o(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=mi(n,e.mode,r),t.return=e,t):(t=a(t,n),t.return=e,t)}function l(e,t,n,r){var i=n.type;return i===_?d(e,t,n.props.children,r,n.key):t!==null&&(t.elementType===i||typeof i==`object`&&i&&i.$$typeof===E&&Da(i)===t.type)?(t=a(t,n.props),Pa(t,n),t.return=e,t):(t=fi(n.type,n.key,n.props,null,e.mode,r),Pa(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=hi(n,e.mode,r),t.return=e,t):(t=a(t,n.children||[]),t.return=e,t)}function d(e,t,n,r,i){return t===null||t.tag!==7?(t=pi(n,e.mode,r,i),t.return=e,t):(t=a(t,n),t.return=e,t)}function f(e,t,n){if(typeof t==`string`&&t!==``||typeof t==`number`||typeof t==`bigint`)return t=mi(``+t,e.mode,n),t.return=e,t;if(typeof t==`object`&&t){switch(t.$$typeof){case h:return n=fi(t.type,t.key,t.props,null,e.mode,n),Pa(n,t),n.return=e,n;case g:return t=hi(t,e.mode,n),t.return=e,t;case E:return t=Da(t),f(e,t,n)}if(ne(t)||A(t))return t=pi(t,e.mode,n,null),t.return=e,t;if(typeof t.then==`function`)return f(e,Na(t),n);if(t.$$typeof===x)return f(e,ta(e,t),n);Fa(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 h:return n.key===i?l(e,t,n,r):null;case g:return n.key===i?u(e,t,n,r):null;case E:return n=Da(n),p(e,t,n,r)}if(ne(n)||A(n))return i===null?d(e,t,n,r,null):null;if(typeof n.then==`function`)return p(e,t,Na(n),r);if(n.$$typeof===x)return p(e,t,ta(e,n),r);Fa(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 h:return e=e.get(r.key===null?n:r.key)||null,l(t,e,r,i);case g:return e=e.get(r.key===null?n:r.key)||null,u(t,e,r,i);case E:return r=Da(r),m(e,t,n,r,i)}if(ne(r)||A(r))return e=e.get(n)||null,d(t,e,r,i,null);if(typeof r.then==`function`)return m(e,t,n,Na(r),i);if(r.$$typeof===x)return m(e,t,n,ta(t,r),i);Fa(t,r)}return null}function v(i,a,s,c){for(var l=null,u=null,d=a,h=a=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),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(i,d),Pi&&Di(i,h),l;if(d===null){for(;h<s.length;h++)d=f(i,s[h],c),d!==null&&(a=o(d,a,h),u===null?l=d:u.sibling=d,u=d);return Pi&&Di(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),a=o(g,a,h),u===null?l=g:u.sibling=g,u=g);return e&&d.forEach(function(e){return t(i,e)}),Pi&&Di(i,h),l}function y(a,s,c,l){if(c==null)throw Error(i(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(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Pi&&Di(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Pi&&Di(a,g),u}for(h=r(h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Pi&&Di(a,g),u}function b(e,r,o,c){if(typeof o==`object`&&o&&o.type===_&&o.key===null&&(o=o.props.children),typeof o==`object`&&o){switch(o.$$typeof){case h:a:{for(var l=o.key;r!==null;){if(r.key===l){if(l=o.type,l===_){if(r.tag===7){n(e,r.sibling),c=a(r,o.props.children),c.return=e,e=c;break a}}else if(r.elementType===l||typeof l==`object`&&l&&l.$$typeof===E&&Da(l)===r.type){n(e,r.sibling),c=a(r,o.props),Pa(c,o),c.return=e,e=c;break a}n(e,r);break}else t(e,r);r=r.sibling}o.type===_?(c=pi(o.props.children,e.mode,c,o.key),c.return=e,e=c):(c=fi(o.type,o.key,o.props,null,e.mode,c),Pa(c,o),c.return=e,e=c)}return s(e);case g:a:{for(l=o.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===o.containerInfo&&r.stateNode.implementation===o.implementation){n(e,r.sibling),c=a(r,o.children||[]),c.return=e,e=c;break a}else{n(e,r);break}else t(e,r);r=r.sibling}c=hi(o,e.mode,c),c.return=e,e=c}return s(e);case E:return o=Da(o),b(e,r,o,c)}if(ne(o))return v(e,r,o,c);if(A(o)){if(l=A(o),typeof l!=`function`)throw Error(i(150));return o=l.call(o),y(e,r,o,c)}if(typeof o.then==`function`)return b(e,r,Na(o),c);if(o.$$typeof===x)return b(e,r,ta(e,o),c);Fa(e,o)}return typeof o==`string`&&o!==``||typeof o==`number`||typeof o==`bigint`?(o=``+o,r!==null&&r.tag===6?(n(e,r.sibling),c=a(r,o),c.return=e,e=c):(n(e,r),c=mi(o,e.mode,c),c.return=e,e=c),s(e)):n(e,r)}return function(e,t,n,r){try{Ma=0;var i=b(e,t,n,r);return ja=null,i}catch(t){if(t===xa||t===Ca)throw t;var a=ci(29,t,null,e.mode);return a.lanes=r,a.return=e,a}}}var La=Ia(!0),Ra=Ia(!1),za=!1;function Ba(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Va(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 Ha(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function Ua(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,zl&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=ai(e),ii(e,null,n),t}return ti(e,r,t,n),ai(e)}function Wa(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,nt(e,n)}}function Ga(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 Ka=!1;function qa(){if(Ka){var e=fa;if(e!==null)throw e}}function Ja(e,t,n,r){Ka=!1;var i=e.updateQueue;za=!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,m=f!==s.lane;if(m?(Hl&f)===f:(r&f)===f){f!==0&&f===da&&(Ka=!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=p({},d,f);break a;case 2:za=!0}}f=s.callback,f!==null&&(e.flags|=64,m&&(e.flags|=8192),m=i.callbacks,m===null?i.callbacks=[f]:m.push(f))}else m={lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=m,c=d):u=u.next=m,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;m=s,s=m.next,m.next=null,i.lastBaseUpdate=m,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),Xl|=o,e.lanes=o,e.memoizedState=d}}function Ya(e,t){if(typeof e!=`function`)throw Error(i(191,e));e.call(t)}function Xa(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;e<n.length;e++)Ya(n[e],t)}var Za=se(null),Qa=se(0);function $a(e,t){e=Jl,le(Qa,e),le(Za,t),Jl=e|t.baseLanes}function eo(){le(Qa,Jl),le(Za,Za.current)}function to(){Jl=Qa.current,ce(Za),ce(Qa)}var no=se(null),ro=null;function io(e){var t=e.alternate;le(lo,lo.current&1),le(no,e),ro===null&&(t===null||Za.current!==null||t.memoizedState!==null)&&(ro=e)}function ao(e){le(lo,lo.current),le(no,e),ro===null&&(ro=e)}function oo(e){e.tag===22?(le(lo,lo.current),le(no,e),ro===null&&(ro=e)):so(e)}function so(){le(lo,lo.current),le(no,no.current)}function co(e){ce(no),ro===e&&(ro=null),ce(lo)}var lo=se(0);function uo(e){for(var t=e;t!==null;){if(t.tag===13){var n=t.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||pf(n)||mf(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 fo=0,z=null,po=null,mo=null,ho=!1,go=!1,_o=!1,vo=0,yo=0,bo=null,xo=0;function So(){throw Error(i(321))}function Co(e,t){if(t===null)return!1;for(var n=0;n<t.length&&n<e.length;n++)if(!Cr(e[n],t[n]))return!1;return!0}function wo(e,t,n,r,i,a){return fo=a,z=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,j.H=e===null||e.memoizedState===null?zs:Bs,_o=!1,a=n(r,i),_o=!1,go&&(a=Eo(t,n,r,i)),To(e),a}function To(e){j.H=Rs;var t=po!==null&&po.next!==null;if(fo=0,mo=po=z=null,ho=!1,yo=0,bo=null,t)throw Error(i(300));e===null||rc||(e=e.dependencies,e!==null&&Qi(e)&&(rc=!0))}function Eo(e,t,n,r){z=e;var a=0;do{if(go&&(bo=null),yo=0,go=!1,25<=a)throw Error(i(301));if(a+=1,mo=po=null,e.updateQueue!=null){var o=e.updateQueue;o.lastEffect=null,o.events=null,o.stores=null,o.memoCache!=null&&(o.memoCache.index=0)}j.H=Vs,o=t(n,r)}while(go);return o}function Do(){var e=j.H,t=e.useState()[0];return t=typeof t.then==`function`?No(t):t,e=e.useState()[0],(po===null?null:po.memoizedState)!==e&&(z.flags|=1024),t}function Oo(){var e=vo!==0;return vo=0,e}function ko(e,t,n){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~n}function Ao(e){if(ho){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ho=!1}fo=0,mo=po=z=null,go=!1,yo=vo=0,bo=null}function jo(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return mo===null?z.memoizedState=mo=e:mo=mo.next=e,mo}function B(){if(po===null){var e=z.alternate;e=e===null?null:e.memoizedState}else e=po.next;var t=mo===null?z.memoizedState:mo.next;if(t!==null)mo=t,po=e;else{if(e===null)throw z.alternate===null?Error(i(467)):Error(i(310));po=e,e={memoizedState:po.memoizedState,baseState:po.baseState,baseQueue:po.baseQueue,queue:po.queue,next:null},mo===null?z.memoizedState=mo=e:mo=mo.next=e}return mo}function Mo(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function No(e){var t=yo;return yo+=1,bo===null&&(bo=[]),e=Ea(bo,e,t),t=z,(mo===null?t.memoizedState:mo.next)===null&&(t=t.alternate,j.H=t===null||t.memoizedState===null?zs:Bs),e}function Po(e){if(typeof e==`object`&&e){if(typeof e.then==`function`)return No(e);if(e.$$typeof===x)return ea(e)}throw Error(i(438,String(e)))}function Fo(e){var t=null,n=z.updateQueue;if(n!==null&&(t=n.memoCache),t==null){var r=z.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=Mo(),z.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]=O;return t.index++,n}function Io(e,t){return typeof t==`function`?t(e):t}function Lo(e){return Ro(B(),po,e)}function Ro(e,t,n){var r=e.queue;if(r===null)throw Error(i(311));r.lastRenderedReducer=n;var a=e.baseQueue,o=r.pending;if(o!==null){if(a!==null){var s=a.next;a.next=o.next,o.next=s}t.baseQueue=a=o,r.pending=null}if(o=e.baseState,a===null)e.memoizedState=o;else{t=a.next;var c=s=null,l=null,u=t,d=!1;do{var f=u.lane&-536870913;if(f===u.lane?(fo&f)===f:(Hl&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===da&&(d=!0);else if((fo&p)===p){u=u.next,p===da&&(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=o):l=l.next=f,z.lanes|=p,Xl|=p;f=u.action,_o&&n(o,f),o=u.hasEagerState?u.eagerState:n(o,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=o):l=l.next=p,z.lanes|=f,Xl|=f;u=u.next}while(u!==null&&u!==t);if(l===null?s=o:l.next=c,!Cr(o,e.memoizedState)&&(rc=!0,d&&(n=fa,n!==null)))throw n;e.memoizedState=o,e.baseState=s,e.baseQueue=l,r.lastRenderedState=o}return a===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function zo(e){var t=B(),n=t.queue;if(n===null)throw Error(i(311));n.lastRenderedReducer=e;var r=n.dispatch,a=n.pending,o=t.memoizedState;if(a!==null){n.pending=null;var s=a=a.next;do o=e(o,s.action),s=s.next;while(s!==a);Cr(o,t.memoizedState)||(rc=!0),t.memoizedState=o,t.baseQueue===null&&(t.baseState=o),n.lastRenderedState=o}return[o,r]}function Bo(e,t,n){var r=z,a=B(),o=Pi;if(o){if(n===void 0)throw Error(i(407));n=n()}else n=t();var s=!Cr((po||a).memoizedState,n);if(s&&(a.memoizedState=n,rc=!0),a=a.queue,us(Ho.bind(null,r,a,e),[e]),a.getSnapshot!==t||s||mo!==null&&mo.memoizedState.tag&1){if(r.flags|=2048,as(9,{destroy:void 0},V.bind(null,r,a,n,t),null),Bl===null)throw Error(i(349));o||fo&127||Vo(r,t,n)}return n}function Vo(e,t,n){e.flags|=16384,e={getSnapshot:t,value:n},t=z.updateQueue,t===null?(t=Mo(),z.updateQueue=t,t.stores=[e]):(n=t.stores,n===null?t.stores=[e]:n.push(e))}function V(e,t,n,r){t.value=n,t.getSnapshot=r,Uo(t)&&Wo(e)}function Ho(e,t,n){return n(function(){Uo(t)&&Wo(e)})}function Uo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Cr(e,n)}catch{return!0}}function Wo(e){var t=ri(e,2);t!==null&&bu(t,e,2)}function Go(e){var t=jo();if(typeof e==`function`){var n=e;if(e=n(),_o){ze(!0);try{n()}finally{ze(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:e},t}function Ko(e,t,n,r){return e.baseState=n,Ro(e,po,typeof r==`function`?r:Io)}function qo(e,t,n,r,a){if(Fs(e))throw Error(i(485));if(e=t.action,e!==null){var o={payload:a,action:e,next:null,isTransition:!0,status:`pending`,value:null,reason:null,listeners:[],then:function(e){o.listeners.push(e)}};j.T===null?o.isTransition=!1:n(!0),r(o),n=t.pending,n===null?(o.next=t.pending=o,Jo(t,o)):(o.next=n.next,t.pending=n.next=o)}}function Jo(e,t){var n=t.action,r=t.payload,i=e.state;if(t.isTransition){var a=j.T,o={};j.T=o;try{var s=n(i,r),c=j.S;c!==null&&c(o,s),Yo(e,t,s)}catch(n){Zo(e,t,n)}finally{a!==null&&o.types!==null&&(a.types=o.types),j.T=a}}else try{a=n(i,r),Yo(e,t,a)}catch(n){Zo(e,t,n)}}function Yo(e,t,n){typeof n==`object`&&n&&typeof n.then==`function`?n.then(function(n){Xo(e,t,n)},function(n){return Zo(e,t,n)}):Xo(e,t,n)}function Xo(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,Jo(e,n)))}function Zo(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 $o(e,t){return t}function es(e,t){if(Pi){var n=Bl.formState;if(n!==null){a:{var r=z;if(Pi){if(Ni){b:{for(var i=Ni,a=Ii;i.nodeType!==8;){if(!a){i=null;break b}if(i=gf(i.nextSibling),i===null){i=null;break b}}a=i.data,i=a===`F!`||a===`F`?i:null}if(i){Ni=gf(i.nextSibling),r=i.data===`F!`;break a}}Ri(r)}r=!1}r&&(t=n[0])}}return n=jo(),n.memoizedState=n.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:$o,lastRenderedState:t},n.queue=r,n=Ms.bind(null,z,r),r.dispatch=n,r=Go(!1),a=Ps.bind(null,z,!1,r.queue),r=jo(),i={state:t,dispatch:null,action:e,pending:null},r.queue=i,n=qo.bind(null,z,i,a,n),i.dispatch=n,r.memoizedState=e,[t,n,!1]}function ts(e){return ns(B(),po,e)}function ns(e,t,n){if(t=Ro(e,t,$o)[0],e=Lo(Io)[0],typeof t==`object`&&t&&typeof t.then==`function`)try{var r=No(t)}catch(e){throw e===xa?Ca:e}else r=t;t=B();var i=t.queue,a=i.dispatch;return n!==t.memoizedState&&(z.flags|=2048,as(9,{destroy:void 0},rs.bind(null,i,n),null)),[r,a,e]}function rs(e,t){e.action=t}function is(e){var t=B(),n=po;if(n!==null)return ns(t,n,e);B(),t=t.memoizedState,n=B();var r=n.queue.dispatch;return n.memoizedState=e,[t,r,!1]}function as(e,t,n,r){return e={tag:e,create:n,deps:r,inst:t,next:null},t=z.updateQueue,t===null&&(t=Mo(),z.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 os(){return B().memoizedState}function ss(e,t,n,r){var i=jo();z.flags|=e,i.memoizedState=as(1|t,{destroy:void 0},n,r===void 0?null:r)}function cs(e,t,n,r){var i=B();r=r===void 0?null:r;var a=i.memoizedState.inst;po!==null&&r!==null&&Co(r,po.memoizedState.deps)?i.memoizedState=as(t,a,n,r):(z.flags|=e,i.memoizedState=as(1|t,a,n,r))}function ls(e,t){ss(8390656,8,e,t)}function us(e,t){cs(2048,8,e,t)}function ds(e){z.flags|=4;var t=z.updateQueue;if(t===null)t=Mo(),z.updateQueue=t,t.events=[e];else{var n=t.events;n===null?t.events=[e]:n.push(e)}}function fs(e){var t=B().memoizedState;return ds({ref:t,nextImpl:e}),function(){if(zl&2)throw Error(i(440));return t.impl.apply(void 0,arguments)}}function ps(e,t){return cs(4,2,e,t)}function ms(e,t){return cs(4,4,e,t)}function hs(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 gs(e,t,n){n=n==null?null:n.concat([e]),cs(4,4,hs.bind(null,t,e),n)}function _s(){}function vs(e,t){var n=B();t=t===void 0?null:t;var r=n.memoizedState;return t!==null&&Co(t,r[1])?r[0]:(n.memoizedState=[e,t],e)}function ys(e,t){var n=B();t=t===void 0?null:t;var r=n.memoizedState;if(t!==null&&Co(t,r[1]))return r[0];if(r=e(),_o){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r}function bs(e,t,n){return n===void 0||fo&1073741824&&!(Hl&261930)?e.memoizedState=t:(e.memoizedState=n,e=yu(),z.lanes|=e,Xl|=e,n)}function xs(e,t,n,r){return Cr(n,t)?n:Za.current===null?!(fo&42)||fo&1073741824&&!(Hl&261930)?(rc=!0,e.memoizedState=n):(e=yu(),z.lanes|=e,Xl|=e,t):(e=bs(e,n,r),Cr(e,t)||(rc=!0),e)}function Ss(e,t,n,r,i){var a=re.p;re.p=a!==0&&8>a?a:8;var o=j.T,s={};j.T=s,Ps(e,!1,t,n);try{var c=i(),l=j.S;l!==null&&l(s,c),typeof c==`object`&&c&&typeof c.then==`function`?Ns(e,t,ha(c,r),vu(e)):Ns(e,t,r,vu(e))}catch(n){Ns(e,t,{then:function(){},status:`rejected`,reason:n},vu())}finally{re.p=a,o!==null&&s.types!==null&&(o.types=s.types),j.T=o}}function Cs(){}function ws(e,t,n,r){if(e.tag!==5)throw Error(i(476));var a=Ts(e).queue;Ss(e,a,t,ie,n===null?Cs:function(){return Es(e),n(r)})}function Ts(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:ie},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Io,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Es(e){var t=Ts(e);t.next===null&&(t=e.alternate.memoizedState),Ns(e,t.next.queue,{},vu())}function Ds(){return ea(op)}function Os(){return B().memoizedState}function ks(){return B().memoizedState}function As(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=vu();e=Ha(n);var r=Ua(t,e,n);r!==null&&(bu(r,t,n),Wa(r,t,n)),t={cache:sa()},e.payload=t;return}t=t.return}}function js(e,t,n){var r=vu();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fs(e)?Is(t,n):(n=ni(e,t,n,r),n!==null&&(bu(n,e,r),Ls(n,t,r)))}function Ms(e,t,n){Ns(e,t,n,vu())}function Ns(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fs(e))Is(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,Cr(s,o))return ti(e,t,i,0),Bl===null&&ei(),!1}catch{}if(n=ni(e,t,i,r),n!==null)return bu(n,e,r),Ls(n,t,r),!0}return!1}function Ps(e,t,n,r){if(r={lane:2,revertLane:_d(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Fs(e)){if(t)throw Error(i(479))}else t=ni(e,n,r,2),t!==null&&bu(t,e,2)}function Fs(e){var t=e.alternate;return e===z||t!==null&&t===z}function Is(e,t){go=ho=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function Ls(e,t,n){if(n&4194048){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,nt(e,n)}}var Rs={readContext:ea,use:Po,useCallback:So,useContext:So,useEffect:So,useImperativeHandle:So,useLayoutEffect:So,useInsertionEffect:So,useMemo:So,useReducer:So,useRef:So,useState:So,useDebugValue:So,useDeferredValue:So,useTransition:So,useSyncExternalStore:So,useId:So,useHostTransitionStatus:So,useFormState:So,useActionState:So,useOptimistic:So,useMemoCache:So,useCacheRefresh:So};Rs.useEffectEvent=So;var zs={readContext:ea,use:Po,useCallback:function(e,t){return jo().memoizedState=[e,t===void 0?null:t],e},useContext:ea,useEffect:ls,useImperativeHandle:function(e,t,n){n=n==null?null:n.concat([e]),ss(4194308,4,hs.bind(null,t,e),n)},useLayoutEffect:function(e,t){return ss(4194308,4,e,t)},useInsertionEffect:function(e,t){ss(4,2,e,t)},useMemo:function(e,t){var n=jo();t=t===void 0?null:t;var r=e();if(_o){ze(!0);try{e()}finally{ze(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=jo();if(n!==void 0){var i=n(t);if(_o){ze(!0);try{n(t)}finally{ze(!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=js.bind(null,z,e),[r.memoizedState,e]},useRef:function(e){var t=jo();return e={current:e},t.memoizedState=e},useState:function(e){e=Go(e);var t=e.queue,n=Ms.bind(null,z,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:_s,useDeferredValue:function(e,t){return bs(jo(),e,t)},useTransition:function(){var e=Go(!1);return e=Ss.bind(null,z,e.queue,!0,!1),jo().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=z,a=jo();if(Pi){if(n===void 0)throw Error(i(407));n=n()}else{if(n=t(),Bl===null)throw Error(i(349));Hl&127||Vo(r,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ls(Ho.bind(null,r,o,e),[e]),r.flags|=2048,as(9,{destroy:void 0},V.bind(null,r,o,n,t),null),n},useId:function(){var e=jo(),t=Bl.identifierPrefix;if(Pi){var n=Ei,r=Ti;n=(r&~(1<<32-Be(r)-1)).toString(32)+n,t=`_`+t+`R_`+n,n=vo++,0<n&&(t+=`H`+n.toString(32)),t+=`_`}else n=xo++,t=`_`+t+`r_`+n.toString(32)+`_`;return e.memoizedState=t},useHostTransitionStatus:Ds,useFormState:es,useActionState:es,useOptimistic:function(e){var t=jo();t.memoizedState=t.baseState=e;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=n,t=Ps.bind(null,z,!0,n),n.dispatch=t,[e,t]},useMemoCache:Fo,useCacheRefresh:function(){return jo().memoizedState=As.bind(null,z)},useEffectEvent:function(e){var t=jo(),n={impl:e};return t.memoizedState=n,function(){if(zl&2)throw Error(i(440));return n.impl.apply(void 0,arguments)}}},Bs={readContext:ea,use:Po,useCallback:vs,useContext:ea,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:Lo,useRef:os,useState:function(){return Lo(Io)},useDebugValue:_s,useDeferredValue:function(e,t){return xs(B(),po.memoizedState,e,t)},useTransition:function(){var e=Lo(Io)[0],t=B().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:Os,useHostTransitionStatus:Ds,useFormState:ts,useActionState:ts,useOptimistic:function(e,t){return Ko(B(),po,e,t)},useMemoCache:Fo,useCacheRefresh:ks};Bs.useEffectEvent=fs;var Vs={readContext:ea,use:Po,useCallback:vs,useContext:ea,useEffect:us,useImperativeHandle:gs,useInsertionEffect:ps,useLayoutEffect:ms,useMemo:ys,useReducer:zo,useRef:os,useState:function(){return zo(Io)},useDebugValue:_s,useDeferredValue:function(e,t){var n=B();return po===null?bs(n,e,t):xs(n,po.memoizedState,e,t)},useTransition:function(){var e=zo(Io)[0],t=B().memoizedState;return[typeof e==`boolean`?e:No(e),t]},useSyncExternalStore:Bo,useId:Os,useHostTransitionStatus:Ds,useFormState:is,useActionState:is,useOptimistic:function(e,t){var n=B();return po===null?(n.baseState=e,[e,n.queue.dispatch]):Ko(n,po,e,t)},useMemoCache:Fo,useCacheRefresh:ks};Vs.useEffectEvent=fs;function Hs(e,t,n,r){t=e.memoizedState,n=n(r,t),n=n==null?t:p({},t,n),e.memoizedState=n,e.lanes===0&&(e.updateQueue.baseState=n)}var Us={enqueueSetState:function(e,t,n){e=e._reactInternals;var r=vu(),i=Ha(r);i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(bu(t,e,r),Wa(t,e,r))},enqueueReplaceState:function(e,t,n){e=e._reactInternals;var r=vu(),i=Ha(r);i.tag=1,i.payload=t,n!=null&&(i.callback=n),t=Ua(e,i,r),t!==null&&(bu(t,e,r),Wa(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var n=vu(),r=Ha(n);r.tag=2,t!=null&&(r.callback=t),t=Ua(e,r,n),t!==null&&(bu(t,e,n),Wa(t,e,n))}};function Ws(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?!wr(n,r)||!wr(i,a):!0}function Gs(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&&Us.enqueueReplaceState(t,t.state,null)}function Ks(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=p({},n)),e)n[i]===void 0&&(n[i]=e[i]);return n}function qs(e){Xr(e)}function Js(e){console.error(e)}function Ys(e){Xr(e)}function Xs(e,t){try{var n=e.onUncaughtError;n(t.value,{componentStack:t.stack})}catch(e){setTimeout(function(){throw e})}}function Zs(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=Ha(n),n.tag=3,n.payload={element:null},n.callback=function(){Xs(e,t)},n}function $s(e){return e=Ha(e),e.tag=3,e}function ec(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(){Zs(t,n,r)}}var o=n.stateNode;o!==null&&typeof o.componentDidCatch==`function`&&(e.callback=function(){Zs(t,n,r),typeof i!=`function`&&(cu===null?cu=new Set([this]):cu.add(this));var e=r.stack;this.componentDidCatch(r.value,{componentStack:e===null?``:e})})}function tc(e,t,n,r,a){if(n.flags|=32768,typeof r==`object`&&r&&typeof r.then==`function`){if(t=n.alternate,t!==null&&Zi(t,n,a,!0),n=no.current,n!==null){switch(n.tag){case 31:case 13:return ro===null?Mu():n.alternate===null&&Yl===0&&(Yl=3),n.flags&=-257,n.flags|=65536,n.lanes=a,r===wa?n.flags|=16384:(t=n.updateQueue,t===null?n.updateQueue=new Set([r]):t.add(r),Zu(e,r,a)),!1;case 22:return n.flags|=65536,r===wa?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)),Zu(e,r,a)),!1}throw Error(i(435,n.tag))}return Zu(e,r,a),Mu(),!1}if(Pi)return t=no.current,t===null?(r!==Li&&(t=Error(i(423),{cause:r}),Wi(_i(t,n))),e=e.current.alternate,e.flags|=65536,a&=-a,e.lanes|=a,r=_i(r,n),a=Qs(e.stateNode,r,a),Ga(e,a),Yl!==4&&(Yl=2)):(!(t.flags&65536)&&(t.flags|=256),t.flags|=65536,t.lanes=a,r!==Li&&(e=Error(i(422),{cause:r}),Wi(_i(e,n)))),!1;var o=Error(i(520),{cause:r});if(o=_i(o,n),tu===null?tu=[o]:tu.push(o),Yl!==4&&(Yl=2),t===null)return!0;r=_i(r,n),n=t;do{switch(n.tag){case 3:return n.flags|=65536,e=a&-a,n.lanes|=e,e=Qs(n.stateNode,r,e),Ga(n,e),!1;case 1:if(t=n.type,o=n.stateNode,!(n.flags&128)&&(typeof t.getDerivedStateFromError==`function`||o!==null&&typeof o.componentDidCatch==`function`&&(cu===null||!cu.has(o))))return n.flags|=65536,a&=-a,n.lanes|=a,a=$s(a),ec(a,e,n,r),Ga(n,a),!1}n=n.return}while(n!==null);return!1}var nc=Error(i(461)),rc=!1;function ic(e,t,n,r){t.child=e===null?Ra(t,null,n,r):La(t,e.child,n,r)}function ac(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 $i(t),r=wo(e,t,n,o,a,i),s=Oo(),e!==null&&!rc?(ko(e,t,i),Oc(e,t,i)):(Pi&&s&&ki(t),t.flags|=1,ic(e,t,r,i),t.child)}function oc(e,t,n,r,i){if(e===null){var a=n.type;return typeof a==`function`&&!li(a)&&a.defaultProps===void 0&&n.compare===null?(t.tag=15,t.type=a,sc(e,t,a,r,i)):(e=fi(n.type,null,r,t,t.mode,i),e.ref=t.ref,e.return=t,t.child=e)}if(a=e.child,!kc(e,i)){var o=a.memoizedProps;if(n=n.compare,n=n===null?wr:n,n(o,r)&&e.ref===t.ref)return Oc(e,t,i)}return t.flags|=1,e=ui(a,r),e.ref=t.ref,e.return=t,t.child=e}function sc(e,t,n,r,i){if(e!==null){var a=e.memoizedProps;if(wr(a,r)&&e.ref===t.ref)if(rc=!1,t.pendingProps=r=a,kc(e,i))e.flags&131072&&(rc=!0);else return t.lanes=e.lanes,Oc(e,t,i)}return U(e,t,n,r,i)}function cc(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 dc(e,t,a,n,r)}if(n&536870912)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&ya(t,a===null?null:a.cachePool),a===null?eo():$a(t,a),oo(t);else return r=t.lanes=536870912,dc(e,t,a===null?n:a.baseLanes|n,n,r)}else a===null?(e!==null&&ya(t,null),eo(),so(t)):(ya(t,a.cachePool),$a(t,a),so(t),t.memoizedState=null);return ic(e,t,i,n),t.child}function lc(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function dc(e,t,n,r,i){var a=va();return a=a===null?null:{parent:oa._currentValue,pool:a},t.memoizedState={baseLanes:n,cachePool:a},e!==null&&ya(t,null),eo(),oo(t),e!==null&&Zi(e,t,r,!0),t.childLanes=i,null}function pc(e,t){return t=Cc({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function mc(e,t,n){return La(t,e.child,null,n),e=pc(t,t.pendingProps),e.flags|=2,co(t),t.memoizedState=null,e}function H(e,t,n){var r=t.pendingProps,a=(t.flags&128)!=0;if(t.flags&=-129,e===null){if(Pi){if(r.mode===`hidden`)return e=pc(t,r),t.lanes=536870912,lc(null,e);if(ao(t),(e=Ni)?(e=ff(e,Ii),e=e!==null&&e.data===`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=L(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return t.lanes=536870912,null}return pc(t,r)}var o=e.memoizedState;if(o!==null){var s=o.dehydrated;if(ao(t),a)if(t.flags&256)t.flags&=-257,t=mc(e,t,n);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(i(558));else if(rc||Zi(e,t,n,!1),a=(n&e.childLanes)!==0,rc||a){if(r=Bl,r!==null&&(s=rt(r,n),s!==0&&s!==o.retryLane))throw o.retryLane=s,ri(e,s),bu(r,e,s),nc;Mu(),t=mc(e,t,n)}else e=o.treeContext,Ni=gf(s.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=pc(t,r),t.flags|=4096;return t}return e=ui(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function hc(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(i(284));(e===null||e.ref!==n)&&(t.flags|=4194816)}}function U(e,t,n,r,i){return $i(t),n=wo(e,t,n,r,void 0,i),r=Oo(),e!==null&&!rc?(ko(e,t,i),Oc(e,t,i)):(Pi&&r&&ki(t),t.flags|=1,ic(e,t,n,i),t.child)}function gc(e,t,n,r,i,a){return $i(t),t.updateQueue=null,n=Eo(t,r,n,i),To(e),r=Oo(),e!==null&&!rc?(ko(e,t,a),Oc(e,t,a)):(Pi&&r&&ki(t),t.flags|=1,ic(e,t,n,a),t.child)}function _c(e,t,n,r,i){if($i(t),t.stateNode===null){var a=oi,o=n.contextType;typeof o==`object`&&o&&(a=ea(o)),a=new n(r,a),t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,a.updater=Us,t.stateNode=a,a._reactInternals=t,a=t.stateNode,a.props=r,a.state=t.memoizedState,a.refs={},Ba(t),o=n.contextType,a.context=typeof o==`object`&&o?ea(o):oi,a.state=t.memoizedState,o=n.getDerivedStateFromProps,typeof o==`function`&&(Hs(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&&Us.enqueueReplaceState(a,a.state,null),Ja(t,r,a,i),qa(),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=Ks(n,s);a.props=c;var l=a.context,u=n.contextType;o=oi,typeof u==`object`&&u&&(o=ea(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)&&Gs(t,a,r,o),za=!1;var f=t.memoizedState;a.state=f,Ja(t,r,a,i),qa(),l=t.memoizedState,s||f!==l||za?(typeof d==`function`&&(Hs(t,n,d,r),l=t.memoizedState),(c=za||Ws(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,Va(e,t),o=t.memoizedProps,u=Ks(n,o),a.props=u,d=t.pendingProps,f=a.context,l=n.contextType,c=oi,typeof l==`object`&&l&&(c=ea(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)&&Gs(t,a,r,c),za=!1,f=t.memoizedState,a.state=f,Ja(t,r,a,i),qa();var p=t.memoizedState;o!==d||f!==p||za||e!==null&&e.dependencies!==null&&Qi(e.dependencies)?(typeof s==`function`&&(Hs(t,n,s,r),p=t.memoizedState),(u=za||Ws(t,n,u,r,f,p,c)||e!==null&&e.dependencies!==null&&Qi(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,hc(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=La(t,e.child,null,i),t.child=La(t,null,n,i)):ic(e,t,n,i),t.memoizedState=a.state,e=t.child):e=Oc(e,t,i),e}function W(e,t,n,r){return Hi(),t.flags|=256,ic(e,t,n,r),t.child}var vc={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function yc(e){return{baseLanes:e,cachePool:ba()}}function bc(e,t,n){return e=e===null?0:e.childLanes&~n,t&&(e|=$l),e}function xc(e,t,n){var r=t.pendingProps,a=!1,o=(t.flags&128)!=0,s;if((s=o)||(s=e!==null&&e.memoizedState===null?!1:(lo.current&2)!=0),s&&(a=!0,t.flags&=-129),s=(t.flags&32)!=0,t.flags&=-33,e===null){if(Pi){if(a?io(t):so(t),(e=Ni)?(e=ff(e,Ii),e=e!==null&&e.data!==`&`?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:wi===null?null:{id:Ti,overflow:Ei},retryLane:536870912,hydrationErrors:null},n=L(e),n.return=t,t.child=n,Mi=t,Ni=null)):e=null,e===null)throw Ri(t);return mf(e)?t.lanes=32:t.lanes=536870912,null}var c=r.children;return r=r.fallback,a?(so(t),a=t.mode,c=Cc({mode:`hidden`,children:c},a),r=pi(r,a,n,null),c.return=t,r.return=t,c.sibling=r,t.child=c,r=t.child,r.memoizedState=yc(n),r.childLanes=bc(e,s,n),t.memoizedState=vc,lc(null,r)):(io(t),Sc(t,c))}var l=e.memoizedState;if(l!==null&&(c=l.dehydrated,c!==null)){if(o)t.flags&256?(io(t),t.flags&=-257,t=wc(e,t,n)):t.memoizedState===null?(so(t),c=r.fallback,a=t.mode,r=Cc({mode:`visible`,children:r.children},a),c=pi(c,a,n,null),c.flags|=2,r.return=t,c.return=t,r.sibling=c,t.child=r,La(t,e.child,null,n),r=t.child,r.memoizedState=yc(n),r.childLanes=bc(e,s,n),t.memoizedState=vc,t=lc(null,r)):(so(t),t.child=e.child,t.flags|=128,t=null);else if(io(t),mf(c)){if(s=c.nextSibling&&c.nextSibling.dataset,s)var u=s.dgst;s=u,r=Error(i(419)),r.stack=``,r.digest=s,Wi({value:r,source:null,stack:null}),t=wc(e,t,n)}else if(rc||Zi(e,t,n,!1),s=(n&e.childLanes)!==0,rc||s){if(s=Bl,s!==null&&(r=rt(s,n),r!==0&&r!==l.retryLane))throw l.retryLane=r,ri(e,r),bu(s,e,r),nc;pf(c)||Mu(),t=wc(e,t,n)}else pf(c)?(t.flags|=192,t.child=e.child,t=null):(e=l.treeContext,Ni=gf(c.nextSibling),Mi=t,Pi=!0,Fi=null,Ii=!1,e!==null&&ji(t,e),t=Sc(t,r.children),t.flags|=4096);return t}return a?(so(t),c=r.fallback,a=t.mode,l=e.child,u=l.sibling,r=ui(l,{mode:`hidden`,children:r.children}),r.subtreeFlags=l.subtreeFlags&65011712,u===null?(c=pi(c,a,n,null),c.flags|=2):c=ui(u,c),c.return=t,r.return=t,r.sibling=c,t.child=r,lc(null,r),r=t.child,c=e.child.memoizedState,c===null?c=yc(n):(a=c.cachePool,a===null?a=ba():(l=oa._currentValue,a=a.parent===l?a:{parent:l,pool:l}),c={baseLanes:c.baseLanes|n,cachePool:a}),r.memoizedState=c,r.childLanes=bc(e,s,n),t.memoizedState=vc,lc(e.child,r)):(io(t),n=e.child,e=n.sibling,n=ui(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 Sc(e,t){return t=Cc({mode:`visible`,children:t},e.mode),t.return=e,e.child=t}function Cc(e,t){return e=ci(22,e,null,t),e.lanes=0,e}function wc(e,t,n){return La(t,e.child,null,n),e=Sc(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Tc(e,t,n){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Yi(e.return,t,n)}function Ec(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 Dc(e,t,n){var r=t.pendingProps,i=r.revealOrder,a=r.tail;r=r.children;var o=lo.current,s=(o&2)!=0;if(s?(o=o&1|2,t.flags|=128):o&=1,le(lo,o),ic(e,t,r,n),r=Pi?xi:0,!s&&e!==null&&e.flags&128)a:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Tc(e,n,t);else if(e.tag===19)Tc(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&&uo(e)===null&&(i=n),n=n.sibling;n=i,n===null?(i=t.child,t.child=null):(i=n.sibling,n.sibling=null),Ec(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&&uo(e)===null){t.child=i;break}e=i.sibling,i.sibling=n,n=i,i=e}Ec(t,!0,n,null,a,r);break;case`together`:Ec(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Oc(e,t,n){if(e!==null&&(t.dependencies=e.dependencies),Xl|=t.lanes,(n&t.childLanes)===0)if(e!==null){if(Zi(e,t,n,!1),(n&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,n=ui(e,e.pendingProps),t.child=n,n.return=t;e.sibling!==null;)e=e.sibling,n=n.sibling=ui(e,e.pendingProps),n.return=t;n.sibling=null}return t.child}function kc(e,t){return(e.lanes&t)===0?(e=e.dependencies,!!(e!==null&&Qi(e))):!0}function Ac(e,t,n){switch(t.tag){case 3:me(t,t.stateNode.containerInfo),Ji(t,oa,e.memoizedState.cache),Hi();break;case 27:case 5:ge(t);break;case 4:me(t,t.stateNode.containerInfo);break;case 10:Ji(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,ao(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated===null?(n&t.child.childLanes)===0?(io(t),e=Oc(e,t,n),e===null?null:e.sibling):xc(e,t,n):(io(t),t.flags|=128,null);io(t);break;case 19:var i=(e.flags&128)!=0;if(r=(n&t.childLanes)!==0,r||=(Zi(e,t,n,!1),(n&t.childLanes)!==0),i){if(r)return Dc(e,t,n);t.flags|=128}if(i=t.memoizedState,i!==null&&(i.rendering=null,i.tail=null,i.lastEffect=null),le(lo,lo.current),r)break;return null;case 22:return t.lanes=0,cc(e,t,n,t.pendingProps);case 24:Ji(t,oa,e.memoizedState.cache)}return Oc(e,t,n)}function jc(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps)rc=!0;else{if(!kc(e,n)&&!(t.flags&128))return rc=!1,Ac(e,t,n);rc=!!(e.flags&131072)}else rc=!1,Pi&&t.flags&1048576&&Oi(t,xi,t.index);switch(t.lanes=0,t.tag){case 16:a:{var r=t.pendingProps;if(e=Da(t.elementType),t.type=e,typeof e==`function`)li(e)?(r=Ks(e,r),t.tag=1,t=_c(null,t,e,r,n)):(t.tag=0,t=U(null,t,e,r,n));else{if(e!=null){var a=e.$$typeof;if(a===S){t.tag=11,t=ac(null,t,e,r,n);break a}else if(a===T){t.tag=14,t=oc(null,t,e,r,n);break a}}throw t=te(e)||e,Error(i(306,t,``))}}return t;case 0:return U(e,t,t.type,t.pendingProps,n);case 1:return r=t.type,a=Ks(r,t.pendingProps),_c(e,t,r,a,n);case 3:a:{if(me(t,t.stateNode.containerInfo),e===null)throw Error(i(387));r=t.pendingProps;var o=t.memoizedState;a=o.element,Va(e,t),Ja(t,r,null,n);var s=t.memoizedState;if(r=s.cache,Ji(t,oa,r),r!==o.cache&&Xi(t,[oa],n,!0),qa(),r=s.element,o.isDehydrated)if(o={element:r,isDehydrated:!1,cache:s.cache},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){t=W(e,t,r,n);break a}else if(r!==a){a=_i(Error(i(424)),t),Wi(a),t=W(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(Ni=gf(e.firstChild),Mi=t,Pi=!0,Fi=null,Ii=!0,n=Ra(t,null,r,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(Hi(),r===a){t=Oc(e,t,n);break a}ic(e,t,r,n)}t=t.child}return t;case 26:return hc(e,t),e===null?(n=Lf(t.type,null,t.pendingProps,null))?t.memoizedState=n:Pi||(n=t.type,e=t.pendingProps,r=Jd(fe.current).createElement(n),r[lt]=t,r[P]=e,Hd(r,n,e),xt(r),t.stateNode=r):t.memoizedState=Lf(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return ge(t),e===null&&Pi&&(r=t.stateNode=bf(t.type,t.pendingProps,fe.current),Mi=t,Ii=!0,a=Ni,of(t.type)?(_f=a,Ni=gf(r.firstChild)):Ni=a),ic(e,t,t.pendingProps.children,n),hc(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Pi&&((a=r=Ni)&&(r=uf(r,t.type,t.pendingProps,Ii),r===null?a=!1:(t.stateNode=r,Mi=t,Ni=gf(r.firstChild),Ii=!1,a=!0)),a||Ri(t)),ge(t),a=t.type,o=t.pendingProps,s=e===null?null:e.memoizedProps,r=o.children,Zd(a,o)?r=null:s!==null&&Zd(a,s)&&(t.flags|=32),t.memoizedState!==null&&(a=wo(e,t,Do,null,null,n),op._currentValue=a),hc(e,t),ic(e,t,r,n),t.child;case 6:return e===null&&Pi&&((e=n=Ni)&&(n=df(n,t.pendingProps,Ii),n===null?e=!1:(t.stateNode=n,Mi=t,Ni=null,e=!0)),e||Ri(t)),null;case 13:return xc(e,t,n);case 4:return me(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=La(t,null,r,n):ic(e,t,r,n),t.child;case 11:return ac(e,t,t.type,t.pendingProps,n);case 7:return ic(e,t,t.pendingProps,n),t.child;case 8:return ic(e,t,t.pendingProps.children,n),t.child;case 12:return ic(e,t,t.pendingProps.children,n),t.child;case 10:return r=t.pendingProps,Ji(t,t.type,r.value),ic(e,t,r.children,n),t.child;case 9:return a=t.type._context,r=t.pendingProps.children,$i(t),a=ea(a),r=r(a),t.flags|=1,ic(e,t,r,n),t.child;case 14:return oc(e,t,t.type,t.pendingProps,n);case 15:return sc(e,t,t.type,t.pendingProps,n);case 19:return Dc(e,t,n);case 31:return H(e,t,n);case 22:return cc(e,t,n,t.pendingProps);case 24:return $i(t),r=ea(oa),e===null?(a=va(),a===null&&(a=Bl,o=sa(),a.pooledCache=o,o.refCount++,o!==null&&(a.pooledCacheLanes|=n),a=o),t.memoizedState={parent:r,cache:a},Ba(t),Ji(t,oa,a)):((e.lanes&n)!==0&&(Va(e,t),Ja(t,null,null,n),qa()),a=e.memoizedState,o=t.memoizedState,a.parent===r?(r=o.cache,Ji(t,oa,r),r!==a.cache&&Xi(t,[oa],n,!0)):(a={parent:r,cache:r},t.memoizedState=a,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=a),Ji(t,oa,r))),ic(e,t,t.pendingProps.children,n),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Mc(e){e.flags|=4}function Nc(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(ku())e.flags|=8192;else throw Oa=wa,Sa}else e.flags&=-16777217}function Pc(e,t){if(t.type!==`stylesheet`||t.state.loading&4)e.flags&=-16777217;else if(e.flags|=16777216,!Qf(t))if(ku())e.flags|=8192;else throw Oa=wa,Sa}function Fc(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag===22?536870912:Ze(),e.lanes|=t,eu|=t)}function Ic(e,t){if(!Pi)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 Lc(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 Rc(e,t,n){var r=t.pendingProps;switch(Ai(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Lc(t),null;case 1:return Lc(t),null;case 3:return n=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),R(oa),he(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(e===null||e.child===null)&&(Vi(t)?Mc(t):e===null||e.memoizedState.isDehydrated&&!(t.flags&256)||(t.flags|=1024,Ui())),Lc(t),null;case 26:var a=t.type,o=t.memoizedState;return e===null?(Mc(t),o===null?(Lc(t),Nc(t,a,null,r,n)):(Lc(t),Pc(t,o))):o?o===e.memoizedState?(Lc(t),t.flags&=-16777217):(Mc(t),Lc(t),Pc(t,o)):(e=e.memoizedProps,e!==r&&Mc(t),Lc(t),Nc(t,a,e,r,n)),null;case 27:if(_e(t),n=fe.current,a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Lc(t),null}e=ue.current,Vi(t)?zi(t,e):(e=bf(a,r,n),t.stateNode=e,Mc(t))}return Lc(t),null;case 5:if(_e(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(!r){if(t.stateNode===null)throw Error(i(166));return Lc(t),null}if(o=ue.current,Vi(t))zi(t,o);else{var s=Jd(fe.current);switch(o){case 1:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case 2:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;default:switch(a){case`svg`:o=s.createElementNS(`http://www.w3.org/2000/svg`,a);break;case`math`:o=s.createElementNS(`http://www.w3.org/1998/Math/MathML`,a);break;case`script`:o=s.createElement(`div`),o.innerHTML=`<script><\/script>`,o=o.removeChild(o.firstChild);break;case`select`:o=typeof r.is==`string`?s.createElement(`select`,{is:r.is}):s.createElement(`select`),r.multiple?o.multiple=!0:r.size&&(o.size=r.size);break;default:o=typeof r.is==`string`?s.createElement(a,{is:r.is}):s.createElement(a)}}o[lt]=t,o[P]=r;a:for(s=t.child;s!==null;){if(s.tag===5||s.tag===6)o.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=o;a:switch(Hd(o,a,r),a){case`button`:case`input`:case`select`:case`textarea`:r=!!r.autoFocus;break a;case`img`:r=!0;break a;default:r=!1}r&&Mc(t)}}return Lc(t),Nc(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Mc(t);else{if(typeof r!=`string`&&t.stateNode===null)throw Error(i(166));if(e=fe.current,Vi(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,a=Mi,a!==null)switch(a.tag){case 27:case 5:r=a.memoizedProps}e[lt]=t,e=!!(e.nodeValue===n||r!==null&&!0===r.suppressHydrationWarning||zd(e.nodeValue,n)),e||Ri(t,!0)}else e=Jd(e).createTextNode(r),e[lt]=t,t.stateNode=e}return Lc(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=Vi(t),n!==null){if(e===null){if(!r)throw Error(i(318));if(e=t.memoizedState,e=e===null?null:e.dehydrated,!e)throw Error(i(557));e[lt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),e=!1}else n=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(co(t),t):(co(t),null);if(t.flags&128)throw Error(i(558))}return Lc(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(a=Vi(t),r!==null&&r.dehydrated!==null){if(e===null){if(!a)throw Error(i(318));if(a=t.memoizedState,a=a===null?null:a.dehydrated,!a)throw Error(i(317));a[lt]=t}else Hi(),!(t.flags&128)&&(t.memoizedState=null),t.flags|=4;Lc(t),a=!1}else a=Ui(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),a=!0;if(!a)return t.flags&256?(co(t),t):(co(t),null)}return co(t),t.flags&128?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,a=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(a=r.alternate.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Fc(t,t.updateQueue),Lc(t),null);case 4:return he(),e===null&&kd(t.stateNode.containerInfo),Lc(t),null;case 10:return R(t.type),Lc(t),null;case 19:if(ce(lo),r=t.memoizedState,r===null)return Lc(t),null;if(a=(t.flags&128)!=0,o=r.rendering,o===null)if(a)Ic(r,!1);else{if(Yl!==0||e!==null&&e.flags&128)for(e=t.child;e!==null;){if(o=uo(e),o!==null){for(t.flags|=128,Ic(r,!1),e=o.updateQueue,t.updateQueue=e,Fc(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)di(n,e),n=n.sibling;return le(lo,lo.current&1|2),Pi&&Di(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Oe()>ou&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304)}else{if(!a)if(e=uo(o),e!==null){if(t.flags|=128,a=!0,e=e.updateQueue,t.updateQueue=e,Fc(t,e),Ic(r,!0),r.tail===null&&r.tailMode===`hidden`&&!o.alternate&&!Pi)return Lc(t),null}else 2*Oe()-r.renderingStartTime>ou&&n!==536870912&&(t.flags|=128,a=!0,Ic(r,!1),t.lanes=4194304);r.isBackwards?(o.sibling=t.child,t.child=o):(e=r.last,e===null?t.child=o:e.sibling=o,r.last=o)}return r.tail===null?(Lc(t),null):(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Oe(),e.sibling=null,n=lo.current,le(lo,a?n&1|2:n&1),Pi&&Di(t,r.treeForkCount),e);case 22:case 23:return co(t),to(),r=t.memoizedState!==null,e===null?r&&(t.flags|=8192):e.memoizedState!==null!==r&&(t.flags|=8192),r?n&536870912&&!(t.flags&128)&&(Lc(t),t.subtreeFlags&6&&(t.flags|=8192)):Lc(t),n=t.updateQueue,n!==null&&Fc(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&&ce(_a),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),R(oa),Lc(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function zc(e,t){switch(Ai(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return R(oa),he(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return _e(t),null;case 31:if(t.memoizedState!==null){if(co(t),t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(co(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Hi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return ce(lo),null;case 4:return he(),null;case 10:return R(t.type),null;case 22:case 23:return co(t),to(),e!==null&&ce(_a),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return R(oa),null;case 25:return null;default:return null}}function Bc(e,t){switch(Ai(t),t.tag){case 3:R(oa),he();break;case 26:case 27:case 5:_e(t);break;case 4:he();break;case 31:t.memoizedState!==null&&co(t);break;case 13:co(t);break;case 19:ce(lo);break;case 10:R(t.type);break;case 22:case 23:co(t),to(),e!==null&&ce(_a);break;case 24:R(oa)}}function Vc(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){Xu(t,t.return,e)}}function Hc(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){Xu(i,c,e)}}}r=r.next}while(r!==a)}}catch(e){Xu(t,t.return,e)}}function Uc(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{Xa(t,n)}catch(t){Xu(e,e.return,t)}}}function Wc(e,t,n){n.props=Ks(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(n){Xu(e,t,n)}}function Gc(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){Xu(e,t,n)}}function Kc(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r==`function`)try{r()}catch(n){Xu(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){Xu(e,t,n)}else n.current=null}function qc(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){Xu(e,e.return,t)}}function Jc(e,t,n){try{var r=e.stateNode;Ud(r,e.type,n,t),r[P]=t}catch(t){Xu(e,e.return,t)}}function Yc(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&of(e.type)||e.tag===4}function Xc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Yc(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&&of(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 Zc(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=tn));else if(r!==4&&(r===27&&of(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(Zc(e,t,n),e=e.sibling;e!==null;)Zc(e,t,n),e=e.sibling}function Qc(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&&of(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Qc(e,t,n),e=e.sibling;e!==null;)Qc(e,t,n),e=e.sibling}function $c(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);Hd(t,r,n),t[lt]=e,t[P]=n}catch(t){Xu(e,e.return,t)}}var el=!1,tl=!1,nl=!1,rl=typeof WeakSet==`function`?WeakSet:Set,il=null;function al(e,t){if(e=e.containerInfo,Kd=hp,e=Or(e),kr(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 a=r.anchorOffset,o=r.focusNode;r=r.focusOffset;try{n.nodeType,o.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||a!==0&&f.nodeType!==3||(c=s+a),f!==o||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===a&&(c=s),p===o&&++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(qd={focusedElem:e,selectionRange:n},hp=!1,il=t;il!==null;)if(t=il,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,il=e;else for(;il!==null;){switch(t=il,o=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++)a=e[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if(e&1024&&o!==null){e=void 0,n=t,a=o.memoizedProps,o=o.memoizedState,r=n.stateNode;try{var h=Ks(n.type,a);e=r.getSnapshotBeforeUpdate(h,o),r.__reactInternalSnapshotBeforeUpdate=e}catch(e){Xu(n,n.return,e)}}break;case 3:if(e&1024){if(e=t.stateNode.containerInfo,n=e.nodeType,n===9)lf(e);else if(n===1)switch(e.nodeName){case`HEAD`:case`HTML`:case`BODY`:lf(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(i(163))}if(e=t.sibling,e!==null){e.return=t.return,il=e;break}il=t.return}}function ol(e,t,n){var r=n.flags;switch(n.tag){case 0:case 11:case 15:G(e,n),r&4&&Vc(5,n);break;case 1:if(G(e,n),r&4)if(e=n.stateNode,t===null)try{e.componentDidMount()}catch(e){Xu(n,n.return,e)}else{var i=Ks(n.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(i,t,e.__reactInternalSnapshotBeforeUpdate)}catch(e){Xu(n,n.return,e)}}r&64&&Uc(n),r&512&&Gc(n,n.return);break;case 3:if(G(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{Xa(e,t)}catch(e){Xu(n,n.return,e)}}break;case 27:t===null&&r&4&&$c(n);case 26:case 5:G(e,n),t===null&&r&4&&qc(n),r&512&&Gc(n,n.return);break;case 12:G(e,n);break;case 31:G(e,n),r&4&&fl(e,n);break;case 13:G(e,n),r&4&&pl(e,n),r&64&&(e=n.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(n=ed.bind(null,n),hf(e,n))));break;case 22:if(r=n.memoizedState!==null||el,!r){t=t!==null&&t.memoizedState!==null||tl,i=el;var a=tl;el=r,(tl=t)&&!a?Sl(e,n,(n.subtreeFlags&8772)!=0):G(e,n),el=i,tl=a}break;case 30:break;default:G(e,n)}}function sl(e){var t=e.alternate;t!==null&&(e.alternate=null,sl(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&>(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 cl=null,ll=!1;function ul(e,t,n){for(n=n.child;n!==null;)dl(e,t,n),n=n.sibling}function dl(e,t,n){if(Re&&typeof Re.onCommitFiberUnmount==`function`)try{Re.onCommitFiberUnmount(Le,n)}catch{}switch(n.tag){case 26:tl||Kc(n,t),ul(e,t,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:tl||Kc(n,t);var r=cl,i=ll;of(n.type)&&(cl=n.stateNode,ll=!1),ul(e,t,n),xf(n.stateNode),cl=r,ll=i;break;case 5:tl||Kc(n,t);case 6:if(r=cl,i=ll,cl=null,ul(e,t,n),cl=r,ll=i,cl!==null)if(ll)try{(cl.nodeType===9?cl.body:cl.nodeName===`HTML`?cl.ownerDocument.body:cl).removeChild(n.stateNode)}catch(e){Xu(n,t,e)}else try{cl.removeChild(n.stateNode)}catch(e){Xu(n,t,e)}break;case 18:cl!==null&&(ll?(e=cl,sf(e.nodeType===9?e.body:e.nodeName===`HTML`?e.ownerDocument.body:e,n.stateNode),Vp(e)):sf(cl,n.stateNode));break;case 4:r=cl,i=ll,cl=n.stateNode.containerInfo,ll=!0,ul(e,t,n),cl=r,ll=i;break;case 0:case 11:case 14:case 15:Hc(2,n,t),tl||Hc(4,n,t),ul(e,t,n);break;case 1:tl||(Kc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`&&Wc(n,t,r)),ul(e,t,n);break;case 21:ul(e,t,n);break;case 22:tl=(r=tl)||n.memoizedState!==null,ul(e,t,n),tl=r;break;default:ul(e,t,n)}}function fl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{Vp(e)}catch(e){Xu(t,t.return,e)}}}function pl(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{Vp(e)}catch(e){Xu(t,t.return,e)}}function ml(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new rl),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new rl),t;default:throw Error(i(435,e.tag))}}function hl(e,t){var n=ml(e);t.forEach(function(t){if(!n.has(t)){n.add(t);var r=td.bind(null,e,t);t.then(r,r)}})}function gl(e,t){var n=t.deletions;if(n!==null)for(var r=0;r<n.length;r++){var a=n[r],o=e,s=t,c=s;a:for(;c!==null;){switch(c.tag){case 27:if(of(c.type)){cl=c.stateNode,ll=!1;break a}break;case 5:cl=c.stateNode,ll=!1;break a;case 3:case 4:cl=c.stateNode.containerInfo,ll=!0;break a}c=c.return}if(cl===null)throw Error(i(160));dl(o,s,a),cl=null,ll=!1,o=a.alternate,o!==null&&(o.return=null),a.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)vl(t,e),t=t.sibling}var _l=null;function vl(e,t){var n=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:gl(t,e),yl(e),r&4&&(Hc(3,e,e.return),Vc(3,e),Hc(5,e,e.return));break;case 1:gl(t,e),yl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&64&&el&&(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 a=_l;if(gl(t,e),yl(e),r&512&&(tl||n===null||Kc(n,n.return)),r&4){var o=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,a=a.ownerDocument||a;b:switch(r){case`title`:o=a.getElementsByTagName(`title`)[0],(!o||o[ht]||o[lt]||o.namespaceURI===`http://www.w3.org/2000/svg`||o.hasAttribute(`itemprop`))&&(o=a.createElement(r),a.head.insertBefore(o,a.querySelector(`head > title`))),Hd(o,r,n),o[lt]=e,xt(o),r=o;break a;case`link`:var s=Yf(`link`,`href`,a).get(r+(n.href||``));if(s){for(var c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`href`)===(n.href==null||n.href===``?null:n.href)&&o.getAttribute(`rel`)===(n.rel==null?null:n.rel)&&o.getAttribute(`title`)===(n.title==null?null:n.title)&&o.getAttribute(`crossorigin`)===(n.crossOrigin==null?null:n.crossOrigin)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;case`meta`:if(s=Yf(`meta`,`content`,a).get(r+(n.content||``))){for(c=0;c<s.length;c++)if(o=s[c],o.getAttribute(`content`)===(n.content==null?null:``+n.content)&&o.getAttribute(`name`)===(n.name==null?null:n.name)&&o.getAttribute(`property`)===(n.property==null?null:n.property)&&o.getAttribute(`http-equiv`)===(n.httpEquiv==null?null:n.httpEquiv)&&o.getAttribute(`charset`)===(n.charSet==null?null:n.charSet)){s.splice(c,1);break b}}o=a.createElement(r),Hd(o,r,n),a.head.appendChild(o);break;default:throw Error(i(468,r))}o[lt]=e,xt(o),r=o}e.stateNode=r}else Xf(a,e.type,e.stateNode);else e.stateNode=Wf(a,r,e.memoizedProps);else o===r?r===null&&e.stateNode!==null&&Jc(e,e.memoizedProps,n.memoizedProps):(o===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):o.count--,r===null?Xf(a,e.type,e.stateNode):Wf(a,r,e.memoizedProps))}break;case 27:gl(t,e),yl(e),r&512&&(tl||n===null||Kc(n,n.return)),n!==null&&r&4&&Jc(e,e.memoizedProps,n.memoizedProps);break;case 5:if(gl(t,e),yl(e),r&512&&(tl||n===null||Kc(n,n.return)),e.flags&32){a=e.stateNode;try{qt(a,``)}catch(t){Xu(e,e.return,t)}}r&4&&e.stateNode!=null&&(a=e.memoizedProps,Jc(e,a,n===null?a:n.memoizedProps)),r&1024&&(nl=!0);break;case 6:if(gl(t,e),yl(e),r&4){if(e.stateNode===null)throw Error(i(162));r=e.memoizedProps,n=e.stateNode;try{n.nodeValue=r}catch(t){Xu(e,e.return,t)}}break;case 3:if(Jf=null,a=_l,_l=wf(t.containerInfo),gl(t,e),_l=a,yl(e),r&4&&n!==null&&n.memoizedState.isDehydrated)try{Vp(t.containerInfo)}catch(t){Xu(e,e.return,t)}nl&&(nl=!1,bl(e));break;case 4:r=_l,_l=wf(e.stateNode.containerInfo),gl(t,e),yl(e),_l=r;break;case 12:gl(t,e),yl(e);break;case 31:gl(t,e),yl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 13:gl(t,e),yl(e),e.child.flags&8192&&e.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(iu=Oe()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 22:a=e.memoizedState!==null;var l=n!==null&&n.memoizedState!==null,u=el,d=tl;if(el=u||a,tl=d||l,gl(t,e),tl=d,el=u,yl(e),r&8192)a:for(t=e.stateNode,t._visibility=a?t._visibility&-2:t._visibility|1,a&&(n===null||l||el||tl||xl(e)),n=null,t=e;;){if(t.tag===5||t.tag===26){if(n===null){l=n=t;try{if(o=l.stateNode,a)s=o.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){Xu(l,l.return,e)}}}else if(t.tag===6){if(n===null){l=t;try{l.stateNode.nodeValue=a?``:l.memoizedProps}catch(e){Xu(l,l.return,e)}}}else if(t.tag===18){if(n===null){l=t;try{var m=l.stateNode;a?cf(m,!0):cf(l.stateNode,!1)}catch(e){Xu(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,hl(e,n))));break;case 19:gl(t,e),yl(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,hl(e,r)));break;case 30:break;case 21:break;default:gl(t,e),yl(e)}}function yl(e){var t=e.flags;if(t&2){try{for(var n,r=e.return;r!==null;){if(Yc(r)){n=r;break}r=r.return}if(n==null)throw Error(i(160));switch(n.tag){case 27:var a=n.stateNode;Qc(e,Xc(e),a);break;case 5:var o=n.stateNode;n.flags&32&&(qt(o,``),n.flags&=-33),Qc(e,Xc(e),o);break;case 3:case 4:var s=n.stateNode.containerInfo;Zc(e,Xc(e),s);break;default:throw Error(i(161))}}catch(t){Xu(e,e.return,t)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function bl(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;bl(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function G(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)ol(e,t.alternate,t),t=t.sibling}function xl(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:Hc(4,t,t.return),xl(t);break;case 1:Kc(t,t.return);var n=t.stateNode;typeof n.componentWillUnmount==`function`&&Wc(t,t.return,n),xl(t);break;case 27:xf(t.stateNode);case 26:case 5:Kc(t,t.return),xl(t);break;case 22:t.memoizedState===null&&xl(t);break;case 30:xl(t);break;default:xl(t)}e=e.sibling}}function Sl(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:Sl(i,a,n),Vc(4,a);break;case 1:if(Sl(i,a,n),r=a,i=r.stateNode,typeof i.componentDidMount==`function`)try{i.componentDidMount()}catch(e){Xu(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++)Ya(c[i],s)}catch(e){Xu(r,r.return,e)}}n&&o&64&&Uc(a),Gc(a,a.return);break;case 27:$c(a);case 26:case 5:Sl(i,a,n),n&&r===null&&o&4&&qc(a),Gc(a,a.return);break;case 12:Sl(i,a,n);break;case 31:Sl(i,a,n),n&&o&4&&fl(i,a);break;case 13:Sl(i,a,n),n&&o&4&&pl(i,a);break;case 22:a.memoizedState===null&&Sl(i,a,n),Gc(a,a.return);break;case 30:break;default:Sl(i,a,n)}t=t.sibling}}function Cl(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&&ca(n))}function wl(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&ca(e))}function Tl(e,t,n,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)El(e,t,n,r),t=t.sibling}function El(e,t,n,r){var i=t.flags;switch(t.tag){case 0:case 11:case 15:Tl(e,t,n,r),i&2048&&Vc(9,t);break;case 1:Tl(e,t,n,r);break;case 3:Tl(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&&ca(e)));break;case 12:if(i&2048){Tl(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){Xu(t,t.return,e)}}else Tl(e,t,n,r);break;case 31:Tl(e,t,n,r);break;case 13:Tl(e,t,n,r);break;case 23:break;case 22:a=t.stateNode,o=t.alternate,t.memoizedState===null?a._visibility&2?Tl(e,t,n,r):(a._visibility|=2,Dl(e,t,n,r,(t.subtreeFlags&10256)!=0||!1)):a._visibility&2?Tl(e,t,n,r):Ol(e,t),i&2048&&Cl(o,t);break;case 24:Tl(e,t,n,r),i&2048&&wl(t.alternate,t);break;default:Tl(e,t,n,r)}}function Dl(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:Dl(a,o,s,c,i),Vc(8,o);break;case 23:break;case 22:var u=o.stateNode;o.memoizedState===null?(u._visibility|=2,Dl(a,o,s,c,i)):u._visibility&2?Dl(a,o,s,c,i):Ol(a,o),i&&l&2048&&Cl(o.alternate,o);break;case 24:Dl(a,o,s,c,i),i&&l&2048&&wl(o.alternate,o);break;default:Dl(a,o,s,c,i)}t=t.sibling}}function Ol(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:Ol(n,r),i&2048&&Cl(r.alternate,r);break;case 24:Ol(n,r),i&2048&&wl(r.alternate,r);break;default:Ol(n,r)}t=t.sibling}}var kl=8192;function Al(e,t,n){if(e.subtreeFlags&kl)for(e=e.child;e!==null;)jl(e,t,n),e=e.sibling}function jl(e,t,n){switch(e.tag){case 26:Al(e,t,n),e.flags&kl&&e.memoizedState!==null&&$f(n,_l,e.memoizedState,e.memoizedProps);break;case 5:Al(e,t,n);break;case 3:case 4:var r=_l;_l=wf(e.stateNode.containerInfo),Al(e,t,n),_l=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=kl,kl=16777216,Al(e,t,n),kl=r):Al(e,t,n));break;default:Al(e,t,n)}}function Ml(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 Nl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];il=r,Il(r,e)}Ml(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Pl(e),e=e.sibling}function Pl(e){switch(e.tag){case 0:case 11:case 15:Nl(e),e.flags&2048&&Hc(9,e,e.return);break;case 3:Nl(e);break;case 12:Nl(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Fl(e)):Nl(e);break;default:Nl(e)}}function Fl(e){var t=e.deletions;if(e.flags&16){if(t!==null)for(var n=0;n<t.length;n++){var r=t[n];il=r,Il(r,e)}Ml(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:Hc(8,t,t.return),Fl(t);break;case 22:n=t.stateNode,n._visibility&2&&(n._visibility&=-3,Fl(t));break;default:Fl(t)}e=e.sibling}}function Il(e,t){for(;il!==null;){var n=il;switch(n.tag){case 0:case 11:case 15:Hc(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:ca(n.memoizedState.cache)}if(r=n.child,r!==null)r.return=n,il=r;else a:for(n=e;il!==null;){r=il;var i=r.sibling,a=r.return;if(sl(r),r===n){il=null;break a}if(i!==null){i.return=a,il=i;break a}il=a}}}var Ll={getCacheForType:function(e){var t=ea(oa),n=t.data.get(e);return n===void 0&&(n=e(),t.data.set(e,n)),n},cacheSignal:function(){return ea(oa).controller.signal}},Rl=typeof WeakMap==`function`?WeakMap:Map,zl=0,Bl=null,Vl=null,Hl=0,Ul=0,Wl=null,Gl=!1,Kl=!1,ql=!1,Jl=0,Yl=0,Xl=0,Zl=0,Ql=0,$l=0,eu=0,tu=null,nu=null,ru=!1,iu=0,au=0,ou=1/0,su=null,cu=null,lu=0,uu=null,du=null,fu=0,pu=0,mu=null,hu=null,gu=0,_u=null;function vu(){return zl&2&&Hl!==0?Hl&-Hl:j.T===null?ot():_d()}function yu(){if($l===0)if(!(Hl&536870912)||Pi){var e=Ge;Ge<<=1,!(Ge&3932160)&&(Ge=262144),$l=e}else $l=536870912;return e=no.current,e!==null&&(e.flags|=32),$l}function bu(e,t,n){(e===Bl&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)&&(Du(e,0),wu(e,Hl,$l,!1)),$e(e,n),(!(zl&2)||e!==Bl)&&(e===Bl&&(!(zl&2)&&(Zl|=n),Yl===4&&wu(e,Hl,$l,!1)),ld(e))}function xu(e,t,n){if(zl&6)throw Error(i(327));var r=!n&&(t&127)==0&&(t&e.expiredLanes)===0||Ye(e,t),a=r?Fu(e,t):Nu(e,t,!0),o=r;do{if(a===0){Kl&&!r&&wu(e,t,0,!1);break}else{if(n=e.current.alternate,o&&!Cu(n)){a=Nu(e,t,!1),o=!1;continue}if(a===2){if(o=t,e.errorRecoveryDisabledLanes&o)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;a=tu;var l=c.current.memoizedState.isDehydrated;if(l&&(Du(c,s).flags|=256),s=Nu(c,s,!1),s!==2){if(ql&&!l){c.errorRecoveryDisabledLanes|=o,Zl|=o,a=4;break a}o=nu,nu=a,o!==null&&(nu===null?nu=o:nu.push.apply(nu,o))}a=s}if(o=!1,a!==2)continue}}if(a===1){Du(e,0),wu(e,t,0,!0);break}a:{switch(r=e,o=a,o){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:wu(r,t,$l,!Gl);break a;case 2:nu=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(a=iu+300-Oe(),10<a)){if(wu(r,t,$l,!Gl),Je(r,0,!0)!==0)break a;fu=t,r.timeoutHandle=ef(Su.bind(null,r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,`Throttled`,-0,0),a);break a}Su(r,n,nu,su,ru,t,$l,Zl,eu,Gl,o,null,-0,0)}}break}while(1);ld(e)}function Su(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:tn},jl(t,a,d);var m=(a&62914560)===a?iu-Oe():(a&4194048)===a?au-Oe():0;if(m=tp(d,m),m!==null){fu=a,e.cancelPendingCommit=m(Hu.bind(null,e,t,a,n,r,i,o,s,c,u,d,null,f,p)),wu(e,a,o,!l);return}}Hu(e,t,a,n,r,i,o,s,c)}function Cu(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(!Cr(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 wu(e,t,n,r){t&=~Ql,t&=~Zl,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var i=t;0<i;){var a=31-Be(i),o=1<<a;r[a]=-1,i&=~o}n!==0&&tt(e,n,t)}function Tu(){return zl&6?!0:(ud(0,!1),!1)}function Eu(){if(Vl!==null){if(Ul===0)var e=Vl.return;else e=Vl,qi=Ki=null,Ao(e),ja=null,Ma=0,e=Vl;for(;e!==null;)Bc(e.alternate,e),e=e.return;Vl=null}}function Du(e,t){var n=e.timeoutHandle;n!==-1&&(e.timeoutHandle=-1,tf(n)),n=e.cancelPendingCommit,n!==null&&(e.cancelPendingCommit=null,n()),fu=0,Eu(),Bl=e,Vl=n=ui(e.current,null),Hl=t,Ul=0,Wl=null,Gl=!1,Kl=Ye(e,t),ql=!1,eu=$l=Ql=Zl=Xl=Yl=0,nu=tu=null,ru=!1,t&8&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var i=31-Be(r),a=1<<i;t|=e[i],r&=~a}return Jl=t,ei(),n}function Ou(e,t){z=null,j.H=Rs,t===xa||t===Ca?(t=ka(),Ul=3):t===Sa?(t=ka(),Ul=4):Ul=t===nc?8:typeof t==`object`&&t&&typeof t.then==`function`?6:1,Wl=t,Vl===null&&(Yl=1,Xs(e,_i(t,e.current)))}function ku(){var e=no.current;return e===null?!0:(Hl&4194048)===Hl?ro===null:(Hl&62914560)===Hl||Hl&536870912?e===ro:!1}function Au(){var e=j.H;return j.H=Rs,e===null?Rs:e}function ju(){var e=j.A;return j.A=Ll,e}function Mu(){Yl=4,Gl||(Hl&4194048)!==Hl&&no.current!==null||(Kl=!0),!(Xl&134217727)&&!(Zl&134217727)||Bl===null||wu(Bl,Hl,$l,!1)}function Nu(e,t,n){var r=zl;zl|=2;var i=Au(),a=ju();(Bl!==e||Hl!==t)&&(su=null,Du(e,t)),t=!1;var o=Yl;a:do try{if(Ul!==0&&Vl!==null){var s=Vl,c=Wl;switch(Ul){case 8:Eu(),o=6;break a;case 3:case 2:case 9:case 6:no.current===null&&(t=!0);var l=Ul;if(Ul=0,Wl=null,zu(e,s,c,l),n&&Kl){o=0;break a}break;default:l=Ul,Ul=0,Wl=null,zu(e,s,c,l)}}Pu(),o=Yl;break}catch(t){Ou(e,t)}while(1);return t&&e.shellSuspendCounter++,qi=Ki=null,zl=r,j.H=i,j.A=a,Vl===null&&(Bl=null,Hl=0,ei()),o}function Pu(){for(;Vl!==null;)Lu(Vl)}function Fu(e,t){var n=zl;zl|=2;var r=Au(),a=ju();Bl!==e||Hl!==t?(su=null,ou=Oe()+500,Du(e,t)):Kl=Ye(e,t);a:do try{if(Ul!==0&&Vl!==null){t=Vl;var o=Wl;b:switch(Ul){case 1:Ul=0,Wl=null,zu(e,t,o,1);break;case 2:case 9:if(Ta(o)){Ul=0,Wl=null,Ru(t);break}t=function(){Ul!==2&&Ul!==9||Bl!==e||(Ul=7),ld(e)},o.then(t,t);break a;case 3:Ul=7;break a;case 4:Ul=5;break a;case 7:Ta(o)?(Ul=0,Wl=null,Ru(t)):(Ul=0,Wl=null,zu(e,t,o,7));break;case 5:var s=null;switch(Vl.tag){case 26:s=Vl.memoizedState;case 5:case 27:var c=Vl;if(s?Qf(s):c.stateNode.complete){Ul=0,Wl=null;var l=c.sibling;if(l!==null)Vl=l;else{var u=c.return;u===null?Vl=null:(Vl=u,Bu(u))}break b}}Ul=0,Wl=null,zu(e,t,o,5);break;case 6:Ul=0,Wl=null,zu(e,t,o,6);break;case 8:Eu(),Yl=6;break a;default:throw Error(i(462))}}Iu();break}catch(t){Ou(e,t)}while(1);return qi=Ki=null,j.H=r,j.A=a,zl=n,Vl===null?(Bl=null,Hl=0,ei(),Yl):0}function Iu(){for(;Vl!==null&&!Ee();)Lu(Vl)}function Lu(e){var t=jc(e.alternate,e,Jl);e.memoizedProps=e.pendingProps,t===null?Bu(e):Vl=t}function Ru(e){var t=e,n=t.alternate;switch(t.tag){case 15:case 0:t=gc(n,t,t.pendingProps,t.type,void 0,Hl);break;case 11:t=gc(n,t,t.pendingProps,t.type.render,t.ref,Hl);break;case 5:Ao(t);default:Bc(n,t),t=Vl=di(t,Jl),t=jc(n,t,Jl)}e.memoizedProps=e.pendingProps,t===null?Bu(e):Vl=t}function zu(e,t,n,r){qi=Ki=null,Ao(t),ja=null,Ma=0;var i=t.return;try{if(tc(e,i,t,n,Hl)){Yl=1,Xs(e,_i(n,e.current)),Vl=null;return}}catch(t){if(i!==null)throw Vl=i,t;Yl=1,Xs(e,_i(n,e.current)),Vl=null;return}t.flags&32768?(Pi||r===1?e=!0:Kl||Hl&536870912?e=!1:(Gl=e=!0,(r===2||r===9||r===3||r===6)&&(r=no.current,r!==null&&r.tag===13&&(r.flags|=16384))),Vu(t,e)):Bu(t)}function Bu(e){var t=e;do{if(t.flags&32768){Vu(t,Gl);return}e=t.return;var n=Rc(t.alternate,t,Jl);if(n!==null){Vl=n;return}if(t=t.sibling,t!==null){Vl=t;return}Vl=t=e}while(t!==null);Yl===0&&(Yl=5)}function Vu(e,t){do{var n=zc(e.alternate,e);if(n!==null){n.flags&=32767,Vl=n;return}if(n=e.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!t&&(e=e.sibling,e!==null)){Vl=e;return}Vl=e=n}while(e!==null);Yl=6,Vl=null}function Hu(e,t,n,r,a,o,s,c,l){e.cancelPendingCommit=null;do qu();while(lu!==0);if(zl&6)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(o=t.lanes|t.childLanes,o|=$r,et(e,n,o,s,c,l),e===Bl&&(Vl=Bl=null,Hl=0),du=t,uu=e,fu=n,pu=o,mu=a,hu=r,t.subtreeFlags&10256||t.flags&10256?(e.callbackNode=null,e.callbackPriority=0,nd(Me,function(){return Ju(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!=0,t.subtreeFlags&13878||r){r=j.T,j.T=null,a=re.p,re.p=2,s=zl,zl|=4;try{al(e,t,n)}finally{zl=s,re.p=a,j.T=r}}lu=1,Uu(),Wu(),Gu()}}function Uu(){if(lu===1){lu=0;var e=uu,t=du,n=(t.flags&13878)!=0;if(t.subtreeFlags&13878||n){n=j.T,j.T=null;var r=re.p;re.p=2;var i=zl;zl|=4;try{vl(t,e);var a=qd,o=Or(e.containerInfo),s=a.focusedElem,c=a.selectionRange;if(o!==s&&s&&s.ownerDocument&&Dr(s.ownerDocument.documentElement,s)){if(c!==null&&kr(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 _=Er(s,h),v=Er(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}}hp=!!Kd,qd=Kd=null}finally{zl=i,re.p=r,j.T=n}}e.current=t,lu=2}}function Wu(){if(lu===2){lu=0;var e=uu,t=du,n=(t.flags&8772)!=0;if(t.subtreeFlags&8772||n){n=j.T,j.T=null;var r=re.p;re.p=2;var i=zl;zl|=4;try{ol(e,t.alternate,t)}finally{zl=i,re.p=r,j.T=n}}lu=3}}function Gu(){if(lu===4||lu===3){lu=0,De();var e=uu,t=du,n=fu,r=hu;t.subtreeFlags&10256||t.flags&10256?lu=5:(lu=0,du=uu=null,Ku(e,e.pendingLanes));var i=e.pendingLanes;if(i===0&&(cu=null),at(n),t=t.stateNode,Re&&typeof Re.onCommitFiberRoot==`function`)try{Re.onCommitFiberRoot(Le,t,void 0,(t.current.flags&128)==128)}catch{}if(r!==null){t=j.T,i=re.p,re.p=2,j.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{j.T=t,re.p=i}}fu&3&&qu(),ld(e),i=e.pendingLanes,n&261930&&i&42?e===_u?gu++:(gu=0,_u=e):gu=0,ud(0,!1)}}function Ku(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,ca(t)))}function qu(){return Uu(),Wu(),Gu(),Ju()}function Ju(){if(lu!==5)return!1;var e=uu,t=pu;pu=0;var n=at(fu),r=j.T,a=re.p;try{re.p=32>n?32:n,j.T=null,n=mu,mu=null;var o=uu,s=fu;if(lu=0,du=uu=null,fu=0,zl&6)throw Error(i(331));var c=zl;if(zl|=4,Pl(o.current),El(o,o.current,s,n),zl=c,ud(0,!1),Re&&typeof Re.onPostCommitFiberRoot==`function`)try{Re.onPostCommitFiberRoot(Le,o)}catch{}return!0}finally{re.p=a,j.T=r,Ku(e,t)}}function Yu(e,t,n){t=_i(n,t),t=Qs(e.stateNode,t,2),e=Ua(e,t,2),e!==null&&($e(e,2),ld(e))}function Xu(e,t,n){if(e.tag===3)Yu(e,e,n);else for(;t!==null;){if(t.tag===3){Yu(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError==`function`||typeof r.componentDidCatch==`function`&&(cu===null||!cu.has(r))){e=_i(n,e),n=$s(2),r=Ua(t,n,2),r!==null&&(ec(n,r,t,e),$e(r,2),ld(r));break}}t=t.return}}function Zu(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new Rl;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)||(ql=!0,i.add(n),e=Qu.bind(null,e,t,n),t.then(e,e))}function Qu(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,Bl===e&&(Hl&n)===n&&(Yl===4||Yl===3&&(Hl&62914560)===Hl&&300>Oe()-iu?!(zl&2)&&Du(e,0):Ql|=n,eu===Hl&&(eu=0)),ld(e)}function $u(e,t){t===0&&(t=Ze()),e=ri(e,t),e!==null&&($e(e,t),ld(e))}function ed(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),$u(e,n)}function td(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}r!==null&&r.delete(t),$u(e,n)}function nd(e,t){return we(e,t)}var rd=null,id=null,ad=!1,od=!1,sd=!1,cd=0;function ld(e){e!==id&&e.next===null&&(id===null?rd=id=e:id=id.next=e),od=!0,ad||(ad=!0,gd())}function ud(e,t){if(!sd&&od){sd=!0;do for(var n=!1,r=rd;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-Be(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,hd(r,a))}else a=Hl,a=Je(r,r===Bl?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),!(a&3)||Ye(r,a)||(n=!0,hd(r,a));r=r.next}while(n);sd=!1}}function dd(){fd()}function fd(){od=ad=!1;var e=0;cd!==0&&$d()&&(e=cd);for(var t=Oe(),n=null,r=rd;r!==null;){var i=r.next,a=pd(r,t);a===0?(r.next=null,n===null?rd=i:n.next=i,i===null&&(id=n)):(n=r,(e!==0||a&3)&&(od=!0)),r=i}lu!==0&&lu!==5||ud(e,!1),cd!==0&&(cd=0)}function pd(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0<a;){var o=31-Be(a),s=1<<o,c=i[o];c===-1?((s&n)===0||(s&r)!==0)&&(i[o]=Xe(s,t)):c<=t&&(e.expiredLanes|=s),a&=~s}if(t=Bl,n=Hl,n=Je(e,e===t?n:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,n===0||e===t&&(Ul===2||Ul===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Te(r),e.callbackNode=null,e.callbackPriority=0;if(!(n&3)||Ye(e,n)){if(t=n&-n,t===e.callbackPriority)return t;switch(r!==null&&Te(r),at(n)){case 2:case 8:n=je;break;case 32:n=Me;break;case 268435456:n=Pe;break;default:n=Me}return r=md.bind(null,e),n=we(n,r),e.callbackPriority=t,e.callbackNode=n,t}return r!==null&&r!==null&&Te(r),e.callbackPriority=2,e.callbackNode=null,2}function md(e,t){if(lu!==0&&lu!==5)return e.callbackNode=null,e.callbackPriority=0,null;var n=e.callbackNode;if(qu()&&e.callbackNode!==n)return null;var r=Hl;return r=Je(e,e===Bl?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(xu(e,r,t),pd(e,Oe()),e.callbackNode!=null&&e.callbackNode===n?md.bind(null,e):null)}function hd(e,t){if(qu())return null;xu(e,t,!0)}function gd(){rf(function(){zl&6?we(Ae,dd):fd()})}function _d(){if(cd===0){var e=da;e===0&&(e=We,We<<=1,!(We&261888)&&(We=256)),cd=e}return cd}function vd(e){return e==null||typeof e==`symbol`||typeof e==`boolean`?null:typeof e==`function`?e:en(``+e)}function yd(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 bd(e,t,n,r,i){if(t===`submit`&&n&&n.stateNode===i){var a=vd((i[P]||null).action),o=r.submitter;o&&(t=(t=o[P]||null)?vd(t.formAction):o.getAttribute(`formAction`),t!==null&&(a=t,o=null));var s=new Cn(`action`,`action`,null,r,i);e.push({event:s,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(cd!==0){var e=o?yd(i,o):new FormData(i);ws(n,{pending:!0,data:e,method:i.method,action:a},null,e)}}else typeof a==`function`&&(s.preventDefault(),e=o?yd(i,o):new FormData(i),ws(n,{pending:!0,data:e,method:i.method,action:a},a,e))},currentTarget:i}]})}}for(var xd=0;xd<Jr.length;xd++){var Sd=Jr[xd];Yr(Sd.toLowerCase(),`on`+(Sd[0].toUpperCase()+Sd.slice(1)))}Yr(Vr,`onAnimationEnd`),Yr(Hr,`onAnimationIteration`),Yr(Ur,`onAnimationStart`),Yr(`dblclick`,`onDoubleClick`),Yr(`focusin`,`onFocus`),Yr(`focusout`,`onBlur`),Yr(Wr,`onTransitionRun`),Yr(Gr,`onTransitionStart`),Yr(Kr,`onTransitionCancel`),Yr(I,`onTransitionEnd`),Tt(`onMouseEnter`,[`mouseout`,`mouseover`]),Tt(`onMouseLeave`,[`mouseout`,`mouseover`]),Tt(`onPointerEnter`,[`pointerout`,`pointerover`]),Tt(`onPointerLeave`,[`pointerout`,`pointerover`]),wt(`onChange`,`change click focusin focusout input keydown keyup selectionchange`.split(` `)),wt(`onSelect`,`focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange`.split(` `)),wt(`onBeforeInput`,[`compositionend`,`keypress`,`textInput`,`paste`]),wt(`onCompositionEnd`,`compositionend focusout keydown keypress keyup mousedown`.split(` `)),wt(`onCompositionStart`,`compositionstart focusout keydown keypress keyup mousedown`.split(` `)),wt(`onCompositionUpdate`,`compositionupdate focusout keydown keypress keyup mousedown`.split(` `));var Cd=`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(` `),wd=new Set(`beforetoggle cancel close invalid load scroll scrollend toggle`.split(` `).concat(Cd));function Td(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){Xr(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){Xr(e)}i.currentTarget=null,a=c}}}}function Ed(e,t){var n=t[dt];n===void 0&&(n=t[dt]=new Set);var r=e+`__bubble`;n.has(r)||(Ad(t,e,2,!1),n.add(r))}function Dd(e,t,n){var r=0;t&&(r|=4),Ad(n,e,r,t)}var Od=`_reactListening`+Math.random().toString(36).slice(2);function kd(e){if(!e[Od]){e[Od]=!0,St.forEach(function(t){t!==`selectionchange`&&(wd.has(t)||Dd(t,!1,e),Dd(t,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Od]||(t[Od]=!0,Dd(`selectionchange`,!1,t))}}function Ad(e,t,n,r){switch(Sp(t)){case 2:var i=gp;break;case 8:i=_p;break;default:i=vp}n=i.bind(null,t,n,e),i=void 0,!fn||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 jd(e,t,n,r,i){var a=r;if(!(t&1)&&!(t&2)&&r!==null)a:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var c=r.stateNode.containerInfo;if(c===i)break;if(s===4)for(s=r.return;s!==null;){var l=s.tag;if((l===3||l===4)&&s.stateNode.containerInfo===i)return;s=s.return}for(;c!==null;){if(s=_t(c),s===null)return;if(l=s.tag,l===5||l===6||l===26||l===27){r=a=s;continue a}c=c.parentNode}}r=r.return}ln(function(){var r=a,i=rn(n),s=[];a:{var c=qr.get(e);if(c!==void 0){var l=Cn,u=e;switch(e){case`keypress`:if(vn(n)===0)break a;case`keydown`:case`keyup`:l=Vn;break;case`focusin`:u=`focus`,l=Mn;break;case`focusout`:u=`blur`,l=Mn;break;case`beforeblur`:case`afterblur`:l=Mn;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=An;break;case`drag`:case`dragend`:case`dragenter`:case`dragexit`:case`dragleave`:case`dragover`:case`dragstart`:case`drop`:l=jn;break;case`touchcancel`:case`touchend`:case`touchmove`:case`touchstart`:l=Un;break;case Vr:case Hr:case Ur:l=Nn;break;case I:l=Wn;break;case`scroll`:case`scrollend`:l=Tn;break;case`wheel`:l=Gn;break;case`copy`:case`cut`:case`paste`:l=Pn;break;case`gotpointercapture`:case`lostpointercapture`:case`pointercancel`:case`pointerdown`:case`pointermove`:case`pointerout`:case`pointerover`:case`pointerup`:l=Hn;break;case`toggle`:case`beforetoggle`:l=Kn}var d=(t&4)!=0,f=!d&&(e===`scroll`||e===`scrollend`),p=d?c===null?null:c+`Capture`:c;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=un(m,p),g!=null&&d.push(Md(m,g,h))),f)break;m=m.return}0<d.length&&(c=new l(c,u,null,n,i),s.push({event:c,listeners:d}))}}if(!(t&7)){a:{if(c=e===`mouseover`||e===`pointerover`,l=e===`mouseout`||e===`pointerout`,c&&n!==nn&&(u=n.relatedTarget||n.fromElement)&&(_t(u)||u[ut]))break a;if((l||c)&&(c=i.window===i?i:(c=i.ownerDocument)?c.defaultView||c.parentWindow:window,l?(u=n.relatedTarget||n.toElement,l=r,u=u?_t(u):null,u!==null&&(f=o(u),d=u.tag,u!==f||d!==5&&d!==27&&d!==6)&&(u=null)):(l=null,u=r),l!==u)){if(d=An,g=`onMouseLeave`,p=`onMouseEnter`,m=`mouse`,(e===`pointerout`||e===`pointerover`)&&(d=Hn,g=`onPointerLeave`,p=`onPointerEnter`,m=`pointer`),f=l==null?c:yt(l),h=u==null?c:yt(u),c=new d(g,m+`leave`,l,n,i),c.target=f,c.relatedTarget=h,g=null,_t(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=Pd,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&&Fd(s,c,l,d,!1),u!==null&&f!==null&&Fd(s,f,u,d,!0)}}a:{if(c=r?yt(r):window,l=c.nodeName&&c.nodeName.toLowerCase(),l===`select`||l===`input`&&c.type===`file`)var v=dr;else if(ar(c))if(fr)v=xr;else{v=yr;var y=vr}else l=c.nodeName,!l||l.toLowerCase()!==`input`||c.type!==`checkbox`&&c.type!==`radio`?r&&Zt(r.elementType)&&(v=dr):v=br;if(v&&=v(e,r)){or(s,v,n,i);break a}y&&y(e,c,r),e===`focusout`&&r&&c.type===`number`&&r.memoizedProps.value!=null&&Ut(c,`number`,c.value)}switch(y=r?yt(r):window,e){case`focusin`:(ar(y)||y.contentEditable===`true`)&&(jr=y,Mr=r,Nr=null);break;case`focusout`:Nr=Mr=jr=null;break;case`mousedown`:Pr=!0;break;case`contextmenu`:case`mouseup`:case`dragend`:Pr=!1,Fr(s,n,i);break;case`selectionchange`:if(Ar)break;case`keydown`:case`keyup`:Fr(s,n,i)}var b;if(Jn)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 tr?$n(e,n)&&(x=`onCompositionEnd`):e===`keydown`&&n.keyCode===229&&(x=`onCompositionStart`);x&&(Xn&&n.locale!==`ko`&&(tr||x!==`onCompositionStart`?x===`onCompositionEnd`&&tr&&(b=_n()):(mn=i,hn=`value`in mn?mn.value:mn.textContent,tr=!0)),y=Nd(r,x),0<y.length&&(x=new Fn(x,e,null,n,i),s.push({event:x,listeners:y}),b?x.data=b:(b=er(n),b!==null&&(x.data=b)))),(b=Yn?nr(e,n):rr(e,n))&&(x=Nd(r,`onBeforeInput`),0<x.length&&(y=new Fn(`onBeforeInput`,`beforeinput`,null,n,i),s.push({event:y,listeners:x}),y.data=b)),bd(s,e,r,n,i)}Td(s,t)})}function Md(e,t,n){return{instance:e,listener:t,currentTarget:n}}function Nd(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=un(e,n),i!=null&&r.unshift(Md(e,i,a)),i=un(e,t),i!=null&&r.push(Md(e,i,a))),e.tag===3)return r;e=e.return}return[]}function Pd(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Fd(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=un(n,a),l!=null&&o.unshift(Md(n,l,c))):i||(l=un(n,a),l!=null&&o.push(Md(n,l,c)))),n=n.return}o.length!==0&&e.push({event:t,listeners:o})}var Id=/\r\n?/g,Ld=/\u0000|\uFFFD/g;function Rd(e){return(typeof e==`string`?e:``+e).replace(Id,`
|
|
10
|
+
`).replace(Ld,``)}function zd(e,t){return t=Rd(t),Rd(e)===t}function Bd(e,t,n,r,a,o){switch(n){case`children`:typeof r==`string`?t===`body`||t===`textarea`&&r===``||qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&t!==`body`&&qt(e,``+r);break;case`className`:jt(e,`class`,r);break;case`tabIndex`:jt(e,`tabindex`,r);break;case`dir`:case`role`:case`viewBox`:case`width`:case`height`:jt(e,n,r);break;case`style`:Xt(e,r,o);break;case`data`:if(t!==`object`){jt(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=en(``+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 o==`function`&&(n===`formAction`?(t!==`input`&&Bd(e,t,`name`,a.name,a,null),Bd(e,t,`formEncType`,a.formEncType,a,null),Bd(e,t,`formMethod`,a.formMethod,a,null),Bd(e,t,`formTarget`,a.formTarget,a,null)):(Bd(e,t,`encType`,a.encType,a,null),Bd(e,t,`method`,a.method,a,null),Bd(e,t,`target`,a.target,a,null)));if(r==null||typeof r==`symbol`||typeof r==`boolean`){e.removeAttribute(n);break}r=en(``+r),e.setAttribute(n,r);break;case`onClick`:r!=null&&(e.onclick=tn);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(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=en(``+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`:Ed(`beforetoggle`,e),Ed(`toggle`,e),At(e,`popover`,r);break;case`xlinkActuate`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:actuate`,r);break;case`xlinkArcrole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:arcrole`,r);break;case`xlinkRole`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:role`,r);break;case`xlinkShow`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:show`,r);break;case`xlinkTitle`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:title`,r);break;case`xlinkType`:Mt(e,`http://www.w3.org/1999/xlink`,`xlink:type`,r);break;case`xmlBase`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:base`,r);break;case`xmlLang`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:lang`,r);break;case`xmlSpace`:Mt(e,`http://www.w3.org/XML/1998/namespace`,`xml:space`,r);break;case`is`:At(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=Qt.get(n)||n,At(e,n,r))}}function Vd(e,t,n,r,a,o){switch(n){case`style`:Xt(e,r,o);break;case`dangerouslySetInnerHTML`:if(r!=null){if(typeof r!=`object`||!(`__html`in r))throw Error(i(61));if(n=r.__html,n!=null){if(a.children!=null)throw Error(i(60));e.innerHTML=n}}break;case`children`:typeof r==`string`?qt(e,r):(typeof r==`number`||typeof r==`bigint`)&&qt(e,``+r);break;case`onScroll`:r!=null&&Ed(`scroll`,e);break;case`onScrollEnd`:r!=null&&Ed(`scrollend`,e);break;case`onClick`:r!=null&&(e.onclick=tn);break;case`suppressContentEditableWarning`:case`suppressHydrationWarning`:case`innerHTML`:case`ref`:break;case`innerText`:case`textContent`:break;default:if(!Ct.hasOwnProperty(n))a:{if(n[0]===`o`&&n[1]===`n`&&(a=n.endsWith(`Capture`),t=n.slice(2,a?n.length-7:void 0),o=e[P]||null,o=o==null?null:o[n],typeof o==`function`&&e.removeEventListener(t,o,a),typeof r==`function`)){typeof o!=`function`&&o!==null&&(n in e?e[n]=null:e.hasAttribute(n)&&e.removeAttribute(n)),e.addEventListener(t,r,a);break a}n in e?e[n]=r:!0===r?e.setAttribute(n,``):At(e,n,r)}}}function Hd(e,t,n){switch(t){case`div`:case`span`:case`svg`:case`path`:case`a`:case`g`:case`p`:case`li`:break;case`img`:Ed(`error`,e),Ed(`load`,e);var r=!1,a=!1,o;for(o in n)if(n.hasOwnProperty(o)){var s=n[o];if(s!=null)switch(o){case`src`:r=!0;break;case`srcSet`:a=!0;break;case`children`:case`dangerouslySetInnerHTML`:throw Error(i(137,t));default:Bd(e,t,o,s,n,null)}}a&&Bd(e,t,`srcSet`,n.srcSet,n,null),r&&Bd(e,t,`src`,n.src,n,null);return;case`input`:Ed(`invalid`,e);var c=o=s=a=null,l=null,u=null;for(r in n)if(n.hasOwnProperty(r)){var d=n[r];if(d!=null)switch(r){case`name`:a=d;break;case`type`:s=d;break;case`checked`:l=d;break;case`defaultChecked`:u=d;break;case`value`:o=d;break;case`defaultValue`:c=d;break;case`children`:case`dangerouslySetInnerHTML`:if(d!=null)throw Error(i(137,t));break;default:Bd(e,t,r,d,n,null)}}Ht(e,o,c,l,u,s,a,!1);return;case`select`:for(a in Ed(`invalid`,e),r=s=o=null,n)if(n.hasOwnProperty(a)&&(c=n[a],c!=null))switch(a){case`value`:o=c;break;case`defaultValue`:s=c;break;case`multiple`:r=c;default:Bd(e,t,a,c,n,null)}t=o,n=s,e.multiple=!!r,t==null?n!=null&&Wt(e,!!r,n,!0):Wt(e,!!r,t,!1);return;case`textarea`:for(s in Ed(`invalid`,e),o=a=r=null,n)if(n.hasOwnProperty(s)&&(c=n[s],c!=null))switch(s){case`value`:r=c;break;case`defaultValue`:a=c;break;case`children`:o=c;break;case`dangerouslySetInnerHTML`:if(c!=null)throw Error(i(91));break;default:Bd(e,t,s,c,n,null)}Kt(e,r,a,o);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:Bd(e,t,l,r,n,null)}return;case`dialog`:Ed(`beforetoggle`,e),Ed(`toggle`,e),Ed(`cancel`,e),Ed(`close`,e);break;case`iframe`:case`object`:Ed(`load`,e);break;case`video`:case`audio`:for(r=0;r<Cd.length;r++)Ed(Cd[r],e);break;case`image`:Ed(`error`,e),Ed(`load`,e);break;case`details`:Ed(`toggle`,e);break;case`embed`:case`source`:case`link`:Ed(`error`,e),Ed(`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(i(137,t));default:Bd(e,t,u,r,n,null)}return;default:if(Zt(t)){for(d in n)n.hasOwnProperty(d)&&(r=n[d],r!==void 0&&Vd(e,t,d,r,n,void 0));return}}for(c in n)n.hasOwnProperty(c)&&(r=n[c],r!=null&&Bd(e,t,c,r,n,null))}function Ud(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 a=null,o=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)||Bd(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`:o=m;break;case`name`:a=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(i(137,t));break;default:m!==f&&Bd(e,t,p,m,r,f)}}Vt(e,s,c,l,u,d,o,a);return;case`select`:for(o in m=s=c=p=null,n)if(l=n[o],n.hasOwnProperty(o)&&l!=null)switch(o){case`value`:break;case`multiple`:m=l;default:r.hasOwnProperty(o)||Bd(e,t,o,null,r,l)}for(a in r)if(o=r[a],l=n[a],r.hasOwnProperty(a)&&(o!=null||l!=null))switch(a){case`value`:p=o;break;case`defaultValue`:c=o;break;case`multiple`:s=o;default:o!==l&&Bd(e,t,a,o,r,l)}t=c,n=s,r=m,p==null?!!r!=!!n&&(t==null?Wt(e,!!n,n?[]:``,!1):Wt(e,!!n,t,!0)):Wt(e,!!n,p,!1);return;case`textarea`:for(c in m=p=null,n)if(a=n[c],n.hasOwnProperty(c)&&a!=null&&!r.hasOwnProperty(c))switch(c){case`value`:break;case`children`:break;default:Bd(e,t,c,null,r,a)}for(s in r)if(a=r[s],o=n[s],r.hasOwnProperty(s)&&(a!=null||o!=null))switch(s){case`value`:p=a;break;case`defaultValue`:m=a;break;case`children`:break;case`dangerouslySetInnerHTML`:if(a!=null)throw Error(i(91));break;default:a!==o&&Bd(e,t,s,a,r,o)}Gt(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:Bd(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:Bd(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)&&Bd(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(i(137,t));break;default:Bd(e,t,u,p,r,m)}return;default:if(Zt(t)){for(var _ in n)p=n[_],n.hasOwnProperty(_)&&p!==void 0&&!r.hasOwnProperty(_)&&Vd(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||Vd(e,t,d,p,r,m);return}}for(var v in n)p=n[v],n.hasOwnProperty(v)&&p!=null&&!r.hasOwnProperty(v)&&Bd(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||Bd(e,t,f,p,r,m)}function Wd(e){switch(e){case`css`:case`script`:case`font`:case`img`:case`image`:case`input`:case`link`:return!0;default:return!1}}function Gd(){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&&Wd(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&&Wd(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 Kd=null,qd=null;function Jd(e){return e.nodeType===9?e:e.ownerDocument}function Yd(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 Xd(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 Zd(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 Qd=null;function $d(){var e=window.event;return e&&e.type===`popstate`?e===Qd?!1:(Qd=e,!0):(Qd=null,!1)}var ef=typeof setTimeout==`function`?setTimeout:void 0,tf=typeof clearTimeout==`function`?clearTimeout:void 0,nf=typeof Promise==`function`?Promise:void 0,rf=typeof queueMicrotask==`function`?queueMicrotask:nf===void 0?ef:function(e){return nf.resolve(null).then(e).catch(af)};function af(e){setTimeout(function(){throw e})}function of(e){return e===`head`}function sf(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),Vp(t);return}r--}else if(n===`$`||n===`$?`||n===`$~`||n===`$!`||n===`&`)r++;else if(n===`html`)xf(e.ownerDocument.documentElement);else if(n===`head`){n=e.ownerDocument.head,xf(n);for(var a=n.firstChild;a;){var o=a.nextSibling,s=a.nodeName;a[ht]||s===`SCRIPT`||s===`STYLE`||s===`LINK`&&a.rel.toLowerCase()===`stylesheet`||n.removeChild(a),a=o}}else n===`body`&&xf(e.ownerDocument.body);n=i}while(n);Vp(t)}function cf(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 lf(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`:lf(n),gt(n);continue;case`SCRIPT`:case`STYLE`:continue;case`LINK`:if(n.rel.toLowerCase()===`stylesheet`)continue}e.removeChild(n)}}function uf(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[ht])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=gf(e.nextSibling),e===null)break}return null}function df(e,t,n){if(t===``)return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!n||(e=gf(e.nextSibling),e===null))return null;return e}function ff(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!==`INPUT`||e.type!==`hidden`)&&!t||(e=gf(e.nextSibling),e===null))return null;return e}function pf(e){return e.data===`$?`||e.data===`$~`}function mf(e){return e.data===`$!`||e.data===`$?`&&e.ownerDocument.readyState!==`loading`}function hf(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 gf(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 _f=null;function vf(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var n=e.data;if(n===`/$`||n===`/&`){if(t===0)return gf(e.nextSibling);t--}else n!==`$`&&n!==`$!`&&n!==`$?`&&n!==`$~`&&n!==`&`||t++}e=e.nextSibling}return null}function yf(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 bf(e,t,n){switch(t=Jd(n),e){case`html`:if(e=t.documentElement,!e)throw Error(i(452));return e;case`head`:if(e=t.head,!e)throw Error(i(453));return e;case`body`:if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function xf(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);gt(e)}var Sf=new Map,Cf=new Set;function wf(e){return typeof e.getRootNode==`function`?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Tf=re.d;re.d={f:Ef,r:Df,D:Af,C:jf,L:Mf,m:Nf,X:Ff,S:Pf,M:If};function Ef(){var e=Tf.f(),t=Tu();return e||t}function Df(e){var t=vt(e);t!==null&&t.tag===5&&t.type===`form`?Es(t):Tf.r(e)}var Of=typeof document>`u`?null:document;function kf(e,t,n){var r=Of;if(r&&typeof t==`string`&&t){var i=Bt(t);i=`link[rel="`+e+`"][href="`+i+`"]`,typeof n==`string`&&(i+=`[crossorigin="`+n+`"]`),Cf.has(i)||(Cf.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement(`link`),Hd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Af(e){Tf.D(e),kf(`dns-prefetch`,e,null)}function jf(e,t){Tf.C(e,t),kf(`preconnect`,e,t)}function Mf(e,t,n){Tf.L(e,t,n);var r=Of;if(r&&e&&t){var i=`link[rel="preload"][as="`+Bt(t)+`"]`;t===`image`&&n&&n.imageSrcSet?(i+=`[imagesrcset="`+Bt(n.imageSrcSet)+`"]`,typeof n.imageSizes==`string`&&(i+=`[imagesizes="`+Bt(n.imageSizes)+`"]`)):i+=`[href="`+Bt(e)+`"]`;var a=i;switch(t){case`style`:a=Rf(e);break;case`script`:a=Hf(e)}Sf.has(a)||(e=p({rel:`preload`,href:t===`image`&&n&&n.imageSrcSet?void 0:e,as:t},n),Sf.set(a,e),r.querySelector(i)!==null||t===`style`&&r.querySelector(zf(a))||t===`script`&&r.querySelector(Uf(a))||(t=r.createElement(`link`),Hd(t,`link`,e),xt(t),r.head.appendChild(t)))}}function Nf(e,t){Tf.m(e,t);var n=Of;if(n&&e){var r=t&&typeof t.as==`string`?t.as:`script`,i=`link[rel="modulepreload"][as="`+Bt(r)+`"][href="`+Bt(e)+`"]`,a=i;switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:a=Hf(e)}if(!Sf.has(a)&&(e=p({rel:`modulepreload`,href:e},t),Sf.set(a,e),n.querySelector(i)===null)){switch(r){case`audioworklet`:case`paintworklet`:case`serviceworker`:case`sharedworker`:case`worker`:case`script`:if(n.querySelector(Uf(a)))return}r=n.createElement(`link`),Hd(r,`link`,e),xt(r),n.head.appendChild(r)}}}function Pf(e,t,n){Tf.S(e,t,n);var r=Of;if(r&&e){var i=bt(r).hoistableStyles,a=Rf(e);t||=`default`;var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(zf(a)))s.loading=5;else{e=p({rel:`stylesheet`,href:e,"data-precedence":t},n),(n=Sf.get(a))&&Kf(e,n);var c=o=r.createElement(`link`);xt(c),Hd(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,Gf(o,t,r)}o={type:`stylesheet`,instance:o,count:1,state:s},i.set(a,o)}}}function Ff(e,t){Tf.X(e,t);var n=Of;if(n&&e){var r=bt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=p({src:e,async:!0},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),xt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function If(e,t){Tf.M(e,t);var n=Of;if(n&&e){var r=bt(n).hoistableScripts,i=Hf(e),a=r.get(i);a||(a=n.querySelector(Uf(i)),a||(e=p({src:e,async:!0,type:`module`},t),(t=Sf.get(i))&&qf(e,t),a=n.createElement(`script`),xt(a),Hd(a,`link`,e),n.head.appendChild(a)),a={type:`script`,instance:a,count:1,state:null},r.set(i,a))}}function Lf(e,t,n,r){var a=(a=fe.current)?wf(a):null;if(!a)throw Error(i(446));switch(e){case`meta`:case`title`:return null;case`style`:return typeof n.precedence==`string`&&typeof n.href==`string`?(t=Rf(n.href),n=bt(a).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=Rf(n.href);var o=bt(a).hoistableStyles,s=o.get(e);if(s||(a=a.ownerDocument||a,s={type:`stylesheet`,instance:null,count:0,state:{loading:0,preload:null}},o.set(e,s),(o=a.querySelector(zf(e)))&&!o._p&&(s.instance=o,s.state.loading=5),Sf.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},Sf.set(e,n),o||Vf(a,e,n,s.state))),t&&r===null)throw Error(i(528,``));return s}if(t&&r!==null)throw Error(i(529,``));return null;case`script`:return t=n.async,n=n.src,typeof n==`string`&&t&&typeof t!=`function`&&typeof t!=`symbol`?(t=Hf(n),n=bt(a).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(i(444,e))}}function Rf(e){return`href="`+Bt(e)+`"`}function zf(e){return`link[rel="stylesheet"][`+e+`]`}function Bf(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function Vf(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}),Hd(t,`link`,n),xt(t),e.head.appendChild(t))}function Hf(e){return`[src="`+Bt(e)+`"]`}function Uf(e){return`script[async]`+e}function Wf(e,t,n){if(t.count++,t.instance===null)switch(t.type){case`style`:var r=e.querySelector(`style[data-href~="`+Bt(n.href)+`"]`);if(r)return t.instance=r,xt(r),r;var a=p({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement(`style`),xt(r),Hd(r,`style`,a),Gf(r,n.precedence,e),t.instance=r;case`stylesheet`:a=Rf(n.href);var o=e.querySelector(zf(a));if(o)return t.state.loading|=4,t.instance=o,xt(o),o;r=Bf(n),(a=Sf.get(a))&&Kf(r,a),o=(e.ownerDocument||e).createElement(`link`),xt(o);var s=o;return s._p=new Promise(function(e,t){s.onload=e,s.onerror=t}),Hd(o,`link`,r),t.state.loading|=4,Gf(o,n.precedence,e),t.instance=o;case`script`:return o=Hf(n.src),(a=e.querySelector(Uf(o)))?(t.instance=a,xt(a),a):(r=n,(a=Sf.get(o))&&(r=p({},n),qf(r,a)),e=e.ownerDocument||e,a=e.createElement(`script`),xt(a),Hd(a,`link`,r),e.head.appendChild(a),t.instance=a);case`void`:return null;default:throw Error(i(443,t.type))}else t.type===`stylesheet`&&!(t.state.loading&4)&&(r=t.instance,t.state.loading|=4,Gf(r,n.precedence,e));return t.instance}function Gf(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 Kf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.title??=t.title}function qf(e,t){e.crossOrigin??=t.crossOrigin,e.referrerPolicy??=t.referrerPolicy,e.integrity??=t.integrity}var Jf=null;function Yf(e,t,n){if(Jf===null){var r=new Map,i=Jf=new Map;i.set(n,r)}else i=Jf,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[ht]||a[lt]||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 Xf(e,t,n){e=e.ownerDocument||e,e.head.insertBefore(n,t===`title`?e.querySelector(`head > title`):null)}function Zf(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 Qf(e){return!(e.type===`stylesheet`&&!(e.state.loading&3))}function $f(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=Rf(r.href),a=t.querySelector(zf(i));if(a){t=a._p,typeof t==`object`&&t&&typeof t.then==`function`&&(e.count++,e=np.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,xt(a);return}a=t.ownerDocument||t,r=Bf(r),(i=Sf.get(i))&&Kf(r,i),a=a.createElement(`link`),xt(a);var o=a;o._p=new Promise(function(e,t){o.onload=e,o.onerror=t}),Hd(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=np.bind(e),t.addEventListener(`load`,n),t.addEventListener(`error`,n))}}var ep=0;function tp(e,t){return e.stylesheets&&e.count===0&&ip(e,e.stylesheets),0<e.count||0<e.imgCount?function(n){var r=setTimeout(function(){if(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend){var t=e.unsuspend;e.unsuspend=null,t()}},6e4+t);0<e.imgBytes&&ep===0&&(ep=62500*Gd());var i=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&ip(e,e.stylesheets),e.unsuspend)){var t=e.unsuspend;e.unsuspend=null,t()}},(e.imgBytes>ep?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function np(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)ip(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var rp=null;function ip(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,rp=new Map,t.forEach(ap,e),rp=null,np.call(e))}function ap(e,t){if(!(t.state.loading&4)){var n=rp.get(e);if(n)var r=n.get(null);else{n=new Map,rp.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=np.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 op={$$typeof:x,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function sp(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=Qe(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qe(0),this.hiddenUpdates=Qe(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 cp(e,t,n,r,i,a,o,s,c,l,u,d){return e=new sp(e,t,n,o,c,l,u,d,s),t=1,!0===a&&(t|=24),a=ci(3,null,null,t),e.current=a,a.stateNode=e,t=sa(),t.refCount++,e.pooledCache=t,t.refCount++,a.memoizedState={element:r,isDehydrated:n,cache:t},Ba(a),e}function lp(e){return e?(e=oi,e):oi}function up(e,t,n,r,i,a){i=lp(i),r.context===null?r.context=i:r.pendingContext=i,r=Ha(t),r.payload={element:n},a=a===void 0?null:a,a!==null&&(r.callback=a),n=Ua(e,r,t),n!==null&&(bu(n,e,t),Wa(n,e,t))}function dp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var n=e.retryLane;e.retryLane=n!==0&&n<t?n:t}}function fp(e,t){dp(e,t),(e=e.alternate)&&dp(e,t)}function pp(e){if(e.tag===13||e.tag===31){var t=ri(e,67108864);t!==null&&bu(t,e,67108864),fp(e,67108864)}}function mp(e){if(e.tag===13||e.tag===31){var t=vu();t=it(t);var n=ri(e,t);n!==null&&bu(n,e,t),fp(e,t)}}var hp=!0;function gp(e,t,n,r){var i=j.T;j.T=null;var a=re.p;try{re.p=2,vp(e,t,n,r)}finally{re.p=a,j.T=i}}function _p(e,t,n,r){var i=j.T;j.T=null;var a=re.p;try{re.p=8,vp(e,t,n,r)}finally{re.p=a,j.T=i}}function vp(e,t,n,r){if(hp){var i=yp(r);if(i===null)jd(e,t,r,bp,n),jp(e,r);else if(Np(i,e,t,n,r))r.stopPropagation();else if(jp(e,r),t&4&&-1<Ap.indexOf(e)){for(;i!==null;){var a=vt(i);if(a!==null)switch(a.tag){case 3:if(a=a.stateNode,a.current.memoizedState.isDehydrated){var o=qe(a.pendingLanes);if(o!==0){var s=a;for(s.pendingLanes|=2,s.entangledLanes|=2;o;){var c=1<<31-Be(o);s.entanglements[1]|=c,o&=~c}ld(a),!(zl&6)&&(ou=Oe()+500,ud(0,!1))}}break;case 31:case 13:s=ri(a,2),s!==null&&bu(s,a,2),Tu(),fp(a,2)}if(a=yp(r),a===null&&jd(e,t,r,bp,n),a===i)break;i=a}i!==null&&r.stopPropagation()}else jd(e,t,r,null,n)}}function yp(e){return e=rn(e),xp(e)}var bp=null;function xp(e){if(bp=null,e=_t(e),e!==null){var t=o(e);if(t===null)e=null;else{var n=t.tag;if(n===13){if(e=c(t),e!==null)return e;e=null}else if(n===31){if(e=l(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 bp=e,null}function Sp(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(ke()){case Ae:return 2;case je:return 8;case Me:case Ne:return 32;case Pe:return 268435456;default:return 32}default:return 32}}var Cp=!1,wp=null,Tp=null,Ep=null,Dp=new Map,Op=new Map,kp=[],Ap=`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 jp(e,t){switch(e){case`focusin`:case`focusout`:wp=null;break;case`dragenter`:case`dragleave`:Tp=null;break;case`mouseover`:case`mouseout`:Ep=null;break;case`pointerover`:case`pointerout`:Dp.delete(t.pointerId);break;case`gotpointercapture`:case`lostpointercapture`:Op.delete(t.pointerId)}}function Mp(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=vt(t),t!==null&&pp(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,i!==null&&t.indexOf(i)===-1&&t.push(i),e)}function Np(e,t,n,r,i){switch(t){case`focusin`:return wp=Mp(wp,e,t,n,r,i),!0;case`dragenter`:return Tp=Mp(Tp,e,t,n,r,i),!0;case`mouseover`:return Ep=Mp(Ep,e,t,n,r,i),!0;case`pointerover`:var a=i.pointerId;return Dp.set(a,Mp(Dp.get(a)||null,e,t,n,r,i)),!0;case`gotpointercapture`:return a=i.pointerId,Op.set(a,Mp(Op.get(a)||null,e,t,n,r,i)),!0}return!1}function Pp(e){var t=_t(e.target);if(t!==null){var n=o(t);if(n!==null){if(t=n.tag,t===13){if(t=c(n),t!==null){e.blockedOn=t,st(e.priority,function(){mp(n)});return}}else if(t===31){if(t=l(n),t!==null){e.blockedOn=t,st(e.priority,function(){mp(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 Fp(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var n=yp(e.nativeEvent);if(n===null){n=e.nativeEvent;var r=new n.constructor(n.type,n);nn=r,n.target.dispatchEvent(r),nn=null}else return t=vt(n),t!==null&&pp(t),e.blockedOn=n,!1;t.shift()}return!0}function Ip(e,t,n){Fp(e)&&n.delete(t)}function Lp(){Cp=!1,wp!==null&&Fp(wp)&&(wp=null),Tp!==null&&Fp(Tp)&&(Tp=null),Ep!==null&&Fp(Ep)&&(Ep=null),Dp.forEach(Ip),Op.forEach(Ip)}function Rp(e,n){e.blockedOn===n&&(e.blockedOn=null,Cp||(Cp=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Lp)))}var zp=null;function Bp(e){zp!==e&&(zp=e,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){zp===e&&(zp=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(xp(r||n)===null)continue;break}var a=vt(n);a!==null&&(e.splice(t,3),t-=3,ws(a,{pending:!0,data:i,method:n.method,action:r},r,i))}}))}function Vp(e){function t(t){return Rp(t,e)}wp!==null&&Rp(wp,e),Tp!==null&&Rp(Tp,e),Ep!==null&&Rp(Ep,e),Dp.forEach(t),Op.forEach(t);for(var n=0;n<kp.length;n++){var r=kp[n];r.blockedOn===e&&(r.blockedOn=null)}for(;0<kp.length&&(n=kp[0],n.blockedOn===null);)Pp(n),n.blockedOn===null&&kp.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[P]||null;if(typeof a==`function`)o||Bp(n);else if(o){var s=null;if(a&&a.hasAttribute(`formAction`)){if(i=a,o=a[P]||null)s=o.formAction;else if(xp(i)!==null)continue}else s=o.action;typeof s==`function`?n[r+1]=s:(n.splice(r,3),r-=3),Bp(n)}}}function Hp(){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 Up(e){this._internalRoot=e}Wp.prototype.render=Up.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var n=t.current;up(n,vu(),e,t,null,null)},Wp.prototype.unmount=Up.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;up(e.current,2,null,e,null,null),Tu(),t[ut]=null}};function Wp(e){this._internalRoot=e}Wp.prototype.unstable_scheduleHydration=function(e){if(e){var t=ot();e={blockedOn:null,target:e,priority:t};for(var n=0;n<kp.length&&t!==0&&t<kp[n].priority;n++);kp.splice(n,0,e),n===0&&Pp(e)}};var Gp=n.version;if(Gp!==`19.2.0`)throw Error(i(527,Gp,`19.2.0`));re.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render==`function`?Error(i(188)):(e=Object.keys(e).join(`,`),Error(i(268,e)));return e=d(t),e=e===null?null:f(e),e=e===null?null:e.stateNode,e};var Kp={bundleType:0,version:`19.2.0`,rendererPackageName:`react-dom`,currentDispatcherRef:j,reconcilerVersion:`19.2.0`};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<`u`){var qp=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!qp.isDisabled&&qp.supportsFiber)try{Le=qp.inject(Kp),Re=qp}catch{}}e.createRoot=function(e,t){if(!a(e))throw Error(i(299));var n=!1,r=``,o=qs,s=Js,c=Ys;return t!=null&&(!0===t.unstable_strictMode&&(n=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(s=t.onCaughtError),t.onRecoverableError!==void 0&&(c=t.onRecoverableError)),t=cp(e,1,!1,null,null,n,r,null,o,s,c,Hp),e[ut]=t.current,kd(e),new Up(t)}})),mc=t(((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=pc()}))(),H=e(s(),1);function hc(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=hc(e[t]))&&(r&&(r+=` `),r+=n);else for(t in e)e[t]&&(r&&(r+=` `),r+=t);return r}function U(){for(var e=0,t,n,r=``;e<arguments.length;)(t=arguments[e++])&&(n=hc(t))&&(r&&(r+=` `),r+=n);return r}var gc=e(t(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=S(t)||0,y(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(S(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function v(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function x(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(x(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=x(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return v(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e,t,r){var i=!0,a=!0;if(typeof e!=`function`)throw TypeError(n);return y(r)&&(i=`leading`in r?!!r.leading:i,a=`trailing`in r?!!r.trailing:a),_(e,t,{leading:i,maxWait:t,trailing:a})}function y(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function b(e){return!!e&&typeof e==`object`}function x(e){return typeof e==`symbol`||b(e)&&p.call(e)==i}function S(e){if(typeof e==`number`)return e;if(x(e))return r;if(y(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=y(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=v}))(),1),_c=e(fc(),1),W=c(),vc=0;function yc(e,t){let n=`atom${++vc}`,r={toString(){return n}};return typeof e==`function`?r.read=e:(r.init=e,r.read=bc,r.write=xc),t&&(r.write=t),r}function bc(e){return e(this)}function xc(e,t,n){return t(this,typeof n==`function`?n(e(this)):n)}var Sc=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,Cc=e=>`init`in e,wc=e=>!!e.write,Tc=new WeakMap,Ec=e=>kc(e)&&!Tc.get(e)?.[1],Dc=(e,t)=>{let n=Tc.get(e);n&&(n[1]=!0,n[0].forEach(e=>e(t)))},Oc=e=>{if(Tc.has(e))return;let t=[new Set,!1];Tc.set(e,t);let n=()=>{t[1]=!0};e.then(n,n),e.onCancel=e=>{t[0].add(e)}},kc=e=>typeof e?.then==`function`,Ac=e=>`v`in e||`e`in e,jc=e=>{if(`e`in e)throw e.e;return e.v},Mc=(e,t,n)=>{n.p.has(e)||(n.p.add(e),t.then(()=>{n.p.delete(e)},()=>{n.p.delete(e)}))},Nc=(e,t,n,r,i)=>{var a;n.d.set(r,i.n),Ec(n.v)&&Mc(t,n.v,i),(a=i.m)==null||a.t.add(t),e&&Lc(e,r,t)},Pc=()=>({D:new Map,H:new Set,M:new Set,L:new Set}),Fc=(e,t,n)=>{e[t].add(n)},Ic=(e,t,n)=>{e.D.has(t)||(e.D.set(t,new Set),Fc(e,`M`,()=>{var t;(t=n.m)==null||t.l.forEach(t=>Fc(e,`M`,t))}))},Lc=(e,t,n)=>{let r=e.D.get(t);r&&r.add(n)},Rc=(e,t)=>e.D.get(t),zc=e=>{let t,n=!1,r=e=>{try{e()}catch(e){n||=(t=e,!0)}};for(;e.H.size||e.M.size||e.L.size;)e.D.clear(),e.H.forEach(r),e.H.clear(),e.M.forEach(r),e.M.clear(),e.L.forEach(r),e.L.clear();if(n)throw t},Bc=(...[e,t,n,r])=>{let i=(t,n,r)=>{let i=`v`in n,a=n.v,o=Ec(n.v)?n.v:null;if(kc(r)){Oc(r);for(let i of n.d.keys())Mc(t,r,e(i));n.v=r}else n.v=r;delete n.e,delete n.x,(!i||!Object.is(a,n.v))&&(++n.n,o&&Dc(o,r))},a=(n,r)=>{var o;let s=e(r);if(Ac(s)&&(s.m&&!s.x||Array.from(s.d).every(([e,t])=>a(n,e).n===t)))return s;s.d.clear();let c=!0,l=t=>{if(Sc(r,t)){let n=e(t);if(!Ac(n))if(Cc(t))i(t,n,t.init);else throw Error(`no atom init`);return jc(n)}let o=a(n,t);try{return jc(o)}finally{if(c)Nc(n,r,s,t,o);else{let e=Pc();Nc(e,r,s,t,o),d(e,r,s),zc(e)}}},f,p,m={get signal(){return f||=new AbortController,f.signal},get setSelf(){return!p&&wc(r)&&(p=(...e)=>{if(!c)return u(r,...e)}),p}};try{let e=t(r,l,m);if(i(r,s,e),kc(e)){(o=e.onCancel)==null||o.call(e,()=>f?.abort());let t=()=>{if(s.m){let e=Pc();d(e,r,s),zc(e)}};e.then(t,t)}return s}catch(e){return delete s.v,s.e=e,delete s.x,++s.n,s}finally{c=!1}},o=e=>jc(a(void 0,e)),s=(t,n,r)=>{var i;let a=new Map;for(let t of r.m?.t||[]){let n=e(t);n.m&&a.set(t,n)}for(let t of r.p)a.set(t,e(t));return(i=Rc(t,n))==null||i.forEach(t=>{a.set(t,e(t))}),a},c=(e,t,n)=>{let r=[],i=new Set,o=new Set,c=[[t,n]];for(;c.length>0;){let[t,n]=c[c.length-1];if(o.has(t)){c.pop();continue}if(i.has(t)){r.push([t,n,n.n]),o.add(t),n.x=!0,c.pop();continue}i.add(t);for(let[r,a]of s(e,t,n))t!==r&&!i.has(r)&&c.push([r,a])}Fc(e,`H`,()=>{let n=new Set([t]);for(let t=r.length-1;t>=0;--t){let[i,o,s]=r[t],c=!1;for(let e of o.d.keys())if(e!==i&&n.has(e)){c=!0;break}c&&(a(e,i),d(e,i,o),s!==o.n&&(Ic(e,i,o),n.add(i))),delete o.x}})},l=(t,r,...o)=>{let s=!0,u=e=>jc(a(t,e)),f=(n,...a)=>{let o=e(n);try{if(Sc(r,n)){if(!Cc(n))throw Error(`atom not writable`);let e=o.n,r=a[0];i(n,o,r),d(t,n,o),e!==o.n&&(Ic(t,n,o),c(t,n,o));return}else return l(t,n,...a)}finally{s||zc(t)}};try{return n(r,u,f,...o)}finally{s=!1}},u=(e,...t)=>{let n=Pc();try{return l(n,e,...t)}finally{zc(n)}},d=(t,n,r)=>{if(r.m&&!Ec(r.v)){for(let i of r.d.keys())r.m.d.has(i)||(f(t,i,e(i)).t.add(n),r.m.d.add(i));for(let i of r.m.d||[])r.d.has(i)||(r.m.d.delete(i),p(t,i,e(i))?.t.delete(n))}},f=(t,n,i)=>{if(!i.m){a(t,n);for(let r of i.d.keys())f(t,r,e(r)).t.add(n);if(i.m={l:new Set,d:new Set(i.d.keys()),t:new Set},wc(n)){let e=i.m,a,o=(e,t)=>{let r=!0;a=(...t)=>{try{return l(e,n,...t)}finally{r||zc(e)}};try{return t()}finally{r=!1}};Fc(t,`L`,()=>{let i=o(t,()=>r(n,(...e)=>a(...e)));i&&(e.u=e=>o(e,i))})}}return i.m},p=(t,n,r)=>{if(r.m&&!r.m.l.size&&!Array.from(r.m.t).some(t=>e(t).m?.d.has(n))){let i=r.m.u;i&&Fc(t,`L`,()=>i(t)),delete r.m;for(let i of r.d.keys())p(t,i,e(i))?.t.delete(n);return}return r.m};return{get:o,set:u,sub:(t,n)=>{let r=Pc(),i=e(t),a=f(r,t,i).l;return a.add(n),zc(r),()=>{a.delete(n);let e=Pc();p(e,t,i),zc(e)}},unstable_derive:i=>Bc(...i(e,t,n,r))}},Vc=()=>{let e=new WeakMap;return Bc(t=>{let n=e.get(t);return n||(n={d:new Map,p:new Set,n:0},e.set(t,n)),n},(e,...t)=>e.read(...t),(e,...t)=>e.write(...t),(e,...t)=>e.onMount?.call(e,...t))},Hc,Uc=()=>(Hc||=Vc(),Hc),Wc=(0,H.createContext)(void 0),Gc=e=>{let t=(0,H.useContext)(Wc);return e?.store||t||Uc()},Kc=e=>typeof e?.then==`function`,qc=e=>{e.status=`pending`,e.then(t=>{e.status=`fulfilled`,e.value=t},t=>{e.status=`rejected`,e.reason=t})},Jc=H.use||(e=>{if(e.status===`pending`)throw e;if(e.status===`fulfilled`)return e.value;throw e.status===`rejected`?e.reason:(qc(e),e)}),Yc=new WeakMap,Xc=e=>{let t=Yc.get(e);return t||(t=new Promise((n,r)=>{let i=e,a=e=>t=>{i===e&&n(t)},o=e=>t=>{i===e&&r(t)},s=e=>{`onCancel`in e&&typeof e.onCancel==`function`&&e.onCancel(e=>{Kc(e)?(Yc.set(e,t),i=e,e.then(a(e),o(e)),s(e)):n(e)})};e.then(a(e),o(e)),s(e)}),Yc.set(e,t)),t};function Zc(e,t){let n=Gc(t),[[r,i,a],o]=(0,H.useReducer)(t=>{let r=n.get(e);return Object.is(t[0],r)&&t[1]===n&&t[2]===e?t:[r,n,e]},void 0,()=>[n.get(e),n,e]),s=r;(i!==n||a!==e)&&(o(),s=n.get(e));let c=t?.delay;return(0,H.useEffect)(()=>{let t=n.sub(e,()=>{if(typeof c==`number`){let t=n.get(e);Kc(t)&&qc(Xc(t)),setTimeout(o,c);return}o()});return o(),t},[n,e,c]),(0,H.useDebugValue)(s),Kc(s)?Jc(Xc(s)):s}function Qc(e,t){let n=Gc(t);return(0,H.useCallback)((...t)=>n.set(e,...t),[n,e])}function $c(e,t){return[Zc(e,t),Qc(e,t)]}var el=new WeakMap;function tl(e,t){let n=Gc(t),r=nl(n);for(let[i,a]of e)(!r.has(i)||t?.dangerouslyForceHydrate)&&(r.add(i),n.set(i,a))}var nl=e=>{let t=el.get(e);return t||(t=new WeakSet,el.set(e,t)),t};function rl(){return rl=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},rl.apply(this,arguments)}function il(){let e=(0,H.createContext)(null);function t({store:t,initialValues:n=[],children:r}){let i=(0,H.useRef)(t);return i.current||=Vc(),tl(n,{store:i.current}),(0,W.jsx)(e.Provider,{value:i.current,children:r})}let n=t=>{let n=(0,H.useContext)(e);if(!n)throw Error(`Missing Provider from createIsolation`);return Gc(rl({store:n},t))};return{Provider:t,useStore:n,useAtom:(e,t)=>{let r=n();return $c(e,rl({store:r},t))},useAtomValue:(e,t)=>{let r=n();return Zc(e,rl({store:r},t))},useSetAtom:(e,t)=>{let r=n();return Qc(e,rl({store:r},t))}}}var{read:al,write:ol}=yc(null);(0,H.createContext)({scope:void 0,baseStore:void 0});function sl(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function cl(...e){return t=>{let n=!1,r=e.map(e=>{let r=sl(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():sl(e[t],null)}}}}function ll(...e){return H.useCallback(cl(...e),e)}function ul(e){let t=dl(e),n=H.forwardRef((e,n)=>{let{children:r,...i}=e,a=H.Children.toArray(r),o=a.find(pl);if(o){let e=o.props.children,r=a.map(t=>t===o?H.Children.count(e)>1?H.Children.only(null):H.isValidElement(e)?e.props.children:null:t);return(0,W.jsx)(t,{...i,ref:n,children:H.isValidElement(e)?H.cloneElement(e,void 0,r):null})}return(0,W.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function dl(e){let t=H.forwardRef((e,t)=>{let{children:n,...r}=e;if(H.isValidElement(n)){let e=hl(n),i=ml(r,n.props);return n.type!==H.Fragment&&(i.ref=t?cl(t,e):e),H.cloneElement(n,i)}return H.Children.count(n)>1?H.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var fl=Symbol(`radix.slottable`);function pl(e){return H.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===fl}function ml(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function hl(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var gl=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ul(`Primitive.${t}`),r=H.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,W.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _l(e,t){e&&_c.flushSync(()=>e.dispatchEvent(t))}function vl(e,t=[]){let n=[];function r(t,r){let i=H.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=H.useMemo(()=>o,Object.values(o));return(0,W.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=H.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>H.createContext(e));return function(n){let r=n?.[e]||t;return H.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,yl(i,...t)]}function yl(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return H.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function bl(e){let t=e+`CollectionProvider`,[n,r]=vl(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=H.useRef(null),a=H.useRef(new Map).current;return(0,W.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=ul(s),l=H.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,W.jsx)(c,{ref:ll(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=ul(u),p=H.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=H.useRef(null),s=ll(t,o),c=a(u,n);return H.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,W.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return H.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}typeof window<`u`&&window.document&&window.document.createElement;function G(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}var xl=globalThis?.document?H.useLayoutEffect:()=>{},Sl=H.useInsertionEffect||xl;function Cl({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=wl({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=H.useRef(e!==void 0);H.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,H.useCallback(t=>{if(s){let n=Tl(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function wl({defaultProp:e,onChange:t}){let[n,r]=H.useState(e),i=H.useRef(n),a=H.useRef(t);return Sl(()=>{a.current=t},[t]),H.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function Tl(e){return typeof e==`function`}function El(e,t){return H.useReducer((e,n)=>t[e][n]??e,e)}var Dl=e=>{let{present:t,children:n}=e,r=Ol(t),i=typeof n==`function`?n({present:r.isPresent}):H.Children.only(n),a=ll(r.ref,Al(i));return typeof n==`function`||r.isPresent?H.cloneElement(i,{ref:a}):null};Dl.displayName=`Presence`;function Ol(e){let[t,n]=H.useState(),r=H.useRef(null),i=H.useRef(e),a=H.useRef(`none`),[o,s]=El(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return H.useEffect(()=>{let e=kl(r.current);a.current=o===`mounted`?e:`none`},[o]),xl(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=kl(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),xl(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=kl(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=kl(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:H.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function kl(e){return e?.animationName||`none`}function Al(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var jl=H.useId||(()=>void 0),Ml=0;function Nl(e){let[t,n]=H.useState(jl());return xl(()=>{e||n(e=>e??String(Ml++))},[e]),e||(t?`radix-${t}`:``)}var Pl=H.createContext(void 0);function Fl(e){let t=H.useContext(Pl);return e||t||`ltr`}function Il(e){let t=H.useRef(e);return H.useEffect(()=>{t.current=e}),H.useMemo(()=>(...e)=>t.current?.(...e),[])}function Ll(e,t=globalThis?.document){let n=Il(e);H.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Rl=`DismissableLayer`,zl=`dismissableLayer.update`,Bl=`dismissableLayer.pointerDownOutside`,Vl=`dismissableLayer.focusOutside`,Hl,Ul=H.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Wl=H.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=H.useContext(Ul),[u,d]=H.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=H.useState({}),m=ll(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=ql(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=Jl(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return Ll(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),H.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Hl=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Yl(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Hl)}},[u,f,n,l]),H.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Yl())},[u,l]),H.useEffect(()=>{let e=()=>p({});return document.addEventListener(zl,e),()=>document.removeEventListener(zl,e)},[]),(0,W.jsx)(gl.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:G(e.onFocusCapture,S.onFocusCapture),onBlurCapture:G(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:G(e.onPointerDownCapture,x.onPointerDownCapture)})});Wl.displayName=Rl;var Gl=`DismissableLayerBranch`,Kl=H.forwardRef((e,t)=>{let n=H.useContext(Ul),r=H.useRef(null),i=ll(t,r);return H.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,W.jsx)(gl.div,{...e,ref:i})});Kl.displayName=Gl;function ql(e,t=globalThis?.document){let n=Il(e),r=H.useRef(!1),i=H.useRef(()=>{});return H.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Xl(Bl,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Jl(e,t=globalThis?.document){let n=Il(e),r=H.useRef(!1);return H.useEffect(()=>{let e=e=>{e.target&&!r.current&&Xl(Vl,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Yl(){let e=new CustomEvent(zl);document.dispatchEvent(e)}function Xl(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?_l(i,a):i.dispatchEvent(a)}var Zl=`focusScope.autoFocusOnMount`,Ql=`focusScope.autoFocusOnUnmount`,$l={bubbles:!1,cancelable:!0},eu=`FocusScope`,tu=H.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=H.useState(null),l=Il(i),u=Il(a),d=H.useRef(null),f=ll(t,e=>c(e)),p=H.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;H.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:cu(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||cu(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&cu(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),H.useEffect(()=>{if(s){lu.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Zl,$l);s.addEventListener(Zl,l),s.dispatchEvent(t),t.defaultPrevented||(nu(fu(iu(s)),{select:!0}),document.activeElement===e&&cu(s))}return()=>{s.removeEventListener(Zl,l),setTimeout(()=>{let t=new CustomEvent(Ql,$l);s.addEventListener(Ql,u),s.dispatchEvent(t),t.defaultPrevented||cu(e??document.body,{select:!0}),s.removeEventListener(Ql,u),lu.remove(p)},0)}}},[s,l,u,p]);let m=H.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=ru(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&cu(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&cu(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,W.jsx)(gl.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});tu.displayName=eu;function nu(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(cu(r,{select:t}),document.activeElement!==n)return}function ru(e){let t=iu(e);return[au(t,e),au(t.reverse(),e)]}function iu(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function au(e,t){for(let n of e)if(!ou(n,{upTo:t}))return n}function ou(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function su(e){return e instanceof HTMLInputElement&&`select`in e}function cu(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&su(e)&&t&&e.select()}}var lu=uu();function uu(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=du(e,t),e.unshift(t)},remove(t){e=du(e,t),e[0]?.resume()}}}function du(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function fu(e){return e.filter(e=>e.tagName!==`A`)}var pu=`Portal`,mu=H.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=H.useState(!1);xl(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?_c.createPortal((0,W.jsx)(gl.div,{...r,ref:t}),o):null});mu.displayName=pu;var hu=0;function gu(){H.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??_u()),document.body.insertAdjacentElement(`beforeend`,e[1]??_u()),hu++,()=>{hu===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),hu--}},[])}function _u(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var vu=function(){return vu=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},vu.apply(this,arguments)};function yu(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function bu(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var xu=`right-scroll-bar-position`,Su=`width-before-scroll-bar`,Cu=`with-scroll-bars-hidden`,wu=`--removed-body-scroll-bar-size`;function Tu(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function Eu(e,t){var n=(0,H.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var Du=typeof window<`u`?H.useLayoutEffect:H.useEffect,Ou=new WeakMap;function ku(e,t){var n=Eu(t||null,function(t){return e.forEach(function(e){return Tu(e,t)})});return Du(function(){var t=Ou.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||Tu(e,null)}),i.forEach(function(e){r.has(e)||Tu(e,a)})}Ou.set(n,e)},[e]),n}function Au(e){return e}function ju(e,t){t===void 0&&(t=Au);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function Mu(e){e===void 0&&(e={});var t=ju(null);return t.options=vu({async:!0,ssr:!1},e),t}var Nu=function(e){var t=e.sideCar,n=yu(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return H.createElement(r,vu({},n))};Nu.isSideCarExport=!0;function Pu(e,t){return e.useMedium(t),Nu}var Fu=Mu(),Iu=function(){},Lu=H.forwardRef(function(e,t){var n=H.useRef(null),r=H.useState({onScrollCapture:Iu,onWheelCapture:Iu,onTouchMoveCapture:Iu}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=yu(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=ku([n,t]),C=vu(vu({},b),i);return H.createElement(H.Fragment,null,u&&H.createElement(x,{sideCar:Fu,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?H.cloneElement(H.Children.only(s),vu(vu({},C),{ref:S})):H.createElement(v,vu({},C,{className:c,ref:S}),s))});Lu.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Lu.classNames={fullWidth:Su,zeroRight:xu};var Ru,zu=function(){if(Ru)return Ru;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function Bu(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=zu();return t&&e.setAttribute(`nonce`,t),e}function Vu(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Hu(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var Uu=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Bu())&&(Vu(t,n),Hu(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Wu=function(){var e=Uu();return function(t,n){H.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Gu=function(){var e=Wu();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},Ku={left:0,top:0,right:0,gap:0},qu=function(e){return parseInt(e||``,10)||0},Ju=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[qu(n),qu(r),qu(i)]},Yu=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return Ku;var t=Ju(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Xu=Gu(),Zu=`data-scroll-locked`,Qu=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
|
|
11
|
+
.${Cu} {
|
|
12
|
+
overflow: hidden ${r};
|
|
13
|
+
padding-right: ${s}px ${r};
|
|
14
|
+
}
|
|
15
|
+
body[${Zu}] {
|
|
16
|
+
overflow: hidden ${r};
|
|
17
|
+
overscroll-behavior: contain;
|
|
18
|
+
${[t&&`position: relative ${r};`,n===`margin`&&`
|
|
19
|
+
padding-left: ${i}px;
|
|
20
|
+
padding-top: ${a}px;
|
|
21
|
+
padding-right: ${o}px;
|
|
22
|
+
margin-left:0;
|
|
23
|
+
margin-top:0;
|
|
24
|
+
margin-right: ${s}px ${r};
|
|
25
|
+
`,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.${xu} {
|
|
29
|
+
right: ${s}px ${r};
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.${Su} {
|
|
33
|
+
margin-right: ${s}px ${r};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.${xu} .${xu} {
|
|
37
|
+
right: 0 ${r};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.${Su} .${Su} {
|
|
41
|
+
margin-right: 0 ${r};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
body[${Zu}] {
|
|
45
|
+
${wu}: ${s}px;
|
|
46
|
+
}
|
|
47
|
+
`},$u=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ed=function(){H.useEffect(function(){return document.body.setAttribute(Zu,($u()+1).toString()),function(){var e=$u()-1;e<=0?document.body.removeAttribute(Zu):document.body.setAttribute(Zu,e.toString())}},[])},td=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ed();var a=H.useMemo(function(){return Yu(i)},[i]);return H.createElement(Xu,{styles:Qu(a,!t,i,n?``:`!important`)})},nd=!1;if(typeof window<`u`)try{var rd=Object.defineProperty({},`passive`,{get:function(){return nd=!0,!0}});window.addEventListener(`test`,rd,rd),window.removeEventListener(`test`,rd,rd)}catch{nd=!1}var id=nd?{passive:!1}:!1,ad=function(e){return e.tagName===`TEXTAREA`},od=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!ad(e)&&n[t]===`visible`)},sd=function(e){return od(e,`overflowY`)},cd=function(e){return od(e,`overflowX`)},ld=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),fd(e,r)){var i=pd(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ud=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},dd=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},fd=function(e,t){return e===`v`?sd(t):cd(t)},pd=function(e,t){return e===`v`?ud(t):dd(t)},md=function(e,t){return e===`h`&&t===`rtl`?-1:1},hd=function(e,t,n,r,i){var a=md(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=pd(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&fd(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},gd=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},_d=function(e){return[e.deltaX,e.deltaY]},vd=function(e){return e&&`current`in e?e.current:e},yd=function(e,t){return e[0]===t[0]&&e[1]===t[1]},bd=function(e){return`
|
|
48
|
+
.block-interactivity-${e} {pointer-events: none;}
|
|
49
|
+
.allow-interactivity-${e} {pointer-events: all;}
|
|
50
|
+
`},xd=0,Sd=[];function Cd(e){var t=H.useRef([]),n=H.useRef([0,0]),r=H.useRef(),i=H.useState(xd++)[0],a=H.useState(Gu)[0],o=H.useRef(e);H.useEffect(function(){o.current=e},[e]),H.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=bu([e.lockRef.current],(e.shards||[]).map(vd),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=H.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=gd(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=ld(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=ld(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return hd(h,t,e,h===`h`?s:c,!0)},[]),c=H.useCallback(function(e){var n=e;if(!(!Sd.length||Sd[Sd.length-1]!==a)){var r=`deltaY`in n?_d(n):gd(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&yd(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(vd).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=H.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:wd(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=H.useCallback(function(e){n.current=gd(e),r.current=void 0},[]),d=H.useCallback(function(t){l(t.type,_d(t),t.target,s(t,e.lockRef.current))},[]),f=H.useCallback(function(t){l(t.type,gd(t),t.target,s(t,e.lockRef.current))},[]);H.useEffect(function(){return Sd.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,id),document.addEventListener(`touchmove`,c,id),document.addEventListener(`touchstart`,u,id),function(){Sd=Sd.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,id),document.removeEventListener(`touchmove`,c,id),document.removeEventListener(`touchstart`,u,id)}},[]);var p=e.removeScrollBar,m=e.inert;return H.createElement(H.Fragment,null,m?H.createElement(a,{styles:bd(i)}):null,p?H.createElement(td,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function wd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var Td=Pu(Fu,Cd),Ed=H.forwardRef(function(e,t){return H.createElement(Lu,vu({},e,{ref:t,sideCar:Td}))});Ed.classNames=Lu.classNames;var Dd=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Od=new WeakMap,kd=new WeakMap,Ad={},jd=0,Md=function(e){return e&&(e.host||Md(e.parentNode))},Nd=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Md(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Pd=function(e,t,n,r){var i=Nd(t,Array.isArray(e)?e:[e]);Ad[n]||(Ad[n]=new WeakMap);var a=Ad[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(Od.get(e)||0)+1,l=(a.get(e)||0)+1;Od.set(e,c),a.set(e,l),o.push(e),c===1&&i&&kd.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),jd++,function(){o.forEach(function(e){var t=Od.get(e)-1,i=a.get(e)-1;Od.set(e,t),a.set(e,i),t||(kd.has(e)||e.removeAttribute(r),kd.delete(e)),i||e.removeAttribute(n)}),jd--,jd||(Od=new WeakMap,Od=new WeakMap,kd=new WeakMap,Ad={})}},Fd=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||Dd(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Pd(r,i,n,`aria-hidden`)):function(){return null}},Id=t((e=>{var t=s();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,i=t.useState,a=t.useEffect,o=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=i({inst:{value:n,getSnapshot:t}}),s=r[0].inst,l=r[1];return o(function(){s.value=n,s.getSnapshot=t,u(s)&&l({inst:s})},[e,n,t]),a(function(){return u(s)&&l({inst:s}),e(function(){u(s)&&l({inst:s})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),Ld=t(((e,t)=>{t.exports=Id()}));function Rd(e){let[t,n]=H.useState(void 0);return xl(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var zd=[`top`,`right`,`bottom`,`left`],Bd=Math.min,Vd=Math.max,Hd=Math.round,Ud=Math.floor,Wd=e=>({x:e,y:e}),Gd={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Kd(e,t,n){return Vd(e,Bd(t,n))}function qd(e,t){return typeof e==`function`?e(t):e}function Jd(e){return e.split(`-`)[0]}function Yd(e){return e.split(`-`)[1]}function Xd(e){return e===`x`?`y`:`x`}function Zd(e){return e===`y`?`height`:`width`}function Qd(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function $d(e){return Xd(Qd(e))}function ef(e,t,n){n===void 0&&(n=!1);let r=Yd(e),i=$d(e),a=Zd(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=uf(o)),[o,uf(o)]}function tf(e){let t=uf(e);return[nf(e),t,nf(t)]}function nf(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var rf=[`left`,`right`],af=[`right`,`left`],of=[`top`,`bottom`],sf=[`bottom`,`top`];function cf(e,t,n){switch(e){case`top`:case`bottom`:return n?t?af:rf:t?rf:af;case`left`:case`right`:return t?of:sf;default:return[]}}function lf(e,t,n,r){let i=Yd(e),a=cf(Jd(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(nf)))),a}function uf(e){let t=Jd(e);return Gd[t]+e.slice(t.length)}function df(e){return{top:0,right:0,bottom:0,left:0,...e}}function ff(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:df(e)}function pf(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function mf(e,t,n){let{reference:r,floating:i}=e,a=Qd(t),o=$d(t),s=Zd(o),c=Jd(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Yd(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function hf(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=qd(t,e),p=ff(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=pf(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=pf(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var gf=50,_f=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:hf},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=mf(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<gf&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=mf(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},vf=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=qd(e,t)||{};if(l==null)return{};let d=ff(u),f={x:n,y:r},p=$d(i),m=Zd(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Bd(d[_],T),D=Bd(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,ee=Kd(O,A,k),te=!c.arrow&&Yd(i)!=null&&A!==ee&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,ne=te?A<O?A-O:A-k:0;return{[p]:f[p]+ne,data:{[p]:ee,centerOffset:A-ee-ne,...te&&{alignmentOffset:ne}},reset:te}}}),yf=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=qd(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Jd(r),_=Qd(o),v=Jd(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[uf(o)]:tf(o)),x=p!==`none`;!d&&x&&b.push(...lf(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=ef(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Qd(t))||T.every(e=>Qd(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Qd(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function bf(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xf(e){return zd.some(t=>e[t]>=0)}var Sf=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=qd(e,t);switch(i){case`referenceHidden`:{let e=bf(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xf(e)}}}case`escaped`:{let e=bf(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xf(e)}}}default:return{}}}}},Cf=new Set([`left`,`top`]);async function wf(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Jd(n),s=Yd(n),c=Qd(n)===`y`,l=Cf.has(o)?-1:1,u=a&&c?-1:1,d=qd(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Tf=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await wf(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ef=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=qd(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Qd(Jd(i)),p=Xd(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Kd(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Kd(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Df=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=qd(e,t),u={x:n,y:r},d=Qd(i),f=Xd(d),p=u[f],m=u[d],h=qd(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Cf.has(Jd(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Of=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=qd(e,t),u=await o.detectOverflow(t,l),d=Jd(i),f=Yd(i),p=Qd(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Bd(h-u[g],v),x=Bd(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Vd(u.left,0),t=Vd(u.right,0),n=Vd(u.top,0),r=Vd(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Vd(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Vd(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function kf(){return typeof window<`u`}function Af(e){return Nf(e)?(e.nodeName||``).toLowerCase():`#document`}function jf(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Mf(e){return((Nf(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Nf(e){return kf()?e instanceof Node||e instanceof jf(e).Node:!1}function Pf(e){return kf()?e instanceof Element||e instanceof jf(e).Element:!1}function Ff(e){return kf()?e instanceof HTMLElement||e instanceof jf(e).HTMLElement:!1}function If(e){return!kf()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof jf(e).ShadowRoot}function Lf(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Jf(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Rf(e){return/^(table|td|th)$/.test(Af(e))}function zf(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Bf=/transform|translate|scale|rotate|perspective|filter/,Vf=/paint|layout|strict|content/,Hf=e=>!!e&&e!==`none`,Uf;function Wf(e){let t=Pf(e)?Jf(e):e;return Hf(t.transform)||Hf(t.translate)||Hf(t.scale)||Hf(t.rotate)||Hf(t.perspective)||!Kf()&&(Hf(t.backdropFilter)||Hf(t.filter))||Bf.test(t.willChange||``)||Vf.test(t.contain||``)}function Gf(e){let t=Xf(e);for(;Ff(t)&&!qf(t);){if(Wf(t))return t;if(zf(t))return null;t=Xf(t)}return null}function Kf(){return Uf??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),Uf}function qf(e){return/^(html|body|#document)$/.test(Af(e))}function Jf(e){return jf(e).getComputedStyle(e)}function Yf(e){return Pf(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Xf(e){if(Af(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||If(e)&&e.host||Mf(e);return If(t)?t.host:t}function Zf(e){let t=Xf(e);return qf(t)?e.ownerDocument?e.ownerDocument.body:e.body:Ff(t)&&Lf(t)?t:Zf(t)}function Qf(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Zf(e),i=r===e.ownerDocument?.body,a=jf(r);if(i){let e=$f(a);return t.concat(a,a.visualViewport||[],Lf(r)?r:[],e&&n?Qf(e):[])}else return t.concat(r,Qf(r,[],n))}function $f(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ep(e){let t=Jf(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Ff(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Hd(n)!==a||Hd(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function tp(e){return Pf(e)?e:e.contextElement}function np(e){let t=tp(e);if(!Ff(t))return Wd(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ep(t),o=(a?Hd(n.width):n.width)/r,s=(a?Hd(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var rp=Wd(0);function ip(e){let t=jf(e);return!Kf()||!t.visualViewport?rp:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ap(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==jf(e)?!1:t}function op(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=tp(e),o=Wd(1);t&&(r?Pf(r)&&(o=np(r)):o=np(e));let s=ap(a,n,r)?ip(a):Wd(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=jf(a),t=r&&Pf(r)?jf(r):r,n=e,i=$f(n);for(;i&&r&&t!==n;){let e=np(i),t=i.getBoundingClientRect(),r=Jf(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=jf(i),i=$f(n)}}return pf({width:u,height:d,x:c,y:l})}function sp(e,t){let n=Yf(e).scrollLeft;return t?t.left+n:op(Mf(e)).left+n}function cp(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-sp(e,n),y:n.top+t.scrollTop}}function lp(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Mf(r),s=t?zf(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Wd(1),u=Wd(0),d=Ff(r);if((d||!d&&!a)&&((Af(r)!==`body`||Lf(o))&&(c=Yf(r)),d)){let e=op(r);l=np(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?cp(o,c):Wd(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function up(e){return Array.from(e.getClientRects())}function dp(e){let t=Mf(e),n=Yf(e),r=e.ownerDocument.body,i=Vd(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Vd(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+sp(e),s=-n.scrollTop;return Jf(r).direction===`rtl`&&(o+=Vd(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var fp=25;function pp(e,t){let n=jf(e),r=Mf(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Kf();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=sp(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=fp&&(a-=o)}else l<=fp&&(a+=l);return{width:a,height:o,x:s,y:c}}function mp(e,t){let n=op(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Ff(e)?np(e):Wd(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function hp(e,t,n){let r;if(t===`viewport`)r=pp(e,n);else if(t===`document`)r=dp(Mf(e));else if(Pf(t))r=mp(t,n);else{let n=ip(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return pf(r)}function gp(e,t){let n=Xf(e);return n===t||!Pf(n)||qf(n)?!1:Jf(n).position===`fixed`||gp(n,t)}function _p(e,t){let n=t.get(e);if(n)return n;let r=Qf(e,[],!1).filter(e=>Pf(e)&&Af(e)!==`body`),i=null,a=Jf(e).position===`fixed`,o=a?Xf(e):e;for(;Pf(o)&&!qf(o);){let t=Jf(o),n=Wf(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Lf(o)&&!n&&gp(e,o))?r=r.filter(e=>e!==o):i=t,o=Xf(o)}return t.set(e,r),r}function vp(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?zf(t)?[]:_p(t,this._c):[].concat(n),r],o=hp(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=hp(t,a[e],i);s=Vd(n.top,s),c=Bd(n.right,c),l=Bd(n.bottom,l),u=Vd(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function yp(e){let{width:t,height:n}=ep(e);return{width:t,height:n}}function bp(e,t,n){let r=Ff(t),i=Mf(t),a=n===`fixed`,o=op(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Wd(0);function l(){c.x=sp(i)}if(r||!r&&!a)if((Af(t)!==`body`||Lf(i))&&(s=Yf(t)),r){let e=op(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?cp(i,s):Wd(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function xp(e){return Jf(e).position===`static`}function Sp(e,t){if(!Ff(e)||Jf(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Mf(e)===n&&(n=n.ownerDocument.body),n}function Cp(e,t){let n=jf(e);if(zf(e))return n;if(!Ff(e)){let t=Xf(e);for(;t&&!qf(t);){if(Pf(t)&&!xp(t))return t;t=Xf(t)}return n}let r=Sp(e,t);for(;r&&Rf(r)&&xp(r);)r=Sp(r,t);return r&&qf(r)&&xp(r)&&!Wf(r)?n:r||Gf(e)||n}var wp=async function(e){let t=this.getOffsetParent||Cp,n=this.getDimensions,r=await n(e.floating);return{reference:bp(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tp(e){return Jf(e).direction===`rtl`}var Ep={convertOffsetParentRelativeRectToViewportRelativeRect:lp,getDocumentElement:Mf,getClippingRect:vp,getOffsetParent:Cp,getElementRects:wp,getClientRects:up,getDimensions:yp,getScale:np,isElement:Pf,isRTL:Tp};function Dp(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Op(e,t){let n=null,r,i=Mf(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=Ud(d),h=Ud(i.clientWidth-(u+f)),g=Ud(i.clientHeight-(d+p)),_=Ud(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:Vd(0,Bd(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Dp(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function kp(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=tp(e),u=i||a?[...l?Qf(l):[],...t?Qf(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Op(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?op(e):null;c&&g();function g(){let t=op(e);h&&!Dp(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Ap=Tf,jp=Ef,Mp=yf,Np=Of,Pp=Sf,Fp=vf,Ip=Df,Lp=(e,t,n)=>{let r=new Map,i={platform:Ep,...n},a={...i.platform,_c:r};return _f(e,t,{...i,platform:a})},Rp=typeof document<`u`?H.useLayoutEffect:function(){};function zp(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!zp(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!zp(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Bp(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Vp(e,t){let n=Bp(e);return Math.round(t*n)/n}function Hp(e){let t=H.useRef(e);return Rp(()=>{t.current=e}),t}function Up(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=H.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=H.useState(r);zp(f,r)||p(r);let[m,h]=H.useState(null),[g,_]=H.useState(null),v=H.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=H.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=H.useRef(null),C=H.useRef(null),w=H.useRef(u),T=c!=null,E=Hp(c),D=Hp(i),O=Hp(l),k=H.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Lp(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!zp(w.current,t)&&(w.current=t,_c.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Rp(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=H.useRef(!1);Rp(()=>(A.current=!0,()=>{A.current=!1}),[]),Rp(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let ee=H.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),te=H.useMemo(()=>({reference:b,floating:x}),[b,x]),ne=H.useMemo(()=>{let e={position:n,left:0,top:0};if(!te.floating)return e;let t=Vp(te.floating,u.x),r=Vp(te.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Bp(te.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,te.floating,u.x,u.y]);return H.useMemo(()=>({...u,update:k,refs:ee,elements:te,floatingStyles:ne}),[u,k,ee,te,ne])}var Wp=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Fp({element:r.current,padding:i}).fn(n):r?Fp({element:r,padding:i}).fn(n):{}}}},Gp=(e,t)=>{let n=Ap(e);return{name:n.name,fn:n.fn,options:[e,t]}},Kp=(e,t)=>{let n=jp(e);return{name:n.name,fn:n.fn,options:[e,t]}},qp=(e,t)=>({fn:Ip(e).fn,options:[e,t]}),Jp=(e,t)=>{let n=Mp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Yp=(e,t)=>{let n=Np(e);return{name:n.name,fn:n.fn,options:[e,t]}},Xp=(e,t)=>{let n=Pp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Zp=(e,t)=>{let n=Wp(e);return{name:n.name,fn:n.fn,options:[e,t]}},Qp=`Arrow`,$p=H.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,W.jsx)(gl.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,W.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});$p.displayName=Qp;var em=$p,tm=`Popper`,[nm,rm]=vl(tm),[im,am]=nm(tm),om=e=>{let{__scopePopper:t,children:n}=e,[r,i]=H.useState(null);return(0,W.jsx)(im,{scope:t,anchor:r,onAnchorChange:i,children:n})};om.displayName=tm;var sm=`PopperAnchor`,cm=H.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=am(sm,n),o=H.useRef(null),s=ll(t,o),c=H.useRef(null);return H.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,W.jsx)(gl.div,{...i,ref:s})});cm.displayName=sm;var lm=`PopperContent`,[um,dm]=nm(lm),fm=H.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=am(lm,n),[_,v]=H.useState(null),y=ll(t,e=>v(e)),[b,x]=H.useState(null),S=Rd(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(gm),altBoundary:O},{refs:A,floatingStyles:ee,placement:te,isPositioned:ne,middlewareData:j}=Up({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>kp(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Gp({mainAxis:i+w,alignmentAxis:o}),c&&Kp({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?qp():void 0,...k}),c&&Jp({...k}),Yp({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&Zp({element:b,padding:s}),_m({arrowWidth:C,arrowHeight:w}),f&&Xp({strategy:`referenceHidden`,...k})]}),[re,ie]=vm(te),ae=Il(m);xl(()=>{ne&&ae?.()},[ne,ae]);let oe=j.arrow?.x,se=j.arrow?.y,ce=j.arrow?.centerOffset!==0,[le,ue]=H.useState();return xl(()=>{_&&ue(window.getComputedStyle(_).zIndex)},[_]),(0,W.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:ne?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:le,"--radix-popper-transform-origin":[j.transformOrigin?.x,j.transformOrigin?.y].join(` `),...j.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,W.jsx)(um,{scope:n,placedSide:re,onArrowChange:x,arrowX:oe,arrowY:se,shouldHideArrow:ce,children:(0,W.jsx)(gl.div,{"data-side":re,"data-align":ie,...h,ref:y,style:{...h.style,animation:ne?void 0:`none`}})})})});fm.displayName=lm;var pm=`PopperArrow`,mm={top:`bottom`,right:`left`,bottom:`top`,left:`right`},hm=H.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=dm(pm,n),a=mm[i.placedSide];return(0,W.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,W.jsx)(em,{...r,ref:t,style:{...r.style,display:`block`}})})});hm.displayName=pm;function gm(e){return e!==null}var _m=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=vm(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function vm(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var ym=om,bm=cm,xm=fm,Sm=hm,Cm=`rovingFocusGroup.onEntryFocus`,wm={bubbles:!1,cancelable:!0},Tm=`RovingFocusGroup`,[Em,Dm,Om]=bl(Tm),[km,Am]=vl(Tm,[Om]),[jm,Mm]=km(Tm),Nm=H.forwardRef((e,t)=>(0,W.jsx)(Em.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Em.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,W.jsx)(Pm,{...e,ref:t})})}));Nm.displayName=Tm;var Pm=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=H.useRef(null),p=ll(t,f),m=Fl(a),[h,g]=Cl({prop:o,defaultProp:s??null,onChange:c,caller:Tm}),[_,v]=H.useState(!1),y=Il(l),b=Dm(n),x=H.useRef(!1),[S,C]=H.useState(0);return H.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(Cm,y),()=>e.removeEventListener(Cm,y)},[y]),(0,W.jsx)(jm,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:H.useCallback(e=>g(e),[g]),onItemShiftTab:H.useCallback(()=>v(!0),[]),onFocusableItemAdd:H.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:H.useCallback(()=>C(e=>e-1),[]),children:(0,W.jsx)(gl.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:G(e.onMouseDown,()=>{x.current=!0}),onFocus:G(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(Cm,wm);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);Bm([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:G(e.onBlur,()=>v(!1))})})}),Fm=`RovingFocusGroupItem`,Im=H.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Nl(),l=a||c,u=Mm(Fm,n),d=u.currentTabStopId===l,f=Dm(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return H.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,W.jsx)(Em.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,W.jsx)(gl.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:G(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:G(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:G(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=zm(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?Vm(n,r+1):n.slice(r+1)}setTimeout(()=>Bm(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});Im.displayName=Fm;var Lm={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function Rm(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function zm(e,t,n){let r=Rm(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return Lm[r]}function Bm(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function Vm(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Hm=Nm,Um=Im,Wm=[`Enter`,` `],Gm=[`ArrowDown`,`PageUp`,`Home`],Km=[`ArrowUp`,`PageDown`,`End`],qm=[...Gm,...Km],Jm={ltr:[...Wm,`ArrowRight`],rtl:[...Wm,`ArrowLeft`]},Ym={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},Xm=`Menu`,[Zm,Qm,$m]=bl(Xm),[eh,th]=vl(Xm,[$m,rm,Am]),nh=rm(),rh=Am(),[ih,ah]=eh(Xm),[oh,sh]=eh(Xm),ch=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=nh(t),[c,l]=H.useState(null),u=H.useRef(!1),d=Il(a),f=Fl(i);return H.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,W.jsx)(ym,{...s,children:(0,W.jsx)(ih,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,W.jsx)(oh,{scope:t,onClose:H.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};ch.displayName=Xm;var lh=`MenuAnchor`,uh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(bm,{...i,...r,ref:t})});uh.displayName=lh;var dh=`MenuPortal`,[fh,ph]=eh(dh,{forceMount:void 0}),mh=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=ah(dh,t);return(0,W.jsx)(fh,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};mh.displayName=dh;var hh=`MenuContent`,[gh,_h]=eh(hh),vh=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:o.modal?(0,W.jsx)(yh,{...i,ref:t}):(0,W.jsx)(bh,{...i,ref:t})})})})}),yh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu),r=H.useRef(null),i=ll(t,r);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Sh,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bh=H.forwardRef((e,t)=>{let n=ah(hh,e.__scopeMenu);return(0,W.jsx)(Sh,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xh=ul(`MenuContent.ScrollLock`),Sh=H.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=ah(hh,n),_=sh(hh,n),v=nh(n),y=rh(n),b=Qm(n),[x,S]=H.useState(null),C=H.useRef(null),w=ll(t,C,g.onContentChange),T=H.useRef(0),E=H.useRef(``),D=H.useRef(0),O=H.useRef(null),k=H.useRef(`right`),A=H.useRef(0),ee=m?Ed:H.Fragment,te=m?{as:xh,allowPinchZoom:!0}:void 0,ne=e=>{let t=E.current+e,n=b().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=og(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){E.current=t,window.clearTimeout(T.current),t!==``&&(T.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};H.useEffect(()=>()=>window.clearTimeout(T.current),[]),gu();let j=H.useCallback(e=>k.current===O.current?.side&&cg(e,O.current?.area),[]);return(0,W.jsx)(gh,{scope:n,searchRef:E,onItemEnter:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),onItemLeave:H.useCallback(e=>{j(e)||(C.current?.focus(),S(null))},[j]),onTriggerLeave:H.useCallback(e=>{j(e)&&e.preventDefault()},[j]),pointerGraceTimerRef:D,onPointerGraceIntentChange:H.useCallback(e=>{O.current=e},[]),children:(0,W.jsx)(ee,{...te,children:(0,W.jsx)(tu,{asChild:!0,trapped:i,onMountAutoFocus:G(a,e=>{e.preventDefault(),C.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,W.jsx)(Hm,{asChild:!0,...y,dir:_.dir,orientation:`vertical`,loop:r,currentTabStopId:x,onCurrentTabStopIdChange:S,onEntryFocus:G(c,e=>{_.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,W.jsx)(xm,{role:`menu`,"aria-orientation":`vertical`,"data-state":tg(g.open),"data-radix-menu-content":``,dir:_.dir,...v,...h,ref:w,style:{outline:`none`,...h.style},onKeyDown:G(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&ne(e.key));let i=C.current;if(e.target!==i||!qm.includes(e.key))return;e.preventDefault();let a=b().filter(e=>!e.disabled).map(e=>e.ref.current);Km.includes(e.key)&&a.reverse(),ig(a)}),onBlur:G(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(T.current),E.current=``)}),onPointerMove:G(e.onPointerMove,lg(e=>{let t=e.target,n=A.current!==e.clientX;e.currentTarget.contains(t)&&n&&(k.current=e.clientX>A.current?`right`:`left`,A.current=e.clientX)}))})})})})})})});vh.displayName=hh;var Ch=`MenuGroup`,wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`group`,...r,ref:t})});wh.displayName=Ch;var Th=`MenuLabel`,Eh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{...r,ref:t})});Eh.displayName=Th;var Dh=`MenuItem`,Oh=`menu.itemSelect`,kh=H.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=H.useRef(null),o=sh(Dh,e.__scopeMenu),s=_h(Dh,e.__scopeMenu),c=ll(t,a),l=H.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(Oh,{bubbles:!0,cancelable:!0});e.addEventListener(Oh,e=>r?.(e),{once:!0}),_l(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,W.jsx)(Ah,{...i,ref:c,disabled:n,onClick:G(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:G(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:G(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||Wm.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});kh.displayName=Dh;var Ah=H.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=_h(Dh,n),s=rh(n),c=H.useRef(null),l=ll(t,c),[u,d]=H.useState(!1),[f,p]=H.useState(``);return H.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,W.jsx)(Zm.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,W.jsx)(Um,{asChild:!0,...s,focusable:!r,children:(0,W.jsx)(gl.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:G(e.onPointerMove,lg(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:G(e.onPointerLeave,lg(e=>o.onItemLeave(e))),onFocus:G(e.onFocus,()=>d(!0)),onBlur:G(e.onBlur,()=>d(!1))})})})}),jh=`MenuCheckboxItem`,Mh=H.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:n,children:(0,W.jsx)(kh,{role:`menuitemcheckbox`,"aria-checked":ng(n)?`mixed`:n,...i,ref:t,"data-state":rg(n),onSelect:G(i.onSelect,()=>r?.(ng(n)?!0:!n),{checkForDefaultPrevented:!1})})})});Mh.displayName=jh;var Nh=`MenuRadioGroup`,[Ph,Fh]=eh(Nh,{value:void 0,onValueChange:()=>{}}),Ih=H.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Il(r);return(0,W.jsx)(Ph,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,W.jsx)(wh,{...i,ref:t})})});Ih.displayName=Nh;var Lh=`MenuRadioItem`,Rh=H.forwardRef((e,t)=>{let{value:n,...r}=e,i=Fh(Lh,e.__scopeMenu),a=n===i.value;return(0,W.jsx)(Bh,{scope:e.__scopeMenu,checked:a,children:(0,W.jsx)(kh,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":rg(a),onSelect:G(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});Rh.displayName=Lh;var zh=`MenuItemIndicator`,[Bh,Vh]=eh(zh,{checked:!1}),Hh=H.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=Vh(zh,n);return(0,W.jsx)(Dl,{present:r||ng(a.checked)||a.checked===!0,children:(0,W.jsx)(gl.span,{...i,ref:t,"data-state":rg(a.checked)})})});Hh.displayName=zh;var Uh=`MenuSeparator`,Wh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,W.jsx)(gl.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});Wh.displayName=Uh;var Gh=`MenuArrow`,Kh=H.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=nh(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});Kh.displayName=Gh;var qh=`MenuSub`,[Jh,Yh]=eh(qh),Xh=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=ah(qh,t),o=nh(t),[s,c]=H.useState(null),[l,u]=H.useState(null),d=Il(i);return H.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,W.jsx)(ym,{...o,children:(0,W.jsx)(ih,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,W.jsx)(Jh,{scope:t,contentId:Nl(),triggerId:Nl(),trigger:s,onTriggerChange:c,children:n})})})};Xh.displayName=qh;var Zh=`MenuSubTrigger`,Qh=H.forwardRef((e,t)=>{let n=ah(Zh,e.__scopeMenu),r=sh(Zh,e.__scopeMenu),i=Yh(Zh,e.__scopeMenu),a=_h(Zh,e.__scopeMenu),o=H.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=H.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return H.useEffect(()=>u,[u]),H.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,W.jsx)(uh,{asChild:!0,...l,children:(0,W.jsx)(Ah,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":tg(n.open),...e,ref:cl(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:G(e.onPointerMove,lg(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:G(e.onPointerLeave,lg(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:G(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||Jm[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});Qh.displayName=Zh;var $h=`MenuSubContent`,eg=H.forwardRef((e,t)=>{let n=ph(hh,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=ah(hh,e.__scopeMenu),o=sh(hh,e.__scopeMenu),s=Yh($h,e.__scopeMenu),c=H.useRef(null),l=ll(t,c);return(0,W.jsx)(Zm.Provider,{scope:e.__scopeMenu,children:(0,W.jsx)(Dl,{present:r||a.open,children:(0,W.jsx)(Zm.Slot,{scope:e.__scopeMenu,children:(0,W.jsx)(Sh,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:G(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:G(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=Ym[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});eg.displayName=$h;function tg(e){return e?`open`:`closed`}function ng(e){return e===`indeterminate`}function rg(e){return ng(e)?`indeterminate`:e?`checked`:`unchecked`}function ig(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function ag(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function og(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=ag(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function sg(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function cg(e,t){return t?sg({x:e.clientX,y:e.clientY},t):!1}function lg(e){return t=>t.pointerType===`mouse`?e(t):void 0}var ug=ch,dg=uh,fg=mh,pg=vh,mg=wh,hg=Eh,gg=kh,_g=Mh,vg=Ih,yg=Rh,bg=Hh,xg=Wh,Sg=Kh,Cg=Xh,wg=Qh,Tg=eg,Eg=`DropdownMenu`,[Dg,Og]=vl(Eg,[th]),kg=th(),[Ag,jg]=Dg(Eg),Mg=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=kg(t),l=H.useRef(null),[u,d]=Cl({prop:i,defaultProp:a??!1,onChange:o,caller:Eg});return(0,W.jsx)(Ag,{scope:t,triggerId:Nl(),triggerRef:l,contentId:Nl(),open:u,onOpenChange:d,onOpenToggle:H.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,W.jsx)(ug,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};Mg.displayName=Eg;var Ng=`DropdownMenuTrigger`,Pg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=jg(Ng,n),o=kg(n);return(0,W.jsx)(dg,{asChild:!0,...o,children:(0,W.jsx)(gl.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:cl(t,a.triggerRef),onPointerDown:G(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:G(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});Pg.displayName=Ng;var Fg=`DropdownMenuPortal`,Ig=e=>{let{__scopeDropdownMenu:t,...n}=e,r=kg(t);return(0,W.jsx)(fg,{...r,...n})};Ig.displayName=Fg;var Lg=`DropdownMenuContent`,Rg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jg(Lg,n),a=kg(n),o=H.useRef(!1);return(0,W.jsx)(pg,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:G(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});Rg.displayName=Lg;var zg=`DropdownMenuGroup`,Bg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(mg,{...i,...r,ref:t})});Bg.displayName=zg;var Vg=`DropdownMenuLabel`,Hg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(hg,{...i,...r,ref:t})});Hg.displayName=Vg;var Ug=`DropdownMenuItem`,Wg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(gg,{...i,...r,ref:t})});Wg.displayName=Ug;var Gg=`DropdownMenuCheckboxItem`,Kg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(_g,{...i,...r,ref:t})});Kg.displayName=Gg;var qg=`DropdownMenuRadioGroup`,Jg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(vg,{...i,...r,ref:t})});Jg.displayName=qg;var Yg=`DropdownMenuRadioItem`,Xg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(yg,{...i,...r,ref:t})});Xg.displayName=Yg;var Zg=`DropdownMenuItemIndicator`,Qg=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(bg,{...i,...r,ref:t})});Qg.displayName=Zg;var $g=`DropdownMenuSeparator`,e_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(xg,{...i,...r,ref:t})});e_.displayName=$g;var t_=`DropdownMenuArrow`,n_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Sg,{...i,...r,ref:t})});n_.displayName=t_;var r_=e=>{let{__scopeDropdownMenu:t,children:n,open:r,onOpenChange:i,defaultOpen:a}=e,o=kg(t),[s,c]=Cl({prop:r,defaultProp:a??!1,onChange:i,caller:`DropdownMenuSub`});return(0,W.jsx)(Cg,{...o,open:s,onOpenChange:c,children:n})},i_=`DropdownMenuSubTrigger`,a_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(wg,{...i,...r,ref:t})});a_.displayName=i_;var o_=`DropdownMenuSubContent`,s_=H.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=kg(n);return(0,W.jsx)(Tg,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});s_.displayName=o_;var c_=Mg,l_=Pg,u_=Rg,d_=Wg,f_=r_,p_=a_,m_=s_,h_=`Popover`,[g_,__]=vl(h_,[rm]),v_=rm(),[y_,b_]=g_(h_),x_=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=v_(t),c=H.useRef(null),[l,u]=H.useState(!1),[d,f]=Cl({prop:r,defaultProp:i??!1,onChange:a,caller:h_});return(0,W.jsx)(ym,{...s,children:(0,W.jsx)(y_,{scope:t,contentId:Nl(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:H.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:H.useCallback(()=>u(!0),[]),onCustomAnchorRemove:H.useCallback(()=>u(!1),[]),modal:o,children:n})})};x_.displayName=h_;var S_=`PopoverAnchor`,C_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(S_,n),a=v_(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return H.useEffect(()=>(o(),()=>s()),[o,s]),(0,W.jsx)(bm,{...a,...r,ref:t})});C_.displayName=S_;var w_=`PopoverTrigger`,T_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(w_,n),a=v_(n),o=ll(t,i.triggerRef),s=(0,W.jsx)(gl.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":B_(i.open),...r,ref:o,onClick:G(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,W.jsx)(bm,{asChild:!0,...a,children:s})});T_.displayName=w_;var E_=`PopoverPortal`,[D_,O_]=g_(E_,{forceMount:void 0}),k_=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=b_(E_,t);return(0,W.jsx)(D_,{scope:t,forceMount:n,children:(0,W.jsx)(Dl,{present:n||a.open,children:(0,W.jsx)(mu,{asChild:!0,container:i,children:r})})})};k_.displayName=E_;var A_=`PopoverContent`,j_=H.forwardRef((e,t)=>{let n=O_(A_,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=b_(A_,e.__scopePopover);return(0,W.jsx)(Dl,{present:r||a.open,children:a.modal?(0,W.jsx)(N_,{...i,ref:t}):(0,W.jsx)(P_,{...i,ref:t})})});j_.displayName=A_;var M_=ul(`PopoverContent.RemoveScroll`),N_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(null),i=ll(t,r),a=H.useRef(!1);return H.useEffect(()=>{let e=r.current;if(e)return Fd(e)},[]),(0,W.jsx)(Ed,{as:M_,allowPinchZoom:!0,children:(0,W.jsx)(F_,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:G(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:G(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:G(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),P_=H.forwardRef((e,t)=>{let n=b_(A_,e.__scopePopover),r=H.useRef(!1),i=H.useRef(!1);return(0,W.jsx)(F_,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),F_=H.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=b_(A_,n),p=v_(n);return gu(),(0,W.jsx)(tu,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,W.jsx)(Wl,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,W.jsx)(xm,{"data-state":B_(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),I_=`PopoverClose`,L_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=b_(I_,n);return(0,W.jsx)(gl.button,{type:`button`,...r,ref:t,onClick:G(e.onClick,()=>i.onOpenChange(!1))})});L_.displayName=I_;var R_=`PopoverArrow`,z_=H.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=v_(n);return(0,W.jsx)(Sm,{...i,...r,ref:t})});z_.displayName=R_;function B_(e){return e?`open`:`closed`}var V_=x_,H_=T_,U_=k_,W_=j_,G_=z_,K_=`Tabs`,[q_,J_]=vl(K_,[Am]),Y_=Am(),[X_,Z_]=q_(K_),Q_=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:a,orientation:o=`horizontal`,dir:s,activationMode:c=`automatic`,...l}=e,u=Fl(s),[d,f]=Cl({prop:r,onChange:i,defaultProp:a??``,caller:K_});return(0,W.jsx)(X_,{scope:n,baseId:Nl(),value:d,onValueChange:f,orientation:o,dir:u,activationMode:c,children:(0,W.jsx)(gl.div,{dir:u,"data-orientation":o,...l,ref:t})})});Q_.displayName=K_;var $_=`TabsList`,ev=H.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=Z_($_,n),o=Y_(n);return(0,W.jsx)(Hm,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,W.jsx)(gl.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});ev.displayName=$_;var tv=`TabsTrigger`,nv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,o=Z_(tv,n),s=Y_(n),c=av(o.baseId,r),l=ov(o.baseId,r),u=r===o.value;return(0,W.jsx)(Um,{asChild:!0,...s,focusable:!i,active:u,children:(0,W.jsx)(gl.button,{type:`button`,role:`tab`,"aria-selected":u,"aria-controls":l,"data-state":u?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:c,...a,ref:t,onMouseDown:G(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?o.onValueChange(r):e.preventDefault()}),onKeyDown:G(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&o.onValueChange(r)}),onFocus:G(e.onFocus,()=>{let e=o.activationMode!==`manual`;!u&&!i&&e&&o.onValueChange(r)})})})});nv.displayName=tv;var rv=`TabsContent`,iv=H.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=Z_(rv,n),c=av(s.baseId,r),l=ov(s.baseId,r),u=r===s.value,d=H.useRef(u);return H.useEffect(()=>{let e=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,W.jsx)(Dl,{present:i||u,children:({present:n})=>(0,W.jsx)(gl.div,{"data-state":u?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":c,hidden:!n,id:l,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:d.current?`0s`:void 0},children:n&&a})})});iv.displayName=rv;function av(e,t){return`${e}-trigger-${t}`}function ov(e,t){return`${e}-content-${t}`}var sv=Q_,cv=ev,lv=nv,uv=iv,dv=e(t(((e,t)=>{(function(){var n=this,r={};e===void 0?n.fuzzy=r:t.exports=r,r.simpleFilter=function(e,t){return t.filter(function(t){return r.test(e,t)})},r.test=function(e,t){return r.match(e,t)!==null},r.match=function(e,t,n){n||={};var r=0,i=[],a=t.length,o=0,s=0,c=n.pre||``,l=n.post||``,u=n.caseSensitive&&t||t.toLowerCase(),d;e=n.caseSensitive&&e||e.toLowerCase();for(var f=0;f<a;f++)d=t[f],u[f]===e[r]?(d=c+d+l,r+=1,s+=1+s):s=0,o+=s,i[i.length]=d;return r===e.length?(o=u===e?1/0:o,{rendered:i.join(``),score:o}):null},r.filter=function(e,t,n){return!t||t.length===0?[]:typeof e==`string`?(n||={},t.reduce(function(t,i,a,o){var s=i;n.extract&&(s=n.extract(i));var c=r.match(e,s,n);return c!=null&&(t[t.length]={string:c.rendered,score:c.score,index:a,original:i}),t},[]).sort(function(e,t){return t.score-e.score||e.index-t.index})):t}})()}))(),1),fv=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},pv=e=>e?fv(e):fv,mv=t((e=>{var t=s(),n=Ld();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=n.useSyncExternalStore,o=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,s){var d=o(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!a){if(a=!0,o=e,e=r(e),s!==void 0&&f.hasValue){var t=f.value;if(s(t,e))return c=t}return c=e}if(t=c,i(o,e))return t;var n=r(e);return s!==void 0&&s(t,n)?(o=e,t):(o=e,c=n)}var a=!1,o,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,s]);var p=a(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),hv=e(t(((e,t)=>{t.exports=mv()}))(),1),{useDebugValue:gv}=H.default,{useSyncExternalStoreWithSelector:_v}=hv.default,vv=e=>e;function yv(e,t=vv,n){let r=_v(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return gv(r),r}var bv=e=>{let t=typeof e==`function`?pv(e):e,n=(e,n)=>yv(t,e,n);return Object.assign(n,t),n},xv=e=>e?bv(e):bv,Sv,Cv=typeof window<`u`&&((Sv=window.document)!=null&&Sv.createElement||window.navigator?.product===`ReactNative`)?H.useLayoutEffect:H.useEffect;function wv(){let e=xv(e=>({current:[],version:0,set:e}));return{In:({children:t})=>{let n=e(e=>e.set),r=e(e=>e.version);return Cv(()=>{n(e=>({version:e.version+1}))},[]),Cv(()=>(n(({current:e})=>({current:[...e,t]})),()=>n(({current:e})=>({current:e.filter(e=>e!==t)}))),[t,r]),null},Out:()=>{let t=e(e=>e.current);return H.createElement(H.Fragment,null,t)}}}function Tv(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2}function Ev(e,t,n){let r=Tv(t,n);if(r===0)return Tv(e,t);let i=((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r;return i=Math.max(0,Math.min(1,i)),Tv(e,Dv(t,n,i))}function Dv(e,t,n){return[e[0]+(t[0]-e[0])*n,e[1]+(t[1]-e[1])*n]}function Ov(e,t){return kv(e,0,e.length,t)}function kv(e,t,n,r,i){let a=i||[],o=e[t],s=e[n-1],c=0,l=1;for(let r=t+1;r<n-1;++r){let t=Ev(e[r],o,s);t>c&&(c=t,l=r)}return Math.sqrt(c)>r?(kv(e,t,l+1,r,a),kv(e,l,n,r,a)):(a.length||a.push(o),a.push(s)),a}function Av(e,t,n,r=e=>e){return e*r(.5-t*(.5-n))}function jv(e){return[-e[0],-e[1]]}function Mv(e,t){return[e[0]+t[0],e[1]+t[1]]}function Nv(e,t){return[e[0]-t[0],e[1]-t[1]]}function Pv(e,t){return[e[0]*t,e[1]*t]}function Fv(e,t){return[e[0]/t,e[1]/t]}function Iv(e){return[e[1],-e[0]]}function Lv(e,t){return e[0]*t[0]+e[1]*t[1]}function Rv(e,t){return e[0]===t[0]&&e[1]===t[1]}function zv(e){return Math.hypot(e[0],e[1])}function Bv(e){return e[0]*e[0]+e[1]*e[1]}function Vv(e,t){return Bv(Nv(e,t))}function Hv(e){return Fv(e,zv(e))}function Uv(e,t){return Math.hypot(e[1]-t[1],e[0]-t[0])}function Wv(e,t,n){let r=Math.sin(n),i=Math.cos(n),a=e[0]-t[0],o=e[1]-t[1],s=a*i-o*r,c=a*r+o*i;return[s+t[0],c+t[1]]}function Gv(e,t,n){return Mv(e,Pv(Nv(t,e),n))}function Kv(e,t,n){return Mv(e,Pv(t,n))}var{min:qv,PI:Jv}=Math,Yv=.275,Xv=Jv+1e-4;function Zv(e,t={}){let{size:n=16,smoothing:r=.5,thinning:i=.5,simulatePressure:a=!0,easing:o=e=>e,start:s={},end:c={},last:l=!1}=t,{cap:u=!0,easing:d=e=>e*(2-e)}=s,{cap:f=!0,easing:p=e=>--e*e*e+1}=c;if(e.length===0||n<=0)return[];let m=e[e.length-1].runningLength,h=s.taper===!1?0:s.taper===!0?Math.max(n,m):s.taper,g=c.taper===!1?0:c.taper===!0?Math.max(n,m):c.taper,_=(n*r)**2,v=[],y=[],b=e.slice(0,10).reduce((e,t)=>{let r=t.pressure;if(a){let i=qv(1,t.distance/n);r=qv(1,e+(qv(1,1-i)-e)*(i*Yv))}return(e+r)/2},e[0].pressure),x=Av(n,i,e[e.length-1].pressure,o),S,C=e[0].vector,w=e[0].point,T=w,E=w,D=T,O=!1;for(let t=0;t<e.length;t++){let{pressure:r}=e[t],{point:s,vector:c,distance:l,runningLength:u}=e[t];if(t<e.length-1&&m-u<3)continue;if(i){if(a){let e=qv(1,l/n),t=qv(1,1-e);r=qv(1,b+(t-b)*(e*Yv))}x=Av(n,i,r,o)}else x=n/2;S===void 0&&(S=x);let f=u<h?d(u/h):1,k=m-u<g?p((m-u)/g):1;x=Math.max(.01,x*Math.min(f,k));let A=(t<e.length-1?e[t+1]:e[t]).vector,ee=t<e.length-1?Lv(c,A):1,te=Lv(c,C)<0&&!O,ne=ee!==null&&ee<0;if(te||ne){let e=Pv(Iv(C),x);for(let t=0;t<=1;t+=.07692307692307693)E=Wv(Nv(s,e),s,Xv*t),v.push(E),D=Wv(Mv(s,e),s,Xv*-t),y.push(D);w=E,T=D,ne&&(O=!0);continue}if(O=!1,t===e.length-1){let e=Pv(Iv(c),x);v.push(Nv(s,e)),y.push(Mv(s,e));continue}let j=Pv(Iv(Gv(A,c,ee)),x);E=Nv(s,j),(t<=1||Vv(w,E)>_)&&(v.push(E),w=E),D=Mv(s,j),(t<=1||Vv(T,D)>_)&&(y.push(D),T=D),b=r,C=c}let k=e[0].point.slice(0,2),A=e.length>1?e[e.length-1].point.slice(0,2):Mv(e[0].point,[1,1]),ee=[],te=[];if(e.length===1){if(!(h||g)||l){let e=Kv(k,Hv(Iv(Nv(k,A))),-(S||x)),t=[];for(let n=1/13,r=n;r<=1;r+=n)t.push(Wv(e,k,Xv*2*r));return t}}else{if(!(h||g&&e.length===1))if(u)for(let e=1/13,t=e;t<=1;t+=e){let e=Wv(y[0],k,Xv*t);ee.push(e)}else{let e=Nv(v[0],y[0]),t=Pv(e,.5),n=Pv(e,.51);ee.push(Nv(k,t),Nv(k,n),Mv(k,n),Mv(k,t))}let t=Iv(jv(e[e.length-1].vector));if(g||h&&e.length===1)te.push(A);else if(f){let e=Kv(A,t,x);for(let t=1/29,n=t;n<1;n+=t)te.push(Wv(e,A,Xv*3*n))}else te.push(Mv(A,Pv(t,x)),Mv(A,Pv(t,x*.99)),Nv(A,Pv(t,x*.99)),Nv(A,Pv(t,x)))}return v.concat(te,y.reverse(),ee)}function Qv(e,t={}){let{streamline:n=.5,size:r=16,last:i=!1}=t;if(e.length===0)return[];let a=.15+(1-n)*.85,o=Array.isArray(e[0])?e:e.map(({x:e,y:t,pressure:n=.5})=>[e,t,n]);if(o.length===2){let e=o[1];o=o.slice(0,-1);for(let t=1;t<5;t++)o.push(Gv(o[0],e,t/4))}o.length===1&&(o=[...o,[...Mv(o[0],[1,1]),...o[0].slice(2)]]);let s=[{point:[o[0][0],o[0][1]],pressure:o[0][2]>=0?o[0][2]:.25,vector:[1,1],distance:0,runningLength:0}],c=!1,l=0,u=s[0],d=o.length-1;for(let e=1;e<o.length;e++){let t=i&&e===d?o[e].slice(0,2):Gv(u.point,o[e],a);if(Rv(u.point,t))continue;let n=Uv(t,u.point);if(l+=n,e<d&&!c){if(l<r)continue;c=!0}u={point:t,pressure:o[e][2]>=0?o[e][2]:.5,vector:Hv(Nv(u.point,t)),distance:n,runningLength:l},s.push(u)}return s[0].vector=s[1]?.vector||[0,0],s}function $v(e,t={}){return Zv(Qv(e,t),t)}function ey(e,t,n,r){Object.defineProperty(e,t,{get:n,set:r,enumerable:!0,configurable:!0})}ey({},`LaserPointer`,()=>hy);function ty([e,t,n],[r,i,a]){return[e+r,t+i,n+a]}function ny([e,t,n],[r,i,a]){return[e-r,t-i,n-a]}function ry([e,t,n],r){return[e*r,t*r,n*r]}function iy([e,t,n]){return[e/Math.sqrt(e**2+t**2),t/Math.sqrt(e**2+t**2),n]}function ay([e,t,n],r){return[Math.cos(r)*e-Math.sin(r)*t,Math.sin(r)*e+Math.cos(r)*t,n]}function oy(e,t,n){return ty(e,ry(ny(t,e),n))}function sy(e,t,n){return Math.atan2(n[1]-e[1],n[0]-e[0])-Math.atan2(t[1]-e[1],t[0]-e[0])}function cy(e){return Math.atan2(Math.sin(e),Math.cos(e))}function ly([e,t]){return Math.sqrt(e**2+t**2)}function uy([e,t],[n,r]){return Math.sqrt((n-e)**2+(r-t)**2)}function dy(e){if(e.length<2)return 0;let t=0;for(let n=1;n<=e.length-1;n++)t+=uy(e[n-1],e[n]);return t+=uy(e[e.length-2],e[e.length-1]),t}var fy=(e,t,n)=>Math.max(t,Math.min(n,e));function py(e,t,n){let r=uy(t,n);if(r===0)return uy(e,t);let i=fy(((e[0]-t[0])*(n[0]-t[0])+(e[1]-t[1])*(n[1]-t[1]))/r**2,0,1);return uy([t[0]+i*(n[0]-t[0]),t[1]+i*(n[1]-t[1]),e[2]],e)}function my(e,t){if(t===0||e.length<=2)return e;let n=e[0],r=e[e.length-1],[i,a]=e.reduce(([e,t],i,a)=>{let o=py(i,n,r);return o>e?[o,a]:[e,t]},[0,-1]);if(i>=t){let i=e[a];return[...my([n,...e.slice(1,a),i],t).slice(0,-1),i,...my([i,...e.slice(a,-1),r],t).slice(1)]}else return[n,r]}var hy=class e{static{this.defaults={size:2,streamline:.45,simplify:.1,simplifyPhase:`output`,keepHead:!1,sizeMapping:()=>1}}static{this.constants={cornerDetectionMaxAngle:75,cornerDetectionVariance:e=>e>35?.5:1,maxTailLength:50}}constructor(t){this.originalPoints=[],this.stablePoints=[],this.tailPoints=[],this.isFresh=!0,this.options=Object.assign({},e.defaults,t)}get lastPoint(){return this.tailPoints[this.tailPoints.length-1]??this.stablePoints[this.stablePoints.length-1]}addPoint(t){let n=this.originalPoints[this.originalPoints.length-1];if(!(n&&n[0]===t[0]&&n[1]===t[1])){if(this.originalPoints.push(t),this.isFresh){this.isFresh=!1,this.stablePoints.push(t);return}this.options.streamline>0&&(t=oy(this.lastPoint,t,1-this.options.streamline)),this.tailPoints.push(t),dy(this.tailPoints)>e.constants.maxTailLength&&this.stabilizeTail()}}close(){this.stabilizeTail()}stabilizeTail(){if(this.options.simplify>0&&this.options.simplifyPhase==`tail`)throw Error(`Not implemented yet`);this.stablePoints.push(...this.tailPoints),this.tailPoints=[]}getSize(e,t,n,r,i){return(e??this.options.size)*this.options.sizeMapping({pressure:t,runningLength:i,currentIndex:n,totalLength:r})}getStrokeOutline(t){if(this.isFresh)return[];let n=[...this.stablePoints,...this.tailPoints];this.options.simplify>0&&this.options.simplifyPhase===`input`&&(n=my(n,this.options.simplify));let r=n.length;if(r===0)return[];if(r===1){let e=n[0],i=this.getSize(t,e[2],0,r,0);if(i<.5)return[];let a=[];for(let t=0;t<=Math.PI*2;t+=Math.PI/16)a.push(ty(e,ry(ay([1,0,0],t),i)));return a.push(ty(e,ry([1,0,0],this.getSize(t,e[2],0,r,0)))),a}if(r===2){let e=n[0],i=n[1],a=this.getSize(t,e[2],0,r,0),o=this.getSize(t,i[2],0,r,0);if(a<.5||o<.5)return[];let s=[],c=sy(e,[e[0],e[1]-100,e[2]],i);for(let t=c;t<=Math.PI+c;t+=Math.PI/16)s.push(ty(e,ry(ay([1,0,0],t),a)));for(let e=Math.PI+c;e<=Math.PI*2+c;e+=Math.PI/16)s.push(ty(i,ry(ay([1,0,0],e),o)));return s.push(s[0]),s}let i=[],a=[],o=0,s=0,c=0,l=0;for(let u=1;u<r-1;u++){let d=n[u-1],f=n[u],p=n[u+1],m=f[2],h=uy(d,f);l+=h,o=s+(h-s)*.2;let g=this.getSize(t,m,u,r,l);if(g===0){c=u+1;continue}let _=iy(ny(d,f)),v=iy(ny(p,f)),y=ay(_,Math.PI/2),b=ay(_,-Math.PI/2),x=ay(v,Math.PI/2),S=ay(v,-Math.PI/2),C=ty(f,ry(y,g)),w=ty(f,ry(b,g)),T=ty(f,ry(x,g)),E=ty(f,ry(S,g)),D=ty(y,S),O=ty(b,x),k=ty(f,ry(ly(D)===0?_:iy(D),g)),A=ty(f,ry(ly(O)===0?v:iy(O),g)),ee=cy(sy(f,d,p)),te=e.constants.cornerDetectionMaxAngle/180*Math.PI*e.constants.cornerDetectionVariance(o);if(Math.abs(ee)<te){let e=Math.abs(cy(Math.PI-ee));if(e===0)continue;if(ee<0){a.push(w,A);for(let t=0;t<=e;t+=e/4)i.push(ty(f,ay(ry(y,g),t)));for(let t=e;t>=0;t-=e/4)a.push(ty(f,ay(ry(y,g),t)));a.push(A,T)}else{i.push(C,k);for(let t=0;t<=e;t+=e/4)a.push(ty(f,ay(ry(y,-g),-t)));for(let t=e;t>=0;t-=e/4)i.push(ty(f,ay(ry(y,-g),-t)));i.push(k,E)}}else i.push(k),a.push(A);s=o}if(c>=r-2)if(this.options.keepHead){let e=n[r-1],t=[];for(let n=0;n<=Math.PI*2;n+=Math.PI/16)t.push(ty(e,ry(ay([1,0,0],n),this.options.size)));return t.push(ty(e,ry([1,0,0],this.options.size))),t}else return[];let u=n[c],d=n[c+1],f=n[r-2],p=n[r-1],m=iy(ny(d,u)),h=iy(ny(f,p)),g=ay(m,-Math.PI/2),_=ay(h,Math.PI/2),v=this.getSize(t,u[2],0,r,0),y=[],b=this.options.keepHead?this.options.size:this.getSize(t,f[2],r-2,r,l),x=[];if(v>1){for(let e=0;e<=Math.PI;e+=Math.PI/16)y.unshift(ty(u,ay(ry(g,v),-e)));y.unshift(ty(u,ry(g,-v)))}else y.push(u);for(let e=0;e<=Math.PI*3;e+=Math.PI/16)x.push(ty(p,ay(ry(_,-b),-e)));let S=[...y,...i,...x.reverse(),...a.reverse()];return y.length>0&&S.push(y[0]),this.options.simplify>0&&this.options.simplifyPhase===`output`?my(S,this.options.simplify):S}},gy=e(t(((e,t)=>{var n=`Expected a function`,r=NaN,i=`[object Symbol]`,a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt,u=typeof global==`object`&&global&&global.Object===Object&&global,d=typeof self==`object`&&self&&self.Object===Object&&self,f=u||d||Function(`return this`)(),p=Object.prototype.toString,m=Math.max,h=Math.min,g=function(){return f.Date.now()};function _(e,t,r){var i,a,o,s,c,l,u=0,d=!1,f=!1,p=!0;if(typeof e!=`function`)throw TypeError(n);t=x(t)||0,v(r)&&(d=!!r.leading,f=`maxWait`in r,o=f?m(x(r.maxWait)||0,t):o,p=`trailing`in r?!!r.trailing:p);function _(t){var n=i,r=a;return i=a=void 0,u=t,s=e.apply(r,n),s}function y(e){return u=e,c=setTimeout(C,t),d?_(e):s}function b(e){var n=e-l,r=e-u,i=t-n;return f?h(i,o-r):i}function S(e){var n=e-l,r=e-u;return l===void 0||n>=t||n<0||f&&r>=o}function C(){var e=g();if(S(e))return w(e);c=setTimeout(C,b(e))}function w(e){return c=void 0,p&&i?_(e):(i=a=void 0,s)}function T(){c!==void 0&&clearTimeout(c),u=0,i=l=a=c=void 0}function E(){return c===void 0?s:w(g())}function D(){var e=g(),n=S(e);if(i=arguments,a=this,l=e,n){if(c===void 0)return y(l);if(f)return c=setTimeout(C,t),_(l)}return c===void 0&&(c=setTimeout(C,t)),s}return D.cancel=T,D.flush=E,D}function v(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function y(e){return!!e&&typeof e==`object`}function b(e){return typeof e==`symbol`||y(e)&&p.call(e)==i}function x(e){if(typeof e==`number`)return e;if(b(e))return r;if(v(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=v(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=e.replace(a,``);var n=s.test(e);return n||c.test(e)?l(e.slice(2),n?2:8):o.test(e)?r:+e}t.exports=_}))(),1),_y=il(),{useAtom:vy,useSetAtom:yy,useAtomValue:by,useStore:xy}=_y,Sy=_y.Provider,Cy=Vc(),wy=a({"./locales/ar-SA.json":()=>n(()=>import(`./ar-SA-NXDWD63E-DND5MLpM.js`),__vite__mapDeps([0,1,2]),import.meta.url),"./locales/az-AZ.json":()=>n(()=>import(`./az-AZ-MXSORGZV-ILYw2sYr.js`),__vite__mapDeps([3,1,2]),import.meta.url),"./locales/bg-BG.json":()=>n(()=>import(`./bg-BG-O6MV2KSF-DmfoZHM8.js`),__vite__mapDeps([4,1,2]),import.meta.url),"./locales/bn-BD.json":()=>n(()=>import(`./bn-BD-T2VJNT7N-uYQx1Wph.js`),__vite__mapDeps([5,1,2]),import.meta.url),"./locales/bn-IN.json":()=>n(()=>import(`./bn-IN-MMW2ORAC-CmlBLY7g.js`),__vite__mapDeps([6,1,2]),import.meta.url),"./locales/ca-ES.json":()=>n(()=>import(`./ca-ES-MKBCGNOG-DWiYvMvF.js`),__vite__mapDeps([7,1,2]),import.meta.url),"./locales/cs-CZ.json":()=>n(()=>import(`./cs-CZ-V77HGUP7-sLBAF2Iw.js`),__vite__mapDeps([8,1,2]),import.meta.url),"./locales/da-DK.json":()=>n(()=>import(`./da-DK-I5RFNTM4-B__PLwca.js`),__vite__mapDeps([9,1,2]),import.meta.url),"./locales/de-CH.json":()=>n(()=>import(`./de-CH-WLRDEVBV-D61DKw_9.js`),__vite__mapDeps([10,1,2]),import.meta.url),"./locales/de-DE.json":()=>n(()=>import(`./de-DE-DTI4WUSC-Ba3fBYEU.js`),__vite__mapDeps([11,1,2]),import.meta.url),"./locales/el-GR.json":()=>n(()=>import(`./el-GR-ZXDJ2OS4-CpEbk42T.js`),__vite__mapDeps([12,1,2]),import.meta.url),"./locales/en.json":()=>n(()=>import(`./en-CTDJDZ6K-C36Iqh9O.js`),__vite__mapDeps([13,14,1,2]),import.meta.url),"./locales/es-ES.json":()=>n(()=>import(`./es-ES-DYQHAD43-Ba-6t0Wr.js`),__vite__mapDeps([15,1,2]),import.meta.url),"./locales/eu-ES.json":()=>n(()=>import(`./eu-ES-QDSYU5Y3-CYzUKQ2_.js`),__vite__mapDeps([16,1,2]),import.meta.url),"./locales/fa-IR.json":()=>n(()=>import(`./fa-IR-26LZG4PM-CxLc7ohL.js`),__vite__mapDeps([17,1,2]),import.meta.url),"./locales/fi-FI.json":()=>n(()=>import(`./fi-FI-6YS4KDE4-DtYLOEJY.js`),__vite__mapDeps([18,1,2]),import.meta.url),"./locales/fr-FR.json":()=>n(()=>import(`./fr-FR-BRLLPTZC-9O_U5gdi.js`),__vite__mapDeps([19,1,2]),import.meta.url),"./locales/gl-ES.json":()=>n(()=>import(`./gl-ES-OKUZTLYG-Bb7TO64O.js`),__vite__mapDeps([20,1,2]),import.meta.url),"./locales/he-IL.json":()=>n(()=>import(`./he-IL-26MGYIU7-CQW1igm9.js`),__vite__mapDeps([21,1,2]),import.meta.url),"./locales/hi-IN.json":()=>n(()=>import(`./hi-IN-Q4ZOGTP2-BM91ENLs.js`),__vite__mapDeps([22,1,2]),import.meta.url),"./locales/hu-HU.json":()=>n(()=>import(`./hu-HU-P2OXPSN5-HiGbsUwM.js`),__vite__mapDeps([23,1,2]),import.meta.url),"./locales/id-ID.json":()=>n(()=>import(`./id-ID-2EIKXYN6-DEG8vRZ2.js`),__vite__mapDeps([24,1,2]),import.meta.url),"./locales/it-IT.json":()=>n(()=>import(`./it-IT-4CFKVXI2-DSrGqCKD.js`),__vite__mapDeps([25,1,2]),import.meta.url),"./locales/ja-JP.json":()=>n(()=>import(`./ja-JP-MAND2Z4V-OFpEymIv.js`),__vite__mapDeps([26,1,2]),import.meta.url),"./locales/kaa.json":()=>n(()=>import(`./kaa-HQRTCXTJ-CpOJ_vn4.js`),__vite__mapDeps([27,1,2]),import.meta.url),"./locales/kab-KAB.json":()=>n(()=>import(`./kab-KAB-JKIKKTGH-CNPzzJH6.js`),__vite__mapDeps([28,1,2]),import.meta.url),"./locales/kk-KZ.json":()=>n(()=>import(`./kk-KZ-HXQ63ZFC-CgtjU5JI.js`),__vite__mapDeps([29,1,2]),import.meta.url),"./locales/km-KH.json":()=>n(()=>import(`./km-KH-PKL3LSGX-BAJh8UnF.js`),__vite__mapDeps([30,1,2]),import.meta.url),"./locales/ko-KR.json":()=>n(()=>import(`./ko-KR-KXLREZX3-BshOksBX.js`),__vite__mapDeps([31,1,2]),import.meta.url),"./locales/ku-TR.json":()=>n(()=>import(`./ku-TR-MJ4IER3X-Bi3YtiD-.js`),__vite__mapDeps([32,1,2]),import.meta.url),"./locales/lt-LT.json":()=>n(()=>import(`./lt-LT-H6WFQ6FJ-DQ2W0g7h.js`),__vite__mapDeps([33,1,2]),import.meta.url),"./locales/lv-LV.json":()=>n(()=>import(`./lv-LV-GOCK6SJW-DeqTo8T7.js`),__vite__mapDeps([34,1,2]),import.meta.url),"./locales/mr-IN.json":()=>n(()=>import(`./mr-IN-IXVLDMEQ-CnH5Wjc7.js`),__vite__mapDeps([35,1,2]),import.meta.url),"./locales/my-MM.json":()=>n(()=>import(`./my-MM-YG6MYTTD-BefEpouO.js`),__vite__mapDeps([36,1,2]),import.meta.url),"./locales/nb-NO.json":()=>n(()=>import(`./nb-NO-XGWJISD2-CNRrlrPY.js`),__vite__mapDeps([37,1,2]),import.meta.url),"./locales/nl-NL.json":()=>n(()=>import(`./nl-NL-XVDVCPNC-CuLTw3kL.js`),__vite__mapDeps([38,1,2]),import.meta.url),"./locales/nn-NO.json":()=>n(()=>import(`./nn-NO-EMX5MJX5-NHFRnQkl.js`),__vite__mapDeps([39,1,2]),import.meta.url),"./locales/oc-FR.json":()=>n(()=>import(`./oc-FR-ROEINTVO-8kCbAtcr.js`),__vite__mapDeps([40,1,2]),import.meta.url),"./locales/pa-IN.json":()=>n(()=>import(`./pa-IN-ZYN6SUDY-Dh8USSIe.js`),__vite__mapDeps([41,1,2]),import.meta.url),"./locales/percentages.json":()=>n(()=>import(`./percentages-5DKR754L-RQFE76Sg.js`),__vite__mapDeps([42,43,1,2]),import.meta.url),"./locales/pl-PL.json":()=>n(()=>import(`./pl-PL-6VTG7PHC-BMbgP62B.js`),__vite__mapDeps([44,1,2]),import.meta.url),"./locales/pt-BR.json":()=>n(()=>import(`./pt-BR-5YFKRR5G-CyrwFw_N.js`),__vite__mapDeps([45,1,2]),import.meta.url),"./locales/pt-PT.json":()=>n(()=>import(`./pt-PT-GEIXXZ67-SpK5vaGR.js`),__vite__mapDeps([46,1,2]),import.meta.url),"./locales/ro-RO.json":()=>n(()=>import(`./ro-RO-E2P6TFZI-90dn2iUp.js`),__vite__mapDeps([47,1,2]),import.meta.url),"./locales/ru-RU.json":()=>n(()=>import(`./ru-RU-YBIIY43T-Cl52NZnQ.js`),__vite__mapDeps([48,1,2]),import.meta.url),"./locales/si-LK.json":()=>n(()=>import(`./si-LK-673C2CI2-DMSUxT-y.js`),__vite__mapDeps([49,1,2]),import.meta.url),"./locales/sk-SK.json":()=>n(()=>import(`./sk-SK-CKZHQ4AP-DUDai5Oe.js`),__vite__mapDeps([50,1,2]),import.meta.url),"./locales/sl-SI.json":()=>n(()=>import(`./sl-SI-557H2GWM-BbLeATfl.js`),__vite__mapDeps([51,1,2]),import.meta.url),"./locales/sv-SE.json":()=>n(()=>import(`./sv-SE-XOPKKDWS-BBa-AcMf.js`),__vite__mapDeps([52,1,2]),import.meta.url),"./locales/ta-IN.json":()=>n(()=>import(`./ta-IN-XBH7DQI3-9uR7ADzx.js`),__vite__mapDeps([53,1,2]),import.meta.url),"./locales/th-TH.json":()=>n(()=>import(`./th-TH-TOCWH3R4-Box9U3ny.js`),__vite__mapDeps([54,1,2]),import.meta.url),"./locales/tr-TR.json":()=>n(()=>import(`./tr-TR-GXW6CYY5-BA8pS3C5.js`),__vite__mapDeps([55,1,2]),import.meta.url),"./locales/uk-UA.json":()=>n(()=>import(`./uk-UA-IJKTNUDG-B6hoHqzM.js`),__vite__mapDeps([56,1,2]),import.meta.url),"./locales/uz-UZ.json":()=>n(()=>import(`./uz-UZ-TBZZEA4V-CPuftH33.js`),__vite__mapDeps([57,1,2]),import.meta.url),"./locales/vi-VN.json":()=>n(()=>import(`./vi-VN-MULSGNVB-yRFd9OXl.js`),__vite__mapDeps([58,1,2]),import.meta.url),"./locales/zh-CN.json":()=>n(()=>import(`./zh-CN-MVX3E32U-VzUIXB4K.js`),__vite__mapDeps([59,1,2]),import.meta.url),"./locales/zh-HK.json":()=>n(()=>import(`./zh-HK-JNU5RLIE-i0G2jHO_.js`),__vite__mapDeps([60,1,2]),import.meta.url),"./locales/zh-TW.json":()=>n(()=>import(`./zh-TW-LENVCA6T-BkHZg3jv.js`),__vite__mapDeps([61,1,2]),import.meta.url)}),Ty=85,Ey={code:`en`,label:`English`},Dy=[Ey,...[{code:`ar-SA`,label:`العربية`,rtl:!0},{code:`bg-BG`,label:`Български`},{code:`ca-ES`,label:`Català`},{code:`cs-CZ`,label:`Česky`},{code:`de-DE`,label:`Deutsch`},{code:`el-GR`,label:`Ελληνικά`},{code:`es-ES`,label:`Español`},{code:`eu-ES`,label:`Euskara`},{code:`fa-IR`,label:`فارسی`,rtl:!0},{code:`fi-FI`,label:`Suomi`},{code:`fr-FR`,label:`Français`},{code:`gl-ES`,label:`Galego`},{code:`he-IL`,label:`עברית`,rtl:!0},{code:`hi-IN`,label:`हिन्दी`},{code:`hu-HU`,label:`Magyar`},{code:`id-ID`,label:`Bahasa Indonesia`},{code:`it-IT`,label:`Italiano`},{code:`ja-JP`,label:`日本語`},{code:`kab-KAB`,label:`Taqbaylit`},{code:`kk-KZ`,label:`Қазақ тілі`},{code:`ko-KR`,label:`한국어`},{code:`ku-TR`,label:`Kurdî`},{code:`lt-LT`,label:`Lietuvių`},{code:`lv-LV`,label:`Latviešu`},{code:`my-MM`,label:`Burmese`},{code:`nb-NO`,label:`Norsk bokmål`},{code:`nl-NL`,label:`Nederlands`},{code:`nn-NO`,label:`Norsk nynorsk`},{code:`oc-FR`,label:`Occitan`},{code:`pa-IN`,label:`ਪੰਜਾਬੀ`},{code:`pl-PL`,label:`Polski`},{code:`pt-BR`,label:`Português Brasileiro`},{code:`pt-PT`,label:`Português`},{code:`ro-RO`,label:`Română`},{code:`ru-RU`,label:`Русский`},{code:`sk-SK`,label:`Slovenčina`},{code:`sv-SE`,label:`Svenska`},{code:`sl-SI`,label:`Slovenščina`},{code:`tr-TR`,label:`Türkçe`},{code:`uk-UA`,label:`Українська`},{code:`zh-CN`,label:`简体中文`},{code:`zh-TW`,label:`繁體中文`},{code:`vi-VN`,label:`Tiếng Việt`},{code:`mr-IN`,label:`मराठी`}].filter(e=>ec[e.code]>=Ty).sort((e,t)=>e.label>t.label?1:-1)],Oy=`__test__`;Vt()&&Dy.unshift({code:Oy,label:`test language`},{code:`${Oy}.rtl`,label:`test language (rtl)`,rtl:!0});var ky=Ey,Ay={},jy=async e=>{if(ky=e,document.documentElement.dir=ky.rtl?`rtl`:`ltr`,document.documentElement.lang=ky.code,e.code.startsWith(Oy))Ay={};else try{Ay=await wy(`./locales/${ky.code}.json`)}catch(t){console.error(`Failed to load language ${e.code}:`,t.message),Ay=$s}Cy.set(Py,e.code)},My=()=>ky,Ny=(e,t)=>{for(let n=0;n<t.length;++n){let r=t[n];if(e[r]===void 0)return;e=e[r]}if(typeof e==`string`)return e},K=(e,t,n)=>{if(ky.code.startsWith(Oy))return`\u202A[[${t?`${e}(${JSON.stringify(t).slice(1,-1)})`:e}]]\u202C`;let i=e.split(`.`),a=Ny(Ay,i)||Ny($s,i)||n;if(a===void 0){let t=`Can't find translation for ${e}`;if(r.PROD)return console.warn(t),``;throw Error(t)}if(t)for(let e in t)a=a.replace(`{{${e}}}`,String(t[e]));return a},Py=yc(Ey.code),Fy=()=>({t:K,langCode:by(Py)}),Iy=e=>`var(--icon-fill-color)`,Ly=e=>e===R.LIGHT?`#fff`:`#1e1e1e`,q=(e,t=512)=>{let{width:n=512,height:r=n,mirror:i,style:a,...o}=typeof t==`number`?{width:t}:t;return(0,W.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,role:`img`,viewBox:`0 0 ${n} ${r}`,className:U({"rtl-mirror":i}),style:a,...o,children:typeof e==`string`?(0,W.jsx)(`path`,{fill:`currentColor`,d:e}):e})},J={width:24,height:24,fill:`none`,strokeWidth:2,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Y={width:20,height:20,fill:`none`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`},Ry={width:40,height:20};q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:3,y:8,width:18,height:4,rx:1}),(0,W.jsx)(`line`,{x1:12,y1:8,x2:12,y2:21}),(0,W.jsx)(`path`,{d:`M19 12v7a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-7`}),(0,W.jsx)(`path`,{d:`M7.5 8a2.5 2.5 0 0 1 0 -5a4.8 8 0 0 1 4.5 5a4.8 8 0 0 1 4.5 -5a2.5 2.5 0 0 1 0 5`})]}),J);var zy=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 19a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`path`,{d:`M3 6a9 9 0 0 1 9 0a9 9 0 0 1 9 0`}),(0,W.jsx)(`line`,{x1:`3`,y1:`6`,x2:`3`,y2:`19`}),(0,W.jsx)(`line`,{x1:`12`,y1:`6`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`21`,y1:`6`,x2:`21`,y2:`19`})]}),J),By=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`12`,y1:`5`,x2:`12`,y2:`19`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`})]}),J),Vy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`19`,r:`1`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`5`,r:`1`})]}),J),Hy=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,W.jsx)(`path`,{d:`M19 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`})]}),J),Uy=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 4v6l-2 4v2h10v-2l-2 -4v-6`}),(0,W.jsx)(`line`,{x1:`12`,y1:`16`,x2:`12`,y2:`21`}),(0,W.jsx)(`line`,{x1:`8`,y1:`4`,x2:`16`,y2:`4`})]}),J),Wy=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M6.5 9.5l3.5 -3`}),(0,W.jsx)(`path`,{d:`M14 5.5l3 1.5`}),(0,W.jsx)(`path`,{d:`M18.5 10l-2.5 7`}),(0,W.jsx)(`path`,{d:`M13.5 17.5l-7 -5`})]}),J),Gy=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`UnlockedIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:6,y:1,width:9,height:9,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M6.399 9.561V5.175c0-.93.401-1.823 1.116-2.48a3.981 3.981 0 0 1 2.693-1.028c1.01 0 1.98.37 2.694 1.027.715.658 1.116 1.55 1.116 2.481`,fill:`#fff`})}),(0,W.jsx)(`g`,{mask:`url(#UnlockedIcon)`,children:(0,W.jsx)(`path`,{stroke:`none`,d:`M5.149 9.561v1.25h2.5v-1.25h-2.5Zm5.06-7.894V.417v1.25Zm2.559 3.508v1.25h2.5v-1.25h-2.5ZM7.648 8.51V5.175h-2.5V8.51h2.5Zm0-3.334c0-.564.243-1.128.713-1.561L6.668 1.775c-.959.883-1.52 2.104-1.52 3.4h2.5Zm.713-1.561a2.732 2.732 0 0 1 1.847-.697v-2.5c-1.31 0-2.585.478-3.54 1.358L8.36 3.614Zm1.847-.697c.71 0 1.374.26 1.847.697l1.694-1.839a5.231 5.231 0 0 0-3.54-1.358v2.5Zm1.847.697c.47.433.713.997.713 1.561h2.5c0-1.296-.56-2.517-1.52-3.4l-1.693 1.839Z`,fill:`currentColor`})})]}),Y),Ky=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M13.542 8.542H6.458a2.5 2.5 0 0 0-2.5 2.5v3.75a2.5 2.5 0 0 0 2.5 2.5h7.084a2.5 2.5 0 0 0 2.5-2.5v-3.75a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{d:`M10 13.958a1.042 1.042 0 1 0 0-2.083 1.042 1.042 0 0 0 0 2.083Z`}),(0,W.jsx)(`path`,{d:`M6.667 8.333V5.417C6.667 3.806 8.159 2.5 10 2.5c1.841 0 3.333 1.306 3.333 2.917v2.916`})]}),Y),qy=q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M12 2a5 5 0 0 1 5 5v3a3 3 0 0 1 3 3v6a3 3 0 0 1 -3 3h-10a3 3 0 0 1 -3 -3v-6a3 3 0 0 1 3 -3v-3a5 5 0 0 1 5 -5m0 12a2 2 0 0 0 -1.995 1.85l-.005 .15a2 2 0 1 0 2 -2m0 -10a3 3 0 0 0 -3 3v3h6v-3a3 3 0 0 0 -3 -3`})}),{width:24,height:24}),Jy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M38.5 83.5c-14-2-17.833-10.473-21-22.5C14.333 48.984 12 22 12 12.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m12.005 10.478 7.905 14.423L6 25.75l6.005-15.273Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M12.005 10.478c1.92 3.495 3.838 7 7.905 14.423m-7.905-14.423c3.11 5.683 6.23 11.368 7.905 14.423m0 0c-3.68.226-7.35.455-13.91.85m13.91-.85c-5.279.33-10.566.647-13.91.85m0 0c1.936-4.931 3.882-9.86 6.005-15.273M6 25.75c2.069-5.257 4.135-10.505 6.005-15.272`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:41,height:94,fill:`none`}),Yy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M18.026 1.232c-5.268 13.125-5.548 33.555 3.285 42.311 8.823 8.75 33.31 12.304 42.422 13.523`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m72.181 59.247-13.058-10-2.948 13.62 16.006-3.62Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M72.181 59.247c-3.163-2.429-6.337-4.856-13.058-10m13.058 10c-5.145-3.936-10.292-7.882-13.058-10m0 0c-.78 3.603-1.563 7.196-2.948 13.62m2.948-13.62c-1.126 5.168-2.24 10.346-2.948 13.62m0 0c5.168-1.166 10.334-2.343 16.006-3.62m-16.006 3.62c5.51-1.248 11.01-2.495 16.006-3.62`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:85,height:71,fill:`none`}),Xy=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M1 77c14-2 31.833-11.973 35-24 3.167-12.016-6-35-9.5-43.5`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`m24.165 1.093-2.132 16.309 13.27-4.258-11.138-12.05Z`,fill:`currentColor`}),(0,W.jsx)(`path`,{d:`M24.165 1.093c-.522 3.953-1.037 7.916-2.132 16.309m2.131-16.309c-.835 6.424-1.68 12.854-2.13 16.308m0 0c3.51-1.125 7.013-2.243 13.27-4.257m-13.27 4.257c5.038-1.608 10.08-3.232 13.27-4.257m0 0c-3.595-3.892-7.197-7.777-11.14-12.05m11.14 12.05c-3.837-4.148-7.667-8.287-11.14-12.05`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`})]}),{width:38,height:78,fill:`none`});q((0,W.jsx)(`g`,{fill:`currentColor`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),{width:40,height:40,fill:`none`});var Zy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 6l4.153 11.793a0.365 .365 0 0 0 .331 .207a0.366 .366 0 0 0 .332 -.207l2.184 -4.793l4.787 -1.994a0.355 .355 0 0 0 .213 -.323a0.355 .355 0 0 0 -.213 -.323l-11.787 -4.36z`}),(0,W.jsx)(`path`,{d:`M13.5 13.5l4.5 4.5`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),Qy=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{d:`M4.028 13.252c-.657 -.972 -1.028 -2.078 -1.028 -3.252c0 -3.866 4.03 -7 9 -7s9 3.134 9 7s-4.03 7 -9 7c-1.913 0 -3.686 -.464 -5.144 -1.255`}),(0,W.jsx)(`path`,{d:`M5 15m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 17c0 1.42 .316 2.805 1 4`})]}),{fill:`none`,width:22,height:22,strokeWidth:1.25}),$y=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`})]}),J),eb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.5 20.4l-6.9 -6.9c-.781 -.781 -.781 -2.219 0 -3l6.9 -6.9c.781 -.781 2.219 -.781 3 0l6.9 6.9c.781 .781 .781 2.219 0 3l-6.9 6.9c-.781 .781 -2.219 .781 -3 0z`})]}),J),tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})]}),J),nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`5`,y1:`12`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`16`,x2:`19`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`8`,x2:`19`,y2:`12`})]}),J),rb=q((0,W.jsx)(`path`,{d:`M4.167 10h11.666`,strokeWidth:`1.5`}),Y),ib=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 17v-12c0 -1.121 -.879 -2 -2 -2s-2 .879 -2 2v12l2 2l2 -2z`}),(0,W.jsx)(`path`,{d:`M16 7h4`}),(0,W.jsx)(`path`,{d:`M18 19h-13a2 2 0 1 1 0 -4h4a2 2 0 1 0 0 -4h-3`})]}),J),ab=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m7.643 15.69 7.774-7.773a2.357 2.357 0 1 0-3.334-3.334L4.31 12.357a3.333 3.333 0 0 0-.977 2.357v1.953h1.953c.884 0 1.732-.352 2.357-.977Z`}),(0,W.jsx)(`path`,{d:`m11.25 5.417 3.333 3.333`})]}),Y),ob=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`7`,y2:`20`}),(0,W.jsx)(`line`,{x1:`14`,y1:`20`,x2:`21`,y2:`20`}),(0,W.jsx)(`line`,{x1:`6.9`,y1:`15`,x2:`13.8`,y2:`15`}),(0,W.jsx)(`line`,{x1:`10.2`,y1:`6.3`,x2:`16`,y2:`20`}),(0,W.jsx)(`polyline`,{points:`5 20 11 4 13 4 20 20`})]}),J),sb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),cb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M12.5 6.667h.01`}),(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`}),(0,W.jsx)(`path`,{d:`m3.333 12.5 3.334-3.333c.773-.745 1.726-.745 2.5 0l4.166 4.166`}),(0,W.jsx)(`path`,{d:`m11.667 11.667.833-.834c.774-.744 1.726-.744 2.5 0l1.667 1.667`})]}),Y),lb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M19 20h-10.5l-4.21 -4.3a1 1 0 0 1 0 -1.41l10 -10a1 1 0 0 1 1.41 0l5 5a1 1 0 0 1 0 1.41l-9.2 9.3`}),(0,W.jsx)(`path`,{d:`M18 13.3l-6.3 -6.3`})]}),J),ub=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M10 4.167v11.666M4.167 10h11.666`}),Y),db=q((0,W.jsx)(`path`,{d:`M5 10h10`,strokeWidth:`1.25`}),Y),fb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`}),(0,W.jsx)(`path`,{d:`M3.268 12.043a7.017 7.017 0 0 0 6.634 4.957a7.012 7.012 0 0 0 7.043 -6.131a7 7 0 0 0 -5.314 -7.672a7.021 7.021 0 0 0 -8.241 4.403`}),(0,W.jsx)(`path`,{d:`M3 4v4h4`})]}),J),pb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 5.833h13.334M8.333 9.167v5M11.667 9.167v5M4.167 5.833l.833 10c0 .92.746 1.667 1.667 1.667h6.666c.92 0 1.667-.746 1.667-1.667l.833-10M7.5 5.833v-2.5c0-.46.373-.833.833-.833h3.334c.46 0 .833.373.833.833v2.5`}),Y),mb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`polyline`,{points:`12 16 18 10 12 4`}),(0,W.jsx)(`polyline`,{points:`8 4 2 10 8 16`})]}),Y),hb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M14.375 6.458H8.958a2.5 2.5 0 0 0-2.5 2.5v5.417a2.5 2.5 0 0 0 2.5 2.5h5.417a2.5 2.5 0 0 0 2.5-2.5V8.958a2.5 2.5 0 0 0-2.5-2.5Z`}),(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M11.667 3.125c.517 0 .986.21 1.325.55.34.338.55.807.55 1.325v1.458H8.333c-.485 0-.927.185-1.26.487-.343.312-.57.75-.609 1.24l-.005 5.357H5a1.87 1.87 0 0 1-1.326-.55 1.87 1.87 0 0 1-.549-1.325V5c0-.518.21-.987.55-1.326.338-.34.807-.549 1.325-.549h6.667Z`})]}),Y),gb=q((0,W.jsx)(`path`,{clipRule:`evenodd`,d:`M10 2.5h.328a6.25 6.25 0 0 0 6.6 10.372A7.5 7.5 0 1 1 10 2.493V2.5Z`,stroke:`currentColor`}),Y),_b=q((0,W.jsx)(`g`,{stroke:`currentColor`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M10 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM10 4.167V2.5M14.167 5.833l1.166-1.166M15.833 10H17.5M14.167 14.167l1.166 1.166M10 15.833V17.5M5.833 14.167l-1.166 1.166M5 10H3.333M5.833 5.833 4.667 4.667`})}),{...Y,strokeWidth:1.5}),vb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`6`,x2:`20`,y2:`6`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`18`,x2:`20`,y2:`18`})]}),J),yb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M3.333 14.167v1.666c0 .92.747 1.667 1.667 1.667h10c.92 0 1.667-.746 1.667-1.667v-1.666M5.833 9.167 10 13.333l4.167-4.166M10 3.333v10`}),Y),bb=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),xb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,W.jsx)(`line`,{x1:`12`,y1:`17`,x2:`12`,y2:`17.01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J),Sb=q((0,W.jsx)(`path`,{strokeWidth:`1.25`,d:`M9.167 5.833H5.833c-1.254 0-2.5 1.282-2.5 2.5v5.834c0 1.283 1.252 2.5 2.5 2.5h5.834c1.251 0 2.5-1.25 2.5-2.5v-3.334M8.333 11.667l8.334-8.334M12.5 3.333h4.167V7.5`}),Y),Cb=q((0,W.jsx)(`path`,{d:`M7.5 15.833c-3.583 1.167-3.583-2.083-5-2.5m10 4.167v-2.917c0-.833.083-1.166-.417-1.666 2.334-.25 4.584-1.167 4.584-5a3.833 3.833 0 0 0-1.084-2.667 3.5 3.5 0 0 0-.083-2.667s-.917-.25-2.917 1.084a10.25 10.25 0 0 0-5.166 0C5.417 2.333 4.5 2.583 4.5 2.583a3.5 3.5 0 0 0-.083 2.667 3.833 3.833 0 0 0-1.084 2.667c0 3.833 2.25 4.75 4.584 5-.5.5-.5 1-.417 1.666V17.5`,strokeWidth:`1.25`}),Y),wb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M7.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM12.5 10.833a.833.833 0 1 0 0-1.666.833.833 0 0 0 0 1.666ZM6.25 6.25c2.917-.833 4.583-.833 7.5 0M5.833 13.75c2.917.833 5.417.833 8.334 0`}),(0,W.jsx)(`path`,{d:`M12.917 14.167c0 .833 1.25 2.5 1.666 2.5 1.25 0 2.361-1.39 2.917-2.5.556-1.39.417-4.861-1.25-9.584-1.214-.846-2.5-1.116-3.75-1.25l-.833 2.084M7.083 14.167c0 .833-1.13 2.5-1.526 2.5-1.191 0-2.249-1.39-2.778-2.5-.529-1.39-.397-4.861 1.19-9.584 1.157-.846 2.318-1.116 3.531-1.25l.833 2.084`})]}),Y),Tb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4l11.733 16h4.267l-11.733 -16z`}),(0,W.jsx)(`path`,{d:`M4 20l6.768 -6.768m2.46 -2.46l6.772 -6.772`})]}),J),Eb=q((0,W.jsx)(`polyline`,{fill:`none`,stroke:`currentColor`,points:`20 6 9 17 4 12`}),{width:24,height:24}),Db=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M8.333 11.667a2.917 2.917 0 0 0 4.167 0l3.333-3.334a2.946 2.946 0 1 0-4.166-4.166l-.417.416`}),(0,W.jsx)(`path`,{d:`M11.667 8.333a2.917 2.917 0 0 0-4.167 0l-3.333 3.334a2.946 2.946 0 0 0 4.166 4.166l.417-.416`})]}),Y),Ob=q(`M433.941 129.941l-83.882-83.882A48 48 0 0 0 316.118 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V163.882a48 48 0 0 0-14.059-33.941zM224 416c-35.346 0-64-28.654-64-64 0-35.346 28.654-64 64-64s64 28.654 64 64c0 35.346-28.654 64-64 64zm96-304.52V212c0 6.627-5.373 12-12 12H76c-6.627 0-12-5.373-12-12V108c0-6.627 5.373-12 12-12h228.52c3.183 0 6.235 1.264 8.485 3.515l3.48 3.48A11.996 11.996 0 0 1 320 111.48z`,{width:448,height:512}),kb=q(`M252 54L203 8a28 27 0 00-20-8H28C12 0 0 12 0 27v195c0 15 12 26 28 26h204c15 0 28-11 28-26V73a28 27 0 00-8-19zM130 213c-21 0-37-16-37-36 0-19 16-35 37-35 20 0 37 16 37 35 0 20-17 36-37 36zm56-169v56c0 4-4 6-7 6H44c-4 0-7-2-7-6V42c0-4 3-7 7-7h133l4 2 3 2a7 7 0 012 5z M296 201l87 95-188 205-78 9c-10 1-19-8-18-20l9-84zm141-14l-41-44a31 31 0 00-46 0l-38 41 87 95 38-42c13-14 13-36 0-50z`,{width:448,height:512}),Ab=q((0,W.jsx)(`path`,{d:`m9.257 6.351.183.183H15.819c.34 0 .727.182 1.051.506.323.323.505.708.505 1.05v5.819c0 .316-.183.7-.52 1.035-.337.338-.723.522-1.037.522H4.182c-.352 0-.74-.181-1.058-.5-.318-.318-.499-.705-.499-1.057V5.182c0-.351.181-.736.5-1.054.32-.321.71-.503 1.057-.503H6.53l2.726 2.726Z`,strokeWidth:`1.25`}),Y);q(`M384 112v352c0 26.51-21.49 48-48 48H48c-26.51 0-48-21.49-48-48V112c0-26.51 21.49-48 48-48h80c0-35.29 28.71-64 64-64s64 28.71 64 64h80c26.51 0 48 21.49 48 48zM192 40c-13.255 0-24 10.745-24 24s10.745 24 24 24 24-10.745 24-24-10.745-24-24-24m96 114v-20a6 6 0 0 0-6-6H102a6 6 0 0 0-6 6v20a6 6 0 0 0 6 6h180a6 6 0 0 0 6-6z`,{width:384,height:512}),q(`M204.3 5C104.9 24.4 24.8 104.3 5.2 203.4c-37 187 131.7 326.4 258.8 306.7 41.2-6.4 61.4-54.6 42.5-91.7-23.1-45.4 9.9-98.4 60.9-98.4h79.7c35.8 0 64.8-29.6 64.9-65.3C511.5 97.1 368.1-26.9 204.3 5zM96 320c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm32-128c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128-64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32zm128 64c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z`);var jb=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 16l1.465 1.638a2 2 0 1 1 -3.015 .099l1.55 -1.737z`}),(0,W.jsx)(`path`,{d:`M13.737 9.737c2.299 -2.3 3.23 -5.095 2.081 -6.245c-1.15 -1.15 -3.945 -.217 -6.244 2.082c-2.3 2.299 -3.231 5.095 -2.082 6.244c1.15 1.15 3.946 .218 6.245 -2.081z`}),(0,W.jsx)(`path`,{d:`M7.492 11.818c.362 .362 .768 .676 1.208 .934l6.895 4.047c1.078 .557 2.255 -.075 3.692 -1.512c1.437 -1.437 2.07 -2.614 1.512 -3.692c-.372 -.718 -1.72 -3.017 -4.047 -6.895a6.015 6.015 0 0 0 -.934 -1.208`})]}),J),Mb=q((0,W.jsx)(`g`,{strokeWidth:1.5,children:(0,W.jsx)(`path`,{d:`M6 18l12 -12`})}),J),Nb=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 8h.01`}),(0,W.jsx)(`path`,{d:`M12 20h-5a3 3 0 0 1 -3 -3v-10a3 3 0 0 1 3 -3h10a3 3 0 0 1 3 3v5`}),(0,W.jsx)(`path`,{d:`M4 15l4 -4c.928 -.893 2.072 -.893 3 0l4 4`}),(0,W.jsx)(`path`,{d:`M14 14l1 -1c.617 -.593 1.328 -.793 2.009 -.598`}),(0,W.jsx)(`path`,{d:`M19 16v6`}),(0,W.jsx)(`path`,{d:`M22 19l-3 3l-3 -3`})]}),J),Pb=q(`M216 0h80c13.3 0 24 10.7 24 24v168h87.7c17.8 0 26.7 21.5 14.1 34.1L269.7 378.3c-7.5 7.5-19.8 7.5-27.3 0L90.1 226.1c-12.6-12.6-3.7-34.1 14.1-34.1H192V24c0-13.3 10.7-24 24-24zm296 376v112c0 13.3-10.7 24-24 24H24c-13.3 0-24-10.7-24-24V376c0-13.3 10.7-24 24-24h146.7l49 49c20.1 20.1 52.5 20.1 72.6 0l49-49H488c13.3 0 24 10.7 24 24zm-124 88c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20zm64 0c0-11-9-20-20-20s-20 9-20 20 9 20 20 20 20-9 20-20z`,{width:512,height:512});q(`M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512}),q(`M416 208H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h384c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z`,{width:448,height:512});var Fb=q(`M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z`);q(`M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z`);var Ib=q((0,W.jsx)(`path`,{d:`M7.5 10.833 4.167 7.5 7.5 4.167M4.167 7.5h9.166a3.333 3.333 0 0 1 0 6.667H12.5`,strokeWidth:`1.25`}),Y),Lb=q((0,W.jsx)(`path`,{d:`M12.5 10.833 15.833 7.5 12.5 4.167M15.833 7.5H6.667a3.333 3.333 0 1 0 0 6.667H7.5`,strokeWidth:`1.25`}),Y),Rb=q(`M504 256c0 136.997-111.043 248-248 248S8 392.997 8 256C8 119.083 119.043 8 256 8s248 111.083 248 248zM262.655 90c-54.497 0-89.255 22.957-116.549 63.758-3.536 5.286-2.353 12.415 2.715 16.258l34.699 26.31c5.205 3.947 12.621 3.008 16.665-2.122 17.864-22.658 30.113-35.797 57.303-35.797 20.429 0 45.698 13.148 45.698 32.958 0 14.976-12.363 22.667-32.534 33.976C247.128 238.528 216 254.941 216 296v4c0 6.627 5.373 12 12 12h56c6.627 0 12-5.373 12-12v-1.333c0-28.462 83.186-29.647 83.186-106.667 0-58.002-60.165-102-116.531-102zM256 338c-25.365 0-46 20.635-46 46 0 25.364 20.635 46 46 46s46-20.636 46-46c0-25.365-20.635-46-46-46z`,{mirror:!0}),zb=q((0,W.jsx)(`path`,{d:`M5 12.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 7.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM15 17.5a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5ZM7.25 8.917l5.5-2.834M7.25 11.083l5.5 2.834`,strokeWidth:`1.5`}),Y);q(`M256 32c14.2 0 27.3 7.5 34.5 19.8l216 368c7.3 12.4 7.3 27.7 .2 40.1S486.3 480 472 480H40c-14.3 0-27.6-7.7-34.7-20.1s-7-27.8 .2-40.1l216-368C228.7 39.5 241.8 32 256 32zm0 128c-13.3 0-24 10.7-24 24V296c0 13.3 10.7 24 24 24s24-10.7 24-24V184c0-13.3-10.7-24-24-24zm32 224a32 32 0 1 0 -64 0 32 32 0 1 0 64 0z`),q(`M16 5l-1.42 1.42-1.59-1.59V16h-1.98V4.83L9.42 6.42 8 5l4-4 4 4zm4 5v11c0 1.1-.9 2-2 2H6c-1.11 0-2-.9-2-2V10c0-1.11.89-2 2-2h3v2H6v11h12V10h-3V8h3c1.1 0 2 .89 2 2z`,{width:24,height:24}),q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`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`}),(0,W.jsx)(`path`,{d:`M12 14v-11`}),(0,W.jsx)(`path`,{d:`M9 6l3 -3l3 3`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{fill:`currentColor`,d:`M40 5.6v6.1l-4.1.7c-8.9 1.4-16.5 6.9-20.6 15C13 32 10.9 43 12.4 43c.4 0 2.4-1.3 4.4-3 5-3.9 12.1-7 18.2-7.7l5-.6v12.8l11.2-11.3L62.5 22 51.2 10.8 40-.5v6.1zm10.2 22.6L44 34.5v-6.8l-6.9.6c-3.9.3-9.8 1.7-13.2 3.1-3.5 1.4-6.5 2.4-6.7 2.2-.9-1 3-7.5 6.4-10.8C28 18.6 34.4 16 40.1 16c3.7 0 3.9-.1 3.9-3.2V9.5l6.2 6.3 6.3 6.2-6.3 6.2z`}),(0,W.jsx)(`path`,{stroke:`currentColor`,fill:`currentColor`,d:`M0 36v20h48v-6.2c0-6 0-6.1-2-4.3-1.1 1-2 2.9-2 4.2V52H4V34c0-17.3-.1-18-2-18s-2 .7-2 20z`})]}),{width:64,height:64}),q((0,W.jsx)(`path`,{stroke:`currentColor`,strokeWidth:`40`,fill:`currentColor`,d:`M148 560a318 318 0 0 0 522 110 316 316 0 0 0 0-450 316 316 0 0 0-450 0c-11 11-21 22-30 34v4h47c25 0 46 21 46 46s-21 45-46 45H90c-13 0-25-6-33-14-9-9-14-20-14-33V156c0-25 20-45 45-45s45 20 45 45v32l1 1a401 401 0 0 1 623 509l212 212a42 42 0 0 1-59 59L698 757A401 401 0 0 1 65 570a42 42 0 0 1 83-10z`}),{width:1024});var Bb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 10l0 10`}),(0,W.jsx)(`path`,{d:`M12 10l4 4`}),(0,W.jsx)(`path`,{d:`M12 10l-4 4`}),(0,W.jsx)(`path`,{d:`M4 4l16 0`})]}),Vb=(0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 5l0 14`}),(0,W.jsx)(`path`,{d:`M16 9l-4 -4`}),(0,W.jsx)(`path`,{d:`M8 9l4 -4`})]}),Hb=q(Vb,J),Ub=q(Vb,{...J,style:{transform:`rotate(180deg)`}}),Wb=q(Bb,J),Gb=q(Bb,{...J,style:{transform:`rotate(180deg)`}}),Kb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v7.083c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V8.125c0-.92-.746-1.667-1.666-1.667ZM6.875 6.458h-.417c-.92 0-1.666.747-1.666 1.667v3.75c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667v-3.75c0-.92-.747-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),qb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 3.125h-.417c-.92 0-1.666.746-1.666 1.667v7.083c0 .92.746 1.667 1.666 1.667h.417c.92 0 1.667-.746 1.667-1.667V4.792c0-.92-.747-1.667-1.667-1.667ZM13.542 5.817h-.417c-.92 0-1.667.747-1.667 1.667v4.391c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667V7.484c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Jb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.208 4.792H8.125c-.92 0-1.667.746-1.667 1.666v.417c0 .92.747 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM12.516 11.458H8.125c-.92 0-1.667.746-1.667 1.667v.417c0 .92.747 1.666 1.667 1.666h4.391c.92 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Yb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M11.875 4.792H4.792c-.92 0-1.667.746-1.667 1.666v.417c0 .92.746 1.667 1.667 1.667h7.083c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666ZM11.683 11.458H7.292c-.92 0-1.667.746-1.667 1.667v.417c0 .92.746 1.666 1.667 1.666h4.39c.921 0 1.667-.746 1.667-1.666v-.417c0-.92-.746-1.667-1.666-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Xb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M16.667 3.333v13.334M3.333 3.333v13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M14.375 10.208v-.416c0-.92-.746-1.667-1.667-1.667H7.292c-.92 0-1.667.746-1.667 1.667v.416c0 .92.746 1.667 1.667 1.667h5.416c.92 0 1.667-.746 1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Zb=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M3.333 3.333h13.334M3.333 16.667h13.334`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10.208 5.625h-.416c-.92 0-1.667.746-1.667 1.667v5.416c0 .92.746 1.667 1.667 1.667h.416c.92 0 1.667-.746 1.667-1.667V7.292c0-.92-.746-1.667-1.667-1.667Z`})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Qb=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M1.667 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M8.333 10h3.334`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M15.417 10h2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M6.875 4.792h-.417c-.92 0-1.666.746-1.666 1.666v7.084c0 .92.746 1.666 1.666 1.666h.417c.92 0 1.667-.746 1.667-1.666V6.458c0-.92-.747-1.666-1.667-1.666ZM13.542 6.458h-.417c-.92 0-1.667.747-1.667 1.667v3.75c0 .92.746 1.667 1.667 1.667h.417c.92 0 1.666-.746 1.666-1.667v-3.75c0-.92-.746-1.667-1.666-1.667Z`})]}),Y),$b=q((0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M10 18.333v-2.916`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 11.667V8.333`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M10 4.583V1.667`,strokeLinecap:`round`,strokeLinejoin:`round`}),(0,W.jsx)(`path`,{d:`M4.792 13.125v.417c0 .92.746 1.666 1.666 1.666h7.084c.92 0 1.666-.746 1.666-1.666v-.417c0-.92-.746-1.667-1.666-1.667H6.458c-.92 0-1.666.746-1.666 1.667ZM6.458 6.458v.417c0 .92.747 1.667 1.667 1.667h3.75c.92 0 1.667-.747 1.667-1.667v-.417c0-.92-.746-1.666-1.667-1.666h-3.75c-.92 0-1.667.746-1.667 1.666Z`})]}),Y),ex=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`circle`,{cx:`9`,cy:`7`,r:`4`}),(0,W.jsx)(`path`,{d:`M3 21v-2a4 4 0 0 1 4 -4h4a4 4 0 0 1 4 4v2`}),(0,W.jsx)(`path`,{d:`M16 3.13a4 4 0 0 1 0 7.75`}),(0,W.jsx)(`path`,{d:`M21 21v-2a4 4 0 0 0 -3 -3.85`})]}),J);q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm115.7 272l-176 101c-15.8 8.8-35.7-2.5-35.7-21V152c0-18.4 19.8-29.8 35.7-21l176 107c16.4 9.2 16.4 32.9 0 42z`);var tx=q(`M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm96 328c0 8.8-7.2 16-16 16H176c-8.8 0-16-7.2-16-16V176c0-8.8 7.2-16 16-16h160c8.8 0 16 7.2 16 16v160z`),nx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M15 5 5 15M5 5l10 10`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y);q(`M464 0c26.51 0 48 21.49 48 48v288c0 26.51-21.49 48-48 48H176c-26.51 0-48-21.49-48-48V48c0-26.51 21.49-48 48-48h288M176 416c-44.112 0-80-35.888-80-80V128H48c-26.51 0-48 21.49-48 48v288c0 26.51 21.49 48 48 48h288c26.51 0 48-21.49 48-48v-48H176z`,{mirror:!0}),q(`M11.553 22.894a.998.998 0 00.894 0s3.037-1.516 5.465-4.097C19.616 16.987 21 14.663 21 12V5a1 1 0 00-.649-.936l-8-3a.998.998 0 00-.702 0l-8 3A1 1 0 003 5v7c0 2.663 1.384 4.987 3.088 6.797 2.428 2.581 5.465 4.097 5.465 4.097zm-1.303-8.481l6.644-6.644a.856.856 0 111.212 1.212l-7.25 7.25a.856.856 0 01-1.212 0l-3.75-3.75a.856.856 0 111.212-1.212l3.144 3.144z`,{width:24}),q(`M369.9 97.9L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM332.1 128H256V51.9l76.1 76.1zM48 464V48h160v104c0 13.3 10.7 24 24 24h104v288H48zm32-48h224V288l-23.5-23.5c-4.7-4.7-12.3-4.7-17 0L176 352l-39.5-39.5c-4.7-4.7-12.3-4.7-17 0L80 352v64zm48-240c-26.5 0-48 21.5-48 48s21.5 48 48 48 48-21.5 48-48-21.5-48-48-48z`,{width:384,height:512});var rx=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`2.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ix=H.memo(({theme:e})=>q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M25 26H111V111H25`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M25 111C25 80.2068 25 49.4135 25 26M25 26C48.6174 26 72.2348 26 111 26H25ZM25 26C53.3671 26 81.7343 26 111 26H25ZM111 26C111 52.303 111 78.606 111 111V26ZM111 26C111 51.2947 111 76.5893 111 111V26ZM111 111C87.0792 111 63.1585 111 25 111H111ZM111 111C87.4646 111 63.9293 111 25 111H111ZM25 111C25 81.1514 25 51.3028 25 26V111Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsx)(`path`,{d:`M100 100H160V160H100`,fill:Iy(e)}),(0,W.jsx)(`path`,{d:`M100 160C100 144.106 100 128.211 100 100M100 100C117.706 100 135.412 100 160 100H100ZM100 100C114.214 100 128.428 100 160 100H100ZM160 100C160 120.184 160 140.369 160 160V100ZM160 100C160 113.219 160 126.437 160 160V100ZM160 160C145.534 160 131.068 160 100 160H160ZM160 160C143.467 160 126.934 160 100 160H160ZM100 160C100 143.661 100 127.321 100 100V160Z`,stroke:Iy(e),strokeWidth:`2`}),(0,W.jsxs)(`g`,{fill:Ly(e),stroke:Iy(e),strokeWidth:`6`,children:[(0,W.jsx)(`rect`,{x:`2.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`78.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`149.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`147.5`,y:`78.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`105.5`,y:`2.5`,width:`30`,height:`30`}),(0,W.jsx)(`rect`,{x:`2.5`,y:`102.5`,width:`30`,height:`30`})]})]}),{width:182,height:182,mirror:!0})),ax=q((0,W.jsx)(`g`,{strokeWidth:1.25,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.27 3.27 0 0 1 3.254 3.254v8.242a3.27 3.27 0 0 1-3.254 3.254H5.88a3.27 3.27 0 0 1-3.254-3.254V5.88A3.27 3.27 0 0 1 5.88 2.626l-.001-.001ZM4.518 16.118l7.608-12.83m.198 13.934 5.051-9.897M2.778 9.675l9.348-6.387m-7.608 12.83 12.857-8.793`})}),Y),ox=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillHachureIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:2,y:2,width:16,height:16,children:(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,fill:`currentColor`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`g`,{mask:`url(#FillHachureIcon)`,children:(0,W.jsx)(`path`,{d:`M2.258 15.156 15.156 2.258M7.324 20.222 20.222 7.325m-20.444 5.35L12.675-.222m-8.157 18.34L17.416 5.22`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})})]}),Y),sx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`g`,{clipPath:`url(#a)`,children:[(0,W.jsx)(`path`,{d:`M5.879 2.625h8.242a3.254 3.254 0 0 1 3.254 3.254v8.242a3.254 3.254 0 0 1-3.254 3.254H5.88a3.254 3.254 0 0 1-3.254-3.254V5.88a3.254 3.254 0 0 1 3.254-3.254Z`,stroke:`currentColor`,strokeWidth:`1.25`}),(0,W.jsx)(`mask`,{id:`FillCrossHatchIcon`,style:{maskType:`alpha`},maskUnits:`userSpaceOnUse`,x:-1,y:-1,width:22,height:22,children:(0,W.jsx)(`path`,{d:`M2.426 15.044 15.044 2.426M7.383 20 20 7.383M0 12.617 12.617 0m-7.98 17.941L17.256 5.324m-2.211 12.25L2.426 4.956M20 12.617 7.383 0m5.234 20L0 7.383m17.941 7.98L5.324 2.745`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`g`,{mask:`url(#FillCrossHatchIcon)`,children:(0,W.jsx)(`path`,{d:`M14.121 2H5.88A3.879 3.879 0 0 0 2 5.879v8.242A3.879 3.879 0 0 0 5.879 18h8.242A3.879 3.879 0 0 0 18 14.121V5.88A3.879 3.879 0 0 0 14.121 2Z`,fill:`currentColor`})})]}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),cx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M4.91 2.625h10.18a2.284 2.284 0 0 1 2.285 2.284v10.182a2.284 2.284 0 0 1-2.284 2.284H4.909a2.284 2.284 0 0 1-2.284-2.284V4.909a2.284 2.284 0 0 1 2.284-2.284Z`,stroke:`currentColor`,strokeWidth:`1.25`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),{...Y,fill:`currentColor`}),lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`M4.167 10h11.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),ux=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y),dx=q((0,W.jsx)(`path`,{d:`M5 10h10`,stroke:`currentColor`,strokeWidth:`3.75`,strokeLinecap:`round`,strokeLinejoin:`round`}),Y);H.memo(({theme:e})=>q((0,W.jsx)(`path`,{d:`M6 10H34`,stroke:Iy(e),strokeWidth:2,fill:`none`,strokeLinecap:`round`}),{width:40,height:20}));var fx=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12h2`}),(0,W.jsx)(`path`,{d:`M17 12h2`}),(0,W.jsx)(`path`,{d:`M11 12h2`})]}),J),px=q((0,W.jsxs)(`g`,{strokeWidth:`2`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M8 12v.01`}),(0,W.jsx)(`path`,{d:`M12 12v.01`}),(0,W.jsx)(`path`,{d:`M16 12v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`})]}),J),mx=q((0,W.jsx)(`path`,{d:`M2.5 12.038c1.655-.885 5.9-3.292 8.568-4.354 2.668-1.063.101 2.821 1.32 3.104 1.218.283 5.112-1.814 5.112-1.814`,strokeWidth:`1.25`}),Y),hx=q((0,W.jsx)(`path`,{d:`M2.5 12.563c1.655-.886 5.9-3.293 8.568-4.355 2.668-1.062.101 2.822 1.32 3.105 1.218.283 5.112-1.814 5.112-1.814m-13.469 2.23c2.963-1.586 6.13-5.62 7.468-4.998 1.338.623-1.153 4.11-.132 5.595 1.02 1.487 6.133-1.43 6.133-1.43`,strokeWidth:`1.25`}),Y),gx=q((0,W.jsx)(`path`,{d:`M2.5 11.936c1.737-.879 8.627-5.346 10.42-5.268 1.795.078-.418 5.138.345 5.736.763.598 3.53-1.789 4.235-2.147M2.929 9.788c1.164-.519 5.47-3.28 6.987-3.114 1.519.165 1 3.827 2.121 4.109 1.122.281 3.839-2.016 4.606-2.42`,strokeWidth:`1.25`}),Y),_x=q((0,W.jsxs)(`svg`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{d:`M3.33334 9.99998V6.66665C3.33334 6.04326 3.33403 4.9332 3.33539 3.33646C4.95233 3.33436 6.06276 3.33331 6.66668 3.33331H10`}),(0,W.jsx)(`path`,{d:`M13.3333 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 3.33331V3.34331`}),(0,W.jsx)(`path`,{d:`M16.6667 6.66669V6.67669`}),(0,W.jsx)(`path`,{d:`M16.6667 10V10.01`}),(0,W.jsx)(`path`,{d:`M3.33334 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M16.6667 13.3333V13.3433`}),(0,W.jsx)(`path`,{d:`M3.33334 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M6.66666 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M10 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M13.3333 16.6667V16.6767`}),(0,W.jsx)(`path`,{d:`M16.6667 16.6667V16.6767`})]}),Y),vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 12v-4a4 4 0 0 1 4 -4h4`}),(0,W.jsx)(`line`,{x1:`16`,y1:`4`,x2:`16`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`4`,x2:`20`,y2:`4.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`8`,x2:`20`,y2:`8.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`12`,x2:`20`,y2:`12.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`4`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`16`,x2:`20`,y2:`16.01`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`4`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`8`,y1:`20`,x2:`8`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`12`,y1:`20`,x2:`12`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`16`,y1:`20`,x2:`16`,y2:`20.01`}),(0,W.jsx)(`line`,{x1:`20`,y1:`20`,x2:`20`,y2:`20.01`})]}),J),yx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,opacity:.3,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H19`}),(0,W.jsx)(`path`,{d:`M25,6 L33,16 M33,6 L25,16`})]}),Ry)),bx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M7,11 H33 M23,5 L33,11 L23,17`})}),Ry)),xx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Sx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,strokeLinejoin:`round`,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H23`}),(0,W.jsx)(`path`,{d:`M23,5 L35,11 L23,17 Z`})]}),Ry)),Cx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),wx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M7,11 H25`,strokeLinecap:`round`}),(0,W.jsx)(`circle`,{cx:`29`,cy:`11`,r:`4`})]}),Ry)),Tx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`currentColor`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`,strokeWidth:2,strokeLinecap:`round`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Ex=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?`translate(40, 0) scale(-1, 1)`:``,strokeLinejoin:`round`,strokeWidth:2,strokeLinecap:`round`,children:[(0,W.jsx)(`path`,{d:`M7,11 H21`}),(0,W.jsx)(`path`,{d:`M21,11 L28,5 L35,11 L28,17 Z`})]}),Ry)),Dx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{transform:e?`translate(40, 0) scale(-1, 1)`:``,stroke:`currentColor`,strokeWidth:2,fill:`none`,strokeLinecap:`round`,children:(0,W.jsx)(`path`,{d:`M11,11 H31 M31,5 V17`})}),Ry)),Ox=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17`})}),Ry)),kx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,11 L7,5 M15,11 L7,17`})}),Ry)),Ax=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M23,5 V17 M15,11 L7,5 M15,11 L7,17`})}),Ry)),jx=H.memo(({flip:e=!1})=>q((0,W.jsx)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:(0,W.jsx)(`path`,{d:`M35,11 H7 M15,5 V17 M7,5 V17`})}),Ry)),Mx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H19 M11,11 H7 M7,5 V17`}),(0,W.jsx)(`circle`,{cx:`15`,cy:`11`,r:`4`})]}),Ry)),Nx=H.memo(({flip:e=!1})=>q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,transform:e?``:`translate(40, 0) scale(-1, 1)`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{d:`M35,11 H27 M19,11 H7 M15,11 L7,5 M15,11 L7,17`}),(0,W.jsx)(`circle`,{cx:`23`,cy:`11`,r:`4`})]}),Ry)),Px=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M14.167 6.667a3.333 3.333 0 0 0-3.334-3.334H9.167a3.333 3.333 0 0 0 0 6.667h1.666a3.333 3.333 0 0 1 0 6.667H9.167a3.333 3.333 0 0 1-3.334-3.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Fx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5 16.667V3.333L10 15l5-11.667v13.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Ix=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`g`,{clipPath:`url(#a)`,children:(0,W.jsx)(`path`,{d:`M5.833 3.333v13.334h8.334`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),(0,W.jsx)(`defs`,{children:(0,W.jsx)(`clipPath`,{id:`a`,children:(0,W.jsx)(`path`,{fill:`#fff`,d:`M0 0h20v20H0z`})})})]}),Y),Lx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`path`,{d:`m1.667 3.333 6.666 13.334M8.333 3.333 1.667 16.667M11.667 3.333v13.334h6.666`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`})}),Y),Rx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 7v-2h13v2`}),(0,W.jsx)(`path`,{d:`M10 5v14`}),(0,W.jsx)(`path`,{d:`M12 19h-4`}),(0,W.jsx)(`path`,{d:`M15 13v-1h6v1`}),(0,W.jsx)(`path`,{d:`M18 12v7`}),(0,W.jsx)(`path`,{d:`M17 19h2`})]}),J),zx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 12h10`}),(0,W.jsx)(`path`,{d:`M7 5v14`}),(0,W.jsx)(`path`,{d:`M17 5v14`}),(0,W.jsx)(`path`,{d:`M15 19h4`}),(0,W.jsx)(`path`,{d:`M15 5h4`}),(0,W.jsx)(`path`,{d:`M5 19h4`}),(0,W.jsx)(`path`,{d:`M5 5h4`})]})}),J),Bx=q((0,W.jsx)(W.Fragment,{children:(0,W.jsx)(`g`,{stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,W.jsx)(`path`,{d:`M5.833 16.667v-10a3.333 3.333 0 0 1 3.334-3.334h1.666a3.333 3.333 0 0 1 3.334 3.334v10M5.833 10.833h8.334`})})}),Y),Vx=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 8l-4 4l4 4`}),(0,W.jsx)(`path`,{d:`M17 8l4 4l-4 4`}),(0,W.jsx)(`path`,{d:`M14 4l-4 16`})]}),J),Hx=Vx,Ux=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`12`,y2:`12`}),(0,W.jsx)(`line`,{x1:`4`,y1:`16`,x2:`16`,y2:`16`})]}),J),Wx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`8`,y1:`12`,x2:`16`,y2:`12`}),(0,W.jsx)(`line`,{x1:`6`,y1:`16`,x2:`18`,y2:`16`})]}),J),Gx=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`8`,x2:`20`,y2:`8`}),(0,W.jsx)(`line`,{x1:`10`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`line`,{x1:`8`,y1:`16`,x2:`20`,y2:`16`})]}),J),Kx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`4`,x2:`20`,y2:`4`}),(0,W.jsx)(`rect`,{x:`9`,y:`8`,width:`6`,height:`12`,rx:`2`})]}),J)),qx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`2`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`20`,x2:`20`,y2:`20`}),(0,W.jsx)(`rect`,{x:`9`,y:`4`,width:`6`,height:`12`,rx:`2`})]}),J)),Jx=H.memo(({theme:e})=>q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,stroke:`currentColor`,fill:`none`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`line`,{x1:`4`,y1:`12`,x2:`9`,y2:`12`}),(0,W.jsx)(`line`,{x1:`15`,y1:`12`,x2:`20`,y2:`12`}),(0,W.jsx)(`rect`,{x:`9`,y:`6`,width:`6`,height:`12`,rx:`2`})]}),J)),Yx=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M21 19h-18l9 -15`}),(0,W.jsx)(`path`,{d:`M20.615 15.171h.015`}),(0,W.jsx)(`path`,{d:`M19.515 11.771h.015`}),(0,W.jsx)(`path`,{d:`M17.715 8.671h.015`}),(0,W.jsx)(`path`,{d:`M15.415 5.971h.015`})]}),J),Xx=q((0,W.jsx)(`path`,{d:`M537.6 226.6c4.1-10.7 6.4-22.4 6.4-34.6 0-53-43-96-96-96-19.7 0-38.1 6-53.3 16.2C367 64.2 315.3 32 256 32c-88.4 0-160 71.6-160 160 0 2.7.1 5.4.2 8.1C40.2 219.8 0 273.2 0 336c0 79.5 64.5 144 144 144h368c70.7 0 128-57.3 128-128 0-61.9-44-113.6-102.4-125.4zM393.4 288H328v112c0 8.8-7.2 16-16 16h-48c-8.8 0-16-7.2-16-16V288h-65.4c-14.3 0-21.4-17.2-11.3-27.3l105.4-105.4c6.2-6.2 16.4-6.2 22.6 0l105.4 105.4c10.1 10.1 2.9 27.3-11.3 27.3z`,fill:`currentColor`}),{width:640,height:512});q((0,W.jsx)(`path`,{d:`M480 416C497.7 416 512 430.3 512 448C512 465.7 497.7 480 480 480H150.6C133.7 480 117.4 473.3 105.4 461.3L25.37 381.3C.3786 356.3 .3786 315.7 25.37 290.7L258.7 57.37C283.7 32.38 324.3 32.38 349.3 57.37L486.6 194.7C511.6 219.7 511.6 260.3 486.6 285.3L355.9 416H480zM265.4 416L332.7 348.7L195.3 211.3L70.63 336L150.6 416L265.4 416z`}));var Zx=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5`}),(0,W.jsx)(`path`,{d:`M14 5.5a1.5 1.5 0 0 1 3 0v6.5`}),(0,W.jsx)(`path`,{d:`M17 7.5a1.5 1.5 0 0 1 3 0v8.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`})]}),J),Qx=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2`}),(0,W.jsx)(`path`,{d:`M7 11l5 5l5 -5`}),(0,W.jsx)(`path`,{d:`M12 4l0 12`})]}),J),$x=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2`})]}),J),eS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M9.15 14.85l8.85 -10.85`}),(0,W.jsx)(`path`,{d:`M6 4l8.85 10.85`})]}),J),tS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 .01`}),(0,W.jsx)(`path`,{d:`M12 13.5a1.5 1.5 0 0 1 1 -1.5a2.6 2.6 0 1 0 -3 -4`})]}),J);q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M7 4v16l13 -8z`})]}),J),q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 4h-10a3 3 0 0 0 -3 3v10a3 3 0 0 0 3 3h10a3 3 0 0 0 3 -3v-10a3 3 0 0 0 -3 -3z`,strokeWidth:`0`,fill:`currentColor`})]}),J);var nS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 12l5 5l10 -10`})]}),J),rS=q((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.24 3.957l-8.422 14.06a1.989 1.989 0 0 0 1.7 2.983h16.845a1.989 1.989 0 0 0 1.7 -2.983l-8.423 -14.06a1.989 1.989 0 0 0 -3.4 0z`}),(0,W.jsx)(`path`,{d:`M12 9v4`}),(0,W.jsx)(`path`,{d:`M12 17h.01`})]}),J),iS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l6 6`}),(0,W.jsx)(`path`,{d:`M4 16l11.7 -11.7a1 1 0 0 1 1.4 0l2.6 2.6a1 1 0 0 1 0 1.4l-11.7 11.7h-4v-4z`})]}),J),aS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l-4 7h8z`}),(0,W.jsx)(`path`,{d:`M17 17m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0`}),(0,W.jsx)(`path`,{d:`M4 14m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z`})]}),J),oS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 7l16 0`}),(0,W.jsx)(`path`,{d:`M4 17l16 0`}),(0,W.jsx)(`path`,{d:`M7 4l0 16`}),(0,W.jsx)(`path`,{d:`M17 4l0 16`})]}),J),sS=q((0,W.jsx)(`path`,{fill:`currentColor`,d:`M407.48,111.18C335.587,108.103 269.573,152.338 245.08,220C220.587,152.338 154.573,108.103 82.68,111.18C80.285,168.229 107.577,222.632 154.74,254.82C178.908,271.419 193.35,298.951 193.27,328.27L193.27,379.13L296.9,379.13L296.9,328.27C296.816,298.953 311.255,271.42 335.42,254.82C382.596,222.644 409.892,168.233 407.48,111.18Z`})),cS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20 11a8.1 8.1 0 0 0 -15.5 -2m-.5 -4v4h4`}),(0,W.jsx)(`path`,{d:`M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4`})]}),J),lS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l-2 1l8 4l8 -4l-2 -1`}),(0,W.jsx)(`path`,{d:`M4 15l8 4l8 -4`}),(0,W.jsx)(`path`,{d:`M12 4v7`}),(0,W.jsx)(`path`,{d:`M15 8l-3 3l-3 -3`})]}),J),uS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{d:`M4.16602 10H15.8327`}),(0,W.jsx)(`path`,{d:`M12.5 13.3333L15.8333 10`}),(0,W.jsx)(`path`,{d:`M12.5 6.66666L15.8333 9.99999`})]}),Y),dS=q((0,W.jsxs)(`g`,{fill:`none`,stroke:`currentColor`,strokeWidth:`1.25`,strokeLinecap:`round`,strokeLinejoin:`round`,transform:`rotate(90 10 10)`,children:[(0,W.jsx)(`path`,{clipRule:`evenodd`,d:`m9.644 13.69 7.774-7.773a2.357 2.357 0 0 0-3.334-3.334l-7.773 7.774L8 12l1.643 1.69Z`}),(0,W.jsx)(`path`,{d:`m13.25 3.417 3.333 3.333M10 10l2-2M5 15l3-3M2.156 17.894l1-1M5.453 19.029l-.144-1.407M2.377 11.887l.866 1.118M8.354 17.273l-1.194-.758M.953 14.652l1.408.13`})]}),20),fS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`}),(0,W.jsx)(`path`,{d:`M6 21l15 -15l-3 -3l-15 15l3 3`}),(0,W.jsx)(`path`,{d:`M15 6l3 3`}),(0,W.jsx)(`path`,{d:`M9 3a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`}),(0,W.jsx)(`path`,{d:`M19 13a2 2 0 0 0 2 2a2 2 0 0 0 -2 2a2 2 0 0 0 -2 -2a2 2 0 0 0 2 -2`})]}),J),q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11.217 19.384a3.501 3.501 0 0 0 6.783 -1.217v-5.167l-6 -3.35`}),(0,W.jsx)(`path`,{d:`M5.214 15.014a3.501 3.501 0 0 0 4.446 5.266l4.34 -2.534v-6.946`}),(0,W.jsx)(`path`,{d:`M6 7.63c-1.391 -.236 -2.787 .395 -3.534 1.689a3.474 3.474 0 0 0 1.271 4.745l4.263 2.514l6 -3.348`}),(0,W.jsx)(`path`,{d:`M12.783 4.616a3.501 3.501 0 0 0 -6.783 1.217v5.067l6 3.45`}),(0,W.jsx)(`path`,{d:`M18.786 8.986a3.501 3.501 0 0 0 -4.446 -5.266l-4.34 2.534v6.946`}),(0,W.jsx)(`path`,{d:`M18 16.302c1.391 .236 2.787 -.395 3.534 -1.689a3.474 3.474 0 0 0 -1.271 -4.745l-4.308 -2.514l-5.955 3.42`})]}),J);var pS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 8v-2a2 2 0 0 1 2 -2h2`}),(0,W.jsx)(`path`,{d:`M4 16v2a2 2 0 0 0 2 2h2`}),(0,W.jsx)(`path`,{d:`M16 4h2a2 2 0 0 1 2 2v2`}),(0,W.jsx)(`path`,{d:`M16 20h2a2 2 0 0 0 2 -2v-2`})]}),J),mS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0`}),(0,W.jsx)(`path`,{d:`M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6`})]}),J),hS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10.585 10.587a2 2 0 0 0 2.829 2.828`}),(0,W.jsx)(`path`,{d:`M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`})]}),J),gS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,fill:`none`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),_S=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15.5 13a3.5 3.5 0 0 0 -3.5 3.5v1a3.5 3.5 0 0 0 7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M8.5 13a3.5 3.5 0 0 1 3.5 3.5v1a3.5 3.5 0 0 1 -7 0v-1.8`}),(0,W.jsx)(`path`,{d:`M17.5 16a3.5 3.5 0 0 0 0 -7h-.5`}),(0,W.jsx)(`path`,{d:`M19 9.3v-2.8a3.5 3.5 0 0 0 -7 0`}),(0,W.jsx)(`path`,{d:`M6.5 16a3.5 3.5 0 0 1 0 -7h.5`}),(0,W.jsx)(`path`,{d:`M5 9.3v-2.8a3.5 3.5 0 0 1 7 0v10`})]}),J),vS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0`}),(0,W.jsx)(`path`,{d:`M21 21l-6 -6`})]}),J),yS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M20.984 12.53a9 9 0 1 0 -7.552 8.355`}),(0,W.jsx)(`path`,{d:`M12 7v5l3 3`}),(0,W.jsx)(`path`,{d:`M19 16l-2 3h4l-2 3`})]}),J),bS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 8l0 4l2 2`}),(0,W.jsx)(`path`,{d:`M3.05 11a9 9 0 1 1 .5 4m-.5 5v-5h5`})]}),J),xS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M9 2m0 3a3 3 0 0 1 3 -3h0a3 3 0 0 1 3 3v5a3 3 0 0 1 -3 3h0a3 3 0 0 1 -3 -3z`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 14 0`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),SS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 3l18 18`}),(0,W.jsx)(`path`,{d:`M9 5a3 3 0 0 1 6 0v5a3 3 0 0 1 -.13 .874m-2 2a3 3 0 0 1 -3.87 -2.872v-1`}),(0,W.jsx)(`path`,{d:`M5 10a7 7 0 0 0 10.846 5.85m2 -2a6.967 6.967 0 0 0 1.152 -3.85`}),(0,W.jsx)(`path`,{d:`M8 21l8 0`}),(0,W.jsx)(`path`,{d:`M12 17l0 4`})]}),J),CS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M13 3l0 7l6 0l-8 11l0 -7l-6 0l8 -11`})]}),J),wS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 8m0 1a1 1 0 0 1 1 -1h6a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-6a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M12 20v.01`}),(0,W.jsx)(`path`,{d:`M16 20v.01`}),(0,W.jsx)(`path`,{d:`M8 20v.01`}),(0,W.jsx)(`path`,{d:`M4 20v.01`}),(0,W.jsx)(`path`,{d:`M4 16v.01`}),(0,W.jsx)(`path`,{d:`M4 12v.01`}),(0,W.jsx)(`path`,{d:`M4 8v.01`}),(0,W.jsx)(`path`,{d:`M4 4v.01`}),(0,W.jsx)(`path`,{d:`M8 4v.01`}),(0,W.jsx)(`path`,{d:`M12 4v.01`}),(0,W.jsx)(`path`,{d:`M16 4v.01`}),(0,W.jsx)(`path`,{d:`M20 4v.01`}),(0,W.jsx)(`path`,{d:`M20 8v.01`}),(0,W.jsx)(`path`,{d:`M20 12v.01`}),(0,W.jsx)(`path`,{d:`M20 16v.01`}),(0,W.jsx)(`path`,{d:`M20 20v.01`})]}),J),TS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3v18`}),(0,W.jsx)(`path`,{d:`M19 21v-18`}),(0,W.jsx)(`path`,{d:`M5 7h14`}),(0,W.jsx)(`path`,{d:`M5 15h14`}),(0,W.jsx)(`path`,{d:`M8 13v4`}),(0,W.jsx)(`path`,{d:`M11 13v4`}),(0,W.jsx)(`path`,{d:`M16 13v4`}),(0,W.jsx)(`path`,{d:`M14 5v4`}),(0,W.jsx)(`path`,{d:`M11 5v4`}),(0,W.jsx)(`path`,{d:`M8 5v4`}),(0,W.jsx)(`path`,{d:`M3 21h18`})]}),J),ES=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 12l18 0`}),(0,W.jsx)(`path`,{d:`M7 16l10 0l-10 5l0 -5`}),(0,W.jsx)(`path`,{d:`M7 8l10 0l-10 -5l0 5`})]}),J),DS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M12 3l0 18`}),(0,W.jsx)(`path`,{d:`M16 7l0 10l5 0l-5 -10`}),(0,W.jsx)(`path`,{d:`M8 7l0 10l-5 0l5 -10`})]}),J),OS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 3m0 2a2 2 0 0 1 2 -2h10a2 2 0 0 1 2 2v2a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M19 6h1a2 2 0 0 1 2 2a5 5 0 0 1 -5 5l-5 0v2`}),(0,W.jsx)(`path`,{d:`M10 15m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v4a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`})]}),J),kS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 15m-5 0a5 5 0 1 0 10 0a5 5 0 1 0 -10 0`}),(0,W.jsx)(`path`,{d:`M22 22l-3 -3`}),(0,W.jsx)(`path`,{d:`M6 18h-1a2 2 0 0 1 -2 -2v-1`}),(0,W.jsx)(`path`,{d:`M3 11v-1`}),(0,W.jsx)(`path`,{d:`M3 6v-1a2 2 0 0 1 2 -2h1`}),(0,W.jsx)(`path`,{d:`M10 3h1`}),(0,W.jsx)(`path`,{d:`M15 3h1a2 2 0 0 1 2 2v1`})]}),J),AS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M4 20.25c0 .414 .336 .75 .75 .75h1.25a1 1 0 0 0 1 -1v-1a1 1 0 0 0 -1 -1h-1a1 1 0 0 1 -1 -1v-1a1 1 0 0 1 1 -1h1.25a.75 .75 0 0 1 .75 .75`}),(0,W.jsx)(`path`,{d:`M10 15l2 6l2 -6`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`})]}),J),jS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 3v4a1 1 0 0 0 1 1h4`}),(0,W.jsx)(`path`,{d:`M5 12v-7a2 2 0 0 1 2 -2h7l5 5v4`}),(0,W.jsx)(`path`,{d:`M20 15h-1a2 2 0 0 0 -2 2v2a2 2 0 0 0 2 2h1v-3`}),(0,W.jsx)(`path`,{d:`M5 18h1.5a1.5 1.5 0 0 0 0 -3h-1.5v6`}),(0,W.jsx)(`path`,{d:`M11 21v-6l3 6v-6`})]}),J),MS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 13v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a2 2 0 0 0 6 0v-8a2 2 0 0 1 2 -2h1a2 2 0 0 1 2 2v8a8 8 0 0 1 -16 0`}),(0,W.jsx)(`path`,{d:`M4 8l5 0`}),(0,W.jsx)(`path`,{d:`M15 8l4 0`})]}),J),NS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 14c.83 .642 2.077 1.017 3.5 1c1.423 .017 2.67 -.358 3.5 -1c.83 -.642 2.077 -1.017 3.5 -1c1.423 -.017 2.67 .358 3.5 1`}),(0,W.jsx)(`path`,{d:`M8 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M12 3a2.4 2.4 0 0 0 -1 2a2.4 2.4 0 0 0 1 2`}),(0,W.jsx)(`path`,{d:`M3 10h14v5a6 6 0 0 1 -6 6h-2a6 6 0 0 1 -6 -6v-5z`}),(0,W.jsx)(`path`,{d:`M16.746 16.726a3 3 0 1 0 .252 -5.555`})]}),J),PS=q((0,W.jsxs)(`g`,{stroke:`currentColor`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 5a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-16a1 1 0 0 1-1-1v-10zM7 20h10M9 16v4M15 16v4`})]}),{...J,strokeWidth:1.5});q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M15 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`}),(0,W.jsx)(`path`,{d:`M21 12h-13l3 -3`}),(0,W.jsx)(`path`,{d:`M11 15l-3 -3`})]}),J);var FS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M2 8a4 4 0 0 1 4 -4h12a4 4 0 0 1 4 4v8a4 4 0 0 1 -4 4h-12a4 4 0 0 1 -4 -4v-8z`}),(0,W.jsx)(`path`,{d:`M10 9l5 3l-5 3z`})]}),J),IS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 6h18`}),(0,W.jsx)(`path`,{d:`M3 12h18`}),(0,W.jsx)(`path`,{d:`M3 18h18`}),(0,W.jsx)(`path`,{d:`M6 3v18`}),(0,W.jsx)(`path`,{d:`M12 3v18`}),(0,W.jsx)(`path`,{d:`M18 3v18`})]}),J),LS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M17 3m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M3 17m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z`}),(0,W.jsx)(`path`,{d:`M17 5c-6.627 0 -12 5.373 -12 12`})]}),J),RS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 18l12 -12`}),(0,W.jsx)(`path`,{d:`M18 10v-4h-4`})]}),J),zS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4,19L10,19C11.097,19 12,18.097 12,17L12,9C12,7.903 12.903,7 14,7L21,7`}),(0,W.jsx)(`path`,{d:`M18 4l3 3l-3 3`})]}),J),BS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{d:`M16,12L20,9L16,6`}),(0,W.jsx)(`path`,{d:`M6 20c0 -6.075 4.925 -11 11 -11h3`})]}),J),VS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 9l6 6l6 -6`})]}),J),HS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),US=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 15l6 -6l6 6`})]}),J),WS=q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M8 5v10a1 1 0 0 0 1 1h10`}),(0,W.jsx)(`path`,{d:`M5 8h10a1 1 0 0 1 1 1v10`})]}),J),GS=q((0,W.jsxs)(`g`,{children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M5 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M19 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M5 7l0 10`}),(0,W.jsx)(`path`,{d:`M7 5l10 0`}),(0,W.jsx)(`path`,{d:`M7 19l10 0`}),(0,W.jsx)(`path`,{d:`M19 7l0 10`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 11v8a1 1 0 0 0 1 1h8m-9 -14v-1a1 1 0 0 1 1 -1h1m5 0h2m5 0h1a1 1 0 0 1 1 1v1m0 5v2m0 5v1a1 1 0 0 1 -1 1h-1`}),(0,W.jsx)(`path`,{d:`M4 12h7a1 1 0 0 1 1 1v7`})]}),J);var KS=q((0,W.jsxs)(`g`,{strokeWidth:1.5,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),qS=q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M6 10l4 -4 L6 14l8 -8 L6 18l12 -12 L10 18l8 -8 L14 18l4 -4`})]}),J),JS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 20h4l10.5 -10.5a2.828 2.828 0 1 0 -4 -4l-10.5 10.5v4`}),(0,W.jsx)(`path`,{d:`M13.5 6.5l4 4`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:1,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M11 7l-5 5l5 5`}),(0,W.jsx)(`path`,{d:`M17 7l-5 5l5 5`})]}),J);var YS=q((0,W.jsxs)(`g`,{strokeWidth:`1.75`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M4 4m0 2a2 2 0 0 1 2 -2h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2z`}),(0,W.jsx)(`path`,{d:`M15 4l0 16`})]}),J);q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`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`})]}),J),q((0,W.jsxs)(`g`,{strokeWidth:`1.25`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M3 4l18 0`}),(0,W.jsx)(`path`,{d:`M4 4v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-10`}),(0,W.jsx)(`path`,{d:`M12 16l0 4`}),(0,W.jsx)(`path`,{d:`M9 20l6 0`}),(0,W.jsx)(`path`,{d:`M8 12l3 -3l2 2l3 -3`})]}),J);var XS=(0,W.jsx)(`div`,{style:{width:`1rem`,height:`1rem`}}),ZS=q((0,W.jsxs)(`g`,{strokeWidth:`1.5`,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`polyline`,{points:`9 6 15 12 9 18`})]}),J),QS=q((0,W.jsxs)(`g`,{strokeWidth:1.25,children:[(0,W.jsx)(`path`,{stroke:`none`,d:`M0 0h24v24H0z`,fill:`none`}),(0,W.jsx)(`path`,{d:`M14 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 6l8 0`}),(0,W.jsx)(`path`,{d:`M16 6l4 0`}),(0,W.jsx)(`path`,{d:`M8 12m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 12l2 0`}),(0,W.jsx)(`path`,{d:`M10 12l10 0`}),(0,W.jsx)(`path`,{d:`M17 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0`}),(0,W.jsx)(`path`,{d:`M4 18l11 0`}),(0,W.jsx)(`path`,{d:`M19 18l1 0`})]}),J),$S=({size:e=`1em`,circleWidth:t=8,synchronized:n=!1,className:r=``})=>{let i=-(H.useRef(Date.now()).current%1600);return(0,W.jsx)(`div`,{className:`Spinner ${r}`,children:(0,W.jsx)(`svg`,{viewBox:`0 0 100 100`,style:{width:e,height:e,"--spinner-delay":n?`${i}ms`:0},children:(0,W.jsx)(`circle`,{cx:`50`,cy:`50`,r:50-t/2,strokeWidth:t,fill:`none`,strokeMiterlimit:`10`})})})},X=H.forwardRef(({size:e=`medium`,visible:t=!0,className:n=``,...r},i)=>{let{id:a}=oz(),o=H.useRef(null);H.useImperativeHandle(i,()=>o.current);let s=`ToolIcon_size_${e}`,[c,l]=(0,H.useState)(!1),u=(0,H.useRef)(!0),d=async e=>{let t=`onClick`in r&&r.onClick?.(e);if(ge(t))try{l(!0),await t}catch(e){if(e instanceof E)console.warn(e);else throw e}finally{u.current&&l(!1)}};(0,H.useEffect)(()=>(u.current=!0,()=>{u.current=!1}),[]);let f=(0,H.useRef)(null);if(r.type===`button`||r.type===`icon`||r.type===`submit`){let e=r.type===`icon`?`button`:r.type;return(0,W.jsxs)(`button`,{className:U(`ToolIcon_type_button`,s,n,t&&!r.hidden?`ToolIcon_type_button--show`:`ToolIcon_type_button--hide`,{ToolIcon:!r.hidden,"ToolIcon--selected":r.selected,"ToolIcon--plain":r.type===`icon`}),style:r.style,"data-testid":r[`data-testid`],hidden:r.hidden,title:r.title,"aria-label":r[`aria-label`],type:e,onClick:d,ref:o,disabled:c||r.isLoading||!!r.disabled,children:[(r.icon||r.label)&&(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,"aria-hidden":`true`,"aria-disabled":!!r.disabled,children:[r.icon||r.label,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel}),r.isLoading&&(0,W.jsx)($S,{})]}),r.showAriaLabel&&(0,W.jsxs)(`div`,{className:`ToolIcon__label`,children:[r[`aria-label`],` `,c&&(0,W.jsx)($S,{})]}),r.children]})}return(0,W.jsxs)(`label`,{className:U(`ToolIcon`,n),title:r.title,onPointerDown:e=>{f.current=e.pointerType||null,r.onPointerDown?.({pointerType:e.pointerType||null})},onPointerUp:()=>{requestAnimationFrame(()=>{f.current=null})},children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_radio ${s}`,type:`radio`,name:r.name,"aria-label":r[`aria-label`],"aria-keyshortcuts":r[`aria-keyshortcuts`],"data-testid":r[`data-testid`],id:`${a}-${r.id}`,onChange:()=>{r.onChange?.({pointerType:f.current})},checked:r.checked,ref:o}),(0,W.jsxs)(`div`,{className:`ToolIcon__icon`,children:[r.icon,r.keyBindingLabel&&(0,W.jsx)(`span`,{className:`ToolIcon__keybinding`,children:r.keyBindingLabel})]})]})});X.displayName=`ToolButton`;var eC=[],Z=e=>(eC=eC.concat(e),e),tC=(e,t,n)=>{let r=new Set(ir(e.filter(e=>L(e)),t).map(e=>e.id)),i={},a=n.scene.getNonDeletedElementsMap(),o=new Set;for(let t of r){let n=Di(e,t);for(let e of n)if(!o.has(e.id)){if(ya(e)){let t=so(e,a);t&&(i[t.id]=!0)}else i[e.id]=!0;o.add(e.id)}}let s=!0,c=e.map(e=>{if(t.selectedElementIds[e.id]){let t=ya(e)?so(e,a):null;return e.frameId&&r.has(e.frameId)?(s=!1,i[e.id]=!0,e):t?.frameId&&r.has(t?.frameId)?e:(e.boundElements&&e.boundElements.forEach(t=>{let r=n.scene.getNonDeletedElementsMap().get(t.id);r&&dr(r)&&n.scene.mutateElement(r,{startBinding:e.id===r.startBinding?.elementId?null:r.startBinding,endBinding:e.id===r.endBinding?.elementId?null:r.endBinding})}),B(e,{isDeleted:!0}))}return e.frameId&&r.has(e.frameId)?(s=!1,ya(e)||(i[e.id]=!0),B(e,{frameId:null})):ya(e)&&t.selectedElementIds[e.containerId]?B(e,{isDeleted:!0}):e}),l=t.editingGroupId;if(s&&t.editingGroupId){let e=Ki(c,t.editingGroupId).filter(e=>!e.isDeleted);if(e.length>1)e[0]&&(i[e[0].id]=!0);else{l=null,e[0]&&(i[e[0].id]=!0);let n=e[0];if(n){let e=n.groupIds.findIndex(e=>e===t.editingGroupId),r=n.groupIds[e+1];if(r){let e=Ki(c,r).filter(e=>!e.isDeleted);e.length>1&&(l=r,e.forEach(e=>{i[e.id]=!0}))}}}}return{elements:c,appState:{...t,...Hr({selectedElementIds:i,editingGroupId:l},c,t,null)}}},nC=(e,t)=>{if(e.editingGroupId){let n=Ki(Cs(t),e.editingGroupId);if(n.length)return{...e,selectedElementIds:{[n[0].id]:!0}}}return e},rC=Z({name:`deleteSelectedElements`,label:`labels.delete`,icon:pb,trackEvent:{category:`element`,action:`delete`},perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing){let{elementId:n,selectedPointsIndices:i}=t.selectedLinearElement,a=r.scene.getNonDeletedElementsMap(),o=I.getElement(n,a);if(!o||i==null)return!1;if(i.length>=o.points.length){let n=e.map(e=>e.id===o.id?B(e,{isDeleted:!0}):e);return{elements:n,appState:{...nC(t,n),selectedLinearElement:null},captureUpdate:V.IMMEDIATELY}}return I.deletePoints(o,r,i),{elements:e,appState:{...t,selectedLinearElement:{...t.selectedLinearElement,selectedPointsIndices:i?.[0]>0?[i[0]-1]:[0]}},captureUpdate:V.IMMEDIATELY}}let{elements:i,appState:a}=tC(e,t,r);return Go(i,i.filter(e=>e.isDeleted)),a=nC(a,i),{elements:i,appState:{...a,activeTool:ka(t,{type:r.state.preferredSelectionTool.type}),multiElement:null,newElement:null,activeEmbeddable:null,selectedLinearElement:null},captureUpdate:Ya(Cs(e),t)?V.IMMEDIATELY:V.EVENTUALLY}},keyTest:(e,t,n)=>(e.key===N.BACKSPACE||e.key===N.DELETE)&&!e[N.CTRL_OR_CMD],PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:pb,title:K(`labels.delete`),"aria-label":K(`labels.delete`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),Q=e=>e.replace(/\b(Opt(?:ion)?|Alt)\b/i,K(di?`keys.option`:`keys.alt`)).replace(/\bShift\b/i,K(`keys.shift`)).replace(/\b(Enter|Return)\b/i,K(`keys.enter`)).replace(/\b(Ctrl|Cmd|Command|CtrlOrCmd)\b/gi,K(di?`keys.cmd`:`keys.ctrl`)).replace(/\b(Esc(?:ape)?)\b/i,K(`keys.escape`)).replace(/\b(Space(?:bar)?)\b/i,K(`keys.spacebar`)).replace(/\b(Del(?:ete)?)\b/i,K(`keys.delete`)),iC=Z({name:`sendBackward`,label:`labels.sendBackward`,keywords:[`move down`,`zindex`,`layer`],icon:Ub,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ua(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendBackward`)} \u2014 ${Q(`CtrlOrCmd+[`)}`,children:Ub})}),aC=Z({name:`bringForward`,label:`labels.bringForward`,keywords:[`move up`,`zindex`,`layer`],icon:Hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:bi(e,t,r.scene),appState:t,captureUpdate:V.IMMEDIATELY}),keyPriority:40,keyTest:e=>e[N.CTRL_OR_CMD]&&!e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.bringForward`)} \u2014 ${Q(`CtrlOrCmd+]`)}`,children:Hb})}),oC=Z({name:`sendToBack`,label:`labels.sendToBack`,keywords:[`move down`,`zindex`,`layer`],icon:Gb,trackEvent:{category:`element`},perform:(e,t)=>({elements:xa(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_LEFT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_LEFT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:()=>e(null),title:`${K(`labels.sendToBack`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)}`,children:Gb})}),sC=Z({name:`bringToFront`,label:`labels.bringToFront`,keywords:[`move up`,`zindex`,`layer`],icon:Wb,trackEvent:{category:`element`},perform:(e,t)=>({elements:Ft(e,t),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>di?e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.BRACKET_RIGHT:e[N.CTRL_OR_CMD]&&e.shiftKey&&e.code===Gs.BRACKET_RIGHT,PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(`button`,{type:`button`,className:`zIndexButton`,onClick:t=>e(null),title:`${K(`labels.bringToFront`)} \u2014 ${Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)}`,children:Wb})}),cC=Z({name:`selectAll`,label:`labels.selectAll`,icon:wS,trackEvent:{category:`canvas`},viewMode:!1,perform:(e,t,n,r)=>{if(t.selectedLinearElement?.isEditing)return!1;let i=e.filter(e=>!e.isDeleted&&!(M(e)&&e.containerId)&&!e.locked).reduce((e,t)=>(e[t.id]=!0,e),{});return{appState:{...t,...Hr({editingGroupId:null,selectedElementIds:i},Cs(e),t,r),selectedLinearElement:Object.keys(i).length===1&&b(e[0])?new I(e[0],lr(e)):null},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.A}),lC=Z({name:`duplicateSelection`,label:`labels.duplicateSelection`,icon:hb,trackEvent:{category:`element`},perform:(e,t,n,r)=>{if(t.selectedElementsAreBeingDragged)return!1;if(t.selectedLinearElement?.isEditing)try{return{elements:e,appState:I.duplicateSelectedPoints(t,r.scene),captureUpdate:V.IMMEDIATELY}}catch{return!1}let{duplicatedElements:i,elementsWithDuplicates:a}=Er({type:`in-place`,elements:e,idsOfElementsToDuplicate:lr(ir(e,t,{includeBoundTextElement:!0,includeElementsInFrames:!0})),appState:t,randomizeSeed:!0,overrides:({origElement:e,origIdToDuplicateId:t})=>{let n=e.frameId&&t.get(e.frameId);return{x:e.x+20/2,y:e.y+20/2,frameId:n??e.frameId}}});if(r.props.onDuplicate&&a){let t=r.props.onDuplicate(a,e);t&&(a=t)}return{elements:fe(a,lr(i)),appState:{...t,...Br(i,Cs(a),t)},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.D,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:hb,title:`${K(`labels.duplicateSelection`)} \u2014 ${Q(`CtrlOrCmd+D`)}`,"aria-label":K(`labels.duplicateSelection`),onClick:()=>n(null),disabled:!Ya(Cs(e),t),style:{...i&&t.openPopup!==`compactOtherProperties`?Bs:{}}})}}),uC=new Set([`command_palette`,`export`]),dC=(e,t,n,i)=>{try{if(typeof window>`u`||r.VITE_WORKER_ID||r.VITE_APP_ENABLE_TRACKING!==`true`||!uC.has(e)||Vt())return;r.PROD||console.info(`trackEvent`,{category:e,action:t,label:n,value:i}),window.sa_event&&window.sa_event(t,{category:e,label:n,value:i})}catch(e){console.error(`error during analytics`,e)}},fC=(0,H.forwardRef)((e,t)=>{let{title:n,className:r,testId:i,active:a,standalone:o,icon:s,onClick:c}=e;return(0,W.jsx)(`button`,{type:`button`,ref:t,title:n,"data-testid":i,className:U(r,{standalone:o,active:a}),onClick:c,style:e.style,children:s},n)}),pC=e=>(0,W.jsx)(W.Fragment,{children:e.options.map(t=>e.type===`button`?(0,W.jsx)(fC,{icon:t.icon,title:t.text,testId:t.testId,active:t.active??e.value===t.value,onClick:n=>e.onClick(t.value,n)},t.text):(0,W.jsxs)(`label`,{className:U({active:e.value===t.value}),title:t.text,children:[(0,W.jsx)(`input`,{type:`radio`,name:e.group,onChange:()=>e.onChange(t.value),checked:e.value===t.value,"data-testid":t.testId}),t.icon]},t.text))}),mC=()=>(0,W.jsx)(`div`,{style:{width:1,height:`1rem`,backgroundColor:`var(--default-border-color)`,margin:`0 auto`}}),hC=H.createContext(null),gC=()=>H.useContext(hC),_C=e=>{let[t,n]=(0,H.useState)(null),r=iz(),{theme:i}=gC(),{container:a}=oz();return(0,H.useLayoutEffect)(()=>{t&&(t.className=``,t.classList.add(`excalidraw`,...e?.className?.split(/\s+/)||[]),t.classList.toggle(`excalidraw--mobile`,r.formFactor===`phone`),t.classList.toggle(`theme--dark`,i===R.DARK))},[t,i,r.formFactor,e?.className]),(0,H.useLayoutEffect)(()=>{let t=e?.parentSelector?a?.querySelector(e.parentSelector):document.body;if(!t)return;let r=document.createElement(`div`);return t.appendChild(r),n(r),()=>{t.removeChild(r)}},[a,e?.parentSelector]),t};function vC(e,t,n){(0,H.useEffect)(()=>{function r(r){let i=r;if(!e.current)return;let a=n?.(i,e.current);if(a!==!0){if(a===!1)return t(i);e.current.contains(i.target)||!document.documentElement.contains(i.target)||i.target.closest(`[data-radix-portal]`)||i.target===document.documentElement&&document.body.style.pointerEvents===`none`||i.target.closest(`[data-prevent-outside-click]`)||t(i)}}return document.addEventListener(F.POINTER_DOWN,r),document.addEventListener(F.TOUCH_START,r),()=>{document.removeEventListener(F.POINTER_DOWN,r),document.removeEventListener(F.TOUCH_START,r)}},[e,t,n])}var yC=e=>{let t=(0,H.useRef)(e);return Object.assign(t.current,e),t.current},bC=yc(null),xC=({onCancel:e,onChange:t,onSelect:n,colorPickerType:r})=>{let i=_C({className:`excalidraw-eye-dropper-backdrop`,parentSelector:`.excalidraw-eye-dropper-container`}),a=gC(),o=sz(),s=nz(),c=yC({app:s,onCancel:e,onChange:t,onSelect:n,selectedElements:ir(o,a)}),{container:l}=oz();(0,H.useEffect)(()=>{let e=u.current;if(!e||!s.canvas||!i)return;let t=!1,n=s.canvas.getContext(`2d`),o=({clientX:e,clientY:t})=>{let r=n.getImageData((e-a.offsetLeft)*window.devicePixelRatio,(t-a.offsetTop)*window.devicePixelRatio,1,1).data;return S(r[0],r[1],r[2])},d=({clientX:n,clientY:i,altKey:a})=>{e.style.top=`${i+20}px`,e.style.left=`${n+20}px`;let s=o({clientX:n,clientY:i});t&&c.onChange(r,s,c.selectedElements,{altKey:a}),e.style.background=s},f=()=>{c.onCancel()},p=(e,t)=>{c.onSelect(e,t)},m=e=>{t=!0,e.stopImmediatePropagation()},h=e=>{t=!1,l?.focus(),e.stopImmediatePropagation(),e.preventDefault(),p(o(e),e)},g=e=>{e.key===N.ESCAPE&&(e.preventDefault(),e.stopImmediatePropagation(),f())};return i.tabIndex=-1,i.focus(),d({clientX:c.app.lastViewportPosition.x,clientY:c.app.lastViewportPosition.y,altKey:!1}),i.addEventListener(F.KEYDOWN,g),i.addEventListener(F.POINTER_DOWN,m),i.addEventListener(F.POINTER_UP,h),window.addEventListener(`pointermove`,d,{passive:!0}),window.addEventListener(F.BLUR,f),()=>{t=!1,i.removeEventListener(F.KEYDOWN,g),i.removeEventListener(F.POINTER_DOWN,m),i.removeEventListener(F.POINTER_UP,h),window.removeEventListener(`pointermove`,d),window.removeEventListener(F.BLUR,f)}},[c,s.canvas,i,r,l,a.offsetLeft,a.offsetTop]);let u=(0,H.useRef)(null);return vC(u,()=>{e()},e=>!!e.target.closest(`.excalidraw-eye-dropper-trigger, .excalidraw-eye-dropper-backdrop`)),i?(0,_c.createPortal)((0,W.jsx)(`div`,{ref:u,className:`excalidraw-eye-dropper-preview`}),i):null},SC=H.forwardRef(({children:e,padding:t,className:n,style:r},i)=>(0,W.jsx)(`div`,{className:U(`Island`,n),style:{"--padding":t,...r},ref:i,children:e})),CC=H.forwardRef(({className:e,container:t,children:n,style:r,onClose:i,onKeyDown:a,onFocusOutside:o,onPointerLeave:s,onPointerDownOutside:c,preventAutoFocusOnTouch:l=!1},u)=>{let d=iz(),f=d.formFactor===`phone`&&!d.isLandscape;return(0,W.jsx)(U_,{container:t,children:(0,W.jsxs)(W_,{ref:u,className:U(`focus-visible-none`,e),"data-prevent-outside-click":!0,side:f?`bottom`:`right`,align:f?`center`:`start`,alignOffset:-16,sideOffset:20,collisionBoundary:t??void 0,style:{zIndex:`var(--zIndex-ui-styles-popup)`,marginLeft:d.formFactor===`phone`?`0.5rem`:void 0},onPointerLeave:s,onKeyDown:a,onFocusOutside:o,onPointerDownOutside:c,onOpenAutoFocus:e=>{l&&d.isTouchScreen&&e.preventDefault()},onCloseAutoFocus:e=>{e.stopPropagation(),e.preventDefault(),t&&!Me(document.activeElement)&&t.focus(),i()},children:[(0,W.jsx)(SC,{padding:3,style:r,children:n}),(0,W.jsx)(G_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})}),wC=()=>document.querySelector(`.excalidraw-wysiwyg`),TC=()=>{let e=wC();return e?{start:e.selectionStart,end:e.selectionEnd}:null},EC=e=>{setTimeout(()=>{let t=wC();t&&(t.focus(),e&&(t.selectionStart=e.start,t.selectionEnd=e.end))},0)},DC=(e,t,n,r)=>{t&&r&&r();let i=t&&n?TC():null;e(),t&&n&&EC(i)},OC=()=>{let[e,t]=(0,H.useState)(null);return{saveCaretPosition:(0,H.useCallback)(()=>{t(TC())},[]),restoreCaretPosition:(0,H.useCallback)(()=>{setTimeout(()=>{let n=wC();n&&(n.focus(),e&&(n.selectionStart=e.start,n.selectionEnd=e.end,t(null)))},0)},[e]),clearSavedPosition:(0,H.useCallback)(()=>{t(null)},[]),hasSavedPosition:!!e}},kC=(e=100)=>{let t=wC();if(t){let n=t.onblur;t.onblur=null,setTimeout(()=>{t.onblur=n},e)}},AC=({palette:e,color:t})=>{if(!t)return null;for(let[n,r]of Object.entries(e))if(Array.isArray(r)){let e=r.indexOf(t);if(e>-1)return{colorName:n,shade:e}}else if(r===t)return{colorName:n,shade:null};return null},jC=[[`q`,`w`,`e`,`r`,`t`],[`a`,`s`,`d`,`f`,`g`],[`z`,`x`,`c`,`v`,`b`]].flat(),MC=({color:e,palette:t})=>!Object.values(t).flat().includes(e),NC=(e,t,n)=>{let r={elementBackground:`backgroundColor`,elementStroke:`strokeColor`},i=e.filter(e=>{if(e.isDeleted)return!1;let i=e[r[t]];return MC({color:i,palette:n})}),a=new Map;return i.forEach(e=>{let n=e[r[t]];a.has(n)?a.set(n,a.get(n)+1):a.set(n,1)}),[...a.entries()].sort((e,t)=>t[1]-e[1]).map(e=>e[0]).slice(0,5)},PC=yc(null),FC=({color:e,onChange:t,label:n,colorPickerType:r,placeholder:i})=>{let a=iz(),[o,s]=(0,H.useState)(e),[c,l]=vy(PC);(0,H.useEffect)(()=>{s(e)},[e]);let u=(0,H.useCallback)(e=>{let n=e.toLowerCase(),r=ma(n);r&&t(r),s(n)},[t]),d=(0,H.useRef)(null),f=(0,H.useRef)(null);(0,H.useEffect)(()=>{d.current&&d.current.focus()},[c]);let[p,m]=vy(bC);return(0,H.useEffect)(()=>()=>{m(null)},[m]),(0,W.jsxs)(`div`,{className:`color-picker__input-label`,children:[(0,W.jsx)(`div`,{className:`color-picker__input-hash`,children:`#`}),(0,W.jsx)(`input`,{ref:c===`hex`?d:void 0,style:{border:0,padding:0},spellCheck:!1,className:`color-picker-input`,"aria-label":n,onChange:e=>{u(e.target.value)},value:(o||``).replace(/^#/,``),onBlur:()=>{s(e)},tabIndex:-1,onFocus:()=>l(`hex`),onKeyDown:e=>{e.key!==N.TAB&&(e.key===N.ESCAPE&&f.current?.focus(),e.stopPropagation())},placeholder:i}),a.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{style:{width:`1px`,height:`1.25rem`,backgroundColor:`var(--default-border-color)`}}),(0,W.jsx)(`div`,{ref:f,className:U(`excalidraw-eye-dropper-trigger`,{selected:p}),onClick:()=>m(e=>e?null:{keepOpenOnAlt:!1,onSelect:e=>t(e),colorPickerType:r}),title:`${K(`labels.eyeDropper`)} \u2014 ${N.I.toLocaleUpperCase()} or ${Q(`Alt`)} `,children:iS})]})]})},IC=({color:e,keyLabel:t,isShade:n=!1})=>(0,W.jsxs)(`div`,{className:`color-picker__button__hotkey-label`,style:{color:yt(e)?`#fff`:`#000`},children:[n&&`⇧`,t]}),LC=({colors:e,color:t,onChange:n,label:r})=>{let[i,a]=vy(PC),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>{o.current&&o.current.focus()},[t,i]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:e.map((e,i)=>(0,W.jsxs)(`button`,{ref:t===e?o:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:t===e,"is-transparent":e===`transparent`||!e}),onClick:()=>{n(e),a(`custom`)},title:e,"aria-label":r,style:{"--swatch-color":e},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),(0,W.jsx)(IC,{color:e,keyLabel:i+1})]},i))})},RC=({palette:e,color:t,onChange:n,activeShade:r,showHotKey:i=!0})=>{let a=AC({color:t,palette:e}),[o,s]=vy(PC),c=(0,H.useRef)(null);return(0,H.useEffect)(()=>{c.current&&o===`baseColors`&&c.current.focus()},[a?.colorName,o]),(0,W.jsx)(`div`,{className:`color-picker-content--default`,children:Object.entries(e).map(([e,t],o)=>{let l=(Array.isArray(t)?t[r]:t)||`transparent`,u=jC[o],d=K(`colors.${e.replace(/\d+/,``)}`,null,``);return(0,W.jsxs)(`button`,{ref:a?.colorName===e?c:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:a?.colorName===e,"is-transparent":l===`transparent`||!l}),onClick:()=>{n(l),s(`baseColors`)},title:`${d}${l.startsWith(`#`)?` ${l}`:``} \u2014 ${u}`,"aria-label":`${d} \u2014 ${u}`,style:l?{"--swatch-color":l}:void 0,"data-testid":`color-${e}`,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),i&&(0,W.jsx)(IC,{color:l,keyLabel:u})]},e)})})},zC=({children:e})=>(0,W.jsx)(`div`,{className:`color-picker__heading`,children:e}),BC=({color:e,onChange:t,palette:n,showHotKey:r})=>{let i=AC({color:e||`transparent`,palette:n}),[a,o]=vy(PC),s=(0,H.useRef)(null);if((0,H.useEffect)(()=>{s.current&&a===`shades`&&s.current.focus()},[i,a]),i){let{colorName:e,shade:c}=i,l=n[e];if(Array.isArray(l))return(0,W.jsx)(`div`,{className:`color-picker-content--default shades`,children:l.map((n,i)=>(0,W.jsxs)(`button`,{ref:i===c&&a===`shades`?s:void 0,tabIndex:-1,type:`button`,className:U(`color-picker__button color-picker__button--large has-outline`,{active:i===c}),"aria-label":`Shade`,title:`${e} - ${i+1}`,style:n?{"--swatch-color":n}:void 0,onClick:()=>{t(n),o(`shades`)},children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`}),r&&(0,W.jsx)(IC,{color:n,keyLabel:i+1,isShade:!0})]},i))})}return(0,W.jsxs)(`div`,{className:`color-picker-content--default`,style:{position:`relative`},tabIndex:-1,children:[(0,W.jsx)(`button`,{type:`button`,tabIndex:-1,className:`color-picker__button color-picker__button--large color-picker__button--no-focus-visible`}),(0,W.jsx)(`div`,{tabIndex:-1,style:{position:`absolute`,top:0,left:0,right:0,bottom:0,display:`flex`,alignItems:`center`,justifyContent:`center`,textAlign:`center`,fontSize:`0.75rem`},children:K(`colorPicker.noShades`)})]})},VC=(e,t,n)=>{let r=Math.ceil(n/5);switch(t??=-1,e){case`ArrowLeft`:{let e=t-1;return e<0?n-1:e}case`ArrowRight`:return(t+1)%n;case`ArrowDown`:{let e=t+5;return e>=n?t%5:e}case`ArrowUp`:{let e=t-5,i=e<0?5*r+e:e;return i>=n?void 0:i}}},HC=({e,colorObj:t,onChange:n,palette:r,customColors:i,setActiveColorPickerSection:a,activeShade:o})=>{if(t?.shade!=null&&[`Digit1`,`Digit2`,`Digit3`,`Digit4`,`Digit5`].includes(e.code)&&e.shiftKey){let i=Number(e.code.slice(-1))-1;return n(r[t.colorName][i]),a(`shades`),!0}if([`1`,`2`,`3`,`4`,`5`].includes(e.key)&&i[Number(e.key)-1])return n(i[Number(e.key)-1]),a(`custom`),!0;if(jC.includes(e.key)){let t=jC.indexOf(e.key),i=r[Object.keys(r)[t]];return n(Array.isArray(i)?i[o]:i),a(`baseColors`),!0}return!1},UC=({event:e,activeColorPickerSection:t,palette:n,color:r,onChange:i,customColors:a,setActiveColorPickerSection:o,updateData:s,activeShade:c,onEyeDropperToggle:l,onEscape:u})=>{if(e[N.CTRL_OR_CMD])return!1;if(e.key===N.ESCAPE)return u(e),!0;if(e.key===N.ALT)return l(!0),!0;if(e.key===N.I)return l(),!0;let d=AC({color:r,palette:n});if(e.key===N.TAB){let s={custom:!!a.length,baseColors:!0,shades:d?.shade!=null,hex:!0},c=Object.entries(s).reduce((e,[t,n])=>(n&&e.push(t),e),[]),l=c.indexOf(t),u=e.shiftKey?-1:1,f=c[l+u>c.length-1?0:l+u<0?c.length-1:l+u];return f&&o(f),f===`custom`?i(a[0]):f===`baseColors`&&(Object.entries(n).find(([e,t])=>Array.isArray(t)?t.includes(r):t===r?e:null)||i(hi.black)),e.preventDefault(),e.stopPropagation(),!0}if(HC({e,colorObj:d,onChange:i,palette:n,customColors:a,setActiveColorPickerSection:o,activeShade:c}))return!0;if(t===`shades`&&d){let{shade:t}=d,r=VC(e.key,t,5);if(r!==void 0)return i(n[d.colorName][r]),!0}if(t===`baseColors`&&d){let{colorName:t}=d,r=Object.keys(n),a=r.indexOf(t),o=VC(e.key,a,r.length);if(o!==void 0){let e=n[r[o]];return i(Array.isArray(e)?e[c]:e),!0}}if(t===`custom`){let t=r==null?0:a.indexOf(r),n=VC(e.key,t,a.length);if(n!==void 0){let e=a[n];return i(e),!0}}return!1},WC=H.forwardRef(({color:e,onChange:t,type:n,elements:r,palette:i,updateData:a,children:o,showTitle:s,onEyeDropperToggle:c,onEscape:l,showHotKey:u=!0},d)=>{let f=s?n===`elementStroke`?K(`labels.stroke`):n===`elementBackground`?K(`labels.background`):null:null,[p]=H.useState(()=>n===`canvasBackground`?[]:NC(r,n,i)),[m,h]=vy(PC),g=AC({color:e,palette:i});(0,H.useEffect)(()=>{if(!m){let t=!!e&&MC({color:e,palette:i});h(t&&!p.includes(e)?null:t?`custom`:g?.shade==null?`baseColors`:`shades`)}},[m,e,i,h,g,p]);let[_,v]=(0,H.useState)(g?.shade??(n===`elementBackground`?1:4));(0,H.useEffect)(()=>{g?.shade!=null&&v(g.shade);let e=e=>{e.key===N.ALT&&c(!1)};return document.addEventListener(F.KEYUP,e,{capture:!0}),()=>{document.removeEventListener(F.KEYUP,e,{capture:!0})}},[g,c]);let y=H.useRef(null);return(0,H.useImperativeHandle)(d,()=>y.current),(0,H.useEffect)(()=>{y?.current?.focus()},[]),(0,W.jsx)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-label":K(`labels.colorPicker`),children:(0,W.jsxs)(`div`,{ref:y,onKeyDown:n=>{UC({event:n,activeColorPickerSection:m,palette:i,color:e,onChange:t,onEyeDropperToggle:c,customColors:p,setActiveColorPickerSection:h,updateData:a,activeShade:_,onEscape:l})&&(n.preventDefault(),n.stopPropagation())},className:`color-picker-content properties-content`,tabIndex:-1,children:[f&&(0,W.jsx)(`div`,{className:`color-picker__title`,children:f}),!!p.length&&(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.mostUsedCustomColors`)}),(0,W.jsx)(LC,{colors:p,color:e,label:K(`colorPicker.mostUsedCustomColors`),onChange:t})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.colors`)}),(0,W.jsx)(RC,{color:e,palette:i,onChange:t,activeShade:_,showHotKey:u})]}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.shades`)}),(0,W.jsx)(BC,{color:e,onChange:t,palette:i,showHotKey:u})]}),o]})})}),GC=({onChange:e,type:t,activeColor:n,topPicks:r})=>{let i;return t===`elementStroke`&&(i=ln),t===`elementBackground`&&(i=ta),t===`canvasBackground`&&(i=Mr),r&&(i=r),i?(0,W.jsx)(`div`,{className:`color-picker__top-picks`,children:i.map(t=>(0,W.jsx)(`button`,{className:U(`color-picker__button`,{active:t===n,"is-transparent":t===`transparent`||!t,"has-outline":!yt(t,240)}),style:{"--swatch-color":t},type:`button`,title:t,onClick:()=>e(t),"data-testid":`color-top-pick-${t}`,children:(0,W.jsx)(`div`,{className:`color-picker__button-outline`})},t))}):(console.error(`Invalid type for TopPicks`),null)},KC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,updateData:o,getOpenPopup:s,appState:c})=>{let{container:l}=oz(),u=az(),d=u!==`full`,f=u===`mobile`,[,p]=vy(PC),[m,h]=vy(bC),g=(0,W.jsxs)(`div`,{children:[(0,W.jsx)(zC,{children:K(`colorPicker.hexCode`)}),(0,W.jsx)(FC,{color:t||``,label:r,onChange:e=>{n(e)},colorPickerType:e,placeholder:K(`colorPicker.color`)})]}),_=(0,H.useRef)(null),v=()=>{_.current?.focus()};return(0,W.jsx)(CC,{container:l,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!c.editingTextElement,onFocusOutside:e=>{Wr(e.target)||v(),e.preventDefault()},onPointerDownOutside:e=>{m&&e.preventDefault()},onClose:()=>{s()===e&&o({openPopup:null}),p(null),c.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},children:a?(0,W.jsx)(WC,{ref:_,palette:a,color:t,onChange:e=>{let t=c.editingTextElement?TC():null;n(e),c.editingTextElement&&t&&EC(t)},onEyeDropperToggle:t=>{h(r=>t?(r||={keepOpenOnAlt:!0,onSelect:n,colorPickerType:e},r.keepOpenOnAlt=!0,r):t===!1||r?null:{keepOpenOnAlt:!1,onSelect:n,colorPickerType:e})},onEscape:e=>{m?h(null):o({openPopup:null})},type:e,elements:i,updateData:o,showTitle:d,showHotKey:!f,children:g}):g})},qC=({label:e,color:t,type:n,mode:r=`background`,onToggle:i,editingTextElement:a})=>{let o=az(),s=o!==`full`,c=o===`mobile`,l=e=>{e.preventDefault(),e.stopPropagation(),a&&kC(),i()};return(0,W.jsxs)(H_,{type:`button`,className:U(`color-picker__button active-color properties-trigger`,{"is-transparent":!t||t===`transparent`,"has-outline":!t||!yt(t,240),"compact-sizing":s,"mobile-border":c}),"aria-label":e,style:t?{"--swatch-color":t}:void 0,title:K(n===`elementStroke`?`labels.showStroke`:`labels.showBackground`),"data-openpopup":n,onClick:l,children:[(0,W.jsx)(`div`,{className:`color-picker__button-outline`,children:!t&&Mb}),s&&t&&r===`stroke`&&(0,W.jsx)(`div`,{className:`color-picker__button-background`,children:(0,W.jsx)(`span`,{style:{color:t&&yt(t,240)?`#fff`:`#111`},children:qS})})]})},JC=({type:e,color:t,onChange:n,label:r,elements:i,palette:a=hi,topPicks:o,updateData:s,appState:c})=>{let l=(0,H.useRef)(c.openPopup);(0,H.useEffect)(()=>{l.current=c.openPopup},[c.openPopup]);let u=az()!==`full`;return(0,W.jsx)(`div`,{children:(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`color-picker-container`,{"color-picker-container--no-top-picks":u}),children:[!u&&(0,W.jsx)(GC,{activeColor:t,onChange:n,type:e,topPicks:o}),!u&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:c.openPopup===e,onOpenChange:t=>{t&&s({openPopup:e})},children:[(0,W.jsx)(qC,{color:t,label:r,type:e,mode:e===`elementStroke`?`stroke`:`background`,editingTextElement:!!c.editingTextElement,onToggle:()=>{c.openPopup===e?s({openPopup:null}):(c.openPopup,s({openPopup:e}))}}),c.openPopup===e&&(0,W.jsx)(KC,{type:e,color:t,onChange:n,label:r,elements:i,palette:a,updateData:s,getOpenPopup:()=>l.current,appState:c})]})]})})},YC=H.forwardRef(({className:e,placeholder:t,onChange:n},r)=>(0,W.jsxs)(`div`,{className:U(`QuickSearch__wrapper`,e),children:[vS,(0,W.jsx)(`input`,{ref:r,className:`QuickSearch__input`,type:`text`,placeholder:t,onChange:e=>n(e.target.value.trim().toLowerCase())})]})),XC=({className:e,placeholder:t,children:n})=>{let r=!H.Children.count(n);return(0,W.jsx)(`div`,{className:U(`ScrollableList__wrapper`,e),role:`menu`,children:r?(0,W.jsx)(`div`,{className:`empty`,children:t}):n})},ZC=({children:e,className:t=``,style:n,title:r})=>(0,W.jsxs)(`div`,{className:`dropdown-menu-group ${t}`,style:n,children:[r&&(0,W.jsx)(`p`,{className:`dropdown-menu-group-title`,children:r}),e]}),QC=ZC;ZC.displayName=`DropdownMenuGroup`;var $C=H.createContext({}),ew=(e=``,t=!1,n=!1)=>`dropdown-menu-item dropdown-menu-item-base ${e} ${t?`dropdown-menu-item--selected`:``} ${n?`dropdown-menu-item--hovered`:``}`.trim(),tw=e=>{let t=(0,H.useContext)($C);return ps(e,e=>{t.onSelect?.(e)})},nw=({children:e,...t})=>(0,W.jsx)(`span`,{...t,style:{textOverflow:`ellipsis`,overflow:`hidden`,whiteSpace:`nowrap`,...t.style},children:e}),rw=({textStyle:e,icon:t,shortcut:n,children:r,badge:i})=>{let a=iz();return(0,W.jsxs)(W.Fragment,{children:[t&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__icon`,children:t}),(0,W.jsx)(`div`,{style:e,className:`dropdown-menu-item__text`,children:(0,W.jsx)(nw,{children:r})}),i&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__badge`,children:i}),n&&a.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__shortcut`,children:n})]})},iw=({icon:e,badge:t,value:n,children:r,shortcut:i,className:a,selected:o,onSelect:s,...c})=>{let l=tw(s);return(0,W.jsx)(d_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,W.jsx)(`button`,{...c,value:n,className:ew(a,o),title:c.title??c[`aria-label`],children:(0,W.jsx)(rw,{icon:e,shortcut:i,badge:t,children:r})})})};iw.displayName=`DropdownMenuItem`;var aw={GREEN:`green`,RED:`red`,BLUE:`blue`},ow=({type:e=aw.BLUE,children:t})=>{let{theme:n}=cz(),r={display:`inline-flex`,marginLeft:`auto`,padding:`2px 4px`,borderRadius:6,fontSize:9,fontFamily:`Cascadia, monospace`,border:n===R.LIGHT?`1.5px solid white`:`none`};switch(e){case aw.GREEN:Object.assign(r,{backgroundColor:`var(--background-color-badge)`,color:`var(--color-badge)`});break;case aw.RED:Object.assign(r,{backgroundColor:`pink`,color:`darkred`});break;case aw.BLUE:default:Object.assign(r,{background:`var(--color-promo)`,color:`var(--color-surface-lowest)`})}return(0,W.jsx)(`div`,{className:`DropDownMenuItemBadge`,style:r,children:t})};ow.displayName=`DropdownMenuItemBadge`,iw.Badge=ow;var sw=iw,cw=({event:e,inputRef:t,hoveredFont:n,filteredFonts:r,onClose:i,onSelect:a,onHover:o})=>{if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F)return t.current?.focus(),!0;if(e.key===N.ESCAPE)return i(),!0;if(e.key===N.ENTER)return n?.value&&a(n.value),!0;if(e.key===N.ARROW_DOWN)return n?.next?o(n.next.value):r[0]?.value&&o(r[0].value),!0;if(e.key===N.ARROW_UP)return n?.prev?o(n.prev.value):r[r.length-1]?.value&&o(r[r.length-1].value),!0},lw=e=>{switch(e){case to.Excalifont:case to.Virgil:return ab;case to.Nunito:case to.Helvetica:return Bx;case to[`Lilita One`]:return zx;case to[`Comic Shanns`]:case to.Cascadia:return Hx;default:return Bx}},uw=H.memo(({selectedFontFamily:e,hoveredFontFamily:t,onSelect:n,onHover:r,onLeave:i,onOpen:a,onClose:o})=>{let{container:s}=oz(),c=nz(),{fonts:l}=c,{showDeprecatedFonts:u}=rz(),d=az(),[f,p]=(0,H.useState)(``),m=(0,H.useRef)(null),h=(0,H.useMemo)(()=>Array.from(de.registered.entries()).filter(([e,{metadata:t}])=>!t.private&&!t.fallback).map(([e,{metadata:t,fontFaces:n}])=>{let r={value:e,icon:lw(e),text:n[0]?.fontFace?.family??`Unknown`};return t.deprecated&&Object.assign(r,{deprecated:t.deprecated,badge:{type:aw.RED,placeholder:K(`fontList.badge.old`)}}),r}).sort((e,t)=>e.text.toLowerCase()>t.text.toLowerCase()?1:-1),[]),g=(0,H.useMemo)(()=>new Set(l.getSceneFamilies()),[e]),_=(0,H.useMemo)(()=>h.filter(e=>g.has(e.value)),[h,g]),v=(0,H.useMemo)(()=>h.filter(e=>!g.has(e.value)&&(u||!e.deprecated)),[h,g,u]),y=(0,H.useMemo)(()=>Kr([..._,...v].filter(e=>e.text?.toLowerCase().includes(f))),[_,v,f]),b=(0,H.useMemo)(()=>{let n;return t?n=y.find(e=>e.value===t):e&&(n=y.find(t=>t.value===e)),!n&&f&&(y[0]?.value?r(y[0].value):i()),n},[t,e,f,y,r,i]),x=(0,H.useCallback)(e=>{let t=null;if(c.state.editingTextElement){let e=document.querySelector(`.excalidraw-wysiwyg`);e&&(t={start:e.selectionStart,end:e.selectionEnd})}n(e),c.state.editingTextElement&&t&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&t&&(e.focus(),e.selectionStart=t.start,e.selectionEnd=t.end)},0)},[n,c.state.editingTextElement]),S=(0,H.useCallback)(e=>{cw({event:e,inputRef:m,hoveredFont:b,filteredFonts:y,onSelect:x,onHover:r,onClose:o})&&(e.preventDefault(),e.stopPropagation())},[b,y,x,r,o]);(0,H.useEffect)(()=>(a(),()=>{o()}),[]);let C=(0,H.useMemo)(()=>y.filter(e=>g.has(e.value)),[y,g]),w=(0,H.useMemo)(()=>y.filter(e=>!g.has(e.value)),[y,g]),T=({font:t,order:n})=>{let i=(0,H.useRef)(null),a=t.value===b?.value,o=t.value===e;return(0,H.useEffect)(()=>{a&&(n===0?i.current?.scrollIntoView?.({block:`end`}):i.current?.scrollIntoView?.({block:`nearest`}))},[a,n]),(0,W.jsx)(`button`,{ref:i,type:`button`,value:t.value,className:ew(``,o,a),title:t.text,tabIndex:o?0:-1,onClick:e=>{x(Number(e.currentTarget.value))},onMouseMove:()=>{b?.value!==t.value&&r(t.value)},children:(0,W.jsx)(rw,{icon:t.icon,badge:t.badge&&(0,W.jsx)(ow,{type:t.badge.type,children:t.badge.placeholder}),textStyle:{fontFamily:yo({fontFamily:t.value})},children:t.text})})},E=[];return C.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.sceneFonts`),children:C.map((e,t)=>(0,W.jsx)(T,{font:e,order:t},e.value))},`group_1`)),w.length&&E.push((0,W.jsx)(QC,{title:K(`fontList.availableFonts`),children:w.map((e,t)=>(0,W.jsx)(T,{font:e,order:t+C.length},e.value))},`group_2`)),(0,W.jsxs)(CC,{className:`properties-content`,container:s,style:{width:`15rem`},onClose:()=>{o(),c.state.editingTextElement&&setTimeout(()=>{let e=document.querySelector(`.excalidraw-wysiwyg`);e&&e.focus()},0)},onPointerLeave:i,onKeyDown:S,preventAutoFocusOnTouch:!!c.state.editingTextElement,children:[d===`full`&&(0,W.jsx)(YC,{ref:m,placeholder:K(`quickSearch.placeholder`),onChange:wt(p,20)}),(0,W.jsx)(XC,{className:`dropdown-menu fonts manual-hover`,placeholder:K(`fontList.empty`),children:E.length?E:null})]})},(e,t)=>e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),dw=({selectedFontFamily:e,isOpened:t=!1,compactMode:n=!1})=>{let r=lz(),i=n?{...Bs,width:`2rem`,height:`2rem`}:{};return(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`div`,{"data-openpopup":`fontFamily`,className:`properties-trigger`,children:(0,W.jsx)(fC,{standalone:!0,icon:ob,title:K(`labels.showFonts`),className:`properties-trigger`,testId:`font-family-show-fonts`,active:t,onClick:()=>{r(e=>({openPopup:e.openPopup===`fontFamily`?null:e.openPopup}))},style:{border:`none`,...i}})})})},fw=[{value:to.Excalifont,icon:ab,text:K(`labels.handDrawn`),testId:`font-family-hand-drawn`},{value:to.Nunito,icon:Bx,text:K(`labels.normal`),testId:`font-family-normal`},{value:to[`Comic Shanns`],icon:Hx,text:K(`labels.code`),testId:`font-family-code`}];new Set(fw.map(e=>e.value));var pw=H.memo(({isOpened:e,selectedFontFamily:t,hoveredFontFamily:n,onSelect:r,onHover:i,onLeave:a,onPopupChange:o,compactMode:s=!1})=>{let c=(0,H.useMemo)(()=>fw,[]),l=(0,H.useCallback)(e=>{e&&r(e)},[r]);return(0,W.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,className:U(`FontPicker__container`,{"FontPicker__container--compact":s}),children:[!s&&(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:c,value:t,onClick:l})}),!s&&(0,W.jsx)(mC,{}),(0,W.jsxs)(V_,{open:e,onOpenChange:o,children:[(0,W.jsx)(dw,{selectedFontFamily:t,isOpened:e,compactMode:s}),e&&(0,W.jsx)(uw,{selectedFontFamily:t,hoveredFontFamily:n,onSelect:l,onHover:i,onLeave:a,onOpen:()=>o(!0),onClose:()=>o(!1)})]})]})},(e,t)=>e.isOpened===t.isOpened&&e.selectedFontFamily===t.selectedFontFamily&&e.hoveredFontFamily===t.hoveredFontFamily),mw=({className:e,icon:t,size:n=`1em`})=>(0,W.jsx)(`span`,{className:e,style:{width:n,height:`100%`,margin:`0 0.5ex 0 0.5ex`,display:`inline-flex`,lineHeight:0,verticalAlign:`middle`,flex:`0 0 auto`},children:t}),hw=({label:e,open:t,openTrigger:n,children:r,className:i,showCollapsedIcon:a=!0})=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{style:{cursor:`pointer`,display:`flex`,justifyContent:`space-between`,alignItems:`center`},className:i,onClick:n,children:[e,a&&(0,W.jsx)(mw,{icon:t?HS:VS})]}),t&&(0,W.jsx)(`div`,{style:{display:`flex`,flexDirection:`column`},children:r})]}),gw=yc(!1),_w=4,vw=`default`,yw=e=>e.flatMap(e=>e.options),bw=(e,t)=>{for(let n of e){let e=n.options.find(t);if(e)return e}return null},xw=(e,t)=>e.some(e=>e.options.some(t)),Sw=e=>e.flatMap(e=>Array.from({length:Math.ceil(e.options.length/_w)},(t,n)=>e.options.slice(n*_w,n*_w+_w)));function Cw({visibleSections:e,hiddenSections:t=[],value:n,label:r,onChange:i,onClose:a}){let o=iz(),{container:s}=oz(),[c,l]=vy(gw),u=yw([...e,...t]),d=Sw([...e,...c?t:[]]),f=e=>{let t=u.find(t=>t.keyBinding===e.key.toLowerCase());if(!(e.metaKey||e.altKey||e.ctrlKey)&&t)i(t.value),e.preventDefault();else if(e.key===N.TAB){let t=u.findIndex(e=>e.value===n);i(u[e.shiftKey?(u.length+t-1)%u.length:(t+1)%u.length].value)}else if(Pe(e.key)){let t=My().rtl,r=u.findIndex(e=>e.value===n);if(r!==-1){let a=u.length,o=r;switch(e.key){case t?N.ARROW_LEFT:N.ARROW_RIGHT:o=(r+1)%a;break;case t?N.ARROW_RIGHT:N.ARROW_LEFT:o=(a+r-1)%a;break;case N.ARROW_DOWN:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(t+1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}case N.ARROW_UP:{let t=d.findIndex(e=>e.some(e=>e.value===n)),a=d[t];if(t!==-1&&a){let o=a.findIndex(e=>e.value===n),s=d[(d.length+t-1)%d.length];i((s[Math.min(o,s.length-1)]??u[r]).value),e.preventDefault(),e.nativeEvent.stopImmediatePropagation(),e.stopPropagation();return}break}}i(u[o].value)}e.preventDefault()}else (e.key===N.ESCAPE||e.key===N.ENTER)&&(e.preventDefault(),a());e.nativeEvent.stopImmediatePropagation(),e.stopPropagation()};(0,H.useEffect)(()=>{xw(t,e=>e.value===n)&&l(!0)},[n,t,l]);let p=e=>(0,W.jsx)(`div`,{className:`picker-content`,children:e.map(e=>(0,W.jsxs)(`button`,{type:`button`,className:U(`picker-option`,{active:n===e.value}),onClick:()=>{i(e.value)},title:e.keyBinding?`${e.text} \u2014 ${e.keyBinding.toUpperCase()}`:e.text,"aria-label":e.text||`none`,"aria-keyshortcuts":e.keyBinding||void 0,ref:t=>{n===e.value&&setTimeout(()=>{t?.focus()},0)},children:[e.icon,e.keyBinding&&(0,W.jsx)(`span`,{className:`picker-keybinding`,children:e.keyBinding})]},e.text))}),m=e=>e.map((e,t)=>e.name===vw?(0,W.jsx)(H.Fragment,{children:p(e.options)},`${e.name}-${t}`):(0,W.jsxs)(`div`,{className:`picker-section`,children:[(0,W.jsx)(`div`,{className:`picker-section-label`,children:e.name}),p(e.options)]},`${e.name}-${t}`)),h=o.formFactor===`phone`;return(0,W.jsx)(W_,{side:h?`right`:`bottom`,align:`start`,sideOffset:h?8:12,style:{zIndex:`var(--zIndex-ui-styles-popup)`},onKeyDown:f,collisionBoundary:s??void 0,children:(0,W.jsx)(`div`,{className:`picker`,role:`dialog`,"aria-modal":`true`,"aria-label":r,children:(0,W.jsxs)(`div`,{className:`picker-sections`,children:[m(e),t.length>0&&(0,W.jsx)(hw,{label:K(`labels.more_options`),open:c,openTrigger:()=>{l(e=>!e)},className:`picker-collapsible`,children:(0,W.jsx)(`div`,{className:`picker-sections`,children:m(t)})})]})})})}function ww({value:e,label:t,visibleSections:n,hiddenSections:r,onChange:i}){let[a,o]=H.useState(!1),s=(0,H.useMemo)(()=>bw(n,t=>t.value===e)??bw(r??[],t=>t.value===e),[n,r,e]);return(0,W.jsx)(`div`,{children:(0,W.jsxs)(V_,{open:a,onOpenChange:e=>o(e),children:[(0,W.jsx)(H_,{type:`button`,"aria-label":t,onClick:()=>o(!a),className:a?`active`:``,children:s?.icon}),a&&(0,W.jsx)(Cw,{visibleSections:n,hiddenSections:r,value:e,label:t,onChange:i,onClose:()=>{o(!1)}})]})})}var Tw=({updateData:e,app:t,testId:n})=>{let r=H.useRef(null),i=H.useRef(null),a=t.scene.getSelectedElements(t.state),o=!0,s=a.at(0),c=a.reduce((e,t)=>(e!=null&&e!==t.opacity&&(o=!1),e==null||e>t.opacity?t.opacity:e),s?.opacity??null)??t.state.currentItemOpacity;return(0,H.useEffect)(()=>{if(r.current&&i.current){let e=r.current,t=i.current,n=e.offsetWidth,a=c/100*(n-15)+15/2;t.style.left=`${a}px`,e.style.background=`linear-gradient(to right, var(--color-slider-track) 0%, var(--color-slider-track) ${c}%, var(--button-bg) ${c}%, var(--button-bg) 100%)`}},[c]),(0,W.jsxs)(`label`,{className:`control-label`,children:[K(`labels.opacity`),(0,W.jsxs)(`div`,{className:`range-wrapper`,children:[(0,W.jsx)(`input`,{style:{"--color-slider-track":o?void 0:`var(--button-bg)`},ref:r,type:`range`,min:`0`,max:`100`,step:`10`,onChange:t=>{e(+t.target.value)},value:c,className:`range-input`,"data-testid":n}),(0,W.jsx)(`div`,{className:`value-bubble`,ref:i,children:c===0?null:c}),(0,W.jsx)(`div`,{className:`zero-label`,children:`0`})]})]})},Ew=.1,Dw=e=>{let t=Ka(e.editorInterface);return{stylesPanelMode:t,isCompact:t!==`full`,isMobile:t===`mobile`}},Ow=(e,t,n,r=!1)=>{let i=lr(ir(e,t,{includeBoundTextElement:r}));return e.map(e=>i.get(e.id)||e.id===t.editingTextElement?.id?n(e):e)},kw=function(e,t,n,r,i){let a=t.state.editingTextElement,o=Cs(e),s=null;if(a&&(s=n(a)),!s)if(Ya(o,t.state)){let e=t.scene.getSelectedElements(t.state);s=it(r===!0?e:e.filter(e=>r(e)),n)??(typeof i==`function`?i(!0):i)}else s=typeof i==`function`?i(!1):i;return s},Aw=(e,t,n)=>ya(t)||!t.autoResize?t:n.mutateElement(t,{x:e.textAlign===`left`?e.x:e.x+(e.width-t.width)/(e.textAlign===`center`?2:1),y:e.y+(e.height-t.height)/2}),jw=(e,t,n,r,i)=>{let a=new Set,o=Ow(e,t,e=>{if(M(e)){let t=r(e);a.add(t);let i=B(e,{fontSize:t});return Zi(i,n.scene.getContainerElement(e),n.scene),i=Aw(e,i,n.scene),i}return e},!0);return ir(e,t,{includeBoundTextElement:!0}).forEach(e=>{M(e)&&ue(e,n.scene)}),{elements:o,appState:{...t,currentItemFontSize:a.size===1?[...a][0]:i??t.currentItemFontSize},captureUpdate:V.IMMEDIATELY}};Z({name:`changeStrokeColor`,label:`labels.stroke`,trackEvent:!1,perform:(e,t,n)=>({...n?.currentItemStrokeColor&&{elements:Ow(e,t,e=>ye(e.type)?B(e,{strokeColor:n.currentItemStrokeColor}):e,!0)},appState:{...t,...n},captureUpdate:n?.currentItemStrokeColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.stroke`)}),(0,W.jsx)(JC,{topPicks:ln,palette:lt,type:`elementStroke`,label:K(`labels.stroke`),color:kw(e,r,e=>e.strokeColor,!0,e=>e?null:t.currentItemStrokeColor),onChange:e=>n({currentItemStrokeColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeBackgroundColor`,label:`labels.changeBackground`,trackEvent:!1,perform:(e,t,n,r)=>{if(!n?.currentItemBackgroundColor)return{appState:{...t,...n},captureUpdate:V.EVENTUALLY};let i,a=r.scene.getSelectedElements(t);if(!Po(n.currentItemBackgroundColor)&&a.every(e=>ca(e)&&Xo(e.points))){let t=lr(a);i=e.map(e=>t.has(e.id)&&ca(e)?B(e,{backgroundColor:n.currentItemBackgroundColor,...g(e,!0)}):e)}else i=Ow(e,t,e=>B(e,{backgroundColor:n.currentItemBackgroundColor}));return{elements:i,appState:{...t,...n},captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{stylesPanelMode:a}=Dw(r);return(0,W.jsxs)(W.Fragment,{children:[a===`full`&&(0,W.jsx)(`h3`,{"aria-hidden":`true`,children:K(`labels.background`)}),(0,W.jsx)(JC,{topPicks:ta,palette:et,type:`elementBackground`,label:K(`labels.background`),color:kw(e,r,e=>e.backgroundColor,!0,e=>e?null:t.currentItemBackgroundColor),onChange:e=>n({currentItemBackgroundColor:e}),elements:e,appState:t,updateData:n})]})}}),Z({name:`changeFillStyle`,label:`labels.fill`,trackEvent:!1,perform:(e,t,n,r)=>(dC(`element`,`changeFillStyle`,`${n} (${r.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),{elements:Ow(e,t,e=>B(e,{fillStyle:n})),appState:{...t,currentItemFillStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=ir(e,t),a=i.length>0&&i.every(e=>e.fillStyle===`zigzag`);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fill`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{type:`button`,options:[{value:`hachure`,text:`${K(a?`labels.zigzag`:`labels.hachure`)} (${Q(`Alt-Click`)})`,icon:a?ax:ox,active:a?!0:void 0,testId:`fill-hachure`},{value:`cross-hatch`,text:K(`labels.crossHatch`),icon:sx,testId:`fill-cross-hatch`},{value:`solid`,text:K(`labels.solid`),icon:cx,testId:`fill-solid`}],value:kw(e,r,e=>e.fillStyle,e=>e.hasOwnProperty(`fillStyle`),e=>e?null:t.currentItemFillStyle),onClick:(e,t)=>{n(t.altKey&&e===`hachure`&&i.every(e=>e.fillStyle===`hachure`)?`zigzag`:e)}})})]})}}),Z({name:`changeStrokeWidth`,label:`labels.strokeWidth`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeWidth:n})),appState:{...t,currentItemStrokeWidth:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeWidth`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`stroke-width`,options:[{value:Ze.thin,text:K(`labels.thin`),icon:lx,testId:`strokeWidth-thin`},{value:Ze.bold,text:K(`labels.bold`),icon:ux,testId:`strokeWidth-bold`},{value:Ze.extraBold,text:K(`labels.extraBold`),icon:dx,testId:`strokeWidth-extraBold`}],value:kw(e,r,e=>e.strokeWidth,e=>e.hasOwnProperty(`strokeWidth`),e=>e?null:t.currentItemStrokeWidth),onChange:e=>n(e)})})]})}),Z({name:`changeSloppiness`,label:`labels.sloppiness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{seed:se(),roughness:n})),appState:{...t,currentItemRoughness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.sloppiness`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`sloppiness`,options:[{value:0,text:K(`labels.architect`),icon:mx},{value:1,text:K(`labels.artist`),icon:hx},{value:2,text:K(`labels.cartoonist`),icon:gx}],value:kw(e,r,e=>e.roughness,e=>e.hasOwnProperty(`roughness`),e=>e?null:t.currentItemRoughness),onChange:e=>n(e)})})]})}),Z({name:`changeStrokeStyle`,label:`labels.strokeStyle`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{strokeStyle:n})),appState:{...t,currentItemStrokeStyle:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.strokeStyle`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`strokeStyle`,options:[{value:`solid`,text:K(`labels.strokeStyle_solid`),icon:lx},{value:`dashed`,text:K(`labels.strokeStyle_dashed`),icon:fx},{value:`dotted`,text:K(`labels.strokeStyle_dotted`),icon:px}],value:kw(e,r,e=>e.strokeStyle,e=>e.hasOwnProperty(`strokeStyle`),e=>e?null:t.currentItemStrokeStyle),onChange:e=>n(e)})})]})}),Z({name:`changeOpacity`,label:`labels.opacity`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>B(e,{opacity:n}),!0),appState:{...t,currentItemOpacity:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({app:e,updateData:t})=>(0,W.jsx)(Tw,{updateData:t,app:e,testId:`opacity`})}),Z({name:`changeFontSize`,label:`labels.fontSize`,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,()=>(gt(n,`actionChangeFontSize: Expected a font size value`),n),n),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.fontSize`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`font-size`,options:[{value:os.sm,text:K(`labels.small`),icon:Px,testId:`fontSize-small`},{value:os.md,text:K(`labels.medium`),icon:Fx,testId:`fontSize-medium`},{value:os.lg,text:K(`labels.large`),icon:Ix,testId:`fontSize-large`},{value:os.xl,text:K(`labels.veryLarge`),icon:Lx,testId:`fontSize-veryLarge`}],value:kw(e,r,e=>{if(M(e))return e.fontSize;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.fontSize:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:t.currentItemFontSize||20),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})]})}});var Mw=Z({name:`decreaseFontSize`,label:`labels.decreaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(1/(1+Ew)*e.fontSize)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_LEFT||e.key===N.COMMA)}),Nw=Z({name:`increaseFontSize`,label:`labels.increaseFontSize`,icon:Rx,trackEvent:!1,perform:(e,t,n,r)=>jw(e,t,r,e=>Math.round(e.fontSize*(1+Ew))),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&(e.key===N.CHEVRON_RIGHT||e.key===N.PERIOD)});Z({name:`changeFontFamily`,label:`labels.fontFamily`,trackEvent:!1,perform:(e,t,n,r)=>{let{cachedElements:i,resetAll:a,resetContainers:o,...s}=n;if(a)return{elements:Ow(e,t,e=>{let t=i?.get(e.id);return t?B(e,{...t}):e},!0),appState:{...t,...s},captureUpdate:V.NEVER};gt(n,`actionChangeFontFamily: value must be defined`);let{currentItemFontFamily:c,currentHoveredFontFamily:l}=n,u=V.EVENTUALLY,d,f=!1;if(c)d=c,u=V.IMMEDIATELY;else if(l){d=l,u=V.EVENTUALLY;let n=ir(e,t,{includeBoundTextElement:!0}).filter(e=>M(e));if(n.length>200)f=!0;else{let e=0,t=0;for(;e<n.length&&t<5e3;){let r=n[e];t+=r?.originalText.length||0,e++}t>5e3&&(f=!0)}}let p={appState:{...t,...s},captureUpdate:u};if(d&&!f){let n=new Map,a=new Set,s=!1,u=Array.from(de.loadedFontsCache.values()),f=Object.entries(to).find(([e,t])=>t===d)?.[0];l&&f&&u.some(e=>e.startsWith(f))&&(s=!0),Object.assign(p,{elements:Ow(e,t,e=>{if(M(e)&&(e.fontFamily!==d||c)){let t=B(e,{fontFamily:d,lineHeight:ba(d)}),c=i?.get(e.containerId||``)||{},l=r.scene.getContainerElement(e);return o&&l&&c&&r.scene.mutateElement(l,{...c}),s||(a=new Set([...a,...Array.from(t.originalText)])),n.set(t,l),t}return e},!0)});let m=`10px ${yo({fontFamily:d})}`,h=Array.from(a.values()).join();if(s||window.document.fonts.check(m,h))for(let[e,t]of n)Zi(e,t,r.scene);else window.document.fonts.load(m,h).then(e=>{for(let[e,t]of n){let n=r.scene.getElement(e.id),i=t?r.scene.getElement(t.id):null;n&&Zi(n,i,r.scene)}r.fonts.onLoaded(e)})}return p},PanelComponent:({elements:e,appState:t,app:n,updateData:r})=>{let i=(0,H.useRef)(new Map),a=(0,H.useRef)(null),[o,s]=(0,H.useState)({}),c=(0,H.useRef)(!0),{stylesPanelMode:l,isCompact:u}=Dw(n),d=(0,H.useMemo)(()=>{let r=(e,r)=>kw(e,n,e=>{if(M(e))return e.fontFamily;let t=ut(e,r);return t?t.fontFamily:null},e=>M(e)||ut(e,r)!==null,e=>e?null:t.currentItemFontFamily||$r);return o.openPopup===`fontFamily`&&t.openPopup===`fontFamily`?r(Array.from(i.current?.values()??[]),i.current):!o.openPopup&&t.openPopup!==`fontFamily`?r(e,n.scene.getNonDeletedElementsMap()):a.current},[o.openPopup,t,e,n]);return(0,H.useEffect)(()=>{a.current=d},[d]),(0,H.useEffect)(()=>{Object.keys(o).length&&(r(o),s({}))},[o]),(0,H.useEffect)(()=>(c.current=!1,()=>{c.current=!0}),[]),(0,W.jsxs)(W.Fragment,{children:[l===`full`&&(0,W.jsx)(`legend`,{children:K(`labels.fontFamily`)}),(0,W.jsx)(pw,{isOpened:t.openPopup===`fontFamily`,selectedFontFamily:d,hoveredFontFamily:t.currentHoveredFontFamily,compactMode:l!==`full`,onSelect:e=>{DC(()=>{s({openPopup:null,currentHoveredFontFamily:null,currentItemFontFamily:e}),i.current.clear()},u,!!t.editingTextElement)},onHover:e=>{s({currentHoveredFontFamily:e,cachedElements:new Map(i.current),resetContainers:!0})},onLeave:()=>{s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0})},onPopupChange:r=>{if(r){i.current.clear();let{editingTextElement:r}=t;if(r?.type===`text`){let e=n.scene.getElement(r.id);i.current.set(r.id,B(e||r,{},!0))}else{let n=ir(e,t,{includeBoundTextElement:!0});for(let e of n)i.current.set(e.id,B(e,{},!0))}s({...o,openPopup:`fontFamily`})}else s({currentHoveredFontFamily:null,cachedElements:new Map(i.current),resetAll:!0}),i.current.clear(),u&&t.editingTextElement&&EC(null)}})]})}}),Z({name:`changeTextAlign`,label:`Change text alignment`,trackEvent:!1,perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{textAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t,currentItemTextAlign:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let a=r.scene.getNonDeletedElementsMap(),{isCompact:o}=Dw(r);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.textAlign`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:`left`,text:K(`labels.left`),icon:Ux,testId:`align-left`},{value:`center`,text:K(`labels.center`),icon:Wx,testId:`align-horizontal-center`},{value:`right`,text:K(`labels.right`),icon:Gx,testId:`align-right`}],value:kw(e,r,e=>{if(M(e))return e.textAlign;let t=ut(e,a);return t?t.textAlign:null},e=>M(e)||ut(e,a)!==null,e=>e?null:t.currentItemTextAlign),onChange:e=>{DC(()=>n(e),o,!!t.editingTextElement,i?.onPreventClose)}})})]})}}),Z({name:`changeVerticalAlign`,label:`Change vertical alignment`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:Ow(e,t,e=>{if(M(e)){let t=B(e,{verticalAlign:n});return Zi(t,r.scene.getContainerElement(e),r.scene),t}return e},!0),appState:{...t},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,data:i})=>{let{isCompact:a}=Dw(r);return(0,W.jsx)(`fieldset`,{children:(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`text-align`,options:[{value:Lr.TOP,text:K(`labels.alignTop`),icon:(0,W.jsx)(Kx,{theme:t.theme}),testId:`align-top`},{value:Lr.MIDDLE,text:K(`labels.centerVertically`),icon:(0,W.jsx)(Jx,{theme:t.theme}),testId:`align-middle`},{value:Lr.BOTTOM,text:K(`labels.alignBottom`),icon:(0,W.jsx)(qx,{theme:t.theme}),testId:`align-bottom`}],value:kw(e,r,e=>{if(M(e)&&e.containerId)return e.verticalAlign;let t=ut(e,r.scene.getNonDeletedElementsMap());return t?t.verticalAlign:null},e=>M(e)||ut(e,r.scene.getNonDeletedElementsMap())!==null,e=>e?null:Lr.MIDDLE),onChange:e=>{DC(()=>n(e),a,!!t.editingTextElement,i?.onPreventClose)}})})})}}),Z({name:`changeRoundness`,label:`Change edge roundness`,trackEvent:!1,perform:(e,t,n)=>({elements:Ow(e,t,e=>dr(e)?e:B(e,{roundness:n===`round`?{type:Ga(e.type)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null})),appState:{...t,currentItemRoundness:n},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>{let a=si(Cs(e),t).some(e=>e.roundness?.type===Xa.LEGACY);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.edges`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[(0,W.jsx)(pC,{group:`edges`,options:[{value:`sharp`,text:K(`labels.sharp`),icon:_x},{value:`round`,text:K(`labels.round`),icon:vx}],value:kw(e,r,e=>a?null:e.roundness?`round`:`sharp`,e=>!jt(e)&&e.hasOwnProperty(`roundness`),e=>e?null:t.currentItemRoundness),onChange:e=>n(e)}),i(`togglePolygon`)]})]})}});var Pw=e=>({visibleSections:[{name:`default`,options:[{value:null,text:K(`labels.arrowhead_none`),keyBinding:`q`,icon:(0,W.jsx)(yx,{flip:e})},{value:`arrow`,text:K(`labels.arrowhead_arrow`),keyBinding:`w`,icon:(0,W.jsx)(bx,{flip:e})},{value:`triangle`,text:K(`labels.arrowhead_triangle`),icon:(0,W.jsx)(xx,{flip:e}),keyBinding:`e`},{value:`triangle_outline`,text:K(`labels.arrowhead_triangle_outline`),icon:(0,W.jsx)(Sx,{flip:e}),keyBinding:`r`}]}],hiddenSections:[{name:`default`,options:[{value:`circle`,text:K(`labels.arrowhead_circle`),keyBinding:`a`,icon:(0,W.jsx)(Cx,{flip:e})},{value:`circle_outline`,text:K(`labels.arrowhead_circle_outline`),keyBinding:`s`,icon:(0,W.jsx)(wx,{flip:e})},{value:`diamond`,text:K(`labels.arrowhead_diamond`),icon:(0,W.jsx)(Tx,{flip:e}),keyBinding:`d`},{value:`diamond_outline`,text:K(`labels.arrowhead_diamond_outline`),icon:(0,W.jsx)(Ex,{flip:e}),keyBinding:`f`},{value:`bar`,text:K(`labels.arrowhead_bar`),keyBinding:`z`,icon:(0,W.jsx)(Dx,{flip:e})}]},{name:K(`labels.cardinality`),options:[{value:`cardinality_one`,text:K(`labels.arrowhead_cardinality_one`),icon:(0,W.jsx)(Ox,{flip:e}),keyBinding:`x`},{value:`cardinality_many`,text:K(`labels.arrowhead_cardinality_many`),icon:(0,W.jsx)(kx,{flip:e}),keyBinding:`c`},{value:`cardinality_one_or_many`,text:K(`labels.arrowhead_cardinality_one_or_many`),icon:(0,W.jsx)(Ax,{flip:e}),keyBinding:`v`},{value:`cardinality_exactly_one`,text:K(`labels.arrowhead_cardinality_exactly_one`),icon:(0,W.jsx)(jx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_one`,text:K(`labels.arrowhead_cardinality_zero_or_one`),icon:(0,W.jsx)(Mx,{flip:e}),keyBinding:null},{value:`cardinality_zero_or_many`,text:K(`labels.arrowhead_cardinality_zero_or_many`),icon:(0,W.jsx)(Nx,{flip:e}),keyBinding:null}]}]});Z({name:`changeArrowhead`,label:`Change arrowheads`,trackEvent:!1,perform:(e,t,n)=>(gt(n,`actionChangeArrowhead: value must be defined`),{elements:Ow(e,t,e=>{if(b(e)){let{position:t,type:r}=n;if(t===`start`)return B(e,{startArrowhead:r});if(t===`end`)return B(e,{endArrowhead:r})}return e}),appState:{...t,[n.position===`start`?`currentItemStartArrowhead`:`currentItemEndArrowhead`]:n.type},captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>{let i=My().rtl,a=(0,H.useMemo)(()=>Pw(!i),[i]),o=(0,H.useMemo)(()=>Pw(!!i),[i]);return(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowheads`)}),(0,W.jsxs)(`div`,{className:`iconSelectList buttonList`,children:[(0,W.jsx)(ww,{visibleSections:a.visibleSections,hiddenSections:a.hiddenSections,label:`arrowhead_start`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.startArrowhead):t.currentItemStartArrowhead,!0,e=>e?null:t.currentItemStartArrowhead),onChange:e=>n({position:`start`,type:e})}),(0,W.jsx)(ww,{visibleSections:o.visibleSections,hiddenSections:o.hiddenSections,label:`arrowhead_end`,value:kw(e,r,e=>b(e)&&Ms(e.type)?Qt(e.endArrowhead):t.currentItemEndArrowhead,!0,e=>e?null:t.currentItemEndArrowhead),onChange:e=>n({position:`end`,type:e})})]})]})}}),Z({name:`changeArrowProperties`,label:`Change arrow properties`,trackEvent:!1,perform:(e,t,n,r)=>!1,PanelComponent:({elements:e,appState:t,updateData:n,app:r,renderAction:i})=>(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[i(`changeArrowhead`),i(`changeArrowType`)]})}),Z({name:`changeArrowType`,label:`Change arrow types`,trackEvent:!1,perform:(e,t,n,r)=>{let i=Ow(e,t,e=>{if(!jt(e))return e;let i=r.scene.getNonDeletedElementsMap(),a=I.getPointAtIndexGlobalCoordinates(e,0,i),o=I.getPointAtIndexGlobalCoordinates(e,-1,i),s=B(e,{x:n===ts.elbow?a[0]:e.x,y:n===ts.elbow?a[1]:e.y,roundness:n===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,elbowed:n===ts.elbow,angle:n===ts.elbow?0:e.angle,points:n===ts.elbow||e.elbowed?[I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},a,i),I.pointFromAbsoluteCoords({...e,x:a[0],y:a[1],angle:0},o,i)]:e.points});if(dr(s)){s.fixedSegments=null;let e=r.scene.getNonDeletedElementsMap();r.dismissLinearEditor();let n=I.getPointAtIndexGlobalCoordinates(s,0,e),i=I.getPointAtIndexGlobalCoordinates(s,-1,e),a=s.startBinding&&e.get(s.startBinding.elementId),o=s.endBinding&&e.get(s.endBinding.elementId),c=a&&s.startBinding?{...s.startBinding,...wo(s,a,`start`,e,t.isBindingEnabled)}:null,l=o&&s.endBinding?{...s.endBinding,...wo(s,o,`end`,e,t.isBindingEnabled)}:null;s={...s,startBinding:c,endBinding:l,...fi(s,e,{points:[n,i].map(e=>O(e[0]-s.x,e[1]-s.y)),startBinding:c,endBinding:l,fixedSegments:null})}}else{let e=r.scene.getNonDeletedElementsMap();if(s.startBinding){let n=e.get(s.startBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`start`,r.scene)}if(s.endBinding){let n=e.get(s.endBinding.elementId);n&&$n(s,n,t.bindMode===`inside`?`inside`:`orbit`,`end`,r.scene)}}return s}),a={...t,currentItemArrowType:n},o=t.selectedLinearElement?.elementId;if(o){let t=i.find(e=>e.id===o);t&&(a.selectedLinearElement=new I(t,lr(e)))}return{elements:i,appState:a,captureUpdate:V.IMMEDIATELY}},PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.arrowtypes`)}),(0,W.jsx)(`div`,{className:`buttonList`,children:(0,W.jsx)(pC,{group:`arrowtypes`,options:[{value:ts.sharp,text:K(`labels.arrowtype_sharp`),icon:RS,testId:`sharp-arrow`},{value:ts.round,text:K(`labels.arrowtype_round`),icon:BS,testId:`round-arrow`},{value:ts.elbow,text:K(`labels.arrowtype_elbowed`),icon:zS,testId:`elbow-arrow`}],value:kw(e,r,e=>jt(e)?e.elbowed?ts.elbow:e.roundness?ts.round:ts.sharp:null,e=>jt(e),e=>e?null:t.currentItemArrowType),onChange:e=>n(e)})})]})});var Fw=()=>{let e=document.querySelector(`.excalidraw-tooltip`);if(e)return e;let t=document.createElement(`div`);return document.body.appendChild(t),t.classList.add(`excalidraw-tooltip`),t},Iw=(e,t,n=`bottom`)=>{let r=e.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight,o=t.left+t.width/2-r.width/2;o<0?o=5:o+r.width>=i&&(o=i-r.width-5);let s;n===`bottom`?(s=t.top+t.height+5,s+r.height>=a&&(s=t.top-r.height-5)):(s=t.top-r.height-5,s<0&&(s=t.top+t.height+5)),Object.assign(e.style,{top:`${s}px`,left:`${o}px`})},Lw=(e,t,n,r)=>{t.classList.add(`excalidraw-tooltip--visible`),t.style.minWidth=r?`50ch`:`10ch`,t.style.maxWidth=r?`50ch`:`15ch`,t.textContent=n,Iw(t,e.getBoundingClientRect())},Rw=({children:e,label:t,long:n=!1,style:r,disabled:i})=>((0,H.useEffect)(()=>()=>Fw().classList.remove(`excalidraw-tooltip--visible`),[]),i?null:(0,W.jsx)(`div`,{className:`excalidraw-tooltip-wrapper`,onPointerEnter:e=>Lw(e.currentTarget,Fw(),t,n),onPointerLeave:()=>Fw().classList.remove(`excalidraw-tooltip--visible`),style:r,children:e})),zw=`<svg viewBox="0 0 24 24" stroke-width="1" width="28" height="28" xmlns="http://www.w3.org/2000/svg">`,Bw=`<path d="M6.164 11.755a5.314 5.314 0 0 1-4.932-5.298 5.314 5.314 0 0 1 5.311-5.311 5.314 5.314 0 0 1 5.307 5.113l8.773 8.773a3.322 3.322 0 0 1 0 4.696l-.895.895a3.322 3.322 0 0 1-4.696 0l-8.868-8.868Z" style="fill:#fff"/>`,Vw=`<path stroke="#1b1b1f" fill="#fff" d="m7.868 11.113 7.773 7.774a2.359 2.359 0 0 0 1.667.691 2.368 2.368 0 0 0 2.357-2.358c0-.625-.248-1.225-.69-1.667L11.201 7.78 9.558 9.469l-1.69 1.643v.001Zm10.273 3.606-3.333 3.333m-3.25-6.583 2 2m-7-7 3 3M3.664 3.625l1 1M2.529 6.922l1.407-.144m5.735-2.932-1.118.866M4.285 9.823l.758-1.194m1.863-6.207-.13 1.408"/>`,Hw=`data:${hs.svg},${encodeURIComponent(`${zw}${Vw}</svg>`)}`,Uw=`data:${hs.svg},${encodeURIComponent(`${zw}${Bw}${Vw}</svg>`)}`,Ww=e=>{e&&(e.style.cursor=``)},Gw=(e,t)=>{e&&(e.style.cursor=t)},Kw,qw,Jw=(e,t)=>{(!Kw||Kw.theme!==t)&&(()=>{let e=t===R.DARK;Kw=document.createElement(`canvas`),Kw.theme=t,Kw.height=20,Kw.width=20;let n=Kw.getContext(`2d`);n.lineWidth=1,n.beginPath(),n.arc(Kw.width/2,Kw.height/2,5,0,2*Math.PI),n.fillStyle=e?`#000`:`#fff`,n.fill(),n.strokeStyle=e?`#fff`:`#000`,n.stroke(),qw=Kw.toDataURL(hs.svg)})(),Gw(e,`url(${qw}) ${20/2} ${20/2}, auto`)},Yw=(e,t)=>{if(e)if(t.activeTool.type===`selection`)Ww(e);else if(Fs(t))e.style.cursor=Kn.GRAB;else if(zr(t))Jw(e,t.theme);else if(t.activeTool.type===`laser`){let n=t.theme===R.LIGHT?Hw:Uw;e.style.cursor=`url(${n}), auto`}else [`image`,`custom`].includes(t.activeTool.type)?t.activeTool.type!==`image`&&(e.style.cursor=Kn.AUTO):e.style.cursor=Kn.CROSSHAIR},Xw=({viewportX:e,viewportY:t,nextZoom:n},r)=>{let i=e-r.offsetLeft,a=t-r.offsetTop,o=r.zoom.value,s=r.scrollX+(i-i/o),c=r.scrollY+(a-a/o),l=-(i-i/n),u=-(a-a/n);return{scrollX:s+l,scrollY:c+u,zoom:{value:n}}};Z({name:`changeViewBackgroundColor`,label:`labels.canvasBackground`,trackEvent:!1,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.changeViewBackgroundColor&&!t.viewModeEnabled,perform:(e,t,n)=>({appState:{...t,...n},captureUpdate:n?.viewBackgroundColor?V.IMMEDIATELY:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n,appProps:r,data:i})=>(0,W.jsx)(JC,{palette:null,topPicks:Mr,label:K(`labels.canvasBackground`),type:`canvasBackground`,color:t.viewBackgroundColor,onChange:e=>n({viewBackgroundColor:e}),"data-testid":`canvas-background-picker`,elements:e,appState:t,updateData:n})});var Zw=Z({name:`clearCanvas`,label:`labels.clearCanvas`,icon:pb,trackEvent:{category:`canvas`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.clearCanvas&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`,perform:(e,t,n,r)=>(r.imageCache.clear(),{elements:e.map(e=>B(e,{isDeleted:!0})),appState:{...cs(),files:{},theme:t.theme,penMode:t.penMode,penDetected:t.penDetected,exportBackground:t.exportBackground,exportEmbedScene:t.exportEmbedScene,gridSize:t.gridSize,gridStep:t.gridStep,gridModeEnabled:t.gridModeEnabled,stats:t.stats,activeTool:t.activeTool.type===`image`?{...t.activeTool,type:r.state.preferredSelectionTool.type}:t.activeTool},captureUpdate:V.IMMEDIATELY})}),Qw=Z({name:`zoomIn`,label:`buttons.zoomIn`,viewMode:!0,icon:ub,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value+qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-in-button zoom-button`,icon:ub,title:`${K(`buttons.zoomIn`)} \u2014 ${Q(`CtrlOrCmd++`)}`,"aria-label":K(`buttons.zoomIn`),disabled:t.zoom.value>=30,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.EQUAL||e.code===Gs.NUM_ADD)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),$w=Z({name:`zoomOut`,label:`buttons.zoomOut`,icon:db,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(t.zoom.value-qi)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(X,{type:`button`,className:`zoom-out-button zoom-button`,icon:db,title:`${K(`buttons.zoomOut`)} \u2014 ${Q(`CtrlOrCmd+-`)}`,"aria-label":K(`buttons.zoomOut`),disabled:t.zoom.value<=mn,onClick:()=>{e(null)}}),keyTest:e=>(e.code===Gs.MINUS||e.code===Gs.NUM_SUBTRACT)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),eT=Z({name:`resetZoom`,label:`buttons.resetZoom`,icon:fb,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>({appState:{...t,...Xw({viewportX:t.width/2+t.offsetLeft,viewportY:t.height/2+t.offsetTop,nextZoom:_i(1)},t),userToFollow:null},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,appState:t})=>(0,W.jsx)(Rw,{label:K(`buttons.resetZoom`),style:{height:`100%`},children:(0,W.jsxs)(X,{type:`button`,className:`reset-zoom-button zoom-button`,title:K(`buttons.resetZoom`),"aria-label":K(`buttons.resetZoom`),onClick:()=>{e(null)},children:[(t.zoom.value*100).toFixed(0),`%`]})}),keyTest:e=>(e.code===Gs.ZERO||e.code===Gs.NUM_ZERO)&&(e[N.CTRL_OR_CMD]||e.shiftKey)}),tT=(e,t,n=1)=>{let[r,i,a,o]=e,s=a-r,c=t.width/s,l=o-i,u=t.height/l,d=Math.min(c,u)*Ht(n,.1,1);return Math.min(d,1)},nT=({bounds:e,appState:t,canvasOffsets:n,fitToViewport:r=!1,viewportZoomFactor:i=1,minZoom:a=-1/0,maxZoom:o=1/0})=>{i=Ht(i,mn,30);let[s,c,l,u]=e,d=(s+l)/2,f=(c+u)/2,p=n?.left??0,m=n?.top??0,h=n?.right??0,g=n?.bottom??0,_=t.width-p-h,v=t.height-m-g,y;if(r){let e=l-s,t=u-c;y=Math.min(_/e,v/t)*i}else y=tT(e,{width:_,height:v},i);let b=_i(Ht(ie(y,qi,`floor`),a,o)),x=$e({scenePoint:{x:d,y:f},viewportDimensions:{width:t.width,height:t.height},offsets:n,zoom:{value:b}});return{appState:{...t,scrollX:x.scrollX,scrollY:x.scrollY,zoom:{value:b}},captureUpdate:V.EVENTUALLY}},rT=({canvasOffsets:e,targetElements:t,appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o})=>nT({canvasOffsets:e,bounds:Ii(Cs(t)),appState:n,fitToViewport:r,viewportZoomFactor:i,minZoom:a,maxZoom:o});Z({name:`zoomToFitSelectionInViewport`,label:`labels.zoomToFitViewport`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.TWO&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFitSelection`,label:`helpDialog.zoomToSelection`,icon:kS,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return rT({targetElements:i.length?i:e,appState:{...t,userToFollow:null},fitToViewport:!0,canvasOffsets:r.getEditorUIOffsets()})},keyTest:e=>e.code===Gs.THREE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]}),Z({name:`zoomToFit`,label:`helpDialog.zoomToFit`,icon:kS,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>rT({targetElements:e,appState:{...t,userToFollow:null},fitToViewport:!1,canvasOffsets:r.getEditorUIOffsets()}),keyTest:e=>e.code===Gs.ONE&&e.shiftKey&&!e.altKey&&!e[N.CTRL_OR_CMD]});var iT=Z({name:`toggleTheme`,label:(e,t)=>t.theme===R.DARK?`buttons.lightMode`:`buttons.darkMode`,keywords:[`toggle`,`dark`,`light`,`mode`,`theme`],icon:(e,t)=>e.theme===R.LIGHT?gb:_b,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t,n)=>({appState:{...t,theme:n||(t.theme===R.LIGHT?R.DARK:R.LIGHT)},captureUpdate:V.EVENTUALLY}),keyTest:e=>e.altKey&&e.shiftKey&&e.code===Gs.D,predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.toggleTheme});Z({name:`toggleEraserTool`,label:`toolBar.eraser`,trackEvent:{category:`toolbar`},perform:(e,t,n,r)=>{let i;return i=zr(t)?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:`eraser`,lastActiveToolBeforeEraser:t.activeTool}),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>e.key===N.E}),Z({name:`toggleLassoTool`,label:`toolBar.lasso`,icon:Qy,trackEvent:{category:`toolbar`},predicate:(e,t,n,r)=>r.state.preferredSelectionTool.type!==`lasso`,perform:(e,t,n,r)=>{let i;return t.activeTool.type===`lasso`?i=ka(t,{type:`selection`}):(i=ka(t,{type:`lasso`,fromSelection:!1}),Gw(r.interactiveCanvas,Kn.CROSSHAIR)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.NEVER}}});var aT=Z({name:`toggleHandTool`,label:`toolBar.hand`,trackEvent:{category:`toolbar`},icon:Zx,viewMode:!1,perform:(e,t,n,r)=>{let i;return Fs(t)?i=ka(t,{...t.activeTool.lastActiveTool||{type:`selection`},lastActiveToolBeforeEraser:null}):(i=ka(t,{type:`hand`,lastActiveToolBeforeEraser:t.activeTool}),Gw(r.interactiveCanvas,Kn.GRAB)),{appState:{...t,selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null,activeTool:i},captureUpdate:V.IMMEDIATELY}},keyTest:e=>!e.altKey&&!e[N.CTRL_OR_CMD]&&e.key===N.H});Z({name:`setEmbeddableAsActiveTool`,trackEvent:{category:`toolbar`},target:`Tool`,label:`toolBar.embeddable`,perform:(e,t,n,r)=>{let i=ka(t,{type:`embeddable`});return Yw(r.canvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:ka(t,{type:`embeddable`})},captureUpdate:V.EVENTUALLY}}});var oT=Z({name:`finalize`,label:``,trackEvent:!1,perform:(e,t,n,r)=>{let i=e,{interactiveCanvas:a,focusContainer:o,scene:s}=r,c=s.getNonDeletedElementsMap();if(n&&t.selectedLinearElement){let{event:a,sceneCoords:o}=n,l=I.getElement(t.selectedLinearElement.elementId,c);gt(l,`Arrow element should exist if selectedLinearElement is set`),gt(o,`sceneCoords should be defined if actionFinalize is called with event`);let u=I.handlePointerUp(a,t.selectedLinearElement,t,r.scene);if(ss(l)&&!t.selectedLinearElement.segmentMidPointHoveredCoords){let e=!!t.newElement;Ur(l,(e||!t.selectedLinearElement.selectedPointsIndices?[l.points.length-1]:t.selectedLinearElement.selectedPointsIndices).reduce((e,t)=>(e.set(t,{point:I.pointFromAbsoluteCoords(l,O(o.x-u.pointerOffset.x,o.y-u.pointerOffset.y),c)}),e),new Map)??new Map,o.x-u.pointerOffset.x,o.y-u.pointerOffset.y,s,t,{newArrow:e,altKey:a.altKey,angleLocked:mr(a)})}else ca(l)&&t.selectedLinearElement?.isEditing&&!t.newElement&&!zs(l.points)&&s.mutateElement(l,{polygon:!1});if(u!==t.selectedLinearElement){l&&na(l)&&(i=i.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e));let n=t.activeTool?.locked;return{elements:l.points.length<2||na(l)?e.map(e=>e.id===l.id?B(e,{isDeleted:!0}):e):i,appState:{...t,cursorButton:`up`,selectedLinearElement:n?null:{...u,selectedPointsIndices:null,isEditing:!1,initialState:{...u.initialState,lastClickedPoint:-1},pointerOffset:{x:0,y:0}},selectionElement:null,suggestedBinding:null,newElement:null,multiElement:null},captureUpdate:V.IMMEDIATELY}}}window.document.activeElement instanceof HTMLElement&&o();let l=null;if(t.multiElement)l=t.multiElement;else if(t.newElement?.type===`freedraw`||ss(t.newElement))l=t.newElement;else if(Object.keys(t.selectedElementIds).length===1){let e=c.get(Object.keys(t.selectedElementIds)[0]);e&&(l=e)}if(l){if(t.selectedLinearElement&&t.multiElement&&l.type!==`freedraw`&&t.lastPointerDownWith!==`touch`){let{points:e}=l,{lastCommittedPoint:n}=t.selectedLinearElement;(!n||e[e.length-1]!==n)&&s.mutateElement(l,{points:l.points.slice(0,-1)})}if(l&&na(l)&&(i=i.map(e=>e.id===l?.id?B(e,{isDeleted:!0}):e)),b(l)||Js(l)){if(ra(l.points,t.zoom.value)&&(ca(l)||Js(l))){let e=l.points,t=e[0],n=e.map((n,r)=>r===e.length-1?O(t[0],t[1]):n);ca(l)?s.mutateElement(l,{points:n,polygon:!0}):s.mutateElement(l,{points:n})}ca(l)&&!zs(l.points)&&s.mutateElement(l,{polygon:!1})}}(!t.activeTool.locked&&t.activeTool.type!==`freedraw`||!l)&&Ww(a);let u;u=t.activeTool.type===`eraser`?ka(t,{...t.activeTool.lastActiveTool||{type:r.state.preferredSelectionTool.type},lastActiveToolBeforeEraser:null}):ka(t,{type:r.state.preferredSelectionTool.type});let d=l&&b(l)?new I(l,lr(i)):t.selectedLinearElement;return d&&={...d,isEditing:t.newElement?!1:d.isEditing,initialState:{...d.initialState,lastClickedPoint:-1,origin:null}},{elements:i,appState:{...t,cursorButton:`up`,activeTool:(t.activeTool.locked||t.activeTool.type===`freedraw`)&&l?t.activeTool:u,activeEmbeddable:null,newElement:null,selectionElement:null,multiElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:l&&!t.activeTool.locked&&t.activeTool.type!==`freedraw`?{...t.selectedElementIds,[l.id]:!0}:t.selectedElementIds,selectedLinearElement:d},captureUpdate:V.IMMEDIATELY}},keyTest:(e,t)=>e.key===N.ESCAPE&&(t.selectedLinearElement?.isEditing||!t.newElement&&t.multiElement===null)||(e.key===N.ESCAPE||e.key===N.ENTER)&&t.multiElement!==null,PanelComponent:({appState:e,updateData:t,data:n})=>(0,W.jsx)(X,{type:`button`,icon:Fb,title:K(`buttons.done`),"aria-label":K(`buttons.done`),onClick:t,visible:e.multiElement!=null,size:n?.size||`medium`,style:{pointerEvents:`all`}})}),sT=({children:e,checked:t,onChange:n,className:r})=>(0,W.jsxs)(`div`,{className:U(`Checkbox`,r,{"is-checked":t}),onClick:e=>{n(!t,e),e.currentTarget.querySelector(`.Checkbox-box`).focus()},children:[(0,W.jsx)(`button`,{type:`button`,className:`Checkbox-box`,role:`checkbox`,"aria-checked":t,children:Eb}),(0,W.jsx)(`div`,{className:`Checkbox-label`,children:e})]}),cT=e=>{let t=e.title||(e.value===R.DARK?K(`buttons.lightMode`):K(`buttons.darkMode`));return(0,W.jsx)(X,{type:`icon`,icon:e.value===R.LIGHT?lT.MOON:lT.SUN,title:t,"aria-label":t,onClick:()=>e.onChange(e.value===R.DARK?R.LIGHT:R.DARK),"data-testid":`toggle-dark-mode`})},lT={SUN:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M256 160c-52.9 0-96 43.1-96 96s43.1 96 96 96 96-43.1 96-96-43.1-96-96-96zm246.4 80.5l-94.7-47.3 33.5-100.4c4.5-13.6-8.4-26.5-21.9-21.9l-100.4 33.5-47.4-94.8c-6.4-12.8-24.6-12.8-31 0l-47.3 94.7L92.7 70.8c-13.6-4.5-26.5 8.4-21.9 21.9l33.5 100.4-94.7 47.4c-12.8 6.4-12.8 24.6 0 31l94.7 47.3-33.5 100.5c-4.5 13.6 8.4 26.5 21.9 21.9l100.4-33.5 47.3 94.7c6.4 12.8 24.6 12.8 31 0l47.3-94.7 100.4 33.5c13.6 4.5 26.5-8.4 21.9-21.9l-33.5-100.4 94.7-47.3c13-6.5 13-24.7.2-31.1zm-155.9 106c-49.9 49.9-131.1 49.9-181 0-49.9-49.9-49.9-131.1 0-181 49.9-49.9 131.1-49.9 181 0 49.9 49.9 49.9 131.1 0 181z`})}),MOON:(0,W.jsx)(`svg`,{width:`512`,height:`512`,className:`rtl-mirror`,viewBox:`0 0 512 512`,children:(0,W.jsx)(`path`,{fill:`currentColor`,d:`M283.211 512c78.962 0 151.079-35.925 198.857-94.792 7.068-8.708-.639-21.43-11.562-19.35-124.203 23.654-238.262-71.576-238.262-196.954 0-72.222 38.662-138.635 101.498-174.394 9.686-5.512 7.25-20.197-3.756-22.23A258.156 258.156 0 0 0 283.211 0c-141.309 0-256 114.511-256 256 0 141.309 114.511 256 256 256z`})})},uT=e=>{let{id:t}=oz(),[n,r]=(0,H.useState)(e.value);return(0,W.jsxs)(`div`,{className:`ProjectName`,children:[(0,W.jsx)(`label`,{className:`ProjectName-label`,htmlFor:`filename`,children:`${e.label}:`}),(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,onBlur:t=>{e.ignoreFocus||Ra(t.target);let n=t.target.value;n!==e.value&&e.onChange(n)},onKeyDown:e=>{if(e.key===N.ENTER){if(e.preventDefault(),e.nativeEvent.isComposing||e.keyCode===229)return;e.currentTarget.blur()}},id:`${t}-filename`,value:n,onChange:e=>r(e.target.value)})]})},dT=5e3,fT=Object.assign(({message:e,onClose:t,closable:n=!1,duration:r=dT,style:i})=>{let a=(0,H.useRef)(0),o=r!==1/0,s=(0,H.useCallback)(()=>{o&&(a.current=window.setTimeout(()=>t(),r))},[t,r,o]);return(0,H.useEffect)(()=>{if(o)return s(),()=>clearTimeout(a.current)},[s,e,r,o]),(0,W.jsxs)(`div`,{className:`Toast`,role:`status`,onMouseEnter:o?()=>clearTimeout(a?.current):void 0,onMouseLeave:o?s:void 0,style:i,children:[(0,W.jsx)(`div`,{className:`Toast__message`,children:e}),n&&(0,W.jsx)(X,{icon:nx,"aria-label":`close`,type:`icon`,onClick:t,className:`close`})]})},{ProgressBar:({progress:e})=>(0,W.jsx)(`div`,{className:`Toast__progress-bar`,children:(0,W.jsx)(`div`,{className:`Toast__progress-bar-fill`,style:{width:`${Math.min(5,Math.round(e*100))}%`}})})});`clipboard`in navigator&&`readText`in navigator.clipboard;var pT=`clipboard`in navigator&&`writeText`in navigator.clipboard,mT=`clipboard`in navigator&&`write`in navigator.clipboard&&`ClipboardItem`in window&&`toBlob`in HTMLCanvasElement.prototype,hT=e=>!!([Na.excalidraw,Na.excalidrawClipboard,Na.excalidrawClipboardWithAPI].includes(e?.type)&&Array.isArray(e.elements)),gT=({types:e,files:t})=>{!e&&!t&&console.warn(`createPasteEvent: no types or files provided`);let n=new ClipboardEvent(F.PASTE,{clipboardData:new DataTransfer});if(e)for(let[r,i]of Object.entries(e)){if(typeof i!=`string`){t||=[],t.push(i);continue}try{if(n.clipboardData?.items.add(i,r),n.clipboardData?.getData(r)!==i)throw Error(`Failed to set "${r}" as clipboardData item`)}catch(e){throw Error(e.message)}}if(t){let e=-1;for(let r of t){e++;try{if(n.clipboardData?.items.add(r),n.clipboardData?.files[e]!==r)throw Error(`Failed to set file "${r.name}" as clipboardData item`)}catch(e){throw Error(e.message)}}}return n},_T=({elements:e,files:t})=>{let n=lr(e),r=new Set(e.filter(e=>L(e))),i=!1,a=e.reduce((e,n)=>(d(n)&&(i=!0,t&&t[n.fileId]&&(e[n.fileId]=t[n.fileId])),e),{});i&&!t&&console.warn("copyToClipboard: attempting to file element(s) without providing associated `files` object.");let o={type:Na.excalidrawClipboard,elements:e.map(e=>{if(No(e,n)&&!r.has(No(e,n))){let t=qn(e);return jn(t,n,{frameId:null}),t}return e}),files:t?a:void 0};return JSON.stringify(o)},vT=async(e,t,n)=>{let r=_T({elements:e,files:t});await AT({[hs.excalidrawClipboard]:r,[hs.text]:r},n)};function yT(e){let t=[];for(let n of e.childNodes)if(n.nodeType===3){let e=n.textContent?.trim();e&&t.push({type:`text`,value:e})}else if(n instanceof HTMLImageElement){let e=n.getAttribute(`src`);e&&e.startsWith(`http`)&&t.push({type:`imageUrl`,value:e})}else t=t.concat(yT(n));return t}var bT=e=>{let t=e.value;try{let e=yT(new DOMParser().parseFromString(t,hs.html).body);if(e.length)return{type:`mixedContent`,value:e}}catch(e){console.error(`error in parseHTMLFromPaste: ${e.message}`)}return null},xT=async()=>{let e={},t;try{t=await navigator.clipboard?.read()}catch(t){try{if(navigator.clipboard?.readText){console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);let e=await navigator.clipboard?.readText();if(e)return{[hs.text]:e}}}catch(t){if(navigator.clipboard?.read)console.warn(`navigator.clipboard.readText() failed (${t.message}). Failling back to navigator.clipboard.read()`);else{if(t.name===`DataError`)return console.warn(`navigator.clipboard.read() error, clipboard is probably empty: ${t.message}`),e;throw t}}throw t}for(let n of t)for(let t of n.types)if(Sn(Ri,t))try{if(t===hs.text||t===hs.html)e[t]=await(await n.getType(t)).text();else if(Ba(t))e[t]=pa(await n.getType(t),t,void 0);else throw new Ct(`Unsupported clipboard type: ${t}`)}catch(e){console.warn(e instanceof Ct?e.message:`Cannot retrieve ${t} from clipboardItem: ${e.message}`)}return Object.keys(e).length===0&&console.warn(`No clipboard data found from clipboard.read().`),e},ST=async(e,t=!1)=>{try{let n=e.findByType(hs.html),r=!t&&n&&bT(n);return r?r.value.every(e=>e.type===`text`)?{type:`text`,value:e.getData(hs.text)??r.value.map(e=>e.value).join(`
|
|
51
|
+
`).trim()}:r:{type:`text`,value:(e.getData(hs.text)||``).trim()}}catch{return{type:`text`,value:``}}},CT=function(e){return this.find(t=>t.type===e)||null},wT=function(e){return this.find(t=>t.type===e)?.value??null},TT=function(){return this.filter(e=>e.kind===`file`)},ET=e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=new Set;for(let e of Array.from(t||[]))n.has(e.type)||n.add(e.type);return n},DT=async e=>{let t;t=MT(e)?e.clipboardData?.items:e.dataTransfer?.items;let n=(await Promise.all(Array.from(t||[]).map(async t=>{if(t.kind===`file`){let e=t.getAsFile();if(e){let n=await ct(t);return e=await z(e),{type:e.type,kind:`file`,file:e,fileHandle:n}}}else if(t.kind===`string`){let{type:n}=t,r;return r=`clipboardData`in e&&e.clipboardData?e.clipboardData?.getData(n):await new Promise(e=>{t.getAsString(t=>e(t))}),{type:n,kind:`string`,value:r}}return null}))).filter(e=>e!=null);return Object.assign(n,{findByType:CT,getData:wT,getFiles:TT})},OT=async(e,t=!1)=>{let n=await ST(e,t);if(n.type===`mixedContent`)return{mixedContent:n.value};try{let e=JSON.parse(n.value),r=e.type===Na.excalidrawClipboardWithAPI;if(hT(e))return{elements:e.elements,files:e.files,text:t?JSON.stringify(e.elements,null,2):void 0,programmaticAPI:r}}catch{}return{text:n.value}},kT=async e=>{try{await navigator.clipboard.write([new ClipboardItem({[hs.png]:e})])}catch(t){if(ge(e))await navigator.clipboard.write([new ClipboardItem({[hs.png]:await e})]);else throw t}},AT=async(e,t)=>{e||=``;let n=Object.entries(typeof e==`string`?{[hs.text]:e}:e);try{if(t){for(let[e,r]of n)if(t.clipboardData?.setData(e,r),t.clipboardData?.getData(e)!==r)throw Error(`Failed to setData on clipboardEvent`);return}}catch(e){console.error(e)}let r=n.find(([e])=>e===hs.text);if(pT&&r)try{await navigator.clipboard.writeText(r[1]);return}catch(e){console.error(e)}if(r&&!jT(r[1]))throw Error(`Error copying to clipboard.`)},jT=e=>{e||=` `;let t=document.documentElement.getAttribute(`dir`)===`rtl`,n=document.createElement(`textarea`);n.style.border=`0`,n.style.padding=`0`,n.style.margin=`0`,n.style.position=`absolute`,n.style[t?`right`:`left`]=`-9999px`;let r=window.pageYOffset||document.documentElement.scrollTop;n.style.top=`${r}px`,n.style.fontSize=`12pt`,n.setAttribute(`readonly`,``),n.value=e,document.body.appendChild(n);let i=!1;try{n.select(),n.setSelectionRange(0,n.value.length),i=document.execCommand(`copy`)}catch(e){console.error(e)}return n.remove(),i},MT=e=>e.type===F.PASTE||e.type===F.COPY||e.type===F.CUT,NT=(e,{selectedElementIds:t},n)=>{e=Cs(e);let r=n&&Ya(e,{selectedElementIds:t}),i=null,a=r?ir(e,{selectedElementIds:t},{includeBoundTextElement:!0}):e;return r&&(a.length===1&&L(a[0])?(i=a[0],a=fo(e,i)):a.length>1&&(a=ir(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}))),{exportingFrame:i,exportedElements:js(a)}},PT=async(e,t,r,i,{exportBackground:a,exportPadding:o=10,viewBackgroundColor:s,name:c=r.name||`Untitled`,fileHandle:l=null,exportingFrame:u=null})=>{if(t.length===0)throw Error(K(`alerts.cannotExportEmptyCanvas`));if(e===`svg`||e===`clipboard-svg`){let n=be(t,{exportBackground:a,exportWithDarkMode:r.exportWithDarkMode,viewBackgroundColor:s,exportPadding:o,exportScale:r.exportScale,exportEmbedScene:r.exportEmbedScene&&e===`svg`},i,{exportingFrame:u});if(e===`svg`)return ti(n.then(e=>new Blob([Mo+e.outerHTML],{type:hs.svg})),{description:`Export to SVG`,name:c,extension:r.exportEmbedScene?`excalidraw.svg`:`svg`,mimeTypes:[Da.svg],fileHandle:l});if(e===`clipboard-svg`){let e=await n.then(e=>e.outerHTML);try{await AT(e)}catch{throw Error(K(`errors.copyToSystemClipboardFailed`))}return}}let d=j(t,r,i,{exportBackground:a,viewBackgroundColor:s,exportPadding:o,exportingFrame:u});if(e===`png`){let e=er(d);return r.exportEmbedScene&&(e=e.then(e=>n(async()=>{let{encodePngMetadata:e}=await import(`./image-32MOCVDX-viHDtJGM.js`);return{encodePngMetadata:e}},__vite__mapDeps([62,63,2,64,65,1]),import.meta.url).then(({encodePngMetadata:n})=>n({blob:e,metadata:Io(t,r,i,`local`)})))),ti(e,{description:`Export to PNG`,name:c,extension:r.exportEmbedScene?`excalidraw.png`:`png`,mimeTypes:[Da.png],fileHandle:l})}else if(e===`clipboard`)try{await kT(er(d))}catch(e){throw console.warn(e),e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(K(`canvasError.canvasTooBig`)):xt&&e.name===`TypeError`?Error(`${K(`alerts.couldNotCopyToClipboard`)}
|
|
52
|
+
|
|
53
|
+
${K(`hints.firefox_clipboard_write`)}`):Error(K(`alerts.couldNotCopyToClipboard`))}else throw Error(`Unsupported export type`)},FT=async(e,t,n)=>{let r=Mi(t);if(Math.random()<1)throw Error(`OLALALALA`);if(!Ie(r))throw Error(`fileHandle should exist and should be of type svg or png when resaving`);let{elements:i,appState:a,files:o}=await e,{exportBackground:s,viewBackgroundColor:c}=a;a={...a,exportEmbedScene:!0};let{exportedElements:l,exportingFrame:u}=NT(i,a,!1);return await PT(r,l,a,o,{exportBackground:s,viewBackgroundColor:c,name:n,fileHandle:t,exportingFrame:u}),{fileHandle:t}},IT=Z({name:`changeProjectName`,label:`labels.fileTitle`,trackEvent:!1,perform:(e,t,n)=>({appState:{...t,name:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t,appProps:n,data:r,app:i})=>(0,W.jsx)(uT,{label:K(`labels.fileTitle`),value:i.getName(),onChange:e=>t(e),ignoreFocus:r?.ignoreFocus??!1})}),LT=Z({name:`changeExportScale`,label:`imageExportDialog.scale`,trackEvent:{category:`export`,action:`scale`},perform:(e,t,n)=>({appState:{...t,exportScale:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=Cs(e),i=Ya(r,t)?ir(r,t):r;return(0,W.jsx)(W.Fragment,{children:Wi.map(e=>{let[r,a]=Ni(i,10,e),o=`${K(`imageExportDialog.label.scale`)} ${e}x (${r}x${a})`;return(0,W.jsx)(X,{size:`small`,type:`radio`,icon:`${e}x`,name:`export-canvas-scale`,title:o,"aria-label":o,id:`export-canvas-scale`,checked:e===t.exportScale,onChange:()=>n(e)},e)})})}}),RT=Z({name:`changeExportBackground`,label:`imageExportDialog.label.withBackground`,trackEvent:{category:`export`,action:`toggleBackground`},perform:(e,t,n)=>({appState:{...t,exportBackground:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsx)(sT,{checked:e.exportBackground,onChange:e=>t(e),children:K(`imageExportDialog.label.withBackground`)})}),zT=Z({name:`changeExportEmbedScene`,label:`imageExportDialog.tooltip.embedScene`,trackEvent:{category:`export`,action:`embedScene`},perform:(e,t,n)=>({appState:{...t,exportEmbedScene:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsxs)(sT,{checked:e.exportEmbedScene,onChange:e=>t(e),children:[K(`imageExportDialog.label.embedScene`),(0,W.jsx)(Rw,{label:K(`imageExportDialog.tooltip.embedScene`),long:!0,children:(0,W.jsx)(`div`,{className:`excalidraw-tooltip-icon`,children:Rb})})]})}),BT=!1,VT=(e,t)=>{let n=t.message??K(`progressDialog.defaultMessage`);e.setAppState({toast:{message:t.progress==null?n:(0,W.jsxs)(W.Fragment,{children:[n,(0,W.jsx)(fT.ProgressBar,{progress:t.progress})]}),duration:1/0}})};async function HT(e,t){if(t.app.state.isLoading&&(VT(t.app,{progress:null}),await t.app.onStateChange({predicate:e=>!e.isLoading})),typeof e==`object`&&e&&Symbol.asyncIterator in e){for await(let n of e){if(t.signal.aborted){e.return();return}if(n.type===`progress`)VT(t.app,{message:n.message,progress:n.progress??null});else if(n.type===`done`)return}return}e instanceof Promise&&(VT(t.app,{progress:null}),await e)}function UT(e,t,n,r){let i=new AbortController,a=i.signal;return{abortController:i,data:new Promise(async i=>{try{r.props.onExport&&await HT(r.props.onExport(`json`,{elements:e,appState:t,files:n},{signal:a}),{app:r,signal:a})}catch(e){e?.name===`AbortError`?console.warn(`onExport() aborted by host app (signal aborted: ${a.aborted})`):console.error(`Error during props.onExport() handling`,e)}i({elements:e,appState:t,files:r.files})})}}var WT=Z({name:`saveToActiveFile`,label:`buttons.save`,icon:yb,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.saveToActiveFile&&!!t.fileHandle&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{if(BT)return!1;BT=!0;let i=t.fileHandle,a=r.getName(),{abortController:o,data:s}=UT(e,t,r.files,r);try{let{fileHandle:e}=ja(i)?await FT(s,i,a):await wr({data:s,filename:a,fileHandle:i});return{captureUpdate:V.NEVER,appState:{fileHandle:e,toast:{message:i&&e?.name?K(`toast.fileSavedToFilename`).replace(`{filename}`,`"${e.name}"`):K(`toast.fileSaved`),duration:1500}}}}catch(e){return o.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:V.NEVER,appState:{toast:null}}}finally{BT=!1}},keyTest:e=>e.key===N.S&&e[N.CTRL_OR_CMD]&&!e.shiftKey}),GT=Z({name:`saveFileToDisk`,label:`exportDialog.disk_title`,icon:yb,viewMode:!0,trackEvent:{category:`export`},perform:async(e,t,n,r)=>{if(BT)return!1;BT=!0;let{abortController:i,data:a}=UT(e,t,r.files,r);try{let{fileHandle:e}=await wr({data:a,filename:r.getName(),fileHandle:null});return{captureUpdate:V.NEVER,appState:{openDialog:null,fileHandle:e,toast:{message:K(`toast.fileSaved`),duration:3e3}}}}catch(e){return i.abort(),e?.name===`AbortError`?console.warn(e):console.error(e),{captureUpdate:V.NEVER,appState:{toast:null}}}finally{BT=!1}},keyTest:e=>e.key.toLowerCase()===N.S&&e.shiftKey&&e[N.CTRL_OR_CMD],PanelComponent:({updateData:e})=>(0,W.jsx)(X,{type:`button`,icon:kb,title:K(`buttons.saveAs`),"aria-label":K(`buttons.saveAs`),showAriaLabel:iz().formFactor===`phone`,hidden:!no,onClick:()=>e(null),"data-testid":`save-as-button`})}),KT=Z({name:`loadScene`,label:`buttons.load`,trackEvent:{category:`export`},predicate:(e,t,n,r)=>!!r.props.UIOptions.canvasActions.loadScene&&!t.viewModeEnabled,perform:async(e,t,n,r)=>{try{let{elements:n,appState:r,files:i}=await _s(t,e);return{elements:n,appState:r,files:i,captureUpdate:V.IMMEDIATELY}}catch(n){return n?.name===`AbortError`?(console.warn(n),!1):{elements:e,appState:{...t,errorMessage:n.message},files:r.files,captureUpdate:V.EVENTUALLY}}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.O}),qT=Z({name:`exportWithDarkMode`,label:`imageExportDialog.label.darkMode`,trackEvent:{category:`export`,action:`toggleTheme`},perform:(e,t,n,r)=>(r.sessionExportThemeOverride=n?R.DARK:R.LIGHT,{appState:{...t,exportWithDarkMode:n},captureUpdate:V.EVENTUALLY}),PanelComponent:({appState:e,updateData:t})=>(0,W.jsx)(`div`,{style:{display:`flex`,justifyContent:`flex-end`,marginTop:`-45px`,marginBottom:`10px`},children:(0,W.jsx)(cT,{value:e.exportWithDarkMode?R.DARK:R.LIGHT,onChange:e=>{t(e===R.DARK)},title:K(`imageExportDialog.label.darkMode`)})})}),JT=`{}`,YT=Z({name:`copyStyles`,label:`labels.copyStyles`,icon:OS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=[],a=e.find(e=>t.selectedElementIds[e.id]);if(i.push(a),a&&xr(a)){let e=ut(a,r.scene.getNonDeletedElementsMap());i.push(e)}return a&&(JT=JSON.stringify(i)),{appState:{...t,toast:{message:K(`toast.copyStyles`)}},captureUpdate:V.EVENTUALLY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.C}),XT=Z({name:`pasteStyles`,label:`labels.pasteStyles`,icon:OS,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=JSON.parse(JT),a=i[0],o=i[1];if(!Ee(a))return{elements:e,captureUpdate:V.EVENTUALLY};let s=ir(e,t,{includeBoundTextElement:!0}),c=s.map(e=>e.id);return{elements:e.map(e=>{if(c.includes(e.id)){let t=a;if(M(e)&&e.containerId&&(t=o),!t)return e;let n=B(e,{backgroundColor:t?.backgroundColor,strokeWidth:t?.strokeWidth,strokeColor:t?.strokeColor,strokeStyle:t?.strokeStyle,fillStyle:t?.fillStyle,opacity:t?.opacity,roughness:t?.roughness,roundness:t.roundness?Xr(t.roundness.type,e)?t.roundness:Rn(e):null});if(M(n)){let e=t.fontSize||20,i=t.fontFamily||$r;n=B(n,{fontSize:e,fontFamily:i,textAlign:t.textAlign||`left`,lineHeight:t.lineHeight||ba(i)});let a=null;n.containerId&&(a=s.find(e=>M(n)&&e.id===n.containerId)||null),Zi(n,a,r.scene)}return n.type===`arrow`&&jt(t)&&(n=B(n,{startArrowhead:t.startArrowhead,endArrowhead:t.endArrowhead})),L(e)&&(n=B(n,{roundness:null,backgroundColor:`transparent`})),n}return e}),captureUpdate:V.IMMEDIATELY}},keyTest:e=>e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.V}),ZT=Z({name:`toggleShortcuts`,label:`welcomeScreen.defaults.helpHint`,icon:xb,viewMode:!0,trackEvent:{category:`menu`,action:`toggleHelpDialog`},perform:(e,t,n,{focusContainer:r})=>(t.openDialog?.name===`help`&&r(),{appState:{...t,openDialog:t.openDialog?.name===`help`?null:{name:`help`},openMenu:null,openPopup:null},captureUpdate:V.EVENTUALLY}),keyTest:e=>e.key===N.QUESTION_MARK}),QT=e=>{if(e.length>=2){let t=e[0].groupIds;for(let n of t)if(e.reduce((e,t)=>e&&Lo(t,n),!0))return!0}return!1},$T=(e,t,n)=>{let r=n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});return r.length>=2&&!QT(r)&&!Dr(r)},eE=Z({name:`group`,label:`labels.group`,icon:e=>(0,W.jsx)(rx,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=re(r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}));if(i.length<2)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY};let a=po(t);if(a.length===1){let n=a[0],r=new Set(Ki(e,n).map(e=>e.id)),o=new Set(i.map(e=>e.id));if(new Set([...Array.from(r),...Array.from(o)]).size===r.size)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY}}let o=[...e];new Set(i.map(e=>e.frameId)).size>1&&pi(i).forEach((e,t)=>{Pi(e,r.scene.getNonDeletedElementsMap())});let s=Bi(),c=lr(i);o=o.map(e=>c.get(e.id)?B(e,{groupIds:wn(e.groupIds,s,t.editingGroupId)}):e);let l=Ki(o,s),u=l[l.length-1],d=o.lastIndexOf(u),f=o.slice(d+1),p=fe([...o.slice(0,d).filter(e=>!Lo(e,s)),...l,...f],lr(l));return{appState:{...t,...Aa(s,{...t,selectedGroupIds:{}},Cs(o))},elements:p,captureUpdate:V.IMMEDIATELY}},predicate:(e,t,n,r)=>$T(e,t,r),keyTest:e=>!e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!$T(e,t,r),type:`button`,icon:(0,W.jsx)(rx,{theme:t.theme}),onClick:()=>n(null),title:`${K(`labels.group`)} \u2014 ${Q(`CtrlOrCmd+G`)}`,"aria-label":K(`labels.group`),visible:Ya(Cs(e),t)})}),tE=Z({name:`ungroup`,label:`labels.ungroup`,icon:e=>(0,W.jsx)(ix,{theme:e.theme}),trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=po(t),a=lr(e);if(i.length===0)return{appState:t,elements:e,captureUpdate:V.EVENTUALLY};let o=[...e],s=[];o=o.map(e=>{ya(e)&&s.push(e.id);let n=Ji(e.groupIds,t.selectedGroupIds);return n.length===e.groupIds.length?e:B(e,{groupIds:n})});let c=Hr(t,Cs(o),t,null),l=r.scene.getSelectedElements(t),u=new Set(l.filter(e=>e.frameId).map(e=>e.frameId));return wi(e).filter(e=>u.has(e.id)).forEach(e=>{e&&(o=Ai(o,kn(o,e,t,a),e,r))}),c.selectedElementIds=Object.entries(c.selectedElementIds).reduce((e,[t,n])=>(n&&!s.includes(t)&&(e[t]=!0),e),{}),{appState:{...t,...c},elements:o,captureUpdate:V.IMMEDIATELY}},keyTest:e=>e.shiftKey&&e[N.CTRL_OR_CMD]&&e.key===N.G.toUpperCase(),predicate:(e,t)=>po(t).length>0,PanelComponent:({elements:e,appState:t,updateData:n})=>(0,W.jsx)(X,{type:`button`,hidden:po(t).length===0,icon:(0,W.jsx)(ix,{theme:t.theme}),onClick:()=>n(null),title:`${K(`labels.ungroup`)} \u2014 ${Q(`CtrlOrCmd+Shift+G`)}`,"aria-label":K(`labels.ungroup`),visible:Ya(Cs(e),t)})}),nE=(e,t,n,r,i,a,o)=>{e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath(),e.fill(),o&&(e.strokeStyle=o),e.stroke()};function rE(e){let t=0;if(e.length===0)return t;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t=(t<<5)-t+r}return t}var iE=(e,t)=>`hsl(${Math.abs(rE(t?.id||e))%37*10}, 100%, 83%)`,aE=e=>{let t=e?.trim()?.codePointAt(0);return(t?String.fromCodePoint(t):`?`).toUpperCase()},oE=({context:e,renderConfig:t,appState:n,normalizedWidth:r,normalizedHeight:i})=>{for(let[a,o]of t.remotePointerViewportCoords){let{x:s,y:c}=o,l=n.collaborators.get(a);s-=n.offsetLeft,c-=n.offsetTop;let u=s<0||s>r-11||c<0||c>i-14;s=Math.max(s,0),s=Math.min(s,r-11),c=Math.max(c,0),c=Math.min(c,i-14);let d=iE(a,l);e.save(),e.strokeStyle=d,e.fillStyle=d;let f=t.remotePointerUserStates.get(a),p=u||f===Ye.IDLE||f===Ye.AWAY;p&&(e.globalAlpha=.3),t.remotePointerButton.get(a)===`down`&&(e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=3,e.strokeStyle=`#ffffff88`,e.stroke(),e.closePath(),e.beginPath(),e.arc(s,c,15,0,2*Math.PI,!1),e.lineWidth=1,e.strokeStyle=d,e.stroke(),e.closePath());let m=n.theme===R.DARK?`#2f6330`:ao,h=l?.isSpeaking;h&&(e.fillStyle=m,e.strokeStyle=m,e.lineWidth=10,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill()),e.fillStyle=yi,e.strokeStyle=yi,e.lineWidth=6,e.lineJoin=`round`,e.beginPath(),e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.stroke(),e.fill(),e.fillStyle=d,e.strokeStyle=d,e.lineWidth=2,e.lineJoin=`round`,e.beginPath(),p?(e.moveTo(s-1,c-1),e.lineTo(s-1,c+15),e.lineTo(s+5,c+10),e.lineTo(s+12,c+9),e.closePath(),e.fill()):(e.moveTo(s,c),e.lineTo(s+0,c+14),e.lineTo(s+4,c+9),e.lineTo(s+11,c+8),e.closePath(),e.fill(),e.stroke());let g=t.remotePointerUsernames.get(a)||``;if(!u&&g){e.font=`600 12px sans-serif`;let t=(h?s+0:s)+11/2,n=(h?c+0:c)+14+2,r=e.measureText(g),i=r.actualBoundingBoxDescent+r.actualBoundingBoxAscent,a=Math.max(i,12),o=t-1,l=n-1,u=r.width+2+10+2,f=a+2+6+2;e.roundRect?(e.beginPath(),e.roundRect(o,l,u,f,8),e.fillStyle=d,e.fill(),e.strokeStyle=`#ffffff`,e.stroke(),h&&(e.beginPath(),e.roundRect(o-2,l-2,u+4,f+4,8),e.strokeStyle=m,e.stroke())):nE(e,o,l,u,f,8,`#ffffff`),e.fillStyle=`#1e1e1e`,e.fillText(g,t+5+1,n+3+r.actualBoundingBoxAscent+Math.floor((a-i)/2)+2),h&&(e.fillStyle=m,e.fillRect(o+u+8,l+(f/2-8/2),2,8),e.fillRect(o+u+8+5,l+(f/2-16/2),2,16),e.fillRect(o+u+8+10,l+(f/2-8/2),2,8))}e.restore(),e.closePath()}},sE=({color:e,onClick:t,name:n,src:r,className:i})=>{let a=aE(n),[o,s]=(0,H.useState)(!1),c=!o&&r,l=c?void 0:{background:e};return(0,W.jsx)(`div`,{className:U(`Avatar`,i),style:l,onClick:t,children:c?(0,W.jsx)(`img`,{className:`Avatar-img`,src:r,alt:a,referrerPolicy:`no-referrer`,onError:()=>s(!0)}):a})};Z({name:`goToCollaborator`,label:`Go to a collaborator`,viewMode:!0,trackEvent:{category:`collab`},perform:(e,t,n)=>(gt(n,`actionGoToCollaborator: collaborator should be defined when actionGoToCollaborator is called`),!n.socketId||t.userToFollow?.socketId===n.socketId||n.isCurrentUser?{appState:{...t,userToFollow:null},captureUpdate:V.EVENTUALLY}:{appState:{...t,userToFollow:{socketId:n.socketId,username:n.username||``},openMenu:t.openMenu===`canvas`?null:t.openMenu},captureUpdate:V.EVENTUALLY}),PanelComponent:({updateData:e,data:t,appState:n})=>{let{socketId:r,collaborator:i,withName:a,isBeingFollowed:o}=t,s=iE(r,i),c=U({"is-followed":o,"is-current-user":i.isCurrentUser===!0,"is-speaking":i.isSpeaking,"is-in-call":i.isInCall,"is-muted":i.isMuted}),l=i.isInCall?i.isSpeaking?(0,W.jsxs)(`div`,{className:`UserList__collaborator-status-icon-speaking-indicator`,title:K(`userList.hint.isSpeaking`),children:[(0,W.jsx)(`div`,{}),(0,W.jsx)(`div`,{}),(0,W.jsx)(`div`,{})]}):i.isMuted?(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon-microphone-muted`,title:K(`userList.hint.micMuted`),children:SS}):(0,W.jsx)(`div`,{title:K(`userList.hint.inCall`),children:xS}):null;return a?(0,W.jsxs)(`div`,{className:`dropdown-menu-item dropdown-menu-item-base UserList__collaborator ${c}`,style:{"--avatar-size":`1.5rem`},onClick:()=>e(i),children:[(0,W.jsx)(sE,{color:s,onClick:()=>{},name:i.username||``,src:i.avatarUrl,className:c}),(0,W.jsx)(`div`,{className:`UserList__collaborator-name`,children:i.username}),(0,W.jsxs)(`div`,{className:`UserList__collaborator-status-icons`,"aria-hidden":!0,children:[o&&(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon-is-followed`,title:K(`userList.hint.followStatus`),children:mS}),l]})]}):(0,W.jsxs)(`div`,{className:`UserList__collaborator UserList__collaborator--avatar-only ${c}`,children:[(0,W.jsx)(sE,{color:s,onClick:()=>{e(i)},name:i.username||``,src:i.avatarUrl,className:c}),l&&(0,W.jsx)(`div`,{className:`UserList__collaborator-status-icon`,children:l})]})}});var cE=Z({name:`addToLibrary`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});for(let e of Le)if(i.some(t=>t.type===e))return{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.libraryElementTypeError.${e}`)}};return r.library.getLatestLibrary().then(e=>r.library.setLibrary([{id:Bi(),status:`unpublished`,elements:i.map(qn),created:Date.now()},...e])).then(()=>({captureUpdate:V.EVENTUALLY,appState:{...t,toast:{message:K(`toast.addedToLibrary`)}}})).catch(e=>({captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:e.message}}))},label:`labels.addToLibrary`}),lE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Xt(n,t.scene.getNonDeletedElementsMap(),e).length>1&&!n.some(e=>L(e))},uE=(e,t,n,r)=>{let i=lr(Xe(n.scene.getSelectedElements(t),r,n.scene,t));return lo(e.map(e=>i.get(e.id)||e),t,n)};Z({name:`alignTop`,label:`labels.alignTop`,icon:Kb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`start`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_UP,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Kb,onClick:()=>n(null),title:`${K(`labels.alignTop`)} \u2014 ${Q(`CtrlOrCmd+Shift+Up`)}`,"aria-label":K(`labels.alignTop`),visible:Ya(Cs(e),t)})}),Z({name:`alignBottom`,label:`labels.alignBottom`,icon:qb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`end`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_DOWN,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:qb,onClick:()=>n(null),title:`${K(`labels.alignBottom`)} \u2014 ${Q(`CtrlOrCmd+Shift+Down`)}`,"aria-label":K(`labels.alignBottom`),visible:Ya(Cs(e),t)})}),Z({name:`alignLeft`,label:`labels.alignLeft`,icon:Jb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`start`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_LEFT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Jb,onClick:()=>n(null),title:`${K(`labels.alignLeft`)} \u2014 ${Q(`CtrlOrCmd+Shift+Left`)}`,"aria-label":K(`labels.alignLeft`),visible:Ya(Cs(e),t)})}),Z({name:`alignRight`,label:`labels.alignRight`,icon:Yb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`end`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key===N.ARROW_RIGHT,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Yb,onClick:()=>n(null),title:`${K(`labels.alignRight`)} \u2014 ${Q(`CtrlOrCmd+Shift+Right`)}`,"aria-label":K(`labels.alignRight`),visible:Ya(Cs(e),t)})}),Z({name:`alignVerticallyCentered`,label:`labels.centerVertically`,icon:Qb,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`center`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:Qb,onClick:()=>n(null),title:K(`labels.centerVertically`),"aria-label":K(`labels.centerVertically`),visible:Ya(Cs(e),t)})}),Z({name:`alignHorizontallyCentered`,label:`labels.centerHorizontally`,icon:$b,trackEvent:{category:`element`},predicate:(e,t,n,r)=>lE(t,r),perform:(e,t,n,r)=>({appState:t,elements:uE(e,t,r,{position:`center`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!lE(t,r),type:`button`,icon:$b,onClick:()=>n(null),title:K(`labels.centerHorizontally`),"aria-label":K(`labels.centerHorizontally`),visible:Ya(Cs(e),t)})});var dE=(e,t)=>{let n=t.scene.getSelectedElements(e);return Xt(n,t.scene.getNonDeletedElementsMap(),e).length>2&&!n.some(e=>L(e))},fE=(e,t,n,r)=>{let i=lr(ce(n.scene.getSelectedElements(t),n.scene.getNonDeletedElementsMap(),r,t,n.scene));return lo(e.map(e=>i.get(e.id)||e),t,n)};Z({name:`distributeHorizontally`,label:`labels.distributeHorizontally`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:fE(e,t,r,{space:`between`,axis:`x`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.H,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!dE(t,r),type:`button`,icon:Xb,onClick:()=>n(null),title:`${K(`labels.distributeHorizontally`)} \u2014 ${Q(`Alt+H`)}`,"aria-label":K(`labels.distributeHorizontally`),visible:Ya(Cs(e),t)})}),Z({name:`distributeVertically`,label:`labels.distributeVertically`,trackEvent:{category:`element`},perform:(e,t,n,r)=>({appState:t,elements:fE(e,t,r,{space:`between`,axis:`y`}),captureUpdate:V.IMMEDIATELY}),keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.V,PanelComponent:({elements:e,appState:t,updateData:n,app:r})=>(0,W.jsx)(X,{hidden:!dE(t,r),type:`button`,icon:Zb,onClick:()=>n(null),title:`${K(`labels.distributeVertically`)} \u2014 ${Q(`Alt+V`)}`,"aria-label":K(`labels.distributeVertically`),visible:Ya(Cs(e),t)})});var pE=Z({name:`flipHorizontal`,label:`labels.flipHorizontal`,icon:DS,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:lo(hE(e,r.scene.getNonDeletedElementsMap(),t,`horizontal`,r),t,r),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gs.H}),mE=Z({name:`flipVertical`,label:`labels.flipVertical`,icon:ES,trackEvent:{category:`element`},perform:(e,t,n,r)=>({elements:lo(hE(e,r.scene.getNonDeletedElementsMap(),t,`vertical`,r),t,r),appState:t,captureUpdate:V.IMMEDIATELY}),keyTest:e=>e.shiftKey&&e.code===Gs.V&&!e[N.CTRL_OR_CMD]}),hE=(e,t,n,r,i)=>{let a=lr(gE(ir(Cs(e),n,{includeBoundTextElement:!0,includeElementsInFrames:!0}),t,r,i));return e.map(e=>a.get(e.id)||e)},gE=(e,t,n,r)=>{if(e.every(e=>jt(e)&&(e.startBinding||e.endBinding)))return e.map(e=>{let t=e;return B(t,{startArrowhead:t.endArrowhead,endArrowhead:t.startArrowhead})});let{midX:i,midY:a}=Pa(e);ds(e,t,`nw`,r.scene,new Map(Array.from(t.values()).map(e=>[e.id,qn(e)])),{flipByX:n===`horizontal`,flipByY:n===`vertical`,shouldResizeFromCenter:!0,shouldMaintainAspectRatio:!0}),Bo(e.filter(jt),r.scene,r.state);let{elbowArrows:o,otherElements:s}=e.reduce((e,t)=>dr(t)?{...e,elbowArrows:e.elbowArrows.concat(t)}:{...e,otherElements:e.otherElements.concat(t)},{elbowArrows:[],otherElements:[]}),{midX:c,midY:l}=Pa(e),[u,d]=[i-c,a-l];return s.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),o.forEach(e=>r.scene.mutateElement(e,{x:e.x+u,y:e.y+d})),e},_E=Z({name:`copy`,label:`labels.copy`,icon:hb,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});try{await vT(i,r.files,n)}catch(e){return{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:e.message}}}return{captureUpdate:V.EVENTUALLY}},keyTest:void 0}),vE=Z({name:`paste`,label:`labels.paste`,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i;try{i=await xT()}catch(e){return e.name===`AbortError`||e.name===`NotAllowedError`?!1:(console.error(`actionPaste ${e.name}: ${e.message}`),xt?{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`hints.firefox_clipboard_write`)}}:{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.asyncPasteFailedOnRead`)}})}try{r.pasteFromClipboard(gT({types:i}))}catch(e){return console.error(e),{captureUpdate:V.EVENTUALLY,appState:{...t,errorMessage:K(`errors.asyncPasteFailedOnParse`)}}}return{captureUpdate:V.EVENTUALLY}},keyTest:void 0}),yE=Z({name:`cut`,label:`labels.cut`,icon:eS,trackEvent:{category:`element`},perform:(e,t,n,r)=>(_E.perform(e,t,n,r),rC.perform(e,t,null,r)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.X}),bE=Z({name:`copyAsSvg`,label:`labels.copyAsSvg`,icon:AS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:V.EVENTUALLY};let{exportedElements:i,exportingFrame:a}=NT(e,t,!0);try{return await PT(`clipboard-svg`,i,t,r.files,{...t,exportingFrame:a,name:r.getName()}),{appState:{toast:{message:K(`toast.copyToClipboardAsSvg`,{exportSelection:r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}).length?K(`toast.selection`):K(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?K(`buttons.darkMode`):K(`buttons.lightMode`)})}},captureUpdate:V.EVENTUALLY}}catch(e){return console.error(e),{appState:{errorMessage:e.message},captureUpdate:V.EVENTUALLY}}},predicate:e=>pT&&e.length>0,keywords:[`svg`,`clipboard`,`copy`]}),xE=Z({name:`copyAsPng`,label:`labels.copyAsPng`,icon:jS,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{if(!r.canvas)return{captureUpdate:V.EVENTUALLY};let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),{exportedElements:a,exportingFrame:o}=NT(e,t,!0);try{return await PT(`clipboard`,a,t,r.files,{...t,exportingFrame:o,name:r.getName()}),{appState:{...t,toast:{message:K(`toast.copyToClipboardAsPng`,{exportSelection:i.length?K(`toast.selection`):K(`toast.canvas`),exportColorScheme:t.exportWithDarkMode?K(`buttons.darkMode`):K(`buttons.lightMode`)})}},captureUpdate:V.EVENTUALLY}}catch(e){return console.error(e),{appState:{...t,errorMessage:e.message},captureUpdate:V.EVENTUALLY}}},predicate:e=>mT&&e.length>0,keyTest:e=>e.code===Gs.C&&e.altKey&&e.shiftKey,keywords:[`png`,`clipboard`,`copy`]}),SE=Z({name:`copyText`,label:`labels.copyText`,trackEvent:{category:`element`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0});try{AT(As(i))}catch{throw Error(K(`errors.copyToSystemClipboardFailed`))}return{captureUpdate:V.EVENTUALLY}},predicate:(e,t,n,r)=>pT&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0}).some(M),keywords:[`text`,`clipboard`,`copy`]}),CE=Z({name:`gridMode`,icon:IS,keywords:[`snap`],label:`labels.toggleGrid`,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>e.gridModeEnabled},perform(e,t){return{appState:{...t,gridModeEnabled:!this.checked(t),objectsSnapModeEnabled:!1},captureUpdate:V.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[N.CTRL_OR_CMD]&&e.code===Gs.QUOTE}),wE=Z({name:`zenMode`,label:`buttons.zenMode`,icon:NS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.zenModeEnabled},perform(e,t){return{appState:{...t,zenModeEnabled:!this.checked(t)},captureUpdate:V.EVENTUALLY}},checked:e=>e.zenModeEnabled,predicate:(e,t,n,r)=>r.editorInterface.formFactor!==`phone`&&typeof n.zenModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.Z}),TE=Z({name:`objectsSnapMode`,label:`buttons.objectsSnapMode`,icon:MS,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.objectsSnapModeEnabled},perform(e,t){return{appState:{...t,objectsSnapModeEnabled:!this.checked(t),gridModeEnabled:!1},captureUpdate:V.EVENTUALLY}},checked:e=>e.objectsSnapModeEnabled,predicate:(e,t,n)=>typeof n.objectsSnapModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.S}),EE=Z({name:`arrowBinding`,label:`labels.arrowBinding`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>e.bindingPreference===`disabled`},perform(e,t){let n=t.bindingPreference===`enabled`?`disabled`:`enabled`;return{appState:{...t,bindingPreference:n,isBindingEnabled:n===`enabled`},captureUpdate:V.NEVER}},checked:e=>e.bindingPreference===`enabled`}),DE=Z({name:`midpointSnapping`,label:`labels.midpointSnapping`,viewMode:!1,trackEvent:{category:`canvas`,predicate:e=>!e.isMidpointSnappingEnabled},perform(e,t){return{appState:{...t,isMidpointSnappingEnabled:!this.checked(t)},captureUpdate:V.NEVER}},checked:e=>e.isMidpointSnappingEnabled}),OE=Z({name:`stats`,label:`stats.fullTitle`,icon:TS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`edit`,`attributes`,`customize`],perform(e,t){return{appState:{...t,stats:{...t.stats,open:!this.checked(t)}},captureUpdate:V.EVENTUALLY}},checked:e=>e.stats.open,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.SLASH}),kE=Z({name:`unbindText`,label:`labels.unbindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>r.scene.getSelectedElements(t).some(e=>xr(e)),perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=r.scene.getNonDeletedElementsMap();return i.forEach(e=>{let t=ut(e,a);if(t){let{width:n,height:i}=gn(t.originalText,u(t),t.lineHeight),o=f(e.id);$t(e.id);let{x:s,y:c}=ui(e,t,a);r.scene.mutateElement(t,{containerId:null,width:n,height:i,text:t.originalText,x:s,y:c}),r.scene.mutateElement(e,{boundElements:e.boundElements?.filter(e=>e.id!==t.id),height:o||e.height})}}),{elements:e,appState:t,captureUpdate:V.IMMEDIATELY}}}),AE=Z({name:`bindText`,label:`labels.bindText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);if(i.length===2){let e=M(i[0])||M(i[1]),t;if(k(i[0])?t=i[0]:k(i[1])&&(t=i[1]),e&&t&&ut(t,r.scene.getNonDeletedElementsMap())===null)return!0}return!1},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a,o;M(i[0])&&k(i[1])?(a=i[0],o=i[1]):(a=i[1],o=i[0]),r.scene.mutateElement(a,{containerId:o.id,verticalAlign:Lr.MIDDLE,textAlign:Zo.CENTER,autoResize:!0,angle:jt(o)?0:o?.angle??0}),r.scene.mutateElement(o,{boundElements:(o.boundElements||[]).concat({type:`text`,id:a.id})});let s=o.height;return Zi(a,o,r.scene),Cr(o.id,s),{elements:jE(e,o,a),appState:{...t,selectedElementIds:{[o.id]:!0}},captureUpdate:V.IMMEDIATELY}}}),jE=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===n.id);r.splice(i,1);let a=r.findIndex(e=>e.id===t.id);return r.splice(a+1,0,n),fe(r,lr([t,n])),r},ME=(e,t,n)=>{let r=e.slice(),i=r.findIndex(e=>e.id===t.id);r.splice(i,1);let a=r.findIndex(e=>e.id===n.id);return r.splice(a,0,t),fe(r,lr([t,n])),r},NE=Z({name:`wrapTextInContainer`,label:`labels.createContainerFromText`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=i.some(e=>M(e)&&!ya(e));return i.length>0&&a},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t),a=e.slice(),o={};for(let e of i)if(M(e)&&!ya(e)){let n=cn({type:`rectangle`,backgroundColor:t.currentItemBackgroundColor,boundElements:[...e.boundElements||[],{id:e.id,type:`text`}],angle:e.angle,fillStyle:t.currentItemFillStyle,strokeColor:t.currentItemStrokeColor,roughness:t.currentItemRoughness,strokeWidth:t.currentItemStrokeWidth,strokeStyle:t.currentItemStrokeStyle,roundness:t.currentItemRoundness===`round`?{type:Ga(`rectangle`)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null,opacity:100,locked:!1,x:e.x-5,y:e.y-5,width:je(e.width,`rectangle`),height:je(e.height,`rectangle`),groupIds:e.groupIds,frameId:e.frameId});if(e.boundElements?.length){let t=e.boundElements.filter(e=>e.type===`arrow`).map(e=>e.id);a.filter(e=>t.includes(e.id)).forEach(t=>{let i=t.startBinding,a=t.endBinding;i?.elementId===e.id&&(i={...i,elementId:n.id}),a?.elementId===e.id&&(a={...a,elementId:n.id}),(i||a)&&r.scene.mutateElement(t,{startBinding:i,endBinding:a})})}r.scene.mutateElement(e,{containerId:n.id,verticalAlign:Lr.MIDDLE,boundElements:null,textAlign:Zo.CENTER,autoResize:!0}),Zi(e,n,r.scene),a=ME([...a,n],n,e),o[n.id]=!0}return{elements:a,appState:{...t,selectedElementIds:o},captureUpdate:V.IMMEDIATELY}}}),PE=380,FE=42,IE=5,LE=85,RE=500,zE=!1,BE=new Map,VE=({element:e,scene:t,setAppState:n,onLinkOpen:r,setToast:i,updateEmbedValidationStatus:a})=>{let o=t.getNonDeletedElementsMap(),s=cz(),c=rz(),l=iz(),u=e.link||``,[d,f]=(0,H.useState)(u),m=(0,H.useRef)(null),h=s.showHyperlinkPopup===`editor`,g=(0,H.useCallback)(()=>{if(!m.current)return;let r=Hs(m.current.value)||null;if(!e.link&&r&&dC(`hyperlink`,`create`),rs(e)){if(s.activeEmbeddable?.element===e&&n({activeEmbeddable:null}),!r){t.mutateElement(e,{link:null}),a(e,!1);return}if(!Lt(r,c.validateEmbeddable))r&&i({message:K(`toast.unableToEmbed`),closable:!0}),e.link&&BE.set(e.id,e.link),t.mutateElement(e,{link:r}),a(e,!1);else{let{width:n,height:o}=e,s=qs(r);s?.error instanceof URIError&&i({message:K(`toast.unrecognizedLinkFormat`),closable:!0});let c=s?s.intrinsicSize.w/s.intrinsicSize.h:1,l=BE.get(e.id)!==e.link;t.mutateElement(e,{...l?{width:s?.type===`video`?n>o?n:o*c:n,height:s?.type===`video`&&n>o?n/c:o}:{},link:r}),a(e,!0),BE.has(e.id)&&BE.delete(e.id)}}else t.mutateElement(e,{link:r})},[e,t,i,c.validateEmbeddable,s.activeEmbeddable,n,a]);(0,H.useLayoutEffect)(()=>()=>{g()},[g]),(0,H.useEffect)(()=>{h&&m?.current&&!(l.formFactor===`phone`||l.isTouchScreen)&&m.current.select()},[h,l.formFactor,l.isTouchScreen]),(0,H.useEffect)(()=>{let t=null,r=r=>{h||(t&&clearTimeout(t),JE(e,o,s,O(r.clientX,r.clientY))&&(t=window.setTimeout(()=>{n({showHyperlinkPopup:!1})},RE)))};return window.addEventListener(F.POINTER_MOVE,r,!1),()=>{window.removeEventListener(F.POINTER_MOVE,r,!1),t&&clearTimeout(t)}},[s,e,h,n,o]);let _=(0,H.useCallback)(()=>{dC(`hyperlink`,`delete`),t.mutateElement(e,{link:null}),n({showHyperlinkPopup:!1})},[n,e,t]),v=()=>{dC(`hyperlink`,`edit`,`popup-ui`),n({showHyperlinkPopup:`editor`})},{x:y,y:b}=HE(e,s,o);return s.contextMenu||s.selectedElementsAreBeingDragged||s.resizingElement||s.isRotating||s.openMenu||s.viewModeEnabled?null:(0,W.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer`,style:{top:`${b}px`,left:`${y}px`,width:PE,padding:IE},children:[h?(0,W.jsx)(`input`,{className:U(`excalidraw-hyperlinkContainer-input`),placeholder:K(`labels.link.hint`),ref:m,value:d,onChange:e=>f(e.target.value),autoFocus:!0,onKeyDown:e=>{e.stopPropagation(),e[N.CTRL_OR_CMD]&&e.key===N.K&&e.preventDefault(),(e.key===N.ENTER||e.key===N.ESCAPE)&&(g(),n({showHyperlinkPopup:`info`}))}}):e.link?(0,W.jsx)(`a`,{href:Hs(e.link||``),className:`excalidraw-hyperlinkContainer-link`,target:p(e.link)?`_self`:`_blank`,onClick:t=>{if(e.link&&r){let n=Fi(F.EXCALIDRAW_LINK,t.nativeEvent);r({...e,link:Hs(e.link)},n),n.defaultPrevented&&t.preventDefault()}},rel:`noopener noreferrer`,children:e.link}):(0,W.jsx)(`div`,{className:`excalidraw-hyperlinkContainer-link`,children:K(`labels.link.empty`)}),(0,W.jsxs)(`div`,{className:`excalidraw-hyperlinkContainer__buttons`,children:[!h&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.edit`),"aria-label":K(`buttons.edit`),label:K(`buttons.edit`),onClick:v,className:`excalidraw-hyperlinkContainer--edit`,icon:ab}),(0,W.jsx)(X,{type:`button`,title:K(`labels.linkToElement`),"aria-label":K(`labels.linkToElement`),label:K(`labels.linkToElement`),onClick:()=>{n({openDialog:{name:`elementLinkSelector`,sourceElementId:e.id}})},icon:GS}),u&&!rs(e)&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.remove`),"aria-label":K(`buttons.remove`),label:K(`buttons.remove`),onClick:_,className:`excalidraw-hyperlinkContainer--remove`,icon:pb})]})]})},HE=(e,t,n)=>{let[r,i]=ei(e,n),{x:a,y:o}=Ci({sceneX:r+e.width/2,sceneY:i},t);return{x:a-t.offsetLeft-PE/2,y:o-t.offsetTop-LE}},UE=(e,t)=>{let n=ir(e,t);return rs(n[0])?`labels.link.editEmbed`:n[0]?.link?`labels.link.edit`:`labels.link.create`},WE=null,GE=(e,t,n)=>{WE&&clearTimeout(WE),WE=window.setTimeout(()=>KE(e,t,n),300)},KE=(e,t,n)=>{if(!e.link)return;let r=Fw();r.classList.add(`excalidraw-tooltip--visible`),r.style.maxWidth=`20rem`,r.textContent=Bn(e.link)?K(`labels.link.goToElement`):e.link;let[i,a,o,s]=ei(e,n),[c,l,u,d]=ro([i,a,o,s],e.angle,t),f=Ci({sceneX:c,sceneY:l},t);Iw(r,{left:f.x,top:f.y,width:u,height:d},`top`),dC(`hyperlink`,`tooltip`,`link-icon`),zE=!0},qE=()=>{WE&&clearTimeout(WE),zE&&(zE=!1,Fw().classList.remove(`excalidraw-tooltip--visible`))},JE=(e,t,n,[r,i])=>{let{x:a,y:o}=la({clientX:r,clientY:i},n),s=15/n.zoom.value;if(Re(O(a,o),e,t))return!1;let[c,l,u]=ei(e,t);if(a>=c&&a<=u&&o>=l-LE&&o<=l)return!1;let{x:d,y:f}=HE(e,n,t);return!(r>=d-s&&r<=d+PE+IE*2+s&&i>=f-s&&i<=f+s+IE*2+FE)},YE=Z({name:`hyperlink`,label:(e,t)=>UE(e,t),icon:Db,perform:(e,t)=>t.showHyperlinkPopup===`editor`?!1:{elements:e,appState:{...t,showHyperlinkPopup:`editor`,openMenu:null},captureUpdate:V.IMMEDIATELY},trackEvent:{category:`hyperlink`,action:`click`},keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.K,predicate:(e,t)=>ir(e,t).length===1,PanelComponent:({elements:e,appState:t,updateData:n})=>{let r=ir(e,t);return(0,W.jsx)(X,{type:`button`,icon:Db,"aria-label":K(UE(e,t)),title:`${rs(e[0])?K(`labels.link.labelEmbed`):K(`labels.link.label`)} - ${Q(`CtrlOrCmd+K`)}`,onClick:()=>n(null),selected:r.length===1&&!!r[0].link})}}),XE=e=>e.every(e=>!e.locked),ZE=Z({name:`toggleElementLock`,label:(e,t,n)=>XE(n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}))?`labels.elementLock.lock`:`labels.elementLock.unlock`,icon:(e,t)=>XE(ir(t,e))?Ky:Gy,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return i.length>0&&!i.some(e=>e.locked&&e.frameId)},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});if(!i.length)return!1;let a=XE(i),o=lr(i),s=i.length>1&&Co(i),c=i.length===1||s?null:Bi(),l={...t.lockedMultiSelections};if(a)l={...t.lockedMultiSelections,...c?{[c]:!0}:{}};else if(s){let e=i[0].groupIds.at(-1);delete l[e]}let u=e.map(e=>{if(!o.has(e.id))return e;let n=e.groupIds;return a?c&&(n=[...n,c]):n=n.filter(e=>!t.lockedMultiSelections[e]),B(e,{locked:a,groupIds:n.length===e.groupIds.length?e.groupIds:n})}),d=lr(u),f=a?{}:Object.fromEntries(i.map(e=>[e.id,!0])),p=i.map(e=>d.get(e.id)||e),m=a?{}:Kt(p,t),h=a?c||(s?i[0].groupIds.at(-1):i[0].id):null;return{elements:u,appState:{...t,selectedElementIds:f,selectedGroupIds:m,selectedLinearElement:a?null:t.selectedLinearElement,lockedMultiSelections:l,activeLockedId:h},captureUpdate:V.IMMEDIATELY}},keyTest:(e,t,n,r)=>e.key.toLocaleLowerCase()===N.L&&e[N.CTRL_OR_CMD]&&e.shiftKey&&r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}).length>0}),QE=Z({name:`unlockAllElements`,trackEvent:{category:`canvas`},viewMode:!1,icon:Gy,predicate:(e,t)=>ir(e,t).length===0&&e.some(e=>e.locked),perform:(e,t)=>{let n=e.filter(e=>e.locked),r=e.map(e=>{if(e.locked){let n=e.groupIds.filter(e=>!t.lockedMultiSelections[e]);return B(e,{locked:!1,groupIds:e.groupIds.length===n.length?e.groupIds:n})}return e}),i=lr(r),a=n.map(e=>i.get(e.id)||e);return{elements:r,appState:{...t,selectedElementIds:Object.fromEntries(n.map(e=>[e.id,!0])),selectedGroupIds:Kt(a,t),lockedMultiSelections:{},activeLockedId:null},captureUpdate:V.IMMEDIATELY}},label:`labels.elementLock.unlockAll`}),$E=8,eD=10,tD=[`rectangle`,`diamond`,`ellipse`],nD=[`line`,`sharpArrow`,`curvedArrow`,`elbowArrow`],rD=new Set(tD),iD=new Set(nD),aD=e=>rD.has(e),oD=e=>e===`arrow`||iD.has(e),sD=yc(null),cD=new Map,lD=new Map,uD=({app:e})=>{let t=e.scene.getSelectedElements(e.state),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(t.length===0){e.updateEditorAtom(sD,null);return}let r=mD(t);r&&!n.current?n.current=r:(n.current&&!r||n.current&&r!==n.current)&&(e.updateEditorAtom(sD,null),n.current=null)},[t,e]),(0,H.useEffect)(()=>()=>{cD.clear(),lD.clear()},[]),(0,W.jsx)(dD,{app:e,elements:t})},dD=({app:e,elements:t})=>{let n=mD(t),r=(0,H.useMemo)(()=>n===`generic`?_D(t):[],[n,t]),i=(0,H.useMemo)(()=>n===`linear`?vD(t):[],[n,t]),a=n===`generic`?r.every(e=>e.type===r[0].type):n===`linear`?i.every(e=>st(e)===st(i[0])):!1,[o,s]=(0,H.useState)({x:0,y:0}),c=(0,H.useRef)(``),l=(0,H.useRef)(null);(0,H.useEffect)(()=>{let t=[...r,...i].sort((e,t)=>e.id.localeCompare(t.id)),n=`
|
|
54
|
+
${e.state.scrollX}${e.state.scrollY}${e.state.offsetTop}${e.state.offsetLeft}${e.state.zoom.value}${t.map(e=>e.id).join(`,`)}`;if(n===c.current)return;c.current=n;let a;if(t.length===1){let[n,,,r,i,o]=ei(t[0],e.scene.getNonDeletedElementsMap());a=ke(O(n,r),O(i,o),t[0].angle)}else{let{minX:e,maxY:n}=Pa(t);a=O(e,n)}let{x:o,y:l}=Ci({sceneX:a[0],sceneY:a[1]},e.state);s({x:o,y:l})},[r,i,e.scene,e.state]),(0,H.useEffect)(()=>{for(let e of i){let t=gD(e.id,DD(e));lD.has(t)||lD.set(t,e)}},[i]),(0,H.useEffect)(()=>{for(let t of r)if(!cD.has(t.id)){let n=ut(t,e.scene.getNonDeletedElementsMap());n&&cD.set(t.id,{fontSize:n.fontSize})}},[r,e.scene]);let u=n===`linear`?[[`line`,rb],[`sharpArrow`,RS],[`curvedArrow`,BS],[`elbowArrow`,zS]]:n===`generic`?[[`rectangle`,$y],[`diamond`,eb],[`ellipse`,tb]]:[];return(0,W.jsx)(`div`,{ref:l,tabIndex:-1,style:{position:`absolute`,top:`${o.y+(eD+8)*e.state.zoom.value-e.state.offsetTop}px`,left:`${o.x-e.state.offsetLeft-$E}px`,zIndex:2},className:Qn.CONVERT_ELEMENT_TYPE_POPUP,children:u.map(([o,s])=>(0,W.jsx)(X,{className:`Shape`,type:`radio`,icon:s,checked:a&&(n===`generic`&&r[0].type===o||n===`linear`&&st(i[0])===o),name:`convertElementType-option`,title:o,keyBindingLabel:``,"aria-label":o,"data-testid":`toolbar-${o}`,onChange:()=>{e.state.activeTool.type!==o&&dC(`convertElementType`,o,`ui`),pD(e,{conversionType:n,nextType:o}),l.current?.focus()}},`${t[0].id}${t[0].version}_${o}`))})},fD=(e,t,n)=>{let r=Ne(e,t),i=_e(e,t),a=gn(Jt(t.text,u(t),r),u(t),t.lineHeight),o=t.fontSize;for(;(a.width>r||a.height>i)&&o>0;){--o;let e={...t,fontSize:o};a=gn(t.text,u(e),t.lineHeight)}jn(t,n.getNonDeletedElementsMap(),{fontSize:o,width:a.width,height:a.height}),Zi(t,e,n)},pD=(e,{conversionType:t,nextType:n,direction:r=`right`})=>{if(!t)return!1;let i=e.scene.getSelectedElements(e.state),a=i.reduce((e,t)=>({...e,[t.id]:!0}),{}),o=r===`right`?1:-1;if(t===`generic`){let t=_D(i),r=t.every(e=>e.type===t[0].type)?tD.indexOf(t[0].type):-1;if(n??=tD[(r+tD.length+o)%tD.length],n&&aD(n)){let r={};for(let i of t){let t=TD(i,n,e);r[t.id]=t}let i=[];for(let t of e.scene.getElementsIncludingDeleted())r[t.id]?i.push(r[t.id]):i.push(t);e.scene.replaceAllElements(i);for(let t of Object.values(r)){let n=ut(t,e.scene.getNonDeletedElementsMap());n&&(cD.get(t.id)&&jn(n,e.scene.getNonDeletedElementsMap(),{fontSize:cD.get(t.id)?.fontSize??n.fontSize}),fD(t,n,e.scene))}e.setState(e=>({selectedElementIds:a,activeTool:ka(e,{type:`selection`})}))}}if(t===`linear`){let t=vD(i);if(!n){let e=it(t,st);n=nD[((e?nD.indexOf(e):-1)+nD.length+o)%nD.length]}if(oD(n)){let r=[],i=e.scene.getElementsMapIncludingDeleted();for(let a of t){let t=lD.get(gD(a.id,n));if(t&&st(t)===n)i.set(t.id,t),r.push(t);else{let t=TD(a,n,e);i.set(t.id,t),r.push(t)}}e.scene.replaceAllElements(i);for(let t of r)if(b(t))if(dr(t)){let n=CD(t);if(n.length<2)continue;let r=[];for(let e=1;e<n.length-2;e++)r.push({start:n[e],end:n[e+1],index:e+1});let i=fi(t,e.scene.getNonDeletedElementsMap(),{points:n,fixedSegments:r});jn(t,e.scene.getNonDeletedElementsMap(),{...i,endArrowhead:`arrow`})}else{let n=le([`line`,`sharpArrow`,`curvedArrow`],e=>lD.get(gD(t.id,e)));if(n){let r=n.points;e.scene.mutateElement(t,{points:r})}}}let r=vD(e.scene.getSelectedElements(e.state));e.setState(t=>({selectedElementIds:a,selectedLinearElement:r.length===1?new I(r[0],e.scene.getNonDeletedElementsMap()):null,activeTool:ka(t,{type:`selection`})}))}return!0},mD=e=>{if(e.length===0)return null;let t=!1;for(let n of e){if(aD(n.type))return`generic`;hD(n)&&(t=!0)}return t?`linear`:null},hD=e=>b(e)&&(!jt(e)||!Yi(e)&&!xr(e)),gD=(e,t)=>`${e}:${t}`,_D=e=>e.filter(e=>aD(e.type)),vD=e=>e.filter(e=>hD(e)),yD=20,bD=(e,t)=>e[0]===t[0],xD=(e,t)=>e[1]===t[1],SD=(e,t)=>bD(e,t)?Math.abs(e[1]-t[1]):Math.abs(e[0]-t[0]),CD=e=>{let t=[e.points[0]],n=wD(e.points);for(let e=1;e<n.length;++e){let r=t[t.length-1],i=[...n[e]];Math.abs(i[0]-r[0])<yD?i[0]=r[0]:Math.abs(i[1]-r[1])<yD&&(i[1]=r[1]),bD(r,i)||xD(r,i)||t.push(O(r[0],i[1])),t.push(i)}let r=[t[0]];for(let e=1;e<t.length-1;++e)bD(t[e-1],t[e])&&bD(t[e],t[e+1])||xD(t[e-1],t[e])&&xD(t[e],t[e+1])||r.push(t[e]);r.push(t[t.length-1]);let i=[r[0]];for(let e=1;e<r.length-1;++e){let t=i[i.length-1],n=r[e],a=r[e+1],o=bD(t,n),s=bD(n,a);if(o!==s){let e=SD(t,n),r=SD(n,a);if(e<yD||r<yD){if(r<e)o?a[0]=t[0]:a[1]=t[1];else if(s)for(let e=i.length-1;e>=0&&i[e][0]===t[0];--e)i[e][0]=n[0];else for(let e=i.length-1;e>=0&&i[e][1]===t[1];--e)i[e][1]=n[1];continue}}i.push(n)}return i.push(r[r.length-1]),i},wD=e=>{if(e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++){let[r,i]=t[t.length-1],[a,o]=e[n];(r!==a||i!==o)&&t.push(e[n])}return t},TD=(e,t,n)=>{if(!ED(e.type,t)){if(!co())throw Error(`Invalid conversion from ${e.type} to ${t}.`);return e}if(e.type===t)return e;if(bn.delete(e),aD(t)){let r=qa(cn({...e,type:t,roundness:t===`diamond`&&e.roundness?{type:Ga(t)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:e.roundness}));return Xn(r,n.scene,n.state),r}if(oD(t))switch(t){case`line`:return qa(Tn({...e,type:`line`}));case`sharpArrow`:return qa(or({...e,type:`arrow`,elbowed:!1,roundness:null,startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`curvedArrow`:return qa(or({...e,type:`arrow`,elbowed:!1,roundness:{type:Xa.PROPORTIONAL_RADIUS},startArrowhead:n.state.currentItemStartArrowhead,endArrowhead:n.state.currentItemEndArrowhead}));case`elbowArrow`:return qa(or({...e,type:`arrow`,elbowed:!0,fixedSegments:null,roundness:null}))}return Ro(t,`unhandled conversion type: ${t}`),e},ED=(e,t)=>!!(aD(e)&&aD(t)||oD(e)&&oD(t)),DD=e=>b(e)?st(e):e.type,OD=uD,kD=Z({name:`toggleShapeSwitch`,label:`labels.shapeSwitch`,icon:()=>null,viewMode:!0,trackEvent:{category:`shape_switch`,action:`toggle`},keywords:[`change`,`switch`,`swap`],perform(e,t,n,r){return Cy.set(sD,{type:`panel`}),{captureUpdate:V.NEVER}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>mD(e)!==null}),AD=Z({name:`copyElementLink`,label:`labels.copyElementLink`,icon:$x,trackEvent:{category:`element`},perform:async(e,t,n,r)=>{let i=ir(e,t);try{if(window.location){let n=Fa(i,t);return n?(await AT(r.props.generateLinkForSelection?r.props.generateLinkForSelection(n.id,n.type):_a(n.id,n.type)),{appState:{toast:{message:K(`toast.elementLinkCopied`),closable:!0}},captureUpdate:V.EVENTUALLY}):{appState:t,elements:e,app:r,captureUpdate:V.EVENTUALLY}}}catch(e){console.error(e)}return{appState:t,elements:e,app:r,captureUpdate:V.EVENTUALLY}},predicate:(e,t)=>vi(ir(e,t))}),jD=Z({name:`linkToElement`,label:`labels.linkToElement`,icon:GS,perform:(e,t,n,r)=>{let i=ir(e,t);return i.length!==1||!vi(i)?{elements:e,appState:t,app:r,captureUpdate:V.EVENTUALLY}:{appState:{...t,openDialog:{name:`elementLinkSelector`,sourceElementId:ir(e,t)[0].id}},captureUpdate:V.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=ir(e,t);return t.openDialog?.name!==`elementLinkSelector`&&i.length===1&&vi(i)},trackEvent:!1}),MD={toggleTheme:[Q(`Shift+Alt+D`)],saveScene:[Q(`CtrlOrCmd+S`)],loadScene:[Q(`CtrlOrCmd+O`)],clearCanvas:[Q(`CtrlOrCmd+Delete`)],imageExport:[Q(`CtrlOrCmd+Shift+E`)],commandPalette:[Q(`CtrlOrCmd+/`),Q(`CtrlOrCmd+Shift+P`)],cut:[Q(`CtrlOrCmd+X`)],copy:[Q(`CtrlOrCmd+C`)],paste:[Q(`CtrlOrCmd+V`)],copyStyles:[Q(`CtrlOrCmd+Alt+C`)],pasteStyles:[Q(`CtrlOrCmd+Alt+V`)],selectAll:[Q(`CtrlOrCmd+A`)],deleteSelectedElements:[Q(`Delete`)],duplicateSelection:[Q(`CtrlOrCmd+D`),Q(`Alt+${K(`helpDialog.drag`)}`)],sendBackward:[Q(`CtrlOrCmd+[`)],bringForward:[Q(`CtrlOrCmd+]`)],sendToBack:[Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)],bringToFront:[Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)],copyAsPng:[Q(`Shift+Alt+C`)],group:[Q(`CtrlOrCmd+G`)],ungroup:[Q(`CtrlOrCmd+Shift+G`)],gridMode:[Q(`CtrlOrCmd+'`)],zenMode:[Q(`Alt+Z`)],objectsSnapMode:[Q(`Alt+S`)],stats:[Q(`Alt+/`)],addToLibrary:[],flipHorizontal:[Q(`Shift+H`)],flipVertical:[Q(`Shift+V`)],viewMode:[Q(`Alt+R`)],hyperlink:[Q(`CtrlOrCmd+K`)],toggleElementLock:[Q(`CtrlOrCmd+Shift+L`)],resetZoom:[Q(`CtrlOrCmd+0`)],zoomOut:[Q(`CtrlOrCmd+-`)],zoomIn:[Q(`CtrlOrCmd++`)],zoomToFitSelection:[Q(`Shift+3`)],zoomToFit:[Q(`Shift+1`)],zoomToFitSelectionInViewport:[Q(`Shift+2`)],toggleEraserTool:[Q(`E`)],toggleHandTool:[Q(`H`)],setFrameAsActiveTool:[Q(`F`)],saveFileToDisk:[Q(`CtrlOrCmd+S`)],saveToActiveFile:[Q(`CtrlOrCmd+S`)],toggleShortcuts:[Q(`?`)],searchMenu:[Q(`CtrlOrCmd+F`)],wrapSelectionInFrame:[],toolLock:[Q(`Q`)]},ND=(e,t=0)=>{let n=MD[e];return n&&n.length>0?n[t]||n[0]:``},PD=RegExp(`[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]`,`g`),FD=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ID={À:`A`,Á:`A`,Â:`A`,Ã:`A`,Ä:`A`,Å:`A`,à:`a`,á:`a`,â:`a`,ã:`a`,ä:`a`,å:`a`,Ç:`C`,ç:`c`,Ð:`D`,ð:`d`,È:`E`,É:`E`,Ê:`E`,Ë:`E`,è:`e`,é:`e`,ê:`e`,ë:`e`,Ì:`I`,Í:`I`,Î:`I`,Ï:`I`,ì:`i`,í:`i`,î:`i`,ï:`i`,Ñ:`N`,ñ:`n`,Ò:`O`,Ó:`O`,Ô:`O`,Õ:`O`,Ö:`O`,Ø:`O`,ò:`o`,ó:`o`,ô:`o`,õ:`o`,ö:`o`,ø:`o`,Ù:`U`,Ú:`U`,Û:`U`,Ü:`U`,ù:`u`,ú:`u`,û:`u`,ü:`u`,Ý:`Y`,ý:`y`,ÿ:`y`,Æ:`E`,æ:`e`,Þ:`T`,þ:`t`,ß:`s`,Ā:`A`,Ă:`A`,Ą:`A`,ā:`a`,ă:`a`,ą:`a`,Ć:`C`,Ĉ:`C`,Ċ:`C`,Č:`C`,ć:`c`,ĉ:`c`,ċ:`c`,č:`c`,Ď:`D`,Đ:`D`,ď:`d`,đ:`d`,Ē:`E`,Ĕ:`E`,Ė:`E`,Ę:`E`,Ě:`E`,ē:`e`,ĕ:`e`,ė:`e`,ę:`e`,ě:`e`,Ĝ:`G`,Ğ:`G`,Ġ:`G`,Ģ:`G`,ĝ:`g`,ğ:`g`,ġ:`g`,ģ:`g`,Ĥ:`H`,Ħ:`H`,ĥ:`h`,ħ:`h`,Ĩ:`I`,Ī:`I`,Ĭ:`I`,Į:`I`,İ:`I`,ĩ:`i`,ī:`i`,ĭ:`i`,į:`i`,ı:`i`,Ĵ:`J`,ĵ:`j`,Ķ:`K`,ķ:`k`,ĸ:`k`,Ĺ:`L`,Ļ:`L`,Ľ:`L`,Ŀ:`L`,Ł:`L`,ĺ:`l`,ļ:`l`,ľ:`l`,ŀ:`l`,ł:`l`,Ń:`N`,Ņ:`N`,Ň:`N`,Ŋ:`N`,ń:`n`,ņ:`n`,ň:`n`,ŋ:`n`,Ō:`O`,Ŏ:`O`,Ő:`O`,ō:`o`,ŏ:`o`,ő:`o`,Ŕ:`R`,Ŗ:`R`,Ř:`R`,ŕ:`r`,ŗ:`r`,ř:`r`,Ś:`S`,Ŝ:`S`,Ş:`S`,Š:`S`,ś:`s`,ŝ:`s`,ş:`s`,š:`s`,Ţ:`T`,Ť:`T`,Ŧ:`T`,ţ:`t`,ť:`t`,ŧ:`t`,Ũ:`U`,Ū:`U`,Ŭ:`U`,Ů:`U`,Ű:`U`,Ų:`U`,ũ:`u`,ū:`u`,ŭ:`u`,ů:`u`,ű:`u`,ų:`u`,Ŵ:`W`,ŵ:`w`,Ŷ:`Y`,ŷ:`y`,Ÿ:`Y`,Ź:`Z`,Ż:`Z`,Ž:`Z`,ź:`z`,ż:`z`,ž:`z`,IJ:`I`,ij:`i`,Œ:`E`,œ:`e`,ʼn:`n`,ſ:`s`},LD=e=>e.replace(FD,e=>ID[e]||e).replace(PD,``),RD=()=>{let[e,t]=(0,H.useState)(null);return[e,(0,H.useCallback)(e=>t(e),[])]},zD=({elements:e,appState:t,files:n,maxWidthOrHeight:r,getDimensions:i,exportPadding:a,exportingFrame:o})=>{let s=Sa(e,null,{deleteInvisibleElements:!0}),c=gr(t,null),{exportBackground:l,viewBackgroundColor:u}=c;return j(s,{...c,offsetTop:0,offsetLeft:0,width:0,height:0},n||{},{exportBackground:l,exportPadding:a,viewBackgroundColor:u,exportingFrame:o},(e,n)=>{let a=document.createElement(`canvas`);if(r){typeof i==`function`&&console.warn("`getDimensions()` is ignored when `maxWidthOrHeight` is supplied.");let o=Math.max(e,n),s=r<o?r/o:t?.exportScale??1;return a.width=e*s,a.height=n*s,{canvas:a,scale:s}}let o=i?.(e,n)||{width:e,height:n};return a.width=o.width,a.height=o.height,{canvas:a,scale:o.scale??1}})},BD=async({elements:e,appState:t=cs(),files:n={},exportPadding:r,renderEmbeddables:i,exportingFrame:a,skipInliningFonts:o,reuseImages:s})=>be(Sa(e,null,{deleteInvisibleElements:!0}),{...gr(t,null),exportPadding:r},n,{exportingFrame:a,renderEmbeddables:i,skipInliningFonts:o,reuseImages:s}),VD=yc(new Map),HD=async e=>await BD({elements:e,appState:{exportBackground:!1,viewBackgroundColor:hi.white},files:null,renderEmbeddables:!1,skipInliningFonts:!0}),UD=(e,t,n,r)=>{let[i,a]=(0,H.useState)();return(0,H.useEffect)(()=>{if(t)if(e){let r=n.get(e);r?a(r):(async()=>{let r=await HD(t);r.querySelector(`.style-fonts`)?.remove(),r&&(n.set(e,r),a(r))})()}else (async()=>{a(await HD(t))})()},[e,t,n,a]),(0,H.useEffect)(()=>{let e=r.current;if(e)return i&&(e.innerHTML=i.outerHTML),()=>{e.innerHTML=``}},[i,r]),i},WD=()=>{let[e]=vy(VD);return{clearLibraryCache:()=>e.clear(),deleteItemsFromLibraryCache:t=>{t.forEach(t=>e.delete(t))},svgCache:e}},GD=new Be,KD=yc({status:`loaded`,isInitialized:!1,libraryItems:[]}),qD=e=>js(e),JD=(e,t)=>!e.find(e=>e.elements.length===t.elements.length?e.elements.every((e,n)=>e.id===t.elements[n].id&&e.versionNonce===t.elements[n].versionNonce):!1),YD=(e,t)=>{let n=[];for(let r of t)JD(e,r)&&n.push(r);return[...n,...e]},XD=(e,t)=>{let n=lr(t),r={deletedItems:new Map,addedItems:new Map,updatedItems:new Map};for(let t of e)n.has(t.id)||r.deletedItems.set(t.id,t);let i=lr(e);for(let e of t){let t=i.get(e.id);t?eO(t)!==eO(e)&&r.updatedItems.set(e.id,e):r.addedItems.set(e.id,e)}return r},ZD=class{constructor(e){i(this,`currLibraryItems`,[]),i(this,`prevLibraryItems`,qD(this.currLibraryItems)),i(this,`app`),i(this,`updateQueue`,[]),i(this,`getLastUpdateTask`,()=>this.updateQueue[this.updateQueue.length-1]),i(this,`notifyListeners`,()=>{if(this.updateQueue.length>0)Cy.set(KD,e=>({status:`loading`,libraryItems:this.currLibraryItems,isInitialized:e.isInitialized}));else{Cy.set(KD,{status:`loaded`,libraryItems:this.currLibraryItems,isInitialized:!0});try{let e=this.prevLibraryItems;this.prevLibraryItems=qD(this.currLibraryItems);let t=qD(this.currLibraryItems);this.app.props.onLibraryChange?.(t),GD.trigger(XD(e,t),t)}catch(e){console.error(e)}}}),i(this,`destroy`,()=>{this.updateQueue=[],this.currLibraryItems=[],Cy.set(VD,new Map)}),i(this,`resetLibrary`,()=>this.setLibrary([])),i(this,`getLatestLibrary`,()=>new Promise(async e=>{try{let t=await(this.getLastUpdateTask()||this.currLibraryItems);this.updateQueue.length>0?e(this.getLatestLibrary()):e(qD(t))}catch{return e(this.currLibraryItems)}})),i(this,`updateLibrary`,async({libraryItems:e,prompt:t=!1,merge:n=!1,openLibraryMenu:r=!1,defaultStatus:i=`unpublished`})=>(r&&this.app.setState({openSidebar:{name:At.name,tab:`library`}}),this.setLibrary(()=>new Promise(async(r,a)=>{try{let o=await(typeof e==`function`&&!(e instanceof Blob)?e(this.currLibraryItems):e),s;s=o instanceof Blob?await Yt(o,i):zn(o,i),!t||window.confirm(K(`alerts.confirmAddLibrary`,{numShapes:s.length}))?(t&&this.app.focusContainer(),r(n?YD(this.currLibraryItems,s):s)):a(new E)}catch(e){a(e)}})))),i(this,`setLibrary`,e=>{let t=new Promise(async(t,n)=>{try{await this.getLastUpdateTask(),typeof e==`function`&&(e=e(this.currLibraryItems)),this.currLibraryItems=qD(await e),t(this.currLibraryItems)}catch(e){n(e)}}).catch(e=>{if(e.name===`AbortError`)return console.warn(`Library update aborted by user`),this.currLibraryItems;throw e}).finally(()=>{this.updateQueue=this.updateQueue.filter(e=>e!==t),this.notifyListeners()});return this.updateQueue.push(t),this.notifyListeners(),t}),this.app=e}},QD=e=>{let t=Math.ceil(Math.sqrt(e.length)),n=[],r=n=>e.slice(n*t,n*t+t).reduce((e,t)=>{let{height:n}=Pa(t.elements);return Math.max(e,n)},0),i=n=>{let r=0,i=0,a=0;for(let o of e){if(r%t===0&&(i=0),i===n){let{width:e}=Pa(o.elements);a=Math.max(a,e)}r++,i++}return a},a=0,o=0,s=0,c=0,l=0,u=0,d=0;for(let f of e){l&&l%t===0&&(o+=s+50,a=0,u=0,d++),u===0&&(s=r(d)),c=i(u);let{minX:e,minY:p,width:m,height:h}=Pa(f.elements),g=(c-m)/2,_=(s-h)/2;n.push(...f.elements.map(t=>({...t,x:t.x+a+g-e,y:t.y+o+_-p}))),a+=c+50,l++,u++}return n},$D=class e{constructor(e){i(this,`adapter`),this.adapter=e}static async getLibraryItems(t,n,r=!0){let i=()=>new Promise(async(e,r)=>{try{e(zn((await t.load({source:n}))?.libraryItems||[],`published`))}catch(e){r(e)}});return r?e.queue.push(i):i()}getLibraryItems(t){return e.getLibraryItems(this.adapter,t,!1)}};i($D,`queue`,new _o),i($D,`run`,async(e,t)=>{let n=new $D(e);return $D.queue.push(()=>t(n))});var eO=e=>`${e.id}:${e.name||``}:${Si(e.elements)}`,tO=({theme:e,id:t,libraryReturnUrl:n})=>{let i=n||window.location.origin+window.location.pathname;return(0,W.jsx)(`a`,{className:`library-menu-browse-button`,href:`${r.VITE_APP_LIBRARY_URL}?target=${window.name||`_blank`}&referrer=${i}&useHash=true&token=${t}&theme=${e}&version=${Ei.excalidrawLibrary}`,target:`_excalidraw_libraries`,children:K(`labels.libraries`)})},nO=({libraryReturnUrl:e,theme:t,id:n,style:r,children:i,className:a})=>(0,W.jsxs)(`div`,{className:U(`library-menu-control-buttons`,a),style:r,children:[(0,W.jsx)(tO,{id:n,libraryReturnUrl:e,theme:t}),i]}),rO=yc(0),iO=e=>{let[t,n]=vy(rO);return(0,H.useEffect)(()=>{let{current:t}=e;if(!t)return;let r=(0,gc.default)(()=>{let{scrollTop:e}=t;n(e)},200);return t.addEventListener(`scroll`,r),()=>{r.cancel(),t.removeEventListener(`scroll`,r)}},[e,n]),t},aO=({label:e,onClick:t,className:n,children:r,actionType:i,type:a=`button`,isLoading:o,...s})=>(0,W.jsxs)(`button`,{className:U(`Dialog__action-button`,i?`Dialog__action-button--${i}`:``,n),type:a,"aria-label":e,onClick:t,...s,children:[r&&(0,W.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:r}),(0,W.jsx)(`div`,{style:o?{visibility:`hidden`}:{},children:e}),o&&(0,W.jsx)(`div`,{style:{position:`absolute`,inset:0},children:(0,W.jsx)($S,{})})]}),oO=e=>{let{onConfirm:t,onCancel:n,children:r,confirmText:i=K(`buttons.confirm`),cancelText:a=K(`buttons.cancel`),className:o=``,...s}=e,c=lz(),l=yy(rk),{container:u}=oz();return(0,W.jsxs)(dk,{onCloseRequest:n,size:`small`,...s,className:`confirm-dialog ${o}`,children:[r,(0,W.jsxs)(`div`,{className:`confirm-dialog-buttons`,children:[(0,W.jsx)(aO,{label:a,onClick:()=>{c({openMenu:null}),l(!1),(0,_c.flushSync)(()=>{n()}),u?.focus()}}),(0,W.jsx)(aO,{label:i,onClick:()=>{c({openMenu:null}),l(!1),(0,_c.flushSync)(()=>{t()}),u?.focus()},actionType:`danger`})]})]})},sO=class{static has(e){try{return!!window.localStorage.getItem(e)}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),!1}}static get(e){try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):null}catch(e){return console.warn(`localStorage.getItem error: ${e.message}`),null}}};i(sO,`set`,(e,t)=>{try{return window.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){return console.warn(`localStorage.setItem error: ${e.message}`),!1}}),i(sO,`delete`,e=>{try{window.localStorage.removeItem(e)}catch(e){console.warn(`localStorage.removeItem error: ${e.message}`)}});var cO=/({{[\w-]+}})|(<[\w-]+>)|(<\/[\w-]+>)/g,lO=/{{([\w-]+)}}/,uO=/<([\w-]+)>/,dO=/<\/([\w-]+)>/,fO=(e,t)=>{let n=[{name:``,children:[]}];return e.split(cO).filter(Boolean).forEach(r=>{let i=r.match(uO),a=r.match(dO),o=r.match(lO);if(i!==null){let r=i[1];t.hasOwnProperty(r)?n.push({name:r,children:[]}):console.warn(`Trans: missed to pass in prop ${r} for interpolating ${e}`)}else if(a!==null)if(a[1]===n[n.length-1].name){let e=n.pop(),r=H.createElement(H.Fragment,{},...e.children),i=t[e.name];typeof i==`function`&&n[n.length-1].children.push(i(r))}else console.warn(`Trans: unexpected end tag ${r} for interpolating ${e}`);else if(o!==null){let r=o[1];t.hasOwnProperty(r)?n[n.length-1].children.push(t[r]):console.warn(`Trans: key ${r} not in props for interpolating ${e}`)}else n[n.length-1].children.push(r)}),n.length!==1&&console.warn(`Trans: stack not empty for interpolating ${e}`),n[0].children},pO=({i18nKey:e,children:t,...n})=>{let{t:r}=Fy();return H.createElement(H.Fragment,{},...fO(r(e),n))},mO=async e=>{let t=ar(e,6),n=document.createElement(`canvas`);n.width=t[0].length*128+(t[0].length+1)*16-16,n.height=t.length*128+(t.length+1)*16-16;let r=n.getContext(`2d`);r.fillStyle=`#fff`,r.fillRect(0,0,n.width,n.height);for(let[t,n]of e.entries()){let e=await zD({elements:n.elements,files:null,maxWidthOrHeight:128}),{width:i,height:a}=e,o=Math.floor(t/6)*144,s=t%6*144;r.drawImage(e,s+(128-i)/2+8,o+(128-a)/2+8),r.lineWidth=2,r.strokeStyle=`#ced4da`,r.strokeRect(s+8/2,o+8/2,136,136)}return await Bt(new File([await er(n)],`preview`,{type:hs.png}),{outputType:hs.jpg,maxWidthOrHeight:5e3})},hO=({libItem:e,appState:t,index:n,onChange:r,onRemove:i})=>{let a=(0,H.useRef)(null),o=(0,H.useRef)(null);return(0,H.useEffect)(()=>{let n=a.current;n&&(async()=>{n.innerHTML=(await BD({elements:e.elements,appState:{...t,viewBackgroundColor:`#fff`,exportBackground:!0},files:null,skipInliningFonts:!0})).outerHTML})()},[e.elements,t]),(0,W.jsxs)(`div`,{className:`single-library-item`,children:[e.status===`published`&&(0,W.jsx)(`span`,{className:`single-library-item-status`,children:K(`labels.statusPublished`)}),(0,W.jsx)(`div`,{ref:a,className:`single-library-item__svg`}),(0,W.jsx)(X,{"aria-label":K(`buttons.remove`),type:`button`,icon:nx,className:`single-library-item--remove`,onClick:i.bind(null,e.id),title:K(`buttons.remove`)}),(0,W.jsxs)(`div`,{style:{display:`flex`,margin:`0.8rem 0`,width:`100%`,fontSize:`14px`,fontWeight:500,flexDirection:`column`},children:[(0,W.jsxs)(`label`,{style:{display:`flex`,justifyContent:`space-between`,flexDirection:`column`},children:[(0,W.jsxs)(`div`,{style:{padding:`0.5em 0`},children:[(0,W.jsx)(`span`,{style:{fontWeight:500,color:`#868e96`},children:K(`publishDialog.itemName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,ref:o,style:{width:`80%`,padding:`0.2rem`},defaultValue:e.name,placeholder:`Item name`,onChange:e=>{r(e.target.value,n)}})]}),(0,W.jsx)(`span`,{className:`error`,children:e.error})]})]})},gO=({onClose:e,libraryItems:t,appState:n,onSuccess:i,onError:a,updateItemsInStorage:o,onRemove:s})=>{let[c,l]=(0,H.useState)({authorName:``,githubHandle:``,name:``,description:``,twitterHandle:``,website:``}),[u,d]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=sO.get(da.PUBLISH_LIBRARY);e&&l(e)},[]);let[f,p]=(0,H.useState)(t.slice());(0,H.useEffect)(()=>{p(t.slice())},[t]);let m=e=>{l({...c,[e.target.name]:e.target.value})},h=async e=>{e.preventDefault(),d(!0);let t=[],n=!1;if(f.forEach(e=>{let r=``;e.name||(r=K(`publishDialog.errors.required`),n=!0),t.push({...e,error:r})}),n){p(t),d(!1);return}let o=await mO(f),s={type:Na.excalidrawLibrary,version:Ei.excalidrawLibrary,source:So(),libraryItems:f},l=JSON.stringify(s,null,2),u=new Blob([l],{type:`application/json`}),m=new FormData;m.append(`excalidrawLib`,u),m.append(`previewImage`,o),m.append(`previewImageType`,o.type),m.append(`title`,c.name),m.append(`authorName`,c.authorName),m.append(`githubHandle`,c.githubHandle),m.append(`name`,c.name),m.append(`description`,c.description),m.append(`twitterHandle`,c.twitterHandle),m.append(`website`,c.website),fetch(`${r.VITE_APP_LIBRARY_BACKEND}/submit`,{method:`post`,body:m}).then(e=>e.ok?e.json().then(({url:e})=>{sO.delete(da.PUBLISH_LIBRARY),i({url:e,authorName:c.authorName,items:f})}):e.json().catch(()=>{throw Error(e.statusText||`something went wrong`)}).then(t=>{throw Error(t.message||e.statusText||`something went wrong`)}),e=>{console.error(e),a(e),d(!1)}).catch(e=>{console.error(e),a(e),d(!1)})},g=()=>{let e=[];return f.forEach((t,r)=>{e.push((0,W.jsx)(`div`,{className:`single-library-item-wrapper`,children:(0,W.jsx)(hO,{libItem:t,appState:n,index:r,onChange:(e,t)=>{let n=f.slice();n[t].name=e,p(n)},onRemove:s})},r))}),(0,W.jsx)(`div`,{className:`selected-library-items`,children:e})},_=(0,H.useCallback)(()=>{o(f),sO.set(da.PUBLISH_LIBRARY,c),e()},[f,e,o,c]),v=!!t.length,y=t.some(e=>e.status===`published`);return(0,W.jsx)(dk,{onCloseRequest:_,title:K(`publishDialog.title`),className:`publish-library`,children:v?(0,W.jsxs)(`form`,{onSubmit:h,children:[(0,W.jsx)(`div`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteDescription`,link:e=>(0,W.jsx)(`a`,{href:`https://libraries.excalidraw.com`,target:`_blank`,rel:`noopener`,children:e})})}),(0,W.jsx)(`span`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteGuidelines`,link:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries#guidelines`,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,W.jsx)(`div`,{className:`publish-library-note`,children:K(`publishDialog.noteItems`)}),y&&(0,W.jsx)(`span`,{className:`publish-library-note publish-library-warning`,children:K(`publishDialog.republishWarning`)}),g(),(0,W.jsxs)(`div`,{className:`publish-library__fields`,children:[(0,W.jsxs)(`label`,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.libraryName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,name:`name`,required:!0,value:c.name,onChange:m,placeholder:K(`publishDialog.placeholder.libraryName`)})]}),(0,W.jsxs)(`label`,{style:{alignItems:`flex-start`},children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.libraryDesc`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`textarea`,{name:`description`,rows:4,required:!0,value:c.description,onChange:m,placeholder:K(`publishDialog.placeholder.libraryDesc`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.authorName`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`required`,children:`*`})]}),(0,W.jsx)(`input`,{type:`text`,name:`authorName`,required:!0,value:c.authorName,onChange:m,placeholder:K(`publishDialog.placeholder.authorName`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.githubUsername`)}),(0,W.jsx)(`input`,{type:`text`,name:`githubHandle`,value:c.githubHandle,onChange:m,placeholder:K(`publishDialog.placeholder.githubHandle`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.twitterUsername`)}),(0,W.jsx)(`input`,{type:`text`,name:`twitterHandle`,value:c.twitterHandle,onChange:m,placeholder:K(`publishDialog.placeholder.twitterHandle`)})]}),(0,W.jsxs)(`label`,{children:[(0,W.jsx)(`span`,{children:K(`publishDialog.website`)}),(0,W.jsx)(`input`,{type:`text`,name:`website`,pattern:`https?://.+`,title:K(`publishDialog.errors.website`),value:c.website,onChange:m,placeholder:K(`publishDialog.placeholder.website`)})]}),(0,W.jsx)(`span`,{className:`publish-library-note`,children:(0,W.jsx)(pO,{i18nKey:`publishDialog.noteLicense`,link:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw-libraries/blob/main/LICENSE`,target:`_blank`,rel:`noopener noreferrer`,children:e})})})]}),(0,W.jsxs)(`div`,{className:`publish-library__buttons`,children:[(0,W.jsx)(aO,{label:K(`buttons.saveLibNames`),onClick:_,"data-testid":`cancel-clear-canvas-button`}),(0,W.jsx)(aO,{type:`submit`,label:K(`buttons.submit`),actionType:`primary`,isLoading:u})]})]}):(0,W.jsx)(`p`,{style:{padding:`1em`,textAlign:`center`,fontWeight:500},children:K(`publishDialog.atleastOneLibItem`)})})},_O={Row:(0,H.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W.jsx)(`div`,{className:U(`Stack Stack_horizontal`,i),style:{"--gap":t,alignItems:n,justifyContent:r,...a},ref:o,children:e})),Col:(0,H.forwardRef)(({children:e,gap:t,align:n,justifyContent:r,className:i,style:a},o)=>(0,W.jsx)(`div`,{className:U(`Stack Stack_vertical`,i),style:{"--gap":t,justifyItems:n,justifyContent:r,...a},ref:o,children:e}))},vO=({children:e,onClickOutside:t,className:n=``,onSelect:r,open:i=!0,align:a=`end`,style:o})=>{let s=iz(),c=(0,H.useRef)(null),l=yC({onClickOutside:t});vC(c,(0,H.useCallback)(e=>{c.current?.closest(`.${Qn.DROPDOWN_MENU_EVENT_WRAPPER}`)?.contains(e.target)||l.onClickOutside?.()},[l])),(0,H.useEffect)(()=>{if(!i)return;let e=e=>{e.key===N.ESCAPE&&(e.stopImmediatePropagation(),l.onClickOutside?.())},t={capture:!0};return document.addEventListener(F.KEYDOWN,e,t),()=>{document.removeEventListener(F.KEYDOWN,e,t)}},[l,i]);let u=U(`dropdown-menu ${n}`,{"dropdown-menu--mobile":s.formFactor===`phone`}).trim();return(0,W.jsx)($C.Provider,{value:{onSelect:r},children:(0,W.jsx)(u_,{ref:c,className:u,style:o,"data-testid":`dropdown-menu`,align:a,sideOffset:8,onCloseAutoFocus:e=>e.preventDefault(),children:s.formFactor===`phone`?(0,W.jsx)(_O.Col,{className:`dropdown-menu-container`,children:e}):(0,W.jsx)(SC,{className:`dropdown-menu-container`,padding:2,children:e})})})};vO.displayName=`DropdownMenuContent`;var yO=vO,bO=({children:e,className:t=``,selected:n,...r})=>(0,W.jsx)(`div`,{...r,className:`dropdown-menu-item-base dropdown-menu-item-custom ${t} ${n?`dropdown-menu-item--selected`:``}`.trim(),children:e}),xO=({icon:e,shortcut:t,href:n,children:r,onSelect:i,className:a=``,selected:o,rel:s=`noopener`,...c})=>{let l=tw(i);return(0,W.jsx)(d_,{className:`radix-menu-item`,onSelect:l,asChild:!0,children:(0,W.jsx)(`a`,{...c,href:n,target:`_blank`,rel:`noopener ${s}`,className:ew(a,o),title:c.title??c[`aria-label`],children:(0,W.jsx)(rw,{icon:e,shortcut:t,children:r})})})},SO=xO;xO.displayName=`DropdownMenuItemLink`;var CO=()=>(0,W.jsx)(`div`,{style:{height:`1px`,backgroundColor:`var(--default-border-color)`,margin:`6px 0`,flex:`0 0 auto`}}),wO=CO;CO.displayName=`DropdownMenuSeparator`;var TO=-4,EO=4,DO=({children:e,className:t})=>{let n=iz(),r=U(`dropdown-menu dropdown-submenu ${t}`,{"dropdown-menu--mobile":n.formFactor===`phone`}).trim(),i=(0,H.useCallback)(e=>{if(e){let t=e.closest(`.dropdown-menu-container`)?.getBoundingClientRect();if(t){let n=e.getBoundingClientRect().width,r=window.innerWidth-t.right;r<n+20&&(o(r-n+TO),c(TO+8))}}},[]),[a,o]=(0,H.useState)(EO),[s,c]=(0,H.useState)(TO);return(0,W.jsx)(m_,{className:r,sideOffset:a,alignOffset:s,collisionPadding:8,ref:i,children:n.formFactor===`phone`?(0,W.jsx)(_O.Col,{className:`dropdown-menu-container`,children:e}):(0,W.jsx)(SC,{className:`dropdown-menu-container`,padding:2,style:{zIndex:1},children:e})})},OO=DO;DO.displayName=`DropdownMenuSubContent`;var kO=({children:e,icon:t,shortcut:n,className:r})=>(0,W.jsxs)(p_,{className:`${ew(r)} dropdown-menu__submenu-trigger`,children:[(0,W.jsx)(rw,{icon:t,shortcut:n,children:e}),(0,W.jsx)(`div`,{className:`dropdown-menu__submenu-trigger-icon`,children:ZS})]}),AO=kO;kO.displayName=`DropdownMenuSubTrigger`;var jO=e=>t=>H.Children.toArray(t).find(t=>H.isValidElement(t)&&typeof t.type!=`string`&&t?.type.displayName&&t.type.displayName===e)||null,MO=jO(`DropdownMenuTrigger`),NO=jO(`DropdownMenuContent`),PO=jO(`DropdownMenuSubTrigger`),FO=jO(`DropdownMenuSubContent`),IO=({children:e})=>{let t=PO(e),n=FO(e);return(0,W.jsxs)(f_,{children:[t,n]})};IO.Trigger=AO,IO.Content=OO,IO.displayName=`DropdownMenuSub`;var LO=IO,RO=({className:e=``,children:t,onToggle:n,title:r,...i})=>{let a=iz(),o=U(`dropdown-menu-button ${e}`,`zen-mode-transition`,{"dropdown-menu-button--mobile":a.formFactor===`phone`}).trim();return(0,W.jsx)(l_,{className:o,onClick:n,type:`button`,"data-testid":`dropdown-menu-button`,title:r,...i,children:t})},zO=RO;RO.displayName=`DropdownMenuTrigger`;var BO=e=>(0,W.jsx)(sw,{...e,icon:e.checked?Eb:XS}),VO=({children:e,open:t})=>{let n=MO(e),r=NO(e),i=r&&H.isValidElement(r)?H.cloneElement(r,{open:t}):r;return(0,W.jsx)(c_,{open:t,modal:!1,children:(0,W.jsxs)(`div`,{className:Qn.DROPDOWN_MENU_EVENT_WRAPPER,style:{display:`contents`},children:[n,i]})})};VO.Trigger=zO,VO.Content=yO,VO.Item=sw,VO.ItemCheckbox=BO,VO.ItemLink=SO,VO.ItemCustom=bO,VO.Group=QC,VO.Separator=wO,VO.Sub=LO;var HO=VO;VO.displayName=`DropdownMenu`;var UO=(e,t)=>e.filter(e=>t.includes(e.id)),WO=({setAppState:e,selectedItems:t,library:n,onRemoveFromLibrary:r,resetLibrary:i,onSelectItems:a,appState:o,className:s})=>{let[c]=vy(KD),[l,u]=vy(rk),d=()=>{let e=t.length?K(`alerts.removeItemsFromsLibrary`,{count:t.length}):K(`alerts.resetLibrary`);return(0,W.jsx)(oO,{onConfirm:()=>{t.length?r():i(),p(!1)},onCancel:()=>{p(!1)},title:t.length?K(`confirmDialog.removeItemsFromLib`):K(`confirmDialog.resetLibrary`),children:(0,W.jsx)(`p`,{children:e})})},[f,p]=(0,H.useState)(!1),m=!!t.length,h=m?c.libraryItems.filter(e=>t.includes(e.id)):c.libraryItems,g=K(m?`buttons.remove`:`buttons.resetLibrary`),[_,v]=(0,H.useState)(!1),[y,b]=(0,H.useState)(null),x=(0,H.useCallback)(()=>(0,W.jsxs)(dk,{onCloseRequest:()=>b(null),title:K(`publishSuccessDialog.title`),className:`publish-library-success`,size:`small`,children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`publishSuccessDialog.content`,authorName:y.authorName,link:e=>(0,W.jsx)(`a`,{href:y?.url,target:`_blank`,rel:`noopener noreferrer`,children:e})})}),(0,W.jsx)(X,{type:`button`,title:K(`buttons.close`),"aria-label":K(`buttons.close`),label:K(`buttons.close`),onClick:()=>b(null),"data-testid":`publish-library-success-close`,className:`publish-library-success-close`})]}),[b,y]),S=(e,r)=>{v(!1),b({url:e.url,authorName:e.authorName});let i=r.slice();i.forEach(e=>{t.includes(e.id)&&(e.status=`published`)}),n.setLibrary(i)},C=async()=>{try{await n.updateLibrary({libraryItems:Wo({description:`Excalidraw library files`}),merge:!0,openLibraryMenu:!0})}catch(t){if(t?.name===`AbortError`){console.warn(t);return}e({errorMessage:K(`errors.importLibraryError`)})}},w=async()=>{Hi(m?h:await n.getLatestLibrary()).catch(te).catch(t=>{e({errorMessage:t.message})})};return(0,W.jsxs)(`div`,{className:U(`library-menu-dropdown-container`,s),children:[(0,W.jsxs)(HO,{open:l,children:[(0,W.jsx)(HO.Trigger,{onToggle:()=>u(!l),children:Vy}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>u(!1),onSelect:()=>u(!1),className:`library-menu`,children:[!m&&(0,W.jsx)(HO.Item,{onSelect:C,icon:Ab,"data-testid":`lib-dropdown--load`,children:K(`buttons.load`)}),!!h.length&&(0,W.jsx)(HO.Item,{onSelect:w,icon:yb,"data-testid":`lib-dropdown--export`,children:K(`buttons.export`)}),m&&(0,W.jsx)(HO.Item,{icon:Xx,onSelect:()=>v(!0),"data-testid":`lib-dropdown--remove`,children:K(`buttons.publishLibrary`)}),!!h.length&&(0,W.jsx)(HO.Item,{onSelect:()=>p(!0),icon:pb,children:g})]})]}),t.length>0&&(0,W.jsx)(`div`,{className:`library-actions-counter`,children:t.length}),f&&d(),_&&(0,W.jsx)(gO,{onClose:()=>v(!1),libraryItems:UO(c.libraryItems,t),appState:o,onSuccess:e=>S(e,c.libraryItems),onError:e=>window.alert(e),updateItemsInStorage:()=>n.setLibrary(c.libraryItems),onRemove:e=>a(t.filter(t=>t!==e))}),y&&x()]})},GO=({selectedItems:e,onSelectItems:t,className:n})=>{let{library:r}=nz(),{clearLibraryCache:i,deleteItemsFromLibraryCache:a}=WD(),o=gC(),s=lz(),[c]=vy(KD),l=async n=>{let i=n.filter(t=>!e.includes(t.id));r.setLibrary(i).catch(()=>{s({errorMessage:K(`alerts.errorRemovingFromLibrary`)})}),a(e),t([])};return(0,W.jsx)(WO,{appState:o,setAppState:s,selectedItems:e,onSelectItems:t,library:r,onRemoveFromLibrary:()=>l(c.libraryItems),resetLibrary:()=>{r.resetLibrary(),i()},className:n})};function KO(){return[!1,(0,H.useCallback)(e=>e(),[])]}var qO=H.useTransition||KO,JO=(0,H.memo)(({id:e,elements:t,isPending:n,onClick:r,selected:i,onToggle:a,onDrag:o,svgCache:s})=>{let c=(0,H.useRef)(null),l=UD(e,t,s,c),[u,d]=(0,H.useState)(!1),f=iz().formFactor===`phone`,p=n&&(0,W.jsx)(`div`,{className:`library-unit__adder`,children:By});return(0,W.jsxs)(`div`,{className:U(`library-unit`,{"library-unit__active":t,"library-unit--hover":t&&u,"library-unit--selected":i,"library-unit--skeleton":!l}),onMouseEnter:()=>d(!0),onMouseLeave:()=>d(!1),children:[(0,W.jsx)(`div`,{className:U(`library-unit__dragger`,{"library-unit__pulse":!!n}),ref:c,draggable:!!t,onClick:t||n?t=>{e&&t.shiftKey?a(e,t):r(e)}:void 0,onDragStart:t=>{if(!e){t.preventDefault();return}d(!1),o(e,t)}}),p,e&&t&&(u||f||i)&&(0,W.jsx)(sT,{checked:i,onChange:(t,n)=>a(e,n),className:`library-unit__checkbox`})]})}),YO=()=>(0,W.jsx)(`div`,{className:`library-unit library-unit--skeleton`}),XO=({children:e})=>(0,W.jsx)(`div`,{className:`library-menu-items-container__grid`,children:e}),ZO=(0,H.memo)(({items:e,onItemSelectToggle:t,onItemDrag:n,isItemSelected:r,onClick:i,svgCache:a,itemsRenderedPerBatch:o})=>{let[,s]=qO(),[c,l]=(0,H.useState)(0);return(0,H.useEffect)(()=>{c<e.length&&s(()=>{l(c+o)})},[c,e.length,s,o]),(0,W.jsx)(W.Fragment,{children:e.map((e,o)=>o<c?(0,W.jsx)(JO,{elements:e?.elements,isPending:!e?.id&&!!e?.elements,onClick:i,svgCache:a,id:e?.id,selected:r(e.id),onToggle:t,onDrag:n},e?.id??o):(0,W.jsx)(YO,{},o))})}),QO=({type:e=`button`,onSelect:t,selected:n,children:r,className:i=``,...a})=>(0,W.jsx)(`button`,{onClick:ps(a.onClick,e=>{t()}),type:e,className:U(`excalidraw-button`,i,{selected:n}),...a,children:r}),$O=(0,H.forwardRef)(({onChange:e,label:t,fullWidth:n,placeholder:r,readonly:i,selectOnRender:a,onKeyDown:o,isRedacted:s=!1,icon:c,className:l,type:u,...d},f)=>{let p=(0,H.useRef)(null);(0,H.useImperativeHandle)(f,()=>p.current),(0,H.useLayoutEffect)(()=>{a&&(p.current?.focus(),p.current?.select())},[a]);let[m,h]=(0,H.useState)(!1);return(0,W.jsxs)(`div`,{className:U(`ExcTextField`,l,{"ExcTextField--fullWidth":n,"ExcTextField--hasIcon":!!c}),onClick:()=>{p.current?.focus()},children:[c,t&&(0,W.jsx)(`div`,{className:`ExcTextField__label`,children:t}),(0,W.jsxs)(`div`,{className:U(`ExcTextField__input`,{"ExcTextField__input--readonly":i}),children:[(0,W.jsx)(`input`,{className:U({"is-redacted":`value`in d&&d.value&&s&&!m}),readOnly:i,value:`value`in d?d.value:void 0,defaultValue:`defaultValue`in d?d.defaultValue:void 0,placeholder:r,ref:p,onChange:t=>e?.(t.target.value),onKeyDown:o,type:u}),s&&(0,W.jsx)(QO,{onSelect:()=>h(!m),style:{border:0,userSelect:`none`},children:m?hS:mS})]})]})}),ek=17,tk=64;function nk({isLoading:e,libraryItems:t,onAddToLibrary:n,onInsertLibraryItems:r,pendingElements:i,theme:a,id:o,libraryReturnUrl:s,onSelectItems:c,selectedItems:l}){let u=iz(),d=(0,H.useRef)(null),f=iO(d);(0,H.useEffect)(()=>{f>0&&d.current?.scrollTo(0,f)},[]);let{svgCache:p}=WD(),[m,h]=(0,H.useState)(null),[g,_]=(0,H.useState)(``),v=!t.length&&!i.length,y=!v&&!!g.trim(),b=(0,H.useMemo)(()=>{let e=LD(g.trim().toLowerCase());return e?t.filter(t=>{let n=t.name||``;return n.trim()&&LD(n.toLowerCase()).includes(e)}):[]},[t,g]),x=(0,H.useMemo)(()=>t.filter(e=>e.status!==`published`),[t]),S=(0,H.useMemo)(()=>t.filter(e=>e.status===`published`),[t]),C=(0,H.useCallback)((e,t)=>{let n=!l.includes(e),r=[...x,...S];if(n){if(t.shiftKey&&m){let t=r.findIndex(e=>e.id===m),n=r.findIndex(t=>t.id===e);if(t===-1||n===-1){c([...l,e]);return}let i=lr(l),a=Math.min(t,n),o=Math.max(t,n);c(r.reduce((e,t,n)=>((n>=a&&n<=o||i.has(t.id))&&e.push(t.id),e),[]))}else c([...l,e]);h(e)}else h(null),c(l.filter(t=>t!==e))},[m,c,S,l,x]);(0,H.useEffect)(()=>{l.length||h(null)},[l]);let w=(0,H.useCallback)(e=>{let n;return n=l.includes(e)?t.filter(e=>l.includes(e.id)):t.filter(t=>t.id===e),n.map(e=>({...e,elements:Er({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements}))},[t,l]),T=(0,H.useCallback)((e,t)=>{let n={itemIds:l.includes(e)?l:[e]};t.dataTransfer.setData(hs.excalidrawlibIds,JSON.stringify(n))},[l]),E=(0,H.useCallback)(e=>e?l.includes(e):!1,[l]),D=(0,H.useCallback)(()=>{n(i)},[i,n]),O=(0,H.useCallback)(e=>{e&&r(w(e))},[w,r]),k=p.size>=(b.length?b:t).length?tk:ek,A=(0,H.useRef)(null);(0,H.useEffect)(()=>{Tr(()=>{A.current?.focus()})},[]);let ee=!y&&(0,W.jsxs)(W.Fragment,{children:[!v&&(0,W.jsx)(`div`,{className:`library-menu-items-container__header`,children:K(`labels.personalLib`)}),!i.length&&!x.length?(0,W.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[!S.length&&(0,W.jsx)(`div`,{className:`library-menu-items__no-items__label`,children:K(`library.noItems`)}),(0,W.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:S.length>0?K(`library.hint_emptyPrivateLibrary`):K(`library.hint_emptyLibrary`)})]}):(0,W.jsxs)(XO,{children:[i.length>0&&(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:[{id:null,elements:i}],onItemSelectToggle:C,onItemDrag:T,onClick:D,isItemSelected:E,svgCache:p}),(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:x,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})]}),S.length>0&&(0,W.jsx)(`div`,{className:`library-menu-items-container__header`,style:{marginTop:`0.75rem`},children:K(`labels.excalidrawLib`)}),S.length>0&&(0,W.jsx)(XO,{children:(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:S,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})})]}),te=y&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`library-menu-items-container__header`,children:[K(`library.search.heading`),!e&&(0,W.jsxs)(`div`,{className:`library-menu-items-container__header__hint`,style:{cursor:`pointer`},onPointerDown:e=>e.preventDefault(),onClick:e=>{_(``)},children:[(0,W.jsx)(`kbd`,{children:`esc`}),` to clear`]})]}),b.length>0?(0,W.jsx)(XO,{children:(0,W.jsx)(ZO,{itemsRenderedPerBatch:k,items:b,onItemSelectToggle:C,onItemDrag:T,onClick:O,isItemSelected:E,svgCache:p})}):(0,W.jsxs)(`div`,{className:`library-menu-items__no-items`,children:[(0,W.jsx)(`div`,{className:`library-menu-items__no-items__hint`,children:K(`library.search.noResults`)}),(0,W.jsx)(QO,{onPointerDown:e=>e.preventDefault(),onSelect:()=>{_(``)},style:{width:`auto`,marginTop:`1rem`},children:K(`library.search.clearSearch`)})]})]});return(0,W.jsxs)(`div`,{className:`library-menu-items-container`,style:i.length||x.length||S.length?{justifyContent:`flex-start`}:{borderBottom:0},children:[(0,W.jsxs)(`div`,{className:`library-menu-items-header`,children:[!v&&(0,W.jsx)($O,{ref:A,type:`search`,className:U(`library-menu-items-container__search`,{hideCancelButton:u.formFactor!==`phone`}),placeholder:K(`library.search.inputPlaceholder`),value:g,onChange:e=>_(e)}),(0,W.jsx)(GO,{selectedItems:l,onSelectItems:c,className:`library-menu-dropdown-container--in-heading`})]}),(0,W.jsxs)(_O.Col,{className:`library-menu-items-container__items`,align:`start`,gap:1,style:{flex:S.length>0?1:`0 1 auto`,margin:v?`auto`:0},ref:d,children:[e&&(0,W.jsx)(`div`,{style:{position:`absolute`,top:`var(--container-padding-y)`,right:`var(--container-padding-x)`,transform:`translateY(50%)`},children:(0,W.jsx)($S,{})}),ee,te,v&&(0,W.jsx)(nO,{style:{padding:`16px 0`,width:`100%`},id:o,libraryReturnUrl:s,theme:a})]})]})}var rk=yc(!1),ik=({children:e})=>(0,W.jsx)(`div`,{className:`layer-ui__library`,children:e}),ak=(0,H.memo)(({onInsertLibraryItems:e,pendingElements:t,onAddToLibrary:n,setAppState:r,libraryReturnUrl:i,library:a,id:o,theme:s,selectedItems:c,onSelectItems:l})=>{let[u]=vy(KD),d=(0,H.useCallback)(e=>{(async(e,t)=>{dC(`element`,`addToLibrary`,`ui`);for(let t of Le)if(e.some(e=>e.type===t))return r({errorMessage:K(`errors.libraryElementTypeError.${t}`)});let i=[{status:`unpublished`,elements:e,id:Bi(),created:Date.now()},...t];n(),a.setLibrary(i).catch(()=>{r({errorMessage:K(`alerts.errorAddingToLibrary`)})})})(e,u.libraryItems)},[n,a,r,u.libraryItems]),f=(0,H.useMemo)(()=>u.libraryItems,[u]);if(u.status===`loading`&&!u.isInitialized)return(0,W.jsx)(ik,{children:(0,W.jsx)(`div`,{className:`layer-ui__library-message`,children:(0,W.jsxs)(`div`,{children:[(0,W.jsx)($S,{size:`2em`}),(0,W.jsx)(`span`,{children:K(`labels.libraryLoadingMessage`)})]})})});let p=u.libraryItems.length>0||t.length>0;return(0,W.jsxs)(ik,{children:[(0,W.jsx)(nk,{isLoading:u.status===`loading`,libraryItems:f,onAddToLibrary:d,onInsertLibraryItems:e,pendingElements:t,id:o,libraryReturnUrl:i,theme:s,onSelectItems:l,selectedItems:c}),p&&(0,W.jsx)(nO,{className:`library-menu-control-buttons--at-bottom`,style:{padding:`16px 12px 0 12px`},id:o,libraryReturnUrl:i,theme:s})]})}),ok=(e,t)=>({elements:e,pending:ir(e,{selectedElementIds:t},{includeBoundTextElement:!0,includeElementsInFrames:!0}),selectedElementIds:t}),sk=(e,t)=>{let n=sz(),[r,i]=(0,H.useState)(()=>ok(n,e.selectedElementIds)),a=(0,H.useRef)(new Map);return(0,H.useEffect)(()=>{for(let e of r.pending)a.current.set(e.id,e.version)},[r.pending]),(0,H.useEffect)(()=>{t.state.cursorButton===`up`&&t.state.activeTool.type===`selection`&&i(r=>{if(!ji(r.selectedElementIds,e.selectedElementIds))return a.current.clear(),ok(n,e.selectedElementIds);let i=t.scene.getNonDeletedElementsMap();for(let t of Object.keys(e.selectedElementIds)){let r=i.get(t)?.version;if(r&&r!==a.current.get(t))return ok(n,e.selectedElementIds)}return r})},[t,t.state.cursorButton,t.state.activeTool.type,e.selectedElementIds,n]),r.pending},ck=(0,H.memo)(()=>{let e=nz(),{onInsertElements:t}=e,n=rz(),r=gC(),i=lz(),[a,o]=(0,H.useState)([]),s=(0,H.useMemo)(()=>e.library,[e.library]),c=sk(r,e);return(0,H.useEffect)(()=>w(document,F.KEYDOWN,t=>{if(t.key===N.ESCAPE&&t.target instanceof HTMLElement){let n=t.target;if(n.closest(`.${Qn.SIDEBAR}`))a.length>0?(t.stopPropagation(),o([])):Wr(n)&&n instanceof HTMLInputElement&&!n.value&&(t.stopPropagation(),i({openSidebar:null}),e.focusContainer());else if(a.length>0){let{x:n,y:r}=e.lastViewportPosition;document.elementFromPoint(n,r)?.closest(`.${Qn.SIDEBAR}`)&&(t.stopPropagation(),o([]))}}},{capture:!0}),[a,i,e]),(0,W.jsx)(ak,{pendingElements:c,onInsertLibraryItems:(0,H.useCallback)(n=>{t(QD(n)),e.focusContainer()},[t,e]),onAddToLibrary:(0,H.useCallback)(()=>{i({selectedElementIds:{},selectedGroupIds:{},activeEmbeddable:null})},[i]),setAppState:i,libraryReturnUrl:n.libraryReturnUrl,library:s,id:e.id,theme:r.theme,selectedItems:a,onSelectItems:o})}),lk=e=>{let{closeOnClickOutside:t=!0}=e,n=_C({className:`excalidraw-modal-container`}),r=(0,H.useRef)(document.body.classList.contains(`excalidraw-animations-disabled`));if(!n)return null;let i=t=>{t.key===N.ESCAPE&&(t.nativeEvent.stopImmediatePropagation(),t.stopPropagation(),e.onCloseRequest())};return(0,_c.createPortal)((0,W.jsxs)(`div`,{className:U(`Modal`,e.className,{"animations-disabled":r.current}),role:`dialog`,"aria-modal":`true`,onKeyDown:i,"aria-labelledby":e.labelledBy,children:[(0,W.jsx)(`div`,{className:`Modal__background`,onClick:t?e.onCloseRequest:void 0}),(0,W.jsx)(`div`,{className:`Modal__content`,style:{"--max-width":`${e.maxWidth}px`},tabIndex:0,children:e.children})]}),n)};function uk(e){if(e&&typeof e==`number`)return e;switch(e){case`small`:return 550;case`wide`:return 1024;default:return 800}}var dk=e=>{let[t,n]=RD(),[r]=(0,H.useState)(document.activeElement),{id:i}=oz(),a=iz().formFactor===`phone`;(0,H.useEffect)(()=>{if(!t)return;let n=is(t);setTimeout(()=>{n.length>0&&e.autofocus!==!1&&(n[1]||n[0]).focus()});let r=e=>{if(e.key===N.TAB){let n=is(t),{activeElement:r}=document,i=n.findIndex(e=>e===r);i===0&&e.shiftKey?(n[n.length-1].focus(),e.preventDefault()):i===n.length-1&&!e.shiftKey&&(n[0].focus(),e.preventDefault())}};return t.addEventListener(`keydown`,r),()=>t.removeEventListener(`keydown`,r)},[t,e.autofocus]);let o=lz(),s=yy(rk),c=()=>{o({openMenu:null}),s(!1),r.focus(),e.onCloseRequest()};return(0,W.jsx)(lk,{className:U(`Dialog`,e.className,{"Dialog--fullscreen":a}),labelledBy:`dialog-title`,maxWidth:uk(e.size),onCloseRequest:c,closeOnClickOutside:e.closeOnClickOutside,children:(0,W.jsxs)(SC,{ref:n,children:[e.title&&(0,W.jsx)(`h2`,{id:`${i}-dialog-title`,className:`Dialog__title`,children:(0,W.jsx)(`span`,{className:`Dialog__titleContent`,children:e.title})}),a&&(0,W.jsx)(`button`,{className:`Dialog__close`,onClick:c,title:K(`buttons.close`),"aria-label":K(`buttons.close`),type:`button`,children:nx}),(0,W.jsx)(`div`,{className:`Dialog__content`,children:e.children})]})})},fk=[{icon:Zx,value:`hand`,key:N.H,numericKey:null,fillable:!1,toolbar:!0},{icon:Zy,value:`selection`,key:N.V,numericKey:N[1],fillable:!0,toolbar:!0},{icon:$y,value:`rectangle`,key:N.R,numericKey:N[2],fillable:!0,toolbar:!0},{icon:eb,value:`diamond`,key:N.D,numericKey:N[3],fillable:!0,toolbar:!0},{icon:tb,value:`ellipse`,key:N.O,numericKey:N[4],fillable:!0,toolbar:!0},{icon:nb,value:`arrow`,key:N.A,numericKey:N[5],fillable:!0,toolbar:!0},{icon:rb,value:`line`,key:N.L,numericKey:N[6],fillable:!0,toolbar:!0},{icon:ab,value:`freedraw`,key:[N.P,N.X],numericKey:N[7],fillable:!1,toolbar:!0},{icon:ob,value:`text`,key:N.T,numericKey:N[8],fillable:!1,toolbar:!0},{icon:cb,value:`image`,key:null,numericKey:N[9],fillable:!1,toolbar:!0},{icon:lb,value:`eraser`,key:N.E,numericKey:N[0],fillable:!1,toolbar:!0},{icon:dS,value:`laser`,key:N.K,numericKey:null,fillable:!1,toolbar:!1}],pk=e=>e.state.preferredSelectionTool.type===`lasso`?[{value:`lasso`,icon:Zy,key:N.V,numericKey:N[1],fillable:!0,toolbar:!0},...fk.slice(1)]:fk,mk=(e,t)=>pk(t).find((t,n)=>t.numericKey!=null&&e===t.numericKey.toString()||t.key&&(typeof t.key==`string`?t.key===e:t.key.includes(e)))?.value||null,hk=H.createContext(null),gk=()=>H.useContext(hk),_k=il(),vk=()=>H.useMemo(()=>({MainMenuTunnel:wv(),WelcomeScreenMenuHintTunnel:wv(),WelcomeScreenToolbarHintTunnel:wv(),WelcomeScreenHelpHintTunnel:wv(),WelcomeScreenCenterTunnel:wv(),FooterCenterTunnel:wv(),DefaultSidebarTriggerTunnel:wv(),DefaultSidebarTabTriggersTunnel:wv(),OverwriteConfirmDialogTunnel:wv(),TTDDialogTriggerTunnel:wv(),tunnelsJotai:_k}),[]),yk=Z({name:`viewMode`,label:`labels.viewMode`,icon:mS,viewMode:!0,trackEvent:{category:`canvas`,predicate:e=>!e.viewModeEnabled},perform(e,t){return{appState:{...t,viewModeEnabled:!this.checked(t)},captureUpdate:V.EVENTUALLY}},checked:e=>e.viewModeEnabled,predicate:(e,t,n)=>typeof n.viewModeEnabled>`u`,keyTest:e=>!e[N.CTRL_OR_CMD]&&e.altKey&&e.code===Gs.R}),bk=({app:e,options:t,activeTool:n,defaultOption:r,className:i=`Shape`,namePrefix:a,title:o,"data-testid":s,onToolChange:c,displayedOption:l,fillable:u=!1})=>{let[d,f]=(0,H.useState)(!1),p=n.type,m=l.type===p,{container:h}=oz();return!t.some(e=>e.type===p)&&d&&f(!1),(0,H.useEffect)(()=>{let t=e.onPointerDownEmitter.on(()=>{f(!1)});return()=>t?.()},[e]),(0,W.jsxs)(V_,{open:d,children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(X,{className:U(i,{fillable:u,active:t.some(e=>e.type===n.type)}),type:`radio`,icon:l.icon,checked:m,name:`editor-current-shape`,title:o,"aria-label":o,"data-testid":s,onPointerDown:()=>{f(e=>!e),c(r)}})}),(0,W.jsx)(W_,{className:`tool-popover-content`,sideOffset:26,collisionBoundary:h??void 0,children:t.map(({type:t,icon:n,title:r})=>(0,W.jsx)(X,{className:U(i,{active:p===t}),type:`radio`,icon:n,checked:p===t,name:`${a}-option`,title:r||Ge(t),keyBindingLabel:``,"aria-label":r||Ge(t),"data-testid":`toolbar-${t}`,onChange:()=>{e.state.activeTool.type!==t&&dC(`toolbar`,t,`ui`),e.setActiveTool({type:t}),c?.(t)}},t))})]})},xk=U([Qn.SHAPE_ACTIONS_THEME_SCOPE,`properties-content`]),Sk=(e,t)=>{let n=t[0]?.type||null;for(let e of t)if(e.type!==n){n=null;break}return ye(e.activeTool.type)&&n!==`image`&&n!==`frame`&&n!==`magicframe`||t.some(e=>ye(e.type))},Ck=(e,t)=>Ir(e.activeTool.type)||t.some(e=>Ir(e.type)),wk=({appState:e,elementsMap:t,renderAction:n,app:r})=>{let i=si(t,e),a=!1;i.length===2&&(xr(i[0])||xr(i[1]))&&(a=!0);let o=!!(e.editingTextElement||e.newElement),s=iz(),c=document.documentElement.getAttribute(`dir`)===`rtl`,l=Ir(e.activeTool.type)&&!Po(e.currentItemBackgroundColor)||i.some(e=>Ir(e.type)&&!Po(e.backgroundColor)),u=i.length===1||a,d=!e.selectedLinearElement?.isEditing&&i.length===1&&b(i[0])&&!dr(i[0]),f=!e.croppingElementId&&i.length===1&&io(i[0]),p=!a&&lE(e,r);return(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,W.jsx)(`div`,{children:Sk(e,i)&&n(`changeStrokeColor`)}),Ck(e,i)&&(0,W.jsx)(`div`,{children:n(`changeBackgroundColor`)}),l&&n(`changeFillStyle`),(bt(e.activeTool.type)||i.some(e=>bt(e.type)))&&n(`changeStrokeWidth`),(e.activeTool.type===`freedraw`||i.some(e=>e.type===`freedraw`))&&n(`changeStrokeShape`),(es(e.activeTool.type)||i.some(e=>es(e.type)))&&(0,W.jsxs)(W.Fragment,{children:[n(`changeStrokeStyle`),n(`changeSloppiness`)]}),(za(e.activeTool.type)||i.some(e=>za(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeRoundness`)}),(ko(e.activeTool.type)||i.some(e=>ko(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeArrowType`)}),(e.activeTool.type===`text`||i.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`fieldset`,{children:n(`changeFontFamily`)}),n(`changeFontSize`),(e.activeTool.type===`text`||Gn(i,t))&&n(`changeTextAlign`)]}),aa(i,t)&&n(`changeVerticalAlign`),(Ms(e.activeTool.type)||i.some(e=>Ms(e.type)))&&(0,W.jsx)(W.Fragment,{children:n(`changeArrowhead`)}),n(`changeOpacity`),(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.layers`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[n(`sendToBack`),n(`sendBackward`),n(`bringForward`),n(`bringToFront`)]})]}),p&&!a&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.align`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[c?(0,W.jsxs)(W.Fragment,{children:[n(`alignRight`),n(`alignHorizontallyCentered`),n(`alignLeft`)]}):(0,W.jsxs)(W.Fragment,{children:[n(`alignLeft`),n(`alignHorizontallyCentered`),n(`alignRight`)]}),i.length>2&&n(`distributeHorizontally`),(0,W.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`.5rem`,marginTop:`-0.5rem`},children:[n(`alignTop`),n(`alignVerticallyCentered`),n(`alignBottom`),i.length>2&&n(`distributeVertically`)]})]})]}),!o&&i.length>0&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.actions`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[s.formFactor!==`phone`&&n(`duplicateSelection`),s.formFactor!==`phone`&&n(`deleteSelectedElements`),n(`group`),n(`ungroup`),u&&n(`hyperlink`),f&&n(`cropEditor`),d&&n(`toggleLinearEditor`)]})]})]})},Tk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i})=>{let a=Ir(e.activeTool.type)&&!Po(e.currentItemBackgroundColor)||r.some(e=>Ir(e.type)&&!Po(e.backgroundColor)),o=r.length>0||e.activeTool.type!==`selection`&&e.activeTool.type!==`eraser`&&e.activeTool.type!==`hand`&&e.activeTool.type!==`laser`&&e.activeTool.type!==`lasso`,s=e.openPopup===`compactStrokeStyles`;return o?(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactStrokeStyles`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:K(`labels.stroke`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactStrokeStyles`})},children:KS})}),s&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`13rem`},onClose:()=>{},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[a&&t(`changeFillStyle`),(bt(e.activeTool.type)||r.some(e=>bt(e.type)))&&t(`changeStrokeWidth`),(es(e.activeTool.type)||r.some(e=>es(e.type)))&&(0,W.jsxs)(W.Fragment,{children:[t(`changeStrokeStyle`),t(`changeSloppiness`)]}),(za(e.activeTool.type)||r.some(e=>za(e.type)))&&t(`changeRoundness`),t(`changeOpacity`)]})})]})}):null},Ek=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,app:a})=>{let o=ko(e.activeTool.type)||r.some(e=>ko(e.type)),s=e.openPopup===`compactArrowProperties`;return o?(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:s,onOpenChange:e=>{n(e?{openPopup:`compactArrowProperties`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:s}),title:K(`labels.arrowtypes`),onClick:e=>{e.preventDefault(),e.stopPropagation(),n({openPopup:s?null:`compactArrowProperties`})},children:(()=>{let t=kw(r,a,e=>jt(e)?e.elbowed?`elbow`:e.roundness?`round`:`sharp`:null,e=>jt(e),t=>t?null:e.currentItemArrowType);return t===`elbow`?zS:t===`round`?BS:RS})()})}),s&&(0,W.jsx)(CC,{container:i,className:`properties-content`,style:{maxWidth:`13rem`},onClose:()=>{},children:t(`changeArrowProperties`)})]})}):null},Dk=({appState:e,renderAction:t,setAppState:n,targetElements:r,container:i,elementsMap:a})=>{let{saveCaretPosition:o,restoreCaretPosition:s}=OC(),c=e.openPopup===`compactTextProperties`;return(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:c,onOpenChange:t=>{t?(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`})):(n({openPopup:null}),e.editingTextElement&&s())},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:c}),title:K(`labels.textAlign`),onClick:t=>{t.preventDefault(),t.stopPropagation(),c?n({openPopup:null}):(e.editingTextElement&&o(),n({openPopup:`compactTextProperties`}))},children:sb})}),e.openPopup===`compactTextProperties`&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`13rem`},preventAutoFocusOnTouch:!!e.editingTextElement,onClose:()=>{e.editingTextElement&&s()},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(e.activeTool.type===`text`||r.some(M))&&t(`changeFontSize`),(e.activeTool.type===`text`||Gn(r,a))&&t(`changeTextAlign`),aa(r,a)&&t(`changeVerticalAlign`)]})})]})})},Ok=({appState:e,renderAction:t,targetElements:n,setAppState:r,container:i,app:a,showDuplicate:o,showDelete:s})=>{let c=!!(e.editingTextElement||e.newElement),l=!e.croppingElementId&&n.length===1&&io(n[0]),u=n.length===1,d=lE(e,a),f=!1;n.length===2&&(xr(n[0])||xr(n[1]))&&(f=!0);let p=document.documentElement.getAttribute(`dir`)===`rtl`,m=e.openPopup===`compactOtherProperties`;return c||n.length===0?null:(0,W.jsx)(`div`,{className:`compact-action-item`,children:(0,W.jsxs)(V_,{open:m,onOpenChange:e=>{r(e?{openPopup:`compactOtherProperties`}:{openPopup:null})},children:[(0,W.jsx)(H_,{asChild:!0,children:(0,W.jsx)(`button`,{type:`button`,className:U(`compact-action-button properties-trigger`,{active:m}),title:K(`labels.actions`),onClick:e=>{e.preventDefault(),e.stopPropagation(),r({openPopup:m?null:`compactOtherProperties`})},children:Hy})}),m&&(0,W.jsx)(CC,{className:xk,container:i,style:{maxWidth:`12rem`,justifyContent:`center`,alignItems:`center`},onClose:()=>{},children:(0,W.jsxs)(`div`,{className:`selected-shape-actions`,children:[(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.layers`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[t(`sendToBack`),t(`sendBackward`),t(`bringForward`),t(`bringToFront`)]})]}),d&&!f&&(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.align`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[p?(0,W.jsxs)(W.Fragment,{children:[t(`alignRight`),t(`alignHorizontallyCentered`),t(`alignLeft`)]}):(0,W.jsxs)(W.Fragment,{children:[t(`alignLeft`),t(`alignHorizontallyCentered`),t(`alignRight`)]}),n.length>2&&t(`distributeHorizontally`),(0,W.jsx)(`div`,{style:{flexBasis:`100%`,height:0}}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexWrap:`wrap`,gap:`.5rem`,marginTop:`-0.5rem`},children:[t(`alignTop`),t(`alignVerticallyCentered`),t(`alignBottom`),n.length>2&&t(`distributeVertically`)]})]})]}),(0,W.jsxs)(`fieldset`,{children:[(0,W.jsx)(`legend`,{children:K(`labels.actions`)}),(0,W.jsxs)(`div`,{className:`buttonList`,children:[t(`group`),t(`ungroup`),u&&t(`hyperlink`),l&&t(`cropEditor`),o&&t(`duplicateSelection`),s&&t(`deleteSelectedElements`)]})]})]})})]})})},kk=({appState:e,renderAction:t,targetElements:n})=>!e.selectedLinearElement?.isEditing&&n.length===1&&b(n[0])&&!dr(n[0])?(0,W.jsx)(`div`,{className:`compact-action-item`,children:t(`toggleLinearEditor`)}):null,Ak=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=si(t,e),{container:o}=oz(),s=!!(e.editingTextElement||e.newElement),c=!e.selectedLinearElement?.isEditing&&a.length===1&&b(a[0])&&!dr(a[0]);return(0,W.jsxs)(`div`,{className:`compact-shape-actions`,children:[Sk(e,a)&&(0,W.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),Ck(e,a)&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,W.jsx)(Tk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,W.jsx)(Ek,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),c&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`toggleLinearEditor`)}),(e.activeTool.type===`text`||a.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,W.jsx)(Dk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),!s&&a.length>0&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),!s&&a.length>0&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)}),(0,W.jsx)(Ok,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r})]})},jk=({appState:e,elementsMap:t,renderAction:n,app:r,setAppState:i})=>{let a=si(t,e),{container:o}=oz(),s=(0,H.useRef)(null),c=s.current?.getBoundingClientRect()?.width??0,l=c>=374,u=c>=412;return(0,W.jsxs)(SC,{className:`compact-shape-actions mobile-shape-actions`,style:{flexDirection:`row`,boxShadow:`none`,padding:0,zIndex:2,backgroundColor:`transparent`,height:32*1.35,marginBottom:4,alignItems:`center`,gap:6,pointerEvents:`none`},ref:s,children:[(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6,flex:1},children:[Sk(e,a)&&(0,W.jsx)(`div`,{className:U(`compact-action-item`),children:n(`changeStrokeColor`)}),Ck(e,a)&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeBackgroundColor`)}),(0,W.jsx)(Tk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o}),(0,W.jsx)(Ek,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,app:r}),(0,W.jsx)(kk,{appState:e,renderAction:n,targetElements:a}),(e.activeTool.type===`text`||a.some(M))&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`changeFontFamily`)}),(0,W.jsx)(Dk,{appState:e,renderAction:n,setAppState:i,targetElements:a,container:o,elementsMap:t})]}),(0,W.jsx)(Ok,{appState:e,renderAction:n,targetElements:a,setAppState:i,container:o,app:r,showDuplicate:!u,showDelete:!l})]}),(0,W.jsxs)(`div`,{style:{display:`flex`,flexDirection:`row`,gap:6},children:[(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`undo`)}),(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`redo`)}),u&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`duplicateSelection`)}),l&&(0,W.jsx)(`div`,{className:`compact-action-item`,children:n(`deleteSelectedElements`)})]})]})},Mk=({activeTool:e,setAppState:t,app:n,UIOptions:r})=>{let[i,a]=(0,H.useState)(!1),o=az(),s=o===`full`,c=o===`compact`,l=[{type:`selection`,icon:Zy,title:Ge(K(`toolBar.selection`))},{type:`lasso`,icon:Qy,title:Ge(K(`toolBar.lasso`))}],u=e.type===`frame`,d=e.type===`laser`,f=s&&e.type===`lasso`&&n.state.preferredSelectionTool.type!==`lasso`,p=e.type===`embeddable`,{TTDDialogTriggerTunnel:m}=gk();return(0,W.jsxs)(W.Fragment,{children:[pk(n).map(({value:i,icon:a,key:o,numericKey:s,fillable:u,toolbar:d})=>{if(d===!1||r.tools?.[i]===!1)return null;let f=K(`toolBar.${i}`),p=o&&Ge(typeof o==`string`?o:o[0]),m=p?`${p} ${K(`helpDialog.or`)} ${s}`:`${s}`,h=i===`hand`?void 0:s||p;return(i===`selection`||i===`lasso`)&&c?(0,W.jsx)(bk,{app:n,options:l,activeTool:e,defaultOption:n.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Ge(K(`toolBar.selection`)),"data-testid":`toolbar-selection`,onToolChange:e=>{(e===`selection`||e===`lasso`)&&(n.setActiveTool({type:e}),t({preferredSelectionTool:{type:e,initialized:!0}}))},displayedOption:l.find(e=>e.type===n.state.preferredSelectionTool.type)||l[0],fillable:e.type===`selection`},`selection-popover`):(0,W.jsx)(X,{className:U(`Shape`,{fillable:u}),type:`radio`,icon:a,checked:e.type===i,name:`editor-current-shape`,title:`${Ge(f)} \u2014 ${m}`,keyBindingLabel:h,"aria-label":Ge(f),"aria-keyshortcuts":m,"data-testid":`toolbar-${i}`,onPointerDown:({pointerType:e})=>{!n.state.penDetected&&e===`pen`&&n.togglePenMode(!0),i===`selection`&&(n.state.activeTool.type===`selection`?n.setActiveTool({type:`lasso`}):n.setActiveTool({type:`selection`}))},onChange:({pointerType:e})=>{n.state.activeTool.type!==i&&dC(`toolbar`,i,`ui`),n.setActiveTool({type:i})}},i)}),(0,W.jsx)(`div`,{className:`App-toolbar__divider`}),(0,W.jsxs)(HO,{open:i,children:[(0,W.jsx)(HO.Trigger,{className:U(`App-toolbar__extra-tools-trigger`,{"App-toolbar__extra-tools-trigger--selected":u||p||f||d&&!n.props.isCollaborating}),onToggle:()=>{a(!i),t({openMenu:null,openPopup:null})},title:K(`toolBar.extraTools`),children:u?oS:p?mb:d&&!n.props.isCollaborating?dS:f?Qy:aS}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,children:[(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`frame`}),icon:oS,shortcut:N.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:K(`toolBar.frame`)}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`embeddable`}),icon:mb,"data-testid":`toolbar-embeddable`,selected:p,children:K(`toolBar.embeddable`)}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`laser`}),icon:dS,"data-testid":`toolbar-laser`,selected:d,shortcut:N.K.toLocaleUpperCase(),children:K(`toolBar.laser`)}),s&&(0,W.jsx)(HO.Item,{onSelect:()=>n.setActiveTool({type:`lasso`}),icon:Qy,"data-testid":`toolbar-lasso`,selected:f,children:K(`toolBar.lasso`)}),(0,W.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),n.props.aiEnabled!==!1&&(0,W.jsx)(m.Out,{}),(0,W.jsx)(HO.Item,{onSelect:()=>n.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:sS,"data-testid":`toolbar-embeddable`,children:K(`toolBar.mermaidToExcalidraw`)}),n.props.aiEnabled!==!1&&n.plugins.diagramToCode&&(0,W.jsx)(HO.Item,{onSelect:()=>n.onMagicframeToolSelect(),icon:fS,"data-testid":`toolbar-magicframe`,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:K(`toolBar.magicframe`)})]})]})]})},Nk=({renderAction:e,zoom:t})=>(0,W.jsx)(_O.Col,{gap:1,className:Qn.ZOOM_ACTIONS,children:(0,W.jsxs)(_O.Row,{align:`center`,children:[e(`zoomOut`),e(`resetZoom`),e(`zoomIn`)]})}),Pk=({renderAction:e,className:t})=>(0,W.jsxs)(`div`,{className:`undo-redo-buttons ${t}`,children:[(0,W.jsx)(`div`,{className:`undo-button-container`,children:(0,W.jsx)(Rw,{label:K(`buttons.undo`),children:e(`undo`)})}),(0,W.jsx)(`div`,{className:`redo-button-container`,children:(0,W.jsxs)(Rw,{label:K(`buttons.redo`),children:[` `,e(`redo`)]})})]}),Fk=({actionManager:e,showExitZenModeBtn:t})=>(0,W.jsx)(`button`,{type:`button`,className:U(`disable-zen-mode`,{"disable-zen-mode--visible":t}),onClick:()=>e.executeAction(wE),children:K(`buttons.exitZenMode`)}),Ik=({actionManager:e})=>(0,W.jsx)(`button`,{type:`button`,className:`disable-view-mode`,onClick:()=>e.executeAction(yk),children:JS}),Lk=e=>{let t=(0,H.useRef)({userFn:e});return t.current.userFn=e,t.current.stableFn||(t.current.stableFn=(...e)=>t.current.userFn(...e)),t.current.stableFn},Rk=yc(null),zk=()=>{let[e,t]=vy(Rk),n=uz();return e&&e===`clearCanvas`?(0,W.jsx)(oO,{onConfirm:()=>{n.executeAction(Zw),t(null)},onCancel:()=>t(null),title:K(`clearCanvasDialog.title`),children:(0,W.jsxs)(`p`,{className:`clear-canvas__content`,children:[` `,K(`alerts.clearReset`)]})}):null},Bk={};o(Bk,{toggleTheme:()=>Vk});var Vk={...iT,category:`App`,label:`Toggle theme`,perform:({actionManager:e})=>{e.executeAction(iT,`commandPalette`)}},Hk=yc(null),Uk={app:`App`,export:`Export`,tools:`Tools`,editor:`Editor`,elements:`Elements`,links:`Links`,library:`Library`},Wk=e=>{switch(e){case Uk.app:return 1;case Uk.export:return 2;case Uk.editor:return 3;case Uk.tools:return 4;case Uk.elements:return 5;case Uk.links:return 6;default:return 10}},Gk=({shortcut:e,className:t,children:n})=>{let r=e.replace(`++`,`+$`).split(`+`);return(0,W.jsxs)(`div`,{className:U(`shortcut`,t),children:[r.map((e,t)=>(0,W.jsx)(`div`,{className:`shortcut-wrapper`,children:(0,W.jsx)(`div`,{className:`shortcut-key`,children:e===`$`?`+`:e})},e)),(0,W.jsx)(`div`,{className:`shortcut-desc`,children:n})]})},Kk=e=>!e.altKey&&e[N.CTRL_OR_CMD]&&(e.shiftKey&&e.key.toLowerCase()===N.P||e.key===N.SLASH);Object.assign(e=>{let t=gC(),n=lz();return(0,H.useEffect)(()=>{let e=e=>{Kk(e)&&(e.preventDefault(),e.stopPropagation(),n(e=>{let t=e.openDialog?.name===`commandPalette`?null:{name:`commandPalette`};return t&&dC(`command_palette`,`open`,`shortcut`),{openDialog:t}}))};return window.addEventListener(F.KEYDOWN,e,{capture:!0}),()=>window.removeEventListener(F.KEYDOWN,e,{capture:!0})},[n]),t.openDialog?.name===`commandPalette`?(0,W.jsx)(qk,{...e}):null},{defaultItems:Bk});function qk({customCommandPaletteItems:e}){let t=nz(),n=gC(),r=lz(),i=rz(),a=uz(),[o,s]=vy(Hk),[c,l]=(0,H.useState)(null),u=(0,H.useRef)(null),d=yC({uiAppState:n,customCommandPaletteItems:e,appProps:i}),[f]=vy(KD),p=(0,H.useMemo)(()=>f.libraryItems?.filter(e=>!!e.name).map(e=>({label:e.name,icon:(0,W.jsx)(Jk,{id:e.id,elements:e.elements}),category:`Library`,order:Wk(`Library`),haystack:LD(e.name),perform:()=>{t.onInsertElements(QD([e]))}}))||[],[t,f.libraryItems]);(0,H.useEffect)(()=>{let{uiAppState:e,customCommandPaletteItems:n,appProps:i}=d,c=n=>{let r=``;return n.label&&(r=typeof n.label==`function`?K(n.label(t.scene.getNonDeletedElements(),e,t)):K(n.label)),r},u=n=>typeof n.icon==`function`?n.icon(e,t.scene.getNonDeletedElements()):n.icon,f=[],m=(e,t,n)=>{let r={label:c(e),icon:u(e),category:t,shortcut:ND(e.name),keywords:e.keywords,predicate:e.predicate,viewMode:e.viewMode,perform:()=>{a.executeAction(e,`commandPalette`)}};return n?n(r,e):r};if(e&&t.scene&&a){let d=[a.actions.group,a.actions.ungroup,a.actions.cut,a.actions.copy,a.actions.deleteSelectedElements,a.actions.wrapSelectionInFrame,a.actions.copyStyles,a.actions.pasteStyles,a.actions.bringToFront,a.actions.bringForward,a.actions.sendBackward,a.actions.sendToBack,a.actions.alignTop,a.actions.alignBottom,a.actions.alignLeft,a.actions.alignRight,a.actions.alignVerticallyCentered,a.actions.alignHorizontallyCentered,a.actions.duplicateSelection,a.actions.flipHorizontal,a.actions.flipVertical,a.actions.zoomToFitSelection,a.actions.zoomToFitSelectionInViewport,a.actions.increaseFontSize,a.actions.decreaseFontSize,a.actions.toggleLinearEditor,a.actions.cropEditor,a.actions.togglePolygon,YE,AD,jD].map(e=>m(e,Uk.elements,(e,t)=>({...e,predicate:t.predicate?t.predicate:(e,t,n,r)=>ir(e,t).length>0}))),h=[a.actions.toggleHandTool,a.actions.setFrameAsActiveTool,a.actions.toggleLassoTool].map(e=>m(e,Uk.tools)),g=[a.actions.undo,a.actions.redo,a.actions.zoomIn,a.actions.zoomOut,a.actions.resetZoom,a.actions.zoomToFit,a.actions.zenMode,a.actions.viewMode,a.actions.gridMode,a.actions.objectsSnapMode,a.actions.toggleShortcuts,a.actions.selectAll,a.actions.toggleElementLock,a.actions.unlockAllElements,a.actions.stats].map(e=>m(e,Uk.editor)),_=[a.actions.saveToActiveFile,a.actions.saveFileToDisk,a.actions.copyAsPng,a.actions.copyAsSvg].map(e=>m(e,Uk.export));f=[...d,...g,{label:c(Zw),icon:u(Zw),shortcut:ND(Zw.name),category:Uk.editor,keywords:[`delete`,`destroy`],viewMode:!1,perform:()=>{Cy.set(Rk,`clearCanvas`)}},{label:K(`buttons.exportImage`),category:Uk.export,icon:Nb,shortcut:ND(`imageExport`),keywords:[`export`,`image`,`png`,`jpeg`,`svg`,`clipboard`,`picture`],perform:()=>{r({openDialog:{name:`imageExport`}})}},..._];let v=[{label:K(`toolBar.library`),category:Uk.app,icon:zy,viewMode:!1,perform:()=>{e.openSidebar?r({openSidebar:null}):r({openSidebar:{name:At.name,tab:At.defaultTab}})}},{label:K(`search.title`),category:Uk.app,icon:vS,viewMode:!0,perform:()=>{a.executeAction(ZA)}},{label:K(`labels.shapeSwitch`),category:Uk.elements,icon:CS,perform:()=>{a.executeAction(kD)}},{label:K(`labels.changeStroke`),keywords:[`color`,`outline`],category:Uk.elements,icon:jb,viewMode:!1,predicate:(e,t)=>{let n=ir(e,t);return n.length>0&&Sk(t,n)},perform:()=>{r(e=>({openPopup:`elementStroke`}))}},{label:K(`labels.changeBackground`),keywords:[`color`,`fill`],icon:jb,category:Uk.elements,viewMode:!1,predicate:(e,t)=>{let n=ir(e,t);return n.length>0&&Ck(t,n)},perform:()=>{r(e=>({openPopup:`elementBackground`}))}},{label:K(`labels.canvasBackground`),keywords:[`color`],icon:jb,category:Uk.editor,viewMode:!1,perform:()=>{r(e=>({openMenu:e.openMenu===`canvas`?null:`canvas`,openPopup:`canvasBackground`}))}},...fk.reduce((e,n)=>{let{value:r,icon:a,key:o,numericKey:s}=n;if(i.UIOptions.tools?.[r]===!1)return e;let c=o&&Ge(typeof o==`string`?o:o[0])||s,l={label:K(`toolBar.${r}`),category:Uk.tools,shortcut:c,icon:a,keywords:[`toolbar`],viewMode:!1,perform:({event:e})=>{t.setActiveTool({type:r})}};return e.push(l),e},[]),...h,{label:K(`toolBar.lock`),category:Uk.tools,icon:e.activeTool.locked?Ky:Gy,shortcut:N.Q.toLocaleUpperCase(),viewMode:!1,perform:()=>{t.toggleLock()}},{label:`${K(`labels.textToDiagram`)}...`,category:Uk.tools,icon:_S,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`text-to-diagram`}}))}},{label:`${K(`toolBar.mermaidToExcalidraw`)}...`,category:Uk.tools,icon:sS,viewMode:!1,predicate:i.aiEnabled,perform:()=>{r(e=>({...e,openDialog:{name:`ttd`,tab:`mermaid`}}))}}],y=[...f,...v,...n||[]].map(e=>({...e,icon:e.icon||CS,order:e.order??Wk(e.category),haystack:`${LD(e.label.toLocaleLowerCase())} ${e.keywords?.join(` `)||``}`}));l(y),s([...y,...p].find(e=>e.label===o?.label)??null)}},[d,t,a,l,o?.label,s,r,p]);let[m,h]=(0,H.useState)(``),[g,_]=(0,H.useState)(null),[v,y]=(0,H.useState)({}),b=e=>{r({openDialog:null},e),h(``)},x=(e,t)=>{n.openDialog?.name===`commandPalette`&&(t.stopPropagation(),t.preventDefault(),document.body.classList.add(`excalidraw-animations-disabled`),b(()=>{e.perform({actionManager:a,event:t}),s(e),requestAnimationFrame(()=>{document.body.classList.remove(`excalidraw-animations-disabled`)})}))},S=Lk(e=>e.viewMode===!1&&n.viewModeEnabled?!1:typeof e.predicate==`function`?e.predicate(t.scene.getNonDeletedElements(),n,i,t):e.predicate===void 0||e.predicate),C=Lk(e=>{let t=Wr(e.target)||Kk(e)||e.key===N.ESCAPE;if(t&&e.key!==N.ARROW_UP&&e.key!==N.ARROW_DOWN&&e.key!==N.ENTER)return;let n=Object.values(v).flat(),r=o&&!m&&S(o);if(e.key===N.ARROW_UP){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(t===0){_(o);return}if(g===o){let e=n[n.length-1];e&&_(e);return}}let i;i=t===-1||t===0?n.length-1:(t-1)%n.length;let a=n[i];a&&_(a);return}if(e.key===N.ARROW_DOWN){e.preventDefault();let t=n.findIndex(e=>e.label===g?.label);if(r){if(!g||t===n.length-1){_(o);return}if(g===o){let e=n[0];e&&_(e);return}}let i=n[(t+1)%n.length];i&&_(i);return}if(e.key===N.ENTER&&g&&setTimeout(()=>{x(g,e)}),!t){if(e.stopPropagation(),/^[a-zA-Z0-9]$/.test(e.key)){u?.current?.focus();return}e.preventDefault()}});return(0,H.useEffect)(()=>(window.addEventListener(F.KEYDOWN,C,{capture:!0}),()=>window.removeEventListener(F.KEYDOWN,C,{capture:!0})),[C]),(0,H.useEffect)(()=>{if(!c)return;let e=e=>{let t={};for(let n of e)t[n.category]?t[n.category].push(n):t[n.category]=[n];return t},t=m?.length>1?[...c.filter(S).sort((e,t)=>e.order-t.order),...p]:c.filter(S).sort((e,t)=>e.order-t.order),n=!m&&o&&S(o);if(!m){y(e(n?t.filter(e=>e.label!==o?.label):t)),_(n?o:t[0]||null);return}let r=LD(m.toLocaleLowerCase().replace(/[<>_| -]/g,``));t=dv.default.filter(r,t,{extract:e=>e.haystack??``}).sort((e,t)=>t.score-e.score).map(e=>e.original),y(e(t)),_(t[0]??null)},[m,c,S,o,p]),(0,W.jsxs)(dk,{onCloseRequest:()=>b(),closeOnClickOutside:!0,title:!1,size:720,autofocus:!0,className:`command-palette-dialog`,children:[(0,W.jsx)($O,{value:m,placeholder:K(`commandPalette.search.placeholder`),onChange:e=>{h(e)},selectOnRender:!0,ref:u}),t.editorInterface.formFactor!==`phone`&&(0,W.jsxs)(`div`,{className:`shortcuts-wrapper`,children:[(0,W.jsx)(Gk,{shortcut:`↑↓`,children:K(`commandPalette.shortcuts.select`)}),(0,W.jsx)(Gk,{shortcut:`↵`,children:K(`commandPalette.shortcuts.confirm`)}),(0,W.jsx)(Gk,{shortcut:Q(`Esc`),children:K(`commandPalette.shortcuts.close`)})]}),(0,W.jsxs)(`div`,{className:`commands`,children:[o&&!m&&(0,W.jsxs)(`div`,{className:`command-category`,children:[(0,W.jsxs)(`div`,{className:`command-category-title`,children:[K(`commandPalette.recents`),(0,W.jsx)(`div`,{className:`icon`,style:{marginLeft:`6px`},children:yS})]}),(0,W.jsx)(Yk,{command:o,isSelected:o.label===g?.label,onClick:e=>x(o,e),disabled:!S(o),onMouseMove:()=>_(o),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n})]}),Object.keys(v).length>0?Object.keys(v).map((e,r)=>(0,W.jsxs)(`div`,{className:`command-category`,children:[(0,W.jsx)(`div`,{className:`command-category-title`,children:e}),v[e].map(r=>(0,W.jsx)(Yk,{command:r,isSelected:r.label===g?.label,onClick:e=>x(r,e),onMouseMove:()=>_(r),showShortcut:t.editorInterface.formFactor!==`phone`,appState:n,size:e===`Library`?`large`:`small`},r.label))]},e)):c?(0,W.jsxs)(`div`,{className:`no-match`,children:[(0,W.jsx)(`div`,{className:`icon`,children:vS}),` `,K(`commandPalette.search.noMatch`)]}):null]})]})}var Jk=({id:e,elements:t})=>{let n=(0,H.useRef)(null),{svgCache:r}=WD();return UD(e,t,r,n),(0,W.jsx)(`div`,{className:`library-item-icon`,ref:n})},Yk=({command:e,isSelected:t,disabled:n,onMouseMove:r,onClick:i,showShortcut:a,appState:o,size:s=`small`})=>{let c=()=>{};return(0,W.jsxs)(`div`,{className:U(`command-item`,{"item-selected":t,"item-disabled":n,"command-item-large":s===`large`}),ref:e=>{t&&!n&&e?.scrollIntoView?.({block:`nearest`})},onClick:n?c:i,onMouseMove:n?c:r,title:n?K(`commandPalette.itemNotAvailable`):``,children:[(0,W.jsxs)(`div`,{className:`name`,children:[e.icon&&(0,W.jsx)(mw,{className:`icon`,size:`var(--icon-size, 1rem)`,icon:typeof e.icon==`function`?e.icon(o,[]):e.icon}),(0,W.jsx)(nw,{children:e.label})]}),a&&e.shortcut&&(0,W.jsx)(Gk,{shortcut:e.shortcut})]})},Xk=e=>{if(!e)return[];for(let t of e.sets)if(t.type===`path`)return t.ops;return e.sets[0].ops},Zk=e=>!!e&&e.type===`embeddable`,Qk=e=>!!e&&e.type===`iframe`,$k=e=>!!e&&(e.type===`iframe`||e.type===`embeddable`),eA=e=>e!=null&&e.type===`text`,tA=e=>e!=null&&(e.type===`frame`||e.type===`magicframe`),nA=e=>e!=null&&aA(e.type),rA=e=>e!=null&&e.type===`arrow`,iA=e=>rA(e)&&e.elbowed,aA=e=>e===`arrow`||e===`line`,oA=e=>e!==null&&`containerId`in e&&e.containerId!==null&&eA(e),sA=(e,t=1)=>{if(e.length>=3){let[n,r]=[e[0],e[e.length-1]];return Se(n,r)<=8/t}return!1},cA=(e,t)=>{if(t.roundness?.type===Xa.PROPORTIONAL_RADIUS||t.roundness?.type===Xa.LEGACY)return e*qt;if(t.roundness?.type===Xa.ADAPTIVE_RADIUS){let n=t.roundness?.value??32;return e<=n/.25?e*qt:n}return 0};`ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789`.toLocaleUpperCase();var lA=[1,0],uA=[0,1],dA=[-1,0],fA=[0,-1],pA=e=>{let[t,n]=e,r=Math.abs(t),i=Math.abs(n);return t>i?lA:t<=-i?dA:n>r?uA:fA},mA=(e,t)=>pA(Mn(e,t)),hA=(e,t)=>_A(mA(e,t)),gA=(e,t)=>e[0]===t[0]&&e[1]===t[1],_A=e=>gA(e,lA)||gA(e,dA),vA=e=>{let t=Math.floor(e.width/2)+1,n=e.width,r=Math.floor(e.height/2)+1;return[t,0,n,r,t,e.height,0,r]},yA=20,bA=15,xA=e=>{switch(e){case`arrow`:return 25;case`diamond`:case`diamond_outline`:return 12;case`cardinality_many`:case`cardinality_one_or_many`:case`cardinality_zero_or_many`:return bA;case`cardinality_one`:case`cardinality_exactly_one`:case`cardinality_zero_or_one`:return yA;default:return 15}},SA=e=>{switch(e){case`bar`:return 90;case`arrow`:return 20;default:return 25}},CA=(e,t,n,r,i=0)=>{if(r===null||t.length<1)return null;let a=Xk(t[0]);if(a.length<1)return null;let o=n===`start`?1:a.length-1,s=a[o].data;gt(s.length===6,`Op data length is not 6`);let c=O(s[4],s[5]),l=O(s[2],s[3]),u=O(s[0],s[1]),d=a[o-1],f=O(0,0);if(d.op===`move`){let e=Vn(d.data);gt(e!=null,`Op data is not a point`),f=e}else d.op===`bcurveTo`&&(f=O(d.data[4],d.data[5]));let p=(e,t)=>(1-e)**3*c[t]+3*e*(1-e)**2*l[t]+3*e**2*(1-e)*u[t]+f[t]*e**3,[m,h]=n===`start`?f:c,[g,_]=[p(.3,0),p(.3,1)],v=Math.hypot(m-g,h-_),y=(m-g)/v,b=(h-_)/v,x=xA(r),S=0;{let[t,r]=n===`end`?e.points[e.points.length-1]:e.points[0],[i,a]=e.points.length>1?n===`end`?e.points[e.points.length-2]:e.points[1]:[0,0];S=Math.hypot(t-i,r-a)}let C=Math.min(x,S*(r===`diamond`||r===`diamond_outline`?.25:.5)),w=m-y*C*i,T=h-b*C*i,E=w-y*C,D=T-b*C;if(r===`circle`||r===`circle_outline`)return[w,T,Math.hypot(D-T,E-w)+e.strokeWidth-2];let k=SA(r);if(r===`cardinality_many`||r===`cardinality_one_or_many`){let[e,t]=ke(O(w,T),O(E,D),Pt(-k)),[n,r]=ke(O(w,T),O(E,D),Pt(k));return[E,D,e,t,n,r]}let[A,ee]=ke(O(E,D),O(w,T),-k*Math.PI/180),[te,ne]=ke(O(E,D),O(w,T),Pt(k));if(r===`diamond`||r===`diamond_outline`){let t,r;if(n===`start`){let[n,i]=e.points.length>1?e.points[1]:[0,0];[t,r]=ke(O(w+C*2,T),O(w,T),Math.atan2(i-T,n-w))}else{let[n,i]=e.points.length>1?e.points[e.points.length-2]:[0,0];[t,r]=ke(O(w-C*2,T),O(w,T),Math.atan2(T-i,w-n))}return[w,T,A,ee,t,r,te,ne]}return[w,T,A,ee,te,ne]};(function(){let e=null,t=null,n=null,r=(r,i,a,o)=>{if(n!==void 0&&i===t&&r===e&&a.editingGroupId===n?.editingGroupId)return n;let s={};for(let e of r){let t=e.groupIds;if(a.editingGroupId){let e=t.indexOf(a.editingGroupId);e>-1&&(t=t.slice(0,e))}if(t.length>0){let e=t[t.length-1];s[e]=!0}}let c={},l=i.reduce((e,t)=>{if(t.isDeleted)return e;let n=t.groupIds.find(e=>s[e]);return n&&(e[t.id]=!0,Array.isArray(c[n])?c[n].push(t.id):c[n]=[t.id]),e},{});for(let e of Object.keys(c))c[e].length<2&&s[e]&&(s[e]=!1);return t=i,e=r,n={editingGroupId:a.editingGroupId,selectedGroupIds:s,selectedElementIds:TA({...a.selectedElementIds,...l},o)},n},i=(e,t,n,i)=>{let a=i?i.scene.getSelectedElements({selectedElementIds:e.selectedElementIds,elements:t}):wA(t,e);return a.length?r(a,t,e,n):{selectedGroupIds:{},editingGroupId:null,selectedElementIds:TA(e.selectedElementIds,n)}};return i.clearCache=()=>{t=null,e=null,n=null},i})(),(function(){let e=null,t=null,n=null,r=(r,i)=>(n!=null&&r===e&&i.selectedElementIds===t||(n=r.some(e=>i.selectedElementIds[e.id]),e=r,t=i.selectedElementIds),n);return r.clearCache=()=>{e=null,t=null,n=null},r})();var wA=(e,t,n)=>{let r=new Set,i=[];for(let a of e.values()){if(t.selectedElementIds[a.id]){i.push(a),r.add(a.id);continue}if(n?.includeBoundTextElement&&oA(a)&&t.selectedElementIds[a?.containerId]){i.push(a),r.add(a.id);continue}}if(n?.includeElementsInFrames){let t=[];return i.forEach(n=>{tA(n)&&EA(e,n.id).forEach(e=>!r.has(e.id)&&t.push(e)),t.push(n)}),t}return i},TA=(e,t)=>ji(t.selectedElementIds,e)?t.selectedElementIds:e,EA=(e,t)=>{let n=[];for(let r of e.values())r.frameId===t&&n.push(r);return n},DA=typeof document<`u`?document.createElement(`img`):{src:``};DA.src=`data:${hs.svg},%3Csvg%20aria-hidden%3D%22true%22%20focusable%3D%22false%22%20data-prefix%3D%22fas%22%20data-icon%3D%22image%22%20class%3D%22svg-inline--fa%20fa-image%20fa-w-16%22%20role%3D%22img%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%20512%20512%22%3E%3Cpath%20fill%3D%22%23888%22%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048zM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56zM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E`;var OA=typeof document<`u`?document.createElement(`img`):{src:``};OA.src=`data:${hs.svg},%3Csvg%20viewBox%3D%220%200%20668%20668%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20xml%3Aspace%3D%22preserve%22%20style%3D%22fill-rule%3Aevenodd%3Bclip-rule%3Aevenodd%3Bstroke-linejoin%3Around%3Bstroke-miterlimit%3A2%22%3E%3Cpath%20d%3D%22M464%20448H48c-26.51%200-48-21.49-48-48V112c0-26.51%2021.49-48%2048-48h416c26.51%200%2048%2021.49%2048%2048v288c0%2026.51-21.49%2048-48%2048ZM112%20120c-30.928%200-56%2025.072-56%2056s25.072%2056%2056%2056%2056-25.072%2056-56-25.072-56-56-56ZM64%20384h384V272l-87.515-87.515c-4.686-4.686-12.284-4.686-16.971%200L208%20320l-55.515-55.515c-4.686-4.686-12.284-4.686-16.971%200L64%20336v48Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.81709%200%200%20.81709%20124.825%20145.825)%22%2F%3E%3Cpath%20d%3D%22M256%208C119.034%208%208%20119.033%208%20256c0%20136.967%20111.034%20248%20248%20248s248-111.034%20248-248S392.967%208%20256%208Zm130.108%20117.892c65.448%2065.448%2070%20165.481%2020.677%20235.637L150.47%20105.216c70.204-49.356%20170.226-44.735%20235.638%2020.676ZM125.892%20386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53%20406.784c-70.203%2049.356-170.226%2044.736-235.638-20.676Z%22%20style%3D%22fill%3A%23888%3Bfill-rule%3Anonzero%22%20transform%3D%22matrix(.30366%200%200%20.30366%20506.822%2060.065)%22%2F%3E%3C%2Fsvg%3E`;var kA=new WeakMap,AA=e=>e===`rectangle`||e===`iframe`||e===`embeddable`||e===`line`||e===`diamond`||e===`image`,jA=class{};i(jA,`rg`,new fa),i(jA,`cache`,new WeakMap),i(jA,`get`,(e,t)=>{let n=jA.cache.get(e);if(n&&(t===null||n.theme===t))return n.shape}),i(jA,`delete`,e=>{jA.cache.delete(e),kA.delete(e)}),i(jA,`destroy`,()=>{jA.cache=new WeakMap}),i(jA,`generateElementShape`,(e,t)=>{let n=t?.isExporting?void 0:jA.get(e,t?t.theme:null);if(n!==void 0)return n;kA.delete(e);let r=HA(e,jA.rg,t||{isExporting:!1,canvasBackgroundColor:hi.white,embedsValidationStatus:null,theme:R.LIGHT});return t?.isExporting||jA.cache.set(e,{shape:r,theme:t?.theme||R.LIGHT}),r});var MA=e=>[8,8+e],NA=e=>[1.5,6+e];function PA(e){let t=e.roughness,n=Math.max(e.width,e.height),r=Math.min(e.width,e.height);return r>=20&&n>=50||r>=15&&e.roundness&&AA(e.type)||nA(e)&&n>=50?t:Math.min(t/(n<10?3:2),2.5)}var FA=(e,t=!1,n=!1)=>{let r={seed:e.seed,strokeLineDash:e.strokeStyle===`dashed`?MA(e.strokeWidth):e.strokeStyle===`dotted`?NA(e.strokeWidth):void 0,disableMultiStroke:e.strokeStyle!==`solid`,strokeWidth:e.strokeStyle===`solid`?e.strokeWidth:e.strokeWidth+.5,fillWeight:e.strokeWidth/2,hachureGap:e.strokeWidth*4,roughness:PA(e),stroke:n?D(e.strokeColor):e.strokeColor,preserveVertices:t||e.roughness<Ia.cartoonist};switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:case`diamond`:case`ellipse`:return r.fillStyle=e.fillStyle,r.fill=Po(e.backgroundColor)?void 0:n?D(e.backgroundColor):e.backgroundColor,e.type===`ellipse`&&(r.curveFitting=1),r;case`line`:case`freedraw`:return sA(e.points)&&(r.fillStyle=e.fillStyle,r.fill=e.backgroundColor===`transparent`?void 0:n?D(e.backgroundColor):e.backgroundColor),r;case`arrow`:return r;default:throw Error(`Unimplemented type ${e.type}`)}},IA=(e,t,n)=>$k(e)&&(t||Zk(e)&&n?.get(e.id)!==!0)&&Po(e.backgroundColor)&&Po(e.strokeColor)?{...e,roughness:0,backgroundColor:`#d3d3d3`,fillStyle:`solid`}:Qk(e)?{...e,strokeColor:Po(e.strokeColor)?`#000000`:e.strokeColor,backgroundColor:Po(e.backgroundColor)?`#f4f4f6`:e.backgroundColor}:e,LA=(e,t,n)=>{if(t===null)return[];let[,,r,i,a,o]=t;return[e.line(r,i,a,o,n)]},RA=(e,t,n)=>{if(t===null)return[];let[r,i,a,o,s,c]=t;return[e.line(a,o,r,i,n),e.line(s,c,r,i,n)]},zA=(e,t)=>{let n={...t};if(e.strokeStyle===`dotted`){let t=NA(e.strokeWidth-1);n.strokeLineDash=[t[0],t[1]-1]}else delete n.strokeLineDash;return n.roughness=Math.min(1,n.roughness||0),n},BA=(e,t,n,r,i,a=1)=>{if(r===null)return[];let[o,s,c]=r,l={...t,fill:i,fillStyle:`solid`,stroke:n,roughness:Math.min(.5,t.roughness||0)};return delete l.strokeLineDash,[e.circle(o,s,c*a,l)]},VA=(e,t,n,r,i,a,o,s)=>{if(r===null)return[];let c=s?D(e.strokeColor):e.strokeColor,l=s?D(o):o,u=.8;switch(r){case`circle`:case`circle_outline`:return BA(i,a,c,CA(e,t,n,r),r===`circle_outline`?l:c);case`triangle`:case`triangle_outline`:{let o=CA(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m]=o,h={...a,fill:r===`triangle_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete h.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[s,u]],h)]}case`diamond`:case`diamond_outline`:{let o=CA(e,t,n,r);if(o===null)return[];let[s,u,d,f,p,m,h,g]=o,_={...a,fill:r===`diamond_outline`?l:c,fillStyle:`solid`,roughness:Math.min(1,a.roughness||0)};return delete _.strokeLineDash,[i.polygon([[s,u],[d,f],[p,m],[h,g],[s,u]],_)]}case`cardinality_one`:return LA(i,CA(e,t,n,r),zA(e,a));case`cardinality_many`:return RA(i,CA(e,t,n,r),zA(e,a));case`cardinality_one_or_many`:{let r=zA(e,a);return[...RA(i,CA(e,t,n,`cardinality_many`),r),...LA(i,CA(e,t,n,`cardinality_one`,-.25),r)]}case`cardinality_exactly_one`:{let r=zA(e,a);return[...LA(i,CA(e,t,n,`cardinality_one`,-.5),r),...LA(i,CA(e,t,n,`cardinality_one`),r)]}case`cardinality_zero_or_one`:{let r=zA(e,a);return[...BA(i,a,c,CA(e,t,n,`circle_outline`,1.5),l,u),...LA(i,CA(e,t,n,`cardinality_one`,-.5),r)]}case`cardinality_zero_or_many`:{let r=zA(e,a);return[...RA(i,CA(e,t,n,`cardinality_many`),r),...BA(i,a,c,CA(e,t,n,`circle_outline`,1.5),l,u)]}default:return RA(i,CA(e,t,n,r),zA(e,a))}},HA=(e,t,{isExporting:n,canvasBackgroundColor:r,embedsValidationStatus:i,theme:a})=>{let o=a===R.DARK;switch(e.type){case`rectangle`:case`iframe`:case`embeddable`:{let r;if(e.roundness){let a=e.width,s=e.height,c=cA(Math.min(a,s),e);r=t.path(`M ${c} 0 L ${a-c} 0 Q ${a} 0, ${a} ${c} L ${a} ${s-c} Q ${a} ${s}, ${a-c} ${s} L ${c} ${s} Q 0 ${s}, 0 ${s-c} L 0 ${c} Q 0 0, ${c} 0`,FA(IA(e,n,i),!0,o))}else r=t.rectangle(0,0,e.width,e.height,FA(IA(e,n,i),!1,o));return r}case`diamond`:{let n,[r,i,a,s,c,l,u,d]=vA(e);if(e.roundness){let f=cA(Math.abs(r-u),e),p=cA(Math.abs(s-i),e);n=t.path(`M ${r+f} ${i+p} L ${a-f} ${s-p}
|
|
55
|
+
C ${a} ${s}, ${a} ${s}, ${a-f} ${s+p}
|
|
56
|
+
L ${c+f} ${l-p}
|
|
57
|
+
C ${c} ${l}, ${c} ${l}, ${c-f} ${l-p}
|
|
58
|
+
L ${u+f} ${d+p}
|
|
59
|
+
C ${u} ${d}, ${u} ${d}, ${u+f} ${d-p}
|
|
60
|
+
L ${r-f} ${i+p}
|
|
61
|
+
C ${r} ${i}, ${r} ${i}, ${r+f} ${i+p}`,FA(e,!0,o))}else n=t.polygon([[r,i],[a,s],[c,l],[u,d]],FA(e,!1,o));return n}case`ellipse`:return t.ellipse(e.width/2,e.height/2,e.width,e.height,FA(e,!1,o));case`line`:case`arrow`:{let n,i=FA(e,!1,o),a=e.points.length?e.points:[O(0,0)];if(iA(e)?a.every(e=>Math.abs(e[0])<=1e6&&Math.abs(e[1])<=1e6)?n=[t.path(UA(a,16),FA(e,!0,o))]:(console.error(`Elbow arrow with extreme point positions detected. Arrow not rendered.`,e.id,JSON.stringify(a)),n=[]):n=e.roundness?[t.curve(a,i)]:i.fill?[t.polygon(a,i)]:[t.linearPath(a,i)],e.type===`arrow`){let{startArrowhead:a=null,endArrowhead:s=`arrow`}=e;if(a!==null){let s=VA(e,n,`start`,a,t,i,r,o);n.push(...s)}if(s!==null){let a=VA(e,n,`end`,s,t,i,r,o);n.push(...a)}}return n}case`freedraw`:{let n=[];if(sA(e.points)){let r=Ov(e.points,.75);n.push(t.curve(r,{...FA(e,!1,o),stroke:`none`}))}return n.push(WA(e)),n}case`frame`:case`magicframe`:case`text`:case`image`:return null;default:return Ro(e,`generateElementShape(): Unimplemented type ${e?.type}`),null}},UA=(e,t)=>{let n=[];for(let r=1;r<e.length-1;r+=1){let i=e[r-1],a=e[r+1],o=e[r],s=hA(o,i),c=hA(a,o),l=Math.min(t,Se(e[r],a)/2,Se(e[r],i)/2);s?i[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):i[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l]),n.push(e[r]),c?a[0]<o[0]?n.push([e[r][0]-l,e[r][1]]):n.push([e[r][0]+l,e[r][1]]):a[1]<o[1]?n.push([e[r][0],e[r][1]-l]):n.push([e[r][0],e[r][1]+l])}let r=[`M ${e[0][0]} ${e[0][1]}`];for(let e=0;e<n.length;e+=3)r.push(`L ${n[e][0]} ${n[e][1]}`),r.push(`Q ${n[e+1][0]} ${n[e+1][1]}, ${n[e+2][0]} ${n[e+2][1]}`);return r.push(`L ${e[e.length-1][0]} ${e[e.length-1][1]}`),r.join(` `)},WA=e=>JA(GA(e)),GA=e=>$v(e.simulatePressure?e.points:e.points.length?e.points.map(([t,n],r)=>[t,n,e.pressures[r]]):[[0,0,.5]],{simulatePressure:e.simulatePressure,size:e.strokeWidth*4.25,thinning:.6,smoothing:.5,streamline:.5,easing:e=>Math.sin(e*Math.PI/2),last:!0}),KA=(e,t)=>[(e[0]+t[0])/2,(e[1]+t[1])/2],qA=/(\s?[A-Z]?,?-?[0-9]*\.[0-9]{0,2})(([0-9]|e|-)*)/g,JA=e=>{if(!e.length)return``;let t=e.length-1;return e.reduce((e,n,r,i)=>(r===t?e.push(n,KA(n,i[0]),`L`,i[0],`Z`):e.push(n,KA(n,i[r+1])),e),[`M`,e[0],`Q`]).join(` `).replace(qA,`$1`)},YA=(e,t,n=!1)=>{let r=!1;for(let n in t){let i=t[n];if(typeof i<`u`){if(e[n]===i&&(typeof i!=`object`||!i))continue;r=!0}}return!r&&!n?e:{...e,...t,version:t.version??e.version+1,versionNonce:t.versionNonce??se(),updated:ot()}},XA=Z({name:`toggleLinearEditor`,category:Uk.elements,label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds})[0]?.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`,keywords:[`line`],trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.selectedLinearElement?.isEditing&&i.length===1&&b(i[0])&&!dr(i[0]))},perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];gt(i,`No selected element found`),gt(t.selectedLinearElement,`No selected linear element found`),gt(i.id===t.selectedLinearElement.elementId,`Selected element ID and linear editor elementId does not match`);let a={...t.selectedLinearElement,isEditing:!t.selectedLinearElement.isEditing};return{appState:{...t,selectedLinearElement:a},captureUpdate:V.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds})[0];if(!r)return null;let i=K(r.type===`arrow`?`labels.lineEditor.editArrow`:`labels.lineEditor.edit`);return(0,W.jsx)(X,{type:`button`,icon:LS,title:i,"aria-label":i,onClick:()=>t(null)})}});Z({name:`togglePolygon`,category:Uk.elements,icon:Wy,keywords:[`loop`],label:(e,t,n)=>n.scene.getSelectedElements({selectedElementIds:t.selectedElementIds}).some(e=>!ca(e)||!e.polygon)?`labels.polygon.convertToPolygon`:`labels.polygon.breakPolygon`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds});return i.length>0&&i.every(e=>ca(e)&&e.points.length>=4)},perform(e,t,n,r){let i=r.scene.getSelectedElements(t);if(i.some(e=>!ca(e)))return!1;let a=i,o=a.some(e=>!e.polygon),s=lr(a);return{elements:e.map(e=>!s.has(e.id)||!ca(e)?e:YA(e,{backgroundColor:o?e.backgroundColor:`transparent`,...g(e,o)})),appState:t,captureUpdate:V.IMMEDIATELY}},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=n.scene.getSelectedElements({selectedElementIds:e.selectedElementIds});if(r.length===0||r.some(e=>!ca(e)||!e.polygon||e.points.length<3))return null;let i=r.every(e=>ca(e)&&e.polygon),a=K(i?`labels.polygon.breakPolygon`:`labels.polygon.convertToPolygon`);return(0,W.jsx)(fC,{icon:Wy,title:a,"aria-label":a,active:i,onClick:()=>t(null),style:{marginLeft:`auto`}})}});var ZA=Z({name:`searchMenu`,icon:vS,keywords:[`search`,`find`],label:`search.title`,viewMode:!0,trackEvent:{category:`search_menu`,action:`toggle`,predicate:e=>e.gridModeEnabled},perform(e,t,n,r){if(t.openDialog)return!1;if(t.openSidebar?.name===At.name&&t.openSidebar.tab===`search`){let e=r.excalidrawContainerValue.container?.querySelector(`.${Qn.SEARCH_MENU_INPUT_WRAPPER} input`);return e?.focus(),e?.select(),!1}return{appState:{...t,openSidebar:{name:At.name,tab:Ln},openDialog:null},captureUpdate:V.EVENTUALLY}},checked:e=>e.gridModeEnabled,predicate:(e,t,n)=>n.gridModeEnabled===void 0,keyTest:e=>e[N.CTRL_OR_CMD]&&e.key===N.F}),QA=Z({name:`cropEditor`,label:`helpDialog.cropStart`,icon:WS,viewMode:!0,trackEvent:{category:`menu`},keywords:[`image`,`crop`],perform(e,t,n,r){let i=r.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!0})[0];return{appState:{...t,isCropping:!1,croppingElementId:i.id},captureUpdate:V.IMMEDIATELY}},predicate:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t);return!!(!t.croppingElementId&&i.length===1&&io(i[0]))},PanelComponent:({appState:e,updateData:t,app:n})=>{let r=K(`helpDialog.cropStart`);return(0,W.jsx)(X,{type:`button`,icon:WS,title:r,"aria-label":r,onClick:()=>t(null)})}}),$A=(e,t)=>{let n=t.scene.getSelectedElements(e);return n.length===1&&L(n[0])},ej=Z({name:`selectAllElementsInFrame`,label:`labels.selectAllElementsInFrame`,trackEvent:{category:`canvas`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;if(L(i)){let n=Di(Cs(e),i.id).filter(e=>!(e.type===`text`&&e.containerId));return{elements:e,appState:{...t,selectedElementIds:n.reduce((e,t)=>(e[t.id]=!0,e),{})},captureUpdate:V.IMMEDIATELY}}return{elements:e,appState:t,captureUpdate:V.EVENTUALLY}},predicate:(e,t,n,r)=>$A(t,r)}),tj=Z({name:`removeAllElementsFromFrame`,label:`labels.removeAllElementsFromFrame`,trackEvent:{category:`history`},perform:(e,t,n,r)=>{let i=r.scene.getSelectedElements(t).at(0)||null;return L(i)?{elements:Nr(e,i),appState:{...t,selectedElementIds:{[i.id]:!0}},captureUpdate:V.IMMEDIATELY}:{elements:e,appState:t,captureUpdate:V.EVENTUALLY}},predicate:(e,t,n,r)=>$A(t,r)});Z({name:`updateFrameRendering`,label:`labels.updateFrameRendering`,viewMode:!0,trackEvent:{category:`canvas`},perform:(e,t)=>({elements:e,appState:{...t,frameRendering:{...t.frameRendering,enabled:!t.frameRendering.enabled}},captureUpdate:V.EVENTUALLY}),checked:e=>e.frameRendering.enabled}),Z({name:`setFrameAsActiveTool`,label:`toolBar.frame`,trackEvent:{category:`toolbar`},icon:oS,viewMode:!1,perform:(e,t,n,r)=>{let i=ka(t,{type:`frame`});return Yw(r.interactiveCanvas,{...t,activeTool:i}),{elements:e,appState:{...t,activeTool:ka(t,{type:`frame`})},captureUpdate:V.EVENTUALLY}},keyTest:e=>!e[N.CTRL_OR_CMD]&&!e.shiftKey&&!e.altKey&&e.key.toLocaleLowerCase()===N.F});var nj=Z({name:`wrapSelectionInFrame`,label:`labels.wrapSelectionInFrame`,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=ir(e,t);return i.length>0&&!i.some(e=>L(e))},perform:(e,t,n,r)=>{let i=ir(e,t),a=r.scene.getNonDeletedElementsMap(),[o,s,c,l]=Ii(i,a),u=Ds({x:o-16,y:s-16,width:c-o+32,height:l-s+32});if(t.editingGroupId){let e=Ki(i,t.editingGroupId);for(let n of e){let e=n.groupIds.indexOf(t.editingGroupId);jn(n,a,{groupIds:n.groupIds.slice(0,e)})}}return{elements:Je([...r.scene.getElementsIncludingDeleted(),u],i,u,t),appState:{selectedElementIds:{[u.id]:!0}},captureUpdate:V.IMMEDIATELY}}}),rj=class extends Ps{applyTo(e,t,n){let[r,i]=this.elements.applyTo(e,n.elements,{excludedProperties:new Set([`version`,`versionNonce`])}),[a,o]=this.appState.applyTo(t,r);return[r,a,i||o]}static calculate(e,t){return super.calculate(e,t)}static inverse(e){return super.inverse(e)}static applyLatestChanges(e,t,n,r){return super.applyLatestChanges(e,t,n,r)}},ij=class{constructor(e=!0,t=!0){this.isUndoStackEmpty=e,this.isRedoStackEmpty=t}},aj=class e{constructor(e){this.store=e,i(this,`onHistoryChangedEmitter`,new Be),i(this,`undoStack`,[]),i(this,`redoStack`,[])}get isUndoStackEmpty(){return this.undoStack.length===0}get isRedoStackEmpty(){return this.redoStack.length===0}clear(){this.undoStack.length=0,this.redoStack.length=0}record(e){if(e.isEmpty()||e instanceof rj)return;let t=rj.inverse(e);this.undoStack.push(t),t.elements.isEmpty()||(this.redoStack.length=0),this.onHistoryChangedEmitter.trigger(new ij(this.isUndoStackEmpty,this.isRedoStackEmpty))}undo(t,n){return this.perform(t,n,()=>e.pop(this.undoStack),t=>e.push(this.redoStack,t))}redo(t,n){return this.perform(t,n,()=>e.pop(this.redoStack),t=>e.push(this.undoStack,t))}perform(e,t,n,r){try{let i=n();if(i===null)return;let a=V.IMMEDIATELY,o=this.store.snapshot,s=e,c=t,l=!1;for(;i;){try{[s,c,l]=i.applyTo(s,c,o);let e=o.elements,t=o.maybeClone(a,s,c),n=Wt.create(o,t),r=rj.applyLatestChanges(i,e,s);r.isEmpty()||(this.store.scheduleMicroAction({action:a,change:n,delta:r}),i=r),o=t}finally{r(i)}if(l)break;i=n()}return[s,c]}finally{this.onHistoryChangedEmitter.trigger(new ij(this.isUndoStackEmpty,this.isRedoStackEmpty))}}static pop(e){if(!e.length)return null;let t=e.pop();return t===void 0?null:t}static push(e,t){let n=rj.inverse(t);return e.push(n)}},oj=(e,t)=>{let[n,r]=(0,H.useState)(t);return(0,H.useEffect)(()=>{let t=e.on(e=>{r(e)});return()=>{t()}},[e]),n},sj=(e,t,n)=>{if(!t.multiElement&&!t.resizingElement&&!t.editingTextElement&&!t.newElement&&!t.selectedElementsAreBeingDragged&&!t.selectionElement&&!e.flowChartCreator.isCreatingChart){let e=n();if(!e)return{captureUpdate:V.EVENTUALLY};let[t,r]=e;return{appState:r,elements:jo(Array.from(t.values())),captureUpdate:V.NEVER}}return{captureUpdate:V.EVENTUALLY}},cj=e=>({name:`undo`,label:`buttons.undo`,icon:Ib,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>sj(i,n,()=>e.undo(lr(t),n)),keyTest:e=>e[N.CTRL_OR_CMD]&&Te(e,N.Z)&&!e.shiftKey,PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isUndoStackEmpty:a}=oj(e.onHistoryChangedEmitter,new ij(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:Ib,"aria-label":K(`buttons.undo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-undo`,style:{...o?Bs:{}}})}}),lj=e=>({name:`redo`,label:`buttons.redo`,icon:Lb,trackEvent:{category:`history`},viewMode:!1,perform:(t,n,r,i)=>sj(i,n,()=>e.redo(lr(t),n)),keyTest:e=>e[N.CTRL_OR_CMD]&&e.shiftKey&&Te(e,N.Z)||tn&&e.ctrlKey&&!e.shiftKey&&Te(e,N.Y),PanelComponent:({appState:t,updateData:n,data:r,app:i})=>{let{isRedoStackEmpty:a}=oj(e.onHistoryChangedEmitter,new ij(e.isUndoStackEmpty,e.isRedoStackEmpty)),o=az()===`mobile`;return(0,W.jsx)(X,{type:`button`,icon:Lb,"aria-label":K(`buttons.redo`),onClick:n,size:r?.size||`medium`,disabled:a,"data-testid":`button-redo`,style:{...o?Bs:{}}})}}),uj=Z({name:`autoResize`,label:`labels.autoResize`,icon:null,trackEvent:{category:`element`},predicate:(e,t,n,r)=>{let i=ir(e,t);return i.length===1&&M(i[0])&&!i[0].autoResize},perform:(e,t,n,r)=>{let i=ir(e,t);return{appState:t,elements:e.map(e=>{if(e.id===i[0].id&&M(e)){let t=gn(e.originalText,u(e),e.lineHeight);return B(e,{autoResize:!0,width:t.width,height:t.height,text:e.originalText})}return e}),captureUpdate:V.IMMEDIATELY}}}),dj=(e,t,n,r,i,a)=>{if(e.trackEvent)try{typeof e.trackEvent==`object`&&(!e.trackEvent.predicate||e.trackEvent.predicate(n,r,a))&&dC(e.trackEvent.category,e.trackEvent.action||e.name,`${t} (${i.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`)}catch(e){console.error(`error while logging action:`,e)}},fj=class{constructor(e,t,n,r){i(this,`actions`,{}),i(this,`updater`),i(this,`getAppState`),i(this,`getElementsIncludingDeleted`),i(this,`app`),i(this,`renderAction`,(e,t)=>{let n=this.app.props.UIOptions.canvasActions;if(this.actions[e]&&`PanelComponent`in this.actions[e]&&(!(e in n)||n[e])){let n=this.actions[e],r=n.PanelComponent;r.displayName=`PanelComponent`;let i=this.getElementsIncludingDeleted(),a=this.getAppState();return(0,W.jsx)(r,{elements:this.getElementsIncludingDeleted(),appState:this.getAppState(),updateData:e=>{dj(n,`ui`,a,i,this.app,e),this.updater(n.perform(this.getElementsIncludingDeleted(),this.getAppState(),e,this.app))},appProps:this.app.props,app:this.app,data:t,renderAction:this.renderAction})}return null}),i(this,`isActionEnabled`,e=>{let t=this.getElementsIncludingDeleted(),n=this.getAppState();return!e.predicate||e.predicate(t,n,this.app.props,this.app)}),this.updater=t=>{if(ge(t))t.then(t=>e(t));else return e(t)},this.getAppState=t,this.getElementsIncludingDeleted=n,this.app=r}registerAction(e){this.actions[e.name]=e}registerAll(e){e.forEach(e=>this.registerAction(e))}handleKeyDown(e){let t=this.app.props.UIOptions.canvasActions,n=Object.values(this.actions).sort((e,t)=>(t.keyPriority||0)-(e.keyPriority||0)).filter(n=>(n.name in t?t[n.name]:!0)&&n.keyTest&&n.keyTest(e,this.getAppState(),this.getElementsIncludingDeleted(),this.app));if(n.length!==1)return n.length>1&&console.warn(`Canceling as multiple actions match this shortcut`,n),!1;let r=n[0];if(this.getAppState().viewModeEnabled&&r.viewMode!==!0)return!1;let i=this.getElementsIncludingDeleted(),a=this.getAppState();return dj(r,`keyboard`,a,i,this.app,null),e.preventDefault(),e.stopPropagation(),this.updater(n[0].perform(i,a,null,this.app)),!0}executeAction(e,t=`api`,n=null){let r=this.getElementsIncludingDeleted(),i=this.getAppState();dj(e,t,i,r,this.app,n),this.updater(e.perform(r,i,n,this.app))}},pj=class{constructor(){i(this,`targets`,new WeakMap),i(this,`rafIds`,new WeakMap)}register(e,t){this.targets.set(e,{callback:t,stopped:!0})}start(e){let t=this.targets.get(e);t&&(this.rafIds.has(e)||(this.targets.set(e,{...t,stopped:!1}),this.scheduleFrame(e)))}stop(e){let t=this.targets.get(e);t&&!t.stopped&&this.targets.set(e,{...t,stopped:!0}),this.cancelFrame(e)}constructFrame(e){return t=>{let n=this.targets.get(e);if(!n)return;let r=this.onFrame(n,t);!n.stopped&&!r?this.scheduleFrame(e):this.cancelFrame(e)}}scheduleFrame(e){let t=requestAnimationFrame(this.constructFrame(e));this.rafIds.set(e,t)}cancelFrame(e){if(this.rafIds.has(e)){let t=this.rafIds.get(e);cancelAnimationFrame(t)}this.rafIds.delete(e)}onFrame(e,t){return e.callback(t)??!1}},mj=e=>{let t=Array.from(e.values());return{x:gj(t,e=>e.x)/t.length,y:gj(t,e=>e.y)/t.length}},hj=([e,t])=>Math.hypot(e.x-t.x,e.y-t.y),gj=(e,t)=>e.reduce((e,n)=>e+t(n),0),_j=8,vj=99999,yj=e=>_j/e,bj=class{};i(bj,`referenceSnapPoints`,null),i(bj,`visibleGaps`,null),i(bj,`setReferenceSnapPoints`,e=>{bj.referenceSnapPoints=e}),i(bj,`getReferenceSnapPoints`,()=>bj.referenceSnapPoints),i(bj,`setVisibleGaps`,e=>{bj.visibleGaps=e}),i(bj,`getVisibleGaps`,()=>bj.visibleGaps),i(bj,`destroy`,()=>{bj.referenceSnapPoints=null,bj.visibleGaps=null});var xj=bj,Sj=e=>e.props.gridModeEnabled??e.state.gridModeEnabled,Cj=({event:e,app:t,selectedElements:n})=>{if(e){let n=t.state.activeTool.type===`lasso`&&t.state.selectedElementsAreBeingDragged;return(t.state.activeTool.type!==`lasso`||n)&&(t.state.objectsSnapModeEnabled&&!e[N.CTRL_OR_CMD]||!t.state.objectsSnapModeEnabled&&e[N.CTRL_OR_CMD]&&!Sj(t))}return n.length===1&&n[0].type===`arrow`?!1:t.state.objectsSnapModeEnabled},wj=(e,t,n=.01)=>Math.abs(e-t)<=n,Tj=(e,t,{omitCenter:n,boundingBoxCorners:r,dragOffset:i}={omitCenter:!1,boundingBoxCorners:!1})=>{let a=[];if(e.length===1){let o=e[0],[s,c,l,u,d,f]=ei(o,t);i&&(s+=i.x,l+=i.x,d+=i.x,c+=i.y,u+=i.y,f+=i.y);let p=(l-s)/2,m=(u-c)/2;if((o.type===`diamond`||o.type===`ellipse`)&&!r){let e=ke(O(s,c+m),O(d,f),o.angle),t=ke(O(s+p,c),O(d,f),o.angle),r=ke(O(l,c+m),O(d,f),o.angle),i=ke(O(s+p,u),O(d,f),o.angle),h=O(d,f);a=n?[e,t,r,i]:[e,t,r,i,h]}else{let e=ke(O(s,c),O(d,f),o.angle),t=ke(O(l,c),O(d,f),o.angle),r=ke(O(s,u),O(d,f),o.angle),i=ke(O(l,u),O(d,f),o.angle),p=O(d,f);a=n?[e,t,r,i]:[e,t,r,i,p]}}else if(e.length>1){let[t,r,o,s]=mt(e,i??{x:0,y:0}),c=o-t,l=s-r,u=O(t,r),d=O(o,r),f=O(t,s),p=O(o,s),m=O(t+c/2,r+l/2);a=n?[u,d,f,p]:[u,d,f,p,m]}return a.map(e=>O(Mj(e[0]),Mj(e[1])))},Ej=(e,t,n,r)=>Ma(e,t,n,r),Dj=(e,t,n,r)=>{let i=Ha(Ej(e,t,n,r),r).filter(e=>!(e.length===1&&ya(e[0]))).map(e=>Ii(e).map(e=>Mj(e))),a=i.sort((e,t)=>e[0]-t[0]),o=[],s=0;e:for(let e=0;e<a.length;e++){let t=a[e];for(let n=e+1;n<a.length;n++){if(++s>vj)break e;let e=a[n],[,r,i,c]=t,[l,u,,d]=e;i<l&&wa(tt(r,c),tt(u,d))&&o.push({startBounds:t,endBounds:e,startSide:[O(i,r),O(i,c)],endSide:[O(l,u),O(l,d)],length:l-i,overlap:ri(tt(r,c),tt(u,d))})}}let c=i.sort((e,t)=>e[1]-t[1]),l=[];s=0;e:for(let e=0;e<c.length;e++){let t=c[e];for(let n=e+1;n<c.length;n++){if(++s>vj)break e;let e=c[n],[r,,i,a]=t,[o,u,d]=e;a<u&&wa(tt(r,i),tt(o,d))&&l.push({startBounds:t,endBounds:e,startSide:[O(r,a),O(i,a)],endSide:[O(o,u),O(d,u)],length:u-a,overlap:ri(tt(r,i),tt(o,d))})}}return{horizontalGaps:o,verticalGaps:l}},Oj=(e,t,n,r,i,a,o)=>{if(!Cj({app:n,event:r,selectedElements:e})||e.length===0)return[];let s=xj.getVisibleGaps();if(s){let{horizontalGaps:n,verticalGaps:r}=s,[c,l,u,d]=mt(e,t).map(e=>Mj(e)),f=(c+u)/2,p=(l+d)/2;for(let e of n){if(!wa(tt(l,d),e.overlap))continue;let t=Mj(e.startSide[0][0]+e.length/2-f);if(e.length>u-c&&Math.abs(t)<=o.x){Math.abs(t)<o.x&&(i.length=0),o.x=Math.abs(t);let n={type:`gap`,direction:`center_horizontal`,gap:e,offset:t};i.push(n);continue}let[,,n]=e.endBounds,r=c-n,a=Mj(e.length-r);if(Math.abs(a)<=o.x){Math.abs(a)<o.x&&(i.length=0),o.x=Math.abs(a);let t={type:`gap`,direction:`side_right`,gap:e,offset:a};i.push(t);continue}let[s,,,]=e.startBounds,p=Mj(s-u-e.length);if(Math.abs(p)<=o.x){Math.abs(p)<o.x&&(i.length=0),o.x=Math.abs(p);let t={type:`gap`,direction:`side_left`,gap:e,offset:p};i.push(t);continue}}for(let e of r){if(!wa(tt(c,u),e.overlap))continue;let t=Mj(e.startSide[0][1]+e.length/2-p);if(e.length>d-l&&Math.abs(t)<=o.y){Math.abs(t)<o.y&&(a.length=0),o.y=Math.abs(t);let n={type:`gap`,direction:`center_vertical`,gap:e,offset:t};a.push(n);continue}let[,n,,]=e.startBounds,r=Mj(n-d-e.length);if(Math.abs(r)<=o.y){Math.abs(r)<o.y&&(a.length=0),o.y=Math.abs(r);let t={type:`gap`,direction:`side_top`,gap:e,offset:r};a.push(t);continue}let[,,,i]=e.endBounds,s=Mj(l-i),f=e.length-s;if(Math.abs(f)<=o.y){Math.abs(f)<o.y&&(a.length=0),o.y=Math.abs(f);let t={type:`gap`,direction:`side_bottom`,gap:e,offset:f};a.push(t);continue}}}},kj=(e,t,n,r)=>Ha(Ej(e,t,n,r),r).filter(e=>!(e.length===1&&ya(e[0]))).flatMap(e=>Tj(e,r)),Aj=(e,t,n,r,i,a,o)=>{if(!Cj({app:n,event:r,selectedElements:e})||e.length===0&&t.length===0)return[];let s=xj.getReferenceSnapPoints();if(s)for(let e of t)for(let t of s){let n=t[0]-e[0],r=t[1]-e[1];Math.abs(n)<=o.x&&(Math.abs(n)<o.x&&(i.length=0),i.push({type:`point`,points:[e,t],offset:n}),o.x=Math.abs(n)),Math.abs(r)<=o.y&&(Math.abs(r)<o.y&&(a.length=0),a.push({type:`point`,points:[e,t],offset:r}),o.y=Math.abs(r))}},jj=(e,t,n,r,i)=>{let a=n.state,o=ir(e,a);if(!Cj({app:n,event:r,selectedElements:o})||o.length===0)return{snapOffset:{x:0,y:0},snapLines:[]};t.x=Mj(t.x),t.y=Mj(t.y);let s=[],c=[],l=yj(a.zoom.value),u={x:l,y:l};Aj(o,Tj(o,i,{dragOffset:t}),n,r,s,c,u),Oj(o,t,n,r,s,c,u);let d={x:s[0]?.offset??0,y:c[0]?.offset??0};u.x=0,u.y=0,s.length=0,c.length=0;let f={x:Mj(t.x+d.x),y:Mj(t.y+d.y)};Aj(o,Tj(o,i,{dragOffset:f}),n,r,s,c,u),Oj(o,f,n,r,s,c,u);let p=Pj(s,c),m=Ij(o,f,[...s,...c].filter(e=>e.type===`gap`));return{snapOffset:d,snapLines:[...p,...m]}},Mj=e=>Math.round(e*10**6)/10**6,Nj=e=>{let t=new Map;for(let n of e){let e=n.join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},Pj=(e,t)=>{let n={},r={};if(e.length>0){for(let t of e)if(t.type===`point`){let e=Mj(t.points[0][0]);n[e]||(n[e]=[]),n[e].push(...t.points.map(e=>O(Mj(e[0]),Mj(e[1]))))}}if(t.length>0){for(let e of t)if(e.type===`point`){let t=Mj(e.points[0][1]);r[t]||(r[t]=[]),r[t].push(...e.points.map(e=>O(Mj(e[0]),Mj(e[1]))))}}return Object.entries(n).map(([e,t])=>({type:`points`,points:Nj(t.map(t=>O(Number(e),t[1])).sort((e,t)=>e[1]-t[1]))})).concat(Object.entries(r).map(([e,t])=>({type:`points`,points:Nj(t.map(t=>O(t[0],Number(e))).sort((e,t)=>e[0]-t[0]))})))},Fj=e=>{let t=new Map;for(let n of e){let e=n.points.flat().map(e=>[Mj(e)]).join(`,`);t.has(e)||t.set(e,n)}return Array.from(t.values())},Ij=(e,t,n)=>{let[r,i,a,o]=mt(e,t),s=[];for(let e of n){let[t,n,c,l]=e.gap.startBounds,[u,d,f,p]=e.gap.endBounds,m=ri(tt(i,o),e.gap.overlap),h=ri(tt(r,a),e.gap.overlap);switch(e.direction){case`center_horizontal`:if(m){let t=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[O(e.gap.startSide[0][0],t),O(r,t)]},{type:`gap`,direction:`horizontal`,points:[O(a,t),O(e.gap.endSide[0][0],t)]})}break;case`center_vertical`:if(h){let t=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[O(t,e.gap.startSide[0][1]),O(t,i)]},{type:`gap`,direction:`vertical`,points:[O(t,o),O(t,e.gap.endSide[0][1])]})}break;case`side_right`:if(m){let e=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[O(c,e),O(u,e)]},{type:`gap`,direction:`horizontal`,points:[O(f,e),O(r,e)]})}break;case`side_left`:if(m){let e=(m[0]+m[1])/2;s.push({type:`gap`,direction:`horizontal`,points:[O(a,e),O(t,e)]},{type:`gap`,direction:`horizontal`,points:[O(c,e),O(u,e)]})}break;case`side_top`:if(h){let e=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[O(e,o),O(e,n)]},{type:`gap`,direction:`vertical`,points:[O(e,l),O(e,d)]})}break;case`side_bottom`:if(h){let e=(h[0]+h[1])/2;s.push({type:`gap`,direction:`vertical`,points:[O(e,l),O(e,d)]},{type:`gap`,direction:`vertical`,points:[O(e,p),O(e,i)]})}break}}return Fj(s.map(e=>({...e,points:e.points.map(e=>O(Mj(e[0]),Mj(e[1])))})))},Lj=(e,t,n,r,i,a)=>{if(!Cj({event:r,selectedElements:e,app:n})||e.length===0||e.length===1&&!wj(e[0].angle,0))return{snapOffset:{x:0,y:0},snapLines:[]};let[o,s,c,l]=Ii(t);a&&(a.includes(`e`)?c+=i.x:a.includes(`w`)&&(o+=i.x),a.includes(`n`)?s+=i.y:a.includes(`s`)&&(l+=i.y));let u=[];if(a)switch(a){case`e`:u.push(O(c,s),O(c,l));break;case`w`:u.push(O(o,s),O(o,l));break;case`n`:u.push(O(o,s),O(c,s));break;case`s`:u.push(O(o,l),O(c,l));break;case`ne`:u.push(O(c,s));break;case`nw`:u.push(O(o,s));break;case`se`:u.push(O(c,l));break;case`sw`:u.push(O(o,l));break}let d=yj(n.state.zoom.value),f={x:d,y:d},p=[],m=[];Aj(t,u,n,r,p,m,f);let h={x:p[0]?.offset??0,y:m[0]?.offset??0};f.x=0,f.y=0,p.length=0,m.length=0;let[g,_,v,y]=Ii(e).map(e=>Mj(e));return Aj(e,[O(g,_),O(g,y),O(v,_),O(v,y)],n,r,p,m,f),{snapOffset:h,snapLines:Pj(p,m)}},Rj=(e,t,n,r,i,a)=>{if(!Cj({event:n,selectedElements:[e],app:t}))return{snapOffset:{x:0,y:0},snapLines:[]};let o=[O(r.x+i.x,r.y+i.y)],s=yj(t.state.zoom.value),c={x:s,y:s},l=[],u=[];Aj([e],o,t,n,l,u,c);let d={x:l[0]?.offset??0,y:u[0]?.offset??0};c.x=0,c.y=0,l.length=0,u.length=0;let f=Tj([e],a,{boundingBoxCorners:!0,omitCenter:!0});return Aj([e],f,t,n,l,u,c),{snapOffset:d,snapLines:Pj(l,u)}},zj=(e,t,n,r,i)=>{if(!Cj({event:r,selectedElements:[],app:t}))return{originOffset:{x:0,y:0},snapLines:[]};let a=Ma(e,[],t.state,i),o=yj(t.state.zoom.value),s={x:o,y:o},c=[],l=[];for(let e of a){let t=Tj([e],i);for(let e of t){let t=e[0]-n.x;Math.abs(t)<=Math.abs(s.x)&&(Math.abs(t)<Math.abs(s.x)&&(l.length=0),l.push({type:`pointer`,points:[e,O(e[0],n.y)],direction:`vertical`}),s.x=t);let r=e[1]-n.y;Math.abs(r)<=Math.abs(s.y)&&(Math.abs(r)<Math.abs(s.y)&&(c.length=0),c.push({type:`pointer`,points:[e,O(n.x,e[1])],direction:`horizontal`}),s.y=r)}}return{originOffset:{x:l.length>0?l[0].points[0][0]-n.x:0,y:c.length>0?c[0].points[0][1]-n.y:0},snapLines:[...l,...c]}},Bj=e=>e===va.rectangle||e===va.ellipse||e===va.diamond||e===va.frame||e===va.magicframe||e===va.image||e===va.text,Vj=class{constructor(e){i(this,`scene`),i(this,`getRenderableElements`,(()=>{let e=({elementsMap:e,zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a,height:o,width:s})=>{let c=[];for(let l of e.values())vn(l,s,o,{zoom:t,offsetLeft:n,offsetTop:r,scrollX:i,scrollY:a},e)&&c.push(l);return c},t=({elements:e,editingTextElement:t,newElementId:n})=>{let r=_r(new Map);for(let i of e)n!==i.id&&(!t||t.type!==`text`||i.id!==t.id)&&r.set(i.id,i);return r};return ki(({zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:c,editingTextElement:l,newElementId:u,sceneNonce:d})=>{let f=t({elements:this.scene.getNonDeletedElements(),editingTextElement:l,newElementId:u});return{elementsMap:f,visibleElements:e({elementsMap:f,zoom:n,offsetLeft:r,offsetTop:i,scrollX:a,scrollY:o,height:s,width:c})}})})()),this.scene=e}destroy(){Mt.cancel(),this.getRenderableElements.clear()}},Hj=5,Uj=(e,t,n)=>{let[r,i]=ei(e,n),{x:a,y:o}=Ci({sceneX:r+e.width,sceneY:i},t);return{x:a-t.offsetLeft+10,y:o-t.offsetTop}},Wj=({children:e,element:t,elementsMap:n})=>{let r=cz();if(r.contextMenu||r.newElement||r.resizingElement||r.isRotating||r.openMenu||r.viewModeEnabled)return null;let{x:i,y:a}=Uj(t,r,n);return(0,W.jsx)(`div`,{className:`excalidraw-canvas-buttons`,style:{top:`${a}px`,left:`${i}px`,padding:Hj},children:e})},Gj=class{constructor(e,t,n){this.animationFrameHandler=e,this.app=t,this.options=n,i(this,`currentTrail`),i(this,`pastTrails`,[]),i(this,`container`),i(this,`trailElement`),i(this,`trailAnimation`),this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.trailElement=document.createElementNS(Wn,`path`),this.options.animateTrail&&(this.trailAnimation=document.createElementNS(`http://www.w3.org/2000/svg`,`animate`),this.trailAnimation.setAttribute(`attributeName`,`stroke-dashoffset`),this.trailElement.setAttribute(`stroke-dasharray`,`7 7`),this.trailElement.setAttribute(`stroke-dashoffset`,`10`),this.trailAnimation.setAttribute(`from`,`0`),this.trailAnimation.setAttribute(`to`,`-14`),this.trailAnimation.setAttribute(`dur`,`0.3s`),this.trailElement.appendChild(this.trailAnimation))}get hasCurrentTrail(){return!!this.currentTrail}hasLastPoint(e,t){if(this.currentTrail){let n=this.currentTrail.originalPoints.length;return this.currentTrail.originalPoints[n-1][0]===e&&this.currentTrail.originalPoints[n-1][1]===t}return!1}start(e){e&&(this.container=e),this.trailElement.parentNode!==this.container&&this.container&&this.container.appendChild(this.trailElement),this.animationFrameHandler.start(this)}stop(){this.animationFrameHandler.stop(this),this.trailElement.parentNode===this.container&&this.container?.removeChild(this.trailElement)}startPath(e,t){this.currentTrail=new hy(this.options),this.currentTrail.addPoint([e,t,performance.now()]),this.update()}addPointToPath(e,t){this.currentTrail&&(this.currentTrail.addPoint([e,t,performance.now()]),this.update())}endPath(){this.currentTrail&&(this.currentTrail.close(),this.currentTrail.options.keepHead=!1,this.pastTrails.push(this.currentTrail),this.currentTrail=void 0,this.update())}getCurrentTrail(){return this.currentTrail}clearTrails(){this.pastTrails=[],this.currentTrail=void 0,this.update()}update(){this.start(),this.trailAnimation&&(this.trailAnimation.setAttribute(`begin`,`indefinite`),this.trailAnimation.setAttribute(`repeatCount`,`indefinite`))}onFrame(){let e=[];for(let t of this.pastTrails)e.push(this.drawTrail(t,this.app.state));if(this.currentTrail){let t=this.drawTrail(this.currentTrail,this.app.state);e.push(t)}this.pastTrails=this.pastTrails.filter(e=>e.getStrokeOutline().length!==0),e.length===0&&this.stop();let t=e.join(` `).trim();this.trailElement.setAttribute(`d`,t),this.trailAnimation?(this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this)),this.trailElement.setAttribute(`stroke`,(this.options.stroke??(()=>`black`))(this))):this.trailElement.setAttribute(`fill`,(this.options.fill??(()=>`black`))(this))}drawTrail(e,t){let n=e.getStrokeOutline(e.options.size/t.zoom.value).map(([e,n])=>{let r=Ci({sceneX:e,sceneY:n},t);return[r.x,r.y]});return Gt(this.trailAnimation?n.slice(0,n.length/2):n,!0)}},Kj=class{constructor(e,t){this.animationFrameHandler=e,this.app=t,i(this,`localTrail`),i(this,`collabTrails`,new Map),i(this,`container`),this.animationFrameHandler.register(this,this.onFrame.bind(this)),this.localTrail=new Gj(e,t,{...this.getTrailOptions(),fill:()=>`red`})}getTrailOptions(){return{simplify:0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/1e3),n=(50-Math.min(50,e.totalLength-e.currentIndex))/50;return Math.min(Oe(n),Oe(t))}}}startPath(e,t){this.localTrail.startPath(e,t)}addPointToPath(e,t){this.localTrail.addPointToPath(e,t)}endPath(){this.localTrail.endPath()}start(e){this.container=e,this.animationFrameHandler.start(this),this.localTrail.start(e)}stop(){this.animationFrameHandler.stop(this),this.localTrail.stop()}onFrame(){this.updateCollabTrails()}updateCollabTrails(){if(!(!this.container||this.app.state.collaborators.size===0)){for(let[e,t]of this.app.state.collaborators.entries()){let n;this.collabTrails.has(e)?n=this.collabTrails.get(e):(n=new Gj(this.animationFrameHandler,this.app,{...this.getTrailOptions(),fill:()=>t.pointer?.laserColor||iE(e,t)}),n.start(this.container),this.collabTrails.set(e,n)),t.pointer&&t.pointer.tool===`laser`&&(t.button===`down`&&!n.hasCurrentTrail&&n.startPath(t.pointer.x,t.pointer.y),t.button===`down`&&n.hasCurrentTrail&&!n.hasLastPoint(t.pointer.x,t.pointer.y)&&n.addPointToPath(t.pointer.x,t.pointer.y),t.button===`up`&&n.hasCurrentTrail&&(n.addPointToPath(t.pointer.x,t.pointer.y),n.endPath()))}for(let e of this.collabTrails.keys())this.app.state.collaborators.has(e)||(this.collabTrails.get(e).stop(),this.collabTrails.delete(e))}}},qj=e=>t=>{(0,_c.unstable_batchedUpdates)(e,t)},Jj=e=>mi(t=>{(0,_c.unstable_batchedUpdates)(e,t)}),Yj=(()=>{let e;try{let t=H.version.split(`.`);e=Number(t[0])>17}catch{e=!1}let t=!1;return()=>window.EXCALIDRAW_THROTTLE_RENDER===!0?e?!0:(t||(t=!0,console.warn(`Excalidraw: render throttling is disabled on React versions < 18.`)),!1):!1})(),Xj=(e,t,n,r,i,a)=>{let{zoom:o}=r,s=180*n/Math.PI,c=e*(o.value-1)/2,l=t*(o.value-1)/2;return e>i&&o.value!==1&&(c=i*(o.value-1)/2),t>a&&o.value!==1&&(l=a*(o.value-1)/2),`translate(${c}px, ${l}px) scale(${o.value}) rotate(${s}deg)`},Zj=({id:e,onChange:t,onSubmit:n,getViewportCoords:r,element:i,canvas:a,excalidrawContainer:o,app:s,autoSelect:c=!0})=>{let l=(e,t)=>{if(!t.style.fontFamily||!t.style.fontSize)return!1;let n=t.style.fontFamily.replace(/"/g,``);return yo({fontFamily:e.fontFamily})!==n||`${e.fontSize}px`!==t.style.fontSize},d=s.state.theme,f=()=>{d=s.state.theme;let t=s.state,n=s.scene.getElement(e);if(!n)return;let{textAlign:i,verticalAlign:a}=n,o=s.scene.getNonDeletedElementsMap();if(n&&M(n)){let e=n.x,c=n.y,d=so(n,s.scene.getNonDeletedElementsMap()),f=n.width,m=n.height,g=n.width,_=n.height;if(d&&n.containerId){if(jt(d)){let t=I.getBoundTextElementPosition(d,n,o);e=t.x,c=t.y}let t=l(n,p),r;if(t?r=Cr(d.id,d.height):(r=kr[d.id],r||=Cr(d.id,d.height)),g=Ne(d,n),_=_e(d,n),!jt(d)&&m>_){let e=je(m,d.type);s.scene.mutateElement(d,{height:e}),ue(d,s.scene);return}else if(!jt(d)&&d.height>r.height&&m<_){let e=je(m,d.type);s.scene.mutateElement(d,{height:e}),ue(d,s.scene)}else{let{x:t,y:r}=ui(d,n,o);e=t,c=r}}let[v,y]=r(e,c);d?f+=.5:(g=(t.width-8-v)/t.zoom.value,f=Math.min(f,g)),m*=1.05;let b=u(n),x=(t.height-y)/t.zoom.value;Object.assign(p.style,{font:b,lineHeight:n.lineHeight,width:`${f}px`,height:`${m}px`,left:`${v}px`,top:`${y}px`,transform:Xj(f,m,To(n,d),t,g,x),textAlign:i,verticalAlign:a,color:t.theme===R.DARK?D(n.strokeColor):n.strokeColor,opacity:n.opacity/100,maxHeight:`${x}px`}),p.scrollTop=0,h()&&(p.style.fontFamily=yo(n)),s.scene.mutateElement(n,{x:e,y:c})}},p=document.createElement(`textarea`);p.dir=`auto`,p.tabIndex=0,p.dataset.type=`wysiwyg`,p.wrap=`off`,p.classList.add(`excalidraw-wysiwyg`);let m=`pre`,g=`normal`;(ya(i)||!i.autoResize)&&(m=`pre-wrap`,g=`break-word`),Object.assign(p.style,{position:`absolute`,display:`inline-block`,minHeight:`1em`,backfaceVisibility:`hidden`,margin:0,padding:0,border:0,outline:0,resize:`none`,background:`transparent`,overflow:`hidden`,zIndex:`var(--zIndex-wysiwyg)`,wordBreak:g,whiteSpace:m,overflowWrap:`break-word`,boxSizing:`content-box`}),p.value=i.originalText,f(),t&&(p.onpaste=async e=>{let t=ET(e),n=null;if(t.has(hs.excalidrawClipboard)||t.has(hs.excalidraw)){e.preventDefault(),n=await DT(e);try{let e=await OT(n);if(e.elements){let t=As(e.elements);if(t){let{selectionStart:e,selectionEnd:n,value:r}=p;p.value=r.slice(0,e)+t+r.slice(n),p.selectionStart=p.selectionEnd=e+t.length,p.dispatchEvent(new Event(`input`))}}return}catch{console.warn(`failed to parse excalidraw clipboard data`)}}n||=await DT(e);let r=n.findByType(hs.text);if(!r)return;let a=Va(r.value);if(!a)return;let o=so(i,s.scene.getNonDeletedElementsMap()),c=u({fontSize:s.state.currentItemFontSize,fontFamily:s.state.currentItemFontFamily});if(o){let e=ut(o,s.scene.getNonDeletedElementsMap()),t=bs(Jt(`${p.value}${a}`,c,Ne(o,e)),c);p.style.width=`${t}px`}},p.oninput=()=>{let e=Va(p.value);if(p.value!==e){let t=p.selectionStart;p.value=e,p.selectionStart=t,p.selectionEnd=t}t(p.value)}),p.onkeydown=e=>{if(!e.shiftKey&&Qw.keyTest(e))e.preventDefault(),s.actionManager.executeAction(Qw),f();else if(!e.shiftKey&&$w.keyTest(e))e.preventDefault(),s.actionManager.executeAction($w),f();else if(!e.shiftKey&&eT.keyTest(e))e.preventDefault(),s.actionManager.executeAction(eT),f();else if(Mw.keyTest(e))s.actionManager.executeAction(Mw);else if(Nw.keyTest(e))s.actionManager.executeAction(Nw);else if(e.key===N.ESCAPE)e.preventDefault(),C=!0,w();else if(WT.keyTest(e))e.preventDefault(),w(),s.actionManager.executeAction(WT);else if(e.key===N.ENTER&&e[N.CTRL_OR_CMD]){if(e.preventDefault(),e.isComposing||e.keyCode===229)return;C=!0,w()}else if(e.key===N.TAB||e[N.CTRL_OR_CMD]&&(e.code===Gs.BRACKET_LEFT||e.code===Gs.BRACKET_RIGHT)){if(e.preventDefault(),e.isComposing)return;e.shiftKey||e.code===Gs.BRACKET_LEFT?b():y(),p.dispatchEvent(new Event(`input`))}};let _=` `.repeat(4),v=RegExp(`^ {1,4}`),y=()=>{let{selectionStart:e,selectionEnd:t}=p,n=x(),r=p.value;n.forEach(e=>{r=`${r.slice(0,e)}${_}${r.slice(e)}`}),p.value=r,p.selectionStart=e+4,p.selectionEnd=t+4*n.length},b=()=>{let{selectionStart:e,selectionEnd:t}=p,n=x(),r=[],i=p.value;n.forEach(e=>{let t=i.slice(e,e+4).match(v);t&&(i=`${i.slice(0,e)}${i.slice(e+t[0].length)}`,r.push(e))}),p.value=i,r.length&&(e>r[r.length-1]?p.selectionStart=Math.max(e-4,r[r.length-1]):p.selectionStart=e,p.selectionEnd=Math.max(p.selectionStart,t-4*r.length))},x=()=>{let{selectionStart:e,selectionEnd:t,value:n}=p,r=n.slice(0,e).match(/[^\n]*$/)[0].length;return e-=r,n.slice(e,t).split(`
|
|
62
|
+
`).reduce((t,n,r,i)=>t.concat(r?t[r-1]+i[r-1].length+1:e),[]).reverse()},S=e=>{e.target instanceof HTMLCanvasElement&&(e.preventDefault(),e.stopPropagation())},C=!1,w=()=>{if(ne)return;ne=!0,T();let e=s.scene.getElement(i.id);if(!e)return;let t=so(e,s.scene.getNonDeletedElementsMap());if(t){if(p.value.trim()){let e=rt(t);!e||e!==i.id?s.scene.mutateElement(t,{boundElements:(t.boundElements||[]).concat({type:`text`,id:i.id})}):jt(t)&&qa(t)}else s.scene.mutateElement(t,{boundElements:t.boundElements?.filter(e=>!M(e))});Zi(e,t,s.scene)}n({viaKeyboard:C,nextOriginalText:p.value})},T=()=>{p.onblur=null,p.oninput=null,p.onkeydown=null,j&&j.disconnect(),window.removeEventListener(`resize`,f),window.removeEventListener(`wheel`,S,!0),window.removeEventListener(`pointerdown`,k),window.removeEventListener(`pointerup`,E),window.removeEventListener(`blur`,w),window.removeEventListener(`beforeunload`,w),ee(),A(),te(),p.remove()},E=e=>{window.removeEventListener(`pointerup`,E);let t=e?.target,n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`),i=(t instanceof HTMLElement||t instanceof SVGElement)&&(!!t.closest(`.${Qn.SHAPE_ACTIONS_MENU}`)||!!t.closest(`.compact-shape-actions-island`));setTimeout(()=>{i||n||r||(p.onblur=w,p.focus())})},O=()=>{p.onblur=null,window.addEventListener(`pointerup`,E),window.addEventListener(`blur`,w)},k=e=>{let t=e?.target;if(e.button===dn.WHEEL){t instanceof HTMLTextAreaElement&&(e.preventDefault(),s.handleCanvasPanUsingWheelOrSpaceDrag(e)),O();return}let n=t instanceof HTMLElement&&t.classList.contains(`properties-trigger`),r=(t instanceof HTMLElement||t instanceof SVGElement)&&!!t.closest(`.properties-content`);(e.target instanceof HTMLElement||e.target instanceof SVGElement)&&(e.target.closest(`.${Qn.SHAPE_ACTIONS_MENU}, .${Qn.ZOOM_ACTIONS}`)||e.target.closest(`.compact-shape-actions-island`))&&!Wr(e.target)||n||r?O():e.target instanceof HTMLCanvasElement&&!h()&&requestAnimationFrame(()=>{w()})},A=s.onChangeEmitter.on(e=>{s.state.theme!==d&&f()}),ee=s.scene.onUpdate(()=>{f(),document.activeElement?.closest(`.properties-content`)||p.focus()}),te=s.onScrollChangeEmitter.on(()=>{f()}),ne=!1;c&&p.select(),E();let j=null;return a&&`ResizeObserver`in window?(j=new window.ResizeObserver(()=>{f()}),j.observe(a)):window.addEventListener(`resize`,f),p.onpointerdown=e=>e.stopPropagation(),requestAnimationFrame(()=>{window.addEventListener(`pointerdown`,k,{capture:!0})}),window.addEventListener(`beforeunload`,w),o?.querySelector(`.excalidraw-textEditorContainer`).appendChild(p),w},Qj=4,$j=6,eM=`rgba(0,0,0,0.3)`,tM=(e,t,n,r)=>{if(!e.size)return{horizontal:null,vertical:null};let[i,a,o,s]=Ii(e),c=t/r.zoom.value,l=n/r.zoom.value,u={top:parseInt(yn(`sat`))||0,bottom:parseInt(yn(`sab`))||0,left:parseInt(yn(`sal`))||0,right:parseInt(yn(`sar`))||0},d=My().rtl,f=-r.scrollX+u.left,p=-r.scrollY+u.top,m=f+c-u.right,h=p+l-u.bottom,g=Math.min(i,f),_=Math.min(a,p),v=Math.max(o,m),y=Math.max(s,h),b=o-i,x=s-a,S=v-g,C=y-_,w=Math.max(Qj*2,u.left+u.right)+$j*2,T=c/S*t-w,E=Math.max(Qj*2,u.top+u.bottom)+$j*2,D=l/C*n-E,O=S>b?S*r.zoom.value/(T+w):t/(T+w),k=C>x?C*r.zoom.value/(D+E):n/(D+E);return{horizontal:f===g&&m===v?null:{x:Math.max(u.left,Qj)+$j+(f-g)/S*t,y:n-$j-Math.max(Qj,u.bottom),width:T,height:$j,deltaMultiplier:O},vertical:p===_&&h===y?null:{x:d?Math.max(u.left,Qj):t-$j-Math.max(u.right,Qj),y:Math.max(u.top,Qj)+$j+(p-_)/C*n,width:$j,height:D,deltaMultiplier:k}}},nM=(e,t,n)=>{let[r,i]=[e.horizontal,e.vertical].map(e=>e!=null&&e.x<=t&&t<=e.x+e.width&&e.y<=n&&n<=e.y+e.height);return{isOverEither:r||i,isOverHorizontal:r,isOverVertical:i}},rM=e=>RegExp(`^(?:%%{.*?}%%[\\s\\n]*)?\\b(?:${[`flowchart`,`graph`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`stateDiagram-v2`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitGraph`,`C4Context`,`mindmap`,`timeline`,`zenuml`,`sankey`,`xychart`,`block`].map(e=>`\\s*${e}(-beta)?`).join(`|`)})\\b`).test(e.trim()),iM=e=>{let{lassoPath:t,elements:n,elementsMap:r,elementsSegments:i,intersectedElements:a,enclosedElements:o,simplifyDistance:s}=e,c=t;s&&(c=Ov(t,s));let l=n.filter(e=>!e.locked);o.clear(),a.clear();let u=t.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[0]),Math.max(e[3],t[1])],[1/0,1/0,-1/0,-1/0]);for(let e of l)oe(u,m(e,r))&&!a.has(e.id)&&!o.has(e.id)&&(aM(c,e,i)?o.add(e.id):oM(c,e,r)&&a.add(e.id));return{selectedElementIds:[...a,...o]}},aM=(e,t,n)=>{let r=Cn(e),i=n.get(t.id);return i?i.some(e=>e.some(e=>Ke(e,r))):!1},oM=(e,t,n)=>{let r=e.slice(1).map((t,n)=>us(e[n],t)).concat([us(e[e.length-1],e[0])]),i=ut(t,n);return r.some(e=>rr(t,n,e,0,!0).length>0||!!i&&rr({...i,...ui(t,i,n)},n,e,0,!0).length>0)},sM=class extends Gj{constructor(e,t){super(e,t,{animateTrail:!0,streamline:.4,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/(1/0)),n=(5e3-Math.min(5e3,e.totalLength-e.currentIndex))/5e3;return Math.min(Oe(n),Oe(t))},fill:()=>`rgba(105,101,219,0.05)`,stroke:()=>`rgba(105,101,219)`}),i(this,`intersectedElements`,new Set),i(this,`enclosedElements`,new Set),i(this,`elementsSegments`,null),i(this,`canvasTranslate`,null),i(this,`keepPreviousSelection`,!1),i(this,`selectElementsFromIds`,e=>{this.app.setState(t=>{let n=e.reduce((e,t)=>(e[t]=!0,e),{});if(this.keepPreviousSelection)for(let e of Object.keys(t.selectedElementIds))n[e]=!0;for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&M(t)){let e=so(t,this.app.scene.getNonDeletedElementsMap());e&&(n[e.id]=!0,delete n[t.id])}}for(let[e]of Object.entries(n)){let t=this.app.scene.getNonDeletedElement(e);if(t&&L(t)){let e=Di(this.app.scene.getNonDeletedElementsMap(),t.id);for(let t of e)delete n[t.id]}}let r=Hr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.app.scene.getNonDeletedElements(),t,this.app),i=[...Object.keys(r.selectedElementIds)],a=[...Object.keys(r.selectedGroupIds)];return{selectedElementIds:r.selectedElementIds,selectedGroupIds:r.selectedGroupIds,selectedLinearElement:i.length===1&&!a.length&&b(this.app.scene.getNonDeletedElement(i[0]))?new I(this.app.scene.getNonDeletedElement(i[0]),this.app.scene.getNonDeletedElementsMap()):null}})}),i(this,`addPointToPath`,(e,t,n=!1)=>{super.addPointToPath(e,t),this.keepPreviousSelection=n,this.updateSelection()}),i(this,`updateSelection`,()=>{let e=super.getCurrentTrail()?.originalPoints?.map(e=>O(e[0],e[1])),t={scrollX:this.app.state.scrollX,scrollY:this.app.state.scrollY,zoom:this.app.state.zoom.value};if(!this.elementsSegments||!ji(t,this.canvasTranslate??{})){this.canvasTranslate=t,this.elementsSegments=new Map;let e=lr(this.app.visibleElements);for(let t of this.app.visibleElements){let n=Za(t,e);this.elementsSegments.set(t.id,n)}}if(e){let{selectedElementIds:t}=iM({lassoPath:e,elements:this.app.visibleElements,elementsMap:this.app.scene.getNonDeletedElementsMap(),elementsSegments:this.elementsSegments,intersectedElements:this.intersectedElements,enclosedElements:this.enclosedElements,simplifyDistance:5/this.app.state.zoom.value});this.selectElementsFromIds(t)}})}startPath(e,t,n=!1){this.endPath(),super.startPath(e,t),this.intersectedElements.clear(),this.enclosedElements.clear(),this.keepPreviousSelection=n,this.keepPreviousSelection||this.app.setState({selectedElementIds:{},selectedGroupIds:{},selectedLinearElement:null})}endPath(){super.endPath(),super.clearTrails(),this.intersectedElements.clear(),this.enclosedElements.clear(),this.elementsSegments=null}},cM=class extends Gj{constructor(e,t){super(e,t,{streamline:.2,size:5,keepHead:!0,sizeMapping:e=>{let t=Math.max(0,1-(performance.now()-e.pressure)/200),n=(10-Math.min(10,e.totalLength-e.currentIndex))/10;return Math.min(Oe(n),Oe(t))},fill:()=>t.state.theme===R.LIGHT?`rgba(0, 0, 0, 0.2)`:`rgba(255, 255, 255, 0.2)`}),i(this,`elementsToErase`,new Set),i(this,`groupsToErase`,new Set)}startPath(e,t){this.endPath(),super.startPath(e,t),this.elementsToErase.clear()}addPointToPath(e,t,n=!1){return super.addPointToPath(e,t),this.updateElementsToBeErased(n)}updateElementsToBeErased(e){let t=super.getCurrentTrail()?.originalPoints?.map(e=>O(e[0],e[1]))||[];if(t.length<2)return[];let n=us(t[t.length-1],t[t.length-2]),r=this.app.visibleElements.filter(e=>!e.locked),i=lr(r);for(let t of r)if(e&&this.elementsToErase.has(t.id)){if(lM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(this.groupsToErase.has(e)){let t=Ki(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.delete(e.id);this.groupsToErase.delete(e)}if(ya(t)&&this.elementsToErase.delete(t.containerId),xr(t)){let e=rt(t);e&&this.elementsToErase.delete(e)}this.elementsToErase.delete(t.id)}}else if(!e&&!this.elementsToErase.has(t.id)&&lM(n,t,i,this.app.state.zoom.value)){let e=t.groupIds.at(-1);if(!this.groupsToErase.has(e)){let t=Ki(this.app.scene.getNonDeletedElementsMap(),e);for(let e of t)this.elementsToErase.add(e.id);this.groupsToErase.add(e)}if(xr(t)){let e=rt(t);e&&this.elementsToErase.add(e)}ya(t)&&this.elementsToErase.add(t.containerId),this.elementsToErase.add(t.id)}return Array.from(this.elementsToErase)}endPath(){super.endPath(),super.clearTrails(),this.elementsToErase.clear(),this.groupsToErase.clear()}},lM=(e,t,n,r)=>{let i=e[1],a=Js(t)?15:t.strokeWidth/2,o=[Math.min(e[0][0],e[1][0])-a,Math.min(e[0][1],e[1][1])-a,Math.max(e[0][0],e[1][0])+a,Math.max(e[0][1],e[1][1])+a],s=m(t,n);if(!oe(o,[s[0]-a,s[1]-a,s[2]+a,s[3]+a]))return!1;if(en(t)&&fs(i,t,n))return!0;if(Js(t)){let i=kt(t),a=ks(t,i,n),o=Math.max(2.25,5/r);for(let t of a)if(pe(t,e)<=o)return!0;let s=Ks(...i.map(([e,n])=>O(t.x+e,t.y+n)));return!!Ke(e[0],s)}let c=ut(t,n);if(jt(t)||ca(t)&&!t.polygon){let i=Math.max(t.strokeWidth,t.strokeWidth*2/r),a=Za(t,n);for(let t of a)if(pe(t,e)<=i)return!0;return!1}return rr(t,n,e,0,!0).length>0||!!c&&rr({...c,...ui(t,c,n)},n,e,0,!0).length>0},uM=44,dM=22,fM=66,pM=48,mM=14,hM=304,gM=320,_M=5.87,vM=28,yM=4,bM=2,xM=10,SM=10,CM=8,wM=12,TM=256,EM=10,DM=4,OM=wM*2,kM=wM*2,AM=100,jM=140,MM=.35,NM=wM/2,PM=20,FM=wM*2,IM=wM,LM={fillStyle:`hachure`,fontFamily:$r,fontSize:20,opacity:100,roughness:1,strokeColor:hi.black,roundness:null,strokeStyle:`solid`,strokeWidth:1,verticalAlign:Lr.MIDDLE,locked:!1},RM=Vo(4),zM=e=>e.labels?.length??e.series[0]?.values.length??0,BM=(e,t)=>{if(!e)return!1;let n=zM(e);return n<2?!1:t===`radar`?n>=3:!0},VM=(e,t)=>e+(t<=1?0:Math.min(fM,(t-1)*dM)),HM=(e,t)=>{if(e===`line`){let e=VM(pM,t);return{slotWidth:e,gap:mM,chartHeight:gM,xLabelMaxWidth:e+mM*3+xM}}let n=VM(uM,t);return{slotWidth:n,gap:mM,chartHeight:hM,xLabelMaxWidth:n+mM*3+xM}},UM=(e,t)=>({chartWidth:(t.slotWidth+t.gap)*e.series[0].values.length+t.gap,chartHeight:t.chartHeight+t.gap*2}),WM=()=>({chartWidth:TM+kM*2,chartHeight:TM+kM*2}),GM=(e,t,n)=>{let r=Math.abs(e-t);return Math.min(r,n-r)},KM=(e,t)=>{if(e<=0||RM.length===0)return[];let n=RM.length,r=(t%n+n)%n,i=[r],a=Math.min(e,n),o=new Set(Array.from({length:n},(e,t)=>t).filter(e=>e!==r));for(;i.length<a;){let e=-1,t=-1,r=-1;for(let a of o){let o=i.map(e=>GM(a,e,n)),s=Math.min(...o),c=o.reduce((e,t)=>e+t,0)/o.length;(s>t||s===t&&c>r)&&(e=a,t=s,r=c)}i.push(e),o.delete(e)}return Array.from({length:e},(e,t)=>RM[i[t%i.length]])},qM=e=>{if(RM.length===0)return 0;if(typeof e!=`number`||!Number.isFinite(e))return Math.floor(Math.random()*RM.length);let t=e.toString(),n=0;for(let e=0;e<t.length;e++)n=n*31+t.charCodeAt(e)|0;return Math.abs(n)%RM.length},JM=e=>RM[e],YM=(e,t)=>{let n=e.flatMap(e=>e.values.map(e=>Math.max(0,e))),r=n.filter(e=>e>0),i=Math.max(1,...n),a=r.length>0?Math.min(...r):1,o=e.length===1&&a>0&&i/a>=AM;return{renderSteps:!1,normalize:(e,t)=>{let n=Math.max(0,e);return o?Math.log10(n+1)/Math.log10(i+1):n/i}}},XM=e=>/\s/.test(e.trim()),ZM=(e,t,n)=>XM(e)?Jt(e,t,n):e,QM=(e,t,n,r,i,a)=>{let o=to.Excalifont,s=os.sm,c=ba(o),l=u({fontFamily:o,fontSize:s}),d=Math.min(jM,i*(e.length>8?.56:.72)),f=Xs(l,c),p=e.map((e,u)=>{let p=t[u],m=Math.max(0,...e.trim().split(/\s+/).filter(Boolean).map(e=>gn(e,l,c).width)),h=ZM(e,l,Math.max(f,d,m)),g=gn(h,l,c),_=Math.cos(p),v=Math.sin(p),y=_>MM?`left`:_<-MM?`right`:`center`,b=y===`center`?g.width/2:0,x=OM+(Math.abs(_)*b+Math.abs(v)*(g.height/2))+NM,S=n+_*(i+x),C=r+v*(i+x),w=v>MM?wM/3:v<-MM?-wM/3:0;return Li({backgroundColor:a,...LM,text:h,originalText:e,x:S,y:C+w,fontFamily:o,fontSize:s,lineHeight:c,textAlign:y,verticalAlign:`middle`})});return{axisLabels:p,axisLabelTopY:Math.min(...p.map(e=>e.y)),axisLabelBottomY:Math.max(...p.map(e=>e.y+e.height))}},$M=(e,t,n,r,i,a)=>{if(e.length<=1)return[];let o=to[`Lilita One`],s=os.lg,c=ba(o),l=u({fontFamily:o,fontSize:s}),d=e.map((e,n)=>{let r=e.title?.trim()||`Series ${n+1}`,i=ZM(r,l,TM),a=gn(i,l,c),o=PM+IM+a.width;return{label:r,displayLabel:i,color:t[n],width:o,height:a.height}}),f=Math.max(PM/2,...d.map(e=>e.height/2)),p=Math.max(i,r+f+OM),m=FM,h=PM*.6,g=d.reduce((e,t)=>e+t.width,0)+FM*Math.max(0,d.length-1),_=g+m*2,v=f*2+h*2,y=[];y.push(cn({...LM,backgroundColor:`transparent`,type:`rectangle`,fillStyle:`solid`,strokeColor:hi.black,x:n-_/2,y:p-v/2,width:_,height:v,roughness:Ia.architect,roundness:{type:Xa.PROPORTIONAL_RADIUS}}));let b=n-g/2;return d.forEach(e=>{y.push(cn({...LM,backgroundColor:e.color,type:`rectangle`,x:b,y:p-PM/2,width:PM,height:PM,fillStyle:`solid`,strokeColor:e.color,roughness:Ia.architect,roundness:{type:Xa.PROPORTIONAL_RADIUS}})),y.push(Li({...LM,text:e.displayLabel,originalText:e.label,autoResize:!1,x:b+PM+IM,y:p,fontFamily:o,fontSize:s,lineHeight:c,textAlign:`left`,verticalAlign:`middle`})),b+=e.width+FM}),y},eN=(e,t,n,r)=>{if(gn(e,n,r).width<=t)return e;let i=e.length;for(;i>1;){let a=`${e.slice(0,i)}...`;if(gn(a,n,r).width<=t)return a;i--}return e[0]?`${e[0]}...`:e},tN=(e,t,n,r)=>{if(gn(e,n,r).width<=t)return{wrapped:!1,text:e};let i=e.trim().split(/\s+/).filter(Boolean);return i.length>1&&!i.some(e=>gn(e,n,r).width>t)&&t>=Xs(n,r)?{wrapped:!0,text:Jt(e,n,t)}:{wrapped:!1,text:eN(e,t,n,r)}},nN=(e,t,n)=>{let r=Math.abs(Math.cos(n)),i=Math.abs(Math.sin(n));return{width:e*r+t*i,height:e*i+t*r}},rN=e=>e.includes(`...`),iN=(e,t,n,r,i)=>{let a=Math.max(vM,Math.ceil(Xs(r,i))),o=Math.max(a,Math.floor(t)),s=[];for(let e=o;e>=a;e-=4)s.push(e);s[s.length-1]!==a&&s.push(a);let c=e=>({ellipsified:rN(e.text),visibleChars:e.text.replace(/\.\.\./g,``).replace(/\n/g,``).length,lineCount:e.text.split(`
|
|
63
|
+
`).length}),l=(e,t)=>{let n=c(e),r=c(t);return n.ellipsified===r.ellipsified?n.visibleChars===r.visibleChars?n.lineCount===r.lineCount?e.rotatedHeight<t.rotatedHeight:n.lineCount<r.lineCount:n.visibleChars>r.visibleChars:!n.ellipsified},u=null,d=null,f=null;for(let t of s){let{wrapped:a,text:o}=tN(e,t,r,i),s=gn(o,r,i),c=nN(s.width,s.height,_M),p={originalText:e,text:o,metrics:s,rotatedWidth:c.width,rotatedHeight:c.height,wrapped:a},m=c.width-n;if(m<=0){(!u||l(p,u))&&(u=p);continue}(!d||m<d.overflow||m===d.overflow&&l(p,d.spec))&&(d={overflow:m,spec:p}),!rN(p.text)&&(!f||m<f.overflow||m===f.overflow&&l(p,f.spec))&&(f={overflow:m,spec:p})}return u||(f&&d&&f.overflow<=d.overflow+CM?f.spec:d.spec)},aN=e=>{if(e.type!==`text`)return e.y+e.height;let t=nN(e.width,e.height,e.angle);return e.y+e.height/2+t.height/2},oN=(e,t,n,r,i)=>{let a=LM.fontFamily,o=os.sm,s=ba(a),c=u({fontFamily:a,fontSize:o}),l=Math.max(1,i.slotWidth+i.gap-yM*2+SM),d=n;return e.labels?.map((e,n)=>{let a=iN(e,i.xLabelMaxWidth,l,c,s),u=t+n*(i.slotWidth+i.gap)+i.gap+i.slotWidth/2,f=d+bM+(a.rotatedHeight-a.metrics.height)/2;return Li({backgroundColor:r,...LM,text:a.text,originalText:a.wrapped?e:a.text,autoResize:!a.wrapped,x:u,y:f,angle:_M,fontSize:o,lineHeight:s,textAlign:`center`,verticalAlign:`top`})})||[]},sN=(e,t,n,r,i,a=Math.max(...e.series[0].values))=>{let o=Li({backgroundColor:r,...LM,x:t-i.gap,y:n-i.gap,text:`0`,textAlign:`right`});return[o,Li({backgroundColor:r,...LM,x:t-i.gap,y:n-i.chartHeight-o.height/2,text:a.toLocaleString(),textAlign:`right`})]},cN=(e,t,n,r,i)=>{let{chartWidth:a,chartHeight:o}=UM(e,i);return[Tn({backgroundColor:r,...LM,type:`line`,x:t,y:n,width:a,points:[O(0,0),O(a,0)]}),Tn({backgroundColor:r,...LM,type:`line`,x:t,y:n,height:o,points:[O(0,0),O(0,-o)]}),Tn({backgroundColor:r,...LM,type:`line`,x:t,y:n-i.chartHeight-i.gap,strokeStyle:`dotted`,width:a,opacity:EM,points:[O(0,0),O(a,0)]})]},lN=(e,t,n,r,i,a=Math.max(...e.series[0].values),o)=>{let{chartWidth:s,chartHeight:c}=UM(e,i),l=e.title?Li({backgroundColor:r,...LM,text:e.title,x:t+s/2,y:n-i.chartHeight-i.gap*2-20,roundness:null,textAlign:`center`,fontSize:os.xl,fontFamily:to[`Lilita One`]}):null,u=o?cn({backgroundColor:r,...LM,type:`rectangle`,x:t,y:n-c,width:s,height:c,strokeColor:hi.black,fillStyle:`solid`,opacity:6}):null;return[...u?[u]:[],...l?[l]:[],...oN(e,t,n,r,i),...sN(e,t,n,r,i,a),...cN(e,t,n,r,i)]},uN=(e,t,n,r)=>{let i=e.series,a=HM(`bar`,i.length),o=Math.max(1,...i.flatMap(e=>e.values.map(e=>Math.max(0,e)))),s=qM(r),c=JM(s),l=KM(i.length,s),u=i.length>1?Math.max(1,Math.floor(a.gap/(i.length+1))):0,d=i.length>1?Math.max(2,(a.slotWidth-u*(i.length-1))/i.length):a.slotWidth,f=i.length*d+u*(i.length-1),p=(a.slotWidth-f)/2,m=i[0].values.flatMap((e,r)=>i.map((e,s)=>{let f=Math.max(0,e.values[r]??0)/o*a.chartHeight,m=i.length>1?l[s]:c;return cn({backgroundColor:m,...LM,type:`rectangle`,fillStyle:i.length>1?`solid`:LM.fillStyle,strokeColor:i.length>1?m:LM.strokeColor,x:t+r*(a.slotWidth+a.gap)+a.gap+p+s*(d+u),y:n-f-a.gap,width:d,height:f})})),h=lN(e,t,n,c,a,o,Vt()),g=oN(e,t,n,c,a),_=Math.max(n+a.gap/2,...g.map(e=>aN(e))),{chartWidth:v}=UM(e,a),y=$M(i,l,t+v/2,_,n+a.gap*5,c);return[...h,...m,...y]},dN=(e,t,n,r)=>{let i=e.series,a=HM(`line`,i.length),o=Math.max(1,...i.flatMap(e=>e.values)),s=qM(r),c=JM(s),l=KM(i.length,s),u=i.map((e,r)=>{let i=e.values.map((e,t)=>O(t*(a.slotWidth+a.gap),-(e/o)*a.chartHeight)),s=Math.max(...i.map(e=>e[0])),c=Math.max(...i.map(e=>e[1])),u=Math.min(...i.map(e=>e[0])),d=Math.min(...i.map(e=>e[1]));return Tn({backgroundColor:`transparent`,...LM,type:`line`,x:t+a.gap+a.slotWidth/2,y:n-a.gap,height:c-d,width:s-u,strokeColor:l[r],strokeWidth:2,points:i})}),d=i.flatMap((e,r)=>e.values.map((e,i)=>{let s=i*(a.slotWidth+a.gap)+a.gap/2,c=-(e/o)*a.chartHeight+a.gap/2;return cn({backgroundColor:l[r],...LM,fillStyle:`solid`,strokeColor:l[r],strokeWidth:2,type:`ellipse`,x:t+s+a.slotWidth/2,y:n+c-a.gap*2,width:a.gap,height:a.gap})})),f=i[0].values.map((e,t)=>Math.max(0,...i.map(e=>e.values[t]??0))).map((e,r)=>{let i=r*(a.slotWidth+a.gap)+a.gap/2,s=e/o*a.chartHeight+a.gap/2+a.gap;return Tn({backgroundColor:c,...LM,type:`line`,x:t+i+a.slotWidth/2+a.gap/2,y:n-s,height:s,strokeStyle:`dotted`,opacity:EM,points:[O(0,0),O(0,s)]})}),p=lN(e,t,n,c,a,o,Vt()),m=oN(e,t,n,c,a),h=Math.max(n+a.gap/2,...m.map(e=>aN(e))),{chartWidth:g}=UM(e,a),_=$M(i,l,t+g/2,h,n+a.gap*5,c);return[...p,...u,...f,...d,..._]},fN=e=>{let t=/^([-+]?)[$\u20AC\u00A3\u00A5\u20A9]?([-+]?)([\d.,]+)[%]?$/.exec(e);return t?parseFloat(`${(t[1]||t[2])+t[3]}`.replace(/,/g,``)):null},pN=(e,t)=>e.slice(1).every(e=>fN(e[t])!==null),mN=e=>{let t=e[0].length;if(t>2){let n=e[0].every(e=>fN(e)===null),r=n?e.slice(1):e;if(r.length<1)return{ok:!1,reason:`No data rows`};if(r.some(e=>e.slice(1).some(e=>fN(e)===null)))return{ok:!1,reason:`Value is not numeric`};if(t-1>r.length){let t=n?e[0].slice(1).map(e=>e.trim()):null,i=r.map(e=>({title:e[0]?.trim()||null,values:e.slice(1).map(e=>fN(e))}));return{ok:!0,data:{title:i.length===1?i[0].title:n&&e[0][0].trim()||null,labels:t,series:i}}}let i=e[0].slice(1).map((e,t)=>{let i=t+1,a=`Series ${i}`;return{title:n&&e.trim()||a,values:r.map(e=>fN(e[i]))}});return{ok:!0,data:{title:n&&e[0][0].trim()||null,labels:r.map(e=>e[0]),series:i}}}if(t===1){if(!pN(e,0))return{ok:!1,reason:`Value is not numeric`};let t=fN(e[0][0])===null,n=t?e[0][0]:null,r=(t?e.slice(1):e).map(e=>fN(e[0]));return r.length<2?{ok:!1,reason:`Less than two rows`}:{ok:!0,data:{title:n,labels:null,series:[{title:n,values:r}]}}}let n=fN(e[0][1])===null,r=n?e.slice(1):e;if(r.length<2)return{ok:!1,reason:`Less than 2 rows`};if(r.some(e=>fN(e[1])===null))return{ok:!1,reason:`Value is not numeric`};let i=n?e[0][1]:null;return{ok:!0,data:{title:i,labels:r.map(e=>e[0]),series:[{title:i,values:r.map(e=>fN(e[1]))}]}}},hN=e=>{let t=t=>e.replace(/\r\n?/g,`
|
|
64
|
+
`).split(`
|
|
65
|
+
`).filter(e=>e.trim().length>0).map(e=>e.split(t).map(e=>e.trim())),n=[` `,`,`,`;`].map(e=>{let n=t(e),r=n[0]?.length??0;return{delimiter:e,parsed:n,numCols:r,isConsistent:n.length>0&&n.every(e=>e.length===r)}}),r=(n.find(e=>e.isConsistent&&e.numCols>1)??n.find(e=>e.isConsistent)??n[0]).parsed;if(r.length===0)return{ok:!1,reason:`No values`};let i=r[0].length;return r.every(e=>e.length===i)?mN(r):{ok:!1,reason:`All rows don't have same number of columns`}},gN=(e,t,n,r)=>{if(!BM(e,`radar`))return null;let i=e.labels??e.series[0].values.map((e,t)=>`Value ${t+1}`),a=e.series,{normalize:o,renderSteps:s}=YM(a,i.length),c=qM(r),l=JM(c),d=KM(a.length,c),{chartWidth:f,chartHeight:p}=WM(),m=t+f/2,h=n-p/2,g=TM/2,_=i.map((e,t)=>-Math.PI/2+Math.PI*2*t/i.length),{axisLabels:v,axisLabelTopY:y,axisLabelBottomY:b}=QM(i,_,m,h,g,l),x=to[`Lilita One`],S=os.xl,C=ba(x),w=u({fontFamily:x,fontSize:S}),T=e.title?ZM(e.title,w,f+OM*2):null,E=T?gn(T,w,C):null,D=T?Li({backgroundColor:l,...LM,text:T,originalText:e.title??T,x:t+f/2,y:y-OM-E.height/2,fontFamily:x,fontSize:S,lineHeight:C,textAlign:`center`}):null,k=s?Array.from({length:DM},(e,t)=>{let n=g*((t+1)/DM),r=_.map(e=>O(Math.cos(e)*n,Math.sin(e)*n));return r.push(O(r[0][0],r[0][1])),Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:n*2,height:n*2,strokeStyle:`solid`,roughness:Ia.architect,opacity:EM,polygon:!0,points:r})}):[],A=_.map(e=>{let t=Math.cos(e)*g,n=Math.sin(e)*g;return Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:Math.abs(t),height:Math.abs(n),strokeStyle:`solid`,roughness:Ia.architect,opacity:EM,points:[O(0,0),O(t,n)]})}),ee=a.map((e,t)=>{let n=_.map((t,n)=>{let r=o(e.values[n]??0,n)*g;return O(Math.cos(t)*r,Math.sin(t)*r)});return n.push(O(n[0][0],n[0][1])),Tn({backgroundColor:`transparent`,...LM,type:`line`,x:m,y:h,width:g*2,height:g*2,strokeColor:d[t],strokeWidth:2,polygon:!0,points:n})}),te=$M(a,d,m,b,n+wM*5,l);return[...D?[D]:[],...v,...k,...A,...ee,...te]},_N=(e,t,n,r,i)=>e===`line`?dN(t,n,r,i):e===`radar`?gN(t,n,r,i):uN(t,n,r,i),vN=()=>(0,W.jsxs)(`div`,{"data-testid":`brave-measure-text-error`,children:[(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line1`,bold:e=>(0,W.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line2`,bold:e=>(0,W.jsx)(`span`,{style:{fontWeight:600},children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line3`,link:e=>(0,W.jsx)(`a`,{href:`http://docs.excalidraw.com/docs/@excalidraw/excalidraw/faq#turning-off-aggresive-block-fingerprinting-in-brave-browser`,children:e})})}),(0,W.jsx)(`p`,{children:(0,W.jsx)(pO,{i18nKey:`errors.brave_measure_text_error.line4`,issueLink:e=>(0,W.jsx)(`a`,{href:`https://github.com/excalidraw/excalidraw/issues/new`,children:e}),discordLink:e=>(0,W.jsxs)(`a`,{href:`https://discord.gg/UexuTaE`,children:[e,`.`]})})})]}),yN=({children:e,left:t,top:n,onCloseRequest:r,fitInViewport:i=!1,offsetLeft:a=0,offsetTop:o=0,viewportWidth:s=window.innerWidth,viewportHeight:c=window.innerHeight,className:l})=>{let u=(0,H.useRef)(null);(0,H.useEffect)(()=>{let e=u.current;if(!e)return;e.contains(document.activeElement)||e.focus();let t=t=>{if(t.key===N.TAB){let n=is(e),{activeElement:r}=document,i=n.findIndex(e=>e===r);r===e?(t.shiftKey?n[n.length-1]?.focus():n[0].focus(),t.preventDefault(),t.stopImmediatePropagation()):i===0&&t.shiftKey?(n[n.length-1]?.focus(),t.preventDefault(),t.stopImmediatePropagation()):i===n.length-1&&!t.shiftKey&&(n[0]?.focus(),t.preventDefault(),t.stopImmediatePropagation())}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)},[]);let d=(0,H.useRef)(null);return(0,H.useLayoutEffect)(()=>{if(i&&u.current&&n!=null&&t!=null){let e=u.current,{width:r,height:i}=e.getBoundingClientRect();if(d.current?.top===n&&d.current?.left===t)return;d.current={top:n,left:t},r>=s?(e.style.width=`${s}px`,e.style.left=`0px`,e.style.overflowX=`scroll`):t+r-a>s?e.style.left=`${s-r-10}px`:e.style.left=`${t}px`,i>=c?(e.style.height=`${c-20}px`,e.style.top=`10px`,e.style.overflowY=`scroll`):n+i-o>c?e.style.top=`${c-i}px`:e.style.top=`${n}px`}},[n,t,i,s,c,a,o]),(0,H.useEffect)(()=>{if(r){let e=e=>{u.current?.contains(e.target)||(0,_c.unstable_batchedUpdates)(()=>r(e))};return document.addEventListener(`pointerdown`,e,!1),()=>document.removeEventListener(`pointerdown`,e,!1)}},[r]),(0,W.jsx)(`div`,{className:U(`popover`,l),ref:u,tabIndex:-1,children:e})},bN=`separator`,xN=H.memo(({actionManager:e,items:t,top:n,left:r,onClose:i})=>{let a=cz(),o=sz(),s=t.reduce((t,n)=>(n&&(n===bN||!n.predicate||n.predicate(o,a,e.app.props,e.app))&&t.push(n),t),[]);return(0,W.jsx)(yN,{onCloseRequest:()=>{i()},top:n,left:r,fitInViewport:!0,offsetLeft:a.offsetLeft,offsetTop:a.offsetTop,viewportWidth:a.width,viewportHeight:a.height,className:`context-menu-popover`,children:(0,W.jsx)(`ul`,{className:`context-menu`,onContextMenu:e=>e.preventDefault(),children:s.map((t,n)=>{if(t===bN)return!s[n-1]||s[n-1]===bN?null:(0,W.jsx)(`hr`,{className:`context-menu-item-separator`},n);let r=t.name,c=``;return t.label&&(c=typeof t.label==`function`?K(t.label(o,a,e.app)):K(t.label)),(0,W.jsx)(`li`,{"data-testid":r,onClick:()=>{i(()=>{e.executeAction(t,`contextMenu`)})},children:(0,W.jsxs)(`button`,{type:`button`,className:U(`context-menu-item`,{dangerous:r===`deleteSelectedElements`,checkmark:t.checked?.(a)}),children:[(0,W.jsx)(`div`,{className:`context-menu-item__label`,children:c}),(0,W.jsx)(`kbd`,{className:`context-menu-item__shortcut`,children:r?ND(r):``})]})},n)})})})}),SN=({height:e,width:t,userToFollow:n,onDisconnect:r})=>(0,W.jsx)(`div`,{className:`follow-mode`,style:{width:t,height:e},children:(0,W.jsxs)(`div`,{className:`follow-mode__badge`,children:[(0,W.jsxs)(`div`,{className:`follow-mode__badge__label`,children:[`Following`,` `,(0,W.jsx)(`span`,{className:`follow-mode__badge__username`,title:n.username,children:n.username})]}),(0,W.jsx)(`button`,{type:`button`,onClick:r,className:`follow-mode__disconnect-btn`,children:nx})]})}),CN=({delay:e,theme:t})=>{let[n,r]=(0,H.useState)(!!e);return(0,H.useEffect)(()=>{if(!e)return;let t=setTimeout(()=>{r(!1)},e);return()=>clearTimeout(t)},[e]),n?null:(0,W.jsxs)(`div`,{className:U(`LoadingMessage`,{"LoadingMessage--dark":t===R.DARK}),children:[(0,W.jsx)(`div`,{children:(0,W.jsx)($S,{})}),(0,W.jsx)(`div`,{className:`LoadingMessage-text`,children:K(`labels.loadingScene`)})]})},wN=`medium`,TN={CHECKED:Ky,UNCHECKED:Gy},EN=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__lock`,`ToolIcon_size_${wN}`,{"is-mobile":e.isMobile}),title:`${e.title} \u2014 Q`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":`toolbar-lock`}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:e.checked?TN.CHECKED:TN.UNCHECKED})]}),DN=e=>(0,W.jsx)(X,{className:U(`Shape`,{fillable:!1,active:e.checked}),type:`radio`,icon:Zx,name:`editor-current-shape`,checked:e.checked,title:`${e.title} \u2014 H`,keyBindingLabel:e.isMobile?void 0:N.H.toLocaleUpperCase(),"aria-label":`${e.title} \u2014 H`,"aria-keyshortcuts":N.H,"data-testid":`toolbar-hand`,onChange:()=>e.onChange?.()}),ON=[{type:`rectangle`,icon:$y,title:Ge(K(`toolBar.rectangle`))},{type:`diamond`,icon:eb,title:Ge(K(`toolBar.diamond`))},{type:`ellipse`,icon:tb,title:Ge(K(`toolBar.ellipse`))}],kN=[{type:`selection`,icon:Zy,title:Ge(K(`toolBar.selection`))},{type:`lasso`,icon:Qy,title:Ge(K(`toolBar.lasso`))}],AN=[{type:`arrow`,icon:nb,title:Ge(K(`toolBar.arrow`))},{type:`line`,icon:rb,title:Ge(K(`toolBar.line`))}],jN=({app:e,onHandToolToggle:t,setAppState:n})=>{let r=e.state.activeTool,[i,a]=(0,H.useState)(!1),[o,s]=(0,H.useState)(`rectangle`),[c,l]=(0,H.useState)(`arrow`);(0,H.useEffect)(()=>{(r.type===`rectangle`||r.type===`diamond`||r.type===`ellipse`)&&s(r.type)},[r.type]),(0,H.useEffect)(()=>{(r.type===`arrow`||r.type===`line`)&&l(r.type)},[r.type]);let u=r.type===`frame`,d=r.type===`laser`,f=r.type===`embeddable`,{TTDDialogTriggerTunnel:p}=gk(),m=(t,n)=>{e.state.activeTool.type!==t&&dC(`toolbar`,t,`ui`),t===`selection`?e.state.activeTool.type===`selection`||e.setActiveTool({type:`selection`}):e.setActiveTool({type:t})},[h,g]=(0,H.useState)(0),_=h>=316,v=h>=356,y=h>=396,b=[`text`,`frame`,`embeddable`,`laser`,`magicframe`].filter(e=>!(_&&e===`text`||v&&e===`image`||y&&e===`frame`)).includes(r.type),x=b?r.type===`text`?ob:r.type===`image`?cb:r.type===`frame`?oS:r.type===`embeddable`?mb:r.type===`laser`?dS:r.type===`magicframe`?fS:aS:aS;return(0,W.jsxs)(`div`,{className:`mobile-toolbar`,ref:e=>{e&&g(e.getBoundingClientRect().width)},children:[(0,W.jsx)(DN,{checked:Fs(e.state),onChange:t,title:K(`toolBar.hand`),isMobile:!0}),(0,W.jsx)(bk,{app:e,options:kN,activeTool:r,defaultOption:e.state.preferredSelectionTool.type,namePrefix:`selectionType`,title:Ge(K(`toolBar.selection`)),"data-testid":`toolbar-selection`,onToolChange:t=>{(t===`selection`||t===`lasso`)&&(e.setActiveTool({type:t}),n({preferredSelectionTool:{type:t,initialized:!0}}))},displayedOption:kN.find(t=>t.type===e.state.preferredSelectionTool.type)||kN[0]}),(0,W.jsx)(X,{className:U({active:r.type===`freedraw`}),type:`radio`,icon:ab,checked:r.type===`freedraw`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.freedraw`))}`,"aria-label":Ge(K(`toolBar.freedraw`)),"data-testid":`toolbar-freedraw`,onChange:()=>m(`freedraw`)}),(0,W.jsx)(X,{className:U({active:r.type===`eraser`}),type:`radio`,icon:lb,checked:r.type===`eraser`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.eraser`))}`,"aria-label":Ge(K(`toolBar.eraser`)),"data-testid":`toolbar-eraser`,onChange:()=>m(`eraser`)}),(0,W.jsx)(bk,{app:e,options:ON,activeTool:r,defaultOption:o,namePrefix:`shapeType`,title:Ge(K(o===`rectangle`?`toolBar.rectangle`:o===`diamond`?`toolBar.diamond`:o===`ellipse`?`toolBar.ellipse`:`toolBar.rectangle`)),"data-testid":`toolbar-rectangle`,onToolChange:t=>{(t===`rectangle`||t===`diamond`||t===`ellipse`)&&(s(t),e.setActiveTool({type:t}))},displayedOption:ON.find(e=>e.type===o)||ON[0]}),(0,W.jsx)(bk,{app:e,options:AN,activeTool:r,defaultOption:c,namePrefix:`linearElementType`,title:Ge(K(c===`arrow`?`toolBar.arrow`:`toolBar.line`)),"data-testid":`toolbar-arrow`,fillable:!0,onToolChange:t=>{(t===`arrow`||t===`line`)&&(l(t),e.setActiveTool({type:t}))},displayedOption:AN.find(e=>e.type===c)||AN[0]}),_&&(0,W.jsx)(X,{className:U({active:r.type===`text`}),type:`radio`,icon:ob,checked:r.type===`text`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.text`))}`,"aria-label":Ge(K(`toolBar.text`)),"data-testid":`toolbar-text`,onChange:()=>m(`text`)}),v&&(0,W.jsx)(X,{className:U({active:r.type===`image`}),type:`radio`,icon:cb,checked:r.type===`image`,name:`editor-current-shape`,title:`${Ge(K(`toolBar.image`))}`,"aria-label":Ge(K(`toolBar.image`)),"data-testid":`toolbar-image`,onChange:()=>m(`image`)}),y&&(0,W.jsx)(X,{className:U({active:u}),type:`radio`,icon:oS,checked:u,name:`editor-current-shape`,title:`${Ge(K(`toolBar.frame`))}`,"aria-label":Ge(K(`toolBar.frame`)),"data-testid":`toolbar-frame`,onChange:()=>m(`frame`)}),(0,W.jsxs)(HO,{open:i,children:[(0,W.jsx)(HO.Trigger,{className:U(`App-toolbar__extra-tools-trigger App-toolbar__extra-tools-trigger--mobile`,{"App-toolbar__extra-tools-trigger--selected":b||i}),onToggle:()=>{a(!i),n({openMenu:null,openPopup:null})},title:K(`toolBar.extraTools`),style:{width:36,height:36,display:`flex`,alignItems:`center`,justifyContent:`center`},children:x}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a(!1),onSelect:()=>a(!1),className:`App-toolbar__extra-tools-dropdown`,align:`start`,children:[!_&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`text`}),icon:ob,shortcut:N.T.toLocaleUpperCase(),"data-testid":`toolbar-text`,selected:r.type===`text`,children:K(`toolBar.text`)}),!v&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`image`}),icon:cb,"data-testid":`toolbar-image`,selected:r.type===`image`,children:K(`toolBar.image`)}),!y&&(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`frame`}),icon:oS,shortcut:N.F.toLocaleUpperCase(),"data-testid":`toolbar-frame`,selected:u,children:K(`toolBar.frame`)}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`embeddable`}),icon:mb,"data-testid":`toolbar-embeddable`,selected:f,children:K(`toolBar.embeddable`)}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setActiveTool({type:`laser`}),icon:dS,"data-testid":`toolbar-laser`,selected:d,shortcut:N.K.toLocaleUpperCase(),children:K(`toolBar.laser`)}),(0,W.jsx)(`div`,{style:{margin:`6px 0`,fontSize:14,fontWeight:600},children:`Generate`}),e.props.aiEnabled!==!1&&(0,W.jsx)(p.Out,{}),(0,W.jsx)(HO.Item,{onSelect:()=>e.setOpenDialog({name:`ttd`,tab:`mermaid`}),icon:sS,"data-testid":`toolbar-embeddable`,children:K(`toolBar.mermaidToExcalidraw`)}),e.props.aiEnabled!==!1&&e.plugins.diagramToCode&&(0,W.jsx)(W.Fragment,{children:(0,W.jsx)(HO.Item,{onSelect:()=>e.onMagicframeToolSelect(),icon:fS,"data-testid":`toolbar-magicframe`,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:K(`toolBar.magicframe`)})})]})]})]})},MN=({children:e,side:t,className:n})=>(0,W.jsx)(`div`,{className:U(`FixedSideContainer`,`FixedSideContainer_side_${t}`,n),children:e}),NN=`medium`,PN=e=>e.penDetected?(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__penMode`,`ToolIcon_size_${NN}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:ib})]}):null,FN=({appState:e,elements:t,actionManager:n,setAppState:r,onHandToolToggle:i,renderTopLeftUI:a,renderTopRightUI:o,renderSidebars:s,renderWelcomeScreen:c,UIOptions:l,app:u,onPenModeToggle:d})=>{let{WelcomeScreenCenterTunnel:f,MainMenuTunnel:p,DefaultSidebarTriggerTunnel:m}=gk();return(0,W.jsxs)(W.Fragment,{children:[s(),(0,W.jsx)(`div`,{className:`App-welcome-screen`,children:c&&(0,W.jsx)(f.Out,{})}),!e.viewModeEnabled&&(0,W.jsxs)(`div`,{className:`App-bottom-bar`,style:{marginBottom:$j+Qj},children:[(0,W.jsx)(jk,{appState:e,elementsMap:u.scene.getNonDeletedElementsMap(),renderAction:n.renderAction,app:u,setAppState:r}),(0,W.jsxs)(SC,{className:`App-toolbar`,children:[!e.viewModeEnabled&&e.openDialog?.name!==`elementLinkSelector`&&(0,W.jsx)(jN,{app:u,onHandToolToggle:i,setAppState:r}),e.scrolledOutside&&!e.openMenu&&!e.openSidebar&&(0,W.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...An(t,e)}))},children:K(`buttons.scrollBackToContent`)})]})]}),(0,W.jsx)(MN,{side:`top`,className:`App-top-bar`,children:(()=>{if(e.openDialog?.name===`elementLinkSelector`)return null;let t=(0,W.jsxs)(`div`,{className:`excalidraw-ui-top-right`,children:[o?.(!0,e)??(!e.viewModeEnabled&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(PN,{checked:e.penMode,onChange:()=>d(null),title:K(`toolBar.penMode`),isMobile:!0,penDetected:e.penDetected}),(0,W.jsx)(m.Out,{})]})),e.viewModeEnabled&&(0,W.jsx)(Ik,{actionManager:n})]});return(0,W.jsxs)(`div`,{className:`App-toolbar-content`,style:{display:`flex`,flexDirection:`row`,justifyContent:`space-between`},children:[(0,W.jsxs)(`div`,{className:`excalidraw-ui-top-left`,children:[a?.(!0,e),(0,W.jsx)(p.Out,{})]}),t]})})()})]})},IN=e=>{switch(e){case`bar`:return K(`labels.chartType_bar`);case`line`:return K(`labels.chartType_line`);case`radar`:return K(`labels.chartType_radar`);default:return e}},LN=e=>{let t=(0,H.useRef)(null),[n,r]=(0,H.useState)(null),{theme:i}=gC();(0,H.useLayoutEffect)(()=>{if(!e.spreadsheet){r(null);return}let n=_N(e.chartType,e.spreadsheet,0,0,e.colorSeed);if(!n){r(null),t.current?.replaceChildren();return}r(n);let a,o=t.current;return(async()=>(a=await be(n,{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:i===`dark`},null,{skipInliningFonts:!0}),a.querySelector(`.style-fonts`)?.remove(),o.replaceChildren(),o.appendChild(a)))(),()=>{o.replaceChildren()}},[e.spreadsheet,e.chartType,e.colorSeed,i]);let a=IN(e.chartType);return(0,W.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":a,onClick:()=>{n&&e.onClick(e.chartType,n)},children:[(0,W.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,W.jsx)(`div`,{className:`ChartPreview__label`,children:a})]})},RN=e=>{let t=(0,H.useRef)(null),{theme:n}=gC();return(0,H.useLayoutEffect)(()=>{if(!e.rawText)return;let r=Li({text:e.rawText,x:0,y:0}),i=t.current;return(async()=>{let e=await be([r],{exportBackground:!1,viewBackgroundColor:`#fff`,exportWithDarkMode:n===`dark`},null,{skipInliningFonts:!0});e.querySelector(`.style-fonts`)?.remove(),i.replaceChildren(),i.appendChild(e)})(),()=>{i.replaceChildren()}},[e.rawText,n]),(0,W.jsxs)(`button`,{type:`button`,className:`ChartPreview`,"aria-label":K(`labels.chartType_plaintext`),onClick:()=>{e.onClick(e.rawText)},children:[(0,W.jsx)(`div`,{className:`ChartPreview__canvas`,ref:t}),(0,W.jsx)(`div`,{className:`ChartPreview__label`,children:K(`labels.chartType_plaintext`)})]})},zN=({data:e,rawText:t,onClose:n})=>{let{onInsertElements:r,focusContainer:i}=nz(),[a,o]=(0,H.useState)(Math.random()),s=H.useCallback(()=>{o(Math.random())},[]),c=H.useCallback(()=>{n&&n()},[n]),l=(e,t)=>{r(t),dC(`paste`,`chart`,e),n(),i()};return(0,W.jsx)(dk,{size:`regular`,onCloseRequest:c,title:(0,W.jsxs)(`div`,{className:`PasteChartDialog__title`,children:[(0,W.jsx)(`div`,{className:`PasteChartDialog__titleText`,children:K(`labels.pasteCharts`)}),(0,W.jsx)(`div`,{className:`PasteChartDialog__reshuffleBtn`,onClick:s,role:`button`,tabIndex:0,onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),s())},children:jb})]}),className:`PasteChartDialog`,autofocus:!1,children:(0,W.jsxs)(`div`,{className:`container`,children:[[`bar`,`line`,`radar`].map(t=>BM(e,t)?(0,W.jsx)(LN,{chartType:t,spreadsheet:e,colorSeed:a,onClick:l},t):null),t&&(0,W.jsx)(RN,{rawText:t,onClick:e=>{r([Li({text:e,x:0,y:0})]),dC(`paste`,`chart`,`plaintext`),n(),i()}})]})})},BN=({heading:e,children:t,...n})=>{let{id:r}=oz(),i=(0,W.jsx)(`h2`,{className:`visually-hidden`,id:`${r}-${e}-title`,children:K(`headings.${e}`)});return(0,W.jsx)(`section`,{...n,"aria-labelledby":`${r}-${e}-title`,children:typeof t==`function`?t(i):(0,W.jsxs)(W.Fragment,{children:[i,t]})})},VN=4,HN=8,UN=({shouldWrap:e,children:t,username:n})=>e?(0,W.jsx)(Rw,{label:n||`Unknown user`,children:t}):(0,W.jsx)(W.Fragment,{children:t}),WN=({actionManager:e,collaborator:t,socketId:n,withName:r=!1,shouldWrapWithTooltip:i=!1,isBeingFollowed:a})=>{let o={socketId:n,collaborator:t,withName:r,isBeingFollowed:a},s=e.renderAction(`goToCollaborator`,o);return(0,W.jsx)(UN,{username:t.username,shouldWrap:i,children:s},n)},GN=[`avatarUrl`,`id`,`socketId`,`username`,`isInCall`,`isSpeaking`,`isMuted`],KN=H.memo(({className:e,mobile:t,collaborators:n,userToFollow:r})=>{let i=uz(),a=new Map;n.forEach((e,t)=>{let n=e.id||t;a.set(n,{...e,socketId:t})});let o=Array.from(a.values()).filter(e=>e.username?.trim()),[s,c]=H.useState(``),l=o.filter(e=>e.username?.toLowerCase().includes(s)),u=H.useRef(null);(0,H.useLayoutEffect)(()=>{if(u.current){let e=e=>{f(Math.max(1,Math.min(8,Math.floor(e/38))))};if(e(u.current.clientWidth),!He)return;let t=new ResizeObserver(t=>{for(let n of t){let{width:t}=n.contentRect;e(t)}});return t.observe(u.current),()=>{t.disconnect()}}},[]);let[d,f]=H.useState(VN),p=o.slice(0,d-1).map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}));return t?(0,W.jsx)(`div`,{className:U(`UserList UserList_mobile`,e),children:o.map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,shouldWrapWithTooltip:!0,isBeingFollowed:e.socketId===r}))}):(0,W.jsx)(`div`,{className:`UserList__wrapper`,ref:u,children:(0,W.jsxs)(`div`,{className:U(`UserList`,e),style:{"--max-avatars":d},children:[p,o.length>d-1&&(0,W.jsxs)(V_,{children:[(0,W.jsxs)(H_,{className:`UserList__more`,children:[`+`,o.length-d+1]}),(0,W.jsx)(W_,{style:{zIndex:2,width:`15rem`,textAlign:`left`},align:`end`,sideOffset:10,children:(0,W.jsxs)(SC,{padding:2,children:[o.length>=HN&&(0,W.jsx)(YC,{placeholder:K(`quickSearch.placeholder`),onChange:c}),(0,W.jsx)(XC,{className:`dropdown-menu UserList__collaborators`,placeholder:K(`userList.empty`),children:l.length>0?[(0,W.jsx)(`div`,{className:`hint`,children:K(`userList.hint.text`)}),l.map(e=>WN({actionManager:i,collaborator:e,socketId:e.socketId,withName:!0,isBeingFollowed:e.socketId===r}))]:[]}),(0,W.jsx)(G_,{width:20,height:10,style:{fill:`var(--popup-bg-color)`,filter:`drop-shadow(rgba(0, 0, 0, 0.05) 0px 3px 2px)`}})]})})]})]})})},(e,t)=>{if(e.collaborators.size!==t.collaborators.size||e.mobile!==t.mobile||e.className!==t.className||e.userToFollow!==t.userToFollow)return!1;let n=t.collaborators.keys();for(let[r,i]of e.collaborators){let e=t.collaborators.get(r);if(!e||r!==n.next().value||!ji(i,e,GN))return!1}return!0}),qN=e=>(0,W.jsx)(`button`,{className:`help-icon`,onClick:e.onClick,type:`button`,title:`${K(`helpDialog.title`)} \u2014 ?`,"aria-label":K(`helpDialog.title`),children:bb}),JN=({appState:e,actionManager:t,showExitZenModeBtn:n,renderWelcomeScreen:r})=>{let{FooterCenterTunnel:i,WelcomeScreenHelpHintTunnel:a}=gk();return(0,W.jsxs)(`footer`,{role:`contentinfo`,className:`layer-ui__wrapper__footer App-menu App-menu_bottom`,children:[(0,W.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-left zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-left":e.zenModeEnabled}),children:(0,W.jsx)(_O.Col,{gap:2,children:(0,W.jsxs)(BN,{heading:`canvasActions`,children:[(0,W.jsx)(Nk,{renderAction:t.renderAction,zoom:e.zoom}),!e.viewModeEnabled&&(0,W.jsx)(Pk,{renderAction:t.renderAction,className:U(`zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":e.zenModeEnabled})})]})})}),(0,W.jsx)(i.Out,{}),(0,W.jsx)(`div`,{className:U(`layer-ui__wrapper__footer-right zen-mode-transition`,{"transition-right":e.zenModeEnabled}),children:(0,W.jsxs)(`div`,{style:{position:`relative`},children:[r&&(0,W.jsx)(a.Out,{}),(0,W.jsx)(qN,{onClick:()=>t.executeAction(ZT)})]})}),(0,W.jsx)(Fk,{actionManager:t,showExitZenModeBtn:n})]})},YN=JN;JN.displayName=`Footer`;var XN=H.createContext({}),ZN=({children:e,className:t})=>{let n=iz(),r=(0,H.useContext)(XN),i=!!(n.canFitSidebar&&r.shouldRenderDockButton);return(0,W.jsxs)(`div`,{className:U(`sidebar__header`,t),"data-testid":`sidebar-header`,children:[e,(0,W.jsxs)(`div`,{className:`sidebar__header__buttons`,children:[i&&(0,W.jsx)(Rw,{label:K(`labels.sidebarLock`),children:(0,W.jsx)(QO,{onSelect:()=>r.onDock?.(!r.docked),selected:!!r.docked,className:`sidebar__dock`,"data-testid":`sidebar-dock`,"aria-label":K(`labels.sidebarLock`),children:Uy})}),(0,W.jsx)(QO,{"data-testid":`sidebar-close`,className:`sidebar__close`,onSelect:r.onCloseRequest,"aria-label":K(`buttons.close`),children:nx})]})]})};ZN.displayName=`SidebarHeader`;var QN=({children:e,tab:t,onSelect:n,...r})=>(0,W.jsx)(lv,{value:t,asChild:!0,onSelect:n,children:(0,W.jsx)(`button`,{type:`button`,className:`excalidraw-button sidebar-tab-trigger`,...r,children:e})});QN.displayName=`SidebarTabTrigger`;var $N=({children:e,...t})=>(0,W.jsx)(cv,{className:`sidebar-triggers`,...t,children:e});$N.displayName=`SidebarTabTriggers`;var eP=({name:e,tab:t,icon:n,title:r,children:i,onToggle:a,className:o,style:s})=>{let c=lz();return(0,W.jsxs)(`label`,{title:r,className:`sidebar-trigger__label-element`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,onChange:n=>{document.querySelector(`.layer-ui__wrapper`)?.classList.remove(`animate`);let r=n.target.checked;c({openSidebar:r?{name:e,tab:t}:null,openMenu:null,openPopup:null}),a?.(r)},checked:gC().openSidebar?.name===e,"aria-label":r,"aria-keyshortcuts":`0`}),(0,W.jsxs)(`div`,{className:U(`sidebar-trigger`,o),style:s,children:[n&&(0,W.jsx)(`div`,{children:n}),i&&(0,W.jsx)(`div`,{className:`sidebar-trigger__label`,children:i})]})]})};eP.displayName=`SidebarTrigger`;var tP=({children:e,...t})=>{let n=gC(),r=lz();if(!n.openSidebar)return null;let{name:i}=n.openSidebar;return(0,W.jsx)(sv,{className:`sidebar-tabs-root`,value:n.openSidebar.tab,onValueChange:e=>r(t=>({...t,openSidebar:{...t.openSidebar,name:i,tab:e}})),...t,children:e})};tP.displayName=`SidebarTabs`;var nP=({tab:e,children:t,...n})=>(0,W.jsx)(uv,{...n,value:e,"data-testid":e,children:t});nP.displayName=`SidebarTab`;var rP=yc(!1),iP=(0,H.forwardRef)(({name:e,children:t,onDock:n,docked:r,className:i,...a},o)=>{Vt()&&n&&r==null&&console.warn("Sidebar: `docked` must be set when `onDock` is supplied for the sidebar to be user-dockable. To hide this message, either pass `docked` or remove `onDock`");let s=lz(),c=yy(rP);(0,H.useLayoutEffect)(()=>(c(!!r),()=>{c(!1)}),[c,r]);let l=(0,H.useRef)({});l.current.onCloseRequest=()=>{s({openSidebar:null})},l.current.onDock=e=>n?.(e),l.current=Jr(l.current,{docked:r,shouldRenderDockButton:!!n&&r!=null});let u=(0,H.useRef)(null);(0,H.useImperativeHandle)(o,()=>u.current);let d=iz(),f=(0,H.useCallback)(()=>{document.querySelector(`.Dialog`)||s({openSidebar:null})},[s]);return vC(u,(0,H.useCallback)(e=>{e.target.closest(`.sidebar-trigger`)||(!r||!d.canFitSidebar)&&f()},[f,r,d.canFitSidebar])),(0,H.useEffect)(()=>{let e=e=>{e.key===N.ESCAPE&&(!r||!d.canFitSidebar)&&f()};return document.addEventListener(F.KEYDOWN,e),()=>{document.removeEventListener(F.KEYDOWN,e)}},[f,r,d.canFitSidebar]),(0,W.jsx)(SC,{...a,className:U(Qn.SIDEBAR,{"sidebar--docked":r},i),ref:u,children:(0,W.jsx)(XN.Provider,{value:l.current,children:t})})});iP.displayName=`SidebarInner`;var aP=Object.assign((0,H.forwardRef)((e,t)=>{let n=gC(),{onStateChange:r}=e,i=(0,H.useRef)(n.openSidebar);(0,H.useEffect)(()=>{(!n.openSidebar&&i?.current?.name===e.name||n.openSidebar?.name===e.name&&i?.current?.name!==e.name||i.current?.name===e.name)&&n.openSidebar!==i.current&&r?.(n.openSidebar?.name===e.name?n.openSidebar:null),i.current=n.openSidebar},[n.openSidebar,r,e.name]);let[a,o]=(0,H.useState)(!1);return(0,H.useLayoutEffect)(()=>(o(!0),()=>o(!1)),[]),a&&n.openSidebar?.name===e.name?(0,H.createElement)(iP,{...e,ref:t,key:e.name}):null}),{Header:ZN,TabTriggers:$N,TabTrigger:QN,Tabs:tP,Tab:nP,Trigger:eP});aP.displayName=`Sidebar`;var oP=(e,t)=>{let n=yc(0),r=e=>{let{tunnelsJotai:{useAtom:r}}=gk(),[,i]=r(n),a=(0,H.useRef)({preferHost:!1,counter:0});return(0,H.useLayoutEffect)(()=>{let e=a.current;return i(t=>{let n=t+1;return e.counter=n,n}),()=>{i(t=>{let n=t-1;return e.counter=n,n||(e.preferHost=!1),n})}},[i]),e.__fallback||(a.current.preferHost=!0),!a.current.counter&&e.__fallback&&a.current.preferHost||a.current.counter>1&&e.__fallback?null:(0,W.jsx)(t,{...e})};return r.displayName=e,r},sP={};o(sP,{ChangeCanvasBackground:()=>xP,ClearCanvas:()=>yP,CommandPalette:()=>gP,Export:()=>SP,Help:()=>vP,LiveCollaborationTrigger:()=>wP,LoadScene:()=>pP,Preferences:()=>NP,PreferencesToggleGridModeItem:()=>kP,PreferencesToggleZenModeItem:()=>AP,SaveAsImage:()=>hP,SaveToActiveFile:()=>mP,SearchMenu:()=>_P,Socials:()=>CP,ToggleTheme:()=>bP});var cP=yc({active:!1});async function lP({title:e,description:t,actionLabel:n,color:r}){return new Promise(i=>{Cy.set(cP,{active:!0,onConfirm:()=>i(!0),onClose:()=>i(!1),onReject:()=>i(!1),title:e,description:t,actionLabel:n,color:r})})}var uP=function({onChange:e,value:t,choices:n,name:r}){return(0,W.jsx)(`div`,{className:`RadioGroup`,children:n.map(n=>(0,W.jsxs)(`div`,{className:U(`RadioGroup__choice`,{active:n.value===t}),title:n.ariaLabel,children:[(0,W.jsx)(`input`,{name:r,type:`radio`,checked:n.value===t,onChange:()=>e(n.value),"aria-label":n.ariaLabel}),n.label]},String(n.value)))})},dP=({value:e,shortcut:t,onChange:n,choices:r,children:i,name:a})=>{let o=iz();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`dropdown-menu-item-base dropdown-menu-item-bare`,children:[(0,W.jsx)(`label`,{className:`dropdown-menu-item__text`,children:i}),(0,W.jsx)(uP,{name:a,value:e,onChange:n,choices:r})]}),t&&o.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`dropdown-menu-item__shortcut dropdown-menu-item__shortcut--orphaned`,children:t})]})};dP.displayName=`DropdownMenuItemContentRadio`;var fP=dP,pP=()=>{let{t:e}=Fy(),t=uz(),n=sz();return t.isActionEnabled(KT)?(0,W.jsx)(sw,{icon:Ab,onSelect:async()=>{(!n.length||await lP({title:e(`overwriteConfirm.modal.loadFromFile.title`),actionLabel:e(`overwriteConfirm.modal.loadFromFile.button`),color:`warning`,description:(0,W.jsx)(pO,{i18nKey:`overwriteConfirm.modal.loadFromFile.description`,bold:e=>(0,W.jsx)(`strong`,{children:e}),br:()=>(0,W.jsx)(`br`,{})})}))&&t.executeAction(KT)},"data-testid":`load-button`,shortcut:ND(`loadScene`),"aria-label":e(`buttons.load`),children:e(`buttons.load`)}):null};pP.displayName=`LoadScene`;var mP=()=>{let{t:e}=Fy(),t=uz();return t.isActionEnabled(WT)?(0,W.jsx)(sw,{shortcut:ND(`saveScene`),"data-testid":`save-button`,onSelect:()=>t.executeAction(WT),icon:Ob,"aria-label":`${e(`buttons.save`)}`,children:`${e(`buttons.save`)}`}):null};mP.displayName=`SaveToActiveFile`;var hP=()=>{let e=lz(),{t}=Fy();return(0,W.jsx)(sw,{icon:Nb,"data-testid":`image-export-button`,onSelect:()=>e({openDialog:{name:`imageExport`}}),shortcut:ND(`imageExport`),"aria-label":t(`buttons.exportImage`),children:t(`buttons.exportImage`)})};hP.displayName=`SaveAsImage`;var gP=e=>{let t=lz(),{t:n}=Fy();return(0,W.jsx)(sw,{icon:CS,"data-testid":`command-palette-button`,onSelect:()=>{dC(`command_palette`,`open`,`menu`),t({openDialog:{name:`commandPalette`}})},shortcut:ND(`commandPalette`),"aria-label":n(`commandPalette.title`),className:e?.className,children:n(`commandPalette.title`)})};gP.displayName=`CommandPalette`;var _P=e=>{let{t}=Fy(),n=uz();return(0,W.jsx)(sw,{icon:vS,"data-testid":`search-menu-button`,onSelect:()=>{n.executeAction(ZA)},shortcut:ND(`searchMenu`),"aria-label":t(`search.title`),className:e?.className,children:t(`search.title`)})};_P.displayName=`SearchMenu`;var vP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(sw,{"data-testid":`help-menu-item`,icon:bb,onSelect:()=>t.executeAction(ZT),shortcut:`?`,"aria-label":e(`helpDialog.title`),children:e(`helpDialog.title`)})};vP.displayName=`Help`;var yP=()=>{let{t:e}=Fy(),t=yy(Rk);return uz().isActionEnabled(Zw)?(0,W.jsx)(sw,{icon:pb,onSelect:()=>t(`clearCanvas`),"data-testid":`clear-canvas-button`,"aria-label":e(`buttons.clearReset`),children:e(`buttons.clearReset`)}):null};yP.displayName=`ClearCanvas`;var bP=e=>{let{t}=Fy(),n=gC(),r=uz(),i=ND(`toggleTheme`);return r.isActionEnabled(iT)?e?.allowSystemTheme?(0,W.jsx)(fP,{name:`theme`,value:e.theme,onChange:t=>e.onSelect(t),choices:[{value:R.LIGHT,label:_b,ariaLabel:`${t(`buttons.lightMode`)} - ${i}`},{value:R.DARK,label:gb,ariaLabel:`${t(`buttons.darkMode`)} - ${i}`},{value:`system`,label:PS,ariaLabel:t(`buttons.systemMode`)}],children:t(`labels.theme`)}):(0,W.jsx)(sw,{onSelect:t=>{if(t.preventDefault(),e?.onSelect)e.onSelect(n.theme===R.DARK?R.LIGHT:R.DARK);else return r.executeAction(iT)},icon:n.theme===R.DARK?_b:gb,"data-testid":`toggle-dark-mode`,shortcut:i,"aria-label":n.theme===R.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`),children:n.theme===R.DARK?t(`buttons.lightMode`):t(`buttons.darkMode`)}):null};bP.displayName=`ToggleTheme`;var xP=()=>{let{t:e}=Fy(),t=gC(),n=uz(),r=rz();return t.viewModeEnabled||!r.UIOptions.canvasActions.changeViewBackgroundColor?null:(0,W.jsxs)(`div`,{style:{marginTop:`0.75rem`},children:[(0,W.jsx)(`div`,{"data-testid":`canvas-background-label`,style:{fontSize:`0.875rem`,marginBottom:`0.25rem`,marginLeft:`0.5rem`},children:e(`labels.canvasBackground`)}),(0,W.jsx)(`div`,{style:{padding:`0 0.625rem`},children:n.renderAction(`changeViewBackgroundColor`)})]})};xP.displayName=`ChangeCanvasBackground`;var SP=()=>{let{t:e}=Fy(),t=lz();return(0,W.jsx)(sw,{icon:yb,onSelect:()=>{t({openDialog:{name:`jsonExport`}})},"data-testid":`json-export-button`,"aria-label":e(`buttons.export`),children:e(`buttons.export`)})};SP.displayName=`Export`;var CP=()=>{let{t:e}=Fy();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(SO,{icon:Cb,href:`https://github.com/excalidraw/excalidraw`,"aria-label":`GitHub`,children:`GitHub`}),(0,W.jsx)(SO,{icon:Tb,href:`https://x.com/excalidraw`,"aria-label":`X`,children:e(`labels.followUs`)}),(0,W.jsx)(SO,{icon:wb,href:`https://discord.gg/UexuTaE`,"aria-label":`Discord`,children:e(`labels.discordChat`)})]})};CP.displayName=`Socials`;var wP=({onSelect:e,isCollaborating:t})=>{let{t:n}=Fy();return(0,W.jsx)(sw,{"data-testid":`collab-button`,icon:ex,className:U({"active-collab":t}),onSelect:e,children:n(`labels.liveCollaboration`)})};wP.displayName=`LiveCollaborationTrigger`;var TP=()=>{let{t:e}=Fy(),t=nz();return(0,W.jsx)(BO,{checked:gC().activeTool.locked,shortcut:ND(`toolLock`),onSelect:e=>{t.toggleLock(),e.preventDefault()},children:e(`labels.preferences_toolLock`)})},EP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().objectsSnapModeEnabled,shortcut:ND(`objectsSnapMode`),onSelect:e=>{t.executeAction(TE),e.preventDefault()},children:e(`buttons.objectsSnapMode`)})},DP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().bindingPreference===`enabled`,onSelect:e=>{t.executeAction(EE),e.preventDefault()},children:e(`labels.arrowBinding`)})},OP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().isMidpointSnappingEnabled,onSelect:e=>{t.executeAction(DE),e.preventDefault()},children:e(`labels.midpointSnapping`)})},kP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().gridModeEnabled,shortcut:ND(`gridMode`),onSelect:e=>{t.executeAction(CE),e.preventDefault()},children:e(`labels.toggleGrid`)})},AP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().zenModeEnabled,shortcut:ND(`zenMode`),onSelect:e=>{t.executeAction(wE),e.preventDefault()},children:e(`buttons.zenMode`)})},jP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().viewModeEnabled,shortcut:ND(`viewMode`),onSelect:e=>{t.executeAction(yk),e.preventDefault()},children:e(`labels.viewMode`)})},MP=()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(BO,{checked:gC().stats.open,shortcut:ND(`stats`),onSelect:e=>{t.executeAction(OE),e.preventDefault()},children:e(`stats.fullTitle`)})},NP=({children:e,additionalItems:t})=>{let{t:n}=Fy();return(0,W.jsxs)(LO,{children:[(0,W.jsx)(LO.Trigger,{icon:QS,children:n(`labels.preferences`)}),(0,W.jsxs)(LO.Content,{className:`excalidraw-main-menu-preferences-submenu`,children:[e||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(TP,{}),(0,W.jsx)(EP,{}),(0,W.jsx)(kP,{}),(0,W.jsx)(AP,{}),(0,W.jsx)(jP,{}),(0,W.jsx)(MP,{}),(0,W.jsx)(DP,{}),(0,W.jsx)(OP,{})]}),t]})]})};NP.ToggleToolLock=TP,NP.ToggleSnapMode=EP,NP.ToggleArrowBinding=DP,NP.ToggleMidpointSnapping=OP,NP.ToggleGridMode=kP,NP.ToggleZenMode=AP,NP.ToggleViewMode=jP,NP.ToggleElementProperties=MP,NP.displayName=`Preferences`;var PP=Object.assign(oP(`MainMenu`,({children:e,onSelect:t})=>{let{MainMenuTunnel:n}=gk(),r=iz(),i=gC(),a=lz();return(0,W.jsx)(n.In,{children:(0,W.jsxs)(HO,{open:i.openMenu===`canvas`,children:[(0,W.jsx)(HO.Trigger,{onToggle:()=>{a({openMenu:i.openMenu===`canvas`?null:`canvas`,openPopup:null,openDialog:null})},"data-testid":`main-menu-trigger`,className:`main-menu-trigger`,children:vb}),(0,W.jsxs)(HO.Content,{onClickOutside:()=>a({openMenu:null}),onSelect:ps(t,()=>{a({openMenu:null})}),className:`main-menu`,align:`start`,children:[e,r.formFactor===`phone`&&i.collaborators.size>0&&(0,W.jsxs)(`fieldset`,{className:`UserList-Wrapper`,children:[(0,W.jsx)(`legend`,{children:K(`labels.collaborators`)}),(0,W.jsx)(KN,{mobile:!0,collaborators:i.collaborators,userToFollow:i.userToFollow?.socketId||null})]})]})]})})}),{Trigger:HO.Trigger,Item:HO.Item,ItemLink:HO.ItemLink,ItemCustom:HO.ItemCustom,Group:HO.Group,Separator:HO.Separator,Sub:LO,DefaultItems:sP}),FP=(0,H.forwardRef)(({children:e,icon:t,onClick:n,label:r,variant:i=`filled`,color:a=`primary`,size:o=`medium`,fullWidth:s,className:c,status:l,disabled:u},d)=>{let[f,p]=(0,H.useState)(!1),m=async e=>{let t=n?.(e);if(ge(t)){let e=window.setTimeout(()=>{p(!0)},50);try{await t}catch(e){if(e instanceof E)console.warn(e);else throw e}finally{clearTimeout(e),p(!1)}}},h=f?`loading`:l;return a=h===`success`?`success`:a,(0,W.jsx)(`button`,{className:U(`ExcButton`,`ExcButton--color-${a}`,`ExcButton--variant-${i}`,`ExcButton--size-${o}`,`ExcButton--status-${h}`,{"ExcButton--fullWidth":s},c),onClick:m,type:`button`,"aria-label":r,ref:d,disabled:u||h===`loading`||h===`success`,children:(0,W.jsxs)(`div`,{className:`ExcButton__contents`,children:[h===`loading`?(0,W.jsx)($S,{className:`ExcButton__statusIcon`}):h===`success`&&(0,W.jsx)(`div`,{className:`ExcButton__statusIcon`,children:nS}),t&&(0,W.jsx)(`div`,{className:`ExcButton__icon`,"aria-hidden":!0,children:t}),i!==`icon`&&(e??r)]})})}),IP=({title:e,children:t,actionLabel:n,onClick:r})=>(0,W.jsxs)(`div`,{className:`OverwriteConfirm__Actions__Action`,children:[(0,W.jsx)(`h4`,{children:e}),(0,W.jsx)(`div`,{className:`OverwriteConfirm__Actions__Action__content`,children:t}),(0,W.jsx)(FP,{variant:`outlined`,color:`muted`,label:n,size:`large`,fullWidth:!0,onClick:r})]}),LP=Object.assign(({children:e})=>(0,W.jsx)(`div`,{className:`OverwriteConfirm__Actions`,children:e}),{ExportToImage:()=>{let{t:e}=Fy(),t=uz(),n=lz();return(0,W.jsx)(IP,{title:e(`overwriteConfirm.action.exportToImage.title`),actionLabel:e(`overwriteConfirm.action.exportToImage.button`),onClick:()=>{t.executeAction(zT,`ui`,!0),n({openDialog:{name:`imageExport`}})},children:e(`overwriteConfirm.action.exportToImage.description`)})},SaveToDisk:()=>{let{t:e}=Fy(),t=uz();return(0,W.jsx)(IP,{title:e(`overwriteConfirm.action.saveToDisk.title`),actionLabel:e(`overwriteConfirm.action.saveToDisk.button`),onClick:()=>{t.executeAction(GT,`ui`)},children:e(`overwriteConfirm.action.saveToDisk.description`)})}}),RP=Object.assign(oP(`OverwriteConfirmDialog`,({children:e})=>{let{OverwriteConfirmDialogTunnel:t}=gk(),[n,r]=vy(cP);return n.active?(0,W.jsx)(t.In,{children:(0,W.jsx)(dk,{onCloseRequest:()=>{n.onClose(),r(e=>({...e,active:!1}))},title:!1,size:916,children:(0,W.jsxs)(`div`,{className:`OverwriteConfirm`,children:[(0,W.jsx)(`h3`,{children:n.title}),(0,W.jsxs)(`div`,{className:`OverwriteConfirm__Description OverwriteConfirm__Description--color-${n.color}`,children:[(0,W.jsx)(`div`,{className:`OverwriteConfirm__Description__icon`,children:rS}),(0,W.jsx)(`div`,{children:n.description}),(0,W.jsx)(`div`,{className:`OverwriteConfirm__Description__spacer`}),(0,W.jsx)(FP,{color:n.color,size:`large`,label:n.actionLabel,onClick:()=>{n.onConfirm(),r(e=>({...e,active:!1}))}})]}),(0,W.jsx)(LP,{children:e})]})})}):null}),{Actions:LP,Action:IP}),zP=yc(``),BP=yc(null),VP=350,HP=()=>{let e=nz(),t=lz(),n=(0,H.useRef)(null),[r,i]=vy(zP),a=r.trim(),[o,s]=(0,H.useState)(!1),[c,l]=(0,H.useState)({nonce:null,items:[]}),u=(0,H.useRef)(null),d=(0,H.useRef)(void 0),[f,p]=vy(BP);(0,H.useEffect)(()=>{o||(a!==u.current||e.scene.getSceneNonce()!==d.current)&&(u.current=null,XP(a,e,(n,r)=>{l({nonce:se(),items:n}),u.current=a,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null})}))},[o,a,e.scene.getNonDeletedElementsMap(),e,t,p,d]);let m=()=>{c.items.length>0&&p(e=>e===null?0:(e+1)%c.items.length)},h=()=>{c.items.length>0&&p(e=>e===null?0:e-1<0?c.items.length-1:e-1)};(0,H.useEffect)(()=>{t(e=>e.searchMatches?{searchMatches:{focusedId:f!==null&&e.searchMatches?.matches[f]?.id||null,matches:e.searchMatches.matches.map((e,t)=>t===f?{...e,focus:!0}:{...e,focus:!1})}}:null)},[f,t]),(0,H.useEffect)(()=>{if(c.items.length>0&&f!==null){let t=c.items[f];if(t){let n=e.state.zoom.value,r=Li({text:t.searchQuery,x:t.element.x+(t.matchedLines[0]?.offsetX??0),y:t.element.y+(t.matchedLines[0]?.offsetY??0),width:t.matchedLines[0]?.width,height:t.matchedLines[0]?.height,fontSize:L(t.element)?On.nameFontSize:t.element.fontSize,fontFamily:L(t.element)?to.Assistant:t.element.fontFamily}),i=r.fontSize,a=i*n<14;if(!ms([r],e.canvas.width/window.devicePixelRatio,e.canvas.height/window.devicePixelRatio,{offsetLeft:e.state.offsetLeft,offsetTop:e.state.offsetTop,scrollX:e.state.scrollX,scrollY:e.state.scrollY,zoom:e.state.zoom},e.scene.getNonDeletedElementsMap(),e.getEditorUIOffsets())||a){let t;t=a?i>=14?{fitToContent:!0}:{fitToViewport:!0,maxZoom:on(14/i,1)}:{fitToContent:!0},e.scrollToContent(r,{animate:!0,duration:300,...t,canvasOffsets:e.getEditorUIOffsets()})}}}},[f,c,e]),(0,H.useEffect)(()=>()=>{p(null),u.current=null,d.current=void 0,t({searchMatches:null}),s(!1)},[t,p]);let g=yC({goToNextItem:m,goToPreviousItem:h,searchMatches:c});(0,H.useEffect)(()=>w(window,F.KEYDOWN,r=>{if(r.key===N.ESCAPE&&!e.state.openDialog&&!e.state.openPopup){r.preventDefault(),r.stopPropagation(),t({openSidebar:null});return}if(r[N.CTRL_OR_CMD]&&r.key===N.F){if(r.preventDefault(),r.stopPropagation(),e.state.openDialog)return;n.current?.matches(`:focus`)||(e.state.openDialog&&t({openDialog:null}),n.current?.focus(),n.current?.select())}r.target instanceof HTMLElement&&r.target.closest(`.layer-ui__search`)&&g.searchMatches.items.length&&(r.key===N.ENTER&&(r.stopPropagation(),g.goToNextItem()),r.key===N.ARROW_UP?(r.stopPropagation(),g.goToPreviousItem()):r.key===N.ARROW_DOWN&&(r.stopPropagation(),g.goToNextItem()))},{capture:!0,passive:!1}),[t,g,e]);let _=`${c.items.length} ${c.items.length===1?K(`search.singleResult`):K(`search.multipleResults`)}`;return(0,W.jsxs)(`div`,{className:`layer-ui__search`,children:[(0,W.jsx)(`div`,{className:`layer-ui__search-header`,children:(0,W.jsx)($O,{className:Qn.SEARCH_MENU_INPUT_WRAPPER,value:r,ref:n,placeholder:K(`search.placeholder`),icon:vS,onChange:n=>{i(n),s(!0);let r=n.trim();XP(r,e,(n,i)=>{l({nonce:se(),items:n}),p(i),u.current=r,d.current=e.scene.getSceneNonce(),t({searchMatches:n.length?{focusedId:null,matches:n.map(e=>({id:e.element.id,focus:!1,matchedLines:e.matchedLines}))}:null}),s(!1)})},selectOnRender:!0})}),(0,W.jsxs)(`div`,{className:`layer-ui__search-count`,children:[c.items.length>0&&(0,W.jsxs)(W.Fragment,{children:[f!==null&&f>-1?(0,W.jsxs)(`div`,{children:[f+1,` / `,_]}):(0,W.jsx)(`div`,{children:_}),(0,W.jsxs)(`div`,{className:`result-nav`,children:[(0,W.jsx)(QO,{onSelect:()=>{m()},className:`result-nav-btn`,children:VS}),(0,W.jsx)(QO,{onSelect:()=>{h()},className:`result-nav-btn`,children:US})]})]}),c.items.length===0&&a&&u.current&&(0,W.jsx)(`div`,{style:{margin:`1rem auto`},children:K(`search.noMatch`)})]}),(0,W.jsx)(WP,{matches:c,onItemClick:p,focusIndex:f,searchQuery:a})]})},UP=e=>{let t=[e.preview.moreBefore?`...`:``,e.preview.previewText.slice(0,e.preview.indexInSearchQuery),e.preview.previewText.slice(e.preview.indexInSearchQuery,e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.previewText.slice(e.preview.indexInSearchQuery+e.searchQuery.length),e.preview.moreAfter?`...`:``];return(0,W.jsx)(`div`,{tabIndex:-1,className:U(`layer-ui__result-item`,{active:e.highlighted}),onClick:e.onClick,ref:t=>{e.highlighted&&t?.scrollIntoView({behavior:`auto`,block:`nearest`})},children:(0,W.jsx)(`div`,{className:`preview-text`,children:t.flatMap((e,t)=>(0,W.jsx)(H.Fragment,{children:t===2?(0,W.jsx)(`b`,{children:e}):e},t))})})},WP=(0,H.memo)(e=>{let t=(0,H.useMemo)(()=>e.matches.items.filter(e=>L(e.element)),[e.matches]),n=(0,H.useMemo)(()=>e.matches.items.filter(e=>M(e.element)),[e.matches]);return(0,W.jsxs)(`div`,{children:[t.length>0&&(0,W.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,W.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,W.jsx)(`div`,{className:`title-icon`,children:oS}),(0,W.jsx)(`div`,{children:K(`search.frames`)})]}),t.map((t,n)=>(0,W.jsx)(UP,{searchQuery:e.searchQuery,preview:t.preview,highlighted:n===e.focusIndex,onClick:()=>e.onItemClick(n)},t.element.id+t.index)),n.length>0&&(0,W.jsx)(`div`,{className:`layer-ui__divider`})]}),n.length>0&&(0,W.jsxs)(`div`,{className:`layer-ui__search-result-container`,children:[(0,W.jsxs)(`div`,{className:`layer-ui__search-result-title`,children:[(0,W.jsx)(`div`,{className:`title-icon`,children:ob}),(0,W.jsx)(`div`,{children:K(`search.texts`)})]}),n.map((n,r)=>(0,W.jsx)(UP,{searchQuery:e.searchQuery,preview:n.preview,highlighted:r+t.length===e.focusIndex,onClick:()=>e.onItemClick(r+t.length)},n.element.id+n.index))]})]})},(e,t)=>e.matches.nonce===t.matches.nonce&&e.focusIndex===t.focusIndex),GP=(e,t,n)=>{let r=e.slice(0,t),i=r.split(/\s+/),a=r.endsWith(` `),o=i.length-2-1-(a?0:1),s=i.slice(o<=0?0:o).join(` `)+(a?` `:``);s=s.length>20?s.slice(-20):s;let c=e.slice(t+n.length),l=c.split(/\s+/),u=!c.startsWith(` `),d=u?6:5,f=(u?``:` `)+l.slice(0,d).join(` `);return{indexInSearchQuery:s.length,previewText:s+n+f,moreBefore:o>0,moreAfter:l.length>d}},KP=(e,t)=>{let n=e.split(`
|
|
66
|
+
`),r=[],i=0;for(let e=0;e<n.length;e++){let a=n[e],o=n[e+1];if(o){let e=t.indexOf(o,i);if(e>a.length+i){let t=e-(a.length+i);for(;t>0;)a+=` `,t--}}r.push(a),i+=a.length}return r.join(`
|
|
67
|
+
`)},qP=(e,t,n)=>{let r=KP(e.text,e.originalText).split(`
|
|
68
|
+
`),i=[],a=0,o=0;for(let e of r){let t=a,n=t+e.length-1;i.push({line:e,startIndex:t,endIndex:n,lineNumber:o}),a=n+1,o++}let s=n,c=e.originalText.slice(n,n+t.length),l=[];for(let t of i){if(c===``)break;if(s>=t.startIndex&&s<=t.endIndex){let n=t.endIndex+1-s,r=t.line.slice(0,s-t.startIndex),i=c.slice(0,n);c=c.slice(n);let a=gn(r,u(e),e.lineHeight);if(r===``&&(a.width=0),e.textAlign!==`left`&&t.line.length>0){let n=gn(t.line,u(e),e.lineHeight),r=e.textAlign===`center`?(e.width-n.width)/2:e.width-n.width;a.width+=r}let{width:o,height:d}=gn(i,u(e),e.lineHeight),f=a.width,p=t.lineNumber*a.height;l.push({offsetX:f,offsetY:p,width:o,height:d,showOnCanvas:!0}),s+=n}}return l},JP=(e,t,n,r)=>{let i=e.name??Us(e),a=i.slice(n,n+t.length),o=i.slice(0,n),s=u({fontSize:On.nameFontSize,fontFamily:to.Assistant}),c=ba(to.Assistant),l=gn(o,s,c);o===``&&(l.width=0);let d=gn(a,s,c),f=l.width,p=-l.height-On.strokeWidth,m=d.width;return[{offsetX:f,offsetY:p,width:m,height:d.height,showOnCanvas:f+m<=e.width*r}]},YP=e=>e.replace(/[.*+?^${}()|[\]\\-]/g,`\\$&`),XP=(0,gy.default)((e,t,n)=>{if(!e||e===``){n([],null);return}let r=t.scene.getNonDeletedElements(),i=r.filter(e=>M(e)),a=r.filter(e=>L(e));i.sort((e,t)=>e.y-t.y),a.sort((e,t)=>e.y-t.y);let o=[],s=new RegExp(YP(e),`gi`);for(let t of i){let n=null,r=t.originalText;for(;(n=s.exec(r))!==null;){let i=GP(r,n.index,e),a=qP(t,e,n.index);a.length>0&&o.push({element:t,searchQuery:e,preview:i,index:n.index,matchedLines:a})}}let c=[];for(let n of a){let r=null,i=n.name??Us(n);for(;(r=s.exec(i))!==null;){let a=GP(i,r.index,e),o=JP(n,e,r.index,t.state.zoom.value);o.length>0&&c.push({element:n,searchQuery:e,preview:a,index:r.index,matchedLines:o})}}let l=new Set(t.visibleElements.map(e=>e.id)),u=[...c,...o];n(u,u.findIndex(e=>l.has(e.element.id))??null)},VP),ZP=oP(`DefaultSidebarTrigger`,e=>{let{DefaultSidebarTriggerTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(aP.Trigger,{...e,className:`default-sidebar-trigger`,name:At.name})})});ZP.displayName=`DefaultSidebarTrigger`;var QP=({children:e})=>{let{DefaultSidebarTabTriggersTunnel:t}=gk();return(0,W.jsx)(t.In,{children:e})};QP.displayName=`DefaultTabTriggers`;var $P=Object.assign(oP(`DefaultSidebar`,({children:e,className:t,onDock:n,docked:r,...i})=>{let a=gC(),o=lz(),{DefaultSidebarTabTriggersTunnel:s}=gk(),c=a.openSidebar?.tab===Ln;return(0,H.createElement)(aP,{...i,name:`default`,key:`default`,className:U(`default-sidebar`,t),docked:c||(r??a.defaultSidebarDockedPreference),onDock:c||n===!1||!n&&r!=null?void 0:ps(n,e=>{o({defaultSidebarDockedPreference:e})})},(0,W.jsxs)(aP.Tabs,{children:[(0,W.jsx)(aP.Header,{children:(0,W.jsxs)(aP.TabTriggers,{children:[(0,W.jsx)(aP.TabTrigger,{tab:Ln,children:vS}),(0,W.jsx)(aP.TabTrigger,{tab:En,children:zy}),(0,W.jsx)(s.Out,{})]})}),(0,W.jsx)(aP.Tab,{tab:En,children:(0,W.jsx)(ck,{})}),(0,W.jsx)(aP.Tab,{tab:Ln,children:(0,W.jsx)(HP,{})}),e]}))}),{Trigger:ZP,TabTriggers:QP}),eF=300,tF=({input:e,placeholder:t,onChange:r,onKeyboardSubmit:i,errorLine:a})=>{let o=(0,H.useRef)(null),s=(0,H.useRef)(i);s.current=i;let[c,l]=(0,H.useState)({type:`loading`}),[u,d]=(0,H.useState)(!1),{theme:f}=gC();if((0,H.useEffect)(()=>{let e=!1,t=setTimeout(()=>{e||d(!0)},eF);return n(()=>import(`./CodeMirrorEditor-UCMRAMCV-BHWNpLuY.js`).then(t=>{e||l({type:`ready`,component:t.default})}),__vite__mapDeps([66,2,67,68,1,69]),import.meta.url).catch(()=>{e||l({type:`fallback`})}).finally(()=>{clearTimeout(t)}),()=>{e=!0,clearTimeout(t)}},[]),(0,H.useEffect)(()=>{if(c.type!==`fallback`||!s.current)return;let e=o.current;if(e){let t=e=>{e[N.CTRL_OR_CMD]&&e.key===N.ENTER&&(e.preventDefault(),s.current?.())};return e.focus(),e.addEventListener(F.KEYDOWN,t),()=>{e.removeEventListener(F.KEYDOWN,t)}}},[c.type]),c.type===`ready`){let n=c.component;return(0,W.jsx)(n,{value:e,onChange:r,onKeyboardSubmit:i,placeholder:t,theme:f,errorLine:a})}return c.type===`fallback`?(0,W.jsx)(`textarea`,{className:`ttd-dialog-input`,onChange:e=>r(e.target.value),value:e,placeholder:t,ref:o}):u?(0,W.jsx)(`div`,{className:`ttd-dialog-input ttd-dialog-input--loading`,children:(0,W.jsx)($S,{})}):null},nF=/(?:Parse|Lexical) error on line (\d+)[.:]/i,rF=/Trying to inactivate an inactive participant \((.+)\)/i,iF=/^\s*-+\^\s*$/,aF=e=>nF.test(e),oF=e=>aF(e)||rF.test(e),sF=e=>iF.test(e),cF=e=>{let t=e.match(rF);return t?.[1]?t[1].trim():null},lF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),uF=(e,t)=>{let n=cF(e);if(!n)return null;let r=RegExp(`^\\s*deactivate\\s+${lF(n)}(?:\\s+%%.*)?\\s*$`),i=t.split(/\r?\n/);for(let e=i.length-1;e>=0;e--)if(r.test(i[e]))return e+1;return null},dF=(e,t)=>{let n=e.match(nF);return n?Number.parseInt(n[1],10):t?uF(e,t):null},fF=(e,t)=>(e.match(t)||[]).length,pF=(e,t)=>{if(!aF(e))return null;let n=dF(e,t),r=n?`Syntax error near line ${n}.`:`Syntax error in Mermaid diagram.`,i=[];return t&&(fF(t,/\[/g)!==fF(t,/\]/g)&&i.push(`Unbalanced square brackets in a node label.`),fF(t,/\(/g)!==fF(t,/\)/g)&&i.push(`Unbalanced parentheses in a node shape.`),fF(t,/\{/g)!==fF(t,/\}/g)&&i.push(`Unbalanced braces in a decision node.`),fF(t,/^\s*subgraph\b/gm)>fF(t,/^\s*end\s*$/gm)&&i.push("A block is missing an `end` statement.")),(/got 'NODE_STRING'/.test(e)||/got 'PS'/.test(e))&&i.push(`An extra character/token may appear after a node or label definition.`),i.length===0&&(i.push(`A node or edge line is malformed (missing/extra delimiters).`),i.push("A block (`subgraph`, `class`, etc.) may be incomplete.")),{summary:r,likelyCauses:[...new Set(i)]}},mF=e=>aF(e)?e.replace(/\n\s*Expecting[\s\S]*$/,``).trimEnd():e,hF=({error:e,canvasRef:t,loaded:n,hideErrorDetails:r,sourceText:i,autoFixAvailable:a,onApplyAutoFix:o})=>{let s=e?r?K(`chat.errors.mermaidParseError`):mF(e.message):null,c=e&&!r?pF(e.message,i):null,l=!!a&&!!o&&!r,u=s?.split(/\r?\n/)??[];return(0,W.jsxs)(`div`,{className:`ttd-dialog-output-wrapper ${e?`ttd-dialog-output-wrapper--error`:``}`,children:[e&&(0,W.jsx)(`div`,{"data-testid":`ttd-dialog-output-error`,className:`ttd-dialog-output-error`,children:(0,W.jsxs)(`div`,{className:`ttd-dialog-output-error-content`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-icon`,children:rS}),c&&(0,W.jsxs)(`div`,{className:`ttd-dialog-output-error-summary`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-summary__headline`,children:c.summary}),(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-summary__label`,children:`Likely causes:`}),(0,W.jsx)(`ul`,{className:`ttd-dialog-output-error-summary__causes`,children:c.likelyCauses.map(e=>(0,W.jsx)(`li`,{children:e},e))})]}),(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-message`,children:u.map((e,t)=>(0,W.jsxs)(`span`,{className:sF(e)?`ttd-dialog-output-error-message__caret`:void 0,children:[e,t<u.length-1?`
|
|
69
|
+
`:``]},`error-line-${t}`))}),!r&&(0,W.jsx)(`div`,{className:`ttd-dialog-output-error-autofix-slot`,children:l?(0,W.jsx)(QO,{className:`ttd-dialog-panel-button ttd-dialog-output-error-autofix`,onSelect:o,children:K(`mermaid.autoFixAvailable`)}):null})]})},`error`),n?(0,W.jsx)(`div`,{className:U(`ttd-dialog-output-canvas-container`,{invisible:!!e}),children:(0,W.jsx)(`div`,{ref:t,className:`ttd-dialog-output-canvas-content`})},`canvas`):(0,W.jsx)($S,{size:`2rem`})]})},gF=({label:e,children:t,panelActions:n=[],onTextSubmitInProgess:r,renderTopRight:i,renderSubmitShortcut:a,className:o,panelActionJustifyContent:s=`flex-start`})=>{let c=e=>{if(e?.variant===`link`)return(0,W.jsxs)(`button`,{className:U(`ttd-dialog-panel-action-link`,e.className),onClick:e.action,disabled:e?.disabled||r,type:`button`,children:[e.label,e.icon&&(0,W.jsx)(`span`,{className:`ttd-dialog-panel-action-link__icon`,children:e.icon})]});if(e?.variant===`button`)return(0,W.jsxs)(QO,{className:U(`ttd-dialog-panel-button`,e.className),onSelect:e.action?e.action:()=>{},disabled:e?.disabled||r,children:[(0,W.jsxs)(`div`,{className:U({invisible:r}),children:[e?.label,e?.icon&&(0,W.jsx)(`span`,{children:e.icon})]}),r&&(0,W.jsx)($S,{})]});if(e?.variant===`rateLimit`)return(0,W.jsx)(`div`,{className:U(`ttd-dialog-panel__rate-limit`,e.className),children:e.label})};return(0,W.jsxs)(`div`,{className:U(`ttd-dialog-panel`,o),children:[(e||i)&&(0,W.jsxs)(`div`,{className:`ttd-dialog-panel__header`,children:[typeof e==`string`?(0,W.jsx)(`label`,{children:e}):e,i?.()]}),t,(0,W.jsxs)(`div`,{className:U(`ttd-dialog-panel-button-container`,{invisible:!n.length}),style:{justifyContent:s},children:[n.filter(Boolean).map(e=>(0,W.jsx)(H.Fragment,{children:c(e)},e.label)),!r&&a?.()]})]})},_F=({children:e})=>(0,W.jsx)(`div`,{className:`ttd-dialog-panels`,children:e}),vF=()=>(0,W.jsxs)(`div`,{className:`ttd-dialog-submit-shortcut`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Q(`CtrlOrCmd`)}),(0,W.jsx)(`div`,{className:`ttd-dialog-submit-shortcut__key`,children:Q(`Enter`)})]}),yF=(e,t)=>{let n=dF(e,t);return n==null?null:n-1},bF=(e,t,n)=>{if(t<0||t>=e.length)return null;let r=n(e[t]);if(r===e[t])return null;let i=[...e];return i[t]=r,i.join(`
|
|
70
|
+
`)},xF=e=>{let t=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([A-Za-z]+)\s*$/);if(t)return t[1];let n=e.match(/^(.*(?:\[[^\]]*]|\([^)]*\)|\{[^}]*}|"(?:[^"]*)"|'(?:[^']*)'))([,;:])\s*$/);return n?n[1]:e},SF=e=>e.replace(/(\|[^|\n]+\|)\s*>\s*(?=[A-Za-z0-9_("[{'`])/g,`$1 `),CF=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),wF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${CF(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/);for(let e=r.length-1;e>=0;e--)if(n.test(r[e]))return r.filter((t,n)=>n!==e).join(`
|
|
71
|
+
`);return null},TF=(e,t)=>{let n=RegExp(`^\\s*deactivate\\s+${CF(t)}(?:\\s+%%.*)?\\s*$`),r=e.split(/\r?\n/),i=!1,a=r.filter(e=>n.test(e)?(i=!0,!1):!0);return i?a.join(`
|
|
72
|
+
`):null},EF=e=>{let t=(e.match(/^\s*subgraph\b/gm)||[]).length-(e.match(/^\s*end\s*$/gm)||[]).length;if(t<=0)return null;let n=Array.from({length:t},()=>`end`).join(`
|
|
73
|
+
`);return`${e.trimEnd()}
|
|
74
|
+
${n}`},DF=e=>e.replace(/[“”]/g,`"`).replace(/[‘’]/g,`'`),OF=(e,t)=>{if(!oF(t)||!e.trim())return[];let n=[],r=new Set,i=t=>{!t||t===e||r.has(t)||(r.add(t),n.push(t))},a=cF(t);if(a&&(i(wF(e,a)),i(TF(e,a))),aF(t)){let n=e.split(/\r?\n/),r=yF(t,e),a=r==null?[]:[r,r-1,r+1];for(let e of a)i(bF(n,e,e=>xF(e))),i(bF(n,e,e=>SF(e)));i(SF(e)),i(EF(e));let o=DF(e);i(o===e?null:o)}return n},kF=({canvasRef:e,setError:t})=>{let n=e.current;if(!n)return;let r=n.parentElement;r&&(r.style.background=``,t(null),n.replaceChildren())},AF=async({canvasRef:e,mermaidToExcalidrawLib:t,mermaidDefinition:n,setError:r,data:i,theme:a})=>{let o=e.current,s=o?.parentElement;if(!o||!s)return{success:!1};if(!n)return kF({canvasRef:e,setError:r}),{success:!1};let c;try{let e=await t.api;try{c=await e.parseMermaidToExcalidraw(n)}catch(t){let r=t;if(!n.includes(`"`))return{success:!1,error:r};try{c=await e.parseMermaidToExcalidraw(n.replace(/"/g,`'`))}catch{return{success:!1,error:r}}}let{elements:l,files:u={}}=c;r(null),i.current={elements:sn(l,{regenerateIds:!0}),files:u};let d=await zD({elements:i.current.elements,files:i.current.files,exportPadding:10,maxWidthOrHeight:Math.max(s.offsetWidth,s.offsetHeight)*window.devicePixelRatio,appState:{exportWithDarkMode:a===R.DARK}});return s.style.background=`var(--default-bg-color)`,o.replaceChildren(d),{success:!0}}catch(e){return s.style.background=`var(--default-bg-color)`,n&&r(e),{success:!1,error:e}}},jF=e=>{sO.set(da.MERMAID_TO_EXCALIDRAW,e)},MF=({app:e,data:t,text:n,shouldSaveMermaidDataToStorage:r})=>{let{elements:i,files:a}=t.current;i.length&&(e.addElementsFromPasteOrLibrary({elements:i,files:a,position:`center`,fitToContent:!0}),e.setOpenDialog(null),r&&n&&jF(n))},NF=`flowchart TD
|
|
75
|
+
A[Christmas] -->|Get money| B(Go shopping)
|
|
76
|
+
B --> C{Let me think}
|
|
77
|
+
C -->|One| D[Laptop]
|
|
78
|
+
C -->|Two| E[iPhone]
|
|
79
|
+
C -->|Three| F[Car]`,PF=wt(jF,300),FF=500,IF=4,LF=30,RF=e=>e instanceof Error?e.message:typeof e==`string`?e:e&&typeof e==`object`&&`message`in e&&typeof e.message==`string`?e.message:``,zF=({mermaidToExcalidrawLib:e,isActive:t})=>{let[n,r]=(0,H.useState)(()=>sO.get(da.MERMAID_TO_EXCALIDRAW)||NF),i=(0,H.useDeferredValue)(n),[a,o]=(0,H.useState)(null),[s,c]=(0,H.useState)(null),l=a?.message?dF(a.message,i):null,u=(0,H.useRef)(null),d=(0,H.useRef)({elements:[],files:null}),f=nz(),{theme:p}=gC();(0,H.useEffect)(()=>{t&&((async()=>{try{if(!i.trim()){kF({canvasRef:u,setError:o});return}let t=await AF({canvasRef:u,data:d,mermaidToExcalidrawLib:e,setError:o,mermaidDefinition:i,theme:p});t.success||o(t.error??Error(`Invalid mermaid definition`))}catch(e){Vt()&&console.error(`Failed to parse mermaid definition`,e)}})(),PF(i))},[i,e,t,p]),(0,H.useEffect)(()=>()=>{PF.flush()},[]),(0,H.useEffect)(()=>{let n=a?.message??``,r=i;if(!(t&&oF(n)&&r.trim()&&e.loaded)){c(null);return}let o=OF(r,n);if(!o.length){c(null);return}let s=!1,l=setTimeout(async()=>{try{let t=await e.api,n=new Set([r]),i=o.map(e=>({text:e,depth:1})),a=0;for(;i.length>0&&a<LF;){let e=i.shift();if(!(!e||n.has(e.text))){n.add(e.text),a+=1;try{await t.parseMermaidToExcalidraw(e.text),s||c(e.text);return}catch(t){if(e.depth>=IF)continue;let r=RF(t);if(!r)continue;let a=OF(e.text,r);for(let t of a)n.has(t)||i.push({text:t,depth:e.depth+1})}}}}catch{}s||c(null)},FF);return()=>{s=!0,clearTimeout(l)}},[i,a?.message,t,e]);let m=()=>{MF({app:f,data:d,text:n,shouldSaveMermaidDataToStorage:!0})};return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`ttd-dialog-desc`,children:(0,W.jsx)(pO,{i18nKey:`mermaid.description`,flowchartLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/flowchart.html`,target:`_blank`,rel:`noreferrer`,children:e}),sequenceLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/sequenceDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),classLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/classDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e}),erdLink:e=>(0,W.jsx)(`a`,{href:`https://mermaid.js.org/syntax/entityRelationshipDiagram.html`,target:`_blank`,rel:`noreferrer`,children:e})})}),(0,W.jsxs)(_F,{children:[(0,W.jsx)(gF,{children:(0,W.jsx)(tF,{input:n,placeholder:K(`mermaid.inputPlaceholder`),onChange:e=>r(e),errorLine:l,onKeyboardSubmit:()=>{m()}})}),(0,W.jsx)(gF,{panelActions:[{action:()=>{m()},label:K(`mermaid.button`),icon:uS,variant:`button`}],renderSubmitShortcut:()=>(0,W.jsx)(vF,{}),children:(0,W.jsx)(hF,{canvasRef:u,loaded:e.loaded,error:a,sourceText:n,autoFixAvailable:!!s,onApplyAutoFix:()=>{s&&r(s)}})})]})]})},BF=()=>(0,W.jsxs)(`div`,{className:`chat-interface__welcome-screen__welcome-message`,children:[(0,W.jsx)(`h3`,{children:K(`chat.placeholder.title`)}),(0,W.jsx)(`p`,{children:K(`chat.placeholder.description`)}),(0,W.jsx)(`p`,{children:K(`chat.placeholder.hint`)})]}),VF=({message:e,onMermaidTabClick:t,onAiRepairClick:n,onDeleteMessage:i,onInsertMessage:a,onRetry:o,rateLimitRemaining:s,isLastMessage:c,renderWarning:l,allowFixingParseError:u})=>{let[d,f]=(0,H.useState)(!1);(0,H.useEffect)(()=>{if(!e.error||!c)return;if(e.error&&!e.lastAttemptAt){f(!0);return}let t=Date.now()-e.lastAttemptAt,n=Math.max(0,5e3-t);if(n===0){f(!0);return}f(!1);let r=setTimeout(()=>{f(!0)},n);return()=>clearTimeout(r)},[e.error,e.lastAttemptAt,c]);let p=e=>e.toLocaleTimeString([],{hour:`2-digit`,minute:`2-digit`});if(e.type===`warning`){let t=l?.(e);return(0,W.jsx)(`div`,{className:`chat-message chat-message--system`,children:(0,W.jsxs)(`div`,{className:`chat-message__content`,children:[(0,W.jsxs)(`div`,{className:`chat-message__header`,children:[(0,W.jsx)(`span`,{className:`chat-message__role`,children:K(`chat.role.system`)}),(0,W.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,W.jsx)(`div`,{className:`chat-message__body`,children:(0,W.jsx)(`div`,{className:`chat-message__text`,children:t||(e.warningType===`messageLimitExceeded`?(0,W.jsxs)(W.Fragment,{children:[K(`chat.rateLimit.messageLimit`),(0,W.jsx)(`div`,{style:{marginTop:`10px`},children:(0,W.jsx)(FP,{onClick:()=>{window.open(`${r.VITE_APP_PLUS_LP}/plus?utm_source=excalidraw&utm_medium=app&utm_content=ttdChatBanner#excalidraw-redirect`,`_blank`,`noopener`)},children:K(`chat.upsellBtnLabel`)})})]}):K(`chat.rateLimit.generalRateLimit`))})})]})})}return(0,W.jsxs)(`div`,{className:`chat-message chat-message--${e.type}`,children:[(0,W.jsxs)(`div`,{className:`chat-message__content`,children:[(0,W.jsxs)(`div`,{className:`chat-message__header`,children:[(0,W.jsx)(`span`,{className:`chat-message__role`,children:e.type===`user`?K(`chat.role.user`):K(`chat.role.assistant`)}),(0,W.jsx)(`span`,{className:`chat-message__timestamp`,children:p(e.timestamp)})]}),(0,W.jsx)(`div`,{className:`chat-message__body`,children:e.error?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`chat-message__error`,children:e.content}),e.errorType!==`parse`&&(0,W.jsxs)(`div`,{className:`chat-message__error_message`,children:[`Error: `,e.error||K(`chat.errors.generationFailed`)]}),e.errorType===`parse`&&u&&(0,W.jsxs)(`div`,{className:`chat-message__error_message`,children:[(0,W.jsx)(`p`,{children:K(`chat.errors.invalidDiagram`)}),(0,W.jsxs)(`div`,{className:`chat-message__error-actions`,children:[t&&(0,W.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>t(e),type:`button`,children:K(`chat.errors.fixInMermaid`)}),n&&(0,W.jsx)(`button`,{className:`chat-message__error-link`,onClick:()=>n(e),disabled:s===0,type:`button`,children:K(`chat.errors.aiRepair`)})]})]})]}):(0,W.jsxs)(`div`,{className:`chat-message__text`,children:[e.content,e.isGenerating&&(0,W.jsx)(`span`,{className:`chat-message__cursor`,children:`▋`})]})})]}),e.type===`assistant`&&!e.isGenerating&&(0,W.jsxs)(`div`,{className:`chat-message__actions`,children:[!e.error&&a&&(0,W.jsx)(`button`,{className:`chat-message__action`,onClick:()=>a(e),type:`button`,"aria-label":K(`chat.insert`),title:K(`chat.insert`),children:lS}),t&&e.content&&(0,W.jsx)(`button`,{className:`chat-message__action`,onClick:()=>t(e),type:`button`,"aria-label":K(`chat.viewAsMermaid`),title:K(`chat.viewAsMermaid`),children:Vx}),i&&e.errorType!==`network`&&(0,W.jsx)(`button`,{className:`chat-message__action chat-message__action--danger`,onClick:()=>i(e.id),type:`button`,"aria-label":K(`chat.deleteMessage`),title:K(`chat.deleteMessage`),children:pb}),e.errorType===`network`&&o&&c&&(0,W.jsx)(`button`,{className:U(`chat-message__action`,{invisible:!d}),onClick:()=>o(e),type:`button`,"aria-label":K(`chat.retry`),title:K(`chat.retry`),children:cS})]})]})},HF=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,rateLimits:o,onAbort:s,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,renderWelcomeScreen:p,renderWarning:m})=>{let h=(0,H.useRef)(null),g=(0,H.useRef)(null);(0,H.useLayoutEffect)(()=>{h.current?.scrollIntoView()},[t]),(0,H.useEffect)(()=>{g.current&&g.current.focus()},[e]);let _=e=>{let t=e.target.value;r(t)},v=()=>{if(a&&s){s();return}let e=n.trim();e&&(i({prompt:e}),r(``))},y=e=>{e.key===N.ENTER&&!e.shiftKey&&(e.preventDefault(),a||v())},b=n.trim().length>3&&!a&&(o?.rateLimitRemaining??1)>0,x=a&&!!s;return(0,W.jsxs)(`div`,{className:`chat-interface`,children:[(0,W.jsxs)(`div`,{className:`chat-interface__messages`,children:[t.length===0?(0,W.jsx)(`div`,{className:`chat-interface__welcome-screen`,children:p?p({rateLimits:o??null}):(0,W.jsx)(BF,{})}):t.map((e,n)=>(0,W.jsx)(VF,{message:e,onMermaidTabClick:c,onAiRepairClick:l,onDeleteMessage:u,onInsertMessage:d,onRetry:f,rateLimitRemaining:o?.rateLimitRemaining,isLastMessage:n===t.length-1,renderWarning:m,allowFixingParseError:e.errorType===`parse`&&n===t.length-1},e.id)),(0,W.jsx)(`div`,{ref:h,id:`messages-end`})]}),(0,W.jsx)(`div`,{className:`chat-interface__input-container`,children:(0,W.jsx)(`div`,{className:`chat-interface__input-outer`,children:(0,W.jsxs)(`div`,{className:`chat-interface__input-wrapper`,style:{borderColor:a?`var(--dialog-border-color)`:void 0},children:[(0,W.jsx)(`textarea`,{ref:g,autoFocus:!0,className:`chat-interface__input`,value:n,onChange:_,onKeyDown:y,placeholder:a?K(`chat.generating`):o?.rateLimitRemaining===0?K(`chat.rateLimit.messageLimitInputPlaceholder`):t.length>0?K(`chat.inputPlaceholderWithMessages`):K(`chat.inputPlaceholder`,{shortcut:`Shift + Enter`}),disabled:o?.rateLimitRemaining===0,rows:1,cols:30,onInput:e=>{let t=e.target;t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,120)}px`}}),(0,W.jsx)(`button`,{className:`chat-interface__send-button`,onClick:v,disabled:!b&&!x,type:`button`,children:(0,W.jsx)(mw,{size:`1.5em`,icon:a?tx:uS})})]})})})]})},UF=yc(null),WF=yc(!1),GF=yc(null),KF=yc({id:Bi(),messages:[],currentPrompt:``}),qF=(e,t)=>{let{messages:n}=e,r=_n(n,e=>e.type===`assistant`);if(r===-1)return e;let i=n[r],a=n.slice();return a[r]={...i,...t},{...e,messages:a}},JF=e=>{let{messages:t}=e;return t[_n(t,e=>e.type===`assistant`)]},YF=(e,t)=>{let n=t.map(e=>({...e,id:Bi(),timestamp:new Date}));return{...e,messages:[...e.messages,...n]}},XF=e=>{let t=_n(e.messages??[],e=>e.type===`assistant`);return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}},ZF=e=>{let t=[];for(let n of e.messages)n.content&&(n.type===`user`||n.type===`assistant`)&&t.push({role:n.type,content:n.content});return t},QF=()=>{let[e,t]=vy(KF);return{addUserMessage:e=>{t(t=>YF(t,[{type:`user`,content:e}]))},addAssistantMessage:()=>{t(e=>YF(e,[{type:`assistant`,content:``,isGenerating:!0}]))},setAssistantError:(e,n=`other`,r)=>{let i=r?JSON.stringify({name:r instanceof Error?r.name:`Error`,message:r instanceof Error?r.message:String(r),stack:r instanceof Error?r.stack:void 0}):void 0;t(t=>qF(t,{isGenerating:!1,error:e,errorType:n,errorDetails:i}))},chatHistory:e,setChatHistory:t,setLastRetryAttempt:()=>{t(e=>qF(e,{lastAttemptAt:Date.now()}))}}},$F=e=>{let t=e.trim();return t.length<=50?t:`${t.substring(0,47)}...`},eI=yc([]),tI=yc(!1),nI=yc(!1),rI=({persistenceAdapter:e})=>{let[t]=vy(KF),[n,r]=vy(eI),[i,a]=vy(tI),[o,s]=vy(nI),c=(0,H.useRef)(n);c.current=n;let l=t?.messages[t?.messages.length-1],u=(0,H.useCallback)(async()=>{if(!(o||i)){a(!0);try{r(await e.loadChats()),s(!0)}catch(e){console.warn(`Failed to load chats:`,e),r([]),s(!0)}finally{a(!1)}}},[o,i,r,a,s,e]);(0,H.useEffect)(()=>{u()},[]);let d=(0,H.useCallback)(async()=>{if(t.messages.length===0)return;let n=t.messages.find(e=>e.type===`user`);if(!n||typeof n.content!=`string`)return;let i=$F(n.content),a=c.current,o=a.find(e=>e.id===t.id),s=!o||o.messages.length!==t.messages.length||o.messages.some((e,n)=>e.id!==t.messages[n]?.id||e.content!==t.messages[n]?.content),l={id:t.id,title:i,messages:t.messages.filter(e=>e.type===`user`||e.type===`assistant`).map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),currentPrompt:t.currentPrompt,timestamp:s?Date.now():o?.timestamp??Date.now()},u=[...a.filter(e=>e.id!==t.id),l].sort((e,t)=>t.timestamp-e.timestamp).slice(0,10);r(u);try{await e.saveChats(u)}catch(e){console.warn(`Failed to save chats:`,e)}},[t,r,e]);return(0,H.useEffect)(()=>{l?.isGenerating||d()},[t.messages?.length,l?.id,l?.isGenerating]),{savedChats:n,saveCurrentChat:d,deleteChat:(0,H.useCallback)(async t=>{let n=c.current.filter(e=>e.id!==t);r(n);try{await e.saveChats(n)}catch(e){console.warn(`Failed to save after delete:`,e)}return n},[r,e]),restoreChat:(0,H.useCallback)(e=>e,[]),createNewChatId:(0,H.useCallback)(async()=>(await d(),Bi()),[d])}},iI=e=>{let t=e.trim();if(!t)return!1;let n=(t.match(/\[/g)||[]).length,r=(t.match(/\]/g)||[]).length,i=(t.match(/\{/g)||[]).length,a=(t.match(/\}/g)||[]).length,o=(t.match(/\(/g)||[]).length,s=(t.match(/\)/g)||[]).length;if(n!==r||i!==a||o!==s)return!1;let c=t.split(`
|
|
80
|
+
`).pop()?.trim()||``;return![/-->$/,/--$/,/-\.$/,/==>$/,/==$/,/~~$/,/::$/,/:$/,/\|$/,/&$/].some(e=>e.test(c))},aI=300,oI=3e3,sI=100,cI=100,lI=({mermaidToExcalidrawLib:e,canvasRef:t})=>{let[n]=vy(KF),[,r]=vy(GF),[i,a]=vy(WF),o=(0,H.useRef)(!1),s=(0,H.useMemo)(()=>JF(n),[n]),c=(0,H.useRef)(s);(0,H.useEffect)(()=>{c.current=s},[s]);let l=(0,H.useRef)({elements:[],files:null}),u=(0,H.useRef)(0),d=(0,H.useRef)(null),f=(0,H.useRef)(!1),p=(0,H.useRef)(aI),{theme:m}=gC(),h=(0,H.useCallback)(async n=>{if(!n.trim()||!e.loaded||o.current)return!1;o.current=!0;let i=performance.now(),a=await AF({canvasRef:t,data:l,mermaidToExcalidrawLib:e,setError:r,mermaidDefinition:n,theme:m});return performance.now()-i<sI?p.current=aI:p.current=oI,o.current=!1,a.success},[t,e,r,m]),g=(0,H.useMemo)(()=>{let e=async e=>{let t=Date.now(),n=t-u.current,r=p.current;if(!iI(e)){f.current||=(u.current=Math.max(u.current,t-r+cI),!0),d.current=e;return}if(f.current=!1,n<r){d.current=e;return}d.current=null;let i=await h(e);u.current=Date.now(),i||(u.current=u.current-r+cI,f.current=!0)};return e.flush=async()=>{if(d.current){let e=d.current;d.current=null,await h(e),u.current=Date.now()}},e.cancel=()=>{d.current=null},e},[h]),_=(0,H.useCallback)(()=>{u.current=0,d.current=null,f.current=!1,p.current=aI},[]);return(0,H.useEffect)(()=>{s?.content&&s?.isGenerating?g(s.content):s?.isGenerating||(g.flush(),_(),s?.content&&g(s.content))},[_,g,s?.isGenerating,s?.content]),(0,H.useEffect)(()=>{let e=c.current;!e?.content||e.error||i&&h(e.content)},[n?.id,h,i]),(0,H.useEffect)(()=>{if(n.messages?.filter(e=>e.type===`assistant`).length)i||a(!0);else{let e=t.current;if(e){let t=e.parentElement;t&&(t.style.background=``,e.replaceChildren())}a(!1)}},[n.messages,a,t,i]),{data:l}},uI=3,dI=1e4,fI=({onTextSubmit:e})=>{let[,t]=vy(GF),[n,r]=vy(UF),[i,a]=vy(KF),{addUserMessage:o,addAssistantMessage:s,setAssistantError:c}=QF(),l=(0,H.useRef)(null),u=e=>e.length>dI||e.length<uI||n?.rateLimitRemaining===0?(e.length<uI&&t(Error(K(`chat.errors.promptTooShort`,{min:uI}))),e.length>dI&&t(Error(K(`chat.errors.promptTooLong`,{max:dI}))),!1):!0;return{onGenerate:async({prompt:n,isRepairFlow:d=!1})=>{if(!u(n))return;l.current&&l.current.abort(),t(null);let f=new AbortController;l.current=f,d?a(e=>qF(e,{isGenerating:!0,content:``,error:void 0,errorType:void 0,errorDetails:void 0})):(o(n),s());try{dC(`ai`,`generate`,`ttd`);let{generatedResponse:o,error:s,rateLimit:l,rateLimitRemaining:u}=await e({messages:[...ZF(i).slice(-3),{role:`user`,content:n}],onStreamCreated:()=>{d&&a(e=>qF(e,{content:``,error:``,isGenerating:!0}))},onChunk:e=>{a(t=>qF(t,{content:JF(t).content+e}))},signal:f.signal});if(a(e=>qF(e,{isGenerating:!1})),Ls(l)&&Ls(u)&&r({rateLimit:l,rateLimitRemaining:u}),(s?.status===429||u===0)&&a(e=>(s?.status===429&&(e=XF(e)),e={...e,messages:e.messages.filter(e=>e.type!==`warning`||e.warningType===`rateLimitExceeded`||e.warningType===`messageLimitExceeded`)},YF(e,[{type:`warning`,warningType:u===0?`messageLimitExceeded`:`rateLimitExceeded`}]))),s){if(s.name===`AbortError`||s.message===`Aborted`||f.signal.aborted)return;let e=Error(s.message||K(`chat.errors.requestFailed`));s.status!==429&&c(e.message,`network`),t(e);return}try{await tc(o??``),dC(`ai`,`mermaid parse success`,`ttd`)}catch(e){dC(`ai`,`mermaid parse failed`,`ttd`);let n=Error(e.message||K(`chat.errors.mermaidParseError`));c(n.message,`parse`),t(n)}}catch(e){let n=Error(e.message||K(`chat.errors.generationFailed`));c(n.message,`other`),t(n)}finally{l.current=null}},handleAbort:()=>{l.current&&l.current.abort()}}},pI=({persistenceAdapter:e})=>{let t=yy(GF),[n,r]=vy(KF),[i,a]=(0,H.useState)(!1),{restoreChat:o,deleteChat:s,createNewChatId:c}=rI({persistenceAdapter:e}),l=(0,H.useCallback)(e=>{let n=e.messages.map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp:new Date(e.timestamp)})),i={id:e.id,messages:n,currentPrompt:``},a=JF(i);t(a?.error?Error(a?.error):null),r(i)},[t,r]),u=(0,H.useCallback)(async()=>{r({id:await c(),messages:[],currentPrompt:``}),t(null)},[c,r,t]);return{isMenuOpen:i,onRestoreChat:(0,H.useCallback)(e=>{l(o(e)),a(!1)},[o,l]),handleDeleteChat:(0,H.useCallback)(async(e,t)=>{t.stopPropagation();let r=e===n.id,i=await s(e);if(r)if(i.length>0){let e=i[0];l(e)}else await u()},[n.id,s,l,u]),handleNewChat:(0,H.useCallback)(async()=>{await u(),a(!1)},[u]),handleMenuToggle:(0,H.useCallback)(()=>{a(e=>!e)},[]),handleMenuClose:(0,H.useCallback)(()=>{a(!1)},[])}},mI=({isOpen:e,onToggle:t,onClose:n,onNewChat:r,onRestoreChat:i,onDeleteChat:a,isNewChatBtnVisible:o,savedChats:s,activeSessionId:c,disabled:l})=>(0,W.jsxs)(`div`,{className:`ttd-chat-history-menu`,children:[o&&(0,W.jsx)(FP,{onClick:r,disabled:l,children:K(`chat.newChat`)}),s.length>0&&(0,W.jsx)(`div`,{className:`ttd-dialog-panel__menu-wrapper`,children:(0,W.jsxs)(HO,{open:e,children:[(0,W.jsx)(HO.Trigger,{onToggle:t,className:`ttd-dialog-menu-trigger`,disabled:l,title:K(`chat.menu`),"aria-label":K(`chat.menu`),children:bS}),(0,W.jsx)(HO.Content,{onClickOutside:n,onSelect:n,children:(0,W.jsx)(W.Fragment,{children:s.map(e=>(0,W.jsxs)(HO.ItemCustom,{className:U(`ttd-chat-menu-item`,{"ttd-chat-menu-item--active":e.id===c}),onClick:()=>{i(e)},children:[(0,W.jsx)(`span`,{className:`ttd-chat-menu-item__title`,children:e.title}),(0,W.jsx)(`button`,{className:`ttd-chat-menu-item__delete`,onClick:t=>a(e.id,t),title:K(`chat.deleteChat`),"aria-label":K(`chat.deleteChat`),type:`button`,children:pb})]},e.id))})})]})})]}),hI=({chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,isMenuOpen:s,onMenuToggle:c,onMenuClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,onViewAsMermaid:x,renderWelcomeScreen:S,renderWarning:C})=>{let[w]=vy(UF),T=(()=>{let e=[];return w&&e.push({label:K(`chat.rateLimitRemaining`,{count:w.rateLimitRemaining}),variant:`rateLimit`,className:w.rateLimitRemaining<5?`ttd-dialog-panel__rate-limit--danger`:``}),o&&e.push({action:x,label:K(`chat.viewAsMermaid`),icon:(0,W.jsx)(mw,{icon:uS}),variant:`link`}),e})();return(0,W.jsx)(gF,{label:(0,W.jsxs)(`div`,{className:`ttd-dialog-panel__label-wrapper`,children:[(0,W.jsx)(`div`,{className:`ttd-dialog-panel__label-group`}),(0,W.jsx)(`div`,{className:`ttd-dialog-panel__header-right`,children:(0,W.jsx)(mI,{isNewChatBtnVisible:!!t.length,isOpen:s,onToggle:c,onClose:l,onNewChat:u,onRestoreChat:d,onDeleteChat:f,savedChats:p,activeSessionId:m,disabled:a})})]}),className:`ttd-dialog-chat-panel`,panelActionJustifyContent:T.length===2?`space-between`:T.length===1&&T[0].variant===`rateLimit`?`flex-start`:`flex-end`,panelActions:T,children:(0,W.jsx)(HF,{chatId:e,messages:t,currentPrompt:n,onPromptChange:r,onGenerate:i,isGenerating:a,generatedResponse:o,onAbort:h,onMermaidTabClick:g,onAiRepairClick:_,onDeleteMessage:v,onInsertMessage:y,onRetry:b,rateLimits:w,renderWelcomeScreen:S,renderWarning:C})})},gI=({canvasRef:e,error:t,loaded:n,onInsert:r,hideErrorDetails:i})=>(0,W.jsx)(gF,{panelActionJustifyContent:`flex-end`,panelActions:[{action:r,label:K(`chat.insert`),icon:uS,variant:`button`}],className:`ttd-dialog-preview-panel`,children:(0,W.jsx)(hF,{canvasRef:e,error:t,loaded:n,hideErrorDetails:i})}),_I=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>{let a=nz(),o=lz(),s=(0,H.useRef)(null),[c,l]=vy(GF),[u,d]=vy(KF),f=by(WF),{savedChats:p}=rI({persistenceAdapter:i}),m=JF(u),{setLastRetryAttempt:h}=QF(),{data:g}=lI({canvasRef:s,mermaidToExcalidrawLib:e}),{onGenerate:_,handleAbort:v}=fI({onTextSubmit:t}),{isMenuOpen:y,onRestoreChat:b,handleDeleteChat:x,handleNewChat:S,handleMenuToggle:C,handleMenuClose:w}=pI({persistenceAdapter:i});return(0,W.jsxs)(`div`,{className:`ttd-dialog-layout ${f?`ttd-dialog-layout--split`:`ttd-dialog-layout--chat-only`}`,children:[(0,W.jsx)(hI,{chatId:u.id,messages:u.messages,currentPrompt:u.currentPrompt,onPromptChange:e=>{d(t=>({...t,currentPrompt:e}))},onGenerate:_,isGenerating:m?.isGenerating??!1,generatedResponse:m?.content,isMenuOpen:y,onMenuToggle:C,onMenuClose:w,onNewChat:S,onRestoreChat:b,onDeleteChat:x,savedChats:p,activeSessionId:u.id,onAbort:v,onMermaidTabClick:e=>{let t=e.content||``;t&&(jF(t),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},onAiRepairClick:async e=>{let t=e.content||``,n=e.error||``;t&&await _({prompt:`Fix the error in this Mermaid diagram. The diagram is:
|
|
81
|
+
|
|
82
|
+
\`\`\`mermaid
|
|
83
|
+
${t}
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
The exception/error is: ${n}
|
|
87
|
+
|
|
88
|
+
Please fix the Mermaid syntax and regenerate a valid diagram.`,isRepairFlow:!0})},onDeleteMessage:e=>{let t=u.messages.findIndex(t=>t.id===e&&t.type===`assistant`),n=u.messages.slice(0,t-1);d({...u,messages:n})},onInsertMessage:async t=>{let n=t.content||``;if(!n.trim()||!e.loaded)return;let r={current:{elements:[],files:null}};(await AF({canvasRef:s,data:r,mermaidToExcalidrawLib:e,setError:l,mermaidDefinition:n,theme:a.state.theme})).success&&MF({app:a,data:r,text:n,shouldSaveMermaidDataToStorage:!0})},onRetry:async e=>{let t=u.messages.findIndex(t=>t.id===e.id);if(t>0){let e=u.messages[t-1];e.type===`user`&&typeof e.content==`string`&&(h(),await _({prompt:e.content,isRepairFlow:!0}))}},onViewAsMermaid:()=>{typeof m?.content==`string`&&(jF(m.content),o({openDialog:{name:`ttd`,tab:`mermaid`}}))},renderWarning:r,renderWelcomeScreen:n}),f&&(0,W.jsx)(gI,{canvasRef:s,hideErrorDetails:m?.errorType===`parse`,error:c,loaded:e.loaded,onInsert:()=>{MF({app:a,data:g})}})]})},vI=({mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i})=>(0,W.jsx)(_I,{mermaidToExcalidrawLib:e,onTextSubmit:t,renderWelcomeScreen:n,renderWarning:r,persistenceAdapter:i}),yI=e=>{let t=lz(),n=(0,H.useRef)(null),r=(0,H.useRef)(0);return(0,W.jsx)(sv,{ref:n,className:`ttd-dialog-tabs-root`,value:e.tab,onValueChange:i=>{if(!i)return;let a=n.current?.closest(`.Modal__content`);if(a){let e=a.offsetHeight||0;e>r.current&&(r.current=e,a.style.minHeight=`min(${r.current}px, 100%)`)}e.dialog===`ttd`&&Sn([`text-to-diagram`,`mermaid`],i)&&t({openDialog:{name:e.dialog,tab:i}})},children:e.children})};yI.displayName=`TTDDialogTabs`;var bI=yI,xI=({children:e,...t})=>(0,W.jsx)(cv,{className:`ttd-dialog-triggers`,...t,children:e});xI.displayName=`TTDDialogTabTriggers`;var SI=({children:e,tab:t,onSelect:n,...r})=>(0,W.jsx)(lv,{value:t,asChild:!0,onSelect:n,children:(0,W.jsx)(`button`,{type:`button`,className:`ttd-dialog-tab-trigger`,...r,children:e})});SI.displayName=`TTDDialogTabTrigger`;var CI=({tab:e,children:t,...n})=>(0,W.jsx)(uv,{...n,value:e,children:t});CI.displayName=`TTDDialogTab`;var wI=e=>{let t=gC();return t.openDialog?.name===`ttd`?(0,W.jsx)(TI,{...e,tab:t.openDialog.tab}):null};wI.WelcomeMessage=BF;var TI=oP(`TTDDialogBase`,({tab:e,...t})=>{let r=nz(),[i,a]=(0,H.useState)({loaded:!1,api:n(()=>import(`./excalidraw-mermaid-stub-C1ZaaI05.js`),__vite__mapDeps([70,71]),import.meta.url)});return(0,H.useEffect)(()=>{(async()=>{await i.api,a(e=>({...e,loaded:!0}))})()},[i.api]),(0,W.jsx)(dk,{className:`ttd-dialog`,onCloseRequest:()=>{r.setOpenDialog(null)},size:1520,title:!1,...t,autofocus:!1,children:(0,W.jsxs)(bI,{dialog:`ttd`,tab:e,children:[`__fallback`in t&&t.__fallback?(0,W.jsx)(`p`,{className:`dialog-mermaid-title`,children:K(`mermaid.title`)}):(0,W.jsxs)(xI,{children:[(0,W.jsx)(SI,{tab:`text-to-diagram`,children:(0,W.jsxs)(`div`,{className:`ttd-dialog-tab-trigger__content`,children:[K(`labels.textToDiagram`),(0,W.jsx)(`div`,{className:`ttd-dialog-tab-trigger__badge`,children:K(`chat.aiBeta`)})]})}),(0,W.jsx)(SI,{tab:`mermaid`,children:K(`mermaid.label`)})]}),!(`__fallback`in t)&&(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`text-to-diagram`,children:(0,W.jsx)(vI,{mermaidToExcalidrawLib:i,onTextSubmit:t.onTextSubmit,renderWelcomeScreen:t.renderWelcomeScreen,renderWarning:t.renderWarning,persistenceAdapter:t.persistenceAdapter})}),(0,W.jsx)(CI,{className:`ttd-dialog-content`,tab:`mermaid`,children:(0,W.jsx)(zF,{mermaidToExcalidrawLib:i,isActive:e===`mermaid`})})]})})}),EI=.01,DI=10,OI=(e,t)=>!(t===`angle`&&L(e)),kI=(e,t)=>{let n=e+t/2;return n-n%t},AI=(e,t,n)=>Object.keys(e).map(e=>({original:(n??t).get(e),latest:t.get(e)})).filter(e=>e.original!==void 0&&e.latest!==void 0),jI=(e,t,n,r,i,a,o=!0)=>{if(ss(n)&&(n.startBinding||n.endBinding)){if(Math.abs(e-n.x)<10&&Math.abs(t-n.y)<10)return;vr(n,`start`,r),vr(n,`end`,r)}let s=r.getNonDeletedElementsMap(),c=s.get(n.id);if(!c)return;let[l,u]=[n.x+n.width/2,n.y+n.height/2],[d,f]=ke(O(n.x,n.y),O(l,u),n.angle),p=e-d,m=t-f,[h,g]=ke(O(e,t),O(l+p,u+m),-n.angle);r.mutateElement(c,{x:h,y:g},{informMutation:o,isDragging:!1}),Xn(c,r,i);let _=ut(n,a);if(_){let e=s.get(_.id);e&&r.mutateElement(e,{x:_.x+p,y:_.y+m},{informMutation:o,isDragging:!1})}if(L(n)){let e=Di(a,n.id);e.forEach(t=>{let n=s.get(t.id);if(!n)return;let[a,c]=[t.x+t.width/2,t.y+t.height/2],[l,u]=ke(O(t.x,t.y),O(a,c),t.angle),[d,f]=ke(O(Math.round(l+p),Math.round(u+m)),O(a+p,c+m),-t.angle);r.mutateElement(n,{x:d,y:f},{informMutation:o,isDragging:!1}),Xn(n,r,i,{simultaneouslyUpdated:e})})}},MI=(e,t)=>{let n=po(t).map(t=>Ki(e,t).reduce((e,t)=>(e[t.id]=!0,e),{}));return e.filter(e=>!Nn(e)).forEach(e=>{n.push({[e.id]:!0})}),n},NI=({label:e,icon:t,dragInputCallback:n,value:r,elements:i,editable:a=!0,shouldKeepAspectRatio:o,property:s,scene:c,appState:l,sensitivity:u=1,dragFinishedCallback:d})=>{let f=nz(),p=lz(),m=(0,H.useRef)(null),h=(0,H.useRef)(null),[g,_]=(0,H.useState)(r.toString()),v=(0,H.useRef)(null);v.current||={originalAppState:js(l),originalElements:i,lastUpdatedValue:g,updatePending:!1},(0,H.useEffect)(()=>{let e=r.toString();_(e),v.current.lastUpdatedValue=e},[r]);let y=(e,t,i)=>{if(!v.current.updatePending)return!1;v.current.updatePending=!1;let a=Number(e);if(isNaN(a)){_(r.toString());return}let l=Number(a.toFixed(2)),u=Number(r);(isNaN(u)||Math.abs(l-u)>=EI)&&(v.current.lastUpdatedValue=e,n({accumulatedChange:0,instantChange:0,originalElements:t,originalElementsMap:f.scene.getNonDeletedElementsMap(),shouldKeepAspectRatio:o,shouldChangeByStepSize:!1,scene:c,nextValue:l,property:s,originalAppState:i,setInputValue:e=>_(String(e)),app:f,setAppState:p}),f.syncActionResult({captureUpdate:V.IMMEDIATELY}))},b=(0,H.useRef)({});return b.current.handleInputValue=y,(0,H.useEffect)(()=>{let e=m.current,t=b.current;return()=>{let n=e?.value;n&&t.handleInputValue?.(n,v.current.originalElements,v.current.originalAppState),window.removeEventListener(F.POINTER_MOVE,t.onPointerMove,!1),window.removeEventListener(F.POINTER_UP,t.onPointerUp,!1)}},[a]),a?(0,W.jsxs)(`div`,{className:U(`drag-input-container`,!a&&`disabled`),"data-testid":e,children:[(0,W.jsx)(`div`,{className:`drag-input-label`,ref:h,onPointerDown:e=>{if(m.current&&a){document.body.classList.add(`excalidraw-cursor-resize`);let e=Number(m.current.value);isNaN(e)&&(e=0);let t=null,r=f.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),a=i.map(e=>r.get(e.id)),h=js(l),g=0,v=0,y=e=>{if(t&&r!==null&&a!==null){let i=e.clientX-t.x;i!==0&&(v+=i,Math.abs(v)>=u&&(v=Math.sign(v)*Math.floor(Math.abs(v)/u),g+=v,n({accumulatedChange:g,instantChange:v,originalElements:a,originalElementsMap:r,shouldKeepAspectRatio:o,shouldChangeByStepSize:e.shiftKey,property:s,scene:c,originalAppState:h,setInputValue:e=>_(String(e)),app:f,setAppState:p}),v=0))}t={x:e.clientX,y:e.clientY}},x=()=>{window.removeEventListener(F.POINTER_MOVE,y,!1),f.syncActionResult({captureUpdate:V.IMMEDIATELY}),d?.({app:f,setAppState:p,originalElements:a,originalAppState:h}),t=null,g=0,v=0,a=null,r=null,document.body.classList.remove(`excalidraw-cursor-resize`),window.removeEventListener(F.POINTER_UP,x,!1)};b.current.onPointerMove=y,b.current.onPointerUp=x,window.addEventListener(F.POINTER_MOVE,y,!1),window.addEventListener(F.POINTER_UP,x,!1)}},onPointerEnter:()=>{h.current&&(h.current.style.cursor=`ew-resize`)},children:t?(0,W.jsx)(mw,{icon:t}):e}),(0,W.jsx)(`input`,{className:`drag-input`,autoComplete:`off`,spellCheck:`false`,onKeyDown:e=>{if(a){let t=e.target;t instanceof HTMLInputElement&&e.key===N.ENTER&&(y(t.value,i,l),f.focusContainer())}},ref:m,value:g,onChange:e=>{v.current.updatePending=!0,_(e.target.value)},onFocus:e=>{e.target.select(),v.current.originalElements=i,v.current.originalAppState=js(l)},onBlur:e=>{g?a&&y(e.target.value,v.current.originalElements,v.current.originalAppState):_(r.toString())},disabled:!a})]}):null},PI=15,FI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i,app:a})=>{let o=i.getNonDeletedElementsMap(),s=t[0];if(s&&!dr(s)){let t=o.get(s.id);if(!t)return;if(r!==void 0){let e=Pt(r);i.mutateElement(t,{angle:e}),Xn(t,i,a.state);let n=ut(t,o);n&&!jt(t)&&i.mutateElement(n,{angle:e});return}let c=(Math.round(ha(s.angle)*100)/100+Math.round(e))%360;n&&(c=kI(c,PI)),c=c<0?c+360:c;let l=Pt(c);i.mutateElement(t,{angle:l}),Xn(t,i,a.state);let u=ut(t,o);u&&!jt(t)&&i.mutateElement(u,{angle:l})}},II=({element:e,scene:t,appState:n,property:r})=>(0,W.jsx)(NI,{label:`A`,icon:Yx,value:Math.round(ha(e.angle)%360*100)/100,elements:[e],dragInputCallback:FI,editable:OI(e,`angle`),scene:t,appState:n,property:r}),LI=5,RI=({property:e,scene:t,appState:n,setAppState:r})=>(0,W.jsx)(NI,{label:`Grid step`,sensitivity:8,elements:[],dragInputCallback:({nextValue:e,instantChange:t,shouldChangeByStepSize:n,setInputValue:i})=>{r(r=>{let a;return e?a=e:t&&(a=n?kI(r.gridStep+LI*Math.sign(t),LI):r.gridStep+t),a?(a=l(a),i(a),{gridStep:a}):(i(r.gridStep),null)})},scene:t,value:n.gridStep,property:e,appState:n}),zI=10,BI=e=>e.type===`image`,VI=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldKeepAspectRatio:r,shouldChangeByStepSize:i,nextValue:a,property:o,originalAppState:s,instantChange:c,scene:l,app:u,setAppState:d})=>{let f=l.getNonDeletedElementsMap(),p=t[0],m=f.get(p.id);if(p&&m){let t=r||BI(p),h=p.width/p.height;if(s.croppingElementId===p.id){let e=f.get(p.id);if(!e||!io(e)||!e.crop)return;let t=e.crop,n={...t},r=e.scale[0]===-1,i=e.scale[1]===-1,{width:s,height:u}=A(e),d=t.naturalWidth/s,m=t.naturalHeight/u,h=r?t.width+t.x:t.naturalWidth-t.x,g=i?t.height+t.y:t.naturalHeight-t.y,_=10*d,v=10*m;if(a!==void 0){if(o===`width`){let e=Ht(a*d,_,h);n={...n,width:e,x:r?t.x+t.width-e:t.x}}else if(o===`height`){let e=Ht(a*m,v,g);n={...n,height:e,y:i?t.y+t.height-e:t.y}}l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}let y=o===`width`?c:0,b=o===`height`?c:0,x=Ht(t.width+y,_,h),S=Ht(t.height+b,_,g);n={...t,x:r?t.x+t.width-x:t.x,y:i?t.y+t.height-S:t.y,width:x,height:S},l.mutateElement(e,{crop:n,width:n.width/(t.naturalWidth/s),height:n.height/(t.naturalHeight/u)});return}if(a!==void 0){if(nt(Math.max(o===`width`?a:t?a*h:p.width,1),Math.max(o===`height`?a:t?a/h:p.height,1),m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)){let e=kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap()),t=Ai(l.getElementsIncludingDeleted(),e,m,u);l.replaceAllElements(t)}return}{let r=o===`width`?e:0,a=o===`height`?e:0,c=Math.max(0,p.width+r);o===`width`&&(c=i?kI(c,zI):Math.round(c));let u=Math.max(0,p.height+a);o===`height`&&(u=i?kI(u,zI):Math.round(u)),t&&(o===`width`?u=Math.round(c/h*100)/100:c=Math.round(u*h*100)/100),u=Math.max(1,u),c=Math.max(1,c),nt(c,u,m,p,n,l,o===`width`?`e`:`s`,{shouldMaintainAspectRatio:t}),L(m)&&d({elementsToHighlight:kn(l.getElementsIncludingDeleted(),m,s,l.getNonDeletedElementsMap())})}}},HI=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},UI=({property:e,element:t,scene:n,appState:r})=>{let i=on(e===`width`?t.width:t.height,2);if(r.croppingElementId&&r.croppingElementId===t.id&&io(t)&&t.crop){let{width:n,height:r}=A(t);if(e===`width`){let e=n/t.crop.naturalWidth;i=on(t.crop.width*e,2)}if(e===`height`){let e=r/t.crop.naturalHeight;i=on(t.crop.height*e,2)}}return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:[t],dragInputCallback:VI,value:i,editable:OI(t,e),scene:n,appState:r,property:e,dragFinishedCallback:HI})},WI=4,GI=4,KI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t[0];if(o){let t=a.get(o.id);if(!t||!M(t))return;let s;if(r!==void 0)s=Math.max(Math.round(r),WI);else if(o.type===`text`){let t=Math.round(o.fontSize);s=Math.max(t+Math.round(e),WI),n&&(s=kI(s,GI))}s&&(i.mutateElement(t,{fontSize:s}),Zi(t,i.getContainerElement(t),i))}},qI=({element:e,scene:t,appState:n,property:r})=>{let i=M(e)?e:xr(e)?ut(e,t.getNonDeletedElementsMap()):null;return i?(0,W.jsx)(NI,{label:`F`,value:Math.round(i.fontSize*10)/10,elements:[i],dragInputCallback:KI,icon:Rx,appState:n,scene:t,property:r}):null},JI=15,YI=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,property:i,scene:a})=>{let o=a.getNonDeletedElementsMap(),s=t.map(e=>o.get(e.id)).filter(e=>e&&!Nn(e)&&OI(e,i)),c=t.filter(e=>!Nn(e)&&OI(e,i));if(r!==void 0){let e=Pt(r);for(let t of s){if(!t)continue;a.mutateElement(t,{angle:e});let n=ut(t,o);n&&!jt(t)&&a.mutateElement(n,{angle:e})}a.triggerUpdate();return}for(let t=0;t<s.length;t++){let r=s[t];if(!r)continue;let i=c[t],l=(Math.round(ha(i.angle)*100)/100+Math.round(e))%360;n&&(l=kI(l,JI)),l=l<0?l+360:l;let u=Pt(l);a.mutateElement(r,{angle:u});let d=ut(r,o);d&&!jt(r)&&a.mutateElement(d,{angle:u})}a.triggerUpdate()},XI=({elements:e,scene:t,appState:n,property:r})=>{let i=e.filter(e=>!Nn(e)&&OI(e,`angle`)),a=i.map(e=>Math.round(ha(e.angle)%360*100)/100);return(0,W.jsx)(NI,{label:`A`,icon:Yx,value:new Set(a).size===1?a[0]:`Mixed`,elements:e,dragInputCallback:YI,editable:i.some(e=>OI(e,`angle`)),appState:n,scene:t,property:r})},ZI=10,QI=(e,t,n,r)=>{let i=r.x-e,a=r.y-t,o=r.width*n,s=r.height*n;return{width:o,height:s,x:e+i*n,y:t+a*n,...Rr(r,o,s,!1),...M(r)?{fontSize:r.fontSize*n}:{}}},$I=(e,t,n,r,i,a,o,s)=>{let c=s.getNonDeletedElementsMap(),l=QI(e,t,r,a);s.mutateElement(i,l);let u=ut(a,o);if(u){let e=u.fontSize*r;ue(i,s);let t=c.get(u.id);t&&M(t)&&(s.mutateElement(t,{fontSize:e}),ci(i,s,n===`width`?`e`:`s`,!0))}},eL=(e,t,n,r,i,a,o,s,c,l)=>{a===`width`?t=Math.round(e/r*100)/100:e=Math.round(t*r*100)/100;let u=t/n;for(let e=0;e<s.length;e++){let t=s[e],n=o[e];$I(i[0],i[1],a,u,n,t,c,l)}},tL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,originalAppState:r,shouldChangeByStepSize:i,nextValue:a,scene:o,property:s,setAppState:c,app:l})=>{let u=o.getNonDeletedElementsMap(),d=MI(t,r);if(a!==void 0){for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[i,c,l,u]=Ii(r),d=l-i,f=u-c,p=d/f;eL(Math.max(1,s===`width`?Math.max(0,a):d),Math.max(1,s===`height`?Math.max(0,a):f),f,p,O(i,c),s,e,r,n,o)}else{let[e]=t,c=e?.latest,u=e?.original;if(c&&u&&OI(c,s)){let e=s===`width`?Math.max(0,a):c.width;s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=s===`height`?Math.max(0,a):c.height;if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,c,u,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(c)){let e=kn(o.getElementsIncludingDeleted(),c,r,o.getNonDeletedElementsMap()),t=Ai(o.getElementsIncludingDeleted(),e,c,l);o.replaceAllElements(t)}}}}o.triggerUpdate();return}let f=s===`width`?e:0,p=s===`height`?e:0,m=[];for(let e of d){let t=AI(e,u,n);if(t.length>1){let e=t.map(e=>e.latest),r=t.map(e=>e.original),[a,c,l,u]=Ii(r),d=l-a,m=u-c,h=d/m,g=Math.max(0,d+f);s===`width`&&(g=i?kI(g,ZI):Math.round(g));let _=Math.max(0,m+p);s===`height`&&(_=i?kI(_,ZI):Math.round(_)),g=Math.max(1,g),_=Math.max(1,_),eL(g,_,m,h,O(a,c),s,e,r,n,o)}else{let[e]=t,a=e?.latest,c=e?.original;if(a&&c&&OI(a,s)){let e=Math.max(0,c.width+f);s===`width`&&(e=i?kI(e,ZI):Math.round(e));let t=Math.max(0,c.height+p);if(s===`height`&&(t=i?kI(t,ZI):Math.round(t)),e=Math.max(1,e),t=Math.max(1,t),nt(e,t,a,c,n,o,s===`width`?`e`:`s`,{shouldInformMutation:!1}),L(a)){let e=kn(o.getElementsIncludingDeleted(),a,r,o.getNonDeletedElementsMap());m.push(...e)}}}}c({elementsToHighlight:m}),o.triggerUpdate()},nL=({setAppState:e,app:t,originalElements:n,originalAppState:r})=>{let i=t.scene.getNonDeletedElementsMap(),a=n?.[0],o=a&&i.get(a.id);if(o&&L(o)){let n=kn(t.scene.getElementsIncludingDeleted(),o,r,t.scene.getNonDeletedElementsMap()),i=Ai(t.scene.getElementsIncludingDeleted(),n,o,t);t.scene.replaceAllElements(i),e({elementsToHighlight:null})}},rL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=AI(t,n);if(r.length>1){let[t,n,i,a]=Ii(r.map(e=>e.latest));return Math.round((e===`width`?i-t:a-n)*100)/100}let[i]=r;return Math.round((e===`width`?i.latest.width:i.latest.height)*100)/100}),[n,r,e]),s=new Set(o).size===1?Math.round(o[0]*100)/100:`Mixed`,c=o.length>0;return(0,W.jsx)(NI,{label:e===`width`?`W`:`H`,elements:t,dragInputCallback:tL,value:s,editable:c,appState:a,property:e,scene:i,dragFinishedCallback:nL})},iL=4,aL=4,oL=(e,t)=>e.reduce((e,n)=>{if(!n||Nn(n))return e;if(M(n))return e.push(n),e;if(xr(n)){let r=ut(n,t);if(r)return e.push(r),e}return e},[]),sL=({accumulatedChange:e,originalElements:t,shouldChangeByStepSize:n,nextValue:r,scene:i})=>{let a=i.getNonDeletedElementsMap(),o=t.map(e=>a.get(e.id)),s;if(r){s=Math.max(Math.round(r),iL);for(let e of o)i.mutateElement(e,{fontSize:s}),Zi(e,i.getContainerElement(e),i);i.triggerUpdate()}else{let r=t;for(let t=0;t<o.length;t++){let a=o[t],s=r[t],c=Math.round(s.fontSize),l=Math.max(c+Math.round(e),iL);n&&(l=kI(l,aL)),i.mutateElement(a,{fontSize:l}),Zi(a,i.getContainerElement(a),i)}i.triggerUpdate()}},cL=({elements:e,scene:t,appState:n,property:r,elementsMap:i})=>{let a=oL(e,i);if(!a.length)return null;let o=a.map(e=>Math.round(e.fontSize*10)/10);return(0,W.jsx)(NI,{label:`F`,icon:Rx,elements:a,dragInputCallback:sL,value:new Set(o).size===1?o[0]:`Mixed`,editable:o.length>0,scene:t,property:r,appState:n})},lL=(e,t,n,r,i,a,o)=>{for(let s=0;s<r.length;s++){let c=r[s],[l,u]=[c.x+c.width/2,c.y+c.height/2],[d,f]=ke(O(c.x,c.y),O(l,u),c.angle);jI(e===`x`?Math.round(d+t):d,e===`y`?Math.round(f+n):f,c,a,o,i,!1)}},uL=(e,t,n,r,i,a)=>{let o=i.getNonDeletedElementsMap(),[s,c,,]=Ii(n),l=e-s,u=t-c;for(let e=0;e<n.length;e++){let t=n[e],s=o.get(t.id);if(s&&(!M(s)||!s.containerId)){let[e,n]=[s.x+s.width/2,s.y+s.height/2],[o,c]=ke(O(s.x,s.y),O(e,n),s.angle);jI(o+l,c+u,t,i,a,r,!1)}}},dL=({accumulatedChange:e,originalElements:t,originalElementsMap:n,shouldChangeByStepSize:r,nextValue:i,property:a,scene:o,originalAppState:s,app:c})=>{let l=o.getNonDeletedElementsMap();if(i!==void 0){for(let e of MI(t,s)){let t=AI(e,l,n);if(t.length>1){let[e,r,,]=Ii(t.map(e=>e.latest));uL(a===`x`?i:e,a===`y`?i:r,t.map(e=>e.original),n,o,c.state)}else{let e=t[0]?.original,r=t[0]?.latest;if(e&&r&&OI(r,a)){let[t,r]=[e.x+e.width/2,e.y+e.height/2],[s,l]=ke(O(e.x,e.y),O(t,r),e.angle);jI(a===`x`?i:s,a===`y`?i:l,e,o,c.state,n,!1)}}}o.triggerUpdate();return}let u=r?kI(e,DI):e;lL(a,a===`x`?u:0,a===`y`?u:0,t,n,o,c.state),o.triggerUpdate()},fL=({property:e,elements:t,elementsMap:n,atomicUnits:r,scene:i,appState:a})=>{let o=(0,H.useMemo)(()=>r.map(t=>{let r=Object.keys(t).map(e=>n.get(e)).filter(e=>e!==void 0);if(r.length>1){let[t,n]=Ii(r);return Math.round((e===`x`?t:n)*100)/100}let[i]=r,[a,o]=[i.x+i.width/2,i.y+i.height/2],[s,c]=ke(O(i.x,i.y),O(a,o),i.angle);return Math.round((e===`x`?s:c)*100)/100}),[r,n,e]),s=new Set(o).size===1?o[0]:`Mixed`;return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:t,dragInputCallback:dL,value:s,property:e,scene:i,appState:a})},pL=({accumulatedChange:e,instantChange:t,originalElements:n,originalElementsMap:r,shouldChangeByStepSize:i,nextValue:a,property:o,scene:s,originalAppState:c,app:l})=>{let u=s.getNonDeletedElementsMap(),d=n[0],[f,p]=[d.x+d.width/2,d.y+d.height/2],[m,h]=ke(O(d.x,d.y),O(f,p),d.angle);if(c.croppingElementId===d.id){let e=u.get(d.id);if(!e||!io(e)||!e.crop)return;let n=e.crop,r=n,i=e.scale[0]===-1,c=e.scale[1]===-1,{width:l,height:f}=A(e);if(a!==void 0){if(o===`x`){let e=a*(n.naturalWidth/l);r=i?{...n,x:Ht(n.naturalWidth-e-n.width,0,n.naturalWidth-n.width)}:{...n,x:Ht(a*(n.naturalWidth/l),0,n.naturalWidth-n.width)}}o===`y`&&(r={...n,y:Ht(a*(n.naturalHeight/f),0,n.naturalHeight-n.height)}),s.mutateElement(e,{crop:r});return}let p=(o===`x`?t:0)*(i?-1:1),m=(o===`y`?t:0)*(c?-1:1);r={...n,x:Ht(n.x+p,0,n.naturalWidth-n.width),y:Ht(n.y+m,0,n.naturalHeight-n.height)},s.mutateElement(e,{crop:r});return}if(a!==void 0){jI(o===`x`?a:m,o===`y`?a:h,d,s,l.state,r);return}let g=o===`x`?e:0,_=o===`y`?e:0;jI(o===`x`?Math.round(i?kI(d.x+g,DI):m+g):m,o===`y`?Math.round(i?kI(d.y+_,DI):h+_):h,d,s,l.state,r)},mL=({property:e,element:t,elementsMap:n,scene:r,appState:i})=>{let[a,o]=ke(O(t.x,t.y),O(t.x+t.width/2,t.y+t.height/2),t.angle),s=on(e===`x`?a:o,2);if(i.croppingElementId===t.id&&io(t)&&t.crop){let n=hr(t);n&&(s=on(e===`x`?n.x:n.y,2))}return(0,W.jsx)(NI,{label:e===`x`?`X`:`Y`,elements:[t],dragInputCallback:pL,scene:r,value:s,property:e,appState:i})},hL=50,gL=e=>{let t=cz(),n=e.app.scene.getSceneNonce()||1,r=e.app.scene.getSelectedElements({selectedElementIds:t.selectedElementIds,includeBoundTextElement:!1}),i=Sj(e.app);return(0,W.jsx)(yL,{...e,appState:t,sceneNonce:n,selectedElements:r,gridModeEnabled:i})},_L=({children:e,columns:t=1,heading:n,style:r,...i})=>(0,W.jsx)(`div`,{className:U(`exc-stats__row`,{"exc-stats__row--heading":n}),style:{gridTemplateColumns:`repeat(${t}, 1fr)`,...r},...i,children:e});_L.displayName=`StatsRow`;var vL=({children:e,order:t,style:n,...r})=>(0,W.jsx)(`div`,{className:`exc-stats__rows`,style:{order:t,...n},...r,children:e});vL.displayName=`StatsRows`,gL.StatsRow=_L,gL.StatsRows=vL;var yL=(0,H.memo)(({app:e,onClose:t,renderCustomStats:n,selectedElements:r,appState:i,sceneNonce:a,gridModeEnabled:o})=>{let s=e.scene,c=s.getNonDeletedElements(),l=s.getNonDeletedElementsMap(),u=lz(),d=r.length===1?r[0]:null,f=r.length>1?r:null,p=i.croppingElementId&&io(d),m=p?A(d):null,[h,g]=(0,H.useState)({width:0,height:0}),_=(0,H.useMemo)(()=>(0,gc.default)(e=>{let t=Ii(e);g({width:Math.round(t[2])-Math.round(t[0]),height:Math.round(t[3])-Math.round(t[1])})},hL),[]);(0,H.useEffect)(()=>{_(c)},[a,c,_]),(0,H.useEffect)(()=>()=>_.cancel(),[_]);let v=(0,H.useMemo)(()=>MI(r,i),[r,i]),y=(0,H.useMemo)(()=>Dr(r),[r]);return(0,W.jsx)(`div`,{className:`exc-stats`,children:(0,W.jsxs)(SC,{padding:3,children:[(0,W.jsxs)(`div`,{className:`title`,children:[(0,W.jsx)(`h2`,{children:K(`stats.title`)}),(0,W.jsx)(`div`,{className:`close`,onClick:t,children:nx})]}),(0,W.jsxs)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.generalStats`)}),open:!!(i.stats.panels&Fr.generalStats),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.generalStats}})),children:[(0,W.jsxs)(vL,{children:[(0,W.jsx)(_L,{heading:!0,children:K(`stats.scene`)}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:c.length})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:h.width})]}),(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:h.height})]}),o&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(_L,{heading:!0,children:`Canvas`}),(0,W.jsx)(_L,{children:(0,W.jsx)(RI,{property:`gridStep`,scene:s,appState:i,setAppState:u})})]})]}),n?.(c,i)]}),!y&&r.length>0&&(0,W.jsx)(`div`,{id:`elementStats`,style:{marginTop:12},children:(0,W.jsx)(hw,{label:(0,W.jsx)(`h3`,{children:K(`stats.elementProperties`)}),open:!!(i.stats.panels&Fr.elementProperties),openTrigger:()=>u(e=>({stats:{open:!0,panels:e.stats.panels^Fr.elementProperties}})),children:(0,W.jsxs)(vL,{children:[d&&(0,W.jsxs)(W.Fragment,{children:[p&&(0,W.jsx)(_L,{heading:!0,children:K(`labels.unCroppedDimension`)}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.width`)}),(0,W.jsx)(`div`,{children:on(m.width,2)})]}),i.croppingElementId&&io(d)&&m&&(0,W.jsxs)(_L,{columns:2,children:[(0,W.jsx)(`div`,{children:K(`stats.height`)}),(0,W.jsx)(`div`,{children:on(m.height,2)})]}),(0,W.jsx)(_L,{heading:!0,"data-testid":`stats-element-type`,style:{margin:`0.3125rem 0`},children:i.croppingElementId?K(`labels.imageCropping`):K(`element.${d.type}`)}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`x`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(mL,{element:d,property:`y`,elementsMap:l,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`width`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(UI,{property:`height`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(II,{property:`angle`,element:d,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(qI,{property:`fontSize`,element:d,scene:s,appState:i})})]}),f&&(0,W.jsxs)(W.Fragment,{children:[Co(f)&&(0,W.jsx)(_L,{heading:!0,children:K(`element.group`)}),(0,W.jsxs)(_L,{columns:2,style:{margin:`0.3125rem 0`},children:[(0,W.jsx)(`div`,{children:K(`stats.shapes`)}),(0,W.jsx)(`div`,{children:r.length})]}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`x`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(fL,{property:`y`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`width`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(rL,{property:`height`,elements:f,elementsMap:l,atomicUnits:v,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(XI,{property:`angle`,elements:f,scene:s,appState:i})}),(0,W.jsx)(_L,{children:(0,W.jsx)(cL,{property:`fontSize`,elements:f,scene:s,appState:i,elementsMap:l})})]})]})})})]})})},(e,t)=>e.sceneNonce===t.sceneNonce&&e.selectedElements===t.selectedElements&&e.appState.stats.panels===t.appState.stats.panels&&e.gridModeEnabled===t.gridModeEnabled&&e.appState.gridStep===t.appState.gridStep&&e.appState.croppingElementId===t.appState.croppingElementId),bL=({sourceElementId:e,onClose:t,appState:n,scene:r,generateLinkForSelection:i=_a})=>{let a=r.getNonDeletedElementsMap(),o=a.get(e)?.link??null,[s,c]=(0,H.useState)(o),[l,u]=(0,H.useState)(!1);(0,H.useEffect)(()=>{let e=ir(a,n),t=o;if(e.length>0&&i){let r=Fa(e,n);r&&(t=Hs(i(r.id,r.type)))}c(t)},[a,n,n.selectedElementIds,o,i]);let d=(0,H.useCallback)(()=>{if(s&&s!==a.get(e)?.link){let t=a.get(e);t&&r.mutateElement(t,{link:s})}if(!s&&l&&e){let t=a.get(e);t&&r.mutateElement(t,{link:null})}t?.()},[e,s,a,l,r,t]);return(0,H.useEffect)(()=>{let e=e=>{n.openDialog?.name===`elementLinkSelector`&&e.key===N.ENTER&&d(),n.openDialog?.name===`elementLinkSelector`&&e.key===N.ESCAPE&&t?.()};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[n,t,d]),(0,W.jsxs)(`div`,{className:`ElementLinkDialog`,children:[(0,W.jsxs)(`div`,{className:`ElementLinkDialog__header`,children:[(0,W.jsx)(`h2`,{children:K(`elementLink.title`)}),(0,W.jsx)(`p`,{children:K(`elementLink.desc`)})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__input`,children:[(0,W.jsx)($O,{value:s??``,onChange:e=>{l||u(!0),c(e)},onKeyDown:e=>{e.key===N.ENTER&&d()},className:`ElementLinkDialog__input-field`,selectOnRender:!0}),o&&s&&(0,W.jsx)(X,{type:`button`,title:K(`buttons.remove`),"aria-label":K(`buttons.remove`),label:K(`buttons.remove`),onClick:()=>{c(null),u(!0)},className:`ElementLinkDialog__remove`,icon:pb})]}),(0,W.jsxs)(`div`,{className:`ElementLinkDialog__actions`,children:[(0,W.jsx)(aO,{label:K(`buttons.cancel`),onClick:()=>{t?.()},style:{marginRight:10}}),(0,W.jsx)(aO,{label:K(`buttons.confirm`),onClick:d,actionType:`primary`})]})]})},xL=({children:e,onClose:t})=>{let[n,r]=(0,H.useState)(!!e),{container:i}=oz(),a=H.useCallback(()=>{r(!1),t&&t(),i?.focus()},[t,i]);return(0,W.jsx)(W.Fragment,{children:n&&(0,W.jsx)(dk,{size:`small`,onCloseRequest:a,title:K(`errorDialog.title`),children:(0,W.jsx)(`div`,{style:{whiteSpace:`pre-wrap`},children:e})})})},SL=()=>(0,W.jsxs)(`div`,{className:`HelpDialog__header`,children:[(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://docs.excalidraw.com`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.documentation`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://plus.excalidraw.com/blog`,target:`_blank`,rel:`noopener`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Sb}),K(`helpDialog.blog`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://github.com/excalidraw/excalidraw/issues`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:Cb}),K(`helpDialog.github`)]}),(0,W.jsxs)(`a`,{className:`HelpDialog__btn`,href:`https://youtube.com/@excalidraw`,target:`_blank`,rel:`noopener noreferrer`,children:[(0,W.jsx)(`div`,{className:`HelpDialog__link-icon`,children:FS}),`YouTube`]})]}),CL=e=>(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`h3`,{children:e.title}),(0,W.jsx)(`div`,{className:`HelpDialog__islands-container`,children:e.children})]}),wL=e=>(0,W.jsxs)(`div`,{className:`HelpDialog__island ${e.className}`,children:[(0,W.jsx)(`h4`,{className:`HelpDialog__island-title`,children:e.caption}),(0,W.jsx)(`div`,{className:`HelpDialog__island-content`,children:e.children})]});function*TL(e,t){let n=!0;for(let r of e)n||(yield t),n=!1,yield r}var EL=e=>e.replace(/\b[a-z]\b/,e=>e.toUpperCase()),$=({label:e,shortcuts:t,isOr:n=!0})=>{let r=t.map(e=>(e.endsWith(`++`)?[...e.slice(0,-2).split(`+`),`+`]:e.split(`+`)).map(e=>(0,W.jsx)(DL,{children:EL(e)},e)));return(0,W.jsxs)(`div`,{className:`HelpDialog__shortcut`,children:[(0,W.jsx)(`div`,{children:e}),(0,W.jsx)(`div`,{className:`HelpDialog__key-container`,children:[...TL(r,n?K(`helpDialog.or`):null)]})]})},DL=e=>(0,W.jsx)(`kbd`,{className:`HelpDialog__key`,...e}),OL=({onClose:e})=>(0,W.jsx)(W.Fragment,{children:(0,W.jsxs)(dk,{onCloseRequest:H.useCallback(()=>{e&&e()},[e]),title:K(`helpDialog.title`),className:`HelpDialog`,children:[(0,W.jsx)(SL,{}),(0,W.jsxs)(CL,{title:K(`helpDialog.shortcuts`),children:[(0,W.jsxs)(wL,{className:`HelpDialog__island--tools`,caption:K(`helpDialog.tools`),children:[(0,W.jsx)($,{label:K(`toolBar.hand`),shortcuts:[N.H]}),(0,W.jsx)($,{label:K(`toolBar.selection`),shortcuts:[N.V,N[1]]}),(0,W.jsx)($,{label:K(`toolBar.rectangle`),shortcuts:[N.R,N[2]]}),(0,W.jsx)($,{label:K(`toolBar.diamond`),shortcuts:[N.D,N[3]]}),(0,W.jsx)($,{label:K(`toolBar.ellipse`),shortcuts:[N.O,N[4]]}),(0,W.jsx)($,{label:K(`toolBar.arrow`),shortcuts:[N.A,N[5]]}),(0,W.jsx)($,{label:K(`toolBar.line`),shortcuts:[N.L,N[6]]}),(0,W.jsx)($,{label:K(`toolBar.freedraw`),shortcuts:[N.P,N[7]]}),(0,W.jsx)($,{label:K(`toolBar.text`),shortcuts:[N.T,N[8]]}),(0,W.jsx)($,{label:K(`toolBar.image`),shortcuts:[N[9]]}),(0,W.jsx)($,{label:K(`toolBar.eraser`),shortcuts:[N.E,N[0]]}),(0,W.jsx)($,{label:K(`toolBar.frame`),shortcuts:[N.F]}),(0,W.jsx)($,{label:K(`toolBar.laser`),shortcuts:[N.K]}),(0,W.jsx)($,{label:K(`labels.eyeDropper`),shortcuts:[N.I,`Shift+S`,`Shift+G`]}),(0,W.jsx)($,{label:K(`helpDialog.editLineArrowPoints`),shortcuts:[Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.editText`),shortcuts:[Q(`Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textNewLine`),shortcuts:[Q(`Enter`),Q(`Shift+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.textFinish`),shortcuts:[Q(`Esc`),Q(`CtrlOrCmd+Enter`)]}),(0,W.jsx)($,{label:K(`helpDialog.curvedArrow`),shortcuts:[`A`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.curvedLine`),shortcuts:[`L`,K(`helpDialog.click`),K(`helpDialog.click`),K(`helpDialog.click`)],isOr:!1}),(0,W.jsx)($,{label:K(`helpDialog.cropStart`),shortcuts:[K(`helpDialog.doubleClick`),Q(`Enter`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.cropFinish`),shortcuts:[Q(`Enter`),Q(`Escape`)],isOr:!0}),(0,W.jsx)($,{label:K(`toolBar.lock`),shortcuts:[N.Q]}),(0,W.jsx)($,{label:K(`helpDialog.preventBinding`),shortcuts:[Q(`CtrlOrCmd`)]}),(0,W.jsx)($,{label:K(`toolBar.link`),shortcuts:[Q(`CtrlOrCmd+K`)]}),(0,W.jsx)($,{label:K(`toolBar.convertElementType`),shortcuts:[`Tab`,`Shift+Tab`],isOr:!0})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--view`,caption:K(`helpDialog.view`),children:[(0,W.jsx)($,{label:K(`buttons.zoomIn`),shortcuts:[Q(`CtrlOrCmd++`)]}),(0,W.jsx)($,{label:K(`buttons.zoomOut`),shortcuts:[Q(`CtrlOrCmd+-`)]}),(0,W.jsx)($,{label:K(`buttons.resetZoom`),shortcuts:[Q(`CtrlOrCmd+0`)]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToFit`),shortcuts:[`Shift+1`]}),(0,W.jsx)($,{label:K(`helpDialog.zoomToSelection`),shortcuts:[`Shift+2`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageUpDown`),shortcuts:[`PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`helpDialog.movePageLeftRight`),shortcuts:[`Shift+PgUp/PgDn`]}),(0,W.jsx)($,{label:K(`buttons.zenMode`),shortcuts:[Q(`Alt+Z`)]}),(0,W.jsx)($,{label:K(`buttons.objectsSnapMode`),shortcuts:[Q(`Alt+S`)]}),(0,W.jsx)($,{label:K(`labels.toggleGrid`),shortcuts:[Q(`CtrlOrCmd+'`)]}),(0,W.jsx)($,{label:K(`labels.viewMode`),shortcuts:[Q(`Alt+R`)]}),(0,W.jsx)($,{label:K(`labels.toggleTheme`),shortcuts:[Q(`Alt+Shift+D`)]}),(0,W.jsx)($,{label:K(`stats.fullTitle`),shortcuts:[Q(`Alt+/`)]}),(0,W.jsx)($,{label:K(`search.title`),shortcuts:[ND(`searchMenu`)]}),(0,W.jsx)($,{label:K(`commandPalette.title`),shortcuts:xt?[ND(`commandPalette`)]:[ND(`commandPalette`),ND(`commandPalette`,1)]})]}),(0,W.jsxs)(wL,{className:`HelpDialog__island--editor`,caption:K(`helpDialog.editor`),children:[(0,W.jsx)($,{label:K(`helpDialog.createFlowchart`),shortcuts:[Q(`CtrlOrCmd+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`helpDialog.navigateFlowchart`),shortcuts:[Q(`Alt+Arrow Key`)],isOr:!0}),(0,W.jsx)($,{label:K(`labels.moveCanvas`),shortcuts:[Q(`Space+${K(`helpDialog.drag`)}`),Q(`Wheel+${K(`helpDialog.drag`)}`)],isOr:!0}),(0,W.jsx)($,{label:K(`buttons.clearReset`),shortcuts:[Q(`CtrlOrCmd+Delete`)]}),(0,W.jsx)($,{label:K(`labels.delete`),shortcuts:[Q(`Delete`)]}),(0,W.jsx)($,{label:K(`labels.cut`),shortcuts:[Q(`CtrlOrCmd+X`)]}),(0,W.jsx)($,{label:K(`labels.copy`),shortcuts:[Q(`CtrlOrCmd+C`)]}),(0,W.jsx)($,{label:K(`labels.paste`),shortcuts:[Q(`CtrlOrCmd+V`)]}),(0,W.jsx)($,{label:K(`labels.pasteAsPlaintext`),shortcuts:[Q(`CtrlOrCmd+Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.selectAll`),shortcuts:[Q(`CtrlOrCmd+A`)]}),(0,W.jsx)($,{label:K(`labels.multiSelect`),shortcuts:[Q(`Shift+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.click`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.deepBoxSelect`),shortcuts:[Q(`CtrlOrCmd+${K(`helpDialog.drag`)}`)]}),(mT||xt)&&(0,W.jsx)($,{label:K(`labels.copyAsPng`),shortcuts:[Q(`Shift+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.copyStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+C`)]}),(0,W.jsx)($,{label:K(`labels.pasteStyles`),shortcuts:[Q(`CtrlOrCmd+Alt+V`)]}),(0,W.jsx)($,{label:K(`labels.sendToBack`),shortcuts:[Q(di?`CtrlOrCmd+Alt+[`:`CtrlOrCmd+Shift+[`)]}),(0,W.jsx)($,{label:K(`labels.bringToFront`),shortcuts:[Q(di?`CtrlOrCmd+Alt+]`:`CtrlOrCmd+Shift+]`)]}),(0,W.jsx)($,{label:K(`labels.sendBackward`),shortcuts:[Q(`CtrlOrCmd+[`)]}),(0,W.jsx)($,{label:K(`labels.bringForward`),shortcuts:[Q(`CtrlOrCmd+]`)]}),(0,W.jsx)($,{label:K(`labels.alignTop`),shortcuts:[Q(`CtrlOrCmd+Shift+Up`)]}),(0,W.jsx)($,{label:K(`labels.alignBottom`),shortcuts:[Q(`CtrlOrCmd+Shift+Down`)]}),(0,W.jsx)($,{label:K(`labels.alignLeft`),shortcuts:[Q(`CtrlOrCmd+Shift+Left`)]}),(0,W.jsx)($,{label:K(`labels.alignRight`),shortcuts:[Q(`CtrlOrCmd+Shift+Right`)]}),(0,W.jsx)($,{label:K(`labels.duplicateSelection`),shortcuts:[Q(`CtrlOrCmd+D`),Q(`Alt+${K(`helpDialog.drag`)}`)]}),(0,W.jsx)($,{label:K(`helpDialog.toggleElementLock`),shortcuts:[Q(`CtrlOrCmd+Shift+L`)]}),(0,W.jsx)($,{label:K(`buttons.undo`),shortcuts:[Q(`CtrlOrCmd+Z`)]}),(0,W.jsx)($,{label:K(`buttons.redo`),shortcuts:tn?[Q(`CtrlOrCmd+Y`),Q(`CtrlOrCmd+Shift+Z`)]:[Q(`CtrlOrCmd+Shift+Z`)]}),(0,W.jsx)($,{label:K(`labels.group`),shortcuts:[Q(`CtrlOrCmd+G`)]}),(0,W.jsx)($,{label:K(`labels.ungroup`),shortcuts:[Q(`CtrlOrCmd+Shift+G`)]}),(0,W.jsx)($,{label:K(`labels.flipHorizontal`),shortcuts:[Q(`Shift+H`)]}),(0,W.jsx)($,{label:K(`labels.flipVertical`),shortcuts:[Q(`Shift+V`)]}),(0,W.jsx)($,{label:K(`labels.showStroke`),shortcuts:[Q(`S`)]}),(0,W.jsx)($,{label:K(`labels.showBackground`),shortcuts:[Q(`G`)]}),(0,W.jsx)($,{label:K(`labels.showFonts`),shortcuts:[Q(`Shift+F`)]}),(0,W.jsx)($,{label:K(`labels.decreaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+<`)]}),(0,W.jsx)($,{label:K(`labels.increaseFontSize`),shortcuts:[Q(`CtrlOrCmd+Shift+>`)]})]})]})]})}),kL=e=>Array.isArray(e)?`<kbd>${e.map(Q).join(` + `)}</kbd>`:`<kbd>${Q(e)}</kbd>`,AL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let{activeTool:i,isResizing:a,isRotating:o,lastPointerDownWith:s}=e,c=e.multiElement!==null;if(e.openSidebar?.name===At.name&&e.openSidebar.tab===`search`&&e.searchMatches?.matches.length)return K(`hints.dismissSearch`,{shortcut:kL(`Escape`)});if(e.openSidebar&&!n.canFitSidebar)return null;if(zr(e))return K(`hints.eraserRevert`,{shortcut:kL(`Alt`)});let l=r.scene.getSelectedElements(e);if(e.selectedLinearElement?.isDragging&&l[0]?.type===`arrow`)return K(`hints.arrowBindModifiers`,{shortcut_1:kL(`Ctrl`),shortcut_2:kL(`Alt`)});if(i.type===`arrow`||i.type===`line`)return c?K(`hints.linearElementMulti`,{shortcut_1:kL(`Escape`),shortcut_2:kL(`Enter`)}):i.type===`arrow`?K(`hints.arrowTool`,{shortcut:kL(`A`)}):K(`hints.linearElement`);if(i.type===`freedraw`)return K(`hints.freeDraw`);if(i.type===`text`)return K(`hints.text`);if(i.type===`embeddable`)return K(`hints.embeddable`);if(a&&s===`mouse`&&l.length===1){let e=l[0];return b(e)&&e.points.length===2?K(`hints.lockAngle`,{shortcut:kL(`Shift`)}):io(e)?K(`hints.resizeImage`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):K(`hints.resize`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)})}if(o&&s===`mouse`)return K(`hints.rotate`,{shortcut:kL(`Shift`)});if(l.length===1&&M(l[0]))return K(`hints.text_selected`,{shortcut:kL(`Enter`)});if(e.editingTextElement)return K(`hints.text_editing`,{shortcut_1:kL(`Escape`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(e.croppingElementId)return K(`hints.leaveCropEditor`,{shortcut_1:kL(`Enter`),shortcut_2:kL(`Escape`)});if(l.length===1&&io(l[0]))return K(`hints.enterCropEditor`,{shortcut:kL(`Enter`)});if(i.type===`selection`){if(e.selectionElement&&!l.length&&!e.editingTextElement&&!e.selectedLinearElement?.isEditing)return K(`hints.deepBoxSelect`,{shortcut:kL(`CtrlOrCmd`)});if(Sj(r)&&e.selectedElementsAreBeingDragged)return K(`hints.disableSnapping`,{shortcut:kL(`CtrlOrCmd`)});if(!l.length&&!t)return K(`hints.canvasPanning`,{shortcut_1:kL(K(`keys.mmb`)),shortcut_2:kL(`Space`)});if(l.length===1){if(b(l[0]))return e.selectedLinearElement?.isEditing?e.selectedLinearElement.selectedPointsIndices?K(`hints.lineEditor_pointSelected`,{shortcut_1:kL(`Delete`),shortcut_2:kL([`CtrlOrCmd`,`D`])}):K(`hints.lineEditor_nothingSelected`,{shortcut_1:kL(`Shift`),shortcut_2:kL(`Alt`)}):ca(l[0])?K(`hints.lineEditor_line_info`,{shortcut:kL(`Enter`)}):K(`hints.lineEditor_info`,{shortcut_1:kL(`CtrlOrCmd`),shortcut_2:kL([`CtrlOrCmd`,`Enter`])});if(!e.newElement&&!e.selectedElementsAreBeingDragged&&k(l[0])){let e=K(`hints.bindTextToElement`,{shortcut:kL(`Enter`)}),t=K(`hints.createFlowchart`,{shortcut:kL([`CtrlOrCmd`,`↑↓`])});return Vi(l[0])?(Dt(l[0],r.scene.getNonDeletedElementsMap()),[e,t]):e}}}return null},jL=({appState:e,isMobile:t,editorInterface:n,app:r})=>{let i=AL({appState:e,isMobile:t,editorInterface:n,app:r});return i?(0,W.jsx)(`div`,{className:`HintViewer`,children:(0,W.jsx)(`span`,{children:(Array.isArray(i)?i.map(e=>e.replace(/\. ?$/,``)).join(`, `):i).split(/(<kbd>[^<]+<\/kbd>)/g).map((e,t)=>{if(t%2==1){let n=e[0]===`<`&&e.match(/^<kbd>([^<]+)<\/kbd>$/);return(0,W.jsx)(`kbd`,{children:n?n[1]:e},t)}return e})})}):null},ML=2e3,NL=()=>{let[e,t]=(0,H.useState)(null),n=(0,H.useRef)(0);return{copyStatus:e,resetCopyStatus:(0,H.useCallback)(()=>{t(null)},[]),onCopy:()=>{clearTimeout(n.current),t(`success`),n.current=window.setTimeout(()=>{t(null)},ML)}}},PL=({title:e,name:t,checked:n,onChange:r,disabled:i=!1})=>(0,W.jsx)(`div`,{className:U(`Switch`,{toggled:n,disabled:i}),children:(0,W.jsx)(`input`,{name:t,id:t,title:e,type:`checkbox`,checked:n,disabled:i,onChange:()=>r(!n),onKeyDown:e=>{e.key===` `&&r(!n)}})}),FL=()=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h3`,{children:K(`canvasError.cannotShowPreview`)}),(0,W.jsx)(`p`,{children:(0,W.jsx)(`span`,{children:K(`canvasError.canvasTooBig`)})}),(0,W.jsxs)(`em`,{children:[`(`,K(`canvasError.canvasTooBigTip`),`)`]})]}),IL=({appStateSnapshot:e,elementsSnapshot:t,files:n,actionManager:r,onExportImage:i,name:a,exportWithDarkMode:o})=>{let s=Ya(t,e),[c,l]=(0,H.useState)(a),[u,d]=(0,H.useState)(s),[f,p]=(0,H.useState)(e.exportBackground),[m,h]=(0,H.useState)(e.exportEmbedScene),[g,_]=(0,H.useState)(e.exportScale),v=(0,H.useRef)(null),y=(0,H.useRef)(0),[b,x]=(0,H.useState)(null),{onCopy:S,copyStatus:C,resetCopyStatus:w}=NL();(0,H.useEffect)(()=>{w()},[c,f,o,g,m,w]);let{exportedElements:T,exportingFrame:E}=NT(t,e,u);return(0,H.useEffect)(()=>{let t=v.current;if(!t)return;let r=t.offsetWidth,i=t.offsetHeight;if(!r)return;let a=++y.current,s=()=>a!==y.current;return zD({elements:T,appState:{...e,name:c,exportBackground:f,exportWithDarkMode:o,exportScale:g,exportEmbedScene:m},files:n,exportPadding:10,maxWidthOrHeight:Math.max(r,i),exportingFrame:E}).then(async e=>{if(!s()){try{await er(e)}catch(e){throw e.name===`CANVAS_POSSIBLY_TOO_BIG`?Error(K(`canvasError.canvasTooBig`)):e}s()||(x(null),t.replaceChildren(e))}}).catch(e=>{s()||(console.error(e),x(e))}),()=>{y.current+=1}},[e,n,T,E,c,f,o,g,m]),(0,W.jsxs)(`div`,{className:`ImageExportModal`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),(0,W.jsxs)(`div`,{className:`ImageExportModal__preview`,children:[(0,W.jsx)(`div`,{className:`ImageExportModal__preview__canvas`,ref:v,children:b&&(0,W.jsx)(FL,{})}),(0,W.jsx)(`div`,{className:`ImageExportModal__preview__filename`,children:!no&&(0,W.jsx)(`input`,{type:`text`,className:`TextInput`,value:c,style:{width:`30ch`},onChange:e=>{l(e.target.value),r.executeAction(IT,`ui`,e.target.value)}})})]}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings`,children:[(0,W.jsx)(`h3`,{children:K(`imageExportDialog.header`)}),s&&(0,W.jsx)(LL,{label:K(`imageExportDialog.label.onlySelected`),name:`exportOnlySelected`,children:(0,W.jsx)(PL,{name:`exportOnlySelected`,checked:u,onChange:e=>{d(e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.withBackground`),name:`exportBackgroundSwitch`,children:(0,W.jsx)(PL,{name:`exportBackgroundSwitch`,checked:f,onChange:e=>{p(e),r.executeAction(RT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.darkMode`),name:`exportDarkModeSwitch`,children:(0,W.jsx)(PL,{name:`exportDarkModeSwitch`,checked:o,onChange:e=>{r.executeAction(qT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.embedScene`),tooltip:K(`imageExportDialog.tooltip.embedScene`),name:`exportEmbedSwitch`,children:(0,W.jsx)(PL,{name:`exportEmbedSwitch`,checked:m,onChange:e=>{h(e),r.executeAction(zT,`ui`,e)}})}),(0,W.jsx)(LL,{label:K(`imageExportDialog.label.scale`),name:`exportScale`,children:(0,W.jsx)(uP,{name:`exportScale`,value:g,onChange:e=>{_(e),r.executeAction(LT,`ui`,e)},choices:Wi.map(e=>({value:e,label:`${e}\xD7`}))})}),(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__buttons`,children:[(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToPng`),onClick:()=>i(oi.png,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToPng`)}),(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.exportToSvg`),onClick:()=>i(oi.svg,T,{exportingFrame:E}),icon:Qx,children:K(`imageExportDialog.button.exportToSvg`)}),(mT||xt)&&(0,W.jsx)(FP,{className:`ImageExportModal__settings__buttons__button`,label:K(`imageExportDialog.title.copyPngToClipboard`),status:C,onClick:async()=>{await i(oi.clipboard,T,{exportingFrame:E}),S()},icon:$x,children:K(`imageExportDialog.button.copyPngToClipboard`)})]})]})]})},LL=({label:e,children:t,tooltip:n,name:r})=>(0,W.jsxs)(`div`,{className:`ImageExportModal__settings__setting`,title:e,children:[(0,W.jsxs)(`label`,{htmlFor:r,className:`ImageExportModal__settings__setting__label`,children:[e,n&&(0,W.jsx)(Rw,{label:n,long:!0,children:tS})]}),(0,W.jsx)(`div`,{className:`ImageExportModal__settings__setting__content`,children:t})]}),RL=({elements:e,appState:t,files:n,actionManager:r,onExportImage:i,onCloseRequest:a,name:o})=>{let[{appStateSnapshot:s,elementsSnapshot:c}]=(0,H.useState)(()=>({appStateSnapshot:js(t),elementsSnapshot:js(e)}));return(0,W.jsx)(dk,{onCloseRequest:a,size:`wide`,title:!1,children:(0,W.jsx)(IL,{elementsSnapshot:c,appStateSnapshot:s,files:n,actionManager:r,onExportImage:i,name:o,exportWithDarkMode:t.exportWithDarkMode})})},zL={primary:{base:`var(--color-primary)`,darker:`var(--color-primary-darker)`,darkest:`var(--color-primary-darkest)`},lime:{base:`#74b816`,darker:`#66a80f`,darkest:`#5c940d`},pink:{base:`#d6336c`,darker:`#c2255c`,darkest:`#a61e4d`}},BL=({children:e,color:t})=>(0,W.jsx)(`div`,{className:`Card`,style:{"--card-color":zL[t].base,"--card-color-darker":zL[t].darker,"--card-color-darkest":zL[t].darkest},children:e}),VL=({elements:e,appState:t,setAppState:n,files:r,actionManager:i,exportOpts:a,canvas:o,onCloseRequest:s})=>{let{onExportToBackend:c}=a;return(0,W.jsx)(`div`,{className:`ExportDialog ExportDialog--json`,children:(0,W.jsxs)(`div`,{className:`ExportDialog-cards`,children:[a.saveFileToDisk&&(0,W.jsxs)(BL,{color:`lime`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Pb}),(0,W.jsx)(`h2`,{children:K(`exportDialog.disk_title`)}),(0,W.jsxs)(`div`,{className:`Card-details`,children:[K(`exportDialog.disk_details`),!no&&i.renderAction(`changeProjectName`)]}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.disk_button`),"aria-label":K(`exportDialog.disk_button`),showAriaLabel:!0,onClick:()=>{i.executeAction(GT,`ui`)}})]}),c&&(0,W.jsxs)(BL,{color:`pink`,children:[(0,W.jsx)(`div`,{className:`Card-icon`,children:Db}),(0,W.jsx)(`h2`,{children:K(`exportDialog.link_title`)}),(0,W.jsx)(`div`,{className:`Card-details`,children:K(`exportDialog.link_details`)}),(0,W.jsx)(X,{className:`Card-button`,type:`button`,title:K(`exportDialog.link_button`),"aria-label":K(`exportDialog.link_button`),showAriaLabel:!0,onClick:async()=>{try{dC(`export`,`link`,`ui (${Sr()})`),await c(e,t,r),s()}catch(e){n({errorMessage:e.message})}}})]}),a.renderCustomUI&&a.renderCustomUI(e,t,r,o)]})})},HL=({elements:e,appState:t,files:n,actionManager:r,exportOpts:i,canvas:a,setAppState:o})=>{let s=H.useCallback(()=>{o({openDialog:null})},[o]);return(0,W.jsx)(W.Fragment,{children:t.openDialog?.name===`jsonExport`&&(0,W.jsx)(dk,{onCloseRequest:s,title:K(`buttons.export`),children:(0,W.jsx)(VL,{elements:e,appState:t,setAppState:o,files:n,actionManager:r,onCloseRequest:s,exportOpts:i,canvas:a})})})},UL=`small`,WL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__LaserPointer`,`ToolIcon_size_${UL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title,"data-testid":`toolbar-LaserPointer`}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:dS})]}),GL=({UIOptions:e})=>(0,W.jsxs)(PP,{__fallback:!0,children:[(0,W.jsx)(PP.DefaultItems.LoadScene,{}),(0,W.jsx)(PP.DefaultItems.SaveToActiveFile,{}),e.canvasActions.export&&(0,W.jsx)(PP.DefaultItems.Export,{}),e.canvasActions.saveAsImage&&(0,W.jsx)(PP.DefaultItems.SaveAsImage,{}),(0,W.jsx)(PP.DefaultItems.SearchMenu,{}),(0,W.jsx)(PP.DefaultItems.Help,{}),(0,W.jsx)(PP.DefaultItems.ClearCanvas,{}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.Group,{title:`Excalidraw links`,children:(0,W.jsx)(PP.DefaultItems.Socials,{})}),(0,W.jsx)(PP.Separator,{}),(0,W.jsx)(PP.DefaultItems.ToggleTheme,{}),(0,W.jsx)(PP.DefaultItems.ChangeCanvasBackground,{})]}),KL=()=>(0,W.jsxs)(RP,{__fallback:!0,children:[(0,W.jsx)(RP.Actions.SaveToDisk,{}),(0,W.jsx)(RP.Actions.ExportToImage,{})]}),qL=({actionManager:e,appState:t,files:n,setAppState:r,elements:i,canvas:a,onLockToggle:o,onHandToolToggle:s,onPenModeToggle:c,showExitZenModeBtn:l,renderTopLeftUI:u,renderTopRightUI:d,renderCustomStats:f,UIOptions:p,onExportImage:m,renderWelcomeScreen:h,children:g,app:_,isCollaborating:v,generateLinkForSelection:y})=>{let b=iz(),x=az()===`compact`,S=vk(),C=x?{menuTopGap:4,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:.5,islandPadding:1,collabMarginLeft:8}:{menuTopGap:6,toolbarColGap:4,toolbarRowGap:1,toolbarInnerRowGap:1,islandPadding:1,collabMarginLeft:8},w=S.tunnelsJotai.Provider,[T,E]=vy(bC),D=()=>p.canvasActions.export?(0,W.jsx)(HL,{elements:i,appState:t,files:n,actionManager:e,exportOpts:p.canvasActions.export,canvas:a,setAppState:r}):null,O=()=>!p.canvasActions.saveAsImage||t.openDialog?.name!==`imageExport`?null:(0,W.jsx)(RL,{elements:i,appState:t,files:n,actionManager:e,onExportImage:m,onCloseRequest:()=>r({openDialog:null}),name:_.getName()}),k=()=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[(0,W.jsx)(S.MainMenuTunnel.Out,{}),h&&(0,W.jsx)(S.WelcomeScreenMenuHintTunnel.Out,{})]}),A=()=>{let n=x;return(0,W.jsx)(BN,{heading:`selectedShapeActions`,className:U(`selected-shape-actions zen-mode-transition`,{"transition-left":t.zenModeEnabled}),children:n?(0,W.jsx)(SC,{className:U(`compact-shape-actions-island`),padding:0,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(Ak,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_,setAppState:r})}):(0,W.jsx)(SC,{className:Qn.SHAPE_ACTIONS_MENU,padding:2,style:{maxHeight:`${t.height-166}px`},children:(0,W.jsx)(wk,{appState:t,elementsMap:_.scene.getNonDeletedElementsMap(),renderAction:e.renderAction,app:_})})})},ee=()=>{let n=oo(t,i),a=t.stats.open&&!t.zenModeEnabled&&!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`;return(0,W.jsx)(MN,{side:`top`,children:(0,W.jsxs)(`div`,{className:`App-menu App-menu_top`,children:[(0,W.jsxs)(_O.Col,{gap:C.menuTopGap,className:U(`App-menu_top__left`),children:[k(),(0,W.jsx)(`div`,{className:U(`selected-shape-actions-container`,{"selected-shape-actions-container--compact":x}),children:n&&A()})]}),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(0,W.jsx)(BN,{heading:`shapes`,className:`shapes-section`,children:e=>(0,W.jsxs)(`div`,{style:{position:`relative`},children:[h&&(0,W.jsx)(S.WelcomeScreenToolbarHintTunnel.Out,{}),(0,W.jsx)(_O.Col,{gap:C.toolbarColGap,align:`start`,children:(0,W.jsxs)(_O.Row,{gap:C.toolbarRowGap,className:U(`App-toolbar-container`,{"zen-mode":t.zenModeEnabled}),children:[(0,W.jsxs)(SC,{padding:C.islandPadding,className:U(`App-toolbar`,{"zen-mode":t.zenModeEnabled,"App-toolbar--compact":x}),children:[(0,W.jsx)(jL,{appState:t,isMobile:b.formFactor===`phone`,editorInterface:b,app:_}),e,(0,W.jsxs)(_O.Row,{gap:C.toolbarInnerRowGap,children:[(0,W.jsx)(PN,{zenModeEnabled:t.zenModeEnabled,checked:t.penMode,onChange:()=>c(null),title:K(`toolBar.penMode`),penDetected:t.penDetected}),(0,W.jsx)(EN,{checked:t.activeTool.locked,onChange:o,title:K(`toolBar.lock`)}),(0,W.jsx)(`div`,{className:`App-toolbar__divider`}),(0,W.jsx)(Mk,{setAppState:r,activeTool:t.activeTool,UIOptions:p,app:_})]})]}),v&&(0,W.jsx)(SC,{style:{marginLeft:C.collabMarginLeft,alignSelf:`center`,height:`fit-content`},children:(0,W.jsx)(WL,{title:K(`toolBar.laser`),checked:t.activeTool.type===va.laser,onChange:()=>_.setActiveTool({type:va.laser}),isMobile:!0})})]})})]})}),(0,W.jsxs)(`div`,{className:U(`layer-ui__wrapper__top-right zen-mode-transition`,{"transition-right":t.zenModeEnabled,"layer-ui__wrapper__top-right--compact":x}),children:[t.collaborators.size>0&&(0,W.jsx)(KN,{collaborators:t.collaborators,userToFollow:t.userToFollow?.socketId||null}),d?.(b.formFactor===`phone`,t),!t.viewModeEnabled&&t.openDialog?.name!==`elementLinkSelector`&&(!ne||t.openSidebar?.name!==At.name)&&(0,W.jsx)(S.DefaultSidebarTriggerTunnel.Out,{}),a&&(0,W.jsx)(gL,{app:_,onClose:()=>{e.executeAction(OE)},renderCustomStats:f})]})]})})},te=()=>(0,W.jsx)($P,{__fallback:!0,onDock:e=>{dC(`sidebar`,`toggleDock (${e?`dock`:`undock`})`,`(${b.formFactor===`phone`?`mobile`:`desktop`})`)}}),ne=by(rP),j=(0,W.jsxs)(W.Fragment,{children:[g,(0,W.jsx)(GL,{UIOptions:p}),(0,W.jsx)($P.Trigger,{__fallback:!0,icon:YS,title:Ge(K(`toolBar.library`)),onToggle:e=>{e&&dC(`sidebar`,`${At.name} (open)`,`button (${b.formFactor===`phone`?`mobile`:`desktop`})`)},tab:At.defaultTab}),(0,W.jsx)(KL,{}),t.openDialog?.name===`ttd`&&(0,W.jsx)(wI,{__fallback:!0}),t.isLoading&&(0,W.jsx)(CN,{delay:250}),t.errorMessage&&(0,W.jsx)(xL,{onClose:()=>r({errorMessage:null}),children:t.errorMessage}),T&&b.formFactor!==`phone`&&(0,W.jsx)(xC,{colorPickerType:T.colorPickerType,onCancel:()=>{E(null)},onChange:(e,t,n,{altKey:a})=>{if(!(e!==`elementBackground`&&e!==`elementStroke`))if(n.length){for(let r of n)jn(r,lr(i),{[a&&T.swapPreviewOnAlt?e===`elementBackground`?`strokeColor`:`backgroundColor`:e===`elementBackground`?`backgroundColor`:`strokeColor`]:t}),bn.delete(r);_.scene.triggerUpdate()}else r(e===`elementBackground`?{currentItemBackgroundColor:t}:{currentItemStrokeColor:t})},onSelect:(e,t)=>{E(e=>e?.keepOpenOnAlt&&t.altKey?e:null),T?.onSelect?.(e,t)}}),t.openDialog?.name===`help`&&(0,W.jsx)(OL,{onClose:()=>{r({openDialog:null})}}),(0,W.jsx)(zk,{}),t.openDialog?.name===`elementLinkSelector`&&(0,W.jsx)(bL,{sourceElementId:t.openDialog.sourceElementId,onClose:()=>{r({openDialog:null})},scene:_.scene,appState:t,generateLinkForSelection:y}),(0,W.jsx)(S.OverwriteConfirmDialogTunnel.Out,{}),O(),D(),t.openDialog?.name===`charts`&&(0,W.jsx)(zN,{data:t.openDialog.data,rawText:t.openDialog.rawText,onClose:()=>r({openDialog:null})}),b.formFactor===`phone`&&(0,W.jsx)(FN,{app:_,appState:t,elements:i,actionManager:e,renderJSONExportDialog:D,renderImageExportDialog:O,setAppState:r,onHandToolToggle:s,onPenModeToggle:c,renderTopLeftUI:u,renderTopRightUI:d,renderSidebars:te,renderWelcomeScreen:h,UIOptions:p}),b.formFactor!==`phone`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`layer-ui__wrapper`,style:t.openSidebar&&ne&&b.canFitSidebar?{width:`calc(100% - var(--right-sidebar-width))`}:{},children:[h&&(0,W.jsx)(S.WelcomeScreenCenterTunnel.Out,{}),ee(),(0,W.jsx)(YN,{appState:t,actionManager:e,showExitZenModeBtn:l,renderWelcomeScreen:h}),(t.toast||t.scrolledOutside)&&(0,W.jsxs)(`div`,{className:`floating-status-stack`,children:[t.toast&&(0,W.jsx)(fT,{message:t.toast.message,onClose:()=>r({toast:null}),duration:t.toast.duration,closable:t.toast.closable}),!t.toast&&t.scrolledOutside&&(0,W.jsx)(`button`,{type:`button`,className:`scroll-back-to-content`,onClick:()=>{r(e=>({...An(i,e)}))},children:K(`buttons.scrollBackToContent`)})]})]}),te()]})]});return(0,W.jsx)(hC.Provider,{value:t,children:(0,W.jsx)(w,{children:(0,W.jsx)(hk.Provider,{value:S,children:j})})})},JL=e=>{let{startBoundElement:t,cursorButton:n,scrollX:r,scrollY:i,...a}=e;return a},YL=H.memo(qL,(e,t)=>{if(e.children!==t.children)return!1;let{canvas:n,appState:r,...i}=e,{canvas:a,appState:o,...s}=t;return ji(JL(r),JL(o),{selectedElementIds:ji,selectedGroupIds:ji})&&ji(i,s)}),XL=`small`,ZL=e=>(0,W.jsxs)(`label`,{className:U(`ToolIcon ToolIcon__MagicButton`,`ToolIcon_size_${XL}`,{"is-mobile":e.isMobile}),title:`${e.title}`,children:[(0,W.jsx)(`input`,{className:`ToolIcon_type_checkbox`,type:`checkbox`,name:e.name,onChange:e.onChange,checked:e.checked,"aria-label":e.title}),(0,W.jsx)(`div`,{className:`ToolIcon__icon`,children:e.icon})]}),QL=({trails:e})=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(t.current)for(let n of e)n.start(t.current);return()=>{for(let t of e)t.stop()}},e),(0,W.jsx)(`div`,{className:`SVGLayer`,children:(0,W.jsx)(`svg`,{ref:t})})},$L=`#ff6b6b`,eR=`#ff0000`,tR=1,nR=2,rR=(e,t)=>{if(!t.snapLines.length)return;let n=t.theme===R.LIGHT||t.zenModeEnabled?$L:eR,r=(t.zenModeEnabled?tR*1.5:tR)/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY);for(let i of t.snapLines)i.type===`pointer`?(e.lineWidth=r,e.strokeStyle=n,aR(i,e,t)):i.type===`gap`?(e.lineWidth=r,e.strokeStyle=n,cR(i.points[0],i.points[1],i.direction,t,e)):i.type===`points`&&(e.lineWidth=r,e.strokeStyle=n,iR(i,e,t));e.restore()},iR=(e,t,n)=>{if(!n.zenModeEnabled){let n=e.points[0],r=e.points[e.points.length-1];sR(n,r,t)}for(let r of e.points)oR(r,n,t)},aR=(e,t,n)=>{oR(e.points[0],n,t),n.zenModeEnabled||sR(e.points[0],e.points[1],t)},oR=([e,t],n,r)=>{r.save();let i=(n.zenModeEnabled?nR*1.5:nR)/n.zoom.value;r.beginPath(),r.moveTo(e-i,t-i),r.lineTo(e+i,t+i),r.moveTo(e+i,t-i),r.lineTo(e-i,t+i),r.stroke(),r.restore()},sR=(e,t,n)=>{n.beginPath(),n.lineTo(e[0],e[1]),n.lineTo(t[0],t[1]),n.stroke()},cR=(e,t,n,r,i)=>{let a=8/r.zoom.value,o=a/2,s=a/4;if(n===`horizontal`){let n=[(e[0]+t[0])/2,e[1]];r.zenModeEnabled||sR(O(e[0],e[1]-a),O(e[0],e[1]+a),i),sR(O(n[0]-s,n[1]-o),O(n[0]-s,n[1]+o),i),sR(O(n[0]+s,n[1]-o),O(n[0]+s,n[1]+o),i),r.zenModeEnabled||(sR(O(t[0],t[1]-a),O(t[0],t[1]+a),i),sR(e,t,i))}else{let n=[e[0],(e[1]+t[1])/2];r.zenModeEnabled||sR(O(e[0]-a,e[1]),O(e[0]+a,e[1]),i),sR(O(n[0]-o,n[1]-s),O(n[0]+o,n[1]-s),i),sR(O(n[0]-o,n[1]+s),O(n[0]+o,n[1]+s),i),r.zenModeEnabled||(sR(O(t[0]-a,t[1]),O(t[0]+a,t[1]),i),sR(e,t,i))}},lR=(e,t)=>{gt(t.selectedLinearElement,`selectedLinearElement is null`);let{segmentMidPointHoveredCoords:n}=t.selectedLinearElement;gt(n,`midPointCoords is null`),e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},uR=(e,t,n)=>{let{elementId:r,hoverPointIndex:i}=t.selectedLinearElement;if(t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(i)||t.selectedLinearElement?.isDragging)return;let a=I.getElement(r,n);if(!a)return;let o=I.getPointAtIndexGlobalCoordinates(a,i,n);e.save(),e.translate(t.scrollX,t.scrollY),dR(o,e,t),e.restore()},dR=(e,t,n)=>{t.fillStyle=`rgba(105, 101, 219, 0.4)`,De(t,e[0],e[1],I.POINT_HANDLE_SIZE/n.zoom.value,!1)},fR=(e,t,n)=>{e.save(),e.translate(t.scrollX,t.scrollY),dR(n,e,t),e.restore()},pR=(e,t,n,r,i,a,o)=>{e.strokeStyle=`#5e5ad8`,e.setLineDash([]),e.fillStyle=`rgba(255, 255, 255, 0.9)`,i?e.fillStyle=`rgba(134, 131, 226, 0.9)`:a&&(e.fillStyle=`rgba(177, 151, 252, 0.7)`),De(e,n[0],n[1],(o?r*(t.selectedLinearElement?.isEditing?1.5:2):r)/t.zoom.value,!a,!o||i)},mR=(e,t,n,r,i)=>{let a=t.element.frameId&&n.get(t.element.frameId);switch(a&&L(a)&&(e.translate(a.x,a.y),e.beginPath(),On.radius&&e.roundRect?e.roundRect(-1,-1,a.width+1,a.height+1,On.radius/r.zoom.value):e.rect(-1,-1,a.width+1,a.height+1),e.clip(),e.translate(-a.x,-a.y)),t.element.type){case`magicframe`:case`frame`:e.save(),e.translate(t.element.x,t.element.y),e.lineWidth=On.strokeWidth/r.zoom.value,e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,On.radius&&e.roundRect?(e.beginPath(),e.roundRect(0,0,t.element.width,t.element.height,On.radius/r.zoom.value),e.stroke(),e.closePath()):e.strokeRect(0,0,t.element.width,t.element.height),e.restore();break;default:e.save();let i=Ae(t.element,n);switch(e.translate(i[0],i[1]),e.rotate(t.element.angle),e.translate(-i[0],-i[1]),e.translate(t.element.x,t.element.y),e.lineWidth=Ht(1.75,t.element.strokeWidth,4)/Math.max(.25,r.zoom.value),e.strokeStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,t.element.type){case`ellipse`:e.beginPath(),e.ellipse(t.element.width/2,t.element.height/2,t.element.width/2,t.element.height/2,0,0,2*Math.PI),e.closePath(),e.stroke();break;case`diamond`:{let[n,r]=ur(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break;default:{let[n,r]=ee(t.element);n.forEach(n=>{e.beginPath(),e.moveTo(n[0][0]-t.element.x,n[0][1]-t.element.y),e.lineTo(n[1][0]-t.element.x,n[1][1]-t.element.y),e.stroke()}),r.forEach(n=>{let[r,i,a,o]=n;e.beginPath(),e.moveTo(r[0]-t.element.x,r[1]-t.element.y),e.bezierCurveTo(i[0]-t.element.x,i[1]-t.element.y,a[0]-t.element.x,a[1]-t.element.y,o[0]-t.element.x,o[1]-t.element.y),e.stroke()})}break}e.restore();break}if(r.isMidpointSnappingEnabled&&(L(t.element)||un(t.element))){let a=r.selectedLinearElement,o=a?.elementId&&I.getElement(a?.elementId,n),s=i&&Ui({point:i,element:t.element,elementsMap:n,threshold:0,overrideShouldTestInside:!0}),c=o&&dr(o)||r.activeTool.type===`arrow`&&r.currentItemArrowType===`elbow`;if(!s||c){e.save();let a=Ae(t.element,n),o;if(t.element.type===`diamond`){let e=Ae(t.element,n);o=as(t.element).map(n=>{let r=ke(Os(n,.5),e,t.element.angle);return O(r[0],r[1])})}else o=[{x:t.element.width,y:t.element.height/2},{x:t.element.width/2,y:t.element.height},{x:0,y:t.element.height/2},{x:t.element.width/2,y:0}].map(e=>{let n=ke(O(e.x+t.element.x,e.y+t.element.y),a,t.element.angle);return O(n[0],n[1])});let l=i&&o.reduce((e,t,n)=>{let r=Se(t,i);return n===-1||r<e.distance?{idx:n,distance:r}:e},{idx:-1,distance:1/0}),u=4/r.zoom.value,d=ii(r.zoom)+t.element.strokeWidth/2;o.forEach((t,n)=>{let i=(!s||c)&&l?.idx===n&&l.distance<=d,a=!i&&(c||n===l?.idx&&l.distance<=d*2);i?(e.fillStyle=r.theme===R.DARK?`rgba(3, 93, 161, 1)`:`rgba(106, 189, 252, 1)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill()):a&&(e.fillStyle=r.theme===R.DARK?`rgba(0, 0, 0, 0.8)`:`rgba(65, 65, 65, 0.5)`,e.beginPath(),e.arc(t[0],t[1],u,0,2*Math.PI),e.fill())}),e.restore()}}},hR=(e,t,n,r,i,a,o)=>{let s=e.state.bindMode===`orbit`&&e.bindModeHandler!==null,c=700-(o?.runtime??(s?0:700)),l=Ht(1/700*c,1e-4,1),u=n.strokeWidth/2,d=n.frameId&&r.get(n.frameId);switch(d&&L(d)&&(t.translate(d.x,d.y),t.beginPath(),On.radius&&t.roundRect?t.roundRect(-1,-1,d.width+1,d.height+1,On.radius/i.zoom.value):t.rect(-1,-1,d.width+1,d.height+1),t.clip(),t.translate(-d.x,-d.y)),n.type){case`magicframe`:case`frame`:t.save(),t.translate(n.x,n.y),t.lineWidth=On.strokeWidth/i.zoom.value,t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,On.radius&&t.roundRect?(t.beginPath(),t.roundRect(0,0,n.width,n.height,On.radius/i.zoom.value),t.stroke(),t.closePath()):t.strokeRect(0,0,n.width,n.height),t.restore();break;default:t.save();let e=Ae(n,r),a=e[0]+i.scrollX,o=e[1]+i.scrollY;switch(t.translate(a,o),t.rotate(n.angle),t.translate(-a,-o),t.translate(n.x+i.scrollX-u,n.y+i.scrollY-u),t.lineWidth=Ht(2.5,n.strokeWidth*1.75,4)/Math.max(.25,i.zoom.value),t.strokeStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l/2})`:`rgba(106, 189, 252, ${l/2})`,n.type){case`ellipse`:t.beginPath(),t.ellipse((n.width+u*2)/2,(n.height+u*2)/2,(n.width+u*2)/2,(n.height+u*2)/2,0,0,2*Math.PI),t.closePath(),t.stroke();break;case`diamond`:{let[e,r]=ur(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break;default:{let[e,r]=ee(n,u);e.forEach(e=>{t.beginPath(),t.moveTo(e[0][0]-n.x+u,e[0][1]-n.y+u),t.lineTo(e[1][0]-n.x+u,e[1][1]-n.y+u),t.stroke()}),r.forEach(e=>{let[r,i,a,o]=e;t.beginPath(),t.moveTo(r[0]-n.x+u,r[1]-n.y+u),t.bezierCurveTo(i[0]-n.x+u,i[1]-n.y+u,a[0]-n.x+u,a[1]-n.y+u,o[0]-n.x+u,o[1]-n.y+u),t.stroke()})}break}t.restore();break}if(!s||(o?.runtime??0)>700)return;let f=.5*(Math.min(n.width,n.height)/2);if(!L(n)){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=1/700*c;if(t.strokeStyle=`rgba(0, 0, 0, 0.2)`,t.lineWidth=1/i.zoom.value,t.setLineDash([4/i.zoom.value,4/i.zoom.value]),t.lineDashOffset=-e*10/i.zoom.value,t.beginPath(),t.ellipse(n.width/2,n.height/2,f,f,0,0,2*Math.PI),t.stroke(),t.fillStyle=`rgba(0, 0, 0, 0.04)`,t.beginPath(),t.ellipse(n.width/2,n.height/2,f*(1-l),f*(1-l),0,0,2*Math.PI),t.fill(),t.restore(),i.isMidpointSnappingEnabled){t.save(),t.translate(n.x+i.scrollX,n.y+i.scrollY);let e=5/i.zoom.value,a=e+5/i.zoom.value,o;if(n.type===`diamond`){let[,e]=ur(n),t=Ae(n,r);o=e.map(e=>{let r=ke(Os(e,.5),t,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}else{let e=Ae(n,r);o=[{x:n.width/2,y:0},{x:n.width,y:n.height/2},{x:n.width/2,y:n.height},{x:0,y:n.height/2}].map(t=>{let r=ke(O(t.x+n.x,t.y+n.y),e,n.angle);return{x:r[0]-n.x,y:r[1]-n.y}})}o.forEach(e=>{t.clearRect(e.x-a,e.y-a,a*2,a*2)}),t.fillStyle=i.theme===R.DARK?`rgba(3, 93, 161, ${l})`:`rgba(106, 189, 252, ${l})`,o.forEach(n=>{t.beginPath(),t.arc(n.x,n.y,e,0,2*Math.PI),t.fill()}),t.restore()}}return{runtime:(o?.runtime??0)+a}},gR=(e,t,n,r,i,a,o)=>{if(n!==null){if(Ys(`COMPLEX_BINDINGS`))return hR(e,t,n.element,r,i,a,o);t.save(),t.translate(i.scrollX,i.scrollY),mR(t,n,r,i,e.lastPointerMoveCoords?O(e.lastPointerMoveCoords.x,e.lastPointerMoveCoords.y):null),t.restore()}},_R=(e,t,n)=>{let{angle:r,x1:i,y1:a,x2:o,y2:s,selectionColors:c,cx:l,cy:u,dashed:d,activeEmbeddable:f}=n,p=o-i,m=s-a,h=(n.padding??4)/t.zoom.value,g=8/t.zoom.value,_=4/t.zoom.value;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=(f?4:1)/t.zoom.value;let v=c.length;for(let t=0;t<v;++t)e.strokeStyle=c[t],d&&e.setLineDash([g,_+(g+_)*(v-1)]),e.lineDashOffset=(g+_)*t,Oo(e,i-h,a-h,p+h*2,m+h*2,l,u,r);e.restore()},vR=(e,t,n,r)=>{let[i,a,o,s]=ei(n,r),c=o-i,l=s-a;e.strokeStyle=`rgb(0,118,255)`,e.lineWidth=On.strokeWidth/t.zoom.value,e.save(),e.translate(t.scrollX,t.scrollY),Oo(e,i,a,c,l,i+c/2,a+l/2,n.angle,!1,On.radius/t.zoom.value),e.restore()},yR=(e,t,n,r)=>{let{colors:i=[`rgb(0,118,255)`],dashed:a=!1}=r||{},o=n.filter(e=>e.groupIds.length===0),s=n.filter(e=>e.groupIds.length>0),c=e=>{let[t,n,r,o]=Ii(e);return{angle:0,x1:t,x2:r,y1:n,y2:o,selectionColors:i,dashed:a,cx:t+(r-t)/2,cy:n+(o-n)/2,activeEmbeddable:!1}},l=e=>c(Ki(n,e));Object.entries(Kt(s,t)).filter(([e,t])=>t).map(([e,t])=>e).map(e=>l(e)).concat(o.map(e=>c([e]))).forEach(n=>_R(e,t,n))},bR=(e,t,n,r)=>{if(!t.selectedLinearElement)return;e.save(),e.translate(t.scrollX,t.scrollY),e.lineWidth=1/t.zoom.value;let i=I.getPointsGlobalCoordinates(n,r),{POINT_HANDLE_SIZE:a}=I,o=t.selectedLinearElement?.isEditing?a:a/2,s=dr(n),c=ca(n);if(i.forEach((r,a)=>{if(s&&a!==0&&a!==i.length-1)return;let l=a>0&&(a!==i.length-1||!c||!n.polygon)&&Tt(r,a===i.length-1?i[0]:i[a-1],2/t.zoom.value),u=!!t.selectedLinearElement?.isEditing&&!!t.selectedLinearElement?.selectedPointsIndices?.includes(a);c&&n.polygon&&!u&&a===n.points.length-1&&t.selectedLinearElement?.isEditing&&t.selectedLinearElement?.selectedPointsIndices?.includes(0)&&(u=!0),pR(e,t,r,o,u,!1,l)}),dr(n)){let r=n.fixedSegments?.map(e=>e.index)||[];i.slice(0,-1).forEach((o,s)=>{I.isSegmentTooShort(n,i[s+1],i[s],s,t.zoom)||pR(e,t,O((o[0]+i[s+1][0])/2,(o[1]+i[s+1][1])/2),a/2,!1,!r.includes(s+1),!1)})}else I.getEditorMidPoints(n,r,t).filter((e,t,r)=>e!==null&&!(dr(n)&&(t===0||t===r.length-1))).forEach(n=>{(t.selectedLinearElement?.isEditing||i.length===2)&&pR(e,t,n,a/2,!1,!0,!1)});e.restore()},xR=(e,t,n,r)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([4/t.zoom.value,4/t.zoom.value]),e.beginPath(),e.moveTo(n[0],n[1]),e.lineTo(r[0],r[1]),e.stroke(),e.restore()},SR=(e,t,n,r,i)=>{e.save(),e.translate(t.scrollX,t.scrollY),e.strokeStyle=`rgba(134, 131, 226, 0.6)`,e.lineWidth=1/t.zoom.value,e.setLineDash([]),e.fillStyle=i?`rgba(134, 131, 226, 0.9)`:`rgba(255, 255, 255, 0.9)`,De(e,n[0],n[1],r/t.zoom.value,!0,!0),e.restore()},CR=({arrow:e,appState:t,type:n,context:r,elementsMap:i})=>{let a=n===`start`?e.startBinding:e.endBinding,o=a?.elementId&&i.get(a.elementId);if(!o||!un(o)||o.isDeleted)return;let s=xi(a.fixedPoint,o,i);if(!sa(s,e,o,i,t,n))return;let c=t.selectedLinearElement,l=!!c?.isDragging,u=n===`start`?0:e.points.length-1,d=!!c?.selectedPointsIndices?.includes(u);if(c?.hoveredFocusPointBinding===n&&!c.draggedFocusPointBinding&&fR(r,t,s),!(d&&l)){let s=xi(a.fixedPoint,o,i),l=c?.hoveredFocusPointBinding===n;xR(r,t,I.getPointAtIndexGlobalCoordinates(e,u,i),s),SR(r,t,s,hn/1.5,l)}},wR=(e,t,n,r,i)=>{Object.keys(r).forEach(a=>{let o=r[a];if(o!==void 0){let[r,s,c,l]=o;e.save(),e.lineWidth=1/n.zoom.value,t.selectionColor&&(e.strokeStyle=t.selectionColor),a===`rotation`?De(e,r+c/2,s+l/2,c/2,!0):e.roundRect?(e.beginPath(),e.roundRect(r,s,c,l,2/n.zoom.value),e.fill(),e.stroke()):Oo(e,r,s,c,l,r+c/2,s+l/2,i,!0),e.restore()}})},TR=(e,t,n,r,i)=>{let[a,o,,,s,c]=ei(r,i),l=3/n.zoom.value,u=l/2,d=s-a+l,f=c-o+l,p=Math.min(20/n.zoom.value,d),m=Math.min(20/n.zoom.value,f);e.save(),e.fillStyle=t.selectionColor,e.strokeStyle=t.selectionColor,e.lineWidth=l,[[[-d,-f],[0,u],[p,u],[u,0],[u,m]],[[d-u,-f],[u,u],[-p+u,u],[0,0],[0,m]],[[-d,f],[0,-u],[p,-u],[u,0],[u,-m]],[[d-u,f],[u,-u],[-p+u,-u],[0,0],[0,-m]]].forEach(t=>{let[[n,i],[a,o],[l,u],[d,f],[p,m]]=t;e.save(),e.translate(s,c),e.rotate(r.angle),e.beginPath(),e.moveTo(n+a,i+o),e.lineTo(n+l,i+u),e.stroke(),e.beginPath(),e.moveTo(n+d,i+f),e.lineTo(n+p,i+m),e.stroke(),e.restore()}),e.restore()},ER=(e,t,n,r)=>{t.save();let i=4/n.zoom.value,a=e.width+i*2,o=e.height+i*2,s=e.x+a/2,c=e.y+o/2,l=-(a/2+i),u=-(o/2+i);t.translate(s+n.scrollX,c+n.scrollY),t.rotate(e.angle),t.lineWidth=1/n.zoom.value,t.strokeStyle=r,t.strokeRect(l,u,a,o),t.restore()},DR=({app:e,canvas:t,elementsMap:n,visibleElements:r,selectedElements:i,allElementsMap:a,scale:o,appState:s,renderConfig:c,editorInterface:l,animationState:u,deltaTime:d})=>{if(t===null)return{atLeastOneVisibleElement:!1,elementsMap:n};let[f,p]=_(t,o),m=u,h=ht({canvas:t,scale:o,normalizedWidth:f,normalizedHeight:p});h.save(),h.scale(s.zoom.value,s.zoom.value);let g;if(r.forEach(e=>{s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===e.id&&e&&(g=e)}),g&&bR(h,s,g,n),s.selectionElement&&!s.isCropping)try{Oa(s.selectionElement,h,s,c.selectionColor)}catch(e){console.error(e)}if(s.editingTextElement&&M(s.editingTextElement)){let e=a.get(s.editingTextElement.id);e&&!e.autoResize&&ER(e,h,s,c.selectionColor)}if(m=s.isBindingEnabled&&s.suggestedBinding?{...u,bindingHighlight:gR(e,h,s.suggestedBinding,a,s,d,u?.bindingHighlight)}:{...u,bindingHighlight:void 0},s.frameToHighlight&&vR(h,s,s.frameToHighlight,n),s.elementsToHighlight&&yR(h,s,s.elementsToHighlight),s.activeLockedId){let e=a.get(s.activeLockedId);yR(h,s,e?[e]:Ki(a,s.activeLockedId),{colors:[`#ced4da`],dashed:!0})}let v=i.some(e=>L(e));i.length===1&&s.selectedLinearElement?.isEditing&&s.selectedLinearElement.elementId===i[0].id&&bR(h,s,i[0],n);let y=s.selectedLinearElement,x=y&&I.getElement(y.elementId,a);if(x&&(s.selectedLinearElement.isDragging||(y.segmentMidPointHoveredCoords?lR(h,s):(dr(x)?y.hoverPointIndex===0||y.hoverPointIndex===x.points.length-1:y.hoverPointIndex>=0)&&uR(h,s,n)),jt(x)&&(CR({arrow:x,elementsMap:a,appState:s,context:h,type:`start`}),CR({arrow:x,elementsMap:a,appState:s,context:h,type:`end`}))),!s.multiElement&&!s.newElement&&!s.selectedLinearElement?.isEditing){let e=Jo(i,s,l),t=i.length===1&&b(i[0]);t&&s.selectedLinearElement?.elementId===i[0].id&&!i[0].locked&&bR(h,s,i[0],n);let r=c.selectionColor||`#000`;if(e){let e=lr(i),a=[];for(let i of n.values()){let o=[],l=c.remoteSelectedElementIds.get(i.id);if(t&&dr(i)&&(i.startBinding||i.endBinding)||(e.has(i.id)&&!ft(s,i)&&o.push(r),l&&o.push(...l.map(e=>iE(e,s.collaborators.get(e))))),o.length){let[e,t,r,c,u,d]=ei(i,n,!0);a.push({angle:i.angle,x1:e,y1:t,x2:r,y2:c,selectionColors:i.locked?[`#ced4da`]:o,dashed:!!l||i.locked,cx:u,cy:d,activeEmbeddable:s.activeEmbeddable?.element===i&&s.activeEmbeddable.state===`active`,padding:i.id===s.croppingElementId||io(i)?0:void 0})}}let o=e=>{let t=Ki(n,e),[r,i,o,s]=Ii(t);a.push({angle:0,x1:r,x2:o,y1:i,y2:s,selectionColors:t.some(e=>e.locked)?[`#ced4da`]:[`#000`],dashed:!0,cx:r+(o-r)/2,cy:i+(s-i)/2,activeEmbeddable:!1})};for(let e of po(s))o(e);s.editingGroupId&&o(s.editingGroupId),a.forEach(e=>_R(h,s,e))}if(h.save(),h.translate(s.scrollX,s.scrollY),i.length===1){h.fillStyle=`#fff`;let t=Ce(i[0],s.zoom,n,`mouse`,Ea(l));if(!s.viewModeEnabled&&e&&!M(s.editingTextElement)&&!s.croppingElementId&&wR(h,c,s,t,i[0].angle),s.croppingElementId&&!s.isCropping){let e=n.get(s.croppingElementId);e&&io(e)&&TR(h,c,s,e,n)}}else if(i.length>1&&!s.isRotating&&!i.some(e=>e.locked)){let e=4/s.zoom.value;h.fillStyle=`#fff`;let[t,a,o,u]=Ii(i,n),d=h.getLineDash();h.setLineDash([2/s.zoom.value]);let f=h.lineWidth;h.lineWidth=1/s.zoom.value,h.strokeStyle=r,Oo(h,t-e,a-e,o-t+e*2,u-a+e*2,(t+o)/2,(a+u)/2,0),h.lineWidth=f,h.setLineDash(d);let p=Do([t,a,o,u,(t+o)/2,(a+u)/2],0,s.zoom,`mouse`,v?{...Ea(l),rotation:!0}:Ea(l));i.some(e=>!e.locked)&&wR(h,c,s,p,0)}h.restore()}s.searchMatches?.matches.forEach(({id:e,focus:t,matchedLines:r})=>{let i=n.get(e);if(i){let[e,a,,,o,c]=ei(i,n,!0);h.save(),s.theme===R.LIGHT?t?h.fillStyle=`rgba(255, 124, 0, 0.4)`:h.fillStyle=`rgba(255, 226, 0, 0.4)`:t?h.fillStyle=`rgba(229, 82, 0, 0.4)`:h.fillStyle=`rgba(99, 52, 0, 0.4)`;let l=L(i)?s.zoom.value:1;h.translate(s.scrollX,s.scrollY),h.translate(o,c),h.rotate(i.angle),r.forEach(n=>{(n.showOnCanvas||t)&&h.fillRect(e+n.offsetX/l-o,a+n.offsetY/l-c,n.width/l,n.height/l)}),h.restore()}}),rR(h,s),h.restore(),oE({context:h,renderConfig:c,appState:s,normalizedWidth:f,normalizedHeight:p});let S;return c.renderScrollbars&&(S=tM(n,f,p,s),h.save(),h.fillStyle=eM,h.strokeStyle=`rgba(255,255,255,0.8)`,[S.horizontal,S.vertical].forEach(e=>{e&&nE(h,e.x,e.y,e.width,e.height,$j/2)}),h.restore()),{scrollBars:S,atLeastOneVisibleElement:r.length>0,elementsMap:n,animationState:m}},OR=e=>{let t=DR(e);return e.callback(t),t},kR=class e{static start(t,n){let r=n({deltaTime:0,state:void 0});r&&(e.animations.set(t,{animation:n,lastTime:0,state:r}),e.isRunning||(e.isRunning=!0,Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)))}static tick(){if(e.animations.size>0){for(let[t,n]of e.animations){let r=performance.now(),i=n.lastTime===0?0:r-n.lastTime,a=n.animation({deltaTime:i,state:n.state});if(a)n.lastTime=r,n.state=a;else if(e.animations.delete(t),e.animations.size===0){e.isRunning=!1;return}}Yj()?requestAnimationFrame(e.tick):setTimeout(e.tick,0)}}static running(t){return e.animations.has(t)}static cancel(t){e.animations.delete(t)}};i(kR,`isRunning`,!1),i(kR,`animations`,new Map);var AR=kR,jR=`animateInteractiveScene`,MR=e=>{let t=(0,H.useRef)(!1),n=(0,H.useRef)(null);return(0,H.useEffect)(()=>{if(!t.current){t.current=!0;return}let r=new Map,i=new Map,a=new Map,o=new Map,s=new Map;e.appState.collaborators.forEach((t,n)=>{if(t.selectedElementIds)for(let e of Object.keys(t.selectedElementIds))a.has(e)||a.set(e,[]),a.get(e).push(n);!t.pointer||t.pointer.renderCursor===!1||(t.username&&o.set(n,t.username),t.userState&&s.set(n,t.userState),i.set(n,Ci({sceneX:t.pointer.x,sceneY:t.pointer.y},e.appState)),r.set(n,t.button))});let c=e.containerRef?.current&&getComputedStyle(e.containerRef.current).getPropertyValue(`--color-selection`)||`#6965db`;n.current={app:e.app,canvas:e.canvas,elementsMap:e.elementsMap,visibleElements:e.visibleElements,selectedElements:e.selectedElements,allElementsMap:e.allElementsMap,scale:window.devicePixelRatio,appState:e.appState,renderConfig:{remotePointerViewportCoords:i,remotePointerButton:r,remoteSelectedElementIds:a,remotePointerUsernames:o,remotePointerUserStates:s,selectionColor:c,renderScrollbars:e.renderScrollbars,lastViewportPosition:e.app.lastViewportPosition},editorInterface:e.editorInterface,callback:e.renderInteractiveSceneCallback,animationState:{bindingHighlight:void 0},deltaTime:0},AR.running(jR)||AR.start(jR,({deltaTime:e,state:t})=>{let r=OR({...n.current,deltaTime:e,animationState:t}).animationState;if(r){for(let e in r)if(r[e]!==void 0)return r}})}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas interactive`,style:{width:e.appState.width,height:e.appState.height,cursor:e.appState.viewModeEnabled&&e.appState.activeTool.type!==`laser`?Kn.GRAB:Kn.AUTO},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:e.handleCanvasRef,onContextMenu:e.onContextMenu,onPointerMove:e.onPointerMove,onPointerUp:e.onPointerUp,onPointerCancel:e.onPointerCancel,onTouchMove:e.onTouchMove,onPointerDown:e.onPointerDown,onDoubleClick:e.appState.viewModeEnabled?void 0:e.onDoubleClick,children:K(`labels.drawingCanvas`)})},NR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,activeTool:e.activeTool,openDialog:e.openDialog,editingGroupId:e.editingGroupId,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,selectionElement:e.selectionElement,selectedGroupIds:e.selectedGroupIds,selectedLinearElement:e.selectedLinearElement,multiElement:e.multiElement,newElement:e.newElement,isBindingEnabled:e.isBindingEnabled,isMidpointSnappingEnabled:e.isMidpointSnappingEnabled,suggestedBinding:e.suggestedBinding,isRotating:e.isRotating,elementsToHighlight:e.elementsToHighlight,collaborators:e.collaborators,activeEmbeddable:e.activeEmbeddable,snapLines:e.snapLines,zenModeEnabled:e.zenModeEnabled,editingTextElement:e.editingTextElement,isCropping:e.isCropping,croppingElementId:e.croppingElementId,searchMatches:e.searchMatches,activeLockedId:e.activeLockedId,hoveredElementIds:e.hoveredElementIds,frameRendering:e.frameRendering,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,exportScale:e.exportScale,currentItemArrowType:e.currentItemArrowType}),PR=H.memo(MR,(e,t)=>e.selectionNonce!==t.selectionNonce||e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements||e.selectedElements!==t.selectedElements||e.renderScrollbars!==t.renderScrollbars?!1:ji(NR(e.appState),NR(t.appState))),FR=e=>{let t=(0,H.useRef)(null),n=(0,H.useRef)(!1);return(0,H.useEffect)(()=>{e.canvas.style.width=`${e.appState.width}px`,e.canvas.style.height=`${e.appState.height}px`,e.canvas.width=e.appState.width*e.scale,e.canvas.height=e.appState.height*e.scale},[e.appState.height,e.appState.width,e.canvas,e.scale]),(0,H.useEffect)(()=>{let r=t.current;if(!r)return;let i=e.canvas;n.current||(n.current=!0,r.replaceChildren(i),i.classList.add(`excalidraw__canvas`,`static`)),We({canvas:i,rc:e.rc,scale:e.scale,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,visibleElements:e.visibleElements,appState:e.appState,renderConfig:e.renderConfig},Yj())}),(0,W.jsx)(`div`,{className:`excalidraw__canvas-wrapper`,ref:t})},IR=e=>({zoom:e.zoom,scrollX:e.scrollX,scrollY:e.scrollY,width:e.width,height:e.height,viewModeEnabled:e.viewModeEnabled,openDialog:e.openDialog,hoveredElementIds:e.hoveredElementIds,offsetLeft:e.offsetLeft,offsetTop:e.offsetTop,theme:e.theme,shouldCacheIgnoreZoom:e.shouldCacheIgnoreZoom,viewBackgroundColor:e.viewBackgroundColor,exportScale:e.exportScale,selectedElementsAreBeingDragged:e.selectedElementsAreBeingDragged,gridSize:e.gridSize,gridStep:e.gridStep,frameRendering:e.frameRendering,selectedElementIds:e.selectedElementIds,frameToHighlight:e.frameToHighlight,editingGroupId:e.editingGroupId,currentHoveredFontFamily:e.currentHoveredFontFamily,croppingElementId:e.croppingElementId,suggestedBinding:e.suggestedBinding}),LR=H.memo(FR,(e,t)=>e.sceneNonce!==t.sceneNonce||e.scale!==t.scale||e.elementsMap!==t.elementsMap||e.visibleElements!==t.visibleElements?!1:ji(IR(e.appState),IR(t.appState))&&ji(e.renderConfig,t.renderConfig)),RR=({canvas:e,rc:t,newElement:n,elementsMap:r,allElementsMap:i,scale:a,appState:o,renderConfig:s})=>{if(e){let[c,l]=_(e,a),u=ht({canvas:e,scale:a,normalizedWidth:c,normalizedHeight:l});if(u.save(),u.scale(o.zoom.value,o.zoom.value),n&&n.type!==`selection`){if(na(n))return;if((n.frameId||o.frameToHighlight?.id)&&o.frameRendering.enabled&&o.frameRendering.clip){let e=Ts(n,r,o);e&&Yr(n,e,o,r)&&Ws(e,u,s,o)}_t(n,r,i,t,u,s,o)}else u.clearRect(0,0,c,l);u.restore()}},zR=mi(e=>{RR(e)}),BR=(e,t)=>{if(t){zR(e);return}RR(e)},VR=e=>{let t=(0,H.useRef)(null);return(0,H.useEffect)(()=>{t.current&&BR({canvas:t.current,scale:e.scale,newElement:e.appState.newElement,elementsMap:e.elementsMap,allElementsMap:e.allElementsMap,rc:e.rc,renderConfig:e.renderConfig,appState:e.appState},Yj())}),(0,W.jsx)(`canvas`,{className:`excalidraw__canvas`,style:{width:e.appState.width,height:e.appState.height},width:e.appState.width*e.scale,height:e.appState.height*e.scale,ref:t})},HR=class{constructor(e){this.getState=e,i(this,`listeners`,[]),i(this,`onStateChange`,(e,t,n)=>{let{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}=this.normalize(e,t,n);return a?s&&(queueMicrotask(()=>{let e=this.getState();a(i(e),e)}),o)?()=>{}:this.subscribe({predicate:r,getValue:i,callback:a,once:o}):s?Promise.resolve(i(this.getState())):new Promise(e=>{this.subscribe({predicate:r,getValue:i,callback:t=>e(t),once:!0})})})}isStateChangePredicateOptions(e){return typeof e==`object`&&!Array.isArray(e)&&`predicate`in e}subscribe(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}normalize(e,t,n){let r,i,a=t,o=n?.once??!1,s=!1;if(this.isStateChangePredicateOptions(e)){let{predicate:t,callback:n,once:c}=e;r=t,i=e=>e,a=n?(e,t)=>n(t):void 0,o=c??!1,s=t(this.getState())}else if(typeof e==`function`){let t=e;r=(e,n)=>t(e)!==t(n),i=e=>t(e)}else if(Array.isArray(e)){let t=e;r=(e,n)=>t.some(t=>e[t]!==n[t]),i=e=>e}else{let t=e;r=(e,n)=>e[t]!==n[t],i=e=>e[t]}return{predicate:r,getValue:i,callback:a,once:o,matchesImmediately:s}}flush(e){if(!this.listeners.length)return;let t=this.getState(),n=[];for(let r of this.listeners)r.predicate(t,e)?(r.callback(r.getValue(t),t),r.once||n.push(r)):n.push(r);this.listeners=n}clear(){this.listeners=[]}},UR=({app:e,activeLockedId:t})=>{let n=e.scene.getElement(t),r=n?[n]:Ki(e.scene.getNonDeletedElementsMap(),t);if(r.length===0)return null;let[i,a]=Ii(r),{x:o,y:s}=Ci({sceneX:i,sceneY:a},e.state);return(0,W.jsx)(`div`,{className:`UnlockPopup`,style:{bottom:`${e.state.height+12-s+e.state.offsetTop}px`,left:`${o-e.state.offsetLeft}px`},onClick:()=>{(0,_c.flushSync)(()=>{let t=Kt(r,e.state);e.setState({selectedElementIds:r.reduce((e,t)=>({...e,[t.id]:!0}),{}),selectedGroupIds:t,activeLockedId:null})}),e.actionManager.executeAction(ZE)},title:K(`labels.elementLock.unlock`),children:qy})},WR=H.createContext(null),GR=H.createContext(null),KR={formFactor:`desktop`,desktopUIMode:`full`,userAgent:Ko(typeof navigator<`u`?navigator.userAgent:``),isTouchScreen:!1,canFitSidebar:!1,isLandscape:!0},qR=H.createContext(KR);qR.displayName=`EditorInterfaceContext`;var JR={"editor:mount":{cardinality:`once`,replay:`last`},"editor:initialize":{cardinality:`once`,replay:`last`},"editor:unmount":{cardinality:`once`,replay:`last`}},YR=H.createContext({container:null,id:null});YR.displayName=`ExcalidrawContainerContext`;var XR=H.createContext([]);XR.displayName=`ExcalidrawElementsContext`;var ZR=H.createContext({...cs(),width:0,height:0,offsetLeft:0,offsetTop:0});ZR.displayName=`ExcalidrawAppStateContext`;var QR=H.createContext(()=>{console.warn(`Uninitialized ExcalidrawSetAppStateContext context!`)});QR.displayName=`ExcalidrawSetAppStateContext`;var $R=H.createContext(null);$R.displayName=`ExcalidrawActionManagerContext`;var ez=H.createContext(null);ez.displayName=`ExcalidrawAPIContext`;var tz=H.createContext(null);tz.displayName=`ExcalidrawAPISetContext`;var nz=()=>(0,H.useContext)(WR),rz=()=>(0,H.useContext)(GR),iz=()=>(0,H.useContext)(qR),az=()=>Ka(iz()),oz=()=>(0,H.useContext)(YR),sz=()=>(0,H.useContext)(XR),cz=()=>(0,H.useContext)(ZR),lz=()=>(0,H.useContext)(QR),uz=()=>(0,H.useContext)($R),dz=!1,fz=0,pz=null,mz=!1,hz=!1,gz=!1,_z={horizontal:null,vertical:null},vz=0,yz=!1,bz=new Map,xz=!1,Sz=0,Cz=!1,wz=null,Tz={pointers:new Map,lastCenter:null,initialDistance:null,initialScale:null},Ez=class e extends H.Component{constructor(t){super(t),i(this,`canvas`),i(this,`interactiveCanvas`,null),i(this,`sessionExportThemeOverride`),i(this,`rc`),i(this,`unmounted`,!1),i(this,`actionManager`),i(this,`editorInterface`,KR),i(this,`stylesPanelMode`,Ka(KR)),i(this,`excalidrawContainerRef`,H.createRef()),i(this,`scene`),i(this,`fonts`),i(this,`renderer`),i(this,`visibleElements`),i(this,`resizeObserver`),i(this,`library`),i(this,`libraryItemsFromStorage`),i(this,`id`),i(this,`store`),i(this,`history`),i(this,`excalidrawContainerValue`),i(this,`files`,{}),i(this,`imageCache`,new Map),i(this,`iFrameRefs`,new Map),i(this,`embedsValidationStatus`,new Map),i(this,`initializedEmbeds`,new Set),i(this,`elementsPendingErasure`,new Set),i(this,`_initialized`,!1),i(this,`editorLifecycleEvents`,new ve(JR)),i(this,`onEvent`,this.editorLifecycleEvents.on.bind(this.editorLifecycleEvents)),i(this,`appStateObserver`,new HR(()=>this.state)),i(this,`onStateChange`,this.appStateObserver.onStateChange),i(this,`flowChartCreator`,new ea),i(this,`flowChartNavigator`,new fn),i(this,`bindModeHandler`,null),i(this,`hitLinkElement`),i(this,`lastPointerDownEvent`,null),i(this,`lastPointerUpEvent`,null),i(this,`lastPointerMoveEvent`,null),i(this,`lastPointerMoveCoords`,null),i(this,`previousPointerMoveCoords`,null),i(this,`lastViewportPosition`,{x:0,y:0}),i(this,`animationFrameHandler`,new pj),i(this,`laserTrails`,new Kj(this.animationFrameHandler,this)),i(this,`eraserTrail`,new cM(this.animationFrameHandler,this)),i(this,`lassoTrail`,new sM(this.animationFrameHandler,this)),i(this,`onChangeEmitter`,new Be),i(this,`onPointerDownEmitter`,new Be),i(this,`onPointerUpEmitter`,new Be),i(this,`onUserFollowEmitter`,new Be),i(this,`onScrollChangeEmitter`,new Be),i(this,`missingPointerEventCleanupEmitter`,new Be),i(this,`onRemoveEventListenersEmitter`,new Be),i(this,`api`),i(this,`updateEditorAtom`,(e,...t)=>{let n=Cy.set(e,...t);return this.triggerRender(),n}),i(this,`previousHoveredBindableElement`,null),i(this,`getEffectiveGridSize`,()=>Sj(this)?this.state.gridSize:null),i(this,`handleIframeLikeElementHover`,({hitElement:e,scenePointer:t,moveEvent:n})=>e&&Rs(e)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(e,n,t.x,t.y))?(Gw(this.interactiveCanvas,Kn.POINTER),this.setState({activeEmbeddable:{element:e,state:`hover`}}),!0):(this.state.activeEmbeddable?.state===`hover`&&this.setState({activeEmbeddable:null}),!1)),i(this,`updateEmbedValidationStatus`,(e,t)=>{this.embedsValidationStatus.set(e.id,t),bn.delete(e)}),i(this,`updateEmbeddables`,()=>{let e=new Set,t=!1;this.scene.getNonDeletedElements().filter(n=>{if(rs(n)){if(e.add(n.id),!this.embedsValidationStatus.has(n.id)){t=!0;let e=Lt(n.link,this.props.validateEmbeddable);this.updateEmbedValidationStatus(n,e)}}else Vs(n)&&e.add(n.id);return!1}),t&&this.scene.triggerUpdate(),this.iFrameRefs.forEach((t,n)=>{e.has(n)||this.iFrameRefs.delete(n)})}),i(this,`getFrameNameDOMId`,e=>`${this.id}-frame-name-${e.id}`),i(this,`frameNameBoundsCache`,{get:e=>{let t=this.frameNameBoundsCache._cache.get(e.id);if(!t||t.zoom!==this.state.zoom.value||t.versionNonce!==e.versionNonce){let n=document.getElementById(this.getFrameNameDOMId(e));if(n){let r=n.getBoundingClientRect(),i=la({clientX:r.x,clientY:r.y},this.state),a=la({clientX:r.right,clientY:r.bottom},this.state);return t={x:i.x,y:i.y,width:a.x-i.x,height:a.y-i.y,angle:0,zoom:this.state.zoom.value,versionNonce:e.versionNonce},this.frameNameBoundsCache._cache.set(e.id,t),t}return null}return t},_cache:new Map}),i(this,`resetEditingFrame`,e=>{e&&this.scene.mutateElement(e,{name:e.name?.trim()||null}),this.setState({editingFrame:null})}),i(this,`renderFrameNames`,()=>{if(!this.state.frameRendering.enabled||!this.state.frameRendering.name)return this.state.editingFrame&&this.resetEditingFrame(null),null;let e=this.state.theme===R.DARK,t=this.scene.getNonDeletedFramesLikes(),n=t.length>0&&this.state.searchMatches?.focusedId&&L(this.scene.getElement(this.state.searchMatches.focusedId))?this.state.searchMatches.matches.find(e=>e.focus):null;return t.map(t=>{if(!vn(t,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap()))return this.state.editingFrame===t.id&&this.resetEditingFrame(t),null;let{x:r,y:i}=Ci({sceneX:t.x,sceneY:t.y},this.state),a,o=ua(t);if(t.id===this.state.editingFrame){let n=o;a=(0,W.jsx)(`input`,{autoFocus:!0,value:n,onChange:e=>{this.scene.mutateElement(t,{name:e.target.value})},onFocus:e=>e.target.select(),onBlur:()=>this.resetEditingFrame(t),onKeyDown:e=>{(e.key===N.ESCAPE||e.key===N.ENTER)&&this.resetEditingFrame(t)},style:{background:e?D(this.state.viewBackgroundColor):this.state.viewBackgroundColor,zIndex:2,border:`none`,display:`block`,padding:`6px`,borderRadius:4,boxShadow:`inset 0 0 0 1px var(--color-primary)`,fontFamily:`Assistant`,fontSize:`${On.nameFontSize}px`,transform:`translate(-6px, 6px)`,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,overflow:`hidden`,maxWidth:`${document.body.clientWidth-r-6}px`},size:n.length+1||1,dir:`auto`,autoComplete:`off`,autoCapitalize:`off`,autoCorrect:`off`})}else a=o;return(0,W.jsx)(`div`,{id:this.getFrameNameDOMId(t),className:Qn.FRAME_NAME,style:{position:`absolute`,bottom:`${this.state.height+On.nameOffsetY-i+this.state.offsetTop}px`,left:`${r-this.state.offsetLeft}px`,zIndex:2,fontSize:On.nameFontSize,color:e?On.nameColorDarkTheme:On.nameColorLightTheme,lineHeight:On.nameLineHeight,width:`max-content`,maxWidth:n?.id===t.id&&n?.focus?`none`:`${t.width*this.state.zoom.value}px`,overflow:t.id===this.state.editingFrame?`visible`:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,cursor:Kn.MOVE,pointerEvents:this.state.viewModeEnabled?uo.disabled:uo.enabled},onPointerDown:e=>this.handleCanvasPointerDown(e),onWheel:e=>this.handleWheel(e),onContextMenu:this.handleCanvasContextMenu,onDoubleClick:()=>{this.setState({editingFrame:t.id})},children:a},t.id)})}),i(this,`focusContainer`,()=>{this.excalidrawContainerRef.current?.focus()}),i(this,`getSceneElementsIncludingDeleted`,()=>this.scene.getElementsIncludingDeleted()),i(this,`getSceneElementsMapIncludingDeleted`,()=>this.scene.getElementsMapIncludingDeleted()),i(this,`getSceneElements`,()=>this.scene.getNonDeletedElements()),i(this,`onInsertElements`,e=>{this.addElementsFromPasteOrLibrary({elements:e,position:`center`,files:null})}),i(this,`onExportImage`,async(e,t,n)=>{dC(`export`,e,`ui`);let r=await PT(e,t,this.state,this.files,{exportBackground:this.state.exportBackground,name:this.getName(),viewBackgroundColor:this.state.viewBackgroundColor,exportingFrame:n.exportingFrame}).catch(te).catch(e=>{console.error(e),this.setState({errorMessage:e.message})});this.state.exportEmbedScene&&r&&ja(r)&&this.setState({fileHandle:r})}),i(this,`magicGenerations`,new Map),i(this,`updateMagicGeneration`,({frameElement:e,data:t})=>{t.status===`pending`?this.scene.mutateElement(e,{customData:{generationData:void 0}},{informMutation:!1,isDragging:!1}):this.scene.mutateElement(e,{customData:{generationData:t}},{informMutation:!1,isDragging:!1}),this.magicGenerations.set(e.id,t),this.triggerRender()}),i(this,`plugins`,{}),i(this,`onMagicframeToolSelect`,()=>{let e=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds});if(e.length===0)this.setActiveTool({type:va.magicframe}),dC(`ai`,`tool-select (empty-selection)`,`d2c`);else{let t=e.length===1&&xe(e[0])&&e[0];if(!t&&e.some(e=>L(e)||e.frameId)){this.setActiveTool({type:va.magicframe});return}dC(`ai`,`tool-select (existing selection)`,`d2c`);let n;if(t)n=t;else{let[t,r,i,a]=Ii(e);n=Pn({...On,x:t-50,y:r-50,width:i-t+100,height:a-r+100,opacity:100,locked:!1}),this.scene.insertElement(n);for(let t of e)this.scene.mutateElement(t,{frameId:n.id});this.setState({selectedElementIds:{[n.id]:!0}})}this.onMagicFrameGenerate(n,`upstream`)}}),i(this,`openEyeDropper`,({type:e})=>{this.updateEditorAtom(bC,{swapPreviewOnAlt:!0,colorPickerType:e===`stroke`?`elementStroke`:`elementBackground`,onSelect:(t,n)=>{let r=e===`background`&&n.altKey||e===`stroke`&&!n.altKey;!this.scene.getSelectedElements(this.state).length||this.state.activeTool.type!==`selection`?r?this.syncActionResult({appState:{...this.state,currentItemStrokeColor:t},captureUpdate:V.IMMEDIATELY}):this.syncActionResult({appState:{...this.state,currentItemBackgroundColor:t},captureUpdate:V.IMMEDIATELY}):this.updateScene({elements:this.scene.getElementsIncludingDeleted().map(e=>this.state.selectedElementIds[e.id]?B(e,{[r?`strokeColor`:`backgroundColor`]:t}):e),captureUpdate:V.IMMEDIATELY})},keepOpenOnAlt:!1})}),i(this,`dismissLinearEditor`,()=>{setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isEditing:!1}})})}),i(this,`syncActionResult`,qj(e=>{if(this.unmounted||e===!1)return;this.store.scheduleAction(e.captureUpdate);let t=!1,n=null;if(e.elements&&(this.scene.replaceAllElements(e.elements),t=!0),e.files&&(this.addMissingFiles(e.files,e.replaceFiles),this.addNewImagesToImageCache()),e.appState||n||this.state.contextMenu){let r=e?.appState?.viewModeEnabled||!1,i=e?.appState?.zenModeEnabled||!1,a=e?.appState?.theme||this.props.theme||R.LIGHT,o=e?.appState?.name??this.state.name,s=e?.appState?.errorMessage??this.state.errorMessage;typeof this.props.viewModeEnabled<`u`&&(r=this.props.viewModeEnabled),typeof this.props.zenModeEnabled<`u`&&(i=this.props.zenModeEnabled),n=e.appState?.editingTextElement||null,e.elements&&n&&e.elements.forEach(e=>{n?.id===e.id&&n!==e&&Is(e)&&M(e)&&(n=e)}),n?.isDeleted&&(n=null),this.setState(t=>{let c=e.appState||{};return{...t,...c,contextMenu:null,editingTextElement:n,viewModeEnabled:r,zenModeEnabled:i,theme:a,name:o,errorMessage:s}}),t=!0}t||this.scene.triggerUpdate()})),i(this,`onBlur`,qj(()=>{mz=!1,this.setState({isBindingEnabled:this.state.bindingPreference===`enabled`})})),i(this,`onUnload`,()=>{this.onBlur()}),i(this,`disableEvent`,e=>{e.preventDefault()}),i(this,`resetHistory`,()=>{this.history.clear()}),i(this,`resetStore`,()=>{this.store.clear()}),i(this,`resetScene`,qj(e=>{this.scene.replaceAllElements([]),this.setState(t=>({...cs(),isLoading:e?.resetLoadingState?!1:t.isLoading,theme:this.state.theme})),this.resetStore(),this.resetHistory()})),i(this,`initializeScene`,async()=>{`launchQueue`in window&&`LaunchParams`in window&&window.launchQueue.setConsumer(async e=>{if(!e.files.length)return;let t=e.files[0],n=await t.getFile();this.loadFileToCanvas(new File([n],n.name||``,{type:n.type}),t)}),this.props.theme&&this.setState({theme:this.props.theme}),this.state.isLoading||this.setState({isLoading:!0});let e=null;try{e=typeof this.props.initialData==`function`?await this.props.initialData()||null:await this.props.initialData||null,e?.libraryItems&&this.library.updateLibrary({libraryItems:e.libraryItems,merge:!0}).catch(e=>{console.error(e)})}catch(t){console.error(t),e={appState:{errorMessage:t.message||`Encountered an error during importing or restoring scene data`}}}let t=Sa(e?.elements,null,{repairBindings:!0,deleteInvisibleElements:!0}),n=gr(e?.appState,null),r=n.activeTool;n.preferredSelectionTool.initialized||(n.preferredSelectionTool={type:this.editorInterface.formFactor===`phone`?`lasso`:`selection`,initialized:!0}),n={...n,theme:this.props.theme||n.theme,openSidebar:n?.openSidebar||this.state.openSidebar,activeTool:r.type===`image`||r.type===`lasso`||r.type===`selection`?{...r,type:n.preferredSelectionTool.type}:n.activeTool,isLoading:!1,toast:this.state.toast},e?.scrollToContent&&(n={...n,...An(t,{...n,width:this.state.width,height:this.state.height,offsetTop:this.state.offsetTop,offsetLeft:this.state.offsetLeft})}),this.resetStore(),this.resetHistory(),this.syncActionResult({elements:t,appState:n,files:e?.files,captureUpdate:V.NEVER}),this.clearImageShapeCache(),this.fonts.loadSceneFonts().then(e=>{this.fonts.onLoaded(e)}),Bn(window.location.href)&&this.scrollToContent(window.location.href,{animate:!1})}),i(this,`getFormFactor`,(e,t)=>this.props.UIOptions.getFormFactor?.(e,t)??$a(e,t)),i(this,`refreshEditorInterface`,()=>{let e=this.excalidrawContainerRef.current;if(!e)return;let{width:t,height:n}=e.getBoundingClientRect(),r=Zs(),i=Ko(typeof navigator<`u`?navigator.userAgent:``),a=this.props.UIOptions.dockedSidebarBreakpoint==null?Qi:this.props.UIOptions.dockedSidebarBreakpoint,o=Jr(this.editorInterface,{desktopUIMode:r??this.editorInterface.desktopUIMode,formFactor:this.getFormFactor(t,n),userAgent:i,canFitSidebar:t>a,isLandscape:t>n});this.editorInterface=o,this.reconcileStylesPanelMode(o)}),i(this,`reconcileStylesPanelMode`,e=>{let t=Ka(e);if(t===this.stylesPanelMode)return;let n=this.stylesPanelMode;this.stylesPanelMode=t,n!==`full`&&t===`full`&&this.setState(e=>({preferredSelectionTool:{type:`selection`,initialized:!0}}))}),i(this,`setDesktopUIMode`,e=>{let t=Ar(e);this.editorInterface=Jr(this.editorInterface,{desktopUIMode:t}),this.reconcileStylesPanelMode(this.editorInterface)}),i(this,`onResize`,qj(()=>{this.scene.getElementsIncludingDeleted().forEach(e=>bn.delete(e)),this.refreshEditorInterface(),this.updateDOMRect(),this.setState({})})),i(this,`onFullscreenChange`,()=>{!document.fullscreenElement&&this.state.activeEmbeddable?.state===`active`&&this.setState({activeEmbeddable:null})}),i(this,`renderInteractiveSceneCallback`,({atLeastOneVisibleElement:e,scrollBars:t,elementsMap:n})=>{t&&(_z=t);let r=this.state.editingTextElement?!1:!e&&n.size>0;this.state.scrolledOutside!==r&&this.setState({scrolledOutside:r}),this.scheduleImageRefresh()}),i(this,`onScroll`,wt(()=>{let{offsetTop:e,offsetLeft:t}=this.getCanvasOffsets();this.setState(n=>n.offsetLeft===t&&n.offsetTop===e?null:{offsetTop:e,offsetLeft:t})},100)),i(this,`onCut`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(yE,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onCopy`,qj(e=>{!this.excalidrawContainerRef.current?.contains(document.activeElement)||Wr(e.target)||(this.actionManager.executeAction(_E,`keyboard`,e),e.preventDefault(),e.stopPropagation())})),i(this,`onTouchStart`,t=>{if(Yo&&t.preventDefault(),!dz){dz=!0,t.touches.length===1&&(pz={x:t.touches[0].clientX,y:t.touches[0].clientY}),clearTimeout(fz),fz=window.setTimeout(e.resetTapTwice,300);return}if(dz&&t.touches.length===1&&pz){let e=t.touches[0];Se(O(e.clientX,e.clientY),O(pz.x,pz.y))<=35&&(this.lassoTrail.endPath(),this.deselectElements(),this.handleCanvasDoubleClick({clientX:e.clientX,clientY:e.clientY})),dz=!1,clearTimeout(fz)}t.touches.length===2&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null})}),i(this,`onTouchEnd`,e=>{this.resetContextMenuTimer(),e.touches.length>0?this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}):Tz.pointers.clear()}),i(this,`pasteFromClipboard`,qj(async e=>{let t=!!xz,n=document.activeElement,r=this.excalidrawContainerRef.current?.contains(n);if(e&&!r)return;let i=document.elementFromPoint(this.lastViewportPosition.x,this.lastViewportPosition.y);if(e&&(!(i instanceof HTMLCanvasElement)||Wr(n)))return;let a=await DT(e),o=a.getFiles(),s=await OT(a,t);if(this.props.onPaste)try{if(await this.props.onPaste(s,e)===!1)return}catch(e){console.error(e)}await this.insertClipboardContent(s,o,t),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e?.preventDefault()})),i(this,`addElementsFromPasteOrLibrary`,e=>{let t=Sa(e.elements,null,{deleteInvisibleElements:!0}),[n,r,i,a]=Ii(t),o=fr(n,i)/2,s=fr(r,a)/2,{x:c,y:l}=la({clientX:typeof e.position==`object`?e.position.clientX:e.position===`cursor`?this.lastViewportPosition.x:this.state.width/2+this.state.offsetLeft,clientY:typeof e.position==`object`?e.position.clientY:e.position===`cursor`?this.lastViewportPosition.y:this.state.height/2+this.state.offsetTop},this.state),[u,d]=It(c-o,l-s,this.getEffectiveGridSize()),{duplicatedElements:f}=Er({type:`everything`,elements:t.map(e=>B(e,{x:e.x+u-n,y:e.y+d-r})),randomizeSeed:!e.retainSeed}),p=this.scene.getElementsIncludingDeleted(),m=[...p,...f];m=this.props.onDuplicate?.(m,p)||m,fe(m,lr(f));let h=this.getTopLayerFrameAtSceneCoords({x:c,y:l});if(h){let e=ze(f,h);Je(m,e,h,this.state)}this.scene.replaceAllElements(m),f.forEach(e=>{M(e)&&ya(e)&&Zi(e,so(e,this.scene.getElementsMapIncludingDeleted()),this.scene)}),Or&&de.loadElementsFonts(f).then(e=>{this.fonts.onLoaded(e)}),e.files&&this.addMissingFiles(e.files);let g=Zn(f);this.store.scheduleCapture(),this.setState({...this.state,openSidebar:this.state.openSidebar&&this.editorInterface.canFitSidebar&&Cy.get(rP)?this.state.openSidebar:null,...Hr({editingGroupId:null,selectedElementIds:g.reduce((e,t)=>(ya(t)||(e[t.id]=!0),e),{})},this.scene.getNonDeletedElements(),this.state,this)},()=>{e.files&&this.addNewImagesToImageCache()}),this.setActiveTool({type:this.state.preferredSelectionTool.type},!0),e.fitToContent&&this.scrollToContent(f,{fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()})}),i(this,`setAppState`,(e,t)=>{this.setState(e,t)}),i(this,`removePointer`,e=>{vz&&this.resetContextMenuTimer(),Tz.pointers.delete(e.pointerId)}),i(this,`toggleLock`,(e=`ui`)=>{this.state.activeTool.locked||dC(`toolbar`,`toggleLock`,`${e} (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),this.setState(e=>({activeTool:{...e.activeTool,...ka(this.state,e.activeTool.locked?{type:this.state.preferredSelectionTool.type}:e.activeTool),locked:!e.activeTool.locked}}))}),i(this,`updateFrameRendering`,e=>{this.setState(t=>{let n=typeof e==`function`?e(t.frameRendering):e;return{frameRendering:{enabled:n?.enabled??t.frameRendering.enabled,clip:n?.clip??t.frameRendering.clip,name:n?.name??t.frameRendering.name,outline:n?.outline??t.frameRendering.outline}}})}),i(this,`togglePenMode`,e=>{this.setState(t=>({penMode:e??!t.penMode,penDetected:!0}))}),i(this,`onHandToolToggle`,()=>{this.actionManager.executeAction(aT)}),i(this,`zoomCanvas`,e=>{this.setState({...Xw({viewportX:this.state.width/2+this.state.offsetLeft,viewportY:this.state.height/2+this.state.offsetTop,nextZoom:_i(e)},this.state)})}),i(this,`cancelInProgressAnimation`,null),i(this,`scrollToContent`,(e=this.scene.getNonDeletedElements(),t)=>{if(typeof e==`string`){let n;if(n=Bn(e)?ne(e):e,n){let r=this.scene.getElementsFromId(n);r?.length?this.scrollToContent(r,{fitToContent:t?.fitToContent??!0,animate:t?.animate??!0}):Bn(e)&&this.setState({toast:{message:K(`elementLink.notFound`),duration:3e3,closable:!0}})}return}this.cancelInProgressAnimation?.();let n=Array.isArray(e)?e:[e],r=this.state.zoom,i=this.state.scrollX,a=this.state.scrollY;if(t?.fitToContent||t?.fitToViewport){let{appState:e}=rT({canvasOffsets:t.canvasOffsets,targetElements:n,appState:this.state,fitToViewport:!!t?.fitToViewport,viewportZoomFactor:t?.viewportZoomFactor,minZoom:t?.minZoom,maxZoom:t?.maxZoom});r=e.zoom,i=e.scrollX,a=e.scrollY}else{let e=An(n,this.state);i=e.scrollX,a=e.scrollY}if(t?.animate){let e=this.state.scrollX,n=this.state.scrollY,o=this.state.zoom.value,s=Ot({fromValues:{scrollX:e,scrollY:n,zoom:o},toValues:{scrollX:i,scrollY:a,zoom:r.value},interpolateValue:(e,t,n,r)=>{if(r===`zoom`)return e*(t/e)**+Oe(n)},onStep:({scrollX:e,scrollY:t,zoom:n})=>{this.setState({scrollX:e,scrollY:t,zoom:{value:n}})},onStart:()=>{this.setState({shouldCacheIgnoreZoom:!0})},onEnd:()=>{this.setState({shouldCacheIgnoreZoom:!1})},onCancel:()=>{this.setState({shouldCacheIgnoreZoom:!1})},duration:t?.duration??500});this.cancelInProgressAnimation=()=>{s(),this.cancelInProgressAnimation=null}}else this.setState({scrollX:i,scrollY:a,zoom:r})}),i(this,`maybeUnfollowRemoteUser`,()=>{this.state.userToFollow&&this.setState({userToFollow:null})}),i(this,`translateCanvas`,e=>{this.cancelInProgressAnimation?.(),this.maybeUnfollowRemoteUser(),this.setState(e)}),i(this,`setToast`,e=>{this.setState({toast:e})}),i(this,`restoreFileFromShare`,async()=>{try{let e=await caches.open(`web-share-target`),t=await e.match(`shared-file`);if(t){let n=await t.blob(),r=new File([n],n.name||``,{type:n.type});this.loadFileToCanvas(r,null),await e.delete(`shared-file`),window.history.replaceState(null,dt,window.location.pathname)}}catch(e){this.setState({errorMessage:e.message})}}),i(this,`addFiles`,qj(e=>{let{addedFiles:t}=this.addMissingFiles(e);this.clearImageShapeCache(t),this.scene.triggerUpdate(),this.addNewImagesToImageCache()})),i(this,`addMissingFiles`,(e,t=!1)=>{let n=t?{}:{...this.files},r={},i=Array.isArray(e)?e:Object.values(e);for(let e of i)if(!n[e.id]&&(r[e.id]=e,n[e.id]=e,e.mimeType===hs.svg))try{let t=Qo(ae(Jn(e.dataURL)),hs.svg);e.dataURL!==t&&(e.version=(e.version??1)+1,e.dataURL=t)}catch(e){console.error(e)}return this.files=n,{addedFiles:r}}),i(this,`updateScene`,qj(e=>{let{elements:t,appState:n,collaborators:r,captureUpdate:i}=e;if(i){let e=t||void 0,r=n?Oi({...this.store.snapshot.appState,...n}):void 0;this.store.scheduleMicroAction({action:i,elements:e,appState:r})}n&&this.setState(n),t&&this.scene.replaceAllElements(t),r&&this.setState({collaborators:r})})),i(this,`applyDeltas`,(e,t)=>{let n=Ps.squash(...e),r={...this.state},i=new Map(this.scene.getElementsMapIncludingDeleted());return Ps.applyTo(n,i,r,t)}),i(this,`mutateElement`,(e,t,n=!0)=>this.scene.mutateElement(e,t,{informMutation:n,isDragging:!1})),i(this,`triggerRender`,e=>{e===!0?this.scene.triggerUpdate():this.setState({})}),i(this,`toggleSidebar`,({name:e,tab:t,force:n})=>{let r;r=n===void 0?this.state.openSidebar?.name===e&&this.state.openSidebar?.tab===t?null:e:n?e:null;let i=r?{name:r}:null;return i&&t&&(i.tab=t),this.setState({openSidebar:i}),!!r}),i(this,`updateCurrentCursorPosition`,qj(e=>{this.lastViewportPosition.x=e.clientX,this.lastViewportPosition.y=e.clientY})),i(this,`getEditorUIOffsets`,()=>{let e=this.excalidrawContainerRef?.current?.querySelector(`.App-toolbar`)?.getBoundingClientRect()?.bottom??0,t=this.excalidrawContainerRef?.current?.querySelector(`.sidebar`)?.getBoundingClientRect(),n=this.excalidrawContainerRef?.current?.querySelector(`.App-menu__left`)?.getBoundingClientRect();return My().rtl?{top:e+16,right:Math.max(this.state.width-(n?.left??this.state.width),0)+16,bottom:16,left:Math.max(t?.right??0,0)+16}:{top:e+16,right:Math.max(this.state.width-(t?.left??this.state.width)+16,0),bottom:16,left:Math.max(n?.right??0,0)+16}}),i(this,`onKeyDown`,qj(e=>{if(`Proxy`in window&&(!e.shiftKey&&/^[A-Z]$/.test(e.key)||e.shiftKey&&/^[a-z]$/.test(e.key))&&(e=new Proxy(e,{get(t,n){let r=t[n];return typeof r==`function`?r.bind(t):n===`key`?e.shiftKey?t.key.toUpperCase():t.key.toLowerCase():r}})),!Zr(e.target)){if((e.key===N.ESCAPE||e.key===N.ENTER)&&this.state.croppingElementId){this.finishImageCropping();return}let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&io(t[0])&&e.key===N.ENTER){this.startImageCropping(t[0]);return}if(e.key===N.ESCAPE)this.updateEditorAtom(sD,null);else if(e.key===N.TAB&&(document.activeElement===this.excalidrawContainerRef?.current||document.activeElement?.classList.contains(Qn.CONVERT_ELEMENT_TYPE_POPUP))){e.preventDefault();let n=mD(t);Cy.get(sD)?.type===`panel`&&pD(this,{conversionType:n,direction:e.shiftKey?`left`:`right`})&&this.store.scheduleCapture(),n&&this.updateEditorAtom(sD,{type:`panel`})}if(e.key===N.ESCAPE&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.clear(),this.triggerRender(!0);return}let n=Pe(e.key);if(e[N.CTRL_OR_CMD]&&n&&!e.shiftKey){e.preventDefault();let t=ir(this.scene.getNonDeletedElementsMap(),this.state);t.length===1&&Vi(t[0])&&this.flowChartCreator.createNodes(t[0],this.state,Qe(e.key),this.scene),this.flowChartCreator.pendingNodes?.length&&!ms(this.flowChartCreator.pendingNodes,this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(this.flowChartCreator.pendingNodes,{animate:!0,duration:300,fitToContent:!0,canvasOffsets:this.getEditorUIOffsets()});return}if(e.altKey){let t=ir(this.scene.getNonDeletedElementsMap(),this.state);if(t.length===1&&n){e.preventDefault();let n=this.flowChartNavigator.exploreByDirection(t[0],this.scene.getNonDeletedElementsMap(),Qe(e.key));if(n){this.setState(e=>({selectedElementIds:P({[n]:!0},e)}));let e=this.scene.getNonDeletedElementsMap().get(n);e&&!ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())&&this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})}return}}}if(e[N.CTRL_OR_CMD]&&e.key===N.P&&!e.shiftKey&&!e.altKey){this.setToast({message:K(`commandPalette.shortcutHint`,{shortcut:ND(`commandPalette`)})}),e.preventDefault();return}if(e[N.CTRL_OR_CMD]&&e.key.toLowerCase()===N.V&&(xz=e.shiftKey,clearTimeout(Sz),Sz=window.setTimeout(()=>{xz=!1},100)),e[N.CTRL_OR_CMD]&&Wr(e.target)&&(e.code===Gs.MINUS||e.code===Gs.EQUAL)){e.preventDefault();return}if(Wr(e.target)&&e.key!==N.ESCAPE||Pe(e.key)&&Zr(e.target))return;if(e.key===N.QUESTION_MARK){this.setState({openDialog:{name:`help`}});return}else if(e.key.toLowerCase()===N.E&&e.shiftKey&&e[N.CTRL_OR_CMD]){e.preventDefault(),this.setState({openDialog:{name:`imageExport`}});return}if(e.key===N.PAGE_UP||e.key===N.PAGE_DOWN){let t=(e.shiftKey?this.state.width:this.state.height)/this.state.zoom.value;e.key===N.PAGE_DOWN&&(t=-t),e.shiftKey?this.translateCanvas(e=>({scrollX:e.scrollX+t})):this.translateCanvas(e=>({scrollY:e.scrollY+t}))}if(this.state.openDialog?.name===`elementLinkSelector`||(e.key===N.ALT&&(Ys(`COMPLEX_BINDINGS`)?this.handleSkipBindMode():C({app:this,event:e})),this.actionManager.handleKeyDown(e)))return;let t=this.props.viewModeEnabled===!0;if(!t&&this.state.viewModeEnabled&&e.key===N.ESCAPE){this.setActiveTool({type:`selection`});return}if(!t&&!e.ctrlKey&&!e.altKey&&!e.metaKey&&!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged){let t=mk(e.key,this);if(this.state.viewModeEnabled&&!v(t,[`laser`,`hand`]))return;if(t){this.state.activeTool.type!==t&&dC(`toolbar`,t,`keyboard (${this.editorInterface.formFactor===`phone`?`mobile`:`desktop`})`),t===`arrow`&&this.state.activeTool.type===`arrow`&&this.setState(e=>({currentItemArrowType:e.currentItemArrowType===ts.sharp?ts.round:e.currentItemArrowType===ts.round?ts.elbow:ts.sharp})),t===`lasso`&&this.state.activeTool.type===`laser`?this.setActiveTool({type:this.state.preferredSelectionTool.type}):this.setActiveTool({type:t}),e.stopPropagation();return}else if(e.key===N.Q){this.toggleLock(`keyboard`),e.stopPropagation();return}}if(this.state.viewModeEnabled)return;if(e[N.CTRL_OR_CMD]&&!e.repeat&&(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),C({app:this,event:e})),Pe(e.key)){let t=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0}),n=new Set;t.filter(e=>ss(e)).filter(e=>{let n=e.startBinding&&!t.some(t=>t.id===e.startBinding?.elementId),r=e.endBinding&&!t.some(t=>t.id===e.endBinding?.elementId);return n||r}).forEach(e=>n.add(e.id)),t=t.filter(e=>!n.has(e.id));let r=this.getEffectiveGridSize()&&(e.shiftKey?1:this.getEffectiveGridSize())||(e.shiftKey?5:1),i=0,a=0;e.key===N.ARROW_LEFT?i=-r:e.key===N.ARROW_RIGHT?i=r:e.key===N.ARROW_UP?a=-r:e.key===N.ARROW_DOWN&&(a=r),t.forEach(e=>{this.scene.mutateElement(e,{x:e.x+i,y:e.y+a},{informMutation:!1,isDragging:!1}),ue(e,this.scene,{simultaneouslyUpdated:t})}),this.scene.triggerUpdate(),e.preventDefault()}else if(e.key===N.ENTER){let t=this.scene.getSelectedElements(this.state);if(t.length===1){let n=t[0];if(e[N.CTRL_OR_CMD]||ca(n))b(n)&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==n.id)&&(this.store.scheduleCapture(),dr(n)||this.actionManager.executeAction(XA));else if(M(n)||ni(n)){let t;M(n)||(t=n);let r=nn(n,this.state,this.scene.getNonDeletedElementsMap()),i=r.x,a=r.y;this.startTextEditing({sceneX:i,sceneY:a,container:t}),e.preventDefault();return}else L(n)&&this.setState({editingFrame:n.id})}}if(e.key===N.SPACE&&Tz.pointers.size===0&&(mz=!0,Gw(this.interactiveCanvas,Kn.GRAB),e.preventDefault()),(e.key===N.G||e.key===N.S)&&!e.altKey&&!e[N.CTRL_OR_CMD]){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;e.key===N.G&&(Ir(this.state.activeTool.type)||t.some(e=>Ir(e.type)))&&(this.setState({openPopup:`elementBackground`}),e.stopPropagation()),e.key===N.S&&(this.setState({openPopup:`elementStroke`}),e.stopPropagation())}if(!e[N.CTRL_OR_CMD]&&e.shiftKey&&e.key.toLowerCase()===N.F){let t=this.scene.getSelectedElements(this.state);if(this.state.activeTool.type===`selection`&&!t.length)return;(this.state.activeTool.type===`text`||t.find(e=>M(e)||ut(e,this.scene.getNonDeletedElementsMap())))&&(e.preventDefault(),this.setState({openPopup:`fontFamily`}))}e[N.CTRL_OR_CMD]&&(e.key===N.BACKSPACE||e.key===N.DELETE)&&this.updateEditorAtom(Rk,`clearCanvas`);let n=e.key.toLocaleLowerCase(),r=n===N.S&&e.shiftKey&&!e[N.CTRL_OR_CMD],i=e.key===N.I||n===N.G&&e.shiftKey;(r||i)&&this.openEyeDropper({type:r?`stroke`:`background`})})),i(this,`onKeyUp`,qj(e=>{if(e.key===N.SPACE&&(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`||this.state.openDialog?.name===`elementLinkSelector`?Gw(this.interactiveCanvas,Kn.GRAB):Vr(this.state.activeTool.type)?Ww(this.interactiveCanvas):(Yw(this.interactiveCanvas,this.state),this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})),mz=!1),e.key===N.ALT&&C({app:this,event:e}),(e.key===N.ALT&&this.state.bindMode===`skip`||!e[N.CTRL_OR_CMD]&&!xs(this.state))&&(this.setState({bindMode:`orbit`}),this.lastPointerMoveEvent&&Ys(`COMPLEX_BINDINGS`))){let e=la({clientX:this.lastPointerMoveEvent.clientX,clientY:this.lastPointerMoveEvent.clientY},this.state),t=go(O(e.x,e.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(this.state.selectedLinearElement){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());ss(e)&&this.handleDelayedBindModeChange(e,t)}}if(!e[N.CTRL_OR_CMD]){let t=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==t&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:t})}),C({app:this,event:e})}if(Pe(e.key)){Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state);let e=this.scene.getNonDeletedElementsMap();this.scene.getSelectedElements(this.state).filter(Ti).forEach(t=>{t.startBinding&&this.scene.mutateElement(t,{startBinding:{...t.startBinding,...Qr(t,e.get(t.startBinding.elementId),`start`,e)}}),t.endBinding&&this.scene.mutateElement(t,{endBinding:{...t.endBinding,...Qr(t,e.get(t.endBinding.elementId),`end`,e)}})}),this.setState({suggestedBinding:null})}if(e.altKey||this.flowChartNavigator.isExploring&&(this.flowChartNavigator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})),!e[N.CTRL_OR_CMD]&&this.flowChartCreator.isCreatingChart){this.flowChartCreator.pendingNodes?.length&&this.scene.insertElements(this.flowChartCreator.pendingNodes);let e=this.flowChartCreator.pendingNodes?.[0];e&&(this.setState(t=>({selectedElementIds:P({[e.id]:!0},t)})),ms([e],this.canvas.width/window.devicePixelRatio,this.canvas.height/window.devicePixelRatio,{offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,zoom:this.state.zoom},this.scene.getNonDeletedElementsMap(),this.getEditorUIOffsets())||this.scrollToContent(e,{animate:!0,duration:300,canvasOffsets:this.getEditorUIOffsets()})),this.flowChartCreator.clear(),this.syncActionResult({captureUpdate:V.IMMEDIATELY})}})),i(this,`isToolSupported`,e=>this.props.UIOptions.tools?.[e]!==!1),i(this,`setActiveTool`,(e,t=!1)=>{if(!this.isToolSupported(e.type)){console.warn(`"${e.type}" tool is disabled via "UIOptions.canvasActions.tools.${e.type}"`);return}let n=ka(this.state,e);n.type===`hand`?Gw(this.interactiveCanvas,Kn.GRAB):mz||Yw(this.interactiveCanvas,{...this.state,activeTool:n}),Rt(document.activeElement)&&this.focusContainer(),me(n.type)||this.setState({suggestedBinding:null}),n.type===`image`&&this.onImageToolbarButtonClick(),this.setState(e=>{let r={snapLines:e.snapLines.length?[]:e.snapLines,originSnapOffset:null,activeEmbeddable:null,selectedLinearElement:Vr(n.type)?e.selectedLinearElement:null};return n.type===`freedraw`&&this.store.scheduleCapture(),n.type===`lasso`?{...e,...r,activeTool:n,...t?{}:{selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}}:n.type===`selection`?{...e,...r,activeTool:n}:{...e,...r,activeTool:n,selectedElementIds:P({},e),selectedGroupIds:P({},e),editingGroupId:null,multiElement:null}})}),i(this,`setOpenDialog`,e=>{this.setState({openDialog:e})}),i(this,`setCursor`,e=>{Gw(this.interactiveCanvas,e)}),i(this,`resetCursor`,()=>{Ww(this.interactiveCanvas)}),i(this,`isTouchScreenMultiTouchGesture`,()=>Tz.pointers.size>=2),i(this,`getName`,()=>this.state.name||this.props.name||`${K(`labels.untitled`)}-${Fn()}`),i(this,`onGestureStart`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null}),Tz.initialScale=this.state.zoom.value})),i(this,`onGestureChange`,qj(e=>{if(e.preventDefault(),this.isTouchScreenMultiTouchGesture())return;let t=Tz.initialScale;t&&this.setState(n=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(t*e.scale)},n)}))})),i(this,`onGestureEnd`,qj(e=>{e.preventDefault(),this.isTouchScreenMultiTouchGesture()&&this.setState({previousSelectedElementIds:{},selectedElementIds:P(this.state.previousSelectedElementIds,this.state)}),Tz.initialScale=null})),i(this,`startTextEditing`,({sceneX:e,sceneY:t,insertAtParentCenter:n=!0,container:r,autoEdit:i=!0})=>{let a=!1,o=n&&this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r);r&&o&&(ut(r,this.scene.getNonDeletedElementsMap())||(a=!0));let s=null,c=this.scene.getSelectedElements(this.state);s=c.length===1?M(c[0])?c[0]:r?ut(c[0],this.scene.getNonDeletedElementsMap()):this.getTextElementAtPosition(e,t):this.getTextElementAtPosition(e,t);let l=s?.fontFamily||this.state.currentItemFontFamily,d=s?.lineHeight||ba(l),f=this.state.currentItemFontSize;if(!s&&a&&r&&!jt(r)){let n=Xs(u({fontSize:f,fontFamily:l}),d),i=Yn(f,d),a=Math.max(r.height,i),s=Math.max(r.width,n);this.scene.mutateElement(r,{height:a,width:s}),e=r.x+s/2,t=r.y+a/2,o&&=this.getTextWysiwygSnappedToCenterPosition(e,t,this.state,r)}let p=this.getTopLayerFrameAtSceneCoords({x:e,y:t}),m=s||Li({x:o?o.elementCenterX:e,y:o?o.elementCenterY:t,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:``,fontSize:f,fontFamily:l,textAlign:o?`center`:this.state.currentItemTextAlign,verticalAlign:o?Lr.MIDDLE:`top`,containerId:a?r?.id:void 0,groupIds:r?.groupIds??[],lineHeight:d,angle:r?jt(r)?0:r.angle:0,frameId:p?p.id:null});if(!s&&a&&r&&this.scene.mutateElement(r,{boundElements:(r.boundElements||[]).concat({type:`text`,id:m.id})}),this.setState({editingTextElement:m}),!s)if(r&&a){let e=this.scene.getElementIndex(r.id);this.scene.insertElementAtIndex(m,e+1)}else this.scene.insertElement(m);i||s||r?this.handleTextWysiwyg(m,{isExistingElement:!!s}):this.setState({newElement:m,multiElement:null})}),i(this,`startImageCropping`,e=>{this.store.scheduleCapture(),this.setState({croppingElementId:e.id})}),i(this,`finishImageCropping`,()=>{this.state.croppingElementId&&(this.store.scheduleCapture(),this.setState({croppingElementId:null}))}),i(this,`handleCanvasDoubleClick`,e=>{if(this.state.multiElement||this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let t=this.scene.getSelectedElements(this.state),{x:n,y:r}=la(e,this.state);if(t.length===1&&b(t[0])){let i=t[0];if((e[N.CTRL_OR_CMD]&&Ti(i)||ca(i))&&(!this.state.selectedLinearElement?.isEditing||this.state.selectedLinearElement.elementId!==i.id)){this.actionManager.executeAction(XA);return}else if(this.state.selectedLinearElement&&dr(t[0])){let e=I.getSegmentMidpointHitCoords(this.state.selectedLinearElement,{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),i=e?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,e,this.scene.getNonDeletedElementsMap()):-1;if(i&&i>-1){this.store.scheduleCapture(),I.deleteFixedSegment(t[0],this.scene,i);let a=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:n,y:r},this.state,this.scene.getNonDeletedElementsMap()),o=a?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,a,this.scene.getNonDeletedElementsMap()):null;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,segmentMidpoint:{index:o,value:e,added:!1}},segmentMidPointHoveredCoords:a}});return}}else if(this.state.selectedLinearElement?.isEditing&&this.state.selectedLinearElement.elementId===i.id&&ca(i))return}if(t.length===1&&io(t[0])){this.startImageCropping(t[0]);return}if(Ww(this.interactiveCanvas),po(this.state).length>0){let e=this.getElementAtPosition(n,r),t=e&&we(e,this.state.selectedGroupIds);if(t){this.store.scheduleCapture(),this.setState(n=>({...n,...Hr({editingGroupId:t,selectedElementIds:{[e.id]:!0}},this.scene.getNonDeletedElements(),n,this)}));return}}if(Ww(this.interactiveCanvas),!e[N.CTRL_OR_CMD]&&!this.state.viewModeEnabled){let t=this.getElementAtPosition(n,r);if(Rs(t)){this.setState({activeEmbeddable:{element:t,state:`active`}});return}if(!this.state.selectedLinearElement?.isEditing){let t=this.getTextBindableContainerAtPosition(n,r);if(t&&(xr(t)||!Po(t.backgroundColor)||Ui({point:O(n,r),element:t,elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(t)}))){let e=nn(t,this.state,this.scene.getNonDeletedElementsMap());n=e.x,r=e.y}this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:t})}}}),i(this,`getElementLinkAtPosition`,(e,t)=>{if(t&&t.locked)return;let n=this.scene.getNonDeletedElements(),r=-1;for(let i=n.length-1;i>=0;i--){let a=n[i];if(t&&a.id===t.id&&(r=i),a.link&&i>=r&&pn(a,this.scene.getNonDeletedElementsMap(),this.state,O(e.x,e.y),this.editorInterface.formFactor===`phone`))return a}}),i(this,`handleElementLinkClick`,e=>{let t=Se(O(this.lastPointerDownEvent.clientX,this.lastPointerDownEvent.clientY),O(this.lastPointerUpEvent.clientX,this.lastPointerUpEvent.clientY));if(!this.hitLinkElement||t>10)return;let n=la(this.lastPointerDownEvent,this.state),r=this.scene.getNonDeletedElementsMap(),i=pn(this.hitLinkElement,r,this.state,O(n.x,n.y),this.editorInterface.formFactor===`phone`),a=la(this.lastPointerUpEvent,this.state),o=pn(this.hitLinkElement,r,this.state,O(a.x,a.y),this.editorInterface.formFactor===`phone`);if(i&&o){qE();let t=this.hitLinkElement.link;if(t){t=Hs(t);let n;if(this.props.onLinkOpen&&(n=Fi(F.EXCALIDRAW_LINK,e.nativeEvent),this.props.onLinkOpen({...this.hitLinkElement,link:t},n)),!n?.defaultPrevented){let e=p(t)?`_self`:`_blank`,n=window.open(void 0,e);n&&(n.opener=null,n.location=t)}}}}),i(this,`getTopLayerFrameAtSceneCoords`,e=>{let t=this.scene.getNonDeletedElementsMap(),n=this.scene.getNonDeletedFramesLikes().filter(n=>!n.locked&&ns(e,n,t));return n.length?n[n.length-1]:null}),i(this,`handleCanvasPointerMove`,e=>{this.savePointer(e.clientX,e.clientY,this.state.cursorButton),this.lastPointerMoveEvent=e.nativeEvent;let t=la(e,this.state),{x:n,y:r}=t;this.lastPointerMoveCoords={x:n,y:r},Tz.pointers.has(e.pointerId)&&Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY});let i=Tz.initialScale;if(Tz.pointers.size===2&&Tz.lastCenter&&i&&Tz.initialDistance){let e=mj(Tz.pointers),t=e.x-Tz.lastCenter.x,n=e.y-Tz.lastCenter.y;Tz.lastCenter=e;let r=hj(Array.from(Tz.pointers.values())),a=this.state.activeTool.type===`freedraw`&&this.state.penMode?1:r/Tz.initialDistance,o=a?_i(i*a):this.state.zoom.value;this.setState(r=>{let i=Xw({viewportX:e.x,viewportY:e.y,nextZoom:o},r);return this.translateCanvas({zoom:i.zoom,scrollX:i.scrollX+t/o*2,scrollY:i.scrollY+n/o*2,shouldCacheIgnoreZoom:!0}),null}),this.resetShouldCacheIgnoreZoomDebounced()}else Tz.lastCenter=Tz.initialDistance=Tz.initialScale=null;if(mz||hz||gz||Fs(this.state))return;let a=nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop).isOverEither;if(!this.state.newElement&&!this.state.selectionElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.multiElement&&(a?Ww(this.interactiveCanvas):Yw(this.interactiveCanvas,this.state)),!this.state.newElement&&Bj(this.state.activeTool.type)){let{originOffset:t,snapLines:i}=zj(this.scene.getNonDeletedElements(),this,{x:n,y:r},e,this.scene.getNonDeletedElementsMap());this.setState(e=>{let n=tr(e.snapLines,i),r=e.originSnapOffset?tr(e.originSnapOffset,t):t;return e.snapLines===n&&e.originSnapOffset===r?null:{snapLines:n,originSnapOffset:r}})}else !this.state.newElement&&!this.state.selectedElementsAreBeingDragged&&!this.state.selectionElement&&this.setState(e=>e.snapLines.length?{snapLines:[]}:null);if(this.state.selectedLinearElement?.isEditing&&!this.state.selectedLinearElement.isDragging){let t=this.state.newElement?null:I.handlePointerMoveInEditMode(e,n,r,this);t&&t!==this.state.selectedLinearElement&&(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:t})})}if(Et(this.state.activeTool.type)){let{newElement:e}=this.state;if(!e&&xs(this.state)){let e=O(n,r),t=this.scene.getNonDeletedElementsMap(),i=go(e,this.scene.getNonDeletedElements(),t,ii(this.state.zoom));i?this.setState({suggestedBinding:{element:i,midPoint:T(e,i,t,this.state.zoom)}}):this.state.suggestedBinding&&this.setState({suggestedBinding:null})}}if(this.state.multiElement&&this.state.selectedLinearElement){let{multiElement:t,selectedLinearElement:i}=this.state,{x:a,y:o,points:s}=t,c=s[s.length-1],{lastCommittedPoint:l}=i;if(Yw(this.interactiveCanvas,this.state),c===l)jt(this.state.newElement)&&xs(this.state)&&go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom))?(this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n,y:r}}),this.setState({suggestedBinding:null,startBoundElement:null}),this.state.activeTool.locked||(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e),selectedLinearElement:new I(t,this.scene.getNonDeletedElementsMap())})))):Se(O(n-a,r-o),c)>=8?(this.scene.mutateElement(t,{points:[...s,O(n-a,r-o)]},{informMutation:!1,isDragging:!1}),gt(this.state.selectedLinearElement?.initialState,`initialState must be set`),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:s[s.length-1],selectedPointsIndices:[t.points.length-1],initialState:{...this.state.selectedLinearElement.initialState,lastClickedPoint:t.points.length-1}}})):Gw(this.interactiveCanvas,Kn.POINTER);else if(s.length>2&&l&&Se(O(n-a,r-o),l)<8)Gw(this.interactiveCanvas,Kn.POINTER),this.scene.mutateElement(t,{points:s.slice(0,-1)},{informMutation:!1,isDragging:!1}),this.setState({selectedLinearElement:{...i,selectedPointsIndices:i.selectedPointsIndices?.includes(t.points.length)?[...i.selectedPointsIndices.filter(e=>e!==t.points.length&&e!==t.points.length-1),t.points.length-1]:i.selectedPointsIndices,lastCommittedPoint:t.points[t.points.length-1],initialState:{...i.initialState,lastClickedPoint:t.points.length-1}}});else{ra(s,this.state.zoom.value)&&Gw(this.interactiveCanvas,Kn.POINTER);let i=this.scene.getNonDeletedElementsMap();if(Ti(t)){let e=go(O(n,r),this.scene.getNonDeletedElements(),i);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(t,e)}gt(this.state.selectedLinearElement,`Expected selectedLinearElement to be set to operate on a linear element`);let a=I.handlePointerMove(e.nativeEvent,this,n,r,this.state.selectedLinearElement);a&&this.setState(a)}return}if(this.state.activeTool.type===`arrow`){let e=go(O(n,r),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap(),ii(this.state.zoom)),t=O(n,r),i=this.scene.getNonDeletedElementsMap();e&&!fs(t,e,i)&&this.setState({suggestedBinding:{element:e,midPoint:T(t,e,i,this.state.zoom)}})}let o=!!e.buttons,s=this.state.activeTool.type===`laser`;if(o||!s&&this.state.activeTool.type!==`selection`&&this.state.activeTool.type!==`lasso`&&this.state.activeTool.type!==`text`&&this.state.activeTool.type!==`eraser`)return;let c=this.scene.getNonDeletedElements(),l=this.scene.getSelectedElements(this.state);if(l.length===1&&!a&&!this.state.selectedLinearElement?.isEditing){if(this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r),(!this.state.selectedLinearElement||this.state.selectedLinearElement.hoverPointIndex===-1)&&this.state.openDialog?.name!==`elementLinkSelector`&&!(l.length===1&&dr(l[0]))&&!(b(l[0])&&(this.editorInterface.userAgent.isMobileDevice||l[0].points.length===2))){let t=vs(c,this.state,n,r,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);if(t&&t.transformHandleType){Gw(this.interactiveCanvas,vo(t));return}}}else if(l.length>1&&!a&&this.state.openDialog?.name!==`elementLinkSelector`){let t=Qs(Ii(l),n,r,this.state.zoom,e.pointerType,this.editorInterface);if(t){Gw(this.interactiveCanvas,vo({transformHandleType:t}));return}}if(zr(this.state))return;let u=this.getElementAtPosition(n,r,{preferSelected:!0,includeLockedElements:!0}),d=null;if(d=u&&u.locked?null:u,this.handleIframeLikeElementHover({hitElement:d,scenePointer:t,moveEvent:e})||(this.hitLinkElement=this.getElementLinkAtPosition(t,u)),this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id])Gw(this.interactiveCanvas,Kn.POINTER),GE(this.hitLinkElement,this.state,this.scene.getNonDeletedElementsMap());else{if(qE(),s)return;d&&(d.link||rs(d))&&this.state.selectedElementIds[d.id]&&!this.state.contextMenu&&!this.state.showHyperlinkPopup?this.setState({showHyperlinkPopup:`info`}):this.state.activeTool.type===`text`?Gw(this.interactiveCanvas,M(d)?Kn.TEXT:Kn.CROSSHAIR):this.state.viewModeEnabled?Gw(this.interactiveCanvas,Kn.GRAB):this.state.openDialog?.name===`elementLinkSelector`||a||e[N.CTRL_OR_CMD]?Gw(this.interactiveCanvas,Kn.AUTO):(d||this.isHittingCommonBoundingBoxOfSelectedElements(t,l))&&!d?.locked&&(!d||!dr(d)||!(d.startBinding||d.endBinding))&&(this.state.activeTool.type!==`lasso`||l.length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement&&this.handleHoverSelectedLinearElement(this.state.selectedLinearElement,n,r)}this.state.openDialog?.name===`elementLinkSelector`&&d?this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[d.id]:!0}},this.scene.getNonDeletedElements(),e,this).selectedElementIds)})):this.state.openDialog?.name===`elementLinkSelector`&&!d&&this.setState(e=>({hoveredElementIds:tr(e.hoveredElementIds,{})}))}),i(this,`handleEraser`,(e,t)=>{let n=this.eraserTrail.addPointToPath(t.x,t.y,e.altKey);this.elementsPendingErasure=new Set(n),this.triggerRender()}),i(this,`handleTouchMove`,e=>{yz=!0}),i(this,`handleCanvasPointerDown`,e=>{if(!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let{x:t,y:n}=la(e,this.state);this.lastPointerMoveCoords={x:t,y:n};let r=e.target;if(r.setPointerCapture&&r.setPointerCapture(e.pointerId),this.maybeCleanupAfterMissingPointerUp(e.nativeEvent),this.maybeUnfollowRemoteUser(),this.state.searchMatches&&(this.setState(e=>({searchMatches:e.searchMatches&&{focusedId:null,matches:e.searchMatches.matches.map(e=>({...e,focus:!1}))}})),this.updateEditorAtom(BP,null)),Cy.get(sD)&&this.updateEditorAtom(sD,null),this.state.contextMenu&&this.setState({contextMenu:null}),this.state.snapLines&&this.setAppState({snapLines:[]}),this.state.openPopup&&this.setState({openPopup:null}),this.updateGestureOnPointerDown(e),e.pointerType===`touch`&&this.state.newElement&&this.state.newElement.type===`freedraw`){let e=this.state.newElement;this.updateScene({...e.points.length<10?{elements:this.scene.getElementsIncludingDeleted().filter(t=>t.id!==e.id)}:{},appState:{newElement:null,editingTextElement:null,startBoundElement:null,suggestedBinding:null,selectedElementIds:P(Object.keys(this.state.selectedElementIds).filter(t=>t!==e.id).reduce((e,t)=>(e[t]=this.state.selectedElementIds[t],e),{}),this.state)},captureUpdate:this.state.openDialog?.name===`elementLinkSelector`?V.EVENTUALLY:V.NEVER});return}let i=document.getSelection();if(i?.anchorNode&&i.removeAllRanges(),this.maybeOpenContextMenuAfterPointerDownOnTouchDevices(e),!this.state.penDetected&&e.pointerType===`pen`&&this.setState(e=>({penMode:!0,penDetected:!0})),!this.editorInterface.isTouchScreen&&[`pen`,`touch`].includes(e.pointerType)&&(this.editorInterface=Jr(this.editorInterface,{isTouchScreen:!0})),hz||(this.lastPointerDownEvent=e,this.handleCanvasPanUsingWheelOrSpaceDrag(e)))return;if(this.setState({lastPointerDownWith:e.pointerType,cursorButton:`down`}),this.savePointer(e.clientX,e.clientY,`down`),e.button===dn.ERASER&&this.state.activeTool.type!==va.eraser){this.setState({activeTool:ka(this.state,{type:va.eraser,lastActiveToolBeforeEraser:this.state.activeTool})},()=>{this.handleCanvasPointerDown(e);let t=()=>{n(),r?.(),zr(this.state)&&this.setState({activeTool:ka(this.state,{...this.state.activeTool.lastActiveTool||{type:va.selection},lastActiveToolBeforeEraser:null})})},n=w(window,F.POINTER_UP,t,{once:!0}),r;requestAnimationFrame(()=>{r=this.missingPointerEventCleanupEmitter.once(t)})});return}if(e.button!==dn.MAIN&&e.button!==dn.TOUCH&&e.button!==dn.ERASER||Tz.pointers.size>1)return;let a=this.initialPointerDownState(e);if(this.setState({selectedElementsAreBeingDragged:!1}),this.handleDraggingScrollBar(e,a)||(this.clearSelectionIfNotUsingSelection(),this.handleSelectionOnPointerDown(e,a))||!(!this.state.penMode||e.pointerType!==`touch`||this.state.activeTool.type===`selection`||this.state.activeTool.type===`lasso`||this.state.activeTool.type===`text`||this.state.activeTool.type===`image`))return;if(this.state.activeTool.type===`lasso`){let t=a.hit.element&&this.isASelectedElement(a.hit.element);!a.hit.hasHitCommonBoundingBoxOfSelectedElements&&!a.resize.handleType&&!t&&(this.lassoTrail.startPath(a.origin.x,a.origin.y,e.shiftKey),a.drag.blockDragging=this.editorInterface.formFactor===`desktop`),this.editorInterface.formFactor!==`desktop`&&a.hit.element&&!t&&(this.setState(e=>{let t={...e.selectedElementIds,[a.hit.element.id]:!0},n=[];Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)});let r=a.hit.element;if(L(r))Di(n,r.id).forEach(e=>{delete t[e.id]});else if(r.frameId)t[r.frameId]&&delete t[r.id];else{let e=r.groupIds,i=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));i.size>0&&n.forEach(e=>{e.frameId&&i.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:r.link||rs(r)?`info`:!1}}),a.hit.wasAddedToSelection=!0)}else this.state.activeTool.type===`text`?this.handleTextOnPointerDown(e,a):this.state.activeTool.type===`arrow`||this.state.activeTool.type===`line`?this.handleLinearElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`freedraw`?this.handleFreeDrawElementOnPointerDown(e,this.state.activeTool.type,a):this.state.activeTool.type===`custom`?Yw(this.interactiveCanvas,this.state):this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe?this.createFrameElementOnPointerDown(a,this.state.activeTool.type):this.state.activeTool.type===`laser`?this.laserTrails.startPath(a.lastCoords.x,a.lastCoords.y):this.state.activeTool.type!==`eraser`&&this.state.activeTool.type!==`hand`&&this.state.activeTool.type!==`image`&&this.createGenericElementOnPointerDown(this.state.activeTool.type,a);this.props?.onPointerDown?.(this.state.activeTool,a),this.onPointerDownEmitter.trigger(this.state.activeTool,a,e),this.state.activeTool.type===`eraser`&&this.eraserTrail.startPath(a.lastCoords.x,a.lastCoords.y);let o=this.onPointerMoveFromPointerDownHandler(a),s=this.onPointerUpFromPointerDownHandler(a),c=this.onKeyDownFromPointerDownHandler(a),l=this.onKeyUpFromPointerDownHandler(a);this.missingPointerEventCleanupEmitter.once(t=>s(t||e.nativeEvent)),(!this.state.viewModeEnabled||this.state.activeTool.type===`laser`)&&(window.addEventListener(F.POINTER_MOVE,o),window.addEventListener(F.POINTER_UP,s),window.addEventListener(F.KEYDOWN,c),window.addEventListener(F.KEYUP,l),a.eventListeners.onMove=o,a.eventListeners.onUp=s,a.eventListeners.onKeyUp=l,a.eventListeners.onKeyDown=c)}),i(this,`handleCanvasPointerUp`,e=>{if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.removePointer(e),this.lastPointerUpEvent=e,!e.ctrlKey){let e=this.state.bindingPreference===`enabled`;this.state.isBindingEnabled!==e&&this.setState({isBindingEnabled:e})}let t=la({clientX:e.clientX,clientY:e.clientY},this.state),{x:n,y:r}=t;if(this.lastPointerMoveCoords={x:n,y:r},!this.handleIframeLikeCenterClick()){if(this.editorInterface.isTouchScreen){let e=this.getElementAtPosition(t.x,t.y,{includeLockedElements:!0});this.hitLinkElement=this.getElementLinkAtPosition(t,e)}this.hitLinkElement&&!this.state.selectedElementIds[this.hitLinkElement.id]?this.handleElementLinkClick(e):this.state.viewModeEnabled&&this.setState({activeEmbeddable:null,selectedElementIds:{}})}}),i(this,`maybeOpenContextMenuAfterPointerDownOnTouchDevices`,e=>{e.pointerType===`touch`&&(yz=!1,vz?yz=!0:vz=window.setTimeout(()=>{vz=0,yz||this.handleCanvasContextMenu(e)},500))}),i(this,`resetContextMenuTimer`,()=>{clearTimeout(vz),vz=0,yz=!1}),i(this,`maybeCleanupAfterMissingPointerUp`,e=>{wz?.(),this.missingPointerEventCleanupEmitter.trigger(e).clear()}),i(this,`handleCanvasPanUsingWheelOrSpaceDrag`,e=>{if(!(Tz.pointers.size<=1&&(e.button===dn.WHEEL||e.button===dn.MAIN&&mz||Fs(this.state)||this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`)))return!1;hz=!0,this.focusContainer(),this.state.editingTextElement||e.preventDefault();let t=!1,n=/Linux/.test(window.navigator.platform);Gw(this.interactiveCanvas,Kn.GRABBING);let{clientX:r,clientY:i}=e,a=Jj(e=>{let a=r-e.clientX,o=i-e.clientY;if(r=e.clientX,i=e.clientY,n&&!t&&(Math.abs(a)>1||Math.abs(o)>1)){t=!0;let e=t=>{document.body.removeEventListener(F.PASTE,e),t.stopPropagation()},n=()=>{setTimeout(()=>{document.body.removeEventListener(F.PASTE,e),window.removeEventListener(F.POINTER_UP,n)},100)};document.body.addEventListener(F.PASTE,e),window.addEventListener(F.POINTER_UP,n)}this.translateCanvas({scrollX:this.state.scrollX-a/this.state.zoom.value,scrollY:this.state.scrollY-o/this.state.zoom.value})}),o=qj(wz=()=>{wz=null,hz=!1,mz||(this.state.viewModeEnabled&&this.state.activeTool.type!==`laser`?Gw(this.interactiveCanvas,Kn.GRAB):Yw(this.interactiveCanvas,this.state)),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,a),window.removeEventListener(F.POINTER_UP,o),window.removeEventListener(F.BLUR,o),a.flush()});return window.addEventListener(F.BLUR,o),window.addEventListener(F.POINTER_MOVE,a,{passive:!0}),window.addEventListener(F.POINTER_UP,o),!0}),i(this,`clearSelectionIfNotUsingSelection`,()=>{Vr(this.state.activeTool.type)||this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}),i(this,`handleSelectionOnPointerDown`,(e,t)=>{if(Vr(this.state.activeTool.type)){let n=this.scene.getNonDeletedElements(),r=this.scene.getNonDeletedElementsMap(),i=this.scene.getSelectedElements(this.state);if(i.length===1&&!this.state.selectedLinearElement?.isEditing&&!dr(i[0])&&!(b(i[0])&&(this.editorInterface.userAgent.isMobileDevice||i[0].points.length===2))&&!(this.state.selectedLinearElement&&this.state.selectedLinearElement.hoverPointIndex!==-1)){let r=vs(n,this.state,t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.scene.getNonDeletedElementsMap(),this.editorInterface);r!=null&&(r.transformHandleType===`rotation`?(this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType):(this.state.croppingElementId||this.setState({resizingElement:r.element}),t.resize.handleType=r.transformHandleType))}else i.length>1&&(t.resize.handleType=Qs(Ii(i),t.origin.x,t.origin.y,this.state.zoom,e.pointerType,this.editorInterface));if(t.resize.handleType)t.resize.isResizing=!0,t.resize.offset=pt(ls(t.resize.handleType,i,r,t.origin.x,t.origin.y)),i.length===1&&b(i[0])&&i[0].points.length===2&&(t.resize.arrowDirection=ai(t.resize.handleType,i[0]));else{if(this.state.selectedLinearElement){let n=this.state.selectedLinearElement,r=I.handlePointerDown(e,this,this.store,t.origin,n,this.scene);if(r.hitElement&&(t.hit.element=r.hitElement),r.linearElementEditor&&this.setState({selectedLinearElement:r.linearElementEditor}),r.didAddPoint)return!0;let i=this.scene.getNonDeletedElementsMap(),a=I.getElement(n.elementId,i);if(a&&ss(a)){let{hitFocusPoint:e,pointerOffset:r}=Uo(a,t,i,this.state);if(e)return this.setState({selectedLinearElement:{...n,hoveredFocusPointBinding:e,draggedFocusPointBinding:e,pointerOffset:r}}),!1}}let n=this.getElementsAtPosition(t.origin.x,t.origin.y,{includeLockedElements:!0}),r=n.filter(e=>!e.locked),i=this.getElementAtPosition(t.origin.x,t.origin.y,{allHitElements:n});if((!i||i.id!==this.state.activeLockedId)&&this.setState({activeLockedId:null}),i&&i.locked&&!r.some(e=>this.state.selectedElementIds[e.id])?t.hit.element=null:t.hit.element=t.hit.element??this.getElementAtPosition(t.origin.x,t.origin.y),this.hitLinkElement=this.getElementLinkAtPosition(t.origin,i),this.hitLinkElement)return!0;if(this.state.croppingElementId&&t.hit.element?.id!==this.state.croppingElementId&&this.finishImageCropping(),t.hit.element&&this.getElementLinkAtPosition({x:t.origin.x,y:t.origin.y},t.hit.element))return!1;t.hit.allHitElements=r;let a=t.hit.element,o=t.hit.allHitElements.some(e=>this.isASelectedElement(e));if((a===null||!o)&&!e.shiftKey&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(!this.state.selectedLinearElement?.isEditing||a&&a?.id!==this.state.selectedLinearElement?.elementId)&&this.clearSelection(a),this.state.selectedLinearElement?.isEditing)this.setState(e=>({selectedLinearElement:e.selectedLinearElement?{...e.selectedLinearElement,isEditing:!!a&&a.id===this.state.selectedLinearElement?.elementId}:null,selectedElementIds:e.selectedLinearElement?P({[e.selectedLinearElement.elementId]:!0},this.state):P({},e)}));else if(a!=null){if(e[N.CTRL_OR_CMD])return e.altKey?(this.state.openDialog?.name===`elementLinkSelector`&&this.setOpenDialog(null),this.lassoTrail.startPath(t.origin.x,t.origin.y,e.shiftKey),this.setActiveTool({type:`lasso`,fromSelection:!0}),!1):(this.state.selectedElementIds[a.id]||(t.hit.wasAddedToSelection=!0),this.setState(e=>({...Ut(e,a),previousSelectedElementIds:this.state.selectedElementIds})),!1);this.state.selectedElementIds[a.id]||(this.state.editingGroupId&&!Lo(a,this.state.editingGroupId)&&this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),!o&&!t.hit.hasHitCommonBoundingBoxOfSelectedElements&&(this.setState(e=>{let t={...e.selectedElementIds,[a.id]:!0},n=[];if(Object.keys(e.selectedElementIds).forEach(e=>{let t=this.scene.getElement(e);t&&n.push(t)}),L(a))Di(n,a.id).forEach(e=>{delete t[e.id]});else if(a.frameId)t[a.frameId]&&delete t[a.id];else{let e=a.groupIds,r=new Set(e.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).filter(e=>L(e)).map(e=>e.id));r.size>0&&n.forEach(e=>{e.frameId&&r.has(e.frameId)&&(delete t[e.id],e.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}))})}return e.openDialog?.name===`elementLinkSelector`&&(a.groupIds.some(t=>e.selectedGroupIds[t])||(t={[a.id]:!0})),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:a.link||rs(a)?`info`:!1}}),t.hit.wasAddedToSelection=!0))}this.setState({previousSelectedElementIds:this.state.selectedElementIds})}}return!1}),i(this,`handleTextOnPointerDown`,(e,t)=>{if(this.state.editingTextElement)return;let n=t.origin.x,r=t.origin.y,i=this.getElementAtPosition(n,r,{includeBoundTextElement:!0}),a=this.getTextBindableContainerAtPosition(n,r);xr(i)&&(a=i,n=i.x+i.width/2,r=i.y+i.height/2),this.startTextEditing({sceneX:n,sceneY:r,insertAtParentCenter:!e.altKey,container:a,autoEdit:!1}),Ww(this.interactiveCanvas),this.state.activeTool.locked||this.setState({activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})}),i(this,`handleFreeDrawElementOnPointerDown`,(e,t,n)=>{let[r,i]=It(n.origin.x,n.origin.y,null),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),o=e.pressure===.5,s=St({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:null,simulatePressure:o,locked:!1,frameId:a?a.id:null,points:[O(0,0)],pressures:o?[]:[e.pressure]});this.scene.insertElement(s),this.setState(e=>{let t={...e.selectedElementIds};return delete t[s.id],{selectedElementIds:P(t,e)}});let c=go(O(n.origin.x,n.origin.y),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());this.setState({newElement:s,startBoundElement:c,suggestedBinding:null})}),i(this,`insertIframeElement`,({sceneX:e,sceneY:t,width:n,height:r})=>{let[i,a]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=jr({type:`iframe`,x:i,y:a,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`iframe`),opacity:this.state.currentItemOpacity,locked:!1,width:n,height:r});return this.scene.insertElement(o),o}),i(this,`insertEmbeddableElement`,({sceneX:e,sceneY:t,link:n})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=qs(n);if(!a)return;a.error instanceof URIError&&this.setToast({message:K(`toast.unrecognizedLinkFormat`),closable:!0});let o=ga({type:`embeddable`,x:r,y:i,strokeColor:`transparent`,backgroundColor:`transparent`,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:this.getCurrentItemRoundness(`embeddable`),opacity:this.state.currentItemOpacity,locked:!1,width:a.intrinsicSize.w,height:a.intrinsicSize.h,link:n});return this.scene.insertElement(o),o}),i(this,`newImagePlaceholder`,({sceneX:e,sceneY:t,addToFrameUnderCursor:n=!0})=>{let[r,i]=It(e,t,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=n?this.getTopLayerFrameAtSceneCoords({x:r,y:i}):null,o=100/this.state.zoom.value;return gi({type:`image`,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,roundness:null,opacity:this.state.currentItemOpacity,locked:!1,frameId:a?a.id:null,x:r-o/2,y:i-o/2,width:o,height:o})}),i(this,`handleLinearElementOnPointerDown`,(e,t,n)=>{if(e.ctrlKey&&(0,_c.flushSync)(()=>{this.setState({isBindingEnabled:this.state.bindingPreference!==`enabled`})}),this.state.multiElement){let{multiElement:t,selectedLinearElement:r}=this.state;if(gt(r,`selectedLinearElement is expected to be set`),t.type===`line`&&ra(t.points,this.state.zoom.value)){(0,_c.flushSync)(()=>{this.setState({selectedLinearElement:{...r,lastCommittedPoint:t.points[t.points.length-1],initialState:{...r.initialState,lastClickedPoint:-1}}})}),this.actionManager.executeAction(oT);return}if(dr(t)&&t.points.length>1){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}let{x:i,y:a}=t,{lastCommittedPoint:o}=r,s=xs(this.state)&&go(O(this.lastPointerMoveCoords?.x??i+t.points[t.points.length-1][0],this.lastPointerMoveCoords?.y??a+t.points[t.points.length-1][1]),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(ss(t)&&s||t.points.length>1&&o&&Se(O(n.origin.x-i,n.origin.y-a),o)<8){this.actionManager.executeAction(oT,`ui`,{event:e.nativeEvent,sceneCoords:{x:n.origin.x,y:n.origin.y}});return}this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t.id]:!0},e)})),Gw(this.interactiveCanvas,Kn.POINTER)}else{let[r,i]=It(n.origin.x,n.origin.y,e[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),a=this.getTopLayerFrameAtSceneCoords({x:r,y:i}),{currentItemStartArrowhead:o,currentItemEndArrowhead:s}=this.state,[c,l]=t===`arrow`?[o,s]:[null,null],u=t===`arrow`?or({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemArrowType===ts.round?{type:Xa.PROPORTIONAL_RADIUS}:null,startArrowhead:c,endArrowhead:l,locked:!1,frameId:a?a.id:null,elbowed:this.state.currentItemArrowType===ts.elbow,fixedSegments:this.state.currentItemArrowType===ts.elbow?[]:null}):Tn({type:t,x:r,y:i,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.state.currentItemRoundness===`round`?{type:Xa.PROPORTIONAL_RADIUS}:null,locked:!1,frameId:a?a.id:null}),d=O(n.origin.x,n.origin.y),f=this.scene.getNonDeletedElementsMap(),p=xs(this.state)?go(d,this.scene.getNonDeletedElements(),f):null;this.scene.mutateElement(u,{points:[O(0,0),O(0,0)]}),this.scene.insertElement(u),ss(u)&&Ur(u,new Map([[0,{point:O(0,0),isDragging:!1}]]),d[0],d[1],this.scene,this.state,{newArrow:!0,altKey:e.altKey,initialBinding:!0,angleLocked:mr(e.nativeEvent)}),(0,_c.flushSync)(()=>{this.setState(t=>{let r=null,i=t.selectedElementIds;if(b(u)){r=new I(u,this.scene.getNonDeletedElementsMap());let t=u.points.length-1;r={...r,selectedPointsIndices:[t],initialState:{...r.initialState,arrowStartIsInside:e.altKey,lastClickedPoint:t,origin:O(n.origin.x,n.origin.y)}}}return i=this.state.activeTool.locked?t.selectedElementIds:P({[u.id]:!0},t),{...t,bindMode:`orbit`,newElement:u,startBoundElement:p,suggestedBinding:p&&ss(u)?{element:p,midPoint:T(d,p,f,this.state.zoom)}:null,selectedElementIds:i,selectedLinearElement:r}})}),ss(u)&&Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(u,p)}}),i(this,`createGenericElementOnPointerDown`,(e,t)=>{let[n,r]=It(t.origin.x,t.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.getTopLayerFrameAtSceneCoords({x:n,y:r}),a={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,roundness:this.getCurrentItemRoundness(e),locked:!1,frameId:i?i.id:null},o;o=e===`embeddable`?ga({type:`embeddable`,...a}):cn({type:e,...a}),o.type===`selection`?this.setState({selectionElement:o}):(this.scene.insertElement(o),this.setState({multiElement:null,newElement:o}))}),i(this,`createFrameElementOnPointerDown`,(e,t)=>{let[n,r]=It(e.origin.x,e.origin.y,this.lastPointerDownEvent?.[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i={x:n,y:r,opacity:this.state.currentItemOpacity,locked:!1,...On},a=t===va.magicframe?Pn(i):Ds(i);this.scene.insertElement(a),this.setState({multiElement:null,newElement:a})}),i(this,`restoreReadyToEraseElements`,()=>{this.elementsPendingErasure=new Set,this.triggerRender()}),i(this,`eraseElements`,()=>{let e=!1;this.elementsPendingErasure.forEach(e=>{let t=this.scene.getElement(e);if(ss(t)){if(t.startBinding){let e=this.scene.getElement(t.startBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}if(t.endBinding){let e=this.scene.getElement(t.endBinding.elementId);jn(e,this.scene.getElementsMapIncludingDeleted(),{boundElements:e.boundElements.filter(e=>e.id!==t.id)})}}else un(t)&&t.boundElements?.forEach(e=>{if(e.type===`arrow`){let n=this.scene.getElement(e.id);n?.startBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{startBinding:null}),n?.endBinding?.elementId===t.id&&jn(n,this.scene.getElementsMapIncludingDeleted(),{endBinding:null})}})});let t=this.scene.getElementsIncludingDeleted().map(t=>this.elementsPendingErasure.has(t.id)||t.frameId&&this.elementsPendingErasure.has(t.frameId)||ya(t)&&this.elementsPendingErasure.has(t.containerId)?(e=!0,B(t,{isDeleted:!0})):t);this.elementsPendingErasure=new Set,e&&(this.store.scheduleCapture(),this.scene.replaceAllElements(t))}),i(this,`initializeImage`,async(e,t)=>{if(!xo(t))throw Error(K(`errors.unsupportedFileType`));let n=t.type;if(Gw(this.interactiveCanvas,`wait`),n===hs.svg)try{t=Xi(ae(await t.text()),t.name)}catch(e){throw console.warn(e),Error(K(`errors.svgImageInsertError`))}let r=await(this.props.generateIdForFile?.(t)||xn(t));if(!r)throw console.warn("Couldn't generate file id or the supplied `generateIdForFile` didn't resolve to one."),Error(K(`errors.imageInsertError`));if(!this.files[r]?.dataURL){try{t=await Bt(t,{maxWidthOrHeight:Eo})}catch(e){console.error(`Error trying to resizing image file on insertion`,e)}if(t.size>4194304)throw Error(K(`errors.fileTooBig`,{maxSize:`${Math.trunc(br/1024/1024)}MB`}))}let i=this.files[r]?.dataURL||await ia(t);return new Promise(async(t,a)=>{try{let a=this.getLatestInitializedImageElement(e,r);if(this.addMissingFiles([{mimeType:n,id:r,dataURL:i,created:Date.now(),lastRetrieved:Date.now()}]),!this.imageCache.get(r)){this.addNewImagesToImageCache();let{erroredFiles:e}=await this.updateImageCache([a]);if(e.size)throw Error(`Image cache update resulted with an error.`)}let o=await this.imageCache.get(r)?.image;if(o&&this.state.newElement?.id!==a.id){a=this.getLatestInitializedImageElement(e,r);let t=this.getImageNaturalDimensions(a,o);Object.assign(a,t)}t(a)}catch(e){console.error(e),a(Error(K(`errors.imageInsertError`)))}})}),i(this,`getLatestInitializedImageElement`,(e,t)=>B(this.scene.getElement(e.id)??e,{fileId:t})),i(this,`onImageToolbarButtonClick`,async()=>{try{let{x:e,y:t}=la({clientX:this.state.width/2+this.state.offsetLeft,clientY:this.state.height/2+this.state.offsetTop},this.state),n=await Wo({description:`Image`,extensions:Object.keys(Da),multiple:!0});this.insertImages(n,e,t)}catch(e){e.name===`AbortError`?console.warn(e):console.error(e),this.setState({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})},()=>{this.actionManager.executeAction(oT)})}}),i(this,`getImageNaturalDimensions`,(e,t)=>{let n=Math.max(this.state.height-120,160),r=Math.min(n,Math.floor(this.state.height*.5)/this.state.zoom.value),i=Math.min(t.naturalHeight,r),a=i*(t.naturalWidth/t.naturalHeight);return{x:e.x+e.width/2-a/2,y:e.y+e.height/2-i/2,width:a,height:i,crop:null}}),i(this,`updateImageCache`,async(e,t=this.files)=>{let{updatedFiles:n,erroredFiles:r}=await at({imageCache:this.imageCache,fileIds:e.map(e=>e.fileId),files:t});return r.size&&(this.store.scheduleAction(V.NEVER),this.scene.replaceAllElements(this.scene.getElementsIncludingDeleted().map(e=>d(e)&&r.has(e.fileId)?B(e,{status:`error`}):e))),{updatedFiles:n,erroredFiles:r}}),i(this,`addNewImagesToImageCache`,async(e=qe(this.scene.getNonDeletedElements()),t=this.files)=>{let n=e.filter(e=>!e.isDeleted&&!this.imageCache.has(e.fileId));if(n.length){let{updatedFiles:e}=await this.updateImageCache(n,t);if(e.size)for(let t of n)e.has(t.fileId)&&bn.delete(t);e.size&&this.scene.triggerUpdate()}}),i(this,`scheduleImageRefresh`,(0,gc.default)(()=>{this.addNewImagesToImageCache()},500)),i(this,`handleInteractiveCanvasRef`,e=>{e===null?(this.interactiveCanvas?.removeEventListener(F.TOUCH_START,this.onTouchStart),this.interactiveCanvas?.removeEventListener(F.TOUCH_END,this.onTouchEnd)):(this.interactiveCanvas=e,this.interactiveCanvas.addEventListener(F.TOUCH_START,this.onTouchStart,{passive:!1}),this.interactiveCanvas.addEventListener(F.TOUCH_END,this.onTouchEnd))}),i(this,`insertImages`,async(e,t,n)=>{let r=50/this.state.zoom.value,i=Gr(e.map(()=>this.newImagePlaceholder({sceneX:t,sceneY:n})),t,n,r);i.forEach(e=>this.scene.insertElement(e));let a=await Promise.all(i.map(async(t,n)=>{try{return await this.initializeImage(t,await z(e[n]))}catch(e){return this.setState({errorMessage:e.message||K(`errors.imageInsertError`)}),B(t,{isDeleted:!0})}})),o=lr(a),s=Gr(a.filter(e=>!e.isDeleted),t,n,r),c=lr(s),l=this.scene.getElementsIncludingDeleted().map(e=>c.get(e.id)??o.get(e.id)??e);this.updateScene({appState:{selectedElementIds:P(Object.fromEntries(s.map(e=>[e.id,!0])),this.state)},elements:l,captureUpdate:V.IMMEDIATELY}),this.setState({},()=>{this.actionManager.executeAction(oT)})}),i(this,`handleAppOnDrop`,async e=>{let{x:t,y:n}=la(e,this.state),r=await DT(e),i=r.getFiles();if(i.length===1){let{file:e,fileHandle:t}=i[0];if(e&&(e.type===hs.png||e.type===hs.svg))try{let n=await $o(e,this.state,this.scene.getElementsIncludingDeleted(),t);this.syncActionResult({...n,appState:{...n.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY});return}catch(e){if(e.name!==`EncodingError`)throw Error(K(`alerts.couldNotLoadInvalidFile`))}}let a=i.map(e=>e.file).filter(e=>xo(e));if(a.length>0&&this.isToolSupported(`image`))return this.insertImages(a,t,n);let o=r.getData(hs.excalidrawlibIds),s=r.getData(hs.excalidrawlib);if(o||s){try{let t=null;if(o){let{itemIds:e}=JSON.parse(o);t=(await this.library.getLatestLibrary()).filter(t=>e.includes(t.id))}else s&&(t=li(s));t?.length&&(t=t.map(e=>({...e,elements:Er({type:`everything`,elements:e.elements,randomizeSeed:!0}).duplicatedElements})),this.addElementsFromPasteOrLibrary({elements:QD(t),position:e,files:null}))}catch(e){this.setState({errorMessage:e.message})}return}if(i.length>0){let{file:e,fileHandle:t}=i[0];e&&await this.loadFileToCanvas(e,t)}let c=r.findByType(hs.text);if(c){let e=c.value;if(e&&Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`)){let r=this.insertEmbeddableElement({sceneX:t,sceneY:n,link:Hs(e)});r&&(this.store.scheduleCapture(),this.setState({selectedElementIds:{[r.id]:!0}}))}}}),i(this,`loadFileToCanvas`,async(e,t)=>{e=await z(e);try{let n=this.scene.getElementsIncludingDeleted(),r;try{r=await Es(e,this.state,n,t)}catch(e){let t=e instanceof rn;if(t&&e.code===`IMAGE_NOT_CONTAINS_SCENE_DATA`&&!this.isToolSupported(`image`)){this.setState({isLoading:!1,errorMessage:K(`errors.imageToolNotSupported`)});return}let n=K(t?`alerts.cannotRestoreFromImage`:`alerts.couldNotLoadInvalidFile`);this.setState({isLoading:!1,errorMessage:n})}if(!r)return;r.type===hs.excalidraw?(ho(n.concat(r.data.elements)),this.store.scheduleMicroAction({action:V.NEVER,elements:n,appState:void 0}),this.setState({isLoading:!0}),this.syncActionResult({...r.data,appState:{...r.data.appState||this.state,isLoading:!1},replaceFiles:!0,captureUpdate:V.IMMEDIATELY})):r.type===hs.excalidrawlib&&await this.library.updateLibrary({libraryItems:e,merge:!0,openLibraryMenu:!0}).catch(e=>{console.error(e),this.setState({errorMessage:K(`errors.importLibraryError`)})})}catch(e){this.setState({isLoading:!1,errorMessage:e.message})}}),i(this,`handleCanvasContextMenu`,e=>{if(e.preventDefault(),(`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`touch`||`pointerType`in e.nativeEvent&&e.nativeEvent.pointerType===`pen`&&e.button!==dn.SECONDARY)&&this.state.activeTool.type!==this.state.preferredSelectionTool.type)return;let{x:t,y:n}=la(e,this.state),r=this.getElementAtPosition(t,n,{preferSelected:!0,includeLockedElements:!0}),i=this.scene.getSelectedElements(this.state),a=this.isHittingCommonBoundingBoxOfSelectedElements({x:t,y:n},i),o=r||a?`element`:`canvas`,{top:s,left:c}=this.excalidrawContainerRef.current.getBoundingClientRect(),l=e.clientX-c,u=e.clientY-s;dC(`contextMenu`,`openContextMenu`,o),this.setState({...r&&!this.state.selectedElementIds[r.id]?{...this.state,...Hr({editingGroupId:this.state.editingGroupId,selectedElementIds:{[r.id]:!0}},this.scene.getNonDeletedElements(),this.state,this),selectedLinearElement:b(r)?new I(r,this.scene.getNonDeletedElementsMap()):null}:this.state,showHyperlinkPopup:!1},()=>{this.setState({contextMenu:{top:u,left:l,items:this.getContextMenuItems(o)}})})}),i(this,`maybeDragNewGenericElement`,(e,t,n=!0)=>{let r=this.state.selectionElement,i=e.lastCoords;if(r&&e.boxSelection.hasOccurred&&this.state.activeTool.type!==`eraser`){gs({newElement:r,elementType:this.state.activeTool.type,originX:e.origin.x,originY:e.origin.y,x:i.x,y:i.y,width:fr(e.origin.x,i.x),height:fr(e.origin.y,i.y),shouldMaintainAspectRatio:oa(t),shouldResizeFromCenter:!1,scene:this.scene,zoom:this.state.zoom.value,informMutation:!1});return}let a=this.state.newElement;if(!a)return;let[o,s]=It(i.x,i.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=d(a)&&this.imageCache.get(a.fileId)?.image,l=c&&!(c instanceof Promise)?c.width/c.height:null;this.maybeCacheReferenceSnapPoints(t,[a]);let{snapOffset:u,snapLines:f}=Rj(a,this,t,{x:e.originInGrid.x+(this.state.originSnapOffset?.x??0),y:e.originInGrid.y+(this.state.originSnapOffset?.y??0)},{x:o-e.originInGrid.x,y:s-e.originInGrid.y},this.scene.getNonDeletedElementsMap());o+=u.x,s+=u.y,this.setState({snapLines:f}),ss(a)||gs({newElement:a,elementType:this.state.activeTool.type,originX:e.originInGrid.x,originY:e.originInGrid.y,x:o,y:s,width:fr(e.originInGrid.x,o),height:fr(e.originInGrid.y,s),shouldMaintainAspectRatio:io(a)?!oa(t):oa(t),shouldResizeFromCenter:Ho(t),zoom:this.state.zoom.value,scene:this.scene,widthAspectRatio:l,originOffset:this.state.originSnapOffset,informMutation:n}),this.setState({newElement:a}),(this.state.activeTool.type===va.frame||this.state.activeTool.type===va.magicframe)&&this.setState({elementsToHighlight:kn(this.scene.getNonDeletedElements(),a,this.state,this.scene.getNonDeletedElementsMap())})}),i(this,`maybeHandleCrop`,(e,t)=>{if(!this.state.croppingElementId)return!1;let n=e.resize.handleType,r=e.lastCoords,[i,a]=It(r.x-e.resize.offset.x,r.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),o=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(n&&o&&io(o)){let s=e.originalElements.get(o.id),c=d(o)&&this.imageCache.get(o.fileId)?.image;if(s&&io(s)&&c&&!(c instanceof Promise)){let[l,u]=It(r.x,r.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),d={x:l-e.originInGrid.x,y:u-e.originInGrid.y};this.maybeCacheReferenceSnapPoints(t,[o]);let{snapOffset:f,snapLines:p}=Lj([o],[s],this,t,d,n);this.scene.mutateElement(o,Un(o,this.scene.getNonDeletedElementsMap(),n,c.naturalWidth,c.naturalHeight,i+f.x,a+f.y,t.shiftKey?s.width/s.height:void 0)),ue(o,this.scene),this.setState({isCropping:n&&n!==`rotation`,snapLines:p})}return!0}return!1}),i(this,`maybeHandleResize`,(e,t)=>{let n=this.scene.getSelectedElements(this.state),r=n.filter(e=>L(e)),i=e.resize.handleType;if(r.length>0&&i===`rotation`||n.length===1&&dr(n[0])||this.state.croppingElementId)return!1;this.setState({isResizing:i&&i!==`rotation`,isRotating:i===`rotation`,activeEmbeddable:null});let a=e.lastCoords,[o,s]=It(a.x-e.resize.offset.x,a.y-e.resize.offset.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),c=new Map;if(r.forEach(e=>{Di(this.scene.getNonDeletedElements(),e.id).forEach(t=>{c.set(e.id+t.id,{x:t.x-e.x,y:t.y-e.y})})}),!this.state.selectedElementsAreBeingDragged){let[r,c]=It(a.x,a.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),l={x:r-e.originInGrid.x,y:c-e.originInGrid.y},u=[...e.originalElements.values()];this.maybeCacheReferenceSnapPoints(t,n);let{snapOffset:d,snapLines:f}=Lj(n,ir(u,this.state),this,t,l,i);o+=d.x,s+=d.y,this.setState({snapLines:f})}if(In(e.originalElements,i,n,this.scene,mr(t),Ho(t),n.some(e=>io(e))?!oa(t):oa(t),o,s,e.resize.center.x,e.resize.center.y)){let e=new Set;return r.forEach(t=>{kn(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()).forEach(t=>e.add(t))}),this.setState({elementsToHighlight:[...e]}),!0}return!1}),i(this,`getContextMenuItems`,e=>{let t=[];if(t.push(xE,bE),e===`canvas`)return this.state.viewModeEnabled?[...t,CE,wE,yk,OE]:[vE,bN,xE,bE,SE,bN,cC,QE,bN,CE,TE,EE,DE,wE,yk,OE];if(t.push(SE),this.state.viewModeEnabled)return[_E,...t];let n=this.editorInterface.formFactor===`desktop`?[bN,iC,aC,oC,sC]:[];return[bN,yE,_E,vE,bN,ej,tj,nj,bN,QA,bN,...t,bN,YT,XT,bN,eE,uj,kE,AE,NE,tE,bN,cE,...n,bN,pE,mE,bN,XA,bN,YE,AD,bN,lC,ZE,bN,rC]}),i(this,`handleWheel`,qj(e=>{if(!(e.target instanceof HTMLCanvasElement||e.target instanceof HTMLTextAreaElement||e.target instanceof HTMLIFrameElement||e.target instanceof HTMLElement&&e.target.classList.contains(Qn.FRAME_NAME))){e[N.CTRL_OR_CMD]&&e.preventDefault();return}if(e.preventDefault(),hz)return;let{deltaX:t,deltaY:n}=e;if(e.metaKey||e.ctrlKey){let e=Math.sign(n),t=qi*100,r=Math.abs(n),i=n;r>t&&(i=t*e);let a=this.state.zoom.value-i/100;a+=Math.log10(Math.max(1,this.state.zoom.value))*-e*Math.min(1,r/20),this.translateCanvas(e=>({...Xw({viewportX:this.lastViewportPosition.x,viewportY:this.lastViewportPosition.y,nextZoom:_i(a)},e),shouldCacheIgnoreZoom:!0})),this.resetShouldCacheIgnoreZoomDebounced();return}if(e.shiftKey){this.translateCanvas(({zoom:e,scrollX:r})=>({scrollX:r-(n||t)/e.value}));return}this.translateCanvas(({zoom:e,scrollX:r,scrollY:i})=>({scrollX:r-t/e.value,scrollY:i-n/e.value}))})),i(this,`savePointer`,(e,t,n)=>{if(!e||!t)return;let{x:r,y:i}=la({clientX:e,clientY:t},this.state),a={x:r,y:i,tool:this.state.activeTool.type===`laser`?`laser`:`pointer`};this.props.onPointerUpdate?.({pointer:a,button:n,pointersMap:Tz.pointers})}),i(this,`resetShouldCacheIgnoreZoomDebounced`,wt(()=>{this.unmounted||this.setState({shouldCacheIgnoreZoom:!1})},300)),i(this,`updateDOMRect`,e=>{if(this.excalidrawContainerRef?.current){let{width:t,height:n,left:r,top:i}=this.excalidrawContainerRef.current.getBoundingClientRect(),{width:a,height:o,offsetTop:s,offsetLeft:c}=this.state;if(t===a&&n===o&&r===c&&i===s){e&&e();return}this.setState({width:t,height:n,offsetLeft:r,offsetTop:i},()=>{e&&e()})}}),i(this,`refresh`,()=>{this.setState({...this.getCanvasOffsets()})}),i(this,`watchState`,()=>{});let n=cs(),{viewModeEnabled:r=!1,zenModeEnabled:a=!1,gridModeEnabled:o=!1,objectsSnapModeEnabled:s=!1,theme:c=n.theme,name:l=`${K(`labels.untitled`)}-${Fn()}`}=t;this.state={...n,theme:c,exportWithDarkMode:c===R.DARK,isLoading:!0,...this.getCanvasOffsets(),viewModeEnabled:r,zenModeEnabled:a,objectsSnapModeEnabled:s,gridModeEnabled:o??n.gridModeEnabled,name:l,width:window.innerWidth,height:window.innerHeight},this.refreshEditorInterface(),this.stylesPanelMode=Ka(this.editorInterface),this.id=Ca(),this.library=new ZD(this),this.actionManager=new fj(this.syncActionResult,()=>this.state,()=>this.scene.getElementsIncludingDeleted(),this),this.scene=new Dn,this.canvas=document.createElement(`canvas`),this.rc=Fo.canvas(this.canvas),this.renderer=new Vj(this.scene),this.visibleElements=[],this.store=new zo(this),this.history=new aj(this.store),this.excalidrawContainerValue={container:this.excalidrawContainerRef.current,id:this.id},this.fonts=new de(this.scene),this.history=new aj(this.store),this.actionManager.registerAll(eC),this.actionManager.registerAction(cj(this.history)),this.actionManager.registerAction(lj(this.history)),this.api=this.createExcalidrawAPI()}createExcalidrawAPI(){return{isDestroyed:!1,updateScene:this.updateScene,applyDeltas:this.applyDeltas,mutateElement:this.mutateElement,updateLibrary:this.library.updateLibrary,addFiles:this.addFiles,resetScene:this.resetScene,getSceneElementsIncludingDeleted:this.getSceneElementsIncludingDeleted,getSceneElementsMapIncludingDeleted:this.getSceneElementsMapIncludingDeleted,history:{clear:this.resetHistory},scrollToContent:this.scrollToContent,getSceneElements:this.getSceneElements,getAppState:()=>this.state,getFiles:()=>this.files,getName:this.getName,registerAction:e=>{this.actionManager.registerAction(e)},refresh:this.refresh,setToast:this.setToast,id:this.id,setActiveTool:this.setActiveTool,setCursor:this.setCursor,resetCursor:this.resetCursor,getEditorInterface:()=>this.editorInterface,updateFrameRendering:this.updateFrameRendering,toggleSidebar:this.toggleSidebar,onChange:e=>this.onChangeEmitter.on(e),onIncrement:e=>this.store.onStoreIncrementEmitter.on(e),onPointerDown:e=>this.onPointerDownEmitter.on(e),onPointerUp:e=>this.onPointerUpEmitter.on(e),onScrollChange:e=>this.onScrollChangeEmitter.on(e),onUserFollow:e=>this.onUserFollowEmitter.on(e),onStateChange:this.onStateChange,onEvent:this.onEvent}}onWindowMessage(e){if(e.origin!==`https://player.vimeo.com`&&e.origin!==`https://www.youtube.com`)return;let t=null;try{t=JSON.parse(e.data)}catch{}if(t)switch(e.origin){case`https://player.vimeo.com`:if(t.method===`paused`){let n=null,r=document.body.querySelectorAll(`iframe.excalidraw__embeddable`);if(!r)break;for(let t of r)t.contentWindow===e.source&&(n=t.contentWindow);n?.postMessage(JSON.stringify({method:t.value?`play`:`pause`,value:!0}),`*`)}break;case`https://www.youtube.com`:if(t.event===`infoDelivery`&&t.info&&t.id&&typeof t.info.playerState==`number`){let e=t.id,n=t.info.playerState;Object.values(Ao).includes(n)&&bz.set(e,n)}break}}handleSkipBindMode(){if(this.state.selectedLinearElement?.initialState&&!this.state.selectedLinearElement.initialState.arrowStartIsInside){gt(this.lastPointerMoveCoords,`Missing last pointer move coords when changing bind skip mode for arrow start`);let e=this.scene.getNonDeletedElementsMap(),t=go(O(this.lastPointerMoveCoords.x,this.lastPointerMoveCoords.y),this.scene.getNonDeletedElements(),e),n=I.getElement(this.state.selectedLinearElement.elementId,e);n?.startBinding&&t?.id===n.startBinding.elementId&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:!0}}})}if(this.state.bindMode===`orbit`&&(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),(0,_c.flushSync)(()=>{this.setState({bindMode:`skip`})}),this.lastPointerMoveCoords&&this.state.selectedLinearElement?.selectedPointsIndices&&this.state.selectedLinearElement?.selectedPointsIndices.length)){let{x:e,y:t}=this.lastPointerMoveCoords,n=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(n,`Last event must exist`);let r=e-this.state.selectedLinearElement.pointerOffset.x,i=t-this.state.selectedLinearElement.pointerOffset.y,a=this.state.multiElement?I.handlePointerMove(n,this,r,i,this.state.selectedLinearElement):I.handlePointDragging(n,this,r,i,this.state.selectedLinearElement);a&&this.setState(a)}}resetDelayedBindMode(){this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode!==`orbit`&&setTimeout(()=>this.setState({bindMode:`orbit`}))}handleDelayedBindModeChange(e,t){if(e.isDeleted||dr(e))return;let n=()=>{if(this.bindModeHandler=null,gt(this.lastPointerMoveCoords,`Expected lastPointerMoveCoords to be set`),!this.state.multiElement){if(!this.state.selectedLinearElement||!this.state.selectedLinearElement.selectedPointsIndices||!this.state.selectedLinearElement.selectedPointsIndices.length)return;let t=this.state.selectedLinearElement.selectedPointsIndices.includes(0),n=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1);if(!t&&!n||t&&n)return}let{x:t,y:n}=this.lastPointerMoveCoords,r=go(O(t,n),this.scene.getNonDeletedElements(),this.scene.getNonDeletedElementsMap());if(r&&this.state.bindMode!==`skip`){gt(this.state.selectedLinearElement?.elementId===e.id,`The selectedLinearElement is expected to not change while a bind mode timeout is ticking`);let i=this.state.selectedLinearElement.initialState.arrowStartIsInside||e.startBinding?.elementId===r.id;(0,_c.flushSync)(()=>{gt(this.state.selectedLinearElement,`this.state.selectedLinearElement must exist`),this.setState({bindMode:`inside`,selectedLinearElement:{...this.state.selectedLinearElement,initialState:{...this.state.selectedLinearElement.initialState,arrowStartIsInside:i}}})});let a=this.lastPointerMoveEvent??this.lastPointerDownEvent?.nativeEvent;gt(a,`Last event must exist`);let o=t-this.state.selectedLinearElement.pointerOffset.x,s=n-this.state.selectedLinearElement.pointerOffset.y,c=this.state.multiElement?I.handlePointerMove(a,this,o,s,this.state.selectedLinearElement):I.handlePointDragging(a,this,o,s,this.state.selectedLinearElement);c&&this.setState(c)}},r=!1;if(this.state.selectedLinearElement?.selectedPointsIndices){let n=this.scene.getNonDeletedElementsMap(),i=this.state.selectedLinearElement.selectedPointsIndices.includes(0),a=this.state.selectedLinearElement.selectedPointsIndices.includes(e.points.length-1),o=i?t:e.startBinding&&n.get(e.startBinding.elementId),s=a?t:e.endBinding&&n.get(e.endBinding.elementId),c=o&&m(o,n),l=s&&m(s,n);r=!!(c&&l&&o.id!==s.id&&oe(c,l))}let i=this.state.selectedLinearElement?.selectedPointsIndices?.includes(0),a=this.state.selectedLinearElement?.selectedPointsIndices?.includes(e.points.length-1),o=i?`startBinding`:a?`endBinding`:null,s=i?`endBinding`:a?`startBinding`:null,c=s&&e[s]?.mode===`inside`&&e[s]?.elementId===t?.id||o&&e[o]?.mode===`inside`&&t?.id===e[o]?.elementId;o&&s&&e[o]?.mode===`inside`&&t?.id!==e[o]?.elementId&&e[s]?.elementId!==e[o]?.elementId&&this.scene.mutateElement(e,{[o]:{...e[o],mode:`orbit`}},{informMutation:!1,isDragging:!0}),!t||this.previousHoveredBindableElement&&t.id!==this.previousHoveredBindableElement.id?(this.bindModeHandler&&=(clearTimeout(this.bindModeHandler),null),this.state.bindMode===`inside`&&(0,_c.flushSync)(()=>{this.setState({bindMode:`orbit`})}),this.previousHoveredBindableElement=null):!this.bindModeHandler&&(!this.state.newElement||!e.startBinding||r)&&!c&&(this.bindModeHandler=setTimeout(n,700)),this.previousHoveredBindableElement=t}cacheEmbeddableRef(e,t){t&&this.iFrameRefs.set(e.id,t)}getHTMLIFrameElement(e){return this.iFrameRefs.get(e.id)}handleIframeLikeCenterClick(){if(!this.lastPointerDownEvent||!this.lastPointerUpEvent||this.lastPointerDownEvent.button!==dn.MAIN||mz||!v(this.state.activeTool.type,[`laser`,`selection`,`lasso`]))return!1;let e=O(la({clientX:this.lastPointerDownEvent.clientX,clientY:this.lastPointerDownEvent.clientY},this.state)),t=O(la({clientX:this.lastPointerUpEvent.clientX,clientY:this.lastPointerUpEvent.clientY},this.state));if(Se(e,t)>10)return!1;let n=this.getElementAtPosition(e[0],e[1]);if(!(n&&this.lastPointerUpEvent.timeStamp-this.lastPointerDownEvent.timeStamp<=300&&Tz.pointers.size<2&&Rs(n)&&(this.state.viewModeEnabled||this.state.activeTool.type===`laser`||this.isIframeLikeElementCenter(n,this.lastPointerUpEvent,t[0],t[1]))))return!1;let r=n;if(this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`||(setTimeout(()=>{this.setState({activeEmbeddable:{element:r,state:`active`},selectedElementIds:{[r.id]:!0},newElement:null,selectionElement:null})},100),Vs(r)))return!0;let i=this.getHTMLIFrameElement(r);if(!i?.contentWindow)return!0;if(i.src.includes(`youtube`)){let e=bz.get(r.id);switch(e||(bz.set(r.id,Ao.UNSTARTED),i.contentWindow.postMessage(JSON.stringify({event:`listening`,id:r.id}),`*`)),e){case Ao.PLAYING:case Ao.BUFFERING:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`pauseVideo`,args:``}),`*`);break;default:i.contentWindow?.postMessage(JSON.stringify({event:`command`,func:`playVideo`,args:``}),`*`)}}return i.src.includes(`player.vimeo.com`)&&i.contentWindow.postMessage(JSON.stringify({method:`paused`}),`*`),!0}isIframeLikeElementCenter(e,t,n,r){return e&&!t.altKey&&!t.shiftKey&&!t.metaKey&&!t.ctrlKey&&(this.state.activeEmbeddable?.element!==e||this.state.activeEmbeddable?.state===`hover`||!this.state.activeEmbeddable)&&n>=e.x+e.width/3&&n<=e.x+2*e.width/3&&r>=e.y+e.height/3&&r<=e.y+2*e.height/3}renderEmbeddables(){let e=this.state.zoom.value,t=this.state.width,n=this.state.height;return(0,W.jsx)(W.Fragment,{children:this.scene.getNonDeletedElements().filter(e=>rs(e)&&this.embedsValidationStatus.get(e.id)===!0||Vs(e)).map(r=>{let{x:i,y:a}=Ci({sceneX:r.x,sceneY:r.y},this.state),o=vn(r,t,n,this.state,this.scene.getNonDeletedElementsMap()),s=this.initializedEmbeds.has(r.id);if(o&&!s&&this.initializedEmbeds.add(r.id),!(o||s))return null;let c;if(Vs(r)){c=null;let e=(r.customData?.generationData??this.magicGenerations.get(r.id))||{status:`error`,message:`No generation data`,code:`ERR_NO_GENERATION_DATA`};if(e.status===`done`){let t=e.html;c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>t}}else if(e.status===`pending`)c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>cr(`
|
|
89
|
+
<style>
|
|
90
|
+
html, body {
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 100%;
|
|
93
|
+
color: ${this.state.theme===R.DARK?`white`:`black`};
|
|
94
|
+
}
|
|
95
|
+
body {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
flex-direction: column;
|
|
100
|
+
gap: 1rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.Spinner {
|
|
104
|
+
display: flex;
|
|
105
|
+
align-items: center;
|
|
106
|
+
justify-content: center;
|
|
107
|
+
margin-left: auto;
|
|
108
|
+
margin-right: auto;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.Spinner svg {
|
|
112
|
+
animation: rotate 1.6s linear infinite;
|
|
113
|
+
transform-origin: center center;
|
|
114
|
+
width: 40px;
|
|
115
|
+
height: 40px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.Spinner circle {
|
|
119
|
+
stroke: currentColor;
|
|
120
|
+
animation: dash 1.6s linear 0s infinite;
|
|
121
|
+
stroke-linecap: round;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@keyframes rotate {
|
|
125
|
+
100% {
|
|
126
|
+
transform: rotate(360deg);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
@keyframes dash {
|
|
131
|
+
0% {
|
|
132
|
+
stroke-dasharray: 1, 300;
|
|
133
|
+
stroke-dashoffset: 0;
|
|
134
|
+
}
|
|
135
|
+
50% {
|
|
136
|
+
stroke-dasharray: 150, 300;
|
|
137
|
+
stroke-dashoffset: -200;
|
|
138
|
+
}
|
|
139
|
+
100% {
|
|
140
|
+
stroke-dasharray: 1, 300;
|
|
141
|
+
stroke-dashoffset: -280;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
145
|
+
<div class="Spinner">
|
|
146
|
+
<svg
|
|
147
|
+
viewBox="0 0 100 100"
|
|
148
|
+
>
|
|
149
|
+
<circle
|
|
150
|
+
cx="50"
|
|
151
|
+
cy="50"
|
|
152
|
+
r="46"
|
|
153
|
+
stroke-width="8"
|
|
154
|
+
fill="none"
|
|
155
|
+
stroke-miter-limit="10"
|
|
156
|
+
/>
|
|
157
|
+
</svg>
|
|
158
|
+
</div>
|
|
159
|
+
<div>Generating...</div>
|
|
160
|
+
`)};else{let t;t=e.code===`ERR_GENERATION_INTERRUPTED`?`Generation was interrupted...`:e.message||`Generation failed`,c={intrinsicSize:{w:r.width,h:r.height},type:`document`,srcdoc:()=>cr(`
|
|
161
|
+
<style>
|
|
162
|
+
html, body {
|
|
163
|
+
height: 100%;
|
|
164
|
+
}
|
|
165
|
+
body {
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
color: ${hi.red[3]};
|
|
171
|
+
}
|
|
172
|
+
h1, h3 {
|
|
173
|
+
margin-top: 0;
|
|
174
|
+
margin-bottom: 0.5rem;
|
|
175
|
+
}
|
|
176
|
+
</style>
|
|
177
|
+
<h1>Error!</h1>
|
|
178
|
+
<h3>${t}</h3>
|
|
179
|
+
`)}}}else c=qs(ws(r.link||``));let l=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`active`,u=this.state.activeEmbeddable?.element===r&&this.state.activeEmbeddable?.state===`hover`;return(0,W.jsx)(`div`,{className:U(`excalidraw__embeddable-container`,{"is-hovered":u}),style:{transform:o?`translate(${i-this.state.offsetLeft}px, ${a-this.state.offsetTop}px) scale(${e})`:`none`,display:o?`block`:`none`,opacity:eo(r,No(r,this.scene.getNonDeletedElementsMap()),this.elementsPendingErasure,null,this.state.openDialog?.name===`elementLinkSelector`?mo:1),"--embeddable-radius":`${Fe(Math.min(r.width,r.height),r)}px`},children:(0,W.jsxs)(`div`,{className:`excalidraw__embeddable-container__inner`,style:{width:o?`${r.width}px`:0,height:o?`${r.height}px`:0,transform:o?`rotate(${r.angle}rad)`:`none`,pointerEvents:l?uo.enabled:uo.disabled},children:[u&&(0,W.jsx)(`div`,{className:`excalidraw__embeddable-hint`,children:K(`buttons.embeddableInteractionButton`)}),(0,W.jsx)(`div`,{className:`excalidraw__embeddable__outer`,style:{padding:`${r.strokeWidth}px`},children:(rs(r)?this.props.renderEmbeddable?.(r,this.state):null)??(0,W.jsx)(`iframe`,{ref:e=>this.cacheEmbeddableRef(r,e),className:`excalidraw__embeddable`,srcDoc:c?.type===`document`?c.srcdoc(this.state.theme):void 0,src:c?.type===`document`?void 0:c?.link??``,scrolling:`no`,referrerPolicy:`no-referrer-when-downgrade`,title:`Excalidraw Embedded Content`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0,sandbox:`${c?.sandbox?.allowSameOrigin?`allow-same-origin`:``} allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-presentation allow-downloads`})})]})},r.id)})})}toggleOverscrollBehavior(e){document.documentElement.style.overscrollBehaviorX=e.type===`pointerenter`?`none`:`auto`}render(){let e=this.scene.getSelectedElements(this.state),{renderTopRightUI:t,renderTopLeftUI:n,renderCustomStats:r}=this.props,i=this.scene.getSceneNonce(),{elementsMap:a,visibleElements:o}=this.renderer.getRenderableElements({sceneNonce:i,zoom:this.state.zoom,offsetLeft:this.state.offsetLeft,offsetTop:this.state.offsetTop,scrollX:this.state.scrollX,scrollY:this.state.scrollY,height:this.state.height,width:this.state.width,editingTextElement:this.state.editingTextElement,newElementId:this.state.newElement?.id});this.visibleElements=o;let s=this.scene.getNonDeletedElementsMap(),c=`setPointerCapture`in HTMLElement.prototype?!1:this.state.selectionElement||this.state.newElement||this.state.selectedElementsAreBeingDragged||this.state.resizingElement||this.state.activeTool.type===`laser`&&this.state.cursorButton===`down`,l=e[0],u=Cy.get(sD)?.type===`panel`;return(0,W.jsx)(`div`,{translate:`no`,className:U(`excalidraw excalidraw-container notranslate`,{"excalidraw--view-mode":this.state.viewModeEnabled||this.state.openDialog?.name===`elementLinkSelector`,"excalidraw--mobile":this.editorInterface.formFactor===`phone`}),style:{"--ui-pointerEvents":c?uo.disabled:uo.enabled,"--right-sidebar-width":`302px`},ref:this.excalidrawContainerRef,onDrop:this.handleAppOnDrop,tabIndex:0,onKeyDown:this.props.handleKeyboardGlobally?void 0:this.onKeyDown,onPointerEnter:this.toggleOverscrollBehavior,onPointerLeave:this.toggleOverscrollBehavior,children:(0,W.jsx)(ez.Provider,{value:this.api,children:(0,W.jsx)(WR.Provider,{value:this,children:(0,W.jsx)(GR.Provider,{value:this.props,children:(0,W.jsx)(YR.Provider,{value:this.excalidrawContainerValue,children:(0,W.jsx)(qR.Provider,{value:this.editorInterface,children:(0,W.jsx)(QR.Provider,{value:this.setAppState,children:(0,W.jsx)(ZR.Provider,{value:this.state,children:(0,W.jsxs)(XR.Provider,{value:this.scene.getNonDeletedElements(),children:[(0,W.jsxs)($R.Provider,{value:this.actionManager,children:[(0,W.jsx)(YL,{canvas:this.canvas,appState:this.state,files:this.files,setAppState:this.setAppState,actionManager:this.actionManager,elements:this.scene.getNonDeletedElements(),onLockToggle:this.toggleLock,onPenModeToggle:this.togglePenMode,onHandToolToggle:this.onHandToolToggle,langCode:My().code,renderTopLeftUI:n,renderTopRightUI:t,renderCustomStats:r,showExitZenModeBtn:typeof this.props?.zenModeEnabled>`u`&&this.state.zenModeEnabled,UIOptions:this.props.UIOptions,onExportImage:this.onExportImage,renderWelcomeScreen:!this.state.isLoading&&this.state.showWelcomeScreen&&this.state.activeTool.type===this.state.preferredSelectionTool.type&&!this.state.zenModeEnabled&&!this.scene.getElementsIncludingDeleted().length,app:this,isCollaborating:this.props.isCollaborating,generateLinkForSelection:this.props.generateLinkForSelection,children:this.props.children}),(0,W.jsx)(`div`,{className:`excalidraw-textEditorContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-contextMenuContainer`}),(0,W.jsx)(`div`,{className:`excalidraw-eye-dropper-container`}),(0,W.jsx)(QL,{trails:[this.laserTrails,this.lassoTrail,this.eraserTrail]}),e.length===1&&this.state.openDialog?.name!==`elementLinkSelector`&&this.state.showHyperlinkPopup&&(0,W.jsx)(VE,{element:l,scene:this.scene,setAppState:this.setAppState,onLinkOpen:this.props.onLinkOpen,setToast:this.setToast,updateEmbedValidationStatus:this.updateEmbedValidationStatus},l.id),this.props.aiEnabled!==!1&&e.length===1&&xe(l)&&(0,W.jsx)(Wj,{element:l,elementsMap:a,children:(0,W.jsx)(ZL,{title:K(`labels.convertToCode`),icon:fS,checked:!1,onChange:()=>this.onMagicFrameGenerate(l,`button`)})}),e.length===1&&Vs(l)&&l.customData?.generationData?.status===`done`&&(0,W.jsxs)(Wj,{element:l,elementsMap:a,children:[(0,W.jsx)(ZL,{title:K(`labels.copySource`),icon:$x,checked:!1,onChange:()=>this.onIframeSrcCopy(l)}),(0,W.jsx)(ZL,{title:`Enter fullscreen`,icon:pS,checked:!1,onChange:()=>{let e=this.getHTMLIFrameElement(l);if(e)try{e.requestFullscreen(),this.setState({activeEmbeddable:{element:l,state:`active`},selectedElementIds:{[l.id]:!0},newElement:null,selectionElement:null})}catch(e){console.warn(e),this.setState({errorMessage:`Couldn't enter fullscreen`})}}})]}),this.state.contextMenu&&(0,W.jsx)(xN,{items:this.state.contextMenu.items,top:this.state.contextMenu.top,left:this.state.contextMenu.left,actionManager:this.actionManager,onClose:e=>{this.setState({contextMenu:null},()=>{this.focusContainer(),e?.()})}}),(0,W.jsx)(LR,{canvas:this.canvas,rc:this.rc,elementsMap:a,allElementsMap:s,visibleElements:o,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:Sj(this),canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:this.flowChartCreator.pendingNodes,theme:this.state.theme}}),this.state.newElement&&(0,W.jsx)(VR,{appState:this.state,scale:window.devicePixelRatio,rc:this.rc,elementsMap:a,allElementsMap:s,renderConfig:{imageCache:this.imageCache,isExporting:!1,renderGrid:!1,canvasBackgroundColor:this.state.viewBackgroundColor,embedsValidationStatus:this.embedsValidationStatus,elementsPendingErasure:this.elementsPendingErasure,pendingFlowchartNodes:null,theme:this.state.theme}}),(0,W.jsx)(PR,{app:this,containerRef:this.excalidrawContainerRef,canvas:this.interactiveCanvas,elementsMap:a,visibleElements:o,allElementsMap:s,selectedElements:e,sceneNonce:i,selectionNonce:this.state.selectionElement?.versionNonce,scale:window.devicePixelRatio,appState:this.state,renderScrollbars:this.props.renderScrollbars===!0,editorInterface:this.editorInterface,renderInteractiveSceneCallback:this.renderInteractiveSceneCallback,handleCanvasRef:this.handleInteractiveCanvasRef,onContextMenu:this.handleCanvasContextMenu,onPointerMove:this.handleCanvasPointerMove,onPointerUp:this.handleCanvasPointerUp,onPointerCancel:this.removePointer,onTouchMove:this.handleTouchMove,onPointerDown:this.handleCanvasPointerDown,onDoubleClick:this.handleCanvasDoubleClick}),this.state.userToFollow&&(0,W.jsx)(SN,{width:this.state.width,height:this.state.height,userToFollow:this.state.userToFollow,onDisconnect:this.maybeUnfollowRemoteUser}),this.renderFrameNames(),this.state.activeLockedId&&(0,W.jsx)(UR,{app:this,activeLockedId:this.state.activeLockedId}),u&&(0,W.jsx)(OD,{app:this})]}),this.renderEmbeddables()]})})})})})})})})})}setPlugins(e){Object.assign(this.plugins,e)}async onMagicFrameGenerate(e,t){let n=this.plugins.diagramToCode?.generate;if(!n){this.setState({errorMessage:`No diagram to code plugin found`});return}let r=fo(this.scene.getNonDeletedElements(),e).filter(e=>!xe(e));if(!r.length){t===`button`?(this.setState({errorMessage:`Cannot generate from an empty frame`}),dC(`ai`,`generate (no-children)`,`d2c`)):this.setActiveTool({type:`magicframe`});return}let i=this.insertIframeElement({sceneX:e.x+e.width+30,sceneY:e.y,width:e.width,height:e.height});if(i){this.updateMagicGeneration({frameElement:i,data:{status:`pending`}}),this.setState({selectedElementIds:{[i.id]:!0}}),dC(`ai`,`generate (start)`,`d2c`);try{let{html:t}=await n({frame:e,children:r});if(dC(`ai`,`generate (success)`,`d2c`),!t.trim()){this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:`Nothing genereated :(`}});return}let a=t.includes(`<!DOCTYPE html>`)&&t.includes(`</html>`)?t.slice(t.indexOf(`<!DOCTYPE html>`),t.indexOf(`</html>`)+7):t;this.updateMagicGeneration({frameElement:i,data:{status:`done`,html:a}})}catch(e){dC(`ai`,`generate (failed)`,`d2c`),this.updateMagicGeneration({frameElement:i,data:{status:`error`,code:`ERR_OAI`,message:e.message||`Unknown error during generation`}})}}}onIframeSrcCopy(e){e.customData?.generationData?.status===`done`&&(AT(e.customData.generationData.html),this.setToast({message:`copied to clipboard`,closable:!1,duration:1500}))}clearImageShapeCache(e){let t=e??this.files;this.scene.getNonDeletedElements().forEach(e=>{d(e)&&t[e.fileId]&&(this.imageCache.delete(e.fileId),bn.delete(e))})}async componentDidMount(){this.unmounted=!1,this.api=this.createExcalidrawAPI(),this.excalidrawContainerValue.container=this.excalidrawContainerRef.current,(h()||Vt())&&(this.setState.bind(this),Object.defineProperties(window.h,{state:{configurable:!0,get:()=>this.state},setState:{configurable:!0,value:(...e)=>this.setState(...e)},app:{configurable:!0,value:this},history:{configurable:!0,value:this.history},store:{configurable:!0,value:this.store},fonts:{configurable:!0,value:this.fonts}})),this.store.onDurableIncrementEmitter.on(e=>{this.history.record(e.delta)}),this.props.onIncrement&&this.store.onStoreIncrementEmitter.on(e=>{this.props.onIncrement?.(e)}),this.scene.onUpdate(this.triggerRender),this.addEventListeners(),this.props.autoFocus&&this.excalidrawContainerRef.current&&this.focusContainer(),He&&this.excalidrawContainerRef.current&&(this.resizeObserver=new ResizeObserver(()=>{this.refreshEditorInterface(),this.updateDOMRect()}),this.resizeObserver?.observe(this.excalidrawContainerRef.current)),new URLSearchParams(window.location.search.slice(1)).has(`web-share-target`)?this.restoreFileFromShare():this.updateDOMRect(this.initializeScene),Ss()&&!x()&&this.setState({errorMessage:(0,W.jsx)(vN,{})});let e={excalidrawAPI:this.api,container:this.excalidrawContainerRef.current};this.editorLifecycleEvents.emit(`editor:mount`,e),this.props.onMount?.(e),this.props.onExcalidrawAPI?.(this.api)}componentWillUnmount(){this.api={...this.api,isDestroyed:!0};for(let e of Object.keys(this.api))(e.startsWith(`get`)||e===`onStateChange`||e===`onEvent`)&&typeof this.api[e]==`function`&&(this.api[e]=()=>{throw Error("ExcalidrawAPI is no longer usable after the editor has been unmounted and will return invalid/empty data. You should check for `ExcalidrawAPI.isDestroyed` before calling get* methods on subscribing to state/event changes.")});this.editorLifecycleEvents.emit(`editor:unmount`),this.props.onUnmount?.(),this.props.onExcalidrawAPI?.(null),window.launchQueue?.setConsumer(()=>{}),this.renderer.destroy(),this.scene.destroy(),this.scene=new Dn,this.fonts=new de(this.scene),this.renderer=new Vj(this.scene),this.files={},this.imageCache.clear(),this.resizeObserver?.disconnect(),this.unmounted=!0,this.removeEventListeners(),this.library.destroy(),this.laserTrails.stop(),this.eraserTrail.stop(),this.onChangeEmitter.clear(),this.store.onStoreIncrementEmitter.clear(),this.store.onDurableIncrementEmitter.clear(),this.appStateObserver.clear(),this.editorLifecycleEvents.clear(),bn.destroy(),xj.destroy(),clearTimeout(vz),Ya.clearCache(),Hr.clearCache(),vz=0,document.documentElement.style.overscrollBehaviorX=``}removeEventListeners(){this.onRemoveEventListenersEmitter.trigger()}addEventListeners(){this.removeEventListeners(),this.props.handleKeyboardGlobally&&this.onRemoveEventListenersEmitter.once(w(document,F.KEYDOWN,this.onKeyDown,!1)),this.onRemoveEventListenersEmitter.once(w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(window,F.MESSAGE,this.onWindowMessage,!1),w(document,F.POINTER_UP,this.removePointer,{passive:!1}),w(document,F.COPY,this.onCopy,{passive:!1}),w(document,F.KEYUP,this.onKeyUp,{passive:!0}),w(document,F.POINTER_MOVE,this.updateCurrentCursorPosition,{passive:!1}),w(document.fonts,`loadingdone`,e=>{let t=e.fontfaces;this.fonts.onLoaded(t)},{passive:!1}),w(document,F.GESTURE_START,this.onGestureStart,!1),w(document,F.GESTURE_CHANGE,this.onGestureChange,!1),w(document,F.GESTURE_END,this.onGestureEnd,!1),w(window,F.FOCUS,()=>{this.maybeCleanupAfterMissingPointerUp(null),this.triggerRender(!0)},{passive:!1})),!this.state.viewModeEnabled&&(this.onRemoveEventListenersEmitter.once(w(document,F.FULLSCREENCHANGE,this.onFullscreenChange,{passive:!1}),w(document,F.PASTE,this.pasteFromClipboard,{passive:!1}),w(document,F.CUT,this.onCut,{passive:!1}),w(window,F.RESIZE,this.onResize,!1),w(window,F.UNLOAD,this.onUnload,!1),w(window,F.BLUR,this.onBlur,!1),w(this.excalidrawContainerRef.current,F.WHEEL,this.handleWheel,{passive:!1}),w(this.excalidrawContainerRef.current,F.DRAG_OVER,this.disableEvent,!1),w(this.excalidrawContainerRef.current,F.DROP,this.disableEvent,!1)),this.props.detectScroll&&this.onRemoveEventListenersEmitter.once(w(sr(this.excalidrawContainerRef.current),F.SCROLL,this.onScroll,{passive:!1})))}componentDidUpdate(e,t){!this._initialized&&!this.state.isLoading&&(this._initialized=!0,this.editorLifecycleEvents.emit(`editor:initialize`,this.api),this.props.onInitialize?.(this.api)),this.appStateObserver.flush(t),this.updateEmbeddables();let n=this.scene.getElementsIncludingDeleted(),r=this.scene.getElementsMapIncludingDeleted(),i=(this.sessionExportThemeOverride??this.state.theme)===R.DARK;this.state.exportWithDarkMode!==i&&this.setState({exportWithDarkMode:i}),!this.state.showWelcomeScreen&&!n.length&&this.setState({showWelcomeScreen:!0}),t.userToFollow&&!this.state.collaborators.has(t.userToFollow.socketId)&&this.maybeUnfollowRemoteUser(),(t.zoom.value!==this.state.zoom.value||t.scrollX!==this.state.scrollX||t.scrollY!==this.state.scrollY)&&(this.props?.onScrollChange?.(this.state.scrollX,this.state.scrollY,this.state.zoom),this.onScrollChangeEmitter.trigger(this.state.scrollX,this.state.scrollY,this.state.zoom)),t.userToFollow!==this.state.userToFollow&&(t.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:t.userToFollow,action:`UNFOLLOW`}),this.state.userToFollow&&this.onUserFollowEmitter.trigger({userToFollow:this.state.userToFollow,action:`FOLLOW`})),Object.keys(this.state.selectedElementIds).length&&zr(this.state)&&this.setState({activeTool:ka(this.state,{type:`selection`})}),this.state.activeTool.type===`eraser`&&t.theme!==this.state.theme&&Jw(this.interactiveCanvas,this.state.theme),t.activeTool.type===`selection`&&this.state.activeTool.type!==`selection`&&this.state.showHyperlinkPopup&&this.setState({showHyperlinkPopup:!1}),e.langCode!==this.props.langCode&&this.updateLanguage(),zr(t)&&!zr(this.state)&&this.eraserTrail.endPath(),e.viewModeEnabled!==this.props.viewModeEnabled&&this.setState({viewModeEnabled:!!this.props.viewModeEnabled}),t.viewModeEnabled!==this.state.viewModeEnabled&&(this.addEventListeners(),this.deselectElements()),(t.openDialog?.name===`elementLinkSelector`||this.state.openDialog?.name===`elementLinkSelector`)&&t.openDialog?.name!==this.state.openDialog?.name&&(this.deselectElements(),this.setState({hoveredElementIds:{}})),e.zenModeEnabled!==this.props.zenModeEnabled&&this.setState({zenModeEnabled:!!this.props.zenModeEnabled}),e.theme!==this.props.theme&&this.props.theme&&this.setState({theme:this.props.theme}),this.excalidrawContainerRef.current?.classList.toggle(`theme--dark`,this.state.theme===R.DARK),this.state.selectedLinearElement?.isEditing&&!this.state.selectedElementIds[this.state.selectedLinearElement.elementId]&&setTimeout(()=>{this.state.selectedLinearElement?.isEditing&&this.actionManager.executeAction(oT)}),this.state.editingTextElement?.isDeleted&&this.setState({editingTextElement:null}),this.store.commit(r,this.state),this.state.isLoading||(this.props.onChange?.(n,this.state,this.files),this.onChangeEmitter.trigger(n,this.state,this.files))}static resetTapTwice(){dz=!1,pz=null}async insertClipboardContent(e,t,r){let{x:i,y:a}=la({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state);if(e.errorMessage){this.setState({errorMessage:e.errorMessage});return}if(t.length===0&&!r&&e.mixedContent){await this.addElementsFromMixedContentPaste(e.mixedContent,{isPlainPaste:r,sceneX:i,sceneY:a});return}if(!r&&e.text){let t=hN(e.text);if(t.ok){this.setState({openDialog:{name:`charts`,data:t.data,rawText:e.text}});return}}let o=t.map(e=>e.file);if(o.length===0&&e.text&&!r){let t=e.text.trim();t.startsWith(`<svg`)&&t.endsWith(`</svg>`)&&o.push(Xi(t))}if(o.length>0){this.isToolSupported(`image`)?await this.insertImages(o,i,a):this.setState({errorMessage:K(`errors.imageToolNotSupported`)});return}if(e.elements){let t=e.programmaticAPI?sn(e.elements):e.elements;this.addElementsFromPasteOrLibrary({elements:t,files:e.files||null,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`,retainSeed:r});return}if(!e.text)return;if(!r&&rM(e.text)){let t=await n(()=>import(`./excalidraw-mermaid-stub-C1ZaaI05.js`),__vite__mapDeps([70,71]),import.meta.url);try{let{elements:n,files:r={}}=await t.parseMermaidToExcalidraw(e.text),i=sn(n,{regenerateIds:!0});this.addElementsFromPasteOrLibrary({elements:i,files:r,position:this.editorInterface.formFactor===`desktop`?`cursor`:`center`});return}catch(e){console.warn(`parsing pasted text as mermaid definition failed: ${e.message}`)}}let s=Wa(e.text).split(/\n+/).map(e=>e.trim()).filter(Boolean),c=s.map(e=>Gi(e)).filter(e=>Lt(e,this.props.validateEmbeddable)&&(/^(http|https):\/\/[^\s/$.?#].[^\s]*$/.test(e)||qs(e)?.type===`video`));if(!r&&c.length>0&&c.length===s.length){let e=[];for(let t of c){let n=e[e.length-1],r=this.insertEmbeddableElement({sceneX:n?n.x+n.width+20:i,sceneY:a,link:Hs(t)});r&&e.push(r)}e.length&&(this.store.scheduleCapture(),this.setState({selectedElementIds:Object.fromEntries(e.map(e=>[e.id,!0]))}));return}this.addTextFromPaste(e.text,r)}async addElementsFromMixedContentPaste(e,{isPlainPaste:t,sceneX:n,sceneY:r}){if(!t&&e.some(e=>e.type===`imageUrl`)&&this.isToolSupported(`image`)){let t=e.filter(e=>e.type===`imageUrl`).map(e=>e.value),i=await Promise.all(t.map(async e=>{try{return{file:await Ja(e)}}catch(e){let t=e.message;return e.cause===`FETCH_ERROR`?t=K(`errors.failedToFetchImage`):e.cause===`UNSUPPORTED`&&(t=K(`errors.unsupportedFileType`)),{errorMessage:t}}})),a=i.filter(e=>!!e.file).map(e=>e.file);await this.insertImages(a,n,r);let o=i.find(e=>!!e.errorMessage);o&&o.errorMessage&&this.setState({errorMessage:o.errorMessage})}else{let n=e.filter(e=>e.type===`text`);n.length&&this.addTextFromPaste(n.map(e=>e.value).join(`
|
|
180
|
+
|
|
181
|
+
`),t)}}addTextFromPaste(e,t=!1){let{x:n,y:r}=la({clientX:this.lastViewportPosition.x,clientY:this.lastViewportPosition.y},this.state),i={x:n,y:r,strokeColor:this.state.currentItemStrokeColor,backgroundColor:this.state.currentItemBackgroundColor,fillStyle:this.state.currentItemFillStyle,strokeWidth:this.state.currentItemStrokeWidth,strokeStyle:this.state.currentItemStrokeStyle,roundness:null,roughness:this.state.currentItemRoughness,opacity:this.state.currentItemOpacity,text:e,fontSize:this.state.currentItemFontSize,fontFamily:this.state.currentItemFontFamily,textAlign:Ns,verticalAlign:`top`,locked:!1},a=u({fontSize:i.fontSize,fontFamily:i.fontFamily}),o=ba(i.fontFamily),[s,,c]=Ue(this.state),l=Math.max(Math.min((c-s)*.5,800),200),d=r,f=t?[e]:e.split(`
|
|
182
|
+
`),p=f.reduce((e,t,r)=>{let s=Va(t).trim();if(s.length){let t=this.getTopLayerFrameAtSceneCoords({x:n,y:d}),r=gn(s,a,o),c=r.width>l,u=c?Jt(s,a,l):s;r=c?gn(u,a,o):r;let f=n-r.width/2,p=d-r.height/2,m=Li({...i,x:f,y:p,text:u,originalText:s,lineHeight:o,autoResize:!c,frameId:t?t.id:null});e.push(m),d+=m.height+10}else f[r-1]?.trim()&&(d+=qo(i.fontSize,o)+10);return e},[]);p.length!==0&&(this.scene.insertElements(p),this.store.scheduleCapture(),this.setState({selectedElementIds:P(Object.fromEntries(p.map(e=>[e.id,!0])),this.state)}),!t&&p.length>1&&Cz===!1&&this.editorInterface.formFactor!==`phone`&&(this.setToast({message:K(`toast.pasteAsSingleElement`,{shortcut:Q(`CtrlOrCmd+Shift+V`)}),duration:5e3}),Cz=!0))}handleTextWysiwyg(e,{isExistingElement:t=!1}){let n=this.scene.getElementsMapIncludingDeleted(),r=(t,r)=>{this.scene.replaceAllElements([...this.scene.getElementsIncludingDeleted().map(i=>i.id===e.id&&M(i)?B(i,{originalText:t,isDeleted:r??i.isDeleted,...he(i,so(i,n),n,t)}):i)])};Zj({id:e.id,canvas:this.canvas,getViewportCoords:(e,t)=>{let{x:n,y:r}=Ci({sceneX:e,sceneY:t},this.state);return[n-this.state.offsetLeft,r-this.state.offsetTop]},onChange:qj(t=>{r(t,!1),Is(e)&&ue(e,this.scene)}),onSubmit:qj(({viaKeyboard:n,nextOriginalText:i})=>{let a=!i.trim();if(r(i,a),!a&&n){let t=e.containerId?e.containerId:e.id;(0,_c.flushSync)(()=>{this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[t]:!0},e)}))})}a&&Go(this.scene.getNonDeletedElements(),[e]),(!a||t)&&this.store.scheduleCapture(),(0,_c.flushSync)(()=>{this.setState({newElement:null,editingTextElement:null})}),this.state.activeTool.locked&&Yw(this.interactiveCanvas,this.state),this.focusContainer()}),element:e,excalidrawContainer:this.excalidrawContainerRef.current,app:this,autoSelect:!this.editorInterface.isTouchScreen}),this.deselectElements(),r(e.originalText,!1)}deselectElements(){this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null})}getTextElementAtPosition(e,t){let n=this.getElementAtPosition(e,t,{includeBoundTextElement:!0});return n&&M(n)&&!n.isDeleted?n:null}getElementAtPosition(e,t,n){let r=[];if(r=n&&`allHitElements`in n?n?.allHitElements||[]:this.getElementsAtPosition(e,t,{includeBoundTextElement:n?.includeBoundTextElement,includeLockedElements:n?.includeLockedElements}),r.length>1){if(n?.preferSelected){for(let e=r.length-1;e>-1;e--)if(this.state.selectedElementIds[r[e].id])return r[e]}let i=r[r.length-1];return Ui({point:O(e,t),element:i,threshold:this.getElementHitThreshold(i)/2,elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(i)?this.frameNameBoundsCache.get(i):null})?i:r[r.length-2]}return r.length===1?r[0]:null}getElementsAtPosition(e,t,n){let r=[],i=this.scene.getNonDeletedElementsMap();return(n?.includeBoundTextElement&&n?.includeLockedElements?this.scene.getNonDeletedElements():this.scene.getNonDeletedElements().filter(e=>(n?.includeLockedElements||!e.locked)&&(n?.includeBoundTextElement||!(M(e)&&e.containerId)))).filter(n=>this.hitElement(e,t,n)).filter(n=>{let r=No(n,i);return r&&this.state.frameRendering.enabled&&this.state.frameRendering.clip?ns({x:e,y:t},r,i):!0}).filter(e=>Vs(e)?(r.push(e),!1):!0).concat(r)}getElementHitThreshold(e){return Math.max(e.strokeWidth/2+.1,.85*(an/this.state.zoom.value))}hitElement(e,t,n,r=!0){return r&&this.state.selectedElementIds[n.id]&&Jo([n],this.state,this.editorInterface)&&Re(O(e,t),n,this.scene.getNonDeletedElementsMap(),this.getElementHitThreshold(n))||Hn(O(e,t),n,this.scene.getNonDeletedElementsMap())?!0:Ui({point:O(e,t),element:n,threshold:this.getElementHitThreshold(n),elementsMap:this.scene.getNonDeletedElementsMap(),frameNameBound:L(n)?this.frameNameBoundsCache.get(n):null})}getTextBindableContainerAtPosition(e,t){let n=this.scene.getNonDeletedElements(),r=this.scene.getSelectedElements(this.state);if(r.length===1)return k(r[0],!1)?r[0]:null;let i=null;for(let r=n.length-1;r>=0;--r){if(n[r].isDeleted)continue;let[a,o,s,c]=ei(n[r],this.scene.getNonDeletedElementsMap());if(jt(n[r])&&Ui({point:O(e,t),element:n[r],elementsMap:this.scene.getNonDeletedElementsMap(),threshold:this.getElementHitThreshold(n[r])})){i=n[r];break}else if(a<e&&e<s&&o<t&&t<c){i=n[r];break}}return k(i,!1)?i:null}handleHoverSelectedLinearElement(e,t,n){let r=this.scene.getNonDeletedElementsMap(),i=I.getElement(e.elementId,r);if(i)if(this.state.selectedLinearElement){let a=-1,o=null;Ui({point:O(t,n),element:i,elementsMap:r,threshold:this.getElementHitThreshold(i)})?(a=I.getPointIndexUnderCursor(i,r,this.state.zoom,t,n),o=I.getSegmentMidpointHitCoords(e,{x:t,y:n},this.state,this.scene.getNonDeletedElementsMap()),(dr(i)?a===0||a===i.points.length-1:a>=0)||o?Gw(this.interactiveCanvas,Kn.POINTER):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE)):this.hitElement(t,n,i)&&(!dr(i)||!(i.startBinding||i.endBinding))&&(this.state.activeTool.type!==`lasso`||Object.keys(this.state.selectedElementIds).length>0)&&Gw(this.interactiveCanvas,Kn.MOVE),this.state.selectedLinearElement.hoverPointIndex!==a&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,hoverPointIndex:a}}),I.arePointsEqual(this.state.selectedLinearElement.segmentMidPointHoveredCoords,o)||this.setState({selectedLinearElement:{...this.state.selectedLinearElement,segmentMidPointHoveredCoords:o}});let s=null,c=i;(c.startBinding||c.endBinding)&&(s=La(i,t,n,this.scene,this.state)),this.state.selectedLinearElement.hoveredFocusPointBinding!==s&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1,hoveredFocusPointBinding:s}}),s&&Gw(this.interactiveCanvas,Kn.POINTER)}else Gw(this.interactiveCanvas,Kn.AUTO)}updateGestureOnPointerDown(e){Tz.pointers.set(e.pointerId,{x:e.clientX,y:e.clientY}),Tz.pointers.size===2&&(Tz.lastCenter=mj(Tz.pointers),Tz.initialScale=this.state.zoom.value,Tz.initialDistance=hj(Array.from(Tz.pointers.values())))}initialPointerDownState(e){let t=la(e,this.state),n=this.scene.getSelectedElements(this.state),[r,i,a,o]=Ii(n),s=n.findIndex(dr)===0;return{origin:t,withCmdOrCtrl:e[N.CTRL_OR_CMD],originInGrid:pt(It(t.x,t.y,e[N.CTRL_OR_CMD]||s?null:this.getEffectiveGridSize())),scrollbars:nM(_z,e.clientX-this.state.offsetLeft,e.clientY-this.state.offsetTop),lastCoords:{...t},originalElements:this.scene.getNonDeletedElements().reduce((e,t)=>(e.set(t.id,qn(t)),e),new Map),resize:{handleType:!1,isResizing:!1,offset:{x:0,y:0},arrowDirection:`origin`,center:{x:(a+r)/2,y:(o+i)/2}},hit:{element:null,allHitElements:[],wasAddedToSelection:!1,hasBeenDuplicated:!1,hasHitCommonBoundingBoxOfSelectedElements:this.isHittingCommonBoundingBoxOfSelectedElements(t,n)},drag:{hasOccurred:!1,offset:null,origin:{...t},blockDragging:!1},eventListeners:{onMove:null,onUp:null,onKeyUp:null,onKeyDown:null},boxSelection:{hasOccurred:!1}}}handleDraggingScrollBar(e,t){if(!(t.scrollbars.isOverEither&&!this.state.multiElement))return!1;gz=!0,t.lastCoords.x=e.clientX,t.lastCoords.y=e.clientY;let n=Jj(e=>{e.target instanceof HTMLElement&&this.handlePointerMoveOverScrollbars(e,t)}),r=qj(()=>{wz=null,gz=!1,Yw(this.interactiveCanvas,this.state),this.setState({cursorButton:`up`}),this.savePointer(e.clientX,e.clientY,`up`),window.removeEventListener(F.POINTER_MOVE,n),window.removeEventListener(F.POINTER_UP,r),n.flush()});return wz=r,window.addEventListener(F.POINTER_MOVE,n),window.addEventListener(F.POINTER_UP,r),!0}isASelectedElement(e){return e!=null&&this.state.selectedElementIds[e.id]}isHittingCommonBoundingBoxOfSelectedElements(e,t){if(t.length<2)return!1;let n=Math.max(an/this.state.zoom.value,1),[r,i,a,o]=Ii(t);return e.x>r-n&&e.x<a+n&&e.y>i-n&&e.y<o+n}getCurrentItemRoundness(e){return this.state.currentItemRoundness===`round`?{type:Ga(e)?Xa.ADAPTIVE_RADIUS:Xa.PROPORTIONAL_RADIUS}:null}maybeCacheReferenceSnapPoints(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getReferenceSnapPoints())&&xj.setReferenceSnapPoints(kj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}maybeCacheVisibleGaps(e,t,n=!1){Cj({event:e,app:this,selectedElements:t})&&(n||!xj.getVisibleGaps())&&xj.setVisibleGaps(Dj(this.scene.getNonDeletedElements(),t,this.state,this.scene.getNonDeletedElementsMap()))}onKeyDownFromPointerDownHandler(e){return qj(t=>{this.maybeHandleResize(e,t)||this.maybeDragNewGenericElement(e,t)})}onKeyUpFromPointerDownHandler(e){return qj(t=>{t.key===N.ALT&&t.preventDefault(),!this.maybeHandleResize(e,t)&&this.maybeDragNewGenericElement(e,t)})}onPointerMoveFromPointerDownHandler(e){return Jj(t=>{if(this.state.openDialog?.name===`elementLinkSelector`)return;let n=la(t,this.state);if(this.state.activeLockedId&&this.setState({activeLockedId:null}),this.state.selectedLinearElement&&this.state.selectedLinearElement.elbowed&&this.state.selectedLinearElement.initialState.segmentMidpoint.index){let[e,r]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),i=this.state.selectedLinearElement.initialState.segmentMidpoint.index;if(i<0){let t=I.getSegmentMidpointHitCoords({...this.state.selectedLinearElement,segmentMidPointHoveredCoords:null},{x:e,y:r},this.state,this.scene.getNonDeletedElementsMap());i=t?I.getSegmentMidPointIndex(this.state.selectedLinearElement,this.state,t,this.scene.getNonDeletedElementsMap()):-1}let a=I.moveFixedSegment(this.state.selectedLinearElement,i,e,r,this.scene);this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!0,segmentMidPointHoveredCoords:a.segmentMidPointHoveredCoords,initialState:a.initialState}});return}let r=this.previousPointerMoveCoords??e.origin;if(this.previousPointerMoveCoords=n,e.drag.offset===null&&(e.drag.offset=pt(Qa(this.scene.getSelectedElements(this.state),e.origin.x,e.origin.y))),!(t.target instanceof HTMLElement)||this.handlePointerMoveOverScrollbars(t,e))return;if(zr(this.state)){this.handleEraser(t,n);return}this.state.activeTool.type===`laser`&&this.laserTrails.addPointToPath(n.x,n.y);let[i,a]=It(n.x,n.y,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize());if(e.resize.isResizing&&(e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeHandleCrop(e,t)||this.maybeHandleResize(e,t)))return!0;let o=this.scene.getNonDeletedElementsMap();if(this.state.selectedLinearElement){let r=this.state.selectedLinearElement;if(r.draggedFocusPointBinding){Pr(r,o,n,this.scene,this.state,this.getEffectiveGridSize(),t.altKey),this.setState({selectedLinearElement:{...r,isDragging:!1,selectedPointsIndices:[],initialState:{...r.initialState,lastClickedPoint:-1}}});return}if(I.shouldAddMidpoint(this.state.selectedLinearElement,n,this.state,o)){let e=I.addMidpoint(this.state.selectedLinearElement,n,this,!t[N.CTRL_OR_CMD],this.scene);if(!e)return;(0,_c.flushSync)(()=>{this.state.selectedLinearElement&&this.setState({selectedLinearElement:{...this.state.selectedLinearElement,initialState:e.pointerDownState,selectedPointsIndices:e.selectedPointsIndices,segmentMidPointHoveredCoords:null}})});return}else{if(r.initialState.segmentMidpoint.value!==null&&!r.initialState.segmentMidpoint.added)return;if(r.initialState.lastClickedPoint>-1){let i=I.getElement(r.elementId,o);if(i?.isDeleted)return;if(ss(i)){let e=go(O(n.x,n.y),this.scene.getNonDeletedElements(),o);Ys(`COMPLEX_BINDINGS`)&&this.handleDelayedBindModeChange(i,e)}if(t.altKey&&!this.state.selectedLinearElement?.initialState?.arrowStartIsInside&&Ys(`COMPLEX_BINDINGS`)&&this.handleSkipBindMode(),r.initialState.lastClickedPoint===-1)return;let a=I.handlePointDragging(t,this,n.x,n.y,r);if(a){e.lastCoords.x=n.x,e.lastCoords.y=n.y,e.drag.hasOccurred=!0,(a.suggestedBinding!==this.state.suggestedBinding||!ji(a.selectedLinearElement?.selectedPointsIndices??[],this.state.selectedLinearElement?.selectedPointsIndices??[])||a.selectedLinearElement?.hoverPointIndex!==this.state.selectedLinearElement?.hoverPointIndex||a.selectedLinearElement?.customLineAngle!==this.state.selectedLinearElement?.customLineAngle||this.state.selectedLinearElement.isDragging!==a.selectedLinearElement?.isDragging||this.state.selectedLinearElement?.initialState?.altFocusPoint!==a.selectedLinearElement?.initialState?.altFocusPoint)&&this.setState(a);return}}}}let s=e.hit.allHitElements.some(e=>this.isASelectedElement(e)),c=this.state.selectedLinearElement?.isEditing&&t.shiftKey&&this.state.selectedLinearElement.elementId===e.hit.element?.id;if((s||e.hit.hasHitCommonBoundingBoxOfSelectedElements)&&!c&&!e.drag.blockDragging){let i=this.scene.getSelectedElements(this.state);if(i.length>0&&i.every(e=>e.locked))return;let a=i.find(e=>L(e)),s=this.getTopLayerFrameAtSceneCoords(n),c=s&&!a?s:null;if(this.state.frameToHighlight!==c&&(0,_c.flushSync)(()=>{this.setState({frameToHighlight:c})}),e.drag.hasOccurred=!0,this.state.activeTool.type===`lasso`&&this.lassoTrail.hasCurrentTrail&&!(this.editorInterface.formFactor!==`desktop`&&e.hit.element)&&!this.state.activeTool.fromSelection)return;if(this.state.activeTool.type===`lasso`&&i.length>0&&e.drag.hasOccurred&&!this.state.activeTool.fromSelection&&this.lassoTrail.endPath(),i.length>0&&!e.withCmdOrCtrl&&!this.state.editingTextElement&&this.state.activeEmbeddable?.state!==`active`){let a={x:n.x-e.drag.origin.x,y:n.y-e.drag.origin.y},s=[...e.originalElements.values()],c=t.shiftKey;if(c){let e=Math.abs(a.x),t=Math.abs(a.y),n=c&&e<t,r=c&&e>t;n&&(a.x=0),r&&(a.y=0)}if(this.state.croppingElementId){let t=this.scene.getNonDeletedElementsMap().get(this.state.croppingElementId);if(t&&io(t)&&t.crop!==null&&e.hit.element===t){let e=t.crop,i=d(t)&&this.imageCache.get(t.fileId)?.image;if(i&&!(i instanceof Promise)){let a=A(t),s=nr(n.x-r.x,n.y-r.y);s[0]*=i.naturalWidth/a.width,s[1]*=i.naturalHeight/a.height;let[c,l,u,d,f,p]=ei(t,o),m=Mn(ke(O(c,l),O(f,p),t.angle)),h=Mn(ke(O(u,l),O(f,p),t.angle)),g=Mn(ke(O(c,d),O(f,p),t.angle)),_=Zt(y(h,m)),v=Zt(y(g,m)),b=nr(ys(s,_),ys(s,v)),x={...e,x:Ht(e.x-b[0]*Math.sign(t.scale[0]),0,i.naturalWidth-e.width),y:Ht(e.y-b[1]*Math.sign(t.scale[1]),0,i.naturalHeight-e.height)};this.scene.mutateElement(t,{crop:x});return}}}this.maybeCacheVisibleGaps(t,i),this.maybeCacheReferenceSnapPoints(t,i);let{snapOffset:l,snapLines:u}=jj(s,a,this,t,this.scene.getNonDeletedElementsMap());if(this.setState({snapLines:u}),this.state.editingFrame||bo(e,i,a,this.scene,l,t[N.CTRL_OR_CMD]?null:this.getEffectiveGridSize()),this.setState({selectedElementsAreBeingDragged:!0,selectionElement:null}),t.altKey&&!e.hit.hasBeenDuplicated){e.hit.hasBeenDuplicated=!0;let n=this.scene.getElementsIncludingDeleted(),r=e.hit.element,i=this.scene.getSelectedElements({selectedElementIds:this.state.selectedElementIds,includeBoundTextElement:!0,includeElementsInFrames:!0});r&&e.hit.wasAddedToSelection&&!i.find(e=>e.id===r.id)&&i.push(r);let a=new Map(i.map(e=>[e.id,e])),{duplicatedElements:o,duplicateElementsMap:s,elementsWithDuplicates:c,origIdToDuplicateId:l}=Er({type:`in-place`,elements:n,appState:this.state,randomizeSeed:!0,idsOfElementsToDuplicate:a,overrides:({duplicateElement:e,origElement:t})=>({frameId:e.frameId??t.frameId,seed:se()})});o.forEach(t=>{e.originalElements.set(t.id,qn(t))});let u=c.map(t=>{if(a.has(t.id)){let n=e.originalElements.get(t.id);if(n)return B(t,{x:n.x,y:n.y})}return t}),d=this.props.onDuplicate?.(u,n),f=fe(d||u,lr(o));(0,_c.flushSync)(()=>{if(e.hit.element){let t=l.get(e.hit.element.id),n=t&&s.get(t);e.hit.element=n||null}e.hit.allHitElements=e.hit.allHitElements.reduce((e,t)=>{let n=l.get(t.id),r=n&&s.get(n);return r&&e.push(r),e},[]),e.drag.origin=la(t,this.state),this.setState(e=>({...Br(o,this.scene.getNonDeletedElements(),e)})),this.scene.replaceAllElements(f),i.forEach(e=>{un(e)&&e.boundElements?.some(e=>e.type===`arrow`)&&ue(e,this.scene)}),this.maybeCacheVisibleGaps(t,i,!0),this.maybeCacheReferenceSnapPoints(t,i,!0)})}return}}if(this.state.selectionElement){if(e.lastCoords.x=n.x,e.lastCoords.y=n.y,t.altKey){this.setActiveTool({type:`lasso`,fromSelection:!0},t.shiftKey),this.lassoTrail.startPath(e.origin.x,e.origin.y,t.shiftKey),this.setAppState({selectionElement:null});return}this.maybeDragNewGenericElement(e,t)}else if(this.state.activeTool.type===`lasso`)!t.altKey&&this.state.activeTool.fromSelection?(this.setActiveTool({type:`selection`}),this.createGenericElementOnPointerDown(`selection`,e),e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t),this.lassoTrail.endPath()):this.lassoTrail.addPointToPath(n.x,n.y,t.shiftKey);else{let r=this.state.newElement;if(!r)return;if(r.type===`freedraw`){let e=r.points,i=n.x-r.x,a=n.y-r.y,o=e.length>0&&e[e.length-1];if(!(o&&o[0]===i&&o[1]===a)){let n=r.simulatePressure?r.pressures:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...e,O(i,a)],pressures:n},{informMutation:!1,isDragging:!1}),this.setState({newElement:r})}}else if(b(r)&&!r.isDeleted){e.drag.hasOccurred=!0;let n=r.points;gt(n.length>1,`Do not create linear elements with less than 2 points`);let o=this.state.selectedLinearElement;o||=(o=new I(r,this.scene.getNonDeletedElementsMap()),{...o,selectedPointsIndices:[1],initialState:{...o.initialState,lastClickedPoint:1}}),this.setState({newElement:r,...I.handlePointDragging(t,this,i,a,o)})}else e.lastCoords.x=n.x,e.lastCoords.y=n.y,this.maybeDragNewGenericElement(e,t,!1)}if(this.state.activeTool.type===`selection`){e.boxSelection.hasOccurred=!0;let n=this.scene.getNonDeletedElements();if(this.state.selectedLinearElement?.isEditing)I.handleBoxSelection(t,this.state,this.setState.bind(this),this.scene.getNonDeletedElementsMap());else{let r=!0;!t.shiftKey&&Ya(n,this.state)&&(e.withCmdOrCtrl&&e.hit.element?this.setState(t=>Hr({...t,selectedElementIds:{[e.hit.element.id]:!0}},this.scene.getNonDeletedElements(),t,this)):r=!1);let i=this.state.selectionElement?Ta(n,this.state.selectionElement,this.scene.getNonDeletedElementsMap(),!1):[];this.setState(t=>{let n={...r&&t.selectedElementIds,...i.reduce((e,t)=>(e[t.id]=!0,e),{})};return e.hit.element&&(i.length?delete n[e.hit.element.id]:n[e.hit.element.id]=!0),t=r?t:{...t,selectedGroupIds:{},editingGroupId:null},{...Hr({editingGroupId:t.editingGroupId,selectedElementIds:n},this.scene.getNonDeletedElements(),t,this),selectedLinearElement:i.length===1&&b(i[0])?new I(i[0],this.scene.getNonDeletedElementsMap()):null,showHyperlinkPopup:i.length===1&&(i[0].link||rs(i[0]))?`info`:!1}})}}})}handlePointerMoveOverScrollbars(e,t){if(t.scrollbars.isOverHorizontal){let n=e.clientX,r=n-t.lastCoords.x;return this.translateCanvas({scrollX:this.state.scrollX-r*(_z.horizontal?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.x=n,!0}if(t.scrollbars.isOverVertical){let n=e.clientY,r=n-t.lastCoords.y;return this.translateCanvas({scrollY:this.state.scrollY-r*(_z.vertical?.deltaMultiplier||1)/this.state.zoom.value}),t.lastCoords.y=n,!0}return!1}onPointerUpFromPointerDownHandler(e){return qj(t=>{let n=this.scene.getNonDeletedElementsMap();this.removePointer(t),e.drag.blockDragging=!1,e.eventListeners.onMove&&e.eventListeners.onMove.flush();let{newElement:r,resizingElement:i,croppingElementId:a,multiElement:o,activeTool:s,isResizing:c,isRotating:l,isCropping:d}=this.state;this.setState(e=>({isResizing:!1,isRotating:!1,isCropping:!1,resizingElement:null,selectionElement:null,frameToHighlight:null,elementsToHighlight:null,cursorButton:`up`,snapLines:tr(e.snapLines,[]),originSnapOffset:null})),this.lassoTrail.endPath(),this.previousPointerMoveCoords=null,xj.setReferenceSnapPoints(null),xj.setVisibleGaps(null),this.savePointer(t.clientX,t.clientY,`up`);let f=e.hit.allHitElements,p=la({clientX:t.clientX,clientY:t.clientY},this.state);if(this.state.activeTool.type===`selection`&&!e.boxSelection.hasOccurred&&!e.resize.isResizing&&!f.some(e=>this.state.selectedElementIds[e.id])){let e=this.getElementAtPosition(p.x,p.y,{includeLockedElements:!0});this.store.scheduleCapture(),e?.locked?this.setState({activeLockedId:e.groupIds.length>0?e.groupIds.at(-1)||``:e.id}):this.setState({activeLockedId:null})}else this.setState({activeLockedId:null});if(Ys(`COMPLEX_BINDINGS`)&&this.resetDelayedBindMode(),this.setState({selectedElementsAreBeingDragged:!1,bindMode:`orbit`}),e.drag.hasOccurred&&e.hit?.element?.id){let t=n.get(e.hit.element.id);un(t)&&t.boundElements?.filter(e=>e.type===`arrow`).map(e=>n.get(e.id)).filter(e=>dr(e)).forEach(e=>{e&&this.scene.mutateElement(e,{})})}if(this.state.selectedLinearElement?.isEditing&&!this.state.newElement&&this.state.selectedLinearElement.draggedFocusPointBinding===null)if(!e.boxSelection.hasOccurred&&e.hit?.element?.id!==this.state.selectedLinearElement.elementId&&this.state.selectedLinearElement.draggedFocusPointBinding===null)this.actionManager.executeAction(oT);else{let e=I.handlePointerUp(t,this.state.selectedLinearElement,this.state,this.scene);this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),e!==this.state.selectedLinearElement&&this.setState({selectedLinearElement:e,suggestedBinding:null})}else if(this.state.selectedLinearElement){if(this.state.selectedLinearElement.elbowed){let e=I.getElement(this.state.selectedLinearElement.elementId,this.scene.getNonDeletedElementsMap());e&&this.scene.mutateElement(e,{})}if(this.state.selectedLinearElement.draggedFocusPointBinding?(yr(this.state.selectedLinearElement,this.scene),this.setState({selectedLinearElement:{...this.state.selectedLinearElement,draggedFocusPointBinding:null}})):e.hit?.element?.id===this.state.selectedLinearElement.elementId?this.state.selectedLinearElement.isDragging&&(this.setState({selectedLinearElement:{...this.state.selectedLinearElement,isDragging:!1}}),this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p})):this.scene.getSelectedElements(this.state).length>1&&this.setState({selectedLinearElement:null}),this.state.newElement&&this.state.multiElement&&b(this.state.newElement)&&this.state.selectedLinearElement){let{multiElement:e}=this.state;this.setState({selectedLinearElement:{...this.state.selectedLinearElement,lastCommittedPoint:e.points[e.points.length-1]}})}}if(this.missingPointerEventCleanupEmitter.clear(),window.removeEventListener(F.POINTER_MOVE,e.eventListeners.onMove),window.removeEventListener(F.POINTER_UP,e.eventListeners.onUp),window.removeEventListener(F.KEYDOWN,e.eventListeners.onKeyDown),window.removeEventListener(F.KEYUP,e.eventListeners.onKeyUp),this.props?.onPointerUp?.(s,e),this.onPointerUpEmitter.trigger(this.state.activeTool,e,t),r?.type===`freedraw`){let e=la(t,this.state),n=r.points,i=e.x-r.x,a=e.y-r.y;i===n[0][0]&&a===n[0][1]&&(a+=1e-4,i+=1e-4);let o=r.simulatePressure?[]:[...r.pressures,t.pressure];this.scene.mutateElement(r,{points:[...n,O(i,a)],pressures:o}),this.actionManager.executeAction(oT);return}if(b(r)){r.points.length>1&&r.points[1][0]!==0&&r.points[1][1]!==0&&this.store.scheduleCapture();let n=la(t,this.state),i=Se(O(n.x,n.y),O(e.origin.x,e.origin.y))*this.state.zoom.value;if((!e.drag.hasOccurred||i<20)&&r&&!o)if(this.editorInterface.isTouchScreen){let e=Math.min(this.state.width*.7/this.state.zoom.value,100);this.scene.mutateElement(r,{x:r.x-e/2,points:[O(0,0),O(e,0)]},{informMutation:!1,isDragging:!1}),this.actionManager.executeAction(oT)}else{let e=n.x-r.x,t=n.y-r.y;this.scene.mutateElement(r,{points:[r.points[0],O(e,t)]},{informMutation:!1,isDragging:!1}),this.setState({multiElement:r,newElement:r})}else e.drag.hasOccurred&&!o&&(b(r)&&this.actionManager.executeAction(oT,`ui`,{event:t,sceneCoords:p}),this.setState({suggestedBinding:null,startBoundElement:null}),s.locked?this.setState(e=>({newElement:null})):(Ww(this.interactiveCanvas),this.setState(e=>({newElement:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type}),selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),selectedLinearElement:new I(r,this.scene.getNonDeletedElementsMap())}))),this.scene.triggerUpdate());return}if(M(r)){let e=Ve(u({fontSize:r.fontSize,fontFamily:r.fontFamily}),r.lineHeight);r.width<e&&this.scene.mutateElement(r,{autoResize:!0}),this.resetCursor(),this.handleTextWysiwyg(r,{isExistingElement:!0})}if(s.type!==`selection`&&r&&na(r)){this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==r.id),appState:{newElement:null},captureUpdate:V.NEVER});return}if(L(r)){let e=zi(this.scene.getElementsIncludingDeleted(),r,this.scene.getNonDeletedElementsMap());this.scene.replaceAllElements(Je(this.scene.getElementsMapIncludingDeleted(),e,r,this.state))}if(r&&(this.scene.mutateElement(r,$i(r),{informMutation:!1,isDragging:!1}),this.scene.triggerUpdate()),e.drag.hasOccurred){let e=la(t,this.state);if(this.state.selectedLinearElement&&this.state.selectedLinearElement.isDragging){let e=this.scene.getElement(this.state.selectedLinearElement.elementId);if(e?.frameId){let t=No(e,n);t&&e&&(pr(e,t,this.scene.getNonDeletedElementsMap())||(this.scene.mutateElement(e,{groupIds:[]}),Pi([e],this.scene.getNonDeletedElementsMap()),this.scene.triggerUpdate()))}}else{let t=this.getTopLayerFrameAtSceneCoords(e),n=this.scene.getSelectedElements(this.state),r=this.scene.getElementsMapIncludingDeleted(),i=e=>{if(e.length>0){for(let t of e){let e=t.groupIds.indexOf(this.state.editingGroupId);this.scene.mutateElement(t,{groupIds:t.groupIds.slice(0,e)},{informMutation:!1,isDragging:!1})}r.forEach(e=>{e.groupIds.length&&Ki(r,e.groupIds[e.groupIds.length-1]).length<2&&this.scene.mutateElement(e,{groupIds:[]},{informMutation:!1,isDragging:!1})}),this.setState({editingGroupId:null})}};if(t&&!this.state.selectedElementIds[t.id]){let e=n.filter(e=>e.frameId!==t.id&&qr(e,r,this.state));this.state.editingGroupId&&i(e),r=Je(r,e,t,this.state)}else !t&&this.state.editingGroupId&&i(n.filter(e=>e.frameId&&!qr(e,r,this.state)));r=lo(r,this.state,this),this.scene.replaceAllElements(r)}}if(i&&this.store.scheduleCapture(),i&&na(i)&&this.updateScene({elements:this.scene.getElementsIncludingDeleted().filter(e=>e.id!==i.id),captureUpdate:V.NEVER}),e.resize.isResizing){let e=lo(this.scene.getElementsIncludingDeleted(),this.state,this),t=this.scene.getSelectedElements(this.state).filter(e=>L(e));for(let r of t)e=Ai(e,kn(this.scene.getElementsIncludingDeleted(),r,this.state,n),r,this);this.scene.replaceAllElements(e)}let m=e.hit.element;this.state.selectedLinearElement?.elementId!==m?.id&&b(m)&&this.scene.getSelectedElements(this.state).length===1&&this.setState({selectedLinearElement:new I(m,this.scene.getNonDeletedElementsMap())}),(!a||a&&(!m&&!d||m&&m.id!==a))&&this.finishImageCropping();let h=this.lastPointerDownEvent,g=this.lastPointerUpEvent||this.lastPointerMoveEvent;if(zr(this.state)&&h&&g){if(this.eraserTrail.endPath(),Se(O(h.clientX,h.clientY),O(g.clientX,g.clientY))===0){let e=la({clientX:g.clientX,clientY:g.clientY},this.state);this.getElementsAtPosition(e.x,e.y).forEach(e=>this.elementsPendingErasure.add(e.id))}this.eraseElements();return}else this.elementsPendingErasure.size&&this.restoreReadyToEraseElements();if(m&&!e.drag.hasOccurred&&!e.hit.wasAddedToSelection&&(!this.state.selectedLinearElement?.isEditing||!e.boxSelection.hasOccurred)&&this.state.activeTool.type!==`lasso`&&(t.shiftKey&&!this.state.selectedLinearElement?.isEditing?this.state.selectedElementIds[m.id]?ft(this.state,m)?this.setState(e=>{let t={...e.selectedElementIds};for(let e of m.groupIds.flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)))delete t[e.id];return{selectedGroupIds:{...e.selectedElementIds,...m.groupIds.map(e=>({[e]:!1})).reduce((e,t)=>({...e,...t}),{})},selectedElementIds:P(t,e)}}):this.state.selectedLinearElement?.isDragging||this.setState(e=>{let t={...e.selectedElementIds};delete t[m.id];let n=ir(this.scene.getNonDeletedElements(),{selectedElementIds:t});return{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:n.length===1&&b(n[0])?new I(n[0],this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}}):m.frameId&&this.state.selectedElementIds[m.frameId]?this.setState(e=>{let t={...e.selectedElementIds,[m.id]:!0};return delete t[m.frameId],(this.scene.getElement(m.frameId)?.groupIds??[]).flatMap(e=>Ki(this.scene.getNonDeletedElements(),e)).forEach(e=>{delete t[e.id]}),{...Hr({editingGroupId:e.editingGroupId,selectedElementIds:t},this.scene.getNonDeletedElements(),e,this),showHyperlinkPopup:m.link||rs(m)?`info`:!1}}):this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[m.id]:!0},e)})):this.setState(e=>({...Hr({editingGroupId:e.editingGroupId,selectedElementIds:{[m.id]:!0}},this.scene.getNonDeletedElements(),e,this),selectedLinearElement:b(m)&&e.selectedLinearElement?.elementId!==m.id?new I(m,this.scene.getNonDeletedElementsMap()):e.selectedLinearElement}))),this.state.activeTool.type!==`lasso`&&!(m&&dr(m))&&!e.drag.hasOccurred&&!this.state.isResizing&&(m&&vt({point:O(e.origin.x,e.origin.y),element:m,elementsMap:n,threshold:this.getElementHitThreshold(m),frameNameBound:L(m)?this.frameNameBoundsCache.get(m):null},n)||!m&&e.hit.hasHitCommonBoundingBoxOfSelectedElements)){this.state.selectedLinearElement?.isEditing?this.actionManager.executeAction(XA):this.setState({selectedElementIds:P({},this.state),selectedGroupIds:{},editingGroupId:null,activeEmbeddable:null}),Gw(this.interactiveCanvas,Kn.AUTO);return}if(!s.locked&&s.type!==`freedraw`&&r&&this.setState(e=>({selectedElementIds:P({...e.selectedElementIds,[r.id]:!0},e),showHyperlinkPopup:rs(r)&&!r.link?`editor`:e.showHyperlinkPopup})),(s.type!==`selection`||Ya(this.scene.getNonDeletedElements(),this.state)||!ji(this.state.previousSelectedElementIds,this.state.selectedElementIds))&&this.store.scheduleCapture(),(e.drag.hasOccurred&&!this.state.selectedLinearElement||c||l||d)&&Bo(this.scene.getSelectedElements(this.state).filter(jt),this.scene,this.state),s.type===`laser`){this.laserTrails.endPath();return}!s.locked&&s.type!==`freedraw`&&(s.type!==`lasso`||s.type===`lasso`&&s.fromSelection)?(Ww(this.interactiveCanvas),this.setState({newElement:null,suggestedBinding:null,activeTool:ka(this.state,{type:this.state.preferredSelectionTool.type})})):this.setState({newElement:null,suggestedBinding:null})})}clearSelection(e){this.setState(t=>({selectedElementIds:P({},t),activeEmbeddable:null,selectedGroupIds:{},editingGroupId:t.editingGroupId&&e!=null&&Lo(e,t.editingGroupId)?t.editingGroupId:null})),this.setState({selectedElementIds:P({},this.state),activeEmbeddable:null,previousSelectedElementIds:this.state.selectedElementIds,selectedLinearElement:null})}getTextWysiwygSnappedToCenterPosition(e,t,n,r){if(r){let i=r.x+r.width/2,a=r.y+r.height/2,o=nn(r,n,this.scene.getNonDeletedElementsMap());if(o&&(i=o.x,a=o.y),Math.hypot(e-i,t-a)<30){let{x:e,y:t}=Ci({sceneX:i,sceneY:a},n);return{viewportX:e,viewportY:t,elementCenterX:i,elementCenterY:a}}}}getCanvasOffsets(){if(this.excalidrawContainerRef?.current){let{left:e,top:t}=this.excalidrawContainerRef.current.getBoundingClientRect();return{offsetLeft:e,offsetTop:t}}return{offsetLeft:0,offsetTop:0}}async updateLanguage(){await jy(Dy.find(e=>e.code===this.props.langCode)||Ey),this.setAppState({})}};(h()||Vt())&&(window.h=window.h||{},Object.defineProperties(window.h,{elements:{configurable:!0,get(){return this.app?.scene.getElementsIncludingDeleted()},set(e){return this.app?.scene.replaceAllElements(ho(e))}},scene:{configurable:!0,get(){return this.app?.scene}}}));var Dz=Ez,Oz=e=>{let[t,n]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let t=async()=>{await jy(r),n(!1)},r=Dy.find(t=>t.code===e.langCode)||Ey;t()},[e.langCode]),t?(0,W.jsx)(CN,{theme:e.theme}):e.children},kz=({children:e})=>{let{FooterCenterTunnel:t}=gk(),n=gC();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:U(`footer-center zen-mode-transition`,{"layer-ui__wrapper__footer-left--transition-bottom":n.zenModeEnabled}),children:e})})};kz.displayName=`FooterCenter`;var Az=({isCollaborating:e,onSelect:t,editorInterface:n,...r})=>{let i=gC(),a=n?.formFactor!==`desktop`||i.width<1440;return(0,W.jsxs)(QO,{...r,className:U(`collab-button`,{active:e}),type:`button`,onSelect:t,style:{position:`relative`,width:a?void 0:`auto`},title:K(`labels.liveCollaboration`),children:[a?zb:K(`labels.share`),i.collaborators.size>0&&(0,W.jsx)(`div`,{className:`CollabButton-collaborators`,children:i.collaborators.size})]})};Az.displayName=`LiveCollaborationTrigger`;var jz=()=>(0,W.jsx)(`svg`,{viewBox:`0 0 40 40`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,className:`ExcalidrawLogo-icon`,children:(0,W.jsx)(`path`,{d:`M39.9 32.889a.326.326 0 0 0-.279-.056c-2.094-3.083-4.774-6-7.343-8.833l-.419-.472a.212.212 0 0 0-.056-.139.586.586 0 0 0-.167-.111l-.084-.083-.056-.056c-.084-.167-.28-.278-.475-.167-.782.39-1.507.973-2.206 1.528-.92.722-1.842 1.445-2.708 2.25a8.405 8.405 0 0 0-.977 1.028c-.14.194-.028.361.14.444-.615.611-1.23 1.223-1.843 1.861a.315.315 0 0 0-.084.223c0 .083.056.166.111.194l1.09.833v.028c1.535 1.528 4.244 3.611 7.12 5.861.418.334.865.667 1.284 1 .195.223.39.473.558.695.084.11.28.139.391.055.056.056.14.111.196.167a.398.398 0 0 0 .167.056.255.255 0 0 0 .224-.111.394.394 0 0 0 .055-.167c.029 0 .028.028.056.028a.318.318 0 0 0 .224-.084l5.082-5.528a.309.309 0 0 0 0-.444Zm-14.63-1.917a.485.485 0 0 0 .111.14c.586.5 1.2 1 1.843 1.555l-2.569-1.945-.251-.166c-.056-.028-.112-.084-.168-.111l-.195-.167.056-.056.055-.055.112-.111c.866-.861 2.346-2.306 3.1-3.028-.81.805-2.43 3.167-2.095 3.944Zm8.767 6.89-2.122-1.612a44.713 44.713 0 0 0-2.625-2.5c1.145.861 2.122 1.611 2.262 1.75 1.117.972 1.06.806 1.815 1.445l.921.666a1.06 1.06 0 0 1-.251.25Zm.558.416-.056-.028c.084-.055.168-.111.252-.194l-.196.222ZM1.089 5.75c.055.361.14.722.195 1.056.335 1.833.67 3.5 1.284 4.75l.252.944c.084.361.223.806.363.917 1.424 1.25 3.602 3.11 5.947 4.889a.295.295 0 0 0 .363 0s0 .027.028.027a.254.254 0 0 0 .196.084.318.318 0 0 0 .223-.084c2.988-3.305 5.221-6.027 6.813-8.305.112-.111.14-.278.14-.417.111-.111.195-.25.307-.333.111-.111.111-.306 0-.39l-.028-.027c0-.055-.028-.139-.084-.167-.698-.666-1.2-1.138-1.731-1.638-.922-.862-1.871-1.75-3.881-3.75l-.028-.028c-.028-.028-.056-.056-.112-.056-.558-.194-1.703-.389-3.127-.639C6.087 2.223 3.21 1.723.614.944c0 0-.168 0-.196.028l-.083.084c-.028.027-.056.055-.224.11h.056-.056c.028.167.028.278.084.473 0 .055.112.5.112.555l.782 3.556Zm15.496 3.278-.335-.334c.084.112.196.195.335.334Zm-3.546 4.666-.056.056c0-.028.028-.056.056-.056Zm-2.038-10c.168.167.866.834 1.033.973-.726-.334-2.54-1.167-3.379-1.445.838.167 1.983.334 2.346.472ZM1.424 2.306c.419.722.754 3.222 1.089 5.666-.196-.778-.335-1.555-.503-2.278-.251-1.277-.503-2.416-.838-3.416.056 0 .14 0 .252.028Zm-.168-.584c-.112 0-.223-.028-.307-.028 0-.027 0-.055-.028-.055.14 0 .223.028.335.083Zm-1.089.222c0-.027 0-.027 0 0ZM39.453 1.333c.028-.11-.558-.61-.363-.639.42-.027.42-.666 0-.666-.558.028-1.144.166-1.675.25-.977.194-1.982.389-2.96.61-2.205.473-4.383.973-6.561 1.557-.67.194-1.424.333-2.066.666-.224.111-.196.333-.084.472-.056.028-.084.028-.14.056-.195.028-.363.056-.558.083-.168.028-.252.167-.224.334 0 .027.028.083.028.11-1.173 1.556-2.485 3.195-3.909 4.945-1.396 1.611-2.876 3.306-4.356 5.056-4.719 5.5-10.052 11.75-15.943 17.25a.268.268 0 0 0 0 .389c.028.027.056.055.084.055-.084.084-.168.14-.252.222-.056.056-.084.111-.084.167a.605.605 0 0 0-.111.139c-.112.111-.112.305.028.389.111.11.307.11.39-.028.029-.028.029-.056.056-.056a.44.44 0 0 1 .615 0c.335.362.67.723.977 1.028l-.698-.583c-.112-.111-.307-.083-.39.028-.113.11-.085.305.027.389l7.427 6.194c.056.056.112.056.196.056s.14-.028.195-.084l.168-.166c.028.027.083.027.111.027.084 0 .14-.027.196-.083 10.052-10.055 18.15-17.639 27.42-24.417.083-.055.111-.166.111-.25.112 0 .196-.083.251-.194 1.704-5.194 2.039-9.806 2.15-12.083v-.028c0-.028.028-.056.028-.083.028-.056.028-.084.028-.084a1.626 1.626 0 0 0-.111-1.028ZM21.472 9.5c.446-.5.893-1.028 1.34-1.5-2.876 3.778-7.65 9.583-14.408 16.5 4.607-5.083 9.242-10.333 13.068-15ZM5.193 35.778h.084-.084Zm3.462 3.194c-.027-.028-.027-.028 0-.028v.028Zm4.16-3.583c.224-.25.448-.472.699-.722 0 0 0 .027.028.027-.252.223-.475.445-.726.695Zm1.146-1.111c.14-.14.279-.334.446-.5l.028-.028c1.648-1.694 3.351-3.389 5.082-5.111l.028-.028c.419-.333.921-.694 1.368-1.028a379.003 379.003 0 0 0-6.952 6.695ZM24.794 6.472c-.921 1.195-1.954 2.778-2.82 4.028-2.736 3.944-11.532 13.583-11.727 13.75a1976.983 1976.983 0 0 1-8.042 7.639l-.167.167c-.14-.167-.14-.417.028-.556C14.49 19.861 22.03 10.167 25.074 5.917c-.084.194-.14.36-.28.555Zm4.83 5.695c-1.116-.64-1.646-1.64-1.34-2.611l.084-.334c.028-.083.084-.194.14-.277.307-.5.754-.917 1.257-1.167.027 0 .055 0 .083-.028-.028-.056-.028-.139-.028-.222.028-.167.14-.278.335-.278.335 0 1.369.306 1.76.639.111.083.223.194.335.305.14.167.363.445.474.667.056.028.112.306.196.445.056.222.111.472.084.694-.028.028 0 .194-.028.194a2.668 2.668 0 0 1-.363 1.028c-.028.028-.028.056-.056.084l-.028.027c-.14.223-.335.417-.53.556-.643.444-1.369.583-2.095.389 0 0-.195-.084-.28-.111Zm8.154-.834a39.098 39.098 0 0 1-.893 3.167c0 .028-.028.083 0 .111-.056 0-.084.028-.14.056-2.206 1.61-4.356 3.305-6.506 5.028 1.843-1.64 3.686-3.306 5.613-4.945.558-.5.949-1.139 1.06-1.861l.28-1.667v-.055c.14-.334.67-.195.586.166Z`,fill:`currentColor`})}),Mz=()=>(0,W.jsxs)(`svg`,{viewBox:`0 0 450 55`,xmlns:`http://www.w3.org/2000/svg`,fill:`none`,className:`ExcalidrawLogo-text`,children:[(0,W.jsx)(`path`,{d:`M429.27 96.74c2.47-1.39 4.78-3.02 6.83-4.95 1.43-1.35 2.73-2.86 3.81-4.51-.66.9-1.4 1.77-2.23 2.59-2.91 2.84-5.72 5.09-8.42 6.87h.01ZM343.6 69.36c.33 3.13.58 6.27.79 9.4.09 1.37.18 2.75.25 4.12-.12-4.46-.27-8.93-.5-13.39-.11-2.08-.24-4.16-.4-6.24-.06 1.79-.11 3.85-.13 6.11h-.01ZM378.47 98.34c.01-.37.07-1.13.01-6.51-.11 1.9-.22 3.81-.31 5.71-.07 1.42-.22 2.91-.16 4.35.39.03.78.07 1.17.1-.92-.85-.76-2.01-.72-3.66l.01.01ZM344.09 86.12c-.09-2.41-.22-4.83-.39-7.24v12.21c.15-.05.32-.09.47-.14.05-1.61-.03-3.23-.09-4.83h.01ZM440.69 66.79c-.22-.34-.45-.67-.69-.99-3.71-4.87-9.91-7.14-15.65-8.55-1.05-.26-2.12-.49-3.18-.71 2.29.59 4.48 1.26 6.64 2.02 7.19 2.54 10.57 5.41 12.88 8.23ZM305.09 72.46l1.2 3.6c.84 2.53 1.67 5.06 2.46 7.61.24.78.5 1.57.73 2.36.22-.04.44-.08.67-.12a776.9 776.9 0 0 1-5.01-13.57c-.02.04-.03.09-.05.13v-.01ZM345.49 90.25v.31c1.48-.42 3.05-.83 4.66-1.2-1.56.25-3.12.52-4.66.89ZM371.02 90.22c0-.57-.04-1.14-.11-1.71-.06-.02-.12-.04-.19-.05-.21-.05-.43-.08-.65-.11.42.16.74.88.95 1.87ZM398.93 54.23c-.13 0-.27-.01-.4-.02l.03.4c.11-.15.23-.27.37-.38ZM401.57 62.28v-.15c-1.22-.24-2.86-.61-3.23-1.25-.09-.15-.18-.51-.27-.98-.09.37-.2.73-.33 1.09 1.24.56 2.52.98 3.83 1.29ZM421.73 88.68c-2.97 1.65-6.28 3.12-9.69 3.68v.18c4.72-.14 11.63-3.85 16.33-8.38-2.04 1.75-4.33 3.24-6.63 4.53l-.01-.01ZM411.28 80.92c-.05-1.2-.09-2.4-.15-3.6-.21 5.66-.46 11.38-.47 14.51.24-.02.48-.04.71-.07.15-3.61.05-7.23-.09-10.83v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M425.38 67.41c-3.5-1.45-7.19-2.57-14.06-3.62.09 1.97.06 4.88-.03 8.12.03.04.06.09.06.15.19 1.36.28 2.73.37 4.1.25 3.77.39 7.55.41 11.33 0 1.38-.01 2.76-.07 4.13 1.4-.25 2.78-.65 4.12-1.15 4.07-1.5 7.94-3.78 11.28-6.54 2.33-1.92 5.13-4.49 5.88-7.58.63-3.53-2.45-6.68-7.97-8.96l.01.02ZM411.35 92.53v-.06l-.34.03c.11.01.22.03.34.03ZM314.26 64.06c-.23-.59-.47-1.17-.7-1.75.57 1.62 1.11 3.25 1.6 4.9l.15.54 2.35 6.05c.32.82.66 1.64.98 2.46-1.38-4.1-2.83-8.17-4.39-12.2h.01ZM156.82 103.07c-.18.13-.38.23-.58.33 1.32-.03 2.66-.2 3.93-.34.86-.09 1.72-.22 2.58-.33-2.12.1-4.12.17-5.94.34h.01ZM210.14 68.88s.03.04.05.07c.18-.31.39-.64.58-.96-.21.3-.42.6-.64.89h.01ZM201.65 82.8c-.5.77-1.02 1.56-1.49 2.37 1.11-1.55 2.21-3.1 3.2-4.59-.23.23-.49.51-.75.79-.32.47-.65.95-.96 1.43ZM194.03 98.66c-.33-.4-.65-.84-1.05-1.17-.24-.2-.07-.49.17-.56-.23-.26-.42-.5-.63-.75 1.51-2.55 3.93-5.87 6.4-9.28-.17-.08-.29-.28-.2-.49.04-.09.09-.17.13-.26-1.21 1.78-2.42 3.55-3.61 5.33-.87 1.31-1.74 2.64-2.54 4-.29.5-.63 1.04-.87 1.61.81.65 1.63 1.27 2.47 1.88-.09-.11-.18-.21-.27-.32v.01ZM307.79 82.93c-1-3.17-2.05-6.32-3.1-9.48-1.62 4.08-3.69 9.17-6.16 15.19 3.32-1.04 6.77-1.87 10.27-2.5-.32-1.08-.67-2.15-1.01-3.21ZM149.5 80.7c.05-1.71.04-3.43 0-5.14-.1 2.26-.16 4.51-.22 6.77-.02.73-.03 1.46-.04 2.19.14-1.27.2-2.55.24-3.82h.02ZM228.98 98.3c.39 1.25.91 3.03.94 3.91.06-.03.12-.07.17-.1.08-1.29-.55-2.65-1.11-3.81ZM307.72 53.36c.81.5 1.53 1.04 2.07 1.49-.38-.8-.78-1.58-1.21-2.35-.17.03-.34.06-.51.11-.43.12-.86.26-1.29.41.35-.01.53.1.94.34ZM283.69 96.14c3.91-7.25 6.89-13.35 8.88-18.15l1.1-2.66c-1.27 2.64-2.56 5.27-3.83 7.9-1.53 3.15-3.06 6.31-4.58 9.47-.87 1.81-1.76 3.62-2.54 5.47.04.02.07.04.11.07.05.05.1.09.15.14.05-.73.27-1.48.71-2.24ZM289.92 103.23s-.04.01-.05.03c0-.02.04-.03.05-.04.05-.05.11-.1.16-.15l.21-.21c-.55 0-1.5-.27-2.55-.72.4.26.8.51 1.22.74.24.13.48.26.73.37.05.02.1.03.14.05a.27.27 0 0 1 .08-.07h.01ZM269.23 68.49c-.39-.19-.82-.48-1.33-.87-3.06-1.56-6.31-2.78-9.36-2.35-3.5.49-5.7 1.11-7.74 2.44 5.71-2.6 12.82-2.07 18.44.79l-.01-.01ZM177.87 53.69l1.06.03c-.96-.22-2-.25-2.89-.3-4.95-.26-9.99.33-14.86 1.19-2.44.43-4.88.95-7.28 1.59 9.09-1.76 15.69-2.77 23.97-2.51ZM219.85 55.51c-.18.12-.36.27-.56.45-.45.53-.86 1.11-1.26 1.66-1.91 2.61-3.71 5.31-5.57 7.95l-.12.18 8.05-10.11c-.18-.05-.36-.1-.55-.13h.01ZM510.71 54.1c.12-.15.29-.3.53-.45.69-.4 3.72-.63 5.87-.74-.36-.02-.73-.04-1.09-.05-1.84-.03-3.67.09-5.49.35.05.3.12.59.18.88v.01ZM510.76 86.02c1.37-3.07 2.49-6.27 3.57-9.46.55-1.64 1.12-3.3 1.6-4.97-1.59 4.01-3.67 9.14-6.2 15.3.24-.08.5-.14.74-.22.1-.22.19-.44.29-.65ZM566.95 75.76c.11-.02.23.03.31.11-.05-.13-.09-.26-.14-.39-.05.09-.11.18-.17.28ZM511.33 86.41c3.08-.89 6.24-1.62 9.46-2.14-1.51-3.98-2.98-7.96-4.39-11.87-.05.15-.09.31-.14.46-1.02 3.32-2.15 6.61-3.39 9.85-.48 1.25-.98 2.49-1.53 3.7h-.01ZM578.24 74.45c.11-.44.23-.87.35-1.31-.31.7-.64 1.39-.97 2.08.09.21.19.4.28.61.12-.46.23-.92.35-1.38h-.01ZM520.62 53.11c-.09 0-.18-.01-.28-.02.38.34.29 1.08.93 2.53l6.65 17.15c2.2 5.68 4.69 11.36 7.41 16.87l1.06 2.17c-2.95-7.05-5.92-14.08-8.87-21.13-1.58-3.79-3.16-7.59-4.7-11.4-.78-1.92-1.73-3.89-2.25-5.91-.03-.1 0-.19.04-.26h.01ZM578.78 77.87c1.45-5.77 3.07-10.43 3.58-13.36.05-.34.16-.88.31-1.55-.67 1.79-1.37 3.56-2.08 5.33-.12.43-.23.86-.35 1.29-.65 2.43-1.29 4.86-1.9 7.3.14.33.29.65.43 1l.01-.01ZM545.3 94.66c.02-.44.03-.83.05-1.12.02-1.01.05-2.02.11-3.02.03-6.66-.46-14.33-1.46-22.8-.13-.42-.27-1.24-.56-2.89 0-.02 0-.04-.01-.06.62 6.61.95 13.25 1.32 19.87.17 3.08.33 6.16.52 9.23.02.25.03.52.04.78l-.01.01ZM580.77 102.81c.13.2.27.38.37.49.27-.11.53-.22.8-.32-.43.09-.82.05-1.17-.16v-.01ZM530.48 104.07h.33c-.36-.13-.71-.32-1.04-.56.14.24.3.47.45.7.06-.08.14-.13.26-.13v-.01ZM542.63 58.82c.06.23.11.47.15.71.14-.33.36-.62.7-.86-.28.05-.57.11-.85.15ZM583.81 57.87c.15-.7.29-1.41.42-2.11-.14.45-.28.9-.42 1.34-.46 1.44-.89 2.89-1.31 4.34.44-1.19.88-2.37 1.31-3.57ZM523.62 91.48c-4.66 1.17-9.05 2.89-14.02 5.27 4.65-1.84 9.48-3.29 14.28-4.63-.09-.22-.17-.41-.26-.64ZM460.64 78.3c-.04-2.9-.11-5.81-.28-8.71-.1-1.68-.17-3.43-.5-5.09-.07.02-.14.03-.2.05.3 6.54.45 12.17.51 17.12.17-.07.34-.14.51-.2 0-1.06-.01-2.11-.03-3.17h-.01ZM470.63 63.24c-3.38-.26-6.81.32-10.1 1.1.41 2.01.47 4.14.57 6.18.18 3.55.25 7.11.27 10.67 3.31-1.38 6.5-3.12 9.3-5.35 1.96-1.56 3.86-3.41 5.02-5.66.73-1.41 1.19-3.22.26-4.65-1.09-1.7-3.46-2.14-5.32-2.29ZM460.29 63.68c1-.24 2.01-.46 3.04-.65-1.15.16-2.37.38-3.71.69v.13c.07-.02.15-.04.22-.05.11-.13.3-.18.45-.11v-.01ZM457.24 100.96c.43-.03.86-.07 1.29-.11.14-.49.27-.99.38-1.49-.44.7-1 1.23-1.67 1.6ZM482.88 104.98c-.18.23-.36.38-.55.47.14.09.27.19.4.28a70.76 70.76 0 0 0 4.37-4.63c.76-.89 1.52-1.81 2.19-2.77-.3-.27-.61-.53-.92-.79-.07 1.94-4.62 6.32-5.49 7.45v-.01Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`M474.36 63.31c-.4-.16-.84-.27-1.29-.37 1.56.42 3.08 1.22 3.76 2.74.62 1.4.32 2.95-.28 4.32.7-1.22.94-2.34.74-3.47-.24-1.33-1.19-2.54-2.93-3.21v-.01ZM477.34 89.18c-1.2-.81-2.4-1.62-3.6-2.42-.14.1-.26.19-.4.29 1.4.67 2.73 1.39 4 2.13ZM465.88 93.85c.37.25.74.5 1.1.75.46.32.92.65 1.38.97-1.57-1.2-2.01-1.61-2.49-1.72h.01ZM574.92 90.06c-2.28-5.21-4.93-11.13-5.67-12.26-.1-.15-1.57-3.01-1.63-3.08 0 0-.01.02-.02.02.4 1.37 1.09 2.69 1.65 3.99 2.14 4.95 4.36 9.86 6.67 14.73.6 1.26 1.21 2.52 1.83 3.78-.75-2.01-1.64-4.45-2.83-7.18ZM448.73 65.29c.1.2.22.38.34.57.22-.02.43-.06.65-.08v-.08c-.14-.05-.25 0-.99-.41ZM460.16 94.81c-.02.31-.06.59-.1.89-.03 1.71-.33 3.43-.79 5.07.15-.02.3-.03.45-.05.01-.04.02-.08.03-.11.09-.34.15-.69.2-1.03.17-1.07.25-2.16.33-3.24.05-.69.08-1.39.12-2.08-.27.1-.27.26-.24.57v-.02Z`,transform:`translate(-144.023 -51.76)`}),(0,W.jsx)(`path`,{d:`m328.67 98.12-3.22-6.58c-1.29-2.63-2.53-5.29-3.72-7.97-.25-.85-.52-1.69-.79-2.53-.81-2.57-1.67-5.12-2.55-7.67-1.92-5.53-3.9-11.08-6.32-16.41-.72-1.58-1.46-3.44-2.63-4.79-.03-.17-.16-.29-.34-.36a.282.282 0 0 0-.23-.04c-.06-.01-.12 0-.18.01-.74.06-1.5.38-2.19.61-2.22.77-4.4 1.64-6.63 2.38-.03-.08-.06-.16-.09-.25-.15-.42-.82-.24-.67.19.03.09.07.19.1.28l-.18.06c-.36.11-.28.6 0 .68.18 1.18.63 2.36.98 3.49.03.09.06.17.08.26-.08.23-.17.46-.24.64-.37.98-.79 1.94-1.21 2.9-1.27 2.89-2.62 5.75-3.98 8.6-3.18 6.67-6.44 13.31-9.64 19.97-1.08 2.25-2.2 4.5-3.15 6.81-.13.32.24.5.5.37 1.34 1.33 2.84 2.5 4.4 3.57.65.44 1.31.87 2.01 1.24.4.22.86.48 1.33.5.24.01.35-.19.33-.37.11-.1.21-.21.28-.28.41-.41.81-.84 1.2-1.26.85-.92 1.69-1.87 2.5-2.84 6.31-2.34 12.6-4.31 18.71-5.84 2.14 5.3 3.43 8.43 3.97 9.58.55 1.05 1.15 1.88 1.82 2.52 1.32.56 6.96-.03 9.23-1.96.87-1.28 1.19-2.67.93-4.15-.09-.5-.22-.95-.4-1.33l-.01-.03Zm-20.09-45.61c.43.77.83 1.56 1.21 2.35-.54-.45-1.27-.99-2.07-1.49-.42-.24-.6-.35-.94-.34.43-.15.85-.29 1.29-.41.17-.05.34-.08.51-.11Zm-25.86 45.66c.78-1.85 1.67-3.66 2.54-5.47 1.51-3.16 3.05-6.31 4.58-9.47 1.28-2.63 2.56-5.26 3.83-7.9l-1.1 2.66c-1.99 4.79-4.97 10.9-8.88 18.15-.43.76-.66 1.51-.71 2.24-.05-.05-.1-.09-.15-.14a.259.259 0 0 0-.11-.07Zm6.24 4.71c-.42-.23-.82-.48-1.22-.74 1.05.45 2 .72 2.55.72l-.21.21c-.05.05-.11.1-.16.15-.01.01-.04.03-.05.04 0-.02.03-.02.05-.03a.27.27 0 0 0-.08.07c-.05-.02-.1-.03-.14-.05-.25-.1-.49-.24-.73-.37h-.01Zm15.73-29.43c1.05 3.15 2.1 6.31 3.1 9.48.34 1.06.69 2.13 1.01 3.21-3.5.63-6.95 1.46-10.27 2.5 2.48-6.03 4.54-11.11 6.16-15.19Zm4.79 12.57c-.23-.79-.49-1.58-.73-2.36-.79-2.54-1.63-5.08-2.46-7.61l-1.2-3.6c.02-.04.04-.09.05-.13 1.6 4.45 3.28 9 5.01 13.57l-.67.12v.01Zm5.83-18.27-.15-.54c-.49-1.64-1.03-3.28-1.6-4.9.23.58.47 1.17.7 1.75 1.56 4.03 3.01 8.1 4.39 12.2-.33-.82-.67-1.64-.98-2.46l-2.35-6.05h-.01ZM390.43 79.37c-.13-10.43-.22-17.5-.24-19.97-.24-1.6.21-2.88-.65-3.65-.14-.13-.32-.23-.52-.32h.03c.45 0 .45-.69 0-.7-1.75-.03-3.5-.04-5.25-.14-1.38-.08-2.76-.21-4.15-.31-.07 0-.12.01-.17.04-.21-.07-.47.03-.45.31l.03.45c-.11.14-.19.3-.22.5-.21 1.26-.32 13.67-.36 23.59-.32 5.79-.67 11.57-.97 17.36-.09 1.73-.29 3.54-.21 5.3-.39.02-.38.64.04.69v.12c.05.44.74.45.7 0v-.06c1.1.09 2.2.21 3.3.3 1.14.19 2.44.2 3.29.17 1.73-.05 2.92-.05 3.8-.37.45-.05.9-.11 1.35-.17.44-.06.25-.73-.19-.67h-.01c.24-.32.45-.72.62-1.25.66-1.84.41-6.36.34-11.33l-.13-9.9.02.01Zm-12.26 18.17c.09-1.91.2-3.81.31-5.71.06 5.38 0 6.14-.01 6.51-.05 1.65-.21 2.81.72 3.66-.39-.04-.78-.07-1.17-.1-.06-1.44.09-2.93.16-4.35l-.01-.01ZM588.97 53.85c-2.06-.25-3.17-.51-3.76-.6a.3.3 0 0 1 .04-.08c.22-.39-.39-.75-.6-.35-.56 1.02-.9 2.19-1.26 3.29-.61 1.88-1.17 3.78-1.72 5.68-.63 2.19-1.24 4.39-1.83 6.59-.81 2.03-1.67 4.05-2.61 6.03-1.7-3.64-3.11-6.04-4.03-7.57-2.26-3.74-2.85-5.48-3.57-6.08l.31-.09c.43-.12.25-.8-.19-.67-1.06.3-2.12.6-3.17.95-.93.32-1.85.69-2.76 1.07-.13.05-.19.16-.22.27-.04.02-.08.05-.11.07-.04-.06-.07-.12-.11-.18a.354.354 0 0 0-.48-.12c-.16.09-.22.32-.13.48l.33.54c0 .09.02.18.06.28.51 1.16.78 1.38.72 1.47-2.42 3.44-5.41 7.86-6.2 9.1-1.27 1.97-2.01 3.14-2.45 3.84l-.91-6.56-.43-4.1c-.19-1.85-.37-3.23-.53-4.13-.19-1.1-.3-2.15-.45-3.16-.2-1.36-.29-2.06-.47-2.42h.04c.45.02.45-.68 0-.7-3.43-.16-6.81.94-10.17 1.48-.24-.22-.73-.04-.58.32.24.59.33 1.25.43 1.87.17 1.06.29 2.13.4 3.2.32 3.09.53 6.2.74 9.3.44 6.75.77 13.51 1.17 20.26.11 1.95.13 3.96.46 5.89.05.3.37.31.55.14.74 1.71 2.87 1.27 6.13 1.27 1.34 0 2.39.04 2.99-.11.02.32.48.53.63.18 3.61-8.26 7.41-16.46 12.05-24.2.03-.05.04-.1.05-.15.3.73.64 1.45.94 2.16.97 2.26 1.97 4.52 2.98 6.76 2.26 5.03 4.54 10.07 7.09 14.96.47.9.94 1.79 1.47 2.65.2.32.4.67.66.96-.18.25 0 .68.34.54.91-.38 1.82-.75 2.76-1.07 1.04-.35 2.11-.65 3.17-.95.39-.11.28-.66-.07-.68.62-.4.95-.96.87-1.91-.3-3.34.72-7.47.86-8.52l2.14-11.43c1.75-10.74 3.13-17.51 3.23-20.86.02-.49.08-2.84.13-3.24.17-1.25.48-1-4.96-1.65l.03-.02Zm-46.19 5.67c-.04-.24-.09-.48-.15-.71l.85-.15c-.34.24-.56.53-.7.86Zm1.95 25.12c-.36-6.63-.7-13.26-1.32-19.87 0 .02 0 .04.01.06.29 1.65.44 2.47.56 2.89 1 8.46 1.5 16.14 1.46 22.8-.06.99-.1 2-.11 3.02-.01.29-.03.68-.05 1.12-.01-.26-.03-.53-.04-.78-.19-3.08-.35-6.16-.52-9.23l.01-.01Zm36.4 18.66c-.11-.11-.24-.29-.37-.49.35.21.74.26 1.17.16-.27.11-.53.22-.8.32v.01Zm-.89-33.72c.12-.43.23-.86.35-1.29.71-1.77 1.41-3.55 2.08-5.33-.15.68-.26 1.22-.31 1.55-.5 2.94-2.13 7.59-3.58 13.36-.15-.35-.29-.66-.43-1 .61-2.44 1.25-4.87 1.9-7.3l-.01.01Zm3.56-12.48c.14-.44.28-.89.42-1.34-.13.7-.27 1.41-.42 2.11-.43 1.19-.86 2.38-1.31 3.57.42-1.45.85-2.9 1.31-4.34Zm-5.22 16.05c-.11.44-.23.87-.35 1.31-.12.46-.23.92-.35 1.38-.1-.22-.19-.4-.28-.61.34-.69.66-1.38.97-2.08h.01Zm-11.64 2.62c.06-.1.12-.19.17-.28.05.13.09.26.14.39a.398.398 0 0 0-.31-.11Zm2.3 2.98c-.56-1.3-1.25-2.63-1.65-3.99 0 0 .01-.02.02-.02.06.08 1.52 2.93 1.63 3.08.73 1.13 3.38 7.04 5.67 12.26 1.2 2.73 2.08 5.17 2.83 7.18-.62-1.25-1.23-2.51-1.83-3.78-2.31-4.87-4.53-9.78-6.67-14.73ZM275.92 87.03c-1.06-2.18-1.13-3.45-2.44-2.93-1.52.57-2.94 1.3-4.5 2.1-1.4.72-2.68 1.44-3.92 2.12.01-.25-.24-.5-.51-.34-4.8 2.93-12.41 4.7-17.28 1.31-1.98-1.77-3.32-4.15-3.97-5.78-.29-.95-.49-1.94-.63-2.93-.14-3.34 1.58-6.53 3.9-9.12.8-.79 1.68-1.51 2.66-2.12 3.7-2.3 8.22-3.07 12.51-2.51 2.71.35 5.32 1.24 7.71 2.55.39.22.75-.39.35-.6-.18-.1-.37-.18-.55-.27.56.27 1.03.33 1.51.19l-.48.39c-.15.11-.23.3-.13.48.09.15.33.24.48.13 1.3-.97 2.46-2.09 3.45-3.37.37-.29.64-.6.65-.97v-.02c.08-.33-.03-.7-.21-1.08-.31-.87-.98-2.01-2.19-3.26-2.43-2.52-3.79-3.45-5.68-4.26-1.14-.49-3.12-1.06-4.42-1.23-3.28-.42-10.64-1.21-18.18 4.11-7.74 5.46-11.94 12.3-12.23 20.61-.08 2.06.04 3.98.34 5.71.74 4.18 2.57 8 5.44 11.34 4.26 4.99 9.76 7.52 16.34 7.52 4.85 0 9.69-1.77 14.89-4.62.23-.12.45-.23.68-.35 2.19-1.1 4.37-2.23 6.46-3.5.49-.3 1.03-.61 1.5-.98 1.47-.87 1.11-1.12.49-2.95-.39-1.14-.76-2.7-2.06-5.36l.02-.01Zm-17.38-21.76c3.05-.42 6.31.79 9.36 2.35.51.39.94.68 1.33.87-5.61-2.86-12.72-3.39-18.44-.79 2.05-1.33 4.24-1.95 7.74-2.44l.01.01ZM443.67 72.67c-.4-2.2-1.15-4.33-2.37-6.22-1.49-2.32-3.58-4.19-5.91-5.64-6.17-3.81-13.75-5.11-20.83-6.01-3.23-.41-6.47-.69-9.72-.92l-1.39-.12c-.85-.07-1.52-.1-2.05-.1-1.08-.06-2.17-.12-3.25-.17-.08 0-.14.02-.19.05-.1.05-.18.14-.16.3.27 2.55-.01 5.12-.92 7.52-.15.38.4.56.62.28 1.32.59 2.68 1.05 4.08 1.37 0 2.78-.14 7.58-.33 12.91 0 0 0 .02-.01.03-.61 3.66-.79 7.42-1 11.12-.23 4.01-.43 8.03-.44 12.05 0 .64 0 1.28.03 1.93.02.31 0 .68.15.96.06.11.14.16.24.17-.2.17-.21.54.11.59 3.83.67 7.78.71 11.68.25 2.3-.19 4.87-.65 7.65-1.56 1.85-.54 3.67-1.18 5.43-1.91 7.2-3.02 14.31-8.07 17.35-15.53.76-1.86 1.17-3.8 1.31-5.75.3-1.93.28-3.82-.09-5.58l.01-.02Zm-19.32-15.42c5.74 1.41 11.94 3.68 15.65 8.55.25.32.47.65.69.99-2.3-2.82-5.68-5.69-12.88-8.23-2.16-.76-4.35-1.43-6.64-2.02 1.06.21 2.13.45 3.18.71Zm-25.82-3.04c.13 0 .27.01.4.02-.14.1-.26.23-.37.38 0-.13-.02-.26-.03-.4Zm34.82 22.17c-.75 3.09-3.55 5.66-5.88 7.58-3.35 2.76-7.21 5.03-11.28 6.54-1.33.49-2.71.9-4.12 1.15.06-1.38.08-2.76.07-4.13-.02-3.78-.16-7.56-.41-11.33-.09-1.37-.18-2.74-.37-4.1 0-.06-.03-.11-.06-.15.09-3.25.12-6.16.03-8.12 6.86 1.05 10.56 2.17 14.06 3.62 5.52 2.28 8.59 5.44 7.97 8.96l-.01-.02Zm-22 16.15c-.12 0-.23-.02-.34-.03l.34-.03v.06Zm-.69-.7c0-3.13.26-8.84.47-14.51.06 1.2.11 2.41.15 3.6.15 3.6.25 7.23.09 10.83-.24.03-.48.05-.71.07v.01Zm-12.33-30.94c.37.63 2.01 1.01 3.23 1.25v.15c-1.31-.31-2.59-.73-3.83-1.29.12-.36.23-.72.33-1.09.08.48.18.84.27.98Zm13.7 31.65v-.18c3.41-.56 6.71-2.02 9.69-3.68 2.31-1.28 4.59-2.78 6.63-4.53-4.69 4.53-11.61 8.24-16.33 8.38l.01.01Zm24.07-.75c-2.05 1.93-4.37 3.56-6.83 4.95 2.7-1.78 5.52-4.03 8.42-6.87.82-.82 1.56-1.69 2.23-2.59-1.08 1.65-2.38 3.16-3.81 4.51h-.01ZM187.16 92.14c-.79-2.47-2.1-7.12-3.1-6.87-.19-.01-2.09.77-4.08 1.54-3.06 1.18-5.91 2.13-10.09 2.82-2.74.42-5.87 1.01-10.61 1.06.04-3.34.05-6.01.05-7.99 7.97-.65 12.33-2.11 16.37-3.55 1.11-.39 2.69-1.01 2.63-1.8-.08-.35-.55-1.39-1.17-2.61-.47-1.16-.98-2.31-1.61-3.38-.42-.71-1.04-1.69-1.86-2.06-.11-.08-.22-.13-.29-.12-.02 0-.04 0-.07.01-.19-.04-.39-.05-.6-.01-.17.03-.24.15-.25.28-.04.02-.09.04-.14.05-4.33 1.48-8.85 2.33-13.24 3.61a499.1 499.1 0 0 0-.31-8.19c4.51-.99 8.88-1.38 13.11-1.82 3.68-.38 6.28.12 7.47.34.59.11.9.16 1.16.18h.1c-.1.37.44.66.62.28.02-.04.03-.08.05-.13.15.2.53.22.62-.1.17-.58.19-1.21.21-1.81v-.36c.03-.15.05-.3.07-.45.52-2.47.33-5.09-.64-7.44-.11-.27-.44-.28-.6-.14-.08-.21-.15-.42-.24-.62-.19-.41-.79-.05-.6.35.03.07.05.15.09.22-.98-.42-2.15-.54-3.17-.63-2.17-.19-4.37-.14-6.54 0-5.7.35-11.4 1.3-16.91 2.79-2.08.56-4.13 1.22-6.14 2-4.54 1.05-3.79 1.51-2.17 6.07.18.51.46 1.68.54 1.94.82 2.47 1.08 2.13 3.1 2.13s0 .05 0 .08h.52c-.48 2.66-.51 5.45-.62 8.13-.15 3.48-.22 6.96-.28 10.45 0 .41-.01.82-.02 1.23-.16.29-.33.57-.51.85-.05.38-.09.77-.14 1.18-.42 3.52-.59 6.48-.52 8.8v.34c.02.47.05.76.06.87.16 1.57-.26 3.47 1.35 3.79 1.61.32 3.5.55 4.85.55.11 0 .22-.02.33-.02 1.79.24 3.67.05 5.45-.12 2.85-.28 5.69-.7 8.51-1.19 3.03-.53 6.05-1.14 9.04-1.86 2.4-.58 4.82-1.19 7.13-2.06.51-.19 1.73-.57 2.46-1.14 1.81-.68 2.18-1 1.57-2.67-.23-.62-.48-1.49-.91-2.78l-.03-.02Zm-11.12-38.71c.89.05 1.93.08 2.89.3-.33 0-.68-.02-1.06-.03-8.28-.26-14.88.75-23.97 2.51 2.41-.64 4.85-1.16 7.28-1.59 4.87-.86 9.91-1.45 14.86-1.19Zm-26.53 22.13c.03 1.71.04 3.43 0 5.14-.04 1.27-.11 2.55-.24 3.82 0-.73.02-1.46.04-2.19.05-2.26.12-4.51.22-6.77h-.02Zm6.73 27.85c.2-.1.4-.21.58-.33 1.82-.17 3.82-.24 5.94-.34-.86.11-1.72.24-2.58.33-1.27.14-2.61.31-3.93.34h-.01ZM534.48 85.44c-3.52-8.38-7.07-16.75-10.5-25.17-.63-1.54-1.25-3.09-1.86-4.65-.31-.8-.65-1.6-.87-2.43-.04-.17-.17-.24-.31-.25.1-.2 0-.51-.29-.53-1.59-.08-3.18-.22-4.78-.25-1.96-.03-3.91.13-5.84.42-.31.05-.31.38-.13.56-.03.06-.05.14-.04.22.23 1.54.63 3.06 1.16 4.53.13.35.27.7.41 1.06l-2.68 6.18c-.11.03-.2.09-.25.22-.67 1.9-1.52 3.73-2.34 5.56a536.85 536.85 0 0 1-3.9 8.45c-2.64 5.64-5.34 11.25-7.91 16.93-.44.97-.88 1.94-1.29 2.93-.2.48-.47 1-.55 1.52v.05c-.02.12.02.26.16.34 1.19.73 2.41 1.41 3.66 2.05 1.2.62 2.45 1.25 3.76 1.61.43.12.62-.55.19-.67-1.13-.31-2.2-.83-3.24-1.36 1.09.36 2.1.69 2.75.93 2.82 1.01 2.38 1.1 4.3-3.75 2.1-1.09 4.34-1.96 6.53-2.79 4.35-1.64 8.8-3.03 13.27-4.29.82 2.01 1.77 3.97 2.72 5.92.35.83.62 1.45.79 1.82.22.42.45.8.69 1.15.17.33.33.67.5 1 .42.8.84 1.63 1.4 2.35.23.29.6 0 .55-.31 1.53-.02 3.06-.07 4.58-.27.92-.12 1.82-.32 2.71-.54 1.39-.27 3.85-1.11 3.74-1.42-.67-1.96-1.55-3.87-2.34-5.78-1.57-3.78-3.16-7.56-4.75-11.33v-.01Zm-11.65-26.16c1.54 3.81 3.12 7.6 4.7 11.4 2.94 7.05 5.91 14.09 8.87 21.13l-1.06-2.17c-2.71-5.51-5.2-11.19-7.41-16.87l-6.65-17.15c-.65-1.45-.55-2.19-.93-2.53.09 0 .18.01.28.02a.29.29 0 0 0-.04.26c.52 2.02 1.47 3.98 2.25 5.91h-.01Zm-6.58 13.58c.05-.15.09-.31.14-.46 1.41 3.92 2.88 7.9 4.39 11.87-3.22.52-6.38 1.25-9.46 2.14.55-1.22 1.05-2.46 1.53-3.7 1.24-3.24 2.37-6.53 3.39-9.85h.01Zm-.23-20c.36 0 .73.03 1.09.05-2.15.1-5.18.33-5.87.74-.24.15-.41.3-.53.45-.06-.29-.13-.58-.18-.88 1.82-.26 3.65-.39 5.49-.35v-.01Zm-.09 18.72c-.49 1.67-1.05 3.33-1.6 4.97-1.07 3.19-2.19 6.38-3.57 9.46-.09.21-.19.43-.29.65-.25.07-.5.14-.74.22 2.53-6.16 4.61-11.29 6.2-15.3Zm-6.34 25.16c4.97-2.38 9.37-4.1 14.02-5.27l.26.64c-4.8 1.35-9.63 2.8-14.28 4.63Zm20.17 6.76c.33.23.68.42 1.04.56h-.33c-.12 0-.21.06-.26.13-.15-.23-.31-.45-.45-.7v.01ZM226.57 91.75c-3.55-4.74-6.68-9.11-9.31-12.99 9.2-15.25 10.05-17.81 10.35-18.38.17-.34 1.09-2.27.64-2.53-1.13-.65-1.03-.65-2.97-1.71-1.19-.65-3.04-1.61-4.53-2.12-1.71-.59-1.24-.36-3 2.77-.06.1-.11.2-.17.3-.75 1.02-1.48 2.05-2.2 3.09-1.88 2.71-3.73 5.45-5.69 8.1-3.68-4.91-6.88-8.76-9.51-11.43-.15-.15-.3-.29-.46-.42-1.27-1.28-7.24 3.53-7.93 5.58-.09.09-.19.16-.28.25-.27.26.03.64.33.58.19.65.5 1.29.94 1.91 3.85 5.06 7.19 9.76 9.94 14-1.23 2.61-3.06 5-4.67 7.38l-2.28 3.33c-.5.66-.93 1.23-1.29 1.69-.67.93-2.09 2.61-2.3 3.87-.51.85-1.16 1.84-1.29 2.83-.06.44.61.63.67.19.01-.08.04-.15.06-.22 1.36 1.08 2.76 2.11 4.19 3.11 1.3.91 2.62 1.85 4.04 2.56.21.1.4 0 .48-.17.24.07.48.14.72.2.44.1.62-.57.19-.67-2.02-.48-3.77-1.57-5.23-3.02-.47-.46-.9-.96-1.32-1.46 1.74 1.35 4.2 2.89 5.89 4.14 1.39 1.03 2.85-2.27 4.22-4.2 1.86-2.64 3.96-5.86 5.52-8.29l10.39 14.51c.67.81 1.14 1.21 1.57 1.36-.05.24.12.51.41.4 1.53-.58 3.05-1.19 4.54-1.87 1.52-.69 3.06-1.45 4.36-2.5a.28.28 0 0 0 .12-.23c1.66-1.1.81-1.74-1.41-4.91-1.13-1.58-1.71-2.36-3.7-5.01l-.03-.02Zm2.41 6.54c.56 1.15 1.19 2.52 1.11 3.81-.06.04-.12.07-.17.1-.03-.88-.55-2.66-.94-3.91Zm-16.51-32.73c1.86-2.65 3.65-5.35 5.57-7.95.4-.55.81-1.13 1.26-1.66.19-.18.38-.33.56-.45.18.03.36.08.55.13l-8.05 10.11.12-.18h-.01ZM192.7 95.48c.79-1.37 1.66-2.69 2.54-4 1.19-1.79 2.4-3.56 3.61-5.33-.04.09-.09.17-.13.26-.1.22.03.41.2.49-2.47 3.42-4.89 6.73-6.4 9.28.21.24.4.48.63.75-.24.07-.4.36-.17.56.4.33.72.77 1.05 1.17.09.11.18.21.27.32-.84-.61-1.66-1.24-2.47-1.88.24-.57.58-1.11.87-1.61v-.01Zm7.46-10.32c.47-.81.98-1.59 1.49-2.37.31-.48.64-.95.96-1.43.26-.29.52-.56.75-.79-.99 1.48-2.09 3.03-3.2 4.59Zm10.03-16.22s-.03-.05-.05-.07c.22-.29.43-.59.64-.89-.2.32-.4.65-.58.96h-.01ZM371.54 87.96c-.01-.08-.01-.16-.03-.23-.06-.38-.58-.29-.66.03-.3-.05-.6-.08-.81-.11-1.14-.15-2.29-.19-3.44-.2 1.04-.09 2.09-.18 3.14-.23.45-.02.45-.72 0-.7-6.57.35-13.14 1.23-19.65 2.11-1.53.21-3.05.42-4.57.68-.01 0-.02.01-.04.01-.04-3.33-.13-6.66-.24-9.99-.19-5.7-.4-11.41-.88-17.1-.13-1.51-.23-3.07-.49-4.58 0-.25 0-.48-.02-.68-.06-1.19-.04-2.61-.68-2.78-.16-.07-.72-.16-1.5-.24.22-.17.16-.62-.2-.63-1.19-.04-2.39.09-3.57.23-1.2.14-2.41.32-3.59.6-.16-.1-.41-.06-.5.12-.06.02-.13.03-.19.05-.35.1-.29.55-.03.66-.26.6-.19 2.27-.21 3-.02.66-.66 33.73-.9 40.3-.03.65.06 1.12.04 1.45-.16 3.05.87 4.96 6.34 3.93 1.09-.08 2.75-.77 5.36-1.43 4.13-1.04 5.78-1.52 6.2-1.65 6.43-1.69 6.78-1.97 11.72-2.43.55-.05 4.8-.38 6.03-.3.64.04 1.19.07 1.65.1.09 0 .16-.03.24-.05.1.27.56.33.66-.02.39-1.32.61-2.71.78-4.08.2-1.61.29-3.24.15-4.86.24.03.52-.23.38-.53-.09-.2-.27-.33-.49-.43v-.02Zm-.63.56c.07.57.11 1.14.11 1.71-.21-.99-.53-1.71-.95-1.87.22.03.44.06.65.11.06.01.12.04.19.05Zm-25.41 1.73c1.54-.36 3.1-.64 4.66-.89-1.61.37-3.18.77-4.66 1.2v-.31Zm-.86-7.37c-.07-1.37-.16-2.75-.25-4.12-.21-3.13-.45-6.27-.79-9.4.02-2.25.08-4.31.13-6.11.16 2.08.29 4.16.4 6.24.23 4.46.38 8.93.5 13.39h.01Zm-.94-4c.16 2.41.29 4.83.39 7.24.06 1.6.14 3.22.09 4.83-.15.05-.32.09-.47.14V78.88h-.01ZM483.72 92.83c-3.05-2.28-6.22-4.4-9.38-6.51 8.86-6.49 13.49-12.95 13.73-19.23.04-.76 0-1.5-.13-2.2-.67-3.82-3.5-6.68-8.39-8.48.13.04.27.08.4.13 3.92 1.39 7.74 4.23 8.5 8.56.34 1.95-.05 3.96-.98 5.69-.21.4.39.75.6.35 1.86-3.46 1.46-7.55-.97-10.63-3.53-4.47-9.76-5.88-15.16-6.16-2.32-.12-4.64-.04-6.95.19-6 .32-12.71 1.68-17.63 3.21-.37.11-.67.23-.92.35-.2-.17-.62.02-.57.37v.03c-.64.68-.18 1.64.48 3.21.38.91.67 1.89 1.15 2.58.32.76.68 1.51 1.13 2.19.14.21.38.19.53.07.19-.02.38-.05.57-.08v1.57c-.06.06-.1.13-.11.23-.27 4.18-.34 8.38-.48 12.57l-.3 9.03c-.24 3.91-.44 6.77-.46 7.26-.05.88-.11 1.95.07 2.81-.01.22-.02.43-.04.65 0 .11-.02.23-.03.35 0 .05-.03.27-.01.16-.05.4.5.59.64.28.05.04.12.08.2.08 1.75.13 3.5.28 5.25.3 1.69.02 3.38-.12 5.06-.32.08.23.36.39.55.15.06-.08.11-.17.16-.26.18-.09.24-.32.18-.48.05-.2.1-.4.13-.6.16-.86.25-1.74.33-2.62.11-1.17.17-2.34.23-3.51.15-.01.32-.03.52-.04.36-.03 1.73-.15 2.06-.15.39 0 .7-.02.95-.04 1.76 1.11 3.45 2.35 5.14 3.55 2.83 2.01 5.64 4.04 8.47 6.04 1.42 1 2.85 2 4.29 2.97.1.06.19.07.27.04.08 0 .17-.02.25-.1 1.61-1.56 3.15-3.18 4.6-4.88.75-.88 1.49-1.78 2.15-2.73.01.01.03.02.04.03.34.3.83-.2.49-.49-2.16-1.9-4.34-3.76-6.64-5.48l.03-.01Zm-6.38-3.65a55.72 55.72 0 0 0-4-2.13c.14-.1.26-.19.4-.29 1.2.81 2.4 1.61 3.6 2.42Zm-20.1 11.78c.67-.37 1.23-.91 1.67-1.6-.11.5-.24 1-.38 1.49-.43.04-.86.08-1.29.11Zm2.38-37.24c1.34-.31 2.56-.52 3.71-.69-1.03.19-2.04.41-3.04.65-.14-.07-.34-.02-.45.11-.07.02-.15.04-.22.05v-.13.01Zm.04.84c.07-.02.14-.03.2-.05.34 1.66.41 3.41.5 5.09.17 2.9.24 5.81.28 8.71l.03 3.17c-.17.07-.34.14-.51.2-.06-4.96-.21-10.58-.51-17.12h.01Zm16.04 5.62c-1.16 2.25-3.06 4.1-5.02 5.66-2.8 2.23-5.99 3.97-9.3 5.35-.01-3.56-.09-7.12-.27-10.67-.1-2.04-.16-4.16-.57-6.18 3.3-.78 6.72-1.36 10.1-1.1 1.85.14 4.23.59 5.32 2.29.92 1.43.46 3.24-.26 4.65Zm.85-.18c.6-1.37.9-2.92.28-4.32-.67-1.52-2.2-2.32-3.76-2.74.46.1.89.21 1.29.37 1.74.67 2.69 1.88 2.93 3.21.2 1.13-.05 2.25-.74 3.47V70Zm-27.47-4.14c-.12-.19-.23-.38-.34-.57.74.42.85.36.99.41v.08c-.22.03-.43.06-.65.08Zm11.21 30.46c-.08 1.08-.16 2.17-.33 3.24-.05.35-.11.69-.2 1.03 0 .04-.02.07-.03.11-.15.02-.3.04-.45.05.45-1.64.76-3.36.79-5.07.03-.29.08-.57.1-.89-.03-.31-.03-.47.24-.57-.04.69-.07 1.39-.12 2.08v.02Zm5.6-2.47c.48.11.92.52 2.49 1.72-.46-.32-.92-.65-1.38-.97-.37-.25-.73-.5-1.1-.75h-.01Zm21.23 7.24a70.76 70.76 0 0 1-4.37 4.63c-.14-.09-.27-.19-.4-.28.19-.09.37-.24.55-.47.87-1.14 5.43-5.51 5.49-7.45.31.26.62.53.92.79-.67.97-1.42 1.88-2.19 2.77v.01Z`,fill:`currentColor`,transform:`translate(-144.023 -51.76)`})]}),Nz=({style:e,size:t=`small`,withText:n})=>(0,W.jsxs)(`div`,{className:`ExcalidrawLogo is-${t}`,style:e,children:[(0,W.jsx)(jz,{}),n&&(0,W.jsx)(Mz,{})]}),Pz=({icon:e,shortcut:t,children:n})=>{let r=iz();return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__icon`,children:e}),(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__text`,children:n}),t&&r.formFactor!==`phone`&&(0,W.jsx)(`div`,{className:`welcome-screen-menu-item__shortcut`,children:t})]})};Pz.displayName=`WelcomeScreenMenuItemContent`;var Fz=({onSelect:e,children:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`button`,{...a,type:`button`,className:`welcome-screen-menu-item ${i}`,onClick:e,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:t})});Fz.displayName=`WelcomeScreenMenuItem`;var Iz=({children:e,href:t,icon:n,shortcut:r,className:i=``,...a})=>(0,W.jsx)(`a`,{...a,className:`welcome-screen-menu-item ${i}`,href:t,target:`_blank`,rel:`noopener`,children:(0,W.jsx)(Pz,{icon:n,shortcut:r,children:e})});Iz.displayName=`WelcomeScreenMenuItemLink`;var Lz=({children:e})=>{let{WelcomeScreenCenterTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsx)(`div`,{className:`welcome-screen-center`,children:e||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Rz,{}),(0,W.jsx)(zz,{children:K(`welcomeScreen.defaults.center_heading`)}),(0,W.jsxs)(Bz,{children:[(0,W.jsx)(Hz,{}),(0,W.jsx)(Vz,{})]})]})})})};Lz.displayName=`Center`;var Rz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__logo excalifont welcome-screen-decor`,children:e||(0,W.jsx)(Nz,{withText:!0})});Rz.displayName=`Logo`;var zz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-center__heading welcome-screen-decor excalifont`,children:e});zz.displayName=`Heading`;var Bz=({children:e})=>(0,W.jsx)(`div`,{className:`welcome-screen-menu`,children:e});Bz.displayName=`Menu`;var Vz=()=>{let e=uz();return(0,W.jsx)(Fz,{onSelect:()=>e.executeAction(ZT),shortcut:`?`,icon:bb,children:K(`helpDialog.title`)})};Vz.displayName=`MenuItemHelp`;var Hz=()=>{let e=gC(),t=uz();return e.viewModeEnabled?null:(0,W.jsx)(Fz,{onSelect:()=>t.executeAction(KT),shortcut:ND(`loadScene`),icon:Ab,children:K(`buttons.load`)})};Hz.displayName=`MenuItemLoadScene`;var Uz=({onSelect:e})=>{let{t}=Fy();return(0,W.jsx)(Fz,{shortcut:null,onSelect:e,icon:ex,children:t(`labels.liveCollaboration`)})};Uz.displayName=`MenuItemLiveCollaborationTrigger`,Lz.Logo=Rz,Lz.Heading=zz,Lz.Menu=Bz,Lz.MenuItem=Fz,Lz.MenuItemLink=Iz,Lz.MenuItemHelp=Vz,Lz.MenuItemLoadScene=Hz,Lz.MenuItemLiveCollaborationTrigger=Uz;var Wz=({children:e})=>{let{WelcomeScreenMenuHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--menu`,children:[Jy,(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.menuHint`)})]})})};Wz.displayName=`MenuHint`;var Gz=({children:e})=>{let{WelcomeScreenToolbarHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--toolbar`,children:[(0,W.jsx)(`div`,{className:`welcome-screen-decor-hint__label`,children:e||K(`welcomeScreen.defaults.toolbarHint`)}),Xy]})})};Gz.displayName=`ToolbarHint`;var Kz=({children:e})=>{let{WelcomeScreenHelpHintTunnel:t}=gk();return(0,W.jsx)(t.In,{children:(0,W.jsxs)(`div`,{className:`excalifont welcome-screen-decor welcome-screen-decor-hint welcome-screen-decor-hint--help`,children:[(0,W.jsx)(`div`,{children:e||K(`welcomeScreen.defaults.helpHint`)}),Yy]})})};Kz.displayName=`HelpHint`;var qz=e=>(0,W.jsx)(W.Fragment,{children:e.children||(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Lz,{}),(0,W.jsx)(Wz,{}),(0,W.jsx)(Gz,{}),(0,W.jsx)(Kz,{})]})});qz.displayName=`WelcomeScreen`,qz.Center=Lz,qz.Hints={MenuHint:Wz,ToolbarHint:Gz,HelpHint:Kz};var Jz=()=>{Array.prototype.at||Object.defineProperty(Array.prototype,`at`,{value:function(e){if(e=Math.trunc(e)||0,e<0&&(e+=this.length),!(e<0||e>=this.length))return this[e]},writable:!0,enumerable:!1,configurable:!0}),Element.prototype.replaceChildren||(Element.prototype.replaceChildren=function(...e){this.innerHTML=``,this.append(...e)})},Yz=(e,t,n)=>!!(t&&(t.id===e.editingTextElement?.id||t.id===e.resizingElement?.id||t.id===e.newElement?.id||t.version>n.version||t.version===n.version&&t.versionNonce<=n.versionNonce)),Xz=(0,gc.default)((e,t,n)=>{(Vt()||h()||window?.DEBUG_FRACTIONAL_INDICES)&&zt(ho(e.map(e=>({...e}))),{shouldThrow:h()||Vt(),includeBoundTextValidation:!0,reconciliationContext:{localElements:t,remoteElements:n}})},1e3*60,{leading:!0,trailing:!1}),Zz=(e,t,n)=>{let r=lr(e),i=[],a=new Set;for(let e of t)if(!a.has(e.id)){let t=r.get(e.id),o=Yz(n,t,e);t&&o?(i.push(t),a.add(t.id)):(i.push(e),a.add(e.id))}for(let t of e)a.has(t.id)||(i.push(t),a.add(t.id));let o=jo(i);return Xz(o,e,t),ho(o),o},Qz=({children:e,icon:t})=>{let{t:n}=Fy(),{TTDDialogTriggerTunnel:r}=gk(),i=lz();return(0,W.jsx)(r.In,{children:(0,W.jsx)(HO.Item,{onSelect:()=>{dC(`ai`,`dialog open`,`ttd`),i({openDialog:{name:`ttd`,tab:`text-to-diagram`}})},icon:t??gS,badge:(0,W.jsx)(HO.Item.Badge,{children:`AI`}),children:e??n(`labels.textToDiagram`)})})};Qz.displayName=`TTDDialogTrigger`,Jz();var $z=H.memo(e=>{let{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:o,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u=!1,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m=Ey.code,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,onPaste:S,detectScroll:C=!0,handleKeyboardGlobally:w=!1,onLibraryChange:T,autoFocus:E=!1,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,children:j,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae,showDeprecatedFonts:oe,renderScrollbars:se}=e,ce=e.UIOptions?.canvasActions,le={...e.UIOptions,canvasActions:{...Nt.canvasActions,...ce},tools:{image:e.UIOptions?.tools?.image??!0}};ce?.export&&(le.canvasActions.export.saveFileToDisk=ce.export?.saveFileToDisk??Nt.canvasActions.export.saveFileToDisk),le.canvasActions.toggleTheme===null&&typeof y>`u`&&(le.canvasActions.toggleTheme=!0);let ue=(0,H.useContext)(tz),de=(0,H.useRef)(o);de.current=o;let fe=(0,H.useCallback)(e=>{ue?.(e),de.current?.(e)},[ue]);return(0,H.useEffect)(()=>{(async()=>{await n(()=>import(`./roundRect-CDlbNkEg.js`),[],import.meta.url)})();let e=e=>{typeof e.scale==`number`&&e.scale!==1&&e.preventDefault()};return document.addEventListener(`touchmove`,e,{passive:!1}),()=>{document.removeEventListener(`touchmove`,e)}},[]),(0,W.jsx)(Sy,{store:Cy,children:(0,W.jsx)(Oz,{langCode:m,theme:y,children:(0,W.jsx)(Dz,{onExport:t,onChange:r,onIncrement:i,initialData:a,onExcalidrawAPI:fe,onMount:s,onUnmount:c,onInitialize:l,isCollaborating:u,onPointerUpdate:d,renderTopLeftUI:f,renderTopRightUI:p,langCode:m,viewModeEnabled:h,zenModeEnabled:g,gridModeEnabled:_,libraryReturnUrl:v,theme:y,name:b,renderCustomStats:x,UIOptions:le,onPaste:S,detectScroll:C,handleKeyboardGlobally:w,onLibraryChange:T,autoFocus:E,generateIdForFile:D,onLinkOpen:O,generateLinkForSelection:k,onPointerDown:A,onPointerUp:ee,onScrollChange:te,onDuplicate:ne,validateEmbeddable:re,renderEmbeddable:ie,aiEnabled:ae!==!1,showDeprecatedFonts:oe,renderScrollbars:se,children:j})})})},(e,t)=>{if(e.children!==t.children)return!1;let{initialData:n,UIOptions:r={},...i}=e,{initialData:a,UIOptions:o={},...s}=t,c=Object.keys(r),l=Object.keys(o);return c.length===l.length?c.every(e=>e===`getFormFactor`?!0:e===`canvasActions`?Object.keys(r.canvasActions).every(e=>e===`export`&&r?.canvasActions?.export&&o?.canvasActions?.export?r.canvasActions.export.saveFileToDisk===o.canvasActions.export.saveFileToDisk:r?.canvasActions?.[e]===o?.canvasActions?.[e]):r[e]===o[e])&&ji(i,s):!1});$z.displayName=`Excalidraw`;function eB(e){let t=String(e||``).trim().replace(/\s+/g,` `);return t?t.slice(0,24):null}function tB(){return{type:`excalidraw`,version:2,source:`collabmd`,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function nB(e){return!e||typeof e!=`object`?tB():{type:`excalidraw`,version:2,source:`collabmd`,elements:Array.isArray(e.elements)?e.elements:[],appState:{gridSize:e.appState?.gridSize??null,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`},files:e.files&&typeof e.files==`object`?e.files:{}}}function rB(e){return iB(e)||tB()}function iB(e){if(!e)return null;try{return nB(JSON.parse(e))}catch{return null}}function aB(e,{theme:t=`dark`}={}){return{elements:e.elements||[],appState:{theme:t,viewBackgroundColor:e.appState?.viewBackgroundColor??`#ffffff`,gridSize:e.appState?.gridSize??null},files:e.files||{}}}function oB(e,t,n){return nB({elements:Array.isArray(e)?e:[],appState:{gridSize:t?.gridSize??null,viewBackgroundColor:t?.viewBackgroundColor??`#ffffff`},files:n||{}})}var sB=[`#ef4444`,`#f97316`,`#eab308`,`#22c55e`,`#06b6d4`,`#3b82f6`,`#8b5cf6`,`#ec4899`,`#14b8a6`,`#f59e0b`,`#6366f1`,`#10b981`,`#f43f5e`,`#0ea5e9`,`#a855f7`];function cB(e){let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)}function lB(){let e=new Uint8Array(8);return globalThis.crypto?.getRandomValues?.(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}function uB(e){return sB[cB(e)%sB.length]}function dB(e,t){return t&&/^#[0-9a-fA-F]{8}$/.test(t)?t:/^#[0-9a-fA-F]{6}$/.test(e)?`${e}33`:`#0ea5e933`}function fB({params:e,storedUserName:t,generatePeerIdFn:n=lB}){let r=eB(e.get(`userName`))||eB(t)||`User`,i=e.get(`userPeerId`)||n(),a=e.get(`userColor`)||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,e.get(`userColorLight`)),name:r,peerId:i}}function pB({currentUser:e,nextUser:t={},generatePeerIdFn:n=lB}){let r=eB(t.name)||e?.name||`User`,i=t.peerId||e?.peerId||n(),a=t.color||e?.color||uB(`${r}-${i}`);return{color:a,colorLight:dB(a,t.colorLight||e?.colorLight),name:r,peerId:i}}function mB(e){if(!e||typeof e!=`object`)return;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);if(!(!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0))return{scrollX:t,scrollY:n,zoom:r}}function hB(e){let t=new Map;return e&&e.getStates().forEach((n,r)=>{let i=n?.user;if(!i)return;let a=n.pointer&&Number.isFinite(n.pointer.x)&&Number.isFinite(n.pointer.y)?{x:n.pointer.x,y:n.pointer.y,tool:n.pointer.tool===`laser`?`laser`:`pointer`}:void 0,o=mB(n.viewport);t.set(String(r),{button:n.pointerButton===`down`?`down`:`up`,color:{background:dB(i.color||`#0ea5e9`,i.colorLight),stroke:i.color||`#0ea5e9`},id:i.peerId||String(r),isCurrentUser:r===e.clientID,pointer:a,viewport:o,selectedElementIds:n.selectedElementIds||void 0,socketId:String(r),username:i.name||`User`})}),t}function gB(e,t){if(!(e instanceof Map)||!t)return null;for(let n of e.values())if(n?.id===t)return n;return null}var _B=`excalidraw`,vB=2,yB=`collabmd`,bB=`excalidraw-app-state`,xB=`excalidraw-elements`,SB=`excalidraw-files`,CB=`excalidraw-meta`,wB=`codemirror`,TB=`schemaVersion`;function EB(){return{type:_B,version:vB,source:yB,elements:[],appState:{gridSize:null,viewBackgroundColor:`#ffffff`},files:{}}}function DB(e={}){return{gridSize:e?.gridSize??null,viewBackgroundColor:e?.viewBackgroundColor??`#ffffff`}}function OB(e){return!e||typeof e!=`object`?EB():{type:_B,version:vB,source:yB,elements:Array.isArray(e.elements)?e.elements:[],appState:DB(e.appState),files:e.files&&typeof e.files==`object`?e.files:{}}}function kB(e,{fallbackToEmpty:t=!0}={}){if(!e)return t?EB():null;try{return OB(JSON.parse(e))}catch{return t?EB():null}}function AB(e){if(e!==void 0)return JSON.parse(JSON.stringify(e))}function jB(e){return`${Number.isFinite(Number(e?.version))?Number(e.version):0}:${Number.isFinite(Number(e?.versionNonce))?Number(e.versionNonce):0}:${Number.isFinite(Number(e?.updated))?Number(e.updated):0}`}function MB(e,t){let n=Number(e?.version)||0,r=Number(t?.version)||0;if(n!==r)return n-r;let i=Number(e?.versionNonce)||0,a=Number(t?.versionNonce)||0;if(i!==a)return i-a;let o=Number(e?.updated)||0,s=Number(t?.updated)||0;return o===s?String(e?.id||``).localeCompare(String(t?.id||``)):o-s}function NB(e,t){let n=e?.index??``,r=t?.index??``;return n===r?String(e?.id||``).localeCompare(String(t?.id||``)):String(n).localeCompare(String(r))}function PB(e,t,{create:n=!1}={}){let r=e.get(t);if(r instanceof ic)return r;if(!n)return null;let i=new ic;return e.set(t,i),i}function FB(e){if(typeof e==`string`)try{return JSON.parse(e)}catch{return null}return!e||typeof e!=`object`?null:AB(e)}function IB(e){if(!(e instanceof ic)||e.size===0)return null;let t=null;return e.forEach(e=>{let n=FB(e);!n||!n.id||(!t||MB(n,t)>0)&&(t=n)}),t}function LB(e,t,{maxRevisions:n=2}={}){let r=jB(t),i=AB(t),a=e.get(r);return(a&&typeof a==`object`?JSON.stringify(a):``)===JSON.stringify(i)?!1:(e.set(r,i),RB(e,n),!0)}function RB(e,t=2){if(!(e instanceof ic)||e.size<=t)return;let n=[];for(e.forEach((e,t)=>{let r=FB(e);if(!r){n.push({element:null,key:t});return}n.push({element:r,key:t})}),n.sort((e,t)=>e.element?t.element?MB(e.element,t.element):1:-1);n.length>t;){let t=n.shift();t?.key&&e.delete(t.key)}}function zB(e){return[...e].sort(NB)}function BB(e){if(!e)return!1;let t=e.getMap(CB);return Number(t.get(`schemaVersion`))===1?!0:e.getMap(`excalidraw-elements`).size>0||e.getMap(`excalidraw-files`).size>0||e.getMap(`excalidraw-app-state`).size>0}function VB(e){let t=e.getMap(CB);return Number(t.get(`schemaVersion`))!==1&&t.set(TB,1),t}function HB(e,{includeDeleted:t=!0}={}){if(!e)return EB();let n=e.getMap(xB),r=e.getMap(SB),i=e.getMap(bB),a=[];n.forEach(e=>{let n=IB(e);n&&(!t&&n.isDeleted||a.push(n))});let o={};return r.forEach((e,t)=>{!e||typeof e!=`object`||(o[t]=AB(e))}),OB({appState:{gridSize:i.get(`gridSize`),viewBackgroundColor:i.get(`viewBackgroundColor`)},elements:zB(a),files:o})}function UB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return EB();let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB);Array.from(i.keys()).forEach(e=>i.delete(e)),Array.from(a.keys()).forEach(e=>a.delete(e)),Array.from(o.keys()).forEach(e=>o.delete(e)),r.elements.forEach(e=>{e?.id&&LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})}),Object.entries(r.files||{}).forEach(([e,t])=>{a.set(e,AB(t))});let s=DB(r.appState);return o.set(`gridSize`,s.gridSize),o.set(`viewBackgroundColor`,s.viewBackgroundColor),r}function WB(e,t,{maxRevisionsPerElement:n=2}={}){if(!e)return!1;let r=OB(t);VB(e);let i=e.getMap(xB),a=e.getMap(SB),o=e.getMap(bB),s=new Set,c=!1;r.elements.forEach(e=>{e?.id&&(s.add(e.id),c=LB(PB(i,e.id,{create:!0}),e,{maxRevisions:n})||c)}),Array.from(i.keys()).forEach(e=>{s.has(e)||(i.delete(e),c=!0)});let l=r.files||{};Object.entries(l).forEach(([e,t])=>{let n=AB(t),r=a.get(e);JSON.stringify(r)!==JSON.stringify(n)&&(a.set(e,n),c=!0)}),Array.from(a.keys()).forEach(e=>{e in l||(a.delete(e),c=!0)});let u=DB(r.appState);return Object.entries(u).forEach(([e,t])=>{o.get(e)!==t&&(o.set(e,t),c=!0)}),Array.from(o.keys()).forEach(e=>{e in u||(o.delete(e),c=!0)}),c}function GB(e){return e?kB(e.getText(wB).toString(),{fallbackToEmpty:!1}):null}var KB=250,qB=48,JB=4e3,YB=class{constructor({cancelAnimationFrameFn:e=e=>cancelAnimationFrame(e),clearTimeoutFn:t=e=>clearTimeout(e),emptySceneGuardMs:n=KB,filePath:r=``,now:i=()=>Date.now(),onCollaboratorsChange:a=()=>{},onRemoteSceneJson:o=()=>{},requestAnimationFrameFn:s=e=>requestAnimationFrame(e),resolveWsBaseUrlFn:c=nc,saveThrottleMs:l=qB,setTimeoutFn:u=(e,t)=>window.setTimeout(e,t),syncTimeoutMs:d=JB,vaultClient:f,websocketProviderFactory:p=(e,t,n,r)=>new rc(e,t,n,r),ydocFactory:m=()=>new ac}){this.cancelAnimationFrameFn=e,this.clearTimeoutFn=t,this.emptySceneGuardMs=n,this.filePath=r,this.now=i,this.onCollaboratorsChange=a,this.onRemoteSceneJson=o,this.requestAnimationFrameFn=s,this.resolveWsBaseUrlFn=c,this.saveThrottleMs=l,this.setTimeoutFn=u,this.syncTimeoutMs=d,this.vaultClient=f,this.websocketProviderFactory=p,this.ydocFactory=m,this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.provider=null,this.awareness=null,this.localUser=null,this.handleProviderSync=null,this.lastSceneJson=``,this.sceneSyncTimer=null,this.lastSceneSyncAt=0,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0,this.handleAwarenessChange=()=>{this.onCollaboratorsChange(hB(this.awareness))},this.handleStructuredSceneUpdate=()=>{if(!this.ydoc)return;let e=this.getStructuredSceneJson();!e||e===this.lastSceneJson||(this.unlockRoomWrites(),this.pendingEmptySceneCandidate=null,this.lastSceneJson=JSON.stringify(rB(e)),this.onRemoteSceneJson(this.lastSceneJson))}}getLastSceneJson(){return this.lastSceneJson}getLocalUser(){return this.localUser}getHistoryState(){return{canRedo:!1,canUndo:!1,head:null,length:null}}canRedo(){return this.getHistoryState().canRedo}canUndo(){return this.getHistoryState().canUndo}isApplyingSharedSnapshot(){return this.applyingSharedSnapshotDepth>0}beginApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth+=1}endApplyingSharedSnapshot(){this.applyingSharedSnapshotDepth=Math.max(0,this.applyingSharedSnapshotDepth-1)}subscribeHistoryState(e){return typeof e==`function`&&e(this.getHistoryState()),()=>{}}setLocalUser(e={}){return this.localUser=pB({currentUser:this.localUser,nextUser:e}),this.awareness&&this.awareness.setLocalStateField(`user`,this.localUser),this.handleAwarenessChange(),this.localUser}async connect({initialUser:e=null}={}){if(this.localUser=e,!this.filePath){let e=tB();return this.lastSceneJson=JSON.stringify(e),e}this.ydoc=this.ydocFactory(),this.roomMeta=this.ydoc.getMap(CB),this.roomElements=this.ydoc.getMap(xB),this.roomFiles=this.ydoc.getMap(SB),this.roomAppState=this.ydoc.getMap(bB),this.provider=this.websocketProviderFactory(this.resolveWsBaseUrlFn(),this.filePath,this.ydoc,{disableBc:!0,maxBackoffTime:5e3}),oc(this.provider),this.awareness=this.provider.awareness,this.localUser&&this.awareness.setLocalStateField(`user`,this.localUser),this.awareness.setLocalStateField(`pointerButton`,`up`),this.awareness.setLocalStateField(`selectedElementIds`,{}),this.awareness.on(`change`,this.handleAwarenessChange),this.handleProviderSync=e=>{e&&(this.unlockRoomWrites(),this.handleStructuredSceneUpdate())},this.provider.on(`sync`,this.handleProviderSync);let t=await this.waitForSync(this.provider,this.syncTimeoutMs),n=this.getStructuredSceneJson(),r=!1;if(!n){let e=await this.loadSceneFromApi(),t=this.getStructuredSceneJson();t?n=t:(n=JSON.stringify(e),r=!0)}return n||=JSON.stringify(tB()),this.waitingForAuthoritativeSync=r&&!t,this.canWriteToRoom=!this.waitingForAuthoritativeSync,this.lastSceneJson=JSON.stringify(rB(n)),!r&&this.canWriteToRoom&&!BB(this.ydoc)&&this.ydoc.transact(()=>{this.replaceStructuredSceneWithinTransaction(this.lastSceneJson)},`excalidraw-legacy-migrate`),this.roomMeta.observe(this.handleStructuredSceneUpdate),this.roomElements.observeDeep(this.handleStructuredSceneUpdate),this.roomFiles.observeDeep(this.handleStructuredSceneUpdate),this.roomAppState.observe(this.handleStructuredSceneUpdate),r&&this.canWriteToRoom&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-api-fallback`}),this.handleStructuredSceneUpdate(),this.handleAwarenessChange(),rB(this.lastSceneJson)}async loadSceneFromApi({createIfMissing:e=!0}={}){if(!this.filePath)return tB();try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(t){if(t?.status!==404||!e)throw t?.status===404?Error(t.message||`Excalidraw file not found`):Error(t?.message||`Failed to load Excalidraw file`)}let t=tB();try{return await this.vaultClient.createFile({content:JSON.stringify(t),path:this.filePath}),t}catch(e){if(e?.status===409)try{return rB((await this.vaultClient.readFile(this.filePath)).content)}catch(e){throw Error(e?.message||`Failed to load existing Excalidraw file after create conflict`)}throw Error(e?.message||`Failed to create Excalidraw file`)}}waitForSync(e,t=JB){return e.synced?Promise.resolve(!0):new Promise(n=>{let r=!1,i=t=>{!t||r||(r=!0,this.clearTimeoutFn(a),e.off(`sync`,i),n(!0))},a=this.setTimeoutFn(()=>{r||(r=!0,e.off(`sync`,i),n(!1))},t);e.on(`sync`,i)})}unlockRoomWrites(){this.waitingForAuthoritativeSync=!1,this.canWriteToRoom=!0,!this.getStructuredSceneJson()&&this.lastSceneJson&&this.commitSceneJson(this.lastSceneJson,{origin:`excalidraw-authoritative-seed`}),this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}getStructuredSceneJson(){if(!this.ydoc)return``;if(BB(this.ydoc))return JSON.stringify(HB(this.ydoc));let e=GB(this.ydoc);return e?JSON.stringify(e):``}replaceStructuredSceneWithinTransaction(e){if(!this.ydoc)return;let t=iB(e);t&&(VB(this.ydoc),UB(this.ydoc,t))}scheduleSceneSync(e,t,n){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.canWriteToRoom&&this.scheduleSceneSyncFlush()}scheduleSceneSyncFlush(){if(this.sceneSyncTimer!==null)return;let e=this.now()-this.lastSceneSyncAt,t=Math.max(0,this.saveThrottleMs-e);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},t)}flushSceneSync(){if(!this.ydoc||!this.pendingSceneSyncPayload)return;let{elements:e,appState:t,files:n}=this.pendingSceneSyncPayload;this.pendingSceneSyncPayload=null;let r=oB(e,t,n),i=JSON.stringify(r);if(this.shouldDelayEmptySceneCommit(i)){this.pendingSceneSyncPayload={appState:t,elements:e,files:n},this.scheduleDelayedEmptySceneCommit();return}i!==this.lastSceneJson&&(this.lastSceneSyncAt=this.now(),this.commitSceneJson(i,{origin:`excalidraw-local-change`})),this.pendingEmptySceneCandidate=null,this.pendingSceneSyncPayload&&this.scheduleSceneSyncFlush()}hasRemoteCollaborators(){if(!this.awareness)return!1;for(let[e,t]of this.awareness.getStates())if(e!==this.awareness.clientID&&t?.user)return!0;return!1}shouldDelayEmptySceneCommit(e){if(!this.emptySceneGuardMs||!this.hasRemoteCollaborators()||rB(e).elements.length>0||rB(this.lastSceneJson||this.getStructuredSceneJson()).elements.length===0)return this.pendingEmptySceneCandidate=null,!1;let t=this.now();return!this.pendingEmptySceneCandidate||this.pendingEmptySceneCandidate.previousSceneJson!==this.lastSceneJson?(this.pendingEmptySceneCandidate={firstSeenAt:t,previousSceneJson:this.lastSceneJson},console.warn(`[excalidraw:${this.filePath}] Delaying suspicious empty scene commit during active collaboration`),!0):t-this.pendingEmptySceneCandidate.firstSeenAt<this.emptySceneGuardMs}scheduleDelayedEmptySceneCommit(){if(this.sceneSyncTimer!==null)return;let e=this.pendingEmptySceneCandidate?.firstSeenAt??this.now(),t=this.now()-e,n=Math.max(0,this.emptySceneGuardMs-t);this.sceneSyncTimer=this.setTimeoutFn(()=>{this.sceneSyncTimer=null,this.flushSceneSync()},n)}flushPointerAwarenessPayload(){this.pointerAwarenessFrame=0,!(!this.awareness||!this.pendingPointerPayload)&&(this.awareness.setLocalStateField(`pointer`,this.pendingPointerPayload.pointer),this.awareness.setLocalStateField(`pointerButton`,this.pendingPointerPayload.button),this.pendingPointerPayload=null)}normalizeViewportAwareness(e){if(!e||typeof e!=`object`)return null;let t=Number(e.scrollX),n=Number(e.scrollY),r=Number(e.zoom);return!Number.isFinite(t)||!Number.isFinite(n)||!Number.isFinite(r)||r<=0?null:{scrollX:t,scrollY:n,zoom:r}}scheduleLocalPointerAwareness(e){!this.awareness||!e?.pointer||(this.pendingPointerPayload={button:e.button===`down`?`down`:`up`,pointer:{x:e.pointer.x,y:e.pointer.y,tool:e.pointer.tool===`laser`?`laser`:`pointer`}},!this.pointerAwarenessFrame&&(this.pointerAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushPointerAwarenessPayload())))}flushViewportAwarenessPayload(){this.viewportAwarenessFrame=0,!(!this.awareness||!this.pendingViewportPayload)&&(this.awareness.setLocalStateField(`viewport`,this.pendingViewportPayload),this.pendingViewportPayload=null)}scheduleLocalViewportAwareness(e){if(!this.awareness)return;let t=this.normalizeViewportAwareness(e);if(!t)return;let n=`${t.scrollX}:${t.scrollY}:${t.zoom}`;n!==this.lastViewportSignature&&(this.lastViewportSignature=n,this.pendingViewportPayload=t,!this.viewportAwarenessFrame&&(this.viewportAwarenessFrame=this.requestAnimationFrameFn(()=>this.flushViewportAwarenessPayload())))}syncLocalSelectionAwareness(e){if(!this.awareness)return;let t=e?.selectedElementIds||{},n=Object.keys(t).sort().join(`,`);n!==this.lastSelectedIdsSignature&&(this.lastSelectedIdsSignature=n,this.awareness.setLocalStateField(`selectedElementIds`,t))}commitSceneJson(e,{origin:t=`excalidraw-room-write`}={}){let n=JSON.stringify(rB(e));if(!this.ydoc){let e=n!==this.lastSceneJson;return this.lastSceneJson=n,e}return n===this.getStructuredSceneJson()&&n===this.lastSceneJson?!1:(this.lastSceneJson=n,this.ydoc.transact(()=>{WB(this.ydoc,rB(n))},t),!0)}disconnect(){this.flushSceneSync(),this.clearTimeoutFn(this.sceneSyncTimer),this.sceneSyncTimer=null,this.pendingSceneSyncPayload=null,this.pointerAwarenessFrame&&this.cancelAnimationFrameFn(this.pointerAwarenessFrame),this.pointerAwarenessFrame=0,this.pendingPointerPayload=null,this.viewportAwarenessFrame&&this.cancelAnimationFrameFn(this.viewportAwarenessFrame),this.viewportAwarenessFrame=0,this.pendingViewportPayload=null,this.lastViewportSignature=``,this.lastSelectedIdsSignature=``,this.pendingEmptySceneCandidate=null,this.roomMeta?.unobserve(this.handleStructuredSceneUpdate),this.roomElements?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomFiles?.unobserveDeep(this.handleStructuredSceneUpdate),this.roomAppState?.unobserve(this.handleStructuredSceneUpdate),this.awareness&&(this.awareness.off(`change`,this.handleAwarenessChange),this.awareness.setLocalState(null)),this.awareness=null,this.provider&&this.handleProviderSync&&this.provider.off(`sync`,this.handleProviderSync),this.handleProviderSync=null,this.provider?.disconnect(),this.provider?.destroy(),this.provider=null,this.ydoc?.destroy(),this.ydoc=null,this.roomMeta=null,this.roomElements=null,this.roomFiles=null,this.roomAppState=null,this.localUser=null,this.canWriteToRoom=!1,this.waitingForAuthoritativeSync=!1,this.applyingSharedSnapshotDepth=0}},XB=new URLSearchParams(window.location.search),ZB=XB.get(`file`),QB=XB.get(`test`)===`1`,$B=XB.get(`mode`)===`preview`,eV=window.location.origin,tV=Number.parseInt(XB.get(`syncTimeoutMs`)||``,10),nV=null,rV=XB.get(`theme`)||`dark`,iV=fB({params:XB,storedUserName:localStorage.getItem(`collabmd-user-name`)}),aV=``,oV=!1,sV=!1,cV=``,lV=null,uV=0,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,_V=[],vV=0,yV=null,bV=!0,xV=new YB({filePath:ZB,onCollaboratorsChange:e=>{if(!oV){lV=e;return}DV(e)},onRemoteSceneJson:e=>{OV(e)},syncTimeoutMs:Number.isFinite(tV)?tV:void 0,vaultClient:cc});function SV(e){let t=document.querySelector(`[data-testid="button-${e}"]`);return t instanceof HTMLButtonElement?t:null}function CV(){let e=SV(`undo`),t=SV(`redo`);return{canRedo:!!t&&!t.disabled,canUndo:!!e&&!e.disabled,head:null,length:null}}function wV(e){let t=SV(e);return!t||t.disabled?!1:(t.click(),!0)}function TV(e={}){iV=pB({currentUser:iV,nextUser:e}),xV.setLocalUser(iV)}QB&&(window.__COLLABMD_EXCALIDRAW_TEST__={getElementBounds:e=>{let t=nV?.getSceneElementsIncludingDeleted?.()?.find(t=>t.id===e&&!t.isDeleted);return t?{centerX:t.x+t.width/2,centerY:t.y+t.height/2,height:t.height,width:t.width,x:t.x,y:t.y}:null},getElementCount:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).length??0,getElementIds:()=>nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted).map(e=>e.id).sort()??[],getHistoryState:()=>CV(),getLocalUserName:()=>iV?.name||``,getLocalPeerId:()=>iV?.peerId||``,getViewport:()=>{let e=nV?.getAppState?.();return e?{scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value??null}:null},isViewMode:()=>!!nV?.getAppState?.().viewModeEnabled,getSceneJson:()=>xV.getLastSceneJson(),isAuthoritativeReady:()=>!!nV&&oV&&xV.canWriteToRoom===!0&&xV.waitingForAuthoritativeSync===!1&&xV.isApplyingSharedSnapshot()===!1,isReady:()=>oV&&!!nV&&!!SV(`undo`)&&!!SV(`redo`),redoShared:()=>wV(`redo`),setScene:e=>{NV(nB(e),{captureUpdate:V.IMMEDIATELY})},setViewport:e=>{if(!nV)return;let t=nV.getAppState();nV.updateScene({appState:{scrollX:Number.isFinite(e?.scrollX)?e.scrollX:t.scrollX,scrollY:Number.isFinite(e?.scrollY)?e.scrollY:t.scrollY,zoom:Number.isFinite(e?.zoom)&&e.zoom>0?{value:e.zoom}:t.zoom},captureUpdate:V.NEVER})},undoShared:()=>wV(`undo`)});function EV(e){if(dV=e instanceof Map?e:new Map,!nV){lV=dV;return}if(nV.updateScene({collaborators:dV,captureUpdate:V.NEVER}),pV){VV(pV);return}BV(dV)}function DV(e){yV=e,!vV&&(vV=requestAnimationFrame(()=>{vV=0;let e=yV;yV=null,EV(e)}))}function OV(e){let t=rB(e),n=JSON.stringify(t);if(!(n===aV&&!cV)){if(aV=n,!nV||!oV){cV=n;return}MV(t)}}function kV({trackedSharedSnapshot:e=!1}={}){uV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{uV=Math.max(0,uV-1),e&&xV.endApplyingSharedSnapshot(),uV===0&&(sV=!1)})})}function AV(){hV+=1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{hV=Math.max(0,hV-1),hV===0&&(mV=!1)})})}function jV(e){let t=nV.getAppState(),n=nV.getSceneElementsIncludingDeleted?.()||nV.getSceneElements(),r=Sa(e?.elements||[],n,{repairBindings:!0}),i=gr(e?.appState||{},t),a=Zz(n,r,t);return{appState:{theme:rV,viewBackgroundColor:i.viewBackgroundColor??`#ffffff`,gridSize:i.gridSize??null},elements:a,files:e?.files||{}}}function MV(e,{captureUpdate:t=V.NEVER,trackedSharedSnapshot:n=!0}={}){let r=jV(e);sV=!0,n&&xV.beginApplyingSharedSnapshot();try{nV.updateScene({...r,captureUpdate:t})}finally{kV({trackedSharedSnapshot:n})}LV()}function NV(e,{captureUpdate:t=V.IMMEDIATELY}={}){let n=nB(e),r=JSON.stringify(n);if(aV=r,!nV||!oV){cV=r;return}nV.updateScene({...jV(n),captureUpdate:t}),sV&&xV.commitSceneJson(r,{origin:`excalidraw-local-scene-apply`})}function PV(){OV(xV.getLastSceneJson())}function FV(e,t={}){window.parent.postMessage({source:`excalidraw-editor`,type:e,...t},eV)}function IV(){return nV?.getSceneElementsIncludingDeleted?.()?.filter(e=>!e.isDeleted)??[]}function LV(){if(!bV||!nV)return;let e=IV();e.length!==0&&(bV=!1,requestAnimationFrame(()=>{requestAnimationFrame(()=>{nV&&nV.scrollToContent(e,{animate:!1,fitToViewport:!0,maxZoom:2,viewportZoomFactor:$B?.92:.88})})}))}function RV(){if(!oV||!nV||mV)return;let e=nV.getAppState();xV.scheduleLocalViewportAwareness({scrollX:e.scrollX,scrollY:e.scrollY,zoom:e.zoom?.value})}function zV(e,{force:t=!1}={}){let n=e?String(e):null,r=fV!==n;fV=n,r&&(gV=``),fV&&BV(dV,{force:t||r})}function BV(e=dV,{force:t=!1}={}){if(!nV||!fV)return;let n=e?.get?.(String(fV))?.viewport;if(!n)return;let r=`${fV}:${n.scrollX}:${n.scrollY}:${n.zoom}`;!t&&r===gV||(gV=r,mV=!0,nV.updateScene({appState:{scrollX:n.scrollX,scrollY:n.scrollY,zoom:{value:n.zoom}},captureUpdate:V.NEVER}),AV())}function VV(e){if(pV=e||null,!nV)return;if(!e){nV.updateScene({appState:{userToFollow:null},captureUpdate:V.NEVER}),zV(null,{force:!0}),pV=null;return}let t=gB(dV,e);t?.socketId&&(nV.updateScene({appState:{userToFollow:{socketId:t.socketId,username:t.username||``}},captureUpdate:V.NEVER}),zV(t.socketId,{force:!0}),pV=null)}function HV(){oV=!1,lV=null,dV=new Map,fV=null,pV=null,mV=!1,hV=0,gV=``,vV&&cancelAnimationFrame(vV),vV=0,yV=null,_V.forEach(e=>e()),_V=[],xV.disconnect()}var UV=!1;function WV(){UV||(UV=!0,HV())}async function GV({intervalMs:e=10,maxWaitMs:t=150}={}){let n=performance.now();for(;performance.now()-n<t;){let t=xV.provider?.ws;if(!t||t.readyState!==WebSocket.OPEN||t.bufferedAmount===0)return;await new Promise(t=>window.setTimeout(t,e))}}async function KV(){xV.flushSceneSync(),await GV()}window.addEventListener(`pagehide`,WV),window.addEventListener(`message`,e=>{if(e.origin!==eV)return;let t=e.data;if(!(!t||t.source!==`collabmd-host`)){if(t.type===`set-theme`){rV=t.theme||`dark`,nV&&(sV=!0,nV.updateScene({appState:{theme:rV},captureUpdate:V.NEVER}),kV());return}if(t.type===`set-user`){TV(t.user);return}if(t.type===`follow-user`){VV(t.peerId||null);return}t.type===`prepare-disconnect`&&(async()=>{await KV(),FV(`disconnect-ready`,{requestId:t.requestId||``})})()}});function qV(e,t,n){!oV||sV||(aV=JSON.stringify(nB({elements:e,appState:t,files:n})),xV.scheduleSceneSync(e,t,n))}function JV(e){nV=e,_V.forEach(e=>e()),_V=[],_V.push(e.onStateChange([`scrollX`,`scrollY`,`zoom`],()=>{RV()})),_V.push(e.onStateChange(`userToFollow`,e=>{if(e?.socketId){zV(e.socketId,{force:!0});return}zV(null,{force:!0})}));let t=cV||xV.getLastSceneJson();cV=``,MV(rB(t)),lV&&=(nV.updateScene({collaborators:lV,captureUpdate:V.NEVER}),null),oV=!0,RV(),PV(),pV&&VV(pV),LV(),FV(`ready`)}function YV({excalidrawAPI:e}){nV=e}async function XV(){let e=document.getElementById(`loadingState`);try{await sc();let t=aB(await xV.connect({initialUser:iV}),{theme:rV});e?.remove();let n={onMount:YV,onInitialize:e=>{JV(e)},onUnmount:()=>{_V.forEach(e=>e()),_V=[],nV=null,oV=!1},initialData:t,aiEnabled:!1,isCollaborating:!0,onChange:(e,t,n)=>{qV(e,t,n),xV.syncLocalSelectionAwareness(t)},onPointerUpdate:e=>{xV.scheduleLocalPointerAwareness(e)},theme:rV,viewModeEnabled:$B,zenModeEnabled:$B,UIOptions:{canvasActions:{export:!1,loadScene:!1,saveToActiveFile:!1,toggleTheme:!1}}};(0,mc.createRoot)(document.getElementById(`root`)).render(H.createElement(()=>H.createElement(`div`,{style:{height:`100vh`,width:`100%`}},H.createElement($z,n))))}catch(t){console.error(`[excalidraw] Failed to initialize:`,t),FV(`error`,{message:t instanceof Error?t.message:`Failed to load Excalidraw`}),e&&(e.className=`loading-state error`,e.textContent=`Failed to load Excalidraw: ${t instanceof Error?t.message:String(t)}`)}}XV();
|