@flyfish-group/file-viewer-web 1.0.22 → 1.0.23
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 +5 -3
- package/dist/index.d.ts +30 -2
- package/dist/index.js +5 -2
- package/package.json +1 -1
- package/viewer/_headers +7 -0
- package/viewer/assets/ArchiveViewer-CZ4MDsrb.js +1 -0
- package/viewer/assets/AudioViewer-DjyDsudI.js +1 -0
- package/viewer/assets/CadViewer-BInkfPwZ.css +1 -0
- package/viewer/assets/CadViewer-BdTvIAMP.js +106 -0
- package/viewer/assets/CodeViewer-57pZ6W1s.js +2 -0
- package/viewer/assets/DrawingViewer-NO4nzeA1.js +2 -0
- package/viewer/assets/EdaViewer-B296bd4C.js +8 -0
- package/viewer/assets/EmailViewer-CPSeSuYo.js +4 -0
- package/viewer/assets/EpubViewer-BCSRMeWe.js +2 -0
- package/viewer/assets/ImageViewer-DnZM9hve.js +1 -0
- package/viewer/assets/{MarkdownViewer-DUe9OWgX.js → MarkdownViewer-CmNTA_kD.js} +2 -2
- package/viewer/assets/ModelViewer-D9x3ivqk.js +2 -0
- package/viewer/assets/OfdViewer-IhXBAdUl.js +2 -0
- package/viewer/assets/{PdfView-qL9biz6K.js → PdfView-E1iujAnQ.js} +19 -19
- package/viewer/assets/PdfView-fzvUeFZP.css +1 -0
- package/viewer/assets/{PptxRender-CgGc0Lmd.js → PptxRender-Dad6hvcj.js} +2 -2
- package/viewer/assets/TypstViewer-gzZvcE-4.js +60 -0
- package/viewer/assets/UmdViewer-YzLD0vlj.js +3 -0
- package/viewer/assets/XlsxTable-CZSQVOJ0.js +5 -0
- package/viewer/assets/__vite-browser-external-BZdVR8v7.js +1 -0
- package/viewer/assets/{ar-SA-G6X2FPQ2-Ct8pPIA9.js → ar-SA-G6X2FPQ2-DIej4228.js} +1 -1
- package/viewer/assets/architecture-7EHR7CIX-sRujR5WN.js +1 -0
- package/viewer/assets/architectureDiagram-3BPJPVTR-aQ-MRDKN.js +36 -0
- package/viewer/assets/archive-CRrvkqZk.js +2 -0
- package/viewer/assets/audio-DWT9z9tK.js +2 -0
- package/viewer/assets/{az-AZ-76LH7QW2-CzGVqBxA.js → az-AZ-76LH7QW2-CS2qXUFa.js} +1 -1
- package/viewer/assets/{bg-BG-XCXSNQG7-BC1WHeuj.js → bg-BG-XCXSNQG7-9ujIdMwb.js} +1 -1
- package/viewer/assets/{blockDiagram-GPEHLZMM-CzYTB9qf.js → blockDiagram-GPEHLZMM-DkVCZJHC.js} +1 -1
- package/viewer/assets/{bn-BD-2XOGV67Q-oDxumlGl.js → bn-BD-2XOGV67Q-Bz4MKzNd.js} +1 -1
- package/viewer/assets/{c4Diagram-AAUBKEIU-Ce3rQlcz.js → c4Diagram-AAUBKEIU-BhUtgtBE.js} +1 -1
- package/viewer/assets/{ca-ES-6MX7JW3Y-DlRpGNhJ.js → ca-ES-6MX7JW3Y-CQ0i-M2m.js} +1 -1
- package/viewer/assets/cad-B78pKw7N.js +2 -0
- package/viewer/assets/{cfb-BzFYazhG.js → cfb-DgjGJYYS.js} +1 -1
- package/viewer/assets/channel-Dz5mnghj.js +1 -0
- package/viewer/assets/{chunk-2J33WTMH-sJnJZdWK.js → chunk-2J33WTMH-CruGLWY_.js} +1 -1
- package/viewer/assets/{chunk-3OPIFGDE-Dy9HIqGz.js → chunk-3OPIFGDE-BBTvqaNI.js} +1 -1
- package/viewer/assets/{chunk-4BX2VUAB-_gCngxqj.js → chunk-4BX2VUAB-DnDF0gw2.js} +1 -1
- package/viewer/assets/{chunk-55IACEB6-DJVZWNP2.js → chunk-55IACEB6-BXXbpqd4.js} +1 -1
- package/viewer/assets/{chunk-5ZQYHXKU-BmHYmhZg.js → chunk-5ZQYHXKU-D-OgLpMs.js} +1 -1
- package/viewer/assets/{chunk-727SXJPM-Bat8V6oA.js → chunk-727SXJPM-DF6e3Zgf.js} +1 -1
- package/viewer/assets/chunk-AGHRB4JF-Fz9kp2Fp.js +1 -0
- package/viewer/assets/{chunk-AQP2D5EJ-1mc6GFJc.js → chunk-AQP2D5EJ-B3sX7UtP.js} +1 -1
- package/viewer/assets/{chunk-BSJP7CBP-B5-KaGur.js → chunk-BSJP7CBP-BkJdmh17.js} +1 -1
- package/viewer/assets/{chunk-CSCIHK7Q-B8WcTeuL.js → chunk-CSCIHK7Q-VDPd5eNJ.js} +1 -1
- package/viewer/assets/{chunk-EIO257PC-DamrG-x6.js → chunk-EIO257PC-Dq8JiXSZ.js} +1 -1
- package/viewer/assets/{chunk-FMBD7UC4-UHfET5Yn.js → chunk-FMBD7UC4-CKA5OKZ8.js} +1 -1
- package/viewer/assets/{chunk-K2UTITRG-CW6VmW0l.js → chunk-K2UTITRG-BEkZoneJ.js} +4 -4
- package/viewer/assets/{chunk-KSCS5N6A-D-BXbKOk.js → chunk-KSCS5N6A-BuXf0YOu.js} +1 -1
- package/viewer/assets/{chunk-L5ZTLDWV-CMDQijEU.js → chunk-L5ZTLDWV-CzNJ_8is.js} +1 -1
- package/viewer/assets/chunk-LZXEDZCA-n9zJSIw5.js +2 -0
- package/viewer/assets/{chunk-ND2GUHAM-Vx_Lzab7.js → chunk-ND2GUHAM-zGgwlxna.js} +1 -1
- package/viewer/assets/{chunk-NZK2D7GU-grlSNYf9.js → chunk-NZK2D7GU-Cte2JwiA.js} +1 -1
- package/viewer/assets/{chunk-O5CBEL6O-MjJGEUAK.js → chunk-O5CBEL6O-Bu7jDUJy.js} +1 -1
- package/viewer/assets/chunk-QZHKN3VN-DmWvf513.js +1 -0
- package/viewer/assets/{chunk-SRAX5OIU-WEWN8Pf_.js → chunk-SRAX5OIU-w1svEpmY.js} +1 -1
- package/viewer/assets/{chunk-WU5MYG2G-CpDqo4az.js → chunk-WU5MYG2G-h67ucwKy.js} +1 -1
- package/viewer/assets/{chunk-XPW4576I-CSqlWRxK.js → chunk-XPW4576I-SsWL9gHk.js} +1 -1
- package/viewer/assets/classDiagram-4FO5ZUOK-B-NZYxkE.js +1 -0
- package/viewer/assets/classDiagram-v2-Q7XG4LA2-B-NZYxkE.js +1 -0
- package/viewer/assets/compare-BA1y8ff-.css +1 -0
- package/viewer/assets/compare-CYFnIciQ.js +1 -0
- package/viewer/assets/{compiler-BV9U7LKi.js → compiler-Doo7uL6g.js} +1 -1
- package/viewer/assets/core-DHC7JJ3v.js +3 -0
- package/viewer/assets/cose-bilkent-S5V4N54A-BbY9gLB6.js +1 -0
- package/viewer/assets/{cs-CZ-2BRQDIVT-C_SPqQME.js → cs-CZ-2BRQDIVT-CNJY03Br.js} +1 -1
- package/viewer/assets/{da-DK-5WZEPLOC-CEZavbB3.js → da-DK-5WZEPLOC-kycNORr2.js} +1 -1
- package/viewer/assets/{dagre-BM42HDAG-lquvmcKk.js → dagre-BM42HDAG-CtFkfSMu.js} +1 -1
- package/viewer/assets/{de-DE-XR44H4JA-D2nL0tOJ.js → de-DE-XR44H4JA-DgEFBHUE.js} +1 -1
- package/viewer/assets/{diagram-2AECGRRQ-BgQ_zxBV.js → diagram-2AECGRRQ-OITOieDL.js} +1 -1
- package/viewer/assets/{diagram-5GNKFQAL-BC3w3tNm.js → diagram-5GNKFQAL-CkpmTcRT.js} +1 -1
- package/viewer/assets/{diagram-KO2AKTUF-D3cznkJB.js → diagram-KO2AKTUF-Q-LQjcLw.js} +1 -1
- package/viewer/assets/{diagram-LMA3HP47--wquG14e.js → diagram-LMA3HP47-BlbmzDQ6.js} +1 -1
- package/viewer/assets/{diagram-OG6HWLK6-C_POLZjQ.js → diagram-OG6HWLK6-CcX1M4RU.js} +1 -1
- package/viewer/assets/{dist-BPGt6zWy.js → dist-Bgk0P6Wx.js} +4 -4
- package/viewer/assets/dist-BzZSLV34.js +1 -0
- package/viewer/assets/{dist-BT9pIsX0.js → dist-idVqPIzq.js} +1 -1
- package/viewer/assets/docx-preview-CbKtHvXt.js +20 -0
- package/viewer/assets/drawing-Cg8yKw0a.js +2 -0
- package/viewer/assets/ebook-B0xdVki1.js +2 -0
- package/viewer/assets/eda-DB_j3--n.js +2 -0
- package/viewer/assets/{el-GR-BZB4AONW-Dj2P_01-.js → el-GR-BZB4AONW-DQbI2D0z.js} +1 -1
- package/viewer/assets/email-ZYgs8alH.js +2 -0
- package/viewer/assets/{en-B4ZKOASM-C1I96dn5.js → en-B4ZKOASM-gYELMyZ6.js} +1 -1
- package/viewer/assets/{erDiagram-TEJ5UH35-DJEqPp7l.js → erDiagram-TEJ5UH35-DEgxv-IW.js} +1 -1
- package/viewer/assets/{es-ES-U4NZUMDT-DrUBr8IT.js → es-ES-U4NZUMDT-e1S39Ti1.js} +1 -1
- package/viewer/assets/{eu-ES-A7QVB2H4-C-B8VObw.js → eu-ES-A7QVB2H4-BFR4rl79.js} +1 -1
- package/viewer/assets/eventmodeling-FCH6USID-BtBKHIsk.js +1 -0
- package/viewer/assets/{fa-IR-HGAKTJCU-D2fbIqFb.js → fa-IR-HGAKTJCU-D9rZqekR.js} +1 -1
- package/viewer/assets/{fi-FI-Z5N7JZ37-ljqLaVsp.js → fi-FI-Z5N7JZ37-LaYcmFdb.js} +1 -1
- package/viewer/assets/{flowDiagram-I6XJVG4X-Brfn5DdP.js → flowDiagram-I6XJVG4X-nqVkey0o.js} +1 -1
- package/viewer/assets/{fr-FR-RHASNOE6-So7R4D2i.js → fr-FR-RHASNOE6-DaN_dVyx.js} +1 -1
- package/viewer/assets/{ganttDiagram-6RSMTGT7-DdIjVTfn.js → ganttDiagram-6RSMTGT7-B5XdNYHP.js} +1 -1
- package/viewer/assets/{gitGraph-WXDBUCRP-oU5uBMJp.js → gitGraph-WXDBUCRP-CcEeprvc.js} +1 -1
- package/viewer/assets/{gitGraphDiagram-PVQCEYII-5HIom59P.js → gitGraphDiagram-PVQCEYII-DoyI3hWK.js} +1 -1
- package/viewer/assets/{gl-ES-HMX3MZ6V-C7WCIWks.js → gl-ES-HMX3MZ6V-Dw-96yV4.js} +1 -1
- package/viewer/assets/{he-IL-6SHJWFNN-EBe1DN0h.js → he-IL-6SHJWFNN-DSze4qOo.js} +1 -1
- package/viewer/assets/{hi-IN-IWLTKZ5I-BKN0Rgs4.js → hi-IN-IWLTKZ5I-BrDOKcx0.js} +1 -1
- package/viewer/assets/{hu-HU-A5ZG7DT2-B0fRz8s0.js → hu-HU-A5ZG7DT2-B5MZHRE0.js} +1 -1
- package/viewer/assets/{id-ID-SAP4L64H-D-3naLhp.js → id-ID-SAP4L64H-CLeuopyl.js} +1 -1
- package/viewer/assets/image-0vZMjp0Z.js +2 -0
- package/viewer/assets/image-GAAHSSAO-Di-5eHoS.js +1 -0
- package/viewer/assets/{info-J43DQDTF-Cj7_d75e.js → info-J43DQDTF-ECAOGDME.js} +1 -1
- package/viewer/assets/{infoDiagram-5YYISTIA-BFSVMUo8.js → infoDiagram-5YYISTIA-C0vYc3h2.js} +1 -1
- package/viewer/assets/{ishikawaDiagram-YF4QCWOH-yoVOo1dl.js → ishikawaDiagram-YF4QCWOH-CG_Ph_lH.js} +1 -1
- package/viewer/assets/{it-IT-JPQ66NNP-BAUX4Gc2.js → it-IT-JPQ66NNP-CU1apqHk.js} +1 -1
- package/viewer/assets/{ja-JP-DBVTYXUO-DI1TIyfM.js → ja-JP-DBVTYXUO-B39Q-cJE.js} +1 -1
- package/viewer/assets/{journeyDiagram-JHISSGLW-Bbi4OnEP.js → journeyDiagram-JHISSGLW-Bls8b6p5.js} +1 -1
- package/viewer/assets/{jszip.min-9ZVZbTBP.js → jszip.min-CoyCHGS6.js} +1 -1
- package/viewer/assets/{kaa-6HZHGXH3-CDl8fx0o.js → kaa-6HZHGXH3-DNr0Hbws.js} +1 -1
- package/viewer/assets/{kab-KAB-ZGHBKWFO-DpRjaTvY.js → kab-KAB-ZGHBKWFO-DUqxtUd5.js} +1 -1
- package/viewer/assets/{kanban-definition-UN3LZRKU-CjkfgLaF.js → kanban-definition-UN3LZRKU-D7NWNdGb.js} +1 -1
- package/viewer/assets/{kk-KZ-P5N5QNE5-zK-_fVIW.js → kk-KZ-P5N5QNE5-oAQRY--4.js} +1 -1
- package/viewer/assets/{km-KH-HSX4SM5Z-DehsMGky.js → km-KH-HSX4SM5Z-aIsalLJg.js} +1 -1
- package/viewer/assets/{ko-KR-MTYHY66A-MXYhOsjv.js → ko-KR-MTYHY66A-Dxxq4OHv.js} +1 -1
- package/viewer/assets/{ku-TR-6OUDTVRD-C7q1COiN.js → ku-TR-6OUDTVRD-cGosJj47.js} +1 -1
- package/viewer/assets/{lib-DIWU3KRt.js → lib-DVPOsS0g.js} +2 -2
- package/viewer/assets/{lt-LT-XHIRWOB4-DdM8RTKz.js → lt-LT-XHIRWOB4-BrbcDiBa.js} +1 -1
- package/viewer/assets/{lv-LV-5QDEKY6T-JLG8FSEV.js → lv-LV-5QDEKY6T-BJB3sRF-.js} +1 -1
- package/viewer/assets/main-BmxokhSj.js +4 -0
- package/viewer/assets/main-G-3rADWH.css +1 -0
- package/viewer/assets/md-GXqo3xMM.js +2 -0
- package/viewer/assets/{mermaid-parser.core-BENCcCsY.js → mermaid-parser.core-919mtcVP.js} +2 -2
- package/viewer/assets/{mindmap-definition-RKZ34NQL-Da3VSyjd.js → mindmap-definition-RKZ34NQL-jpsqOaHj.js} +1 -1
- package/viewer/assets/model-DNiDRYMH.js +2 -0
- package/viewer/assets/{mr-IN-CRQNXWMA-CVFsyXLA.js → mr-IN-CRQNXWMA-DYl82JZe.js} +1 -1
- package/viewer/assets/{my-MM-5M5IBNSE-D0d4LZCZ.js → my-MM-5M5IBNSE-CdnDB-54.js} +1 -1
- package/viewer/assets/{nb-NO-T6EIAALU-zKIQ8i0_.js → nb-NO-T6EIAALU-T-ly9gG2.js} +1 -1
- package/viewer/assets/nestedRender-BAYFA7cb.js +3 -0
- package/viewer/assets/{nl-NL-IS3SIHDZ-nx6qzVMe.js → nl-NL-IS3SIHDZ-CZqPZnHj.js} +1 -1
- package/viewer/assets/{nn-NO-6E72VCQL-DlUCFzXM.js → nn-NO-6E72VCQL-CvMupQbc.js} +1 -1
- package/viewer/assets/{oc-FR-POXYY2M6-B_FaqiYz.js → oc-FR-POXYY2M6-BRlPd_BR.js} +1 -1
- package/viewer/assets/ofd-BJzyd_Eq.js +2 -0
- package/viewer/assets/{ofd-CmAfXjFW.js → ofd-roCNaEHA.js} +1 -1
- package/viewer/assets/{pa-IN-N4M65BXN-YH5GORnI.js → pa-IN-N4M65BXN-BfVUAlRi.js} +1 -1
- package/viewer/assets/package-Bop5TfAT.js +296 -0
- package/viewer/assets/package-OvxnQO7z.css +1 -0
- package/viewer/assets/{packet-YPE3B663-CbkeKKRx.js → packet-YPE3B663-BLIVl-jG.js} +1 -1
- package/viewer/assets/pdf-CDtYB0WY.js +2 -0
- package/viewer/assets/percentages-BXMCSKIN-C5NgCvxl.js +1 -0
- package/viewer/assets/{pica-BnQTSY_g.js → pica-Dfy4NaK_.js} +1 -1
- package/viewer/assets/{pie-LRSECV5Y-DtfPCqZg.js → pie-LRSECV5Y-DcYPzp1c.js} +1 -1
- package/viewer/assets/{pieDiagram-4H26LBE5-DKuS6vJG.js → pieDiagram-4H26LBE5-CMzoHPw-.js} +1 -1
- package/viewer/assets/{pl-PL-T2D74RX3-BmZoKFT7.js → pl-PL-T2D74RX3-CXvOHlyd.js} +1 -1
- package/viewer/assets/pptx-CI2NrkhY.js +2 -0
- package/viewer/assets/{prod-DPLJAbJU.js → prod-B0HxyDM0.js} +6 -6
- package/viewer/assets/{pt-BR-5N22H2LF-sN9sRoQ_.js → pt-BR-5N22H2LF-CAHMJIN0.js} +1 -1
- package/viewer/assets/{pt-PT-UZXXM6DQ-CY-MOlkp.js → pt-PT-UZXXM6DQ-9stw3O1j.js} +1 -1
- package/viewer/assets/{quadrantDiagram-W4KKPZXB-NwMS_YqW.js → quadrantDiagram-W4KKPZXB-BS8uQ6E6.js} +1 -1
- package/viewer/assets/{radar-GUYGQ44K-DOIjAHXC.js → radar-GUYGQ44K-Bqokr2eR.js} +1 -1
- package/viewer/assets/renderer-BMLnfeSl.js +1 -0
- package/viewer/assets/{requirementDiagram-4Y6WPE33-sPbqvYv9.js → requirementDiagram-4Y6WPE33-pyX-Egau.js} +1 -1
- package/viewer/assets/{ro-RO-JPDTUUEW-CR28nHgw.js → ro-RO-JPDTUUEW-_Ym6U2of.js} +1 -1
- package/viewer/assets/{rough.esm-C4Phtcrp.js → rough.esm-DjrMDdlL.js} +1 -1
- package/viewer/assets/{ru-RU-B4JR7IUQ-CGKVxm63.js → ru-RU-B4JR7IUQ-DWUO9__j.js} +1 -1
- package/viewer/assets/runtime-core.esm-bundler-DO-WTVbd.js +1 -0
- package/viewer/assets/{sankeyDiagram-5OEKKPKP-C50FIC8Y.js → sankeyDiagram-5OEKKPKP-BIl0S1dQ.js} +1 -1
- package/viewer/assets/{sequenceDiagram-3UESZ5HK-Bi1R7g7S.js → sequenceDiagram-3UESZ5HK-EhMFCxNn.js} +1 -1
- package/viewer/assets/{si-LK-N5RQ5JYF-BW7AdTgs.js → si-LK-N5RQ5JYF-DOuaKjIP.js} +1 -1
- package/viewer/assets/{sk-SK-C5VTKIMK-B9b1lWlx.js → sk-SK-C5VTKIMK-D04wnRn8.js} +1 -1
- package/viewer/assets/{sl-SI-NN7IZMDC-DOPNH4Mv.js → sl-SI-NN7IZMDC-DlSoyI38.js} +1 -1
- package/viewer/assets/{src-D_WiFutn.js → src-CmLfrMFg.js} +4 -4
- package/viewer/assets/{stateDiagram-AJRCARHV-laY9nBdY.js → stateDiagram-AJRCARHV-CBylKBpj.js} +1 -1
- package/viewer/assets/stateDiagram-v2-BHNVJYJU-f7X6eKbo.js +1 -0
- package/viewer/assets/subset-shared.chunk-WzaeClRm.js +1 -0
- package/viewer/assets/{subset-worker.chunk-CvvTW5M7.js → subset-worker.chunk-CXi44O4x.js} +1 -1
- package/viewer/assets/{sv-SE-XGPEYMSR-CPLWZrAn.js → sv-SE-XGPEYMSR-y8nUmsTq.js} +1 -1
- package/viewer/assets/{ta-IN-2NMHFXQM-D55L614R.js → ta-IN-2NMHFXQM-BTlY1MOo.js} +1 -1
- package/viewer/assets/text-BTWcQTKM.js +2 -0
- package/viewer/assets/{th-TH-HPSO5L25-D3MPD0Md.js → th-TH-HPSO5L25-B0-Jm0dR.js} +1 -1
- package/viewer/assets/{timeline-definition-PNZ67QCA-DqotLxx2.js → timeline-definition-PNZ67QCA-BrR0Lwj6.js} +1 -1
- package/viewer/assets/{tr-TR-DEFEU3FU-Q8xsSXAo.js → tr-TR-DEFEU3FU-CuiTnA8n.js} +1 -1
- package/viewer/assets/{treeView-BLDUP644-CPi2xY7A.js → treeView-BLDUP644-B3NDovtS.js} +1 -1
- package/viewer/assets/{treemap-LRROVOQU-C8Mj1X4O.js → treemap-LRROVOQU-CNBN28UV.js} +1 -1
- package/viewer/assets/typst-BlzZcMe5.js +2 -0
- package/viewer/assets/{uk-UA-QMV73CPH-Dnl8D1p8.js → uk-UA-QMV73CPH-za143PJQ.js} +1 -1
- package/viewer/assets/umd-CaNdxjcL.js +2 -0
- package/viewer/assets/{vennDiagram-CIIHVFJN-BIkyq-4v.js → vennDiagram-CIIHVFJN-BkqtdITb.js} +1 -1
- package/viewer/assets/{vi-VN-M7AON7JQ-DQI4i_hS.js → vi-VN-M7AON7JQ-BkwUlhW4.js} +1 -1
- package/viewer/assets/{wardley-L42UT6IY-DJWWSlJn.js → wardley-L42UT6IY-B82Hng0D.js} +1 -1
- package/viewer/assets/{wardleyDiagram-YWT4CUSO-2IdxQGv-.js → wardleyDiagram-YWT4CUSO-d1SlYFch.js} +1 -1
- package/viewer/assets/word-CbznmAOT.js +126 -0
- package/viewer/assets/xlsx-B70Tzp_0.js +2 -0
- package/viewer/assets/{xychartDiagram-2RQKCTM6-Bks5TALn.js → xychartDiagram-2RQKCTM6-AETQ-2hJ.js} +1 -1
- package/viewer/assets/{zh-CN-LNUGB5OW-ByzhDQAP.js → zh-CN-LNUGB5OW-CLMN5wFH.js} +1 -1
- package/viewer/assets/{zh-HK-E62DVLB3-Dyd19evA.js → zh-HK-E62DVLB3-BQAhIarC.js} +1 -1
- package/viewer/assets/{zh-TW-RAJ6MFWO-D2sseOtI.js → zh-TW-RAJ6MFWO-D3o6FRFS.js} +1 -1
- package/viewer/compare.html +5 -4
- package/viewer/flyfish-viewer-manifest.json +1 -1
- package/viewer/index.html +6 -5
- package/viewer/wasm/cad/DwgWorker-CuZJ5EUe.js +349 -0
- package/viewer/wasm/cad/dwfv-render.wasm +0 -0
- package/viewer/wasm/cad/dwg-worker.js +349 -0
- package/viewer/wasm/cad/index-C365l3i9.js +4161 -0
- package/viewer/wasm/cad/libredwg-web.js +15 -0
- package/viewer/wasm/cad/libredwg-web.wasm +0 -0
- package/viewer/assets/ArchiveViewer-CPhpkbIj.js +0 -1
- package/viewer/assets/AudioViewer-B_qZjmsL.js +0 -1
- package/viewer/assets/CadViewer-DU2h_miC.js +0 -1
- package/viewer/assets/CadViewer-DZAS6XFY.css +0 -1
- package/viewer/assets/CodeViewer-n64org7g.js +0 -2
- package/viewer/assets/DrawingViewer-BsPDsvje.js +0 -2
- package/viewer/assets/EdaViewer-CRXNBqD8.js +0 -8
- package/viewer/assets/EmailViewer-BdKEJv7y.js +0 -4
- package/viewer/assets/EpubViewer-wPFt5vlJ.js +0 -2
- package/viewer/assets/ImageViewer-3xUYPq4w.js +0 -1
- package/viewer/assets/ModelViewer-LeKRgAjH.js +0 -2
- package/viewer/assets/OfdViewer-yYh014I9.js +0 -2
- package/viewer/assets/PdfView-CtiDN2FA.css +0 -1
- package/viewer/assets/TypstViewer-BWfhuA9V.js +0 -60
- package/viewer/assets/UmdViewer-BQg9tWl-.js +0 -3
- package/viewer/assets/XlsxTable-weyE_CEp.js +0 -5
- package/viewer/assets/__vite-browser-external-BEGdo7Ij.js +0 -1
- package/viewer/assets/architecture-7EHR7CIX-BTlHPVaJ.js +0 -1
- package/viewer/assets/architectureDiagram-3BPJPVTR-B-eDaTQ2.js +0 -36
- package/viewer/assets/archive-DwmH2EER.js +0 -2
- package/viewer/assets/audio-DP7_SHBq.js +0 -2
- package/viewer/assets/cad-S62Z1ew-.js +0 -2
- package/viewer/assets/channel-DdWUR2sn.js +0 -1
- package/viewer/assets/chunk-AGHRB4JF-N1YYSFfw.js +0 -1
- package/viewer/assets/chunk-LZXEDZCA-C3SSYZJ5.js +0 -2
- package/viewer/assets/chunk-QZHKN3VN-BsA9NQqS.js +0 -1
- package/viewer/assets/classDiagram-4FO5ZUOK-CNHAm630.js +0 -1
- package/viewer/assets/classDiagram-v2-Q7XG4LA2-CNHAm630.js +0 -1
- package/viewer/assets/compare-BDsbatdp.css +0 -1
- package/viewer/assets/compare-Bfimd92S.js +0 -1
- package/viewer/assets/core-CxoxnOTi.js +0 -3
- package/viewer/assets/cose-bilkent-S5V4N54A-COeDszYN.js +0 -1
- package/viewer/assets/dist-sSvuNO1e.js +0 -7
- package/viewer/assets/docx-preview-DdnRdWo4.js +0 -20
- package/viewer/assets/drawing-CMJwN97z.js +0 -2
- package/viewer/assets/ebook-DMvVt15d.js +0 -2
- package/viewer/assets/eda-DBL4Aevf.js +0 -2
- package/viewer/assets/email-DeRFcYIE.js +0 -2
- package/viewer/assets/eventmodeling-FCH6USID-B7JUE007.js +0 -1
- package/viewer/assets/image-Cr2N5G2B.js +0 -2
- package/viewer/assets/image-GAAHSSAO-fNZpvZ4Y.js +0 -1
- package/viewer/assets/main-CKt4m6T4.js +0 -4
- package/viewer/assets/main-Qy_H7MQU.css +0 -1
- package/viewer/assets/md-wWevhORM.js +0 -2
- package/viewer/assets/model-Bdx2Fqb-.js +0 -2
- package/viewer/assets/nestedRender-BecIPX74.js +0 -3
- package/viewer/assets/ofd-C8N_zW41.js +0 -2
- package/viewer/assets/package-D9RNadqh.js +0 -296
- package/viewer/assets/package-Dwgf8BpP.css +0 -1
- package/viewer/assets/pdf-ENBCQnjn.js +0 -2
- package/viewer/assets/percentages-BXMCSKIN-d_HmO-5v.js +0 -1
- package/viewer/assets/pptx-CJoRHTVc.js +0 -2
- package/viewer/assets/renderer-CtCQDwvN.js +0 -1
- package/viewer/assets/stateDiagram-v2-BHNVJYJU-D-TcJvmH.js +0 -1
- package/viewer/assets/subset-shared.chunk-BMWMi2iF.js +0 -1
- package/viewer/assets/text-DQQak32L.js +0 -2
- package/viewer/assets/typst-LCgT-gly.js +0 -2
- package/viewer/assets/umd--jna8_t9.js +0 -2
- package/viewer/assets/word-TCDf8xQo.js +0 -126
- package/viewer/assets/xlsx-D3PqLMcm.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Y as e,et as t}from"./package-D9RNadqh.js";import{n,r}from"./chunk-AGHRB4JF-N1YYSFfw.js";import{Q as i}from"./src-BrOGWJpF.js";import{t as a}from"./cytoscape.esm-C8YCVR3_.js";var o=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r():typeof define==`function`&&define.amd?define([],r):typeof e==`object`?e.layoutBase=r():n.layoutBase=r()})(e,function(){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=26)})([(function(e,t,n){function r(){}r.QUALITY=1,r.DEFAULT_CREATE_BENDS_AS_NEEDED=!1,r.DEFAULT_INCREMENTAL=!1,r.DEFAULT_ANIMATION_ON_LAYOUT=!0,r.DEFAULT_ANIMATION_DURING_LAYOUT=!1,r.DEFAULT_ANIMATION_PERIOD=50,r.DEFAULT_UNIFORM_LEAF_NODE_SIZES=!1,r.DEFAULT_GRAPH_MARGIN=15,r.NODE_DIMENSIONS_INCLUDE_LABELS=!1,r.SIMPLE_NODE_SIZE=40,r.SIMPLE_NODE_HALF_SIZE=r.SIMPLE_NODE_SIZE/2,r.EMPTY_COMPOUND_NODE_SIZE=40,r.MIN_EDGE_LENGTH=1,r.WORLD_BOUNDARY=1e6,r.INITIAL_WORLD_BOUNDARY=r.WORLD_BOUNDARY/1e3,r.WORLD_CENTER_X=1200,r.WORLD_CENTER_Y=900,e.exports=r}),(function(e,t,n){var r=n(2),i=n(8),a=n(9);function o(e,t,n){r.call(this,n),this.isOverlapingSourceAndTarget=!1,this.vGraphObject=n,this.bendpoints=[],this.source=e,this.target=t}for(var s in o.prototype=Object.create(r.prototype),r)o[s]=r[s];o.prototype.getSource=function(){return this.source},o.prototype.getTarget=function(){return this.target},o.prototype.isInterGraph=function(){return this.isInterGraph},o.prototype.getLength=function(){return this.length},o.prototype.isOverlapingSourceAndTarget=function(){return this.isOverlapingSourceAndTarget},o.prototype.getBendpoints=function(){return this.bendpoints},o.prototype.getLca=function(){return this.lca},o.prototype.getSourceInLca=function(){return this.sourceInLca},o.prototype.getTargetInLca=function(){return this.targetInLca},o.prototype.getOtherEnd=function(e){if(this.source===e)return this.target;if(this.target===e)return this.source;throw`Node is not incident with this edge`},o.prototype.getOtherEndInGraph=function(e,t){for(var n=this.getOtherEnd(e),r=t.getGraphManager().getRoot();;){if(n.getOwner()==t)return n;if(n.getOwner()==r)break;n=n.getOwner().getParent()}return null},o.prototype.updateLength=function(){var e=[,,,,];this.isOverlapingSourceAndTarget=i.getIntersection(this.target.getRect(),this.source.getRect(),e),this.isOverlapingSourceAndTarget||(this.lengthX=e[0]-e[2],this.lengthY=e[1]-e[3],Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY))},o.prototype.updateLengthSimple=function(){this.lengthX=this.target.getCenterX()-this.source.getCenterX(),this.lengthY=this.target.getCenterY()-this.source.getCenterY(),Math.abs(this.lengthX)<1&&(this.lengthX=a.sign(this.lengthX)),Math.abs(this.lengthY)<1&&(this.lengthY=a.sign(this.lengthY)),this.length=Math.sqrt(this.lengthX*this.lengthX+this.lengthY*this.lengthY)},e.exports=o}),(function(e,t,n){function r(e){this.vGraphObject=e}e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(13),o=n(0),s=n(16),c=n(4);function l(e,t,n,o){n==null&&o==null&&(o=t),r.call(this,o),e.graphManager!=null&&(e=e.graphManager),this.estimatedSize=i.MIN_VALUE,this.inclusionTreeDepth=i.MAX_VALUE,this.vGraphObject=o,this.edges=[],this.graphManager=e,n!=null&&t!=null?this.rect=new a(t.x,t.y,n.width,n.height):this.rect=new a}for(var u in l.prototype=Object.create(r.prototype),r)l[u]=r[u];l.prototype.getEdges=function(){return this.edges},l.prototype.getChild=function(){return this.child},l.prototype.getOwner=function(){return this.owner},l.prototype.getWidth=function(){return this.rect.width},l.prototype.setWidth=function(e){this.rect.width=e},l.prototype.getHeight=function(){return this.rect.height},l.prototype.setHeight=function(e){this.rect.height=e},l.prototype.getCenterX=function(){return this.rect.x+this.rect.width/2},l.prototype.getCenterY=function(){return this.rect.y+this.rect.height/2},l.prototype.getCenter=function(){return new c(this.rect.x+this.rect.width/2,this.rect.y+this.rect.height/2)},l.prototype.getLocation=function(){return new c(this.rect.x,this.rect.y)},l.prototype.getRect=function(){return this.rect},l.prototype.getDiagonal=function(){return Math.sqrt(this.rect.width*this.rect.width+this.rect.height*this.rect.height)},l.prototype.getHalfTheDiagonal=function(){return Math.sqrt(this.rect.height*this.rect.height+this.rect.width*this.rect.width)/2},l.prototype.setRect=function(e,t){this.rect.x=e.x,this.rect.y=e.y,this.rect.width=t.width,this.rect.height=t.height},l.prototype.setCenter=function(e,t){this.rect.x=e-this.rect.width/2,this.rect.y=t-this.rect.height/2},l.prototype.setLocation=function(e,t){this.rect.x=e,this.rect.y=t},l.prototype.moveBy=function(e,t){this.rect.x+=e,this.rect.y+=t},l.prototype.getEdgeListToNode=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(r.target==e){if(r.source!=n)throw`Incorrect edge source!`;t.push(r)}}),t},l.prototype.getEdgesBetween=function(e){var t=[],n=this;return n.edges.forEach(function(r){if(!(r.source==n||r.target==n))throw`Incorrect edge source and/or target`;(r.target==e||r.source==e)&&t.push(r)}),t},l.prototype.getNeighborsList=function(){var e=new Set,t=this;return t.edges.forEach(function(n){if(n.source==t)e.add(n.target);else{if(n.target!=t)throw`Incorrect incidency!`;e.add(n.source)}}),e},l.prototype.withChildren=function(){var e=new Set,t,n;if(e.add(this),this.child!=null)for(var r=this.child.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.withChildren(),n.forEach(function(t){e.add(t)});return e},l.prototype.getNoOfChildren=function(){var e=0,t;if(this.child==null)e=1;else for(var n=this.child.getNodes(),r=0;r<n.length;r++)t=n[r],e+=t.getNoOfChildren();return e==0&&(e=1),e},l.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},l.prototype.calcEstimatedSize=function(){return this.child==null?this.estimatedSize=(this.rect.width+this.rect.height)/2:(this.estimatedSize=this.child.calcEstimatedSize(),this.rect.width=this.estimatedSize,this.rect.height=this.estimatedSize,this.estimatedSize)},l.prototype.scatter=function(){var e,t,n=-o.INITIAL_WORLD_BOUNDARY,r=o.INITIAL_WORLD_BOUNDARY;e=o.WORLD_CENTER_X+s.nextDouble()*(r-n)+n;var i=-o.INITIAL_WORLD_BOUNDARY,a=o.INITIAL_WORLD_BOUNDARY;t=o.WORLD_CENTER_Y+s.nextDouble()*(a-i)+i,this.rect.x=e,this.rect.y=t},l.prototype.updateBounds=function(){if(this.getChild()==null)throw`assert failed`;if(this.getChild().getNodes().length!=0){var e=this.getChild();if(e.updateBounds(!0),this.rect.x=e.getLeft(),this.rect.y=e.getTop(),this.setWidth(e.getRight()-e.getLeft()),this.setHeight(e.getBottom()-e.getTop()),o.NODE_DIMENSIONS_INCLUDE_LABELS){var t=e.getRight()-e.getLeft(),n=e.getBottom()-e.getTop();this.labelWidth>t&&(this.rect.x-=(this.labelWidth-t)/2,this.setWidth(this.labelWidth)),this.labelHeight>n&&(this.labelPos==`center`?this.rect.y-=(this.labelHeight-n)/2:this.labelPos==`top`&&(this.rect.y-=this.labelHeight-n),this.setHeight(this.labelHeight))}}},l.prototype.getInclusionTreeDepth=function(){if(this.inclusionTreeDepth==i.MAX_VALUE)throw`assert failed`;return this.inclusionTreeDepth},l.prototype.transform=function(e){var t=this.rect.x;t>o.WORLD_BOUNDARY?t=o.WORLD_BOUNDARY:t<-o.WORLD_BOUNDARY&&(t=-o.WORLD_BOUNDARY);var n=this.rect.y;n>o.WORLD_BOUNDARY?n=o.WORLD_BOUNDARY:n<-o.WORLD_BOUNDARY&&(n=-o.WORLD_BOUNDARY);var r=new c(t,n),i=e.inverseTransformPoint(r);this.setLocation(i.x,i.y)},l.prototype.getLeft=function(){return this.rect.x},l.prototype.getRight=function(){return this.rect.x+this.rect.width},l.prototype.getTop=function(){return this.rect.y},l.prototype.getBottom=function(){return this.rect.y+this.rect.height},l.prototype.getParent=function(){return this.owner==null?null:this.owner.getParent()},e.exports=l}),(function(e,t,n){function r(e,t){e==null&&t==null?(this.x=0,this.y=0):(this.x=e,this.y=t)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.setX=function(e){this.x=e},r.prototype.setY=function(e){this.y=e},r.prototype.getDifference=function(e){return new DimensionD(this.x-e.x,this.y-e.y)},r.prototype.getCopy=function(){return new r(this.x,this.y)},r.prototype.translate=function(e){return this.x+=e.width,this.y+=e.height,this},e.exports=r}),(function(e,t,n){var r=n(2),i=n(10),a=n(0),o=n(6),s=n(3),c=n(1),l=n(13),u=n(12),d=n(11);function f(e,t,n){r.call(this,n),this.estimatedSize=i.MIN_VALUE,this.margin=a.DEFAULT_GRAPH_MARGIN,this.edges=[],this.nodes=[],this.isConnected=!1,this.parent=e,t!=null&&t instanceof o?this.graphManager=t:t!=null&&t instanceof Layout&&(this.graphManager=t.graphManager)}for(var p in f.prototype=Object.create(r.prototype),r)f[p]=r[p];f.prototype.getNodes=function(){return this.nodes},f.prototype.getEdges=function(){return this.edges},f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getParent=function(){return this.parent},f.prototype.getLeft=function(){return this.left},f.prototype.getRight=function(){return this.right},f.prototype.getTop=function(){return this.top},f.prototype.getBottom=function(){return this.bottom},f.prototype.isConnected=function(){return this.isConnected},f.prototype.add=function(e,t,n){if(t==null&&n==null){var r=e;if(this.graphManager==null)throw`Graph has no graph mgr!`;if(this.getNodes().indexOf(r)>-1)throw`Node already in graph!`;return r.owner=this,this.getNodes().push(r),r}else{var i=e;if(!(this.getNodes().indexOf(t)>-1&&this.getNodes().indexOf(n)>-1))throw`Source or target not in graph!`;if(!(t.owner==n.owner&&t.owner==this))throw`Both owners must be this graph!`;return t.owner==n.owner?(i.source=t,i.target=n,i.isInterGraph=!1,this.getEdges().push(i),t.edges.push(i),n!=t&&n.edges.push(i),i):null}},f.prototype.remove=function(e){var t=e;if(e instanceof s){if(t==null)throw`Node is null!`;if(!(t.owner!=null&&t.owner==this))throw`Owner graph is invalid!`;if(this.graphManager==null)throw`Owner graph manager is invalid!`;for(var n=t.edges.slice(),r,i=n.length,a=0;a<i;a++)r=n[a],r.isInterGraph?this.graphManager.remove(r):r.source.owner.remove(r);var o=this.nodes.indexOf(t);if(o==-1)throw`Node not in owner node list!`;this.nodes.splice(o,1)}else if(e instanceof c){var r=e;if(r==null)throw`Edge is null!`;if(!(r.source!=null&&r.target!=null))throw`Source and/or target is null!`;if(!(r.source.owner!=null&&r.target.owner!=null&&r.source.owner==this&&r.target.owner==this))throw`Source and/or target owner is invalid!`;var l=r.source.edges.indexOf(r),u=r.target.edges.indexOf(r);if(!(l>-1&&u>-1))throw`Source and/or target doesn't know this edge!`;r.source.edges.splice(l,1),r.target!=r.source&&r.target.edges.splice(u,1);var o=r.source.owner.getEdges().indexOf(r);if(o==-1)throw`Not in owner's edge list!`;r.source.owner.getEdges().splice(o,1)}},f.prototype.updateLeftTop=function(){for(var e=i.MAX_VALUE,t=i.MAX_VALUE,n,r,a,o=this.getNodes(),s=o.length,c=0;c<s;c++){var l=o[c];n=l.getTop(),r=l.getLeft(),e>n&&(e=n),t>r&&(t=r)}return e==i.MAX_VALUE?null:(a=o[0].getParent().paddingLeft==null?this.margin:o[0].getParent().paddingLeft,this.left=t-a,this.top=e-a,new u(this.left,this.top))},f.prototype.updateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d,f=this.nodes,p=f.length,m=0;m<p;m++){var h=f[m];e&&h.child!=null&&h.updateBounds(),o=h.getLeft(),s=h.getRight(),c=h.getTop(),u=h.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}var g=new l(t,r,n-t,a-r);t==i.MAX_VALUE&&(this.left=this.parent.getLeft(),this.right=this.parent.getRight(),this.top=this.parent.getTop(),this.bottom=this.parent.getBottom()),d=f[0].getParent().paddingLeft==null?this.margin:f[0].getParent().paddingLeft,this.left=g.x-d,this.right=g.x+g.width+d,this.top=g.y-d,this.bottom=g.y+g.height+d},f.calculateBounds=function(e){for(var t=i.MAX_VALUE,n=-i.MAX_VALUE,r=i.MAX_VALUE,a=-i.MAX_VALUE,o,s,c,u,d=e.length,f=0;f<d;f++){var p=e[f];o=p.getLeft(),s=p.getRight(),c=p.getTop(),u=p.getBottom(),t>o&&(t=o),n<s&&(n=s),r>c&&(r=c),a<u&&(a=u)}return new l(t,r,n-t,a-r)},f.prototype.getInclusionTreeDepth=function(){return this==this.graphManager.getRoot()?1:this.parent.getInclusionTreeDepth()},f.prototype.getEstimatedSize=function(){if(this.estimatedSize==i.MIN_VALUE)throw`assert failed`;return this.estimatedSize},f.prototype.calcEstimatedSize=function(){for(var e=0,t=this.nodes,n=t.length,r=0;r<n;r++){var i=t[r];e+=i.calcEstimatedSize()}return e==0?this.estimatedSize=a.EMPTY_COMPOUND_NODE_SIZE:this.estimatedSize=e/Math.sqrt(this.nodes.length),this.estimatedSize},f.prototype.updateConnected=function(){var e=this;if(this.nodes.length==0){this.isConnected=!0;return}var t=new d,n=new Set,r=this.nodes[0],i,a;for(r.withChildren().forEach(function(e){t.push(e),n.add(e)});t.length!==0;){r=t.shift(),i=r.getEdges();for(var o=i.length,s=0;s<o;s++)a=i[s].getOtherEndInGraph(r,this),a!=null&&!n.has(a)&&a.withChildren().forEach(function(e){t.push(e),n.add(e)})}if(this.isConnected=!1,n.size>=this.nodes.length){var c=0;n.forEach(function(t){t.owner==e&&c++}),c==this.nodes.length&&(this.isConnected=!0)}},e.exports=f}),(function(e,t,n){var r,i=n(1);function a(e){r=n(5),this.layout=e,this.graphs=[],this.edges=[]}a.prototype.addRoot=function(){var e=this.layout.newGraph(),t=this.layout.newNode(null),n=this.add(e,t);return this.setRootGraph(n),this.rootGraph},a.prototype.add=function(e,t,n,r,i){if(n==null&&r==null&&i==null){if(e==null)throw`Graph is null!`;if(t==null)throw`Parent node is null!`;if(this.graphs.indexOf(e)>-1)throw`Graph already in this graph mgr!`;if(this.graphs.push(e),e.parent!=null)throw`Already has a parent!`;if(t.child!=null)throw`Already has a child!`;return e.parent=t,t.child=e,e}else{i=n,r=t,n=e;var a=r.getOwner(),o=i.getOwner();if(!(a!=null&&a.getGraphManager()==this))throw`Source not in this graph mgr!`;if(!(o!=null&&o.getGraphManager()==this))throw`Target not in this graph mgr!`;if(a==o)return n.isInterGraph=!1,a.add(n,r,i);if(n.isInterGraph=!0,n.source=r,n.target=i,this.edges.indexOf(n)>-1)throw`Edge already in inter-graph edge list!`;if(this.edges.push(n),!(n.source!=null&&n.target!=null))throw`Edge source and/or target is null!`;if(!(n.source.edges.indexOf(n)==-1&&n.target.edges.indexOf(n)==-1))throw`Edge already in source and/or target incidency list!`;return n.source.edges.push(n),n.target.edges.push(n),n}},a.prototype.remove=function(e){if(e instanceof r){var t=e;if(t.getGraphManager()!=this)throw`Graph not in this graph mgr`;if(!(t==this.rootGraph||t.parent!=null&&t.parent.graphManager==this))throw`Invalid parent node!`;var n=[];n=n.concat(t.getEdges());for(var a,o=n.length,s=0;s<o;s++)a=n[s],t.remove(a);var c=[];c=c.concat(t.getNodes());var l;o=c.length;for(var s=0;s<o;s++)l=c[s],t.remove(l);t==this.rootGraph&&this.setRootGraph(null);var u=this.graphs.indexOf(t);this.graphs.splice(u,1),t.parent=null}else if(e instanceof i){if(a=e,a==null)throw`Edge is null!`;if(!a.isInterGraph)throw`Not an inter-graph edge!`;if(!(a.source!=null&&a.target!=null))throw`Source and/or target is null!`;if(!(a.source.edges.indexOf(a)!=-1&&a.target.edges.indexOf(a)!=-1))throw`Source and/or target doesn't know this edge!`;var u=a.source.edges.indexOf(a);if(a.source.edges.splice(u,1),u=a.target.edges.indexOf(a),a.target.edges.splice(u,1),!(a.source.owner!=null&&a.source.owner.getGraphManager()!=null))throw`Edge owner graph or owner graph manager is null!`;if(a.source.owner.getGraphManager().edges.indexOf(a)==-1)throw`Not in owner graph manager's edge list!`;var u=a.source.owner.getGraphManager().edges.indexOf(a);a.source.owner.getGraphManager().edges.splice(u,1)}},a.prototype.updateBounds=function(){this.rootGraph.updateBounds(!0)},a.prototype.getGraphs=function(){return this.graphs},a.prototype.getAllNodes=function(){if(this.allNodes==null){for(var e=[],t=this.getGraphs(),n=t.length,r=0;r<n;r++)e=e.concat(t[r].getNodes());this.allNodes=e}return this.allNodes},a.prototype.resetAllNodes=function(){this.allNodes=null},a.prototype.resetAllEdges=function(){this.allEdges=null},a.prototype.resetAllNodesToApplyGravitation=function(){this.allNodesToApplyGravitation=null},a.prototype.getAllEdges=function(){if(this.allEdges==null){var e=[],t=this.getGraphs();t.length;for(var n=0;n<t.length;n++)e=e.concat(t[n].getEdges());e=e.concat(this.edges),this.allEdges=e}return this.allEdges},a.prototype.getAllNodesToApplyGravitation=function(){return this.allNodesToApplyGravitation},a.prototype.setAllNodesToApplyGravitation=function(e){if(this.allNodesToApplyGravitation!=null)throw`assert failed`;this.allNodesToApplyGravitation=e},a.prototype.getRoot=function(){return this.rootGraph},a.prototype.setRootGraph=function(e){if(e.getGraphManager()!=this)throw`Root not in this graph mgr!`;this.rootGraph=e,e.parent??=this.layout.newNode(`Root node`)},a.prototype.getLayout=function(){return this.layout},a.prototype.isOneAncestorOfOther=function(e,t){if(!(e!=null&&t!=null))throw`assert failed`;if(e==t)return!0;var n=e.getOwner(),r;do{if(r=n.getParent(),r==null)break;if(r==t)return!0;if(n=r.getOwner(),n==null)break}while(!0);n=t.getOwner();do{if(r=n.getParent(),r==null)break;if(r==e)return!0;if(n=r.getOwner(),n==null)break}while(!0);return!1},a.prototype.calcLowestCommonAncestors=function(){for(var e,t,n,r,i,a=this.getAllEdges(),o=a.length,s=0;s<o;s++){if(e=a[s],t=e.source,n=e.target,e.lca=null,e.sourceInLca=t,e.targetInLca=n,t==n){e.lca=t.getOwner();continue}for(r=t.getOwner();e.lca==null;){for(e.targetInLca=n,i=n.getOwner();e.lca==null;){if(i==r){e.lca=i;break}if(i==this.rootGraph)break;if(e.lca!=null)throw`assert failed`;e.targetInLca=i.getParent(),i=e.targetInLca.getOwner()}if(r==this.rootGraph)break;e.lca??(e.sourceInLca=r.getParent(),r=e.sourceInLca.getOwner())}if(e.lca==null)throw`assert failed`}},a.prototype.calcLowestCommonAncestor=function(e,t){if(e==t)return e.getOwner();var n=e.getOwner();do{if(n==null)break;var r=t.getOwner();do{if(r==null)break;if(r==n)return r;r=r.getParent().getOwner()}while(!0);n=n.getParent().getOwner()}while(!0);return n},a.prototype.calcInclusionTreeDepths=function(e,t){e==null&&t==null&&(e=this.rootGraph,t=1);for(var n,r=e.getNodes(),i=r.length,a=0;a<i;a++)n=r[a],n.inclusionTreeDepth=t,n.child!=null&&this.calcInclusionTreeDepths(n.child,t+1)},a.prototype.includesInvalidEdge=function(){for(var e,t=this.edges.length,n=0;n<t;n++)if(e=this.edges[n],this.isOneAncestorOfOther(e.source,e.target))return!0;return!1},e.exports=a}),(function(e,t,n){var r=n(0);function i(){}for(var a in r)i[a]=r[a];i.MAX_ITERATIONS=2500,i.DEFAULT_EDGE_LENGTH=50,i.DEFAULT_SPRING_STRENGTH=.45,i.DEFAULT_REPULSION_STRENGTH=4500,i.DEFAULT_GRAVITY_STRENGTH=.4,i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=1,i.DEFAULT_GRAVITY_RANGE_FACTOR=3.8,i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=1.5,i.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION=!0,i.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION=!0,i.DEFAULT_COOLING_FACTOR_INCREMENTAL=.3,i.COOLING_ADAPTATION_FACTOR=.33,i.ADAPTATION_LOWER_NODE_LIMIT=1e3,i.ADAPTATION_UPPER_NODE_LIMIT=5e3,i.MAX_NODE_DISPLACEMENT_INCREMENTAL=100,i.MAX_NODE_DISPLACEMENT=i.MAX_NODE_DISPLACEMENT_INCREMENTAL*3,i.MIN_REPULSION_DIST=i.DEFAULT_EDGE_LENGTH/10,i.CONVERGENCE_CHECK_PERIOD=100,i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=.1,i.MIN_EDGE_LENGTH=1,i.GRID_CALCULATION_CHECK_PERIOD=10,e.exports=i}),(function(e,t,n){var r=n(12);function i(){}i.calcSeparationAmount=function(e,t,n,r){if(!e.intersects(t))throw`assert failed`;var i=[,,];this.decideDirectionsForOverlappingNodes(e,t,i),n[0]=Math.min(e.getRight(),t.getRight())-Math.max(e.x,t.x),n[1]=Math.min(e.getBottom(),t.getBottom())-Math.max(e.y,t.y),e.getX()<=t.getX()&&e.getRight()>=t.getRight()?n[0]+=Math.min(t.getX()-e.getX(),e.getRight()-t.getRight()):t.getX()<=e.getX()&&t.getRight()>=e.getRight()&&(n[0]+=Math.min(e.getX()-t.getX(),t.getRight()-e.getRight())),e.getY()<=t.getY()&&e.getBottom()>=t.getBottom()?n[1]+=Math.min(t.getY()-e.getY(),e.getBottom()-t.getBottom()):t.getY()<=e.getY()&&t.getBottom()>=e.getBottom()&&(n[1]+=Math.min(e.getY()-t.getY(),t.getBottom()-e.getBottom()));var a=Math.abs((t.getCenterY()-e.getCenterY())/(t.getCenterX()-e.getCenterX()));t.getCenterY()===e.getCenterY()&&t.getCenterX()===e.getCenterX()&&(a=1);var o=a*n[0],s=n[1]/a;n[0]<s?s=n[0]:o=n[1],n[0]=-1*i[0]*(s/2+r),n[1]=-1*i[1]*(o/2+r)},i.decideDirectionsForOverlappingNodes=function(e,t,n){e.getCenterX()<t.getCenterX()?n[0]=-1:n[0]=1,e.getCenterY()<t.getCenterY()?n[1]=-1:n[1]=1},i.getIntersection2=function(e,t,n){var r=e.getCenterX(),i=e.getCenterY(),a=t.getCenterX(),o=t.getCenterY();if(e.intersects(t))return n[0]=r,n[1]=i,n[2]=a,n[3]=o,!0;var s=e.getX(),c=e.getY(),l=e.getRight(),u=e.getX(),d=e.getBottom(),f=e.getRight(),p=e.getWidthHalf(),m=e.getHeightHalf(),h=t.getX(),g=t.getY(),_=t.getRight(),v=t.getX(),y=t.getBottom(),b=t.getRight(),x=t.getWidthHalf(),S=t.getHeightHalf(),C=!1,w=!1;if(r===a){if(i>o)return n[0]=r,n[1]=c,n[2]=a,n[3]=y,!1;if(i<o)return n[0]=r,n[1]=d,n[2]=a,n[3]=g,!1}else if(i===o){if(r>a)return n[0]=s,n[1]=i,n[2]=_,n[3]=o,!1;if(r<a)return n[0]=l,n[1]=i,n[2]=h,n[3]=o,!1}else{var T=e.height/e.width,E=t.height/t.width,D=(o-i)/(a-r),O=void 0,k=void 0,A=void 0,j=void 0,M=void 0,N=void 0;if(-T===D?r>a?(n[0]=u,n[1]=d,C=!0):(n[0]=l,n[1]=c,C=!0):T===D&&(r>a?(n[0]=s,n[1]=c,C=!0):(n[0]=f,n[1]=d,C=!0)),-E===D?a>r?(n[2]=v,n[3]=y,w=!0):(n[2]=_,n[3]=g,w=!0):E===D&&(a>r?(n[2]=h,n[3]=g,w=!0):(n[2]=b,n[3]=y,w=!0)),C&&w)return!1;if(r>a?i>o?(O=this.getCardinalDirection(T,D,4),k=this.getCardinalDirection(E,D,2)):(O=this.getCardinalDirection(-T,D,3),k=this.getCardinalDirection(-E,D,1)):i>o?(O=this.getCardinalDirection(-T,D,1),k=this.getCardinalDirection(-E,D,3)):(O=this.getCardinalDirection(T,D,2),k=this.getCardinalDirection(E,D,4)),!C)switch(O){case 1:j=c,A=r+-m/D,n[0]=A,n[1]=j;break;case 2:A=f,j=i+p*D,n[0]=A,n[1]=j;break;case 3:j=d,A=r+m/D,n[0]=A,n[1]=j;break;case 4:A=u,j=i+-p*D,n[0]=A,n[1]=j;break}if(!w)switch(k){case 1:N=g,M=a+-S/D,n[2]=M,n[3]=N;break;case 2:M=b,N=o+x*D,n[2]=M,n[3]=N;break;case 3:N=y,M=a+S/D,n[2]=M,n[3]=N;break;case 4:M=v,N=o+-x*D,n[2]=M,n[3]=N;break}}return!1},i.getCardinalDirection=function(e,t,n){return e>t?n:1+n%4},i.getIntersection=function(e,t,n,i){if(i==null)return this.getIntersection2(e,t,n);var a=e.x,o=e.y,s=t.x,c=t.y,l=n.x,u=n.y,d=i.x,f=i.y,p=void 0,m=void 0,h=void 0,g=void 0,_=void 0,v=void 0,y=void 0,b=void 0,x=void 0;return h=c-o,_=a-s,y=s*o-a*c,g=f-u,v=l-d,b=d*u-l*f,x=h*v-g*_,x===0?null:(p=(_*b-v*y)/x,m=(g*y-h*b)/x,new r(p,m))},i.angleOfVector=function(e,t,n,r){var i=void 0;return e===n?i=r<t?this.ONE_AND_HALF_PI:this.HALF_PI:(i=Math.atan((r-t)/(n-e)),n<e?i+=Math.PI:r<t&&(i+=this.TWO_PI)),i},i.doIntersect=function(e,t,n,r){var i=e.x,a=e.y,o=t.x,s=t.y,c=n.x,l=n.y,u=r.x,d=r.y,f=(o-i)*(d-l)-(u-c)*(s-a);if(f===0)return!1;var p=((d-l)*(u-i)+(c-u)*(d-a))/f,m=((a-s)*(u-i)+(o-i)*(d-a))/f;return 0<p&&p<1&&0<m&&m<1},i.HALF_PI=.5*Math.PI,i.ONE_AND_HALF_PI=1.5*Math.PI,i.TWO_PI=2*Math.PI,i.THREE_PI=3*Math.PI,e.exports=i}),(function(e,t,n){function r(){}r.sign=function(e){return e>0?1:e<0?-1:0},r.floor=function(e){return e<0?Math.ceil(e):Math.floor(e)},r.ceil=function(e){return e<0?Math.floor(e):Math.ceil(e)},e.exports=r}),(function(e,t,n){function r(){}r.MAX_VALUE=2147483647,r.MIN_VALUE=-2147483648,e.exports=r}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=function(e){return{value:e,next:null,prev:null}},o=function(e,t,n,r){return e===null?r.head=t:e.next=t,n===null?r.tail=t:n.prev=t,t.prev=e,t.next=n,r.length++,t},s=function(e,t){var n=e.prev,r=e.next;return n===null?t.head=r:n.next=r,r===null?t.tail=n:r.prev=n,e.prev=e.next=null,t.length--,e};e.exports=function(){function e(t){var n=this;i(this,e),this.length=0,this.head=null,this.tail=null,t?.forEach(function(e){return n.push(e)})}return r(e,[{key:`size`,value:function(){return this.length}},{key:`insertBefore`,value:function(e,t){return o(t.prev,a(e),t,this)}},{key:`insertAfter`,value:function(e,t){return o(t,a(e),t.next,this)}},{key:`insertNodeBefore`,value:function(e,t){return o(t.prev,e,t,this)}},{key:`insertNodeAfter`,value:function(e,t){return o(t,e,t.next,this)}},{key:`push`,value:function(e){return o(this.tail,a(e),null,this)}},{key:`unshift`,value:function(e){return o(null,a(e),this.head,this)}},{key:`remove`,value:function(e){return s(e,this)}},{key:`pop`,value:function(){return s(this.tail,this).value}},{key:`popNode`,value:function(){return s(this.tail,this)}},{key:`shift`,value:function(){return s(this.head,this).value}},{key:`shiftNode`,value:function(){return s(this.head,this)}},{key:`get_object_at`,value:function(e){if(e<=this.length()){for(var t=1,n=this.head;t<e;)n=n.next,t++;return n.value}}},{key:`set_object_at`,value:function(e,t){if(e<=this.length()){for(var n=1,r=this.head;n<e;)r=r.next,n++;r.value=t}}}]),e}()}),(function(e,t,n){function r(e,t,n){this.x=null,this.y=null,e==null&&t==null&&n==null?(this.x=0,this.y=0):typeof e==`number`&&typeof t==`number`&&n==null?(this.x=e,this.y=t):e.constructor.name==`Point`&&t==null&&n==null&&(n=e,this.x=n.x,this.y=n.y)}r.prototype.getX=function(){return this.x},r.prototype.getY=function(){return this.y},r.prototype.getLocation=function(){return new r(this.x,this.y)},r.prototype.setLocation=function(e,t,n){e.constructor.name==`Point`&&t==null&&n==null?(n=e,this.setLocation(n.x,n.y)):typeof e==`number`&&typeof t==`number`&&n==null&&(parseInt(e)==e&&parseInt(t)==t?this.move(e,t):(this.x=Math.floor(e+.5),this.y=Math.floor(t+.5)))},r.prototype.move=function(e,t){this.x=e,this.y=t},r.prototype.translate=function(e,t){this.x+=e,this.y+=t},r.prototype.equals=function(e){if(e.constructor.name==`Point`){var t=e;return this.x==t.x&&this.y==t.y}return this==e},r.prototype.toString=function(){return new r().constructor.name+`[x=`+this.x+`,y=`+this.y+`]`},e.exports=r}),(function(e,t,n){function r(e,t,n,r){this.x=0,this.y=0,this.width=0,this.height=0,e!=null&&t!=null&&n!=null&&r!=null&&(this.x=e,this.y=t,this.width=n,this.height=r)}r.prototype.getX=function(){return this.x},r.prototype.setX=function(e){this.x=e},r.prototype.getY=function(){return this.y},r.prototype.setY=function(e){this.y=e},r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},r.prototype.getRight=function(){return this.x+this.width},r.prototype.getBottom=function(){return this.y+this.height},r.prototype.intersects=function(e){return!(this.getRight()<e.x||this.getBottom()<e.y||e.getRight()<this.x||e.getBottom()<this.y)},r.prototype.getCenterX=function(){return this.x+this.width/2},r.prototype.getMinX=function(){return this.getX()},r.prototype.getMaxX=function(){return this.getX()+this.width},r.prototype.getCenterY=function(){return this.y+this.height/2},r.prototype.getMinY=function(){return this.getY()},r.prototype.getMaxY=function(){return this.getY()+this.height},r.prototype.getWidthHalf=function(){return this.width/2},r.prototype.getHeightHalf=function(){return this.height/2},e.exports=r}),(function(e,t,n){var r=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e};function i(){}i.lastID=0,i.createID=function(e){return i.isPrimitive(e)?e:e.uniqueID==null?(e.uniqueID=i.getString(),i.lastID++,e.uniqueID):e.uniqueID},i.getString=function(e){return e??=i.lastID,`Object#`+e},i.isPrimitive=function(e){var t=e===void 0?`undefined`:r(e);return e==null||t!=`object`&&t!=`function`},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}var i=n(0),a=n(6),o=n(3),s=n(1),c=n(5),l=n(4),u=n(17),d=n(27);function f(e){d.call(this),this.layoutQuality=i.QUALITY,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.incremental=i.DEFAULT_INCREMENTAL,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES,this.edgeToDummyNodes=new Map,this.graphManager=new a(this),this.isLayoutFinished=!1,this.isSubLayout=!1,this.isRemoteUse=!1,e!=null&&(this.isRemoteUse=e)}f.RANDOM_SEED=1,f.prototype=Object.create(d.prototype),f.prototype.getGraphManager=function(){return this.graphManager},f.prototype.getAllNodes=function(){return this.graphManager.getAllNodes()},f.prototype.getAllEdges=function(){return this.graphManager.getAllEdges()},f.prototype.getAllNodesToApplyGravitation=function(){return this.graphManager.getAllNodesToApplyGravitation()},f.prototype.newGraphManager=function(){var e=new a(this);return this.graphManager=e,e},f.prototype.newGraph=function(e){return new c(null,this.graphManager,e)},f.prototype.newNode=function(e){return new o(this.graphManager,e)},f.prototype.newEdge=function(e){return new s(null,null,e)},f.prototype.checkLayoutSuccess=function(){return this.graphManager.getRoot()==null||this.graphManager.getRoot().getNodes().length==0||this.graphManager.includesInvalidEdge()},f.prototype.runLayout=function(){this.isLayoutFinished=!1,this.tilingPreLayout&&this.tilingPreLayout(),this.initParameters();var e=this.checkLayoutSuccess()?!1:this.layout();return i.ANIMATE===`during`?!1:(e&&(this.isSubLayout||this.doPostLayout()),this.tilingPostLayout&&this.tilingPostLayout(),this.isLayoutFinished=!0,e)},f.prototype.doPostLayout=function(){this.incremental||this.transform(),this.update()},f.prototype.update2=function(){if(this.createBendsAsNeeded&&(this.createBendpointsFromDummyNodes(),this.graphManager.resetAllEdges()),!this.isRemoteUse){for(var e=this.graphManager.getAllEdges(),t=0;t<e.length;t++)e[t];for(var n=this.graphManager.getRoot().getNodes(),t=0;t<n.length;t++)n[t];this.update(this.graphManager.getRoot())}},f.prototype.update=function(e){if(e==null)this.update2();else if(e instanceof o){var t=e;if(t.getChild()!=null)for(var n=t.getChild().getNodes(),r=0;r<n.length;r++)update(n[r]);t.vGraphObject!=null&&t.vGraphObject.update(t)}else if(e instanceof s){var i=e;i.vGraphObject!=null&&i.vGraphObject.update(i)}else if(e instanceof c){var a=e;a.vGraphObject!=null&&a.vGraphObject.update(a)}},f.prototype.initParameters=function(){this.isSubLayout||(this.layoutQuality=i.QUALITY,this.animationDuringLayout=i.DEFAULT_ANIMATION_DURING_LAYOUT,this.animationPeriod=i.DEFAULT_ANIMATION_PERIOD,this.animationOnLayout=i.DEFAULT_ANIMATION_ON_LAYOUT,this.incremental=i.DEFAULT_INCREMENTAL,this.createBendsAsNeeded=i.DEFAULT_CREATE_BENDS_AS_NEEDED,this.uniformLeafNodeSizes=i.DEFAULT_UNIFORM_LEAF_NODE_SIZES),this.animationDuringLayout&&(this.animationOnLayout=!1)},f.prototype.transform=function(e){if(e==null)this.transform(new l(0,0));else{var t=new u,n=this.graphManager.getRoot().updateLeftTop();if(n!=null){t.setWorldOrgX(e.x),t.setWorldOrgY(e.y),t.setDeviceOrgX(n.x),t.setDeviceOrgY(n.y);for(var r=this.getAllNodes(),i,a=0;a<r.length;a++)i=r[a],i.transform(t)}}},f.prototype.positionNodesRandomly=function(e){if(e==null)this.positionNodesRandomly(this.getGraphManager().getRoot()),this.getGraphManager().getRoot().updateBounds(!0);else for(var t,n,r=e.getNodes(),i=0;i<r.length;i++)t=r[i],n=t.getChild(),n==null||n.getNodes().length==0?t.scatter():(this.positionNodesRandomly(n),t.updateBounds())},f.prototype.getFlatForest=function(){for(var e=[],t=!0,n=this.graphManager.getRoot().getNodes(),i=!0,a=0;a<n.length;a++)n[a].getChild()!=null&&(i=!1);if(!i)return e;var o=new Set,s=[],c=new Map,l=[];for(l=l.concat(n);l.length>0&&t;){for(s.push(l[0]);s.length>0&&t;){var u=s[0];s.splice(0,1),o.add(u);for(var d=u.getEdges(),a=0;a<d.length;a++){var f=d[a].getOtherEnd(u);if(c.get(u)!=f)if(!o.has(f))s.push(f),c.set(f,u);else{t=!1;break}}}if(!t)e=[];else{var p=[].concat(r(o));e.push(p);for(var a=0;a<p.length;a++){var m=p[a],h=l.indexOf(m);h>-1&&l.splice(h,1)}o=new Set,c=new Map}}return e},f.prototype.createDummyNodesForBendpoints=function(e){for(var t=[],n=e.source,r=this.graphManager.calcLowestCommonAncestor(e.source,e.target),i=0;i<e.bendpoints.length;i++){var a=this.newNode(null);a.setRect(new Point(0,0),new Dimension(1,1)),r.add(a);var o=this.newEdge(null);this.graphManager.add(o,n,a),t.add(a),n=a}var o=this.newEdge(null);return this.graphManager.add(o,n,e.target),this.edgeToDummyNodes.set(e,t),e.isInterGraph()?this.graphManager.remove(e):r.remove(e),t},f.prototype.createBendpointsFromDummyNodes=function(){var e=[];e=e.concat(this.graphManager.getAllEdges()),e=[].concat(r(this.edgeToDummyNodes.keys()),e);for(var t=0;t<e.length;t++){var n=e[t];if(n.bendpoints.length>0){for(var i=this.edgeToDummyNodes.get(n),a=0;a<i.length;a++){var o=i[a],s=new l(o.getCenterX(),o.getCenterY()),c=n.bendpoints.get(a);c.x=s.x,c.y=s.y,o.getOwner().remove(o)}this.graphManager.add(n,n.source,n.target)}}},f.transform=function(e,t,n,r){if(n!=null&&r!=null){var i=t;if(e<=50){var a=t/n;i-=(t-a)/50*(50-e)}else{var o=t*r;i+=(o-t)/50*(e-50)}return i}else{var s,c;return e<=50?(s=9*t/500,c=t/10):(s=9*t/50,c=-8*t),s*e+c}},f.findCenterOfTree=function(e){var t=[];t=t.concat(e);var n=[],r=new Map,i=!1,a=null;(t.length==1||t.length==2)&&(i=!0,a=t[0]);for(var o=0;o<t.length;o++){var s=t[o],c=s.getNeighborsList().size;r.set(s,s.getNeighborsList().size),c==1&&n.push(s)}var l=[];for(l=l.concat(n);!i;){var u=[];u=u.concat(l),l=[];for(var o=0;o<t.length;o++){var s=t[o],d=t.indexOf(s);d>=0&&t.splice(d,1),s.getNeighborsList().forEach(function(e){if(n.indexOf(e)<0){var t=r.get(e)-1;t==1&&l.push(e),r.set(e,t)}})}n=n.concat(l),(t.length==1||t.length==2)&&(i=!0,a=t[0])}return a},f.prototype.setGraphManager=function(e){this.graphManager=e},e.exports=f}),(function(e,t,n){function r(){}r.seed=1,r.x=0,r.nextDouble=function(){return r.x=Math.sin(r.seed++)*1e4,r.x-Math.floor(r.x)},e.exports=r}),(function(e,t,n){var r=n(4);function i(e,t){this.lworldOrgX=0,this.lworldOrgY=0,this.ldeviceOrgX=0,this.ldeviceOrgY=0,this.lworldExtX=1,this.lworldExtY=1,this.ldeviceExtX=1,this.ldeviceExtY=1}i.prototype.getWorldOrgX=function(){return this.lworldOrgX},i.prototype.setWorldOrgX=function(e){this.lworldOrgX=e},i.prototype.getWorldOrgY=function(){return this.lworldOrgY},i.prototype.setWorldOrgY=function(e){this.lworldOrgY=e},i.prototype.getWorldExtX=function(){return this.lworldExtX},i.prototype.setWorldExtX=function(e){this.lworldExtX=e},i.prototype.getWorldExtY=function(){return this.lworldExtY},i.prototype.setWorldExtY=function(e){this.lworldExtY=e},i.prototype.getDeviceOrgX=function(){return this.ldeviceOrgX},i.prototype.setDeviceOrgX=function(e){this.ldeviceOrgX=e},i.prototype.getDeviceOrgY=function(){return this.ldeviceOrgY},i.prototype.setDeviceOrgY=function(e){this.ldeviceOrgY=e},i.prototype.getDeviceExtX=function(){return this.ldeviceExtX},i.prototype.setDeviceExtX=function(e){this.ldeviceExtX=e},i.prototype.getDeviceExtY=function(){return this.ldeviceExtY},i.prototype.setDeviceExtY=function(e){this.ldeviceExtY=e},i.prototype.transformX=function(e){var t=0,n=this.lworldExtX;return n!=0&&(t=this.ldeviceOrgX+(e-this.lworldOrgX)*this.ldeviceExtX/n),t},i.prototype.transformY=function(e){var t=0,n=this.lworldExtY;return n!=0&&(t=this.ldeviceOrgY+(e-this.lworldOrgY)*this.ldeviceExtY/n),t},i.prototype.inverseTransformX=function(e){var t=0,n=this.ldeviceExtX;return n!=0&&(t=this.lworldOrgX+(e-this.ldeviceOrgX)*this.lworldExtX/n),t},i.prototype.inverseTransformY=function(e){var t=0,n=this.ldeviceExtY;return n!=0&&(t=this.lworldOrgY+(e-this.ldeviceOrgY)*this.lworldExtY/n),t},i.prototype.inverseTransformPoint=function(e){return new r(this.inverseTransformX(e.x),this.inverseTransformY(e.y))},e.exports=i}),(function(e,t,n){function r(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}else return Array.from(e)}var i=n(15),a=n(7),o=n(0),s=n(8),c=n(9);function l(){i.call(this),this.useSmartIdealEdgeLengthCalculation=a.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.idealEdgeLength=a.DEFAULT_EDGE_LENGTH,this.springConstant=a.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=a.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=a.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=a.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=a.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.displacementThresholdPerNode=3*a.DEFAULT_EDGE_LENGTH/100,this.coolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.initialCoolingFactor=a.DEFAULT_COOLING_FACTOR_INCREMENTAL,this.totalDisplacement=0,this.oldTotalDisplacement=0,this.maxIterations=a.MAX_ITERATIONS}for(var u in l.prototype=Object.create(i.prototype),i)l[u]=i[u];l.prototype.initParameters=function(){i.prototype.initParameters.call(this,arguments),this.totalIterations=0,this.notAnimatedIterations=0,this.useFRGridVariant=a.DEFAULT_USE_SMART_REPULSION_RANGE_CALCULATION,this.grid=[]},l.prototype.calcIdealEdgeLengths=function(){for(var e,t,n,r,i,s,c=this.getGraphManager().getAllEdges(),l=0;l<c.length;l++)e=c[l],e.idealLength=this.idealEdgeLength,e.isInterGraph&&(n=e.getSource(),r=e.getTarget(),i=e.getSourceInLca().getEstimatedSize(),s=e.getTargetInLca().getEstimatedSize(),this.useSmartIdealEdgeLengthCalculation&&(e.idealLength+=i+s-2*o.SIMPLE_NODE_SIZE),t=e.getLca().getInclusionTreeDepth(),e.idealLength+=a.DEFAULT_EDGE_LENGTH*a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR*(n.getInclusionTreeDepth()+r.getInclusionTreeDepth()-2*t))},l.prototype.initSpringEmbedder=function(){var e=this.getAllNodes().length;this.incremental?(e>a.ADAPTATION_LOWER_NODE_LIMIT&&(this.coolingFactor=Math.max(this.coolingFactor*a.COOLING_ADAPTATION_FACTOR,this.coolingFactor-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*this.coolingFactor*(1-a.COOLING_ADAPTATION_FACTOR))),this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT_INCREMENTAL):(e>a.ADAPTATION_LOWER_NODE_LIMIT?this.coolingFactor=Math.max(a.COOLING_ADAPTATION_FACTOR,1-(e-a.ADAPTATION_LOWER_NODE_LIMIT)/(a.ADAPTATION_UPPER_NODE_LIMIT-a.ADAPTATION_LOWER_NODE_LIMIT)*(1-a.COOLING_ADAPTATION_FACTOR)):this.coolingFactor=1,this.initialCoolingFactor=this.coolingFactor,this.maxNodeDisplacement=a.MAX_NODE_DISPLACEMENT),this.maxIterations=Math.max(this.getAllNodes().length*5,this.maxIterations),this.totalDisplacementThreshold=this.displacementThresholdPerNode*this.getAllNodes().length,this.repulsionRange=this.calcRepulsionRange()},l.prototype.calcSpringForces=function(){for(var e=this.getAllEdges(),t,n=0;n<e.length;n++)t=e[n],this.calcSpringForce(t,t.idealLength)},l.prototype.calcRepulsionForces=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n,r,i,o,s=this.getAllNodes(),c;if(this.useFRGridVariant)for(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&e&&this.updateGrid(),c=new Set,n=0;n<s.length;n++)i=s[n],this.calculateRepulsionForceOfANode(i,c,e,t),c.add(i);else for(n=0;n<s.length;n++)for(i=s[n],r=n+1;r<s.length;r++)o=s[r],i.getOwner()==o.getOwner()&&this.calcRepulsionForce(i,o)},l.prototype.calcGravitationalForces=function(){for(var e,t=this.getAllNodesToApplyGravitation(),n=0;n<t.length;n++)e=t[n],this.calcGravitationalForce(e)},l.prototype.moveNodes=function(){for(var e=this.getAllNodes(),t,n=0;n<e.length;n++)t=e[n],t.move()},l.prototype.calcSpringForce=function(e,t){var n=e.getSource(),r=e.getTarget(),i,a,o,s;if(this.uniformLeafNodeSizes&&n.getChild()==null&&r.getChild()==null)e.updateLengthSimple();else if(e.updateLength(),e.isOverlapingSourceAndTarget)return;i=e.getLength(),i!=0&&(a=this.springConstant*(i-t),o=a*(e.lengthX/i),s=a*(e.lengthY/i),n.springForceX+=o,n.springForceY+=s,r.springForceX-=o,r.springForceY-=s)},l.prototype.calcRepulsionForce=function(e,t){var n=e.getRect(),r=t.getRect(),i=[,,],o=[,,,,],l,u,d,f,p,m,h;if(n.intersects(r)){s.calcSeparationAmount(n,r,i,a.DEFAULT_EDGE_LENGTH/2),m=2*i[0],h=2*i[1];var g=e.noOfChildren*t.noOfChildren/(e.noOfChildren+t.noOfChildren);e.repulsionForceX-=g*m,e.repulsionForceY-=g*h,t.repulsionForceX+=g*m,t.repulsionForceY+=g*h}else this.uniformLeafNodeSizes&&e.getChild()==null&&t.getChild()==null?(l=r.getCenterX()-n.getCenterX(),u=r.getCenterY()-n.getCenterY()):(s.getIntersection(n,r,o),l=o[2]-o[0],u=o[3]-o[1]),Math.abs(l)<a.MIN_REPULSION_DIST&&(l=c.sign(l)*a.MIN_REPULSION_DIST),Math.abs(u)<a.MIN_REPULSION_DIST&&(u=c.sign(u)*a.MIN_REPULSION_DIST),d=l*l+u*u,f=Math.sqrt(d),p=this.repulsionConstant*e.noOfChildren*t.noOfChildren/d,m=p*l/f,h=p*u/f,e.repulsionForceX-=m,e.repulsionForceY-=h,t.repulsionForceX+=m,t.repulsionForceY+=h},l.prototype.calcGravitationalForce=function(e){var t=e.getOwner(),n=(t.getRight()+t.getLeft())/2,r=(t.getTop()+t.getBottom())/2,i=e.getCenterX()-n,a=e.getCenterY()-r,o=Math.abs(i)+e.getWidth()/2,s=Math.abs(a)+e.getHeight()/2,c;e.getOwner()==this.graphManager.getRoot()?(c=t.getEstimatedSize()*this.gravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i,e.gravitationForceY=-this.gravityConstant*a)):(c=t.getEstimatedSize()*this.compoundGravityRangeFactor,(o>c||s>c)&&(e.gravitationForceX=-this.gravityConstant*i*this.compoundGravityConstant,e.gravitationForceY=-this.gravityConstant*a*this.compoundGravityConstant))},l.prototype.isConverged=function(){var e,t=!1;return this.totalIterations>this.maxIterations/3&&(t=Math.abs(this.totalDisplacement-this.oldTotalDisplacement)<2),e=this.totalDisplacement<this.totalDisplacementThreshold,this.oldTotalDisplacement=this.totalDisplacement,e||t},l.prototype.animate=function(){this.animationDuringLayout&&!this.isSubLayout&&(this.notAnimatedIterations==this.animationPeriod?(this.update(),this.notAnimatedIterations=0):this.notAnimatedIterations++)},l.prototype.calcNoOfChildrenForAllNodes=function(){for(var e,t=this.graphManager.getAllNodes(),n=0;n<t.length;n++)e=t[n],e.noOfChildren=e.getNoOfChildren()},l.prototype.calcGrid=function(e){var t=0,n=0;t=parseInt(Math.ceil((e.getRight()-e.getLeft())/this.repulsionRange)),n=parseInt(Math.ceil((e.getBottom()-e.getTop())/this.repulsionRange));for(var r=Array(t),i=0;i<t;i++)r[i]=Array(n);for(var i=0;i<t;i++)for(var a=0;a<n;a++)r[i][a]=[];return r},l.prototype.addNodeToGrid=function(e,t,n){var r=0,i=0,a=0,o=0;r=parseInt(Math.floor((e.getRect().x-t)/this.repulsionRange)),i=parseInt(Math.floor((e.getRect().width+e.getRect().x-t)/this.repulsionRange)),a=parseInt(Math.floor((e.getRect().y-n)/this.repulsionRange)),o=parseInt(Math.floor((e.getRect().height+e.getRect().y-n)/this.repulsionRange));for(var s=r;s<=i;s++)for(var c=a;c<=o;c++)this.grid[s][c].push(e),e.setGridCoordinates(r,i,a,o)},l.prototype.updateGrid=function(){var e,t,n=this.getAllNodes();for(this.grid=this.calcGrid(this.graphManager.getRoot()),e=0;e<n.length;e++)t=n[e],this.addNodeToGrid(t,this.graphManager.getRoot().getLeft(),this.graphManager.getRoot().getTop())},l.prototype.calculateRepulsionForceOfANode=function(e,t,n,i){if(this.totalIterations%a.GRID_CALCULATION_CHECK_PERIOD==1&&n||i){var o=new Set;e.surrounding=[];for(var s,c=this.grid,l=e.startX-1;l<e.finishX+2;l++)for(var u=e.startY-1;u<e.finishY+2;u++)if(!(l<0||u<0||l>=c.length||u>=c[0].length)){for(var d=0;d<c[l][u].length;d++)if(s=c[l][u][d],!(e.getOwner()!=s.getOwner()||e==s)&&!t.has(s)&&!o.has(s)){var f=Math.abs(e.getCenterX()-s.getCenterX())-(e.getWidth()/2+s.getWidth()/2),p=Math.abs(e.getCenterY()-s.getCenterY())-(e.getHeight()/2+s.getHeight()/2);f<=this.repulsionRange&&p<=this.repulsionRange&&o.add(s)}}e.surrounding=[].concat(r(o))}for(l=0;l<e.surrounding.length;l++)this.calcRepulsionForce(e,e.surrounding[l])},l.prototype.calcRepulsionRange=function(){return 0},e.exports=l}),(function(e,t,n){var r=n(1),i=n(7);function a(e,t,n){r.call(this,e,t,n),this.idealLength=i.DEFAULT_EDGE_LENGTH}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];e.exports=a}),(function(e,t,n){var r=n(3);function i(e,t,n,i){r.call(this,e,t,n,i),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0,this.startX=0,this.finishX=0,this.startY=0,this.finishY=0,this.surrounding=[]}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];i.prototype.setGridCoordinates=function(e,t,n,r){this.startX=e,this.finishX=t,this.startY=n,this.finishY=r},e.exports=i}),(function(e,t,n){function r(e,t){this.width=0,this.height=0,e!==null&&t!==null&&(this.height=t,this.width=e)}r.prototype.getWidth=function(){return this.width},r.prototype.setWidth=function(e){this.width=e},r.prototype.getHeight=function(){return this.height},r.prototype.setHeight=function(e){this.height=e},e.exports=r}),(function(e,t,n){var r=n(14);function i(){this.map={},this.keys=[]}i.prototype.put=function(e,t){var n=r.createID(e);this.contains(n)||(this.map[n]=t,this.keys.push(e))},i.prototype.contains=function(e){return r.createID(e),this.map[e]!=null},i.prototype.get=function(e){var t=r.createID(e);return this.map[t]},i.prototype.keySet=function(){return this.keys},e.exports=i}),(function(e,t,n){var r=n(14);function i(){this.set={}}i.prototype.add=function(e){var t=r.createID(e);this.contains(t)||(this.set[t]=e)},i.prototype.remove=function(e){delete this.set[r.createID(e)]},i.prototype.clear=function(){this.set={}},i.prototype.contains=function(e){return this.set[r.createID(e)]==e},i.prototype.isEmpty=function(){return this.size()===0},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAllTo=function(e){for(var t=Object.keys(this.set),n=t.length,r=0;r<n;r++)e.push(this.set[t[r]])},i.prototype.size=function(){return Object.keys(this.set).length},i.prototype.addAll=function(e){for(var t=e.length,n=0;n<t;n++){var r=e[n];this.add(r)}},e.exports=i}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}var a=n(11);e.exports=function(){function e(t,n){i(this,e),(n!==null||n!==void 0)&&(this.compareFunction=this._defaultCompareFunction);var r=void 0;r=t instanceof a?t.size():t.length,this._quicksort(t,0,r-1)}return r(e,[{key:`_quicksort`,value:function(e,t,n){if(t<n){var r=this._partition(e,t,n);this._quicksort(e,t,r),this._quicksort(e,r+1,n)}}},{key:`_partition`,value:function(e,t,n){for(var r=this._get(e,t),i=t,a=n;;){for(;this.compareFunction(r,this._get(e,a));)a--;for(;this.compareFunction(this._get(e,i),r);)i++;if(i<a)this._swap(e,i,a),i++,a--;else return a}}},{key:`_get`,value:function(e,t){return e instanceof a?e.get_object_at(t):e[t]}},{key:`_set`,value:function(e,t,n){e instanceof a?e.set_object_at(t,n):e[t]=n}},{key:`_swap`,value:function(e,t,n){var r=this._get(e,t);this._set(e,t,this._get(e,n)),this._set(e,n,r)}},{key:`_defaultCompareFunction`,value:function(e,t){return t>e}}]),e}()}),(function(e,t,n){var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}e.exports=function(){function e(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:-1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:-1;i(this,e),this.sequence1=t,this.sequence2=n,this.match_score=r,this.mismatch_penalty=a,this.gap_penalty=o,this.iMax=t.length+1,this.jMax=n.length+1,this.grid=Array(this.iMax);for(var s=0;s<this.iMax;s++){this.grid[s]=Array(this.jMax);for(var c=0;c<this.jMax;c++)this.grid[s][c]=0}this.tracebackGrid=Array(this.iMax);for(var l=0;l<this.iMax;l++){this.tracebackGrid[l]=Array(this.jMax);for(var u=0;u<this.jMax;u++)this.tracebackGrid[l][u]=[null,null,null]}this.alignments=[],this.score=-1,this.computeGrids()}return r(e,[{key:`getScore`,value:function(){return this.score}},{key:`getAlignments`,value:function(){return this.alignments}},{key:`computeGrids`,value:function(){for(var e=1;e<this.jMax;e++)this.grid[0][e]=this.grid[0][e-1]+this.gap_penalty,this.tracebackGrid[0][e]=[!1,!1,!0];for(var t=1;t<this.iMax;t++)this.grid[t][0]=this.grid[t-1][0]+this.gap_penalty,this.tracebackGrid[t][0]=[!1,!0,!1];for(var n=1;n<this.iMax;n++)for(var r=1;r<this.jMax;r++){var i=void 0;i=this.sequence1[n-1]===this.sequence2[r-1]?this.grid[n-1][r-1]+this.match_score:this.grid[n-1][r-1]+this.mismatch_penalty;var a=this.grid[n-1][r]+this.gap_penalty,o=this.grid[n][r-1]+this.gap_penalty,s=[i,a,o],c=this.arrayAllMaxIndexes(s);this.grid[n][r]=s[c[0]],this.tracebackGrid[n][r]=[c.includes(0),c.includes(1),c.includes(2)]}this.score=this.grid[this.iMax-1][this.jMax-1]}},{key:`alignmentTraceback`,value:function(){var e=[];for(e.push({pos:[this.sequence1.length,this.sequence2.length],seq1:``,seq2:``});e[0];){var t=e[0],n=this.tracebackGrid[t.pos[0]][t.pos[1]];n[0]&&e.push({pos:[t.pos[0]-1,t.pos[1]-1],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),n[1]&&e.push({pos:[t.pos[0]-1,t.pos[1]],seq1:this.sequence1[t.pos[0]-1]+t.seq1,seq2:`-`+t.seq2}),n[2]&&e.push({pos:[t.pos[0],t.pos[1]-1],seq1:`-`+t.seq1,seq2:this.sequence2[t.pos[1]-1]+t.seq2}),t.pos[0]===0&&t.pos[1]===0&&this.alignments.push({sequence1:t.seq1,sequence2:t.seq2}),e.shift()}return this.alignments}},{key:`getAllIndexes`,value:function(e,t){for(var n=[],r=-1;(r=e.indexOf(t,r+1))!==-1;)n.push(r);return n}},{key:`arrayAllMaxIndexes`,value:function(e){return this.getAllIndexes(e,Math.max.apply(null,e))}}]),e}()}),(function(e,t,n){var r=function(){};r.FDLayout=n(18),r.FDLayoutConstants=n(7),r.FDLayoutEdge=n(19),r.FDLayoutNode=n(20),r.DimensionD=n(21),r.HashMap=n(22),r.HashSet=n(23),r.IGeometry=n(8),r.IMath=n(9),r.Integer=n(10),r.Point=n(12),r.PointD=n(4),r.RandomSeed=n(16),r.RectangleD=n(13),r.Transform=n(17),r.UniqueIDGeneretor=n(14),r.Quicksort=n(24),r.LinkedList=n(11),r.LGraphObject=n(2),r.LGraph=n(5),r.LEdge=n(1),r.LGraphManager=n(6),r.LNode=n(3),r.Layout=n(15),r.LayoutConstants=n(0),r.NeedlemanWunsch=n(25),e.exports=r}),(function(e,t,n){function r(){this.listeners=[]}var i=r.prototype;i.addListener=function(e,t){this.listeners.push({event:e,callback:t})},i.removeListener=function(e,t){for(var n=this.listeners.length;n>=0;n--){var r=this.listeners[n];r.event===e&&r.callback===t&&this.listeners.splice(n,1)}},i.emit=function(e,t){for(var n=0;n<this.listeners.length;n++){var r=this.listeners[n];e===r.event&&r.callback(t)}},e.exports=r})])})})),s=e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(o()):typeof define==`function`&&define.amd?define([`layout-base`],r):typeof e==`object`?e.coseBase=r(o()):n.coseBase=r(n.layoutBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=7)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).FDLayoutConstants;function i(){}for(var a in r)i[a]=r[a];i.DEFAULT_USE_MULTI_LEVEL_SCALING=!1,i.DEFAULT_RADIAL_SEPARATION=r.DEFAULT_EDGE_LENGTH,i.DEFAULT_COMPONENT_SEPERATION=60,i.TILE=!0,i.TILING_PADDING_VERTICAL=10,i.TILING_PADDING_HORIZONTAL=10,i.TREE_REDUCTION_ON_INCREMENTAL=!1,e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutEdge;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraph;function i(e,t,n){r.call(this,e,t,n)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).LGraphManager;function i(e){r.call(this,e)}for(var a in i.prototype=Object.create(r.prototype),r)i[a]=r[a];e.exports=i}),(function(e,t,n){var r=n(0).FDLayoutNode,i=n(0).IMath;function a(e,t,n,i){r.call(this,e,t,n,i)}for(var o in a.prototype=Object.create(r.prototype),r)a[o]=r[o];a.prototype.move=function(){var e=this.graphManager.getLayout();this.displacementX=e.coolingFactor*(this.springForceX+this.repulsionForceX+this.gravitationForceX)/this.noOfChildren,this.displacementY=e.coolingFactor*(this.springForceY+this.repulsionForceY+this.gravitationForceY)/this.noOfChildren,Math.abs(this.displacementX)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementX=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementX)),Math.abs(this.displacementY)>e.coolingFactor*e.maxNodeDisplacement&&(this.displacementY=e.coolingFactor*e.maxNodeDisplacement*i.sign(this.displacementY)),this.child==null||this.child.getNodes().length==0?this.moveBy(this.displacementX,this.displacementY):this.propogateDisplacementToChildren(this.displacementX,this.displacementY),e.totalDisplacement+=Math.abs(this.displacementX)+Math.abs(this.displacementY),this.springForceX=0,this.springForceY=0,this.repulsionForceX=0,this.repulsionForceY=0,this.gravitationForceX=0,this.gravitationForceY=0,this.displacementX=0,this.displacementY=0},a.prototype.propogateDisplacementToChildren=function(e,t){for(var n=this.getChild().getNodes(),r,i=0;i<n.length;i++)r=n[i],r.getChild()==null?(r.moveBy(e,t),r.displacementX+=e,r.displacementY+=t):r.propogateDisplacementToChildren(e,t)},a.prototype.setPred1=function(e){this.pred1=e},a.prototype.getPred1=function(){return pred1},a.prototype.getPred2=function(){return pred2},a.prototype.setNext=function(e){this.next=e},a.prototype.getNext=function(){return next},a.prototype.setProcessed=function(e){this.processed=e},a.prototype.isProcessed=function(){return processed},e.exports=a}),(function(e,t,n){var r=n(0).FDLayout,i=n(4),a=n(3),o=n(5),s=n(2),c=n(1),l=n(0).FDLayoutConstants,u=n(0).LayoutConstants,d=n(0).Point,f=n(0).PointD,p=n(0).Layout,m=n(0).Integer,h=n(0).IGeometry,g=n(0).LGraph,_=n(0).Transform;function v(){r.call(this),this.toBeTiled={}}for(var y in v.prototype=Object.create(r.prototype),r)v[y]=r[y];v.prototype.newGraphManager=function(){var e=new i(this);return this.graphManager=e,e},v.prototype.newGraph=function(e){return new a(null,this.graphManager,e)},v.prototype.newNode=function(e){return new o(this.graphManager,e)},v.prototype.newEdge=function(e){return new s(null,null,e)},v.prototype.initParameters=function(){r.prototype.initParameters.call(this,arguments),this.isSubLayout||(c.DEFAULT_EDGE_LENGTH<10?this.idealEdgeLength=10:this.idealEdgeLength=c.DEFAULT_EDGE_LENGTH,this.useSmartIdealEdgeLengthCalculation=c.DEFAULT_USE_SMART_IDEAL_EDGE_LENGTH_CALCULATION,this.springConstant=l.DEFAULT_SPRING_STRENGTH,this.repulsionConstant=l.DEFAULT_REPULSION_STRENGTH,this.gravityConstant=l.DEFAULT_GRAVITY_STRENGTH,this.compoundGravityConstant=l.DEFAULT_COMPOUND_GRAVITY_STRENGTH,this.gravityRangeFactor=l.DEFAULT_GRAVITY_RANGE_FACTOR,this.compoundGravityRangeFactor=l.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR,this.prunedNodesAll=[],this.growTreeIterations=0,this.afterGrowthIterations=0,this.isTreeGrowing=!1,this.isGrowthFinished=!1,this.coolingCycle=0,this.maxCoolingCycle=this.maxIterations/l.CONVERGENCE_CHECK_PERIOD,this.finalTemperature=l.CONVERGENCE_CHECK_PERIOD/this.maxIterations,this.coolingAdjuster=1)},v.prototype.layout=function(){return u.DEFAULT_CREATE_BENDS_AS_NEEDED&&(this.createBendpoints(),this.graphManager.resetAllEdges()),this.level=0,this.classicLayout()},v.prototype.classicLayout=function(){if(this.nodesWithGravity=this.calculateNodesToApplyGravitationTo(),this.graphManager.setAllNodesToApplyGravitation(this.nodesWithGravity),this.calcNoOfChildrenForAllNodes(),this.graphManager.calcLowestCommonAncestors(),this.graphManager.calcInclusionTreeDepths(),this.graphManager.getRoot().calcEstimatedSize(),this.calcIdealEdgeLengths(),!this.incremental){var e=this.getFlatForest();if(e.length>0)this.positionNodesRadially(e);else{this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n),this.positionNodesRandomly()}}else if(c.TREE_REDUCTION_ON_INCREMENTAL){this.reduceTrees(),this.graphManager.resetAllNodesToApplyGravitation();var t=new Set(this.getAllNodes()),n=this.nodesWithGravity.filter(function(e){return t.has(e)});this.graphManager.setAllNodesToApplyGravitation(n)}return this.initSpringEmbedder(),this.runSpringEmbedder(),!0},v.prototype.tick=function(){if(this.totalIterations++,this.totalIterations===this.maxIterations&&!this.isTreeGrowing&&!this.isGrowthFinished)if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;if(this.totalIterations%l.CONVERGENCE_CHECK_PERIOD==0&&!this.isTreeGrowing&&!this.isGrowthFinished){if(this.isConverged())if(this.prunedNodesAll.length>0)this.isTreeGrowing=!0;else return!0;this.coolingCycle++,this.layoutQuality==0?this.coolingAdjuster=this.coolingCycle:this.layoutQuality==1&&(this.coolingAdjuster=this.coolingCycle/3),this.coolingFactor=Math.max(this.initialCoolingFactor-this.coolingCycle**+(Math.log(100*(this.initialCoolingFactor-this.finalTemperature))/Math.log(this.maxCoolingCycle))/100*this.coolingAdjuster,this.finalTemperature),this.animationPeriod=Math.ceil(this.initialAnimationPeriod*Math.sqrt(this.coolingFactor))}if(this.isTreeGrowing){if(this.growTreeIterations%10==0)if(this.prunedNodesAll.length>0){this.graphManager.updateBounds(),this.updateGrid(),this.growTree(this.prunedNodesAll),this.graphManager.resetAllNodesToApplyGravitation();var e=new Set(this.getAllNodes()),t=this.nodesWithGravity.filter(function(t){return e.has(t)});this.graphManager.setAllNodesToApplyGravitation(t),this.graphManager.updateBounds(),this.updateGrid(),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL}else this.isTreeGrowing=!1,this.isGrowthFinished=!0;this.growTreeIterations++}if(this.isGrowthFinished){if(this.isConverged())return!0;this.afterGrowthIterations%10==0&&(this.graphManager.updateBounds(),this.updateGrid()),this.coolingFactor=l.DEFAULT_COOLING_FACTOR_INCREMENTAL*((100-this.afterGrowthIterations)/100),this.afterGrowthIterations++}var n=!this.isTreeGrowing&&!this.isGrowthFinished,r=this.growTreeIterations%10==1&&this.isTreeGrowing||this.afterGrowthIterations%10==1&&this.isGrowthFinished;return this.totalDisplacement=0,this.graphManager.updateBounds(),this.calcSpringForces(),this.calcRepulsionForces(n,r),this.calcGravitationalForces(),this.moveNodes(),this.animate(),!1},v.prototype.getPositionsData=function(){for(var e=this.graphManager.getAllNodes(),t={},n=0;n<e.length;n++){var r=e[n].rect,i=e[n].id;t[i]={id:i,x:r.getCenterX(),y:r.getCenterY(),w:r.width,h:r.height}}return t},v.prototype.runSpringEmbedder=function(){this.initialAnimationPeriod=25,this.animationPeriod=this.initialAnimationPeriod;var e=!1;if(l.ANIMATE===`during`)this.emit(`layoutstarted`);else{for(;!e;)e=this.tick();this.graphManager.updateBounds()}},v.prototype.calculateNodesToApplyGravitationTo=function(){var e=[],t,n=this.graphManager.getGraphs(),r=n.length,i;for(i=0;i<r;i++)t=n[i],t.updateConnected(),t.isConnected||(e=e.concat(t.getNodes()));return e},v.prototype.createBendpoints=function(){var e=[];e=e.concat(this.graphManager.getAllEdges());var t=new Set,n;for(n=0;n<e.length;n++){var r=e[n];if(!t.has(r)){var i=r.getSource(),a=r.getTarget();if(i==a)r.getBendpoints().push(new f),r.getBendpoints().push(new f),this.createDummyNodesForBendpoints(r),t.add(r);else{var o=[];if(o=o.concat(i.getEdgeListToNode(a)),o=o.concat(a.getEdgeListToNode(i)),!t.has(o[0])){if(o.length>1){var s;for(s=0;s<o.length;s++){var c=o[s];c.getBendpoints().push(new f),this.createDummyNodesForBendpoints(c)}}o.forEach(function(e){t.add(e)})}}}if(t.size==e.length)break}},v.prototype.positionNodesRadially=function(e){for(var t=new d(0,0),n=Math.ceil(Math.sqrt(e.length)),r=0,i=0,a=0,o=new f(0,0),s=0;s<e.length;s++){s%n==0&&(a=0,i=r,s!=0&&(i+=c.DEFAULT_COMPONENT_SEPERATION),r=0);var l=e[s],m=p.findCenterOfTree(l);t.x=a,t.y=i,o=v.radialLayout(l,m,t),o.y>r&&(r=Math.floor(o.y)),a=Math.floor(o.x+c.DEFAULT_COMPONENT_SEPERATION)}this.transform(new f(u.WORLD_CENTER_X-o.x/2,u.WORLD_CENTER_Y-o.y/2))},v.radialLayout=function(e,t,n){var r=Math.max(this.maxDiagonalInTree(e),c.DEFAULT_RADIAL_SEPARATION);v.branchRadialLayout(t,null,0,359,0,r);var i=g.calculateBounds(e),a=new _;a.setDeviceOrgX(i.getMinX()),a.setDeviceOrgY(i.getMinY()),a.setWorldOrgX(n.x),a.setWorldOrgY(n.y);for(var o=0;o<e.length;o++)e[o].transform(a);var s=new f(i.getMaxX(),i.getMaxY());return a.inverseTransformPoint(s)},v.branchRadialLayout=function(e,t,n,r,i,a){var o=(r-n+1)/2;o<0&&(o+=180);var s=(o+n)%360*h.TWO_PI/360,c=i*Math.cos(s),l=i*Math.sin(s);e.setCenter(c,l);var u=[];u=u.concat(e.getEdges());var d=u.length;t!=null&&d--;for(var f=0,p=u.length,m,g=e.getEdgesBetween(t);g.length>1;){var _=g[0];g.splice(0,1);var y=u.indexOf(_);y>=0&&u.splice(y,1),p--,d--}m=t==null?0:(u.indexOf(g[0])+1)%p;for(var b=Math.abs(r-n)/d,x=m;f!=d;x=++x%p){var S=u[x].getOtherEnd(e);if(S!=t){var C=(n+f*b)%360,w=(C+b)%360;v.branchRadialLayout(S,e,C,w,i+a,a),f++}}},v.maxDiagonalInTree=function(e){for(var t=m.MIN_VALUE,n=0;n<e.length;n++){var r=e[n].getDiagonal();r>t&&(t=r)}return t},v.prototype.calcRepulsionRange=function(){return 2*(this.level+1)*this.idealEdgeLength},v.prototype.groupZeroDegreeMembers=function(){var e=this,t={};this.memberGroups={},this.idToDummyNode={};for(var n=[],r=this.graphManager.getAllNodes(),i=0;i<r.length;i++){var a=r[i],s=a.getParent();this.getNodeDegreeWithChildren(a)===0&&(s.id==null||!this.getToBeTiled(s))&&n.push(a)}for(var i=0;i<n.length;i++){var a=n[i],c=a.getParent().id;t[c]===void 0&&(t[c]=[]),t[c]=t[c].concat(a)}Object.keys(t).forEach(function(n){if(t[n].length>1){var r=`DummyCompound_`+n;e.memberGroups[r]=t[n];var i=t[n][0].getParent(),a=new o(e.graphManager);a.id=r,a.paddingLeft=i.paddingLeft||0,a.paddingRight=i.paddingRight||0,a.paddingBottom=i.paddingBottom||0,a.paddingTop=i.paddingTop||0,e.idToDummyNode[r]=a;var s=e.getGraphManager().add(e.newGraph(),a),c=i.getChild();c.add(a);for(var l=0;l<t[n].length;l++){var u=t[n][l];c.remove(u),s.add(u)}}})},v.prototype.clearCompounds=function(){var e={},t={};this.performDFSOnCompounds();for(var n=0;n<this.compoundOrder.length;n++)t[this.compoundOrder[n].id]=this.compoundOrder[n],e[this.compoundOrder[n].id]=[].concat(this.compoundOrder[n].getChild().getNodes()),this.graphManager.remove(this.compoundOrder[n].getChild()),this.compoundOrder[n].child=null;this.graphManager.resetAllNodes(),this.tileCompoundMembers(e,t)},v.prototype.clearZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack=[];Object.keys(this.memberGroups).forEach(function(n){var r=e.idToDummyNode[n];t[n]=e.tileNodes(e.memberGroups[n],r.paddingLeft+r.paddingRight),r.rect.width=t[n].width,r.rect.height=t[n].height})},v.prototype.repopulateCompounds=function(){for(var e=this.compoundOrder.length-1;e>=0;e--){var t=this.compoundOrder[e],n=t.id,r=t.paddingLeft,i=t.paddingTop;this.adjustLocations(this.tiledMemberPack[n],t.rect.x,t.rect.y,r,i)}},v.prototype.repopulateZeroDegreeMembers=function(){var e=this,t=this.tiledZeroDegreePack;Object.keys(t).forEach(function(n){var r=e.idToDummyNode[n],i=r.paddingLeft,a=r.paddingTop;e.adjustLocations(t[n],r.rect.x,r.rect.y,i,a)})},v.prototype.getToBeTiled=function(e){var t=e.id;if(this.toBeTiled[t]!=null)return this.toBeTiled[t];var n=e.getChild();if(n==null)return this.toBeTiled[t]=!1,!1;for(var r=n.getNodes(),i=0;i<r.length;i++){var a=r[i];if(this.getNodeDegree(a)>0)return this.toBeTiled[t]=!1,!1;if(a.getChild()==null){this.toBeTiled[a.id]=!1;continue}if(!this.getToBeTiled(a))return this.toBeTiled[t]=!1,!1}return this.toBeTiled[t]=!0,!0},v.prototype.getNodeDegree=function(e){e.id;for(var t=e.getEdges(),n=0,r=0;r<t.length;r++){var i=t[r];i.getSource().id!==i.getTarget().id&&(n+=1)}return n},v.prototype.getNodeDegreeWithChildren=function(e){var t=this.getNodeDegree(e);if(e.getChild()==null)return t;for(var n=e.getChild().getNodes(),r=0;r<n.length;r++){var i=n[r];t+=this.getNodeDegreeWithChildren(i)}return t},v.prototype.performDFSOnCompounds=function(){this.compoundOrder=[],this.fillCompexOrderByDFS(this.graphManager.getRoot().getNodes())},v.prototype.fillCompexOrderByDFS=function(e){for(var t=0;t<e.length;t++){var n=e[t];n.getChild()!=null&&this.fillCompexOrderByDFS(n.getChild().getNodes()),this.getToBeTiled(n)&&this.compoundOrder.push(n)}},v.prototype.adjustLocations=function(e,t,n,r,i){t+=r,n+=i;for(var a=t,o=0;o<e.rows.length;o++){var s=e.rows[o];t=a;for(var c=0,l=0;l<s.length;l++){var u=s[l];u.rect.x=t,u.rect.y=n,t+=u.rect.width+e.horizontalPadding,u.rect.height>c&&(c=u.rect.height)}n+=c+e.verticalPadding}},v.prototype.tileCompoundMembers=function(e,t){var n=this;this.tiledMemberPack=[],Object.keys(e).forEach(function(r){var i=t[r];n.tiledMemberPack[r]=n.tileNodes(e[r],i.paddingLeft+i.paddingRight),i.rect.width=n.tiledMemberPack[r].width,i.rect.height=n.tiledMemberPack[r].height})},v.prototype.tileNodes=function(e,t){var n={rows:[],rowWidth:[],rowHeight:[],width:0,height:t,verticalPadding:c.TILING_PADDING_VERTICAL,horizontalPadding:c.TILING_PADDING_HORIZONTAL};e.sort(function(e,t){return e.rect.width*e.rect.height>t.rect.width*t.rect.height?-1:+(e.rect.width*e.rect.height<t.rect.width*t.rect.height)});for(var r=0;r<e.length;r++){var i=e[r];n.rows.length==0?this.insertNodeToRow(n,i,0,t):this.canAddHorizontal(n,i.rect.width,i.rect.height)?this.insertNodeToRow(n,i,this.getShortestRowIndex(n),t):this.insertNodeToRow(n,i,n.rows.length,t),this.shiftToLastRow(n)}return n},v.prototype.insertNodeToRow=function(e,t,n,r){var i=r;n==e.rows.length&&(e.rows.push([]),e.rowWidth.push(i),e.rowHeight.push(0));var a=e.rowWidth[n]+t.rect.width;e.rows[n].length>0&&(a+=e.horizontalPadding),e.rowWidth[n]=a,e.width<a&&(e.width=a);var o=t.rect.height;n>0&&(o+=e.verticalPadding);var s=0;o>e.rowHeight[n]&&(s=e.rowHeight[n],e.rowHeight[n]=o,s=e.rowHeight[n]-s),e.height+=s,e.rows[n].push(t)},v.prototype.getShortestRowIndex=function(e){for(var t=-1,n=Number.MAX_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]<n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.getLongestRowIndex=function(e){for(var t=-1,n=Number.MIN_VALUE,r=0;r<e.rows.length;r++)e.rowWidth[r]>n&&(t=r,n=e.rowWidth[r]);return t},v.prototype.canAddHorizontal=function(e,t,n){var r=this.getShortestRowIndex(e);if(r<0)return!0;var i=e.rowWidth[r];if(i+e.horizontalPadding+t<=e.width)return!0;var a=0;e.rowHeight[r]<n&&r>0&&(a=n+e.verticalPadding-e.rowHeight[r]);var o=e.width-i>=t+e.horizontalPadding?(e.height+a)/(i+t+e.horizontalPadding):(e.height+a)/e.width;a=n+e.verticalPadding;var s=e.width<t?(e.height+a)/t:(e.height+a)/e.width;return s<1&&(s=1/s),o<1&&(o=1/o),o<s},v.prototype.shiftToLastRow=function(e){var t=this.getLongestRowIndex(e),n=e.rowWidth.length-1,r=e.rows[t],i=r[r.length-1],a=i.width+e.horizontalPadding;if(e.width-e.rowWidth[n]>a&&t!=n){r.splice(-1,1),e.rows[n].push(i),e.rowWidth[t]=e.rowWidth[t]-a,e.rowWidth[n]=e.rowWidth[n]+a,e.width=e.rowWidth[instance.getLongestRowIndex(e)];for(var o=Number.MIN_VALUE,s=0;s<r.length;s++)r[s].height>o&&(o=r[s].height);t>0&&(o+=e.verticalPadding);var c=e.rowHeight[t]+e.rowHeight[n];e.rowHeight[t]=o,e.rowHeight[n]<i.height+e.verticalPadding&&(e.rowHeight[n]=i.height+e.verticalPadding);var l=e.rowHeight[t]+e.rowHeight[n];e.height+=l-c,this.shiftToLastRow(e)}},v.prototype.tilingPreLayout=function(){c.TILE&&(this.groupZeroDegreeMembers(),this.clearCompounds(),this.clearZeroDegreeMembers())},v.prototype.tilingPostLayout=function(){c.TILE&&(this.repopulateZeroDegreeMembers(),this.repopulateCompounds())},v.prototype.reduceTrees=function(){for(var e=[],t=!0,n;t;){var r=this.graphManager.getAllNodes(),i=[];t=!1;for(var a=0;a<r.length;a++)n=r[a],n.getEdges().length==1&&!n.getEdges()[0].isInterGraph&&n.getChild()==null&&(i.push([n,n.getEdges()[0],n.getOwner()]),t=!0);if(t==1){for(var o=[],s=0;s<i.length;s++)i[s][0].getEdges().length==1&&(o.push(i[s]),i[s][0].getOwner().remove(i[s][0]));e.push(o),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()}}this.prunedNodesAll=e},v.prototype.growTree=function(e){for(var t=e[e.length-1],n,r=0;r<t.length;r++)n=t[r],this.findPlaceforPrunedNode(n),n[2].add(n[0]),n[2].add(n[1],n[1].source,n[1].target);e.splice(e.length-1,1),this.graphManager.resetAllNodes(),this.graphManager.resetAllEdges()},v.prototype.findPlaceforPrunedNode=function(e){var t,n,r=e[0];n=r==e[1].source?e[1].target:e[1].source;var i=n.startX,a=n.finishX,o=n.startY,s=n.finishY,c=[0,0,0,0];if(o>0)for(var u=i;u<=a;u++)c[0]+=this.grid[u][o-1].length+this.grid[u][o].length-1;if(a<this.grid.length-1)for(var u=o;u<=s;u++)c[1]+=this.grid[a+1][u].length+this.grid[a][u].length-1;if(s<this.grid[0].length-1)for(var u=i;u<=a;u++)c[2]+=this.grid[u][s+1].length+this.grid[u][s].length-1;if(i>0)for(var u=o;u<=s;u++)c[3]+=this.grid[i-1][u].length+this.grid[i][u].length-1;for(var d=m.MAX_VALUE,f,p,h=0;h<c.length;h++)c[h]<d?(d=c[h],f=1,p=h):c[h]==d&&f++;if(f==3&&d==0)c[0]==0&&c[1]==0&&c[2]==0?t=1:c[0]==0&&c[1]==0&&c[3]==0?t=0:c[0]==0&&c[2]==0&&c[3]==0?t=3:c[1]==0&&c[2]==0&&c[3]==0&&(t=2);else if(f==2&&d==0){var g=Math.floor(Math.random()*2);t=c[0]==0&&c[1]==0?g==0?0:1:c[0]==0&&c[2]==0?g==0?0:2:c[0]==0&&c[3]==0?g==0?0:3:c[1]==0&&c[2]==0?g==0?1:2:c[1]==0&&c[3]==0?g==0?1:3:g==0?2:3}else if(f==4&&d==0){var g=Math.floor(Math.random()*4);t=g}else t=p;t==0?r.setCenter(n.getCenterX(),n.getCenterY()-n.getHeight()/2-l.DEFAULT_EDGE_LENGTH-r.getHeight()/2):t==1?r.setCenter(n.getCenterX()+n.getWidth()/2+l.DEFAULT_EDGE_LENGTH+r.getWidth()/2,n.getCenterY()):t==2?r.setCenter(n.getCenterX(),n.getCenterY()+n.getHeight()/2+l.DEFAULT_EDGE_LENGTH+r.getHeight()/2):r.setCenter(n.getCenterX()-n.getWidth()/2-l.DEFAULT_EDGE_LENGTH-r.getWidth()/2,n.getCenterY())},e.exports=v}),(function(e,t,n){var r={};r.layoutBase=n(0),r.CoSEConstants=n(1),r.CoSEEdge=n(2),r.CoSEGraph=n(3),r.CoSEGraphManager=n(4),r.CoSELayout=n(6),r.CoSENode=n(5),e.exports=r})])})})),c=t(e(((e,t)=>{(function(n,r){typeof e==`object`&&typeof t==`object`?t.exports=r(s()):typeof define==`function`&&define.amd?define([`cose-base`],r):typeof e==`object`?e.cytoscapeCoseBilkent=r(s()):n.cytoscapeCoseBilkent=r(n.coseBase)})(e,function(e){return(function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.i=function(e){return e},n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,`a`,t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p=``,n(n.s=1)})([(function(t,n){t.exports=e}),(function(e,t,n){var r=n(0).layoutBase.LayoutConstants,i=n(0).layoutBase.FDLayoutConstants,a=n(0).CoSEConstants,o=n(0).CoSELayout,s=n(0).CoSENode,c=n(0).layoutBase.PointD,l=n(0).layoutBase.DimensionD,u={ready:function(){},stop:function(){},quality:`default`,nodeDimensionsIncludeLabels:!1,refresh:30,fit:!0,padding:10,randomize:!0,nodeRepulsion:4500,idealEdgeLength:50,edgeElasticity:.45,nestingFactor:.1,gravity:.25,numIter:2500,tile:!0,animate:`end`,animationDuration:500,tilingPaddingVertical:10,tilingPaddingHorizontal:10,gravityRangeCompound:1.5,gravityCompound:1,gravityRange:3.8,initialEnergyOnIncremental:.5};function d(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n}function f(e){this.options=d(u,e),p(this.options)}var p=function(e){e.nodeRepulsion!=null&&(a.DEFAULT_REPULSION_STRENGTH=i.DEFAULT_REPULSION_STRENGTH=e.nodeRepulsion),e.idealEdgeLength!=null&&(a.DEFAULT_EDGE_LENGTH=i.DEFAULT_EDGE_LENGTH=e.idealEdgeLength),e.edgeElasticity!=null&&(a.DEFAULT_SPRING_STRENGTH=i.DEFAULT_SPRING_STRENGTH=e.edgeElasticity),e.nestingFactor!=null&&(a.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=i.PER_LEVEL_IDEAL_EDGE_LENGTH_FACTOR=e.nestingFactor),e.gravity!=null&&(a.DEFAULT_GRAVITY_STRENGTH=i.DEFAULT_GRAVITY_STRENGTH=e.gravity),e.numIter!=null&&(a.MAX_ITERATIONS=i.MAX_ITERATIONS=e.numIter),e.gravityRange!=null&&(a.DEFAULT_GRAVITY_RANGE_FACTOR=i.DEFAULT_GRAVITY_RANGE_FACTOR=e.gravityRange),e.gravityCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_STRENGTH=i.DEFAULT_COMPOUND_GRAVITY_STRENGTH=e.gravityCompound),e.gravityRangeCompound!=null&&(a.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=i.DEFAULT_COMPOUND_GRAVITY_RANGE_FACTOR=e.gravityRangeCompound),e.initialEnergyOnIncremental!=null&&(a.DEFAULT_COOLING_FACTOR_INCREMENTAL=i.DEFAULT_COOLING_FACTOR_INCREMENTAL=e.initialEnergyOnIncremental),e.quality==`draft`?r.QUALITY=0:e.quality==`proof`?r.QUALITY=2:r.QUALITY=1,a.NODE_DIMENSIONS_INCLUDE_LABELS=i.NODE_DIMENSIONS_INCLUDE_LABELS=r.NODE_DIMENSIONS_INCLUDE_LABELS=e.nodeDimensionsIncludeLabels,a.DEFAULT_INCREMENTAL=i.DEFAULT_INCREMENTAL=r.DEFAULT_INCREMENTAL=!e.randomize,a.ANIMATE=i.ANIMATE=r.ANIMATE=e.animate,a.TILE=e.tile,a.TILING_PADDING_VERTICAL=typeof e.tilingPaddingVertical==`function`?e.tilingPaddingVertical.call():e.tilingPaddingVertical,a.TILING_PADDING_HORIZONTAL=typeof e.tilingPaddingHorizontal==`function`?e.tilingPaddingHorizontal.call():e.tilingPaddingHorizontal};f.prototype.run=function(){var e,t,n=this.options;this.idToLNode={};var r=this.layout=new o,i=this;i.stopped=!1,this.cy=this.options.cy,this.cy.trigger({type:`layoutstart`,layout:this});var a=r.newGraphManager();this.gm=a;var s=this.options.eles.nodes(),c=this.options.eles.edges();this.root=a.addRoot(),this.processChildrenList(this.root,this.getTopMostNodes(s),r);for(var l=0;l<c.length;l++){var u=c[l],d=this.idToLNode[u.data(`source`)],f=this.idToLNode[u.data(`target`)];if(d!==f&&d.getEdgesBetween(f).length==0){var p=a.add(r.newEdge(),d,f);p.id=u.id()}}var m=function(e,t){typeof e==`number`&&(e=t);var n=e.data(`id`),r=i.idToLNode[n];return{x:r.getRect().getCenterX(),y:r.getRect().getCenterY()}},h=function a(){for(var o=function(){n.fit&&n.cy.fit(n.eles,n.padding),e||(e=!0,i.cy.one(`layoutready`,n.ready),i.cy.trigger({type:`layoutready`,layout:i}))},s=i.options.refresh,c,l=0;l<s&&!c;l++)c=i.stopped||i.layout.tick();if(c){r.checkLayoutSuccess()&&!r.isSubLayout&&r.doPostLayout(),r.tilingPostLayout&&r.tilingPostLayout(),r.isLayoutFinished=!0,i.options.eles.nodes().positions(m),o(),i.cy.one(`layoutstop`,i.options.stop),i.cy.trigger({type:`layoutstop`,layout:i}),t&&cancelAnimationFrame(t),e=!1;return}var u=i.layout.getPositionsData();n.eles.nodes().positions(function(e,t){if(typeof e==`number`&&(e=t),!e.isParent()){for(var n=e.id(),r=u[n],i=e;r==null&&(r=u[i.data(`parent`)]||u[`DummyCompound_`+i.data(`parent`)],u[n]=r,i=i.parent()[0],i!=null););return r==null?{x:e.position(`x`),y:e.position(`y`)}:{x:r.x,y:r.y}}}),o(),t=requestAnimationFrame(a)};return r.addListener(`layoutstarted`,function(){i.options.animate===`during`&&(t=requestAnimationFrame(h))}),r.runLayout(),this.options.animate!==`during`&&(i.options.eles.nodes().not(`:parent`).layoutPositions(i,i.options,m),e=!1),this},f.prototype.getTopMostNodes=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].id()]=!0;return e.filter(function(e,n){typeof e==`number`&&(e=n);for(var r=e.parent()[0];r!=null;){if(t[r.id()])return!1;r=r.parent()[0]}return!0})},f.prototype.processChildrenList=function(e,t,n){for(var r=t.length,i=0;i<r;i++){var a=t[i],o=a.children(),u,d=a.layoutDimensions({nodeDimensionsIncludeLabels:this.options.nodeDimensionsIncludeLabels});if(u=a.outerWidth()!=null&&a.outerHeight()!=null?e.add(new s(n.graphManager,new c(a.position(`x`)-d.w/2,a.position(`y`)-d.h/2),new l(parseFloat(d.w),parseFloat(d.h)))):e.add(new s(this.graphManager)),u.id=a.data(`id`),u.paddingLeft=parseInt(a.css(`padding`)),u.paddingTop=parseInt(a.css(`padding`)),u.paddingRight=parseInt(a.css(`padding`)),u.paddingBottom=parseInt(a.css(`padding`)),this.options.nodeDimensionsIncludeLabels&&a.isParent()){var f=a.boundingBox({includeLabels:!0,includeNodes:!1}).w,p=a.boundingBox({includeLabels:!0,includeNodes:!1}).h,m=a.css(`text-halign`);u.labelWidth=f,u.labelHeight=p,u.labelPos=m}if(this.idToLNode[a.data(`id`)]=u,isNaN(u.rect.x)&&(u.rect.x=0),isNaN(u.rect.y)&&(u.rect.y=0),o!=null&&o.length>0){var h=n.getGraphManager().add(n.newGraph(),u);this.processChildrenList(h,o,n)}}},f.prototype.stop=function(){return this.stopped=!0,this};var m=function(e){e(`layout`,`cose-bilkent`,f)};typeof cytoscape<`u`&&m(cytoscape),e.exports=m})])})}))(),1);a.use(c.default);function l(e,t){e.forEach(e=>{let n={id:e.id,labelText:e.label,height:e.height,width:e.width,padding:e.padding??0};Object.keys(e).forEach(t=>{[`id`,`label`,`height`,`width`,`padding`,`x`,`y`].includes(t)||(n[t]=e[t])}),t.add({group:`nodes`,data:n,position:{x:e.x??0,y:e.y??0}})})}n(l,`addNodes`);function u(e,t){e.forEach(e=>{let n={id:e.id,source:e.start,target:e.end};Object.keys(e).forEach(t=>{[`id`,`start`,`end`].includes(t)||(n[t]=e[t])}),t.add({group:`edges`,data:n})})}n(u,`addEdges`);function d(e){return new Promise(t=>{let n=i(`body`).append(`div`).attr(`id`,`cy`).attr(`style`,`display:none`),o=a({container:document.getElementById(`cy`),style:[{selector:`edge`,style:{"curve-style":`bezier`}}]});n.remove(),l(e.nodes,o),u(e.edges,o),o.nodes().forEach(function(e){e.layoutDimensions=()=>{let t=e.data();return{w:t.width,h:t.height}}}),o.layout({name:`cose-bilkent`,quality:`proof`,styleEnabled:!1,animate:!1}).run(),o.ready(e=>{r.info(`Cytoscape ready`,e),t(o)})})}n(d,`createCytoscapeInstance`);function f(e){return e.nodes().map(e=>{let t=e.data(),n=e.position(),r={id:t.id,x:n.x,y:n.y};return Object.keys(t).forEach(e=>{e!==`id`&&(r[e]=t[e])}),r})}n(f,`extractPositionedNodes`);function p(e){return e.edges().map(e=>{let t=e.data(),n=e._private.rscratch,r={id:t.id,source:t.source,target:t.target,startX:n.startX,startY:n.startY,midX:n.midX,midY:n.midY,endX:n.endX,endY:n.endY};return Object.keys(t).forEach(e=>{[`id`,`source`,`target`].includes(e)||(r[e]=t[e])}),r})}n(p,`extractPositionedEdges`);async function m(e,t){r.debug(`Starting cose-bilkent layout algorithm`);try{h(e);let t=await d(e),n=f(t),i=p(t);return r.debug(`Layout completed: ${n.length} nodes, ${i.length} edges`),{nodes:n,edges:i}}catch(e){throw r.error(`Error in cose-bilkent layout algorithm:`,e),e}}n(m,`executeCoseBilkentLayout`);function h(e){if(!e)throw Error(`Layout data is required`);if(!e.config)throw Error(`Configuration is required in layout data`);if(!e.rootNode)throw Error(`Root node is required`);if(!e.nodes||!Array.isArray(e.nodes))throw Error(`No nodes found in layout data`);if(!Array.isArray(e.edges))throw Error(`Edges array is required in layout data`);return!0}n(h,`validateLayoutData`);var g=n(async(e,t,{insertCluster:n,insertEdge:r,insertEdgeLabel:i,insertMarkers:a,insertNode:o,log:s,positionEdgeLabel:c},{algorithm:l})=>{let u={},d={},f=t.select(`g`);a(f,e.markers,e.type,e.diagramId);let p=f.insert(`g`).attr(`class`,`subgraphs`),h=f.insert(`g`).attr(`class`,`edgePaths`),g=f.insert(`g`).attr(`class`,`edgeLabels`),_=f.insert(`g`).attr(`class`,`nodes`);s.debug(`Inserting nodes into DOM for dimension calculation`),await Promise.all(e.nodes.map(async t=>{if(t.isGroup){let e={...t};d[t.id]=e,u[t.id]=e,await n(p,t)}else{let n={...t};u[t.id]=n;let r=await o(_,t,{config:e.config,dir:e.direction||`TB`}),i=r.node().getBBox();n.width=i.width,n.height=i.height,n.domId=r,s.debug(`Node ${t.id} dimensions: ${i.width}x${i.height}`)}})),s.debug(`Running cose-bilkent layout algorithm`);let v=await m({...e,nodes:e.nodes.map(e=>{let t=u[e.id];return{...e,width:t.width,height:t.height}})},e.config);s.debug(`Positioning nodes based on layout results`),v.nodes.forEach(e=>{let t=u[e.id];t?.domId&&(t.domId.attr(`transform`,`translate(${e.x}, ${e.y})`),t.x=e.x,t.y=e.y,s.debug(`Positioned node ${t.id} at center (${e.x}, ${e.y})`))}),v.edges.forEach(t=>{let n=e.edges.find(e=>e.id===t.id);n&&(n.points=[{x:t.startX,y:t.startY},{x:t.midX,y:t.midY},{x:t.endX,y:t.endY}])}),s.debug(`Inserting and positioning edges`),await Promise.all(e.edges.map(async t=>{await i(g,t);let n=u[t.start??``],a=u[t.end??``];if(n&&a){let i=v.edges.find(e=>e.id===t.id);if(i){s.debug(`APA01 positionedEdge`,i);let o={...t};c(o,r(h,o,d,e.type,n,a,e.diagramId))}else{let i={...t,points:[{x:n.x||0,y:n.y||0},{x:a.x||0,y:a.y||0}]};c(i,r(h,i,d,e.type,n,a,e.diagramId))}}})),s.debug(`Cose-bilkent rendering completed`)},`render`);export{g as render};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
function e(r,i,a=0,o=r.length-1,s=n){for(;o>a;){if(o-a>600){let t=o-a+1,n=i-a+1,c=Math.log(t),l=.5*Math.exp(2*c/3),u=.5*Math.sqrt(c*l*(t-l)/t)*(n-t/2<0?-1:1);e(r,i,Math.max(a,Math.floor(i-n*l/t+u)),Math.min(o,Math.floor(i+(t-n)*l/t+u)),s)}let n=r[i],c=a,l=o;for(t(r,a,i),s(r[o],n)>0&&t(r,a,o);c<l;){for(t(r,c,l),c++,l--;s(r[c],n)<0;)c++;for(;s(r[l],n)>0;)l--}s(r[a],n)===0?t(r,a,l):(l++,t(r,l,o)),l<=i&&(a=l+1),i<=l&&(o=l-1)}}function t(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function n(e,t){return e<t?-1:+(e>t)}var r=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!h(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;h(e,s)&&(t.leaf?n.push(o):m(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!h(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(h(e,a)){if(t.leaf||m(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=g([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),a=[],o=[],s,c,l;for(;n||a.length;){if(n||(n=a.pop(),c=a[a.length-1],s=o.pop(),l=!0),n.leaf){let r=i(e,n.children,t);if(r!==-1)return n.children.splice(r,1),a.push(n),this._condense(a),this}!l&&!n.leaf&&m(n,r)?(a.push(n),o.push(s),s=0,c=n,n=n.children[0]):c?(s++,n=c.children[s],l=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,o=this._maxEntries,s;if(i<=o)return s=g(e.slice(t,n+1)),a(s,this.toBBox),s;r||(r=Math.ceil(Math.log(i)/Math.log(o)),o=Math.ceil(i/o**(r-1))),s=g([]),s.leaf=!1,s.height=r;let c=Math.ceil(i/o),l=c*Math.ceil(Math.sqrt(o));_(e,t,n,l,this.compareMinX);for(let i=t;i<=n;i+=l){let t=Math.min(i+l-1,n);_(e,i,t,c,this.compareMinY);for(let n=i;n<=t;n+=c){let i=Math.min(n+c-1,t);s.children.push(this._build(e,n,i,r-1))}}return a(s,this.toBBox),s}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=u(o),c=f(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),s(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let o=this._chooseSplitIndex(n,i,r),s=g(n.children.splice(o,n.children.length-o));s.height=n.height,s.leaf=n.leaf,a(n,this.toBBox),a(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(n,s)}_splitRoot(e,t){this.data=g([e,t]),this.data.height=e.height+1,this.data.leaf=!1,a(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let s=t;s<=n-t;s++){let t=o(e,0,s,this.toBBox),c=o(e,s,n,this.toBBox),l=p(t,c),d=u(t)+u(c);l<i?(i=l,r=s,a=d<a?d:a):l===i&&d<a&&(a=d,r=s)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:c,i=e.leaf?this.compareMinY:l;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=o(e,0,t,i),c=o(e,n-t,n,i),l=d(a)+d(c);for(let r=t;r<n-t;r++){let t=e.children[r];s(a,e.leaf?i(t):t),l+=d(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];s(c,e.leaf?i(t):t),l+=d(c)}return l}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)s(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():a(e[t],this.toBBox)}};function i(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function a(e,t){o(e,0,e.children.length,t,e)}function o(e,t,n,r,i){i||=g(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];s(i,e.leaf?r(t):t)}return i}function s(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function c(e,t){return e.minX-t.minX}function l(e,t){return e.minY-t.minY}function u(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function d(e){return e.maxX-e.minX+(e.maxY-e.minY)}function f(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function p(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function m(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function h(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function g(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function _(t,n,r,i,a){let o=[n,r];for(;o.length;){if(r=o.pop(),n=o.pop(),r-n<=i)continue;let s=n+Math.ceil((r-n)/i/2)*i;e(t,s,n,r,a),o.push(n,s,s,r)}}function v(e){let t=e.replace(/\r\n?/g,`
|
|
2
|
-
`),n=[],r=t.length,i=0;for(;i<r;){for(;i<r&&t.charCodeAt(i)===10;)i++;if(i>=r)break;let e=t.indexOf(`
|
|
3
|
-
`,i);e===-1&&(e=r);let a=t.substring(i,e).trim();i=e+1;let o=parseInt(a,10);if(isNaN(o)){i<r&&(e=t.indexOf(`
|
|
4
|
-
`,i),e===-1&&(e=r),i=e+1);continue}if(i>=r)break;e=t.indexOf(`
|
|
5
|
-
`,i),e===-1&&(e=r);let s=t.substring(i,e).replace(/\s+$/,``);i=e+1,n.push({code:o,value:s})}return n}function y(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDSEC`)return t+1;if(r.code===9){let i=r.value;switch(t++,i){case`$ACADVER`:t<e.length&&(n.acadVersion=e[t].value,t++);break;case`$EXTMIN`:if(t<e.length){let r=b(e,t);n.extMin=r.point,t=r.nextIndex}break;case`$EXTMAX`:if(t<e.length){let r=b(e,t);n.extMax=r.point,t=r.nextIndex}break;case`$INSUNITS`:t<e.length&&(n.insUnits=parseInt(e[t].value,10),t++);break;case`$MEASUREMENT`:t<e.length&&(n.measurement=parseInt(e[t].value,10),t++);break;case`$LTSCALE`:t<e.length&&(n.ltScale=parseFloat(e[t].value),t++);break;case`$DWGCODEPAGE`:t<e.length&&(n.dwgCodePage=e[t].value,t++);break;case`$HANDSEED`:t<e.length&&(n.handleSeed=e[t].value,t++);break;default:for(;t<e.length&&e[t].code!==9&&e[t].code!==0;)n[i]=e[t].value,t++}}else t++}return t}function b(e,t){let n={x:0,y:0,z:0};for(;t<e.length;){let r=e[t].code;if(r===10)n.x=parseFloat(e[t].value),t++;else if(r===20)n.y=parseFloat(e[t].value),t++;else if(r===30)n.z=parseFloat(e[t].value),t++;else break}return{point:n,nextIndex:t}}function ee(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDSEC`)return t+1;if(r.code===0&&r.value===`TABLE`){if(t++,t>=e.length)break;let r=e[t].value;switch(t++,r){case`LAYER`:t=ne(e,t,n.layers);break;case`LTYPE`:t=x(e,t,n.lineTypes);break;case`STYLE`:t=S(e,t,n.styles);break;default:t=te(e,t);break}}else t++}return t}function te(e,t){for(;t<e.length;){if(e[t].code===0&&e[t].value===`ENDTAB`)return t+1;t++}return t}function ne(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDTAB`)return t+1;if(r.code===0&&r.value===`LAYER`){t++;let r={name:`0`,color:7,lineType:`Continuous`,flags:0,lineWeight:-3,isOff:!1,isFrozen:!1,isLocked:!1};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 2:r.name=n.value;break;case 6:r.lineType=n.value;break;case 62:r.color=parseInt(n.value,10);break;case 70:r.flags=parseInt(n.value,10);break;case 370:r.lineWeight=parseInt(n.value,10);break;case 420:r.trueColor=parseInt(n.value,10);break}t++}n.set(r.name,r)}else t++}return t}function x(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDTAB`)return t+1;if(r.code===0&&r.value===`LTYPE`){t++;let r={name:``,description:``,pattern:[],totalLength:0};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 2:r.name=n.value;break;case 3:r.description=n.value;break;case 40:r.totalLength=parseFloat(n.value);break;case 49:r.pattern.push(parseFloat(n.value));break}t++}r.name&&n.set(r.name,r)}else t++}return t}function S(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDTAB`)return t+1;if(r.code===0&&r.value===`STYLE`){t++;let r={name:``,fontName:``,bigFontName:``,height:0,widthFactor:1,obliqueAngle:0};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 2:r.name=n.value;break;case 3:r.fontName=n.value;break;case 4:r.bigFontName=n.value;break;case 40:r.height=parseFloat(n.value);break;case 41:r.widthFactor=parseFloat(n.value);break;case 50:r.obliqueAngle=parseFloat(n.value);break}t++}r.name&&n.set(r.name,r)}else t++}return t}function C(e){let t={type:``,layer:`0`,color:256,lineType:`BYLAYER`,lineTypeScale:1,lineWeight:-1,visible:!0,extrusion:{x:0,y:0,z:1}};for(let n of e)switch(n.code){case 5:t.handle=n.value;break;case 8:t.layer=n.value;break;case 6:t.lineType=n.value;break;case 48:t.lineTypeScale=parseFloat(n.value);break;case 60:t.visible=n.value===`0`||n.value===``;break;case 62:t.color=parseInt(n.value,10);break;case 370:t.lineWeight=parseInt(n.value,10);break;case 420:t.trueColor=parseInt(n.value,10);break;case 210:t.extrusion.x=parseFloat(n.value);break;case 220:t.extrusion.y=parseFloat(n.value);break;case 230:t.extrusion.z=parseFloat(n.value);break}return t}function w(e){let t={...C(e),type:`LINE`,start:{x:0,y:0,z:0},end:{x:0,y:0,z:0}};for(let n of e)switch(n.code){case 10:t.start.x=parseFloat(n.value);break;case 20:t.start.y=parseFloat(n.value);break;case 30:t.start.z=parseFloat(n.value);break;case 11:t.end.x=parseFloat(n.value);break;case 21:t.end.y=parseFloat(n.value);break;case 31:t.end.z=parseFloat(n.value);break}return t}function T(e){let t={...C(e),type:`CIRCLE`,center:{x:0,y:0,z:0},radius:0};for(let n of e)switch(n.code){case 10:t.center.x=parseFloat(n.value);break;case 20:t.center.y=parseFloat(n.value);break;case 30:t.center.z=parseFloat(n.value);break;case 40:t.radius=parseFloat(n.value);break}return t}function E(e){let t={...C(e),type:`ARC`,center:{x:0,y:0,z:0},radius:0,startAngle:0,endAngle:360};for(let n of e)switch(n.code){case 10:t.center.x=parseFloat(n.value);break;case 20:t.center.y=parseFloat(n.value);break;case 30:t.center.z=parseFloat(n.value);break;case 40:t.radius=parseFloat(n.value);break;case 50:t.startAngle=parseFloat(n.value);break;case 51:t.endAngle=parseFloat(n.value);break}return t}function re(e){let t={...C(e),type:`LWPOLYLINE`,vertices:[],closed:!1,constantWidth:0,elevation:0},n=null;for(let r of e)switch(r.code){case 70:t.closed=(parseInt(r.value,10)&1)!=0;break;case 38:t.elevation=parseFloat(r.value);break;case 43:t.constantWidth=parseFloat(r.value);break;case 10:n&&t.vertices.push(n),n={x:parseFloat(r.value),y:0,bulge:0,startWidth:0,endWidth:0};break;case 20:n&&(n.y=parseFloat(r.value));break;case 40:n&&(n.startWidth=parseFloat(r.value));break;case 41:n&&(n.endWidth=parseFloat(r.value));break;case 42:n&&(n.bulge=parseFloat(r.value));break}return n&&t.vertices.push(n),t}function ie(e){let t={...C(e),type:`POLYLINE`,vertices:[],closed:!1,is3d:!1};for(let n of e)switch(n.code){case 70:{let e=parseInt(n.value,10);t.closed=(e&1)!=0,t.is3d=(e&8)!=0;break}}return t}function ae(e){let t={...C(e),type:`ELLIPSE`,center:{x:0,y:0,z:0},majorAxis:{x:1,y:0,z:0},minorRatio:1,startParam:0,endParam:Math.PI*2};for(let n of e)switch(n.code){case 10:t.center.x=parseFloat(n.value);break;case 20:t.center.y=parseFloat(n.value);break;case 30:t.center.z=parseFloat(n.value);break;case 11:t.majorAxis.x=parseFloat(n.value);break;case 21:t.majorAxis.y=parseFloat(n.value);break;case 31:t.majorAxis.z=parseFloat(n.value);break;case 40:t.minorRatio=parseFloat(n.value);break;case 41:t.startParam=parseFloat(n.value);break;case 42:t.endParam=parseFloat(n.value);break}return t}function oe(e){let t={...C(e),type:`SPLINE`,degree:3,flags:0,knots:[],controlPoints:[],fitPoints:[],weights:[]},n=null,r=null;for(let i of e)switch(i.code){case 70:t.flags=parseInt(i.value,10);break;case 71:t.degree=parseInt(i.value,10);break;case 40:t.knots.push(parseFloat(i.value));break;case 41:t.weights.push(parseFloat(i.value));break;case 10:n&&t.controlPoints.push(n),n={x:parseFloat(i.value),y:0,z:0};break;case 20:n&&(n.y=parseFloat(i.value));break;case 30:n&&(n.z=parseFloat(i.value));break;case 11:r&&t.fitPoints.push(r),r={x:parseFloat(i.value),y:0,z:0};break;case 21:r&&(r.y=parseFloat(i.value));break;case 31:r&&(r.z=parseFloat(i.value));break;case 12:t.startTangent||={x:0,y:0,z:0},t.startTangent.x=parseFloat(i.value);break;case 22:t.startTangent&&(t.startTangent.y=parseFloat(i.value));break;case 32:t.startTangent&&(t.startTangent.z=parseFloat(i.value));break;case 13:t.endTangent||={x:0,y:0,z:0},t.endTangent.x=parseFloat(i.value);break;case 23:t.endTangent&&(t.endTangent.y=parseFloat(i.value));break;case 33:t.endTangent&&(t.endTangent.z=parseFloat(i.value));break}return n&&t.controlPoints.push(n),r&&t.fitPoints.push(r),t}function se(e){let t={...C(e),type:`TEXT`,text:``,insertionPoint:{x:0,y:0,z:0},height:1,rotation:0,widthFactor:1,obliqueAngle:0,style:`STANDARD`,hAlign:0,vAlign:0,generationFlags:0};for(let n of e)switch(n.code){case 1:t.text=n.value;break;case 10:t.insertionPoint.x=parseFloat(n.value);break;case 20:t.insertionPoint.y=parseFloat(n.value);break;case 30:t.insertionPoint.z=parseFloat(n.value);break;case 11:t.alignmentPoint||={x:0,y:0,z:0},t.alignmentPoint.x=parseFloat(n.value);break;case 21:t.alignmentPoint||={x:0,y:0,z:0},t.alignmentPoint.y=parseFloat(n.value);break;case 31:t.alignmentPoint||={x:0,y:0,z:0},t.alignmentPoint.z=parseFloat(n.value);break;case 40:t.height=parseFloat(n.value);break;case 41:t.widthFactor=parseFloat(n.value);break;case 50:t.rotation=parseFloat(n.value);break;case 51:t.obliqueAngle=parseFloat(n.value);break;case 7:t.style=n.value;break;case 71:t.generationFlags=parseInt(n.value,10);break;case 72:t.hAlign=parseInt(n.value,10);break;case 73:t.vAlign=parseInt(n.value,10);break}return t}function ce(e){let t={...C(e),type:`MTEXT`,text:``,insertionPoint:{x:0,y:0,z:0},height:1,width:0,attachmentPoint:1,drawingDirection:1,rotation:0,lineSpacingStyle:1,lineSpacingFactor:1,style:`STANDARD`,bgFill:0,bgFillScale:1.5},n=[];for(let r of e)switch(r.code){case 1:n.push(r.value);break;case 3:n.push(r.value);break;case 7:t.style=r.value;break;case 10:t.insertionPoint.x=parseFloat(r.value);break;case 20:t.insertionPoint.y=parseFloat(r.value);break;case 30:t.insertionPoint.z=parseFloat(r.value);break;case 11:t.textDirection||={x:0,y:0,z:0},t.textDirection.x=parseFloat(r.value);break;case 21:t.textDirection||={x:0,y:0,z:0},t.textDirection.y=parseFloat(r.value);break;case 31:t.textDirection||={x:0,y:0,z:0},t.textDirection.z=parseFloat(r.value);break;case 40:t.height=parseFloat(r.value);break;case 41:t.width=parseFloat(r.value);break;case 44:t.lineSpacingFactor=parseFloat(r.value);break;case 50:t.rotation=parseFloat(r.value);break;case 71:t.attachmentPoint=parseInt(r.value,10);break;case 72:t.drawingDirection=parseInt(r.value,10);break;case 73:t.lineSpacingStyle=parseInt(r.value,10);break;case 90:t.bgFill=parseInt(r.value,10);break}return t.text=n.join(``),t}function le(e){let t={...C(e),type:`INSERT`,blockName:``,insertionPoint:{x:0,y:0,z:0},scaleX:1,scaleY:1,scaleZ:1,rotation:0,columnCount:1,rowCount:1,columnSpacing:0,rowSpacing:0,attribs:[]};for(let n of e)switch(n.code){case 2:t.blockName=n.value;break;case 10:t.insertionPoint.x=parseFloat(n.value);break;case 20:t.insertionPoint.y=parseFloat(n.value);break;case 30:t.insertionPoint.z=parseFloat(n.value);break;case 41:t.scaleX=parseFloat(n.value);break;case 42:t.scaleY=parseFloat(n.value);break;case 43:t.scaleZ=parseFloat(n.value);break;case 44:t.columnSpacing=parseFloat(n.value);break;case 45:t.rowSpacing=parseFloat(n.value);break;case 50:t.rotation=parseFloat(n.value);break;case 70:t.columnCount=parseInt(n.value,10)||1;break;case 71:t.rowCount=parseInt(n.value,10)||1;break}return t}function ue(e){let t={...C(e),type:`DIMENSION`,blockName:``,dimStyle:`STANDARD`,dimType:0,defPoint:{x:0,y:0,z:0},textMidpoint:{x:0,y:0,z:0},textOverride:``,rotation:0,textRotation:0,leaderLength:0};for(let n of e)switch(n.code){case 1:t.textOverride=n.value;break;case 2:t.blockName=n.value;break;case 3:t.dimStyle=n.value;break;case 10:t.defPoint.x=parseFloat(n.value);break;case 20:t.defPoint.y=parseFloat(n.value);break;case 30:t.defPoint.z=parseFloat(n.value);break;case 11:t.textMidpoint.x=parseFloat(n.value);break;case 21:t.textMidpoint.y=parseFloat(n.value);break;case 31:t.textMidpoint.z=parseFloat(n.value);break;case 13:t.defPoint2||={x:0,y:0,z:0},t.defPoint2.x=parseFloat(n.value);break;case 23:t.defPoint2||={x:0,y:0,z:0},t.defPoint2.y=parseFloat(n.value);break;case 33:t.defPoint2||={x:0,y:0,z:0},t.defPoint2.z=parseFloat(n.value);break;case 14:t.defPoint3||={x:0,y:0,z:0},t.defPoint3.x=parseFloat(n.value);break;case 24:t.defPoint3||={x:0,y:0,z:0},t.defPoint3.y=parseFloat(n.value);break;case 34:t.defPoint3||={x:0,y:0,z:0},t.defPoint3.z=parseFloat(n.value);break;case 15:t.defPoint4||={x:0,y:0,z:0},t.defPoint4.x=parseFloat(n.value);break;case 25:t.defPoint4||={x:0,y:0,z:0},t.defPoint4.y=parseFloat(n.value);break;case 35:t.defPoint4||={x:0,y:0,z:0},t.defPoint4.z=parseFloat(n.value);break;case 16:t.defPoint5||={x:0,y:0,z:0},t.defPoint5.x=parseFloat(n.value);break;case 26:t.defPoint5||={x:0,y:0,z:0},t.defPoint5.y=parseFloat(n.value);break;case 36:t.defPoint5||={x:0,y:0,z:0},t.defPoint5.z=parseFloat(n.value);break;case 40:t.leaderLength=parseFloat(n.value);break;case 50:t.rotation=parseFloat(n.value);break;case 53:t.textRotation=parseFloat(n.value);break;case 70:t.dimType=parseInt(n.value,10);break}return t}function de(e){let t={...C(e),type:`HATCH`,patternName:``,solidFill:!0,associative:!1,hatchStyle:0,patternType:1,patternAngle:0,patternScale:1,boundaryPaths:[]},n=0;for(;n<e.length;){let r=e[n];switch(r.code){case 2:t.patternName=r.value;break;case 41:t.patternScale=parseFloat(r.value);break;case 52:t.patternAngle=parseFloat(r.value);break;case 70:t.solidFill=r.value===`1`;break;case 71:t.associative=r.value===`1`;break;case 75:t.hatchStyle=parseInt(r.value,10);break;case 76:t.patternType=parseInt(r.value,10);break;case 91:{let i=parseInt(r.value,10);n++;for(let r=0;r<i&&n<e.length;r++){let r=fe(e,n);t.boundaryPaths.push(r.path),n=r.nextIndex}continue}}n++}return t}function fe(e,t){let n=0;return t<e.length&&e[t].code===92&&(n=parseInt(e[t].value,10),t++),n&2?pe(e,t,n):me(e,t,n)}function pe(e,t,n){let r={type:`polyline`,vertices:[],bulges:[],flags:n},i=!1;t<e.length&&e[t].code===72&&(i=e[t].value===`1`,t++),t<e.length&&e[t].code===73&&(r.isClosed=e[t].value===`1`,t++);let a=0;t<e.length&&e[t].code===93&&(a=parseInt(e[t].value,10),t++);for(let n=0;n<a&&t<e.length;n++){let n={x:0,y:0};e[t].code===10&&(n.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===20&&(n.y=parseFloat(e[t].value),t++),r.vertices.push(n),i&&t<e.length&&e[t].code===42?(r.bulges.push(parseFloat(e[t].value)),t++):i&&r.bulges.push(0)}for(;t<e.length&&(e[t].code===97||e[t].code===330);)if(e[t].code===97){let n=parseInt(e[t].value,10);t++;for(let r=0;r<n&&t<e.length&&e[t].code===330;r++)t++}else t++;return{path:r,nextIndex:t}}function me(e,t,n){let r={type:`edges`,edges:[],flags:n},i=0;t<e.length&&e[t].code===93&&(i=parseInt(e[t].value,10),t++);for(let n=0;n<i&&t<e.length&&e[t].code===72;n++){let n=parseInt(e[t].value,10);switch(t++,n){case 1:{let n={type:`line`,start:{x:0,y:0},end:{x:0,y:0}};t<e.length&&e[t].code===10&&(n.start.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===20&&(n.start.y=parseFloat(e[t].value),t++),t<e.length&&e[t].code===11&&(n.end.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===21&&(n.end.y=parseFloat(e[t].value),t++),r.edges.push(n);break}case 2:{let n={type:`arc`,center:{x:0,y:0},radius:0,startAngle:0,endAngle:360,ccw:!0};t<e.length&&e[t].code===10&&(n.center.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===20&&(n.center.y=parseFloat(e[t].value),t++),t<e.length&&e[t].code===40&&(n.radius=parseFloat(e[t].value),t++),t<e.length&&e[t].code===50&&(n.startAngle=parseFloat(e[t].value),t++),t<e.length&&e[t].code===51&&(n.endAngle=parseFloat(e[t].value),t++),t<e.length&&e[t].code===73&&(n.ccw=e[t].value===`1`,t++),r.edges.push(n);break}case 3:{let n={type:`ellipse`,center:{x:0,y:0},majorAxis:{x:1,y:0},minorRatio:1,startAngle:0,endAngle:Math.PI*2,ccw:!0};t<e.length&&e[t].code===10&&(n.center.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===20&&(n.center.y=parseFloat(e[t].value),t++),t<e.length&&e[t].code===11&&(n.majorAxis.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===21&&(n.majorAxis.y=parseFloat(e[t].value),t++),t<e.length&&e[t].code===40&&(n.minorRatio=parseFloat(e[t].value),t++),t<e.length&&e[t].code===50&&(n.startAngle=parseFloat(e[t].value),t++),t<e.length&&e[t].code===51&&(n.endAngle=parseFloat(e[t].value),t++),t<e.length&&e[t].code===73&&(n.ccw=e[t].value===`1`,t++),r.edges.push(n);break}case 4:{let n=3,i=[],a=[];t<e.length&&e[t].code===94&&(n=parseInt(e[t].value,10),t++),t<e.length&&e[t].code===73&&t++,t<e.length&&e[t].code===74&&t++;let o=0;t<e.length&&e[t].code===95&&(o=parseInt(e[t].value,10),t++);let s=0;t<e.length&&e[t].code===96&&(s=parseInt(e[t].value,10),t++);for(let n=0;n<o&&t<e.length&&e[t].code===40;n++)i.push(parseFloat(e[t].value)),t++;for(let n=0;n<s&&t<e.length;n++){let n={x:0,y:0};e[t].code===10&&(n.x=parseFloat(e[t].value),t++),t<e.length&&e[t].code===20&&(n.y=parseFloat(e[t].value),t++),a.push(n)}r.edges.push({type:`spline`,degree:n,knots:i,controlPoints:a});break}}}for(;t<e.length&&(e[t].code===97||e[t].code===330);)if(e[t].code===97){let n=parseInt(e[t].value,10);t++;for(let r=0;r<n&&t<e.length&&e[t].code===330;r++)t++}else t++;return{path:r,nextIndex:t}}function he(e){let t={...C(e),type:`POINT`,position:{x:0,y:0,z:0}};for(let n of e)switch(n.code){case 10:t.position.x=parseFloat(n.value);break;case 20:t.position.y=parseFloat(n.value);break;case 30:t.position.z=parseFloat(n.value);break}return t}function D(e,t,n){for(;t<e.length;){let r=e[t];if(r.code!==0){t++;continue}let i=r.value;if(i===`ENDSEC`||i===`ENDBLK`)return t+1;t++;let a=[];for(;t<e.length&&e[t].code!==0;)a.push(e[t]),t++;switch(i){case`LINE`:n.push(w(a));break;case`CIRCLE`:n.push(T(a));break;case`ARC`:n.push(E(a));break;case`LWPOLYLINE`:n.push(re(a));break;case`ELLIPSE`:n.push(ae(a));break;case`SPLINE`:n.push(oe(a));break;case`TEXT`:n.push(se(a));break;case`MTEXT`:n.push(ce(a));break;case`INSERT`:{let r=le(a);a.some(e=>e.code===66&&e.value===`1`)&&(t=_e(e,t,r.attribs)),n.push(r);break}case`DIMENSION`:n.push(ue(a));break;case`HATCH`:n.push(de(a));break;case`POINT`:n.push(he(a));break;case`POLYLINE`:{let r=ie(a);t=ge(e,t,r.vertices),n.push(r);break}}}return t}function ge(e,t,n){for(;t<e.length;){if(e[t].code!==0){t++;continue}let r=e[t].value;if(r===`SEQEND`)return t+1;if(r===`ENDSEC`||r===`ENDBLK`)return t;if(r===`VERTEX`){t++;let r={x:0,y:0,bulge:0,startWidth:0,endWidth:0};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 10:r.x=parseFloat(n.value);break;case 20:r.y=parseFloat(n.value);break;case 42:r.bulge=parseFloat(n.value);break;case 40:r.startWidth=parseFloat(n.value);break;case 41:r.endWidth=parseFloat(n.value);break}t++}n.push(r)}else for(t++;t<e.length&&e[t].code!==0;)t++}return t}function _e(e,t,n){for(;t<e.length;){if(e[t].code!==0){t++;continue}let r=e[t].value;if(r===`SEQEND`)return t+1;if(r===`ENDSEC`||r===`ENDBLK`)return t;if(r===`ATTRIB`){t++;let r={tag:``,text:``,insertionPoint:{x:0,y:0,z:0},height:1,rotation:0,style:`STANDARD`,layer:`0`,color:256};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 1:r.text=n.value;break;case 2:r.tag=n.value;break;case 7:r.style=n.value;break;case 8:r.layer=n.value;break;case 10:r.insertionPoint.x=parseFloat(n.value);break;case 20:r.insertionPoint.y=parseFloat(n.value);break;case 30:r.insertionPoint.z=parseFloat(n.value);break;case 40:r.height=parseFloat(n.value);break;case 50:r.rotation=parseFloat(n.value);break;case 62:r.color=parseInt(n.value,10);break}t++}n.push(r)}else for(t++;t<e.length&&e[t].code!==0;)t++}return t}function ve(e,t,n){for(;t<e.length;){let r=e[t];if(r.code===0&&r.value===`ENDSEC`)return t+1;if(r.code===0&&r.value===`BLOCK`){t++;let r={name:``,basePoint:{x:0,y:0,z:0},entities:[],flags:0};for(;t<e.length&&e[t].code!==0;){let n=e[t];switch(n.code){case 2:r.name=n.value;break;case 8:break;case 10:r.basePoint.x=parseFloat(n.value);break;case 20:r.basePoint.y=parseFloat(n.value);break;case 30:r.basePoint.z=parseFloat(n.value);break;case 70:r.flags=parseInt(n.value,10);break}t++}t=D(e,t,r.entities),r.name&&!r.name.startsWith(`*Model_Space`)&&!r.name.startsWith(`*Paper_Space`)&&n.set(r.name,r)}else t++}return t}var O=`AutoCAD Binary DXF`,ye={ANSI_874:`windows-874`,ANSI_932:`shift_jis`,ANSI_936:`gbk`,ANSI_949:`euc-kr`,ANSI_950:`big5`,ANSI_1250:`windows-1250`,ANSI_1251:`windows-1251`,ANSI_1252:`windows-1252`,ANSI_1253:`windows-1253`,ANSI_1254:`windows-1254`,ANSI_1255:`windows-1255`,ANSI_1256:`windows-1256`,ANSI_1257:`windows-1257`,ANSI_1258:`windows-1258`},be=`AC1021`;function xe(){return{acadVersion:``,insUnits:0,measurement:0,ltScale:1}}function k(e){return e.replace(/\\U\+([0-9A-Fa-f]{4})/g,(e,t)=>String.fromCodePoint(parseInt(t,16)))}function Se(e){if(typeof e==`string`)return k(e);let t=new Uint8Array(e);if(new TextDecoder(`ascii`).decode(t.slice(0,O.length))===O)throw new A(`Binary DXF format is not supported. Please export as ASCII DXF.`);let n=new TextDecoder(`utf-8`).decode(e),r=n.match(/\$ACADVER[\s\S]*?\n\s*1\s*\n\s*(\S+)/)?.[1]??``;if(r&&r<be){let t=ye[n.match(/\$DWGCODEPAGE[\s\S]*?\n\s*3\s*\n\s*(\S+)/)?.[1]??``]??`windows-1252`;t!==`utf-8`&&(n=new TextDecoder(t).decode(e))}return k(n)}function Ce(e,t){for(;t<e.length;){if(e[t].code===0&&e[t].value===`ENDSEC`)return t+1;t++}return t}function we(e){e.layers.has(`0`)||e.layers.set(`0`,{name:`0`,color:7,lineType:`Continuous`,flags:0,lineWeight:-3,isOff:!1,isFrozen:!1,isLocked:!1})}function Te(e){for(let[,t]of e.layers)t.isOff=t.color<0,t.isOff&&(t.color=Math.abs(t.color)),t.isFrozen=(t.flags&1)!=0,t.isLocked=(t.flags&4)!=0}var A=class extends Error{constructor(e,t){super(e),this.cause=t,this.name=`DxfParseError`}};function j(e){if(typeof e==`string`){if(e.length===0)throw new A(`Input is empty. Expected a DXF string or ArrayBuffer.`)}else if(e instanceof ArrayBuffer){if(e.byteLength===0)throw new A(`Input ArrayBuffer is empty.`)}else throw new A(`Invalid input type. Expected a string or ArrayBuffer.`);let t;try{t=Se(e)}catch(e){throw e instanceof A?e:new A(`Failed to decode DXF input.`,e)}let n;try{n=v(t)}catch(e){throw new A(`Failed to tokenize DXF content.`,e)}if(n.length===0)throw new A(`DXF content produced no tokens. The input may not be a valid DXF file.`);let r={header:xe(),layers:new Map,lineTypes:new Map,styles:new Map,blocks:new Map,entities:[]};try{let e=0;for(;e<n.length;){let t=n[e];if(t.code===0&&t.value===`SECTION`){if(e++,e>=n.length)break;let t=n[e].value;switch(e++,t){case`HEADER`:e=y(n,e,r.header);break;case`TABLES`:e=ee(n,e,r);break;case`BLOCKS`:e=ve(n,e,r.blocks);break;case`ENTITIES`:e=D(n,e,r.entities);break;default:e=Ce(n,e);break}}else if(t.code===0&&t.value===`EOF`)break;else e++}}catch(e){throw new A(`Failed to parse DXF sections.`,e)}return we(r),Te(r),r}var Ee=`#000000.#FF0000.#FFFF00.#00FF00.#00FFFF.#0000FF.#FF00FF.#FFFFFF.#808080.#C0C0C0.#FF0000.#FF7F7F.#A50000.#A55252.#7F0000.#7F3F3F.#4C0000.#4C2626.#260000.#261313.#FF3F00.#FF9F7F.#A52900.#A56752.#7F1F00.#7F4F3F.#4C1300.#4C2F26.#260900.#261713.#FF7F00.#FFBF7F.#A55200.#A57C52.#7F3F00.#7F5F3F.#4C2600.#4C3926.#261300.#261C13.#FFBF00.#FFDF7F.#A57C00.#A59152.#7F5F00.#7F6F3F.#4C3900.#4C4226.#261C00.#262113.#FFFF00.#FFFF7F.#A5A500.#A5A552.#7F7F00.#7F7F3F.#4C4C00.#4C4C26.#262600.#262613.#BFFF00.#DFFF7F.#7CA500.#91A552.#5F7F00.#6F7F3F.#394C00.#424C26.#1C2600.#212613.#7FFF00.#BFFF7F.#52A500.#7CA552.#3F7F00.#5F7F3F.#264C00.#394C26.#132600.#1C2613.#3FFF00.#9FFF7F.#29A500.#67A552.#1F7F00.#4F7F3F.#134C00.#2F4C26.#092600.#172613.#00FF00.#7FFF7F.#00A500.#52A552.#007F00.#3F7F3F.#004C00.#264C26.#002600.#132613.#00FF3F.#7FFF9F.#00A529.#52A567.#007F1F.#3F7F4F.#004C13.#264C2F.#002609.#132617.#00FF7F.#7FFFBF.#00A552.#52A57C.#007F3F.#3F7F5F.#004C26.#264C39.#002613.#13261C.#00FFBF.#7FFFDF.#00A57C.#52A591.#007F5F.#3F7F6F.#004C39.#264C42.#00261C.#132621.#00FFFF.#7FFFFF.#00A5A5.#52A5A5.#007F7F.#3F7F7F.#004C4C.#264C4C.#002626.#132626.#00BFFF.#7FDFFF.#007CA5.#5291A5.#005F7F.#3F6F7F.#00394C.#26424C.#001C26.#132126.#007FFF.#7FBFFF.#0052A5.#527CA5.#003F7F.#3F5F7F.#00264C.#26394C.#001326.#131C26.#003FFF.#7F9FFF.#0029A5.#5267A5.#001F7F.#3F4F7F.#00134C.#262F4C.#000926.#131726.#0000FF.#7F7FFF.#0000A5.#5252A5.#00007F.#3F3F7F.#00004C.#26264C.#000026.#131326.#3F00FF.#9F7FFF.#2900A5.#6752A5.#1F007F.#4F3F7F.#13004C.#2F264C.#090026.#171326.#7F00FF.#BF7FFF.#5200A5.#7C52A5.#3F007F.#5F3F7F.#26004C.#39264C.#130026.#1C1326.#BF00FF.#DF7FFF.#7C00A5.#9152A5.#5F007F.#6F3F7F.#39004C.#42264C.#1C0026.#211326.#FF00FF.#FF7FFF.#A500A5.#A552A5.#7F007F.#7F3F7F.#4C004C.#4C264C.#260026.#261326.#FF00BF.#FF7FDF.#A5007C.#A55291.#7F005F.#7F3F6F.#4C0039.#4C2642.#26001C.#261321.#FF007F.#FF7FBF.#A50052.#A5527C.#7F003F.#7F3F5F.#4C0026.#4C2639.#260013.#26131C.#FF003F.#FF7F9F.#A50029.#A55267.#7F001F.#7F3F4F.#4C0013.#4C262F.#260009.#261317.#333333.#505050.#696969.#828282.#BEBEBE.#FFFFFF`.split(`.`);function De(e){if(!(e===0||e===256)&&!(e<0||e>255))return Ee[e]}var M={dark:{backgroundColor:`#1a1a2e`,defaultEntityColor:`#ffffff`,selectionColor:`#00ff88`,measureColor:`#ffaa00`,gridColor:`#333333`,crosshairColor:`#555555`},light:{backgroundColor:`#ffffff`,defaultEntityColor:`#000000`,selectionColor:`#0066ff`,measureColor:`#ff6600`,gridColor:`#dddddd`,crosshairColor:`#cccccc`}};function N(e,t,n){return[t*e.scale+e.offsetX,-n*e.scale+e.offsetY]}function P(e,t,n){return[(t-e.offsetX)/e.scale,-(n-e.offsetY)/e.scale]}function Oe(e,t){let n=window.devicePixelRatio||1;e.setTransform(t.scale*n,0,0,-t.scale*n,t.offsetX*n,t.offsetY*n)}function ke(e,t,n,r,i,a,o=.05){let s=i-n,c=a-r;if(s<=0||c<=0)return{scale:1,offsetX:e/2,offsetY:t/2};let l=e/s,u=t/c,d=Math.min(l,u)*(1-o*2),f=(n+i)/2,p=(r+a)/2;return{scale:d,offsetX:e/2-f*d,offsetY:t/2+p*d}}function Ae(e,t,n,r,i=1e-4,a=1e5){let o=Math.max(i,Math.min(a,e.scale*r)),s=o/e.scale;return{scale:o,offsetX:t-(t-e.offsetX)*s,offsetY:n-(n-e.offsetY)*s}}var je=class{transform={scale:1,offsetX:0,offsetY:0};minScale;maxScale;constructor(e){this.minScale=e.minZoom,this.maxScale=e.maxZoom}getTransform(){return this.transform}setTransform(e){this.transform=e}pan(e,t){this.transform={...this.transform,offsetX:this.transform.offsetX+e,offsetY:this.transform.offsetY+t}}zoom(e,t,n){this.transform=Ae(this.transform,e,t,n,this.minScale,this.maxScale)}};function F(e,t){return e===7?t===`dark`?`#ffffff`:`#000000`:De(e)??`#ffffff`}function I(e,t,n,r){if(e.trueColor!==void 0)return`rgb(${e.trueColor>>16&255},${e.trueColor>>8&255},${e.trueColor&255})`;if(e.color===0)return r??M[n].defaultEntityColor;if(e.color!==256)return F(e.color,n);let i=t.get(e.layer);return i?i.trueColor===void 0?F(Math.abs(i.color),n):`rgb(${i.trueColor>>16&255},${i.trueColor>>8&255},${i.trueColor&255})`:M[n].defaultEntityColor}function Me(e,t){e.beginPath(),e.moveTo(t.start.x,t.start.y),e.lineTo(t.end.x,t.end.y),e.stroke()}function Ne(e,t){t.radius<=0||(e.beginPath(),e.arc(t.center.x,t.center.y,t.radius,0,Math.PI*2),e.stroke())}function Pe(e,t){if(t.radius<=0)return;let n=t.startAngle*Math.PI/180,r=t.endAngle*Math.PI/180;e.beginPath(),e.arc(t.center.x,t.center.y,t.radius,n,r,!1),e.stroke()}function Fe(e,t,n,r,i){let a=n-e,o=r-t,s=Math.sqrt(a*a+o*o);if(s<1e-10)return{cx:e,cy:t,radius:0,startAngle:0,endAngle:0,anticlockwise:!1};let c=Math.abs(i)*s/2,l=((s/2)**2+c**2)/(2*c),u=(e+n)/2,d=(t+r)/2,f=-o/s,p=a/s,m=l-c,h=i>0?1:-1,g=u+h*m*f,_=d+h*m*p;return{cx:g,cy:_,radius:l,startAngle:Math.atan2(t-_,e-g),endAngle:Math.atan2(r-_,n-g),anticlockwise:i<0}}function L(e,t,n,r,i,a){let o=Fe(t,n,r,i,a);if(o.radius<1e-10){e.lineTo(r,i);return}e.arc(o.cx,o.cy,o.radius,o.startAngle,o.endAngle,o.anticlockwise)}function Ie(e,t){let n=t.vertices;if(n.length<2)return;e.beginPath(),e.moveTo(n[0].x,n[0].y);let r=t.closed?n.length:n.length-1;for(let t=0;t<r;t++){let r=n[t],i=n[(t+1)%n.length];Math.abs(r.bulge)<1e-10?e.lineTo(i.x,i.y):L(e,r.x,r.y,i.x,i.y,r.bulge)}e.stroke()}function Le(e,t){let n=t.vertices;if(n.length<2)return;e.beginPath(),e.moveTo(n[0].x,n[0].y);let r=t.closed?n.length:n.length-1;for(let t=0;t<r;t++){let r=n[t],i=n[(t+1)%n.length],a=r.bulge??0;Math.abs(a)<1e-10?e.lineTo(i.x,i.y):L(e,r.x,r.y,i.x,i.y,a)}e.stroke()}function Re(e,t){let n=Math.sqrt(t.majorAxis.x**2+t.majorAxis.y**2+t.majorAxis.z**2);if(n<1e-10||t.minorRatio<=0)return;let r=n*t.minorRatio,i=Math.atan2(t.majorAxis.y,t.majorAxis.x);e.beginPath(),e.ellipse(t.center.x,t.center.y,n,r,i,t.startParam,t.endParam,!1),e.stroke()}function ze(e,t,n,r,i){let a=t.length-1,o=e;for(;o<a&&n[o+1]<=r;)o++;let s=[],c=[];for(let n=0;n<=e;n++){let r=o-e+n;s.push({...t[r]}),c.push(i?i[r]:1)}for(let t=1;t<=e;t++)for(let a=e;a>=t;a--){let l=o-e+a,u=n[l+e-t+1]-n[l];if(Math.abs(u)<1e-10)continue;let d=(r-n[l])/u,f=s[a],p=s[a-1];if(i){let e=c[a-1]*(1-d),t=c[a]*d,n=e+t;if(Math.abs(n)<1e-10)continue;f.x=(p.x*e+f.x*t)/n,f.y=(p.y*e+f.y*t)/n,f.z=(p.z*e+f.z*t)/n,c[a]=n}else f.x=(1-d)*p.x+d*f.x,f.y=(1-d)*p.y+d*f.y,f.z=(1-d)*p.z+d*f.z}return s[e]??{x:0,y:0,z:0}}function Be(e){if(e.length<2)return e.map(e=>({x:e.x,y:e.y}));let t=[],n=e.length;for(let r=0;r<n-1;r++){let i=e[Math.max(0,r-1)],a=e[r],o=e[Math.min(n-1,r+1)],s=e[Math.min(n-1,r+2)];for(let e=0;e<=(r===n-2?10:9);e++){let n=e/10,r=n*n,c=r*n,l=.5*(2*a.x+(-i.x+o.x)*n+(2*i.x-5*a.x+4*o.x-s.x)*r+(-i.x+3*a.x-3*o.x+s.x)*c),u=.5*(2*a.y+(-i.y+o.y)*n+(2*i.y-5*a.y+4*o.y-s.y)*r+(-i.y+3*a.y-3*o.y+s.y)*c);t.push({x:l,y:u})}}return t}function R(e,t){if(e.degree===1)return e.controlPoints.map(e=>({x:e.x,y:e.y}));if(e.controlPoints.length===0&&e.fitPoints.length>=2)return Be(e.fitPoints);if(e.controlPoints.length<e.degree+1||e.knots.length<e.controlPoints.length+e.degree+1)return[];let n=[],r=e.knots[e.degree],i=e.knots[e.knots.length-e.degree-1];if(i<=r)return[];let a=Math.max(e.controlPoints.length*10,Math.ceil((i-r)/t)),o=Math.min(a,5e3),s=e.weights.length>0?e.weights:void 0;for(let t=0;t<=o;t++){let a=r+(i-r)*(t/o),c=ze(e.degree,e.controlPoints,e.knots,a,s);n.push({x:c.x,y:c.y})}return n}function Ve(e,t,n){let r=R(t,n);if(!(r.length<2)){e.beginPath(),e.moveTo(r[0].x,r[0].y);for(let t=1;t<r.length;t++)e.lineTo(r[t].x,r[t].y);t.flags&1&&e.closePath(),e.stroke()}}var He={standard:`Arial, sans-serif`,arial:`Arial, sans-serif`,"arial.ttf":`Arial, sans-serif`,"romans.shx":`"Courier New", monospace`,"simplex.shx":`"Courier New", monospace`,"txt.shx":`monospace`,"monotxt.shx":`monospace`,"isocp.shx":`"Courier New", monospace`,"isocpeur.shx":`"Courier New", monospace`,"times.ttf":`"Times New Roman", serif`,"timesnr.ttf":`"Times New Roman", serif`,"gothic.ttf":`"Century Gothic", sans-serif`};function z(e){return He[e.toLowerCase().trim()]||`sans-serif`}function Ue(e,t,n){if(!t.text||t.height<n*4)return;let r=t.hAlign!==0||t.vAlign!==0,i=r&&t.alignmentPoint?t.alignmentPoint.x:t.insertionPoint.x,a=r&&t.alignmentPoint?t.alignmentPoint.y:t.insertionPoint.y;if(e.save(),e.translate(i,a),e.scale(1,-1),t.rotation&&e.rotate(-t.rotation*Math.PI/180),t.widthFactor!==1&&e.scale(t.widthFactor,1),t.obliqueAngle){let n=Math.tan(t.obliqueAngle*Math.PI/180);e.transform(1,0,n,1,0,0)}let o=(t.generationFlags&2)!=0,s=(t.generationFlags&4)!=0;o&&e.scale(-1,1),s&&e.scale(1,-1);let c=z(t.style||`Standard`);switch(e.font=`${t.height}px ${c}`,t.hAlign){case 0:e.textAlign=`left`;break;case 1:e.textAlign=`center`;break;case 2:e.textAlign=`right`;break;case 3:e.textAlign=`left`;break;case 4:e.textAlign=`center`;break;case 5:e.textAlign=`left`;break;default:e.textAlign=`left`}switch(t.vAlign){case 0:e.textBaseline=`alphabetic`;break;case 1:e.textBaseline=`bottom`;break;case 2:e.textBaseline=`middle`;break;case 3:e.textBaseline=`top`;break;default:e.textBaseline=`alphabetic`}e.fillText(t.text,0,0),e.restore()}function We(e){return e.replace(/\\P/g,`
|
|
6
|
-
`).replace(/\\[fFHWQTCAaLlOoKk][^;]*;/g,``).replace(/\\\\/g,`\\`).replace(/\\~/g,`\xA0`).replace(/\{/g,``).replace(/\}/g,``).replace(/\\S[^;]*;/g,``).trim()}function Ge(e,t,n){if(!t.text||t.height<n*4)return;e.save(),e.translate(t.insertionPoint.x,t.insertionPoint.y),e.scale(1,-1);let r=t.textDirection?Math.atan2(t.textDirection.y,t.textDirection.x):(t.rotation||0)*Math.PI/180;r&&e.rotate(-r);let i=We(t.text).split(`
|
|
7
|
-
`),a=t.height*(t.lineSpacingFactor||1.4),o=z(t.style||`Standard`);e.font=`${t.height}px ${o}`;let s=(t.attachmentPoint-1)%3,c=Math.floor((t.attachmentPoint-1)/3);e.textAlign=[`left`,`center`,`right`][s]??`left`;let l=0,u=i.length*a;switch(c){case 0:l=t.height;break;case 1:l=t.height-u/2;break;case 2:l=t.height-u;break}for(let t=0;t<i.length;t++)e.fillText(i[t],0,l+t*a);e.restore()}var Ke=100;function qe(e,t,n,r=0){if(r>Ke)return null;if(n.has(e))return n.get(e);let i=t.blocks.get(e);if(!i)return n.set(e,null),null;n.set(e,null);let a=1/0,o=1/0,s=-1/0,c=-1/0,l=!1;for(let e of i.entities){let i;i=e.type===`INSERT`?B(e,t,n,r+1):W(e),i&&(l=!0,a=Math.min(a,i.minX),o=Math.min(o,i.minY),s=Math.max(s,i.maxX),c=Math.max(c,i.maxY))}let u=l?{minX:a,minY:o,maxX:s,maxY:c}:null;return n.set(e,u),u}function B(e,t,n,r=0){let i=qe(e.blockName,t,n,r);if(!i)return null;let a=t.blocks.get(e.blockName);if(!a)return null;let o=a.basePoint.x,s=a.basePoint.y,c=i.minX-o,l=i.minY-s,u=i.maxX-o,d=i.maxY-s,f=e.scaleX,p=e.scaleY,m=c*f,h=u*f,g=l*p,_=d*p;if(m>h){let e=m;m=h,h=e}if(g>_){let e=g;g=_,_=e}let v=(e.rotation||0)*Math.PI/180;if(Math.abs(v)<1e-10){let t=e.insertionPoint.x,n=e.insertionPoint.y,r=m+t,i=g+n,a=h+t,o=_+n,s=Math.max(1,e.columnCount),c=Math.max(1,e.rowCount);if(s>1||c>1){let t=(s-1)*e.columnSpacing,n=(c-1)*e.rowSpacing;r=Math.min(r,r+t),a=Math.max(a,a+t),i=Math.min(i,i+n),o=Math.max(o,o+n)}return{minX:r,minY:i,maxX:a,maxY:o}}let y=Math.cos(v),b=Math.sin(v),ee=[{x:m,y:g},{x:h,y:g},{x:h,y:_},{x:m,y:_}],te=e.insertionPoint.x,ne=e.insertionPoint.y,x=1/0,S=1/0,C=-1/0,w=-1/0;for(let e of ee){let t=e.x*y-e.y*b+te,n=e.x*b+e.y*y+ne;x=Math.min(x,t),S=Math.min(S,n),C=Math.max(C,t),w=Math.max(w,n)}let T=Math.max(1,e.columnCount),E=Math.max(1,e.rowCount);if(T>1||E>1){let t=(T-1)*e.columnSpacing,n=(E-1)*e.rowSpacing,r=[{x:0,y:0},{x:t,y:0},{x:t,y:n},{x:0,y:n}];for(let e of r){let t=e.x*y-e.y*b,n=e.x*b+e.y*y;x=Math.min(x,x+t),S=Math.min(S,S+n),C=Math.max(C,C+t),w=Math.max(w,w+n)}}return{minX:x,minY:S,maxX:C,maxY:w}}function Je(e,t){let n=1/0,r=1/0,i=-1/0,a=-1/0,o=!1,s=t?new Map:void 0;for(let c of e){let e=t&&s?V(c,t,s):W(c);e&&(o=!0,n=Math.min(n,e.minX),r=Math.min(r,e.minY),i=Math.max(i,e.maxX),a=Math.max(a,e.maxY))}return o?{minX:n,minY:r,maxX:i,maxY:a}:null}function V(e,t,n){return e.type===`INSERT`?B(e,t,n):W(e)}var H=null;function Ye(e){let t=new Map;for(let[n,r]of e.blocks){let e=Array(r.entities.length);for(let t=0;t<r.entities.length;t++)e[t]=W(r.entities[t]);t.set(n,e)}return t}function Xe(e){H=e}function U(){H=null}function Ze(e,t){if(!H)return;let n=H.get(e);if(!(!n||t>=n.length))return n[t]}function W(e){switch(e.type){case`LINE`:return{minX:Math.min(e.start.x,e.end.x),minY:Math.min(e.start.y,e.end.y),maxX:Math.max(e.start.x,e.end.x),maxY:Math.max(e.start.y,e.end.y)};case`CIRCLE`:return{minX:e.center.x-e.radius,minY:e.center.y-e.radius,maxX:e.center.x+e.radius,maxY:e.center.y+e.radius};case`ARC`:return{minX:e.center.x-e.radius,minY:e.center.y-e.radius,maxX:e.center.x+e.radius,maxY:e.center.y+e.radius};case`LWPOLYLINE`:case`POLYLINE`:{if(e.vertices.length===0)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e.vertices)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}case`ELLIPSE`:{let t=Math.sqrt(e.majorAxis.x**2+e.majorAxis.y**2);return{minX:e.center.x-t,minY:e.center.y-t,maxX:e.center.x+t,maxY:e.center.y+t}}case`TEXT`:return{minX:e.insertionPoint.x,minY:e.insertionPoint.y,maxX:e.insertionPoint.x+e.height*e.text.length*.6,maxY:e.insertionPoint.y+e.height};case`MTEXT`:return{minX:e.insertionPoint.x,minY:e.insertionPoint.y-e.height,maxX:e.insertionPoint.x+(e.width||e.height*10),maxY:e.insertionPoint.y+e.height};case`SPLINE`:{if(e.controlPoints.length===0)return null;let t=1/0,n=1/0,r=-1/0,i=-1/0;for(let a of e.controlPoints)t=Math.min(t,a.x),n=Math.min(n,a.y),r=Math.max(r,a.x),i=Math.max(i,a.y);return{minX:t,minY:n,maxX:r,maxY:i}}case`POINT`:return{minX:e.position.x,minY:e.position.y,maxX:e.position.x,maxY:e.position.y};case`INSERT`:return{minX:e.insertionPoint.x,minY:e.insertionPoint.y,maxX:e.insertionPoint.x,maxY:e.insertionPoint.y};case`DIMENSION`:return e.defPoint?{minX:Math.min(e.defPoint.x,e.defPoint2?.x??e.defPoint.x,e.defPoint3?.x??e.defPoint.x),minY:Math.min(e.defPoint.y,e.defPoint2?.y??e.defPoint.y,e.defPoint3?.y??e.defPoint.y),maxX:Math.max(e.defPoint.x,e.defPoint2?.x??e.defPoint.x,e.defPoint3?.x??e.defPoint.x),maxY:Math.max(e.defPoint.y,e.defPoint2?.y??e.defPoint.y,e.defPoint3?.y??e.defPoint.y)}:null;case`HATCH`:{let t=1/0,n=1/0,r=-1/0,i=-1/0,a=!1;for(let o of e.boundaryPaths)if(o.vertices)for(let e of o.vertices)a=!0,t=Math.min(t,e.x),n=Math.min(n,e.y),r=Math.max(r,e.x),i=Math.max(i,e.y);return a?{minX:t,minY:n,maxX:r,maxY:i}:null}default:return null}}var Qe=new Set([`LINE`,`ARC`,`CIRCLE`,`LWPOLYLINE`,`POLYLINE`,`ELLIPSE`,`SPLINE`]);function G(e){return Qe.has(e)}function $e(e,t){e.moveTo(t.start.x,t.start.y),e.lineTo(t.end.x,t.end.y)}function et(e,t){if(t.radius<=0)return;let n=t.startAngle*Math.PI/180,r=t.endAngle*Math.PI/180;e.moveTo(t.center.x+t.radius*Math.cos(n),t.center.y+t.radius*Math.sin(n)),e.arc(t.center.x,t.center.y,t.radius,n,r,!1)}function tt(e,t){t.radius<=0||(e.moveTo(t.center.x+t.radius,t.center.y),e.arc(t.center.x,t.center.y,t.radius,0,Math.PI*2))}function nt(e,t){let n=t.vertices;if(n.length<2)return;e.moveTo(n[0].x,n[0].y);let r=t.closed?n.length:n.length-1;for(let t=0;t<r;t++){let r=n[t],i=n[(t+1)%n.length];Math.abs(r.bulge)<1e-10?e.lineTo(i.x,i.y):L(e,r.x,r.y,i.x,i.y,r.bulge)}}function rt(e,t){let n=t.vertices;if(n.length<2)return;e.moveTo(n[0].x,n[0].y);let r=t.closed?n.length:n.length-1;for(let t=0;t<r;t++){let r=n[t],i=n[(t+1)%n.length],a=r.bulge??0;Math.abs(a)<1e-10?e.lineTo(i.x,i.y):L(e,r.x,r.y,i.x,i.y,a)}}function it(e,t){let n=Math.sqrt(t.majorAxis.x**2+t.majorAxis.y**2+t.majorAxis.z**2);if(n<1e-10||t.minorRatio<=0)return;let r=n*t.minorRatio,i=Math.atan2(t.majorAxis.y,t.majorAxis.x),a=Math.cos(i),o=Math.sin(i),s=Math.cos(t.startParam),c=Math.sin(t.startParam);e.moveTo(t.center.x+n*a*s-r*o*c,t.center.y+n*o*s+r*a*c),e.ellipse(t.center.x,t.center.y,n,r,i,t.startParam,t.endParam,!1)}function at(e,t,n){let r=R(t,n);if(!(r.length<2)){e.moveTo(r[0].x,r[0].y);for(let t=1;t<r.length;t++)e.lineTo(r[t].x,r[t].y);t.flags&1&&e.closePath()}}function K(e,t,n){switch(t.type){case`LINE`:$e(e,t);break;case`ARC`:et(e,t);break;case`CIRCLE`:tt(e,t);break;case`LWPOLYLINE`:nt(e,t);break;case`POLYLINE`:rt(e,t);break;case`ELLIPSE`:it(e,t);break;case`SPLINE`:at(e,t,n);break}}var ot=100,st=.5;function ct(e,t,n,r,i,a,o=0,s){if(o>ot)return;let c=n.blocks.get(t.blockName);if(!c)return;let l=Math.max(1,t.columnCount),u=Math.max(1,t.rowCount);for(let d=0;d<u;d++)for(let u=0;u<l;u++){e.save();let l=t.insertionPoint.x+u*t.columnSpacing,f=t.insertionPoint.y+d*t.rowSpacing;e.translate(l,f),t.rotation&&e.rotate(t.rotation*Math.PI/180),e.scale(t.scaleX,t.scaleY),e.translate(-c.basePoint.x,-c.basePoint.y);let p=a/(Math.max(Math.abs(t.scaleX),Math.abs(t.scaleY))||1),m=null,h=c.entities;for(let a=0;a<h.length;a++){let c=h[a];if(c.type!==`INSERT`){let e=Ze(t.blockName,a),n=e===void 0?W(c):e;if(n){let e=Math.max(n.maxX-n.minX,n.maxY-n.minY);if(e>0&&e/p<st)continue}}let l=I(c,n.layers,i);c.type!==`INSERT`&&G(c.type)?(l!==m&&(m!==null&&(e.stroke(),s&&s.drawCalls++),m=l,e.beginPath(),e.strokeStyle=l,e.lineWidth=p),K(e,c,p),s&&(s.byType[c.type]=(s.byType[c.type]??0)+1)):(m!==null&&(e.stroke(),s&&s.drawCalls++,m=null),e.strokeStyle=l,e.fillStyle=l,e.lineWidth=p,c.type===`INSERT`?ct(e,c,n,r,i,p,o+1,s):q(e,c,n,r,i,p,s))}m!==null&&(e.stroke(),s&&s.drawCalls++),e.restore()}}function lt(e,t,n,r,i,a,o){if(t.blockName){let s=n.blocks.get(t.blockName);if(s){for(let t of s.entities){let s=I(t,n.layers,i);e.strokeStyle=s,e.fillStyle=s,e.lineWidth=a,q(e,t,n,r,i,a,o)}return}}t.defPoint2&&t.defPoint3&&(e.beginPath(),e.moveTo(t.defPoint2.x,t.defPoint2.y),e.lineTo(t.defPoint.x,t.defPoint.y),e.stroke(),e.beginPath(),e.moveTo(t.defPoint3.x,t.defPoint3.y),e.lineTo(t.defPoint.x,t.defPoint.y),e.stroke())}function ut(e,t){if(t.boundaryPaths.length!==0){e.beginPath();for(let n of t.boundaryPaths)if(n.type===`polyline`&&n.vertices&&n.vertices.length>0){let t=n.vertices[0];e.moveTo(t.x,t.y);for(let t=1;t<n.vertices.length;t++){let r=n.vertices[t-1],i=n.vertices[t],a=n.bulges?.[t-1]??0;Math.abs(a)<1e-10?e.lineTo(i.x,i.y):L(e,r.x,r.y,i.x,i.y,a)}n.isClosed&&e.closePath()}else if(n.type===`edges`&&n.edges)for(let t=0;t<n.edges.length;t++){let r=n.edges[t];if(r.type===`line`)t===0&&e.moveTo(r.start.x,r.start.y),e.lineTo(r.end.x,r.end.y);else if(r.type===`arc`){if(t===0){let t=r.center.x+r.radius*Math.cos(r.startAngle*Math.PI/180),n=r.center.y+r.radius*Math.sin(r.startAngle*Math.PI/180);e.moveTo(t,n)}e.arc(r.center.x,r.center.y,r.radius,r.startAngle*Math.PI/180,r.endAngle*Math.PI/180,!r.ccw)}}t.solidFill&&(e.globalAlpha=.3,e.fill(`evenodd`),e.globalAlpha=1),e.stroke()}}function dt(e,t,n){let r=n*3;e.beginPath(),e.arc(t.position.x,t.position.y,r,0,Math.PI*2),e.fill()}function q(e,t,n,r,i,a,o){switch(o&&(o.drawCalls++,o.byType[t.type]=(o.byType[t.type]??0)+1),t.type){case`LINE`:Me(e,t);break;case`CIRCLE`:Ne(e,t);break;case`ARC`:Pe(e,t);break;case`LWPOLYLINE`:Ie(e,t);break;case`POLYLINE`:Le(e,t);break;case`ELLIPSE`:Re(e,t);break;case`SPLINE`:Ve(e,t,a);break;case`TEXT`:Ue(e,t,a);break;case`MTEXT`:Ge(e,t,a);break;case`INSERT`:ct(e,t,n,r,i,a,0,o);break;case`DIMENSION`:lt(e,t,n,r,i,a,o);break;case`HATCH`:ut(e,t);break;case`POINT`:dt(e,t,a);break}}var ft=.5,pt=class{constructor(e){this.canvas=e;let t=e.getContext(`2d`,{alpha:!1});if(!t)throw Error(`Failed to get 2D rendering context. The canvas may already have a different context type, or canvas rendering is not available in this environment.`);this.ctx=t,this.updateSize()}ctx;width=0;height=0;getContext(){return this.ctx}getWidth(){return this.width}getHeight(){return this.height}updateSize(){let e=window.devicePixelRatio||1,t=this.canvas.getBoundingClientRect();this.width=t.width,this.height=t.height,this.canvas.width=t.width*e,this.canvas.height=t.height*e}render(e,t,n,r,i,a,o){let s=this.ctx,c=window.devicePixelRatio||1,l={entitiesDrawn:0,entitiesSkipped:0,drawCalls:0,byType:{}};s.setTransform(c,0,0,c,0,0),s.fillStyle=M[n].backgroundColor,s.fillRect(0,0,this.width,this.height),Oe(s,t);let u=1/t.scale;s.lineCap=`round`,s.lineJoin=`round`;let d=null;for(let i=0;i<e.entities.length;i++){let c=e.entities[i];if(!c.visible){l.entitiesSkipped++;continue}if(!r.has(c.layer)){l.entitiesSkipped++;continue}if(a&&!a.has(i)){l.entitiesSkipped++;continue}if(o){let e=o[i];if(e){let n=(e.maxX-e.minX)*t.scale,r=(e.maxY-e.minY)*t.scale;if(Math.max(n,r)<ft){l.entitiesSkipped++;continue}}}let f=I(c,e.layers,n);G(c.type)?(f!==d&&(d!==null&&(s.stroke(),l.drawCalls++),d=f,s.beginPath(),s.strokeStyle=f,s.lineWidth=u),K(s,c,u),l.entitiesDrawn++,l.byType[c.type]=(l.byType[c.type]??0)+1):(d!==null&&(s.stroke(),l.drawCalls++,d=null),s.strokeStyle=f,s.fillStyle=f,s.lineWidth=u,l.entitiesDrawn++,q(s,c,e,t,n,u,l))}if(d!==null&&(s.stroke(),l.drawCalls++),i>=0&&i<e.entities.length){let r=e.entities[i];Oe(s,t),s.strokeStyle=M[n].selectionColor,s.fillStyle=M[n].selectionColor,s.lineWidth=u*3,q(s,r,e,t,n,u)}return l}renderEmpty(e){let t=this.ctx,n=window.devicePixelRatio||1;t.setTransform(n,0,0,n,0,0),t.fillStyle=M[e].backgroundColor,t.fillRect(0,0,this.width,this.height)}destroy(){}},mt={showFps:!0,showRenderStats:!0,showDocumentInfo:!0,showTimings:!0,showCamera:!0,position:`top-left`};function J(e){return{...mt,...e}}function ht(e){return e===0?`0 B`:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function gt(e){return e>=1?`${e.toFixed(2)}x`:`1:${(1/e).toFixed(1)}`}var _t=`11px monospace`,vt=15,yt=8,Y=8,X=10;function bt(e,t,n,r,i,a){e.setTransform(1,0,0,1,0,0);let o=[];if(r.showFps&&o.push([`FPS: ${t.fps} Frame: ${t.frameTime.toFixed(1)}ms`]),r.showRenderStats){let e=t.renderStats.entitiesDrawn+t.renderStats.entitiesSkipped,n=[`Drawn: ${t.renderStats.entitiesDrawn} / ${e} Calls: ${t.renderStats.drawCalls}`],r=Object.entries(t.renderStats.byType).sort(([,e],[,t])=>t-e).slice(0,6).map(([e,t])=>`${e}: ${t}`).join(` `);r&&n.push(r),o.push(n)}if(r.showDocumentInfo){let e=[`Layers: ${t.visibleLayerCount} / ${t.layerCount} Blocks: ${t.blockCount}`];t.dxfVersion&&e.push(`DXF: ${t.dxfVersion}`),t.fileName&&e.push(`File: ${t.fileName}`),t.fileSize>0&&e.push(`Size: ${ht(t.fileSize)}`),o.push(e)}if(r.showTimings){let e=[];t.parseTime>0&&e.push(`Parse: ${t.parseTime.toFixed(0)}ms`),t.spatialIndexBuildTime>0&&e.push(`Index: ${t.spatialIndexBuildTime.toFixed(0)}ms`),t.totalLoadTime>0&&e.push(`Load: ${t.totalLoadTime.toFixed(0)}ms`),e.length>0&&o.push([e.join(` `)])}if(r.showCamera){let e=t.viewportBounds;o.push([`Zoom: ${gt(t.zoom)} Pixel: ${t.pixelSize.toFixed(2)}`,`View: [${e.minX.toFixed(0)}, ${e.minY.toFixed(0)}] \u2192 [${e.maxX.toFixed(0)}, ${e.maxY.toFixed(0)}]`])}if(o.length===0)return;e.font=_t;let s=[];for(let e=0;e<o.length;e++){e>0&&s.push({text:``,isSeparator:!0});for(let t of o[e])s.push({text:t,isSeparator:!1})}let c=0;for(let t of s)if(!t.isSeparator){let n=e.measureText(t.text).width;n>c&&(c=n)}let l=c+Y*2,u=Y*2;for(let e of s)u+=e.isSeparator?yt:vt;let d,f;switch(r.position){case`top-left`:d=X,f=X;break;case`top-right`:d=i-l-X,f=X;break;case`bottom-left`:d=X,f=a-u-X;break;case`bottom-right`:d=i-l-X,f=a-u-X;break}let p=M[n];e.fillStyle=n===`dark`?`rgba(0, 0, 0, 0.75)`:`rgba(255, 255, 255, 0.85)`,e.fillRect(d,f,l,u),e.strokeStyle=n===`dark`?`rgba(255, 255, 255, 0.15)`:`rgba(0, 0, 0, 0.15)`,e.lineWidth=1,e.strokeRect(d+.5,f+.5,l-1,u-1),e.fillStyle=n===`dark`?p.defaultEntityColor:`rgba(0, 0, 0, 0.85)`,e.textAlign=`left`,e.textBaseline=`top`;let m=f+Y;for(let t of s)t.isSeparator?m+=yt:(e.fillText(t.text,d+Y,m),m+=vt)}var xt=class{layers=new Map;visibility=new Map;colorOverrides=new Map;visibleCache=null;setLayers(e){this.layers=new Map(e),this.visibility.clear(),this.colorOverrides.clear(),this.visibleCache=null;for(let[e,t]of this.layers)this.visibility.set(e,!t.isOff&&!t.isFrozen)}getAllLayers(){return Array.from(this.layers.values())}setVisible(e,t){this.visibility.set(e,t),this.visibleCache=null}isVisible(e){return this.visibility.get(e)??!0}setColorOverride(e,t){this.colorOverrides.set(e,t)}getColorOverride(e){return this.colorOverrides.get(e)}getVisibleLayerNames(){if(this.visibleCache)return this.visibleCache;let e=new Set;for(let[t,n]of this.visibility)n&&e.add(t);return this.visibleCache=e,e}clear(){this.layers.clear(),this.visibility.clear(),this.colorOverrides.clear(),this.visibleCache=null}},St=class{listeners=new Map;on(e,t){this.listeners.has(e)||this.listeners.set(e,new Set),this.listeners.get(e).add(t)}off(e,t){this.listeners.get(e)?.delete(t)}emit(e,t){let n=this.listeners.get(e);if(n)for(let e of n)e(t)}removeAllListeners(){this.listeners.clear()}},Ct=class{constructor(e,t){this.canvas=e,this.viewer=t,this.onPointerDown=this.handlePointerDown.bind(this),this.onPointerMove=this.handlePointerMove.bind(this),this.onPointerUp=this.handlePointerUp.bind(this),this.onWheel=this.handleWheel.bind(this),this.onTouchStart=this.handleTouchStart.bind(this),this.onTouchMove=this.handleTouchMove.bind(this),this.onTouchEnd=this.handleTouchEnd.bind(this),this.onContextMenu=e=>e.preventDefault(),e.addEventListener(`pointerdown`,this.onPointerDown),e.addEventListener(`pointermove`,this.onPointerMove),e.addEventListener(`pointerup`,this.onPointerUp),e.addEventListener(`wheel`,this.onWheel,{passive:!1}),e.addEventListener(`touchstart`,this.onTouchStart,{passive:!1}),e.addEventListener(`touchmove`,this.onTouchMove,{passive:!1}),e.addEventListener(`touchend`,this.onTouchEnd),e.addEventListener(`contextmenu`,this.onContextMenu)}isPanning=!1;lastX=0;lastY=0;touches=new Map;onPointerDown;onPointerMove;onPointerUp;onWheel;onTouchStart;onTouchMove;onTouchEnd;onContextMenu;destroy(){this.canvas.removeEventListener(`pointerdown`,this.onPointerDown),this.canvas.removeEventListener(`pointermove`,this.onPointerMove),this.canvas.removeEventListener(`pointerup`,this.onPointerUp),this.canvas.removeEventListener(`wheel`,this.onWheel),this.canvas.removeEventListener(`touchstart`,this.onTouchStart),this.canvas.removeEventListener(`touchmove`,this.onTouchMove),this.canvas.removeEventListener(`touchend`,this.onTouchEnd),this.canvas.removeEventListener(`contextmenu`,this.onContextMenu)}handlePointerDown(e){let t=this.viewer.getTool(),n=this.canvas.getBoundingClientRect(),r=e.clientX-n.left,i=e.clientY-n.top;e.button===0&&t===`pan`||e.button===1?this.startPan(e,r,i):e.button===0&&(t===`select`||t===`measure`)&&this.viewer.handleClick(r,i)}startPan(e,t,n){this.isPanning=!0,this.lastX=t,this.lastY=n,this.canvas.setPointerCapture(e.pointerId),this.canvas.style.cursor=`grabbing`}handlePointerMove(e){let t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;if(this.isPanning){let e=n-this.lastX,t=r-this.lastY;this.lastX=n,this.lastY=r,this.viewer.handlePan(e,t)}else this.viewer.handleMouseMove(n,r)}handlePointerUp(e){this.isPanning&&(this.isPanning=!1,this.canvas.releasePointerCapture(e.pointerId),this.canvas.style.cursor=this.viewer.getTool()===`pan`?`grab`:`crosshair`)}handleWheel(e){e.preventDefault();let t=this.canvas.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top,i=-Math.sign(e.deltaY),a=this.viewer.getZoomSpeed(),o=i>0?a:1/a;this.viewer.handleZoom(n,r,o)}handleTouchStart(e){e.preventDefault();for(let t of Array.from(e.changedTouches))this.touches.set(t.identifier,{x:t.clientX,y:t.clientY})}handleTouchMove(e){if(e.preventDefault(),this.touches.size===2&&e.touches.length===2){let t=e.touches[0],n=e.touches[1],r=Array.from(this.touches.values()),i=Math.hypot(r[0].x-r[1].x,r[0].y-r[1].y),a=Math.hypot(t.clientX-n.clientX,t.clientY-n.clientY);if(i>0){let e=a/i,o=this.canvas.getBoundingClientRect(),s=(r[0].x+r[1].x)/2-o.left,c=(r[0].y+r[1].y)/2-o.top,l=(t.clientX+n.clientX)/2-o.left,u=(t.clientY+n.clientY)/2-o.top;this.viewer.handleZoom(s,c,e),this.viewer.handlePan(l-s,u-c)}}else if(this.touches.size===1&&e.touches.length===1){let t=e.touches[0],n=this.touches.get(t.identifier);n&&this.viewer.handlePan(t.clientX-n.x,t.clientY-n.y)}for(let t of Array.from(e.changedTouches))this.touches.set(t.identifier,{x:t.clientX,y:t.clientY})}handleTouchEnd(e){for(let t of Array.from(e.changedTouches))this.touches.delete(t.identifier)}},wt=5,Tt=class{tree=new r;items=[];entityBBoxes=[];build(e,t){this.items=[],this.entityBBoxes=Array(e.length).fill(null);let n=t?new Map:void 0;for(let r=0;r<e.length;r++){let i=e[r],a=t&&n?V(i,t,n):W(i);this.entityBBoxes[r]=a,a&&this.items.push({...a,entityIndex:r})}this.tree.clear(),this.tree.load(this.items)}search(e,t,n,r){return this.tree.search({minX:e,minY:t,maxX:n,maxY:r})}getEntityBBox(e){return this.entityBBoxes[e]??null}getEntityBBoxes(){return this.entityBBoxes}clear(){this.tree.clear(),this.items=[],this.entityBBoxes=[]}};function Et(e,t,n,r,i,a){let o=wt/a,s=r.search(e-o,t-o,e+o,t+o),c=o,l=-1;for(let r=s.length-1;r>=0;r--){let a=s[r],o=n[a.entityIndex];if(!o||!i.has(o.layer)||!o.visible)continue;let u=Dt(e,t,o);u<c&&(c=u,l=a.entityIndex)}return l}function Dt(e,t,n){switch(n.type){case`LINE`:return Z(e,t,n.start.x,n.start.y,n.end.x,n.end.y);case`CIRCLE`:return Ot(e,t,n.center.x,n.center.y,n.radius);case`ARC`:return kt(e,t,n.center.x,n.center.y,n.radius,n.startAngle*Math.PI/180,n.endAngle*Math.PI/180);case`LWPOLYLINE`:case`POLYLINE`:{let r=1/0,i=n.vertices,a=n.closed?i.length:i.length-1;for(let n=0;n<a;n++){let a=i[n],o=i[(n+1)%i.length],s=Z(e,t,a.x,a.y,o.x,o.y);r=Math.min(r,s)}return r}case`ELLIPSE`:return jt(e,t,n.center.x,n.center.y,n.majorAxis,n.minorRatio);case`TEXT`:case`MTEXT`:{let r=W(n);return r?At(e,t,r.minX,r.minY,r.maxX,r.maxY):1/0}case`POINT`:return Math.hypot(e-n.position.x,t-n.position.y);case`SPLINE`:{let r=1/0,i=n.controlPoints;for(let n=0;n<i.length-1;n++){let a=Z(e,t,i[n].x,i[n].y,i[n+1].x,i[n+1].y);r=Math.min(r,a)}return r}default:return 1/0}}function Z(e,t,n,r,i,a){let o=i-n,s=a-r,c=o*o+s*s;if(c===0)return Math.hypot(e-n,t-r);let l=((e-n)*o+(t-r)*s)/c;l=Math.max(0,Math.min(1,l));let u=n+l*o,d=r+l*s;return Math.hypot(e-u,t-d)}function Ot(e,t,n,r,i){return Math.abs(Math.hypot(e-n,t-r)-i)}function kt(e,t,n,r,i,a,o){let s=(Math.atan2(t-r,e-n)%(2*Math.PI)+2*Math.PI)%(2*Math.PI),c=(a%(2*Math.PI)+2*Math.PI)%(2*Math.PI),l=(o%(2*Math.PI)+2*Math.PI)%(2*Math.PI);if(c<=l?s>=c&&s<=l:s>=c||s<=l)return Math.abs(Math.hypot(e-n,t-r)-i);let u=Math.hypot(e-(n+i*Math.cos(a)),t-(r+i*Math.sin(a))),d=Math.hypot(e-(n+i*Math.cos(o)),t-(r+i*Math.sin(o)));return Math.min(u,d)}function At(e,t,n,r,i,a){if(e>=n&&e<=i&&t>=r&&t<=a)return 0;let o=Math.max(n-e,0,e-i),s=Math.max(r-t,0,t-a);return Math.hypot(o,s)}function jt(e,t,n,r,i,a){let o=Math.atan2(i.y,i.x),s=Math.cos(-o),c=Math.sin(-o),l=(e-n)*s-(t-r)*c,u=(e-n)*c+(t-r)*s,d=Math.sqrt(i.x**2+i.y**2),f=d*a;if(d<1e-10)return Math.hypot(e-n,t-r);let p=d/f*u,m=Math.hypot(l,p);if(m<1e-10)return d;let h=l/m*d,g=u/m*f;return Math.hypot(l-h,u-g)}var Mt=class{state={phase:`idle`};currentSnap=null;activate(){this.state={phase:`first-point`},this.currentSnap=null}deactivate(){this.state={phase:`idle`},this.currentSnap=null}handleClick(e,t,n){let r=n?n.point:{x:e,y:t};switch(this.state.phase){case`first-point`:return this.state={phase:`second-point`,firstPoint:r,firstSnap:n??void 0},null;case`second-point`:{let e=this.state.firstPoint,t=r,n=t.x-e.x,i=t.y-e.y,a=Math.sqrt(n*n+i*i),o=Math.atan2(i,n)*180/Math.PI;return this.state={phase:`done`,firstPoint:e,secondPoint:t,distance:a,angle:o},{distance:a,angle:o,deltaX:n,deltaY:i,points:[e,t]}}case`done`:return this.state={phase:`second-point`,firstPoint:r},null;default:return null}}handleMove(e){this.currentSnap=e}};function Nt(e,t,n,r,i,a=new Set([`endpoint`,`midpoint`,`center`])){let o=10/i,s=[],c=r.search(e-o,t-o,e+o,t+o);for(let r of c){let i=n[r.entityIndex];if(!i)continue;let c=r.entityIndex;switch(i.type){case`LINE`:a.has(`endpoint`)&&(Q(s,i.start.x,i.start.y,`endpoint`,c,e,t,o),Q(s,i.end.x,i.end.y,`endpoint`,c,e,t,o)),a.has(`midpoint`)&&Q(s,(i.start.x+i.end.x)/2,(i.start.y+i.end.y)/2,`midpoint`,c,e,t,o);break;case`CIRCLE`:if(a.has(`center`)&&Q(s,i.center.x,i.center.y,`center`,c,e,t,o),a.has(`endpoint`))for(let n of[0,Math.PI/2,Math.PI,3*Math.PI/2])Q(s,i.center.x+i.radius*Math.cos(n),i.center.y+i.radius*Math.sin(n),`endpoint`,c,e,t,o);break;case`ARC`:if(a.has(`center`)&&Q(s,i.center.x,i.center.y,`center`,c,e,t,o),a.has(`endpoint`)){let n=i.startAngle*Math.PI/180,r=i.endAngle*Math.PI/180;Q(s,i.center.x+i.radius*Math.cos(n),i.center.y+i.radius*Math.sin(n),`endpoint`,c,e,t,o),Q(s,i.center.x+i.radius*Math.cos(r),i.center.y+i.radius*Math.sin(r),`endpoint`,c,e,t,o)}break;case`LWPOLYLINE`:case`POLYLINE`:if(a.has(`endpoint`))for(let n of i.vertices)Q(s,n.x,n.y,`endpoint`,c,e,t,o);if(a.has(`midpoint`))for(let n=0;n<i.vertices.length-1;n++){let r=i.vertices[n],a=i.vertices[n+1];Q(s,(r.x+a.x)/2,(r.y+a.y)/2,`midpoint`,c,e,t,o)}break;case`ELLIPSE`:a.has(`center`)&&Q(s,i.center.x,i.center.y,`center`,c,e,t,o);break;case`TEXT`:a.has(`endpoint`)&&Q(s,i.insertionPoint.x,i.insertionPoint.y,`endpoint`,c,e,t,o);break;case`MTEXT`:a.has(`endpoint`)&&Q(s,i.insertionPoint.x,i.insertionPoint.y,`endpoint`,c,e,t,o);break}}return s.sort((n,r)=>Math.hypot(n.point.x-e,n.point.y-t)-Math.hypot(r.point.x-e,r.point.y-t)),s}function Q(e,t,n,r,i,a,o,s){Math.hypot(t-a,n-o)<=s&&e.push({point:{x:t,y:n},type:r,entityIndex:i})}function Pt(e,t,n,r,i,a){let o=M[a];e.setTransform(1,0,0,1,0,0);let s=n.state;if(n.currentSnap){let[r,i]=N(t,n.currentSnap.point.x,n.currentSnap.point.y);Ft(e,r,i,n.currentSnap.type,o.measureColor)}if(s.phase===`second-point`){let[c,l]=N(t,s.firstPoint.x,s.firstPoint.y),u,d;if(n.currentSnap){let[e,r]=N(t,n.currentSnap.point.x,n.currentSnap.point.y);u=e,d=r}else u=r,d=i;e.strokeStyle=o.measureColor,e.lineWidth=1.5,e.setLineDash([6,3]),e.beginPath(),e.moveTo(c,l),e.lineTo(u,d),e.stroke(),e.setLineDash([]),$(e,c,l,o.measureColor),$(e,u,d,o.measureColor);let f,p;n.currentSnap?(f=n.currentSnap.point.x,p=n.currentSnap.point.y):[f,p]=P(t,r,i);let m=Math.hypot(f-s.firstPoint.x,p-s.firstPoint.y);It(e,(c+u)/2,(l+d)/2,m,a)}if(s.phase===`done`){let[n,r]=N(t,s.firstPoint.x,s.firstPoint.y),[i,c]=N(t,s.secondPoint.x,s.secondPoint.y);e.strokeStyle=o.measureColor,e.lineWidth=2,e.beginPath(),e.moveTo(n,r),e.lineTo(i,c),e.stroke(),$(e,n,r,o.measureColor),$(e,i,c,o.measureColor),It(e,(n+i)/2,(r+c)/2,s.distance,a)}}function Ft(e,t,n,r,i){switch(e.strokeStyle=i,e.lineWidth=2,r){case`endpoint`:e.strokeRect(t-8/2,n-8/2,8,8);break;case`midpoint`:e.beginPath(),e.moveTo(t,n-8/2),e.lineTo(t+8/2,n+8/2),e.lineTo(t-8/2,n+8/2),e.closePath(),e.stroke();break;case`center`:e.beginPath(),e.arc(t,n,8/2,0,Math.PI*2),e.stroke();break;case`nearest`:e.beginPath(),e.moveTo(t-8/2,n-8/2),e.lineTo(t+8/2,n+8/2),e.moveTo(t+8/2,n-8/2),e.lineTo(t-8/2,n+8/2),e.stroke();break}}function $(e,t,n,r){e.fillStyle=r,e.beginPath(),e.arc(t,n,4,0,Math.PI*2),e.fill()}function It(e,t,n,r,i){let a=r.toFixed(4);e.font=`13px monospace`,e.textAlign=`center`,e.textBaseline=`bottom`;let o=e.measureText(a),s=t-o.width/2-4,c=n-20,l=o.width+8;e.fillStyle=i===`dark`?`rgba(0,0,0,0.8)`:`rgba(255,255,255,0.9)`,e.fillRect(s,c,l,18),e.fillStyle=M[i].measureColor,e.fillText(a,t,n-6)}var Lt=class{worker=null;blobUrl=null;nextId=1;pending=new Map;getWorker(){return this.worker?this.worker:(this.blobUrl=URL.createObjectURL(new Blob(['"use strict";(()=>{function h(a){let e=a.replace(/\\r\\n?/g,`\n`),t=[],r=e.length,n=0;for(;n<r;){for(;n<r&&e.charCodeAt(n)===10;)n++;if(n>=r)break;let o=e.indexOf(`\n`,n);o===-1&&(o=r);let c=e.substring(n,o).trim();n=o+1;let s=parseInt(c,10);if(isNaN(s)){n<r&&(o=e.indexOf(`\n`,n),o===-1&&(o=r),n=o+1);continue}if(n>=r)break;o=e.indexOf(`\n`,n),o===-1&&(o=r);let p=e.substring(n,o).replace(/\\s+$/,"");n=o+1,t.push({code:s,value:p})}return t}function m(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDSEC")return e+1;if(r.code===9){let n=r.value;switch(e++,n){case"$ACADVER":e<a.length&&(t.acadVersion=a[e].value,e++);break;case"$EXTMIN":if(e<a.length){let o=v(a,e);t.extMin=o.point,e=o.nextIndex}break;case"$EXTMAX":if(e<a.length){let o=v(a,e);t.extMax=o.point,e=o.nextIndex}break;case"$INSUNITS":e<a.length&&(t.insUnits=parseInt(a[e].value,10),e++);break;case"$MEASUREMENT":e<a.length&&(t.measurement=parseInt(a[e].value,10),e++);break;case"$LTSCALE":e<a.length&&(t.ltScale=parseFloat(a[e].value),e++);break;case"$DWGCODEPAGE":e<a.length&&(t.dwgCodePage=a[e].value,e++);break;case"$HANDSEED":e<a.length&&(t.handleSeed=a[e].value,e++);break;default:for(;e<a.length&&a[e].code!==9&&a[e].code!==0;)t[n]=a[e].value,e++}}else e++}return e}function v(a,e){let t={x:0,y:0,z:0};for(;e<a.length;){let r=a[e].code;if(r===10)t.x=parseFloat(a[e].value),e++;else if(r===20)t.y=parseFloat(a[e].value),e++;else if(r===30)t.z=parseFloat(a[e].value),e++;else break}return{point:t,nextIndex:e}}function k(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDSEC")return e+1;if(r.code===0&&r.value==="TABLE"){if(e++,e>=a.length)break;let n=a[e].value;switch(e++,n){case"LAYER":e=H(a,e,t.layers);break;case"LTYPE":e=O(a,e,t.lineTypes);break;case"STYLE":e=_(a,e,t.styles);break;default:e=R(a,e);break}}else e++}return e}function R(a,e){for(;e<a.length;){if(a[e].code===0&&a[e].value==="ENDTAB")return e+1;e++}return e}function H(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDTAB")return e+1;if(r.code===0&&r.value==="LAYER"){e++;let n={name:"0",color:7,lineType:"Continuous",flags:0,lineWeight:-3,isOff:!1,isFrozen:!1,isLocked:!1};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 2:n.name=o.value;break;case 6:n.lineType=o.value;break;case 62:n.color=parseInt(o.value,10);break;case 70:n.flags=parseInt(o.value,10);break;case 370:n.lineWeight=parseInt(o.value,10);break;case 420:n.trueColor=parseInt(o.value,10);break}e++}t.set(n.name,n)}else e++}return e}function O(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDTAB")return e+1;if(r.code===0&&r.value==="LTYPE"){e++;let n={name:"",description:"",pattern:[],totalLength:0};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 2:n.name=o.value;break;case 3:n.description=o.value;break;case 40:n.totalLength=parseFloat(o.value);break;case 49:n.pattern.push(parseFloat(o.value));break}e++}n.name&&t.set(n.name,n)}else e++}return e}function _(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDTAB")return e+1;if(r.code===0&&r.value==="STYLE"){e++;let n={name:"",fontName:"",bigFontName:"",height:0,widthFactor:1,obliqueAngle:0};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 2:n.name=o.value;break;case 3:n.fontName=o.value;break;case 4:n.bigFontName=o.value;break;case 40:n.height=parseFloat(o.value);break;case 41:n.widthFactor=parseFloat(o.value);break;case 50:n.obliqueAngle=parseFloat(o.value);break}e++}n.name&&t.set(n.name,n)}else e++}return e}function l(a){let e={type:"",layer:"0",color:256,lineType:"BYLAYER",lineTypeScale:1,lineWeight:-1,visible:!0,extrusion:{x:0,y:0,z:1}};for(let t of a)switch(t.code){case 5:e.handle=t.value;break;case 8:e.layer=t.value;break;case 6:e.lineType=t.value;break;case 48:e.lineTypeScale=parseFloat(t.value);break;case 60:e.visible=t.value==="0"||t.value==="";break;case 62:e.color=parseInt(t.value,10);break;case 370:e.lineWeight=parseInt(t.value,10);break;case 420:e.trueColor=parseInt(t.value,10);break;case 210:e.extrusion.x=parseFloat(t.value);break;case 220:e.extrusion.y=parseFloat(t.value);break;case 230:e.extrusion.z=parseFloat(t.value);break}return e}function D(a){let t={...l(a),type:"LINE",start:{x:0,y:0,z:0},end:{x:0,y:0,z:0}};for(let r of a)switch(r.code){case 10:t.start.x=parseFloat(r.value);break;case 20:t.start.y=parseFloat(r.value);break;case 30:t.start.z=parseFloat(r.value);break;case 11:t.end.x=parseFloat(r.value);break;case 21:t.end.y=parseFloat(r.value);break;case 31:t.end.z=parseFloat(r.value);break}return t}function F(a){let t={...l(a),type:"CIRCLE",center:{x:0,y:0,z:0},radius:0};for(let r of a)switch(r.code){case 10:t.center.x=parseFloat(r.value);break;case 20:t.center.y=parseFloat(r.value);break;case 30:t.center.z=parseFloat(r.value);break;case 40:t.radius=parseFloat(r.value);break}return t}function E(a){let t={...l(a),type:"ARC",center:{x:0,y:0,z:0},radius:0,startAngle:0,endAngle:360};for(let r of a)switch(r.code){case 10:t.center.x=parseFloat(r.value);break;case 20:t.center.y=parseFloat(r.value);break;case 30:t.center.z=parseFloat(r.value);break;case 40:t.radius=parseFloat(r.value);break;case 50:t.startAngle=parseFloat(r.value);break;case 51:t.endAngle=parseFloat(r.value);break}return t}function P(a){let t={...l(a),type:"LWPOLYLINE",vertices:[],closed:!1,constantWidth:0,elevation:0},r=null;for(let n of a)switch(n.code){case 70:t.closed=(parseInt(n.value,10)&1)!==0;break;case 38:t.elevation=parseFloat(n.value);break;case 43:t.constantWidth=parseFloat(n.value);break;case 10:r&&t.vertices.push(r),r={x:parseFloat(n.value),y:0,bulge:0,startWidth:0,endWidth:0};break;case 20:r&&(r.y=parseFloat(n.value));break;case 40:r&&(r.startWidth=parseFloat(n.value));break;case 41:r&&(r.endWidth=parseFloat(n.value));break;case 42:r&&(r.bulge=parseFloat(n.value));break}return r&&t.vertices.push(r),t}function T(a){let t={...l(a),type:"POLYLINE",vertices:[],closed:!1,is3d:!1};for(let r of a)if(r.code===70){let n=parseInt(r.value,10);t.closed=(n&1)!==0,t.is3d=(n&8)!==0}return t}function w(a){let t={...l(a),type:"ELLIPSE",center:{x:0,y:0,z:0},majorAxis:{x:1,y:0,z:0},minorRatio:1,startParam:0,endParam:Math.PI*2};for(let r of a)switch(r.code){case 10:t.center.x=parseFloat(r.value);break;case 20:t.center.y=parseFloat(r.value);break;case 30:t.center.z=parseFloat(r.value);break;case 11:t.majorAxis.x=parseFloat(r.value);break;case 21:t.majorAxis.y=parseFloat(r.value);break;case 31:t.majorAxis.z=parseFloat(r.value);break;case 40:t.minorRatio=parseFloat(r.value);break;case 41:t.startParam=parseFloat(r.value);break;case 42:t.endParam=parseFloat(r.value);break}return t}function g(a){let t={...l(a),type:"SPLINE",degree:3,flags:0,knots:[],controlPoints:[],fitPoints:[],weights:[]},r=null,n=null;for(let o of a)switch(o.code){case 70:t.flags=parseInt(o.value,10);break;case 71:t.degree=parseInt(o.value,10);break;case 40:t.knots.push(parseFloat(o.value));break;case 41:t.weights.push(parseFloat(o.value));break;case 10:r&&t.controlPoints.push(r),r={x:parseFloat(o.value),y:0,z:0};break;case 20:r&&(r.y=parseFloat(o.value));break;case 30:r&&(r.z=parseFloat(o.value));break;case 11:n&&t.fitPoints.push(n),n={x:parseFloat(o.value),y:0,z:0};break;case 21:n&&(n.y=parseFloat(o.value));break;case 31:n&&(n.z=parseFloat(o.value));break;case 12:t.startTangent||(t.startTangent={x:0,y:0,z:0}),t.startTangent.x=parseFloat(o.value);break;case 22:t.startTangent&&(t.startTangent.y=parseFloat(o.value));break;case 32:t.startTangent&&(t.startTangent.z=parseFloat(o.value));break;case 13:t.endTangent||(t.endTangent={x:0,y:0,z:0}),t.endTangent.x=parseFloat(o.value);break;case 23:t.endTangent&&(t.endTangent.y=parseFloat(o.value));break;case 33:t.endTangent&&(t.endTangent.z=parseFloat(o.value));break}return r&&t.controlPoints.push(r),n&&t.fitPoints.push(n),t}function I(a){let t={...l(a),type:"TEXT",text:"",insertionPoint:{x:0,y:0,z:0},height:1,rotation:0,widthFactor:1,obliqueAngle:0,style:"STANDARD",hAlign:0,vAlign:0,generationFlags:0};for(let r of a)switch(r.code){case 1:t.text=r.value;break;case 10:t.insertionPoint.x=parseFloat(r.value);break;case 20:t.insertionPoint.y=parseFloat(r.value);break;case 30:t.insertionPoint.z=parseFloat(r.value);break;case 11:t.alignmentPoint||(t.alignmentPoint={x:0,y:0,z:0}),t.alignmentPoint.x=parseFloat(r.value);break;case 21:t.alignmentPoint||(t.alignmentPoint={x:0,y:0,z:0}),t.alignmentPoint.y=parseFloat(r.value);break;case 31:t.alignmentPoint||(t.alignmentPoint={x:0,y:0,z:0}),t.alignmentPoint.z=parseFloat(r.value);break;case 40:t.height=parseFloat(r.value);break;case 41:t.widthFactor=parseFloat(r.value);break;case 50:t.rotation=parseFloat(r.value);break;case 51:t.obliqueAngle=parseFloat(r.value);break;case 7:t.style=r.value;break;case 71:t.generationFlags=parseInt(r.value,10);break;case 72:t.hAlign=parseInt(r.value,10);break;case 73:t.vAlign=parseInt(r.value,10);break}return t}function A(a){let t={...l(a),type:"MTEXT",text:"",insertionPoint:{x:0,y:0,z:0},height:1,width:0,attachmentPoint:1,drawingDirection:1,rotation:0,lineSpacingStyle:1,lineSpacingFactor:1,style:"STANDARD",bgFill:0,bgFillScale:1.5},r=[];for(let n of a)switch(n.code){case 1:r.push(n.value);break;case 3:r.push(n.value);break;case 7:t.style=n.value;break;case 10:t.insertionPoint.x=parseFloat(n.value);break;case 20:t.insertionPoint.y=parseFloat(n.value);break;case 30:t.insertionPoint.z=parseFloat(n.value);break;case 11:t.textDirection||(t.textDirection={x:0,y:0,z:0}),t.textDirection.x=parseFloat(n.value);break;case 21:t.textDirection||(t.textDirection={x:0,y:0,z:0}),t.textDirection.y=parseFloat(n.value);break;case 31:t.textDirection||(t.textDirection={x:0,y:0,z:0}),t.textDirection.z=parseFloat(n.value);break;case 40:t.height=parseFloat(n.value);break;case 41:t.width=parseFloat(n.value);break;case 44:t.lineSpacingFactor=parseFloat(n.value);break;case 50:t.rotation=parseFloat(n.value);break;case 71:t.attachmentPoint=parseInt(n.value,10);break;case 72:t.drawingDirection=parseInt(n.value,10);break;case 73:t.lineSpacingStyle=parseInt(n.value,10);break;case 90:t.bgFill=parseInt(n.value,10);break}return t.text=r.join(""),t}function z(a){let t={...l(a),type:"INSERT",blockName:"",insertionPoint:{x:0,y:0,z:0},scaleX:1,scaleY:1,scaleZ:1,rotation:0,columnCount:1,rowCount:1,columnSpacing:0,rowSpacing:0,attribs:[]};for(let r of a)switch(r.code){case 2:t.blockName=r.value;break;case 10:t.insertionPoint.x=parseFloat(r.value);break;case 20:t.insertionPoint.y=parseFloat(r.value);break;case 30:t.insertionPoint.z=parseFloat(r.value);break;case 41:t.scaleX=parseFloat(r.value);break;case 42:t.scaleY=parseFloat(r.value);break;case 43:t.scaleZ=parseFloat(r.value);break;case 44:t.columnSpacing=parseFloat(r.value);break;case 45:t.rowSpacing=parseFloat(r.value);break;case 50:t.rotation=parseFloat(r.value);break;case 70:t.columnCount=parseInt(r.value,10)||1;break;case 71:t.rowCount=parseInt(r.value,10)||1;break}return t}function S(a){let t={...l(a),type:"DIMENSION",blockName:"",dimStyle:"STANDARD",dimType:0,defPoint:{x:0,y:0,z:0},textMidpoint:{x:0,y:0,z:0},textOverride:"",rotation:0,textRotation:0,leaderLength:0};for(let r of a)switch(r.code){case 1:t.textOverride=r.value;break;case 2:t.blockName=r.value;break;case 3:t.dimStyle=r.value;break;case 10:t.defPoint.x=parseFloat(r.value);break;case 20:t.defPoint.y=parseFloat(r.value);break;case 30:t.defPoint.z=parseFloat(r.value);break;case 11:t.textMidpoint.x=parseFloat(r.value);break;case 21:t.textMidpoint.y=parseFloat(r.value);break;case 31:t.textMidpoint.z=parseFloat(r.value);break;case 13:t.defPoint2||(t.defPoint2={x:0,y:0,z:0}),t.defPoint2.x=parseFloat(r.value);break;case 23:t.defPoint2||(t.defPoint2={x:0,y:0,z:0}),t.defPoint2.y=parseFloat(r.value);break;case 33:t.defPoint2||(t.defPoint2={x:0,y:0,z:0}),t.defPoint2.z=parseFloat(r.value);break;case 14:t.defPoint3||(t.defPoint3={x:0,y:0,z:0}),t.defPoint3.x=parseFloat(r.value);break;case 24:t.defPoint3||(t.defPoint3={x:0,y:0,z:0}),t.defPoint3.y=parseFloat(r.value);break;case 34:t.defPoint3||(t.defPoint3={x:0,y:0,z:0}),t.defPoint3.z=parseFloat(r.value);break;case 15:t.defPoint4||(t.defPoint4={x:0,y:0,z:0}),t.defPoint4.x=parseFloat(r.value);break;case 25:t.defPoint4||(t.defPoint4={x:0,y:0,z:0}),t.defPoint4.y=parseFloat(r.value);break;case 35:t.defPoint4||(t.defPoint4={x:0,y:0,z:0}),t.defPoint4.z=parseFloat(r.value);break;case 16:t.defPoint5||(t.defPoint5={x:0,y:0,z:0}),t.defPoint5.x=parseFloat(r.value);break;case 26:t.defPoint5||(t.defPoint5={x:0,y:0,z:0}),t.defPoint5.y=parseFloat(r.value);break;case 36:t.defPoint5||(t.defPoint5={x:0,y:0,z:0}),t.defPoint5.z=parseFloat(r.value);break;case 40:t.leaderLength=parseFloat(r.value);break;case 50:t.rotation=parseFloat(r.value);break;case 53:t.textRotation=parseFloat(r.value);break;case 70:t.dimType=parseInt(r.value,10);break}return t}function N(a){let t={...l(a),type:"HATCH",patternName:"",solidFill:!0,associative:!1,hatchStyle:0,patternType:1,patternAngle:0,patternScale:1,boundaryPaths:[]},r=0;for(;r<a.length;){let n=a[r];switch(n.code){case 2:t.patternName=n.value;break;case 41:t.patternScale=parseFloat(n.value);break;case 52:t.patternAngle=parseFloat(n.value);break;case 70:t.solidFill=n.value==="1";break;case 71:t.associative=n.value==="1";break;case 75:t.hatchStyle=parseInt(n.value,10);break;case 76:t.patternType=parseInt(n.value,10);break;case 91:{let o=parseInt(n.value,10);r++;for(let c=0;c<o&&r<a.length;c++){let s=W(a,r);t.boundaryPaths.push(s.path),r=s.nextIndex}continue}}r++}return t}function W(a,e){let t=0;return e<a.length&&a[e].code===92&&(t=parseInt(a[e].value,10),e++),(t&2)!==0?X(a,e,t):Y(a,e,t)}function X(a,e,t){let r={type:"polyline",vertices:[],bulges:[],flags:t},n=!1;e<a.length&&a[e].code===72&&(n=a[e].value==="1",e++),e<a.length&&a[e].code===73&&(r.isClosed=a[e].value==="1",e++);let o=0;e<a.length&&a[e].code===93&&(o=parseInt(a[e].value,10),e++);for(let c=0;c<o&&e<a.length;c++){let s={x:0,y:0};a[e].code===10&&(s.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===20&&(s.y=parseFloat(a[e].value),e++),r.vertices.push(s),n&&e<a.length&&a[e].code===42?(r.bulges.push(parseFloat(a[e].value)),e++):n&&r.bulges.push(0)}for(;e<a.length&&(a[e].code===97||a[e].code===330);)if(a[e].code===97){let c=parseInt(a[e].value,10);e++;for(let s=0;s<c&&e<a.length&&a[e].code===330;s++)e++}else e++;return{path:r,nextIndex:e}}function Y(a,e,t){let r={type:"edges",edges:[],flags:t},n=0;e<a.length&&a[e].code===93&&(n=parseInt(a[e].value,10),e++);for(let o=0;o<n&&e<a.length&&a[e].code===72;o++){let c=parseInt(a[e].value,10);switch(e++,c){case 1:{let s={type:"line",start:{x:0,y:0},end:{x:0,y:0}};e<a.length&&a[e].code===10&&(s.start.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===20&&(s.start.y=parseFloat(a[e].value),e++),e<a.length&&a[e].code===11&&(s.end.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===21&&(s.end.y=parseFloat(a[e].value),e++),r.edges.push(s);break}case 2:{let s={type:"arc",center:{x:0,y:0},radius:0,startAngle:0,endAngle:360,ccw:!0};e<a.length&&a[e].code===10&&(s.center.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===20&&(s.center.y=parseFloat(a[e].value),e++),e<a.length&&a[e].code===40&&(s.radius=parseFloat(a[e].value),e++),e<a.length&&a[e].code===50&&(s.startAngle=parseFloat(a[e].value),e++),e<a.length&&a[e].code===51&&(s.endAngle=parseFloat(a[e].value),e++),e<a.length&&a[e].code===73&&(s.ccw=a[e].value==="1",e++),r.edges.push(s);break}case 3:{let s={type:"ellipse",center:{x:0,y:0},majorAxis:{x:1,y:0},minorRatio:1,startAngle:0,endAngle:Math.PI*2,ccw:!0};e<a.length&&a[e].code===10&&(s.center.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===20&&(s.center.y=parseFloat(a[e].value),e++),e<a.length&&a[e].code===11&&(s.majorAxis.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===21&&(s.majorAxis.y=parseFloat(a[e].value),e++),e<a.length&&a[e].code===40&&(s.minorRatio=parseFloat(a[e].value),e++),e<a.length&&a[e].code===50&&(s.startAngle=parseFloat(a[e].value),e++),e<a.length&&a[e].code===51&&(s.endAngle=parseFloat(a[e].value),e++),e<a.length&&a[e].code===73&&(s.ccw=a[e].value==="1",e++),r.edges.push(s);break}case 4:{let s=3,p=[],b=[];e<a.length&&a[e].code===94&&(s=parseInt(a[e].value,10),e++),e<a.length&&a[e].code===73&&e++,e<a.length&&a[e].code===74&&e++;let d=0;e<a.length&&a[e].code===95&&(d=parseInt(a[e].value,10),e++);let x=0;e<a.length&&a[e].code===96&&(x=parseInt(a[e].value,10),e++);for(let f=0;f<d&&e<a.length&&a[e].code===40;f++)p.push(parseFloat(a[e].value)),e++;for(let f=0;f<x&&e<a.length;f++){let y={x:0,y:0};a[e].code===10&&(y.x=parseFloat(a[e].value),e++),e<a.length&&a[e].code===20&&(y.y=parseFloat(a[e].value),e++),b.push(y)}r.edges.push({type:"spline",degree:s,knots:p,controlPoints:b});break}default:break}}for(;e<a.length&&(a[e].code===97||a[e].code===330);)if(a[e].code===97){let o=parseInt(a[e].value,10);e++;for(let c=0;c<o&&e<a.length&&a[e].code===330;c++)e++}else e++;return{path:r,nextIndex:e}}function L(a){let t={...l(a),type:"POINT",position:{x:0,y:0,z:0}};for(let r of a)switch(r.code){case 10:t.position.x=parseFloat(r.value);break;case 20:t.position.y=parseFloat(r.value);break;case 30:t.position.z=parseFloat(r.value);break}return t}function u(a,e,t){for(;e<a.length;){let r=a[e];if(r.code!==0){e++;continue}let n=r.value;if(n==="ENDSEC"||n==="ENDBLK")return e+1;e++;let o=[];for(;e<a.length&&a[e].code!==0;)o.push(a[e]),e++;switch(n){case"LINE":t.push(D(o));break;case"CIRCLE":t.push(F(o));break;case"ARC":t.push(E(o));break;case"LWPOLYLINE":t.push(P(o));break;case"ELLIPSE":t.push(w(o));break;case"SPLINE":t.push(g(o));break;case"TEXT":t.push(I(o));break;case"MTEXT":t.push(A(o));break;case"INSERT":{let c=z(o);o.some(p=>p.code===66&&p.value==="1")&&(e=$(a,e,c.attribs)),t.push(c);break}case"DIMENSION":t.push(S(o));break;case"HATCH":t.push(N(o));break;case"POINT":t.push(L(o));break;case"POLYLINE":{let c=T(o);e=V(a,e,c.vertices),t.push(c);break}default:break}}return e}function V(a,e,t){for(;e<a.length;){if(a[e].code!==0){e++;continue}let r=a[e].value;if(r==="SEQEND")return e+1;if(r==="ENDSEC"||r==="ENDBLK")return e;if(r==="VERTEX"){e++;let n={x:0,y:0,bulge:0,startWidth:0,endWidth:0};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 10:n.x=parseFloat(o.value);break;case 20:n.y=parseFloat(o.value);break;case 42:n.bulge=parseFloat(o.value);break;case 40:n.startWidth=parseFloat(o.value);break;case 41:n.endWidth=parseFloat(o.value);break}e++}t.push(n)}else for(e++;e<a.length&&a[e].code!==0;)e++}return e}function $(a,e,t){for(;e<a.length;){if(a[e].code!==0){e++;continue}let r=a[e].value;if(r==="SEQEND")return e+1;if(r==="ENDSEC"||r==="ENDBLK")return e;if(r==="ATTRIB"){e++;let n={tag:"",text:"",insertionPoint:{x:0,y:0,z:0},height:1,rotation:0,style:"STANDARD",layer:"0",color:256};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 1:n.text=o.value;break;case 2:n.tag=o.value;break;case 7:n.style=o.value;break;case 8:n.layer=o.value;break;case 10:n.insertionPoint.x=parseFloat(o.value);break;case 20:n.insertionPoint.y=parseFloat(o.value);break;case 30:n.insertionPoint.z=parseFloat(o.value);break;case 40:n.height=parseFloat(o.value);break;case 50:n.rotation=parseFloat(o.value);break;case 62:n.color=parseInt(o.value,10);break}e++}t.push(n)}else for(e++;e<a.length&&a[e].code!==0;)e++}return e}function B(a,e,t){for(;e<a.length;){let r=a[e];if(r.code===0&&r.value==="ENDSEC")return e+1;if(r.code===0&&r.value==="BLOCK"){e++;let n={name:"",basePoint:{x:0,y:0,z:0},entities:[],flags:0};for(;e<a.length&&a[e].code!==0;){let o=a[e];switch(o.code){case 2:n.name=o.value;break;case 8:break;case 10:n.basePoint.x=parseFloat(o.value);break;case 20:n.basePoint.y=parseFloat(o.value);break;case 30:n.basePoint.z=parseFloat(o.value);break;case 70:n.flags=parseInt(o.value,10);break}e++}e=u(a,e,n.entities),n.name&&!n.name.startsWith("*Model_Space")&&!n.name.startsWith("*Paper_Space")&&t.set(n.name,n)}else e++}return e}var C="AutoCAD Binary DXF",U={ANSI_874:"windows-874",ANSI_932:"shift_jis",ANSI_936:"gbk",ANSI_949:"euc-kr",ANSI_950:"big5",ANSI_1250:"windows-1250",ANSI_1251:"windows-1251",ANSI_1252:"windows-1252",ANSI_1253:"windows-1253",ANSI_1254:"windows-1254",ANSI_1255:"windows-1255",ANSI_1256:"windows-1256",ANSI_1257:"windows-1257",ANSI_1258:"windows-1258"},G="AC1021";function K(){return{acadVersion:"",insUnits:0,measurement:0,ltScale:1}}function j(a){return a.replace(/\\\\U\\+([0-9A-Fa-f]{4})/g,(e,t)=>String.fromCodePoint(parseInt(t,16)))}function q(a){if(typeof a=="string")return j(a);let e=new Uint8Array(a);if(new TextDecoder("ascii").decode(e.slice(0,C.length))===C)throw new i("Binary DXF format is not supported. Please export as ASCII DXF.");let r=new TextDecoder("utf-8").decode(a),o=r.match(/\\$ACADVER[\\s\\S]*?\\n\\s*1\\s*\\n\\s*(\\S+)/)?.[1]??"";if(o&&o<G){let s=r.match(/\\$DWGCODEPAGE[\\s\\S]*?\\n\\s*3\\s*\\n\\s*(\\S+)/)?.[1]??"",p=U[s]??"windows-1252";p!=="utf-8"&&(r=new TextDecoder(p).decode(a))}return j(r)}function Q(a,e){for(;e<a.length;){if(a[e].code===0&&a[e].value==="ENDSEC")return e+1;e++}return e}function Z(a){a.layers.has("0")||a.layers.set("0",{name:"0",color:7,lineType:"Continuous",flags:0,lineWeight:-3,isOff:!1,isFrozen:!1,isLocked:!1})}function J(a){for(let[,e]of a.layers)e.isOff=e.color<0,e.isOff&&(e.color=Math.abs(e.color)),e.isFrozen=(e.flags&1)!==0,e.isLocked=(e.flags&4)!==0}var i=class extends Error{constructor(t,r){super(t);this.cause=r;this.name="DxfParseError"}};function M(a){if(typeof a=="string"){if(a.length===0)throw new i("Input is empty. Expected a DXF string or ArrayBuffer.")}else if(a instanceof ArrayBuffer){if(a.byteLength===0)throw new i("Input ArrayBuffer is empty.")}else throw new i("Invalid input type. Expected a string or ArrayBuffer.");let e;try{e=q(a)}catch(n){throw n instanceof i?n:new i("Failed to decode DXF input.",n)}let t;try{t=h(e)}catch(n){throw new i("Failed to tokenize DXF content.",n)}if(t.length===0)throw new i("DXF content produced no tokens. The input may not be a valid DXF file.");let r={header:K(),layers:new Map,lineTypes:new Map,styles:new Map,blocks:new Map,entities:[]};try{let n=0;for(;n<t.length;){let o=t[n];if(o.code===0&&o.value==="SECTION"){if(n++,n>=t.length)break;let c=t[n].value;switch(n++,c){case"HEADER":n=m(t,n,r.header);break;case"TABLES":n=k(t,n,r);break;case"BLOCKS":n=B(t,n,r.blocks);break;case"ENTITIES":n=u(t,n,r.entities);break;default:n=Q(t,n);break}}else{if(o.code===0&&o.value==="EOF")break;n++}}}catch(n){throw new i("Failed to parse DXF sections.",n)}return Z(r),J(r),r}self.onmessage=a=>{let{type:e,id:t,payload:r}=a.data;if(e==="parse")try{let n=M(r);postMessage({type:"result",id:t,doc:n})}catch(n){let o=n instanceof Error?n.message:String(n);postMessage({type:"error",id:t,message:o})}};})();\n'],{type:`text/javascript`})),this.worker=new Worker(this.blobUrl),this.worker.onmessage=e=>{let{type:t,id:n,doc:r,message:i}=e.data,a=this.pending.get(n);a&&(this.pending.delete(n),t===`result`?a.resolve(this.reviveDocument(r)):t===`error`&&a.reject(Error(i??`Worker parse failed`)))},this.worker.onerror=e=>{let t=Error(e.message??`Worker error`);for(let[,e]of this.pending)e.reject(t);this.pending.clear(),this.destroyWorker()},this.worker)}parse(e){return new Promise((t,n)=>{let r=this.nextId++;this.pending.set(r,{resolve:t,reject:n});let i;try{i=this.getWorker()}catch(e){this.pending.delete(r),n(e instanceof Error?e:Error(String(e)));return}let a={type:`parse`,id:r,payload:e};try{e instanceof ArrayBuffer?i.postMessage(a,[e]):i.postMessage(a)}catch(e){this.pending.delete(r),n(e instanceof Error?e:Error(String(e)))}})}terminate(){this.destroyWorker();let e=Error(`Worker terminated`);for(let[,t]of this.pending)t.reject(e);this.pending.clear()}destroyWorker(){this.worker&&=(this.worker.terminate(),null),this.blobUrl&&=(URL.revokeObjectURL(this.blobUrl),null)}reviveDocument(e){return{...e,layers:this.ensureMap(e.layers),lineTypes:this.ensureMap(e.lineTypes),styles:this.ensureMap(e.styles),blocks:this.ensureMap(e.blocks)}}ensureMap(e){return e instanceof Map?e:e&&typeof e==`object`?new Map(Object.entries(e)):new Map}},Rt=class{canvas;renderer;camera;layerManager;emitter;spatialIndex;measureTool;doc=null;options;currentTool;inputHandler;resizeObserver;formatConverters;workerManager=null;selectedEntityIndex=-1;renderPending=!1;destroyed=!1;loadGeneration=0;mouseScreenX=0;mouseScreenY=0;debugEnabled=!1;debugOptions;lastRenderStats=null;lastDebugStats=null;frameTimestamps=[];lastDoRenderTime=0;lastFrameTime=0;parseTime=0;spatialIndexBuildTime=0;loadedFileName=null;loadedFileSize=0;debugRafId=0;constructor(e,t){this.canvas=e,this.options={theme:t?.theme??`dark`,backgroundColor:t?.backgroundColor,antialias:t?.antialias??!0,minZoom:t?.minZoom??1e-4,maxZoom:t?.maxZoom??1e5,zoomSpeed:t?.zoomSpeed??1.1,initialTool:t?.initialTool??`pan`},this.formatConverters=t?.formatConverters??[],t?.worker&&(this.workerManager=new Lt),t?.debug?(this.debugEnabled=!0,this.debugOptions=J(typeof t.debug==`boolean`?void 0:t.debug)):this.debugOptions=J(),this.renderer=new pt(e),this.camera=new je(this.options),this.layerManager=new xt,this.emitter=new St,this.spatialIndex=new Tt,this.measureTool=new Mt,this.currentTool=this.options.initialTool,this.inputHandler=new Ct(e,this),this.resizeObserver=new ResizeObserver(()=>this.resize()),this.resizeObserver.observe(e),e.style.cursor=this.getCursorForTool(this.currentTool),this.requestRender(),this.debugEnabled&&this.startDebugLoop()}guardDestroyed(){if(this.destroyed)throw Error(`CadViewer: cannot call methods on a destroyed instance.`)}async runConverters(e){for(let t of this.formatConverters){let n=!1;try{n=t.detect(e)}catch{continue}if(n)return t.convert(e)}return null}async loadFile(e){this.guardDestroyed();let t=++this.loadGeneration;this.loadedFileName=e.name,this.loadedFileSize=e.size;let n=await e.arrayBuffer();if(this.destroyed||t!==this.loadGeneration)return;let r=await this.runConverters(n);if(this.destroyed||t!==this.loadGeneration)return;let i=performance.now(),a=r??n;this.doc=await this.parseWithOptionalWorker(a,t),!(this.destroyed||t!==this.loadGeneration)&&(this.parseTime=performance.now()-i,this.onDocumentLoaded())}async loadBuffer(e){this.guardDestroyed();let t=++this.loadGeneration;this.loadedFileName=null,this.loadedFileSize=e.byteLength;let n=await this.runConverters(e);if(this.destroyed||t!==this.loadGeneration)return;let r=performance.now(),i=n??e;this.doc=await this.parseWithOptionalWorker(i,t),!(this.destroyed||t!==this.loadGeneration)&&(this.parseTime=performance.now()-r,this.onDocumentLoaded())}async parseWithOptionalWorker(e,t){if(!this.workerManager)return j(e);try{return await this.workerManager.parse(e)}catch(e){if(this.destroyed||t!==this.loadGeneration)return null;throw e}}loadDocument(e){if(this.guardDestroyed(),++this.loadGeneration,this.loadedFileName=null,this.loadedFileSize=0,this.parseTime=0,!e||!Array.isArray(e.entities)||!(e.layers instanceof Map))throw Error(`CadViewer: invalid DxfDocument — expected entities array and layers Map.`);this.doc=e,this.onDocumentLoaded()}loadString(e){this.guardDestroyed(),++this.loadGeneration,this.loadedFileName=null,this.loadedFileSize=e.length;let t=performance.now();this.doc=j(e),this.parseTime=performance.now()-t,this.onDocumentLoaded()}loadArrayBuffer(e){this.guardDestroyed(),++this.loadGeneration,this.loadedFileName=null,this.loadedFileSize=e.byteLength;let t=performance.now();this.doc=j(e),this.parseTime=performance.now()-t,this.onDocumentLoaded()}clearDocument(){this.guardDestroyed(),++this.loadGeneration,this.doc=null,this.selectedEntityIndex=-1,this.spatialIndex.clear(),U(),this.layerManager.clear(),this.measureTool.deactivate(),this.requestRender()}onDocumentLoaded(){if(!this.doc)return;this.layerManager.setLayers(this.doc.layers);let e=performance.now();this.spatialIndex.build(this.doc.entities,this.doc),Xe(Ye(this.doc)),this.spatialIndexBuildTime=performance.now()-e,this.selectedEntityIndex=-1,this.measureTool.deactivate(),this.currentTool===`measure`&&this.measureTool.activate(),this.fitToView()}fitToView(){if(this.guardDestroyed(),!this.doc)return;let e=this.computeDocumentBounds();if(!e)return;let t=this.canvas.getBoundingClientRect();this.camera.setTransform(ke(t.width,t.height,e.minX,e.minY,e.maxX,e.maxY)),this.requestRender(),this.emitter.emit(`viewchange`,this.camera.getTransform())}zoomTo(e){this.guardDestroyed();let t=this.canvas.getBoundingClientRect(),n=t.width/2,r=t.height/2,i=e/this.camera.getTransform().scale;this.camera.zoom(n,r,i),this.requestRender(),this.emitter.emit(`viewchange`,this.camera.getTransform())}panTo(e,t){this.guardDestroyed();let n=this.canvas.getBoundingClientRect(),r=this.camera.getTransform(),i=e*r.scale+r.offsetX,a=-t*r.scale+r.offsetY,o=n.width/2-i,s=n.height/2-a;this.camera.pan(o,s),this.requestRender(),this.emitter.emit(`viewchange`,this.camera.getTransform())}getViewTransform(){return{...this.camera.getTransform()}}getZoomSpeed(){return this.options.zoomSpeed}getLayers(){return this.layerManager.getAllLayers()}setLayerVisible(e,t){this.guardDestroyed(),this.layerManager.setVisible(e,t),this.requestRender()}setLayerColor(e,t){this.guardDestroyed(),this.layerManager.setColorOverride(e,t),this.requestRender()}setTheme(e){this.guardDestroyed(),this.options.theme=e,this.requestRender()}getTheme(){return this.options.theme}setBackgroundColor(e){this.guardDestroyed(),this.options.backgroundColor=e,this.requestRender()}setTool(e){this.guardDestroyed(),this.currentTool===`measure`&&e!==`measure`&&this.measureTool.deactivate(),this.currentTool=e,this.canvas.style.cursor=this.getCursorForTool(e),e===`measure`&&this.measureTool.activate(),e!==`select`&&(this.selectedEntityIndex=-1),this.requestRender()}getTool(){return this.currentTool}getCursorForTool(e){switch(e){case`pan`:return`grab`;case`select`:return`crosshair`;case`measure`:return`crosshair`}}on(e,t){this.emitter.on(e,t)}off(e,t){this.emitter.off(e,t)}getDocument(){return this.doc}getEntities(){return this.doc?.entities??[]}resize(){this.renderer.updateSize(),this.requestRender()}destroy(){this.destroyed=!0,this.stopDebugLoop(),this.inputHandler.destroy(),this.resizeObserver.disconnect(),this.renderer.destroy(),this.emitter.removeAllListeners(),this.spatialIndex.clear(),U(),this.layerManager.clear(),this.workerManager?.terminate(),this.workerManager=null,this.doc=null}requestRender(){if(!this.destroyed){if(this.debugRafId){this.doRender();return}this.renderPending||(this.renderPending=!0,requestAnimationFrame(()=>{this.renderPending=!1,!this.destroyed&&this.doRender()}))}}doRender(){if(!this.doc){this.renderer.renderEmpty(this.options.theme);return}let e=this.camera.getTransform(),t=this.renderer.getWidth(),n=this.renderer.getHeight(),r=this.computeViewportBounds(e,t,n),i=this.spatialIndex.search(r.minX,r.minY,r.maxX,r.maxY),a=new Set;for(let e=0;e<i.length;e++)a.add(i[e].entityIndex);let o=performance.now(),s=this.renderer.render(this.doc,e,this.options.theme,this.layerManager.getVisibleLayerNames(),this.selectedEntityIndex,a,this.spatialIndex.getEntityBBoxes());this.lastFrameTime=performance.now()-o,this.lastRenderStats=s;let c=performance.now();for(c-this.lastDoRenderTime>=3&&this.frameTimestamps.push(c),this.lastDoRenderTime=c;this.frameTimestamps.length>0&&this.frameTimestamps[0]<c-1e3;)this.frameTimestamps.shift();if(this.currentTool===`measure`&&this.measureTool.state.phase!==`idle`&&Pt(this.renderer.getContext(),this.camera.getTransform(),this.measureTool,this.mouseScreenX,this.mouseScreenY,this.options.theme),this.debugEnabled){let e=this.renderer.getContext(),t=this.buildDebugStats();this.lastDebugStats=t,bt(e,t,this.options.theme,this.debugOptions,this.renderer.getWidth(),this.renderer.getHeight())}}setDebug(e){this.guardDestroyed(),typeof e==`boolean`?this.debugEnabled=e:(this.debugEnabled=!0,this.debugOptions=J(e)),this.debugEnabled?this.startDebugLoop():(this.stopDebugLoop(),this.requestRender())}startDebugLoop(){if(this.debugRafId)return;let e=()=>{if(!this.debugEnabled||this.destroyed){this.debugRafId=0;return}this.doRender(),this.debugRafId=requestAnimationFrame(e)};this.debugRafId=requestAnimationFrame(e)}stopDebugLoop(){this.debugRafId&&=(cancelAnimationFrame(this.debugRafId),0)}getDebugStats(){return this.debugEnabled?this.lastDebugStats:null}buildDebugStats(){let e=this.camera.getTransform(),t=this.renderer.getWidth(),n=this.renderer.getHeight(),r=this.computeViewportBounds(e,t,n);return{fps:this.frameTimestamps.length,frameTime:this.lastFrameTime,renderStats:this.lastRenderStats??{entitiesDrawn:0,entitiesSkipped:0,drawCalls:0,byType:{}},entityCount:this.doc?.entities.length??0,layerCount:this.doc?.layers.size??0,visibleLayerCount:this.layerManager.getVisibleLayerNames().size,blockCount:this.doc?.blocks.size??0,parseTime:this.parseTime,spatialIndexBuildTime:this.spatialIndexBuildTime,totalLoadTime:this.parseTime+this.spatialIndexBuildTime,zoom:e.scale,pixelSize:e.scale>0?1/e.scale:0,viewportBounds:r,fileName:this.loadedFileName,fileSize:this.loadedFileSize,dxfVersion:this.doc?.header.acadVersion??null}}computeViewportBounds(e,t,n){let[r,i]=P(e,0,n),[a,o]=P(e,t,0);return{minX:Math.min(r,a),minY:Math.min(i,o),maxX:Math.max(r,a),maxY:Math.max(i,o)}}handlePan(e,t){this.camera.pan(e,t),this.requestRender(),this.emitter.emit(`viewchange`,this.camera.getTransform())}handleZoom(e,t,n){this.camera.zoom(e,t,n),this.requestRender(),this.emitter.emit(`viewchange`,this.camera.getTransform())}handleClick(e,t){if(!this.doc)return;let n=this.camera.getTransform(),[r,i]=P(n,e,t);switch(this.currentTool){case`select`:this.handleSelect(r,i,e,t);break;case`measure`:{let e=Nt(r,i,this.doc.entities,this.spatialIndex,n.scale),t=e.length>0?e[0]:null,a=this.measureTool.handleClick(r,i,t);this.requestRender(),a&&this.emitter.emit(`measure`,a);break}}}handleMouseMove(e,t){if(this.mouseScreenX=e,this.mouseScreenY=t,this.currentTool===`measure`&&this.doc){let n=this.camera.getTransform(),[r,i]=P(n,e,t),a=Nt(r,i,this.doc.entities,this.spatialIndex,n.scale);this.measureTool.handleMove(a[0]??null),this.requestRender()}}handleSelect(e,t,n,r){if(!this.doc)return;let i=Et(e,t,this.doc.entities,this.spatialIndex,this.layerManager.getVisibleLayerNames(),this.camera.getTransform().scale);if(this.selectedEntityIndex=i,this.requestRender(),i>=0&&this.doc){let a=this.doc.entities[i];a&&this.emitter.emit(`select`,{entity:a,entityIndex:i,worldPoint:{x:e,y:t},screenPoint:{x:n,y:r}})}}computeDocumentBounds(){return this.doc?this.doc.header.extMin&&this.doc.header.extMax?{minX:this.doc.header.extMin.x,minY:this.doc.header.extMin.y,maxX:this.doc.header.extMax.x,maxY:this.doc.header.extMax.y}:Je(this.doc.entities):null}};export{Rt as CadViewer};
|