From 2062e8d5ac446c861aaafb1d50f26b02540017fc Mon Sep 17 00:00:00 2001 From: thednp Date: Thu, 17 Oct 2024 17:18:10 +0300 Subject: [PATCH] Further performance improvements #44 --- README.md | 4 +- deno.lock | 2194 +++++++++++++++++++++++++++++ dist/svg-path-commander.cjs | 2 +- dist/svg-path-commander.cjs.map | 2 +- dist/svg-path-commander.d.ts | 226 ++- dist/svg-path-commander.js | 2 +- dist/svg-path-commander.js.map | 2 +- dist/svg-path-commander.mjs | 2021 +++++++++++++------------- dist/svg-path-commander.mjs.map | 2 +- docs/svg-path-commander.js | 2 +- docs/svg-path-commander.js.map | 2 +- package.json | 14 +- pnpm-lock.yaml | 264 ++-- src/convert/pathToAbsolute.ts | 33 +- src/convert/pathToCurve.ts | 40 +- src/convert/pathToRelative.ts | 49 +- src/convert/pathToString.ts | 47 +- src/index.ts | 171 ++- src/interface.ts | 3 +- src/math/arcTools.ts | 104 +- src/math/bezier.ts | 74 +- src/math/cubicTools.ts | 18 +- src/math/distanceSquareRoot.ts | 2 +- src/math/lineTools.ts | 10 +- src/math/polygonArea.ts | 29 - src/math/polygonLength.ts | 22 - src/math/polygonTools.ts | 48 + src/math/quadTools.ts | 14 +- src/math/rotateVector.ts | 5 +- src/math/roundTo.ts | 7 + src/parser/finalizeSegment.ts | 18 +- src/parser/parsePathString.ts | 5 +- src/parser/pathParser.ts | 2 +- src/process/absolutizeSegment.ts | 65 +- src/process/arcToCubic.ts | 4 +- src/process/iterate.ts | 57 +- src/process/lineToCubic.ts | 2 +- src/process/normalizePath.ts | 45 +- src/process/normalizeSegment.ts | 68 +- src/process/optimizePath.ts | 100 +- src/process/projection2d.ts | 4 +- src/process/relativizeSegment.ts | 68 +- src/process/reverseCurve.ts | 13 +- src/process/reversePath.ts | 161 ++- src/process/roundPath.ts | 22 +- src/process/roundSegment.ts | 9 + src/process/segmentToCubic.ts | 16 +- src/process/shortenSegment.ts | 56 +- src/process/splitCubic.ts | 4 +- src/process/transformPath.ts | 75 +- src/types.ts | 18 +- src/util/getPathArea.ts | 4 +- src/util/getPathBBox.ts | 67 +- src/util/getPointAtLength.ts | 100 +- src/util/getPropertiesAtLength.ts | 9 +- src/util/getPropertiesAtPoint.ts | 10 +- src/util/getTotalLength.ts | 61 +- test/class.test.ts | 2 + test/fixtures/shapes.js | 10 +- test/static.test.ts | 30 +- 60 files changed, 4534 insertions(+), 1984 deletions(-) create mode 100644 deno.lock delete mode 100644 src/math/polygonArea.ts delete mode 100644 src/math/polygonLength.ts create mode 100644 src/math/polygonTools.ts create mode 100644 src/math/roundTo.ts create mode 100644 src/process/roundSegment.ts diff --git a/README.md b/README.md index af63b2b..07a134a 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ [![typescript version](https://img.shields.io/badge/typescript-5.6.3-brightgreen)](https://www.typescriptlang.org/) [![prettier version](https://img.shields.io/badge/prettier-2.8.8-brightgreen)](https://prettier.io/) [![eslint version](https://img.shields.io/badge/eslint-8.57.1-brightgreen)](https://github.com/eslint) -[![vitest version](https://img.shields.io/badge/vitest-2.1.2-brightgreen)](https://vitest.dev/) -[![vite version](https://img.shields.io/badge/vite-5.4.8-brightgreen)](https://vitejs.dev/) +[![vitest version](https://img.shields.io/badge/vitest-2.1.3-brightgreen)](https://vitest.dev/) +[![vite version](https://img.shields.io/badge/vite-5.4.9-brightgreen)](https://vitejs.dev/) ![image](./docs/assets/SVGPathCommander.svg) diff --git a/deno.lock b/deno.lock new file mode 100644 index 0000000..3f43e6b --- /dev/null +++ b/deno.lock @@ -0,0 +1,2194 @@ +{ + "version": "4", + "specifiers": { + "npm:@thednp/dommatrix@^2.0.8": "2.0.8", + "npm:@typescript-eslint/eslint-plugin@^5.62.0": "5.62.0_@typescript-eslint+parser@5.62.0__eslint@8.57.1__typescript@5.6.3_eslint@8.57.1_typescript@5.6.3", + "npm:@typescript-eslint/parser@^5.62.0": "5.62.0_eslint@8.57.1_typescript@5.6.3", + "npm:@vitest/browser@^2.1.2": "2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3__playwright@1.48.0__typescript@5.6.3", + "npm:@vitest/coverage-istanbul@^2.1.2": "2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_typescript@5.6.3", + "npm:@vitest/ui@^2.1.2": "2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__@vitest+ui@2.1.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3_playwright@1.48.0_typescript@5.6.3", + "npm:dts-bundle-generator@^9.5.1": "9.5.1", + "npm:eslint-plugin-jsdoc@^46.10.1": "46.10.1_eslint@8.57.1", + "npm:eslint-plugin-prefer-arrow@^1.2.3": "1.2.3_eslint@8.57.1", + "npm:eslint-plugin-prettier@^4.2.1": "4.2.1_eslint@8.57.1_prettier@2.8.8", + "npm:eslint@^8.57.1": "8.57.1", + "npm:playwright@^1.48.0": "1.48.0", + "npm:prettier@^2.8.8": "2.8.8", + "npm:typescript@^5.6.3": "5.6.3", + "npm:vite@^5.4.8": "5.4.9", + "npm:vitest@^2.1.2": "2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3" + }, + "npm": { + "@ampproject/remapping@2.3.0": { + "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==", + "dependencies": [ + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping" + ] + }, + "@babel/code-frame@7.25.7": { + "integrity": "sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==", + "dependencies": [ + "@babel/highlight", + "picocolors" + ] + }, + "@babel/compat-data@7.25.8": { + "integrity": "sha512-ZsysZyXY4Tlx+Q53XdnOFmqwfB9QDTHYxaZYajWRoBLuLEAwI2UIbtxOjWh/cFaa9IKUlcB+DDuoskLuKu56JA==" + }, + "@babel/core@7.25.8": { + "integrity": "sha512-Oixnb+DzmRT30qu9d3tJSQkxuygWm32DFykT4bRoORPa9hZ/L4KhVB/XiRm6KG+roIEM7DBQlmg27kw2HZkdZg==", + "dependencies": [ + "@ampproject/remapping", + "@babel/code-frame", + "@babel/generator", + "@babel/helper-compilation-targets", + "@babel/helper-module-transforms", + "@babel/helpers", + "@babel/parser", + "@babel/template", + "@babel/traverse", + "@babel/types", + "convert-source-map", + "debug", + "gensync", + "json5", + "semver@6.3.1" + ] + }, + "@babel/generator@7.25.7": { + "integrity": "sha512-5Dqpl5fyV9pIAD62yK9P7fcA768uVPUyrQmqpqstHWgMma4feF1x/oFysBCVZLY5wJ2GkMUCdsNDnGZrPoR6rA==", + "dependencies": [ + "@babel/types", + "@jridgewell/gen-mapping", + "@jridgewell/trace-mapping", + "jsesc" + ] + }, + "@babel/helper-compilation-targets@7.25.7": { + "integrity": "sha512-DniTEax0sv6isaw6qSQSfV4gVRNtw2rte8HHM45t9ZR0xILaufBRNkpMifCRiAPyvL4ACD6v0gfCwCmtOQaV4A==", + "dependencies": [ + "@babel/compat-data", + "@babel/helper-validator-option", + "browserslist", + "lru-cache@5.1.1", + "semver@6.3.1" + ] + }, + "@babel/helper-module-imports@7.25.7": { + "integrity": "sha512-o0xCgpNmRohmnoWKQ0Ij8IdddjyBFE4T2kagL/x6M3+4zUgc+4qTOUBoNe4XxDskt1HPKO007ZPiMgLDq2s7Kw==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-module-transforms@7.25.7_@babel+core@7.25.8": { + "integrity": "sha512-k/6f8dKG3yDz/qCwSM+RKovjMix563SLxQFo0UhRNo239SP6n9u5/eLtKD6EAjwta2JHJ49CsD8pms2HdNiMMQ==", + "dependencies": [ + "@babel/core", + "@babel/helper-module-imports", + "@babel/helper-simple-access", + "@babel/helper-validator-identifier", + "@babel/traverse" + ] + }, + "@babel/helper-simple-access@7.25.7": { + "integrity": "sha512-FPGAkJmyoChQeM+ruBGIDyrT2tKfZJO8NcxdC+CWNJi7N8/rZpSxK7yvBJ5O/nF1gfu5KzN7VKG3YVSLFfRSxQ==", + "dependencies": [ + "@babel/traverse", + "@babel/types" + ] + }, + "@babel/helper-string-parser@7.25.7": { + "integrity": "sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==" + }, + "@babel/helper-validator-identifier@7.25.7": { + "integrity": "sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==" + }, + "@babel/helper-validator-option@7.25.7": { + "integrity": "sha512-ytbPLsm+GjArDYXJ8Ydr1c/KJuutjF2besPNbIZnZ6MKUxi/uTA22t2ymmA4WFjZFpjiAMO0xuuJPqK2nvDVfQ==" + }, + "@babel/helpers@7.25.7": { + "integrity": "sha512-Sv6pASx7Esm38KQpF/U/OXLwPPrdGHNKoeblRxgZRLXnAtnkEe4ptJPDtAZM7fBLadbc1Q07kQpSiGQ0Jg6tRA==", + "dependencies": [ + "@babel/template", + "@babel/types" + ] + }, + "@babel/highlight@7.25.7": { + "integrity": "sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==", + "dependencies": [ + "@babel/helper-validator-identifier", + "chalk@2.4.2", + "js-tokens", + "picocolors" + ] + }, + "@babel/parser@7.25.8": { + "integrity": "sha512-HcttkxzdPucv3nNFmfOOMfFf64KgdJVqm1KaCm25dPGMLElo9nsLvXeJECQg8UzPuBGLyTSA0ZzqCtDSzKTEoQ==", + "dependencies": [ + "@babel/types" + ] + }, + "@babel/runtime@7.25.7": { + "integrity": "sha512-FjoyLe754PMiYsFaN5C94ttGiOmBNYTf6pLr4xXHAT5uctHb092PBszndLDR5XA/jghQvn4n7JMHl7dmTgbm9w==", + "dependencies": [ + "regenerator-runtime" + ] + }, + "@babel/template@7.25.7": { + "integrity": "sha512-wRwtAgI3bAS+JGU2upWNL9lSlDcRCqD05BZ1n3X2ONLH1WilFP6O1otQjeMK/1g0pvYcXC7b/qVUB1keofjtZA==", + "dependencies": [ + "@babel/code-frame", + "@babel/parser", + "@babel/types" + ] + }, + "@babel/traverse@7.25.7": { + "integrity": "sha512-jatJPT1Zjqvh/1FyJs6qAHL+Dzb7sTb+xr7Q+gM1b+1oBsMsQQ4FkVKb6dFlJvLlVssqkRzV05Jzervt9yhnzg==", + "dependencies": [ + "@babel/code-frame", + "@babel/generator", + "@babel/parser", + "@babel/template", + "@babel/types", + "debug", + "globals@11.12.0" + ] + }, + "@babel/types@7.25.8": { + "integrity": "sha512-JWtuCu8VQsMladxVz/P4HzHUGCAwpuqacmowgXFs5XjxIgKuNjnLokQzuVjlTvIzODaDmpjT3oxcC48vyk9EWg==", + "dependencies": [ + "@babel/helper-string-parser", + "@babel/helper-validator-identifier", + "to-fast-properties" + ] + }, + "@bundled-es-modules/cookie@2.0.0": { + "integrity": "sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==", + "dependencies": [ + "cookie" + ] + }, + "@bundled-es-modules/statuses@1.0.1": { + "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==", + "dependencies": [ + "statuses" + ] + }, + "@bundled-es-modules/tough-cookie@0.1.6": { + "integrity": "sha512-dvMHbL464C0zI+Yqxbz6kZ5TOEp7GLW+pry/RWndAR8MJQAXZ2rPmIs8tziTZjeIyhSNZgZbCePtfSbdWqStJw==", + "dependencies": [ + "@types/tough-cookie", + "tough-cookie" + ] + }, + "@es-joy/jsdoccomment@0.41.0": { + "integrity": "sha512-aKUhyn1QI5Ksbqcr3fFJj16p99QdjUxXAEuFst1Z47DRyoiMwivIH9MV/ARcJOCXVjPfjITciej8ZD2O/6qUmw==", + "dependencies": [ + "comment-parser", + "esquery", + "jsdoc-type-pratt-parser" + ] + }, + "@esbuild/aix-ppc64@0.21.5": { + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==" + }, + "@esbuild/android-arm64@0.21.5": { + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==" + }, + "@esbuild/android-arm@0.21.5": { + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==" + }, + "@esbuild/android-x64@0.21.5": { + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==" + }, + "@esbuild/darwin-arm64@0.21.5": { + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==" + }, + "@esbuild/darwin-x64@0.21.5": { + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==" + }, + "@esbuild/freebsd-arm64@0.21.5": { + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==" + }, + "@esbuild/freebsd-x64@0.21.5": { + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==" + }, + "@esbuild/linux-arm64@0.21.5": { + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==" + }, + "@esbuild/linux-arm@0.21.5": { + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==" + }, + "@esbuild/linux-ia32@0.21.5": { + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==" + }, + "@esbuild/linux-loong64@0.21.5": { + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==" + }, + "@esbuild/linux-mips64el@0.21.5": { + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==" + }, + "@esbuild/linux-ppc64@0.21.5": { + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==" + }, + "@esbuild/linux-riscv64@0.21.5": { + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==" + }, + "@esbuild/linux-s390x@0.21.5": { + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==" + }, + "@esbuild/linux-x64@0.21.5": { + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==" + }, + "@esbuild/netbsd-x64@0.21.5": { + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==" + }, + "@esbuild/openbsd-x64@0.21.5": { + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==" + }, + "@esbuild/sunos-x64@0.21.5": { + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==" + }, + "@esbuild/win32-arm64@0.21.5": { + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==" + }, + "@esbuild/win32-ia32@0.21.5": { + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==" + }, + "@esbuild/win32-x64@0.21.5": { + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==" + }, + "@eslint-community/eslint-utils@4.4.0_eslint@8.57.1": { + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dependencies": [ + "eslint", + "eslint-visitor-keys" + ] + }, + "@eslint-community/regexpp@4.11.1": { + "integrity": "sha512-m4DVN9ZqskZoLU5GlWZadwDnYo3vAEydiUayB9widCl9ffWx2IvPnp6n3on5rJmziJSw9Bv+Z3ChDVdMwXCY8Q==" + }, + "@eslint/eslintrc@2.1.4": { + "integrity": "sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==", + "dependencies": [ + "ajv", + "debug", + "espree", + "globals@13.24.0", + "ignore", + "import-fresh", + "js-yaml", + "minimatch@3.1.2", + "strip-json-comments" + ] + }, + "@eslint/js@8.57.1": { + "integrity": "sha512-d9zaMRSTIKDLhctzH12MtXvJKSSUhaHcjV+2Z+GK+EEY7XKpP5yR4x+N3TAcHTcu963nIr+TMcCb4DBCYX1z6Q==" + }, + "@humanwhocodes/config-array@0.13.0": { + "integrity": "sha512-DZLEEqFWQFiyK6h5YIeynKx7JlvCYWL0cImfSRXZ9l4Sg2efkFGTuFf6vzXjK1cq6IYkU+Eg/JizXw+TD2vRNw==", + "dependencies": [ + "@humanwhocodes/object-schema", + "debug", + "minimatch@3.1.2" + ] + }, + "@humanwhocodes/module-importer@1.0.1": { + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==" + }, + "@humanwhocodes/object-schema@2.0.3": { + "integrity": "sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==" + }, + "@inquirer/confirm@3.2.0": { + "integrity": "sha512-oOIwPs0Dvq5220Z8lGL/6LHRTEr9TgLHmiI99Rj1PJ1p1czTys+olrgBqZk4E2qC0YTzeHprxSQmoHioVdJ7Lw==", + "dependencies": [ + "@inquirer/core", + "@inquirer/type@1.5.5" + ] + }, + "@inquirer/core@9.2.1": { + "integrity": "sha512-F2VBt7W/mwqEU4bL0RnHNZmC/OxzNx9cOYxHqnXX3MP6ruYvZUZAW9imgN9+h/uBT/oP8Gh888J2OZSbjSeWcg==", + "dependencies": [ + "@inquirer/figures", + "@inquirer/type@2.0.0", + "@types/mute-stream", + "@types/node@22.7.5", + "@types/wrap-ansi", + "ansi-escapes", + "cli-width", + "mute-stream", + "signal-exit", + "strip-ansi@6.0.1", + "wrap-ansi@6.2.0", + "yoctocolors-cjs" + ] + }, + "@inquirer/figures@1.0.7": { + "integrity": "sha512-m+Trk77mp54Zma6xLkLuY+mvanPxlE4A7yNKs2HBiyZ4UkVs28Mv5c/pgWrHeInx+USHeX/WEPzjrWrcJiQgjw==" + }, + "@inquirer/type@1.5.5": { + "integrity": "sha512-MzICLu4yS7V8AA61sANROZ9vT1H3ooca5dSmI1FjZkzq7o/koMsRfQSzRtFo+F3Ao4Sf1C0bpLKejpKB/+j6MA==", + "dependencies": [ + "mute-stream" + ] + }, + "@inquirer/type@2.0.0": { + "integrity": "sha512-XvJRx+2KR3YXyYtPUUy+qd9i7p+GO9Ko6VIIpWlBrpWwXDv8WLFeHTxz35CfQFUiBMLXlGHhGzys7lqit9gWag==", + "dependencies": [ + "mute-stream" + ] + }, + "@isaacs/cliui@8.0.2": { + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": [ + "string-width@5.1.2", + "string-width-cjs@npm:string-width@4.2.3", + "strip-ansi@7.1.0", + "strip-ansi-cjs@npm:strip-ansi@6.0.1", + "wrap-ansi@8.1.0", + "wrap-ansi-cjs@npm:wrap-ansi@7.0.0" + ] + }, + "@istanbuljs/schema@0.1.3": { + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==" + }, + "@jridgewell/gen-mapping@0.3.5": { + "integrity": "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==", + "dependencies": [ + "@jridgewell/set-array", + "@jridgewell/sourcemap-codec", + "@jridgewell/trace-mapping" + ] + }, + "@jridgewell/resolve-uri@3.1.2": { + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==" + }, + "@jridgewell/set-array@1.2.1": { + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==" + }, + "@jridgewell/sourcemap-codec@1.5.0": { + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==" + }, + "@jridgewell/trace-mapping@0.3.25": { + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dependencies": [ + "@jridgewell/resolve-uri", + "@jridgewell/sourcemap-codec" + ] + }, + "@mswjs/interceptors@0.35.9": { + "integrity": "sha512-SSnyl/4ni/2ViHKkiZb8eajA/eN1DNFaHjhGiLUdZvDz6PKF4COSf/17xqSz64nOo2Ia29SA6B2KNCsyCbVmaQ==", + "dependencies": [ + "@open-draft/deferred-promise", + "@open-draft/logger", + "@open-draft/until", + "is-node-process", + "outvariant", + "strict-event-emitter" + ] + }, + "@nodelib/fs.scandir@2.1.5": { + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dependencies": [ + "@nodelib/fs.stat", + "run-parallel" + ] + }, + "@nodelib/fs.stat@2.0.5": { + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" + }, + "@nodelib/fs.walk@1.2.8": { + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dependencies": [ + "@nodelib/fs.scandir", + "fastq" + ] + }, + "@open-draft/deferred-promise@2.2.0": { + "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==" + }, + "@open-draft/logger@0.3.0": { + "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==", + "dependencies": [ + "is-node-process", + "outvariant" + ] + }, + "@open-draft/until@2.1.0": { + "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==" + }, + "@pkgjs/parseargs@0.11.0": { + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==" + }, + "@polka/url@1.0.0-next.28": { + "integrity": "sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==" + }, + "@rollup/rollup-android-arm-eabi@4.24.0": { + "integrity": "sha512-Q6HJd7Y6xdB48x8ZNVDOqsbh2uByBhgK8PiQgPhwkIw/HC/YX5Ghq2mQY5sRMZWHb3VsFkWooUVOZHKr7DmDIA==" + }, + "@rollup/rollup-android-arm64@4.24.0": { + "integrity": "sha512-ijLnS1qFId8xhKjT81uBHuuJp2lU4x2yxa4ctFPtG+MqEE6+C5f/+X/bStmxapgmwLwiL3ih122xv8kVARNAZA==" + }, + "@rollup/rollup-darwin-arm64@4.24.0": { + "integrity": "sha512-bIv+X9xeSs1XCk6DVvkO+S/z8/2AMt/2lMqdQbMrmVpgFvXlmde9mLcbQpztXm1tajC3raFDqegsH18HQPMYtA==" + }, + "@rollup/rollup-darwin-x64@4.24.0": { + "integrity": "sha512-X6/nOwoFN7RT2svEQWUsW/5C/fYMBe4fnLK9DQk4SX4mgVBiTA9h64kjUYPvGQ0F/9xwJ5U5UfTbl6BEjaQdBQ==" + }, + "@rollup/rollup-linux-arm-gnueabihf@4.24.0": { + "integrity": "sha512-0KXvIJQMOImLCVCz9uvvdPgfyWo93aHHp8ui3FrtOP57svqrF/roSSR5pjqL2hcMp0ljeGlU4q9o/rQaAQ3AYA==" + }, + "@rollup/rollup-linux-arm-musleabihf@4.24.0": { + "integrity": "sha512-it2BW6kKFVh8xk/BnHfakEeoLPv8STIISekpoF+nBgWM4d55CZKc7T4Dx1pEbTnYm/xEKMgy1MNtYuoA8RFIWw==" + }, + "@rollup/rollup-linux-arm64-gnu@4.24.0": { + "integrity": "sha512-i0xTLXjqap2eRfulFVlSnM5dEbTVque/3Pi4g2y7cxrs7+a9De42z4XxKLYJ7+OhE3IgxvfQM7vQc43bwTgPwA==" + }, + "@rollup/rollup-linux-arm64-musl@4.24.0": { + "integrity": "sha512-9E6MKUJhDuDh604Qco5yP/3qn3y7SLXYuiC0Rpr89aMScS2UAmK1wHP2b7KAa1nSjWJc/f/Lc0Wl1L47qjiyQw==" + }, + "@rollup/rollup-linux-powerpc64le-gnu@4.24.0": { + "integrity": "sha512-2XFFPJ2XMEiF5Zi2EBf4h73oR1V/lycirxZxHZNc93SqDN/IWhYYSYj8I9381ikUFXZrz2v7r2tOVk2NBwxrWw==" + }, + "@rollup/rollup-linux-riscv64-gnu@4.24.0": { + "integrity": "sha512-M3Dg4hlwuntUCdzU7KjYqbbd+BLq3JMAOhCKdBE3TcMGMZbKkDdJ5ivNdehOssMCIokNHFOsv7DO4rlEOfyKpg==" + }, + "@rollup/rollup-linux-s390x-gnu@4.24.0": { + "integrity": "sha512-mjBaoo4ocxJppTorZVKWFpy1bfFj9FeCMJqzlMQGjpNPY9JwQi7OuS1axzNIk0nMX6jSgy6ZURDZ2w0QW6D56g==" + }, + "@rollup/rollup-linux-x64-gnu@4.24.0": { + "integrity": "sha512-ZXFk7M72R0YYFN5q13niV0B7G8/5dcQ9JDp8keJSfr3GoZeXEoMHP/HlvqROA3OMbMdfr19IjCeNAnPUG93b6A==" + }, + "@rollup/rollup-linux-x64-musl@4.24.0": { + "integrity": "sha512-w1i+L7kAXZNdYl+vFvzSZy8Y1arS7vMgIy8wusXJzRrPyof5LAb02KGr1PD2EkRcl73kHulIID0M501lN+vobQ==" + }, + "@rollup/rollup-win32-arm64-msvc@4.24.0": { + "integrity": "sha512-VXBrnPWgBpVDCVY6XF3LEW0pOU51KbaHhccHw6AS6vBWIC60eqsH19DAeeObl+g8nKAz04QFdl/Cefta0xQtUQ==" + }, + "@rollup/rollup-win32-ia32-msvc@4.24.0": { + "integrity": "sha512-xrNcGDU0OxVcPTH/8n/ShH4UevZxKIO6HJFK0e15XItZP2UcaiLFd5kiX7hJnqCbSztUF8Qot+JWBC/QXRPYWQ==" + }, + "@rollup/rollup-win32-x64-msvc@4.24.0": { + "integrity": "sha512-fbMkAF7fufku0N2dE5TBXcNlg0pt0cJue4xBRE2Qc5Vqikxr4VCgKj/ht6SMdFcOacVA9rqF70APJ8RN/4vMJw==" + }, + "@testing-library/dom@10.4.0": { + "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==", + "dependencies": [ + "@babel/code-frame", + "@babel/runtime", + "@types/aria-query", + "aria-query", + "chalk@4.1.2", + "dom-accessibility-api", + "lz-string", + "pretty-format" + ] + }, + "@testing-library/user-event@14.5.2_@testing-library+dom@10.4.0": { + "integrity": "sha512-YAh82Wh4TIrxYLmfGcixwD18oIjyC1pFQC2Y01F2lzV2HTMiYrI0nze0FD0ocB//CKS/7jIUgae+adPqxK5yCQ==", + "dependencies": [ + "@testing-library/dom" + ] + }, + "@thednp/dommatrix@2.0.8": { + "integrity": "sha512-uITrAo0Oyu8BCHfhsBPmbqGoXwcyHUi7N2gPiI3lXItysPp+X8g7ZqGHi5/VBbaEHrv4eJxll8nFwL6SO25hzA==" + }, + "@types/aria-query@5.0.4": { + "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==" + }, + "@types/cookie@0.6.0": { + "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==" + }, + "@types/estree@1.0.6": { + "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==" + }, + "@types/json-schema@7.0.15": { + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==" + }, + "@types/mute-stream@0.0.4": { + "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==", + "dependencies": [ + "@types/node@22.5.4" + ] + }, + "@types/node@22.5.4": { + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "dependencies": [ + "undici-types" + ] + }, + "@types/node@22.7.5": { + "integrity": "sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==", + "dependencies": [ + "undici-types" + ] + }, + "@types/semver@7.5.8": { + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==" + }, + "@types/statuses@2.0.5": { + "integrity": "sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==" + }, + "@types/tough-cookie@4.0.5": { + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==" + }, + "@types/wrap-ansi@3.0.0": { + "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==" + }, + "@typescript-eslint/eslint-plugin@5.62.0_@typescript-eslint+parser@5.62.0__eslint@8.57.1__typescript@5.6.3_eslint@8.57.1_typescript@5.6.3": { + "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", + "dependencies": [ + "@eslint-community/regexpp", + "@typescript-eslint/parser", + "@typescript-eslint/scope-manager", + "@typescript-eslint/type-utils", + "@typescript-eslint/utils", + "debug", + "eslint", + "graphemer", + "ignore", + "natural-compare-lite", + "semver@7.6.3", + "tsutils" + ] + }, + "@typescript-eslint/parser@5.62.0_eslint@8.57.1_typescript@5.6.3": { + "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "dependencies": [ + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "debug", + "eslint" + ] + }, + "@typescript-eslint/scope-manager@5.62.0": { + "integrity": "sha512-VXuvVvZeQCQb5Zgf4HAxc04q5j+WrNAtNh9OwCsCgpKqESMTu3tF/jhZ3xG6T4NZwWl65Bg8KuS2uEvhSfLl0w==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys" + ] + }, + "@typescript-eslint/type-utils@5.62.0_eslint@8.57.1_typescript@5.6.3": { + "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "dependencies": [ + "@typescript-eslint/typescript-estree", + "@typescript-eslint/utils", + "debug", + "eslint", + "tsutils" + ] + }, + "@typescript-eslint/types@5.62.0": { + "integrity": "sha512-87NVngcbVXUahrRTqIK27gD2t5Cu1yuCXxbLcFtCzZGlfyVWWh8mLHkoxzjsB6DDNnvdL+fW8MiwPEJyGJQDgQ==" + }, + "@typescript-eslint/typescript-estree@5.62.0_typescript@5.6.3": { + "integrity": "sha512-CmcQ6uY7b9y694lKdRB8FEel7JbU/40iSAPomu++SjLMntB+2Leay2LO6i8VnJk58MtE9/nQSFIH6jpyRWyYzA==", + "dependencies": [ + "@typescript-eslint/types", + "@typescript-eslint/visitor-keys", + "debug", + "globby", + "is-glob", + "semver@7.6.3", + "tsutils" + ] + }, + "@typescript-eslint/utils@5.62.0_eslint@8.57.1_typescript@5.6.3": { + "integrity": "sha512-n8oxjeb5aIbPFEtmQxQYOLI0i9n5ySBEY/ZEHHZqKQSFnxio1rv6dthascc9dLuwrL0RC5mPCxB7vnAVGAYWAQ==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@types/json-schema", + "@types/semver", + "@typescript-eslint/scope-manager", + "@typescript-eslint/types", + "@typescript-eslint/typescript-estree", + "eslint", + "eslint-scope@5.1.1", + "semver@7.6.3" + ] + }, + "@typescript-eslint/visitor-keys@5.62.0": { + "integrity": "sha512-07ny+LHRzQXepkGg6w0mFY41fVUNBrL2Roj/++7V1txKugfjm/Ci/qSND03r2RhlJhJYMcTn9AhhSSqQp0Ysyw==", + "dependencies": [ + "@typescript-eslint/types", + "eslint-visitor-keys" + ] + }, + "@ungap/structured-clone@1.2.0": { + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" + }, + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3__playwright@1.48.0__typescript@5.6.3": { + "integrity": "sha512-PQ2kLLc9q8ukJutuuYsynHSr31E78/dtYEvPy4jCHLht1LmITqXTVTqu7THWdZ1kXNGrWwtdMqtt3z2mvSKdIg==", + "dependencies": [ + "@testing-library/dom", + "@testing-library/user-event", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3", + "@vitest/utils", + "magic-string", + "msw", + "playwright", + "sirv", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3", + "ws" + ] + }, + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+spy@2.1.3": { + "integrity": "sha512-PQ2kLLc9q8ukJutuuYsynHSr31E78/dtYEvPy4jCHLht1LmITqXTVTqu7THWdZ1kXNGrWwtdMqtt3z2mvSKdIg==", + "dependencies": [ + "@testing-library/dom", + "@testing-library/user-event", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3", + "@vitest/utils", + "magic-string", + "msw", + "playwright", + "sirv", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3", + "ws" + ] + }, + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+spy@2.1.3_vite@5.4.9_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_typescript@5.6.3": { + "integrity": "sha512-PQ2kLLc9q8ukJutuuYsynHSr31E78/dtYEvPy4jCHLht1LmITqXTVTqu7THWdZ1kXNGrWwtdMqtt3z2mvSKdIg==", + "dependencies": [ + "@testing-library/dom", + "@testing-library/user-event", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3", + "@vitest/utils", + "magic-string", + "msw", + "playwright", + "sirv", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3", + "ws" + ] + }, + "@vitest/coverage-istanbul@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_typescript@5.6.3": { + "integrity": "sha512-FByj6ni54EzA4SXl5X3ugSeeBSI6MSEQBbvPefF6x6GCajePLeZSNYt7u0NOKUQbWpQpAdHHstrqR9ALEpnAxA==", + "dependencies": [ + "@istanbuljs/schema", + "debug", + "istanbul-lib-coverage", + "istanbul-lib-instrument", + "istanbul-lib-report", + "istanbul-lib-source-maps", + "istanbul-reports", + "magicast", + "test-exclude", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3" + ] + }, + "@vitest/expect@2.1.3": { + "integrity": "sha512-SNBoPubeCJhZ48agjXruCI57DvxcsivVDdWz+SSsmjTT4QN/DfHk3zB/xKsJqMs26bLZ/pNRLnCf0j679i0uWQ==", + "dependencies": [ + "@vitest/spy", + "@vitest/utils", + "chai", + "tinyrainbow" + ] + }, + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3": { + "integrity": "sha512-eSpdY/eJDuOvuTA3ASzCjdithHa+GIF1L4PqtEELl6Qa3XafdMLBpBlZCIUCX2J+Q6sNmjmxtosAG62fK4BlqQ==", + "dependencies": [ + "@vitest/spy", + "estree-walker", + "magic-string", + "msw", + "vite" + ] + }, + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_vite@5.4.9_msw@2.4.11__typescript@5.6.3_typescript@5.6.3": { + "integrity": "sha512-eSpdY/eJDuOvuTA3ASzCjdithHa+GIF1L4PqtEELl6Qa3XafdMLBpBlZCIUCX2J+Q6sNmjmxtosAG62fK4BlqQ==", + "dependencies": [ + "@vitest/spy", + "estree-walker", + "magic-string", + "msw", + "vite" + ] + }, + "@vitest/pretty-format@2.1.3": { + "integrity": "sha512-XH1XdtoLZCpqV59KRbPrIhFCOO0hErxrQCMcvnQete3Vibb9UeIOX02uFPfVn3Z9ZXsq78etlfyhnkmIZSzIwQ==", + "dependencies": [ + "tinyrainbow" + ] + }, + "@vitest/runner@2.1.3": { + "integrity": "sha512-JGzpWqmFJ4fq5ZKHtVO3Xuy1iF2rHGV4d/pdzgkYHm1+gOzNZtqjvyiaDGJytRyMU54qkxpNzCx+PErzJ1/JqQ==", + "dependencies": [ + "@vitest/utils", + "pathe" + ] + }, + "@vitest/snapshot@2.1.3": { + "integrity": "sha512-qWC2mWc7VAXmjAkEKxrScWHWFyCQx/cmiZtuGqMi+WwqQJ2iURsVY4ZfAK6dVo6K2smKRU6l3BPwqEBvhnpQGg==", + "dependencies": [ + "@vitest/pretty-format", + "magic-string", + "pathe" + ] + }, + "@vitest/spy@2.1.3": { + "integrity": "sha512-Nb2UzbcUswzeSP7JksMDaqsI43Sj5+Kry6ry6jQJT4b5gAK+NS9NED6mDb8FlMRCX8m5guaHCDZmqYMMWRy5nQ==", + "dependencies": [ + "tinyspy" + ] + }, + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__@vitest+ui@2.1.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3_playwright@1.48.0_typescript@5.6.3": { + "integrity": "sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==", + "dependencies": [ + "@vitest/utils", + "fflate", + "flatted", + "pathe", + "sirv", + "tinyglobby", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3" + ] + }, + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3": { + "integrity": "sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==", + "dependencies": [ + "@vitest/utils", + "fflate", + "flatted", + "pathe", + "sirv", + "tinyglobby", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3" + ] + }, + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__@vitest+spy@2.1.3__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3": { + "integrity": "sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==", + "dependencies": [ + "@vitest/utils", + "fflate", + "flatted", + "pathe", + "sirv", + "tinyglobby", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3" + ] + }, + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3": { + "integrity": "sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==", + "dependencies": [ + "@vitest/utils", + "fflate", + "flatted", + "pathe", + "sirv", + "tinyglobby", + "tinyrainbow", + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3" + ] + }, + "@vitest/utils@2.1.3": { + "integrity": "sha512-xpiVfDSg1RrYT0tX6czgerkpcKFmFOF/gCr30+Mve5V2kewCy4Prn1/NDMSRwaSmT7PRaOF83wu+bEtsY1wrvA==", + "dependencies": [ + "@vitest/pretty-format", + "loupe", + "tinyrainbow" + ] + }, + "acorn-jsx@5.3.2_acorn@8.12.1": { + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dependencies": [ + "acorn" + ] + }, + "acorn@8.12.1": { + "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==" + }, + "ajv@6.12.6": { + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dependencies": [ + "fast-deep-equal", + "fast-json-stable-stringify", + "json-schema-traverse", + "uri-js" + ] + }, + "ansi-escapes@4.3.2": { + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dependencies": [ + "type-fest@0.21.3" + ] + }, + "ansi-regex@5.0.1": { + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==" + }, + "ansi-regex@6.1.0": { + "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==" + }, + "ansi-styles@3.2.1": { + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dependencies": [ + "color-convert@1.9.3" + ] + }, + "ansi-styles@4.3.0": { + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": [ + "color-convert@2.0.1" + ] + }, + "ansi-styles@5.2.0": { + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==" + }, + "ansi-styles@6.2.1": { + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==" + }, + "are-docs-informative@0.0.2": { + "integrity": "sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==" + }, + "argparse@2.0.1": { + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, + "aria-query@5.3.0": { + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dependencies": [ + "dequal" + ] + }, + "array-union@2.1.0": { + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==" + }, + "assertion-error@2.0.1": { + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==" + }, + "balanced-match@1.0.2": { + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "brace-expansion@1.1.11": { + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": [ + "balanced-match", + "concat-map" + ] + }, + "brace-expansion@2.0.1": { + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": [ + "balanced-match" + ] + }, + "braces@3.0.3": { + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dependencies": [ + "fill-range" + ] + }, + "browserslist@4.24.0": { + "integrity": "sha512-Rmb62sR1Zpjql25eSanFGEhAxcFwfA1K0GuQcLoaJBAcENegrQut3hYdhXFF1obQfiDyqIW/cLM5HSJ/9k884A==", + "dependencies": [ + "caniuse-lite", + "electron-to-chromium", + "node-releases", + "update-browserslist-db" + ] + }, + "builtin-modules@3.3.0": { + "integrity": "sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==" + }, + "cac@6.7.14": { + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==" + }, + "callsites@3.1.0": { + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==" + }, + "caniuse-lite@1.0.30001668": { + "integrity": "sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==" + }, + "chai@5.1.1": { + "integrity": "sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==", + "dependencies": [ + "assertion-error", + "check-error", + "deep-eql", + "loupe", + "pathval" + ] + }, + "chalk@2.4.2": { + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dependencies": [ + "ansi-styles@3.2.1", + "escape-string-regexp@1.0.5", + "supports-color@5.5.0" + ] + }, + "chalk@4.1.2": { + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dependencies": [ + "ansi-styles@4.3.0", + "supports-color@7.2.0" + ] + }, + "check-error@2.1.1": { + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==" + }, + "cli-width@4.1.0": { + "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==" + }, + "cliui@8.0.1": { + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": [ + "string-width@4.2.3", + "strip-ansi@6.0.1", + "wrap-ansi@7.0.0" + ] + }, + "color-convert@1.9.3": { + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dependencies": [ + "color-name@1.1.3" + ] + }, + "color-convert@2.0.1": { + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": [ + "color-name@1.1.4" + ] + }, + "color-name@1.1.3": { + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" + }, + "color-name@1.1.4": { + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "comment-parser@1.4.1": { + "integrity": "sha512-buhp5kePrmda3vhc5B9t7pUQXAb2Tnd0qgpkIhPhkHXxJpiPJ11H0ZEU0oBpJ2QztSbzG/ZxMj/CHsYJqRHmyg==" + }, + "concat-map@0.0.1": { + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "convert-source-map@2.0.0": { + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==" + }, + "cookie@0.5.0": { + "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==" + }, + "cross-spawn@7.0.3": { + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": [ + "path-key", + "shebang-command", + "which" + ] + }, + "debug@4.3.7": { + "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==", + "dependencies": [ + "ms" + ] + }, + "deep-eql@5.0.2": { + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==" + }, + "deep-is@0.1.4": { + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==" + }, + "dequal@2.0.3": { + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" + }, + "dir-glob@3.0.1": { + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dependencies": [ + "path-type" + ] + }, + "doctrine@3.0.0": { + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dependencies": [ + "esutils" + ] + }, + "dom-accessibility-api@0.5.16": { + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==" + }, + "dts-bundle-generator@9.5.1": { + "integrity": "sha512-DxpJOb2FNnEyOzMkG11sxO2dmxPjthoVWxfKqWYJ/bI/rT1rvTMktF5EKjAYrRZu6Z6t3NhOUZ0sZ5ZXevOfbA==", + "dependencies": [ + "typescript", + "yargs" + ] + }, + "eastasianwidth@0.2.0": { + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "electron-to-chromium@1.5.38": { + "integrity": "sha512-VbeVexmZ1IFh+5EfrYz1I0HTzHVIlJa112UEWhciPyeOcKJGeTv6N8WnG4wsQB81DGCaVEGhpSb6o6a8WYFXXg==" + }, + "emoji-regex@8.0.0": { + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "emoji-regex@9.2.2": { + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "esbuild@0.21.5": { + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dependencies": [ + "@esbuild/aix-ppc64", + "@esbuild/android-arm", + "@esbuild/android-arm64", + "@esbuild/android-x64", + "@esbuild/darwin-arm64", + "@esbuild/darwin-x64", + "@esbuild/freebsd-arm64", + "@esbuild/freebsd-x64", + "@esbuild/linux-arm", + "@esbuild/linux-arm64", + "@esbuild/linux-ia32", + "@esbuild/linux-loong64", + "@esbuild/linux-mips64el", + "@esbuild/linux-ppc64", + "@esbuild/linux-riscv64", + "@esbuild/linux-s390x", + "@esbuild/linux-x64", + "@esbuild/netbsd-x64", + "@esbuild/openbsd-x64", + "@esbuild/sunos-x64", + "@esbuild/win32-arm64", + "@esbuild/win32-ia32", + "@esbuild/win32-x64" + ] + }, + "escalade@3.2.0": { + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==" + }, + "escape-string-regexp@1.0.5": { + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==" + }, + "escape-string-regexp@4.0.0": { + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==" + }, + "eslint-plugin-jsdoc@46.10.1_eslint@8.57.1": { + "integrity": "sha512-x8wxIpv00Y50NyweDUpa+58ffgSAI5sqe+zcZh33xphD0AVh+1kqr1ombaTRb7Fhpove1zfUuujlX9DWWBP5ag==", + "dependencies": [ + "@es-joy/jsdoccomment", + "are-docs-informative", + "comment-parser", + "debug", + "escape-string-regexp@4.0.0", + "eslint", + "esquery", + "is-builtin-module", + "semver@7.6.3", + "spdx-expression-parse" + ] + }, + "eslint-plugin-prefer-arrow@1.2.3_eslint@8.57.1": { + "integrity": "sha512-J9I5PKCOJretVuiZRGvPQxCbllxGAV/viI20JO3LYblAodofBxyMnZAJ+WGeClHgANnSJberTNoFWWjrWKBuXQ==", + "dependencies": [ + "eslint" + ] + }, + "eslint-plugin-prettier@4.2.1_eslint@8.57.1_prettier@2.8.8": { + "integrity": "sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==", + "dependencies": [ + "eslint", + "prettier", + "prettier-linter-helpers" + ] + }, + "eslint-scope@5.1.1": { + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dependencies": [ + "esrecurse", + "estraverse@4.3.0" + ] + }, + "eslint-scope@7.2.2": { + "integrity": "sha512-dOt21O7lTMhDM+X9mB4GX+DZrZtCUJPL/wlcTqxyrx5IvO0IYtILdtrQGQp+8n5S0gwSVmOf9NQrjMOgfQZlIg==", + "dependencies": [ + "esrecurse", + "estraverse@5.3.0" + ] + }, + "eslint-visitor-keys@3.4.3": { + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==" + }, + "eslint@8.57.1": { + "integrity": "sha512-ypowyDxpVSYpkXr9WPv2PAZCtNip1Mv5KTW0SCurXv/9iOpcrH9PaqUElksqEB6pChqHGDRCFTyrZlGhnLNGiA==", + "dependencies": [ + "@eslint-community/eslint-utils", + "@eslint-community/regexpp", + "@eslint/eslintrc", + "@eslint/js", + "@humanwhocodes/config-array", + "@humanwhocodes/module-importer", + "@nodelib/fs.walk", + "@ungap/structured-clone", + "ajv", + "chalk@4.1.2", + "cross-spawn", + "debug", + "doctrine", + "escape-string-regexp@4.0.0", + "eslint-scope@7.2.2", + "eslint-visitor-keys", + "espree", + "esquery", + "esutils", + "fast-deep-equal", + "file-entry-cache", + "find-up", + "glob-parent@6.0.2", + "globals@13.24.0", + "graphemer", + "ignore", + "imurmurhash", + "is-glob", + "is-path-inside", + "js-yaml", + "json-stable-stringify-without-jsonify", + "levn", + "lodash.merge", + "minimatch@3.1.2", + "natural-compare", + "optionator", + "strip-ansi@6.0.1", + "text-table" + ] + }, + "espree@9.6.1_acorn@8.12.1": { + "integrity": "sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==", + "dependencies": [ + "acorn", + "acorn-jsx", + "eslint-visitor-keys" + ] + }, + "esquery@1.6.0": { + "integrity": "sha512-ca9pw9fomFcKPvFLXhBKUK90ZvGibiGOvRJNbjljY7s7uq/5YO4BOzcYtJqExdx99rF6aAcnRxHmcUHcz6sQsg==", + "dependencies": [ + "estraverse@5.3.0" + ] + }, + "esrecurse@4.3.0": { + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dependencies": [ + "estraverse@5.3.0" + ] + }, + "estraverse@4.3.0": { + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==" + }, + "estraverse@5.3.0": { + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==" + }, + "estree-walker@3.0.3": { + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dependencies": [ + "@types/estree" + ] + }, + "esutils@2.0.3": { + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==" + }, + "fast-deep-equal@3.1.3": { + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + }, + "fast-diff@1.3.0": { + "integrity": "sha512-VxPP4NqbUjj6MaAOafWeUn2cXWLcCtljklUtZf0Ind4XQ+QPtmA0b18zZy0jIQx+ExRVCR/ZQpBmik5lXshNsw==" + }, + "fast-glob@3.3.2": { + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dependencies": [ + "@nodelib/fs.stat", + "@nodelib/fs.walk", + "glob-parent@5.1.2", + "merge2", + "micromatch" + ] + }, + "fast-json-stable-stringify@2.1.0": { + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + }, + "fast-levenshtein@2.0.6": { + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==" + }, + "fastq@1.17.1": { + "integrity": "sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==", + "dependencies": [ + "reusify" + ] + }, + "fdir@6.4.0_picomatch@4.0.2": { + "integrity": "sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==", + "dependencies": [ + "picomatch@4.0.2" + ] + }, + "fflate@0.8.2": { + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==" + }, + "file-entry-cache@6.0.1": { + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dependencies": [ + "flat-cache" + ] + }, + "fill-range@7.1.1": { + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dependencies": [ + "to-regex-range" + ] + }, + "find-up@5.0.0": { + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dependencies": [ + "locate-path", + "path-exists" + ] + }, + "flat-cache@3.2.0": { + "integrity": "sha512-CYcENa+FtcUKLmhhqyctpclsq7QF38pKjZHsGNiSQF5r4FtoKDWabFDl3hzaEQMvT1LHEysw5twgLvpYYb4vbw==", + "dependencies": [ + "flatted", + "keyv", + "rimraf" + ] + }, + "flatted@3.3.1": { + "integrity": "sha512-X8cqMLLie7KsNUDSdzeN8FYK9rEt4Dt67OsG/DNGnYTSDBG4uFAJFBnUeiV+zCVAvwFy56IjM9sH51jVaEhNxw==" + }, + "foreground-child@3.3.0": { + "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "dependencies": [ + "cross-spawn", + "signal-exit" + ] + }, + "fs.realpath@1.0.0": { + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "fsevents@2.3.2": { + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==" + }, + "fsevents@2.3.3": { + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==" + }, + "gensync@1.0.0-beta.2": { + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==" + }, + "get-caller-file@2.0.5": { + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==" + }, + "glob-parent@5.1.2": { + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dependencies": [ + "is-glob" + ] + }, + "glob-parent@6.0.2": { + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dependencies": [ + "is-glob" + ] + }, + "glob@10.4.5": { + "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", + "dependencies": [ + "foreground-child", + "jackspeak", + "minimatch@9.0.5", + "minipass", + "package-json-from-dist", + "path-scurry" + ] + }, + "glob@7.2.3": { + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": [ + "fs.realpath", + "inflight", + "inherits", + "minimatch@3.1.2", + "once", + "path-is-absolute" + ] + }, + "globals@11.12.0": { + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==" + }, + "globals@13.24.0": { + "integrity": "sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==", + "dependencies": [ + "type-fest@0.20.2" + ] + }, + "globby@11.1.0": { + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dependencies": [ + "array-union", + "dir-glob", + "fast-glob", + "ignore", + "merge2", + "slash" + ] + }, + "graphemer@1.4.0": { + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" + }, + "graphql@16.9.0": { + "integrity": "sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw==" + }, + "has-flag@3.0.0": { + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==" + }, + "has-flag@4.0.0": { + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==" + }, + "headers-polyfill@4.0.3": { + "integrity": "sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==" + }, + "html-escaper@2.0.2": { + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==" + }, + "ignore@5.3.2": { + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==" + }, + "import-fresh@3.3.0": { + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dependencies": [ + "parent-module", + "resolve-from" + ] + }, + "imurmurhash@0.1.4": { + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==" + }, + "inflight@1.0.6": { + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": [ + "once", + "wrappy" + ] + }, + "inherits@2.0.4": { + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-builtin-module@3.2.1": { + "integrity": "sha512-BSLE3HnV2syZ0FK0iMA/yUGplUeMmNz4AW5fnTunbCIqZi4vG3WjJT9FHMy5D69xmAYBHXQhJdALdpwVxV501A==", + "dependencies": [ + "builtin-modules" + ] + }, + "is-extglob@2.1.1": { + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==" + }, + "is-fullwidth-code-point@3.0.0": { + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==" + }, + "is-glob@4.0.3": { + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dependencies": [ + "is-extglob" + ] + }, + "is-node-process@1.2.0": { + "integrity": "sha512-Vg4o6/fqPxIjtxgUH5QLJhwZ7gW5diGCVlXpuUfELC62CuxM1iHcRe51f2W1FDy04Ai4KJkagKjx3XaqyfRKXw==" + }, + "is-number@7.0.0": { + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==" + }, + "is-path-inside@3.0.3": { + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==" + }, + "isexe@2.0.0": { + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "istanbul-lib-coverage@3.2.2": { + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==" + }, + "istanbul-lib-instrument@6.0.3": { + "integrity": "sha512-Vtgk7L/R2JHyyGW07spoFlB8/lpjiOLTjMdms6AFMraYt3BaJauod/NGrfnVG/y4Ix1JEuMRPDPEj2ua+zz1/Q==", + "dependencies": [ + "@babel/core", + "@babel/parser", + "@istanbuljs/schema", + "istanbul-lib-coverage", + "semver@7.6.3" + ] + }, + "istanbul-lib-report@3.0.1": { + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dependencies": [ + "istanbul-lib-coverage", + "make-dir", + "supports-color@7.2.0" + ] + }, + "istanbul-lib-source-maps@5.0.6": { + "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==", + "dependencies": [ + "@jridgewell/trace-mapping", + "debug", + "istanbul-lib-coverage" + ] + }, + "istanbul-reports@3.1.7": { + "integrity": "sha512-BewmUXImeuRk2YY0PVbxgKAysvhRPUQE0h5QRM++nVWyubKGV0l8qQ5op8+B2DOmwSe63Jivj0BjkPQVf8fP5g==", + "dependencies": [ + "html-escaper", + "istanbul-lib-report" + ] + }, + "jackspeak@3.4.3": { + "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", + "dependencies": [ + "@isaacs/cliui", + "@pkgjs/parseargs" + ] + }, + "js-tokens@4.0.0": { + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==" + }, + "js-yaml@4.1.0": { + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dependencies": [ + "argparse" + ] + }, + "jsdoc-type-pratt-parser@4.0.0": { + "integrity": "sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==" + }, + "jsesc@3.0.2": { + "integrity": "sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==" + }, + "json-buffer@3.0.1": { + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==" + }, + "json-schema-traverse@0.4.1": { + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + }, + "json-stable-stringify-without-jsonify@1.0.1": { + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==" + }, + "json5@2.2.3": { + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==" + }, + "keyv@4.5.4": { + "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==", + "dependencies": [ + "json-buffer" + ] + }, + "levn@0.4.1": { + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dependencies": [ + "prelude-ls", + "type-check" + ] + }, + "locate-path@6.0.0": { + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dependencies": [ + "p-locate" + ] + }, + "lodash.merge@4.6.2": { + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==" + }, + "loupe@3.1.2": { + "integrity": "sha512-23I4pFZHmAemUnz8WZXbYRSKYj801VDaNv9ETuMh7IrMc7VuVVSo+Z9iLE3ni30+U48iDWfi30d3twAXBYmnCg==" + }, + "lru-cache@10.4.3": { + "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==" + }, + "lru-cache@5.1.1": { + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dependencies": [ + "yallist" + ] + }, + "lz-string@1.5.0": { + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==" + }, + "magic-string@0.30.12": { + "integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==", + "dependencies": [ + "@jridgewell/sourcemap-codec" + ] + }, + "magicast@0.3.5": { + "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==", + "dependencies": [ + "@babel/parser", + "@babel/types", + "source-map-js" + ] + }, + "make-dir@4.0.0": { + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dependencies": [ + "semver@7.6.3" + ] + }, + "merge2@1.4.1": { + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" + }, + "micromatch@4.0.8": { + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dependencies": [ + "braces", + "picomatch@2.3.1" + ] + }, + "minimatch@3.1.2": { + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": [ + "brace-expansion@1.1.11" + ] + }, + "minimatch@9.0.5": { + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dependencies": [ + "brace-expansion@2.0.1" + ] + }, + "minipass@7.1.2": { + "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==" + }, + "mrmime@2.0.0": { + "integrity": "sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==" + }, + "ms@2.1.3": { + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "msw@2.4.11_typescript@5.6.3": { + "integrity": "sha512-TVEw9NOPTc6ufOQLJ53234S9NBRxQbu7xFMxs+OCP43JQcNEIOKiZHxEm2nDzYIrwccoIhUxUf8wr99SukD76A==", + "dependencies": [ + "@bundled-es-modules/cookie", + "@bundled-es-modules/statuses", + "@bundled-es-modules/tough-cookie", + "@inquirer/confirm", + "@mswjs/interceptors", + "@open-draft/until", + "@types/cookie", + "@types/statuses", + "chalk@4.1.2", + "graphql", + "headers-polyfill", + "is-node-process", + "outvariant", + "path-to-regexp", + "strict-event-emitter", + "type-fest@4.26.1", + "typescript", + "yargs" + ] + }, + "mute-stream@1.0.0": { + "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==" + }, + "nanoid@3.3.7": { + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" + }, + "natural-compare-lite@1.4.0": { + "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==" + }, + "natural-compare@1.4.0": { + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==" + }, + "node-releases@2.0.18": { + "integrity": "sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==" + }, + "once@1.4.0": { + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": [ + "wrappy" + ] + }, + "optionator@0.9.4": { + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", + "dependencies": [ + "deep-is", + "fast-levenshtein", + "levn", + "prelude-ls", + "type-check", + "word-wrap" + ] + }, + "outvariant@1.4.3": { + "integrity": "sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==" + }, + "p-limit@3.1.0": { + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dependencies": [ + "yocto-queue" + ] + }, + "p-locate@5.0.0": { + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dependencies": [ + "p-limit" + ] + }, + "package-json-from-dist@1.0.1": { + "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==" + }, + "parent-module@1.0.1": { + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dependencies": [ + "callsites" + ] + }, + "path-exists@4.0.0": { + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==" + }, + "path-is-absolute@1.0.1": { + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + }, + "path-key@3.1.1": { + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==" + }, + "path-scurry@1.11.1": { + "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", + "dependencies": [ + "lru-cache@10.4.3", + "minipass" + ] + }, + "path-to-regexp@6.3.0": { + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==" + }, + "path-type@4.0.0": { + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==" + }, + "pathe@1.1.2": { + "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==" + }, + "pathval@2.0.0": { + "integrity": "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==" + }, + "picocolors@1.1.0": { + "integrity": "sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==" + }, + "picomatch@2.3.1": { + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==" + }, + "picomatch@4.0.2": { + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==" + }, + "playwright-core@1.48.0": { + "integrity": "sha512-RBvzjM9rdpP7UUFrQzRwR8L/xR4HyC1QXMzGYTbf1vjw25/ya9NRAVnXi/0fvFopjebvyPzsmoK58xxeEOaVvA==" + }, + "playwright@1.48.0": { + "integrity": "sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==", + "dependencies": [ + "fsevents@2.3.2", + "playwright-core" + ] + }, + "postcss@8.4.47": { + "integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==", + "dependencies": [ + "nanoid", + "picocolors", + "source-map-js" + ] + }, + "prelude-ls@1.2.1": { + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==" + }, + "prettier-linter-helpers@1.0.0": { + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dependencies": [ + "fast-diff" + ] + }, + "prettier@2.8.8": { + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==" + }, + "pretty-format@27.5.1": { + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dependencies": [ + "ansi-regex@5.0.1", + "ansi-styles@5.2.0", + "react-is" + ] + }, + "psl@1.9.0": { + "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" + }, + "punycode@2.3.1": { + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==" + }, + "querystringify@2.2.0": { + "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" + }, + "queue-microtask@1.2.3": { + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==" + }, + "react-is@17.0.2": { + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" + }, + "regenerator-runtime@0.14.1": { + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==" + }, + "require-directory@2.1.1": { + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==" + }, + "requires-port@1.0.0": { + "integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==" + }, + "resolve-from@4.0.0": { + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==" + }, + "reusify@1.0.4": { + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" + }, + "rimraf@3.0.2": { + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dependencies": [ + "glob@7.2.3" + ] + }, + "rollup@4.24.0": { + "integrity": "sha512-DOmrlGSXNk1DM0ljiQA+i+o0rSLhtii1je5wgk60j49d1jHT5YYttBv1iWOnYSTG+fZZESUOSNiAl89SIet+Cg==", + "dependencies": [ + "@rollup/rollup-android-arm-eabi", + "@rollup/rollup-android-arm64", + "@rollup/rollup-darwin-arm64", + "@rollup/rollup-darwin-x64", + "@rollup/rollup-linux-arm-gnueabihf", + "@rollup/rollup-linux-arm-musleabihf", + "@rollup/rollup-linux-arm64-gnu", + "@rollup/rollup-linux-arm64-musl", + "@rollup/rollup-linux-powerpc64le-gnu", + "@rollup/rollup-linux-riscv64-gnu", + "@rollup/rollup-linux-s390x-gnu", + "@rollup/rollup-linux-x64-gnu", + "@rollup/rollup-linux-x64-musl", + "@rollup/rollup-win32-arm64-msvc", + "@rollup/rollup-win32-ia32-msvc", + "@rollup/rollup-win32-x64-msvc", + "@types/estree", + "fsevents@2.3.3" + ] + }, + "run-parallel@1.2.0": { + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dependencies": [ + "queue-microtask" + ] + }, + "semver@6.3.1": { + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" + }, + "semver@7.6.3": { + "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==" + }, + "shebang-command@2.0.0": { + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": [ + "shebang-regex" + ] + }, + "shebang-regex@3.0.0": { + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==" + }, + "siginfo@2.0.0": { + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==" + }, + "signal-exit@4.1.0": { + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==" + }, + "sirv@2.0.4": { + "integrity": "sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==", + "dependencies": [ + "@polka/url", + "mrmime", + "totalist" + ] + }, + "slash@3.0.0": { + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==" + }, + "source-map-js@1.2.1": { + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" + }, + "spdx-exceptions@2.5.0": { + "integrity": "sha512-PiU42r+xO4UbUS1buo3LPJkjlO7430Xn5SVAhdpzzsPHsjbYVflnnFdATgabnLude+Cqu25p6N+g2lw/PFsa4w==" + }, + "spdx-expression-parse@4.0.0": { + "integrity": "sha512-Clya5JIij/7C6bRR22+tnGXbc4VKlibKSVj2iHvVeX5iMW7s1SIQlqu699JkODJJIhh/pUu8L0/VLh8xflD+LQ==", + "dependencies": [ + "spdx-exceptions", + "spdx-license-ids" + ] + }, + "spdx-license-ids@3.0.20": { + "integrity": "sha512-jg25NiDV/1fLtSgEgyvVyDunvaNHbuwF9lfNV17gSmPFAlYzdfNBlLtLzXTevwkPj7DhGbmN9VnmJIgLnhvaBw==" + }, + "stackback@0.0.2": { + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==" + }, + "statuses@2.0.1": { + "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==" + }, + "std-env@3.7.0": { + "integrity": "sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==" + }, + "strict-event-emitter@0.5.1": { + "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==" + }, + "string-width@4.2.3": { + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": [ + "emoji-regex@8.0.0", + "is-fullwidth-code-point", + "strip-ansi@6.0.1" + ] + }, + "string-width@5.1.2": { + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": [ + "eastasianwidth", + "emoji-regex@9.2.2", + "strip-ansi@7.1.0" + ] + }, + "strip-ansi@6.0.1": { + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": [ + "ansi-regex@5.0.1" + ] + }, + "strip-ansi@7.1.0": { + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": [ + "ansi-regex@6.1.0" + ] + }, + "strip-json-comments@3.1.1": { + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==" + }, + "supports-color@5.5.0": { + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dependencies": [ + "has-flag@3.0.0" + ] + }, + "supports-color@7.2.0": { + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dependencies": [ + "has-flag@4.0.0" + ] + }, + "test-exclude@7.0.1": { + "integrity": "sha512-pFYqmTw68LXVjeWJMST4+borgQP2AyMNbg1BpZh9LbyhUeNkeaPF9gzfPGUAnSMV3qPYdWUwDIjjCLiSDOl7vg==", + "dependencies": [ + "@istanbuljs/schema", + "glob@10.4.5", + "minimatch@9.0.5" + ] + }, + "text-table@0.2.0": { + "integrity": "sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==" + }, + "tinybench@2.9.0": { + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==" + }, + "tinyexec@0.3.0": { + "integrity": "sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==" + }, + "tinyglobby@0.2.9_picomatch@4.0.2": { + "integrity": "sha512-8or1+BGEdk1Zkkw2ii16qSS7uVrQJPre5A9o/XkWPATkk23FZh/15BKFxPnlTy6vkljZxLqYCzzBMj30ZrSvjw==", + "dependencies": [ + "fdir", + "picomatch@4.0.2" + ] + }, + "tinypool@1.0.1": { + "integrity": "sha512-URZYihUbRPcGv95En+sz6MfghfIc2OJ1sv/RmhWZLouPY0/8Vo80viwPvg3dlaS9fuq7fQMEfgRRK7BBZThBEA==" + }, + "tinyrainbow@1.2.0": { + "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==" + }, + "tinyspy@3.0.2": { + "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==" + }, + "to-fast-properties@2.0.0": { + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==" + }, + "to-regex-range@5.0.1": { + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dependencies": [ + "is-number" + ] + }, + "totalist@3.0.1": { + "integrity": "sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==" + }, + "tough-cookie@4.1.4": { + "integrity": "sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==", + "dependencies": [ + "psl", + "punycode", + "universalify", + "url-parse" + ] + }, + "tslib@1.14.1": { + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + }, + "tsutils@3.21.0_typescript@5.6.3": { + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dependencies": [ + "tslib", + "typescript" + ] + }, + "type-check@0.4.0": { + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dependencies": [ + "prelude-ls" + ] + }, + "type-fest@0.20.2": { + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==" + }, + "type-fest@0.21.3": { + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==" + }, + "type-fest@4.26.1": { + "integrity": "sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==" + }, + "typescript@5.6.3": { + "integrity": "sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==" + }, + "undici-types@6.19.8": { + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==" + }, + "universalify@0.2.0": { + "integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==" + }, + "update-browserslist-db@1.1.1_browserslist@4.24.0": { + "integrity": "sha512-R8UzCaa9Az+38REPiJ1tXlImTJXlVfgHZsglwBD/k6nj76ctsH1E3q4doGrukiLQd3sGQYu56r5+lo5r94l29A==", + "dependencies": [ + "browserslist", + "escalade", + "picocolors" + ] + }, + "uri-js@4.4.1": { + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dependencies": [ + "punycode" + ] + }, + "url-parse@1.5.10": { + "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", + "dependencies": [ + "querystringify", + "requires-port" + ] + }, + "vite-node@2.1.3": { + "integrity": "sha512-I1JadzO+xYX887S39Do+paRePCKoiDrWRRjp9kkG5he0t7RXNvPAJPCQSJqbGN4uCrFFeS3Kj3sLqY8NMYBEdA==", + "dependencies": [ + "cac", + "debug", + "pathe", + "vite" + ] + }, + "vite@5.4.9": { + "integrity": "sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==", + "dependencies": [ + "esbuild", + "fsevents@2.3.3", + "postcss", + "rollup" + ] + }, + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3": { + "integrity": "sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==", + "dependencies": [ + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+spy@2.1.3_vite@5.4.9_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_typescript@5.6.3", + "@vitest/expect", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_vite@5.4.9_msw@2.4.11__typescript@5.6.3_typescript@5.6.3", + "@vitest/pretty-format", + "@vitest/runner", + "@vitest/snapshot", + "@vitest/spy", + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3", + "@vitest/utils", + "chai", + "debug", + "magic-string", + "pathe", + "std-env", + "tinybench", + "tinyexec", + "tinypool", + "tinyrainbow", + "vite", + "vite-node", + "why-is-node-running" + ] + }, + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3": { + "integrity": "sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==", + "dependencies": [ + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3__playwright@1.48.0__typescript@5.6.3", + "@vitest/expect", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3", + "@vitest/pretty-format", + "@vitest/runner", + "@vitest/snapshot", + "@vitest/spy", + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__@vitest+spy@2.1.3__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3", + "@vitest/utils", + "chai", + "debug", + "magic-string", + "pathe", + "std-env", + "tinybench", + "tinyexec", + "tinypool", + "tinyrainbow", + "vite", + "vite-node", + "why-is-node-running" + ] + }, + "vitest@2.1.3_@vitest+browser@2.1.3__playwright@1.48.0__vitest@2.1.3___@vitest+browser@2.1.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@testing-library+dom@10.4.0__msw@2.4.11___typescript@5.6.3__vite@5.4.9__typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3___playwright@1.48.0___typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_playwright@1.48.0_@vitest+spy@2.1.3_vite@5.4.9_typescript@5.6.3": { + "integrity": "sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==", + "dependencies": [ + "@vitest/browser@2.1.3_playwright@1.48.0_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@testing-library+dom@10.4.0_msw@2.4.11__typescript@5.6.3_vite@5.4.9_typescript@5.6.3_@vitest+ui@2.1.3__vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___@vitest+ui@2.1.3___playwright@1.48.0___@vitest+spy@2.1.3___vite@5.4.9___typescript@5.6.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3__playwright@1.48.0__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_@vitest+spy@2.1.3", + "@vitest/expect", + "@vitest/mocker@2.1.3_@vitest+spy@2.1.3_vite@5.4.9_msw@2.4.11__typescript@5.6.3_typescript@5.6.3", + "@vitest/pretty-format", + "@vitest/runner", + "@vitest/snapshot", + "@vitest/spy", + "@vitest/ui@2.1.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_vitest@2.1.3__@vitest+browser@2.1.3___playwright@1.48.0___vitest@2.1.3____@vitest+browser@2.1.3____@vitest+ui@2.1.3_____vitest@2.1.3_____@vitest+browser@2.1.3_____playwright@1.48.0_____typescript@5.6.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@testing-library+dom@10.4.0___msw@2.4.11____typescript@5.6.3___vite@5.4.9___typescript@5.6.3___@vitest+ui@2.1.3____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@vitest+browser@2.1.3____playwright@1.48.0____typescript@5.6.3__@vitest+ui@2.1.3___vitest@2.1.3____@vitest+browser@2.1.3_____playwright@1.48.0_____vitest@2.1.3_____@testing-library+dom@10.4.0_____msw@2.4.11______typescript@5.6.3_____vite@5.4.9_____typescript@5.6.3_____@vitest+ui@2.1.3____@vitest+ui@2.1.3____playwright@1.48.0____@vitest+spy@2.1.3____vite@5.4.9____typescript@5.6.3___@vitest+browser@2.1.3____playwright@1.48.0____vitest@2.1.3_____@vitest+browser@2.1.3_____@vitest+ui@2.1.3_____playwright@1.48.0_____@vitest+spy@2.1.3_____vite@5.4.9_____typescript@5.6.3____@testing-library+dom@10.4.0____msw@2.4.11_____typescript@5.6.3____vite@5.4.9____typescript@5.6.3____@vitest+ui@2.1.3___playwright@1.48.0___typescript@5.6.3__playwright@1.48.0__@vitest+spy@2.1.3__vite@5.4.9__typescript@5.6.3_typescript@5.6.3", + "@vitest/utils", + "chai", + "debug", + "magic-string", + "pathe", + "std-env", + "tinybench", + "tinyexec", + "tinypool", + "tinyrainbow", + "vite", + "vite-node", + "why-is-node-running" + ] + }, + "which@2.0.2": { + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": [ + "isexe" + ] + }, + "why-is-node-running@2.3.0": { + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dependencies": [ + "siginfo", + "stackback" + ] + }, + "word-wrap@1.2.5": { + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==" + }, + "wrap-ansi@6.2.0": { + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dependencies": [ + "ansi-styles@4.3.0", + "string-width@4.2.3", + "strip-ansi@6.0.1" + ] + }, + "wrap-ansi@7.0.0": { + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": [ + "ansi-styles@4.3.0", + "string-width@4.2.3", + "strip-ansi@6.0.1" + ] + }, + "wrap-ansi@8.1.0": { + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": [ + "ansi-styles@6.2.1", + "string-width@5.1.2", + "strip-ansi@7.1.0" + ] + }, + "wrappy@1.0.2": { + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "ws@8.18.0": { + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==" + }, + "y18n@5.0.8": { + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==" + }, + "yallist@3.1.1": { + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==" + }, + "yargs-parser@21.1.1": { + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==" + }, + "yargs@17.7.2": { + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": [ + "cliui", + "escalade", + "get-caller-file", + "require-directory", + "string-width@4.2.3", + "y18n", + "yargs-parser" + ] + }, + "yocto-queue@0.1.0": { + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" + }, + "yoctocolors-cjs@2.1.2": { + "integrity": "sha512-cYVsTjKl8b+FrnidjibDWskAv7UKOfcwaVZdp/it9n1s9fU3IkgDbhdIRKCW4JDsAlECJY0ytoVPT3sK6kideA==" + } + }, + "workspace": { + "packageJson": { + "dependencies": [ + "npm:@thednp/dommatrix@^2.0.8", + "npm:@typescript-eslint/eslint-plugin@^5.62.0", + "npm:@typescript-eslint/parser@^5.62.0", + "npm:@vitest/browser@^2.1.2", + "npm:@vitest/coverage-istanbul@^2.1.2", + "npm:@vitest/ui@^2.1.2", + "npm:dts-bundle-generator@^9.5.1", + "npm:eslint-plugin-jsdoc@^46.10.1", + "npm:eslint-plugin-prefer-arrow@^1.2.3", + "npm:eslint-plugin-prettier@^4.2.1", + "npm:eslint@^8.57.1", + "npm:playwright@^1.48.0", + "npm:prettier@^2.8.8", + "npm:typescript@^5.6.3", + "npm:vite@^5.4.8", + "npm:vitest@^2.1.2" + ] + } + } +} diff --git a/dist/svg-path-commander.cjs b/dist/svg-path-commander.cjs index 82d89df..e958620 100644 --- a/dist/svg-path-commander.cjs +++ b/dist/svg-path-commander.cjs @@ -1,2 +1,2 @@ -"use strict";var he=Object.defineProperty;var fe=(e,t,n)=>t in e?he(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var N=(e,t,n)=>fe(e,typeof t!="symbol"?t+"":t,n);const st={origin:[0,0,0],round:4},E="SVGPathCommander Error",tt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},$t=e=>{let t=e.pathValue[e.segmentStart],n=t.toLowerCase();const{data:r}=e;for(;r.length>=tt[n]&&(n==="m"&&r.length>2?(e.segments.push([t,...r.splice(0,2)]),n="l",t=t==="m"?"l":"L"):e.segments.push([t,...r.splice(0,tt[n])]),!!tt[n]););},ye=e=>{const{index:t,pathValue:n}=e,r=n.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${E}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`},F=e=>e>=48&&e<=57,U="Invalid path value",ge=e=>{const{max:t,pathValue:n,index:r}=e;let s=r,i=!1,o=!1,c=!1,l=!1,a;if(s>=t){e.err=`${E}: ${U} at index ${s}, "pathValue" is missing param`;return}if(a=n.charCodeAt(s),(a===43||a===45)&&(s+=1,a=n.charCodeAt(s)),!F(a)&&a!==46){e.err=`${E}: ${U} at index ${s}, "${n[s]}" is not a number`;return}if(a!==46){if(i=a===48,s+=1,a=n.charCodeAt(s),i&&s[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),et=e=>{const{pathValue:t,max:n}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},de=e=>F(e)||e===43||e===45||e===46,Me=e=>(e|32)===97,be=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},Qt=e=>{var l;const{max:t,pathValue:n,index:r,segments:s}=e,i=n.charCodeAt(r),o=tt[n[r].toLowerCase()];if(e.segmentStart=r,!pe(i)){e.err=`${E}: ${U} "${n[r]}" is not a path command at index ${r}`;return}const c=s[s.length-1];if(!be(i)&&((l=c==null?void 0:c[0])==null?void 0:l.toLocaleLowerCase())==="z"){e.err=`${E}: ${U} "${n[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,et(e),e.data=[],!o){$t(e);return}for(;;){for(let a=o;a>0;a-=1){if(Me(i)&&(a===3||a===4)?ye(e):ge(e),e.err.length)return;e.data.push(e.param),et(e),e.index=e.max||!de(n.charCodeAt(e.index)))break}$t(e)};class Xt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const q=e=>{if(typeof e!="string")return e.slice(0);const t=new Xt(e);for(et(t);t.index{const t=e.length;let n=-1,r,s=e[t-1],i=0;for(;++nMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),Ne=e=>e.reduce((t,n,r)=>r?t+Pt(e[r-1],n):0,0);var Ae=Object.defineProperty,Ce=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>Ce(e,typeof t!="symbol"?t+"":t,n);const ve={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},Bt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),Yt=e=>e instanceof DOMMatrix||e instanceof v||typeof e=="object"&&Object.keys(ve).every(t=>e&&t in e),it=e=>{const t=new v,n=Array.from(e);if(!Bt(n))throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);if(n.length===16){const[r,s,i,o,c,l,a,m,u,g,f,h,y,x,p,d]=n;t.m11=r,t.a=r,t.m21=c,t.c=c,t.m31=u,t.m41=y,t.e=y,t.m12=s,t.b=s,t.m22=l,t.d=l,t.m32=g,t.m42=x,t.f=x,t.m13=i,t.m23=a,t.m33=f,t.m43=p,t.m14=o,t.m24=m,t.m34=h,t.m44=d}else if(n.length===6){const[r,s,i,o,c,l]=n;t.m11=r,t.a=r,t.m12=s,t.b=s,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=c,t.e=c,t.m42=l,t.f=l}return t},Ht=e=>{if(Yt(e))return it([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},Ft=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let n=new v;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(s=>s).forEach(s=>{const[i,o]=s.split("(");if(!o)throw TypeError(r);const c=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[l,a,m,u]=c,g=[l,a,m],f=[l,a,m,u];if(i==="perspective"&&l&&[a,m].every(h=>h===void 0))n.m34=-1/l;else if(i.includes("matrix")&&[6,16].includes(c.length)&&c.every(h=>!Number.isNaN(+h))){const h=c.map(y=>Math.abs(y)<1e-6?0:y);n=n.multiply(it(h))}else if(i==="translate3d"&&g.every(h=>!Number.isNaN(+h)))n=n.translate(l,a,m);else if(i==="translate"&&l&&m===void 0)n=n.translate(l,a||0,0);else if(i==="rotate3d"&&f.every(h=>!Number.isNaN(+h))&&u)n=n.rotateAxisAngle(l,a,m,u);else if(i==="rotate"&&l&&[a,m].every(h=>h===void 0))n=n.rotate(0,0,l);else if(i==="scale3d"&&g.every(h=>!Number.isNaN(+h))&&g.some(h=>h!==1))n=n.scale(l,a,m);else if(i==="scale"&&!Number.isNaN(l)&&l!==1&&m===void 0){const h=Number.isNaN(+a)?l:a;n=n.scale(l,h,1)}else if(i==="skew"&&(l||!Number.isNaN(l)&&a)&&m===void 0)n=n.skew(l,a||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&l&&[a,m].every(h=>h===void 0))if(i==="skewX"||i==="skewY")n=n[i](l);else{const h=i.replace(/[XYZ]/,""),y=i.replace(h,""),x=["X","Y","Z"].indexOf(y),p=h==="scale"?1:0,d=[x===0?l:p,x===1?l:p,x===2?l:p];n=n[h](...d)}else throw TypeError(r)}),n},wt=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],Ut=(e,t,n)=>{const r=new v;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=n,r},Vt=(e,t,n)=>{const r=new v,s=Math.PI/180,i=e*s,o=t*s,c=n*s,l=Math.cos(i),a=-Math.sin(i),m=Math.cos(o),u=-Math.sin(o),g=Math.cos(c),f=-Math.sin(c),h=m*g,y=-m*f;r.m11=h,r.a=h,r.m12=y,r.b=y,r.m13=u;const x=a*u*g+l*f;r.m21=x,r.c=x;const p=l*g-a*u*f;return r.m22=p,r.d=p,r.m23=-a*m,r.m31=a*f-l*u*g,r.m32=a*g+l*u*f,r.m33=l*m,r},_t=(e,t,n,r)=>{const s=new v,i=Math.sqrt(e*e+t*t+n*n);if(i===0)return s;const o=e/i,c=t/i,l=n/i,a=r*(Math.PI/360),m=Math.sin(a),u=Math.cos(a),g=m*m,f=o*o,h=c*c,y=l*l,x=1-2*(h+y)*g;s.m11=x,s.a=x;const p=2*(o*c*g+l*m*u);s.m12=p,s.b=p,s.m13=2*(o*l*g-c*m*u);const d=2*(c*o*g-l*m*u);s.m21=d,s.c=d;const C=1-2*(y+f)*g;return s.m22=C,s.d=C,s.m23=2*(c*l*g+o*m*u),s.m31=2*(l*o*g+c*m*u),s.m32=2*(l*c*g-o*m*u),s.m33=1-2*(f+h)*g,s},Jt=(e,t,n)=>{const r=new v;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=n,r},yt=(e,t)=>{const n=new v;if(e){const r=e*Math.PI/180,s=Math.tan(r);n.m21=s,n.c=s}if(t){const r=t*Math.PI/180,s=Math.tan(r);n.m12=s,n.b=s}return n},Kt=e=>yt(e,0),Wt=e=>yt(0,e),j=(e,t)=>{const n=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,s=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,c=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,l=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,a=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,m=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,u=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,g=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,f=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,y=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,x=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,p=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return it([n,r,s,i,o,c,l,a,m,u,g,f,h,y,x,p])};class v{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?Ft(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?it(t):typeof t=="object"?Ht(t):this}toFloat32Array(t){return Float32Array.from(wt(this,t))}toFloat64Array(t){return Float64Array.from(wt(this,t))}toString(){const{is2D:t}=this,n=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${n})`}toJSON(){const{is2D:t,isIdentity:n}=this;return{...this,is2D:t,isIdentity:n}}multiply(t){return j(this,t)}translate(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),j(this,Ut(s,i,o))}scale(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),j(this,Jt(s,i,o))}rotate(t,n,r){let s=t,i=n||0,o=r||0;return typeof t=="number"&&typeof n>"u"&&typeof r>"u"&&(o=s,s=0,i=0),j(this,Vt(s,i,o))}rotateAxisAngle(t,n,r,s){if([t,n,r,s].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return j(this,_t(t,n,r,s))}skewX(t){return j(this,Kt(t))}skewY(t){return j(this,Wt(t))}skew(t,n){return j(this,yt(t,n))}transformPoint(t){const n=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,s=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}k(v,"Translate",Ut),k(v,"Rotate",Vt),k(v,"RotateAxisAngle",_t),k(v,"Scale",Jt),k(v,"SkewX",Kt),k(v,"SkewY",Wt),k(v,"Skew",yt),k(v,"Multiply",j),k(v,"fromArray",it),k(v,"fromMatrix",Ht),k(v,"fromString",Ft),k(v,"toArray",wt),k(v,"isCompatibleArray",Bt),k(v,"isCompatibleObject",Yt);const gt={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},D=(e,t)=>{const n={...gt};let r=e.length,s;for(let i=0;i{const[n]=e,{x:r,y:s}=t,i=e.slice(1).map(Number),o=n.toUpperCase();if(!(o===n)){if(o==="A")return[o,i[0],i[1],i[2],i[3],i[4],i[5]+r,i[6]+s];if(o==="V")return[o,i[0]+s];if(o==="H")return[o,i[0]+r];{const l=i.map((a,m)=>a+(m%2?s:r));return[o,...l]}}return e},G=(e,t)=>{const[n]=e,{x1:r,y1:s,x2:i,y2:o}=t,c=e.slice(1).map(Number);if("TQ".includes(n)||(t.qx=null,t.qy=null),n==="H")return["L",e[1],s];if(n==="V")return["L",r,e[1]];if(n==="S"){const l=r*2-i,a=s*2-o;return t.x1=l,t.y1=a,["C",l,a,...c]}else if(n==="T"){const l=r*2-(t.qx?t.qx:0),a=s*2-(t.qy?t.qy:0);return t.qx=l,t.qy=a,["Q",l,a,...c]}else if(n==="Q"){const[l,a]=c;t.qx=l,t.qy=a}return e},R=(e,t,n)=>{const[r,s]=e,[i,o]=t;return[r+(i-r)*n,s+(o-s)*n]},at=(e,t,n,r)=>Pt([e,t],[n,r]),Gt=(e,t,n,r,s)=>{const i=Pt([e,t],[n,r]);let o={x:e,y:t};if(typeof s=="number")if(s<=0)o={x:e,y:t};else if(s>=i)o={x:n,y:r};else{const[c,l]=R([e,t],[n,r],s/i);o={x:c,y:l}}return o},kt=(e,t,n,r)=>{const{min:s,max:i}=Math;return{min:{x:s(e,n),y:s(t,r)},max:{x:i(e,n),y:i(t,r)}}},te=(e,t,n)=>{const r=n/2,s=Math.sin(r),i=Math.cos(r),o=e**2*s**2,c=t**2*i**2,l=Math.sqrt(o+c)*n;return Math.abs(l)},K=(e,t,n,r,s,i)=>{const o=Math.cos(i),c=Math.sin(i),l=r*Math.cos(e),a=s*Math.sin(e);return{x:t+o*l-c*a,y:n+c*l+o*a}},qt=(e,t)=>{const{x:n,y:r}=e,{x:s,y:i}=t,o=n*s+r*i,c=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(o/c)},Lt=(e,t,n,r,s,i,o,c,l)=>{const{abs:a,sin:m,cos:u,sqrt:g,PI:f}=Math;let h=a(n),y=a(r);const p=(s%360+360)%360*(f/180);if(e===c&&t===l)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};if(h===0||y===0)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};const d=(e-c)/2,C=(t-l)/2,M={x:u(p)*d+m(p)*C,y:-m(p)*d+u(p)*C},b=M.x**2/h**2+M.y**2/y**2;b>1&&(h*=g(b),y*=g(b));const w=h**2*y**2-h**2*M.y**2-y**2*M.x**2,T=h**2*M.y**2+y**2*M.x**2;let P=w/T;P=P<0?0:P;const $=(i!==o?1:-1)*g(P),S={x:$*(h*M.y/y),y:$*(-(y*M.x)/h)},_={x:u(p)*S.x-m(p)*S.y+(e+c)/2,y:m(p)*S.x+u(p)*S.y+(t+l)/2},X={x:(M.x-S.x)/h,y:(M.y-S.y)/y},Q=qt({x:1,y:0},X),B={x:(-M.x-S.x)/h,y:(-M.y-S.y)/y};let I=qt(X,B);!o&&I>0?I-=2*f:o&&I<0&&(I+=2*f),I%=2*f;const J=Q+I;return{center:_,startAngle:Q,endAngle:J,rx:h,ry:y}},ee=(e,t,n,r,s,i,o,c,l)=>{const{rx:a,ry:m,startAngle:u,endAngle:g}=Lt(e,t,n,r,s,i,o,c,l);return te(a,m,g-u)},Pe=(e,t,n,r,s,i,o,c,l,a)=>{let m={x:e,y:t};const{center:u,rx:g,ry:f,startAngle:h,endAngle:y}=Lt(e,t,n,r,s,i,o,c,l),x=te(g,f,y-h);if(typeof a=="number")if(a<=0)m={x:e,y:t};else if(a>=x)m={x:c,y:l};else{if(e===c&&t===l)return{x:c,y:l};if(g===0||f===0)return Gt(e,t,c,l,a);const{PI:p,cos:d,sin:C}=Math,M=y-h,w=(s%360+360)%360*(p/180),T=h+M*(a/x),P=g*d(T),$=f*C(T);m={x:d(w)*P-C(w)*$+u.x,y:C(w)*P+d(w)*$+u.y}}return m},Le=(e,t,n,r,s,i,o,c,l)=>{const{center:a,rx:m,ry:u,startAngle:g,endAngle:f}=Lt(e,t,n,r,s,i,o,c,l),h=f-g,y={x:c,y:l},[x,p]=[a.x,a.y],d=[y],C=s*Math.PI/180,M=Math.tan(C),b=Math.atan2(-u*M,m),w=b,T=b+Math.PI,P=Math.atan2(u,m*M),$=P+Math.PI,S=[e,c],_=[t,l],X=Math.min(...S),Q=Math.max(...S),B=Math.min(..._),I=Math.max(..._),J=f-h*.001,z=K(J,x,p,m,u,C),ot=f-h*.999,Y=K(ot,x,p,m,u,C);return(z.x>Q||Y.x>Q)&&d.push(K(w,x,p,m,u,C)),(z.xI||Y.y>I)&&d.push(K(P,x,p,m,u,C)),{min:{x:Math.min(...d.map(O=>O.x)),y:Math.min(...d.map(O=>O.y))},max:{x:Math.max(...d.map(O=>O.x)),y:Math.max(...d.map(O=>O.y))}}},Te={x:0,y:0},It=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Se=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],$e=e=>{const t=[];for(let n=e,r=n.length,s=r-1;r>1;r-=1,s-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const n=e.length-1;if(t===1)return e[n].t=1,e[n];const r=1-t;let s=e;if(n===0)return e[0].t=t,e[0];if(n===1)return{x:r*s[0].x+t*s[1].x,y:r*s[0].y+t*s[1].y,t};const i=r*r,o=t*t;let c=0,l=0,a=0,m=0;return n===2?(s=[s[0],s[1],s[2],Te],c=i,l=r*t*2,a=o):n===3&&(c=i*r,l=i*t*3,a=r*o*3,m=t*o),{x:c*s[0].x+l*s[1].x+a*s[2].x+m*s[3].x,y:c*s[0].y+l*s[1].y+a*s[2].y+m*s[3].y,t}},qe=(e,t)=>{const n=e(t),r=n.x*n.x+n.y*n.y;return Math.sqrt(r)},Ie=e=>{const n=It.length;let r=0;for(let s=0,i;s{const t=[];for(let r=0,s=e.length,i=2;rke(n[0],r))},Ee=1e-8,Nt=e=>{const t=Math.min(e[0],e[2]),n=Math.max(e[0],e[2]);if(e[1]>=e[0]?e[2]>=e[1]:e[2]<=e[1])return[t,n];const r=(e[0]*e[2]-e[1]*e[1])/(e[0]-2*e[1]+e[2]);return r{const t=e[0]-3*e[1]+3*e[2]-e[3];if(Math.abs(t)0&&c<1){const a=e[0]*(1-c)*(1-c)*(1-c)+e[1]*3*(1-c)*(1-c)*c+e[2]*3*(1-c)*c*c+e[3]*c*c*c;ai&&(i=a)}return[s,i]},ze=([e,t,n,r,s,i,o,c],l)=>{const a=1-l;return{x:a**3*e+3*a**2*l*n+3*a*l**2*s+l**3*o,y:a**3*t+3*a**2*l*r+3*a*l**2*i+l**3*c}},ne=(e,t,n,r,s,i,o,c)=>xt([e,t,n,r,s,i,o,c]),Ze=(e,t,n,r,s,i,o,c,l)=>{const a=typeof l=="number";let m={x:e,y:t};if(a){const u=xt([e,t,n,r,s,i,o,c]);l<=0||(l>=u?m={x:o,y:c}:m=ze([e,t,n,r,s,i,o,c],l/u))}return m},Oe=(e,t,n,r,s,i,o,c)=>{const l=Et([e,n,s,o]),a=Et([t,r,i,c]);return{min:{x:l[0],y:a[0]},max:{x:l[1],y:a[1]}}},je=([e,t,n,r,s,i],o)=>{const c=1-o;return{x:c**2*e+2*c*o*n+o**2*s,y:c**2*t+2*c*o*r+o**2*i}},se=(e,t,n,r,s,i)=>xt([e,t,n,r,s,i]),Re=(e,t,n,r,s,i,o)=>{const c=typeof o=="number";let l={x:e,y:t};if(c){const a=xt([e,t,n,r,s,i]);o<=0||(o>=a?l={x:s,y:i}:l=je([e,t,n,r,s,i],o/a))}return l},De=(e,t,n,r,s,i)=>{const o=Nt([e,n,s]),c=Nt([t,r,i]);return{min:{x:o[0],y:c[0]},max:{x:o[1],y:c[1]}}},zt=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=q(e);let n=[],r="M",s=0,i=0,o=0,c=0;const l=[],a=[];let m={x:s,y:i},u={x:s,y:i};D(t,(d,C)=>{const M=V(d,C),b=G(M,C);return[r]=b,n=[s,i,...b.slice(1)],r==="M"?([,o,c]=b,m={x:o,y:c},u={x:o,y:c}):r==="L"?{min:m,max:u}=kt(...n):r==="A"?{min:m,max:u}=Le(...n):r==="C"?{min:m,max:u}=Oe(...n):r==="Q"?{min:m,max:u}=De(...n):r==="Z"&&(n=[s,i,o,c],{min:m,max:u}=kt(...n)),l.push(m),a.push(u),r==="Z"?(s=o,i=c):([s,i]=b.slice(-2),r==="M"&&(o=s,c=i)),C.x=s,C.y=i,b});const g=Math.min(...l.map(d=>d.x)),f=Math.max(...a.map(d=>d.x)),h=Math.min(...l.map(d=>d.y)),y=Math.max(...a.map(d=>d.y)),x=f-g,p=y-h;return{width:x,height:p,x:g,y:h,x2:f,y2:y,cx:g+x/2,cy:h+p/2,cz:Math.max(x,p)+Math.min(x,p)/2}},ct=(e,t,n)=>{const r=e*Math.cos(n)-t*Math.sin(n),s=e*Math.sin(n)+t*Math.cos(n);return{x:r,y:s}},re=(e,t,n,r,s,i,o,c,l,a)=>{let m=e,u=t,g=n,f=r,h=c,y=l;const x=Math.PI*120/180,p=Math.PI/180*(+s||0);let d=[],C,M,b,w,T;if(a)[M,b,w,T]=a;else{C=ct(m,u,-p),m=C.x,u=C.y,C=ct(h,y,-p),h=C.x,y=C.y;const L=(m-h)/2,Z=(u-y)/2;let H=L*L/(g*g)+Z*Z/(f*f);H>1&&(H=Math.sqrt(H),g*=H,f*=H);const Mt=g*g,bt=f*f,St=(i===o?-1:1)*Math.sqrt(Math.abs((Mt*bt-Mt*Z*Z-bt*L*L)/(Mt*Z*Z+bt*L*L)));w=St*g*Z/f+(m+h)/2,T=St*-f*L/g+(u+y)/2,M=Math.asin(((u-T)/f*10**9>>0)/10**9),b=Math.asin(((y-T)/f*10**9>>0)/10**9),M=mb&&(M-=Math.PI*2),!o&&b>M&&(b-=Math.PI*2)}let P=b-M;if(Math.abs(P)>x){const L=b,Z=h,H=y;b=M+x*(o&&b>M?1:-1),h=w+g*Math.cos(b),y=T+f*Math.sin(b),d=re(h,y,g,f,s,0,o,Z,H,[b,L,w,T])}P=b-M;const $=Math.cos(M),S=Math.sin(M),_=Math.cos(b),X=Math.sin(b),Q=Math.tan(P/4),B=4/3*g*Q,I=4/3*f*Q,J=[m,u],z=[m+B*S,u-I*$],ot=[h+B*X,y-I*_],Y=[h,y];if(z[0]=2*J[0]-z[0],z[1]=2*J[1]-z[1],a)return[...z,...ot,...Y,...d];d=[...z,...ot,...Y,...d];const O=[];for(let L=0,Z=d.length;L{const o=.3333333333333333,c=2/3;return[o*e+c*n,o*t+c*r,o*s+c*n,o*i+c*r,s,i]},Zt=(e,t,n,r)=>{const s=R([e,t],[n,r],.3333333333333333),i=R([e,t],[n,r],2/3);return[...s,...i,n,r]},ie=(e,t)=>{const[n]=e,r=e.slice(1).map(Number),[s,i]=r;let o;const{x1:c,y1:l,x:a,y:m}=t;return"TQ".includes(n)||(t.qx=null,t.qy=null),n==="M"?(t.x=s,t.y=i,e):n==="A"?(o=[c,l,...r],["C",...re(...o)]):n==="Q"?(t.qx=s,t.qy=i,o=[c,l,...r],["C",...Qe(...o)]):n==="L"?["C",...Zt(c,l,s,i)]:n==="Z"?["C",...Zt(c,l,a,m)]:e},mt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=q(e);return D(o,(c,l,a)=>{const m=V(c,l);[i]=m;const u=i.toUpperCase(),g=G(m,l);let f=ie(g,l);return f[0]==="C"&&f.length>7&&(o.splice(a+1,0,["C",...f.slice(7)]),f=f.slice(0,7)),u==="Z"?(t=r,n=s):([t,n]=f.slice(-2),u==="M"&&(r=t,s=n)),l.x=t,l.y=n,f})},Xe=(e,t,n,r,s,i,o,c)=>3*((c-t)*(n+s)-(o-e)*(r+i)+r*(e-s)-n*(t-i)+c*(s+e/3)-o*(i+t/3))/20,oe=e=>{let t=0,n=0,r=0;return mt(e).map(s=>{switch(s[0]){case"M":return[,t,n]=s,0;default:return r=Xe(t,n,...s.slice(1)),[t,n]=s.slice(-2),r}}).reduce((s,i)=>s+i,0)},W=e=>{const t=q(e);let n=!1,r=[],s="M",i=0,o=0,c=0,l=0,a=0;return D(t,(m,u)=>{const g=V(m,u),f=G(g,u);return[s]=f,n=s==="M",r=n?r:[i,o,...f.slice(1)],n?[,c,l]=m:s==="L"?a+=at(...r):s==="A"?a+=ee(...r):s==="C"?a+=ne(...r):s==="Q"?a+=se(...r):s==="Z"&&(r=[i,o,c,l],a+=at(...r)),s==="Z"?(i=c,o=l):([i,o]=f.slice(-2),n&&(c=i,l=o)),u.x=i,u.y=o,f}),a},Be=e=>oe(mt(e))>=0,At=1e-5,nt=(e,t)=>{const n=q(e);let r=!1,s=[],i="M",o=0,c=0,[l,a]=n[0].slice(1);const m=typeof t=="number";let u={x:l,y:a},g=0,f=u,h=0;return m?(t{const p=V(y,x),d=G(p,x);return[i]=d,r=i==="M",s=r?s:[o,c,...d.slice(1)],r?([,l,a]=y,u={x:l,y:a},g=0):i==="L"?(u=Gt(...s,t-h),g=at(...s)):i==="A"?(u=Pe(...s,t-h),g=ee(...s)):i==="C"?(u=Ze(...s,t-h),g=ne(...s)):i==="Q"?(u=Re(...s,t-h),g=se(...s)):i==="Z"&&(s=[o,c,l,a],u={x:l,y:a},g=at(...s)),h=t&&(f=u),h+=g,i==="Z"?(o=l,c=a):([o,c]=d.slice(-2),i==="M"&&(l=o,a=c)),x.x=o,x.y=c,d}),t>h-At&&(f={x:o,y:c}),f):u},Tt=(e,t)=>{const n=q(e);let r=n.slice(0),s=W(r),i=r.length-1,o=0,c=0,l=n[0];const[a,m]=l.slice(-2),u={x:a,y:m};if(i<=0||!t||!Number.isFinite(t))return{segment:l,index:0,length:c,point:u,lengthAtSegment:o};if(t>=s)return r=n.slice(0,-1),o=W(r),c=s-o,{segment:n[i],index:i,length:c,lengthAtSegment:o};const g=[];for(;i>0;)l=r[i],r=r.slice(0,-1),o=W(r),c=s-o,s=o,g.push({segment:l,index:i,length:c,lengthAtSegment:o}),i-=1;return g.find(({lengthAtSegment:f})=>f<=t)},rt=e=>{let t=0,n=0,r=0,s=0,i="M";return D(q(e),(o,c)=>{const l=V(o,c),a=G(l,c);[i]=a;const m=i.toUpperCase();return m==="Z"?(t=r,n=s):([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),c.x=t,c.y=n,a})},pt=(e,t)=>{const n=q(e),r=rt(n),s=W(n),i=M=>{const b=M.x-t.x,w=M.y-t.y;return b*b+w*w};let o=8,c,l={x:0,y:0},a=0,m=0,u=1/0;for(let M=0;M<=s;M+=o)c=nt(r,M),a=i(c),a1e-6&&(h=m-o,g=nt(r,h),x=i(g),y=m+o,f=nt(r,y),p=i(f),h>=0&&xpt(e,t).closest,He=(e,t)=>pt(e,t).segment,Fe=(e,t)=>Tt(e,t).segment,Ue=(e,t)=>{const{distance:n}=pt(e,t);return Math.abs(n){if(typeof e!="string"||!e.length)return!1;const t=new Xt(e);for(et(t);t.indexArray.isArray(e)&&e.every(t=>{const n=t[0].toLowerCase();return tt[n]===t.length-1&&"achlmqstvz".includes(n)&&t.slice(1).every(Number.isFinite)})&&e.length>0,le=e=>dt(e)&&e.every(([t])=>t===t.toUpperCase()),Ve=e=>dt(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),ae=e=>le(e)&&e.every(([t])=>"ACLMQZ".includes(t)),_e=e=>ae(e)&&e.every(([t])=>"MC".includes(t)),ut={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]},Je=e=>{let{x1:t,y1:n,x2:r,y2:s}=e;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t,n],["L",r,s]]},Ke=e=>{const t=[],n=(e.points||"").trim().split(/[\s|,]/).map(s=>+s);let r=0;for(;r{let{cx:t,cy:n,r}=e;return[t,n,r]=[t,n,r].map(s=>+s),[["M",t-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},Ge=e=>{let{cx:t,cy:n}=e,r=e.rx||0,s=e.ry||r;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]},tn=e=>{const t=+e.x||0,n=+e.y||0,r=+e.width,s=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>s&&(o-=(o*2-s)/2),[["M",t+i,n],["h",r-i*2],["s",i,0,i,o],["v",s-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-s+o*2],["s",0,-o,i,-o]]):[["M",t,n],["h",r],["v",s],["H",t],["Z"]]},me=(e,t)=>{const r=(t||document).defaultView||window,s=Object.keys(ut),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...s,"path"].every(u=>o!==u))throw TypeError(`${E}: "${o}" is not SVGElement`);const c=i?o:e.type,l=ut[c],a={type:c};i?l.forEach(u=>{a[u]=e.getAttribute(u)}):Object.assign(a,e);let m=[];return c==="circle"?m=We(a):c==="ellipse"?m=Ge(a):["polyline","polygon"].includes(c)?m=Ke(a):c==="rect"?m=tn(a):c==="line"?m=Je(a):["glyph","path"].includes(c)&&(m=q(i?e.getAttribute("d")||"":e.d||"")),dt(m)&&m.length?m:!1},ht=(e,t)=>{let{round:n}=st;if(t==="off"||n==="off")return e.slice(0);n=typeof t=="number"&&t>=0?t:n;const r=typeof n=="number"&&n>=1?10**n:1;return D(e,s=>{const i=s.slice(1).map(o=>n?Math.round(o*r)/r:Math.round(o));return[s[0],...i]})},Ct=(e,t)=>ht(e,t).map(n=>n[0]+n.slice(1).join(" ")).join(""),en=(e,t,n)=>{const r=n||document,s=r.defaultView||window,i=Object.keys(ut),o=e instanceof s.SVGElement,c=o?e.tagName:null;if(c==="path")throw TypeError(`${E}: "${c}" is already SVGPathElement`);if(c&&i.every(y=>c!==y))throw TypeError(`${E}: "${c}" is not SVGElement`);const l=r.createElementNS("http://www.w3.org/2000/svg","path"),a=o?c:e.type,m=ut[a],u={type:a},g=st.round,f=me(e,r),h=f&&f.length?Ct(f,g):"";return o?(m.forEach(y=>{u[y]=e.getAttribute(y)}),Object.values(e.attributes).forEach(({name:y,value:x})=>{m.includes(y)||l.setAttribute(y,x)})):(Object.assign(u,e),Object.keys(u).forEach(y=>{!m.includes(y)&&y!=="type"&&l.setAttribute(y.replace(/[A-Z]/g,x=>`-${x.toLowerCase()}`),u[y])})),ce(h)?(l.setAttribute("d",h),t&&o&&(e.before(l,e),e.remove()),l):!1},Ot=e=>{const t=[];let n,r=-1,s=0,i=0,o=0,c=0;const l={...gt};return e.forEach(a=>{const[m]=a,u=m.toUpperCase(),g=m.toLowerCase(),f=m===g,h=a.slice(1);u==="M"?(r+=1,[s,i]=h,s+=f?l.x:0,i+=f?l.y:0,o=s,c=i,n=[f?[u,o,c]:a]):(u==="Z"?(s=o,i=c):u==="H"?([,s]=a,s+=f?l.x:0):u==="V"?([,i]=a,i+=f?l.y:0):([s,i]=a.slice(-2),s+=f?l.x:0,i+=f?l.y:0),n.push(a)),l.x=s,l.y=i,t[r]=n}),t},ue=e=>{let t=new v;const{origin:n}=e,[r,s]=n,{translate:i}=e,{rotate:o}=e,{skew:c}=e,{scale:l}=e;return Array.isArray(i)&&i.length>=2&&i.every(a=>!Number.isNaN(+a))&&i.some(a=>a!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||c||l)&&(t=t.translate(r,s),Array.isArray(o)&&o.length>=2&&o.every(a=>!Number.isNaN(+a))&&o.some(a=>a!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(c)&&c.length===2&&c.every(a=>!Number.isNaN(+a))&&c.some(a=>a!==0)?(t=c[0]?t.skewX(c[0]):t,t=c[1]?t.skewY(c[1]):t):typeof c=="number"&&!Number.isNaN(c)&&(t=t.skewX(c)),Array.isArray(l)&&l.length>=2&&l.every(a=>!Number.isNaN(+a))&&l.some(a=>a!==1)?t=t.scale(...l):typeof l=="number"&&!Number.isNaN(l)&&(t=t.scale(l)),t=t.translate(-r,-s)),t},ft=e=>{let t=0,n=0,r=0,s=0,i="M";const o=q(e);return D(o,(c,l)=>{[i]=c;const a=V(c,l),m=i.toUpperCase();return m==="Z"?(t=r,n=s):m==="H"?[,t]=a:m==="V"?[,n]=a:([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),l.x=t,l.y=n,a})},nn=(e,t,n)=>{const[r]=e,{x:s,y:i}=t,o=e.slice(1).map(Number),c=r.toLowerCase();if(n===0&&r==="M")return e;if(r!==c){if(c==="a")return[c,o[0],o[1],o[2],o[3],o[4],o[5]-s,o[6]-i];if(c==="v")return[c,o[0]-i];if(c==="h")return[c,o[0]-s];{const l=o.map((a,m)=>a-(m%2?i:s));return[c,...l]}}return e},vt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=q(e);return D(o,(c,l,a)=>{[i]=c;const m=nn(c,l,a),[u]=m,g=i.toUpperCase(),f=i.toLowerCase(),h=u===f;return g==="Z"?(t=r,n=s):g==="H"?([,t]=m,t+=h?l.x:0):g==="V"?([,n]=m,n+=h?l.y:0):([t,n]=m.slice(-2),t+=h?l.x:0,n+=h?l.y:0,g==="M"&&(r=t,s=n)),l.x=t,l.y=n,m})},sn=(e,t,n,r)=>{const[s]=e,i=p=>Math.round(p*10**4)/10**4,o=e.slice(1),c=t.slice(1),{x1:l,y1:a,x2:m,y2:u,x:g,y:f}=n;let h=e;const[y,x]=c.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))h=[s,...o];else if(s==="L")i(g)===i(y)?h=["V",x]:i(f)===i(x)&&(h=["H",y]);else if(s==="C"){const[p,d]=c;"CS".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["S",...c.slice(-4)]),n.x1=p,n.y1=d}else if(s==="Q"){const[p,d]=c;n.qx=p,n.qy=d,"QT".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["T",...c.slice(-2)])}return h},jt=(e,t)=>{const n=ft(e),r=rt(n),s={...gt},i=[],o=n.length;let c="",l="",a=0,m=0,u=0,g=0;for(let y=0;yx?y.join("").length{const t=e.slice(1).map((n,r,s)=>r?[...s[r-1].slice(-2),...n.slice(1)]:[...e[0].slice(1),...n.slice(1)]).map(n=>n.map((r,s)=>n[n.length-s-2*(1-s%2)])).reverse();return[["M",...t[0].slice(0,2)],...t.map(n=>["C",...n.slice(2)])]},lt=e=>{const t=ft(e),n=t.slice(-1)[0][0]==="Z",r=rt(t).map((s,i)=>{const[o,c]=s.slice(-2).map(Number);return{seg:t[i],n:s,c:t[i][0],x:o,y:c}}).map((s,i,o)=>{const c=s.seg,l=s.n,a=i&&o[i-1],m=o[i+1],u=s.c,g=o.length,f=i?o[i-1].x:o[g-1].x,h=i?o[i-1].y:o[g-1].y;let y=[];switch(u){case"M":y=n?["Z"]:[u,f,h];break;case"A":y=[u,...c.slice(1,-3),c[5]===1?0:1,f,h];break;case"C":m&&m.c==="S"?y=["S",c[1],c[2],f,h]:y=[u,c[3],c[4],c[1],c[2],f,h];break;case"S":a&&"CS".includes(a.c)&&(!m||m.c!=="S")?y=["C",l[3],l[4],l[1],l[2],f,h]:y=[u,l[1],l[2],f,h];break;case"Q":m&&m.c==="T"?y=["T",f,h]:y=[u,...c.slice(1,-2),f,h];break;case"T":a&&"QT".includes(a.c)&&(!m||m.c!=="T")?y=["Q",l[1],l[2],f,h]:y=[u,f,h];break;case"Z":y=["M",f,h];break;case"H":y=[u,f];break;case"V":y=[u,h];break;default:y=[u,...c.slice(1,-2),f,h]}return y});return n?r.reverse():[r[0],...r.slice(1).reverse()]},on=(e,t)=>{let n=v.Translate(...t.slice(0,-1));return[,,,n.m44]=t,n=e.multiply(n),[n.m41,n.m42,n.m43,n.m44]},Rt=(e,t,n)=>{const[r,s,i]=n,[o,c,l]=on(e,[...t,0,1]),a=o-r,m=c-s,u=l-i;return[a*(Math.abs(i)/Math.abs(u)||1)+r,m*(Math.abs(i)/Math.abs(u)||1)+s]},Dt=(e,t)=>{let n=0,r=0,s=0,i=0,o=0,c=0,l=0,a=0,m=0,u=0,g="M";const f={...gt},h=q(e),y=t&&Object.keys(t);if(!t||y&&!y.length)return h;t.origin||Object.assign(t,{origin:st.origin});const x=t.origin,p=ue(t);return p.isIdentity?h:D(h,(d,C,M)=>{const b=V(d,f);[g]=b;let w=g==="A"?ie(b,f):["V","H"].includes(g)?G(b,f):b;const T=w[0]==="C"&&w.length>7,P=T?w.slice(0,7):w.slice(0);if(T&&(h.splice(M+1,0,["C",...w.slice(7)]),w=w.slice(0,7)),w[0]==="L"){const S=w.slice(-2);[o,c]=Rt(p,S,x),n!==o&&r!==c?w=["L",o,c]:r===c?w=["H",o]:n===o&&(w=["V",c])}else for(l=1,a=w.length;l{const n=t,r=e.slice(0,2),s=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),c=R(r,s,n),l=R(s,i,n),a=R(i,o,n),m=R(c,l,n),u=R(l,a,n),g=R(m,u,n);return[["C",...c,...m,...g],["C",...u,...a,...o]]};class A{constructor(t,n){const r=n||{},s=typeof t>"u";if(s||!t.length)throw TypeError(`${E}: "pathValue" is ${s?"undefined":"empty"}`);const i=q(t);this.segments=i;const{round:o,origin:c}=r;let l;Number.isInteger(o)||o==="off"?l=o:l=st.round;let a=st.origin;if(Array.isArray(c)&&c.length>=2){const[m,u,g]=c.map(Number);a=[Number.isNaN(m)?0:m,Number.isNaN(u)?0:u,Number.isNaN(g)?0:g]}return this.round=l,this.origin=a,this}get bbox(){return zt(this.segments)}get length(){return W(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return nt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=ft(t),this}toRelative(){const{segments:t}=this;return this.segments=vt(t),this}toCurve(){const{segments:t}=this;return this.segments=mt(t),this}reverse(t){this.toAbsolute();const{segments:n}=this,r=Ot(n),s=r.length>1?r:!1,i=s?s.map((c,l)=>t?l?lt(c):c.slice(0):lt(c)):n.slice(0);let o=[];return s?o=i.flat(1):o=t?n:lt(n),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=rt(t),this}optimize(){const{segments:t}=this;return this.segments=jt(t,this.round),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(l=>l in t))return this;const{segments:n,origin:[r,s,i]}=this,o={};for(const[l,a]of Object.entries(t))l==="skew"&&Array.isArray(a)||(l==="rotate"||l==="translate"||l==="origin"||l==="scale")&&Array.isArray(a)?o[l]=a.map(Number):l!=="origin"&&typeof Number(a)=="number"&&(o[l]=Number(a));const{origin:c}=o;if(Array.isArray(c)&&c.length>=2){const[l,a,m]=c.map(Number);o.origin=[Number.isNaN(l)?r:l,Number.isNaN(a)?s:a,m||i]}else o.origin=[r,s,i];return this.segments=Dt(n,o),this}flipX(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,n,0]}),this}flipY(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,n,0]}),this}toString(){return Ct(this.segments,this.round)}}N(A,"CSSMatrix",v),N(A,"getSVGMatrix",ue),N(A,"getPathBBox",zt),N(A,"getPathArea",oe),N(A,"getTotalLength",W),N(A,"getDrawDirection",Be),N(A,"getPointAtLength",nt),N(A,"getPropertiesAtLength",Tt),N(A,"getPropertiesAtPoint",pt),N(A,"polygonLength",Ne),N(A,"polygonArea",we),N(A,"getClosestPoint",Ye),N(A,"getSegmentOfPoint",He),N(A,"getSegmentAtLength",Fe),N(A,"isPointInStroke",Ue),N(A,"isValidPath",ce),N(A,"isPathArray",dt),N(A,"isAbsoluteArray",le),N(A,"isRelativeArray",Ve),N(A,"isCurveArray",_e),N(A,"isNormalizedArray",ae),N(A,"shapeToPath",en),N(A,"shapeToPathArray",me),N(A,"parsePathString",q),N(A,"roundPath",ht),N(A,"splitPath",Ot),N(A,"splitCubic",cn),N(A,"optimizePath",jt),N(A,"reverseCurve",rn),N(A,"reversePath",lt),N(A,"normalizePath",rt),N(A,"transformPath",Dt),N(A,"pathToAbsolute",ft),N(A,"pathToRelative",vt),N(A,"pathToCurve",mt),N(A,"pathToString",Ct);module.exports=A; +"use strict";var Se=Object.defineProperty;var De=(e,t,s)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var g=(e,t,s)=>De(e,typeof t!="symbol"?t+"":t,s);var Ze=Object.defineProperty,Oe=(e,t,s)=>t in e?Ze(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,q=(e,t,s)=>Oe(e,typeof t!="symbol"?t+"":t,s);const Qe={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},Vt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),Gt=e=>e instanceof DOMMatrix||e instanceof C||typeof e=="object"&&Object.keys(Qe).every(t=>e&&t in e),ht=e=>{const t=new C,s=Array.from(e);if(!Vt(s))throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`);if(s.length===16){const[r,n,i,o,a,c,l,u,m,f,y,h,x,b,A,w]=s;t.m11=r,t.a=r,t.m21=a,t.c=a,t.m31=m,t.m41=x,t.e=x,t.m12=n,t.b=n,t.m22=c,t.d=c,t.m32=f,t.m42=b,t.f=b,t.m13=i,t.m23=l,t.m33=y,t.m43=A,t.m14=o,t.m24=u,t.m34=h,t.m44=w}else if(s.length===6){const[r,n,i,o,a,c]=s;t.m11=r,t.a=r,t.m12=n,t.b=n,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=a,t.e=a,t.m42=c,t.f=c}return t},te=e=>{if(Gt(e))return ht([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},ee=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let s=new C;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(n=>n).forEach(n=>{const[i,o]=n.split("(");if(!o)throw TypeError(r);const a=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[c,l,u,m]=a,f=[c,l,u],y=[c,l,u,m];if(i==="perspective"&&c&&[l,u].every(h=>h===void 0))s.m34=-1/c;else if(i.includes("matrix")&&[6,16].includes(a.length)&&a.every(h=>!Number.isNaN(+h))){const h=a.map(x=>Math.abs(x)<1e-6?0:x);s=s.multiply(ht(h))}else if(i==="translate3d"&&f.every(h=>!Number.isNaN(+h)))s=s.translate(c,l,u);else if(i==="translate"&&c&&u===void 0)s=s.translate(c,l||0,0);else if(i==="rotate3d"&&y.every(h=>!Number.isNaN(+h))&&m)s=s.rotateAxisAngle(c,l,u,m);else if(i==="rotate"&&c&&[l,u].every(h=>h===void 0))s=s.rotate(0,0,c);else if(i==="scale3d"&&f.every(h=>!Number.isNaN(+h))&&f.some(h=>h!==1))s=s.scale(c,l,u);else if(i==="scale"&&!Number.isNaN(c)&&c!==1&&u===void 0){const h=Number.isNaN(+l)?c:l;s=s.scale(c,h,1)}else if(i==="skew"&&(c||!Number.isNaN(c)&&l)&&u===void 0)s=s.skew(c,l||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&c&&[l,u].every(h=>h===void 0))if(i==="skewX"||i==="skewY")s=s[i](c);else{const h=i.replace(/[XYZ]/,""),x=i.replace(h,""),b=["X","Y","Z"].indexOf(x),A=h==="scale"?1:0,w=[b===0?c:A,b===1?c:A,b===2?c:A];s=s[h](...w)}else throw TypeError(r)}),s},vt=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],ne=(e,t,s)=>{const r=new C;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=s,r},se=(e,t,s)=>{const r=new C,n=Math.PI/180,i=e*n,o=t*n,a=s*n,c=Math.cos(i),l=-Math.sin(i),u=Math.cos(o),m=-Math.sin(o),f=Math.cos(a),y=-Math.sin(a),h=u*f,x=-u*y;r.m11=h,r.a=h,r.m12=x,r.b=x,r.m13=m;const b=l*m*f+c*y;r.m21=b,r.c=b;const A=c*f-l*m*y;return r.m22=A,r.d=A,r.m23=-l*u,r.m31=l*y-c*m*f,r.m32=l*f+c*m*y,r.m33=c*u,r},re=(e,t,s,r)=>{const n=new C,i=Math.sqrt(e*e+t*t+s*s);if(i===0)return n;const o=e/i,a=t/i,c=s/i,l=r*(Math.PI/360),u=Math.sin(l),m=Math.cos(l),f=u*u,y=o*o,h=a*a,x=c*c,b=1-2*(h+x)*f;n.m11=b,n.a=b;const A=2*(o*a*f+c*u*m);n.m12=A,n.b=A,n.m13=2*(o*c*f-a*u*m);const w=2*(a*o*f-c*u*m);n.m21=w,n.c=w;const N=1-2*(x+y)*f;return n.m22=N,n.d=N,n.m23=2*(a*c*f+o*u*m),n.m31=2*(c*o*f+a*u*m),n.m32=2*(c*a*f-o*u*m),n.m33=1-2*(y+h)*f,n},ie=(e,t,s)=>{const r=new C;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=s,r},At=(e,t)=>{const s=new C;if(e){const r=e*Math.PI/180,n=Math.tan(r);s.m21=n,s.c=n}if(t){const r=t*Math.PI/180,n=Math.tan(r);s.m12=n,s.b=n}return s},oe=e=>At(e,0),ce=e=>At(0,e),B=(e,t)=>{const s=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,n=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,a=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,c=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,l=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,u=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,m=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,f=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,y=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,x=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,b=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,A=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return ht([s,r,n,i,o,a,c,l,u,m,f,y,h,x,b,A])};class C{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?ee(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?ht(t):typeof t=="object"?te(t):this}toFloat32Array(t){return Float32Array.from(vt(this,t))}toFloat64Array(t){return Float64Array.from(vt(this,t))}toString(){const{is2D:t}=this,s=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${s})`}toJSON(){const{is2D:t,isIdentity:s}=this;return{...this,is2D:t,isIdentity:s}}multiply(t){return B(this,t)}translate(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),B(this,ne(n,i,o))}scale(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),B(this,ie(n,i,o))}rotate(t,s,r){let n=t,i=s||0,o=r||0;return typeof t=="number"&&typeof s>"u"&&typeof r>"u"&&(o=n,n=0,i=0),B(this,se(n,i,o))}rotateAxisAngle(t,s,r,n){if([t,s,r,n].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return B(this,re(t,s,r,n))}skewX(t){return B(this,oe(t))}skewY(t){return B(this,ce(t))}skew(t,s){return B(this,At(t,s))}transformPoint(t){const s=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,n=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(s,r,n,i):{x:s,y:r,z:n,w:i}}}q(C,"Translate",ne),q(C,"Rotate",se),q(C,"RotateAxisAngle",re),q(C,"Scale",ie),q(C,"SkewX",oe),q(C,"SkewY",ce),q(C,"Skew",At),q(C,"Multiply",B),q(C,"fromArray",ht),q(C,"fromMatrix",te),q(C,"fromString",ee),q(C,"toArray",vt),q(C,"isCompatibleArray",Vt),q(C,"isCompatibleObject",Gt);const V={origin:[0,0,0],round:4},nt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},Tt=e=>{let t=e.pathValue[e.segmentStart],s=t.toLowerCase();const{data:r}=e;for(;r.length>=nt[s]&&(s==="m"&&r.length>2?(e.segments.push([t].concat(r.splice(0,2))),s="l",t=t==="m"?"l":"L"):e.segments.push([t].concat(r.splice(0,nt[s]))),!!nt[s]););},E="SVGPathCommander Error",ae=e=>{const{index:t,pathValue:s}=e,r=s.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${E}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`},H=e=>e>=48&&e<=57,U="Invalid path value",le=e=>{const{max:t,pathValue:s,index:r}=e;let n=r,i=!1,o=!1,a=!1,c=!1,l;if(n>=t){e.err=`${E}: ${U} at index ${n}, "pathValue" is missing param`;return}if(l=s.charCodeAt(n),(l===43||l===45)&&(n+=1,l=s.charCodeAt(n)),!H(l)&&l!==46){e.err=`${E}: ${U} at index ${n}, "${s[n]}" is not a number`;return}if(l!==46){if(i=l===48,n+=1,l=s.charCodeAt(n),i&&n[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),st=e=>{const{pathValue:t,max:s}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},he=e=>H(e)||e===43||e===45||e===46,fe=e=>(e|32)===97,ye=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},Et=e=>{var c;const{max:t,pathValue:s,index:r,segments:n}=e,i=s.charCodeAt(r),o=nt[s[r].toLowerCase()];if(e.segmentStart=r,!me(i)){e.err=`${E}: ${U} "${s[r]}" is not a path command at index ${r}`;return}const a=n[n.length-1];if(!ye(i)&&((c=a==null?void 0:a[0])==null?void 0:c.toLocaleLowerCase())==="z"){e.err=`${E}: ${U} "${s[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,st(e),e.data=[],!o){Tt(e);return}for(;;){for(let l=o;l>0;l-=1){if(fe(i)&&(l===3||l===4)?ae(e):le(e),e.err.length)return;e.data.push(e.param),st(e),e.index=e.max||!he(s.charCodeAt(e.index)))break}Tt(e)};class Rt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const R=e=>{if(typeof e!="string")return e.slice(0);const t=new Rt(e);for(st(t);t.index{const[n]=e,i=n.toUpperCase();if(t===0||i===n)return e;if(i==="A")return[i,e[1],e[2],e[3],e[4],e[5],e[6]+s,e[7]+r];if(i==="V")return[i,e[1]+r];if(i==="H")return[i,e[1]+s];if(i==="L")return[i,e[1]+s,e[2]+r];{const a=e.slice(1).map((c,l)=>c+(l%2?r:s));return[i].concat(a)}},j=(e,t)=>{let s=e.length,r,n="M",i="M",o=!1,a=0,c=0,l=0,u=0,m=0;for(let f=0;f{const t=R(e);return j(t,jt)},St=(e,t,s,r)=>{const[n]=e,i=n.toLowerCase();if(t===0||n===i)return e;if(i==="a")return[i,e[1],e[2],e[3],e[4],e[5],e[6]-s,e[7]-r];if(i==="v")return[i,e[1]-r];if(i==="h")return[i,e[1]-s];if(i==="l")return[i,e[1]-s,e[2]-r];{const a=e.slice(1).map((c,l)=>c-(l%2?r:s));return[i].concat(a)}},Xt=e=>{const t=R(e);return j(t,St)},ct=(e,t,s)=>{const{sin:r,cos:n}=Math,i=e*n(s)-t*r(s),o=e*r(s)+t*n(s);return{x:i,y:o}},Dt=(e,t,s,r,n,i,o,a,c,l)=>{let u=e,m=t,f=s,y=r,h=a,x=c;const b=Math.PI*120/180,A=Math.PI/180*(+n||0);let w=[],N,M,d,v,L;if(l)[M,d,v,L]=l;else{N=ct(u,m,-A),u=N.x,m=N.y,N=ct(h,x,-A),h=N.x,x=N.y;const $=(u-h)/2,P=(m-x)/2;let Q=$*$/(f*f)+P*P/(y*y);Q>1&&(Q=Math.sqrt(Q),f*=Q,y*=Q);const F=f*f,D=y*y,Ut=(i===o?-1:1)*Math.sqrt(Math.abs((F*D-F*P*P-D*$*$)/(F*P*P+D*$*$)));v=Ut*f*P/y+(u+h)/2,L=Ut*-y*$/f+(m+x)/2,M=Math.asin(((m-L)/y*10**9>>0)/10**9),d=Math.asin(((x-L)/y*10**9>>0)/10**9),M=ud&&(M-=Math.PI*2),!o&&d>M&&(d-=Math.PI*2)}let T=d-M;if(Math.abs(T)>b){const $=d,P=h,Q=x;d=M+b*(o&&d>M?1:-1),h=v+f*Math.cos(d),x=L+y*Math.sin(d),w=Dt(h,x,f,y,n,0,o,P,Q,[d,$,v,L])}T=d-M;const Z=Math.cos(M),k=Math.sin(M),it=Math.cos(d),tt=Math.sin(d),_=Math.tan(T/4),et=4/3*f*_,I=4/3*y*_,J=[u,m],S=[u+et*k,m-I*Z],Y=[h+et*tt,x-I*it],K=[h,x];if(S[0]=2*J[0]-S[0],S[1]=2*J[1]-S[1],l)return[S[0],S[1],Y[0],Y[1],K[0],K[1]].concat(w);w=[S[0],S[1],Y[0],Y[1],K[0],K[1]].concat(w);const ot=[];for(let $=0,P=w.length;${const o=.3333333333333333,a=2/3;return[o*e+a*s,o*t+a*r,o*n+a*s,o*i+a*r,n,i]},O=(e,t,s)=>{const[r,n]=e,[i,o]=t;return[r+(i-r)*s,n+(o-n)*s]},Ct=(e,t,s,r)=>{const n=O([e,t],[s,r],.3333333333333333),i=O([e,t],[s,r],2/3);return[n[0],n[1],i[0],i[1],s,r]},Zt=(e,t)=>{const[s]=e,r=e.slice(1).map(Number),[n,i]=r,{x1:o,y1:a,x:c,y:l}=t;return"TQ".includes(s)||(t.qx=null,t.qy=null),s==="M"?(t.x=n,t.y=i,e):s==="A"?["C"].concat(Dt(o,a,r[0],r[1],r[2],r[3],r[4],r[5],r[6])):s==="Q"?(t.qx=n,t.qy=i,["C"].concat(xe(o,a,r[0],r[1],r[2],r[3]))):s==="L"?["C"].concat(Ct(o,a,n,i)):s==="Z"?["C"].concat(Ct(o,a,c,l)):e},G=(e,t)=>{const[s]=e,r=s.toUpperCase(),n=s!==r,{x1:i,y1:o,x2:a,y2:c,x:l,y:u}=t,m=e.slice(1);let f=m.map((y,h)=>y+(n?h%2?u:l:0));if("TQ".includes(r)||(t.qx=null,t.qy=null),r==="A")return f=m.slice(0,-2).concat(m[5]+(n?l:0),m[6]+(n?u:0)),["A"].concat(f);if(r==="H")return["L",e[1]+(n?l:0),o];if(r==="V")return["L",i,e[1]+(n?u:0)];if(r==="L")return["L",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="M")return["M",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="C")return["C"].concat(f);if(r==="S"){const y=i*2-a,h=o*2-c;return t.x1=y,t.y1=h,["C",y,h].concat(f)}else if(r==="T"){const y=i*2-(t.qx?t.qx:0),h=o*2-(t.qy?t.qy:0);return t.qx=y,t.qy=h,["Q",y,h].concat(f)}else if(r==="Q"){const[y,h]=f;return t.qx=y,t.qy=h,["Q"].concat(f)}else if(r==="Z")return["Z"];return e},X={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},gt=e=>{const t={...X},s=R(e);return j(s,(r,n,i,o)=>{t.x=i,t.y=o;const a=G(r,t);let c=Zt(a,t);c[0]==="C"&&c.length>7&&(s.splice(n+1,0,["C"].concat(c.slice(7))),c=c.slice(0,7));const u=c.length;return t.x1=+c[u-2],t.y1=+c[u-1],t.x2=+c[u-4]||t.x1,t.y2=+c[u-3]||t.y1,c})},z=(e,t)=>{const s=t>=1?10**t:1;return t>0?Math.round(e*s)/s:Math.round(e)},$t=(e,t)=>{const s=e.length;let{round:r}=V,n=e[0],i="";r=t==="off"||typeof t=="number"&&t>=0?t:typeof r=="number"&&r>=0?r:"off";for(let o=0;oMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),lt=(e,t,s,r)=>Mt([e,t],[s,r]),Ot=(e,t,s,r,n)=>{let i={x:e,y:t};if(typeof n=="number"){const o=Mt([e,t],[s,r]);if(n<=0)i={x:e,y:t};else if(n>=o)i={x:s,y:r};else{const[a,c]=O([e,t],[s,r],n/o);i={x:a,y:c}}}return i},zt=(e,t,s,r)=>{const{min:n,max:i}=Math;return{min:{x:n(e,s),y:n(t,r)},max:{x:i(e,s),y:i(t,r)}}},Qt=(e,t,s)=>{const r=s/2,n=Math.sin(r),i=Math.cos(r),o=e**2*n**2,a=t**2*i**2,c=Math.sqrt(o+a)*s;return Math.abs(c)},W=(e,t,s,r,n,i)=>{const{sin:o,cos:a}=Math,c=a(n),l=o(n),u=s*a(i),m=r*o(i);return{x:e+c*u-l*m,y:t+l*u+c*m}},Pt=(e,t)=>{const{x:s,y:r}=e,{x:n,y:i}=t,o=s*n+r*i,a=Math.sqrt((s**2+r**2)*(n**2+i**2));return(s*i-r*n<0?-1:1)*Math.acos(o/a)},wt=(e,t,s,r,n,i,o,a,c)=>{const{abs:l,sin:u,cos:m,sqrt:f,PI:y}=Math;let h=l(s),x=l(r);const A=(n%360+360)%360*(y/180);if(e===a&&t===c)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:a,y:c}};if(h===0||x===0)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:(a+e)/2,y:(c+t)/2}};const w=(e-a)/2,N=(t-c)/2,M={x:m(A)*w+u(A)*N,y:-u(A)*w+m(A)*N},d=M.x**2/h**2+M.y**2/x**2;d>1&&(h*=f(d),x*=f(d));const v=h**2*x**2-h**2*M.y**2-x**2*M.x**2,L=h**2*M.y**2+x**2*M.x**2;let T=v/L;T=T<0?0:T;const Z=(i!==o?1:-1)*f(T),k={x:Z*(h*M.y/x),y:Z*(-(x*M.x)/h)},it={x:m(A)*k.x-u(A)*k.y+(e+a)/2,y:u(A)*k.x+m(A)*k.y+(t+c)/2},tt={x:(M.x-k.x)/h,y:(M.y-k.y)/x},_=Pt({x:1,y:0},tt),et={x:(-M.x-k.x)/h,y:(-M.y-k.y)/x};let I=Pt(tt,et);!o&&I>0?I-=2*y:o&&I<0&&(I+=2*y),I%=2*y;const J=_+I;return{center:it,startAngle:_,endAngle:J,rx:h,ry:x}},Bt=(e,t,s,r,n,i,o,a,c)=>{const{rx:l,ry:u,startAngle:m,endAngle:f}=wt(e,t,s,r,n,i,o,a,c);return Qt(l,u,f-m)},ge=(e,t,s,r,n,i,o,a,c,l)=>{let u={x:e,y:t};const{center:m,rx:f,ry:y,startAngle:h,endAngle:x}=wt(e,t,s,r,n,i,o,a,c);if(typeof l=="number"){const b=Qt(f,y,x-h);if(l<=0)u={x:e,y:t};else if(l>=b)u={x:a,y:c};else{if(e===a&&t===c)return{x:a,y:c};if(f===0||y===0)return Ot(e,t,a,c,l);const{PI:A,cos:w,sin:N}=Math,M=x-h,v=(n%360+360)%360*(A/180),L=h+M*(l/b),T=f*w(L),Z=y*N(L);u={x:w(v)*T-N(v)*Z+m.x,y:N(v)*T+w(v)*Z+m.y}}}return u},pe=(e,t,s,r,n,i,o,a,c)=>{const{center:l,rx:u,ry:m,startAngle:f,endAngle:y}=wt(e,t,s,r,n,i,o,a,c),h=y-f,{min:x,max:b,tan:A,atan2:w,PI:N}=Math,M={x:a,y:c},{x:d,y:v}=l,L=[M],T=n*N/180,Z=A(T),k=w(-m*Z,u),it=k,tt=k+N,_=w(m,u*Z),et=_+N,I=[e,a],J=[t,c],S=x(...I),Y=b(...I),K=x(...J),ot=b(...J),$=y-h*.001,P=W(d,v,u,m,T,$),Q=y-h*.999,F=W(d,v,u,m,T,Q);return(P.x>Y||F.x>Y)&&L.push(W(d,v,u,m,T,it)),(P.xot||F.y>ot)&&L.push(W(d,v,u,m,T,_)),{min:{x:x(...L.map(D=>D.x)),y:x(...L.map(D=>D.y))},max:{x:b(...L.map(D=>D.x)),y:b(...L.map(D=>D.y))}}},Be=Object.freeze(Object.defineProperty({__proto__:null,angleBetween:Pt,arcLength:Qt,arcPoint:W,getArcBBox:pe,getArcLength:Bt,getArcProps:wt,getPointAtArcLength:ge},Symbol.toStringTag,{value:"Module"})),qt=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],be=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],de=e=>{const t=[];for(let s=e,r=s.length,n=r-1;r>1;r-=1,n-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const s=e.length-1;if(t===1)return e[s].t=1,e[s];const r=1-t;let n=e;if(s===0)return e[0].t=t,e[0];if(s===1)return{x:r*n[0].x+t*n[1].x,y:r*n[0].y+t*n[1].y,t};const i=r*r,o=t*t;let a=0,c=0,l=0,u=0;return s===2?(n=[n[0],n[1],n[2],{x:0,y:0}],a=i,c=r*t*2,l=o):s===3&&(a=i*r,c=i*t*3,l=r*o*3,u=t*o),{x:a*n[0].x+c*n[1].x+l*n[2].x+u*n[3].x,y:a*n[0].y+c*n[1].y+l*n[2].y+u*n[3].y,t}},Me=(e,t)=>{const s=e(t),r=s.x*s.x+s.y*s.y;return Math.sqrt(r)},we=e=>{const s=qt.length;let r=0;for(let n=0,i;n{const t=[];for(let r=0,n=e.length,i=2;rAe(s[0],r))},Ne=1e-8,pt=([e,t,s])=>{const r=Math.min(e,s),n=Math.max(e,s);if(t>=e?s>=t:s<=t)return[r,n];const i=(e*s-t*t)/(e-2*t+s);return i{const n=e-3*t+3*s-r;if(Math.abs(n)0&&u<1){const f=e*(1-u)*(1-u)*(1-u)+t*3*(1-u)*(1-u)*u+s*3*(1-u)*u*u+r*u*u*u;fc&&(c=f)}return[a,c]},Le=([e,t,s,r,n,i,o,a],c)=>{const l=1-c;return{x:l**3*e+3*l**2*c*s+3*l*c**2*n+c**3*o,y:l**3*t+3*l**2*c*r+3*l*c**2*i+c**3*a}},_t=(e,t,s,r,n,i,o,a)=>ft([e,t,s,r,n,i,o,a]),ve=(e,t,s,r,n,i,o,a,c)=>{const l=typeof c=="number";let u={x:e,y:t};if(l){const m=ft([e,t,s,r,n,i,o,a]);c<=0||(c>=m?u={x:o,y:a}:u=Le([e,t,s,r,n,i,o,a],c/m))}return u},Te=(e,t,s,r,n,i,o,a)=>{const c=kt([e,s,n,o]),l=kt([t,r,i,a]);return{min:{x:c[0],y:l[0]},max:{x:c[1],y:l[1]}}},Ce=([e,t,s,r,n,i],o)=>{const a=1-o;return{x:a**2*e+2*a*o*s+o**2*n,y:a**2*t+2*a*o*r+o**2*i}},Ft=(e,t,s,r,n,i)=>ft([e,t,s,r,n,i]),$e=(e,t,s,r,n,i,o)=>{const a=typeof o=="number";let c={x:e,y:t};if(a){const l=ft([e,t,s,r,n,i]);o<=0||(o>=l?c={x:n,y:i}:c=Ce([e,t,s,r,n,i],o/l))}return c},ze=(e,t,s,r,n,i)=>{const o=pt([e,s,n]),a=pt([t,r,i]);return{min:{x:o[0],y:a[0]},max:{x:o[1],y:a[1]}}},_e=e=>{const t=e.length;let s=-1,r,n=e[t-1],i=0;for(;++se.reduce((t,s,r)=>r?t+Mt(e[r-1],s):0,0),bt=1e-5,ut=e=>{const t=R(e),s={...X};return j(t,(r,n,i,o)=>{s.x=i,s.y=o;const a=G(r,s),c=a.length;return s.x1=+a[c-2],s.y1=+a[c-1],s.x2=+a[c-4]||s.x1,s.y2=+a[c-3]||s.y1,a})},at=(e,t)=>{const s=ut(e);let r=!1,n=[],i="M",o=0,a=0,[c,l]=s[0].slice(1);const u=typeof t=="number";let m={x:c,y:l},f=0,y=m,h=0;return!u||t{if([i]=x,r=i==="M",n=r?n:[A,w].concat(x.slice(1)),r?([,c,l]=x,m={x:c,y:l},f=0):i==="L"?(m=Ot(n[0],n[1],n[2],n[3],t-h),f=lt(n[0],n[1],n[2],n[3])):i==="A"?(m=ge(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],t-h),f=Bt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])):i==="C"?(m=ve(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],t-h),f=_t(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7])):i==="Q"?(m=$e(n[0],n[1],n[2],n[3],n[4],n[5],t-h),f=Ft(n[0],n[1],n[2],n[3],n[4],n[5])):i==="Z"&&(n=[A,w,c,l],m={x:c,y:l},f=lt(n[0],n[1],n[2],n[3])),[o,a]=n.slice(-2),hh-bt?{x:o,y:a}:y)},rt=e=>{const t=R(e),s={...X};let r=!1,n=[],i="M",o=0,a=0,c=0;return j(t,(l,u,m,f)=>{s.x=m,s.y=f;const y=G(l,s);[i]=y,r=i==="M",n=r?n:[m,f].concat(y.slice(1)),r?[,o,a]=y:i==="L"?c+=lt(n[0],n[1],n[2],n[3]):i==="A"?c+=Bt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]):i==="C"?c+=_t(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):i==="Q"?c+=Ft(n[0],n[1],n[2],n[3],n[4],n[5]):i==="Z"&&(n=[m,f,o,a],c+=lt(n[0],n[1],n[2],n[3]));const h=y.length;s.x1=+y[h-2],s.y1=+y[h-1],s.x2=+y[h-4]||s.x1,s.y2=+y[h-3]||s.y1}),c},Ht=(e,t)=>{const s=R(e);let r=s.slice(0),n=rt(r),i=r.length-1,o=0,a=0,c=s[0];if(i<=0||!t||!Number.isFinite(t))return{segment:c,index:0,length:a,lengthAtSegment:o};if(t>=n)return r=s.slice(0,-1),o=rt(r),a=n-o,c=s[i],{segment:c,index:i,length:a,lengthAtSegment:o};const l=[];for(;i>0;)c=r[i],r=r.slice(0,-1),o=rt(r),a=n-o,n=o,l.push({segment:c,index:i,length:a,lengthAtSegment:o}),i-=1;return l.find(({lengthAtSegment:u})=>u<=t)},Nt=(e,t)=>{const s=R(e),r=ut(s),n=rt(r),i=M=>{const d=M.x-t.x,v=M.y-t.y;return d*d+v*v};let o=8,a,c={x:0,y:0},l=0,u=0,m=1/0;for(let M=0;M<=n;M+=o)a=at(r,M),l=i(a),l1e-6&&(h=u-o,f=at(r,h),b=i(f),x=u+o,y=at(r,x),A=i(y),h>=0&&bNt(e,t).closest,Ue=(e,t,s,r,n,i,o,a)=>3*((a-t)*(s+n)-(o-e)*(r+i)+r*(e-n)-s*(t-i)+a*(n+e/3)-o*(i+t/3))/20,Pe=e=>{let t=0,s=0,r=0;return gt(e).map(n=>{switch(n[0]){case"M":return[,t,s]=n,0;default:return r=Ue(t,s,n[1],n[2],n[3],n[4],n[5],n[6]),[t,s]=n.slice(-2),r}}).reduce((n,i)=>n+i,0)},Xe=e=>Pe(gt(e))>=0,Jt=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=R(e);let s=[],r="M";const n=0,i=0;let o=0,a=0;const c=[],l=[];let u={x:n,y:i},m={x:n,y:i};const f={...X};j(t,(N,M,d,v)=>{f.x=d,f.y=v;const L=G(N,f);[r]=L,s=[d,v].concat(L.slice(1)),r==="M"?([,o,a]=L,u={x:o,y:a},m={x:o,y:a}):r==="L"?{min:u,max:m}=zt(s[0],s[1],s[2],s[3]):r==="A"?{min:u,max:m}=pe(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8]):r==="C"?{min:u,max:m}=Te(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]):r==="Q"?{min:u,max:m}=ze(s[0],s[1],s[2],s[3],s[4],s[5]):r==="Z"&&(s=[d,v,o,a],{min:u,max:m}=zt(s[0],s[1],s[2],s[3])),c.push(u),l.push(m);const T=L.length;f.x1=+L[T-2],f.y1=+L[T-1],f.x2=+L[T-4]||f.x1,f.y2=+L[T-3]||f.y1});const y=Math.min(...c.map(N=>N.x)),h=Math.max(...l.map(N=>N.x)),x=Math.min(...c.map(N=>N.y)),b=Math.max(...l.map(N=>N.y)),A=h-y,w=b-x;return{width:A,height:w,x:y,y:x,x2:h,y2:b,cx:y+A/2,cy:x+w/2,cz:Math.max(A,w)+Math.min(A,w)/2}},Je=(e,t)=>Ht(e,t).segment,Ye=(e,t)=>Nt(e,t).segment,Lt=e=>Array.isArray(e)&&e.every(t=>{const s=t[0].toLowerCase();return nt[s]===t.length-1&&"achlmqstvz".includes(s)&&t.slice(1).every(Number.isFinite)})&&e.length>0,qe=e=>Lt(e)&&e.every(([t])=>t===t.toUpperCase()),ke=e=>qe(e)&&e.every(([t])=>"ACLMQZ".includes(t)),Ke=e=>ke(e)&&e.every(([t])=>"MC".includes(t)),We=(e,t)=>{const{distance:s}=Nt(e,t);return Math.abs(s)Lt(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),Ie=e=>{if(typeof e!="string"||!e.length)return!1;const t=new Rt(e);for(st(t);t.index{let{x1:t,y1:s,x2:r,y2:n}=e;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t,s],["L",r,n]]},tn=e=>{const t=[],s=(e.points||"").trim().split(/[\s|,]/).map(n=>+n);let r=0;for(;r{let{cx:t,cy:s,r}=e;return[t,s,r]=[t,s,r].map(n=>+n),[["M",t-r,s],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},nn=e=>{let{cx:t,cy:s}=e,r=e.rx||0,n=e.ry||r;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t-r,s],["a",r,n,0,1,0,2*r,0],["a",r,n,0,1,0,-2*r,0]]},sn=e=>{const t=+e.x||0,s=+e.y||0,r=+e.width,n=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>n&&(o-=(o*2-n)/2),[["M",t+i,s],["h",r-i*2],["s",i,0,i,o],["v",n-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-n+o*2],["s",0,-o,i,-o]]):[["M",t,s],["h",r],["v",n],["H",t],["Z"]]},Ee=(e,t)=>{const r=(t||document).defaultView||window,n=Object.keys(mt),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...n,"path"].every(m=>o!==m))throw TypeError(`${E}: "${o}" is not SVGElement`);const a=i?o:e.type,c=mt[a],l={type:a};i?c.forEach(m=>{l[m]=e.getAttribute(m)}):Object.assign(l,e);let u=[];return a==="circle"?u=en(l):a==="ellipse"?u=nn(l):["polyline","polygon"].includes(a)?u=tn(l):a==="rect"?u=sn(l):a==="line"?u=Ge(l):["glyph","path"].includes(a)&&(u=R(i?e.getAttribute("d")||"":e.d||"")),Lt(u)&&u.length?u:!1},rn=(e,t,s)=>{const r=s||document,n=r.defaultView||window,i=Object.keys(mt),o=e instanceof n.SVGElement,a=o?e.tagName:null;if(a==="path")throw TypeError(`${E}: "${a}" is already SVGPathElement`);if(a&&i.every(x=>a!==x))throw TypeError(`${E}: "${a}" is not SVGElement`);const c=r.createElementNS("http://www.w3.org/2000/svg","path"),l=o?a:e.type,u=mt[l],m={type:l},f=V.round,y=Ee(e,r),h=y&&y.length?$t(y,f):"";return o?(u.forEach(x=>{m[x]=e.getAttribute(x)}),Object.values(e.attributes).forEach(({name:x,value:b})=>{u.includes(x)||c.setAttribute(x,b)})):(Object.assign(m,e),Object.keys(m).forEach(x=>{!u.includes(x)&&x!=="type"&&c.setAttribute(x.replace(/[A-Z]/g,b=>`-${b.toLowerCase()}`),m[x])})),Ie(h)?(c.setAttribute("d",h),t&&o&&(e.before(c,e),e.remove()),c):!1},Re=e=>{let t=new C;const{origin:s}=e,[r,n]=s,{translate:i}=e,{rotate:o}=e,{skew:a}=e,{scale:c}=e;return Array.isArray(i)&&i.length>=2&&i.every(l=>!Number.isNaN(+l))&&i.some(l=>l!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||a||c)&&(t=t.translate(r,n),Array.isArray(o)&&o.length>=2&&o.every(l=>!Number.isNaN(+l))&&o.some(l=>l!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(a)&&a.length===2&&a.every(l=>!Number.isNaN(+l))&&a.some(l=>l!==0)?(t=a[0]?t.skewX(a[0]):t,t=a[1]?t.skewY(a[1]):t):typeof a=="number"&&!Number.isNaN(a)&&(t=t.skewX(a)),Array.isArray(c)&&c.length>=2&&c.every(l=>!Number.isNaN(+l))&&c.some(l=>l!==1)?t=t.scale(...c):typeof c=="number"&&!Number.isNaN(c)&&(t=t.scale(c)),t=t.translate(-r,-n)),t},je=(e,t,s,r)=>{const[n]=e,{round:i}=V,o=typeof i=="number"?i:4,a=t.slice(1),{x1:c,y1:l,x2:u,y2:m,x:f,y}=s,[h,x]=a.slice(-2),b=e;if("TQ".includes(n)||(s.qx=null,s.qy=null),n==="L"){if(z(f,o)===z(h,o))return["V",x];if(z(y,o)===z(x,o))return["H",h]}else if(n==="C"){const[A,w]=a;if(s.x1=A,s.y1=w,"CS".includes(r)&&(z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o)||z(c,o)===z(u*2-f,o)&&z(l,o)===z(m*2-y,o)))return["S",a[2],a[3],a[4],a[5]]}else if(n==="Q"){const[A,w]=a;if(s.qx=A,s.qy=w,"QT".includes(r)&&z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o))return["T",a[2],a[3]]}return b},dt=(e,t)=>{const s=e.slice(1).map(r=>z(r,t));return[e[0]].concat(s)},Yt=(e,t)=>{const s=xt(e),r=typeof t=="number"&&t>=0?t:2,n={...X},i=[];let o="M",a="Z";return j(s,(c,l,u,m)=>{n.x=u,n.y=m;const f=G(c,n);let y=c;if([o]=c,i[l]=o,l){a=i[l-1];const x=je(c,f,n,a),b=dt(x,r),A=b.join(""),w=St(x,l,u,m),N=dt(w,r),M=N.join("");y=A.length{let s=C.Translate(t[0],t[1],t[2]);return[,,,s.m44]=t,s=e.multiply(s),[s.m41,s.m42,s.m43,s.m44]},It=(e,t,s)=>{const[r,n,i]=s,[o,a,c]=on(e,[t[0],t[1],0,1]),l=o-r,u=a-n,m=c-i;return[l*(Math.abs(i)/Math.abs(m)||1)+r,u*(Math.abs(i)/Math.abs(m)||1)+n]},cn=e=>{const t=e.slice(1).map((s,r,n)=>r?n[r-1].slice(-2).concat(s.slice(1)):e[0].slice(1).concat(s.slice(1))).map(s=>s.map((r,n)=>s[s.length-n-2*(1-n%2)])).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(s=>["C"].concat(s.slice(2))))},yt=e=>{const t=xt(e),s=ut(t),r=t.length,n=t[r-1][0]==="Z",i=j(t,(o,a)=>{const c=s[a],l=a&&t[a-1],u=l&&l[0],m=t[a+1],f=m&&m[0],[y]=o,[h,x]=s[a?a-1:r-1].slice(-2);let b=o;switch(y){case"M":b=n?["Z"]:[y,h,x];break;case"A":b=[y,o[1],o[2],o[3],o[4],o[5]===1?0:1,h,x];break;case"C":m&&f==="S"?b=["S",o[1],o[2],h,x]:b=[y,o[3],o[4],o[1],o[2],h,x];break;case"S":u&&"CS".includes(u)&&(!m||f!=="S")?b=["C",c[3],c[4],c[1],c[2],h,x]:b=[y,c[1],c[2],h,x];break;case"Q":m&&f==="T"?b=["T",h,x]:b=[y,o[1],o[2],h,x];break;case"T":u&&"QT".includes(u)&&(!m||f!=="T")?b=["Q",c[1],c[2],h,x]:b=[y,h,x];break;case"Z":b=["M",h,x];break;case"H":b=[y,h];break;case"V":b=[y,x];break;default:b=[y].concat(o.slice(1,-2),h,x)}return b});return n?i.reverse():[i[0]].concat(i.slice(1).reverse())},an=(e,t)=>{let{round:s}=V;return s=t==="off"||typeof t=="number"&&t>=0?t:typeof s=="number"&&s>=0?s:"off",s==="off"?e.slice(0):j(e,r=>dt(r,s))},ln=(e,t=.5)=>{const s=t,r=e.slice(0,2),n=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),a=O(r,n,s),c=O(n,i,s),l=O(i,o,s),u=O(a,c,s),m=O(c,l,s),f=O(u,m,s);return[["C",a[0],a[1],u[0],u[1],f[0],f[1]],["C",m[0],m[1],l[0],l[1],o[0],o[1]]]},Kt=e=>{const t=[];let s,r=-1,n=0,i=0,o=0,a=0;const c={...X};return e.forEach(l=>{const[u]=l,m=u.toUpperCase(),f=u.toLowerCase(),y=u===f,h=l.slice(1);m==="M"?(r+=1,[n,i]=h,n+=y?c.x:0,i+=y?c.y:0,o=n,a=i,s=[y?[m,o,a]:l]):(m==="Z"?(n=o,i=a):m==="H"?([,n]=l,n+=y?c.x:0):m==="V"?([,i]=l,i+=y?c.y:0):([n,i]=l.slice(-2),n+=y?c.x:0,i+=y?c.y:0),s.push(l)),c.x=n,c.y=i,t[r]=s}),t},Wt=(e,t)=>{let s=0,r=0,n=0,i=0,o=0,a=0,c="M";const l={...X},u=R(e),m=t&&Object.keys(t);if(!t||m&&!m.length)return u.slice(0);t.origin||Object.assign(t,{origin:V.origin});const f=t.origin,y=Re(t);return y.isIdentity?u.slice(0):j(u,(h,x,b,A)=>{l.x=b,l.y=A,[c]=h;const w=c.toUpperCase(),M=w!==c?jt(h,x,b,A):h.slice(0);let d=w==="A"?Zt(M,l):["V","H"].includes(w)?G(M,l):M;c=d[0];const v=c==="C"&&d.length>7,L=v?d.slice(0,7):d.slice(0);if(v&&(u.splice(x+1,0,["C"].concat(d.slice(7))),d=L),c==="L")[n,i]=It(y,[d[1],d[2]],f),s!==n&&r!==i?d=["L",n,i]:r===i?d=["H",n]:s===n&&(d=["V",i]);else for(o=1,a=d.length;o"u";if(n||!t.length)throw TypeError(`${E}: "pathValue" is ${n?"undefined":"empty"}`);this.segments=R(t);const{round:i,origin:o}=r;let a;Number.isInteger(i)||i==="off"?a=i:a=V.round;let c=V.origin;if(Array.isArray(o)&&o.length>=2){const[l,u,m]=o.map(Number);c=[Number.isNaN(l)?0:l,Number.isNaN(u)?0:u,Number.isNaN(m)?0:m]}return this.round=a,this.origin=c,this}get bbox(){return Jt(this.segments)}get length(){return rt(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return at(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=xt(t),this}toRelative(){const{segments:t}=this;return this.segments=Xt(t),this}toCurve(){const{segments:t}=this;return this.segments=gt(t),this}reverse(t){this.toAbsolute();const{segments:s}=this,r=Kt(s),n=r.length>1?r:!1,i=n?n.map((a,c)=>t?c?yt(a):a.slice(0):yt(a)):s.slice(0);let o=[];return n?o=i.flat(1):o=t?s:yt(s),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=ut(t),this}optimize(){const{segments:t}=this,s=this.round==="off"?2:this.round;return this.segments=Yt(t,s),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(c=>c in t))return this;const{segments:s,origin:[r,n,i]}=this,o={};for(const[c,l]of Object.entries(t))c==="skew"&&Array.isArray(l)||(c==="rotate"||c==="translate"||c==="origin"||c==="scale")&&Array.isArray(l)?o[c]=l.map(Number):c!=="origin"&&typeof Number(l)=="number"&&(o[c]=Number(l));const{origin:a}=o;if(Array.isArray(a)&&a.length>=2){const[c,l,u]=a.map(Number);o.origin=[Number.isNaN(c)?r:c,Number.isNaN(l)?n:l,u||i]}else o.origin=[r,n,i];return this.segments=Wt(s,o),this}flipX(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,s,0]}),this}flipY(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,s,0]}),this}toString(){return $t(this.segments,this.round)}}g(p,"CSSMatrix",C),g(p,"pathToAbsolute",xt),g(p,"pathToRelative",Xt),g(p,"pathToCurve",gt),g(p,"pathToString",$t),g(p,"arcTools",Be),g(p,"bezierTools",{Cvalues:be,Tvalues:qt,minmaxC:kt,minmaxQ:pt,getBezierLength:ft,bezierLength:we,calculateBezier:Me,computeBezier:Ae,deriveBezier:de,CBEZIER_MINMAX_EPSILON:Ne}),g(p,"cubicTools",{getCubicLength:_t,getCubicBBox:Te,getPointAtCubicLength:ve,getPointAtCubicSegmentLength:Le}),g(p,"lineTools",{getPointAtLineLength:Ot,getLineBBox:zt,getLineLength:lt}),g(p,"quadTools",{getPointAtQuadSegmentLength:Ce,getQuadLength:Ft,getQuadBBox:ze,getPointAtQuadLength:$e}),g(p,"polygonTools",{polygonArea:_e,polygonLength:Fe}),g(p,"distanceSquareRoot",Mt),g(p,"distanceEpsilon",bt),g(p,"midPoint",O),g(p,"rotateVector",ct),g(p,"roundTo",z),g(p,"finalizeSegment",Tt),g(p,"invalidPathValue",U),g(p,"isArcCommand",fe),g(p,"isDigit",H),g(p,"isDigitStart",he),g(p,"isMoveCommand",ye),g(p,"isPathCommand",me),g(p,"isSpace",ue),g(p,"paramsCount",nt),g(p,"paramsParser",X),g(p,"pathParser",Rt),g(p,"scanFlag",ae),g(p,"scanParam",le),g(p,"scanSegment",Et),g(p,"skipSpaces",st),g(p,"getPathBBox",Jt),g(p,"getPathArea",Pe),g(p,"getTotalLength",rt),g(p,"getDrawDirection",Xe),g(p,"getPointAtLength",at),g(p,"getPropertiesAtLength",Ht),g(p,"getPropertiesAtPoint",Nt),g(p,"getClosestPoint",He),g(p,"getSegmentOfPoint",Ye),g(p,"getSegmentAtLength",Je),g(p,"isPointInStroke",We),g(p,"isValidPath",Ie),g(p,"isPathArray",Lt),g(p,"isAbsoluteArray",qe),g(p,"isRelativeArray",Ve),g(p,"isCurveArray",Ke),g(p,"isNormalizedArray",ke),g(p,"shapeToPath",rn),g(p,"shapeToPathArray",Ee),g(p,"shapeParams",mt),g(p,"parsePathString",R),g(p,"absolutizeSegment",jt),g(p,"arcToCubic",Dt),g(p,"getSVGMatrix",Re),g(p,"iterate",j),g(p,"lineToCubic",Ct),g(p,"normalizePath",ut),g(p,"normalizeSegment",G),g(p,"optimizePath",Yt),g(p,"projection2d",It),g(p,"quadToCubic",xe),g(p,"relativizeSegment",St),g(p,"reverseCurve",cn),g(p,"reversePath",yt),g(p,"roundPath",an),g(p,"roundSegment",dt),g(p,"segmentToCubic",Zt),g(p,"shortenSegment",je),g(p,"splitCubic",ln),g(p,"splitPath",Kt),g(p,"transformPath",Wt);module.exports=p; //# sourceMappingURL=svg-path-commander.cjs.map diff --git a/dist/svg-path-commander.cjs.map b/dist/svg-path-commander.cjs.map index 30652e1..ef2f6c5 100644 --- a/dist/svg-path-commander.cjs.map +++ b/dist/svg-path-commander.cjs.map @@ -1 +1 @@ -{"version":3,"file":"svg-path-commander.cjs","sources":["../src/options/options.ts","../src/parser/error.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/math/polygonArea.ts","../src/math/distanceSquareRoot.ts","../src/math/polygonLength.ts","../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/parser/paramsParser.ts","../src/process/iterate.ts","../src/process/absolutizeSegment.ts","../src/process/normalizeSegment.ts","../src/math/midPoint.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/util/getPathBBox.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/convert/pathToCurve.ts","../src/util/getPathArea.ts","../src/util/getTotalLength.ts","../src/util/getDrawDirection.ts","../src/util/distanceEpsilon.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/process/normalizePath.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getSegmentOfPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/isPointInStroke.ts","../src/util/isValidPath.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isRelativeArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/process/roundPath.ts","../src/convert/pathToString.ts","../src/util/shapeToPath.ts","../src/process/splitPath.ts","../src/process/getSVGMatrix.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/process/shortenSegment.ts","../src/process/optimizePath.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/projection2d.ts","../src/process/transformPath.ts","../src/process/splitCubic.ts","../src/index.ts"],"sourcesContent":["import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let LK = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[LK]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (LK === 'm' && data.length > 2) {\n path.segments.push([pathCommand, ...(data.splice(0, 2) as number[])] as PathSegment);\n LK = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push([pathCommand, ...(data.splice(0, paramsCount[LK]) as number[])] as PathSegment);\n }\n\n if (!paramsCount[LK]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: any[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | PathArray) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as PathArray;\n // return pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]): number => {\n const n = polygon.length;\n let i = -1;\n let a;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nexport default polygonArea;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple): number => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import { type PointTuple } from '../types';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns {number} the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]): number => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport default polygonLength;\n","var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n const allPathCommands = [] as PathCommand[];\n const params = { ...paramsParser };\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n allPathCommands[i] = pathCommand;\n const iteratorResult = iterator(segment, params, i);\n path[i] = iteratorResult;\n\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n\n segment = path[i];\n const seglen = segment.length;\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n }\n // console.log('iteration: ', ...path)\n return path as T;\n};\n\nexport default iterate;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (!isAbsolute) {\n if (absCommand === 'A') {\n return [\n absCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] + x,\n values[6] + y,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, values[0] + y] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, values[0] + x] as HSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = values.map((n, j) => n + (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [absCommand, ...absValues] as MSegment | QSegment | TSegment | SSegment | CSegment;\n }\n }\n\n return segment as AbsoluteSegment;\n};\nexport default absolutizeSegment;\n","import type { ParserParams } from '../interface';\nimport type { NormalSegment, PointTuple, PathSegment, QSegment, CSegment, LSegment } from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x1: px1, y1: py1, x2: px2, y2: py2 } = params;\n const values = segment.slice(1).map(Number);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'H') {\n return ['L', segment[1], py1] as LSegment;\n } else if (pathCommand === 'V') {\n return ['L', px1, segment[1]] as LSegment;\n } else if (pathCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1, ...values] as CSegment;\n } else if (pathCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy, ...values] as QSegment;\n } else if (pathCommand === 'Q') {\n const [nqx, nqy] = values as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n }\n\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nexport const getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nexport const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nexport const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst ellipticalArcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const arcLength = Math.sqrt(term1 + term2) * theta;\n return Math.abs(arcLength);\n};\n\n/**\n * Compute point on ellipse from angle around ellipse (theta);\n * @param theta the arc sweep angle\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the angle\n * @returns a point around ellipse\n */\nconst arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alpha: number) => {\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cos = Math.cos(alpha);\n const sin = Math.sin(alpha);\n const x = rx * Math.cos(theta);\n const y = ry * Math.sin(theta);\n\n return {\n x: cx + cos * x - sin * y,\n y: cy + sin * x + cos * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n const angle = sign * Math.acos(p / n);\n\n return angle;\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle\n * and radiuses on X and Y coordinates.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // to be used later\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n // point.length = ellipticalArcLength(rx, ry, sweepAngle);\n // point.box = minmax(center.x, center.y, rx, ry, xRotRad, startAngle, startAngle + sweepAngle);\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nexport const getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return ellipticalArcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nexport const getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const length = ellipticalArcLength(rx, ry, endAngle - startAngle);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the bounding box for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nexport const getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const [cx, cy] = [center.x, center.y];\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * Math.PI) / 180;\n const tan = Math.tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = Math.atan2(-ry * tan, rx);\n const angle1 = theta;\n const angle2 = theta + Math.PI;\n const angle3 = Math.atan2(ry, rx * tan);\n const angle4 = angle3 + Math.PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = Math.min(...xArr);\n const xMax = Math.max(...xArr);\n const yMin = Math.min(...yArr);\n const yMax = Math.max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arc(angleAfterStart, cx, cy, rx, ry, alpha);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arc(angleBeforeEnd, cx, cy, rx, ry, alpha);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arc(angle1, cx, cy, rx, ry, alpha));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arc(angle2, cx, cy, rx, ry, alpha));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arc(angle4, cx, cy, rx, ry, alpha));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arc(angle3, cx, cy, rx, ry, alpha));\n }\n\n return {\n min: {\n x: Math.min(...extremes.map(n => n.x)),\n y: Math.min(...extremes.map(n => n.y)),\n },\n max: {\n x: Math.max(...extremes.map(n => n.x)),\n y: Math.max(...extremes.map(n => n.y)),\n },\n };\n};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst ZERO = { x: 0, y: 0 };\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst derive = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], ZERO as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst arcfn = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst lengthFn = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * arcfn(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nexport const length = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = derive(points);\n return lengthFn((t: number) => {\n return compute(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nexport const minmaxQ = (A: [number, number, number]) => {\n const min = Math.min(A[0], A[2]);\n const max = Math.max(A[0], A[2]);\n\n /* istanbul ignore next @preserve */\n if (A[1] >= A[0] ? A[2] >= A[1] : A[2] <= A[1]) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (A[0] * A[2] - A[1] * A[1]) / (A[0] - 2 * A[1] + A[2]);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nexport const minmaxC = (A: [number, number, number, number]) => {\n const K = A[0] - 3 * A[1] + 3 * A[2] - A[3];\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (A[0] === A[3] && A[0] === A[1]) {\n // no curve, point targeting same location\n return [A[0], A[3]] as PointTuple;\n }\n\n return minmaxQ([A[0], -0.5 * A[0] + 1.5 * A[1], A[0] - 3 * A[1] + 3 * A[2]]);\n }\n\n // the reduced discriminant of the derivative\n const T = -A[0] * A[2] + A[0] * A[3] - A[1] * A[2] - A[1] * A[3] + A[1] * A[1] + A[2] * A[2];\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(A[0], A[3]), Math.max(A[0], A[3])] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(A[0], A[3]);\n let max = Math.max(A[0], A[3]);\n\n const L = A[0] - 2 * A[1] + A[2];\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n A[0] * (1 - R) * (1 - R) * (1 - R) +\n A[1] * 3 * (1 - R) * (1 - R) * R +\n A[2] * 3 * (1 - R) * R * R +\n A[3] * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n","import { length, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a {x,y} point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nexport const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nexport const getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nexport const getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import { length, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nexport const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return length([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nexport const getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n Point,\n PointTuple,\n QuadCoordinates,\n} from '../types';\n// import pathFactory from './pathFactory';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport parsePathString from '../parser/parsePathString';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n data = [x, y, ...normalSegment.slice(1)] as number[];\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(...(data as ArcCoordinates)));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(...(data as CubicCoordinates)));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(...(data as QuadCoordinates)));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const X = x * Math.cos(rad) - y * Math.sin(rad);\n const Y = x * Math.sin(rad) + y * Math.cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [...m2, ...m3, ...m4, ...res];\n }\n res = [...m2, ...m3, ...m4, ...res];\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [...c1, ...c2, x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n args = [px1, py1, ...values] as [number, number, number, number, number, number, number, number, number];\n return ['C', ...arcToCubic(...args)] as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n args = [px1, py1, ...values] as [number, number, number, number, number, number];\n return ['C', ...quadToCubic(...args)] as CSegment;\n } else if (pathCommand === 'L') {\n return ['C', ...lineToCubic(px1, py1, x, y)] as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C', ...lineToCubic(px1, py1, px, py)] as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport absolutizeSegment from '../process/absolutizeSegment';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n const path = parsePathString(pathInput);\n return iterate(path, (seg, params, i) => {\n const absSegment = absolutizeSegment(seg, params);\n [pathCommand] = absSegment;\n\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const normalSegment = normalizeSegment(absSegment, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToCurve;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray, QuadCoordinates } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, ...(seg.slice(1) as QuadCoordinates));\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\n// import pathFactory from './pathFactory';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n totalLength += getLineLength(...(data as LineCoordinates));\n }\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (isM) {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber) return point;\n\n if (distance < DISTANCE_EPSILON) {\n POINT = point;\n }\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(...(data as LineCoordinates), distance - totalLength);\n length = getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(...(data as ArcCoordinates), distance - totalLength);\n length = getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(...(data as CubicCoordinates), distance - totalLength);\n length = getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(...(data as QuadCoordinates), distance - totalLength);\n length = getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n point = { x: mx, y: my };\n length = getLineLength(...(data as LineCoordinates));\n }\n\n if (totalLength < distance && totalLength + length >= distance) {\n POINT = point;\n }\n\n totalLength += length;\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n POINT = { x, y };\n }\n\n return POINT;\n};\nexport default getPointAtLength;\n","import type { PointTuple, PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n const [x, y] = segment.slice(-2) as PointTuple;\n const point = { x, y };\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n point,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n return {\n segment: pathArray[index],\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import normalizeSegment from './normalizeSegment';\nimport type { AbsoluteCommand, NormalArray, PathArray, PointTuple } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Normalizes a `path` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n return iterate(parsePathString(pathInput), (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const result = normalizeSegment(absoluteSegment, params);\n [pathCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n // const seglen = result.length;\n // params.x1 = +result[seglen - 2];\n // params.y1 = +result[seglen - 1];\n // params.x2 = +result[seglen - 4] || params.x1;\n // params.y2 = +result[seglen - 3] || params.y1;\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default normalizePath;\n","import type { PathArray } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: { x: number; y: number }): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(path);\n const distanceTo = (p: { x: number; y: number }) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: { x: number; y: number };\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n if (roundOption === 'off' || round === 'off') return path.slice(0) as PathArray;\n // allow for ZERO decimals\n round = typeof roundOption === 'number' && roundOption >= 0 ? roundOption : round;\n // to round values to the power\n // the `round` value must be integer\n const pow = typeof round === 'number' && round >= 1 ? 10 ** round : 1;\n\n return iterate(path, segment => {\n const values = (segment.slice(1) as number[]).map(n => (round ? Math.round(n * pow) / pow : Math.round(n)));\n return [segment[0], ...values] as PathSegment;\n });\n};\nexport default roundPath;\n","import type { PathArray } from '../types';\nimport roundPath from '../process/roundPath';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param round amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, round?: number | 'off'): string => {\n return roundPath(path, round)\n .map(x => x[0] + x.slice(1).join(' '))\n .join('');\n};\nexport default pathToString;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, AbsoluteCommand, HSegment, PathArray, PointTuple, VSegment } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params) => {\n [pathCommand] = seg;\n const result = absolutizeSegment(seg, params);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as HSegment;\n } else if (absCommand === 'V') {\n [, y] = result as VSegment;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToAbsolute;\n","import type { ParserParams } from '../interface';\nimport type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @param index the segment index\n * @returns the absolute segment\n */\nconst relativizeSegment = (segment: PathSegment, params: ParserParams, index: number) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n\n if (index === 0 && pathCommand === 'M') {\n return segment;\n }\n\n /* istanbul ignore else @preserve */\n if (pathCommand !== relCommand) {\n if (relCommand === 'a') {\n return [\n relCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] - x,\n values[6] - y,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, values[0] - y] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, values[0] - x] as hSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = values.map((n, j) => n - (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [relCommand, ...relValues] as qSegment | tSegment | sSegment | cSegment;\n }\n }\n\n return segment as RelativeSegment;\n};\nexport default relativizeSegment;\n","import type {\n AbsoluteCommand,\n hSegment,\n PathArray,\n PointTuple,\n RelativeArray,\n RelativeCommand,\n vSegment,\n} from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params, i) => {\n [pathCommand] = seg;\n const result = relativizeSegment(seg, params, i);\n const [resultedCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = resultedCommand === relCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as hSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = result as vSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n\n return result;\n });\n};\nexport default pathToRelative;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n HSegment,\n NormalSegment,\n PathCommand,\n ShortSegment,\n SSegment,\n TSegment,\n VSegment,\n ZSegment,\n} from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const round4 = (n: number) => Math.round(n * 10 ** 4) / 10 ** 4;\n const segmentValues = segment.slice(1) as number[];\n const normalValues = normalSegment.slice(1) as number[];\n const { x1: px1, y1: py1, x2: px2, y2: py2, x: px, y: py } = params;\n let result = segment;\n const [x, y] = normalValues.slice(-2);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)) {\n result = [pathCommand, ...segmentValues] as VSegment | HSegment | SSegment | TSegment | ZSegment;\n } else if (pathCommand === 'L') {\n if (round4(px) === round4(x)) {\n result = ['V', y];\n } else if (round4(py) === round4(y)) {\n result = ['H', x];\n }\n } else if (pathCommand === 'C') {\n const [x1, y1] = normalValues;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((round4(x1) === round4(px1 * 2 - px2) && round4(y1) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['S', ...normalValues.slice(-4)] as SSegment;\n }\n params.x1 = x1;\n params.y1 = y1;\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n ((round4(qx) === round4(px1 * 2 - px2) && round4(qy) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['T', ...normalValues.slice(-2)] as TSegment;\n }\n }\n\n return result as ShortSegment;\n};\nexport default shortenSegment;\n","import roundPath from './roundPath';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport pathToRelative from '../convert/pathToRelative';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport normalizePath from './normalizePath';\nimport type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteSegment } from '../types';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param round the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, round: 'off' | number): PathArray => {\n const path = pathToAbsolute(pathInput);\n const normalPath = normalizePath(path);\n const params = { ...paramsParser };\n const allPathCommands = [] as PathCommand[];\n const ii = path.length;\n let pathCommand = '' as PathCommand;\n let prevCommand = '' as PathCommand;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n\n for (let i = 0; i < ii; i += 1) {\n [pathCommand] = path[i];\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n // Get previous path command for `shortenSegment`\n if (i) prevCommand = allPathCommands[i - 1];\n path[i] = shortenSegment(path[i], normalPath[i], params, prevCommand) as AbsoluteSegment;\n\n const segment = path[i];\n const seglen = segment.length;\n\n // update C, S, Q, T specific params\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n\n // update x, y params\n switch (pathCommand) {\n case 'Z':\n x = mx;\n y = my;\n break;\n case 'H':\n [, x] = segment as HSegment;\n break;\n case 'V':\n [, y] = segment as VSegment;\n break;\n default:\n [x, y] = segment.slice(-2).map(Number);\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n }\n\n const absolutePath = roundPath(path, round);\n const relativePath = roundPath(pathToRelative(path), round);\n\n return absolutePath.map((a: PathSegment, i: number) => {\n if (i) {\n return a.join('').length < relativePath[i].join('').length ? a : relativePath[i];\n }\n return a;\n }) as PathArray;\n};\nexport default optimizePath;\n","import type { CurveArray } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray): CurveArray => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? [...path[0].slice(1), ...x.slice(1)] : [...curveOnly[i - 1].slice(-2), ...x.slice(1)],\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse();\n\n return [['M', ...rotatedCurve[0].slice(0, 2)], ...rotatedCurve.map(x => ['C', ...x.slice(2)])] as CurveArray;\n};\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray): PathArray => {\n const absolutePath = pathToAbsolute(pathInput);\n const isClosed = absolutePath.slice(-1)[0][0] === 'Z';\n\n const reversedPath = normalizePath(absolutePath)\n .map((segment, i) => {\n const [x, y] = segment.slice(-2).map(Number);\n return {\n seg: absolutePath[i], // absolute\n n: segment, // normalized\n c: absolutePath[i][0], // pathCommand\n x, // x\n y, // y\n };\n })\n .map((seg, i, path) => {\n const segment = seg.seg;\n const data = seg.n;\n const prevSeg = i && path[i - 1];\n const nextSeg = path[i + 1];\n const pathCommand = seg.c;\n const pLen = path.length;\n const x = i ? path[i - 1].x : path[pLen - 1].x;\n const y = i ? path[i - 1].y : path[pLen - 1].y;\n let result = [];\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [pathCommand, ...segment.slice(1, -3), segment[5] === 1 ? 0 : 1, x, y] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextSeg.c === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevSeg && 'CS'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'S')) {\n result = ['C', data[3], data[4], data[1], data[2], x, y] as CSegment;\n } else {\n result = [pathCommand, data[1], data[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextSeg.c === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, ...segment.slice(1, -2), x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevSeg && 'QT'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'T')) {\n result = ['Q', data[1], data[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand, ...segment.slice(1, -2), x, y] as PathSegment;\n }\n\n return result;\n });\n\n return (isClosed ? reversedPath.reverse() : [reversedPath[0], ...reversedPath.slice(1).reverse()]) as PathArray;\n};\nexport default reversePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(...(v.slice(0, -1) as [number, number, number]));\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [...point2D, 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, CSegment, PathArray, PointTuple, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let lx = 0;\n let ly = 0;\n let j = 0;\n let jj = 0;\n let nx = 0;\n let ny = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path;\n\n return iterate(path, (seg, _, i) => {\n const absSegment = absolutizeSegment(seg, transformParams);\n [pathCommand] = absSegment;\n\n let result =\n pathCommand === 'A'\n ? segmentToCubic(absSegment, transformParams)\n : ['V', 'H'].includes(pathCommand)\n ? normalizeSegment(absSegment, transformParams)\n : absSegment;\n const isLongArc = result[0] === 'C' && result.length > 7;\n const normalizedSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as typeof result;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (result[0] === 'L') {\n const values = result.slice(-2) as PointTuple;\n [lx, ly] = projection2d(matrixInstance, values, origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n if (pathCommand === 'Z') {\n nx = mx;\n ny = my;\n } else {\n [nx, ny] = normalizedSegment.slice(-2) as PointTuple;\n if (pathCommand === 'M') {\n mx = nx;\n my = ny;\n }\n }\n\n const seglen = normalizedSegment.length;\n transformParams.x1 = +normalizedSegment[seglen - 2];\n transformParams.y1 = +normalizedSegment[seglen - 1];\n transformParams.x2 = +normalizedSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +normalizedSegment[seglen - 3] || transformParams.y1;\n transformParams.x = nx;\n transformParams.y = ny;\n return result;\n });\n};\n\nexport default transformPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', ...p4, ...p7, ...p9],\n ['C', ...p8, ...p6, ...p3],\n ];\n};\nexport default splitCubic;\n","'use strict';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\n\nimport polygonArea from './math/polygonArea';\nimport polygonLength from './math/polygonLength';\n\nimport CSSMatrix from '@thednp/dommatrix';\nimport getPathBBox from './util/getPathBBox';\nimport getPathArea from './util/getPathArea';\nimport getTotalLength from './util/getTotalLength';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPointAtLength from './util/getPointAtLength';\n\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getClosestPoint from './util/getClosestPoint';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport isPointInStroke from './util/isPointInStroke';\n\nimport isValidPath from './util/isValidPath';\nimport isPathArray from './util/isPathArray';\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isRelativeArray from './util/isRelativeArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport shapeToPathArray from './util/shapeToPathArray';\nimport shapeToPath from './util/shapeToPath';\n\nimport roundPath from './process/roundPath';\nimport splitPath from './process/splitPath';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport optimizePath from './process/optimizePath';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport normalizePath from './process/normalizePath';\nimport transformPath from './process/transformPath';\nimport splitCubic from './process/splitCubic';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static getSVGMatrix = getSVGMatrix;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static polygonLength = polygonLength;\n public static polygonArea = polygonArea;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static parsePathString = parsePathString;\n public static roundPath = roundPath;\n public static splitPath = splitPath;\n public static splitCubic = splitCubic;\n public static optimizePath = optimizePath;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static normalizePath = normalizePath;\n public static transformPath = transformPath;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n const segments = parsePathString(pathValue);\n this.segments = segments;\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n\n this.segments = optimizePath(segments, this.round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["defaultOptions","error","paramsCount","finalizeSegment","path","pathCommand","LK","data","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","i","PathParser","pathString","parsePathString","pathInput","polygonArea","polygon","n","a","b","area","distanceSquareRoot","polygonLength","length","point","Z","z","s","e","p","$","E","P","y","g","r","l","m","h","c","f","w","o","d","A","M","X","O","x","Y","F","T","k","I","v","R","D","N","paramsParser","iterate","iterator","params","pathLen","segment","iteratorResult","seglen","absolutizeSegment","values","absCommand","absValues","j","normalizeSegment","px1","py1","px2","py2","x1","y1","qx","qy","nqx","nqy","midPoint","t","ax","ay","bx","by","getLineLength","x2","y2","getPointAtLineLength","distance","getLineBBox","min","ellipticalArcLength","rx","ry","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcLength","arc","cx","cy","alpha","cos","sin","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","RX","RY","angle","LAF","SF","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","extremes","tan","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","ZERO","Tvalues","Cvalues","derive","points","dpoints","list","compute","order","mt","mt2","t2","arcfn","derivativeFn","lengthFn","len","sum","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","minmaxC","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","getPathBBox","mx","my","MIN","MAX","seg","absoluteSegment","normalSegment","width","height","rotateVector","rad","arcToCubic","X1","Y1","X2","Y2","recursive","d120","res","xy","f1","f2","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","r13","r23","lineToCubic","segmentToCubic","args","px","py","pathToCurve","absSegment","result","getCubicSegArea","getPathArea","getTotalLength","isM","totalLength","getDrawDirection","DISTANCE_EPSILON","getPointAtLength","POINT","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","normalizePath","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getSegmentOfPoint","getSegmentAtLength","isPointInStroke","isValidPath","isPathArray","lk","isAbsoluteArray","isRelativeArray","pc","isNormalizedArray","isCurveArray","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","roundPath","roundOption","round","pow","pathToString","shapeToPath","replace","doc","description","name","value","splitPath","composite","pi","relCommand","isRelative","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","pathToAbsolute","relativizeSegment","relValues","pathToRelative","resultedCommand","shortenSegment","prevCommand","round4","segmentValues","normalValues","optimizePath","allPathCommands","absolutePath","relativePath","reverseCurve","rotatedCurve","curveOnly","_","reversePath","isClosed","reversedPath","prevSeg","nextSeg","pLen","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","transformPath","lx","ly","jj","nx","ny","transformParams","transformProps","matrixInstance","isLongArc","normalizedSegment","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField"],"mappings":"qLAGA,MAAMA,GAA0B,CAC9B,OAAQ,CAAC,EAAG,EAAG,CAAC,EAChB,MAAO,CACT,ECNMC,EAAQ,yBCCRC,GAAc,CAClB,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,CACL,ECJMC,GAAmBC,GAAqB,CAC5C,IAAIC,EAAcD,EAAK,UAAUA,EAAK,YAAY,EAC9CE,EAAKD,EAAY,cACf,KAAA,CAAE,KAAAE,CAAS,EAAAH,EAEjB,KAAOG,EAAK,QAAUL,GAAYI,CAAE,IAG9BA,IAAO,KAAOC,EAAK,OAAS,GACzBH,EAAA,SAAS,KAAK,CAACC,EAAa,GAAIE,EAAK,OAAO,EAAG,CAAC,CAAc,CAAgB,EAC9ED,EAA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IAC9B2I,EAhCIV,EAgCU,gBAAgBxB,IAC9BkC,EAjCIV,EAiCU,iBAAiBxD,IAC/BkE,EAlCIV,EAkCU,iBAAiBrD,IAC/B+D,EAnCIV,EAmCU,cAAclJ,IAC5B4J,EApCIV,EAoCU,eAAe/E","x_google_ignoreList":[20]} \ No newline at end of file +{"version":3,"file":"svg-path-commander.cjs","sources":["../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/options/options.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/error.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/process/absolutizeSegment.ts","../src/process/iterate.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/math/midPoint.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/process/normalizeSegment.ts","../src/parser/paramsParser.ts","../src/convert/pathToCurve.ts","../src/math/roundTo.ts","../src/convert/pathToString.ts","../src/math/distanceSquareRoot.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/util/distanceEpsilon.ts","../src/process/normalizePath.ts","../src/util/getPointAtLength.ts","../src/util/getTotalLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getPathArea.ts","../src/util/getDrawDirection.ts","../src/util/getPathBBox.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/util/shapeToPath.ts","../src/process/getSVGMatrix.ts","../src/process/shortenSegment.ts","../src/process/roundSegment.ts","../src/process/optimizePath.ts","../src/process/projection2d.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/roundPath.ts","../src/process/splitCubic.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/index.ts"],"sourcesContent":["var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let relativeCommand = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[relativeCommand]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (relativeCommand === 'm' && data.length > 2) {\n path.segments.push([pathCommand as PathCommand | number].concat(data.splice(0, 2) as number[]) as PathSegment);\n relativeCommand = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push(\n [pathCommand as PathCommand | number].concat(\n data.splice(0, paramsCount[relativeCommand]) as number[],\n ) as PathSegment,\n );\n }\n\n if (!paramsCount[relativeCommand]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: (string | number)[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | T) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as typeof pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n LSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isAbsolute) return segment as MSegment | AbsoluteSegment;\n // const values = segment.slice(1) as number[];\n if (absCommand === 'A') {\n return [\n absCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as ASegment)[6] + lastX,\n (segment as ASegment)[7] + lastY,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, (segment as VSegment)[1] + lastY] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, (segment as HSegment)[1] + lastX] as HSegment;\n } else if (absCommand === 'L') {\n return [absCommand, (segment as LSegment)[1] + lastX, (segment as LSegment)[2] + lastY] as LSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = (segment.slice(1) as number[]).map((n, j) => n + (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [absCommand as typeof absCommand | number].concat(absValues) as\n | MSegment\n | QSegment\n | TSegment\n | SSegment\n | CSegment;\n }\n};\nexport default absolutizeSegment;\n","// import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback, AbsoluteCommand } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n let absCommand = 'M' as AbsoluteCommand;\n let isRelative = false;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let segLen = 0;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n segLen = segment.length;\n absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n isRelative = absCommand !== pathCommand;\n\n const iteratorResult = iterator(segment, i, x, y);\n // some methods like getPointAtLength would like to break\n // when task is complete\n if (iteratorResult === false) {\n break;\n }\n\n // segment = path[i];\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n x = (segment[1] as number) + (isRelative ? x : 0);\n } else if (absCommand === 'V') {\n y = (segment[1] as number) + (isRelative ? y : 0);\n } else {\n x = (segment[segLen - 2] as number) + (isRelative ? x : 0);\n y = (segment[segLen - 1] as number) + (isRelative ? y : 0);\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n if (iteratorResult) {\n path[i] = iteratorResult;\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n }\n }\n return path as T;\n};\n\nexport default iterate;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n\n return iterate(path, absolutizeSegment);\n};\nexport default pathToAbsolute;\n","import type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n MSegment,\n lSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the relative segment\n */\nconst relativizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isRelative) return segment as MSegment | RelativeSegment;\n\n if (relCommand === 'a') {\n return [\n relCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as aSegment)[6] - lastX,\n (segment as aSegment)[7] - lastY,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, (segment as vSegment)[1] - lastY] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, (segment as hSegment)[1] - lastX] as hSegment;\n } else if (relCommand === 'l') {\n return [relCommand, (segment as lSegment)[1] - lastX, (segment as lSegment)[2] - lastY] as lSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = (segment.slice(1) as number[]).map((n, j) => n - (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [relCommand as RelativeCommand | number].concat(relValues) as qSegment | tSegment | sSegment | cSegment;\n }\n};\n\nexport default relativizeSegment;\n","import type { PathArray, RelativeArray } from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n const path = parsePathString(pathInput);\n\n return iterate(path, relativizeSegment);\n};\nexport default pathToRelative;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const { sin, cos } = Math;\n const X = x * cos(rad) - y * sin(rad);\n const Y = x * sin(rad) + y * cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n }\n res = [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [c1[0], c1[1], c2[0], c2[1], x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n // let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n return ['C' as string | number].concat(\n arcToCubic(px1, py1, values[0], values[1], values[2], values[3], values[4], values[5], values[6]),\n ) as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n return ['C' as string | number].concat(\n quadToCubic(px1, py1, values[0], values[1], values[2], values[3]),\n ) as CSegment;\n } else if (pathCommand === 'L') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, x, y)) as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, px, py)) as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import type { ParserParams } from '../interface';\nimport type {\n NormalSegment,\n PointTuple,\n PathSegment,\n QSegment,\n CSegment,\n LSegment,\n MSegment,\n HSegment,\n VSegment,\n ASegment,\n PathCommand,\n} from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the normalization parameters\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = pathCommand !== absCommand;\n const { x1: px1, y1: py1, x2: px2, y2: py2, x, y } = params;\n const values = segment.slice(1) as number[];\n let absValues = values.map((n, j) => n + (isRelative ? (j % 2 ? y : x) : 0));\n\n if (!'TQ'.includes(absCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n // istanbul ignore else @preserve\n if (absCommand === 'A') {\n absValues = values.slice(0, -2).concat(values[5] + (isRelative ? x : 0), values[6] + (isRelative ? y : 0));\n\n return ['A' as PathCommand | number].concat(absValues) as ASegment;\n } else if (absCommand === 'H') {\n return ['L', (segment as HSegment)[1] + (isRelative ? x : 0), py1] as LSegment;\n } else if (absCommand === 'V') {\n return ['L', px1, (segment as VSegment)[1] + (isRelative ? y : 0)] as LSegment;\n } else if (absCommand === 'L') {\n return [\n 'L',\n (segment as LSegment)[1] + (isRelative ? x : 0),\n (segment as LSegment)[2] + (isRelative ? y : 0),\n ] as LSegment;\n } else if (absCommand === 'M') {\n return [\n 'M',\n (segment as MSegment)[1] + (isRelative ? x : 0),\n (segment as MSegment)[2] + (isRelative ? y : 0),\n ] as MSegment;\n } else if (absCommand === 'C') {\n return ['C' as PathCommand | number].concat(absValues) as CSegment;\n } else if (absCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1].concat(absValues) as CSegment;\n } else if (absCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy].concat(absValues) as QSegment;\n } else if (absCommand === 'Q') {\n const [nqx, nqy] = absValues as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n return ['Q' as PathCommand | number].concat(absValues) as QSegment;\n } else if (absCommand === 'Z') {\n return ['Z'] as NormalSegment;\n }\n\n // istanbul ignore next @preserve\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n const params = { ...paramsParser };\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, index, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as AbsoluteCommand | number].concat(result.slice(7)) as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default pathToCurve;\n","const roundTo = (n: number, round: number) => {\n const pow = round >= 1 ? 10 ** round : 1;\n\n return round > 0 ? Math.round(n * pow) / pow : Math.round(n);\n};\n\nexport default roundTo;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport roundTo from '../math/roundTo';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param roundOption amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, roundOption?: number | 'off'): string => {\n const pathLen = path.length;\n let { round } = defaultOptions;\n let segment = path[0] as PathSegment;\n let result = '';\n\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n const [pathCommand] = segment;\n const values = segment.slice(1) as number[];\n result += pathCommand;\n if (round === 'off') {\n result += values.join(' ');\n } else {\n let j = 0;\n const valLen = values.length;\n while (j < valLen) {\n result += roundTo(values[j], round);\n if (j !== valLen - 1) result += ' ';\n j += 1;\n }\n }\n }\n\n return result;\n};\n\nexport default pathToString;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple) => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nconst getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nconst getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nconst getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n\nexport { getPointAtLineLength, getLineBBox, getLineLength };\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst arcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const length = Math.sqrt(term1 + term2) * theta;\n return Math.abs(length);\n};\n\n/**\n * Find point on ellipse at given angle around ellipse (theta);\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the arc rotation angle in radians\n * @param theta the arc sweep angle in radians\n * @returns a point around ellipse at given angle\n */\nconst arcPoint = (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => {\n const { sin, cos } = Math;\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cosA = cos(alpha);\n const sinA = sin(alpha);\n const x = rx * cos(theta);\n const y = ry * sin(theta);\n\n return {\n x: cx + cosA * x - sinA * y,\n y: cy + sinA * x + cosA * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle in radian\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n return sign * Math.acos(p / n);\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle,\n * end angle, and radiuses on X and Y axis.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n // istanbul ignore next @preserve\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x: (x + x1) / 2, y: (y + y1) / 2 },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nconst getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return arcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nconst getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = arcLength(rx, ry, endAngle - startAngle);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the extrema for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nconst getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n const { min, max, tan, atan2, PI } = Math;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const { x: cx, y: cy } = center;\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * PI) / 180;\n const tangent = tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = atan2(-ry * tangent, rx);\n const angle1 = theta;\n const angle2 = theta + PI;\n const angle3 = atan2(ry, rx * tangent);\n const angle4 = angle3 + PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = min(...xArr);\n const xMax = max(...xArr);\n const yMin = min(...yArr);\n const yMax = max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arcPoint(cx, cy, rx, ry, alpha, angleAfterStart);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arcPoint(cx, cy, rx, ry, alpha, angleBeforeEnd);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle1));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle2));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle4));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle3));\n }\n\n return {\n min: {\n x: min(...extremes.map(n => n.x)),\n y: min(...extremes.map(n => n.y)),\n },\n max: {\n x: max(...extremes.map(n => n.x)),\n y: max(...extremes.map(n => n.y)),\n },\n };\n};\n\nexport { arcPoint, angleBetween, getArcLength, arcLength, getArcBBox, getArcProps, getPointAtArcLength };\n\nexport {};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst deriveBezier = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst computeBezier = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], { x: 0, y: 0 } as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst calculateBezier = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst bezierLength = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * calculateBezier(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nconst getBezierLength = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = deriveBezier(points);\n return bezierLength((t: number) => {\n return computeBezier(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A an array which consist of X/Y values\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nconst minmaxQ = ([v1, cp, v2]: [number, number, number]) => {\n const min = Math.min(v1, v2);\n const max = Math.max(v1, v2);\n\n /* istanbul ignore next @preserve */\n if (cp >= v1 ? v2 >= cp : v2 <= cp) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (v1 * v2 - cp * cp) / (v1 - 2 * cp + v2);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A an array which consist of X/Y values\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nconst minmaxC = ([v1, cp1, cp2, v2]: [number, number, number, number]) => {\n const K = v1 - 3 * cp1 + 3 * cp2 - v2;\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (v1 === v2 && v1 === cp1) {\n // no curve, point targeting same location\n return [v1, v2] as PointTuple;\n }\n\n return minmaxQ([v1, -0.5 * v1 + 1.5 * cp1, v1 - 3 * cp1 + 3 * cp2]);\n }\n\n // the reduced discriminant of the derivative\n const T = -v1 * cp2 + v1 * v2 - cp1 * cp2 - cp1 * v2 + cp1 * cp1 + cp2 * cp2;\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(v1, v2), Math.max(v1, v2)] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(v1, v2);\n let max = Math.max(v1, v2);\n\n const L = v1 - 2 * cp1 + cp2;\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n v1 * (1 - R) * (1 - R) * (1 - R) + cp1 * 3 * (1 - R) * (1 - R) * R + cp2 * 3 * (1 - R) * R * R + v2 * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n\nexport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n};\n","import { getBezierLength, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nconst getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nconst getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nconst getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n","import { getBezierLength, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nconst getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return getBezierLength([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nconst getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n","import distanceSquareRoot from './distanceSquareRoot';\nimport { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]) => {\n const n = polygon.length;\n let i = -1;\n let a: PointTuple;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]) => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport { polygonArea, polygonLength };\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import normalizeSegment from './normalizeSegment';\nimport type { NormalArray, PathArray } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Normalizes a `pathArray` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n return iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default normalizePath;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport type { MSegment, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = normalizePath(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber || distance < DISTANCE_EPSILON) return point;\n\n // for (let i = 0; i < pathLen; i += 1) {\n iterate(path, (seg, _, lastX, lastY) => {\n [pathCommand] = seg;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(seg.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(data[0], data[1], data[2], data[3], distance - totalLength);\n length = getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n data[8],\n distance - totalLength,\n );\n length = getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n distance - totalLength,\n );\n length = getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(data[0], data[1], data[2], data[3], data[4], data[5], distance - totalLength);\n length = getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n point = { x: mx, y: my };\n\n length = getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n [x, y] = data.slice(-2);\n\n if (totalLength < distance) {\n POINT = point;\n } else {\n // totalLength >= distance\n // stop right here\n // stop iterator now!\n return false;\n }\n\n totalLength += length;\n return;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n return { x, y };\n }\n\n return POINT;\n};\n\nexport default getPointAtLength;\n","import type { MSegment, PathArray } from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\n// import normalizePath from '../process/normalizePath';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(normalSegment.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n const seglen = normalSegment.length;\n params.x1 = +normalSegment[seglen - 2];\n params.y1 = +normalSegment[seglen - 1];\n params.x2 = +normalSegment[seglen - 4] || params.x1;\n params.y2 = +normalSegment[seglen - 3] || params.y1;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import type { PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n segment = pathArray[index];\n return {\n segment,\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import type { PathArray, Point } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: Point): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(normalPath);\n const distanceTo = (p: Point) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: Point;\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, seg[1], seg[2], seg[3], seg[4], seg[5], seg[6]);\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport { MSegment, PathArray, Point } from '../types';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n const x = 0;\n const y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n const params = { ...paramsParser };\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n [pathCommand] = result;\n data = [lastX, lastY].concat(result.slice(1) as number[]);\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = result as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(data[0], data[1], data[2], data[3], data[4], data[5]));\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import defaultOptions from '../options/options';\nimport type { ParserParams } from '../interface';\nimport roundTo from '../math/roundTo';\nimport type { AbsoluteSegment, NormalSegment, PathCommand, ShortSegment, SSegment, TSegment } from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const { round: defaultRound } = defaultOptions;\n const round = typeof defaultRound === 'number' ? defaultRound : /* istanbul ignore next */ 4;\n const normalValues = normalSegment.slice(1) as number[];\n const { x1, y1, x2, y2, x, y } = params;\n const [nx, ny] = normalValues.slice(-2);\n const result = segment;\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'L') {\n if (roundTo(x, round) === roundTo(nx, round)) {\n return ['V', ny];\n } else if (roundTo(y, round) === roundTo(ny, round)) {\n return ['H', nx];\n }\n } else if (pathCommand === 'C') {\n const [nx1, ny1] = normalValues;\n params.x1 = nx1;\n params.y1 = ny1;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((roundTo(nx1, round) === roundTo(x1 * 2 - x2, round) && roundTo(ny1, round) === roundTo(y1 * 2 - y2, round)) ||\n (roundTo(x1, round) === roundTo(x2 * 2 - x, round) && roundTo(y1, round) === roundTo(y2 * 2 - y, round)))\n ) {\n return ['S', normalValues[2], normalValues[3], normalValues[4], normalValues[5]] as SSegment;\n }\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n roundTo(qx, round) === roundTo(x1 * 2 - x2, round) &&\n roundTo(qy, round) === roundTo(y1 * 2 - y2, round)\n ) {\n return ['T', normalValues[2], normalValues[3]] as TSegment;\n }\n }\n\n // ['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)\n return result as ShortSegment;\n};\n\nexport default shortenSegment;\n","import type { PathCommand, PathSegment } from '../types';\nimport roundTo from '../math/roundTo';\n\nconst roundSegment = (segment: T, roundOption: number) => {\n const values = (segment.slice(1) as number[]).map(n => roundTo(n, roundOption));\n return [segment[0] as PathCommand | number].concat(values) as T;\n};\n\nexport default roundSegment;\n","import pathToAbsolute from '../convert/pathToAbsolute';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport type { AbsoluteSegment, PathArray, PathCommand } from '../types';\nimport iterate from './iterate';\nimport normalizeSegment from './normalizeSegment';\nimport relativizeSegment from './relativizeSegment';\nimport roundSegment from './roundSegment';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param roundOption the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, roundOption: number) => {\n const path = pathToAbsolute(pathInput);\n // allow for ZERO decimals or use an aggressive value of 2\n const round =\n typeof roundOption === 'number' && roundOption >= 0 ? roundOption : /* istanbul ignore next @preserve */ 2;\n // this utility overrides the iterator params\n const optimParams = { ...paramsParser };\n\n const allPathCommands = [] as PathCommand[];\n let pathCommand = 'M' as PathCommand;\n let prevCommand = 'Z' as PathCommand;\n\n return iterate(path, (seg, i, lastX, lastY) => {\n optimParams.x = lastX;\n optimParams.y = lastY;\n // const absoluteSegment = absolutizeSegment(seg, optimParams);\n const normalizedSegment = normalizeSegment(seg, optimParams);\n let result = seg;\n [pathCommand] = seg;\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n if (i) {\n // Get previous path command for `shortenSegment`\n prevCommand = allPathCommands[i - 1];\n const shortSegment = shortenSegment(seg as AbsoluteSegment, normalizedSegment, optimParams, prevCommand);\n const absSegment = roundSegment(shortSegment, round);\n const absString = absSegment.join('');\n const relativeSegment = relativizeSegment(shortSegment, i, lastX, lastY);\n const relSegment = roundSegment(relativeSegment, round);\n const relString = relSegment.join('');\n result = absString.length < relString.length ? absSegment : relSegment;\n }\n\n const seglen = normalizedSegment.length;\n optimParams.x1 = +normalizedSegment[seglen - 2];\n optimParams.y1 = +normalizedSegment[seglen - 1];\n optimParams.x2 = +normalizedSegment[seglen - 4] || optimParams.x1;\n optimParams.y2 = +normalizedSegment[seglen - 3] || optimParams.y1;\n\n return result;\n });\n};\n\nexport default optimizePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(v[0], v[1], v[2]);\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [point2D[0], point2D[1], 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import type { CSegment, CurveArray, MSegment, PathCommand } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray) => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? path[0].slice(1).concat(x.slice(1) as number[]) : curveOnly[i - 1].slice(-2).concat(x.slice(1)),\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse() as (MSegment | CSegment)[];\n\n return [['M' as PathCommand | number].concat(rotatedCurve[0].slice(0, 2))].concat(\n rotatedCurve.map(x => ['C' as PathCommand | number].concat(x.slice(2))),\n ) as CurveArray;\n};\n\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n PointTuple,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\nimport iterate from './iterate';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance\n * with absolute values.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray) => {\n const absolutePath = pathToAbsolute(pathInput);\n const normalizedPath = normalizePath(absolutePath);\n const pLen = absolutePath.length;\n const isClosed = absolutePath[pLen - 1][0] === 'Z';\n\n const reversedPath = iterate(absolutePath, (segment, i) => {\n const normalizedSegment = normalizedPath[i];\n const prevSeg = i && absolutePath[i - 1];\n const prevCommand = prevSeg && prevSeg[0];\n const nextSeg = absolutePath[i + 1];\n const nextCommand = nextSeg && nextSeg[0];\n const [pathCommand] = segment;\n const [x, y] = normalizedPath[i ? i - 1 : pLen - 1].slice(-2) as PointTuple;\n let result = segment;\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [\n pathCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5] === 1 ? 0 : 1,\n x,\n y,\n ] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextCommand === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevCommand && 'CS'.includes(prevCommand) && (!nextSeg || nextCommand !== 'S')) {\n result = [\n 'C',\n normalizedSegment[3],\n normalizedSegment[4],\n normalizedSegment[1],\n normalizedSegment[2],\n x,\n y,\n ] as CSegment;\n } else {\n result = [pathCommand, normalizedSegment[1], normalizedSegment[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextCommand === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, segment[1], segment[2], x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevCommand && 'QT'.includes(prevCommand) && (!nextSeg || nextCommand !== 'T')) {\n result = ['Q', normalizedSegment[1], normalizedSegment[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand as typeof pathCommand | number].concat(segment.slice(1, -2), x, y) as PathSegment;\n }\n\n return result;\n });\n\n return (\n isClosed ? reversedPath.reverse() : [reversedPath[0] as PathSegment].concat(reversedPath.slice(1).reverse())\n ) as PathArray;\n};\n\nexport default reversePath;\n","import type { PathArray } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\nimport roundSegment from './roundSegment';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n /* istanbul ignore else @preserve */\n if (round === 'off') return path.slice(0) as PathArray;\n\n return iterate(path, segment => {\n return roundSegment(segment, round);\n });\n};\nexport default roundPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', p4[0], p4[1], p7[0], p7[1], p9[0], p9[1]],\n ['C', p8[0], p8[1], p6[0], p6[1], p3[0], p3[1]],\n ];\n};\nexport default splitCubic;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, AbsoluteSegment, CSegment, LSegment, PathArray, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n // last x and y transformed values\n let x = 0;\n let y = 0;\n // new x and y transformed\n let lx = 0;\n let ly = 0;\n // segment params iteration index and length\n let j = 0;\n let jj = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path.slice(0) as typeof path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path.slice(0) as typeof path;\n\n return iterate(path, (seg, index, lastX, lastY) => {\n transformParams.x = lastX;\n transformParams.y = lastY;\n [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = absCommand !== pathCommand;\n const absoluteSegment = isRelative\n ? absolutizeSegment(seg, index, lastX, lastY)\n : (seg.slice(0) as AbsoluteSegment);\n\n let result =\n absCommand === 'A'\n ? segmentToCubic(absoluteSegment, transformParams)\n : ['V', 'H'].includes(absCommand)\n ? normalizeSegment(absoluteSegment, transformParams)\n : absoluteSegment;\n\n // update pathCommand\n pathCommand = result[0];\n const isLongArc = pathCommand === 'C' && result.length > 7;\n const tempSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as AbsoluteSegment;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as typeof pathCommand | number].concat(result.slice(7)) as CSegment);\n result = tempSegment as CSegment;\n }\n\n if (pathCommand === 'L') {\n [lx, ly] = projection2d(matrixInstance, [(result as LSegment)[1], (result as LSegment)[2]], origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n const seglen = tempSegment.length;\n transformParams.x1 = +tempSegment[seglen - 2];\n transformParams.y1 = +tempSegment[seglen - 1];\n transformParams.x2 = +tempSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +tempSegment[seglen - 3] || transformParams.y1;\n\n return result;\n });\n};\n\nexport default transformPath;\n","'use strict';\nimport CSSMatrix from '@thednp/dommatrix';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\nimport * as arcTools from './math/arcTools';\nimport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n} from './math/bezier';\nimport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools';\nimport { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools';\nimport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools';\nimport { polygonArea, polygonLength } from './math/polygonTools';\n\nimport distanceSquareRoot from './math/distanceSquareRoot';\nimport midPoint from './math/midPoint';\nimport rotateVector from './math/rotateVector';\nimport roundTo from './math/roundTo';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\nimport finalizeSegment from './parser/finalizeSegment';\nimport invalidPathValue from './parser/invalidPathValue';\nimport isArcCommand from './parser/isArcCommand';\nimport isDigit from './parser/isDigit';\nimport isDigitStart from './parser/isDigitStart';\nimport isMoveCommand from './parser/isMoveCommand';\nimport isPathCommand from './parser/isPathCommand';\nimport isSpace from './parser/isSpace';\nimport paramsCount from './parser/paramsCount';\nimport paramsParser from './parser/paramsParser';\nimport pathParser from './parser/pathParser';\nimport scanFlag from './parser/scanFlag';\nimport scanParam from './parser/scanParam';\nimport scanSegment from './parser/scanSegment';\nimport skipSpaces from './parser/skipSpaces';\n\nimport distanceEpsilon from './util/distanceEpsilon';\nimport getClosestPoint from './util/getClosestPoint';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPathArea from './util/getPathArea';\nimport getPathBBox from './util/getPathBBox';\nimport getPointAtLength from './util/getPointAtLength';\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getTotalLength from './util/getTotalLength';\n\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport isPathArray from './util/isPathArray';\nimport isPointInStroke from './util/isPointInStroke';\nimport isRelativeArray from './util/isRelativeArray';\nimport isValidPath from './util/isValidPath';\nimport shapeParams from './util/shapeParams';\nimport shapeToPath from './util/shapeToPath';\nimport shapeToPathArray from './util/shapeToPathArray';\n\nimport absolutizeSegment from './process/absolutizeSegment';\nimport arcToCubic from './process/arcToCubic';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport iterate from './process/iterate';\nimport lineToCubic from './process/lineToCubic';\nimport normalizePath from './process/normalizePath';\nimport normalizeSegment from './process/normalizeSegment';\nimport optimizePath from './process/optimizePath';\nimport projection2d from './process/projection2d';\nimport quadToCubic from './process/quadToCubic';\nimport relativizeSegment from './process/relativizeSegment';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport roundPath from './process/roundPath';\nimport roundSegment from './process/roundSegment';\nimport segmentToCubic from './process/segmentToCubic';\nimport shortenSegment from './process/shortenSegment';\nimport splitCubic from './process/splitCubic';\nimport splitPath from './process/splitPath';\nimport transformPath from './process/transformPath';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n public static arcTools = arcTools;\n public static bezierTools = {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n };\n public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength };\n public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n public static polygonTools = { polygonArea, polygonLength };\n public static distanceSquareRoot = distanceSquareRoot;\n public static distanceEpsilon = distanceEpsilon;\n public static midPoint = midPoint;\n public static rotateVector = rotateVector;\n public static roundTo = roundTo;\n public static finalizeSegment = finalizeSegment;\n public static invalidPathValue = invalidPathValue;\n public static isArcCommand = isArcCommand;\n public static isDigit = isDigit;\n public static isDigitStart = isDigitStart;\n public static isMoveCommand = isMoveCommand;\n public static isPathCommand = isPathCommand;\n public static isSpace = isSpace;\n public static paramsCount = paramsCount;\n public static paramsParser = paramsParser;\n public static pathParser = pathParser;\n public static scanFlag = scanFlag;\n public static scanParam = scanParam;\n public static scanSegment = scanSegment;\n public static skipSpaces = skipSpaces;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static shapeParams = shapeParams;\n public static parsePathString = parsePathString;\n public static absolutizeSegment = absolutizeSegment;\n public static arcToCubic = arcToCubic;\n public static getSVGMatrix = getSVGMatrix;\n public static iterate = iterate;\n public static lineToCubic = lineToCubic;\n public static normalizePath = normalizePath;\n public static normalizeSegment = normalizeSegment;\n public static optimizePath = optimizePath;\n public static projection2d = projection2d;\n public static quadToCubic = quadToCubic;\n public static relativizeSegment = relativizeSegment;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static roundPath = roundPath;\n public static roundSegment = roundSegment;\n public static segmentToCubic = segmentToCubic;\n public static shortenSegment = shortenSegment;\n public static splitCubic = splitCubic;\n public static splitPath = splitPath;\n public static transformPath = transformPath;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n this.segments = parsePathString(pathValue);\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n const round = this.round === 'off' ? 2 : this.round;\n\n this.segments = optimizePath(segments, round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["Z","z","s","e","p","$","E","P","y","g","n","i","r","a","l","m","h","c","u","w","o","d","A","M","b","X","O","x","Y","F","T","k","I","v","R","D","N","defaultOptions","paramsCount","finalizeSegment","path","pathCommand","relativeCommand","data","error","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","PathParser","pathString","parsePathString","pathInput","absolutizeSegment","segment","lastX","lastY","absCommand","absValues","j","iterate","iterator","pathLen","isRelative","mx","my","segLen","iteratorResult","pathToAbsolute","relativizeSegment","relCommand","relValues","pathToRelative","rotateVector","rad","sin","cos","arcToCubic","X1","Y1","RX","RY","angle","LAF","SF","X2","Y2","recursive","x1","y1","rx","ry","x2","y2","d120","res","xy","f1","f2","cx","cy","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","t","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","qx","qy","r13","r23","midPoint","ax","ay","bx","by","lineToCubic","segmentToCubic","params","values","px1","py1","px","py","normalizeSegment","px2","py2","nqx","nqy","paramsParser","pathToCurve","seg","normalSegment","result","seglen","roundTo","round","pow","pathToString","roundOption","valLen","distanceSquareRoot","getLineLength","getPointAtLineLength","distance","point","length","getLineBBox","min","arcLength","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcPoint","alpha","cosA","sinA","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","tan","atan2","extremes","tangent","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","Tvalues","Cvalues","deriveBezier","points","dpoints","list","computeBezier","order","mt","mt2","t2","calculateBezier","derivativeFn","bezierLength","len","sum","getBezierLength","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","cp","v2","minmaxC","cp1","cp2","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","polygonArea","polygon","area","polygonLength","DISTANCE_EPSILON","normalizePath","_","getPointAtLength","isM","POINT","totalLength","getTotalLength","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getCubicSegArea","getPathArea","getDrawDirection","getPathBBox","MIN","MAX","width","height","getSegmentAtLength","getSegmentOfPoint","isPathArray","lk","isAbsoluteArray","isNormalizedArray","pc","isCurveArray","isPointInStroke","isRelativeArray","isValidPath","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","shapeToPath","replace","doc","description","name","value","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","shortenSegment","prevCommand","defaultRound","normalValues","nx","ny","nx1","ny1","roundSegment","optimizePath","optimParams","allPathCommands","normalizedSegment","shortSegment","absSegment","absString","relativeSegment","relSegment","relString","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","reverseCurve","rotatedCurve","curveOnly","reversePath","absolutePath","normalizedPath","pLen","isClosed","reversedPath","prevSeg","nextSeg","nextCommand","roundPath","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","splitPath","composite","pi","transformPath","lx","ly","jj","transformParams","transformProps","matrixInstance","absoluteSegment","isLongArc","tempSegment","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split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7BmE,EAxEIV,EAwEU,eAAe7C,IAC7BuD,EAzEIV,EAyEU,cAAclT,IAC5B4T,EA1EIV,EA0EU,oBAAoBrW,IAClC+W,EA3EIV,EA2EU,eAAevC,IAC7BiD,EA5EIV,EA4EU,cAAcpC,IAC5B8C,EA7EIV,EA6EU,YAAY3B,IAC1BqC,EA9EIV,EA8EU,eAAe1D,IAC7BoE,EA/EIV,EA+EU,iBAAiBvS,IAC/BiT,EAhFIV,EAgFU,iBAAiBlE,IAC/B4E,EAjFIV,EAiFU,aAAa1B,IAC3BoC,EAlFIV,EAkFU,YAAYb,IAC1BuB,EAnFIV,EAmFU,gBAAgBV","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/svg-path-commander.d.ts b/dist/svg-path-commander.d.ts index b3e7a7c..9b7b7ac 100644 --- a/dist/svg-path-commander.d.ts +++ b/dist/svg-path-commander.d.ts @@ -5,7 +5,6 @@ export type SegmentProperties = { index: number; length: number; lengthAtSegment: number; - [key: string]: any; }; export type PointProperties = { closest: { @@ -443,7 +442,49 @@ export type LineCoordinates = [ number ]; export type DeriveCallback = (t: number) => Point; -export type IteratorCallback = (segment: PathSegment, params: ParserParams, index: number) => PathSegment; +export type IteratorCallback = (segment: PathSegment, index: number, lastX: number, lastY: number) => PathSegment | false | void | undefined; +declare const arcLength: (rx: number, ry: number, theta: number) => number; +declare const arcPoint: (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => { + x: number; + y: number; +}; +declare const angleBetween: (v0: Point, v1: Point) => number; +declare const getArcProps: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => { + rx: number; + ry: number; + startAngle: number; + endAngle: number; + center: { + x: number; + y: number; + }; +}; +declare const getArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => number; +declare const getPointAtArcLength: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number, distance?: number) => { + x: number; + y: number; +}; +declare const getArcBBox: (x1: number, y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, x: number, y: number) => { + min: { + x: number; + y: number; + }; + max: { + x: number; + y: number; + }; +}; +declare class PathParser { + segments: PathArray | PathSegment[]; + pathValue: string; + max: number; + index: number; + param: number; + segmentStart: number; + data: (string | number)[]; + err: string; + constructor(pathString: string); +} /** * Creates a new SVGPathCommander instance with the following properties: * * segments: `pathArray` @@ -456,7 +497,130 @@ export type IteratorCallback = (segment: PathSegment, params: ParserParams, inde */ declare class SVGPathCommander { static CSSMatrix: typeof CSSMatrix$1; - static getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix$1; + static pathToAbsolute: (pathInput: string | PathArray) => AbsoluteArray; + static pathToRelative: (pathInput: string | PathArray) => RelativeArray; + static pathToCurve: (pathInput: string | PathArray) => CurveArray; + static pathToString: (path: PathArray, roundOption?: number | "off") => string; + static arcTools: typeof arcTools; + static bezierTools: { + Cvalues: number[]; + Tvalues: number[]; + minmaxC: ([v1, cp1, cp2, v2]: [ + number, + number, + number, + number + ]) => PointTuple; + minmaxQ: ([v1, cp, v2]: [ + number, + number, + number + ]) => PointTuple; + getBezierLength: (curve: CubicCoordinates | QuadCoordinates) => number; + bezierLength: (derivativeFn: DeriveCallback) => number; + calculateBezier: (derivativeFn: DeriveCallback, t: number) => number; + computeBezier: (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => DerivedPoint; + deriveBezier: (points: QuadPoints | CubicPoints) => (DerivedQuadPoints | DerivedCubicPoints)[]; + CBEZIER_MINMAX_EPSILON: number; + }; + static cubicTools: { + getCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => number; + getCubicBBox: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number) => { + min: { + x: number; + y: number; + }; + max: { + x: number; + y: number; + }; + }; + getPointAtCubicLength: (x1: number, y1: number, c1x: number, c1y: number, c2x: number, c2y: number, x2: number, y2: number, distance?: number) => { + x: number; + y: number; + }; + getPointAtCubicSegmentLength: ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => { + x: number; + y: number; + }; + }; + static lineTools: { + getPointAtLineLength: (x1: number, y1: number, x2: number, y2: number, distance?: number) => { + x: number; + y: number; + }; + getLineBBox: (x1: number, y1: number, x2: number, y2: number) => { + min: { + x: number; + y: number; + }; + max: { + x: number; + y: number; + }; + }; + getLineLength: (x1: number, y1: number, x2: number, y2: number) => number; + }; + static quadTools: { + getPointAtQuadSegmentLength: ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => { + x: number; + y: number; + }; + getQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => number; + getQuadBBox: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => { + min: { + x: number; + y: number; + }; + max: { + x: number; + y: number; + }; + }; + getPointAtQuadLength: (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number, distance?: number) => { + x: number; + y: number; + }; + }; + static polygonTools: { + polygonArea: (polygon: PointTuple[]) => number; + polygonLength: (polygon: PointTuple[]) => number; + }; + static distanceSquareRoot: (a: PointTuple, b: PointTuple) => number; + static distanceEpsilon: number; + static midPoint: (a: PointTuple, b: PointTuple, t: number) => PointTuple; + static rotateVector: (x: number, y: number, rad: number) => { + x: number; + y: number; + }; + static roundTo: (n: number, round: number) => number; + static finalizeSegment: (path: PathParser) => void; + static invalidPathValue: string; + static isArcCommand: (code: number) => code is 97; + static isDigit: (code: number) => code is DigitNumber; + static isDigitStart: (code: number) => code is DigitNumber | 43 | 45 | 46; + static isMoveCommand: (code: number) => code is 109 | 77; + static isPathCommand: (code: number) => code is PathCommandNumber; + static isSpace: (ch: number) => ch is SpaceNumber; + static paramsCount: { + a: number; + c: number; + h: number; + l: number; + m: number; + r: number; + q: number; + s: number; + t: number; + v: number; + z: number; + }; + static paramsParser: ParserParams; + static pathParser: typeof PathParser; + static scanFlag: (path: PathParser) => void; + static scanParam: (path: PathParser) => void; + static scanSegment: (path: PathParser) => void; + static skipSpaces: (path: PathParser) => void; static getPathBBox: (pathInput: PathArray | string) => { x: number; y: number; @@ -476,12 +640,7 @@ declare class SVGPathCommander { y: number; }; static getPropertiesAtLength: (pathInput: string | PathArray, distance?: number) => SegmentProperties; - static getPropertiesAtPoint: (pathInput: string | PathArray, point: { - x: number; - y: number; - }) => PointProperties; - static polygonLength: (polygon: PointTuple[]) => number; - static polygonArea: (polygon: PointTuple[]) => number; + static getPropertiesAtPoint: (pathInput: string | PathArray, point: Point) => PointProperties; static getClosestPoint: (pathInput: string | PathArray, point: { x: number; y: number; @@ -506,22 +665,47 @@ declare class SVGPathCommander { static isNormalizedArray: (path: unknown) => path is NormalArray; static shapeToPath: (element: ShapeTypes | ShapeOps, replace?: boolean, ownerDocument?: Document) => SVGPathElement | false; static shapeToPathArray: (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => false | PathArray; - static parsePathString: (pathInput: string | PathArray) => PathArray; + static shapeParams: ShapeParams; + static parsePathString: (pathInput: string | T) => PathArray; + static absolutizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => AbsoluteSegment; + static arcToCubic: (X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive?: [ + number, + number, + number, + number + ]) => number[]; + static getSVGMatrix: (transform: TransformObjectValues) => CSSMatrix$1; + static iterate: (path: PathArray, iterator: IteratorCallback) => T; + static lineToCubic: (x1: number, y1: number, x2: number, y2: number) => number[]; + static normalizePath: (pathInput: string | PathArray) => NormalArray; + static normalizeSegment: (segment: PathSegment, params: ParserParams) => NormalSegment; + static optimizePath: (pathInput: PathArray, roundOption: number) => PathArray; + static projection2d: (m: CSSMatrix$1, point2D: PointTuple, origin: [ + number, + number, + number + ]) => PointTuple; + static quadToCubic: (x1: number, y1: number, qx: number, qy: number, x2: number, y2: number) => [ + number, + number, + number, + number, + number, + number + ]; + static relativizeSegment: (segment: PathSegment, index: number, lastX: number, lastY: number) => MSegment | RelativeSegment; + static reverseCurve: (path: CurveArray) => CurveArray; + static reversePath: (pathInput: PathArray) => PathArray; static roundPath: (path: PathArray, roundOption?: number | "off") => PathArray; - static splitPath: (pathInput: PathArray) => PathArray[]; + static roundSegment: (segment: T, roundOption: number) => T; + static segmentToCubic: (segment: PathSegment, params: ParserParams) => MSegment | CSegment; + static shortenSegment: (segment: AbsoluteSegment, normalSegment: NormalSegment, params: ParserParams, prevCommand: PathCommand) => ShortSegment; static splitCubic: (pts: number[], ratio?: number) => [ CubicSegment, CubicSegment ]; - static optimizePath: (pathInput: PathArray, round: "off" | number) => PathArray; - static reverseCurve: (path: CurveArray) => CurveArray; - static reversePath: (pathInput: PathArray) => PathArray; - static normalizePath: (pathInput: string | PathArray) => NormalArray; + static splitPath: (pathInput: PathArray) => PathArray[]; static transformPath: (pathInput: PathArray | string, transform?: Partial) => PathArray; - static pathToAbsolute: (pathInput: string | PathArray) => AbsoluteArray; - static pathToRelative: (pathInput: string | PathArray) => RelativeArray; - static pathToCurve: (pathInput: string | PathArray) => CurveArray; - static pathToString: (path: PathArray, round?: number | "off") => string; segments: PathArray; round: number | "off"; origin: [ @@ -657,6 +841,10 @@ declare class SVGPathCommander { toString(): string; } +declare namespace arcTools { + export { angleBetween, arcLength, arcPoint, getArcBBox, getArcLength, getArcProps, getPointAtArcLength }; +} + export { SVGPathCommander as default, }; diff --git a/dist/svg-path-commander.js b/dist/svg-path-commander.js index 58cdc7c..c7372f0 100644 --- a/dist/svg-path-commander.js +++ b/dist/svg-path-commander.js @@ -1,2 +1,2 @@ -var SVGPathCommander=function(){"use strict";var on=Object.defineProperty;var cn=(z,L,j)=>L in z?on(z,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):z[L]=j;var A=(z,L,j)=>cn(z,typeof L!="symbol"?L+"":L,j);const z={origin:[0,0,0],round:4},L="SVGPathCommander Error",j={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},St=e=>{let t=e.pathValue[e.segmentStart],n=t.toLowerCase();const{data:r}=e;for(;r.length>=j[n]&&(n==="m"&&r.length>2?(e.segments.push([t,...r.splice(0,2)]),n="l",t=t==="m"?"l":"L"):e.segments.push([t,...r.splice(0,j[n])]),!!j[n]););},he=e=>{const{index:t,pathValue:n}=e,r=n.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${L}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`},Y=e=>e>=48&&e<=57,H="Invalid path value",fe=e=>{const{max:t,pathValue:n,index:r}=e;let s=r,i=!1,o=!1,c=!1,l=!1,a;if(s>=t){e.err=`${L}: ${H} at index ${s}, "pathValue" is missing param`;return}if(a=n.charCodeAt(s),(a===43||a===45)&&(s+=1,a=n.charCodeAt(s)),!Y(a)&&a!==46){e.err=`${L}: ${H} at index ${s}, "${n[s]}" is not a number`;return}if(a!==46){if(i=a===48,s+=1,a=n.charCodeAt(s),i&&s[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),nt=e=>{const{pathValue:t,max:n}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},xe=e=>Y(e)||e===43||e===45||e===46,pe=e=>(e|32)===97,de=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},$t=e=>{var l;const{max:t,pathValue:n,index:r,segments:s}=e,i=n.charCodeAt(r),o=j[n[r].toLowerCase()];if(e.segmentStart=r,!ge(i)){e.err=`${L}: ${H} "${n[r]}" is not a path command at index ${r}`;return}const c=s[s.length-1];if(!de(i)&&((l=c==null?void 0:c[0])==null?void 0:l.toLocaleLowerCase())==="z"){e.err=`${L}: ${H} "${n[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,nt(e),e.data=[],!o){St(e);return}for(;;){for(let a=o;a>0;a-=1){if(pe(i)&&(a===3||a===4)?he(e):fe(e),e.err.length)return;e.data.push(e.param),nt(e),e.index=e.max||!xe(n.charCodeAt(e.index)))break}St(e)};class kt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const I=e=>{if(typeof e!="string")return e.slice(0);const t=new kt(e);for(nt(t);t.index{const t=e.length;let n=-1,r,s=e[t-1],i=0;for(;++nMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),be=e=>e.reduce((t,n,r)=>r?t+Mt(e[r-1],n):0,0);var we=Object.defineProperty,Ne=(e,t,n)=>t in e?we(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>Ne(e,typeof t!="symbol"?t+"":t,n);const Ae={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},qt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),It=e=>e instanceof DOMMatrix||e instanceof v||typeof e=="object"&&Object.keys(Ae).every(t=>e&&t in e),st=e=>{const t=new v,n=Array.from(e);if(!qt(n))throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);if(n.length===16){const[r,s,i,o,c,l,a,m,u,g,f,h,y,x,p,d]=n;t.m11=r,t.a=r,t.m21=c,t.c=c,t.m31=u,t.m41=y,t.e=y,t.m12=s,t.b=s,t.m22=l,t.d=l,t.m32=g,t.m42=x,t.f=x,t.m13=i,t.m23=a,t.m33=f,t.m43=p,t.m14=o,t.m24=m,t.m34=h,t.m44=d}else if(n.length===6){const[r,s,i,o,c,l]=n;t.m11=r,t.a=r,t.m12=s,t.b=s,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=c,t.e=c,t.m42=l,t.f=l}return t},Et=e=>{if(It(e))return st([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},zt=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let n=new v;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(s=>s).forEach(s=>{const[i,o]=s.split("(");if(!o)throw TypeError(r);const c=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[l,a,m,u]=c,g=[l,a,m],f=[l,a,m,u];if(i==="perspective"&&l&&[a,m].every(h=>h===void 0))n.m34=-1/l;else if(i.includes("matrix")&&[6,16].includes(c.length)&&c.every(h=>!Number.isNaN(+h))){const h=c.map(y=>Math.abs(y)<1e-6?0:y);n=n.multiply(st(h))}else if(i==="translate3d"&&g.every(h=>!Number.isNaN(+h)))n=n.translate(l,a,m);else if(i==="translate"&&l&&m===void 0)n=n.translate(l,a||0,0);else if(i==="rotate3d"&&f.every(h=>!Number.isNaN(+h))&&u)n=n.rotateAxisAngle(l,a,m,u);else if(i==="rotate"&&l&&[a,m].every(h=>h===void 0))n=n.rotate(0,0,l);else if(i==="scale3d"&&g.every(h=>!Number.isNaN(+h))&&g.some(h=>h!==1))n=n.scale(l,a,m);else if(i==="scale"&&!Number.isNaN(l)&&l!==1&&m===void 0){const h=Number.isNaN(+a)?l:a;n=n.scale(l,h,1)}else if(i==="skew"&&(l||!Number.isNaN(l)&&a)&&m===void 0)n=n.skew(l,a||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&l&&[a,m].every(h=>h===void 0))if(i==="skewX"||i==="skewY")n=n[i](l);else{const h=i.replace(/[XYZ]/,""),y=i.replace(h,""),x=["X","Y","Z"].indexOf(y),p=h==="scale"?1:0,d=[x===0?l:p,x===1?l:p,x===2?l:p];n=n[h](...d)}else throw TypeError(r)}),n},bt=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],Zt=(e,t,n)=>{const r=new v;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=n,r},Ot=(e,t,n)=>{const r=new v,s=Math.PI/180,i=e*s,o=t*s,c=n*s,l=Math.cos(i),a=-Math.sin(i),m=Math.cos(o),u=-Math.sin(o),g=Math.cos(c),f=-Math.sin(c),h=m*g,y=-m*f;r.m11=h,r.a=h,r.m12=y,r.b=y,r.m13=u;const x=a*u*g+l*f;r.m21=x,r.c=x;const p=l*g-a*u*f;return r.m22=p,r.d=p,r.m23=-a*m,r.m31=a*f-l*u*g,r.m32=a*g+l*u*f,r.m33=l*m,r},jt=(e,t,n,r)=>{const s=new v,i=Math.sqrt(e*e+t*t+n*n);if(i===0)return s;const o=e/i,c=t/i,l=n/i,a=r*(Math.PI/360),m=Math.sin(a),u=Math.cos(a),g=m*m,f=o*o,h=c*c,y=l*l,x=1-2*(h+y)*g;s.m11=x,s.a=x;const p=2*(o*c*g+l*m*u);s.m12=p,s.b=p,s.m13=2*(o*l*g-c*m*u);const d=2*(c*o*g-l*m*u);s.m21=d,s.c=d;const C=1-2*(y+f)*g;return s.m22=C,s.d=C,s.m23=2*(c*l*g+o*m*u),s.m31=2*(l*o*g+c*m*u),s.m32=2*(l*c*g-o*m*u),s.m33=1-2*(f+h)*g,s},Rt=(e,t,n)=>{const r=new v;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=n,r},ot=(e,t)=>{const n=new v;if(e){const r=e*Math.PI/180,s=Math.tan(r);n.m21=s,n.c=s}if(t){const r=t*Math.PI/180,s=Math.tan(r);n.m12=s,n.b=s}return n},Dt=e=>ot(e,0),Qt=e=>ot(0,e),D=(e,t)=>{const n=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,s=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,c=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,l=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,a=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,m=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,u=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,g=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,f=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,y=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,x=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,p=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return st([n,r,s,i,o,c,l,a,m,u,g,f,h,y,x,p])};class v{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?zt(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?st(t):typeof t=="object"?Et(t):this}toFloat32Array(t){return Float32Array.from(bt(this,t))}toFloat64Array(t){return Float64Array.from(bt(this,t))}toString(){const{is2D:t}=this,n=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${n})`}toJSON(){const{is2D:t,isIdentity:n}=this;return{...this,is2D:t,isIdentity:n}}multiply(t){return D(this,t)}translate(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),D(this,Zt(s,i,o))}scale(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),D(this,Rt(s,i,o))}rotate(t,n,r){let s=t,i=n||0,o=r||0;return typeof t=="number"&&typeof n>"u"&&typeof r>"u"&&(o=s,s=0,i=0),D(this,Ot(s,i,o))}rotateAxisAngle(t,n,r,s){if([t,n,r,s].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return D(this,jt(t,n,r,s))}skewX(t){return D(this,Dt(t))}skewY(t){return D(this,Qt(t))}skew(t,n){return D(this,ot(t,n))}transformPoint(t){const n=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,s=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}k(v,"Translate",Zt),k(v,"Rotate",Ot),k(v,"RotateAxisAngle",jt),k(v,"Scale",Rt),k(v,"SkewX",Dt),k(v,"SkewY",Qt),k(v,"Skew",ot),k(v,"Multiply",D),k(v,"fromArray",st),k(v,"fromMatrix",Et),k(v,"fromString",zt),k(v,"toArray",bt),k(v,"isCompatibleArray",qt),k(v,"isCompatibleObject",It);const ct={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},Q=(e,t)=>{const n={...ct};let r=e.length,s;for(let i=0;i{const[n]=e,{x:r,y:s}=t,i=e.slice(1).map(Number),o=n.toUpperCase();if(!(o===n)){if(o==="A")return[o,i[0],i[1],i[2],i[3],i[4],i[5]+r,i[6]+s];if(o==="V")return[o,i[0]+s];if(o==="H")return[o,i[0]+r];{const l=i.map((a,m)=>a+(m%2?s:r));return[o,...l]}}return e},K=(e,t)=>{const[n]=e,{x1:r,y1:s,x2:i,y2:o}=t,c=e.slice(1).map(Number);if("TQ".includes(n)||(t.qx=null,t.qy=null),n==="H")return["L",e[1],s];if(n==="V")return["L",r,e[1]];if(n==="S"){const l=r*2-i,a=s*2-o;return t.x1=l,t.y1=a,["C",l,a,...c]}else if(n==="T"){const l=r*2-(t.qx?t.qx:0),a=s*2-(t.qy?t.qy:0);return t.qx=l,t.qy=a,["Q",l,a,...c]}else if(n==="Q"){const[l,a]=c;t.qx=l,t.qy=a}return e},X=(e,t,n)=>{const[r,s]=e,[i,o]=t;return[r+(i-r)*n,s+(o-s)*n]},lt=(e,t,n,r)=>Mt([e,t],[n,r]),Xt=(e,t,n,r,s)=>{const i=Mt([e,t],[n,r]);let o={x:e,y:t};if(typeof s=="number")if(s<=0)o={x:e,y:t};else if(s>=i)o={x:n,y:r};else{const[c,l]=X([e,t],[n,r],s/i);o={x:c,y:l}}return o},Bt=(e,t,n,r)=>{const{min:s,max:i}=Math;return{min:{x:s(e,n),y:s(t,r)},max:{x:i(e,n),y:i(t,r)}}},Yt=(e,t,n)=>{const r=n/2,s=Math.sin(r),i=Math.cos(r),o=e**2*s**2,c=t**2*i**2,l=Math.sqrt(o+c)*n;return Math.abs(l)},W=(e,t,n,r,s,i)=>{const o=Math.cos(i),c=Math.sin(i),l=r*Math.cos(e),a=s*Math.sin(e);return{x:t+o*l-c*a,y:n+c*l+o*a}},Ht=(e,t)=>{const{x:n,y:r}=e,{x:s,y:i}=t,o=n*s+r*i,c=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(o/c)},wt=(e,t,n,r,s,i,o,c,l)=>{const{abs:a,sin:m,cos:u,sqrt:g,PI:f}=Math;let h=a(n),y=a(r);const p=(s%360+360)%360*(f/180);if(e===c&&t===l)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};if(h===0||y===0)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};const d=(e-c)/2,C=(t-l)/2,M={x:u(p)*d+m(p)*C,y:-m(p)*d+u(p)*C},b=M.x**2/h**2+M.y**2/y**2;b>1&&(h*=g(b),y*=g(b));const N=h**2*y**2-h**2*M.y**2-y**2*M.x**2,S=h**2*M.y**2+y**2*M.x**2;let P=N/S;P=P<0?0:P;const q=(i!==o?1:-1)*g(P),$={x:q*(h*M.y/y),y:q*(-(y*M.x)/h)},tt={x:u(p)*$.x-m(p)*$.y+(e+c)/2,y:m(p)*$.x+u(p)*$.y+(t+l)/2},U={x:(M.x-$.x)/h,y:(M.y-$.y)/y},B=Ht({x:1,y:0},U),V={x:(-M.x-$.x)/h,y:(-M.y-$.y)/y};let E=Ht(U,V);!o&&E>0?E-=2*f:o&&E<0&&(E+=2*f),E%=2*f;const et=B+E;return{center:tt,startAngle:B,endAngle:et,rx:h,ry:y}},Ft=(e,t,n,r,s,i,o,c,l)=>{const{rx:a,ry:m,startAngle:u,endAngle:g}=wt(e,t,n,r,s,i,o,c,l);return Yt(a,m,g-u)},Ce=(e,t,n,r,s,i,o,c,l,a)=>{let m={x:e,y:t};const{center:u,rx:g,ry:f,startAngle:h,endAngle:y}=wt(e,t,n,r,s,i,o,c,l),x=Yt(g,f,y-h);if(typeof a=="number")if(a<=0)m={x:e,y:t};else if(a>=x)m={x:c,y:l};else{if(e===c&&t===l)return{x:c,y:l};if(g===0||f===0)return Xt(e,t,c,l,a);const{PI:p,cos:d,sin:C}=Math,M=y-h,N=(s%360+360)%360*(p/180),S=h+M*(a/x),P=g*d(S),q=f*C(S);m={x:d(N)*P-C(N)*q+u.x,y:C(N)*P+d(N)*q+u.y}}return m},ve=(e,t,n,r,s,i,o,c,l)=>{const{center:a,rx:m,ry:u,startAngle:g,endAngle:f}=wt(e,t,n,r,s,i,o,c,l),h=f-g,y={x:c,y:l},[x,p]=[a.x,a.y],d=[y],C=s*Math.PI/180,M=Math.tan(C),b=Math.atan2(-u*M,m),N=b,S=b+Math.PI,P=Math.atan2(u,m*M),q=P+Math.PI,$=[e,c],tt=[t,l],U=Math.min(...$),B=Math.max(...$),V=Math.min(...tt),E=Math.max(...tt),et=f-h*.001,Z=W(et,x,p,m,u,C),dt=f-h*.999,_=W(dt,x,p,m,u,C);return(Z.x>B||_.x>B)&&d.push(W(N,x,p,m,u,C)),(Z.xE||_.y>E)&&d.push(W(P,x,p,m,u,C)),{min:{x:Math.min(...d.map(R=>R.x)),y:Math.min(...d.map(R=>R.y))},max:{x:Math.max(...d.map(R=>R.x)),y:Math.max(...d.map(R=>R.y))}}},Pe={x:0,y:0},Ut=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Le=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],Te=e=>{const t=[];for(let n=e,r=n.length,s=r-1;r>1;r-=1,s-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const n=e.length-1;if(t===1)return e[n].t=1,e[n];const r=1-t;let s=e;if(n===0)return e[0].t=t,e[0];if(n===1)return{x:r*s[0].x+t*s[1].x,y:r*s[0].y+t*s[1].y,t};const i=r*r,o=t*t;let c=0,l=0,a=0,m=0;return n===2?(s=[s[0],s[1],s[2],Pe],c=i,l=r*t*2,a=o):n===3&&(c=i*r,l=i*t*3,a=r*o*3,m=t*o),{x:c*s[0].x+l*s[1].x+a*s[2].x+m*s[3].x,y:c*s[0].y+l*s[1].y+a*s[2].y+m*s[3].y,t}},$e=(e,t)=>{const n=e(t),r=n.x*n.x+n.y*n.y;return Math.sqrt(r)},ke=e=>{const n=Ut.length;let r=0;for(let s=0,i;s{const t=[];for(let r=0,s=e.length,i=2;rSe(n[0],r))},qe=1e-8,Nt=e=>{const t=Math.min(e[0],e[2]),n=Math.max(e[0],e[2]);if(e[1]>=e[0]?e[2]>=e[1]:e[2]<=e[1])return[t,n];const r=(e[0]*e[2]-e[1]*e[1])/(e[0]-2*e[1]+e[2]);return r{const t=e[0]-3*e[1]+3*e[2]-e[3];if(Math.abs(t)0&&c<1){const a=e[0]*(1-c)*(1-c)*(1-c)+e[1]*3*(1-c)*(1-c)*c+e[2]*3*(1-c)*c*c+e[3]*c*c*c;ai&&(i=a)}return[s,i]},Ie=([e,t,n,r,s,i,o,c],l)=>{const a=1-l;return{x:a**3*e+3*a**2*l*n+3*a*l**2*s+l**3*o,y:a**3*t+3*a**2*l*r+3*a*l**2*i+l**3*c}},_t=(e,t,n,r,s,i,o,c)=>at([e,t,n,r,s,i,o,c]),Ee=(e,t,n,r,s,i,o,c,l)=>{const a=typeof l=="number";let m={x:e,y:t};if(a){const u=at([e,t,n,r,s,i,o,c]);l<=0||(l>=u?m={x:o,y:c}:m=Ie([e,t,n,r,s,i,o,c],l/u))}return m},ze=(e,t,n,r,s,i,o,c)=>{const l=Vt([e,n,s,o]),a=Vt([t,r,i,c]);return{min:{x:l[0],y:a[0]},max:{x:l[1],y:a[1]}}},Ze=([e,t,n,r,s,i],o)=>{const c=1-o;return{x:c**2*e+2*c*o*n+o**2*s,y:c**2*t+2*c*o*r+o**2*i}},Jt=(e,t,n,r,s,i)=>at([e,t,n,r,s,i]),Oe=(e,t,n,r,s,i,o)=>{const c=typeof o=="number";let l={x:e,y:t};if(c){const a=at([e,t,n,r,s,i]);o<=0||(o>=a?l={x:s,y:i}:l=Ze([e,t,n,r,s,i],o/a))}return l},je=(e,t,n,r,s,i)=>{const o=Nt([e,n,s]),c=Nt([t,r,i]);return{min:{x:o[0],y:c[0]},max:{x:o[1],y:c[1]}}},Kt=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=I(e);let n=[],r="M",s=0,i=0,o=0,c=0;const l=[],a=[];let m={x:s,y:i},u={x:s,y:i};Q(t,(d,C)=>{const M=F(d,C),b=K(M,C);return[r]=b,n=[s,i,...b.slice(1)],r==="M"?([,o,c]=b,m={x:o,y:c},u={x:o,y:c}):r==="L"?{min:m,max:u}=Bt(...n):r==="A"?{min:m,max:u}=ve(...n):r==="C"?{min:m,max:u}=ze(...n):r==="Q"?{min:m,max:u}=je(...n):r==="Z"&&(n=[s,i,o,c],{min:m,max:u}=Bt(...n)),l.push(m),a.push(u),r==="Z"?(s=o,i=c):([s,i]=b.slice(-2),r==="M"&&(o=s,c=i)),C.x=s,C.y=i,b});const g=Math.min(...l.map(d=>d.x)),f=Math.max(...a.map(d=>d.x)),h=Math.min(...l.map(d=>d.y)),y=Math.max(...a.map(d=>d.y)),x=f-g,p=y-h;return{width:x,height:p,x:g,y:h,x2:f,y2:y,cx:g+x/2,cy:h+p/2,cz:Math.max(x,p)+Math.min(x,p)/2}},mt=(e,t,n)=>{const r=e*Math.cos(n)-t*Math.sin(n),s=e*Math.sin(n)+t*Math.cos(n);return{x:r,y:s}},Wt=(e,t,n,r,s,i,o,c,l,a)=>{let m=e,u=t,g=n,f=r,h=c,y=l;const x=Math.PI*120/180,p=Math.PI/180*(+s||0);let d=[],C,M,b,N,S;if(a)[M,b,N,S]=a;else{C=mt(m,u,-p),m=C.x,u=C.y,C=mt(h,y,-p),h=C.x,y=C.y;const T=(m-h)/2,O=(u-y)/2;let J=T*T/(g*g)+O*O/(f*f);J>1&&(J=Math.sqrt(J),g*=J,f*=J);const Lt=g*g,Tt=f*f,ue=(i===o?-1:1)*Math.sqrt(Math.abs((Lt*Tt-Lt*O*O-Tt*T*T)/(Lt*O*O+Tt*T*T)));N=ue*g*O/f+(m+h)/2,S=ue*-f*T/g+(u+y)/2,M=Math.asin(((u-S)/f*10**9>>0)/10**9),b=Math.asin(((y-S)/f*10**9>>0)/10**9),M=mb&&(M-=Math.PI*2),!o&&b>M&&(b-=Math.PI*2)}let P=b-M;if(Math.abs(P)>x){const T=b,O=h,J=y;b=M+x*(o&&b>M?1:-1),h=N+g*Math.cos(b),y=S+f*Math.sin(b),d=Wt(h,y,g,f,s,0,o,O,J,[b,T,N,S])}P=b-M;const q=Math.cos(M),$=Math.sin(M),tt=Math.cos(b),U=Math.sin(b),B=Math.tan(P/4),V=4/3*g*B,E=4/3*f*B,et=[m,u],Z=[m+V*$,u-E*q],dt=[h+V*U,y-E*tt],_=[h,y];if(Z[0]=2*et[0]-Z[0],Z[1]=2*et[1]-Z[1],a)return[...Z,...dt,..._,...d];d=[...Z,...dt,..._,...d];const R=[];for(let T=0,O=d.length;T{const o=.3333333333333333,c=2/3;return[o*e+c*n,o*t+c*r,o*s+c*n,o*i+c*r,s,i]},Gt=(e,t,n,r)=>{const s=X([e,t],[n,r],.3333333333333333),i=X([e,t],[n,r],2/3);return[...s,...i,n,r]},te=(e,t)=>{const[n]=e,r=e.slice(1).map(Number),[s,i]=r;let o;const{x1:c,y1:l,x:a,y:m}=t;return"TQ".includes(n)||(t.qx=null,t.qy=null),n==="M"?(t.x=s,t.y=i,e):n==="A"?(o=[c,l,...r],["C",...Wt(...o)]):n==="Q"?(t.qx=s,t.qy=i,o=[c,l,...r],["C",...Re(...o)]):n==="L"?["C",...Gt(c,l,s,i)]:n==="Z"?["C",...Gt(c,l,a,m)]:e},ut=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l,a)=>{const m=F(c,l);[i]=m;const u=i.toUpperCase(),g=K(m,l);let f=te(g,l);return f[0]==="C"&&f.length>7&&(o.splice(a+1,0,["C",...f.slice(7)]),f=f.slice(0,7)),u==="Z"?(t=r,n=s):([t,n]=f.slice(-2),u==="M"&&(r=t,s=n)),l.x=t,l.y=n,f})},De=(e,t,n,r,s,i,o,c)=>3*((c-t)*(n+s)-(o-e)*(r+i)+r*(e-s)-n*(t-i)+c*(s+e/3)-o*(i+t/3))/20,ee=e=>{let t=0,n=0,r=0;return ut(e).map(s=>{switch(s[0]){case"M":return[,t,n]=s,0;default:return r=De(t,n,...s.slice(1)),[t,n]=s.slice(-2),r}}).reduce((s,i)=>s+i,0)},G=e=>{const t=I(e);let n=!1,r=[],s="M",i=0,o=0,c=0,l=0,a=0;return Q(t,(m,u)=>{const g=F(m,u),f=K(g,u);return[s]=f,n=s==="M",r=n?r:[i,o,...f.slice(1)],n?[,c,l]=m:s==="L"?a+=lt(...r):s==="A"?a+=Ft(...r):s==="C"?a+=_t(...r):s==="Q"?a+=Jt(...r):s==="Z"&&(r=[i,o,c,l],a+=lt(...r)),s==="Z"?(i=c,o=l):([i,o]=f.slice(-2),n&&(c=i,l=o)),u.x=i,u.y=o,f}),a},Qe=e=>ee(ut(e))>=0,At=1e-5,rt=(e,t)=>{const n=I(e);let r=!1,s=[],i="M",o=0,c=0,[l,a]=n[0].slice(1);const m=typeof t=="number";let u={x:l,y:a},g=0,f=u,h=0;return m?(t{const p=F(y,x),d=K(p,x);return[i]=d,r=i==="M",s=r?s:[o,c,...d.slice(1)],r?([,l,a]=y,u={x:l,y:a},g=0):i==="L"?(u=Xt(...s,t-h),g=lt(...s)):i==="A"?(u=Ce(...s,t-h),g=Ft(...s)):i==="C"?(u=Ee(...s,t-h),g=_t(...s)):i==="Q"?(u=Oe(...s,t-h),g=Jt(...s)):i==="Z"&&(s=[o,c,l,a],u={x:l,y:a},g=lt(...s)),h=t&&(f=u),h+=g,i==="Z"?(o=l,c=a):([o,c]=d.slice(-2),i==="M"&&(l=o,a=c)),x.x=o,x.y=c,d}),t>h-At&&(f={x:o,y:c}),f):u},Ct=(e,t)=>{const n=I(e);let r=n.slice(0),s=G(r),i=r.length-1,o=0,c=0,l=n[0];const[a,m]=l.slice(-2),u={x:a,y:m};if(i<=0||!t||!Number.isFinite(t))return{segment:l,index:0,length:c,point:u,lengthAtSegment:o};if(t>=s)return r=n.slice(0,-1),o=G(r),c=s-o,{segment:n[i],index:i,length:c,lengthAtSegment:o};const g=[];for(;i>0;)l=r[i],r=r.slice(0,-1),o=G(r),c=s-o,s=o,g.push({segment:l,index:i,length:c,lengthAtSegment:o}),i-=1;return g.find(({lengthAtSegment:f})=>f<=t)},it=e=>{let t=0,n=0,r=0,s=0,i="M";return Q(I(e),(o,c)=>{const l=F(o,c),a=K(l,c);[i]=a;const m=i.toUpperCase();return m==="Z"?(t=r,n=s):([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),c.x=t,c.y=n,a})},ht=(e,t)=>{const n=I(e),r=it(n),s=G(n),i=M=>{const b=M.x-t.x,N=M.y-t.y;return b*b+N*N};let o=8,c,l={x:0,y:0},a=0,m=0,u=1/0;for(let M=0;M<=s;M+=o)c=rt(r,M),a=i(c),a1e-6&&(h=m-o,g=rt(r,h),x=i(g),y=m+o,f=rt(r,y),p=i(f),h>=0&&xht(e,t).closest,Be=(e,t)=>ht(e,t).segment,Ye=(e,t)=>Ct(e,t).segment,He=(e,t)=>{const{distance:n}=ht(e,t);return Math.abs(n){if(typeof e!="string"||!e.length)return!1;const t=new kt(e);for(nt(t);t.indexArray.isArray(e)&&e.every(t=>{const n=t[0].toLowerCase();return j[n]===t.length-1&&"achlmqstvz".includes(n)&&t.slice(1).every(Number.isFinite)})&&e.length>0,se=e=>ft(e)&&e.every(([t])=>t===t.toUpperCase()),Fe=e=>ft(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),re=e=>se(e)&&e.every(([t])=>"ACLMQZ".includes(t)),Ue=e=>re(e)&&e.every(([t])=>"MC".includes(t)),yt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]},Ve=e=>{let{x1:t,y1:n,x2:r,y2:s}=e;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t,n],["L",r,s]]},_e=e=>{const t=[],n=(e.points||"").trim().split(/[\s|,]/).map(s=>+s);let r=0;for(;r{let{cx:t,cy:n,r}=e;return[t,n,r]=[t,n,r].map(s=>+s),[["M",t-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},Ke=e=>{let{cx:t,cy:n}=e,r=e.rx||0,s=e.ry||r;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]},We=e=>{const t=+e.x||0,n=+e.y||0,r=+e.width,s=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>s&&(o-=(o*2-s)/2),[["M",t+i,n],["h",r-i*2],["s",i,0,i,o],["v",s-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-s+o*2],["s",0,-o,i,-o]]):[["M",t,n],["h",r],["v",s],["H",t],["Z"]]},ie=(e,t)=>{const r=(t||document).defaultView||window,s=Object.keys(yt),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...s,"path"].every(u=>o!==u))throw TypeError(`${L}: "${o}" is not SVGElement`);const c=i?o:e.type,l=yt[c],a={type:c};i?l.forEach(u=>{a[u]=e.getAttribute(u)}):Object.assign(a,e);let m=[];return c==="circle"?m=Je(a):c==="ellipse"?m=Ke(a):["polyline","polygon"].includes(c)?m=_e(a):c==="rect"?m=We(a):c==="line"?m=Ve(a):["glyph","path"].includes(c)&&(m=I(i?e.getAttribute("d")||"":e.d||"")),ft(m)&&m.length?m:!1},gt=(e,t)=>{let{round:n}=z;if(t==="off"||n==="off")return e.slice(0);n=typeof t=="number"&&t>=0?t:n;const r=typeof n=="number"&&n>=1?10**n:1;return Q(e,s=>{const i=s.slice(1).map(o=>n?Math.round(o*r)/r:Math.round(o));return[s[0],...i]})},vt=(e,t)=>gt(e,t).map(n=>n[0]+n.slice(1).join(" ")).join(""),Ge=(e,t,n)=>{const r=n||document,s=r.defaultView||window,i=Object.keys(yt),o=e instanceof s.SVGElement,c=o?e.tagName:null;if(c==="path")throw TypeError(`${L}: "${c}" is already SVGPathElement`);if(c&&i.every(y=>c!==y))throw TypeError(`${L}: "${c}" is not SVGElement`);const l=r.createElementNS("http://www.w3.org/2000/svg","path"),a=o?c:e.type,m=yt[a],u={type:a},g=z.round,f=ie(e,r),h=f&&f.length?vt(f,g):"";return o?(m.forEach(y=>{u[y]=e.getAttribute(y)}),Object.values(e.attributes).forEach(({name:y,value:x})=>{m.includes(y)||l.setAttribute(y,x)})):(Object.assign(u,e),Object.keys(u).forEach(y=>{!m.includes(y)&&y!=="type"&&l.setAttribute(y.replace(/[A-Z]/g,x=>`-${x.toLowerCase()}`),u[y])})),ne(h)?(l.setAttribute("d",h),t&&o&&(e.before(l,e),e.remove()),l):!1},oe=e=>{const t=[];let n,r=-1,s=0,i=0,o=0,c=0;const l={...ct};return e.forEach(a=>{const[m]=a,u=m.toUpperCase(),g=m.toLowerCase(),f=m===g,h=a.slice(1);u==="M"?(r+=1,[s,i]=h,s+=f?l.x:0,i+=f?l.y:0,o=s,c=i,n=[f?[u,o,c]:a]):(u==="Z"?(s=o,i=c):u==="H"?([,s]=a,s+=f?l.x:0):u==="V"?([,i]=a,i+=f?l.y:0):([s,i]=a.slice(-2),s+=f?l.x:0,i+=f?l.y:0),n.push(a)),l.x=s,l.y=i,t[r]=n}),t},ce=e=>{let t=new v;const{origin:n}=e,[r,s]=n,{translate:i}=e,{rotate:o}=e,{skew:c}=e,{scale:l}=e;return Array.isArray(i)&&i.length>=2&&i.every(a=>!Number.isNaN(+a))&&i.some(a=>a!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||c||l)&&(t=t.translate(r,s),Array.isArray(o)&&o.length>=2&&o.every(a=>!Number.isNaN(+a))&&o.some(a=>a!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(c)&&c.length===2&&c.every(a=>!Number.isNaN(+a))&&c.some(a=>a!==0)?(t=c[0]?t.skewX(c[0]):t,t=c[1]?t.skewY(c[1]):t):typeof c=="number"&&!Number.isNaN(c)&&(t=t.skewX(c)),Array.isArray(l)&&l.length>=2&&l.every(a=>!Number.isNaN(+a))&&l.some(a=>a!==1)?t=t.scale(...l):typeof l=="number"&&!Number.isNaN(l)&&(t=t.scale(l)),t=t.translate(-r,-s)),t},xt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l)=>{[i]=c;const a=F(c,l),m=i.toUpperCase();return m==="Z"?(t=r,n=s):m==="H"?[,t]=a:m==="V"?[,n]=a:([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),l.x=t,l.y=n,a})},tn=(e,t,n)=>{const[r]=e,{x:s,y:i}=t,o=e.slice(1).map(Number),c=r.toLowerCase();if(n===0&&r==="M")return e;if(r!==c){if(c==="a")return[c,o[0],o[1],o[2],o[3],o[4],o[5]-s,o[6]-i];if(c==="v")return[c,o[0]-i];if(c==="h")return[c,o[0]-s];{const l=o.map((a,m)=>a-(m%2?i:s));return[c,...l]}}return e},Pt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l,a)=>{[i]=c;const m=tn(c,l,a),[u]=m,g=i.toUpperCase(),f=i.toLowerCase(),h=u===f;return g==="Z"?(t=r,n=s):g==="H"?([,t]=m,t+=h?l.x:0):g==="V"?([,n]=m,n+=h?l.y:0):([t,n]=m.slice(-2),t+=h?l.x:0,n+=h?l.y:0,g==="M"&&(r=t,s=n)),l.x=t,l.y=n,m})},en=(e,t,n,r)=>{const[s]=e,i=p=>Math.round(p*10**4)/10**4,o=e.slice(1),c=t.slice(1),{x1:l,y1:a,x2:m,y2:u,x:g,y:f}=n;let h=e;const[y,x]=c.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))h=[s,...o];else if(s==="L")i(g)===i(y)?h=["V",x]:i(f)===i(x)&&(h=["H",y]);else if(s==="C"){const[p,d]=c;"CS".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["S",...c.slice(-4)]),n.x1=p,n.y1=d}else if(s==="Q"){const[p,d]=c;n.qx=p,n.qy=d,"QT".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["T",...c.slice(-2)])}return h},le=(e,t)=>{const n=xt(e),r=it(n),s={...ct},i=[],o=n.length;let c="",l="",a=0,m=0,u=0,g=0;for(let y=0;yx?y.join("").length{const t=e.slice(1).map((n,r,s)=>r?[...s[r-1].slice(-2),...n.slice(1)]:[...e[0].slice(1),...n.slice(1)]).map(n=>n.map((r,s)=>n[n.length-s-2*(1-s%2)])).reverse();return[["M",...t[0].slice(0,2)],...t.map(n=>["C",...n.slice(2)])]},pt=e=>{const t=xt(e),n=t.slice(-1)[0][0]==="Z",r=it(t).map((s,i)=>{const[o,c]=s.slice(-2).map(Number);return{seg:t[i],n:s,c:t[i][0],x:o,y:c}}).map((s,i,o)=>{const c=s.seg,l=s.n,a=i&&o[i-1],m=o[i+1],u=s.c,g=o.length,f=i?o[i-1].x:o[g-1].x,h=i?o[i-1].y:o[g-1].y;let y=[];switch(u){case"M":y=n?["Z"]:[u,f,h];break;case"A":y=[u,...c.slice(1,-3),c[5]===1?0:1,f,h];break;case"C":m&&m.c==="S"?y=["S",c[1],c[2],f,h]:y=[u,c[3],c[4],c[1],c[2],f,h];break;case"S":a&&"CS".includes(a.c)&&(!m||m.c!=="S")?y=["C",l[3],l[4],l[1],l[2],f,h]:y=[u,l[1],l[2],f,h];break;case"Q":m&&m.c==="T"?y=["T",f,h]:y=[u,...c.slice(1,-2),f,h];break;case"T":a&&"QT".includes(a.c)&&(!m||m.c!=="T")?y=["Q",l[1],l[2],f,h]:y=[u,f,h];break;case"Z":y=["M",f,h];break;case"H":y=[u,f];break;case"V":y=[u,h];break;default:y=[u,...c.slice(1,-2),f,h]}return y});return n?r.reverse():[r[0],...r.slice(1).reverse()]},sn=(e,t)=>{let n=v.Translate(...t.slice(0,-1));return[,,,n.m44]=t,n=e.multiply(n),[n.m41,n.m42,n.m43,n.m44]},ae=(e,t,n)=>{const[r,s,i]=n,[o,c,l]=sn(e,[...t,0,1]),a=o-r,m=c-s,u=l-i;return[a*(Math.abs(i)/Math.abs(u)||1)+r,m*(Math.abs(i)/Math.abs(u)||1)+s]},me=(e,t)=>{let n=0,r=0,s=0,i=0,o=0,c=0,l=0,a=0,m=0,u=0,g="M";const f={...ct},h=I(e),y=t&&Object.keys(t);if(!t||y&&!y.length)return h;t.origin||Object.assign(t,{origin:z.origin});const x=t.origin,p=ce(t);return p.isIdentity?h:Q(h,(d,C,M)=>{const b=F(d,f);[g]=b;let N=g==="A"?te(b,f):["V","H"].includes(g)?K(b,f):b;const S=N[0]==="C"&&N.length>7,P=S?N.slice(0,7):N.slice(0);if(S&&(h.splice(M+1,0,["C",...N.slice(7)]),N=N.slice(0,7)),N[0]==="L"){const $=N.slice(-2);[o,c]=ae(p,$,x),n!==o&&r!==c?N=["L",o,c]:r===c?N=["H",o]:n===o&&(N=["V",c])}else for(l=1,a=N.length;l{const n=t,r=e.slice(0,2),s=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),c=X(r,s,n),l=X(s,i,n),a=X(i,o,n),m=X(c,l,n),u=X(l,a,n),g=X(m,u,n);return[["C",...c,...m,...g],["C",...u,...a,...o]]};class w{constructor(t,n){const r=n||{},s=typeof t>"u";if(s||!t.length)throw TypeError(`${L}: "pathValue" is ${s?"undefined":"empty"}`);const i=I(t);this.segments=i;const{round:o,origin:c}=r;let l;Number.isInteger(o)||o==="off"?l=o:l=z.round;let a=z.origin;if(Array.isArray(c)&&c.length>=2){const[m,u,g]=c.map(Number);a=[Number.isNaN(m)?0:m,Number.isNaN(u)?0:u,Number.isNaN(g)?0:g]}return this.round=l,this.origin=a,this}get bbox(){return Kt(this.segments)}get length(){return G(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return rt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=xt(t),this}toRelative(){const{segments:t}=this;return this.segments=Pt(t),this}toCurve(){const{segments:t}=this;return this.segments=ut(t),this}reverse(t){this.toAbsolute();const{segments:n}=this,r=oe(n),s=r.length>1?r:!1,i=s?s.map((c,l)=>t?l?pt(c):c.slice(0):pt(c)):n.slice(0);let o=[];return s?o=i.flat(1):o=t?n:pt(n),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=it(t),this}optimize(){const{segments:t}=this;return this.segments=le(t,this.round),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(l=>l in t))return this;const{segments:n,origin:[r,s,i]}=this,o={};for(const[l,a]of Object.entries(t))l==="skew"&&Array.isArray(a)||(l==="rotate"||l==="translate"||l==="origin"||l==="scale")&&Array.isArray(a)?o[l]=a.map(Number):l!=="origin"&&typeof Number(a)=="number"&&(o[l]=Number(a));const{origin:c}=o;if(Array.isArray(c)&&c.length>=2){const[l,a,m]=c.map(Number);o.origin=[Number.isNaN(l)?r:l,Number.isNaN(a)?s:a,m||i]}else o.origin=[r,s,i];return this.segments=me(n,o),this}flipX(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,n,0]}),this}flipY(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,n,0]}),this}toString(){return vt(this.segments,this.round)}}return A(w,"CSSMatrix",v),A(w,"getSVGMatrix",ce),A(w,"getPathBBox",Kt),A(w,"getPathArea",ee),A(w,"getTotalLength",G),A(w,"getDrawDirection",Qe),A(w,"getPointAtLength",rt),A(w,"getPropertiesAtLength",Ct),A(w,"getPropertiesAtPoint",ht),A(w,"polygonLength",be),A(w,"polygonArea",Me),A(w,"getClosestPoint",Xe),A(w,"getSegmentOfPoint",Be),A(w,"getSegmentAtLength",Ye),A(w,"isPointInStroke",He),A(w,"isValidPath",ne),A(w,"isPathArray",ft),A(w,"isAbsoluteArray",se),A(w,"isRelativeArray",Fe),A(w,"isCurveArray",Ue),A(w,"isNormalizedArray",re),A(w,"shapeToPath",Ge),A(w,"shapeToPathArray",ie),A(w,"parsePathString",I),A(w,"roundPath",gt),A(w,"splitPath",oe),A(w,"splitCubic",rn),A(w,"optimizePath",le),A(w,"reverseCurve",nn),A(w,"reversePath",pt),A(w,"normalizePath",it),A(w,"transformPath",me),A(w,"pathToAbsolute",xt),A(w,"pathToRelative",Pt),A(w,"pathToCurve",ut),A(w,"pathToString",vt),w}(); +var SVGPathCommander=function(){"use strict";var an=Object.defineProperty;var ln=(Y,Q,$)=>Q in Y?an(Y,Q,{enumerable:!0,configurable:!0,writable:!0,value:$}):Y[Q]=$;var p=(Y,Q,$)=>ln(Y,typeof Q!="symbol"?Q+"":Q,$);var Y=Object.defineProperty,Q=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,$=(e,t,s)=>Q(e,typeof t!="symbol"?t+"":t,s);const Ze={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},Jt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),Yt=e=>e instanceof DOMMatrix||e instanceof C||typeof e=="object"&&Object.keys(Ze).every(t=>e&&t in e),ct=e=>{const t=new C,s=Array.from(e);if(!Jt(s))throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`);if(s.length===16){const[r,n,i,o,a,c,l,u,m,f,y,h,x,b,A,w]=s;t.m11=r,t.a=r,t.m21=a,t.c=a,t.m31=m,t.m41=x,t.e=x,t.m12=n,t.b=n,t.m22=c,t.d=c,t.m32=f,t.m42=b,t.f=b,t.m13=i,t.m23=l,t.m33=y,t.m43=A,t.m14=o,t.m24=u,t.m34=h,t.m44=w}else if(s.length===6){const[r,n,i,o,a,c]=s;t.m11=r,t.a=r,t.m12=n,t.b=n,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=a,t.e=a,t.m42=c,t.f=c}return t},Kt=e=>{if(Yt(e))return ct([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},Wt=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let s=new C;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(n=>n).forEach(n=>{const[i,o]=n.split("(");if(!o)throw TypeError(r);const a=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[c,l,u,m]=a,f=[c,l,u],y=[c,l,u,m];if(i==="perspective"&&c&&[l,u].every(h=>h===void 0))s.m34=-1/c;else if(i.includes("matrix")&&[6,16].includes(a.length)&&a.every(h=>!Number.isNaN(+h))){const h=a.map(x=>Math.abs(x)<1e-6?0:x);s=s.multiply(ct(h))}else if(i==="translate3d"&&f.every(h=>!Number.isNaN(+h)))s=s.translate(c,l,u);else if(i==="translate"&&c&&u===void 0)s=s.translate(c,l||0,0);else if(i==="rotate3d"&&y.every(h=>!Number.isNaN(+h))&&m)s=s.rotateAxisAngle(c,l,u,m);else if(i==="rotate"&&c&&[l,u].every(h=>h===void 0))s=s.rotate(0,0,c);else if(i==="scale3d"&&f.every(h=>!Number.isNaN(+h))&&f.some(h=>h!==1))s=s.scale(c,l,u);else if(i==="scale"&&!Number.isNaN(c)&&c!==1&&u===void 0){const h=Number.isNaN(+l)?c:l;s=s.scale(c,h,1)}else if(i==="skew"&&(c||!Number.isNaN(c)&&l)&&u===void 0)s=s.skew(c,l||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&c&&[l,u].every(h=>h===void 0))if(i==="skewX"||i==="skewY")s=s[i](c);else{const h=i.replace(/[XYZ]/,""),x=i.replace(h,""),b=["X","Y","Z"].indexOf(x),A=h==="scale"?1:0,w=[b===0?c:A,b===1?c:A,b===2?c:A];s=s[h](...w)}else throw TypeError(r)}),s},Ct=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],Vt=(e,t,s)=>{const r=new C;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=s,r},Gt=(e,t,s)=>{const r=new C,n=Math.PI/180,i=e*n,o=t*n,a=s*n,c=Math.cos(i),l=-Math.sin(i),u=Math.cos(o),m=-Math.sin(o),f=Math.cos(a),y=-Math.sin(a),h=u*f,x=-u*y;r.m11=h,r.a=h,r.m12=x,r.b=x,r.m13=m;const b=l*m*f+c*y;r.m21=b,r.c=b;const A=c*f-l*m*y;return r.m22=A,r.d=A,r.m23=-l*u,r.m31=l*y-c*m*f,r.m32=l*f+c*m*y,r.m33=c*u,r},te=(e,t,s,r)=>{const n=new C,i=Math.sqrt(e*e+t*t+s*s);if(i===0)return n;const o=e/i,a=t/i,c=s/i,l=r*(Math.PI/360),u=Math.sin(l),m=Math.cos(l),f=u*u,y=o*o,h=a*a,x=c*c,b=1-2*(h+x)*f;n.m11=b,n.a=b;const A=2*(o*a*f+c*u*m);n.m12=A,n.b=A,n.m13=2*(o*c*f-a*u*m);const w=2*(a*o*f-c*u*m);n.m21=w,n.c=w;const N=1-2*(x+y)*f;return n.m22=N,n.d=N,n.m23=2*(a*c*f+o*u*m),n.m31=2*(c*o*f+a*u*m),n.m32=2*(c*a*f-o*u*m),n.m33=1-2*(y+h)*f,n},ee=(e,t,s)=>{const r=new C;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=s,r},gt=(e,t)=>{const s=new C;if(e){const r=e*Math.PI/180,n=Math.tan(r);s.m21=n,s.c=n}if(t){const r=t*Math.PI/180,n=Math.tan(r);s.m12=n,s.b=n}return s},ne=e=>gt(e,0),se=e=>gt(0,e),B=(e,t)=>{const s=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,n=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,a=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,c=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,l=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,u=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,m=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,f=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,y=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,x=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,b=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,A=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return ct([s,r,n,i,o,a,c,l,u,m,f,y,h,x,b,A])};class C{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?Wt(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?ct(t):typeof t=="object"?Kt(t):this}toFloat32Array(t){return Float32Array.from(Ct(this,t))}toFloat64Array(t){return Float64Array.from(Ct(this,t))}toString(){const{is2D:t}=this,s=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${s})`}toJSON(){const{is2D:t,isIdentity:s}=this;return{...this,is2D:t,isIdentity:s}}multiply(t){return B(this,t)}translate(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),B(this,Vt(n,i,o))}scale(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),B(this,ee(n,i,o))}rotate(t,s,r){let n=t,i=s||0,o=r||0;return typeof t=="number"&&typeof s>"u"&&typeof r>"u"&&(o=n,n=0,i=0),B(this,Gt(n,i,o))}rotateAxisAngle(t,s,r,n){if([t,s,r,n].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return B(this,te(t,s,r,n))}skewX(t){return B(this,ne(t))}skewY(t){return B(this,se(t))}skew(t,s){return B(this,gt(t,s))}transformPoint(t){const s=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,n=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(s,r,n,i):{x:s,y:r,z:n,w:i}}}$(C,"Translate",Vt),$(C,"Rotate",Gt),$(C,"RotateAxisAngle",te),$(C,"Scale",ee),$(C,"SkewX",ne),$(C,"SkewY",se),$(C,"Skew",gt),$(C,"Multiply",B),$(C,"fromArray",ct),$(C,"fromMatrix",Kt),$(C,"fromString",Wt),$(C,"toArray",Ct),$(C,"isCompatibleArray",Jt),$(C,"isCompatibleObject",Yt);const K={origin:[0,0,0],round:4},nt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},Pt=e=>{let t=e.pathValue[e.segmentStart],s=t.toLowerCase();const{data:r}=e;for(;r.length>=nt[s]&&(s==="m"&&r.length>2?(e.segments.push([t].concat(r.splice(0,2))),s="l",t=t==="m"?"l":"L"):e.segments.push([t].concat(r.splice(0,nt[s]))),!!nt[s]););},I="SVGPathCommander Error",re=e=>{const{index:t,pathValue:s}=e,r=s.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${I}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`},F=e=>e>=48&&e<=57,H="Invalid path value",ie=e=>{const{max:t,pathValue:s,index:r}=e;let n=r,i=!1,o=!1,a=!1,c=!1,l;if(n>=t){e.err=`${I}: ${H} at index ${n}, "pathValue" is missing param`;return}if(l=s.charCodeAt(n),(l===43||l===45)&&(n+=1,l=s.charCodeAt(n)),!F(l)&&l!==46){e.err=`${I}: ${H} at index ${n}, "${s[n]}" is not a number`;return}if(l!==46){if(i=l===48,n+=1,l=s.charCodeAt(n),i&&n[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),st=e=>{const{pathValue:t,max:s}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},ae=e=>F(e)||e===43||e===45||e===46,le=e=>(e|32)===97,ue=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},$t=e=>{var c;const{max:t,pathValue:s,index:r,segments:n}=e,i=s.charCodeAt(r),o=nt[s[r].toLowerCase()];if(e.segmentStart=r,!ce(i)){e.err=`${I}: ${H} "${s[r]}" is not a path command at index ${r}`;return}const a=n[n.length-1];if(!ue(i)&&((c=a==null?void 0:a[0])==null?void 0:c.toLocaleLowerCase())==="z"){e.err=`${I}: ${H} "${s[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,st(e),e.data=[],!o){Pt(e);return}for(;;){for(let l=o;l>0;l-=1){if(le(i)&&(l===3||l===4)?re(e):ie(e),e.err.length)return;e.data.push(e.param),st(e),e.index=e.max||!ae(s.charCodeAt(e.index)))break}Pt(e)};class zt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const E=e=>{if(typeof e!="string")return e.slice(0);const t=new zt(e);for(st(t);t.index{const[n]=e,i=n.toUpperCase();if(t===0||i===n)return e;if(i==="A")return[i,e[1],e[2],e[3],e[4],e[5],e[6]+s,e[7]+r];if(i==="V")return[i,e[1]+r];if(i==="H")return[i,e[1]+s];if(i==="L")return[i,e[1]+s,e[2]+r];{const a=e.slice(1).map((c,l)=>c+(l%2?r:s));return[i].concat(a)}},R=(e,t)=>{let s=e.length,r,n="M",i="M",o=!1,a=0,c=0,l=0,u=0,m=0;for(let f=0;f{const t=E(e);return R(t,qt)},kt=(e,t,s,r)=>{const[n]=e,i=n.toLowerCase();if(t===0||n===i)return e;if(i==="a")return[i,e[1],e[2],e[3],e[4],e[5],e[6]-s,e[7]-r];if(i==="v")return[i,e[1]-r];if(i==="h")return[i,e[1]-s];if(i==="l")return[i,e[1]-s,e[2]-r];{const a=e.slice(1).map((c,l)=>c-(l%2?r:s));return[i].concat(a)}},me=e=>{const t=E(e);return R(t,kt)},at=(e,t,s)=>{const{sin:r,cos:n}=Math,i=e*n(s)-t*r(s),o=e*r(s)+t*n(s);return{x:i,y:o}},It=(e,t,s,r,n,i,o,a,c,l)=>{let u=e,m=t,f=s,y=r,h=a,x=c;const b=Math.PI*120/180,A=Math.PI/180*(+n||0);let w=[],N,M,d,v,L;if(l)[M,d,v,L]=l;else{N=at(u,m,-A),u=N.x,m=N.y,N=at(h,x,-A),h=N.x,x=N.y;const P=(u-h)/2,q=(m-x)/2;let _=P*P/(f*f)+q*q/(y*y);_>1&&(_=Math.sqrt(_),f*=_,y*=_);const J=f*f,D=y*y,De=(i===o?-1:1)*Math.sqrt(Math.abs((J*D-J*q*q-D*P*P)/(J*q*q+D*P*P)));v=De*f*q/y+(u+h)/2,L=De*-y*P/f+(m+x)/2,M=Math.asin(((m-L)/y*10**9>>0)/10**9),d=Math.asin(((x-L)/y*10**9>>0)/10**9),M=ud&&(M-=Math.PI*2),!o&&d>M&&(d-=Math.PI*2)}let T=d-M;if(Math.abs(T)>b){const P=d,q=h,_=x;d=M+b*(o&&d>M?1:-1),h=v+f*Math.cos(d),x=L+y*Math.sin(d),w=It(h,x,f,y,n,0,o,q,_,[d,P,v,L])}T=d-M;const O=Math.cos(M),k=Math.sin(M),yt=Math.cos(d),it=Math.sin(d),X=Math.tan(T/4),ot=4/3*f*X,j=4/3*y*X,G=[u,m],S=[u+ot*k,m-j*O],tt=[h+ot*it,x-j*yt],et=[h,x];if(S[0]=2*G[0]-S[0],S[1]=2*G[1]-S[1],l)return[S[0],S[1],tt[0],tt[1],et[0],et[1]].concat(w);w=[S[0],S[1],tt[0],tt[1],et[0],et[1]].concat(w);const xt=[];for(let P=0,q=w.length;P{const o=.3333333333333333,a=2/3;return[o*e+a*s,o*t+a*r,o*n+a*s,o*i+a*r,n,i]},Z=(e,t,s)=>{const[r,n]=e,[i,o]=t;return[r+(i-r)*s,n+(o-n)*s]},Et=(e,t,s,r)=>{const n=Z([e,t],[s,r],.3333333333333333),i=Z([e,t],[s,r],2/3);return[n[0],n[1],i[0],i[1],s,r]},Rt=(e,t)=>{const[s]=e,r=e.slice(1).map(Number),[n,i]=r,{x1:o,y1:a,x:c,y:l}=t;return"TQ".includes(s)||(t.qx=null,t.qy=null),s==="M"?(t.x=n,t.y=i,e):s==="A"?["C"].concat(It(o,a,r[0],r[1],r[2],r[3],r[4],r[5],r[6])):s==="Q"?(t.qx=n,t.qy=i,["C"].concat(he(o,a,r[0],r[1],r[2],r[3]))):s==="L"?["C"].concat(Et(o,a,n,i)):s==="Z"?["C"].concat(Et(o,a,c,l)):e},W=(e,t)=>{const[s]=e,r=s.toUpperCase(),n=s!==r,{x1:i,y1:o,x2:a,y2:c,x:l,y:u}=t,m=e.slice(1);let f=m.map((y,h)=>y+(n?h%2?u:l:0));if("TQ".includes(r)||(t.qx=null,t.qy=null),r==="A")return f=m.slice(0,-2).concat(m[5]+(n?l:0),m[6]+(n?u:0)),["A"].concat(f);if(r==="H")return["L",e[1]+(n?l:0),o];if(r==="V")return["L",i,e[1]+(n?u:0)];if(r==="L")return["L",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="M")return["M",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="C")return["C"].concat(f);if(r==="S"){const y=i*2-a,h=o*2-c;return t.x1=y,t.y1=h,["C",y,h].concat(f)}else if(r==="T"){const y=i*2-(t.qx?t.qx:0),h=o*2-(t.qy?t.qy:0);return t.qx=y,t.qy=h,["Q",y,h].concat(f)}else if(r==="Q"){const[y,h]=f;return t.qx=y,t.qy=h,["Q"].concat(f)}else if(r==="Z")return["Z"];return e},U={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},bt=e=>{const t={...U},s=E(e);return R(s,(r,n,i,o)=>{t.x=i,t.y=o;const a=W(r,t);let c=Rt(a,t);c[0]==="C"&&c.length>7&&(s.splice(n+1,0,["C"].concat(c.slice(7))),c=c.slice(0,7));const u=c.length;return t.x1=+c[u-2],t.y1=+c[u-1],t.x2=+c[u-4]||t.x1,t.y2=+c[u-3]||t.y1,c})},z=(e,t)=>{const s=t>=1?10**t:1;return t>0?Math.round(e*s)/s:Math.round(e)},jt=(e,t)=>{const s=e.length;let{round:r}=K,n=e[0],i="";r=t==="off"||typeof t=="number"&&t>=0?t:typeof r=="number"&&r>=0?r:"off";for(let o=0;oMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),lt=(e,t,s,r)=>dt([e,t],[s,r]),St=(e,t,s,r,n)=>{let i={x:e,y:t};if(typeof n=="number"){const o=dt([e,t],[s,r]);if(n<=0)i={x:e,y:t};else if(n>=o)i={x:s,y:r};else{const[a,c]=Z([e,t],[s,r],n/o);i={x:a,y:c}}}return i},Dt=(e,t,s,r)=>{const{min:n,max:i}=Math;return{min:{x:n(e,s),y:n(t,r)},max:{x:i(e,s),y:i(t,r)}}},Zt=(e,t,s)=>{const r=s/2,n=Math.sin(r),i=Math.cos(r),o=e**2*n**2,a=t**2*i**2,c=Math.sqrt(o+a)*s;return Math.abs(c)},V=(e,t,s,r,n,i)=>{const{sin:o,cos:a}=Math,c=a(n),l=o(n),u=s*a(i),m=r*o(i);return{x:e+c*u-l*m,y:t+l*u+c*m}},Ot=(e,t)=>{const{x:s,y:r}=e,{x:n,y:i}=t,o=s*n+r*i,a=Math.sqrt((s**2+r**2)*(n**2+i**2));return(s*i-r*n<0?-1:1)*Math.acos(o/a)},At=(e,t,s,r,n,i,o,a,c)=>{const{abs:l,sin:u,cos:m,sqrt:f,PI:y}=Math;let h=l(s),x=l(r);const A=(n%360+360)%360*(y/180);if(e===a&&t===c)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:a,y:c}};if(h===0||x===0)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:(a+e)/2,y:(c+t)/2}};const w=(e-a)/2,N=(t-c)/2,M={x:m(A)*w+u(A)*N,y:-u(A)*w+m(A)*N},d=M.x**2/h**2+M.y**2/x**2;d>1&&(h*=f(d),x*=f(d));const v=h**2*x**2-h**2*M.y**2-x**2*M.x**2,L=h**2*M.y**2+x**2*M.x**2;let T=v/L;T=T<0?0:T;const O=(i!==o?1:-1)*f(T),k={x:O*(h*M.y/x),y:O*(-(x*M.x)/h)},yt={x:m(A)*k.x-u(A)*k.y+(e+a)/2,y:u(A)*k.x+m(A)*k.y+(t+c)/2},it={x:(M.x-k.x)/h,y:(M.y-k.y)/x},X=Ot({x:1,y:0},it),ot={x:(-M.x-k.x)/h,y:(-M.y-k.y)/x};let j=Ot(it,ot);!o&&j>0?j-=2*y:o&&j<0&&(j+=2*y),j%=2*y;const G=X+j;return{center:yt,startAngle:X,endAngle:G,rx:h,ry:x}},Qt=(e,t,s,r,n,i,o,a,c)=>{const{rx:l,ry:u,startAngle:m,endAngle:f}=At(e,t,s,r,n,i,o,a,c);return Zt(l,u,f-m)},fe=(e,t,s,r,n,i,o,a,c,l)=>{let u={x:e,y:t};const{center:m,rx:f,ry:y,startAngle:h,endAngle:x}=At(e,t,s,r,n,i,o,a,c);if(typeof l=="number"){const b=Zt(f,y,x-h);if(l<=0)u={x:e,y:t};else if(l>=b)u={x:a,y:c};else{if(e===a&&t===c)return{x:a,y:c};if(f===0||y===0)return St(e,t,a,c,l);const{PI:A,cos:w,sin:N}=Math,M=x-h,v=(n%360+360)%360*(A/180),L=h+M*(l/b),T=f*w(L),O=y*N(L);u={x:w(v)*T-N(v)*O+m.x,y:N(v)*T+w(v)*O+m.y}}}return u},ye=(e,t,s,r,n,i,o,a,c)=>{const{center:l,rx:u,ry:m,startAngle:f,endAngle:y}=At(e,t,s,r,n,i,o,a,c),h=y-f,{min:x,max:b,tan:A,atan2:w,PI:N}=Math,M={x:a,y:c},{x:d,y:v}=l,L=[M],T=n*N/180,O=A(T),k=w(-m*O,u),yt=k,it=k+N,X=w(m,u*O),ot=X+N,j=[e,a],G=[t,c],S=x(...j),tt=b(...j),et=x(...G),xt=b(...G),P=y-h*.001,q=V(d,v,u,m,T,P),_=y-h*.999,J=V(d,v,u,m,T,_);return(q.x>tt||J.x>tt)&&L.push(V(d,v,u,m,T,yt)),(q.xxt||J.y>xt)&&L.push(V(d,v,u,m,T,X)),{min:{x:x(...L.map(D=>D.x)),y:x(...L.map(D=>D.y))},max:{x:b(...L.map(D=>D.x)),y:b(...L.map(D=>D.y))}}},Oe=Object.freeze(Object.defineProperty({__proto__:null,angleBetween:Ot,arcLength:Zt,arcPoint:V,getArcBBox:ye,getArcLength:Qt,getArcProps:At,getPointAtArcLength:fe},Symbol.toStringTag,{value:"Module"})),Bt=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],xe=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],ge=e=>{const t=[];for(let s=e,r=s.length,n=r-1;r>1;r-=1,n-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const s=e.length-1;if(t===1)return e[s].t=1,e[s];const r=1-t;let n=e;if(s===0)return e[0].t=t,e[0];if(s===1)return{x:r*n[0].x+t*n[1].x,y:r*n[0].y+t*n[1].y,t};const i=r*r,o=t*t;let a=0,c=0,l=0,u=0;return s===2?(n=[n[0],n[1],n[2],{x:0,y:0}],a=i,c=r*t*2,l=o):s===3&&(a=i*r,c=i*t*3,l=r*o*3,u=t*o),{x:a*n[0].x+c*n[1].x+l*n[2].x+u*n[3].x,y:a*n[0].y+c*n[1].y+l*n[2].y+u*n[3].y,t}},be=(e,t)=>{const s=e(t),r=s.x*s.x+s.y*s.y;return Math.sqrt(r)},de=e=>{const s=Bt.length;let r=0;for(let n=0,i;n{const t=[];for(let r=0,n=e.length,i=2;rpe(s[0],r))},Ae=1e-8,Mt=([e,t,s])=>{const r=Math.min(e,s),n=Math.max(e,s);if(t>=e?s>=t:s<=t)return[r,n];const i=(e*s-t*t)/(e-2*t+s);return i{const n=e-3*t+3*s-r;if(Math.abs(n)0&&u<1){const f=e*(1-u)*(1-u)*(1-u)+t*3*(1-u)*(1-u)*u+s*3*(1-u)*u*u+r*u*u*u;fc&&(c=f)}return[a,c]},Me=([e,t,s,r,n,i,o,a],c)=>{const l=1-c;return{x:l**3*e+3*l**2*c*s+3*l*c**2*n+c**3*o,y:l**3*t+3*l**2*c*r+3*l*c**2*i+c**3*a}},Ft=(e,t,s,r,n,i,o,a)=>ut([e,t,s,r,n,i,o,a]),we=(e,t,s,r,n,i,o,a,c)=>{const l=typeof c=="number";let u={x:e,y:t};if(l){const m=ut([e,t,s,r,n,i,o,a]);c<=0||(c>=m?u={x:o,y:a}:u=Me([e,t,s,r,n,i,o,a],c/m))}return u},Ne=(e,t,s,r,n,i,o,a)=>{const c=_t([e,s,n,o]),l=_t([t,r,i,a]);return{min:{x:c[0],y:l[0]},max:{x:c[1],y:l[1]}}},Le=([e,t,s,r,n,i],o)=>{const a=1-o;return{x:a**2*e+2*a*o*s+o**2*n,y:a**2*t+2*a*o*r+o**2*i}},Ht=(e,t,s,r,n,i)=>ut([e,t,s,r,n,i]),ve=(e,t,s,r,n,i,o)=>{const a=typeof o=="number";let c={x:e,y:t};if(a){const l=ut([e,t,s,r,n,i]);o<=0||(o>=l?c={x:n,y:i}:c=Le([e,t,s,r,n,i],o/l))}return c},Te=(e,t,s,r,n,i)=>{const o=Mt([e,s,n]),a=Mt([t,r,i]);return{min:{x:o[0],y:a[0]},max:{x:o[1],y:a[1]}}},Qe=e=>{const t=e.length;let s=-1,r,n=e[t-1],i=0;for(;++se.reduce((t,s,r)=>r?t+dt(e[r-1],s):0,0),wt=1e-5,mt=e=>{const t=E(e),s={...U};return R(t,(r,n,i,o)=>{s.x=i,s.y=o;const a=W(r,s),c=a.length;return s.x1=+a[c-2],s.y1=+a[c-1],s.x2=+a[c-4]||s.x1,s.y2=+a[c-3]||s.y1,a})},ht=(e,t)=>{const s=mt(e);let r=!1,n=[],i="M",o=0,a=0,[c,l]=s[0].slice(1);const u=typeof t=="number";let m={x:c,y:l},f=0,y=m,h=0;return!u||t{if([i]=x,r=i==="M",n=r?n:[A,w].concat(x.slice(1)),r?([,c,l]=x,m={x:c,y:l},f=0):i==="L"?(m=St(n[0],n[1],n[2],n[3],t-h),f=lt(n[0],n[1],n[2],n[3])):i==="A"?(m=fe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],t-h),f=Qt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])):i==="C"?(m=we(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],t-h),f=Ft(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7])):i==="Q"?(m=ve(n[0],n[1],n[2],n[3],n[4],n[5],t-h),f=Ht(n[0],n[1],n[2],n[3],n[4],n[5])):i==="Z"&&(n=[A,w,c,l],m={x:c,y:l},f=lt(n[0],n[1],n[2],n[3])),[o,a]=n.slice(-2),hh-wt?{x:o,y:a}:y)},rt=e=>{const t=E(e),s={...U};let r=!1,n=[],i="M",o=0,a=0,c=0;return R(t,(l,u,m,f)=>{s.x=m,s.y=f;const y=W(l,s);[i]=y,r=i==="M",n=r?n:[m,f].concat(y.slice(1)),r?[,o,a]=y:i==="L"?c+=lt(n[0],n[1],n[2],n[3]):i==="A"?c+=Qt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]):i==="C"?c+=Ft(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):i==="Q"?c+=Ht(n[0],n[1],n[2],n[3],n[4],n[5]):i==="Z"&&(n=[m,f,o,a],c+=lt(n[0],n[1],n[2],n[3]));const h=y.length;s.x1=+y[h-2],s.y1=+y[h-1],s.x2=+y[h-4]||s.x1,s.y2=+y[h-3]||s.y1}),c},Ut=(e,t)=>{const s=E(e);let r=s.slice(0),n=rt(r),i=r.length-1,o=0,a=0,c=s[0];if(i<=0||!t||!Number.isFinite(t))return{segment:c,index:0,length:a,lengthAtSegment:o};if(t>=n)return r=s.slice(0,-1),o=rt(r),a=n-o,c=s[i],{segment:c,index:i,length:a,lengthAtSegment:o};const l=[];for(;i>0;)c=r[i],r=r.slice(0,-1),o=rt(r),a=n-o,n=o,l.push({segment:c,index:i,length:a,lengthAtSegment:o}),i-=1;return l.find(({lengthAtSegment:u})=>u<=t)},Nt=(e,t)=>{const s=E(e),r=mt(s),n=rt(r),i=M=>{const d=M.x-t.x,v=M.y-t.y;return d*d+v*v};let o=8,a,c={x:0,y:0},l=0,u=0,m=1/0;for(let M=0;M<=n;M+=o)a=ht(r,M),l=i(a),l1e-6&&(h=u-o,f=ht(r,h),b=i(f),x=u+o,y=ht(r,x),A=i(y),h>=0&&bNt(e,t).closest,Fe=(e,t,s,r,n,i,o,a)=>3*((a-t)*(s+n)-(o-e)*(r+i)+r*(e-n)-s*(t-i)+a*(n+e/3)-o*(i+t/3))/20,Ce=e=>{let t=0,s=0,r=0;return bt(e).map(n=>{switch(n[0]){case"M":return[,t,s]=n,0;default:return r=Fe(t,s,n[1],n[2],n[3],n[4],n[5],n[6]),[t,s]=n.slice(-2),r}}).reduce((n,i)=>n+i,0)},He=e=>Ce(bt(e))>=0,Pe=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=E(e);let s=[],r="M";const n=0,i=0;let o=0,a=0;const c=[],l=[];let u={x:n,y:i},m={x:n,y:i};const f={...U};R(t,(N,M,d,v)=>{f.x=d,f.y=v;const L=W(N,f);[r]=L,s=[d,v].concat(L.slice(1)),r==="M"?([,o,a]=L,u={x:o,y:a},m={x:o,y:a}):r==="L"?{min:u,max:m}=Dt(s[0],s[1],s[2],s[3]):r==="A"?{min:u,max:m}=ye(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8]):r==="C"?{min:u,max:m}=Ne(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]):r==="Q"?{min:u,max:m}=Te(s[0],s[1],s[2],s[3],s[4],s[5]):r==="Z"&&(s=[d,v,o,a],{min:u,max:m}=Dt(s[0],s[1],s[2],s[3])),c.push(u),l.push(m);const T=L.length;f.x1=+L[T-2],f.y1=+L[T-1],f.x2=+L[T-4]||f.x1,f.y2=+L[T-3]||f.y1});const y=Math.min(...c.map(N=>N.x)),h=Math.max(...l.map(N=>N.x)),x=Math.min(...c.map(N=>N.y)),b=Math.max(...l.map(N=>N.y)),A=h-y,w=b-x;return{width:A,height:w,x:y,y:x,x2:h,y2:b,cx:y+A/2,cy:x+w/2,cz:Math.max(A,w)+Math.min(A,w)/2}},Ue=(e,t)=>Ut(e,t).segment,Xe=(e,t)=>Nt(e,t).segment,Lt=e=>Array.isArray(e)&&e.every(t=>{const s=t[0].toLowerCase();return nt[s]===t.length-1&&"achlmqstvz".includes(s)&&t.slice(1).every(Number.isFinite)})&&e.length>0,$e=e=>Lt(e)&&e.every(([t])=>t===t.toUpperCase()),ze=e=>$e(e)&&e.every(([t])=>"ACLMQZ".includes(t)),Je=e=>ze(e)&&e.every(([t])=>"MC".includes(t)),Ye=(e,t)=>{const{distance:s}=Nt(e,t);return Math.abs(s)Lt(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),qe=e=>{if(typeof e!="string"||!e.length)return!1;const t=new zt(e);for(st(t);t.index{let{x1:t,y1:s,x2:r,y2:n}=e;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t,s],["L",r,n]]},Ve=e=>{const t=[],s=(e.points||"").trim().split(/[\s|,]/).map(n=>+n);let r=0;for(;r{let{cx:t,cy:s,r}=e;return[t,s,r]=[t,s,r].map(n=>+n),[["M",t-r,s],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},tn=e=>{let{cx:t,cy:s}=e,r=e.rx||0,n=e.ry||r;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t-r,s],["a",r,n,0,1,0,2*r,0],["a",r,n,0,1,0,-2*r,0]]},en=e=>{const t=+e.x||0,s=+e.y||0,r=+e.width,n=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>n&&(o-=(o*2-n)/2),[["M",t+i,s],["h",r-i*2],["s",i,0,i,o],["v",n-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-n+o*2],["s",0,-o,i,-o]]):[["M",t,s],["h",r],["v",n],["H",t],["Z"]]},ke=(e,t)=>{const r=(t||document).defaultView||window,n=Object.keys(ft),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...n,"path"].every(m=>o!==m))throw TypeError(`${I}: "${o}" is not SVGElement`);const a=i?o:e.type,c=ft[a],l={type:a};i?c.forEach(m=>{l[m]=e.getAttribute(m)}):Object.assign(l,e);let u=[];return a==="circle"?u=Ge(l):a==="ellipse"?u=tn(l):["polyline","polygon"].includes(a)?u=Ve(l):a==="rect"?u=en(l):a==="line"?u=We(l):["glyph","path"].includes(a)&&(u=E(i?e.getAttribute("d")||"":e.d||"")),Lt(u)&&u.length?u:!1},nn=(e,t,s)=>{const r=s||document,n=r.defaultView||window,i=Object.keys(ft),o=e instanceof n.SVGElement,a=o?e.tagName:null;if(a==="path")throw TypeError(`${I}: "${a}" is already SVGPathElement`);if(a&&i.every(x=>a!==x))throw TypeError(`${I}: "${a}" is not SVGElement`);const c=r.createElementNS("http://www.w3.org/2000/svg","path"),l=o?a:e.type,u=ft[l],m={type:l},f=K.round,y=ke(e,r),h=y&&y.length?jt(y,f):"";return o?(u.forEach(x=>{m[x]=e.getAttribute(x)}),Object.values(e.attributes).forEach(({name:x,value:b})=>{u.includes(x)||c.setAttribute(x,b)})):(Object.assign(m,e),Object.keys(m).forEach(x=>{!u.includes(x)&&x!=="type"&&c.setAttribute(x.replace(/[A-Z]/g,b=>`-${b.toLowerCase()}`),m[x])})),qe(h)?(c.setAttribute("d",h),t&&o&&(e.before(c,e),e.remove()),c):!1},Ie=e=>{let t=new C;const{origin:s}=e,[r,n]=s,{translate:i}=e,{rotate:o}=e,{skew:a}=e,{scale:c}=e;return Array.isArray(i)&&i.length>=2&&i.every(l=>!Number.isNaN(+l))&&i.some(l=>l!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||a||c)&&(t=t.translate(r,n),Array.isArray(o)&&o.length>=2&&o.every(l=>!Number.isNaN(+l))&&o.some(l=>l!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(a)&&a.length===2&&a.every(l=>!Number.isNaN(+l))&&a.some(l=>l!==0)?(t=a[0]?t.skewX(a[0]):t,t=a[1]?t.skewY(a[1]):t):typeof a=="number"&&!Number.isNaN(a)&&(t=t.skewX(a)),Array.isArray(c)&&c.length>=2&&c.every(l=>!Number.isNaN(+l))&&c.some(l=>l!==1)?t=t.scale(...c):typeof c=="number"&&!Number.isNaN(c)&&(t=t.scale(c)),t=t.translate(-r,-n)),t},Ee=(e,t,s,r)=>{const[n]=e,{round:i}=K,o=typeof i=="number"?i:4,a=t.slice(1),{x1:c,y1:l,x2:u,y2:m,x:f,y}=s,[h,x]=a.slice(-2),b=e;if("TQ".includes(n)||(s.qx=null,s.qy=null),n==="L"){if(z(f,o)===z(h,o))return["V",x];if(z(y,o)===z(x,o))return["H",h]}else if(n==="C"){const[A,w]=a;if(s.x1=A,s.y1=w,"CS".includes(r)&&(z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o)||z(c,o)===z(u*2-f,o)&&z(l,o)===z(m*2-y,o)))return["S",a[2],a[3],a[4],a[5]]}else if(n==="Q"){const[A,w]=a;if(s.qx=A,s.qy=w,"QT".includes(r)&&z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o))return["T",a[2],a[3]]}return b},vt=(e,t)=>{const s=e.slice(1).map(r=>z(r,t));return[e[0]].concat(s)},Re=(e,t)=>{const s=pt(e),r=typeof t=="number"&&t>=0?t:2,n={...U},i=[];let o="M",a="Z";return R(s,(c,l,u,m)=>{n.x=u,n.y=m;const f=W(c,n);let y=c;if([o]=c,i[l]=o,l){a=i[l-1];const x=Ee(c,f,n,a),b=vt(x,r),A=b.join(""),w=kt(x,l,u,m),N=vt(w,r),M=N.join("");y=A.length{let s=C.Translate(t[0],t[1],t[2]);return[,,,s.m44]=t,s=e.multiply(s),[s.m41,s.m42,s.m43,s.m44]},Xt=(e,t,s)=>{const[r,n,i]=s,[o,a,c]=sn(e,[t[0],t[1],0,1]),l=o-r,u=a-n,m=c-i;return[l*(Math.abs(i)/Math.abs(m)||1)+r,u*(Math.abs(i)/Math.abs(m)||1)+n]},rn=e=>{const t=e.slice(1).map((s,r,n)=>r?n[r-1].slice(-2).concat(s.slice(1)):e[0].slice(1).concat(s.slice(1))).map(s=>s.map((r,n)=>s[s.length-n-2*(1-n%2)])).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(s=>["C"].concat(s.slice(2))))},Tt=e=>{const t=pt(e),s=mt(t),r=t.length,n=t[r-1][0]==="Z",i=R(t,(o,a)=>{const c=s[a],l=a&&t[a-1],u=l&&l[0],m=t[a+1],f=m&&m[0],[y]=o,[h,x]=s[a?a-1:r-1].slice(-2);let b=o;switch(y){case"M":b=n?["Z"]:[y,h,x];break;case"A":b=[y,o[1],o[2],o[3],o[4],o[5]===1?0:1,h,x];break;case"C":m&&f==="S"?b=["S",o[1],o[2],h,x]:b=[y,o[3],o[4],o[1],o[2],h,x];break;case"S":u&&"CS".includes(u)&&(!m||f!=="S")?b=["C",c[3],c[4],c[1],c[2],h,x]:b=[y,c[1],c[2],h,x];break;case"Q":m&&f==="T"?b=["T",h,x]:b=[y,o[1],o[2],h,x];break;case"T":u&&"QT".includes(u)&&(!m||f!=="T")?b=["Q",c[1],c[2],h,x]:b=[y,h,x];break;case"Z":b=["M",h,x];break;case"H":b=[y,h];break;case"V":b=[y,x];break;default:b=[y].concat(o.slice(1,-2),h,x)}return b});return n?i.reverse():[i[0]].concat(i.slice(1).reverse())},on=(e,t)=>{let{round:s}=K;return s=t==="off"||typeof t=="number"&&t>=0?t:typeof s=="number"&&s>=0?s:"off",s==="off"?e.slice(0):R(e,r=>vt(r,s))},cn=(e,t=.5)=>{const s=t,r=e.slice(0,2),n=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),a=Z(r,n,s),c=Z(n,i,s),l=Z(i,o,s),u=Z(a,c,s),m=Z(c,l,s),f=Z(u,m,s);return[["C",a[0],a[1],u[0],u[1],f[0],f[1]],["C",m[0],m[1],l[0],l[1],o[0],o[1]]]},je=e=>{const t=[];let s,r=-1,n=0,i=0,o=0,a=0;const c={...U};return e.forEach(l=>{const[u]=l,m=u.toUpperCase(),f=u.toLowerCase(),y=u===f,h=l.slice(1);m==="M"?(r+=1,[n,i]=h,n+=y?c.x:0,i+=y?c.y:0,o=n,a=i,s=[y?[m,o,a]:l]):(m==="Z"?(n=o,i=a):m==="H"?([,n]=l,n+=y?c.x:0):m==="V"?([,i]=l,i+=y?c.y:0):([n,i]=l.slice(-2),n+=y?c.x:0,i+=y?c.y:0),s.push(l)),c.x=n,c.y=i,t[r]=s}),t},Se=(e,t)=>{let s=0,r=0,n=0,i=0,o=0,a=0,c="M";const l={...U},u=E(e),m=t&&Object.keys(t);if(!t||m&&!m.length)return u.slice(0);t.origin||Object.assign(t,{origin:K.origin});const f=t.origin,y=Ie(t);return y.isIdentity?u.slice(0):R(u,(h,x,b,A)=>{l.x=b,l.y=A,[c]=h;const w=c.toUpperCase(),M=w!==c?qt(h,x,b,A):h.slice(0);let d=w==="A"?Rt(M,l):["V","H"].includes(w)?W(M,l):M;c=d[0];const v=c==="C"&&d.length>7,L=v?d.slice(0,7):d.slice(0);if(v&&(u.splice(x+1,0,["C"].concat(d.slice(7))),d=L),c==="L")[n,i]=Xt(y,[d[1],d[2]],f),s!==n&&r!==i?d=["L",n,i]:r===i?d=["H",n]:s===n&&(d=["V",i]);else for(o=1,a=d.length;o"u";if(n||!t.length)throw TypeError(`${I}: "pathValue" is ${n?"undefined":"empty"}`);this.segments=E(t);const{round:i,origin:o}=r;let a;Number.isInteger(i)||i==="off"?a=i:a=K.round;let c=K.origin;if(Array.isArray(o)&&o.length>=2){const[l,u,m]=o.map(Number);c=[Number.isNaN(l)?0:l,Number.isNaN(u)?0:u,Number.isNaN(m)?0:m]}return this.round=a,this.origin=c,this}get bbox(){return Pe(this.segments)}get length(){return rt(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return ht(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=pt(t),this}toRelative(){const{segments:t}=this;return this.segments=me(t),this}toCurve(){const{segments:t}=this;return this.segments=bt(t),this}reverse(t){this.toAbsolute();const{segments:s}=this,r=je(s),n=r.length>1?r:!1,i=n?n.map((a,c)=>t?c?Tt(a):a.slice(0):Tt(a)):s.slice(0);let o=[];return n?o=i.flat(1):o=t?s:Tt(s),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=mt(t),this}optimize(){const{segments:t}=this,s=this.round==="off"?2:this.round;return this.segments=Re(t,s),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(c=>c in t))return this;const{segments:s,origin:[r,n,i]}=this,o={};for(const[c,l]of Object.entries(t))c==="skew"&&Array.isArray(l)||(c==="rotate"||c==="translate"||c==="origin"||c==="scale")&&Array.isArray(l)?o[c]=l.map(Number):c!=="origin"&&typeof Number(l)=="number"&&(o[c]=Number(l));const{origin:a}=o;if(Array.isArray(a)&&a.length>=2){const[c,l,u]=a.map(Number);o.origin=[Number.isNaN(c)?r:c,Number.isNaN(l)?n:l,u||i]}else o.origin=[r,n,i];return this.segments=Se(s,o),this}flipX(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,s,0]}),this}flipY(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,s,0]}),this}toString(){return jt(this.segments,this.round)}}return p(g,"CSSMatrix",C),p(g,"pathToAbsolute",pt),p(g,"pathToRelative",me),p(g,"pathToCurve",bt),p(g,"pathToString",jt),p(g,"arcTools",Oe),p(g,"bezierTools",{Cvalues:xe,Tvalues:Bt,minmaxC:_t,minmaxQ:Mt,getBezierLength:ut,bezierLength:de,calculateBezier:be,computeBezier:pe,deriveBezier:ge,CBEZIER_MINMAX_EPSILON:Ae}),p(g,"cubicTools",{getCubicLength:Ft,getCubicBBox:Ne,getPointAtCubicLength:we,getPointAtCubicSegmentLength:Me}),p(g,"lineTools",{getPointAtLineLength:St,getLineBBox:Dt,getLineLength:lt}),p(g,"quadTools",{getPointAtQuadSegmentLength:Le,getQuadLength:Ht,getQuadBBox:Te,getPointAtQuadLength:ve}),p(g,"polygonTools",{polygonArea:Qe,polygonLength:Be}),p(g,"distanceSquareRoot",dt),p(g,"distanceEpsilon",wt),p(g,"midPoint",Z),p(g,"rotateVector",at),p(g,"roundTo",z),p(g,"finalizeSegment",Pt),p(g,"invalidPathValue",H),p(g,"isArcCommand",le),p(g,"isDigit",F),p(g,"isDigitStart",ae),p(g,"isMoveCommand",ue),p(g,"isPathCommand",ce),p(g,"isSpace",oe),p(g,"paramsCount",nt),p(g,"paramsParser",U),p(g,"pathParser",zt),p(g,"scanFlag",re),p(g,"scanParam",ie),p(g,"scanSegment",$t),p(g,"skipSpaces",st),p(g,"getPathBBox",Pe),p(g,"getPathArea",Ce),p(g,"getTotalLength",rt),p(g,"getDrawDirection",He),p(g,"getPointAtLength",ht),p(g,"getPropertiesAtLength",Ut),p(g,"getPropertiesAtPoint",Nt),p(g,"getClosestPoint",_e),p(g,"getSegmentOfPoint",Xe),p(g,"getSegmentAtLength",Ue),p(g,"isPointInStroke",Ye),p(g,"isValidPath",qe),p(g,"isPathArray",Lt),p(g,"isAbsoluteArray",$e),p(g,"isRelativeArray",Ke),p(g,"isCurveArray",Je),p(g,"isNormalizedArray",ze),p(g,"shapeToPath",nn),p(g,"shapeToPathArray",ke),p(g,"shapeParams",ft),p(g,"parsePathString",E),p(g,"absolutizeSegment",qt),p(g,"arcToCubic",It),p(g,"getSVGMatrix",Ie),p(g,"iterate",R),p(g,"lineToCubic",Et),p(g,"normalizePath",mt),p(g,"normalizeSegment",W),p(g,"optimizePath",Re),p(g,"projection2d",Xt),p(g,"quadToCubic",he),p(g,"relativizeSegment",kt),p(g,"reverseCurve",rn),p(g,"reversePath",Tt),p(g,"roundPath",on),p(g,"roundSegment",vt),p(g,"segmentToCubic",Rt),p(g,"shortenSegment",Ee),p(g,"splitCubic",cn),p(g,"splitPath",je),p(g,"transformPath",Se),g}(); //# sourceMappingURL=svg-path-commander.js.map diff --git a/dist/svg-path-commander.js.map b/dist/svg-path-commander.js.map index e5a7467..e5a82e0 100644 --- a/dist/svg-path-commander.js.map +++ b/dist/svg-path-commander.js.map @@ -1 +1 @@ -{"version":3,"file":"svg-path-commander.js","sources":["../src/options/options.ts","../src/parser/error.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/math/polygonArea.ts","../src/math/distanceSquareRoot.ts","../src/math/polygonLength.ts","../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/parser/paramsParser.ts","../src/process/iterate.ts","../src/process/absolutizeSegment.ts","../src/process/normalizeSegment.ts","../src/math/midPoint.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/util/getPathBBox.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/convert/pathToCurve.ts","../src/util/getPathArea.ts","../src/util/getTotalLength.ts","../src/util/getDrawDirection.ts","../src/util/distanceEpsilon.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/process/normalizePath.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getSegmentOfPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/isPointInStroke.ts","../src/util/isValidPath.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isRelativeArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/process/roundPath.ts","../src/convert/pathToString.ts","../src/util/shapeToPath.ts","../src/process/splitPath.ts","../src/process/getSVGMatrix.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/process/shortenSegment.ts","../src/process/optimizePath.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/projection2d.ts","../src/process/transformPath.ts","../src/process/splitCubic.ts","../src/index.ts"],"sourcesContent":["import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let LK = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[LK]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (LK === 'm' && data.length > 2) {\n path.segments.push([pathCommand, ...(data.splice(0, 2) as number[])] as PathSegment);\n LK = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push([pathCommand, ...(data.splice(0, paramsCount[LK]) as number[])] as PathSegment);\n }\n\n if (!paramsCount[LK]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: any[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | PathArray) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as PathArray;\n // return pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]): number => {\n const n = polygon.length;\n let i = -1;\n let a;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nexport default polygonArea;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple): number => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import { type PointTuple } from '../types';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns {number} the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]): number => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport default polygonLength;\n","var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n const allPathCommands = [] as PathCommand[];\n const params = { ...paramsParser };\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n allPathCommands[i] = pathCommand;\n const iteratorResult = iterator(segment, params, i);\n path[i] = iteratorResult;\n\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n\n segment = path[i];\n const seglen = segment.length;\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n }\n // console.log('iteration: ', ...path)\n return path as T;\n};\n\nexport default iterate;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (!isAbsolute) {\n if (absCommand === 'A') {\n return [\n absCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] + x,\n values[6] + y,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, values[0] + y] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, values[0] + x] as HSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = values.map((n, j) => n + (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [absCommand, ...absValues] as MSegment | QSegment | TSegment | SSegment | CSegment;\n }\n }\n\n return segment as AbsoluteSegment;\n};\nexport default absolutizeSegment;\n","import type { ParserParams } from '../interface';\nimport type { NormalSegment, PointTuple, PathSegment, QSegment, CSegment, LSegment } from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x1: px1, y1: py1, x2: px2, y2: py2 } = params;\n const values = segment.slice(1).map(Number);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'H') {\n return ['L', segment[1], py1] as LSegment;\n } else if (pathCommand === 'V') {\n return ['L', px1, segment[1]] as LSegment;\n } else if (pathCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1, ...values] as CSegment;\n } else if (pathCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy, ...values] as QSegment;\n } else if (pathCommand === 'Q') {\n const [nqx, nqy] = values as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n }\n\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nexport const getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nexport const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nexport const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst ellipticalArcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const arcLength = Math.sqrt(term1 + term2) * theta;\n return Math.abs(arcLength);\n};\n\n/**\n * Compute point on ellipse from angle around ellipse (theta);\n * @param theta the arc sweep angle\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the angle\n * @returns a point around ellipse\n */\nconst arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alpha: number) => {\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cos = Math.cos(alpha);\n const sin = Math.sin(alpha);\n const x = rx * Math.cos(theta);\n const y = ry * Math.sin(theta);\n\n return {\n x: cx + cos * x - sin * y,\n y: cy + sin * x + cos * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n const angle = sign * Math.acos(p / n);\n\n return angle;\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle\n * and radiuses on X and Y coordinates.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // to be used later\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n // point.length = ellipticalArcLength(rx, ry, sweepAngle);\n // point.box = minmax(center.x, center.y, rx, ry, xRotRad, startAngle, startAngle + sweepAngle);\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nexport const getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return ellipticalArcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nexport const getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const length = ellipticalArcLength(rx, ry, endAngle - startAngle);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the bounding box for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nexport const getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const [cx, cy] = [center.x, center.y];\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * Math.PI) / 180;\n const tan = Math.tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = Math.atan2(-ry * tan, rx);\n const angle1 = theta;\n const angle2 = theta + Math.PI;\n const angle3 = Math.atan2(ry, rx * tan);\n const angle4 = angle3 + Math.PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = Math.min(...xArr);\n const xMax = Math.max(...xArr);\n const yMin = Math.min(...yArr);\n const yMax = Math.max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arc(angleAfterStart, cx, cy, rx, ry, alpha);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arc(angleBeforeEnd, cx, cy, rx, ry, alpha);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arc(angle1, cx, cy, rx, ry, alpha));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arc(angle2, cx, cy, rx, ry, alpha));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arc(angle4, cx, cy, rx, ry, alpha));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arc(angle3, cx, cy, rx, ry, alpha));\n }\n\n return {\n min: {\n x: Math.min(...extremes.map(n => n.x)),\n y: Math.min(...extremes.map(n => n.y)),\n },\n max: {\n x: Math.max(...extremes.map(n => n.x)),\n y: Math.max(...extremes.map(n => n.y)),\n },\n };\n};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst ZERO = { x: 0, y: 0 };\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst derive = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], ZERO as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst arcfn = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst lengthFn = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * arcfn(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nexport const length = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = derive(points);\n return lengthFn((t: number) => {\n return compute(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nexport const minmaxQ = (A: [number, number, number]) => {\n const min = Math.min(A[0], A[2]);\n const max = Math.max(A[0], A[2]);\n\n /* istanbul ignore next @preserve */\n if (A[1] >= A[0] ? A[2] >= A[1] : A[2] <= A[1]) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (A[0] * A[2] - A[1] * A[1]) / (A[0] - 2 * A[1] + A[2]);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nexport const minmaxC = (A: [number, number, number, number]) => {\n const K = A[0] - 3 * A[1] + 3 * A[2] - A[3];\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (A[0] === A[3] && A[0] === A[1]) {\n // no curve, point targeting same location\n return [A[0], A[3]] as PointTuple;\n }\n\n return minmaxQ([A[0], -0.5 * A[0] + 1.5 * A[1], A[0] - 3 * A[1] + 3 * A[2]]);\n }\n\n // the reduced discriminant of the derivative\n const T = -A[0] * A[2] + A[0] * A[3] - A[1] * A[2] - A[1] * A[3] + A[1] * A[1] + A[2] * A[2];\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(A[0], A[3]), Math.max(A[0], A[3])] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(A[0], A[3]);\n let max = Math.max(A[0], A[3]);\n\n const L = A[0] - 2 * A[1] + A[2];\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n A[0] * (1 - R) * (1 - R) * (1 - R) +\n A[1] * 3 * (1 - R) * (1 - R) * R +\n A[2] * 3 * (1 - R) * R * R +\n A[3] * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n","import { length, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a {x,y} point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nexport const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nexport const getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nexport const getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import { length, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nexport const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return length([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nexport const getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n Point,\n PointTuple,\n QuadCoordinates,\n} from '../types';\n// import pathFactory from './pathFactory';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport parsePathString from '../parser/parsePathString';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n data = [x, y, ...normalSegment.slice(1)] as number[];\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(...(data as ArcCoordinates)));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(...(data as CubicCoordinates)));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(...(data as QuadCoordinates)));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const X = x * Math.cos(rad) - y * Math.sin(rad);\n const Y = x * Math.sin(rad) + y * Math.cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [...m2, ...m3, ...m4, ...res];\n }\n res = [...m2, ...m3, ...m4, ...res];\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [...c1, ...c2, x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n args = [px1, py1, ...values] as [number, number, number, number, number, number, number, number, number];\n return ['C', ...arcToCubic(...args)] as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n args = [px1, py1, ...values] as [number, number, number, number, number, number];\n return ['C', ...quadToCubic(...args)] as CSegment;\n } else if (pathCommand === 'L') {\n return ['C', ...lineToCubic(px1, py1, x, y)] as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C', ...lineToCubic(px1, py1, px, py)] as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport absolutizeSegment from '../process/absolutizeSegment';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n const path = parsePathString(pathInput);\n return iterate(path, (seg, params, i) => {\n const absSegment = absolutizeSegment(seg, params);\n [pathCommand] = absSegment;\n\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const normalSegment = normalizeSegment(absSegment, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToCurve;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray, QuadCoordinates } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, ...(seg.slice(1) as QuadCoordinates));\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\n// import pathFactory from './pathFactory';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n totalLength += getLineLength(...(data as LineCoordinates));\n }\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (isM) {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber) return point;\n\n if (distance < DISTANCE_EPSILON) {\n POINT = point;\n }\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(...(data as LineCoordinates), distance - totalLength);\n length = getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(...(data as ArcCoordinates), distance - totalLength);\n length = getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(...(data as CubicCoordinates), distance - totalLength);\n length = getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(...(data as QuadCoordinates), distance - totalLength);\n length = getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n point = { x: mx, y: my };\n length = getLineLength(...(data as LineCoordinates));\n }\n\n if (totalLength < distance && totalLength + length >= distance) {\n POINT = point;\n }\n\n totalLength += length;\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n POINT = { x, y };\n }\n\n return POINT;\n};\nexport default getPointAtLength;\n","import type { PointTuple, PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n const [x, y] = segment.slice(-2) as PointTuple;\n const point = { x, y };\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n point,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n return {\n segment: pathArray[index],\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import normalizeSegment from './normalizeSegment';\nimport type { AbsoluteCommand, NormalArray, PathArray, PointTuple } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Normalizes a `path` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n return iterate(parsePathString(pathInput), (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const result = normalizeSegment(absoluteSegment, params);\n [pathCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n // const seglen = result.length;\n // params.x1 = +result[seglen - 2];\n // params.y1 = +result[seglen - 1];\n // params.x2 = +result[seglen - 4] || params.x1;\n // params.y2 = +result[seglen - 3] || params.y1;\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default normalizePath;\n","import type { PathArray } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: { x: number; y: number }): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(path);\n const distanceTo = (p: { x: number; y: number }) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: { x: number; y: number };\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n if (roundOption === 'off' || round === 'off') return path.slice(0) as PathArray;\n // allow for ZERO decimals\n round = typeof roundOption === 'number' && roundOption >= 0 ? roundOption : round;\n // to round values to the power\n // the `round` value must be integer\n const pow = typeof round === 'number' && round >= 1 ? 10 ** round : 1;\n\n return iterate(path, segment => {\n const values = (segment.slice(1) as number[]).map(n => (round ? Math.round(n * pow) / pow : Math.round(n)));\n return [segment[0], ...values] as PathSegment;\n });\n};\nexport default roundPath;\n","import type { PathArray } from '../types';\nimport roundPath from '../process/roundPath';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param round amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, round?: number | 'off'): string => {\n return roundPath(path, round)\n .map(x => x[0] + x.slice(1).join(' '))\n .join('');\n};\nexport default pathToString;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, AbsoluteCommand, HSegment, PathArray, PointTuple, VSegment } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params) => {\n [pathCommand] = seg;\n const result = absolutizeSegment(seg, params);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as HSegment;\n } else if (absCommand === 'V') {\n [, y] = result as VSegment;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToAbsolute;\n","import type { ParserParams } from '../interface';\nimport type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @param index the segment index\n * @returns the absolute segment\n */\nconst relativizeSegment = (segment: PathSegment, params: ParserParams, index: number) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n\n if (index === 0 && pathCommand === 'M') {\n return segment;\n }\n\n /* istanbul ignore else @preserve */\n if (pathCommand !== relCommand) {\n if (relCommand === 'a') {\n return [\n relCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] - x,\n values[6] - y,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, values[0] - y] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, values[0] - x] as hSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = values.map((n, j) => n - (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [relCommand, ...relValues] as qSegment | tSegment | sSegment | cSegment;\n }\n }\n\n return segment as RelativeSegment;\n};\nexport default relativizeSegment;\n","import type {\n AbsoluteCommand,\n hSegment,\n PathArray,\n PointTuple,\n RelativeArray,\n RelativeCommand,\n vSegment,\n} from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params, i) => {\n [pathCommand] = seg;\n const result = relativizeSegment(seg, params, i);\n const [resultedCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = resultedCommand === relCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as hSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = result as vSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n\n return result;\n });\n};\nexport default pathToRelative;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n HSegment,\n NormalSegment,\n PathCommand,\n ShortSegment,\n SSegment,\n TSegment,\n VSegment,\n ZSegment,\n} from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const round4 = (n: number) => Math.round(n * 10 ** 4) / 10 ** 4;\n const segmentValues = segment.slice(1) as number[];\n const normalValues = normalSegment.slice(1) as number[];\n const { x1: px1, y1: py1, x2: px2, y2: py2, x: px, y: py } = params;\n let result = segment;\n const [x, y] = normalValues.slice(-2);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)) {\n result = [pathCommand, ...segmentValues] as VSegment | HSegment | SSegment | TSegment | ZSegment;\n } else if (pathCommand === 'L') {\n if (round4(px) === round4(x)) {\n result = ['V', y];\n } else if (round4(py) === round4(y)) {\n result = ['H', x];\n }\n } else if (pathCommand === 'C') {\n const [x1, y1] = normalValues;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((round4(x1) === round4(px1 * 2 - px2) && round4(y1) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['S', ...normalValues.slice(-4)] as SSegment;\n }\n params.x1 = x1;\n params.y1 = y1;\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n ((round4(qx) === round4(px1 * 2 - px2) && round4(qy) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['T', ...normalValues.slice(-2)] as TSegment;\n }\n }\n\n return result as ShortSegment;\n};\nexport default shortenSegment;\n","import roundPath from './roundPath';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport pathToRelative from '../convert/pathToRelative';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport normalizePath from './normalizePath';\nimport type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteSegment } from '../types';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param round the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, round: 'off' | number): PathArray => {\n const path = pathToAbsolute(pathInput);\n const normalPath = normalizePath(path);\n const params = { ...paramsParser };\n const allPathCommands = [] as PathCommand[];\n const ii = path.length;\n let pathCommand = '' as PathCommand;\n let prevCommand = '' as PathCommand;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n\n for (let i = 0; i < ii; i += 1) {\n [pathCommand] = path[i];\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n // Get previous path command for `shortenSegment`\n if (i) prevCommand = allPathCommands[i - 1];\n path[i] = shortenSegment(path[i], normalPath[i], params, prevCommand) as AbsoluteSegment;\n\n const segment = path[i];\n const seglen = segment.length;\n\n // update C, S, Q, T specific params\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n\n // update x, y params\n switch (pathCommand) {\n case 'Z':\n x = mx;\n y = my;\n break;\n case 'H':\n [, x] = segment as HSegment;\n break;\n case 'V':\n [, y] = segment as VSegment;\n break;\n default:\n [x, y] = segment.slice(-2).map(Number);\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n }\n\n const absolutePath = roundPath(path, round);\n const relativePath = roundPath(pathToRelative(path), round);\n\n return absolutePath.map((a: PathSegment, i: number) => {\n if (i) {\n return a.join('').length < relativePath[i].join('').length ? a : relativePath[i];\n }\n return a;\n }) as PathArray;\n};\nexport default optimizePath;\n","import type { CurveArray } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray): CurveArray => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? [...path[0].slice(1), ...x.slice(1)] : [...curveOnly[i - 1].slice(-2), ...x.slice(1)],\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse();\n\n return [['M', ...rotatedCurve[0].slice(0, 2)], ...rotatedCurve.map(x => ['C', ...x.slice(2)])] as CurveArray;\n};\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray): PathArray => {\n const absolutePath = pathToAbsolute(pathInput);\n const isClosed = absolutePath.slice(-1)[0][0] === 'Z';\n\n const reversedPath = normalizePath(absolutePath)\n .map((segment, i) => {\n const [x, y] = segment.slice(-2).map(Number);\n return {\n seg: absolutePath[i], // absolute\n n: segment, // normalized\n c: absolutePath[i][0], // pathCommand\n x, // x\n y, // y\n };\n })\n .map((seg, i, path) => {\n const segment = seg.seg;\n const data = seg.n;\n const prevSeg = i && path[i - 1];\n const nextSeg = path[i + 1];\n const pathCommand = seg.c;\n const pLen = path.length;\n const x = i ? path[i - 1].x : path[pLen - 1].x;\n const y = i ? path[i - 1].y : path[pLen - 1].y;\n let result = [];\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [pathCommand, ...segment.slice(1, -3), segment[5] === 1 ? 0 : 1, x, y] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextSeg.c === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevSeg && 'CS'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'S')) {\n result = ['C', data[3], data[4], data[1], data[2], x, y] as CSegment;\n } else {\n result = [pathCommand, data[1], data[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextSeg.c === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, ...segment.slice(1, -2), x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevSeg && 'QT'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'T')) {\n result = ['Q', data[1], data[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand, ...segment.slice(1, -2), x, y] as PathSegment;\n }\n\n return result;\n });\n\n return (isClosed ? reversedPath.reverse() : [reversedPath[0], ...reversedPath.slice(1).reverse()]) as PathArray;\n};\nexport default reversePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(...(v.slice(0, -1) as [number, number, number]));\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [...point2D, 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, CSegment, PathArray, PointTuple, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let lx = 0;\n let ly = 0;\n let j = 0;\n let jj = 0;\n let nx = 0;\n let ny = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path;\n\n return iterate(path, (seg, _, i) => {\n const absSegment = absolutizeSegment(seg, transformParams);\n [pathCommand] = absSegment;\n\n let result =\n pathCommand === 'A'\n ? segmentToCubic(absSegment, transformParams)\n : ['V', 'H'].includes(pathCommand)\n ? normalizeSegment(absSegment, transformParams)\n : absSegment;\n const isLongArc = result[0] === 'C' && result.length > 7;\n const normalizedSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as typeof result;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (result[0] === 'L') {\n const values = result.slice(-2) as PointTuple;\n [lx, ly] = projection2d(matrixInstance, values, origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n if (pathCommand === 'Z') {\n nx = mx;\n ny = my;\n } else {\n [nx, ny] = normalizedSegment.slice(-2) as PointTuple;\n if (pathCommand === 'M') {\n mx = nx;\n my = ny;\n }\n }\n\n const seglen = normalizedSegment.length;\n transformParams.x1 = +normalizedSegment[seglen - 2];\n transformParams.y1 = +normalizedSegment[seglen - 1];\n transformParams.x2 = +normalizedSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +normalizedSegment[seglen - 3] || transformParams.y1;\n transformParams.x = nx;\n transformParams.y = ny;\n return result;\n });\n};\n\nexport default transformPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', ...p4, ...p7, ...p9],\n ['C', ...p8, ...p6, ...p3],\n ];\n};\nexport default splitCubic;\n","'use strict';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\n\nimport polygonArea from './math/polygonArea';\nimport polygonLength from './math/polygonLength';\n\nimport CSSMatrix from '@thednp/dommatrix';\nimport getPathBBox from './util/getPathBBox';\nimport getPathArea from './util/getPathArea';\nimport getTotalLength from './util/getTotalLength';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPointAtLength from './util/getPointAtLength';\n\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getClosestPoint from './util/getClosestPoint';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport isPointInStroke from './util/isPointInStroke';\n\nimport isValidPath from './util/isValidPath';\nimport isPathArray from './util/isPathArray';\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isRelativeArray from './util/isRelativeArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport shapeToPathArray from './util/shapeToPathArray';\nimport shapeToPath from './util/shapeToPath';\n\nimport roundPath from './process/roundPath';\nimport splitPath from './process/splitPath';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport optimizePath from './process/optimizePath';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport normalizePath from './process/normalizePath';\nimport transformPath from './process/transformPath';\nimport splitCubic from './process/splitCubic';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static getSVGMatrix = getSVGMatrix;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static polygonLength = polygonLength;\n public static polygonArea = polygonArea;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static parsePathString = parsePathString;\n public static roundPath = roundPath;\n public static splitPath = splitPath;\n public static splitCubic = splitCubic;\n public static optimizePath = optimizePath;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static normalizePath = normalizePath;\n public static transformPath = transformPath;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n const segments = parsePathString(pathValue);\n this.segments = segments;\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n\n this.segments = optimizePath(segments, this.round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["defaultOptions","error","paramsCount","finalizeSegment","path","pathCommand","LK","data","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","i","PathParser","pathString","parsePathString","pathInput","polygonArea","polygon","n","a","b","area","distanceSquareRoot","polygonLength","length","point","Z","z","s","e","p","$","E","P","y","g","r","l","m","h","c","f","w","o","d","A","M","X","O","x","Y","F","T","k","I","v","R","D","N","paramsParser","iterate","iterator","params","pathLen","segment","iteratorResult","seglen","absolutizeSegment","values","absCommand","absValues","j","normalizeSegment","px1","py1","px2","py2","x1","y1","qx","qy","nqx","nqy","midPoint","t","ax","ay","bx","by","getLineLength","x2","y2","getPointAtLineLength","distance","getLineBBox","min","ellipticalArcLength","rx","ry","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcLength","arc","cx","cy","alpha","cos","sin","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","RX","RY","angle","LAF","SF","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","extremes","tan","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","ZERO","Tvalues","Cvalues","derive","points","dpoints","list","compute","order","mt","mt2","t2","arcfn","derivativeFn","lengthFn","len","sum","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","minmaxC","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","getPathBBox","mx","my","MIN","MAX","seg","absoluteSegment","normalSegment","width","height","rotateVector","rad","arcToCubic","X1","Y1","X2","Y2","recursive","d120","res","xy","f1","f2","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","r13","r23","lineToCubic","segmentToCubic","args","px","py","pathToCurve","absSegment","result","getCubicSegArea","getPathArea","getTotalLength","isM","totalLength","getDrawDirection","DISTANCE_EPSILON","getPointAtLength","POINT","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","normalizePath","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getSegmentOfPoint","getSegmentAtLength","isPointInStroke","isValidPath","isPathArray","lk","isAbsoluteArray","isRelativeArray","pc","isNormalizedArray","isCurveArray","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","roundPath","roundOption","round","pow","pathToString","shapeToPath","replace","doc","description","name","value","splitPath","composite","pi","relCommand","isRelative","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","pathToAbsolute","relativizeSegment","relValues","pathToRelative","resultedCommand","shortenSegment","prevCommand","round4","segmentValues","normalValues","optimizePath","allPathCommands","absolutePath","relativePath","reverseCurve","rotatedCurve","curveOnly","_","reversePath","isClosed","reversedPath","prevSeg","nextSeg","pLen","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","transformPath","lx","ly","jj","nx","ny","transformParams","transformProps","matrixInstance","isLongArc","normalizedSegment","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField"],"mappings":"qNAGA,MAAMA,EAA0B,CAC9B,OAAQ,CAAC,EAAG,EAAG,CAAC,EAChB,MAAO,CACT,ECNMC,EAAQ,yBCCRC,EAAc,CAClB,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,CACL,ECJMC,GAAmBC,GAAqB,CAC5C,IAAIC,EAAcD,EAAK,UAAUA,EAAK,YAAY,EAC9CE,EAAKD,EAAY,cACf,KAAA,CAAE,KAAAE,CAAS,EAAAH,EAEjB,KAAOG,EAAK,QAAUL,EAAYI,CAAE,IAG9BA,IAAO,KAAOC,EAAK,OAAS,GACzBH,EAAA,SAAS,KAAK,CAACC,EAAa,GAAIE,EAAK,OAAO,EAAG,CAAC,CAAc,CAAgB,EAC9ED,EAAA,IACSD,EAAAA,IAAgB,IAAM,IAAM,KAE1CD,EAAK,SAAS,KAAK,CAACC,EAAa,GAAIE,EAAK,OAAO,EAAGL,EAAYI,CAAE,CAAC,CAAc,CAAgB,EAG/F,EAACJ,EAAYI,CAAE,IAAf,CAIR,ECpBME,GAAYJ,GAAqB,CAC/B,KAAA,CAAE,MAAAK,EAAO,UAAAC,CAAc,EAAAN,EACvBO,EAAOD,EAAU,WAAWD,CAAK,EAEvC,GAAIE,IAAS,GAAc,CACzBP,EAAK,MAAQ,EACbA,EAAK,OAAS,EACd,MACF,CAEA,GAAIO,IAAS,GAAc,CACzBP,EAAK,MAAQ,EACbA,EAAK,OAAS,EACd,MACF,CAEKA,EAAA,IAAM,GAAGH,CAAK,uBAAuBS,EAAUD,CAAK,CAAC,gCAAgCA,CAAK,EACjG,EClBMG,EAAWD,GACRA,GAAQ,IAAMA,GAAQ,GCTzBE,EAAmB,qBCWnBC,GAAaV,GAAqB,CACtC,K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IAChC0H,EAbIV,EAaU,oBAAoB/G,IAClCyH,EAdIV,EAcU,qBAAqB9G,IACnCwH,EAfIV,EAeU,kBAAkB7G,IAChCuH,EAhBIV,EAgBU,cAAc5G,IAC5BsH,EAjBIV,EAiBU,cAAc3G,IAC5BqH,EAlBIV,EAkBU,kBAAkBzG,IAChCmH,EAnBIV,EAmBU,kBAAkBxG,IAChCkH,EApBIV,EAoBU,eAAerG,IAC7B+G,EArBIV,EAqBU,oBAAoBtG,IAClCgH,EAtBIV,EAsBU,cAAc9E,IAC5BwF,EAvBIV,EAuBU,mBAAmB7F,IACjCuG,EAxBIV,EAwBU,kBAAkBvY,GAChCiZ,EAzBIV,EAyBU,YAAYnF,IAC1B6F,EA1BIV,EA0BU,YAAYxE,IAC1BkF,EA3BIV,EA2BU,aAAab,IAC3BuB,EA5BIV,EA4BU,eAAe9C,IAC7BwD,EA7BIV,EA6BU,eAAe1C,IAC7BoD,EA9BIV,EA8BU,cAActC,IAC5BgD,EA/BIV,EA+BU,gBAAgBjI,IAC9B2I,EAhCIV,EAgCU,gBAAgBxB,IAC9BkC,EAjCIV,EAiCU,iBAAiBxD,IAC/BkE,EAlCIV,EAkCU,iBAAiBrD,IAC/B+D,EAnCIV,EAmCU,cAAclJ,IAC5B4J,EApCIV,EAoCU,eAAe/E","x_google_ignoreList":[20]} \ No newline at end of file +{"version":3,"file":"svg-path-commander.js","sources":["../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/options/options.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/error.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/process/absolutizeSegment.ts","../src/process/iterate.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/math/midPoint.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/process/normalizeSegment.ts","../src/parser/paramsParser.ts","../src/convert/pathToCurve.ts","../src/math/roundTo.ts","../src/convert/pathToString.ts","../src/math/distanceSquareRoot.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/util/distanceEpsilon.ts","../src/process/normalizePath.ts","../src/util/getPointAtLength.ts","../src/util/getTotalLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getPathArea.ts","../src/util/getDrawDirection.ts","../src/util/getPathBBox.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/util/shapeToPath.ts","../src/process/getSVGMatrix.ts","../src/process/shortenSegment.ts","../src/process/roundSegment.ts","../src/process/optimizePath.ts","../src/process/projection2d.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/roundPath.ts","../src/process/splitCubic.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/index.ts"],"sourcesContent":["var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let relativeCommand = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[relativeCommand]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (relativeCommand === 'm' && data.length > 2) {\n path.segments.push([pathCommand as PathCommand | number].concat(data.splice(0, 2) as number[]) as PathSegment);\n relativeCommand = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push(\n [pathCommand as PathCommand | number].concat(\n data.splice(0, paramsCount[relativeCommand]) as number[],\n ) as PathSegment,\n );\n }\n\n if (!paramsCount[relativeCommand]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: (string | number)[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | T) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as typeof pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n LSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isAbsolute) return segment as MSegment | AbsoluteSegment;\n // const values = segment.slice(1) as number[];\n if (absCommand === 'A') {\n return [\n absCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as ASegment)[6] + lastX,\n (segment as ASegment)[7] + lastY,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, (segment as VSegment)[1] + lastY] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, (segment as HSegment)[1] + lastX] as HSegment;\n } else if (absCommand === 'L') {\n return [absCommand, (segment as LSegment)[1] + lastX, (segment as LSegment)[2] + lastY] as LSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = (segment.slice(1) as number[]).map((n, j) => n + (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [absCommand as typeof absCommand | number].concat(absValues) as\n | MSegment\n | QSegment\n | TSegment\n | SSegment\n | CSegment;\n }\n};\nexport default absolutizeSegment;\n","// import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback, AbsoluteCommand } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n let absCommand = 'M' as AbsoluteCommand;\n let isRelative = false;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let segLen = 0;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n segLen = segment.length;\n absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n isRelative = absCommand !== pathCommand;\n\n const iteratorResult = iterator(segment, i, x, y);\n // some methods like getPointAtLength would like to break\n // when task is complete\n if (iteratorResult === false) {\n break;\n }\n\n // segment = path[i];\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n x = (segment[1] as number) + (isRelative ? x : 0);\n } else if (absCommand === 'V') {\n y = (segment[1] as number) + (isRelative ? y : 0);\n } else {\n x = (segment[segLen - 2] as number) + (isRelative ? x : 0);\n y = (segment[segLen - 1] as number) + (isRelative ? y : 0);\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n if (iteratorResult) {\n path[i] = iteratorResult;\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n }\n }\n return path as T;\n};\n\nexport default iterate;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n\n return iterate(path, absolutizeSegment);\n};\nexport default pathToAbsolute;\n","import type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n MSegment,\n lSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the relative segment\n */\nconst relativizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isRelative) return segment as MSegment | RelativeSegment;\n\n if (relCommand === 'a') {\n return [\n relCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as aSegment)[6] - lastX,\n (segment as aSegment)[7] - lastY,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, (segment as vSegment)[1] - lastY] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, (segment as hSegment)[1] - lastX] as hSegment;\n } else if (relCommand === 'l') {\n return [relCommand, (segment as lSegment)[1] - lastX, (segment as lSegment)[2] - lastY] as lSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = (segment.slice(1) as number[]).map((n, j) => n - (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [relCommand as RelativeCommand | number].concat(relValues) as qSegment | tSegment | sSegment | cSegment;\n }\n};\n\nexport default relativizeSegment;\n","import type { PathArray, RelativeArray } from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n const path = parsePathString(pathInput);\n\n return iterate(path, relativizeSegment);\n};\nexport default pathToRelative;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const { sin, cos } = Math;\n const X = x * cos(rad) - y * sin(rad);\n const Y = x * sin(rad) + y * cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n }\n res = [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [c1[0], c1[1], c2[0], c2[1], x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n // let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n return ['C' as string | number].concat(\n arcToCubic(px1, py1, values[0], values[1], values[2], values[3], values[4], values[5], values[6]),\n ) as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n return ['C' as string | number].concat(\n quadToCubic(px1, py1, values[0], values[1], values[2], values[3]),\n ) as CSegment;\n } else if (pathCommand === 'L') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, x, y)) as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, px, py)) as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import type { ParserParams } from '../interface';\nimport type {\n NormalSegment,\n PointTuple,\n PathSegment,\n QSegment,\n CSegment,\n LSegment,\n MSegment,\n HSegment,\n VSegment,\n ASegment,\n PathCommand,\n} from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the normalization parameters\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = pathCommand !== absCommand;\n const { x1: px1, y1: py1, x2: px2, y2: py2, x, y } = params;\n const values = segment.slice(1) as number[];\n let absValues = values.map((n, j) => n + (isRelative ? (j % 2 ? y : x) : 0));\n\n if (!'TQ'.includes(absCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n // istanbul ignore else @preserve\n if (absCommand === 'A') {\n absValues = values.slice(0, -2).concat(values[5] + (isRelative ? x : 0), values[6] + (isRelative ? y : 0));\n\n return ['A' as PathCommand | number].concat(absValues) as ASegment;\n } else if (absCommand === 'H') {\n return ['L', (segment as HSegment)[1] + (isRelative ? x : 0), py1] as LSegment;\n } else if (absCommand === 'V') {\n return ['L', px1, (segment as VSegment)[1] + (isRelative ? y : 0)] as LSegment;\n } else if (absCommand === 'L') {\n return [\n 'L',\n (segment as LSegment)[1] + (isRelative ? x : 0),\n (segment as LSegment)[2] + (isRelative ? y : 0),\n ] as LSegment;\n } else if (absCommand === 'M') {\n return [\n 'M',\n (segment as MSegment)[1] + (isRelative ? x : 0),\n (segment as MSegment)[2] + (isRelative ? y : 0),\n ] as MSegment;\n } else if (absCommand === 'C') {\n return ['C' as PathCommand | number].concat(absValues) as CSegment;\n } else if (absCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1].concat(absValues) as CSegment;\n } else if (absCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy].concat(absValues) as QSegment;\n } else if (absCommand === 'Q') {\n const [nqx, nqy] = absValues as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n return ['Q' as PathCommand | number].concat(absValues) as QSegment;\n } else if (absCommand === 'Z') {\n return ['Z'] as NormalSegment;\n }\n\n // istanbul ignore next @preserve\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n const params = { ...paramsParser };\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, index, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as AbsoluteCommand | number].concat(result.slice(7)) as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default pathToCurve;\n","const roundTo = (n: number, round: number) => {\n const pow = round >= 1 ? 10 ** round : 1;\n\n return round > 0 ? Math.round(n * pow) / pow : Math.round(n);\n};\n\nexport default roundTo;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport roundTo from '../math/roundTo';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param roundOption amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, roundOption?: number | 'off'): string => {\n const pathLen = path.length;\n let { round } = defaultOptions;\n let segment = path[0] as PathSegment;\n let result = '';\n\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n const [pathCommand] = segment;\n const values = segment.slice(1) as number[];\n result += pathCommand;\n if (round === 'off') {\n result += values.join(' ');\n } else {\n let j = 0;\n const valLen = values.length;\n while (j < valLen) {\n result += roundTo(values[j], round);\n if (j !== valLen - 1) result += ' ';\n j += 1;\n }\n }\n }\n\n return result;\n};\n\nexport default pathToString;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple) => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nconst getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nconst getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nconst getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n\nexport { getPointAtLineLength, getLineBBox, getLineLength };\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst arcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const length = Math.sqrt(term1 + term2) * theta;\n return Math.abs(length);\n};\n\n/**\n * Find point on ellipse at given angle around ellipse (theta);\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the arc rotation angle in radians\n * @param theta the arc sweep angle in radians\n * @returns a point around ellipse at given angle\n */\nconst arcPoint = (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => {\n const { sin, cos } = Math;\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cosA = cos(alpha);\n const sinA = sin(alpha);\n const x = rx * cos(theta);\n const y = ry * sin(theta);\n\n return {\n x: cx + cosA * x - sinA * y,\n y: cy + sinA * x + cosA * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle in radian\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n return sign * Math.acos(p / n);\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle,\n * end angle, and radiuses on X and Y axis.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n // istanbul ignore next @preserve\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x: (x + x1) / 2, y: (y + y1) / 2 },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nconst getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return arcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nconst getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = arcLength(rx, ry, endAngle - startAngle);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the extrema for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nconst getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n const { min, max, tan, atan2, PI } = Math;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const { x: cx, y: cy } = center;\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * PI) / 180;\n const tangent = tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = atan2(-ry * tangent, rx);\n const angle1 = theta;\n const angle2 = theta + PI;\n const angle3 = atan2(ry, rx * tangent);\n const angle4 = angle3 + PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = min(...xArr);\n const xMax = max(...xArr);\n const yMin = min(...yArr);\n const yMax = max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arcPoint(cx, cy, rx, ry, alpha, angleAfterStart);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arcPoint(cx, cy, rx, ry, alpha, angleBeforeEnd);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle1));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle2));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle4));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle3));\n }\n\n return {\n min: {\n x: min(...extremes.map(n => n.x)),\n y: min(...extremes.map(n => n.y)),\n },\n max: {\n x: max(...extremes.map(n => n.x)),\n y: max(...extremes.map(n => n.y)),\n },\n };\n};\n\nexport { arcPoint, angleBetween, getArcLength, arcLength, getArcBBox, getArcProps, getPointAtArcLength };\n\nexport {};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst deriveBezier = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst computeBezier = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], { x: 0, y: 0 } as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst calculateBezier = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst bezierLength = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * calculateBezier(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nconst getBezierLength = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = deriveBezier(points);\n return bezierLength((t: number) => {\n return computeBezier(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A an array which consist of X/Y values\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nconst minmaxQ = ([v1, cp, v2]: [number, number, number]) => {\n const min = Math.min(v1, v2);\n const max = Math.max(v1, v2);\n\n /* istanbul ignore next @preserve */\n if (cp >= v1 ? v2 >= cp : v2 <= cp) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (v1 * v2 - cp * cp) / (v1 - 2 * cp + v2);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A an array which consist of X/Y values\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nconst minmaxC = ([v1, cp1, cp2, v2]: [number, number, number, number]) => {\n const K = v1 - 3 * cp1 + 3 * cp2 - v2;\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (v1 === v2 && v1 === cp1) {\n // no curve, point targeting same location\n return [v1, v2] as PointTuple;\n }\n\n return minmaxQ([v1, -0.5 * v1 + 1.5 * cp1, v1 - 3 * cp1 + 3 * cp2]);\n }\n\n // the reduced discriminant of the derivative\n const T = -v1 * cp2 + v1 * v2 - cp1 * cp2 - cp1 * v2 + cp1 * cp1 + cp2 * cp2;\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(v1, v2), Math.max(v1, v2)] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(v1, v2);\n let max = Math.max(v1, v2);\n\n const L = v1 - 2 * cp1 + cp2;\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n v1 * (1 - R) * (1 - R) * (1 - R) + cp1 * 3 * (1 - R) * (1 - R) * R + cp2 * 3 * (1 - R) * R * R + v2 * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n\nexport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n};\n","import { getBezierLength, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nconst getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nconst getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nconst getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n","import { getBezierLength, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nconst getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return getBezierLength([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nconst getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n","import distanceSquareRoot from './distanceSquareRoot';\nimport { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]) => {\n const n = polygon.length;\n let i = -1;\n let a: PointTuple;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]) => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport { polygonArea, polygonLength };\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import normalizeSegment from './normalizeSegment';\nimport type { NormalArray, PathArray } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Normalizes a `pathArray` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n return iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default normalizePath;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport type { MSegment, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = normalizePath(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber || distance < DISTANCE_EPSILON) return point;\n\n // for (let i = 0; i < pathLen; i += 1) {\n iterate(path, (seg, _, lastX, lastY) => {\n [pathCommand] = seg;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(seg.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(data[0], data[1], data[2], data[3], distance - totalLength);\n length = getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n data[8],\n distance - totalLength,\n );\n length = getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n distance - totalLength,\n );\n length = getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(data[0], data[1], data[2], data[3], data[4], data[5], distance - totalLength);\n length = getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n point = { x: mx, y: my };\n\n length = getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n [x, y] = data.slice(-2);\n\n if (totalLength < distance) {\n POINT = point;\n } else {\n // totalLength >= distance\n // stop right here\n // stop iterator now!\n return false;\n }\n\n totalLength += length;\n return;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n return { x, y };\n }\n\n return POINT;\n};\n\nexport default getPointAtLength;\n","import type { MSegment, PathArray } from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\n// import normalizePath from '../process/normalizePath';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(normalSegment.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n const seglen = normalSegment.length;\n params.x1 = +normalSegment[seglen - 2];\n params.y1 = +normalSegment[seglen - 1];\n params.x2 = +normalSegment[seglen - 4] || params.x1;\n params.y2 = +normalSegment[seglen - 3] || params.y1;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import type { PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n segment = pathArray[index];\n return {\n segment,\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import type { PathArray, Point } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: Point): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(normalPath);\n const distanceTo = (p: Point) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: Point;\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, seg[1], seg[2], seg[3], seg[4], seg[5], seg[6]);\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport { MSegment, PathArray, Point } from '../types';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n const x = 0;\n const y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n const params = { ...paramsParser };\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n [pathCommand] = result;\n data = [lastX, lastY].concat(result.slice(1) as number[]);\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = result as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(data[0], data[1], data[2], data[3], data[4], data[5]));\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import defaultOptions from '../options/options';\nimport type { ParserParams } from '../interface';\nimport roundTo from '../math/roundTo';\nimport type { AbsoluteSegment, NormalSegment, PathCommand, ShortSegment, SSegment, TSegment } from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const { round: defaultRound } = defaultOptions;\n const round = typeof defaultRound === 'number' ? defaultRound : /* istanbul ignore next */ 4;\n const normalValues = normalSegment.slice(1) as number[];\n const { x1, y1, x2, y2, x, y } = params;\n const [nx, ny] = normalValues.slice(-2);\n const result = segment;\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'L') {\n if (roundTo(x, round) === roundTo(nx, round)) {\n return ['V', ny];\n } else if (roundTo(y, round) === roundTo(ny, round)) {\n return ['H', nx];\n }\n } else if (pathCommand === 'C') {\n const [nx1, ny1] = normalValues;\n params.x1 = nx1;\n params.y1 = ny1;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((roundTo(nx1, round) === roundTo(x1 * 2 - x2, round) && roundTo(ny1, round) === roundTo(y1 * 2 - y2, round)) ||\n (roundTo(x1, round) === roundTo(x2 * 2 - x, round) && roundTo(y1, round) === roundTo(y2 * 2 - y, round)))\n ) {\n return ['S', normalValues[2], normalValues[3], normalValues[4], normalValues[5]] as SSegment;\n }\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n roundTo(qx, round) === roundTo(x1 * 2 - x2, round) &&\n roundTo(qy, round) === roundTo(y1 * 2 - y2, round)\n ) {\n return ['T', normalValues[2], normalValues[3]] as TSegment;\n }\n }\n\n // ['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)\n return result as ShortSegment;\n};\n\nexport default shortenSegment;\n","import type { PathCommand, PathSegment } from '../types';\nimport roundTo from '../math/roundTo';\n\nconst roundSegment = (segment: T, roundOption: number) => {\n const values = (segment.slice(1) as number[]).map(n => roundTo(n, roundOption));\n return [segment[0] as PathCommand | number].concat(values) as T;\n};\n\nexport default roundSegment;\n","import pathToAbsolute from '../convert/pathToAbsolute';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport type { AbsoluteSegment, PathArray, PathCommand } from '../types';\nimport iterate from './iterate';\nimport normalizeSegment from './normalizeSegment';\nimport relativizeSegment from './relativizeSegment';\nimport roundSegment from './roundSegment';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param roundOption the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, roundOption: number) => {\n const path = pathToAbsolute(pathInput);\n // allow for ZERO decimals or use an aggressive value of 2\n const round =\n typeof roundOption === 'number' && roundOption >= 0 ? roundOption : /* istanbul ignore next @preserve */ 2;\n // this utility overrides the iterator params\n const optimParams = { ...paramsParser };\n\n const allPathCommands = [] as PathCommand[];\n let pathCommand = 'M' as PathCommand;\n let prevCommand = 'Z' as PathCommand;\n\n return iterate(path, (seg, i, lastX, lastY) => {\n optimParams.x = lastX;\n optimParams.y = lastY;\n // const absoluteSegment = absolutizeSegment(seg, optimParams);\n const normalizedSegment = normalizeSegment(seg, optimParams);\n let result = seg;\n [pathCommand] = seg;\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n if (i) {\n // Get previous path command for `shortenSegment`\n prevCommand = allPathCommands[i - 1];\n const shortSegment = shortenSegment(seg as AbsoluteSegment, normalizedSegment, optimParams, prevCommand);\n const absSegment = roundSegment(shortSegment, round);\n const absString = absSegment.join('');\n const relativeSegment = relativizeSegment(shortSegment, i, lastX, lastY);\n const relSegment = roundSegment(relativeSegment, round);\n const relString = relSegment.join('');\n result = absString.length < relString.length ? absSegment : relSegment;\n }\n\n const seglen = normalizedSegment.length;\n optimParams.x1 = +normalizedSegment[seglen - 2];\n optimParams.y1 = +normalizedSegment[seglen - 1];\n optimParams.x2 = +normalizedSegment[seglen - 4] || optimParams.x1;\n optimParams.y2 = +normalizedSegment[seglen - 3] || optimParams.y1;\n\n return result;\n });\n};\n\nexport default optimizePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(v[0], v[1], v[2]);\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [point2D[0], point2D[1], 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import type { CSegment, CurveArray, MSegment, PathCommand } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray) => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? path[0].slice(1).concat(x.slice(1) as number[]) : curveOnly[i - 1].slice(-2).concat(x.slice(1)),\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse() as (MSegment | CSegment)[];\n\n return [['M' as PathCommand | number].concat(rotatedCurve[0].slice(0, 2))].concat(\n rotatedCurve.map(x => ['C' as PathCommand | number].concat(x.slice(2))),\n ) as CurveArray;\n};\n\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n PointTuple,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\nimport iterate from './iterate';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance\n * with absolute values.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray) => {\n const absolutePath = pathToAbsolute(pathInput);\n const normalizedPath = normalizePath(absolutePath);\n const pLen = absolutePath.length;\n const isClosed = absolutePath[pLen - 1][0] === 'Z';\n\n const reversedPath = iterate(absolutePath, (segment, i) => {\n const normalizedSegment = normalizedPath[i];\n const prevSeg = i && absolutePath[i - 1];\n const prevCommand = prevSeg && prevSeg[0];\n const nextSeg = absolutePath[i + 1];\n const nextCommand = nextSeg && nextSeg[0];\n const [pathCommand] = segment;\n const [x, y] = normalizedPath[i ? i - 1 : pLen - 1].slice(-2) as PointTuple;\n let result = segment;\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [\n pathCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5] === 1 ? 0 : 1,\n x,\n y,\n ] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextCommand === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevCommand && 'CS'.includes(prevCommand) && (!nextSeg || nextCommand !== 'S')) {\n result = [\n 'C',\n normalizedSegment[3],\n normalizedSegment[4],\n normalizedSegment[1],\n normalizedSegment[2],\n x,\n y,\n ] as CSegment;\n } else {\n result = [pathCommand, normalizedSegment[1], normalizedSegment[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextCommand === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, segment[1], segment[2], x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevCommand && 'QT'.includes(prevCommand) && (!nextSeg || nextCommand !== 'T')) {\n result = ['Q', normalizedSegment[1], normalizedSegment[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand as typeof pathCommand | number].concat(segment.slice(1, -2), x, y) as PathSegment;\n }\n\n return result;\n });\n\n return (\n isClosed ? reversedPath.reverse() : [reversedPath[0] as PathSegment].concat(reversedPath.slice(1).reverse())\n ) as PathArray;\n};\n\nexport default reversePath;\n","import type { PathArray } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\nimport roundSegment from './roundSegment';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n /* istanbul ignore else @preserve */\n if (round === 'off') return path.slice(0) as PathArray;\n\n return iterate(path, segment => {\n return roundSegment(segment, round);\n });\n};\nexport default roundPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', p4[0], p4[1], p7[0], p7[1], p9[0], p9[1]],\n ['C', p8[0], p8[1], p6[0], p6[1], p3[0], p3[1]],\n ];\n};\nexport default splitCubic;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, AbsoluteSegment, CSegment, LSegment, PathArray, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n // last x and y transformed values\n let x = 0;\n let y = 0;\n // new x and y transformed\n let lx = 0;\n let ly = 0;\n // segment params iteration index and length\n let j = 0;\n let jj = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path.slice(0) as typeof path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path.slice(0) as typeof path;\n\n return iterate(path, (seg, index, lastX, lastY) => {\n transformParams.x = lastX;\n transformParams.y = lastY;\n [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = absCommand !== pathCommand;\n const absoluteSegment = isRelative\n ? absolutizeSegment(seg, index, lastX, lastY)\n : (seg.slice(0) as AbsoluteSegment);\n\n let result =\n absCommand === 'A'\n ? segmentToCubic(absoluteSegment, transformParams)\n : ['V', 'H'].includes(absCommand)\n ? normalizeSegment(absoluteSegment, transformParams)\n : absoluteSegment;\n\n // update pathCommand\n pathCommand = result[0];\n const isLongArc = pathCommand === 'C' && result.length > 7;\n const tempSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as AbsoluteSegment;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as typeof pathCommand | number].concat(result.slice(7)) as CSegment);\n result = tempSegment as CSegment;\n }\n\n if (pathCommand === 'L') {\n [lx, ly] = projection2d(matrixInstance, [(result as LSegment)[1], (result as LSegment)[2]], origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n const seglen = tempSegment.length;\n transformParams.x1 = +tempSegment[seglen - 2];\n transformParams.y1 = +tempSegment[seglen - 1];\n transformParams.x2 = +tempSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +tempSegment[seglen - 3] || transformParams.y1;\n\n return result;\n });\n};\n\nexport default transformPath;\n","'use strict';\nimport CSSMatrix from '@thednp/dommatrix';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\nimport * as arcTools from './math/arcTools';\nimport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n} from './math/bezier';\nimport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools';\nimport { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools';\nimport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools';\nimport { polygonArea, polygonLength } from './math/polygonTools';\n\nimport distanceSquareRoot from './math/distanceSquareRoot';\nimport midPoint from './math/midPoint';\nimport rotateVector from './math/rotateVector';\nimport roundTo from './math/roundTo';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\nimport finalizeSegment from './parser/finalizeSegment';\nimport invalidPathValue from './parser/invalidPathValue';\nimport isArcCommand from './parser/isArcCommand';\nimport isDigit from './parser/isDigit';\nimport isDigitStart from './parser/isDigitStart';\nimport isMoveCommand from './parser/isMoveCommand';\nimport isPathCommand from './parser/isPathCommand';\nimport isSpace from './parser/isSpace';\nimport paramsCount from './parser/paramsCount';\nimport paramsParser from './parser/paramsParser';\nimport pathParser from './parser/pathParser';\nimport scanFlag from './parser/scanFlag';\nimport scanParam from './parser/scanParam';\nimport scanSegment from './parser/scanSegment';\nimport skipSpaces from './parser/skipSpaces';\n\nimport distanceEpsilon from './util/distanceEpsilon';\nimport getClosestPoint from './util/getClosestPoint';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPathArea from './util/getPathArea';\nimport getPathBBox from './util/getPathBBox';\nimport getPointAtLength from './util/getPointAtLength';\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getTotalLength from './util/getTotalLength';\n\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport isPathArray from './util/isPathArray';\nimport isPointInStroke from './util/isPointInStroke';\nimport isRelativeArray from './util/isRelativeArray';\nimport isValidPath from './util/isValidPath';\nimport shapeParams from './util/shapeParams';\nimport shapeToPath from './util/shapeToPath';\nimport shapeToPathArray from './util/shapeToPathArray';\n\nimport absolutizeSegment from './process/absolutizeSegment';\nimport arcToCubic from './process/arcToCubic';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport iterate from './process/iterate';\nimport lineToCubic from './process/lineToCubic';\nimport normalizePath from './process/normalizePath';\nimport normalizeSegment from './process/normalizeSegment';\nimport optimizePath from './process/optimizePath';\nimport projection2d from './process/projection2d';\nimport quadToCubic from './process/quadToCubic';\nimport relativizeSegment from './process/relativizeSegment';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport roundPath from './process/roundPath';\nimport roundSegment from './process/roundSegment';\nimport segmentToCubic from './process/segmentToCubic';\nimport shortenSegment from './process/shortenSegment';\nimport splitCubic from './process/splitCubic';\nimport splitPath from './process/splitPath';\nimport transformPath from './process/transformPath';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n public static arcTools = arcTools;\n public static bezierTools = {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n };\n public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength };\n public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n public static polygonTools = { polygonArea, polygonLength };\n public static distanceSquareRoot = distanceSquareRoot;\n public static distanceEpsilon = distanceEpsilon;\n public static midPoint = midPoint;\n public static rotateVector = rotateVector;\n public static roundTo = roundTo;\n public static finalizeSegment = finalizeSegment;\n public static invalidPathValue = invalidPathValue;\n public static isArcCommand = isArcCommand;\n public static isDigit = isDigit;\n public static isDigitStart = isDigitStart;\n public static isMoveCommand = isMoveCommand;\n public static isPathCommand = isPathCommand;\n public static isSpace = isSpace;\n public static paramsCount = paramsCount;\n public static paramsParser = paramsParser;\n public static pathParser = pathParser;\n public static scanFlag = scanFlag;\n public static scanParam = scanParam;\n public static scanSegment = scanSegment;\n public static skipSpaces = skipSpaces;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static shapeParams = shapeParams;\n public static parsePathString = parsePathString;\n public static absolutizeSegment = absolutizeSegment;\n public static arcToCubic = arcToCubic;\n public static getSVGMatrix = getSVGMatrix;\n public static iterate = iterate;\n public static lineToCubic = lineToCubic;\n public static normalizePath = normalizePath;\n public static normalizeSegment = normalizeSegment;\n public static optimizePath = optimizePath;\n public static projection2d = projection2d;\n public static quadToCubic = quadToCubic;\n public static relativizeSegment = relativizeSegment;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static roundPath = roundPath;\n public static roundSegment = roundSegment;\n public static segmentToCubic = segmentToCubic;\n public static shortenSegment = shortenSegment;\n public static splitCubic = splitCubic;\n public static splitPath = splitPath;\n public static transformPath = transformPath;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n this.segments = parsePathString(pathValue);\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n const round = this.round === 'off' ? 2 : this.round;\n\n this.segments = optimizePath(segments, round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["Z","z","s","e","p","$","E","P","y","g","n","i","r","a","l","m","h","c","u","w","o","d","A","M","b","X","O","x","Y","F","T","k","I","v","R","D","N","defaultOptions","paramsCount","finalizeSegment","path","pathCommand","relativeCommand","data","error","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","PathParser","pathString","parsePathString","pathInput","absolutizeSegment","segment","lastX","lastY","absCommand","absValues","j","iterate","iterator","pathLen","isRelative","mx","my","segLen","iteratorResult","pathToAbsolute","relativizeSegment","relCommand","relValues","pathToRelative","rotateVector","rad","sin","cos","arcToCubic","X1","Y1","RX","RY","angle","LAF","SF","X2","Y2","recursive","x1","y1","rx","ry","x2","y2","d120","res","xy","f1","f2","cx","cy","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","t","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","qx","qy","r13","r23","midPoint","ax","ay","bx","by","lineToCubic","segmentToCubic","params","values","px1","py1","px","py","normalizeSegment","px2","py2","nqx","nqy","paramsParser","pathToCurve","seg","normalSegment","result","seglen","roundTo","round","pow","pathToString","roundOption","valLen","distanceSquareRoot","getLineLength","getPointAtLineLength","distance","point","length","getLineBBox","min","arcLength","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcPoint","alpha","cosA","sinA","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","tan","atan2","extremes","tangent","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","Tvalues","Cvalues","deriveBezier","points","dpoints","list","computeBezier","order","mt","mt2","t2","calculateBezier","derivativeFn","bezierLength","len","sum","getBezierLength","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","cp","v2","minmaxC","cp1","cp2","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","polygonArea","polygon","area","polygonLength","DISTANCE_EPSILON","normalizePath","_","getPointAtLength","isM","POINT","totalLength","getTotalLength","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getCubicSegArea","getPathArea","getDrawDirection","getPathBBox","MIN","MAX","width","height","getSegmentAtLength","getSegmentOfPoint","isPathArray","lk","isAbsoluteArray","isNormalizedArray","pc","isCurveArray","isPointInStroke","isRelativeArray","isValidPath","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","shapeToPath","replace","doc","description","name","value","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","shortenSegment","prevCommand","defaultRound","normalValues","nx","ny","nx1","ny1","roundSegment","optimizePath","optimParams","allPathCommands","normalizedSegment","shortSegment","absSegment","absString","relativeSegment","relSegment","relString","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","reverseCurve","rotatedCurve","curveOnly","reversePath","absolutePath","normalizedPath","pLen","isClosed","reversedPath","prevSeg","nextSeg","nextCommand","roundPath","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","splitPath","composite","pi","transformPath","lx","ly","jj","transformParams","transformProps","matrixInstance","absoluteSegment","isLongArc","tempSegment","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField","arcTools","distanceEpsilon","pathParser"],"mappings":"qNAAA,IAAIA,EAAI,OAAO,eACXC,EAAI,CAACC,EAAG,EAAGC,IAAM,KAAKD,EAAIF,EAAEE,EAAG,EAAG,CAAE,WAAY,GAAI,aAAc,GAAI,SAAU,GAAI,MAAOC,CAAC,CAAE,EAAID,EAAE,CAAC,EAAIC,EACzGC,EAAI,CAACF,EAAG,EAAGC,IAAMF,EAAEC,EAAG,OAAO,GAAK,SAAW,EAAI,GAAK,EAAGC,CAAC,EAC9D,MAAME,GAAI,CACR,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK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EArDIV,EAqDU,kBAAkBvG,IAChCiH,EAtDIV,EAsDU,cAAcrG,IAC5B+G,EAvDIV,EAuDU,cAAc7G,IAC5BuH,EAxDIV,EAwDU,kBAAkB3G,IAChCqH,EAzDIV,EAyDU,kBAAkBtG,IAChCgH,EA1DIV,EA0DU,eAAexG,IAC7BkH,EA3DIV,EA2DU,oBAAoB1G,IAClCoH,EA5DIV,EA4DU,cAAcnF,IAC5B6F,EA7DIV,EA6DU,mBAAmB7F,IACjCuG,EA9DIV,EA8DU,cAAcpG,IAC5B8G,EA/DIV,EA+DU,kBAAkBvX,GAChCiY,EAhEIV,EAgEU,oBAAoBrX,IAClC+X,EAjEIV,EAiEU,aAAa7V,IAC3BuW,EAlEIV,EAkEU,eAAe7E,IAC7BuF,EAnEIV,EAmEU,UAAU9W,GACxBwX,EApEIV,EAoEU,cAAcxS,IAC5BkT,EArEIV,EAqEU,gBAAgBpJ,IAC9B8J,EAtEIV,EAsEU,mBAAmBhS,GACjC0S,EAvEIV,EAuEU,eAAezD,IAC7BmE,EAxEIV,EAwEU,eAAe7C,IAC7BuD,EAzEIV,EAyEU,cAAclT,IAC5B4T,EA1EIV,EA0EU,oBAAoBrW,IAClC+W,EA3EIV,EA2EU,eAAevC,IAC7BiD,EA5EIV,EA4EU,cAAcpC,IAC5B8C,EA7EIV,EA6EU,YAAY3B,IAC1BqC,EA9EIV,EA8EU,eAAe1D,IAC7BoE,EA/EIV,EA+EU,iBAAiBvS,IAC/BiT,EAhFIV,EAgFU,iBAAiBlE,IAC/B4E,EAjFIV,EAiFU,aAAa1B,IAC3BoC,EAlFIV,EAkFU,YAAYb,IAC1BuB,EAnFIV,EAmFU,gBAAgBV","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/dist/svg-path-commander.mjs b/dist/svg-path-commander.mjs index ccda60c..f310e99 100644 --- a/dist/svg-path-commander.mjs +++ b/dist/svg-path-commander.mjs @@ -1,184 +1,8 @@ -var he = Object.defineProperty; -var fe = (e, t, n) => t in e ? he(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; -var N = (e, t, n) => fe(e, typeof t != "symbol" ? t + "" : t, n); -const st = { - origin: [0, 0, 0], - round: 4 -}, E = "SVGPathCommander Error", tt = { - a: 7, - c: 6, - h: 1, - l: 2, - m: 2, - r: 4, - q: 4, - s: 4, - t: 2, - v: 1, - z: 0 -}, $t = (e) => { - let t = e.pathValue[e.segmentStart], n = t.toLowerCase(); - const { data: r } = e; - for (; r.length >= tt[n] && (n === "m" && r.length > 2 ? (e.segments.push([t, ...r.splice(0, 2)]), n = "l", t = t === "m" ? "l" : "L") : e.segments.push([t, ...r.splice(0, tt[n])]), !!tt[n]); ) - ; -}, ye = (e) => { - const { index: t, pathValue: n } = e, r = n.charCodeAt(t); - if (r === 48) { - e.param = 0, e.index += 1; - return; - } - if (r === 49) { - e.param = 1, e.index += 1; - return; - } - e.err = `${E}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`; -}, F = (e) => e >= 48 && e <= 57, U = "Invalid path value", ge = (e) => { - const { max: t, pathValue: n, index: r } = e; - let s = r, i = !1, o = !1, c = !1, l = !1, a; - if (s >= t) { - e.err = `${E}: ${U} at index ${s}, "pathValue" is missing param`; - return; - } - if (a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1, a = n.charCodeAt(s)), !F(a) && a !== 46) { - e.err = `${E}: ${U} at index ${s}, "${n[s]}" is not a number`; - return; - } - if (a !== 46) { - if (i = a === 48, s += 1, a = n.charCodeAt(s), i && s < t && a && F(a)) { - e.err = `${E}: ${U} at index ${r}, "${n[r]}" illegal number`; - return; - } - for (; s < t && F(n.charCodeAt(s)); ) - s += 1, o = !0; - a = n.charCodeAt(s); - } - if (a === 46) { - for (l = !0, s += 1; F(n.charCodeAt(s)); ) - s += 1, c = !0; - a = n.charCodeAt(s); - } - if (a === 101 || a === 69) { - if (l && !o && !c) { - e.err = `${E}: ${U} at index ${s}, "${n[s]}" invalid float exponent`; - return; - } - if (s += 1, a = n.charCodeAt(s), (a === 43 || a === 45) && (s += 1), s < t && F(n.charCodeAt(s))) - for (; s < t && F(n.charCodeAt(s)); ) - s += 1; - else { - e.err = `${E}: ${U} at index ${s}, "${n[s]}" invalid integer exponent`; - return; - } - } - e.index = s, e.param = +e.pathValue.slice(r, s); -}, xe = (e) => [ - // Special spaces - 5760, - 6158, - 8192, - 8193, - 8194, - 8195, - 8196, - 8197, - 8198, - 8199, - 8200, - 8201, - 8202, - 8239, - 8287, - 12288, - 65279, - // Line terminators - 10, - 13, - 8232, - 8233, - // White spaces - 32, - 9, - 11, - 12, - 160 -].includes(e), et = (e) => { - const { pathValue: t, max: n } = e; - for (; e.index < n && xe(t.charCodeAt(e.index)); ) - e.index += 1; -}, pe = (e) => { - switch (e | 32) { - case 109: - case 122: - case 108: - case 104: - case 118: - case 99: - case 115: - case 113: - case 116: - case 97: - return !0; - default: - return !1; - } -}, de = (e) => F(e) || e === 43 || e === 45 || e === 46, Me = (e) => (e | 32) === 97, be = (e) => { - switch (e | 32) { - case 109: - case 77: - return !0; - default: - return !1; - } -}, Qt = (e) => { - var l; - const { max: t, pathValue: n, index: r, segments: s } = e, i = n.charCodeAt(r), o = tt[n[r].toLowerCase()]; - if (e.segmentStart = r, !pe(i)) { - e.err = `${E}: ${U} "${n[r]}" is not a path command at index ${r}`; - return; - } - const c = s[s.length - 1]; - if (!be(i) && ((l = c == null ? void 0 : c[0]) == null ? void 0 : l.toLocaleLowerCase()) === "z") { - e.err = `${E}: ${U} "${n[r]}" is not a MoveTo path command at index ${r}`; - return; - } - if (e.index += 1, et(e), e.data = [], !o) { - $t(e); - return; - } - for (; ; ) { - for (let a = o; a > 0; a -= 1) { - if (Me(i) && (a === 3 || a === 4) ? ye(e) : ge(e), e.err.length) - return; - e.data.push(e.param), et(e), e.index < t && n.charCodeAt(e.index) === 44 && (e.index += 1, et(e)); - } - if (e.index >= e.max || !de(n.charCodeAt(e.index))) - break; - } - $t(e); -}; -class Xt { - constructor(t) { - this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = ""; - } -} -const q = (e) => { - if (typeof e != "string") - return e.slice(0); - const t = new Xt(e); - for (et(t); t.index < t.max && !t.err.length; ) - Qt(t); - if (t != null && t.err.length) - throw TypeError(t.err); - return t.segments; -}, we = (e) => { - const t = e.length; - let n = -1, r, s = e[t - 1], i = 0; - for (; ++n < t; ) - r = s, s = e[n], i += r[1] * s[0] - r[0] * s[1]; - return i / 2; -}, Pt = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), Ne = (e) => e.reduce((t, n, r) => r ? t + Pt(e[r - 1], n) : 0, 0); -var Ae = Object.defineProperty, Ce = (e, t, n) => t in e ? Ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n, k = (e, t, n) => Ce(e, typeof t != "symbol" ? t + "" : t, n); -const ve = { +var Se = Object.defineProperty; +var De = (e, t, s) => t in e ? Se(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s; +var g = (e, t, s) => De(e, typeof t != "symbol" ? t + "" : t, s); +var Ze = Object.defineProperty, Oe = (e, t, s) => t in e ? Ze(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, q = (e, t, s) => Oe(e, typeof t != "symbol" ? t + "" : t, s); +const Qe = { a: 1, b: 0, c: 0, @@ -203,21 +27,21 @@ const ve = { m44: 1, is2D: !0, isIdentity: !0 -}, Bt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Yt = (e) => e instanceof DOMMatrix || e instanceof v || typeof e == "object" && Object.keys(ve).every((t) => e && t in e), it = (e) => { - const t = new v(), n = Array.from(e); - if (!Bt(n)) - throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`); - if (n.length === 16) { - const [r, s, i, o, c, l, a, m, u, g, f, h, y, x, p, d] = n; - t.m11 = r, t.a = r, t.m21 = c, t.c = c, t.m31 = u, t.m41 = y, t.e = y, t.m12 = s, t.b = s, t.m22 = l, t.d = l, t.m32 = g, t.m42 = x, t.f = x, t.m13 = i, t.m23 = a, t.m33 = f, t.m43 = p, t.m14 = o, t.m24 = m, t.m34 = h, t.m44 = d; - } else if (n.length === 6) { - const [r, s, i, o, c, l] = n; - t.m11 = r, t.a = r, t.m12 = s, t.b = s, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = c, t.e = c, t.m42 = l, t.f = l; +}, Vt = (e) => (e instanceof Float64Array || e instanceof Float32Array || Array.isArray(e) && e.every((t) => typeof t == "number")) && [6, 16].some((t) => e.length === t), Gt = (e) => e instanceof DOMMatrix || e instanceof C || typeof e == "object" && Object.keys(Qe).every((t) => e && t in e), ht = (e) => { + const t = new C(), s = Array.from(e); + if (!Vt(s)) + throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`); + if (s.length === 16) { + const [r, n, i, o, a, c, l, u, m, f, y, h, x, b, A, w] = s; + t.m11 = r, t.a = r, t.m21 = a, t.c = a, t.m31 = m, t.m41 = x, t.e = x, t.m12 = n, t.b = n, t.m22 = c, t.d = c, t.m32 = f, t.m42 = b, t.f = b, t.m13 = i, t.m23 = l, t.m33 = y, t.m43 = A, t.m14 = o, t.m24 = u, t.m34 = h, t.m44 = w; + } else if (s.length === 6) { + const [r, n, i, o, a, c] = s; + t.m11 = r, t.a = r, t.m12 = n, t.b = n, t.m21 = i, t.c = i, t.m22 = o, t.d = o, t.m41 = a, t.e = a, t.m42 = c, t.f = c; } return t; -}, Ht = (e) => { - if (Yt(e)) - return it([ +}, te = (e) => { + if (Gt(e)) + return ht([ e.m11, e.m12, e.m13, @@ -236,47 +60,47 @@ const ve = { e.m44 ]); throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`); -}, Ft = (e) => { +}, ee = (e) => { if (typeof e != "string") throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`); const t = String(e).replace(/\s/g, ""); - let n = new v(); + let s = new C(); const r = `CSSMatrix: invalid transform string "${e}"`; - return t.split(")").filter((s) => s).forEach((s) => { - const [i, o] = s.split("("); + return t.split(")").filter((n) => n).forEach((n) => { + const [i, o] = n.split("("); if (!o) throw TypeError(r); - const c = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [l, a, m, u] = c, g = [l, a, m], f = [l, a, m, u]; - if (i === "perspective" && l && [a, m].every((h) => h === void 0)) - n.m34 = -1 / l; - else if (i.includes("matrix") && [6, 16].includes(c.length) && c.every((h) => !Number.isNaN(+h))) { - const h = c.map((y) => Math.abs(y) < 1e-6 ? 0 : y); - n = n.multiply(it(h)); - } else if (i === "translate3d" && g.every((h) => !Number.isNaN(+h))) - n = n.translate(l, a, m); - else if (i === "translate" && l && m === void 0) - n = n.translate(l, a || 0, 0); - else if (i === "rotate3d" && f.every((h) => !Number.isNaN(+h)) && u) - n = n.rotateAxisAngle(l, a, m, u); - else if (i === "rotate" && l && [a, m].every((h) => h === void 0)) - n = n.rotate(0, 0, l); - else if (i === "scale3d" && g.every((h) => !Number.isNaN(+h)) && g.some((h) => h !== 1)) - n = n.scale(l, a, m); - else if (i === "scale" && !Number.isNaN(l) && l !== 1 && m === void 0) { - const h = Number.isNaN(+a) ? l : a; - n = n.scale(l, h, 1); - } else if (i === "skew" && (l || !Number.isNaN(l) && a) && m === void 0) - n = n.skew(l, a || 0); - else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && l && [a, m].every((h) => h === void 0)) + const a = o.split(",").map((h) => h.includes("rad") ? parseFloat(h) * (180 / Math.PI) : parseFloat(h)), [c, l, u, m] = a, f = [c, l, u], y = [c, l, u, m]; + if (i === "perspective" && c && [l, u].every((h) => h === void 0)) + s.m34 = -1 / c; + else if (i.includes("matrix") && [6, 16].includes(a.length) && a.every((h) => !Number.isNaN(+h))) { + const h = a.map((x) => Math.abs(x) < 1e-6 ? 0 : x); + s = s.multiply(ht(h)); + } else if (i === "translate3d" && f.every((h) => !Number.isNaN(+h))) + s = s.translate(c, l, u); + else if (i === "translate" && c && u === void 0) + s = s.translate(c, l || 0, 0); + else if (i === "rotate3d" && y.every((h) => !Number.isNaN(+h)) && m) + s = s.rotateAxisAngle(c, l, u, m); + else if (i === "rotate" && c && [l, u].every((h) => h === void 0)) + s = s.rotate(0, 0, c); + else if (i === "scale3d" && f.every((h) => !Number.isNaN(+h)) && f.some((h) => h !== 1)) + s = s.scale(c, l, u); + else if (i === "scale" && !Number.isNaN(c) && c !== 1 && u === void 0) { + const h = Number.isNaN(+l) ? c : l; + s = s.scale(c, h, 1); + } else if (i === "skew" && (c || !Number.isNaN(c) && l) && u === void 0) + s = s.skew(c, l || 0); + else if (["translate", "rotate", "scale", "skew"].some((h) => i.includes(h)) && /[XYZ]/.test(i) && c && [l, u].every((h) => h === void 0)) if (i === "skewX" || i === "skewY") - n = n[i](l); + s = s[i](c); else { - const h = i.replace(/[XYZ]/, ""), y = i.replace(h, ""), x = ["X", "Y", "Z"].indexOf(y), p = h === "scale" ? 1 : 0, d = [x === 0 ? l : p, x === 1 ? l : p, x === 2 ? l : p]; - n = n[h](...d); + const h = i.replace(/[XYZ]/, ""), x = i.replace(h, ""), b = ["X", "Y", "Z"].indexOf(x), A = h === "scale" ? 1 : 0, w = [b === 0 ? c : A, b === 1 ? c : A, b === 2 ? c : A]; + s = s[h](...w); } else throw TypeError(r); - }), n; -}, wt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [ + }), s; +}, vt = (e, t) => t ? [e.a, e.b, e.c, e.d, e.e, e.f] : [ e.m11, e.m12, e.m13, @@ -293,47 +117,47 @@ const ve = { e.m42, e.m43, e.m44 -], Ut = (e, t, n) => { - const r = new v(); - return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = n, r; -}, Vt = (e, t, n) => { - const r = new v(), s = Math.PI / 180, i = e * s, o = t * s, c = n * s, l = Math.cos(i), a = -Math.sin(i), m = Math.cos(o), u = -Math.sin(o), g = Math.cos(c), f = -Math.sin(c), h = m * g, y = -m * f; - r.m11 = h, r.a = h, r.m12 = y, r.b = y, r.m13 = u; - const x = a * u * g + l * f; - r.m21 = x, r.c = x; - const p = l * g - a * u * f; - return r.m22 = p, r.d = p, r.m23 = -a * m, r.m31 = a * f - l * u * g, r.m32 = a * g + l * u * f, r.m33 = l * m, r; -}, _t = (e, t, n, r) => { - const s = new v(), i = Math.sqrt(e * e + t * t + n * n); +], ne = (e, t, s) => { + const r = new C(); + return r.m41 = e, r.e = e, r.m42 = t, r.f = t, r.m43 = s, r; +}, se = (e, t, s) => { + const r = new C(), n = Math.PI / 180, i = e * n, o = t * n, a = s * n, c = Math.cos(i), l = -Math.sin(i), u = Math.cos(o), m = -Math.sin(o), f = Math.cos(a), y = -Math.sin(a), h = u * f, x = -u * y; + r.m11 = h, r.a = h, r.m12 = x, r.b = x, r.m13 = m; + const b = l * m * f + c * y; + r.m21 = b, r.c = b; + const A = c * f - l * m * y; + return r.m22 = A, r.d = A, r.m23 = -l * u, r.m31 = l * y - c * m * f, r.m32 = l * f + c * m * y, r.m33 = c * u, r; +}, re = (e, t, s, r) => { + const n = new C(), i = Math.sqrt(e * e + t * t + s * s); if (i === 0) - return s; - const o = e / i, c = t / i, l = n / i, a = r * (Math.PI / 360), m = Math.sin(a), u = Math.cos(a), g = m * m, f = o * o, h = c * c, y = l * l, x = 1 - 2 * (h + y) * g; - s.m11 = x, s.a = x; - const p = 2 * (o * c * g + l * m * u); - s.m12 = p, s.b = p, s.m13 = 2 * (o * l * g - c * m * u); - const d = 2 * (c * o * g - l * m * u); - s.m21 = d, s.c = d; - const C = 1 - 2 * (y + f) * g; - return s.m22 = C, s.d = C, s.m23 = 2 * (c * l * g + o * m * u), s.m31 = 2 * (l * o * g + c * m * u), s.m32 = 2 * (l * c * g - o * m * u), s.m33 = 1 - 2 * (f + h) * g, s; -}, Jt = (e, t, n) => { - const r = new v(); - return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = n, r; -}, yt = (e, t) => { - const n = new v(); + return n; + const o = e / i, a = t / i, c = s / i, l = r * (Math.PI / 360), u = Math.sin(l), m = Math.cos(l), f = u * u, y = o * o, h = a * a, x = c * c, b = 1 - 2 * (h + x) * f; + n.m11 = b, n.a = b; + const A = 2 * (o * a * f + c * u * m); + n.m12 = A, n.b = A, n.m13 = 2 * (o * c * f - a * u * m); + const w = 2 * (a * o * f - c * u * m); + n.m21 = w, n.c = w; + const N = 1 - 2 * (x + y) * f; + return n.m22 = N, n.d = N, n.m23 = 2 * (a * c * f + o * u * m), n.m31 = 2 * (c * o * f + a * u * m), n.m32 = 2 * (c * a * f - o * u * m), n.m33 = 1 - 2 * (y + h) * f, n; +}, ie = (e, t, s) => { + const r = new C(); + return r.m11 = e, r.a = e, r.m22 = t, r.d = t, r.m33 = s, r; +}, At = (e, t) => { + const s = new C(); if (e) { - const r = e * Math.PI / 180, s = Math.tan(r); - n.m21 = s, n.c = s; + const r = e * Math.PI / 180, n = Math.tan(r); + s.m21 = n, s.c = n; } if (t) { - const r = t * Math.PI / 180, s = Math.tan(r); - n.m12 = s, n.b = s; + const r = t * Math.PI / 180, n = Math.tan(r); + s.m12 = n, s.b = n; } - return n; -}, Kt = (e) => yt(e, 0), Wt = (e) => yt(0, e), j = (e, t) => { - const n = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, s = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, c = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, l = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, a = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, m = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, u = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, g = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, f = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, y = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, x = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, p = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44; - return it([n, r, s, i, o, c, l, a, m, u, g, f, h, y, x, p]); + return s; +}, oe = (e) => At(e, 0), ce = (e) => At(0, e), B = (e, t) => { + const s = t.m11 * e.m11 + t.m12 * e.m21 + t.m13 * e.m31 + t.m14 * e.m41, r = t.m11 * e.m12 + t.m12 * e.m22 + t.m13 * e.m32 + t.m14 * e.m42, n = t.m11 * e.m13 + t.m12 * e.m23 + t.m13 * e.m33 + t.m14 * e.m43, i = t.m11 * e.m14 + t.m12 * e.m24 + t.m13 * e.m34 + t.m14 * e.m44, o = t.m21 * e.m11 + t.m22 * e.m21 + t.m23 * e.m31 + t.m24 * e.m41, a = t.m21 * e.m12 + t.m22 * e.m22 + t.m23 * e.m32 + t.m24 * e.m42, c = t.m21 * e.m13 + t.m22 * e.m23 + t.m23 * e.m33 + t.m24 * e.m43, l = t.m21 * e.m14 + t.m22 * e.m24 + t.m23 * e.m34 + t.m24 * e.m44, u = t.m31 * e.m11 + t.m32 * e.m21 + t.m33 * e.m31 + t.m34 * e.m41, m = t.m31 * e.m12 + t.m32 * e.m22 + t.m33 * e.m32 + t.m34 * e.m42, f = t.m31 * e.m13 + t.m32 * e.m23 + t.m33 * e.m33 + t.m34 * e.m43, y = t.m31 * e.m14 + t.m32 * e.m24 + t.m33 * e.m34 + t.m34 * e.m44, h = t.m41 * e.m11 + t.m42 * e.m21 + t.m43 * e.m31 + t.m44 * e.m41, x = t.m41 * e.m12 + t.m42 * e.m22 + t.m43 * e.m32 + t.m44 * e.m42, b = t.m41 * e.m13 + t.m42 * e.m23 + t.m43 * e.m33 + t.m44 * e.m43, A = t.m41 * e.m14 + t.m42 * e.m24 + t.m43 * e.m34 + t.m44 * e.m44; + return ht([s, r, n, i, o, a, c, l, u, m, f, y, h, x, b, A]); }; -class v { +class C { /** * @constructor * @param init accepts all parameter configurations: @@ -378,7 +202,7 @@ class v { * @return the matrix instance */ setMatrixValue(t) { - return typeof t == "string" && t.length && t !== "none" ? Ft(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? it(t) : typeof t == "object" ? Ht(t) : this; + return typeof t == "string" && t.length && t !== "none" ? ee(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? ht(t) : typeof t == "object" ? te(t) : this; } /** * Returns a *Float32Array* containing elements which comprise the matrix. @@ -389,7 +213,7 @@ class v { * @return an *Array* representation of the matrix */ toFloat32Array(t) { - return Float32Array.from(wt(this, t)); + return Float32Array.from(vt(this, t)); } /** * Returns a *Float64Array* containing elements which comprise the matrix. @@ -400,7 +224,7 @@ class v { * @return an *Array* representation of the matrix */ toFloat64Array(t) { - return Float64Array.from(wt(this, t)); + return Float64Array.from(vt(this, t)); } /** * Creates and returns a string representation of the matrix in `CSS` matrix syntax, @@ -412,8 +236,8 @@ class v { * @return a string representation of the matrix */ toString() { - const { is2D: t } = this, n = this.toFloat64Array(t).join(", "); - return `${t ? "matrix" : "matrix3d"}(${n})`; + const { is2D: t } = this, s = this.toFloat64Array(t).join(", "); + return `${t ? "matrix" : "matrix3d"}(${s})`; } /** * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object* @@ -426,8 +250,8 @@ class v { * @return an *Object* with all matrix values. */ toJSON() { - const { is2D: t, isIdentity: n } = this; - return { ...this, is2D: t, isIdentity: n }; + const { is2D: t, isIdentity: s } = this; + return { ...this, is2D: t, isIdentity: s }; } /** * The Multiply method returns a new CSSMatrix which is the result of this @@ -438,7 +262,7 @@ class v { * @return The resulted matrix. */ multiply(t) { - return j(this, t); + return B(this, t); } /** * The translate method returns a new matrix which is this matrix post @@ -451,10 +275,10 @@ class v { * @param z Z component of the translation value. * @return The resulted matrix */ - translate(t, n, r) { - const s = t; - let i = n, o = r; - return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), j(this, Ut(s, i, o)); + translate(t, s, r) { + const n = t; + let i = s, o = r; + return typeof i > "u" && (i = 0), typeof o > "u" && (o = 0), B(this, ne(n, i, o)); } /** * The scale method returns a new matrix which is this matrix post multiplied by @@ -467,10 +291,10 @@ class v { * @param z The Z component of the scale value. * @return The resulted matrix */ - scale(t, n, r) { - const s = t; - let i = n, o = r; - return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), j(this, Jt(s, i, o)); + scale(t, s, r) { + const n = t; + let i = s, o = r; + return typeof i > "u" && (i = t), typeof o > "u" && (o = 1), B(this, ie(n, i, o)); } /** * The rotate method returns a new matrix which is this matrix post multiplied @@ -484,9 +308,9 @@ class v { * @param rz The (optional) Z component of the rotation value. * @return The resulted matrix */ - rotate(t, n, r) { - let s = t, i = n || 0, o = r || 0; - return typeof t == "number" && typeof n > "u" && typeof r > "u" && (o = s, s = 0, i = 0), j(this, Vt(s, i, o)); + rotate(t, s, r) { + let n = t, i = s || 0, o = r || 0; + return typeof t == "number" && typeof s > "u" && typeof r > "u" && (o = n, n = 0, i = 0), B(this, se(n, i, o)); } /** * The rotateAxisAngle method returns a new matrix which is this matrix post @@ -500,10 +324,10 @@ class v { * @param angle The angle of rotation about the axis vector, in degrees. * @return The resulted matrix */ - rotateAxisAngle(t, n, r, s) { - if ([t, n, r, s].some((i) => Number.isNaN(+i))) + rotateAxisAngle(t, s, r, n) { + if ([t, s, r, n].some((i) => Number.isNaN(+i))) throw new TypeError("CSSMatrix: expecting 4 values"); - return j(this, _t(t, n, r, s)); + return B(this, re(t, s, r, n)); } /** * Specifies a skew transformation along the `x-axis` by the given angle. @@ -513,7 +337,7 @@ class v { * @return The resulted matrix */ skewX(t) { - return j(this, Kt(t)); + return B(this, oe(t)); } /** * Specifies a skew transformation along the `y-axis` by the given angle. @@ -523,7 +347,7 @@ class v { * @return The resulted matrix */ skewY(t) { - return j(this, Wt(t)); + return B(this, ce(t)); } /** * Specifies a skew transformation along both the `x-axis` and `y-axis`. @@ -533,8 +357,8 @@ class v { * @param angleY The angle amount in degrees to skew. * @return The resulted matrix */ - skew(t, n) { - return j(this, yt(t, n)); + skew(t, s) { + return B(this, At(t, s)); } /** * Transforms a specified vector using the matrix, returning a new @@ -548,210 +372,531 @@ class v { * @return the resulting Tuple */ transformPoint(t) { - const n = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, r = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, s = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, i = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w; - return t instanceof DOMPoint ? new DOMPoint(n, r, s, i) : { - x: n, + const s = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, r = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, n = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, i = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w; + return t instanceof DOMPoint ? new DOMPoint(s, r, n, i) : { + x: s, y: r, - z: s, + z: n, w: i }; } } -k(v, "Translate", Ut), k(v, "Rotate", Vt), k(v, "RotateAxisAngle", _t), k(v, "Scale", Jt), k(v, "SkewX", Kt), k(v, "SkewY", Wt), k(v, "Skew", yt), k(v, "Multiply", j), k(v, "fromArray", it), k(v, "fromMatrix", Ht), k(v, "fromString", Ft), k(v, "toArray", wt), k(v, "isCompatibleArray", Bt), k(v, "isCompatibleObject", Yt); -const gt = { - x1: 0, - y1: 0, - x2: 0, - y2: 0, - x: 0, - y: 0, - qx: null, - qy: null -}, D = (e, t) => { - const n = { ...gt }; - let r = e.length, s; - for (let i = 0; i < r; i += 1) { - s = e[i]; - const o = t(s, n, i); - e[i] = o, o[0] === "C" && (r = e.length), s = e[i]; - const c = s.length; - n.x1 = +s[c - 2], n.y1 = +s[c - 1], n.x2 = +s[c - 4] || n.x1, n.y2 = +s[c - 3] || n.y1; +q(C, "Translate", ne), q(C, "Rotate", se), q(C, "RotateAxisAngle", re), q(C, "Scale", ie), q(C, "SkewX", oe), q(C, "SkewY", ce), q(C, "Skew", At), q(C, "Multiply", B), q(C, "fromArray", ht), q(C, "fromMatrix", te), q(C, "fromString", ee), q(C, "toArray", vt), q(C, "isCompatibleArray", Vt), q(C, "isCompatibleObject", Gt); +const V = { + origin: [0, 0, 0], + round: 4 +}, nt = { + a: 7, + c: 6, + h: 1, + l: 2, + m: 2, + r: 4, + q: 4, + s: 4, + t: 2, + v: 1, + z: 0 +}, Tt = (e) => { + let t = e.pathValue[e.segmentStart], s = t.toLowerCase(); + const { data: r } = e; + for (; r.length >= nt[s] && (s === "m" && r.length > 2 ? (e.segments.push([t].concat(r.splice(0, 2))), s = "l", t = t === "m" ? "l" : "L") : e.segments.push( + [t].concat( + r.splice(0, nt[s]) + ) + ), !!nt[s]); ) + ; +}, E = "SVGPathCommander Error", ae = (e) => { + const { index: t, pathValue: s } = e, r = s.charCodeAt(t); + if (r === 48) { + e.param = 0, e.index += 1; + return; } - return e; -}, V = (e, t) => { - const [n] = e, { x: r, y: s } = t, i = e.slice(1).map(Number), o = n.toUpperCase(); - if (!(o === n)) { - if (o === "A") - return [ - o, - i[0], - i[1], - i[2], - i[3], - i[4], - i[5] + r, - i[6] + s - ]; - if (o === "V") - return [o, i[0] + s]; - if (o === "H") - return [o, i[0] + r]; - { - const l = i.map((a, m) => a + (m % 2 ? s : r)); - return [o, ...l]; + if (r === 49) { + e.param = 1, e.index += 1; + return; + } + e.err = `${E}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`; +}, H = (e) => e >= 48 && e <= 57, U = "Invalid path value", le = (e) => { + const { max: t, pathValue: s, index: r } = e; + let n = r, i = !1, o = !1, a = !1, c = !1, l; + if (n >= t) { + e.err = `${E}: ${U} at index ${n}, "pathValue" is missing param`; + return; + } + if (l = s.charCodeAt(n), (l === 43 || l === 45) && (n += 1, l = s.charCodeAt(n)), !H(l) && l !== 46) { + e.err = `${E}: ${U} at index ${n}, "${s[n]}" is not a number`; + return; + } + if (l !== 46) { + if (i = l === 48, n += 1, l = s.charCodeAt(n), i && n < t && l && H(l)) { + e.err = `${E}: ${U} at index ${r}, "${s[r]}" illegal number`; + return; + } + for (; n < t && H(s.charCodeAt(n)); ) + n += 1, o = !0; + l = s.charCodeAt(n); + } + if (l === 46) { + for (c = !0, n += 1; H(s.charCodeAt(n)); ) + n += 1, a = !0; + l = s.charCodeAt(n); + } + if (l === 101 || l === 69) { + if (c && !o && !a) { + e.err = `${E}: ${U} at index ${n}, "${s[n]}" invalid float exponent`; + return; + } + if (n += 1, l = s.charCodeAt(n), (l === 43 || l === 45) && (n += 1), n < t && H(s.charCodeAt(n))) + for (; n < t && H(s.charCodeAt(n)); ) + n += 1; + else { + e.err = `${E}: ${U} at index ${n}, "${s[n]}" invalid integer exponent`; + return; + } + } + e.index = n, e.param = +e.pathValue.slice(r, n); +}, ue = (e) => [ + // Special spaces + 5760, + 6158, + 8192, + 8193, + 8194, + 8195, + 8196, + 8197, + 8198, + 8199, + 8200, + 8201, + 8202, + 8239, + 8287, + 12288, + 65279, + // Line terminators + 10, + 13, + 8232, + 8233, + // White spaces + 32, + 9, + 11, + 12, + 160 +].includes(e), st = (e) => { + const { pathValue: t, max: s } = e; + for (; e.index < s && ue(t.charCodeAt(e.index)); ) + e.index += 1; +}, me = (e) => { + switch (e | 32) { + case 109: + case 122: + case 108: + case 104: + case 118: + case 99: + case 115: + case 113: + case 116: + case 97: + return !0; + default: + return !1; + } +}, he = (e) => H(e) || e === 43 || e === 45 || e === 46, fe = (e) => (e | 32) === 97, ye = (e) => { + switch (e | 32) { + case 109: + case 77: + return !0; + default: + return !1; + } +}, Et = (e) => { + var c; + const { max: t, pathValue: s, index: r, segments: n } = e, i = s.charCodeAt(r), o = nt[s[r].toLowerCase()]; + if (e.segmentStart = r, !me(i)) { + e.err = `${E}: ${U} "${s[r]}" is not a path command at index ${r}`; + return; + } + const a = n[n.length - 1]; + if (!ye(i) && ((c = a == null ? void 0 : a[0]) == null ? void 0 : c.toLocaleLowerCase()) === "z") { + e.err = `${E}: ${U} "${s[r]}" is not a MoveTo path command at index ${r}`; + return; + } + if (e.index += 1, st(e), e.data = [], !o) { + Tt(e); + return; + } + for (; ; ) { + for (let l = o; l > 0; l -= 1) { + if (fe(i) && (l === 3 || l === 4) ? ae(e) : le(e), e.err.length) + return; + e.data.push(e.param), st(e), e.index < t && s.charCodeAt(e.index) === 44 && (e.index += 1, st(e)); } + if (e.index >= e.max || !he(s.charCodeAt(e.index))) + break; + } + Tt(e); +}; +class Rt { + constructor(t) { + this.segments = [], this.pathValue = t, this.max = t.length, this.index = 0, this.param = 0, this.segmentStart = 0, this.data = [], this.err = ""; + } +} +const R = (e) => { + if (typeof e != "string") + return e.slice(0); + const t = new Rt(e); + for (st(t); t.index < t.max && !t.err.length; ) + Et(t); + if (t != null && t.err.length) + throw TypeError(t.err); + return t.segments; +}, jt = (e, t, s, r) => { + const [n] = e, i = n.toUpperCase(); + if (t === 0 || i === n) return e; + if (i === "A") + return [ + i, + e[1], + e[2], + e[3], + e[4], + e[5], + e[6] + s, + e[7] + r + ]; + if (i === "V") + return [i, e[1] + r]; + if (i === "H") + return [i, e[1] + s]; + if (i === "L") + return [i, e[1] + s, e[2] + r]; + { + const a = e.slice(1).map((c, l) => c + (l % 2 ? r : s)); + return [i].concat(a); + } +}, j = (e, t) => { + let s = e.length, r, n = "M", i = "M", o = !1, a = 0, c = 0, l = 0, u = 0, m = 0; + for (let f = 0; f < s; f += 1) { + r = e[f], [n] = r, m = r.length, i = n.toUpperCase(), o = i !== n; + const y = t(r, f, a, c); + if (y === !1) + break; + i === "Z" ? (a = l, c = u) : i === "H" ? a = r[1] + (o ? a : 0) : i === "V" ? c = r[1] + (o ? c : 0) : (a = r[m - 2] + (o ? a : 0), c = r[m - 1] + (o ? c : 0), i === "M" && (l = a, u = c)), y && (e[f] = y, y[0] === "C" && (s = e.length)); } return e; +}, xt = (e) => { + const t = R(e); + return j(t, jt); +}, St = (e, t, s, r) => { + const [n] = e, i = n.toLowerCase(); + if (t === 0 || n === i) return e; + if (i === "a") + return [ + i, + e[1], + e[2], + e[3], + e[4], + e[5], + e[6] - s, + e[7] - r + ]; + if (i === "v") + return [i, e[1] - r]; + if (i === "h") + return [i, e[1] - s]; + if (i === "l") + return [i, e[1] - s, e[2] - r]; + { + const a = e.slice(1).map((c, l) => c - (l % 2 ? r : s)); + return [i].concat(a); + } +}, Xt = (e) => { + const t = R(e); + return j(t, St); +}, ct = (e, t, s) => { + const { sin: r, cos: n } = Math, i = e * n(s) - t * r(s), o = e * r(s) + t * n(s); + return { x: i, y: o }; +}, Dt = (e, t, s, r, n, i, o, a, c, l) => { + let u = e, m = t, f = s, y = r, h = a, x = c; + const b = Math.PI * 120 / 180, A = Math.PI / 180 * (+n || 0); + let w = [], N, M, d, v, L; + if (l) + [M, d, v, L] = l; + else { + N = ct(u, m, -A), u = N.x, m = N.y, N = ct(h, x, -A), h = N.x, x = N.y; + const $ = (u - h) / 2, P = (m - x) / 2; + let Q = $ * $ / (f * f) + P * P / (y * y); + Q > 1 && (Q = Math.sqrt(Q), f *= Q, y *= Q); + const F = f * f, D = y * y, Ut = (i === o ? -1 : 1) * Math.sqrt(Math.abs((F * D - F * P * P - D * $ * $) / (F * P * P + D * $ * $))); + v = Ut * f * P / y + (u + h) / 2, L = Ut * -y * $ / f + (m + x) / 2, M = Math.asin(((m - L) / y * 10 ** 9 >> 0) / 10 ** 9), d = Math.asin(((x - L) / y * 10 ** 9 >> 0) / 10 ** 9), M = u < v ? Math.PI - M : M, d = h < v ? Math.PI - d : d, M < 0 && (M = Math.PI * 2 + M), d < 0 && (d = Math.PI * 2 + d), o && M > d && (M -= Math.PI * 2), !o && d > M && (d -= Math.PI * 2); + } + let T = d - M; + if (Math.abs(T) > b) { + const $ = d, P = h, Q = x; + d = M + b * (o && d > M ? 1 : -1), h = v + f * Math.cos(d), x = L + y * Math.sin(d), w = Dt(h, x, f, y, n, 0, o, P, Q, [d, $, v, L]); + } + T = d - M; + const Z = Math.cos(M), k = Math.sin(M), it = Math.cos(d), tt = Math.sin(d), _ = Math.tan(T / 4), et = 4 / 3 * f * _, I = 4 / 3 * y * _, J = [u, m], S = [u + et * k, m - I * Z], Y = [h + et * tt, x - I * it], K = [h, x]; + if (S[0] = 2 * J[0] - S[0], S[1] = 2 * J[1] - S[1], l) + return [S[0], S[1], Y[0], Y[1], K[0], K[1]].concat(w); + w = [S[0], S[1], Y[0], Y[1], K[0], K[1]].concat(w); + const ot = []; + for (let $ = 0, P = w.length; $ < P; $ += 1) + ot[$] = $ % 2 ? ct(w[$ - 1], w[$], A).y : ct(w[$], w[$ + 1], A).x; + return ot; +}, xe = (e, t, s, r, n, i) => { + const o = 0.3333333333333333, a = 2 / 3; + return [ + o * e + a * s, + // cpx1 + o * t + a * r, + // cpy1 + o * n + a * s, + // cpx2 + o * i + a * r, + // cpy2 + n, + i + // x,y + ]; +}, O = (e, t, s) => { + const [r, n] = e, [i, o] = t; + return [r + (i - r) * s, n + (o - n) * s]; +}, Ct = (e, t, s, r) => { + const n = O([e, t], [s, r], 0.3333333333333333), i = O([e, t], [s, r], 2 / 3); + return [n[0], n[1], i[0], i[1], s, r]; +}, Zt = (e, t) => { + const [s] = e, r = e.slice(1).map(Number), [n, i] = r, { x1: o, y1: a, x: c, y: l } = t; + return "TQ".includes(s) || (t.qx = null, t.qy = null), s === "M" ? (t.x = n, t.y = i, e) : s === "A" ? ["C"].concat( + Dt(o, a, r[0], r[1], r[2], r[3], r[4], r[5], r[6]) + ) : s === "Q" ? (t.qx = n, t.qy = i, ["C"].concat( + xe(o, a, r[0], r[1], r[2], r[3]) + )) : s === "L" ? ["C"].concat(Ct(o, a, n, i)) : s === "Z" ? ["C"].concat(Ct(o, a, c, l)) : e; }, G = (e, t) => { - const [n] = e, { x1: r, y1: s, x2: i, y2: o } = t, c = e.slice(1).map(Number); - if ("TQ".includes(n) || (t.qx = null, t.qy = null), n === "H") - return ["L", e[1], s]; - if (n === "V") - return ["L", r, e[1]]; - if (n === "S") { - const l = r * 2 - i, a = s * 2 - o; - return t.x1 = l, t.y1 = a, ["C", l, a, ...c]; - } else if (n === "T") { - const l = r * 2 - (t.qx ? t.qx : ( + const [s] = e, r = s.toUpperCase(), n = s !== r, { x1: i, y1: o, x2: a, y2: c, x: l, y: u } = t, m = e.slice(1); + let f = m.map((y, h) => y + (n ? h % 2 ? u : l : 0)); + if ("TQ".includes(r) || (t.qx = null, t.qy = null), r === "A") + return f = m.slice(0, -2).concat(m[5] + (n ? l : 0), m[6] + (n ? u : 0)), ["A"].concat(f); + if (r === "H") + return ["L", e[1] + (n ? l : 0), o]; + if (r === "V") + return ["L", i, e[1] + (n ? u : 0)]; + if (r === "L") + return [ + "L", + e[1] + (n ? l : 0), + e[2] + (n ? u : 0) + ]; + if (r === "M") + return [ + "M", + e[1] + (n ? l : 0), + e[2] + (n ? u : 0) + ]; + if (r === "C") + return ["C"].concat(f); + if (r === "S") { + const y = i * 2 - a, h = o * 2 - c; + return t.x1 = y, t.y1 = h, ["C", y, h].concat(f); + } else if (r === "T") { + const y = i * 2 - (t.qx ? t.qx : ( /* istanbul ignore next */ 0 - )), a = s * 2 - (t.qy ? t.qy : ( + )), h = o * 2 - (t.qy ? t.qy : ( /* istanbul ignore next */ 0 )); - return t.qx = l, t.qy = a, ["Q", l, a, ...c]; - } else if (n === "Q") { - const [l, a] = c; - t.qx = l, t.qy = a; - } + return t.qx = y, t.qy = h, ["Q", y, h].concat(f); + } else if (r === "Q") { + const [y, h] = f; + return t.qx = y, t.qy = h, ["Q"].concat(f); + } else if (r === "Z") + return ["Z"]; return e; -}, R = (e, t, n) => { - const [r, s] = e, [i, o] = t; - return [r + (i - r) * n, s + (o - s) * n]; -}, at = (e, t, n, r) => Pt([e, t], [n, r]), Gt = (e, t, n, r, s) => { - const i = Pt([e, t], [n, r]); - let o = { x: e, y: t }; - if (typeof s == "number") - if (s <= 0) - o = { x: e, y: t }; - else if (s >= i) - o = { x: n, y: r }; +}, X = { + x1: 0, + y1: 0, + x2: 0, + y2: 0, + x: 0, + y: 0, + qx: null, + qy: null +}, gt = (e) => { + const t = { ...X }, s = R(e); + return j(s, (r, n, i, o) => { + t.x = i, t.y = o; + const a = G(r, t); + let c = Zt(a, t); + c[0] === "C" && c.length > 7 && (s.splice(n + 1, 0, ["C"].concat(c.slice(7))), c = c.slice(0, 7)); + const u = c.length; + return t.x1 = +c[u - 2], t.y1 = +c[u - 1], t.x2 = +c[u - 4] || t.x1, t.y2 = +c[u - 3] || t.y1, c; + }); +}, z = (e, t) => { + const s = t >= 1 ? 10 ** t : 1; + return t > 0 ? Math.round(e * s) / s : Math.round(e); +}, $t = (e, t) => { + const s = e.length; + let { round: r } = V, n = e[0], i = ""; + r = t === "off" || typeof t == "number" && t >= 0 ? t : typeof r == "number" && r >= 0 ? r : ( + /* istanbul ignore next @preserve */ + "off" + ); + for (let o = 0; o < s; o += 1) { + n = e[o]; + const [a] = n, c = n.slice(1); + if (i += a, r === "off") + i += c.join(" "); else { - const [c, l] = R([e, t], [n, r], s / i); - o = { x: c, y: l }; + let l = 0; + const u = c.length; + for (; l < u; ) + i += z(c[l], r), l !== u - 1 && (i += " "), l += 1; } - return o; -}, kt = (e, t, n, r) => { - const { min: s, max: i } = Math; + } + return i; +}, Mt = (e, t) => Math.sqrt((e[0] - t[0]) * (e[0] - t[0]) + (e[1] - t[1]) * (e[1] - t[1])), lt = (e, t, s, r) => Mt([e, t], [s, r]), Ot = (e, t, s, r, n) => { + let i = { x: e, y: t }; + if (typeof n == "number") { + const o = Mt([e, t], [s, r]); + if (n <= 0) + i = { x: e, y: t }; + else if (n >= o) + i = { x: s, y: r }; + else { + const [a, c] = O([e, t], [s, r], n / o); + i = { x: a, y: c }; + } + } + return i; +}, zt = (e, t, s, r) => { + const { min: n, max: i } = Math; return { min: { - x: s(e, n), - y: s(t, r) + x: n(e, s), + y: n(t, r) }, max: { - x: i(e, n), + x: i(e, s), y: i(t, r) } }; -}, te = (e, t, n) => { - const r = n / 2, s = Math.sin(r), i = Math.cos(r), o = e ** 2 * s ** 2, c = t ** 2 * i ** 2, l = Math.sqrt(o + c) * n; - return Math.abs(l); -}, K = (e, t, n, r, s, i) => { - const o = Math.cos(i), c = Math.sin(i), l = r * Math.cos(e), a = s * Math.sin(e); +}, Qt = (e, t, s) => { + const r = s / 2, n = Math.sin(r), i = Math.cos(r), o = e ** 2 * n ** 2, a = t ** 2 * i ** 2, c = Math.sqrt(o + a) * s; + return Math.abs(c); +}, W = (e, t, s, r, n, i) => { + const { sin: o, cos: a } = Math, c = a(n), l = o(n), u = s * a(i), m = r * o(i); return { - x: t + o * l - c * a, - y: n + c * l + o * a + x: e + c * u - l * m, + y: t + l * u + c * m }; -}, qt = (e, t) => { - const { x: n, y: r } = e, { x: s, y: i } = t, o = n * s + r * i, c = Math.sqrt((n ** 2 + r ** 2) * (s ** 2 + i ** 2)); - return (n * i - r * s < 0 ? -1 : 1) * Math.acos(o / c); -}, Lt = (e, t, n, r, s, i, o, c, l) => { - const { abs: a, sin: m, cos: u, sqrt: g, PI: f } = Math; - let h = a(n), y = a(r); - const p = (s % 360 + 360) % 360 * (f / 180); - if (e === c && t === l) +}, Pt = (e, t) => { + const { x: s, y: r } = e, { x: n, y: i } = t, o = s * n + r * i, a = Math.sqrt((s ** 2 + r ** 2) * (n ** 2 + i ** 2)); + return (s * i - r * n < 0 ? -1 : 1) * Math.acos(o / a); +}, wt = (e, t, s, r, n, i, o, a, c) => { + const { abs: l, sin: u, cos: m, sqrt: f, PI: y } = Math; + let h = l(s), x = l(r); + const A = (n % 360 + 360) % 360 * (y / 180); + if (e === a && t === c) return { rx: h, - ry: y, + ry: x, startAngle: 0, endAngle: 0, - center: { x: c, y: l } + center: { x: a, y: c } }; - if (h === 0 || y === 0) + if (h === 0 || x === 0) return { rx: h, - ry: y, + ry: x, startAngle: 0, endAngle: 0, - center: { x: c, y: l } + center: { x: (a + e) / 2, y: (c + t) / 2 } }; - const d = (e - c) / 2, C = (t - l) / 2, M = { - x: u(p) * d + m(p) * C, - y: -m(p) * d + u(p) * C - }, b = M.x ** 2 / h ** 2 + M.y ** 2 / y ** 2; - b > 1 && (h *= g(b), y *= g(b)); - const w = h ** 2 * y ** 2 - h ** 2 * M.y ** 2 - y ** 2 * M.x ** 2, T = h ** 2 * M.y ** 2 + y ** 2 * M.x ** 2; - let P = w / T; - P = P < 0 ? 0 : P; - const $ = (i !== o ? 1 : -1) * g(P), S = { - x: $ * (h * M.y / y), - y: $ * (-(y * M.x) / h) - }, _ = { - x: u(p) * S.x - m(p) * S.y + (e + c) / 2, - y: m(p) * S.x + u(p) * S.y + (t + l) / 2 - }, X = { - x: (M.x - S.x) / h, - y: (M.y - S.y) / y - }, Q = qt({ x: 1, y: 0 }, X), B = { - x: (-M.x - S.x) / h, - y: (-M.y - S.y) / y + const w = (e - a) / 2, N = (t - c) / 2, M = { + x: m(A) * w + u(A) * N, + y: -u(A) * w + m(A) * N + }, d = M.x ** 2 / h ** 2 + M.y ** 2 / x ** 2; + d > 1 && (h *= f(d), x *= f(d)); + const v = h ** 2 * x ** 2 - h ** 2 * M.y ** 2 - x ** 2 * M.x ** 2, L = h ** 2 * M.y ** 2 + x ** 2 * M.x ** 2; + let T = v / L; + T = T < 0 ? 0 : T; + const Z = (i !== o ? 1 : -1) * f(T), k = { + x: Z * (h * M.y / x), + y: Z * (-(x * M.x) / h) + }, it = { + x: m(A) * k.x - u(A) * k.y + (e + a) / 2, + y: u(A) * k.x + m(A) * k.y + (t + c) / 2 + }, tt = { + x: (M.x - k.x) / h, + y: (M.y - k.y) / x + }, _ = Pt({ x: 1, y: 0 }, tt), et = { + x: (-M.x - k.x) / h, + y: (-M.y - k.y) / x }; - let I = qt(X, B); - !o && I > 0 ? I -= 2 * f : o && I < 0 && (I += 2 * f), I %= 2 * f; - const J = Q + I; + let I = Pt(tt, et); + !o && I > 0 ? I -= 2 * y : o && I < 0 && (I += 2 * y), I %= 2 * y; + const J = _ + I; return { - center: _, - startAngle: Q, + center: it, + startAngle: _, endAngle: J, rx: h, - ry: y + ry: x }; -}, ee = (e, t, n, r, s, i, o, c, l) => { - const { rx: a, ry: m, startAngle: u, endAngle: g } = Lt(e, t, n, r, s, i, o, c, l); - return te(a, m, g - u); -}, Pe = (e, t, n, r, s, i, o, c, l, a) => { - let m = { x: e, y: t }; - const { center: u, rx: g, ry: f, startAngle: h, endAngle: y } = Lt(e, t, n, r, s, i, o, c, l), x = te(g, f, y - h); - if (typeof a == "number") - if (a <= 0) - m = { x: e, y: t }; - else if (a >= x) - m = { x: c, y: l }; +}, Bt = (e, t, s, r, n, i, o, a, c) => { + const { rx: l, ry: u, startAngle: m, endAngle: f } = wt(e, t, s, r, n, i, o, a, c); + return Qt(l, u, f - m); +}, ge = (e, t, s, r, n, i, o, a, c, l) => { + let u = { x: e, y: t }; + const { center: m, rx: f, ry: y, startAngle: h, endAngle: x } = wt(e, t, s, r, n, i, o, a, c); + if (typeof l == "number") { + const b = Qt(f, y, x - h); + if (l <= 0) + u = { x: e, y: t }; + else if (l >= b) + u = { x: a, y: c }; else { - if (e === c && t === l) - return { x: c, y: l }; - if (g === 0 || f === 0) - return Gt(e, t, c, l, a); - const { PI: p, cos: d, sin: C } = Math, M = y - h, w = (s % 360 + 360) % 360 * (p / 180), T = h + M * (a / x), P = g * d(T), $ = f * C(T); - m = { - x: d(w) * P - C(w) * $ + u.x, - y: C(w) * P + d(w) * $ + u.y + if (e === a && t === c) + return { x: a, y: c }; + if (f === 0 || y === 0) + return Ot(e, t, a, c, l); + const { PI: A, cos: w, sin: N } = Math, M = x - h, v = (n % 360 + 360) % 360 * (A / 180), L = h + M * (l / b), T = f * w(L), Z = y * N(L); + u = { + x: w(v) * T - N(v) * Z + m.x, + y: N(v) * T + w(v) * Z + m.y }; } - return m; -}, Le = (e, t, n, r, s, i, o, c, l) => { - const { center: a, rx: m, ry: u, startAngle: g, endAngle: f } = Lt(e, t, n, r, s, i, o, c, l), h = f - g, y = { x: c, y: l }, [x, p] = [a.x, a.y], d = [y], C = s * Math.PI / 180, M = Math.tan(C), b = Math.atan2(-u * M, m), w = b, T = b + Math.PI, P = Math.atan2(u, m * M), $ = P + Math.PI, S = [e, c], _ = [t, l], X = Math.min(...S), Q = Math.max(...S), B = Math.min(..._), I = Math.max(..._), J = f - h * 1e-3, z = K(J, x, p, m, u, C), ot = f - h * 0.999, Y = K(ot, x, p, m, u, C); - return (z.x > Q || Y.x > Q) && d.push(K(w, x, p, m, u, C)), (z.x < X || Y.x < X) && d.push(K(T, x, p, m, u, C)), (z.y < B || Y.y < B) && d.push(K($, x, p, m, u, C)), (z.y > I || Y.y > I) && d.push(K(P, x, p, m, u, C)), { + } + return u; +}, pe = (e, t, s, r, n, i, o, a, c) => { + const { center: l, rx: u, ry: m, startAngle: f, endAngle: y } = wt(e, t, s, r, n, i, o, a, c), h = y - f, { min: x, max: b, tan: A, atan2: w, PI: N } = Math, M = { x: a, y: c }, { x: d, y: v } = l, L = [M], T = n * N / 180, Z = A(T), k = w(-m * Z, u), it = k, tt = k + N, _ = w(m, u * Z), et = _ + N, I = [e, a], J = [t, c], S = x(...I), Y = b(...I), K = x(...J), ot = b(...J), $ = y - h * 1e-3, P = W(d, v, u, m, T, $), Q = y - h * 0.999, F = W(d, v, u, m, T, Q); + return (P.x > Y || F.x > Y) && L.push(W(d, v, u, m, T, it)), (P.x < S || F.x < S) && L.push(W(d, v, u, m, T, tt)), (P.y < K || F.y < K) && L.push(W(d, v, u, m, T, et)), (P.y > ot || F.y > ot) && L.push(W(d, v, u, m, T, _)), { min: { - x: Math.min(...d.map((O) => O.x)), - y: Math.min(...d.map((O) => O.y)) + x: x(...L.map((D) => D.x)), + y: x(...L.map((D) => D.y)) }, max: { - x: Math.max(...d.map((O) => O.x)), - y: Math.max(...d.map((O) => O.y)) + x: b(...L.map((D) => D.x)), + y: b(...L.map((D) => D.y)) } }; -}, Te = { x: 0, y: 0 }, It = [ +}, Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + angleBetween: Pt, + arcLength: Qt, + arcPoint: W, + getArcBBox: pe, + getArcLength: Bt, + getArcProps: wt, + getPointAtArcLength: ge +}, Symbol.toStringTag, { value: "Module" })), qt = [ -0.06405689286260563, 0.06405689286260563, -0.1911188674736163, @@ -776,7 +921,7 @@ const gt = { 0.9747285559713095, -0.9951872199970213, 0.9951872199970213 -], Se = [ +], be = [ 0.12793819534675216, 0.12793819534675216, 0.1258374563468283, @@ -801,312 +946,284 @@ const gt = { 0.028531388628933663, 0.0123412297999872, 0.0123412297999872 -], $e = (e) => { +], de = (e) => { const t = []; - for (let n = e, r = n.length, s = r - 1; r > 1; r -= 1, s -= 1) { + for (let s = e, r = s.length, n = r - 1; r > 1; r -= 1, n -= 1) { const i = []; - for (let o = 0; o < s; o += 1) + for (let o = 0; o < n; o += 1) i.push({ - x: s * (n[o + 1].x - n[o].x), - y: s * (n[o + 1].y - n[o].y), + x: n * (s[o + 1].x - s[o].x), + y: n * (s[o + 1].y - s[o].y), t: 0 }); - t.push(i), n = i; + t.push(i), s = i; } return t; -}, ke = (e, t) => { +}, Ae = (e, t) => { if (t === 0) return e[0].t = 0, e[0]; - const n = e.length - 1; + const s = e.length - 1; if (t === 1) - return e[n].t = 1, e[n]; + return e[s].t = 1, e[s]; const r = 1 - t; - let s = e; - if (n === 0) + let n = e; + if (s === 0) return e[0].t = t, e[0]; - if (n === 1) + if (s === 1) return { - x: r * s[0].x + t * s[1].x, - y: r * s[0].y + t * s[1].y, + x: r * n[0].x + t * n[1].x, + y: r * n[0].y + t * n[1].y, t }; const i = r * r, o = t * t; - let c = 0, l = 0, a = 0, m = 0; - return n === 2 ? (s = [s[0], s[1], s[2], Te], c = i, l = r * t * 2, a = o) : n === 3 && (c = i * r, l = i * t * 3, a = r * o * 3, m = t * o), { - x: c * s[0].x + l * s[1].x + a * s[2].x + m * s[3].x, - y: c * s[0].y + l * s[1].y + a * s[2].y + m * s[3].y, + let a = 0, c = 0, l = 0, u = 0; + return s === 2 ? (n = [n[0], n[1], n[2], { x: 0, y: 0 }], a = i, c = r * t * 2, l = o) : s === 3 && (a = i * r, c = i * t * 3, l = r * o * 3, u = t * o), { + x: a * n[0].x + c * n[1].x + l * n[2].x + u * n[3].x, + y: a * n[0].y + c * n[1].y + l * n[2].y + u * n[3].y, t }; -}, qe = (e, t) => { - const n = e(t), r = n.x * n.x + n.y * n.y; +}, Me = (e, t) => { + const s = e(t), r = s.x * s.x + s.y * s.y; return Math.sqrt(r); -}, Ie = (e) => { - const n = It.length; +}, we = (e) => { + const s = qt.length; let r = 0; - for (let s = 0, i; s < n; s++) - i = 0.5 * It[s] + 0.5, r += Se[s] * qe(e, i); + for (let n = 0, i; n < s; n++) + i = 0.5 * qt[n] + 0.5, r += be[n] * Me(e, i); return 0.5 * r; -}, xt = (e) => { +}, ft = (e) => { const t = []; - for (let r = 0, s = e.length, i = 2; r < s; r += i) + for (let r = 0, n = e.length, i = 2; r < n; r += i) t.push({ x: e[r], y: e[r + 1] }); - const n = $e(t); - return Ie((r) => ke(n[0], r)); -}, Ee = 1e-8, Nt = (e) => { - const t = Math.min(e[0], e[2]), n = Math.max(e[0], e[2]); - if (e[1] >= e[0] ? e[2] >= e[1] : e[2] <= e[1]) - return [t, n]; - const r = (e[0] * e[2] - e[1] * e[1]) / (e[0] - 2 * e[1] + e[2]); - return r < t ? [r, n] : [t, r]; -}, Et = (e) => { - const t = e[0] - 3 * e[1] + 3 * e[2] - e[3]; - if (Math.abs(t) < Ee) - return e[0] === e[3] && e[0] === e[1] ? [e[0], e[3]] : Nt([e[0], -0.5 * e[0] + 1.5 * e[1], e[0] - 3 * e[1] + 3 * e[2]]); - const n = -e[0] * e[2] + e[0] * e[3] - e[1] * e[2] - e[1] * e[3] + e[1] * e[1] + e[2] * e[2]; - if (n <= 0) - return [Math.min(e[0], e[3]), Math.max(e[0], e[3])]; - const r = Math.sqrt(n); - let s = Math.min(e[0], e[3]), i = Math.max(e[0], e[3]); - const o = e[0] - 2 * e[1] + e[2]; - for (let c = (o + r) / t, l = 1; l <= 2; c = (o - r) / t, l++) - if (c > 0 && c < 1) { - const a = e[0] * (1 - c) * (1 - c) * (1 - c) + e[1] * 3 * (1 - c) * (1 - c) * c + e[2] * 3 * (1 - c) * c * c + e[3] * c * c * c; - a < s && (s = a), a > i && (i = a); + const s = de(t); + return we((r) => Ae(s[0], r)); +}, Ne = 1e-8, pt = ([e, t, s]) => { + const r = Math.min(e, s), n = Math.max(e, s); + if (t >= e ? s >= t : s <= t) + return [r, n]; + const i = (e * s - t * t) / (e - 2 * t + s); + return i < r ? [i, n] : [r, i]; +}, kt = ([e, t, s, r]) => { + const n = e - 3 * t + 3 * s - r; + if (Math.abs(n) < Ne) + return e === r && e === t ? [e, r] : pt([e, -0.5 * e + 1.5 * t, e - 3 * t + 3 * s]); + const i = -e * s + e * r - t * s - t * r + t * t + s * s; + if (i <= 0) + return [Math.min(e, r), Math.max(e, r)]; + const o = Math.sqrt(i); + let a = Math.min(e, r), c = Math.max(e, r); + const l = e - 2 * t + s; + for (let u = (l + o) / n, m = 1; m <= 2; u = (l - o) / n, m++) + if (u > 0 && u < 1) { + const f = e * (1 - u) * (1 - u) * (1 - u) + t * 3 * (1 - u) * (1 - u) * u + s * 3 * (1 - u) * u * u + r * u * u * u; + f < a && (a = f), f > c && (c = f); } - return [s, i]; -}, ze = ([e, t, n, r, s, i, o, c], l) => { - const a = 1 - l; + return [a, c]; +}, Le = ([e, t, s, r, n, i, o, a], c) => { + const l = 1 - c; return { - x: a ** 3 * e + 3 * a ** 2 * l * n + 3 * a * l ** 2 * s + l ** 3 * o, - y: a ** 3 * t + 3 * a ** 2 * l * r + 3 * a * l ** 2 * i + l ** 3 * c + x: l ** 3 * e + 3 * l ** 2 * c * s + 3 * l * c ** 2 * n + c ** 3 * o, + y: l ** 3 * t + 3 * l ** 2 * c * r + 3 * l * c ** 2 * i + c ** 3 * a }; -}, ne = (e, t, n, r, s, i, o, c) => xt([e, t, n, r, s, i, o, c]), Ze = (e, t, n, r, s, i, o, c, l) => { - const a = typeof l == "number"; - let m = { x: e, y: t }; - if (a) { - const u = xt([e, t, n, r, s, i, o, c]); - l <= 0 || (l >= u ? m = { x: o, y: c } : m = ze([e, t, n, r, s, i, o, c], l / u)); +}, _t = (e, t, s, r, n, i, o, a) => ft([e, t, s, r, n, i, o, a]), ve = (e, t, s, r, n, i, o, a, c) => { + const l = typeof c == "number"; + let u = { x: e, y: t }; + if (l) { + const m = ft([e, t, s, r, n, i, o, a]); + c <= 0 || (c >= m ? u = { x: o, y: a } : u = Le([e, t, s, r, n, i, o, a], c / m)); } - return m; -}, Oe = (e, t, n, r, s, i, o, c) => { - const l = Et([e, n, s, o]), a = Et([t, r, i, c]); + return u; +}, Te = (e, t, s, r, n, i, o, a) => { + const c = kt([e, s, n, o]), l = kt([t, r, i, a]); return { - min: { x: l[0], y: a[0] }, - max: { x: l[1], y: a[1] } + min: { x: c[0], y: l[0] }, + max: { x: c[1], y: l[1] } }; -}, je = ([e, t, n, r, s, i], o) => { - const c = 1 - o; +}, Ce = ([e, t, s, r, n, i], o) => { + const a = 1 - o; return { - x: c ** 2 * e + 2 * c * o * n + o ** 2 * s, - y: c ** 2 * t + 2 * c * o * r + o ** 2 * i + x: a ** 2 * e + 2 * a * o * s + o ** 2 * n, + y: a ** 2 * t + 2 * a * o * r + o ** 2 * i }; -}, se = (e, t, n, r, s, i) => xt([e, t, n, r, s, i]), Re = (e, t, n, r, s, i, o) => { - const c = typeof o == "number"; - let l = { x: e, y: t }; - if (c) { - const a = xt([e, t, n, r, s, i]); - o <= 0 || (o >= a ? l = { x: s, y: i } : l = je([e, t, n, r, s, i], o / a)); +}, Ft = (e, t, s, r, n, i) => ft([e, t, s, r, n, i]), $e = (e, t, s, r, n, i, o) => { + const a = typeof o == "number"; + let c = { x: e, y: t }; + if (a) { + const l = ft([e, t, s, r, n, i]); + o <= 0 || (o >= l ? c = { x: n, y: i } : c = Ce([e, t, s, r, n, i], o / l)); } - return l; -}, De = (e, t, n, r, s, i) => { - const o = Nt([e, n, s]), c = Nt([t, r, i]); - return { - min: { x: o[0], y: c[0] }, - max: { x: o[1], y: c[1] } - }; -}, zt = (e) => { - if (!e) - return { - x: 0, - y: 0, - width: 0, - height: 0, - x2: 0, - y2: 0, - cx: 0, - cy: 0, - cz: 0 - }; - const t = q(e); - let n = [], r = "M", s = 0, i = 0, o = 0, c = 0; - const l = [], a = []; - let m = { x: s, y: i }, u = { x: s, y: i }; - D(t, (d, C) => { - const M = V(d, C), b = G(M, C); - return [r] = b, n = [s, i, ...b.slice(1)], r === "M" ? ([, o, c] = b, m = { x: o, y: c }, u = { x: o, y: c }) : r === "L" ? { min: m, max: u } = kt(...n) : r === "A" ? { min: m, max: u } = Le(...n) : r === "C" ? { min: m, max: u } = Oe(...n) : r === "Q" ? { min: m, max: u } = De(...n) : r === "Z" && (n = [s, i, o, c], { min: m, max: u } = kt(...n)), l.push(m), a.push(u), r === "Z" ? (s = o, i = c) : ([s, i] = b.slice(-2), r === "M" && (o = s, c = i)), C.x = s, C.y = i, b; - }); - const g = Math.min(...l.map((d) => d.x)), f = Math.max(...a.map((d) => d.x)), h = Math.min(...l.map((d) => d.y)), y = Math.max(...a.map((d) => d.y)), x = f - g, p = y - h; + return c; +}, ze = (e, t, s, r, n, i) => { + const o = pt([e, s, n]), a = pt([t, r, i]); return { - width: x, - height: p, - x: g, - y: h, - x2: f, - y2: y, - cx: g + x / 2, - cy: h + p / 2, - // an estimated guess - cz: Math.max(x, p) + Math.min(x, p) / 2 + min: { x: o[0], y: a[0] }, + max: { x: o[1], y: a[1] } }; -}, ct = (e, t, n) => { - const r = e * Math.cos(n) - t * Math.sin(n), s = e * Math.sin(n) + t * Math.cos(n); - return { x: r, y: s }; -}, re = (e, t, n, r, s, i, o, c, l, a) => { - let m = e, u = t, g = n, f = r, h = c, y = l; - const x = Math.PI * 120 / 180, p = Math.PI / 180 * (+s || 0); - let d = [], C, M, b, w, T; - if (a) - [M, b, w, T] = a; - else { - C = ct(m, u, -p), m = C.x, u = C.y, C = ct(h, y, -p), h = C.x, y = C.y; - const L = (m - h) / 2, Z = (u - y) / 2; - let H = L * L / (g * g) + Z * Z / (f * f); - H > 1 && (H = Math.sqrt(H), g *= H, f *= H); - const Mt = g * g, bt = f * f, St = (i === o ? -1 : 1) * Math.sqrt(Math.abs((Mt * bt - Mt * Z * Z - bt * L * L) / (Mt * Z * Z + bt * L * L))); - w = St * g * Z / f + (m + h) / 2, T = St * -f * L / g + (u + y) / 2, M = Math.asin(((u - T) / f * 10 ** 9 >> 0) / 10 ** 9), b = Math.asin(((y - T) / f * 10 ** 9 >> 0) / 10 ** 9), M = m < w ? Math.PI - M : M, b = h < w ? Math.PI - b : b, M < 0 && (M = Math.PI * 2 + M), b < 0 && (b = Math.PI * 2 + b), o && M > b && (M -= Math.PI * 2), !o && b > M && (b -= Math.PI * 2); - } - let P = b - M; - if (Math.abs(P) > x) { - const L = b, Z = h, H = y; - b = M + x * (o && b > M ? 1 : -1), h = w + g * Math.cos(b), y = T + f * Math.sin(b), d = re(h, y, g, f, s, 0, o, Z, H, [b, L, w, T]); - } - P = b - M; - const $ = Math.cos(M), S = Math.sin(M), _ = Math.cos(b), X = Math.sin(b), Q = Math.tan(P / 4), B = 4 / 3 * g * Q, I = 4 / 3 * f * Q, J = [m, u], z = [m + B * S, u - I * $], ot = [h + B * X, y - I * _], Y = [h, y]; - if (z[0] = 2 * J[0] - z[0], z[1] = 2 * J[1] - z[1], a) - return [...z, ...ot, ...Y, ...d]; - d = [...z, ...ot, ...Y, ...d]; - const O = []; - for (let L = 0, Z = d.length; L < Z; L += 1) - O[L] = L % 2 ? ct(d[L - 1], d[L], p).y : ct(d[L], d[L + 1], p).x; - return O; -}, Qe = (e, t, n, r, s, i) => { - const o = 0.3333333333333333, c = 2 / 3; - return [ - o * e + c * n, - // cpx1 - o * t + c * r, - // cpy1 - o * s + c * n, - // cpx2 - o * i + c * r, - // cpy2 - s, - i - // x,y - ]; -}, Zt = (e, t, n, r) => { - const s = R([e, t], [n, r], 0.3333333333333333), i = R([e, t], [n, r], 2 / 3); - return [...s, ...i, n, r]; -}, ie = (e, t) => { - const [n] = e, r = e.slice(1).map(Number), [s, i] = r; - let o; - const { x1: c, y1: l, x: a, y: m } = t; - return "TQ".includes(n) || (t.qx = null, t.qy = null), n === "M" ? (t.x = s, t.y = i, e) : n === "A" ? (o = [c, l, ...r], ["C", ...re(...o)]) : n === "Q" ? (t.qx = s, t.qy = i, o = [c, l, ...r], ["C", ...Qe(...o)]) : n === "L" ? ["C", ...Zt(c, l, s, i)] : n === "Z" ? ["C", ...Zt(c, l, a, m)] : e; -}, mt = (e) => { - let t = 0, n = 0, r = 0, s = 0, i = "M"; - const o = q(e); - return D(o, (c, l, a) => { - const m = V(c, l); - [i] = m; - const u = i.toUpperCase(), g = G(m, l); - let f = ie(g, l); - return f[0] === "C" && f.length > 7 && (o.splice(a + 1, 0, ["C", ...f.slice(7)]), f = f.slice(0, 7)), u === "Z" ? (t = r, n = s) : ([t, n] = f.slice(-2), u === "M" && (r = t, s = n)), l.x = t, l.y = n, f; +}, _e = (e) => { + const t = e.length; + let s = -1, r, n = e[t - 1], i = 0; + for (; ++s < t; ) + r = n, n = e[s], i += r[1] * n[0] - r[0] * n[1]; + return i / 2; +}, Fe = (e) => e.reduce((t, s, r) => r ? t + Mt(e[r - 1], s) : 0, 0), bt = 1e-5, ut = (e) => { + const t = R(e), s = { ...X }; + return j(t, (r, n, i, o) => { + s.x = i, s.y = o; + const a = G(r, s), c = a.length; + return s.x1 = +a[c - 2], s.y1 = +a[c - 1], s.x2 = +a[c - 4] || s.x1, s.y2 = +a[c - 3] || s.y1, a; }); -}, Xe = (e, t, n, r, s, i, o, c) => 3 * ((c - t) * (n + s) - (o - e) * (r + i) + r * (e - s) - n * (t - i) + c * (s + e / 3) - o * (i + t / 3)) / 20, oe = (e) => { - let t = 0, n = 0, r = 0; - return mt(e).map((s) => { - switch (s[0]) { - case "M": - return [, t, n] = s, 0; - default: - return r = Xe(t, n, ...s.slice(1)), [t, n] = s.slice(-2), r; - } - }).reduce((s, i) => s + i, 0); -}, W = (e) => { - const t = q(e); - let n = !1, r = [], s = "M", i = 0, o = 0, c = 0, l = 0, a = 0; - return D(t, (m, u) => { - const g = V(m, u), f = G(g, u); - return [s] = f, n = s === "M", r = n ? r : [i, o, ...f.slice(1)], n ? [, c, l] = m : s === "L" ? a += at(...r) : s === "A" ? a += ee(...r) : s === "C" ? a += ne(...r) : s === "Q" ? a += se(...r) : s === "Z" && (r = [i, o, c, l], a += at(...r)), s === "Z" ? (i = c, o = l) : ([i, o] = f.slice(-2), n && (c = i, l = o)), u.x = i, u.y = o, f; - }), a; -}, Be = (e) => oe(mt(e)) >= 0, At = 1e-5, nt = (e, t) => { - const n = q(e); - let r = !1, s = [], i = "M", o = 0, c = 0, [l, a] = n[0].slice(1); - const m = typeof t == "number"; - let u = { x: l, y: a }, g = 0, f = u, h = 0; - return m ? (t < At && (f = u), D(n, (y, x) => { - const p = V(y, x), d = G(p, x); - return [i] = d, r = i === "M", s = r ? s : [o, c, ...d.slice(1)], r ? ([, l, a] = y, u = { x: l, y: a }, g = 0) : i === "L" ? (u = Gt(...s, t - h), g = at(...s)) : i === "A" ? (u = Pe(...s, t - h), g = ee(...s)) : i === "C" ? (u = Ze(...s, t - h), g = ne(...s)) : i === "Q" ? (u = Re(...s, t - h), g = se(...s)) : i === "Z" && (s = [o, c, l, a], u = { x: l, y: a }, g = at(...s)), h < t && h + g >= t && (f = u), h += g, i === "Z" ? (o = l, c = a) : ([o, c] = d.slice(-2), i === "M" && (l = o, a = c)), x.x = o, x.y = c, d; - }), t > h - At && (f = { x: o, y: c }), f) : u; -}, Tt = (e, t) => { - const n = q(e); - let r = n.slice(0), s = W(r), i = r.length - 1, o = 0, c = 0, l = n[0]; - const [a, m] = l.slice(-2), u = { x: a, y: m }; +}, at = (e, t) => { + const s = ut(e); + let r = !1, n = [], i = "M", o = 0, a = 0, [c, l] = s[0].slice(1); + const u = typeof t == "number"; + let m = { x: c, y: l }, f = 0, y = m, h = 0; + return !u || t < bt ? m : (j(s, (x, b, A, w) => { + if ([i] = x, r = i === "M", n = r ? n : [A, w].concat(x.slice(1)), r ? ([, c, l] = x, m = { x: c, y: l }, f = 0) : i === "L" ? (m = Ot(n[0], n[1], n[2], n[3], t - h), f = lt(n[0], n[1], n[2], n[3])) : i === "A" ? (m = ge( + n[0], + n[1], + n[2], + n[3], + n[4], + n[5], + n[6], + n[7], + n[8], + t - h + ), f = Bt(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8])) : i === "C" ? (m = ve( + n[0], + n[1], + n[2], + n[3], + n[4], + n[5], + n[6], + n[7], + t - h + ), f = _t(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7])) : i === "Q" ? (m = $e(n[0], n[1], n[2], n[3], n[4], n[5], t - h), f = Ft(n[0], n[1], n[2], n[3], n[4], n[5])) : i === "Z" && (n = [A, w, c, l], m = { x: c, y: l }, f = lt(n[0], n[1], n[2], n[3])), [o, a] = n.slice(-2), h < t) + y = m; + else + return !1; + h += f; + }), t > h - bt ? { x: o, y: a } : y); +}, rt = (e) => { + const t = R(e), s = { ...X }; + let r = !1, n = [], i = "M", o = 0, a = 0, c = 0; + return j(t, (l, u, m, f) => { + s.x = m, s.y = f; + const y = G(l, s); + [i] = y, r = i === "M", n = r ? n : [m, f].concat(y.slice(1)), r ? [, o, a] = y : i === "L" ? c += lt(n[0], n[1], n[2], n[3]) : i === "A" ? c += Bt(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7], n[8]) : i === "C" ? c += _t(n[0], n[1], n[2], n[3], n[4], n[5], n[6], n[7]) : i === "Q" ? c += Ft(n[0], n[1], n[2], n[3], n[4], n[5]) : i === "Z" && (n = [m, f, o, a], c += lt(n[0], n[1], n[2], n[3])); + const h = y.length; + s.x1 = +y[h - 2], s.y1 = +y[h - 1], s.x2 = +y[h - 4] || s.x1, s.y2 = +y[h - 3] || s.y1; + }), c; +}, Ht = (e, t) => { + const s = R(e); + let r = s.slice(0), n = rt(r), i = r.length - 1, o = 0, a = 0, c = s[0]; if (i <= 0 || !t || !Number.isFinite(t)) return { - segment: l, + segment: c, index: 0, - length: c, - point: u, + length: a, lengthAtSegment: o }; - if (t >= s) - return r = n.slice(0, -1), o = W(r), c = s - o, { - segment: n[i], + if (t >= n) + return r = s.slice(0, -1), o = rt(r), a = n - o, c = s[i], { + segment: c, index: i, - length: c, + length: a, lengthAtSegment: o }; - const g = []; + const l = []; for (; i > 0; ) - l = r[i], r = r.slice(0, -1), o = W(r), c = s - o, s = o, g.push({ - segment: l, + c = r[i], r = r.slice(0, -1), o = rt(r), a = n - o, n = o, l.push({ + segment: c, index: i, - length: c, + length: a, lengthAtSegment: o }), i -= 1; - return g.find(({ lengthAtSegment: f }) => f <= t); -}, rt = (e) => { - let t = 0, n = 0, r = 0, s = 0, i = "M"; - return D(q(e), (o, c) => { - const l = V(o, c), a = G(l, c); - [i] = a; - const m = i.toUpperCase(); - return m === "Z" ? (t = r, n = s) : ([t, n] = a.slice(-2), m === "M" && (r = t, s = n)), c.x = t, c.y = n, a; - }); -}, pt = (e, t) => { - const n = q(e), r = rt(n), s = W(n), i = (M) => { - const b = M.x - t.x, w = M.y - t.y; - return b * b + w * w; + return l.find(({ lengthAtSegment: u }) => u <= t); +}, Nt = (e, t) => { + const s = R(e), r = ut(s), n = rt(r), i = (M) => { + const d = M.x - t.x, v = M.y - t.y; + return d * d + v * v; }; - let o = 8, c, l = { x: 0, y: 0 }, a = 0, m = 0, u = 1 / 0; - for (let M = 0; M <= s; M += o) - c = nt(r, M), a = i(c), a < u && (l = c, m = M, u = a); + let o = 8, a, c = { x: 0, y: 0 }, l = 0, u = 0, m = 1 / 0; + for (let M = 0; M <= n; M += o) + a = at(r, M), l = i(a), l < m && (c = a, u = M, m = l); o /= 2; - let g, f, h = 0, y = 0, x = 0, p = 0; - for (; o > 1e-6 && (h = m - o, g = nt(r, h), x = i(g), y = m + o, f = nt(r, y), p = i(f), h >= 0 && x < u ? (l = g, m = h, u = x) : y <= s && p < u ? (l = f, m = y, u = p) : o /= 2, !(o < 1e-5)); ) + let f, y, h = 0, x = 0, b = 0, A = 0; + for (; o > 1e-6 && (h = u - o, f = at(r, h), b = i(f), x = u + o, y = at(r, x), A = i(y), h >= 0 && b < m ? (c = f, u = h, m = b) : x <= n && A < m ? (c = y, u = x, m = A) : o /= 2, !(o < 1e-5)); ) ; - const d = Tt(n, m), C = Math.sqrt(u); - return { closest: l, distance: C, segment: d }; -}, Ye = (e, t) => pt(e, t).closest, He = (e, t) => pt(e, t).segment, Fe = (e, t) => Tt(e, t).segment, Ue = (e, t) => { - const { distance: n } = pt(e, t); - return Math.abs(n) < At; -}, ce = (e) => { + const w = Ht(s, u), N = Math.sqrt(m); + return { closest: c, distance: N, segment: w }; +}, He = (e, t) => Nt(e, t).closest, Ue = (e, t, s, r, n, i, o, a) => 3 * ((a - t) * (s + n) - (o - e) * (r + i) + r * (e - n) - s * (t - i) + a * (n + e / 3) - o * (i + t / 3)) / 20, Pe = (e) => { + let t = 0, s = 0, r = 0; + return gt(e).map((n) => { + switch (n[0]) { + case "M": + return [, t, s] = n, 0; + default: + return r = Ue(t, s, n[1], n[2], n[3], n[4], n[5], n[6]), [t, s] = n.slice(-2), r; + } + }).reduce((n, i) => n + i, 0); +}, Xe = (e) => Pe(gt(e)) >= 0, Jt = (e) => { + if (!e) + return { + x: 0, + y: 0, + width: 0, + height: 0, + x2: 0, + y2: 0, + cx: 0, + cy: 0, + cz: 0 + }; + const t = R(e); + let s = [], r = "M"; + const n = 0, i = 0; + let o = 0, a = 0; + const c = [], l = []; + let u = { x: n, y: i }, m = { x: n, y: i }; + const f = { ...X }; + j(t, (N, M, d, v) => { + f.x = d, f.y = v; + const L = G(N, f); + [r] = L, s = [d, v].concat(L.slice(1)), r === "M" ? ([, o, a] = L, u = { x: o, y: a }, m = { x: o, y: a }) : r === "L" ? { min: u, max: m } = zt(s[0], s[1], s[2], s[3]) : r === "A" ? { min: u, max: m } = pe(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8]) : r === "C" ? { min: u, max: m } = Te(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7]) : r === "Q" ? { min: u, max: m } = ze(s[0], s[1], s[2], s[3], s[4], s[5]) : r === "Z" && (s = [d, v, o, a], { min: u, max: m } = zt(s[0], s[1], s[2], s[3])), c.push(u), l.push(m); + const T = L.length; + f.x1 = +L[T - 2], f.y1 = +L[T - 1], f.x2 = +L[T - 4] || f.x1, f.y2 = +L[T - 3] || f.y1; + }); + const y = Math.min(...c.map((N) => N.x)), h = Math.max(...l.map((N) => N.x)), x = Math.min(...c.map((N) => N.y)), b = Math.max(...l.map((N) => N.y)), A = h - y, w = b - x; + return { + width: A, + height: w, + x: y, + y: x, + x2: h, + y2: b, + cx: y + A / 2, + cy: x + w / 2, + // an estimated guess + cz: Math.max(A, w) + Math.min(A, w) / 2 + }; +}, Je = (e, t) => Ht(e, t).segment, Ye = (e, t) => Nt(e, t).segment, Lt = (e) => Array.isArray(e) && e.every((t) => { + const s = t[0].toLowerCase(); + return nt[s] === t.length - 1 && "achlmqstvz".includes(s) && t.slice(1).every(Number.isFinite); +}) && e.length > 0, qe = (e) => Lt(e) && // `isPathArray` also checks if it's `Array` +e.every(([t]) => t === t.toUpperCase()), ke = (e) => qe(e) && e.every(([t]) => "ACLMQZ".includes(t)), Ke = (e) => ke(e) && e.every(([t]) => "MC".includes(t)), We = (e, t) => { + const { distance: s } = Nt(e, t); + return Math.abs(s) < bt; +}, Ve = (e) => Lt(e) && // `isPathArray` checks if it's `Array` +e.slice(1).every(([t]) => t === t.toLowerCase()), Ie = (e) => { if (typeof e != "string" || !e.length) return !1; - const t = new Xt(e); - for (et(t); t.index < t.max && !t.err.length; ) - Qt(t); + const t = new Rt(e); + for (st(t); t.index < t.max && !t.err.length; ) + Et(t); return !t.err.length && "mM".includes(t.segments[0][0]); -}, dt = (e) => Array.isArray(e) && e.every((t) => { - const n = t[0].toLowerCase(); - return tt[n] === t.length - 1 && "achlmqstvz".includes(n) && t.slice(1).every(Number.isFinite); -}) && e.length > 0, le = (e) => dt(e) && // `isPathArray` also checks if it's `Array` -e.every(([t]) => t === t.toUpperCase()), Ve = (e) => dt(e) && // `isPathArray` checks if it's `Array` -e.slice(1).every(([t]) => t === t.toLowerCase()), ae = (e) => le(e) && e.every(([t]) => "ACLMQZ".includes(t)), _e = (e) => ae(e) && e.every(([t]) => "MC".includes(t)), ut = { +}, mt = { line: ["x1", "y1", "x2", "y2"], circle: ["cx", "cy", "r"], ellipse: ["cx", "cy", "rx", "ry"], @@ -1114,316 +1231,271 @@ e.slice(1).every(([t]) => t === t.toLowerCase()), ae = (e) => le(e) && e.every(( polygon: ["points"], polyline: ["points"], glyph: ["d"] -}, Je = (e) => { - let { x1: t, y1: n, x2: r, y2: s } = e; - return [t, n, r, s] = [t, n, r, s].map((i) => +i), [ - ["M", t, n], - ["L", r, s] +}, Ge = (e) => { + let { x1: t, y1: s, x2: r, y2: n } = e; + return [t, s, r, n] = [t, s, r, n].map((i) => +i), [ + ["M", t, s], + ["L", r, n] ]; -}, Ke = (e) => { - const t = [], n = (e.points || "").trim().split(/[\s|,]/).map((s) => +s); +}, tn = (e) => { + const t = [], s = (e.points || "").trim().split(/[\s|,]/).map((n) => +n); let r = 0; - for (; r < n.length; ) - t.push([r ? "L" : "M", n[r], n[r + 1]]), r += 2; + for (; r < s.length; ) + t.push([r ? "L" : "M", s[r], s[r + 1]]), r += 2; return e.type === "polygon" ? [...t, ["z"]] : t; -}, We = (e) => { - let { cx: t, cy: n, r } = e; - return [t, n, r] = [t, n, r].map((s) => +s), [ - ["M", t - r, n], +}, en = (e) => { + let { cx: t, cy: s, r } = e; + return [t, s, r] = [t, s, r].map((n) => +n), [ + ["M", t - r, s], ["a", r, r, 0, 1, 0, 2 * r, 0], ["a", r, r, 0, 1, 0, -2 * r, 0] ]; -}, Ge = (e) => { - let { cx: t, cy: n } = e, r = e.rx || 0, s = e.ry || r; - return [t, n, r, s] = [t, n, r, s].map((i) => +i), [ - ["M", t - r, n], - ["a", r, s, 0, 1, 0, 2 * r, 0], - ["a", r, s, 0, 1, 0, -2 * r, 0] +}, nn = (e) => { + let { cx: t, cy: s } = e, r = e.rx || 0, n = e.ry || r; + return [t, s, r, n] = [t, s, r, n].map((i) => +i), [ + ["M", t - r, s], + ["a", r, n, 0, 1, 0, 2 * r, 0], + ["a", r, n, 0, 1, 0, -2 * r, 0] ]; -}, tn = (e) => { - const t = +e.x || 0, n = +e.y || 0, r = +e.width, s = +e.height; +}, sn = (e) => { + const t = +e.x || 0, s = +e.y || 0, r = +e.width, n = +e.height; let i = +(e.rx || 0), o = +(e.ry || i); - return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > s && (o -= (o * 2 - s) / 2), [ - ["M", t + i, n], + return i || o ? (i * 2 > r && (i -= (i * 2 - r) / 2), o * 2 > n && (o -= (o * 2 - n) / 2), [ + ["M", t + i, s], ["h", r - i * 2], ["s", i, 0, i, o], - ["v", s - o * 2], + ["v", n - o * 2], ["s", 0, o, -i, o], ["h", -r + i * 2], ["s", -i, 0, -i, -o], - ["v", -s + o * 2], + ["v", -n + o * 2], ["s", 0, -o, i, -o] - ]) : [["M", t, n], ["h", r], ["v", s], ["H", t], ["Z"]]; -}, me = (e, t) => { + ]) : [["M", t, s], ["h", r], ["v", n], ["H", t], ["Z"]]; +}, Ee = (e, t) => { const r = (t || document).defaultView || /* istanbul ignore next */ - window, s = Object.keys(ut), i = e instanceof r.SVGElement, o = i ? e.tagName : null; - if (o && [...s, "path"].every((u) => o !== u)) + window, n = Object.keys(mt), i = e instanceof r.SVGElement, o = i ? e.tagName : null; + if (o && [...n, "path"].every((m) => o !== m)) throw TypeError(`${E}: "${o}" is not SVGElement`); - const c = i ? o : e.type, l = ut[c], a = { type: c }; - i ? l.forEach((u) => { - a[u] = e.getAttribute(u); - }) : Object.assign(a, e); - let m = []; - return c === "circle" ? m = We(a) : c === "ellipse" ? m = Ge(a) : ["polyline", "polygon"].includes(c) ? m = Ke(a) : c === "rect" ? m = tn(a) : c === "line" ? m = Je(a) : ["glyph", "path"].includes(c) && (m = q( + const a = i ? o : e.type, c = mt[a], l = { type: a }; + i ? c.forEach((m) => { + l[m] = e.getAttribute(m); + }) : Object.assign(l, e); + let u = []; + return a === "circle" ? u = en(l) : a === "ellipse" ? u = nn(l) : ["polyline", "polygon"].includes(a) ? u = tn(l) : a === "rect" ? u = sn(l) : a === "line" ? u = Ge(l) : ["glyph", "path"].includes(a) && (u = R( i ? e.getAttribute("d") || /* istanbul ignore next @preserve */ "" : e.d || "" - )), dt(m) && m.length ? m : !1; -}, ht = (e, t) => { - let { round: n } = st; - if (t === "off" || n === "off") return e.slice(0); - n = typeof t == "number" && t >= 0 ? t : n; - const r = typeof n == "number" && n >= 1 ? 10 ** n : 1; - return D(e, (s) => { - const i = s.slice(1).map((o) => n ? Math.round(o * r) / r : Math.round(o)); - return [s[0], ...i]; - }); -}, Ct = (e, t) => ht(e, t).map((n) => n[0] + n.slice(1).join(" ")).join(""), en = (e, t, n) => { - const r = n || document, s = r.defaultView || /* istanbul ignore next */ - window, i = Object.keys(ut), o = e instanceof s.SVGElement, c = o ? e.tagName : null; - if (c === "path") throw TypeError(`${E}: "${c}" is already SVGPathElement`); - if (c && i.every((y) => c !== y)) throw TypeError(`${E}: "${c}" is not SVGElement`); - const l = r.createElementNS("http://www.w3.org/2000/svg", "path"), a = o ? c : e.type, m = ut[a], u = { type: a }, g = st.round, f = me(e, r), h = f && f.length ? Ct(f, g) : ""; - return o ? (m.forEach((y) => { - u[y] = e.getAttribute(y); - }), Object.values(e.attributes).forEach(({ name: y, value: x }) => { - m.includes(y) || l.setAttribute(y, x); - })) : (Object.assign(u, e), Object.keys(u).forEach((y) => { - !m.includes(y) && y !== "type" && l.setAttribute( - y.replace(/[A-Z]/g, (x) => `-${x.toLowerCase()}`), - u[y] + )), Lt(u) && u.length ? u : !1; +}, rn = (e, t, s) => { + const r = s || document, n = r.defaultView || /* istanbul ignore next */ + window, i = Object.keys(mt), o = e instanceof n.SVGElement, a = o ? e.tagName : null; + if (a === "path") throw TypeError(`${E}: "${a}" is already SVGPathElement`); + if (a && i.every((x) => a !== x)) throw TypeError(`${E}: "${a}" is not SVGElement`); + const c = r.createElementNS("http://www.w3.org/2000/svg", "path"), l = o ? a : e.type, u = mt[l], m = { type: l }, f = V.round, y = Ee(e, r), h = y && y.length ? $t(y, f) : ""; + return o ? (u.forEach((x) => { + m[x] = e.getAttribute(x); + }), Object.values(e.attributes).forEach(({ name: x, value: b }) => { + u.includes(x) || c.setAttribute(x, b); + })) : (Object.assign(m, e), Object.keys(m).forEach((x) => { + !u.includes(x) && x !== "type" && c.setAttribute( + x.replace(/[A-Z]/g, (b) => `-${b.toLowerCase()}`), + m[x] ); - })), ce(h) ? (l.setAttribute("d", h), t && o && (e.before(l, e), e.remove()), l) : !1; -}, Ot = (e) => { - const t = []; - let n, r = -1, s = 0, i = 0, o = 0, c = 0; - const l = { ...gt }; - return e.forEach((a) => { - const [m] = a, u = m.toUpperCase(), g = m.toLowerCase(), f = m === g, h = a.slice(1); - u === "M" ? (r += 1, [s, i] = h, s += f ? l.x : 0, i += f ? l.y : 0, o = s, c = i, n = [f ? [u, o, c] : a]) : (u === "Z" ? (s = o, i = c) : u === "H" ? ([, s] = a, s += f ? l.x : ( - /* istanbul ignore next @preserve */ - 0 - )) : u === "V" ? ([, i] = a, i += f ? l.y : ( - /* istanbul ignore next @preserve */ - 0 - )) : ([s, i] = a.slice(-2), s += f ? l.x : 0, i += f ? l.y : 0), n.push(a)), l.x = s, l.y = i, t[r] = n; - }), t; -}, ue = (e) => { - let t = new v(); - const { origin: n } = e, [r, s] = n, { translate: i } = e, { rotate: o } = e, { skew: c } = e, { scale: l } = e; - return Array.isArray(i) && i.length >= 2 && i.every((a) => !Number.isNaN(+a)) && i.some((a) => a !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || c || l) && (t = t.translate(r, s), Array.isArray(o) && o.length >= 2 && o.every((a) => !Number.isNaN(+a)) && o.some((a) => a !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(c) && c.length === 2 && c.every((a) => !Number.isNaN(+a)) && c.some((a) => a !== 0) ? (t = c[0] ? t.skewX(c[0]) : t, t = c[1] ? t.skewY(c[1]) : t) : typeof c == "number" && !Number.isNaN(c) && (t = t.skewX(c)), Array.isArray(l) && l.length >= 2 && l.every((a) => !Number.isNaN(+a)) && l.some((a) => a !== 1) ? t = t.scale(...l) : typeof l == "number" && !Number.isNaN(l) && (t = t.scale(l)), t = t.translate(-r, -s)), t; -}, ft = (e) => { - let t = 0, n = 0, r = 0, s = 0, i = "M"; - const o = q(e); - return D(o, (c, l) => { - [i] = c; - const a = V(c, l), m = i.toUpperCase(); - return m === "Z" ? (t = r, n = s) : m === "H" ? [, t] = a : m === "V" ? [, n] = a : ([t, n] = a.slice(-2), m === "M" && (r = t, s = n)), l.x = t, l.y = n, a; - }); -}, nn = (e, t, n) => { - const [r] = e, { x: s, y: i } = t, o = e.slice(1).map(Number), c = r.toLowerCase(); - if (n === 0 && r === "M") - return e; - if (r !== c) { - if (c === "a") - return [ - c, - o[0], - o[1], - o[2], - o[3], - o[4], - o[5] - s, - o[6] - i - ]; - if (c === "v") - return [c, o[0] - i]; - if (c === "h") - return [c, o[0] - s]; - { - const l = o.map((a, m) => a - (m % 2 ? i : s)); - return [c, ...l]; - } - } - return e; -}, vt = (e) => { - let t = 0, n = 0, r = 0, s = 0, i = "M"; - const o = q(e); - return D(o, (c, l, a) => { - [i] = c; - const m = nn(c, l, a), [u] = m, g = i.toUpperCase(), f = i.toLowerCase(), h = u === f; - return g === "Z" ? (t = r, n = s) : g === "H" ? ([, t] = m, t += h ? l.x : ( - /* istanbul ignore next @preserve */ - 0 - )) : g === "V" ? ([, n] = m, n += h ? l.y : ( - /* istanbul ignore next @preserve */ - 0 - )) : ([t, n] = m.slice(-2), t += h ? l.x : 0, n += h ? l.y : 0, g === "M" && (r = t, s = n)), l.x = t, l.y = n, m; - }); -}, sn = (e, t, n, r) => { - const [s] = e, i = (p) => Math.round(p * 10 ** 4) / 10 ** 4, o = e.slice(1), c = t.slice(1), { x1: l, y1: a, x2: m, y2: u, x: g, y: f } = n; - let h = e; - const [y, x] = c.slice(-2); - if ("TQ".includes(s) || (n.qx = null, n.qy = null), ["V", "H", "S", "T", "Z"].includes(s)) - h = [s, ...o]; - else if (s === "L") - i(g) === i(y) ? h = ["V", x] : i(f) === i(x) && (h = ["H", y]); - else if (s === "C") { - const [p, d] = c; - "CS".includes(r) && (i(p) === i(l * 2 - m) && i(d) === i(a * 2 - u) || i(l) === i(m * 2 - g) && i(a) === i(u * 2 - f)) && (h = ["S", ...c.slice(-4)]), n.x1 = p, n.y1 = d; - } else if (s === "Q") { - const [p, d] = c; - n.qx = p, n.qy = d, "QT".includes(r) && (i(p) === i(l * 2 - m) && i(d) === i(a * 2 - u) || i(l) === i(m * 2 - g) && i(a) === i(u * 2 - f)) && (h = ["T", ...c.slice(-2)]); + })), Ie(h) ? (c.setAttribute("d", h), t && o && (e.before(c, e), e.remove()), c) : !1; +}, Re = (e) => { + let t = new C(); + const { origin: s } = e, [r, n] = s, { translate: i } = e, { rotate: o } = e, { skew: a } = e, { scale: c } = e; + return Array.isArray(i) && i.length >= 2 && i.every((l) => !Number.isNaN(+l)) && i.some((l) => l !== 0) ? t = t.translate(...i) : typeof i == "number" && !Number.isNaN(i) && (t = t.translate(i)), (o || a || c) && (t = t.translate(r, n), Array.isArray(o) && o.length >= 2 && o.every((l) => !Number.isNaN(+l)) && o.some((l) => l !== 0) ? t = t.rotate(...o) : typeof o == "number" && !Number.isNaN(o) && (t = t.rotate(o)), Array.isArray(a) && a.length === 2 && a.every((l) => !Number.isNaN(+l)) && a.some((l) => l !== 0) ? (t = a[0] ? t.skewX(a[0]) : t, t = a[1] ? t.skewY(a[1]) : t) : typeof a == "number" && !Number.isNaN(a) && (t = t.skewX(a)), Array.isArray(c) && c.length >= 2 && c.every((l) => !Number.isNaN(+l)) && c.some((l) => l !== 1) ? t = t.scale(...c) : typeof c == "number" && !Number.isNaN(c) && (t = t.scale(c)), t = t.translate(-r, -n)), t; +}, je = (e, t, s, r) => { + const [n] = e, { round: i } = V, o = typeof i == "number" ? i : ( + /* istanbul ignore next */ + 4 + ), a = t.slice(1), { x1: c, y1: l, x2: u, y2: m, x: f, y } = s, [h, x] = a.slice(-2), b = e; + if ("TQ".includes(n) || (s.qx = null, s.qy = null), n === "L") { + if (z(f, o) === z(h, o)) + return ["V", x]; + if (z(y, o) === z(x, o)) + return ["H", h]; + } else if (n === "C") { + const [A, w] = a; + if (s.x1 = A, s.y1 = w, "CS".includes(r) && (z(A, o) === z(c * 2 - u, o) && z(w, o) === z(l * 2 - m, o) || z(c, o) === z(u * 2 - f, o) && z(l, o) === z(m * 2 - y, o))) + return ["S", a[2], a[3], a[4], a[5]]; + } else if (n === "Q") { + const [A, w] = a; + if (s.qx = A, s.qy = w, "QT".includes(r) && z(A, o) === z(c * 2 - u, o) && z(w, o) === z(l * 2 - m, o)) + return ["T", a[2], a[3]]; } - return h; -}, jt = (e, t) => { - const n = ft(e), r = rt(n), s = { ...gt }, i = [], o = n.length; - let c = "", l = "", a = 0, m = 0, u = 0, g = 0; - for (let y = 0; y < o; y += 1) { - [c] = n[y], i[y] = c, y && (l = i[y - 1]), n[y] = sn(n[y], r[y], s, l); - const x = n[y], p = x.length; - switch (s.x1 = +x[p - 2], s.y1 = +x[p - 1], s.x2 = +x[p - 4] || s.x1, s.y2 = +x[p - 3] || s.y1, c) { - case "Z": - a = u, m = g; - break; - case "H": - [, a] = x; - break; - case "V": - [, m] = x; - break; - default: - [a, m] = x.slice(-2).map(Number), c === "M" && (u = a, g = m); + return b; +}, dt = (e, t) => { + const s = e.slice(1).map((r) => z(r, t)); + return [e[0]].concat(s); +}, Yt = (e, t) => { + const s = xt(e), r = typeof t == "number" && t >= 0 ? t : ( + /* istanbul ignore next @preserve */ + 2 + ), n = { ...X }, i = []; + let o = "M", a = "Z"; + return j(s, (c, l, u, m) => { + n.x = u, n.y = m; + const f = G(c, n); + let y = c; + if ([o] = c, i[l] = o, l) { + a = i[l - 1]; + const x = je(c, f, n, a), b = dt(x, r), A = b.join(""), w = St(x, l, u, m), N = dt(w, r), M = N.join(""); + y = A.length < M.length ? b : N; } - s.x = a, s.y = m; - } - const f = ht(n, t), h = ht(vt(n), t); - return f.map((y, x) => x ? y.join("").length < h[x].join("").length ? y : h[x] : y); -}, rn = (e) => { + const h = f.length; + return n.x1 = +f[h - 2], n.y1 = +f[h - 1], n.x2 = +f[h - 4] || n.x1, n.y2 = +f[h - 3] || n.y1, y; + }); +}, on = (e, t) => { + let s = C.Translate(t[0], t[1], t[2]); + return [, , , s.m44] = t, s = e.multiply(s), [s.m41, s.m42, s.m43, s.m44]; +}, It = (e, t, s) => { + const [r, n, i] = s, [o, a, c] = on(e, [t[0], t[1], 0, 1]), l = o - r, u = a - n, m = c - i; + return [ + // protect against division by ZERO + l * (Math.abs(i) / Math.abs(m) || 1) + r, + u * (Math.abs(i) / Math.abs(m) || 1) + n + ]; +}, cn = (e) => { const t = e.slice(1).map( - (n, r, s) => r ? [...s[r - 1].slice(-2), ...n.slice(1)] : [...e[0].slice(1), ...n.slice(1)] - ).map((n) => n.map((r, s) => n[n.length - s - 2 * (1 - s % 2)])).reverse(); - return [["M", ...t[0].slice(0, 2)], ...t.map((n) => ["C", ...n.slice(2)])]; -}, lt = (e) => { - const t = ft(e), n = t.slice(-1)[0][0] === "Z", r = rt(t).map((s, i) => { - const [o, c] = s.slice(-2).map(Number); - return { - seg: t[i], - // absolute - n: s, - // normalized - c: t[i][0], - // pathCommand - x: o, - // x - y: c - // y - }; - }).map((s, i, o) => { - const c = s.seg, l = s.n, a = i && o[i - 1], m = o[i + 1], u = s.c, g = o.length, f = i ? o[i - 1].x : o[g - 1].x, h = i ? o[i - 1].y : o[g - 1].y; - let y = []; - switch (u) { + (s, r, n) => r ? n[r - 1].slice(-2).concat(s.slice(1)) : e[0].slice(1).concat(s.slice(1)) + ).map((s) => s.map((r, n) => s[s.length - n - 2 * (1 - n % 2)])).reverse(); + return [["M"].concat(t[0].slice(0, 2))].concat( + t.map((s) => ["C"].concat(s.slice(2))) + ); +}, yt = (e) => { + const t = xt(e), s = ut(t), r = t.length, n = t[r - 1][0] === "Z", i = j(t, (o, a) => { + const c = s[a], l = a && t[a - 1], u = l && l[0], m = t[a + 1], f = m && m[0], [y] = o, [h, x] = s[a ? a - 1 : r - 1].slice(-2); + let b = o; + switch (y) { case "M": - y = n ? ["Z"] : [u, f, h]; + b = n ? ["Z"] : [y, h, x]; break; case "A": - y = [u, ...c.slice(1, -3), c[5] === 1 ? 0 : 1, f, h]; + b = [ + y, + o[1], + o[2], + o[3], + o[4], + o[5] === 1 ? 0 : 1, + h, + x + ]; break; case "C": - m && m.c === "S" ? y = ["S", c[1], c[2], f, h] : y = [u, c[3], c[4], c[1], c[2], f, h]; + m && f === "S" ? b = ["S", o[1], o[2], h, x] : b = [y, o[3], o[4], o[1], o[2], h, x]; break; case "S": - a && "CS".includes(a.c) && (!m || m.c !== "S") ? y = ["C", l[3], l[4], l[1], l[2], f, h] : y = [u, l[1], l[2], f, h]; + u && "CS".includes(u) && (!m || f !== "S") ? b = [ + "C", + c[3], + c[4], + c[1], + c[2], + h, + x + ] : b = [y, c[1], c[2], h, x]; break; case "Q": - m && m.c === "T" ? y = ["T", f, h] : y = [u, ...c.slice(1, -2), f, h]; + m && f === "T" ? b = ["T", h, x] : b = [y, o[1], o[2], h, x]; break; case "T": - a && "QT".includes(a.c) && (!m || m.c !== "T") ? y = ["Q", l[1], l[2], f, h] : y = [u, f, h]; + u && "QT".includes(u) && (!m || f !== "T") ? b = ["Q", c[1], c[2], h, x] : b = [y, h, x]; break; case "Z": - y = ["M", f, h]; + b = ["M", h, x]; break; case "H": - y = [u, f]; + b = [y, h]; break; case "V": - y = [u, h]; + b = [y, x]; break; default: - y = [u, ...c.slice(1, -2), f, h]; + b = [y].concat(o.slice(1, -2), h, x); } - return y; + return b; }); - return n ? r.reverse() : [r[0], ...r.slice(1).reverse()]; -}, on = (e, t) => { - let n = v.Translate(...t.slice(0, -1)); - return [, , , n.m44] = t, n = e.multiply(n), [n.m41, n.m42, n.m43, n.m44]; -}, Rt = (e, t, n) => { - const [r, s, i] = n, [o, c, l] = on(e, [...t, 0, 1]), a = o - r, m = c - s, u = l - i; + return n ? i.reverse() : [i[0]].concat(i.slice(1).reverse()); +}, an = (e, t) => { + let { round: s } = V; + return s = t === "off" || typeof t == "number" && t >= 0 ? t : typeof s == "number" && s >= 0 ? s : ( + /* istanbul ignore next @preserve */ + "off" + ), s === "off" ? e.slice(0) : j(e, (r) => dt(r, s)); +}, ln = (e, t = 0.5) => { + const s = t, r = e.slice(0, 2), n = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), a = O(r, n, s), c = O(n, i, s), l = O(i, o, s), u = O(a, c, s), m = O(c, l, s), f = O(u, m, s); return [ - // protect against division by ZERO - a * (Math.abs(i) / Math.abs(u) || 1) + r, - m * (Math.abs(i) / Math.abs(u) || 1) + s + ["C", a[0], a[1], u[0], u[1], f[0], f[1]], + ["C", m[0], m[1], l[0], l[1], o[0], o[1]] ]; -}, Dt = (e, t) => { - let n = 0, r = 0, s = 0, i = 0, o = 0, c = 0, l = 0, a = 0, m = 0, u = 0, g = "M"; - const f = { ...gt }, h = q(e), y = t && Object.keys(t); - if (!t || y && !y.length) return h; - t.origin || Object.assign(t, { origin: st.origin }); - const x = t.origin, p = ue(t); - return p.isIdentity ? h : D(h, (d, C, M) => { - const b = V(d, f); - [g] = b; - let w = g === "A" ? ie(b, f) : ["V", "H"].includes(g) ? G(b, f) : b; - const T = w[0] === "C" && w.length > 7, P = T ? w.slice(0, 7) : w.slice(0); - if (T && (h.splice(M + 1, 0, ["C", ...w.slice(7)]), w = w.slice(0, 7)), w[0] === "L") { - const S = w.slice(-2); - [o, c] = Rt(p, S, x), n !== o && r !== c ? w = ["L", o, c] : r === c ? w = ["H", o] : n === o && (w = ["V", c]); - } else - for (l = 1, a = w.length; l < a; l += 2) - [o, c] = Rt(p, [+w[l], +w[l + 1]], x), w[l] = o, w[l + 1] = c; - n = o, r = c, g === "Z" ? (m = s, u = i) : ([m, u] = P.slice(-2), g === "M" && (s = m, i = u)); - const $ = P.length; - return f.x1 = +P[$ - 2], f.y1 = +P[$ - 1], f.x2 = +P[$ - 4] || f.x1, f.y2 = +P[$ - 3] || f.y1, f.x = m, f.y = u, w; +}, Kt = (e) => { + const t = []; + let s, r = -1, n = 0, i = 0, o = 0, a = 0; + const c = { ...X }; + return e.forEach((l) => { + const [u] = l, m = u.toUpperCase(), f = u.toLowerCase(), y = u === f, h = l.slice(1); + m === "M" ? (r += 1, [n, i] = h, n += y ? c.x : 0, i += y ? c.y : 0, o = n, a = i, s = [y ? [m, o, a] : l]) : (m === "Z" ? (n = o, i = a) : m === "H" ? ([, n] = l, n += y ? c.x : ( + /* istanbul ignore next @preserve */ + 0 + )) : m === "V" ? ([, i] = l, i += y ? c.y : ( + /* istanbul ignore next @preserve */ + 0 + )) : ([n, i] = l.slice(-2), n += y ? c.x : 0, i += y ? c.y : 0), s.push(l)), c.x = n, c.y = i, t[r] = s; + }), t; +}, Wt = (e, t) => { + let s = 0, r = 0, n = 0, i = 0, o = 0, a = 0, c = "M"; + const l = { ...X }, u = R(e), m = t && Object.keys(t); + if (!t || m && !m.length) return u.slice(0); + t.origin || Object.assign(t, { origin: V.origin }); + const f = t.origin, y = Re(t); + return y.isIdentity ? u.slice(0) : j(u, (h, x, b, A) => { + l.x = b, l.y = A, [c] = h; + const w = c.toUpperCase(), M = w !== c ? jt(h, x, b, A) : h.slice(0); + let d = w === "A" ? Zt(M, l) : ["V", "H"].includes(w) ? G(M, l) : M; + c = d[0]; + const v = c === "C" && d.length > 7, L = v ? d.slice(0, 7) : d.slice(0); + if (v && (u.splice(x + 1, 0, ["C"].concat(d.slice(7))), d = L), c === "L") + [n, i] = It(y, [d[1], d[2]], f), s !== n && r !== i ? d = ["L", n, i] : r === i ? d = ["H", n] : s === n && (d = ["V", i]); + else + for (o = 1, a = d.length; o < a; o += 2) + [n, i] = It(y, [+d[o], +d[o + 1]], f), d[o] = n, d[o + 1] = i; + s = n, r = i; + const T = L.length; + return l.x1 = +L[T - 2], l.y1 = +L[T - 1], l.x2 = +L[T - 4] || l.x1, l.y2 = +L[T - 3] || l.y1, d; }); -}, cn = (e, t = 0.5) => { - const n = t, r = e.slice(0, 2), s = e.slice(2, 4), i = e.slice(4, 6), o = e.slice(6, 8), c = R(r, s, n), l = R(s, i, n), a = R(i, o, n), m = R(c, l, n), u = R(l, a, n), g = R(m, u, n); - return [ - ["C", ...c, ...m, ...g], - ["C", ...u, ...a, ...o] - ]; }; -class A { +class p { /** * @constructor * @param pathValue the path string * @param config instance options */ - constructor(t, n) { - const r = n || {}, s = typeof t > "u"; - if (s || !t.length) - throw TypeError(`${E}: "pathValue" is ${s ? "undefined" : "empty"}`); - const i = q(t); - this.segments = i; - const { round: o, origin: c } = r; - let l; - Number.isInteger(o) || o === "off" ? l = o : l = st.round; - let a = st.origin; - if (Array.isArray(c) && c.length >= 2) { - const [m, u, g] = c.map(Number); - a = [ - Number.isNaN(m) ? 0 : m, + constructor(t, s) { + const r = s || {}, n = typeof t > "u"; + if (n || !t.length) + throw TypeError(`${E}: "pathValue" is ${n ? "undefined" : "empty"}`); + this.segments = R(t); + const { round: i, origin: o } = r; + let a; + Number.isInteger(i) || i === "off" ? a = i : a = V.round; + let c = V.origin; + if (Array.isArray(o) && o.length >= 2) { + const [l, u, m] = o.map(Number); + c = [ + Number.isNaN(l) ? 0 : l, Number.isNaN(u) ? 0 : u, - Number.isNaN(g) ? 0 : g + Number.isNaN(m) ? 0 : m ]; } - return this.round = l, this.origin = a, this; + return this.round = a, this.origin = c, this; } get bbox() { - return zt(this.segments); + return Jt(this.segments); } get length() { - return W(this.segments); + return rt(this.segments); } /** * Returns the path bounding box, equivalent to native `path.getBBox()`. @@ -1452,7 +1524,7 @@ class A { * @returns the requested point */ getPointAtLength(t) { - return nt(this.segments, t); + return at(this.segments, t); } /** * Convert path to absolute values @@ -1461,7 +1533,7 @@ class A { */ toAbsolute() { const { segments: t } = this; - return this.segments = ft(t), this; + return this.segments = xt(t), this; } /** * Convert path to relative values @@ -1470,7 +1542,7 @@ class A { */ toRelative() { const { segments: t } = this; - return this.segments = vt(t), this; + return this.segments = Xt(t), this; } /** * Convert path to cubic-bezier values. In addition, un-necessary `Z` @@ -1480,7 +1552,7 @@ class A { */ toCurve() { const { segments: t } = this; - return this.segments = mt(t), this; + return this.segments = gt(t), this; } /** * Reverse the order of the segments and their values. @@ -1490,9 +1562,9 @@ class A { */ reverse(t) { this.toAbsolute(); - const { segments: n } = this, r = Ot(n), s = r.length > 1 ? r : !1, i = s ? s.map((c, l) => t ? l ? lt(c) : c.slice(0) : lt(c)) : n.slice(0); + const { segments: s } = this, r = Kt(s), n = r.length > 1 ? r : !1, i = n ? n.map((a, c) => t ? c ? yt(a) : a.slice(0) : yt(a)) : s.slice(0); let o = []; - return s ? o = i.flat(1) : o = t ? n : lt(n), this.segments = o.slice(0), this; + return n ? o = i.flat(1) : o = t ? s : yt(s), this.segments = o.slice(0), this; } /** * Normalize path in 2 steps: @@ -1503,7 +1575,7 @@ class A { */ normalize() { const { segments: t } = this; - return this.segments = rt(t), this; + return this.segments = ut(t), this; } /** * Optimize `pathArray` values: @@ -1514,8 +1586,8 @@ class A { * @public */ optimize() { - const { segments: t } = this; - return this.segments = jt(t, this.round), this; + const { segments: t } = this, s = this.round === "off" ? 2 : this.round; + return this.segments = Yt(t, s), this; } /** * Transform path using values from an `Object` defined as `transformObject`. @@ -1526,21 +1598,21 @@ class A { * @public */ transform(t) { - if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((l) => l in t)) + if (!t || typeof t != "object" || typeof t == "object" && !["translate", "rotate", "skew", "scale"].some((c) => c in t)) return this; const { - segments: n, - origin: [r, s, i] + segments: s, + origin: [r, n, i] } = this, o = {}; - for (const [l, a] of Object.entries(t)) - l === "skew" && Array.isArray(a) || (l === "rotate" || l === "translate" || l === "origin" || l === "scale") && Array.isArray(a) ? o[l] = a.map(Number) : l !== "origin" && typeof Number(a) == "number" && (o[l] = Number(a)); - const { origin: c } = o; - if (Array.isArray(c) && c.length >= 2) { - const [l, a, m] = c.map(Number); - o.origin = [Number.isNaN(l) ? r : l, Number.isNaN(a) ? s : a, m || i]; + for (const [c, l] of Object.entries(t)) + c === "skew" && Array.isArray(l) || (c === "rotate" || c === "translate" || c === "origin" || c === "scale") && Array.isArray(l) ? o[c] = l.map(Number) : c !== "origin" && typeof Number(l) == "number" && (o[c] = Number(l)); + const { origin: a } = o; + if (Array.isArray(a) && a.length >= 2) { + const [c, l, u] = a.map(Number); + o.origin = [Number.isNaN(c) ? r : c, Number.isNaN(l) ? n : l, u || i]; } else - o.origin = [r, s, i]; - return this.segments = Dt(n, o), this; + o.origin = [r, n, i]; + return this.segments = Wt(s, o), this; } /** * Rotate path 180deg vertically @@ -1548,8 +1620,8 @@ class A { * @public */ flipX() { - const { cx: t, cy: n } = this.bbox; - return this.transform({ rotate: [0, 180, 0], origin: [t, n, 0] }), this; + const { cx: t, cy: s } = this.bbox; + return this.transform({ rotate: [0, 180, 0], origin: [t, s, 0] }), this; } /** * Rotate path 180deg horizontally @@ -1557,8 +1629,8 @@ class A { * @public */ flipY() { - const { cx: t, cy: n } = this.bbox; - return this.transform({ rotate: [180, 0, 0], origin: [t, n, 0] }), this; + const { cx: t, cy: s } = this.bbox; + return this.transform({ rotate: [180, 0, 0], origin: [t, s, 0] }), this; } /** * Export the current path to be used @@ -1568,11 +1640,22 @@ class A { * @return the path string */ toString() { - return Ct(this.segments, this.round); + return $t(this.segments, this.round); } } -N(A, "CSSMatrix", v), N(A, "getSVGMatrix", ue), N(A, "getPathBBox", zt), N(A, "getPathArea", oe), N(A, "getTotalLength", W), N(A, "getDrawDirection", Be), N(A, "getPointAtLength", nt), N(A, "getPropertiesAtLength", Tt), N(A, "getPropertiesAtPoint", pt), N(A, "polygonLength", Ne), N(A, "polygonArea", we), N(A, "getClosestPoint", Ye), N(A, "getSegmentOfPoint", He), N(A, "getSegmentAtLength", Fe), N(A, "isPointInStroke", Ue), N(A, "isValidPath", ce), N(A, "isPathArray", dt), N(A, "isAbsoluteArray", le), N(A, "isRelativeArray", Ve), N(A, "isCurveArray", _e), N(A, "isNormalizedArray", ae), N(A, "shapeToPath", en), N(A, "shapeToPathArray", me), N(A, "parsePathString", q), N(A, "roundPath", ht), N(A, "splitPath", Ot), N(A, "splitCubic", cn), N(A, "optimizePath", jt), N(A, "reverseCurve", rn), N(A, "reversePath", lt), N(A, "normalizePath", rt), N(A, "transformPath", Dt), N(A, "pathToAbsolute", ft), N(A, "pathToRelative", vt), N(A, "pathToCurve", mt), N(A, "pathToString", Ct); +g(p, "CSSMatrix", C), g(p, "pathToAbsolute", xt), g(p, "pathToRelative", Xt), g(p, "pathToCurve", gt), g(p, "pathToString", $t), g(p, "arcTools", Be), g(p, "bezierTools", { + Cvalues: be, + Tvalues: qt, + minmaxC: kt, + minmaxQ: pt, + getBezierLength: ft, + bezierLength: we, + calculateBezier: Me, + computeBezier: Ae, + deriveBezier: de, + CBEZIER_MINMAX_EPSILON: Ne +}), g(p, "cubicTools", { getCubicLength: _t, getCubicBBox: Te, getPointAtCubicLength: ve, getPointAtCubicSegmentLength: Le }), g(p, "lineTools", { getPointAtLineLength: Ot, getLineBBox: zt, getLineLength: lt }), g(p, "quadTools", { getPointAtQuadSegmentLength: Ce, getQuadLength: Ft, getQuadBBox: ze, getPointAtQuadLength: $e }), g(p, "polygonTools", { polygonArea: _e, polygonLength: Fe }), g(p, "distanceSquareRoot", Mt), g(p, "distanceEpsilon", bt), g(p, "midPoint", O), g(p, "rotateVector", ct), g(p, "roundTo", z), g(p, "finalizeSegment", Tt), g(p, "invalidPathValue", U), g(p, "isArcCommand", fe), g(p, "isDigit", H), g(p, "isDigitStart", he), g(p, "isMoveCommand", ye), g(p, "isPathCommand", me), g(p, "isSpace", ue), g(p, "paramsCount", nt), g(p, "paramsParser", X), g(p, "pathParser", Rt), g(p, "scanFlag", ae), g(p, "scanParam", le), g(p, "scanSegment", Et), g(p, "skipSpaces", st), g(p, "getPathBBox", Jt), g(p, "getPathArea", Pe), g(p, "getTotalLength", rt), g(p, "getDrawDirection", Xe), g(p, "getPointAtLength", at), g(p, "getPropertiesAtLength", Ht), g(p, "getPropertiesAtPoint", Nt), g(p, "getClosestPoint", He), g(p, "getSegmentOfPoint", Ye), g(p, "getSegmentAtLength", Je), g(p, "isPointInStroke", We), g(p, "isValidPath", Ie), g(p, "isPathArray", Lt), g(p, "isAbsoluteArray", qe), g(p, "isRelativeArray", Ve), g(p, "isCurveArray", Ke), g(p, "isNormalizedArray", ke), g(p, "shapeToPath", rn), g(p, "shapeToPathArray", Ee), g(p, "shapeParams", mt), g(p, "parsePathString", R), g(p, "absolutizeSegment", jt), g(p, "arcToCubic", Dt), g(p, "getSVGMatrix", Re), g(p, "iterate", j), g(p, "lineToCubic", Ct), g(p, "normalizePath", ut), g(p, "normalizeSegment", G), g(p, "optimizePath", Yt), g(p, "projection2d", It), g(p, "quadToCubic", xe), g(p, "relativizeSegment", St), g(p, "reverseCurve", cn), g(p, "reversePath", yt), g(p, "roundPath", an), g(p, "roundSegment", dt), g(p, "segmentToCubic", Zt), g(p, "shortenSegment", je), g(p, "splitCubic", ln), g(p, "splitPath", Kt), g(p, "transformPath", Wt); export { - A as default + p as default }; //# sourceMappingURL=svg-path-commander.mjs.map diff --git a/dist/svg-path-commander.mjs.map b/dist/svg-path-commander.mjs.map index 9d4acb2..8644f8c 100644 --- a/dist/svg-path-commander.mjs.map +++ b/dist/svg-path-commander.mjs.map @@ -1 +1 @@ -{"version":3,"file":"svg-path-commander.mjs","sources":["../src/options/options.ts","../src/parser/error.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/math/polygonArea.ts","../src/math/distanceSquareRoot.ts","../src/math/polygonLength.ts","../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/parser/paramsParser.ts","../src/process/iterate.ts","../src/process/absolutizeSegment.ts","../src/process/normalizeSegment.ts","../src/math/midPoint.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/util/getPathBBox.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/convert/pathToCurve.ts","../src/util/getPathArea.ts","../src/util/getTotalLength.ts","../src/util/getDrawDirection.ts","../src/util/distanceEpsilon.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/process/normalizePath.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getSegmentOfPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/isPointInStroke.ts","../src/util/isValidPath.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isRelativeArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/process/roundPath.ts","../src/convert/pathToString.ts","../src/util/shapeToPath.ts","../src/process/splitPath.ts","../src/process/getSVGMatrix.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/process/shortenSegment.ts","../src/process/optimizePath.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/projection2d.ts","../src/process/transformPath.ts","../src/process/splitCubic.ts","../src/index.ts"],"sourcesContent":["import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let LK = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[LK]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (LK === 'm' && data.length > 2) {\n path.segments.push([pathCommand, ...(data.splice(0, 2) as number[])] as PathSegment);\n LK = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push([pathCommand, ...(data.splice(0, paramsCount[LK]) as number[])] as PathSegment);\n }\n\n if (!paramsCount[LK]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: any[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | PathArray) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as PathArray;\n // return pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]): number => {\n const n = polygon.length;\n let i = -1;\n let a;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nexport default polygonArea;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple): number => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import { type PointTuple } from '../types';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns {number} the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]): number => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport default polygonLength;\n","var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n const allPathCommands = [] as PathCommand[];\n const params = { ...paramsParser };\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n allPathCommands[i] = pathCommand;\n const iteratorResult = iterator(segment, params, i);\n path[i] = iteratorResult;\n\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n\n segment = path[i];\n const seglen = segment.length;\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n }\n // console.log('iteration: ', ...path)\n return path as T;\n};\n\nexport default iterate;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (!isAbsolute) {\n if (absCommand === 'A') {\n return [\n absCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] + x,\n values[6] + y,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, values[0] + y] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, values[0] + x] as HSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = values.map((n, j) => n + (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [absCommand, ...absValues] as MSegment | QSegment | TSegment | SSegment | CSegment;\n }\n }\n\n return segment as AbsoluteSegment;\n};\nexport default absolutizeSegment;\n","import type { ParserParams } from '../interface';\nimport type { NormalSegment, PointTuple, PathSegment, QSegment, CSegment, LSegment } from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x1: px1, y1: py1, x2: px2, y2: py2 } = params;\n const values = segment.slice(1).map(Number);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'H') {\n return ['L', segment[1], py1] as LSegment;\n } else if (pathCommand === 'V') {\n return ['L', px1, segment[1]] as LSegment;\n } else if (pathCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1, ...values] as CSegment;\n } else if (pathCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy, ...values] as QSegment;\n } else if (pathCommand === 'Q') {\n const [nqx, nqy] = values as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n }\n\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nexport const getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nexport const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nexport const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst ellipticalArcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const arcLength = Math.sqrt(term1 + term2) * theta;\n return Math.abs(arcLength);\n};\n\n/**\n * Compute point on ellipse from angle around ellipse (theta);\n * @param theta the arc sweep angle\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the angle\n * @returns a point around ellipse\n */\nconst arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alpha: number) => {\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cos = Math.cos(alpha);\n const sin = Math.sin(alpha);\n const x = rx * Math.cos(theta);\n const y = ry * Math.sin(theta);\n\n return {\n x: cx + cos * x - sin * y,\n y: cy + sin * x + cos * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n const angle = sign * Math.acos(p / n);\n\n return angle;\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle\n * and radiuses on X and Y coordinates.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // to be used later\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n // point.length = ellipticalArcLength(rx, ry, sweepAngle);\n // point.box = minmax(center.x, center.y, rx, ry, xRotRad, startAngle, startAngle + sweepAngle);\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nexport const getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return ellipticalArcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nexport const getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const length = ellipticalArcLength(rx, ry, endAngle - startAngle);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the bounding box for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nexport const getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const [cx, cy] = [center.x, center.y];\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * Math.PI) / 180;\n const tan = Math.tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = Math.atan2(-ry * tan, rx);\n const angle1 = theta;\n const angle2 = theta + Math.PI;\n const angle3 = Math.atan2(ry, rx * tan);\n const angle4 = angle3 + Math.PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = Math.min(...xArr);\n const xMax = Math.max(...xArr);\n const yMin = Math.min(...yArr);\n const yMax = Math.max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arc(angleAfterStart, cx, cy, rx, ry, alpha);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arc(angleBeforeEnd, cx, cy, rx, ry, alpha);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arc(angle1, cx, cy, rx, ry, alpha));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arc(angle2, cx, cy, rx, ry, alpha));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arc(angle4, cx, cy, rx, ry, alpha));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arc(angle3, cx, cy, rx, ry, alpha));\n }\n\n return {\n min: {\n x: Math.min(...extremes.map(n => n.x)),\n y: Math.min(...extremes.map(n => n.y)),\n },\n max: {\n x: Math.max(...extremes.map(n => n.x)),\n y: Math.max(...extremes.map(n => n.y)),\n },\n };\n};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst ZERO = { x: 0, y: 0 };\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst derive = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], ZERO as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst arcfn = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst lengthFn = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * arcfn(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nexport const length = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = derive(points);\n return lengthFn((t: number) => {\n return compute(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nexport const minmaxQ = (A: [number, number, number]) => {\n const min = Math.min(A[0], A[2]);\n const max = Math.max(A[0], A[2]);\n\n /* istanbul ignore next @preserve */\n if (A[1] >= A[0] ? A[2] >= A[1] : A[2] <= A[1]) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (A[0] * A[2] - A[1] * A[1]) / (A[0] - 2 * A[1] + A[2]);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nexport const minmaxC = (A: [number, number, number, number]) => {\n const K = A[0] - 3 * A[1] + 3 * A[2] - A[3];\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (A[0] === A[3] && A[0] === A[1]) {\n // no curve, point targeting same location\n return [A[0], A[3]] as PointTuple;\n }\n\n return minmaxQ([A[0], -0.5 * A[0] + 1.5 * A[1], A[0] - 3 * A[1] + 3 * A[2]]);\n }\n\n // the reduced discriminant of the derivative\n const T = -A[0] * A[2] + A[0] * A[3] - A[1] * A[2] - A[1] * A[3] + A[1] * A[1] + A[2] * A[2];\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(A[0], A[3]), Math.max(A[0], A[3])] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(A[0], A[3]);\n let max = Math.max(A[0], A[3]);\n\n const L = A[0] - 2 * A[1] + A[2];\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n A[0] * (1 - R) * (1 - R) * (1 - R) +\n A[1] * 3 * (1 - R) * (1 - R) * R +\n A[2] * 3 * (1 - R) * R * R +\n A[3] * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n","import { length, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a {x,y} point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nexport const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nexport const getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nexport const getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import { length, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nexport const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return length([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nexport const getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n Point,\n PointTuple,\n QuadCoordinates,\n} from '../types';\n// import pathFactory from './pathFactory';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport parsePathString from '../parser/parsePathString';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n data = [x, y, ...normalSegment.slice(1)] as number[];\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(...(data as ArcCoordinates)));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(...(data as CubicCoordinates)));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(...(data as QuadCoordinates)));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const X = x * Math.cos(rad) - y * Math.sin(rad);\n const Y = x * Math.sin(rad) + y * Math.cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [...m2, ...m3, ...m4, ...res];\n }\n res = [...m2, ...m3, ...m4, ...res];\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [...c1, ...c2, x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n args = [px1, py1, ...values] as [number, number, number, number, number, number, number, number, number];\n return ['C', ...arcToCubic(...args)] as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n args = [px1, py1, ...values] as [number, number, number, number, number, number];\n return ['C', ...quadToCubic(...args)] as CSegment;\n } else if (pathCommand === 'L') {\n return ['C', ...lineToCubic(px1, py1, x, y)] as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C', ...lineToCubic(px1, py1, px, py)] as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport absolutizeSegment from '../process/absolutizeSegment';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n const path = parsePathString(pathInput);\n return iterate(path, (seg, params, i) => {\n const absSegment = absolutizeSegment(seg, params);\n [pathCommand] = absSegment;\n\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const normalSegment = normalizeSegment(absSegment, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToCurve;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray, QuadCoordinates } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, ...(seg.slice(1) as QuadCoordinates));\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\n// import pathFactory from './pathFactory';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n totalLength += getLineLength(...(data as LineCoordinates));\n }\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (isM) {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber) return point;\n\n if (distance < DISTANCE_EPSILON) {\n POINT = point;\n }\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(...(data as LineCoordinates), distance - totalLength);\n length = getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(...(data as ArcCoordinates), distance - totalLength);\n length = getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(...(data as CubicCoordinates), distance - totalLength);\n length = getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(...(data as QuadCoordinates), distance - totalLength);\n length = getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n point = { x: mx, y: my };\n length = getLineLength(...(data as LineCoordinates));\n }\n\n if (totalLength < distance && totalLength + length >= distance) {\n POINT = point;\n }\n\n totalLength += length;\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n POINT = { x, y };\n }\n\n return POINT;\n};\nexport default getPointAtLength;\n","import type { PointTuple, PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n const [x, y] = segment.slice(-2) as PointTuple;\n const point = { x, y };\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n point,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n return {\n segment: pathArray[index],\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import normalizeSegment from './normalizeSegment';\nimport type { AbsoluteCommand, NormalArray, PathArray, PointTuple } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Normalizes a `path` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n return iterate(parsePathString(pathInput), (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const result = normalizeSegment(absoluteSegment, params);\n [pathCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n // const seglen = result.length;\n // params.x1 = +result[seglen - 2];\n // params.y1 = +result[seglen - 1];\n // params.x2 = +result[seglen - 4] || params.x1;\n // params.y2 = +result[seglen - 3] || params.y1;\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default normalizePath;\n","import type { PathArray } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: { x: number; y: number }): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(path);\n const distanceTo = (p: { x: number; y: number }) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: { x: number; y: number };\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n if (roundOption === 'off' || round === 'off') return path.slice(0) as PathArray;\n // allow for ZERO decimals\n round = typeof roundOption === 'number' && roundOption >= 0 ? roundOption : round;\n // to round values to the power\n // the `round` value must be integer\n const pow = typeof round === 'number' && round >= 1 ? 10 ** round : 1;\n\n return iterate(path, segment => {\n const values = (segment.slice(1) as number[]).map(n => (round ? Math.round(n * pow) / pow : Math.round(n)));\n return [segment[0], ...values] as PathSegment;\n });\n};\nexport default roundPath;\n","import type { PathArray } from '../types';\nimport roundPath from '../process/roundPath';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param round amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, round?: number | 'off'): string => {\n return roundPath(path, round)\n .map(x => x[0] + x.slice(1).join(' '))\n .join('');\n};\nexport default pathToString;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, AbsoluteCommand, HSegment, PathArray, PointTuple, VSegment } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params) => {\n [pathCommand] = seg;\n const result = absolutizeSegment(seg, params);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as HSegment;\n } else if (absCommand === 'V') {\n [, y] = result as VSegment;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToAbsolute;\n","import type { ParserParams } from '../interface';\nimport type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @param index the segment index\n * @returns the absolute segment\n */\nconst relativizeSegment = (segment: PathSegment, params: ParserParams, index: number) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n\n if (index === 0 && pathCommand === 'M') {\n return segment;\n }\n\n /* istanbul ignore else @preserve */\n if (pathCommand !== relCommand) {\n if (relCommand === 'a') {\n return [\n relCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] - x,\n values[6] - y,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, values[0] - y] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, values[0] - x] as hSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = values.map((n, j) => n - (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [relCommand, ...relValues] as qSegment | tSegment | sSegment | cSegment;\n }\n }\n\n return segment as RelativeSegment;\n};\nexport default relativizeSegment;\n","import type {\n AbsoluteCommand,\n hSegment,\n PathArray,\n PointTuple,\n RelativeArray,\n RelativeCommand,\n vSegment,\n} from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params, i) => {\n [pathCommand] = seg;\n const result = relativizeSegment(seg, params, i);\n const [resultedCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = resultedCommand === relCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as hSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = result as vSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n\n return result;\n });\n};\nexport default pathToRelative;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n HSegment,\n NormalSegment,\n PathCommand,\n ShortSegment,\n SSegment,\n TSegment,\n VSegment,\n ZSegment,\n} from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const round4 = (n: number) => Math.round(n * 10 ** 4) / 10 ** 4;\n const segmentValues = segment.slice(1) as number[];\n const normalValues = normalSegment.slice(1) as number[];\n const { x1: px1, y1: py1, x2: px2, y2: py2, x: px, y: py } = params;\n let result = segment;\n const [x, y] = normalValues.slice(-2);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)) {\n result = [pathCommand, ...segmentValues] as VSegment | HSegment | SSegment | TSegment | ZSegment;\n } else if (pathCommand === 'L') {\n if (round4(px) === round4(x)) {\n result = ['V', y];\n } else if (round4(py) === round4(y)) {\n result = ['H', x];\n }\n } else if (pathCommand === 'C') {\n const [x1, y1] = normalValues;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((round4(x1) === round4(px1 * 2 - px2) && round4(y1) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['S', ...normalValues.slice(-4)] as SSegment;\n }\n params.x1 = x1;\n params.y1 = y1;\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n ((round4(qx) === round4(px1 * 2 - px2) && round4(qy) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['T', ...normalValues.slice(-2)] as TSegment;\n }\n }\n\n return result as ShortSegment;\n};\nexport default shortenSegment;\n","import roundPath from './roundPath';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport pathToRelative from '../convert/pathToRelative';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport normalizePath from './normalizePath';\nimport type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteSegment } from '../types';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param round the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, round: 'off' | number): PathArray => {\n const path = pathToAbsolute(pathInput);\n const normalPath = normalizePath(path);\n const params = { ...paramsParser };\n const allPathCommands = [] as PathCommand[];\n const ii = path.length;\n let pathCommand = '' as PathCommand;\n let prevCommand = '' as PathCommand;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n\n for (let i = 0; i < ii; i += 1) {\n [pathCommand] = path[i];\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n // Get previous path command for `shortenSegment`\n if (i) prevCommand = allPathCommands[i - 1];\n path[i] = shortenSegment(path[i], normalPath[i], params, prevCommand) as AbsoluteSegment;\n\n const segment = path[i];\n const seglen = segment.length;\n\n // update C, S, Q, T specific params\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n\n // update x, y params\n switch (pathCommand) {\n case 'Z':\n x = mx;\n y = my;\n break;\n case 'H':\n [, x] = segment as HSegment;\n break;\n case 'V':\n [, y] = segment as VSegment;\n break;\n default:\n [x, y] = segment.slice(-2).map(Number);\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n }\n\n const absolutePath = roundPath(path, round);\n const relativePath = roundPath(pathToRelative(path), round);\n\n return absolutePath.map((a: PathSegment, i: number) => {\n if (i) {\n return a.join('').length < relativePath[i].join('').length ? a : relativePath[i];\n }\n return a;\n }) as PathArray;\n};\nexport default optimizePath;\n","import type { CurveArray } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray): CurveArray => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? [...path[0].slice(1), ...x.slice(1)] : [...curveOnly[i - 1].slice(-2), ...x.slice(1)],\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse();\n\n return [['M', ...rotatedCurve[0].slice(0, 2)], ...rotatedCurve.map(x => ['C', ...x.slice(2)])] as CurveArray;\n};\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray): PathArray => {\n const absolutePath = pathToAbsolute(pathInput);\n const isClosed = absolutePath.slice(-1)[0][0] === 'Z';\n\n const reversedPath = normalizePath(absolutePath)\n .map((segment, i) => {\n const [x, y] = segment.slice(-2).map(Number);\n return {\n seg: absolutePath[i], // absolute\n n: segment, // normalized\n c: absolutePath[i][0], // pathCommand\n x, // x\n y, // y\n };\n })\n .map((seg, i, path) => {\n const segment = seg.seg;\n const data = seg.n;\n const prevSeg = i && path[i - 1];\n const nextSeg = path[i + 1];\n const pathCommand = seg.c;\n const pLen = path.length;\n const x = i ? path[i - 1].x : path[pLen - 1].x;\n const y = i ? path[i - 1].y : path[pLen - 1].y;\n let result = [];\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [pathCommand, ...segment.slice(1, -3), segment[5] === 1 ? 0 : 1, x, y] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextSeg.c === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevSeg && 'CS'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'S')) {\n result = ['C', data[3], data[4], data[1], data[2], x, y] as CSegment;\n } else {\n result = [pathCommand, data[1], data[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextSeg.c === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, ...segment.slice(1, -2), x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevSeg && 'QT'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'T')) {\n result = ['Q', data[1], data[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand, ...segment.slice(1, -2), x, y] as PathSegment;\n }\n\n return result;\n });\n\n return (isClosed ? reversedPath.reverse() : [reversedPath[0], ...reversedPath.slice(1).reverse()]) as PathArray;\n};\nexport default reversePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(...(v.slice(0, -1) as [number, number, number]));\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [...point2D, 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, CSegment, PathArray, PointTuple, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let lx = 0;\n let ly = 0;\n let j = 0;\n let jj = 0;\n let nx = 0;\n let ny = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path;\n\n return iterate(path, (seg, _, i) => {\n const absSegment = absolutizeSegment(seg, transformParams);\n [pathCommand] = absSegment;\n\n let result =\n pathCommand === 'A'\n ? segmentToCubic(absSegment, transformParams)\n : ['V', 'H'].includes(pathCommand)\n ? normalizeSegment(absSegment, transformParams)\n : absSegment;\n const isLongArc = result[0] === 'C' && result.length > 7;\n const normalizedSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as typeof result;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (result[0] === 'L') {\n const values = result.slice(-2) as PointTuple;\n [lx, ly] = projection2d(matrixInstance, values, origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n if (pathCommand === 'Z') {\n nx = mx;\n ny = my;\n } else {\n [nx, ny] = normalizedSegment.slice(-2) as PointTuple;\n if (pathCommand === 'M') {\n mx = nx;\n my = ny;\n }\n }\n\n const seglen = normalizedSegment.length;\n transformParams.x1 = +normalizedSegment[seglen - 2];\n transformParams.y1 = +normalizedSegment[seglen - 1];\n transformParams.x2 = +normalizedSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +normalizedSegment[seglen - 3] || transformParams.y1;\n transformParams.x = nx;\n transformParams.y = ny;\n return result;\n });\n};\n\nexport default transformPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', ...p4, ...p7, ...p9],\n ['C', ...p8, ...p6, ...p3],\n ];\n};\nexport default splitCubic;\n","'use strict';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\n\nimport polygonArea from './math/polygonArea';\nimport polygonLength from './math/polygonLength';\n\nimport CSSMatrix from '@thednp/dommatrix';\nimport getPathBBox from './util/getPathBBox';\nimport getPathArea from './util/getPathArea';\nimport getTotalLength from './util/getTotalLength';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPointAtLength from './util/getPointAtLength';\n\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getClosestPoint from './util/getClosestPoint';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport isPointInStroke from './util/isPointInStroke';\n\nimport isValidPath from './util/isValidPath';\nimport isPathArray from './util/isPathArray';\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isRelativeArray from './util/isRelativeArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport shapeToPathArray from './util/shapeToPathArray';\nimport shapeToPath from './util/shapeToPath';\n\nimport roundPath from './process/roundPath';\nimport splitPath from './process/splitPath';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport optimizePath from './process/optimizePath';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport normalizePath from './process/normalizePath';\nimport transformPath from './process/transformPath';\nimport splitCubic from './process/splitCubic';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static getSVGMatrix = getSVGMatrix;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static polygonLength = polygonLength;\n public static polygonArea = polygonArea;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static parsePathString = parsePathString;\n public static roundPath = roundPath;\n public static splitPath = splitPath;\n public static splitCubic = splitCubic;\n public static optimizePath = optimizePath;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static normalizePath = normalizePath;\n public static transformPath = transformPath;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n const segments = parsePathString(pathValue);\n this.segments = segments;\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n\n this.segments = optimizePath(segments, this.round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["defaultOptions","error","paramsCount","finalizeSegment","path","pathCommand","LK","data","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","_a","segments","cmdCode","reqParams","paramCounts","lastSegment","i","PathParser","pathString","parsePathString","pathInput","polygonArea","polygon","n","a","b","area","distanceSquareRoot","polygonLength","length","point","Z","z","s","e","p","$","E","P","y","g","r","l","m","h","c","f","w","o","d","A","M","X","O","x","Y","F","T","k","I","v","R","D","N","paramsParser","iterate","iterator","params","pathLen","segment","iteratorResult","seglen","absolutizeSegment","values","absCommand","absValues","j","normalizeSegment","px1","py1","px2","py2","x1","y1","qx","qy","nqx","nqy","midPoint","t","ax","ay","bx","by","getLineLength","x2","y2","getPointAtLineLength","distance","getLineBBox","min","ellipticalArcLength","rx","ry","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcLength","arc","cx","cy","alpha","cos","sin","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","RX","RY","angle","LAF","SF","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","extremes","tan","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","ZERO","Tvalues","Cvalues","derive","points","dpoints","list","compute","order","mt","mt2","t2","arcfn","derivativeFn","lengthFn","len","sum","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","minmaxC","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","getPathBBox","mx","my","MIN","MAX","seg","absoluteSegment","normalSegment","width","height","rotateVector","rad","arcToCubic","X1","Y1","X2","Y2","recursive","d120","res","xy","f1","f2","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","r13","r23","lineToCubic","segmentToCubic","args","px","py","pathToCurve","absSegment","result","getCubicSegArea","getPathArea","getTotalLength","isM","totalLength","getDrawDirection","DISTANCE_EPSILON","getPointAtLength","POINT","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","normalizePath","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getSegmentOfPoint","getSegmentAtLength","isPointInStroke","isValidPath","isPathArray","lk","isAbsoluteArray","isRelativeArray","pc","isNormalizedArray","isCurveArray","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","roundPath","roundOption","round","pow","pathToString","shapeToPath","replace","doc","description","name","value","splitPath","composite","pi","relCommand","isRelative","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","pathToAbsolute","relativizeSegment","relValues","pathToRelative","resultedCommand","shortenSegment","prevCommand","round4","segmentValues","normalValues","optimizePath","allPathCommands","absolutePath","relativePath","reverseCurve","rotatedCurve","curveOnly","_","reversePath","isClosed","reversedPath","prevSeg","nextSeg","pLen","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","transformPath","lx","ly","jj","nx","ny","transformParams","transformProps","matrixInstance","isLongArc","normalizedSegment","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField"],"mappings":";;;AAGA,MAAMA,KAA0B;AAAA,EAC9B,QAAQ,CAAC,GAAG,GAAG,CAAC;AAAA,EAChB,OAAO;AACT,GCNMC,IAAQ,0BCCRC,KAAc;AAAA,EAClB,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,GCJMC,KAAkB,CAACC,MAAqB;AAC5C,MAAIC,IAAcD,EAAK,UAAUA,EAAK,YAAY,GAC9CE,IAAKD,EAAY;AACf,QAAA,EAAE,MAAAE,EAAS,IAAAH;AAEjB,SAAOG,EAAK,UAAUL,GAAYI,CAAE,MAG9BA,MAAO,OAAOC,EAAK,SAAS,KACzBH,EAAA,SAAS,KAAK,CAACC,G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BAAiBrD,KAC/B+D,EAnCIV,GAmCU,eAAclJ,KAC5B4J,EApCIV,GAoCU,gBAAe/E;","x_google_ignoreList":[20]} \ No newline at end of file +{"version":3,"file":"svg-path-commander.mjs","sources":["../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/options/options.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/error.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/process/absolutizeSegment.ts","../src/process/iterate.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/math/midPoint.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/process/normalizeSegment.ts","../src/parser/paramsParser.ts","../src/convert/pathToCurve.ts","../src/math/roundTo.ts","../src/convert/pathToString.ts","../src/math/distanceSquareRoot.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/util/distanceEpsilon.ts","../src/process/normalizePath.ts","../src/util/getPointAtLength.ts","../src/util/getTotalLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getPathArea.ts","../src/util/getDrawDirection.ts","../src/util/getPathBBox.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/util/shapeToPath.ts","../src/process/getSVGMatrix.ts","../src/process/shortenSegment.ts","../src/process/roundSegment.ts","../src/process/optimizePath.ts","../src/process/projection2d.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/roundPath.ts","../src/process/splitCubic.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/index.ts"],"sourcesContent":["var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let relativeCommand = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[relativeCommand]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (relativeCommand === 'm' && data.length > 2) {\n path.segments.push([pathCommand as PathCommand | number].concat(data.splice(0, 2) as number[]) as PathSegment);\n relativeCommand = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push(\n [pathCommand as PathCommand | number].concat(\n data.splice(0, paramsCount[relativeCommand]) as number[],\n ) as PathSegment,\n );\n }\n\n if (!paramsCount[relativeCommand]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: (string | number)[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | T) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as typeof pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n LSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isAbsolute) return segment as MSegment | AbsoluteSegment;\n // const values = segment.slice(1) as number[];\n if (absCommand === 'A') {\n return [\n absCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as ASegment)[6] + lastX,\n (segment as ASegment)[7] + lastY,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, (segment as VSegment)[1] + lastY] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, (segment as HSegment)[1] + lastX] as HSegment;\n } else if (absCommand === 'L') {\n return [absCommand, (segment as LSegment)[1] + lastX, (segment as LSegment)[2] + lastY] as LSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = (segment.slice(1) as number[]).map((n, j) => n + (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [absCommand as typeof absCommand | number].concat(absValues) as\n | MSegment\n | QSegment\n | TSegment\n | SSegment\n | CSegment;\n }\n};\nexport default absolutizeSegment;\n","// import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback, AbsoluteCommand } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n let absCommand = 'M' as AbsoluteCommand;\n let isRelative = false;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let segLen = 0;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n segLen = segment.length;\n absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n isRelative = absCommand !== pathCommand;\n\n const iteratorResult = iterator(segment, i, x, y);\n // some methods like getPointAtLength would like to break\n // when task is complete\n if (iteratorResult === false) {\n break;\n }\n\n // segment = path[i];\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n x = (segment[1] as number) + (isRelative ? x : 0);\n } else if (absCommand === 'V') {\n y = (segment[1] as number) + (isRelative ? y : 0);\n } else {\n x = (segment[segLen - 2] as number) + (isRelative ? x : 0);\n y = (segment[segLen - 1] as number) + (isRelative ? y : 0);\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n if (iteratorResult) {\n path[i] = iteratorResult;\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n }\n }\n return path as T;\n};\n\nexport default iterate;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n\n return iterate(path, absolutizeSegment);\n};\nexport default pathToAbsolute;\n","import type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n MSegment,\n lSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the relative segment\n */\nconst relativizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isRelative) return segment as MSegment | RelativeSegment;\n\n if (relCommand === 'a') {\n return [\n relCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as aSegment)[6] - lastX,\n (segment as aSegment)[7] - lastY,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, (segment as vSegment)[1] - lastY] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, (segment as hSegment)[1] - lastX] as hSegment;\n } else if (relCommand === 'l') {\n return [relCommand, (segment as lSegment)[1] - lastX, (segment as lSegment)[2] - lastY] as lSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = (segment.slice(1) as number[]).map((n, j) => n - (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [relCommand as RelativeCommand | number].concat(relValues) as qSegment | tSegment | sSegment | cSegment;\n }\n};\n\nexport default relativizeSegment;\n","import type { PathArray, RelativeArray } from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n const path = parsePathString(pathInput);\n\n return iterate(path, relativizeSegment);\n};\nexport default pathToRelative;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const { sin, cos } = Math;\n const X = x * cos(rad) - y * sin(rad);\n const Y = x * sin(rad) + y * cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n }\n res = [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [c1[0], c1[1], c2[0], c2[1], x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n // let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n return ['C' as string | number].concat(\n arcToCubic(px1, py1, values[0], values[1], values[2], values[3], values[4], values[5], values[6]),\n ) as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n return ['C' as string | number].concat(\n quadToCubic(px1, py1, values[0], values[1], values[2], values[3]),\n ) as CSegment;\n } else if (pathCommand === 'L') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, x, y)) as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, px, py)) as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import type { ParserParams } from '../interface';\nimport type {\n NormalSegment,\n PointTuple,\n PathSegment,\n QSegment,\n CSegment,\n LSegment,\n MSegment,\n HSegment,\n VSegment,\n ASegment,\n PathCommand,\n} from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the normalization parameters\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = pathCommand !== absCommand;\n const { x1: px1, y1: py1, x2: px2, y2: py2, x, y } = params;\n const values = segment.slice(1) as number[];\n let absValues = values.map((n, j) => n + (isRelative ? (j % 2 ? y : x) : 0));\n\n if (!'TQ'.includes(absCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n // istanbul ignore else @preserve\n if (absCommand === 'A') {\n absValues = values.slice(0, -2).concat(values[5] + (isRelative ? x : 0), values[6] + (isRelative ? y : 0));\n\n return ['A' as PathCommand | number].concat(absValues) as ASegment;\n } else if (absCommand === 'H') {\n return ['L', (segment as HSegment)[1] + (isRelative ? x : 0), py1] as LSegment;\n } else if (absCommand === 'V') {\n return ['L', px1, (segment as VSegment)[1] + (isRelative ? y : 0)] as LSegment;\n } else if (absCommand === 'L') {\n return [\n 'L',\n (segment as LSegment)[1] + (isRelative ? x : 0),\n (segment as LSegment)[2] + (isRelative ? y : 0),\n ] as LSegment;\n } else if (absCommand === 'M') {\n return [\n 'M',\n (segment as MSegment)[1] + (isRelative ? x : 0),\n (segment as MSegment)[2] + (isRelative ? y : 0),\n ] as MSegment;\n } else if (absCommand === 'C') {\n return ['C' as PathCommand | number].concat(absValues) as CSegment;\n } else if (absCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1].concat(absValues) as CSegment;\n } else if (absCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy].concat(absValues) as QSegment;\n } else if (absCommand === 'Q') {\n const [nqx, nqy] = absValues as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n return ['Q' as PathCommand | number].concat(absValues) as QSegment;\n } else if (absCommand === 'Z') {\n return ['Z'] as NormalSegment;\n }\n\n // istanbul ignore next @preserve\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n const params = { ...paramsParser };\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, index, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as AbsoluteCommand | number].concat(result.slice(7)) as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default pathToCurve;\n","const roundTo = (n: number, round: number) => {\n const pow = round >= 1 ? 10 ** round : 1;\n\n return round > 0 ? Math.round(n * pow) / pow : Math.round(n);\n};\n\nexport default roundTo;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport roundTo from '../math/roundTo';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param roundOption amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, roundOption?: number | 'off'): string => {\n const pathLen = path.length;\n let { round } = defaultOptions;\n let segment = path[0] as PathSegment;\n let result = '';\n\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n const [pathCommand] = segment;\n const values = segment.slice(1) as number[];\n result += pathCommand;\n if (round === 'off') {\n result += values.join(' ');\n } else {\n let j = 0;\n const valLen = values.length;\n while (j < valLen) {\n result += roundTo(values[j], round);\n if (j !== valLen - 1) result += ' ';\n j += 1;\n }\n }\n }\n\n return result;\n};\n\nexport default pathToString;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple) => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nconst getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nconst getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nconst getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n\nexport { getPointAtLineLength, getLineBBox, getLineLength };\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst arcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const length = Math.sqrt(term1 + term2) * theta;\n return Math.abs(length);\n};\n\n/**\n * Find point on ellipse at given angle around ellipse (theta);\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the arc rotation angle in radians\n * @param theta the arc sweep angle in radians\n * @returns a point around ellipse at given angle\n */\nconst arcPoint = (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => {\n const { sin, cos } = Math;\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cosA = cos(alpha);\n const sinA = sin(alpha);\n const x = rx * cos(theta);\n const y = ry * sin(theta);\n\n return {\n x: cx + cosA * x - sinA * y,\n y: cy + sinA * x + cosA * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle in radian\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n return sign * Math.acos(p / n);\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle,\n * end angle, and radiuses on X and Y axis.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n // istanbul ignore next @preserve\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x: (x + x1) / 2, y: (y + y1) / 2 },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nconst getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return arcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nconst getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = arcLength(rx, ry, endAngle - startAngle);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the extrema for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nconst getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n const { min, max, tan, atan2, PI } = Math;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const { x: cx, y: cy } = center;\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * PI) / 180;\n const tangent = tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = atan2(-ry * tangent, rx);\n const angle1 = theta;\n const angle2 = theta + PI;\n const angle3 = atan2(ry, rx * tangent);\n const angle4 = angle3 + PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = min(...xArr);\n const xMax = max(...xArr);\n const yMin = min(...yArr);\n const yMax = max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arcPoint(cx, cy, rx, ry, alpha, angleAfterStart);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arcPoint(cx, cy, rx, ry, alpha, angleBeforeEnd);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle1));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle2));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle4));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle3));\n }\n\n return {\n min: {\n x: min(...extremes.map(n => n.x)),\n y: min(...extremes.map(n => n.y)),\n },\n max: {\n x: max(...extremes.map(n => n.x)),\n y: max(...extremes.map(n => n.y)),\n },\n };\n};\n\nexport { arcPoint, angleBetween, getArcLength, arcLength, getArcBBox, getArcProps, getPointAtArcLength };\n\nexport {};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst deriveBezier = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst computeBezier = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], { x: 0, y: 0 } as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst calculateBezier = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst bezierLength = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * calculateBezier(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nconst getBezierLength = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = deriveBezier(points);\n return bezierLength((t: number) => {\n return computeBezier(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A an array which consist of X/Y values\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nconst minmaxQ = ([v1, cp, v2]: [number, number, number]) => {\n const min = Math.min(v1, v2);\n const max = Math.max(v1, v2);\n\n /* istanbul ignore next @preserve */\n if (cp >= v1 ? v2 >= cp : v2 <= cp) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (v1 * v2 - cp * cp) / (v1 - 2 * cp + v2);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A an array which consist of X/Y values\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nconst minmaxC = ([v1, cp1, cp2, v2]: [number, number, number, number]) => {\n const K = v1 - 3 * cp1 + 3 * cp2 - v2;\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (v1 === v2 && v1 === cp1) {\n // no curve, point targeting same location\n return [v1, v2] as PointTuple;\n }\n\n return minmaxQ([v1, -0.5 * v1 + 1.5 * cp1, v1 - 3 * cp1 + 3 * cp2]);\n }\n\n // the reduced discriminant of the derivative\n const T = -v1 * cp2 + v1 * v2 - cp1 * cp2 - cp1 * v2 + cp1 * cp1 + cp2 * cp2;\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(v1, v2), Math.max(v1, v2)] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(v1, v2);\n let max = Math.max(v1, v2);\n\n const L = v1 - 2 * cp1 + cp2;\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n v1 * (1 - R) * (1 - R) * (1 - R) + cp1 * 3 * (1 - R) * (1 - R) * R + cp2 * 3 * (1 - R) * R * R + v2 * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n\nexport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n};\n","import { getBezierLength, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nconst getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nconst getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nconst getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n","import { getBezierLength, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nconst getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return getBezierLength([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nconst getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n","import distanceSquareRoot from './distanceSquareRoot';\nimport { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]) => {\n const n = polygon.length;\n let i = -1;\n let a: PointTuple;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]) => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport { polygonArea, polygonLength };\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import normalizeSegment from './normalizeSegment';\nimport type { NormalArray, PathArray } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Normalizes a `pathArray` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n return iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default normalizePath;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport type { MSegment, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = normalizePath(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber || distance < DISTANCE_EPSILON) return point;\n\n // for (let i = 0; i < pathLen; i += 1) {\n iterate(path, (seg, _, lastX, lastY) => {\n [pathCommand] = seg;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(seg.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(data[0], data[1], data[2], data[3], distance - totalLength);\n length = getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n data[8],\n distance - totalLength,\n );\n length = getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n distance - totalLength,\n );\n length = getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(data[0], data[1], data[2], data[3], data[4], data[5], distance - totalLength);\n length = getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n point = { x: mx, y: my };\n\n length = getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n [x, y] = data.slice(-2);\n\n if (totalLength < distance) {\n POINT = point;\n } else {\n // totalLength >= distance\n // stop right here\n // stop iterator now!\n return false;\n }\n\n totalLength += length;\n return;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n return { x, y };\n }\n\n return POINT;\n};\n\nexport default getPointAtLength;\n","import type { MSegment, PathArray } from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\n// import normalizePath from '../process/normalizePath';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(normalSegment.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n const seglen = normalSegment.length;\n params.x1 = +normalSegment[seglen - 2];\n params.y1 = +normalSegment[seglen - 1];\n params.x2 = +normalSegment[seglen - 4] || params.x1;\n params.y2 = +normalSegment[seglen - 3] || params.y1;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import type { PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n segment = pathArray[index];\n return {\n segment,\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import type { PathArray, Point } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: Point): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(normalPath);\n const distanceTo = (p: Point) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: Point;\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, seg[1], seg[2], seg[3], seg[4], seg[5], seg[6]);\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport { MSegment, PathArray, Point } from '../types';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n const x = 0;\n const y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n const params = { ...paramsParser };\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n [pathCommand] = result;\n data = [lastX, lastY].concat(result.slice(1) as number[]);\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = result as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(data[0], data[1], data[2], data[3], data[4], data[5]));\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import defaultOptions from '../options/options';\nimport type { ParserParams } from '../interface';\nimport roundTo from '../math/roundTo';\nimport type { AbsoluteSegment, NormalSegment, PathCommand, ShortSegment, SSegment, TSegment } from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const { round: defaultRound } = defaultOptions;\n const round = typeof defaultRound === 'number' ? defaultRound : /* istanbul ignore next */ 4;\n const normalValues = normalSegment.slice(1) as number[];\n const { x1, y1, x2, y2, x, y } = params;\n const [nx, ny] = normalValues.slice(-2);\n const result = segment;\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'L') {\n if (roundTo(x, round) === roundTo(nx, round)) {\n return ['V', ny];\n } else if (roundTo(y, round) === roundTo(ny, round)) {\n return ['H', nx];\n }\n } else if (pathCommand === 'C') {\n const [nx1, ny1] = normalValues;\n params.x1 = nx1;\n params.y1 = ny1;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((roundTo(nx1, round) === roundTo(x1 * 2 - x2, round) && roundTo(ny1, round) === roundTo(y1 * 2 - y2, round)) ||\n (roundTo(x1, round) === roundTo(x2 * 2 - x, round) && roundTo(y1, round) === roundTo(y2 * 2 - y, round)))\n ) {\n return ['S', normalValues[2], normalValues[3], normalValues[4], normalValues[5]] as SSegment;\n }\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n roundTo(qx, round) === roundTo(x1 * 2 - x2, round) &&\n roundTo(qy, round) === roundTo(y1 * 2 - y2, round)\n ) {\n return ['T', normalValues[2], normalValues[3]] as TSegment;\n }\n }\n\n // ['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)\n return result as ShortSegment;\n};\n\nexport default shortenSegment;\n","import type { PathCommand, PathSegment } from '../types';\nimport roundTo from '../math/roundTo';\n\nconst roundSegment = (segment: T, roundOption: number) => {\n const values = (segment.slice(1) as number[]).map(n => roundTo(n, roundOption));\n return [segment[0] as PathCommand | number].concat(values) as T;\n};\n\nexport default roundSegment;\n","import pathToAbsolute from '../convert/pathToAbsolute';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport type { AbsoluteSegment, PathArray, PathCommand } from '../types';\nimport iterate from './iterate';\nimport normalizeSegment from './normalizeSegment';\nimport relativizeSegment from './relativizeSegment';\nimport roundSegment from './roundSegment';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param roundOption the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, roundOption: number) => {\n const path = pathToAbsolute(pathInput);\n // allow for ZERO decimals or use an aggressive value of 2\n const round =\n typeof roundOption === 'number' && roundOption >= 0 ? roundOption : /* istanbul ignore next @preserve */ 2;\n // this utility overrides the iterator params\n const optimParams = { ...paramsParser };\n\n const allPathCommands = [] as PathCommand[];\n let pathCommand = 'M' as PathCommand;\n let prevCommand = 'Z' as PathCommand;\n\n return iterate(path, (seg, i, lastX, lastY) => {\n optimParams.x = lastX;\n optimParams.y = lastY;\n // const absoluteSegment = absolutizeSegment(seg, optimParams);\n const normalizedSegment = normalizeSegment(seg, optimParams);\n let result = seg;\n [pathCommand] = seg;\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n if (i) {\n // Get previous path command for `shortenSegment`\n prevCommand = allPathCommands[i - 1];\n const shortSegment = shortenSegment(seg as AbsoluteSegment, normalizedSegment, optimParams, prevCommand);\n const absSegment = roundSegment(shortSegment, round);\n const absString = absSegment.join('');\n const relativeSegment = relativizeSegment(shortSegment, i, lastX, lastY);\n const relSegment = roundSegment(relativeSegment, round);\n const relString = relSegment.join('');\n result = absString.length < relString.length ? absSegment : relSegment;\n }\n\n const seglen = normalizedSegment.length;\n optimParams.x1 = +normalizedSegment[seglen - 2];\n optimParams.y1 = +normalizedSegment[seglen - 1];\n optimParams.x2 = +normalizedSegment[seglen - 4] || optimParams.x1;\n optimParams.y2 = +normalizedSegment[seglen - 3] || optimParams.y1;\n\n return result;\n });\n};\n\nexport default optimizePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(v[0], v[1], v[2]);\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [point2D[0], point2D[1], 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import type { CSegment, CurveArray, MSegment, PathCommand } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray) => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? path[0].slice(1).concat(x.slice(1) as number[]) : curveOnly[i - 1].slice(-2).concat(x.slice(1)),\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse() as (MSegment | CSegment)[];\n\n return [['M' as PathCommand | number].concat(rotatedCurve[0].slice(0, 2))].concat(\n rotatedCurve.map(x => ['C' as PathCommand | number].concat(x.slice(2))),\n ) as CurveArray;\n};\n\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n PointTuple,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\nimport iterate from './iterate';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance\n * with absolute values.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray) => {\n const absolutePath = pathToAbsolute(pathInput);\n const normalizedPath = normalizePath(absolutePath);\n const pLen = absolutePath.length;\n const isClosed = absolutePath[pLen - 1][0] === 'Z';\n\n const reversedPath = iterate(absolutePath, (segment, i) => {\n const normalizedSegment = normalizedPath[i];\n const prevSeg = i && absolutePath[i - 1];\n const prevCommand = prevSeg && prevSeg[0];\n const nextSeg = absolutePath[i + 1];\n const nextCommand = nextSeg && nextSeg[0];\n const [pathCommand] = segment;\n const [x, y] = normalizedPath[i ? i - 1 : pLen - 1].slice(-2) as PointTuple;\n let result = segment;\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [\n pathCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5] === 1 ? 0 : 1,\n x,\n y,\n ] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextCommand === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevCommand && 'CS'.includes(prevCommand) && (!nextSeg || nextCommand !== 'S')) {\n result = [\n 'C',\n normalizedSegment[3],\n normalizedSegment[4],\n normalizedSegment[1],\n normalizedSegment[2],\n x,\n y,\n ] as CSegment;\n } else {\n result = [pathCommand, normalizedSegment[1], normalizedSegment[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextCommand === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, segment[1], segment[2], x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevCommand && 'QT'.includes(prevCommand) && (!nextSeg || nextCommand !== 'T')) {\n result = ['Q', normalizedSegment[1], normalizedSegment[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand as typeof pathCommand | number].concat(segment.slice(1, -2), x, y) as PathSegment;\n }\n\n return result;\n });\n\n return (\n isClosed ? reversedPath.reverse() : [reversedPath[0] as PathSegment].concat(reversedPath.slice(1).reverse())\n ) as PathArray;\n};\n\nexport default reversePath;\n","import type { PathArray } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\nimport roundSegment from './roundSegment';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n /* istanbul ignore else @preserve */\n if (round === 'off') return path.slice(0) as PathArray;\n\n return iterate(path, segment => {\n return roundSegment(segment, round);\n });\n};\nexport default roundPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', p4[0], p4[1], p7[0], p7[1], p9[0], p9[1]],\n ['C', p8[0], p8[1], p6[0], p6[1], p3[0], p3[1]],\n ];\n};\nexport default splitCubic;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, AbsoluteSegment, CSegment, LSegment, PathArray, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n // last x and y transformed values\n let x = 0;\n let y = 0;\n // new x and y transformed\n let lx = 0;\n let ly = 0;\n // segment params iteration index and length\n let j = 0;\n let jj = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path.slice(0) as typeof path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path.slice(0) as typeof path;\n\n return iterate(path, (seg, index, lastX, lastY) => {\n transformParams.x = lastX;\n transformParams.y = lastY;\n [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = absCommand !== pathCommand;\n const absoluteSegment = isRelative\n ? absolutizeSegment(seg, index, lastX, lastY)\n : (seg.slice(0) as AbsoluteSegment);\n\n let result =\n absCommand === 'A'\n ? segmentToCubic(absoluteSegment, transformParams)\n : ['V', 'H'].includes(absCommand)\n ? normalizeSegment(absoluteSegment, transformParams)\n : absoluteSegment;\n\n // update pathCommand\n pathCommand = result[0];\n const isLongArc = pathCommand === 'C' && result.length > 7;\n const tempSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as AbsoluteSegment;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as typeof pathCommand | number].concat(result.slice(7)) as CSegment);\n result = tempSegment as CSegment;\n }\n\n if (pathCommand === 'L') {\n [lx, ly] = projection2d(matrixInstance, [(result as LSegment)[1], (result as LSegment)[2]], origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n const seglen = tempSegment.length;\n transformParams.x1 = +tempSegment[seglen - 2];\n transformParams.y1 = +tempSegment[seglen - 1];\n transformParams.x2 = +tempSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +tempSegment[seglen - 3] || transformParams.y1;\n\n return result;\n });\n};\n\nexport default transformPath;\n","'use strict';\nimport CSSMatrix from '@thednp/dommatrix';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\nimport * as arcTools from './math/arcTools';\nimport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n} from './math/bezier';\nimport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools';\nimport { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools';\nimport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools';\nimport { polygonArea, polygonLength } from './math/polygonTools';\n\nimport distanceSquareRoot from './math/distanceSquareRoot';\nimport midPoint from './math/midPoint';\nimport rotateVector from './math/rotateVector';\nimport roundTo from './math/roundTo';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\nimport finalizeSegment from './parser/finalizeSegment';\nimport invalidPathValue from './parser/invalidPathValue';\nimport isArcCommand from './parser/isArcCommand';\nimport isDigit from './parser/isDigit';\nimport isDigitStart from './parser/isDigitStart';\nimport isMoveCommand from './parser/isMoveCommand';\nimport isPathCommand from './parser/isPathCommand';\nimport isSpace from './parser/isSpace';\nimport paramsCount from './parser/paramsCount';\nimport paramsParser from './parser/paramsParser';\nimport pathParser from './parser/pathParser';\nimport scanFlag from './parser/scanFlag';\nimport scanParam from './parser/scanParam';\nimport scanSegment from './parser/scanSegment';\nimport skipSpaces from './parser/skipSpaces';\n\nimport distanceEpsilon from './util/distanceEpsilon';\nimport getClosestPoint from './util/getClosestPoint';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPathArea from './util/getPathArea';\nimport getPathBBox from './util/getPathBBox';\nimport getPointAtLength from './util/getPointAtLength';\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getTotalLength from './util/getTotalLength';\n\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport isPathArray from './util/isPathArray';\nimport isPointInStroke from './util/isPointInStroke';\nimport isRelativeArray from './util/isRelativeArray';\nimport isValidPath from './util/isValidPath';\nimport shapeParams from './util/shapeParams';\nimport shapeToPath from './util/shapeToPath';\nimport shapeToPathArray from './util/shapeToPathArray';\n\nimport absolutizeSegment from './process/absolutizeSegment';\nimport arcToCubic from './process/arcToCubic';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport iterate from './process/iterate';\nimport lineToCubic from './process/lineToCubic';\nimport normalizePath from './process/normalizePath';\nimport normalizeSegment from './process/normalizeSegment';\nimport optimizePath from './process/optimizePath';\nimport projection2d from './process/projection2d';\nimport quadToCubic from './process/quadToCubic';\nimport relativizeSegment from './process/relativizeSegment';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport roundPath from './process/roundPath';\nimport roundSegment from './process/roundSegment';\nimport segmentToCubic from './process/segmentToCubic';\nimport shortenSegment from './process/shortenSegment';\nimport splitCubic from './process/splitCubic';\nimport splitPath from './process/splitPath';\nimport transformPath from './process/transformPath';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n public static arcTools = arcTools;\n public static bezierTools = {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n };\n public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength };\n public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n public static polygonTools = { polygonArea, polygonLength };\n public static distanceSquareRoot = distanceSquareRoot;\n public static distanceEpsilon = distanceEpsilon;\n public static midPoint = midPoint;\n public static rotateVector = rotateVector;\n public static roundTo = roundTo;\n public static finalizeSegment = finalizeSegment;\n public static invalidPathValue = invalidPathValue;\n public static isArcCommand = isArcCommand;\n public static isDigit = isDigit;\n public static isDigitStart = isDigitStart;\n public static isMoveCommand = isMoveCommand;\n public static isPathCommand = isPathCommand;\n public static isSpace = isSpace;\n public static paramsCount = paramsCount;\n public static paramsParser = paramsParser;\n public static pathParser = pathParser;\n public static scanFlag = scanFlag;\n public static scanParam = scanParam;\n public static scanSegment = scanSegment;\n public static skipSpaces = skipSpaces;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static shapeParams = shapeParams;\n public static parsePathString = parsePathString;\n public static absolutizeSegment = absolutizeSegment;\n public static arcToCubic = arcToCubic;\n public static getSVGMatrix = getSVGMatrix;\n public static iterate = iterate;\n public static lineToCubic = lineToCubic;\n public static normalizePath = normalizePath;\n public static normalizeSegment = normalizeSegment;\n public static optimizePath = optimizePath;\n public static projection2d = projection2d;\n public static quadToCubic = quadToCubic;\n public static relativizeSegment = relativizeSegment;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static roundPath = roundPath;\n public static roundSegment = roundSegment;\n public static segmentToCubic = segmentToCubic;\n public static shortenSegment = shortenSegment;\n public static splitCubic = splitCubic;\n public static splitPath = splitPath;\n public static transformPath = transformPath;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n this.segments = parsePathString(pathValue);\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n const round = this.round === 'off' ? 2 : this.round;\n\n this.segments = optimizePath(segments, round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["Z","z","s","e","p","$","E","P","y","g","n","i","r","a","l","m","h","c","u","w","o","d","A","M","b","X","O","x","Y","F","T","k","I","v","R","D","N","defaultOptions","paramsCount","finalizeSegment","path","pathCommand","relativeCommand","data","error","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","_a","segments","cmdCode","reqParams","paramCounts","lastSegment","PathParser","pathString","parsePathString","pathInput","absolutizeSegment","segment","lastX","lastY","absCommand","absValues","j","iterate","iterator","pathLen","isRelative","mx","my","segLen","iteratorResult","pathToAbsolute","relativizeSegment","relCommand","relValues","pathToRelative","rotateVector","rad","sin","cos","arcToCubic","X1","Y1","RX","RY","angle","LAF","SF","X2","Y2","recursive","x1","y1","rx","ry","x2","y2","d120","res","xy","f1","f2","cx","cy","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","t","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","qx","qy","r13","r23","midPoint","ax","ay","bx","by","lineToCubic","segmentToCubic","params","values","px1","py1","px","py","normalizeSegment","px2","py2","nqx","nqy","paramsParser","pathToCurve","seg","normalSegment","result","seglen","roundTo","round","pow","pathToString","roundOption","valLen","distanceSquareRoot","getLineLength","getPointAtLineLength","distance","point","length","getLineBBox","min","arcLength","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcPoint","alpha","cosA","sinA","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","tan","atan2","extremes","tangent","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","Tvalues","Cvalues","deriveBezier","points","dpoints","list","computeBezier","order","mt","mt2","t2","calculateBezier","derivativeFn","bezierLength","len","sum","getBezierLength","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","cp","v2","minmaxC","cp1","cp2","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","polygonArea","polygon","area","polygonLength","DISTANCE_EPSILON","normalizePath","_","getPointAtLength","isM","POINT","totalLength","getTotalLength","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getCubicSegArea","getPathArea","getDrawDirection","getPathBBox","MIN","MAX","width","height","getSegmentAtLength","getSegmentOfPoint","isPathArray","lk","isAbsoluteArray","isNormalizedArray","pc","isCurveArray","isPointInStroke","isRelativeArray","isValidPath","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","shapeToPath","replace","doc","description","name","value","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","shortenSegment","prevCommand","defaultRound","normalValues","nx","ny","nx1","ny1","roundSegment","optimizePath","optimParams","allPathCommands","normalizedSegment","shortSegment","absSegment","absString","relativeSegment","relSegment","relString","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","reverseCurve","rotatedCurve","curveOnly","reversePath","absolutePath","normalizedPath","pLen","isClosed","reversedPath","prevSeg","nextSeg","nextCommand","roundPath","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","splitPath","composite","pi","transformPath","lx","ly","jj","transformParams","transformProps","matrixInstance","absoluteSegment","isLongArc","tempSegment","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField","arcTools","distanceEpsilon","pathParser"],"mappings":";;;AAAA,IAAIA,KAAI,OAAO,gBACXC,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EIV,GAkEU,gBAAe7E,KAC7BuF,EAnEIV,GAmEU,WAAU9W,IACxBwX,EApEIV,GAoEU,eAAcxS,KAC5BkT,EArEIV,GAqEU,iBAAgBpJ,KAC9B8J,EAtEIV,GAsEU,oBAAmBhS,IACjC0S,EAvEIV,GAuEU,gBAAezD,KAC7BmE,EAxEIV,GAwEU,gBAAe7C,KAC7BuD,EAzEIV,GAyEU,eAAclT,KAC5B4T,EA1EIV,GA0EU,qBAAoBrW,KAClC+W,EA3EIV,GA2EU,gBAAevC,KAC7BiD,EA5EIV,GA4EU,eAAcpC,KAC5B8C,EA7EIV,GA6EU,aAAY3B,KAC1BqC,EA9EIV,GA8EU,gBAAe1D,KAC7BoE,EA/EIV,GA+EU,kBAAiBvS,KAC/BiT,EAhFIV,GAgFU,kBAAiBlE,KAC/B4E,EAjFIV,GAiFU,cAAa1B,KAC3BoC,EAlFIV,GAkFU,aAAYb,KAC1BuB,EAnFIV,GAmFU,iBAAgBV;","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/docs/svg-path-commander.js b/docs/svg-path-commander.js index 58cdc7c..c7372f0 100644 --- a/docs/svg-path-commander.js +++ b/docs/svg-path-commander.js @@ -1,2 +1,2 @@ -var SVGPathCommander=function(){"use strict";var on=Object.defineProperty;var cn=(z,L,j)=>L in z?on(z,L,{enumerable:!0,configurable:!0,writable:!0,value:j}):z[L]=j;var A=(z,L,j)=>cn(z,typeof L!="symbol"?L+"":L,j);const z={origin:[0,0,0],round:4},L="SVGPathCommander Error",j={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},St=e=>{let t=e.pathValue[e.segmentStart],n=t.toLowerCase();const{data:r}=e;for(;r.length>=j[n]&&(n==="m"&&r.length>2?(e.segments.push([t,...r.splice(0,2)]),n="l",t=t==="m"?"l":"L"):e.segments.push([t,...r.splice(0,j[n])]),!!j[n]););},he=e=>{const{index:t,pathValue:n}=e,r=n.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${L}: invalid Arc flag "${n[t]}", expecting 0 or 1 at index ${t}`},Y=e=>e>=48&&e<=57,H="Invalid path value",fe=e=>{const{max:t,pathValue:n,index:r}=e;let s=r,i=!1,o=!1,c=!1,l=!1,a;if(s>=t){e.err=`${L}: ${H} at index ${s}, "pathValue" is missing param`;return}if(a=n.charCodeAt(s),(a===43||a===45)&&(s+=1,a=n.charCodeAt(s)),!Y(a)&&a!==46){e.err=`${L}: ${H} at index ${s}, "${n[s]}" is not a number`;return}if(a!==46){if(i=a===48,s+=1,a=n.charCodeAt(s),i&&s[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),nt=e=>{const{pathValue:t,max:n}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},xe=e=>Y(e)||e===43||e===45||e===46,pe=e=>(e|32)===97,de=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},$t=e=>{var l;const{max:t,pathValue:n,index:r,segments:s}=e,i=n.charCodeAt(r),o=j[n[r].toLowerCase()];if(e.segmentStart=r,!ge(i)){e.err=`${L}: ${H} "${n[r]}" is not a path command at index ${r}`;return}const c=s[s.length-1];if(!de(i)&&((l=c==null?void 0:c[0])==null?void 0:l.toLocaleLowerCase())==="z"){e.err=`${L}: ${H} "${n[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,nt(e),e.data=[],!o){St(e);return}for(;;){for(let a=o;a>0;a-=1){if(pe(i)&&(a===3||a===4)?he(e):fe(e),e.err.length)return;e.data.push(e.param),nt(e),e.index=e.max||!xe(n.charCodeAt(e.index)))break}St(e)};class kt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const I=e=>{if(typeof e!="string")return e.slice(0);const t=new kt(e);for(nt(t);t.index{const t=e.length;let n=-1,r,s=e[t-1],i=0;for(;++nMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),be=e=>e.reduce((t,n,r)=>r?t+Mt(e[r-1],n):0,0);var we=Object.defineProperty,Ne=(e,t,n)=>t in e?we(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>Ne(e,typeof t!="symbol"?t+"":t,n);const Ae={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},qt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),It=e=>e instanceof DOMMatrix||e instanceof v||typeof e=="object"&&Object.keys(Ae).every(t=>e&&t in e),st=e=>{const t=new v,n=Array.from(e);if(!qt(n))throw TypeError(`CSSMatrix: "${n.join(",")}" must be an array with 6/16 numbers.`);if(n.length===16){const[r,s,i,o,c,l,a,m,u,g,f,h,y,x,p,d]=n;t.m11=r,t.a=r,t.m21=c,t.c=c,t.m31=u,t.m41=y,t.e=y,t.m12=s,t.b=s,t.m22=l,t.d=l,t.m32=g,t.m42=x,t.f=x,t.m13=i,t.m23=a,t.m33=f,t.m43=p,t.m14=o,t.m24=m,t.m34=h,t.m44=d}else if(n.length===6){const[r,s,i,o,c,l]=n;t.m11=r,t.a=r,t.m12=s,t.b=s,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=c,t.e=c,t.m42=l,t.f=l}return t},Et=e=>{if(It(e))return st([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},zt=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let n=new v;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(s=>s).forEach(s=>{const[i,o]=s.split("(");if(!o)throw TypeError(r);const c=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[l,a,m,u]=c,g=[l,a,m],f=[l,a,m,u];if(i==="perspective"&&l&&[a,m].every(h=>h===void 0))n.m34=-1/l;else if(i.includes("matrix")&&[6,16].includes(c.length)&&c.every(h=>!Number.isNaN(+h))){const h=c.map(y=>Math.abs(y)<1e-6?0:y);n=n.multiply(st(h))}else if(i==="translate3d"&&g.every(h=>!Number.isNaN(+h)))n=n.translate(l,a,m);else if(i==="translate"&&l&&m===void 0)n=n.translate(l,a||0,0);else if(i==="rotate3d"&&f.every(h=>!Number.isNaN(+h))&&u)n=n.rotateAxisAngle(l,a,m,u);else if(i==="rotate"&&l&&[a,m].every(h=>h===void 0))n=n.rotate(0,0,l);else if(i==="scale3d"&&g.every(h=>!Number.isNaN(+h))&&g.some(h=>h!==1))n=n.scale(l,a,m);else if(i==="scale"&&!Number.isNaN(l)&&l!==1&&m===void 0){const h=Number.isNaN(+a)?l:a;n=n.scale(l,h,1)}else if(i==="skew"&&(l||!Number.isNaN(l)&&a)&&m===void 0)n=n.skew(l,a||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&l&&[a,m].every(h=>h===void 0))if(i==="skewX"||i==="skewY")n=n[i](l);else{const h=i.replace(/[XYZ]/,""),y=i.replace(h,""),x=["X","Y","Z"].indexOf(y),p=h==="scale"?1:0,d=[x===0?l:p,x===1?l:p,x===2?l:p];n=n[h](...d)}else throw TypeError(r)}),n},bt=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],Zt=(e,t,n)=>{const r=new v;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=n,r},Ot=(e,t,n)=>{const r=new v,s=Math.PI/180,i=e*s,o=t*s,c=n*s,l=Math.cos(i),a=-Math.sin(i),m=Math.cos(o),u=-Math.sin(o),g=Math.cos(c),f=-Math.sin(c),h=m*g,y=-m*f;r.m11=h,r.a=h,r.m12=y,r.b=y,r.m13=u;const x=a*u*g+l*f;r.m21=x,r.c=x;const p=l*g-a*u*f;return r.m22=p,r.d=p,r.m23=-a*m,r.m31=a*f-l*u*g,r.m32=a*g+l*u*f,r.m33=l*m,r},jt=(e,t,n,r)=>{const s=new v,i=Math.sqrt(e*e+t*t+n*n);if(i===0)return s;const o=e/i,c=t/i,l=n/i,a=r*(Math.PI/360),m=Math.sin(a),u=Math.cos(a),g=m*m,f=o*o,h=c*c,y=l*l,x=1-2*(h+y)*g;s.m11=x,s.a=x;const p=2*(o*c*g+l*m*u);s.m12=p,s.b=p,s.m13=2*(o*l*g-c*m*u);const d=2*(c*o*g-l*m*u);s.m21=d,s.c=d;const C=1-2*(y+f)*g;return s.m22=C,s.d=C,s.m23=2*(c*l*g+o*m*u),s.m31=2*(l*o*g+c*m*u),s.m32=2*(l*c*g-o*m*u),s.m33=1-2*(f+h)*g,s},Rt=(e,t,n)=>{const r=new v;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=n,r},ot=(e,t)=>{const n=new v;if(e){const r=e*Math.PI/180,s=Math.tan(r);n.m21=s,n.c=s}if(t){const r=t*Math.PI/180,s=Math.tan(r);n.m12=s,n.b=s}return n},Dt=e=>ot(e,0),Qt=e=>ot(0,e),D=(e,t)=>{const n=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,s=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,c=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,l=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,a=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,m=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,u=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,g=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,f=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,y=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,x=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,p=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return st([n,r,s,i,o,c,l,a,m,u,g,f,h,y,x,p])};class v{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?zt(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?st(t):typeof t=="object"?Et(t):this}toFloat32Array(t){return Float32Array.from(bt(this,t))}toFloat64Array(t){return Float64Array.from(bt(this,t))}toString(){const{is2D:t}=this,n=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${n})`}toJSON(){const{is2D:t,isIdentity:n}=this;return{...this,is2D:t,isIdentity:n}}multiply(t){return D(this,t)}translate(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),D(this,Zt(s,i,o))}scale(t,n,r){const s=t;let i=n,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),D(this,Rt(s,i,o))}rotate(t,n,r){let s=t,i=n||0,o=r||0;return typeof t=="number"&&typeof n>"u"&&typeof r>"u"&&(o=s,s=0,i=0),D(this,Ot(s,i,o))}rotateAxisAngle(t,n,r,s){if([t,n,r,s].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return D(this,jt(t,n,r,s))}skewX(t){return D(this,Dt(t))}skewY(t){return D(this,Qt(t))}skew(t,n){return D(this,ot(t,n))}transformPoint(t){const n=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,s=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(n,r,s,i):{x:n,y:r,z:s,w:i}}}k(v,"Translate",Zt),k(v,"Rotate",Ot),k(v,"RotateAxisAngle",jt),k(v,"Scale",Rt),k(v,"SkewX",Dt),k(v,"SkewY",Qt),k(v,"Skew",ot),k(v,"Multiply",D),k(v,"fromArray",st),k(v,"fromMatrix",Et),k(v,"fromString",zt),k(v,"toArray",bt),k(v,"isCompatibleArray",qt),k(v,"isCompatibleObject",It);const ct={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},Q=(e,t)=>{const n={...ct};let r=e.length,s;for(let i=0;i{const[n]=e,{x:r,y:s}=t,i=e.slice(1).map(Number),o=n.toUpperCase();if(!(o===n)){if(o==="A")return[o,i[0],i[1],i[2],i[3],i[4],i[5]+r,i[6]+s];if(o==="V")return[o,i[0]+s];if(o==="H")return[o,i[0]+r];{const l=i.map((a,m)=>a+(m%2?s:r));return[o,...l]}}return e},K=(e,t)=>{const[n]=e,{x1:r,y1:s,x2:i,y2:o}=t,c=e.slice(1).map(Number);if("TQ".includes(n)||(t.qx=null,t.qy=null),n==="H")return["L",e[1],s];if(n==="V")return["L",r,e[1]];if(n==="S"){const l=r*2-i,a=s*2-o;return t.x1=l,t.y1=a,["C",l,a,...c]}else if(n==="T"){const l=r*2-(t.qx?t.qx:0),a=s*2-(t.qy?t.qy:0);return t.qx=l,t.qy=a,["Q",l,a,...c]}else if(n==="Q"){const[l,a]=c;t.qx=l,t.qy=a}return e},X=(e,t,n)=>{const[r,s]=e,[i,o]=t;return[r+(i-r)*n,s+(o-s)*n]},lt=(e,t,n,r)=>Mt([e,t],[n,r]),Xt=(e,t,n,r,s)=>{const i=Mt([e,t],[n,r]);let o={x:e,y:t};if(typeof s=="number")if(s<=0)o={x:e,y:t};else if(s>=i)o={x:n,y:r};else{const[c,l]=X([e,t],[n,r],s/i);o={x:c,y:l}}return o},Bt=(e,t,n,r)=>{const{min:s,max:i}=Math;return{min:{x:s(e,n),y:s(t,r)},max:{x:i(e,n),y:i(t,r)}}},Yt=(e,t,n)=>{const r=n/2,s=Math.sin(r),i=Math.cos(r),o=e**2*s**2,c=t**2*i**2,l=Math.sqrt(o+c)*n;return Math.abs(l)},W=(e,t,n,r,s,i)=>{const o=Math.cos(i),c=Math.sin(i),l=r*Math.cos(e),a=s*Math.sin(e);return{x:t+o*l-c*a,y:n+c*l+o*a}},Ht=(e,t)=>{const{x:n,y:r}=e,{x:s,y:i}=t,o=n*s+r*i,c=Math.sqrt((n**2+r**2)*(s**2+i**2));return(n*i-r*s<0?-1:1)*Math.acos(o/c)},wt=(e,t,n,r,s,i,o,c,l)=>{const{abs:a,sin:m,cos:u,sqrt:g,PI:f}=Math;let h=a(n),y=a(r);const p=(s%360+360)%360*(f/180);if(e===c&&t===l)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};if(h===0||y===0)return{rx:h,ry:y,startAngle:0,endAngle:0,center:{x:c,y:l}};const d=(e-c)/2,C=(t-l)/2,M={x:u(p)*d+m(p)*C,y:-m(p)*d+u(p)*C},b=M.x**2/h**2+M.y**2/y**2;b>1&&(h*=g(b),y*=g(b));const N=h**2*y**2-h**2*M.y**2-y**2*M.x**2,S=h**2*M.y**2+y**2*M.x**2;let P=N/S;P=P<0?0:P;const q=(i!==o?1:-1)*g(P),$={x:q*(h*M.y/y),y:q*(-(y*M.x)/h)},tt={x:u(p)*$.x-m(p)*$.y+(e+c)/2,y:m(p)*$.x+u(p)*$.y+(t+l)/2},U={x:(M.x-$.x)/h,y:(M.y-$.y)/y},B=Ht({x:1,y:0},U),V={x:(-M.x-$.x)/h,y:(-M.y-$.y)/y};let E=Ht(U,V);!o&&E>0?E-=2*f:o&&E<0&&(E+=2*f),E%=2*f;const et=B+E;return{center:tt,startAngle:B,endAngle:et,rx:h,ry:y}},Ft=(e,t,n,r,s,i,o,c,l)=>{const{rx:a,ry:m,startAngle:u,endAngle:g}=wt(e,t,n,r,s,i,o,c,l);return Yt(a,m,g-u)},Ce=(e,t,n,r,s,i,o,c,l,a)=>{let m={x:e,y:t};const{center:u,rx:g,ry:f,startAngle:h,endAngle:y}=wt(e,t,n,r,s,i,o,c,l),x=Yt(g,f,y-h);if(typeof a=="number")if(a<=0)m={x:e,y:t};else if(a>=x)m={x:c,y:l};else{if(e===c&&t===l)return{x:c,y:l};if(g===0||f===0)return Xt(e,t,c,l,a);const{PI:p,cos:d,sin:C}=Math,M=y-h,N=(s%360+360)%360*(p/180),S=h+M*(a/x),P=g*d(S),q=f*C(S);m={x:d(N)*P-C(N)*q+u.x,y:C(N)*P+d(N)*q+u.y}}return m},ve=(e,t,n,r,s,i,o,c,l)=>{const{center:a,rx:m,ry:u,startAngle:g,endAngle:f}=wt(e,t,n,r,s,i,o,c,l),h=f-g,y={x:c,y:l},[x,p]=[a.x,a.y],d=[y],C=s*Math.PI/180,M=Math.tan(C),b=Math.atan2(-u*M,m),N=b,S=b+Math.PI,P=Math.atan2(u,m*M),q=P+Math.PI,$=[e,c],tt=[t,l],U=Math.min(...$),B=Math.max(...$),V=Math.min(...tt),E=Math.max(...tt),et=f-h*.001,Z=W(et,x,p,m,u,C),dt=f-h*.999,_=W(dt,x,p,m,u,C);return(Z.x>B||_.x>B)&&d.push(W(N,x,p,m,u,C)),(Z.xE||_.y>E)&&d.push(W(P,x,p,m,u,C)),{min:{x:Math.min(...d.map(R=>R.x)),y:Math.min(...d.map(R=>R.y))},max:{x:Math.max(...d.map(R=>R.x)),y:Math.max(...d.map(R=>R.y))}}},Pe={x:0,y:0},Ut=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],Le=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],Te=e=>{const t=[];for(let n=e,r=n.length,s=r-1;r>1;r-=1,s-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const n=e.length-1;if(t===1)return e[n].t=1,e[n];const r=1-t;let s=e;if(n===0)return e[0].t=t,e[0];if(n===1)return{x:r*s[0].x+t*s[1].x,y:r*s[0].y+t*s[1].y,t};const i=r*r,o=t*t;let c=0,l=0,a=0,m=0;return n===2?(s=[s[0],s[1],s[2],Pe],c=i,l=r*t*2,a=o):n===3&&(c=i*r,l=i*t*3,a=r*o*3,m=t*o),{x:c*s[0].x+l*s[1].x+a*s[2].x+m*s[3].x,y:c*s[0].y+l*s[1].y+a*s[2].y+m*s[3].y,t}},$e=(e,t)=>{const n=e(t),r=n.x*n.x+n.y*n.y;return Math.sqrt(r)},ke=e=>{const n=Ut.length;let r=0;for(let s=0,i;s{const t=[];for(let r=0,s=e.length,i=2;rSe(n[0],r))},qe=1e-8,Nt=e=>{const t=Math.min(e[0],e[2]),n=Math.max(e[0],e[2]);if(e[1]>=e[0]?e[2]>=e[1]:e[2]<=e[1])return[t,n];const r=(e[0]*e[2]-e[1]*e[1])/(e[0]-2*e[1]+e[2]);return r{const t=e[0]-3*e[1]+3*e[2]-e[3];if(Math.abs(t)0&&c<1){const a=e[0]*(1-c)*(1-c)*(1-c)+e[1]*3*(1-c)*(1-c)*c+e[2]*3*(1-c)*c*c+e[3]*c*c*c;ai&&(i=a)}return[s,i]},Ie=([e,t,n,r,s,i,o,c],l)=>{const a=1-l;return{x:a**3*e+3*a**2*l*n+3*a*l**2*s+l**3*o,y:a**3*t+3*a**2*l*r+3*a*l**2*i+l**3*c}},_t=(e,t,n,r,s,i,o,c)=>at([e,t,n,r,s,i,o,c]),Ee=(e,t,n,r,s,i,o,c,l)=>{const a=typeof l=="number";let m={x:e,y:t};if(a){const u=at([e,t,n,r,s,i,o,c]);l<=0||(l>=u?m={x:o,y:c}:m=Ie([e,t,n,r,s,i,o,c],l/u))}return m},ze=(e,t,n,r,s,i,o,c)=>{const l=Vt([e,n,s,o]),a=Vt([t,r,i,c]);return{min:{x:l[0],y:a[0]},max:{x:l[1],y:a[1]}}},Ze=([e,t,n,r,s,i],o)=>{const c=1-o;return{x:c**2*e+2*c*o*n+o**2*s,y:c**2*t+2*c*o*r+o**2*i}},Jt=(e,t,n,r,s,i)=>at([e,t,n,r,s,i]),Oe=(e,t,n,r,s,i,o)=>{const c=typeof o=="number";let l={x:e,y:t};if(c){const a=at([e,t,n,r,s,i]);o<=0||(o>=a?l={x:s,y:i}:l=Ze([e,t,n,r,s,i],o/a))}return l},je=(e,t,n,r,s,i)=>{const o=Nt([e,n,s]),c=Nt([t,r,i]);return{min:{x:o[0],y:c[0]},max:{x:o[1],y:c[1]}}},Kt=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=I(e);let n=[],r="M",s=0,i=0,o=0,c=0;const l=[],a=[];let m={x:s,y:i},u={x:s,y:i};Q(t,(d,C)=>{const M=F(d,C),b=K(M,C);return[r]=b,n=[s,i,...b.slice(1)],r==="M"?([,o,c]=b,m={x:o,y:c},u={x:o,y:c}):r==="L"?{min:m,max:u}=Bt(...n):r==="A"?{min:m,max:u}=ve(...n):r==="C"?{min:m,max:u}=ze(...n):r==="Q"?{min:m,max:u}=je(...n):r==="Z"&&(n=[s,i,o,c],{min:m,max:u}=Bt(...n)),l.push(m),a.push(u),r==="Z"?(s=o,i=c):([s,i]=b.slice(-2),r==="M"&&(o=s,c=i)),C.x=s,C.y=i,b});const g=Math.min(...l.map(d=>d.x)),f=Math.max(...a.map(d=>d.x)),h=Math.min(...l.map(d=>d.y)),y=Math.max(...a.map(d=>d.y)),x=f-g,p=y-h;return{width:x,height:p,x:g,y:h,x2:f,y2:y,cx:g+x/2,cy:h+p/2,cz:Math.max(x,p)+Math.min(x,p)/2}},mt=(e,t,n)=>{const r=e*Math.cos(n)-t*Math.sin(n),s=e*Math.sin(n)+t*Math.cos(n);return{x:r,y:s}},Wt=(e,t,n,r,s,i,o,c,l,a)=>{let m=e,u=t,g=n,f=r,h=c,y=l;const x=Math.PI*120/180,p=Math.PI/180*(+s||0);let d=[],C,M,b,N,S;if(a)[M,b,N,S]=a;else{C=mt(m,u,-p),m=C.x,u=C.y,C=mt(h,y,-p),h=C.x,y=C.y;const T=(m-h)/2,O=(u-y)/2;let J=T*T/(g*g)+O*O/(f*f);J>1&&(J=Math.sqrt(J),g*=J,f*=J);const Lt=g*g,Tt=f*f,ue=(i===o?-1:1)*Math.sqrt(Math.abs((Lt*Tt-Lt*O*O-Tt*T*T)/(Lt*O*O+Tt*T*T)));N=ue*g*O/f+(m+h)/2,S=ue*-f*T/g+(u+y)/2,M=Math.asin(((u-S)/f*10**9>>0)/10**9),b=Math.asin(((y-S)/f*10**9>>0)/10**9),M=mb&&(M-=Math.PI*2),!o&&b>M&&(b-=Math.PI*2)}let P=b-M;if(Math.abs(P)>x){const T=b,O=h,J=y;b=M+x*(o&&b>M?1:-1),h=N+g*Math.cos(b),y=S+f*Math.sin(b),d=Wt(h,y,g,f,s,0,o,O,J,[b,T,N,S])}P=b-M;const q=Math.cos(M),$=Math.sin(M),tt=Math.cos(b),U=Math.sin(b),B=Math.tan(P/4),V=4/3*g*B,E=4/3*f*B,et=[m,u],Z=[m+V*$,u-E*q],dt=[h+V*U,y-E*tt],_=[h,y];if(Z[0]=2*et[0]-Z[0],Z[1]=2*et[1]-Z[1],a)return[...Z,...dt,..._,...d];d=[...Z,...dt,..._,...d];const R=[];for(let T=0,O=d.length;T{const o=.3333333333333333,c=2/3;return[o*e+c*n,o*t+c*r,o*s+c*n,o*i+c*r,s,i]},Gt=(e,t,n,r)=>{const s=X([e,t],[n,r],.3333333333333333),i=X([e,t],[n,r],2/3);return[...s,...i,n,r]},te=(e,t)=>{const[n]=e,r=e.slice(1).map(Number),[s,i]=r;let o;const{x1:c,y1:l,x:a,y:m}=t;return"TQ".includes(n)||(t.qx=null,t.qy=null),n==="M"?(t.x=s,t.y=i,e):n==="A"?(o=[c,l,...r],["C",...Wt(...o)]):n==="Q"?(t.qx=s,t.qy=i,o=[c,l,...r],["C",...Re(...o)]):n==="L"?["C",...Gt(c,l,s,i)]:n==="Z"?["C",...Gt(c,l,a,m)]:e},ut=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l,a)=>{const m=F(c,l);[i]=m;const u=i.toUpperCase(),g=K(m,l);let f=te(g,l);return f[0]==="C"&&f.length>7&&(o.splice(a+1,0,["C",...f.slice(7)]),f=f.slice(0,7)),u==="Z"?(t=r,n=s):([t,n]=f.slice(-2),u==="M"&&(r=t,s=n)),l.x=t,l.y=n,f})},De=(e,t,n,r,s,i,o,c)=>3*((c-t)*(n+s)-(o-e)*(r+i)+r*(e-s)-n*(t-i)+c*(s+e/3)-o*(i+t/3))/20,ee=e=>{let t=0,n=0,r=0;return ut(e).map(s=>{switch(s[0]){case"M":return[,t,n]=s,0;default:return r=De(t,n,...s.slice(1)),[t,n]=s.slice(-2),r}}).reduce((s,i)=>s+i,0)},G=e=>{const t=I(e);let n=!1,r=[],s="M",i=0,o=0,c=0,l=0,a=0;return Q(t,(m,u)=>{const g=F(m,u),f=K(g,u);return[s]=f,n=s==="M",r=n?r:[i,o,...f.slice(1)],n?[,c,l]=m:s==="L"?a+=lt(...r):s==="A"?a+=Ft(...r):s==="C"?a+=_t(...r):s==="Q"?a+=Jt(...r):s==="Z"&&(r=[i,o,c,l],a+=lt(...r)),s==="Z"?(i=c,o=l):([i,o]=f.slice(-2),n&&(c=i,l=o)),u.x=i,u.y=o,f}),a},Qe=e=>ee(ut(e))>=0,At=1e-5,rt=(e,t)=>{const n=I(e);let r=!1,s=[],i="M",o=0,c=0,[l,a]=n[0].slice(1);const m=typeof t=="number";let u={x:l,y:a},g=0,f=u,h=0;return m?(t{const p=F(y,x),d=K(p,x);return[i]=d,r=i==="M",s=r?s:[o,c,...d.slice(1)],r?([,l,a]=y,u={x:l,y:a},g=0):i==="L"?(u=Xt(...s,t-h),g=lt(...s)):i==="A"?(u=Ce(...s,t-h),g=Ft(...s)):i==="C"?(u=Ee(...s,t-h),g=_t(...s)):i==="Q"?(u=Oe(...s,t-h),g=Jt(...s)):i==="Z"&&(s=[o,c,l,a],u={x:l,y:a},g=lt(...s)),h=t&&(f=u),h+=g,i==="Z"?(o=l,c=a):([o,c]=d.slice(-2),i==="M"&&(l=o,a=c)),x.x=o,x.y=c,d}),t>h-At&&(f={x:o,y:c}),f):u},Ct=(e,t)=>{const n=I(e);let r=n.slice(0),s=G(r),i=r.length-1,o=0,c=0,l=n[0];const[a,m]=l.slice(-2),u={x:a,y:m};if(i<=0||!t||!Number.isFinite(t))return{segment:l,index:0,length:c,point:u,lengthAtSegment:o};if(t>=s)return r=n.slice(0,-1),o=G(r),c=s-o,{segment:n[i],index:i,length:c,lengthAtSegment:o};const g=[];for(;i>0;)l=r[i],r=r.slice(0,-1),o=G(r),c=s-o,s=o,g.push({segment:l,index:i,length:c,lengthAtSegment:o}),i-=1;return g.find(({lengthAtSegment:f})=>f<=t)},it=e=>{let t=0,n=0,r=0,s=0,i="M";return Q(I(e),(o,c)=>{const l=F(o,c),a=K(l,c);[i]=a;const m=i.toUpperCase();return m==="Z"?(t=r,n=s):([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),c.x=t,c.y=n,a})},ht=(e,t)=>{const n=I(e),r=it(n),s=G(n),i=M=>{const b=M.x-t.x,N=M.y-t.y;return b*b+N*N};let o=8,c,l={x:0,y:0},a=0,m=0,u=1/0;for(let M=0;M<=s;M+=o)c=rt(r,M),a=i(c),a1e-6&&(h=m-o,g=rt(r,h),x=i(g),y=m+o,f=rt(r,y),p=i(f),h>=0&&xht(e,t).closest,Be=(e,t)=>ht(e,t).segment,Ye=(e,t)=>Ct(e,t).segment,He=(e,t)=>{const{distance:n}=ht(e,t);return Math.abs(n){if(typeof e!="string"||!e.length)return!1;const t=new kt(e);for(nt(t);t.indexArray.isArray(e)&&e.every(t=>{const n=t[0].toLowerCase();return j[n]===t.length-1&&"achlmqstvz".includes(n)&&t.slice(1).every(Number.isFinite)})&&e.length>0,se=e=>ft(e)&&e.every(([t])=>t===t.toUpperCase()),Fe=e=>ft(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),re=e=>se(e)&&e.every(([t])=>"ACLMQZ".includes(t)),Ue=e=>re(e)&&e.every(([t])=>"MC".includes(t)),yt={line:["x1","y1","x2","y2"],circle:["cx","cy","r"],ellipse:["cx","cy","rx","ry"],rect:["width","height","x","y","rx","ry"],polygon:["points"],polyline:["points"],glyph:["d"]},Ve=e=>{let{x1:t,y1:n,x2:r,y2:s}=e;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t,n],["L",r,s]]},_e=e=>{const t=[],n=(e.points||"").trim().split(/[\s|,]/).map(s=>+s);let r=0;for(;r{let{cx:t,cy:n,r}=e;return[t,n,r]=[t,n,r].map(s=>+s),[["M",t-r,n],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},Ke=e=>{let{cx:t,cy:n}=e,r=e.rx||0,s=e.ry||r;return[t,n,r,s]=[t,n,r,s].map(i=>+i),[["M",t-r,n],["a",r,s,0,1,0,2*r,0],["a",r,s,0,1,0,-2*r,0]]},We=e=>{const t=+e.x||0,n=+e.y||0,r=+e.width,s=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>s&&(o-=(o*2-s)/2),[["M",t+i,n],["h",r-i*2],["s",i,0,i,o],["v",s-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-s+o*2],["s",0,-o,i,-o]]):[["M",t,n],["h",r],["v",s],["H",t],["Z"]]},ie=(e,t)=>{const r=(t||document).defaultView||window,s=Object.keys(yt),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...s,"path"].every(u=>o!==u))throw TypeError(`${L}: "${o}" is not SVGElement`);const c=i?o:e.type,l=yt[c],a={type:c};i?l.forEach(u=>{a[u]=e.getAttribute(u)}):Object.assign(a,e);let m=[];return c==="circle"?m=Je(a):c==="ellipse"?m=Ke(a):["polyline","polygon"].includes(c)?m=_e(a):c==="rect"?m=We(a):c==="line"?m=Ve(a):["glyph","path"].includes(c)&&(m=I(i?e.getAttribute("d")||"":e.d||"")),ft(m)&&m.length?m:!1},gt=(e,t)=>{let{round:n}=z;if(t==="off"||n==="off")return e.slice(0);n=typeof t=="number"&&t>=0?t:n;const r=typeof n=="number"&&n>=1?10**n:1;return Q(e,s=>{const i=s.slice(1).map(o=>n?Math.round(o*r)/r:Math.round(o));return[s[0],...i]})},vt=(e,t)=>gt(e,t).map(n=>n[0]+n.slice(1).join(" ")).join(""),Ge=(e,t,n)=>{const r=n||document,s=r.defaultView||window,i=Object.keys(yt),o=e instanceof s.SVGElement,c=o?e.tagName:null;if(c==="path")throw TypeError(`${L}: "${c}" is already SVGPathElement`);if(c&&i.every(y=>c!==y))throw TypeError(`${L}: "${c}" is not SVGElement`);const l=r.createElementNS("http://www.w3.org/2000/svg","path"),a=o?c:e.type,m=yt[a],u={type:a},g=z.round,f=ie(e,r),h=f&&f.length?vt(f,g):"";return o?(m.forEach(y=>{u[y]=e.getAttribute(y)}),Object.values(e.attributes).forEach(({name:y,value:x})=>{m.includes(y)||l.setAttribute(y,x)})):(Object.assign(u,e),Object.keys(u).forEach(y=>{!m.includes(y)&&y!=="type"&&l.setAttribute(y.replace(/[A-Z]/g,x=>`-${x.toLowerCase()}`),u[y])})),ne(h)?(l.setAttribute("d",h),t&&o&&(e.before(l,e),e.remove()),l):!1},oe=e=>{const t=[];let n,r=-1,s=0,i=0,o=0,c=0;const l={...ct};return e.forEach(a=>{const[m]=a,u=m.toUpperCase(),g=m.toLowerCase(),f=m===g,h=a.slice(1);u==="M"?(r+=1,[s,i]=h,s+=f?l.x:0,i+=f?l.y:0,o=s,c=i,n=[f?[u,o,c]:a]):(u==="Z"?(s=o,i=c):u==="H"?([,s]=a,s+=f?l.x:0):u==="V"?([,i]=a,i+=f?l.y:0):([s,i]=a.slice(-2),s+=f?l.x:0,i+=f?l.y:0),n.push(a)),l.x=s,l.y=i,t[r]=n}),t},ce=e=>{let t=new v;const{origin:n}=e,[r,s]=n,{translate:i}=e,{rotate:o}=e,{skew:c}=e,{scale:l}=e;return Array.isArray(i)&&i.length>=2&&i.every(a=>!Number.isNaN(+a))&&i.some(a=>a!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||c||l)&&(t=t.translate(r,s),Array.isArray(o)&&o.length>=2&&o.every(a=>!Number.isNaN(+a))&&o.some(a=>a!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(c)&&c.length===2&&c.every(a=>!Number.isNaN(+a))&&c.some(a=>a!==0)?(t=c[0]?t.skewX(c[0]):t,t=c[1]?t.skewY(c[1]):t):typeof c=="number"&&!Number.isNaN(c)&&(t=t.skewX(c)),Array.isArray(l)&&l.length>=2&&l.every(a=>!Number.isNaN(+a))&&l.some(a=>a!==1)?t=t.scale(...l):typeof l=="number"&&!Number.isNaN(l)&&(t=t.scale(l)),t=t.translate(-r,-s)),t},xt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l)=>{[i]=c;const a=F(c,l),m=i.toUpperCase();return m==="Z"?(t=r,n=s):m==="H"?[,t]=a:m==="V"?[,n]=a:([t,n]=a.slice(-2),m==="M"&&(r=t,s=n)),l.x=t,l.y=n,a})},tn=(e,t,n)=>{const[r]=e,{x:s,y:i}=t,o=e.slice(1).map(Number),c=r.toLowerCase();if(n===0&&r==="M")return e;if(r!==c){if(c==="a")return[c,o[0],o[1],o[2],o[3],o[4],o[5]-s,o[6]-i];if(c==="v")return[c,o[0]-i];if(c==="h")return[c,o[0]-s];{const l=o.map((a,m)=>a-(m%2?i:s));return[c,...l]}}return e},Pt=e=>{let t=0,n=0,r=0,s=0,i="M";const o=I(e);return Q(o,(c,l,a)=>{[i]=c;const m=tn(c,l,a),[u]=m,g=i.toUpperCase(),f=i.toLowerCase(),h=u===f;return g==="Z"?(t=r,n=s):g==="H"?([,t]=m,t+=h?l.x:0):g==="V"?([,n]=m,n+=h?l.y:0):([t,n]=m.slice(-2),t+=h?l.x:0,n+=h?l.y:0,g==="M"&&(r=t,s=n)),l.x=t,l.y=n,m})},en=(e,t,n,r)=>{const[s]=e,i=p=>Math.round(p*10**4)/10**4,o=e.slice(1),c=t.slice(1),{x1:l,y1:a,x2:m,y2:u,x:g,y:f}=n;let h=e;const[y,x]=c.slice(-2);if("TQ".includes(s)||(n.qx=null,n.qy=null),["V","H","S","T","Z"].includes(s))h=[s,...o];else if(s==="L")i(g)===i(y)?h=["V",x]:i(f)===i(x)&&(h=["H",y]);else if(s==="C"){const[p,d]=c;"CS".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["S",...c.slice(-4)]),n.x1=p,n.y1=d}else if(s==="Q"){const[p,d]=c;n.qx=p,n.qy=d,"QT".includes(r)&&(i(p)===i(l*2-m)&&i(d)===i(a*2-u)||i(l)===i(m*2-g)&&i(a)===i(u*2-f))&&(h=["T",...c.slice(-2)])}return h},le=(e,t)=>{const n=xt(e),r=it(n),s={...ct},i=[],o=n.length;let c="",l="",a=0,m=0,u=0,g=0;for(let y=0;yx?y.join("").length{const t=e.slice(1).map((n,r,s)=>r?[...s[r-1].slice(-2),...n.slice(1)]:[...e[0].slice(1),...n.slice(1)]).map(n=>n.map((r,s)=>n[n.length-s-2*(1-s%2)])).reverse();return[["M",...t[0].slice(0,2)],...t.map(n=>["C",...n.slice(2)])]},pt=e=>{const t=xt(e),n=t.slice(-1)[0][0]==="Z",r=it(t).map((s,i)=>{const[o,c]=s.slice(-2).map(Number);return{seg:t[i],n:s,c:t[i][0],x:o,y:c}}).map((s,i,o)=>{const c=s.seg,l=s.n,a=i&&o[i-1],m=o[i+1],u=s.c,g=o.length,f=i?o[i-1].x:o[g-1].x,h=i?o[i-1].y:o[g-1].y;let y=[];switch(u){case"M":y=n?["Z"]:[u,f,h];break;case"A":y=[u,...c.slice(1,-3),c[5]===1?0:1,f,h];break;case"C":m&&m.c==="S"?y=["S",c[1],c[2],f,h]:y=[u,c[3],c[4],c[1],c[2],f,h];break;case"S":a&&"CS".includes(a.c)&&(!m||m.c!=="S")?y=["C",l[3],l[4],l[1],l[2],f,h]:y=[u,l[1],l[2],f,h];break;case"Q":m&&m.c==="T"?y=["T",f,h]:y=[u,...c.slice(1,-2),f,h];break;case"T":a&&"QT".includes(a.c)&&(!m||m.c!=="T")?y=["Q",l[1],l[2],f,h]:y=[u,f,h];break;case"Z":y=["M",f,h];break;case"H":y=[u,f];break;case"V":y=[u,h];break;default:y=[u,...c.slice(1,-2),f,h]}return y});return n?r.reverse():[r[0],...r.slice(1).reverse()]},sn=(e,t)=>{let n=v.Translate(...t.slice(0,-1));return[,,,n.m44]=t,n=e.multiply(n),[n.m41,n.m42,n.m43,n.m44]},ae=(e,t,n)=>{const[r,s,i]=n,[o,c,l]=sn(e,[...t,0,1]),a=o-r,m=c-s,u=l-i;return[a*(Math.abs(i)/Math.abs(u)||1)+r,m*(Math.abs(i)/Math.abs(u)||1)+s]},me=(e,t)=>{let n=0,r=0,s=0,i=0,o=0,c=0,l=0,a=0,m=0,u=0,g="M";const f={...ct},h=I(e),y=t&&Object.keys(t);if(!t||y&&!y.length)return h;t.origin||Object.assign(t,{origin:z.origin});const x=t.origin,p=ce(t);return p.isIdentity?h:Q(h,(d,C,M)=>{const b=F(d,f);[g]=b;let N=g==="A"?te(b,f):["V","H"].includes(g)?K(b,f):b;const S=N[0]==="C"&&N.length>7,P=S?N.slice(0,7):N.slice(0);if(S&&(h.splice(M+1,0,["C",...N.slice(7)]),N=N.slice(0,7)),N[0]==="L"){const $=N.slice(-2);[o,c]=ae(p,$,x),n!==o&&r!==c?N=["L",o,c]:r===c?N=["H",o]:n===o&&(N=["V",c])}else for(l=1,a=N.length;l{const n=t,r=e.slice(0,2),s=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),c=X(r,s,n),l=X(s,i,n),a=X(i,o,n),m=X(c,l,n),u=X(l,a,n),g=X(m,u,n);return[["C",...c,...m,...g],["C",...u,...a,...o]]};class w{constructor(t,n){const r=n||{},s=typeof t>"u";if(s||!t.length)throw TypeError(`${L}: "pathValue" is ${s?"undefined":"empty"}`);const i=I(t);this.segments=i;const{round:o,origin:c}=r;let l;Number.isInteger(o)||o==="off"?l=o:l=z.round;let a=z.origin;if(Array.isArray(c)&&c.length>=2){const[m,u,g]=c.map(Number);a=[Number.isNaN(m)?0:m,Number.isNaN(u)?0:u,Number.isNaN(g)?0:g]}return this.round=l,this.origin=a,this}get bbox(){return Kt(this.segments)}get length(){return G(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return rt(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=xt(t),this}toRelative(){const{segments:t}=this;return this.segments=Pt(t),this}toCurve(){const{segments:t}=this;return this.segments=ut(t),this}reverse(t){this.toAbsolute();const{segments:n}=this,r=oe(n),s=r.length>1?r:!1,i=s?s.map((c,l)=>t?l?pt(c):c.slice(0):pt(c)):n.slice(0);let o=[];return s?o=i.flat(1):o=t?n:pt(n),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=it(t),this}optimize(){const{segments:t}=this;return this.segments=le(t,this.round),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(l=>l in t))return this;const{segments:n,origin:[r,s,i]}=this,o={};for(const[l,a]of Object.entries(t))l==="skew"&&Array.isArray(a)||(l==="rotate"||l==="translate"||l==="origin"||l==="scale")&&Array.isArray(a)?o[l]=a.map(Number):l!=="origin"&&typeof Number(a)=="number"&&(o[l]=Number(a));const{origin:c}=o;if(Array.isArray(c)&&c.length>=2){const[l,a,m]=c.map(Number);o.origin=[Number.isNaN(l)?r:l,Number.isNaN(a)?s:a,m||i]}else o.origin=[r,s,i];return this.segments=me(n,o),this}flipX(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,n,0]}),this}flipY(){const{cx:t,cy:n}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,n,0]}),this}toString(){return vt(this.segments,this.round)}}return A(w,"CSSMatrix",v),A(w,"getSVGMatrix",ce),A(w,"getPathBBox",Kt),A(w,"getPathArea",ee),A(w,"getTotalLength",G),A(w,"getDrawDirection",Qe),A(w,"getPointAtLength",rt),A(w,"getPropertiesAtLength",Ct),A(w,"getPropertiesAtPoint",ht),A(w,"polygonLength",be),A(w,"polygonArea",Me),A(w,"getClosestPoint",Xe),A(w,"getSegmentOfPoint",Be),A(w,"getSegmentAtLength",Ye),A(w,"isPointInStroke",He),A(w,"isValidPath",ne),A(w,"isPathArray",ft),A(w,"isAbsoluteArray",se),A(w,"isRelativeArray",Fe),A(w,"isCurveArray",Ue),A(w,"isNormalizedArray",re),A(w,"shapeToPath",Ge),A(w,"shapeToPathArray",ie),A(w,"parsePathString",I),A(w,"roundPath",gt),A(w,"splitPath",oe),A(w,"splitCubic",rn),A(w,"optimizePath",le),A(w,"reverseCurve",nn),A(w,"reversePath",pt),A(w,"normalizePath",it),A(w,"transformPath",me),A(w,"pathToAbsolute",xt),A(w,"pathToRelative",Pt),A(w,"pathToCurve",ut),A(w,"pathToString",vt),w}(); +var SVGPathCommander=function(){"use strict";var an=Object.defineProperty;var ln=(Y,Q,$)=>Q in Y?an(Y,Q,{enumerable:!0,configurable:!0,writable:!0,value:$}):Y[Q]=$;var p=(Y,Q,$)=>ln(Y,typeof Q!="symbol"?Q+"":Q,$);var Y=Object.defineProperty,Q=(e,t,s)=>t in e?Y(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,$=(e,t,s)=>Q(e,typeof t!="symbol"?t+"":t,s);const Ze={a:1,b:0,c:0,d:1,e:0,f:0,m11:1,m12:0,m13:0,m14:0,m21:0,m22:1,m23:0,m24:0,m31:0,m32:0,m33:1,m34:0,m41:0,m42:0,m43:0,m44:1,is2D:!0,isIdentity:!0},Jt=e=>(e instanceof Float64Array||e instanceof Float32Array||Array.isArray(e)&&e.every(t=>typeof t=="number"))&&[6,16].some(t=>e.length===t),Yt=e=>e instanceof DOMMatrix||e instanceof C||typeof e=="object"&&Object.keys(Ze).every(t=>e&&t in e),ct=e=>{const t=new C,s=Array.from(e);if(!Jt(s))throw TypeError(`CSSMatrix: "${s.join(",")}" must be an array with 6/16 numbers.`);if(s.length===16){const[r,n,i,o,a,c,l,u,m,f,y,h,x,b,A,w]=s;t.m11=r,t.a=r,t.m21=a,t.c=a,t.m31=m,t.m41=x,t.e=x,t.m12=n,t.b=n,t.m22=c,t.d=c,t.m32=f,t.m42=b,t.f=b,t.m13=i,t.m23=l,t.m33=y,t.m43=A,t.m14=o,t.m24=u,t.m34=h,t.m44=w}else if(s.length===6){const[r,n,i,o,a,c]=s;t.m11=r,t.a=r,t.m12=n,t.b=n,t.m21=i,t.c=i,t.m22=o,t.d=o,t.m41=a,t.e=a,t.m42=c,t.f=c}return t},Kt=e=>{if(Yt(e))return ct([e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44]);throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a DOMMatrix / CSSMatrix / JSON compatible object.`)},Wt=e=>{if(typeof e!="string")throw TypeError(`CSSMatrix: "${JSON.stringify(e)}" is not a string.`);const t=String(e).replace(/\s/g,"");let s=new C;const r=`CSSMatrix: invalid transform string "${e}"`;return t.split(")").filter(n=>n).forEach(n=>{const[i,o]=n.split("(");if(!o)throw TypeError(r);const a=o.split(",").map(h=>h.includes("rad")?parseFloat(h)*(180/Math.PI):parseFloat(h)),[c,l,u,m]=a,f=[c,l,u],y=[c,l,u,m];if(i==="perspective"&&c&&[l,u].every(h=>h===void 0))s.m34=-1/c;else if(i.includes("matrix")&&[6,16].includes(a.length)&&a.every(h=>!Number.isNaN(+h))){const h=a.map(x=>Math.abs(x)<1e-6?0:x);s=s.multiply(ct(h))}else if(i==="translate3d"&&f.every(h=>!Number.isNaN(+h)))s=s.translate(c,l,u);else if(i==="translate"&&c&&u===void 0)s=s.translate(c,l||0,0);else if(i==="rotate3d"&&y.every(h=>!Number.isNaN(+h))&&m)s=s.rotateAxisAngle(c,l,u,m);else if(i==="rotate"&&c&&[l,u].every(h=>h===void 0))s=s.rotate(0,0,c);else if(i==="scale3d"&&f.every(h=>!Number.isNaN(+h))&&f.some(h=>h!==1))s=s.scale(c,l,u);else if(i==="scale"&&!Number.isNaN(c)&&c!==1&&u===void 0){const h=Number.isNaN(+l)?c:l;s=s.scale(c,h,1)}else if(i==="skew"&&(c||!Number.isNaN(c)&&l)&&u===void 0)s=s.skew(c,l||0);else if(["translate","rotate","scale","skew"].some(h=>i.includes(h))&&/[XYZ]/.test(i)&&c&&[l,u].every(h=>h===void 0))if(i==="skewX"||i==="skewY")s=s[i](c);else{const h=i.replace(/[XYZ]/,""),x=i.replace(h,""),b=["X","Y","Z"].indexOf(x),A=h==="scale"?1:0,w=[b===0?c:A,b===1?c:A,b===2?c:A];s=s[h](...w)}else throw TypeError(r)}),s},Ct=(e,t)=>t?[e.a,e.b,e.c,e.d,e.e,e.f]:[e.m11,e.m12,e.m13,e.m14,e.m21,e.m22,e.m23,e.m24,e.m31,e.m32,e.m33,e.m34,e.m41,e.m42,e.m43,e.m44],Vt=(e,t,s)=>{const r=new C;return r.m41=e,r.e=e,r.m42=t,r.f=t,r.m43=s,r},Gt=(e,t,s)=>{const r=new C,n=Math.PI/180,i=e*n,o=t*n,a=s*n,c=Math.cos(i),l=-Math.sin(i),u=Math.cos(o),m=-Math.sin(o),f=Math.cos(a),y=-Math.sin(a),h=u*f,x=-u*y;r.m11=h,r.a=h,r.m12=x,r.b=x,r.m13=m;const b=l*m*f+c*y;r.m21=b,r.c=b;const A=c*f-l*m*y;return r.m22=A,r.d=A,r.m23=-l*u,r.m31=l*y-c*m*f,r.m32=l*f+c*m*y,r.m33=c*u,r},te=(e,t,s,r)=>{const n=new C,i=Math.sqrt(e*e+t*t+s*s);if(i===0)return n;const o=e/i,a=t/i,c=s/i,l=r*(Math.PI/360),u=Math.sin(l),m=Math.cos(l),f=u*u,y=o*o,h=a*a,x=c*c,b=1-2*(h+x)*f;n.m11=b,n.a=b;const A=2*(o*a*f+c*u*m);n.m12=A,n.b=A,n.m13=2*(o*c*f-a*u*m);const w=2*(a*o*f-c*u*m);n.m21=w,n.c=w;const N=1-2*(x+y)*f;return n.m22=N,n.d=N,n.m23=2*(a*c*f+o*u*m),n.m31=2*(c*o*f+a*u*m),n.m32=2*(c*a*f-o*u*m),n.m33=1-2*(y+h)*f,n},ee=(e,t,s)=>{const r=new C;return r.m11=e,r.a=e,r.m22=t,r.d=t,r.m33=s,r},gt=(e,t)=>{const s=new C;if(e){const r=e*Math.PI/180,n=Math.tan(r);s.m21=n,s.c=n}if(t){const r=t*Math.PI/180,n=Math.tan(r);s.m12=n,s.b=n}return s},ne=e=>gt(e,0),se=e=>gt(0,e),B=(e,t)=>{const s=t.m11*e.m11+t.m12*e.m21+t.m13*e.m31+t.m14*e.m41,r=t.m11*e.m12+t.m12*e.m22+t.m13*e.m32+t.m14*e.m42,n=t.m11*e.m13+t.m12*e.m23+t.m13*e.m33+t.m14*e.m43,i=t.m11*e.m14+t.m12*e.m24+t.m13*e.m34+t.m14*e.m44,o=t.m21*e.m11+t.m22*e.m21+t.m23*e.m31+t.m24*e.m41,a=t.m21*e.m12+t.m22*e.m22+t.m23*e.m32+t.m24*e.m42,c=t.m21*e.m13+t.m22*e.m23+t.m23*e.m33+t.m24*e.m43,l=t.m21*e.m14+t.m22*e.m24+t.m23*e.m34+t.m24*e.m44,u=t.m31*e.m11+t.m32*e.m21+t.m33*e.m31+t.m34*e.m41,m=t.m31*e.m12+t.m32*e.m22+t.m33*e.m32+t.m34*e.m42,f=t.m31*e.m13+t.m32*e.m23+t.m33*e.m33+t.m34*e.m43,y=t.m31*e.m14+t.m32*e.m24+t.m33*e.m34+t.m34*e.m44,h=t.m41*e.m11+t.m42*e.m21+t.m43*e.m31+t.m44*e.m41,x=t.m41*e.m12+t.m42*e.m22+t.m43*e.m32+t.m44*e.m42,b=t.m41*e.m13+t.m42*e.m23+t.m43*e.m33+t.m44*e.m43,A=t.m41*e.m14+t.m42*e.m24+t.m43*e.m34+t.m44*e.m44;return ct([s,r,n,i,o,a,c,l,u,m,f,y,h,x,b,A])};class C{constructor(t){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this.m11=1,this.m12=0,this.m13=0,this.m14=0,this.m21=0,this.m22=1,this.m23=0,this.m24=0,this.m31=0,this.m32=0,this.m33=1,this.m34=0,this.m41=0,this.m42=0,this.m43=0,this.m44=1,t?this.setMatrixValue(t):this}get isIdentity(){return this.m11===1&&this.m12===0&&this.m13===0&&this.m14===0&&this.m21===0&&this.m22===1&&this.m23===0&&this.m24===0&&this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m41===0&&this.m42===0&&this.m43===0&&this.m44===1}get is2D(){return this.m31===0&&this.m32===0&&this.m33===1&&this.m34===0&&this.m43===0&&this.m44===1}setMatrixValue(t){return typeof t=="string"&&t.length&&t!=="none"?Wt(t):Array.isArray(t)||t instanceof Float64Array||t instanceof Float32Array?ct(t):typeof t=="object"?Kt(t):this}toFloat32Array(t){return Float32Array.from(Ct(this,t))}toFloat64Array(t){return Float64Array.from(Ct(this,t))}toString(){const{is2D:t}=this,s=this.toFloat64Array(t).join(", ");return`${t?"matrix":"matrix3d"}(${s})`}toJSON(){const{is2D:t,isIdentity:s}=this;return{...this,is2D:t,isIdentity:s}}multiply(t){return B(this,t)}translate(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=0),typeof o>"u"&&(o=0),B(this,Vt(n,i,o))}scale(t,s,r){const n=t;let i=s,o=r;return typeof i>"u"&&(i=t),typeof o>"u"&&(o=1),B(this,ee(n,i,o))}rotate(t,s,r){let n=t,i=s||0,o=r||0;return typeof t=="number"&&typeof s>"u"&&typeof r>"u"&&(o=n,n=0,i=0),B(this,Gt(n,i,o))}rotateAxisAngle(t,s,r,n){if([t,s,r,n].some(i=>Number.isNaN(+i)))throw new TypeError("CSSMatrix: expecting 4 values");return B(this,te(t,s,r,n))}skewX(t){return B(this,ne(t))}skewY(t){return B(this,se(t))}skew(t,s){return B(this,gt(t,s))}transformPoint(t){const s=this.m11*t.x+this.m21*t.y+this.m31*t.z+this.m41*t.w,r=this.m12*t.x+this.m22*t.y+this.m32*t.z+this.m42*t.w,n=this.m13*t.x+this.m23*t.y+this.m33*t.z+this.m43*t.w,i=this.m14*t.x+this.m24*t.y+this.m34*t.z+this.m44*t.w;return t instanceof DOMPoint?new DOMPoint(s,r,n,i):{x:s,y:r,z:n,w:i}}}$(C,"Translate",Vt),$(C,"Rotate",Gt),$(C,"RotateAxisAngle",te),$(C,"Scale",ee),$(C,"SkewX",ne),$(C,"SkewY",se),$(C,"Skew",gt),$(C,"Multiply",B),$(C,"fromArray",ct),$(C,"fromMatrix",Kt),$(C,"fromString",Wt),$(C,"toArray",Ct),$(C,"isCompatibleArray",Jt),$(C,"isCompatibleObject",Yt);const K={origin:[0,0,0],round:4},nt={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0},Pt=e=>{let t=e.pathValue[e.segmentStart],s=t.toLowerCase();const{data:r}=e;for(;r.length>=nt[s]&&(s==="m"&&r.length>2?(e.segments.push([t].concat(r.splice(0,2))),s="l",t=t==="m"?"l":"L"):e.segments.push([t].concat(r.splice(0,nt[s]))),!!nt[s]););},I="SVGPathCommander Error",re=e=>{const{index:t,pathValue:s}=e,r=s.charCodeAt(t);if(r===48){e.param=0,e.index+=1;return}if(r===49){e.param=1,e.index+=1;return}e.err=`${I}: invalid Arc flag "${s[t]}", expecting 0 or 1 at index ${t}`},F=e=>e>=48&&e<=57,H="Invalid path value",ie=e=>{const{max:t,pathValue:s,index:r}=e;let n=r,i=!1,o=!1,a=!1,c=!1,l;if(n>=t){e.err=`${I}: ${H} at index ${n}, "pathValue" is missing param`;return}if(l=s.charCodeAt(n),(l===43||l===45)&&(n+=1,l=s.charCodeAt(n)),!F(l)&&l!==46){e.err=`${I}: ${H} at index ${n}, "${s[n]}" is not a number`;return}if(l!==46){if(i=l===48,n+=1,l=s.charCodeAt(n),i&&n[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279,10,13,8232,8233,32,9,11,12,160].includes(e),st=e=>{const{pathValue:t,max:s}=e;for(;e.index{switch(e|32){case 109:case 122:case 108:case 104:case 118:case 99:case 115:case 113:case 116:case 97:return!0;default:return!1}},ae=e=>F(e)||e===43||e===45||e===46,le=e=>(e|32)===97,ue=e=>{switch(e|32){case 109:case 77:return!0;default:return!1}},$t=e=>{var c;const{max:t,pathValue:s,index:r,segments:n}=e,i=s.charCodeAt(r),o=nt[s[r].toLowerCase()];if(e.segmentStart=r,!ce(i)){e.err=`${I}: ${H} "${s[r]}" is not a path command at index ${r}`;return}const a=n[n.length-1];if(!ue(i)&&((c=a==null?void 0:a[0])==null?void 0:c.toLocaleLowerCase())==="z"){e.err=`${I}: ${H} "${s[r]}" is not a MoveTo path command at index ${r}`;return}if(e.index+=1,st(e),e.data=[],!o){Pt(e);return}for(;;){for(let l=o;l>0;l-=1){if(le(i)&&(l===3||l===4)?re(e):ie(e),e.err.length)return;e.data.push(e.param),st(e),e.index=e.max||!ae(s.charCodeAt(e.index)))break}Pt(e)};class zt{constructor(t){this.segments=[],this.pathValue=t,this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}}const E=e=>{if(typeof e!="string")return e.slice(0);const t=new zt(e);for(st(t);t.index{const[n]=e,i=n.toUpperCase();if(t===0||i===n)return e;if(i==="A")return[i,e[1],e[2],e[3],e[4],e[5],e[6]+s,e[7]+r];if(i==="V")return[i,e[1]+r];if(i==="H")return[i,e[1]+s];if(i==="L")return[i,e[1]+s,e[2]+r];{const a=e.slice(1).map((c,l)=>c+(l%2?r:s));return[i].concat(a)}},R=(e,t)=>{let s=e.length,r,n="M",i="M",o=!1,a=0,c=0,l=0,u=0,m=0;for(let f=0;f{const t=E(e);return R(t,qt)},kt=(e,t,s,r)=>{const[n]=e,i=n.toLowerCase();if(t===0||n===i)return e;if(i==="a")return[i,e[1],e[2],e[3],e[4],e[5],e[6]-s,e[7]-r];if(i==="v")return[i,e[1]-r];if(i==="h")return[i,e[1]-s];if(i==="l")return[i,e[1]-s,e[2]-r];{const a=e.slice(1).map((c,l)=>c-(l%2?r:s));return[i].concat(a)}},me=e=>{const t=E(e);return R(t,kt)},at=(e,t,s)=>{const{sin:r,cos:n}=Math,i=e*n(s)-t*r(s),o=e*r(s)+t*n(s);return{x:i,y:o}},It=(e,t,s,r,n,i,o,a,c,l)=>{let u=e,m=t,f=s,y=r,h=a,x=c;const b=Math.PI*120/180,A=Math.PI/180*(+n||0);let w=[],N,M,d,v,L;if(l)[M,d,v,L]=l;else{N=at(u,m,-A),u=N.x,m=N.y,N=at(h,x,-A),h=N.x,x=N.y;const P=(u-h)/2,q=(m-x)/2;let _=P*P/(f*f)+q*q/(y*y);_>1&&(_=Math.sqrt(_),f*=_,y*=_);const J=f*f,D=y*y,De=(i===o?-1:1)*Math.sqrt(Math.abs((J*D-J*q*q-D*P*P)/(J*q*q+D*P*P)));v=De*f*q/y+(u+h)/2,L=De*-y*P/f+(m+x)/2,M=Math.asin(((m-L)/y*10**9>>0)/10**9),d=Math.asin(((x-L)/y*10**9>>0)/10**9),M=ud&&(M-=Math.PI*2),!o&&d>M&&(d-=Math.PI*2)}let T=d-M;if(Math.abs(T)>b){const P=d,q=h,_=x;d=M+b*(o&&d>M?1:-1),h=v+f*Math.cos(d),x=L+y*Math.sin(d),w=It(h,x,f,y,n,0,o,q,_,[d,P,v,L])}T=d-M;const O=Math.cos(M),k=Math.sin(M),yt=Math.cos(d),it=Math.sin(d),X=Math.tan(T/4),ot=4/3*f*X,j=4/3*y*X,G=[u,m],S=[u+ot*k,m-j*O],tt=[h+ot*it,x-j*yt],et=[h,x];if(S[0]=2*G[0]-S[0],S[1]=2*G[1]-S[1],l)return[S[0],S[1],tt[0],tt[1],et[0],et[1]].concat(w);w=[S[0],S[1],tt[0],tt[1],et[0],et[1]].concat(w);const xt=[];for(let P=0,q=w.length;P{const o=.3333333333333333,a=2/3;return[o*e+a*s,o*t+a*r,o*n+a*s,o*i+a*r,n,i]},Z=(e,t,s)=>{const[r,n]=e,[i,o]=t;return[r+(i-r)*s,n+(o-n)*s]},Et=(e,t,s,r)=>{const n=Z([e,t],[s,r],.3333333333333333),i=Z([e,t],[s,r],2/3);return[n[0],n[1],i[0],i[1],s,r]},Rt=(e,t)=>{const[s]=e,r=e.slice(1).map(Number),[n,i]=r,{x1:o,y1:a,x:c,y:l}=t;return"TQ".includes(s)||(t.qx=null,t.qy=null),s==="M"?(t.x=n,t.y=i,e):s==="A"?["C"].concat(It(o,a,r[0],r[1],r[2],r[3],r[4],r[5],r[6])):s==="Q"?(t.qx=n,t.qy=i,["C"].concat(he(o,a,r[0],r[1],r[2],r[3]))):s==="L"?["C"].concat(Et(o,a,n,i)):s==="Z"?["C"].concat(Et(o,a,c,l)):e},W=(e,t)=>{const[s]=e,r=s.toUpperCase(),n=s!==r,{x1:i,y1:o,x2:a,y2:c,x:l,y:u}=t,m=e.slice(1);let f=m.map((y,h)=>y+(n?h%2?u:l:0));if("TQ".includes(r)||(t.qx=null,t.qy=null),r==="A")return f=m.slice(0,-2).concat(m[5]+(n?l:0),m[6]+(n?u:0)),["A"].concat(f);if(r==="H")return["L",e[1]+(n?l:0),o];if(r==="V")return["L",i,e[1]+(n?u:0)];if(r==="L")return["L",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="M")return["M",e[1]+(n?l:0),e[2]+(n?u:0)];if(r==="C")return["C"].concat(f);if(r==="S"){const y=i*2-a,h=o*2-c;return t.x1=y,t.y1=h,["C",y,h].concat(f)}else if(r==="T"){const y=i*2-(t.qx?t.qx:0),h=o*2-(t.qy?t.qy:0);return t.qx=y,t.qy=h,["Q",y,h].concat(f)}else if(r==="Q"){const[y,h]=f;return t.qx=y,t.qy=h,["Q"].concat(f)}else if(r==="Z")return["Z"];return e},U={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null},bt=e=>{const t={...U},s=E(e);return R(s,(r,n,i,o)=>{t.x=i,t.y=o;const a=W(r,t);let c=Rt(a,t);c[0]==="C"&&c.length>7&&(s.splice(n+1,0,["C"].concat(c.slice(7))),c=c.slice(0,7));const u=c.length;return t.x1=+c[u-2],t.y1=+c[u-1],t.x2=+c[u-4]||t.x1,t.y2=+c[u-3]||t.y1,c})},z=(e,t)=>{const s=t>=1?10**t:1;return t>0?Math.round(e*s)/s:Math.round(e)},jt=(e,t)=>{const s=e.length;let{round:r}=K,n=e[0],i="";r=t==="off"||typeof t=="number"&&t>=0?t:typeof r=="number"&&r>=0?r:"off";for(let o=0;oMath.sqrt((e[0]-t[0])*(e[0]-t[0])+(e[1]-t[1])*(e[1]-t[1])),lt=(e,t,s,r)=>dt([e,t],[s,r]),St=(e,t,s,r,n)=>{let i={x:e,y:t};if(typeof n=="number"){const o=dt([e,t],[s,r]);if(n<=0)i={x:e,y:t};else if(n>=o)i={x:s,y:r};else{const[a,c]=Z([e,t],[s,r],n/o);i={x:a,y:c}}}return i},Dt=(e,t,s,r)=>{const{min:n,max:i}=Math;return{min:{x:n(e,s),y:n(t,r)},max:{x:i(e,s),y:i(t,r)}}},Zt=(e,t,s)=>{const r=s/2,n=Math.sin(r),i=Math.cos(r),o=e**2*n**2,a=t**2*i**2,c=Math.sqrt(o+a)*s;return Math.abs(c)},V=(e,t,s,r,n,i)=>{const{sin:o,cos:a}=Math,c=a(n),l=o(n),u=s*a(i),m=r*o(i);return{x:e+c*u-l*m,y:t+l*u+c*m}},Ot=(e,t)=>{const{x:s,y:r}=e,{x:n,y:i}=t,o=s*n+r*i,a=Math.sqrt((s**2+r**2)*(n**2+i**2));return(s*i-r*n<0?-1:1)*Math.acos(o/a)},At=(e,t,s,r,n,i,o,a,c)=>{const{abs:l,sin:u,cos:m,sqrt:f,PI:y}=Math;let h=l(s),x=l(r);const A=(n%360+360)%360*(y/180);if(e===a&&t===c)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:a,y:c}};if(h===0||x===0)return{rx:h,ry:x,startAngle:0,endAngle:0,center:{x:(a+e)/2,y:(c+t)/2}};const w=(e-a)/2,N=(t-c)/2,M={x:m(A)*w+u(A)*N,y:-u(A)*w+m(A)*N},d=M.x**2/h**2+M.y**2/x**2;d>1&&(h*=f(d),x*=f(d));const v=h**2*x**2-h**2*M.y**2-x**2*M.x**2,L=h**2*M.y**2+x**2*M.x**2;let T=v/L;T=T<0?0:T;const O=(i!==o?1:-1)*f(T),k={x:O*(h*M.y/x),y:O*(-(x*M.x)/h)},yt={x:m(A)*k.x-u(A)*k.y+(e+a)/2,y:u(A)*k.x+m(A)*k.y+(t+c)/2},it={x:(M.x-k.x)/h,y:(M.y-k.y)/x},X=Ot({x:1,y:0},it),ot={x:(-M.x-k.x)/h,y:(-M.y-k.y)/x};let j=Ot(it,ot);!o&&j>0?j-=2*y:o&&j<0&&(j+=2*y),j%=2*y;const G=X+j;return{center:yt,startAngle:X,endAngle:G,rx:h,ry:x}},Qt=(e,t,s,r,n,i,o,a,c)=>{const{rx:l,ry:u,startAngle:m,endAngle:f}=At(e,t,s,r,n,i,o,a,c);return Zt(l,u,f-m)},fe=(e,t,s,r,n,i,o,a,c,l)=>{let u={x:e,y:t};const{center:m,rx:f,ry:y,startAngle:h,endAngle:x}=At(e,t,s,r,n,i,o,a,c);if(typeof l=="number"){const b=Zt(f,y,x-h);if(l<=0)u={x:e,y:t};else if(l>=b)u={x:a,y:c};else{if(e===a&&t===c)return{x:a,y:c};if(f===0||y===0)return St(e,t,a,c,l);const{PI:A,cos:w,sin:N}=Math,M=x-h,v=(n%360+360)%360*(A/180),L=h+M*(l/b),T=f*w(L),O=y*N(L);u={x:w(v)*T-N(v)*O+m.x,y:N(v)*T+w(v)*O+m.y}}}return u},ye=(e,t,s,r,n,i,o,a,c)=>{const{center:l,rx:u,ry:m,startAngle:f,endAngle:y}=At(e,t,s,r,n,i,o,a,c),h=y-f,{min:x,max:b,tan:A,atan2:w,PI:N}=Math,M={x:a,y:c},{x:d,y:v}=l,L=[M],T=n*N/180,O=A(T),k=w(-m*O,u),yt=k,it=k+N,X=w(m,u*O),ot=X+N,j=[e,a],G=[t,c],S=x(...j),tt=b(...j),et=x(...G),xt=b(...G),P=y-h*.001,q=V(d,v,u,m,T,P),_=y-h*.999,J=V(d,v,u,m,T,_);return(q.x>tt||J.x>tt)&&L.push(V(d,v,u,m,T,yt)),(q.xxt||J.y>xt)&&L.push(V(d,v,u,m,T,X)),{min:{x:x(...L.map(D=>D.x)),y:x(...L.map(D=>D.y))},max:{x:b(...L.map(D=>D.x)),y:b(...L.map(D=>D.y))}}},Oe=Object.freeze(Object.defineProperty({__proto__:null,angleBetween:Ot,arcLength:Zt,arcPoint:V,getArcBBox:ye,getArcLength:Qt,getArcProps:At,getPointAtArcLength:fe},Symbol.toStringTag,{value:"Module"})),Bt=[-.06405689286260563,.06405689286260563,-.1911188674736163,.1911188674736163,-.3150426796961634,.3150426796961634,-.4337935076260451,.4337935076260451,-.5454214713888396,.5454214713888396,-.6480936519369755,.6480936519369755,-.7401241915785544,.7401241915785544,-.820001985973903,.820001985973903,-.8864155270044011,.8864155270044011,-.9382745520027328,.9382745520027328,-.9747285559713095,.9747285559713095,-.9951872199970213,.9951872199970213],xe=[.12793819534675216,.12793819534675216,.1258374563468283,.1258374563468283,.12167047292780339,.12167047292780339,.1155056680537256,.1155056680537256,.10744427011596563,.10744427011596563,.09761865210411388,.09761865210411388,.08619016153195327,.08619016153195327,.0733464814110803,.0733464814110803,.05929858491543678,.05929858491543678,.04427743881741981,.04427743881741981,.028531388628933663,.028531388628933663,.0123412297999872,.0123412297999872],ge=e=>{const t=[];for(let s=e,r=s.length,n=r-1;r>1;r-=1,n-=1){const i=[];for(let o=0;o{if(t===0)return e[0].t=0,e[0];const s=e.length-1;if(t===1)return e[s].t=1,e[s];const r=1-t;let n=e;if(s===0)return e[0].t=t,e[0];if(s===1)return{x:r*n[0].x+t*n[1].x,y:r*n[0].y+t*n[1].y,t};const i=r*r,o=t*t;let a=0,c=0,l=0,u=0;return s===2?(n=[n[0],n[1],n[2],{x:0,y:0}],a=i,c=r*t*2,l=o):s===3&&(a=i*r,c=i*t*3,l=r*o*3,u=t*o),{x:a*n[0].x+c*n[1].x+l*n[2].x+u*n[3].x,y:a*n[0].y+c*n[1].y+l*n[2].y+u*n[3].y,t}},be=(e,t)=>{const s=e(t),r=s.x*s.x+s.y*s.y;return Math.sqrt(r)},de=e=>{const s=Bt.length;let r=0;for(let n=0,i;n{const t=[];for(let r=0,n=e.length,i=2;rpe(s[0],r))},Ae=1e-8,Mt=([e,t,s])=>{const r=Math.min(e,s),n=Math.max(e,s);if(t>=e?s>=t:s<=t)return[r,n];const i=(e*s-t*t)/(e-2*t+s);return i{const n=e-3*t+3*s-r;if(Math.abs(n)0&&u<1){const f=e*(1-u)*(1-u)*(1-u)+t*3*(1-u)*(1-u)*u+s*3*(1-u)*u*u+r*u*u*u;fc&&(c=f)}return[a,c]},Me=([e,t,s,r,n,i,o,a],c)=>{const l=1-c;return{x:l**3*e+3*l**2*c*s+3*l*c**2*n+c**3*o,y:l**3*t+3*l**2*c*r+3*l*c**2*i+c**3*a}},Ft=(e,t,s,r,n,i,o,a)=>ut([e,t,s,r,n,i,o,a]),we=(e,t,s,r,n,i,o,a,c)=>{const l=typeof c=="number";let u={x:e,y:t};if(l){const m=ut([e,t,s,r,n,i,o,a]);c<=0||(c>=m?u={x:o,y:a}:u=Me([e,t,s,r,n,i,o,a],c/m))}return u},Ne=(e,t,s,r,n,i,o,a)=>{const c=_t([e,s,n,o]),l=_t([t,r,i,a]);return{min:{x:c[0],y:l[0]},max:{x:c[1],y:l[1]}}},Le=([e,t,s,r,n,i],o)=>{const a=1-o;return{x:a**2*e+2*a*o*s+o**2*n,y:a**2*t+2*a*o*r+o**2*i}},Ht=(e,t,s,r,n,i)=>ut([e,t,s,r,n,i]),ve=(e,t,s,r,n,i,o)=>{const a=typeof o=="number";let c={x:e,y:t};if(a){const l=ut([e,t,s,r,n,i]);o<=0||(o>=l?c={x:n,y:i}:c=Le([e,t,s,r,n,i],o/l))}return c},Te=(e,t,s,r,n,i)=>{const o=Mt([e,s,n]),a=Mt([t,r,i]);return{min:{x:o[0],y:a[0]},max:{x:o[1],y:a[1]}}},Qe=e=>{const t=e.length;let s=-1,r,n=e[t-1],i=0;for(;++se.reduce((t,s,r)=>r?t+dt(e[r-1],s):0,0),wt=1e-5,mt=e=>{const t=E(e),s={...U};return R(t,(r,n,i,o)=>{s.x=i,s.y=o;const a=W(r,s),c=a.length;return s.x1=+a[c-2],s.y1=+a[c-1],s.x2=+a[c-4]||s.x1,s.y2=+a[c-3]||s.y1,a})},ht=(e,t)=>{const s=mt(e);let r=!1,n=[],i="M",o=0,a=0,[c,l]=s[0].slice(1);const u=typeof t=="number";let m={x:c,y:l},f=0,y=m,h=0;return!u||t{if([i]=x,r=i==="M",n=r?n:[A,w].concat(x.slice(1)),r?([,c,l]=x,m={x:c,y:l},f=0):i==="L"?(m=St(n[0],n[1],n[2],n[3],t-h),f=lt(n[0],n[1],n[2],n[3])):i==="A"?(m=fe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8],t-h),f=Qt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])):i==="C"?(m=we(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],t-h),f=Ft(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7])):i==="Q"?(m=ve(n[0],n[1],n[2],n[3],n[4],n[5],t-h),f=Ht(n[0],n[1],n[2],n[3],n[4],n[5])):i==="Z"&&(n=[A,w,c,l],m={x:c,y:l},f=lt(n[0],n[1],n[2],n[3])),[o,a]=n.slice(-2),hh-wt?{x:o,y:a}:y)},rt=e=>{const t=E(e),s={...U};let r=!1,n=[],i="M",o=0,a=0,c=0;return R(t,(l,u,m,f)=>{s.x=m,s.y=f;const y=W(l,s);[i]=y,r=i==="M",n=r?n:[m,f].concat(y.slice(1)),r?[,o,a]=y:i==="L"?c+=lt(n[0],n[1],n[2],n[3]):i==="A"?c+=Qt(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8]):i==="C"?c+=Ft(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7]):i==="Q"?c+=Ht(n[0],n[1],n[2],n[3],n[4],n[5]):i==="Z"&&(n=[m,f,o,a],c+=lt(n[0],n[1],n[2],n[3]));const h=y.length;s.x1=+y[h-2],s.y1=+y[h-1],s.x2=+y[h-4]||s.x1,s.y2=+y[h-3]||s.y1}),c},Ut=(e,t)=>{const s=E(e);let r=s.slice(0),n=rt(r),i=r.length-1,o=0,a=0,c=s[0];if(i<=0||!t||!Number.isFinite(t))return{segment:c,index:0,length:a,lengthAtSegment:o};if(t>=n)return r=s.slice(0,-1),o=rt(r),a=n-o,c=s[i],{segment:c,index:i,length:a,lengthAtSegment:o};const l=[];for(;i>0;)c=r[i],r=r.slice(0,-1),o=rt(r),a=n-o,n=o,l.push({segment:c,index:i,length:a,lengthAtSegment:o}),i-=1;return l.find(({lengthAtSegment:u})=>u<=t)},Nt=(e,t)=>{const s=E(e),r=mt(s),n=rt(r),i=M=>{const d=M.x-t.x,v=M.y-t.y;return d*d+v*v};let o=8,a,c={x:0,y:0},l=0,u=0,m=1/0;for(let M=0;M<=n;M+=o)a=ht(r,M),l=i(a),l1e-6&&(h=u-o,f=ht(r,h),b=i(f),x=u+o,y=ht(r,x),A=i(y),h>=0&&bNt(e,t).closest,Fe=(e,t,s,r,n,i,o,a)=>3*((a-t)*(s+n)-(o-e)*(r+i)+r*(e-n)-s*(t-i)+a*(n+e/3)-o*(i+t/3))/20,Ce=e=>{let t=0,s=0,r=0;return bt(e).map(n=>{switch(n[0]){case"M":return[,t,s]=n,0;default:return r=Fe(t,s,n[1],n[2],n[3],n[4],n[5],n[6]),[t,s]=n.slice(-2),r}}).reduce((n,i)=>n+i,0)},He=e=>Ce(bt(e))>=0,Pe=e=>{if(!e)return{x:0,y:0,width:0,height:0,x2:0,y2:0,cx:0,cy:0,cz:0};const t=E(e);let s=[],r="M";const n=0,i=0;let o=0,a=0;const c=[],l=[];let u={x:n,y:i},m={x:n,y:i};const f={...U};R(t,(N,M,d,v)=>{f.x=d,f.y=v;const L=W(N,f);[r]=L,s=[d,v].concat(L.slice(1)),r==="M"?([,o,a]=L,u={x:o,y:a},m={x:o,y:a}):r==="L"?{min:u,max:m}=Dt(s[0],s[1],s[2],s[3]):r==="A"?{min:u,max:m}=ye(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7],s[8]):r==="C"?{min:u,max:m}=Ne(s[0],s[1],s[2],s[3],s[4],s[5],s[6],s[7]):r==="Q"?{min:u,max:m}=Te(s[0],s[1],s[2],s[3],s[4],s[5]):r==="Z"&&(s=[d,v,o,a],{min:u,max:m}=Dt(s[0],s[1],s[2],s[3])),c.push(u),l.push(m);const T=L.length;f.x1=+L[T-2],f.y1=+L[T-1],f.x2=+L[T-4]||f.x1,f.y2=+L[T-3]||f.y1});const y=Math.min(...c.map(N=>N.x)),h=Math.max(...l.map(N=>N.x)),x=Math.min(...c.map(N=>N.y)),b=Math.max(...l.map(N=>N.y)),A=h-y,w=b-x;return{width:A,height:w,x:y,y:x,x2:h,y2:b,cx:y+A/2,cy:x+w/2,cz:Math.max(A,w)+Math.min(A,w)/2}},Ue=(e,t)=>Ut(e,t).segment,Xe=(e,t)=>Nt(e,t).segment,Lt=e=>Array.isArray(e)&&e.every(t=>{const s=t[0].toLowerCase();return nt[s]===t.length-1&&"achlmqstvz".includes(s)&&t.slice(1).every(Number.isFinite)})&&e.length>0,$e=e=>Lt(e)&&e.every(([t])=>t===t.toUpperCase()),ze=e=>$e(e)&&e.every(([t])=>"ACLMQZ".includes(t)),Je=e=>ze(e)&&e.every(([t])=>"MC".includes(t)),Ye=(e,t)=>{const{distance:s}=Nt(e,t);return Math.abs(s)Lt(e)&&e.slice(1).every(([t])=>t===t.toLowerCase()),qe=e=>{if(typeof e!="string"||!e.length)return!1;const t=new zt(e);for(st(t);t.index{let{x1:t,y1:s,x2:r,y2:n}=e;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t,s],["L",r,n]]},Ve=e=>{const t=[],s=(e.points||"").trim().split(/[\s|,]/).map(n=>+n);let r=0;for(;r{let{cx:t,cy:s,r}=e;return[t,s,r]=[t,s,r].map(n=>+n),[["M",t-r,s],["a",r,r,0,1,0,2*r,0],["a",r,r,0,1,0,-2*r,0]]},tn=e=>{let{cx:t,cy:s}=e,r=e.rx||0,n=e.ry||r;return[t,s,r,n]=[t,s,r,n].map(i=>+i),[["M",t-r,s],["a",r,n,0,1,0,2*r,0],["a",r,n,0,1,0,-2*r,0]]},en=e=>{const t=+e.x||0,s=+e.y||0,r=+e.width,n=+e.height;let i=+(e.rx||0),o=+(e.ry||i);return i||o?(i*2>r&&(i-=(i*2-r)/2),o*2>n&&(o-=(o*2-n)/2),[["M",t+i,s],["h",r-i*2],["s",i,0,i,o],["v",n-o*2],["s",0,o,-i,o],["h",-r+i*2],["s",-i,0,-i,-o],["v",-n+o*2],["s",0,-o,i,-o]]):[["M",t,s],["h",r],["v",n],["H",t],["Z"]]},ke=(e,t)=>{const r=(t||document).defaultView||window,n=Object.keys(ft),i=e instanceof r.SVGElement,o=i?e.tagName:null;if(o&&[...n,"path"].every(m=>o!==m))throw TypeError(`${I}: "${o}" is not SVGElement`);const a=i?o:e.type,c=ft[a],l={type:a};i?c.forEach(m=>{l[m]=e.getAttribute(m)}):Object.assign(l,e);let u=[];return a==="circle"?u=Ge(l):a==="ellipse"?u=tn(l):["polyline","polygon"].includes(a)?u=Ve(l):a==="rect"?u=en(l):a==="line"?u=We(l):["glyph","path"].includes(a)&&(u=E(i?e.getAttribute("d")||"":e.d||"")),Lt(u)&&u.length?u:!1},nn=(e,t,s)=>{const r=s||document,n=r.defaultView||window,i=Object.keys(ft),o=e instanceof n.SVGElement,a=o?e.tagName:null;if(a==="path")throw TypeError(`${I}: "${a}" is already SVGPathElement`);if(a&&i.every(x=>a!==x))throw TypeError(`${I}: "${a}" is not SVGElement`);const c=r.createElementNS("http://www.w3.org/2000/svg","path"),l=o?a:e.type,u=ft[l],m={type:l},f=K.round,y=ke(e,r),h=y&&y.length?jt(y,f):"";return o?(u.forEach(x=>{m[x]=e.getAttribute(x)}),Object.values(e.attributes).forEach(({name:x,value:b})=>{u.includes(x)||c.setAttribute(x,b)})):(Object.assign(m,e),Object.keys(m).forEach(x=>{!u.includes(x)&&x!=="type"&&c.setAttribute(x.replace(/[A-Z]/g,b=>`-${b.toLowerCase()}`),m[x])})),qe(h)?(c.setAttribute("d",h),t&&o&&(e.before(c,e),e.remove()),c):!1},Ie=e=>{let t=new C;const{origin:s}=e,[r,n]=s,{translate:i}=e,{rotate:o}=e,{skew:a}=e,{scale:c}=e;return Array.isArray(i)&&i.length>=2&&i.every(l=>!Number.isNaN(+l))&&i.some(l=>l!==0)?t=t.translate(...i):typeof i=="number"&&!Number.isNaN(i)&&(t=t.translate(i)),(o||a||c)&&(t=t.translate(r,n),Array.isArray(o)&&o.length>=2&&o.every(l=>!Number.isNaN(+l))&&o.some(l=>l!==0)?t=t.rotate(...o):typeof o=="number"&&!Number.isNaN(o)&&(t=t.rotate(o)),Array.isArray(a)&&a.length===2&&a.every(l=>!Number.isNaN(+l))&&a.some(l=>l!==0)?(t=a[0]?t.skewX(a[0]):t,t=a[1]?t.skewY(a[1]):t):typeof a=="number"&&!Number.isNaN(a)&&(t=t.skewX(a)),Array.isArray(c)&&c.length>=2&&c.every(l=>!Number.isNaN(+l))&&c.some(l=>l!==1)?t=t.scale(...c):typeof c=="number"&&!Number.isNaN(c)&&(t=t.scale(c)),t=t.translate(-r,-n)),t},Ee=(e,t,s,r)=>{const[n]=e,{round:i}=K,o=typeof i=="number"?i:4,a=t.slice(1),{x1:c,y1:l,x2:u,y2:m,x:f,y}=s,[h,x]=a.slice(-2),b=e;if("TQ".includes(n)||(s.qx=null,s.qy=null),n==="L"){if(z(f,o)===z(h,o))return["V",x];if(z(y,o)===z(x,o))return["H",h]}else if(n==="C"){const[A,w]=a;if(s.x1=A,s.y1=w,"CS".includes(r)&&(z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o)||z(c,o)===z(u*2-f,o)&&z(l,o)===z(m*2-y,o)))return["S",a[2],a[3],a[4],a[5]]}else if(n==="Q"){const[A,w]=a;if(s.qx=A,s.qy=w,"QT".includes(r)&&z(A,o)===z(c*2-u,o)&&z(w,o)===z(l*2-m,o))return["T",a[2],a[3]]}return b},vt=(e,t)=>{const s=e.slice(1).map(r=>z(r,t));return[e[0]].concat(s)},Re=(e,t)=>{const s=pt(e),r=typeof t=="number"&&t>=0?t:2,n={...U},i=[];let o="M",a="Z";return R(s,(c,l,u,m)=>{n.x=u,n.y=m;const f=W(c,n);let y=c;if([o]=c,i[l]=o,l){a=i[l-1];const x=Ee(c,f,n,a),b=vt(x,r),A=b.join(""),w=kt(x,l,u,m),N=vt(w,r),M=N.join("");y=A.length{let s=C.Translate(t[0],t[1],t[2]);return[,,,s.m44]=t,s=e.multiply(s),[s.m41,s.m42,s.m43,s.m44]},Xt=(e,t,s)=>{const[r,n,i]=s,[o,a,c]=sn(e,[t[0],t[1],0,1]),l=o-r,u=a-n,m=c-i;return[l*(Math.abs(i)/Math.abs(m)||1)+r,u*(Math.abs(i)/Math.abs(m)||1)+n]},rn=e=>{const t=e.slice(1).map((s,r,n)=>r?n[r-1].slice(-2).concat(s.slice(1)):e[0].slice(1).concat(s.slice(1))).map(s=>s.map((r,n)=>s[s.length-n-2*(1-n%2)])).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(s=>["C"].concat(s.slice(2))))},Tt=e=>{const t=pt(e),s=mt(t),r=t.length,n=t[r-1][0]==="Z",i=R(t,(o,a)=>{const c=s[a],l=a&&t[a-1],u=l&&l[0],m=t[a+1],f=m&&m[0],[y]=o,[h,x]=s[a?a-1:r-1].slice(-2);let b=o;switch(y){case"M":b=n?["Z"]:[y,h,x];break;case"A":b=[y,o[1],o[2],o[3],o[4],o[5]===1?0:1,h,x];break;case"C":m&&f==="S"?b=["S",o[1],o[2],h,x]:b=[y,o[3],o[4],o[1],o[2],h,x];break;case"S":u&&"CS".includes(u)&&(!m||f!=="S")?b=["C",c[3],c[4],c[1],c[2],h,x]:b=[y,c[1],c[2],h,x];break;case"Q":m&&f==="T"?b=["T",h,x]:b=[y,o[1],o[2],h,x];break;case"T":u&&"QT".includes(u)&&(!m||f!=="T")?b=["Q",c[1],c[2],h,x]:b=[y,h,x];break;case"Z":b=["M",h,x];break;case"H":b=[y,h];break;case"V":b=[y,x];break;default:b=[y].concat(o.slice(1,-2),h,x)}return b});return n?i.reverse():[i[0]].concat(i.slice(1).reverse())},on=(e,t)=>{let{round:s}=K;return s=t==="off"||typeof t=="number"&&t>=0?t:typeof s=="number"&&s>=0?s:"off",s==="off"?e.slice(0):R(e,r=>vt(r,s))},cn=(e,t=.5)=>{const s=t,r=e.slice(0,2),n=e.slice(2,4),i=e.slice(4,6),o=e.slice(6,8),a=Z(r,n,s),c=Z(n,i,s),l=Z(i,o,s),u=Z(a,c,s),m=Z(c,l,s),f=Z(u,m,s);return[["C",a[0],a[1],u[0],u[1],f[0],f[1]],["C",m[0],m[1],l[0],l[1],o[0],o[1]]]},je=e=>{const t=[];let s,r=-1,n=0,i=0,o=0,a=0;const c={...U};return e.forEach(l=>{const[u]=l,m=u.toUpperCase(),f=u.toLowerCase(),y=u===f,h=l.slice(1);m==="M"?(r+=1,[n,i]=h,n+=y?c.x:0,i+=y?c.y:0,o=n,a=i,s=[y?[m,o,a]:l]):(m==="Z"?(n=o,i=a):m==="H"?([,n]=l,n+=y?c.x:0):m==="V"?([,i]=l,i+=y?c.y:0):([n,i]=l.slice(-2),n+=y?c.x:0,i+=y?c.y:0),s.push(l)),c.x=n,c.y=i,t[r]=s}),t},Se=(e,t)=>{let s=0,r=0,n=0,i=0,o=0,a=0,c="M";const l={...U},u=E(e),m=t&&Object.keys(t);if(!t||m&&!m.length)return u.slice(0);t.origin||Object.assign(t,{origin:K.origin});const f=t.origin,y=Ie(t);return y.isIdentity?u.slice(0):R(u,(h,x,b,A)=>{l.x=b,l.y=A,[c]=h;const w=c.toUpperCase(),M=w!==c?qt(h,x,b,A):h.slice(0);let d=w==="A"?Rt(M,l):["V","H"].includes(w)?W(M,l):M;c=d[0];const v=c==="C"&&d.length>7,L=v?d.slice(0,7):d.slice(0);if(v&&(u.splice(x+1,0,["C"].concat(d.slice(7))),d=L),c==="L")[n,i]=Xt(y,[d[1],d[2]],f),s!==n&&r!==i?d=["L",n,i]:r===i?d=["H",n]:s===n&&(d=["V",i]);else for(o=1,a=d.length;o"u";if(n||!t.length)throw TypeError(`${I}: "pathValue" is ${n?"undefined":"empty"}`);this.segments=E(t);const{round:i,origin:o}=r;let a;Number.isInteger(i)||i==="off"?a=i:a=K.round;let c=K.origin;if(Array.isArray(o)&&o.length>=2){const[l,u,m]=o.map(Number);c=[Number.isNaN(l)?0:l,Number.isNaN(u)?0:u,Number.isNaN(m)?0:m]}return this.round=a,this.origin=c,this}get bbox(){return Pe(this.segments)}get length(){return rt(this.segments)}getBBox(){return this.bbox}getTotalLength(){return this.length}getPointAtLength(t){return ht(this.segments,t)}toAbsolute(){const{segments:t}=this;return this.segments=pt(t),this}toRelative(){const{segments:t}=this;return this.segments=me(t),this}toCurve(){const{segments:t}=this;return this.segments=bt(t),this}reverse(t){this.toAbsolute();const{segments:s}=this,r=je(s),n=r.length>1?r:!1,i=n?n.map((a,c)=>t?c?Tt(a):a.slice(0):Tt(a)):s.slice(0);let o=[];return n?o=i.flat(1):o=t?s:Tt(s),this.segments=o.slice(0),this}normalize(){const{segments:t}=this;return this.segments=mt(t),this}optimize(){const{segments:t}=this,s=this.round==="off"?2:this.round;return this.segments=Re(t,s),this}transform(t){if(!t||typeof t!="object"||typeof t=="object"&&!["translate","rotate","skew","scale"].some(c=>c in t))return this;const{segments:s,origin:[r,n,i]}=this,o={};for(const[c,l]of Object.entries(t))c==="skew"&&Array.isArray(l)||(c==="rotate"||c==="translate"||c==="origin"||c==="scale")&&Array.isArray(l)?o[c]=l.map(Number):c!=="origin"&&typeof Number(l)=="number"&&(o[c]=Number(l));const{origin:a}=o;if(Array.isArray(a)&&a.length>=2){const[c,l,u]=a.map(Number);o.origin=[Number.isNaN(c)?r:c,Number.isNaN(l)?n:l,u||i]}else o.origin=[r,n,i];return this.segments=Se(s,o),this}flipX(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[0,180,0],origin:[t,s,0]}),this}flipY(){const{cx:t,cy:s}=this.bbox;return this.transform({rotate:[180,0,0],origin:[t,s,0]}),this}toString(){return jt(this.segments,this.round)}}return p(g,"CSSMatrix",C),p(g,"pathToAbsolute",pt),p(g,"pathToRelative",me),p(g,"pathToCurve",bt),p(g,"pathToString",jt),p(g,"arcTools",Oe),p(g,"bezierTools",{Cvalues:xe,Tvalues:Bt,minmaxC:_t,minmaxQ:Mt,getBezierLength:ut,bezierLength:de,calculateBezier:be,computeBezier:pe,deriveBezier:ge,CBEZIER_MINMAX_EPSILON:Ae}),p(g,"cubicTools",{getCubicLength:Ft,getCubicBBox:Ne,getPointAtCubicLength:we,getPointAtCubicSegmentLength:Me}),p(g,"lineTools",{getPointAtLineLength:St,getLineBBox:Dt,getLineLength:lt}),p(g,"quadTools",{getPointAtQuadSegmentLength:Le,getQuadLength:Ht,getQuadBBox:Te,getPointAtQuadLength:ve}),p(g,"polygonTools",{polygonArea:Qe,polygonLength:Be}),p(g,"distanceSquareRoot",dt),p(g,"distanceEpsilon",wt),p(g,"midPoint",Z),p(g,"rotateVector",at),p(g,"roundTo",z),p(g,"finalizeSegment",Pt),p(g,"invalidPathValue",H),p(g,"isArcCommand",le),p(g,"isDigit",F),p(g,"isDigitStart",ae),p(g,"isMoveCommand",ue),p(g,"isPathCommand",ce),p(g,"isSpace",oe),p(g,"paramsCount",nt),p(g,"paramsParser",U),p(g,"pathParser",zt),p(g,"scanFlag",re),p(g,"scanParam",ie),p(g,"scanSegment",$t),p(g,"skipSpaces",st),p(g,"getPathBBox",Pe),p(g,"getPathArea",Ce),p(g,"getTotalLength",rt),p(g,"getDrawDirection",He),p(g,"getPointAtLength",ht),p(g,"getPropertiesAtLength",Ut),p(g,"getPropertiesAtPoint",Nt),p(g,"getClosestPoint",_e),p(g,"getSegmentOfPoint",Xe),p(g,"getSegmentAtLength",Ue),p(g,"isPointInStroke",Ye),p(g,"isValidPath",qe),p(g,"isPathArray",Lt),p(g,"isAbsoluteArray",$e),p(g,"isRelativeArray",Ke),p(g,"isCurveArray",Je),p(g,"isNormalizedArray",ze),p(g,"shapeToPath",nn),p(g,"shapeToPathArray",ke),p(g,"shapeParams",ft),p(g,"parsePathString",E),p(g,"absolutizeSegment",qt),p(g,"arcToCubic",It),p(g,"getSVGMatrix",Ie),p(g,"iterate",R),p(g,"lineToCubic",Et),p(g,"normalizePath",mt),p(g,"normalizeSegment",W),p(g,"optimizePath",Re),p(g,"projection2d",Xt),p(g,"quadToCubic",he),p(g,"relativizeSegment",kt),p(g,"reverseCurve",rn),p(g,"reversePath",Tt),p(g,"roundPath",on),p(g,"roundSegment",vt),p(g,"segmentToCubic",Rt),p(g,"shortenSegment",Ee),p(g,"splitCubic",cn),p(g,"splitPath",je),p(g,"transformPath",Se),g}(); //# sourceMappingURL=svg-path-commander.js.map diff --git a/docs/svg-path-commander.js.map b/docs/svg-path-commander.js.map index e5a7467..e5a82e0 100644 --- a/docs/svg-path-commander.js.map +++ b/docs/svg-path-commander.js.map @@ -1 +1 @@ -{"version":3,"file":"svg-path-commander.js","sources":["../src/options/options.ts","../src/parser/error.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/math/polygonArea.ts","../src/math/distanceSquareRoot.ts","../src/math/polygonLength.ts","../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/parser/paramsParser.ts","../src/process/iterate.ts","../src/process/absolutizeSegment.ts","../src/process/normalizeSegment.ts","../src/math/midPoint.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/util/getPathBBox.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/convert/pathToCurve.ts","../src/util/getPathArea.ts","../src/util/getTotalLength.ts","../src/util/getDrawDirection.ts","../src/util/distanceEpsilon.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/process/normalizePath.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getSegmentOfPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/isPointInStroke.ts","../src/util/isValidPath.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isRelativeArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/process/roundPath.ts","../src/convert/pathToString.ts","../src/util/shapeToPath.ts","../src/process/splitPath.ts","../src/process/getSVGMatrix.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/process/shortenSegment.ts","../src/process/optimizePath.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/projection2d.ts","../src/process/transformPath.ts","../src/process/splitCubic.ts","../src/index.ts"],"sourcesContent":["import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let LK = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[LK]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (LK === 'm' && data.length > 2) {\n path.segments.push([pathCommand, ...(data.splice(0, 2) as number[])] as PathSegment);\n LK = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push([pathCommand, ...(data.splice(0, paramsCount[LK]) as number[])] as PathSegment);\n }\n\n if (!paramsCount[LK]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: any[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | PathArray) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as PathArray;\n // return pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]): number => {\n const n = polygon.length;\n let i = -1;\n let a;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\nexport default polygonArea;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple): number => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import { type PointTuple } from '../types';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns {number} the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]): number => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport default polygonLength;\n","var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n const allPathCommands = [] as PathCommand[];\n const params = { ...paramsParser };\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n allPathCommands[i] = pathCommand;\n const iteratorResult = iterator(segment, params, i);\n path[i] = iteratorResult;\n\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n\n segment = path[i];\n const seglen = segment.length;\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n }\n // console.log('iteration: ', ...path)\n return path as T;\n};\n\nexport default iterate;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (!isAbsolute) {\n if (absCommand === 'A') {\n return [\n absCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] + x,\n values[6] + y,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, values[0] + y] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, values[0] + x] as HSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = values.map((n, j) => n + (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [absCommand, ...absValues] as MSegment | QSegment | TSegment | SSegment | CSegment;\n }\n }\n\n return segment as AbsoluteSegment;\n};\nexport default absolutizeSegment;\n","import type { ParserParams } from '../interface';\nimport type { NormalSegment, PointTuple, PathSegment, QSegment, CSegment, LSegment } from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const { x1: px1, y1: py1, x2: px2, y2: py2 } = params;\n const values = segment.slice(1).map(Number);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'H') {\n return ['L', segment[1], py1] as LSegment;\n } else if (pathCommand === 'V') {\n return ['L', px1, segment[1]] as LSegment;\n } else if (pathCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1, ...values] as CSegment;\n } else if (pathCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy, ...values] as QSegment;\n } else if (pathCommand === 'Q') {\n const [nqx, nqy] = values as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n }\n\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nexport const getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nexport const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nexport const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst ellipticalArcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const arcLength = Math.sqrt(term1 + term2) * theta;\n return Math.abs(arcLength);\n};\n\n/**\n * Compute point on ellipse from angle around ellipse (theta);\n * @param theta the arc sweep angle\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the angle\n * @returns a point around ellipse\n */\nconst arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alpha: number) => {\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cos = Math.cos(alpha);\n const sin = Math.sin(alpha);\n const x = rx * Math.cos(theta);\n const y = ry * Math.sin(theta);\n\n return {\n x: cx + cos * x - sin * y,\n y: cy + sin * x + cos * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n const angle = sign * Math.acos(p / n);\n\n return angle;\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle\n * and radiuses on X and Y coordinates.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // to be used later\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n // point.length = ellipticalArcLength(rx, ry, sweepAngle);\n // point.box = minmax(center.x, center.y, rx, ry, xRotRad, startAngle, startAngle + sweepAngle);\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nexport const getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return ellipticalArcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nexport const getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const length = ellipticalArcLength(rx, ry, endAngle - startAngle);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the bounding box for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nexport const getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const [cx, cy] = [center.x, center.y];\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * Math.PI) / 180;\n const tan = Math.tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = Math.atan2(-ry * tan, rx);\n const angle1 = theta;\n const angle2 = theta + Math.PI;\n const angle3 = Math.atan2(ry, rx * tan);\n const angle4 = angle3 + Math.PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = Math.min(...xArr);\n const xMax = Math.max(...xArr);\n const yMin = Math.min(...yArr);\n const yMax = Math.max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arc(angleAfterStart, cx, cy, rx, ry, alpha);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arc(angleBeforeEnd, cx, cy, rx, ry, alpha);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arc(angle1, cx, cy, rx, ry, alpha));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arc(angle2, cx, cy, rx, ry, alpha));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arc(angle4, cx, cy, rx, ry, alpha));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arc(angle3, cx, cy, rx, ry, alpha));\n }\n\n return {\n min: {\n x: Math.min(...extremes.map(n => n.x)),\n y: Math.min(...extremes.map(n => n.y)),\n },\n max: {\n x: Math.max(...extremes.map(n => n.x)),\n y: Math.max(...extremes.map(n => n.y)),\n },\n };\n};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst ZERO = { x: 0, y: 0 };\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst derive = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], ZERO as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst arcfn = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst lengthFn = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * arcfn(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nexport const length = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = derive(points);\n return lengthFn((t: number) => {\n return compute(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nexport const minmaxQ = (A: [number, number, number]) => {\n const min = Math.min(A[0], A[2]);\n const max = Math.max(A[0], A[2]);\n\n /* istanbul ignore next @preserve */\n if (A[1] >= A[0] ? A[2] >= A[1] : A[2] <= A[1]) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (A[0] * A[2] - A[1] * A[1]) / (A[0] - 2 * A[1] + A[2]);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nexport const minmaxC = (A: [number, number, number, number]) => {\n const K = A[0] - 3 * A[1] + 3 * A[2] - A[3];\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (A[0] === A[3] && A[0] === A[1]) {\n // no curve, point targeting same location\n return [A[0], A[3]] as PointTuple;\n }\n\n return minmaxQ([A[0], -0.5 * A[0] + 1.5 * A[1], A[0] - 3 * A[1] + 3 * A[2]]);\n }\n\n // the reduced discriminant of the derivative\n const T = -A[0] * A[2] + A[0] * A[3] - A[1] * A[2] - A[1] * A[3] + A[1] * A[1] + A[2] * A[2];\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(A[0], A[3]), Math.max(A[0], A[3])] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(A[0], A[3]);\n let max = Math.max(A[0], A[3]);\n\n const L = A[0] - 2 * A[1] + A[2];\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n A[0] * (1 - R) * (1 - R) * (1 - R) +\n A[1] * 3 * (1 - R) * (1 - R) * R +\n A[2] * 3 * (1 - R) * R * R +\n A[3] * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n","import { length, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a {x,y} point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nexport const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nexport const getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nexport const getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import { length, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nexport const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return length([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nexport const getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = length([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nexport const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n Point,\n PointTuple,\n QuadCoordinates,\n} from '../types';\n// import pathFactory from './pathFactory';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport parsePathString from '../parser/parsePathString';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n data = [x, y, ...normalSegment.slice(1)] as number[];\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(...(data as ArcCoordinates)));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(...(data as CubicCoordinates)));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(...(data as QuadCoordinates)));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n ({ min, max } = getLineBBox(...(data as LineCoordinates)));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const X = x * Math.cos(rad) - y * Math.sin(rad);\n const Y = x * Math.sin(rad) + y * Math.cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [...m2, ...m3, ...m4, ...res];\n }\n res = [...m2, ...m3, ...m4, ...res];\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [...c1, ...c2, x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n args = [px1, py1, ...values] as [number, number, number, number, number, number, number, number, number];\n return ['C', ...arcToCubic(...args)] as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n args = [px1, py1, ...values] as [number, number, number, number, number, number];\n return ['C', ...quadToCubic(...args)] as CSegment;\n } else if (pathCommand === 'L') {\n return ['C', ...lineToCubic(px1, py1, x, y)] as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C', ...lineToCubic(px1, py1, px, py)] as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport absolutizeSegment from '../process/absolutizeSegment';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n const path = parsePathString(pathInput);\n return iterate(path, (seg, params, i) => {\n const absSegment = absolutizeSegment(seg, params);\n [pathCommand] = absSegment;\n\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const normalSegment = normalizeSegment(absSegment, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToCurve;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray, QuadCoordinates } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, ...(seg.slice(1) as QuadCoordinates));\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\n// import pathFactory from './pathFactory';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n totalLength += getLineLength(...(data as LineCoordinates));\n }\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (isM) {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport parsePathString from '../parser/parsePathString';\nimport type {\n ArcCoordinates,\n CubicCoordinates,\n LineCoordinates,\n MSegment,\n PathArray,\n PointTuple,\n QuadCoordinates,\n} from '../types';\nimport iterate from '../process/iterate';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport normalizeSegment from '../process/normalizeSegment';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = parsePathString(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber) return point;\n\n if (distance < DISTANCE_EPSILON) {\n POINT = point;\n }\n\n iterate(path, (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const normalSegment = normalizeSegment(absoluteSegment, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(...(data as LineCoordinates), distance - totalLength);\n length = getLineLength(...(data as LineCoordinates));\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(...(data as ArcCoordinates), distance - totalLength);\n length = getArcLength(...(data as ArcCoordinates));\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(...(data as CubicCoordinates), distance - totalLength);\n length = getCubicLength(...(data as CubicCoordinates));\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(...(data as QuadCoordinates), distance - totalLength);\n length = getQuadLength(...(data as QuadCoordinates));\n } else if (pathCommand === 'Z') {\n data = [x, y, mx, my];\n point = { x: mx, y: my };\n length = getLineLength(...(data as LineCoordinates));\n }\n\n if (totalLength < distance && totalLength + length >= distance) {\n POINT = point;\n }\n\n totalLength += length;\n if (pathCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = normalSegment.slice(-2) as PointTuple;\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n return normalSegment;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n POINT = { x, y };\n }\n\n return POINT;\n};\nexport default getPointAtLength;\n","import type { PointTuple, PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n const [x, y] = segment.slice(-2) as PointTuple;\n const point = { x, y };\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n point,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n return {\n segment: pathArray[index],\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import normalizeSegment from './normalizeSegment';\nimport type { AbsoluteCommand, NormalArray, PathArray, PointTuple } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Normalizes a `path` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n\n return iterate(parsePathString(pathInput), (seg, params) => {\n const absoluteSegment = absolutizeSegment(seg, params);\n const result = normalizeSegment(absoluteSegment, params);\n [pathCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n // const seglen = result.length;\n // params.x1 = +result[seglen - 2];\n // params.y1 = +result[seglen - 1];\n // params.x2 = +result[seglen - 4] || params.x1;\n // params.y2 = +result[seglen - 3] || params.y1;\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default normalizePath;\n","import type { PathArray } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: { x: number; y: number }): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(path);\n const distanceTo = (p: { x: number; y: number }) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: { x: number; y: number };\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n if (roundOption === 'off' || round === 'off') return path.slice(0) as PathArray;\n // allow for ZERO decimals\n round = typeof roundOption === 'number' && roundOption >= 0 ? roundOption : round;\n // to round values to the power\n // the `round` value must be integer\n const pow = typeof round === 'number' && round >= 1 ? 10 ** round : 1;\n\n return iterate(path, segment => {\n const values = (segment.slice(1) as number[]).map(n => (round ? Math.round(n * pow) / pow : Math.round(n)));\n return [segment[0], ...values] as PathSegment;\n });\n};\nexport default roundPath;\n","import type { PathArray } from '../types';\nimport roundPath from '../process/roundPath';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param round amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, round?: number | 'off'): string => {\n return roundPath(path, round)\n .map(x => x[0] + x.slice(1).join(' '))\n .join('');\n};\nexport default pathToString;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, AbsoluteCommand, HSegment, PathArray, PointTuple, VSegment } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params) => {\n [pathCommand] = seg;\n const result = absolutizeSegment(seg, params);\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as HSegment;\n } else if (absCommand === 'V') {\n [, y] = result as VSegment;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n return result;\n });\n};\nexport default pathToAbsolute;\n","import type { ParserParams } from '../interface';\nimport type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param params the coordinates of the previous segment\n * @param index the segment index\n * @returns the absolute segment\n */\nconst relativizeSegment = (segment: PathSegment, params: ParserParams, index: number) => {\n const [pathCommand] = segment;\n const { x, y } = params;\n const values = segment.slice(1).map(Number);\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n\n if (index === 0 && pathCommand === 'M') {\n return segment;\n }\n\n /* istanbul ignore else @preserve */\n if (pathCommand !== relCommand) {\n if (relCommand === 'a') {\n return [\n relCommand,\n values[0],\n values[1],\n values[2],\n values[3],\n values[4],\n values[5] - x,\n values[6] - y,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, values[0] - y] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, values[0] - x] as hSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = values.map((n, j) => n - (j % 2 ? y : x));\n // for n, l, c, s, q, t\n return [relCommand, ...relValues] as qSegment | tSegment | sSegment | cSegment;\n }\n }\n\n return segment as RelativeSegment;\n};\nexport default relativizeSegment;\n","import type {\n AbsoluteCommand,\n hSegment,\n PathArray,\n PointTuple,\n RelativeArray,\n RelativeCommand,\n vSegment,\n} from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let pathCommand = 'M';\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, params, i) => {\n [pathCommand] = seg;\n const result = relativizeSegment(seg, params, i);\n const [resultedCommand] = result;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = resultedCommand === relCommand;\n\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = result as hSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = result as vSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = result.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n params.x = x;\n params.y = y;\n\n return result;\n });\n};\nexport default pathToRelative;\n","import type { ParserParams } from '../interface';\nimport type {\n AbsoluteSegment,\n HSegment,\n NormalSegment,\n PathCommand,\n ShortSegment,\n SSegment,\n TSegment,\n VSegment,\n ZSegment,\n} from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const round4 = (n: number) => Math.round(n * 10 ** 4) / 10 ** 4;\n const segmentValues = segment.slice(1) as number[];\n const normalValues = normalSegment.slice(1) as number[];\n const { x1: px1, y1: py1, x2: px2, y2: py2, x: px, y: py } = params;\n let result = segment;\n const [x, y] = normalValues.slice(-2);\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)) {\n result = [pathCommand, ...segmentValues] as VSegment | HSegment | SSegment | TSegment | ZSegment;\n } else if (pathCommand === 'L') {\n if (round4(px) === round4(x)) {\n result = ['V', y];\n } else if (round4(py) === round4(y)) {\n result = ['H', x];\n }\n } else if (pathCommand === 'C') {\n const [x1, y1] = normalValues;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((round4(x1) === round4(px1 * 2 - px2) && round4(y1) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['S', ...normalValues.slice(-4)] as SSegment;\n }\n params.x1 = x1;\n params.y1 = y1;\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n ((round4(qx) === round4(px1 * 2 - px2) && round4(qy) === round4(py1 * 2 - py2)) ||\n (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py)))\n ) {\n result = ['T', ...normalValues.slice(-2)] as TSegment;\n }\n }\n\n return result as ShortSegment;\n};\nexport default shortenSegment;\n","import roundPath from './roundPath';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport pathToRelative from '../convert/pathToRelative';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport normalizePath from './normalizePath';\nimport type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteSegment } from '../types';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param round the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, round: 'off' | number): PathArray => {\n const path = pathToAbsolute(pathInput);\n const normalPath = normalizePath(path);\n const params = { ...paramsParser };\n const allPathCommands = [] as PathCommand[];\n const ii = path.length;\n let pathCommand = '' as PathCommand;\n let prevCommand = '' as PathCommand;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n\n for (let i = 0; i < ii; i += 1) {\n [pathCommand] = path[i];\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n // Get previous path command for `shortenSegment`\n if (i) prevCommand = allPathCommands[i - 1];\n path[i] = shortenSegment(path[i], normalPath[i], params, prevCommand) as AbsoluteSegment;\n\n const segment = path[i];\n const seglen = segment.length;\n\n // update C, S, Q, T specific params\n params.x1 = +segment[seglen - 2];\n params.y1 = +segment[seglen - 1];\n params.x2 = +segment[seglen - 4] || params.x1;\n params.y2 = +segment[seglen - 3] || params.y1;\n\n // update x, y params\n switch (pathCommand) {\n case 'Z':\n x = mx;\n y = my;\n break;\n case 'H':\n [, x] = segment as HSegment;\n break;\n case 'V':\n [, y] = segment as VSegment;\n break;\n default:\n [x, y] = segment.slice(-2).map(Number);\n\n if (pathCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n params.x = x;\n params.y = y;\n }\n\n const absolutePath = roundPath(path, round);\n const relativePath = roundPath(pathToRelative(path), round);\n\n return absolutePath.map((a: PathSegment, i: number) => {\n if (i) {\n return a.join('').length < relativePath[i].join('').length ? a : relativePath[i];\n }\n return a;\n }) as PathArray;\n};\nexport default optimizePath;\n","import type { CurveArray } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray): CurveArray => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? [...path[0].slice(1), ...x.slice(1)] : [...curveOnly[i - 1].slice(-2), ...x.slice(1)],\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse();\n\n return [['M', ...rotatedCurve[0].slice(0, 2)], ...rotatedCurve.map(x => ['C', ...x.slice(2)])] as CurveArray;\n};\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray): PathArray => {\n const absolutePath = pathToAbsolute(pathInput);\n const isClosed = absolutePath.slice(-1)[0][0] === 'Z';\n\n const reversedPath = normalizePath(absolutePath)\n .map((segment, i) => {\n const [x, y] = segment.slice(-2).map(Number);\n return {\n seg: absolutePath[i], // absolute\n n: segment, // normalized\n c: absolutePath[i][0], // pathCommand\n x, // x\n y, // y\n };\n })\n .map((seg, i, path) => {\n const segment = seg.seg;\n const data = seg.n;\n const prevSeg = i && path[i - 1];\n const nextSeg = path[i + 1];\n const pathCommand = seg.c;\n const pLen = path.length;\n const x = i ? path[i - 1].x : path[pLen - 1].x;\n const y = i ? path[i - 1].y : path[pLen - 1].y;\n let result = [];\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [pathCommand, ...segment.slice(1, -3), segment[5] === 1 ? 0 : 1, x, y] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextSeg.c === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevSeg && 'CS'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'S')) {\n result = ['C', data[3], data[4], data[1], data[2], x, y] as CSegment;\n } else {\n result = [pathCommand, data[1], data[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextSeg.c === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, ...segment.slice(1, -2), x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevSeg && 'QT'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'T')) {\n result = ['Q', data[1], data[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand, ...segment.slice(1, -2), x, y] as PathSegment;\n }\n\n return result;\n });\n\n return (isClosed ? reversedPath.reverse() : [reversedPath[0], ...reversedPath.slice(1).reverse()]) as PathArray;\n};\nexport default reversePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(...(v.slice(0, -1) as [number, number, number]));\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [...point2D, 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, CSegment, PathArray, PointTuple, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from './absolutizeSegment';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let lx = 0;\n let ly = 0;\n let j = 0;\n let jj = 0;\n let nx = 0;\n let ny = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path;\n\n return iterate(path, (seg, _, i) => {\n const absSegment = absolutizeSegment(seg, transformParams);\n [pathCommand] = absSegment;\n\n let result =\n pathCommand === 'A'\n ? segmentToCubic(absSegment, transformParams)\n : ['V', 'H'].includes(pathCommand)\n ? normalizeSegment(absSegment, transformParams)\n : absSegment;\n const isLongArc = result[0] === 'C' && result.length > 7;\n const normalizedSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as typeof result;\n\n if (isLongArc) {\n path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n if (result[0] === 'L') {\n const values = result.slice(-2) as PointTuple;\n [lx, ly] = projection2d(matrixInstance, values, origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n if (pathCommand === 'Z') {\n nx = mx;\n ny = my;\n } else {\n [nx, ny] = normalizedSegment.slice(-2) as PointTuple;\n if (pathCommand === 'M') {\n mx = nx;\n my = ny;\n }\n }\n\n const seglen = normalizedSegment.length;\n transformParams.x1 = +normalizedSegment[seglen - 2];\n transformParams.y1 = +normalizedSegment[seglen - 1];\n transformParams.x2 = +normalizedSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +normalizedSegment[seglen - 3] || transformParams.y1;\n transformParams.x = nx;\n transformParams.y = ny;\n return result;\n });\n};\n\nexport default transformPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', ...p4, ...p7, ...p9],\n ['C', ...p8, ...p6, ...p3],\n ];\n};\nexport default splitCubic;\n","'use strict';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\n\nimport polygonArea from './math/polygonArea';\nimport polygonLength from './math/polygonLength';\n\nimport CSSMatrix from '@thednp/dommatrix';\nimport getPathBBox from './util/getPathBBox';\nimport getPathArea from './util/getPathArea';\nimport getTotalLength from './util/getTotalLength';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPointAtLength from './util/getPointAtLength';\n\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getClosestPoint from './util/getClosestPoint';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport isPointInStroke from './util/isPointInStroke';\n\nimport isValidPath from './util/isValidPath';\nimport isPathArray from './util/isPathArray';\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isRelativeArray from './util/isRelativeArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport shapeToPathArray from './util/shapeToPathArray';\nimport shapeToPath from './util/shapeToPath';\n\nimport roundPath from './process/roundPath';\nimport splitPath from './process/splitPath';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport optimizePath from './process/optimizePath';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport normalizePath from './process/normalizePath';\nimport transformPath from './process/transformPath';\nimport splitCubic from './process/splitCubic';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static getSVGMatrix = getSVGMatrix;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static polygonLength = polygonLength;\n public static polygonArea = polygonArea;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static parsePathString = parsePathString;\n public static roundPath = roundPath;\n public static splitPath = splitPath;\n public static splitCubic = splitCubic;\n public static optimizePath = optimizePath;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static normalizePath = normalizePath;\n public static transformPath = transformPath;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n const segments = parsePathString(pathValue);\n this.segments = segments;\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n\n this.segments = optimizePath(segments, this.round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["defaultOptions","error","paramsCount","finalizeSegment","path","pathCommand","LK","data","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","i","PathParser","pathString","parsePathString","pathInput","polygonArea","polygon","n","a","b","area","distanceSquareRoot","polygonLength","length","point","Z","z","s","e","p","$","E","P","y","g","r","l","m","h","c","f","w","o","d","A","M","X","O","x","Y","F","T","k","I","v","R","D","N","paramsParser","iterate","iterator","params","pathLen","segment","iteratorResult","seglen","absolutizeSegment","values","absCommand","absValues","j","normalizeSegment","px1","py1","px2","py2","x1","y1","qx","qy","nqx","nqy","midPoint","t","ax","ay","bx","by","getLineLength","x2","y2","getPointAtLineLength","distance","getLineBBox","min","ellipticalArcLength","rx","ry","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcLength","arc","cx","cy","alpha","cos","sin","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","RX","RY","angle","LAF","SF","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","extremes","tan","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","ZERO","Tvalues","Cvalues","derive","points","dpoints","list","compute","order","mt","mt2","t2","arcfn","derivativeFn","lengthFn","len","sum","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","minmaxC","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","getPathBBox","mx","my","MIN","MAX","seg","absoluteSegment","normalSegment","width","height","rotateVector","rad","arcToCubic","X1","Y1","X2","Y2","recursive","d120","res","xy","f1","f2","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","r13","r23","lineToCubic","segmentToCubic","args","px","py","pathToCurve","absSegment","result","getCubicSegArea","getPathArea","getTotalLength","isM","totalLength","getDrawDirection","DISTANCE_EPSILON","getPointAtLength","POINT","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","normalizePath","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getSegmentOfPoint","getSegmentAtLength","isPointInStroke","isValidPath","isPathArray","lk","isAbsoluteArray","isRelativeArray","pc","isNormalizedArray","isCurveArray","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","roundPath","roundOption","round","pow","pathToString","shapeToPath","replace","doc","description","name","value","splitPath","composite","pi","relCommand","isRelative","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","pathToAbsolute","relativizeSegment","relValues","pathToRelative","resultedCommand","shortenSegment","prevCommand","round4","segmentValues","normalValues","optimizePath","allPathCommands","absolutePath","relativePath","reverseCurve","rotatedCurve","curveOnly","_","reversePath","isClosed","reversedPath","prevSeg","nextSeg","pLen","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","transformPath","lx","ly","jj","nx","ny","transformParams","transformProps","matrixInstance","isLongArc","normalizedSegment","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField"],"mappings":"qNAGA,MAAMA,EAA0B,CAC9B,OAAQ,CAAC,EAAG,EAAG,CAAC,EAChB,MAAO,CACT,ECNMC,EAAQ,yBCCRC,EAAc,CAClB,EAAG,EAC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,kBAAkBxG,IAChCkH,EApBIV,EAoBU,eAAerG,IAC7B+G,EArBIV,EAqBU,oBAAoBtG,IAClCgH,EAtBIV,EAsBU,cAAc9E,IAC5BwF,EAvBIV,EAuBU,mBAAmB7F,IACjCuG,EAxBIV,EAwBU,kBAAkBvY,GAChCiZ,EAzBIV,EAyBU,YAAYnF,IAC1B6F,EA1BIV,EA0BU,YAAYxE,IAC1BkF,EA3BIV,EA2BU,aAAab,IAC3BuB,EA5BIV,EA4BU,eAAe9C,IAC7BwD,EA7BIV,EA6BU,eAAe1C,IAC7BoD,EA9BIV,EA8BU,cAActC,IAC5BgD,EA/BIV,EA+BU,gBAAgBjI,IAC9B2I,EAhCIV,EAgCU,gBAAgBxB,IAC9BkC,EAjCIV,EAiCU,iBAAiBxD,IAC/BkE,EAlCIV,EAkCU,iBAAiBrD,IAC/B+D,EAnCIV,EAmCU,cAAclJ,IAC5B4J,EApCIV,EAoCU,eAAe/E","x_google_ignoreList":[20]} \ No newline at end of file +{"version":3,"file":"svg-path-commander.js","sources":["../node_modules/.pnpm/@thednp+dommatrix@2.0.8/node_modules/@thednp/dommatrix/dist/dommatrix.mjs","../src/options/options.ts","../src/parser/paramsCount.ts","../src/parser/finalizeSegment.ts","../src/parser/error.ts","../src/parser/scanFlag.ts","../src/parser/isDigit.ts","../src/parser/invalidPathValue.ts","../src/parser/scanParam.ts","../src/parser/isSpace.ts","../src/parser/skipSpaces.ts","../src/parser/isPathCommand.ts","../src/parser/isDigitStart.ts","../src/parser/isArcCommand.ts","../src/parser/isMoveCommand.ts","../src/parser/scanSegment.ts","../src/parser/pathParser.ts","../src/parser/parsePathString.ts","../src/process/absolutizeSegment.ts","../src/process/iterate.ts","../src/convert/pathToAbsolute.ts","../src/process/relativizeSegment.ts","../src/convert/pathToRelative.ts","../src/math/rotateVector.ts","../src/process/arcToCubic.ts","../src/process/quadToCubic.ts","../src/math/midPoint.ts","../src/process/lineToCubic.ts","../src/process/segmentToCubic.ts","../src/process/normalizeSegment.ts","../src/parser/paramsParser.ts","../src/convert/pathToCurve.ts","../src/math/roundTo.ts","../src/convert/pathToString.ts","../src/math/distanceSquareRoot.ts","../src/math/lineTools.ts","../src/math/arcTools.ts","../src/math/bezier.ts","../src/math/cubicTools.ts","../src/math/quadTools.ts","../src/math/polygonTools.ts","../src/util/distanceEpsilon.ts","../src/process/normalizePath.ts","../src/util/getPointAtLength.ts","../src/util/getTotalLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getClosestPoint.ts","../src/util/getPathArea.ts","../src/util/getDrawDirection.ts","../src/util/getPathBBox.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isPathArray.ts","../src/util/isAbsoluteArray.ts","../src/util/isNormalizedArray.ts","../src/util/isCurveArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/util/shapeParams.ts","../src/util/shapeToPathArray.ts","../src/util/shapeToPath.ts","../src/process/getSVGMatrix.ts","../src/process/shortenSegment.ts","../src/process/roundSegment.ts","../src/process/optimizePath.ts","../src/process/projection2d.ts","../src/process/reverseCurve.ts","../src/process/reversePath.ts","../src/process/roundPath.ts","../src/process/splitCubic.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/index.ts"],"sourcesContent":["var Z = Object.defineProperty;\nvar z = (s, t, e) => t in s ? Z(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;\nvar p = (s, t, e) => z(s, typeof t != \"symbol\" ? t + \"\" : t, e);\nconst $ = {\n a: 1,\n b: 0,\n c: 0,\n d: 1,\n e: 0,\n f: 0,\n m11: 1,\n m12: 0,\n m13: 0,\n m14: 0,\n m21: 0,\n m22: 1,\n m23: 0,\n m24: 0,\n m31: 0,\n m32: 0,\n m33: 1,\n m34: 0,\n m41: 0,\n m42: 0,\n m43: 0,\n m44: 1,\n is2D: !0,\n isIdentity: !0\n}, E = (s) => (s instanceof Float64Array || s instanceof Float32Array || Array.isArray(s) && s.every((t) => typeof t == \"number\")) && [6, 16].some((t) => s.length === t), P = (s) => s instanceof DOMMatrix || s instanceof y || typeof s == \"object\" && Object.keys($).every((t) => s && t in s), g = (s) => {\n const t = new y(), e = Array.from(s);\n if (!E(e))\n throw TypeError(`CSSMatrix: \"${e.join(\",\")}\" must be an array with 6/16 numbers.`);\n // istanbul ignore else @preserve\n if (e.length === 16) {\n const [n, i, r, a, l, m, h, c, u, f, w, o, d, A, M, b] = e;\n t.m11 = n, t.a = n, t.m21 = l, t.c = l, t.m31 = u, t.m41 = d, t.e = d, t.m12 = i, t.b = i, t.m22 = m, t.d = m, t.m32 = f, t.m42 = A, t.f = A, t.m13 = r, t.m23 = h, t.m33 = w, t.m43 = M, t.m14 = a, t.m24 = c, t.m34 = o, t.m44 = b;\n } else if (e.length === 6) {\n const [n, i, r, a, l, m] = e;\n t.m11 = n, t.a = n, t.m12 = i, t.b = i, t.m21 = r, t.c = r, t.m22 = a, t.d = a, t.m41 = l, t.e = l, t.m42 = m, t.f = m;\n }\n return t;\n}, X = (s) => {\n if (P(s))\n return g([\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n ]);\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a DOMMatrix / CSSMatrix / JSON compatible object.`);\n}, O = (s) => {\n if (typeof s != \"string\")\n throw TypeError(`CSSMatrix: \"${JSON.stringify(s)}\" is not a string.`);\n const t = String(s).replace(/\\s/g, \"\");\n let e = new y();\n const n = `CSSMatrix: invalid transform string \"${s}\"`;\n return t.split(\")\").filter((i) => i).forEach((i) => {\n const [r, a] = i.split(\"(\");\n if (!a) throw TypeError(n);\n const l = a.split(\",\").map((o) => o.includes(\"rad\") ? parseFloat(o) * (180 / Math.PI) : parseFloat(o)), [m, h, c, u] = l, f = [m, h, c], w = [m, h, c, u];\n if (r === \"perspective\" && m && [h, c].every((o) => o === void 0))\n e.m34 = -1 / m;\n else if (r.includes(\"matrix\") && [6, 16].includes(l.length) && l.every((o) => !Number.isNaN(+o))) {\n const o = l.map((d) => Math.abs(d) < 1e-6 ? 0 : d);\n e = e.multiply(g(o));\n } else if (r === \"translate3d\" && f.every((o) => !Number.isNaN(+o)))\n e = e.translate(m, h, c);\n else if (r === \"translate\" && m && c === void 0)\n e = e.translate(m, h || 0, 0);\n else if (r === \"rotate3d\" && w.every((o) => !Number.isNaN(+o)) && u)\n e = e.rotateAxisAngle(m, h, c, u);\n else if (r === \"rotate\" && m && [h, c].every((o) => o === void 0))\n e = e.rotate(0, 0, m);\n else if (r === \"scale3d\" && f.every((o) => !Number.isNaN(+o)) && f.some((o) => o !== 1))\n e = e.scale(m, h, c);\n else if (r === \"scale\" && !Number.isNaN(m) && m !== 1 && c === void 0) {\n const d = Number.isNaN(+h) ? m : h;\n e = e.scale(m, d, 1);\n } else if (r === \"skew\" && (m || !Number.isNaN(m) && h) && c === void 0)\n e = e.skew(m, h || 0);\n else if ([\"translate\", \"rotate\", \"scale\", \"skew\"].some((o) => r.includes(o)) && /[XYZ]/.test(r) && m && [h, c].every((o) => o === void 0))\n if (r === \"skewX\" || r === \"skewY\")\n e = e[r](m);\n else {\n const o = r.replace(/[XYZ]/, \"\"), d = r.replace(o, \"\"), A = [\"X\", \"Y\", \"Z\"].indexOf(d), M = o === \"scale\" ? 1 : 0, b = [A === 0 ? m : M, A === 1 ? m : M, A === 2 ? m : M];\n e = e[o](...b);\n }\n else\n throw TypeError(n);\n }), e;\n}, x = (s, t) => t ? [s.a, s.b, s.c, s.d, s.e, s.f] : [\n s.m11,\n s.m12,\n s.m13,\n s.m14,\n s.m21,\n s.m22,\n s.m23,\n s.m24,\n s.m31,\n s.m32,\n s.m33,\n s.m34,\n s.m41,\n s.m42,\n s.m43,\n s.m44\n], Y = (s, t, e) => {\n const n = new y();\n return n.m41 = s, n.e = s, n.m42 = t, n.f = t, n.m43 = e, n;\n}, F = (s, t, e) => {\n const n = new y(), i = Math.PI / 180, r = s * i, a = t * i, l = e * i, m = Math.cos(r), h = -Math.sin(r), c = Math.cos(a), u = -Math.sin(a), f = Math.cos(l), w = -Math.sin(l), o = c * f, d = -c * w;\n n.m11 = o, n.a = o, n.m12 = d, n.b = d, n.m13 = u;\n const A = h * u * f + m * w;\n n.m21 = A, n.c = A;\n const M = m * f - h * u * w;\n return n.m22 = M, n.d = M, n.m23 = -h * c, n.m31 = h * w - m * u * f, n.m32 = h * f + m * u * w, n.m33 = m * c, n;\n}, T = (s, t, e, n) => {\n const i = new y(), r = Math.sqrt(s * s + t * t + e * e);\n if (r === 0)\n return i;\n const a = s / r, l = t / r, m = e / r, h = n * (Math.PI / 360), c = Math.sin(h), u = Math.cos(h), f = c * c, w = a * a, o = l * l, d = m * m, A = 1 - 2 * (o + d) * f;\n i.m11 = A, i.a = A;\n const M = 2 * (a * l * f + m * c * u);\n i.m12 = M, i.b = M, i.m13 = 2 * (a * m * f - l * c * u);\n const b = 2 * (l * a * f - m * c * u);\n i.m21 = b, i.c = b;\n const k = 1 - 2 * (d + w) * f;\n return i.m22 = k, i.d = k, i.m23 = 2 * (l * m * f + a * c * u), i.m31 = 2 * (m * a * f + l * c * u), i.m32 = 2 * (m * l * f - a * c * u), i.m33 = 1 - 2 * (w + o) * f, i;\n}, I = (s, t, e) => {\n const n = new y();\n return n.m11 = s, n.a = s, n.m22 = t, n.d = t, n.m33 = e, n;\n}, v = (s, t) => {\n const e = new y();\n if (s) {\n const n = s * Math.PI / 180, i = Math.tan(n);\n e.m21 = i, e.c = i;\n }\n if (t) {\n const n = t * Math.PI / 180, i = Math.tan(n);\n e.m12 = i, e.b = i;\n }\n return e;\n}, R = (s) => v(s, 0), D = (s) => v(0, s), N = (s, t) => {\n const e = t.m11 * s.m11 + t.m12 * s.m21 + t.m13 * s.m31 + t.m14 * s.m41, n = t.m11 * s.m12 + t.m12 * s.m22 + t.m13 * s.m32 + t.m14 * s.m42, i = t.m11 * s.m13 + t.m12 * s.m23 + t.m13 * s.m33 + t.m14 * s.m43, r = t.m11 * s.m14 + t.m12 * s.m24 + t.m13 * s.m34 + t.m14 * s.m44, a = t.m21 * s.m11 + t.m22 * s.m21 + t.m23 * s.m31 + t.m24 * s.m41, l = t.m21 * s.m12 + t.m22 * s.m22 + t.m23 * s.m32 + t.m24 * s.m42, m = t.m21 * s.m13 + t.m22 * s.m23 + t.m23 * s.m33 + t.m24 * s.m43, h = t.m21 * s.m14 + t.m22 * s.m24 + t.m23 * s.m34 + t.m24 * s.m44, c = t.m31 * s.m11 + t.m32 * s.m21 + t.m33 * s.m31 + t.m34 * s.m41, u = t.m31 * s.m12 + t.m32 * s.m22 + t.m33 * s.m32 + t.m34 * s.m42, f = t.m31 * s.m13 + t.m32 * s.m23 + t.m33 * s.m33 + t.m34 * s.m43, w = t.m31 * s.m14 + t.m32 * s.m24 + t.m33 * s.m34 + t.m34 * s.m44, o = t.m41 * s.m11 + t.m42 * s.m21 + t.m43 * s.m31 + t.m44 * s.m41, d = t.m41 * s.m12 + t.m42 * s.m22 + t.m43 * s.m32 + t.m44 * s.m42, A = t.m41 * s.m13 + t.m42 * s.m23 + t.m43 * s.m33 + t.m44 * s.m43, M = t.m41 * s.m14 + t.m42 * s.m24 + t.m43 * s.m34 + t.m44 * s.m44;\n return g([e, n, i, r, a, l, m, h, c, u, f, w, o, d, A, M]);\n};\nclass y {\n /**\n * @constructor\n * @param init accepts all parameter configurations:\n * * valid CSS transform string,\n * * CSSMatrix/DOMMatrix instance,\n * * a 6/16 elements *Array*.\n */\n constructor(t) {\n return this.a = 1, this.b = 0, this.c = 0, this.d = 1, this.e = 0, this.f = 0, this.m11 = 1, this.m12 = 0, this.m13 = 0, this.m14 = 0, this.m21 = 0, this.m22 = 1, this.m23 = 0, this.m24 = 0, this.m31 = 0, this.m32 = 0, this.m33 = 1, this.m34 = 0, this.m41 = 0, this.m42 = 0, this.m43 = 0, this.m44 = 1, t ? this.setMatrixValue(t) : this;\n }\n /**\n * A `Boolean` whose value is `true` if the matrix is the identity matrix. The identity\n * matrix is one in which every value is 0 except those on the main diagonal from top-left\n * to bottom-right corner (in other words, where the offsets in each direction are equal).\n *\n * @return the current property value\n */\n get isIdentity() {\n return this.m11 === 1 && this.m12 === 0 && this.m13 === 0 && this.m14 === 0 && this.m21 === 0 && this.m22 === 1 && this.m23 === 0 && this.m24 === 0 && this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m41 === 0 && this.m42 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * A `Boolean` flag whose value is `true` if the matrix was initialized as a 2D matrix\n * and `false` if the matrix is 3D.\n *\n * @return the current property value\n */\n get is2D() {\n return this.m31 === 0 && this.m32 === 0 && this.m33 === 1 && this.m34 === 0 && this.m43 === 0 && this.m44 === 1;\n }\n /**\n * The `setMatrixValue` method replaces the existing matrix with one computed\n * in the browser. EG: `matrix(1,0.25,-0.25,1,0,0)`\n *\n * The method accepts any *Array* values, the result of\n * `DOMMatrix` instance method `toFloat64Array()` / `toFloat32Array()` calls\n * or `CSSMatrix` instance method `toArray()`.\n *\n * This method expects valid *matrix()* / *matrix3d()* string values, as well\n * as other transform functions like *translateX(10px)*.\n *\n * @param source\n * @return the matrix instance\n */\n setMatrixValue(t) {\n return typeof t == \"string\" && t.length && t !== \"none\" ? O(t) : Array.isArray(t) || t instanceof Float64Array || t instanceof Float32Array ? g(t) : typeof t == \"object\" ? X(t) : this;\n }\n /**\n * Returns a *Float32Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat32Array(t) {\n return Float32Array.from(x(this, t));\n }\n /**\n * Returns a *Float64Array* containing elements which comprise the matrix.\n * The method can return either the 16 elements or the 6 elements\n * depending on the value of the `is2D` parameter.\n *\n * @param is2D *Array* representation of the matrix\n * @return an *Array* representation of the matrix\n */\n toFloat64Array(t) {\n return Float64Array.from(x(this, t));\n }\n /**\n * Creates and returns a string representation of the matrix in `CSS` matrix syntax,\n * using the appropriate `CSS` matrix notation.\n *\n * matrix3d *matrix3d(m11, m12, m13, m14, m21, ...)*\n * matrix *matrix(a, b, c, d, e, f)*\n *\n * @return a string representation of the matrix\n */\n toString() {\n const { is2D: t } = this, e = this.toFloat64Array(t).join(\", \");\n return `${t ? \"matrix\" : \"matrix3d\"}(${e})`;\n }\n /**\n * Returns a JSON representation of the `CSSMatrix` instance, a standard *Object*\n * that includes `{a,b,c,d,e,f}` and `{m11,m12,m13,..m44}` properties as well\n * as the `is2D` & `isIdentity` properties.\n *\n * The result can also be used as a second parameter for the `fromMatrix` static method\n * to load values into another matrix instance.\n *\n * @return an *Object* with all matrix values.\n */\n toJSON() {\n const { is2D: t, isIdentity: e } = this;\n return { ...this, is2D: t, isIdentity: e };\n }\n /**\n * The Multiply method returns a new CSSMatrix which is the result of this\n * matrix multiplied by the passed matrix, with the passed matrix to the right.\n * This matrix is not modified.\n *\n * @param m2 CSSMatrix\n * @return The resulted matrix.\n */\n multiply(t) {\n return N(this, t);\n }\n /**\n * The translate method returns a new matrix which is this matrix post\n * multiplied by a translation matrix containing the passed values. If the z\n * component is undefined, a 0 value is used in its place. This matrix is not\n * modified.\n *\n * @param x X component of the translation value.\n * @param y Y component of the translation value.\n * @param z Z component of the translation value.\n * @return The resulted matrix\n */\n translate(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = 0), typeof a > \"u\" && (a = 0), N(this, Y(i, r, a));\n }\n /**\n * The scale method returns a new matrix which is this matrix post multiplied by\n * a scale matrix containing the passed values. If the z component is undefined,\n * a 1 value is used in its place. If the y component is undefined, the x\n * component value is used in its place. This matrix is not modified.\n *\n * @param x The X component of the scale value.\n * @param y The Y component of the scale value.\n * @param z The Z component of the scale value.\n * @return The resulted matrix\n */\n scale(t, e, n) {\n const i = t;\n let r = e, a = n;\n return typeof r > \"u\" && (r = t), typeof a > \"u\" && (a = 1), N(this, I(i, r, a));\n }\n /**\n * The rotate method returns a new matrix which is this matrix post multiplied\n * by each of 3 rotation matrices about the major axes, first X, then Y, then Z.\n * If the y and z components are undefined, the x value is used to rotate the\n * object about the z axis, as though the vector (0,0,x) were passed. All\n * rotation values are in degrees. This matrix is not modified.\n *\n * @param rx The X component of the rotation, or Z if Y and Z are null.\n * @param ry The (optional) Y component of the rotation value.\n * @param rz The (optional) Z component of the rotation value.\n * @return The resulted matrix\n */\n rotate(t, e, n) {\n let i = t, r = e || 0, a = n || 0;\n return typeof t == \"number\" && typeof e > \"u\" && typeof n > \"u\" && (a = i, i = 0, r = 0), N(this, F(i, r, a));\n }\n /**\n * The rotateAxisAngle method returns a new matrix which is this matrix post\n * multiplied by a rotation matrix with the given axis and `angle`. The right-hand\n * rule is used to determine the direction of rotation. All rotation values are\n * in degrees. This matrix is not modified.\n *\n * @param x The X component of the axis vector.\n * @param y The Y component of the axis vector.\n * @param z The Z component of the axis vector.\n * @param angle The angle of rotation about the axis vector, in degrees.\n * @return The resulted matrix\n */\n rotateAxisAngle(t, e, n, i) {\n if ([t, e, n, i].some((r) => Number.isNaN(+r)))\n throw new TypeError(\"CSSMatrix: expecting 4 values\");\n return N(this, T(t, e, n, i));\n }\n /**\n * Specifies a skew transformation along the `x-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewX(t) {\n return N(this, R(t));\n }\n /**\n * Specifies a skew transformation along the `y-axis` by the given angle.\n * This matrix is not modified.\n *\n * @param angle The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skewY(t) {\n return N(this, D(t));\n }\n /**\n * Specifies a skew transformation along both the `x-axis` and `y-axis`.\n * This matrix is not modified.\n *\n * @param angleX The X-angle amount in degrees to skew.\n * @param angleY The angle amount in degrees to skew.\n * @return The resulted matrix\n */\n skew(t, e) {\n return N(this, v(t, e));\n }\n /**\n * Transforms a specified vector using the matrix, returning a new\n * {x,y,z,w} Tuple *Object* comprising the transformed vector.\n * Neither the matrix nor the original vector are altered.\n *\n * The method is equivalent with `transformPoint()` method\n * of the `DOMMatrix` constructor.\n *\n * @param t Tuple with `{x,y,z,w}` components\n * @return the resulting Tuple\n */\n transformPoint(t) {\n const e = this.m11 * t.x + this.m21 * t.y + this.m31 * t.z + this.m41 * t.w, n = this.m12 * t.x + this.m22 * t.y + this.m32 * t.z + this.m42 * t.w, i = this.m13 * t.x + this.m23 * t.y + this.m33 * t.z + this.m43 * t.w, r = this.m14 * t.x + this.m24 * t.y + this.m34 * t.z + this.m44 * t.w;\n return t instanceof DOMPoint ? new DOMPoint(e, n, i, r) : {\n x: e,\n y: n,\n z: i,\n w: r\n };\n }\n}\np(y, \"Translate\", Y), p(y, \"Rotate\", F), p(y, \"RotateAxisAngle\", T), p(y, \"Scale\", I), p(y, \"SkewX\", R), p(y, \"SkewY\", D), p(y, \"Skew\", v), p(y, \"Multiply\", N), p(y, \"fromArray\", g), p(y, \"fromMatrix\", X), p(y, \"fromString\", O), p(y, \"toArray\", x), p(y, \"isCompatibleArray\", E), p(y, \"isCompatibleObject\", P);\nexport {\n y as default\n};\n//# sourceMappingURL=dommatrix.mjs.map\n","import { Options } from '../interface';\n\n/** SVGPathCommander default options */\nconst defaultOptions: Options = {\n origin: [0, 0, 0],\n round: 4,\n};\n\nexport default defaultOptions;\n","/** Segment params length */\nconst paramsCount = {\n a: 7,\n c: 6,\n h: 1,\n l: 2,\n m: 2,\n r: 4,\n q: 4,\n s: 4,\n t: 2,\n v: 1,\n z: 0,\n};\n\nexport default paramsCount;\n","import paramsCount from './paramsCount';\nimport PathParser from './pathParser';\nimport type { PathCommand, PathSegment, RelativeCommand } from '../types';\n\n/**\n * Breaks the parsing of a pathString once a segment is finalized.\n *\n * @param path the `PathParser` instance\n */\nconst finalizeSegment = (path: PathParser) => {\n let pathCommand = path.pathValue[path.segmentStart] as PathCommand;\n let relativeCommand = pathCommand.toLowerCase() as RelativeCommand;\n const { data } = path;\n\n while (data.length >= paramsCount[relativeCommand]) {\n // overloaded `moveTo`\n // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts\n if (relativeCommand === 'm' && data.length > 2) {\n path.segments.push([pathCommand as PathCommand | number].concat(data.splice(0, 2) as number[]) as PathSegment);\n relativeCommand = 'l';\n pathCommand = pathCommand === 'm' ? 'l' : 'L';\n } else {\n path.segments.push(\n [pathCommand as PathCommand | number].concat(\n data.splice(0, paramsCount[relativeCommand]) as number[],\n ) as PathSegment,\n );\n }\n\n if (!paramsCount[relativeCommand]) {\n break;\n }\n }\n};\nexport default finalizeSegment;\n","const error = 'SVGPathCommander Error';\nexport default error;\n","import error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates an A (arc-to) specific path command value.\n * Usually a `large-arc-flag` or `sweep-flag`.\n *\n * @param path the `PathParser` instance\n */\nconst scanFlag = (path: PathParser) => {\n const { index, pathValue } = path;\n const code = pathValue.charCodeAt(index);\n\n if (code === 0x30 /* 0 */) {\n path.param = 0;\n path.index += 1;\n return;\n }\n\n if (code === 0x31 /* 1 */) {\n path.param = 1;\n path.index += 1;\n return;\n }\n\n path.err = `${error}: invalid Arc flag \"${pathValue[index]}\", expecting 0 or 1 at index ${index}`;\n};\n\nexport default scanFlag;\n","import { DigitNumber } from '../types';\n\n/**\n * Checks if a character is a digit.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigit = (code: number): code is DigitNumber => {\n return code >= 48 && code <= 57; // 0..9\n};\nexport default isDigit;\n","const invalidPathValue = 'Invalid path value';\nexport default invalidPathValue;\n","import isDigit from './isDigit';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\nimport type PathParser from './pathParser';\n\n/**\n * Validates every character of the path string,\n * every path command, negative numbers or floating point numbers.\n *\n * @param path the `PathParser` instance\n */\nconst scanParam = (path: PathParser) => {\n const { max, pathValue, index: start } = path;\n let index = start;\n let zeroFirst = false;\n let hasCeiling = false;\n let hasDecimal = false;\n let hasDot = false;\n let ch;\n\n if (index >= max) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"pathValue\" is missing param`;\n return;\n }\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n // ch = (index < max) ? pathValue.charCodeAt(index) : 0;\n ch = pathValue.charCodeAt(index);\n }\n\n // This logic is shamelessly borrowed from Esprima\n // https://github.com/ariya/esprimas\n if (!isDigit(ch) && ch !== 0x2e /* . */) {\n // path.err = 'SvgPath: param should start with 0..9 or `.` (at pos ' + index + ')';\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" is not a number`;\n return;\n }\n\n if (ch !== 0x2e /* . */) {\n zeroFirst = ch === 0x30 /* 0 */;\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (zeroFirst && index < max) {\n // decimal number starts with '0' such as '09' is illegal.\n if (ch && isDigit(ch)) {\n // path.err = 'SvgPath: numbers started with `0` such as `09`\n // are illegal (at pos ' + start + ')';\n path.err = `${error}: ${invalidPathValue} at index ${start}, \"${pathValue[start]}\" illegal number`;\n return;\n }\n }\n\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasCeiling = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x2e /* . */) {\n hasDot = true;\n index += 1;\n while (isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n hasDecimal = true;\n }\n\n ch = pathValue.charCodeAt(index);\n }\n\n if (ch === 0x65 /* e */ || ch === 0x45 /* E */) {\n if (hasDot && !hasCeiling && !hasDecimal) {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid float exponent`;\n return;\n }\n\n index += 1;\n\n ch = pathValue.charCodeAt(index);\n\n if (ch === 0x2b /* + */ || ch === 0x2d /* - */) {\n index += 1;\n }\n if (index < max && isDigit(pathValue.charCodeAt(index))) {\n while (index < max && isDigit(pathValue.charCodeAt(index))) {\n index += 1;\n }\n } else {\n path.err = `${error}: ${invalidPathValue} at index ${index}, \"${pathValue[index]}\" invalid integer exponent`;\n return;\n }\n }\n\n path.index = index;\n path.param = +path.pathValue.slice(start, index);\n};\nexport default scanParam;\n","import type { SpaceNumber } from '../types';\n\n/**\n * Checks if the character is a space.\n *\n * @param ch the character to check\n * @returns check result\n */\n\nconst isSpace = (ch: number): ch is SpaceNumber => {\n const allSpaces = [\n // Special spaces\n 0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200a, 0x202f,\n 0x205f, 0x3000, 0xfeff,\n // Line terminators\n 0x0a, 0x0d, 0x2028, 0x2029,\n // White spaces\n 0x20, 0x09, 0x0b, 0x0c, 0xa0,\n ];\n\n return allSpaces.includes(ch);\n};\nexport default isSpace;\n","import isSpace from './isSpace';\nimport type PathParser from './pathParser';\n\n/**\n * Points the parser to the next character in the\n * path string every time it encounters any kind of\n * space character.\n *\n * @param path the `PathParser` instance\n */\nconst skipSpaces = (path: PathParser) => {\n const { pathValue, max } = path;\n while (path.index < max && isSpace(pathValue.charCodeAt(path.index))) {\n path.index += 1;\n }\n};\nexport default skipSpaces;\n","import type { PathCommandNumber } from '../types';\n\n/**\n * Checks if the character is a path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isPathCommand = (code: number): code is PathCommandNumber => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x7a /* z */:\n case 0x6c /* l */:\n case 0x68 /* h */:\n case 0x76 /* v */:\n case 0x63 /* c */:\n case 0x73 /* s */:\n case 0x71 /* q */:\n case 0x74 /* t */:\n case 0x61 /* a */:\n // case 0x72/* r */:\n return true;\n default:\n return false;\n }\n};\nexport default isPathCommand;\n","import isDigit from './isDigit';\nimport type { DigitNumber } from '../types';\n\n/**\n * Checks if the character is or belongs to a number.\n * [0-9]|+|-|.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isDigitStart = (code: number): code is DigitNumber | 0x2b | 0x2d | 0x2e => {\n return isDigit(code) /* 0..9 */ || code === 0x2b /* + */ || code === 0x2d /* - */ || code === 0x2e; /* . */\n};\nexport default isDigitStart;\n","/**\n * Checks if the character is an A (arc-to) path command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isArcCommand = (code: number): code is 0x61 => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n return (code | 0x20) === 0x61;\n};\nexport default isArcCommand;\n","/**\n * Checks if the character is a MoveTo command.\n *\n * @param code the character to check\n * @returns check result\n */\nconst isMoveCommand = (code: number): code is 0x6d | 0x4d => {\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy\n switch (code | 0x20) {\n case 0x6d /* m */:\n case 0x4d /* M */:\n return true;\n default:\n return false;\n }\n};\nexport default isMoveCommand;\n","import finalizeSegment from './finalizeSegment';\nimport paramCounts from './paramsCount';\nimport scanFlag from './scanFlag';\nimport scanParam from './scanParam';\nimport skipSpaces from './skipSpaces';\nimport isPathCommand from './isPathCommand';\nimport isDigitStart from './isDigitStart';\nimport isArcCommand from './isArcCommand';\nimport isMoveCommand from './isMoveCommand';\nimport invalidPathValue from './invalidPathValue';\nimport error from './error';\n\nimport type PathParser from './pathParser';\nimport type { PathSegment, RelativeCommand } from '../types';\n\n/**\n * Scans every character in the path string to determine\n * where a segment starts and where it ends.\n *\n * @param path the `PathParser` instance\n */\nconst scanSegment = (path: PathParser) => {\n const { max, pathValue, index, segments } = path;\n const cmdCode = pathValue.charCodeAt(index);\n const reqParams = paramCounts[pathValue[index].toLowerCase() as RelativeCommand];\n\n path.segmentStart = index;\n\n // segments always start with a path command\n if (!isPathCommand(cmdCode)) {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a path command at index ${index}`;\n return;\n }\n\n // after a Z segment, we only expect a MoveTo path command\n const lastSegment = segments[segments.length - 1] as PathSegment | undefined;\n if (!isMoveCommand(cmdCode) && lastSegment?.[0]?.toLocaleLowerCase() === 'z') {\n path.err = `${error}: ${invalidPathValue} \"${pathValue[index]}\" is not a MoveTo path command at index ${index}`;\n return;\n }\n\n path.index += 1;\n skipSpaces(path);\n\n path.data = [];\n\n if (!reqParams) {\n // Z\n finalizeSegment(path);\n return;\n }\n\n for (;;) {\n for (let i = reqParams; i > 0; i -= 1) {\n if (isArcCommand(cmdCode) && (i === 3 || i === 4)) scanFlag(path);\n else scanParam(path);\n\n if (path.err.length) {\n return;\n }\n path.data.push(path.param);\n\n skipSpaces(path);\n\n // after ',' param is mandatory\n if (path.index < max && pathValue.charCodeAt(path.index) === 0x2c /* , */) {\n path.index += 1;\n skipSpaces(path);\n }\n }\n\n if (path.index >= path.max) {\n break;\n }\n\n // Stop on next segment\n if (!isDigitStart(pathValue.charCodeAt(path.index))) {\n break;\n }\n }\n\n finalizeSegment(path);\n};\nexport default scanSegment;\n","import type { PathArray, PathSegment } from '../types';\n\n/**\n * The `PathParser` is used by the `parsePathString` static method\n * to generate a `pathArray`.\n *\n * @param pathString\n */\nexport default class PathParser {\n declare segments: PathArray | PathSegment[];\n declare pathValue: string;\n declare max: number;\n declare index: number;\n declare param: number;\n declare segmentStart: number;\n declare data: (string | number)[];\n declare err: string;\n\n constructor(pathString: string) {\n this.segments = [];\n this.pathValue = pathString;\n this.max = pathString.length;\n this.index = 0;\n this.param = 0.0;\n this.segmentStart = 0;\n this.data = [];\n this.err = '';\n }\n}\n","import scanSegment from './scanSegment';\nimport skipSpaces from './skipSpaces';\nimport PathParser from './pathParser';\nimport type { PathArray } from '../types';\n\n/**\n * Parses a path string value and returns an array\n * of segments we like to call `pathArray`.\n *\n * @param pathInput the string to be parsed\n * @returns the resulted `pathArray` or error string\n */\nconst parsePathString = (pathInput: string | T) => {\n if (typeof pathInput !== 'string') {\n return pathInput.slice(0) as typeof pathInput;\n }\n\n const path = new PathParser(pathInput);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n if (path?.err.length) {\n throw TypeError(path.err);\n }\n\n return path.segments as PathArray;\n};\n\nexport default parsePathString;\n","import type {\n AbsoluteSegment,\n AbsoluteCommand,\n ASegment,\n VSegment,\n HSegment,\n QSegment,\n SSegment,\n TSegment,\n CSegment,\n PathSegment,\n MSegment,\n LSegment,\n} from '../types';\n\n/**\n * Returns an absolute segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the absolute segment\n */\nconst absolutizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const isAbsolute = absCommand === pathCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isAbsolute) return segment as MSegment | AbsoluteSegment;\n // const values = segment.slice(1) as number[];\n if (absCommand === 'A') {\n return [\n absCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as ASegment)[6] + lastX,\n (segment as ASegment)[7] + lastY,\n ] as ASegment;\n } else if (absCommand === 'V') {\n return [absCommand, (segment as VSegment)[1] + lastY] as VSegment;\n } else if (absCommand === 'H') {\n return [absCommand, (segment as HSegment)[1] + lastX] as HSegment;\n } else if (absCommand === 'L') {\n return [absCommand, (segment as LSegment)[1] + lastX, (segment as LSegment)[2] + lastY] as LSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const absValues = (segment.slice(1) as number[]).map((n, j) => n + (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [absCommand as typeof absCommand | number].concat(absValues) as\n | MSegment\n | QSegment\n | TSegment\n | SSegment\n | CSegment;\n }\n};\nexport default absolutizeSegment;\n","// import paramsParser from '../parser/paramsParser';\nimport type { PathArray, PathCommand, PathSegment, IteratorCallback, AbsoluteCommand } from '../types';\n\nconst iterate = (path: PathArray, iterator: IteratorCallback) => {\n let pathLen = path.length;\n let segment: PathSegment;\n let pathCommand = 'M' as PathCommand;\n let absCommand = 'M' as AbsoluteCommand;\n let isRelative = false;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n let segLen = 0;\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n [pathCommand] = segment;\n segLen = segment.length;\n absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n isRelative = absCommand !== pathCommand;\n\n const iteratorResult = iterator(segment, i, x, y);\n // some methods like getPointAtLength would like to break\n // when task is complete\n if (iteratorResult === false) {\n break;\n }\n\n // segment = path[i];\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n x = (segment[1] as number) + (isRelative ? x : 0);\n } else if (absCommand === 'V') {\n y = (segment[1] as number) + (isRelative ? y : 0);\n } else {\n x = (segment[segLen - 2] as number) + (isRelative ? x : 0);\n y = (segment[segLen - 1] as number) + (isRelative ? y : 0);\n\n if (absCommand === 'M') {\n mx = x;\n my = y;\n }\n }\n\n if (iteratorResult) {\n path[i] = iteratorResult;\n if (iteratorResult[0] === 'C') {\n pathLen = path.length;\n }\n }\n }\n return path as T;\n};\n\nexport default iterate;\n","import parsePathString from '../parser/parsePathString';\nimport absolutizeSegment from '../process/absolutizeSegment';\nimport type { AbsoluteArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to absolute values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with absolute values\n */\nconst pathToAbsolute = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n\n return iterate(path, absolutizeSegment);\n};\nexport default pathToAbsolute;\n","import type {\n RelativeSegment,\n RelativeCommand,\n PathSegment,\n aSegment,\n vSegment,\n hSegment,\n qSegment,\n tSegment,\n sSegment,\n cSegment,\n MSegment,\n lSegment,\n} from '../types';\n\n/**\n * Returns a relative segment of a `PathArray` object.\n *\n * @param segment the segment object\n * @param index the segment index\n * @param lastX the last known X value\n * @param lastY the last known Y value\n * @returns the relative segment\n */\nconst relativizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => {\n const [pathCommand] = segment;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n\n /* istanbul ignore else @preserve */\n if (index === 0 || isRelative) return segment as MSegment | RelativeSegment;\n\n if (relCommand === 'a') {\n return [\n relCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5],\n (segment as aSegment)[6] - lastX,\n (segment as aSegment)[7] - lastY,\n ] as aSegment;\n } else if (relCommand === 'v') {\n return [relCommand, (segment as vSegment)[1] - lastY] as vSegment;\n } else if (relCommand === 'h') {\n return [relCommand, (segment as hSegment)[1] - lastX] as hSegment;\n } else if (relCommand === 'l') {\n return [relCommand, (segment as lSegment)[1] - lastX, (segment as lSegment)[2] - lastY] as lSegment;\n } else {\n // use brakets for `eslint: no-case-declaration`\n // https://stackoverflow.com/a/50753272/803358\n const relValues = (segment.slice(1) as number[]).map((n, j) => n - (j % 2 ? lastY : lastX));\n // for c, s, q, t\n return [relCommand as RelativeCommand | number].concat(relValues) as qSegment | tSegment | sSegment | cSegment;\n }\n};\n\nexport default relativizeSegment;\n","import type { PathArray, RelativeArray } from '../types';\nimport parsePathString from '../parser/parsePathString';\nimport iterate from '../process/iterate';\nimport relativizeSegment from '../process/relativizeSegment';\n\n/**\n * Parses a path string value or object and returns an array\n * of segments, all converted to relative values.\n *\n * @param pathInput the path string | object\n * @returns the resulted `pathArray` with relative values\n */\nconst pathToRelative = (pathInput: string | PathArray): RelativeArray => {\n const path = parsePathString(pathInput);\n\n return iterate(path, relativizeSegment);\n};\nexport default pathToRelative;\n","/**\n * Returns an {x,y} vector rotated by a given\n * angle in radian.\n *\n * @param x the initial vector x\n * @param y the initial vector y\n * @param rad the radian vector angle\n * @returns the rotated vector\n */\nconst rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => {\n const { sin, cos } = Math;\n const X = x * cos(rad) - y * sin(rad);\n const Y = x * sin(rad) + y * cos(rad);\n return { x: X, y: Y };\n};\n\nexport default rotateVector;\n","import rotateVector from '../math/rotateVector';\n\n/**\n * Converts A (arc-to) segments to C (cubic-bezier-to).\n *\n * For more information of where this math came from visit:\n * http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n *\n * @param X1 the starting x position\n * @param Y1 the starting y position\n * @param RX x-radius of the arc\n * @param RY y-radius of the arc\n * @param angle x-axis-rotation of the arc\n * @param LAF large-arc-flag of the arc\n * @param SF sweep-flag of the arc\n * @param X2 the ending x position\n * @param Y2 the ending y position\n * @param recursive the parameters needed to split arc into 2 segments\n * @return the resulting cubic-bezier segment(s)\n */\nconst arcToCubic = (\n X1: number,\n Y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n X2: number,\n Y2: number,\n recursive?: [number, number, number, number],\n): number[] => {\n let x1 = X1;\n let y1 = Y1;\n let rx = RX;\n let ry = RY;\n let x2 = X2;\n let y2 = Y2;\n // for more information of where this Math came from visit:\n // http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes\n const d120 = (Math.PI * 120) / 180;\n\n const rad = (Math.PI / 180) * (+angle || 0);\n let res = [] as number[];\n let xy;\n let f1;\n let f2;\n let cx;\n let cy;\n\n if (!recursive) {\n xy = rotateVector(x1, y1, -rad);\n x1 = xy.x;\n y1 = xy.y;\n xy = rotateVector(x2, y2, -rad);\n x2 = xy.x;\n y2 = xy.y;\n\n const x = (x1 - x2) / 2;\n const y = (y1 - y2) / 2;\n let h = (x * x) / (rx * rx) + (y * y) / (ry * ry);\n if (h > 1) {\n h = Math.sqrt(h);\n rx *= h;\n ry *= h;\n }\n const rx2 = rx * rx;\n const ry2 = ry * ry;\n\n const k =\n (LAF === SF ? -1 : 1) *\n Math.sqrt(Math.abs((rx2 * ry2 - rx2 * y * y - ry2 * x * x) / (rx2 * y * y + ry2 * x * x)));\n\n cx = (k * rx * y) / ry + (x1 + x2) / 2;\n cy = (k * -ry * x) / rx + (y1 + y2) / 2;\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f1 = Math.asin(((((y1 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise\n f2 = Math.asin(((((y2 - cy) / ry) * 10 ** 9) >> 0) / 10 ** 9);\n\n f1 = x1 < cx ? Math.PI - f1 : f1;\n f2 = x2 < cx ? Math.PI - f2 : f2;\n if (f1 < 0) f1 = Math.PI * 2 + f1;\n if (f2 < 0) f2 = Math.PI * 2 + f2;\n if (SF && f1 > f2) {\n f1 -= Math.PI * 2;\n }\n if (!SF && f2 > f1) {\n f2 -= Math.PI * 2;\n }\n } else {\n [f1, f2, cx, cy] = recursive;\n }\n let df = f2 - f1;\n if (Math.abs(df) > d120) {\n const f2old = f2;\n const x2old = x2;\n const y2old = y2;\n f2 = f1 + d120 * (SF && f2 > f1 ? 1 : -1);\n x2 = cx + rx * Math.cos(f2);\n y2 = cy + ry * Math.sin(f2);\n res = arcToCubic(x2, y2, rx, ry, angle, 0, SF, x2old, y2old, [f2, f2old, cx, cy]);\n }\n df = f2 - f1;\n const c1 = Math.cos(f1);\n const s1 = Math.sin(f1);\n const c2 = Math.cos(f2);\n const s2 = Math.sin(f2);\n const t = Math.tan(df / 4);\n const hx = (4 / 3) * rx * t;\n const hy = (4 / 3) * ry * t;\n const m1 = [x1, y1];\n const m2 = [x1 + hx * s1, y1 - hy * c1];\n const m3 = [x2 + hx * s2, y2 - hy * c2];\n const m4 = [x2, y2];\n m2[0] = 2 * m1[0] - m2[0];\n m2[1] = 2 * m1[1] - m2[1];\n if (recursive) {\n return [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n }\n res = [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res);\n const newres = [];\n for (let i = 0, ii = res.length; i < ii; i += 1) {\n newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x;\n }\n return newres;\n};\nexport default arcToCubic;\n","/**\n * Converts a Q (quadratic-bezier) segment to C (cubic-bezier).\n *\n * @param x1 curve start x\n * @param y1 curve start y\n * @param qx control point x\n * @param qy control point y\n * @param x2 curve end x\n * @param y2 curve end y\n * @returns the cubic-bezier segment\n */\nconst quadToCubic = (\n x1: number,\n y1: number,\n qx: number,\n qy: number,\n x2: number,\n y2: number,\n): [number, number, number, number, number, number] => {\n const r13 = 1 / 3;\n const r23 = 2 / 3;\n return [\n r13 * x1 + r23 * qx, // cpx1\n r13 * y1 + r23 * qy, // cpy1\n r13 * x2 + r23 * qx, // cpx2\n r13 * y2 + r23 * qy, // cpy2\n x2,\n y2, // x,y\n ];\n};\nexport default quadToCubic;\n","import { PointTuple } from '../types';\n\n/**\n * Returns the coordinates of a specified distance\n * ratio between two points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @param t the ratio\n * @returns the midpoint coordinates\n */\nconst midPoint = (a: PointTuple, b: PointTuple, t: number): PointTuple => {\n const [ax, ay] = a;\n const [bx, by] = b;\n return [ax + (bx - ax) * t, ay + (by - ay) * t];\n};\n\nexport default midPoint;\n","import midPoint from '../math/midPoint';\n\n/**\n * Converts an L (line-to) segment to C (cubic-bezier).\n *\n * @param x1 line start x\n * @param y1 line start y\n * @param x2 line end x\n * @param y2 line end y\n * @returns the cubic-bezier segment\n */\nconst lineToCubic = (x1: number, y1: number, x2: number, y2: number) => {\n const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0);\n const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0);\n return [c1[0], c1[1], c2[0], c2[1], x2, y2];\n};\nexport default lineToCubic;\n","import arcToCubic from './arcToCubic';\nimport quadToCubic from './quadToCubic';\nimport lineToCubic from './lineToCubic';\nimport type { CSegment, MSegment, PathSegment } from '../types';\nimport type { ParserParams } from '../interface';\n\n/**\n * Converts any segment to C (cubic-bezier).\n *\n * @param segment the source segment\n * @param params the source segment parameters\n * @returns the cubic-bezier segment\n */\nconst segmentToCubic = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const values = segment.slice(1).map(Number);\n const [x, y] = values;\n // let args;\n const { x1: px1, y1: py1, x: px, y: py } = params;\n\n if (!'TQ'.includes(pathCommand)) {\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'M') {\n params.x = x;\n params.y = y;\n return segment;\n } else if (pathCommand === 'A') {\n return ['C' as string | number].concat(\n arcToCubic(px1, py1, values[0], values[1], values[2], values[3], values[4], values[5], values[6]),\n ) as CSegment;\n } else if (pathCommand === 'Q') {\n params.qx = x;\n params.qy = y;\n return ['C' as string | number].concat(\n quadToCubic(px1, py1, values[0], values[1], values[2], values[3]),\n ) as CSegment;\n } else if (pathCommand === 'L') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, x, y)) as CSegment;\n } else if (pathCommand === 'Z') {\n return ['C' as string | number].concat(lineToCubic(px1, py1, px, py)) as CSegment;\n }\n\n return segment as MSegment | CSegment;\n};\nexport default segmentToCubic;\n","import type { ParserParams } from '../interface';\nimport type {\n NormalSegment,\n PointTuple,\n PathSegment,\n QSegment,\n CSegment,\n LSegment,\n MSegment,\n HSegment,\n VSegment,\n ASegment,\n PathCommand,\n} from '../types';\n\n/**\n * Normalizes a single segment of a `pathArray` object.\n *\n * @param segment the segment object\n * @param params the normalization parameters\n * @returns the normalized segment\n */\nconst normalizeSegment = (segment: PathSegment, params: ParserParams) => {\n const [pathCommand] = segment;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = pathCommand !== absCommand;\n const { x1: px1, y1: py1, x2: px2, y2: py2, x, y } = params;\n const values = segment.slice(1) as number[];\n let absValues = values.map((n, j) => n + (isRelative ? (j % 2 ? y : x) : 0));\n\n if (!'TQ'.includes(absCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n // istanbul ignore else @preserve\n if (absCommand === 'A') {\n absValues = values.slice(0, -2).concat(values[5] + (isRelative ? x : 0), values[6] + (isRelative ? y : 0));\n\n return ['A' as PathCommand | number].concat(absValues) as ASegment;\n } else if (absCommand === 'H') {\n return ['L', (segment as HSegment)[1] + (isRelative ? x : 0), py1] as LSegment;\n } else if (absCommand === 'V') {\n return ['L', px1, (segment as VSegment)[1] + (isRelative ? y : 0)] as LSegment;\n } else if (absCommand === 'L') {\n return [\n 'L',\n (segment as LSegment)[1] + (isRelative ? x : 0),\n (segment as LSegment)[2] + (isRelative ? y : 0),\n ] as LSegment;\n } else if (absCommand === 'M') {\n return [\n 'M',\n (segment as MSegment)[1] + (isRelative ? x : 0),\n (segment as MSegment)[2] + (isRelative ? y : 0),\n ] as MSegment;\n } else if (absCommand === 'C') {\n return ['C' as PathCommand | number].concat(absValues) as CSegment;\n } else if (absCommand === 'S') {\n const x1 = px1 * 2 - px2;\n const y1 = py1 * 2 - py2;\n params.x1 = x1;\n params.y1 = y1;\n return ['C', x1, y1].concat(absValues) as CSegment;\n } else if (absCommand === 'T') {\n const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0);\n const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0);\n params.qx = qx;\n params.qy = qy;\n return ['Q', qx, qy].concat(absValues) as QSegment;\n } else if (absCommand === 'Q') {\n const [nqx, nqy] = absValues as PointTuple;\n params.qx = nqx;\n params.qy = nqy;\n return ['Q' as PathCommand | number].concat(absValues) as QSegment;\n } else if (absCommand === 'Z') {\n return ['Z'] as NormalSegment;\n }\n\n // istanbul ignore next @preserve\n return segment as NormalSegment;\n};\nexport default normalizeSegment;\n","import type { ParserParams } from '../interface';\n\nconst paramsParser: ParserParams = {\n x1: 0,\n y1: 0,\n x2: 0,\n y2: 0,\n x: 0,\n y: 0,\n qx: null,\n qy: null,\n};\n\nexport default paramsParser;\n","import segmentToCubic from '../process/segmentToCubic';\nimport { AbsoluteCommand, CSegment, CurveArray, PathArray } from '../types';\nimport iterate from '../process/iterate';\nimport parsePathString from '../parser/parsePathString';\nimport normalizeSegment from '../process/normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Parses a path string value or 'pathArray' and returns a new one\n * in which all segments are converted to cubic-bezier.\n *\n * In addition, un-necessary `Z` segment is removed if previous segment\n * extends to the `M` segment.\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the resulted `pathArray` converted to cubic-bezier\n */\nconst pathToCurve = (pathInput: string | PathArray): CurveArray => {\n const params = { ...paramsParser };\n const path = parsePathString(pathInput);\n\n return iterate(path, (seg, index, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n let result = segmentToCubic(normalSegment, params);\n const isLongArc = result[0] === 'C' && result.length > 7;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as AbsoluteCommand | number].concat(result.slice(7)) as CSegment);\n result = result.slice(0, 7) as CSegment;\n }\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default pathToCurve;\n","const roundTo = (n: number, round: number) => {\n const pow = round >= 1 ? 10 ** round : 1;\n\n return round > 0 ? Math.round(n * pow) / pow : Math.round(n);\n};\n\nexport default roundTo;\n","import type { PathArray, PathSegment } from '../types';\nimport defaultOptions from '../options/options';\nimport roundTo from '../math/roundTo';\n\n/**\n * Returns a valid `d` attribute string value created\n * by rounding values and concatenating the `pathArray` segments.\n *\n * @param path the `pathArray` object\n * @param roundOption amount of decimals to round values to\n * @returns the concatenated path string\n */\nconst pathToString = (path: PathArray, roundOption?: number | 'off'): string => {\n const pathLen = path.length;\n let { round } = defaultOptions;\n let segment = path[0] as PathSegment;\n let result = '';\n\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n for (let i = 0; i < pathLen; i += 1) {\n segment = path[i];\n const [pathCommand] = segment;\n const values = segment.slice(1) as number[];\n result += pathCommand;\n if (round === 'off') {\n result += values.join(' ');\n } else {\n let j = 0;\n const valLen = values.length;\n while (j < valLen) {\n result += roundTo(values[j], round);\n if (j !== valLen - 1) result += ' ';\n j += 1;\n }\n }\n }\n\n return result;\n};\n\nexport default pathToString;\n","import { type PointTuple } from '../types';\n\n/**\n * Returns the square root of the distance\n * between two given points.\n *\n * @param a the first point coordinates\n * @param b the second point coordinates\n * @returns the distance value\n */\nconst distanceSquareRoot = (a: PointTuple, b: PointTuple) => {\n return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1]));\n};\n\nexport default distanceSquareRoot;\n","import midPoint from './midPoint';\nimport distanceSquareRoot from './distanceSquareRoot';\n\n/**\n * Returns length for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the line segment length\n */\nconst getLineLength = (x1: number, y1: number, x2: number, y2: number) => {\n return distanceSquareRoot([x1, y1], [x2, y2]);\n};\n\n/**\n * Returns a point along the line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the point at length\n */\nconst getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => {\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = distanceSquareRoot([x1, y1], [x2, y2]);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x: x2, y: y2 };\n } else {\n const [x, y] = midPoint([x1, y1], [x2, y2], distance / length);\n point = { x, y };\n }\n }\n return point;\n};\n\n/**\n * Returns bounding box for line segments (MoveTo, LineTo).\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to point in [0-1] range\n * @returns the extrema for line segments\n */\nconst getLineBBox = (x1: number, y1: number, x2: number, y2: number) => {\n const { min, max } = Math;\n return {\n min: {\n x: min(x1, x2),\n y: min(y1, y2),\n },\n max: {\n x: max(x1, x2),\n y: max(y1, y2),\n },\n };\n};\n\nexport { getPointAtLineLength, getLineBBox, getLineLength };\n","import { getPointAtLineLength } from './lineTools';\nimport type { Point } from '../types';\n\n/**\n * Returns the Arc segment length.\n * @param rx radius along X axis\n * @param ry radius along Y axis\n * @param theta the angle in radians\n * @returns the arc length\n */\nconst arcLength = (rx: number, ry: number, theta: number) => {\n const halfTheta = theta / 2;\n const sinHalfTheta = Math.sin(halfTheta);\n const cosHalfTheta = Math.cos(halfTheta);\n const term1 = rx ** 2 * sinHalfTheta ** 2;\n const term2 = ry ** 2 * cosHalfTheta ** 2;\n const length = Math.sqrt(term1 + term2) * theta;\n return Math.abs(length);\n};\n\n/**\n * Find point on ellipse at given angle around ellipse (theta);\n * @param cx the center X\n * @param cy the center Y\n * @param rx the radius X\n * @param ry the radius Y\n * @param alpha the arc rotation angle in radians\n * @param theta the arc sweep angle in radians\n * @returns a point around ellipse at given angle\n */\nconst arcPoint = (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => {\n const { sin, cos } = Math;\n // theta is angle in radians around arc\n // alpha is angle of rotation of ellipse in radians\n const cosA = cos(alpha);\n const sinA = sin(alpha);\n const x = rx * cos(theta);\n const y = ry * sin(theta);\n\n return {\n x: cx + cosA * x - sinA * y,\n y: cy + sinA * x + cosA * y,\n };\n};\n\n/**\n * Returns the angle between two points.\n * @param v0 starting point\n * @param v1 ending point\n * @returns the angle in radian\n */\nconst angleBetween = (v0: Point, v1: Point) => {\n const { x: v0x, y: v0y } = v0;\n const { x: v1x, y: v1y } = v1;\n const p = v0x * v1x + v0y * v1y;\n const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2));\n const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1;\n return sign * Math.acos(p / n);\n};\n\n/**\n * Returns the following properties for an Arc segment: center, start angle,\n * end angle, and radiuses on X and Y axis.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns properties specific to Arc segments\n */\nconst getArcProps = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { abs, sin, cos, sqrt, PI } = Math;\n let rx = abs(RX);\n let ry = abs(RY);\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n\n // istanbul ignore next @preserve\n if (x1 === x && y1 === y) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x, y },\n };\n }\n\n if (rx === 0 || ry === 0) {\n return {\n rx,\n ry,\n startAngle: 0,\n endAngle: 0,\n center: { x: (x + x1) / 2, y: (y + y1) / 2 },\n };\n }\n\n const dx = (x1 - x) / 2;\n const dy = (y1 - y) / 2;\n\n const transformedPoint = {\n x: cos(xRotRad) * dx + sin(xRotRad) * dy,\n y: -sin(xRotRad) * dx + cos(xRotRad) * dy,\n };\n\n const radiiCheck = transformedPoint.x ** 2 / rx ** 2 + transformedPoint.y ** 2 / ry ** 2;\n\n if (radiiCheck > 1) {\n rx *= sqrt(radiiCheck);\n ry *= sqrt(radiiCheck);\n }\n\n const cSquareNumerator = rx ** 2 * ry ** 2 - rx ** 2 * transformedPoint.y ** 2 - ry ** 2 * transformedPoint.x ** 2;\n const cSquareRootDenom = rx ** 2 * transformedPoint.y ** 2 + ry ** 2 * transformedPoint.x ** 2;\n\n let cRadicand = cSquareNumerator / cSquareRootDenom;\n /* istanbul ignore next @preserve */\n cRadicand = cRadicand < 0 ? 0 : cRadicand;\n const cCoef = (LAF !== SF ? 1 : -1) * sqrt(cRadicand);\n const transformedCenter = {\n x: cCoef * ((rx * transformedPoint.y) / ry),\n y: cCoef * (-(ry * transformedPoint.x) / rx),\n };\n\n const center = {\n x: cos(xRotRad) * transformedCenter.x - sin(xRotRad) * transformedCenter.y + (x1 + x) / 2,\n y: sin(xRotRad) * transformedCenter.x + cos(xRotRad) * transformedCenter.y + (y1 + y) / 2,\n };\n\n const startVector = {\n x: (transformedPoint.x - transformedCenter.x) / rx,\n y: (transformedPoint.y - transformedCenter.y) / ry,\n };\n\n const startAngle = angleBetween({ x: 1, y: 0 }, startVector);\n\n const endVector = {\n x: (-transformedPoint.x - transformedCenter.x) / rx,\n y: (-transformedPoint.y - transformedCenter.y) / ry,\n };\n\n let sweepAngle = angleBetween(startVector, endVector);\n if (!SF && sweepAngle > 0) {\n sweepAngle -= 2 * PI;\n } else if (SF && sweepAngle < 0) {\n sweepAngle += 2 * PI;\n }\n sweepAngle %= 2 * PI;\n\n const endAngle = startAngle + sweepAngle;\n\n // point.ellipticalArcStartAngle = startAngle;\n // point.ellipticalArcEndAngle = startAngle + sweepAngle;\n // point.ellipticalArcAngle = alpha;\n\n // point.ellipticalArcCenter = center;\n // point.resultantRx = rx;\n // point.resultantRy = ry;\n\n return {\n center,\n startAngle,\n endAngle,\n rx,\n ry,\n };\n};\n\n/**\n * Returns the length of an Arc segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the length of the Arc segment\n */\nconst getArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n return arcLength(rx, ry, endAngle - startAngle);\n};\n\n/**\n * Returns a point along an Arc segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance a [0-1] ratio\n * @returns a point along the Arc segment\n */\nconst getPointAtArcLength = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n distance?: number,\n) => {\n let point = { x: x1, y: y1 };\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n\n /* istanbul ignore else @preserve */\n if (typeof distance === 'number') {\n const length = arcLength(rx, ry, endAngle - startAngle);\n if (distance <= 0) {\n point = { x: x1, y: y1 };\n } else if (distance >= length) {\n point = { x, y };\n } else {\n /* istanbul ignore next @preserve */\n if (x1 === x && y1 === y) {\n return { x, y };\n }\n /* istanbul ignore next @preserve */\n if (rx === 0 || ry === 0) {\n return getPointAtLineLength(x1, y1, x, y, distance);\n }\n const { PI, cos, sin } = Math;\n const sweepAngle = endAngle - startAngle;\n const xRot = ((angle % 360) + 360) % 360;\n const xRotRad = xRot * (PI / 180);\n const alpha = startAngle + sweepAngle * (distance / length);\n const ellipseComponentX = rx * cos(alpha);\n const ellipseComponentY = ry * sin(alpha);\n\n point = {\n x: cos(xRotRad) * ellipseComponentX - sin(xRotRad) * ellipseComponentY + center.x,\n y: sin(xRotRad) * ellipseComponentX + cos(xRotRad) * ellipseComponentY + center.y,\n };\n }\n }\n\n return point;\n};\n\n/**\n * Returns the extrema for an Arc segment.\n * @see https://github.com/herrstrietzel/svg-pathdata-getbbox\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param RX the radius on X axis\n * @param RY the radius on Y axis\n * @param angle the ellipse rotation in degrees\n * @param LAF the large arc flag\n * @param SF the sweep flag\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the extrema of the Arc segment\n *\n */\nconst getArcBBox = (\n x1: number,\n y1: number,\n RX: number,\n RY: number,\n angle: number,\n LAF: number,\n SF: number,\n x: number,\n y: number,\n) => {\n const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y);\n const deltaAngle = endAngle - startAngle;\n const { min, max, tan, atan2, PI } = Math;\n\n // final on path point\n const p = { x, y };\n\n // circle/elipse center coordinates\n const { x: cx, y: cy } = center;\n\n // collect extreme points – add end point\n const extremes = [p];\n\n // rotation to radians\n const alpha = (angle * PI) / 180;\n const tangent = tan(alpha);\n\n /**\n * find min/max from zeroes of directional derivative along x and y\n * along x axis\n */\n const theta = atan2(-ry * tangent, rx);\n const angle1 = theta;\n const angle2 = theta + PI;\n const angle3 = atan2(ry, rx * tangent);\n const angle4 = angle3 + PI;\n\n // inner bounding box\n const xArr = [x1, x];\n const yArr = [y1, y];\n const xMin = min(...xArr);\n const xMax = max(...xArr);\n const yMin = min(...yArr);\n const yMax = max(...yArr);\n\n // on path point close after start\n const angleAfterStart = endAngle - deltaAngle * 0.001;\n const pP2 = arcPoint(cx, cy, rx, ry, alpha, angleAfterStart);\n\n // on path point close before end\n const angleBeforeEnd = endAngle - deltaAngle * 0.999;\n const pP3 = arcPoint(cx, cy, rx, ry, alpha, angleBeforeEnd);\n\n /**\n * expected extremes\n * if leaving inner bounding box\n * (between segment start and end point)\n * otherwise exclude elliptic extreme points\n */\n\n // right\n // istanbul ignore if @preserve\n if (pP2.x > xMax || pP3.x > xMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle1));\n }\n\n // left\n // istanbul ignore if @preserve\n if (pP2.x < xMin || pP3.x < xMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle2));\n }\n\n // top\n // istanbul ignore if @preserve\n if (pP2.y < yMin || pP3.y < yMin) {\n // get anti-symmetric point\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle4));\n }\n\n // bottom\n // istanbul ignore if @preserve\n if (pP2.y > yMax || pP3.y > yMax) {\n // get point for this theta\n extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle3));\n }\n\n return {\n min: {\n x: min(...extremes.map(n => n.x)),\n y: min(...extremes.map(n => n.y)),\n },\n max: {\n x: max(...extremes.map(n => n.x)),\n y: max(...extremes.map(n => n.y)),\n },\n };\n};\n\nexport { arcPoint, angleBetween, getArcLength, arcLength, getArcBBox, getArcProps, getPointAtArcLength };\n\nexport {};\n","import type {\n PointTuple,\n DerivedPoint,\n QuadPoints,\n CubicPoints,\n DerivedQuadPoints,\n DerivedCubicPoints,\n QuadCoordinates,\n CubicCoordinates,\n DeriveCallback,\n} from '../types';\n\n/**\n * Tools from bezier.js by Mike 'Pomax' Kamermans\n * @see https://github.com/Pomax/bezierjs\n */\n\nconst Tvalues = [\n -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909,\n -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404,\n -0.3150426796961633743867932913198102407864, 0.3150426796961633743867932913198102407864,\n -0.4337935076260451384870842319133497124524, 0.4337935076260451384870842319133497124524,\n -0.5454214713888395356583756172183723700107, 0.5454214713888395356583756172183723700107,\n -0.6480936519369755692524957869107476266696, 0.6480936519369755692524957869107476266696,\n -0.7401241915785543642438281030999784255232, 0.7401241915785543642438281030999784255232,\n -0.8200019859739029219539498726697452080761, 0.8200019859739029219539498726697452080761,\n -0.8864155270044010342131543419821967550873, 0.8864155270044010342131543419821967550873,\n -0.9382745520027327585236490017087214496548, 0.9382745520027327585236490017087214496548,\n -0.9747285559713094981983919930081690617411, 0.9747285559713094981983919930081690617411,\n -0.9951872199970213601799974097007368118745, 0.9951872199970213601799974097007368118745,\n];\n\nconst Cvalues = [\n 0.1279381953467521569740561652246953718517, 0.1279381953467521569740561652246953718517,\n 0.1258374563468282961213753825111836887264, 0.1258374563468282961213753825111836887264,\n 0.121670472927803391204463153476262425607, 0.121670472927803391204463153476262425607,\n 0.1155056680537256013533444839067835598622, 0.1155056680537256013533444839067835598622,\n 0.1074442701159656347825773424466062227946, 0.1074442701159656347825773424466062227946,\n 0.0976186521041138882698806644642471544279, 0.0976186521041138882698806644642471544279,\n 0.086190161531953275917185202983742667185, 0.086190161531953275917185202983742667185,\n 0.0733464814110803057340336152531165181193, 0.0733464814110803057340336152531165181193,\n 0.0592985849154367807463677585001085845412, 0.0592985849154367807463677585001085845412,\n 0.0442774388174198061686027482113382288593, 0.0442774388174198061686027482113382288593,\n 0.0285313886289336631813078159518782864491, 0.0285313886289336631813078159518782864491,\n 0.0123412297999871995468056670700372915759, 0.0123412297999871995468056670700372915759,\n];\n\n/**\n *\n * @param points\n * @returns\n */\nconst deriveBezier = (points: QuadPoints | CubicPoints) => {\n const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[];\n for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) {\n const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints;\n for (let j = 0; j < c; j += 1) {\n list.push({\n x: c * (p[j + 1].x - p[j].x),\n y: c * (p[j + 1].y - p[j].y),\n t: 0,\n });\n }\n dpoints.push(list);\n p = list;\n }\n return dpoints;\n};\n\n/**\n *\n * @param points\n * @param t\n */\nconst computeBezier = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => {\n // shortcuts\n /* istanbul ignore next @preserve */\n if (t === 0) {\n points[0].t = 0;\n return points[0];\n }\n\n const order = points.length - 1;\n\n /* istanbul ignore next @preserve */\n if (t === 1) {\n points[order].t = 1;\n return points[order];\n }\n\n const mt = 1 - t;\n let p = points as typeof points | [DerivedPoint, DerivedPoint, DerivedPoint, DerivedPoint];\n\n // constant?\n /* istanbul ignore next @preserve */\n if (order === 0) {\n points[0].t = t;\n return points[0];\n }\n\n // linear?\n /* istanbul ignore else @preserve */\n if (order === 1) {\n return {\n x: mt * p[0].x + t * p[1].x,\n y: mt * p[0].y + t * p[1].y,\n t,\n };\n }\n\n // quadratic/cubic curve?\n const mt2 = mt * mt;\n const t2 = t * t;\n let a = 0;\n let b = 0;\n let c = 0;\n let d = 0;\n /* istanbul ignore else @preserve */\n if (order === 2) {\n p = [p[0], p[1], p[2], { x: 0, y: 0 } as DerivedPoint];\n a = mt2;\n b = mt * t * 2;\n c = t2;\n } else if (order === 3) {\n a = mt2 * mt;\n b = mt2 * t * 3;\n c = mt * t2 * 3;\n d = t * t2;\n }\n return {\n x: a * p[0].x + b * p[1].x + c * p[2].x + d * p[3].x,\n y: a * p[0].y + b * p[1].y + c * p[2].y + d * p[3].y,\n t,\n };\n};\n\nconst calculateBezier = (derivativeFn: DeriveCallback, t: number) => {\n const d = derivativeFn(t);\n const l = d.x * d.x + d.y * d.y;\n\n return Math.sqrt(l);\n};\n\nconst bezierLength = (derivativeFn: DeriveCallback) => {\n const z = 0.5;\n const len = Tvalues.length;\n\n let sum = 0;\n\n for (let i = 0, t; i < len; i++) {\n t = z * Tvalues[i] + z;\n sum += Cvalues[i] * calculateBezier(derivativeFn, t);\n }\n return z * sum;\n};\n\n/**\n * Returns the length of CubicBezier / Quad segment.\n * @param curve cubic / quad bezier segment\n */\nconst getBezierLength = (curve: CubicCoordinates | QuadCoordinates) => {\n const points = [] as unknown as CubicPoints | QuadPoints;\n for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) {\n points.push({\n x: curve[idx],\n y: curve[idx + 1],\n });\n }\n const dpoints = deriveBezier(points);\n return bezierLength((t: number) => {\n return computeBezier(dpoints[0], t);\n });\n};\n\n// Precision for consider cubic polynom as quadratic one\nconst CBEZIER_MINMAX_EPSILON = 0.00000001;\n\n/**\n * Returns the most extreme points in a Quad Bezier segment.\n * @param A an array which consist of X/Y values\n */\n// https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89\nconst minmaxQ = ([v1, cp, v2]: [number, number, number]) => {\n const min = Math.min(v1, v2);\n const max = Math.max(v1, v2);\n\n /* istanbul ignore next @preserve */\n if (cp >= v1 ? v2 >= cp : v2 <= cp) {\n // if no extremum in ]0,1[\n return [min, max] as PointTuple;\n }\n\n // check if the extremum E is min or max\n const E = (v1 * v2 - cp * cp) / (v1 - 2 * cp + v2);\n return (E < min ? [E, max] : [min, E]) as PointTuple;\n};\n\n/**\n * Returns the most extreme points in a Cubic Bezier segment.\n * @param A an array which consist of X/Y values\n * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127\n */\nconst minmaxC = ([v1, cp1, cp2, v2]: [number, number, number, number]) => {\n const K = v1 - 3 * cp1 + 3 * cp2 - v2;\n\n // if the polynomial is (almost) quadratic and not cubic\n /* istanbul ignore next @preserve */\n if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) {\n if (v1 === v2 && v1 === cp1) {\n // no curve, point targeting same location\n return [v1, v2] as PointTuple;\n }\n\n return minmaxQ([v1, -0.5 * v1 + 1.5 * cp1, v1 - 3 * cp1 + 3 * cp2]);\n }\n\n // the reduced discriminant of the derivative\n const T = -v1 * cp2 + v1 * v2 - cp1 * cp2 - cp1 * v2 + cp1 * cp1 + cp2 * cp2;\n\n // if the polynomial is monotone in [0,1]\n if (T <= 0) {\n return [Math.min(v1, v2), Math.max(v1, v2)] as PointTuple;\n }\n const S = Math.sqrt(T);\n\n // potential extrema\n let min = Math.min(v1, v2);\n let max = Math.max(v1, v2);\n\n const L = v1 - 2 * cp1 + cp2;\n // check local extrema\n for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) {\n // istanbul ignore next @preserve\n if (R > 0 && R < 1) {\n // if the extrema is for R in [0,1]\n const Q =\n v1 * (1 - R) * (1 - R) * (1 - R) + cp1 * 3 * (1 - R) * (1 - R) * R + cp2 * 3 * (1 - R) * R * R + v2 * R * R * R;\n if (Q < min) {\n min = Q;\n }\n if (Q > max) {\n max = Q;\n }\n }\n }\n\n return [min, max] as PointTuple;\n};\n\nexport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n};\n","import { getBezierLength, minmaxC } from './bezier';\nimport { type CubicCoordinates } from '../types';\n\n/**\n * Returns a point at a given length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the point at cubic-bezier segment length\n */\nconst getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2,\n y: t1 ** 3 * y1 + 3 * t1 ** 2 * t * c1y + 3 * t1 * t ** 2 * c2y + t ** 3 * y2,\n };\n};\n\n/**\n * Returns the length of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the CubicBezier segment length\n */\nconst getCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n};\n\n/**\n * Returns the point along a CubicBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at CubicBezier length\n */\nconst getPointAtCubicLength = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtCubicSegmentLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a CubicBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getCubicBBox = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n const cxMinMax = minmaxC([x1, c1x, c2x, x2]);\n const cyMinMax = minmaxC([y1, c1y, c2y, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n","import { getBezierLength, minmaxQ } from './bezier';\nimport { type QuadCoordinates } from '../types';\n\n/**\n * Returns the {x,y} coordinates of a point at a\n * given length of a quadratic-bezier segment.\n *\n * @see https://github.com/substack/point-at-length\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param t a [0-1] ratio\n * @returns the requested {x,y} coordinates\n */\nconst getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, t: number) => {\n const t1 = 1 - t;\n return {\n x: t1 ** 2 * x1 + 2 * t1 * t * cx + t ** 2 * x2,\n y: t1 ** 2 * y1 + 2 * t1 * t * cy + t ** 2 * y2,\n };\n};\n\n/**\n * Returns the length of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the QuadraticBezier segment length\n */\nconst getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n return getBezierLength([x1, y1, cx, cy, x2, y2]);\n};\n\n/**\n * Returns the point along a QuadraticBezier segment at a given distance.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @param distance the distance to look at\n * @returns the point at QuadraticBezier length\n */\nconst getPointAtQuadLength = (\n x1: number,\n y1: number,\n cx: number,\n cy: number,\n x2: number,\n y2: number,\n distance?: number,\n) => {\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: x1, y: y1 };\n\n /* istanbul ignore else @preserve */\n if (distanceIsNumber) {\n const currentLength = getBezierLength([x1, y1, cx, cy, x2, y2]);\n if (distance <= 0) {\n // first point already defined\n } else if (distance >= currentLength) {\n point = { x: x2, y: y2 };\n } else {\n point = getPointAtQuadSegmentLength([x1, y1, cx, cy, x2, y2], distance / currentLength);\n }\n }\n return point;\n};\n\n/**\n * Returns the boundig box of a QuadraticBezier segment.\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param cx the control point X\n * @param cy the control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the point at CubicBezier length\n */\nconst getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => {\n const cxMinMax = minmaxQ([x1, cx, x2]);\n const cyMinMax = minmaxQ([y1, cy, y2]);\n return {\n min: { x: cxMinMax[0], y: cyMinMax[0] },\n max: { x: cxMinMax[1], y: cyMinMax[1] },\n };\n};\n\nexport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n","import distanceSquareRoot from './distanceSquareRoot';\nimport { type PointTuple } from '../types';\n\n/**\n * d3-polygon-area\n * https://github.com/d3/d3-polygon\n *\n * Returns the area of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon area\n */\nconst polygonArea = (polygon: PointTuple[]) => {\n const n = polygon.length;\n let i = -1;\n let a: PointTuple;\n let b = polygon[n - 1];\n let area = 0;\n\n /* eslint-disable-next-line */\n while (++i < n) {\n a = b;\n b = polygon[i];\n area += a[1] * b[0] - a[0] * b[1];\n }\n\n return area / 2;\n};\n\n/**\n * d3-polygon-length\n * https://github.com/d3/d3-polygon\n *\n * Returns the perimeter of a polygon.\n *\n * @param polygon an array of coordinates\n * @returns the polygon length\n */\nconst polygonLength = (polygon: PointTuple[]) => {\n return polygon.reduce((length, point, i) => {\n if (i) {\n return length + distanceSquareRoot(polygon[i - 1], point);\n }\n return 0;\n }, 0);\n};\n\nexport { polygonArea, polygonLength };\n","const DISTANCE_EPSILON = 0.00001;\n\nexport default DISTANCE_EPSILON;\n","import normalizeSegment from './normalizeSegment';\nimport type { NormalArray, PathArray } from '../types';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\n\n/**\n * Normalizes a `pathArray` object for further processing:\n * * convert segments to absolute values\n * * convert shorthand path commands to their non-shorthand notation\n *\n * @param pathInput the string to be parsed or 'pathArray'\n * @returns the normalized `pathArray`\n */\nconst normalizePath = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n return iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n\n return result;\n });\n};\nexport default normalizePath;\n","import DISTANCE_EPSILON from './distanceEpsilon';\nimport type { MSegment, PathArray, PointTuple } from '../types';\nimport iterate from '../process/iterate';\nimport { getLineLength, getPointAtLineLength } from '../math/lineTools';\nimport { getArcLength, getPointAtArcLength } from '../math/arcTools';\nimport { getCubicLength, getPointAtCubicLength } from '../math/cubicTools';\nimport { getQuadLength, getPointAtQuadLength } from '../math/quadTools';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns [x,y] coordinates of a point at a given length of a shape.\n *\n * @param pathInput the `pathArray` to look into\n * @param distance the length of the shape to look at\n * @returns the requested {x, y} point coordinates\n */\nconst getPointAtLength = (pathInput: string | PathArray, distance?: number) => {\n const path = normalizePath(pathInput);\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let x = 0;\n let y = 0;\n let [mx, my] = path[0].slice(1) as PointTuple;\n const distanceIsNumber = typeof distance === 'number';\n let point = { x: mx, y: my };\n let length = 0;\n let POINT = point;\n let totalLength = 0;\n\n if (!distanceIsNumber || distance < DISTANCE_EPSILON) return point;\n\n // for (let i = 0; i < pathLen; i += 1) {\n iterate(path, (seg, _, lastX, lastY) => {\n [pathCommand] = seg;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(seg.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = seg as MSegment;\n point = { x: mx, y: my };\n length = 0;\n } else if (pathCommand === 'L') {\n point = getPointAtLineLength(data[0], data[1], data[2], data[3], distance - totalLength);\n length = getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n point = getPointAtArcLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n data[8],\n distance - totalLength,\n );\n length = getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n point = getPointAtCubicLength(\n data[0],\n data[1],\n data[2],\n data[3],\n data[4],\n data[5],\n data[6],\n data[7],\n distance - totalLength,\n );\n length = getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n point = getPointAtQuadLength(data[0], data[1], data[2], data[3], data[4], data[5], distance - totalLength);\n length = getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n point = { x: mx, y: my };\n\n length = getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n [x, y] = data.slice(-2);\n\n if (totalLength < distance) {\n POINT = point;\n } else {\n // totalLength >= distance\n // stop right here\n // stop iterator now!\n return false;\n }\n\n totalLength += length;\n return;\n });\n\n // native `getPointAtLength` behavior when the given distance\n // is higher than total length\n if (distance > totalLength - DISTANCE_EPSILON) {\n return { x, y };\n }\n\n return POINT;\n};\n\nexport default getPointAtLength;\n","import type { MSegment, PathArray } from '../types';\nimport { getLineLength } from '../math/lineTools';\nimport { getArcLength } from '../math/arcTools';\nimport { getCubicLength } from '../math/cubicTools';\nimport { getQuadLength } from '../math/quadTools';\nimport iterate from '../process/iterate';\n// import normalizePath from '../process/normalizePath';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\n/**\n * Returns the shape total length, or the equivalent to `shape.getTotalLength()`.\n *\n * The `normalizePath` version is lighter, faster, more efficient and more accurate\n * with paths that are not `curveArray`.\n *\n * @param pathInput the target `pathArray`\n * @returns the shape total length\n */\nconst getTotalLength = (pathInput: string | PathArray) => {\n const path = parsePathString(pathInput);\n const params = { ...paramsParser };\n\n let isM = false;\n let data = [] as number[];\n let pathCommand = 'M';\n let mx = 0;\n let my = 0;\n let totalLength = 0;\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const normalSegment = normalizeSegment(seg, params);\n [pathCommand] = normalSegment;\n isM = pathCommand === 'M';\n data = !isM ? [lastX, lastY].concat(normalSegment.slice(1) as number[]) : data;\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (isM) {\n // remember mx, my for Z\n [, mx, my] = normalSegment as MSegment;\n } else if (pathCommand === 'L') {\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n } else if (pathCommand === 'A') {\n totalLength += getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]);\n } else if (pathCommand === 'C') {\n totalLength += getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]);\n } else if (pathCommand === 'Q') {\n totalLength += getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]);\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n totalLength += getLineLength(data[0], data[1], data[2], data[3]);\n }\n\n const seglen = normalSegment.length;\n params.x1 = +normalSegment[seglen - 2];\n params.y1 = +normalSegment[seglen - 1];\n params.x2 = +normalSegment[seglen - 4] || params.x1;\n params.y2 = +normalSegment[seglen - 3] || params.y1;\n });\n\n return totalLength;\n};\n\nexport default getTotalLength;\n","import type { PathArray, PathSegment } from '../types';\nimport type { SegmentProperties } from '../interface';\nimport parsePathString from '../parser/parsePathString';\nimport getTotalLength from './getTotalLength';\n\n/**\n * Returns the segment, its index and length as well as\n * the length to that segment at a given length in a path.\n *\n * @param pathInput target `pathArray`\n * @param distance the given length\n * @returns the requested properties\n */\nconst getPropertiesAtLength = (pathInput: string | PathArray, distance?: number): SegmentProperties => {\n const pathArray = parsePathString(pathInput);\n\n let pathTemp = pathArray.slice(0) as PathArray;\n let pathLength = getTotalLength(pathTemp);\n let index = pathTemp.length - 1;\n let lengthAtSegment = 0;\n let length = 0;\n let segment = pathArray[0] as PathSegment;\n\n // If the path is empty, return 0.\n if (index <= 0 || !distance || !Number.isFinite(distance)) {\n return {\n segment,\n index: 0,\n length,\n lengthAtSegment,\n };\n }\n\n if (distance >= pathLength) {\n pathTemp = pathArray.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n segment = pathArray[index];\n return {\n segment,\n index,\n length,\n lengthAtSegment,\n };\n }\n\n const segments = [] as SegmentProperties[];\n while (index > 0) {\n segment = pathTemp[index];\n pathTemp = pathTemp.slice(0, -1) as PathArray;\n lengthAtSegment = getTotalLength(pathTemp);\n length = pathLength - lengthAtSegment;\n pathLength = lengthAtSegment;\n\n segments.push({\n segment,\n index,\n length,\n lengthAtSegment,\n });\n index -= 1;\n }\n\n return segments.find(({ lengthAtSegment: l }) => l <= distance) as SegmentProperties;\n};\n\nexport default getPropertiesAtLength;\n","import type { PathArray, Point } from '../types';\nimport type { PointProperties } from '../interface';\nimport getPointAtLength from './getPointAtLength';\nimport getPropertiesAtLength from './getPropertiesAtLength';\nimport getTotalLength from './getTotalLength';\nimport parsePathString from '../parser/parsePathString';\nimport normalizePath from '../process/normalizePath';\n\n/**\n * Returns the point and segment in path closest to a given point as well as\n * the distance to the path stroke.\n *\n * @see https://bl.ocks.org/mbostock/8027637\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the requested properties\n */\nconst getPropertiesAtPoint = (pathInput: string | PathArray, point: Point): PointProperties => {\n const path = parsePathString(pathInput);\n const normalPath = normalizePath(path);\n const pathLength = getTotalLength(normalPath);\n const distanceTo = (p: Point) => {\n const dx = p.x - point.x;\n const dy = p.y - point.y;\n return dx * dx + dy * dy;\n };\n let precision = 8;\n let scan: Point;\n let closest = { x: 0, y: 0 }; // make TS happy\n let scanDistance = 0;\n let bestLength = 0;\n let bestDistance = Infinity;\n\n // linear scan for coarse approximation\n for (let scanLength = 0; scanLength <= pathLength; scanLength += precision) {\n scan = getPointAtLength(normalPath, scanLength);\n scanDistance = distanceTo(scan);\n\n if (scanDistance < bestDistance) {\n closest = scan;\n bestLength = scanLength;\n bestDistance = scanDistance;\n }\n }\n\n // binary search for precise estimate\n precision /= 2;\n let before: { x: number; y: number };\n let after: { x: number; y: number };\n let beforeLength = 0;\n let afterLength = 0;\n let beforeDistance = 0;\n let afterDistance = 0;\n\n while (precision > 0.000001) {\n beforeLength = bestLength - precision;\n before = getPointAtLength(normalPath, beforeLength);\n beforeDistance = distanceTo(before);\n afterLength = bestLength + precision;\n after = getPointAtLength(normalPath, afterLength);\n afterDistance = distanceTo(after);\n\n if (beforeLength >= 0 && beforeDistance < bestDistance) {\n closest = before;\n bestLength = beforeLength;\n bestDistance = beforeDistance;\n } else if (afterLength <= pathLength && afterDistance < bestDistance) {\n closest = after;\n bestLength = afterLength;\n bestDistance = afterDistance;\n } else {\n precision /= 2;\n }\n if (precision < 0.00001) break;\n }\n\n const segment = getPropertiesAtLength(path, bestLength);\n const distance = Math.sqrt(bestDistance);\n\n return { closest, distance, segment };\n};\n\nexport default getPropertiesAtPoint;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the point in path closest to a given point.\n *\n * @param pathInput target `pathArray`\n * @param point the given point\n * @returns the best match\n */\nconst getClosestPoint = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n return getPropertiesAtPoint(pathInput, point).closest;\n};\n\nexport default getClosestPoint;\n","import pathToCurve from '../convert/pathToCurve';\nimport type { PointTuple, PathArray } from '../types';\n\n/**\n * Returns the area of a single cubic-bezier segment.\n *\n * http://objectmix.com/graphics/133553-area-closed-bezier-curve.html\n *\n * @param x1 the starting point X\n * @param y1 the starting point Y\n * @param c1x the first control point X\n * @param c1y the first control point Y\n * @param c2x the second control point X\n * @param c2y the second control point Y\n * @param x2 the ending point X\n * @param y2 the ending point Y\n * @returns the area of the cubic-bezier segment\n */\nconst getCubicSegArea = (\n x1: number,\n y1: number,\n c1x: number,\n c1y: number,\n c2x: number,\n c2y: number,\n x2: number,\n y2: number,\n) => {\n return (\n (3 *\n ((y2 - y1) * (c1x + c2x) -\n (x2 - x1) * (c1y + c2y) +\n c1y * (x1 - c2x) -\n c1x * (y1 - c2y) +\n y2 * (c2x + x1 / 3) -\n x2 * (c2y + y1 / 3))) /\n 20\n );\n};\n\n/**\n * Returns the area of a shape.\n *\n * @author Jürg Lehni & Jonathan Puckey\n *\n * @see https://github.com/paperjs/paper.js/blob/develop/src/path/Path.js\n *\n * @param path the shape `pathArray`\n * @returns the length of the cubic-bezier segment\n */\nconst getPathArea = (path: PathArray) => {\n let x = 0;\n let y = 0;\n let len = 0;\n\n return pathToCurve(path)\n .map(seg => {\n switch (seg[0]) {\n case 'M':\n [, x, y] = seg;\n return 0;\n default:\n len = getCubicSegArea(x, y, seg[1], seg[2], seg[3], seg[4], seg[5], seg[6]);\n [x, y] = seg.slice(-2) as PointTuple;\n return len;\n }\n })\n .reduce((a, b) => a + b, 0);\n};\nexport default getPathArea;\n","import getPathArea from './getPathArea';\nimport pathToCurve from '../convert/pathToCurve';\nimport type { PathArray } from '../types';\n\n/**\n * Check if a path is drawn clockwise and returns true if so,\n * false otherwise.\n *\n * @param path the path string or `pathArray`\n * @returns true when clockwise or false if not\n */\nconst getDrawDirection = (path: string | PathArray) => {\n return getPathArea(pathToCurve(path)) >= 0;\n};\n\nexport default getDrawDirection;\n","import iterate from '../process/iterate';\nimport { PathBBox } from '../interface';\nimport { MSegment, PathArray, Point } from '../types';\nimport { getLineBBox } from '../math/lineTools';\nimport { getArcBBox } from '../math/arcTools';\nimport { getCubicBBox } from '../math/cubicTools';\nimport { getQuadBBox } from '../math/quadTools';\nimport parsePathString from '../parser/parsePathString';\nimport paramsParser from '../parser/paramsParser';\nimport normalizeSegment from '../process/normalizeSegment';\n\nconst getPathBBox = (pathInput: PathArray | string) => {\n if (!pathInput) {\n return {\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n x2: 0,\n y2: 0,\n cx: 0,\n cy: 0,\n cz: 0,\n };\n }\n\n const path = parsePathString(pathInput);\n let data = [] as number[];\n let pathCommand = 'M';\n const x = 0;\n const y = 0;\n let mx = 0;\n let my = 0;\n const MIN = [] as Point[];\n const MAX = [] as Point[];\n let min = { x, y };\n let max = { x, y };\n const params = { ...paramsParser };\n\n iterate(path, (seg, _, lastX, lastY) => {\n params.x = lastX;\n params.y = lastY;\n const result = normalizeSegment(seg, params);\n [pathCommand] = result;\n data = [lastX, lastY].concat(result.slice(1) as number[]);\n\n // this segment is always ZERO\n /* istanbul ignore else @preserve */\n if (pathCommand === 'M') {\n // remember mx, my for Z\n [, mx, my] = result as MSegment;\n min = { x: mx, y: my };\n max = { x: mx, y: my };\n } else if (pathCommand === 'L') {\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n } else if (pathCommand === 'A') {\n ({ min, max } = getArcBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]));\n } else if (pathCommand === 'C') {\n ({ min, max } = getCubicBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]));\n } else if (pathCommand === 'Q') {\n ({ min, max } = getQuadBBox(data[0], data[1], data[2], data[3], data[4], data[5]));\n } else if (pathCommand === 'Z') {\n data = [lastX, lastY, mx, my];\n ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3]));\n }\n\n MIN.push(min);\n MAX.push(max);\n\n const seglen = result.length;\n params.x1 = +result[seglen - 2];\n params.y1 = +result[seglen - 1];\n params.x2 = +result[seglen - 4] || params.x1;\n params.y2 = +result[seglen - 3] || params.y1;\n });\n\n const xMin = Math.min(...MIN.map(n => n.x));\n const xMax = Math.max(...MAX.map(n => n.x));\n const yMin = Math.min(...MIN.map(n => n.y));\n const yMax = Math.max(...MAX.map(n => n.y));\n const width = xMax - xMin;\n const height = yMax - yMin;\n\n return {\n width,\n height,\n x: xMin,\n y: yMin,\n x2: xMax,\n y2: yMax,\n cx: xMin + width / 2,\n cy: yMin + height / 2,\n // an estimated guess\n cz: Math.max(width, height) + Math.min(width, height) / 2,\n } satisfies PathBBox;\n};\n\nexport default getPathBBox;\n","import type { PathArray, PathSegment } from '../types';\nimport getPropertiesAtLength from './getPropertiesAtLength';\n\n/**\n * Returns the segment at a given length.\n *\n * @param pathInput the target `pathArray`\n * @param distance the distance in path to look at\n * @returns the requested segment\n */\nconst getSegmentAtLength = (pathInput: string | PathArray, distance?: number): PathSegment | undefined => {\n return getPropertiesAtLength(pathInput, distance).segment;\n};\n\nexport default getSegmentAtLength;\n","import type { SegmentProperties } from '../interface';\nimport type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\n\n/**\n * Returns the path segment which contains a given point.\n *\n * @param path the `pathArray` to look into\n * @param point the point of the shape to look for\n * @returns the requested segment\n */\nconst getSegmentOfPoint = (\n path: string | PathArray,\n point: { x: number; y: number },\n): SegmentProperties | undefined => {\n return getPropertiesAtPoint(path, point).segment;\n};\nexport default getSegmentOfPoint;\n","import type { PathArray, PathSegment, RelativeCommand } from '../types';\nimport paramsCount from '../parser/paramsCount';\n\n/**\n * Iterates an array to check if it's an actual `pathArray`.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isPathArray = (path: unknown): path is PathArray => {\n return (\n Array.isArray(path) &&\n path.every((seg: PathSegment) => {\n const lk = seg[0].toLowerCase() as RelativeCommand;\n return (\n paramsCount[lk] === seg.length - 1 &&\n 'achlmqstvz'.includes(lk) &&\n (seg.slice(1) as unknown[]).every(Number.isFinite)\n );\n }) &&\n path.length > 0\n );\n};\nexport default isPathArray;\n","import type { AbsoluteArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all absolute values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isAbsoluteArray = (path: unknown): path is AbsoluteArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` also checks if it's `Array`\n path.every(([x]) => x === x.toUpperCase())\n );\n};\nexport default isAbsoluteArray;\n","import type { NormalArray } from '../types';\nimport isAbsoluteArray from './isAbsoluteArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all segments are in non-shorthand notation\n * with absolute values.\n *\n * @param {string | SVGPath.pathArray} path the `pathArray` to be checked\n * @returns {boolean} iteration result\n */\nconst isNormalizedArray = (path: unknown): path is NormalArray => {\n // `isAbsoluteArray` also checks if it's `Array`\n return isAbsoluteArray(path) && path.every(([pc]) => 'ACLMQZ'.includes(pc));\n};\nexport default isNormalizedArray;\n","import { CurveArray } from '../types';\nimport isNormalizedArray from './isNormalizedArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with all C (cubic bezier) segments.\n *\n * @param path the `Array` to be checked\n * @returns iteration result\n */\nconst isCurveArray = (path: unknown): path is CurveArray => {\n // `isPathArray` also checks if it's `Array`\n return isNormalizedArray(path) && path.every(([pc]) => 'MC'.includes(pc));\n};\nexport default isCurveArray;\n","import type { PathArray } from '../types';\nimport getPropertiesAtPoint from './getPropertiesAtPoint';\nimport DISTANCE_EPSILON from './distanceEpsilon';\n\n/**\n * Checks if a given point is in the stroke of a path.\n *\n * @param pathInput target path\n * @param point the given `{x,y}` point\n * @returns the query result\n */\nconst isPointInStroke = (pathInput: string | PathArray, point: { x: number; y: number }) => {\n const { distance } = getPropertiesAtPoint(pathInput, point);\n return Math.abs(distance) < DISTANCE_EPSILON; // 0.01 might be more permissive\n};\nexport default isPointInStroke;\n","import type { RelativeArray } from '../types';\nimport isPathArray from './isPathArray';\n\n/**\n * Iterates an array to check if it's a `pathArray`\n * with relative values.\n *\n * @param path the `pathArray` to be checked\n * @returns iteration result\n */\nconst isRelativeArray = (path: unknown): path is RelativeArray => {\n return (\n isPathArray(path) &&\n // `isPathArray` checks if it's `Array`\n path.slice(1).every(([pc]) => pc === pc.toLowerCase())\n );\n};\nexport default isRelativeArray;\n","import scanSegment from '../parser/scanSegment';\nimport skipSpaces from '../parser/skipSpaces';\nimport PathParser from '../parser/pathParser';\n\n/**\n * Parses a path string value to determine its validity\n * then returns true if it's valid or false otherwise.\n *\n * @param pathString the path string to be parsed\n * @returns the path string validity\n */\nconst isValidPath = (pathString: string) => {\n if (typeof pathString !== 'string' || !pathString.length) {\n return false;\n }\n\n const path = new PathParser(pathString);\n\n skipSpaces(path);\n\n while (path.index < path.max && !path.err.length) {\n scanSegment(path);\n }\n\n return !path.err.length && 'mM'.includes(path.segments[0][0]);\n};\nexport default isValidPath;\n","import type { ShapeParams } from '../interface';\n\n/**\n * Supported shapes and their specific parameters.\n */\nconst shapeParams: ShapeParams = {\n line: ['x1', 'y1', 'x2', 'y2'],\n circle: ['cx', 'cy', 'r'],\n ellipse: ['cx', 'cy', 'rx', 'ry'],\n rect: ['width', 'height', 'x', 'y', 'rx', 'ry'],\n polygon: ['points'],\n polyline: ['points'],\n glyph: ['d'],\n};\n\nexport default shapeParams;\n","import type { CircleAttr, EllipseAttr, GlyphAttr, LineAttr, PolyAttr, RectAttr, ShapeParams } from '../interface';\nimport type { PathArray, PathSegment, ShapeOps, ShapeTypes } from '../types';\nimport error from '../parser/error';\nimport parsePathString from '../parser/parsePathString';\nimport shapeParams from './shapeParams';\nimport isPathArray from './isPathArray';\n\n/**\n * Returns a new `pathArray` from line attributes.\n *\n * @param attr shape configuration\n * @returns a new line `pathArray`\n */\nexport const getLinePath = (attr: LineAttr): PathArray => {\n let { x1, y1, x2, y2 } = attr;\n [x1, y1, x2, y2] = [x1, y1, x2, y2].map(a => +a);\n return [\n ['M', x1, y1],\n ['L', x2, y2],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from polyline/polygon attributes.\n *\n * @param attr shape configuration\n * @return a new polygon/polyline `pathArray`\n */\nexport const getPolyPath = (attr: PolyAttr): PathArray => {\n const pathArray = [] as PathSegment[];\n const points = (attr.points || '')\n .trim()\n .split(/[\\s|,]/)\n .map(a => +a);\n\n let index = 0;\n while (index < points.length) {\n pathArray.push([index ? 'L' : 'M', points[index], points[index + 1]]);\n index += 2;\n }\n\n return (attr.type === 'polygon' ? [...pathArray, ['z']] : pathArray) as PathArray;\n};\n\n/**\n * Returns a new `pathArray` from circle attributes.\n *\n * @param attr shape configuration\n * @return a circle `pathArray`\n */\nexport const getCirclePath = (attr: CircleAttr): PathArray => {\n let { cx, cy, r } = attr;\n [cx, cy, r] = [cx, cy, r].map(a => +a);\n\n return [\n ['M', cx - r, cy],\n ['a', r, r, 0, 1, 0, 2 * r, 0],\n ['a', r, r, 0, 1, 0, -2 * r, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` from ellipse attributes.\n *\n * @param attr shape configuration\n * @return an ellipse `pathArray`\n */\nexport const getEllipsePath = (attr: EllipseAttr): PathArray => {\n let { cx, cy } = attr;\n let rx = attr.rx || 0;\n let ry = attr.ry || rx;\n [cx, cy, rx, ry] = [cx, cy, rx, ry].map(a => +a);\n\n return [\n ['M', cx - rx, cy],\n ['a', rx, ry, 0, 1, 0, 2 * rx, 0],\n ['a', rx, ry, 0, 1, 0, -2 * rx, 0],\n ];\n};\n\n/**\n * Returns a new `pathArray` like from rect attributes.\n *\n * @param attr object with properties above\n * @return a new `pathArray` from `` attributes\n */\nexport const getRectanglePath = (attr: RectAttr): PathArray => {\n const x = +attr.x || 0;\n const y = +attr.y || 0;\n const w = +attr.width;\n const h = +attr.height;\n let rx = +(attr.rx || 0);\n let ry = +(attr.ry || rx);\n\n // Validity checks from http://www.w3.org/TR/SVG/shapes.html#RectElement:\n if (rx || ry) {\n // rx = !rx ? ry : rx;\n // ry = !ry ? rx : ry;\n\n /* istanbul ignore else @preserve */\n if (rx * 2 > w) rx -= (rx * 2 - w) / 2;\n /* istanbul ignore else @preserve */\n if (ry * 2 > h) ry -= (ry * 2 - h) / 2;\n\n return [\n ['M', x + rx, y],\n ['h', w - rx * 2],\n ['s', rx, 0, rx, ry],\n ['v', h - ry * 2],\n ['s', 0, ry, -rx, ry],\n ['h', -w + rx * 2],\n ['s', -rx, 0, -rx, -ry],\n ['v', -h + ry * 2],\n ['s', 0, -ry, rx, -ry],\n ];\n }\n\n return [['M', x, y], ['h', w], ['v', h], ['H', x], ['Z']];\n};\n\n/**\n * Returns a new `pathArray` created from attributes of a ``, ``,\n * ``, ``, ``, ``, or ``.\n *\n * The default `ownerDocument` is your current `document` browser page,\n * if you want to use in server-side using `jsdom`, you can pass the\n * `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * @param element target shape\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPathArray = (element: ShapeTypes | ShapeOps, ownerDocument?: Document) => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName && [...supportedShapes, 'path'].every(s => tagName !== s)) {\n throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n }\n\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n } else {\n Object.assign(config, element);\n }\n\n // set d\n let pathArray = [] as unknown as PathArray;\n\n /* istanbul ignore else */\n if (type === 'circle') pathArray = getCirclePath(config as unknown as CircleAttr);\n else if (type === 'ellipse') pathArray = getEllipsePath(config as unknown as EllipseAttr);\n else if (['polyline', 'polygon'].includes(type)) pathArray = getPolyPath(config as unknown as PolyAttr);\n else if (type === 'rect') pathArray = getRectanglePath(config as unknown as RectAttr);\n else if (type === 'line') pathArray = getLinePath(config as unknown as LineAttr);\n else if (['glyph', 'path'].includes(type)) {\n pathArray = parsePathString(\n targetIsElement\n ? element.getAttribute('d') || /* istanbul ignore next @preserve */ ''\n : (element as GlyphAttr).d || '',\n );\n }\n\n // replace target element\n if (isPathArray(pathArray) && pathArray.length) {\n return pathArray;\n }\n return false;\n};\nexport default shapeToPathArray;\n","import type { ShapeParams } from '../interface';\nimport type { ShapeOps, ShapeTypes } from '../types';\nimport pathToString from '../convert/pathToString';\nimport defaultOptions from '../options/options';\nimport error from '../parser/error';\nimport isValidPath from './isValidPath';\nimport shapeToPathArray from './shapeToPathArray';\nimport shapeParams from './shapeParams';\n\n/**\n * Returns a new `` element created from attributes of a ``, ``,\n * ``, ``, ``, `` or ``. If `replace` parameter\n * is `true`, it will replace the target. The default `ownerDocument` is your current\n * `document` browser page, if you want to use in server-side using `jsdom`, you can\n * pass the `jsdom` `document` to `ownDocument`.\n *\n * It can also work with an options object, see the type below\n *\n * @see ShapeOps\n *\n * The newly created `` element keeps all non-specific\n * attributes like `class`, `fill`, etc.\n *\n * @param element target shape\n * @param replace option to replace target\n * @param ownerDocument document for create element\n * @return the newly created `` element\n */\nconst shapeToPath = (\n element: ShapeTypes | ShapeOps,\n replace?: boolean,\n ownerDocument?: Document,\n): SVGPathElement | false => {\n const doc = ownerDocument || document;\n const win = doc.defaultView || /* istanbul ignore next */ window;\n const supportedShapes = Object.keys(shapeParams) as (keyof ShapeParams)[];\n const targetIsElement = element instanceof win.SVGElement;\n const tagName = targetIsElement ? element.tagName : null;\n\n if (tagName === 'path') throw TypeError(`${error}: \"${tagName}\" is already SVGPathElement`);\n if (tagName && supportedShapes.every(s => tagName !== s)) throw TypeError(`${error}: \"${tagName}\" is not SVGElement`);\n\n const path = doc.createElementNS('http://www.w3.org/2000/svg', 'path');\n const type = (targetIsElement ? tagName : element.type) as ShapeOps['type'];\n const shapeAttrs = shapeParams[type] as string[];\n const config = { type } as Record;\n\n // set d\n const round = defaultOptions.round as number;\n const pathArray = shapeToPathArray(element, doc);\n const description = pathArray && pathArray.length ? pathToString(pathArray, round) : '';\n\n if (targetIsElement) {\n shapeAttrs.forEach(p => {\n config[p] = element.getAttribute(p) as string;\n });\n // set no-specific shape attributes: fill, stroke, etc\n Object.values(element.attributes).forEach(({ name, value }) => {\n if (!shapeAttrs.includes(name)) path.setAttribute(name, value);\n });\n } else {\n Object.assign(config, element);\n // set no-specific shape attributes: fill, stroke, etc\n Object.keys(config).forEach(k => {\n if (!shapeAttrs.includes(k) && k !== 'type') {\n path.setAttribute(\n k.replace(/[A-Z]/g, m => `-${m.toLowerCase()}`),\n config[k],\n );\n }\n });\n }\n\n // replace target element\n if (isValidPath(description)) {\n path.setAttribute('d', description);\n if (replace && targetIsElement) {\n element.before(path, element);\n element.remove();\n }\n return path;\n }\n return false;\n};\n\nexport default shapeToPath;\n","import CSSMatrix from '@thednp/dommatrix';\n// import type { TransformObject } from '../interface';\nimport type { TransformObjectValues } from '../types';\n\n/**\n * Returns a transformation matrix to apply to `` elements.\n *\n * @see TransformObjectValues\n *\n * @param transform the `transformObject`\n * @returns a new transformation matrix\n */\nconst getSVGMatrix = (transform: TransformObjectValues): CSSMatrix => {\n let matrix = new CSSMatrix();\n const { origin } = transform;\n const [originX, originY] = origin as [number, number, number];\n const { translate } = transform;\n const { rotate } = transform;\n const { skew } = transform;\n const { scale } = transform;\n\n // set translate\n if (\n Array.isArray(translate) &&\n translate.length >= 2 &&\n translate.every(x => !Number.isNaN(+x)) &&\n translate.some(x => x !== 0)\n ) {\n matrix = matrix.translate(...(translate as [number, number, number?]));\n } else if (typeof translate === 'number' && !Number.isNaN(translate)) {\n matrix = matrix.translate(translate);\n }\n\n if (rotate || skew || scale) {\n // set SVG transform-origin, always defined\n matrix = matrix.translate(originX, originY);\n\n // set rotation\n if (\n Array.isArray(rotate) &&\n rotate.length >= 2 &&\n rotate.every(x => !Number.isNaN(+x)) &&\n rotate.some(x => x !== 0)\n ) {\n matrix = matrix.rotate(...(rotate as [number, number, number?]));\n } else if (typeof rotate === 'number' && !Number.isNaN(rotate)) {\n matrix = matrix.rotate(rotate);\n }\n\n // set skew(s)\n if (Array.isArray(skew) && skew.length === 2 && skew.every(x => !Number.isNaN(+x)) && skew.some(x => x !== 0)) {\n matrix = skew[0] ? matrix.skewX(skew[0]) : matrix;\n matrix = skew[1] ? matrix.skewY(skew[1]) : matrix;\n } else if (typeof skew === 'number' && !Number.isNaN(skew)) {\n matrix = matrix.skewX(skew);\n }\n\n // set scale\n if (Array.isArray(scale) && scale.length >= 2 && scale.every(x => !Number.isNaN(+x)) && scale.some(x => x !== 1)) {\n matrix = matrix.scale(...(scale as [number, number, number?]));\n } else if (typeof scale === 'number' && !Number.isNaN(scale)) {\n matrix = matrix.scale(scale);\n }\n // set SVG transform-origin\n matrix = matrix.translate(-originX, -originY);\n }\n\n return matrix;\n};\nexport default getSVGMatrix;\n","import defaultOptions from '../options/options';\nimport type { ParserParams } from '../interface';\nimport roundTo from '../math/roundTo';\nimport type { AbsoluteSegment, NormalSegment, PathCommand, ShortSegment, SSegment, TSegment } from '../types';\n\n/**\n * Shorten a single segment of a `pathArray` object.\n *\n * @param segment the `absoluteSegment` object\n * @param normalSegment the `normalSegment` object\n * @param params the coordinates of the previous segment\n * @param prevCommand the path command of the previous segment\n * @returns the shortened segment\n */\nconst shortenSegment = (\n segment: AbsoluteSegment,\n normalSegment: NormalSegment,\n params: ParserParams,\n prevCommand: PathCommand,\n): ShortSegment => {\n const [pathCommand] = segment;\n const { round: defaultRound } = defaultOptions;\n const round = typeof defaultRound === 'number' ? defaultRound : /* istanbul ignore next */ 4;\n const normalValues = normalSegment.slice(1) as number[];\n const { x1, y1, x2, y2, x, y } = params;\n const [nx, ny] = normalValues.slice(-2);\n const result = segment;\n\n if (!'TQ'.includes(pathCommand)) {\n // optional but good to be cautious\n params.qx = null;\n params.qy = null;\n }\n\n if (pathCommand === 'L') {\n if (roundTo(x, round) === roundTo(nx, round)) {\n return ['V', ny];\n } else if (roundTo(y, round) === roundTo(ny, round)) {\n return ['H', nx];\n }\n } else if (pathCommand === 'C') {\n const [nx1, ny1] = normalValues;\n params.x1 = nx1;\n params.y1 = ny1;\n\n if (\n 'CS'.includes(prevCommand) &&\n ((roundTo(nx1, round) === roundTo(x1 * 2 - x2, round) && roundTo(ny1, round) === roundTo(y1 * 2 - y2, round)) ||\n (roundTo(x1, round) === roundTo(x2 * 2 - x, round) && roundTo(y1, round) === roundTo(y2 * 2 - y, round)))\n ) {\n return ['S', normalValues[2], normalValues[3], normalValues[4], normalValues[5]] as SSegment;\n }\n } else if (pathCommand === 'Q') {\n const [qx, qy] = normalValues;\n params.qx = qx;\n params.qy = qy;\n\n if (\n 'QT'.includes(prevCommand) &&\n roundTo(qx, round) === roundTo(x1 * 2 - x2, round) &&\n roundTo(qy, round) === roundTo(y1 * 2 - y2, round)\n ) {\n return ['T', normalValues[2], normalValues[3]] as TSegment;\n }\n }\n\n // ['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)\n return result as ShortSegment;\n};\n\nexport default shortenSegment;\n","import type { PathCommand, PathSegment } from '../types';\nimport roundTo from '../math/roundTo';\n\nconst roundSegment = (segment: T, roundOption: number) => {\n const values = (segment.slice(1) as number[]).map(n => roundTo(n, roundOption));\n return [segment[0] as PathCommand | number].concat(values) as T;\n};\n\nexport default roundSegment;\n","import pathToAbsolute from '../convert/pathToAbsolute';\nimport shortenSegment from './shortenSegment';\nimport paramsParser from '../parser/paramsParser';\nimport type { AbsoluteSegment, PathArray, PathCommand } from '../types';\nimport iterate from './iterate';\nimport normalizeSegment from './normalizeSegment';\nimport relativizeSegment from './relativizeSegment';\nimport roundSegment from './roundSegment';\n\n/**\n * Optimizes a `pathArray` object:\n * * convert segments to shorthand if possible\n * * select shortest segments from absolute and relative `pathArray`s\n *\n * @param pathInput a string or `pathArray`\n * @param roundOption the amount of decimals to round values to\n * @returns the optimized `pathArray`\n */\nconst optimizePath = (pathInput: PathArray, roundOption: number) => {\n const path = pathToAbsolute(pathInput);\n // allow for ZERO decimals or use an aggressive value of 2\n const round =\n typeof roundOption === 'number' && roundOption >= 0 ? roundOption : /* istanbul ignore next @preserve */ 2;\n // this utility overrides the iterator params\n const optimParams = { ...paramsParser };\n\n const allPathCommands = [] as PathCommand[];\n let pathCommand = 'M' as PathCommand;\n let prevCommand = 'Z' as PathCommand;\n\n return iterate(path, (seg, i, lastX, lastY) => {\n optimParams.x = lastX;\n optimParams.y = lastY;\n // const absoluteSegment = absolutizeSegment(seg, optimParams);\n const normalizedSegment = normalizeSegment(seg, optimParams);\n let result = seg;\n [pathCommand] = seg;\n\n // Save current path command\n allPathCommands[i] = pathCommand;\n if (i) {\n // Get previous path command for `shortenSegment`\n prevCommand = allPathCommands[i - 1];\n const shortSegment = shortenSegment(seg as AbsoluteSegment, normalizedSegment, optimParams, prevCommand);\n const absSegment = roundSegment(shortSegment, round);\n const absString = absSegment.join('');\n const relativeSegment = relativizeSegment(shortSegment, i, lastX, lastY);\n const relSegment = roundSegment(relativeSegment, round);\n const relString = relSegment.join('');\n result = absString.length < relString.length ? absSegment : relSegment;\n }\n\n const seglen = normalizedSegment.length;\n optimParams.x1 = +normalizedSegment[seglen - 2];\n optimParams.y1 = +normalizedSegment[seglen - 1];\n optimParams.x2 = +normalizedSegment[seglen - 4] || optimParams.x1;\n optimParams.y2 = +normalizedSegment[seglen - 3] || optimParams.y1;\n\n return result;\n });\n};\n\nexport default optimizePath;\n","import CSSMatrix from '@thednp/dommatrix';\nimport { type PointTuple } from '../types';\n\n/**\n * Transforms a specified point using a matrix, returning a new\n * Tuple *Object* comprising of the transformed point.\n * Neither the matrix nor the original point are altered.\n *\n * @copyright thednp © 2021\n *\n * @param cssm CSSMatrix instance\n * @param v Tuple\n * @return the resulting Tuple\n */\nconst translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => {\n let m = CSSMatrix.Translate(v[0], v[1], v[2]);\n\n [, , , m.m44] = v;\n m = cssm.multiply(m);\n\n return [m.m41, m.m42, m.m43, m.m44];\n};\n\n/**\n * Returns the [x,y] projected coordinates for a given an [x,y] point\n * and an [x,y,z] perspective origin point.\n *\n * Equation found here =>\n * http://en.wikipedia.org/wiki/3D_projection#Diagram\n * Details =>\n * https://stackoverflow.com/questions/23792505/predicted-rendering-of-css-3d-transformed-pixel\n *\n * @param m the transformation matrix\n * @param point2D the initial [x,y] coordinates\n * @param origin the [x,y,z] transform origin\n * @returns the projected [x,y] coordinates\n */\nconst projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => {\n const [originX, originY, originZ] = origin;\n const [x, y, z] = translatePoint(m, [point2D[0], point2D[1], 0, 1]);\n\n const relativePositionX = x - originX;\n const relativePositionY = y - originY;\n const relativePositionZ = z - originZ;\n\n return [\n // protect against division by ZERO\n relativePositionX * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originX,\n relativePositionY * (Math.abs(originZ) / Math.abs(relativePositionZ) || 1) + originY,\n ];\n};\nexport default projection2d;\n","import type { CSegment, CurveArray, MSegment, PathCommand } from '../types';\n\n/**\n * Reverses all segments of a `pathArray`\n * which consists of only C (cubic-bezier) path commands.\n *\n * @param path the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reverseCurve = (path: CurveArray) => {\n const rotatedCurve = path\n .slice(1)\n .map((x, i, curveOnly) =>\n !i ? path[0].slice(1).concat(x.slice(1) as number[]) : curveOnly[i - 1].slice(-2).concat(x.slice(1)),\n )\n .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))]))\n .reverse() as (MSegment | CSegment)[];\n\n return [['M' as PathCommand | number].concat(rotatedCurve[0].slice(0, 2))].concat(\n rotatedCurve.map(x => ['C' as PathCommand | number].concat(x.slice(2))),\n ) as CurveArray;\n};\n\nexport default reverseCurve;\n","import type {\n ASegment,\n CSegment,\n HSegment,\n MSegment,\n PathArray,\n PathSegment,\n PointTuple,\n QSegment,\n SSegment,\n TSegment,\n VSegment,\n} from '../types';\nimport pathToAbsolute from '../convert/pathToAbsolute';\nimport normalizePath from './normalizePath';\nimport iterate from './iterate';\n\n/**\n * Reverses all segments of a `pathArray` and returns a new `pathArray` instance\n * with absolute values.\n *\n * @param pathInput the source `pathArray`\n * @returns the reversed `pathArray`\n */\nconst reversePath = (pathInput: PathArray) => {\n const absolutePath = pathToAbsolute(pathInput);\n const normalizedPath = normalizePath(absolutePath);\n const pLen = absolutePath.length;\n const isClosed = absolutePath[pLen - 1][0] === 'Z';\n\n const reversedPath = iterate(absolutePath, (segment, i) => {\n const normalizedSegment = normalizedPath[i];\n const prevSeg = i && absolutePath[i - 1];\n const prevCommand = prevSeg && prevSeg[0];\n const nextSeg = absolutePath[i + 1];\n const nextCommand = nextSeg && nextSeg[0];\n const [pathCommand] = segment;\n const [x, y] = normalizedPath[i ? i - 1 : pLen - 1].slice(-2) as PointTuple;\n let result = segment;\n\n switch (pathCommand) {\n case 'M':\n result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment;\n break;\n case 'A':\n result = [\n pathCommand,\n segment[1],\n segment[2],\n segment[3],\n segment[4],\n segment[5] === 1 ? 0 : 1,\n x,\n y,\n ] as ASegment;\n break;\n case 'C':\n if (nextSeg && nextCommand === 'S') {\n result = ['S', segment[1], segment[2], x, y] as SSegment;\n } else {\n result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment;\n }\n break;\n case 'S':\n if (prevCommand && 'CS'.includes(prevCommand) && (!nextSeg || nextCommand !== 'S')) {\n result = [\n 'C',\n normalizedSegment[3],\n normalizedSegment[4],\n normalizedSegment[1],\n normalizedSegment[2],\n x,\n y,\n ] as CSegment;\n } else {\n result = [pathCommand, normalizedSegment[1], normalizedSegment[2], x, y] as SSegment;\n }\n break;\n case 'Q':\n if (nextSeg && nextCommand === 'T') {\n result = ['T', x, y] as TSegment;\n } else {\n result = [pathCommand, segment[1], segment[2], x, y] as QSegment;\n }\n break;\n case 'T':\n if (prevCommand && 'QT'.includes(prevCommand) && (!nextSeg || nextCommand !== 'T')) {\n result = ['Q', normalizedSegment[1], normalizedSegment[2], x, y] as QSegment;\n } else {\n result = [pathCommand, x, y] as TSegment;\n }\n break;\n case 'Z':\n result = ['M', x, y] as MSegment;\n break;\n case 'H':\n result = [pathCommand, x] as HSegment;\n break;\n case 'V':\n result = [pathCommand, y] as VSegment;\n break;\n default:\n result = [pathCommand as typeof pathCommand | number].concat(segment.slice(1, -2), x, y) as PathSegment;\n }\n\n return result;\n });\n\n return (\n isClosed ? reversedPath.reverse() : [reversedPath[0] as PathSegment].concat(reversedPath.slice(1).reverse())\n ) as PathArray;\n};\n\nexport default reversePath;\n","import type { PathArray } from '../types';\nimport defaultOptions from '../options/options';\nimport iterate from './iterate';\nimport roundSegment from './roundSegment';\n\n/**\n * Rounds the values of a `pathArray` instance to\n * a specified amount of decimals and returns it.\n *\n * @param path the source `pathArray`\n * @param roundOption the amount of decimals to round numbers to\n * @returns the resulted `pathArray` with rounded values\n */\nconst roundPath = (path: PathArray, roundOption?: number | 'off') => {\n let { round } = defaultOptions;\n // allow for ZERO decimals\n round =\n roundOption === 'off'\n ? roundOption\n : typeof roundOption === 'number' && roundOption >= 0\n ? roundOption\n : typeof round === 'number' && round >= 0\n ? round\n : /* istanbul ignore next @preserve */ 'off';\n\n /* istanbul ignore else @preserve */\n if (round === 'off') return path.slice(0) as PathArray;\n\n return iterate(path, segment => {\n return roundSegment(segment, round);\n });\n};\nexport default roundPath;\n","import midPoint from '../math/midPoint';\nimport type { CubicSegment, PointTuple } from '../types';\n\n/**\n * Split a cubic-bezier segment into two.\n *\n * @param pts the cubic-bezier parameters\n * @param ratio the cubic-bezier parameters\n * @return two new cubic-bezier segments\n */\nconst splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => {\n const t = ratio;\n const p0 = pts.slice(0, 2) as PointTuple;\n const p1 = pts.slice(2, 4) as PointTuple;\n const p2 = pts.slice(4, 6) as PointTuple;\n const p3 = pts.slice(6, 8) as PointTuple;\n const p4 = midPoint(p0, p1, t);\n const p5 = midPoint(p1, p2, t);\n const p6 = midPoint(p2, p3, t);\n const p7 = midPoint(p4, p5, t);\n const p8 = midPoint(p5, p6, t);\n const p9 = midPoint(p7, p8, t);\n\n return [\n ['C', p4[0], p4[1], p7[0], p7[1], p9[0], p9[1]],\n ['C', p8[0], p8[1], p6[0], p6[1], p3[0], p3[1]],\n ];\n};\nexport default splitCubic;\n","import paramsParser from '../parser/paramsParser';\nimport type { AbsoluteCommand, HSegment, MSegment, PathArray, PointTuple, RelativeCommand, VSegment } from '../types';\n\n/**\n * Split a path into an `Array` of sub-path strings.\n *\n * In the process, values are converted to absolute\n * for visual consistency.\n *\n * @param pathInput the source `pathArray`\n * @return an array with all sub-path strings\n */\nconst splitPath = (pathInput: PathArray): PathArray[] => {\n const composite = [] as PathArray[];\n let path: PathArray;\n let pi = -1;\n let x = 0;\n let y = 0;\n let mx = 0;\n let my = 0;\n const params = { ...paramsParser };\n\n pathInput.forEach(seg => {\n const [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase() as AbsoluteCommand;\n const relCommand = pathCommand.toLowerCase() as RelativeCommand;\n const isRelative = pathCommand === relCommand;\n const values = seg.slice(1) as number[];\n\n if (absCommand === 'M') {\n pi += 1;\n [x, y] = values as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n mx = x;\n my = y;\n path = [(isRelative ? [absCommand, mx, my] : seg) as MSegment];\n } else {\n if (absCommand === 'Z') {\n x = mx;\n y = my;\n } else if (absCommand === 'H') {\n [, x] = seg as HSegment;\n x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0;\n } else if (absCommand === 'V') {\n [, y] = seg as VSegment;\n y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0;\n } else {\n [x, y] = seg.slice(-2) as PointTuple;\n x += isRelative ? params.x : 0;\n y += isRelative ? params.y : 0;\n }\n path.push(seg);\n }\n\n params.x = x;\n params.y = y;\n composite[pi] = path;\n });\n\n return composite;\n};\nexport default splitPath;\n","import getSVGMatrix from './getSVGMatrix';\nimport projection2d from './projection2d';\nimport defaultOptions from '../options/options';\nimport type { AbsoluteArray, AbsoluteSegment, CSegment, LSegment, PathArray, TransformObjectValues } from '../types';\nimport type { TransformObject } from '../interface';\nimport iterate from './iterate';\nimport parsePathString from '../parser/parsePathString';\nimport segmentToCubic from './segmentToCubic';\nimport normalizeSegment from './normalizeSegment';\nimport paramsParser from '../parser/paramsParser';\nimport absolutizeSegment from './absolutizeSegment';\n\n/**\n * Apply a 2D / 3D transformation to a `pathArray` instance.\n *\n * Since *SVGElement* doesn't support 3D transformation, this function\n * creates a 2D projection of the element.\n *\n * @param path the `pathArray` to apply transformation\n * @param transform the transform functions `Object`\n * @returns the resulted `pathArray`\n */\nconst transformPath = (pathInput: PathArray | string, transform?: Partial) => {\n // last x and y transformed values\n let x = 0;\n let y = 0;\n // new x and y transformed\n let lx = 0;\n let ly = 0;\n // segment params iteration index and length\n let j = 0;\n let jj = 0;\n let pathCommand = 'M';\n // transform uses it's own set of params\n const transformParams = { ...paramsParser };\n const path = parsePathString(pathInput);\n const transformProps = transform && Object.keys(transform);\n\n // when used as a static method, invalidate somehow\n if (!transform || (transformProps && !transformProps.length)) return path.slice(0) as typeof path;\n\n // transform origin is extremely important\n if (!transform.origin) {\n Object.assign(transform, { origin: defaultOptions.origin });\n }\n const origin = transform.origin as [number, number, number];\n const matrixInstance = getSVGMatrix(transform as TransformObjectValues);\n\n if (matrixInstance.isIdentity) return path.slice(0) as typeof path;\n\n return iterate(path, (seg, index, lastX, lastY) => {\n transformParams.x = lastX;\n transformParams.y = lastY;\n [pathCommand] = seg;\n const absCommand = pathCommand.toUpperCase();\n const isRelative = absCommand !== pathCommand;\n const absoluteSegment = isRelative\n ? absolutizeSegment(seg, index, lastX, lastY)\n : (seg.slice(0) as AbsoluteSegment);\n\n let result =\n absCommand === 'A'\n ? segmentToCubic(absoluteSegment, transformParams)\n : ['V', 'H'].includes(absCommand)\n ? normalizeSegment(absoluteSegment, transformParams)\n : absoluteSegment;\n\n // update pathCommand\n pathCommand = result[0];\n const isLongArc = pathCommand === 'C' && result.length > 7;\n const tempSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as AbsoluteSegment;\n\n if (isLongArc) {\n path.splice(index + 1, 0, ['C' as typeof pathCommand | number].concat(result.slice(7)) as CSegment);\n result = tempSegment as CSegment;\n }\n\n if (pathCommand === 'L') {\n [lx, ly] = projection2d(matrixInstance, [(result as LSegment)[1], (result as LSegment)[2]], origin);\n\n /* istanbul ignore else @preserve */\n if (x !== lx && y !== ly) {\n result = ['L', lx, ly];\n } else if (y === ly) {\n result = ['H', lx];\n } else if (x === lx) {\n result = ['V', ly];\n }\n } else {\n for (j = 1, jj = result.length; j < jj; j += 2) {\n [lx, ly] = projection2d(matrixInstance, [+result[j], +result[j + 1]], origin);\n result[j] = lx;\n result[j + 1] = ly;\n }\n }\n // now update x and y\n x = lx;\n y = ly;\n\n const seglen = tempSegment.length;\n transformParams.x1 = +tempSegment[seglen - 2];\n transformParams.y1 = +tempSegment[seglen - 1];\n transformParams.x2 = +tempSegment[seglen - 4] || transformParams.x1;\n transformParams.y2 = +tempSegment[seglen - 3] || transformParams.y1;\n\n return result;\n });\n};\n\nexport default transformPath;\n","'use strict';\nimport CSSMatrix from '@thednp/dommatrix';\nimport { PointTuple, PathArray, TransformObjectValues } from './types';\nimport type { Options, TransformEntries, TransformObject } from './interface';\nexport * from './types';\nexport * from './interface';\nimport defaultOptions from './options/options';\n\nimport pathToAbsolute from './convert/pathToAbsolute';\nimport pathToRelative from './convert/pathToRelative';\nimport pathToCurve from './convert/pathToCurve';\nimport pathToString from './convert/pathToString';\nimport * as arcTools from './math/arcTools';\nimport {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n} from './math/bezier';\nimport { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools';\nimport { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools';\nimport { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools';\nimport { polygonArea, polygonLength } from './math/polygonTools';\n\nimport distanceSquareRoot from './math/distanceSquareRoot';\nimport midPoint from './math/midPoint';\nimport rotateVector from './math/rotateVector';\nimport roundTo from './math/roundTo';\n\nimport error from './parser/error';\nimport parsePathString from './parser/parsePathString';\nimport finalizeSegment from './parser/finalizeSegment';\nimport invalidPathValue from './parser/invalidPathValue';\nimport isArcCommand from './parser/isArcCommand';\nimport isDigit from './parser/isDigit';\nimport isDigitStart from './parser/isDigitStart';\nimport isMoveCommand from './parser/isMoveCommand';\nimport isPathCommand from './parser/isPathCommand';\nimport isSpace from './parser/isSpace';\nimport paramsCount from './parser/paramsCount';\nimport paramsParser from './parser/paramsParser';\nimport pathParser from './parser/pathParser';\nimport scanFlag from './parser/scanFlag';\nimport scanParam from './parser/scanParam';\nimport scanSegment from './parser/scanSegment';\nimport skipSpaces from './parser/skipSpaces';\n\nimport distanceEpsilon from './util/distanceEpsilon';\nimport getClosestPoint from './util/getClosestPoint';\nimport getDrawDirection from './util/getDrawDirection';\nimport getPathArea from './util/getPathArea';\nimport getPathBBox from './util/getPathBBox';\nimport getPointAtLength from './util/getPointAtLength';\nimport getPropertiesAtLength from './util/getPropertiesAtLength';\nimport getPropertiesAtPoint from './util/getPropertiesAtPoint';\nimport getSegmentAtLength from './util/getSegmentAtLength';\nimport getSegmentOfPoint from './util/getSegmentOfPoint';\nimport getTotalLength from './util/getTotalLength';\n\nimport isAbsoluteArray from './util/isAbsoluteArray';\nimport isCurveArray from './util/isCurveArray';\nimport isNormalizedArray from './util/isNormalizedArray';\nimport isPathArray from './util/isPathArray';\nimport isPointInStroke from './util/isPointInStroke';\nimport isRelativeArray from './util/isRelativeArray';\nimport isValidPath from './util/isValidPath';\nimport shapeParams from './util/shapeParams';\nimport shapeToPath from './util/shapeToPath';\nimport shapeToPathArray from './util/shapeToPathArray';\n\nimport absolutizeSegment from './process/absolutizeSegment';\nimport arcToCubic from './process/arcToCubic';\nimport getSVGMatrix from './process/getSVGMatrix';\nimport iterate from './process/iterate';\nimport lineToCubic from './process/lineToCubic';\nimport normalizePath from './process/normalizePath';\nimport normalizeSegment from './process/normalizeSegment';\nimport optimizePath from './process/optimizePath';\nimport projection2d from './process/projection2d';\nimport quadToCubic from './process/quadToCubic';\nimport relativizeSegment from './process/relativizeSegment';\nimport reverseCurve from './process/reverseCurve';\nimport reversePath from './process/reversePath';\nimport roundPath from './process/roundPath';\nimport roundSegment from './process/roundSegment';\nimport segmentToCubic from './process/segmentToCubic';\nimport shortenSegment from './process/shortenSegment';\nimport splitCubic from './process/splitCubic';\nimport splitPath from './process/splitPath';\nimport transformPath from './process/transformPath';\n\n/**\n * Creates a new SVGPathCommander instance with the following properties:\n * * segments: `pathArray`\n * * round: number\n * * origin: [number, number, number?]\n *\n * @class\n * @author thednp \n * @returns a new SVGPathCommander instance\n */\nclass SVGPathCommander {\n public static CSSMatrix = CSSMatrix;\n public static pathToAbsolute = pathToAbsolute;\n public static pathToRelative = pathToRelative;\n public static pathToCurve = pathToCurve;\n public static pathToString = pathToString;\n public static arcTools = arcTools;\n public static bezierTools = {\n Cvalues,\n Tvalues,\n minmaxC,\n minmaxQ,\n getBezierLength,\n bezierLength,\n calculateBezier,\n computeBezier,\n deriveBezier,\n CBEZIER_MINMAX_EPSILON,\n };\n public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength };\n public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength };\n public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength };\n public static polygonTools = { polygonArea, polygonLength };\n public static distanceSquareRoot = distanceSquareRoot;\n public static distanceEpsilon = distanceEpsilon;\n public static midPoint = midPoint;\n public static rotateVector = rotateVector;\n public static roundTo = roundTo;\n public static finalizeSegment = finalizeSegment;\n public static invalidPathValue = invalidPathValue;\n public static isArcCommand = isArcCommand;\n public static isDigit = isDigit;\n public static isDigitStart = isDigitStart;\n public static isMoveCommand = isMoveCommand;\n public static isPathCommand = isPathCommand;\n public static isSpace = isSpace;\n public static paramsCount = paramsCount;\n public static paramsParser = paramsParser;\n public static pathParser = pathParser;\n public static scanFlag = scanFlag;\n public static scanParam = scanParam;\n public static scanSegment = scanSegment;\n public static skipSpaces = skipSpaces;\n public static getPathBBox = getPathBBox;\n public static getPathArea = getPathArea;\n public static getTotalLength = getTotalLength;\n public static getDrawDirection = getDrawDirection;\n public static getPointAtLength = getPointAtLength;\n public static getPropertiesAtLength = getPropertiesAtLength;\n public static getPropertiesAtPoint = getPropertiesAtPoint;\n public static getClosestPoint = getClosestPoint;\n public static getSegmentOfPoint = getSegmentOfPoint;\n public static getSegmentAtLength = getSegmentAtLength;\n public static isPointInStroke = isPointInStroke;\n public static isValidPath = isValidPath;\n public static isPathArray = isPathArray;\n public static isAbsoluteArray = isAbsoluteArray;\n public static isRelativeArray = isRelativeArray;\n public static isCurveArray = isCurveArray;\n public static isNormalizedArray = isNormalizedArray;\n public static shapeToPath = shapeToPath;\n public static shapeToPathArray = shapeToPathArray;\n public static shapeParams = shapeParams;\n public static parsePathString = parsePathString;\n public static absolutizeSegment = absolutizeSegment;\n public static arcToCubic = arcToCubic;\n public static getSVGMatrix = getSVGMatrix;\n public static iterate = iterate;\n public static lineToCubic = lineToCubic;\n public static normalizePath = normalizePath;\n public static normalizeSegment = normalizeSegment;\n public static optimizePath = optimizePath;\n public static projection2d = projection2d;\n public static quadToCubic = quadToCubic;\n public static relativizeSegment = relativizeSegment;\n public static reverseCurve = reverseCurve;\n public static reversePath = reversePath;\n public static roundPath = roundPath;\n public static roundSegment = roundSegment;\n public static segmentToCubic = segmentToCubic;\n public static shortenSegment = shortenSegment;\n public static splitCubic = splitCubic;\n public static splitPath = splitPath;\n public static transformPath = transformPath;\n // declare class properties\n declare segments: PathArray;\n declare round: number | 'off';\n declare origin: [number, number, number];\n\n /**\n * @constructor\n * @param pathValue the path string\n * @param config instance options\n */\n constructor(pathValue: string, config?: Partial) {\n const instanceOptions = config || {};\n const undefPath = typeof pathValue === 'undefined';\n\n if (undefPath || !pathValue.length) {\n throw TypeError(`${error}: \"pathValue\" is ${undefPath ? 'undefined' : 'empty'}`);\n }\n\n this.segments = parsePathString(pathValue);\n\n // // set instance options.round\n const { round: roundOption, origin: originOption } = instanceOptions;\n let round: number | 'off';\n\n if (Number.isInteger(roundOption) || roundOption === 'off') {\n round = roundOption as number | 'off';\n } else {\n round = defaultOptions.round as number;\n }\n\n // set instance options.origin\n // the SVGPathCommander class will always override the default origin\n let origin = defaultOptions.origin as [number, number, number];\n /* istanbul ignore else @preserve */\n if (Array.isArray(originOption) && originOption.length >= 2) {\n const [originX, originY, originZ] = originOption.map(Number);\n origin = [\n !Number.isNaN(originX) ? originX : 0,\n !Number.isNaN(originY) ? originY : 0,\n !Number.isNaN(originZ) ? originZ : 0,\n ];\n }\n\n this.round = round;\n this.origin = origin;\n\n return this;\n }\n get bbox() {\n return getPathBBox(this.segments);\n }\n get length() {\n return getTotalLength(this.segments);\n }\n\n /**\n * Returns the path bounding box, equivalent to native `path.getBBox()`.\n *\n * @public\n * @returns the pathBBox\n */\n getBBox() {\n return this.bbox;\n }\n\n /**\n * Returns the total path length, equivalent to native `path.getTotalLength()`.\n *\n * @public\n * @returns the path total length\n */\n getTotalLength() {\n return this.length;\n }\n\n /**\n * Returns an `{x,y}` point in the path stroke at a given length,\n * equivalent to the native `path.getPointAtLength()`.\n *\n * @public\n * @param length the length\n * @returns the requested point\n */\n getPointAtLength(length: number) {\n return getPointAtLength(this.segments, length);\n }\n\n /**\n * Convert path to absolute values\n *\n * @public\n */\n toAbsolute() {\n const { segments } = this;\n this.segments = pathToAbsolute(segments);\n return this;\n }\n\n /**\n * Convert path to relative values\n *\n * @public\n */\n toRelative() {\n const { segments } = this;\n this.segments = pathToRelative(segments);\n return this;\n }\n\n /**\n * Convert path to cubic-bezier values. In addition, un-necessary `Z`\n * segment is removed if previous segment extends to the `M` segment.\n *\n * @public\n */\n toCurve() {\n const { segments } = this;\n this.segments = pathToCurve(segments);\n return this;\n }\n\n /**\n * Reverse the order of the segments and their values.\n *\n * @param onlySubpath option to reverse all sub-paths except first\n * @public\n */\n reverse(onlySubpath?: boolean) {\n this.toAbsolute();\n\n const { segments } = this;\n const split = splitPath(segments);\n const subPath = split.length > 1 ? split : false;\n\n const absoluteMultiPath = subPath\n ? subPath.map((x, i) => {\n if (onlySubpath) {\n return i ? reversePath(x) : x.slice(0);\n }\n return reversePath(x);\n })\n : segments.slice(0);\n\n let path = [] as unknown as PathArray;\n if (subPath) {\n path = absoluteMultiPath.flat(1) as PathArray;\n } else {\n path = onlySubpath ? segments : reversePath(segments);\n }\n\n this.segments = path.slice(0) as PathArray;\n return this;\n }\n\n /**\n * Normalize path in 2 steps:\n * * convert `pathArray`(s) to absolute values\n * * convert shorthand notation to standard notation\n *\n * @public\n */\n normalize() {\n const { segments } = this;\n this.segments = normalizePath(segments);\n return this;\n }\n\n /**\n * Optimize `pathArray` values:\n * * convert segments to absolute and/or relative values\n * * select segments with shortest resulted string\n * * round values to the specified `decimals` option value\n *\n * @public\n */\n optimize() {\n const { segments } = this;\n const round = this.round === 'off' ? 2 : this.round;\n\n this.segments = optimizePath(segments, round);\n return this;\n }\n\n /**\n * Transform path using values from an `Object` defined as `transformObject`.\n *\n * @see TransformObject for a quick refference\n *\n * @param source a `transformObject`as described above\n * @public\n */\n transform(source?: Partial) {\n if (\n !source ||\n typeof source !== 'object' ||\n (typeof source === 'object' && !['translate', 'rotate', 'skew', 'scale'].some(x => x in source))\n )\n return this;\n\n const {\n segments,\n origin: [cx, cy, cz],\n } = this;\n const transform = {} as TransformObjectValues;\n for (const [k, v] of Object.entries(source) as TransformEntries) {\n // istanbul ignore else @preserve\n if (k === 'skew' && Array.isArray(v)) {\n transform[k] = v.map(Number) as PointTuple;\n } else if ((k === 'rotate' || k === 'translate' || k === 'origin' || k === 'scale') && Array.isArray(v)) {\n transform[k] = v.map(Number) as [number, number, number];\n } else if (k !== 'origin' && typeof Number(v) === 'number') transform[k] = Number(v);\n }\n\n // if origin is not specified\n // it's important that we have one\n const { origin } = transform;\n\n if (Array.isArray(origin) && origin.length >= 2) {\n const [originX, originY, originZ] = origin.map(Number);\n transform.origin = [!Number.isNaN(originX) ? originX : cx, !Number.isNaN(originY) ? originY : cy, originZ || cz];\n } else {\n transform.origin = [cx, cy, cz];\n }\n\n this.segments = transformPath(segments, transform);\n return this;\n }\n\n /**\n * Rotate path 180deg vertically\n *\n * @public\n */\n flipX() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [0, 180, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Rotate path 180deg horizontally\n *\n * @public\n */\n flipY() {\n const { cx, cy } = this.bbox;\n this.transform({ rotate: [180, 0, 0], origin: [cx, cy, 0] });\n return this;\n }\n\n /**\n * Export the current path to be used\n * for the `d` (description) attribute.\n *\n * @public\n * @return the path string\n */\n toString() {\n return pathToString(this.segments, this.round);\n }\n}\n\nexport default SVGPathCommander;\n"],"names":["Z","z","s","e","p","$","E","P","y","g","n","i","r","a","l","m","h","c","u","w","o","d","A","M","b","X","O","x","Y","F","T","k","I","v","R","D","N","defaultOptions","paramsCount","finalizeSegment","path","pathCommand","relativeCommand","data","error","scanFlag","index","pathValue","code","isDigit","invalidPathValue","scanParam","max","start","zeroFirst","hasCeiling","hasDecimal","hasDot","ch","isSpace","skipSpaces","isPathCommand","isDigitStart","isArcCommand","isMoveCommand","scanSegment","segments","cmdCode","reqParams","paramCounts","lastSegment","_a","PathParser","pathString","parsePathString","pathInput","absolutizeSegment","segment","lastX","lastY","absCommand","absValues","j","iterate","iterator","pathLen","isRelative","mx","my","segLen","iteratorResult","pathToAbsolute","relativizeSegment","relCommand","relValues","pathToRelative","rotateVector","rad","sin","cos","arcToCubic","X1","Y1","RX","RY","angle","LAF","SF","X2","Y2","recursive","x1","y1","rx","ry","x2","y2","d120","res","xy","f1","f2","cx","cy","rx2","ry2","df","f2old","x2old","y2old","c1","s1","c2","s2","t","hx","hy","m1","m2","m3","m4","newres","ii","quadToCubic","qx","qy","r13","r23","midPoint","ax","ay","bx","by","lineToCubic","segmentToCubic","params","values","px1","py1","px","py","normalizeSegment","px2","py2","nqx","nqy","paramsParser","pathToCurve","seg","normalSegment","result","seglen","roundTo","round","pow","pathToString","roundOption","valLen","distanceSquareRoot","getLineLength","getPointAtLineLength","distance","point","length","getLineBBox","min","arcLength","theta","halfTheta","sinHalfTheta","cosHalfTheta","term1","term2","arcPoint","alpha","cosA","sinA","angleBetween","v0","v1","v0x","v0y","v1x","v1y","getArcProps","abs","sqrt","PI","xRotRad","dx","dy","transformedPoint","radiiCheck","cSquareNumerator","cSquareRootDenom","cRadicand","cCoef","transformedCenter","center","startVector","startAngle","endVector","sweepAngle","endAngle","getArcLength","getPointAtArcLength","ellipseComponentX","ellipseComponentY","getArcBBox","deltaAngle","tan","atan2","extremes","tangent","angle1","angle2","angle3","angle4","xArr","yArr","xMin","xMax","yMin","yMax","angleAfterStart","pP2","angleBeforeEnd","pP3","Tvalues","Cvalues","deriveBezier","points","dpoints","list","computeBezier","order","mt","mt2","t2","calculateBezier","derivativeFn","bezierLength","len","sum","getBezierLength","curve","idx","step","CBEZIER_MINMAX_EPSILON","minmaxQ","cp","v2","minmaxC","cp1","cp2","K","S","L","Q","getPointAtCubicSegmentLength","c1x","c1y","c2x","c2y","t1","getCubicLength","getPointAtCubicLength","distanceIsNumber","currentLength","getCubicBBox","cxMinMax","cyMinMax","getPointAtQuadSegmentLength","getQuadLength","getPointAtQuadLength","getQuadBBox","polygonArea","polygon","area","polygonLength","DISTANCE_EPSILON","normalizePath","_","getPointAtLength","isM","POINT","totalLength","getTotalLength","getPropertiesAtLength","pathArray","pathTemp","pathLength","lengthAtSegment","getPropertiesAtPoint","normalPath","distanceTo","precision","scan","closest","scanDistance","bestLength","bestDistance","scanLength","before","after","beforeLength","afterLength","beforeDistance","afterDistance","getClosestPoint","getCubicSegArea","getPathArea","getDrawDirection","getPathBBox","MIN","MAX","width","height","getSegmentAtLength","getSegmentOfPoint","isPathArray","lk","isAbsoluteArray","isNormalizedArray","pc","isCurveArray","isPointInStroke","isRelativeArray","isValidPath","shapeParams","getLinePath","attr","getPolyPath","getCirclePath","getEllipsePath","getRectanglePath","shapeToPathArray","element","ownerDocument","win","supportedShapes","targetIsElement","tagName","type","shapeAttrs","config","shapeToPath","replace","doc","description","name","value","getSVGMatrix","transform","matrix","CSSMatrix","origin","originX","originY","translate","rotate","skew","scale","shortenSegment","prevCommand","defaultRound","normalValues","nx","ny","nx1","ny1","roundSegment","optimizePath","optimParams","allPathCommands","normalizedSegment","shortSegment","absSegment","absString","relativeSegment","relSegment","relString","translatePoint","cssm","projection2d","point2D","originZ","relativePositionX","relativePositionY","relativePositionZ","reverseCurve","rotatedCurve","curveOnly","reversePath","absolutePath","normalizedPath","pLen","isClosed","reversedPath","prevSeg","nextSeg","nextCommand","roundPath","splitCubic","pts","ratio","p0","p1","p2","p3","p4","p5","p6","p7","p8","p9","splitPath","composite","pi","transformPath","lx","ly","jj","transformParams","transformProps","matrixInstance","absoluteSegment","isLongArc","tempSegment","SVGPathCommander","instanceOptions","undefPath","originOption","onlySubpath","split","subPath","absoluteMultiPath","source","cz","__publicField","arcTools","distanceEpsilon","pathParser"],"mappings":"qNAAA,IAAIA,EAAI,OAAO,eACXC,EAAI,CAACC,EAAG,EAAGC,IAAM,KAAKD,EAAIF,EAAEE,EAAG,EAAG,CAAE,WAAY,GAAI,aAAc,GAAI,SAAU,GAAI,MAAOC,CAAC,CAAE,EAAID,EAAE,CAAC,EAAIC,EACzGC,EAAI,CAACF,EAAG,EAAGC,IAAMF,EAAEC,EAAG,OAAO,GAAK,SAAW,EAAI,GAAK,EAAGC,CAAC,EAC9D,MAAME,GAAI,CACR,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,EAAG,EACH,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,IAAK,EACL,KAAM,GACN,WAAY,EACd,EAAGC,GAAKJ,IAAOA,aAAa,cAAgBA,aAAa,cAAgB,MAAM,QAAQA,CAAC,GAAKA,EAAE,MAAO,GAAM,OAAO,GAAK,QAAQ,IAAM,CAAC,EAAG,EAAE,EAAE,KAAM,GAAMA,EAAE,SAAW,CAAC,EAAGK,GAAKL,GAAM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AoB1G,IAClCoH,EA5DIV,EA4DU,cAAcnF,IAC5B6F,EA7DIV,EA6DU,mBAAmB7F,IACjCuG,EA9DIV,EA8DU,cAAcpG,IAC5B8G,EA/DIV,EA+DU,kBAAkBvX,GAChCiY,EAhEIV,EAgEU,oBAAoBrX,IAClC+X,EAjEIV,EAiEU,aAAa7V,IAC3BuW,EAlEIV,EAkEU,eAAe7E,IAC7BuF,EAnEIV,EAmEU,UAAU9W,GACxBwX,EApEIV,EAoEU,cAAcxS,IAC5BkT,EArEIV,EAqEU,gBAAgBpJ,IAC9B8J,EAtEIV,EAsEU,mBAAmBhS,GACjC0S,EAvEIV,EAuEU,eAAezD,IAC7BmE,EAxEIV,EAwEU,eAAe7C,IAC7BuD,EAzEIV,EAyEU,cAAclT,IAC5B4T,EA1EIV,EA0EU,oBAAoBrW,IAClC+W,EA3EIV,EA2EU,eAAevC,IAC7BiD,EA5EIV,EA4EU,cAAcpC,IAC5B8C,EA7EIV,EA6EU,YAAY3B,IAC1BqC,EA9EIV,EA8EU,eAAe1D,IAC7BoE,EA/EIV,EA+EU,iBAAiBvS,IAC/BiT,EAhFIV,EAgFU,iBAAiBlE,IAC/B4E,EAjFIV,EAiFU,aAAa1B,IAC3BoC,EAlFIV,EAkFU,YAAYb,IAC1BuB,EAnFIV,EAmFU,gBAAgBV","x_google_ignoreList":[0]} \ No newline at end of file diff --git a/package.json b/package.json index c695c40..7c599f1 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "svg-path-commander", "author": "thednp", "license": "MIT", - "version": "2.1.1", + "version": "2.1.2", "description": "Modern TypeScript tools for SVG", "source": "./src/index.ts", "main": "./dist/svg-path-commander.js", @@ -58,19 +58,19 @@ "devDependencies": { "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", - "@vitest/browser": "^2.1.2", - "@vitest/coverage-istanbul": "^2.1.2", - "@vitest/ui": "^2.1.2", + "@vitest/browser": "^2.1.3", + "@vitest/coverage-istanbul": "^2.1.3", + "@vitest/ui": "^2.1.3", "dts-bundle-generator": "^9.5.1", "eslint": "^8.57.1", "eslint-plugin-jsdoc": "^46.10.1", "eslint-plugin-prefer-arrow": "^1.2.3", "eslint-plugin-prettier": "^4.2.1", - "playwright": "^1.48.0", + "playwright": "^1.48.1", "prettier": "^2.8.8", "typescript": "^5.6.3", - "vite": "^5.4.8", - "vitest": "^2.1.2" + "vite": "^5.4.9", + "vitest": "^2.1.3" }, "dependencies": { "@thednp/dommatrix": "^2.0.8" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 822c7c5..0fc49af 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,14 +19,14 @@ importers: specifier: ^5.62.0 version: 5.62.0(eslint@8.57.1)(typescript@5.6.3) '@vitest/browser': - specifier: ^2.1.2 - version: 2.1.2(@vitest/spy@2.1.2)(playwright@1.48.0)(typescript@5.6.3)(vite@5.4.8(@types/node@22.7.5))(vitest@2.1.2) + specifier: ^2.1.3 + version: 2.1.3(@vitest/spy@2.1.3)(playwright@1.48.1)(typescript@5.6.3)(vite@5.4.9(@types/node@22.7.6))(vitest@2.1.3) '@vitest/coverage-istanbul': - specifier: ^2.1.2 - version: 2.1.2(vitest@2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3))) + specifier: ^2.1.3 + version: 2.1.3(vitest@2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3))) '@vitest/ui': - specifier: ^2.1.2 - version: 2.1.2(vitest@2.1.2) + specifier: ^2.1.3 + version: 2.1.3(vitest@2.1.3) dts-bundle-generator: specifier: ^9.5.1 version: 9.5.1 @@ -43,8 +43,8 @@ importers: specifier: ^4.2.1 version: 4.2.1(eslint@8.57.1)(prettier@2.8.8) playwright: - specifier: ^1.48.0 - version: 1.48.0 + specifier: ^1.48.1 + version: 1.48.1 prettier: specifier: ^2.8.8 version: 2.8.8 @@ -52,11 +52,11 @@ importers: specifier: ^5.6.3 version: 5.6.3 vite: - specifier: ^5.4.8 - version: 5.4.8(@types/node@22.7.5) + specifier: ^5.4.9 + version: 5.4.9(@types/node@22.7.6) vitest: - specifier: ^2.1.2 - version: 2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)) + specifier: ^2.1.3 + version: 2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)) packages: @@ -507,8 +507,8 @@ packages: '@types/mute-stream@0.0.4': resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==} - '@types/node@22.7.5': - resolution: {integrity: sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==} + '@types/node@22.7.6': + resolution: {integrity: sha512-/d7Rnj0/ExXDMcioS78/kf1lMzYk4BZV8MZGTBKzTGZ6/406ukkbYlIsZmMPhcR5KlkunDHQLrtAVmSq7r+mSw==} '@types/semver@7.5.8': resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} @@ -583,12 +583,12 @@ packages: '@ungap/structured-clone@1.2.0': resolution: {integrity: sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==} - '@vitest/browser@2.1.2': - resolution: {integrity: sha512-tqpGfz2sfjFFNuZ2iLZ6EGRVnH8z18O93ZIicbLsxDhiLgRNz84UcjSvX4pbheuddW+BJeNbLGdM3BU8vohbEg==} + '@vitest/browser@2.1.3': + resolution: {integrity: sha512-PQ2kLLc9q8ukJutuuYsynHSr31E78/dtYEvPy4jCHLht1LmITqXTVTqu7THWdZ1kXNGrWwtdMqtt3z2mvSKdIg==} peerDependencies: playwright: '*' safaridriver: '*' - vitest: 2.1.2 + vitest: 2.1.3 webdriverio: '*' peerDependenciesMeta: playwright: @@ -598,18 +598,18 @@ packages: webdriverio: optional: true - '@vitest/coverage-istanbul@2.1.2': - resolution: {integrity: sha512-dg7ex3GKrTIenAV0oEp78JucTVFsPMzjl1gYWun22O7SBDxcHFC/REZjWLhMTHRHY8ihm4uBCvmu+CvEu5/Adg==} + '@vitest/coverage-istanbul@2.1.3': + resolution: {integrity: sha512-FByj6ni54EzA4SXl5X3ugSeeBSI6MSEQBbvPefF6x6GCajePLeZSNYt7u0NOKUQbWpQpAdHHstrqR9ALEpnAxA==} peerDependencies: - vitest: 2.1.2 + vitest: 2.1.3 - '@vitest/expect@2.1.2': - resolution: {integrity: sha512-FEgtlN8mIUSEAAnlvn7mP8vzaWhEaAEvhSXCqrsijM7K6QqjB11qoRZYEd4AKSCDz8p0/+yH5LzhZ47qt+EyPg==} + '@vitest/expect@2.1.3': + resolution: {integrity: sha512-SNBoPubeCJhZ48agjXruCI57DvxcsivVDdWz+SSsmjTT4QN/DfHk3zB/xKsJqMs26bLZ/pNRLnCf0j679i0uWQ==} - '@vitest/mocker@2.1.2': - resolution: {integrity: sha512-ExElkCGMS13JAJy+812fw1aCv2QO/LBK6CyO4WOPAzLTmve50gydOlWhgdBJPx2ztbADUq3JVI0C5U+bShaeEA==} + '@vitest/mocker@2.1.3': + resolution: {integrity: sha512-eSpdY/eJDuOvuTA3ASzCjdithHa+GIF1L4PqtEELl6Qa3XafdMLBpBlZCIUCX2J+Q6sNmjmxtosAG62fK4BlqQ==} peerDependencies: - '@vitest/spy': 2.1.2 + '@vitest/spy': 2.1.3 msw: ^2.3.5 vite: ^5.0.0 peerDependenciesMeta: @@ -618,33 +618,33 @@ packages: vite: optional: true - '@vitest/pretty-format@2.1.2': - resolution: {integrity: sha512-FIoglbHrSUlOJPDGIrh2bjX1sNars5HbxlcsFKCtKzu4+5lpsRhOCVcuzp0fEhAGHkPZRIXVNzPcpSlkoZ3LuA==} + '@vitest/pretty-format@2.1.3': + resolution: {integrity: sha512-XH1XdtoLZCpqV59KRbPrIhFCOO0hErxrQCMcvnQete3Vibb9UeIOX02uFPfVn3Z9ZXsq78etlfyhnkmIZSzIwQ==} - '@vitest/runner@2.1.2': - resolution: {integrity: sha512-UCsPtvluHO3u7jdoONGjOSil+uON5SSvU9buQh3lP7GgUXHp78guN1wRmZDX4wGK6J10f9NUtP6pO+SFquoMlw==} + '@vitest/runner@2.1.3': + resolution: {integrity: sha512-JGzpWqmFJ4fq5ZKHtVO3Xuy1iF2rHGV4d/pdzgkYHm1+gOzNZtqjvyiaDGJytRyMU54qkxpNzCx+PErzJ1/JqQ==} - '@vitest/snapshot@2.1.2': - resolution: {integrity: sha512-xtAeNsZ++aRIYIUsek7VHzry/9AcxeULlegBvsdLncLmNCR6tR8SRjn8BbDP4naxtccvzTqZ+L1ltZlRCfBZFA==} + '@vitest/snapshot@2.1.3': + resolution: {integrity: sha512-qWC2mWc7VAXmjAkEKxrScWHWFyCQx/cmiZtuGqMi+WwqQJ2iURsVY4ZfAK6dVo6K2smKRU6l3BPwqEBvhnpQGg==} - '@vitest/spy@2.1.2': - resolution: {integrity: sha512-GSUi5zoy+abNRJwmFhBDC0yRuVUn8WMlQscvnbbXdKLXX9dE59YbfwXxuJ/mth6eeqIzofU8BB5XDo/Ns/qK2A==} + '@vitest/spy@2.1.3': + resolution: {integrity: sha512-Nb2UzbcUswzeSP7JksMDaqsI43Sj5+Kry6ry6jQJT4b5gAK+NS9NED6mDb8FlMRCX8m5guaHCDZmqYMMWRy5nQ==} - '@vitest/ui@2.1.2': - resolution: {integrity: sha512-92gcNzkDnmxOxyHzQrQYRsoV9Q0Aay0r4QMLnV+B+lbqlUWa8nDg9ivyLV5mMVTtGirHsYUGGh/zbIA55gBZqA==} + '@vitest/ui@2.1.3': + resolution: {integrity: sha512-2XwTrHVJw3t9NYES26LQUYy51ZB8W4bRPgqUH2Eyda3kIuOlYw1ZdPNU22qcVlUVx4WKgECFQOSXuopsczuVjQ==} peerDependencies: - vitest: 2.1.2 + vitest: 2.1.3 - '@vitest/utils@2.1.2': - resolution: {integrity: sha512-zMO2KdYy6mx56btx9JvAqAZ6EyS3g49krMPPrgOp1yxGZiA93HumGk+bZ5jIZtOg5/VBYl5eBmGRQHqq4FG6uQ==} + '@vitest/utils@2.1.3': + resolution: {integrity: sha512-xpiVfDSg1RrYT0tX6czgerkpcKFmFOF/gCr30+Mve5V2kewCy4Prn1/NDMSRwaSmT7PRaOF83wu+bEtsY1wrvA==} acorn-jsx@5.3.2: resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} peerDependencies: acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 - acorn@8.12.1: - resolution: {integrity: sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==} + acorn@8.13.0: + resolution: {integrity: sha512-8zSiw54Oxrdym50NlZ9sUusyO1Z1ZchgRLWRaK6c86XJFClyCgFKetdowBg5bKxyp/u+CDBJG4Mpp0m3HLZl9w==} engines: {node: '>=0.4.0'} hasBin: true @@ -727,8 +727,8 @@ packages: resolution: {integrity: sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==} engines: {node: '>=6'} - caniuse-lite@1.0.30001668: - resolution: {integrity: sha512-nWLrdxqCdblixUO+27JtGJJE/txpJlyUy5YN1u53wLZkP0emYCo5zgS6QYft7VUYR42LGgi/S5hdLZTrnyIddw==} + caniuse-lite@1.0.30001669: + resolution: {integrity: sha512-DlWzFDJqstqtIVx1zeSpIMLjunf5SmwOw0N2Ck/QSQdS8PLS4+9HrLaYei4w8BIAL7IB/UEDu889d8vhCTPA0w==} chai@5.1.1: resolution: {integrity: sha512-pT1ZgP8rPNqUgieVaEY+ryQr6Q4HXNg8Ei9UnLUrjN4IA7dvQC5JB+/kxVcPNDHyBcc/26CXPkbNzq3qwrOEKA==} @@ -824,8 +824,8 @@ packages: eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} - electron-to-chromium@1.5.36: - resolution: {integrity: sha512-HYTX8tKge/VNp6FGO+f/uVDmUkq+cEfcxYhKf15Akc4M5yxt5YmorwlAitKWjWhWQnKcDRBAQKXkhqqXMqcrjw==} + electron-to-chromium@1.5.40: + resolution: {integrity: sha512-LYm78o6if4zTasnYclgQzxEcgMoIcybWOhkATWepN95uwVVWV0/IW10v+2sIeHE+bIYWipLneTftVyQm45UY7g==} emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} @@ -936,8 +936,8 @@ packages: fastq@1.17.1: resolution: {integrity: sha512-sRVD3lWVIXWg6By68ZN7vho9a1pQcN/WBFaAAsDDFzlJjvoGx0P8z7V1t72grFJfJhu3YPZBuu25f7Kaw2jN1w==} - fdir@6.4.0: - resolution: {integrity: sha512-3oB133prH1o4j/L5lLW7uOCF1PlD+/It2L0eL/iAqWMB91RBbqTewABqxhj0ibBd90EEmWZq7ntIWzVaWcXTGQ==} + fdir@6.4.2: + resolution: {integrity: sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==} peerDependencies: picomatch: ^3 || ^4 peerDependenciesMeta: @@ -1205,8 +1205,8 @@ packages: ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - msw@2.4.10: - resolution: {integrity: sha512-bDQh9b25JK4IKMs5hnamwAkcNZ9RwA4mR/4YcgWkzwHOxj7UICbVJfmChJvY1UCAAMraPpvjHdxjoUDpc3F+Qw==} + msw@2.4.11: + resolution: {integrity: sha512-TVEw9NOPTc6ufOQLJ53234S9NBRxQbu7xFMxs+OCP43JQcNEIOKiZHxEm2nDzYIrwccoIhUxUf8wr99SukD76A==} engines: {node: '>=18'} hasBin: true peerDependencies: @@ -1288,8 +1288,8 @@ packages: resolution: {integrity: sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA==} engines: {node: '>= 14.16'} - picocolors@1.1.0: - resolution: {integrity: sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==} + picocolors@1.1.1: + resolution: {integrity: sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==} picomatch@2.3.1: resolution: {integrity: sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==} @@ -1299,13 +1299,13 @@ packages: resolution: {integrity: sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==} engines: {node: '>=12'} - playwright-core@1.48.0: - resolution: {integrity: sha512-RBvzjM9rdpP7UUFrQzRwR8L/xR4HyC1QXMzGYTbf1vjw25/ya9NRAVnXi/0fvFopjebvyPzsmoK58xxeEOaVvA==} + playwright-core@1.48.1: + resolution: {integrity: sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==} engines: {node: '>=18'} hasBin: true - playwright@1.48.0: - resolution: {integrity: sha512-qPqFaMEHuY/ug8o0uteYJSRfMGFikhUysk8ZvAtfKmUK3kc/6oNl/y3EczF8OFGYIi/Ex2HspMfzYArk6+XQSA==} + playwright@1.48.1: + resolution: {integrity: sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==} engines: {node: '>=18'} hasBin: true @@ -1473,8 +1473,8 @@ packages: tinybench@2.9.0: resolution: {integrity: sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==} - tinyexec@0.3.0: - resolution: {integrity: sha512-tVGE0mVJPGb0chKhqmsoosjsS+qUnJVGJpZgsHYQcGoPlG3B51R3PouqTgEGH2Dc9jjFyOqOpix6ZHNMXp1FZg==} + tinyexec@0.3.1: + resolution: {integrity: sha512-WiCJLEECkO18gwqIp6+hJg0//p23HXp4S+gGtAKu3mI2F2/sXC4FvHvXvB0zJVVaTPhx1/tOwdbRsa1sOBIKqQ==} tinyglobby@0.2.9: resolution: {integrity: sha512-8or1+BGEdk1Zkkw2ii16qSS7uVrQJPre5A9o/XkWPATkk23FZh/15BKFxPnlTy6vkljZxLqYCzzBMj30ZrSvjw==} @@ -1557,13 +1557,13 @@ packages: url-parse@1.5.10: resolution: {integrity: sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==} - vite-node@2.1.2: - resolution: {integrity: sha512-HPcGNN5g/7I2OtPjLqgOtCRu/qhVvBxTUD3qzitmL0SrG1cWFzxzhMDWussxSbrRYWqnKf8P2jiNhPMSN+ymsQ==} + vite-node@2.1.3: + resolution: {integrity: sha512-I1JadzO+xYX887S39Do+paRePCKoiDrWRRjp9kkG5he0t7RXNvPAJPCQSJqbGN4uCrFFeS3Kj3sLqY8NMYBEdA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true - vite@5.4.8: - resolution: {integrity: sha512-FqrItQ4DT1NC4zCUqMB4c4AZORMKIa0m8/URVCZ77OZ/QSNeJ54bU1vrFADbDsuwfIPcgknRkmqakQcgnL4GiQ==} + vite@5.4.9: + resolution: {integrity: sha512-20OVpJHh0PAM0oSOELa5GaZNWeDjcAvQjGXy2Uyr+Tp+/D2/Hdz6NLgpJLsarPTA2QJ6v8mX2P1ZfbsSKvdMkg==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: @@ -1593,15 +1593,15 @@ packages: terser: optional: true - vitest@2.1.2: - resolution: {integrity: sha512-veNjLizOMkRrJ6xxb+pvxN6/QAWg95mzcRjtmkepXdN87FNfxAss9RKe2far/G9cQpipfgP2taqg0KiWsquj8A==} + vitest@2.1.3: + resolution: {integrity: sha512-Zrxbg/WiIvUP2uEzelDNTXmEMJXuzJ1kCpbDvaKByFA9MNeO95V+7r/3ti0qzJzrxdyuUw5VduN7k+D3VmVOSA==} engines: {node: ^18.0.0 || >=20.0.0} hasBin: true peerDependencies: '@edge-runtime/vm': '*' '@types/node': ^18.0.0 || >=20.0.0 - '@vitest/browser': 2.1.2 - '@vitest/ui': 2.1.2 + '@vitest/browser': 2.1.3 + '@vitest/ui': 2.1.3 happy-dom: '*' jsdom: '*' peerDependenciesMeta: @@ -1692,7 +1692,7 @@ snapshots: '@babel/code-frame@7.25.7': dependencies: '@babel/highlight': 7.25.7 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/compat-data@7.25.8': {} @@ -1771,7 +1771,7 @@ snapshots: '@babel/helper-validator-identifier': 7.25.7 chalk: 2.4.2 js-tokens: 4.0.0 - picocolors: 1.1.0 + picocolors: 1.1.1 '@babel/parser@7.25.8': dependencies: @@ -1938,7 +1938,7 @@ snapshots: '@inquirer/figures': 1.0.7 '@inquirer/type': 2.0.0 '@types/mute-stream': 0.0.4 - '@types/node': 22.7.5 + '@types/node': 22.7.6 '@types/wrap-ansi': 3.0.0 ansi-escapes: 4.3.2 cli-width: 4.1.0 @@ -2096,9 +2096,9 @@ snapshots: '@types/mute-stream@0.0.4': dependencies: - '@types/node': 22.7.5 + '@types/node': 22.7.6 - '@types/node@22.7.5': + '@types/node@22.7.6': dependencies: undici-types: 6.19.8 @@ -2196,20 +2196,20 @@ snapshots: '@ungap/structured-clone@1.2.0': {} - '@vitest/browser@2.1.2(@vitest/spy@2.1.2)(playwright@1.48.0)(typescript@5.6.3)(vite@5.4.8(@types/node@22.7.5))(vitest@2.1.2)': + '@vitest/browser@2.1.3(@vitest/spy@2.1.3)(playwright@1.48.1)(typescript@5.6.3)(vite@5.4.9(@types/node@22.7.6))(vitest@2.1.3)': dependencies: '@testing-library/dom': 10.4.0 '@testing-library/user-event': 14.5.2(@testing-library/dom@10.4.0) - '@vitest/mocker': 2.1.2(@vitest/spy@2.1.2)(msw@2.4.10(typescript@5.6.3))(vite@5.4.8(@types/node@22.7.5)) - '@vitest/utils': 2.1.2 + '@vitest/mocker': 2.1.3(@vitest/spy@2.1.3)(msw@2.4.11(typescript@5.6.3))(vite@5.4.9(@types/node@22.7.6)) + '@vitest/utils': 2.1.3 magic-string: 0.30.12 - msw: 2.4.10(typescript@5.6.3) + msw: 2.4.11(typescript@5.6.3) sirv: 2.0.4 tinyrainbow: 1.2.0 - vitest: 2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)) + vitest: 2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)) ws: 8.18.0 optionalDependencies: - playwright: 1.48.0 + playwright: 1.48.1 transitivePeerDependencies: - '@vitest/spy' - bufferutil @@ -2217,7 +2217,7 @@ snapshots: - utf-8-validate - vite - '@vitest/coverage-istanbul@2.1.2(vitest@2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)))': + '@vitest/coverage-istanbul@2.1.3(vitest@2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)))': dependencies: '@istanbuljs/schema': 0.1.3 debug: 4.3.7 @@ -2229,67 +2229,67 @@ snapshots: magicast: 0.3.5 test-exclude: 7.0.1 tinyrainbow: 1.2.0 - vitest: 2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)) + vitest: 2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)) transitivePeerDependencies: - supports-color - '@vitest/expect@2.1.2': + '@vitest/expect@2.1.3': dependencies: - '@vitest/spy': 2.1.2 - '@vitest/utils': 2.1.2 + '@vitest/spy': 2.1.3 + '@vitest/utils': 2.1.3 chai: 5.1.1 tinyrainbow: 1.2.0 - '@vitest/mocker@2.1.2(@vitest/spy@2.1.2)(msw@2.4.10(typescript@5.6.3))(vite@5.4.8(@types/node@22.7.5))': + '@vitest/mocker@2.1.3(@vitest/spy@2.1.3)(msw@2.4.11(typescript@5.6.3))(vite@5.4.9(@types/node@22.7.6))': dependencies: - '@vitest/spy': 2.1.2 + '@vitest/spy': 2.1.3 estree-walker: 3.0.3 magic-string: 0.30.12 optionalDependencies: - msw: 2.4.10(typescript@5.6.3) - vite: 5.4.8(@types/node@22.7.5) + msw: 2.4.11(typescript@5.6.3) + vite: 5.4.9(@types/node@22.7.6) - '@vitest/pretty-format@2.1.2': + '@vitest/pretty-format@2.1.3': dependencies: tinyrainbow: 1.2.0 - '@vitest/runner@2.1.2': + '@vitest/runner@2.1.3': dependencies: - '@vitest/utils': 2.1.2 + '@vitest/utils': 2.1.3 pathe: 1.1.2 - '@vitest/snapshot@2.1.2': + '@vitest/snapshot@2.1.3': dependencies: - '@vitest/pretty-format': 2.1.2 + '@vitest/pretty-format': 2.1.3 magic-string: 0.30.12 pathe: 1.1.2 - '@vitest/spy@2.1.2': + '@vitest/spy@2.1.3': dependencies: tinyspy: 3.0.2 - '@vitest/ui@2.1.2(vitest@2.1.2)': + '@vitest/ui@2.1.3(vitest@2.1.3)': dependencies: - '@vitest/utils': 2.1.2 + '@vitest/utils': 2.1.3 fflate: 0.8.2 flatted: 3.3.1 pathe: 1.1.2 sirv: 2.0.4 tinyglobby: 0.2.9 tinyrainbow: 1.2.0 - vitest: 2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)) + vitest: 2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)) - '@vitest/utils@2.1.2': + '@vitest/utils@2.1.3': dependencies: - '@vitest/pretty-format': 2.1.2 + '@vitest/pretty-format': 2.1.3 loupe: 3.1.2 tinyrainbow: 1.2.0 - acorn-jsx@5.3.2(acorn@8.12.1): + acorn-jsx@5.3.2(acorn@8.13.0): dependencies: - acorn: 8.12.1 + acorn: 8.13.0 - acorn@8.12.1: {} + acorn@8.13.0: {} ajv@6.12.6: dependencies: @@ -2347,8 +2347,8 @@ snapshots: browserslist@4.24.0: dependencies: - caniuse-lite: 1.0.30001668 - electron-to-chromium: 1.5.36 + caniuse-lite: 1.0.30001669 + electron-to-chromium: 1.5.40 node-releases: 2.0.18 update-browserslist-db: 1.1.1(browserslist@4.24.0) @@ -2358,7 +2358,7 @@ snapshots: callsites@3.1.0: {} - caniuse-lite@1.0.30001668: {} + caniuse-lite@1.0.30001669: {} chai@5.1.1: dependencies: @@ -2442,7 +2442,7 @@ snapshots: eastasianwidth@0.2.0: {} - electron-to-chromium@1.5.36: {} + electron-to-chromium@1.5.40: {} emoji-regex@8.0.0: {} @@ -2562,8 +2562,8 @@ snapshots: espree@9.6.1: dependencies: - acorn: 8.12.1 - acorn-jsx: 5.3.2(acorn@8.12.1) + acorn: 8.13.0 + acorn-jsx: 5.3.2(acorn@8.13.0) eslint-visitor-keys: 3.4.3 esquery@1.6.0: @@ -2604,7 +2604,7 @@ snapshots: dependencies: reusify: 1.0.4 - fdir@6.4.0(picomatch@4.0.2): + fdir@6.4.2(picomatch@4.0.2): optionalDependencies: picomatch: 4.0.2 @@ -2852,7 +2852,7 @@ snapshots: ms@2.1.3: {} - msw@2.4.10(typescript@5.6.3): + msw@2.4.11(typescript@5.6.3): dependencies: '@bundled-es-modules/cookie': 2.0.0 '@bundled-es-modules/statuses': 1.0.1 @@ -2932,24 +2932,24 @@ snapshots: pathval@2.0.0: {} - picocolors@1.1.0: {} + picocolors@1.1.1: {} picomatch@2.3.1: {} picomatch@4.0.2: {} - playwright-core@1.48.0: {} + playwright-core@1.48.1: {} - playwright@1.48.0: + playwright@1.48.1: dependencies: - playwright-core: 1.48.0 + playwright-core: 1.48.1 optionalDependencies: fsevents: 2.3.2 postcss@8.4.47: dependencies: nanoid: 3.3.7 - picocolors: 1.1.0 + picocolors: 1.1.1 source-map-js: 1.2.1 prelude-ls@1.2.1: {} @@ -3097,11 +3097,11 @@ snapshots: tinybench@2.9.0: {} - tinyexec@0.3.0: {} + tinyexec@0.3.1: {} tinyglobby@0.2.9: dependencies: - fdir: 6.4.0(picomatch@4.0.2) + fdir: 6.4.2(picomatch@4.0.2) picomatch: 4.0.2 tinypool@1.0.1: {} @@ -3152,7 +3152,7 @@ snapshots: dependencies: browserslist: 4.24.0 escalade: 3.2.0 - picocolors: 1.1.0 + picocolors: 1.1.1 uri-js@4.4.1: dependencies: @@ -3163,12 +3163,12 @@ snapshots: querystringify: 2.2.0 requires-port: 1.0.0 - vite-node@2.1.2(@types/node@22.7.5): + vite-node@2.1.3(@types/node@22.7.6): dependencies: cac: 6.7.14 debug: 4.3.7 pathe: 1.1.2 - vite: 5.4.8(@types/node@22.7.5) + vite: 5.4.9(@types/node@22.7.6) transitivePeerDependencies: - '@types/node' - less @@ -3180,40 +3180,40 @@ snapshots: - supports-color - terser - vite@5.4.8(@types/node@22.7.5): + vite@5.4.9(@types/node@22.7.6): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.24.0 optionalDependencies: - '@types/node': 22.7.5 + '@types/node': 22.7.6 fsevents: 2.3.3 - vitest@2.1.2(@types/node@22.7.5)(@vitest/browser@2.1.2)(@vitest/ui@2.1.2)(msw@2.4.10(typescript@5.6.3)): + vitest@2.1.3(@types/node@22.7.6)(@vitest/browser@2.1.3)(@vitest/ui@2.1.3)(msw@2.4.11(typescript@5.6.3)): dependencies: - '@vitest/expect': 2.1.2 - '@vitest/mocker': 2.1.2(@vitest/spy@2.1.2)(msw@2.4.10(typescript@5.6.3))(vite@5.4.8(@types/node@22.7.5)) - '@vitest/pretty-format': 2.1.2 - '@vitest/runner': 2.1.2 - '@vitest/snapshot': 2.1.2 - '@vitest/spy': 2.1.2 - '@vitest/utils': 2.1.2 + '@vitest/expect': 2.1.3 + '@vitest/mocker': 2.1.3(@vitest/spy@2.1.3)(msw@2.4.11(typescript@5.6.3))(vite@5.4.9(@types/node@22.7.6)) + '@vitest/pretty-format': 2.1.3 + '@vitest/runner': 2.1.3 + '@vitest/snapshot': 2.1.3 + '@vitest/spy': 2.1.3 + '@vitest/utils': 2.1.3 chai: 5.1.1 debug: 4.3.7 magic-string: 0.30.12 pathe: 1.1.2 std-env: 3.7.0 tinybench: 2.9.0 - tinyexec: 0.3.0 + tinyexec: 0.3.1 tinypool: 1.0.1 tinyrainbow: 1.2.0 - vite: 5.4.8(@types/node@22.7.5) - vite-node: 2.1.2(@types/node@22.7.5) + vite: 5.4.9(@types/node@22.7.6) + vite-node: 2.1.3(@types/node@22.7.6) why-is-node-running: 2.3.0 optionalDependencies: - '@types/node': 22.7.5 - '@vitest/browser': 2.1.2(@vitest/spy@2.1.2)(playwright@1.48.0)(typescript@5.6.3)(vite@5.4.8(@types/node@22.7.5))(vitest@2.1.2) - '@vitest/ui': 2.1.2(vitest@2.1.2) + '@types/node': 22.7.6 + '@vitest/browser': 2.1.3(@vitest/spy@2.1.3)(playwright@1.48.1)(typescript@5.6.3)(vite@5.4.9(@types/node@22.7.6))(vitest@2.1.3) + '@vitest/ui': 2.1.3(vitest@2.1.3) transitivePeerDependencies: - less - lightningcss diff --git a/src/convert/pathToAbsolute.ts b/src/convert/pathToAbsolute.ts index e2fce0d..15ebcdf 100644 --- a/src/convert/pathToAbsolute.ts +++ b/src/convert/pathToAbsolute.ts @@ -1,6 +1,6 @@ import parsePathString from '../parser/parsePathString'; import absolutizeSegment from '../process/absolutizeSegment'; -import type { AbsoluteArray, AbsoluteCommand, HSegment, PathArray, PointTuple, VSegment } from '../types'; +import type { AbsoluteArray, PathArray } from '../types'; import iterate from '../process/iterate'; /** @@ -11,37 +11,8 @@ import iterate from '../process/iterate'; * @returns the resulted `pathArray` with absolute values */ const pathToAbsolute = (pathInput: string | PathArray) => { - let x = 0; - let y = 0; - let mx = 0; - let my = 0; - let pathCommand = 'M'; const path = parsePathString(pathInput); - return iterate(path, (seg, params) => { - [pathCommand] = seg; - const result = absolutizeSegment(seg, params); - const absCommand = pathCommand.toUpperCase() as AbsoluteCommand; - - if (absCommand === 'Z') { - x = mx; - y = my; - } else if (absCommand === 'H') { - [, x] = result as HSegment; - } else if (absCommand === 'V') { - [, y] = result as VSegment; - } else { - [x, y] = result.slice(-2) as PointTuple; - - if (absCommand === 'M') { - mx = x; - my = y; - } - } - - params.x = x; - params.y = y; - return result; - }); + return iterate(path, absolutizeSegment); }; export default pathToAbsolute; diff --git a/src/convert/pathToCurve.ts b/src/convert/pathToCurve.ts index f851ec6..a3d934e 100644 --- a/src/convert/pathToCurve.ts +++ b/src/convert/pathToCurve.ts @@ -1,9 +1,9 @@ import segmentToCubic from '../process/segmentToCubic'; -import { AbsoluteCommand, CSegment, CurveArray, PathArray, PointTuple } from '../types'; +import { AbsoluteCommand, CSegment, CurveArray, PathArray } from '../types'; import iterate from '../process/iterate'; import parsePathString from '../parser/parsePathString'; import normalizeSegment from '../process/normalizeSegment'; -import absolutizeSegment from '../process/absolutizeSegment'; +import paramsParser from '../parser/paramsParser'; /** * Parses a path string value or 'pathArray' and returns a new one @@ -16,41 +16,27 @@ import absolutizeSegment from '../process/absolutizeSegment'; * @returns the resulted `pathArray` converted to cubic-bezier */ const pathToCurve = (pathInput: string | PathArray): CurveArray => { - let x = 0; - let y = 0; - let mx = 0; - let my = 0; - let pathCommand = 'M'; - + const params = { ...paramsParser }; const path = parsePathString(pathInput); - return iterate(path, (seg, params, i) => { - const absSegment = absolutizeSegment(seg, params); - [pathCommand] = absSegment; - const absCommand = pathCommand.toUpperCase() as AbsoluteCommand; - const normalSegment = normalizeSegment(absSegment, params); + return iterate(path, (seg, index, lastX, lastY) => { + params.x = lastX; + params.y = lastY; + const normalSegment = normalizeSegment(seg, params); let result = segmentToCubic(normalSegment, params); const isLongArc = result[0] === 'C' && result.length > 7; if (isLongArc) { - path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment); + path.splice(index + 1, 0, ['C' as AbsoluteCommand | number].concat(result.slice(7)) as CSegment); result = result.slice(0, 7) as CSegment; } - if (absCommand === 'Z') { - x = mx; - y = my; - } else { - [x, y] = result.slice(-2) as PointTuple; - - if (absCommand === 'M') { - mx = x; - my = y; - } - } + const seglen = result.length; + params.x1 = +result[seglen - 2]; + params.y1 = +result[seglen - 1]; + params.x2 = +result[seglen - 4] || params.x1; + params.y2 = +result[seglen - 3] || params.y1; - params.x = x; - params.y = y; return result; }); }; diff --git a/src/convert/pathToRelative.ts b/src/convert/pathToRelative.ts index ebdf895..86767b2 100644 --- a/src/convert/pathToRelative.ts +++ b/src/convert/pathToRelative.ts @@ -1,12 +1,4 @@ -import type { - AbsoluteCommand, - hSegment, - PathArray, - PointTuple, - RelativeArray, - RelativeCommand, - vSegment, -} from '../types'; +import type { PathArray, RelativeArray } from '../types'; import parsePathString from '../parser/parsePathString'; import iterate from '../process/iterate'; import relativizeSegment from '../process/relativizeSegment'; @@ -19,45 +11,8 @@ import relativizeSegment from '../process/relativizeSegment'; * @returns the resulted `pathArray` with relative values */ const pathToRelative = (pathInput: string | PathArray): RelativeArray => { - let x = 0; - let y = 0; - let mx = 0; - let my = 0; - let pathCommand = 'M'; const path = parsePathString(pathInput); - return iterate(path, (seg, params, i) => { - [pathCommand] = seg; - const result = relativizeSegment(seg, params, i); - const [resultedCommand] = result; - const absCommand = pathCommand.toUpperCase() as AbsoluteCommand; - const relCommand = pathCommand.toLowerCase() as RelativeCommand; - const isRelative = resultedCommand === relCommand; - - if (absCommand === 'Z') { - x = mx; - y = my; - } else if (absCommand === 'H') { - [, x] = result as hSegment; - x += isRelative ? params.x : /* istanbul ignore next @preserve */ 0; - } else if (absCommand === 'V') { - [, y] = result as vSegment; - y += isRelative ? params.y : /* istanbul ignore next @preserve */ 0; - } else { - [x, y] = result.slice(-2) as PointTuple; - x += isRelative ? params.x : 0; - y += isRelative ? params.y : 0; - - if (absCommand === 'M') { - mx = x; - my = y; - } - } - - params.x = x; - params.y = y; - - return result; - }); + return iterate(path, relativizeSegment); }; export default pathToRelative; diff --git a/src/convert/pathToString.ts b/src/convert/pathToString.ts index 183fbcd..c299216 100644 --- a/src/convert/pathToString.ts +++ b/src/convert/pathToString.ts @@ -1,17 +1,50 @@ -import type { PathArray } from '../types'; -import roundPath from '../process/roundPath'; +import type { PathArray, PathSegment } from '../types'; +import defaultOptions from '../options/options'; +import roundTo from '../math/roundTo'; /** * Returns a valid `d` attribute string value created * by rounding values and concatenating the `pathArray` segments. * * @param path the `pathArray` object - * @param round amount of decimals to round values to + * @param roundOption amount of decimals to round values to * @returns the concatenated path string */ -const pathToString = (path: PathArray, round?: number | 'off'): string => { - return roundPath(path, round) - .map(x => x[0] + x.slice(1).join(' ')) - .join(''); +const pathToString = (path: PathArray, roundOption?: number | 'off'): string => { + const pathLen = path.length; + let { round } = defaultOptions; + let segment = path[0] as PathSegment; + let result = ''; + + // allow for ZERO decimals + round = + roundOption === 'off' + ? roundOption + : typeof roundOption === 'number' && roundOption >= 0 + ? roundOption + : typeof round === 'number' && round >= 0 + ? round + : /* istanbul ignore next @preserve */ 'off'; + + for (let i = 0; i < pathLen; i += 1) { + segment = path[i]; + const [pathCommand] = segment; + const values = segment.slice(1) as number[]; + result += pathCommand; + if (round === 'off') { + result += values.join(' '); + } else { + let j = 0; + const valLen = values.length; + while (j < valLen) { + result += roundTo(values[j], round); + if (j !== valLen - 1) result += ' '; + j += 1; + } + } + } + + return result; }; + export default pathToString; diff --git a/src/index.ts b/src/index.ts index 1a9dec8..d640cbc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,53 +1,99 @@ 'use strict'; +import CSSMatrix from '@thednp/dommatrix'; import { PointTuple, PathArray, TransformObjectValues } from './types'; import type { Options, TransformEntries, TransformObject } from './interface'; export * from './types'; export * from './interface'; import defaultOptions from './options/options'; +import pathToAbsolute from './convert/pathToAbsolute'; +import pathToRelative from './convert/pathToRelative'; +import pathToCurve from './convert/pathToCurve'; +import pathToString from './convert/pathToString'; +import * as arcTools from './math/arcTools'; +import { + Cvalues, + Tvalues, + minmaxC, + minmaxQ, + getBezierLength, + bezierLength, + calculateBezier, + computeBezier, + deriveBezier, + CBEZIER_MINMAX_EPSILON, +} from './math/bezier'; +import { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength } from './math/cubicTools'; +import { getPointAtLineLength, getLineBBox, getLineLength } from './math/lineTools'; +import { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength } from './math/quadTools'; +import { polygonArea, polygonLength } from './math/polygonTools'; + +import distanceSquareRoot from './math/distanceSquareRoot'; +import midPoint from './math/midPoint'; +import rotateVector from './math/rotateVector'; +import roundTo from './math/roundTo'; + import error from './parser/error'; import parsePathString from './parser/parsePathString'; - -import polygonArea from './math/polygonArea'; -import polygonLength from './math/polygonLength'; - -import CSSMatrix from '@thednp/dommatrix'; -import getPathBBox from './util/getPathBBox'; -import getPathArea from './util/getPathArea'; -import getTotalLength from './util/getTotalLength'; +import finalizeSegment from './parser/finalizeSegment'; +import invalidPathValue from './parser/invalidPathValue'; +import isArcCommand from './parser/isArcCommand'; +import isDigit from './parser/isDigit'; +import isDigitStart from './parser/isDigitStart'; +import isMoveCommand from './parser/isMoveCommand'; +import isPathCommand from './parser/isPathCommand'; +import isSpace from './parser/isSpace'; +import paramsCount from './parser/paramsCount'; +import paramsParser from './parser/paramsParser'; +import pathParser from './parser/pathParser'; +import scanFlag from './parser/scanFlag'; +import scanParam from './parser/scanParam'; +import scanSegment from './parser/scanSegment'; +import skipSpaces from './parser/skipSpaces'; + +import distanceEpsilon from './util/distanceEpsilon'; +import getClosestPoint from './util/getClosestPoint'; import getDrawDirection from './util/getDrawDirection'; +import getPathArea from './util/getPathArea'; +import getPathBBox from './util/getPathBBox'; import getPointAtLength from './util/getPointAtLength'; - import getPropertiesAtLength from './util/getPropertiesAtLength'; import getPropertiesAtPoint from './util/getPropertiesAtPoint'; -import getClosestPoint from './util/getClosestPoint'; -import getSegmentOfPoint from './util/getSegmentOfPoint'; import getSegmentAtLength from './util/getSegmentAtLength'; -import isPointInStroke from './util/isPointInStroke'; +import getSegmentOfPoint from './util/getSegmentOfPoint'; +import getTotalLength from './util/getTotalLength'; -import isValidPath from './util/isValidPath'; -import isPathArray from './util/isPathArray'; import isAbsoluteArray from './util/isAbsoluteArray'; -import isRelativeArray from './util/isRelativeArray'; import isCurveArray from './util/isCurveArray'; import isNormalizedArray from './util/isNormalizedArray'; -import shapeToPathArray from './util/shapeToPathArray'; +import isPathArray from './util/isPathArray'; +import isPointInStroke from './util/isPointInStroke'; +import isRelativeArray from './util/isRelativeArray'; +import isValidPath from './util/isValidPath'; +import shapeParams from './util/shapeParams'; import shapeToPath from './util/shapeToPath'; +import shapeToPathArray from './util/shapeToPathArray'; -import roundPath from './process/roundPath'; -import splitPath from './process/splitPath'; +import absolutizeSegment from './process/absolutizeSegment'; +import arcToCubic from './process/arcToCubic'; import getSVGMatrix from './process/getSVGMatrix'; +import iterate from './process/iterate'; +import lineToCubic from './process/lineToCubic'; +import normalizePath from './process/normalizePath'; +import normalizeSegment from './process/normalizeSegment'; import optimizePath from './process/optimizePath'; +import projection2d from './process/projection2d'; +import quadToCubic from './process/quadToCubic'; +import relativizeSegment from './process/relativizeSegment'; import reverseCurve from './process/reverseCurve'; import reversePath from './process/reversePath'; -import normalizePath from './process/normalizePath'; -import transformPath from './process/transformPath'; +import roundPath from './process/roundPath'; +import roundSegment from './process/roundSegment'; +import segmentToCubic from './process/segmentToCubic'; +import shortenSegment from './process/shortenSegment'; import splitCubic from './process/splitCubic'; - -import pathToAbsolute from './convert/pathToAbsolute'; -import pathToRelative from './convert/pathToRelative'; -import pathToCurve from './convert/pathToCurve'; -import pathToString from './convert/pathToString'; +import splitPath from './process/splitPath'; +import transformPath from './process/transformPath'; /** * Creates a new SVGPathCommander instance with the following properties: @@ -61,7 +107,47 @@ import pathToString from './convert/pathToString'; */ class SVGPathCommander { public static CSSMatrix = CSSMatrix; - public static getSVGMatrix = getSVGMatrix; + public static pathToAbsolute = pathToAbsolute; + public static pathToRelative = pathToRelative; + public static pathToCurve = pathToCurve; + public static pathToString = pathToString; + public static arcTools = arcTools; + public static bezierTools = { + Cvalues, + Tvalues, + minmaxC, + minmaxQ, + getBezierLength, + bezierLength, + calculateBezier, + computeBezier, + deriveBezier, + CBEZIER_MINMAX_EPSILON, + }; + public static cubicTools = { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength }; + public static lineTools = { getPointAtLineLength, getLineBBox, getLineLength }; + public static quadTools = { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength }; + public static polygonTools = { polygonArea, polygonLength }; + public static distanceSquareRoot = distanceSquareRoot; + public static distanceEpsilon = distanceEpsilon; + public static midPoint = midPoint; + public static rotateVector = rotateVector; + public static roundTo = roundTo; + public static finalizeSegment = finalizeSegment; + public static invalidPathValue = invalidPathValue; + public static isArcCommand = isArcCommand; + public static isDigit = isDigit; + public static isDigitStart = isDigitStart; + public static isMoveCommand = isMoveCommand; + public static isPathCommand = isPathCommand; + public static isSpace = isSpace; + public static paramsCount = paramsCount; + public static paramsParser = paramsParser; + public static pathParser = pathParser; + public static scanFlag = scanFlag; + public static scanParam = scanParam; + public static scanSegment = scanSegment; + public static skipSpaces = skipSpaces; public static getPathBBox = getPathBBox; public static getPathArea = getPathArea; public static getTotalLength = getTotalLength; @@ -69,8 +155,6 @@ class SVGPathCommander { public static getPointAtLength = getPointAtLength; public static getPropertiesAtLength = getPropertiesAtLength; public static getPropertiesAtPoint = getPropertiesAtPoint; - public static polygonLength = polygonLength; - public static polygonArea = polygonArea; public static getClosestPoint = getClosestPoint; public static getSegmentOfPoint = getSegmentOfPoint; public static getSegmentAtLength = getSegmentAtLength; @@ -83,19 +167,28 @@ class SVGPathCommander { public static isNormalizedArray = isNormalizedArray; public static shapeToPath = shapeToPath; public static shapeToPathArray = shapeToPathArray; + public static shapeParams = shapeParams; public static parsePathString = parsePathString; - public static roundPath = roundPath; - public static splitPath = splitPath; - public static splitCubic = splitCubic; + public static absolutizeSegment = absolutizeSegment; + public static arcToCubic = arcToCubic; + public static getSVGMatrix = getSVGMatrix; + public static iterate = iterate; + public static lineToCubic = lineToCubic; + public static normalizePath = normalizePath; + public static normalizeSegment = normalizeSegment; public static optimizePath = optimizePath; + public static projection2d = projection2d; + public static quadToCubic = quadToCubic; + public static relativizeSegment = relativizeSegment; public static reverseCurve = reverseCurve; public static reversePath = reversePath; - public static normalizePath = normalizePath; + public static roundPath = roundPath; + public static roundSegment = roundSegment; + public static segmentToCubic = segmentToCubic; + public static shortenSegment = shortenSegment; + public static splitCubic = splitCubic; + public static splitPath = splitPath; public static transformPath = transformPath; - public static pathToAbsolute = pathToAbsolute; - public static pathToRelative = pathToRelative; - public static pathToCurve = pathToCurve; - public static pathToString = pathToString; // declare class properties declare segments: PathArray; declare round: number | 'off'; @@ -114,8 +207,7 @@ class SVGPathCommander { throw TypeError(`${error}: "pathValue" is ${undefPath ? 'undefined' : 'empty'}`); } - const segments = parsePathString(pathValue); - this.segments = segments; + this.segments = parsePathString(pathValue); // // set instance options.round const { round: roundOption, origin: originOption } = instanceOptions; @@ -274,8 +366,9 @@ class SVGPathCommander { */ optimize() { const { segments } = this; + const round = this.round === 'off' ? 2 : this.round; - this.segments = optimizePath(segments, this.round); + this.segments = optimizePath(segments, round); return this; } diff --git a/src/interface.ts b/src/interface.ts index 592109a..6e59ff8 100644 --- a/src/interface.ts +++ b/src/interface.ts @@ -5,7 +5,8 @@ export type SegmentProperties = { index: number; length: number; lengthAtSegment: number; - [key: string]: any; + // point: Point; + // [key: string]: any; }; export type PointProperties = { diff --git a/src/math/arcTools.ts b/src/math/arcTools.ts index be9cb14..e0673d8 100644 --- a/src/math/arcTools.ts +++ b/src/math/arcTools.ts @@ -8,37 +8,38 @@ import type { Point } from '../types'; * @param theta the angle in radians * @returns the arc length */ -const ellipticalArcLength = (rx: number, ry: number, theta: number) => { +const arcLength = (rx: number, ry: number, theta: number) => { const halfTheta = theta / 2; const sinHalfTheta = Math.sin(halfTheta); const cosHalfTheta = Math.cos(halfTheta); const term1 = rx ** 2 * sinHalfTheta ** 2; const term2 = ry ** 2 * cosHalfTheta ** 2; - const arcLength = Math.sqrt(term1 + term2) * theta; - return Math.abs(arcLength); + const length = Math.sqrt(term1 + term2) * theta; + return Math.abs(length); }; /** - * Compute point on ellipse from angle around ellipse (theta); - * @param theta the arc sweep angle + * Find point on ellipse at given angle around ellipse (theta); * @param cx the center X * @param cy the center Y * @param rx the radius X * @param ry the radius Y - * @param alpha the angle - * @returns a point around ellipse + * @param alpha the arc rotation angle in radians + * @param theta the arc sweep angle in radians + * @returns a point around ellipse at given angle */ -const arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alpha: number) => { +const arcPoint = (cx: number, cy: number, rx: number, ry: number, alpha: number, theta: number) => { + const { sin, cos } = Math; // theta is angle in radians around arc // alpha is angle of rotation of ellipse in radians - const cos = Math.cos(alpha); - const sin = Math.sin(alpha); - const x = rx * Math.cos(theta); - const y = ry * Math.sin(theta); + const cosA = cos(alpha); + const sinA = sin(alpha); + const x = rx * cos(theta); + const y = ry * sin(theta); return { - x: cx + cos * x - sin * y, - y: cy + sin * x + cos * y, + x: cx + cosA * x - sinA * y, + y: cy + sinA * x + cosA * y, }; }; @@ -46,7 +47,7 @@ const arc = (theta: number, cx: number, cy: number, rx: number, ry: number, alph * Returns the angle between two points. * @param v0 starting point * @param v1 ending point - * @returns the angle + * @returns the angle in radian */ const angleBetween = (v0: Point, v1: Point) => { const { x: v0x, y: v0y } = v0; @@ -54,14 +55,12 @@ const angleBetween = (v0: Point, v1: Point) => { const p = v0x * v1x + v0y * v1y; const n = Math.sqrt((v0x ** 2 + v0y ** 2) * (v1x ** 2 + v1y ** 2)); const sign = v0x * v1y - v0y * v1x < 0 ? -1 : 1; - const angle = sign * Math.acos(p / n); - - return angle; + return sign * Math.acos(p / n); }; /** - * Returns the following properties for an Arc segment: center, start angle - * and radiuses on X and Y coordinates. + * Returns the following properties for an Arc segment: center, start angle, + * end angle, and radiuses on X and Y axis. * * @param x1 the starting point X * @param y1 the starting point Y @@ -91,6 +90,7 @@ const getArcProps = ( const xRot = ((angle % 360) + 360) % 360; const xRotRad = xRot * (PI / 180); + // istanbul ignore next @preserve if (x1 === x && y1 === y) { return { rx, @@ -107,7 +107,7 @@ const getArcProps = ( ry, startAngle: 0, endAngle: 0, - center: { x, y }, + center: { x: (x + x1) / 2, y: (y + y1) / 2 }, }; } @@ -165,7 +165,6 @@ const getArcProps = ( const endAngle = startAngle + sweepAngle; - // to be used later // point.ellipticalArcStartAngle = startAngle; // point.ellipticalArcEndAngle = startAngle + sweepAngle; // point.ellipticalArcAngle = alpha; @@ -173,8 +172,6 @@ const getArcProps = ( // point.ellipticalArcCenter = center; // point.resultantRx = rx; // point.resultantRy = ry; - // point.length = ellipticalArcLength(rx, ry, sweepAngle); - // point.box = minmax(center.x, center.y, rx, ry, xRotRad, startAngle, startAngle + sweepAngle); return { center, @@ -198,7 +195,7 @@ const getArcProps = ( * @param y2 the ending point Y * @returns the length of the Arc segment */ -export const getArcLength = ( +const getArcLength = ( x1: number, y1: number, RX: number, @@ -210,7 +207,7 @@ export const getArcLength = ( y: number, ) => { const { rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y); - return ellipticalArcLength(rx, ry, endAngle - startAngle); + return arcLength(rx, ry, endAngle - startAngle); }; /** @@ -228,7 +225,7 @@ export const getArcLength = ( * @param distance a [0-1] ratio * @returns a point along the Arc segment */ -export const getPointAtArcLength = ( +const getPointAtArcLength = ( x1: number, y1: number, RX: number, @@ -242,10 +239,10 @@ export const getPointAtArcLength = ( ) => { let point = { x: x1, y: y1 }; const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y); - const length = ellipticalArcLength(rx, ry, endAngle - startAngle); /* istanbul ignore else @preserve */ if (typeof distance === 'number') { + const length = arcLength(rx, ry, endAngle - startAngle); if (distance <= 0) { point = { x: x1, y: y1 }; } else if (distance >= length) { @@ -278,7 +275,7 @@ export const getPointAtArcLength = ( }; /** - * Returns the bounding box for an Arc segment. + * Returns the extrema for an Arc segment. * @see https://github.com/herrstrietzel/svg-pathdata-getbbox * * @param x1 the starting point X @@ -293,7 +290,7 @@ export const getPointAtArcLength = ( * @returns the extrema of the Arc segment * */ -export const getArcBBox = ( +const getArcBBox = ( x1: number, y1: number, RX: number, @@ -306,45 +303,46 @@ export const getArcBBox = ( ) => { const { center, rx, ry, startAngle, endAngle } = getArcProps(x1, y1, RX, RY, angle, LAF, SF, x, y); const deltaAngle = endAngle - startAngle; + const { min, max, tan, atan2, PI } = Math; // final on path point const p = { x, y }; // circle/elipse center coordinates - const [cx, cy] = [center.x, center.y]; + const { x: cx, y: cy } = center; // collect extreme points – add end point const extremes = [p]; // rotation to radians - const alpha = (angle * Math.PI) / 180; - const tan = Math.tan(alpha); + const alpha = (angle * PI) / 180; + const tangent = tan(alpha); /** * find min/max from zeroes of directional derivative along x and y * along x axis */ - const theta = Math.atan2(-ry * tan, rx); + const theta = atan2(-ry * tangent, rx); const angle1 = theta; - const angle2 = theta + Math.PI; - const angle3 = Math.atan2(ry, rx * tan); - const angle4 = angle3 + Math.PI; + const angle2 = theta + PI; + const angle3 = atan2(ry, rx * tangent); + const angle4 = angle3 + PI; // inner bounding box const xArr = [x1, x]; const yArr = [y1, y]; - const xMin = Math.min(...xArr); - const xMax = Math.max(...xArr); - const yMin = Math.min(...yArr); - const yMax = Math.max(...yArr); + const xMin = min(...xArr); + const xMax = max(...xArr); + const yMin = min(...yArr); + const yMax = max(...yArr); // on path point close after start const angleAfterStart = endAngle - deltaAngle * 0.001; - const pP2 = arc(angleAfterStart, cx, cy, rx, ry, alpha); + const pP2 = arcPoint(cx, cy, rx, ry, alpha, angleAfterStart); // on path point close before end const angleBeforeEnd = endAngle - deltaAngle * 0.999; - const pP3 = arc(angleBeforeEnd, cx, cy, rx, ry, alpha); + const pP3 = arcPoint(cx, cy, rx, ry, alpha, angleBeforeEnd); /** * expected extremes @@ -357,38 +355,42 @@ export const getArcBBox = ( // istanbul ignore if @preserve if (pP2.x > xMax || pP3.x > xMax) { // get point for this theta - extremes.push(arc(angle1, cx, cy, rx, ry, alpha)); + extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle1)); } // left // istanbul ignore if @preserve if (pP2.x < xMin || pP3.x < xMin) { // get anti-symmetric point - extremes.push(arc(angle2, cx, cy, rx, ry, alpha)); + extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle2)); } // top // istanbul ignore if @preserve if (pP2.y < yMin || pP3.y < yMin) { // get anti-symmetric point - extremes.push(arc(angle4, cx, cy, rx, ry, alpha)); + extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle4)); } // bottom // istanbul ignore if @preserve if (pP2.y > yMax || pP3.y > yMax) { // get point for this theta - extremes.push(arc(angle3, cx, cy, rx, ry, alpha)); + extremes.push(arcPoint(cx, cy, rx, ry, alpha, angle3)); } return { min: { - x: Math.min(...extremes.map(n => n.x)), - y: Math.min(...extremes.map(n => n.y)), + x: min(...extremes.map(n => n.x)), + y: min(...extremes.map(n => n.y)), }, max: { - x: Math.max(...extremes.map(n => n.x)), - y: Math.max(...extremes.map(n => n.y)), + x: max(...extremes.map(n => n.x)), + y: max(...extremes.map(n => n.y)), }, }; }; + +export { arcPoint, angleBetween, getArcLength, arcLength, getArcBBox, getArcProps, getPointAtArcLength }; + +export {}; diff --git a/src/math/bezier.ts b/src/math/bezier.ts index 6c743aa..878f0d9 100644 --- a/src/math/bezier.ts +++ b/src/math/bezier.ts @@ -15,8 +15,6 @@ import type { * @see https://github.com/Pomax/bezierjs */ -const ZERO = { x: 0, y: 0 }; - const Tvalues = [ -0.0640568928626056260850430826247450385909, 0.0640568928626056260850430826247450385909, -0.1911188674736163091586398207570696318404, 0.1911188674736163091586398207570696318404, @@ -52,7 +50,7 @@ const Cvalues = [ * @param points * @returns */ -const derive = (points: QuadPoints | CubicPoints) => { +const deriveBezier = (points: QuadPoints | CubicPoints) => { const dpoints = [] as (DerivedCubicPoints | DerivedQuadPoints)[]; for (let p = points, d = p.length, c = d - 1; d > 1; d -= 1, c -= 1) { const list = [] as unknown as DerivedCubicPoints | DerivedQuadPoints; @@ -74,7 +72,7 @@ const derive = (points: QuadPoints | CubicPoints) => { * @param points * @param t */ -const compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => { +const computeBezier = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => { // shortcuts /* istanbul ignore next @preserve */ if (t === 0) { @@ -119,7 +117,7 @@ const compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => { let d = 0; /* istanbul ignore else @preserve */ if (order === 2) { - p = [p[0], p[1], p[2], ZERO as DerivedPoint]; + p = [p[0], p[1], p[2], { x: 0, y: 0 } as DerivedPoint]; a = mt2; b = mt * t * 2; c = t2; @@ -136,14 +134,14 @@ const compute = (points: DerivedQuadPoints | DerivedCubicPoints, t: number) => { }; }; -const arcfn = (derivativeFn: DeriveCallback, t: number) => { +const calculateBezier = (derivativeFn: DeriveCallback, t: number) => { const d = derivativeFn(t); const l = d.x * d.x + d.y * d.y; return Math.sqrt(l); }; -const lengthFn = (derivativeFn: DeriveCallback) => { +const bezierLength = (derivativeFn: DeriveCallback) => { const z = 0.5; const len = Tvalues.length; @@ -151,7 +149,7 @@ const lengthFn = (derivativeFn: DeriveCallback) => { for (let i = 0, t; i < len; i++) { t = z * Tvalues[i] + z; - sum += Cvalues[i] * arcfn(derivativeFn, t); + sum += Cvalues[i] * calculateBezier(derivativeFn, t); } return z * sum; }; @@ -160,7 +158,7 @@ const lengthFn = (derivativeFn: DeriveCallback) => { * Returns the length of CubicBezier / Quad segment. * @param curve cubic / quad bezier segment */ -export const length = (curve: CubicCoordinates | QuadCoordinates) => { +const getBezierLength = (curve: CubicCoordinates | QuadCoordinates) => { const points = [] as unknown as CubicPoints | QuadPoints; for (let idx = 0, len = curve.length, step = 2; idx < len; idx += step) { points.push({ @@ -168,9 +166,9 @@ export const length = (curve: CubicCoordinates | QuadCoordinates) => { y: curve[idx + 1], }); } - const dpoints = derive(points); - return lengthFn((t: number) => { - return compute(dpoints[0], t); + const dpoints = deriveBezier(points); + return bezierLength((t: number) => { + return computeBezier(dpoints[0], t); }); }; @@ -179,67 +177,64 @@ const CBEZIER_MINMAX_EPSILON = 0.00000001; /** * Returns the most extreme points in a Quad Bezier segment. - * @param A + * @param A an array which consist of X/Y values */ // https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L89 -export const minmaxQ = (A: [number, number, number]) => { - const min = Math.min(A[0], A[2]); - const max = Math.max(A[0], A[2]); +const minmaxQ = ([v1, cp, v2]: [number, number, number]) => { + const min = Math.min(v1, v2); + const max = Math.max(v1, v2); /* istanbul ignore next @preserve */ - if (A[1] >= A[0] ? A[2] >= A[1] : A[2] <= A[1]) { + if (cp >= v1 ? v2 >= cp : v2 <= cp) { // if no extremum in ]0,1[ return [min, max] as PointTuple; } // check if the extremum E is min or max - const E = (A[0] * A[2] - A[1] * A[1]) / (A[0] - 2 * A[1] + A[2]); + const E = (v1 * v2 - cp * cp) / (v1 - 2 * cp + v2); return (E < min ? [E, max] : [min, E]) as PointTuple; }; /** * Returns the most extreme points in a Cubic Bezier segment. - * @param A + * @param A an array which consist of X/Y values * @see https://github.com/kpym/SVGPathy/blob/acd1a50c626b36d81969f6e98e8602e128ba4302/lib/box.js#L127 */ -export const minmaxC = (A: [number, number, number, number]) => { - const K = A[0] - 3 * A[1] + 3 * A[2] - A[3]; +const minmaxC = ([v1, cp1, cp2, v2]: [number, number, number, number]) => { + const K = v1 - 3 * cp1 + 3 * cp2 - v2; // if the polynomial is (almost) quadratic and not cubic /* istanbul ignore next @preserve */ if (Math.abs(K) < CBEZIER_MINMAX_EPSILON) { - if (A[0] === A[3] && A[0] === A[1]) { + if (v1 === v2 && v1 === cp1) { // no curve, point targeting same location - return [A[0], A[3]] as PointTuple; + return [v1, v2] as PointTuple; } - return minmaxQ([A[0], -0.5 * A[0] + 1.5 * A[1], A[0] - 3 * A[1] + 3 * A[2]]); + return minmaxQ([v1, -0.5 * v1 + 1.5 * cp1, v1 - 3 * cp1 + 3 * cp2]); } // the reduced discriminant of the derivative - const T = -A[0] * A[2] + A[0] * A[3] - A[1] * A[2] - A[1] * A[3] + A[1] * A[1] + A[2] * A[2]; + const T = -v1 * cp2 + v1 * v2 - cp1 * cp2 - cp1 * v2 + cp1 * cp1 + cp2 * cp2; // if the polynomial is monotone in [0,1] if (T <= 0) { - return [Math.min(A[0], A[3]), Math.max(A[0], A[3])] as PointTuple; + return [Math.min(v1, v2), Math.max(v1, v2)] as PointTuple; } const S = Math.sqrt(T); // potential extrema - let min = Math.min(A[0], A[3]); - let max = Math.max(A[0], A[3]); + let min = Math.min(v1, v2); + let max = Math.max(v1, v2); - const L = A[0] - 2 * A[1] + A[2]; + const L = v1 - 2 * cp1 + cp2; // check local extrema for (let R = (L + S) / K, i = 1; i <= 2; R = (L - S) / K, i++) { // istanbul ignore next @preserve if (R > 0 && R < 1) { // if the extrema is for R in [0,1] const Q = - A[0] * (1 - R) * (1 - R) * (1 - R) + - A[1] * 3 * (1 - R) * (1 - R) * R + - A[2] * 3 * (1 - R) * R * R + - A[3] * R * R * R; + v1 * (1 - R) * (1 - R) * (1 - R) + cp1 * 3 * (1 - R) * (1 - R) * R + cp2 * 3 * (1 - R) * R * R + v2 * R * R * R; if (Q < min) { min = Q; } @@ -251,3 +246,16 @@ export const minmaxC = (A: [number, number, number, number]) => { return [min, max] as PointTuple; }; + +export { + Cvalues, + Tvalues, + minmaxC, + minmaxQ, + getBezierLength, + bezierLength, + calculateBezier, + computeBezier, + deriveBezier, + CBEZIER_MINMAX_EPSILON, +}; diff --git a/src/math/cubicTools.ts b/src/math/cubicTools.ts index e54440f..bb8a506 100644 --- a/src/math/cubicTools.ts +++ b/src/math/cubicTools.ts @@ -1,8 +1,8 @@ -import { length, minmaxC } from './bezier'; +import { getBezierLength, minmaxC } from './bezier'; import { type CubicCoordinates } from '../types'; /** - * Returns a {x,y} point at a given length of a CubicBezier segment. + * Returns a point at a given length of a CubicBezier segment. * * @param x1 the starting point X * @param y1 the starting point Y @@ -15,7 +15,7 @@ import { type CubicCoordinates } from '../types'; * @param t a [0-1] ratio * @returns the point at cubic-bezier segment length */ -export const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => { +const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2]: CubicCoordinates, t: number) => { const t1 = 1 - t; return { x: t1 ** 3 * x1 + 3 * t1 ** 2 * t * c1x + 3 * t1 * t ** 2 * c2x + t ** 3 * x2, @@ -36,7 +36,7 @@ export const getPointAtCubicSegmentLength = ([x1, y1, c1x, c1y, c2x, c2y, x2, y2 * @param y2 the ending point Y * @returns the CubicBezier segment length */ -export const getCubicLength = ( +const getCubicLength = ( x1: number, y1: number, c1x: number, @@ -46,7 +46,7 @@ export const getCubicLength = ( x2: number, y2: number, ) => { - return length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]); + return getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]); }; /** @@ -63,7 +63,7 @@ export const getCubicLength = ( * @param distance the distance to look at * @returns the point at CubicBezier length */ -export const getPointAtCubicLength = ( +const getPointAtCubicLength = ( x1: number, y1: number, c1x: number, @@ -78,7 +78,7 @@ export const getPointAtCubicLength = ( let point = { x: x1, y: y1 }; /* istanbul ignore else @preserve */ if (distanceIsNumber) { - const currentLength = length([x1, y1, c1x, c1y, c2x, c2y, x2, y2]); + const currentLength = getBezierLength([x1, y1, c1x, c1y, c2x, c2y, x2, y2]); if (distance <= 0) { // first point already defined } else if (distance >= currentLength) { @@ -103,7 +103,7 @@ export const getPointAtCubicLength = ( * @param y2 the ending point Y * @returns the point at CubicBezier length */ -export const getCubicBBox = ( +const getCubicBBox = ( x1: number, y1: number, c1x: number, @@ -120,3 +120,5 @@ export const getCubicBBox = ( max: { x: cxMinMax[1], y: cyMinMax[1] }, }; }; + +export { getCubicLength, getCubicBBox, getPointAtCubicLength, getPointAtCubicSegmentLength }; diff --git a/src/math/distanceSquareRoot.ts b/src/math/distanceSquareRoot.ts index 5cec40d..71ccbed 100644 --- a/src/math/distanceSquareRoot.ts +++ b/src/math/distanceSquareRoot.ts @@ -8,7 +8,7 @@ import { type PointTuple } from '../types'; * @param b the second point coordinates * @returns the distance value */ -const distanceSquareRoot = (a: PointTuple, b: PointTuple): number => { +const distanceSquareRoot = (a: PointTuple, b: PointTuple) => { return Math.sqrt((a[0] - b[0]) * (a[0] - b[0]) + (a[1] - b[1]) * (a[1] - b[1])); }; diff --git a/src/math/lineTools.ts b/src/math/lineTools.ts index fd5c715..0bcb87d 100644 --- a/src/math/lineTools.ts +++ b/src/math/lineTools.ts @@ -10,7 +10,7 @@ import distanceSquareRoot from './distanceSquareRoot'; * @param y2 the ending point Y * @returns the line segment length */ -export const getLineLength = (x1: number, y1: number, x2: number, y2: number) => { +const getLineLength = (x1: number, y1: number, x2: number, y2: number) => { return distanceSquareRoot([x1, y1], [x2, y2]); }; @@ -24,12 +24,12 @@ export const getLineLength = (x1: number, y1: number, x2: number, y2: number) => * @param distance the distance to point in [0-1] range * @returns the point at length */ -export const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => { - const length = distanceSquareRoot([x1, y1], [x2, y2]); +const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: number, distance?: number) => { let point = { x: x1, y: y1 }; /* istanbul ignore else @preserve */ if (typeof distance === 'number') { + const length = distanceSquareRoot([x1, y1], [x2, y2]); if (distance <= 0) { point = { x: x1, y: y1 }; } else if (distance >= length) { @@ -52,7 +52,7 @@ export const getPointAtLineLength = (x1: number, y1: number, x2: number, y2: num * @param distance the distance to point in [0-1] range * @returns the extrema for line segments */ -export const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => { +const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => { const { min, max } = Math; return { min: { @@ -65,3 +65,5 @@ export const getLineBBox = (x1: number, y1: number, x2: number, y2: number) => { }, }; }; + +export { getPointAtLineLength, getLineBBox, getLineLength }; diff --git a/src/math/polygonArea.ts b/src/math/polygonArea.ts deleted file mode 100644 index f378c68..0000000 --- a/src/math/polygonArea.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { type PointTuple } from '../types'; - -/** - * d3-polygon-area - * https://github.com/d3/d3-polygon - * - * Returns the area of a polygon. - * - * @param polygon an array of coordinates - * @returns the polygon area - */ -const polygonArea = (polygon: PointTuple[]): number => { - const n = polygon.length; - let i = -1; - let a; - let b = polygon[n - 1]; - let area = 0; - - /* eslint-disable-next-line */ - while (++i < n) { - a = b; - b = polygon[i]; - area += a[1] * b[0] - a[0] * b[1]; - } - - return area / 2; -}; - -export default polygonArea; diff --git a/src/math/polygonLength.ts b/src/math/polygonLength.ts deleted file mode 100644 index ec72c97..0000000 --- a/src/math/polygonLength.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { type PointTuple } from '../types'; -import distanceSquareRoot from './distanceSquareRoot'; - -/** - * d3-polygon-length - * https://github.com/d3/d3-polygon - * - * Returns the perimeter of a polygon. - * - * @param polygon an array of coordinates - * @returns {number} the polygon length - */ -const polygonLength = (polygon: PointTuple[]): number => { - return polygon.reduce((length, point, i) => { - if (i) { - return length + distanceSquareRoot(polygon[i - 1], point); - } - return 0; - }, 0); -}; - -export default polygonLength; diff --git a/src/math/polygonTools.ts b/src/math/polygonTools.ts new file mode 100644 index 0000000..d66f2d7 --- /dev/null +++ b/src/math/polygonTools.ts @@ -0,0 +1,48 @@ +import distanceSquareRoot from './distanceSquareRoot'; +import { type PointTuple } from '../types'; + +/** + * d3-polygon-area + * https://github.com/d3/d3-polygon + * + * Returns the area of a polygon. + * + * @param polygon an array of coordinates + * @returns the polygon area + */ +const polygonArea = (polygon: PointTuple[]) => { + const n = polygon.length; + let i = -1; + let a: PointTuple; + let b = polygon[n - 1]; + let area = 0; + + /* eslint-disable-next-line */ + while (++i < n) { + a = b; + b = polygon[i]; + area += a[1] * b[0] - a[0] * b[1]; + } + + return area / 2; +}; + +/** + * d3-polygon-length + * https://github.com/d3/d3-polygon + * + * Returns the perimeter of a polygon. + * + * @param polygon an array of coordinates + * @returns the polygon length + */ +const polygonLength = (polygon: PointTuple[]) => { + return polygon.reduce((length, point, i) => { + if (i) { + return length + distanceSquareRoot(polygon[i - 1], point); + } + return 0; + }, 0); +}; + +export { polygonArea, polygonLength }; diff --git a/src/math/quadTools.ts b/src/math/quadTools.ts index 1b0e306..a653810 100644 --- a/src/math/quadTools.ts +++ b/src/math/quadTools.ts @@ -1,4 +1,4 @@ -import { length, minmaxQ } from './bezier'; +import { getBezierLength, minmaxQ } from './bezier'; import { type QuadCoordinates } from '../types'; /** @@ -35,8 +35,8 @@ const getPointAtQuadSegmentLength = ([x1, y1, cx, cy, x2, y2]: QuadCoordinates, * @param y2 the ending point Y * @returns the QuadraticBezier segment length */ -export const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => { - return length([x1, y1, cx, cy, x2, y2]); +const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => { + return getBezierLength([x1, y1, cx, cy, x2, y2]); }; /** @@ -51,7 +51,7 @@ export const getQuadLength = (x1: number, y1: number, cx: number, cy: number, x2 * @param distance the distance to look at * @returns the point at QuadraticBezier length */ -export const getPointAtQuadLength = ( +const getPointAtQuadLength = ( x1: number, y1: number, cx: number, @@ -65,7 +65,7 @@ export const getPointAtQuadLength = ( /* istanbul ignore else @preserve */ if (distanceIsNumber) { - const currentLength = length([x1, y1, cx, cy, x2, y2]); + const currentLength = getBezierLength([x1, y1, cx, cy, x2, y2]); if (distance <= 0) { // first point already defined } else if (distance >= currentLength) { @@ -88,7 +88,7 @@ export const getPointAtQuadLength = ( * @param y2 the ending point Y * @returns the point at CubicBezier length */ -export const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => { +const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: number, y2: number) => { const cxMinMax = minmaxQ([x1, cx, x2]); const cyMinMax = minmaxQ([y1, cy, y2]); return { @@ -96,3 +96,5 @@ export const getQuadBBox = (x1: number, y1: number, cx: number, cy: number, x2: max: { x: cxMinMax[1], y: cyMinMax[1] }, }; }; + +export { getPointAtQuadSegmentLength, getQuadLength, getQuadBBox, getPointAtQuadLength }; diff --git a/src/math/rotateVector.ts b/src/math/rotateVector.ts index fc60eb9..0c29e4e 100644 --- a/src/math/rotateVector.ts +++ b/src/math/rotateVector.ts @@ -8,8 +8,9 @@ * @returns the rotated vector */ const rotateVector = (x: number, y: number, rad: number): { x: number; y: number } => { - const X = x * Math.cos(rad) - y * Math.sin(rad); - const Y = x * Math.sin(rad) + y * Math.cos(rad); + const { sin, cos } = Math; + const X = x * cos(rad) - y * sin(rad); + const Y = x * sin(rad) + y * cos(rad); return { x: X, y: Y }; }; diff --git a/src/math/roundTo.ts b/src/math/roundTo.ts new file mode 100644 index 0000000..9b11e85 --- /dev/null +++ b/src/math/roundTo.ts @@ -0,0 +1,7 @@ +const roundTo = (n: number, round: number) => { + const pow = round >= 1 ? 10 ** round : 1; + + return round > 0 ? Math.round(n * pow) / pow : Math.round(n); +}; + +export default roundTo; diff --git a/src/parser/finalizeSegment.ts b/src/parser/finalizeSegment.ts index c63aae5..d6564e3 100644 --- a/src/parser/finalizeSegment.ts +++ b/src/parser/finalizeSegment.ts @@ -9,21 +9,25 @@ import type { PathCommand, PathSegment, RelativeCommand } from '../types'; */ const finalizeSegment = (path: PathParser) => { let pathCommand = path.pathValue[path.segmentStart] as PathCommand; - let LK = pathCommand.toLowerCase() as RelativeCommand; + let relativeCommand = pathCommand.toLowerCase() as RelativeCommand; const { data } = path; - while (data.length >= paramsCount[LK]) { + while (data.length >= paramsCount[relativeCommand]) { // overloaded `moveTo` // https://github.com/rveciana/svg-path-properties/blob/master/src/parse.ts - if (LK === 'm' && data.length > 2) { - path.segments.push([pathCommand, ...(data.splice(0, 2) as number[])] as PathSegment); - LK = 'l'; + if (relativeCommand === 'm' && data.length > 2) { + path.segments.push([pathCommand as PathCommand | number].concat(data.splice(0, 2) as number[]) as PathSegment); + relativeCommand = 'l'; pathCommand = pathCommand === 'm' ? 'l' : 'L'; } else { - path.segments.push([pathCommand, ...(data.splice(0, paramsCount[LK]) as number[])] as PathSegment); + path.segments.push( + [pathCommand as PathCommand | number].concat( + data.splice(0, paramsCount[relativeCommand]) as number[], + ) as PathSegment, + ); } - if (!paramsCount[LK]) { + if (!paramsCount[relativeCommand]) { break; } } diff --git a/src/parser/parsePathString.ts b/src/parser/parsePathString.ts index cb3654a..b25672d 100644 --- a/src/parser/parsePathString.ts +++ b/src/parser/parsePathString.ts @@ -10,10 +10,9 @@ import type { PathArray } from '../types'; * @param pathInput the string to be parsed * @returns the resulted `pathArray` or error string */ -const parsePathString = (pathInput: string | PathArray) => { +const parsePathString = (pathInput: string | T) => { if (typeof pathInput !== 'string') { - return pathInput.slice(0) as PathArray; - // return pathInput; + return pathInput.slice(0) as typeof pathInput; } const path = new PathParser(pathInput); diff --git a/src/parser/pathParser.ts b/src/parser/pathParser.ts index e64d039..83fc416 100644 --- a/src/parser/pathParser.ts +++ b/src/parser/pathParser.ts @@ -13,7 +13,7 @@ export default class PathParser { declare index: number; declare param: number; declare segmentStart: number; - declare data: any[]; + declare data: (string | number)[]; declare err: string; constructor(pathString: string) { diff --git a/src/process/absolutizeSegment.ts b/src/process/absolutizeSegment.ts index cafee75..492706a 100644 --- a/src/process/absolutizeSegment.ts +++ b/src/process/absolutizeSegment.ts @@ -1,4 +1,3 @@ -import type { ParserParams } from '../interface'; import type { AbsoluteSegment, AbsoluteCommand, @@ -11,48 +10,54 @@ import type { CSegment, PathSegment, MSegment, + LSegment, } from '../types'; /** * Returns an absolute segment of a `PathArray` object. * * @param segment the segment object - * @param params the coordinates of the previous segment + * @param index the segment index + * @param lastX the last known X value + * @param lastY the last known Y value * @returns the absolute segment */ -const absolutizeSegment = (segment: PathSegment, params: ParserParams) => { +const absolutizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => { const [pathCommand] = segment; - const { x, y } = params; - const values = segment.slice(1).map(Number); const absCommand = pathCommand.toUpperCase() as AbsoluteCommand; const isAbsolute = absCommand === pathCommand; /* istanbul ignore else @preserve */ - if (!isAbsolute) { - if (absCommand === 'A') { - return [ - absCommand, - values[0], - values[1], - values[2], - values[3], - values[4], - values[5] + x, - values[6] + y, - ] as ASegment; - } else if (absCommand === 'V') { - return [absCommand, values[0] + y] as VSegment; - } else if (absCommand === 'H') { - return [absCommand, values[0] + x] as HSegment; - } else { - // use brakets for `eslint: no-case-declaration` - // https://stackoverflow.com/a/50753272/803358 - const absValues = values.map((n, j) => n + (j % 2 ? y : x)); - // for n, l, c, s, q, t - return [absCommand, ...absValues] as MSegment | QSegment | TSegment | SSegment | CSegment; - } + if (index === 0 || isAbsolute) return segment as MSegment | AbsoluteSegment; + // const values = segment.slice(1) as number[]; + if (absCommand === 'A') { + return [ + absCommand, + segment[1], + segment[2], + segment[3], + segment[4], + segment[5], + (segment as ASegment)[6] + lastX, + (segment as ASegment)[7] + lastY, + ] as ASegment; + } else if (absCommand === 'V') { + return [absCommand, (segment as VSegment)[1] + lastY] as VSegment; + } else if (absCommand === 'H') { + return [absCommand, (segment as HSegment)[1] + lastX] as HSegment; + } else if (absCommand === 'L') { + return [absCommand, (segment as LSegment)[1] + lastX, (segment as LSegment)[2] + lastY] as LSegment; + } else { + // use brakets for `eslint: no-case-declaration` + // https://stackoverflow.com/a/50753272/803358 + const absValues = (segment.slice(1) as number[]).map((n, j) => n + (j % 2 ? lastY : lastX)); + // for c, s, q, t + return [absCommand as typeof absCommand | number].concat(absValues) as + | MSegment + | QSegment + | TSegment + | SSegment + | CSegment; } - - return segment as AbsoluteSegment; }; export default absolutizeSegment; diff --git a/src/process/arcToCubic.ts b/src/process/arcToCubic.ts index 7753a57..59c9088 100644 --- a/src/process/arcToCubic.ts +++ b/src/process/arcToCubic.ts @@ -116,9 +116,9 @@ const arcToCubic = ( m2[0] = 2 * m1[0] - m2[0]; m2[1] = 2 * m1[1] - m2[1]; if (recursive) { - return [...m2, ...m3, ...m4, ...res]; + return [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res); } - res = [...m2, ...m3, ...m4, ...res]; + res = [m2[0], m2[1], m3[0], m3[1], m4[0], m4[1]].concat(res); const newres = []; for (let i = 0, ii = res.length; i < ii; i += 1) { newres[i] = i % 2 ? rotateVector(res[i - 1], res[i], rad).y : rotateVector(res[i], res[i + 1], rad).x; diff --git a/src/process/iterate.ts b/src/process/iterate.ts index 7c0a0f6..20d261b 100644 --- a/src/process/iterate.ts +++ b/src/process/iterate.ts @@ -1,32 +1,57 @@ -import paramsParser from '../parser/paramsParser'; -import type { PathArray, PathCommand, PathSegment, IteratorCallback } from '../types'; +// import paramsParser from '../parser/paramsParser'; +import type { PathArray, PathCommand, PathSegment, IteratorCallback, AbsoluteCommand } from '../types'; const iterate = (path: PathArray, iterator: IteratorCallback) => { - const allPathCommands = [] as PathCommand[]; - const params = { ...paramsParser }; let pathLen = path.length; let segment: PathSegment; let pathCommand = 'M' as PathCommand; + let absCommand = 'M' as AbsoluteCommand; + let isRelative = false; + let x = 0; + let y = 0; + let mx = 0; + let my = 0; + let segLen = 0; for (let i = 0; i < pathLen; i += 1) { segment = path[i]; [pathCommand] = segment; - allPathCommands[i] = pathCommand; - const iteratorResult = iterator(segment, params, i); - path[i] = iteratorResult; + segLen = segment.length; + absCommand = pathCommand.toUpperCase() as AbsoluteCommand; + isRelative = absCommand !== pathCommand; - if (iteratorResult[0] === 'C') { - pathLen = path.length; + const iteratorResult = iterator(segment, i, x, y); + // some methods like getPointAtLength would like to break + // when task is complete + if (iteratorResult === false) { + break; } - segment = path[i]; - const seglen = segment.length; - params.x1 = +segment[seglen - 2]; - params.y1 = +segment[seglen - 1]; - params.x2 = +segment[seglen - 4] || params.x1; - params.y2 = +segment[seglen - 3] || params.y1; + // segment = path[i]; + if (absCommand === 'Z') { + x = mx; + y = my; + } else if (absCommand === 'H') { + x = (segment[1] as number) + (isRelative ? x : 0); + } else if (absCommand === 'V') { + y = (segment[1] as number) + (isRelative ? y : 0); + } else { + x = (segment[segLen - 2] as number) + (isRelative ? x : 0); + y = (segment[segLen - 1] as number) + (isRelative ? y : 0); + + if (absCommand === 'M') { + mx = x; + my = y; + } + } + + if (iteratorResult) { + path[i] = iteratorResult; + if (iteratorResult[0] === 'C') { + pathLen = path.length; + } + } } - // console.log('iteration: ', ...path) return path as T; }; diff --git a/src/process/lineToCubic.ts b/src/process/lineToCubic.ts index 9b46d59..062512e 100644 --- a/src/process/lineToCubic.ts +++ b/src/process/lineToCubic.ts @@ -12,6 +12,6 @@ import midPoint from '../math/midPoint'; const lineToCubic = (x1: number, y1: number, x2: number, y2: number) => { const c1 = midPoint([x1, y1], [x2, y2], 1.0 / 3.0); const c2 = midPoint([x1, y1], [x2, y2], 2.0 / 3.0); - return [...c1, ...c2, x2, y2]; + return [c1[0], c1[1], c2[0], c2[1], x2, y2]; }; export default lineToCubic; diff --git a/src/process/normalizePath.ts b/src/process/normalizePath.ts index 66ad58c..37290f2 100644 --- a/src/process/normalizePath.ts +++ b/src/process/normalizePath.ts @@ -1,11 +1,11 @@ import normalizeSegment from './normalizeSegment'; -import type { AbsoluteCommand, NormalArray, PathArray, PointTuple } from '../types'; +import type { NormalArray, PathArray } from '../types'; import iterate from './iterate'; import parsePathString from '../parser/parsePathString'; -import absolutizeSegment from './absolutizeSegment'; +import paramsParser from '../parser/paramsParser'; /** - * Normalizes a `path` object for further processing: + * Normalizes a `pathArray` object for further processing: * * convert segments to absolute values * * convert shorthand path commands to their non-shorthand notation * @@ -13,37 +13,20 @@ import absolutizeSegment from './absolutizeSegment'; * @returns the normalized `pathArray` */ const normalizePath = (pathInput: string | PathArray) => { - let x = 0; - let y = 0; - let mx = 0; - let my = 0; - let pathCommand = 'M'; + const path = parsePathString(pathInput); + const params = { ...paramsParser }; - return iterate(parsePathString(pathInput), (seg, params) => { - const absoluteSegment = absolutizeSegment(seg, params); - const result = normalizeSegment(absoluteSegment, params); - [pathCommand] = result; - const absCommand = pathCommand.toUpperCase() as AbsoluteCommand; + return iterate(path, (seg, _, lastX, lastY) => { + params.x = lastX; + params.y = lastY; + const result = normalizeSegment(seg, params); - if (absCommand === 'Z') { - x = mx; - y = my; - } else { - [x, y] = result.slice(-2) as PointTuple; + const seglen = result.length; + params.x1 = +result[seglen - 2]; + params.y1 = +result[seglen - 1]; + params.x2 = +result[seglen - 4] || params.x1; + params.y2 = +result[seglen - 3] || params.y1; - if (absCommand === 'M') { - mx = x; - my = y; - } - } - - // const seglen = result.length; - // params.x1 = +result[seglen - 2]; - // params.y1 = +result[seglen - 1]; - // params.x2 = +result[seglen - 4] || params.x1; - // params.y2 = +result[seglen - 3] || params.y1; - params.x = x; - params.y = y; return result; }); }; diff --git a/src/process/normalizeSegment.ts b/src/process/normalizeSegment.ts index 0593552..a7b25e2 100644 --- a/src/process/normalizeSegment.ts +++ b/src/process/normalizeSegment.ts @@ -1,46 +1,84 @@ import type { ParserParams } from '../interface'; -import type { NormalSegment, PointTuple, PathSegment, QSegment, CSegment, LSegment } from '../types'; +import type { + NormalSegment, + PointTuple, + PathSegment, + QSegment, + CSegment, + LSegment, + MSegment, + HSegment, + VSegment, + ASegment, + PathCommand, +} from '../types'; /** * Normalizes a single segment of a `pathArray` object. * * @param segment the segment object - * @param params the coordinates of the previous segment + * @param params the normalization parameters * @returns the normalized segment */ const normalizeSegment = (segment: PathSegment, params: ParserParams) => { const [pathCommand] = segment; - const { x1: px1, y1: py1, x2: px2, y2: py2 } = params; - const values = segment.slice(1).map(Number); + const absCommand = pathCommand.toUpperCase(); + const isRelative = pathCommand !== absCommand; + const { x1: px1, y1: py1, x2: px2, y2: py2, x, y } = params; + const values = segment.slice(1) as number[]; + let absValues = values.map((n, j) => n + (isRelative ? (j % 2 ? y : x) : 0)); - if (!'TQ'.includes(pathCommand)) { + if (!'TQ'.includes(absCommand)) { // optional but good to be cautious params.qx = null; params.qy = null; } - if (pathCommand === 'H') { - return ['L', segment[1], py1] as LSegment; - } else if (pathCommand === 'V') { - return ['L', px1, segment[1]] as LSegment; - } else if (pathCommand === 'S') { + // istanbul ignore else @preserve + if (absCommand === 'A') { + absValues = values.slice(0, -2).concat(values[5] + (isRelative ? x : 0), values[6] + (isRelative ? y : 0)); + + return ['A' as PathCommand | number].concat(absValues) as ASegment; + } else if (absCommand === 'H') { + return ['L', (segment as HSegment)[1] + (isRelative ? x : 0), py1] as LSegment; + } else if (absCommand === 'V') { + return ['L', px1, (segment as VSegment)[1] + (isRelative ? y : 0)] as LSegment; + } else if (absCommand === 'L') { + return [ + 'L', + (segment as LSegment)[1] + (isRelative ? x : 0), + (segment as LSegment)[2] + (isRelative ? y : 0), + ] as LSegment; + } else if (absCommand === 'M') { + return [ + 'M', + (segment as MSegment)[1] + (isRelative ? x : 0), + (segment as MSegment)[2] + (isRelative ? y : 0), + ] as MSegment; + } else if (absCommand === 'C') { + return ['C' as PathCommand | number].concat(absValues) as CSegment; + } else if (absCommand === 'S') { const x1 = px1 * 2 - px2; const y1 = py1 * 2 - py2; params.x1 = x1; params.y1 = y1; - return ['C', x1, y1, ...values] as CSegment; - } else if (pathCommand === 'T') { + return ['C', x1, y1].concat(absValues) as CSegment; + } else if (absCommand === 'T') { const qx = px1 * 2 - (params.qx ? params.qx : /* istanbul ignore next */ 0); const qy = py1 * 2 - (params.qy ? params.qy : /* istanbul ignore next */ 0); params.qx = qx; params.qy = qy; - return ['Q', qx, qy, ...values] as QSegment; - } else if (pathCommand === 'Q') { - const [nqx, nqy] = values as PointTuple; + return ['Q', qx, qy].concat(absValues) as QSegment; + } else if (absCommand === 'Q') { + const [nqx, nqy] = absValues as PointTuple; params.qx = nqx; params.qy = nqy; + return ['Q' as PathCommand | number].concat(absValues) as QSegment; + } else if (absCommand === 'Z') { + return ['Z'] as NormalSegment; } + // istanbul ignore next @preserve return segment as NormalSegment; }; export default normalizeSegment; diff --git a/src/process/optimizePath.ts b/src/process/optimizePath.ts index f924f1c..2237b22 100644 --- a/src/process/optimizePath.ts +++ b/src/process/optimizePath.ts @@ -1,10 +1,11 @@ -import roundPath from './roundPath'; import pathToAbsolute from '../convert/pathToAbsolute'; -import pathToRelative from '../convert/pathToRelative'; import shortenSegment from './shortenSegment'; import paramsParser from '../parser/paramsParser'; -import normalizePath from './normalizePath'; -import type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteSegment } from '../types'; +import type { AbsoluteSegment, PathArray, PathCommand } from '../types'; +import iterate from './iterate'; +import normalizeSegment from './normalizeSegment'; +import relativizeSegment from './relativizeSegment'; +import roundSegment from './roundSegment'; /** * Optimizes a `pathArray` object: @@ -12,72 +13,51 @@ import type { PathSegment, HSegment, PathArray, VSegment, PathCommand, AbsoluteS * * select shortest segments from absolute and relative `pathArray`s * * @param pathInput a string or `pathArray` - * @param round the amount of decimals to round values to + * @param roundOption the amount of decimals to round values to * @returns the optimized `pathArray` */ -const optimizePath = (pathInput: PathArray, round: 'off' | number): PathArray => { +const optimizePath = (pathInput: PathArray, roundOption: number) => { const path = pathToAbsolute(pathInput); - const normalPath = normalizePath(path); - const params = { ...paramsParser }; + // allow for ZERO decimals or use an aggressive value of 2 + const round = + typeof roundOption === 'number' && roundOption >= 0 ? roundOption : /* istanbul ignore next @preserve */ 2; + // this utility overrides the iterator params + const optimParams = { ...paramsParser }; + const allPathCommands = [] as PathCommand[]; - const ii = path.length; - let pathCommand = '' as PathCommand; - let prevCommand = '' as PathCommand; - let x = 0; - let y = 0; - let mx = 0; - let my = 0; + let pathCommand = 'M' as PathCommand; + let prevCommand = 'Z' as PathCommand; - for (let i = 0; i < ii; i += 1) { - [pathCommand] = path[i]; + return iterate(path, (seg, i, lastX, lastY) => { + optimParams.x = lastX; + optimParams.y = lastY; + // const absoluteSegment = absolutizeSegment(seg, optimParams); + const normalizedSegment = normalizeSegment(seg, optimParams); + let result = seg; + [pathCommand] = seg; // Save current path command allPathCommands[i] = pathCommand; - // Get previous path command for `shortenSegment` - if (i) prevCommand = allPathCommands[i - 1]; - path[i] = shortenSegment(path[i], normalPath[i], params, prevCommand) as AbsoluteSegment; - - const segment = path[i]; - const seglen = segment.length; - - // update C, S, Q, T specific params - params.x1 = +segment[seglen - 2]; - params.y1 = +segment[seglen - 1]; - params.x2 = +segment[seglen - 4] || params.x1; - params.y2 = +segment[seglen - 3] || params.y1; - - // update x, y params - switch (pathCommand) { - case 'Z': - x = mx; - y = my; - break; - case 'H': - [, x] = segment as HSegment; - break; - case 'V': - [, y] = segment as VSegment; - break; - default: - [x, y] = segment.slice(-2).map(Number); - - if (pathCommand === 'M') { - mx = x; - my = y; - } + if (i) { + // Get previous path command for `shortenSegment` + prevCommand = allPathCommands[i - 1]; + const shortSegment = shortenSegment(seg as AbsoluteSegment, normalizedSegment, optimParams, prevCommand); + const absSegment = roundSegment(shortSegment, round); + const absString = absSegment.join(''); + const relativeSegment = relativizeSegment(shortSegment, i, lastX, lastY); + const relSegment = roundSegment(relativeSegment, round); + const relString = relSegment.join(''); + result = absString.length < relString.length ? absSegment : relSegment; } - params.x = x; - params.y = y; - } - const absolutePath = roundPath(path, round); - const relativePath = roundPath(pathToRelative(path), round); + const seglen = normalizedSegment.length; + optimParams.x1 = +normalizedSegment[seglen - 2]; + optimParams.y1 = +normalizedSegment[seglen - 1]; + optimParams.x2 = +normalizedSegment[seglen - 4] || optimParams.x1; + optimParams.y2 = +normalizedSegment[seglen - 3] || optimParams.y1; - return absolutePath.map((a: PathSegment, i: number) => { - if (i) { - return a.join('').length < relativePath[i].join('').length ? a : relativePath[i]; - } - return a; - }) as PathArray; + return result; + }); }; + export default optimizePath; diff --git a/src/process/projection2d.ts b/src/process/projection2d.ts index 30ba271..e8005ce 100644 --- a/src/process/projection2d.ts +++ b/src/process/projection2d.ts @@ -13,7 +13,7 @@ import { type PointTuple } from '../types'; * @return the resulting Tuple */ const translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [number, number, number, number] => { - let m = CSSMatrix.Translate(...(v.slice(0, -1) as [number, number, number])); + let m = CSSMatrix.Translate(v[0], v[1], v[2]); [, , , m.m44] = v; m = cssm.multiply(m); @@ -37,7 +37,7 @@ const translatePoint = (cssm: CSSMatrix, v: [number, number, number, number]): [ */ const projection2d = (m: CSSMatrix, point2D: PointTuple, origin: [number, number, number]): PointTuple => { const [originX, originY, originZ] = origin; - const [x, y, z] = translatePoint(m, [...point2D, 0, 1]); + const [x, y, z] = translatePoint(m, [point2D[0], point2D[1], 0, 1]); const relativePositionX = x - originX; const relativePositionY = y - originY; diff --git a/src/process/relativizeSegment.ts b/src/process/relativizeSegment.ts index d0896eb..199f90b 100644 --- a/src/process/relativizeSegment.ts +++ b/src/process/relativizeSegment.ts @@ -1,4 +1,3 @@ -import type { ParserParams } from '../interface'; import type { RelativeSegment, RelativeCommand, @@ -10,52 +9,51 @@ import type { tSegment, sSegment, cSegment, + MSegment, + lSegment, } from '../types'; /** * Returns a relative segment of a `PathArray` object. * * @param segment the segment object - * @param params the coordinates of the previous segment * @param index the segment index - * @returns the absolute segment + * @param lastX the last known X value + * @param lastY the last known Y value + * @returns the relative segment */ -const relativizeSegment = (segment: PathSegment, params: ParserParams, index: number) => { +const relativizeSegment = (segment: PathSegment, index: number, lastX: number, lastY: number) => { const [pathCommand] = segment; - const { x, y } = params; - const values = segment.slice(1).map(Number); const relCommand = pathCommand.toLowerCase() as RelativeCommand; - - if (index === 0 && pathCommand === 'M') { - return segment; - } + const isRelative = pathCommand === relCommand; /* istanbul ignore else @preserve */ - if (pathCommand !== relCommand) { - if (relCommand === 'a') { - return [ - relCommand, - values[0], - values[1], - values[2], - values[3], - values[4], - values[5] - x, - values[6] - y, - ] as aSegment; - } else if (relCommand === 'v') { - return [relCommand, values[0] - y] as vSegment; - } else if (relCommand === 'h') { - return [relCommand, values[0] - x] as hSegment; - } else { - // use brakets for `eslint: no-case-declaration` - // https://stackoverflow.com/a/50753272/803358 - const relValues = values.map((n, j) => n - (j % 2 ? y : x)); - // for n, l, c, s, q, t - return [relCommand, ...relValues] as qSegment | tSegment | sSegment | cSegment; - } - } + if (index === 0 || isRelative) return segment as MSegment | RelativeSegment; - return segment as RelativeSegment; + if (relCommand === 'a') { + return [ + relCommand, + segment[1], + segment[2], + segment[3], + segment[4], + segment[5], + (segment as aSegment)[6] - lastX, + (segment as aSegment)[7] - lastY, + ] as aSegment; + } else if (relCommand === 'v') { + return [relCommand, (segment as vSegment)[1] - lastY] as vSegment; + } else if (relCommand === 'h') { + return [relCommand, (segment as hSegment)[1] - lastX] as hSegment; + } else if (relCommand === 'l') { + return [relCommand, (segment as lSegment)[1] - lastX, (segment as lSegment)[2] - lastY] as lSegment; + } else { + // use brakets for `eslint: no-case-declaration` + // https://stackoverflow.com/a/50753272/803358 + const relValues = (segment.slice(1) as number[]).map((n, j) => n - (j % 2 ? lastY : lastX)); + // for c, s, q, t + return [relCommand as RelativeCommand | number].concat(relValues) as qSegment | tSegment | sSegment | cSegment; + } }; + export default relativizeSegment; diff --git a/src/process/reverseCurve.ts b/src/process/reverseCurve.ts index ae03c95..25f181d 100644 --- a/src/process/reverseCurve.ts +++ b/src/process/reverseCurve.ts @@ -1,4 +1,4 @@ -import type { CurveArray } from '../types'; +import type { CSegment, CurveArray, MSegment, PathCommand } from '../types'; /** * Reverses all segments of a `pathArray` @@ -7,15 +7,18 @@ import type { CurveArray } from '../types'; * @param path the source `pathArray` * @returns the reversed `pathArray` */ -const reverseCurve = (path: CurveArray): CurveArray => { +const reverseCurve = (path: CurveArray) => { const rotatedCurve = path .slice(1) .map((x, i, curveOnly) => - !i ? [...path[0].slice(1), ...x.slice(1)] : [...curveOnly[i - 1].slice(-2), ...x.slice(1)], + !i ? path[0].slice(1).concat(x.slice(1) as number[]) : curveOnly[i - 1].slice(-2).concat(x.slice(1)), ) .map(x => x.map((_, i) => x[x.length - i - 2 * (1 - (i % 2))])) - .reverse(); + .reverse() as (MSegment | CSegment)[]; - return [['M', ...rotatedCurve[0].slice(0, 2)], ...rotatedCurve.map(x => ['C', ...x.slice(2)])] as CurveArray; + return [['M' as PathCommand | number].concat(rotatedCurve[0].slice(0, 2))].concat( + rotatedCurve.map(x => ['C' as PathCommand | number].concat(x.slice(2))), + ) as CurveArray; }; + export default reverseCurve; diff --git a/src/process/reversePath.ts b/src/process/reversePath.ts index f3c3430..76074a6 100644 --- a/src/process/reversePath.ts +++ b/src/process/reversePath.ts @@ -5,6 +5,7 @@ import type { MSegment, PathArray, PathSegment, + PointTuple, QSegment, SSegment, TSegment, @@ -12,90 +13,102 @@ import type { } from '../types'; import pathToAbsolute from '../convert/pathToAbsolute'; import normalizePath from './normalizePath'; +import iterate from './iterate'; /** - * Reverses all segments of a `pathArray` and returns a new `pathArray` instance. + * Reverses all segments of a `pathArray` and returns a new `pathArray` instance + * with absolute values. * * @param pathInput the source `pathArray` * @returns the reversed `pathArray` */ -const reversePath = (pathInput: PathArray): PathArray => { +const reversePath = (pathInput: PathArray) => { const absolutePath = pathToAbsolute(pathInput); - const isClosed = absolutePath.slice(-1)[0][0] === 'Z'; + const normalizedPath = normalizePath(absolutePath); + const pLen = absolutePath.length; + const isClosed = absolutePath[pLen - 1][0] === 'Z'; - const reversedPath = normalizePath(absolutePath) - .map((segment, i) => { - const [x, y] = segment.slice(-2).map(Number); - return { - seg: absolutePath[i], // absolute - n: segment, // normalized - c: absolutePath[i][0], // pathCommand - x, // x - y, // y - }; - }) - .map((seg, i, path) => { - const segment = seg.seg; - const data = seg.n; - const prevSeg = i && path[i - 1]; - const nextSeg = path[i + 1]; - const pathCommand = seg.c; - const pLen = path.length; - const x = i ? path[i - 1].x : path[pLen - 1].x; - const y = i ? path[i - 1].y : path[pLen - 1].y; - let result = []; + const reversedPath = iterate(absolutePath, (segment, i) => { + const normalizedSegment = normalizedPath[i]; + const prevSeg = i && absolutePath[i - 1]; + const prevCommand = prevSeg && prevSeg[0]; + const nextSeg = absolutePath[i + 1]; + const nextCommand = nextSeg && nextSeg[0]; + const [pathCommand] = segment; + const [x, y] = normalizedPath[i ? i - 1 : pLen - 1].slice(-2) as PointTuple; + let result = segment; - switch (pathCommand) { - case 'M': - result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment; - break; - case 'A': - result = [pathCommand, ...segment.slice(1, -3), segment[5] === 1 ? 0 : 1, x, y] as ASegment; - break; - case 'C': - if (nextSeg && nextSeg.c === 'S') { - result = ['S', segment[1], segment[2], x, y] as SSegment; - } else { - result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment; - } - break; - case 'S': - if (prevSeg && 'CS'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'S')) { - result = ['C', data[3], data[4], data[1], data[2], x, y] as CSegment; - } else { - result = [pathCommand, data[1], data[2], x, y] as SSegment; - } - break; - case 'Q': - if (nextSeg && nextSeg.c === 'T') { - result = ['T', x, y] as TSegment; - } else { - result = [pathCommand, ...segment.slice(1, -2), x, y] as QSegment; - } - break; - case 'T': - if (prevSeg && 'QT'.includes(prevSeg.c) && (!nextSeg || nextSeg.c !== 'T')) { - result = ['Q', data[1], data[2], x, y] as QSegment; - } else { - result = [pathCommand, x, y] as TSegment; - } - break; - case 'Z': - result = ['M', x, y] as MSegment; - break; - case 'H': - result = [pathCommand, x] as HSegment; - break; - case 'V': - result = [pathCommand, y] as VSegment; - break; - default: - result = [pathCommand, ...segment.slice(1, -2), x, y] as PathSegment; - } + switch (pathCommand) { + case 'M': + result = (isClosed ? ['Z'] : [pathCommand, x, y]) as PathSegment; + break; + case 'A': + result = [ + pathCommand, + segment[1], + segment[2], + segment[3], + segment[4], + segment[5] === 1 ? 0 : 1, + x, + y, + ] as ASegment; + break; + case 'C': + if (nextSeg && nextCommand === 'S') { + result = ['S', segment[1], segment[2], x, y] as SSegment; + } else { + result = [pathCommand, segment[3], segment[4], segment[1], segment[2], x, y] as CSegment; + } + break; + case 'S': + if (prevCommand && 'CS'.includes(prevCommand) && (!nextSeg || nextCommand !== 'S')) { + result = [ + 'C', + normalizedSegment[3], + normalizedSegment[4], + normalizedSegment[1], + normalizedSegment[2], + x, + y, + ] as CSegment; + } else { + result = [pathCommand, normalizedSegment[1], normalizedSegment[2], x, y] as SSegment; + } + break; + case 'Q': + if (nextSeg && nextCommand === 'T') { + result = ['T', x, y] as TSegment; + } else { + result = [pathCommand, segment[1], segment[2], x, y] as QSegment; + } + break; + case 'T': + if (prevCommand && 'QT'.includes(prevCommand) && (!nextSeg || nextCommand !== 'T')) { + result = ['Q', normalizedSegment[1], normalizedSegment[2], x, y] as QSegment; + } else { + result = [pathCommand, x, y] as TSegment; + } + break; + case 'Z': + result = ['M', x, y] as MSegment; + break; + case 'H': + result = [pathCommand, x] as HSegment; + break; + case 'V': + result = [pathCommand, y] as VSegment; + break; + default: + result = [pathCommand as typeof pathCommand | number].concat(segment.slice(1, -2), x, y) as PathSegment; + } - return result; - }); + return result; + }); - return (isClosed ? reversedPath.reverse() : [reversedPath[0], ...reversedPath.slice(1).reverse()]) as PathArray; + return ( + isClosed ? reversedPath.reverse() : [reversedPath[0] as PathSegment].concat(reversedPath.slice(1).reverse()) + ) as PathArray; }; + export default reversePath; diff --git a/src/process/roundPath.ts b/src/process/roundPath.ts index 829deb6..fc95a2b 100644 --- a/src/process/roundPath.ts +++ b/src/process/roundPath.ts @@ -1,6 +1,7 @@ -import type { PathArray, PathSegment } from '../types'; +import type { PathArray } from '../types'; import defaultOptions from '../options/options'; import iterate from './iterate'; +import roundSegment from './roundSegment'; /** * Rounds the values of a `pathArray` instance to @@ -12,16 +13,21 @@ import iterate from './iterate'; */ const roundPath = (path: PathArray, roundOption?: number | 'off') => { let { round } = defaultOptions; - if (roundOption === 'off' || round === 'off') return path.slice(0) as PathArray; // allow for ZERO decimals - round = typeof roundOption === 'number' && roundOption >= 0 ? roundOption : round; - // to round values to the power - // the `round` value must be integer - const pow = typeof round === 'number' && round >= 1 ? 10 ** round : 1; + round = + roundOption === 'off' + ? roundOption + : typeof roundOption === 'number' && roundOption >= 0 + ? roundOption + : typeof round === 'number' && round >= 0 + ? round + : /* istanbul ignore next @preserve */ 'off'; + + /* istanbul ignore else @preserve */ + if (round === 'off') return path.slice(0) as PathArray; return iterate(path, segment => { - const values = (segment.slice(1) as number[]).map(n => (round ? Math.round(n * pow) / pow : Math.round(n))); - return [segment[0], ...values] as PathSegment; + return roundSegment(segment, round); }); }; export default roundPath; diff --git a/src/process/roundSegment.ts b/src/process/roundSegment.ts new file mode 100644 index 0000000..ea00254 --- /dev/null +++ b/src/process/roundSegment.ts @@ -0,0 +1,9 @@ +import type { PathCommand, PathSegment } from '../types'; +import roundTo from '../math/roundTo'; + +const roundSegment = (segment: T, roundOption: number) => { + const values = (segment.slice(1) as number[]).map(n => roundTo(n, roundOption)); + return [segment[0] as PathCommand | number].concat(values) as T; +}; + +export default roundSegment; diff --git a/src/process/segmentToCubic.ts b/src/process/segmentToCubic.ts index c0ac545..231a428 100644 --- a/src/process/segmentToCubic.ts +++ b/src/process/segmentToCubic.ts @@ -15,7 +15,7 @@ const segmentToCubic = (segment: PathSegment, params: ParserParams) => { const [pathCommand] = segment; const values = segment.slice(1).map(Number); const [x, y] = values; - let args; + // let args; const { x1: px1, y1: py1, x: px, y: py } = params; if (!'TQ'.includes(pathCommand)) { @@ -28,17 +28,19 @@ const segmentToCubic = (segment: PathSegment, params: ParserParams) => { params.y = y; return segment; } else if (pathCommand === 'A') { - args = [px1, py1, ...values] as [number, number, number, number, number, number, number, number, number]; - return ['C', ...arcToCubic(...args)] as CSegment; + return ['C' as string | number].concat( + arcToCubic(px1, py1, values[0], values[1], values[2], values[3], values[4], values[5], values[6]), + ) as CSegment; } else if (pathCommand === 'Q') { params.qx = x; params.qy = y; - args = [px1, py1, ...values] as [number, number, number, number, number, number]; - return ['C', ...quadToCubic(...args)] as CSegment; + return ['C' as string | number].concat( + quadToCubic(px1, py1, values[0], values[1], values[2], values[3]), + ) as CSegment; } else if (pathCommand === 'L') { - return ['C', ...lineToCubic(px1, py1, x, y)] as CSegment; + return ['C' as string | number].concat(lineToCubic(px1, py1, x, y)) as CSegment; } else if (pathCommand === 'Z') { - return ['C', ...lineToCubic(px1, py1, px, py)] as CSegment; + return ['C' as string | number].concat(lineToCubic(px1, py1, px, py)) as CSegment; } return segment as MSegment | CSegment; diff --git a/src/process/shortenSegment.ts b/src/process/shortenSegment.ts index 6f33ed4..4ab3c17 100644 --- a/src/process/shortenSegment.ts +++ b/src/process/shortenSegment.ts @@ -1,15 +1,7 @@ +import defaultOptions from '../options/options'; import type { ParserParams } from '../interface'; -import type { - AbsoluteSegment, - HSegment, - NormalSegment, - PathCommand, - ShortSegment, - SSegment, - TSegment, - VSegment, - ZSegment, -} from '../types'; +import roundTo from '../math/roundTo'; +import type { AbsoluteSegment, NormalSegment, PathCommand, ShortSegment, SSegment, TSegment } from '../types'; /** * Shorten a single segment of a `pathArray` object. @@ -27,12 +19,12 @@ const shortenSegment = ( prevCommand: PathCommand, ): ShortSegment => { const [pathCommand] = segment; - const round4 = (n: number) => Math.round(n * 10 ** 4) / 10 ** 4; - const segmentValues = segment.slice(1) as number[]; + const { round: defaultRound } = defaultOptions; + const round = typeof defaultRound === 'number' ? defaultRound : /* istanbul ignore next */ 4; const normalValues = normalSegment.slice(1) as number[]; - const { x1: px1, y1: py1, x2: px2, y2: py2, x: px, y: py } = params; - let result = segment; - const [x, y] = normalValues.slice(-2); + const { x1, y1, x2, y2, x, y } = params; + const [nx, ny] = normalValues.slice(-2); + const result = segment; if (!'TQ'.includes(pathCommand)) { // optional but good to be cautious @@ -40,26 +32,24 @@ const shortenSegment = ( params.qy = null; } - if (['V', 'H', 'S', 'T', 'Z'].includes(pathCommand)) { - result = [pathCommand, ...segmentValues] as VSegment | HSegment | SSegment | TSegment | ZSegment; - } else if (pathCommand === 'L') { - if (round4(px) === round4(x)) { - result = ['V', y]; - } else if (round4(py) === round4(y)) { - result = ['H', x]; + if (pathCommand === 'L') { + if (roundTo(x, round) === roundTo(nx, round)) { + return ['V', ny]; + } else if (roundTo(y, round) === roundTo(ny, round)) { + return ['H', nx]; } } else if (pathCommand === 'C') { - const [x1, y1] = normalValues; + const [nx1, ny1] = normalValues; + params.x1 = nx1; + params.y1 = ny1; if ( 'CS'.includes(prevCommand) && - ((round4(x1) === round4(px1 * 2 - px2) && round4(y1) === round4(py1 * 2 - py2)) || - (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py))) + ((roundTo(nx1, round) === roundTo(x1 * 2 - x2, round) && roundTo(ny1, round) === roundTo(y1 * 2 - y2, round)) || + (roundTo(x1, round) === roundTo(x2 * 2 - x, round) && roundTo(y1, round) === roundTo(y2 * 2 - y, round))) ) { - result = ['S', ...normalValues.slice(-4)] as SSegment; + return ['S', normalValues[2], normalValues[3], normalValues[4], normalValues[5]] as SSegment; } - params.x1 = x1; - params.y1 = y1; } else if (pathCommand === 'Q') { const [qx, qy] = normalValues; params.qx = qx; @@ -67,13 +57,15 @@ const shortenSegment = ( if ( 'QT'.includes(prevCommand) && - ((round4(qx) === round4(px1 * 2 - px2) && round4(qy) === round4(py1 * 2 - py2)) || - (round4(px1) === round4(px2 * 2 - px) && round4(py1) === round4(py2 * 2 - py))) + roundTo(qx, round) === roundTo(x1 * 2 - x2, round) && + roundTo(qy, round) === roundTo(y1 * 2 - y2, round) ) { - result = ['T', ...normalValues.slice(-2)] as TSegment; + return ['T', normalValues[2], normalValues[3]] as TSegment; } } + // ['V', 'H', 'S', 'T', 'Z'].includes(pathCommand) return result as ShortSegment; }; + export default shortenSegment; diff --git a/src/process/splitCubic.ts b/src/process/splitCubic.ts index 72e1557..ff7bfce 100644 --- a/src/process/splitCubic.ts +++ b/src/process/splitCubic.ts @@ -22,8 +22,8 @@ const splitCubic = (pts: number[], ratio = 0.5): [CubicSegment, CubicSegment] => const p9 = midPoint(p7, p8, t); return [ - ['C', ...p4, ...p7, ...p9], - ['C', ...p8, ...p6, ...p3], + ['C', p4[0], p4[1], p7[0], p7[1], p9[0], p9[1]], + ['C', p8[0], p8[1], p6[0], p6[1], p3[0], p3[1]], ]; }; export default splitCubic; diff --git a/src/process/transformPath.ts b/src/process/transformPath.ts index 921d6fb..06ab285 100644 --- a/src/process/transformPath.ts +++ b/src/process/transformPath.ts @@ -1,14 +1,14 @@ import getSVGMatrix from './getSVGMatrix'; import projection2d from './projection2d'; import defaultOptions from '../options/options'; -import type { AbsoluteArray, CSegment, PathArray, PointTuple, TransformObjectValues } from '../types'; +import type { AbsoluteArray, AbsoluteSegment, CSegment, LSegment, PathArray, TransformObjectValues } from '../types'; import type { TransformObject } from '../interface'; import iterate from './iterate'; import parsePathString from '../parser/parsePathString'; -import absolutizeSegment from './absolutizeSegment'; import segmentToCubic from './segmentToCubic'; import normalizeSegment from './normalizeSegment'; import paramsParser from '../parser/paramsParser'; +import absolutizeSegment from './absolutizeSegment'; /** * Apply a 2D / 3D transformation to a `pathArray` instance. @@ -21,16 +21,15 @@ import paramsParser from '../parser/paramsParser'; * @returns the resulted `pathArray` */ const transformPath = (pathInput: PathArray | string, transform?: Partial) => { + // last x and y transformed values let x = 0; let y = 0; - let mx = 0; - let my = 0; + // new x and y transformed let lx = 0; let ly = 0; + // segment params iteration index and length let j = 0; let jj = 0; - let nx = 0; - let ny = 0; let pathCommand = 'M'; // transform uses it's own set of params const transformParams = { ...paramsParser }; @@ -38,7 +37,7 @@ const transformPath = (pathInput: PathArray | string, transform?: Partial(path, (seg, _, i) => { - const absSegment = absolutizeSegment(seg, transformParams); - [pathCommand] = absSegment; + return iterate(path, (seg, index, lastX, lastY) => { + transformParams.x = lastX; + transformParams.y = lastY; + [pathCommand] = seg; + const absCommand = pathCommand.toUpperCase(); + const isRelative = absCommand !== pathCommand; + const absoluteSegment = isRelative + ? absolutizeSegment(seg, index, lastX, lastY) + : (seg.slice(0) as AbsoluteSegment); let result = - pathCommand === 'A' - ? segmentToCubic(absSegment, transformParams) - : ['V', 'H'].includes(pathCommand) - ? normalizeSegment(absSegment, transformParams) - : absSegment; - const isLongArc = result[0] === 'C' && result.length > 7; - const normalizedSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as typeof result; + absCommand === 'A' + ? segmentToCubic(absoluteSegment, transformParams) + : ['V', 'H'].includes(absCommand) + ? normalizeSegment(absoluteSegment, transformParams) + : absoluteSegment; + + // update pathCommand + pathCommand = result[0]; + const isLongArc = pathCommand === 'C' && result.length > 7; + const tempSegment = (isLongArc ? result.slice(0, 7) : result.slice(0)) as AbsoluteSegment; if (isLongArc) { - path.splice(i + 1, 0, ['C', ...result.slice(7)] as CSegment); - result = result.slice(0, 7) as CSegment; + path.splice(index + 1, 0, ['C' as typeof pathCommand | number].concat(result.slice(7)) as CSegment); + result = tempSegment as CSegment; } - if (result[0] === 'L') { - const values = result.slice(-2) as PointTuple; - [lx, ly] = projection2d(matrixInstance, values, origin); + if (pathCommand === 'L') { + [lx, ly] = projection2d(matrixInstance, [(result as LSegment)[1], (result as LSegment)[2]], origin); /* istanbul ignore else @preserve */ if (x !== lx && y !== ly) { @@ -90,24 +97,12 @@ const transformPath = (pathInput: PathArray | string, transform?: Partial Point; -export type IteratorCallback = (segment: PathSegment, params: ParserParams, index: number) => PathSegment; +export type IteratorCallback = ( + segment: PathSegment, + index: number, + lastX: number, + lastY: number, +) => PathSegment | false | void | undefined; diff --git a/src/util/getPathArea.ts b/src/util/getPathArea.ts index fa7b2ac..dad9313 100644 --- a/src/util/getPathArea.ts +++ b/src/util/getPathArea.ts @@ -1,5 +1,5 @@ import pathToCurve from '../convert/pathToCurve'; -import type { PointTuple, PathArray, QuadCoordinates } from '../types'; +import type { PointTuple, PathArray } from '../types'; /** * Returns the area of a single cubic-bezier segment. @@ -60,7 +60,7 @@ const getPathArea = (path: PathArray) => { [, x, y] = seg; return 0; default: - len = getCubicSegArea(x, y, ...(seg.slice(1) as QuadCoordinates)); + len = getCubicSegArea(x, y, seg[1], seg[2], seg[3], seg[4], seg[5], seg[6]); [x, y] = seg.slice(-2) as PointTuple; return len; } diff --git a/src/util/getPathBBox.ts b/src/util/getPathBBox.ts index 047aadc..e4748d6 100644 --- a/src/util/getPathBBox.ts +++ b/src/util/getPathBBox.ts @@ -1,23 +1,13 @@ import iterate from '../process/iterate'; import { PathBBox } from '../interface'; -import { - ArcCoordinates, - CubicCoordinates, - LineCoordinates, - MSegment, - PathArray, - Point, - PointTuple, - QuadCoordinates, -} from '../types'; -// import pathFactory from './pathFactory'; -import absolutizeSegment from '../process/absolutizeSegment'; -import normalizeSegment from '../process/normalizeSegment'; -import parsePathString from '../parser/parsePathString'; +import { MSegment, PathArray, Point } from '../types'; import { getLineBBox } from '../math/lineTools'; import { getArcBBox } from '../math/arcTools'; import { getCubicBBox } from '../math/cubicTools'; import { getQuadBBox } from '../math/quadTools'; +import parsePathString from '../parser/parsePathString'; +import paramsParser from '../parser/paramsParser'; +import normalizeSegment from '../process/normalizeSegment'; const getPathBBox = (pathInput: PathArray | string) => { if (!pathInput) { @@ -37,58 +27,51 @@ const getPathBBox = (pathInput: PathArray | string) => { const path = parsePathString(pathInput); let data = [] as number[]; let pathCommand = 'M'; - let x = 0; - let y = 0; + const x = 0; + const y = 0; let mx = 0; let my = 0; const MIN = [] as Point[]; const MAX = [] as Point[]; let min = { x, y }; let max = { x, y }; + const params = { ...paramsParser }; - iterate(path, (seg, params) => { - const absoluteSegment = absolutizeSegment(seg, params); - const normalSegment = normalizeSegment(absoluteSegment, params); - [pathCommand] = normalSegment; - data = [x, y, ...normalSegment.slice(1)] as number[]; + iterate(path, (seg, _, lastX, lastY) => { + params.x = lastX; + params.y = lastY; + const result = normalizeSegment(seg, params); + [pathCommand] = result; + data = [lastX, lastY].concat(result.slice(1) as number[]); // this segment is always ZERO /* istanbul ignore else @preserve */ if (pathCommand === 'M') { // remember mx, my for Z - [, mx, my] = normalSegment as MSegment; + [, mx, my] = result as MSegment; min = { x: mx, y: my }; max = { x: mx, y: my }; } else if (pathCommand === 'L') { - ({ min, max } = getLineBBox(...(data as LineCoordinates))); + ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3])); } else if (pathCommand === 'A') { - ({ min, max } = getArcBBox(...(data as ArcCoordinates))); + ({ min, max } = getArcBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8])); } else if (pathCommand === 'C') { - ({ min, max } = getCubicBBox(...(data as CubicCoordinates))); + ({ min, max } = getCubicBBox(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7])); } else if (pathCommand === 'Q') { - ({ min, max } = getQuadBBox(...(data as QuadCoordinates))); + ({ min, max } = getQuadBBox(data[0], data[1], data[2], data[3], data[4], data[5])); } else if (pathCommand === 'Z') { - data = [x, y, mx, my]; - ({ min, max } = getLineBBox(...(data as LineCoordinates))); + data = [lastX, lastY, mx, my]; + ({ min, max } = getLineBBox(data[0], data[1], data[2], data[3])); } MIN.push(min); MAX.push(max); - if (pathCommand === 'Z') { - x = mx; - y = my; - } else { - [x, y] = normalSegment.slice(-2) as PointTuple; - - if (pathCommand === 'M') { - mx = x; - my = y; - } - } - params.x = x; - params.y = y; - return normalSegment; + const seglen = result.length; + params.x1 = +result[seglen - 2]; + params.y1 = +result[seglen - 1]; + params.x2 = +result[seglen - 4] || params.x1; + params.y2 = +result[seglen - 3] || params.y1; }); const xMin = Math.min(...MIN.map(n => n.x)); diff --git a/src/util/getPointAtLength.ts b/src/util/getPointAtLength.ts index 4a32380..85accfc 100644 --- a/src/util/getPointAtLength.ts +++ b/src/util/getPointAtLength.ts @@ -1,21 +1,11 @@ import DISTANCE_EPSILON from './distanceEpsilon'; -import parsePathString from '../parser/parsePathString'; -import type { - ArcCoordinates, - CubicCoordinates, - LineCoordinates, - MSegment, - PathArray, - PointTuple, - QuadCoordinates, -} from '../types'; +import type { MSegment, PathArray, PointTuple } from '../types'; import iterate from '../process/iterate'; -import absolutizeSegment from '../process/absolutizeSegment'; -import normalizeSegment from '../process/normalizeSegment'; import { getLineLength, getPointAtLineLength } from '../math/lineTools'; import { getArcLength, getPointAtArcLength } from '../math/arcTools'; import { getCubicLength, getPointAtCubicLength } from '../math/cubicTools'; import { getQuadLength, getPointAtQuadLength } from '../math/quadTools'; +import normalizePath from '../process/normalizePath'; /** * Returns [x,y] coordinates of a point at a given length of a shape. @@ -25,7 +15,7 @@ import { getQuadLength, getPointAtQuadLength } from '../math/quadTools'; * @returns the requested {x, y} point coordinates */ const getPointAtLength = (pathInput: string | PathArray, distance?: number) => { - const path = parsePathString(pathInput); + const path = normalizePath(pathInput); let isM = false; let data = [] as number[]; let pathCommand = 'M'; @@ -38,18 +28,13 @@ const getPointAtLength = (pathInput: string | PathArray, distance?: number) => { let POINT = point; let totalLength = 0; - if (!distanceIsNumber) return point; + if (!distanceIsNumber || distance < DISTANCE_EPSILON) return point; - if (distance < DISTANCE_EPSILON) { - POINT = point; - } - - iterate(path, (seg, params) => { - const absoluteSegment = absolutizeSegment(seg, params); - const normalSegment = normalizeSegment(absoluteSegment, params); - [pathCommand] = normalSegment; + // for (let i = 0; i < pathLen; i += 1) { + iterate(path, (seg, _, lastX, lastY) => { + [pathCommand] = seg; isM = pathCommand === 'M'; - data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data; + data = !isM ? [lastX, lastY].concat(seg.slice(1) as number[]) : data; // this segment is always ZERO /* istanbul ignore else @preserve */ @@ -59,50 +44,67 @@ const getPointAtLength = (pathInput: string | PathArray, distance?: number) => { point = { x: mx, y: my }; length = 0; } else if (pathCommand === 'L') { - point = getPointAtLineLength(...(data as LineCoordinates), distance - totalLength); - length = getLineLength(...(data as LineCoordinates)); + point = getPointAtLineLength(data[0], data[1], data[2], data[3], distance - totalLength); + length = getLineLength(data[0], data[1], data[2], data[3]); } else if (pathCommand === 'A') { - point = getPointAtArcLength(...(data as ArcCoordinates), distance - totalLength); - length = getArcLength(...(data as ArcCoordinates)); + point = getPointAtArcLength( + data[0], + data[1], + data[2], + data[3], + data[4], + data[5], + data[6], + data[7], + data[8], + distance - totalLength, + ); + length = getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]); } else if (pathCommand === 'C') { - point = getPointAtCubicLength(...(data as CubicCoordinates), distance - totalLength); - length = getCubicLength(...(data as CubicCoordinates)); + point = getPointAtCubicLength( + data[0], + data[1], + data[2], + data[3], + data[4], + data[5], + data[6], + data[7], + distance - totalLength, + ); + length = getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); } else if (pathCommand === 'Q') { - point = getPointAtQuadLength(...(data as QuadCoordinates), distance - totalLength); - length = getQuadLength(...(data as QuadCoordinates)); + point = getPointAtQuadLength(data[0], data[1], data[2], data[3], data[4], data[5], distance - totalLength); + length = getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]); } else if (pathCommand === 'Z') { - data = [x, y, mx, my]; + data = [lastX, lastY, mx, my]; point = { x: mx, y: my }; - length = getLineLength(...(data as LineCoordinates)); + + length = getLineLength(data[0], data[1], data[2], data[3]); } - if (totalLength < distance && totalLength + length >= distance) { + [x, y] = data.slice(-2); + + if (totalLength < distance) { POINT = point; + } else { + // totalLength >= distance + // stop right here + // stop iterator now! + return false; } totalLength += length; - if (pathCommand === 'Z') { - x = mx; - y = my; - } else { - [x, y] = normalSegment.slice(-2) as PointTuple; - - if (pathCommand === 'M') { - mx = x; - my = y; - } - } - params.x = x; - params.y = y; - return normalSegment; + return; }); // native `getPointAtLength` behavior when the given distance // is higher than total length if (distance > totalLength - DISTANCE_EPSILON) { - POINT = { x, y }; + return { x, y }; } return POINT; }; + export default getPointAtLength; diff --git a/src/util/getPropertiesAtLength.ts b/src/util/getPropertiesAtLength.ts index 4827d9e..ed8d57f 100644 --- a/src/util/getPropertiesAtLength.ts +++ b/src/util/getPropertiesAtLength.ts @@ -1,4 +1,4 @@ -import type { PointTuple, PathArray, PathSegment } from '../types'; +import type { PathArray, PathSegment } from '../types'; import type { SegmentProperties } from '../interface'; import parsePathString from '../parser/parsePathString'; import getTotalLength from './getTotalLength'; @@ -20,8 +20,6 @@ const getPropertiesAtLength = (pathInput: string | PathArray, distance?: number) let lengthAtSegment = 0; let length = 0; let segment = pathArray[0] as PathSegment; - const [x, y] = segment.slice(-2) as PointTuple; - const point = { x, y }; // If the path is empty, return 0. if (index <= 0 || !distance || !Number.isFinite(distance)) { @@ -29,7 +27,6 @@ const getPropertiesAtLength = (pathInput: string | PathArray, distance?: number) segment, index: 0, length, - point, lengthAtSegment, }; } @@ -38,8 +35,9 @@ const getPropertiesAtLength = (pathInput: string | PathArray, distance?: number) pathTemp = pathArray.slice(0, -1) as PathArray; lengthAtSegment = getTotalLength(pathTemp); length = pathLength - lengthAtSegment; + segment = pathArray[index]; return { - segment: pathArray[index], + segment, index, length, lengthAtSegment, @@ -53,6 +51,7 @@ const getPropertiesAtLength = (pathInput: string | PathArray, distance?: number) lengthAtSegment = getTotalLength(pathTemp); length = pathLength - lengthAtSegment; pathLength = lengthAtSegment; + segments.push({ segment, index, diff --git a/src/util/getPropertiesAtPoint.ts b/src/util/getPropertiesAtPoint.ts index 475fe2f..1caeeb2 100644 --- a/src/util/getPropertiesAtPoint.ts +++ b/src/util/getPropertiesAtPoint.ts @@ -1,4 +1,4 @@ -import type { PathArray } from '../types'; +import type { PathArray, Point } from '../types'; import type { PointProperties } from '../interface'; import getPointAtLength from './getPointAtLength'; import getPropertiesAtLength from './getPropertiesAtLength'; @@ -16,17 +16,17 @@ import normalizePath from '../process/normalizePath'; * @param point the given point * @returns the requested properties */ -const getPropertiesAtPoint = (pathInput: string | PathArray, point: { x: number; y: number }): PointProperties => { +const getPropertiesAtPoint = (pathInput: string | PathArray, point: Point): PointProperties => { const path = parsePathString(pathInput); const normalPath = normalizePath(path); - const pathLength = getTotalLength(path); - const distanceTo = (p: { x: number; y: number }) => { + const pathLength = getTotalLength(normalPath); + const distanceTo = (p: Point) => { const dx = p.x - point.x; const dy = p.y - point.y; return dx * dx + dy * dy; }; let precision = 8; - let scan: { x: number; y: number }; + let scan: Point; let closest = { x: 0, y: 0 }; // make TS happy let scanDistance = 0; let bestLength = 0; diff --git a/src/util/getTotalLength.ts b/src/util/getTotalLength.ts index 9da0e98..efb3677 100644 --- a/src/util/getTotalLength.ts +++ b/src/util/getTotalLength.ts @@ -1,21 +1,13 @@ -import parsePathString from '../parser/parsePathString'; -import type { - ArcCoordinates, - CubicCoordinates, - LineCoordinates, - MSegment, - PathArray, - PointTuple, - QuadCoordinates, -} from '../types'; +import type { MSegment, PathArray } from '../types'; import { getLineLength } from '../math/lineTools'; import { getArcLength } from '../math/arcTools'; import { getCubicLength } from '../math/cubicTools'; import { getQuadLength } from '../math/quadTools'; import iterate from '../process/iterate'; -import absolutizeSegment from '../process/absolutizeSegment'; +// import normalizePath from '../process/normalizePath'; +import parsePathString from '../parser/parsePathString'; +import paramsParser from '../parser/paramsParser'; import normalizeSegment from '../process/normalizeSegment'; -// import pathFactory from './pathFactory'; /** * Returns the shape total length, or the equivalent to `shape.getTotalLength()`. @@ -28,53 +20,46 @@ import normalizeSegment from '../process/normalizeSegment'; */ const getTotalLength = (pathInput: string | PathArray) => { const path = parsePathString(pathInput); + const params = { ...paramsParser }; + let isM = false; let data = [] as number[]; let pathCommand = 'M'; - let x = 0; - let y = 0; let mx = 0; let my = 0; let totalLength = 0; - iterate(path, (seg, params) => { - const absoluteSegment = absolutizeSegment(seg, params); - const normalSegment = normalizeSegment(absoluteSegment, params); + iterate(path, (seg, _, lastX, lastY) => { + params.x = lastX; + params.y = lastY; + const normalSegment = normalizeSegment(seg, params); [pathCommand] = normalSegment; isM = pathCommand === 'M'; - data = !isM ? [x, y, ...(normalSegment.slice(1) as number[])] : data; + data = !isM ? [lastX, lastY].concat(normalSegment.slice(1) as number[]) : data; // this segment is always ZERO /* istanbul ignore else @preserve */ if (isM) { // remember mx, my for Z - [, mx, my] = seg as MSegment; + [, mx, my] = normalSegment as MSegment; } else if (pathCommand === 'L') { - totalLength += getLineLength(...(data as LineCoordinates)); + totalLength += getLineLength(data[0], data[1], data[2], data[3]); } else if (pathCommand === 'A') { - totalLength += getArcLength(...(data as ArcCoordinates)); + totalLength += getArcLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7], data[8]); } else if (pathCommand === 'C') { - totalLength += getCubicLength(...(data as CubicCoordinates)); + totalLength += getCubicLength(data[0], data[1], data[2], data[3], data[4], data[5], data[6], data[7]); } else if (pathCommand === 'Q') { - totalLength += getQuadLength(...(data as QuadCoordinates)); + totalLength += getQuadLength(data[0], data[1], data[2], data[3], data[4], data[5]); } else if (pathCommand === 'Z') { - data = [x, y, mx, my]; - totalLength += getLineLength(...(data as LineCoordinates)); + data = [lastX, lastY, mx, my]; + totalLength += getLineLength(data[0], data[1], data[2], data[3]); } - if (pathCommand === 'Z') { - x = mx; - y = my; - } else { - [x, y] = normalSegment.slice(-2) as PointTuple; - if (isM) { - mx = x; - my = y; - } - } - params.x = x; - params.y = y; - return normalSegment; + const seglen = normalSegment.length; + params.x1 = +normalSegment[seglen - 2]; + params.y1 = +normalSegment[seglen - 1]; + params.x2 = +normalSegment[seglen - 4] || params.x1; + params.y2 = +normalSegment[seglen - 3] || params.y1; }); return totalLength; diff --git a/test/class.test.ts b/test/class.test.ts index 2dec2b0..6b41609 100644 --- a/test/class.test.ts +++ b/test/class.test.ts @@ -283,6 +283,8 @@ a1.63 1.63 0 0 0 -0.906 0.274a1.63 1.63 0 0 0 -0.601 0.73a1.63 1.63 0 0 0 -0.094 path.setAttribute('d', rect.toString()); expect(path.getAttribute('d')).to.equal('M2 0A2 2 0 0 0 0 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2V2A2 2 0 0 0 14 0H2z'); + // add at least one round: 'off' test + expect(new SVGPathCommander(simpleShapes.normalized[2], { round: 'off' }).optimize().toString()).to.equal(simpleShapes.initial[2]); }); it('Test reverse single path', async () => { diff --git a/test/fixtures/shapes.js b/test/fixtures/shapes.js index a9ebc11..9d6e152 100644 --- a/test/fixtures/shapes.js +++ b/test/fixtures/shapes.js @@ -20,12 +20,12 @@ const shapes = { "M8.66 8.66L8.66 4.66L7.34 4.66L7.34 8.66L8.65 8.66ZM8.66 11.34L8.66 10L7.34 10L7.34 11.34L8.65 11.34ZM8 1.34Q10.75 1.34 12.7 3.29Q14.65 5.24 14.66 8Q14.67 10.76 12.71 12.7Q10.75 14.64 8 14.66Q5.25 14.68 3.3 12.7Q1.35 10.72 1.34 8Q1.33 5.28 3.3 3.3Q5.27 1.32 8 1.34Z" ], optimized: [ - "M16 8C16 4.13 12.42 1 8 1S0 4.13 0 8c0 1.76 0.74 3.37 1.97 4.6c-0.1 1.02 -0.42 2.13 -0.77 2.97c-0.08 0.18 0.07 0.39 0.27 0.36c2.26 -0.37 3.6 -0.94 4.18 -1.24A9.06 9.06 0 0 0 8 15c4.42 0 8 -3.13 8 -7zM7.19 6.77c0.09 0.12 0.17 0.26 0.23 0.4c0.43 0.94 0.39 2.37 -0.94 3.7a0.45 0.45 0 0 1 -0.61 0.01A0.41 0.41 0 0 1 5.86 10.29C6.27 9.88 6.53 9.46 6.67 9.07C6.4 9.24 6.08 9.33 5.74 9.33C4.78 9.33 4 8.59 4 7.67S4.78 6 5.73 6c0.28 0 0.53 0.06 0.76 0.17l0.01 0c0.17 0.07 0.32 0.18 0.47 0.32c0.08 0.09 0.16 0.18 0.22 0.28zM11 9.07c-0.27 0.17 -0.59 0.26 -0.93 0.26C9.11 9.33 8.34 8.59 8.34 7.67S9.11 6 10.07 6c0.27 0 0.53 0.06 0.75 0.17l0.01 0C11 6.24 11.16 6.35 11.3 6.49c0.09 0.09 0.16 0.18 0.23 0.27c0.08 0.13 0.16 0.26 0.22 0.4c0.43 0.95 0.4 2.38 -0.94 3.71a0.45 0.45 0 0 1 -0.61 0.01a0.41 0.41 0 0 1 -0.01 -0.59C10.61 9.87 10.86 9.46 11 9.07z", - "M16 14V5H0v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2zM2.56 12.33H1.85L3.75 7h0.69l1.9 5.33H5.62l-0.54 -1.6H3.1l-0.54 1.6zM4.1 7.81H4.08l-0.8 2.37H4.9L4.1 7.81zm5.75 0.42v4.1H9.18v-0.54H9.16C9.01 12.12 8.62 12.4 7.97 12.4c-0.85 0 -1.46 -0.49 -1.46 -1.43V8.23h0.68v2.55c0 0.77 0.44 1.01 0.98 1.01c0.59 0 1 -0.37 1 -1.02V8.23h0.68zm1.27 4.41c0.08 0.33 0.43 0.63 0.99 0.63c0.65 0 1.07 -0.37 1.07 -1.02v-0.6h-0.02C13 12 12.55 12.29 11.99 12.29c-0.96 0 -1.64 -0.67 -1.64 -1.9v-0.34c0 -1.21 0.67 -1.89 1.64 -1.89c0.56 0 1 0.3 1.19 0.64h0.02V8.23h0.65v4.03c0 1.05 -0.82 1.58 -1.75 1.58c-1.04 0 -1.57 -0.52 -1.66 -1.2h0.68zm2.06 -2.54c0 -0.83 -0.42 -1.36 -1.06 -1.36c-0.7 0 -1.1 0.49 -1.1 1.36v0.26c0 0.85 0.4 1.36 1.1 1.36c0.67 0 1.06 -0.52 1.06 -1.36V10.1zM4 0.5a0.5 0.5 0 0 0 -1 0V1H2A2 2 0 0 0 0 3v1h16V3A2 2 0 0 0 14 1h-1V0.5a0.5 0.5 0 0 0 -1 0V1H4V0.5z", - "M5.5 0.5A0.5 0.5 0 0 1 6 0h4a0.5 0.5 0 0 1 0 1H9v1.07a7 7 0 0 1 3.54 12.26l0.81 0.82a0.5 0.5 0 0 1 -0.7 0.7l-0.93 -0.92A6.97 6.97 0 0 1 8 16A6.97 6.97 0 0 1 4.28 14.93l-0.93 0.92a0.5 0.5 0 0 1 -0.7 -0.7l0.81 -0.82A7 7 0 0 1 7 2.07V1H6A0.5 0.5 0 0 1 5.5 0.5zM0.86 5.39A2.5 2.5 0 1 1 4.39 1.86A8.04 8.04 0 0 0 0.86 5.39zM13.5 1c-0.75 0 -1.43 0.33 -1.89 0.86a8.04 8.04 0 0 1 3.53 3.53A2.5 2.5 0 0 0 13.5 1zm-5 4a0.5 0.5 0 0 0 -1 0v3.88l-1.45 2.9a0.5 0.5 0 1 0 0.9 0.44l1.5 -3A0.5 0.5 0 0 0 8.5 9V5z", - "M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2H2A2 2 0 0 1 0 14V2A2 2 0 0 1 2 0zm3.35 4.65a0.5 0.5 0 1 0 -0.7 0.7L7.29 8l-2.64 2.65a0.5 0.5 0 0 0 0.7 0.7L8 8.71l2.65 2.64a0.5 0.5 0 0 0 0.7 -0.7L8.71 8l2.64 -2.65a0.5 0.5 0 0 0 -0.7 -0.7L8 7.29L5.35 4.65z", + "M16 8C16 4.13 12.42 1 8 1S0 4.13 0 8c0 1.76 0.74 3.37 1.97 4.6c-0.1 1.02 -0.42 2.13 -0.77 2.97c-0.08 0.19 0.07 0.39 0.27 0.36c2.26 -0.37 3.6 -0.94 4.18 -1.23A9.06 9.06 0 0 0 8 15c4.42 0 8 -3.13 8 -7zM7.19 6.77c0.09 0.12 0.16 0.26 0.23 0.4c0.43 0.95 0.39 2.38 -0.94 3.71a0.45 0.45 0 0 1 -0.61 0.01A0.41 0.41 0 0 1 5.86 10.29C6.27 9.88 6.53 9.46 6.67 9.07C6.4 9.24 6.08 9.33 5.74 9.33C4.78 9.33 4 8.59 4 7.67S4.78 6 5.73 6c0.27 0 0.53 0.06 0.76 0.17l0.01 0c0.17 0.07 0.33 0.18 0.47 0.32c0.08 0.08 0.16 0.17 0.23 0.27zM11 9.07c-0.27 0.16 -0.59 0.26 -0.93 0.26C9.11 9.33 8.34 8.59 8.34 7.67S9.11 6 10.07 6c0.27 0 0.53 0.06 0.76 0.17l0.01 0C11 6.24 11.16 6.35 11.3 6.49c0.09 0.08 0.16 0.17 0.23 0.27c0.09 0.12 0.16 0.26 0.23 0.4c0.43 0.95 0.39 2.38 -0.94 3.71a0.45 0.45 0 0 1 -0.61 0.01a0.41 0.41 0 0 1 -0.01 -0.59C10.61 9.87 10.86 9.46 11 9.07z", + "M16 14V5H0v9a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2zM2.56 12.33H1.85L3.75 7h0.7l1.9 5.33H5.62l-0.54 -1.6H3.1l-0.54 1.6zM4.1 7.81H4.08l-0.8 2.38H4.9L4.1 7.81zm5.75 0.42v4.11H9.18v-0.54H9.16C9.01 12.12 8.62 12.4 7.97 12.4c-0.85 0 -1.45 -0.48 -1.45 -1.43V8.23h0.68v2.55c0 0.77 0.44 1.01 0.98 1.01c0.59 0 1 -0.37 1 -1.02V8.23h0.68zm1.27 4.41c0.07 0.33 0.42 0.64 0.98 0.64c0.65 0 1.07 -0.38 1.07 -1.02v-0.61h-0.02C13 12 12.55 12.29 11.99 12.29c-0.96 0 -1.64 -0.67 -1.64 -1.9v-0.34c0 -1.21 0.68 -1.89 1.64 -1.89c0.56 0 1 0.29 1.2 0.64h0.02V8.23h0.65v4.03c0 1.05 -0.82 1.58 -1.75 1.58c-1.04 0 -1.57 -0.52 -1.67 -1.2h0.69zm2.06 -2.53c0 -0.83 -0.41 -1.36 -1.06 -1.36c-0.69 0 -1.1 0.49 -1.1 1.36v0.25c0 0.85 0.41 1.36 1.1 1.36c0.67 0 1.06 -0.52 1.06 -1.36V10.1zM4 0.5a0.5 0.5 0 0 0 -1 0V1H2A2 2 0 0 0 0 3v1h16V3A2 2 0 0 0 14 1h-1V0.5a0.5 0.5 0 0 0 -1 0V1H4V0.5z", + "M5.5 0.5A0.5 0.5 0 0 1 6 0h4a0.5 0.5 0 0 1 0 1H9v1.07a7 7 0 0 1 3.54 12.26l0.82 0.82a0.5 0.5 0 0 1 -0.71 0.71l-0.92 -0.93A6.97 6.97 0 0 1 8 16A6.97 6.97 0 0 1 4.28 14.93l-0.92 0.92A0.5 0.5 0 0 1 2.65 15.15l0.82 -0.82A7 7 0 0 1 7 2.07V1H6A0.5 0.5 0 0 1 5.5 0.5zM0.86 5.39A2.5 2.5 0 1 1 4.39 1.86A8.04 8.04 0 0 0 0.86 5.39zM13.5 1c-0.75 0 -1.43 0.33 -1.89 0.86a8.04 8.04 0 0 1 3.53 3.53A2.5 2.5 0 0 0 13.5 1zm-5 4a0.5 0.5 0 0 0 -1 0v3.88l-1.45 2.89a0.5 0.5 0 1 0 0.89 0.45l1.5 -3A0.5 0.5 0 0 0 8.5 9V5z", + "M2 0h12a2 2 0 0 1 2 2v12a2 2 0 0 1 -2 2H2A2 2 0 0 1 0 14V2A2 2 0 0 1 2 0zm3.35 4.65A0.5 0.5 0 1 0 4.65 5.35L7.29 8l-2.65 2.65a0.5 0.5 0 0 0 0.71 0.71L8 8.71l2.65 2.65a0.5 0.5 0 0 0 0.71 -0.71L8.71 8l2.65 -2.65A0.5 0.5 0 0 0 10.65 4.65L8 7.29L5.35 4.65z", "M2 4A2 2 0 0 0 0 6v6a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2V6A2 2 0 0 0 14 4h-1.17A2 2 0 0 1 11.41 3.41L10.59 2.59A2 2 0 0 0 9.17 2H6.83A2 2 0 0 0 5.41 2.59L4.59 3.41A2 2 0 0 1 3.17 4H2zm8.5 4.5a2.5 2.5 0 0 0 -5 0a2.5 2.5 0 1 0 5 0zM2.5 6a0.5 0.5 0 0 1 0 -1a0.5 0.5 0 1 1 0 1zm9 2.5a3.5 3.5 0 1 1 -7 0a3.5 3.5 0 0 1 7 0z", - "M2 0A2 2 0 0 0 0 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2V2A2 2 0 0 0 14 0H2zm7.5 11h-4A0.5 0.5 0 0 1 5 10.5v-4a0.5 0.5 0 0 1 1 0v2.79l4.15 -4.14a0.5 0.5 0 0 1 0.7 0.7L6.71 10H9.5a0.5 0.5 0 0 1 0 1z", + "M2 0A2 2 0 0 0 0 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2V2A2 2 0 0 0 14 0H2zm7.5 11h-4A0.5 0.5 0 0 1 5 10.5v-4a0.5 0.5 0 0 1 1 0v2.79l4.15 -4.15a0.5 0.5 0 0 1 0.71 0.71L6.71 10H9.5a0.5 0.5 0 0 1 0 1z", "M15.98 8.51c-0.38 6.15 -7.27 9.57 -12.4 6.17C3.27 14.47 2.98 14.25 2.71 14.01l5.5 -5.5h7.78zM2 13.3L7.5 7.8V0.03C1.35 0.41 -2.07 7.3 1.33 12.43c0.2 0.3 0.42 0.59 0.67 0.87zM8.5 0.03c4.02 0.25 7.23 3.46 7.49 7.49H8.5V0.03z", "M8.66 8.66v-4H7.34v4h1.31zm0 2.68V10H7.34v1.34h1.31zM8 1.34q2.75 0 4.7 1.95T14.66 8t-1.95 4.7T8 14.66T3.3 12.7T1.34 8T3.3 3.3T8 1.34z" ], diff --git a/test/static.test.ts b/test/static.test.ts index 6ba11ac..6415b10 100644 --- a/test/static.test.ts +++ b/test/static.test.ts @@ -1,5 +1,5 @@ import { expect, it, describe, beforeEach, vi } from 'vitest'; -import SVGPathCommander, { type CurveArray, type ShapeTypes } from '~/index'; +import SVGPathCommander, { PathArray, type CurveArray, type ShapeTypes } from '~/index'; import invalidPathValue from '../src/parser/invalidPathValue'; import error from '../src/parser/error'; @@ -115,11 +115,12 @@ describe('SVGPathCommander Static Methods', () => { }); }); - it(`Can revert back to default round option`, () => { - const sample = [["M", 0, 0], ["L", 181.99955, 0], ["L", 91, 72], ["L", 0, 0], ["Z"]]; - const rounded = [["M", 0, 0], ["L", 181.9996, 0], ["L", 91, 72], ["L", 0, 0], ["Z"]]; + it(`Can disable round, use a given decimal amount or revert back to default round option`, () => { + const sample = [["M", 0, 0], ["L", 181.99955, 0], ["L", 91, 72], ["L", 0, 0], ["Z"]] as PathArray; + const rounded = [["M", 0, 0], ["L", 181.9996, 0], ["L", 91, 72], ["L", 0, 0], ["Z"]] as PathArray; - // @ts-expect-error + expect(SVGPathCommander.roundPath(sample, 4), `can use number setting`).to.deep.equal(rounded); + expect(SVGPathCommander.roundPath(sample, 'off'), `can use "off" setting`).to.deep.equal(sample); expect(SVGPathCommander.roundPath(sample, -1), `use 4 decimals when negative number is provided`).to.deep.equal(rounded); // @ts-expect-error expect(SVGPathCommander.roundPath(sample, 'wombat'), `use 4 decimals when string is provided`).to.deep.equal(rounded); @@ -198,7 +199,7 @@ describe('SVGPathCommander Static Methods', () => { const propsPoint0 = getPropertiesAtPoint(simpleShapes.initial[1], { "x": 10, "y": 90 }); expect(propsPoint0.closest).to.deep.equal({ x: 10, y: 90 }); expect(propsPoint0.distance).to.equal(0); - expect(propsPoint0.segment).to.deep.equal({ segment: ["M", 10, 90], index: 0, length: 0, point: { x: 10, y: 90 }, lengthAtSegment: 0 }) + expect(propsPoint0.segment).to.deep.equal({ segment: ["M", 10, 90], index: 0, length: 0, lengthAtSegment: 0 }) // getPropertiesAtPoint mid point const propsPoint50 = getPropertiesAtPoint(simpleShapes.initial[1], { x: 30.072453006153214, y: 41.42818552481854 }); @@ -224,7 +225,7 @@ describe('SVGPathCommander Static Methods', () => { it(`Can do getSegmentOfPoint`, () => { const { getSegmentOfPoint } = SVGPathCommander; // first point - expect(getSegmentOfPoint(simpleShapes.initial[1], { x: 10, y: 90 })).to.deep.equal({ segment: ["M", 10, 90], index: 0, length: 0, point: { x: 10, y: 90 }, lengthAtSegment: 0 }); + expect(getSegmentOfPoint(simpleShapes.initial[1], { x: 10, y: 90 })).to.deep.equal({ segment: ["M", 10, 90], index: 0, length: 0, lengthAtSegment: 0 }); // mid point expect(getSegmentOfPoint(simpleShapes.initial[3], { x: 9, y: 9 })).to.deep.equal({ segment: ["a", 6, 4, 10, 0, 1, 8, 0], index: 5, length: 7.498916687913066,/* point: { x: 6, y: 10 },*/ lengthAtSegment: 48.11479095890485 }); }); @@ -267,13 +268,13 @@ describe('SVGPathCommander Static Methods', () => { }); it(`Can do polygonLength`, () => { - const { polygonLength } = SVGPathCommander; - expect(polygonLength([[100, 100], [150, 25], [150, 75], [200, 0]])).to.equal(230.27756377319946); + const { polygonTools } = SVGPathCommander; + expect(polygonTools.polygonLength([[100, 100], [150, 25], [150, 75], [200, 0]])).to.equal(230.27756377319946); }); it(`Can do polygonArea`, () => { - const { polygonArea } = SVGPathCommander; - expect(polygonArea([[107.4, 13], [113.7, 28.8], [127.9, 31.3], [117.6, 43.5], [120.1, 60.8], [107.4, 52.6], [94.6, 60.8], [97.1, 43.5], [86.8, 31.3], [101, 28.8]])).to.equal(-836.69); + const { polygonTools } = SVGPathCommander; + expect(polygonTools.polygonArea([[107.4, 13], [113.7, 28.8], [127.9, 31.3], [117.6, 43.5], [120.1, 60.8], [107.4, 52.6], [94.6, 60.8], [97.1, 43.5], [86.8, 31.3], [101, 28.8]])).to.equal(-836.69); }); it(`Can do transformPath with empty object`, () => { @@ -304,7 +305,7 @@ describe('SVGPathCommander Static Methods', () => { }); it(`Can cover all remaining branches`, () => { - const { splitPath, parsePathString, getPathBBox, getPointAtLength, getTotalLength } = SVGPathCommander; + const { splitPath, pathToString, optimizePath, parsePathString, getPathBBox, getPointAtLength, getTotalLength } = SVGPathCommander; expect(getPointAtLength(simpleShapes.normalized[3], 24.057395479452424)).to.deep.equal({ x: 14, y: 10 }); expect(getPointAtLength(simpleShapes.normalized[0], 0)).to.deep.equal({ x: 10, y: 10 }); expect(getPointAtLength(simpleShapes.normalized[3], undefined)).to.deep.equal({ x: 6, y: 10 }); @@ -320,5 +321,10 @@ describe('SVGPathCommander Static Methods', () => { "x": 10, "y": 10, "x2": 170,"y2": 90, }); expect(splitPath(parsePathString(shapes.relative[1])).length).to.equal(7); + expect(pathToString(optimizePath(parsePathString( + // 'M10 50q15 -25 30 0Q55 75 70 50Q85 25 100 50T130 50Q145 25 160 50t30 0' + simpleShapes.normalized[2] + ), 2))).to.equal(simpleShapes.initial[2]); + // M10 50q15 -25 30 0t30 0t30 0t30 0t30 0t30 0 }); });