ranui 0.2.1-alpha.1 → 0.2.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abnfDiagram-VRR7QNED-CH_pIv_l.cjs +1 -0
- package/dist/abnfDiagram-VRR7QNED-CTsqwzwi.js +95 -0
- package/dist/arc-D25LhgTs.cjs +1 -0
- package/dist/arc-DRPGof21.js +82 -0
- package/dist/architecture-TIHT7OUA-BbBd15_y.cjs +1 -0
- package/dist/architecture-TIHT7OUA-pbFO1xSx.js +5 -0
- package/dist/architectureDiagram-ZJ3FMSHR-8mjyXr-w.js +4279 -0
- package/dist/architectureDiagram-ZJ3FMSHR-D_jWFFZx.cjs +36 -0
- package/dist/array-By5736M5.js +7 -0
- package/dist/array-C3cbN3GY.cjs +1 -0
- package/dist/blockDiagram-677ZJIJ3-3F79MOSt.js +3321 -0
- package/dist/blockDiagram-677ZJIJ3-Cx35khWe.cjs +132 -0
- package/dist/builder.d.ts +2 -2
- package/dist/builder.js +39 -34
- package/dist/{builtin-D9djWkCE.js → builtin-1lUEp_ro.js} +83 -76
- package/dist/button-Cj-XSCsd.js +117 -0
- package/dist/button.js +1 -1
- package/dist/c4Diagram-LMCZKHZV-Cxn_gqu_.js +3064 -0
- package/dist/c4Diagram-LMCZKHZV-TRNb3Gvl.cjs +10 -0
- package/dist/{card-CqJa4Q_v.js → card-BHN9Xp4S.js} +2 -2
- package/dist/card.js +1 -1
- package/dist/channel-C9WSNwcS.cjs +1 -0
- package/dist/channel-k5-UxdcV.js +5 -0
- package/dist/{checkbox-CThC9-vy.js → checkbox-O_J_n1_W.js} +10 -10
- package/dist/checkbox.js +1 -1
- package/dist/chunk-2Q5K7J3B-CTMy5FII.cjs +1 -0
- package/dist/chunk-2Q5K7J3B-DlFVJRAn.js +15 -0
- package/dist/chunk-32BRIVSS-BXVdG_nV.cjs +1 -0
- package/dist/chunk-32BRIVSS-jAuAwMVV.js +68 -0
- package/dist/chunk-52WLFC77-BChUrU24.cjs +10 -0
- package/dist/chunk-52WLFC77-wpL7en7e.js +630 -0
- package/dist/chunk-5VM5RSS4-Cni2Ogq2.js +19 -0
- package/dist/chunk-5VM5RSS4-DudUFQ_Z.cjs +15 -0
- package/dist/chunk-7BUUIJ7U-9hiBbc7O.js +87 -0
- package/dist/chunk-7BUUIJ7U-DMv_UkjI.cjs +1 -0
- package/dist/chunk-C7G6YPKG-CA-DNpvI.js +71 -0
- package/dist/chunk-C7G6YPKG-CKEeW9TM.cjs +1 -0
- package/dist/chunk-EX3LRPZG-BCmf0iDq.js +2137 -0
- package/dist/chunk-EX3LRPZG-DbfbNdXo.cjs +231 -0
- package/dist/chunk-FWX5IMBZ-D11-gbhc.cjs +1 -0
- package/dist/chunk-FWX5IMBZ-DZ5VYvm5.js +60 -0
- package/dist/chunk-HOUHSVGY-BGB3dOvI.cjs +1 -0
- package/dist/chunk-HOUHSVGY-DRQcQeMT.js +268 -0
- package/dist/chunk-ICXQ74PX-BbT9JaEW.cjs +2 -0
- package/dist/chunk-ICXQ74PX-DR8rL-xF.js +1377 -0
- package/dist/chunk-JWPE2WC7-CGEmUMMZ.js +8 -0
- package/dist/chunk-JWPE2WC7-D8EnWK1B.cjs +1 -0
- package/dist/chunk-KEIR6QF5-B2Op7cFH.js +22155 -0
- package/dist/chunk-KEIR6QF5-C4fcHpY0.cjs +161 -0
- package/dist/chunk-MOJQB5TN-BC46HDyu.js +516 -0
- package/dist/chunk-MOJQB5TN-oOeq982_.cjs +88 -0
- package/dist/chunk-OGEWGWER-BV51ll2w.js +33 -0
- package/dist/chunk-OGEWGWER-DX8sW1dT.cjs +1 -0
- package/dist/chunk-PUDLZKDR-48YaqVoF.cjs +156 -0
- package/dist/chunk-PUDLZKDR-NdMR0Ft5.js +4282 -0
- package/dist/chunk-Q4XR5HBZ-3BHjjc9u.js +1709 -0
- package/dist/chunk-Q4XR5HBZ-aBnPq509.cjs +70 -0
- package/dist/chunk-RYQCIY6F-BER2T9t0.js +246 -0
- package/dist/chunk-RYQCIY6F-DVRzSnsI.cjs +1 -0
- package/dist/chunk-V7JOEXUC-Cr_hr02u.js +3467 -0
- package/dist/chunk-V7JOEXUC-DHizzTla.cjs +206 -0
- package/dist/chunk-VAUOI2AC-DfQf5L2_.cjs +1 -0
- package/dist/chunk-VAUOI2AC-izt0o4id.js +11 -0
- package/dist/chunk-VR4S4FIN-CJi5okl4.js +26 -0
- package/dist/chunk-VR4S4FIN-KiwnPF31.cjs +1 -0
- package/dist/chunk-WYO6CB5R-DDHkKowO.js +4535 -0
- package/dist/chunk-WYO6CB5R-u4mJNOcO.cjs +127 -0
- package/dist/chunk-XXDRQBXY-BB1i_53q.js +9 -0
- package/dist/chunk-XXDRQBXY-C8VGLZmt.cjs +1 -0
- package/dist/chunk-Y2CYZVJY-0JxdZxki.js +13 -0
- package/dist/chunk-Y2CYZVJY-DPaYLFFP.cjs +1 -0
- package/dist/chunk-ZGVPDNZ5-6uMbTJXy.js +3841 -0
- package/dist/chunk-ZGVPDNZ5-Cw5_HJba.cjs +62 -0
- package/dist/chunk-ZIRB5QZD-C7OH2FI2.js +1280 -0
- package/dist/chunk-ZIRB5QZD-aLu-4ITN.cjs +32 -0
- package/dist/classDiagram-OUVF2IWQ-D6rqYIh0.cjs +1 -0
- package/dist/classDiagram-OUVF2IWQ-Df0ghim9.js +30 -0
- package/dist/classDiagram-v2-EOCWNBFH-D6rqYIh0.cjs +1 -0
- package/dist/classDiagram-v2-EOCWNBFH-Df0ghim9.js +30 -0
- package/dist/{colorpicker-XNxDRcQ-.js → colorpicker-mebH0XLm.js} +8 -8
- package/dist/colorpicker.js +1 -1
- package/dist/components/glass/index.d.ts +52 -0
- package/dist/components/icon/core-icons.d.ts +13 -0
- package/dist/components/icon/index.d.ts +1 -1
- package/dist/components/mermaid/index.d.ts +52 -0
- package/dist/components/modal/index.d.ts +9 -0
- package/dist/content-YOKzMoc7.js +39 -0
- package/dist/content.js +5 -0
- package/dist/cose-bilkent-JH36ORCC-BUxFTdey.cjs +1 -0
- package/dist/cose-bilkent-JH36ORCC-DTwvJlGw.js +2353 -0
- package/dist/cynefin-VYW2F7L2-6c1GOGXW.cjs +1 -0
- package/dist/cynefin-VYW2F7L2-ALQKF7N6.js +5 -0
- package/dist/cynefinDiagram-TSTJHNR4-Bjt4QTVh.js +355 -0
- package/dist/cynefinDiagram-TSTJHNR4-ISDORSxO.cjs +62 -0
- package/dist/cytoscape.esm-CFq1_DTa.js +18906 -0
- package/dist/cytoscape.esm-pygMw4dR.cjs +321 -0
- package/dist/dagre-D1-W1tt6.cjs +1 -0
- package/dist/dagre-D8GLTwuf.js +1578 -0
- package/dist/dagre-VKFMJZFB-DXI69qAN.cjs +4 -0
- package/dist/dagre-VKFMJZFB-Dfku86Az.js +341 -0
- package/dist/defaultLocale-0M_kMcEH.js +184 -0
- package/dist/defaultLocale-DSqtvhxg.cjs +1 -0
- package/dist/diagram-FQU43EPY-BAiRt5eL.cjs +3 -0
- package/dist/diagram-FQU43EPY-BvQ5jmVn.js +452 -0
- package/dist/diagram-G47NLZAW-DGnmEa8u.cjs +24 -0
- package/dist/diagram-G47NLZAW-DT2BBA0T.js +498 -0
- package/dist/diagram-NH7WQ7WH-DxgkStA3.cjs +24 -0
- package/dist/diagram-NH7WQ7WH-W7jg4Vh8.js +135 -0
- package/dist/diagram-OA4YK3LP-DkvFII73.cjs +30 -0
- package/dist/diagram-OA4YK3LP-jU--aqQl.js +317 -0
- package/dist/diagram-WEI45ONY-C_Qhf4ny.js +215 -0
- package/dist/diagram-WEI45ONY-XvzRFmmY.cjs +41 -0
- package/dist/dist-C0Fwsvsq.js +70 -0
- package/dist/dist-C20XxSsP.cjs +1 -0
- package/dist/{dropdown-CCvsambb.js → dropdown-CzGAVWYC.js} +4 -4
- package/dist/dropdown.js +1 -1
- package/dist/ebnfDiagram-CCIWWBDH-Cu8bAlhC.cjs +1 -0
- package/dist/ebnfDiagram-CCIWWBDH-Gnr20Oc1.js +112 -0
- package/dist/erDiagram-Q63AITRT-CxLSa9Yv.cjs +85 -0
- package/dist/erDiagram-Q63AITRT-D0Hh9b-W.js +1822 -0
- package/dist/eventmodeling-45OFAUF4-C6VXxUn1.cjs +1 -0
- package/dist/eventmodeling-45OFAUF4-DMpGs2yI.js +5 -0
- package/dist/factory-ZNhcQ4tf.js +482 -0
- package/dist/flowDiagram-23GEKE2U-B6gASEYG.cjs +1 -0
- package/dist/flowDiagram-23GEKE2U-BY4wE2vw.js +19 -0
- package/dist/{form-Ceq3uJzz.js → form-B8afuJlF.js} +5 -5
- package/dist/form.js +1 -1
- package/dist/ganttDiagram-NO4QXBWP-B40Eabk0.js +3125 -0
- package/dist/ganttDiagram-NO4QXBWP-DZT79qJr.cjs +292 -0
- package/dist/gitGraph-TEB2WS4Q-BbtF3MDr.cjs +1 -0
- package/dist/gitGraph-TEB2WS4Q-D6Ru11Cs.js +5 -0
- package/dist/gitGraphDiagram-IHSO6WYX-BUJNSssA.js +754 -0
- package/dist/gitGraphDiagram-IHSO6WYX-DW06165m.cjs +106 -0
- package/dist/glass-BniIptBE.js +115 -0
- package/dist/glass.js +5 -0
- package/dist/graphlib-CCKThIKP.js +1104 -0
- package/dist/graphlib-Du-578Js.cjs +1 -0
- package/dist/{icon-C_ENrJ3F.js → icon-GZrfSeon.js} +77 -25
- package/dist/icon.js +1 -1
- package/dist/icons.js +1 -1
- package/dist/iife/button.iife.js +1 -1
- package/dist/iife/card.iife.js +1 -1
- package/dist/iife/checkbox.iife.js +1 -1
- package/dist/iife/colorpicker.iife.js +2 -2
- package/dist/iife/content.iife.js +1 -0
- package/dist/iife/dropdown.iife.js +1 -1
- package/dist/iife/form.iife.js +1 -1
- package/dist/iife/glass.iife.js +1 -0
- package/dist/iife/icon.iife.js +1 -1
- package/dist/iife/image.iife.js +1 -1
- package/dist/iife/input.iife.js +1 -1
- package/dist/iife/loading.iife.js +1 -1
- package/dist/iife/math.iife.js +14 -14
- package/dist/iife/mermaid.iife.js +3535 -0
- package/dist/iife/message.iife.js +1 -1
- package/dist/iife/modal.iife.js +1 -1
- package/dist/iife/player.iife.js +8 -8
- package/dist/iife/popover.iife.js +1 -1
- package/dist/iife/progress.iife.js +1 -1
- package/dist/iife/radar.iife.js +1 -1
- package/dist/iife/route.iife.js +1 -1
- package/dist/iife/router.iife.js +1 -1
- package/dist/iife/scratch.iife.js +1 -1
- package/dist/iife/section.iife.js +1 -1
- package/dist/iife/select.iife.js +2 -2
- package/dist/iife/skeleton.iife.js +1 -1
- package/dist/iife/tab.iife.js +1 -1
- package/dist/iife/tabpane.iife.js +1 -1
- package/dist/iife/theme-switch.iife.js +1 -1
- package/dist/{image-B7MBI5n_.js → image-CqoQfJoV.js} +4 -4
- package/dist/image.js +1 -1
- package/dist/index.cjs +38 -37
- package/dist/index.d.ts +8 -0
- package/dist/index.iife.js +3623 -88
- package/dist/index.js +88 -84
- package/dist/info-DKCQHKI2-DNOtUIin.cjs +1 -0
- package/dist/info-DKCQHKI2-Df7h9MSE.js +5 -0
- package/dist/infoDiagram-FWYZ7A6U-C8dZc-Ki.cjs +2 -0
- package/dist/infoDiagram-FWYZ7A6U-Dc0m9qAx.js +21 -0
- package/dist/init-1VpIn1S3.js +16 -0
- package/dist/init-CbDwVtpO.cjs +1 -0
- package/dist/{input-RNqdEHPf.js → input-BlwAXu7I.js} +6 -6
- package/dist/input.js +1 -1
- package/dist/ishikawaDiagram-FXEZZL3T-BugNyysB.cjs +70 -0
- package/dist/ishikawaDiagram-FXEZZL3T-DuFtHOmf.js +742 -0
- package/dist/journeyDiagram-5HDEW3XC-Bshelnhq.js +928 -0
- package/dist/journeyDiagram-5HDEW3XC-ItmURvA2.cjs +139 -0
- package/dist/kanban-definition-HUTT4EX6-BL512R2A.cjs +89 -0
- package/dist/kanban-definition-HUTT4EX6-Dogv2paU.js +1050 -0
- package/dist/katex-Cq3Y8cmK.cjs +257 -0
- package/dist/katex-Pg2EqTH0.js +23485 -0
- package/dist/line-BIPmUVxO.js +33 -0
- package/dist/line-CAB5QHC6.cjs +1 -0
- package/dist/linear-B2AM4ZBe.js +259 -0
- package/dist/linear-CSAfNEpl.cjs +1 -0
- package/dist/{link-DURZzd7u.js → link-BCrmHvXP.js} +3 -3
- package/dist/link.js +1 -1
- package/dist/{loading-B9MFI03l.js → loading-M6gWxLbm.js} +4 -4
- package/dist/loading.js +1 -1
- package/dist/map-BC2bk_rV.cjs +1 -0
- package/dist/map-DMSWkcq6.js +208 -0
- package/dist/{math-CudIwEXZ.js → math-8E-45Y8e.js} +4 -4
- package/dist/math.js +1 -1
- package/dist/mermaid-C1oQyPE3.js +261 -0
- package/dist/mermaid-parser.core-DYumW1vq.cjs +6 -0
- package/dist/mermaid-parser.core-uIDZYuBu.js +654 -0
- package/dist/mermaid.core-B2d5lQW2.js +1085 -0
- package/dist/mermaid.core-a1hgpWfs.cjs +10 -0
- package/dist/mermaid.js +5 -0
- package/dist/{message-DW7qWpEm.js → message-CNdmbeLf.js} +6 -6
- package/dist/message.js +1 -1
- package/dist/mindmap-definition-LN4V7U3C-DYZgIZym.cjs +96 -0
- package/dist/mindmap-definition-LN4V7U3C-f7s5ZePP.js +1070 -0
- package/dist/{modal-CrvGKL2B.js → modal-gRagDkTb.js} +40 -24
- package/dist/modal.js +1 -1
- package/dist/ordinal-BMN81JG2.js +64 -0
- package/dist/ordinal-BplLHIij.cjs +1 -0
- package/dist/packet-7NZHBO7P-4PLslLZJ.js +5 -0
- package/dist/packet-7NZHBO7P-DeyLCrSn.cjs +1 -0
- package/dist/path-Bja5PoYn.js +82 -0
- package/dist/path-DmfWsuKi.cjs +1 -0
- package/dist/pegDiagram-2B236MQR-B-Xeh55J.js +107 -0
- package/dist/pegDiagram-2B236MQR-Bo5Nj40u.cjs +1 -0
- package/dist/pie-RZYD4A2V-DBE9a8Kz.js +5 -0
- package/dist/pie-RZYD4A2V-pDNZ2ZyB.cjs +1 -0
- package/dist/pieDiagram-ENE6RG2P-BkSiP4iu.cjs +39 -0
- package/dist/pieDiagram-ENE6RG2P-CVSE95zc.js +207 -0
- package/dist/{player-BKQaaT7o.js → player-CAQ5Og2P.js} +196 -195
- package/dist/player.js +1 -1
- package/dist/{popover-CvYIVgUS.js → popover-BZKSLe3D.js} +22 -54
- package/dist/popover.js +1 -1
- package/dist/{progress-C6jctsFH.js → progress-vk40tuhm.js} +5 -5
- package/dist/progress.js +1 -1
- package/dist/quadrantDiagram-ABIIQ3AL-BDmdDGsh.cjs +7 -0
- package/dist/quadrantDiagram-ABIIQ3AL-TJ8FmqES.js +2058 -0
- package/dist/{radar-BUb4EzmG.js → radar-Bg0cexzU.js} +5 -5
- package/dist/radar-I7S5WNFK-CY5ycn2a.cjs +1 -0
- package/dist/radar-I7S5WNFK-DFTxtd_t.js +5 -0
- package/dist/radar.js +1 -1
- package/dist/railroad-3IZDKUUU-DALJwv16.js +5 -0
- package/dist/railroad-3IZDKUUU-DGzXHqt7.cjs +1 -0
- package/dist/railroad-abnf-AHOZXSZD-BCIHdSw6.cjs +1 -0
- package/dist/railroad-abnf-AHOZXSZD-CntW2udQ.js +5 -0
- package/dist/railroad-ebnf-EBAXGLYW-4vFZrfHF.cjs +1 -0
- package/dist/railroad-ebnf-EBAXGLYW-s_1ZOb_9.js +5 -0
- package/dist/railroad-peg-LSFZ7HO6-CaM5A0Ml.js +5 -0
- package/dist/railroad-peg-LSFZ7HO6-D_oFW1Bo.cjs +1 -0
- package/dist/railroadDiagram-RFXS5EU6-0lS5wYI7.js +83 -0
- package/dist/railroadDiagram-RFXS5EU6-DJKAtnQk.cjs +1 -0
- package/dist/ranui.css +1 -1
- package/dist/requirementDiagram-TGXJPOKE-Bg701bNl.cjs +84 -0
- package/dist/requirementDiagram-TGXJPOKE-viCQLyJd.js +2301 -0
- package/dist/rolldown-runtime-9ZSF5uba.js +16 -0
- package/dist/rolldown-runtime-CAnuVJ4g.cjs +1 -0
- package/dist/rough.esm-BWe9E0Nz.js +1387 -0
- package/dist/rough.esm-BfSi6CZE.cjs +1 -0
- package/dist/{route-Djrf9UR_.js → route-CGwS0cd_.js} +10 -10
- package/dist/route.js +1 -1
- package/dist/{router-BU2KhtxV.js → router-BK6DEkcN.js} +5 -5
- package/dist/router.js +1 -1
- package/dist/sankeyDiagram-HTMAVEWB-CV6_AuMF.js +974 -0
- package/dist/sankeyDiagram-HTMAVEWB-K-nGMsuS.cjs +40 -0
- package/dist/{scratch-CO4I2dIa.js → scratch-ClF1awGi.js} +2 -2
- package/dist/scratch.js +1 -1
- package/dist/{section-CsUkp8bv.js → section-BL0V7Kjf.js} +2 -2
- package/dist/section.js +1 -1
- package/dist/{select-Dn26ajJZ.js → select-BIFVbQIj.js} +13 -13
- package/dist/select.js +1 -1
- package/dist/sequenceDiagram-DBY2YBRQ-4GdkLnUr.cjs +162 -0
- package/dist/sequenceDiagram-DBY2YBRQ-B9WNesh2.js +4326 -0
- package/dist/sizeCapture-X5ZJPWSS-BUY3-n09.cjs +1 -0
- package/dist/sizeCapture-X5ZJPWSS-D7rGsqTl.js +48 -0
- package/dist/{skeleton-BuMLhvzQ.js → skeleton-D7JIbROq.js} +5 -5
- package/dist/skeleton.js +1 -1
- package/dist/src-C9EhKhbk.cjs +1 -0
- package/dist/src-DtRLxcYO.js +2104 -0
- package/dist/stateDiagram-2N3HPSRC-B7VpgjJu.cjs +1 -0
- package/dist/stateDiagram-2N3HPSRC-DxH4BMSh.js +237 -0
- package/dist/stateDiagram-v2-6OUMAXLB-CQv7GIaO.cjs +1 -0
- package/dist/stateDiagram-v2-6OUMAXLB-CWfn6e7n.js +30 -0
- package/dist/swimlanes-5IMT3BWC-DcADNGpg.js +5258 -0
- package/dist/swimlanes-5IMT3BWC-o-MjdPlw.cjs +1 -0
- package/dist/swimlanesDiagram-G3AALYLV-D-rmAGky.cjs +8 -0
- package/dist/swimlanesDiagram-G3AALYLV-DDtDtl1L.js +31 -0
- package/dist/{tab-40fDkuox.js → tab-DFVtDJb2.js} +5 -5
- package/dist/tab.js +1 -1
- package/dist/{tabpane-F4Pd7JtC.js → tabpane-C3qZGN-D.js} +5 -5
- package/dist/tabpane.js +1 -1
- package/dist/test/ssr/stream.test.d.ts +1 -0
- package/dist/{theme-switch-B09egc6h.js → theme-switch-BXNH5uPD.js} +45 -45
- package/dist/theme-switch.js +1 -1
- package/dist/timeline-definition-FHXFAJF6-C80VjPLh.js +1119 -0
- package/dist/timeline-definition-FHXFAJF6-DOwvOb3S.cjs +120 -0
- package/dist/treeView-QDETBFTQ-B1Ejxfpg.cjs +1 -0
- package/dist/treeView-QDETBFTQ-vTKOZls1.js +5 -0
- package/dist/treemap-6X3UGDF4-D0FeO_NX.cjs +1 -0
- package/dist/treemap-6X3UGDF4-Ddzv6Gqd.js +5 -0
- package/dist/utils/builder/core.d.ts +135 -3
- package/dist/utils/builder/index.d.ts +1 -1
- package/dist/{utils-DBfrRFoE.js → utils-D1iZnChu.js} +38 -31
- package/dist/vennDiagram-L72KCM5P-BYHB7OW8.js +1955 -0
- package/dist/vennDiagram-L72KCM5P-CidVJK6y.cjs +34 -0
- package/dist/wardley-OPB4EBWU-C1hXbbD4.cjs +1 -0
- package/dist/wardley-OPB4EBWU-DBgFLc64.js +5 -0
- package/dist/wardleyDiagram-EHGQE667--ubmCaWM.js +652 -0
- package/dist/wardleyDiagram-EHGQE667-K6ckkRZS.cjs +78 -0
- package/dist/xychartDiagram-FW5EYKEG-CzdokxrM.cjs +7 -0
- package/dist/xychartDiagram-FW5EYKEG-DLqWcTPt.js +2154 -0
- package/docs/BUILDER.md +170 -2
- package/package.json +7 -1
- package/dist/button-BfYw0fes.js +0 -117
- package/dist/factory-DCrO37si.js +0 -334
|
@@ -0,0 +1,1387 @@
|
|
|
1
|
+
function U(t, s, e) {
|
|
2
|
+
if (t && t.length) {
|
|
3
|
+
const [a, n] = s, o = Math.PI / 180 * e, r = Math.cos(o), h = Math.sin(o);
|
|
4
|
+
for (const i of t) {
|
|
5
|
+
const [c, l] = i;
|
|
6
|
+
i[0] = (c - a) * r - (l - n) * h + a, i[1] = (c - a) * h + (l - n) * r + n;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function Ot(t, s) {
|
|
11
|
+
return t[0] === s[0] && t[1] === s[1];
|
|
12
|
+
}
|
|
13
|
+
function Lt(t, s, e, a = 1) {
|
|
14
|
+
const n = e, o = Math.max(s, 0.1), r = t[0] && t[0][0] && typeof t[0][0] == "number" ? [t] : t, h = [0, 0];
|
|
15
|
+
if (n) for (const c of r) U(c, h, n);
|
|
16
|
+
const i = (function(c, l, d) {
|
|
17
|
+
const f = [];
|
|
18
|
+
for (const M of c) {
|
|
19
|
+
const y = [...M];
|
|
20
|
+
Ot(y[0], y[y.length - 1]) || y.push([y[0][0], y[0][1]]), y.length > 2 && f.push(y);
|
|
21
|
+
}
|
|
22
|
+
const u = [];
|
|
23
|
+
l = Math.max(l, 0.1);
|
|
24
|
+
const p = [];
|
|
25
|
+
for (const M of f) for (let y = 0; y < M.length - 1; y++) {
|
|
26
|
+
const w = M[y], v = M[y + 1];
|
|
27
|
+
if (w[1] !== v[1]) {
|
|
28
|
+
const P = Math.min(w[1], v[1]);
|
|
29
|
+
p.push({
|
|
30
|
+
ymin: P,
|
|
31
|
+
ymax: Math.max(w[1], v[1]),
|
|
32
|
+
x: P === w[1] ? w[0] : v[0],
|
|
33
|
+
islope: (v[0] - w[0]) / (v[1] - w[1])
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
if (p.sort(((M, y) => M.ymin < y.ymin ? -1 : M.ymin > y.ymin ? 1 : M.x < y.x ? -1 : M.x > y.x ? 1 : M.ymax === y.ymax ? 0 : (M.ymax - y.ymax) / Math.abs(M.ymax - y.ymax))), !p.length) return u;
|
|
38
|
+
let k = [], g = p[0].ymin, m = 0;
|
|
39
|
+
for (; k.length || p.length; ) {
|
|
40
|
+
if (p.length) {
|
|
41
|
+
let M = -1;
|
|
42
|
+
for (let y = 0; y < p.length && !(p[y].ymin > g); y++) M = y;
|
|
43
|
+
p.splice(0, M + 1).forEach(((y) => {
|
|
44
|
+
k.push({
|
|
45
|
+
s: g,
|
|
46
|
+
edge: y
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
if (k = k.filter(((M) => !(M.edge.ymax <= g))), k.sort(((M, y) => M.edge.x === y.edge.x ? 0 : (M.edge.x - y.edge.x) / Math.abs(M.edge.x - y.edge.x))), (d !== 1 || m % l == 0) && k.length > 1) for (let M = 0; M < k.length; M += 2) {
|
|
51
|
+
const y = M + 1;
|
|
52
|
+
if (y >= k.length) break;
|
|
53
|
+
const w = k[M].edge, v = k[y].edge;
|
|
54
|
+
u.push([[Math.round(w.x), g], [Math.round(v.x), g]]);
|
|
55
|
+
}
|
|
56
|
+
g += d, k.forEach(((M) => {
|
|
57
|
+
M.edge.x = M.edge.x + d * M.edge.islope;
|
|
58
|
+
})), m++;
|
|
59
|
+
}
|
|
60
|
+
return u;
|
|
61
|
+
})(r, o, a);
|
|
62
|
+
if (n) {
|
|
63
|
+
for (const c of r) U(c, h, -n);
|
|
64
|
+
(function(c, l, d) {
|
|
65
|
+
const f = [];
|
|
66
|
+
c.forEach(((u) => f.push(...u))), U(f, l, d);
|
|
67
|
+
})(i, h, -n);
|
|
68
|
+
}
|
|
69
|
+
return i;
|
|
70
|
+
}
|
|
71
|
+
function R(t, s) {
|
|
72
|
+
var e;
|
|
73
|
+
const a = s.hachureAngle + 90;
|
|
74
|
+
let n = s.hachureGap;
|
|
75
|
+
n < 0 && (n = 4 * s.strokeWidth), n = Math.round(Math.max(n, 0.1));
|
|
76
|
+
let o = 1;
|
|
77
|
+
return s.roughness >= 1 && (((e = s.randomizer) === null || e === void 0 ? void 0 : e.next()) || Math.random()) > 0.7 && (o = n), Lt(t, n, a, o || 1);
|
|
78
|
+
}
|
|
79
|
+
var ot = class {
|
|
80
|
+
constructor(t) {
|
|
81
|
+
this.helper = t;
|
|
82
|
+
}
|
|
83
|
+
fillPolygons(t, s) {
|
|
84
|
+
return this._fillPolygons(t, s);
|
|
85
|
+
}
|
|
86
|
+
_fillPolygons(t, s) {
|
|
87
|
+
const e = R(t, s);
|
|
88
|
+
return {
|
|
89
|
+
type: "fillSketch",
|
|
90
|
+
ops: this.renderLines(e, s)
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
renderLines(t, s) {
|
|
94
|
+
const e = [];
|
|
95
|
+
for (const a of t) e.push(...this.helper.doubleLineOps(a[0][0], a[0][1], a[1][0], a[1][1], s));
|
|
96
|
+
return e;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
function K(t) {
|
|
100
|
+
const s = t[0], e = t[1];
|
|
101
|
+
return Math.sqrt(Math.pow(s[0] - e[0], 2) + Math.pow(s[1] - e[1], 2));
|
|
102
|
+
}
|
|
103
|
+
var Tt = class extends ot {
|
|
104
|
+
fillPolygons(t, s) {
|
|
105
|
+
let e = s.hachureGap;
|
|
106
|
+
e < 0 && (e = 4 * s.strokeWidth), e = Math.max(e, 0.1);
|
|
107
|
+
const a = R(t, Object.assign({}, s, { hachureGap: e })), n = Math.PI / 180 * s.hachureAngle, o = [], r = 0.5 * e * Math.cos(n), h = 0.5 * e * Math.sin(n);
|
|
108
|
+
for (const [i, c] of a) K([i, c]) && o.push([[i[0] - r, i[1] + h], [...c]], [[i[0] + r, i[1] - h], [...c]]);
|
|
109
|
+
return {
|
|
110
|
+
type: "fillSketch",
|
|
111
|
+
ops: this.renderLines(o, s)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
}, Dt = class extends ot {
|
|
115
|
+
fillPolygons(t, s) {
|
|
116
|
+
const e = this._fillPolygons(t, s), a = Object.assign({}, s, { hachureAngle: s.hachureAngle + 90 }), n = this._fillPolygons(t, a);
|
|
117
|
+
return e.ops = e.ops.concat(n.ops), e;
|
|
118
|
+
}
|
|
119
|
+
}, At = class {
|
|
120
|
+
constructor(t) {
|
|
121
|
+
this.helper = t;
|
|
122
|
+
}
|
|
123
|
+
fillPolygons(t, s) {
|
|
124
|
+
const e = R(t, s = Object.assign({}, s, { hachureAngle: 0 }));
|
|
125
|
+
return this.dotsOnLines(e, s);
|
|
126
|
+
}
|
|
127
|
+
dotsOnLines(t, s) {
|
|
128
|
+
const e = [];
|
|
129
|
+
let a = s.hachureGap;
|
|
130
|
+
a < 0 && (a = 4 * s.strokeWidth), a = Math.max(a, 0.1);
|
|
131
|
+
let n = s.fillWeight;
|
|
132
|
+
n < 0 && (n = s.strokeWidth / 2);
|
|
133
|
+
const o = a / 4;
|
|
134
|
+
for (const r of t) {
|
|
135
|
+
const h = K(r), i = h / a, c = Math.ceil(i) - 1, l = h - c * a, d = (r[0][0] + r[1][0]) / 2 - a / 4, f = Math.min(r[0][1], r[1][1]);
|
|
136
|
+
for (let u = 0; u < c; u++) {
|
|
137
|
+
const p = f + l + u * a, k = d - o + 2 * Math.random() * o, g = p - o + 2 * Math.random() * o, m = this.helper.ellipse(k, g, n, n, s);
|
|
138
|
+
e.push(...m.ops);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return {
|
|
142
|
+
type: "fillSketch",
|
|
143
|
+
ops: e
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
}, _t = class {
|
|
147
|
+
constructor(t) {
|
|
148
|
+
this.helper = t;
|
|
149
|
+
}
|
|
150
|
+
fillPolygons(t, s) {
|
|
151
|
+
const e = R(t, s);
|
|
152
|
+
return {
|
|
153
|
+
type: "fillSketch",
|
|
154
|
+
ops: this.dashedLine(e, s)
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
dashedLine(t, s) {
|
|
158
|
+
const e = s.dashOffset < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashOffset, a = s.dashGap < 0 ? s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap : s.dashGap, n = [];
|
|
159
|
+
return t.forEach(((o) => {
|
|
160
|
+
const r = K(o), h = Math.floor(r / (e + a)), i = (r + a - h * (e + a)) / 2;
|
|
161
|
+
let c = o[0], l = o[1];
|
|
162
|
+
c[0] > l[0] && (c = o[1], l = o[0]);
|
|
163
|
+
const d = Math.atan((l[1] - c[1]) / (l[0] - c[0]));
|
|
164
|
+
for (let f = 0; f < h; f++) {
|
|
165
|
+
const u = f * (e + a), p = u + e, k = [c[0] + u * Math.cos(d) + i * Math.cos(d), c[1] + u * Math.sin(d) + i * Math.sin(d)], g = [c[0] + p * Math.cos(d) + i * Math.cos(d), c[1] + p * Math.sin(d) + i * Math.sin(d)];
|
|
166
|
+
n.push(...this.helper.doubleLineOps(k[0], k[1], g[0], g[1], s));
|
|
167
|
+
}
|
|
168
|
+
})), n;
|
|
169
|
+
}
|
|
170
|
+
}, It = class {
|
|
171
|
+
constructor(t) {
|
|
172
|
+
this.helper = t;
|
|
173
|
+
}
|
|
174
|
+
fillPolygons(t, s) {
|
|
175
|
+
const e = s.hachureGap < 0 ? 4 * s.strokeWidth : s.hachureGap, a = s.zigzagOffset < 0 ? e : s.zigzagOffset, n = R(t, s = Object.assign({}, s, { hachureGap: e + a }));
|
|
176
|
+
return {
|
|
177
|
+
type: "fillSketch",
|
|
178
|
+
ops: this.zigzagLines(n, a, s)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
zigzagLines(t, s, e) {
|
|
182
|
+
const a = [];
|
|
183
|
+
return t.forEach(((n) => {
|
|
184
|
+
const o = K(n), r = Math.round(o / (2 * s));
|
|
185
|
+
let h = n[0], i = n[1];
|
|
186
|
+
h[0] > i[0] && (h = n[1], i = n[0]);
|
|
187
|
+
const c = Math.atan((i[1] - h[1]) / (i[0] - h[0]));
|
|
188
|
+
for (let l = 0; l < r; l++) {
|
|
189
|
+
const d = 2 * l * s, f = 2 * (l + 1) * s, u = Math.sqrt(2 * Math.pow(s, 2)), p = [h[0] + d * Math.cos(c), h[1] + d * Math.sin(c)], k = [h[0] + f * Math.cos(c), h[1] + f * Math.sin(c)], g = [p[0] + u * Math.cos(c + Math.PI / 4), p[1] + u * Math.sin(c + Math.PI / 4)];
|
|
190
|
+
a.push(...this.helper.doubleLineOps(p[0], p[1], g[0], g[1], e), ...this.helper.doubleLineOps(g[0], g[1], k[0], k[1], e));
|
|
191
|
+
}
|
|
192
|
+
})), a;
|
|
193
|
+
}
|
|
194
|
+
}, S = {}, Ct = class {
|
|
195
|
+
constructor(t) {
|
|
196
|
+
this.seed = t;
|
|
197
|
+
}
|
|
198
|
+
next() {
|
|
199
|
+
return this.seed ? (2 ** 31 - 1 & (this.seed = Math.imul(48271, this.seed))) / 2 ** 31 : Math.random();
|
|
200
|
+
}
|
|
201
|
+
}, zt = 0, X = 1, lt = 2, q = {
|
|
202
|
+
A: 7,
|
|
203
|
+
a: 7,
|
|
204
|
+
C: 6,
|
|
205
|
+
c: 6,
|
|
206
|
+
H: 1,
|
|
207
|
+
h: 1,
|
|
208
|
+
L: 2,
|
|
209
|
+
l: 2,
|
|
210
|
+
M: 2,
|
|
211
|
+
m: 2,
|
|
212
|
+
Q: 4,
|
|
213
|
+
q: 4,
|
|
214
|
+
S: 4,
|
|
215
|
+
s: 4,
|
|
216
|
+
T: 2,
|
|
217
|
+
t: 2,
|
|
218
|
+
V: 1,
|
|
219
|
+
v: 1,
|
|
220
|
+
Z: 0,
|
|
221
|
+
z: 0
|
|
222
|
+
};
|
|
223
|
+
function Y(t, s) {
|
|
224
|
+
return t.type === s;
|
|
225
|
+
}
|
|
226
|
+
function ht(t) {
|
|
227
|
+
const s = [], e = (function(r) {
|
|
228
|
+
const h = new Array();
|
|
229
|
+
for (; r !== ""; ) if (r.match(/^([ \t\r\n,]+)/)) r = r.substr(RegExp.$1.length);
|
|
230
|
+
else if (r.match(/^([aAcChHlLmMqQsStTvVzZ])/)) h[h.length] = {
|
|
231
|
+
type: zt,
|
|
232
|
+
text: RegExp.$1
|
|
233
|
+
}, r = r.substr(RegExp.$1.length);
|
|
234
|
+
else {
|
|
235
|
+
if (!r.match(/^(([-+]?[0-9]+(\.[0-9]*)?|[-+]?\.[0-9]+)([eE][-+]?[0-9]+)?)/)) return [];
|
|
236
|
+
h[h.length] = {
|
|
237
|
+
type: X,
|
|
238
|
+
text: `${parseFloat(RegExp.$1)}`
|
|
239
|
+
}, r = r.substr(RegExp.$1.length);
|
|
240
|
+
}
|
|
241
|
+
return h[h.length] = {
|
|
242
|
+
type: lt,
|
|
243
|
+
text: ""
|
|
244
|
+
}, h;
|
|
245
|
+
})(t);
|
|
246
|
+
let a = "BOD", n = 0, o = e[n];
|
|
247
|
+
for (; !Y(o, lt); ) {
|
|
248
|
+
let r = 0;
|
|
249
|
+
const h = [];
|
|
250
|
+
if (a === "BOD") {
|
|
251
|
+
if (o.text !== "M" && o.text !== "m") return ht("M0,0" + t);
|
|
252
|
+
n++, r = q[o.text], a = o.text;
|
|
253
|
+
} else Y(o, X) ? r = q[a] : (n++, r = q[o.text], a = o.text);
|
|
254
|
+
if (!(n + r < e.length)) throw new Error("Path data ended short");
|
|
255
|
+
for (let i = n; i < n + r; i++) {
|
|
256
|
+
const c = e[i];
|
|
257
|
+
if (!Y(c, X)) throw new Error("Param not a number: " + a + "," + c.text);
|
|
258
|
+
h[h.length] = +c.text;
|
|
259
|
+
}
|
|
260
|
+
if (typeof q[a] != "number") throw new Error("Bad segment: " + a);
|
|
261
|
+
{
|
|
262
|
+
const i = {
|
|
263
|
+
key: a,
|
|
264
|
+
data: h
|
|
265
|
+
};
|
|
266
|
+
s.push(i), n += r, o = e[n], a === "M" && (a = "L"), a === "m" && (a = "l");
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return s;
|
|
270
|
+
}
|
|
271
|
+
function bt(t) {
|
|
272
|
+
let s = 0, e = 0, a = 0, n = 0;
|
|
273
|
+
const o = [];
|
|
274
|
+
for (const { key: r, data: h } of t) switch (r) {
|
|
275
|
+
case "M":
|
|
276
|
+
o.push({
|
|
277
|
+
key: "M",
|
|
278
|
+
data: [...h]
|
|
279
|
+
}), [s, e] = h, [a, n] = h;
|
|
280
|
+
break;
|
|
281
|
+
case "m":
|
|
282
|
+
s += h[0], e += h[1], o.push({
|
|
283
|
+
key: "M",
|
|
284
|
+
data: [s, e]
|
|
285
|
+
}), a = s, n = e;
|
|
286
|
+
break;
|
|
287
|
+
case "L":
|
|
288
|
+
o.push({
|
|
289
|
+
key: "L",
|
|
290
|
+
data: [...h]
|
|
291
|
+
}), [s, e] = h;
|
|
292
|
+
break;
|
|
293
|
+
case "l":
|
|
294
|
+
s += h[0], e += h[1], o.push({
|
|
295
|
+
key: "L",
|
|
296
|
+
data: [s, e]
|
|
297
|
+
});
|
|
298
|
+
break;
|
|
299
|
+
case "C":
|
|
300
|
+
o.push({
|
|
301
|
+
key: "C",
|
|
302
|
+
data: [...h]
|
|
303
|
+
}), s = h[4], e = h[5];
|
|
304
|
+
break;
|
|
305
|
+
case "c": {
|
|
306
|
+
const i = h.map(((c, l) => l % 2 ? c + e : c + s));
|
|
307
|
+
o.push({
|
|
308
|
+
key: "C",
|
|
309
|
+
data: i
|
|
310
|
+
}), s = i[4], e = i[5];
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
case "Q":
|
|
314
|
+
o.push({
|
|
315
|
+
key: "Q",
|
|
316
|
+
data: [...h]
|
|
317
|
+
}), s = h[2], e = h[3];
|
|
318
|
+
break;
|
|
319
|
+
case "q": {
|
|
320
|
+
const i = h.map(((c, l) => l % 2 ? c + e : c + s));
|
|
321
|
+
o.push({
|
|
322
|
+
key: "Q",
|
|
323
|
+
data: i
|
|
324
|
+
}), s = i[2], e = i[3];
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
case "A":
|
|
328
|
+
o.push({
|
|
329
|
+
key: "A",
|
|
330
|
+
data: [...h]
|
|
331
|
+
}), s = h[5], e = h[6];
|
|
332
|
+
break;
|
|
333
|
+
case "a":
|
|
334
|
+
s += h[5], e += h[6], o.push({
|
|
335
|
+
key: "A",
|
|
336
|
+
data: [
|
|
337
|
+
h[0],
|
|
338
|
+
h[1],
|
|
339
|
+
h[2],
|
|
340
|
+
h[3],
|
|
341
|
+
h[4],
|
|
342
|
+
s,
|
|
343
|
+
e
|
|
344
|
+
]
|
|
345
|
+
});
|
|
346
|
+
break;
|
|
347
|
+
case "H":
|
|
348
|
+
o.push({
|
|
349
|
+
key: "H",
|
|
350
|
+
data: [...h]
|
|
351
|
+
}), s = h[0];
|
|
352
|
+
break;
|
|
353
|
+
case "h":
|
|
354
|
+
s += h[0], o.push({
|
|
355
|
+
key: "H",
|
|
356
|
+
data: [s]
|
|
357
|
+
});
|
|
358
|
+
break;
|
|
359
|
+
case "V":
|
|
360
|
+
o.push({
|
|
361
|
+
key: "V",
|
|
362
|
+
data: [...h]
|
|
363
|
+
}), e = h[0];
|
|
364
|
+
break;
|
|
365
|
+
case "v":
|
|
366
|
+
e += h[0], o.push({
|
|
367
|
+
key: "V",
|
|
368
|
+
data: [e]
|
|
369
|
+
});
|
|
370
|
+
break;
|
|
371
|
+
case "S":
|
|
372
|
+
o.push({
|
|
373
|
+
key: "S",
|
|
374
|
+
data: [...h]
|
|
375
|
+
}), s = h[2], e = h[3];
|
|
376
|
+
break;
|
|
377
|
+
case "s": {
|
|
378
|
+
const i = h.map(((c, l) => l % 2 ? c + e : c + s));
|
|
379
|
+
o.push({
|
|
380
|
+
key: "S",
|
|
381
|
+
data: i
|
|
382
|
+
}), s = i[2], e = i[3];
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
case "T":
|
|
386
|
+
o.push({
|
|
387
|
+
key: "T",
|
|
388
|
+
data: [...h]
|
|
389
|
+
}), s = h[0], e = h[1];
|
|
390
|
+
break;
|
|
391
|
+
case "t":
|
|
392
|
+
s += h[0], e += h[1], o.push({
|
|
393
|
+
key: "T",
|
|
394
|
+
data: [s, e]
|
|
395
|
+
});
|
|
396
|
+
break;
|
|
397
|
+
case "Z":
|
|
398
|
+
case "z":
|
|
399
|
+
o.push({
|
|
400
|
+
key: "Z",
|
|
401
|
+
data: []
|
|
402
|
+
}), s = a, e = n;
|
|
403
|
+
}
|
|
404
|
+
return o;
|
|
405
|
+
}
|
|
406
|
+
function yt(t) {
|
|
407
|
+
const s = [];
|
|
408
|
+
let e = "", a = 0, n = 0, o = 0, r = 0, h = 0, i = 0;
|
|
409
|
+
for (const { key: c, data: l } of t) {
|
|
410
|
+
switch (c) {
|
|
411
|
+
case "M":
|
|
412
|
+
s.push({
|
|
413
|
+
key: "M",
|
|
414
|
+
data: [...l]
|
|
415
|
+
}), [a, n] = l, [o, r] = l;
|
|
416
|
+
break;
|
|
417
|
+
case "C":
|
|
418
|
+
s.push({
|
|
419
|
+
key: "C",
|
|
420
|
+
data: [...l]
|
|
421
|
+
}), a = l[4], n = l[5], h = l[2], i = l[3];
|
|
422
|
+
break;
|
|
423
|
+
case "L":
|
|
424
|
+
s.push({
|
|
425
|
+
key: "L",
|
|
426
|
+
data: [...l]
|
|
427
|
+
}), [a, n] = l;
|
|
428
|
+
break;
|
|
429
|
+
case "H":
|
|
430
|
+
a = l[0], s.push({
|
|
431
|
+
key: "L",
|
|
432
|
+
data: [a, n]
|
|
433
|
+
});
|
|
434
|
+
break;
|
|
435
|
+
case "V":
|
|
436
|
+
n = l[0], s.push({
|
|
437
|
+
key: "L",
|
|
438
|
+
data: [a, n]
|
|
439
|
+
});
|
|
440
|
+
break;
|
|
441
|
+
case "S": {
|
|
442
|
+
let d = 0, f = 0;
|
|
443
|
+
e === "C" || e === "S" ? (d = a + (a - h), f = n + (n - i)) : (d = a, f = n), s.push({
|
|
444
|
+
key: "C",
|
|
445
|
+
data: [
|
|
446
|
+
d,
|
|
447
|
+
f,
|
|
448
|
+
...l
|
|
449
|
+
]
|
|
450
|
+
}), h = l[0], i = l[1], a = l[2], n = l[3];
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
case "T": {
|
|
454
|
+
const [d, f] = l;
|
|
455
|
+
let u = 0, p = 0;
|
|
456
|
+
e === "Q" || e === "T" ? (u = a + (a - h), p = n + (n - i)) : (u = a, p = n);
|
|
457
|
+
const k = a + 2 * (u - a) / 3, g = n + 2 * (p - n) / 3, m = d + 2 * (u - d) / 3, M = f + 2 * (p - f) / 3;
|
|
458
|
+
s.push({
|
|
459
|
+
key: "C",
|
|
460
|
+
data: [
|
|
461
|
+
k,
|
|
462
|
+
g,
|
|
463
|
+
m,
|
|
464
|
+
M,
|
|
465
|
+
d,
|
|
466
|
+
f
|
|
467
|
+
]
|
|
468
|
+
}), h = u, i = p, a = d, n = f;
|
|
469
|
+
break;
|
|
470
|
+
}
|
|
471
|
+
case "Q": {
|
|
472
|
+
const [d, f, u, p] = l, k = a + 2 * (d - a) / 3, g = n + 2 * (f - n) / 3, m = u + 2 * (d - u) / 3, M = p + 2 * (f - p) / 3;
|
|
473
|
+
s.push({
|
|
474
|
+
key: "C",
|
|
475
|
+
data: [
|
|
476
|
+
k,
|
|
477
|
+
g,
|
|
478
|
+
m,
|
|
479
|
+
M,
|
|
480
|
+
u,
|
|
481
|
+
p
|
|
482
|
+
]
|
|
483
|
+
}), h = d, i = f, a = u, n = p;
|
|
484
|
+
break;
|
|
485
|
+
}
|
|
486
|
+
case "A": {
|
|
487
|
+
const d = Math.abs(l[0]), f = Math.abs(l[1]), u = l[2], p = l[3], k = l[4], g = l[5], m = l[6];
|
|
488
|
+
d === 0 || f === 0 ? (s.push({
|
|
489
|
+
key: "C",
|
|
490
|
+
data: [
|
|
491
|
+
a,
|
|
492
|
+
n,
|
|
493
|
+
g,
|
|
494
|
+
m,
|
|
495
|
+
g,
|
|
496
|
+
m
|
|
497
|
+
]
|
|
498
|
+
}), a = g, n = m) : (a !== g || n !== m) && (mt(a, n, g, m, d, f, u, p, k).forEach((function(M) {
|
|
499
|
+
s.push({
|
|
500
|
+
key: "C",
|
|
501
|
+
data: M
|
|
502
|
+
});
|
|
503
|
+
})), a = g, n = m);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
case "Z":
|
|
507
|
+
s.push({
|
|
508
|
+
key: "Z",
|
|
509
|
+
data: []
|
|
510
|
+
}), a = o, n = r;
|
|
511
|
+
}
|
|
512
|
+
e = c;
|
|
513
|
+
}
|
|
514
|
+
return s;
|
|
515
|
+
}
|
|
516
|
+
function G(t, s, e) {
|
|
517
|
+
return [t * Math.cos(e) - s * Math.sin(e), t * Math.sin(e) + s * Math.cos(e)];
|
|
518
|
+
}
|
|
519
|
+
function mt(t, s, e, a, n, o, r, h, i, c) {
|
|
520
|
+
const l = (d = r, Math.PI * d / 180);
|
|
521
|
+
var d;
|
|
522
|
+
let f = [], u = 0, p = 0, k = 0, g = 0;
|
|
523
|
+
if (c) [u, p, k, g] = c;
|
|
524
|
+
else {
|
|
525
|
+
[t, s] = G(t, s, -l), [e, a] = G(e, a, -l);
|
|
526
|
+
const L = (t - e) / 2, x = (s - a) / 2;
|
|
527
|
+
let A = L * L / (n * n) + x * x / (o * o);
|
|
528
|
+
A > 1 && (A = Math.sqrt(A), n *= A, o *= A);
|
|
529
|
+
const z = n * n, W = o * o, Pt = z * W - z * x * x - W * L * L, St = z * x * x + W * L * L, ct = (h === i ? -1 : 1) * Math.sqrt(Math.abs(Pt / St));
|
|
530
|
+
k = ct * n * x / o + (t + e) / 2, g = ct * -o * L / n + (s + a) / 2, u = Math.asin(parseFloat(((s - g) / o).toFixed(9))), p = Math.asin(parseFloat(((a - g) / o).toFixed(9))), t < k && (u = Math.PI - u), e < k && (p = Math.PI - p), u < 0 && (u = 2 * Math.PI + u), p < 0 && (p = 2 * Math.PI + p), i && u > p && (u -= 2 * Math.PI), !i && p > u && (p -= 2 * Math.PI);
|
|
531
|
+
}
|
|
532
|
+
let m = p - u;
|
|
533
|
+
if (Math.abs(m) > 120 * Math.PI / 180) {
|
|
534
|
+
const L = p, x = e, A = a;
|
|
535
|
+
p = i && p > u ? u + 120 * Math.PI / 180 * 1 : u + 120 * Math.PI / 180 * -1, f = mt(e = k + n * Math.cos(p), a = g + o * Math.sin(p), x, A, n, o, r, 0, i, [
|
|
536
|
+
p,
|
|
537
|
+
L,
|
|
538
|
+
k,
|
|
539
|
+
g
|
|
540
|
+
]);
|
|
541
|
+
}
|
|
542
|
+
m = p - u;
|
|
543
|
+
const M = Math.cos(u), y = Math.sin(u), w = Math.cos(p), v = Math.sin(p), P = Math.tan(m / 4), D = 4 / 3 * n * P, j = 4 / 3 * o * P, I = [t, s], T = [t + D * y, s - j * M], rt = [e + D * v, a - j * w], it = [e, a];
|
|
544
|
+
if (T[0] = 2 * I[0] - T[0], T[1] = 2 * I[1] - T[1], c) return [
|
|
545
|
+
T,
|
|
546
|
+
rt,
|
|
547
|
+
it
|
|
548
|
+
].concat(f);
|
|
549
|
+
{
|
|
550
|
+
f = [
|
|
551
|
+
T,
|
|
552
|
+
rt,
|
|
553
|
+
it
|
|
554
|
+
].concat(f);
|
|
555
|
+
const L = [];
|
|
556
|
+
for (let x = 0; x < f.length; x += 3) {
|
|
557
|
+
const A = G(f[x][0], f[x][1], l), z = G(f[x + 1][0], f[x + 1][1], l), W = G(f[x + 2][0], f[x + 2][1], l);
|
|
558
|
+
L.push([
|
|
559
|
+
A[0],
|
|
560
|
+
A[1],
|
|
561
|
+
z[0],
|
|
562
|
+
z[1],
|
|
563
|
+
W[0],
|
|
564
|
+
W[1]
|
|
565
|
+
]);
|
|
566
|
+
}
|
|
567
|
+
return L;
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
var Wt = {
|
|
571
|
+
randOffset: function(t, s) {
|
|
572
|
+
return b(t, s);
|
|
573
|
+
},
|
|
574
|
+
randOffsetWithRange: function(t, s, e) {
|
|
575
|
+
return H(t, s, e);
|
|
576
|
+
},
|
|
577
|
+
ellipse: function(t, s, e, a, n) {
|
|
578
|
+
return st(t, s, n, wt(e, a, n)).opset;
|
|
579
|
+
},
|
|
580
|
+
doubleLineOps: function(t, s, e, a, n) {
|
|
581
|
+
return _(t, s, e, a, n, !0);
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
function vt(t, s, e, a, n) {
|
|
585
|
+
return {
|
|
586
|
+
type: "path",
|
|
587
|
+
ops: _(t, s, e, a, n)
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
function Z(t, s, e) {
|
|
591
|
+
const a = (t || []).length;
|
|
592
|
+
if (a > 2) {
|
|
593
|
+
const n = [];
|
|
594
|
+
for (let o = 0; o < a - 1; o++) n.push(..._(t[o][0], t[o][1], t[o + 1][0], t[o + 1][1], e));
|
|
595
|
+
return s && n.push(..._(t[a - 1][0], t[a - 1][1], t[0][0], t[0][1], e)), {
|
|
596
|
+
type: "path",
|
|
597
|
+
ops: n
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
return a === 2 ? vt(t[0][0], t[0][1], t[1][0], t[1][1], e) : {
|
|
601
|
+
type: "path",
|
|
602
|
+
ops: []
|
|
603
|
+
};
|
|
604
|
+
}
|
|
605
|
+
function Et(t, s, e, a, n) {
|
|
606
|
+
return (function(o, r) {
|
|
607
|
+
return Z(o, !0, r);
|
|
608
|
+
})([
|
|
609
|
+
[t, s],
|
|
610
|
+
[t + e, s],
|
|
611
|
+
[t + e, s + a],
|
|
612
|
+
[t, s + a]
|
|
613
|
+
], n);
|
|
614
|
+
}
|
|
615
|
+
function ut(t, s) {
|
|
616
|
+
if (t.length) {
|
|
617
|
+
const e = typeof t[0][0] == "number" ? [t] : t, a = F(e[0], 1 * (1 + 0.2 * s.roughness), s), n = s.disableMultiStroke ? [] : F(e[0], 1.5 * (1 + 0.22 * s.roughness), dt(s));
|
|
618
|
+
for (let o = 1; o < e.length; o++) {
|
|
619
|
+
const r = e[o];
|
|
620
|
+
if (r.length) {
|
|
621
|
+
const h = F(r, 1 * (1 + 0.2 * s.roughness), s), i = s.disableMultiStroke ? [] : F(r, 1.5 * (1 + 0.22 * s.roughness), dt(s));
|
|
622
|
+
for (const c of h) c.op !== "move" && a.push(c);
|
|
623
|
+
for (const c of i) c.op !== "move" && n.push(c);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return {
|
|
627
|
+
type: "path",
|
|
628
|
+
ops: a.concat(n)
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
return {
|
|
632
|
+
type: "path",
|
|
633
|
+
ops: []
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
function wt(t, s, e) {
|
|
637
|
+
const a = Math.sqrt(2 * Math.PI * Math.sqrt((Math.pow(t / 2, 2) + Math.pow(s / 2, 2)) / 2)), n = Math.ceil(Math.max(e.curveStepCount, e.curveStepCount / Math.sqrt(200) * a)), o = 2 * Math.PI / n;
|
|
638
|
+
let r = Math.abs(t / 2), h = Math.abs(s / 2);
|
|
639
|
+
const i = 1 - e.curveFitting;
|
|
640
|
+
return r += b(r * i, e), h += b(h * i, e), {
|
|
641
|
+
increment: o,
|
|
642
|
+
rx: r,
|
|
643
|
+
ry: h
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function st(t, s, e, a) {
|
|
647
|
+
const [n, o] = gt(a.increment, t, s, a.rx, a.ry, 1, a.increment * H(0.1, H(0.4, 1, e), e), e);
|
|
648
|
+
let r = N(n, null, e);
|
|
649
|
+
if (!e.disableMultiStroke && e.roughness !== 0) {
|
|
650
|
+
const [h] = gt(a.increment, t, s, a.rx, a.ry, 1.5, 0, e), i = N(h, null, e);
|
|
651
|
+
r = r.concat(i);
|
|
652
|
+
}
|
|
653
|
+
return {
|
|
654
|
+
estimatedPoints: o,
|
|
655
|
+
opset: {
|
|
656
|
+
type: "path",
|
|
657
|
+
ops: r
|
|
658
|
+
}
|
|
659
|
+
};
|
|
660
|
+
}
|
|
661
|
+
function pt(t, s, e, a, n, o, r, h, i) {
|
|
662
|
+
const c = t, l = s;
|
|
663
|
+
let d = Math.abs(e / 2), f = Math.abs(a / 2);
|
|
664
|
+
d += b(0.01 * d, i), f += b(0.01 * f, i);
|
|
665
|
+
let u = n, p = o;
|
|
666
|
+
for (; u < 0; ) u += 2 * Math.PI, p += 2 * Math.PI;
|
|
667
|
+
p - u > 2 * Math.PI && (u = 0, p = 2 * Math.PI);
|
|
668
|
+
const k = 2 * Math.PI / i.curveStepCount, g = Math.min(k / 2, (p - u) / 2), m = Mt(g, c, l, d, f, u, p, 1, i);
|
|
669
|
+
if (!i.disableMultiStroke) {
|
|
670
|
+
const M = Mt(g, c, l, d, f, u, p, 1.5, i);
|
|
671
|
+
m.push(...M);
|
|
672
|
+
}
|
|
673
|
+
return r && (h ? m.push(..._(c, l, c + d * Math.cos(u), l + f * Math.sin(u), i), ..._(c, l, c + d * Math.cos(p), l + f * Math.sin(p), i)) : m.push({
|
|
674
|
+
op: "lineTo",
|
|
675
|
+
data: [c, l]
|
|
676
|
+
}, {
|
|
677
|
+
op: "lineTo",
|
|
678
|
+
data: [c + d * Math.cos(u), l + f * Math.sin(u)]
|
|
679
|
+
})), {
|
|
680
|
+
type: "path",
|
|
681
|
+
ops: m
|
|
682
|
+
};
|
|
683
|
+
}
|
|
684
|
+
function ft(t, s) {
|
|
685
|
+
const e = yt(bt(ht(t))), a = [];
|
|
686
|
+
let n = [0, 0], o = [0, 0];
|
|
687
|
+
for (const { key: r, data: h } of e) switch (r) {
|
|
688
|
+
case "M":
|
|
689
|
+
o = [h[0], h[1]], n = [h[0], h[1]];
|
|
690
|
+
break;
|
|
691
|
+
case "L":
|
|
692
|
+
a.push(..._(o[0], o[1], h[0], h[1], s)), o = [h[0], h[1]];
|
|
693
|
+
break;
|
|
694
|
+
case "C": {
|
|
695
|
+
const [i, c, l, d, f, u] = h;
|
|
696
|
+
a.push(...Gt(i, c, l, d, f, u, o, s)), o = [f, u];
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
case "Z":
|
|
700
|
+
a.push(..._(o[0], o[1], n[0], n[1], s)), o = [n[0], n[1]];
|
|
701
|
+
}
|
|
702
|
+
return {
|
|
703
|
+
type: "path",
|
|
704
|
+
ops: a
|
|
705
|
+
};
|
|
706
|
+
}
|
|
707
|
+
function tt(t, s) {
|
|
708
|
+
const e = [];
|
|
709
|
+
for (const a of t) if (a.length) {
|
|
710
|
+
const n = s.maxRandomnessOffset || 0, o = a.length;
|
|
711
|
+
if (o > 2) {
|
|
712
|
+
e.push({
|
|
713
|
+
op: "move",
|
|
714
|
+
data: [a[0][0] + b(n, s), a[0][1] + b(n, s)]
|
|
715
|
+
});
|
|
716
|
+
for (let r = 1; r < o; r++) e.push({
|
|
717
|
+
op: "lineTo",
|
|
718
|
+
data: [a[r][0] + b(n, s), a[r][1] + b(n, s)]
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
type: "fillPath",
|
|
724
|
+
ops: e
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
function E(t, s) {
|
|
728
|
+
return (function(e, a) {
|
|
729
|
+
let n = e.fillStyle || "hachure";
|
|
730
|
+
if (!S[n]) switch (n) {
|
|
731
|
+
case "zigzag":
|
|
732
|
+
S[n] || (S[n] = new Tt(a));
|
|
733
|
+
break;
|
|
734
|
+
case "cross-hatch":
|
|
735
|
+
S[n] || (S[n] = new Dt(a));
|
|
736
|
+
break;
|
|
737
|
+
case "dots":
|
|
738
|
+
S[n] || (S[n] = new At(a));
|
|
739
|
+
break;
|
|
740
|
+
case "dashed":
|
|
741
|
+
S[n] || (S[n] = new _t(a));
|
|
742
|
+
break;
|
|
743
|
+
case "zigzag-line":
|
|
744
|
+
S[n] || (S[n] = new It(a));
|
|
745
|
+
break;
|
|
746
|
+
default:
|
|
747
|
+
n = "hachure", S[n] || (S[n] = new ot(a));
|
|
748
|
+
}
|
|
749
|
+
return S[n];
|
|
750
|
+
})(s, Wt).fillPolygons(t, s);
|
|
751
|
+
}
|
|
752
|
+
function dt(t) {
|
|
753
|
+
const s = Object.assign({}, t);
|
|
754
|
+
return s.randomizer = void 0, t.seed && (s.seed = t.seed + 1), s;
|
|
755
|
+
}
|
|
756
|
+
function xt(t) {
|
|
757
|
+
return t.randomizer || (t.randomizer = new Ct(t.seed || 0)), t.randomizer.next();
|
|
758
|
+
}
|
|
759
|
+
function H(t, s, e, a = 1) {
|
|
760
|
+
return e.roughness * a * (xt(e) * (s - t) + t);
|
|
761
|
+
}
|
|
762
|
+
function b(t, s, e = 1) {
|
|
763
|
+
return H(-t, t, s, e);
|
|
764
|
+
}
|
|
765
|
+
function _(t, s, e, a, n, o = !1) {
|
|
766
|
+
const r = o ? n.disableMultiStrokeFill : n.disableMultiStroke, h = nt(t, s, e, a, n, !0, !1);
|
|
767
|
+
if (r) return h;
|
|
768
|
+
const i = nt(t, s, e, a, n, !0, !0);
|
|
769
|
+
return h.concat(i);
|
|
770
|
+
}
|
|
771
|
+
function nt(t, s, e, a, n, o, r) {
|
|
772
|
+
const h = Math.pow(t - e, 2) + Math.pow(s - a, 2), i = Math.sqrt(h);
|
|
773
|
+
let c = 1;
|
|
774
|
+
c = i < 200 ? 1 : i > 500 ? 0.4 : -16668e-7 * i + 1.233334;
|
|
775
|
+
let l = n.maxRandomnessOffset || 0;
|
|
776
|
+
l * l * 100 > h && (l = i / 10);
|
|
777
|
+
const d = l / 2, f = 0.2 + 0.2 * xt(n);
|
|
778
|
+
let u = n.bowing * n.maxRandomnessOffset * (a - s) / 200, p = n.bowing * n.maxRandomnessOffset * (t - e) / 200;
|
|
779
|
+
u = b(u, n, c), p = b(p, n, c);
|
|
780
|
+
const k = [], g = () => b(d, n, c), m = () => b(l, n, c), M = n.preserveVertices;
|
|
781
|
+
return o && (r ? k.push({
|
|
782
|
+
op: "move",
|
|
783
|
+
data: [t + (M ? 0 : g()), s + (M ? 0 : g())]
|
|
784
|
+
}) : k.push({
|
|
785
|
+
op: "move",
|
|
786
|
+
data: [t + (M ? 0 : b(l, n, c)), s + (M ? 0 : b(l, n, c))]
|
|
787
|
+
})), r ? k.push({
|
|
788
|
+
op: "bcurveTo",
|
|
789
|
+
data: [
|
|
790
|
+
u + t + (e - t) * f + g(),
|
|
791
|
+
p + s + (a - s) * f + g(),
|
|
792
|
+
u + t + 2 * (e - t) * f + g(),
|
|
793
|
+
p + s + 2 * (a - s) * f + g(),
|
|
794
|
+
e + (M ? 0 : g()),
|
|
795
|
+
a + (M ? 0 : g())
|
|
796
|
+
]
|
|
797
|
+
}) : k.push({
|
|
798
|
+
op: "bcurveTo",
|
|
799
|
+
data: [
|
|
800
|
+
u + t + (e - t) * f + m(),
|
|
801
|
+
p + s + (a - s) * f + m(),
|
|
802
|
+
u + t + 2 * (e - t) * f + m(),
|
|
803
|
+
p + s + 2 * (a - s) * f + m(),
|
|
804
|
+
e + (M ? 0 : m()),
|
|
805
|
+
a + (M ? 0 : m())
|
|
806
|
+
]
|
|
807
|
+
}), k;
|
|
808
|
+
}
|
|
809
|
+
function F(t, s, e) {
|
|
810
|
+
if (!t.length) return [];
|
|
811
|
+
const a = [];
|
|
812
|
+
a.push([t[0][0] + b(s, e), t[0][1] + b(s, e)]), a.push([t[0][0] + b(s, e), t[0][1] + b(s, e)]);
|
|
813
|
+
for (let n = 1; n < t.length; n++) a.push([t[n][0] + b(s, e), t[n][1] + b(s, e)]), n === t.length - 1 && a.push([t[n][0] + b(s, e), t[n][1] + b(s, e)]);
|
|
814
|
+
return N(a, null, e);
|
|
815
|
+
}
|
|
816
|
+
function N(t, s, e) {
|
|
817
|
+
const a = t.length, n = [];
|
|
818
|
+
if (a > 3) {
|
|
819
|
+
const o = [], r = 1 - e.curveTightness;
|
|
820
|
+
n.push({
|
|
821
|
+
op: "move",
|
|
822
|
+
data: [t[1][0], t[1][1]]
|
|
823
|
+
});
|
|
824
|
+
for (let h = 1; h + 2 < a; h++) {
|
|
825
|
+
const i = t[h];
|
|
826
|
+
o[0] = [i[0], i[1]], o[1] = [i[0] + (r * t[h + 1][0] - r * t[h - 1][0]) / 6, i[1] + (r * t[h + 1][1] - r * t[h - 1][1]) / 6], o[2] = [t[h + 1][0] + (r * t[h][0] - r * t[h + 2][0]) / 6, t[h + 1][1] + (r * t[h][1] - r * t[h + 2][1]) / 6], o[3] = [t[h + 1][0], t[h + 1][1]], n.push({
|
|
827
|
+
op: "bcurveTo",
|
|
828
|
+
data: [
|
|
829
|
+
o[1][0],
|
|
830
|
+
o[1][1],
|
|
831
|
+
o[2][0],
|
|
832
|
+
o[2][1],
|
|
833
|
+
o[3][0],
|
|
834
|
+
o[3][1]
|
|
835
|
+
]
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
if (s && s.length === 2) {
|
|
839
|
+
const h = e.maxRandomnessOffset;
|
|
840
|
+
n.push({
|
|
841
|
+
op: "lineTo",
|
|
842
|
+
data: [s[0] + b(h, e), s[1] + b(h, e)]
|
|
843
|
+
});
|
|
844
|
+
}
|
|
845
|
+
} else a === 3 ? (n.push({
|
|
846
|
+
op: "move",
|
|
847
|
+
data: [t[1][0], t[1][1]]
|
|
848
|
+
}), n.push({
|
|
849
|
+
op: "bcurveTo",
|
|
850
|
+
data: [
|
|
851
|
+
t[1][0],
|
|
852
|
+
t[1][1],
|
|
853
|
+
t[2][0],
|
|
854
|
+
t[2][1],
|
|
855
|
+
t[2][0],
|
|
856
|
+
t[2][1]
|
|
857
|
+
]
|
|
858
|
+
})) : a === 2 && n.push(...nt(t[0][0], t[0][1], t[1][0], t[1][1], e, !0, !0));
|
|
859
|
+
return n;
|
|
860
|
+
}
|
|
861
|
+
function gt(t, s, e, a, n, o, r, h) {
|
|
862
|
+
const i = [], c = [];
|
|
863
|
+
if (h.roughness === 0) {
|
|
864
|
+
t /= 4, c.push([s + a * Math.cos(-t), e + n * Math.sin(-t)]);
|
|
865
|
+
for (let l = 0; l <= 2 * Math.PI; l += t) {
|
|
866
|
+
const d = [s + a * Math.cos(l), e + n * Math.sin(l)];
|
|
867
|
+
i.push(d), c.push(d);
|
|
868
|
+
}
|
|
869
|
+
c.push([s + a * Math.cos(0), e + n * Math.sin(0)]), c.push([s + a * Math.cos(t), e + n * Math.sin(t)]);
|
|
870
|
+
} else {
|
|
871
|
+
const l = b(0.5, h) - Math.PI / 2;
|
|
872
|
+
c.push([b(o, h) + s + 0.9 * a * Math.cos(l - t), b(o, h) + e + 0.9 * n * Math.sin(l - t)]);
|
|
873
|
+
const d = 2 * Math.PI + l - 0.01;
|
|
874
|
+
for (let f = l; f < d; f += t) {
|
|
875
|
+
const u = [b(o, h) + s + a * Math.cos(f), b(o, h) + e + n * Math.sin(f)];
|
|
876
|
+
i.push(u), c.push(u);
|
|
877
|
+
}
|
|
878
|
+
c.push([b(o, h) + s + a * Math.cos(l + 2 * Math.PI + 0.5 * r), b(o, h) + e + n * Math.sin(l + 2 * Math.PI + 0.5 * r)]), c.push([b(o, h) + s + 0.98 * a * Math.cos(l + r), b(o, h) + e + 0.98 * n * Math.sin(l + r)]), c.push([b(o, h) + s + 0.9 * a * Math.cos(l + 0.5 * r), b(o, h) + e + 0.9 * n * Math.sin(l + 0.5 * r)]);
|
|
879
|
+
}
|
|
880
|
+
return [c, i];
|
|
881
|
+
}
|
|
882
|
+
function Mt(t, s, e, a, n, o, r, h, i) {
|
|
883
|
+
const c = o + b(0.1, i), l = [];
|
|
884
|
+
l.push([b(h, i) + s + 0.9 * a * Math.cos(c - t), b(h, i) + e + 0.9 * n * Math.sin(c - t)]);
|
|
885
|
+
for (let d = c; d <= r; d += t) l.push([b(h, i) + s + a * Math.cos(d), b(h, i) + e + n * Math.sin(d)]);
|
|
886
|
+
return l.push([s + a * Math.cos(r), e + n * Math.sin(r)]), l.push([s + a * Math.cos(r), e + n * Math.sin(r)]), N(l, null, i);
|
|
887
|
+
}
|
|
888
|
+
function Gt(t, s, e, a, n, o, r, h) {
|
|
889
|
+
const i = [], c = [h.maxRandomnessOffset || 1, (h.maxRandomnessOffset || 1) + 0.3];
|
|
890
|
+
let l = [0, 0];
|
|
891
|
+
const d = h.disableMultiStroke ? 1 : 2, f = h.preserveVertices;
|
|
892
|
+
for (let u = 0; u < d; u++) u === 0 ? i.push({
|
|
893
|
+
op: "move",
|
|
894
|
+
data: [r[0], r[1]]
|
|
895
|
+
}) : i.push({
|
|
896
|
+
op: "move",
|
|
897
|
+
data: [r[0] + (f ? 0 : b(c[0], h)), r[1] + (f ? 0 : b(c[0], h))]
|
|
898
|
+
}), l = f ? [n, o] : [n + b(c[u], h), o + b(c[u], h)], i.push({
|
|
899
|
+
op: "bcurveTo",
|
|
900
|
+
data: [
|
|
901
|
+
t + b(c[u], h),
|
|
902
|
+
s + b(c[u], h),
|
|
903
|
+
e + b(c[u], h),
|
|
904
|
+
a + b(c[u], h),
|
|
905
|
+
l[0],
|
|
906
|
+
l[1]
|
|
907
|
+
]
|
|
908
|
+
});
|
|
909
|
+
return i;
|
|
910
|
+
}
|
|
911
|
+
function $(t) {
|
|
912
|
+
return [...t];
|
|
913
|
+
}
|
|
914
|
+
function kt(t, s = 0) {
|
|
915
|
+
const e = t.length;
|
|
916
|
+
if (e < 3) throw new Error("A curve must have at least three points.");
|
|
917
|
+
const a = [];
|
|
918
|
+
if (e === 3) a.push($(t[0]), $(t[1]), $(t[2]), $(t[2]));
|
|
919
|
+
else {
|
|
920
|
+
const n = [];
|
|
921
|
+
n.push(t[0], t[0]);
|
|
922
|
+
for (let h = 1; h < t.length; h++) n.push(t[h]), h === t.length - 1 && n.push(t[h]);
|
|
923
|
+
const o = [], r = 1 - s;
|
|
924
|
+
a.push($(n[0]));
|
|
925
|
+
for (let h = 1; h + 2 < n.length; h++) {
|
|
926
|
+
const i = n[h];
|
|
927
|
+
o[0] = [i[0], i[1]], o[1] = [i[0] + (r * n[h + 1][0] - r * n[h - 1][0]) / 6, i[1] + (r * n[h + 1][1] - r * n[h - 1][1]) / 6], o[2] = [n[h + 1][0] + (r * n[h][0] - r * n[h + 2][0]) / 6, n[h + 1][1] + (r * n[h][1] - r * n[h + 2][1]) / 6], o[3] = [n[h + 1][0], n[h + 1][1]], a.push(o[1], o[2], o[3]);
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
return a;
|
|
931
|
+
}
|
|
932
|
+
function Q(t, s) {
|
|
933
|
+
return Math.pow(t[0] - s[0], 2) + Math.pow(t[1] - s[1], 2);
|
|
934
|
+
}
|
|
935
|
+
function $t(t, s, e) {
|
|
936
|
+
const a = Q(s, e);
|
|
937
|
+
if (a === 0) return Q(t, s);
|
|
938
|
+
let n = ((t[0] - s[0]) * (e[0] - s[0]) + (t[1] - s[1]) * (e[1] - s[1])) / a;
|
|
939
|
+
return n = Math.max(0, Math.min(1, n)), Q(t, C(s, e, n));
|
|
940
|
+
}
|
|
941
|
+
function C(t, s, e) {
|
|
942
|
+
return [t[0] + (s[0] - t[0]) * e, t[1] + (s[1] - t[1]) * e];
|
|
943
|
+
}
|
|
944
|
+
function at(t, s, e, a) {
|
|
945
|
+
const n = a || [];
|
|
946
|
+
if ((function(h, i) {
|
|
947
|
+
const c = h[i + 0], l = h[i + 1], d = h[i + 2], f = h[i + 3];
|
|
948
|
+
let u = 3 * l[0] - 2 * c[0] - f[0];
|
|
949
|
+
u *= u;
|
|
950
|
+
let p = 3 * l[1] - 2 * c[1] - f[1];
|
|
951
|
+
p *= p;
|
|
952
|
+
let k = 3 * d[0] - 2 * f[0] - c[0];
|
|
953
|
+
k *= k;
|
|
954
|
+
let g = 3 * d[1] - 2 * f[1] - c[1];
|
|
955
|
+
return g *= g, u < k && (u = k), p < g && (p = g), u + p;
|
|
956
|
+
})(t, s) < e) {
|
|
957
|
+
const h = t[s + 0];
|
|
958
|
+
n.length ? (o = n[n.length - 1], r = h, Math.sqrt(Q(o, r)) > 1 && n.push(h)) : n.push(h), n.push(t[s + 3]);
|
|
959
|
+
} else {
|
|
960
|
+
const i = t[s + 0], c = t[s + 1], l = t[s + 2], d = t[s + 3], f = C(i, c, 0.5), u = C(c, l, 0.5), p = C(l, d, 0.5), k = C(f, u, 0.5), g = C(u, p, 0.5), m = C(k, g, 0.5);
|
|
961
|
+
at([
|
|
962
|
+
i,
|
|
963
|
+
f,
|
|
964
|
+
k,
|
|
965
|
+
m
|
|
966
|
+
], 0, e, n), at([
|
|
967
|
+
m,
|
|
968
|
+
g,
|
|
969
|
+
p,
|
|
970
|
+
d
|
|
971
|
+
], 0, e, n);
|
|
972
|
+
}
|
|
973
|
+
var o, r;
|
|
974
|
+
return n;
|
|
975
|
+
}
|
|
976
|
+
function Rt(t, s) {
|
|
977
|
+
return B(t, 0, t.length, s);
|
|
978
|
+
}
|
|
979
|
+
function B(t, s, e, a, n) {
|
|
980
|
+
const o = n || [], r = t[s], h = t[e - 1];
|
|
981
|
+
let i = 0, c = 1;
|
|
982
|
+
for (let l = s + 1; l < e - 1; ++l) {
|
|
983
|
+
const d = $t(t[l], r, h);
|
|
984
|
+
d > i && (i = d, c = l);
|
|
985
|
+
}
|
|
986
|
+
return Math.sqrt(i) > a ? (B(t, s, c + 1, a, o), B(t, c, e, a, o)) : (o.length || o.push(r), o.push(h)), o;
|
|
987
|
+
}
|
|
988
|
+
function et(t, s = 0.15, e) {
|
|
989
|
+
const a = [], n = (t.length - 1) / 3;
|
|
990
|
+
for (let o = 0; o < n; o++) at(t, 3 * o, s, a);
|
|
991
|
+
return e && e > 0 ? B(a, 0, a.length, e) : a;
|
|
992
|
+
}
|
|
993
|
+
var O = "none", J = class {
|
|
994
|
+
constructor(t) {
|
|
995
|
+
this.defaultOptions = {
|
|
996
|
+
maxRandomnessOffset: 2,
|
|
997
|
+
roughness: 1,
|
|
998
|
+
bowing: 1,
|
|
999
|
+
stroke: "#000",
|
|
1000
|
+
strokeWidth: 1,
|
|
1001
|
+
curveTightness: 0,
|
|
1002
|
+
curveFitting: 0.95,
|
|
1003
|
+
curveStepCount: 9,
|
|
1004
|
+
fillStyle: "hachure",
|
|
1005
|
+
fillWeight: -1,
|
|
1006
|
+
hachureAngle: -41,
|
|
1007
|
+
hachureGap: -1,
|
|
1008
|
+
dashOffset: -1,
|
|
1009
|
+
dashGap: -1,
|
|
1010
|
+
zigzagOffset: -1,
|
|
1011
|
+
seed: 0,
|
|
1012
|
+
disableMultiStroke: !1,
|
|
1013
|
+
disableMultiStrokeFill: !1,
|
|
1014
|
+
preserveVertices: !1,
|
|
1015
|
+
fillShapeRoughnessGain: 0.8
|
|
1016
|
+
}, this.config = t || {}, this.config.options && (this.defaultOptions = this._o(this.config.options));
|
|
1017
|
+
}
|
|
1018
|
+
static newSeed() {
|
|
1019
|
+
return Math.floor(Math.random() * 2 ** 31);
|
|
1020
|
+
}
|
|
1021
|
+
_o(t) {
|
|
1022
|
+
return t ? Object.assign({}, this.defaultOptions, t) : this.defaultOptions;
|
|
1023
|
+
}
|
|
1024
|
+
_d(t, s, e) {
|
|
1025
|
+
return {
|
|
1026
|
+
shape: t,
|
|
1027
|
+
sets: s || [],
|
|
1028
|
+
options: e || this.defaultOptions
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
line(t, s, e, a, n) {
|
|
1032
|
+
const o = this._o(n);
|
|
1033
|
+
return this._d("line", [vt(t, s, e, a, o)], o);
|
|
1034
|
+
}
|
|
1035
|
+
rectangle(t, s, e, a, n) {
|
|
1036
|
+
const o = this._o(n), r = [], h = Et(t, s, e, a, o);
|
|
1037
|
+
if (o.fill) {
|
|
1038
|
+
const i = [
|
|
1039
|
+
[t, s],
|
|
1040
|
+
[t + e, s],
|
|
1041
|
+
[t + e, s + a],
|
|
1042
|
+
[t, s + a]
|
|
1043
|
+
];
|
|
1044
|
+
o.fillStyle === "solid" ? r.push(tt([i], o)) : r.push(E([i], o));
|
|
1045
|
+
}
|
|
1046
|
+
return o.stroke !== O && r.push(h), this._d("rectangle", r, o);
|
|
1047
|
+
}
|
|
1048
|
+
ellipse(t, s, e, a, n) {
|
|
1049
|
+
const o = this._o(n), r = [], h = wt(e, a, o), i = st(t, s, o, h);
|
|
1050
|
+
if (o.fill) if (o.fillStyle === "solid") {
|
|
1051
|
+
const c = st(t, s, o, h).opset;
|
|
1052
|
+
c.type = "fillPath", r.push(c);
|
|
1053
|
+
} else r.push(E([i.estimatedPoints], o));
|
|
1054
|
+
return o.stroke !== O && r.push(i.opset), this._d("ellipse", r, o);
|
|
1055
|
+
}
|
|
1056
|
+
circle(t, s, e, a) {
|
|
1057
|
+
const n = this.ellipse(t, s, e, e, a);
|
|
1058
|
+
return n.shape = "circle", n;
|
|
1059
|
+
}
|
|
1060
|
+
linearPath(t, s) {
|
|
1061
|
+
const e = this._o(s);
|
|
1062
|
+
return this._d("linearPath", [Z(t, !1, e)], e);
|
|
1063
|
+
}
|
|
1064
|
+
arc(t, s, e, a, n, o, r = !1, h) {
|
|
1065
|
+
const i = this._o(h), c = [], l = pt(t, s, e, a, n, o, r, !0, i);
|
|
1066
|
+
if (r && i.fill) if (i.fillStyle === "solid") {
|
|
1067
|
+
const d = Object.assign({}, i);
|
|
1068
|
+
d.disableMultiStroke = !0;
|
|
1069
|
+
const f = pt(t, s, e, a, n, o, !0, !1, d);
|
|
1070
|
+
f.type = "fillPath", c.push(f);
|
|
1071
|
+
} else c.push((function(d, f, u, p, k, g, m) {
|
|
1072
|
+
const M = d, y = f;
|
|
1073
|
+
let w = Math.abs(u / 2), v = Math.abs(p / 2);
|
|
1074
|
+
w += b(0.01 * w, m), v += b(0.01 * v, m);
|
|
1075
|
+
let P = k, D = g;
|
|
1076
|
+
for (; P < 0; ) P += 2 * Math.PI, D += 2 * Math.PI;
|
|
1077
|
+
D - P > 2 * Math.PI && (P = 0, D = 2 * Math.PI);
|
|
1078
|
+
const j = (D - P) / m.curveStepCount, I = [];
|
|
1079
|
+
for (let T = P; T <= D; T += j) I.push([M + w * Math.cos(T), y + v * Math.sin(T)]);
|
|
1080
|
+
return I.push([M + w * Math.cos(D), y + v * Math.sin(D)]), I.push([M, y]), E([I], m);
|
|
1081
|
+
})(t, s, e, a, n, o, i));
|
|
1082
|
+
return i.stroke !== O && c.push(l), this._d("arc", c, i);
|
|
1083
|
+
}
|
|
1084
|
+
curve(t, s) {
|
|
1085
|
+
const e = this._o(s), a = [], n = ut(t, e);
|
|
1086
|
+
if (e.fill && e.fill !== O) if (e.fillStyle === "solid") {
|
|
1087
|
+
const o = ut(t, Object.assign(Object.assign({}, e), {
|
|
1088
|
+
disableMultiStroke: !0,
|
|
1089
|
+
roughness: e.roughness ? e.roughness + e.fillShapeRoughnessGain : 0
|
|
1090
|
+
}));
|
|
1091
|
+
a.push({
|
|
1092
|
+
type: "fillPath",
|
|
1093
|
+
ops: this._mergedShape(o.ops)
|
|
1094
|
+
});
|
|
1095
|
+
} else {
|
|
1096
|
+
const o = [], r = t;
|
|
1097
|
+
if (r.length) {
|
|
1098
|
+
const h = typeof r[0][0] == "number" ? [r] : r;
|
|
1099
|
+
for (const i of h) i.length < 3 ? o.push(...i) : i.length === 3 ? o.push(...et(kt([
|
|
1100
|
+
i[0],
|
|
1101
|
+
i[0],
|
|
1102
|
+
i[1],
|
|
1103
|
+
i[2]
|
|
1104
|
+
]), 10, (1 + e.roughness) / 2)) : o.push(...et(kt(i), 10, (1 + e.roughness) / 2));
|
|
1105
|
+
}
|
|
1106
|
+
o.length && a.push(E([o], e));
|
|
1107
|
+
}
|
|
1108
|
+
return e.stroke !== O && a.push(n), this._d("curve", a, e);
|
|
1109
|
+
}
|
|
1110
|
+
polygon(t, s) {
|
|
1111
|
+
const e = this._o(s), a = [], n = Z(t, !0, e);
|
|
1112
|
+
return e.fill && (e.fillStyle === "solid" ? a.push(tt([t], e)) : a.push(E([t], e))), e.stroke !== O && a.push(n), this._d("polygon", a, e);
|
|
1113
|
+
}
|
|
1114
|
+
path(t, s) {
|
|
1115
|
+
const e = this._o(s), a = [];
|
|
1116
|
+
if (!t) return this._d("path", a, e);
|
|
1117
|
+
t = (t || "").replace(/\n/g, " ").replace(/(-\s)/g, "-").replace("/(ss)/g", " ");
|
|
1118
|
+
const n = e.fill && e.fill !== "transparent" && e.fill !== O, o = e.stroke !== O, r = !!(e.simplification && e.simplification < 1), h = (function(c, l, d) {
|
|
1119
|
+
const f = yt(bt(ht(c))), u = [];
|
|
1120
|
+
let p = [], k = [0, 0], g = [];
|
|
1121
|
+
const m = () => {
|
|
1122
|
+
g.length >= 4 && p.push(...et(g, l)), g = [];
|
|
1123
|
+
}, M = () => {
|
|
1124
|
+
m(), p.length && (u.push(p), p = []);
|
|
1125
|
+
};
|
|
1126
|
+
for (const { key: w, data: v } of f) switch (w) {
|
|
1127
|
+
case "M":
|
|
1128
|
+
M(), k = [v[0], v[1]], p.push(k);
|
|
1129
|
+
break;
|
|
1130
|
+
case "L":
|
|
1131
|
+
m(), p.push([v[0], v[1]]);
|
|
1132
|
+
break;
|
|
1133
|
+
case "C":
|
|
1134
|
+
if (!g.length) {
|
|
1135
|
+
const P = p.length ? p[p.length - 1] : k;
|
|
1136
|
+
g.push([P[0], P[1]]);
|
|
1137
|
+
}
|
|
1138
|
+
g.push([v[0], v[1]]), g.push([v[2], v[3]]), g.push([v[4], v[5]]);
|
|
1139
|
+
break;
|
|
1140
|
+
case "Z":
|
|
1141
|
+
m(), p.push([k[0], k[1]]);
|
|
1142
|
+
}
|
|
1143
|
+
if (M(), !d) return u;
|
|
1144
|
+
const y = [];
|
|
1145
|
+
for (const w of u) {
|
|
1146
|
+
const v = Rt(w, d);
|
|
1147
|
+
v.length && y.push(v);
|
|
1148
|
+
}
|
|
1149
|
+
return y;
|
|
1150
|
+
})(t, 1, r ? 4 - 4 * (e.simplification || 1) : (1 + e.roughness) / 2), i = ft(t, e);
|
|
1151
|
+
if (n) if (e.fillStyle === "solid") if (h.length === 1) {
|
|
1152
|
+
const c = ft(t, Object.assign(Object.assign({}, e), {
|
|
1153
|
+
disableMultiStroke: !0,
|
|
1154
|
+
roughness: e.roughness ? e.roughness + e.fillShapeRoughnessGain : 0
|
|
1155
|
+
}));
|
|
1156
|
+
a.push({
|
|
1157
|
+
type: "fillPath",
|
|
1158
|
+
ops: this._mergedShape(c.ops)
|
|
1159
|
+
});
|
|
1160
|
+
} else a.push(tt(h, e));
|
|
1161
|
+
else a.push(E(h, e));
|
|
1162
|
+
return o && (r ? h.forEach(((c) => {
|
|
1163
|
+
a.push(Z(c, !1, e));
|
|
1164
|
+
})) : a.push(i)), this._d("path", a, e);
|
|
1165
|
+
}
|
|
1166
|
+
opsToPath(t, s) {
|
|
1167
|
+
let e = "";
|
|
1168
|
+
for (const a of t.ops) {
|
|
1169
|
+
const n = typeof s == "number" && s >= 0 ? a.data.map(((o) => +o.toFixed(s))) : a.data;
|
|
1170
|
+
switch (a.op) {
|
|
1171
|
+
case "move":
|
|
1172
|
+
e += `M${n[0]} ${n[1]} `;
|
|
1173
|
+
break;
|
|
1174
|
+
case "bcurveTo":
|
|
1175
|
+
e += `C${n[0]} ${n[1]}, ${n[2]} ${n[3]}, ${n[4]} ${n[5]} `;
|
|
1176
|
+
break;
|
|
1177
|
+
case "lineTo":
|
|
1178
|
+
e += `L${n[0]} ${n[1]} `;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
return e.trim();
|
|
1182
|
+
}
|
|
1183
|
+
toPaths(t) {
|
|
1184
|
+
const s = t.sets || [], e = t.options || this.defaultOptions, a = [];
|
|
1185
|
+
for (const n of s) {
|
|
1186
|
+
let o = null;
|
|
1187
|
+
switch (n.type) {
|
|
1188
|
+
case "path":
|
|
1189
|
+
o = {
|
|
1190
|
+
d: this.opsToPath(n),
|
|
1191
|
+
stroke: e.stroke,
|
|
1192
|
+
strokeWidth: e.strokeWidth,
|
|
1193
|
+
fill: O
|
|
1194
|
+
};
|
|
1195
|
+
break;
|
|
1196
|
+
case "fillPath":
|
|
1197
|
+
o = {
|
|
1198
|
+
d: this.opsToPath(n),
|
|
1199
|
+
stroke: O,
|
|
1200
|
+
strokeWidth: 0,
|
|
1201
|
+
fill: e.fill || O
|
|
1202
|
+
};
|
|
1203
|
+
break;
|
|
1204
|
+
case "fillSketch":
|
|
1205
|
+
o = this.fillSketch(n, e);
|
|
1206
|
+
}
|
|
1207
|
+
o && a.push(o);
|
|
1208
|
+
}
|
|
1209
|
+
return a;
|
|
1210
|
+
}
|
|
1211
|
+
fillSketch(t, s) {
|
|
1212
|
+
let e = s.fillWeight;
|
|
1213
|
+
return e < 0 && (e = s.strokeWidth / 2), {
|
|
1214
|
+
d: this.opsToPath(t),
|
|
1215
|
+
stroke: s.fill || O,
|
|
1216
|
+
strokeWidth: e,
|
|
1217
|
+
fill: O
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
_mergedShape(t) {
|
|
1221
|
+
return t.filter(((s, e) => e === 0 || s.op !== "move"));
|
|
1222
|
+
}
|
|
1223
|
+
}, jt = class {
|
|
1224
|
+
constructor(t, s) {
|
|
1225
|
+
this.canvas = t, this.ctx = this.canvas.getContext("2d"), this.gen = new J(s);
|
|
1226
|
+
}
|
|
1227
|
+
draw(t) {
|
|
1228
|
+
const s = t.sets || [], e = t.options || this.getDefaultOptions(), a = this.ctx, n = t.options.fixedDecimalPlaceDigits;
|
|
1229
|
+
for (const o of s) switch (o.type) {
|
|
1230
|
+
case "path":
|
|
1231
|
+
a.save(), a.strokeStyle = e.stroke === "none" ? "transparent" : e.stroke, a.lineWidth = e.strokeWidth, e.strokeLineDash && a.setLineDash(e.strokeLineDash), e.strokeLineDashOffset && (a.lineDashOffset = e.strokeLineDashOffset), this._drawToContext(a, o, n), a.restore();
|
|
1232
|
+
break;
|
|
1233
|
+
case "fillPath": {
|
|
1234
|
+
a.save(), a.fillStyle = e.fill || "";
|
|
1235
|
+
const r = t.shape === "curve" || t.shape === "polygon" || t.shape === "path" ? "evenodd" : "nonzero";
|
|
1236
|
+
this._drawToContext(a, o, n, r), a.restore();
|
|
1237
|
+
break;
|
|
1238
|
+
}
|
|
1239
|
+
case "fillSketch":
|
|
1240
|
+
this.fillSketch(a, o, e);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
fillSketch(t, s, e) {
|
|
1244
|
+
let a = e.fillWeight;
|
|
1245
|
+
a < 0 && (a = e.strokeWidth / 2), t.save(), e.fillLineDash && t.setLineDash(e.fillLineDash), e.fillLineDashOffset && (t.lineDashOffset = e.fillLineDashOffset), t.strokeStyle = e.fill || "", t.lineWidth = a, this._drawToContext(t, s, e.fixedDecimalPlaceDigits), t.restore();
|
|
1246
|
+
}
|
|
1247
|
+
_drawToContext(t, s, e, a = "nonzero") {
|
|
1248
|
+
t.beginPath();
|
|
1249
|
+
for (const n of s.ops) {
|
|
1250
|
+
const o = typeof e == "number" && e >= 0 ? n.data.map(((r) => +r.toFixed(e))) : n.data;
|
|
1251
|
+
switch (n.op) {
|
|
1252
|
+
case "move":
|
|
1253
|
+
t.moveTo(o[0], o[1]);
|
|
1254
|
+
break;
|
|
1255
|
+
case "bcurveTo":
|
|
1256
|
+
t.bezierCurveTo(o[0], o[1], o[2], o[3], o[4], o[5]);
|
|
1257
|
+
break;
|
|
1258
|
+
case "lineTo":
|
|
1259
|
+
t.lineTo(o[0], o[1]);
|
|
1260
|
+
}
|
|
1261
|
+
}
|
|
1262
|
+
s.type === "fillPath" ? t.fill(a) : t.stroke();
|
|
1263
|
+
}
|
|
1264
|
+
get generator() {
|
|
1265
|
+
return this.gen;
|
|
1266
|
+
}
|
|
1267
|
+
getDefaultOptions() {
|
|
1268
|
+
return this.gen.defaultOptions;
|
|
1269
|
+
}
|
|
1270
|
+
line(t, s, e, a, n) {
|
|
1271
|
+
const o = this.gen.line(t, s, e, a, n);
|
|
1272
|
+
return this.draw(o), o;
|
|
1273
|
+
}
|
|
1274
|
+
rectangle(t, s, e, a, n) {
|
|
1275
|
+
const o = this.gen.rectangle(t, s, e, a, n);
|
|
1276
|
+
return this.draw(o), o;
|
|
1277
|
+
}
|
|
1278
|
+
ellipse(t, s, e, a, n) {
|
|
1279
|
+
const o = this.gen.ellipse(t, s, e, a, n);
|
|
1280
|
+
return this.draw(o), o;
|
|
1281
|
+
}
|
|
1282
|
+
circle(t, s, e, a) {
|
|
1283
|
+
const n = this.gen.circle(t, s, e, a);
|
|
1284
|
+
return this.draw(n), n;
|
|
1285
|
+
}
|
|
1286
|
+
linearPath(t, s) {
|
|
1287
|
+
const e = this.gen.linearPath(t, s);
|
|
1288
|
+
return this.draw(e), e;
|
|
1289
|
+
}
|
|
1290
|
+
polygon(t, s) {
|
|
1291
|
+
const e = this.gen.polygon(t, s);
|
|
1292
|
+
return this.draw(e), e;
|
|
1293
|
+
}
|
|
1294
|
+
arc(t, s, e, a, n, o, r = !1, h) {
|
|
1295
|
+
const i = this.gen.arc(t, s, e, a, n, o, r, h);
|
|
1296
|
+
return this.draw(i), i;
|
|
1297
|
+
}
|
|
1298
|
+
curve(t, s) {
|
|
1299
|
+
const e = this.gen.curve(t, s);
|
|
1300
|
+
return this.draw(e), e;
|
|
1301
|
+
}
|
|
1302
|
+
path(t, s) {
|
|
1303
|
+
const e = this.gen.path(t, s);
|
|
1304
|
+
return this.draw(e), e;
|
|
1305
|
+
}
|
|
1306
|
+
}, V = "http://www.w3.org/2000/svg", qt = class {
|
|
1307
|
+
constructor(t, s) {
|
|
1308
|
+
this.svg = t, this.gen = new J(s);
|
|
1309
|
+
}
|
|
1310
|
+
draw(t) {
|
|
1311
|
+
const s = t.sets || [], e = t.options || this.getDefaultOptions(), a = this.svg.ownerDocument || window.document, n = a.createElementNS(V, "g"), o = t.options.fixedDecimalPlaceDigits;
|
|
1312
|
+
for (const r of s) {
|
|
1313
|
+
let h = null;
|
|
1314
|
+
switch (r.type) {
|
|
1315
|
+
case "path":
|
|
1316
|
+
h = a.createElementNS(V, "path"), h.setAttribute("d", this.opsToPath(r, o)), h.setAttribute("stroke", e.stroke), h.setAttribute("stroke-width", e.strokeWidth + ""), h.setAttribute("fill", "none"), e.strokeLineDash && h.setAttribute("stroke-dasharray", e.strokeLineDash.join(" ").trim()), e.strokeLineDashOffset && h.setAttribute("stroke-dashoffset", `${e.strokeLineDashOffset}`);
|
|
1317
|
+
break;
|
|
1318
|
+
case "fillPath":
|
|
1319
|
+
h = a.createElementNS(V, "path"), h.setAttribute("d", this.opsToPath(r, o)), h.setAttribute("stroke", "none"), h.setAttribute("stroke-width", "0"), h.setAttribute("fill", e.fill || ""), t.shape !== "curve" && t.shape !== "polygon" || h.setAttribute("fill-rule", "evenodd");
|
|
1320
|
+
break;
|
|
1321
|
+
case "fillSketch":
|
|
1322
|
+
h = this.fillSketch(a, r, e);
|
|
1323
|
+
}
|
|
1324
|
+
h && n.appendChild(h);
|
|
1325
|
+
}
|
|
1326
|
+
return n;
|
|
1327
|
+
}
|
|
1328
|
+
fillSketch(t, s, e) {
|
|
1329
|
+
let a = e.fillWeight;
|
|
1330
|
+
a < 0 && (a = e.strokeWidth / 2);
|
|
1331
|
+
const n = t.createElementNS(V, "path");
|
|
1332
|
+
return n.setAttribute("d", this.opsToPath(s, e.fixedDecimalPlaceDigits)), n.setAttribute("stroke", e.fill || ""), n.setAttribute("stroke-width", a + ""), n.setAttribute("fill", "none"), e.fillLineDash && n.setAttribute("stroke-dasharray", e.fillLineDash.join(" ").trim()), e.fillLineDashOffset && n.setAttribute("stroke-dashoffset", `${e.fillLineDashOffset}`), n;
|
|
1333
|
+
}
|
|
1334
|
+
get generator() {
|
|
1335
|
+
return this.gen;
|
|
1336
|
+
}
|
|
1337
|
+
getDefaultOptions() {
|
|
1338
|
+
return this.gen.defaultOptions;
|
|
1339
|
+
}
|
|
1340
|
+
opsToPath(t, s) {
|
|
1341
|
+
return this.gen.opsToPath(t, s);
|
|
1342
|
+
}
|
|
1343
|
+
line(t, s, e, a, n) {
|
|
1344
|
+
const o = this.gen.line(t, s, e, a, n);
|
|
1345
|
+
return this.draw(o);
|
|
1346
|
+
}
|
|
1347
|
+
rectangle(t, s, e, a, n) {
|
|
1348
|
+
const o = this.gen.rectangle(t, s, e, a, n);
|
|
1349
|
+
return this.draw(o);
|
|
1350
|
+
}
|
|
1351
|
+
ellipse(t, s, e, a, n) {
|
|
1352
|
+
const o = this.gen.ellipse(t, s, e, a, n);
|
|
1353
|
+
return this.draw(o);
|
|
1354
|
+
}
|
|
1355
|
+
circle(t, s, e, a) {
|
|
1356
|
+
const n = this.gen.circle(t, s, e, a);
|
|
1357
|
+
return this.draw(n);
|
|
1358
|
+
}
|
|
1359
|
+
linearPath(t, s) {
|
|
1360
|
+
const e = this.gen.linearPath(t, s);
|
|
1361
|
+
return this.draw(e);
|
|
1362
|
+
}
|
|
1363
|
+
polygon(t, s) {
|
|
1364
|
+
const e = this.gen.polygon(t, s);
|
|
1365
|
+
return this.draw(e);
|
|
1366
|
+
}
|
|
1367
|
+
arc(t, s, e, a, n, o, r = !1, h) {
|
|
1368
|
+
const i = this.gen.arc(t, s, e, a, n, o, r, h);
|
|
1369
|
+
return this.draw(i);
|
|
1370
|
+
}
|
|
1371
|
+
curve(t, s) {
|
|
1372
|
+
const e = this.gen.curve(t, s);
|
|
1373
|
+
return this.draw(e);
|
|
1374
|
+
}
|
|
1375
|
+
path(t, s) {
|
|
1376
|
+
const e = this.gen.path(t, s);
|
|
1377
|
+
return this.draw(e);
|
|
1378
|
+
}
|
|
1379
|
+
}, Ft = {
|
|
1380
|
+
canvas: (t, s) => new jt(t, s),
|
|
1381
|
+
svg: (t, s) => new qt(t, s),
|
|
1382
|
+
generator: (t) => new J(t),
|
|
1383
|
+
newSeed: () => J.newSeed()
|
|
1384
|
+
};
|
|
1385
|
+
export {
|
|
1386
|
+
Ft as t
|
|
1387
|
+
};
|