reactive-md 0.9.3 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG-ch.md +34 -0
- package/CHANGELOG.md +34 -0
- package/README-ch.md +7 -7
- package/README-en.md +7 -7
- package/README.md +7 -7
- package/THIRD_PARTY_NOTICES.md +0 -57
- package/cli/help.mjs +6 -4
- package/cli/init.mjs +1 -1
- package/cli/migrate.mjs +1 -1
- package/dist-library/{LocalDocumentView-D6zQkTkt.js → LocalDocumentView-CP2QG86k.js} +46 -44
- package/dist-library/{LocalDocumentViewCore-CmJhemcA.js → LocalDocumentViewCore-Cd6yMEkg.js} +284 -265
- package/dist-library/{LocalReactiveDocumentCore-lAKOGAZ7.js → LocalReactiveDocumentCore-VuYpZqdn.js} +7 -7
- package/dist-library/LocalStaticDocumentView-DfX6bemE.js +147 -0
- package/dist-library/authoring-Bwu_zCWs.js +768 -0
- package/dist-library/choice-values-BItGjPD2.js +58 -0
- package/dist-library/compile-B35rfzKr.js +1742 -0
- package/dist-library/{compile-cache-key-6GgpETz_.js → compile-cache-key-D21X2Obx.js} +5 -5
- package/dist-library/{compiler-DLkKUK4t.js → compiler-DBwLawMZ.js} +4 -4
- package/dist-library/{compiler-core-Niqhp9wV.js → compiler-core-kkDiQ1RK.js} +3146 -2055
- package/dist-library/{component-kernel-IG4wOO0i.js → component-kernel-CsJSabHX.js} +42 -26
- package/dist-library/{component-state-Ht-hOK0W.js → component-state-Da0G8Ajc.js} +1 -1
- package/dist-library/{component-utils-eSj5IdG4.js → component-utils-ZM3jUJNy.js} +80 -79
- package/dist-library/conditional-branches-CIhJXasR.js +17 -0
- package/dist-library/{config-validation-Cpol91_M.js → config-validation-DbmsWAEV.js} +165 -152
- package/dist-library/{controls-B-CLSK8Q.js → controls-DRy5rzzN.js} +271 -228
- package/dist-library/{coordinate-PyLPMIQK.js → coordinate-c54pHfgf.js} +29 -29
- package/dist-library/data-table-CSAkm1eU.js +290 -0
- package/dist-library/data-table-model-DruztQFt.js +391 -0
- package/dist-library/{data-visuals-_Z7QqYTk.js → data-visuals-rZQUeQM0.js} +14 -14
- package/dist-library/{default-components-jugH7Ubr.js → default-components-B-39etG9.js} +233 -71
- package/dist-library/{default-config-DIrRpuQz.js → default-config-CCa8rm2k.js} +236 -216
- package/dist-library/default-options-By16CVw1.js +131 -0
- package/dist-library/{default-registry-BlloaZi7.js → default-registry-DXJy66xj.js} +3 -3
- package/dist-library/{default-schema-Ch-Vznpm.js → default-schema-CeYiEW1K.js} +3 -3
- package/dist-library/display-Bb6hAG5T.js +2065 -0
- package/dist-library/{document-theme-DBAfnk7y.js → document-theme-CJvN-nC1.js} +190 -3
- package/dist-library/{export-heVBqgxA.js → export-BSV4E0jv.js} +105 -106
- package/dist-library/font-aliases-CKYjwn4o.js +4 -0
- package/dist-library/{gallery-Q6VPS2ep.js → gallery-DM2yTVZJ.js} +1 -1
- package/dist-library/{html-CCnvzan1.js → html-CY9mC3Sr.js} +5 -5
- package/dist-library/{incremental-Bzvh8_lB.js → incremental-B-wW4H3F.js} +251 -245
- package/dist-library/{display-y4v9v0Qd.js → katex-4ukd4ZxT.js} +1555 -3618
- package/dist-library/layout-CPQggKxk.js +592 -0
- package/dist-library/{layout-BnfDeUNy.js → layout-CaDWsDof.js} +1 -1
- package/dist-library/{math-view-B0jthpRw.js → math-view-CyGTS6kv.js} +1 -1
- package/dist-library/{mount-preset-C_i37FvY.js → mount-preset-DtrCX4G8.js} +4 -4
- package/dist-library/{numeric-sliders-CkWS0-ja.js → numeric-sliders-BmJ1LCLx.js} +190 -190
- package/dist-library/{observability-CYLuvFfL.js → observability-BVQ16ByQ.js} +5 -4
- package/dist-library/{package-core-9UK5ZdqB.js → package-core-Cu_r_qs7.js} +7 -6
- package/dist-library/{parser-9yNJxGip.js → parser-BHl9Lxbw.js} +2 -2
- package/dist-library/{parser-standard-BPIy4HOu.js → parser-standard-DDAKv_DZ.js} +247 -247
- package/dist-library/{plugin-packs-CZb46nuv.js → plugin-packs-CkI0floL.js} +3 -3
- package/dist-library/{preset-core-BW3NWZJ9.js → preset-core-BKPbH_Nv.js} +377 -306
- package/dist-library/{props-pJRrfDc6.js → props-0iDqxlTk.js} +56 -61
- package/dist-library/{react-BSo0o998.js → react-74jdGBmu.js} +2 -2
- package/dist-library/reactive-md-authoring.js +277 -269
- package/dist-library/reactive-md-build.js +327 -33
- package/dist-library/reactive-md-compiler-session.js +3 -3
- package/dist-library/reactive-md-compiler-standard.js +10 -10
- package/dist-library/reactive-md-compiler.js +3 -3
- package/dist-library/reactive-md-contracts.js +4 -4
- package/dist-library/reactive-md-default-packs.js +4 -3
- package/dist-library/reactive-md-default-preset.js +3 -3
- package/dist-library/reactive-md-export.js +6 -6
- package/dist-library/reactive-md-minimal-preset.js +3 -2
- package/dist-library/reactive-md-minimal-react-preset.js +18 -17
- package/dist-library/reactive-md-minimal.css +1 -1
- package/dist-library/reactive-md-observability.js +2 -2
- package/dist-library/reactive-md-pack-style-manifest.js +8 -0
- package/dist-library/reactive-md-plugin-chart.js +13 -9
- package/dist-library/reactive-md-plugin-data.js +4 -4
- package/dist-library/reactive-md-plugin-diagram.js +3 -3
- package/dist-library/reactive-md-plugin-forms.js +5 -5
- package/dist-library/reactive-md-plugin-gallery.js +3 -3
- package/dist-library/reactive-md-plugin-navigation.js +10 -10
- package/dist-library/reactive-md-plugin-network.js +5 -5
- package/dist-library/reactive-md-plugin-plot.js +4 -4
- package/dist-library/reactive-md-react-component-accordion.js +3 -3
- package/dist-library/reactive-md-react-component-alert.js +3 -3
- package/dist-library/reactive-md-react-component-anchor.js +3 -3
- package/dist-library/reactive-md-react-component-badge.js +3 -3
- package/dist-library/reactive-md-react-component-card.js +3 -3
- package/dist-library/reactive-md-react-component-chart.js +2 -2
- package/dist-library/reactive-md-react-component-checkbox.js +2 -2
- package/dist-library/reactive-md-react-component-checklist.js +2 -2
- package/dist-library/reactive-md-react-component-choices.js +2 -2
- package/dist-library/reactive-md-react-component-column.js +1 -1
- package/dist-library/reactive-md-react-component-coordinate.js +2 -2
- package/dist-library/reactive-md-react-component-counter.js +2 -2
- package/dist-library/reactive-md-react-component-data-table.js +2 -2
- package/dist-library/reactive-md-react-component-date.js +2 -2
- package/dist-library/reactive-md-react-component-diagram.js +2 -2
- package/dist-library/reactive-md-react-component-disclosure.js +3 -3
- package/dist-library/reactive-md-react-component-edge.js +1 -1
- package/dist-library/reactive-md-react-component-else.js +10 -0
- package/dist-library/reactive-md-react-component-gallery-item.js +2 -2
- package/dist-library/reactive-md-react-component-gallery.js +2 -2
- package/dist-library/reactive-md-react-component-grid.js +3 -3
- package/dist-library/reactive-md-react-component-if.js +3 -3
- package/dist-library/reactive-md-react-component-input.js +2 -2
- package/dist-library/reactive-md-react-component-jump.js +3 -3
- package/dist-library/reactive-md-react-component-multi-select.js +2 -2
- package/dist-library/reactive-md-react-component-node.js +2 -2
- package/dist-library/reactive-md-react-component-number.js +2 -2
- package/dist-library/reactive-md-react-component-option.js +1 -1
- package/dist-library/reactive-md-react-component-panel.js +3 -3
- package/dist-library/reactive-md-react-component-plot.js +2 -2
- package/dist-library/reactive-md-react-component-progress.js +2 -2
- package/dist-library/reactive-md-react-component-quiz.js +2 -2
- package/dist-library/reactive-md-react-component-radio-group.js +2 -2
- package/dist-library/reactive-md-react-component-range-slider.js +2 -2
- package/dist-library/reactive-md-react-component-section.js +3 -3
- package/dist-library/reactive-md-react-component-select.js +2 -2
- package/dist-library/reactive-md-react-component-slider.js +2 -2
- package/dist-library/reactive-md-react-component-step.js +3 -3
- package/dist-library/reactive-md-react-component-steps.js +3 -3
- package/dist-library/reactive-md-react-component-tab.js +3 -3
- package/dist-library/reactive-md-react-component-table.js +2 -2
- package/dist-library/reactive-md-react-component-tabs.js +3 -3
- package/dist-library/reactive-md-react-component-text.js +3 -3
- package/dist-library/reactive-md-react-component-textarea.js +2 -2
- package/dist-library/reactive-md-react-component-timeline.js +2 -2
- package/dist-library/reactive-md-react-component-timer.js +2 -2
- package/dist-library/reactive-md-react-component-toggle.js +2 -2
- package/dist-library/reactive-md-react-component-tooltip.js +3 -3
- package/dist-library/reactive-md-react-component-validation.js +3 -3
- package/dist-library/reactive-md-react-minimal.js +4 -4
- package/dist-library/reactive-md-react-pack-controls.js +4 -4
- package/dist-library/reactive-md-react-pack-data.js +3 -3
- package/dist-library/reactive-md-react-pack-layout.js +25 -24
- package/dist-library/reactive-md-react-pack-visuals.js +2 -2
- package/dist-library/reactive-md-react-packed.js +6 -6
- package/dist-library/reactive-md-react-server.js +37 -36
- package/dist-library/reactive-md-react-static-server.js +2 -2
- package/dist-library/reactive-md-react-static.js +1 -1
- package/dist-library/reactive-md-react-unstyled.js +12 -12
- package/dist-library/reactive-md-react.js +12 -12
- package/dist-library/reactive-md-scan.js +1 -1
- package/dist-library/reactive-md-sdk.js +23 -9
- package/dist-library/reactive-md-standalone-configured.js +2 -2
- package/dist-library/reactive-md-standalone-host.js +2 -2
- package/dist-library/reactive-md-testing-browser.js +2 -2
- package/dist-library/reactive-md-testing-react.js +6 -6
- package/dist-library/reactive-md-testing.js +6 -6
- package/dist-library/reactive-md-vite.js +25 -9
- package/dist-library/reactive-md-worker-pool.js +3 -3
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +52 -43
- package/dist-library/{registry-core-CziAIP5P.js → registry-core-DxEaxhJ6.js} +3 -2
- package/dist-library/{render-nodes-DKjg_TR1.js → render-nodes-B6j6Ip5I.js} +766 -731
- package/dist-library/{requirements-DhIkxAbl.js → requirements-C56sFIEs.js} +2 -2
- package/dist-library/{resources-B_nbROgj.js → resources-6VaNgk-h.js} +2 -2
- package/dist-library/rmd-pack-layout.css +9 -0
- package/dist-library/rmd-pack-resource-layout.css +9 -0
- package/dist-library/runtime-BHeuLOv_.js +1369 -0
- package/dist-library/{runtime-requirement-C4-vNcf5.js → runtime-requirement-DzPO8raU.js} +166 -163
- package/dist-library/{schema-core-4sd1Vu7V.js → schema-core-CDXfxdID.js} +24 -1
- package/dist-library/{sdk-core-BLsW9cCy.js → sdk-core-CnE-n0Z7.js} +469 -314
- package/dist-library/{session-core-DLBRPV7f.js → session-core-C071yQwV.js} +140 -127
- package/dist-library/{validation-XXlb-spV.js → sha256-utf16-Bmandi_H.js} +392 -315
- package/dist-library/shareable-CHCDnl6j.js +844 -0
- package/dist-library/types/authoring/catalog.d.ts +3 -1
- package/dist-library/types/authoring/index.d.ts +1 -1
- package/dist-library/types/components/chart/default-chart-types.d.ts +3 -0
- package/dist-library/types/components/chart/default-chart.d.ts +7 -0
- package/dist-library/types/components/entries/else.d.ts +3 -0
- package/dist-library/types/components/layout/layout.d.ts +5 -0
- package/dist-library/types/components/shared/visuals.d.ts +1 -1
- package/dist-library/types/components/table/data-table-model.d.ts +95 -2
- package/dist-library/types/components/table/data-table.d.ts +2 -2
- package/dist-library/types/contracts/component-kernel.d.ts +5 -0
- package/dist-library/types/contracts/font-aliases.d.ts +18 -0
- package/dist-library/types/contracts/number-literal.d.ts +2 -0
- package/dist-library/types/contracts/sha256-utf16.d.ts +2 -0
- package/dist-library/types/export/index.d.ts +4 -1
- package/dist-library/types/local/compilation/compiler-choices.d.ts +4 -0
- package/dist-library/types/local/compilation/compiler-declarations.d.ts +2 -1
- package/dist-library/types/local/compilation/compiler-expressions.d.ts +12 -1
- package/dist-library/types/local/compilation/compiler-macros.d.ts +18 -0
- package/dist-library/types/local/compilation/compiler-structure.d.ts +8 -2
- package/dist-library/types/local/compilation/compiler-tables.d.ts +1 -0
- package/dist-library/types/local/compilation/compiler-validation.d.ts +11 -0
- package/dist-library/types/local/compilation/compiler-values.d.ts +1 -2
- package/dist-library/types/local/configuration/diagnostic-messages.d.ts +173 -2
- package/dist-library/types/local/configuration/diagnostic-runtime-messages.d.ts +40 -0
- package/dist-library/types/local/evaluation/choice-values.d.ts +22 -0
- package/dist-library/types/local/evaluation/computations.d.ts +13 -5
- package/dist-library/types/local/evaluation/dataset.d.ts +4 -0
- package/dist-library/types/local/evaluation/expression/collection-functions.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/compile.d.ts +11 -4
- package/dist-library/types/local/evaluation/expression/data-functions.d.ts +23 -0
- package/dist-library/types/local/evaluation/expression/evaluation.d.ts +3 -1
- package/dist-library/types/local/evaluation/expression/internal-names.d.ts +8 -0
- package/dist-library/types/local/evaluation/expression/syntax.d.ts +19 -2
- package/dist-library/types/local/evaluation/expression/transform-budget.d.ts +13 -0
- package/dist-library/types/local/evaluation/expression/values.d.ts +9 -1
- package/dist-library/types/local/evaluation/validation.d.ts +8 -6
- package/dist-library/types/local/index.d.ts +4 -3
- package/dist-library/types/local/parsing/conditional-branches.d.ts +4 -0
- package/dist-library/types/local/parsing/source-revision.d.ts +3 -0
- package/dist-library/types/local/runtime/runtime-choices.d.ts +11 -0
- package/dist-library/types/local/runtime/runtime.d.ts +3 -1
- package/dist-library/types/local/runtime/state.d.ts +30 -15
- package/dist-library/types/local/source/authoring-requirements.d.ts +3 -0
- package/dist-library/types/local/source/authoring-syntax.d.ts +3 -2
- package/dist-library/types/local/source/authoring.d.ts +10 -0
- package/dist-library/types/local/source/source-migration.d.ts +1 -0
- package/dist-library/types/local/types.d.ts +33 -2
- package/dist-library/types/react/component-api.d.ts +21 -2
- package/dist-library/types/react/component-utils.d.ts +11 -0
- package/dist-library/types/react/font-aliases.d.ts +2 -0
- package/dist-library/types/react/package-core.d.ts +3 -0
- package/dist-library/types/react/rendering/document/validation-state.d.ts +1 -1
- package/dist-library/types/react/rendering/document/view-revision.d.ts +3 -12
- package/dist-library/types/react/rendering/table/data-table.d.ts +1 -1
- package/dist-library/types/react/sdk-core.d.ts +3 -1
- package/dist-library/types/sdk/assembly.d.ts +3 -0
- package/dist-library/types/sdk/font.d.ts +13 -0
- package/dist-library/types/sdk/index.d.ts +1 -0
- package/dist-library/types/sdk/theme.d.ts +5 -0
- package/dist-library/types/sdk/types.d.ts +6 -0
- package/dist-library/types/sdk/version.d.ts +1 -1
- package/dist-library/types/shareable.d.ts +15 -3
- package/dist-library/types/standalone/prepare.d.ts +4 -2
- package/dist-library/types/standalone/session-core.d.ts +4 -1
- package/dist-library/types/vite/index.d.ts +3 -0
- package/dist-library/types/vite/registration.d.ts +1 -0
- package/dist-library/{types-Bza88SGK.js → types-B4qG8J4S.js} +1 -1
- package/dist-library/types-FYhRWRn9.js +3 -0
- package/dist-library/use-hydrated-D1gFY2Dq.js +2655 -0
- package/dist-library/validation-DRuW0Wl9.js +433 -0
- package/dist-library/{version-B0G1699c.js → version-4wzhbvDG.js} +1 -1
- package/dist-library/{visual-helpers-CRmaqCHX.js → visual-helpers-UU6xiL8g.js} +3 -3
- package/dist-library/visuals-7xzoL9ql.js +49340 -0
- package/dist-library/{worker-D6WMV8xJ.js → worker-3ldRjOEG.js} +9 -9
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +128 -368
- package/docs/README-ch.md +3 -1
- package/docs/README.md +3 -1
- package/docs/compatibility/api-stability-ch.md +1 -1
- package/docs/compatibility/api-stability-en.md +1 -1
- package/docs/compatibility/compatibility-ch.md +15 -15
- package/docs/compatibility/compatibility-en.md +15 -15
- package/docs/compatibility/compatibility-manifest.schema.json +3 -2
- package/docs/compatibility/deprecation-ch.md +2 -2
- package/docs/compatibility/deprecation-en.md +2 -2
- package/docs/compatibility/source-versioning-ch.md +22 -14
- package/docs/compatibility/source-versioning-en.md +22 -13
- package/docs/compatibility/support-matrix-ch.md +4 -3
- package/docs/compatibility/support-matrix-en.md +4 -3
- package/docs/development/component-development-ch.md +2 -2
- package/docs/development/component-development-en.md +2 -2
- package/docs/development/component-protocol-ch.md +18 -18
- package/docs/development/component-protocol-en.md +14 -14
- package/docs/guides/local-guide-ch.md +109 -20
- package/docs/guides/local-guide-en.md +109 -20
- package/docs/integration/author-tools-ch.md +1 -1
- package/docs/integration/author-tools-en.md +1 -1
- package/docs/integration/editor-ch.md +3 -3
- package/docs/integration/editor-en.md +3 -3
- package/docs/integration/extension-sdk-ch.md +29 -3
- package/docs/integration/extension-sdk-en.md +29 -3
- package/docs/integration/local-integration-ch.md +3 -3
- package/docs/integration/local-integration-en.md +3 -3
- package/docs/integration/pdf-export-ch.md +42 -0
- package/docs/integration/pdf-export-en.md +42 -0
- package/docs/integration/shareable-export-ch.md +11 -19
- package/docs/integration/shareable-export-en.md +11 -19
- package/docs/reference/diagnostics-counting-ch.md +24 -1
- package/docs/reference/diagnostics-counting-en.md +24 -1
- package/docs/reference/local-interaction-syntax-ch.md +222 -33
- package/docs/reference/local-interaction-syntax-en.md +220 -31
- package/docs/reference/public-api-ch.md +24 -18
- package/docs/reference/public-api-en.md +24 -18
- package/docs/reference/theme-protocol-ch.md +1 -1
- package/docs/reference/theme-protocol-en.md +1 -1
- package/docs/releases/release-0.10.0-ch.md +45 -0
- package/docs/releases/release-0.10.0-en.md +45 -0
- package/examples/conformance/README-ch.md +3 -3
- package/examples/conformance/README.md +3 -3
- package/examples/conformance/local-draft-4.json +441 -0
- package/examples/integration/README-ch.md +3 -3
- package/examples/integration/README.md +3 -3
- package/examples/integration/chat-session/package.json +1 -1
- package/examples/local/README-ch.md +1 -1
- package/examples/local/README.md +1 -1
- package/package.json +6 -1
- package/dist-library/LocalStaticDocumentView-2J7w0sKm.js +0 -143
- package/dist-library/authoring-B14SsOXZ.js +0 -893
- package/dist-library/compile-D50B5_Ww.js +0 -1249
- package/dist-library/computations-CffoW7Ff.js +0 -340
- package/dist-library/data-table-Kv_ZA2Z2.js +0 -297
- package/dist-library/default-options-DU5dxuU6.js +0 -125
- package/dist-library/layout-BfUzzO2b.js +0 -553
- package/dist-library/runtime-CuJndKqK.js +0 -1289
- package/dist-library/shareable-C6mUerpQ.js +0 -817
- package/dist-library/types-daDo2c_w.js +0 -3
- package/dist-library/use-hydrated-W-laKPhY.js +0 -22975
- package/dist-library/visuals-CoVSjVD8.js +0 -49159
|
@@ -0,0 +1,2655 @@
|
|
|
1
|
+
import "./katex-4ukd4ZxT.js";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
import t, { useCallback as n, useEffect as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s, useSyncExternalStore as c } from "react";
|
|
4
|
+
import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
// node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
6
|
+
var f = process.env.NODE_ENV === "production", p = "Invariant failed";
|
|
7
|
+
function m(e, t) {
|
|
8
|
+
if (!e) {
|
|
9
|
+
if (f) throw Error(p);
|
|
10
|
+
var n = typeof t == "function" ? t() : t, r = n ? `${p}: ${n}` : p;
|
|
11
|
+
throw Error(r);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
// node_modules/mafs/node_modules/use-resize-observer/dist/bundle.esm.js
|
|
15
|
+
function h(e, t) {
|
|
16
|
+
var i = o(null), a = o(null);
|
|
17
|
+
a.current = t;
|
|
18
|
+
var s = o(null);
|
|
19
|
+
r(function() {
|
|
20
|
+
c();
|
|
21
|
+
});
|
|
22
|
+
var c = n(function() {
|
|
23
|
+
var t = s.current, n = a.current, r = t || (n ? n instanceof Element ? n : n.current : null);
|
|
24
|
+
i.current && i.current.element === r && i.current.subscriber === e || (i.current && i.current.cleanup && i.current.cleanup(), i.current = {
|
|
25
|
+
element: r,
|
|
26
|
+
subscriber: e,
|
|
27
|
+
cleanup: r ? e(r) : void 0
|
|
28
|
+
});
|
|
29
|
+
}, [e]);
|
|
30
|
+
return r(function() {
|
|
31
|
+
return function() {
|
|
32
|
+
i.current && i.current.cleanup && (i.current.cleanup(), i.current = null);
|
|
33
|
+
};
|
|
34
|
+
}, []), n(function(e) {
|
|
35
|
+
s.current = e, c();
|
|
36
|
+
}, [c]);
|
|
37
|
+
}
|
|
38
|
+
function g(e, t, n) {
|
|
39
|
+
return e[t] ? e[t][0] ? e[t][0][n] : e[t][n] : t === "contentBoxSize" ? e.contentRect[n === "inlineSize" ? "width" : "height"] : void 0;
|
|
40
|
+
}
|
|
41
|
+
function _(e) {
|
|
42
|
+
e === void 0 && (e = {});
|
|
43
|
+
var t = e.onResize, i = o(void 0);
|
|
44
|
+
i.current = t;
|
|
45
|
+
var c = e.round || Math.round, l = o(), u = s({
|
|
46
|
+
width: void 0,
|
|
47
|
+
height: void 0
|
|
48
|
+
}), d = u[0], f = u[1], p = o(!1);
|
|
49
|
+
r(function() {
|
|
50
|
+
return p.current = !1, function() {
|
|
51
|
+
p.current = !0;
|
|
52
|
+
};
|
|
53
|
+
}, []);
|
|
54
|
+
var m = o({
|
|
55
|
+
width: void 0,
|
|
56
|
+
height: void 0
|
|
57
|
+
}), _ = h(n(function(t) {
|
|
58
|
+
return l.current && l.current.box === e.box && l.current.round === c || (l.current = {
|
|
59
|
+
box: e.box,
|
|
60
|
+
round: c,
|
|
61
|
+
instance: new ResizeObserver(function(t) {
|
|
62
|
+
var n = t[0], r = e.box === "border-box" ? "borderBoxSize" : e.box === "device-pixel-content-box" ? "devicePixelContentBoxSize" : "contentBoxSize", a = g(n, r, "inlineSize"), o = g(n, r, "blockSize"), s = a ? c(a) : void 0, l = o ? c(o) : void 0;
|
|
63
|
+
if (m.current.width !== s || m.current.height !== l) {
|
|
64
|
+
var u = {
|
|
65
|
+
width: s,
|
|
66
|
+
height: l
|
|
67
|
+
};
|
|
68
|
+
m.current.width = s, m.current.height = l, i.current ? i.current(u) : p.current || f(u);
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
}), l.current.instance.observe(t, { box: e.box }), function() {
|
|
72
|
+
l.current && l.current.instance.unobserve(t);
|
|
73
|
+
};
|
|
74
|
+
}, [e.box, c]), e.ref);
|
|
75
|
+
return a(function() {
|
|
76
|
+
return {
|
|
77
|
+
ref: _,
|
|
78
|
+
width: d.width,
|
|
79
|
+
height: d.height
|
|
80
|
+
};
|
|
81
|
+
}, [
|
|
82
|
+
_,
|
|
83
|
+
d.width,
|
|
84
|
+
d.height
|
|
85
|
+
]);
|
|
86
|
+
}
|
|
87
|
+
// node_modules/@use-gesture/core/dist/maths-0ab39ae9.esm.js
|
|
88
|
+
function v(e, t, n) {
|
|
89
|
+
return Math.max(t, Math.min(e, n));
|
|
90
|
+
}
|
|
91
|
+
var y = {
|
|
92
|
+
toVector(e, t) {
|
|
93
|
+
return e === void 0 && (e = t), Array.isArray(e) ? e : [e, e];
|
|
94
|
+
},
|
|
95
|
+
add(e, t) {
|
|
96
|
+
return [e[0] + t[0], e[1] + t[1]];
|
|
97
|
+
},
|
|
98
|
+
sub(e, t) {
|
|
99
|
+
return [e[0] - t[0], e[1] - t[1]];
|
|
100
|
+
},
|
|
101
|
+
addTo(e, t) {
|
|
102
|
+
e[0] += t[0], e[1] += t[1];
|
|
103
|
+
},
|
|
104
|
+
subTo(e, t) {
|
|
105
|
+
e[0] -= t[0], e[1] -= t[1];
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
function b(e, t, n) {
|
|
109
|
+
return t === 0 || Math.abs(t) === Infinity ? e ** (n * 5) : e * t * n / (t + n * e);
|
|
110
|
+
}
|
|
111
|
+
function x(e, t, n, r = .15) {
|
|
112
|
+
return r === 0 ? v(e, t, n) : e < t ? -b(t - e, n - t, r) + t : e > n ? +b(e - n, n - t, r) + n : e;
|
|
113
|
+
}
|
|
114
|
+
function S(e, [t, n], [r, i]) {
|
|
115
|
+
let [[a, o], [s, c]] = e;
|
|
116
|
+
return [x(t, a, o, r), x(n, s, c, i)];
|
|
117
|
+
}
|
|
118
|
+
// node_modules/@use-gesture/core/dist/actions-fe213e88.esm.js
|
|
119
|
+
function C(e, t) {
|
|
120
|
+
if (typeof e != "object" || !e) return e;
|
|
121
|
+
var n = e[Symbol.toPrimitive];
|
|
122
|
+
if (n !== void 0) {
|
|
123
|
+
var r = n.call(e, t || "default");
|
|
124
|
+
if (typeof r != "object") return r;
|
|
125
|
+
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
126
|
+
}
|
|
127
|
+
return (t === "string" ? String : Number)(e);
|
|
128
|
+
}
|
|
129
|
+
function w(e) {
|
|
130
|
+
var t = C(e, "string");
|
|
131
|
+
return typeof t == "symbol" ? t : String(t);
|
|
132
|
+
}
|
|
133
|
+
function T(e, t, n) {
|
|
134
|
+
return t = w(t), t in e ? Object.defineProperty(e, t, {
|
|
135
|
+
value: n,
|
|
136
|
+
enumerable: !0,
|
|
137
|
+
configurable: !0,
|
|
138
|
+
writable: !0
|
|
139
|
+
}) : e[t] = n, e;
|
|
140
|
+
}
|
|
141
|
+
function E(e, t) {
|
|
142
|
+
var n = Object.keys(e);
|
|
143
|
+
if (Object.getOwnPropertySymbols) {
|
|
144
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
145
|
+
t && (r = r.filter(function(t) {
|
|
146
|
+
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
147
|
+
})), n.push.apply(n, r);
|
|
148
|
+
}
|
|
149
|
+
return n;
|
|
150
|
+
}
|
|
151
|
+
function D(e) {
|
|
152
|
+
for (var t = 1; t < arguments.length; t++) {
|
|
153
|
+
var n = arguments[t] == null ? {} : arguments[t];
|
|
154
|
+
t % 2 ? E(Object(n), !0).forEach(function(t) {
|
|
155
|
+
T(e, t, n[t]);
|
|
156
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : E(Object(n)).forEach(function(t) {
|
|
157
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return e;
|
|
161
|
+
}
|
|
162
|
+
var O = {
|
|
163
|
+
pointer: {
|
|
164
|
+
start: "down",
|
|
165
|
+
change: "move",
|
|
166
|
+
end: "up"
|
|
167
|
+
},
|
|
168
|
+
mouse: {
|
|
169
|
+
start: "down",
|
|
170
|
+
change: "move",
|
|
171
|
+
end: "up"
|
|
172
|
+
},
|
|
173
|
+
touch: {
|
|
174
|
+
start: "start",
|
|
175
|
+
change: "move",
|
|
176
|
+
end: "end"
|
|
177
|
+
},
|
|
178
|
+
gesture: {
|
|
179
|
+
start: "start",
|
|
180
|
+
change: "change",
|
|
181
|
+
end: "end"
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
function k(e) {
|
|
185
|
+
return e ? e[0].toUpperCase() + e.slice(1) : "";
|
|
186
|
+
}
|
|
187
|
+
var A = ["enter", "leave"];
|
|
188
|
+
function j(e = !1, t) {
|
|
189
|
+
return e && !A.includes(t);
|
|
190
|
+
}
|
|
191
|
+
function ee(e, t = "", n = !1) {
|
|
192
|
+
let r = O[e], i = r && r[t] || t;
|
|
193
|
+
return "on" + k(e) + k(i) + (j(n, i) ? "Capture" : "");
|
|
194
|
+
}
|
|
195
|
+
var M = ["gotpointercapture", "lostpointercapture"];
|
|
196
|
+
function te(e) {
|
|
197
|
+
let t = e.substring(2).toLowerCase(), n = !!~t.indexOf("passive");
|
|
198
|
+
n && (t = t.replace("passive", ""));
|
|
199
|
+
let r = M.includes(t) ? "capturecapture" : "capture", i = !!~t.indexOf(r);
|
|
200
|
+
return i && (t = t.replace("capture", "")), {
|
|
201
|
+
device: t,
|
|
202
|
+
capture: i,
|
|
203
|
+
passive: n
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function ne(e, t = "") {
|
|
207
|
+
let n = O[e];
|
|
208
|
+
return e + (n && n[t] || t);
|
|
209
|
+
}
|
|
210
|
+
function N(e) {
|
|
211
|
+
return "touches" in e;
|
|
212
|
+
}
|
|
213
|
+
function re(e) {
|
|
214
|
+
return N(e) ? "touch" : "pointerType" in e ? e.pointerType : "mouse";
|
|
215
|
+
}
|
|
216
|
+
function ie(e) {
|
|
217
|
+
return Array.from(e.touches).filter((t) => {
|
|
218
|
+
var n, r;
|
|
219
|
+
return t.target === e.currentTarget || ((n = e.currentTarget) == null || (r = n.contains) == null ? void 0 : r.call(n, t.target));
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function ae(e) {
|
|
223
|
+
return e.type === "touchend" || e.type === "touchcancel" ? e.changedTouches : e.targetTouches;
|
|
224
|
+
}
|
|
225
|
+
function oe(e) {
|
|
226
|
+
return N(e) ? ae(e)[0] : e;
|
|
227
|
+
}
|
|
228
|
+
function se(e, t) {
|
|
229
|
+
try {
|
|
230
|
+
let n = t.clientX - e.clientX, r = t.clientY - e.clientY, i = (t.clientX + e.clientX) / 2, a = (t.clientY + e.clientY) / 2, o = Math.hypot(n, r);
|
|
231
|
+
return {
|
|
232
|
+
angle: -(Math.atan2(n, r) * 180) / Math.PI,
|
|
233
|
+
distance: o,
|
|
234
|
+
origin: [i, a]
|
|
235
|
+
};
|
|
236
|
+
} catch {}
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
function ce(e) {
|
|
240
|
+
return ie(e).map((e) => e.identifier);
|
|
241
|
+
}
|
|
242
|
+
function le(e, t) {
|
|
243
|
+
let [n, r] = Array.from(e.touches).filter((e) => t.includes(e.identifier));
|
|
244
|
+
return se(n, r);
|
|
245
|
+
}
|
|
246
|
+
function ue(e) {
|
|
247
|
+
let t = oe(e);
|
|
248
|
+
return N(e) ? t.identifier : t.pointerId;
|
|
249
|
+
}
|
|
250
|
+
function P(e) {
|
|
251
|
+
let t = oe(e);
|
|
252
|
+
return [t.clientX, t.clientY];
|
|
253
|
+
}
|
|
254
|
+
var de = 40, fe = 800;
|
|
255
|
+
function pe(e) {
|
|
256
|
+
let { deltaX: t, deltaY: n, deltaMode: r } = e;
|
|
257
|
+
return r === 1 ? (t *= de, n *= de) : r === 2 && (t *= fe, n *= fe), [t, n];
|
|
258
|
+
}
|
|
259
|
+
function me(e) {
|
|
260
|
+
let { scrollX: t, scrollY: n, scrollLeft: r, scrollTop: i } = e.currentTarget;
|
|
261
|
+
return [t ?? r ?? 0, n ?? i ?? 0];
|
|
262
|
+
}
|
|
263
|
+
function he(e) {
|
|
264
|
+
let t = {};
|
|
265
|
+
if ("buttons" in e && (t.buttons = e.buttons), "shiftKey" in e) {
|
|
266
|
+
let { shiftKey: n, altKey: r, metaKey: i, ctrlKey: a } = e;
|
|
267
|
+
Object.assign(t, {
|
|
268
|
+
shiftKey: n,
|
|
269
|
+
altKey: r,
|
|
270
|
+
metaKey: i,
|
|
271
|
+
ctrlKey: a
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
return t;
|
|
275
|
+
}
|
|
276
|
+
function F(e, ...t) {
|
|
277
|
+
return typeof e == "function" ? e(...t) : e;
|
|
278
|
+
}
|
|
279
|
+
function ge() {}
|
|
280
|
+
function _e(...e) {
|
|
281
|
+
return e.length === 0 ? ge : e.length === 1 ? e[0] : function() {
|
|
282
|
+
let t;
|
|
283
|
+
for (let n of e) t = n.apply(this, arguments) || t;
|
|
284
|
+
return t;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function ve(e, t) {
|
|
288
|
+
return Object.assign({}, t, e || {});
|
|
289
|
+
}
|
|
290
|
+
var ye = 32, be = class {
|
|
291
|
+
constructor(e, t, n) {
|
|
292
|
+
this.ctrl = e, this.args = t, this.key = n, this.state || (this.state = {}, this.computeValues([0, 0]), this.computeInitial(), this.init && this.init(), this.reset());
|
|
293
|
+
}
|
|
294
|
+
get state() {
|
|
295
|
+
return this.ctrl.state[this.key];
|
|
296
|
+
}
|
|
297
|
+
set state(e) {
|
|
298
|
+
this.ctrl.state[this.key] = e;
|
|
299
|
+
}
|
|
300
|
+
get shared() {
|
|
301
|
+
return this.ctrl.state.shared;
|
|
302
|
+
}
|
|
303
|
+
get eventStore() {
|
|
304
|
+
return this.ctrl.gestureEventStores[this.key];
|
|
305
|
+
}
|
|
306
|
+
get timeoutStore() {
|
|
307
|
+
return this.ctrl.gestureTimeoutStores[this.key];
|
|
308
|
+
}
|
|
309
|
+
get config() {
|
|
310
|
+
return this.ctrl.config[this.key];
|
|
311
|
+
}
|
|
312
|
+
get sharedConfig() {
|
|
313
|
+
return this.ctrl.config.shared;
|
|
314
|
+
}
|
|
315
|
+
get handler() {
|
|
316
|
+
return this.ctrl.handlers[this.key];
|
|
317
|
+
}
|
|
318
|
+
reset() {
|
|
319
|
+
let { state: e, shared: t, ingKey: n, args: r } = this;
|
|
320
|
+
t[n] = e._active = e.active = e._blocked = e._force = !1, e._step = [!1, !1], e.intentional = !1, e._movement = [0, 0], e._distance = [0, 0], e._direction = [0, 0], e._delta = [0, 0], e._bounds = [[-Infinity, Infinity], [-Infinity, Infinity]], e.args = r, e.axis = void 0, e.memo = void 0, e.elapsedTime = e.timeDelta = 0, e.direction = [0, 0], e.distance = [0, 0], e.overflow = [0, 0], e._movementBound = [!1, !1], e.velocity = [0, 0], e.movement = [0, 0], e.delta = [0, 0], e.timeStamp = 0;
|
|
321
|
+
}
|
|
322
|
+
start(e) {
|
|
323
|
+
let t = this.state, n = this.config;
|
|
324
|
+
t._active || (this.reset(), this.computeInitial(), t._active = !0, t.target = e.target, t.currentTarget = e.currentTarget, t.lastOffset = n.from ? F(n.from, t) : t.offset, t.offset = t.lastOffset, t.startTime = t.timeStamp = e.timeStamp);
|
|
325
|
+
}
|
|
326
|
+
computeValues(e) {
|
|
327
|
+
let t = this.state;
|
|
328
|
+
t._values = e, t.values = this.config.transform(e);
|
|
329
|
+
}
|
|
330
|
+
computeInitial() {
|
|
331
|
+
let e = this.state;
|
|
332
|
+
e._initial = e._values, e.initial = e.values;
|
|
333
|
+
}
|
|
334
|
+
compute(e) {
|
|
335
|
+
let { state: t, config: n, shared: r } = this;
|
|
336
|
+
t.args = this.args;
|
|
337
|
+
let i = 0;
|
|
338
|
+
if (e && (t.event = e, n.preventDefault && e.cancelable && t.event.preventDefault(), t.type = e.type, r.touches = this.ctrl.pointerIds.size || this.ctrl.touchIds.size, r.locked = !!document.pointerLockElement, Object.assign(r, he(e)), r.down = r.pressed = r.buttons % 2 == 1 || r.touches > 0, i = e.timeStamp - t.timeStamp, t.timeStamp = e.timeStamp, t.elapsedTime = t.timeStamp - t.startTime), t._active) {
|
|
339
|
+
let e = t._delta.map(Math.abs);
|
|
340
|
+
y.addTo(t._distance, e);
|
|
341
|
+
}
|
|
342
|
+
this.axisIntent && this.axisIntent(e);
|
|
343
|
+
let [a, o] = t._movement, [s, c] = n.threshold, { _step: l, values: u } = t;
|
|
344
|
+
if (n.hasCustomTransform ? (l[0] === !1 && (l[0] = Math.abs(a) >= s && u[0]), l[1] === !1 && (l[1] = Math.abs(o) >= c && u[1])) : (l[0] === !1 && (l[0] = Math.abs(a) >= s && Math.sign(a) * s), l[1] === !1 && (l[1] = Math.abs(o) >= c && Math.sign(o) * c)), t.intentional = l[0] !== !1 || l[1] !== !1, !t.intentional) return;
|
|
345
|
+
let d = [0, 0];
|
|
346
|
+
if (n.hasCustomTransform) {
|
|
347
|
+
let [e, t] = u;
|
|
348
|
+
d[0] = l[0] === !1 ? 0 : e - l[0], d[1] = l[1] === !1 ? 0 : t - l[1];
|
|
349
|
+
} else d[0] = l[0] === !1 ? 0 : a - l[0], d[1] = l[1] === !1 ? 0 : o - l[1];
|
|
350
|
+
this.restrictToAxis && !t._blocked && this.restrictToAxis(d);
|
|
351
|
+
let f = t.offset, p = t._active && !t._blocked || t.active;
|
|
352
|
+
p && (t.first = t._active && !t.active, t.last = !t._active && t.active, t.active = r[this.ingKey] = t._active, e && (t.first && ("bounds" in n && (t._bounds = F(n.bounds, t)), this.setup && this.setup()), t.movement = d, this.computeOffset()));
|
|
353
|
+
let [m, h] = t.offset, [[g, _], [v, b]] = t._bounds;
|
|
354
|
+
t.overflow = [m < g ? -1 : +(m > _), h < v ? -1 : +(h > b)], t._movementBound[0] = t.overflow[0] ? t._movementBound[0] === !1 ? t._movement[0] : t._movementBound[0] : !1, t._movementBound[1] = t.overflow[1] ? t._movementBound[1] === !1 ? t._movement[1] : t._movementBound[1] : !1;
|
|
355
|
+
let x = t._active && n.rubberband || [0, 0];
|
|
356
|
+
if (t.offset = S(t._bounds, t.offset, x), t.delta = y.sub(t.offset, f), this.computeMovement(), p && (!t.last || i > ye)) {
|
|
357
|
+
t.delta = y.sub(t.offset, f);
|
|
358
|
+
let e = t.delta.map(Math.abs);
|
|
359
|
+
y.addTo(t.distance, e), t.direction = t.delta.map(Math.sign), t._direction = t._delta.map(Math.sign), !t.first && i > 0 && (t.velocity = [e[0] / i, e[1] / i], t.timeDelta = i);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
emit() {
|
|
363
|
+
let e = this.state, t = this.shared, n = this.config;
|
|
364
|
+
if (e._active || this.clean(), (e._blocked || !e.intentional) && !e._force && !n.triggerAllEvents) return;
|
|
365
|
+
let r = this.handler(D(D(D({}, t), e), {}, { [this.aliasKey]: e.values }));
|
|
366
|
+
r !== void 0 && (e.memo = r);
|
|
367
|
+
}
|
|
368
|
+
clean() {
|
|
369
|
+
this.eventStore.clean(), this.timeoutStore.clean();
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
function xe([e, t], n) {
|
|
373
|
+
let r = Math.abs(e), i = Math.abs(t);
|
|
374
|
+
if (r > i && r > n) return "x";
|
|
375
|
+
if (i > r && i > n) return "y";
|
|
376
|
+
}
|
|
377
|
+
var I = class extends be {
|
|
378
|
+
constructor(...e) {
|
|
379
|
+
super(...e), T(this, "aliasKey", "xy");
|
|
380
|
+
}
|
|
381
|
+
reset() {
|
|
382
|
+
super.reset(), this.state.axis = void 0;
|
|
383
|
+
}
|
|
384
|
+
init() {
|
|
385
|
+
this.state.offset = [0, 0], this.state.lastOffset = [0, 0];
|
|
386
|
+
}
|
|
387
|
+
computeOffset() {
|
|
388
|
+
this.state.offset = y.add(this.state.lastOffset, this.state.movement);
|
|
389
|
+
}
|
|
390
|
+
computeMovement() {
|
|
391
|
+
this.state.movement = y.sub(this.state.offset, this.state.lastOffset);
|
|
392
|
+
}
|
|
393
|
+
axisIntent(e) {
|
|
394
|
+
let t = this.state, n = this.config;
|
|
395
|
+
if (!t.axis && e) {
|
|
396
|
+
let r = typeof n.axisThreshold == "object" ? n.axisThreshold[re(e)] : n.axisThreshold;
|
|
397
|
+
t.axis = xe(t._movement, r);
|
|
398
|
+
}
|
|
399
|
+
t._blocked = (n.lockDirection || !!n.axis) && !t.axis || !!n.axis && n.axis !== t.axis;
|
|
400
|
+
}
|
|
401
|
+
restrictToAxis(e) {
|
|
402
|
+
if (this.config.axis || this.config.lockDirection) switch (this.state.axis) {
|
|
403
|
+
case "x":
|
|
404
|
+
e[1] = 0;
|
|
405
|
+
break;
|
|
406
|
+
case "y": e[0] = 0;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}, Se = (e) => e, Ce = .15, we = {
|
|
410
|
+
enabled(e = !0) {
|
|
411
|
+
return e;
|
|
412
|
+
},
|
|
413
|
+
eventOptions(e, t, n) {
|
|
414
|
+
return D(D({}, n.shared.eventOptions), e);
|
|
415
|
+
},
|
|
416
|
+
preventDefault(e = !1) {
|
|
417
|
+
return e;
|
|
418
|
+
},
|
|
419
|
+
triggerAllEvents(e = !1) {
|
|
420
|
+
return e;
|
|
421
|
+
},
|
|
422
|
+
rubberband(e = 0) {
|
|
423
|
+
switch (e) {
|
|
424
|
+
case !0: return [Ce, Ce];
|
|
425
|
+
case !1: return [0, 0];
|
|
426
|
+
default: return y.toVector(e);
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
from(e) {
|
|
430
|
+
if (typeof e == "function") return e;
|
|
431
|
+
if (e != null) return y.toVector(e);
|
|
432
|
+
},
|
|
433
|
+
transform(e, t, n) {
|
|
434
|
+
let r = e || n.shared.transform;
|
|
435
|
+
if (this.hasCustomTransform = !!r, process.env.NODE_ENV === "development") {
|
|
436
|
+
let e = r || Se;
|
|
437
|
+
return (t) => {
|
|
438
|
+
let n = e(t);
|
|
439
|
+
return isFinite(n[0]) && isFinite(n[1]) || console.warn(`[@use-gesture]: config.transform() must produce a valid result, but it was: [${n[0]},1]`), n;
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
return r || Se;
|
|
443
|
+
},
|
|
444
|
+
threshold(e) {
|
|
445
|
+
return y.toVector(e, 0);
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
process.env.NODE_ENV === "development" && Object.assign(we, {
|
|
449
|
+
domTarget(e) {
|
|
450
|
+
if (e !== void 0) throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
451
|
+
return NaN;
|
|
452
|
+
},
|
|
453
|
+
lockDirection(e) {
|
|
454
|
+
if (e !== void 0) throw Error("[@use-gesture]: `lockDirection` option has been merged with `axis`. Use it as in `{ axis: 'lock' }`");
|
|
455
|
+
return NaN;
|
|
456
|
+
},
|
|
457
|
+
initial(e) {
|
|
458
|
+
if (e !== void 0) throw Error("[@use-gesture]: `initial` option has been renamed to `from`.");
|
|
459
|
+
return NaN;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
var Te = 0, L = D(D({}, we), {}, {
|
|
463
|
+
axis(e, t, { axis: n }) {
|
|
464
|
+
if (this.lockDirection = n === "lock", !this.lockDirection) return n;
|
|
465
|
+
},
|
|
466
|
+
axisThreshold(e = Te) {
|
|
467
|
+
return e;
|
|
468
|
+
},
|
|
469
|
+
bounds(e = {}) {
|
|
470
|
+
if (typeof e == "function") return (t) => L.bounds(e(t));
|
|
471
|
+
if ("current" in e) return () => e.current;
|
|
472
|
+
if (typeof HTMLElement == "function" && e instanceof HTMLElement) return e;
|
|
473
|
+
let { left: t = -Infinity, right: n = Infinity, top: r = -Infinity, bottom: i = Infinity } = e;
|
|
474
|
+
return [[t, n], [r, i]];
|
|
475
|
+
}
|
|
476
|
+
}), Ee = {
|
|
477
|
+
ArrowRight: (e, t = 1) => [e * t, 0],
|
|
478
|
+
ArrowLeft: (e, t = 1) => [-1 * e * t, 0],
|
|
479
|
+
ArrowUp: (e, t = 1) => [0, -1 * e * t],
|
|
480
|
+
ArrowDown: (e, t = 1) => [0, e * t]
|
|
481
|
+
}, De = class extends I {
|
|
482
|
+
constructor(...e) {
|
|
483
|
+
super(...e), T(this, "ingKey", "dragging");
|
|
484
|
+
}
|
|
485
|
+
reset() {
|
|
486
|
+
super.reset();
|
|
487
|
+
let e = this.state;
|
|
488
|
+
e._pointerId = void 0, e._pointerActive = !1, e._keyboardActive = !1, e._preventScroll = !1, e._delayed = !1, e.swipe = [0, 0], e.tap = !1, e.canceled = !1, e.cancel = this.cancel.bind(this);
|
|
489
|
+
}
|
|
490
|
+
setup() {
|
|
491
|
+
let e = this.state;
|
|
492
|
+
if (e._bounds instanceof HTMLElement) {
|
|
493
|
+
let t = e._bounds.getBoundingClientRect(), n = e.currentTarget.getBoundingClientRect(), r = {
|
|
494
|
+
left: t.left - n.left + e.offset[0],
|
|
495
|
+
right: t.right - n.right + e.offset[0],
|
|
496
|
+
top: t.top - n.top + e.offset[1],
|
|
497
|
+
bottom: t.bottom - n.bottom + e.offset[1]
|
|
498
|
+
};
|
|
499
|
+
e._bounds = L.bounds(r);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
cancel() {
|
|
503
|
+
let e = this.state;
|
|
504
|
+
e.canceled || (e.canceled = !0, e._active = !1, setTimeout(() => {
|
|
505
|
+
this.compute(), this.emit();
|
|
506
|
+
}, 0));
|
|
507
|
+
}
|
|
508
|
+
setActive() {
|
|
509
|
+
this.state._active = this.state._pointerActive || this.state._keyboardActive;
|
|
510
|
+
}
|
|
511
|
+
clean() {
|
|
512
|
+
this.pointerClean(), this.state._pointerActive = !1, this.state._keyboardActive = !1, super.clean();
|
|
513
|
+
}
|
|
514
|
+
pointerDown(e) {
|
|
515
|
+
let t = this.config, n = this.state;
|
|
516
|
+
if (e.buttons != null && (Array.isArray(t.pointerButtons) ? !t.pointerButtons.includes(e.buttons) : t.pointerButtons !== -1 && t.pointerButtons !== e.buttons)) return;
|
|
517
|
+
let r = this.ctrl.setEventIds(e);
|
|
518
|
+
t.pointerCapture && e.target.setPointerCapture(e.pointerId), !(r && r.size > 1 && n._pointerActive) && (this.start(e), this.setupPointer(e), n._pointerId = ue(e), n._pointerActive = !0, this.computeValues(P(e)), this.computeInitial(), t.preventScrollAxis && re(e) !== "mouse" ? (n._active = !1, this.setupScrollPrevention(e)) : t.delay > 0 ? (this.setupDelayTrigger(e), t.triggerAllEvents && (this.compute(e), this.emit())) : this.startPointerDrag(e));
|
|
519
|
+
}
|
|
520
|
+
startPointerDrag(e) {
|
|
521
|
+
let t = this.state;
|
|
522
|
+
t._active = !0, t._preventScroll = !0, t._delayed = !1, this.compute(e), this.emit();
|
|
523
|
+
}
|
|
524
|
+
pointerMove(e) {
|
|
525
|
+
let t = this.state, n = this.config;
|
|
526
|
+
if (!t._pointerActive) return;
|
|
527
|
+
let r = ue(e);
|
|
528
|
+
if (t._pointerId !== void 0 && r !== t._pointerId) return;
|
|
529
|
+
let i = P(e);
|
|
530
|
+
if (document.pointerLockElement === e.target ? t._delta = [e.movementX, e.movementY] : (t._delta = y.sub(i, t._values), this.computeValues(i)), y.addTo(t._movement, t._delta), this.compute(e), t._delayed && t.intentional) this.timeoutStore.remove("dragDelay"), t.active = !1, this.startPointerDrag(e);
|
|
531
|
+
else if (n.preventScrollAxis && !t._preventScroll) {
|
|
532
|
+
if (t.axis) {
|
|
533
|
+
if (t.axis === n.preventScrollAxis || n.preventScrollAxis === "xy") {
|
|
534
|
+
t._active = !1, this.clean();
|
|
535
|
+
return;
|
|
536
|
+
}
|
|
537
|
+
this.timeoutStore.remove("startPointerDrag"), this.startPointerDrag(e);
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
} else this.emit();
|
|
541
|
+
}
|
|
542
|
+
pointerUp(e) {
|
|
543
|
+
this.ctrl.setEventIds(e);
|
|
544
|
+
try {
|
|
545
|
+
this.config.pointerCapture && e.target.hasPointerCapture(e.pointerId) && e.target.releasePointerCapture(e.pointerId);
|
|
546
|
+
} catch {
|
|
547
|
+
process.env.NODE_ENV === "development" && console.warn("[@use-gesture]: If you see this message, it's likely that you're using an outdated version of `@react-three/fiber`. \n\nPlease upgrade to the latest version.");
|
|
548
|
+
}
|
|
549
|
+
let t = this.state, n = this.config;
|
|
550
|
+
if (!t._active || !t._pointerActive) return;
|
|
551
|
+
let r = ue(e);
|
|
552
|
+
if (t._pointerId !== void 0 && r !== t._pointerId) return;
|
|
553
|
+
this.state._pointerActive = !1, this.setActive(), this.compute(e);
|
|
554
|
+
let [i, a] = t._distance;
|
|
555
|
+
if (t.tap = i <= n.tapsThreshold && a <= n.tapsThreshold, t.tap && n.filterTaps) t._force = !0;
|
|
556
|
+
else {
|
|
557
|
+
let [e, r] = t._delta, [i, a] = t._movement, [o, s] = n.swipe.velocity, [c, l] = n.swipe.distance, u = n.swipe.duration;
|
|
558
|
+
if (t.elapsedTime < u) {
|
|
559
|
+
let n = Math.abs(e / t.timeDelta), u = Math.abs(r / t.timeDelta);
|
|
560
|
+
n > o && Math.abs(i) > c && (t.swipe[0] = Math.sign(e)), u > s && Math.abs(a) > l && (t.swipe[1] = Math.sign(r));
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
this.emit();
|
|
564
|
+
}
|
|
565
|
+
pointerClick(e) {
|
|
566
|
+
!this.state.tap && e.detail > 0 && (e.preventDefault(), e.stopPropagation());
|
|
567
|
+
}
|
|
568
|
+
setupPointer(e) {
|
|
569
|
+
let t = this.config, n = t.device;
|
|
570
|
+
if (process.env.NODE_ENV === "development") try {
|
|
571
|
+
if (n === "pointer" && t.preventScrollDelay === void 0) {
|
|
572
|
+
let t = "uv" in e ? e.sourceEvent.currentTarget : e.currentTarget;
|
|
573
|
+
window.getComputedStyle(t).touchAction === "auto" && console.warn("[@use-gesture]: The drag target has its `touch-action` style property set to `auto`. It is recommended to add `touch-action: 'none'` so that the drag gesture behaves correctly on touch-enabled devices. For more information read this: https://use-gesture.netlify.app/docs/extras/#touch-action.\n\nThis message will only show in development mode. It won't appear in production. If this is intended, you can ignore it.", t);
|
|
574
|
+
}
|
|
575
|
+
} catch {}
|
|
576
|
+
t.pointerLock && e.currentTarget.requestPointerLock(), t.pointerCapture || (this.eventStore.add(this.sharedConfig.window, n, "change", this.pointerMove.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "end", this.pointerUp.bind(this)), this.eventStore.add(this.sharedConfig.window, n, "cancel", this.pointerUp.bind(this)));
|
|
577
|
+
}
|
|
578
|
+
pointerClean() {
|
|
579
|
+
this.config.pointerLock && document.pointerLockElement === this.state.currentTarget && document.exitPointerLock();
|
|
580
|
+
}
|
|
581
|
+
preventScroll(e) {
|
|
582
|
+
this.state._preventScroll && e.cancelable && e.preventDefault();
|
|
583
|
+
}
|
|
584
|
+
setupScrollPrevention(e) {
|
|
585
|
+
this.state._preventScroll = !1, Oe(e);
|
|
586
|
+
let t = this.eventStore.add(this.sharedConfig.window, "touch", "change", this.preventScroll.bind(this), { passive: !1 });
|
|
587
|
+
this.eventStore.add(this.sharedConfig.window, "touch", "end", t), this.eventStore.add(this.sharedConfig.window, "touch", "cancel", t), this.timeoutStore.add("startPointerDrag", this.startPointerDrag.bind(this), this.config.preventScrollDelay, e);
|
|
588
|
+
}
|
|
589
|
+
setupDelayTrigger(e) {
|
|
590
|
+
this.state._delayed = !0, this.timeoutStore.add("dragDelay", () => {
|
|
591
|
+
this.state._step = [0, 0], this.startPointerDrag(e);
|
|
592
|
+
}, this.config.delay);
|
|
593
|
+
}
|
|
594
|
+
keyDown(e) {
|
|
595
|
+
let t = Ee[e.key];
|
|
596
|
+
if (t) {
|
|
597
|
+
let n = this.state, r = e.shiftKey ? 10 : e.altKey ? .1 : 1;
|
|
598
|
+
this.start(e), n._delta = t(this.config.keyboardDisplacement, r), n._keyboardActive = !0, y.addTo(n._movement, n._delta), this.compute(e), this.emit();
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
keyUp(e) {
|
|
602
|
+
e.key in Ee && (this.state._keyboardActive = !1, this.setActive(), this.compute(e), this.emit());
|
|
603
|
+
}
|
|
604
|
+
bind(e) {
|
|
605
|
+
let t = this.config.device;
|
|
606
|
+
e(t, "start", this.pointerDown.bind(this)), this.config.pointerCapture && (e(t, "change", this.pointerMove.bind(this)), e(t, "end", this.pointerUp.bind(this)), e(t, "cancel", this.pointerUp.bind(this)), e("lostPointerCapture", "", this.pointerUp.bind(this))), this.config.keys && (e("key", "down", this.keyDown.bind(this)), e("key", "up", this.keyUp.bind(this))), this.config.filterTaps && e("click", "", this.pointerClick.bind(this), {
|
|
607
|
+
capture: !0,
|
|
608
|
+
passive: !1
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
};
|
|
612
|
+
function Oe(e) {
|
|
613
|
+
"persist" in e && typeof e.persist == "function" && e.persist();
|
|
614
|
+
}
|
|
615
|
+
var R = typeof window < "u" && window.document && window.document.createElement;
|
|
616
|
+
function ke() {
|
|
617
|
+
return R && "ontouchstart" in window;
|
|
618
|
+
}
|
|
619
|
+
function Ae() {
|
|
620
|
+
return ke() || R && window.navigator.maxTouchPoints > 1;
|
|
621
|
+
}
|
|
622
|
+
function je() {
|
|
623
|
+
return R && "onpointerdown" in window;
|
|
624
|
+
}
|
|
625
|
+
function Me() {
|
|
626
|
+
return R && "exitPointerLock" in window.document;
|
|
627
|
+
}
|
|
628
|
+
function Ne() {
|
|
629
|
+
try {
|
|
630
|
+
return "constructor" in GestureEvent;
|
|
631
|
+
} catch {
|
|
632
|
+
return !1;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
var z = {
|
|
636
|
+
isBrowser: R,
|
|
637
|
+
gesture: Ne(),
|
|
638
|
+
touch: ke(),
|
|
639
|
+
touchscreen: Ae(),
|
|
640
|
+
pointer: je(),
|
|
641
|
+
pointerLock: Me()
|
|
642
|
+
}, Pe = 250, Fe = 180, Ie = .5, Le = 50, Re = 250, ze = 10, Be = {
|
|
643
|
+
mouse: 0,
|
|
644
|
+
touch: 0,
|
|
645
|
+
pen: 8
|
|
646
|
+
}, Ve = D(D({}, L), {}, {
|
|
647
|
+
device(e, t, { pointer: { touch: n = !1, lock: r = !1, mouse: i = !1 } = {} }) {
|
|
648
|
+
return this.pointerLock = r && z.pointerLock, z.touch && n ? "touch" : this.pointerLock ? "mouse" : z.pointer && !i ? "pointer" : z.touch ? "touch" : "mouse";
|
|
649
|
+
},
|
|
650
|
+
preventScrollAxis(e, t, { preventScroll: n }) {
|
|
651
|
+
if (this.preventScrollDelay = typeof n == "number" ? n : n || n === void 0 && e ? Pe : void 0, z.touchscreen && n !== !1) return e || (n === void 0 ? void 0 : "y");
|
|
652
|
+
},
|
|
653
|
+
pointerCapture(e, t, { pointer: { capture: n = !0, buttons: r = 1, keys: i = !0 } = {} }) {
|
|
654
|
+
return this.pointerButtons = r, this.keys = i, !this.pointerLock && this.device === "pointer" && n;
|
|
655
|
+
},
|
|
656
|
+
threshold(e, t, { filterTaps: n = !1, tapsThreshold: r = 3, axis: i = void 0 }) {
|
|
657
|
+
let a = y.toVector(e, n ? r : +!!i);
|
|
658
|
+
return this.filterTaps = n, this.tapsThreshold = r, a;
|
|
659
|
+
},
|
|
660
|
+
swipe({ velocity: e = Ie, distance: t = Le, duration: n = Re } = {}) {
|
|
661
|
+
return {
|
|
662
|
+
velocity: this.transform(y.toVector(e)),
|
|
663
|
+
distance: this.transform(y.toVector(t)),
|
|
664
|
+
duration: n
|
|
665
|
+
};
|
|
666
|
+
},
|
|
667
|
+
delay(e = 0) {
|
|
668
|
+
switch (e) {
|
|
669
|
+
case !0: return Fe;
|
|
670
|
+
case !1: return 0;
|
|
671
|
+
default: return e;
|
|
672
|
+
}
|
|
673
|
+
},
|
|
674
|
+
axisThreshold(e) {
|
|
675
|
+
return e ? D(D({}, Be), e) : Be;
|
|
676
|
+
},
|
|
677
|
+
keyboardDisplacement(e = ze) {
|
|
678
|
+
return e;
|
|
679
|
+
}
|
|
680
|
+
});
|
|
681
|
+
process.env.NODE_ENV === "development" && Object.assign(Ve, {
|
|
682
|
+
useTouch(e) {
|
|
683
|
+
if (e !== void 0) throw Error("[@use-gesture]: `useTouch` option has been renamed to `pointer.touch`. Use it as in `{ pointer: { touch: true } }`.");
|
|
684
|
+
return NaN;
|
|
685
|
+
},
|
|
686
|
+
experimental_preventWindowScrollY(e) {
|
|
687
|
+
if (e !== void 0) throw Error("[@use-gesture]: `experimental_preventWindowScrollY` option has been renamed to `preventScroll`.");
|
|
688
|
+
return NaN;
|
|
689
|
+
},
|
|
690
|
+
swipeVelocity(e) {
|
|
691
|
+
if (e !== void 0) throw Error("[@use-gesture]: `swipeVelocity` option has been renamed to `swipe.velocity`. Use it as in `{ swipe: { velocity: 0.5 } }`.");
|
|
692
|
+
return NaN;
|
|
693
|
+
},
|
|
694
|
+
swipeDistance(e) {
|
|
695
|
+
if (e !== void 0) throw Error("[@use-gesture]: `swipeDistance` option has been renamed to `swipe.distance`. Use it as in `{ swipe: { distance: 50 } }`.");
|
|
696
|
+
return NaN;
|
|
697
|
+
},
|
|
698
|
+
swipeDuration(e) {
|
|
699
|
+
if (e !== void 0) throw Error("[@use-gesture]: `swipeDuration` option has been renamed to `swipe.duration`. Use it as in `{ swipe: { duration: 250 } }`.");
|
|
700
|
+
return NaN;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
function He(e) {
|
|
704
|
+
let [t, n] = e.overflow, [r, i] = e._delta, [a, o] = e._direction;
|
|
705
|
+
(t < 0 && r > 0 && a < 0 || t > 0 && r < 0 && a > 0) && (e._movement[0] = e._movementBound[0]), (n < 0 && i > 0 && o < 0 || n > 0 && i < 0 && o > 0) && (e._movement[1] = e._movementBound[1]);
|
|
706
|
+
}
|
|
707
|
+
var Ue = 30, We = 100, Ge = class extends be {
|
|
708
|
+
constructor(...e) {
|
|
709
|
+
super(...e), T(this, "ingKey", "pinching"), T(this, "aliasKey", "da");
|
|
710
|
+
}
|
|
711
|
+
init() {
|
|
712
|
+
this.state.offset = [1, 0], this.state.lastOffset = [1, 0], this.state._pointerEvents = /* @__PURE__ */ new Map();
|
|
713
|
+
}
|
|
714
|
+
reset() {
|
|
715
|
+
super.reset();
|
|
716
|
+
let e = this.state;
|
|
717
|
+
e._touchIds = [], e.canceled = !1, e.cancel = this.cancel.bind(this), e.turns = 0;
|
|
718
|
+
}
|
|
719
|
+
computeOffset() {
|
|
720
|
+
let { type: e, movement: t, lastOffset: n } = this.state;
|
|
721
|
+
e === "wheel" ? this.state.offset = y.add(t, n) : this.state.offset = [(1 + t[0]) * n[0], t[1] + n[1]];
|
|
722
|
+
}
|
|
723
|
+
computeMovement() {
|
|
724
|
+
let { offset: e, lastOffset: t } = this.state;
|
|
725
|
+
this.state.movement = [e[0] / t[0], e[1] - t[1]];
|
|
726
|
+
}
|
|
727
|
+
axisIntent() {
|
|
728
|
+
let e = this.state, [t, n] = e._movement;
|
|
729
|
+
if (!e.axis) {
|
|
730
|
+
let r = Math.abs(t) * Ue - Math.abs(n);
|
|
731
|
+
r < 0 ? e.axis = "angle" : r > 0 && (e.axis = "scale");
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
restrictToAxis(e) {
|
|
735
|
+
this.config.lockDirection && (this.state.axis === "scale" ? e[1] = 0 : this.state.axis === "angle" && (e[0] = 0));
|
|
736
|
+
}
|
|
737
|
+
cancel() {
|
|
738
|
+
let e = this.state;
|
|
739
|
+
e.canceled || setTimeout(() => {
|
|
740
|
+
e.canceled = !0, e._active = !1, this.compute(), this.emit();
|
|
741
|
+
}, 0);
|
|
742
|
+
}
|
|
743
|
+
touchStart(e) {
|
|
744
|
+
this.ctrl.setEventIds(e);
|
|
745
|
+
let t = this.state, n = this.ctrl.touchIds;
|
|
746
|
+
if (t._active && t._touchIds.every((e) => n.has(e)) || n.size < 2) return;
|
|
747
|
+
this.start(e), t._touchIds = Array.from(n).slice(0, 2);
|
|
748
|
+
let r = le(e, t._touchIds);
|
|
749
|
+
r && this.pinchStart(e, r);
|
|
750
|
+
}
|
|
751
|
+
pointerStart(e) {
|
|
752
|
+
if (e.buttons != null && e.buttons % 2 != 1) return;
|
|
753
|
+
this.ctrl.setEventIds(e), e.target.setPointerCapture(e.pointerId);
|
|
754
|
+
let t = this.state, n = t._pointerEvents, r = this.ctrl.pointerIds;
|
|
755
|
+
if (t._active && Array.from(n.keys()).every((e) => r.has(e)) || (n.size < 2 && n.set(e.pointerId, e), t._pointerEvents.size < 2)) return;
|
|
756
|
+
this.start(e);
|
|
757
|
+
let i = se(...Array.from(n.values()));
|
|
758
|
+
i && this.pinchStart(e, i);
|
|
759
|
+
}
|
|
760
|
+
pinchStart(e, t) {
|
|
761
|
+
let n = this.state;
|
|
762
|
+
n.origin = t.origin, this.computeValues([t.distance, t.angle]), this.computeInitial(), this.compute(e), this.emit();
|
|
763
|
+
}
|
|
764
|
+
touchMove(e) {
|
|
765
|
+
if (!this.state._active) return;
|
|
766
|
+
let t = le(e, this.state._touchIds);
|
|
767
|
+
t && this.pinchMove(e, t);
|
|
768
|
+
}
|
|
769
|
+
pointerMove(e) {
|
|
770
|
+
let t = this.state._pointerEvents;
|
|
771
|
+
if (t.has(e.pointerId) && t.set(e.pointerId, e), !this.state._active) return;
|
|
772
|
+
let n = se(...Array.from(t.values()));
|
|
773
|
+
n && this.pinchMove(e, n);
|
|
774
|
+
}
|
|
775
|
+
pinchMove(e, t) {
|
|
776
|
+
let n = this.state, r = n._values[1], i = t.angle - r, a = 0;
|
|
777
|
+
Math.abs(i) > 270 && (a += Math.sign(i)), this.computeValues([t.distance, t.angle - 360 * a]), n.origin = t.origin, n.turns = a, n._movement = [n._values[0] / n._initial[0] - 1, n._values[1] - n._initial[1]], this.compute(e), this.emit();
|
|
778
|
+
}
|
|
779
|
+
touchEnd(e) {
|
|
780
|
+
this.ctrl.setEventIds(e), this.state._active && this.state._touchIds.some((e) => !this.ctrl.touchIds.has(e)) && (this.state._active = !1, this.compute(e), this.emit());
|
|
781
|
+
}
|
|
782
|
+
pointerEnd(e) {
|
|
783
|
+
let t = this.state;
|
|
784
|
+
this.ctrl.setEventIds(e);
|
|
785
|
+
try {
|
|
786
|
+
e.target.releasePointerCapture(e.pointerId);
|
|
787
|
+
} catch {}
|
|
788
|
+
t._pointerEvents.has(e.pointerId) && t._pointerEvents.delete(e.pointerId), t._active && t._pointerEvents.size < 2 && (t._active = !1, this.compute(e), this.emit());
|
|
789
|
+
}
|
|
790
|
+
gestureStart(e) {
|
|
791
|
+
e.cancelable && e.preventDefault();
|
|
792
|
+
let t = this.state;
|
|
793
|
+
t._active || (this.start(e), this.computeValues([e.scale, e.rotation]), t.origin = [e.clientX, e.clientY], this.compute(e), this.emit());
|
|
794
|
+
}
|
|
795
|
+
gestureMove(e) {
|
|
796
|
+
if (e.cancelable && e.preventDefault(), !this.state._active) return;
|
|
797
|
+
let t = this.state;
|
|
798
|
+
this.computeValues([e.scale, e.rotation]), t.origin = [e.clientX, e.clientY];
|
|
799
|
+
let n = t._movement;
|
|
800
|
+
t._movement = [e.scale - 1, e.rotation], t._delta = y.sub(t._movement, n), this.compute(e), this.emit();
|
|
801
|
+
}
|
|
802
|
+
gestureEnd(e) {
|
|
803
|
+
this.state._active && (this.state._active = !1, this.compute(e), this.emit());
|
|
804
|
+
}
|
|
805
|
+
wheel(e) {
|
|
806
|
+
let t = this.config.modifierKey;
|
|
807
|
+
t && (Array.isArray(t) ? !t.find((t) => e[t]) : !e[t]) || (this.state._active ? this.wheelChange(e) : this.wheelStart(e), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this)));
|
|
808
|
+
}
|
|
809
|
+
wheelStart(e) {
|
|
810
|
+
this.start(e), this.wheelChange(e);
|
|
811
|
+
}
|
|
812
|
+
wheelChange(e) {
|
|
813
|
+
"uv" in e || (e.cancelable && e.preventDefault(), process.env.NODE_ENV === "development" && !e.defaultPrevented && console.warn("[@use-gesture]: To properly support zoom on trackpads, try using the `target` option.\n\nThis message will only appear in development mode."));
|
|
814
|
+
let t = this.state;
|
|
815
|
+
t._delta = [-pe(e)[1] / We * t.offset[0], 0], y.addTo(t._movement, t._delta), He(t), this.state.origin = [e.clientX, e.clientY], this.compute(e), this.emit();
|
|
816
|
+
}
|
|
817
|
+
wheelEnd() {
|
|
818
|
+
this.state._active && (this.state._active = !1, this.compute(), this.emit());
|
|
819
|
+
}
|
|
820
|
+
bind(e) {
|
|
821
|
+
let t = this.config.device;
|
|
822
|
+
t && (e(t, "start", this[t + "Start"].bind(this)), e(t, "change", this[t + "Move"].bind(this)), e(t, "end", this[t + "End"].bind(this)), e(t, "cancel", this[t + "End"].bind(this)), e("lostPointerCapture", "", this[t + "End"].bind(this))), this.config.pinchOnWheel && e("wheel", "", this.wheel.bind(this), { passive: !1 });
|
|
823
|
+
}
|
|
824
|
+
}, Ke = D(D({}, we), {}, {
|
|
825
|
+
device(e, t, { shared: n, pointer: { touch: r = !1 } = {} }) {
|
|
826
|
+
if (n.target && !z.touch && z.gesture) return "gesture";
|
|
827
|
+
if (z.touch && r) return "touch";
|
|
828
|
+
if (z.touchscreen) {
|
|
829
|
+
if (z.pointer) return "pointer";
|
|
830
|
+
if (z.touch) return "touch";
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
bounds(e, t, { scaleBounds: n = {}, angleBounds: r = {} }) {
|
|
834
|
+
let i = (e) => {
|
|
835
|
+
let t = ve(F(n, e), {
|
|
836
|
+
min: -Infinity,
|
|
837
|
+
max: Infinity
|
|
838
|
+
});
|
|
839
|
+
return [t.min, t.max];
|
|
840
|
+
}, a = (e) => {
|
|
841
|
+
let t = ve(F(r, e), {
|
|
842
|
+
min: -Infinity,
|
|
843
|
+
max: Infinity
|
|
844
|
+
});
|
|
845
|
+
return [t.min, t.max];
|
|
846
|
+
};
|
|
847
|
+
return typeof n != "function" && typeof r != "function" ? [i(), a()] : (e) => [i(e), a(e)];
|
|
848
|
+
},
|
|
849
|
+
threshold(e, t, n) {
|
|
850
|
+
return this.lockDirection = n.axis === "lock", y.toVector(e, this.lockDirection ? [.1, 3] : 0);
|
|
851
|
+
},
|
|
852
|
+
modifierKey(e) {
|
|
853
|
+
return e === void 0 ? "ctrlKey" : e;
|
|
854
|
+
},
|
|
855
|
+
pinchOnWheel(e = !0) {
|
|
856
|
+
return e;
|
|
857
|
+
}
|
|
858
|
+
}), qe = class extends I {
|
|
859
|
+
constructor(...e) {
|
|
860
|
+
super(...e), T(this, "ingKey", "moving");
|
|
861
|
+
}
|
|
862
|
+
move(e) {
|
|
863
|
+
this.config.mouseOnly && e.pointerType !== "mouse" || (this.state._active ? this.moveChange(e) : this.moveStart(e), this.timeoutStore.add("moveEnd", this.moveEnd.bind(this)));
|
|
864
|
+
}
|
|
865
|
+
moveStart(e) {
|
|
866
|
+
this.start(e), this.computeValues(P(e)), this.compute(e), this.computeInitial(), this.emit();
|
|
867
|
+
}
|
|
868
|
+
moveChange(e) {
|
|
869
|
+
if (!this.state._active) return;
|
|
870
|
+
let t = P(e), n = this.state;
|
|
871
|
+
n._delta = y.sub(t, n._values), y.addTo(n._movement, n._delta), this.computeValues(t), this.compute(e), this.emit();
|
|
872
|
+
}
|
|
873
|
+
moveEnd(e) {
|
|
874
|
+
this.state._active && (this.state._active = !1, this.compute(e), this.emit());
|
|
875
|
+
}
|
|
876
|
+
bind(e) {
|
|
877
|
+
e("pointer", "change", this.move.bind(this)), e("pointer", "leave", this.moveEnd.bind(this));
|
|
878
|
+
}
|
|
879
|
+
}, Je = D(D({}, L), {}, { mouseOnly: (e = !0) => e }), Ye = class extends I {
|
|
880
|
+
constructor(...e) {
|
|
881
|
+
super(...e), T(this, "ingKey", "scrolling");
|
|
882
|
+
}
|
|
883
|
+
scroll(e) {
|
|
884
|
+
this.state._active || this.start(e), this.scrollChange(e), this.timeoutStore.add("scrollEnd", this.scrollEnd.bind(this));
|
|
885
|
+
}
|
|
886
|
+
scrollChange(e) {
|
|
887
|
+
e.cancelable && e.preventDefault();
|
|
888
|
+
let t = this.state, n = me(e);
|
|
889
|
+
t._delta = y.sub(n, t._values), y.addTo(t._movement, t._delta), this.computeValues(n), this.compute(e), this.emit();
|
|
890
|
+
}
|
|
891
|
+
scrollEnd() {
|
|
892
|
+
this.state._active && (this.state._active = !1, this.compute(), this.emit());
|
|
893
|
+
}
|
|
894
|
+
bind(e) {
|
|
895
|
+
e("scroll", "", this.scroll.bind(this));
|
|
896
|
+
}
|
|
897
|
+
}, Xe = L, Ze = class extends I {
|
|
898
|
+
constructor(...e) {
|
|
899
|
+
super(...e), T(this, "ingKey", "wheeling");
|
|
900
|
+
}
|
|
901
|
+
wheel(e) {
|
|
902
|
+
this.state._active || this.start(e), this.wheelChange(e), this.timeoutStore.add("wheelEnd", this.wheelEnd.bind(this));
|
|
903
|
+
}
|
|
904
|
+
wheelChange(e) {
|
|
905
|
+
let t = this.state;
|
|
906
|
+
t._delta = pe(e), y.addTo(t._movement, t._delta), He(t), this.compute(e), this.emit();
|
|
907
|
+
}
|
|
908
|
+
wheelEnd() {
|
|
909
|
+
this.state._active && (this.state._active = !1, this.compute(), this.emit());
|
|
910
|
+
}
|
|
911
|
+
bind(e) {
|
|
912
|
+
e("wheel", "", this.wheel.bind(this));
|
|
913
|
+
}
|
|
914
|
+
}, Qe = L, $e = class extends I {
|
|
915
|
+
constructor(...e) {
|
|
916
|
+
super(...e), T(this, "ingKey", "hovering");
|
|
917
|
+
}
|
|
918
|
+
enter(e) {
|
|
919
|
+
this.config.mouseOnly && e.pointerType !== "mouse" || (this.start(e), this.computeValues(P(e)), this.compute(e), this.emit());
|
|
920
|
+
}
|
|
921
|
+
leave(e) {
|
|
922
|
+
if (this.config.mouseOnly && e.pointerType !== "mouse") return;
|
|
923
|
+
let t = this.state;
|
|
924
|
+
if (!t._active) return;
|
|
925
|
+
t._active = !1;
|
|
926
|
+
let n = P(e);
|
|
927
|
+
t._movement = t._delta = y.sub(n, t._values), this.computeValues(n), this.compute(e), t.delta = t.movement, this.emit();
|
|
928
|
+
}
|
|
929
|
+
bind(e) {
|
|
930
|
+
e("pointer", "enter", this.enter.bind(this)), e("pointer", "leave", this.leave.bind(this));
|
|
931
|
+
}
|
|
932
|
+
}, et = D(D({}, L), {}, { mouseOnly: (e = !0) => e }), tt = /* @__PURE__ */ new Map(), nt = /* @__PURE__ */ new Map();
|
|
933
|
+
function rt(e) {
|
|
934
|
+
tt.set(e.key, e.engine), nt.set(e.key, e.resolver);
|
|
935
|
+
}
|
|
936
|
+
var it = {
|
|
937
|
+
key: "drag",
|
|
938
|
+
engine: De,
|
|
939
|
+
resolver: Ve
|
|
940
|
+
}, at = {
|
|
941
|
+
key: "hover",
|
|
942
|
+
engine: $e,
|
|
943
|
+
resolver: et
|
|
944
|
+
}, ot = {
|
|
945
|
+
key: "move",
|
|
946
|
+
engine: qe,
|
|
947
|
+
resolver: Je
|
|
948
|
+
}, st = {
|
|
949
|
+
key: "pinch",
|
|
950
|
+
engine: Ge,
|
|
951
|
+
resolver: Ke
|
|
952
|
+
}, ct = {
|
|
953
|
+
key: "scroll",
|
|
954
|
+
engine: Ye,
|
|
955
|
+
resolver: Xe
|
|
956
|
+
}, lt = {
|
|
957
|
+
key: "wheel",
|
|
958
|
+
engine: Ze,
|
|
959
|
+
resolver: Qe
|
|
960
|
+
};
|
|
961
|
+
// node_modules/@use-gesture/core/dist/use-gesture-core.esm.js
|
|
962
|
+
function ut(e, t) {
|
|
963
|
+
if (e == null) return {};
|
|
964
|
+
for (var n = {}, r = Object.keys(e), i, a = 0; a < r.length; a++) i = r[a], !(t.indexOf(i) >= 0) && (n[i] = e[i]);
|
|
965
|
+
return n;
|
|
966
|
+
}
|
|
967
|
+
function dt(e, t) {
|
|
968
|
+
if (e == null) return {};
|
|
969
|
+
var n = ut(e, t), r, i;
|
|
970
|
+
if (Object.getOwnPropertySymbols) {
|
|
971
|
+
var a = Object.getOwnPropertySymbols(e);
|
|
972
|
+
for (i = 0; i < a.length; i++) r = a[i], !(t.indexOf(r) >= 0) && Object.prototype.propertyIsEnumerable.call(e, r) && (n[r] = e[r]);
|
|
973
|
+
}
|
|
974
|
+
return n;
|
|
975
|
+
}
|
|
976
|
+
var ft = {
|
|
977
|
+
target(e) {
|
|
978
|
+
if (e) return () => "current" in e ? e.current : e;
|
|
979
|
+
},
|
|
980
|
+
enabled(e = !0) {
|
|
981
|
+
return e;
|
|
982
|
+
},
|
|
983
|
+
window(e = z.isBrowser ? window : void 0) {
|
|
984
|
+
return e;
|
|
985
|
+
},
|
|
986
|
+
eventOptions({ passive: e = !0, capture: t = !1 } = {}) {
|
|
987
|
+
return {
|
|
988
|
+
passive: e,
|
|
989
|
+
capture: t
|
|
990
|
+
};
|
|
991
|
+
},
|
|
992
|
+
transform(e) {
|
|
993
|
+
return e;
|
|
994
|
+
}
|
|
995
|
+
}, pt = [
|
|
996
|
+
"target",
|
|
997
|
+
"eventOptions",
|
|
998
|
+
"window",
|
|
999
|
+
"enabled",
|
|
1000
|
+
"transform"
|
|
1001
|
+
];
|
|
1002
|
+
function B(e = {}, t) {
|
|
1003
|
+
let n = {};
|
|
1004
|
+
for (let [r, i] of Object.entries(t)) switch (typeof i) {
|
|
1005
|
+
case "function":
|
|
1006
|
+
if (process.env.NODE_ENV === "development") {
|
|
1007
|
+
let t = i.call(n, e[r], r, e);
|
|
1008
|
+
Number.isNaN(t) || (n[r] = t);
|
|
1009
|
+
} else n[r] = i.call(n, e[r], r, e);
|
|
1010
|
+
break;
|
|
1011
|
+
case "object":
|
|
1012
|
+
n[r] = B(e[r], i);
|
|
1013
|
+
break;
|
|
1014
|
+
case "boolean": i && (n[r] = e[r]);
|
|
1015
|
+
}
|
|
1016
|
+
return n;
|
|
1017
|
+
}
|
|
1018
|
+
function mt(e, t, n = {}) {
|
|
1019
|
+
let r = e, { target: i, eventOptions: a, window: o, enabled: s, transform: c } = r, l = dt(r, pt);
|
|
1020
|
+
if (n.shared = B({
|
|
1021
|
+
target: i,
|
|
1022
|
+
eventOptions: a,
|
|
1023
|
+
window: o,
|
|
1024
|
+
enabled: s,
|
|
1025
|
+
transform: c
|
|
1026
|
+
}, ft), t) {
|
|
1027
|
+
let e = nt.get(t);
|
|
1028
|
+
n[t] = B(D({ shared: n.shared }, l), e);
|
|
1029
|
+
} else for (let e in l) {
|
|
1030
|
+
let t = nt.get(e);
|
|
1031
|
+
if (t) n[e] = B(D({ shared: n.shared }, l[e]), t);
|
|
1032
|
+
else if (process.env.NODE_ENV === "development" && ![
|
|
1033
|
+
"drag",
|
|
1034
|
+
"pinch",
|
|
1035
|
+
"scroll",
|
|
1036
|
+
"wheel",
|
|
1037
|
+
"move",
|
|
1038
|
+
"hover"
|
|
1039
|
+
].includes(e)) {
|
|
1040
|
+
if (e === "domTarget") throw Error("[@use-gesture]: `domTarget` option has been renamed to `target`.");
|
|
1041
|
+
console.warn(`[@use-gesture]: Unknown config key \`${e}\` was used. Please read the documentation for further information.`);
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
return n;
|
|
1045
|
+
}
|
|
1046
|
+
var ht = class {
|
|
1047
|
+
constructor(e, t) {
|
|
1048
|
+
T(this, "_listeners", /* @__PURE__ */ new Set()), this._ctrl = e, this._gestureKey = t;
|
|
1049
|
+
}
|
|
1050
|
+
add(e, t, n, r, i) {
|
|
1051
|
+
let a = this._listeners, o = ne(t, n), s = D(D({}, this._gestureKey ? this._ctrl.config[this._gestureKey].eventOptions : {}), i);
|
|
1052
|
+
e.addEventListener(o, r, s);
|
|
1053
|
+
let c = () => {
|
|
1054
|
+
e.removeEventListener(o, r, s), a.delete(c);
|
|
1055
|
+
};
|
|
1056
|
+
return a.add(c), c;
|
|
1057
|
+
}
|
|
1058
|
+
clean() {
|
|
1059
|
+
this._listeners.forEach((e) => e()), this._listeners.clear();
|
|
1060
|
+
}
|
|
1061
|
+
}, gt = class {
|
|
1062
|
+
constructor() {
|
|
1063
|
+
T(this, "_timeouts", /* @__PURE__ */ new Map());
|
|
1064
|
+
}
|
|
1065
|
+
add(e, t, n = 140, ...r) {
|
|
1066
|
+
this.remove(e), this._timeouts.set(e, window.setTimeout(t, n, ...r));
|
|
1067
|
+
}
|
|
1068
|
+
remove(e) {
|
|
1069
|
+
let t = this._timeouts.get(e);
|
|
1070
|
+
t && window.clearTimeout(t);
|
|
1071
|
+
}
|
|
1072
|
+
clean() {
|
|
1073
|
+
this._timeouts.forEach((e) => void window.clearTimeout(e)), this._timeouts.clear();
|
|
1074
|
+
}
|
|
1075
|
+
}, _t = class {
|
|
1076
|
+
constructor(e) {
|
|
1077
|
+
T(this, "gestures", /* @__PURE__ */ new Set()), T(this, "_targetEventStore", new ht(this)), T(this, "gestureEventStores", {}), T(this, "gestureTimeoutStores", {}), T(this, "handlers", {}), T(this, "config", {}), T(this, "pointerIds", /* @__PURE__ */ new Set()), T(this, "touchIds", /* @__PURE__ */ new Set()), T(this, "state", { shared: {
|
|
1078
|
+
shiftKey: !1,
|
|
1079
|
+
metaKey: !1,
|
|
1080
|
+
ctrlKey: !1,
|
|
1081
|
+
altKey: !1
|
|
1082
|
+
} }), vt(this, e);
|
|
1083
|
+
}
|
|
1084
|
+
setEventIds(e) {
|
|
1085
|
+
if (N(e)) return this.touchIds = new Set(ce(e)), this.touchIds;
|
|
1086
|
+
if ("pointerId" in e) return e.type === "pointerup" || e.type === "pointercancel" ? this.pointerIds.delete(e.pointerId) : e.type === "pointerdown" && this.pointerIds.add(e.pointerId), this.pointerIds;
|
|
1087
|
+
}
|
|
1088
|
+
applyHandlers(e, t) {
|
|
1089
|
+
this.handlers = e, this.nativeHandlers = t;
|
|
1090
|
+
}
|
|
1091
|
+
applyConfig(e, t) {
|
|
1092
|
+
this.config = mt(e, t, this.config);
|
|
1093
|
+
}
|
|
1094
|
+
clean() {
|
|
1095
|
+
this._targetEventStore.clean();
|
|
1096
|
+
for (let e of this.gestures) this.gestureEventStores[e].clean(), this.gestureTimeoutStores[e].clean();
|
|
1097
|
+
}
|
|
1098
|
+
effect() {
|
|
1099
|
+
return this.config.shared.target && this.bind(), () => this._targetEventStore.clean();
|
|
1100
|
+
}
|
|
1101
|
+
bind(...e) {
|
|
1102
|
+
let t = this.config.shared, n = {}, r;
|
|
1103
|
+
if (!(t.target && (r = t.target(), !r))) {
|
|
1104
|
+
if (t.enabled) {
|
|
1105
|
+
for (let t of this.gestures) {
|
|
1106
|
+
let i = this.config[t], a = yt(n, i.eventOptions, !!r);
|
|
1107
|
+
i.enabled && new (tt.get(t))(this, e, t).bind(a);
|
|
1108
|
+
}
|
|
1109
|
+
let i = yt(n, t.eventOptions, !!r);
|
|
1110
|
+
for (let t in this.nativeHandlers) i(t, "", (n) => this.nativeHandlers[t](D(D({}, this.state.shared), {}, {
|
|
1111
|
+
event: n,
|
|
1112
|
+
args: e
|
|
1113
|
+
})), void 0, !0);
|
|
1114
|
+
}
|
|
1115
|
+
for (let e in n) n[e] = _e(...n[e]);
|
|
1116
|
+
if (!r) return n;
|
|
1117
|
+
for (let e in n) {
|
|
1118
|
+
let { device: t, capture: i, passive: a } = te(e);
|
|
1119
|
+
this._targetEventStore.add(r, t, "", n[e], {
|
|
1120
|
+
capture: i,
|
|
1121
|
+
passive: a
|
|
1122
|
+
});
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
};
|
|
1127
|
+
function V(e, t) {
|
|
1128
|
+
e.gestures.add(t), e.gestureEventStores[t] = new ht(e, t), e.gestureTimeoutStores[t] = new gt();
|
|
1129
|
+
}
|
|
1130
|
+
function vt(e, t) {
|
|
1131
|
+
t.drag && V(e, "drag"), t.wheel && V(e, "wheel"), t.scroll && V(e, "scroll"), t.move && V(e, "move"), t.pinch && V(e, "pinch"), t.hover && V(e, "hover");
|
|
1132
|
+
}
|
|
1133
|
+
var yt = (e, t, n) => (r, i, a, o = {}, s = !1) => {
|
|
1134
|
+
let c = o.capture ?? t.capture, l = o.passive ?? t.passive, u = s ? r : ee(r, i, c);
|
|
1135
|
+
n && l && (u += "Passive"), e[u] = e[u] || [], e[u].push(a);
|
|
1136
|
+
}, bt = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
|
|
1137
|
+
function xt(e) {
|
|
1138
|
+
let t = {}, n = {}, r = /* @__PURE__ */ new Set();
|
|
1139
|
+
for (let i in e) bt.test(i) ? (r.add(RegExp.lastMatch), n[i] = e[i]) : t[i] = e[i];
|
|
1140
|
+
return [
|
|
1141
|
+
n,
|
|
1142
|
+
t,
|
|
1143
|
+
r
|
|
1144
|
+
];
|
|
1145
|
+
}
|
|
1146
|
+
function H(e, t, n, r, i, a) {
|
|
1147
|
+
if (!e.has(n)) return;
|
|
1148
|
+
if (!tt.has(r)) {
|
|
1149
|
+
process.env.NODE_ENV === "development" && console.warn(`[@use-gesture]: You've created a custom handler that that uses the \`${r}\` gesture but isn't properly configured.\n\nPlease add \`${r}Action\` when creating your handler.`);
|
|
1150
|
+
return;
|
|
1151
|
+
}
|
|
1152
|
+
let o = n + "Start", s = n + "End";
|
|
1153
|
+
i[r] = (e) => {
|
|
1154
|
+
let r;
|
|
1155
|
+
return e.first && o in t && t[o](e), n in t && (r = t[n](e)), e.last && s in t && t[s](e), r;
|
|
1156
|
+
}, a[r] = a[r] || {};
|
|
1157
|
+
}
|
|
1158
|
+
function St(e, t) {
|
|
1159
|
+
let [n, r, i] = xt(e), a = {};
|
|
1160
|
+
return H(i, n, "onDrag", "drag", a, t), H(i, n, "onWheel", "wheel", a, t), H(i, n, "onScroll", "scroll", a, t), H(i, n, "onPinch", "pinch", a, t), H(i, n, "onMove", "move", a, t), H(i, n, "onHover", "hover", a, t), {
|
|
1161
|
+
handlers: a,
|
|
1162
|
+
config: t,
|
|
1163
|
+
nativeHandlers: r
|
|
1164
|
+
};
|
|
1165
|
+
}
|
|
1166
|
+
// node_modules/@use-gesture/react/dist/use-gesture-react.esm.js
|
|
1167
|
+
function Ct(e, n = {}, r, i) {
|
|
1168
|
+
let a = t.useMemo(() => new _t(e), []);
|
|
1169
|
+
if (a.applyHandlers(e, i), a.applyConfig(n, r), t.useEffect(a.effect.bind(a)), t.useEffect(() => a.clean.bind(a), []), n.target === void 0) return a.bind.bind(a);
|
|
1170
|
+
}
|
|
1171
|
+
function wt(e, t) {
|
|
1172
|
+
return rt(it), Ct({ drag: e }, t || {}, "drag");
|
|
1173
|
+
}
|
|
1174
|
+
function Tt(e) {
|
|
1175
|
+
return e.forEach(rt), function(e, t) {
|
|
1176
|
+
let { handlers: n, nativeHandlers: r, config: i } = St(e, t || {});
|
|
1177
|
+
return Ct(n, i, void 0, r);
|
|
1178
|
+
};
|
|
1179
|
+
}
|
|
1180
|
+
function Et(e, t) {
|
|
1181
|
+
return Tt([
|
|
1182
|
+
it,
|
|
1183
|
+
st,
|
|
1184
|
+
ct,
|
|
1185
|
+
lt,
|
|
1186
|
+
ot,
|
|
1187
|
+
at
|
|
1188
|
+
])(e, t || {});
|
|
1189
|
+
}
|
|
1190
|
+
// node_modules/mafs/build/index.js
|
|
1191
|
+
var Dt = e.createContext(null);
|
|
1192
|
+
Dt.displayName = "CoordinateContext";
|
|
1193
|
+
function Ot() {
|
|
1194
|
+
let t = e.useContext(Dt);
|
|
1195
|
+
return m(t, "CoordinateContext is not loaded. Are you rendering a Mafs component outside of Mafs?"), t;
|
|
1196
|
+
}
|
|
1197
|
+
var kt = Dt;
|
|
1198
|
+
function U(e, t = 0) {
|
|
1199
|
+
let n = 10 ** (t || 0);
|
|
1200
|
+
return Math.round(e * n) / n;
|
|
1201
|
+
}
|
|
1202
|
+
function W(e, t, n = 1) {
|
|
1203
|
+
let r = [];
|
|
1204
|
+
for (let i = e; i < t - n / 2; i += n) r.push(i);
|
|
1205
|
+
let i = r[r.length - 1] + n;
|
|
1206
|
+
return Math.abs(t - i) < n / 1e-6 ? r.push(t) : r.push(i), r;
|
|
1207
|
+
}
|
|
1208
|
+
function At(e, t, n) {
|
|
1209
|
+
return Math.min(Math.max(e, t), n);
|
|
1210
|
+
}
|
|
1211
|
+
var { round: jt, ceil: Mt, floor: Nt, log2: Pt } = Math, Ft = e.createContext({
|
|
1212
|
+
xPanes: [],
|
|
1213
|
+
yPanes: [],
|
|
1214
|
+
xPaneRange: [0, 0],
|
|
1215
|
+
yPaneRange: [0, 0]
|
|
1216
|
+
});
|
|
1217
|
+
Ft.displayName = "PaneContext";
|
|
1218
|
+
function G() {
|
|
1219
|
+
return e.useContext(Ft);
|
|
1220
|
+
}
|
|
1221
|
+
function It({ children: t }) {
|
|
1222
|
+
let { xMin: n, xMax: r, yMin: i, yMax: a } = Ot(), o = 2 ** jt(Pt(r - n) - 1), s = 2 ** jt(Pt(a - i) - 1), c = 1 / 8, l = o * Nt(n / o - c), d = o * Mt(r / o + c), f = s * Nt(i / s - c), p = s * Mt(a / s + c), m = e.useMemo(() => W(l, d - o, o).map((e) => [e, e + o]), [
|
|
1223
|
+
l,
|
|
1224
|
+
d,
|
|
1225
|
+
o
|
|
1226
|
+
]), h = e.useMemo(() => W(f, p - s, s).map((e) => [e, e + s]), [
|
|
1227
|
+
f,
|
|
1228
|
+
p,
|
|
1229
|
+
s
|
|
1230
|
+
]), g = e.useMemo(() => ({
|
|
1231
|
+
xPanes: m,
|
|
1232
|
+
yPanes: h,
|
|
1233
|
+
xPaneRange: [l, d],
|
|
1234
|
+
yPaneRange: [f, p]
|
|
1235
|
+
}), [
|
|
1236
|
+
m,
|
|
1237
|
+
h,
|
|
1238
|
+
l,
|
|
1239
|
+
d,
|
|
1240
|
+
f,
|
|
1241
|
+
p
|
|
1242
|
+
]);
|
|
1243
|
+
return /* @__PURE__ */ u(Ft.Provider, {
|
|
1244
|
+
value: g,
|
|
1245
|
+
children: t
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
It.displayName = "PaneManager";
|
|
1249
|
+
var Lt = It, K;
|
|
1250
|
+
((e) => {
|
|
1251
|
+
function t(e, t) {
|
|
1252
|
+
return [e[0] + t[0], e[1] + t[1]];
|
|
1253
|
+
}
|
|
1254
|
+
e.add = t;
|
|
1255
|
+
function n(e, t) {
|
|
1256
|
+
return [e[0] - t[0], e[1] - t[1]];
|
|
1257
|
+
}
|
|
1258
|
+
e.sub = n;
|
|
1259
|
+
function r(e) {
|
|
1260
|
+
return Math.sqrt(e[0] * e[0] + e[1] * e[1]);
|
|
1261
|
+
}
|
|
1262
|
+
e.mag = r;
|
|
1263
|
+
function i(e) {
|
|
1264
|
+
return [-e[1], e[0]];
|
|
1265
|
+
}
|
|
1266
|
+
e.normal = i;
|
|
1267
|
+
function a(e, i, a) {
|
|
1268
|
+
let s = n(i, e);
|
|
1269
|
+
return t(e, o(s, a * r(s)));
|
|
1270
|
+
}
|
|
1271
|
+
e.lerp = a;
|
|
1272
|
+
function o(e, t) {
|
|
1273
|
+
return c(e, t / r(e));
|
|
1274
|
+
}
|
|
1275
|
+
e.withMag = o;
|
|
1276
|
+
function s(e) {
|
|
1277
|
+
return o(e, 1);
|
|
1278
|
+
}
|
|
1279
|
+
e.normalize = s;
|
|
1280
|
+
function c(e, t) {
|
|
1281
|
+
return [e[0] * t, e[1] * t];
|
|
1282
|
+
}
|
|
1283
|
+
e.scale = c;
|
|
1284
|
+
function l(e, t) {
|
|
1285
|
+
return [e[0] * t[0] + e[1] * t[1] + t[2], e[0] * t[3] + e[1] * t[4] + t[5]];
|
|
1286
|
+
}
|
|
1287
|
+
e.transform = l;
|
|
1288
|
+
function u(e, t) {
|
|
1289
|
+
return q(e[0] * t[0] + e[1] * t[3], e[3] * t[0] + e[4] * t[3], e[0] * t[1] + e[1] * t[4], e[3] * t[1] + e[4] * t[4], e[0] * t[2] + e[1] * t[5] + e[2], e[3] * t[2] + e[4] * t[5] + e[5]);
|
|
1290
|
+
}
|
|
1291
|
+
e.matrixMult = u;
|
|
1292
|
+
function d(e, t) {
|
|
1293
|
+
let n = Math.cos(t), r = Math.sin(t);
|
|
1294
|
+
return [e[0] * n - e[1] * r, e[0] * r + e[1] * n];
|
|
1295
|
+
}
|
|
1296
|
+
e.rotate = d;
|
|
1297
|
+
function f(e, r, i) {
|
|
1298
|
+
return t(r, d(n(e, r), i));
|
|
1299
|
+
}
|
|
1300
|
+
e.rotateAbout = f;
|
|
1301
|
+
function p(e, t) {
|
|
1302
|
+
return a(e, t, .5);
|
|
1303
|
+
}
|
|
1304
|
+
e.midpoint = p;
|
|
1305
|
+
function m(e, t) {
|
|
1306
|
+
return Math.sqrt(h(e, t));
|
|
1307
|
+
}
|
|
1308
|
+
e.dist = m;
|
|
1309
|
+
function h(e, t) {
|
|
1310
|
+
return (t[0] - e[0]) ** 2 + (t[1] - e[1]) ** 2;
|
|
1311
|
+
}
|
|
1312
|
+
e.squareDist = h;
|
|
1313
|
+
function g(e, t) {
|
|
1314
|
+
return e[0] * t[0] + e[1] * t[1];
|
|
1315
|
+
}
|
|
1316
|
+
e.dot = g;
|
|
1317
|
+
function _(e) {
|
|
1318
|
+
return e[0] * e[4] - e[3] * e[1];
|
|
1319
|
+
}
|
|
1320
|
+
e.det = _;
|
|
1321
|
+
function v(e) {
|
|
1322
|
+
let t = _(e);
|
|
1323
|
+
if (!t) return null;
|
|
1324
|
+
let n = 1 / t, r = e[0], i = e[1], a = e[2], o = e[3], s = e[4], c = e[5];
|
|
1325
|
+
return q(n * s, n * -o, n * -i, n * r, n * (c * i - a * s), n * (-c * r + a * o));
|
|
1326
|
+
}
|
|
1327
|
+
e.matrixInvert = v;
|
|
1328
|
+
function y(e = null) {
|
|
1329
|
+
let t = e || q();
|
|
1330
|
+
return {
|
|
1331
|
+
mult: (e) => y(u(e, t)),
|
|
1332
|
+
translate: (e, n) => y(u(q(1, 0, 0, 1, e, n), t)),
|
|
1333
|
+
rotate: (e) => {
|
|
1334
|
+
let n = Math.cos(e), r = Math.sin(e);
|
|
1335
|
+
return y(u(q(n, r, -r, n), t));
|
|
1336
|
+
},
|
|
1337
|
+
scale: (e, n) => y(u(q(e, 0, 0, n), t)),
|
|
1338
|
+
shear: (e, n) => y(u(q(1, n, e, 1), t)),
|
|
1339
|
+
get: () => [...t]
|
|
1340
|
+
};
|
|
1341
|
+
}
|
|
1342
|
+
e.matrixBuilder = y;
|
|
1343
|
+
function b(e) {
|
|
1344
|
+
let [t, n, r, i, a, o] = e;
|
|
1345
|
+
return `matrix(${t}, ${i}, ${n}, ${a}, ${r}, ${o})`;
|
|
1346
|
+
}
|
|
1347
|
+
e.toCSS = b, e.identity = y().get();
|
|
1348
|
+
})(K ||= {});
|
|
1349
|
+
function q(e = 1, t = 0, n = 0, r = 1, i = 0, a = 0) {
|
|
1350
|
+
return [
|
|
1351
|
+
e,
|
|
1352
|
+
n,
|
|
1353
|
+
i,
|
|
1354
|
+
t,
|
|
1355
|
+
r,
|
|
1356
|
+
a
|
|
1357
|
+
];
|
|
1358
|
+
}
|
|
1359
|
+
var J = e.createContext(null);
|
|
1360
|
+
J.displayName = "TransformContext";
|
|
1361
|
+
function Y() {
|
|
1362
|
+
let t = e.useContext(J);
|
|
1363
|
+
return m(t, "TransformContext is not loaded. Are you rendering a Mafs component outside of a MafsView?"), t;
|
|
1364
|
+
}
|
|
1365
|
+
var Rt = e.createContext({
|
|
1366
|
+
xSpan: 0,
|
|
1367
|
+
ySpan: 0
|
|
1368
|
+
});
|
|
1369
|
+
Rt.displayName = "SpanContext";
|
|
1370
|
+
function zt() {
|
|
1371
|
+
let t = e.useContext(Rt);
|
|
1372
|
+
return m(t, "SpanContext is not defined"), t;
|
|
1373
|
+
}
|
|
1374
|
+
function Bt({ minZoom: t, maxZoom: n }) {
|
|
1375
|
+
let [r, i] = e.useState(K.identity), a = e.useRef(K.identity);
|
|
1376
|
+
return {
|
|
1377
|
+
matrix: r,
|
|
1378
|
+
setBase() {
|
|
1379
|
+
a.current = r;
|
|
1380
|
+
},
|
|
1381
|
+
move({ zoom: e, pan: r }) {
|
|
1382
|
+
let o = 1 / (e?.scale ?? 1), s = e?.at ?? [0, 0], c = a.current[0], l = At(o, 1 / n / c, 1 / t / c), u = K.matrixBuilder(a.current).translate(...K.scale(s, -1)).scale(l, l).translate(...K.scale(s, 1)).translate(...r ?? [0, 0]).get();
|
|
1383
|
+
i(u);
|
|
1384
|
+
}
|
|
1385
|
+
};
|
|
1386
|
+
}
|
|
1387
|
+
function Vt(t) {
|
|
1388
|
+
let [n, r] = e.useState(!1), i = e.useRef(0);
|
|
1389
|
+
return e.useEffect(() => {
|
|
1390
|
+
if (!t) return;
|
|
1391
|
+
function e() {
|
|
1392
|
+
r(!1), clearTimeout(i.current), i.current = setTimeout(() => {
|
|
1393
|
+
r(!0);
|
|
1394
|
+
}, 500);
|
|
1395
|
+
}
|
|
1396
|
+
return window.addEventListener("scroll", e), () => window.removeEventListener("scroll", e);
|
|
1397
|
+
}, [t]), {
|
|
1398
|
+
wheelEnabled: t ? n : !1,
|
|
1399
|
+
handleMouseMove() {
|
|
1400
|
+
r(!0);
|
|
1401
|
+
}
|
|
1402
|
+
};
|
|
1403
|
+
}
|
|
1404
|
+
var Ht = e.createContext({ overrideHeight: void 0 });
|
|
1405
|
+
Ht.Provider;
|
|
1406
|
+
function Ut({ precision: e = 3 }) {
|
|
1407
|
+
let { xMin: t, xMax: n, yMin: r, yMax: i } = Ot(), { viewTransform: a } = Y(), { xPanes: o, yPanes: s } = G(), [c, l] = K.transform([t, r], a), u = o.map((e) => `(${e.join(", ")})`).join(" "), f = s.map((e) => `(${e.join(", ")})`).join(" ");
|
|
1408
|
+
return /* @__PURE__ */ d("g", {
|
|
1409
|
+
className: "mafs-shadow",
|
|
1410
|
+
fontFamily: "monospace",
|
|
1411
|
+
children: [
|
|
1412
|
+
/* @__PURE__ */ d("text", {
|
|
1413
|
+
x: c + 10,
|
|
1414
|
+
y: l - 70,
|
|
1415
|
+
children: [
|
|
1416
|
+
"x: (",
|
|
1417
|
+
t.toFixed(e),
|
|
1418
|
+
", ",
|
|
1419
|
+
n.toFixed(e),
|
|
1420
|
+
")"
|
|
1421
|
+
]
|
|
1422
|
+
}),
|
|
1423
|
+
/* @__PURE__ */ d("text", {
|
|
1424
|
+
x: c + 10,
|
|
1425
|
+
y: l - 50,
|
|
1426
|
+
children: [
|
|
1427
|
+
"y: (",
|
|
1428
|
+
r.toFixed(e),
|
|
1429
|
+
", ",
|
|
1430
|
+
i.toFixed(e),
|
|
1431
|
+
")"
|
|
1432
|
+
]
|
|
1433
|
+
}),
|
|
1434
|
+
/* @__PURE__ */ d("text", {
|
|
1435
|
+
x: c + 10,
|
|
1436
|
+
y: l - 30,
|
|
1437
|
+
children: ["xPanes: ", u]
|
|
1438
|
+
}),
|
|
1439
|
+
/* @__PURE__ */ d("text", {
|
|
1440
|
+
x: c + 10,
|
|
1441
|
+
y: l - 10,
|
|
1442
|
+
children: ["yPanes: ", f]
|
|
1443
|
+
})
|
|
1444
|
+
]
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
Ut.displayName = "Debug.ViewportInfo";
|
|
1448
|
+
var X = {
|
|
1449
|
+
foreground: "var(--mafs-fg)",
|
|
1450
|
+
background: "var(--mafs-bg)",
|
|
1451
|
+
red: "var(--mafs-red)",
|
|
1452
|
+
orange: "var(--mafs-orange)",
|
|
1453
|
+
green: "var(--mafs-green)",
|
|
1454
|
+
blue: "var(--mafs-blue)",
|
|
1455
|
+
indigo: "var(--mafs-indigo)",
|
|
1456
|
+
violet: "var(--mafs-violet)",
|
|
1457
|
+
pink: "var(--mafs-pink)",
|
|
1458
|
+
yellow: "var(--mafs-yellow)"
|
|
1459
|
+
};
|
|
1460
|
+
function Wt(t) {
|
|
1461
|
+
let { gestureTarget: n, onMove: r, point: i, constrain: a } = t, [o, s] = e.useState(!1), { xSpan: c, ySpan: l } = zt(), { viewTransform: u, userTransform: d } = Y(), f = K.matrixInvert(u);
|
|
1462
|
+
m(f, "The view transform must be invertible.");
|
|
1463
|
+
let p = e.useMemo(() => Gt(d), [d]), h = e.useRef([0, 0]);
|
|
1464
|
+
return wt((e) => {
|
|
1465
|
+
let { type: t, event: n } = e;
|
|
1466
|
+
if (n?.stopPropagation(), t.includes("key")) {
|
|
1467
|
+
if (n?.preventDefault(), t === "keyup") return;
|
|
1468
|
+
let { direction: o, altKey: s, metaKey: u, shiftKey: f } = e, m = [o[0], -o[1]], h = Math.abs(m[0]) ? c : l, g = 50;
|
|
1469
|
+
(s || u) && (g = 200), f && (g = 10);
|
|
1470
|
+
let _ = h / (g * 2), v = W(h / g, h / 2, h / g);
|
|
1471
|
+
for (let e of v) {
|
|
1472
|
+
let t = K.scale(m, e), n = a(K.transform(K.add(K.transform(i, d), t), p));
|
|
1473
|
+
if (K.dist(n, i) > _) {
|
|
1474
|
+
r(n);
|
|
1475
|
+
break;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
} else {
|
|
1479
|
+
let { last: t, movement: n, first: o } = e;
|
|
1480
|
+
if (s(!t), o && (h.current = K.transform(i, d)), K.mag(n) === 0) return;
|
|
1481
|
+
let c = K.transform(n, f);
|
|
1482
|
+
r(a(K.transform(K.add(h.current, c), p)));
|
|
1483
|
+
}
|
|
1484
|
+
}, {
|
|
1485
|
+
target: n,
|
|
1486
|
+
eventOptions: { passive: !1 }
|
|
1487
|
+
}), { dragging: o };
|
|
1488
|
+
}
|
|
1489
|
+
function Gt(e) {
|
|
1490
|
+
let t = K.matrixInvert(e);
|
|
1491
|
+
return m(t !== null, "Could not invert transform matrix. A parent transformation matrix might be degenerative (mapping 2D space to a line)."), t;
|
|
1492
|
+
}
|
|
1493
|
+
var Kt = e.forwardRef((t, n) => {
|
|
1494
|
+
let { color: r = X.pink, ringRadiusPx: i = 15, dragging: a, point: o } = t, { viewTransform: s, userTransform: c } = Y(), l = e.useMemo(() => K.matrixMult(s, c), [s, c]), [f, p] = K.transform(o, l);
|
|
1495
|
+
return /* @__PURE__ */ d("g", {
|
|
1496
|
+
ref: n,
|
|
1497
|
+
style: {
|
|
1498
|
+
"--movable-point-color": r,
|
|
1499
|
+
"--movable-point-ring-size": `${i}px`
|
|
1500
|
+
},
|
|
1501
|
+
className: `mafs-movable-point ${a ? "mafs-movable-point-dragging" : ""}`,
|
|
1502
|
+
tabIndex: 0,
|
|
1503
|
+
children: [
|
|
1504
|
+
/* @__PURE__ */ u("circle", {
|
|
1505
|
+
className: "mafs-movable-point-hitbox",
|
|
1506
|
+
r: 30,
|
|
1507
|
+
cx: f,
|
|
1508
|
+
cy: p
|
|
1509
|
+
}),
|
|
1510
|
+
/* @__PURE__ */ u("circle", {
|
|
1511
|
+
className: "mafs-movable-point-focus",
|
|
1512
|
+
r: i + 1,
|
|
1513
|
+
cx: f,
|
|
1514
|
+
cy: p
|
|
1515
|
+
}),
|
|
1516
|
+
/* @__PURE__ */ u("circle", {
|
|
1517
|
+
className: "mafs-movable-point-ring",
|
|
1518
|
+
r: i,
|
|
1519
|
+
cx: f,
|
|
1520
|
+
cy: p
|
|
1521
|
+
}),
|
|
1522
|
+
/* @__PURE__ */ u("circle", {
|
|
1523
|
+
className: "mafs-movable-point-point",
|
|
1524
|
+
r: 6,
|
|
1525
|
+
cx: f,
|
|
1526
|
+
cy: p
|
|
1527
|
+
})
|
|
1528
|
+
]
|
|
1529
|
+
});
|
|
1530
|
+
});
|
|
1531
|
+
Kt.displayName = "MovablePointDisplay";
|
|
1532
|
+
function qt({ point: t, onMove: n, constrain: r = (e) => e, color: i = X.pink }) {
|
|
1533
|
+
let a = e.useRef(null), { dragging: o } = Wt({
|
|
1534
|
+
gestureTarget: a,
|
|
1535
|
+
onMove: n,
|
|
1536
|
+
point: t,
|
|
1537
|
+
constrain: r
|
|
1538
|
+
});
|
|
1539
|
+
return /* @__PURE__ */ u(Kt, {
|
|
1540
|
+
ref: a,
|
|
1541
|
+
point: t,
|
|
1542
|
+
color: i,
|
|
1543
|
+
dragging: o
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
qt.displayName = "MovablePoint";
|
|
1547
|
+
function Jt(t, { constrain: n, color: r = X.pink } = {}) {
|
|
1548
|
+
let [i, a] = t, [o, s] = e.useState(t), [c, l] = o, d = e.useMemo(() => n === "horizontal" ? ([e]) => [e, a] : n === "vertical" ? ([, e]) => [i, e] : typeof n == "function" ? n : ([e, t]) => [e, t], [
|
|
1549
|
+
n,
|
|
1550
|
+
i,
|
|
1551
|
+
a
|
|
1552
|
+
]), f = e.useMemo(() => /* @__PURE__ */ u(qt, {
|
|
1553
|
+
point: o,
|
|
1554
|
+
color: r,
|
|
1555
|
+
constrain: d,
|
|
1556
|
+
onMove: s
|
|
1557
|
+
}), [
|
|
1558
|
+
o,
|
|
1559
|
+
r,
|
|
1560
|
+
d
|
|
1561
|
+
]);
|
|
1562
|
+
return {
|
|
1563
|
+
x: c,
|
|
1564
|
+
y: l,
|
|
1565
|
+
point: [c, l],
|
|
1566
|
+
element: f,
|
|
1567
|
+
setPoint: s
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
function Yt(e) {
|
|
1571
|
+
let { userTransform: t, viewTransform: n } = Y(), r = K.matrixBuilder(), { matrix: i, children: a, ...o } = e;
|
|
1572
|
+
i && (r = r.mult(i));
|
|
1573
|
+
for (let [e, t] of Object.entries(o)) if (t != null) switch (e) {
|
|
1574
|
+
case "translate":
|
|
1575
|
+
r = r.translate(...t);
|
|
1576
|
+
break;
|
|
1577
|
+
case "scale":
|
|
1578
|
+
r = typeof t == "number" ? r.scale(t, t) : r.scale(...t);
|
|
1579
|
+
break;
|
|
1580
|
+
case "shear":
|
|
1581
|
+
r = r.shear(...t);
|
|
1582
|
+
break;
|
|
1583
|
+
case "rotate": r = r.rotate(t);
|
|
1584
|
+
}
|
|
1585
|
+
r = r.mult(t);
|
|
1586
|
+
let s = r.get();
|
|
1587
|
+
return /* @__PURE__ */ u(J.Provider, {
|
|
1588
|
+
value: {
|
|
1589
|
+
userTransform: s,
|
|
1590
|
+
viewTransform: n
|
|
1591
|
+
},
|
|
1592
|
+
children: /* @__PURE__ */ u("g", {
|
|
1593
|
+
style: { "--mafs-user-transform": K.toCSS(s) },
|
|
1594
|
+
children: a
|
|
1595
|
+
})
|
|
1596
|
+
});
|
|
1597
|
+
}
|
|
1598
|
+
Yt.displayName = "Transform";
|
|
1599
|
+
function Xt({ center: e, radius: t, angle: n = 0, strokeStyle: r = "solid", strokeOpacity: i = 1, weight: a = 2, color: o = X.foreground, fillOpacity: s = .15, svgEllipseProps: c = {} }) {
|
|
1600
|
+
let { viewTransform: l, userTransform: d } = Y(), f = K.matrixBuilder().translate(...e).mult(d).scale(1, -1).mult(l).scale(1, -1).get(), p = `
|
|
1601
|
+
${K.toCSS(f)}
|
|
1602
|
+
rotate(${180 / Math.PI * n})
|
|
1603
|
+
`;
|
|
1604
|
+
return /* @__PURE__ */ u("ellipse", {
|
|
1605
|
+
cx: 0,
|
|
1606
|
+
cy: 0,
|
|
1607
|
+
rx: t[0],
|
|
1608
|
+
ry: t[1],
|
|
1609
|
+
strokeWidth: a,
|
|
1610
|
+
transform: p,
|
|
1611
|
+
...c,
|
|
1612
|
+
style: {
|
|
1613
|
+
stroke: o,
|
|
1614
|
+
strokeDasharray: r === "dashed" ? "var(--mafs-line-stroke-dash-style)" : void 0,
|
|
1615
|
+
fill: o,
|
|
1616
|
+
fillOpacity: s,
|
|
1617
|
+
strokeOpacity: i,
|
|
1618
|
+
vectorEffect: "non-scaling-stroke",
|
|
1619
|
+
...c.style || {}
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
Xt.displayName = "Ellipse";
|
|
1624
|
+
function Zt({ radius: e, ...t }) {
|
|
1625
|
+
return /* @__PURE__ */ u(Xt, {
|
|
1626
|
+
radius: [e, e],
|
|
1627
|
+
...t
|
|
1628
|
+
});
|
|
1629
|
+
}
|
|
1630
|
+
Zt.displayName = "Circle";
|
|
1631
|
+
function Qt({ element: e, points: t, color: n = X.foreground, weight: r = 2, fillOpacity: i = .15, strokeOpacity: a = 1, strokeStyle: o = "solid", svgPolyProps: s = {} }) {
|
|
1632
|
+
let { userTransform: c } = Y(), l = t.map((e) => K.transform(e, c).join(" ")).join(" ");
|
|
1633
|
+
return /* @__PURE__ */ u(e, {
|
|
1634
|
+
points: l,
|
|
1635
|
+
strokeWidth: r,
|
|
1636
|
+
fillOpacity: i,
|
|
1637
|
+
strokeLinejoin: "round",
|
|
1638
|
+
...s,
|
|
1639
|
+
style: {
|
|
1640
|
+
fill: n,
|
|
1641
|
+
fillOpacity: i,
|
|
1642
|
+
stroke: n,
|
|
1643
|
+
strokeDasharray: o === "dashed" ? "var(--mafs-line-stroke-dash-style)" : void 0,
|
|
1644
|
+
strokeOpacity: a,
|
|
1645
|
+
vectorEffect: "non-scaling-stroke",
|
|
1646
|
+
transform: "var(--mafs-view-transform)",
|
|
1647
|
+
...s.style || {}
|
|
1648
|
+
}
|
|
1649
|
+
});
|
|
1650
|
+
}
|
|
1651
|
+
function $t({ svgPolygonProps: e, ...t }) {
|
|
1652
|
+
return /* @__PURE__ */ u(Qt, {
|
|
1653
|
+
element: "polygon",
|
|
1654
|
+
svgPolyProps: e,
|
|
1655
|
+
...t
|
|
1656
|
+
});
|
|
1657
|
+
}
|
|
1658
|
+
$t.displayName = "Polygon";
|
|
1659
|
+
function en({ children: e }) {
|
|
1660
|
+
let t = Jt([0, 0]), n = Jt([1, 1], { color: X.blue }), r = Jt([1, 0], {
|
|
1661
|
+
color: X.green,
|
|
1662
|
+
constrain: (e) => K.normalize(e)
|
|
1663
|
+
}), i = Math.atan2(r.point[1], r.point[0]);
|
|
1664
|
+
return /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ d(Yt, {
|
|
1665
|
+
translate: t.point,
|
|
1666
|
+
children: [/* @__PURE__ */ d(Yt, {
|
|
1667
|
+
rotate: i,
|
|
1668
|
+
children: [
|
|
1669
|
+
/* @__PURE__ */ d(Yt, {
|
|
1670
|
+
scale: n.point,
|
|
1671
|
+
children: [e, /* @__PURE__ */ u($t, {
|
|
1672
|
+
points: [
|
|
1673
|
+
[0, 0],
|
|
1674
|
+
[0, 1],
|
|
1675
|
+
[1, 1],
|
|
1676
|
+
[1, 0]
|
|
1677
|
+
],
|
|
1678
|
+
color: X.blue
|
|
1679
|
+
})]
|
|
1680
|
+
}),
|
|
1681
|
+
/* @__PURE__ */ u(Zt, {
|
|
1682
|
+
center: [0, 0],
|
|
1683
|
+
radius: 1,
|
|
1684
|
+
strokeStyle: "dashed",
|
|
1685
|
+
strokeOpacity: .5,
|
|
1686
|
+
fillOpacity: 0,
|
|
1687
|
+
color: X.green
|
|
1688
|
+
}),
|
|
1689
|
+
n.element
|
|
1690
|
+
]
|
|
1691
|
+
}), r.element]
|
|
1692
|
+
}), t.element] });
|
|
1693
|
+
}
|
|
1694
|
+
en.displayName = "Debug.TransformWidget";
|
|
1695
|
+
var tn = {
|
|
1696
|
+
ViewportInfo: Ut,
|
|
1697
|
+
TransformWidget: en
|
|
1698
|
+
};
|
|
1699
|
+
function nn({ width: t = "auto", height: n = 500, pan: r = !0, zoom: i = !1, viewBox: a = {
|
|
1700
|
+
x: [-3, 3],
|
|
1701
|
+
y: [-3, 3]
|
|
1702
|
+
}, preserveAspectRatio: o = "contain", children: s, ssr: c = !1, debug: l = !1, onClick: d = void 0 }) {
|
|
1703
|
+
let f = e.useContext(Ht).overrideHeight ?? n, p = t === "auto" ? "100%" : `${t}px`, m = e.useRef(null), { width: h = t === "auto" ? c ? 500 : 0 : t } = _({ ref: t === "auto" ? m : null });
|
|
1704
|
+
return /* @__PURE__ */ u("div", {
|
|
1705
|
+
className: "MafsView",
|
|
1706
|
+
style: {
|
|
1707
|
+
width: p,
|
|
1708
|
+
height: f
|
|
1709
|
+
},
|
|
1710
|
+
tabIndex: r || i ? 0 : -1,
|
|
1711
|
+
ref: m,
|
|
1712
|
+
children: h > 0 && /* @__PURE__ */ u(rn, {
|
|
1713
|
+
width: h,
|
|
1714
|
+
height: f,
|
|
1715
|
+
desiredCssWidth: p,
|
|
1716
|
+
rootRef: m,
|
|
1717
|
+
pan: r,
|
|
1718
|
+
zoom: i,
|
|
1719
|
+
viewBox: a,
|
|
1720
|
+
preserveAspectRatio: o,
|
|
1721
|
+
ssr: c,
|
|
1722
|
+
onClick: d,
|
|
1723
|
+
debug: l,
|
|
1724
|
+
children: s
|
|
1725
|
+
})
|
|
1726
|
+
});
|
|
1727
|
+
}
|
|
1728
|
+
function rn({ width: t, height: n, desiredCssWidth: r, rootRef: i, pan: a, zoom: o, viewBox: s, preserveAspectRatio: c, children: l, onClick: f, debug: p }) {
|
|
1729
|
+
let h = 1, g = 1;
|
|
1730
|
+
typeof o == "object" ? (m(o.min > 0 && o.min <= 1, "zoom.min must be in the range (0, 1]"), m(o.max >= 1, "zoom.max must be in the range [1, ∞)"), h = o.min, g = o.max) : o && (h = .5, g = 5);
|
|
1731
|
+
let _ = Bt({
|
|
1732
|
+
minZoom: h,
|
|
1733
|
+
maxZoom: g
|
|
1734
|
+
}), v = s?.padding ?? .5, y = (s?.x?.[0] ?? 0) - v, b = (s?.x?.[1] ?? 0) + v, x = (s?.y?.[0] ?? 0) - v, S = (s?.y?.[1] ?? 0) + v;
|
|
1735
|
+
if (c === "contain") {
|
|
1736
|
+
let e = t / n;
|
|
1737
|
+
if ((b - y) / (S - x) > e) {
|
|
1738
|
+
let t = (S + x) / 2, n = (b - y) / e / 2;
|
|
1739
|
+
x = t - n, S = t + n;
|
|
1740
|
+
} else {
|
|
1741
|
+
let t = (b + y) / 2, n = (S - x) * e / 2;
|
|
1742
|
+
y = t - n, b = t + n;
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
[y, x] = K.transform([y, x], _.matrix), [b, S] = K.transform([b, S], _.matrix);
|
|
1746
|
+
let C = b - y, w = S - x, T = e.useMemo(() => {
|
|
1747
|
+
let e = U(1 / C * t, 5), r = U(-1 / w * n, 5);
|
|
1748
|
+
return K.matrixBuilder().scale(e, r).get();
|
|
1749
|
+
}, [
|
|
1750
|
+
n,
|
|
1751
|
+
t,
|
|
1752
|
+
C,
|
|
1753
|
+
w
|
|
1754
|
+
]), E = U(y / (b - y) * t, 10), D = U(S / (x - S) * n, 10), O = K.matrixInvert(T), k = e.useRef([0, 0]), A = e.useRef([0, 0]);
|
|
1755
|
+
function j(e) {
|
|
1756
|
+
let t = i.current;
|
|
1757
|
+
m(t, "SVG is not mounted"), m(O, "View transform is not invertible");
|
|
1758
|
+
let n = t.getBoundingClientRect();
|
|
1759
|
+
return K.transform([e[0] - n.left + E, e[1] - n.top + D], O);
|
|
1760
|
+
}
|
|
1761
|
+
let ee = Vt(!!o), M = e.useRef(!1);
|
|
1762
|
+
Et({
|
|
1763
|
+
onDrag: ({ movement: e, first: r, event: i, type: a, pinching: o, memo: s = [0, 0], last: c }) => {
|
|
1764
|
+
if (o) return e;
|
|
1765
|
+
r && _.setBase();
|
|
1766
|
+
let [l, u] = K.sub(e, s);
|
|
1767
|
+
_.move({ pan: [-l / t * C, u / n * w] });
|
|
1768
|
+
let d = a.includes("key");
|
|
1769
|
+
return d && i?.preventDefault(), c && (M.current = !0, setTimeout(() => M.current = !1, 10)), !d && r ? e : s;
|
|
1770
|
+
},
|
|
1771
|
+
onPinch: ({ first: e, movement: [t], origin: n, event: r, last: i }) => {
|
|
1772
|
+
if (!r.currentTarget || !O) return;
|
|
1773
|
+
e && (_.setBase(), k.current = n, A.current = a ? j(n) : [(y + b) / 2, (x + S) / 2]);
|
|
1774
|
+
let o = [0, 0];
|
|
1775
|
+
a && (o = K.transform(K.sub(n, k.current), O)), _.move({
|
|
1776
|
+
zoom: {
|
|
1777
|
+
at: A.current,
|
|
1778
|
+
scale: t
|
|
1779
|
+
},
|
|
1780
|
+
pan: K.scale(o, -1)
|
|
1781
|
+
}), i && _.setBase();
|
|
1782
|
+
},
|
|
1783
|
+
onWheel: ({ pinching: e, event: t, delta: [, n] }) => {
|
|
1784
|
+
if (e) return;
|
|
1785
|
+
let r = 2 / (1 + Math.exp(-n / 300)), i = j([t.clientX, t.clientY]);
|
|
1786
|
+
_.setBase(), _.move({ zoom: {
|
|
1787
|
+
at: i,
|
|
1788
|
+
scale: 1 / r
|
|
1789
|
+
} });
|
|
1790
|
+
},
|
|
1791
|
+
onKeyDown: ({ event: e }) => {
|
|
1792
|
+
if (e.metaKey) return;
|
|
1793
|
+
let t = {
|
|
1794
|
+
Equal: 1,
|
|
1795
|
+
Minus: -1
|
|
1796
|
+
}[e.code] ?? 0;
|
|
1797
|
+
if (!t) return;
|
|
1798
|
+
let n = .1;
|
|
1799
|
+
(e.altKey || e.metaKey) && (n = .01), e.shiftKey && (n = .3);
|
|
1800
|
+
let r = 1 + t * n, i = [(b + y) / 2, (S + x) / 2];
|
|
1801
|
+
_.setBase(), _.move({ zoom: {
|
|
1802
|
+
at: i,
|
|
1803
|
+
scale: r
|
|
1804
|
+
} });
|
|
1805
|
+
},
|
|
1806
|
+
onMouseMove: () => {
|
|
1807
|
+
ee.handleMouseMove();
|
|
1808
|
+
},
|
|
1809
|
+
onClick: ({ event: e }) => {
|
|
1810
|
+
if (!f || !i.current || M.current) return;
|
|
1811
|
+
let r = i.current.getBoundingClientRect(), a = e.clientX - r.left, o = r.bottom - e.clientY;
|
|
1812
|
+
f([a / t * C + y, o / n * w + x], e);
|
|
1813
|
+
}
|
|
1814
|
+
}, {
|
|
1815
|
+
drag: {
|
|
1816
|
+
enabled: a,
|
|
1817
|
+
eventOptions: { passive: !1 },
|
|
1818
|
+
threshold: 1
|
|
1819
|
+
},
|
|
1820
|
+
pinch: {
|
|
1821
|
+
enabled: !!o,
|
|
1822
|
+
eventOptions: { passive: !1 }
|
|
1823
|
+
},
|
|
1824
|
+
wheel: {
|
|
1825
|
+
enabled: ee.wheelEnabled,
|
|
1826
|
+
preventDefault: !0,
|
|
1827
|
+
eventOptions: { passive: !1 }
|
|
1828
|
+
},
|
|
1829
|
+
target: i
|
|
1830
|
+
});
|
|
1831
|
+
let te = K.toCSS(T), ne = e.useMemo(() => ({
|
|
1832
|
+
xMin: y,
|
|
1833
|
+
xMax: b,
|
|
1834
|
+
yMin: x,
|
|
1835
|
+
yMax: S,
|
|
1836
|
+
height: n,
|
|
1837
|
+
width: t
|
|
1838
|
+
}), [
|
|
1839
|
+
y,
|
|
1840
|
+
b,
|
|
1841
|
+
x,
|
|
1842
|
+
S,
|
|
1843
|
+
n,
|
|
1844
|
+
t
|
|
1845
|
+
]);
|
|
1846
|
+
return /* @__PURE__ */ u(kt.Provider, {
|
|
1847
|
+
value: ne,
|
|
1848
|
+
children: /* @__PURE__ */ u(Rt.Provider, {
|
|
1849
|
+
value: {
|
|
1850
|
+
xSpan: C,
|
|
1851
|
+
ySpan: w
|
|
1852
|
+
},
|
|
1853
|
+
children: /* @__PURE__ */ u(J.Provider, {
|
|
1854
|
+
value: {
|
|
1855
|
+
userTransform: K.identity,
|
|
1856
|
+
viewTransform: T
|
|
1857
|
+
},
|
|
1858
|
+
children: /* @__PURE__ */ u(Lt, { children: /* @__PURE__ */ d("svg", {
|
|
1859
|
+
width: t,
|
|
1860
|
+
height: n,
|
|
1861
|
+
viewBox: [
|
|
1862
|
+
E - (p ? 150 : 0),
|
|
1863
|
+
D - (p ? 150 : 0),
|
|
1864
|
+
t + (p ? 300 : 0),
|
|
1865
|
+
n + (p ? 300 : 0)
|
|
1866
|
+
].join(" "),
|
|
1867
|
+
preserveAspectRatio: "xMidYMin",
|
|
1868
|
+
style: {
|
|
1869
|
+
width: r,
|
|
1870
|
+
touchAction: a ? "none" : "auto",
|
|
1871
|
+
"--mafs-view-transform": te,
|
|
1872
|
+
"--mafs-user-transform": "translate(0, 0)"
|
|
1873
|
+
},
|
|
1874
|
+
children: [
|
|
1875
|
+
l,
|
|
1876
|
+
p && /* @__PURE__ */ u("rect", {
|
|
1877
|
+
x: E,
|
|
1878
|
+
y: D,
|
|
1879
|
+
width: t,
|
|
1880
|
+
height: n,
|
|
1881
|
+
fill: "none",
|
|
1882
|
+
stroke: "red",
|
|
1883
|
+
style: { outline: "9999px solid #f002" }
|
|
1884
|
+
}),
|
|
1885
|
+
p && /* @__PURE__ */ u(tn.ViewportInfo, {})
|
|
1886
|
+
]
|
|
1887
|
+
}) })
|
|
1888
|
+
})
|
|
1889
|
+
})
|
|
1890
|
+
});
|
|
1891
|
+
}
|
|
1892
|
+
nn.displayName = "Mafs";
|
|
1893
|
+
var an = (e) => /* @__PURE__ */ d(l, { children: [e, e < 0 && /* @__PURE__ */ u("tspan", {
|
|
1894
|
+
visibility: "hidden",
|
|
1895
|
+
children: "-"
|
|
1896
|
+
})] }), on = {
|
|
1897
|
+
axis: !0,
|
|
1898
|
+
lines: 1,
|
|
1899
|
+
labels: an
|
|
1900
|
+
};
|
|
1901
|
+
function sn({ separation: e, labelMaker: t }) {
|
|
1902
|
+
let { viewTransform: n } = Y(), { xPanes: r } = G();
|
|
1903
|
+
return /* @__PURE__ */ u("g", {
|
|
1904
|
+
className: "mafs-axis",
|
|
1905
|
+
children: r.map(([r, i]) => /* @__PURE__ */ u("g", { children: dn(r, i, e).filter((t) => Math.abs(t) > e / 1e6).map((e) => /* @__PURE__ */ u("text", {
|
|
1906
|
+
x: K.transform([e, 0], n)[0],
|
|
1907
|
+
y: 5,
|
|
1908
|
+
dominantBaseline: "hanging",
|
|
1909
|
+
textAnchor: "middle",
|
|
1910
|
+
style: {
|
|
1911
|
+
fill: "var(--mafs-origin-color)",
|
|
1912
|
+
paintOrder: "stroke"
|
|
1913
|
+
},
|
|
1914
|
+
children: t(e)
|
|
1915
|
+
}, e)) }, `${r},${i}`))
|
|
1916
|
+
});
|
|
1917
|
+
}
|
|
1918
|
+
sn.displayName = "CartesianCoordinates.XLabels";
|
|
1919
|
+
function cn({ separation: e, labelMaker: t }) {
|
|
1920
|
+
let { viewTransform: n } = Y(), { yPanes: r } = G();
|
|
1921
|
+
return /* @__PURE__ */ u("g", {
|
|
1922
|
+
className: "mafs-axis",
|
|
1923
|
+
children: r.map(([r, i]) => /* @__PURE__ */ u("g", { children: dn(r, i, e).filter((t) => Math.abs(t) > e / 1e6).map((e) => /* @__PURE__ */ u("text", {
|
|
1924
|
+
x: 5,
|
|
1925
|
+
y: K.transform([0, e], n)[1],
|
|
1926
|
+
dominantBaseline: "central",
|
|
1927
|
+
style: {
|
|
1928
|
+
fill: "var(--mafs-origin-color)",
|
|
1929
|
+
paintOrder: "stroke"
|
|
1930
|
+
},
|
|
1931
|
+
children: t(e)
|
|
1932
|
+
}, e)) }, `${r},${i}`))
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
cn.displayName = "CartesianCoordinates.YLabels";
|
|
1936
|
+
var ln = 0;
|
|
1937
|
+
function un({ xAxis: t, yAxis: n, subdivisions: r = !1 }) {
|
|
1938
|
+
let i = t !== !1, a = n !== !1, o = {
|
|
1939
|
+
subdivisions: r,
|
|
1940
|
+
...on,
|
|
1941
|
+
...t
|
|
1942
|
+
}, s = {
|
|
1943
|
+
subdivisions: r,
|
|
1944
|
+
...on,
|
|
1945
|
+
...n
|
|
1946
|
+
}, c = e.useMemo(() => `cartesian-${ln++}`, []), { viewTransform: f } = Y(), { xPaneRange: p, yPaneRange: m } = G(), [h, g] = p, [_, v] = m, [y, b] = K.transform([h, _], f), [x, S] = K.transform([g, v], f), C = o.lines || 1, w = s.lines || 1, [T, E] = K.transform([C, -w], f), D = o.subdivisions || 1, O = s.subdivisions || 1, k = T / D, A = E / O;
|
|
1947
|
+
return /* @__PURE__ */ d("g", {
|
|
1948
|
+
fill: "none",
|
|
1949
|
+
children: [
|
|
1950
|
+
/* @__PURE__ */ d("pattern", {
|
|
1951
|
+
x: 0,
|
|
1952
|
+
y: 0,
|
|
1953
|
+
width: T,
|
|
1954
|
+
height: E,
|
|
1955
|
+
id: c,
|
|
1956
|
+
patternUnits: "userSpaceOnUse",
|
|
1957
|
+
children: [
|
|
1958
|
+
/* @__PURE__ */ u("pattern", {
|
|
1959
|
+
width: k,
|
|
1960
|
+
height: A,
|
|
1961
|
+
id: `${c}-subdivision`,
|
|
1962
|
+
patternUnits: "userSpaceOnUse",
|
|
1963
|
+
children: /* @__PURE__ */ d("g", {
|
|
1964
|
+
stroke: "var(--grid-line-subdivision-color)",
|
|
1965
|
+
children: [i !== !1 && D > 1 && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("line", {
|
|
1966
|
+
x1: 0,
|
|
1967
|
+
y1: 0,
|
|
1968
|
+
x2: 0,
|
|
1969
|
+
y2: A
|
|
1970
|
+
}), /* @__PURE__ */ u("line", {
|
|
1971
|
+
x1: k,
|
|
1972
|
+
y1: 0,
|
|
1973
|
+
x2: k,
|
|
1974
|
+
y2: A
|
|
1975
|
+
})] }), a !== !1 && O > 1 && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("line", {
|
|
1976
|
+
x1: 0,
|
|
1977
|
+
y1: 0,
|
|
1978
|
+
x2: k,
|
|
1979
|
+
y2: 0
|
|
1980
|
+
}), /* @__PURE__ */ u("line", {
|
|
1981
|
+
x1: 0,
|
|
1982
|
+
y1: A,
|
|
1983
|
+
x2: k,
|
|
1984
|
+
y2: A
|
|
1985
|
+
})] })]
|
|
1986
|
+
})
|
|
1987
|
+
}),
|
|
1988
|
+
/* @__PURE__ */ u("rect", {
|
|
1989
|
+
width: T,
|
|
1990
|
+
height: E,
|
|
1991
|
+
fill: `url(#${c}-subdivision)`
|
|
1992
|
+
}),
|
|
1993
|
+
/* @__PURE__ */ d("g", {
|
|
1994
|
+
stroke: "var(--mafs-line-color)",
|
|
1995
|
+
children: [a && o.lines && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("line", {
|
|
1996
|
+
x1: 0,
|
|
1997
|
+
y1: 0,
|
|
1998
|
+
x2: T,
|
|
1999
|
+
y2: 0
|
|
2000
|
+
}), /* @__PURE__ */ u("line", {
|
|
2001
|
+
x1: 0,
|
|
2002
|
+
y1: E,
|
|
2003
|
+
x2: T,
|
|
2004
|
+
y2: E
|
|
2005
|
+
})] }), i && s.lines && /* @__PURE__ */ d(l, { children: [/* @__PURE__ */ u("line", {
|
|
2006
|
+
x1: 0,
|
|
2007
|
+
y1: 0,
|
|
2008
|
+
x2: 0,
|
|
2009
|
+
y2: E
|
|
2010
|
+
}), /* @__PURE__ */ u("line", {
|
|
2011
|
+
x1: T,
|
|
2012
|
+
y1: 0,
|
|
2013
|
+
x2: T,
|
|
2014
|
+
y2: E
|
|
2015
|
+
})] })]
|
|
2016
|
+
})
|
|
2017
|
+
]
|
|
2018
|
+
}),
|
|
2019
|
+
/* @__PURE__ */ u("rect", {
|
|
2020
|
+
x: y,
|
|
2021
|
+
y: S,
|
|
2022
|
+
width: x - y,
|
|
2023
|
+
height: b - S,
|
|
2024
|
+
fill: `url(#${c})`
|
|
2025
|
+
}),
|
|
2026
|
+
/* @__PURE__ */ d("g", {
|
|
2027
|
+
stroke: "var(--mafs-origin-color)",
|
|
2028
|
+
strokeWidth: "var(--mafs-axis-stroke-width)",
|
|
2029
|
+
children: [i && o.axis && /* @__PURE__ */ u("line", {
|
|
2030
|
+
x1: y,
|
|
2031
|
+
y1: 0,
|
|
2032
|
+
x2: x,
|
|
2033
|
+
y2: 0
|
|
2034
|
+
}), a && s.axis && /* @__PURE__ */ u("line", {
|
|
2035
|
+
x1: 0,
|
|
2036
|
+
y1: b,
|
|
2037
|
+
x2: 0,
|
|
2038
|
+
y2: S
|
|
2039
|
+
})]
|
|
2040
|
+
}),
|
|
2041
|
+
/* @__PURE__ */ d("g", {
|
|
2042
|
+
className: "mafs-shadow",
|
|
2043
|
+
children: [i && o.labels && /* @__PURE__ */ u(sn, {
|
|
2044
|
+
separation: o.lines || 1,
|
|
2045
|
+
labelMaker: o.labels
|
|
2046
|
+
}), a && s.labels && /* @__PURE__ */ u(cn, {
|
|
2047
|
+
separation: s.lines || 1,
|
|
2048
|
+
labelMaker: s.labels
|
|
2049
|
+
})]
|
|
2050
|
+
})
|
|
2051
|
+
]
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
un.displayName = "Coordinates.Cartesian";
|
|
2055
|
+
function dn(e, t, n) {
|
|
2056
|
+
let r = Math.floor(e / n) * n, i = Math.ceil(t / n) * n;
|
|
2057
|
+
return r === i - n ? [r] : W(r, i - n, n);
|
|
2058
|
+
}
|
|
2059
|
+
var fn = W(0, 2 * Math.PI, Math.PI / 12);
|
|
2060
|
+
function pn({ xAxis: e, yAxis: t, lines: n = 1, subdivisions: r }) {
|
|
2061
|
+
let i = e !== !1, a = t !== !1, o = {
|
|
2062
|
+
...on,
|
|
2063
|
+
...e
|
|
2064
|
+
}, s = {
|
|
2065
|
+
...on,
|
|
2066
|
+
...t
|
|
2067
|
+
}, { viewTransform: c } = Y(), { xPaneRange: l, yPaneRange: f } = G(), [p, m] = l, [h, g] = f, _ = [
|
|
2068
|
+
K.mag([p, h]),
|
|
2069
|
+
K.mag([p, g]),
|
|
2070
|
+
K.mag([m, h]),
|
|
2071
|
+
K.mag([m, g]),
|
|
2072
|
+
K.mag([(p + m) / 2, (h + g) / 2])
|
|
2073
|
+
], v = n, y = Math.min(..._) < Math.max(m - p, g - h) ? 0 : Math.min(..._), b = Math.max(..._), x = Math.floor(y / v) * v, S = Math.ceil(b / v) * v, [C, w] = K.transform([p, h], c), [T, E] = K.transform([m, g], c), [D, O] = K.transform([1, -1], c), k = W(x, S, v), A = r == null ? [] : W(x, S, v / r);
|
|
2074
|
+
return /* @__PURE__ */ d("g", {
|
|
2075
|
+
fill: "none",
|
|
2076
|
+
children: [
|
|
2077
|
+
/* @__PURE__ */ u("g", {
|
|
2078
|
+
stroke: "var(--grid-line-subdivision-color)",
|
|
2079
|
+
children: fn.map((e) => /* @__PURE__ */ u("line", {
|
|
2080
|
+
x1: 0,
|
|
2081
|
+
y1: 0,
|
|
2082
|
+
x2: Math.cos(e) * S * D,
|
|
2083
|
+
y2: -Math.sin(e) * S * O
|
|
2084
|
+
}, e))
|
|
2085
|
+
}),
|
|
2086
|
+
A.map((e) => /* @__PURE__ */ u("ellipse", {
|
|
2087
|
+
"data-r": e,
|
|
2088
|
+
cx: 0,
|
|
2089
|
+
cy: 0,
|
|
2090
|
+
rx: e * D,
|
|
2091
|
+
ry: e * O,
|
|
2092
|
+
stroke: "var(--grid-line-subdivision-color)"
|
|
2093
|
+
}, e)),
|
|
2094
|
+
k.map((e) => /* @__PURE__ */ u("ellipse", {
|
|
2095
|
+
"data-r": e,
|
|
2096
|
+
cx: 0,
|
|
2097
|
+
cy: 0,
|
|
2098
|
+
rx: e * D,
|
|
2099
|
+
ry: e * O,
|
|
2100
|
+
stroke: "var(--mafs-line-color)"
|
|
2101
|
+
}, e)),
|
|
2102
|
+
/* @__PURE__ */ d("g", {
|
|
2103
|
+
stroke: "var(--mafs-origin-color)",
|
|
2104
|
+
strokeWidth: "var(--mafs-axis-stroke-width)",
|
|
2105
|
+
children: [i && o.axis && /* @__PURE__ */ u("line", {
|
|
2106
|
+
x1: C,
|
|
2107
|
+
y1: 0,
|
|
2108
|
+
x2: T,
|
|
2109
|
+
y2: 0
|
|
2110
|
+
}), a && s.axis && /* @__PURE__ */ u("line", {
|
|
2111
|
+
x1: 0,
|
|
2112
|
+
y1: w,
|
|
2113
|
+
x2: 0,
|
|
2114
|
+
y2: E
|
|
2115
|
+
})]
|
|
2116
|
+
}),
|
|
2117
|
+
/* @__PURE__ */ d("g", {
|
|
2118
|
+
className: "mafs-shadow",
|
|
2119
|
+
children: [i && o.labels && /* @__PURE__ */ u(sn, {
|
|
2120
|
+
separation: e?.lines || n || 1,
|
|
2121
|
+
labelMaker: o.labels || an
|
|
2122
|
+
}), a && s.labels && /* @__PURE__ */ u(cn, {
|
|
2123
|
+
separation: t?.lines || n || 1,
|
|
2124
|
+
labelMaker: s.labels || an
|
|
2125
|
+
})]
|
|
2126
|
+
})
|
|
2127
|
+
]
|
|
2128
|
+
});
|
|
2129
|
+
}
|
|
2130
|
+
pn.displayName = "Coordinates.Polar";
|
|
2131
|
+
var mn = {
|
|
2132
|
+
Cartesian: un,
|
|
2133
|
+
Polar: pn
|
|
2134
|
+
};
|
|
2135
|
+
function hn({ point1: e, point2: t, color: n = X.foreground, style: r = "solid", weight: i = 2, opacity: a = 1 }) {
|
|
2136
|
+
let { xPaneRange: o, yPaneRange: s } = G(), [c, l] = o, [d, f] = s, { userTransform: p } = Y(), m = K.transform(e, p), h = K.transform(t, p), g = (h[1] - m[1]) / (h[0] - m[0]), _, v;
|
|
2137
|
+
return Math.abs(Math.atan(g)) > Math.PI / 4 ? (_ = [(d - m[1]) / g + m[0], d], v = [(f - m[1]) / g + m[0], f]) : (_ = [c, g * (c - m[0]) + m[1]], v = [l, g * (l - m[0]) + m[1]]), /* @__PURE__ */ u("line", {
|
|
2138
|
+
x1: U(_[0], 2),
|
|
2139
|
+
y1: U(_[1], 2),
|
|
2140
|
+
x2: U(v[0], 2),
|
|
2141
|
+
y2: U(v[1], 2),
|
|
2142
|
+
style: {
|
|
2143
|
+
stroke: n,
|
|
2144
|
+
strokeDasharray: r === "dashed" ? "var(--mafs-line-stroke-dash-style)" : void 0,
|
|
2145
|
+
transform: "var(--mafs-view-transform)",
|
|
2146
|
+
vectorEffect: "non-scaling-stroke"
|
|
2147
|
+
},
|
|
2148
|
+
strokeWidth: i,
|
|
2149
|
+
opacity: a
|
|
2150
|
+
});
|
|
2151
|
+
}
|
|
2152
|
+
hn.displayName = "Line.ThroughPoints";
|
|
2153
|
+
function gn({ point: e, angle: t, ...n }) {
|
|
2154
|
+
let r = K.add(e, K.rotate([1, 0], t));
|
|
2155
|
+
return /* @__PURE__ */ u(hn, {
|
|
2156
|
+
point1: e,
|
|
2157
|
+
point2: r,
|
|
2158
|
+
...n
|
|
2159
|
+
});
|
|
2160
|
+
}
|
|
2161
|
+
gn.displayName = "Line.PointAngle";
|
|
2162
|
+
function _n({ point: e, slope: t, ...n }) {
|
|
2163
|
+
return /* @__PURE__ */ u(gn, {
|
|
2164
|
+
point: e,
|
|
2165
|
+
angle: Math.atan(t),
|
|
2166
|
+
...n
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
2169
|
+
_n.displayName = "Line.PointSlope";
|
|
2170
|
+
function vn({ point1: e, point2: t, color: n = X.foreground, style: r = "solid", weight: i = 2, opacity: a = 1 }) {
|
|
2171
|
+
let { viewTransform: o, userTransform: s } = Y(), c = K.matrixMult(o, s), l = K.transform(e, c), d = K.transform(t, c);
|
|
2172
|
+
return /* @__PURE__ */ u("line", {
|
|
2173
|
+
x1: U(l[0], 2),
|
|
2174
|
+
y1: U(l[1], 2),
|
|
2175
|
+
x2: U(d[0], 2),
|
|
2176
|
+
y2: U(d[1], 2),
|
|
2177
|
+
style: {
|
|
2178
|
+
stroke: n,
|
|
2179
|
+
strokeDasharray: r === "dashed" ? "var(--mafs-line-stroke-dash-style)" : void 0
|
|
2180
|
+
},
|
|
2181
|
+
strokeWidth: i,
|
|
2182
|
+
opacity: a
|
|
2183
|
+
});
|
|
2184
|
+
}
|
|
2185
|
+
vn.displayName = "Line.Segment";
|
|
2186
|
+
var yn = {
|
|
2187
|
+
PointAngle: gn,
|
|
2188
|
+
PointSlope: _n,
|
|
2189
|
+
ThroughPoints: hn,
|
|
2190
|
+
Segment: vn
|
|
2191
|
+
};
|
|
2192
|
+
function bn({ fillOpacity: e = 0, svgPolylineProps: t, ...n }) {
|
|
2193
|
+
return /* @__PURE__ */ u(Qt, {
|
|
2194
|
+
element: "polyline",
|
|
2195
|
+
fillOpacity: e,
|
|
2196
|
+
svgPolyProps: t,
|
|
2197
|
+
...n
|
|
2198
|
+
});
|
|
2199
|
+
}
|
|
2200
|
+
bn.displayName = "Polyline";
|
|
2201
|
+
function xn({ x: e, y: t, color: n = X.foreground, opacity: r = 1, svgCircleProps: i = {} }) {
|
|
2202
|
+
let { viewTransform: a, userTransform: o } = Y(), [s, c] = K.transform([e, t], K.matrixMult(a, o));
|
|
2203
|
+
return /* @__PURE__ */ u("circle", {
|
|
2204
|
+
cx: s,
|
|
2205
|
+
cy: c,
|
|
2206
|
+
r: 6,
|
|
2207
|
+
...i,
|
|
2208
|
+
style: {
|
|
2209
|
+
fill: n,
|
|
2210
|
+
opacity: r,
|
|
2211
|
+
...i.style
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
}
|
|
2215
|
+
xn.displayName = "Point";
|
|
2216
|
+
function Sn({ children: e, x: t, y: n, color: r, size: i = 30, svgTextProps: a = {}, attach: o, attachDistance: s = 0 }) {
|
|
2217
|
+
let { viewTransform: c, userTransform: l } = Y(), d = 0, f = "middle";
|
|
2218
|
+
o?.includes("w") ? (f = "end", d = -1) : o?.includes("e") && (f = "start", d = 1);
|
|
2219
|
+
let p = 0, m = "middle";
|
|
2220
|
+
o?.includes("n") ? (m = "baseline", p = 1) : o?.includes("s") && (m = "hanging", p = -1);
|
|
2221
|
+
let [h, g] = [0, 0];
|
|
2222
|
+
(d !== 0 || p !== 0) && ([h, g] = K.withMag([d, p], s));
|
|
2223
|
+
let _ = K.transform([t, n], K.matrixMult(c, l));
|
|
2224
|
+
return /* @__PURE__ */ u("text", {
|
|
2225
|
+
x: _[0] + h,
|
|
2226
|
+
y: _[1] + g,
|
|
2227
|
+
fontSize: i,
|
|
2228
|
+
dominantBaseline: m,
|
|
2229
|
+
textAnchor: f,
|
|
2230
|
+
style: {
|
|
2231
|
+
fill: r || "var(--mafs-fg)",
|
|
2232
|
+
vectorEffect: "non-scaling-stroke"
|
|
2233
|
+
},
|
|
2234
|
+
className: "mafs-shadow",
|
|
2235
|
+
...a,
|
|
2236
|
+
children: e
|
|
2237
|
+
});
|
|
2238
|
+
}
|
|
2239
|
+
Sn.displayName = "Text";
|
|
2240
|
+
// src/components/plot/mafs-plot-grid.ts
|
|
2241
|
+
var Cn = [
|
|
2242
|
+
1,
|
|
2243
|
+
2,
|
|
2244
|
+
2.5,
|
|
2245
|
+
4,
|
|
2246
|
+
5
|
|
2247
|
+
], wn = .04, Tn = 58, En = 30, Dn = 110, On = 560, kn = 360;
|
|
2248
|
+
function Z(e, t) {
|
|
2249
|
+
return Number.isFinite(e) && e > 0 ? e : t;
|
|
2250
|
+
}
|
|
2251
|
+
function An(e) {
|
|
2252
|
+
if (!e || !Number.isFinite(e.min) || !Number.isFinite(e.max)) return {
|
|
2253
|
+
min: 0,
|
|
2254
|
+
max: 1
|
|
2255
|
+
};
|
|
2256
|
+
let t = Math.min(e.min, e.max), n = Math.max(e.min, e.max);
|
|
2257
|
+
if (n > t) return {
|
|
2258
|
+
min: t,
|
|
2259
|
+
max: n
|
|
2260
|
+
};
|
|
2261
|
+
let r = (t + n) / 2, i = Math.max(Math.abs(r) * .15, .5);
|
|
2262
|
+
return {
|
|
2263
|
+
min: r - i,
|
|
2264
|
+
max: r + i
|
|
2265
|
+
};
|
|
2266
|
+
}
|
|
2267
|
+
function jn(e, t) {
|
|
2268
|
+
let n = (e.max - e.min) * t;
|
|
2269
|
+
return {
|
|
2270
|
+
min: e.min - n,
|
|
2271
|
+
max: e.max + n
|
|
2272
|
+
};
|
|
2273
|
+
}
|
|
2274
|
+
function Mn(e, t) {
|
|
2275
|
+
let n = Math.max(t, e.max - e.min), r = (e.min + e.max) / 2;
|
|
2276
|
+
return {
|
|
2277
|
+
min: r - n / 2,
|
|
2278
|
+
max: r + n / 2
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
function Nn(e) {
|
|
2282
|
+
if (!Number.isFinite(e) || e <= 0) return 1;
|
|
2283
|
+
let t = Math.floor(Math.log10(e)), n = e / 10 ** t, r = Cn[0];
|
|
2284
|
+
for (let e of Cn) e <= n + 1e-9 && (r = e);
|
|
2285
|
+
return r * 10 ** t;
|
|
2286
|
+
}
|
|
2287
|
+
function Pn(e, t) {
|
|
2288
|
+
if (!Number.isFinite(e) || !Number.isFinite(t) || e <= 0 || t < e) return [];
|
|
2289
|
+
let n = [], r = Math.floor(Math.log10(e)) - 1, i = Math.ceil(Math.log10(t)) + 1;
|
|
2290
|
+
for (let a = r; a <= i; a += 1) for (let r of Cn) {
|
|
2291
|
+
let i = r * 10 ** a;
|
|
2292
|
+
i >= e * (1 - 1e-9) && i <= t * (1 + 1e-9) && n.push(i);
|
|
2293
|
+
}
|
|
2294
|
+
return n;
|
|
2295
|
+
}
|
|
2296
|
+
function Fn(e, t, n, r) {
|
|
2297
|
+
let i = Pn(e * n / t, e * r / t);
|
|
2298
|
+
return i.length > 0 ? i : [Nn(e / 8)];
|
|
2299
|
+
}
|
|
2300
|
+
function In(e) {
|
|
2301
|
+
let t = Z(e.width, On), n = Z(e.height, kn), r = e.padding === void 0 ? wn : Math.max(0, e.padding), i = Z(e.targetCellPx, Tn), a = Z(e.minCellPx, En), o = Z(e.maxCellPx, Dn), s = jn(An(e.xDomain), r), c = jn(An(e.yDomain), r), l = s.max - s.min, u = c.max - c.min, d = Fn(l, t, a, o), f = Fn(u, n, a, o), p = null;
|
|
2302
|
+
for (let e of d) for (let r of f) {
|
|
2303
|
+
let a = e * t / l, o = r * n / u, s = Math.min(a, o);
|
|
2304
|
+
if (!(s > 0)) continue;
|
|
2305
|
+
let c = Math.max(a, o) / s - 1, d = Math.abs(Math.log(s / i)), f = c * 4 + d;
|
|
2306
|
+
(!p || f < p.score) && (p = {
|
|
2307
|
+
xLines: e,
|
|
2308
|
+
yLines: r,
|
|
2309
|
+
cellPx: s,
|
|
2310
|
+
score: f
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
if (!p) {
|
|
2314
|
+
let e = Nn(l / 8), r = Nn(u / 6);
|
|
2315
|
+
return {
|
|
2316
|
+
xLines: e,
|
|
2317
|
+
yLines: r,
|
|
2318
|
+
xRange: s,
|
|
2319
|
+
yRange: c,
|
|
2320
|
+
cellPx: Math.min(e * t / l, r * n / u)
|
|
2321
|
+
};
|
|
2322
|
+
}
|
|
2323
|
+
let m = p.xLines * t / p.cellPx, h = p.yLines * n / p.cellPx;
|
|
2324
|
+
return {
|
|
2325
|
+
xLines: p.xLines,
|
|
2326
|
+
yLines: p.yLines,
|
|
2327
|
+
xRange: Mn(s, m),
|
|
2328
|
+
yRange: Mn(c, h),
|
|
2329
|
+
cellPx: p.cellPx
|
|
2330
|
+
};
|
|
2331
|
+
}
|
|
2332
|
+
// src/components/plot/mafs-visuals.tsx
|
|
2333
|
+
function Ln(e, t, n) {
|
|
2334
|
+
return Math.min(n, Math.max(t, e));
|
|
2335
|
+
}
|
|
2336
|
+
function Q(e) {
|
|
2337
|
+
let t = Math.abs(e);
|
|
2338
|
+
return t >= 1e6 || t > 0 && t < .001 ? e.toExponential(2) : String(Number(e.toFixed(4)));
|
|
2339
|
+
}
|
|
2340
|
+
function $(e) {
|
|
2341
|
+
return Math.abs(e) < 1e-9 ? "" : Q(e);
|
|
2342
|
+
}
|
|
2343
|
+
function Rn({ xSpacing: e, ySpacing: t, subdivisions: n, width: r, height: a, xLabelMinGap: c, yLabelMinGap: l }) {
|
|
2344
|
+
let { viewTransform: d } = Y(), f = o(null), [p, m] = s(null);
|
|
2345
|
+
i(() => {
|
|
2346
|
+
let e = f.current?.ownerSVGElement?.getAttribute("viewBox")?.split(/\s+/).map(Number);
|
|
2347
|
+
!e || e.length < 2 || !Number.isFinite(e[0]) || !Number.isFinite(e[1]) || m((t) => t && t[0] === e[0] && t[1] === e[1] ? t : [e[0], e[1]]);
|
|
2348
|
+
});
|
|
2349
|
+
let h = t ?? e, g = Math.abs(d[0] * e), _ = Math.abs(d[4] * h), v = zn(g, c), y = zn(_, l);
|
|
2350
|
+
return /* @__PURE__ */ u("g", {
|
|
2351
|
+
ref: f,
|
|
2352
|
+
children: /* @__PURE__ */ u(mn.Cartesian, {
|
|
2353
|
+
xAxis: {
|
|
2354
|
+
lines: e,
|
|
2355
|
+
subdivisions: n,
|
|
2356
|
+
labels: (t) => {
|
|
2357
|
+
if (!Bn(t, e, v)) return "";
|
|
2358
|
+
if (!p) return $(t);
|
|
2359
|
+
let n = K.transform([t, 0], d)[0] - p[0];
|
|
2360
|
+
return n < 14 || n > r - 14 ? "" : $(t);
|
|
2361
|
+
}
|
|
2362
|
+
},
|
|
2363
|
+
yAxis: {
|
|
2364
|
+
lines: h,
|
|
2365
|
+
subdivisions: n,
|
|
2366
|
+
labels: (e) => {
|
|
2367
|
+
if (!Bn(e, h, y)) return "";
|
|
2368
|
+
if (!p) return $(e);
|
|
2369
|
+
let t = K.transform([0, e], d)[1] - p[1];
|
|
2370
|
+
return t < 14 || t > a - 14 ? "" : $(e);
|
|
2371
|
+
}
|
|
2372
|
+
}
|
|
2373
|
+
})
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
function zn(e, t) {
|
|
2377
|
+
return !t || !(e > 0) || t <= e ? 1 : Math.ceil(t / e - 1e-9);
|
|
2378
|
+
}
|
|
2379
|
+
function Bn(e, t, n) {
|
|
2380
|
+
if (n <= 1 || !(t > 0)) return !0;
|
|
2381
|
+
let r = e / t, i = Math.round(r);
|
|
2382
|
+
return Math.abs(r - i) < 1e-6 && (i % n + n) % n === 0;
|
|
2383
|
+
}
|
|
2384
|
+
function Vn(e) {
|
|
2385
|
+
let [t, n] = s(0);
|
|
2386
|
+
return r(() => {
|
|
2387
|
+
let t = e.current;
|
|
2388
|
+
if (!t || (n(t.getBoundingClientRect().width), typeof ResizeObserver > "u")) return;
|
|
2389
|
+
let r = new ResizeObserver((e) => n(e[0].contentRect.width));
|
|
2390
|
+
return r.observe(t), () => r.disconnect();
|
|
2391
|
+
}, [e]), t;
|
|
2392
|
+
}
|
|
2393
|
+
function Hn(e, t) {
|
|
2394
|
+
let n = t > 0 ? t : 1, r = e / 8;
|
|
2395
|
+
for (let e of [
|
|
2396
|
+
1,
|
|
2397
|
+
2,
|
|
2398
|
+
5,
|
|
2399
|
+
10,
|
|
2400
|
+
20,
|
|
2401
|
+
50,
|
|
2402
|
+
100
|
|
2403
|
+
]) if (n * e >= r) return n * e;
|
|
2404
|
+
return n * 100;
|
|
2405
|
+
}
|
|
2406
|
+
function Un(e) {
|
|
2407
|
+
let t = Math.floor(Math.log10(e)), n = e / 10 ** t;
|
|
2408
|
+
return (n < 1.5 ? 2 : n < 3.5 ? 5 : 10) * 10 ** t;
|
|
2409
|
+
}
|
|
2410
|
+
function Wn(e, t, n, r) {
|
|
2411
|
+
let i = Math.min(n || r, r || n) || 1, a = Math.max(e, t);
|
|
2412
|
+
for (let e = 0; e < 12 && a / i > 10; e += 1) i = Un(i * 1.01);
|
|
2413
|
+
return i;
|
|
2414
|
+
}
|
|
2415
|
+
function Gn(e, t, n) {
|
|
2416
|
+
let r = n > 0 ? n : 1, i = Math.max(0, Math.floor((t.max - t.min) / r + 1e-9)), a = Ln(Math.round((e - t.min) / r), 0, i), o = t.min + a * r;
|
|
2417
|
+
return Number(o.toPrecision(15));
|
|
2418
|
+
}
|
|
2419
|
+
function Kn({ x: e, y: t, xRange: n, yRange: r, step: i, disabled: a, accent: s, onMove: c }) {
|
|
2420
|
+
let l = Math.max(1e-9, n.max - n.min), f = Math.max(1e-9, r.max - r.min), p = Wn(l, f, Hn(l, i), Hn(f, i)), m = (() => {
|
|
2421
|
+
let e = Math.round(p / (i > 0 ? i : 1)) - 1;
|
|
2422
|
+
return e > 0 && e;
|
|
2423
|
+
})(), h = Ln(0, n.min, n.max), g = Ln(0, r.min, r.max), _ = o(null), v = Vn(_);
|
|
2424
|
+
return /* @__PURE__ */ u("div", {
|
|
2425
|
+
ref: _,
|
|
2426
|
+
"data-rmd-part": "plane",
|
|
2427
|
+
children: /* @__PURE__ */ d(nn, {
|
|
2428
|
+
height: 420,
|
|
2429
|
+
width: "auto",
|
|
2430
|
+
pan: !1,
|
|
2431
|
+
zoom: !1,
|
|
2432
|
+
preserveAspectRatio: "contain",
|
|
2433
|
+
viewBox: {
|
|
2434
|
+
x: [n.min, n.max],
|
|
2435
|
+
y: [r.min, r.max],
|
|
2436
|
+
padding: Math.max(l, f) * .09
|
|
2437
|
+
},
|
|
2438
|
+
children: [
|
|
2439
|
+
/* @__PURE__ */ u(Rn, {
|
|
2440
|
+
xSpacing: p,
|
|
2441
|
+
subdivisions: m,
|
|
2442
|
+
width: v,
|
|
2443
|
+
height: 420
|
|
2444
|
+
}),
|
|
2445
|
+
/* @__PURE__ */ u(yn.Segment, {
|
|
2446
|
+
point1: [e, g],
|
|
2447
|
+
point2: [e, t],
|
|
2448
|
+
color: s,
|
|
2449
|
+
opacity: .5,
|
|
2450
|
+
style: "dashed",
|
|
2451
|
+
weight: 1.5
|
|
2452
|
+
}),
|
|
2453
|
+
/* @__PURE__ */ u(yn.Segment, {
|
|
2454
|
+
point1: [h, t],
|
|
2455
|
+
point2: [e, t],
|
|
2456
|
+
color: s,
|
|
2457
|
+
opacity: .5,
|
|
2458
|
+
style: "dashed",
|
|
2459
|
+
weight: 1.5
|
|
2460
|
+
}),
|
|
2461
|
+
/* @__PURE__ */ u(qt, {
|
|
2462
|
+
point: [e, t],
|
|
2463
|
+
onMove: ([e, t]) => c(e, t),
|
|
2464
|
+
constrain: ([o, s]) => a ? [e, t] : [Gn(o, n, i), Gn(s, r, i)],
|
|
2465
|
+
color: s
|
|
2466
|
+
}),
|
|
2467
|
+
/* @__PURE__ */ d(Sn, {
|
|
2468
|
+
x: e,
|
|
2469
|
+
y: t,
|
|
2470
|
+
attach: "s",
|
|
2471
|
+
attachDistance: 24,
|
|
2472
|
+
color: s,
|
|
2473
|
+
size: 17,
|
|
2474
|
+
svgTextProps: { textAnchor: "middle" },
|
|
2475
|
+
children: [
|
|
2476
|
+
"(",
|
|
2477
|
+
Q(e),
|
|
2478
|
+
", ",
|
|
2479
|
+
Q(t),
|
|
2480
|
+
")"
|
|
2481
|
+
]
|
|
2482
|
+
})
|
|
2483
|
+
]
|
|
2484
|
+
})
|
|
2485
|
+
});
|
|
2486
|
+
}
|
|
2487
|
+
var qn = 360, Jn = 560;
|
|
2488
|
+
function Yn({ viewRef: e }) {
|
|
2489
|
+
return e.current = Y().viewTransform, null;
|
|
2490
|
+
}
|
|
2491
|
+
function Xn({ label: e, readoutId: t, xDomain: n, yDomain: i, segments: a, colors: c, focused: f, onFocusedChange: p, onActiveXChange: m, curvePointAt: h, onKeyDown: g, onFocus: _, onBlur: v }) {
|
|
2492
|
+
let y = o(null), b = o(null), [x, S] = s(null), C = Vn(y);
|
|
2493
|
+
r(() => {
|
|
2494
|
+
y.current?.querySelector(".MafsView")?.setAttribute("tabindex", "-1");
|
|
2495
|
+
}, []);
|
|
2496
|
+
let w = In({
|
|
2497
|
+
xDomain: n,
|
|
2498
|
+
yDomain: i,
|
|
2499
|
+
width: C > 0 ? C : Jn,
|
|
2500
|
+
height: qn
|
|
2501
|
+
}), T = 16 + Math.max($(n.min).length, $(n.max).length, 1) * 8, E = (e) => {
|
|
2502
|
+
let t = b.current, n = y.current?.querySelector(".MafsView svg");
|
|
2503
|
+
if (!t || !n) return null;
|
|
2504
|
+
let r = n.getBoundingClientRect();
|
|
2505
|
+
if (e.clientX < r.left || e.clientX > r.right || e.clientY < r.top || e.clientY > r.bottom) return null;
|
|
2506
|
+
let i = n.getScreenCTM(), a = K.matrixInvert(t);
|
|
2507
|
+
if (!i || !a) return null;
|
|
2508
|
+
let o = new DOMPoint(e.clientX, e.clientY).matrixTransform(i.inverse());
|
|
2509
|
+
return K.transform([o.x, o.y], a);
|
|
2510
|
+
}, D = (e, t, n) => {
|
|
2511
|
+
let r = b.current;
|
|
2512
|
+
if (!r) return null;
|
|
2513
|
+
let i = Math.abs(r[0]) || 1, a = Math.abs(r[4]) || 1, o = null;
|
|
2514
|
+
for (let r = 0; r < c.length; r += 1) {
|
|
2515
|
+
let s = h(r, e);
|
|
2516
|
+
if (!s || !Number.isFinite(s.y)) continue;
|
|
2517
|
+
let c = Math.hypot((s.x - e) * i, (s.y - t) * a);
|
|
2518
|
+
c <= n && (!o || c < o.distance) && (o = {
|
|
2519
|
+
curve: r,
|
|
2520
|
+
distance: c
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
return o ? o.curve : null;
|
|
2524
|
+
}, O = (e) => {
|
|
2525
|
+
let t = E(e);
|
|
2526
|
+
if (!t) {
|
|
2527
|
+
S(null), m(null);
|
|
2528
|
+
return;
|
|
2529
|
+
}
|
|
2530
|
+
let [r, i] = t;
|
|
2531
|
+
if (r < n.min || r > n.max) {
|
|
2532
|
+
S(null), m(null);
|
|
2533
|
+
return;
|
|
2534
|
+
}
|
|
2535
|
+
m(r);
|
|
2536
|
+
let a = f ?? D(r, i, 44);
|
|
2537
|
+
if (a === null) {
|
|
2538
|
+
S(null);
|
|
2539
|
+
return;
|
|
2540
|
+
}
|
|
2541
|
+
let o = h(a, r), s = o !== null && Math.abs(o.x - r) < 1e-6;
|
|
2542
|
+
S(s && Number.isFinite(o.y) ? {
|
|
2543
|
+
curve: a,
|
|
2544
|
+
x: o.x,
|
|
2545
|
+
y: o.y
|
|
2546
|
+
} : null);
|
|
2547
|
+
}, k = () => {
|
|
2548
|
+
S(null), m(null);
|
|
2549
|
+
}, A = ([e, t]) => {
|
|
2550
|
+
let n = D(e, t, 28);
|
|
2551
|
+
if (p(n), m(e), n === null) {
|
|
2552
|
+
S(null);
|
|
2553
|
+
return;
|
|
2554
|
+
}
|
|
2555
|
+
let r = h(n, e), i = r !== null && Math.abs(r.x - e) < 1e-6;
|
|
2556
|
+
S(i && Number.isFinite(r.y) ? {
|
|
2557
|
+
curve: n,
|
|
2558
|
+
x: r.x,
|
|
2559
|
+
y: r.y
|
|
2560
|
+
} : null);
|
|
2561
|
+
}, j = x && x.curve < c.length ? c[x.curve] : c[0], ee = Ln(0, i.min, i.max), M = x ? x.y > i.max - (i.max - i.min) * .08 : !1;
|
|
2562
|
+
return /* @__PURE__ */ u("div", {
|
|
2563
|
+
ref: y,
|
|
2564
|
+
className: "local-mafs-plot",
|
|
2565
|
+
role: "group",
|
|
2566
|
+
"aria-label": e,
|
|
2567
|
+
"aria-describedby": t,
|
|
2568
|
+
tabIndex: 0,
|
|
2569
|
+
"data-rmd-part": "plane",
|
|
2570
|
+
onPointerDown: () => y.current?.focus({ preventScroll: !0 }),
|
|
2571
|
+
onPointerMove: O,
|
|
2572
|
+
onPointerLeave: k,
|
|
2573
|
+
onKeyDownCapture: g,
|
|
2574
|
+
onFocus: _,
|
|
2575
|
+
onBlur: v,
|
|
2576
|
+
children: /* @__PURE__ */ d(nn, {
|
|
2577
|
+
height: qn,
|
|
2578
|
+
width: "auto",
|
|
2579
|
+
pan: !0,
|
|
2580
|
+
zoom: {
|
|
2581
|
+
min: .4,
|
|
2582
|
+
max: 4
|
|
2583
|
+
},
|
|
2584
|
+
preserveAspectRatio: !1,
|
|
2585
|
+
viewBox: {
|
|
2586
|
+
x: [w.xRange.min, w.xRange.max],
|
|
2587
|
+
y: [w.yRange.min, w.yRange.max],
|
|
2588
|
+
padding: 0
|
|
2589
|
+
},
|
|
2590
|
+
onClick: A,
|
|
2591
|
+
children: [
|
|
2592
|
+
/* @__PURE__ */ u(Yn, { viewRef: b }),
|
|
2593
|
+
/* @__PURE__ */ u(Rn, {
|
|
2594
|
+
xSpacing: w.xLines,
|
|
2595
|
+
ySpacing: w.yLines,
|
|
2596
|
+
width: C > 0 ? C : Jn,
|
|
2597
|
+
height: qn,
|
|
2598
|
+
xLabelMinGap: T,
|
|
2599
|
+
yLabelMinGap: 24
|
|
2600
|
+
}),
|
|
2601
|
+
a.map((e, t) => e.points.length > 1 ? /* @__PURE__ */ u(bn, {
|
|
2602
|
+
points: e.points.map((e) => [e.x, e.y]),
|
|
2603
|
+
color: c[e.curve % c.length],
|
|
2604
|
+
weight: f === e.curve ? 3 : 2.4,
|
|
2605
|
+
strokeOpacity: f !== null && f !== e.curve ? .25 : 1
|
|
2606
|
+
}, `segment-${e.curve}-${t}`) : null),
|
|
2607
|
+
x ? /* @__PURE__ */ d(l, { children: [
|
|
2608
|
+
/* @__PURE__ */ u(yn.Segment, {
|
|
2609
|
+
point1: [x.x, ee],
|
|
2610
|
+
point2: [x.x, x.y],
|
|
2611
|
+
color: j,
|
|
2612
|
+
opacity: .35,
|
|
2613
|
+
style: "dashed",
|
|
2614
|
+
weight: 1.2
|
|
2615
|
+
}),
|
|
2616
|
+
/* @__PURE__ */ u(xn, {
|
|
2617
|
+
x: x.x,
|
|
2618
|
+
y: x.y,
|
|
2619
|
+
color: j,
|
|
2620
|
+
opacity: .18,
|
|
2621
|
+
svgCircleProps: { r: 9 }
|
|
2622
|
+
}),
|
|
2623
|
+
/* @__PURE__ */ u(xn, {
|
|
2624
|
+
x: x.x,
|
|
2625
|
+
y: x.y,
|
|
2626
|
+
color: j,
|
|
2627
|
+
svgCircleProps: { r: 4 }
|
|
2628
|
+
}),
|
|
2629
|
+
/* @__PURE__ */ d(Sn, {
|
|
2630
|
+
x: x.x,
|
|
2631
|
+
y: x.y,
|
|
2632
|
+
attach: M ? "n" : "s",
|
|
2633
|
+
attachDistance: M ? 12 : 20,
|
|
2634
|
+
color: j,
|
|
2635
|
+
size: 14,
|
|
2636
|
+
svgTextProps: { textAnchor: "middle" },
|
|
2637
|
+
children: [
|
|
2638
|
+
"(",
|
|
2639
|
+
Q(x.x),
|
|
2640
|
+
", ",
|
|
2641
|
+
Q(x.y),
|
|
2642
|
+
")"
|
|
2643
|
+
]
|
|
2644
|
+
})
|
|
2645
|
+
] }) : null
|
|
2646
|
+
]
|
|
2647
|
+
})
|
|
2648
|
+
});
|
|
2649
|
+
}
|
|
2650
|
+
// src/components/shared/use-hydrated.ts
|
|
2651
|
+
var Zn = () => () => {};
|
|
2652
|
+
function Qn() {
|
|
2653
|
+
return c(Zn, () => !0, () => !1);
|
|
2654
|
+
}
|
|
2655
|
+
export { Kn as n, Xn as r, Qn as t };
|