@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/cli/dist/lib/cli/project.js +2 -16
- package/cli/dist/lib/config.js +20 -29
- package/cli/dist/lib/local-test.js +3 -19
- package/cli/dist/lib/paths.js +11 -0
- package/cli/dist/lib/resolveNpmSpawn.d.ts +20 -0
- package/cli/dist/lib/resolveNpmSpawn.js +71 -0
- package/cli/dist/lib/template-engine/context/pluginPackageJsonData.js +21 -19
- package/cli/dist/lib/template-engine/context/standVitePackageJsonData.js +7 -8
- package/cli/dist/lib/template-engine/resolveVariantDir.d.ts +5 -1
- package/cli/dist/lib/template-engine/resolveVariantDir.js +22 -0
- package/cli/dist/lib/templates/shared/i18n.js +2 -2
- package/cli/dist/lib/templates/shared/paths.js +3 -4
- package/cli/dist/lib/types/package-config.d.ts +1 -0
- package/cli/lib/cli/project.ts +2 -18
- package/cli/lib/config.ts +19 -30
- package/cli/lib/local-test.ts +3 -22
- package/cli/lib/paths.ts +15 -0
- package/cli/lib/resolveNpmSpawn.ts +72 -0
- package/cli/lib/template-engine/buildStandIndexHtml.test.ts +1 -0
- package/cli/lib/template-engine/context/pluginPackageJsonData.ts +23 -23
- package/cli/lib/template-engine/context/standVitePackageJsonData.ts +7 -12
- package/cli/lib/template-engine/pluginEtaParity.test.ts +1 -0
- package/cli/lib/template-engine/resolveVariantDir.ts +22 -0
- package/cli/lib/template-engine/standAdvancedViteDevHostEta.test.ts +4 -3
- package/cli/lib/template-engine/standWebpackDevHostEta.test.ts +7 -6
- package/cli/lib/templates/shared/i18n.ts +2 -2
- package/cli/lib/templates/shared/paths.ts +3 -4
- package/cli/lib/types/package-config.ts +1 -0
- package/cli/package.json +1 -1
- package/cli/project-templates/plugin/assets/vite/{plugin-build.config.mjs → plugin-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/vite/{sandbox-build.config.mjs → sandbox-build.config.ts} +7 -5
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.module.cjs → plugin-build.legacy.module.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.legacy.umd.cjs → plugin-build.legacy.umd.ts} +20 -7
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.module.cjs → plugin-build.modern.module.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{plugin-build.modern.umd.cjs → plugin-build.modern.umd.ts} +9 -4
- package/cli/project-templates/plugin/assets/webpack/{sandbox-build.config.cjs → sandbox-build.config.ts} +13 -3
- package/cli/project-templates/plugin/bundler-vite/release.html.eta +1 -0
- package/cli/project-templates/plugin/bundler-webpack/public/release.html.eta +1 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-1.svg +10 -0
- package/cli/project-templates/plugin/shared-base/public/demo/product-2.svg +10 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-runner.ts +22 -0
- package/cli/project-templates/plugin/shared-base/scripts/build-types.ts +17 -0
- package/cli/project-templates/plugin/shared-base/scripts/clean.ts +16 -0
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.ts +52 -0
- package/cli/project-templates/plugin/shared-base/scripts/npmRun.ts +61 -0
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.ts +18 -0
- package/cli/project-templates/plugin/shared-base/scripts/scriptRuntime.ts +10 -0
- package/cli/project-templates/plugin/shared-base/src/dev/hostApp.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev-release.tsx.eta +1 -0
- package/cli/project-templates/plugin/shared-base/src/dev.tsx.eta +1 -1
- package/cli/project-templates/shared/partials/plugin-dev-host-app-advanced.eta +93 -0
- package/cli/project-templates/shared/partials/plugin-dev-host-app-minimal.eta +54 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-advanced.eta +3 -2
- package/cli/project-templates/shared/partials/plugin-dev-tsx-debug.eta +18 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-release.eta +33 -0
- package/cli/project-templates/shared/partials/plugin-dev-tsx-runtime-helpers.eta +8 -8
- package/cli/project-templates/shared/partials/plugin-index-ts.eta +0 -1
- package/cli/project-templates/shared/partials/plugin-vite-dev-host.eta +9 -5
- package/cli/project-templates/shared/partials/plugin-vite-plugin-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-vite-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-vite-sandbox-build.eta +7 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-legacy.eta +12 -5
- package/cli/project-templates/shared/partials/plugin-webpack-dev-host-modern.eta +13 -6
- package/cli/project-templates/shared/partials/plugin-webpack-release-html.eta +12 -0
- package/cli/project-templates/shared/partials/plugin-webpack-sandbox-build.eta +13 -3
- package/cli/project-templates/shared/partials/plugin-wp-legacy-module.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-legacy-umd.eta +28 -10
- package/cli/project-templates/shared/partials/plugin-wp-modern-module.eta +9 -4
- package/cli/project-templates/shared/partials/plugin-wp-modern-umd.eta +9 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-memory.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-vite-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-vite-umd.eta +5 -5
- package/cli/project-templates/shared/partials/stand-dev-host-vite.eta +3 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-subpath.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-host-webpack-umd.eta +9 -3
- package/cli/project-templates/shared/partials/stand-dev-host-webpack.eta +8 -4
- package/cli/project-templates/shared/partials/stand-dev-storage-middleware.eta +370 -0
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.ts +80 -0
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/shared/stand-webpack-base/config/lib/{createWebpackStandConfig.cjs → createWebpackStandConfig.ts} +31 -19
- package/cli/project-templates/{stand/advanced/umd/vite/config/lib/umdServeMiddleware.mjs → shared/stand-webpack-base/config/lib/umdServeMiddleware.ts} +19 -11
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.ts.eta +1 -0
- package/cli/project-templates/stand/advanced/memory-usage/vite/config/lib/{createMemoryUsageStandConfig.mjs → createMemoryUsageStandConfig.ts} +25 -20
- package/cli/project-templates/stand/advanced/umd/vite/config/lib/umdServeMiddleware.ts +68 -0
- package/cli/project-templates/stand/react-adapter/webpack/README.md.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/config/dev-host.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/package.json.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/public/index.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/editorConfig.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/email.html.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/getAuthToken.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/oauthCredentials.ts +9 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/dev/storageProvider.ts.eta +1 -0
- package/cli/project-templates/stand/react-adapter/webpack/src/index.tsx.eta +1 -0
- package/cli/scripts/cli-matrix-smoke.ts +19 -10
- package/cli/scripts/verify-global-cli.ts +1 -1
- package/cli/scripts/vite-plugin-version-matrix.ts +299 -0
- package/cli/tsconfig.json +2 -2
- package/emailmaker-core.ed344c04.js +1 -0
- package/emailmaker-esm.js +788 -153
- package/emailmaker.d.ts +32 -0
- package/emailmaker.js +4 -4
- package/iframe/js/amp.BGJMqoms.js +1 -1
- package/iframe/js/chunk.oX6nCJbK.js +1 -1
- package/iframe/js/iframe-eblock.js +1 -1
- package/iframe/js/iframe.js +1 -1
- package/iframe/js/rules.BSaCN7eK.js +1 -1
- package/iframe/js/sanitize-html.Dy7Uwo8P.js +1 -1
- package/images/integrations/activecampaign.svg +4 -0
- package/images/integrations/bento.svg +9 -0
- package/images/integrations/brevo.svg +7 -0
- package/images/integrations/campaign_monitor.svg +10 -0
- package/images/integrations/constant_contact.svg +24 -0
- package/images/integrations/dotdigital.svg +144 -0
- package/images/integrations/getresponse.svg +23 -0
- package/images/integrations/hubspot.svg +3 -0
- package/images/integrations/klaviyo.svg +10 -0
- package/images/integrations/mailchimp.svg +9 -0
- package/images/integrations/salesforce.svg +20 -0
- package/js/browser-image-compression.js +9 -0
- package/package.json +2 -5
- package/runtime/@ant-design/cssinjs/index.js +1 -1
- package/runtime/@ant-design/icons/index.js +1 -1
- package/runtime/@ant-design/pro-layout/index.js +1 -1
- package/runtime/README.md +13 -13
- package/runtime/antd/index.js +1 -1
- package/runtime/app-core/index.js +1 -2
- package/runtime/classnames/index.js +1 -1
- package/runtime/core/index.js +6 -6
- package/runtime/dayjs/index.js +1 -1
- package/runtime/di/index.js +1 -2
- package/runtime/disposable/index.js +1 -2
- package/runtime/errors-runtime/index.js +1 -2
- package/runtime/guid/index.js +1 -2
- package/runtime/index.js +2 -4
- package/runtime/package.json +2 -3
- package/runtime/prop-types/index.js +1 -1
- package/runtime/react/index.js +1 -1
- package/runtime/react/jsx-dev-runtime/index.js +1 -1
- package/runtime/react/jsx-runtime/index.js +1 -1
- package/runtime/react-dom/client/index.js +1 -1
- package/runtime/react-dom/index.js +1 -1
- package/runtime/react-router-dom/index.js +1 -1
- package/runtime/uuid/index.js +1 -1
- package/static/amd/{8fc2a596.js → 19aeb269.js} +88 -88
- package/static/core/192ec827.js +1 -0
- package/static/core/22c1de2e2.js +1 -0
- package/static/core/24faedf0.js +1 -0
- package/static/core/29231645.js +1 -0
- package/static/core/2a3177fc2.js +1 -0
- package/static/core/346aabd2.js +3 -0
- package/static/core/3b800ed6.js +1 -0
- package/static/core/3e840e90.js +1 -0
- package/static/core/40cc9fd7.js +1 -0
- package/static/core/421bdec22.js +1 -0
- package/static/core/50ff48bc.js +4 -0
- package/static/core/5282795d2.js +6 -0
- package/static/core/555e2e2f2.js +903 -0
- package/static/core/563a283d.js +1 -0
- package/static/core/5d47e095.js +47 -0
- package/static/core/5f574386.js +1 -0
- package/static/core/67a41193.js +1 -0
- package/static/core/698dace4.js +7 -0
- package/static/core/6b648e2d.js +1 -0
- package/static/core/7629adfd.js +1 -0
- package/static/core/7717f2932.js +3 -0
- package/static/core/776cb34a.js +1 -0
- package/static/core/78a1e31e.js +1 -0
- package/static/core/7d56d643.js +1 -0
- package/static/core/841752212.js +40 -0
- package/static/core/8477e97e.js +1 -0
- package/static/core/8756d562.js +1 -0
- package/static/core/91d328d8.js +1 -0
- package/static/core/9270dbb6.js +6 -0
- package/static/core/96371334.js +566 -0
- package/static/core/9b9ddaef2.js +168 -0
- package/static/core/af1da4b4.js +1 -0
- package/static/core/b5096b152.js +471 -0
- package/static/core/bde6775a.js +1 -0
- package/static/core/bf1b888c.js +4 -0
- package/static/core/c3747df72.js +598 -0
- package/static/core/cec8d739.js +11 -0
- package/static/core/cfac3d32.js +1 -0
- package/static/core/d21c95cf2.js +1 -0
- package/static/core/dbd9ca52.js +1 -0
- package/static/core/dc590181.js +1 -0
- package/static/core/e0039d55.js +1 -0
- package/static/core/e4071c1a.js +4 -0
- package/static/core/ef87b75c.js +41 -0
- package/static/core/f47701f32.js +20 -0
- package/static/core/f83d7ac42.js +3 -0
- package/static/core/fcc67e6b.js +1 -0
- package/static/core/fd40d85c.js +1 -0
- package/static/core/fe638847.js +1 -0
- package/static/esm/{e8401d17.js → 203c9644.js} +3 -3
- package/static/esm/4b679053.js +27 -0
- package/static/esm/{b273a6c2.js → f31a26c6.js} +1 -1
- package/static/runtime/disposable-CD74igiJ.js +1 -0
- package/static/runtime/guid-C0wuVR8v.js +1 -0
- package/vite/index.d.ts +17 -6
- package/vite/index.js +315 -270
- package/vite/pluginDev/index.d.ts +10 -19
- package/vite/pluginDev/index.js +251 -204
- package/webpack/index.d.ts +24 -5
- package/webpack/index.js +168 -144
- package/webpack/pluginDev/index.d.ts +21 -22
- package/webpack/pluginDev/index.js +242 -177
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/buildStandIndexHtml.test.js +0 -89
- package/cli/dist/lib/template-engine/emitEtaTree.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/emitEtaTree.test.js +0 -34
- package/cli/dist/lib/template-engine/pluginEtaParity.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/pluginEtaParity.test.js +0 -105
- package/cli/dist/lib/template-engine/resolveVariantDir.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/resolveVariantDir.test.js +0 -52
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standAdvancedViteDevHostEta.test.js +0 -67
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/standWebpackDevHostEta.test.js +0 -83
- package/cli/dist/lib/template-engine/storageProviderEta.test.d.ts +0 -2
- package/cli/dist/lib/template-engine/storageProviderEta.test.js +0 -26
- package/cli/project-templates/plugin/shared-base/scripts/build-types.cjs +0 -8
- package/cli/project-templates/plugin/shared-base/scripts/clean.cjs +0 -6
- package/cli/project-templates/plugin/shared-base/scripts/dev-runner.cjs +0 -48
- package/cli/project-templates/plugin/shared-base/scripts/release-runner.cjs +0 -63
- package/cli/project-templates/shared/stand-vite-base/config/lib/createViteStandConfig.mjs +0 -80
- package/cli/project-templates/shared/stand-vite-base/scripts/devStorageMiddleware.cjs +0 -235
- package/cli/project-templates/shared/stand-webpack-base/config/lib/umdServeMiddleware.cjs +0 -38
- package/cli/project-templates/shared/stand-webpack-base/scripts/devStorageMiddleware.cjs +0 -235
- package/emailmaker-core.80d62b88.js +0 -569
- package/runtime/_core/app-core/index.js +0 -1
- package/runtime/_core/chunks/app-core-DphKKh8f.js +0 -1
- package/runtime/_core/chunks/chunk-oqAt0Dze.js +0 -1
- package/runtime/_core/chunks/di-BHUzE57z.js +0 -1
- package/runtime/_core/chunks/disposable-PhM3rJkj.js +0 -1
- package/runtime/_core/chunks/errors-runtime-VjCOXaQX.js +0 -1
- package/runtime/_core/chunks/guid-D2-FTZQG.js +0 -1
- package/runtime/_core/di/index.js +0 -1
- package/runtime/_core/disposable/index.js +0 -1
- package/runtime/_core/errors-runtime/index.js +0 -1
- package/runtime/_core/guid/index.js +0 -1
- package/runtime/_core/index.js +0 -1
- package/shared/hostBootstrap.js +0 -47
- package/shared/pluginDevOptions.js +0 -31
- package/shared/runtimeManifest.js +0 -72
- package/shared/stringCase.js +0 -16
- package/static/core/2360f32a.js +0 -3
- package/static/core/2687db56.js +0 -3
- package/static/core/2b250af6.js +0 -1261
- package/static/core/3469930c.js +0 -302
- package/static/core/34ce9042.js +0 -201
- package/static/core/4091ba5b.js +0 -25
- package/static/core/41ce3a6a.js +0 -173
- package/static/core/4ac4908c.js +0 -2213
- package/static/core/519096c1.js +0 -2597
- package/static/core/5fa1772b.js +0 -116550
- package/static/core/61312909.js +0 -3
- package/static/core/62a98c07.js +0 -75301
- package/static/core/6309c0f2.js +0 -3
- package/static/core/68d9f440.js +0 -3
- package/static/core/73b645ab.js +0 -2
- package/static/core/81019351.js +0 -280
- package/static/core/835b37ef.js +0 -591
- package/static/core/91242fb3.js +0 -3
- package/static/core/972b15b0.js +0 -92399
- package/static/core/974ef468.js +0 -493
- package/static/core/a17614422.js +0 -38078
- package/static/core/a2fa7b5b.js +0 -4232
- package/static/core/a513adfd.js +0 -89857
- package/static/core/a7c73a9b.js +0 -3813
- package/static/core/b64c7c90.js +0 -228
- package/static/core/cdc9ba92.js +0 -4711
- package/static/core/d1db685d.js +0 -2193
- package/static/core/d661febc.js +0 -3
- package/static/core/d6d2d2d0.js +0 -23
- package/static/core/df1a1225.js +0 -607
- package/static/core/e5bff179.js +0 -1302
- package/static/core/e5d602f5.js +0 -2
- package/static/core/eb029366.js +0 -1532
- package/static/core/f46c035a.js +0 -2
- package/static/core/f8b9d89a.js +0 -461
- package/static/core/fd897ad7.js +0 -3
- package/static/core/fdd890c7.js +0 -6168
- package/static/esm/29eb18ff.js +0 -164
- package/vite/mime-types.js +0 -179
- package/vite/utils.js +0 -44
- /package/cli/project-templates/plugin/bundler-vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{plugin-build.mjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-vite/config/{sandbox-build.mjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{plugin-build.cjs.eta → plugin-build.ts.eta} +0 -0
- /package/cli/project-templates/plugin/bundler-webpack/config/{sandbox-build.cjs.eta → sandbox-build.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/memory-usage/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/shadow-dom/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/subpath/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/advanced/umd/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/closed-loop/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/oauth/webpack/config/{dev-host.cjs.eta → dev-host.ts.eta} +0 -0
- /package/cli/project-templates/stand/react-adapter/vite/config/{dev-host.mjs.eta → dev-host.ts.eta} +0 -0
- /package/iframe/{iframe-eblock.80d62b88.html → iframe-eblock.ed344c04.html} +0 -0
- /package/iframe/{iframe.80d62b88.html → iframe.ed344c04.html} +0 -0
- /package/{runtime/chunks → static/runtime}/DownloadOutlined-a2ZUz7zB.js +0 -0
- /package/{runtime/chunks → static/runtime}/chunk-D-iEO58U.js +0 -0
- /package/{runtime/chunks → static/runtime}/classnames-DBEldvch.js +0 -0
- /package/{runtime/chunks → static/runtime}/client-5XqXGmAI.js +0 -0
- /package/{runtime/chunks → static/runtime}/dayjs.min-CO3mzOeV.js +0 -0
- /package/{runtime/_core/chunks/defineProperty-BGJFuFMq.js → static/runtime/defineProperty-CGNmw-jw.js} +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Cns8cA2n.js +0 -0
- /package/{runtime/chunks → static/runtime}/dist-Ct0xRt3Y.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-0FFT3fCz.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-BwJ3eGbx.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-D8EsVtRL.js +0 -0
- /package/{runtime/chunks → static/runtime}/es-Da4O25Kw.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-dev-runtime-V4_MuHNS.js +0 -0
- /package/{runtime/chunks → static/runtime}/jsx-runtime-DBeCoE0b.js +0 -0
- /package/{runtime/chunks → static/runtime}/objectWithoutProperties-Bk0EDksJ.js +0 -0
- /package/{runtime/chunks → static/runtime}/prop-types-DxD5wgQ0.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-TEeeBWTl.js +0 -0
- /package/{runtime/chunks → static/runtime}/react-dom-BKKa1g6U.js +0 -0
|
@@ -0,0 +1,471 @@
|
|
|
1
|
+
(function(){try{if(typeof document<`u`){var e=document.createElement(`style`);e.setAttribute(`data-emailmaker`,`true`),e.appendChild(document.createTextNode(`.blocks-app .image-preview{text-align:center;min-height:100px;position:relative}.blocks-app .image-preview .image-editor-modal{border:1px solid red}.blocks-app .image-preview__edit-button{position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-preview img{border:1px solid var(--colorBorder);border-radius:6px;max-width:100%;max-height:500px}.blocks-app .image-editor-modal .ant-modal-content{flex-direction:column;min-height:100vh;display:flex;border-radius:0!important}.blocks-app .image-editor-modal .ant-modal-body{flex-grow:1;display:flex}.blocks-app .image-editor-modal .ant-modal-body #pixie-editor{flex-grow:1;height:calc(100vh - 70px);min-height:calc(100vh - 70px);overflow:hidden}.blocks-app .image-editor-modal .pi .text-on-primary{background:var(--colorPrimary);border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary:hover{background:var(--colorPrimaryHover);border-color:var(--colorPrimaryHover)}.blocks-app .image-editor-modal .pi .text-on-primary.rounded-full{border-radius:calc(var(--borderRadius) * 1px)}.blocks-app .image-editor-modal .pi .shadow-xl{box-shadow:none}.blocks-app .image-editor-modal .w-\\[4ch\\].text-sm.text-center{width:5ch}.blocks-app .image-editor-modal .pi .border-white{border-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .bg-white\\/50{background-color:var(--colorPrimary)}.blocks-app .image-editor-modal .pi .text-on-primary{color:var(--colorWhite)}.blocks-app .slideshow-container{width:524px;height:350px;margin:auto;position:relative;overflow:hidden}.blocks-app .slideshow-image{opacity:0;width:100%;height:100%;position:absolute;top:0;left:0}.blocks-app .image-ai .slideshow-image{width:auto;height:auto}.blocks-app .image-ai__image-item{text-align:center;border-radius:6px;justify-content:center;align-items:center;min-height:100px;display:flex;position:relative}.blocks-app .image-ai__image-item .buttons{justify-content:space-between;display:flex;position:absolute;bottom:10px;left:50%;transform:translate(-50%)}.blocks-app .image-ai .text-area-input-hybrid{border:none;outline:none;min-height:0;padding:0 0 0 1px}.blocks-app .image-ai .text-area-input-hybrid textarea{height:32px;min-height:32px;padding:3px 11px;line-height:26px}.blocks-app .image-ai__loading{justify-content:center;align-items:center;min-height:150px;display:flex}.blocks-app .image-ai__loading .spin{flex-direction:column;justify-content:center;align-items:center;height:150px;display:flex}.blocks-app .image-ai__loading .status{margin:3px 0 0}.blocks-app .image-ai .ant-carousel{border-radius:6px;overflow:hidden}.blocks-app .image-ai .ant-carousel .image-ai__image-item img{border-radius:calc(var(--borderRadius) * 1px);object-fit:contain;max-height:100%;transition:height 1s;top:50%;left:50%;overflow:hidden;transform:translate(-50%,-50%)}.blocks-app .image-ai .small{width:302px;height:202px}.blocks-app .image-ai .large{width:524px;height:350px}.blocks-app .image-ai .image-ai__arrow{z-index:3000;opacity:.8;background-color:#0000;display:block;position:absolute;top:50%;transform:translateY(-50%)}.blocks-app .image-ai .image-ai__arrow--next{right:0;transform:translateY(-50%)translate(-100%)}.blocks-app .image-ai .image-ai__arrow--prev{left:0}.blocks-app .image-ai .image-ai__arrow-btn{border-radius:100px}.blocks-app .image-ai .image-ai__arrow-btn--next{right:10px}.blocks-app .image-ai .image-ai__arrow-btn--prev{left:10px}.blocks-app .image-ai .image-ai__row{padding:0 2px}.blocks-app .image-ai .image-ai__input-affix-wrapper{padding-left:0}.blocks-app .image-ai .image-ai__textarea{font-size:16px}.blocks-app .image-ai .image-ai__input-icon{font-size:16px;top:0;right:0}.blocks-app .image-ai .image-ai__carousel{margin-top:24px}.dark .blocks-app .image-ai .ant-carousel .image-ai__image-item img{background:#2b2b2b;border:1px solid #434343}.dark .blocks-app .image-ai .ant-btn{background:#1f1f1f}.dark .blocks-app .image-ai .ant-btn:hover{color:var(--colorPrimary)}.blocks-app .stock-tab img{border-radius:0;max-width:none;max-height:none}.blocks-app .stock-tab .stock-search-input{padding:0 2px}.blocks-app .stock-tab .my-masonry-grid{text-align:center;width:auto;display:flex}.blocks-app .stock-tab .my-masonry-grid_column{background-clip:padding-box}.blocks-app .stock-tab .list-item{cursor:pointer;background:#f0f2f5;border:1px solid #f0f2f5;border-radius:6px;min-height:100px;max-height:100px;margin-bottom:20px;transition:all .3s;display:inline-block;position:relative;overflow:hidden}.blocks-app .stock-tab .list-item .overlay-image{opacity:0;background-size:cover;width:110px;height:40px;transition:opacity .5s;position:absolute;bottom:10px;right:10px}.blocks-app .stock-tab .list-item .ant-spin{color:#f0f2f5;font-size:20px;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)}.blocks-app .stock-tab .list-item img{object-fit:cover;opacity:0;border-radius:6px;height:auto;transition:opacity .5s ease-in-out;display:block}.blocks-app .stock-tab .list-item.loaded{border:1px solid #d9d9d9;max-height:1000px}.blocks-app .stock-tab .list-item.loaded img{opacity:1;height:100%}.blocks-app .stock-tab .list-item.loaded .loaded-image{opacity:.5}.blocks-app .stock-tab .list-item:hover{box-shadow:0 1px 2px -2px #00000029,0 3px 6px #0000001f,0 5px 12px 4px #00000017}.blocks-app .stock-tab .list-item:hover p.creator-info,.blocks-app .stock-tab .list-item:hover .overlay-image{opacity:1}.blocks-app .stock-tab .list-item p.creator-info{color:#fff;opacity:0;background-color:#00000080;border-radius:0 0 6px;margin:0;padding:5px;font-size:10px;line-height:1.2;position:absolute;bottom:0;right:0}.blocks-app .stock-tab .list-item p.creator-info:hover a{color:#fff;text-decoration:underline}.blocks-app .stock-tab .list-item p.creator-info a{color:#fff;text-decoration:none}.blocks-app .stock-tab .ant-divider-horizontal.ant-divider-with-text:before,.blocks-app .stock-tab .ant-divider-horizontal.ant-divider-with-text:after{transform:none}.blocks-app .stock-color-filter{display:flex}.blocks-app .stock-color-filter label{border-width:1px;width:24px;height:24px;margin:4px;padding:0;font-size:0;border-radius:6px!important}.blocks-app .stock-color-filter label.all-colors{background-image:linear-gradient(135deg,red,#ff7f00,#ff0,#0f0,#00f,#8b00ff)}.blocks-app .stock-color-filter label.black-color{background:#222}.blocks-app .stock-color-filter label.bw-color{background-image:linear-gradient(135deg,#222 50%,#fff 50%)}.blocks-app .stock-color-filter label.white-color{background:#fff}.blocks-app .stock-color-filter label.orange-color{background:#fa8c16}.blocks-app .stock-color-filter label.red-color{background:#f5222d}.blocks-app .stock-color-filter label.purple-color{background:#722ed1}.blocks-app .stock-color-filter label.magenta-color{background:#eb2f96}.blocks-app .stock-color-filter label.green-color{background:#52c41a}.blocks-app .stock-color-filter label.teal-color{background:#43c3c3}.blocks-app .stock-color-filter label.blue-color{background:#1677ff}.blocks-app .stock-color-filter .ant-radio-button-wrapper:not(:first-child):before{display:none}.blocks-app .serach-results{padding-top:6px}.blocks-app .serach-results .stock-search-input{width:322px;padding:0 2px}.dark .blocks-app .stock-tab .list-item{background:#2b2b2b;border:1px solid #2b2b2b}.dark .blocks-app .stock-tab .list-item.loaded{border:1px solid #434343}.blocks-app .image-center .image-center-image-preview{justify-content:center;align-items:center;display:flex}.blocks-app .image-center .ant-divider-horizontal{pointer-events:none;z-index:1;background:linear-gradient(180deg, var(--colorBgContainerDisabled), transparent 40%);width:calc(100% + 48px);height:20px;margin:24px -24px 0;position:absolute;bottom:-19px}.dark .blocks-app .image-center .ant-divider-horizontal{background:linear-gradient(180deg, var(--colorBgBase), transparent 40%)}.blocks-app .image-center .ant-divider-horizontal.ant-divider-with-text{background:0 0;width:calc(100% + 38px);margin:0 -24px 20px;position:relative;top:0}.blocks-app .image-center img{border-radius:4px;max-width:524px;max-height:352px}.blocks-app .image-center .image-size{justify-content:center;margin-top:6px;font-size:14px;line-height:22px;display:flex}.blocks-app .image-center .ant-upload.ant-upload-drag{border-radius:6px}.blocks-app .image-center .ant-modal-body .stock-search-input{margin-bottom:0}.blocks-app .image-center .ant-modal-body .serach-results .stock-search-input{margin-bottom:10px}.blocks-app .image-center .ant-modal-body .ant-form:not(.serach-results) .ant-form-item:last-child{margin-bottom:0}.blocks-app .image-center .ant-modal-body .ant-tabs{transition:all .7s cubic-bezier(.075,.82,.165,1);overflow-y:clip}.blocks-app .ant-modal{transition:width .7s ease-in-out}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})();__emailmaker__.define(`static/core/b5096b152.js`,[`require`,`exports`,`module`,`static/core/91d328d8.js`,`static/core/5d47e095.js`,`static/core/f83d7ac42.js`,`static/core/f47701f32.js`,`static/core/7717f2932.js`,`static/core/698dace4.js`,`static/core/40cc9fd7.js`,`react`,`react-dom`,`react-router-dom`,`antd`,`@ant-design/icons`,`react/jsx-runtime`,`react-dom/client`],function(e,t,n){let r=e(`./91d328d8.js`),i=e(`./5d47e095.js`),a=e(`./40cc9fd7.js`);e(`./698dace4.js`);let o=e(`./7717f2932.js`),s=e(`./f83d7ac42.js`),c=e(`./f47701f32.js`),l=e(`react`);l=r.u(l);let u=e(`react-dom`);u=r.u(u);let d=e(`react-router-dom`),f=e(`antd`),p=e(`@ant-design/icons`),m=e(`react/jsx-runtime`),h=e(`react-dom/client`);function g(e,t){return{[e]:{Filter:t(`Filter`),filter:t(`filter`),Resize:t(`Resize`),resize:t(`resize`),Crop:t(`Crop`),Width:t(`Width`),width:t(`width`),Height:t(`Height`),height:t(`height`),"Background color":t(`Background color`),Cancel:t(`Cancel`),Create:t(`Create`),Objects:t(`Objects`),Quality:t(`Quality`),Save:t(`Save`),"Loading Canvas":t(`Loading Canvas`),"Loading Image":t(`Loading Image`),"Loading State":t(`Loading State`),"Processing Image":t(`Processing Image`),Close:t(`Close`),Apply:t(`Apply`),Font:t(`Font`),Color:t(`Color`),Background:t(`Background`),Image:t(`Image`),Opacity:t(`Opacity`),Outline:t(`Outline`),Shadow:t(`Shadow`),Gradient:t(`Gradient`),Texture:t(`Texture`),"Replace Image":t(`Replace Image`),"Outline Color":t(`Outline Color`),"Shadow Color":t(`Shadow Color`),"Font Size":t(`Font Size`),Radius:t(`Radius`),"Brush Color":t(`Brush Color`),"Brush Type":t(`Brush Type`),"Brush Size":t(`Brush Size`),History:t(`History`),"Maintain aspect ratio":t(`Maintain aspect ratio`),"New Text":t(`New Text`),Size:t(`Size`),Draw:t(`Draw`),Text:t(`Text`),Stickers:t(`Stickers`),Frame:t(`Frame`),Shapes:t(`Shapes`),Corners:t(`Corners`),corners:t(`corners`),Done:t(`Done`),"Applied Filters":t(`Applied Filters`),"Resized Image":t(`Resized Image`),"Cropped Image":t(`Cropped Image`),"Added Drawing":t(`Added Drawing`),"Added Text":t(`Added Text`),"Added Shape":t(`Added Shape`),"Added Sticker":t(`Added Sticker`),"Added Frame":t(`Added Frame`),"Merged Objects":t(`Merged Objects`),"Rounded Corner":t(`Rounded Corner`),"Replaced Background Image":t(`Replaced Background Image`),"Added Image":t(`Added Image`),Initial:t(`Initial`),"Loaded State":t(`Loaded State`),"Changed Style":t(`Changed Style`),"Deleted object":t(`Deleted object`),Merge:t(`Merge`),Emoticons:t(`Emoticons`),Doodles:t(`Doodles`),Landmarks:t(`Landmarks`),Bubbles:t(`Bubbles`),Transportation:t(`Transportation`),Beach:t(`Beach`),PencilBrush:t(`PencilBrush`),SprayBrush:t(`SprayBrush`),CircleBrush:t(`CircleBrush`),DiamondBrush:t(`DiamondBrush`),VLineBrush:t(`VLineBrush`),HLineBrush:t(`HLineBrush`),SquareBrush:t(`SquareBrush`),Square:t(`Square`),square:t(`square`)}}}r.n(),r.i();var _=Object.defineProperty,v=(e,t,n)=>t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t,n)=>(v(e,typeof t==`symbol`?t:t+``,n),n);function b(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}function x(e,t){return t===void 0&&(t=15),+parseFloat(Number(e).toPrecision(t))}function S(e){var t=e.toString().split(/[eE]/),n=(t[0].split(`.`)[1]||``).length-+(t[1]||0);return n>0?n:0}function C(e){if(e.toString().indexOf(`e`)===-1)return Number(e.toString().replace(`.`,``));var t=S(e);return t>0?x(Number(e)*10**t):Number(e)}function w(e){j&&(e>2**53-1||e<-(2**53-1))&&e+``}function T(e){return function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=t[0];return t.slice(1).reduce(function(t,n){return e(t,n)},r)}}var E=T(function(e,t){var n=C(e),r=C(t),i=S(e)+S(t),a=n*r;return w(a),a/10**i}),D=T(function(e,t){var n=10**Math.max(S(e),S(t));return(E(e,n)+E(t,n))/n}),O=T(function(e,t){var n=10**Math.max(S(e),S(t));return(E(e,n)-E(t,n))/n}),k=T(function(e,t){var n=C(e),r=C(t);return w(n),w(r),E(n/r,x(10**(S(t)-S(e))))});function A(e,t){var n=10**t,r=k(Math.round(Math.abs(E(e,n))),n);return e<0&&r!==0&&(r=E(r,-1)),r}var j=!0;function M(e){e===void 0&&(e=!0),j=e}var N={strip:x,plus:D,minus:O,times:E,divide:k,round:A,digitLength:S,float2Fixed:C,enableBoundaryChecking:M},P=Object.prototype.toString;function ee(e){switch(P.call(e)){case`[object Error]`:case`[object Exception]`:case`[object DOMException]`:return!0;default:return fe(e,Error)}}function F(e,t){return P.call(e)===`[object ${t}]`}function te(e){return F(e,`ErrorEvent`)}function ne(e){return F(e,`DOMError`)}function re(e){return F(e,`DOMException`)}function I(e){return F(e,`String`)}function ie(e){return typeof e==`object`&&!!e&&`__sentry_template_string__`in e&&`__sentry_template_values__`in e}function ae(e){return e===null||ie(e)||typeof e!=`object`&&typeof e!=`function`}function L(e){return F(e,`Object`)}function oe(e){return typeof Event<`u`&&fe(e,Event)}function se(e){return typeof Element<`u`&&fe(e,Element)}function ce(e){return F(e,`RegExp`)}function le(e){return!!(e&&e.then&&typeof e.then==`function`)}function ue(e){return L(e)&&`nativeEvent`in e&&`preventDefault`in e&&`stopPropagation`in e}function de(e){return typeof e==`number`&&e!==e}function fe(e,t){try{return e instanceof t}catch{return!1}}function pe(e){return!!(typeof e==`object`&&e&&(e.__isVue||e._isVue))}function me(e,t=0){return typeof e!=`string`||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function he(e,t){if(!Array.isArray(e))return``;let n=[];for(let t=0;t<e.length;t++){let r=e[t];try{pe(r)?n.push(`[VueViewModel]`):n.push(String(r))}catch{n.push(`[value cannot be serialized]`)}}return n.join(t)}function ge(e,t,n=!1){return I(e)?ce(t)?t.test(e):I(t)?n?e===t:e.includes(t):!1:!1}function _e(e,t=[],n=!1){return t.some(t=>ge(e,t,n))}function ve(e,t,n=250,r,i,a,o){if(!a.exception||!a.exception.values||!o||!fe(o.originalException,Error))return;let s=a.exception.values.length>0?a.exception.values[a.exception.values.length-1]:void 0;s&&(a.exception.values=Se(ye(e,t,i,o.originalException,r,a.exception.values,s,0),n))}function ye(e,t,n,r,i,a,o,s){if(a.length>=n+1)return a;let c=[...a];if(fe(r[i],Error)){be(o,s);let a=e(t,r[i]),l=c.length;xe(a,i,l,s),c=ye(e,t,n,r[i],i,[a,...c],a,l)}return Array.isArray(r.errors)&&r.errors.forEach((r,a)=>{if(fe(r,Error)){be(o,s);let l=e(t,r),u=c.length;xe(l,`errors[${a}]`,u,s),c=ye(e,t,n,r,i,[l,...c],l,u)}}),c}function be(e,t){e.mechanism=e.mechanism||{type:`generic`,handled:!0},e.mechanism={...e.mechanism,...e.type===`AggregateError`&&{is_exception_group:!0},exception_id:t}}function xe(e,t,n,r){e.mechanism=e.mechanism||{type:`generic`,handled:!0},e.mechanism={...e.mechanism,type:`chained`,source:t,exception_id:n,parent_id:r}}function Se(e,t){return e.map(e=>(e.value&&=me(e.value,t),e))}function Ce(e){return e&&e.Math==Math?e:void 0}var R=typeof globalThis==`object`&&Ce(globalThis)||typeof window==`object`&&Ce(window)||typeof self==`object`&&Ce(self)||typeof r.r==`object`&&Ce(r.r)||function(){return this}()||{};function we(){return R}function Te(e,t,n){let r=n||R,i=r.__SENTRY__=r.__SENTRY__||{};return i[e]||(i[e]=t())}var Ee=we(),De=80;function Oe(e,t={}){if(!e)return`<unknown>`;try{let n=e,r=[],i=0,a=0,o,s=Array.isArray(t)?t:t.keyAttrs,c=!Array.isArray(t)&&t.maxStringLength||De;for(;n&&i++<5&&(o=ke(n,s),!(o===`html`||i>1&&a+r.length*3+o.length>=c));)r.push(o),a+=o.length,n=n.parentNode;return r.reverse().join(` > `)}catch{return`<unknown>`}}function ke(e,t){let n=e,r=[],i,a,o,s,c;if(!n||!n.tagName)return``;if(Ee.HTMLElement&&n instanceof HTMLElement&&n.dataset&&n.dataset.sentryComponent)return n.dataset.sentryComponent;r.push(n.tagName.toLowerCase());let l=t&&t.length?t.filter(e=>n.getAttribute(e)).map(e=>[e,n.getAttribute(e)]):null;if(l&&l.length)l.forEach(e=>{r.push(`[${e[0]}="${e[1]}"]`)});else if(n.id&&r.push(`#${n.id}`),i=n.className,i&&I(i))for(a=i.split(/\s+/),c=0;c<a.length;c++)r.push(`.${a[c]}`);let u=[`aria-label`,`type`,`name`,`title`,`alt`];for(c=0;c<u.length;c++)o=u[c],s=n.getAttribute(o),s&&r.push(`[${o}="${s}"]`);return r.join(``)}function Ae(){try{return Ee.document.location.href}catch{return``}}function je(e){if(!Ee.HTMLElement)return null;let t=e;for(let e=0;e<5;e++){if(!t)return null;if(t instanceof HTMLElement&&t.dataset.sentryComponent)return t.dataset.sentryComponent;t=t.parentNode}return null}var Me=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Ne=`Sentry Logger `,Pe=[`debug`,`info`,`warn`,`error`,`log`,`assert`,`trace`],Fe={};function Ie(e){if(!(`console`in R))return e();let t=R.console,n={},r=Object.keys(Fe);r.forEach(e=>{let r=Fe[e];n[e]=t[e],t[e]=r});try{return e()}finally{r.forEach(e=>{t[e]=n[e]})}}function Le(){let e=!1,t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return Me?Pe.forEach(n=>{t[n]=(...t)=>{e&&Ie(()=>{R.console[n](`${Ne}[${n}]:`,...t)})}}):Pe.forEach(e=>{t[e]=()=>{}}),t}var z=Le(),Re=/^(?:(\w+):)\/\/(?:(\w+)(?::(\w+)?)?@)([\w.-]+)(?::(\d+))?\/(.+)/;function ze(e){return e===`http`||e===`https`}function Be(e,t=!1){let{host:n,path:r,pass:i,port:a,projectId:o,protocol:s,publicKey:c}=e;return`${s}://${c}${t&&i?`:${i}`:``}@${n}${a?`:${a}`:``}/${r&&`${r}/`}${o}`}function Ve(e){let t=Re.exec(e);if(!t){Ie(()=>{console.error(`Invalid Sentry Dsn: ${e}`)});return}let[n,r,i=``,a,o=``,s]=t.slice(1),c=``,l=s,u=l.split(`/`);if(u.length>1&&(c=u.slice(0,-1).join(`/`),l=u.pop()),l){let e=l.match(/^\d+/);e&&(l=e[0])}return He({host:a,pass:i,path:c,projectId:l,port:o,protocol:n,publicKey:r})}function He(e){return{protocol:e.protocol,publicKey:e.publicKey||``,pass:e.pass||``,host:e.host,port:e.port||``,path:e.path||``,projectId:e.projectId}}function Ue(e){if(!Me)return!0;let{port:t,projectId:n,protocol:r}=e;return[`protocol`,`publicKey`,`host`,`projectId`].find(t=>e[t]?!1:(z.error(`Invalid Sentry Dsn: ${t} missing`),!0))?!1:n.match(/^\d+$/)?ze(r)?t&&isNaN(parseInt(t,10))?(z.error(`Invalid Sentry Dsn: Invalid port ${t}`),!1):!0:(z.error(`Invalid Sentry Dsn: Invalid protocol ${r}`),!1):(z.error(`Invalid Sentry Dsn: Invalid projectId ${n}`),!1)}function We(e){let t=typeof e==`string`?Ve(e):He(e);if(!(!t||!Ue(t)))return t}var Ge=class extends Error{constructor(e,t=`warn`){super(e),this.message=e,this.name=new.target.prototype.constructor.name,Object.setPrototypeOf(this,new.target.prototype),this.logLevel=t}};function Ke(e,t,n){if(!(t in e))return;let r=e[t],i=n(r);typeof i==`function`&&Je(i,r),e[t]=i}function qe(e,t,n){try{Object.defineProperty(e,t,{value:n,writable:!0,configurable:!0})}catch{Me&&z.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function Je(e,t){try{e.prototype=t.prototype=t.prototype||{},qe(e,`__sentry_original__`,t)}catch{}}function Ye(e){return e.__sentry_original__}function Xe(e){return Object.keys(e).map(t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join(`&`)}function Ze(e){if(ee(e))return{message:e.message,name:e.name,stack:e.stack,...$e(e)};if(oe(e)){let t={type:e.type,target:Qe(e.target),currentTarget:Qe(e.currentTarget),...$e(e)};return typeof CustomEvent<`u`&&fe(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Qe(e){try{return se(e)?Oe(e):Object.prototype.toString.call(e)}catch{return`<unknown>`}}function $e(e){if(typeof e==`object`&&e){let t={};for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}else return{}}function et(e,t=40){let n=Object.keys(Ze(e));if(n.sort(),!n.length)return`[object has no keys]`;if(n[0].length>=t)return me(n[0],t);for(let e=n.length;e>0;e--){let r=n.slice(0,e).join(`, `);if(!(r.length>t))return e===n.length?r:me(r,t)}return``}function tt(e){return nt(e,new Map)}function nt(e,t){if(rt(e)){let n=t.get(e);if(n!==void 0)return n;let r={};t.set(e,r);for(let n of Object.keys(e))typeof e[n]<`u`&&(r[n]=nt(e[n],t));return r}if(Array.isArray(e)){let n=t.get(e);if(n!==void 0)return n;let r=[];return t.set(e,r),e.forEach(e=>{r.push(nt(e,t))}),r}return e}function rt(e){if(!L(e))return!1;try{let t=Object.getPrototypeOf(e).constructor.name;return!t||t===`Object`}catch{return!0}}var it=50,at=/\(error: (.*)\)/,ot=/captureMessage|captureException/;function st(...e){let t=e.sort((e,t)=>e[0]-t[0]).map(e=>e[1]);return(e,n=0)=>{let r=[],i=e.split(`
|
|
2
|
+
`);for(let e=n;e<i.length;e++){let n=i[e];if(n.length>1024)continue;let a=at.test(n)?n.replace(at,`$1`):n;if(!a.match(/\S*Error: /)){for(let e of t){let t=e(a);if(t){r.push(t);break}}if(r.length>=it)break}}return lt(r)}}function ct(e){return Array.isArray(e)?st(...e):e}function lt(e){if(!e.length)return[];let t=Array.from(e);return/sentryWrapped/.test(t[t.length-1].function||``)&&t.pop(),t.reverse(),ot.test(t[t.length-1].function||``)&&(t.pop(),ot.test(t[t.length-1].function||``)&&t.pop()),t.slice(0,it).map(e=>({...e,filename:e.filename||t[t.length-1].filename,function:e.function||`?`}))}var ut=`<anonymous>`;function dt(e){try{return!e||typeof e!=`function`?ut:e.name||ut}catch{return ut}}var ft={},pt={};function mt(e,t){ft[e]=ft[e]||[],ft[e].push(t)}function ht(e,t){pt[e]||(t(),pt[e]=!0)}function gt(e,t){let n=e&&ft[e];if(n)for(let r of n)try{r(t)}catch(t){Me&&z.error(`Error while triggering instrumentation handler.
|
|
3
|
+
Type: ${e}
|
|
4
|
+
Name: ${dt(r)}
|
|
5
|
+
Error:`,t)}}function _t(e){let t=`console`;mt(t,e),ht(t,vt)}function vt(){`console`in R&&Pe.forEach(function(e){e in R.console&&Ke(R.console,e,function(t){return Fe[e]=t,function(...t){gt(`console`,{args:t,level:e});let n=Fe[e];n&&n.apply(R.console,t)}})})}function yt(){let e=R,t=e.crypto||e.msCrypto,n=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,``);t&&t.getRandomValues&&(n=()=>{let e=new Uint8Array(1);return t.getRandomValues(e),e[0]})}catch{}return`10000000100040008000100000000000`.replace(/[018]/g,e=>(e^(n()&15)>>e/4).toString(16))}function bt(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function xt(e){let{message:t,event_id:n}=e;if(t)return t;let r=bt(e);return r?r.type&&r.value?`${r.type}: ${r.value}`:r.type||r.value||n||`<unknown>`:n||`<unknown>`}function St(e,t,n){let r=e.exception=e.exception||{},i=r.values=r.values||[],a=i[0]=i[0]||{};a.value||=t||``,a.type||=n||`Error`}function Ct(e,t){let n=bt(e);if(!n)return;let r={type:`generic`,handled:!0},i=n.mechanism;if(n.mechanism={...r,...i,...t},t&&`data`in t){let e={...i&&i.data,...t.data};n.mechanism.data=e}}function wt(e){if(e&&e.__sentry_captured__)return!0;try{qe(e,`__sentry_captured__`,!0)}catch{}return!1}function Tt(e){return Array.isArray(e)?e:[e]}var Et=R,Dt=1e3,Ot,kt,At;function jt(e){mt(`dom`,e),ht(`dom`,Mt)}function Mt(){if(!Et.document)return;let e=gt.bind(null,`dom`),t=Ft(e,!0);Et.document.addEventListener(`click`,t,!1),Et.document.addEventListener(`keypress`,t,!1),[`EventTarget`,`Node`].forEach(t=>{let n=Et[t]&&Et[t].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty(`addEventListener`)||(Ke(n,`addEventListener`,function(t){return function(n,r,i){if(n===`click`||n==`keypress`)try{let r=this,a=r.__sentry_instrumentation_handlers__=r.__sentry_instrumentation_handlers__||{},o=a[n]=a[n]||{refCount:0};if(!o.handler){let r=Ft(e);o.handler=r,t.call(this,n,r,i)}o.refCount++}catch{}return t.call(this,n,r,i)}}),Ke(n,`removeEventListener`,function(e){return function(t,n,r){if(t===`click`||t==`keypress`)try{let n=this,i=n.__sentry_instrumentation_handlers__||{},a=i[t];a&&(a.refCount--,a.refCount<=0&&(e.call(this,t,a.handler,r),a.handler=void 0,delete i[t]),Object.keys(i).length===0&&delete n.__sentry_instrumentation_handlers__)}catch{}return e.call(this,t,n,r)}}))})}function Nt(e){if(e.type!==kt)return!1;try{if(!e.target||e.target._sentryId!==At)return!1}catch{}return!0}function Pt(e,t){return e===`keypress`?!t||!t.tagName?!0:!(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable):!1}function Ft(e,t=!1){return n=>{if(!n||n._sentryCaptured)return;let r=It(n);if(Pt(n.type,r))return;qe(n,`_sentryCaptured`,!0),r&&!r._sentryId&&qe(r,`_sentryId`,yt());let i=n.type===`keypress`?`input`:n.type;Nt(n)||(e({event:n,name:i,global:t}),kt=n.type,At=r?r._sentryId:void 0),clearTimeout(Ot),Ot=Et.setTimeout(()=>{At=void 0,kt=void 0},Dt)}}function It(e){try{return e.target}catch{return null}}var Lt=we();function Rt(){if(!(`fetch`in Lt))return!1;try{return new Headers,new Request(`http://www.example.com`),new Response,!0}catch{return!1}}function zt(e){return e&&/^function fetch\(\)\s+\{\s+\[native code\]\s+\}$/.test(e.toString())}function Bt(){if(typeof EdgeRuntime==`string`)return!0;if(!Rt())return!1;if(zt(Lt.fetch))return!0;let e=!1,t=Lt.document;if(t&&typeof t.createElement==`function`)try{let n=t.createElement(`iframe`);n.hidden=!0,t.head.appendChild(n),n.contentWindow&&n.contentWindow.fetch&&(e=zt(n.contentWindow.fetch)),t.head.removeChild(n)}catch(e){Me&&z.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return e}function Vt(e){let t=`fetch`;mt(t,e),ht(t,Ht)}function Ht(){Bt()&&Ke(R,`fetch`,function(e){return function(...t){let{method:n,url:r}=Gt(t),i={args:t,fetchData:{method:n,url:r},startTimestamp:Date.now()};return gt(`fetch`,{...i}),e.apply(R,t).then(e=>(gt(`fetch`,{...i,endTimestamp:Date.now(),response:e}),e),e=>{throw gt(`fetch`,{...i,endTimestamp:Date.now(),error:e}),e})}})}function Ut(e,t){return!!e&&typeof e==`object`&&!!e[t]}function Wt(e){return typeof e==`string`?e:e?Ut(e,`url`)?e.url:e.toString?e.toString():``:``}function Gt(e){if(e.length===0)return{method:`GET`,url:``};if(e.length===2){let[t,n]=e;return{url:Wt(t),method:Ut(n,`method`)?String(n.method).toUpperCase():`GET`}}let t=e[0];return{url:Wt(t),method:Ut(t,`method`)?String(t.method).toUpperCase():`GET`}}var Kt=null;function qt(e){let t=`error`;mt(t,e),ht(t,Jt)}function Jt(){Kt=R.onerror,R.onerror=function(e,t,n,r,i){return gt(`error`,{column:r,error:i,line:n,msg:e,url:t}),Kt&&!Kt.__SENTRY_LOADER__?Kt.apply(this,arguments):!1},R.onerror.__SENTRY_INSTRUMENTED__=!0}var Yt=null;function Xt(e){let t=`unhandledrejection`;mt(t,e),ht(t,Zt)}function Zt(){Yt=R.onunhandledrejection,R.onunhandledrejection=function(e){return gt(`unhandledrejection`,e),Yt&&!Yt.__SENTRY_LOADER__?Yt.apply(this,arguments):!0},R.onunhandledrejection.__SENTRY_INSTRUMENTED__=!0}var Qt=we();function $t(){let e=Qt.chrome,t=e&&e.app&&e.app.runtime,n=`history`in Qt&&!!Qt.history.pushState&&!!Qt.history.replaceState;return!t&&n}var en=R,tn;function nn(e){let t=`history`;mt(t,e),ht(t,rn)}function rn(){if(!$t())return;let e=en.onpopstate;en.onpopstate=function(...t){let n=en.location.href,r=tn;if(tn=n,gt(`history`,{from:r,to:n}),e)try{return e.apply(this,t)}catch{}};function t(e){return function(...t){let n=t.length>2?t[2]:void 0;if(n){let e=tn,t=String(n);tn=t,gt(`history`,{from:e,to:t})}return e.apply(this,t)}}Ke(en.history,`pushState`,t),Ke(en.history,`replaceState`,t)}var an=R,on=`__sentry_xhr_v3__`;function sn(e){mt(`xhr`,e),ht(`xhr`,cn)}function cn(){if(!an.XMLHttpRequest)return;let e=XMLHttpRequest.prototype;Ke(e,`open`,function(e){return function(...t){let n=Date.now(),r=I(t[0])?t[0].toUpperCase():void 0,i=ln(t[1]);if(!r||!i)return e.apply(this,t);this[on]={method:r,url:i,request_headers:{}},r===`POST`&&i.match(/sentry_key/)&&(this.__sentry_own_request__=!0);let a=()=>{let e=this[on];if(e&&this.readyState===4){try{e.status_code=this.status}catch{}gt(`xhr`,{args:[r,i],endTimestamp:Date.now(),startTimestamp:n,xhr:this})}};return`onreadystatechange`in this&&typeof this.onreadystatechange==`function`?Ke(this,`onreadystatechange`,function(e){return function(...t){return a(),e.apply(this,t)}}):this.addEventListener(`readystatechange`,a),Ke(this,`setRequestHeader`,function(e){return function(...t){let[n,r]=t,i=this[on];return i&&I(n)&&I(r)&&(i.request_headers[n.toLowerCase()]=r),e.apply(this,t)}}),e.apply(this,t)}}),Ke(e,`send`,function(e){return function(...t){let n=this[on];return n?(t[0]!==void 0&&(n.body=t[0]),gt(`xhr`,{args:[n.method,n.url],startTimestamp:Date.now(),xhr:this}),e.apply(this,t)):e.apply(this,t)}})}function ln(e){if(I(e))return e;try{return e.toString()}catch{}}function un(){return`npm`}function dn(){let e=typeof WeakSet==`function`,t=e?new WeakSet:[];function n(n){if(e)return t.has(n)?!0:(t.add(n),!1);for(let e=0;e<t.length;e++)if(t[e]===n)return!0;return t.push(n),!1}function r(n){if(e)t.delete(n);else for(let e=0;e<t.length;e++)if(t[e]===n){t.splice(e,1);break}}return[n,r]}function fn(e,t=100,n=1/0){try{return mn(``,e,t,n)}catch(e){return{ERROR:`**non-serializable** (${e})`}}}function pn(e,t=3,n=100*1024){let r=fn(e,t);return vn(r)>n?pn(e,t-1,n):r}function mn(e,t,n=1/0,r=1/0,i=dn()){let[a,o]=i;if(t==null||[`number`,`boolean`,`string`].includes(typeof t)&&!de(t))return t;let s=hn(e,t);if(!s.startsWith(`[object `))return s;if(t.__sentry_skip_normalization__)return t;let c=typeof t.__sentry_override_normalization_depth__==`number`?t.__sentry_override_normalization_depth__:n;if(c===0)return s.replace(`object `,``);if(a(t))return`[Circular ~]`;let l=t;if(l&&typeof l.toJSON==`function`)try{return mn(``,l.toJSON(),c-1,r,i)}catch{}let u=Array.isArray(t)?[]:{},d=0,f=Ze(t);for(let e in f){if(!Object.prototype.hasOwnProperty.call(f,e))continue;if(d>=r){u[e]=`[MaxProperties ~]`;break}let t=f[e];u[e]=mn(e,t,c-1,r,i),d++}return o(t),u}function hn(e,t){try{if(e===`domain`&&t&&typeof t==`object`&&t._events)return`[Domain]`;if(e===`domainEmitter`)return`[DomainEmitter]`;if(typeof r.r<`u`&&t===r.r)return`[Global]`;if(typeof window<`u`&&t===window)return`[Window]`;if(typeof document<`u`&&t===document)return`[Document]`;if(pe(t))return`[VueViewModel]`;if(ue(t))return`[SyntheticEvent]`;if(typeof t==`number`&&t!==t)return`[NaN]`;if(typeof t==`function`)return`[Function: ${dt(t)}]`;if(typeof t==`symbol`)return`[${String(t)}]`;if(typeof t==`bigint`)return`[BigInt: ${String(t)}]`;let n=gn(t);return/^HTML(\w*)Element$/.test(n)?`[HTMLElement: ${n}]`:`[object ${n}]`}catch(e){return`**non-serializable** (${e})`}}function gn(e){let t=Object.getPrototypeOf(e);return t?t.constructor.name:`null prototype`}function _n(e){return~-encodeURI(e).split(/%..|./).length}function vn(e){return _n(JSON.stringify(e))}var yn;(function(e){e[e.PENDING=0]=`PENDING`,e[e.RESOLVED=1]=`RESOLVED`,e[e.REJECTED=2]=`REJECTED`})(yn||={});function bn(e){return new Sn(t=>{t(e)})}function xn(e){return new Sn((t,n)=>{n(e)})}var Sn=class e{constructor(t){e.prototype.__init.call(this),e.prototype.__init2.call(this),e.prototype.__init3.call(this),e.prototype.__init4.call(this),this._state=yn.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(e){this._reject(e)}}then(t,n){return new e((e,r)=>{this._handlers.push([!1,n=>{if(!t)e(n);else try{e(t(n))}catch(e){r(e)}},t=>{if(!n)r(t);else try{e(n(t))}catch(e){r(e)}}]),this._executeHandlers()})}catch(e){return this.then(e=>e,e)}finally(t){return new e((e,n)=>{let r,i;return this.then(e=>{i=!1,r=e,t&&t()},e=>{i=!0,r=e,t&&t()}).then(()=>{if(i){n(r);return}e(r)})})}__init(){this._resolve=e=>{this._setResult(yn.RESOLVED,e)}}__init2(){this._reject=e=>{this._setResult(yn.REJECTED,e)}}__init3(){this._setResult=(e,t)=>{if(this._state===yn.PENDING){if(le(t)){t.then(this._resolve,this._reject);return}this._state=e,this._value=t,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===yn.PENDING)return;let e=this._handlers.slice();this._handlers=[],e.forEach(e=>{e[0]||=(this._state===yn.RESOLVED&&e[1](this._value),this._state===yn.REJECTED&&e[2](this._value),!0)})}}};function Cn(e){let t=[];function n(){return e===void 0||t.length<e}function r(e){return t.splice(t.indexOf(e),1)[0]}function i(e){if(!n())return xn(new Ge(`Not adding Promise because buffer limit was reached.`));let i=e();return t.indexOf(i)===-1&&t.push(i),i.then(()=>r(i)).then(null,()=>r(i).then(null,()=>{})),i}function a(e){return new Sn((n,r)=>{let i=t.length;if(!i)return n(!0);let a=setTimeout(()=>{e&&e>0&&n(!1)},e);t.forEach(e=>{bn(e).then(()=>{--i||(clearTimeout(a),n(!0))},r)})})}return{$:t,add:i,drain:a}}function wn(e){if(!e)return{};let t=e.match(/^(([^:/?#]+):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/);if(!t)return{};let n=t[6]||``,r=t[8]||``;return{host:t[4],path:t[5],protocol:t[2],search:n,hash:r,relative:t[5]+n+r}}var Tn=[`fatal`,`error`,`warning`,`log`,`info`,`debug`];function En(e){return e===`warn`?`warning`:Tn.includes(e)?e:`log`}var Dn=1e3;function On(){return Date.now()/Dn}function kn(){let{performance:e}=R;if(!e||!e.now)return On;let t=Date.now()-e.now(),n=e.timeOrigin==null?t:e.timeOrigin;return()=>(n+e.now())/Dn}var An=kn();(()=>{let{performance:e}=R;if(!e||!e.now)return;let t=3600*1e3,n=e.now(),r=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+n-r):t,a=i<t,o=e.timing&&e.timing.navigationStart,s=typeof o==`number`?Math.abs(o+n-r):t;return a||s<t?i<=s?e.timeOrigin:o:r})();function jn(e,t=[]){return[e,t]}function Mn(e,t){let[n,r]=e;return[n,[...r,t]]}function Nn(e,t){let n=e[1];for(let e of n){let n=e[0].type;if(t(e,n))return!0}return!1}function Pn(e,t){return(t||new TextEncoder).encode(e)}function Fn(e,t){let[n,r]=e,i=JSON.stringify(n);function a(e){typeof i==`string`?i=typeof e==`string`?i+e:[Pn(i,t),e]:i.push(typeof e==`string`?Pn(e,t):e)}for(let e of r){let[t,n]=e;if(a(`
|
|
6
|
+
${JSON.stringify(t)}
|
|
7
|
+
`),typeof n==`string`||n instanceof Uint8Array)a(n);else{let e;try{e=JSON.stringify(n)}catch{e=JSON.stringify(fn(n))}a(e)}}return typeof i==`string`?i:In(i)}function In(e){let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ln(e,t){let n=typeof e.data==`string`?Pn(e.data,t):e.data;return[tt({type:`attachment`,length:n.length,filename:e.filename,content_type:e.contentType,attachment_type:e.attachmentType}),n]}var Rn={session:`session`,sessions:`session`,attachment:`attachment`,transaction:`transaction`,event:`error`,client_report:`internal`,user_report:`default`,profile:`profile`,replay_event:`replay`,replay_recording:`replay`,check_in:`monitor`,feedback:`feedback`,span:`span`,statsd:`metric_bucket`};function zn(e){return Rn[e]}function Bn(e){if(!e||!e.sdk)return;let{name:t,version:n}=e.sdk;return{name:t,version:n}}function Vn(e,t,n,r){let i=e.sdkProcessingMetadata&&e.sdkProcessingMetadata.dynamicSamplingContext;return{event_id:e.event_id,sent_at:new Date().toISOString(),...t&&{sdk:t},...!!n&&r&&{dsn:Be(r)},...i&&{trace:tt({...i})}}}function Hn(e,t,n){let r=[{type:`client_report`},{timestamp:n||On(),discarded_events:e}];return jn(t?{dsn:t}:{},[r])}var Un=60*1e3;function Wn(e,t=Date.now()){let n=parseInt(`${e}`,10);if(!isNaN(n))return n*1e3;let r=Date.parse(`${e}`);return isNaN(r)?Un:r-t}function Gn(e,t){return e[t]||e.all||0}function Kn(e,t,n=Date.now()){return Gn(e,t)>n}function qn(e,{statusCode:t,headers:n},r=Date.now()){let i={...e},a=n&&n[`x-sentry-rate-limits`],o=n&&n[`retry-after`];if(a)for(let e of a.trim().split(`,`)){let[t,n,,,a]=e.split(`:`,5),o=parseInt(t,10),s=(isNaN(o)?60:o)*1e3;if(!n)i.all=r+s;else for(let e of n.split(`;`))e===`metric_bucket`?(!a||a.split(`;`).includes(`custom`))&&(i[e]=r+s):i[e]=r+s}else o?i.all=r+Wn(o,r):t===429&&(i.all=r+60*1e3);return i}var Jn=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__,Yn=`production`;function Xn(){return Te(`globalEventProcessors`,()=>[])}function Zn(e){Xn().push(e)}function Qn(e,t,n,r=0){return new Sn((i,a)=>{let o=e[r];if(t===null||typeof o!=`function`)i(t);else{let s=o({...t},n);Jn&&o.id&&s===null&&z.log(`Event processor "${o.id}" dropped event`),le(s)?s.then(t=>Qn(e,t,n,r+1).then(i)).then(null,a):Qn(e,s,n,r+1).then(i).then(null,a)}})}function $n(e){let t=An(),n={sid:yt(),init:!0,timestamp:t,started:t,duration:0,status:`ok`,errors:0,ignoreDuration:!1,toJSON:()=>nr(n)};return e&&er(n,e),n}function er(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||An(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:yt()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started==`number`&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration==`number`)e.duration=t.duration;else{let t=e.timestamp-e.started;e.duration=t>=0?t:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors==`number`&&(e.errors=t.errors),t.status&&(e.status=t.status)}function tr(e,t){let n={};t?n={status:t}:e.status===`ok`&&(n={status:`exited`}),er(e,n)}function nr(e){return tt({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did==`number`||typeof e.did==`string`?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}var rr=1;function ir(e){let{spanId:t,traceId:n}=e.spanContext(),{data:r,op:i,parent_span_id:a,status:o,tags:s,origin:c}=ar(e);return tt({data:r,op:i,parent_span_id:a,span_id:t,status:o,tags:s,trace_id:n,origin:c})}function ar(e){return or(e)?e.getSpanJSON():typeof e.toJSON==`function`?e.toJSON():{}}function or(e){return typeof e.getSpanJSON==`function`}function sr(e){let{traceFlags:t}=e.spanContext();return!!(t&rr)}function cr(e,t,n,r,i,a){let{normalizeDepth:o=3,normalizeMaxBreadth:s=1e3}=e,c={...t,event_id:t.event_id||n.event_id||yt(),timestamp:t.timestamp||On()},l=n.integrations||e.integrations.map(e=>e.name);lr(c,e),pr(c,l),t.type===void 0&&dr(c,e.stackParser);let u=hr(r,n.captureContext);n.mechanism&&Ct(c,n.mechanism);let d=i&&i.getEventProcessors?i.getEventProcessors():[],f=Wr().getScopeData();a&&Pr(f,a.getScopeData()),u&&Pr(f,u.getScopeData());let p=[...n.attachments||[],...f.attachments];return p.length&&(n.attachments=p),Nr(c,f),Qn([...d,...Xn(),...f.eventProcessors],c,n).then(e=>(e&&fr(e),typeof o==`number`&&o>0?mr(e,o,s):e))}function lr(e,t){let{environment:n,release:r,dist:i,maxValueLength:a=250}=t;`environment`in e||(e.environment=`environment`in t?n:Yn),e.release===void 0&&r!==void 0&&(e.release=r),e.dist===void 0&&i!==void 0&&(e.dist=i),e.message&&=me(e.message,a);let o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=me(o.value,a));let s=e.request;s&&s.url&&(s.url=me(s.url,a))}var ur=new WeakMap;function dr(e,t){let n=R._sentryDebugIds;if(!n)return;let r,i=ur.get(t);i?r=i:(r=new Map,ur.set(t,r));let a=Object.keys(n).reduce((e,i)=>{let a,o=r.get(i);o?a=o:(a=t(i),r.set(i,a));for(let t=a.length-1;t>=0;t--){let r=a[t];if(r.filename){e[r.filename]=n[i];break}}return e},{});try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.filename&&(e.debug_id=a[e.filename])})})}catch{}}function fr(e){let t={};try{e.exception.values.forEach(e=>{e.stacktrace.frames.forEach(e=>{e.debug_id&&(e.abs_path?t[e.abs_path]=e.debug_id:e.filename&&(t[e.filename]=e.debug_id),delete e.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];let n=e.debug_meta.images;Object.keys(t).forEach(e=>{n.push({type:`sourcemap`,code_file:e,debug_id:t[e]})})}function pr(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function mr(e,t,n){if(!e)return null;let r={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(e=>({...e,...e.data&&{data:fn(e.data,t,n)}}))},...e.user&&{user:fn(e.user,t,n)},...e.contexts&&{contexts:fn(e.contexts,t,n)},...e.extra&&{extra:fn(e.extra,t,n)}};return e.contexts&&e.contexts.trace&&r.contexts&&(r.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(r.contexts.trace.data=fn(e.contexts.trace.data,t,n))),e.spans&&(r.spans=e.spans.map(e=>{let r=ar(e).data;return r&&(e.data=fn(r,t,n)),e})),r}function hr(e,t){if(!t)return e;let n=e?e.clone():new Ur;return n.update(t),n}function gr(e){if(e)return _r(e)||yr(e)?{captureContext:e}:e}function _r(e){return e instanceof Ur||typeof e==`function`}var vr=[`user`,`level`,`extra`,`contexts`,`tags`,`fingerprint`,`requestSession`,`propagationContext`];function yr(e){return Object.keys(e).some(e=>vr.includes(e))}function br(e,t){return Qr().captureException(e,gr(t))}function xr(e,t){return Qr().captureEvent(e,t)}function Sr(e,t){Qr().addBreadcrumb(e,t)}function Cr(...e){let t=Qr();if(e.length===2){let[n,r]=e;return n?t.withScope(()=>(t.getStackTop().scope=n,r(n))):t.withScope(r)}return t.withScope(e[0])}function wr(){return Qr().getClient()}function Tr(){return Qr().getScope()}function Er(e){let t=wr(),n=$r(),r=Tr(),{release:i,environment:a=Yn}=t&&t.getOptions()||{},{userAgent:o}=R.navigator||{},s=$n({release:i,environment:a,user:r.getUser()||n.getUser(),...o&&{userAgent:o},...e}),c=n.getSession();return c&&c.status===`ok`&&er(c,{status:`exited`}),Dr(),n.setSession(s),r.setSession(s),s}function Dr(){let e=$r(),t=Tr(),n=t.getSession()||e.getSession();n&&tr(n),Or(),e.setSession(),t.setSession()}function Or(){let e=$r(),t=Tr(),n=wr(),r=t.getSession()||e.getSession();r&&n&&n.captureSession&&n.captureSession(r)}function kr(e=!1){if(e){Dr();return}Or()}function Ar(e){return e.transaction}function jr(e,t,n){let r=t.getOptions(),{publicKey:i}=t.getDsn()||{},{segment:a}=n&&n.getUser()||{},o=tt({environment:r.environment||Yn,release:r.release,user_segment:a,public_key:i,trace_id:e});return t.emit&&t.emit(`createDsc`,o),o}function Mr(e){let t=wr();if(!t)return{};let n=jr(ar(e).trace_id||``,t,Tr()),r=Ar(e);if(!r)return n;let i=r&&r._frozenDynamicSamplingContext;if(i)return i;let{sampleRate:a,source:o}=r.metadata;a!=null&&(n.sample_rate=`${a}`);let s=ar(r);return o&&o!==`url`&&(n.transaction=s.description),n.sampled=String(sr(r)),t.emit&&t.emit(`createDsc`,n),n}function Nr(e,t){let{fingerprint:n,span:r,breadcrumbs:i,sdkProcessingMetadata:a}=t;Ir(e,t),r&&zr(e,r),Br(e,n),Lr(e,i),Rr(e,a)}function Pr(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,sdkProcessingMetadata:s,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:d,propagationContext:f,transactionName:p,span:m}=t;Fr(e,`extra`,n),Fr(e,`tags`,r),Fr(e,`user`,i),Fr(e,`contexts`,a),Fr(e,`sdkProcessingMetadata`,s),o&&(e.level=o),p&&(e.transactionName=p),m&&(e.span=m),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),d.length&&(e.attachments=[...e.attachments,...d]),e.propagationContext={...e.propagationContext,...f}}function Fr(e,t,n){if(n&&Object.keys(n).length){e[t]={...e[t]};for(let r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[t][r]=n[r])}}function Ir(e,t){let{extra:n,tags:r,user:i,contexts:a,level:o,transactionName:s}=t,c=tt(n);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});let l=tt(r);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});let u=tt(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});let d=tt(a);d&&Object.keys(d).length&&(e.contexts={...d,...e.contexts}),o&&(e.level=o),s&&(e.transaction=s)}function Lr(e,t){let n=[...e.breadcrumbs||[],...t];e.breadcrumbs=n.length?n:void 0}function Rr(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function zr(e,t){e.contexts={trace:ir(t),...e.contexts};let n=Ar(t);if(n){e.sdkProcessingMetadata={dynamicSamplingContext:Mr(t),...e.sdkProcessingMetadata};let r=ar(n).description;r&&(e.tags={transaction:r,...e.tags})}}function Br(e,t){e.fingerprint=e.fingerprint?Tt(e.fingerprint):[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}var Vr=100,Hr,Ur=class e{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext=Gr()}static clone(t){return t?t.clone():new e}clone(){let t=new e;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},t._user=this._user,t._level=this._level,t._span=this._span,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t}setClient(e){this._client=e}getClient(){return this._client}addScopeListener(e){this._scopeListeners.push(e)}addEventProcessor(e){return this._eventProcessors.push(e),this}setUser(e){return this._user=e||{email:void 0,id:void 0,ip_address:void 0,segment:void 0,username:void 0},this._session&&er(this._session,{user:e}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(e){return this._requestSession=e,this}setTags(e){return this._tags={...this._tags,...e},this._notifyScopeListeners(),this}setTag(e,t){return this._tags={...this._tags,[e]:t},this._notifyScopeListeners(),this}setExtras(e){return this._extra={...this._extra,...e},this._notifyScopeListeners(),this}setExtra(e,t){return this._extra={...this._extra,[e]:t},this._notifyScopeListeners(),this}setFingerprint(e){return this._fingerprint=e,this._notifyScopeListeners(),this}setLevel(e){return this._level=e,this._notifyScopeListeners(),this}setTransactionName(e){return this._transactionName=e,this._notifyScopeListeners(),this}setContext(e,t){return t===null?delete this._contexts[e]:this._contexts[e]=t,this._notifyScopeListeners(),this}setSpan(e){return this._span=e,this._notifyScopeListeners(),this}getSpan(){return this._span}getTransaction(){let e=this._span;return e&&e.transaction}setSession(e){return e?this._session=e:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;let n=typeof t==`function`?t(this):t;if(n instanceof e){let e=n.getScopeData();this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&Object.keys(e.user).length&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint.length&&(this._fingerprint=e.fingerprint),n.getRequestSession()&&(this._requestSession=n.getRequestSession()),e.propagationContext&&(this._propagationContext=e.propagationContext)}else if(L(n)){let e=t;this._tags={...this._tags,...e.tags},this._extra={...this._extra,...e.extra},this._contexts={...this._contexts,...e.contexts},e.user&&(this._user=e.user),e.level&&(this._level=e.level),e.fingerprint&&(this._fingerprint=e.fingerprint),e.requestSession&&(this._requestSession=e.requestSession),e.propagationContext&&(this._propagationContext=e.propagationContext)}return this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._span=void 0,this._session=void 0,this._notifyScopeListeners(),this._attachments=[],this._propagationContext=Gr(),this}addBreadcrumb(e,t){let n=typeof t==`number`?t:Vr;if(n<=0)return this;let r={timestamp:On(),...e},i=this._breadcrumbs;return i.push(r),this._breadcrumbs=i.length>n?i.slice(-n):i,this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(e){return this._attachments.push(e),this}getAttachments(){return this.getScopeData().attachments}clearAttachments(){return this._attachments=[],this}getScopeData(){let{_breadcrumbs:e,_attachments:t,_contexts:n,_tags:r,_extra:i,_user:a,_level:o,_fingerprint:s,_eventProcessors:c,_propagationContext:l,_sdkProcessingMetadata:u,_transactionName:d,_span:f}=this;return{breadcrumbs:e,attachments:t,contexts:n,tags:r,extra:i,user:a,level:o,fingerprint:s||[],eventProcessors:c,propagationContext:l,sdkProcessingMetadata:u,transactionName:d,span:f}}applyToEvent(e,t={},n=[]){return Nr(e,this.getScopeData()),Qn([...n,...Xn(),...this._eventProcessors],e,t)}setSDKProcessingMetadata(e){return this._sdkProcessingMetadata={...this._sdkProcessingMetadata,...e},this}setPropagationContext(e){return this._propagationContext=e,this}getPropagationContext(){return this._propagationContext}captureException(e,t){let n=t&&t.event_id?t.event_id:yt();if(!this._client)return z.warn(`No client configured on scope - will not capture exception!`),n;let r=Error(`Sentry syntheticException`);return this._client.captureException(e,{originalException:e,syntheticException:r,...t,event_id:n},this),n}captureMessage(e,t,n){let r=n&&n.event_id?n.event_id:yt();if(!this._client)return z.warn(`No client configured on scope - will not capture message!`),r;let i=Error(e);return this._client.captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r},this),r}captureEvent(e,t){let n=t&&t.event_id?t.event_id:yt();return this._client?(this._client.captureEvent(e,{...t,event_id:n},this),n):(z.warn(`No client configured on scope - will not capture event!`),n)}_notifyScopeListeners(){this._notifyingListeners||=(this._notifyingListeners=!0,this._scopeListeners.forEach(e=>{e(this)}),!1)}};function Wr(){return Hr||=new Ur,Hr}function Gr(){return{traceId:yt(),spanId:yt().substring(16)}}var Kr=`7.116.0`,qr=parseFloat(Kr),Jr=100,Yr=class{constructor(e,t,n,r=qr){this._version=r;let i;t?i=t:(i=new Ur,i.setClient(e));let a;n?a=n:(a=new Ur,a.setClient(e)),this._stack=[{scope:i}],e&&this.bindClient(e),this._isolationScope=a}isOlderThan(e){return this._version<e}bindClient(e){let t=this.getStackTop();t.client=e,t.scope.setClient(e),e&&e.setupIntegrations&&e.setupIntegrations()}pushScope(){let e=this.getScope().clone();return this.getStack().push({client:this.getClient(),scope:e}),e}popScope(){return this.getStack().length<=1?!1:!!this.getStack().pop()}withScope(e){let t=this.pushScope(),n;try{n=e(t)}catch(e){throw this.popScope(),e}return le(n)?n.then(e=>(this.popScope(),e),e=>{throw this.popScope(),e}):(this.popScope(),n)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStack(){return this._stack}getStackTop(){return this._stack[this._stack.length-1]}captureException(e,t){let n=this._lastEventId=t&&t.event_id?t.event_id:yt(),r=Error(`Sentry syntheticException`);return this.getScope().captureException(e,{originalException:e,syntheticException:r,...t,event_id:n}),n}captureMessage(e,t,n){let r=this._lastEventId=n&&n.event_id?n.event_id:yt(),i=Error(e);return this.getScope().captureMessage(e,t,{originalException:e,syntheticException:i,...n,event_id:r}),r}captureEvent(e,t){let n=t&&t.event_id?t.event_id:yt();return e.type||(this._lastEventId=n),this.getScope().captureEvent(e,{...t,event_id:n}),n}lastEventId(){return this._lastEventId}addBreadcrumb(e,t){let{scope:n,client:r}=this.getStackTop();if(!r)return;let{beforeBreadcrumb:i=null,maxBreadcrumbs:a=Jr}=r.getOptions&&r.getOptions()||{};if(a<=0)return;let o={timestamp:On(),...e},s=i?Ie(()=>i(o,t)):o;s!==null&&(r.emit&&r.emit(`beforeAddBreadcrumb`,s,t),n.addBreadcrumb(s,a))}setUser(e){this.getScope().setUser(e),this.getIsolationScope().setUser(e)}setTags(e){this.getScope().setTags(e),this.getIsolationScope().setTags(e)}setExtras(e){this.getScope().setExtras(e),this.getIsolationScope().setExtras(e)}setTag(e,t){this.getScope().setTag(e,t),this.getIsolationScope().setTag(e,t)}setExtra(e,t){this.getScope().setExtra(e,t),this.getIsolationScope().setExtra(e,t)}setContext(e,t){this.getScope().setContext(e,t),this.getIsolationScope().setContext(e,t)}configureScope(e){let{scope:t,client:n}=this.getStackTop();n&&e(t)}run(e){let t=Zr(this);try{e(this)}finally{Zr(t)}}getIntegration(e){let t=this.getClient();if(!t)return null;try{return t.getIntegration(e)}catch{return Jn&&z.warn(`Cannot retrieve integration ${e.id} from the current Hub`),null}}startTransaction(e,t){let n=this._callExtensionMethod(`startTransaction`,e,t);return Jn&&!n&&(this.getClient()?z.warn(`Tracing extension 'startTransaction' has not been added. Call 'addTracingExtensions' before calling 'init':
|
|
8
|
+
Sentry.addTracingExtensions();
|
|
9
|
+
Sentry.init({...});
|
|
10
|
+
`):z.warn(`Tracing extension 'startTransaction' is missing. You should 'init' the SDK before calling 'startTransaction'`)),n}traceHeaders(){return this._callExtensionMethod(`traceHeaders`)}captureSession(e=!1){if(e)return this.endSession();this._sendSessionUpdate()}endSession(){let e=this.getStackTop().scope,t=e.getSession();t&&tr(t),this._sendSessionUpdate(),e.setSession()}startSession(e){let{scope:t,client:n}=this.getStackTop(),{release:r,environment:i=Yn}=n&&n.getOptions()||{},{userAgent:a}=R.navigator||{},o=$n({release:r,environment:i,user:t.getUser(),...a&&{userAgent:a},...e}),s=t.getSession&&t.getSession();return s&&s.status===`ok`&&er(s,{status:`exited`}),this.endSession(),t.setSession(o),o}shouldSendDefaultPii(){let e=this.getClient(),t=e&&e.getOptions();return!!(t&&t.sendDefaultPii)}_sendSessionUpdate(){let{scope:e,client:t}=this.getStackTop(),n=e.getSession();n&&t&&t.captureSession&&t.captureSession(n)}_callExtensionMethod(e,...t){let n=Xr().__SENTRY__;if(n&&n.extensions&&typeof n.extensions[e]==`function`)return n.extensions[e].apply(this,t);Jn&&z.warn(`Extension method ${e} couldn't be found, doing nothing.`)}};function Xr(){return R.__SENTRY__=R.__SENTRY__||{extensions:{},hub:void 0},R}function Zr(e){let t=Xr(),n=ni(t);return ri(t,e),n}function Qr(){let e=Xr();if(e.__SENTRY__&&e.__SENTRY__.acs){let t=e.__SENTRY__.acs.getCurrentHub();if(t)return t}return ei(e)}function $r(){return Qr().getIsolationScope()}function ei(e=Xr()){return(!ti(e)||ni(e).isOlderThan(qr))&&ri(e,new Yr),ni(e)}function ti(e){return!!(e&&e.__SENTRY__&&e.__SENTRY__.hub)}function ni(e){return Te(`hub`,()=>new Yr,e)}function ri(e,t){if(!e)return!1;let n=e.__SENTRY__=e.__SENTRY__||{};return n.hub=t,!0}function ii(e,t){return t&&(e.sdk=e.sdk||{},e.sdk.name=e.sdk.name||t.name,e.sdk.version=e.sdk.version||t.version,e.sdk.integrations=[...e.sdk.integrations||[],...t.integrations||[]],e.sdk.packages=[...e.sdk.packages||[],...t.packages||[]]),e}function ai(e,t,n,r){let i=Bn(n);return jn({sent_at:new Date().toISOString(),...i&&{sdk:i},...!!r&&t&&{dsn:Be(t)}},[`aggregates`in e?[{type:`sessions`},e]:[{type:`session`},e.toJSON()]])}function oi(e,t,n,r){let i=Bn(n),a=e.type&&e.type!==`replay_event`?e.type:`event`;ii(e,n&&n.sdk);let o=Vn(e,i,r,t);return delete e.sdkProcessingMetadata,jn(o,[[{type:a},e]])}var si=`7`;function ci(e){let t=e.protocol?`${e.protocol}:`:``,n=e.port?`:${e.port}`:``;return`${t}//${e.host}${n}${e.path?`/${e.path}`:``}/api/`}function li(e){return`${ci(e)}${e.projectId}/envelope/`}function ui(e,t){return Xe({sentry_key:e.publicKey,sentry_version:si,...t&&{sentry_client:`${t.name}/${t.version}`}})}function di(e,t={}){let n=typeof t==`string`?t:t.tunnel,r=typeof t==`string`||!t._metadata?void 0:t._metadata.sdk;return n||`${li(e)}?${ui(e,r)}`}var fi=[];function pi(e){let t={};return e.forEach(e=>{let{name:n}=e,r=t[n];r&&!r.isDefaultInstance&&e.isDefaultInstance||(t[n]=e)}),Object.keys(t).map(e=>t[e])}function mi(e){let t=e.defaultIntegrations||[],n=e.integrations;t.forEach(e=>{e.isDefaultInstance=!0});let r;r=Array.isArray(n)?[...t,...n]:typeof n==`function`?Tt(n(t)):t;let i=pi(r),a=vi(i,e=>e.name===`Debug`);if(a!==-1){let[e]=i.splice(a,1);i.push(e)}return i}function hi(e,t){let n={};return t.forEach(t=>{t&&_i(e,t,n)}),n}function gi(e,t){for(let n of t)n&&n.afterAllSetup&&n.afterAllSetup(e)}function _i(e,t,n){if(n[t.name]){Jn&&z.log(`Integration skipped because it was already installed: ${t.name}`);return}if(n[t.name]=t,fi.indexOf(t.name)===-1&&(t.setupOnce(Zn,Qr),fi.push(t.name)),t.setup&&typeof t.setup==`function`&&t.setup(e),e.on&&typeof t.preprocessEvent==`function`){let n=t.preprocessEvent.bind(t);e.on(`preprocessEvent`,(t,r)=>n(t,r,e))}if(e.addEventProcessor&&typeof t.processEvent==`function`){let n=t.processEvent.bind(t),r=Object.assign((t,r)=>n(t,r,e),{id:t.name});e.addEventProcessor(r)}Jn&&z.log(`Integration installed: ${t.name}`)}function vi(e,t){for(let n=0;n<e.length;n++)if(t(e[n])===!0)return n;return-1}function yi(e,t){return Object.assign(function(...e){return t(...e)},{id:e})}function bi(e){let t=``;for(let n of e){let e=Object.entries(n.tags),r=e.length>0?`|#${e.map(([e,t])=>`${e}:${t}`).join(`,`)}`:``;t+=`${n.name}@${n.unit}:${n.metric}|${n.metricType}${r}|T${n.timestamp}
|
|
11
|
+
`}return t}function xi(e,t,n,r){let i={sent_at:new Date().toISOString()};return n&&n.sdk&&(i.sdk={name:n.sdk.name,version:n.sdk.version}),r&&t&&(i.dsn=Be(t)),jn(i,[Si(e)])}function Si(e){let t=bi(e);return[{type:`statsd`,length:t.length},t]}var Ci=`Not capturing exception because it's already been captured.`,wi=class{constructor(e){if(this._options=e,this._integrations={},this._integrationsInitialized=!1,this._numProcessing=0,this._outcomes={},this._hooks={},this._eventProcessors=[],e.dsn?this._dsn=We(e.dsn):Jn&&z.warn(`No DSN provided, client will not send events.`),this._dsn){let t=di(this._dsn,e);this._transport=e.transport({tunnel:this._options.tunnel,recordDroppedEvent:this.recordDroppedEvent.bind(this),...e.transportOptions,url:t})}}captureException(e,t,n){if(wt(e)){Jn&&z.log(Ci);return}let r=t&&t.event_id;return this._process(this.eventFromException(e,t).then(e=>this._captureEvent(e,t,n)).then(e=>{r=e})),r}captureMessage(e,t,n,r){let i=n&&n.event_id,a=ie(e)?e:String(e),o=ae(e)?this.eventFromMessage(a,t,n):this.eventFromException(e,n);return this._process(o.then(e=>this._captureEvent(e,n,r)).then(e=>{i=e})),i}captureEvent(e,t,n){if(t&&t.originalException&&wt(t.originalException)){Jn&&z.log(Ci);return}let r=t&&t.event_id,i=(e.sdkProcessingMetadata||{}).capturedSpanScope;return this._process(this._captureEvent(e,t,i||n).then(e=>{r=e})),r}captureSession(e){typeof e.release==`string`?(this.sendSession(e),er(e,{init:!1})):Jn&&z.warn(`Discarded session because of missing or non-string release`)}getDsn(){return this._dsn}getOptions(){return this._options}getSdkMetadata(){return this._options._metadata}getTransport(){return this._transport}flush(e){let t=this._transport;return t?(this.metricsAggregator&&this.metricsAggregator.flush(),this._isClientDoneProcessing(e).then(n=>t.flush(e).then(e=>n&&e))):bn(!0)}close(e){return this.flush(e).then(e=>(this.getOptions().enabled=!1,this.metricsAggregator&&this.metricsAggregator.close(),e))}getEventProcessors(){return this._eventProcessors}addEventProcessor(e){this._eventProcessors.push(e)}setupIntegrations(e){(e&&!this._integrationsInitialized||this._isEnabled()&&!this._integrationsInitialized)&&this._setupIntegrations()}init(){this._isEnabled()&&this._setupIntegrations()}getIntegrationById(e){return this.getIntegrationByName(e)}getIntegrationByName(e){return this._integrations[e]}getIntegration(e){try{return this._integrations[e.id]||null}catch{return Jn&&z.warn(`Cannot retrieve integration ${e.id} from the current Client`),null}}addIntegration(e){let t=this._integrations[e.name];_i(this,e,this._integrations),t||gi(this,[e])}sendEvent(e,t={}){this.emit(`beforeSendEvent`,e,t);let n=oi(e,this._dsn,this._options._metadata,this._options.tunnel);for(let e of t.attachments||[])n=Mn(n,Ln(e,this._options.transportOptions&&this._options.transportOptions.textEncoder));let r=this._sendEnvelope(n);r&&r.then(t=>this.emit(`afterSendEvent`,e,t),null)}sendSession(e){let t=ai(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}recordDroppedEvent(e,t,n){if(this._options.sendClientReports){let n=`${e}:${t}`;Jn&&z.log(`Adding outcome: "${n}"`),this._outcomes[n]=this._outcomes[n]+1||1}}captureAggregateMetrics(e){Jn&&z.log(`Flushing aggregated metrics, number of metrics: ${e.length}`);let t=xi(e,this._dsn,this._options._metadata,this._options.tunnel);this._sendEnvelope(t)}on(e,t){this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t)}emit(e,...t){this._hooks[e]&&this._hooks[e].forEach(e=>e(...t))}_setupIntegrations(){let{integrations:e}=this._options;this._integrations=hi(this,e),gi(this,e),this._integrationsInitialized=!0}_updateSessionFromEvent(e,t){let n=!1,r=!1,i=t.exception&&t.exception.values;if(i){r=!0;for(let e of i){let t=e.mechanism;if(t&&t.handled===!1){n=!0;break}}}let a=e.status===`ok`;(a&&e.errors===0||a&&n)&&(er(e,{...n&&{status:`crashed`},errors:e.errors||Number(r||n)}),this.captureSession(e))}_isClientDoneProcessing(e){return new Sn(t=>{let n=0,r=setInterval(()=>{this._numProcessing==0?(clearInterval(r),t(!0)):(n+=1,e&&n>=e&&(clearInterval(r),t(!1)))},1)})}_isEnabled(){return this.getOptions().enabled!==!1&&this._transport!==void 0}_prepareEvent(e,t,n,r=$r()){let i=this.getOptions(),a=Object.keys(this._integrations);return!t.integrations&&a.length>0&&(t.integrations=a),this.emit(`preprocessEvent`,e,t),cr(i,e,t,n,this,r).then(e=>{if(e===null)return e;let t={...r.getPropagationContext(),...n?n.getPropagationContext():void 0};if(!(e.contexts&&e.contexts.trace)&&t){let{traceId:r,spanId:i,parentSpanId:a,dsc:o}=t;e.contexts={trace:{trace_id:r,span_id:i,parent_span_id:a},...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:o||jr(r,this,n),...e.sdkProcessingMetadata}}return e})}_captureEvent(e,t={},n){return this._processEvent(e,t,n).then(e=>e.event_id,e=>{if(Jn){let t=e;t.logLevel===`log`?z.log(t.message):z.warn(t)}})}_processEvent(e,t,n){let r=this.getOptions(),{sampleRate:i}=r,a=Oi(e),o=Di(e),s=e.type||`error`,c=`before send for type \`${s}\``;if(o&&typeof i==`number`&&Math.random()>i)return this.recordDroppedEvent(`sample_rate`,`error`,e),xn(new Ge(`Discarding event because it's not included in the random sample (sampling rate = ${i})`,`log`));let l=s===`replay_event`?`replay`:s,u=(e.sdkProcessingMetadata||{}).capturedSpanIsolationScope;return this._prepareEvent(e,t,n,u).then(n=>{if(n===null)throw this.recordDroppedEvent(`event_processor`,l,e),new Ge("An event processor returned `null`, will not send event.",`log`);return t.data&&t.data.__sentry__===!0?n:Ti(Ei(r,n,t),c)}).then(r=>{if(r===null)throw this.recordDroppedEvent(`before_send`,l,e),new Ge(`${c} returned \`null\`, will not send event.`,`log`);let i=n&&n.getSession();!a&&i&&this._updateSessionFromEvent(i,r);let o=r.transaction_info;return a&&o&&r.transaction!==e.transaction&&(r.transaction_info={...o,source:`custom`}),this.sendEvent(r,t),r}).then(null,e=>{throw e instanceof Ge?e:(this.captureException(e,{data:{__sentry__:!0},originalException:e}),new Ge(`Event processing pipeline threw an error, original event will not be sent. Details have been sent as a new event.
|
|
12
|
+
Reason: ${e}`))})}_process(e){this._numProcessing++,e.then(e=>(this._numProcessing--,e),e=>(this._numProcessing--,e))}_sendEnvelope(e){if(this.emit(`beforeEnvelope`,e),this._isEnabled()&&this._transport)return this._transport.send(e).then(null,e=>{Jn&&z.error(`Error while sending event:`,e)});Jn&&z.error(`Transport disabled`)}_clearOutcomes(){let e=this._outcomes;return this._outcomes={},Object.keys(e).map(t=>{let[n,r]=t.split(`:`);return{reason:n,category:r,quantity:e[t]}})}};function Ti(e,t){let n=`${t} must return \`null\` or a valid event.`;if(le(e))return e.then(e=>{if(!L(e)&&e!==null)throw new Ge(n);return e},e=>{throw new Ge(`${t} rejected with ${e}`)});if(!L(e)&&e!==null)throw new Ge(n);return e}function Ei(e,t,n){let{beforeSend:r,beforeSendTransaction:i}=e;return Di(t)&&r?r(t,n):Oi(t)&&i?i(t,n):t}function Di(e){return e.type===void 0}function Oi(e){return e.type===`transaction`}function ki(e,t){t.debug===!0&&(Jn?z.enable():Ie(()=>{})),Tr().update(t.initialScope);let n=new e(t);Ai(n),ji(n)}function Ai(e){let t=Qr().getStackTop();t.client=e,t.scope.setClient(e)}function ji(e){e.init?e.init():e.setupIntegrations&&e.setupIntegrations()}var Mi=30;function Ni(e,t,n=Cn(e.bufferSize||Mi)){let r={},i=e=>n.drain(e);function a(i){let a=[];if(Nn(i,(t,n)=>{let i=zn(n);if(Kn(r,i)){let r=Pi(t,n);e.recordDroppedEvent(`ratelimit_backoff`,i,r)}else a.push(t)}),a.length===0)return bn();let o=jn(i[0],a),s=t=>{Nn(o,(n,r)=>{let i=Pi(n,r);e.recordDroppedEvent(t,zn(r),i)})};return n.add(()=>t({body:Fn(o,e.textEncoder)}).then(e=>(e.statusCode!==void 0&&(e.statusCode<200||e.statusCode>=300)&&Jn&&z.warn(`Sentry responded with status code ${e.statusCode} to sent event.`),r=qn(r,e),e),e=>{throw s(`network_error`),e})).then(e=>e,e=>{if(e instanceof Ge)return Jn&&z.error(`Skipped sending event because buffer is full.`),s(`queue_overflow`),bn();throw e})}return a.__sentry__baseTransport__=!0,{send:a,flush:i}}function Pi(e,t){if(!(t!==`event`&&t!==`transaction`))return Array.isArray(e)?e[1]:void 0}function Fi(e,t,n=[t],r=`npm`){let i=e._metadata||{};i.sdk||={name:`sentry.javascript.${t}`,packages:n.map(e=>({name:`${r}:@sentry/${e}`,version:Kr})),version:Kr},e._metadata=i}var Ii=[/^Script error\.?$/,/^Javascript error: Script error\.? on line 0$/,/^ResizeObserver loop completed with undelivered notifications.$/,/^Cannot redefine property: googletag$/],Li=[/^.*\/healthcheck$/,/^.*\/healthy$/,/^.*\/live$/,/^.*\/ready$/,/^.*\/heartbeat$/,/^.*\/health$/,/^.*\/healthz$/],Ri=`InboundFilters`,zi=(e={})=>({name:Ri,setupOnce(){},processEvent(t,n,r){return Vi(t,Bi(e,r.getOptions()))?null:t}});yi(Ri,zi);function Bi(e={},t={}){return{allowUrls:[...e.allowUrls||[],...t.allowUrls||[]],denyUrls:[...e.denyUrls||[],...t.denyUrls||[]],ignoreErrors:[...e.ignoreErrors||[],...t.ignoreErrors||[],...e.disableErrorDefaults?[]:Ii],ignoreTransactions:[...e.ignoreTransactions||[],...t.ignoreTransactions||[],...e.disableTransactionDefaults?[]:Li],ignoreInternal:e.ignoreInternal===void 0?!0:e.ignoreInternal}}function Vi(e,t){return t.ignoreInternal&&qi(e)?(Jn&&z.warn(`Event dropped due to being internal Sentry Error.
|
|
13
|
+
Event: ${xt(e)}`),!0):Hi(e,t.ignoreErrors)?(Jn&&z.warn(`Event dropped due to being matched by \`ignoreErrors\` option.
|
|
14
|
+
Event: ${xt(e)}`),!0):Ui(e,t.ignoreTransactions)?(Jn&&z.warn(`Event dropped due to being matched by \`ignoreTransactions\` option.
|
|
15
|
+
Event: ${xt(e)}`),!0):Wi(e,t.denyUrls)?(Jn&&z.warn(`Event dropped due to being matched by \`denyUrls\` option.
|
|
16
|
+
Event: ${xt(e)}.
|
|
17
|
+
Url: ${Yi(e)}`),!0):Gi(e,t.allowUrls)?!1:(Jn&&z.warn(`Event dropped due to not being matched by \`allowUrls\` option.
|
|
18
|
+
Event: ${xt(e)}.
|
|
19
|
+
Url: ${Yi(e)}`),!0)}function Hi(e,t){return e.type||!t||!t.length?!1:Ki(e).some(e=>_e(e,t))}function Ui(e,t){if(e.type!==`transaction`||!t||!t.length)return!1;let n=e.transaction;return n?_e(n,t):!1}function Wi(e,t){if(!t||!t.length)return!1;let n=Yi(e);return n?_e(n,t):!1}function Gi(e,t){if(!t||!t.length)return!0;let n=Yi(e);return n?_e(n,t):!0}function Ki(e){let t=[];e.message&&t.push(e.message);let n;try{n=e.exception.values[e.exception.values.length-1]}catch{}return n&&n.value&&(t.push(n.value),n.type&&t.push(`${n.type}: ${n.value}`)),Jn&&t.length===0&&z.error(`Could not extract message for event ${xt(e)}`),t}function qi(e){try{return e.exception.values[0].type===`SentryError`}catch{}return!1}function Ji(e=[]){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.filename!==`<anonymous>`&&n.filename!==`[native code]`)return n.filename||null}return null}function Yi(e){try{let t;try{t=e.exception.values[0].stacktrace.frames}catch{}return t?Ji(t):null}catch{return Jn&&z.error(`Cannot extract url for event ${xt(e)}`),null}}var Xi,Zi=`FunctionToString`,Qi=new WeakMap,$i=()=>({name:Zi,setupOnce(){Xi=Function.prototype.toString;try{Function.prototype.toString=function(...e){let t=Ye(this),n=Qi.has(wr())&&t!==void 0?t:this;return Xi.apply(n,e)}}catch{}},setup(e){Qi.set(e,!0)}});yi(Zi,$i);var ea=R,ta=0;function na(){return ta>0}function ra(){ta++,setTimeout(()=>{ta--})}function ia(e,t={},n){if(typeof e!=`function`)return e;try{let t=e.__sentry_wrapped__;if(t)return t;if(Ye(e))return e}catch{return e}let r=function(){let r=Array.prototype.slice.call(arguments);try{n&&typeof n==`function`&&n.apply(this,arguments);let i=r.map(e=>ia(e,t));return e.apply(this,i)}catch(e){throw ra(),Cr(n=>{n.addEventProcessor(e=>(t.mechanism&&(St(e,void 0,void 0),Ct(e,t.mechanism)),e.extra={...e.extra,arguments:r},e)),br(e)}),e}};try{for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t])}catch{}Je(r,e),qe(e,`__sentry_wrapped__`,r);try{Object.getOwnPropertyDescriptor(r,`name`).configurable&&Object.defineProperty(r,`name`,{get(){return e.name}})}catch{}return r}var aa=typeof __SENTRY_DEBUG__>`u`||__SENTRY_DEBUG__;function oa(e,t){let n=la(e,t),r={type:t&&t.name,value:fa(t)};return n.length&&(r.stacktrace={frames:n}),r.type===void 0&&r.value===``&&(r.value=`Unrecoverable error caught`),r}function sa(e,t,n,r){let i=wr(),a=i&&i.getOptions().normalizeDepth,o={exception:{values:[{type:oe(t)?t.constructor.name:r?`UnhandledRejection`:`Error`,value:_a(t,{isUnhandledRejection:r})}]},extra:{__serialized__:pn(t,a)}};if(n){let t=la(e,n);t.length&&(o.exception.values[0].stacktrace={frames:t})}return o}function ca(e,t){return{exception:{values:[oa(e,t)]}}}function la(e,t){let n=t.stacktrace||t.stack||``,r=da(t);try{return e(n,r)}catch{}return[]}var ua=/Minified React error #\d+;/i;function da(e){if(e){if(typeof e.framesToPop==`number`)return e.framesToPop;if(ua.test(e.message))return 1}return 0}function fa(e){let t=e&&e.message;return t?t.error&&typeof t.error.message==`string`?t.error.message:t:`No error message`}function pa(e,t,n,r){let i=ha(e,t,n&&n.syntheticException||void 0,r);return Ct(i),i.level=`error`,n&&n.event_id&&(i.event_id=n.event_id),bn(i)}function ma(e,t,n=`info`,r,i){let a=ga(e,t,r&&r.syntheticException||void 0,i);return a.level=n,r&&r.event_id&&(a.event_id=r.event_id),bn(a)}function ha(e,t,n,r,i){let a;if(te(t)&&t.error)return ca(e,t.error);if(ne(t)||re(t)){let i=t;if(`stack`in t)a=ca(e,t);else{let t=i.name||(ne(i)?`DOMError`:`DOMException`),o=i.message?`${t}: ${i.message}`:t;a=ga(e,o,n,r),St(a,o)}return`code`in i&&(a.tags={...a.tags,"DOMException.code":`${i.code}`}),a}return ee(t)?ca(e,t):L(t)||oe(t)?(a=sa(e,t,n,i),Ct(a,{synthetic:!0}),a):(a=ga(e,t,n,r),St(a,`${t}`,void 0),Ct(a,{synthetic:!0}),a)}function ga(e,t,n,r){let i={};if(r&&n){let r=la(e,n);r.length&&(i.exception={values:[{value:t,stacktrace:{frames:r}}]})}if(ie(t)){let{__sentry_template_string__:e,__sentry_template_values__:n}=t;return i.logentry={message:e,params:n},i}return i.message=t,i}function _a(e,{isUnhandledRejection:t}){let n=et(e),r=t?`promise rejection`:`exception`;return te(e)?`Event \`ErrorEvent\` captured as ${r} with message \`${e.message}\``:oe(e)?`Event \`${va(e)}\` (type=${e.type}) captured as ${r}`:`Object captured as ${r} with keys: ${n}`}function va(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{}}function ya(e,{metadata:t,tunnel:n,dsn:r}){return jn({event_id:e.event_id,sent_at:new Date().toISOString(),...t&&t.sdk&&{sdk:{name:t.sdk.name,version:t.sdk.version}},...!!n&&!!r&&{dsn:Be(r)}},[ba(e)])}function ba(e){return[{type:`user_report`},e]}var xa=class extends wi{constructor(e){Fi(e,`browser`,[`browser`],ea.SENTRY_SDK_SOURCE||un()),super(e),e.sendClientReports&&ea.document&&ea.document.addEventListener(`visibilitychange`,()=>{ea.document.visibilityState===`hidden`&&this._flushOutcomes()})}eventFromException(e,t){return pa(this._options.stackParser,e,t,this._options.attachStacktrace)}eventFromMessage(e,t=`info`,n){return ma(this._options.stackParser,e,t,n,this._options.attachStacktrace)}captureUserFeedback(e){if(!this._isEnabled()){aa&&z.warn(`SDK not enabled, will not capture user feedback.`);return}let t=ya(e,{metadata:this.getSdkMetadata(),dsn:this.getDsn(),tunnel:this.getOptions().tunnel});this._sendEnvelope(t)}_prepareEvent(e,t,n){return e.platform=e.platform||`javascript`,super._prepareEvent(e,t,n)}_flushOutcomes(){let e=this._clearOutcomes();if(e.length===0){aa&&z.log(`No outcomes to send`);return}if(!this._dsn){aa&&z.log(`No dsn provided, will not send outcomes`);return}aa&&z.log(`Sending outcomes:`,e);let t=Hn(e,this._options.tunnel&&Be(this._dsn));this._sendEnvelope(t)}},Sa;function Ca(){if(Sa)return Sa;if(zt(ea.fetch))return Sa=ea.fetch.bind(ea);let e=ea.document,t=ea.fetch;if(e&&typeof e.createElement==`function`)try{let n=e.createElement(`iframe`);n.hidden=!0,e.head.appendChild(n);let r=n.contentWindow;r&&r.fetch&&(t=r.fetch),e.head.removeChild(n)}catch(e){aa&&z.warn(`Could not create sandbox iframe for pure fetch check, bailing to window.fetch: `,e)}return Sa=t.bind(ea)}function wa(){Sa=void 0}function Ta(e,t=Ca()){let n=0,r=0;function i(i){let a=i.body.length;n+=a,r++;let o={body:i.body,method:`POST`,referrerPolicy:`origin`,headers:e.headers,keepalive:n<=6e4&&r<15,...e.fetchOptions};try{return t(e.url,o).then(e=>(n-=a,r--,{statusCode:e.status,headers:{"x-sentry-rate-limits":e.headers.get(`X-Sentry-Rate-Limits`),"retry-after":e.headers.get(`Retry-After`)}}))}catch(e){return wa(),n-=a,r--,xn(e)}}return Ni(e,i)}var Ea=4;function Da(e){function t(t){return new Sn((n,r)=>{let i=new XMLHttpRequest;i.onerror=r,i.onreadystatechange=()=>{i.readyState===Ea&&n({statusCode:i.status,headers:{"x-sentry-rate-limits":i.getResponseHeader(`X-Sentry-Rate-Limits`),"retry-after":i.getResponseHeader(`Retry-After`)}})},i.open(`POST`,e.url);for(let t in e.headers)Object.prototype.hasOwnProperty.call(e.headers,t)&&i.setRequestHeader(t,e.headers[t]);i.send(t.body)})}return Ni(e,t)}var Oa=`?`,ka=30,Aa=40,ja=50;function Ma(e,t,n,r){let i={filename:e,function:t,in_app:!0};return n!==void 0&&(i.lineno=n),r!==void 0&&(i.colno=r),i}var Na=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,Pa=/\((\S*)(?::(\d+))(?::(\d+))\)/,Fa=[ka,e=>{let t=Na.exec(e);if(t){if(t[2]&&t[2].indexOf(`eval`)===0){let e=Pa.exec(t[2]);e&&(t[2]=e[1],t[3]=e[2],t[4]=e[3])}let[e,n]=Va(t[1]||Oa,t[2]);return Ma(n,e,t[3]?+t[3]:void 0,t[4]?+t[4]:void 0)}}],Ia=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,La=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Ra=[ja,e=>{let t=Ia.exec(e);if(t){if(t[3]&&t[3].indexOf(` > eval`)>-1){let e=La.exec(t[3]);e&&(t[1]=t[1]||`eval`,t[3]=e[1],t[4]=e[2],t[5]=``)}let e=t[3],n=t[1]||Oa;return[n,e]=Va(n,e),Ma(e,n,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}],za=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,Ba=st(Fa,Ra,[Aa,e=>{let t=za.exec(e);return t?Ma(t[2],t[1]||Oa,+t[3],t[4]?+t[4]:void 0):void 0}]),Va=(e,t)=>{let n=e.indexOf(`safari-extension`)!==-1,r=e.indexOf(`safari-web-extension`)!==-1;return n||r?[e.indexOf(`@`)===-1?Oa:e.split(`@`)[0],n?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},Ha=1024,Ua=`Breadcrumbs`,Wa=(e={})=>{let t={console:!0,dom:!0,fetch:!0,history:!0,sentry:!0,xhr:!0,...e};return{name:Ua,setupOnce(){},setup(e){t.console&&_t(qa(e)),t.dom&&jt(Ka(e,t.dom)),t.xhr&&sn(Ja(e)),t.fetch&&Vt(Ya(e)),t.history&&nn(Xa(e)),t.sentry&&e.on&&e.on(`beforeSendEvent`,Ga(e))}}};yi(Ua,Wa);function Ga(e){return function(t){wr()===e&&Sr({category:`sentry.${t.type===`transaction`?`transaction`:`event`}`,event_id:t.event_id,level:t.level,message:xt(t)},{event:t})}}function Ka(e,t){return function(n){if(wr()!==e)return;let r,i,a=typeof t==`object`?t.serializeAttribute:void 0,o=typeof t==`object`&&typeof t.maxStringLength==`number`?t.maxStringLength:void 0;o&&o>Ha&&(aa&&z.warn(`\`dom.maxStringLength\` cannot exceed ${Ha}, but a value of ${o} was configured. Sentry will use ${Ha} instead.`),o=Ha),typeof a==`string`&&(a=[a]);try{let e=n.event,t=Za(e)?e.target:e;r=Oe(t,{keyAttrs:a,maxStringLength:o}),i=je(t)}catch{r=`<unknown>`}if(r.length===0)return;let s={category:`ui.${n.name}`,message:r};i&&(s.data={"ui.component_name":i}),Sr(s,{event:n.event,name:n.name,global:n.global})}}function qa(e){return function(t){if(wr()!==e)return;let n={category:`console`,data:{arguments:t.args,logger:`console`},level:En(t.level),message:he(t.args,` `)};if(t.level===`assert`)if(t.args[0]===!1)n.message=`Assertion failed: ${he(t.args.slice(1),` `)||`console.assert`}`,n.data.arguments=t.args.slice(1);else return;Sr(n,{input:t.args,level:t.level})}}function Ja(e){return function(t){if(wr()!==e)return;let{startTimestamp:n,endTimestamp:r}=t,i=t.xhr[on];if(!n||!r||!i)return;let{method:a,url:o,status_code:s,body:c}=i,l={method:a,url:o,status_code:s},u={xhr:t.xhr,input:c,startTimestamp:n,endTimestamp:r};Sr({category:`xhr`,data:l,type:`http`},u)}}function Ya(e){return function(t){if(wr()!==e)return;let{startTimestamp:n,endTimestamp:r}=t;if(r&&!(t.fetchData.url.match(/sentry_key/)&&t.fetchData.method===`POST`))if(t.error){let e=t.fetchData,i={data:t.error,input:t.args,startTimestamp:n,endTimestamp:r};Sr({category:`fetch`,data:e,level:`error`,type:`http`},i)}else{let e=t.response,i={...t.fetchData,status_code:e&&e.status},a={input:t.args,response:e,startTimestamp:n,endTimestamp:r};Sr({category:`fetch`,data:i,type:`http`},a)}}}function Xa(e){return function(t){if(wr()!==e)return;let n=t.from,r=t.to,i=wn(ea.location.href),a=n?wn(n):void 0,o=wn(r);(!a||!a.path)&&(a=i),i.protocol===o.protocol&&i.host===o.host&&(r=o.relative),i.protocol===a.protocol&&i.host===a.host&&(n=a.relative),Sr({category:`navigation`,data:{from:n,to:r}})}}function Za(e){return!!e&&!!e.target}var Qa=`Dedupe`,$a=()=>{let e;return{name:Qa,setupOnce(){},processEvent(t){if(t.type)return t;try{if(eo(t,e))return aa&&z.warn(`Event dropped due to being a duplicate of previously captured event.`),null}catch{}return e=t}}};yi(Qa,$a);function eo(e,t){return t?!!(to(e,t)||no(e,t)):!1}function to(e,t){let n=e.message,r=t.message;return!(!n&&!r||n&&!r||!n&&r||n!==r||!io(e,t)||!ro(e,t))}function no(e,t){let n=ao(t),r=ao(e);return!(!n||!r||n.type!==r.type||n.value!==r.value||!io(e,t)||!ro(e,t))}function ro(e,t){let n=oo(e),r=oo(t);if(!n&&!r)return!0;if(n&&!r||!n&&r||(n=n,r=r,r.length!==n.length))return!1;for(let e=0;e<r.length;e++){let t=r[e],i=n[e];if(t.filename!==i.filename||t.lineno!==i.lineno||t.colno!==i.colno||t.function!==i.function)return!1}return!0}function io(e,t){let n=e.fingerprint,r=t.fingerprint;if(!n&&!r)return!0;if(n&&!r||!n&&r)return!1;n=n,r=r;try{return n.join(``)===r.join(``)}catch{return!1}}function ao(e){return e.exception&&e.exception.values&&e.exception.values[0]}function oo(e){let t=e.exception;if(t)try{return t.values[0].stacktrace.frames}catch{return}}var so=`GlobalHandlers`,co=(e={})=>{let t={onerror:!0,onunhandledrejection:!0,...e};return{name:so,setupOnce(){Error.stackTraceLimit=50},setup(e){t.onerror&&(lo(e),go(`onerror`)),t.onunhandledrejection&&(uo(e),go(`onunhandledrejection`))}}};yi(so,co);function lo(e){qt(t=>{let{stackParser:n,attachStacktrace:r}=_o();if(wr()!==e||na())return;let{msg:i,url:a,line:o,column:s,error:c}=t,l=c===void 0&&I(i)?mo(i,a,o,s):ho(ha(n,c||i,void 0,r,!1),a,o,s);l.level=`error`,xr(l,{originalException:c,mechanism:{handled:!1,type:`onerror`}})})}function uo(e){Xt(t=>{let{stackParser:n,attachStacktrace:r}=_o();if(wr()!==e||na())return;let i=fo(t),a=ae(i)?po(i):ha(n,i,void 0,r,!0);a.level=`error`,xr(a,{originalException:i,mechanism:{handled:!1,type:`onunhandledrejection`}})})}function fo(e){if(ae(e))return e;let t=e;try{if(`reason`in t)return t.reason;if(`detail`in t&&`reason`in t.detail)return t.detail.reason}catch{}return e}function po(e){return{exception:{values:[{type:`UnhandledRejection`,value:`Non-Error promise rejection captured with value: ${String(e)}`}]}}}function mo(e,t,n,r){let i=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,a=te(e)?e.message:e,o=`Error`,s=a.match(i);return s&&(o=s[1],a=s[2]),ho({exception:{values:[{type:o,value:a}]}},t,n,r)}function ho(e,t,n,r){let i=e.exception=e.exception||{},a=i.values=i.values||[],o=a[0]=a[0]||{},s=o.stacktrace=o.stacktrace||{},c=s.frames=s.frames||[],l=isNaN(parseInt(r,10))?void 0:r,u=isNaN(parseInt(n,10))?void 0:n,d=I(t)&&t.length>0?t:Ae();return c.length===0&&c.push({colno:l,filename:d,function:`?`,in_app:!0,lineno:u}),e}function go(e){aa&&z.log(`Global Handler attached: ${e}`)}function _o(){let e=wr();return e&&e.getOptions()||{stackParser:()=>[],attachStacktrace:!1}}var vo=`HttpContext`,yo=()=>({name:vo,setupOnce(){},preprocessEvent(e){if(!ea.navigator&&!ea.location&&!ea.document)return;let t=e.request&&e.request.url||ea.location&&ea.location.href,{referrer:n}=ea.document||{},{userAgent:r}=ea.navigator||{},i={...e.request&&e.request.headers,...n&&{Referer:n},...r&&{"User-Agent":r}};e.request={...e.request,...t&&{url:t},headers:i}}});yi(vo,yo);var bo=`cause`,xo=5,So=`LinkedErrors`,Co=(e={})=>{let t=e.limit||xo,n=e.key||bo;return{name:So,setupOnce(){},preprocessEvent(e,r,i){let a=i.getOptions();ve(oa,a.stackParser,a.maxValueLength,n,t,e,r)}}};yi(So,Co);var wo=`EventTarget.Window.Node.ApplicationCache.AudioTrackList.BroadcastChannel.ChannelMergerNode.CryptoOperation.EventSource.FileReader.HTMLUnknownElement.IDBDatabase.IDBRequest.IDBTransaction.KeyOperation.MediaController.MessagePort.ModalWindow.Notification.SVGElementInstance.Screen.SharedWorker.TextTrack.TextTrackCue.TextTrackList.WebSocket.WebSocketWorker.Worker.XMLHttpRequest.XMLHttpRequestEventTarget.XMLHttpRequestUpload`.split(`.`),To=`TryCatch`,Eo=(e={})=>{let t={XMLHttpRequest:!0,eventTarget:!0,requestAnimationFrame:!0,setInterval:!0,setTimeout:!0,...e};return{name:To,setupOnce(){t.setTimeout&&Ke(ea,`setTimeout`,Do),t.setInterval&&Ke(ea,`setInterval`,Do),t.requestAnimationFrame&&Ke(ea,`requestAnimationFrame`,Oo),t.XMLHttpRequest&&`XMLHttpRequest`in ea&&Ke(XMLHttpRequest.prototype,`send`,ko);let e=t.eventTarget;e&&(Array.isArray(e)?e:wo).forEach(Ao)}}};yi(To,Eo);function Do(e){return function(...t){let n=t[0];return t[0]=ia(n,{mechanism:{data:{function:dt(e)},handled:!1,type:`instrument`}}),e.apply(this,t)}}function Oo(e){return function(t){return e.apply(this,[ia(t,{mechanism:{data:{function:`requestAnimationFrame`,handler:dt(e)},handled:!1,type:`instrument`}})])}}function ko(e){return function(...t){let n=this;return[`onload`,`onerror`,`onprogress`,`onreadystatechange`].forEach(e=>{e in n&&typeof n[e]==`function`&&Ke(n,e,function(t){let n={mechanism:{data:{function:e,handler:dt(t)},handled:!1,type:`instrument`}},r=Ye(t);return r&&(n.mechanism.data.handler=dt(r)),ia(t,n)})}),e.apply(this,t)}}function Ao(e){let t=ea,n=t[e]&&t[e].prototype;!n||!n.hasOwnProperty||!n.hasOwnProperty(`addEventListener`)||(Ke(n,`addEventListener`,function(t){return function(n,r,i){try{typeof r.handleEvent==`function`&&(r.handleEvent=ia(r.handleEvent,{mechanism:{data:{function:`handleEvent`,handler:dt(r),target:e},handled:!1,type:`instrument`}}))}catch{}return t.apply(this,[n,ia(r,{mechanism:{data:{function:`addEventListener`,handler:dt(r),target:e},handled:!1,type:`instrument`}}),i])}}),Ke(n,`removeEventListener`,function(e){return function(t,n,r){let i=n;try{let n=i&&i.__sentry_wrapped__;n&&e.call(this,t,n,r)}catch{}return e.call(this,t,i,r)}}))}var jo=[zi(),$i(),Eo(),Wa(),co(),Co(),$a(),yo()];function Mo(e){return[...jo]}function No(e={}){e.defaultIntegrations===void 0&&(e.defaultIntegrations=Mo()),e.release===void 0&&(typeof __SENTRY_RELEASE__==`string`&&(e.release=__SENTRY_RELEASE__),ea.SENTRY_RELEASE&&ea.SENTRY_RELEASE.id&&(e.release=ea.SENTRY_RELEASE.id)),e.autoSessionTracking===void 0&&(e.autoSessionTracking=!0),e.sendClientReports===void 0&&(e.sendClientReports=!0),ki(xa,{...e,stackParser:ct(e.stackParser||Ba),integrations:mi(e),transport:e.transport||(Rt()?Ta:Da)}),e.autoSessionTracking&&Po()}function Po(){if(typeof ea.document>`u`){aa&&z.warn(`Session tracking in non-browser environment with @sentry/browser is not supported.`);return}Er({ignoreDuration:!0}),kr(),nn(({from:e,to:t})=>{e!==void 0&&e!==t&&(Er({ignoreDuration:!0}),kr())})}var Fo=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof r.r<`u`?r.r:typeof self<`u`?self:{};function Io(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}function Lo(e){if(e.__esModule)return e;var t=e.default;if(typeof t==`function`){var n=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,`__esModule`,{value:!0}),Object.keys(e).forEach(function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}),n}function Ro(e){let t={...e};Fi(t,`react`),No(t)}var zo=(e=>(e.INLINE=`inline`,e.OVERLAY=`overlay`,e))(zo||{}),Bo=(e=>(e.TOP=`top`,e.BOTTOM=`bottom`,e.HIDDEN=``,e))(Bo||{}),Vo=[{name:`circle`,type:`Circle`},{name:`square`,type:`Rect`,options:{lockUniScaling:!1}},{name:`triangle`,type:`Triangle`},{name:`ellipse`,type:`Ellipse`,options:{lockUniScaling:!1}},{name:`Arrow #1`,type:`Path`,options:{path:`M 294.9 16.4 l 15.7 42.2 c -171.4 70.3 -294 242.3 -289.1 437.4 l 14.7 -1 c 9.1 -0.6 18.1 -1.2 27.1 -1.9 l 14.7 -1 c -4.3 -170.1 102.5 -320 252 -381.3 l 15.7 42.2 c 34.7 -40.5 83.1 -76.6 144.8 -99.8 c -58.1 -26.2 -124.9 -39.6 -195.6 -36.8 z`}},{name:`Arrow #2`,type:`Path`,options:{path:`M 16 248.4 v 14.9 h 447.5 l -93.2 82.5 l 11.9 10.5 l 113.8 -100.2 l -113.6 -100.4 l -11.8 10.5 l 92.9 82.2 z`}},{name:`Arrow #3`,type:`Path`,options:{path:`M 496 256 l -118.6 -66 v 40.8 h -361.4 v 50.4 h 361.4 v 40.8 l 118.6 -66 z`}},{name:`Line`,type:`Path`,options:{path:`M 16 256 h 480`,strokeWidth:10,stroke:`#000`,padding:10}},{name:`Star`,type:`Path`,options:{path:`M 256 406.3 l 148.3 78 l -28.3 -165.2 l 120 -117 l -165.8 -24.1 l -74.2 -150.3 l -74.2 150.3 l -165.8 24.1 l 120 117 l -28.3 165.2 z`}},{name:`Polygon`,type:`Path`,options:{path:`M 256 19.6 l 156.6 57.1 l 83.4 144.3 l -28.9 164.2 l -127.7 107.2 h -166.8 l -127.7 -107.2 l -28.9 -164.2 l 83.4 -144.3 z`}},{name:`Badge`,type:`Path`,options:{path:`M 257.3 16.2 s -148 58.2 -204.4 81.4 c 0 75.7 -16.8 303.5 204.4 398.2 c 218.7 -94.6 201.9 -322.4 201.9 -398.2 c -62.1 -23.6 -201.9 -81.4 -201.9 -81.4 z`}}],Ho=`afro-1.afro.agent.alien-1.alien.angel.angry-1.angry-2.angry-3.angry-4.angry-5.angry.arguing.arrogant.asian-1.asian.avatar.baby-1.baby-2.baby.bully.burglar.businessman.cheeky-1.cheeky.clown.confused-1.confused-2.confused-3.confused.creepy.crying-1.crying-2.crying-3.crying.dazed-1.dazed-2.dazed-3.dazed.dead-1.dead-2.dead-3.dead-4.dead-5.dead-6.dead.desperate-1.desperate.detective.dissapointment.doctor.drunk.dumb.emo-1.emo-2.emo.emoticon.evil.faint-1.faint.flirt-1.flirt-2.flirt.flirty.gangster.geek-1.geek.gentleman-1.gentleman-2.gentleman-3.gentleman-4.gentleman.ginger.girl-1.girl.goofy-1.goofy-2.goofy-3.goofy-4.goofy.grubby-1.grubby.happy-1.happy-10.happy-11.happy-12.happy-13.happy-14.happy-15.happy-16.happy-2.happy-3.happy-4.happy-5.happy-6.happy-7.happy-8.happy-9.happy.harry-potter.heisenberg.hipster-1.hipster-2.hipster.in-love-1.in-love-2.in-love-3.in-love-4.in-love-5.in-love-6.in-love.japan.jew.joyful-1.joyful-2.joyful.kiss-1.kiss-2.kiss-3.kiss-4.kiss.laughing-1.laughing-2.laughing-3.laughing.listening.love.manly.miserly-1.miserly.nerd-1.nerd-2.nerd-3.nerd-4.nerd.ninja.pirate-1.pirate-2.pirate.punk-1.punk-2.punk.rapper.relieved.rich-1.rich-2.rich.rockstar.sad-1.sad-2.sad-3.sad-4.sad-5.sad-6.sad.scared-1.scared-2.scared-3.scared.sceptic-1.sceptic-2.sceptic-3.sceptic-4.sceptic-5.sceptic-6.sceptic-7.sceptic.secret.shocked-1.shocked-2.shocked-3.shocked.sick-1.sick-2.sick-3.sick-4.sick.silent.skeleton.smile.smiling-1.smiling.smoked.smug-1.smug-2.smug-3.smug-4.smug-5.smug-6.smug.sporty.stunned.superhero-1.superhero-2.superhero-3.superhero-4.superhero.surprised-1.surprised.thinking.tired-1.tired-2.tired-3.tired.tough-1.tough.trendy.vampire-1.vampire.wink-1.wink-2.wink.winking-1.winking.yawning-1.yawning-2.yawning-3.yawning.yelling.zombie`.split(`.`);function B(e,t){return{...t,message:e}}var Uo=[{name:`emoticons`,list:Ho,type:`svg`,thumbnailUrl:`images/stickers/categories/emoticon.svg`},{name:`doodles`,items:100,type:`svg`,thumbnailUrl:`images/stickers/categories/doodles.svg`},{name:`landmarks`,items:100,type:`svg`,thumbnailUrl:`images/stickers/categories/landmark.svg`,invertPreview:!0},{name:`bubbles`,items:104,type:`png`,thumbnailUrl:`images/stickers/categories/speech-bubble.svg`},{name:`transportation`,items:22,type:`svg`,thumbnailUrl:`images/stickers/categories/transportation.svg`,invertPreview:!0},{name:`beach`,items:22,type:`svg`,thumbnailUrl:`images/stickers/categories/beach.svg`,invertPreview:!0}],Wo={emoticons:B(`Emoticons`),doodles:B(`Doodles`),landmarks:B(`Landmarks`),bubbles:B(`Bubbles`),transportation:B(`Transportation`),beach:B(`Beach`)},Go={fill:`#1565C0`,opacity:1,backgroundColor:null,strokeWidth:.05,stroke:`#000`},Ko=[`PencilBrush`,`EraserBrush`,`SprayBrush`,`CircleBrush`,`DiamondBrush`,`VLineBrush`,`HLineBrush`,`SquareBrush`],qo=[1,8,15,20,25],Jo=(e=>(e.DARK=`dark`,e.LIGHT=`light`,e))(Jo||{}),Yo=[{name:Jo.LIGHT,colors:{"--be-foreground-base":`0 0 0`,"--be-primary-light":`191 219 254`,"--be-primary":`59 130 246`,"--be-primary-dark":`37 99 235`,"--be-on-primary":`255 255 255`,"--be-danger":`179 38 30`,"--be-on-danger":`255 255 255`,"--be-background":`255 255 255`,"--be-background-alt":`250 250 250`,"--be-paper":`255 255 255`,"--be-disabled-bg-opacity":`12%`,"--be-disabled-fg-opacity":`26%`,"--be-hover-opacity":`4%`,"--be-focus-opacity":`12%`,"--be-selected-opacity":`8%`,"--be-text-main-opacity":`87%`,"--be-text-muted-opacity":`60%`,"--be-divider-opacity":`12%`}},{name:Jo.DARK,isDark:!0,colors:{"--be-foreground-base":`255 255 255`,"--be-primary-light":`239 246 255`,"--be-primary":`191 219 254`,"--be-primary-dark":`147 197 253`,"--be-on-primary":`56 30 114`,"--be-danger":`242 184 181`,"--be-on-danger":`96 20 16`,"--be-background":`20 21 23`,"--be-background-alt":`26 27 30`,"--be-paper":`44 46 51`,"--be-disabled-bg-opacity":`12%`,"--be-disabled-fg-opacity":`30%`,"--be-hover-opacity":`8%`,"--be-focus-opacity":`12%`,"--be-selected-opacity":`16%`,"--be-text-main-opacity":`100%`,"--be-text-muted-opacity":`70%`,"--be-divider-opacity":`12%`}}],V=(e=>(e.FILTER=`filter`,e.RESIZE=`resize`,e.CROP=`crop`,e.DRAW=`draw`,e.TEXT=`text`,e.SHAPES=`shapes`,e.STICKERS=`stickers`,e.FRAME=`frame`,e.CORNERS=`corners`,e.MERGE=`merge`,e))(V||{});function Xo(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Xo(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function H(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Xo(e))&&(r&&(r+=` `),r+=t);return r}var Zo=(0,l.forwardRef)((e,t)=>{let{attr:n,size:r,title:i,className:a,color:o,style:s,children:c,viewBox:l,width:u,height:d,...f}=e;return(0,m.jsxs)(`svg`,{"aria-hidden":!i,focusable:!1,xmlns:`http://www.w3.org/2000/svg`,viewBox:l||`0 0 24 24`,...n,...f,className:H(`svg-icon`,a,Qo(r)),style:{color:o,...s},ref:t,height:d||`1em`,width:u||`1em`,children:[i&&(0,m.jsx)(`title`,{children:i}),c]})});function Qo(e){switch(e){case`2xs`:return`icon-2xs`;case`xs`:return`icon-xs`;case`sm`:return`icon-sm`;case`md`:return`icon-md`;case`lg`:return`icon-lg`;case`xl`:return`icon-xl`;default:return e}}function U(e,t=``,n){return l.default.memo(l.default.forwardRef((r,i)=>(0,m.jsx)(Zo,{"data-testid":`${t}Icon`,ref:i,viewBox:n,...r,size:r.size||`md`,children:e})))}function $o(e,t=``){return U(es(e),t)}function es(e){return e?.map&&e.map((e,t)=>l.default.createElement(e.tag,{key:t,...e.attr},es(e.child)))}var ts=U((0,m.jsx)(`path`,{d:`M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z`}),`TuneOutlined`),ns=U((0,m.jsx)(`path`,{d:`M21 15h2v2h-2v-2zm0-4h2v2h-2v-2zm2 8h-2v2c1 0 2-1 2-2zM13 3h2v2h-2V3zm8 4h2v2h-2V7zm0-4v2h2c0-1-1-2-2-2zM1 7h2v2H1V7zm16-4h2v2h-2V3zm0 16h2v2h-2v-2zM3 3C2 3 1 4 1 5h2V3zm6 0h2v2H9V3zM5 3h2v2H5V3zm-4 8v8c0 1.1.9 2 2 2h12V11H1zm2 8 2.5-3.21 1.79 2.15 2.5-3.22L13 19H3z`}),`PhotoSizeSelectLargeOutlined`),rs=U((0,m.jsx)(`path`,{d:`M17 15h2V7c0-1.1-.9-2-2-2H9v2h8v8zM7 17V1H5v4H1v2h4v10c0 1.1.9 2 2 2h10v4h2v-4h4v-2H7z`}),`CropOutlined`),is=U((0,m.jsx)(`path`,{d:`M2.5 4v3h5v12h3V7h5V4h-13zm19 5h-9v3h3v7h3v-7h3V9z`}),`TextFieldsOutlined`),as=U((0,m.jsx)(`path`,{d:`M10.5 4.5c.28 0 .5.22.5.5v2h6v6h2c.28 0 .5.22.5.5s-.22.5-.5.5h-2v6h-2.12c-.68-1.75-2.39-3-4.38-3s-3.7 1.25-4.38 3H4v-2.12c1.75-.68 3-2.39 3-4.38 0-1.99-1.24-3.7-2.99-4.38L4 7h6V5c0-.28.22-.5.5-.5m0-2C9.12 2.5 8 3.62 8 5H4c-1.1 0-1.99.9-1.99 2v3.8h.29c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-.3c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7v.3H17c1.1 0 2-.9 2-2v-4c1.38 0 2.5-1.12 2.5-2.5S20.38 11 19 11V7c0-1.1-.9-2-2-2h-4c0-1.38-1.12-2.5-2.5-2.5z`}),`ExtensionOutlined`),os=U((0,m.jsx)(`path`,{d:`M10.25 13c0 .69-.56 1.25-1.25 1.25S7.75 13.69 7.75 13s.56-1.25 1.25-1.25 1.25.56 1.25 1.25zM15 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm7 .25c0 5.52-4.48 10-10 10S2 17.52 2 12 6.48 2 12 2s10 4.48 10 10zM10.66 4.12C12.06 6.44 14.6 8 17.5 8c.46 0 .91-.05 1.34-.12C17.44 5.56 14.9 4 12 4c-.46 0-.91.05-1.34.12zM4.42 9.47c1.71-.97 3.03-2.55 3.66-4.44C6.37 6 5.05 7.58 4.42 9.47zM20 12c0-.78-.12-1.53-.33-2.24-.7.15-1.42.24-2.17.24-3.13 0-5.92-1.44-7.76-3.69C8.69 8.87 6.6 10.88 4 11.86c.01.04 0 .09 0 .14 0 4.41 3.59 8 8 8s8-3.59 8-8z`}),`FaceOutlined`),ss=U((0,m.jsx)(`path`,{d:`M20 4h-4l-4-4-4 4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H4V6h4.52l3.52-3.5L15.52 6H20v14zM6 18h12V8H6v10zm2-8h8v6H8v-6z`}),`FilterFramesOutlined`),cs=U((0,m.jsx)(`path`,{d:`M6.41 21 5 19.59l4.83-4.83c.75-.75 1.17-1.77 1.17-2.83v-5.1L9.41 8.41 8 7l4-4 4 4-1.41 1.41L13 6.83v5.1c0 1.06.42 2.08 1.17 2.83L19 19.59 17.59 21 12 15.41 6.41 21z`}),`MergeOutlined`),ls=U((0,m.jsx)(`path`,{d:`M19 19h2v2h-2v-2zm0-2h2v-2h-2v2zM3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm0-4h2V3H3v2zm4 0h2V3H7v2zm8 16h2v-2h-2v2zm-4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm-8 0h2v-2H7v2zm-4 0h2v-2H3v2zM21 8c0-2.76-2.24-5-5-5h-5v2h5c1.65 0 3 1.35 3 3v5h2V8z`}),`RoundedCornerOutlined`),us=U((0,m.jsx)(`path`,{d:`M20 4v12H8V4h12m0-2H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-8.5 9.67 1.69 2.26 2.48-3.1L19 15H9zM2 6v14c0 1.1.9 2 2 2h14v-2H4V6H2z`}),`PhotoLibraryOutlined`),ds=U((0,m.jsx)(`path`,{d:`M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.25 2.52.77-1.28-3.52-2.09V8z`}),`HistoryOutlined`),fs=U([(0,m.jsx)(`path`,{d:`m2.53 19.65 1.34.56v-9.03l-2.43 5.86c-.41 1.02.08 2.19 1.09 2.61zm19.5-3.7L17.07 3.98c-.31-.75-1.04-1.21-1.81-1.23-.26 0-.53.04-.79.15L7.1 5.95c-.75.31-1.21 1.03-1.23 1.8-.01.27.04.54.15.8l4.96 11.97c.31.76 1.05 1.22 1.83 1.23.26 0 .52-.05.77-.15l7.36-3.05c1.02-.42 1.51-1.59 1.09-2.6zm-9.2 3.8L7.87 7.79l7.35-3.04h.01l4.95 11.95-7.35 3.05z`},`0`),(0,m.jsx)(`circle`,{cx:`11`,cy:`9`,r:`1`},`1`),(0,m.jsx)(`path`,{d:`M5.88 19.75c0 1.1.9 2 2 2h1.45l-3.45-8.34v6.34z`},`2`)],`StyleOutlined`),ps=U((0,m.jsx)(`path`,{d:`M16 9v10H8V9h8m-1.5-6h-5l-1 1H5v2h14V4h-3.5l-1-1zM18 7H6v12c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7z`}),`DeleteOutlined`),ms=U((0,m.jsx)(`path`,{d:`M18.85,10.39l1.06-1.06c0.78-0.78,0.78-2.05,0-2.83L18.5,5.09c-0.78-0.78-2.05-0.78-2.83,0l-1.06,1.06L18.85,10.39z M14.61,11.81L7.41,19H6v-1.41l7.19-7.19L14.61,11.81z M13.19,7.56L4,16.76V21h4.24l9.19-9.19L13.19,7.56L13.19,7.56z M19,17.5 c0,2.19-2.54,3.5-5,3.5c-0.55,0-1-0.45-1-1s0.45-1,1-1c1.54,0,3-0.73,3-1.5c0-0.47-0.48-0.87-1.23-1.2l1.48-1.48 C18.32,15.45,19,16.29,19,17.5z M4.58,13.35C3.61,12.79,3,12.06,3,11c0-1.8,1.89-2.63,3.56-3.36C7.59,7.18,9,6.56,9,6 c0-0.41-0.78-1-2-1C5.74,5,5.2,5.61,5.17,5.64C4.82,6.05,4.19,6.1,3.77,5.76C3.36,5.42,3.28,4.81,3.62,4.38C3.73,4.24,4.76,3,7,3 c2.24,0,4,1.32,4,3c0,1.87-1.93,2.72-3.64,3.47C6.42,9.88,5,10.5,5,11c0,0.31,0.43,0.6,1.07,0.86L4.58,13.35z`}),`Draw`),hs=U((0,m.jsx)(`path`,{d:`m12 5.69 5 4.5V18h-2v-6H9v6H7v-7.81l5-4.5M12 3 2 12h3v8h6v-6h2v6h6v-8h3L12 3z`}),`HomeOutlined`),gs={[V.FILTER]:{name:B(`Applied Filters`),icon:ts},[V.RESIZE]:{name:B(`Resized Image`),icon:ns},[V.CROP]:{name:B(`Cropped Image`),icon:rs},[V.DRAW]:{name:B(`Added Drawing`),icon:ms},[V.TEXT]:{name:B(`Added Text`),icon:is},[V.SHAPES]:{name:B(`Added Shape`),icon:as},[V.STICKERS]:{name:B(`Added Sticker`),icon:os},[V.FRAME]:{name:B(`Added Frame`),icon:ss},[V.MERGE]:{name:B(`Merged Objects`),icon:cs},[V.CORNERS]:{name:B(`Rounded Corner`),icon:ls},bgImage:{name:B(`Replaced Background Image`),icon:us},overlayImage:{name:B(`Added Image`),icon:us},initial:{name:B(`Initial`),icon:hs},loadedState:{name:B(`Loaded State`),icon:ds},objectStyle:{name:B(`Changed Style`),icon:fs},deletedObject:{name:B(`Deleted object`),icon:ps}},_s=Object.values(V).map(e=>({name:e,icon:gs[e].icon,action:e===V.MERGE?e=>{e.tools.merge.apply()}:e})),vs={filter:B(`filter`),resize:B(`resize`),crop:B(`crop`),draw:B(`draw`),text:B(`text`),shapes:B(`shapes`),stickers:B(`stickers`),frame:B(`frame`),corners:B(`corners`),merge:B(`merge`)},ys=U((0,m.jsx)(`path`,{d:`M18 15v3H6v-3H4v3c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2v-3h-2zm-1-4-1.41-1.41L13 12.17V4h-2v8.17L8.41 9.59 7 11l5 5 5-5z`}),`FileDownloadOutlined`),bs={name:`pixie`,version:`3.0.5`,main:`dist/pixie.umd.js`,module:`dist/pixie.es.js`,types:`dist/types/src/pixie.d.ts`,private:!0,exports:{".":{import:`./dist/pixie.es.js`,require:`./dist/pixie.umd.js`}},files:[`dist`],scripts:{dev:`vite --host`,build:`vite build && npm run build-umd && npm run types && npm run build-cc`,types:`tsc --skipLibCheck --emitDeclarationOnly --noEmit false --declarationMap false`,"build-umd":`vite build --config scripts/vite-umd.config.ts`,"build-cc":`./scripts/build-cc.sh`,serve:`vite preview`,extract:`node ./scripts/extract-translations.js`},dependencies:{"@floating-ui/react-dom":`^2.0.2`,"@internationalized/date":`^3.5.0`,"@internationalized/number":`^3.3.0`,"@paypal/paypal-js":`^7.0.3`,"@react-aria/focus":`^3.14.3`,"@react-aria/interactions":`^3.19.1`,"@react-aria/overlays":`^3.18.1`,"@react-aria/ssr":`^3.8.0`,"@react-aria/utils":`^3.21.1`,"@react-stately/color":`^3.4.4`,"@react-stately/utils":`^3.8.0`,"@sentry/react":`^7.76.0`,"@sentry/tracing":`^7.76.0`,"@stripe/react-stripe-js":`^2.3.1`,"@stripe/stripe-js":`^2.1.10`,"@tailwindcss/container-queries":`^0.1.0`,"@tanstack/react-query":`^5.0.5`,"@tanstack/react-query-devtools":`^5.4.2`,"@tanstack/react-virtual":`^3.0.0-beta.68`,"@tiptap/extension-code-block-lowlight":`^2.1.12`,"@tiptap/extension-color":`^2.1.12`,"@tiptap/extension-image":`^2.1.12`,"@tiptap/extension-link":`^2.1.12`,"@tiptap/extension-subscript":`^2.1.12`,"@tiptap/extension-superscript":`^2.1.12`,"@tiptap/extension-text-align":`^2.1.12`,"@tiptap/extension-text-style":`^2.1.12`,"@tiptap/extension-underline":`^2.1.12`,"@tiptap/react":`^2.1.12`,"@tiptap/starter-kit":`^2.1.12`,"@types/google.visualization":`^0.0.71`,"@use-gesture/react":`^10.2.20`,"@vitejs/plugin-react-swc":`^3.4.0`,"ace-builds":`^1.31.0`,axios:`^1.6.0`,"axios-retry":`^3.8.1`,"chart.js":`^4.4.0`,clsx:`^2.0.0`,color:`^4.2.3`,dashjs:`^4.7.2`,"deep-object-diff":`^1.1.7`,deepmerge:`^4.2.2`,"dot-object":`^2.1.4`,fabric:`^5.3.0`,"file-saver":`^2.0.5`,"framer-motion":`^10.16.4`,fscreen:`^1.2.0`,"get-video-id":`^3.6.5`,"highlight.js":`^11.9.0`,"hls.js":`^1.4.12`,immer:`^10.0.3`,"just-debounce-it":`^3.2.0`,"linkify-string":`^4.0.2`,lowlight:`^3.1.0`,"media-icons":`^0.10.0`,"mime-match":`^1.0.2`,"nano-memoize":`^1.3.0`,nanoid:`^5.0.2`,"number-precision":`^1.6.0`,"performant-array-to-tree":`^1.11.0`,"prosemirror-state":`^1.4.1`,react:`>=18.2.0`,"react-ace":`^10.1.0`,"react-colorful":`^5.5.1`,"react-dom":`>=18.2.0`,"react-hook-form":`^7.47.0`,"react-merge-refs":`^2.1.1`,"react-router-dom":`^6.17.0`,"react-textarea-autosize":`^8.5.3`,"react-use-clipboard":`^1.0.7`,"react-use-cookie":`^1.4.0`,slugify:`^1.6.5`,"style-inject":`^0.3.0`,"swagger-ui-react":`^4.15`,"tus-js-client":`^3.0.1`,"url-regex":`^5.0.0`,"use-debounce":`^9.0.4`,"use-immer":`^0.9.0`,zustand:`^4.4.4`},peerDependencies:{react:`>=18.2.0`,"react-dom":`>=18.2.0`},devDependencies:{"@prettier/plugin-php":`^0.21.0`,"@rollup/plugin-replace":`^5.0`,"@tailwindcss/typography":`^0.5.10`,"@types/color":`^3.0.6`,"@types/dot-object":`^2.1.4`,"@types/fabric":`^4.5.12`,"@types/file-saver":`^2.0.7`,"@types/fscreen":`^1.0.3`,"@types/react":`^18`,"@types/react-dom":`^18`,"@types/react-recaptcha-v3":`^1.1.3`,"@types/swagger-ui-react":`^4.18.2`,"@typescript-eslint/eslint-plugin":`^6.9.0`,"@typescript-eslint/parser":`^6.9.0`,"@vitejs/plugin-react":`^4.3.0`,autoprefixer:`^10.4.16`,"babel-loader":`^9.1.3`,cssnano:`^7.0.2`,eslint:`^8.52.0`,"eslint-config-prettier":`^9.0.0`,"eslint-plugin-import":`^2.29.0`,"eslint-plugin-jsx-a11y":`^6.6.1`,"eslint-plugin-react":`^7.33.2`,"eslint-plugin-react-hooks":`^4.6.0`,express:`^4.18.2`,"laravel-vite-plugin":`^0.8.1`,postcss:`^8.4.31`,prettier:`^3.0.3`,"prettier-plugin-blade":`^1.6.14`,"prettier-plugin-tailwindcss":`^0.5.6`,tailwindcss:`^3.3`,typescript:`^5.2.2`,"utility-types":`^3.10.0`,vite:`^4.5.0`,"vite-tsconfig-paths":`^4.2.1`}}.version,xs={selector:`pixie-editor`,textureSize:4096,activeLanguage:`en`,ui:{visible:!0,mode:zo.INLINE,forceOverlayModeOnMobile:!0,activeTheme:Jo.LIGHT,themes:Yo,allowEditorClose:!0,menubar:{items:[{type:`undoWidget`,align:`left`},{type:`zoomWidget`,align:`center`,desktopOnly:!0},{type:`button`,icon:ds,align:`right`,desktopOnly:!0,action:e=>{e.togglePanel(`history`)}},{type:`button`,icon:ys,label:B(`Done`),align:`right`,action:e=>{var t;(t=e.state.config.ui)!=null&&t.showExportPanel?e.state.togglePanel(`export`,!0):e.tools.export.save()}}]},nav:{position:Bo.BOTTOM,items:[..._s]},openImageDialog:{show:!0,sampleImages:[{url:`images/samples/sample1.jpg`,thumbnail:`images/samples/sample1_thumbnail.jpg`},{url:`images/samples/sample2.jpg`,thumbnail:`images/samples/sample2_thumbnail.jpg`},{url:`images/samples/sample3.jpg`,thumbnail:`images/samples/sample3_thumbnail.jpg`}]},colorPresets:{items:[`rgb(0,0,0)`,`rgb(255, 255, 255)`,`rgb(242, 38, 19)`,`rgb(249, 105, 14)`,`rgb(253, 227, 167)`,`rgb(4, 147, 114)`,`rgb(30, 139, 195)`,`rgb(142, 68, 173)`]}},objectDefaults:{global:{...Go},sticker:{fill:void 0},text:{textAlign:`initial`,underline:!1,linethrough:!1,fontStyle:`normal`,fontFamily:`Times New Roman`,fontWeight:`normal`,stroke:void 0,fontSize:40}},tools:{filter:{items:[`grayscale`,`blackWhite`,`sharpen`,`invert`,`vintage`,`polaroid`,`kodachrome`,`technicolor`,`brownie`,`sepia`,`removeColor`,`brightness`,`gamma`,`noise`,`pixelate`,`blur`,`emboss`,`blendColor`]},zoom:{allowUserZoom:!0,fitImageToScreen:!0},crop:{allowCustomRatio:!0,defaultRatio:`1:1`,presets:[{ratio:null,name:`Custom`},{ratio:`1:1`,name:`Square`},{ratio:`4:3`},{ratio:`16:9`},{ratio:`5:3`},{ratio:`5:4`},{ratio:`6:4`},{ratio:`7:5`},{ratio:`10:8`}]},text:{defaultText:`Double click to edit`,controlsPadding:6,items:[{family:`Roboto`,src:`fonts/open-sans-v27-latin-ext_latin-regular.woff2`},{family:`Fuzzy Bubbles`,src:`fonts/fuzzy-bubbles-v3-latin-700.woff2`,descriptors:{weight:`700`}},{family:`Aleo Bold`,src:`fonts/aleo-v4-latin-ext_latin-700.woff2`,descriptors:{weight:`700`}},{family:`Amatic SC`,src:`fonts/amatic-sc-v16-latin-ext_latin-regular.woff2`},{family:`Corinthia Bold`,src:`fonts/corinthia-v7-latin-ext_latin-700.woff2`},{family:`Bungee Inline`,src:`fonts/bungee-inline-v6-latin-ext_latin-regular.woff2`},{family:`Robot Slab Bold`,src:`fonts/roboto-slab-v16-latin-ext_latin-500.woff2`},{family:`Carter One`,src:`fonts/carter-one-v12-latin-regular.woff2`},{family:`Cody Star`,src:`fonts/codystar-v10-latin-ext_latin-regular.woff2`},{family:`Fira Sans`,src:`fonts/fira-sans-v11-latin-ext_latin_cyrillic-regular.woff2`},{family:`Krona One`,src:`fonts/krona-one-v9-latin-ext_latin-regular.woff2`},{family:`Kumar One Outline`,src:`fonts/kumar-one-outline-v8-latin-ext_latin-regular.woff2`},{family:`Lobster Two`,src:`fonts/lobster-two-v13-latin-regular.woff2`},{family:`Molle Italic`,src:`fonts/molle-v11-latin-ext_latin-italic.woff2`},{family:`Monoton`,src:`fonts/monoton-v10-latin-regular.woff2`},{family:`Nixie One`,src:`fonts/nixie-one-v11-latin-regular.woff2`},{family:`Permanent Marker`,src:`fonts/permanent-marker-v10-latin-regular.woff2`},{family:`Sancreek`,src:`fonts/sancreek-v13-latin-ext_latin-regular.woff2`},{family:`Stint Ultra Expanded`,src:`fonts/stint-ultra-expanded-v10-latin-regular.woff2`},{family:`VT323`,src:`fonts/vt323-v12-latin-ext_latin-regular.woff2`},{family:`Trash Hand`,src:`fonts/TrashHand.ttf`}]},draw:{brushSizes:qo,brushTypes:Ko},shapes:{items:Vo.slice()},stickers:{items:Uo},import:{validImgExtensions:[`png`,`jpg`,`jpeg`,`svg`,`gif`],fitOverlayToScreen:!0,openDroppedImageAsBackground:!1},export:{defaultFormat:`png`,defaultQuality:.8,defaultName:`image`},frame:{items:[{name:`basic`,mode:`basic`,size:{min:1,max:35,default:10}},{name:`pine`,mode:`stretch`,size:{min:1,max:35,default:15}},{name:`oak`,mode:`stretch`,size:{min:1,max:35,default:15}},{name:`rainbow`,mode:`stretch`,size:{min:1,max:35,default:15}},{name:`grunge1`,display_name:`grunge #1`,mode:`stretch`,size:{min:1,max:35,default:15}},{name:`grunge2`,display_name:`grunge #2`,mode:`stretch`,size:{min:1,max:35,default:20}},{name:`ebony`,mode:`stretch`,size:{min:1,max:35,default:15}},{name:`art1`,display_name:`Art #1`,mode:`repeat`,size:{min:10,max:70,default:55}},{name:`art2`,display_name:`Art #2`,mode:`repeat`,size:{min:10,max:70,default:55}}]}}},Ss=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:e=>(n.add(e),()=>n.delete(e)),destroy:()=>{n.clear()}},o=t=e(r,i,a);return a},Cs=e=>e?Ss(e):Ss,ws={exports:{}},Ts={},Es={exports:{}},Ds={},Os=l.default;function ks(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var As=typeof Object.is==`function`?Object.is:ks,js=Os.useState,Ms=Os.useEffect,Ns=Os.useLayoutEffect,Ps=Os.useDebugValue;function Fs(e,t){var n=t(),r=js({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return Ns(function(){i.value=n,i.getSnapshot=t,Is(i)&&a({inst:i})},[e,n,t]),Ms(function(){return Is(i)&&a({inst:i}),e(function(){Is(i)&&a({inst:i})})},[e]),Ps(n),n}function Is(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!As(e,n)}catch{return!0}}function Ls(e,t){return t()}var Rs=typeof window>`u`||typeof window.document>`u`||typeof window.document.createElement>`u`?Ls:Fs;Ds.useSyncExternalStore=Os.useSyncExternalStore===void 0?Rs:Os.useSyncExternalStore,Es.exports=Ds;var zs=Es.exports,Bs=l.default,Vs=zs;function Hs(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var Us=typeof Object.is==`function`?Object.is:Hs,Ws=Vs.useSyncExternalStore,Gs=Bs.useRef,Ks=Bs.useEffect,qs=Bs.useMemo,Js=Bs.useDebugValue;Ts.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=Gs(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=qs(function(){function e(e){if(!a){if(a=!0,s=e,e=r(e),i!==void 0&&o.hasValue){var t=o.value;if(i(t,e))return c=t}return c=e}if(t=c,Us(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?t:(s=e,c=n)}var a=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var s=Ws(e,a[0],a[1]);return Ks(function(){o.hasValue=!0,o.value=s},[s]),Js(s),s},ws.exports=Ts;var Ys=ws.exports,Xs=Io(Ys),{useDebugValue:Zs}=l.default,{useSyncExternalStoreWithSelector:Qs}=Xs,$s=e=>e;function ec(e,t=$s,n){let r=Qs(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,n);return Zs(r),r}var tc=e=>{let t=typeof e==`function`?Cs(e):e,n=(e,n)=>ec(t,e,n);return Object.assign(n,t),n},nc=e=>e?tc(e):tc,rc=e=>(t,n,r)=>{let i=r.subscribe;return r.subscribe=(e,t,n)=>{let a=e;if(t){let i=n?.equalityFn||Object.is,o=e(r.getState());a=n=>{let r=e(n);if(!i(o,r)){let e=o;t(o=r,e)}},n!=null&&n.fireImmediately&&t(o,o)}return i(a)},e(t,n,r)},ic=Symbol.for(`immer-nothing`),ac=Symbol.for(`immer-draftable`),oc=Symbol.for(`immer-state`);function sc(e,...t){throw Error(`[Immer] minified error nr: ${e}. Full error at: https://bit.ly/3cXEKWf`)}var cc=Object.getPrototypeOf;function lc(e){return!!e&&!!e[oc]}function uc(e){var t;return e?fc(e)||Array.isArray(e)||!!e[ac]||!!((t=e.constructor)!=null&&t[ac])||vc(e)||yc(e):!1}var dc=Object.prototype.constructor.toString();function fc(e){if(!e||typeof e!=`object`)return!1;let t=cc(e);if(t===null)return!0;let n=Object.hasOwnProperty.call(t,`constructor`)&&t.constructor;return n===Object?!0:typeof n==`function`&&Function.toString.call(n)===dc}function pc(e,t){mc(e)===0?Reflect.ownKeys(e).forEach(n=>{t(n,e[n],e)}):e.forEach((n,r)=>t(r,n,e))}function mc(e){let t=e[oc];return t?t.type_:Array.isArray(e)?1:vc(e)?2:yc(e)?3:0}function hc(e,t){return mc(e)===2?e.has(t):Object.prototype.hasOwnProperty.call(e,t)}function gc(e,t,n){let r=mc(e);r===2?e.set(t,n):r===3?e.add(n):e[t]=n}function _c(e,t){return e===t?e!==0||1/e==1/t:e!==e&&t!==t}function vc(e){return e instanceof Map}function yc(e){return e instanceof Set}function bc(e){return e.copy_||e.base_}function xc(e,t){if(vc(e))return new Map(e);if(yc(e))return new Set(e);if(Array.isArray(e))return Array.prototype.slice.call(e);let n=fc(e);if(t===!0||t===`class_only`&&!n){let t=Object.getOwnPropertyDescriptors(e);delete t[oc];let n=Reflect.ownKeys(t);for(let r=0;r<n.length;r++){let i=n[r],a=t[i];a.writable===!1&&(a.writable=!0,a.configurable=!0),(a.get||a.set)&&(t[i]={configurable:!0,writable:!0,enumerable:a.enumerable,value:e[i]})}return Object.create(cc(e),t)}else{let t=cc(e);return t!==null&&n?{...e}:Object.assign(Object.create(t),e)}}function Sc(e,t=!1){return wc(e)||lc(e)||!uc(e)||(mc(e)>1&&(e.set=e.add=e.clear=e.delete=Cc),Object.freeze(e),t&&Object.entries(e).forEach(([e,t])=>Sc(t,!0))),e}function Cc(){sc(2)}function wc(e){return Object.isFrozen(e)}var Tc={};function Ec(e){let t=Tc[e];return t||sc(0,e),t}var Dc;function Oc(){return Dc}function kc(e,t){return{drafts_:[],parent_:e,immer_:t,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function Ac(e,t){t&&(Ec(`Patches`),e.patches_=[],e.inversePatches_=[],e.patchListener_=t)}function jc(e){Mc(e),e.drafts_.forEach(Pc),e.drafts_=null}function Mc(e){e===Dc&&(Dc=e.parent_)}function Nc(e){return Dc=kc(Dc,e)}function Pc(e){let t=e[oc];t.type_===0||t.type_===1?t.revoke_():t.revoked_=!0}function Fc(e,t){t.unfinalizedDrafts_=t.drafts_.length;let n=t.drafts_[0];return e!==void 0&&e!==n?(n[oc].modified_&&(jc(t),sc(4)),uc(e)&&(e=Ic(t,e),t.parent_||Rc(t,e)),t.patches_&&Ec(`Patches`).generateReplacementPatches_(n[oc].base_,e,t.patches_,t.inversePatches_)):e=Ic(t,n,[]),jc(t),t.patches_&&t.patchListener_(t.patches_,t.inversePatches_),e===ic?void 0:e}function Ic(e,t,n){if(wc(t))return t;let r=t[oc];if(!r)return pc(t,(i,a)=>Lc(e,r,t,i,a,n)),t;if(r.scope_!==e)return t;if(!r.modified_)return Rc(e,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;let t=r.copy_,i=t,a=!1;r.type_===3&&(i=new Set(t),t.clear(),a=!0),pc(i,(i,o)=>Lc(e,r,t,i,o,n,a)),Rc(e,t,!1),n&&e.patches_&&Ec(`Patches`).generatePatches_(r,n,e.patches_,e.inversePatches_)}return r.copy_}function Lc(e,t,n,r,i,a,o){if(lc(i)){let o=Ic(e,i,a&&t&&t.type_!==3&&!hc(t.assigned_,r)?a.concat(r):void 0);if(gc(n,r,o),lc(o))e.canAutoFreeze_=!1;else return}else o&&n.add(i);if(uc(i)&&!wc(i)){if(!e.immer_.autoFreeze_&&e.unfinalizedDrafts_<1)return;Ic(e,i),(!t||!t.scope_.parent_)&&typeof r!=`symbol`&&Object.prototype.propertyIsEnumerable.call(n,r)&&Rc(e,i)}}function Rc(e,t,n=!1){!e.parent_&&e.immer_.autoFreeze_&&e.canAutoFreeze_&&Sc(t,n)}function zc(e,t){let n=Array.isArray(e),r={type_:n?1:0,scope_:t?t.scope_:Oc(),modified_:!1,finalized_:!1,assigned_:{},parent_:t,base_:e,draft_:null,copy_:null,revoke_:null,isManual_:!1},i=r,a=Bc;n&&(i=[r],a=Vc);let{revoke:o,proxy:s}=Proxy.revocable(i,a);return r.draft_=s,r.revoke_=o,s}var Bc={get(e,t){if(t===oc)return e;let n=bc(e);if(!hc(n,t))return Uc(e,n,t);let r=n[t];return e.finalized_||!uc(r)?r:r===Hc(e.base_,t)?(Kc(e),e.copy_[t]=Jc(r,e)):r},has(e,t){return t in bc(e)},ownKeys(e){return Reflect.ownKeys(bc(e))},set(e,t,n){let r=Wc(bc(e),t);if(r!=null&&r.set)return r.set.call(e.draft_,n),!0;if(!e.modified_){let r=Hc(bc(e),t),i=r?.[oc];if(i&&i.base_===n)return e.copy_[t]=n,e.assigned_[t]=!1,!0;if(_c(n,r)&&(n!==void 0||hc(e.base_,t)))return!0;Kc(e),Gc(e)}return e.copy_[t]===n&&(n!==void 0||t in e.copy_)||Number.isNaN(n)&&Number.isNaN(e.copy_[t])||(e.copy_[t]=n,e.assigned_[t]=!0),!0},deleteProperty(e,t){return Hc(e.base_,t)!==void 0||t in e.base_?(e.assigned_[t]=!1,Kc(e),Gc(e)):delete e.assigned_[t],e.copy_&&delete e.copy_[t],!0},getOwnPropertyDescriptor(e,t){let n=bc(e),r=Reflect.getOwnPropertyDescriptor(n,t);return r&&{writable:!0,configurable:e.type_!==1||t!==`length`,enumerable:r.enumerable,value:n[t]}},defineProperty(){sc(11)},getPrototypeOf(e){return cc(e.base_)},setPrototypeOf(){sc(12)}},Vc={};pc(Bc,(e,t)=>{Vc[e]=function(){return arguments[0]=arguments[0][0],t.apply(this,arguments)}}),Vc.deleteProperty=function(e,t){return Vc.set.call(this,e,t,void 0)},Vc.set=function(e,t,n){return Bc.set.call(this,e[0],t,n,e[0])};function Hc(e,t){let n=e[oc];return(n?bc(n):e)[t]}function Uc(e,t,n){let r=Wc(t,n);return r?`value`in r?r.value:r.get?.call(e.draft_):void 0}function Wc(e,t){if(!(t in e))return;let n=cc(e);for(;n;){let e=Object.getOwnPropertyDescriptor(n,t);if(e)return e;n=cc(n)}}function Gc(e){e.modified_||(e.modified_=!0,e.parent_&&Gc(e.parent_))}function Kc(e){e.copy_||=xc(e.base_,e.scope_.immer_.useStrictShallowCopy_)}var qc=class{constructor(e){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,t,n)=>{if(typeof e==`function`&&typeof t!=`function`){let n=t;t=e;let r=this;return function(e=n,...i){return r.produce(e,e=>t.call(this,e,...i))}}typeof t!=`function`&&sc(6),n!==void 0&&typeof n!=`function`&&sc(7);let r;if(uc(e)){let i=Nc(this),a=Jc(e,void 0),o=!0;try{r=t(a),o=!1}finally{o?jc(i):Mc(i)}return Ac(i,n),Fc(r,i)}else if(!e||typeof e!=`object`){if(r=t(e),r===void 0&&(r=e),r===ic&&(r=void 0),this.autoFreeze_&&Sc(r,!0),n){let t=[],i=[];Ec(`Patches`).generateReplacementPatches_(e,r,t,i),n(t,i)}return r}else sc(1,e)},this.produceWithPatches=(e,t)=>{if(typeof e==`function`)return(t,...n)=>this.produceWithPatches(t,t=>e(t,...n));let n,r;return[this.produce(e,t,(e,t)=>{n=e,r=t}),n,r]},typeof e?.autoFreeze==`boolean`&&this.setAutoFreeze(e.autoFreeze),typeof e?.useStrictShallowCopy==`boolean`&&this.setUseStrictShallowCopy(e.useStrictShallowCopy)}createDraft(e){uc(e)||sc(8),lc(e)&&(e=Yc(e));let t=Nc(this),n=Jc(e,void 0);return n[oc].isManual_=!0,Mc(t),n}finishDraft(e,t){let n=e&&e[oc];(!n||!n.isManual_)&&sc(9);let{scope_:r}=n;return Ac(r,t),Fc(void 0,r)}setAutoFreeze(e){this.autoFreeze_=e}setUseStrictShallowCopy(e){this.useStrictShallowCopy_=e}applyPatches(e,t){let n;for(n=t.length-1;n>=0;n--){let r=t[n];if(r.path.length===0&&r.op===`replace`){e=r.value;break}}n>-1&&(t=t.slice(n+1));let r=Ec(`Patches`).applyPatches_;return lc(e)?r(e,t):this.produce(e,e=>r(e,t))}};function Jc(e,t){let n=vc(e)?Ec(`MapSet`).proxyMap_(e,t):yc(e)?Ec(`MapSet`).proxySet_(e,t):zc(e,t);return(t?t.scope_:Oc()).drafts_.push(n),n}function Yc(e){return lc(e)||sc(10,e),Xc(e)}function Xc(e){if(!uc(e)||wc(e))return e;let t=e[oc],n;if(t){if(!t.modified_)return t.base_;t.finalized_=!0,n=xc(e,t.scope_.immer_.useStrictShallowCopy_)}else n=xc(e,!0);return pc(n,(e,t)=>{gc(n,e,Xc(t))}),t&&(t.finalized_=!1),n}var Zc=new qc,Qc=Zc.produce;Zc.produceWithPatches.bind(Zc),Zc.setAutoFreeze.bind(Zc),Zc.setUseStrictShallowCopy.bind(Zc),Zc.applyPatches.bind(Zc),Zc.createDraft.bind(Zc),Zc.finishDraft.bind(Zc);var $c=function(e){return el(e)&&!tl(e)};function el(e){return!!e&&typeof e==`object`}function tl(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||rl(e)}var nl=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function rl(e){return e.$$typeof===nl}function il(e){return Array.isArray(e)?[]:{}}function al(e,t){return t.clone!==!1&&t.isMergeableObject(e)?pl(il(e),e,t):e}function ol(e,t,n){return e.concat(t).map(function(e){return al(e,n)})}function sl(e,t){if(!t.customMerge)return pl;var n=t.customMerge(e);return typeof n==`function`?n:pl}function cl(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function ll(e){return Object.keys(e).concat(cl(e))}function ul(e,t){try{return t in e}catch{return!1}}function dl(e,t){return ul(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function fl(e,t,n){var r={};return n.isMergeableObject(e)&&ll(e).forEach(function(t){r[t]=al(e[t],n)}),ll(t).forEach(function(i){dl(e,i)||(ul(e,i)&&n.isMergeableObject(t[i])?r[i]=sl(i,n)(e[i],t[i],n):r[i]=al(t[i],n))}),r}function pl(e,t,n){n||={},n.arrayMerge=n.arrayMerge||ol,n.isMergeableObject=n.isMergeableObject||$c,n.cloneUnlessOtherwiseSpecified=al;var r=Array.isArray(t);return r===Array.isArray(e)?r?n.arrayMerge(e,t,n):fl(e,t,n):al(t,n)}pl.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return pl(e,n,t)},{})};var ml=Io(pl);function hl(e){return e?e.charAt(0).toLowerCase()+e.slice(1):``}function gl(e,t){return _l(ml(t,e),e)}function _l(e,t){return Object.keys(e).forEach(n=>{if(n.startsWith(`replaceDefault`)&&e[n]){let r=hl(n.replace(`replaceDefault`,``)||`items`);e[r]=t?t[r]:[],delete e[n]}else typeof e[n]==`object`&&e[n]!==null&&_l(e[n],t?.[n])}),e}var vl=(e,t)=>({history:{...yl,updatePointerById:e=>{let n=t().history.items.findIndex(t=>t.id===e);t().history.update(n)},update:(t,n)=>{e(e=>{e.history.pointer=t,n&&(e.history.items=n),e.history.canUndo=e.history.pointer>0,e.history.canRedo=e.history.items.length>e.history.pointer+1})},reset:n=>{e({history:{...t().history,...n??yl}})}}}),yl={items:[],pointer:0,canUndo:!1,canRedo:!1},bl=(e=>(e.Filter=`filter`,e.Frame=`frame`,e.ActiveObject=`activeObj`,e.Text=`text`,e))(bl||{}),xl=(e,t)=>({filter:{...Sl,select(t,n=!1){e(e=>{e.filter.selected=t,e.activeToolOverlay=n?bl.Filter:null,e.dirty=!0})},deselect(n){t().filter.selected===n&&e(e=>{e.filter.selected=null,e.activeToolOverlay=null,e.dirty=!0})},reset(){e({filter:{...t().filter,...Sl}})}}}),Sl={selected:null,applied:[]},Cl=(e,t)=>({crop:{...wl,setCropzoneRect:t=>{e(e=>{e.crop.zoneRect=t})},setAspectRatio:t=>{e(e=>{e.crop.selectedAspectRatio=t})},setTransformAngle:t=>{e(e=>{e.crop.straightenAngle=t})},apply:async()=>{let e=t().crop.zoneRect;if(e){let n={width:Math.ceil(e.width/t().zoom),height:Math.ceil(e.height/t().zoom),left:Math.ceil(e.left/t().zoom),top:Math.ceil(e.top/t().zoom)};await t().editor.tools.crop.apply(n)}},reset:()=>{e({crop:{...t().crop,...wl}})}}}),wl={zoneRect:null,selectedAspectRatio:null,straightenAngle:0};function Tl(e){return e?.type===`i-text`}var El=(e=>(e.Text=`text`,e.Shape=`shape`,e.Sticker=`sticker`,e.Drawing=`drawing`,e.Image=`image`,e.MainImage=`mainImage`,e.StraightenAnchor=`straightenHelper`,e))(El||{}),Dl={text:{name:B(`Text`),icon:gs.text.icon},shape:{name:B(`Shape`),icon:gs.shapes.icon},sticker:{name:B(`Sticker`),icon:gs.stickers.icon},drawing:{name:B(`Drawing`),icon:gs.draw.icon},image:{name:B(`Image`),icon:gs.overlayImage.icon},mainImage:{name:B(`Background Image`),icon:gs.bgImage.icon}};function Ol(e){return e.name===El.Image}var kl={isMoving:!1,editableProps:{},id:null,isText:!1,isImage:!1,name:null};function Al(e){if(!e)return{};let t={fill:e.fill,opacity:e.opacity,backgroundColor:e.backgroundColor,stroke:e.stroke,strokeWidth:e.strokeWidth},n=e.shadow;return n&&(t.shadow={color:n.color,blur:n.blur,offsetX:n.offsetX,offsetY:n.offsetY}),Tl(e)&&(t.textAlign=e.textAlign,t.underline=e.underline,t.linethrough=e.linethrough,t.fontStyle=e.fontStyle,t.fontFamily=e.fontFamily,t.fontWeight=e.fontWeight,t.fontSize=e.fontSize),t}var jl=(e,t)=>({objects:{...Ml,setActiveIsMoving:t=>{e(e=>{e.objects.active.isMoving=t})},setIsEditingText:t=>{e(e=>{e.objects.isEditingText=t})},setActive:n=>{e(n?e=>{e.objects.active.editableProps=Al(n),e.objects.active.id=n.data.id,e.objects.active.name=n.name??null,e.objects.active.isText=Tl(n),e.objects.active.isImage=Ol(n)}:e=>{let n={...t().config.objectDefaults?.global,fontFamily:t().config.objectDefaults?.text?.fontFamily,fontSize:t().config.objectDefaults?.text?.fontSize};e.objects.active={...kl,editableProps:n}})},reset(){e({objects:{...t().objects,...Ml}})}}}),Ml={all:[],isEditingText:!1,active:kl},Nl=(e,t)=>({frame:{...Pl,select:n=>{e(e=>{e.frame.active=n}),t().frame.showOptionsPanel()},deselect:()=>{e(e=>{e.frame.active=null,e.activeToolOverlay=null})},showOptionsPanel:()=>{t().activeTool===V.FRAME&&e(e=>{e.activeToolOverlay=bl.Frame})},reset(){e({frame:{...t().frame,...Pl}})}}}),Pl={active:null},Fl=(e,t)=>({resize:{...Il,setFormValue:t=>{e(e=>{Object.entries(t).forEach(([t,n])=>{e.resize.formValue[t]=n})})},apply(){let e=t().resize.formValue,n=t().original;if(e.width===n.width&&e.height===n.height)return!1;t().editor.tools.resize.apply(e)},reset(){e({resize:{...t().resize,...Il}})}}}),Il={formValue:{width:1,height:1,maintainAspect:!0,usePercentages:!1}},Ll=(e,t)=>({corners:{...Rl,setRadius:t=>{e(e=>{e.corners.radius=t})},apply(){return t().editor.tools.corners.apply(t().corners.radius)},reset(){e({corners:{...t().corners,...Rl}})}}}),Rl={radius:50},zl=e=>(t,n,r)=>(r.setState=(e,n,...r)=>t(typeof e==`function`?Qc(e):e,n,...r),e(r.setState,n,r)),Bl={exports:{}},Vl={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},Hl={exports:{}},Ul=function(e){return!e||typeof e==`string`?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!==`String`)},Wl=Array.prototype.concat,Gl=Array.prototype.slice,Kl=Hl.exports=function(e){for(var t=[],n=0,r=e.length;n<r;n++){var i=e[n];Ul(i)?t=Wl.call(t,Gl.call(i)):t.push(i)}return t};Kl.wrap=function(e){return function(){return e(Kl(arguments))}};var ql=Hl.exports,Jl=Vl,Yl=ql,Xl=Object.hasOwnProperty,Zl=Object.create(null);for(var Ql in Jl)Xl.call(Jl,Ql)&&(Zl[Jl[Ql]]=Ql);var $l=Bl.exports={to:{},get:{}};$l.get=function(e){var t=e.substring(0,3).toLowerCase(),n,r;switch(t){case`hsl`:n=$l.get.hsl(e),r=`hsl`;break;case`hwb`:n=$l.get.hwb(e),r=`hwb`;break;default:n=$l.get.rgb(e),r=`rgb`;break}return n?{model:r,value:n}:null},$l.get.rgb=function(e){if(!e)return null;var t=/^#([a-f0-9]{3,4})$/i,n=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,r=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,i=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,a=/^(\w+)$/,o=[0,0,0,1],s,c,l;if(s=e.match(n)){for(l=s[2],s=s[1],c=0;c<3;c++){var u=c*2;o[c]=parseInt(s.slice(u,u+2),16)}l&&(o[3]=parseInt(l,16)/255)}else if(s=e.match(t)){for(s=s[1],l=s[3],c=0;c<3;c++)o[c]=parseInt(s[c]+s[c],16);l&&(o[3]=parseInt(l+l,16)/255)}else if(s=e.match(r)){for(c=0;c<3;c++)o[c]=parseInt(s[c+1],0);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else if(s=e.match(i)){for(c=0;c<3;c++)o[c]=Math.round(parseFloat(s[c+1])*2.55);s[4]&&(s[5]?o[3]=parseFloat(s[4])*.01:o[3]=parseFloat(s[4]))}else return(s=e.match(a))?s[1]===`transparent`?[0,0,0,0]:Xl.call(Jl,s[1])?(o=Jl[s[1]],o[3]=1,o):null:null;for(c=0;c<3;c++)o[c]=eu(o[c],0,255);return o[3]=eu(o[3],0,1),o},$l.get.hsl=function(e){if(!e)return null;var t=e.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,eu(parseFloat(t[2]),0,100),eu(parseFloat(t[3]),0,100),eu(isNaN(n)?1:n,0,1)]}return null},$l.get.hwb=function(e){if(!e)return null;var t=e.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);if(t){var n=parseFloat(t[4]);return[(parseFloat(t[1])%360+360)%360,eu(parseFloat(t[2]),0,100),eu(parseFloat(t[3]),0,100),eu(isNaN(n)?1:n,0,1)]}return null},$l.to.hex=function(){var e=Yl(arguments);return`#`+tu(e[0])+tu(e[1])+tu(e[2])+(e[3]<1?tu(Math.round(e[3]*255)):``)},$l.to.rgb=function(){var e=Yl(arguments);return e.length<4||e[3]===1?`rgb(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`)`:`rgba(`+Math.round(e[0])+`, `+Math.round(e[1])+`, `+Math.round(e[2])+`, `+e[3]+`)`},$l.to.rgb.percent=function(){var e=Yl(arguments),t=Math.round(e[0]/255*100),n=Math.round(e[1]/255*100),r=Math.round(e[2]/255*100);return e.length<4||e[3]===1?`rgb(`+t+`%, `+n+`%, `+r+`%)`:`rgba(`+t+`%, `+n+`%, `+r+`%, `+e[3]+`)`},$l.to.hsl=function(){var e=Yl(arguments);return e.length<4||e[3]===1?`hsl(`+e[0]+`, `+e[1]+`%, `+e[2]+`%)`:`hsla(`+e[0]+`, `+e[1]+`%, `+e[2]+`%, `+e[3]+`)`},$l.to.hwb=function(){var e=Yl(arguments),t=``;return e.length>=4&&e[3]!==1&&(t=`, `+e[3]),`hwb(`+e[0]+`, `+e[1]+`%, `+e[2]+`%`+t+`)`},$l.to.keyword=function(e){return Zl[e.slice(0,3)]};function eu(e,t,n){return Math.min(Math.max(t,e),n)}function tu(e){var t=Math.round(e).toString(16).toUpperCase();return t.length<2?`0`+t:t}var nu=Bl.exports,ru={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},iu={};for(let e of Object.keys(ru))iu[ru[e]]=e;var W={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},lch:{channels:3,labels:`lch`},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}},au=W;for(let e of Object.keys(W)){if(!(`channels`in W[e]))throw Error(`missing channels property: `+e);if(!(`labels`in W[e]))throw Error(`missing channel labels property: `+e);if(W[e].labels.length!==W[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=W[e];delete W[e].channels,delete W[e].labels,Object.defineProperty(W[e],`channels`,{value:t}),Object.defineProperty(W[e],`labels`,{value:n})}W.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;a===i?s=0:t===a?s=(n-r)/o:n===a?s=2+(r-t)/o:r===a&&(s=4+(t-n)/o),s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},W.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};return u===0?(i=0,a=0):(a=u/l,t=d(o),n=d(s),r=d(c),o===l?i=r-n:s===l?i=1/3+t-r:c===l&&(i=2/3+n-t),i<0?i+=1:i>1&&--i),[i*360,a*100,l*100]},W.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],i=W.rgb.hsl(e)[0],a=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[i,a*100,r*100]},W.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function ou(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}W.rgb.keyword=function(e){let t=iu[e];if(t)return t;let n=1/0,r;for(let t of Object.keys(ru)){let i=ru[t],a=ou(e,i);a<n&&(n=a,r=t)}return r},W.keyword.rgb=function(e){return ru[e]},W.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;let i=t*.4124+n*.3576+r*.1805,a=t*.2126+n*.7152+r*.0722,o=t*.0193+n*.1192+r*.9505;return[i*100,a*100,o*100]},W.rgb.lab=function(e){let t=W.rgb.xyz(e),n=t[0],r=t[1],i=t[2];return n/=95.047,r/=100,i/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,[116*r-16,500*(n-r),200*(r-i)]},W.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a,o;if(n===0)return o=r*255,[o,o,o];i=r<.5?r*(1+n):r+n-r*n;let s=2*r-i,c=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+(i-s)*6*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,c[e]=o*255;return c},W.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},W.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},W.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},W.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},W.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},W.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2406+n*-1.5372+r*-.4986,a=t*-.9689+n*1.8758+r*.0415,o=t*.0557+n*-.204+r*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]},W.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},W.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>.008856?s:(a-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},W.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},W.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},W.rgb.ansi16=function(e,t=null){let[n,r,i]=e,a=t===null?W.rgb.hsv(e)[2]:t;if(a=Math.round(a/50),a===0)return 30;let o=30+(Math.round(i/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return a===2&&(o+=60),o},W.hsv.ansi16=function(e){return W.rgb.ansi16(W.hsv.rgb(e),e[2])},W.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},W.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(~~(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},W.ansi256.rgb=function(e){if(e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},W.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.substring(t.length)+t},W.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=n.split(``).map(e=>e+e).join(``));let r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},W.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c;return s=o<1?a/(1-o):0,c=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,c/=6,c%=1,[c*360,o*100,s*100]},W.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},W.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},W.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},W.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},W.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},W.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},W.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},W.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},W.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},W.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},W.gray.hsl=function(e){return[0,0,e[0]]},W.gray.hsv=W.gray.hsl,W.gray.hwb=function(e){return[0,100,e[0]]},W.gray.cmyk=function(e){return[0,0,0,e[0]]},W.gray.lab=function(e){return[e[0],0,0]},W.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.substring(n.length)+n},W.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};var su=au;function cu(){let e={},t=Object.keys(su);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function lu(e){let t=cu(),n=[e];for(t[e].distance=0;n.length;){let e=n.pop(),r=Object.keys(su[e]);for(let i=r.length,a=0;a<i;a++){let i=r[a],o=t[i];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,n.unshift(i))}}return t}function uu(e,t){return function(n){return t(e(n))}}function du(e,t){let n=[t[e].parent,e],r=su[t[e].parent][e],i=t[e].parent;for(;t[i].parent;)n.unshift(t[i].parent),r=uu(su[t[i].parent][i],r),i=t[i].parent;return r.conversion=n,r}var fu=function(e){let t=lu(e),n={},r=Object.keys(t);for(let e=r.length,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=du(e,t))}return n},pu=au,mu=fu,hu={},gu=Object.keys(pu);function _u(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function vu(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let e=r.length,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}gu.forEach(e=>{hu[e]={},Object.defineProperty(hu[e],`channels`,{value:pu[e].channels}),Object.defineProperty(hu[e],`labels`,{value:pu[e].labels});let t=mu(e);Object.keys(t).forEach(n=>{let r=t[n];hu[e][n]=vu(r),hu[e][n].raw=_u(r)})});var yu=hu,bu=nu,xu=yu,Su=[`keyword`,`gray`,`hex`],Cu={};for(let e of Object.keys(xu))Cu[[...xu[e].labels].sort().join(``)]=e;var wu={};function Tu(e,t){if(!(this instanceof Tu))return new Tu(e,t);if(t&&t in Su&&(t=null),t&&!(t in xu))throw Error(`Unknown model: `+t);let n,r;if(e==null)this.model=`rgb`,this.color=[0,0,0],this.valpha=1;else if(e instanceof Tu)this.model=e.model,this.color=[...e.color],this.valpha=e.valpha;else if(typeof e==`string`){let t=bu.get(e);if(t===null)throw Error(`Unable to parse color from string: `+e);this.model=t.model,r=xu[this.model].channels,this.color=t.value.slice(0,r),this.valpha=typeof t.value[r]==`number`?t.value[r]:1}else if(e.length>0)this.model=t||`rgb`,r=xu[this.model].channels,this.color=ju(Array.prototype.slice.call(e,0,r),r),this.valpha=typeof e[r]==`number`?e[r]:1;else if(typeof e==`number`)this.model=`rgb`,this.color=[e>>16&255,e>>8&255,e&255],this.valpha=1;else{this.valpha=1;let t=Object.keys(e);`alpha`in e&&(t.splice(t.indexOf(`alpha`),1),this.valpha=typeof e.alpha==`number`?e.alpha:0);let r=t.sort().join(``);if(!(r in Cu))throw Error(`Unable to parse color from object: `+JSON.stringify(e));this.model=Cu[r];let{labels:i}=xu[this.model],a=[];for(n=0;n<i.length;n++)a.push(e[i[n]]);this.color=ju(a)}if(wu[this.model])for(r=xu[this.model].channels,n=0;n<r;n++){let e=wu[this.model][n];e&&(this.color[n]=e(this.color[n]))}this.valpha=Math.max(0,Math.min(1,this.valpha)),Object.freeze&&Object.freeze(this)}Tu.prototype={toString(){return this.string()},toJSON(){return this[this.model]()},string(e){let t=this.model in bu.to?this:this.rgb();t=t.round(typeof e==`number`?e:1);let n=t.valpha===1?t.color:[...t.color,this.valpha];return bu.to[t.model](n)},percentString(e){let t=this.rgb().round(typeof e==`number`?e:1),n=t.valpha===1?t.color:[...t.color,this.valpha];return bu.to.rgb.percent(n)},array(){return this.valpha===1?[...this.color]:[...this.color,this.valpha]},object(){let e={},{channels:t}=xu[this.model],{labels:n}=xu[this.model];for(let r=0;r<t;r++)e[n[r]]=this.color[r];return this.valpha!==1&&(e.alpha=this.valpha),e},unitArray(){let e=this.rgb().color;return e[0]/=255,e[1]/=255,e[2]/=255,this.valpha!==1&&e.push(this.valpha),e},unitObject(){let e=this.rgb().object();return e.r/=255,e.g/=255,e.b/=255,this.valpha!==1&&(e.alpha=this.valpha),e},round(e){return e=Math.max(e||0,0),new Tu([...this.color.map(Du(e)),this.valpha],this.model)},alpha(e){return e===void 0?this.valpha:new Tu([...this.color,Math.max(0,Math.min(1,e))],this.model)},red:Ou(`rgb`,0,ku(255)),green:Ou(`rgb`,1,ku(255)),blue:Ou(`rgb`,2,ku(255)),hue:Ou([`hsl`,`hsv`,`hsl`,`hwb`,`hcg`],0,e=>(e%360+360)%360),saturationl:Ou(`hsl`,1,ku(100)),lightness:Ou(`hsl`,2,ku(100)),saturationv:Ou(`hsv`,1,ku(100)),value:Ou(`hsv`,2,ku(100)),chroma:Ou(`hcg`,1,ku(100)),gray:Ou(`hcg`,2,ku(100)),white:Ou(`hwb`,1,ku(100)),wblack:Ou(`hwb`,2,ku(100)),cyan:Ou(`cmyk`,0,ku(100)),magenta:Ou(`cmyk`,1,ku(100)),yellow:Ou(`cmyk`,2,ku(100)),black:Ou(`cmyk`,3,ku(100)),x:Ou(`xyz`,0,ku(95.047)),y:Ou(`xyz`,1,ku(100)),z:Ou(`xyz`,2,ku(108.833)),l:Ou(`lab`,0,ku(100)),a:Ou(`lab`,1),b:Ou(`lab`,2),keyword(e){return e===void 0?xu[this.model].keyword(this.color):new Tu(e)},hex(e){return e===void 0?bu.to.hex(this.rgb().round().color):new Tu(e)},hexa(e){if(e!==void 0)return new Tu(e);let t=this.rgb().round().color,n=Math.round(this.valpha*255).toString(16).toUpperCase();return n.length===1&&(n=`0`+n),bu.to.hex(t)+n},rgbNumber(){let e=this.rgb().color;return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255},luminosity(){let e=this.rgb().color,t=[];for(let[n,r]of e.entries()){let e=r/255;t[n]=e<=.04045?e/12.92:((e+.055)/1.055)**2.4}return .2126*t[0]+.7152*t[1]+.0722*t[2]},contrast(e){let t=this.luminosity(),n=e.luminosity();return t>n?(t+.05)/(n+.05):(n+.05)/(t+.05)},level(e){let t=this.contrast(e);return t>=7?`AAA`:t>=4.5?`AA`:``},isDark(){let e=this.rgb().color;return(e[0]*2126+e[1]*7152+e[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let e=this.rgb();for(let t=0;t<3;t++)e.color[t]=255-e.color[t];return e},lighten(e){let t=this.hsl();return t.color[2]+=t.color[2]*e,t},darken(e){let t=this.hsl();return t.color[2]-=t.color[2]*e,t},saturate(e){let t=this.hsl();return t.color[1]+=t.color[1]*e,t},desaturate(e){let t=this.hsl();return t.color[1]-=t.color[1]*e,t},whiten(e){let t=this.hwb();return t.color[1]+=t.color[1]*e,t},blacken(e){let t=this.hwb();return t.color[2]+=t.color[2]*e,t},grayscale(){let e=this.rgb().color,t=e[0]*.3+e[1]*.59+e[2]*.11;return Tu.rgb(t,t,t)},fade(e){return this.alpha(this.valpha-this.valpha*e)},opaquer(e){return this.alpha(this.valpha+this.valpha*e)},rotate(e){let t=this.hsl(),n=t.color[0];return n=(n+e)%360,n=n<0?360+n:n,t.color[0]=n,t},mix(e,t){if(!e||!e.rgb)throw Error(`Argument to "mix" was not a Color instance, but rather an instance of `+typeof e);let n=e.rgb(),r=this.rgb(),i=t===void 0?.5:t,a=2*i-1,o=n.alpha()-r.alpha(),s=((a*o===-1?a:(a+o)/(1+a*o))+1)/2,c=1-s;return Tu.rgb(s*n.red()+c*r.red(),s*n.green()+c*r.green(),s*n.blue()+c*r.blue(),n.alpha()*i+r.alpha()*(1-i))}};for(let e of Object.keys(xu)){if(Su.includes(e))continue;let{channels:t}=xu[e];Tu.prototype[e]=function(...t){return this.model===e?new Tu(this):t.length>0?new Tu(t,e):new Tu([...Au(xu[this.model][e].raw(this.color)),this.valpha],e)},Tu[e]=function(...n){let r=n[0];return typeof r==`number`&&(r=ju(n,t)),new Tu(r,e)}}function Eu(e,t){return Number(e.toFixed(t))}function Du(e){return function(t){return Eu(t,e)}}function Ou(e,t,n){e=Array.isArray(e)?e:[e];for(let r of e)(wu[r]||(wu[r]=[]))[t]=n;return e=e[0],function(r){let i;return r===void 0?(i=this[e]().color[t],n&&(i=n(i)),i):(n&&(r=n(r)),i=this[e](),i.color[t]=r,i)}}function ku(e){return function(t){return Math.max(0,Math.min(e,t))}}function Au(e){return Array.isArray(e)?e:[e]}function ju(e,t){for(let n=0;n<t;n++)typeof e[n]!=`number`&&(e[n]=0);return e}var Mu=Io(Tu);function Nu(e){let t=e.isDark?Yo.find(e=>e.isDark):Yo.find(e=>!e.isDark),n={...t,...e,colors:{...t?.colors,...e.colors}},r=Object.entries(n.colors).map(([e,t])=>[e,Pu(t)]);return{id:n.name,name:n.name,values:Object.fromEntries(r),is_dark:n.isDark}}function Pu(e){return e.endsWith(`%`)||e.split(` `).length===3?e:Mu(e).rgb().array().slice(0,3).join(` `)}var Fu=typeof document<`u`?document.getElementById(`root`)??document.body:void 0,Iu=typeof document<`u`?document.documentElement:void 0;function Lu(e){Fu=e,Iu=e}function Ru(e,t){Iu?.style.setProperty(e,t)}function zu(e){Object.entries(e.values).forEach(([e,t])=>{Ru(e,t)}),e.is_dark?Iu.classList.add(`dark`):Iu.classList.remove(`dark`)}var Bu=nc()(e=>({data:typeof window<`u`&&window.bootstrapData?Uu(window.bootstrapData):null,setData:t=>{e({data:typeof t==`string`?Uu(t):t})},mergeData:t=>{e(e=>({data:{...e.data,...t}}))}})),Vu=()=>Bu.getState().data;Bu.getState().setData;var Hu=Bu.getState().mergeData;function Uu(e){return typeof e==`string`?JSON.parse(e):e}var Wu={top:0,right:0,bottom:0,left:0,width:0,height:0},G=nc()(rc(zl((e,t)=>({editor:null,fabric:null,config:xs,zoom:1,dirty:!1,original:{width:1,height:1},stageSize:Wu,canvasSize:Wu,canvasRef:null,activeTool:null,activeToolOverlay:null,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1},...vl(e,t),...jl(e,t),...xl(e,t),...Cl(e,t),...Nl(e,t),...Fl(e,t),...Ll(e,t),setZoom:t=>e(e=>{e.zoom=t}),setOriginal:(t,n)=>e(e=>{e.original={width:t,height:n}}),setDirty:t=>e(e=>{e.dirty=t}),toggleLoading:t=>e(e=>{e.loading=t}),setStageSize:t=>e(e=>{e.stageSize=t}),setCanvasSize:t=>e(e=>{e.canvasSize=t}),setActiveTool:(t,n)=>{e(e=>{e.activeTool=t,e.activeToolOverlay=n})},setConfig:n=>e(e=>{let r=gl(n,t().config);e.config=r;let i=r.activeLanguage||`en`,a=r.languages?.[i],o=(r.ui?.themes||[]).map(e=>Nu(e)),s=o.find(e=>e.id===r.ui?.activeTheme);s&&zu(s),Hu({i18n:{language:i,name:i,id:0,lines:a},themes:{all:o}})}),togglePanel:(t,n)=>e(e=>{e.openPanels[t]=n??!e.openPanels[t]}),applyChanges:async()=>{let n=t().activeTool;if(!n)return;let r=t()[n],i=await(r?.apply)?.call(r);e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),i!==!1&&t().editor.tools.history.addHistoryItem({name:n}),r?.reset()},cancelChanges:async()=>{let n=t().activeTool;if(!n)return;let r=t().dirty;e(e=>{e.dirty=!1,e.activeTool=null,e.activeToolOverlay=null}),r&&await t().editor.tools.history.reload(),t()[n]?.reset()},reset:()=>{t().editor.tools.transform.resetStraightenAnchor(),e({activeTool:null,activeToolOverlay:null,zoom:1,dirty:!1,loading:!1,openPanels:{newImage:!1,history:!1,objects:!1,export:!1}}),t().history.reset(),t().objects.reset(),t().filter.reset(),t().crop.reset(),t().frame.reset(),t().resize.reset(),t().corners.reset()}}))));function K(){return G.getState()}function q(){return K().editor.tools}function J(){return K().fabric}function Gu(e){var t,n,r,i;q().canvas.clear(),q().frame.remove();let a=!((t=K().config.ui)!=null&&t.visible);return K().setConfig({image:void 0,blankCanvasSize:void 0,...e}),K().reset(),(n=K().config.ui)!=null&&n.defaultTool&&K().setActiveTool(K().config.ui?.defaultTool,null),a&&((i=(r=K().config).onOpen)==null||i.call(r)),new Promise(e=>setTimeout(e))}async function Ku(e){return(await fetch(e)).json()}var qu={selectable:!1,evented:!1,lockMovementX:!0,lockMovementY:!0,lockRotation:!0,lockScalingX:!0,lockScalingY:!0,lockUniScaling:!0,hasControls:!1,hasBorders:!1,hasRotatingPoint:!1,strokeWidth:0};function Ju(e=[]){e=[...Object.keys(qu),`crossOrigin`,`name`,`displayName`,`data`,...e];let t=J().toJSON(e);return t.objects=t.objects.filter(e=>!e.data.pixieInternal).map(e=>(e.type===`image`&&K().config.crossOrigin&&(e.crossOrigin=`anonymous`),Tl(e)&&(e.selectable=!0,e.lockMovementX=!1,e.lockMovementY=!1,e.lockUniScaling=!1),{...e,data:e.data?{...e.data}:{}})),{canvas:t,editor:{frame:q().frame.active.config?{name:q().frame.active.config.name,sizePercent:q().frame.active.currentSizeInPercent}:null,zoom:K().zoom,activeObjectId:K().objects.active?.id||null},canvasWidth:K().original.width,canvasHeight:K().original.height}}function Yu(e=null){if(K().dirty)return;q().zoom.fitToScreen();let[t,n]=Xu(J().getActiveObject());e?K().setActiveTool(e,t===e?n:null):K().setActiveTool(t,n)}function Xu(e){switch(e?.name){case El.Text:return[V.TEXT,bl.Text];case El.Sticker:return[V.STICKERS,bl.ActiveObject];case El.Image:return[null,bl.ActiveObject];case El.Shape:return[V.SHAPES,bl.ActiveObject];default:return[null,null]}}var Zu=`/*! tailwindcss v3.3.2 | MIT License | https://tailwindcss.com*/.pi *,.pi :after,.pi :before{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity));border-style:solid;border-width:0;box-sizing:border-box}.pi :after,.pi :before{--tw-content:""}.pi hr{border-top-width:1px;color:inherit;height:0}.pi abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6{font-size:inherit;font-weight:inherit}.pi a{color:inherit;text-decoration:inherit}.pi b,.pi strong{font-weight:bolder}.pi code,.pi kbd,.pi pre,.pi samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}.pi small{font-size:80%}.pi sub,.pi sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}.pi sub{bottom:-.25em}.pi sup{top:-.5em}.pi table{border-collapse:collapse;border-color:inherit;text-indent:0}.pi button,.pi input,.pi optgroup,.pi select,.pi textarea{color:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;margin:0;padding:0}.pi button,.pi select{text-transform:none}.pi [type=button],.pi [type=reset],.pi [type=submit],.pi button{-webkit-appearance:button;background-color:transparent;background-image:none}.pi :-moz-focusring{outline:auto}.pi :-moz-ui-invalid{box-shadow:none}.pi progress{vertical-align:baseline}.pi ::-webkit-inner-spin-button,.pi ::-webkit-outer-spin-button{height:auto}.pi [type=search]{-webkit-appearance:textfield;outline-offset:-2px}.pi ::-webkit-search-decoration{-webkit-appearance:none}.pi ::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}.pi summary{display:list-item}.pi blockquote,.pi dd,.pi dl,.pi figure,.pi h1,.pi h2,.pi h3,.pi h4,.pi h5,.pi h6,.pi hr,.pi p,.pi pre{margin:0}.pi fieldset{margin:0;padding:0}.pi legend{padding:0}.pi menu,.pi ol,.pi ul{list-style:none;margin:0;padding:0}.pi textarea{resize:vertical}.pi input::-moz-placeholder,.pi textarea::-moz-placeholder{color:#9ca3af;opacity:1}.pi input::placeholder,.pi textarea::placeholder{color:#9ca3af;opacity:1}.pi [role=button],.pi button{cursor:pointer}.pi :disabled{cursor:default}.pi audio,.pi canvas,.pi embed,.pi iframe,.pi img,.pi object,.pi svg,.pi video{display:block;vertical-align:middle}.pi img,.pi video{height:auto;max-width:100%}.pi [hidden]{display:none}.pi *,.pi :after,.pi :before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi ::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(147,197,253,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.pi .\\!container{width:100%!important}.pi .container{width:100%}@media (min-width:640px){.pi .\\!container{max-width:640px!important}.pi .container{max-width:640px}}@media (min-width:768px){.pi .\\!container{max-width:768px!important}.pi .container{max-width:768px}}@media (min-width:1024px){.pi .\\!container{max-width:1024px!important}.pi .container{max-width:1024px}}@media (min-width:1280px){.pi .\\!container{max-width:1280px!important}.pi .container{max-width:1280px}}@media (min-width:1536px){.pi .\\!container{max-width:1536px!important}.pi .container{max-width:1536px}}.pi .sr-only{height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;clip:rect(0,0,0,0);border-width:0;white-space:nowrap}.pi .pointer-events-none{pointer-events:none}.pi .pointer-events-auto{pointer-events:auto}.pi .\\!visible{visibility:visible!important}.pi .visible{visibility:visible}.pi .invisible{visibility:hidden}.pi .collapse{visibility:collapse}.pi .static{position:static}.pi .fixed{position:fixed}.pi .absolute{position:absolute}.pi .relative{position:relative}.pi .inset-0{top:0;right:0;bottom:0;left:0}.pi .inset-x-0{left:0;right:0}.pi .-bottom-10{bottom:-10px}.pi .-bottom-20{bottom:-20px}.pi .-bottom-5{bottom:-5px}.pi .-left-5{left:-5px}.pi .-left-8{left:-8px}.pi .-left-80{left:-80px}.pi .-right-5{right:-5px}.pi .-top-144{top:-144px}.pi .-top-40{top:-40px}.pi .-top-5{top:-5px}.pi .bottom-0{bottom:0}.pi .bottom-20{bottom:20px}.pi .left-0{left:0}.pi .left-1\\/2{left:50%}.pi .left-20{left:20px}.pi .right-0{right:0}.pi .right-16{right:16px}.pi .right-2{right:2px}.pi .right-20{right:20px}.pi .right-4{right:4px}.pi .top-0{top:0}.pi .top-1\\/2{top:50%}.pi .top-2{top:2px}.pi .isolate{isolation:isolate}.pi .z-10{z-index:10}.pi .z-20{z-index:20}.pi .z-50{z-index:50}.pi .z-cropzone{z-index:10}.pi .z-loading-indicator{z-index:50}.pi .z-modal{z-index:110}.pi .z-navbar{z-index:40}.pi .z-obj-box{z-index:20}.pi .z-popover{z-index:130}.pi .z-toast{z-index:160}.pi .z-tool-overlay{z-index:30}.pi .z-tooltip{z-index:150}.pi .z-tray{z-index:120}.pi .m-auto{margin:auto}.pi .mx-20{margin-left:20px;margin-right:20px}.pi .mx-8{margin-left:8px;margin-right:8px}.pi .mx-auto{margin-left:auto;margin-right:auto}.pi .my-20{margin-bottom:20px;margin-top:20px}.pi .my-4{margin-bottom:4px;margin-top:4px}.pi .my-6{margin-bottom:6px;margin-top:6px}.pi .my-8{margin-bottom:8px;margin-top:8px}.pi .my-auto{margin-bottom:auto;margin-top:auto}.pi .-ml-1{margin-left:-1px}.pi .-ml-10{margin-left:-10px}.pi .-ml-12{margin-left:-12px}.pi .-ml-3{margin-left:-3px}.pi .-ml-4{margin-left:-4px}.pi .-ml-6{margin-left:-6px}.pi .-mr-4{margin-right:-4px}.pi .-mr-8{margin-right:-8px}.pi .mb-1{margin-bottom:1px}.pi .mb-10{margin-bottom:10px}.pi .mb-16{margin-bottom:16px}.pi .mb-2{margin-bottom:2px}.pi .mb-20{margin-bottom:20px}.pi .mb-24{margin-bottom:24px}.pi .mb-4{margin-bottom:4px}.pi .mb-6{margin-bottom:6px}.pi .mb-8{margin-bottom:8px}.pi .ml-10{margin-left:10px}.pi .ml-12{margin-left:12px}.pi .ml-4{margin-left:4px}.pi .ml-6{margin-left:6px}.pi .ml-8{margin-left:8px}.pi .ml-auto{margin-left:auto}.pi .mr-10{margin-right:10px}.pi .mr-16{margin-right:16px}.pi .mr-20{margin-right:20px}.pi .mr-4{margin-right:4px}.pi .mr-5{margin-right:5px}.pi .mr-6{margin-right:6px}.pi .mr-8{margin-right:8px}.pi .mr-auto{margin-right:auto}.pi .mt-0{margin-top:0}.pi .mt-10{margin-top:10px}.pi .mt-14{margin-top:14px}.pi .mt-20{margin-top:20px}.pi .mt-24{margin-top:24px}.pi .mt-4{margin-top:4px}.pi .mt-6{margin-top:6px}.pi .box-content{box-sizing:content-box}.pi .block{display:block}.pi .inline-block{display:inline-block}.pi .inline{display:inline}.pi .flex{display:flex}.pi .inline-flex{display:inline-flex}.pi .grid{display:grid}.pi .contents{display:contents}.pi .hidden{display:none}.pi .aspect-square{aspect-ratio:1/1}.pi .h-1{height:1px}.pi .h-12{height:12px}.pi .h-128{height:128px}.pi .h-14{height:14px}.pi .h-16{height:16px}.pi .h-18{height:18px}.pi .h-2{height:2px}.pi .h-2\\/4{height:50%}.pi .h-20{height:20px}.pi .h-22{height:22px}.pi .h-24{height:24px}.pi .h-26{height:26px}.pi .h-28{height:28px}.pi .h-3{height:3px}.pi .h-30{height:30px}.pi .h-32{height:32px}.pi .h-36{height:36px}.pi .h-38{height:2.375rem}.pi .h-4{height:4px}.pi .h-40{height:40px}.pi .h-42{height:42px}.pi .h-48{height:48px}.pi .h-50{height:50px}.pi .h-56{height:56px}.pi .h-6{height:6px}.pi .h-60{height:60px}.pi .h-64{height:64px}.pi .h-68{height:68px}.pi .h-8{height:8px}.pi .h-80{height:80px}.pi .h-84{height:84px}.pi .h-92{height:92px}.pi .h-\\[54px\\]{height:54px}.pi .h-font{height:1em}.pi .h-full{height:100%}.pi .h-px{height:1px}.pi .h-screen{height:100dvh}.pi .max-h-100{max-height:6.25rem}.pi .max-h-\\[calc\\(100\\%-40px\\)\\]{max-height:calc(100% - 40px)}.pi .max-h-\\[calc\\(100vh-90px\\)\\]{max-height:calc(100vh - 90px)}.pi .max-h-dialog{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .max-h-full{max-height:100%}.pi .max-h-inherit{max-height:inherit}.pi .max-h-tray{max-height:calc(var(--be-viewport-height, 100vh)*.9)}.pi .min-h-24{min-height:24px}.pi .min-h-30{min-height:30px}.pi .min-h-36{min-height:36px}.pi .min-h-42{min-height:42px}.pi .min-h-50{min-height:50px}.pi .min-h-60{min-height:60px}.pi .min-h-86{min-height:86px}.pi .\\!w-auto{width:auto!important}.pi .w-1\\/2{width:50%}.pi .w-110{width:110px}.pi .w-12{width:12px}.pi .w-1280{width:80rem}.pi .w-14{width:14px}.pi .w-144{width:144px}.pi .w-16{width:16px}.pi .w-18{width:18px}.pi .w-2{width:2px}.pi .w-20{width:20px}.pi .w-22{width:22px}.pi .w-224{width:224px}.pi .w-24{width:24px}.pi .w-256{width:256px}.pi .w-26{width:26px}.pi .w-28{width:28px}.pi .w-280{width:17.5rem}.pi .w-30{width:30px}.pi .w-32{width:32px}.pi .w-320{width:320px}.pi .w-36{width:36px}.pi .w-38{width:2.375rem}.pi .w-384{width:384px}.pi .w-40{width:40px}.pi .w-42{width:42px}.pi .w-440{width:27.5rem}.pi .w-46{width:2.875rem}.pi .w-50{width:50px}.pi .w-56{width:56px}.pi .w-60{width:60px}.pi .w-620{width:38.75rem}.pi .w-64{width:64px}.pi .w-68{width:68px}.pi .w-780{width:48.75rem}.pi .w-8{width:8px}.pi .w-80{width:80px}.pi .w-850{width:53.125rem}.pi .w-96{width:96px}.pi .w-\\[4ch\\]{width:4ch}.pi .w-auto{width:auto}.pi .w-font{width:1em}.pi .w-full{width:100%}.pi .w-max{width:-moz-max-content;width:max-content}.pi .w-min{width:-moz-min-content;width:min-content}.pi .w-px{width:1px}.pi .w-screen{width:100vw}.pi .min-w-0{min-width:0}.pi .min-w-128{min-width:128px}.pi .min-w-180{min-width:11.25rem}.pi .min-w-192{min-width:192px}.pi .min-w-288{min-width:288px}.pi .min-w-30{min-width:30px}.pi .min-w-4{min-width:4px}.pi .min-w-42{min-width:42px}.pi .min-w-92{min-width:92px}.pi .min-w-min{min-width:-moz-min-content;min-width:min-content}.pi .max-w-112{max-width:112px}.pi .max-w-240{max-width:240px}.pi .max-w-288{max-width:288px}.pi .max-w-320{max-width:320px}.pi .max-w-375{max-width:375px}.pi .max-w-500{max-width:31.25rem}.pi .max-w-\\[90\\%\\]{max-width:90%}.pi .max-w-\\[calc\\(100\\%-40px\\)\\]{max-width:calc(100% - 40px)}.pi .max-w-\\[calc\\(100vw-90px\\)\\]{max-width:calc(100vw - 90px)}.pi .max-w-dialog{max-width:calc(var(--be-viewport-width, 100vw)*.9)}.pi .max-w-full{max-width:100%}.pi .max-w-max{max-width:-moz-max-content;max-width:max-content}.pi .flex-\\[1_1_60px\\]{flex:1 1 60px}.pi .flex-auto{flex:1 1 auto}.pi .flex-shrink-0,.pi .shrink-0{flex-shrink:0}.pi .origin-\\[0_55\\%\\]{transform-origin:0 55%}.pi .origin-\\[100\\%\\]{transform-origin:100%}.pi .-translate-x-1\\/2{--tw-translate-x:-50%}.pi .-translate-x-1\\/2,.pi .-translate-y-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .-translate-y-1\\/2{--tw-translate-y:-50%}.pi .rotate-0{--tw-rotate:0deg}.pi .rotate-0,.pi .rotate-180{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-180{--tw-rotate:180deg}.pi .rotate-45{--tw-rotate:45deg}.pi .rotate-45,.pi .rotate-90{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .rotate-90{--tw-rotate:90deg}.pi .scale-y-\\[0\\.6\\]{--tw-scale-y:.6}.pi .scale-y-\\[0\\.6\\],.pi .transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .cursor-default{cursor:default}.pi .cursor-move{cursor:move}.pi .cursor-nesw-resize{cursor:nesw-resize}.pi .cursor-not-allowed{cursor:not-allowed}.pi .cursor-nwse-resize{cursor:nwse-resize}.pi .cursor-pointer{cursor:pointer}.pi .cursor-se-resize{cursor:se-resize}.pi .cursor-sw-resize{cursor:sw-resize}.pi .touch-none{touch-action:none}.pi .select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.pi .resize{resize:both}.pi .appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.pi .grid-cols-5-min-content{grid-template-columns:repeat(5,min-content)}.pi .flex-row{flex-direction:row}.pi .flex-col{flex-direction:column}.pi .flex-col-reverse{flex-direction:column-reverse}.pi .flex-wrap{flex-wrap:wrap}.pi .flex-nowrap{flex-wrap:nowrap}.pi .items-start{align-items:flex-start}.pi .items-end{align-items:flex-end}.pi .items-center{align-items:center}.pi .items-stretch{align-items:stretch}.pi .justify-start{justify-content:flex-start}.pi .justify-center{justify-content:center}.pi .justify-between{justify-content:space-between}.pi .gap-10{gap:10px}.pi .gap-14{gap:14px}.pi .gap-16{gap:16px}.pi .gap-18{gap:18px}.pi .gap-20{gap:20px}.pi .gap-36{gap:36px}.pi .gap-4{gap:4px}.pi .gap-40{gap:40px}.pi .gap-6{gap:6px}.pi .gap-8{gap:8px}.pi .space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(10px*var(--tw-space-y-reverse));margin-top:calc(10px*(1 - var(--tw-space-y-reverse)))}.pi .overflow-auto{overflow:auto}.pi .overflow-hidden{overflow:hidden}.pi .overflow-x-auto{overflow-x:auto}.pi .overflow-y-auto{overflow-y:auto}.pi .overflow-x-hidden{overflow-x:hidden}.pi .overflow-y-hidden{overflow-y:hidden}.pi .overscroll-contain{overscroll-behavior:contain}.pi .truncate{overflow:hidden;white-space:nowrap}.pi .overflow-ellipsis,.pi .text-ellipsis,.pi .truncate{text-overflow:ellipsis}.pi .whitespace-normal{white-space:normal}.pi .whitespace-nowrap{white-space:nowrap}.pi .break-words{overflow-wrap:break-word}.pi .rounded{border-radius:4px}.pi .rounded-2xl{border-radius:16px}.pi .rounded-3xl{border-radius:24px}.pi .rounded-button{border-radius:var(--be-button-radius,.25rem)}.pi .rounded-full{border-radius:9999px}.pi .rounded-input{border-radius:var(--be-input-radius,.25rem)}.pi .rounded-lg{border-radius:8px}.pi .rounded-md{border-radius:6px}.pi .rounded-none{border-radius:0}.pi .rounded-panel{border-radius:var(--be-panel-radius,.25rem)}.pi .rounded-xl{border-radius:12px}.pi .rounded-l{border-bottom-left-radius:4px;border-top-left-radius:4px}.pi .rounded-l-full{border-bottom-left-radius:9999px;border-top-left-radius:9999px}.pi .rounded-l-input{border-bottom-left-radius:var(--be-input-radius,.25rem);border-top-left-radius:var(--be-input-radius,.25rem)}.pi .rounded-l-none{border-bottom-left-radius:0;border-top-left-radius:0}.pi .rounded-r-full{border-bottom-right-radius:9999px;border-top-right-radius:9999px}.pi .rounded-r-input{border-bottom-right-radius:var(--be-input-radius,.25rem);border-top-right-radius:var(--be-input-radius,.25rem)}.pi .rounded-r-none{border-bottom-right-radius:0;border-top-right-radius:0}.pi .rounded-t{border-top-left-radius:4px;border-top-right-radius:4px}.pi .rounded-bl-none{border-bottom-left-radius:0}.pi .rounded-br-none{border-bottom-right-radius:0}.pi .rounded-tl-none{border-top-left-radius:0}.pi .rounded-tr-none{border-top-right-radius:0}.pi .border{border-width:1px}.pi .border-2{border-width:2px}.pi .border-4{border-width:4px}.pi .border-\\[3px\\]{border-width:3px}.pi .border-y{border-top-width:1px}.pi .border-b,.pi .border-y{border-bottom-width:1px}.pi .border-b-4{border-bottom-width:4px}.pi .border-l{border-left-width:1px}.pi .border-l-4{border-left-width:4px}.pi .border-r{border-right-width:1px}.pi .border-r-4{border-right-width:4px}.pi .border-t{border-top-width:1px}.pi .border-t-4{border-top-width:4px}.pi .border-dotted{border-style:dotted}.pi .border-none{border-style:none}.pi .border-background{--tw-border-opacity:1;border-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-bg-alt{--tw-border-opacity:1;border-color:rgb(var(--be-background-alt)/var(--tw-border-opacity))}.pi .border-chip{--tw-border-opacity:1;border-color:rgb(var(--be-background-chip)/var(--tw-border-opacity))}.pi .border-danger{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .border-danger\\/50{border-color:#ef444480}.pi .border-divider{border-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .border-paper{--tw-border-opacity:1;border-color:rgb(var(--be-paper)/var(--tw-border-opacity))}.pi .border-positive\\/50{border-color:#22c55e80}.pi .border-primary{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .border-primary\\/50{border-color:rgb(var(--be-primary)/.5)}.pi .border-text-muted{border-color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .border-transparent{border-color:transparent}.pi .border-white{--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .border-white\\/50{border-color:#ffffff80}.pi .border-b-bg{--tw-border-opacity:1;border-bottom-color:rgb(var(--be-background)/var(--tw-border-opacity))}.pi .border-b-transparent{border-bottom-color:transparent}.pi .border-r-transparent{border-right-color:transparent}.pi .bg{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-alt{--tw-bg-opacity:1;background-color:rgb(var(--be-background-alt)/var(--tw-bg-opacity))}.pi .bg-background{--tw-bg-opacity:1;background-color:rgb(var(--be-background)/var(--tw-bg-opacity))}.pi .bg-background\\/70{background-color:rgb(var(--be-background)/.7)}.pi .bg-background\\/80{background-color:rgb(var(--be-background)/.8)}.pi .bg-black\\/50{background-color:#00000080}.pi .bg-black\\/80{background-color:#000c}.pi .bg-chip{--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi .bg-controls{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-danger{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .bg-danger-lighter{--tw-bg-opacity:1;background-color:rgb(254 202 202/var(--tw-bg-opacity))}.pi .bg-divider{background-color:rgb(var(--be-foreground-base)/var(--be-divider-opacity))}.pi .bg-fg-base\\/4{background-color:rgb(var(--be-foreground-base)/4%)}.pi .bg-focus{background-color:rgb(var(--be-foreground-base)/var(--be-focus-opacity))}.pi .bg-inherit{background-color:inherit}.pi .bg-paper{--tw-bg-opacity:1;background-color:rgb(var(--be-paper)/var(--tw-bg-opacity))}.pi .bg-positive{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity))}.pi .bg-positive-lighter{--tw-bg-opacity:1;background-color:rgb(187 247 208/var(--tw-bg-opacity))}.pi .bg-primary{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .bg-primary-dark{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .bg-primary-light{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-light)/var(--tw-bg-opacity))}.pi .bg-primary\\/focus{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .bg-primary\\/selected{background-color:rgb(var(--be-primary)/var(--be-selected-opacity))}.pi .bg-slider-disabled{--tw-bg-opacity:1;background-color:rgb(189 189 189/var(--tw-bg-opacity))}.pi .bg-slider-disabled\\/60{background-color:#bdbdbd99}.pi .bg-toast{--tw-bg-opacity:1;background-color:rgb(50 50 50/var(--tw-bg-opacity))}.pi .bg-transparent{background-color:transparent}.pi .bg-warning{--tw-bg-opacity:1;background-color:rgb(243 164 50/var(--tw-bg-opacity))}.pi .bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .bg-white\\/50{background-color:#ffffff80}.pi .bg-opacity-95{--tw-bg-opacity:.95}.pi .bg-no-repeat{background-repeat:no-repeat}.pi .fill-current{fill:currentColor}.pi .fill-transparent{fill:transparent}.pi .stroke-current{stroke:currentColor}.pi .object-contain{-o-object-fit:contain;object-fit:contain}.pi .object-cover{-o-object-fit:cover;object-fit:cover}.pi .p-0{padding:0}.pi .p-10{padding:10px}.pi .p-14{padding:14px}.pi .p-16{padding:16px}.pi .p-18{padding:18px}.pi .p-2{padding:2px}.pi .p-20{padding:20px}.pi .p-4{padding:4px}.pi .p-40{padding:40px}.pi .p-6{padding:6px}.pi .p-8{padding:8px}.pi .px-10{padding-left:10px;padding-right:10px}.pi .px-12{padding-left:12px;padding-right:12px}.pi .px-14{padding-left:14px;padding-right:14px}.pi .px-16{padding-left:16px;padding-right:16px}.pi .px-18{padding-left:18px;padding-right:18px}.pi .px-20{padding-left:20px;padding-right:20px}.pi .px-22{padding-left:22px;padding-right:22px}.pi .px-24{padding-left:24px;padding-right:24px}.pi .px-26{padding-left:26px;padding-right:26px}.pi .px-32{padding-left:32px;padding-right:32px}.pi .px-4{padding-left:4px;padding-right:4px}.pi .px-5vw{padding-left:5vw;padding-right:5vw}.pi .px-6{padding-left:6px;padding-right:6px}.pi .px-8{padding-left:8px;padding-right:8px}.pi .py-10{padding-bottom:10px;padding-top:10px}.pi .py-12{padding-bottom:12px;padding-top:12px}.pi .py-14{padding-bottom:14px;padding-top:14px}.pi .py-2{padding-bottom:2px;padding-top:2px}.pi .py-20{padding-bottom:20px;padding-top:20px}.pi .py-3{padding-bottom:3px;padding-top:3px}.pi .py-4{padding-bottom:4px;padding-top:4px}.pi .py-5{padding-bottom:5px;padding-top:5px}.pi .py-6{padding-bottom:6px;padding-top:6px}.pi .py-8{padding-bottom:8px;padding-top:8px}.pi .py-\\[9px\\]{padding-bottom:9px;padding-top:9px}.pi .pb-10{padding-bottom:10px}.pi .pb-12{padding-bottom:12px}.pi .pb-14{padding-bottom:14px}.pi .pb-16{padding-bottom:16px}.pi .pb-18{padding-bottom:18px}.pi .pb-20{padding-bottom:20px}.pi .pb-4{padding-bottom:4px}.pi .pb-8{padding-bottom:8px}.pi .pb-safe-area{padding-bottom:env(safe-area-inset-bottom)}.pi .pl-10{padding-left:10px}.pi .pl-12{padding-left:12px}.pi .pl-14{padding-left:14px}.pi .pl-16{padding-left:16px}.pi .pl-18{padding-left:18px}.pi .pl-28{padding-left:28px}.pi .pl-46{padding-left:2.875rem}.pi .pl-54{padding-left:3.375rem}.pi .pl-8{padding-left:8px}.pi .pr-10{padding-right:10px}.pi .pr-12{padding-right:12px}.pi .pr-18{padding-right:18px}.pi .pr-24{padding-right:24px}.pi .pr-28{padding-right:28px}.pi .pr-46{padding-right:2.875rem}.pi .pr-54{padding-right:3.375rem}.pi .pr-6{padding-right:6px}.pi .pr-8{padding-right:8px}.pi .pt-10{padding-top:10px}.pi .pt-12{padding-top:12px}.pi .pt-14{padding-top:14px}.pi .pt-16{padding-top:16px}.pi .pt-20{padding-top:20px}.pi .pt-24{padding-top:24px}.pi .pt-4{padding-top:4px}.pi .pt-40{padding-top:40px}.pi .pt-6{padding-top:6px}.pi .text-left{text-align:left}.pi .text-center{text-align:center}.pi .text-right{text-align:right}.pi .align-middle{vertical-align:middle}.pi .text-base{font-size:16px;line-height:24px}.pi .text-lg{font-size:18px;line-height:28px}.pi .text-sm{font-size:14px;line-height:20px}.pi .text-xl{font-size:20px;line-height:28px}.pi .text-xs{font-size:12px;line-height:16px}.pi .font-bold{font-weight:700}.pi .font-medium{font-weight:500}.pi .font-semibold{font-weight:600}.pi .uppercase{text-transform:uppercase}.pi .capitalize{text-transform:capitalize}.pi .italic{font-style:italic}.pi .tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.pi .leading-5{line-height:1.25rem}.pi .leading-none{line-height:1}.pi .tracking-wide{letter-spacing:.025em}.pi .\\!text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))!important}.pi .text{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity))}.pi .text-black\\/30{color:#0000004d}.pi .text-danger{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.pi .text-danger-darker{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity))}.pi .text-disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .text-link{--tw-text-opacity:1;color:rgb(var(--be-link-color,var(--be-primary))/var(--tw-text-opacity))}.pi .text-main{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .text-muted{color:rgb(var(--be-foreground-base)/var(--be-text-muted-opacity))}.pi .text-on-primary{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .text-positive{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity))}.pi .text-positive-darker{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity))}.pi .text-primary{--tw-text-opacity:1;color:rgb(var(--be-primary)/var(--tw-text-opacity))}.pi .text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.pi .underline{text-decoration-line:underline}.pi .no-underline{text-decoration-line:none}.pi .caret-transparent{caret-color:transparent}.pi .opacity-0{opacity:0}.pi .opacity-100{opacity:1}.pi .opacity-70{opacity:.7}.pi .opacity-80{opacity:.8}.pi .opacity-90{opacity:.9}.pi .shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.pi .shadow,.pi .shadow-2xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-2xl{--tw-shadow:0 25px 50px -12px rgba(0,0,0,.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color)}.pi .shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.pi .shadow-lg,.pi .shadow-md{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.pi .shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.pi .shadow-sm,.pi .shadow-xl{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .shadow-xl{--tw-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.1);--tw-shadow-colored:0 20px 25px -5px var(--tw-shadow-color),0 8px 10px -6px var(--tw-shadow-color)}.pi .outline-none{outline:2px solid transparent;outline-offset:2px}.pi .outline{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .ring{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .ring-inset{--tw-ring-inset:inset}.pi .blur{--tw-blur:blur(8px)}.pi .blur,.pi .grayscale{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .grayscale{--tw-grayscale:grayscale(100%)}.pi .invert{--tw-invert:invert(100%)}.pi .invert,.pi .sepia{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .sepia{--tw-sepia:sepia(100%)}.pi .filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.pi .backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.pi .transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-button{transition-duration:.15s;transition-property:background-color,box-shadow,border-color,color;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-shadow{transition-duration:.15s;transition-property:box-shadow;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-transform{transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .transition-width{transition-duration:.15s;transition-property:width;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .duration-100{transition-duration:.1s}.pi .duration-200{transition-duration:.2s}.pi .will-change-transform{will-change:transform}.pi .icon-2xs{font-size:.75rem}.pi .icon-xs{font-size:1rem}.pi .icon-sm{font-size:1.25rem}.pi .icon-md{font-size:1.5rem}.pi .icon-lg{font-size:2.1875rem}.pi .icon-xl{font-size:2.6875rem}.pi .no-tap-highlight{-webkit-tap-highlight-color:transparent}@media only screen and (min-device-width:768px){.pi .tiny-scrollbar{scrollbar-color:rgba(0,0,0,.2) transparent;scrollbar-width:thin}.pi .tiny-scrollbar::-webkit-scrollbar{background-color:transparent;height:6px;width:6px}.pi .tiny-scrollbar::-webkit-scrollbar-thumb{background-color:rgb(var(--be-foreground-base)/.2);border-radius:10px}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:start{background:transparent}.pi .tiny-scrollbar::-webkit-scrollbar-track-piece:end{background:transparent}}.pi .hide-scrollbar{-ms-overflow-style:none;scrollbar-width:none}.pi .hide-scrollbar::-webkit-scrollbar{background:transparent;display:none;height:0;width:0}.pi .svg-icon{display:inline-block;flex-shrink:0;-webkit-user-select:none;-moz-user-select:none;user-select:none;fill:currentColor;transition-duration:.15s;transition-property:transform,fill;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .cropzone:not(.moving) .cropzone-transition{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .first-letter\\:capitalize:first-letter{text-transform:capitalize}.pi .file\\:mr-10::file-selector-button{margin-right:10px}.pi .file\\:h-24::file-selector-button{height:24px}.pi .file\\:rounded::file-selector-button{border-radius:4px}.pi .file\\:border-none::file-selector-button{border-style:none}.pi .file\\:bg-primary::file-selector-button{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .file\\:px-10::file-selector-button{padding-left:10px;padding-right:10px}.pi .file\\:text-sm::file-selector-button{font-size:14px;line-height:20px}.pi .file\\:font-semibold::file-selector-button{font-weight:600}.pi .file\\:text-on-primary::file-selector-button{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .before\\:z-10:before{content:var(--tw-content);z-index:10}.pi .before\\:block:before{content:var(--tw-content);display:block}.pi .before\\:h-12:before{content:var(--tw-content);height:12px}.pi .before\\:h-14:before{content:var(--tw-content);height:14px}.pi .before\\:h-18:before{content:var(--tw-content);height:18px}.pi .before\\:h-22:before{content:var(--tw-content);height:22px}.pi .before\\:h-28:before{content:var(--tw-content);height:28px}.pi .before\\:h-full:before{content:var(--tw-content);height:100%}.pi .before\\:w-12:before{content:var(--tw-content);width:12px}.pi .before\\:w-14:before{content:var(--tw-content);width:14px}.pi .before\\:w-18:before{content:var(--tw-content);width:18px}.pi .before\\:w-22:before{content:var(--tw-content);width:22px}.pi .before\\:w-28:before{content:var(--tw-content);width:28px}.pi .before\\:w-full:before{content:var(--tw-content);width:100%}.pi .before\\:translate-x-2:before{--tw-translate-x:2px}.pi .before\\:scale-10:before,.pi .before\\:translate-x-2:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .before\\:scale-10:before{--tw-scale-x:.1;--tw-scale-y:.1}.pi .before\\:rounded-3xl:before{border-radius:24px;content:var(--tw-content)}.pi .before\\:rounded-full:before{border-radius:9999px;content:var(--tw-content)}.pi .before\\:border:before{border-width:1px;content:var(--tw-content)}.pi .before\\:bg-primary:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .before\\:bg-white:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .before\\:opacity-0:before{content:var(--tw-content);opacity:0}.pi .before\\:transition:before{content:var(--tw-content);transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:transition-transform:before{content:var(--tw-content);transition-duration:.15s;transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1)}.pi .before\\:duration-200:before{content:var(--tw-content);transition-duration:.2s}.pi .after\\:pointer-events-none:after{content:var(--tw-content);pointer-events:none}.pi .after\\:absolute:after{content:var(--tw-content);position:absolute}.pi .after\\:inset-0:after{content:var(--tw-content);top:0;right:0;bottom:0;left:0}.pi .checked\\:border-danger:checked{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .checked\\:border-primary:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .checked\\:bg-danger:checked{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity))}.pi .checked\\:bg-primary:checked{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .checked\\:before\\:translate-x-14:checked:before{--tw-translate-x:14px}.pi .checked\\:before\\:translate-x-14:checked:before,.pi .checked\\:before\\:translate-x-20:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-20:checked:before{--tw-translate-x:20px}.pi .checked\\:before\\:translate-x-24:checked:before{--tw-translate-x:24px}.pi .checked\\:before\\:translate-x-24:checked:before,.pi .checked\\:before\\:translate-x-30:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:translate-x-30:checked:before{--tw-translate-x:30px}.pi .checked\\:before\\:translate-x-36:checked:before{--tw-translate-x:36px}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before,.pi .checked\\:before\\:translate-x-36:checked:before{content:var(--tw-content);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .checked\\:before\\:scale-\\[\\.65\\]:checked:before{--tw-scale-x:.65;--tw-scale-y:.65}.pi .checked\\:before\\:border-white:checked:before{content:var(--tw-content);--tw-border-opacity:1;border-color:rgb(255 255 255/var(--tw-border-opacity))}.pi .checked\\:before\\:opacity-100:checked:before{content:var(--tw-content);opacity:1}.pi .focus-within\\:border-primary\\/60:focus-within{border-color:rgb(var(--be-primary)/.6)}.pi .focus-within\\:ring:focus-within{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-within\\:ring-primary\\/focus:focus-within{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:scale-110:hover{--tw-scale-x:1.1;--tw-scale-y:1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.pi .hover\\:border-chip\\/90:hover{border-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:border-danger:hover{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity))}.pi .hover\\:border-danger\\/90:hover{border-color:#ef4444e6}.pi .hover\\:border-paper\\/90:hover{border-color:rgb(var(--be-paper)/.9)}.pi .hover\\:border-positive:hover{--tw-border-opacity:1;border-color:rgb(34 197 94/var(--tw-border-opacity))}.pi .hover\\:border-primary:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary)/var(--tw-border-opacity))}.pi .hover\\:border-primary-dark:hover{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .hover\\:bg-chip\\/90:hover{background-color:rgb(var(--be-background-chip)/.9)}.pi .hover\\:bg-danger\\/4:hover{background-color:#ef44440a}.pi .hover\\:bg-danger\\/90:hover{background-color:#ef4444e6}.pi .hover\\:bg-fg-base\\/15:hover{background-color:rgb(var(--be-foreground-base)/15%)}.pi .hover\\:bg-hover:hover{background-color:rgb(var(--be-foreground-base)/var(--be-hover-opacity))}.pi .hover\\:bg-paper\\/90:hover{background-color:rgb(var(--be-paper)/.9)}.pi .hover\\:bg-positive\\/4:hover{background-color:#22c55e0a}.pi .hover\\:bg-primary-dark:hover{--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:bg-primary\\/4:hover{background-color:rgb(var(--be-primary)/4%)}.pi .hover\\:bg-primary\\/focus:hover{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .hover\\:bg-primary\\/hover:hover{background-color:rgb(var(--be-primary)/var(--be-hover-opacity))}.pi .hover\\:bg-white:hover{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.pi .hover\\:bg-white\\/20:hover{background-color:#fff3}.pi .hover\\:bg-white\\/hover:hover{background-color:rgb(255 255 255/var(--be-hover-opacity))}.pi .hover\\:text-main:hover{color:rgb(var(--be-foreground-base)/var(--be-text-main-opacity))}.pi .hover\\:text-primary-dark:hover{--tw-text-opacity:1;color:rgb(var(--be-primary-dark)/var(--tw-text-opacity))}.pi .hover\\:underline:hover{text-decoration-line:underline}.pi .hover\\:shadow-md:hover{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .before\\:hover\\:bg-primary-dark:hover:before{content:var(--tw-content);--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}.pi .hover\\:after\\:bg-black\\/5:hover:after{background-color:#0000000d;content:var(--tw-content)}.pi .checked\\:hover\\:border-primary-dark:hover:checked{--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi .focus\\:border-danger\\/60:focus{border-color:#ef444499}.pi .focus\\:border-primary\\/60:focus{border-color:rgb(var(--be-primary)/.6)}.pi .focus\\:bg-primary:focus{--tw-bg-opacity:1;background-color:rgb(var(--be-primary)/var(--tw-bg-opacity))}.pi .focus\\:text-on-primary:focus{--tw-text-opacity:1;color:rgb(var(--be-on-primary)/var(--tw-text-opacity))}.pi .focus\\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.pi .focus\\:ring:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus\\:ring-danger\\/focus:focus{--tw-ring-color:rgb(239 68 68/var(--be-focus-opacity))}.pi .focus\\:ring-primary\\/focus:focus{--tw-ring-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus\\:after\\:bg-black\\/10:focus:after{background-color:#0000001a;content:var(--tw-content)}.pi .focus-visible\\:bg-primary\\/focus:focus-visible{background-color:rgb(var(--be-primary)/var(--be-focus-opacity))}.pi .focus-visible\\:outline:focus-visible{outline-color:rgb(var(--be-primary-lighter)/1);outline-style:solid;outline-width:2px}.pi .focus-visible\\:outline-primary-light:focus-visible{outline-color:rgb(var(--be-primary-light)/1)}.pi .focus-visible\\:ring:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .focus-visible\\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.pi .disabled\\:pointer-events-none:disabled{pointer-events:none}.pi .disabled\\:cursor-default:disabled{cursor:default}.pi .disabled\\:border-disabled-bg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:border-disabled-fg:disabled{border-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:border-transparent:disabled{border-color:transparent}.pi .disabled\\:border-white\\/70:disabled{border-color:#ffffffb3}.pi .disabled\\:border-r-transparent:disabled{border-right-color:transparent}.pi .disabled\\:bg-disabled:disabled{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-bg-opacity))}.pi .disabled\\:bg-transparent:disabled{background-color:transparent}.pi .disabled\\:text-disabled:disabled{color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity))}.pi .disabled\\:text-white\\/70:disabled{color:#ffffffb3}.pi .disabled\\:shadow-none:disabled{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.pi .disabled\\:before\\:bg-disabled-fg:disabled:before{background-color:rgb(var(--be-foreground-base)/var(--be-disabled-fg-opacity));content:var(--tw-content)}.pi :is(.dark .dark\\:bg-chip){--tw-bg-opacity:1;background-color:rgb(var(--be-background-chip)/var(--tw-bg-opacity))}.pi :is(.dark .dark\\:text-white\\/50){color:#ffffff80}.pi :is(.dark .dark\\:checked\\:border-primary-dark:checked){--tw-border-opacity:1;border-color:rgb(var(--be-primary-dark)/var(--tw-border-opacity))}.pi :is(.dark .dark\\:checked\\:bg-primary-dark:checked){--tw-bg-opacity:1;background-color:rgb(var(--be-primary-dark)/var(--tw-bg-opacity))}@media (min-width:640px){.pi .sm\\:text-sm{font-size:14px;line-height:20px}}@media (min-width:768px){.pi .md\\:text-lg{font-size:18px;line-height:28px}}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-2:focus-visible>.tree-label{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.pi .\\[\\&\\>\\.tree-label\\]\\:focus-visible\\:ring-inset:focus-visible>.tree-label{--tw-ring-inset:inset}
|
|
20
|
+
`,Qu=`useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict`,$u=(e=21)=>{let t=``,n=crypto.getRandomValues(new Uint8Array(e));for(;e--;)t+=Qu[n[e]&63];return t},ed=class{constructor(e,t){y(this,`timerId`),y(this,`createdAt`,0),this.callback=e,this.remaining=t,this.resume()}pause(){clearTimeout(this.timerId),this.remaining-=Date.now()-this.createdAt}resume(){this.createdAt=Date.now(),this.timerId&&clearTimeout(this.timerId),this.timerId=setTimeout(this.callback,this.remaining)}clear(){clearTimeout(this.timerId)}},td=1;function nd(e){switch(e){case`danger`:return 8e3;case`loading`:return 0;default:return 3e3}}var rd=nc()(zl((e,t)=>({toasts:[],add:(n,r)=>{let i=t().toasts.length+1-td;i>0&&e(e=>{e.toasts.splice(0,i)});let a=r?.id||$u(6),o=r?.type||`positive`,s=r?.duration??nd(o),c={timer:s>0?new ed(()=>t().remove(a),s):null,message:n,...r,id:a,type:o,position:r?.position||`bottom-center`,duration:s,disableExitAnimation:r?.disableExitAnimation,disableEnterAnimation:r?.disableEnterAnimation},l=t().toasts.findIndex(e=>e.id===c.id);e(l>-1?e=>{e.toasts[l]=c}:e=>{e.toasts.push(c)})},remove:n=>{let r=t().toasts.filter(e=>{var t;return n===e.id?((t=e.timer)==null||t.clear(),!1):!0});e(e=>{e.toasts=r})}})));function id(){return rd.getState()}function ad(e,t){id().add(e,t)}ad.danger=(e,t)=>{id().add(e,{...t,type:`danger`})},ad.positive=(e,t)=>{id().add(e,{...t,type:`positive`})},ad.loading=(e,t)=>{id().add(e,{...t,type:`loading`})};var od=(0,l.createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:`never`}),sd=(0,l.createContext)({}),cd=(0,l.createContext)(null),ld=typeof document<`u`,ud=ld?l.useLayoutEffect:l.useEffect,dd=(0,l.createContext)({strict:!1}),fd=e=>e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase(),pd=`data-`+fd(`framerAppearId`);function md(e,t,n,r){let{visualElement:i}=(0,l.useContext)(sd),a=(0,l.useContext)(dd),o=(0,l.useContext)(cd),s=(0,l.useContext)(od).reducedMotion,c=(0,l.useRef)();r||=a.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:i,props:n,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:s}));let u=c.current;(0,l.useInsertionEffect)(()=>{u&&u.update(n,o)});let d=(0,l.useRef)(!!(n[pd]&&!window.HandoffComplete));return ud(()=>{u&&(u.render(),d.current&&u.animationState&&u.animationState.animateChanges())}),(0,l.useEffect)(()=>{u&&(u.updateFeatures(),!d.current&&u.animationState&&u.animationState.animateChanges(),d.current&&(d.current=!1,window.HandoffComplete=!0))}),u}function hd(e){return e&&typeof e==`object`&&Object.prototype.hasOwnProperty.call(e,`current`)}function gd(e,t,n){return(0,l.useCallback)(r=>{r&&e.mount&&e.mount(r),t&&(r?t.mount(r):t.unmount()),n&&(typeof n==`function`?n(r):hd(n)&&(n.current=r))},[t])}function _d(e){return typeof e==`string`||Array.isArray(e)}function vd(e){return typeof e==`object`&&!!e&&typeof e.start==`function`}var yd=[`animate`,`whileInView`,`whileFocus`,`whileHover`,`whileTap`,`whileDrag`,`exit`],bd=[`initial`,...yd];function xd(e){return vd(e.animate)||bd.some(t=>_d(e[t]))}function Sd(e){return!!(xd(e)||e.variants)}function Cd(e,t){if(xd(e)){let{initial:t,animate:n}=e;return{initial:t===!1||_d(t)?t:void 0,animate:_d(n)?n:void 0}}return e.inherit===!1?{}:t}function wd(e){let{initial:t,animate:n}=Cd(e,(0,l.useContext)(sd));return(0,l.useMemo)(()=>({initial:t,animate:n}),[Td(t),Td(n)])}function Td(e){return Array.isArray(e)?e.join(` `):e}var Ed={animation:[`animate`,`variants`,`whileHover`,`whileTap`,`exit`,`whileInView`,`whileFocus`,`whileDrag`],exit:[`exit`],drag:[`drag`,`dragControls`],focus:[`whileFocus`],hover:[`whileHover`,`onHoverStart`,`onHoverEnd`],tap:[`whileTap`,`onTap`,`onTapStart`,`onTapCancel`],pan:[`onPan`,`onPanStart`,`onPanSessionStart`,`onPanEnd`],inView:[`whileInView`,`onViewportEnter`,`onViewportLeave`],layout:[`layout`,`layoutId`]},Dd={};for(let e in Ed)Dd[e]={isEnabled:t=>Ed[e].some(e=>!!t[e])};function Od(e){for(let t in e)Dd[t]={...Dd[t],...e[t]}}var kd=(0,l.createContext)({}),Ad=(0,l.createContext)({}),jd=Symbol.for(`motionComponentSymbol`);function Md({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){e&&Od(e);function a(a,o){let s,c={...(0,l.useContext)(od),...a,layoutId:Nd(a)},{isStatic:u}=c,d=wd(a),f=r(a,u);if(!u&&ld){d.visualElement=md(i,f,c,t);let n=(0,l.useContext)(Ad),r=(0,l.useContext)(dd).strict;d.visualElement&&(s=d.visualElement.loadFeatures(c,r,e,n))}return l.createElement(sd.Provider,{value:d},s&&d.visualElement?l.createElement(s,{visualElement:d.visualElement,...c}):null,n(i,a,gd(f,d.visualElement,o),f,u,d.visualElement))}let o=(0,l.forwardRef)(a);return o[jd]=i,o}function Nd({layoutId:e}){let t=(0,l.useContext)(kd).id;return t&&e!==void 0?t+`-`+e:e}function Pd(e){function t(t,n={}){return Md(e(t,n))}if(typeof Proxy>`u`)return t;let n=new Map;return new Proxy(t,{get:(e,r)=>(n.has(r)||n.set(r,t(r)),n.get(r))})}var Fd=[`animate`,`circle`,`defs`,`desc`,`ellipse`,`g`,`image`,`line`,`filter`,`marker`,`mask`,`metadata`,`path`,`pattern`,`polygon`,`polyline`,`rect`,`stop`,`switch`,`symbol`,`svg`,`text`,`tspan`,`use`,`view`];function Id(e){return typeof e!=`string`||e.includes(`-`)?!1:!!(Fd.indexOf(e)>-1||/[A-Z]/.test(e))}var Ld={},Rd=[`transformPerspective`,`x`,`y`,`z`,`translateX`,`translateY`,`translateZ`,`scale`,`scaleX`,`scaleY`,`rotate`,`rotateX`,`rotateY`,`rotateZ`,`skew`,`skewX`,`skewY`],zd=new Set(Rd);function Bd(e,{layout:t,layoutId:n}){return zd.has(e)||e.startsWith(`origin`)||(t||n!==void 0)&&(!!Ld[e]||e===`opacity`)}var Vd=e=>!!(e&&e.getVelocity),Hd={x:`translateX`,y:`translateY`,z:`translateZ`,transformPerspective:`perspective`},Ud=Rd.length;function Wd(e,{enableHardwareAcceleration:t=!0,allowTransformNone:n=!0},r,i){let a=``;for(let t=0;t<Ud;t++){let n=Rd[t];if(e[n]!==void 0){let t=Hd[n]||n;a+=`${t}(${e[n]}) `}}return t&&!e.z&&(a+=`translateZ(0)`),a=a.trim(),i?a=i(e,r?``:a):n&&r&&(a=`none`),a}var Gd=e=>t=>typeof t==`string`&&t.startsWith(e),Kd=Gd(`--`),qd=Gd(`var(--`),Jd=/var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g,Yd=(e,t)=>t&&typeof e==`number`?t.transform(e):e,Xd=(e,t,n)=>Math.min(Math.max(n,e),t),Zd={test:e=>typeof e==`number`,parse:parseFloat,transform:e=>e},Qd={...Zd,transform:e=>Xd(0,1,e)},$d={...Zd,default:1},ef=e=>Math.round(e*1e5)/1e5,tf=/(-)?([\d]*\.?[\d])+/g,nf=/(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))/gi,rf=/^(#[0-9a-f]{3,8}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2}(-?[\d\.]+%?)\s*[\,\/]?\s*[\d\.]*%?\))$/i;function af(e){return typeof e==`string`}var of=e=>({test:t=>af(t)&&t.endsWith(e)&&t.split(` `).length===1,parse:parseFloat,transform:t=>`${t}${e}`}),sf=of(`deg`),cf=of(`%`),Y=of(`px`),lf=of(`vh`),uf=of(`vw`),df={...cf,parse:e=>cf.parse(e)/100,transform:e=>cf.transform(e*100)},ff={...Zd,transform:Math.round},pf={borderWidth:Y,borderTopWidth:Y,borderRightWidth:Y,borderBottomWidth:Y,borderLeftWidth:Y,borderRadius:Y,radius:Y,borderTopLeftRadius:Y,borderTopRightRadius:Y,borderBottomRightRadius:Y,borderBottomLeftRadius:Y,width:Y,maxWidth:Y,height:Y,maxHeight:Y,size:Y,top:Y,right:Y,bottom:Y,left:Y,padding:Y,paddingTop:Y,paddingRight:Y,paddingBottom:Y,paddingLeft:Y,margin:Y,marginTop:Y,marginRight:Y,marginBottom:Y,marginLeft:Y,rotate:sf,rotateX:sf,rotateY:sf,rotateZ:sf,scale:$d,scaleX:$d,scaleY:$d,scaleZ:$d,skew:sf,skewX:sf,skewY:sf,distance:Y,translateX:Y,translateY:Y,translateZ:Y,x:Y,y:Y,z:Y,perspective:Y,transformPerspective:Y,opacity:Qd,originX:df,originY:df,originZ:Y,zIndex:ff,fillOpacity:Qd,strokeOpacity:Qd,numOctaves:ff};function mf(e,t,n,r){let{style:i,vars:a,transform:o,transformOrigin:s}=e,c=!1,l=!1,u=!0;for(let e in t){let n=t[e];if(Kd(e)){a[e]=n;continue}let r=pf[e],d=Yd(n,r);if(zd.has(e)){if(c=!0,o[e]=d,!u)continue;n!==(r.default||0)&&(u=!1)}else e.startsWith(`origin`)?(l=!0,s[e]=d):i[e]=d}if(t.transform||(c||r?i.transform=Wd(e.transform,n,u,r):i.transform&&=`none`),l){let{originX:e=`50%`,originY:t=`50%`,originZ:n=0}=s;i.transformOrigin=`${e} ${t} ${n}`}}var hf=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function gf(e,t,n){for(let r in t)!Vd(t[r])&&!Bd(r,n)&&(e[r]=t[r])}function _f({transformTemplate:e},t,n){return(0,l.useMemo)(()=>{let r=hf();return mf(r,t,{enableHardwareAcceleration:!n},e),Object.assign({},r.vars,r.style)},[t])}function vf(e,t,n){let r=e.style||{},i={};return gf(i,r,e),Object.assign(i,_f(e,t,n)),e.transformValues?e.transformValues(i):i}function yf(e,t,n){let r={},i=vf(e,t,n);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout=`none`,i.touchAction=e.drag===!0?`none`:`pan-${e.drag===`x`?`y`:`x`}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=i,r}var bf=new Set(`animate.exit.variants.initial.style.values.variants.transition.transformTemplate.transformValues.custom.inherit.onBeforeLayoutMeasure.onAnimationStart.onAnimationComplete.onUpdate.onDragStart.onDrag.onDragEnd.onMeasureDragConstraints.onDirectionLock.onDragTransitionEnd._dragX._dragY.onHoverStart.onHoverEnd.onViewportEnter.onViewportLeave.globalTapTarget.ignoreStrict.viewport`.split(`.`));function xf(e){return e.startsWith(`while`)||e.startsWith(`drag`)&&e!==`draggable`||e.startsWith(`layout`)||e.startsWith(`onTap`)||e.startsWith(`onPan`)||e.startsWith(`onLayout`)||bf.has(e)}var Sf=e=>!xf(e);function Cf(e,t,n){let r={};for(let i in e)i===`values`&&typeof e.values==`object`||(Sf(i)||n===!0&&xf(i)||!t&&!xf(i)||e.draggable&&i.startsWith(`onDrag`))&&(r[i]=e[i]);return r}function wf(e,t,n){return typeof e==`string`?e:Y.transform(t+n*e)}function Tf(e,t,n){return`${wf(t,e.x,e.width)} ${wf(n,e.y,e.height)}`}var Ef={offset:`stroke-dashoffset`,array:`stroke-dasharray`},Df={offset:`strokeDashoffset`,array:`strokeDasharray`};function Of(e,t,n=1,r=0,i=!0){e.pathLength=1;let a=i?Ef:Df;e[a.offset]=Y.transform(-r);let o=Y.transform(t),s=Y.transform(n);e[a.array]=`${o} ${s}`}function kf(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:a,pathLength:o,pathSpacing:s=1,pathOffset:c=0,...l},u,d,f){if(mf(e,l,u,f),d){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:p,style:m,dimensions:h}=e;p.transform&&(h&&(m.transform=p.transform),delete p.transform),h&&(i!==void 0||a!==void 0||m.transform)&&(m.transformOrigin=Tf(h,i===void 0?.5:i,a===void 0?.5:a)),t!==void 0&&(p.x=t),n!==void 0&&(p.y=n),r!==void 0&&(p.scale=r),o!==void 0&&Of(p,o,s,c,!1)}var Af=()=>({...hf(),attrs:{}}),jf=e=>typeof e==`string`&&e.toLowerCase()===`svg`;function Mf(e,t,n,r){let i=(0,l.useMemo)(()=>{let n=Af();return kf(n,t,{enableHardwareAcceleration:!1},jf(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};gf(t,e.style,e),i.style={...t,...i.style}}return i}function Nf(e=!1){return(t,n,r,{latestValues:i},a)=>{let o=(Id(t)?Mf:yf)(n,i,a,t),s={...Cf(n,typeof t==`string`,e),...o,ref:r},{children:c}=n,u=(0,l.useMemo)(()=>Vd(c)?c.get():c,[c]);return(0,l.createElement)(t,{...s,children:u})}}function Pf(e,{style:t,vars:n},r,i){Object.assign(e.style,t,i&&i.getProjectionStyles(r));for(let t in n)e.style.setProperty(t,n[t])}var Ff=new Set([`baseFrequency`,`diffuseConstant`,`kernelMatrix`,`kernelUnitLength`,`keySplines`,`keyTimes`,`limitingConeAngle`,`markerHeight`,`markerWidth`,`numOctaves`,`targetX`,`targetY`,`surfaceScale`,`specularConstant`,`specularExponent`,`stdDeviation`,`tableValues`,`viewBox`,`gradientTransform`,`pathLength`,`startOffset`,`textLength`,`lengthAdjust`]);function If(e,t,n,r){Pf(e,t,void 0,r);for(let n in t.attrs)e.setAttribute(Ff.has(n)?n:fd(n),t.attrs[n])}function Lf(e,t){let{style:n}=e,r={};for(let i in n)(Vd(n[i])||t.style&&Vd(t.style[i])||Bd(i,e))&&(r[i]=n[i]);return r}function Rf(e,t){let n=Lf(e,t);for(let r in e)if(Vd(e[r])||Vd(t[r])){let t=Rd.indexOf(r)===-1?r:`attr`+r.charAt(0).toUpperCase()+r.substring(1);n[t]=e[r]}return n}function zf(e,t,n,r={},i={}){return typeof t==`function`&&(t=t(n===void 0?e.custom:n,r,i)),typeof t==`string`&&(t=e.variants&&e.variants[t]),typeof t==`function`&&(t=t(n===void 0?e.custom:n,r,i)),t}function Bf(e){let t=(0,l.useRef)(null);return t.current===null&&(t.current=e()),t.current}var Vf=e=>Array.isArray(e),Hf=e=>!!(e&&typeof e==`object`&&e.mix&&e.toValue),Uf=e=>Vf(e)?e[e.length-1]||0:e;function Wf(e){let t=Vd(e)?e.get():e;return Hf(t)?t.toValue():t}function Gf({scrapeMotionValuesFromProps:e,createRenderState:t,onMount:n},r,i,a){let o={latestValues:qf(r,i,a,e),renderState:t()};return n&&(o.mount=e=>n(r,e,o)),o}var Kf=e=>(t,n)=>{let r=(0,l.useContext)(sd),i=(0,l.useContext)(cd),a=()=>Gf(e,t,r,i);return n?a():Bf(a)};function qf(e,t,n,r){let i={},a=r(e,{});for(let e in a)i[e]=Wf(a[e]);let{initial:o,animate:s}=e,c=xd(e),l=Sd(e);t&&l&&!c&&e.inherit!==!1&&(o===void 0&&(o=t.initial),s===void 0&&(s=t.animate));let u=n?n.initial===!1:!1;u||=o===!1;let d=u?s:o;return d&&typeof d!=`boolean`&&!vd(d)&&(Array.isArray(d)?d:[d]).forEach(t=>{let n=zf(e,t);if(!n)return;let{transitionEnd:r,transition:a,...o}=n;for(let e in o){let t=o[e];if(Array.isArray(t)){let e=u?t.length-1:0;t=t[e]}t!==null&&(i[e]=t)}for(let e in r)i[e]=r[e]}),i}var Jf=e=>e,Yf=class{constructor(){this.order=[],this.scheduled=new Set}add(e){if(!this.scheduled.has(e))return this.scheduled.add(e),this.order.push(e),!0}remove(e){let t=this.order.indexOf(e);t!==-1&&(this.order.splice(t,1),this.scheduled.delete(e))}clear(){this.order.length=0,this.scheduled.clear()}};function Xf(e){let t=new Yf,n=new Yf,r=0,i=!1,a=!1,o=new WeakSet,s={schedule:(e,a=!1,s=!1)=>{let c=s&&i,l=c?t:n;return a&&o.add(e),l.add(e)&&c&&i&&(r=t.order.length),e},cancel:e=>{n.remove(e),o.delete(e)},process:c=>{if(i){a=!0;return}if(i=!0,[t,n]=[n,t],n.clear(),r=t.order.length,r)for(let n=0;n<r;n++){let r=t.order[n];r(c),o.has(r)&&(s.schedule(r),e())}i=!1,a&&(a=!1,s.process(c))}};return s}var Zf=[`prepare`,`read`,`update`,`preRender`,`render`,`postRender`],Qf=40;function $f(e,t){let n=!1,r=!0,i={delta:0,timestamp:0,isProcessing:!1},a=Zf.reduce((e,t)=>(e[t]=Xf(()=>n=!0),e),{}),o=e=>a[e].process(i),s=()=>{let a=performance.now();n=!1,i.delta=r?1e3/60:Math.max(Math.min(a-i.timestamp,Qf),1),i.timestamp=a,i.isProcessing=!0,Zf.forEach(o),i.isProcessing=!1,n&&t&&(r=!1,e(s))},c=()=>{n=!0,r=!0,i.isProcessing||e(s)};return{schedule:Zf.reduce((e,t)=>{let r=a[t];return e[t]=(e,t=!1,i=!1)=>(n||c(),r.schedule(e,t,i)),e},{}),cancel:e=>Zf.forEach(t=>a[t].cancel(e)),state:i,steps:a}}var{schedule:ep,cancel:tp,state:np,steps:rp}=$f(typeof requestAnimationFrame<`u`?requestAnimationFrame:Jf,!0),ip={useVisualState:Kf({scrapeMotionValuesFromProps:Rf,createRenderState:Af,onMount:(e,t,{renderState:n,latestValues:r})=>{ep.read(()=>{try{n.dimensions=typeof t.getBBox==`function`?t.getBBox():t.getBoundingClientRect()}catch{n.dimensions={x:0,y:0,width:0,height:0}}}),ep.render(()=>{kf(n,r,{enableHardwareAcceleration:!1},jf(t.tagName),e.transformTemplate),If(t,n)})}})},ap={useVisualState:Kf({scrapeMotionValuesFromProps:Lf,createRenderState:hf})};function op(e,{forwardMotionProps:t=!1},n,r){return{...Id(e)?ip:ap,preloadedFeatures:n,useRender:Nf(t),createVisualElement:r,Component:e}}function sp(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}var cp=e=>e.pointerType===`mouse`?typeof e.button!=`number`||e.button<=0:e.isPrimary!==!1;function lp(e,t=`page`){return{point:{x:e[t+`X`],y:e[t+`Y`]}}}var up=e=>t=>cp(t)&&e(t,lp(t));function dp(e,t,n,r){return sp(e,t,up(n),r)}var fp=(e,t)=>n=>t(e(n)),pp=(...e)=>e.reduce(fp);function mp(e){let t=null;return()=>t===null?(t=e,()=>{t=null}):!1}var hp=mp(`dragHorizontal`),gp=mp(`dragVertical`);function _p(e){let t=!1;if(e===`y`)t=gp();else if(e===`x`)t=hp();else{let e=hp(),n=gp();e&&n?t=()=>{e(),n()}:(e&&e(),n&&n())}return t}function vp(){let e=_p(!0);return e?(e(),!1):!0}var yp=class{constructor(e){this.isMounted=!1,this.node=e}update(){}};function bp(e,t){let n=`pointer`+(t?`enter`:`leave`),r=`onHover`+(t?`Start`:`End`);return dp(e.current,n,(n,i)=>{if(n.pointerType===`touch`||vp())return;let a=e.getProps();e.animationState&&a.whileHover&&e.animationState.setActive(`whileHover`,t),a[r]&&ep.update(()=>a[r](n,i))},{passive:!e.getProps()[r]})}var xp=class extends yp{mount(){this.unmount=pp(bp(this.node,!0),bp(this.node,!1))}unmount(){}},Sp=class extends yp{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(`:focus-visible`)}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive(`whileFocus`,!1),this.isActive=!1)}mount(){this.unmount=pp(sp(this.node.current,`focus`,()=>this.onFocus()),sp(this.node.current,`blur`,()=>this.onBlur()))}unmount(){}},Cp=(e,t)=>t?e===t?!0:Cp(e,t.parentElement):!1;function wp(e,t){if(!t)return;let n=new PointerEvent(`pointer`+e);t(n,lp(n))}var Tp=class extends yp{constructor(){super(...arguments),this.removeStartListeners=Jf,this.removeEndListeners=Jf,this.removeAccessibleListeners=Jf,this.startPointerPress=(e,t)=>{if(this.isPressing)return;this.removeEndListeners();let n=this.node.getProps();this.removeEndListeners=pp(dp(window,`pointerup`,(e,t)=>{if(!this.checkPressEnd())return;let{onTap:n,onTapCancel:r,globalTapTarget:i}=this.node.getProps();ep.update(()=>{!i&&!Cp(this.node.current,e.target)?r&&r(e,t):n&&n(e,t)})},{passive:!(n.onTap||n.onPointerUp)}),dp(window,`pointercancel`,(e,t)=>this.cancelPress(e,t),{passive:!(n.onTapCancel||n.onPointerCancel)})),this.startPress(e,t)},this.startAccessiblePress=()=>{this.removeAccessibleListeners=pp(sp(this.node.current,`keydown`,e=>{e.key!==`Enter`||this.isPressing||(this.removeEndListeners(),this.removeEndListeners=sp(this.node.current,`keyup`,e=>{e.key!==`Enter`||!this.checkPressEnd()||wp(`up`,(e,t)=>{let{onTap:n}=this.node.getProps();n&&ep.update(()=>n(e,t))})}),wp(`down`,(e,t)=>{this.startPress(e,t)}))}),sp(this.node.current,`blur`,()=>{this.isPressing&&wp(`cancel`,(e,t)=>this.cancelPress(e,t))}))}}startPress(e,t){this.isPressing=!0;let{onTapStart:n,whileTap:r}=this.node.getProps();r&&this.node.animationState&&this.node.animationState.setActive(`whileTap`,!0),n&&ep.update(()=>n(e,t))}checkPressEnd(){return this.removeEndListeners(),this.isPressing=!1,this.node.getProps().whileTap&&this.node.animationState&&this.node.animationState.setActive(`whileTap`,!1),!vp()}cancelPress(e,t){if(!this.checkPressEnd())return;let{onTapCancel:n}=this.node.getProps();n&&ep.update(()=>n(e,t))}mount(){let e=this.node.getProps();this.removeStartListeners=pp(dp(e.globalTapTarget?window:this.node.current,`pointerdown`,this.startPointerPress,{passive:!(e.onTapStart||e.onPointerStart)}),sp(this.node.current,`focus`,this.startAccessiblePress))}unmount(){this.removeStartListeners(),this.removeEndListeners(),this.removeAccessibleListeners()}},Ep=new WeakMap,Dp=new WeakMap,Op=e=>{let t=Ep.get(e.target);t&&t(e)},kp=e=>{e.forEach(Op)};function Ap({root:e,...t}){let n=e||document;Dp.has(n)||Dp.set(n,{});let r=Dp.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(kp,{root:e,...t})),r[i]}function jp(e,t,n){let r=Ap(t);return Ep.set(e,n),r.observe(e),()=>{Ep.delete(e),r.unobserve(e)}}var Mp={some:0,all:1},Np=class extends yp{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r=`some`,once:i}=e,a={root:t?t.current:void 0,rootMargin:n,threshold:typeof r==`number`?r:Mp[r]};return jp(this.node.current,a,e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive(`whileInView`,t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),a=t?n:r;a&&a(e)})}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>`u`)return;let{props:e,prevProps:t}=this.node;[`amount`,`margin`,`root`].some(Pp(e,t))&&this.startObserver()}unmount(){}};function Pp({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}var Fp={inView:{Feature:Np},tap:{Feature:Tp},focus:{Feature:Sp},hover:{Feature:xp}};function Ip(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function Lp(e){let t={};return e.values.forEach((e,n)=>t[n]=e.get()),t}function Rp(e){let t={};return e.values.forEach((e,n)=>t[n]=e.getVelocity()),t}function zp(e,t,n){let r=e.getProps();return zf(r,t,n===void 0?r.custom:n,Lp(e),Rp(e))}var Bp=Jf,Vp=Jf,Hp=e=>e*1e3,Up=e=>e/1e3,Wp={current:!1},Gp=e=>Array.isArray(e)&&typeof e[0]==`number`;function Kp(e){return!!(!e||typeof e==`string`&&Jp[e]||Gp(e)||Array.isArray(e)&&e.every(Kp))}var qp=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,Jp={linear:`linear`,ease:`ease`,easeIn:`ease-in`,easeOut:`ease-out`,easeInOut:`ease-in-out`,circIn:qp([0,.65,.55,1]),circOut:qp([.55,0,1,.45]),backIn:qp([.31,.01,.66,-.59]),backOut:qp([.33,1.53,.69,.99])};function Yp(e){if(e)return Gp(e)?qp(e):Array.isArray(e)?e.map(Yp):Jp[e]}function Xp(e,t,n,{delay:r=0,duration:i,repeat:a=0,repeatType:o=`loop`,ease:s,times:c}={}){let l={[t]:n};c&&(l.offset=c);let u=Yp(s);return Array.isArray(u)&&(l.easing=u),e.animate(l,{delay:r,duration:i,easing:Array.isArray(u)?`linear`:u,fill:`both`,iterations:a+1,direction:o===`reverse`?`alternate`:`normal`})}function Zp(e,{repeat:t,repeatType:n=`loop`}){return e[t&&n!==`loop`&&t%2==1?0:e.length-1]}var Qp=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e,$p=1e-7,em=12;function tm(e,t,n,r,i){let a,o,s=0;do o=t+(n-t)/2,a=Qp(o,r,i)-e,a>0?n=o:t=o;while(Math.abs(a)>$p&&++s<em);return o}function nm(e,t,n,r){if(e===t&&n===r)return Jf;let i=t=>tm(t,0,1,e,n);return e=>e===0||e===1?e:Qp(i(e),t,r)}var rm=nm(.42,0,1,1),im=nm(0,0,.58,1),am=nm(.42,0,.58,1),om=e=>Array.isArray(e)&&typeof e[0]!=`number`,sm=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,cm=e=>t=>1-e(1-t),lm=e=>1-Math.sin(Math.acos(e)),um=cm(lm),dm=sm(lm),fm=nm(.33,1.53,.69,.99),pm=cm(fm),mm={linear:Jf,easeIn:rm,easeInOut:am,easeOut:im,circIn:lm,circInOut:dm,circOut:um,backIn:pm,backInOut:sm(pm),backOut:fm,anticipate:e=>(e*=2)<1?.5*pm(e):.5*(2-2**(-10*(e-1)))},hm=e=>{if(Array.isArray(e)){Vp(e.length===4);let[t,n,r,i]=e;return nm(t,n,r,i)}else if(typeof e==`string`)return mm[e];return e},gm=(e,t)=>n=>!!(af(n)&&rf.test(n)&&n.startsWith(e)||t&&Object.prototype.hasOwnProperty.call(n,t)),_m=(e,t,n)=>r=>{if(!af(r))return r;let[i,a,o,s]=r.match(tf);return{[e]:parseFloat(i),[t]:parseFloat(a),[n]:parseFloat(o),alpha:s===void 0?1:parseFloat(s)}},vm=e=>Xd(0,255,e),ym={...Zd,transform:e=>Math.round(vm(e))},bm={test:gm(`rgb`,`red`),parse:_m(`red`,`green`,`blue`),transform:({red:e,green:t,blue:n,alpha:r=1})=>`rgba(`+ym.transform(e)+`, `+ym.transform(t)+`, `+ym.transform(n)+`, `+ef(Qd.transform(r))+`)`};function xm(e){let t=``,n=``,r=``,i=``;return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:i?parseInt(i,16)/255:1}}var Sm={test:gm(`#`),parse:xm,transform:bm.transform},Cm={test:gm(`hsl`,`hue`),parse:_m(`hue`,`saturation`,`lightness`),transform:({hue:e,saturation:t,lightness:n,alpha:r=1})=>`hsla(`+Math.round(e)+`, `+cf.transform(ef(t))+`, `+cf.transform(ef(n))+`, `+ef(Qd.transform(r))+`)`},wm={test:e=>bm.test(e)||Sm.test(e)||Cm.test(e),parse:e=>bm.test(e)?bm.parse(e):Cm.test(e)?Cm.parse(e):Sm.parse(e),transform:e=>af(e)?e:e.hasOwnProperty(`red`)?bm.transform(e):Cm.transform(e)},Tm=(e,t,n)=>-n*e+n*t+e;function Em(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function Dm({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,t/=100,n/=100;let i=0,a=0,o=0;if(!t)i=a=o=n;else{let r=n<.5?n*(1+t):n+t-n*t,s=2*n-r;i=Em(s,r,e+1/3),a=Em(s,r,e),o=Em(s,r,e-1/3)}return{red:Math.round(i*255),green:Math.round(a*255),blue:Math.round(o*255),alpha:r}}var Om=(e,t,n)=>{let r=e*e;return Math.sqrt(Math.max(0,n*(t*t-r)+r))},km=[Sm,bm,Cm],Am=e=>km.find(t=>t.test(e));function jm(e){let t=Am(e),n=t.parse(e);return t===Cm&&(n=Dm(n)),n}var Mm=(e,t)=>{let n=jm(e),r=jm(t),i={...n};return e=>(i.red=Om(n.red,r.red,e),i.green=Om(n.green,r.green,e),i.blue=Om(n.blue,r.blue,e),i.alpha=Tm(n.alpha,r.alpha,e),bm.transform(i))};function Nm(e){return isNaN(e)&&af(e)&&(e.match(tf)?.length||0)+(e.match(nf)?.length||0)>0}var Pm={regex:Jd,countKey:`Vars`,token:"${v}",parse:Jf},Fm={regex:nf,countKey:`Colors`,token:"${c}",parse:wm.parse},Im={regex:tf,countKey:`Numbers`,token:"${n}",parse:Zd.parse};function Lm(e,{regex:t,countKey:n,token:r,parse:i}){let a=e.tokenised.match(t);a&&(e[`num`+n]=a.length,e.tokenised=e.tokenised.replace(t,r),e.values.push(...a.map(i)))}function Rm(e){let t=e.toString(),n={value:t,tokenised:t,values:[],numVars:0,numColors:0,numNumbers:0};return n.value.includes(`var(--`)&&Lm(n,Pm),Lm(n,Fm),Lm(n,Im),n}function zm(e){return Rm(e).values}function Bm(e){let{values:t,numColors:n,numVars:r,tokenised:i}=Rm(e),a=t.length;return e=>{let t=i;for(let i=0;i<a;i++)t=i<r?t.replace(Pm.token,e[i]):i<r+n?t.replace(Fm.token,wm.transform(e[i])):t.replace(Im.token,ef(e[i]));return t}}var Vm=e=>typeof e==`number`?0:e;function Hm(e){let t=zm(e);return Bm(e)(t.map(Vm))}var Um={test:Nm,parse:zm,createTransformer:Bm,getAnimatableNone:Hm},Wm=(e,t)=>n=>`${n>0?t:e}`;function Gm(e,t){return typeof e==`number`?n=>Tm(e,t,n):wm.test(e)?Mm(e,t):e.startsWith(`var(`)?Wm(e,t):Jm(e,t)}var Km=(e,t)=>{let n=[...e],r=n.length,i=e.map((e,n)=>Gm(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}},qm=(e,t)=>{let n={...e,...t},r={};for(let i in n)e[i]!==void 0&&t[i]!==void 0&&(r[i]=Gm(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}},Jm=(e,t)=>{let n=Um.createTransformer(t),r=Rm(e),i=Rm(t);return r.numVars===i.numVars&&r.numColors===i.numColors&&r.numNumbers>=i.numNumbers?pp(Km(r.values,i.values),n):Wm(e,t)},Ym=(e,t,n)=>{let r=t-e;return r===0?1:(n-e)/r},Xm=(e,t)=>n=>Tm(e,t,n);function Zm(e){return typeof e==`number`?Xm:typeof e==`string`?wm.test(e)?Mm:Jm:Array.isArray(e)?Km:typeof e==`object`?qm:Xm}function Qm(e,t,n){let r=[],i=n||Zm(e[0]),a=e.length-1;for(let n=0;n<a;n++){let a=i(e[n],e[n+1]);t&&(a=pp(Array.isArray(t)?t[n]||Jf:t,a)),r.push(a)}return r}function $m(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let a=e.length;if(Vp(a===t.length),a===1)return()=>t[0];e[0]>e[a-1]&&(e=[...e].reverse(),t=[...t].reverse());let o=Qm(t,r,i),s=o.length,c=t=>{let n=0;if(s>1)for(;n<e.length-2&&!(t<e[n+1]);n++);let r=Ym(e[n],e[n+1],t);return o[n](r)};return n?t=>c(Xd(e[0],e[a-1],t)):c}function eh(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=Ym(0,t,r);e.push(Tm(n,1,i))}}function th(e){let t=[0];return eh(t,e.length-1),t}function nh(e,t){return e.map(e=>e*t)}function rh(e,t){return e.map(()=>t||am).splice(0,e.length-1)}function ih({duration:e=300,keyframes:t,times:n,ease:r=`easeInOut`}){let i=om(r)?r.map(hm):hm(r),a={done:!1,value:t[0]},o=$m(nh(n&&n.length===t.length?n:th(t),e),t,{ease:Array.isArray(i)?i:rh(t,i)});return{calculatedDuration:e,next:t=>(a.value=o(t),a.done=t>=e,a)}}function ah(e,t){return t?1e3/t*e:0}var oh=5;function sh(e,t,n){let r=Math.max(t-oh,0);return ah(n-e(r),t-r)}var ch=.001,lh=.01,uh=10,dh=.05,fh=1;function ph({duration:e=800,bounce:t=.25,velocity:n=0,mass:r=1}){let i,a;Bp(e<=Hp(uh));let o=1-t;o=Xd(dh,fh,o),e=Xd(lh,uh,Up(e)),o<1?(i=t=>{let r=t*o,i=r*e,a=r-n,s=gh(t,o),c=Math.exp(-i);return ch-a/s*c},a=t=>{let r=t*o*e,a=r*n+n,s=o**2*t**2*e,c=Math.exp(-r),l=gh(t**2,o);return(-i(t)+ch>0?-1:1)*((a-s)*c)/l}):(i=t=>{let r=Math.exp(-t*e),i=(t-n)*e+1;return-ch+r*i},a=t=>Math.exp(-t*e)*((n-t)*(e*e)));let s=5/e,c=hh(i,a,s);if(e=Hp(e),isNaN(c))return{stiffness:100,damping:10,duration:e};{let t=c**2*r;return{stiffness:t,damping:o*2*Math.sqrt(r*t),duration:e}}}var mh=12;function hh(e,t,n){let r=n;for(let n=1;n<mh;n++)r-=e(r)/t(r);return r}function gh(e,t){return e*Math.sqrt(1-t*t)}var _h=[`duration`,`bounce`],vh=[`stiffness`,`damping`,`mass`];function yh(e,t){return t.some(t=>e[t]!==void 0)}function bh(e){let t={velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1,...e};if(!yh(e,vh)&&yh(e,_h)){let n=ph(e);t={...t,...n,mass:1},t.isResolvedFromDuration=!0}return t}function xh({keyframes:e,restDelta:t,restSpeed:n,...r}){let i=e[0],a=e[e.length-1],o={done:!1,value:i},{stiffness:s,damping:c,mass:l,duration:u,velocity:d,isResolvedFromDuration:f}=bh({...r,velocity:-Up(r.velocity||0)}),p=d||0,m=c/(2*Math.sqrt(s*l)),h=a-i,g=Up(Math.sqrt(s/l)),_=Math.abs(h)<5;n||=_?.01:2,t||=_?.005:.5;let v;if(m<1){let e=gh(g,m);v=t=>a-Math.exp(-m*g*t)*((p+m*g*h)/e*Math.sin(e*t)+h*Math.cos(e*t))}else if(m===1)v=e=>a-Math.exp(-g*e)*(h+(p+g*h)*e);else{let e=g*Math.sqrt(m*m-1);v=t=>{let n=Math.exp(-m*g*t),r=Math.min(e*t,300);return a-n*((p+m*g*h)*Math.sinh(r)+e*h*Math.cosh(r))/e}}return{calculatedDuration:f&&u||null,next:e=>{let r=v(e);if(f)o.done=e>=u;else{let i=p;e!==0&&(i=m<1?sh(v,e,r):0);let s=Math.abs(i)<=n,c=Math.abs(a-r)<=t;o.done=s&&c}return o.value=o.done?a:r,o}}}function Sh({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:a=500,modifyTarget:o,min:s,max:c,restDelta:l=.5,restSpeed:u}){let d=e[0],f={done:!1,value:d},p=e=>s!==void 0&&e<s||c!==void 0&&e>c,m=e=>s===void 0?c:c===void 0||Math.abs(s-e)<Math.abs(c-e)?s:c,h=n*t,g=d+h,_=o===void 0?g:o(g);_!==g&&(h=_-d);let v=e=>-h*Math.exp(-e/r),y=e=>_+v(e),b=e=>{let t=v(e),n=y(e);f.done=Math.abs(t)<=l,f.value=f.done?_:n},x,S,C=e=>{p(f.value)&&(x=e,S=xh({keyframes:[f.value,m(f.value)],velocity:sh(y,e,f.value),damping:i,stiffness:a,restDelta:l,restSpeed:u}))};return C(0),{calculatedDuration:null,next:e=>{let t=!1;return!S&&x===void 0&&(t=!0,b(e),C(e)),x!==void 0&&e>x?S.next(e-x):(!t&&b(e),f)}}}var Ch=e=>{let t=({timestamp:t})=>e(t);return{start:()=>ep.update(t,!0),stop:()=>tp(t),now:()=>np.isProcessing?np.timestamp:performance.now()}},wh=2e4;function Th(e){let t=0,n=e.next(t);for(;!n.done&&t<wh;)t+=50,n=e.next(t);return t>=wh?1/0:t}var Eh={decay:Sh,inertia:Sh,tween:ih,keyframes:ih,spring:xh};function Dh({autoplay:e=!0,delay:t=0,driver:n=Ch,keyframes:r,type:i=`keyframes`,repeat:a=0,repeatDelay:o=0,repeatType:s=`loop`,onPlay:c,onStop:l,onComplete:u,onUpdate:d,...f}){let p=1,m=!1,h,g,_=()=>{g=new Promise(e=>{h=e})};_();let v,y=Eh[i]||ih,b;y!==ih&&typeof r[0]!=`number`&&(b=$m([0,100],r,{clamp:!1}),r=[0,100]);let x=y({...f,keyframes:r}),S;s===`mirror`&&(S=y({...f,keyframes:[...r].reverse(),velocity:-(f.velocity||0)}));let C=`idle`,w=null,T=null,E=null;x.calculatedDuration===null&&a&&(x.calculatedDuration=Th(x));let{calculatedDuration:D}=x,O=1/0,k=1/0;D!==null&&(O=D+o,k=O*(a+1)-o);let A=0,j=e=>{if(T===null)return;p>0&&(T=Math.min(T,e)),p<0&&(T=Math.min(e-k/p,T)),A=w===null?Math.round(e-T)*p:w;let n=A-t*(p>=0?1:-1),i=p>=0?n<0:n>k;A=Math.max(n,0),C===`finished`&&w===null&&(A=k);let c=A,l=x;if(a){let e=Math.min(A,k)/O,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),n===1&&t--,t=Math.min(t,a+1),t%2&&(s===`reverse`?(n=1-n,o&&(n-=o/O)):s===`mirror`&&(l=S)),c=Xd(0,1,n)*O}let u=i?{done:!1,value:r[0]}:l.next(c);b&&(u.value=b(u.value));let{done:f}=u;!i&&D!==null&&(f=p>=0?A>=k:A<=0);let m=w===null&&(C===`finished`||C===`running`&&f);return d&&d(u.value),m&&P(),u},M=()=>{v&&v.stop(),v=void 0},N=()=>{C=`idle`,M(),h(),_(),T=E=null},P=()=>{C=`finished`,u&&u(),M(),h()},ee=()=>{if(m)return;v||=n(j);let e=v.now();c&&c(),w===null?(!T||C===`finished`)&&(T=e):T=e-w,C===`finished`&&_(),E=T,w=null,C=`running`,v.start()};e&&ee();let F={then(e,t){return g.then(e,t)},get time(){return Up(A)},set time(e){e=Hp(e),A=e,w!==null||!v||p===0?w=e:T=v.now()-e/p},get duration(){return Up(x.calculatedDuration===null?Th(x):x.calculatedDuration)},get speed(){return p},set speed(e){e===p||!v||(p=e,F.time=Up(A))},get state(){return C},play:ee,pause:()=>{C=`paused`,w=A},stop:()=>{m=!0,C!==`idle`&&(C=`idle`,l&&l(),N())},cancel:()=>{E!==null&&j(E),N()},complete:()=>{C=`finished`},sample:e=>(T=0,j(e))};return F}function Oh(e){let t;return()=>(t===void 0&&(t=e()),t)}var kh=Oh(()=>Object.hasOwnProperty.call(Element.prototype,`animate`)),Ah=new Set([`opacity`,`clipPath`,`filter`,`transform`,`backgroundColor`]),jh=10,Mh=2e4,Nh=(e,t)=>t.type===`spring`||e===`backgroundColor`||!Kp(t.ease);function Ph(e,t,{onUpdate:n,onComplete:r,...i}){if(!(kh()&&Ah.has(t)&&!i.repeatDelay&&i.repeatType!==`mirror`&&i.damping!==0&&i.type!==`inertia`))return!1;let a=!1,o,s,c=!1,l=()=>{s=new Promise(e=>{o=e})};l();let{keyframes:u,duration:d=300,ease:f,times:p}=i;if(Nh(t,i)){let e=Dh({...i,repeat:0,delay:0}),t={done:!1,value:u[0]},n=[],r=0;for(;!t.done&&r<Mh;)t=e.sample(r),n.push(t.value),r+=jh;p=void 0,u=n,d=r-jh,f=`linear`}let m=Xp(e.owner.current,t,u,{...i,duration:d,ease:f,times:p}),h=()=>{c=!1,m.cancel()},g=()=>{c=!0,ep.update(h),o(),l()};return m.onfinish=()=>{c||(e.set(Zp(u,i)),r&&r(),g())},{then(e,t){return s.then(e,t)},attachTimeline(e){return m.timeline=e,m.onfinish=null,Jf},get time(){return Up(m.currentTime||0)},set time(e){m.currentTime=Hp(e)},get speed(){return m.playbackRate},set speed(e){m.playbackRate=e},get duration(){return Up(d)},play:()=>{a||(m.play(),tp(h))},pause:()=>m.pause(),stop:()=>{if(a=!0,m.playState===`idle`)return;let{currentTime:t}=m;if(t){let n=Dh({...i,autoplay:!1});e.setWithVelocity(n.sample(t-jh).value,n.sample(t).value,jh)}g()},complete:()=>{c||m.finish()},cancel:g}}function Fh({keyframes:e,delay:t,onUpdate:n,onComplete:r}){let i=()=>(n&&n(e[e.length-1]),r&&r(),{time:0,speed:1,duration:0,play:Jf,pause:Jf,stop:Jf,then:e=>(e(),Promise.resolve()),cancel:Jf,complete:Jf});return t?Dh({keyframes:[0,1],duration:0,delay:t,onComplete:i}):i()}var Ih={type:`spring`,stiffness:500,damping:25,restSpeed:10},Lh=e=>({type:`spring`,stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),Rh={type:`keyframes`,duration:.8},zh={type:`keyframes`,ease:[.25,.1,.35,1],duration:.3},Bh=(e,{keyframes:t})=>t.length>2?Rh:zd.has(e)?e.startsWith(`scale`)?Lh(t[1]):Ih:zh,Vh=(e,t)=>e===`zIndex`?!1:!!(typeof t==`number`||Array.isArray(t)||typeof t==`string`&&(Um.test(t)||t===`0`)&&!t.startsWith(`url(`)),Hh=new Set([`brightness`,`contrast`,`saturate`,`opacity`]);function Uh(e){let[t,n]=e.slice(0,-1).split(`(`);if(t===`drop-shadow`)return e;let[r]=n.match(tf)||[];if(!r)return e;let i=n.replace(r,``),a=Hh.has(t)?1:0;return r!==n&&(a*=100),t+`(`+a+i+`)`}var Wh=/([a-z-]*)\(.*?\)/g,Gh={...Um,getAnimatableNone:e=>{let t=e.match(Wh);return t?t.map(Uh).join(` `):e}},Kh={...pf,color:wm,backgroundColor:wm,outlineColor:wm,fill:wm,stroke:wm,borderColor:wm,borderTopColor:wm,borderRightColor:wm,borderBottomColor:wm,borderLeftColor:wm,filter:Gh,WebkitFilter:Gh},qh=e=>Kh[e];function Jh(e,t){let n=qh(e);return n!==Gh&&(n=Um),n.getAnimatableNone?n.getAnimatableNone(t):void 0}var Yh=e=>/^0[^.\s]+$/.test(e);function Xh(e){if(typeof e==`number`)return e===0;if(e!==null)return e===`none`||e===`0`||Yh(e)}function Zh(e,t,n,r){let i=Vh(t,n),a;a=Array.isArray(n)?[...n]:[null,n];let o=r.from===void 0?e.get():r.from,s,c=[];for(let e=0;e<a.length;e++)a[e]===null&&(a[e]=e===0?o:a[e-1]),Xh(a[e])&&c.push(e),typeof a[e]==`string`&&a[e]!==`none`&&a[e]!==`0`&&(s=a[e]);if(i&&c.length&&s)for(let e=0;e<c.length;e++){let n=c[e];a[n]=Jh(t,s)}return a}function Qh({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:a,repeatType:o,repeatDelay:s,from:c,elapsed:l,...u}){return!!Object.keys(u).length}function $h(e,t){return e[t]||e.default||e}var eg={skipAnimations:!1},tg=(e,t,n,r={})=>i=>{let a=$h(r,e)||{},o=a.delay||r.delay||0,{elapsed:s=0}=r;s-=Hp(o);let c=Zh(t,e,n,a),l=c[0],u=c[c.length-1],d=Vh(e,l),f=Vh(e,u),p={keyframes:c,velocity:t.getVelocity(),ease:`easeOut`,...a,delay:-s,onUpdate:e=>{t.set(e),a.onUpdate&&a.onUpdate(e)},onComplete:()=>{i(),a.onComplete&&a.onComplete()}};if(Qh(a)||(p={...p,...Bh(e,p)}),p.duration&&=Hp(p.duration),p.repeatDelay&&=Hp(p.repeatDelay),!d||!f||Wp.current||a.type===!1||eg.skipAnimations)return Fh(p);if(!r.isHandoff&&t.owner&&t.owner.current instanceof HTMLElement&&!t.owner.getProps().onUpdate){let n=Ph(t,e,p);if(n)return n}return Dh(p)};function ng(e){return!!(Vd(e)&&e.add)}var rg=e=>/^\-?\d*\.?\d+$/.test(e);function ig(e,t){e.indexOf(t)===-1&&e.push(t)}function ag(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}var og=class{constructor(){this.subscriptions=[]}add(e){return ig(this.subscriptions,e),()=>ag(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(r===1)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}},sg=e=>!isNaN(parseFloat(e)),cg=class{constructor(e,t={}){this.version=`10.18.0`,this.timeDelta=0,this.lastUpdated=0,this.canTrackVelocity=!1,this.events={},this.updateAndNotify=(e,t=!0)=>{this.prev=this.current,this.current=e;let{delta:n,timestamp:r}=np;this.lastUpdated!==r&&(this.timeDelta=n,this.lastUpdated=r,ep.postRender(this.scheduleVelocityCheck)),this.prev!==this.current&&this.events.change&&this.events.change.notify(this.current),this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.scheduleVelocityCheck=()=>ep.postRender(this.velocityCheck),this.velocityCheck=({timestamp:e})=>{e!==this.lastUpdated&&(this.prev=this.current,this.events.velocityChange&&this.events.velocityChange.notify(this.getVelocity()))},this.hasAnimated=!1,this.prev=this.current=e,this.canTrackVelocity=sg(this.current),this.owner=t.owner}onChange(e){return this.on(`change`,e)}on(e,t){this.events[e]||(this.events[e]=new og);let n=this.events[e].add(t);return e===`change`?()=>{n(),ep.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){!t||!this.passiveEffect?this.updateAndNotify(e,t):this.passiveEffect(e,this.updateAndNotify)}setWithVelocity(e,t,n){this.set(t),this.prev=e,this.timeDelta=n}jump(e){this.updateAndNotify(e),this.prev=e,this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return this.current}getPrevious(){return this.prev}getVelocity(){return this.canTrackVelocity?ah(parseFloat(this.current)-parseFloat(this.prev),this.timeDelta):0}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}};function lg(e,t){return new cg(e,t)}var ug=e=>t=>t.test(e),dg=[Zd,Y,cf,sf,uf,lf,{test:e=>e===`auto`,parse:e=>e}],fg=e=>dg.find(ug(e)),pg=[...dg,wm,Um],mg=e=>pg.find(ug(e));function hg(e,t,n){e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,lg(n))}function gg(e,t){let n=zp(e,t),{transitionEnd:r={},transition:i={},...a}=n?e.makeTargetAnimatable(n,!1):{};a={...a,...r};for(let t in a)hg(e,t,Uf(a[t]))}function _g(e,t,n){let r=Object.keys(t).filter(t=>!e.hasValue(t)),i=r.length;if(i)for(let a=0;a<i;a++){let i=r[a],o=t[i],s=null;Array.isArray(o)&&(s=o[0]),s===null&&(s=n[i]??e.readValue(i)??t[i]),s!=null&&(typeof s==`string`&&(rg(s)||Yh(s))?s=parseFloat(s):!mg(s)&&Um.test(o)&&(s=Jh(i,o)),e.addValue(i,lg(s,{owner:e})),n[i]===void 0&&(n[i]=s),s!==null&&e.setBaseTarget(i,s))}}function vg(e,t){return t?(t[e]||t.default||t).from:void 0}function yg(e,t,n){let r={};for(let i in e){let e=vg(i,t);if(e!==void 0)r[i]=e;else{let e=n.getValue(i);e&&(r[i]=e.get())}}return r}function bg({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&t[n]!==!0;return t[n]=!1,r}function xg(e,t){let n=e.get();if(Array.isArray(t)){for(let e=0;e<t.length;e++)if(t[e]!==n)return!0}else return n!==t}function Sg(e,t,{delay:n=0,transitionOverride:r,type:i}={}){let{transition:a=e.getDefaultTransition(),transitionEnd:o,...s}=e.makeTargetAnimatable(t),c=e.getValue(`willChange`);r&&(a=r);let l=[],u=i&&e.animationState&&e.animationState.getState()[i];for(let t in s){let r=e.getValue(t),i=s[t];if(!r||i===void 0||u&&bg(u,t))continue;let o={delay:n,elapsed:0,...$h(a||{},t)};if(window.HandoffAppearAnimations){let n=e.getProps()[pd];if(n){let e=window.HandoffAppearAnimations(n,t,r,ep);e!==null&&(o.elapsed=e,o.isHandoff=!0)}}let d=!o.isHandoff&&!xg(r,i);if(o.type===`spring`&&(r.getVelocity()||o.velocity)&&(d=!1),r.animation&&(d=!1),d)continue;r.start(tg(t,r,i,e.shouldReduceMotion&&zd.has(t)?{type:!1}:o));let f=r.animation;ng(c)&&(c.add(t),f.then(()=>c.remove(t))),l.push(f)}return o&&Promise.all(l).then(()=>{o&&gg(e,o)}),l}function Cg(e,t,n={}){let r=zp(e,t,n.custom),{transition:i=e.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(i=n.transitionOverride);let a=r?()=>Promise.all(Sg(e,r,n)):()=>Promise.resolve(),o=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:a=0,staggerChildren:o,staggerDirection:s}=i;return wg(e,t,a+r,o,s,n)}:()=>Promise.resolve(),{when:s}=i;if(s){let[e,t]=s===`beforeChildren`?[a,o]:[o,a];return e().then(()=>t())}else return Promise.all([a(),o(n.delay)])}function wg(e,t,n=0,r=0,i=1,a){let o=[],s=(e.variantChildren.size-1)*r,c=i===1?(e=0)=>e*r:(e=0)=>s-e*r;return Array.from(e.variantChildren).sort(Tg).forEach((e,r)=>{e.notify(`AnimationStart`,t),o.push(Cg(e,t,{...a,delay:n+c(r)}).then(()=>e.notify(`AnimationComplete`,t)))}),Promise.all(o)}function Tg(e,t){return e.sortNodePosition(t)}function Eg(e,t,n={}){e.notify(`AnimationStart`,t);let r;if(Array.isArray(t)){let i=t.map(t=>Cg(e,t,n));r=Promise.all(i)}else if(typeof t==`string`)r=Cg(e,t,n);else{let i=typeof t==`function`?zp(e,t,n.custom):t;r=Promise.all(Sg(e,i,n))}return r.then(()=>e.notify(`AnimationComplete`,t))}var Dg=[...yd].reverse(),Og=yd.length;function kg(e){return t=>Promise.all(t.map(({animation:t,options:n})=>Eg(e,t,n)))}function Ag(e){let t=kg(e),n=Ng(),r=!0,i=(t,n)=>{let r=zp(e,n);if(r){let{transition:e,transitionEnd:n,...i}=r;t={...t,...i,...n}}return t};function a(n){t=n(e)}function o(a,o){let s=e.getProps(),c=e.getVariantContext(!0)||{},l=[],u=new Set,d={},f=1/0;for(let t=0;t<Og;t++){let p=Dg[t],m=n[p],h=s[p]===void 0?c[p]:s[p],g=_d(h),_=p===o?m.isActive:null;_===!1&&(f=t);let v=h===c[p]&&h!==s[p]&&g;if(v&&r&&e.manuallyAnimateOnMount&&(v=!1),m.protectedKeys={...d},!m.isActive&&_===null||!h&&!m.prevProp||vd(h)||typeof h==`boolean`)continue;let y=jg(m.prevProp,h)||p===o&&m.isActive&&!v&&g||t>f&&g,b=!1,x=Array.isArray(h)?h:[h],S=x.reduce(i,{});_===!1&&(S={});let{prevResolvedValues:C={}}=m,w={...C,...S},T=e=>{y=!0,u.has(e)&&(b=!0,u.delete(e)),m.needsAnimating[e]=!0};for(let e in w){let t=S[e],n=C[e];if(d.hasOwnProperty(e))continue;let r=!1;r=Vf(t)&&Vf(n)?!Ip(t,n):t!==n,r?t===void 0?u.add(e):T(e):t!==void 0&&u.has(e)?T(e):m.protectedKeys[e]=!0}m.prevProp=h,m.prevResolvedValues=S,m.isActive&&(d={...d,...S}),r&&e.blockInitialAnimation&&(y=!1),y&&(!v||b)&&l.push(...x.map(e=>({animation:e,options:{type:p,...a}})))}if(u.size){let t={};u.forEach(n=>{let r=e.getBaseTarget(n);r!==void 0&&(t[n]=r)}),l.push({animation:t})}let p=!!l.length;return r&&(s.initial===!1||s.initial===s.animate)&&!e.manuallyAnimateOnMount&&(p=!1),r=!1,p?t(l):Promise.resolve()}function s(t,r,i){var a;if(n[t].isActive===r)return Promise.resolve();(a=e.variantChildren)==null||a.forEach(e=>e.animationState?.setActive(t,r)),n[t].isActive=r;let s=o(i,t);for(let e in n)n[e].protectedKeys={};return s}return{animateChanges:o,setActive:s,setAnimateFunction:a,getState:()=>n}}function jg(e,t){return typeof t==`string`?t!==e:Array.isArray(t)?!Ip(t,e):!1}function Mg(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Ng(){return{animate:Mg(!0),whileInView:Mg(),whileHover:Mg(),whileTap:Mg(),whileDrag:Mg(),whileFocus:Mg(),exit:Mg()}}var Pg=class extends yp{constructor(e){super(e),e.animationState||=Ag(e)}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();this.unmount(),vd(e)&&(this.unmount=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){}},Fg=0,Ig={animation:{Feature:Pg},exit:{Feature:class extends yp{constructor(){super(...arguments),this.id=Fg++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t,custom:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;let i=this.node.animationState.setActive(`exit`,!e,{custom:n??this.node.getProps().custom});t&&!e&&i.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}}},Lg=()=>({min:0,max:0}),Rg=()=>({x:Lg(),y:Lg()});function zg({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function Bg(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function Vg(e,t){return zg(Bg(e.getBoundingClientRect(),t))}var Hg=/var\((--[a-zA-Z0-9-_]+),? ?([a-zA-Z0-9 ()%#.,-]+)?\)/;function Ug(e){let t=Hg.exec(e);if(!t)return[,];let[,n,r]=t;return[n,r]}function Wg(e,t,n=1){let[r,i]=Ug(e);if(!r)return;let a=window.getComputedStyle(t).getPropertyValue(r);if(a){let e=a.trim();return rg(e)?parseFloat(e):e}else return qd(i)?Wg(i,t,n+1):i}function Gg(e,{...t},n){let r=e.current;if(!(r instanceof Element))return{target:t,transitionEnd:n};n&&={...n},e.values.forEach(e=>{let t=e.get();if(!qd(t))return;let n=Wg(t,r);n&&e.set(n)});for(let e in t){let i=t[e];if(!qd(i))continue;let a=Wg(i,r);a&&(t[e]=a,n||={},n[e]===void 0&&(n[e]=i))}return{target:t,transitionEnd:n}}var Kg=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,`x`,`y`,`translateX`,`translateY`]),qg=e=>Kg.has(e),Jg=e=>Object.keys(e).some(qg),Yg=e=>e===Zd||e===Y,Xg=(e,t)=>parseFloat(e.split(`, `)[t]),Zg=(e,t)=>(n,{transform:r})=>{if(r===`none`||!r)return 0;let i=r.match(/^matrix3d\((.+)\)$/);if(i)return Xg(i[1],t);{let t=r.match(/^matrix\((.+)\)$/);return t?Xg(t[1],e):0}},Qg=new Set([`x`,`y`,`z`]),$g=Rd.filter(e=>!Qg.has(e));function e_(e){let t=[];return $g.forEach(n=>{let r=e.getValue(n);r!==void 0&&(t.push([n,r.get()]),r.set(n.startsWith(`scale`)?1:0))}),t.length&&e.render(),t}var t_={width:({x:e},{paddingLeft:t=`0`,paddingRight:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t=`0`,paddingBottom:n=`0`})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:Zg(4,13),y:Zg(5,14)};t_.translateX=t_.x,t_.translateY=t_.y;var n_=(e,t,n)=>{let r=t.measureViewportBox(),i=t.current,a=getComputedStyle(i),{display:o}=a,s={};o===`none`&&t.setStaticValue(`display`,e.display||`block`),n.forEach(e=>{s[e]=t_[e](r,a)}),t.render();let c=t.measureViewportBox();return n.forEach(n=>{let r=t.getValue(n);r&&r.jump(s[n]),e[n]=t_[n](c,a)}),e},r_=(e,t,n={},r={})=>{t={...t},r={...r};let i=Object.keys(t).filter(qg),a=[],o=!1,s=[];if(i.forEach(i=>{let c=e.getValue(i);if(!e.hasValue(i))return;let l=n[i],u=fg(l),d=t[i],f;if(Vf(d)){let e=d.length,t=d[0]===null?1:0;l=d[t],u=fg(l);for(let n=t;n<e&&d[n]!==null;n++)f?Vp(fg(d[n])===f):f=fg(d[n])}else f=fg(d);if(u!==f)if(Yg(u)&&Yg(f)){let e=c.get();typeof e==`string`&&c.set(parseFloat(e)),typeof d==`string`?t[i]=parseFloat(d):Array.isArray(d)&&f===Y&&(t[i]=d.map(parseFloat))}else u!=null&&u.transform&&f!=null&&f.transform&&(l===0||d===0)?l===0?c.set(f.transform(l)):t[i]=u.transform(d):(o||=(a=e_(e),!0),s.push(i),r[i]=r[i]===void 0?t[i]:r[i],c.jump(d))}),s.length){let n=s.indexOf(`height`)>=0?window.pageYOffset:null,i=n_(t,e,s);return a.length&&a.forEach(([t,n])=>{e.getValue(t).set(n)}),e.render(),ld&&n!==null&&window.scrollTo({top:n}),{target:i,transitionEnd:r}}else return{target:t,transitionEnd:r}};function i_(e,t,n,r){return Jg(t)?r_(e,t,n,r):{target:t,transitionEnd:r}}var a_=(e,t,n,r)=>{let i=Gg(e,t,r);return t=i.target,r=i.transitionEnd,i_(e,t,n,r)},o_={current:null},s_={current:!1};function c_(){if(s_.current=!0,ld)if(window.matchMedia){let e=window.matchMedia(`(prefers-reduced-motion)`),t=()=>o_.current=e.matches;e.addListener(t),t()}else o_.current=!1}function l_(e,t,n){let{willChange:r}=t;for(let i in t){let a=t[i],o=n[i];if(Vd(a))e.addValue(i,a),ng(r)&&r.add(i);else if(Vd(o))e.addValue(i,lg(a,{owner:e})),ng(r)&&r.remove(i);else if(o!==a)if(e.hasValue(i)){let t=e.getValue(i);!t.hasAnimated&&t.set(a)}else{let t=e.getStaticValue(i);e.addValue(i,lg(t===void 0?a:t,{owner:e}))}}for(let r in n)t[r]===void 0&&e.removeValue(r);return t}var u_=new WeakMap,d_=Object.keys(Dd),f_=d_.length,p_=[`AnimationStart`,`AnimationComplete`,`Update`,`BeforeLayoutMeasure`,`LayoutMeasure`,`LayoutAnimationStart`,`LayoutAnimationComplete`],m_=bd.length,h_=class{constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,visualState:i},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify(`Update`,this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.scheduleRender=()=>ep.render(this.render,!1,!0);let{latestValues:o,renderState:s}=i;this.latestValues=o,this.baseTarget={...o},this.initialValues=t.initial?{...o}:{},this.renderState=s,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=a,this.isControllingVariants=xd(t),this.isVariantNode=Sd(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:c,...l}=this.scrapeMotionValuesFromProps(t,{});for(let e in l){let t=l[e];o[e]!==void 0&&Vd(t)&&(t.set(o[e],!1),ng(c)&&c.add(e))}}scrapeMotionValuesFromProps(e,t){return{}}mount(e){this.current=e,u_.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,t)=>this.bindToMotionValue(t,e)),s_.current||c_(),this.shouldReduceMotion=this.reducedMotionConfig===`never`?!1:this.reducedMotionConfig===`always`?!0:o_.current,this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){u_.delete(this.current),this.projection&&this.projection.unmount(),tp(this.notifyUpdate),tp(this.render),this.valueSubscriptions.forEach(e=>e()),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this);for(let e in this.events)this.events[e].clear();for(let e in this.features)this.features[e].unmount();this.current=null}bindToMotionValue(e,t){let n=zd.has(e),r=t.on(`change`,t=>{this.latestValues[e]=t,this.props.onUpdate&&ep.update(this.notifyUpdate,!1,!0),n&&this.projection&&(this.projection.isTransformDirty=!0)}),i=t.on(`renderRequest`,this.scheduleRender);this.valueSubscriptions.set(e,()=>{r(),i()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}loadFeatures({children:e,...t},n,r,i){let a,o;for(let e=0;e<f_;e++){let n=d_[e],{isEnabled:r,Feature:i,ProjectionNode:s,MeasureLayout:c}=Dd[n];s&&(a=s),r(t)&&(!this.features[n]&&i&&(this.features[n]=new i(this)),c&&(o=c))}if((this.type===`html`||this.type===`svg`)&&!this.projection&&a){this.projection=new a(this.latestValues,this.parent&&this.parent.projection);let{layoutId:e,layout:n,drag:r,dragConstraints:o,layoutScroll:s,layoutRoot:c}=t;this.projection.setOptions({layoutId:e,layout:n,alwaysMeasureLayout:!!r||o&&hd(o),visualElement:this,scheduleRender:()=>this.scheduleRender(),animationType:typeof n==`string`?n:`both`,initialPromotionConfig:i,layoutScroll:s,layoutRoot:c})}return o}updateFeatures(){for(let e in this.features){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}triggerBuild(){this.build(this.renderState,this.latestValues,this.options,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Rg()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}makeTargetAnimatable(e,t=!0){return this.makeTargetAnimatableFromInstance(e,this.props,t)}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<p_.length;t++){let n=p_[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e[`on`+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=l_(this,this.scrapeMotionValuesFromProps(e,this.prevProps),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}getVariantContext(e=!1){if(e)return this.parent?this.parent.getVariantContext():void 0;if(!this.isControllingVariants){let e=this.parent&&this.parent.getVariantContext()||{};return this.props.initial!==void 0&&(e.initial=this.props.initial),e}let t={};for(let e=0;e<m_;e++){let n=bd[e],r=this.props[n];(_d(r)||r===!1)&&(t[n]=r)}return t}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){t!==this.values.get(e)&&(this.removeValue(e),this.bindToMotionValue(e,t)),this.values.set(e,t),this.latestValues[e]=t.get()}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return n===void 0&&t!==void 0&&(n=lg(t,{owner:this}),this.addValue(e,n)),n}readValue(e){return this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options)}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){let{initial:t}=this.props,n=typeof t==`string`||typeof t==`object`?zf(this.props,t)?.[e]:void 0;if(t&&n!==void 0)return n;let r=this.getBaseTargetFromProps(this.props,e);return r!==void 0&&!Vd(r)?r:this.initialValues[e]!==void 0&&n===void 0?void 0:this.baseTarget[e]}on(e,t){return this.events[e]||(this.events[e]=new og),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}},g_=class extends h_{sortInstanceNodePosition(e,t){return e.compareDocumentPosition(t)&2?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}makeTargetAnimatableFromInstance({transition:e,transitionEnd:t,...n},{transformValues:r},i){let a=yg(n,e||{},this);if(r&&(t&&=r(t),n&&=r(n),a&&=r(a)),i){_g(this,n,a);let e=a_(this,n,a,t);t=e.transitionEnd,n=e.target}return{transition:e,transitionEnd:t,...n}}};function __(e){return window.getComputedStyle(e)}var v_=class extends g_{constructor(){super(...arguments),this.type=`html`}readValueFromInstance(e,t){if(zd.has(t)){let e=qh(t);return e&&e.default||0}else{let n=__(e),r=(Kd(t)?n.getPropertyValue(t):n[t])||0;return typeof r==`string`?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return Vg(e,t)}build(e,t,n,r){mf(e,t,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,t){return Lf(e,t)}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;Vd(e)&&(this.childSubscription=e.on(`change`,e=>{this.current&&(this.current.textContent=`${e}`)}))}renderInstance(e,t,n,r){Pf(e,t,n,r)}},y_=class extends g_{constructor(){super(...arguments),this.type=`svg`,this.isSVGTag=!1}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(zd.has(t)){let e=qh(t);return e&&e.default||0}return t=Ff.has(t)?t:fd(t),e.getAttribute(t)}measureInstanceViewportBox(){return Rg()}scrapeMotionValuesFromProps(e,t){return Rf(e,t)}build(e,t,n,r){kf(e,t,n,this.isSVGTag,r.transformTemplate)}renderInstance(e,t,n,r){If(e,t,n,r)}mount(e){this.isSVGTag=jf(e.tagName),super.mount(e)}},b_=(e,t)=>Id(e)?new y_(t,{enableHardwareAcceleration:!1}):new v_(t,{enableHardwareAcceleration:!0}),x_=Pd(op);function S_(){let e=(0,l.useRef)(!1);return ud(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function C_(){let e=S_(),[t,n]=(0,l.useState)(0),r=(0,l.useCallback)(()=>{e.current&&n(t+1)},[t]);return[(0,l.useCallback)(()=>ep.postRender(r),[r]),t]}var w_=class extends l.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}};function T_({children:e,isPresent:t}){let n=(0,l.useId)(),r=(0,l.useRef)(null),i=(0,l.useRef)({width:0,height:0,top:0,left:0});return(0,l.useInsertionEffect)(()=>{let{width:e,height:a,top:o,left:s}=i.current;if(t||!r.current||!e||!a)return;r.current.dataset.motionPopId=n;let c=document.createElement(`style`);return document.head.appendChild(c),c.sheet&&c.sheet.insertRule(`
|
|
21
|
+
[data-motion-pop-id="${n}"] {
|
|
22
|
+
position: absolute !important;
|
|
23
|
+
width: ${e}px !important;
|
|
24
|
+
height: ${a}px !important;
|
|
25
|
+
top: ${o}px !important;
|
|
26
|
+
left: ${s}px !important;
|
|
27
|
+
}
|
|
28
|
+
`),()=>{document.head.removeChild(c)}},[t]),l.createElement(w_,{isPresent:t,childRef:r,sizeRef:i},l.cloneElement(e,{ref:r}))}var E_=({children:e,initial:t,isPresent:n,onExitComplete:r,custom:i,presenceAffectsLayout:a,mode:o})=>{let s=Bf(D_),c=(0,l.useId)(),u=(0,l.useMemo)(()=>({id:c,initial:t,isPresent:n,custom:i,onExitComplete:e=>{s.set(e,!0);for(let e of s.values())if(!e)return;r&&r()},register:e=>(s.set(e,!1),()=>s.delete(e))}),a?void 0:[n]);return(0,l.useMemo)(()=>{s.forEach((e,t)=>s.set(t,!1))},[n]),l.useEffect(()=>{!n&&!s.size&&r&&r()},[n]),o===`popLayout`&&(e=l.createElement(T_,{isPresent:n},e)),l.createElement(cd.Provider,{value:u},e)};function D_(){return new Map}function O_(e){return(0,l.useEffect)(()=>()=>e(),[])}var k_=e=>e.key||``;function A_(e,t){e.forEach(e=>{let n=k_(e);t.set(n,e)})}function j_(e){let t=[];return l.Children.forEach(e,e=>{(0,l.isValidElement)(e)&&t.push(e)}),t}var M_=({children:e,custom:t,initial:n=!0,onExitComplete:r,exitBeforeEnter:i,presenceAffectsLayout:a=!0,mode:o=`sync`})=>{let s=(0,l.useContext)(kd).forceRender||C_()[0],c=S_(),u=j_(e),d=u,f=(0,l.useRef)(new Map).current,p=(0,l.useRef)(d),m=(0,l.useRef)(new Map).current,h=(0,l.useRef)(!0);if(ud(()=>{h.current=!1,A_(u,m),p.current=d}),O_(()=>{h.current=!0,m.clear(),f.clear()}),h.current)return l.createElement(l.Fragment,null,d.map(e=>l.createElement(E_,{key:k_(e),isPresent:!0,initial:n?void 0:!1,presenceAffectsLayout:a,mode:o},e)));d=[...d];let g=p.current.map(k_),_=u.map(k_),v=g.length;for(let e=0;e<v;e++){let t=g[e];_.indexOf(t)===-1&&!f.has(t)&&f.set(t,void 0)}return o===`wait`&&f.size&&(d=[]),f.forEach((e,n)=>{if(_.indexOf(n)!==-1)return;let i=m.get(n);if(!i)return;let h=g.indexOf(n),v=e;v||(v=l.createElement(E_,{key:k_(i),isPresent:!1,onExitComplete:()=>{f.delete(n);let e=Array.from(m.keys()).filter(e=>!_.includes(e));if(e.forEach(e=>m.delete(e)),p.current=u.filter(t=>{let r=k_(t);return r===n||e.includes(r)}),!f.size){if(c.current===!1)return;s(),r&&r()}},custom:t,presenceAffectsLayout:a,mode:o},i),f.set(n,v)),d.splice(h,0,v)}),d=d.map(e=>{let t=e.key;return f.has(t)?e:l.createElement(E_,{key:k_(e),isPresent:!0,presenceAffectsLayout:a,mode:o},e)}),l.createElement(l.Fragment,null,f.size?d:d.map(e=>(0,l.cloneElement)(e)))};function N_({children:e,features:t,strict:n=!1}){let[,r]=(0,l.useState)(!P_(t)),i=(0,l.useRef)(void 0);if(!P_(t)){let{renderer:e,...n}=t;i.current=e,Od(n)}return(0,l.useEffect)(()=>{P_(t)&&t().then(({renderer:e,...t})=>{Od(t),i.current=e,r(!0)})},[]),l.createElement(dd.Provider,{value:{renderer:i.current,strict:n}},e)}function P_(e){return typeof e==`function`}var F_={renderer:b_,...Ig,...Fp},I_=typeof document<`u`?l.default.useLayoutEffect:()=>{};String(Math.round(Math.random()*1e10));var L_=l.default.createContext(!1);typeof window<`u`&&window.document&&window.document.createElement,l.default.useId;function R_(){return!1}function z_(){return!0}function B_(e){return()=>{}}function V_(){return typeof l.default.useSyncExternalStore==`function`?l.default.useSyncExternalStore(B_,R_,z_):(0,l.useContext)(L_)}var H_=new Map;function U_(e,t){if(e===t)return e;let n=H_.get(e);if(n)return n(t),t;let r=H_.get(t);return r?(r(e),e):t}function W_(...e){return(...t)=>{for(let n of e)typeof n==`function`&&n(...t)}}var G_=e=>e?.ownerDocument??document,K_=e=>e&&`window`in e&&e.window===e?e:G_(e).defaultView||window;function q_(...e){let t={...e[0]};for(let n=1;n<e.length;n++){let r=e[n];for(let e in r){let n=t[e],i=r[e];typeof n==`function`&&typeof i==`function`&&e[0]===`o`&&e[1]===`n`&&e.charCodeAt(2)>=65&&e.charCodeAt(2)<=90?t[e]=W_(n,i):(e===`className`||e===`UNSAFE_className`)&&typeof n==`string`&&typeof i==`string`?t[e]=H(n,i):e===`id`&&n&&i?t.id=U_(n,i):t[e]=i===void 0?n:i}}return t}function J_(e){if(X_())e.focus({preventScroll:!0});else{let t=Z_(e);e.focus(),Q_(t)}}var Y_=null;function X_(){if(Y_==null){Y_=!1;try{document.createElement(`div`).focus({get preventScroll(){return Y_=!0,!0}})}catch{}}return Y_}function Z_(e){let t=e.parentNode,n=[],r=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==r;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&n.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return r instanceof HTMLElement&&n.push({element:r,scrollTop:r.scrollTop,scrollLeft:r.scrollLeft}),n}function Q_(e){for(let{element:t,scrollTop:n,scrollLeft:r}of e)t.scrollTop=n,t.scrollLeft=r}function $_(e){return typeof window>`u`||window.navigator==null?!1:window.navigator.userAgentData?.brands.some(t=>e.test(t.brand))||e.test(window.navigator.userAgent)}function ev(e){return typeof window<`u`&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function tv(){return ev(/^Mac/i)}function nv(){return $_(/Android/i)}var rv=new Map,iv=new Set;function av(){if(typeof window>`u`)return;function e(e){return`propertyName`in e}let t=t=>{if(!e(t)||!t.target)return;let r=rv.get(t.target);r||(r=new Set,rv.set(t.target,r),t.target.addEventListener(`transitioncancel`,n,{once:!0})),r.add(t.propertyName)},n=t=>{if(!e(t)||!t.target)return;let r=rv.get(t.target);if(r&&(r.delete(t.propertyName),r.size===0&&(t.target.removeEventListener(`transitioncancel`,n),rv.delete(t.target)),rv.size===0)){for(let e of iv)e();iv.clear()}};document.body.addEventListener(`transitionrun`,t),document.body.addEventListener(`transitionend`,n)}typeof document<`u`&&(document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,av):av());function ov(e){requestAnimationFrame(()=>{rv.size===0?e():iv.add(e)})}function sv(){let e=(0,l.useRef)(new Map),t=(0,l.useCallback)((t,n,r,i)=>{let a=i!=null&&i.once?(...t)=>{e.current.delete(r),r(...t)}:r;e.current.set(r,{type:n,eventTarget:t,fn:a,options:i}),t.addEventListener(n,r,i)},[]),n=(0,l.useCallback)((t,n,r,i)=>{let a=e.current.get(r)?.fn||r;t.removeEventListener(n,a,i),e.current.delete(r)},[]),r=(0,l.useCallback)(()=>{e.current.forEach((e,t)=>{n(e.eventTarget,e.type,t,e.options)})},[n]);return(0,l.useEffect)(()=>r,[r]),{addGlobalListener:t,removeGlobalListener:n,removeAllGlobalListeners:r}}function cv(e){let t=(0,l.useRef)(null);return(0,l.useMemo)(()=>({get current(){return t.current},set current(n){t.current=n,typeof e==`function`?e(n):e&&(e.current=n)}}),[e])}var lv=typeof document<`u`&&window.visualViewport;function uv(){let e=V_(),[t,n]=(0,l.useState)(()=>e?{width:0,height:0}:dv());return(0,l.useEffect)(()=>{let e=()=>{n(e=>{let t=dv();return t.width===e.width&&t.height===e.height?e:t})};return lv?lv.addEventListener(`resize`,e):window.addEventListener(`resize`,e),()=>{lv?lv.removeEventListener(`resize`,e):window.removeEventListener(`resize`,e)}},[]),t}function dv(){return{width:lv&&lv?.width||window.innerWidth,height:lv&&lv?.height||window.innerHeight}}function fv(e){return e.mozInputSource===0&&e.isTrusted?!0:nv()&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function pv(e,t,n){let[r,i]=(0,l.useState)(e||t),a=(0,l.useRef)(e!==void 0),o=e!==void 0;(0,l.useEffect)(()=>{a.current,a.current=o},[o]);let s=o?e:r,c=(0,l.useCallback)((e,...t)=>{let r=(e,...t)=>{n&&(Object.is(s,e)||n(e,...t)),o||(s=e)};typeof e==`function`?i((n,...i)=>{let a=e(o?s:n,...i);return r(a,...t),o?n:a}):(o||i(e),r(e,...t))},[o,s,n]);return[s,c]}function mv(e,t=-1/0,n=1/0){return Math.min(Math.max(e,t),n)}function hv(e,t){let n=e,r=t.toString(),i=r.indexOf(`.`),a=i>=0?r.length-i:0;if(a>0){let e=10**a;n=Math.round(n*e)/e}return n}function gv(e,t,n,r){t=Number(t),n=Number(n);let i=(e-(isNaN(t)?0:t))%r,a=hv(Math.abs(i)*2>=r?e+Math.sign(i)*(r-Math.abs(i)):e-i,r);return isNaN(t)?!isNaN(n)&&a>n&&(a=Math.floor(hv(n/r,r))*r):a<t?a=t:!isNaN(n)&&a>n&&(a=t+Math.floor(hv((n-t)/r,r))*r),a=hv(a,r),a}function _v(e,t,n=10){let r=n**+t;return Math.round(e*r)/r}var X={},vv=Lo(Object.freeze(Object.defineProperty({__proto__:null,default:{}},Symbol.toStringTag,{value:`Module`})));(function(e){var t=t||{version:`5.3.0`};if(e.fabric=t,typeof document<`u`&&typeof window<`u`)document instanceof(typeof HTMLDocument<`u`?HTMLDocument:Document)?t.document=document:t.document=document.implementation.createHTMLDocument(``),t.window=window;else{var n=new vv.JSDOM(`<!DOCTYPE html><html><head></head><body></body></html>`,{features:{FetchExternalResources:[`img`]},resources:`usable`}).window;t.document=n.document,t.jsdomImplForWrapper=vv.implForWrapper,t.nodeCanvas=vv.Canvas,t.window=n,DOMParser=t.window.DOMParser}t.isTouchSupported=`ontouchstart`in t.window||`ontouchstart`in t.document||t.window&&t.window.navigator&&t.window.navigator.maxTouchPoints>0,t.isLikelyNode=typeof r.t<`u`&&typeof window>`u`,t.SHARED_ATTRIBUTES=[`display`,`transform`,`fill`,`fill-opacity`,`fill-rule`,`opacity`,`stroke`,`stroke-dasharray`,`stroke-linecap`,`stroke-dashoffset`,`stroke-linejoin`,`stroke-miterlimit`,`stroke-opacity`,`stroke-width`,`id`,`paint-order`,`vector-effect`,`instantiated_by_use`,`clip-path`],t.DPI=96,t.reNum=`(?:[-+]?(?:\\d+|\\d*\\.\\d+)(?:[eE][-+]?\\d+)?)`,t.commaWsp=`(?:\\s+,?\\s*|,\\s*)`,t.rePathCommand=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,t.reNonWord=/[ \n\.,;!\?\-]/,t.fontPaths={},t.iMatrix=[1,0,0,1,0,0],t.svgNS=`http://www.w3.org/2000/svg`,t.perfLimitSizeTotal=2097152,t.maxCacheSideLimit=4096,t.minCacheSideLimit=256,t.charWidthsCache={},t.textureSize=2048,t.disableStyleCopyPaste=!1,t.enableGLFiltering=!0,t.devicePixelRatio=t.window.devicePixelRatio||t.window.webkitDevicePixelRatio||t.window.mozDevicePixelRatio||1,t.browserShadowBlurConstant=1,t.arcToSegmentsCache={},t.boundsOfCurveCache={},t.cachesBoundsOfCurve=!0,t.forceGLPutImageData=!1,t.initFilterBackend=function(){if(t.enableGLFiltering&&t.isWebglSupported&&t.isWebglSupported(t.textureSize))return``+t.maxTextureSize,new t.WebglFilterBackend({tileSize:t.textureSize});if(t.Canvas2dFilterBackend)return new t.Canvas2dFilterBackend},typeof document<`u`&&typeof window<`u`&&(window.fabric=t),function(){function e(e,n){if(this.__eventListeners[e]){var r=this.__eventListeners[e];n?r[r.indexOf(n)]=!1:t.util.array.fill(r,!1)}}function n(e,t){if(this.__eventListeners||={},arguments.length===1)for(var n in e)this.on(n,e[n]);else this.__eventListeners[e]||(this.__eventListeners[e]=[]),this.__eventListeners[e].push(t);return this}function r(e,t){var n=(function(){t.apply(this,arguments),this.off(e,n)}).bind(this);this.on(e,n)}function i(e,t){if(arguments.length===1)for(var n in e)r.call(this,n,e[n]);else r.call(this,e,t);return this}function a(t,n){if(!this.__eventListeners)return this;if(arguments.length===0)for(t in this.__eventListeners)e.call(this,t);else if(arguments.length===1&&typeof arguments[0]==`object`)for(var r in t)e.call(this,r,t[r]);else e.call(this,t,n);return this}function o(e,t){if(!this.__eventListeners)return this;var n=this.__eventListeners[e];if(!n)return this;for(var r=0,i=n.length;r<i;r++)n[r]&&n[r].call(this,t||{});return this.__eventListeners[e]=n.filter(function(e){return e!==!1}),this}t.Observable={fire:o,on:n,once:i,off:a}}(),t.Collection={_objects:[],add:function(){if(this._objects.push.apply(this._objects,arguments),this._onObjectAdded)for(var e=0,t=arguments.length;e<t;e++)this._onObjectAdded(arguments[e]);return this.renderOnAddRemove&&this.requestRenderAll(),this},insertAt:function(e,t,n){var r=this._objects;return n?r[t]=e:r.splice(t,0,e),this._onObjectAdded&&this._onObjectAdded(e),this.renderOnAddRemove&&this.requestRenderAll(),this},remove:function(){for(var e=this._objects,t,n=!1,r=0,i=arguments.length;r<i;r++)t=e.indexOf(arguments[r]),t!==-1&&(n=!0,e.splice(t,1),this._onObjectRemoved&&this._onObjectRemoved(arguments[r]));return this.renderOnAddRemove&&n&&this.requestRenderAll(),this},forEachObject:function(e,t){for(var n=this.getObjects(),r=0,i=n.length;r<i;r++)e.call(t,n[r],r,n);return this},getObjects:function(e){return typeof e>`u`?this._objects.concat():this._objects.filter(function(t){return t.type===e})},item:function(e){return this._objects[e]},isEmpty:function(){return this._objects.length===0},size:function(){return this._objects.length},contains:function(e,t){return this._objects.indexOf(e)>-1?!0:t?this._objects.some(function(t){return typeof t.contains==`function`&&t.contains(e,!0)}):!1},complexity:function(){return this._objects.reduce(function(e,t){return e+=t.complexity?t.complexity():0,e},0)}},t.CommonMethods={_setOptions:function(e){for(var t in e)this.set(t,e[t])},_initGradient:function(e,n){e&&e.colorStops&&!(e instanceof t.Gradient)&&this.set(n,new t.Gradient(e))},_initPattern:function(e,n,r){e&&e.source&&!(e instanceof t.Pattern)?this.set(n,new t.Pattern(e,r)):r&&r()},_setObject:function(e){for(var t in e)this._set(t,e[t])},set:function(e,t){return typeof e==`object`?this._setObject(e):this._set(e,t),this},_set:function(e,t){this[e]=t},toggle:function(e){var t=this.get(e);return typeof t==`boolean`&&this.set(e,!t),this},get:function(e){return this[e]}},function(e){var n=Math.sqrt,r=Math.atan2,i=Math.pow,a=Math.PI/180,o=Math.PI/2;t.util={cos:function(e){if(e===0)return 1;switch(e<0&&(e=-e),e/o){case 1:case 3:return 0;case 2:return-1}return Math.cos(e)},sin:function(e){if(e===0)return 0;var t=e/o,n=1;switch(e<0&&(n=-1),t){case 1:return n;case 2:return 0;case 3:return-n}return Math.sin(e)},removeFromArray:function(e,t){var n=e.indexOf(t);return n!==-1&&e.splice(n,1),e},getRandomInt:function(e,t){return Math.floor(Math.random()*(t-e+1))+e},degreesToRadians:function(e){return e*a},radiansToDegrees:function(e){return e/a},rotatePoint:function(e,n,r){var i=new t.Point(e.x-n.x,e.y-n.y),a=t.util.rotateVector(i,r);return new t.Point(a.x,a.y).addEquals(n)},rotateVector:function(e,n){var r=t.util.sin(n),i=t.util.cos(n);return{x:e.x*i-e.y*r,y:e.x*r+e.y*i}},createVector:function(e,n){return new t.Point(n.x-e.x,n.y-e.y)},calcAngleBetweenVectors:function(e,t){return Math.acos((e.x*t.x+e.y*t.y)/(Math.hypot(e.x,e.y)*Math.hypot(t.x,t.y)))},getHatVector:function(e){return new t.Point(e.x,e.y).multiply(1/Math.hypot(e.x,e.y))},getBisector:function(e,n,r){var i=t.util.createVector(e,n),a=t.util.createVector(e,r),o=t.util.calcAngleBetweenVectors(i,a),s=o*(t.util.calcAngleBetweenVectors(t.util.rotateVector(i,o),a)===0?1:-1)/2;return{vector:t.util.getHatVector(t.util.rotateVector(i,s)),angle:o}},projectStrokeOnPoints:function(e,n,r){var i=[],a=n.strokeWidth/2,o=n.strokeUniform?new t.Point(1/n.scaleX,1/n.scaleY):new t.Point(1,1),s=function(e){var n=a/Math.hypot(e.x,e.y);return new t.Point(e.x*n*o.x,e.y*n*o.y)};return e.length<=1||e.forEach(function(c,l){var u=new t.Point(c.x,c.y),d,f;l===0?(f=e[l+1],d=r?s(t.util.createVector(f,u)).addEquals(u):e[e.length-1]):l===e.length-1?(d=e[l-1],f=r?s(t.util.createVector(d,u)).addEquals(u):e[0]):(d=e[l-1],f=e[l+1]);var p=t.util.getBisector(u,d,f),m=p.vector,h=p.angle,g,_;if(n.strokeLineJoin===`miter`&&(g=-a/Math.sin(h/2),_=new t.Point(m.x*g*o.x,m.y*g*o.y),Math.hypot(_.x,_.y)/a<=n.strokeMiterLimit)){i.push(u.add(_)),i.push(u.subtract(_));return}g=-a*Math.SQRT2,_=new t.Point(m.x*g*o.x,m.y*g*o.y),i.push(u.add(_)),i.push(u.subtract(_))}),i},transformPoint:function(e,n,r){return r?new t.Point(n[0]*e.x+n[2]*e.y,n[1]*e.x+n[3]*e.y):new t.Point(n[0]*e.x+n[2]*e.y+n[4],n[1]*e.x+n[3]*e.y+n[5])},makeBoundingBoxFromPoints:function(e,n){if(n)for(var r=0;r<e.length;r++)e[r]=t.util.transformPoint(e[r],n);var i=[e[0].x,e[1].x,e[2].x,e[3].x],a=t.util.array.min(i),o=t.util.array.max(i)-a,s=[e[0].y,e[1].y,e[2].y,e[3].y],c=t.util.array.min(s);return{left:a,top:c,width:o,height:t.util.array.max(s)-c}},invertTransform:function(e){var n=1/(e[0]*e[3]-e[1]*e[2]),r=[n*e[3],-n*e[1],-n*e[2],n*e[0]],i=t.util.transformPoint({x:e[4],y:e[5]},r,!0);return r[4]=-i.x,r[5]=-i.y,r},toFixed:function(e,t){return parseFloat(Number(e).toFixed(t))},parseUnit:function(e,n){var r=/\D{0,2}$/.exec(e),i=parseFloat(e);switch(n||=t.Text.DEFAULT_SVG_FONT_SIZE,r[0]){case`mm`:return i*t.DPI/25.4;case`cm`:return i*t.DPI/2.54;case`in`:return i*t.DPI;case`pt`:return i*t.DPI/72;case`pc`:return i*t.DPI/72*12;case`em`:return i*n;default:return i}},falseFunction:function(){return!1},getKlass:function(e,n){return e=t.util.string.camelize(e.charAt(0).toUpperCase()+e.slice(1)),t.util.resolveNamespace(n)[e]},getSvgAttributes:function(e){var t=[`instantiated_by_use`,`style`,`id`,`class`];switch(e){case`linearGradient`:t=t.concat([`x1`,`y1`,`x2`,`y2`,`gradientUnits`,`gradientTransform`]);break;case`radialGradient`:t=t.concat([`gradientUnits`,`gradientTransform`,`cx`,`cy`,`r`,`fx`,`fy`,`fr`]);break;case`stop`:t=t.concat([`offset`,`stop-color`,`stop-opacity`]);break}return t},resolveNamespace:function(n){if(!n)return t;var r=n.split(`.`),i=r.length,a,o=e||t.window;for(a=0;a<i;++a)o=o[r[a]];return o},loadImage:function(e,n,r,i){if(!e){n&&n.call(r,e);return}var a=t.util.createImage(),o=function(){n&&n.call(r,a,!1),a=a.onload=a.onerror=null};a.onload=o,a.onerror=function(){t.log(`Error loading `+a.src),n&&n.call(r,null,!0),a=a.onload=a.onerror=null},e.indexOf(`data`)!==0&&i!=null&&(a.crossOrigin=i),e.substring(0,14)===`data:image/svg`&&(a.onload=null,t.util.loadImageInDom(a,o)),a.src=e},loadImageInDom:function(e,n){var r=t.document.createElement(`div`);r.style.width=r.style.height=`1px`,r.style.left=r.style.top=`-100%`,r.style.position=`absolute`,r.appendChild(e),t.document.querySelector(`body`).appendChild(r),e.onload=function(){n(),r.parentNode.removeChild(r),r=null}},enlivenObjects:function(e,n,r,i){e||=[];var a=[],o=0,s=e.length;function c(){++o===s&&n&&n(a.filter(function(e){return e}))}if(!s){n&&n(a);return}e.forEach(function(e,n){if(!e||!e.type){c();return}t.util.getKlass(e.type,r).fromObject(e,function(t,r){r||(a[n]=t),i&&i(e,t,r),c()})})},enlivenObjectEnlivables:function(e,n,r){var i=t.Object.ENLIVEN_PROPS.filter(function(t){return!!e[t]});t.util.enlivenObjects(i.map(function(t){return e[t]}),function(e){var t={};i.forEach(function(r,i){t[r]=e[i],n&&(n[r]=e[i])}),r&&r(t)})},enlivenPatterns:function(e,n){e||=[];function r(){++a===o&&n&&n(i)}var i=[],a=0,o=e.length;if(!o){n&&n(i);return}e.forEach(function(e,n){e&&e.source?new t.Pattern(e,function(e){i[n]=e,r()}):(i[n]=e,r())})},groupSVGElements:function(e,n,r){var i;return e&&e.length===1?(typeof r<`u`&&(e[0].sourcePath=r),e[0]):(n&&(n.width&&n.height?n.centerPoint={x:n.width/2,y:n.height/2}:(delete n.width,delete n.height)),i=new t.Group(e,n),typeof r<`u`&&(i.sourcePath=r),i)},populateWithProperties:function(e,t,n){if(n&&Array.isArray(n))for(var r=0,i=n.length;r<i;r++)n[r]in e&&(t[n[r]]=e[n[r]])},createCanvasElement:function(){return t.document.createElement(`canvas`)},copyCanvasElement:function(e){var n=t.util.createCanvasElement();return n.width=e.width,n.height=e.height,n.getContext(`2d`).drawImage(e,0,0),n},toDataURL:function(e,t,n){return e.toDataURL(`image/`+t,n)},createImage:function(){return t.document.createElement(`img`)},multiplyTransformMatrices:function(e,t,n){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],n?0:e[0]*t[4]+e[2]*t[5]+e[4],n?0:e[1]*t[4]+e[3]*t[5]+e[5]]},qrDecompose:function(e){var t=r(e[1],e[0]),o=i(e[0],2)+i(e[1],2),s=n(o),c=(e[0]*e[3]-e[2]*e[1])/s,l=r(e[0]*e[2]+e[1]*e[3],o);return{angle:t/a,scaleX:s,scaleY:c,skewX:l/a,skewY:0,translateX:e[4],translateY:e[5]}},calcRotateMatrix:function(e){if(!e.angle)return t.iMatrix.concat();var n=t.util.degreesToRadians(e.angle),r=t.util.cos(n),i=t.util.sin(n);return[r,i,-i,r,0,0]},calcDimensionsMatrix:function(e){var n=typeof e.scaleX>`u`?1:e.scaleX,r=typeof e.scaleY>`u`?1:e.scaleY,i=[e.flipX?-n:n,0,0,e.flipY?-r:r,0,0],a=t.util.multiplyTransformMatrices,o=t.util.degreesToRadians;return e.skewX&&(i=a(i,[1,0,Math.tan(o(e.skewX)),1],!0)),e.skewY&&(i=a(i,[1,Math.tan(o(e.skewY)),0,1],!0)),i},composeMatrix:function(e){var n=[1,0,0,1,e.translateX||0,e.translateY||0],r=t.util.multiplyTransformMatrices;return e.angle&&(n=r(n,t.util.calcRotateMatrix(e))),(e.scaleX!==1||e.scaleY!==1||e.skewX||e.skewY||e.flipX||e.flipY)&&(n=r(n,t.util.calcDimensionsMatrix(e))),n},resetObjectTransform:function(e){e.scaleX=1,e.scaleY=1,e.skewX=0,e.skewY=0,e.flipX=!1,e.flipY=!1,e.rotate(0)},saveObjectTransform:function(e){return{scaleX:e.scaleX,scaleY:e.scaleY,skewX:e.skewX,skewY:e.skewY,angle:e.angle,left:e.left,flipX:e.flipX,flipY:e.flipY,top:e.top}},isTransparent:function(e,t,n,r){r>0&&(t>r?t-=r:t=0,n>r?n-=r:n=0);var i=!0,a,o,s=e.getImageData(t,n,r*2||1,r*2||1),c=s.data.length;for(a=3;a<c&&(o=s.data[a],i=o<=0,i!==!1);a+=4);return s=null,i},parsePreserveAspectRatioAttribute:function(e){var t=`meet`,n=`Mid`,r=`Mid`,i=e.split(` `),a;return i&&i.length&&(t=i.pop(),t!==`meet`&&t!==`slice`?(a=t,t=`meet`):i.length&&(a=i.pop())),n=a===`none`?`none`:a.slice(1,4),r=a===`none`?`none`:a.slice(5,8),{meetOrSlice:t,alignX:n,alignY:r}},clearFabricFontCache:function(e){e=(e||``).toLowerCase(),e?t.charWidthsCache[e]&&delete t.charWidthsCache[e]:t.charWidthsCache={}},limitDimsByArea:function(e,t){var n=Math.sqrt(t*e),r=Math.floor(t/n);return{x:Math.floor(n),y:r}},capValue:function(e,t,n){return Math.max(e,Math.min(t,n))},findScaleToFit:function(e,t){return Math.min(t.width/e.width,t.height/e.height)},findScaleToCover:function(e,t){return Math.max(t.width/e.width,t.height/e.height)},matrixToSVG:function(e){return`matrix(`+e.map(function(e){return t.util.toFixed(e,t.Object.NUM_FRACTION_DIGITS)}).join(` `)+`)`},removeTransformFromObject:function(e,n){var r=t.util.invertTransform(n),i=t.util.multiplyTransformMatrices(r,e.calcOwnMatrix());t.util.applyTransformToObject(e,i)},addTransformToObject:function(e,n){t.util.applyTransformToObject(e,t.util.multiplyTransformMatrices(n,e.calcOwnMatrix()))},applyTransformToObject:function(e,n){var r=t.util.qrDecompose(n),i=new t.Point(r.translateX,r.translateY);e.flipX=!1,e.flipY=!1,e.set(`scaleX`,r.scaleX),e.set(`scaleY`,r.scaleY),e.skewX=r.skewX,e.skewY=r.skewY,e.angle=r.angle,e.setPositionByOrigin(i,`center`,`center`)},sizeAfterTransform:function(e,n,r){var i=e/2,a=n/2,o=[{x:-i,y:-a},{x:i,y:-a},{x:-i,y:a},{x:i,y:a}],s=t.util.calcDimensionsMatrix(r),c=t.util.makeBoundingBoxFromPoints(o,s);return{x:c.width,y:c.height}},mergeClipPaths:function(e,n){var r=e,i=n;r.inverted&&!i.inverted&&(r=n,i=e),t.util.applyTransformToObject(i,t.util.multiplyTransformMatrices(t.util.invertTransform(r.calcTransformMatrix()),i.calcTransformMatrix()));var a=r.inverted&&i.inverted;return a&&(r.inverted=i.inverted=!1),new t.Group([r],{clipPath:i,inverted:a})},hasStyleChanged:function(e,t,n){return n||=!1,e.fill!==t.fill||e.stroke!==t.stroke||e.strokeWidth!==t.strokeWidth||e.fontSize!==t.fontSize||e.fontFamily!==t.fontFamily||e.fontWeight!==t.fontWeight||e.fontStyle!==t.fontStyle||e.textBackgroundColor!==t.textBackgroundColor||e.deltaY!==t.deltaY||n&&(e.overline!==t.overline||e.underline!==t.underline||e.linethrough!==t.linethrough)},stylesToArray:function(e,n){for(var e=t.util.object.clone(e,!0),r=n.split(`
|
|
29
|
+
`),i=-1,a={},o=[],s=0;s<r.length;s++){if(!e[s]){i+=r[s].length;continue}for(var c=0;c<r[s].length;c++){i++;var l=e[s][c];l&&Object.keys(l).length>0&&(t.util.hasStyleChanged(a,l,!0)?o.push({start:i,end:i+1,style:l}):o[o.length-1].end++),a=l||{}}}return o},stylesFromArray:function(e,t){if(!Array.isArray(e))return e;for(var n=t.split(`
|
|
30
|
+
`),r=-1,i=0,a={},o=0;o<n.length;o++)for(var s=0;s<n[o].length;s++)r++,e[i]&&e[i].start<=r&&r<e[i].end&&(a[o]=a[o]||{},a[o][s]=Object.assign({},e[i].style),r===e[i].end-1&&i++);return a}}}(e),function(){var e=Array.prototype.join,n={m:2,l:2,h:1,v:1,c:6,s:4,q:4,t:2,a:7},r={m:`l`,M:`L`};function i(e,n,r,i,a,o,s,c,l,u,d){var f=t.util.cos(e),p=t.util.sin(e),m=t.util.cos(n),h=t.util.sin(n),g=r*a*m-i*o*h+s,_=i*a*m+r*o*h+c;return[`C`,u+l*(-r*a*p-i*o*f),d+l*(-i*a*p+r*o*f),g+l*(r*a*h+i*o*m),_+l*(i*a*h-r*o*m),g,_]}function a(e,n,r,a,s,c,l){var u=Math.PI,d=l*u/180,f=t.util.sin(d),p=t.util.cos(d),m=0,h=0;r=Math.abs(r),a=Math.abs(a);var g=-p*e*.5-f*n*.5,_=-p*n*.5+f*e*.5,v=r*r,y=a*a,b=_*_,x=g*g,S=v*y-v*b-y*x,C=0;if(S<0){var w=Math.sqrt(1-S/(v*y));r*=w,a*=w}else C=(s===c?-1:1)*Math.sqrt(S/(v*b+y*x));var T=C*r*_/a,E=-C*a*g/r,D=p*T-f*E+e*.5,O=f*T+p*E+n*.5,k=o(1,0,(g-T)/r,(_-E)/a),A=o((g-T)/r,(_-E)/a,(-g-T)/r,(-_-E)/a);c===0&&A>0?A-=2*u:c===1&&A<0&&(A+=2*u);for(var j=Math.ceil(Math.abs(A/u*2)),M=[],N=A/j,P=8/3*Math.sin(N/4)*Math.sin(N/4)/Math.sin(N/2),ee=k+N,F=0;F<j;F++)M[F]=i(k,ee,p,f,r,a,D,O,P,m,h),m=M[F][5],h=M[F][6],k=ee,ee+=N;return M}function o(e,t,n,r){var i=Math.atan2(t,e),a=Math.atan2(r,n);return a>=i?a-i:2*Math.PI-(i-a)}function s(n,r,i,a,o,s,c,l){var u;if(t.cachesBoundsOfCurve&&(u=e.call(arguments),t.boundsOfCurveCache[u]))return t.boundsOfCurveCache[u];var d=Math.sqrt,f=Math.min,p=Math.max,m=Math.abs,h=[],g=[[],[]],_,v=6*n-12*i+6*o,y,b,x,S,C,w;_=-3*n+9*i-9*o+3*c,y=3*i-3*n;for(var T=0;T<2;++T){if(T>0&&(v=6*r-12*a+6*s,_=-3*r+9*a-9*s+3*l,y=3*a-3*r),m(_)<1e-12){if(m(v)<1e-12)continue;b=-y/v,0<b&&b<1&&h.push(b);continue}C=v*v-4*y*_,!(C<0)&&(w=d(C),x=(-v+w)/(2*_),0<x&&x<1&&h.push(x),S=(-v-w)/(2*_),0<S&&S<1&&h.push(S))}for(var E,D,O=h.length,k=O,A;O--;)b=h[O],A=1-b,E=A*A*A*n+3*A*A*b*i+3*A*b*b*o+b*b*b*c,g[0][O]=E,D=A*A*A*r+3*A*A*b*a+3*A*b*b*s+b*b*b*l,g[1][O]=D;g[0][k]=n,g[1][k]=r,g[0][k+1]=c,g[1][k+1]=l;var j=[{x:f.apply(null,g[0]),y:f.apply(null,g[1])},{x:p.apply(null,g[0]),y:p.apply(null,g[1])}];return t.cachesBoundsOfCurve&&(t.boundsOfCurveCache[u]=j),j}function c(e,t,n){for(var r=n[1],i=n[2],o=n[3],s=n[4],c=n[5],l=n[6],u=n[7],d=a(l-e,u-t,r,i,s,c,o),f=0,p=d.length;f<p;f++)d[f][1]+=e,d[f][2]+=t,d[f][3]+=e,d[f][4]+=t,d[f][5]+=e,d[f][6]+=t;return d}function l(e){var t=0,n=0,r=e.length,i=0,a=0,o,s,l,u=[],d,f,p;for(s=0;s<r;++s){switch(l=!1,o=e[s].slice(0),o[0]){case`l`:o[0]=`L`,o[1]+=t,o[2]+=n;case`L`:t=o[1],n=o[2];break;case`h`:o[1]+=t;case`H`:o[0]=`L`,o[2]=n,t=o[1];break;case`v`:o[1]+=n;case`V`:o[0]=`L`,n=o[1],o[1]=t,o[2]=n;break;case`m`:o[0]=`M`,o[1]+=t,o[2]+=n;case`M`:t=o[1],n=o[2],i=o[1],a=o[2];break;case`c`:o[0]=`C`,o[1]+=t,o[2]+=n,o[3]+=t,o[4]+=n,o[5]+=t,o[6]+=n;case`C`:f=o[3],p=o[4],t=o[5],n=o[6];break;case`s`:o[0]=`S`,o[1]+=t,o[2]+=n,o[3]+=t,o[4]+=n;case`S`:d===`C`?(f=2*t-f,p=2*n-p):(f=t,p=n),t=o[3],n=o[4],o[0]=`C`,o[5]=o[3],o[6]=o[4],o[3]=o[1],o[4]=o[2],o[1]=f,o[2]=p,f=o[3],p=o[4];break;case`q`:o[0]=`Q`,o[1]+=t,o[2]+=n,o[3]+=t,o[4]+=n;case`Q`:f=o[1],p=o[2],t=o[3],n=o[4];break;case`t`:o[0]=`T`,o[1]+=t,o[2]+=n;case`T`:d===`Q`?(f=2*t-f,p=2*n-p):(f=t,p=n),o[0]=`Q`,t=o[1],n=o[2],o[1]=f,o[2]=p,o[3]=t,o[4]=n;break;case`a`:o[0]=`A`,o[6]+=t,o[7]+=n;case`A`:l=!0,u=u.concat(c(t,n,o)),t=o[6],n=o[7];break;case`z`:case`Z`:t=i,n=a;break}l||u.push(o),d=o[0]}return u}function u(e,t,n,r){return Math.sqrt((n-e)*(n-e)+(r-t)*(r-t))}function d(e){return e*e*e}function f(e){return 3*e*e*(1-e)}function p(e){return 3*e*(1-e)*(1-e)}function m(e){return(1-e)*(1-e)*(1-e)}function h(e,t,n,r,i,a,o,s){return function(c){var l=d(c),u=f(c),h=p(c),g=m(c);return{x:o*l+i*u+n*h+e*g,y:s*l+a*u+r*h+t*g}}}function g(e,t,n,r,i,a,o,s){return function(c){var l=1-c,u=3*l*l*(n-e)+6*l*c*(i-n)+3*c*c*(o-i),d=3*l*l*(r-t)+6*l*c*(a-r)+3*c*c*(s-a);return Math.atan2(d,u)}}function _(e){return e*e}function v(e){return 2*e*(1-e)}function y(e){return(1-e)*(1-e)}function b(e,t,n,r,i,a){return function(o){var s=_(o),c=v(o),l=y(o);return{x:i*s+n*c+e*l,y:a*s+r*c+t*l}}}function x(e,t,n,r,i,a){return function(o){var s=1-o,c=2*s*(n-e)+2*o*(i-n),l=2*s*(r-t)+2*o*(a-r);return Math.atan2(l,c)}}function S(e,t,n){var r={x:t,y:n},i,a=0,o;for(o=1;o<=100;o+=1)i=e(o/100),a+=u(r.x,r.y,i.x,i.y),r=i;return a}function C(e,t){for(var n=0,r=0,i=e.iterator,a={x:e.x,y:e.y},o,s,c=.01,l=e.angleFinder,d;r<t&&c>1e-4;)o=i(n),d=n,s=u(a.x,a.y,o.x,o.y),s+r>t?(n-=c,c/=2):(a=o,n+=c,r+=s);return o.angle=l(d),o}function w(e){for(var t=0,n=e.length,r,i=0,a=0,o=0,s=0,c=[],l,d,f,p=0;p<n;p++){switch(r=e[p],d={x:i,y:a,command:r[0]},r[0]){case`M`:d.length=0,o=i=r[1],s=a=r[2];break;case`L`:d.length=u(i,a,r[1],r[2]),i=r[1],a=r[2];break;case`C`:l=h(i,a,r[1],r[2],r[3],r[4],r[5],r[6]),f=g(i,a,r[1],r[2],r[3],r[4],r[5],r[6]),d.iterator=l,d.angleFinder=f,d.length=S(l,i,a),i=r[5],a=r[6];break;case`Q`:l=b(i,a,r[1],r[2],r[3],r[4]),f=x(i,a,r[1],r[2],r[3],r[4]),d.iterator=l,d.angleFinder=f,d.length=S(l,i,a),i=r[3],a=r[4];break;case`Z`:case`z`:d.destX=o,d.destY=s,d.length=u(i,a,o,s),i=o,a=s;break}t+=d.length,c.push(d)}return c.push({length:t,x:i,y:a}),c}function T(e,n,r){r||=w(e);for(var i=0;n-r[i].length>0&&i<r.length-2;)n-=r[i].length,i++;var a=r[i],o=n/a.length,s=a.command,c=e[i],l;switch(s){case`M`:return{x:a.x,y:a.y,angle:0};case`Z`:case`z`:return l=new t.Point(a.x,a.y).lerp(new t.Point(a.destX,a.destY),o),l.angle=Math.atan2(a.destY-a.y,a.destX-a.x),l;case`L`:return l=new t.Point(a.x,a.y).lerp(new t.Point(c[1],c[2]),o),l.angle=Math.atan2(c[2]-a.y,c[1]-a.x),l;case`C`:return C(a,n);case`Q`:return C(a,n)}}function E(e){var i=[],a=[],o,s,c=t.rePathCommand,l=`[-+]?(?:\\d*\\.\\d+|\\d+\\.?)(?:[eE][-+]?\\d+)?\\s*`,u=`(`+l+`)`+t.commaWsp,d=`([01])`+t.commaWsp+`?`,f=u+`?`+u+`?`+u+d+d+u+`?(`+l+`)`,p=new RegExp(f,`g`),m,h,g;if(!e||!e.match)return i;g=e.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);for(var _=0,v,y=g.length;_<y;_++){o=g[_],h=o.slice(1).trim(),a.length=0;var b=o.charAt(0);if(v=[b],b.toLowerCase()===`a`)for(var x;x=p.exec(h);)for(var S=1;S<x.length;S++)a.push(x[S]);else for(;m=c.exec(h);)a.push(m[0]);for(var S=0,C=a.length;S<C;S++)s=parseFloat(a[S]),isNaN(s)||v.push(s);var w=n[b.toLowerCase()],T=r[b]||b;if(v.length-1>w)for(var E=1,D=v.length;E<D;E+=w)i.push([b].concat(v.slice(E,E+w))),b=T;else i.push(v)}return i}function D(e,n){var r=[],i,a=new t.Point(e[0].x,e[0].y),o=new t.Point(e[1].x,e[1].y),s=e.length,c=1,l=0,u=s>2;for(n||=0,u&&(c=e[2].x<o.x?-1:e[2].x===o.x?0:1,l=e[2].y<o.y?-1:e[2].y===o.y?0:1),r.push([`M`,a.x-c*n,a.y-l*n]),i=1;i<s;i++){if(!a.eq(o)){var d=a.midPointFrom(o);r.push([`Q`,a.x,a.y,d.x,d.y])}a=e[i],i+1<e.length&&(o=e[i+1])}return u&&(c=a.x>e[i-2].x?1:a.x===e[i-2].x?0:-1,l=a.y>e[i-2].y?1:a.y===e[i-2].y?0:-1),r.push([`L`,a.x+c*n,a.y+l*n]),r}function O(e,n,r){return r&&(n=t.util.multiplyTransformMatrices(n,[1,0,0,1,-r.x,-r.y])),e.map(function(e){for(var r=e.slice(0),i={},a=1;a<e.length-1;a+=2)i.x=e[a],i.y=e[a+1],i=t.util.transformPoint(i,n),r[a]=i.x,r[a+1]=i.y;return r})}t.util.joinPath=function(e){return e.map(function(e){return e.join(` `)}).join(` `)},t.util.parsePath=E,t.util.makePathSimpler=l,t.util.getSmoothPathFromPoints=D,t.util.getPathSegmentsInfo=w,t.util.getBoundsOfCurve=s,t.util.getPointOnPath=T,t.util.transformPath=O}(),function(){var e=Array.prototype.slice;function n(t,n){for(var r=e.call(arguments,2),i=[],a=0,o=t.length;a<o;a++)i[a]=r.length?t[a][n].apply(t[a],r):t[a][n].call(t[a]);return i}function r(e,t){return o(e,t,function(e,t){return e>=t})}function i(e,t){return o(e,t,function(e,t){return e<t})}function a(e,t){for(var n=e.length;n--;)e[n]=t;return e}function o(e,t,n){if(!(!e||e.length===0)){var r=e.length-1,i=t?e[r][t]:e[r];if(t)for(;r--;)n(e[r][t],i)&&(i=e[r][t]);else for(;r--;)n(e[r],i)&&(i=e[r]);return i}}t.util.array={fill:a,invoke:n,min:i,max:r}}(),function(){function e(n,r,i){if(i)if(!t.isLikelyNode&&r instanceof Element)n=r;else if(r instanceof Array){n=[];for(var a=0,o=r.length;a<o;a++)n[a]=e({},r[a],i)}else if(r&&typeof r==`object`)for(var s in r)s===`canvas`||s===`group`?n[s]=null:r.hasOwnProperty(s)&&(n[s]=e({},r[s],i));else n=r;else for(var s in r)n[s]=r[s];return n}function n(t,n){return e({},t,n)}t.util.object={extend:e,clone:n},t.util.object.extend(t.util,t.Observable)}(),function(){function e(e){return e.replace(/-+(.)?/g,function(e,t){return t?t.toUpperCase():``})}function n(e,t){return e.charAt(0).toUpperCase()+(t?e.slice(1):e.slice(1).toLowerCase())}function r(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}function i(e){var t=0,n,r=[];for(t=0;t<e.length;t++)(n=a(e,t))!==!1&&r.push(n);return r}function a(e,t){var n=e.charCodeAt(t);if(isNaN(n))return``;if(n<55296||n>57343)return e.charAt(t);if(55296<=n&&n<=56319){if(e.length<=t+1)throw`High surrogate without following low surrogate`;var r=e.charCodeAt(t+1);if(56320>r||r>57343)throw`High surrogate without following low surrogate`;return e.charAt(t)+e.charAt(t+1)}if(t===0)throw`Low surrogate without preceding high surrogate`;var i=e.charCodeAt(t-1);if(55296>i||i>56319)throw`Low surrogate without preceding high surrogate`;return!1}t.util.string={camelize:e,capitalize:n,escapeXml:r,graphemeSplit:i}}(),function(){var e=Array.prototype.slice,n=function(){},r=function(){for(var e in{toString:1})if(e===`toString`)return!1;return!0}(),i=function(e,t,n){for(var i in t)i in e.prototype&&typeof e.prototype[i]==`function`&&(t[i]+``).indexOf(`callSuper`)>-1?e.prototype[i]=function(e){return function(){var r=this.constructor.superclass;this.constructor.superclass=n;var i=t[e].apply(this,arguments);if(this.constructor.superclass=r,e!==`initialize`)return i}}(i):e.prototype[i]=t[i],r&&(t.toString!==Object.prototype.toString&&(e.prototype.toString=t.toString),t.valueOf!==Object.prototype.valueOf&&(e.prototype.valueOf=t.valueOf))};function a(){}function o(t){for(var n=null,r=this;r.constructor.superclass;){var i=r.constructor.superclass.prototype[t];if(r[t]!==i){n=i;break}r=r.constructor.superclass.prototype}return n?arguments.length>1?n.apply(this,e.call(arguments,1)):n.call(this):console.log(`tried to callSuper `+t+`, method not found in prototype chain`,this)}function s(){var t=null,r=e.call(arguments,0);typeof r[0]==`function`&&(t=r.shift());function s(){this.initialize.apply(this,arguments)}s.superclass=t,s.subclasses=[],t&&(a.prototype=t.prototype,s.prototype=new a,t.subclasses.push(s));for(var c=0,l=r.length;c<l;c++)i(s,r[c],t);return s.prototype.initialize||(s.prototype.initialize=n),s.prototype.constructor=s,s.prototype.callSuper=o,s}t.util.createClass=s}(),function(){var e=!!t.document.createElement(`div`).attachEvent,n=[`touchstart`,`touchmove`,`touchend`];t.util.addListener=function(t,n,r,i){t&&t.addEventListener(n,r,e?!1:i)},t.util.removeListener=function(t,n,r,i){t&&t.removeEventListener(n,r,e?!1:i)};function r(e){var t=e.changedTouches;return t&&t[0]?t[0]:e}t.util.getPointer=function(e){var n=e.target,i=t.util.getScrollLeftTop(n),a=r(e);return{x:a.clientX+i.left,y:a.clientY+i.top}},t.util.isTouchEvent=function(e){return n.indexOf(e.type)>-1||e.pointerType===`touch`}}(),function(){function e(e,t){var n=e.style;if(!n)return e;if(typeof t==`string`)return e.style.cssText+=`;`+t,t.indexOf(`opacity`)>-1?o(e,t.match(/opacity:\s*(\d?\.?\d*)/)[1]):e;for(var r in t)if(r===`opacity`)o(e,t[r]);else{var i=r===`float`||r===`cssFloat`?typeof n.styleFloat>`u`?`cssFloat`:`styleFloat`:r;n.setProperty(i,t[r])}return e}var n=t.document.createElement(`div`),r=typeof n.style.opacity==`string`,i=typeof n.style.filter==`string`,a=/alpha\s*\(\s*opacity\s*=\s*([^\)]+)\)/,o=function(e){return e};r?o=function(e,t){return e.style.opacity=t,e}:i&&(o=function(e,t){var n=e.style;return e.currentStyle&&!e.currentStyle.hasLayout&&(n.zoom=1),a.test(n.filter)?(t=t>=.9999?``:`alpha(opacity=`+t*100+`)`,n.filter=n.filter.replace(a,t)):n.filter+=` alpha(opacity=`+t*100+`)`,e}),t.util.setStyle=e}(),function(){var e=Array.prototype.slice;function n(e){return typeof e==`string`?t.document.getElementById(e):e}var r,i=function(t){return e.call(t,0)};try{r=i(t.document.childNodes)instanceof Array}catch{}r||(i=function(e){for(var t=Array(e.length),n=e.length;n--;)t[n]=e[n];return t});function a(e,n){var r=t.document.createElement(e);for(var i in n)i===`class`?r.className=n[i]:i===`for`?r.htmlFor=n[i]:r.setAttribute(i,n[i]);return r}function o(e,t){e&&(` `+e.className+` `).indexOf(` `+t+` `)===-1&&(e.className+=(e.className?` `:``)+t)}function s(e,t,n){return typeof t==`string`&&(t=a(t,n)),e.parentNode&&e.parentNode.replaceChild(t,e),t.appendChild(e),t}function c(e){for(var n=0,r=0,i=t.document.documentElement,a=t.document.body||{scrollLeft:0,scrollTop:0};e&&(e.parentNode||e.host)&&(e=e.parentNode||e.host,e===t.document?(n=a.scrollLeft||i.scrollLeft||0,r=a.scrollTop||i.scrollTop||0):(n+=e.scrollLeft||0,r+=e.scrollTop||0),!(e.nodeType===1&&e.style.position===`fixed`)););return{left:n,top:r}}function l(e){var t,n=e&&e.ownerDocument,r={left:0,top:0},i={left:0,top:0},a,o={borderLeftWidth:`left`,borderTopWidth:`top`,paddingLeft:`left`,paddingTop:`top`};if(!n)return i;for(var s in o)i[o[s]]+=parseInt(u(e,s),10)||0;return t=n.documentElement,typeof e.getBoundingClientRect<`u`&&(r=e.getBoundingClientRect()),a=c(e),{left:r.left+a.left-(t.clientLeft||0)+i.left,top:r.top+a.top-(t.clientTop||0)+i.top}}var u=t.document.defaultView&&t.document.defaultView.getComputedStyle?function(e,n){var r=t.document.defaultView.getComputedStyle(e,null);return r?r[n]:void 0}:function(e,t){var n=e.style[t];return!n&&e.currentStyle&&(n=e.currentStyle[t]),n};(function(){var e=t.document.documentElement.style,n=`userSelect`in e?`userSelect`:`MozUserSelect`in e?`MozUserSelect`:`WebkitUserSelect`in e?`WebkitUserSelect`:`KhtmlUserSelect`in e?`KhtmlUserSelect`:``;function r(e){return typeof e.onselectstart<`u`&&(e.onselectstart=t.util.falseFunction),n?e.style[n]=`none`:typeof e.unselectable==`string`&&(e.unselectable=`on`),e}function i(e){return typeof e.onselectstart<`u`&&(e.onselectstart=null),n?e.style[n]=``:typeof e.unselectable==`string`&&(e.unselectable=``),e}t.util.makeElementUnselectable=r,t.util.makeElementSelectable=i})();function d(e){var n=t.jsdomImplForWrapper(e);return n._canvas||n._image}function f(e){if(t.isLikelyNode){var n=t.jsdomImplForWrapper(e);n&&(n._image=null,n._canvas=null,n._currentSrc=null,n._attributes=null,n._classList=null)}}function p(e,t){e.imageSmoothingEnabled=e.imageSmoothingEnabled||e.webkitImageSmoothingEnabled||e.mozImageSmoothingEnabled||e.msImageSmoothingEnabled||e.oImageSmoothingEnabled,e.imageSmoothingEnabled=t}t.util.setImageSmoothing=p,t.util.getById=n,t.util.toArray=i,t.util.addClass=o,t.util.makeElement=a,t.util.wrapElement=s,t.util.getScrollLeftTop=c,t.util.getElementOffset=l,t.util.getNodeCanvas=d,t.util.cleanUpJsdomNode=f}(),function(){function e(e,t){return e+(/\?/.test(e)?`&`:`?`)+t}function n(){}function r(r,i){i||={};var a=i.method?i.method.toUpperCase():`GET`,o=i.onComplete||function(){},s=new t.window.XMLHttpRequest,c=i.body||i.parameters;return s.onreadystatechange=function(){s.readyState===4&&(o(s),s.onreadystatechange=n)},a===`GET`&&(c=null,typeof i.parameters==`string`&&(r=e(r,i.parameters))),s.open(a,r,!0),(a===`POST`||a===`PUT`)&&s.setRequestHeader(`Content-Type`,`application/x-www-form-urlencoded`),s.send(c),s}t.util.request=r}(),t.log=console.log,t.warn=console.warn,function(){var e=t.util.object.extend,n=t.util.object.clone,r=[];t.util.object.extend(r,{cancelAll:function(){var e=this.splice(0);return e.forEach(function(e){e.cancel()}),e},cancelByCanvas:function(e){if(!e)return[];var t=this.filter(function(t){return typeof t.target==`object`&&t.target.canvas===e});return t.forEach(function(e){e.cancel()}),t},cancelByTarget:function(e){var t=this.findAnimationsByTarget(e);return t.forEach(function(e){e.cancel()}),t},findAnimationIndex:function(e){return this.indexOf(this.findAnimation(e))},findAnimation:function(e){return this.find(function(t){return t.cancel===e})},findAnimationsByTarget:function(e){return e?this.filter(function(t){return t.target===e}):[]}});function i(){return!1}function a(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}function o(r){r||={};var o=!1,s,c=function(){var e=t.runningAnimations.indexOf(s);return e>-1&&t.runningAnimations.splice(e,1)[0]};return s=e(n(r),{cancel:function(){return o=!0,c()},currentValue:`startValue`in r?r.startValue:0,completionRate:0,durationRate:0}),t.runningAnimations.push(s),l(function(e){var t=e||+new Date,n=r.duration||500,u=t+n,d,f=r.onChange||i,p=r.abort||i,m=r.onComplete||i,h=r.easing||a,g=`startValue`in r?r.startValue.length>0:!1,_=`startValue`in r?r.startValue:0,v=`endValue`in r?r.endValue:100,y=r.byValue||(g?_.map(function(e,t){return v[t]-_[t]}):v-_);r.onStart&&r.onStart(),function e(r){d=r||+new Date;var i=d>u?n:d-t,a=i/n,b=g?_.map(function(e,t){return h(i,_[t],y[t],n)}):h(i,_,y,n),x=Math.abs(g?(b[0]-_[0])/y[0]:(b-_)/y);if(s.currentValue=g?b.slice():b,s.completionRate=x,s.durationRate=a,!o){if(p(b,x,a)){c();return}if(d>u){s.currentValue=g?v.slice():v,s.completionRate=1,s.durationRate=1,f(g?v.slice():v,1,1),m(v,1,1),c();return}else f(b,x,a),l(e)}}(t)}),s.cancel}var s=t.window.requestAnimationFrame||t.window.webkitRequestAnimationFrame||t.window.mozRequestAnimationFrame||t.window.oRequestAnimationFrame||t.window.msRequestAnimationFrame||function(e){return t.window.setTimeout(e,1e3/60)},c=t.window.cancelAnimationFrame||t.window.clearTimeout;function l(){return s.apply(t.window,arguments)}function u(){return c.apply(t.window,arguments)}t.util.animate=o,t.util.requestAnimFrame=l,t.util.cancelAnimFrame=u,t.runningAnimations=r}(),function(){function e(e,t,n){var r=`rgba(`+parseInt(e[0]+n*(t[0]-e[0]),10)+`,`+parseInt(e[1]+n*(t[1]-e[1]),10)+`,`+parseInt(e[2]+n*(t[2]-e[2]),10);return r+=`,`+(e&&t?parseFloat(e[3]+n*(t[3]-e[3])):1),r+=`)`,r}function n(n,r,i,a){var o=new t.Color(n).getSource(),s=new t.Color(r).getSource(),c=a.onComplete,l=a.onChange;return a||={},t.util.animate(t.util.object.extend(a,{duration:i||500,startValue:o,endValue:s,byValue:s,easing:function(t,n,r,i){return e(n,r,a.colorEasing?a.colorEasing(t,i):1-Math.cos(t/i*(Math.PI/2)))},onComplete:function(t,n,r){if(c)return c(e(s,s,0),n,r)},onChange:function(t,n,r){if(l){if(Array.isArray(t))return l(e(t,t,0),n,r);l(t,n,r)}}}))}t.util.animateColor=n}(),function(){function e(e,t,n,r){return e<Math.abs(t)?(e=t,r=n/4):r=t===0&&e===0?n/(2*Math.PI)*Math.asin(1):n/(2*Math.PI)*Math.asin(t/e),{a:e,c:t,p:n,s:r}}function n(e,t,n){return e.a*2**(10*--t)*Math.sin((t*n-e.s)*(2*Math.PI)/e.p)}function r(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function i(e,t,n,r){return e/=r/2,e<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t}function a(e,t,n,r){return n*(e/=r)*e*e*e+t}function o(e,t,n,r){return-n*((e=e/r-1)*e*e*e-1)+t}function s(e,t,n,r){return e/=r/2,e<1?n/2*e*e*e*e+t:-n/2*((e-=2)*e*e*e-2)+t}function c(e,t,n,r){return n*(e/=r)*e*e*e*e+t}function l(e,t,n,r){return n*((e=e/r-1)*e*e*e*e+1)+t}function u(e,t,n,r){return e/=r/2,e<1?n/2*e*e*e*e*e+t:n/2*((e-=2)*e*e*e*e+2)+t}function d(e,t,n,r){return-n*Math.cos(e/r*(Math.PI/2))+n+t}function f(e,t,n,r){return n*Math.sin(e/r*(Math.PI/2))+t}function p(e,t,n,r){return-n/2*(Math.cos(Math.PI*e/r)-1)+t}function m(e,t,n,r){return e===0?t:n*2**(10*(e/r-1))+t}function h(e,t,n,r){return e===r?t+n:n*(-(2**(-10*e/r))+1)+t}function g(e,t,n,r){return e===0?t:e===r?t+n:(e/=r/2,e<1?n/2*2**(10*(e-1))+t:n/2*(-(2**(-10*--e))+2)+t)}function _(e,t,n,r){return-n*(Math.sqrt(1-(e/=r)*e)-1)+t}function v(e,t,n,r){return n*Math.sqrt(1-(e=e/r-1)*e)+t}function y(e,t,n,r){return e/=r/2,e<1?-n/2*(Math.sqrt(1-e*e)-1)+t:n/2*(Math.sqrt(1-(e-=2)*e)+1)+t}function b(t,r,i,a){var o=1.70158,s=0,c=i;return t===0?r:(t/=a,t===1?r+i:(s||=a*.3,-n(e(c,i,s,o),t,a)+r))}function x(t,n,r,i){var a=1.70158,o=0,s=r;if(t===0)return n;if(t/=i,t===1)return n+r;o||=i*.3;var c=e(s,r,o,a);return c.a*2**(-10*t)*Math.sin((t*i-c.s)*(2*Math.PI)/c.p)+c.c+n}function S(t,r,i,a){var o=1.70158,s=0,c=i;if(t===0)return r;if(t/=a/2,t===2)return r+i;s||=.3*1.5*a;var l=e(c,i,s,o);return t<1?-.5*n(l,t,a)+r:l.a*2**(-10*--t)*Math.sin((t*a-l.s)*(2*Math.PI)/l.p)*.5+l.c+r}function C(e,t,n,r,i){return i===void 0&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t}function w(e,t,n,r,i){return i===void 0&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function T(e,t,n,r,i){return i===void 0&&(i=1.70158),e/=r/2,e<1?n/2*(e*e*(((i*=1.525)+1)*e-i))+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t}function E(e,t,n,r){return n-D(r-e,0,n,r)+t}function D(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}function O(e,t,n,r){return e<r/2?E(e*2,0,n,r)*.5+t:D(e*2-r,0,n,r)*.5+n*.5+t}t.util.ease={easeInQuad:function(e,t,n,r){return n*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){return e/=r/2,e<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},easeOutCubic:r,easeInOutCubic:i,easeInQuart:a,easeOutQuart:o,easeInOutQuart:s,easeInQuint:c,easeOutQuint:l,easeInOutQuint:u,easeInSine:d,easeOutSine:f,easeInOutSine:p,easeInExpo:m,easeOutExpo:h,easeInOutExpo:g,easeInCirc:_,easeOutCirc:v,easeInOutCirc:y,easeInElastic:b,easeOutElastic:x,easeInOutElastic:S,easeInBack:C,easeOutBack:w,easeInOutBack:T,easeInBounce:E,easeOutBounce:D,easeInOutBounce:O}}(),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.util.object.clone,i=t.util.toFixed,a=t.util.parseUnit,o=t.util.multiplyTransformMatrices,s=[`path`,`circle`,`polygon`,`polyline`,`ellipse`,`rect`,`line`,`image`,`text`],c=[`symbol`,`image`,`marker`,`pattern`,`view`,`svg`],l=[`pattern`,`defs`,`symbol`,`metadata`,`clipPath`,`mask`,`desc`],u=[`symbol`,`g`,`a`,`svg`,`clipPath`,`defs`],d={cx:`left`,x:`left`,r:`radius`,cy:`top`,y:`top`,display:`visible`,visibility:`visible`,transform:`transformMatrix`,"fill-opacity":`fillOpacity`,"fill-rule":`fillRule`,"font-family":`fontFamily`,"font-size":`fontSize`,"font-style":`fontStyle`,"font-weight":`fontWeight`,"letter-spacing":`charSpacing`,"paint-order":`paintFirst`,"stroke-dasharray":`strokeDashArray`,"stroke-dashoffset":`strokeDashOffset`,"stroke-linecap":`strokeLineCap`,"stroke-linejoin":`strokeLineJoin`,"stroke-miterlimit":`strokeMiterLimit`,"stroke-opacity":`strokeOpacity`,"stroke-width":`strokeWidth`,"text-decoration":`textDecoration`,"text-anchor":`textAnchor`,opacity:`opacity`,"clip-path":`clipPath`,"clip-rule":`clipRule`,"vector-effect":`strokeUniform`,"image-rendering":`imageSmoothing`},f={stroke:`strokeOpacity`,fill:`fillOpacity`},p=`font-size`,m=`clip-path`;t.svgValidTagNamesRegEx=_(s),t.svgViewBoxElementsRegEx=_(c),t.svgInvalidAncestorsRegEx=_(l),t.svgValidParentsRegEx=_(u),t.cssRules={},t.gradientDefs={},t.clipPaths={};function h(e){return e in d?d[e]:e}function g(e,n,r,i){var s=Array.isArray(n),c;if((e===`fill`||e===`stroke`)&&n===`none`)n=``;else{if(e===`strokeUniform`)return n===`non-scaling-stroke`;if(e===`strokeDashArray`)n=n===`none`?null:n.replace(/,/g,` `).split(/\s+/).map(parseFloat);else if(e===`transformMatrix`)n=r&&r.transformMatrix?o(r.transformMatrix,t.parseTransformAttribute(n)):t.parseTransformAttribute(n);else if(e===`visible`)n=n!==`none`&&n!==`hidden`,r&&r.visible===!1&&(n=!1);else if(e===`opacity`)n=parseFloat(n),r&&typeof r.opacity<`u`&&(n*=r.opacity);else if(e===`textAnchor`)n=n===`start`?`left`:n===`end`?`right`:`center`;else if(e===`charSpacing`)c=a(n,i)/i*1e3;else if(e===`paintFirst`){var l=n.indexOf(`fill`),u=n.indexOf(`stroke`),n=`fill`;(l>-1&&u>-1&&u<l||l===-1&&u>-1)&&(n=`stroke`)}else{if(e===`href`||e===`xlink:href`||e===`font`)return n;if(e===`imageSmoothing`)return n===`optimizeQuality`;c=s?n.map(a):a(n,i)}}return!s&&isNaN(c)?n:c}function _(e){return RegExp(`^(`+e.join(`|`)+`)\\b`,`i`)}function v(e){for(var n in f)if(!(typeof e[f[n]]>`u`||e[n]===``)){if(typeof e[n]>`u`){if(!t.Object.prototype[n])continue;e[n]=t.Object.prototype[n]}if(e[n].indexOf(`url(`)!==0){var r=new t.Color(e[n]);e[n]=r.setAlpha(i(r.getAlpha()*e[f[n]],2)).toRgba()}}return e}function y(e,t){var n,r=[],i,a,o;for(a=0,o=t.length;a<o;a++)n=t[a],i=e.getElementsByTagName(n),r=r.concat(Array.prototype.slice.call(i));return r}t.parseTransformAttribute=function(){function e(e,n){var r=t.util.cos(n[0]),i=t.util.sin(n[0]),a=0,o=0;n.length===3&&(a=n[1],o=n[2]),e[0]=r,e[1]=i,e[2]=-i,e[3]=r,e[4]=a-(r*a-i*o),e[5]=o-(i*a+r*o)}function n(e,t){var n=t[0],r=t.length===2?t[1]:t[0];e[0]=n,e[3]=r}function r(e,n,r){e[r]=Math.tan(t.util.degreesToRadians(n[0]))}function i(e,t){e[4]=t[0],t.length===2&&(e[5]=t[1])}var a=t.iMatrix,o=t.reNum,s=t.commaWsp,c=`(?:(skewX)\\s*\\(\\s*(`+o+`)\\s*\\))`,l=`(?:(skewY)\\s*\\(\\s*(`+o+`)\\s*\\))`,u=`(?:(rotate)\\s*\\(\\s*(`+o+`)(?:`+s+`(`+o+`)`+s+`(`+o+`))?\\s*\\))`,d=`(?:(scale)\\s*\\(\\s*(`+o+`)(?:`+s+`(`+o+`))?\\s*\\))`,f=`(?:(translate)\\s*\\(\\s*(`+o+`)(?:`+s+`(`+o+`))?\\s*\\))`,p=`(?:`+(`(?:(matrix)\\s*\\(\\s*(`+o+`)`+s+`(`+o+`)`+s+`(`+o+`)`+s+`(`+o+`)`+s+`(`+o+`)`+s+`(`+o+`)\\s*\\))`)+`|`+f+`|`+d+`|`+u+`|`+c+`|`+l+`)`,m=`^\\s*(?:`+(`(?:`+p+`(?:`+s+`*`+p+`)*)`)+`?)\\s*$`,h=new RegExp(m),g=new RegExp(p,`g`);return function(o){var s=a.concat(),c=[];if(!o||o&&!h.test(o))return s;o.replace(g,function(o){var l=new RegExp(p).exec(o).filter(function(e){return!!e}),u=l[1],d=l.slice(2).map(parseFloat);switch(u){case`translate`:i(s,d);break;case`rotate`:d[0]=t.util.degreesToRadians(d[0]),e(s,d);break;case`scale`:n(s,d);break;case`skewX`:r(s,d,2);break;case`skewY`:r(s,d,1);break;case`matrix`:s=d;break}c.push(s.concat()),s=a.concat()});for(var l=c[0];c.length>1;)c.shift(),l=t.util.multiplyTransformMatrices(l,c[0]);return l}}();function b(e,t){var n,r;e.replace(/;\s*$/,``).split(`;`).forEach(function(e){var i=e.split(`:`);n=i[0].trim().toLowerCase(),r=i[1].trim(),t[n]=r})}function x(e,t){var n,r;for(var i in e)typeof e[i]>`u`||(n=i.toLowerCase(),r=e[i],t[n]=r)}function S(e,n){var r={};for(var i in t.cssRules[n])if(C(e,i.split(` `)))for(var a in t.cssRules[n][i])r[a]=t.cssRules[n][i][a];return r}function C(e,t){var n,r=!0;return n=T(e,t.pop()),n&&t.length&&(r=w(e,t)),n&&r&&t.length===0}function w(e,t){for(var n,r=!0;e.parentNode&&e.parentNode.nodeType===1&&t.length;)r&&(n=t.pop()),e=e.parentNode,r=T(e,n);return t.length===0}function T(e,t){var n=e.nodeName,r=e.getAttribute(`class`),i=e.getAttribute(`id`),a,o;if(a=RegExp(`^`+n,`i`),t=t.replace(a,``),i&&t.length&&(a=RegExp(`#`+i+`(?![a-zA-Z\\-]+)`,`i`),t=t.replace(a,``)),r&&t.length)for(r=r.split(` `),o=r.length;o--;)a=RegExp(`\\.`+r[o]+`(?![a-zA-Z\\-]+)`,`i`),t=t.replace(a,``);return t.length===0}function E(e,t){var n;if(e.getElementById&&(n=e.getElementById(t)),n)return n;var r,i,a,o=e.getElementsByTagName(`*`);for(i=0,a=o.length;i<a;i++)if(r=o[i],t===r.getAttribute(`id`))return r}function D(e){for(var n=y(e,[`use`,`svg:use`]),r=0;n.length&&r<n.length;){var i=n[r],a=i.getAttribute(`xlink:href`)||i.getAttribute(`href`);if(a===null)return;var o=a.slice(1),s=i.getAttribute(`x`)||0,c=i.getAttribute(`y`)||0,l=E(e,o).cloneNode(!0),u=(l.getAttribute(`transform`)||``)+` translate(`+s+`, `+c+`)`,d,f=n.length,p,m,h,g,_=t.svgNS;if(k(l),/^svg$/i.test(l.nodeName)){var v=l.ownerDocument.createElementNS(_,`g`);for(m=0,h=l.attributes,g=h.length;m<g;m++)p=h.item(m),v.setAttributeNS(_,p.nodeName,p.nodeValue);for(;l.firstChild;)v.appendChild(l.firstChild);l=v}for(m=0,h=i.attributes,g=h.length;m<g;m++)p=h.item(m),!(p.nodeName===`x`||p.nodeName===`y`||p.nodeName===`xlink:href`||p.nodeName===`href`)&&(p.nodeName===`transform`?u=p.nodeValue+` `+u:l.setAttribute(p.nodeName,p.nodeValue));l.setAttribute(`transform`,u),l.setAttribute(`instantiated_by_use`,`1`),l.removeAttribute(`id`),d=i.parentNode,d.replaceChild(l,i),n.length===f&&r++}}var O=RegExp(`^\\s*(`+t.reNum+`+)\\s*,?\\s*(`+t.reNum+`+)\\s*,?\\s*(`+t.reNum+`+)\\s*,?\\s*(`+t.reNum+`+)\\s*$`);function k(e){if(!t.svgViewBoxElementsRegEx.test(e.nodeName))return{};var n=e.getAttribute(`viewBox`),r=1,i=1,o=0,s=0,c,l,u,d,f=e.getAttribute(`width`),p=e.getAttribute(`height`),m=e.getAttribute(`x`)||0,h=e.getAttribute(`y`)||0,g=e.getAttribute(`preserveAspectRatio`)||``,_=!n||!(n=n.match(O)),v=!f||!p||f===`100%`||p===`100%`,y=_&&v,b={},x=``,S=0,C=0;if(b.width=0,b.height=0,b.toBeParsed=y,_&&(m||h)&&e.parentNode&&e.parentNode.nodeName!==`#document`&&(x=` translate(`+a(m)+` `+a(h)+`) `,u=(e.getAttribute(`transform`)||``)+x,e.setAttribute(`transform`,u),e.removeAttribute(`x`),e.removeAttribute(`y`)),y)return b;if(_)return b.width=a(f),b.height=a(p),b;if(o=-parseFloat(n[1]),s=-parseFloat(n[2]),c=parseFloat(n[3]),l=parseFloat(n[4]),b.minX=o,b.minY=s,b.viewBoxWidth=c,b.viewBoxHeight=l,v?(b.width=c,b.height=l):(b.width=a(f),b.height=a(p),r=b.width/c,i=b.height/l),g=t.util.parsePreserveAspectRatioAttribute(g),g.alignX!==`none`&&(g.meetOrSlice===`meet`&&(i=r=r>i?i:r),g.meetOrSlice===`slice`&&(i=r=r>i?r:i),S=b.width-c*r,C=b.height-l*r,g.alignX===`Mid`&&(S/=2),g.alignY===`Mid`&&(C/=2),g.alignX===`Min`&&(S=0),g.alignY===`Min`&&(C=0)),r===1&&i===1&&o===0&&s===0&&m===0&&h===0)return b;if((m||h)&&e.parentNode.nodeName!==`#document`&&(x=` translate(`+a(m)+` `+a(h)+`) `),u=x+` matrix(`+r+` 0 0 `+i+` `+(o*r+S)+` `+(s*i+C)+`) `,e.nodeName===`svg`){for(d=e.ownerDocument.createElementNS(t.svgNS,`g`);e.firstChild;)d.appendChild(e.firstChild);e.appendChild(d)}else d=e,d.removeAttribute(`x`),d.removeAttribute(`y`),u=d.getAttribute(`transform`)+u;return d.setAttribute(`transform`,u),b}function A(e,t){for(;e&&=e.parentNode;)if(e.nodeName&&t.test(e.nodeName.replace(`svg:`,``))&&!e.getAttribute(`instantiated_by_use`))return!0;return!1}t.parseSVGDocument=function(e,n,i,a){if(e){D(e);var o=t.Object.__uid++,s,c,l=k(e),u=t.util.toArray(e.getElementsByTagName(`*`));if(l.crossOrigin=a&&a.crossOrigin,l.svgUid=o,u.length===0&&t.isLikelyNode){u=e.selectNodes(`//*[name(.)!="svg"]`);var d=[];for(s=0,c=u.length;s<c;s++)d[s]=u[s];u=d}var f=u.filter(function(e){return k(e),t.svgValidTagNamesRegEx.test(e.nodeName.replace(`svg:`,``))&&!A(e,t.svgInvalidAncestorsRegEx)});if(!f||f&&!f.length){n&&n([],{});return}var p={};u.filter(function(e){return e.nodeName.replace(`svg:`,``)===`clipPath`}).forEach(function(e){var n=e.getAttribute(`id`);p[n]=t.util.toArray(e.getElementsByTagName(`*`)).filter(function(e){return t.svgValidTagNamesRegEx.test(e.nodeName.replace(`svg:`,``))})}),t.gradientDefs[o]=t.getGradientDefs(e),t.cssRules[o]=t.getCSSRules(e),t.clipPaths[o]=p,t.parseElements(f,function(e,r){n&&(n(e,l,r,u),delete t.gradientDefs[o],delete t.cssRules[o],delete t.clipPaths[o])},r(l),i,a)}};function j(e,t){var n=[`gradientTransform`,`x1`,`x2`,`y1`,`y2`,`gradientUnits`,`cx`,`cy`,`r`,`fx`,`fy`],r=`xlink:href`,i=E(e,t.getAttribute(r).slice(1));if(i&&i.getAttribute(r)&&j(e,i),n.forEach(function(e){i&&!t.hasAttribute(e)&&i.hasAttribute(e)&&t.setAttribute(e,i.getAttribute(e))}),!t.children.length)for(var a=i.cloneNode(!0);a.firstChild;)t.appendChild(a.firstChild);t.removeAttribute(r)}var M=RegExp(`(normal|italic)?\\s*(normal|small-caps)?\\s*(normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900)?\\s*(`+t.reNum+`(?:px|cm|mm|em|pt|pc|in)*)(?:\\/(normal|`+t.reNum+`))?\\s+(.*)`);n(t,{parseFontDeclaration:function(e,t){var n=e.match(M);if(n){var r=n[1],i=n[3],o=n[4],s=n[5],c=n[6];r&&(t.fontStyle=r),i&&(t.fontWeight=isNaN(parseFloat(i))?i:parseFloat(i)),o&&(t.fontSize=a(o)),c&&(t.fontFamily=c),s&&(t.lineHeight=s===`normal`?1:s)}},getGradientDefs:function(e){var t=y(e,[`linearGradient`,`radialGradient`,`svg:linearGradient`,`svg:radialGradient`]),n,r=0,i={};for(r=t.length;r--;)n=t[r],n.getAttribute(`xlink:href`)&&j(e,n),i[n.getAttribute(`id`)]=n;return i},parseAttributes:function(e,r,i){if(e){var o,s={},c,l;typeof i>`u`&&(i=e.getAttribute(`svgUid`)),e.parentNode&&t.svgValidParentsRegEx.test(e.parentNode.nodeName)&&(s=t.parseAttributes(e.parentNode,r,i));var u=r.reduce(function(t,n){return o=e.getAttribute(n),o&&(t[n]=o),t},{}),d=n(S(e,i),t.parseStyleAttribute(e));u=n(u,d),d[m]&&e.setAttribute(m,d[m]),c=l=s.fontSize||t.Text.DEFAULT_SVG_FONT_SIZE,u[p]&&(u[p]=c=a(u[p],l));var f,_,y={};for(var b in u)f=h(b),_=g(f,u[b],s,c),y[f]=_;y&&y.font&&t.parseFontDeclaration(y.font,y);var x=n(s,y);return t.svgValidParentsRegEx.test(e.nodeName)?x:v(x)}},parseElements:function(e,n,r,i,a){new t.ElementsParser(e,n,r,i,a).parse()},parseStyleAttribute:function(e){var t={},n=e.getAttribute(`style`);return n&&(typeof n==`string`?b(n,t):x(n,t)),t},parsePointsAttribute:function(e){if(!e)return null;e=e.replace(/,/g,` `).trim(),e=e.split(/\s+/);var t=[],n,r;for(n=0,r=e.length;n<r;n+=2)t.push({x:parseFloat(e[n]),y:parseFloat(e[n+1])});return t},getCSSRules:function(e){var n=e.getElementsByTagName(`style`),r,i,a={},o;for(r=0,i=n.length;r<i;r++){var s=n[r].textContent;s=s.replace(/\/\*[\s\S]*?\*\//g,``),s.trim()!==``&&(o=s.split(`}`),o=o.filter(function(e){return e.trim()}),o.forEach(function(e){var n=e.split(`{`),o={},s=n[1].trim().split(`;`).filter(function(e){return e.trim()});for(r=0,i=s.length;r<i;r++){var c=s[r].split(`:`),l=c[0].trim();o[l]=c[1].trim()}e=n[0].trim(),e.split(`,`).forEach(function(e){e=e.replace(/^svg/i,``).trim(),e!==``&&(a[e]?t.util.object.extend(a[e],o):a[e]=t.util.object.clone(o))})}))}return a},loadSVGFromURL:function(e,n,r,i){e=e.replace(/^\n\s*/,``).trim(),new t.util.request(e,{method:`get`,onComplete:a});function a(e){var a=e.responseXML;if(!a||!a.documentElement)return n&&n(null),!1;t.parseSVGDocument(a.documentElement,function(e,t,r,i){n&&n(e,t,r,i)},r,i)}},loadSVGFromString:function(e,n,r,i){var a=new t.window.DOMParser().parseFromString(e.trim(),`text/xml`);t.parseSVGDocument(a.documentElement,function(e,t,r,i){n(e,t,r,i)},r,i)}})}(e),t.ElementsParser=function(e,t,n,r,i,a){this.elements=e,this.callback=t,this.options=n,this.reviver=r,this.svgUid=n&&n.svgUid||0,this.parsingOptions=i,this.regexUrl=/^url\(['"]?#([^'"]+)['"]?\)/g,this.doc=a},function(e){e.parse=function(){this.instances=Array(this.elements.length),this.numElements=this.elements.length,this.createObjects()},e.createObjects=function(){var e=this;this.elements.forEach(function(t,n){t.setAttribute(`svgUid`,e.svgUid),e.createObject(t,n)})},e.findTag=function(e){return t[t.util.string.capitalize(e.tagName.replace(`svg:`,``))]},e.createObject=function(e,n){var r=this.findTag(e);if(r&&r.fromElement)try{r.fromElement(e,this.createCallback(n,e),this.options)}catch(e){t.log(e)}else this.checkIfDone()},e.createCallback=function(e,n){var r=this;return function(i){var a;r.resolveGradient(i,n,`fill`),r.resolveGradient(i,n,`stroke`),i instanceof t.Image&&i._originalElement&&(a=i.parsePreserveAspectRatioAttribute(n)),i._removeTransformMatrix(a),r.resolveClipPath(i,n),r.reviver&&r.reviver(n,i),r.instances[e]=i,r.checkIfDone()}},e.extractPropertyDefinition=function(e,n,r){var i=e[n],a=this.regexUrl;if(a.test(i)){a.lastIndex=0;var o=a.exec(i)[1];return a.lastIndex=0,t[r][this.svgUid][o]}},e.resolveGradient=function(e,n,r){var i=this.extractPropertyDefinition(e,r,`gradientDefs`);if(i){var a=n.getAttribute(r+`-opacity`),o=t.Gradient.fromElement(i,e,a,this.options);e.set(r,o)}},e.createClipPathCallback=function(e,t){return function(e){e._removeTransformMatrix(),e.fillRule=e.clipRule,t.push(e)}},e.resolveClipPath=function(e,n){var r=this.extractPropertyDefinition(e,`clipPath`,`clipPaths`),i,a,o,s,c,l;if(r){s=[],o=t.util.invertTransform(e.calcTransformMatrix());for(var u=r[0].parentNode,d=n;d.parentNode&&d.getAttribute(`clip-path`)!==e.clipPath;)d=d.parentNode;d.parentNode.appendChild(u);for(var f=0;f<r.length;f++)i=r[f],a=this.findTag(i),a.fromElement(i,this.createClipPathCallback(e,s),this.options);r=s.length===1?s[0]:new t.Group(s),c=t.util.multiplyTransformMatrices(o,r.calcTransformMatrix()),r.clipPath&&this.resolveClipPath(r,d);var l=t.util.qrDecompose(c);r.flipX=!1,r.flipY=!1,r.set(`scaleX`,l.scaleX),r.set(`scaleY`,l.scaleY),r.angle=l.angle,r.skewX=l.skewX,r.skewY=0,r.setPositionByOrigin({x:l.translateX,y:l.translateY},`center`,`center`),e.clipPath=r}else delete e.clipPath},e.checkIfDone=function(){--this.numElements===0&&(this.instances=this.instances.filter(function(e){return e!=null}),this.callback(this.instances,this.elements))}}(t.ElementsParser.prototype),function(e){var t=e.fabric||={};if(t.Point){t.warn(`fabric.Point is already defined`);return}t.Point=n;function n(e,t){this.x=e,this.y=t}n.prototype={type:`point`,constructor:n,add:function(e){return new n(this.x+e.x,this.y+e.y)},addEquals:function(e){return this.x+=e.x,this.y+=e.y,this},scalarAdd:function(e){return new n(this.x+e,this.y+e)},scalarAddEquals:function(e){return this.x+=e,this.y+=e,this},subtract:function(e){return new n(this.x-e.x,this.y-e.y)},subtractEquals:function(e){return this.x-=e.x,this.y-=e.y,this},scalarSubtract:function(e){return new n(this.x-e,this.y-e)},scalarSubtractEquals:function(e){return this.x-=e,this.y-=e,this},multiply:function(e){return new n(this.x*e,this.y*e)},multiplyEquals:function(e){return this.x*=e,this.y*=e,this},divide:function(e){return new n(this.x/e,this.y/e)},divideEquals:function(e){return this.x/=e,this.y/=e,this},eq:function(e){return this.x===e.x&&this.y===e.y},lt:function(e){return this.x<e.x&&this.y<e.y},lte:function(e){return this.x<=e.x&&this.y<=e.y},gt:function(e){return this.x>e.x&&this.y>e.y},gte:function(e){return this.x>=e.x&&this.y>=e.y},lerp:function(e,t){return typeof t>`u`&&(t=.5),t=Math.max(Math.min(1,t),0),new n(this.x+(e.x-this.x)*t,this.y+(e.y-this.y)*t)},distanceFrom:function(e){var t=this.x-e.x,n=this.y-e.y;return Math.sqrt(t*t+n*n)},midPointFrom:function(e){return this.lerp(e)},min:function(e){return new n(Math.min(this.x,e.x),Math.min(this.y,e.y))},max:function(e){return new n(Math.max(this.x,e.x),Math.max(this.y,e.y))},toString:function(){return this.x+`,`+this.y},setXY:function(e,t){return this.x=e,this.y=t,this},setX:function(e){return this.x=e,this},setY:function(e){return this.y=e,this},setFromPoint:function(e){return this.x=e.x,this.y=e.y,this},swap:function(e){var t=this.x,n=this.y;this.x=e.x,this.y=e.y,e.x=t,e.y=n},clone:function(){return new n(this.x,this.y)}}}(e),function(e){var t=e.fabric||={};if(t.Intersection){t.warn(`fabric.Intersection is already defined`);return}function n(e){this.status=e,this.points=[]}t.Intersection=n,t.Intersection.prototype={constructor:n,appendPoint:function(e){return this.points.push(e),this},appendPoints:function(e){return this.points=this.points.concat(e),this}},t.Intersection.intersectLineLine=function(e,r,i,a){var o,s=(a.x-i.x)*(e.y-i.y)-(a.y-i.y)*(e.x-i.x),c=(r.x-e.x)*(e.y-i.y)-(r.y-e.y)*(e.x-i.x),l=(a.y-i.y)*(r.x-e.x)-(a.x-i.x)*(r.y-e.y);if(l!==0){var u=s/l,d=c/l;0<=u&&u<=1&&0<=d&&d<=1?(o=new n(`Intersection`),o.appendPoint(new t.Point(e.x+u*(r.x-e.x),e.y+u*(r.y-e.y)))):o=new n}else o=s===0||c===0?new n(`Coincident`):new n(`Parallel`);return o},t.Intersection.intersectLinePolygon=function(e,t,r){var i=new n,a=r.length,o,s,c,l;for(l=0;l<a;l++)o=r[l],s=r[(l+1)%a],c=n.intersectLineLine(e,t,o,s),i.appendPoints(c.points);return i.points.length>0&&(i.status=`Intersection`),i},t.Intersection.intersectPolygonPolygon=function(e,t){var r=new n,i=e.length,a;for(a=0;a<i;a++){var o=e[a],s=e[(a+1)%i],c=n.intersectLinePolygon(o,s,t);r.appendPoints(c.points)}return r.points.length>0&&(r.status=`Intersection`),r},t.Intersection.intersectPolygonRectangle=function(e,r,i){var a=r.min(i),o=r.max(i),s=new t.Point(o.x,a.y),c=new t.Point(a.x,o.y),l=n.intersectLinePolygon(a,s,e),u=n.intersectLinePolygon(s,o,e),d=n.intersectLinePolygon(o,c,e),f=n.intersectLinePolygon(c,a,e),p=new n;return p.appendPoints(l.points),p.appendPoints(u.points),p.appendPoints(d.points),p.appendPoints(f.points),p.points.length>0&&(p.status=`Intersection`),p}}(e),function(e){var t=e.fabric||={};if(t.Color){t.warn(`fabric.Color is already defined.`);return}function n(e){e?this._tryParsingColor(e):this.setSource([0,0,0,1])}t.Color=n,t.Color.prototype={_tryParsingColor:function(e){var t;e in n.colorNameMap&&(e=n.colorNameMap[e]),e===`transparent`&&(t=[255,255,255,0]),t||=n.sourceFromHex(e),t||=n.sourceFromRgb(e),t||=n.sourceFromHsl(e),t||=[0,0,0,1],t&&this.setSource(t)},_rgbToHsl:function(e,n,r){e/=255,n/=255,r/=255;var i,a,o,s=t.util.array.max([e,n,r]),c=t.util.array.min([e,n,r]);if(o=(s+c)/2,s===c)i=a=0;else{var l=s-c;switch(a=o>.5?l/(2-s-c):l/(s+c),s){case e:i=(n-r)/l+(n<r?6:0);break;case n:i=(r-e)/l+2;break;case r:i=(e-n)/l+4;break}i/=6}return[Math.round(i*360),Math.round(a*100),Math.round(o*100)]},getSource:function(){return this._source},setSource:function(e){this._source=e},toRgb:function(){var e=this.getSource();return`rgb(`+e[0]+`,`+e[1]+`,`+e[2]+`)`},toRgba:function(){var e=this.getSource();return`rgba(`+e[0]+`,`+e[1]+`,`+e[2]+`,`+e[3]+`)`},toHsl:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return`hsl(`+t[0]+`,`+t[1]+`%,`+t[2]+`%)`},toHsla:function(){var e=this.getSource(),t=this._rgbToHsl(e[0],e[1],e[2]);return`hsla(`+t[0]+`,`+t[1]+`%,`+t[2]+`%,`+e[3]+`)`},toHex:function(){var e=this.getSource(),t,n,r;return t=e[0].toString(16),t=t.length===1?`0`+t:t,n=e[1].toString(16),n=n.length===1?`0`+n:n,r=e[2].toString(16),r=r.length===1?`0`+r:r,t.toUpperCase()+n.toUpperCase()+r.toUpperCase()},toHexa:function(){var e=this.getSource(),t;return t=Math.round(e[3]*255),t=t.toString(16),t=t.length===1?`0`+t:t,this.toHex()+t.toUpperCase()},getAlpha:function(){return this.getSource()[3]},setAlpha:function(e){var t=this.getSource();return t[3]=e,this.setSource(t),this},toGrayscale:function(){var e=this.getSource(),t=parseInt((e[0]*.3+e[1]*.59+e[2]*.11).toFixed(0),10),n=e[3];return this.setSource([t,t,t,n]),this},toBlackWhite:function(e){var t=this.getSource(),n=(t[0]*.3+t[1]*.59+t[2]*.11).toFixed(0),r=t[3];return e||=127,n=Number(n)<Number(e)?0:255,this.setSource([n,n,n,r]),this},overlayWith:function(e){e instanceof n||(e=new n(e));var t=[],r=this.getAlpha(),i=.5,a=this.getSource(),o=e.getSource(),s;for(s=0;s<3;s++)t.push(Math.round(a[s]*(1-i)+o[s]*i));return t[3]=r,this.setSource(t),this}},t.Color.reRGBa=/^rgba?\(\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*,\s*(\d{1,3}(?:\.\d+)?\%?)\s*(?:\s*,\s*((?:\d*\.?\d+)?)\s*)?\)$/i,t.Color.reHSLa=/^hsla?\(\s*(\d{1,3})\s*,\s*(\d{1,3}\%)\s*,\s*(\d{1,3}\%)\s*(?:\s*,\s*(\d+(?:\.\d+)?)\s*)?\)$/i,t.Color.reHex=/^#?([0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{4}|[0-9a-f]{3})$/i,t.Color.colorNameMap={aliceblue:`#F0F8FF`,antiquewhite:`#FAEBD7`,aqua:`#00FFFF`,aquamarine:`#7FFFD4`,azure:`#F0FFFF`,beige:`#F5F5DC`,bisque:`#FFE4C4`,black:`#000000`,blanchedalmond:`#FFEBCD`,blue:`#0000FF`,blueviolet:`#8A2BE2`,brown:`#A52A2A`,burlywood:`#DEB887`,cadetblue:`#5F9EA0`,chartreuse:`#7FFF00`,chocolate:`#D2691E`,coral:`#FF7F50`,cornflowerblue:`#6495ED`,cornsilk:`#FFF8DC`,crimson:`#DC143C`,cyan:`#00FFFF`,darkblue:`#00008B`,darkcyan:`#008B8B`,darkgoldenrod:`#B8860B`,darkgray:`#A9A9A9`,darkgrey:`#A9A9A9`,darkgreen:`#006400`,darkkhaki:`#BDB76B`,darkmagenta:`#8B008B`,darkolivegreen:`#556B2F`,darkorange:`#FF8C00`,darkorchid:`#9932CC`,darkred:`#8B0000`,darksalmon:`#E9967A`,darkseagreen:`#8FBC8F`,darkslateblue:`#483D8B`,darkslategray:`#2F4F4F`,darkslategrey:`#2F4F4F`,darkturquoise:`#00CED1`,darkviolet:`#9400D3`,deeppink:`#FF1493`,deepskyblue:`#00BFFF`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1E90FF`,firebrick:`#B22222`,floralwhite:`#FFFAF0`,forestgreen:`#228B22`,fuchsia:`#FF00FF`,gainsboro:`#DCDCDC`,ghostwhite:`#F8F8FF`,gold:`#FFD700`,goldenrod:`#DAA520`,gray:`#808080`,grey:`#808080`,green:`#008000`,greenyellow:`#ADFF2F`,honeydew:`#F0FFF0`,hotpink:`#FF69B4`,indianred:`#CD5C5C`,indigo:`#4B0082`,ivory:`#FFFFF0`,khaki:`#F0E68C`,lavender:`#E6E6FA`,lavenderblush:`#FFF0F5`,lawngreen:`#7CFC00`,lemonchiffon:`#FFFACD`,lightblue:`#ADD8E6`,lightcoral:`#F08080`,lightcyan:`#E0FFFF`,lightgoldenrodyellow:`#FAFAD2`,lightgray:`#D3D3D3`,lightgrey:`#D3D3D3`,lightgreen:`#90EE90`,lightpink:`#FFB6C1`,lightsalmon:`#FFA07A`,lightseagreen:`#20B2AA`,lightskyblue:`#87CEFA`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#B0C4DE`,lightyellow:`#FFFFE0`,lime:`#00FF00`,limegreen:`#32CD32`,linen:`#FAF0E6`,magenta:`#FF00FF`,maroon:`#800000`,mediumaquamarine:`#66CDAA`,mediumblue:`#0000CD`,mediumorchid:`#BA55D3`,mediumpurple:`#9370DB`,mediumseagreen:`#3CB371`,mediumslateblue:`#7B68EE`,mediumspringgreen:`#00FA9A`,mediumturquoise:`#48D1CC`,mediumvioletred:`#C71585`,midnightblue:`#191970`,mintcream:`#F5FFFA`,mistyrose:`#FFE4E1`,moccasin:`#FFE4B5`,navajowhite:`#FFDEAD`,navy:`#000080`,oldlace:`#FDF5E6`,olive:`#808000`,olivedrab:`#6B8E23`,orange:`#FFA500`,orangered:`#FF4500`,orchid:`#DA70D6`,palegoldenrod:`#EEE8AA`,palegreen:`#98FB98`,paleturquoise:`#AFEEEE`,palevioletred:`#DB7093`,papayawhip:`#FFEFD5`,peachpuff:`#FFDAB9`,peru:`#CD853F`,pink:`#FFC0CB`,plum:`#DDA0DD`,powderblue:`#B0E0E6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#FF0000`,rosybrown:`#BC8F8F`,royalblue:`#4169E1`,saddlebrown:`#8B4513`,salmon:`#FA8072`,sandybrown:`#F4A460`,seagreen:`#2E8B57`,seashell:`#FFF5EE`,sienna:`#A0522D`,silver:`#C0C0C0`,skyblue:`#87CEEB`,slateblue:`#6A5ACD`,slategray:`#708090`,slategrey:`#708090`,snow:`#FFFAFA`,springgreen:`#00FF7F`,steelblue:`#4682B4`,tan:`#D2B48C`,teal:`#008080`,thistle:`#D8BFD8`,tomato:`#FF6347`,turquoise:`#40E0D0`,violet:`#EE82EE`,wheat:`#F5DEB3`,white:`#FFFFFF`,whitesmoke:`#F5F5F5`,yellow:`#FFFF00`,yellowgreen:`#9ACD32`};function r(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}t.Color.fromRgb=function(e){return n.fromSource(n.sourceFromRgb(e))},t.Color.sourceFromRgb=function(e){var t=e.match(n.reRGBa);if(t){var r=parseInt(t[1],10)/(/%$/.test(t[1])?100:1)*(/%$/.test(t[1])?255:1),i=parseInt(t[2],10)/(/%$/.test(t[2])?100:1)*(/%$/.test(t[2])?255:1),a=parseInt(t[3],10)/(/%$/.test(t[3])?100:1)*(/%$/.test(t[3])?255:1);return[parseInt(r,10),parseInt(i,10),parseInt(a,10),t[4]?parseFloat(t[4]):1]}},t.Color.fromRgba=n.fromRgb,t.Color.fromHsl=function(e){return n.fromSource(n.sourceFromHsl(e))},t.Color.sourceFromHsl=function(e){var t=e.match(n.reHSLa);if(t){var i=(parseFloat(t[1])%360+360)%360/360,a=parseFloat(t[2])/(/%$/.test(t[2])?100:1),o=parseFloat(t[3])/(/%$/.test(t[3])?100:1),s,c,l;if(a===0)s=c=l=o;else{var u=o<=.5?o*(a+1):o+a-o*a,d=o*2-u;s=r(d,u,i+1/3),c=r(d,u,i),l=r(d,u,i-1/3)}return[Math.round(s*255),Math.round(c*255),Math.round(l*255),t[4]?parseFloat(t[4]):1]}},t.Color.fromHsla=n.fromHsl,t.Color.fromHex=function(e){return n.fromSource(n.sourceFromHex(e))},t.Color.sourceFromHex=function(e){if(e.match(n.reHex)){var t=e.slice(e.indexOf(`#`)+1),r=t.length===3||t.length===4,i=t.length===8||t.length===4,a=r?t.charAt(0)+t.charAt(0):t.substring(0,2),o=r?t.charAt(1)+t.charAt(1):t.substring(2,4),s=r?t.charAt(2)+t.charAt(2):t.substring(4,6),c=i?r?t.charAt(3)+t.charAt(3):t.substring(6,8):`FF`;return[parseInt(a,16),parseInt(o,16),parseInt(s,16),parseFloat((parseInt(c,16)/255).toFixed(2))]}},t.Color.fromSource=function(e){var t=new n;return t.setSource(e),t}}(e),function(e){var t=e.fabric||={},n=[`e`,`se`,`s`,`sw`,`w`,`nw`,`n`,`ne`,`e`],r=[`ns`,`nesw`,`ew`,`nwse`],i={},a=`left`,o=`top`,s=`right`,c=`bottom`,l=`center`,u={top:c,bottom:o,left:s,right:a,center:l},d=t.util.radiansToDegrees,f=Math.sign||function(e){return(e>0)-(e<0)||+e};function p(e,t){var n=e.angle+d(Math.atan2(t.y,t.x))+360;return Math.round(n%360/45)}function m(e,n){var r=n.transform.target,i=r.canvas,a=t.util.object.clone(n);a.target=r,i&&i.fire(`object:`+e,a),r.fire(e,n)}function h(e,t){var n=t.canvas,r=e[n.uniScaleKey];return n.uniformScaling&&!r||!n.uniformScaling&&r}function g(e){return e.originX===l&&e.originY===l}function _(e,t,n){var r=e.lockScalingX,i=e.lockScalingY;return!!(r&&i||!t&&(r||i)&&n||r&&t===`x`||i&&t===`y`)}function v(e,t,r){var i=`not-allowed`,a=h(e,r),o=``;return t.x!==0&&t.y===0?o=`x`:t.x===0&&t.y!==0&&(o=`y`),_(r,o,a)?i:n[p(r,t)]+`-resize`}function y(e,t,n){return t.x!==0&&n.lockSkewingY||t.y!==0&&n.lockSkewingX?`not-allowed`:r[p(n,t)%4]+`-resize`}function b(e,t,n){return e[n.canvas.altActionKey]?i.skewCursorStyleHandler(e,t,n):i.scaleCursorStyleHandler(e,t,n)}function x(e,t,n){var r=e[n.canvas.altActionKey];if(t.x===0)return r?`skewX`:`scaleY`;if(t.y===0)return r?`skewY`:`scaleX`}function S(e,t,n){return n.lockRotation?`not-allowed`:t.cursorStyle}function C(e,t,n,r){return{e,transform:t,pointer:{x:n,y:r}}}function w(e){return function(t,n,r,i){var a=n.target,o=a.getCenterPoint(),s=a.translateToOriginPoint(o,n.originX,n.originY),c=e(t,n,r,i);return a.setPositionByOrigin(s,n.originX,n.originY),c}}function T(e,t){return function(n,r,i,a){var o=t(n,r,i,a);return o&&m(e,C(n,r,i,a)),o}}function E(e,n,r,i,a){var o=e.target,s=o.controls[e.corner],c=o.canvas.getZoom(),l=o.padding/c,u=o.toLocalPoint(new t.Point(i,a),n,r);return u.x>=l&&(u.x-=l),u.x<=-l&&(u.x+=l),u.y>=l&&(u.y-=l),u.y<=l&&(u.y+=l),u.x-=s.offsetX,u.y-=s.offsetY,u}function D(e){return e.flipX!==e.flipY}function O(e,t,n,r,i){if(e[t]!==0){var a=i/e._getTransformedDimensions()[r]*e[n];e.set(n,a)}}function k(e,t,n,r){var i=t.target,l=i._getTransformedDimensions(0,i.skewY),u=E(t,t.originX,t.originY,n,r),f=Math.abs(u.x*2)-l.x,p=i.skewX,m;f<2?m=0:(m=d(Math.atan2(f/i.scaleX,l.y/i.scaleY)),t.originX===a&&t.originY===c&&(m=-m),t.originX===s&&t.originY===o&&(m=-m),D(i)&&(m=-m));var h=p!==m;if(h){var g=i._getTransformedDimensions().y;i.set(`skewX`,m),O(i,`skewY`,`scaleY`,`y`,g)}return h}function A(e,t,n,r){var i=t.target,l=i._getTransformedDimensions(i.skewX,0),u=E(t,t.originX,t.originY,n,r),f=Math.abs(u.y*2)-l.y,p=i.skewY,m;f<2?m=0:(m=d(Math.atan2(f/i.scaleY,l.x/i.scaleX)),t.originX===a&&t.originY===c&&(m=-m),t.originX===s&&t.originY===o&&(m=-m),D(i)&&(m=-m));var h=p!==m;if(h){var g=i._getTransformedDimensions().x;i.set(`skewY`,m),O(i,`skewX`,`scaleX`,`x`,g)}return h}function j(e,t,n,r){var i=t.target,c=i.skewX,u,d=t.originY;return i.lockSkewingX?!1:(c===0?u=E(t,l,l,n,r).x>0?a:s:(c>0&&(u=d===o?a:s),c<0&&(u=d===o?s:a),D(i)&&(u=u===a?s:a)),t.originX=u,T(`skewing`,w(k))(e,t,n,r))}function M(e,t,n,r){var i=t.target,s=i.skewY,u,d=t.originX;return i.lockSkewingY?!1:(s===0?u=E(t,l,l,n,r).y>0?o:c:(s>0&&(u=d===a?o:c),s<0&&(u=d===a?c:o),D(i)&&(u=u===o?c:o)),t.originY=u,T(`skewing`,w(A))(e,t,n,r))}function N(e,t,n,r){var i=t,a=i.target,o=a.translateToOriginPoint(a.getCenterPoint(),i.originX,i.originY);if(a.lockRotation)return!1;var s=Math.atan2(i.ey-o.y,i.ex-o.x),c=d(Math.atan2(r-o.y,n-o.x)-s+i.theta),l=!0;if(a.snapAngle>0){var u=a.snapAngle,f=a.snapThreshold||u,p=Math.ceil(c/u)*u,m=Math.floor(c/u)*u;Math.abs(c-m)<f?c=m:Math.abs(c-p)<f&&(c=p)}return c<0&&(c=360+c),c%=360,l=a.angle!==c,a.angle=c,l}function P(e,t,n,r,i){i||={};var a=t.target,o=a.lockScalingX,s=a.lockScalingY,c=i.by,l,d,p,m,v=h(e,a),y=_(a,c,v),b,x,S=t.gestureScale;if(y)return!1;if(S)d=t.scaleX*S,p=t.scaleY*S;else{if(l=E(t,t.originX,t.originY,n,r),b=c===`y`?1:f(l.x),x=c===`x`?1:f(l.y),t.signX||=b,t.signY||=x,a.lockScalingFlip&&(t.signX!==b||t.signY!==x))return!1;if(m=a._getTransformedDimensions(),v&&!c){var C=Math.abs(l.x)+Math.abs(l.y),w=t.original,T=C/(Math.abs(m.x*w.scaleX/a.scaleX)+Math.abs(m.y*w.scaleY/a.scaleY));d=w.scaleX*T,p=w.scaleY*T}else d=Math.abs(l.x*a.scaleX/m.x),p=Math.abs(l.y*a.scaleY/m.y);g(t)&&(d*=2,p*=2),t.signX!==b&&c!==`y`&&(t.originX=u[t.originX],d*=-1,t.signX=b),t.signY!==x&&c!==`x`&&(t.originY=u[t.originY],p*=-1,t.signY=x)}var D=a.scaleX,O=a.scaleY;return c?(c===`x`&&a.set(`scaleX`,d),c===`y`&&a.set(`scaleY`,p)):(!o&&a.set(`scaleX`,d),!s&&a.set(`scaleY`,p)),D!==a.scaleX||O!==a.scaleY}function ee(e,t,n,r){return P(e,t,n,r)}function F(e,t,n,r){return P(e,t,n,r,{by:`x`})}function te(e,t,n,r){return P(e,t,n,r,{by:`y`})}function ne(e,t,n,r){return e[t.target.canvas.altActionKey]?i.skewHandlerX(e,t,n,r):i.scalingY(e,t,n,r)}function re(e,t,n,r){return e[t.target.canvas.altActionKey]?i.skewHandlerY(e,t,n,r):i.scalingX(e,t,n,r)}function I(e,t,n,r){var i=t.target,a=E(t,t.originX,t.originY,n,r),o=i.strokeWidth/(i.strokeUniform?i.scaleX:1),s=g(t)?2:1,c=i.width,l=Math.abs(a.x*s/i.scaleX)-o;return i.set(`width`,Math.max(l,0)),c!==l}function ie(e,t,n,r){var i=t.target,a=n-t.offsetX,o=r-t.offsetY,s=!i.get(`lockMovementX`)&&i.left!==a,c=!i.get(`lockMovementY`)&&i.top!==o;return s&&i.set(`left`,a),c&&i.set(`top`,o),(s||c)&&m(`moving`,C(e,t,n,r)),s||c}i.scaleCursorStyleHandler=v,i.skewCursorStyleHandler=y,i.scaleSkewCursorStyleHandler=b,i.rotationWithSnapping=T(`rotating`,w(N)),i.scalingEqually=T(`scaling`,w(ee)),i.scalingX=T(`scaling`,w(F)),i.scalingY=T(`scaling`,w(te)),i.scalingYOrSkewingX=ne,i.scalingXOrSkewingY=re,i.changeWidth=T(`resizing`,w(I)),i.skewHandlerX=j,i.skewHandlerY=M,i.dragHandler=ie,i.scaleOrSkewActionName=x,i.rotationStyleHandler=S,i.fireEvent=m,i.wrapWithFixedAnchor=w,i.wrapWithFireEvent=T,i.getLocalPoint=E,t.controlsUtils=i}(e),function(e){var t=e.fabric||={},n=t.util.degreesToRadians,r=t.controlsUtils;function i(e,t,n,r,i){r||={};var a=this.sizeX||r.cornerSize||i.cornerSize,o=this.sizeY||r.cornerSize||i.cornerSize,s=typeof r.transparentCorners<`u`?r.transparentCorners:i.transparentCorners,c=s?`stroke`:`fill`,l=!s&&(r.cornerStrokeColor||i.cornerStrokeColor),u=t,d=n,f;e.save(),e.fillStyle=r.cornerColor||i.cornerColor,e.strokeStyle=r.cornerStrokeColor||i.cornerStrokeColor,a>o?(f=a,e.scale(1,o/a),d=n*a/o):o>a?(f=o,e.scale(a/o,1),u=t*o/a):f=a,e.lineWidth=1,e.beginPath(),e.arc(u,d,f/2,0,2*Math.PI,!1),e[c](),l&&e.stroke(),e.restore()}function a(e,t,r,i,a){i||={};var o=this.sizeX||i.cornerSize||a.cornerSize,s=this.sizeY||i.cornerSize||a.cornerSize,c=typeof i.transparentCorners<`u`?i.transparentCorners:a.transparentCorners,l=c?`stroke`:`fill`,u=!c&&(i.cornerStrokeColor||a.cornerStrokeColor),d=o/2,f=s/2;e.save(),e.fillStyle=i.cornerColor||a.cornerColor,e.strokeStyle=i.cornerStrokeColor||a.cornerStrokeColor,e.lineWidth=1,e.translate(t,r),e.rotate(n(a.angle)),e[l+`Rect`](-d,-f,o,s),u&&e.strokeRect(-d,-f,o,s),e.restore()}r.renderCircleControl=i,r.renderSquareControl=a}(e),function(e){var t=e.fabric||={};function n(e){for(var t in e)this[t]=e[t]}t.Control=n,t.Control.prototype={visible:!0,actionName:`scale`,angle:0,x:0,y:0,offsetX:0,offsetY:0,sizeX:null,sizeY:null,touchSizeX:null,touchSizeY:null,cursorStyle:`crosshair`,withConnection:!1,actionHandler:function(){},mouseDownHandler:function(){},mouseUpHandler:function(){},getActionHandler:function(){return this.actionHandler},getMouseDownHandler:function(){return this.mouseDownHandler},getMouseUpHandler:function(){return this.mouseUpHandler},cursorStyleHandler:function(e,t){return t.cursorStyle},getActionName:function(e,t){return t.actionName},getVisibility:function(e,t){var n=e._controlsVisibility;return n&&typeof n[t]<`u`?n[t]:this.visible},setVisibility:function(e){this.visible=e},positionHandler:function(e,n){return t.util.transformPoint({x:this.x*e.x+this.offsetX,y:this.y*e.y+this.offsetY},n)},calcCornerCoords:function(e,n,r,i,a){var o,s,c,l,u=a?this.touchSizeX:this.sizeX,d=a?this.touchSizeY:this.sizeY;if(u&&d&&u!==d){var f=Math.atan2(d,u),p=Math.sqrt(u*u+d*d)/2,m=f-t.util.degreesToRadians(e),h=Math.PI/2-f-t.util.degreesToRadians(e);o=p*t.util.cos(m),s=p*t.util.sin(m),c=p*t.util.cos(h),l=p*t.util.sin(h)}else{p=(u&&d?u:n)*.7071067812;var m=t.util.degreesToRadians(45-e);o=c=p*t.util.cos(m),s=l=p*t.util.sin(m)}return{tl:{x:r-l,y:i-c},tr:{x:r+o,y:i-s},bl:{x:r-o,y:i+s},br:{x:r+l,y:i+c}}},render:function(e,n,r,i,a){switch(i||={},i.cornerStyle||a.cornerStyle){case`circle`:t.controlsUtils.renderCircleControl.call(this,e,n,r,i,a);break;default:t.controlsUtils.renderSquareControl.call(this,e,n,r,i,a)}}}}(e),function(){function e(e,n){var r=e.getAttribute(`style`),i=e.getAttribute(`offset`)||0,a,o,s,c;if(i=parseFloat(i)/(/%$/.test(i)?100:1),i=i<0?0:i>1?1:i,r){var l=r.split(/\s*;\s*/);for(l[l.length-1]===``&&l.pop(),c=l.length;c--;){var u=l[c].split(/\s*:\s*/),d=u[0].trim(),f=u[1].trim();d===`stop-color`?a=f:d===`stop-opacity`&&(s=f)}}return a||=e.getAttribute(`stop-color`)||`rgb(0,0,0)`,s||=e.getAttribute(`stop-opacity`),a=new t.Color(a),o=a.getAlpha(),s=isNaN(parseFloat(s))?1:parseFloat(s),s*=o*n,{offset:i,color:a.toRgb(),opacity:s}}function n(e){return{x1:e.getAttribute(`x1`)||0,y1:e.getAttribute(`y1`)||0,x2:e.getAttribute(`x2`)||`100%`,y2:e.getAttribute(`y2`)||0}}function r(e){return{x1:e.getAttribute(`fx`)||e.getAttribute(`cx`)||`50%`,y1:e.getAttribute(`fy`)||e.getAttribute(`cy`)||`50%`,r1:0,x2:e.getAttribute(`cx`)||`50%`,y2:e.getAttribute(`cy`)||`50%`,r2:e.getAttribute(`r`)||`50%`}}var i=t.util.object.clone;t.Gradient=t.util.createClass({offsetX:0,offsetY:0,gradientTransform:null,gradientUnits:`pixels`,type:`linear`,initialize:function(e){e||={},e.coords||={};var n,r=this;Object.keys(e).forEach(function(t){r[t]=e[t]}),this.id?this.id+=`_`+ t.Object.__uid++:this.id=t.Object.__uid++,n={x1:e.coords.x1||0,y1:e.coords.y1||0,x2:e.coords.x2||0,y2:e.coords.y2||0},this.type===`radial`&&(n.r1=e.coords.r1||0,n.r2=e.coords.r2||0),this.coords=n,this.colorStops=e.colorStops.slice()},addColorStop:function(e){for(var n in e){var r=new t.Color(e[n]);this.colorStops.push({offset:parseFloat(n),color:r.toRgb(),opacity:r.getAlpha()})}return this},toObject:function(e){var n={type:this.type,coords:this.coords,colorStops:this.colorStops,offsetX:this.offsetX,offsetY:this.offsetY,gradientUnits:this.gradientUnits,gradientTransform:this.gradientTransform?this.gradientTransform.concat():this.gradientTransform};return t.util.populateWithProperties(this,n,e),n},toSVG:function(e,n){var r=i(this.coords,!0),a,o,n=n||{},s,c,l=i(this.colorStops,!0),u=r.r1>r.r2,d=this.gradientTransform?this.gradientTransform.concat():t.iMatrix.concat(),f=-this.offsetX,p=-this.offsetY,m=!!n.additionalTransform,h=this.gradientUnits===`pixels`?`userSpaceOnUse`:`objectBoundingBox`;if(l.sort(function(e,t){return e.offset-t.offset}),h===`objectBoundingBox`?(f/=e.width,p/=e.height):(f+=e.width/2,p+=e.height/2),e.type===`path`&&this.gradientUnits!==`percentage`&&(f-=e.pathOffset.x,p-=e.pathOffset.y),d[4]-=f,d[5]-=p,c=`id="SVGID_`+this.id+`" gradientUnits="`+h+`"`,c+=` gradientTransform="`+(m?n.additionalTransform+` `:``)+t.util.matrixToSVG(d)+`" `,this.type===`linear`?s=[`<linearGradient `,c,` x1="`,r.x1,`" y1="`,r.y1,`" x2="`,r.x2,`" y2="`,r.y2,`">
|
|
31
|
+
`]:this.type===`radial`&&(s=[`<radialGradient `,c,` cx="`,u?r.x1:r.x2,`" cy="`,u?r.y1:r.y2,`" r="`,u?r.r1:r.r2,`" fx="`,u?r.x2:r.x1,`" fy="`,u?r.y2:r.y1,`">
|
|
32
|
+
`]),this.type===`radial`){if(u)for(l=l.concat(),l.reverse(),a=0,o=l.length;a<o;a++)l[a].offset=1-l[a].offset;var g=Math.min(r.r1,r.r2);if(g>0){var _=g/Math.max(r.r1,r.r2);for(a=0,o=l.length;a<o;a++)l[a].offset+=_*(1-l[a].offset)}}for(a=0,o=l.length;a<o;a++){var v=l[a];s.push(`<stop `,`offset="`,v.offset*100+`%`,`" style="stop-color:`,v.color,typeof v.opacity<`u`?`;stop-opacity: `+v.opacity:`;`,`"/>
|
|
33
|
+
`)}return s.push(this.type===`linear`?`</linearGradient>
|
|
34
|
+
`:`</radialGradient>
|
|
35
|
+
`),s.join(``)},toLive:function(e){var n,r=t.util.object.clone(this.coords),i,a;if(this.type){for(this.type===`linear`?n=e.createLinearGradient(r.x1,r.y1,r.x2,r.y2):this.type===`radial`&&(n=e.createRadialGradient(r.x1,r.y1,r.r1,r.x2,r.y2,r.r2)),i=0,a=this.colorStops.length;i<a;i++){var o=this.colorStops[i].color,s=this.colorStops[i].opacity,c=this.colorStops[i].offset;typeof s<`u`&&(o=new t.Color(o).setAlpha(s).toRgba()),n.addColorStop(c,o)}return n}}}),t.util.object.extend(t.Gradient,{fromElement:function(i,o,s,c){var l=parseFloat(s)/(/%$/.test(s)?100:1);l=l<0?0:l>1?1:l,isNaN(l)&&(l=1);var u=i.getElementsByTagName(`stop`),d,f=i.getAttribute(`gradientUnits`)===`userSpaceOnUse`?`pixels`:`percentage`,p=i.getAttribute(`gradientTransform`)||``,m=[],h,g,_=0,v=0,y;for(i.nodeName===`linearGradient`||i.nodeName===`LINEARGRADIENT`?(d=`linear`,h=n(i)):(d=`radial`,h=r(i)),g=u.length;g--;)m.push(e(u[g],l));return y=t.parseTransformAttribute(p),a(o,h,c,f),f===`pixels`&&(_=-o.left,v=-o.top),new t.Gradient({id:i.getAttribute(`id`),type:d,coords:h,colorStops:m,gradientUnits:f,gradientTransform:y,offsetX:_,offsetY:v})}});function a(e,t,n,r){var i,a;Object.keys(t).forEach(function(e){i=t[e],i===`Infinity`?a=1:i===`-Infinity`?a=0:(a=parseFloat(t[e],10),typeof i==`string`&&/^(\d+\.\d+)%|(\d+)%$/.test(i)&&(a*=.01,r===`pixels`&&((e===`x1`||e===`x2`||e===`r2`)&&(a*=n.viewBoxWidth||n.width),(e===`y1`||e===`y2`)&&(a*=n.viewBoxHeight||n.height)))),t[e]=a})}}(),function(){var e=t.util.toFixed;t.Pattern=t.util.createClass({repeat:`repeat`,offsetX:0,offsetY:0,crossOrigin:``,patternTransform:null,initialize:function(e,n){if(e||={},this.id=t.Object.__uid++,this.setOptions(e),!e.source||e.source&&typeof e.source!=`string`){n&&n(this);return}else{var r=this;this.source=t.util.createImage(),t.util.loadImage(e.source,function(e,t){r.source=e,n&&n(r,t)},null,this.crossOrigin)}},toObject:function(n){var r=t.Object.NUM_FRACTION_DIGITS,i,a;return typeof this.source.src==`string`?i=this.source.src:typeof this.source==`object`&&this.source.toDataURL&&(i=this.source.toDataURL()),a={type:`pattern`,source:i,repeat:this.repeat,crossOrigin:this.crossOrigin,offsetX:e(this.offsetX,r),offsetY:e(this.offsetY,r),patternTransform:this.patternTransform?this.patternTransform.concat():null},t.util.populateWithProperties(this,a,n),a},toSVG:function(e){var t=typeof this.source==`function`?this.source():this.source,n=t.width/e.width,r=t.height/e.height,i=this.offsetX/e.width,a=this.offsetY/e.height,o=``;return(this.repeat===`repeat-x`||this.repeat===`no-repeat`)&&(r=1,a&&(r+=Math.abs(a))),(this.repeat===`repeat-y`||this.repeat===`no-repeat`)&&(n=1,i&&(n+=Math.abs(i))),t.src?o=t.src:t.toDataURL&&(o=t.toDataURL()),`<pattern id="SVGID_`+this.id+`" x="`+i+`" y="`+a+`" width="`+n+`" height="`+r+`">
|
|
36
|
+
<image x="0" y="0" width="`+t.width+`" height="`+t.height+`" xlink:href="`+o+`"></image>
|
|
37
|
+
</pattern>
|
|
38
|
+
`},setOptions:function(e){for(var t in e)this[t]=e[t]},toLive:function(e){var t=this.source;return!t||typeof t.src<`u`&&(!t.complete||t.naturalWidth===0||t.naturalHeight===0)?``:e.createPattern(t,this.repeat)}})}(),function(e){var t=e.fabric||={},n=t.util.toFixed;if(t.Shadow){t.warn(`fabric.Shadow is already defined.`);return}t.Shadow=t.util.createClass({color:`rgb(0,0,0)`,blur:0,offsetX:0,offsetY:0,affectStroke:!1,includeDefaultValues:!0,nonScaling:!1,initialize:function(e){for(var n in typeof e==`string`&&(e=this._parseShadow(e)),e)this[n]=e[n];this.id=t.Object.__uid++},_parseShadow:function(e){var n=e.trim(),r=t.Shadow.reOffsetsAndBlur.exec(n)||[];return{color:(n.replace(t.Shadow.reOffsetsAndBlur,``)||`rgb(0,0,0)`).trim(),offsetX:parseFloat(r[1],10)||0,offsetY:parseFloat(r[2],10)||0,blur:parseFloat(r[3],10)||0}},toString:function(){return[this.offsetX,this.offsetY,this.blur,this.color].join(`px `)},toSVG:function(e){var r=40,i=40,a=t.Object.NUM_FRACTION_DIGITS,o=t.util.rotateVector({x:this.offsetX,y:this.offsetY},t.util.degreesToRadians(-e.angle)),s=20,c=new t.Color(this.color);return e.width&&e.height&&(r=n((Math.abs(o.x)+this.blur)/e.width,a)*100+s,i=n((Math.abs(o.y)+this.blur)/e.height,a)*100+s),e.flipX&&(o.x*=-1),e.flipY&&(o.y*=-1),`<filter id="SVGID_`+this.id+`" y="-`+i+`%" height="`+(100+2*i)+`%" x="-`+r+`%" width="`+(100+2*r)+`%" >
|
|
39
|
+
<feGaussianBlur in="SourceAlpha" stdDeviation="`+n(this.blur?this.blur/2:0,a)+`"></feGaussianBlur>
|
|
40
|
+
<feOffset dx="`+n(o.x,a)+`" dy="`+n(o.y,a)+`" result="oBlur" ></feOffset>
|
|
41
|
+
<feFlood flood-color="`+c.toRgb()+`" flood-opacity="`+c.getAlpha()+`"/>
|
|
42
|
+
<feComposite in2="oBlur" operator="in" />
|
|
43
|
+
<feMerge>
|
|
44
|
+
<feMergeNode></feMergeNode>
|
|
45
|
+
<feMergeNode in="SourceGraphic"></feMergeNode>
|
|
46
|
+
</feMerge>
|
|
47
|
+
</filter>
|
|
48
|
+
`},toObject:function(){if(this.includeDefaultValues)return{color:this.color,blur:this.blur,offsetX:this.offsetX,offsetY:this.offsetY,affectStroke:this.affectStroke,nonScaling:this.nonScaling};var e={},n=t.Shadow.prototype;return[`color`,`blur`,`offsetX`,`offsetY`,`affectStroke`,`nonScaling`].forEach(function(t){this[t]!==n[t]&&(e[t]=this[t])},this),e}}),t.Shadow.reOffsetsAndBlur=/(?:\s|^)(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(-?\d+(?:\.\d*)?(?:px)?(?:\s?|$))?(\d+(?:\.\d*)?(?:px)?)?(?:\s?|$)(?:$|\s)/}(e),function(){if(t.StaticCanvas){t.warn(`fabric.StaticCanvas is already defined.`);return}var e=t.util.object.extend,n=t.util.getElementOffset,r=t.util.removeFromArray,i=t.util.toFixed,a=t.util.transformPoint,o=t.util.invertTransform,s=t.util.getNodeCanvas,c=t.util.createCanvasElement,l=Error("Could not initialize `canvas` element");t.StaticCanvas=t.util.createClass(t.CommonMethods,{initialize:function(e,t){t||={},this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t)},backgroundColor:``,backgroundImage:null,overlayColor:``,overlayImage:null,includeDefaultValues:!0,stateful:!1,renderOnAddRemove:!0,controlsAboveOverlay:!1,allowTouchScrolling:!1,imageSmoothingEnabled:!0,viewportTransform:t.iMatrix.concat(),backgroundVpt:!0,overlayVpt:!0,enableRetinaScaling:!0,vptCoords:{},skipOffscreen:!0,clipPath:void 0,_initStatic:function(e,t){var n=this.requestRenderAllBound;this._objects=[],this._createLowerCanvas(e),this._initOptions(t),this.interactive||this._initRetinaScaling(),t.overlayImage&&this.setOverlayImage(t.overlayImage,n),t.backgroundImage&&this.setBackgroundImage(t.backgroundImage,n),t.backgroundColor&&this.setBackgroundColor(t.backgroundColor,n),t.overlayColor&&this.setOverlayColor(t.overlayColor,n),this.calcOffset()},_isRetinaScaling:function(){return t.devicePixelRatio>1&&this.enableRetinaScaling},getRetinaScaling:function(){return this._isRetinaScaling()?Math.max(1,t.devicePixelRatio):1},_initRetinaScaling:function(){if(this._isRetinaScaling()){var e=t.devicePixelRatio;this.__initRetinaScaling(e,this.lowerCanvasEl,this.contextContainer),this.upperCanvasEl&&this.__initRetinaScaling(e,this.upperCanvasEl,this.contextTop)}},__initRetinaScaling:function(e,t,n){t.setAttribute(`width`,this.width*e),t.setAttribute(`height`,this.height*e),n.scale(e,e)},calcOffset:function(){return this._offset=n(this.lowerCanvasEl),this},setOverlayImage:function(e,t,n){return this.__setBgOverlayImage(`overlayImage`,e,t,n)},setBackgroundImage:function(e,t,n){return this.__setBgOverlayImage(`backgroundImage`,e,t,n)},setOverlayColor:function(e,t){return this.__setBgOverlayColor(`overlayColor`,e,t)},setBackgroundColor:function(e,t){return this.__setBgOverlayColor(`backgroundColor`,e,t)},__setBgOverlayImage:function(e,n,r,i){return typeof n==`string`?t.util.loadImage(n,function(n,a){if(n){var o=new t.Image(n,i);this[e]=o,o.canvas=this}r&&r(n,a)},this,i&&i.crossOrigin):(i&&n.setOptions(i),this[e]=n,n&&(n.canvas=this),r&&r(n,!1)),this},__setBgOverlayColor:function(e,t,n){return this[e]=t,this._initGradient(t,e),this._initPattern(t,e,n),this},_createCanvasElement:function(){var e=c();if(!e||(e.style||={},typeof e.getContext>`u`))throw l;return e},_initOptions:function(e){var t=this.lowerCanvasEl;this._setOptions(e),this.width=this.width||parseInt(t.width,10)||0,this.height=this.height||parseInt(t.height,10)||0,this.lowerCanvasEl.style&&(t.width=this.width,t.height=this.height,t.style.width=this.width+`px`,t.style.height=this.height+`px`,this.viewportTransform=this.viewportTransform.slice())},_createLowerCanvas:function(e){e&&e.getContext?this.lowerCanvasEl=e:this.lowerCanvasEl=t.util.getById(e)||this._createCanvasElement(),t.util.addClass(this.lowerCanvasEl,`lower-canvas`),this._originalCanvasStyle=this.lowerCanvasEl.style,this.interactive&&this._applyCanvasStyle(this.lowerCanvasEl),this.contextContainer=this.lowerCanvasEl.getContext(`2d`)},getWidth:function(){return this.width},getHeight:function(){return this.height},setWidth:function(e,t){return this.setDimensions({width:e},t)},setHeight:function(e,t){return this.setDimensions({height:e},t)},setDimensions:function(e,t){var n;for(var r in t||={},e)n=e[r],t.cssOnly||(this._setBackstoreDimension(r,e[r]),n+=`px`,this.hasLostContext=!0),t.backstoreOnly||this._setCssDimension(r,n);return this._isCurrentlyDrawing&&this.freeDrawingBrush&&this.freeDrawingBrush._setBrushStyles(this.contextTop),this._initRetinaScaling(),this.calcOffset(),t.cssOnly||this.requestRenderAll(),this},_setBackstoreDimension:function(e,t){return this.lowerCanvasEl[e]=t,this.upperCanvasEl&&(this.upperCanvasEl[e]=t),this.cacheCanvasEl&&(this.cacheCanvasEl[e]=t),this[e]=t,this},_setCssDimension:function(e,t){return this.lowerCanvasEl.style[e]=t,this.upperCanvasEl&&(this.upperCanvasEl.style[e]=t),this.wrapperEl&&(this.wrapperEl.style[e]=t),this},getZoom:function(){return this.viewportTransform[0]},setViewportTransform:function(e){var t=this._activeObject,n=this.backgroundImage,r=this.overlayImage,i,a,o;for(this.viewportTransform=e,a=0,o=this._objects.length;a<o;a++)i=this._objects[a],i.group||i.setCoords(!0);return t&&t.setCoords(),n&&n.setCoords(!0),r&&r.setCoords(!0),this.calcViewportBoundaries(),this.renderOnAddRemove&&this.requestRenderAll(),this},zoomToPoint:function(e,t){var n=e,r=this.viewportTransform.slice(0);e=a(e,o(this.viewportTransform)),r[0]=t,r[3]=t;var i=a(e,r);return r[4]+=n.x-i.x,r[5]+=n.y-i.y,this.setViewportTransform(r)},setZoom:function(e){return this.zoomToPoint(new t.Point(0,0),e),this},absolutePan:function(e){var t=this.viewportTransform.slice(0);return t[4]=-e.x,t[5]=-e.y,this.setViewportTransform(t)},relativePan:function(e){return this.absolutePan(new t.Point(-e.x-this.viewportTransform[4],-e.y-this.viewportTransform[5]))},getElement:function(){return this.lowerCanvasEl},_onObjectAdded:function(e){this.stateful&&e.setupState(),e._set(`canvas`,this),e.setCoords(),this.fire(`object:added`,{target:e}),e.fire(`added`)},_onObjectRemoved:function(e){this.fire(`object:removed`,{target:e}),e.fire(`removed`),delete e.canvas},clearContext:function(e){return e.clearRect(0,0,this.width,this.height),this},getContext:function(){return this.contextContainer},clear:function(){return this.remove.apply(this,this.getObjects()),this.backgroundImage=null,this.overlayImage=null,this.backgroundColor=``,this.overlayColor=``,this._hasITextHandlers&&=(this.off(`mouse:up`,this._mouseUpITextHandler),this._iTextInstances=null,!1),this.clearContext(this.contextContainer),this.fire(`canvas:cleared`),this.renderOnAddRemove&&this.requestRenderAll(),this},renderAll:function(){var e=this.contextContainer;return this.renderCanvas(e,this._objects),this},renderAndReset:function(){this.isRendering=0,this.renderAll()},requestRenderAll:function(){return this.isRendering||=t.util.requestAnimFrame(this.renderAndResetBound),this},calcViewportBoundaries:function(){var e={},n=this.width,r=this.height,i=o(this.viewportTransform);return e.tl=a({x:0,y:0},i),e.br=a({x:n,y:r},i),e.tr=new t.Point(e.br.x,e.tl.y),e.bl=new t.Point(e.tl.x,e.br.y),this.vptCoords=e,e},cancelRequestedRender:function(){this.isRendering&&=(t.util.cancelAnimFrame(this.isRendering),0)},renderCanvas:function(e,n){var r=this.viewportTransform,i=this.clipPath;this.cancelRequestedRender(),this.calcViewportBoundaries(),this.clearContext(e),t.util.setImageSmoothing(e,this.imageSmoothingEnabled),this.fire(`before:render`,{ctx:e}),this._renderBackground(e),e.save(),e.transform(r[0],r[1],r[2],r[3],r[4],r[5]),this._renderObjects(e,n),e.restore(),!this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),i&&(i.canvas=this,i.shouldCache(),i._transformDone=!0,i.renderCache({forClipping:!0}),this.drawClipPathOnCanvas(e)),this._renderOverlay(e),this.controlsAboveOverlay&&this.interactive&&this.drawControls(e),this.fire(`after:render`,{ctx:e})},drawClipPathOnCanvas:function(e){var t=this.viewportTransform,n=this.clipPath;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5]),e.globalCompositeOperation=`destination-in`,n.transform(e),e.scale(1/n.zoomX,1/n.zoomY),e.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),e.restore()},_renderObjects:function(e,t){var n,r;for(n=0,r=t.length;n<r;++n)t[n]&&t[n].render(e)},_renderBackgroundOrOverlay:function(e,t){var n=this[t+`Color`],r=this[t+`Image`],i=this.viewportTransform,a=this[t+`Vpt`];if(!(!n&&!r)){if(n){e.save(),e.beginPath(),e.moveTo(0,0),e.lineTo(this.width,0),e.lineTo(this.width,this.height),e.lineTo(0,this.height),e.closePath(),e.fillStyle=n.toLive?n.toLive(e,this):n,a&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),e.transform(1,0,0,1,n.offsetX||0,n.offsetY||0);var o=n.gradientTransform||n.patternTransform;o&&e.transform(o[0],o[1],o[2],o[3],o[4],o[5]),e.fill(),e.restore()}r&&(e.save(),a&&e.transform(i[0],i[1],i[2],i[3],i[4],i[5]),r.render(e),e.restore())}},_renderBackground:function(e){this._renderBackgroundOrOverlay(e,`background`)},_renderOverlay:function(e){this._renderBackgroundOrOverlay(e,`overlay`)},getCenter:function(){return{top:this.height/2,left:this.width/2}},getCenterPoint:function(){return new t.Point(this.width/2,this.height/2)},centerObjectH:function(e){return this._centerObject(e,new t.Point(this.getCenterPoint().x,e.getCenterPoint().y))},centerObjectV:function(e){return this._centerObject(e,new t.Point(e.getCenterPoint().x,this.getCenterPoint().y))},centerObject:function(e){var t=this.getCenterPoint();return this._centerObject(e,t)},viewportCenterObject:function(e){var t=this.getVpCenter();return this._centerObject(e,t)},viewportCenterObjectH:function(e){var n=this.getVpCenter();return this._centerObject(e,new t.Point(n.x,e.getCenterPoint().y)),this},viewportCenterObjectV:function(e){var n=this.getVpCenter();return this._centerObject(e,new t.Point(e.getCenterPoint().x,n.y))},getVpCenter:function(){return a(this.getCenterPoint(),o(this.viewportTransform))},_centerObject:function(e,t){return e.setPositionByOrigin(t,`center`,`center`),e.setCoords(),this.renderOnAddRemove&&this.requestRenderAll(),this},toDatalessJSON:function(e){return this.toDatalessObject(e)},toObject:function(e){return this._toObjectMethod(`toObject`,e)},toDatalessObject:function(e){return this._toObjectMethod(`toDatalessObject`,e)},_toObjectMethod:function(n,r){var i=this.clipPath,a={version:t.version,objects:this._toObjects(n,r)};return i&&!i.excludeFromExport&&(a.clipPath=this._toObject(this.clipPath,n,r)),e(a,this.__serializeBgOverlay(n,r)),t.util.populateWithProperties(this,a,r),a},_toObjects:function(e,t){return this._objects.filter(function(e){return!e.excludeFromExport}).map(function(n){return this._toObject(n,e,t)},this)},_toObject:function(e,t,n){var r;this.includeDefaultValues||(r=e.includeDefaultValues,e.includeDefaultValues=!1);var i=e[t](n);return this.includeDefaultValues||(e.includeDefaultValues=r),i},__serializeBgOverlay:function(e,t){var n={},r=this.backgroundImage,i=this.overlayImage,a=this.backgroundColor,o=this.overlayColor;return a&&a.toObject?a.excludeFromExport||(n.background=a.toObject(t)):a&&(n.background=a),o&&o.toObject?o.excludeFromExport||(n.overlay=o.toObject(t)):o&&(n.overlay=o),r&&!r.excludeFromExport&&(n.backgroundImage=this._toObject(r,e,t)),i&&!i.excludeFromExport&&(n.overlayImage=this._toObject(i,e,t)),n},svgViewportTransformation:!0,toSVG:function(e,t){e||={},e.reviver=t;var n=[];return this._setSVGPreamble(n,e),this._setSVGHeader(n,e),this.clipPath&&n.push(`<g clip-path="url(#`+this.clipPath.clipPathId+`)" >
|
|
49
|
+
`),this._setSVGBgOverlayColor(n,`background`),this._setSVGBgOverlayImage(n,`backgroundImage`,t),this._setSVGObjects(n,t),this.clipPath&&n.push(`</g>
|
|
50
|
+
`),this._setSVGBgOverlayColor(n,`overlay`),this._setSVGBgOverlayImage(n,`overlayImage`,t),n.push(`</svg>`),n.join(``)},_setSVGPreamble:function(e,t){t.suppressPreamble||e.push(`<?xml version="1.0" encoding="`,t.encoding||`UTF-8`,`" standalone="no" ?>
|
|
51
|
+
`,`<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" `,`"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
52
|
+
`)},_setSVGHeader:function(e,n){var r=n.width||this.width,a=n.height||this.height,o,s=`viewBox="0 0 `+this.width+` `+this.height+`" `,c=t.Object.NUM_FRACTION_DIGITS;n.viewBox?s=`viewBox="`+n.viewBox.x+` `+n.viewBox.y+` `+n.viewBox.width+` `+n.viewBox.height+`" `:this.svgViewportTransformation&&(o=this.viewportTransform,s=`viewBox="`+i(-o[4]/o[0],c)+` `+i(-o[5]/o[3],c)+` `+i(this.width/o[0],c)+` `+i(this.height/o[3],c)+`" `),e.push(`<svg `,`xmlns="http://www.w3.org/2000/svg" `,`xmlns:xlink="http://www.w3.org/1999/xlink" `,`version="1.1" `,`width="`,r,`" `,`height="`,a,`" `,s,`xml:space="preserve">
|
|
53
|
+
`,`<desc>Created with Fabric.js `,t.version,`</desc>
|
|
54
|
+
`,`<defs>
|
|
55
|
+
`,this.createSVGFontFacesMarkup(),this.createSVGRefElementsMarkup(),this.createSVGClipPathMarkup(n),`</defs>
|
|
56
|
+
`)},createSVGClipPathMarkup:function(e){var n=this.clipPath;return n?(n.clipPathId=`CLIPPATH_`+ t.Object.__uid++,`<clipPath id="`+n.clipPathId+`" >
|
|
57
|
+
`+this.clipPath.toClipPathSVG(e.reviver)+`</clipPath>
|
|
58
|
+
`):``},createSVGRefElementsMarkup:function(){var e=this;return[`background`,`overlay`].map(function(n){var r=e[n+`Color`];if(r&&r.toLive){var i=e[n+`Vpt`],a=e.viewportTransform,o={width:e.width/(i?a[0]:1),height:e.height/(i?a[3]:1)};return r.toSVG(o,{additionalTransform:i?t.util.matrixToSVG(a):``})}}).join(``)},createSVGFontFacesMarkup:function(){var e=``,n={},r,i,a,o,s,c,l,u,d,f=t.fontPaths,p=[];for(this._objects.forEach(function e(t){p.push(t),t._objects&&t._objects.forEach(e)}),u=0,d=p.length;u<d;u++)if(r=p[u],i=r.fontFamily,!(r.type.indexOf(`text`)===-1||n[i]||!f[i])&&(n[i]=!0,r.styles))for(s in a=r.styles,a)for(l in o=a[s],o)c=o[l],i=c.fontFamily,!n[i]&&f[i]&&(n[i]=!0);for(var m in n)e+=[` @font-face {
|
|
59
|
+
`,` font-family: '`,m,`';
|
|
60
|
+
`,` src: url('`,f[m],`');
|
|
61
|
+
`,` }
|
|
62
|
+
`].join(``);return e&&=[` <style type="text/css">`,`<![CDATA[
|
|
63
|
+
`,e,`]]>`,`</style>
|
|
64
|
+
`].join(``),e},_setSVGObjects:function(e,t){var n,r,i,a=this._objects;for(r=0,i=a.length;r<i;r++)n=a[r],!n.excludeFromExport&&this._setSVGObject(e,n,t)},_setSVGObject:function(e,t,n){e.push(t.toSVG(n))},_setSVGBgOverlayImage:function(e,t,n){this[t]&&!this[t].excludeFromExport&&this[t].toSVG&&e.push(this[t].toSVG(n))},_setSVGBgOverlayColor:function(e,n){var r=this[n+`Color`],i=this.viewportTransform,a=this.width,o=this.height;if(r)if(r.toLive){var s=r.repeat,c=t.util.invertTransform(i),l=this[n+`Vpt`]?t.util.matrixToSVG(c):``;e.push(`<rect transform="`+l+` translate(`,a/2,`,`,o/2,`)"`,` x="`,r.offsetX-a/2,`" y="`,r.offsetY-o/2,`" `,`width="`,s===`repeat-y`||s===`no-repeat`?r.source.width:a,`" height="`,s===`repeat-x`||s===`no-repeat`?r.source.height:o,`" fill="url(#SVGID_`+r.id+`)"`,`></rect>
|
|
65
|
+
`)}else e.push(`<rect x="0" y="0" width="100%" height="100%" `,`fill="`,r,`"`,`></rect>
|
|
66
|
+
`)},sendToBack:function(e){if(!e)return this;var t=this._activeObject,n,i,a;if(e===t&&e.type===`activeSelection`)for(a=t._objects,n=a.length;n--;)i=a[n],r(this._objects,i),this._objects.unshift(i);else r(this._objects,e),this._objects.unshift(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},bringToFront:function(e){if(!e)return this;var t=this._activeObject,n,i,a;if(e===t&&e.type===`activeSelection`)for(a=t._objects,n=0;n<a.length;n++)i=a[n],r(this._objects,i),this._objects.push(i);else r(this._objects,e),this._objects.push(e);return this.renderOnAddRemove&&this.requestRenderAll(),this},sendBackwards:function(e,t){if(!e)return this;var n=this._activeObject,i,a,o,s,c,l=0;if(e===n&&e.type===`activeSelection`)for(c=n._objects,i=0;i<c.length;i++)a=c[i],o=this._objects.indexOf(a),o>0+l&&(s=o-1,r(this._objects,a),this._objects.splice(s,0,a)),l++;else o=this._objects.indexOf(e),o!==0&&(s=this._findNewLowerIndex(e,o,t),r(this._objects,e),this._objects.splice(s,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewLowerIndex:function(e,t,n){var r,i;if(n){for(r=t,i=t-1;i>=0;--i)if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){r=i;break}}else r=t-1;return r},bringForward:function(e,t){if(!e)return this;var n=this._activeObject,i,a,o,s,c,l=0;if(e===n&&e.type===`activeSelection`)for(c=n._objects,i=c.length;i--;)a=c[i],o=this._objects.indexOf(a),o<this._objects.length-1-l&&(s=o+1,r(this._objects,a),this._objects.splice(s,0,a)),l++;else o=this._objects.indexOf(e),o!==this._objects.length-1&&(s=this._findNewUpperIndex(e,o,t),r(this._objects,e),this._objects.splice(s,0,e));return this.renderOnAddRemove&&this.requestRenderAll(),this},_findNewUpperIndex:function(e,t,n){var r,i,a;if(n){for(r=t,i=t+1,a=this._objects.length;i<a;++i)if(e.intersectsWithObject(this._objects[i])||e.isContainedWithinObject(this._objects[i])||this._objects[i].isContainedWithinObject(e)){r=i;break}}else r=t+1;return r},moveTo:function(e,t){return r(this._objects,e),this._objects.splice(t,0,e),this.renderOnAddRemove&&this.requestRenderAll()},dispose:function(){return this.isRendering&&=(t.util.cancelAnimFrame(this.isRendering),0),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[],this.backgroundImage&&this.backgroundImage.dispose&&this.backgroundImage.dispose(),this.backgroundImage=null,this.overlayImage&&this.overlayImage.dispose&&this.overlayImage.dispose(),this.overlayImage=null,this._iTextInstances=null,this.contextContainer=null,this.lowerCanvasEl.classList.remove(`lower-canvas`),t.util.setStyle(this.lowerCanvasEl,this._originalCanvasStyle),delete this._originalCanvasStyle,this.lowerCanvasEl.setAttribute(`width`,this.width),this.lowerCanvasEl.setAttribute(`height`,this.height),t.util.cleanUpJsdomNode(this.lowerCanvasEl),this.lowerCanvasEl=void 0,this},toString:function(){return`#<fabric.Canvas (`+this.complexity()+`): { objects: `+this._objects.length+` }>`}}),e(t.StaticCanvas.prototype,t.Observable),e(t.StaticCanvas.prototype,t.Collection),e(t.StaticCanvas.prototype,t.DataURLExporter),e(t.StaticCanvas,{EMPTY_JSON:`{"objects": [], "background": "white"}`,supports:function(e){var t=c();if(!t||!t.getContext)return null;var n=t.getContext(`2d`);if(!n)return null;switch(e){case`setLineDash`:return typeof n.setLineDash<`u`;default:return null}}}),t.StaticCanvas.prototype.toJSON=t.StaticCanvas.prototype.toObject,t.isLikelyNode&&(t.StaticCanvas.prototype.createPNGStream=function(){var e=s(this.lowerCanvasEl);return e&&e.createPNGStream()},t.StaticCanvas.prototype.createJPEGStream=function(e){var t=s(this.lowerCanvasEl);return t&&t.createJPEGStream(e)})}(),t.BaseBrush=t.util.createClass({color:`rgb(0, 0, 0)`,width:1,shadow:null,strokeLineCap:`round`,strokeLineJoin:`round`,strokeMiterLimit:10,strokeDashArray:null,limitedToCanvasSize:!1,_setBrushStyles:function(e){e.strokeStyle=this.color,e.lineWidth=this.width,e.lineCap=this.strokeLineCap,e.miterLimit=this.strokeMiterLimit,e.lineJoin=this.strokeLineJoin,e.setLineDash(this.strokeDashArray||[])},_saveAndTransform:function(e){var t=this.canvas.viewportTransform;e.save(),e.transform(t[0],t[1],t[2],t[3],t[4],t[5])},_setShadow:function(){if(this.shadow){var e=this.canvas,n=this.shadow,r=e.contextTop,i=e.getZoom();e&&e._isRetinaScaling()&&(i*=t.devicePixelRatio),r.shadowColor=n.color,r.shadowBlur=n.blur*i,r.shadowOffsetX=n.offsetX*i,r.shadowOffsetY=n.offsetY*i}},needsFullRender:function(){return new t.Color(this.color).getAlpha()<1||!!this.shadow},_resetShadow:function(){var e=this.canvas.contextTop;e.shadowColor=``,e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0},_isOutSideCanvas:function(e){return e.x<0||e.x>this.canvas.getWidth()||e.y<0||e.y>this.canvas.getHeight()}}),function(){t.PencilBrush=t.util.createClass(t.BaseBrush,{decimate:.4,drawStraightLine:!1,straightLineKey:`shiftKey`,initialize:function(e){this.canvas=e,this._points=[]},needsFullRender:function(){return this.callSuper(`needsFullRender`)||this._hasStraightLine},_drawSegment:function(e,t,n){var r=t.midPointFrom(n);return e.quadraticCurveTo(t.x,t.y,r.x,r.y),r},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],this._prepareForDrawing(e),this._captureDrawingPath(e),this._render())},onMouseMove:function(e,t){if(this.canvas._isMainEvent(t.e)&&(this.drawStraightLine=t.e[this.straightLineKey],!(this.limitedToCanvasSize===!0&&this._isOutSideCanvas(e))&&this._captureDrawingPath(e)&&this._points.length>1))if(this.needsFullRender())this.canvas.clearContext(this.canvas.contextTop),this._render();else{var n=this._points,r=n.length,i=this.canvas.contextTop;this._saveAndTransform(i),this.oldEnd&&(i.beginPath(),i.moveTo(this.oldEnd.x,this.oldEnd.y)),this.oldEnd=this._drawSegment(i,n[r-2],n[r-1],!0),i.stroke(),i.restore()}},onMouseUp:function(e){return this.canvas._isMainEvent(e.e)?(this.drawStraightLine=!1,this.oldEnd=void 0,this._finalizeAndAddPath(),!1):!0},_prepareForDrawing:function(e){var n=new t.Point(e.x,e.y);this._reset(),this._addPoint(n),this.canvas.contextTop.moveTo(n.x,n.y)},_addPoint:function(e){return this._points.length>1&&e.eq(this._points[this._points.length-1])?!1:(this.drawStraightLine&&this._points.length>1&&(this._hasStraightLine=!0,this._points.pop()),this._points.push(e),!0)},_reset:function(){this._points=[],this._setBrushStyles(this.canvas.contextTop),this._setShadow(),this._hasStraightLine=!1},_captureDrawingPath:function(e){var n=new t.Point(e.x,e.y);return this._addPoint(n)},_render:function(e){var n,r,i=this._points[0],a=this._points[1];if(e||=this.canvas.contextTop,this._saveAndTransform(e),e.beginPath(),this._points.length===2&&i.x===a.x&&i.y===a.y){var o=this.width/1e3;i=new t.Point(i.x,i.y),a=new t.Point(a.x,a.y),i.x-=o,a.x+=o}for(e.moveTo(i.x,i.y),n=1,r=this._points.length;n<r;n++)this._drawSegment(e,i,a),i=this._points[n],a=this._points[n+1];e.lineTo(i.x,i.y),e.stroke(),e.restore()},convertPointsToSVGPath:function(e){var n=this.width/1e3;return t.util.getSmoothPathFromPoints(e,n)},_isEmptySVGPath:function(e){return t.util.joinPath(e)===`M 0 0 Q 0 0 0 0 L 0 0`},createPath:function(e){var n=new t.Path(e,{fill:null,stroke:this.color,strokeWidth:this.width,strokeLineCap:this.strokeLineCap,strokeMiterLimit:this.strokeMiterLimit,strokeLineJoin:this.strokeLineJoin,strokeDashArray:this.strokeDashArray});return this.shadow&&(this.shadow.affectStroke=!0,n.shadow=new t.Shadow(this.shadow)),n},decimatePoints:function(e,t){if(e.length<=2)return e;var n=(t/this.canvas.getZoom())**2,r,i=e.length-1,a=e[0],o=[a],s;for(r=1;r<i-1;r++)s=(a.x-e[r].x)**2+(a.y-e[r].y)**2,s>=n&&(a=e[r],o.push(a));return o.push(e[i]),o},_finalizeAndAddPath:function(){this.canvas.contextTop.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate));var e=this.convertPointsToSVGPath(this._points);if(this._isEmptySVGPath(e)){this.canvas.requestRenderAll();return}var t=this.createPath(e);this.canvas.clearContext(this.canvas.contextTop),this.canvas.fire(`before:path:created`,{path:t}),this.canvas.add(t),this.canvas.requestRenderAll(),t.setCoords(),this._resetShadow(),this.canvas.fire(`path:created`,{path:t})}})}(),t.CircleBrush=t.util.createClass(t.BaseBrush,{width:10,initialize:function(e){this.canvas=e,this.points=[]},drawDot:function(e){var t=this.addPoint(e),n=this.canvas.contextTop;this._saveAndTransform(n),this.dot(n,t),n.restore()},dot:function(e,t){e.fillStyle=t.fill,e.beginPath(),e.arc(t.x,t.y,t.radius,0,Math.PI*2,!1),e.closePath(),e.fill()},onMouseDown:function(e){this.points.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.drawDot(e)},_render:function(){var e=this.canvas.contextTop,t,n,r=this.points;for(this._saveAndTransform(e),t=0,n=r.length;t<n;t++)this.dot(e,r[t]);e.restore()},onMouseMove:function(e){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(e)||(this.needsFullRender()?(this.canvas.clearContext(this.canvas.contextTop),this.addPoint(e),this._render()):this.drawDot(e))},onMouseUp:function(){var e=this.canvas.renderOnAddRemove,n,r;this.canvas.renderOnAddRemove=!1;var i=[];for(n=0,r=this.points.length;n<r;n++){var a=this.points[n],o=new t.Circle({radius:a.radius,left:a.x,top:a.y,originX:`center`,originY:`center`,fill:a.fill});this.shadow&&(o.shadow=new t.Shadow(this.shadow)),i.push(o)}var s=new t.Group(i);s.canvas=this.canvas,this.canvas.fire(`before:path:created`,{path:s}),this.canvas.add(s),this.canvas.fire(`path:created`,{path:s}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=e,this.canvas.requestRenderAll()},addPoint:function(e){var n=new t.Point(e.x,e.y),r=t.util.getRandomInt(Math.max(0,this.width-20),this.width+20)/2,i=new t.Color(this.color).setAlpha(t.util.getRandomInt(0,100)/100).toRgba();return n.radius=r,n.fill=i,this.points.push(n),n}}),t.SprayBrush=t.util.createClass(t.BaseBrush,{width:10,density:20,dotWidth:1,dotWidthVariance:1,randomOpacity:!1,optimizeOverlapping:!0,initialize:function(e){this.canvas=e,this.sprayChunks=[]},onMouseDown:function(e){this.sprayChunks.length=0,this.canvas.clearContext(this.canvas.contextTop),this._setShadow(),this.addSprayChunk(e),this.render(this.sprayChunkPoints)},onMouseMove:function(e){this.limitedToCanvasSize===!0&&this._isOutSideCanvas(e)||(this.addSprayChunk(e),this.render(this.sprayChunkPoints))},onMouseUp:function(){var e=this.canvas.renderOnAddRemove;this.canvas.renderOnAddRemove=!1;for(var n=[],r=0,i=this.sprayChunks.length;r<i;r++)for(var a=this.sprayChunks[r],o=0,s=a.length;o<s;o++){var c=new t.Rect({width:a[o].width,height:a[o].width,left:a[o].x+1,top:a[o].y+1,originX:`center`,originY:`center`,fill:this.color});n.push(c)}this.optimizeOverlapping&&(n=this._getOptimizedRects(n));var l=new t.Group(n);this.shadow&&l.set(`shadow`,new t.Shadow(this.shadow)),this.canvas.fire(`before:path:created`,{path:l}),this.canvas.add(l),this.canvas.fire(`path:created`,{path:l}),this.canvas.clearContext(this.canvas.contextTop),this._resetShadow(),this.canvas.renderOnAddRemove=e,this.canvas.requestRenderAll()},_getOptimizedRects:function(e){var t={},n,r,i;for(r=0,i=e.length;r<i;r++)n=e[r].left+``+e[r].top,t[n]||(t[n]=e[r]);var a=[];for(n in t)a.push(t[n]);return a},render:function(e){var t=this.canvas.contextTop,n,r;for(t.fillStyle=this.color,this._saveAndTransform(t),n=0,r=e.length;n<r;n++){var i=e[n];typeof i.opacity<`u`&&(t.globalAlpha=i.opacity),t.fillRect(i.x,i.y,i.width,i.width)}t.restore()},_render:function(){var e=this.canvas.contextTop,t,n;for(e.fillStyle=this.color,this._saveAndTransform(e),t=0,n=this.sprayChunks.length;t<n;t++)this.render(this.sprayChunks[t]);e.restore()},addSprayChunk:function(e){this.sprayChunkPoints=[];var n,r,i,a=this.width/2,o;for(o=0;o<this.density;o++){n=t.util.getRandomInt(e.x-a,e.x+a),r=t.util.getRandomInt(e.y-a,e.y+a),i=this.dotWidthVariance?t.util.getRandomInt(Math.max(1,this.dotWidth-this.dotWidthVariance),this.dotWidth+this.dotWidthVariance):this.dotWidth;var s=new t.Point(n,r);s.width=i,this.randomOpacity&&(s.opacity=t.util.getRandomInt(0,100)/100),this.sprayChunkPoints.push(s)}this.sprayChunks.push(this.sprayChunkPoints)}}),t.PatternBrush=t.util.createClass(t.PencilBrush,{getPatternSrc:function(){var e=20,n=5,r=t.util.createCanvasElement(),i=r.getContext(`2d`);return r.width=r.height=e+n,i.fillStyle=this.color,i.beginPath(),i.arc(e/2,e/2,e/2,0,Math.PI*2,!1),i.closePath(),i.fill(),r},getPatternSrcFunction:function(){return String(this.getPatternSrc).replace(`this.color`,`"`+this.color+`"`)},getPattern:function(e){return e.createPattern(this.source||this.getPatternSrc(),`repeat`)},_setBrushStyles:function(e){this.callSuper(`_setBrushStyles`,e),e.strokeStyle=this.getPattern(e)},createPath:function(e){var n=this.callSuper(`createPath`,e),r=n._getLeftTopCoords().scalarAdd(n.strokeWidth/2);return n.stroke=new t.Pattern({source:this.source||this.getPatternSrcFunction(),offsetX:-r.x,offsetY:-r.y}),n}}),function(){var e=t.util.getPointer,n=t.util.degreesToRadians,r=t.util.isTouchEvent;for(var i in t.Canvas=t.util.createClass(t.StaticCanvas,{initialize:function(e,t){t||={},this.renderAndResetBound=this.renderAndReset.bind(this),this.requestRenderAllBound=this.requestRenderAll.bind(this),this._initStatic(e,t),this._initInteractive(),this._createCacheCanvas()},uniformScaling:!0,uniScaleKey:`shiftKey`,centeredScaling:!1,centeredRotation:!1,centeredKey:`altKey`,altActionKey:`shiftKey`,interactive:!0,selection:!0,selectionKey:`shiftKey`,altSelectionKey:null,selectionColor:`rgba(100, 100, 255, 0.3)`,selectionDashArray:[],selectionBorderColor:`rgba(255, 255, 255, 0.3)`,selectionLineWidth:1,selectionFullyContained:!1,hoverCursor:`move`,moveCursor:`move`,defaultCursor:`default`,freeDrawingCursor:`crosshair`,notAllowedCursor:`not-allowed`,containerClass:`canvas-container`,perPixelTargetFind:!1,targetFindTolerance:0,skipTargetFind:!1,isDrawingMode:!1,preserveObjectStacking:!1,snapAngle:0,snapThreshold:null,stopContextMenu:!1,fireRightClick:!1,fireMiddleClick:!1,targets:[],enablePointerEvents:!1,_hoveredTarget:null,_hoveredTargets:[],_initInteractive:function(){this._currentTransform=null,this._groupSelector=null,this._initWrapperElement(),this._createUpperCanvas(),this._initEventListeners(),this._initRetinaScaling(),this.freeDrawingBrush=t.PencilBrush&&new t.PencilBrush(this),this.calcOffset()},_chooseObjectsToRender:function(){var e=this.getActiveObjects(),t,n,r;if(e.length>0&&!this.preserveObjectStacking){n=[],r=[];for(var i=0,a=this._objects.length;i<a;i++)t=this._objects[i],e.indexOf(t)===-1?n.push(t):r.push(t);e.length>1&&(this._activeObject._objects=r),n.push.apply(n,r)}else n=this._objects;return n},renderAll:function(){this.contextTopDirty&&!this._groupSelector&&!this.isDrawingMode&&(this.clearContext(this.contextTop),this.contextTopDirty=!1),this.hasLostContext&&=(this.renderTopLayer(this.contextTop),!1);var e=this.contextContainer;return this.renderCanvas(e,this._chooseObjectsToRender()),this},renderTopLayer:function(e){e.save(),this.isDrawingMode&&this._isCurrentlyDrawing&&(this.freeDrawingBrush&&this.freeDrawingBrush._render(),this.contextTopDirty=!0),this.selection&&this._groupSelector&&(this._drawSelection(e),this.contextTopDirty=!0),e.restore()},renderTop:function(){var e=this.contextTop;return this.clearContext(e),this.renderTopLayer(e),this.fire(`after:render`),this},_normalizePointer:function(e,n){var r=e.calcTransformMatrix(),i=t.util.invertTransform(r),a=this.restorePointerVpt(n);return t.util.transformPoint(a,i)},isTargetTransparent:function(e,n,r){if(e.shouldCache()&&e._cacheCanvas&&e!==this._activeObject){var i=this._normalizePointer(e,{x:n,y:r}),a=Math.max(e.cacheTranslationX+i.x*e.zoomX,0),o=Math.max(e.cacheTranslationY+i.y*e.zoomY,0),s=t.util.isTransparent(e._cacheContext,Math.round(a),Math.round(o),this.targetFindTolerance);return s}var c=this.contextCache,l=e.selectionBackgroundColor,u=this.viewportTransform;e.selectionBackgroundColor=``,this.clearContext(c),c.save(),c.transform(u[0],u[1],u[2],u[3],u[4],u[5]),e.render(c),c.restore(),e.selectionBackgroundColor=l;var s=t.util.isTransparent(c,n,r,this.targetFindTolerance);return s},_isSelectionKeyPressed:function(e){var t=!1;return t=Array.isArray(this.selectionKey)?!!this.selectionKey.find(function(t){return e[t]===!0}):e[this.selectionKey],t},_shouldClearSelection:function(e,t){var n=this.getActiveObjects(),r=this._activeObject;return!t||t&&r&&n.length>1&&n.indexOf(t)===-1&&r!==t&&!this._isSelectionKeyPressed(e)||t&&!t.evented||t&&!t.selectable&&r&&r!==t},_shouldCenterTransform:function(e,t,n){if(e){var r;return t===`scale`||t===`scaleX`||t===`scaleY`||t===`resizing`?r=this.centeredScaling||e.centeredScaling:t===`rotate`&&(r=this.centeredRotation||e.centeredRotation),r?!n:n}},_getOriginFromCorner:function(e,t){var n={x:e.originX,y:e.originY};return t===`ml`||t===`tl`||t===`bl`?n.x=`right`:(t===`mr`||t===`tr`||t===`br`)&&(n.x=`left`),t===`tl`||t===`mt`||t===`tr`?n.y=`bottom`:(t===`bl`||t===`mb`||t===`br`)&&(n.y=`top`),n},_getActionFromCorner:function(e,t,n,r){if(!t||!e)return`drag`;var i=r.controls[t];return i.getActionName(n,i,r)},_setupCurrentTransform:function(e,r,i){if(r){var a=this.getPointer(e),o=r.__corner,s=r.controls[o],c=i&&o?s.getActionHandler(e,r,s):t.controlsUtils.dragHandler,l=this._getActionFromCorner(i,o,e,r),u=this._getOriginFromCorner(r,o),d=e[this.centeredKey],f={target:r,action:l,actionHandler:c,corner:o,scaleX:r.scaleX,scaleY:r.scaleY,skewX:r.skewX,skewY:r.skewY,offsetX:a.x-r.left,offsetY:a.y-r.top,originX:u.x,originY:u.y,ex:a.x,ey:a.y,lastX:a.x,lastY:a.y,theta:n(r.angle),width:r.width*r.scaleX,shiftKey:e.shiftKey,altKey:d,original:t.util.saveObjectTransform(r)};this._shouldCenterTransform(r,l,d)&&(f.originX=`center`,f.originY=`center`),f.original.originX=u.x,f.original.originY=u.y,this._currentTransform=f,this._beforeTransform(e)}},setCursor:function(e){this.upperCanvasEl.style.cursor=e},_drawSelection:function(e){var n=this._groupSelector,r=new t.Point(n.ex,n.ey),i=t.util.transformPoint(r,this.viewportTransform),a=new t.Point(n.ex+n.left,n.ey+n.top),o=t.util.transformPoint(a,this.viewportTransform),s=Math.min(i.x,o.x),c=Math.min(i.y,o.y),l=Math.max(i.x,o.x),u=Math.max(i.y,o.y),d=this.selectionLineWidth/2;this.selectionColor&&(e.fillStyle=this.selectionColor,e.fillRect(s,c,l-s,u-c)),!(!this.selectionLineWidth||!this.selectionBorderColor)&&(e.lineWidth=this.selectionLineWidth,e.strokeStyle=this.selectionBorderColor,s+=d,c+=d,l-=d,u-=d,t.Object.prototype._setLineDash.call(this,e,this.selectionDashArray),e.strokeRect(s,c,l-s,u-c))},findTarget:function(e,t){if(!this.skipTargetFind){var n=this.getPointer(e,!0),i=this._activeObject,a=this.getActiveObjects(),o,s,c=r(e),l=a.length>1&&!t||a.length===1;if(this.targets=[],l&&i._findTargetCorner(n,c)||a.length>1&&!t&&i===this._searchPossibleTargets([i],n))return i;if(a.length===1&&i===this._searchPossibleTargets([i],n))if(this.preserveObjectStacking)o=i,s=this.targets,this.targets=[];else return i;var u=this._searchPossibleTargets(this._objects,n);return e[this.altSelectionKey]&&u&&o&&u!==o&&(u=o,this.targets=s),u}},_checkTarget:function(e,t,n){if(t&&t.visible&&t.evented&&t.containsPoint(e))if((this.perPixelTargetFind||t.perPixelTargetFind)&&!t.isEditing){if(!this.isTargetTransparent(t,n.x,n.y))return!0}else return!0},_searchPossibleTargets:function(e,n){for(var r,i=e.length,a;i--;){var o=e[i],s=o.group?this._normalizePointer(o.group,n):n;if(this._checkTarget(s,o,n)){r=e[i],r.subTargetCheck&&r instanceof t.Group&&(a=this._searchPossibleTargets(r._objects,n),a&&this.targets.push(a));break}}return r},restorePointerVpt:function(e){return t.util.transformPoint(e,t.util.invertTransform(this.viewportTransform))},getPointer:function(t,n){if(this._absolutePointer&&!n)return this._absolutePointer;if(this._pointer&&n)return this._pointer;var r=e(t),i=this.upperCanvasEl,a=i.getBoundingClientRect(),o=a.width||0,s=a.height||0,c;(!o||!s)&&(`top`in a&&`bottom`in a&&(s=Math.abs(a.top-a.bottom)),`right`in a&&`left`in a&&(o=Math.abs(a.right-a.left))),this.calcOffset(),r.x-=this._offset.left,r.y-=this._offset.top,n||(r=this.restorePointerVpt(r));var l=this.getRetinaScaling();return l!==1&&(r.x/=l,r.y/=l),c=o===0||s===0?{width:1,height:1}:{width:i.width/o,height:i.height/s},{x:r.x*c.width,y:r.y*c.height}},_createUpperCanvas:function(){var e=this.lowerCanvasEl.className.replace(/\s*lower-canvas\s*/,``),n=this.lowerCanvasEl,r=this.upperCanvasEl;r?r.className=``:(r=this._createCanvasElement(),this.upperCanvasEl=r),t.util.addClass(r,`upper-canvas `+e),this.wrapperEl.appendChild(r),this._copyCanvasStyle(n,r),this._applyCanvasStyle(r),this.contextTop=r.getContext(`2d`)},getTopContext:function(){return this.contextTop},_createCacheCanvas:function(){this.cacheCanvasEl=this._createCanvasElement(),this.cacheCanvasEl.setAttribute(`width`,this.width),this.cacheCanvasEl.setAttribute(`height`,this.height),this.contextCache=this.cacheCanvasEl.getContext(`2d`)},_initWrapperElement:function(){this.wrapperEl=t.util.wrapElement(this.lowerCanvasEl,`div`,{class:this.containerClass}),t.util.setStyle(this.wrapperEl,{width:this.width+`px`,height:this.height+`px`,position:`relative`}),t.util.makeElementUnselectable(this.wrapperEl)},_applyCanvasStyle:function(e){var n=this.width||e.width,r=this.height||e.height;t.util.setStyle(e,{position:`absolute`,width:n+`px`,height:r+`px`,left:0,top:0,"touch-action":this.allowTouchScrolling?`manipulation`:`none`,"-ms-touch-action":this.allowTouchScrolling?`manipulation`:`none`}),e.width=n,e.height=r,t.util.makeElementUnselectable(e)},_copyCanvasStyle:function(e,t){t.style.cssText=e.style.cssText},getSelectionContext:function(){return this.contextTop},getSelectionElement:function(){return this.upperCanvasEl},getActiveObject:function(){return this._activeObject},getActiveObjects:function(){var e=this._activeObject;return e?e.type===`activeSelection`&&e._objects?e._objects.slice(0):[e]:[]},_onObjectRemoved:function(e){e===this._activeObject&&(this.fire(`before:selection:cleared`,{target:e}),this._discardActiveObject(),this.fire(`selection:cleared`,{target:e}),e.fire(`deselected`)),e===this._hoveredTarget&&(this._hoveredTarget=null,this._hoveredTargets=[]),this.callSuper(`_onObjectRemoved`,e)},_fireSelectionEvents:function(e,t){var n=!1,r=this.getActiveObjects(),i=[],a=[];e.forEach(function(e){r.indexOf(e)===-1&&(n=!0,e.fire(`deselected`,{e:t,target:e}),a.push(e))}),r.forEach(function(r){e.indexOf(r)===-1&&(n=!0,r.fire(`selected`,{e:t,target:r}),i.push(r))}),e.length>0&&r.length>0?n&&this.fire(`selection:updated`,{e:t,selected:i,deselected:a}):r.length>0?this.fire(`selection:created`,{e:t,selected:i}):e.length>0&&this.fire(`selection:cleared`,{e:t,deselected:a})},setActiveObject:function(e,t){var n=this.getActiveObjects();return this._setActiveObject(e,t),this._fireSelectionEvents(n,t),this},_setActiveObject:function(e,t){return this._activeObject===e||!this._discardActiveObject(t,e)||e.onSelect({e:t})?!1:(this._activeObject=e,!0)},_discardActiveObject:function(e,t){var n=this._activeObject;if(n){if(n.onDeselect({e,object:t}))return!1;this._activeObject=null}return!0},discardActiveObject:function(e){var t=this.getActiveObjects(),n=this.getActiveObject();return t.length&&this.fire(`before:selection:cleared`,{target:n,e}),this._discardActiveObject(e),this._fireSelectionEvents(t,e),this},dispose:function(){var e=this.wrapperEl;return this.removeListeners(),e.removeChild(this.upperCanvasEl),e.removeChild(this.lowerCanvasEl),this.contextCache=null,this.contextTop=null,[`upperCanvasEl`,`cacheCanvasEl`].forEach((function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}).bind(this)),e.parentNode&&e.parentNode.replaceChild(this.lowerCanvasEl,this.wrapperEl),delete this.wrapperEl,t.StaticCanvas.prototype.dispose.call(this),this},clear:function(){return this.discardActiveObject(),this.clearContext(this.contextTop),this.callSuper(`clear`)},drawControls:function(e){var t=this._activeObject;t&&t._renderControls(e)},_toObject:function(e,t,n){var r=this._realizeGroupTransformOnObject(e),i=this.callSuper(`_toObject`,e,t,n);return this._unwindGroupTransformOnObject(e,r),i},_realizeGroupTransformOnObject:function(e){if(e.group&&e.group.type===`activeSelection`&&this._activeObject===e.group){var n=[`angle`,`flipX`,`flipY`,`left`,`scaleX`,`scaleY`,`skewX`,`skewY`,`top`],r={};return n.forEach(function(t){r[t]=e[t]}),t.util.addTransformToObject(e,this._activeObject.calcOwnMatrix()),r}else return null},_unwindGroupTransformOnObject:function(e,t){t&&e.set(t)},_setSVGObject:function(e,t,n){var r=this._realizeGroupTransformOnObject(t);this.callSuper(`_setSVGObject`,e,t,n),this._unwindGroupTransformOnObject(t,r)},setViewportTransform:function(e){this.renderOnAddRemove&&this._activeObject&&this._activeObject.isEditing&&this._activeObject.clearContextTop(),t.StaticCanvas.prototype.setViewportTransform.call(this,e)}}),t.StaticCanvas)i!==`prototype`&&(t.Canvas[i]=t.StaticCanvas[i])}(),function(){var e=t.util.addListener,n=t.util.removeListener,r=3,i=2,a=1,o={passive:!1};function s(e,t){return e.button&&e.button===t-1}t.util.object.extend(t.Canvas.prototype,{mainTouchId:null,_initEventListeners:function(){this.removeListeners(),this._bindEvents(),this.addOrRemove(e,`add`)},_getEventPrefix:function(){return this.enablePointerEvents?`pointer`:`mouse`},addOrRemove:function(e,n){var r=this.upperCanvasEl,i=this._getEventPrefix();e(t.window,`resize`,this._onResize),e(r,i+`down`,this._onMouseDown),e(r,i+`move`,this._onMouseMove,o),e(r,i+`out`,this._onMouseOut),e(r,i+`enter`,this._onMouseEnter),e(r,`wheel`,this._onMouseWheel),e(r,`contextmenu`,this._onContextMenu),e(r,`dblclick`,this._onDoubleClick),e(r,`dragover`,this._onDragOver),e(r,`dragenter`,this._onDragEnter),e(r,`dragleave`,this._onDragLeave),e(r,`drop`,this._onDrop),this.enablePointerEvents||e(r,`touchstart`,this._onTouchStart,o),typeof eventjs<`u`&&n in eventjs&&(eventjs[n](r,`gesture`,this._onGesture),eventjs[n](r,`drag`,this._onDrag),eventjs[n](r,`orientation`,this._onOrientationChange),eventjs[n](r,`shake`,this._onShake),eventjs[n](r,`longpress`,this._onLongPress))},removeListeners:function(){this.addOrRemove(n,`remove`);var e=this._getEventPrefix();n(t.document,e+`up`,this._onMouseUp),n(t.document,`touchend`,this._onTouchEnd,o),n(t.document,e+`move`,this._onMouseMove,o),n(t.document,`touchmove`,this._onMouseMove,o)},_bindEvents:function(){this.eventsBound||=(this._onMouseDown=this._onMouseDown.bind(this),this._onTouchStart=this._onTouchStart.bind(this),this._onMouseMove=this._onMouseMove.bind(this),this._onMouseUp=this._onMouseUp.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onResize=this._onResize.bind(this),this._onGesture=this._onGesture.bind(this),this._onDrag=this._onDrag.bind(this),this._onShake=this._onShake.bind(this),this._onLongPress=this._onLongPress.bind(this),this._onOrientationChange=this._onOrientationChange.bind(this),this._onMouseWheel=this._onMouseWheel.bind(this),this._onMouseOut=this._onMouseOut.bind(this),this._onMouseEnter=this._onMouseEnter.bind(this),this._onContextMenu=this._onContextMenu.bind(this),this._onDoubleClick=this._onDoubleClick.bind(this),this._onDragOver=this._onDragOver.bind(this),this._onDragEnter=this._simpleEventHandler.bind(this,`dragenter`),this._onDragLeave=this._simpleEventHandler.bind(this,`dragleave`),this._onDrop=this._onDrop.bind(this),!0)},_onGesture:function(e,t){this.__onTransformGesture&&this.__onTransformGesture(e,t)},_onDrag:function(e,t){this.__onDrag&&this.__onDrag(e,t)},_onMouseWheel:function(e){this.__onMouseWheel(e)},_onMouseOut:function(e){var t=this._hoveredTarget;this.fire(`mouse:out`,{target:t,e}),this._hoveredTarget=null,t&&t.fire(`mouseout`,{e});var n=this;this._hoveredTargets.forEach(function(r){n.fire(`mouse:out`,{target:t,e}),r&&t.fire(`mouseout`,{e})}),this._hoveredTargets=[]},_onMouseEnter:function(e){!this._currentTransform&&!this.findTarget(e)&&(this.fire(`mouse:over`,{target:null,e}),this._hoveredTarget=null,this._hoveredTargets=[])},_onOrientationChange:function(e,t){this.__onOrientationChange&&this.__onOrientationChange(e,t)},_onShake:function(e,t){this.__onShake&&this.__onShake(e,t)},_onLongPress:function(e,t){this.__onLongPress&&this.__onLongPress(e,t)},_onDragOver:function(e){e.preventDefault();var t=this._simpleEventHandler(`dragover`,e);this._fireEnterLeaveEvents(t,e)},_onDrop:function(e){return this._simpleEventHandler(`drop:before`,e),this._simpleEventHandler(`drop`,e)},_onContextMenu:function(e){return this.stopContextMenu&&(e.stopPropagation(),e.preventDefault()),!1},_onDoubleClick:function(e){this._cacheTransformEventData(e),this._handleEvent(e,`dblclick`),this._resetTransformEventData(e)},getPointerId:function(e){var t=e.changedTouches;return t?t[0]&&t[0].identifier:this.enablePointerEvents?e.pointerId:-1},_isMainEvent:function(e){return e.isPrimary===!0?!0:e.isPrimary===!1?!1:e.type===`touchend`&&e.touches.length===0?!0:e.changedTouches?e.changedTouches[0].identifier===this.mainTouchId:!0},_onTouchStart:function(r){r.preventDefault(),this.mainTouchId===null&&(this.mainTouchId=this.getPointerId(r)),this.__onMouseDown(r),this._resetTransformEventData();var i=this.upperCanvasEl,a=this._getEventPrefix();e(t.document,`touchend`,this._onTouchEnd,o),e(t.document,`touchmove`,this._onMouseMove,o),n(i,a+`down`,this._onMouseDown)},_onMouseDown:function(r){this.__onMouseDown(r),this._resetTransformEventData();var i=this.upperCanvasEl,a=this._getEventPrefix();n(i,a+`move`,this._onMouseMove,o),e(t.document,a+`up`,this._onMouseUp),e(t.document,a+`move`,this._onMouseMove,o)},_onTouchEnd:function(r){if(!(r.touches.length>0)){this.__onMouseUp(r),this._resetTransformEventData(),this.mainTouchId=null;var i=this._getEventPrefix();n(t.document,`touchend`,this._onTouchEnd,o),n(t.document,`touchmove`,this._onMouseMove,o);var a=this;this._willAddMouseDown&&clearTimeout(this._willAddMouseDown),this._willAddMouseDown=setTimeout(function(){e(a.upperCanvasEl,i+`down`,a._onMouseDown),a._willAddMouseDown=0},400)}},_onMouseUp:function(r){this.__onMouseUp(r),this._resetTransformEventData();var i=this.upperCanvasEl,a=this._getEventPrefix();this._isMainEvent(r)&&(n(t.document,a+`up`,this._onMouseUp),n(t.document,a+`move`,this._onMouseMove,o),e(i,a+`move`,this._onMouseMove,o))},_onMouseMove:function(e){!this.allowTouchScrolling&&e.preventDefault&&e.preventDefault(),this.__onMouseMove(e)},_onResize:function(){this.calcOffset()},_shouldRender:function(e){var t=this._activeObject;return!!t!=!!e||t&&e&&t!==e?!0:(t&&t.isEditing,!1)},__onMouseUp:function(e){var n,o=this._currentTransform,c=this._groupSelector,l=!1,u=!c||c.left===0&&c.top===0;if(this._cacheTransformEventData(e),n=this._target,this._handleEvent(e,`up:before`),s(e,r)){this.fireRightClick&&this._handleEvent(e,`up`,r,u);return}if(s(e,i)){this.fireMiddleClick&&this._handleEvent(e,`up`,i,u),this._resetTransformEventData();return}if(this.isDrawingMode&&this._isCurrentlyDrawing){this._onMouseUpInDrawingMode(e);return}if(this._isMainEvent(e)){if(o&&(this._finalizeCurrentTransform(e),l=o.actionPerformed),!u){var d=n===this._activeObject;this._maybeGroupObjects(e),l||=this._shouldRender(n)||!d&&n===this._activeObject}var f,p;if(n){if(f=n._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e)),n.selectable&&n!==this._activeObject&&n.activeOn===`up`)this.setActiveObject(n,e),l=!0;else{var m=n.controls[f],h=m&&m.getMouseUpHandler(e,n,m);h&&(p=this.getPointer(e),h(e,o,p.x,p.y))}n.isMoving=!1}if(o&&(o.target!==n||o.corner!==f)){var g=o.target&&o.target.controls[o.corner],_=g&&g.getMouseUpHandler(e,n,m);p||=this.getPointer(e),_&&_(e,o,p.x,p.y)}this._setCursorFromEvent(e,n),this._handleEvent(e,`up`,a,u),this._groupSelector=null,this._currentTransform=null,n&&(n.__corner=0),l?this.requestRenderAll():u||this.renderTop()}},_simpleEventHandler:function(e,t){var n=this.findTarget(t),r=this.targets,i={e:t,target:n,subTargets:r};if(this.fire(e,i),n&&n.fire(e,i),!r)return n;for(var a=0;a<r.length;a++)r[a].fire(e,i);return n},_handleEvent:function(e,t,n,r){var i=this._target,o=this.targets||[],s={e,target:i,subTargets:o,button:n||a,isClick:r||!1,pointer:this._pointer,absolutePointer:this._absolutePointer,transform:this._currentTransform};t===`up`&&(s.currentTarget=this.findTarget(e),s.currentSubTargets=this.targets),this.fire(`mouse:`+t,s),i&&i.fire(`mouse`+t,s);for(var c=0;c<o.length;c++)o[c].fire(`mouse`+t,s)},_finalizeCurrentTransform:function(e){var t=this._currentTransform,n=t.target,r={e,target:n,transform:t,action:t.action};n._scaling&&=!1,n.setCoords(),(t.actionPerformed||this.stateful&&n.hasStateChanged())&&this._fire(`modified`,r)},_onMouseDownInDrawingMode:function(e){this._isCurrentlyDrawing=!0,this.getActiveObject()&&this.discardActiveObject(e).requestRenderAll();var t=this.getPointer(e);this.freeDrawingBrush.onMouseDown(t,{e,pointer:t}),this._handleEvent(e,`down`)},_onMouseMoveInDrawingMode:function(e){if(this._isCurrentlyDrawing){var t=this.getPointer(e);this.freeDrawingBrush.onMouseMove(t,{e,pointer:t})}this.setCursor(this.freeDrawingCursor),this._handleEvent(e,`move`)},_onMouseUpInDrawingMode:function(e){var t=this.getPointer(e);this._isCurrentlyDrawing=this.freeDrawingBrush.onMouseUp({e,pointer:t}),this._handleEvent(e,`up`)},__onMouseDown:function(e){this._cacheTransformEventData(e),this._handleEvent(e,`down:before`);var n=this._target;if(s(e,r)){this.fireRightClick&&this._handleEvent(e,`down`,r);return}if(s(e,i)){this.fireMiddleClick&&this._handleEvent(e,`down`,i);return}if(this.isDrawingMode){this._onMouseDownInDrawingMode(e);return}if(this._isMainEvent(e)&&!this._currentTransform){var a=this._pointer;this._previousPointer=a;var o=this._shouldRender(n),c=this._shouldGroup(e,n);if(this._shouldClearSelection(e,n)?this.discardActiveObject(e):c&&(this._handleGrouping(e,n),n=this._activeObject),this.selection&&(!n||!n.selectable&&!n.isEditing&&n!==this._activeObject)&&(this._groupSelector={ex:this._absolutePointer.x,ey:this._absolutePointer.y,top:0,left:0}),n){var l=n===this._activeObject;n.selectable&&n.activeOn===`down`&&this.setActiveObject(n,e);var u=n._findTargetCorner(this.getPointer(e,!0),t.util.isTouchEvent(e));if(n.__corner=u,n===this._activeObject&&(u||!c)){this._setupCurrentTransform(e,n,l);var d=n.controls[u],a=this.getPointer(e),f=d&&d.getMouseDownHandler(e,n,d);f&&f(e,this._currentTransform,a.x,a.y)}}this._handleEvent(e,`down`),(o||c)&&this.requestRenderAll()}},_resetTransformEventData:function(){this._target=null,this._pointer=null,this._absolutePointer=null},_cacheTransformEventData:function(e){this._resetTransformEventData(),this._pointer=this.getPointer(e,!0),this._absolutePointer=this.restorePointerVpt(this._pointer),this._target=this._currentTransform?this._currentTransform.target:this.findTarget(e)||null},_beforeTransform:function(e){var t=this._currentTransform;this.stateful&&t.target.saveState(),this.fire(`before:transform`,{e,transform:t})},__onMouseMove:function(e){this._handleEvent(e,`move:before`),this._cacheTransformEventData(e);var t,n;if(this.isDrawingMode){this._onMouseMoveInDrawingMode(e);return}if(this._isMainEvent(e)){var r=this._groupSelector;r?(n=this._absolutePointer,r.left=n.x-r.ex,r.top=n.y-r.ey,this.renderTop()):this._currentTransform?this._transformObject(e):(t=this.findTarget(e)||null,this._setCursorFromEvent(e,t),this._fireOverOutEvents(t,e)),this._handleEvent(e,`move`),this._resetTransformEventData()}},_fireOverOutEvents:function(e,t){var n=this._hoveredTarget,r=this._hoveredTargets,i=this.targets,a=Math.max(r.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:n,evtOut:`mouseout`,canvasEvtOut:`mouse:out`,evtIn:`mouseover`,canvasEvtIn:`mouse:over`});for(var o=0;o<a;o++)this.fireSyntheticInOutEvents(i[o],t,{oldTarget:r[o],evtOut:`mouseout`,evtIn:`mouseover`});this._hoveredTarget=e,this._hoveredTargets=this.targets.concat()},_fireEnterLeaveEvents:function(e,t){var n=this._draggedoverTarget,r=this._hoveredTargets,i=this.targets,a=Math.max(r.length,i.length);this.fireSyntheticInOutEvents(e,t,{oldTarget:n,evtOut:`dragleave`,evtIn:`dragenter`});for(var o=0;o<a;o++)this.fireSyntheticInOutEvents(i[o],t,{oldTarget:r[o],evtOut:`dragleave`,evtIn:`dragenter`});this._draggedoverTarget=e},fireSyntheticInOutEvents:function(e,t,n){var r,i,a=n.oldTarget,o,s,c=a!==e,l=n.canvasEvtIn,u=n.canvasEvtOut;c&&(r={e:t,target:e,previousTarget:a},i={e:t,target:a,nextTarget:e}),s=e&&c,o=a&&c,o&&(u&&this.fire(u,i),a.fire(n.evtOut,i)),s&&(l&&this.fire(l,r),e.fire(n.evtIn,r))},__onMouseWheel:function(e){this._cacheTransformEventData(e),this._handleEvent(e,`wheel`),this._resetTransformEventData()},_transformObject:function(e){var t=this.getPointer(e),n=this._currentTransform;n.reset=!1,n.shiftKey=e.shiftKey,n.altKey=e[this.centeredKey],this._performTransformAction(e,n,t),n.actionPerformed&&this.requestRenderAll()},_performTransformAction:function(e,t,n){var r=n.x,i=n.y,a=t.action,o=!1,s=t.actionHandler;s&&(o=s(e,t,r,i)),a===`drag`&&o&&(t.target.isMoving=!0,this.setCursor(t.target.moveCursor||this.moveCursor)),t.actionPerformed=t.actionPerformed||o},_fire:t.controlsUtils.fireEvent,_setCursorFromEvent:function(e,t){if(!t)return this.setCursor(this.defaultCursor),!1;var n=t.hoverCursor||this.hoverCursor,r=this._activeObject&&this._activeObject.type===`activeSelection`?this._activeObject:null,i=(!r||!r.contains(t))&&t._findTargetCorner(this.getPointer(e,!0));i?this.setCursor(this.getCornerCursor(i,t,e)):(t.subTargetCheck&&this.targets.concat().reverse().map(function(e){n=e.hoverCursor||n}),this.setCursor(n))},getCornerCursor:function(e,t,n){var r=t.controls[e];return r.cursorStyleHandler(n,r,t)}})}(),function(){var e=Math.min,n=Math.max;t.util.object.extend(t.Canvas.prototype,{_shouldGroup:function(e,t){var n=this._activeObject;return n&&this._isSelectionKeyPressed(e)&&t&&t.selectable&&this.selection&&(n!==t||n.type===`activeSelection`)&&!t.onSelect({e})},_handleGrouping:function(e,t){var n=this._activeObject;n.__corner||t===n&&(t=this.findTarget(e,!0),!t||!t.selectable)||(n&&n.type===`activeSelection`?this._updateActiveSelection(t,e):this._createActiveSelection(t,e))},_updateActiveSelection:function(e,t){var n=this._activeObject,r=n._objects.slice(0);n.contains(e)?(n.removeWithUpdate(e),this._hoveredTarget=e,this._hoveredTargets=this.targets.concat(),n.size()===1&&this._setActiveObject(n.item(0),t)):(n.addWithUpdate(e),this._hoveredTarget=n,this._hoveredTargets=this.targets.concat()),this._fireSelectionEvents(r,t)},_createActiveSelection:function(e,t){var n=this.getActiveObjects(),r=this._createGroup(e);this._hoveredTarget=r,this._setActiveObject(r,t),this._fireSelectionEvents(n,t)},_createGroup:function(e){var n=this._objects,r=n.indexOf(this._activeObject)<n.indexOf(e)?[this._activeObject,e]:[e,this._activeObject];return this._activeObject.isEditing&&this._activeObject.exitEditing(),new t.ActiveSelection(r,{canvas:this})},_groupSelectedObjects:function(e){var n=this._collectObjects(e),r;n.length===1?this.setActiveObject(n[0],e):n.length>1&&(r=new t.ActiveSelection(n.reverse(),{canvas:this}),this.setActiveObject(r,e))},_collectObjects:function(r){for(var i=[],a,o=this._groupSelector.ex,s=this._groupSelector.ey,c=o+this._groupSelector.left,l=s+this._groupSelector.top,u=new t.Point(e(o,c),e(s,l)),d=new t.Point(n(o,c),n(s,l)),f=!this.selectionFullyContained,p=o===c&&s===l,m=this._objects.length;m--&&(a=this._objects[m],!(!(!a||!a.selectable||!a.visible)&&(f&&a.intersectsWithRect(u,d,!0)||a.isContainedWithinRect(u,d,!0)||f&&a.containsPoint(u,null,!0)||f&&a.containsPoint(d,null,!0))&&(i.push(a),p))););return i.length>1&&(i=i.filter(function(e){return!e.onSelect({e:r})})),i},_maybeGroupObjects:function(e){this.selection&&this._groupSelector&&this._groupSelectedObjects(e),this.setCursor(this.defaultCursor),this._groupSelector=null}})}(),function(){t.util.object.extend(t.StaticCanvas.prototype,{toDataURL:function(e){e||={};var n=e.format||`png`,r=e.quality||1,i=(e.multiplier||1)*(e.enableRetinaScaling?this.getRetinaScaling():1),a=this.toCanvasElement(i,e);return t.util.toDataURL(a,n,r)},toCanvasElement:function(e,n){e||=1,n||={};var r=(n.width||this.width)*e,i=(n.height||this.height)*e,a=this.getZoom(),o=this.width,s=this.height,c=a*e,l=this.viewportTransform,u=(l[4]-(n.left||0))*e,d=(l[5]-(n.top||0))*e,f=this.interactive,p=[c,0,0,c,u,d],m=this.enableRetinaScaling,h=t.util.createCanvasElement(),g=this.contextTop;return h.width=r,h.height=i,this.contextTop=null,this.enableRetinaScaling=!1,this.interactive=!1,this.viewportTransform=p,this.width=r,this.height=i,this.calcViewportBoundaries(),this.renderCanvas(h.getContext(`2d`),this._objects),this.viewportTransform=l,this.width=o,this.height=s,this.calcViewportBoundaries(),this.interactive=f,this.enableRetinaScaling=m,this.contextTop=g,h}})}(),t.util.object.extend(t.StaticCanvas.prototype,{loadFromJSON:function(e,n,r){if(e){var i=typeof e==`string`?JSON.parse(e):t.util.object.clone(e),a=this,o=i.clipPath,s=this.renderOnAddRemove;return this.renderOnAddRemove=!1,delete i.clipPath,this._enlivenObjects(i.objects,function(e){a.clear(),a._setBgOverlay(i,function(){o?a._enlivenObjects([o],function(t){a.clipPath=t[0],a.__setupCanvas.call(a,i,e,s,n)}):a.__setupCanvas.call(a,i,e,s,n)})},r),this}},__setupCanvas:function(e,t,n,r){var i=this;t.forEach(function(e,t){i.insertAt(e,t)}),this.renderOnAddRemove=n,delete e.objects,delete e.backgroundImage,delete e.overlayImage,delete e.background,delete e.overlay,this._setOptions(e),this.renderAll(),r&&r()},_setBgOverlay:function(e,t){var n={backgroundColor:!1,overlayColor:!1,backgroundImage:!1,overlayImage:!1};if(!e.backgroundImage&&!e.overlayImage&&!e.background&&!e.overlay){t&&t();return}var r=function(){n.backgroundImage&&n.overlayImage&&n.backgroundColor&&n.overlayColor&&t&&t()};this.__setBgOverlay(`backgroundImage`,e.backgroundImage,n,r),this.__setBgOverlay(`overlayImage`,e.overlayImage,n,r),this.__setBgOverlay(`backgroundColor`,e.background,n,r),this.__setBgOverlay(`overlayColor`,e.overlay,n,r)},__setBgOverlay:function(e,n,r,i){var a=this;if(!n){r[e]=!0,i&&i();return}e===`backgroundImage`||e===`overlayImage`?t.util.enlivenObjects([n],function(t){a[e]=t[0],r[e]=!0,i&&i()}):this[`set`+t.util.string.capitalize(e,!0)](n,function(){r[e]=!0,i&&i()})},_enlivenObjects:function(e,n,r){if(!e||e.length===0){n&&n([]);return}t.util.enlivenObjects(e,function(e){n&&n(e)},null,r)},_toDataURL:function(e,t){this.clone(function(n){t(n.toDataURL(e))})},_toDataURLWithMultiplier:function(e,t,n){this.clone(function(r){n(r.toDataURLWithMultiplier(e,t))})},clone:function(e,t){var n=JSON.stringify(this.toJSON(t));this.cloneWithoutData(function(t){t.loadFromJSON(n,function(){e&&e(t)})})},cloneWithoutData:function(e){var n=t.util.createCanvasElement();n.width=this.width,n.height=this.height;var r=new t.Canvas(n);this.backgroundImage?(r.setBackgroundImage(this.backgroundImage.src,function(){r.renderAll(),e&&e(r)}),r.backgroundImageOpacity=this.backgroundImageOpacity,r.backgroundImageStretch=this.backgroundImageStretch):e&&e(r)}}),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.util.object.clone,i=t.util.toFixed,a=t.util.string.capitalize,o=t.util.degreesToRadians,s=!t.isLikelyNode,c=2;t.Object||(t.Object=t.util.createClass(t.CommonMethods,{type:`object`,originX:`left`,originY:`top`,top:0,left:0,width:0,height:0,scaleX:1,scaleY:1,flipX:!1,flipY:!1,opacity:1,angle:0,skewX:0,skewY:0,cornerSize:13,touchCornerSize:24,transparentCorners:!0,hoverCursor:null,moveCursor:null,padding:0,borderColor:`rgb(178,204,255)`,borderDashArray:null,cornerColor:`rgb(178,204,255)`,cornerStrokeColor:null,cornerStyle:`rect`,cornerDashArray:null,centeredScaling:!1,centeredRotation:!0,fill:`rgb(0,0,0)`,fillRule:`nonzero`,globalCompositeOperation:`source-over`,backgroundColor:``,selectionBackgroundColor:``,stroke:null,strokeWidth:1,strokeDashArray:null,strokeDashOffset:0,strokeLineCap:`butt`,strokeLineJoin:`miter`,strokeMiterLimit:4,shadow:null,borderOpacityWhenMoving:.4,borderScaleFactor:1,minScaleLimit:0,selectable:!0,evented:!0,visible:!0,hasControls:!0,hasBorders:!0,perPixelTargetFind:!1,includeDefaultValues:!0,lockMovementX:!1,lockMovementY:!1,lockRotation:!1,lockScalingX:!1,lockScalingY:!1,lockSkewingX:!1,lockSkewingY:!1,lockScalingFlip:!1,excludeFromExport:!1,objectCaching:s,statefullCache:!1,noScaleCache:!0,strokeUniform:!1,dirty:!0,__corner:0,paintFirst:`fill`,activeOn:`down`,stateProperties:`top left width height scaleX scaleY flipX flipY originX originY transformMatrix stroke strokeWidth strokeDashArray strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit angle opacity fill globalCompositeOperation shadow visible backgroundColor skewX skewY fillRule paintFirst clipPath strokeUniform`.split(` `),cacheProperties:`fill stroke strokeWidth strokeDashArray width height paintFirst strokeUniform strokeLineCap strokeDashOffset strokeLineJoin strokeMiterLimit backgroundColor clipPath`.split(` `),colorProperties:`fill stroke backgroundColor`.split(` `),clipPath:void 0,inverted:!1,absolutePositioned:!1,initialize:function(e){e&&this.setOptions(e)},_createCacheCanvas:function(){this._cacheProperties={},this._cacheCanvas=t.util.createCanvasElement(),this._cacheContext=this._cacheCanvas.getContext(`2d`),this._updateCacheCanvas(),this.dirty=!0},_limitCacheSize:function(e){var n=t.perfLimitSizeTotal,r=e.width,i=e.height,a=t.maxCacheSideLimit,o=t.minCacheSideLimit;if(r<=a&&i<=a&&r*i<=n)return r<o&&(e.width=o),i<o&&(e.height=o),e;var s=r/i,c=t.util.limitDimsByArea(s,n),l=t.util.capValue,u=l(o,c.x,a),d=l(o,c.y,a);return r>u&&(e.zoomX/=r/u,e.width=u,e.capped=!0),i>d&&(e.zoomY/=i/d,e.height=d,e.capped=!0),e},_getCacheCanvasDimensions:function(){var e=this.getTotalObjectScaling(),t=this._getTransformedDimensions(0,0),n=t.x*e.scaleX/this.scaleX,r=t.y*e.scaleY/this.scaleY;return{width:n+c,height:r+c,zoomX:e.scaleX,zoomY:e.scaleY,x:n,y:r}},_updateCacheCanvas:function(){var e=this.canvas;if(this.noScaleCache&&e&&e._currentTransform){var n=e._currentTransform.target,r=e._currentTransform.action;if(this===n&&r.slice&&r.slice(0,5)===`scale`)return!1}var i=this._cacheCanvas,a=this._limitCacheSize(this._getCacheCanvasDimensions()),o=t.minCacheSideLimit,s=a.width,c=a.height,l,u,d=a.zoomX,f=a.zoomY,p=s!==this.cacheWidth||c!==this.cacheHeight,m=this.zoomX!==d||this.zoomY!==f,h=p||m,g=0,_=0,v=!1;if(p){var y=this._cacheCanvas.width,b=this._cacheCanvas.height,x=s>y||c>b,S=(s<y*.9||c<b*.9)&&y>o&&b>o;v=x||S,x&&!a.capped&&(s>o||c>o)&&(g=s*.1,_=c*.1)}return this instanceof t.Text&&this.path&&(h=!0,v=!0,g+=this.getHeightOfLine(0)*this.zoomX,_+=this.getHeightOfLine(0)*this.zoomY),h?(v?(i.width=Math.ceil(s+g),i.height=Math.ceil(c+_)):(this._cacheContext.setTransform(1,0,0,1,0,0),this._cacheContext.clearRect(0,0,i.width,i.height)),l=a.x/2,u=a.y/2,this.cacheTranslationX=Math.round(i.width/2-l)+l,this.cacheTranslationY=Math.round(i.height/2-u)+u,this.cacheWidth=s,this.cacheHeight=c,this._cacheContext.translate(this.cacheTranslationX,this.cacheTranslationY),this._cacheContext.scale(d,f),this.zoomX=d,this.zoomY=f,!0):!1},setOptions:function(e){this._setOptions(e),this._initGradient(e.fill,`fill`),this._initGradient(e.stroke,`stroke`),this._initPattern(e.fill,`fill`),this._initPattern(e.stroke,`stroke`)},transform:function(e){var t=this.group&&!this.group._transformDone||this.group&&this.canvas&&e===this.canvas.contextTop,n=this.calcTransformMatrix(!t);e.transform(n[0],n[1],n[2],n[3],n[4],n[5])},toObject:function(e){var n=t.Object.NUM_FRACTION_DIGITS,r={type:this.type,version:t.version,originX:this.originX,originY:this.originY,left:i(this.left,n),top:i(this.top,n),width:i(this.width,n),height:i(this.height,n),fill:this.fill&&this.fill.toObject?this.fill.toObject():this.fill,stroke:this.stroke&&this.stroke.toObject?this.stroke.toObject():this.stroke,strokeWidth:i(this.strokeWidth,n),strokeDashArray:this.strokeDashArray?this.strokeDashArray.concat():this.strokeDashArray,strokeLineCap:this.strokeLineCap,strokeDashOffset:this.strokeDashOffset,strokeLineJoin:this.strokeLineJoin,strokeUniform:this.strokeUniform,strokeMiterLimit:i(this.strokeMiterLimit,n),scaleX:i(this.scaleX,n),scaleY:i(this.scaleY,n),angle:i(this.angle,n),flipX:this.flipX,flipY:this.flipY,opacity:i(this.opacity,n),shadow:this.shadow&&this.shadow.toObject?this.shadow.toObject():this.shadow,visible:this.visible,backgroundColor:this.backgroundColor,fillRule:this.fillRule,paintFirst:this.paintFirst,globalCompositeOperation:this.globalCompositeOperation,skewX:i(this.skewX,n),skewY:i(this.skewY,n)};return this.clipPath&&!this.clipPath.excludeFromExport&&(r.clipPath=this.clipPath.toObject(e),r.clipPath.inverted=this.clipPath.inverted,r.clipPath.absolutePositioned=this.clipPath.absolutePositioned),t.util.populateWithProperties(this,r,e),this.includeDefaultValues||(r=this._removeDefaultValues(r)),r},toDatalessObject:function(e){return this.toObject(e)},_removeDefaultValues:function(e){var n=t.util.getKlass(e.type).prototype;return n.stateProperties.forEach(function(t){t===`left`||t===`top`||(e[t]===n[t]&&delete e[t],Array.isArray(e[t])&&Array.isArray(n[t])&&e[t].length===0&&n[t].length===0&&delete e[t])}),e},toString:function(){return`#<fabric.`+a(this.type)+`>`},getObjectScaling:function(){if(!this.group)return{scaleX:this.scaleX,scaleY:this.scaleY};var e=t.util.qrDecompose(this.calcTransformMatrix());return{scaleX:Math.abs(e.scaleX),scaleY:Math.abs(e.scaleY)}},getTotalObjectScaling:function(){var e=this.getObjectScaling(),t=e.scaleX,n=e.scaleY;if(this.canvas){var r=this.canvas.getZoom(),i=this.canvas.getRetinaScaling();t*=r*i,n*=r*i}return{scaleX:t,scaleY:n}},getObjectOpacity:function(){var e=this.opacity;return this.group&&(e*=this.group.getObjectOpacity()),e},_set:function(e,n){var r=e===`scaleX`||e===`scaleY`,i=this[e]!==n,a=!1;return r&&(n=this._constrainScale(n)),e===`scaleX`&&n<0?(this.flipX=!this.flipX,n*=-1):e===`scaleY`&&n<0?(this.flipY=!this.flipY,n*=-1):e===`shadow`&&n&&!(n instanceof t.Shadow)?n=new t.Shadow(n):e===`dirty`&&this.group&&this.group.set(`dirty`,n),this[e]=n,i&&(a=this.group&&this.group.isOnACache(),this.cacheProperties.indexOf(e)>-1?(this.dirty=!0,a&&this.group.set(`dirty`,!0)):a&&this.stateProperties.indexOf(e)>-1&&this.group.set(`dirty`,!0)),this},setOnGroup:function(){},getViewportTransform:function(){return this.canvas&&this.canvas.viewportTransform?this.canvas.viewportTransform:t.iMatrix.concat()},isNotVisible:function(){return this.opacity===0||!this.width&&!this.height&&this.strokeWidth===0||!this.visible},render:function(e){this.isNotVisible()||this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(e.save(),this._setupCompositeOperation(e),this.drawSelectionBackground(e),this.transform(e),this._setOpacity(e),this._setShadow(e,this),this.shouldCache()?(this.renderCache(),this.drawCacheOnCanvas(e)):(this._removeCacheCanvas(),this.dirty=!1,this.drawObject(e),this.objectCaching&&this.statefullCache&&this.saveState({propertySet:`cacheProperties`})),e.restore())},renderCache:function(e){e||={},(!this._cacheCanvas||!this._cacheContext)&&this._createCacheCanvas(),this.isCacheDirty()&&(this.statefullCache&&this.saveState({propertySet:`cacheProperties`}),this.drawObject(this._cacheContext,e.forClipping),this.dirty=!1)},_removeCacheCanvas:function(){this._cacheCanvas=null,this._cacheContext=null,this.cacheWidth=0,this.cacheHeight=0},hasStroke:function(){return this.stroke&&this.stroke!==`transparent`&&this.strokeWidth!==0},hasFill:function(){return this.fill&&this.fill!==`transparent`},needsItsOwnCache:function(){return!!(this.paintFirst===`stroke`&&this.hasFill()&&this.hasStroke()&&typeof this.shadow==`object`||this.clipPath)},shouldCache:function(){return this.ownCaching=this.needsItsOwnCache()||this.objectCaching&&(!this.group||!this.group.isOnACache()),this.ownCaching},willDrawShadow:function(){return!!this.shadow&&(this.shadow.offsetX!==0||this.shadow.offsetY!==0)},drawClipPathOnCache:function(e,n){if(e.save(),n.inverted?e.globalCompositeOperation=`destination-out`:e.globalCompositeOperation=`destination-in`,n.absolutePositioned){var r=t.util.invertTransform(this.calcTransformMatrix());e.transform(r[0],r[1],r[2],r[3],r[4],r[5])}n.transform(e),e.scale(1/n.zoomX,1/n.zoomY),e.drawImage(n._cacheCanvas,-n.cacheTranslationX,-n.cacheTranslationY),e.restore()},drawObject:function(e,t){var n=this.fill,r=this.stroke;t?(this.fill=`black`,this.stroke=``,this._setClippingProperties(e)):this._renderBackground(e),this._render(e),this._drawClipPath(e,this.clipPath),this.fill=n,this.stroke=r},_drawClipPath:function(e,t){t&&(t.canvas=this.canvas,t.shouldCache(),t._transformDone=!0,t.renderCache({forClipping:!0}),this.drawClipPathOnCache(e,t))},drawCacheOnCanvas:function(e){e.scale(1/this.zoomX,1/this.zoomY),e.drawImage(this._cacheCanvas,-this.cacheTranslationX,-this.cacheTranslationY)},isCacheDirty:function(e){if(this.isNotVisible())return!1;if(this._cacheCanvas&&this._cacheContext&&!e&&this._updateCacheCanvas())return!0;if(this.dirty||this.clipPath&&this.clipPath.absolutePositioned||this.statefullCache&&this.hasStateChanged(`cacheProperties`)){if(this._cacheCanvas&&this._cacheContext&&!e){var t=this.cacheWidth/this.zoomX,n=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-t/2,-n/2,t,n)}return!0}return!1},_renderBackground:function(e){if(this.backgroundColor){var t=this._getNonTransformedDimensions();e.fillStyle=this.backgroundColor,e.fillRect(-t.x/2,-t.y/2,t.x,t.y),this._removeShadow(e)}},_setOpacity:function(e){this.group&&!this.group._transformDone?e.globalAlpha=this.getObjectOpacity():e.globalAlpha*=this.opacity},_setStrokeStyles:function(e,t){var n=t.stroke;n&&(e.lineWidth=t.strokeWidth,e.lineCap=t.strokeLineCap,e.lineDashOffset=t.strokeDashOffset,e.lineJoin=t.strokeLineJoin,e.miterLimit=t.strokeMiterLimit,n.toLive?n.gradientUnits===`percentage`||n.gradientTransform||n.patternTransform?this._applyPatternForTransformedGradient(e,n):(e.strokeStyle=n.toLive(e,this),this._applyPatternGradientTransform(e,n)):e.strokeStyle=t.stroke)},_setFillStyles:function(e,t){var n=t.fill;n&&(n.toLive?(e.fillStyle=n.toLive(e,this),this._applyPatternGradientTransform(e,t.fill)):e.fillStyle=n)},_setClippingProperties:function(e){e.globalAlpha=1,e.strokeStyle=`transparent`,e.fillStyle=`#000000`},_setLineDash:function(e,t){!t||t.length===0||(1&t.length&&t.push.apply(t,t),e.setLineDash(t))},_renderControls:function(e,n){var r=this.getViewportTransform(),i=this.calcTransformMatrix(),a,s,c;n||={},s=typeof n.hasBorders<`u`?n.hasBorders:this.hasBorders,c=typeof n.hasControls<`u`?n.hasControls:this.hasControls,i=t.util.multiplyTransformMatrices(r,i),a=t.util.qrDecompose(i),e.save(),e.translate(a.translateX,a.translateY),e.lineWidth=1*this.borderScaleFactor,this.group||(e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1),this.flipX&&(a.angle-=180),e.rotate(o(this.group?a.angle:this.angle)),n.forActiveSelection||this.group?s&&this.drawBordersInGroup(e,a,n):s&&this.drawBorders(e,n),c&&this.drawControls(e,n),e.restore()},_setShadow:function(e){if(this.shadow){var n=this.shadow,r=this.canvas,i,a=r&&r.viewportTransform[0]||1,o=r&&r.viewportTransform[3]||1;i=n.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),r&&r._isRetinaScaling()&&(a*=t.devicePixelRatio,o*=t.devicePixelRatio),e.shadowColor=n.color,e.shadowBlur=n.blur*t.browserShadowBlurConstant*(a+o)*(i.scaleX+i.scaleY)/4,e.shadowOffsetX=n.offsetX*a*i.scaleX,e.shadowOffsetY=n.offsetY*o*i.scaleY}},_removeShadow:function(e){this.shadow&&(e.shadowColor=``,e.shadowBlur=e.shadowOffsetX=e.shadowOffsetY=0)},_applyPatternGradientTransform:function(e,t){if(!t||!t.toLive)return{offsetX:0,offsetY:0};var n=t.gradientTransform||t.patternTransform,r=-this.width/2+t.offsetX||0,i=-this.height/2+t.offsetY||0;return t.gradientUnits===`percentage`?e.transform(this.width,0,0,this.height,r,i):e.transform(1,0,0,1,r,i),n&&e.transform(n[0],n[1],n[2],n[3],n[4],n[5]),{offsetX:r,offsetY:i}},_renderPaintInOrder:function(e){this.paintFirst===`stroke`?(this._renderStroke(e),this._renderFill(e)):(this._renderFill(e),this._renderStroke(e))},_render:function(){},_renderFill:function(e){this.fill&&(e.save(),this._setFillStyles(e,this),this.fillRule===`evenodd`?e.fill(`evenodd`):e.fill(),e.restore())},_renderStroke:function(e){if(!(!this.stroke||this.strokeWidth===0)){if(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this.strokeUniform&&this.group){var t=this.getObjectScaling();e.scale(1/t.scaleX,1/t.scaleY)}else this.strokeUniform&&e.scale(1/this.scaleX,1/this.scaleY);this._setLineDash(e,this.strokeDashArray),this._setStrokeStyles(e,this),e.stroke(),e.restore()}},_applyPatternForTransformedGradient:function(e,n){var r=this._limitCacheSize(this._getCacheCanvasDimensions()),i=t.util.createCanvasElement(),a,o=this.canvas.getRetinaScaling(),s=r.x/this.scaleX/o,c=r.y/this.scaleY/o;i.width=s,i.height=c,a=i.getContext(`2d`),a.beginPath(),a.moveTo(0,0),a.lineTo(s,0),a.lineTo(s,c),a.lineTo(0,c),a.closePath(),a.translate(s/2,c/2),a.scale(r.zoomX/this.scaleX/o,r.zoomY/this.scaleY/o),this._applyPatternGradientTransform(a,n),a.fillStyle=n.toLive(e),a.fill(),e.translate(-this.width/2-this.strokeWidth/2,-this.height/2-this.strokeWidth/2),e.scale(o*this.scaleX/r.zoomX,o*this.scaleY/r.zoomY),e.strokeStyle=a.createPattern(i,`no-repeat`)},_findCenterFromElement:function(){return{x:this.left+this.width/2,y:this.top+this.height/2}},_assignTransformMatrixProps:function(){if(this.transformMatrix){var e=t.util.qrDecompose(this.transformMatrix);this.flipX=!1,this.flipY=!1,this.set(`scaleX`,e.scaleX),this.set(`scaleY`,e.scaleY),this.angle=e.angle,this.skewX=e.skewX,this.skewY=0}},_removeTransformMatrix:function(e){var n=this._findCenterFromElement();this.transformMatrix&&(this._assignTransformMatrixProps(),n=t.util.transformPoint(n,this.transformMatrix)),this.transformMatrix=null,e&&(this.scaleX*=e.scaleX,this.scaleY*=e.scaleY,this.cropX=e.cropX,this.cropY=e.cropY,n.x+=e.offsetLeft,n.y+=e.offsetTop,this.width=e.width,this.height=e.height),this.setPositionByOrigin(n,`center`,`center`)},clone:function(e,n){var r=this.toObject(n);this.constructor.fromObject?this.constructor.fromObject(r,e):t.Object._fromObject(`Object`,r,e)},cloneAsImage:function(e,n){var r=this.toCanvasElement(n);return e&&e(new t.Image(r)),this},toCanvasElement:function(e){e||={};var n=t.util,r=n.saveObjectTransform(this),i=this.group,a=this.shadow,o=Math.abs,s=(e.multiplier||1)*(e.enableRetinaScaling?t.devicePixelRatio:1);delete this.group,e.withoutTransform&&n.resetObjectTransform(this),e.withoutShadow&&(this.shadow=null);var c=t.util.createCanvasElement(),l=this.getBoundingRect(!0,!0),u=this.shadow,d,f={x:0,y:0},p,m,h;u&&(p=u.blur,d=u.nonScaling?{scaleX:1,scaleY:1}:this.getObjectScaling(),f.x=2*Math.round(o(u.offsetX)+p)*o(d.scaleX),f.y=2*Math.round(o(u.offsetY)+p)*o(d.scaleY)),m=l.width+f.x,h=l.height+f.y,c.width=Math.ceil(m),c.height=Math.ceil(h);var g=new t.StaticCanvas(c,{enableRetinaScaling:!1,renderOnAddRemove:!1,skipOffscreen:!1});e.format===`jpeg`&&(g.backgroundColor=`#fff`),this.setPositionByOrigin(new t.Point(g.width/2,g.height/2),`center`,`center`);var _=this.canvas;g.add(this);var v=g.toCanvasElement(s||1,e);return this.shadow=a,this.set(`canvas`,_),i&&(this.group=i),this.set(r).setCoords(),g._objects=[],g.dispose(),g=null,v},toDataURL:function(e){return e||={},t.util.toDataURL(this.toCanvasElement(e),e.format||`png`,e.quality||1)},isType:function(e){return arguments.length>1?Array.from(arguments).includes(this.type):this.type===e},complexity:function(){return 1},toJSON:function(e){return this.toObject(e)},rotate:function(e){var t=(this.originX!==`center`||this.originY!==`center`)&&this.centeredRotation;return t&&this._setOriginToCenter(),this.set(`angle`,e),t&&this._resetOrigin(),this},centerH:function(){return this.canvas&&this.canvas.centerObjectH(this),this},viewportCenterH:function(){return this.canvas&&this.canvas.viewportCenterObjectH(this),this},centerV:function(){return this.canvas&&this.canvas.centerObjectV(this),this},viewportCenterV:function(){return this.canvas&&this.canvas.viewportCenterObjectV(this),this},center:function(){return this.canvas&&this.canvas.centerObject(this),this},viewportCenter:function(){return this.canvas&&this.canvas.viewportCenterObject(this),this},getLocalPointer:function(e,n){n||=this.canvas.getPointer(e);var r=new t.Point(n.x,n.y),i=this._getLeftTopCoords();return this.angle&&(r=t.util.rotatePoint(r,i,o(-this.angle))),{x:r.x-i.x,y:r.y-i.y}},_setupCompositeOperation:function(e){this.globalCompositeOperation&&(e.globalCompositeOperation=this.globalCompositeOperation)},dispose:function(){t.runningAnimations&&t.runningAnimations.cancelByTarget(this)}}),t.util.createAccessors&&t.util.createAccessors(t.Object),n(t.Object.prototype,t.Observable),t.Object.NUM_FRACTION_DIGITS=2,t.Object.ENLIVEN_PROPS=[`clipPath`],t.Object._fromObject=function(e,n,i,a){var o=t[e];n=r(n,!0),t.util.enlivenPatterns([n.fill,n.stroke],function(e){typeof e[0]<`u`&&(n.fill=e[0]),typeof e[1]<`u`&&(n.stroke=e[1]),t.util.enlivenObjectEnlivables(n,n,function(){var e=a?new o(n[a],n):new o(n);i&&i(e)})})},t.Object.__uid=0)}(e),function(){var e=t.util.degreesToRadians,n={left:-.5,center:0,right:.5},r={top:-.5,center:0,bottom:.5};t.util.object.extend(t.Object.prototype,{translateToGivenOrigin:function(e,i,a,o,s){var c=e.x,l=e.y,u,d,f;return typeof i==`string`?i=n[i]:i-=.5,typeof o==`string`?o=n[o]:o-=.5,u=o-i,typeof a==`string`?a=r[a]:a-=.5,typeof s==`string`?s=r[s]:s-=.5,d=s-a,(u||d)&&(f=this._getTransformedDimensions(),c=e.x+u*f.x,l=e.y+d*f.y),new t.Point(c,l)},translateToCenterPoint:function(n,r,i){var a=this.translateToGivenOrigin(n,r,i,`center`,`center`);return this.angle?t.util.rotatePoint(a,n,e(this.angle)):a},translateToOriginPoint:function(n,r,i){var a=this.translateToGivenOrigin(n,`center`,`center`,r,i);return this.angle?t.util.rotatePoint(a,n,e(this.angle)):a},getCenterPoint:function(){var e=new t.Point(this.left,this.top);return this.translateToCenterPoint(e,this.originX,this.originY)},getPointByOrigin:function(e,t){var n=this.getCenterPoint();return this.translateToOriginPoint(n,e,t)},toLocalPoint:function(n,r,i){var a=this.getCenterPoint(),o,s;return o=typeof r<`u`&&typeof i<`u`?this.translateToGivenOrigin(a,`center`,`center`,r,i):new t.Point(this.left,this.top),s=new t.Point(n.x,n.y),this.angle&&(s=t.util.rotatePoint(s,a,-e(this.angle))),s.subtractEquals(o)},setPositionByOrigin:function(e,t,n){var r=this.translateToCenterPoint(e,t,n),i=this.translateToOriginPoint(r,this.originX,this.originY);this.set(`left`,i.x),this.set(`top`,i.y)},adjustPosition:function(r){var i=e(this.angle),a=this.getScaledWidth(),o=t.util.cos(i)*a,s=t.util.sin(i)*a,c=typeof this.originX==`string`?n[this.originX]:this.originX-.5,l=typeof r==`string`?n[r]:r-.5;this.left+=o*(l-c),this.top+=s*(l-c),this.setCoords(),this.originX=r},_setOriginToCenter:function(){this._originalOriginX=this.originX,this._originalOriginY=this.originY;var e=this.getCenterPoint();this.originX=`center`,this.originY=`center`,this.left=e.x,this.top=e.y},_resetOrigin:function(){var e=this.translateToOriginPoint(this.getCenterPoint(),this._originalOriginX,this._originalOriginY);this.originX=this._originalOriginX,this.originY=this._originalOriginY,this.left=e.x,this.top=e.y,this._originalOriginX=null,this._originalOriginY=null},_getLeftTopCoords:function(){return this.translateToOriginPoint(this.getCenterPoint(),`left`,`top`)}})}(),function(){function e(e){return[new t.Point(e.tl.x,e.tl.y),new t.Point(e.tr.x,e.tr.y),new t.Point(e.br.x,e.br.y),new t.Point(e.bl.x,e.bl.y)]}var n=t.util,r=n.degreesToRadians,i=n.multiplyTransformMatrices,a=n.transformPoint;n.object.extend(t.Object.prototype,{oCoords:null,aCoords:null,lineCoords:null,ownMatrixCache:null,matrixCache:null,controls:{},_getCoords:function(e,t){return t?e?this.calcACoords():this.calcLineCoords():((!this.aCoords||!this.lineCoords)&&this.setCoords(!0),e?this.aCoords:this.lineCoords)},getCoords:function(t,n){return e(this._getCoords(t,n))},intersectsWithRect:function(e,n,r,i){var a=this.getCoords(r,i);return t.Intersection.intersectPolygonRectangle(a,e,n).status===`Intersection`},intersectsWithObject:function(e,n,r){return t.Intersection.intersectPolygonPolygon(this.getCoords(n,r),e.getCoords(n,r)).status===`Intersection`||e.isContainedWithinObject(this,n,r)||this.isContainedWithinObject(e,n,r)},isContainedWithinObject:function(e,t,n){for(var r=this.getCoords(t,n),i=t?e.aCoords:e.lineCoords,a=0,o=e._getImageLines(i);a<4;a++)if(!e.containsPoint(r[a],o))return!1;return!0},isContainedWithinRect:function(e,t,n,r){var i=this.getBoundingRect(n,r);return i.left>=e.x&&i.left+i.width<=t.x&&i.top>=e.y&&i.top+i.height<=t.y},containsPoint:function(e,t,n,r){var i=this._getCoords(n,r),t=t||this._getImageLines(i),a=this._findCrossPoints(e,t);return a!==0&&a%2==1},isOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return this.getCoords(!0,e).some(function(e){return e.x<=n.x&&e.x>=t.x&&e.y<=n.y&&e.y>=t.y})||this.intersectsWithRect(t,n,!0,e)?!0:this._containsCenterOfCanvas(t,n,e)},_containsCenterOfCanvas:function(e,t,n){var r={x:(e.x+t.x)/2,y:(e.y+t.y)/2};return!!this.containsPoint(r,null,!0,n)},isPartiallyOnScreen:function(e){if(!this.canvas)return!1;var t=this.canvas.vptCoords.tl,n=this.canvas.vptCoords.br;return this.intersectsWithRect(t,n,!0,e)?!0:this.getCoords(!0,e).every(function(e){return(e.x>=n.x||e.x<=t.x)&&(e.y>=n.y||e.y<=t.y)})&&this._containsCenterOfCanvas(t,n,e)},_getImageLines:function(e){return{topline:{o:e.tl,d:e.tr},rightline:{o:e.tr,d:e.br},bottomline:{o:e.br,d:e.bl},leftline:{o:e.bl,d:e.tl}}},_findCrossPoints:function(e,t){var n,r,i,a,o,s=0,c;for(var l in t)if(c=t[l],!(c.o.y<e.y&&c.d.y<e.y)&&!(c.o.y>=e.y&&c.d.y>=e.y)&&(c.o.x===c.d.x&&c.o.x>=e.x?o=c.o.x:(n=0,r=(c.d.y-c.o.y)/(c.d.x-c.o.x),i=e.y-n*e.x,a=c.o.y-r*c.o.x,o=-(i-a)/(n-r)),o>=e.x&&(s+=1),s===2))break;return s},getBoundingRect:function(e,t){var r=this.getCoords(e,t);return n.makeBoundingBoxFromPoints(r)},getScaledWidth:function(){return this._getTransformedDimensions().x},getScaledHeight:function(){return this._getTransformedDimensions().y},_constrainScale:function(e){return Math.abs(e)<this.minScaleLimit?e<0?-this.minScaleLimit:this.minScaleLimit:e===0?1e-4:e},scale:function(e){return this._set(`scaleX`,e),this._set(`scaleY`,e),this.setCoords()},scaleToWidth:function(e,t){var n=this.getBoundingRect(t).width/this.getScaledWidth();return this.scale(e/this.width/n)},scaleToHeight:function(e,t){var n=this.getBoundingRect(t).height/this.getScaledHeight();return this.scale(e/this.height/n)},calcLineCoords:function(){var e=this.getViewportTransform(),t=this.padding,i=r(this.angle),o=n.cos(i),s=n.sin(i),c=o*t,l=s*t,u=c+l,d=c-l,f=this.calcACoords(),p={tl:a(f.tl,e),tr:a(f.tr,e),bl:a(f.bl,e),br:a(f.br,e)};return t&&(p.tl.x-=d,p.tl.y-=u,p.tr.x+=u,p.tr.y-=d,p.bl.x-=u,p.bl.y+=d,p.br.x+=d,p.br.y+=u),p},calcOCoords:function(){var e=this._calcRotateMatrix(),t=this._calcTranslateMatrix(),n=this.getViewportTransform(),r=i(i(n,t),e),r=i(r,[1/n[0],0,0,1/n[3],0,0]),a=this._calculateCurrentDimensions(),o={};return this.forEachControl(function(e,t,n){o[t]=e.positionHandler(a,r,n)}),o},calcACoords:function(){var e=this._calcRotateMatrix(),t=i(this._calcTranslateMatrix(),e),n=this._getTransformedDimensions(),r=n.x/2,o=n.y/2;return{tl:a({x:-r,y:-o},t),tr:a({x:r,y:-o},t),bl:a({x:-r,y:o},t),br:a({x:r,y:o},t)}},setCoords:function(e){return this.aCoords=this.calcACoords(),this.lineCoords=this.group?this.aCoords:this.calcLineCoords(),e?this:(this.oCoords=this.calcOCoords(),this._setCornerCoords&&this._setCornerCoords(),this)},_calcRotateMatrix:function(){return n.calcRotateMatrix(this)},_calcTranslateMatrix:function(){var e=this.getCenterPoint();return[1,0,0,1,e.x,e.y]},transformMatrixKey:function(e){var t=`_`,n=``;return!e&&this.group&&(n=this.group.transformMatrixKey(e)+t),n+this.top+t+this.left+t+this.scaleX+t+this.scaleY+t+this.skewX+t+this.skewY+t+this.angle+t+this.originX+t+this.originY+t+this.width+t+this.height+t+this.strokeWidth+this.flipX+this.flipY},calcTransformMatrix:function(e){var t=this.calcOwnMatrix();if(e||!this.group)return t;var n=this.transformMatrixKey(e),r=this.matrixCache||={};return r.key===n?r.value:(this.group&&(t=i(this.group.calcTransformMatrix(!1),t)),r.key=n,r.value=t,t)},calcOwnMatrix:function(){var e=this.transformMatrixKey(!0),t=this.ownMatrixCache||={};if(t.key===e)return t.value;var r=this._calcTranslateMatrix(),i={angle:this.angle,translateX:r[4],translateY:r[5],scaleX:this.scaleX,scaleY:this.scaleY,skewX:this.skewX,skewY:this.skewY,flipX:this.flipX,flipY:this.flipY};return t.key=e,t.value=n.composeMatrix(i),t.value},_getNonTransformedDimensions:function(){var e=this.strokeWidth;return{x:this.width+e,y:this.height+e}},_getTransformedDimensions:function(e,t){typeof e>`u`&&(e=this.skewX),typeof t>`u`&&(t=this.skewY);var r,i,a,o=e===0&&t===0;if(this.strokeUniform?(i=this.width,a=this.height):(r=this._getNonTransformedDimensions(),i=r.x,a=r.y),o)return this._finalizeDimensions(i*this.scaleX,a*this.scaleY);var s=n.sizeAfterTransform(i,a,{scaleX:this.scaleX,scaleY:this.scaleY,skewX:e,skewY:t});return this._finalizeDimensions(s.x,s.y)},_finalizeDimensions:function(e,t){return this.strokeUniform?{x:e+this.strokeWidth,y:t+this.strokeWidth}:{x:e,y:t}},_calculateCurrentDimensions:function(){var e=this.getViewportTransform();return a(this._getTransformedDimensions(),e,!0).scalarAdd(2*this.padding)}})}(),t.util.object.extend(t.Object.prototype,{sendToBack:function(){return this.group?t.StaticCanvas.prototype.sendToBack.call(this.group,this):this.canvas&&this.canvas.sendToBack(this),this},bringToFront:function(){return this.group?t.StaticCanvas.prototype.bringToFront.call(this.group,this):this.canvas&&this.canvas.bringToFront(this),this},sendBackwards:function(e){return this.group?t.StaticCanvas.prototype.sendBackwards.call(this.group,this,e):this.canvas&&this.canvas.sendBackwards(this,e),this},bringForward:function(e){return this.group?t.StaticCanvas.prototype.bringForward.call(this.group,this,e):this.canvas&&this.canvas.bringForward(this,e),this},moveTo:function(e){return this.group&&this.group.type!==`activeSelection`?t.StaticCanvas.prototype.moveTo.call(this.group,this,e):this.canvas&&this.canvas.moveTo(this,e),this}}),function(){function e(e,n){if(n){if(n.toLive)return e+`: url(#SVGID_`+n.id+`); `;var r=new t.Color(n),i=e+`: `+r.toRgb()+`; `,a=r.getAlpha();return a!==1&&(i+=e+`-opacity: `+a.toString()+`; `),i}else return e+`: none; `}var n=t.util.toFixed;t.util.object.extend(t.Object.prototype,{getSvgStyles:function(t){var n=this.fillRule?this.fillRule:`nonzero`,r=this.strokeWidth?this.strokeWidth:`0`,i=this.strokeDashArray?this.strokeDashArray.join(` `):`none`,a=this.strokeDashOffset?this.strokeDashOffset:`0`,o=this.strokeLineCap?this.strokeLineCap:`butt`,s=this.strokeLineJoin?this.strokeLineJoin:`miter`,c=this.strokeMiterLimit?this.strokeMiterLimit:`4`,l=typeof this.opacity<`u`?this.opacity:`1`,u=this.visible?``:` visibility: hidden;`,d=t?``:this.getSvgFilter(),f=e(`fill`,this.fill);return[e(`stroke`,this.stroke),`stroke-width: `,r,`; `,`stroke-dasharray: `,i,`; `,`stroke-linecap: `,o,`; `,`stroke-dashoffset: `,a,`; `,`stroke-linejoin: `,s,`; `,`stroke-miterlimit: `,c,`; `,f,`fill-rule: `,n,`; `,`opacity: `,l,`;`,d,u].join(``)},getSvgSpanStyles:function(t,n){var r=`; `,i=t.fontFamily?`font-family: `+(t.fontFamily.indexOf(`'`)===-1&&t.fontFamily.indexOf(`"`)===-1?`'`+t.fontFamily+`'`:t.fontFamily)+r:``,a=t.strokeWidth?`stroke-width: `+t.strokeWidth+r:``,i=i,o=t.fontSize?`font-size: `+t.fontSize+`px`+r:``,s=t.fontStyle?`font-style: `+t.fontStyle+r:``,c=t.fontWeight?`font-weight: `+t.fontWeight+r:``,l=t.fill?e(`fill`,t.fill):``,u=t.stroke?e(`stroke`,t.stroke):``,d=this.getSvgTextDecoration(t),f=t.deltaY?`baseline-shift: `+-t.deltaY+`; `:``;return d&&=`text-decoration: `+d+r,[u,a,i,o,s,c,d,l,f,n?`white-space: pre; `:``].join(``)},getSvgTextDecoration:function(e){return[`overline`,`underline`,`line-through`].filter(function(t){return e[t.replace(`-`,``)]}).join(` `)},getSvgFilter:function(){return this.shadow?`filter: url(#SVGID_`+this.shadow.id+`);`:``},getSvgCommons:function(){return[this.id?`id="`+this.id+`" `:``,this.clipPath?`clip-path="url(#`+this.clipPath.clipPathId+`)" `:``].join(``)},getSvgTransform:function(e,n){var r=e?this.calcTransformMatrix():this.calcOwnMatrix();return`transform="`+t.util.matrixToSVG(r)+(n||``)+`" `},_setSVGBg:function(e){if(this.backgroundColor){var r=t.Object.NUM_FRACTION_DIGITS;e.push(` <rect `,this._getFillAttributes(this.backgroundColor),` x="`,n(-this.width/2,r),`" y="`,n(-this.height/2,r),`" width="`,n(this.width,r),`" height="`,n(this.height,r),`"></rect>
|
|
67
|
+
`)}},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(e),{reviver:e})},toClipPathSVG:function(e){return` `+this._createBaseClipPathSVGMarkup(this._toSVG(e),{reviver:e})},_createBaseClipPathSVGMarkup:function(e,t){t||={};var n=t.reviver,r=t.additionalTransform||``,i=[this.getSvgTransform(!0,r),this.getSvgCommons()].join(``),a=e.indexOf(`COMMON_PARTS`);return e[a]=i,n?n(e.join(``)):e.join(``)},_createBaseSVGMarkup:function(e,n){n||={};var r=n.noStyle,i=n.reviver,a=r?``:`style="`+this.getSvgStyles()+`" `,o=n.withShadow?`style="`+this.getSvgFilter()+`" `:``,s=this.clipPath,c=this.strokeUniform?`vector-effect="non-scaling-stroke" `:``,l=s&&s.absolutePositioned,u=this.stroke,d=this.fill,f=this.shadow,p,m=[],h,g=e.indexOf(`COMMON_PARTS`),_=n.additionalTransform;return s&&(s.clipPathId=`CLIPPATH_`+ t.Object.__uid++,h=`<clipPath id="`+s.clipPathId+`" >
|
|
68
|
+
`+s.toClipPathSVG(i)+`</clipPath>
|
|
69
|
+
`),l&&m.push(`<g `,o,this.getSvgCommons(),` >
|
|
70
|
+
`),m.push(`<g `,this.getSvgTransform(!1),l?``:o+this.getSvgCommons(),` >
|
|
71
|
+
`),p=[a,c,r?``:this.addPaintOrder(),` `,_?`transform="`+_+`" `:``].join(``),e[g]=p,d&&d.toLive&&m.push(d.toSVG(this)),u&&u.toLive&&m.push(u.toSVG(this)),f&&m.push(f.toSVG(this)),s&&m.push(h),m.push(e.join(``)),m.push(`</g>
|
|
72
|
+
`),l&&m.push(`</g>
|
|
73
|
+
`),i?i(m.join(``)):m.join(``)},addPaintOrder:function(){return this.paintFirst===`fill`?``:` paint-order="`+this.paintFirst+`" `}})}(),function(){var e=t.util.object.extend,n=`stateProperties`;function r(t,n,r){var i={};r.forEach(function(e){i[e]=t[e]}),e(t[n],i,!0)}function i(e,t,n){if(e===t)return!0;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(var r=0,a=e.length;r<a;r++)if(!i(e[r],t[r]))return!1;return!0}else if(e&&typeof e==`object`){var o=Object.keys(e),s;if(!t||typeof t!=`object`||!n&&o.length!==Object.keys(t).length)return!1;for(var r=0,a=o.length;r<a;r++)if(s=o[r],!(s===`canvas`||s===`group`)&&!i(e[s],t[s]))return!1;return!0}}t.util.object.extend(t.Object.prototype,{hasStateChanged:function(e){e||=n;var t=`_`+e;return Object.keys(this[t]).length<this[e].length?!0:!i(this[t],this,!0)},saveState:function(e){var t=e&&e.propertySet||n,i=`_`+t;return this[i]?(r(this,i,this[t]),e&&e.stateProperties&&r(this,i,e.stateProperties),this):this.setupState(e)},setupState:function(e){e||={};var t=e.propertySet||n;return e.propertySet=t,this[`_`+t]={},this.saveState(e),this}})}(),function(){var e=t.util.degreesToRadians;t.util.object.extend(t.Object.prototype,{_findTargetCorner:function(e,t){if(!this.hasControls||this.group||!this.canvas||this.canvas._activeObject!==this)return!1;var n=e.x,r=e.y,i,a,o=Object.keys(this.oCoords),s=o.length-1,c;for(this.__corner=0;s>=0;s--)if(c=o[s],this.isControlVisible(c)&&(a=this._getImageLines(t?this.oCoords[c].touchCorner:this.oCoords[c].corner),i=this._findCrossPoints({x:n,y:r},a),i!==0&&i%2==1))return this.__corner=c,c;return!1},forEachControl:function(e){for(var t in this.controls)e(this.controls[t],t,this)},_setCornerCoords:function(){var e=this.oCoords;for(var t in e){var n=this.controls[t];e[t].corner=n.calcCornerCoords(this.angle,this.cornerSize,e[t].x,e[t].y,!1),e[t].touchCorner=n.calcCornerCoords(this.angle,this.touchCornerSize,e[t].x,e[t].y,!0)}},drawSelectionBackground:function(t){if(!this.selectionBackgroundColor||this.canvas&&!this.canvas.interactive||this.canvas&&this.canvas._activeObject!==this)return this;t.save();var n=this.getCenterPoint(),r=this._calculateCurrentDimensions(),i=this.canvas.viewportTransform;return t.translate(n.x,n.y),t.scale(1/i[0],1/i[3]),t.rotate(e(this.angle)),t.fillStyle=this.selectionBackgroundColor,t.fillRect(-r.x/2,-r.y/2,r.x,r.y),t.restore(),this},drawBorders:function(e,t){t||={};var n=this._calculateCurrentDimensions(),r=this.borderScaleFactor,i=n.x+r,a=n.y+r,o=typeof t.hasControls<`u`?t.hasControls:this.hasControls,s=!1;return e.save(),e.strokeStyle=t.borderColor||this.borderColor,this._setLineDash(e,t.borderDashArray||this.borderDashArray),e.strokeRect(-i/2,-a/2,i,a),o&&(e.beginPath(),this.forEachControl(function(t,n,r){t.withConnection&&t.getVisibility(r,n)&&(s=!0,e.moveTo(t.x*i,t.y*a),e.lineTo(t.x*i+t.offsetX,t.y*a+t.offsetY))}),s&&e.stroke()),e.restore(),this},drawBordersInGroup:function(e,n,r){r||={};var i=t.util.sizeAfterTransform(this.width,this.height,n),a=this.strokeWidth,o=this.strokeUniform,s=this.borderScaleFactor,c=i.x+a*(o?this.canvas.getZoom():n.scaleX)+s,l=i.y+a*(o?this.canvas.getZoom():n.scaleY)+s;return e.save(),this._setLineDash(e,r.borderDashArray||this.borderDashArray),e.strokeStyle=r.borderColor||this.borderColor,e.strokeRect(-c/2,-l/2,c,l),e.restore(),this},drawControls:function(e,n){n||={},e.save();var r=this.canvas.getRetinaScaling(),i,a;return e.setTransform(r,0,0,r,0,0),e.strokeStyle=e.fillStyle=n.cornerColor||this.cornerColor,this.transparentCorners||(e.strokeStyle=n.cornerStrokeColor||this.cornerStrokeColor),this._setLineDash(e,n.cornerDashArray||this.cornerDashArray),this.setCoords(),this.group&&(i=this.group.calcTransformMatrix()),this.forEachControl(function(r,o,s){a=s.oCoords[o],r.getVisibility(s,o)&&(i&&(a=t.util.transformPoint(a,i)),r.render(e,a.x,a.y,n,s))}),e.restore(),this},isControlVisible:function(e){return this.controls[e]&&this.controls[e].getVisibility(this,e)},setControlVisible:function(e,t){return this._controlsVisibility||={},this._controlsVisibility[e]=t,this},setControlsVisibility:function(e){for(var t in e||={},e)this.setControlVisible(t,e[t]);return this},onDeselect:function(){},onSelect:function(){}})}(),t.util.object.extend(t.StaticCanvas.prototype,{FX_DURATION:500,fxCenterObjectH:function(e,n){n||={};var r=function(){},i=n.onComplete||r,a=n.onChange||r,o=this;return t.util.animate({target:this,startValue:e.left,endValue:this.getCenterPoint().x,duration:this.FX_DURATION,onChange:function(t){e.set(`left`,t),o.requestRenderAll(),a()},onComplete:function(){e.setCoords(),i()}})},fxCenterObjectV:function(e,n){n||={};var r=function(){},i=n.onComplete||r,a=n.onChange||r,o=this;return t.util.animate({target:this,startValue:e.top,endValue:this.getCenterPoint().y,duration:this.FX_DURATION,onChange:function(t){e.set(`top`,t),o.requestRenderAll(),a()},onComplete:function(){e.setCoords(),i()}})},fxRemove:function(e,n){n||={};var r=function(){},i=n.onComplete||r,a=n.onChange||r,o=this;return t.util.animate({target:this,startValue:e.opacity,endValue:0,duration:this.FX_DURATION,onChange:function(t){e.set(`opacity`,t),o.requestRenderAll(),a()},onComplete:function(){o.remove(e),i()}})}}),t.util.object.extend(t.Object.prototype,{animate:function(){if(arguments[0]&&typeof arguments[0]==`object`){var e=[],t,n,r=[];for(t in arguments[0])e.push(t);for(var i=0,a=e.length;i<a;i++)t=e[i],n=i!==a-1,r.push(this._animate(t,arguments[0][t],arguments[1],n));return r}else return this._animate.apply(this,arguments)},_animate:function(e,n,r,i){var a=this,o;n=n.toString(),r=r?t.util.object.clone(r):{},~e.indexOf(`.`)&&(o=e.split(`.`));var s=a.colorProperties.indexOf(e)>-1||o&&a.colorProperties.indexOf(o[1])>-1,c=o?this.get(o[0])[o[1]]:this.get(e);`from`in r||(r.from=c),s||(n=~n.indexOf(`=`)?c+parseFloat(n.replace(`=`,``)):parseFloat(n));var l={target:this,startValue:r.from,endValue:n,byValue:r.by,easing:r.easing,duration:r.duration,abort:r.abort&&function(e,t,n){return r.abort.call(a,e,t,n)},onChange:function(t,n,s){o?a[o[0]][o[1]]=t:a.set(e,t),!i&&r.onChange&&r.onChange(t,n,s)},onComplete:function(e,t,n){i||(a.setCoords(),r.onComplete&&r.onComplete(e,t,n))}};return s?t.util.animateColor(l.startValue,l.endValue,l.duration,l):t.util.animate(l)}}),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.util.object.clone,i={x1:1,x2:1,y1:1,y2:1};if(t.Line){t.warn(`fabric.Line is already defined`);return}t.Line=t.util.createClass(t.Object,{type:`line`,x1:0,y1:0,x2:0,y2:0,cacheProperties:t.Object.prototype.cacheProperties.concat(`x1`,`x2`,`y1`,`y2`),initialize:function(e,t){e||=[0,0,0,0],this.callSuper(`initialize`,t),this.set(`x1`,e[0]),this.set(`y1`,e[1]),this.set(`x2`,e[2]),this.set(`y2`,e[3]),this._setWidthHeight(t)},_setWidthHeight:function(e){e||={},this.width=Math.abs(this.x2-this.x1),this.height=Math.abs(this.y2-this.y1),this.left=`left`in e?e.left:this._getLeftToOriginX(),this.top=`top`in e?e.top:this._getTopToOriginY()},_set:function(e,t){return this.callSuper(`_set`,e,t),typeof i[e]<`u`&&this._setWidthHeight(),this},_getLeftToOriginX:a({origin:`originX`,axis1:`x1`,axis2:`x2`,dimension:`width`},{nearest:`left`,center:`center`,farthest:`right`}),_getTopToOriginY:a({origin:`originY`,axis1:`y1`,axis2:`y2`,dimension:`height`},{nearest:`top`,center:`center`,farthest:`bottom`}),_render:function(e){e.beginPath();var t=this.calcLinePoints();e.moveTo(t.x1,t.y1),e.lineTo(t.x2,t.y2),e.lineWidth=this.strokeWidth;var n=e.strokeStyle;e.strokeStyle=this.stroke||e.fillStyle,this.stroke&&this._renderStroke(e),e.strokeStyle=n},_findCenterFromElement:function(){return{x:(this.x1+this.x2)/2,y:(this.y1+this.y2)/2}},toObject:function(e){return n(this.callSuper(`toObject`,e),this.calcLinePoints())},_getNonTransformedDimensions:function(){var e=this.callSuper(`_getNonTransformedDimensions`);return this.strokeLineCap===`butt`&&(this.width===0&&(e.y-=this.strokeWidth),this.height===0&&(e.x-=this.strokeWidth)),e},calcLinePoints:function(){var e=this.x1<=this.x2?-1:1,t=this.y1<=this.y2?-1:1,n=e*this.width*.5,r=t*this.height*.5;return{x1:n,x2:e*this.width*-.5,y1:r,y2:t*this.height*-.5}},_toSVG:function(){var e=this.calcLinePoints();return[`<line `,`COMMON_PARTS`,`x1="`,e.x1,`" y1="`,e.y1,`" x2="`,e.x2,`" y2="`,e.y2,`" />
|
|
74
|
+
`]}}),t.Line.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`x1 y1 x2 y2`.split(` `)),t.Line.fromElement=function(e,r,i){i||={};var a=t.parseAttributes(e,t.Line.ATTRIBUTE_NAMES),o=[a.x1||0,a.y1||0,a.x2||0,a.y2||0];r(new t.Line(o,n(a,i)))},t.Line.fromObject=function(e,n){function i(e){delete e.points,n&&n(e)}var a=r(e,!0);a.points=[e.x1,e.y1,e.x2,e.y2],t.Object._fromObject(`Line`,a,i,`points`)};function a(e,t){var n=e.origin,r=e.axis1,i=e.axis2,a=e.dimension,o=t.nearest,s=t.center,c=t.farthest;return function(){switch(this.get(n)){case o:return Math.min(this.get(r),this.get(i));case s:return Math.min(this.get(r),this.get(i))+.5*this.get(a);case c:return Math.max(this.get(r),this.get(i))}}}}(e),function(e){var t=e.fabric||={},n=t.util.degreesToRadians;if(t.Circle){t.warn(`fabric.Circle is already defined.`);return}t.Circle=t.util.createClass(t.Object,{type:`circle`,radius:0,startAngle:0,endAngle:360,cacheProperties:t.Object.prototype.cacheProperties.concat(`radius`,`startAngle`,`endAngle`),_set:function(e,t){return this.callSuper(`_set`,e,t),e===`radius`&&this.setRadius(t),this},toObject:function(e){return this.callSuper(`toObject`,[`radius`,`startAngle`,`endAngle`].concat(e))},_toSVG:function(){var e,r=0,i=0,a=(this.endAngle-this.startAngle)%360;if(a===0)e=[`<circle `,`COMMON_PARTS`,`cx="`+r+`" cy="`+i+`" `,`r="`,this.radius,`" />
|
|
75
|
+
`];else{var o=n(this.startAngle),s=n(this.endAngle),c=this.radius,l=t.util.cos(o)*c,u=t.util.sin(o)*c,d=t.util.cos(s)*c,f=t.util.sin(s)*c,p=a>180?`1`:`0`;e=[`<path d="M `+l+` `+u,` A `+c+` `+c,` 0 `,+p+` 1`,` `+d+` `+f,`" `,`COMMON_PARTS`,` />
|
|
76
|
+
`]}return e},_render:function(e){e.beginPath(),e.arc(0,0,this.radius,n(this.startAngle),n(this.endAngle),!1),this._renderPaintInOrder(e)},getRadiusX:function(){return this.get(`radius`)*this.get(`scaleX`)},getRadiusY:function(){return this.get(`radius`)*this.get(`scaleY`)},setRadius:function(e){return this.radius=e,this.set(`width`,e*2).set(`height`,e*2)}}),t.Circle.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`cx cy r`.split(` `)),t.Circle.fromElement=function(e,n){var i=t.parseAttributes(e,t.Circle.ATTRIBUTE_NAMES);if(!r(i))throw Error("value of `r` attribute is required and can not be negative");i.left=(i.left||0)-i.radius,i.top=(i.top||0)-i.radius,n(new t.Circle(i))};function r(e){return`radius`in e&&e.radius>=0}t.Circle.fromObject=function(e,n){t.Object._fromObject(`Circle`,e,n)}}(e),function(e){var t=e.fabric||={};if(t.Triangle){t.warn(`fabric.Triangle is already defined`);return}t.Triangle=t.util.createClass(t.Object,{type:`triangle`,width:100,height:100,_render:function(e){var t=this.width/2,n=this.height/2;e.beginPath(),e.moveTo(-t,n),e.lineTo(0,-n),e.lineTo(t,n),e.closePath(),this._renderPaintInOrder(e)},_toSVG:function(){var e=this.width/2,t=this.height/2;return[`<polygon `,`COMMON_PARTS`,`points="`,[-e+` `+t,`0 `+-t,e+` `+t].join(`,`),`" />`]}}),t.Triangle.fromObject=function(e,n){return t.Object._fromObject(`Triangle`,e,n)}}(e),function(e){var t=e.fabric||={},n=Math.PI*2;if(t.Ellipse){t.warn(`fabric.Ellipse is already defined.`);return}t.Ellipse=t.util.createClass(t.Object,{type:`ellipse`,rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat(`rx`,`ry`),initialize:function(e){this.callSuper(`initialize`,e),this.set(`rx`,e&&e.rx||0),this.set(`ry`,e&&e.ry||0)},_set:function(e,t){switch(this.callSuper(`_set`,e,t),e){case`rx`:this.rx=t,this.set(`width`,t*2);break;case`ry`:this.ry=t,this.set(`height`,t*2);break}return this},getRx:function(){return this.get(`rx`)*this.get(`scaleX`)},getRy:function(){return this.get(`ry`)*this.get(`scaleY`)},toObject:function(e){return this.callSuper(`toObject`,[`rx`,`ry`].concat(e))},_toSVG:function(){return[`<ellipse `,`COMMON_PARTS`,`cx="0" cy="0" `,`rx="`,this.rx,`" ry="`,this.ry,`" />
|
|
77
|
+
`]},_render:function(e){e.beginPath(),e.save(),e.transform(1,0,0,this.ry/this.rx,0,0),e.arc(0,0,this.rx,0,n,!1),e.restore(),this._renderPaintInOrder(e)}}),t.Ellipse.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`cx cy rx ry`.split(` `)),t.Ellipse.fromElement=function(e,n){var r=t.parseAttributes(e,t.Ellipse.ATTRIBUTE_NAMES);r.left=(r.left||0)-r.rx,r.top=(r.top||0)-r.ry,n(new t.Ellipse(r))},t.Ellipse.fromObject=function(e,n){t.Object._fromObject(`Ellipse`,e,n)}}(e),function(e){var t=e.fabric||={},n=t.util.object.extend;if(t.Rect){t.warn(`fabric.Rect is already defined`);return}t.Rect=t.util.createClass(t.Object,{stateProperties:t.Object.prototype.stateProperties.concat(`rx`,`ry`),type:`rect`,rx:0,ry:0,cacheProperties:t.Object.prototype.cacheProperties.concat(`rx`,`ry`),initialize:function(e){this.callSuper(`initialize`,e),this._initRxRy()},_initRxRy:function(){this.rx&&!this.ry?this.ry=this.rx:this.ry&&!this.rx&&(this.rx=this.ry)},_render:function(e){var t=this.rx?Math.min(this.rx,this.width/2):0,n=this.ry?Math.min(this.ry,this.height/2):0,r=this.width,i=this.height,a=-this.width/2,o=-this.height/2,s=t!==0||n!==0,c=.4477152502;e.beginPath(),e.moveTo(a+t,o),e.lineTo(a+r-t,o),s&&e.bezierCurveTo(a+r-c*t,o,a+r,o+c*n,a+r,o+n),e.lineTo(a+r,o+i-n),s&&e.bezierCurveTo(a+r,o+i-c*n,a+r-c*t,o+i,a+r-t,o+i),e.lineTo(a+t,o+i),s&&e.bezierCurveTo(a+c*t,o+i,a,o+i-c*n,a,o+i-n),e.lineTo(a,o+n),s&&e.bezierCurveTo(a,o+c*n,a+c*t,o,a+t,o),e.closePath(),this._renderPaintInOrder(e)},toObject:function(e){return this.callSuper(`toObject`,[`rx`,`ry`].concat(e))},_toSVG:function(){return[`<rect `,`COMMON_PARTS`,`x="`,-this.width/2,`" y="`,-this.height/2,`" rx="`,this.rx,`" ry="`,this.ry,`" width="`,this.width,`" height="`,this.height,`" />
|
|
78
|
+
`]}}),t.Rect.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`x y rx ry width height`.split(` `)),t.Rect.fromElement=function(e,r,i){if(!e)return r(null);i||={};var a=t.parseAttributes(e,t.Rect.ATTRIBUTE_NAMES);a.left=a.left||0,a.top=a.top||0,a.height=a.height||0,a.width=a.width||0;var o=new t.Rect(n(i?t.util.object.clone(i):{},a));o.visible=o.visible&&o.width>0&&o.height>0,r(o)},t.Rect.fromObject=function(e,n){return t.Object._fromObject(`Rect`,e,n)}}(e),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.util.array.min,i=t.util.array.max,a=t.util.toFixed,o=t.util.projectStrokeOnPoints;if(t.Polyline){t.warn(`fabric.Polyline is already defined`);return}t.Polyline=t.util.createClass(t.Object,{type:`polyline`,points:null,exactBoundingBox:!1,cacheProperties:t.Object.prototype.cacheProperties.concat(`points`),initialize:function(e,t){t||={},this.points=e||[],this.callSuper(`initialize`,t),this._setPositionDimensions(t)},_projectStrokeOnPoints:function(){return o(this.points,this,!0)},_setPositionDimensions:function(e){var t=this._calcDimensions(e),n,r=this.exactBoundingBox?this.strokeWidth:0;this.width=t.width-r,this.height=t.height-r,e.fromSVG||(n=this.translateToGivenOrigin({x:t.left-this.strokeWidth/2+r/2,y:t.top-this.strokeWidth/2+r/2},`left`,`top`,this.originX,this.originY)),typeof e.left>`u`&&(this.left=e.fromSVG?t.left:n.x),typeof e.top>`u`&&(this.top=e.fromSVG?t.top:n.y),this.pathOffset={x:t.left+this.width/2+r/2,y:t.top+this.height/2+r/2}},_calcDimensions:function(){var e=this.exactBoundingBox?this._projectStrokeOnPoints():this.points,t=r(e,`x`)||0,n=r(e,`y`)||0,a=i(e,`x`)||0,o=i(e,`y`)||0;return{left:t,top:n,width:a-t,height:o-n}},toObject:function(e){return n(this.callSuper(`toObject`,e),{points:this.points.concat()})},_toSVG:function(){for(var e=[],n=this.pathOffset.x,r=this.pathOffset.y,i=t.Object.NUM_FRACTION_DIGITS,o=0,s=this.points.length;o<s;o++)e.push(a(this.points[o].x-n,i),`,`,a(this.points[o].y-r,i),` `);return[`<`+this.type+` `,`COMMON_PARTS`,`points="`,e.join(``),`" />
|
|
79
|
+
`]},commonRender:function(e){var t,n=this.points.length,r=this.pathOffset.x,i=this.pathOffset.y;if(!n||isNaN(this.points[n-1].y))return!1;e.beginPath(),e.moveTo(this.points[0].x-r,this.points[0].y-i);for(var a=0;a<n;a++)t=this.points[a],e.lineTo(t.x-r,t.y-i);return!0},_render:function(e){this.commonRender(e)&&this._renderPaintInOrder(e)},complexity:function(){return this.get(`points`).length}}),t.Polyline.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polyline.fromElementGenerator=function(e){return function(r,i,a){if(!r)return i(null);a||={};var o=t.parsePointsAttribute(r.getAttribute(`points`)),s=t.parseAttributes(r,t[e].ATTRIBUTE_NAMES);s.fromSVG=!0,i(new t[e](o,n(s,a)))}},t.Polyline.fromElement=t.Polyline.fromElementGenerator(`Polyline`),t.Polyline.fromObject=function(e,n){return t.Object._fromObject(`Polyline`,e,n,`points`)}}(e),function(e){var t=e.fabric||={},n=t.util.projectStrokeOnPoints;if(t.Polygon){t.warn(`fabric.Polygon is already defined`);return}t.Polygon=t.util.createClass(t.Polyline,{type:`polygon`,_projectStrokeOnPoints:function(){return n(this.points,this)},_render:function(e){this.commonRender(e)&&(e.closePath(),this._renderPaintInOrder(e))}}),t.Polygon.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(),t.Polygon.fromElement=t.Polyline.fromElementGenerator(`Polygon`),t.Polygon.fromObject=function(e,n){t.Object._fromObject(`Polygon`,e,n,`points`)}}(e),function(e){var t=e.fabric||={},n=t.util.array.min,r=t.util.array.max,i=t.util.object.extend,a=t.util.object.clone,o=t.util.toFixed;if(t.Path){t.warn(`fabric.Path is already defined`);return}t.Path=t.util.createClass(t.Object,{type:`path`,path:null,cacheProperties:t.Object.prototype.cacheProperties.concat(`path`,`fillRule`),stateProperties:t.Object.prototype.stateProperties.concat(`path`),initialize:function(e,t){t=a(t||{}),delete t.path,this.callSuper(`initialize`,t),this._setPath(e||[],t)},_setPath:function(e,n){this.path=t.util.makePathSimpler(Array.isArray(e)?e:t.util.parsePath(e)),t.Polyline.prototype._setPositionDimensions.call(this,n||{})},_renderPathCommands:function(e){var t,n=0,r=0,i=0,a=0,o=0,s=0,c=-this.pathOffset.x,l=-this.pathOffset.y;e.beginPath();for(var u=0,d=this.path.length;u<d;++u)switch(t=this.path[u],t[0]){case`L`:i=t[1],a=t[2],e.lineTo(i+c,a+l);break;case`M`:i=t[1],a=t[2],n=i,r=a,e.moveTo(i+c,a+l);break;case`C`:i=t[5],a=t[6],o=t[3],s=t[4],e.bezierCurveTo(t[1]+c,t[2]+l,o+c,s+l,i+c,a+l);break;case`Q`:e.quadraticCurveTo(t[1]+c,t[2]+l,t[3]+c,t[4]+l),i=t[3],a=t[4],o=t[1],s=t[2];break;case`z`:case`Z`:i=n,a=r,e.closePath();break}},_render:function(e){this._renderPathCommands(e),this._renderPaintInOrder(e)},toString:function(){return`#<fabric.Path (`+this.complexity()+`): { "top": `+this.top+`, "left": `+this.left+` }>`},toObject:function(e){return i(this.callSuper(`toObject`,e),{path:this.path.map(function(e){return e.slice()})})},toDatalessObject:function(e){var t=this.toObject([`sourcePath`].concat(e));return t.sourcePath&&delete t.path,t},_toSVG:function(){return[`<path `,`COMMON_PARTS`,`d="`,t.util.joinPath(this.path),`" stroke-linecap="round" `,`/>
|
|
80
|
+
`]},_getOffsetTransform:function(){var e=t.Object.NUM_FRACTION_DIGITS;return` translate(`+o(-this.pathOffset.x,e)+`, `+o(-this.pathOffset.y,e)+`)`},toClipPathSVG:function(e){var t=this._getOffsetTransform();return` `+this._createBaseClipPathSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},toSVG:function(e){var t=this._getOffsetTransform();return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,additionalTransform:t})},complexity:function(){return this.path.length},_calcDimensions:function(){for(var e=[],i=[],a,o=0,s=0,c=0,l=0,u,d=0,f=this.path.length;d<f;++d){switch(a=this.path[d],a[0]){case`L`:c=a[1],l=a[2],u=[];break;case`M`:c=a[1],l=a[2],o=c,s=l,u=[];break;case`C`:u=t.util.getBoundsOfCurve(c,l,a[1],a[2],a[3],a[4],a[5],a[6]),c=a[5],l=a[6];break;case`Q`:u=t.util.getBoundsOfCurve(c,l,a[1],a[2],a[1],a[2],a[3],a[4]),c=a[3],l=a[4];break;case`z`:case`Z`:c=o,l=s;break}u.forEach(function(t){e.push(t.x),i.push(t.y)}),e.push(c),i.push(l)}var p=n(e)||0,m=n(i)||0,h=r(e)||0,g=r(i)||0;return{left:p,top:m,width:h-p,height:g-m}}}),t.Path.fromObject=function(e,n){if(typeof e.sourcePath==`string`){var r=e.sourcePath;t.loadSVGFromURL(r,function(r){var i=r[0];i.setOptions(e),e.clipPath?t.util.enlivenObjects([e.clipPath],function(e){i.clipPath=e[0],n&&n(i)}):n&&n(i)})}else t.Object._fromObject(`Path`,e,n,`path`)},t.Path.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat([`d`]),t.Path.fromElement=function(e,n,r){var a=t.parseAttributes(e,t.Path.ATTRIBUTE_NAMES);a.fromSVG=!0,n(new t.Path(a.d,i(a,r)))}}(e),function(e){var t=e.fabric||={},n=t.util.array.min,r=t.util.array.max;t.Group||(t.Group=t.util.createClass(t.Object,t.Collection,{type:`group`,strokeWidth:0,subTargetCheck:!1,cacheProperties:[],useSetOnGroup:!1,initialize:function(e,t,n){t||={},this._objects=[],n&&this.callSuper(`initialize`,t),this._objects=e||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;if(n)this._updateObjectsACoords();else{var i=t&&t.centerPoint;t.originX!==void 0&&(this.originX=t.originX),t.originY!==void 0&&(this.originY=t.originY),i||this._calcBounds(),this._updateObjectsCoords(i),delete t.centerPoint,this.callSuper(`initialize`,t)}this.setCoords()},_updateObjectsACoords:function(){for(var e=!0,t=this._objects.length;t--;)this._objects[t].setCoords(e)},_updateObjectsCoords:function(e){for(var e=e||this.getCenterPoint(),t=this._objects.length;t--;)this._updateObjectCoords(this._objects[t],e)},_updateObjectCoords:function(e,t){var n=e.left,r=e.top;e.set({left:n-t.x,top:r-t.y}),e.group=this,e.setCoords(!0)},toString:function(){return`#<fabric.Group: (`+this.complexity()+`)>`},addWithUpdate:function(e){var n=!!this.group;return this._restoreObjectsState(),t.util.resetObjectTransform(this),e&&(n&&t.util.removeTransformFromObject(e,this.group.calcTransformMatrix()),this._objects.push(e),e.group=this,e._set(`canvas`,this.canvas)),this._calcBounds(),this._updateObjectsCoords(),this.dirty=!0,n?this.group.addWithUpdate():this.setCoords(),this},removeWithUpdate:function(e){return this._restoreObjectsState(),t.util.resetObjectTransform(this),this.remove(e),this._calcBounds(),this._updateObjectsCoords(),this.setCoords(),this.dirty=!0,this},_onObjectAdded:function(e){this.dirty=!0,e.group=this,e._set(`canvas`,this.canvas)},_onObjectRemoved:function(e){this.dirty=!0,delete e.group},_set:function(e,n){var r=this._objects.length;if(this.useSetOnGroup)for(;r--;)this._objects[r].setOnGroup(e,n);if(e===`canvas`)for(;r--;)this._objects[r]._set(e,n);t.Object.prototype._set.call(this,e,n)},toObject:function(e){var n=this.includeDefaultValues,r=this._objects.filter(function(e){return!e.excludeFromExport}).map(function(t){var r=t.includeDefaultValues;t.includeDefaultValues=n;var i=t.toObject(e);return t.includeDefaultValues=r,i}),i=t.Object.prototype.toObject.call(this,e);return i.objects=r,i},toDatalessObject:function(e){var n,r=this.sourcePath;if(r)n=r;else{var i=this.includeDefaultValues;n=this._objects.map(function(t){var n=t.includeDefaultValues;t.includeDefaultValues=i;var r=t.toDatalessObject(e);return t.includeDefaultValues=n,r})}var a=t.Object.prototype.toDatalessObject.call(this,e);return a.objects=n,a},render:function(e){this._transformDone=!0,this.callSuper(`render`,e),this._transformDone=!1},shouldCache:function(){var e=t.Object.prototype.shouldCache.call(this);if(e){for(var n=0,r=this._objects.length;n<r;n++)if(this._objects[n].willDrawShadow())return this.ownCaching=!1,!1}return e},willDrawShadow:function(){if(t.Object.prototype.willDrawShadow.call(this))return!0;for(var e=0,n=this._objects.length;e<n;e++)if(this._objects[e].willDrawShadow())return!0;return!1},isOnACache:function(){return this.ownCaching||this.group&&this.group.isOnACache()},drawObject:function(e){for(var t=0,n=this._objects.length;t<n;t++)this._objects[t].render(e);this._drawClipPath(e,this.clipPath)},isCacheDirty:function(e){if(this.callSuper(`isCacheDirty`,e))return!0;if(!this.statefullCache)return!1;for(var t=0,n=this._objects.length;t<n;t++)if(this._objects[t].isCacheDirty(!0)){if(this._cacheCanvas){var r=this.cacheWidth/this.zoomX,i=this.cacheHeight/this.zoomY;this._cacheContext.clearRect(-r/2,-i/2,r,i)}return!0}return!1},_restoreObjectsState:function(){var e=this.calcOwnMatrix();return this._objects.forEach(function(n){t.util.addTransformToObject(n,e),delete n.group,n.setCoords()}),this},destroy:function(){return this._objects.forEach(function(e){e.set(`dirty`,!0)}),this._restoreObjectsState()},dispose:function(){this.callSuper(`dispose`),this.forEachObject(function(e){e.dispose&&e.dispose()}),this._objects=[]},toActiveSelection:function(){if(this.canvas){var e=this._objects,n=this.canvas;this._objects=[];var r=this.toObject();delete r.objects;var i=new t.ActiveSelection([]);return i.set(r),i.type=`activeSelection`,n.remove(this),e.forEach(function(e){e.group=i,e.dirty=!0,n.add(e)}),i.canvas=n,i._objects=e,n._activeObject=i,i.setCoords(),i}},ungroupOnCanvas:function(){return this._restoreObjectsState()},setObjectsCoords:function(){var e=!0;return this.forEachObject(function(t){t.setCoords(e)}),this},_calcBounds:function(e){for(var t=[],n=[],r,i,a,o=[`tr`,`br`,`bl`,`tl`],s=0,c=this._objects.length,l,u=o.length;s<c;++s){for(r=this._objects[s],a=r.calcACoords(),l=0;l<u;l++)i=o[l],t.push(a[i].x),n.push(a[i].y);r.aCoords=a}this._getBounds(t,n,e)},_getBounds:function(e,i,a){var o=new t.Point(n(e),n(i)),s=new t.Point(r(e),r(i)),c=o.y||0,l=o.x||0,u=s.x-o.x||0,d=s.y-o.y||0;this.width=u,this.height=d,a||this.setPositionByOrigin({x:l,y:c},`left`,`top`)},_toSVG:function(e){for(var t=[`<g `,`COMMON_PARTS`,` >
|
|
81
|
+
`],n=0,r=this._objects.length;n<r;n++)t.push(` `,this._objects[n].toSVG(e));return t.push(`</g>
|
|
82
|
+
`),t},getSvgStyles:function(){var e=typeof this.opacity<`u`&&this.opacity!==1?`opacity: `+this.opacity+`;`:``,t=this.visible?``:` visibility: hidden;`;return[e,this.getSvgFilter(),t].join(``)},toClipPathSVG:function(e){for(var t=[],n=0,r=this._objects.length;n<r;n++)t.push(` `,this._objects[n].toClipPathSVG(e));return this._createBaseClipPathSVGMarkup(t,{reviver:e})}}),t.Group.fromObject=function(e,n){var r=e.objects,i=t.util.object.clone(e,!0);if(delete i.objects,typeof r==`string`){t.loadSVGFromURL(r,function(a){var o=t.util.groupSVGElements(a,e,r),s=i.clipPath;delete i.clipPath,o.set(i),s?t.util.enlivenObjects([s],function(e){o.clipPath=e[0],n&&n(o)}):n&&n(o)});return}t.util.enlivenObjects(r,function(r){t.util.enlivenObjectEnlivables(e,i,function(){n&&n(new t.Group(r,i,!0))})})})}(e),function(e){var t=e.fabric||={};t.ActiveSelection||(t.ActiveSelection=t.util.createClass(t.Group,{type:`activeSelection`,initialize:function(e,n){n||={},this._objects=e||[];for(var r=this._objects.length;r--;)this._objects[r].group=this;n.originX&&(this.originX=n.originX),n.originY&&(this.originY=n.originY),this._calcBounds(),this._updateObjectsCoords(),t.Object.prototype.initialize.call(this,n),this.setCoords()},toGroup:function(){var e=this._objects.concat();this._objects=[];var n=t.Object.prototype.toObject.call(this),r=new t.Group([]);if(delete n.type,r.set(n),e.forEach(function(e){e.canvas.remove(e),e.group=r}),r._objects=e,!this.canvas)return r;var i=this.canvas;return i.add(r),i._activeObject=r,r.setCoords(),r},onDeselect:function(){return this.destroy(),!1},toString:function(){return`#<fabric.ActiveSelection: (`+this.complexity()+`)>`},shouldCache:function(){return!1},isOnACache:function(){return!1},_renderControls:function(e,t,n){e.save(),e.globalAlpha=this.isMoving?this.borderOpacityWhenMoving:1,this.callSuper(`_renderControls`,e,t),n||={},typeof n.hasControls>`u`&&(n.hasControls=!1),n.forActiveSelection=!0;for(var r=0,i=this._objects.length;r<i;r++)this._objects[r]._renderControls(e,n);e.restore()}}),t.ActiveSelection.fromObject=function(e,n){t.util.enlivenObjects(e.objects,function(r){delete e.objects,n&&n(new t.ActiveSelection(r,e,!0))})})}(e),function(e){var n=t.util.object.extend;if(e.fabric||={},e.fabric.Image){t.warn(`fabric.Image is already defined.`);return}t.Image=t.util.createClass(t.Object,{type:`image`,strokeWidth:0,srcFromAttribute:!1,_lastScaleX:1,_lastScaleY:1,_filterScalingX:1,_filterScalingY:1,minimumScaleTrigger:.5,stateProperties:t.Object.prototype.stateProperties.concat(`cropX`,`cropY`),cacheProperties:t.Object.prototype.cacheProperties.concat(`cropX`,`cropY`),cacheKey:``,cropX:0,cropY:0,imageSmoothing:!0,initialize:function(e,n){n||={},this.filters=[],this.cacheKey=`texture`+ t.Object.__uid++,this.callSuper(`initialize`,n),this._initElement(e,n)},getElement:function(){return this._element||{}},setElement:function(e,t){return this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+`_filtered`),this._element=e,this._originalElement=e,this._initConfig(t),this.filters.length!==0&&this.applyFilters(),this.resizeFilter&&this.applyResizeFilters(),this},removeTexture:function(e){var n=t.filterBackend;n&&n.evictCachesForKey&&n.evictCachesForKey(e)},dispose:function(){this.callSuper(`dispose`),this.removeTexture(this.cacheKey),this.removeTexture(this.cacheKey+`_filtered`),this._cacheContext=void 0,[`_originalElement`,`_element`,`_filteredEl`,`_cacheCanvas`].forEach((function(e){t.util.cleanUpJsdomNode(this[e]),this[e]=void 0}).bind(this))},getCrossOrigin:function(){return this._originalElement&&(this._originalElement.crossOrigin||null)},getOriginalSize:function(){var e=this.getElement();return{width:e.naturalWidth||e.width,height:e.naturalHeight||e.height}},_stroke:function(e){if(!(!this.stroke||this.strokeWidth===0)){var t=this.width/2,n=this.height/2;e.beginPath(),e.moveTo(-t,-n),e.lineTo(t,-n),e.lineTo(t,n),e.lineTo(-t,n),e.lineTo(-t,-n),e.closePath()}},toObject:function(e){var t=[];this.filters.forEach(function(e){e&&t.push(e.toObject())});var r=n(this.callSuper(`toObject`,[`cropX`,`cropY`].concat(e)),{src:this.getSrc(),crossOrigin:this.getCrossOrigin(),filters:t});return this.resizeFilter&&(r.resizeFilter=this.resizeFilter.toObject()),r},hasCrop:function(){return this.cropX||this.cropY||this.width<this._element.width||this.height<this._element.height},_toSVG:function(){var e=[],n=[],r,i=this._element,a=-this.width/2,o=-this.height/2,s=``,c=``;if(!i)return[];if(this.hasCrop()){var l=t.Object.__uid++;e.push(`<clipPath id="imageCrop_`+l+`">
|
|
83
|
+
`,` <rect x="`+a+`" y="`+o+`" width="`+this.width+`" height="`+this.height+`" />
|
|
84
|
+
`,`</clipPath>
|
|
85
|
+
`),s=` clip-path="url(#imageCrop_`+l+`)" `}if(this.imageSmoothing||(c=`" image-rendering="optimizeSpeed`),n.push(` <image `,`COMMON_PARTS`,`xlink:href="`,this.getSvgSrc(!0),`" x="`,a-this.cropX,`" y="`,o-this.cropY,`" width="`,i.width||i.naturalWidth,`" height="`,i.height||i.height,c,`"`,s,`></image>
|
|
86
|
+
`),this.stroke||this.strokeDashArray){var u=this.fill;this.fill=null,r=[` <rect `,`x="`,a,`" y="`,o,`" width="`,this.width,`" height="`,this.height,`" style="`,this.getSvgStyles(),`"/>
|
|
87
|
+
`],this.fill=u}return e=this.paintFirst===`fill`?e.concat(n,r):e.concat(r,n),e},getSrc:function(e){var t=e?this._element:this._originalElement;return t?t.toDataURL?t.toDataURL():this.srcFromAttribute?t.getAttribute(`src`):t.src:this.src||``},setSrc:function(e,n,r){return t.util.loadImage(e,function(e,t){this.setElement(e,r),this._setWidthHeight(),n&&n(this,t)},this,r&&r.crossOrigin),this},toString:function(){return`#<fabric.Image: { src: "`+this.getSrc()+`" }>`},applyResizeFilters:function(){var e=this.resizeFilter,n=this.minimumScaleTrigger,r=this.getTotalObjectScaling(),i=r.scaleX,a=r.scaleY,o=this._filteredEl||this._originalElement;if(this.group&&this.set(`dirty`,!0),!e||i>n&&a>n){this._element=o,this._filterScalingX=1,this._filterScalingY=1,this._lastScaleX=i,this._lastScaleY=a;return}t.filterBackend||=t.initFilterBackend();var s=t.util.createCanvasElement(),c=this._filteredEl?this.cacheKey+`_filtered`:this.cacheKey,l=o.width,u=o.height;s.width=l,s.height=u,this._element=s,this._lastScaleX=e.scaleX=i,this._lastScaleY=e.scaleY=a,t.filterBackend.applyFilters([e],o,l,u,this._element,c),this._filterScalingX=s.width/this._originalElement.width,this._filterScalingY=s.height/this._originalElement.height},applyFilters:function(e){if(e=e||this.filters||[],e=e.filter(function(e){return e&&!e.isNeutralState()}),this.set(`dirty`,!0),this.removeTexture(this.cacheKey+`_filtered`),e.length===0)return this._element=this._originalElement,this._filteredEl=null,this._filterScalingX=1,this._filterScalingY=1,this;var n=this._originalElement,r=n.naturalWidth||n.width,i=n.naturalHeight||n.height;if(this._element===this._originalElement){var a=t.util.createCanvasElement();a.width=r,a.height=i,this._element=a,this._filteredEl=a}else this._element=this._filteredEl,this._filteredEl.getContext(`2d`).clearRect(0,0,r,i),this._lastScaleX=1,this._lastScaleY=1;return t.filterBackend||=t.initFilterBackend(),t.filterBackend.applyFilters(e,this._originalElement,r,i,this._element,this.cacheKey),(this._originalElement.width!==this._element.width||this._originalElement.height!==this._element.height)&&(this._filterScalingX=this._element.width/this._originalElement.width,this._filterScalingY=this._element.height/this._originalElement.height),this},_render:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),this.isMoving!==!0&&this.resizeFilter&&this._needsResize()&&this.applyResizeFilters(),this._stroke(e),this._renderPaintInOrder(e)},drawCacheOnCanvas:function(e){t.util.setImageSmoothing(e,this.imageSmoothing),t.Object.prototype.drawCacheOnCanvas.call(this,e)},shouldCache:function(){return this.needsItsOwnCache()},_renderFill:function(e){var t=this._element;if(t){var n=this._filterScalingX,r=this._filterScalingY,i=this.width,a=this.height,o=Math.min,s=Math.max,c=s(this.cropX,0),l=s(this.cropY,0),u=t.naturalWidth||t.width,d=t.naturalHeight||t.height,f=c*n,p=l*r,m=o(i*n,u-f),h=o(a*r,d-p),g=-i/2,_=-a/2,v=o(i,u/n-c),y=o(a,d/r-l);t&&e.drawImage(t,f,p,m,h,g,_,v,y)}},_needsResize:function(){var e=this.getTotalObjectScaling();return e.scaleX!==this._lastScaleX||e.scaleY!==this._lastScaleY},_resetWidthHeight:function(){this.set(this.getOriginalSize())},_initElement:function(e,n){this.setElement(t.util.getById(e),n),t.util.addClass(this.getElement(),t.Image.CSS_CANVAS)},_initConfig:function(e){e||={},this.setOptions(e),this._setWidthHeight(e)},_initFilters:function(e,n){e&&e.length?t.util.enlivenObjects(e,function(e){n&&n(e)},`fabric.Image.filters`):n&&n()},_setWidthHeight:function(e){e||={};var t=this.getElement();this.width=e.width||t.naturalWidth||t.width||0,this.height=e.height||t.naturalHeight||t.height||0},parsePreserveAspectRatioAttribute:function(){var e=t.util.parsePreserveAspectRatioAttribute(this.preserveAspectRatio||``),n=this._element.width,r=this._element.height,i=1,a=1,o=0,s=0,c=0,l=0,u,d=this.width,f=this.height,p={width:d,height:f};return e&&(e.alignX!==`none`||e.alignY!==`none`)?(e.meetOrSlice===`meet`&&(i=a=t.util.findScaleToFit(this._element,p),u=(d-n*i)/2,e.alignX===`Min`&&(o=-u),e.alignX===`Max`&&(o=u),u=(f-r*a)/2,e.alignY===`Min`&&(s=-u),e.alignY===`Max`&&(s=u)),e.meetOrSlice===`slice`&&(i=a=t.util.findScaleToCover(this._element,p),u=n-d/i,e.alignX===`Mid`&&(c=u/2),e.alignX===`Max`&&(c=u),u=r-f/a,e.alignY===`Mid`&&(l=u/2),e.alignY===`Max`&&(l=u),n=d/i,r=f/a)):(i=d/n,a=f/r),{width:n,height:r,scaleX:i,scaleY:a,offsetLeft:o,offsetTop:s,cropX:c,cropY:l}}}),t.Image.CSS_CANVAS=`canvas-img`,t.Image.prototype.getSvgSrc=t.Image.prototype.getSrc,t.Image.fromObject=function(e,n){var r=t.util.object.clone(e);t.util.loadImage(r.src,function(e,i){if(i){n&&n(null,!0);return}t.Image.prototype._initFilters.call(r,r.filters,function(i){r.filters=i||[],t.Image.prototype._initFilters.call(r,[r.resizeFilter],function(i){r.resizeFilter=i[0],t.util.enlivenObjectEnlivables(r,r,function(){n(new t.Image(e,r),!1)})})})},null,r.crossOrigin)},t.Image.fromURL=function(e,n,r){t.util.loadImage(e,function(e,i){n&&n(new t.Image(e,r),i)},null,r&&r.crossOrigin)},t.Image.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`x y width height preserveAspectRatio xlink:href crossOrigin image-rendering`.split(` `)),t.Image.fromElement=function(e,r,i){var a=t.parseAttributes(e,t.Image.ATTRIBUTE_NAMES);t.Image.fromURL(a[`xlink:href`],r,n(i?t.util.object.clone(i):{},a))}}(e),t.util.object.extend(t.Object.prototype,{_getAngleValueForStraighten:function(){var e=this.angle%360;return e>0?Math.round((e-1)/90)*90:Math.round(e/90)*90},straighten:function(){return this.rotate(this._getAngleValueForStraighten())},fxStraighten:function(e){e||={};var n=function(){},r=e.onComplete||n,i=e.onChange||n,a=this;return t.util.animate({target:this,startValue:this.get(`angle`),endValue:this._getAngleValueForStraighten(),duration:this.FX_DURATION,onChange:function(e){a.rotate(e),i()},onComplete:function(){a.setCoords(),r()}})}}),t.util.object.extend(t.StaticCanvas.prototype,{straightenObject:function(e){return e.straighten(),this.requestRenderAll(),this},fxStraightenObject:function(e){return e.fxStraighten({onChange:this.requestRenderAllBound})}}),function(){function e(e,t){var n=`precision `+t+` float;
|
|
88
|
+
void main(){}`,r=e.createShader(e.FRAGMENT_SHADER);return e.shaderSource(r,n),e.compileShader(r),!!e.getShaderParameter(r,e.COMPILE_STATUS)}t.isWebglSupported=function(n){if(t.isLikelyNode)return!1;n||=t.WebglFilterBackend.prototype.tileSize;var r=document.createElement(`canvas`),i=r.getContext(`webgl`)||r.getContext(`experimental-webgl`),a=!1;if(i){t.maxTextureSize=i.getParameter(i.MAX_TEXTURE_SIZE),a=t.maxTextureSize>=n;for(var o=[`highp`,`mediump`,`lowp`],s=0;s<3;s++)if(e(i,o[s])){t.webGlPrecision=o[s];break}}return this.isSupported=a,a},t.WebglFilterBackend=n;function n(e){e&&e.tileSize&&(this.tileSize=e.tileSize),this.setupGLContext(this.tileSize,this.tileSize),this.captureGPUInfo()}n.prototype={tileSize:2048,resources:{},setupGLContext:function(e,t){this.dispose(),this.createWebGLCanvas(e,t),this.aPosition=new Float32Array([0,0,0,1,1,0,1,1]),this.chooseFastestCopyGLTo2DMethod(e,t)},chooseFastestCopyGLTo2DMethod:function(e,n){var r=typeof window.performance<`u`,i;try{new ImageData(1,1),i=!0}catch{i=!1}if(r&&i&&typeof ArrayBuffer<`u`&&typeof Uint8ClampedArray<`u`){var s=t.util.createCanvasElement(),c=new ArrayBuffer(e*n*4);if(t.forceGLPutImageData){this.imageBuffer=c,this.copyGLTo2D=o;return}var l={imageBuffer:c,destinationWidth:e,destinationHeight:n,targetCanvas:s},u,d,f;s.width=e,s.height=n,u=window.performance.now(),a.call(l,this.gl,l),d=window.performance.now()-u,u=window.performance.now(),o.call(l,this.gl,l),f=window.performance.now()-u,d>f?(this.imageBuffer=c,this.copyGLTo2D=o):this.copyGLTo2D=a}},createWebGLCanvas:function(e,n){var r=t.util.createCanvasElement();r.width=e,r.height=n;var i={alpha:!0,premultipliedAlpha:!1,depth:!1,stencil:!1,antialias:!1},a=r.getContext(`webgl`,i);a||=r.getContext(`experimental-webgl`,i),a&&(a.clearColor(0,0,0,0),this.canvas=r,this.gl=a)},applyFilters:function(e,t,n,r,a,o){var s=this.gl,c;o&&(c=this.getCachedTexture(o,t));var l={originalWidth:t.width||t.originalWidth,originalHeight:t.height||t.originalHeight,sourceWidth:n,sourceHeight:r,destinationWidth:n,destinationHeight:r,context:s,sourceTexture:this.createTexture(s,n,r,!c&&t),targetTexture:this.createTexture(s,n,r),originalTexture:c||this.createTexture(s,n,r,!c&&t),passes:e.length,webgl:!0,aPosition:this.aPosition,programCache:this.programCache,pass:0,filterBackend:this,targetCanvas:a},u=s.createFramebuffer();return s.bindFramebuffer(s.FRAMEBUFFER,u),e.forEach(function(e){e&&e.applyTo(l)}),i(l),this.copyGLTo2D(s,l),s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(l.sourceTexture),s.deleteTexture(l.targetTexture),s.deleteFramebuffer(u),a.getContext(`2d`).setTransform(1,0,0,1,0,0),l},dispose:function(){this.canvas&&(this.canvas=null,this.gl=null),this.clearWebGLCaches()},clearWebGLCaches:function(){this.programCache={},this.textureCache={}},createTexture:function(e,t,n,r,i){var a=e.createTexture();return e.bindTexture(e.TEXTURE_2D,a),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,i||e.NEAREST),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE),r?e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,r):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t,n,0,e.RGBA,e.UNSIGNED_BYTE,null),a},getCachedTexture:function(e,t){if(this.textureCache[e])return this.textureCache[e];var n=this.createTexture(this.gl,t.width,t.height,t);return this.textureCache[e]=n,n},evictCachesForKey:function(e){this.textureCache[e]&&(this.gl.deleteTexture(this.textureCache[e]),delete this.textureCache[e])},copyGLTo2D:a,captureGPUInfo:function(){if(this.gpuInfo)return this.gpuInfo;var e=this.gl,t={renderer:``,vendor:``};if(!e)return t;var n=e.getExtension(`WEBGL_debug_renderer_info`);if(n){var r=e.getParameter(n.UNMASKED_RENDERER_WEBGL),i=e.getParameter(n.UNMASKED_VENDOR_WEBGL);r&&(t.renderer=r.toLowerCase()),i&&(t.vendor=i.toLowerCase())}return this.gpuInfo=t,t}}}();function i(e){var t=e.targetCanvas,n=t.width,r=t.height,i=e.destinationWidth,a=e.destinationHeight;(n!==i||r!==a)&&(t.width=i,t.height=a)}function a(e,t){var n=e.canvas,r=t.targetCanvas,i=r.getContext(`2d`);i.translate(0,r.height),i.scale(1,-1);var a=n.height-r.height;i.drawImage(n,0,a,r.width,r.height,0,0,r.width,r.height)}function o(e,t){var n=t.targetCanvas.getContext(`2d`),r=t.destinationWidth,i=t.destinationHeight,a=r*i*4,o=new Uint8Array(this.imageBuffer,0,a),s=new Uint8ClampedArray(this.imageBuffer,0,a);e.readPixels(0,0,r,i,e.RGBA,e.UNSIGNED_BYTE,o);var c=new ImageData(s,r,i);n.putImageData(c,0,0)}(function(){var e=function(){};t.Canvas2dFilterBackend=n;function n(){}n.prototype={evictCachesForKey:e,dispose:e,clearWebGLCaches:e,resources:{},applyFilters:function(e,t,n,r,i){var a=i.getContext(`2d`);a.drawImage(t,0,0,n,r);var o={sourceWidth:n,sourceHeight:r,imageData:a.getImageData(0,0,n,r),originalEl:t,originalImageData:a.getImageData(0,0,n,r),canvasEl:i,ctx:a,filterBackend:this};return e.forEach(function(e){e.applyTo(o)}),(o.imageData.width!==n||o.imageData.height!==r)&&(i.width=o.imageData.width,i.height=o.imageData.height),a.putImageData(o.imageData,0,0),o}}})(),t.Image=t.Image||{},t.Image.filters=t.Image.filters||{},t.Image.filters.BaseFilter=t.util.createClass({type:`BaseFilter`,vertexSource:`attribute vec2 aPosition;
|
|
89
|
+
varying vec2 vTexCoord;
|
|
90
|
+
void main() {
|
|
91
|
+
vTexCoord = aPosition;
|
|
92
|
+
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
|
|
93
|
+
}`,fragmentSource:`precision highp float;
|
|
94
|
+
varying vec2 vTexCoord;
|
|
95
|
+
uniform sampler2D uTexture;
|
|
96
|
+
void main() {
|
|
97
|
+
gl_FragColor = texture2D(uTexture, vTexCoord);
|
|
98
|
+
}`,initialize:function(e){e&&this.setOptions(e)},setOptions:function(e){for(var t in e)this[t]=e[t]},createProgram:function(e,n,r){n||=this.fragmentSource,r||=this.vertexSource,t.webGlPrecision!==`highp`&&(n=n.replace(/precision highp float/g,`precision `+t.webGlPrecision+` float`));var i=e.createShader(e.VERTEX_SHADER);if(e.shaderSource(i,r),e.compileShader(i),!e.getShaderParameter(i,e.COMPILE_STATUS))throw Error(`Vertex shader compile error for `+this.type+`: `+e.getShaderInfoLog(i));var a=e.createShader(e.FRAGMENT_SHADER);if(e.shaderSource(a,n),e.compileShader(a),!e.getShaderParameter(a,e.COMPILE_STATUS))throw Error(`Fragment shader compile error for `+this.type+`: `+e.getShaderInfoLog(a));var o=e.createProgram();if(e.attachShader(o,i),e.attachShader(o,a),e.linkProgram(o),!e.getProgramParameter(o,e.LINK_STATUS))throw Error('Shader link error for "${this.type}" '+e.getProgramInfoLog(o));var s=this.getAttributeLocations(e,o),c=this.getUniformLocations(e,o)||{};return c.uStepW=e.getUniformLocation(o,`uStepW`),c.uStepH=e.getUniformLocation(o,`uStepH`),{program:o,attributeLocations:s,uniformLocations:c}},getAttributeLocations:function(e,t){return{aPosition:e.getAttribLocation(t,`aPosition`)}},getUniformLocations:function(){return{}},sendAttributeData:function(e,t,n){var r=t.aPosition,i=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,i),e.enableVertexAttribArray(r),e.vertexAttribPointer(r,2,e.FLOAT,!1,0,0),e.bufferData(e.ARRAY_BUFFER,n,e.STATIC_DRAW)},_setupFrameBuffer:function(e){var t=e.context,n,r;e.passes>1?(n=e.destinationWidth,r=e.destinationHeight,(e.sourceWidth!==n||e.sourceHeight!==r)&&(t.deleteTexture(e.targetTexture),e.targetTexture=e.filterBackend.createTexture(t,n,r)),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,e.targetTexture,0)):(t.bindFramebuffer(t.FRAMEBUFFER,null),t.finish())},_swapTextures:function(e){e.passes--,e.pass++;var t=e.targetTexture;e.targetTexture=e.sourceTexture,e.sourceTexture=t},isNeutralState:function(){var e=this.mainParameter,n=t.Image.filters[this.type].prototype;if(e)if(Array.isArray(n[e])){for(var r=n[e].length;r--;)if(this[e][r]!==n[e][r])return!1;return!0}else return n[e]===this[e];else return!1},applyTo:function(e){e.webgl?(this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},retrieveShader:function(e){return e.programCache.hasOwnProperty(this.type)||(e.programCache[this.type]=this.createProgram(e.context)),e.programCache[this.type]},applyToWebGL:function(e){var t=e.context,n=this.retrieveShader(e);e.pass===0&&e.originalTexture?t.bindTexture(t.TEXTURE_2D,e.originalTexture):t.bindTexture(t.TEXTURE_2D,e.sourceTexture),t.useProgram(n.program),this.sendAttributeData(t,n.attributeLocations,e.aPosition),t.uniform1f(n.uniformLocations.uStepW,1/e.sourceWidth),t.uniform1f(n.uniformLocations.uStepH,1/e.sourceHeight),this.sendUniformData(t,n.uniformLocations),t.viewport(0,0,e.destinationWidth,e.destinationHeight),t.drawArrays(t.TRIANGLE_STRIP,0,4)},bindAdditionalTexture:function(e,t,n){e.activeTexture(n),e.bindTexture(e.TEXTURE_2D,t),e.activeTexture(e.TEXTURE0)},unbindAdditionalTexture:function(e,t){e.activeTexture(t),e.bindTexture(e.TEXTURE_2D,null),e.activeTexture(e.TEXTURE0)},getMainParameter:function(){return this[this.mainParameter]},setMainParameter:function(e){this[this.mainParameter]=e},sendUniformData:function(){},createHelpLayer:function(e){if(!e.helpLayer){var t=document.createElement(`canvas`);t.width=e.sourceWidth,t.height=e.sourceHeight,e.helpLayer=t}},toObject:function(){var e={type:this.type},t=this.mainParameter;return t&&(e[t]=this[t]),e},toJSON:function(){return this.toObject()}}),t.Image.filters.BaseFilter.fromObject=function(e,n){var r=new t.Image.filters[e.type](e);return n&&n(r),r},function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.ColorMatrix=r(n.BaseFilter,{type:`ColorMatrix`,fragmentSource:`precision highp float;
|
|
99
|
+
uniform sampler2D uTexture;
|
|
100
|
+
varying vec2 vTexCoord;
|
|
101
|
+
uniform mat4 uColorMatrix;
|
|
102
|
+
uniform vec4 uConstants;
|
|
103
|
+
void main() {
|
|
104
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
105
|
+
color *= uColorMatrix;
|
|
106
|
+
color += uConstants;
|
|
107
|
+
gl_FragColor = color;
|
|
108
|
+
}`,matrix:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],mainParameter:`matrix`,colorsOnly:!0,initialize:function(e){this.callSuper(`initialize`,e),this.matrix=this.matrix.slice(0)},applyTo2d:function(e){var t=e.imageData.data,n=t.length,r=this.matrix,i,a,o,s,c,l=this.colorsOnly;for(c=0;c<n;c+=4)i=t[c],a=t[c+1],o=t[c+2],l?(t[c]=i*r[0]+a*r[1]+o*r[2]+r[4]*255,t[c+1]=i*r[5]+a*r[6]+o*r[7]+r[9]*255,t[c+2]=i*r[10]+a*r[11]+o*r[12]+r[14]*255):(s=t[c+3],t[c]=i*r[0]+a*r[1]+o*r[2]+s*r[3]+r[4]*255,t[c+1]=i*r[5]+a*r[6]+o*r[7]+s*r[8]+r[9]*255,t[c+2]=i*r[10]+a*r[11]+o*r[12]+s*r[13]+r[14]*255,t[c+3]=i*r[15]+a*r[16]+o*r[17]+s*r[18]+r[19]*255)},getUniformLocations:function(e,t){return{uColorMatrix:e.getUniformLocation(t,`uColorMatrix`),uConstants:e.getUniformLocation(t,`uConstants`)}},sendUniformData:function(e,t){var n=this.matrix,r=[n[0],n[1],n[2],n[3],n[5],n[6],n[7],n[8],n[10],n[11],n[12],n[13],n[15],n[16],n[17],n[18]],i=[n[4],n[9],n[14],n[19]];e.uniformMatrix4fv(t.uColorMatrix,!1,r),e.uniform4fv(t.uConstants,i)}}),t.Image.filters.ColorMatrix.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Brightness=r(n.BaseFilter,{type:`Brightness`,fragmentSource:`precision highp float;
|
|
109
|
+
uniform sampler2D uTexture;
|
|
110
|
+
uniform float uBrightness;
|
|
111
|
+
varying vec2 vTexCoord;
|
|
112
|
+
void main() {
|
|
113
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
114
|
+
color.rgb += uBrightness;
|
|
115
|
+
gl_FragColor = color;
|
|
116
|
+
}`,brightness:0,mainParameter:`brightness`,applyTo2d:function(e){if(this.brightness!==0){var t=e.imageData.data,n,r=t.length,i=Math.round(this.brightness*255);for(n=0;n<r;n+=4)t[n]=t[n]+i,t[n+1]=t[n+1]+i,t[n+2]=t[n+2]+i}},getUniformLocations:function(e,t){return{uBrightness:e.getUniformLocation(t,`uBrightness`)}},sendUniformData:function(e,t){e.uniform1f(t.uBrightness,this.brightness)}}),t.Image.filters.Brightness.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.Image.filters,i=t.util.createClass;r.Convolute=i(r.BaseFilter,{type:`Convolute`,opaque:!1,matrix:[0,0,0,0,1,0,0,0,0],fragmentSource:{Convolute_3_1:`precision highp float;
|
|
117
|
+
uniform sampler2D uTexture;
|
|
118
|
+
uniform float uMatrix[9];
|
|
119
|
+
uniform float uStepW;
|
|
120
|
+
uniform float uStepH;
|
|
121
|
+
varying vec2 vTexCoord;
|
|
122
|
+
void main() {
|
|
123
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
124
|
+
for (float h = 0.0; h < 3.0; h+=1.0) {
|
|
125
|
+
for (float w = 0.0; w < 3.0; w+=1.0) {
|
|
126
|
+
vec2 matrixPos = vec2(uStepW * (w - 1), uStepH * (h - 1));
|
|
127
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 3.0 + w)];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
gl_FragColor = color;
|
|
131
|
+
}`,Convolute_3_0:`precision highp float;
|
|
132
|
+
uniform sampler2D uTexture;
|
|
133
|
+
uniform float uMatrix[9];
|
|
134
|
+
uniform float uStepW;
|
|
135
|
+
uniform float uStepH;
|
|
136
|
+
varying vec2 vTexCoord;
|
|
137
|
+
void main() {
|
|
138
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
139
|
+
for (float h = 0.0; h < 3.0; h+=1.0) {
|
|
140
|
+
for (float w = 0.0; w < 3.0; w+=1.0) {
|
|
141
|
+
vec2 matrixPos = vec2(uStepW * (w - 1.0), uStepH * (h - 1.0));
|
|
142
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 3.0 + w)];
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
146
|
+
gl_FragColor = color;
|
|
147
|
+
gl_FragColor.a = alpha;
|
|
148
|
+
}`,Convolute_5_1:`precision highp float;
|
|
149
|
+
uniform sampler2D uTexture;
|
|
150
|
+
uniform float uMatrix[25];
|
|
151
|
+
uniform float uStepW;
|
|
152
|
+
uniform float uStepH;
|
|
153
|
+
varying vec2 vTexCoord;
|
|
154
|
+
void main() {
|
|
155
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
156
|
+
for (float h = 0.0; h < 5.0; h+=1.0) {
|
|
157
|
+
for (float w = 0.0; w < 5.0; w+=1.0) {
|
|
158
|
+
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
|
|
159
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 5.0 + w)];
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
gl_FragColor = color;
|
|
163
|
+
}`,Convolute_5_0:`precision highp float;
|
|
164
|
+
uniform sampler2D uTexture;
|
|
165
|
+
uniform float uMatrix[25];
|
|
166
|
+
uniform float uStepW;
|
|
167
|
+
uniform float uStepH;
|
|
168
|
+
varying vec2 vTexCoord;
|
|
169
|
+
void main() {
|
|
170
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
171
|
+
for (float h = 0.0; h < 5.0; h+=1.0) {
|
|
172
|
+
for (float w = 0.0; w < 5.0; w+=1.0) {
|
|
173
|
+
vec2 matrixPos = vec2(uStepW * (w - 2.0), uStepH * (h - 2.0));
|
|
174
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 5.0 + w)];
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
178
|
+
gl_FragColor = color;
|
|
179
|
+
gl_FragColor.a = alpha;
|
|
180
|
+
}`,Convolute_7_1:`precision highp float;
|
|
181
|
+
uniform sampler2D uTexture;
|
|
182
|
+
uniform float uMatrix[49];
|
|
183
|
+
uniform float uStepW;
|
|
184
|
+
uniform float uStepH;
|
|
185
|
+
varying vec2 vTexCoord;
|
|
186
|
+
void main() {
|
|
187
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
188
|
+
for (float h = 0.0; h < 7.0; h+=1.0) {
|
|
189
|
+
for (float w = 0.0; w < 7.0; w+=1.0) {
|
|
190
|
+
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
|
|
191
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 7.0 + w)];
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
gl_FragColor = color;
|
|
195
|
+
}`,Convolute_7_0:`precision highp float;
|
|
196
|
+
uniform sampler2D uTexture;
|
|
197
|
+
uniform float uMatrix[49];
|
|
198
|
+
uniform float uStepW;
|
|
199
|
+
uniform float uStepH;
|
|
200
|
+
varying vec2 vTexCoord;
|
|
201
|
+
void main() {
|
|
202
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
203
|
+
for (float h = 0.0; h < 7.0; h+=1.0) {
|
|
204
|
+
for (float w = 0.0; w < 7.0; w+=1.0) {
|
|
205
|
+
vec2 matrixPos = vec2(uStepW * (w - 3.0), uStepH * (h - 3.0));
|
|
206
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 7.0 + w)];
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
210
|
+
gl_FragColor = color;
|
|
211
|
+
gl_FragColor.a = alpha;
|
|
212
|
+
}`,Convolute_9_1:`precision highp float;
|
|
213
|
+
uniform sampler2D uTexture;
|
|
214
|
+
uniform float uMatrix[81];
|
|
215
|
+
uniform float uStepW;
|
|
216
|
+
uniform float uStepH;
|
|
217
|
+
varying vec2 vTexCoord;
|
|
218
|
+
void main() {
|
|
219
|
+
vec4 color = vec4(0, 0, 0, 0);
|
|
220
|
+
for (float h = 0.0; h < 9.0; h+=1.0) {
|
|
221
|
+
for (float w = 0.0; w < 9.0; w+=1.0) {
|
|
222
|
+
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
|
|
223
|
+
color += texture2D(uTexture, vTexCoord + matrixPos) * uMatrix[int(h * 9.0 + w)];
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
gl_FragColor = color;
|
|
227
|
+
}`,Convolute_9_0:`precision highp float;
|
|
228
|
+
uniform sampler2D uTexture;
|
|
229
|
+
uniform float uMatrix[81];
|
|
230
|
+
uniform float uStepW;
|
|
231
|
+
uniform float uStepH;
|
|
232
|
+
varying vec2 vTexCoord;
|
|
233
|
+
void main() {
|
|
234
|
+
vec4 color = vec4(0, 0, 0, 1);
|
|
235
|
+
for (float h = 0.0; h < 9.0; h+=1.0) {
|
|
236
|
+
for (float w = 0.0; w < 9.0; w+=1.0) {
|
|
237
|
+
vec2 matrixPos = vec2(uStepW * (w - 4.0), uStepH * (h - 4.0));
|
|
238
|
+
color.rgb += texture2D(uTexture, vTexCoord + matrixPos).rgb * uMatrix[int(h * 9.0 + w)];
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
float alpha = texture2D(uTexture, vTexCoord).a;
|
|
242
|
+
gl_FragColor = color;
|
|
243
|
+
gl_FragColor.a = alpha;
|
|
244
|
+
}`},retrieveShader:function(e){var t=Math.sqrt(this.matrix.length),n=this.type+`_`+t+`_`+(this.opaque?1:0),r=this.fragmentSource[n];return e.programCache.hasOwnProperty(n)||(e.programCache[n]=this.createProgram(e.context,r)),e.programCache[n]},applyTo2d:function(e){var t=e.imageData,n=t.data,r=this.matrix,i=Math.round(Math.sqrt(r.length)),a=Math.floor(i/2),o=t.width,s=t.height,c=e.ctx.createImageData(o,s),l=c.data,u=this.opaque?1:0,d,f,p,m,h,g,_,v,y,b,x,S,C;for(x=0;x<s;x++)for(b=0;b<o;b++){for(h=(x*o+b)*4,d=0,f=0,p=0,m=0,C=0;C<i;C++)for(S=0;S<i;S++)_=x+C-a,g=b+S-a,!(_<0||_>=s||g<0||g>=o)&&(v=(_*o+g)*4,y=r[C*i+S],d+=n[v]*y,f+=n[v+1]*y,p+=n[v+2]*y,u||(m+=n[v+3]*y));l[h]=d,l[h+1]=f,l[h+2]=p,u?l[h+3]=n[h+3]:l[h+3]=m}e.imageData=c},getUniformLocations:function(e,t){return{uMatrix:e.getUniformLocation(t,`uMatrix`),uOpaque:e.getUniformLocation(t,`uOpaque`),uHalfSize:e.getUniformLocation(t,`uHalfSize`),uSize:e.getUniformLocation(t,`uSize`)}},sendUniformData:function(e,t){e.uniform1fv(t.uMatrix,this.matrix)},toObject:function(){return n(this.callSuper(`toObject`),{opaque:this.opaque,matrix:this.matrix})}}),t.Image.filters.Convolute.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Grayscale=r(n.BaseFilter,{type:`Grayscale`,fragmentSource:{average:`precision highp float;
|
|
245
|
+
uniform sampler2D uTexture;
|
|
246
|
+
varying vec2 vTexCoord;
|
|
247
|
+
void main() {
|
|
248
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
249
|
+
float average = (color.r + color.b + color.g) / 3.0;
|
|
250
|
+
gl_FragColor = vec4(average, average, average, color.a);
|
|
251
|
+
}`,lightness:`precision highp float;
|
|
252
|
+
uniform sampler2D uTexture;
|
|
253
|
+
uniform int uMode;
|
|
254
|
+
varying vec2 vTexCoord;
|
|
255
|
+
void main() {
|
|
256
|
+
vec4 col = texture2D(uTexture, vTexCoord);
|
|
257
|
+
float average = (max(max(col.r, col.g),col.b) + min(min(col.r, col.g),col.b)) / 2.0;
|
|
258
|
+
gl_FragColor = vec4(average, average, average, col.a);
|
|
259
|
+
}`,luminosity:`precision highp float;
|
|
260
|
+
uniform sampler2D uTexture;
|
|
261
|
+
uniform int uMode;
|
|
262
|
+
varying vec2 vTexCoord;
|
|
263
|
+
void main() {
|
|
264
|
+
vec4 col = texture2D(uTexture, vTexCoord);
|
|
265
|
+
float average = 0.21 * col.r + 0.72 * col.g + 0.07 * col.b;
|
|
266
|
+
gl_FragColor = vec4(average, average, average, col.a);
|
|
267
|
+
}`},mode:`average`,mainParameter:`mode`,applyTo2d:function(e){var t=e.imageData.data,n,r=t.length,i,a=this.mode;for(n=0;n<r;n+=4)a===`average`?i=(t[n]+t[n+1]+t[n+2])/3:a===`lightness`?i=(Math.min(t[n],t[n+1],t[n+2])+Math.max(t[n],t[n+1],t[n+2]))/2:a===`luminosity`&&(i=.21*t[n]+.72*t[n+1]+.07*t[n+2]),t[n]=i,t[n+1]=i,t[n+2]=i},retrieveShader:function(e){var t=this.type+`_`+this.mode;if(!e.programCache.hasOwnProperty(t)){var n=this.fragmentSource[this.mode];e.programCache[t]=this.createProgram(e.context,n)}return e.programCache[t]},getUniformLocations:function(e,t){return{uMode:e.getUniformLocation(t,`uMode`)}},sendUniformData:function(e,t){e.uniform1i(t.uMode,1)},isNeutralState:function(){return!1}}),t.Image.filters.Grayscale.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Invert=r(n.BaseFilter,{type:`Invert`,fragmentSource:`precision highp float;
|
|
268
|
+
uniform sampler2D uTexture;
|
|
269
|
+
uniform int uInvert;
|
|
270
|
+
varying vec2 vTexCoord;
|
|
271
|
+
void main() {
|
|
272
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
273
|
+
if (uInvert == 1) {
|
|
274
|
+
gl_FragColor = vec4(1.0 - color.r,1.0 -color.g,1.0 -color.b,color.a);
|
|
275
|
+
} else {
|
|
276
|
+
gl_FragColor = color;
|
|
277
|
+
}
|
|
278
|
+
}`,invert:!0,mainParameter:`invert`,applyTo2d:function(e){var t=e.imageData.data,n,r=t.length;for(n=0;n<r;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]},isNeutralState:function(){return!this.invert},getUniformLocations:function(e,t){return{uInvert:e.getUniformLocation(t,`uInvert`)}},sendUniformData:function(e,t){e.uniform1i(t.uInvert,this.invert)}}),t.Image.filters.Invert.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.Image.filters,i=t.util.createClass;r.Noise=i(r.BaseFilter,{type:`Noise`,fragmentSource:`precision highp float;
|
|
279
|
+
uniform sampler2D uTexture;
|
|
280
|
+
uniform float uStepH;
|
|
281
|
+
uniform float uNoise;
|
|
282
|
+
uniform float uSeed;
|
|
283
|
+
varying vec2 vTexCoord;
|
|
284
|
+
float rand(vec2 co, float seed, float vScale) {
|
|
285
|
+
return fract(sin(dot(co.xy * vScale ,vec2(12.9898 , 78.233))) * 43758.5453 * (seed + 0.01) / 2.0);
|
|
286
|
+
}
|
|
287
|
+
void main() {
|
|
288
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
289
|
+
color.rgb += (0.5 - rand(vTexCoord, uSeed, 0.1 / uStepH)) * uNoise;
|
|
290
|
+
gl_FragColor = color;
|
|
291
|
+
}`,mainParameter:`noise`,noise:0,applyTo2d:function(e){if(this.noise!==0){var t=e.imageData.data,n,r=t.length,i=this.noise,a;for(n=0,r=t.length;n<r;n+=4)a=(.5-Math.random())*i,t[n]+=a,t[n+1]+=a,t[n+2]+=a}},getUniformLocations:function(e,t){return{uNoise:e.getUniformLocation(t,`uNoise`),uSeed:e.getUniformLocation(t,`uSeed`)}},sendUniformData:function(e,t){e.uniform1f(t.uNoise,this.noise/255),e.uniform1f(t.uSeed,Math.random())},toObject:function(){return n(this.callSuper(`toObject`),{noise:this.noise})}}),t.Image.filters.Noise.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Pixelate=r(n.BaseFilter,{type:`Pixelate`,blocksize:4,mainParameter:`blocksize`,fragmentSource:`precision highp float;
|
|
292
|
+
uniform sampler2D uTexture;
|
|
293
|
+
uniform float uBlocksize;
|
|
294
|
+
uniform float uStepW;
|
|
295
|
+
uniform float uStepH;
|
|
296
|
+
varying vec2 vTexCoord;
|
|
297
|
+
void main() {
|
|
298
|
+
float blockW = uBlocksize * uStepW;
|
|
299
|
+
float blockH = uBlocksize * uStepW;
|
|
300
|
+
int posX = int(vTexCoord.x / blockW);
|
|
301
|
+
int posY = int(vTexCoord.y / blockH);
|
|
302
|
+
float fposX = float(posX);
|
|
303
|
+
float fposY = float(posY);
|
|
304
|
+
vec2 squareCoords = vec2(fposX * blockW, fposY * blockH);
|
|
305
|
+
vec4 color = texture2D(uTexture, squareCoords);
|
|
306
|
+
gl_FragColor = color;
|
|
307
|
+
}`,applyTo2d:function(e){var t=e.imageData,n=t.data,r=t.height,i=t.width,a,o,s,c,l,u,d,f,p,m,h;for(o=0;o<r;o+=this.blocksize)for(s=0;s<i;s+=this.blocksize)for(a=o*4*i+s*4,c=n[a],l=n[a+1],u=n[a+2],d=n[a+3],m=Math.min(o+this.blocksize,r),h=Math.min(s+this.blocksize,i),f=o;f<m;f++)for(p=s;p<h;p++)a=f*4*i+p*4,n[a]=c,n[a+1]=l,n[a+2]=u,n[a+3]=d},isNeutralState:function(){return this.blocksize===1},getUniformLocations:function(e,t){return{uBlocksize:e.getUniformLocation(t,`uBlocksize`),uStepW:e.getUniformLocation(t,`uStepW`),uStepH:e.getUniformLocation(t,`uStepH`)}},sendUniformData:function(e,t){e.uniform1f(t.uBlocksize,this.blocksize)}}),t.Image.filters.Pixelate.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.util.object.extend,r=t.Image.filters,i=t.util.createClass;r.RemoveColor=i(r.BaseFilter,{type:`RemoveColor`,color:`#FFFFFF`,fragmentSource:`precision highp float;
|
|
308
|
+
uniform sampler2D uTexture;
|
|
309
|
+
uniform vec4 uLow;
|
|
310
|
+
uniform vec4 uHigh;
|
|
311
|
+
varying vec2 vTexCoord;
|
|
312
|
+
void main() {
|
|
313
|
+
gl_FragColor = texture2D(uTexture, vTexCoord);
|
|
314
|
+
if(all(greaterThan(gl_FragColor.rgb,uLow.rgb)) && all(greaterThan(uHigh.rgb,gl_FragColor.rgb))) {
|
|
315
|
+
gl_FragColor.a = 0.0;
|
|
316
|
+
}
|
|
317
|
+
}`,distance:.02,useAlpha:!1,applyTo2d:function(e){var n=e.imageData.data,r,i=this.distance*255,a,o,s,c=new t.Color(this.color).getSource(),l=[c[0]-i,c[1]-i,c[2]-i],u=[c[0]+i,c[1]+i,c[2]+i];for(r=0;r<n.length;r+=4)a=n[r],o=n[r+1],s=n[r+2],a>l[0]&&o>l[1]&&s>l[2]&&a<u[0]&&o<u[1]&&s<u[2]&&(n[r+3]=0)},getUniformLocations:function(e,t){return{uLow:e.getUniformLocation(t,`uLow`),uHigh:e.getUniformLocation(t,`uHigh`)}},sendUniformData:function(e,n){var r=new t.Color(this.color).getSource(),i=parseFloat(this.distance),a=[0+r[0]/255-i,0+r[1]/255-i,0+r[2]/255-i,1],o=[r[0]/255+i,r[1]/255+i,r[2]/255+i,1];e.uniform4fv(n.uLow,a),e.uniform4fv(n.uHigh,o)},toObject:function(){return n(this.callSuper(`toObject`),{color:this.color,distance:this.distance})}}),t.Image.filters.RemoveColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass,i={Brownie:[.5997,.34553,-.27082,0,.186,-.0377,.86095,.15059,0,-.1449,.24113,-.07441,.44972,0,-.02965,0,0,0,1,0],Vintage:[.62793,.32021,-.03965,0,.03784,.02578,.64411,.03259,0,.02926,.0466,-.08512,.52416,0,.02023,0,0,0,1,0],Kodachrome:[1.12855,-.39673,-.03992,0,.24991,-.16404,1.08352,-.05498,0,.09698,-.16786,-.56034,1.60148,0,.13972,0,0,0,1,0],Technicolor:[1.91252,-.85453,-.09155,0,.04624,-.30878,1.76589,-.10601,0,-.27589,-.2311,-.75018,1.84759,0,.12137,0,0,0,1,0],Polaroid:[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],Sepia:[.393,.769,.189,0,0,.349,.686,.168,0,0,.272,.534,.131,0,0,0,0,0,1,0],BlackWhite:[1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,1.5,1.5,1.5,0,-1,0,0,0,1,0]};for(var a in i)n[a]=r(n.ColorMatrix,{type:a,matrix:i[a],mainParameter:!1,colorsOnly:!0}),t.Image.filters[a].fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,n=t.Image.filters,r=t.util.createClass;n.BlendColor=r(n.BaseFilter,{type:`BlendColor`,color:`#F95C63`,mode:`multiply`,alpha:1,fragmentSource:{multiply:`gl_FragColor.rgb *= uColor.rgb;
|
|
318
|
+
`,screen:`gl_FragColor.rgb = 1.0 - (1.0 - gl_FragColor.rgb) * (1.0 - uColor.rgb);
|
|
319
|
+
`,add:`gl_FragColor.rgb += uColor.rgb;
|
|
320
|
+
`,diff:`gl_FragColor.rgb = abs(gl_FragColor.rgb - uColor.rgb);
|
|
321
|
+
`,subtract:`gl_FragColor.rgb -= uColor.rgb;
|
|
322
|
+
`,lighten:`gl_FragColor.rgb = max(gl_FragColor.rgb, uColor.rgb);
|
|
323
|
+
`,darken:`gl_FragColor.rgb = min(gl_FragColor.rgb, uColor.rgb);
|
|
324
|
+
`,exclusion:`gl_FragColor.rgb += uColor.rgb - 2.0 * (uColor.rgb * gl_FragColor.rgb);
|
|
325
|
+
`,overlay:`if (uColor.r < 0.5) {
|
|
326
|
+
gl_FragColor.r *= 2.0 * uColor.r;
|
|
327
|
+
} else {
|
|
328
|
+
gl_FragColor.r = 1.0 - 2.0 * (1.0 - gl_FragColor.r) * (1.0 - uColor.r);
|
|
329
|
+
}
|
|
330
|
+
if (uColor.g < 0.5) {
|
|
331
|
+
gl_FragColor.g *= 2.0 * uColor.g;
|
|
332
|
+
} else {
|
|
333
|
+
gl_FragColor.g = 1.0 - 2.0 * (1.0 - gl_FragColor.g) * (1.0 - uColor.g);
|
|
334
|
+
}
|
|
335
|
+
if (uColor.b < 0.5) {
|
|
336
|
+
gl_FragColor.b *= 2.0 * uColor.b;
|
|
337
|
+
} else {
|
|
338
|
+
gl_FragColor.b = 1.0 - 2.0 * (1.0 - gl_FragColor.b) * (1.0 - uColor.b);
|
|
339
|
+
}
|
|
340
|
+
`,tint:`gl_FragColor.rgb *= (1.0 - uColor.a);
|
|
341
|
+
gl_FragColor.rgb += uColor.rgb;
|
|
342
|
+
`},buildSource:function(e){return`precision highp float;
|
|
343
|
+
uniform sampler2D uTexture;
|
|
344
|
+
uniform vec4 uColor;
|
|
345
|
+
varying vec2 vTexCoord;
|
|
346
|
+
void main() {
|
|
347
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
348
|
+
gl_FragColor = color;
|
|
349
|
+
if (color.a > 0.0) {
|
|
350
|
+
`+this.fragmentSource[e]+`}
|
|
351
|
+
}`},retrieveShader:function(e){var t=this.type+`_`+this.mode,n;return e.programCache.hasOwnProperty(t)||(n=this.buildSource(this.mode),e.programCache[t]=this.createProgram(e.context,n)),e.programCache[t]},applyTo2d:function(e){var n=e.imageData.data,r=n.length,i,a,o,s,c,l,u,d=1-this.alpha;u=new t.Color(this.color).getSource(),i=u[0]*this.alpha,a=u[1]*this.alpha,o=u[2]*this.alpha;for(var f=0;f<r;f+=4)switch(s=n[f],c=n[f+1],l=n[f+2],this.mode){case`multiply`:n[f]=s*i/255,n[f+1]=c*a/255,n[f+2]=l*o/255;break;case`screen`:n[f]=255-(255-s)*(255-i)/255,n[f+1]=255-(255-c)*(255-a)/255,n[f+2]=255-(255-l)*(255-o)/255;break;case`add`:n[f]=s+i,n[f+1]=c+a,n[f+2]=l+o;break;case`diff`:case`difference`:n[f]=Math.abs(s-i),n[f+1]=Math.abs(c-a),n[f+2]=Math.abs(l-o);break;case`subtract`:n[f]=s-i,n[f+1]=c-a,n[f+2]=l-o;break;case`darken`:n[f]=Math.min(s,i),n[f+1]=Math.min(c,a),n[f+2]=Math.min(l,o);break;case`lighten`:n[f]=Math.max(s,i),n[f+1]=Math.max(c,a),n[f+2]=Math.max(l,o);break;case`overlay`:n[f]=i<128?2*s*i/255:255-2*(255-s)*(255-i)/255,n[f+1]=a<128?2*c*a/255:255-2*(255-c)*(255-a)/255,n[f+2]=o<128?2*l*o/255:255-2*(255-l)*(255-o)/255;break;case`exclusion`:n[f]=i+s-2*i*s/255,n[f+1]=a+c-2*a*c/255,n[f+2]=o+l-2*o*l/255;break;case`tint`:n[f]=i+s*d,n[f+1]=a+c*d,n[f+2]=o+l*d}},getUniformLocations:function(e,t){return{uColor:e.getUniformLocation(t,`uColor`)}},sendUniformData:function(e,n){var r=new t.Color(this.color).getSource();r[0]=this.alpha*r[0]/255,r[1]=this.alpha*r[1]/255,r[2]=this.alpha*r[2]/255,r[3]=this.alpha,e.uniform4fv(n.uColor,r)},toObject:function(){return{type:this.type,color:this.color,mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendColor.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric,n=t.Image.filters,r=t.util.createClass;n.BlendImage=r(n.BaseFilter,{type:`BlendImage`,image:null,mode:`multiply`,alpha:1,vertexSource:`attribute vec2 aPosition;
|
|
352
|
+
varying vec2 vTexCoord;
|
|
353
|
+
varying vec2 vTexCoord2;
|
|
354
|
+
uniform mat3 uTransformMatrix;
|
|
355
|
+
void main() {
|
|
356
|
+
vTexCoord = aPosition;
|
|
357
|
+
vTexCoord2 = (uTransformMatrix * vec3(aPosition, 1.0)).xy;
|
|
358
|
+
gl_Position = vec4(aPosition * 2.0 - 1.0, 0.0, 1.0);
|
|
359
|
+
}`,fragmentSource:{multiply:`precision highp float;
|
|
360
|
+
uniform sampler2D uTexture;
|
|
361
|
+
uniform sampler2D uImage;
|
|
362
|
+
uniform vec4 uColor;
|
|
363
|
+
varying vec2 vTexCoord;
|
|
364
|
+
varying vec2 vTexCoord2;
|
|
365
|
+
void main() {
|
|
366
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
367
|
+
vec4 color2 = texture2D(uImage, vTexCoord2);
|
|
368
|
+
color.rgba *= color2.rgba;
|
|
369
|
+
gl_FragColor = color;
|
|
370
|
+
}`,mask:`precision highp float;
|
|
371
|
+
uniform sampler2D uTexture;
|
|
372
|
+
uniform sampler2D uImage;
|
|
373
|
+
uniform vec4 uColor;
|
|
374
|
+
varying vec2 vTexCoord;
|
|
375
|
+
varying vec2 vTexCoord2;
|
|
376
|
+
void main() {
|
|
377
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
378
|
+
vec4 color2 = texture2D(uImage, vTexCoord2);
|
|
379
|
+
color.a = color2.a;
|
|
380
|
+
gl_FragColor = color;
|
|
381
|
+
}`},retrieveShader:function(e){var t=this.type+`_`+this.mode,n=this.fragmentSource[this.mode];return e.programCache.hasOwnProperty(t)||(e.programCache[t]=this.createProgram(e.context,n)),e.programCache[t]},applyToWebGL:function(e){var t=e.context,n=this.createTexture(e.filterBackend,this.image);this.bindAdditionalTexture(t,n,t.TEXTURE1),this.callSuper(`applyToWebGL`,e),this.unbindAdditionalTexture(t,t.TEXTURE1)},createTexture:function(e,t){return e.getCachedTexture(t.cacheKey,t._element)},calculateMatrix:function(){var e=this.image,t=e._element.width,n=e._element.height;return[1/e.scaleX,0,0,0,1/e.scaleY,0,-e.left/t,-e.top/n,1]},applyTo2d:function(e){var n=e.imageData,r=e.filterBackend.resources,i=n.data,a=i.length,o=n.width,s=n.height,c,l,u,d,f,p,m,h,g,_,v=this.image,y;r.blendImage||=t.util.createCanvasElement(),g=r.blendImage,_=g.getContext(`2d`),g.width!==o||g.height!==s?(g.width=o,g.height=s):_.clearRect(0,0,o,s),_.setTransform(v.scaleX,0,0,v.scaleY,v.left,v.top),_.drawImage(v._element,0,0,o,s),y=_.getImageData(0,0,o,s).data;for(var b=0;b<a;b+=4)switch(f=i[b],p=i[b+1],m=i[b+2],h=i[b+3],c=y[b],l=y[b+1],u=y[b+2],d=y[b+3],this.mode){case`multiply`:i[b]=f*c/255,i[b+1]=p*l/255,i[b+2]=m*u/255,i[b+3]=h*d/255;break;case`mask`:i[b+3]=d;break}},getUniformLocations:function(e,t){return{uTransformMatrix:e.getUniformLocation(t,`uTransformMatrix`),uImage:e.getUniformLocation(t,`uImage`)}},sendUniformData:function(e,t){var n=this.calculateMatrix();e.uniform1i(t.uImage,1),e.uniformMatrix3fv(t.uTransformMatrix,!1,n)},toObject:function(){return{type:this.type,image:this.image&&this.image.toObject(),mode:this.mode,alpha:this.alpha}}}),t.Image.filters.BlendImage.fromObject=function(e,n){t.Image.fromObject(e.image,function(r){var i=t.util.object.clone(e);i.image=r,n(new t.Image.filters.BlendImage(i))})}}(e),function(e){var t=e.fabric||={},n=Math.pow,r=Math.floor,i=Math.sqrt,a=Math.abs,o=Math.round,s=Math.sin,c=Math.ceil,l=t.Image.filters,u=t.util.createClass;l.Resize=u(l.BaseFilter,{type:`Resize`,resizeType:`hermite`,scaleX:1,scaleY:1,lanczosLobes:3,getUniformLocations:function(e,t){return{uDelta:e.getUniformLocation(t,`uDelta`),uTaps:e.getUniformLocation(t,`uTaps`)}},sendUniformData:function(e,t){e.uniform2fv(t.uDelta,this.horizontal?[1/this.width,0]:[0,1/this.height]),e.uniform1fv(t.uTaps,this.taps)},retrieveShader:function(e){var t=this.getFilterWindow(),n=this.type+`_`+t;if(!e.programCache.hasOwnProperty(n)){var r=this.generateShader(t);e.programCache[n]=this.createProgram(e.context,r)}return e.programCache[n]},getFilterWindow:function(){var e=this.tempScale;return Math.ceil(this.lanczosLobes/e)},getTaps:function(){for(var e=this.lanczosCreate(this.lanczosLobes),t=this.tempScale,n=this.getFilterWindow(),r=Array(n),i=1;i<=n;i++)r[i-1]=e(i*t);return r},generateShader:function(e){for(var t=Array(e),n=this.fragmentSourceTOP,e,r=1;r<=e;r++)t[r-1]=r+`.0 * uDelta`;return n+=`uniform float uTaps[`+e+`];
|
|
382
|
+
`,n+=`void main() {
|
|
383
|
+
`,n+=` vec4 color = texture2D(uTexture, vTexCoord);
|
|
384
|
+
`,n+=` float sum = 1.0;
|
|
385
|
+
`,t.forEach(function(e,t){n+=` color += texture2D(uTexture, vTexCoord + `+e+`) * uTaps[`+t+`];
|
|
386
|
+
`,n+=` color += texture2D(uTexture, vTexCoord - `+e+`) * uTaps[`+t+`];
|
|
387
|
+
`,n+=` sum += 2.0 * uTaps[`+t+`];
|
|
388
|
+
`}),n+=` gl_FragColor = color / sum;
|
|
389
|
+
`,n+=`}`,n},fragmentSourceTOP:`precision highp float;
|
|
390
|
+
uniform sampler2D uTexture;
|
|
391
|
+
uniform vec2 uDelta;
|
|
392
|
+
varying vec2 vTexCoord;
|
|
393
|
+
`,applyTo:function(e){e.webgl?(e.passes++,this.width=e.sourceWidth,this.horizontal=!0,this.dW=Math.round(this.width*this.scaleX),this.dH=e.sourceHeight,this.tempScale=this.dW/this.width,this.taps=this.getTaps(),e.destinationWidth=this.dW,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceWidth=e.destinationWidth,this.height=e.sourceHeight,this.horizontal=!1,this.dH=Math.round(this.height*this.scaleY),this.tempScale=this.dH/this.height,this.taps=this.getTaps(),e.destinationHeight=this.dH,this._setupFrameBuffer(e),this.applyToWebGL(e),this._swapTextures(e),e.sourceHeight=e.destinationHeight):this.applyTo2d(e)},isNeutralState:function(){return this.scaleX===1&&this.scaleY===1},lanczosCreate:function(e){return function(t){if(t>=e||t<=-e)return 0;if(t<1.1920929e-7&&t>-1.1920929e-7)return 1;t*=Math.PI;var n=t/e;return s(t)/t*s(n)/n}},applyTo2d:function(e){var t=e.imageData,n=this.scaleX,r=this.scaleY;this.rcpScaleX=1/n,this.rcpScaleY=1/r;var i=t.width,a=t.height,s=o(i*n),c=o(a*r),l;this.resizeType===`sliceHack`?l=this.sliceByTwo(e,i,a,s,c):this.resizeType===`hermite`?l=this.hermiteFastResize(e,i,a,s,c):this.resizeType===`bilinear`?l=this.bilinearFiltering(e,i,a,s,c):this.resizeType===`lanczos`&&(l=this.lanczosResize(e,i,a,s,c)),e.imageData=l},sliceByTwo:function(e,n,i,a,o){var s=e.imageData,c=.5,l=!1,u=!1,d=n*c,f=i*c,p=t.filterBackend.resources,m,h,g=0,_=0,v=n,y=0;for(p.sliceByTwo||=document.createElement(`canvas`),m=p.sliceByTwo,(m.width<n*1.5||m.height<i)&&(m.width=n*1.5,m.height=i),h=m.getContext(`2d`),h.clearRect(0,0,n*1.5,i),h.putImageData(s,0,0),a=r(a),o=r(o);!l||!u;)n=d,i=f,a<r(d*c)?d=r(d*c):(d=a,l=!0),o<r(f*c)?f=r(f*c):(f=o,u=!0),h.drawImage(m,g,_,n,i,v,y,d,f),g=v,_=y,y+=f;return h.getImageData(g,_,a,o)},lanczosResize:function(e,t,o,s,l){function u(e){var c,w,T,E,D,O,k,A,j,M,N;for(S.x=(e+.5)*h,C.x=r(S.x),c=0;c<l;c++){for(S.y=(c+.5)*g,C.y=r(S.y),D=0,O=0,k=0,A=0,j=0,w=C.x-y;w<=C.x+y;w++)if(!(w<0||w>=t)){M=r(1e3*a(w-S.x)),x[M]||(x[M]={});for(var P=C.y-b;P<=C.y+b;P++)P<0||P>=o||(N=r(1e3*a(P-S.y)),x[M][N]||(x[M][N]=m(i(n(M*_,2)+n(N*v,2))/1e3)),T=x[M][N],T>0&&(E=(P*t+w)*4,D+=T,O+=T*d[E],k+=T*d[E+1],A+=T*d[E+2],j+=T*d[E+3]))}E=(c*s+e)*4,p[E]=O/D,p[E+1]=k/D,p[E+2]=A/D,p[E+3]=j/D}return++e<s?u(e):f}var d=e.imageData.data,f=e.ctx.createImageData(s,l),p=f.data,m=this.lanczosCreate(this.lanczosLobes),h=this.rcpScaleX,g=this.rcpScaleY,_=2/this.rcpScaleX,v=2/this.rcpScaleY,y=c(h*this.lanczosLobes/2),b=c(g*this.lanczosLobes/2),x={},S={},C={};return u(0)},bilinearFiltering:function(e,t,n,i,a){var o,s,c,l,u,d,f,p,m,h,g,_,v=0,y,b=this.rcpScaleX,x=this.rcpScaleY,S=4*(t-1),C=e.imageData.data,w=e.ctx.createImageData(i,a),T=w.data;for(f=0;f<a;f++)for(p=0;p<i;p++)for(u=r(b*p),d=r(x*f),m=b*p-u,h=x*f-d,y=4*(d*t+u),g=0;g<4;g++)o=C[y+g],s=C[y+4+g],c=C[y+S+g],l=C[y+S+4+g],_=o*(1-m)*(1-h)+s*m*(1-h)+c*h*(1-m)+l*m*h,T[v++]=_;return w},hermiteFastResize:function(e,t,n,o,s){for(var l=this.rcpScaleX,u=this.rcpScaleY,d=c(l/2),f=c(u/2),p=e.imageData.data,m=e.ctx.createImageData(o,s),h=m.data,g=0;g<s;g++)for(var _=0;_<o;_++){for(var v=(_+g*o)*4,y=0,b=0,x=0,S=0,C=0,w=0,T=0,E=(g+.5)*u,D=r(g*u);D<(g+1)*u;D++)for(var O=a(E-(D+.5))/f,k=(_+.5)*l,A=O*O,j=r(_*l);j<(_+1)*l;j++){var M=a(k-(j+.5))/d,N=i(A+M*M);N>1&&N<-1||(y=2*N*N*N-3*N*N+1,y>0&&(M=4*(j+D*t),T+=y*p[M+3],x+=y,p[M+3]<255&&(y=y*p[M+3]/250),S+=y*p[M],C+=y*p[M+1],w+=y*p[M+2],b+=y))}h[v]=S/b,h[v+1]=C/b,h[v+2]=w/b,h[v+3]=T/x}return m},toObject:function(){return{type:this.type,scaleX:this.scaleX,scaleY:this.scaleY,resizeType:this.resizeType,lanczosLobes:this.lanczosLobes}}}),t.Image.filters.Resize.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Contrast=r(n.BaseFilter,{type:`Contrast`,fragmentSource:`precision highp float;
|
|
394
|
+
uniform sampler2D uTexture;
|
|
395
|
+
uniform float uContrast;
|
|
396
|
+
varying vec2 vTexCoord;
|
|
397
|
+
void main() {
|
|
398
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
399
|
+
float contrastF = 1.015 * (uContrast + 1.0) / (1.0 * (1.015 - uContrast));
|
|
400
|
+
color.rgb = contrastF * (color.rgb - 0.5) + 0.5;
|
|
401
|
+
gl_FragColor = color;
|
|
402
|
+
}`,contrast:0,mainParameter:`contrast`,applyTo2d:function(e){if(this.contrast!==0){var t=e.imageData,n,r,i=t.data,r=i.length,a=Math.floor(this.contrast*255),o=259*(a+255)/(255*(259-a));for(n=0;n<r;n+=4)i[n]=o*(i[n]-128)+128,i[n+1]=o*(i[n+1]-128)+128,i[n+2]=o*(i[n+2]-128)+128}},getUniformLocations:function(e,t){return{uContrast:e.getUniformLocation(t,`uContrast`)}},sendUniformData:function(e,t){e.uniform1f(t.uContrast,this.contrast)}}),t.Image.filters.Contrast.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Saturation=r(n.BaseFilter,{type:`Saturation`,fragmentSource:`precision highp float;
|
|
403
|
+
uniform sampler2D uTexture;
|
|
404
|
+
uniform float uSaturation;
|
|
405
|
+
varying vec2 vTexCoord;
|
|
406
|
+
void main() {
|
|
407
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
408
|
+
float rgMax = max(color.r, color.g);
|
|
409
|
+
float rgbMax = max(rgMax, color.b);
|
|
410
|
+
color.r += rgbMax != color.r ? (rgbMax - color.r) * uSaturation : 0.00;
|
|
411
|
+
color.g += rgbMax != color.g ? (rgbMax - color.g) * uSaturation : 0.00;
|
|
412
|
+
color.b += rgbMax != color.b ? (rgbMax - color.b) * uSaturation : 0.00;
|
|
413
|
+
gl_FragColor = color;
|
|
414
|
+
}`,saturation:0,mainParameter:`saturation`,applyTo2d:function(e){if(this.saturation!==0){var t=e.imageData.data,n=t.length,r=-this.saturation,i,a;for(i=0;i<n;i+=4)a=Math.max(t[i],t[i+1],t[i+2]),t[i]+=a===t[i]?0:(a-t[i])*r,t[i+1]+=a===t[i+1]?0:(a-t[i+1])*r,t[i+2]+=a===t[i+2]?0:(a-t[i+2])*r}},getUniformLocations:function(e,t){return{uSaturation:e.getUniformLocation(t,`uSaturation`)}},sendUniformData:function(e,t){e.uniform1f(t.uSaturation,-this.saturation)}}),t.Image.filters.Saturation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Vibrance=r(n.BaseFilter,{type:`Vibrance`,fragmentSource:`precision highp float;
|
|
415
|
+
uniform sampler2D uTexture;
|
|
416
|
+
uniform float uVibrance;
|
|
417
|
+
varying vec2 vTexCoord;
|
|
418
|
+
void main() {
|
|
419
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
420
|
+
float max = max(color.r, max(color.g, color.b));
|
|
421
|
+
float avg = (color.r + color.g + color.b) / 3.0;
|
|
422
|
+
float amt = (abs(max - avg) * 2.0) * uVibrance;
|
|
423
|
+
color.r += max != color.r ? (max - color.r) * amt : 0.00;
|
|
424
|
+
color.g += max != color.g ? (max - color.g) * amt : 0.00;
|
|
425
|
+
color.b += max != color.b ? (max - color.b) * amt : 0.00;
|
|
426
|
+
gl_FragColor = color;
|
|
427
|
+
}`,vibrance:0,mainParameter:`vibrance`,applyTo2d:function(e){if(this.vibrance!==0){var t=e.imageData.data,n=t.length,r=-this.vibrance,i,a,o,s;for(i=0;i<n;i+=4)a=Math.max(t[i],t[i+1],t[i+2]),o=(t[i]+t[i+1]+t[i+2])/3,s=Math.abs(a-o)*2/255*r,t[i]+=a===t[i]?0:(a-t[i])*s,t[i+1]+=a===t[i+1]?0:(a-t[i+1])*s,t[i+2]+=a===t[i+2]?0:(a-t[i+2])*s}},getUniformLocations:function(e,t){return{uVibrance:e.getUniformLocation(t,`uVibrance`)}},sendUniformData:function(e,t){e.uniform1f(t.uVibrance,-this.vibrance)}}),t.Image.filters.Vibrance.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Blur=r(n.BaseFilter,{type:`Blur`,fragmentSource:`precision highp float;
|
|
428
|
+
uniform sampler2D uTexture;
|
|
429
|
+
uniform vec2 uDelta;
|
|
430
|
+
varying vec2 vTexCoord;
|
|
431
|
+
const float nSamples = 15.0;
|
|
432
|
+
vec3 v3offset = vec3(12.9898, 78.233, 151.7182);
|
|
433
|
+
float random(vec3 scale) {
|
|
434
|
+
return fract(sin(dot(gl_FragCoord.xyz, scale)) * 43758.5453);
|
|
435
|
+
}
|
|
436
|
+
void main() {
|
|
437
|
+
vec4 color = vec4(0.0);
|
|
438
|
+
float total = 0.0;
|
|
439
|
+
float offset = random(v3offset);
|
|
440
|
+
for (float t = -nSamples; t <= nSamples; t++) {
|
|
441
|
+
float percent = (t + offset - 0.5) / nSamples;
|
|
442
|
+
float weight = 1.0 - abs(percent);
|
|
443
|
+
color += texture2D(uTexture, vTexCoord + uDelta * percent) * weight;
|
|
444
|
+
total += weight;
|
|
445
|
+
}
|
|
446
|
+
gl_FragColor = color / total;
|
|
447
|
+
}`,blur:0,mainParameter:`blur`,applyTo:function(e){e.webgl?(this.aspectRatio=e.sourceWidth/e.sourceHeight,e.passes++,this._setupFrameBuffer(e),this.horizontal=!0,this.applyToWebGL(e),this._swapTextures(e),this._setupFrameBuffer(e),this.horizontal=!1,this.applyToWebGL(e),this._swapTextures(e)):this.applyTo2d(e)},applyTo2d:function(e){e.imageData=this.simpleBlur(e)},simpleBlur:function(e){var n=e.filterBackend.resources,r,i,a=e.imageData.width,o=e.imageData.height;n.blurLayer1||(n.blurLayer1=t.util.createCanvasElement(),n.blurLayer2=t.util.createCanvasElement()),r=n.blurLayer1,i=n.blurLayer2,(r.width!==a||r.height!==o)&&(i.width=r.width=a,i.height=r.height=o);var s=r.getContext(`2d`),c=i.getContext(`2d`),l=15,u,d,f,p,m=this.blur*.06*.5;for(s.putImageData(e.imageData,0,0),c.clearRect(0,0,a,o),p=-l;p<=l;p++)u=(Math.random()-.5)/4,d=p/l,f=m*d*a+u,c.globalAlpha=1-Math.abs(d),c.drawImage(r,f,u),s.drawImage(i,0,0),c.globalAlpha=1,c.clearRect(0,0,i.width,i.height);for(p=-l;p<=l;p++)u=(Math.random()-.5)/4,d=p/l,f=m*d*o+u,c.globalAlpha=1-Math.abs(d),c.drawImage(r,u,f),s.drawImage(i,0,0),c.globalAlpha=1,c.clearRect(0,0,i.width,i.height);e.ctx.drawImage(r,0,0);var h=e.ctx.getImageData(0,0,r.width,r.height);return s.globalAlpha=1,s.clearRect(0,0,r.width,r.height),h},getUniformLocations:function(e,t){return{delta:e.getUniformLocation(t,`uDelta`)}},sendUniformData:function(e,t){var n=this.chooseRightDelta();e.uniform2fv(t.delta,n)},chooseRightDelta:function(){var e=1,t=[0,0],n;return this.horizontal?this.aspectRatio>1&&(e=1/this.aspectRatio):this.aspectRatio<1&&(e=this.aspectRatio),n=e*this.blur*.12,this.horizontal?t[0]=n:t[1]=n,t}}),n.Blur.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Gamma=r(n.BaseFilter,{type:`Gamma`,fragmentSource:`precision highp float;
|
|
448
|
+
uniform sampler2D uTexture;
|
|
449
|
+
uniform vec3 uGamma;
|
|
450
|
+
varying vec2 vTexCoord;
|
|
451
|
+
void main() {
|
|
452
|
+
vec4 color = texture2D(uTexture, vTexCoord);
|
|
453
|
+
vec3 correction = (1.0 / uGamma);
|
|
454
|
+
color.r = pow(color.r, correction.r);
|
|
455
|
+
color.g = pow(color.g, correction.g);
|
|
456
|
+
color.b = pow(color.b, correction.b);
|
|
457
|
+
gl_FragColor = color;
|
|
458
|
+
gl_FragColor.rgb *= color.a;
|
|
459
|
+
}`,gamma:[1,1,1],mainParameter:`gamma`,initialize:function(e){this.gamma=[1,1,1],n.BaseFilter.prototype.initialize.call(this,e)},applyTo2d:function(e){var t=e.imageData.data,n=this.gamma,r=t.length,i=1/n[0],a=1/n[1],o=1/n[2],s;for(this.rVals||(this.rVals=new Uint8Array(256),this.gVals=new Uint8Array(256),this.bVals=new Uint8Array(256)),s=0,r=256;s<r;s++)this.rVals[s]=(s/255)**i*255,this.gVals[s]=(s/255)**a*255,this.bVals[s]=(s/255)**o*255;for(s=0,r=t.length;s<r;s+=4)t[s]=this.rVals[t[s]],t[s+1]=this.gVals[t[s+1]],t[s+2]=this.bVals[t[s+2]]},getUniformLocations:function(e,t){return{uGamma:e.getUniformLocation(t,`uGamma`)}},sendUniformData:function(e,t){e.uniform3fv(t.uGamma,this.gamma)}}),t.Image.filters.Gamma.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.Composed=r(n.BaseFilter,{type:`Composed`,subFilters:[],initialize:function(e){this.callSuper(`initialize`,e),this.subFilters=this.subFilters.slice(0)},applyTo:function(e){e.passes+=this.subFilters.length-1,this.subFilters.forEach(function(t){t.applyTo(e)})},toObject:function(){return t.util.object.extend(this.callSuper(`toObject`),{subFilters:this.subFilters.map(function(e){return e.toObject()})})},isNeutralState:function(){return!this.subFilters.some(function(e){return!e.isNeutralState()})}}),t.Image.filters.Composed.fromObject=function(e,n){var r=(e.subFilters||[]).map(function(e){return new t.Image.filters[e.type](e)}),i=new t.Image.filters.Composed({subFilters:r});return n&&n(i),i}}(e),function(e){var t=e.fabric||={},n=t.Image.filters,r=t.util.createClass;n.HueRotation=r(n.ColorMatrix,{type:`HueRotation`,rotation:0,mainParameter:`rotation`,calculateMatrix:function(){var e=this.rotation*Math.PI,n=t.util.cos(e),r=t.util.sin(e),i=1/3,a=Math.sqrt(i)*r,o=1-n;this.matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],this.matrix[0]=n+o/3,this.matrix[1]=i*o-a,this.matrix[2]=i*o+a,this.matrix[5]=i*o+a,this.matrix[6]=n+i*o,this.matrix[7]=i*o-a,this.matrix[10]=i*o-a,this.matrix[11]=i*o+a,this.matrix[12]=n+i*o},isNeutralState:function(e){return this.calculateMatrix(),n.BaseFilter.prototype.isNeutralState.call(this,e)},applyTo:function(e){this.calculateMatrix(),n.BaseFilter.prototype.applyTo.call(this,e)}}),t.Image.filters.HueRotation.fromObject=t.Image.filters.BaseFilter.fromObject}(e),function(e){var t=e.fabric||={},n=t.util.object.clone;if(t.Text){t.warn(`fabric.Text is already defined`);return}var r=`fontFamily fontWeight fontSize text underline overline linethrough textAlign fontStyle lineHeight textBackgroundColor charSpacing styles direction path pathStartOffset pathSide pathAlign`.split(` `);t.Text=t.util.createClass(t.Object,{_dimensionAffectingProps:[`fontSize`,`fontWeight`,`fontFamily`,`fontStyle`,`lineHeight`,`text`,`charSpacing`,`textAlign`,`styles`,`path`,`pathStartOffset`,`pathSide`,`pathAlign`],_reNewline:/\r?\n/,_reSpacesAndTabs:/[ \t\r]/g,_reSpaceAndTab:/[ \t\r]/,_reWords:/\S+/g,type:`text`,fontSize:40,fontWeight:`normal`,fontFamily:`Times New Roman`,underline:!1,overline:!1,linethrough:!1,textAlign:`left`,fontStyle:`normal`,lineHeight:1.16,superscript:{size:.6,baseline:-.35},subscript:{size:.6,baseline:.11},textBackgroundColor:``,stateProperties:t.Object.prototype.stateProperties.concat(r),cacheProperties:t.Object.prototype.cacheProperties.concat(r),stroke:null,shadow:null,path:null,pathStartOffset:0,pathSide:`left`,pathAlign:`baseline`,_fontSizeFraction:.222,offsets:{underline:.1,linethrough:-.315,overline:-.88},_fontSizeMult:1.13,charSpacing:0,styles:null,_measuringContext:null,deltaY:0,direction:`ltr`,_styleProperties:[`stroke`,`strokeWidth`,`fill`,`fontFamily`,`fontSize`,`fontWeight`,`fontStyle`,`underline`,`overline`,`linethrough`,`deltaY`,`textBackgroundColor`],__charBounds:[],CACHE_FONT_SIZE:400,MIN_TEXT_WIDTH:2,initialize:function(e,t){this.styles=t&&t.styles||{},this.text=e,this.__skipDimension=!0,this.callSuper(`initialize`,t),this.path&&this.setPathInfo(),this.__skipDimension=!1,this.initDimensions(),this.setCoords(),this.setupState({propertySet:`_dimensionAffectingProps`})},setPathInfo:function(){var e=this.path;e&&(e.segmentsInfo=t.util.getPathSegmentsInfo(e.path))},getMeasuringContext:function(){return t._measuringContext||=this.canvas&&this.canvas.contextCache||t.util.createCanvasElement().getContext(`2d`),t._measuringContext},_splitText:function(){var e=this._splitTextIntoLines(this.text);return this.textLines=e.lines,this._textLines=e.graphemeLines,this._unwrappedTextLines=e._unwrappedLines,this._text=e.graphemeText,e},initDimensions:function(){this.__skipDimension||(this._splitText(),this._clearCache(),this.path?(this.width=this.path.width,this.height=this.path.height):(this.width=this.calcTextWidth()||this.cursorWidth||this.MIN_TEXT_WIDTH,this.height=this.calcTextHeight()),this.textAlign.indexOf(`justify`)!==-1&&this.enlargeSpaces(),this.saveState({propertySet:`_dimensionAffectingProps`}))},enlargeSpaces:function(){for(var e,t,n,r,i,a,o,s=0,c=this._textLines.length;s<c;s++)if(!(this.textAlign!==`justify`&&(s===c-1||this.isEndOfWrapping(s)))&&(r=0,i=this._textLines[s],t=this.getLineWidth(s),t<this.width&&(o=this.textLines[s].match(this._reSpacesAndTabs)))){n=o.length,e=(this.width-t)/n;for(var l=0,u=i.length;l<=u;l++)a=this.__charBounds[s][l],this._reSpaceAndTab.test(i[l])?(a.width+=e,a.kernedWidth+=e,a.left+=r,r+=e):a.left+=r}},isEndOfWrapping:function(e){return e===this._textLines.length-1},missingNewlineOffset:function(){return 1},toString:function(){return`#<fabric.Text (`+this.complexity()+`): { "text": "`+this.text+`", "fontFamily": "`+this.fontFamily+`" }>`},_getCacheCanvasDimensions:function(){var e=this.callSuper(`_getCacheCanvasDimensions`),t=this.fontSize;return e.width+=t*e.zoomX,e.height+=t*e.zoomY,e},_render:function(e){var t=this.path;t&&!t.isNotVisible()&&t._render(e),this._setTextStyles(e),this._renderTextLinesBackground(e),this._renderTextDecoration(e,`underline`),this._renderText(e),this._renderTextDecoration(e,`overline`),this._renderTextDecoration(e,`linethrough`)},_renderText:function(e){this.paintFirst===`stroke`?(this._renderTextStroke(e),this._renderTextFill(e)):(this._renderTextFill(e),this._renderTextStroke(e))},_setTextStyles:function(e,t,n){if(e.textBaseline=`alphabetical`,this.path)switch(this.pathAlign){case`center`:e.textBaseline=`middle`;break;case`ascender`:e.textBaseline=`top`;break;case`descender`:e.textBaseline=`bottom`;break}e.font=this._getFontDeclaration(t,n)},calcTextWidth:function(){for(var e=this.getLineWidth(0),t=1,n=this._textLines.length;t<n;t++){var r=this.getLineWidth(t);r>e&&(e=r)}return e},_renderTextLine:function(e,t,n,r,i,a){this._renderChars(e,t,n,r,i,a)},_renderTextLinesBackground:function(e){if(!(!this.textBackgroundColor&&!this.styleHas(`textBackgroundColor`))){for(var t,n,r=e.fillStyle,i,a,o=this._getLeftOffset(),s=this._getTopOffset(),c=0,l=0,u,d,f=this.path,p,m=0,h=this._textLines.length;m<h;m++){if(t=this.getHeightOfLine(m),!this.textBackgroundColor&&!this.styleHas(`textBackgroundColor`,m)){s+=t;continue}i=this._textLines[m],n=this._getLineLeftOffset(m),l=0,c=0,a=this.getValueOfPropertyAt(m,0,`textBackgroundColor`);for(var g=0,_=i.length;g<_;g++)u=this.__charBounds[m][g],d=this.getValueOfPropertyAt(m,g,`textBackgroundColor`),f?(e.save(),e.translate(u.renderLeft,u.renderTop),e.rotate(u.angle),e.fillStyle=d,d&&e.fillRect(-u.width/2,-t/this.lineHeight*(1-this._fontSizeFraction),u.width,t/this.lineHeight),e.restore()):d===a?l+=u.kernedWidth:(p=o+n+c,this.direction===`rtl`&&(p=this.width-p-l),e.fillStyle=a,a&&e.fillRect(p,s,l,t/this.lineHeight),c=u.left,l=u.width,a=d);d&&!f&&(p=o+n+c,this.direction===`rtl`&&(p=this.width-p-l),e.fillStyle=d,e.fillRect(p,s,l,t/this.lineHeight)),s+=t}e.fillStyle=r,this._removeShadow(e)}},getFontCache:function(e){var n=e.fontFamily.toLowerCase();t.charWidthsCache[n]||(t.charWidthsCache[n]={});var r=t.charWidthsCache[n],i=e.fontStyle.toLowerCase()+`_`+(e.fontWeight+``).toLowerCase();return r[i]||(r[i]={}),r[i]},_measureChar:function(e,t,n,r){var i=this.getFontCache(t),a=this._getFontDeclaration(t),o=this._getFontDeclaration(r),s=n+e,c=a===o,l,u,d,f=t.fontSize/this.CACHE_FONT_SIZE,p;if(n&&i[n]!==void 0&&(d=i[n]),i[e]!==void 0&&(p=l=i[e]),c&&i[s]!==void 0&&(u=i[s],p=u-d),l===void 0||d===void 0||u===void 0){var m=this.getMeasuringContext();this._setTextStyles(m,t,!0)}return l===void 0&&(p=l=m.measureText(e).width,i[e]=l),d===void 0&&c&&n&&(d=m.measureText(n).width,i[n]=d),c&&u===void 0&&(u=m.measureText(s).width,i[s]=u,p=u-d),{width:l*f,kernedWidth:p*f}},getHeightOfChar:function(e,t){return this.getValueOfPropertyAt(e,t,`fontSize`)},measureLine:function(e){var t=this._measureLine(e);return this.charSpacing!==0&&(t.width-=this._getWidthOfCharSpacing()),t.width<0&&(t.width=0),t},_measureLine:function(e){var n=0,r,i,a=this._textLines[e],o,s,c=0,l=Array(a.length),u=0,d,f,p=this.path,m=this.pathSide===`right`;for(this.__charBounds[e]=l,r=0;r<a.length;r++)i=a[r],s=this._getGraphemeBox(i,e,r,o),l[r]=s,n+=s.kernedWidth,o=i;if(l[r]={left:s?s.left+s.width:0,width:0,kernedWidth:0,height:this.fontSize},p){switch(f=p.segmentsInfo[p.segmentsInfo.length-1].length,d=t.util.getPointOnPath(p.path,0,p.segmentsInfo),d.x+=p.pathOffset.x,d.y+=p.pathOffset.y,this.textAlign){case`left`:u=m?f-n:0;break;case`center`:u=(f-n)/2;break;case`right`:u=m?0:f-n;break}for(u+=this.pathStartOffset*(m?-1:1),r=m?a.length-1:0;m?r>=0:r<a.length;m?r--:r++)s=l[r],u>f?u%=f:u<0&&(u+=f),this._setGraphemeOnPath(u,s,d),u+=s.kernedWidth}return{width:n,numOfSpaces:c}},_setGraphemeOnPath:function(e,n,r){var i=e+n.kernedWidth/2,a=this.path,o=t.util.getPointOnPath(a.path,i,a.segmentsInfo);n.renderLeft=o.x-r.x,n.renderTop=o.y-r.y,n.angle=o.angle+(this.pathSide===`right`?Math.PI:0)},_getGraphemeBox:function(e,t,n,r,i){var a=this.getCompleteStyleDeclaration(t,n),o=r?this.getCompleteStyleDeclaration(t,n-1):{},s=this._measureChar(e,a,r,o),c=s.kernedWidth,l=s.width,u;this.charSpacing!==0&&(u=this._getWidthOfCharSpacing(),l+=u,c+=u);var d={width:l,left:0,height:a.fontSize,kernedWidth:c,deltaY:a.deltaY};if(n>0&&!i){var f=this.__charBounds[t][n-1];d.left=f.left+f.width+s.kernedWidth-s.width}return d},getHeightOfLine:function(e){if(this.__lineHeights[e])return this.__lineHeights[e];for(var t=this._textLines[e],n=this.getHeightOfChar(e,0),r=1,i=t.length;r<i;r++)n=Math.max(this.getHeightOfChar(e,r),n);return this.__lineHeights[e]=n*this.lineHeight*this._fontSizeMult},calcTextHeight:function(){for(var e,t=0,n=0,r=this._textLines.length;n<r;n++)e=this.getHeightOfLine(n),t+=n===r-1?e/this.lineHeight:e;return t},_getLeftOffset:function(){return this.direction===`ltr`?-this.width/2:this.width/2},_getTopOffset:function(){return-this.height/2},_renderTextCommon:function(e,t){e.save();for(var n=0,r=this._getLeftOffset(),i=this._getTopOffset(),a=0,o=this._textLines.length;a<o;a++){var s=this.getHeightOfLine(a),c=s/this.lineHeight,l=this._getLineLeftOffset(a);this._renderTextLine(t,e,this._textLines[a],r+l,i+n+c,a),n+=s}e.restore()},_renderTextFill:function(e){!this.fill&&!this.styleHas(`fill`)||this._renderTextCommon(e,`fillText`)},_renderTextStroke:function(e){(!this.stroke||this.strokeWidth===0)&&this.isEmptyStyles()||(this.shadow&&!this.shadow.affectStroke&&this._removeShadow(e),e.save(),this._setLineDash(e,this.strokeDashArray),e.beginPath(),this._renderTextCommon(e,`strokeText`),e.closePath(),e.restore())},_renderChars:function(e,n,r,i,a,o){var s=this.getHeightOfLine(o),c=this.textAlign.indexOf(`justify`)!==-1,l,u,d=``,f,p=0,m,h=this.path,g=!c&&this.charSpacing===0&&this.isEmptyStyles(o)&&!h,_=this.direction===`ltr`,v=this.direction===`ltr`?1:-1,y,b=n.canvas.getAttribute(`dir`);if(n.save(),b!==this.direction&&(n.canvas.setAttribute(`dir`,_?`ltr`:`rtl`),n.direction=_?`ltr`:`rtl`,n.textAlign=_?`left`:`right`),a-=s*this._fontSizeFraction/this.lineHeight,g){this._renderChar(e,n,o,0,r.join(``),i,a,s),n.restore();return}for(var x=0,S=r.length-1;x<=S;x++)m=x===S||this.charSpacing||h,d+=r[x],f=this.__charBounds[o][x],p===0?(i+=v*(f.kernedWidth-f.width),p+=f.width):p+=f.kernedWidth,c&&!m&&this._reSpaceAndTab.test(r[x])&&(m=!0),m||=(l||=this.getCompleteStyleDeclaration(o,x),u=this.getCompleteStyleDeclaration(o,x+1),t.util.hasStyleChanged(l,u,!1)),m&&(h?(n.save(),n.translate(f.renderLeft,f.renderTop),n.rotate(f.angle),this._renderChar(e,n,o,x,d,-p/2,0,s),n.restore()):(y=i,this._renderChar(e,n,o,x,d,y,a,s)),d=``,l=u,i+=v*p,p=0);n.restore()},_applyPatternGradientTransformText:function(e){var n=t.util.createCanvasElement(),r,i=this.width+this.strokeWidth,a=this.height+this.strokeWidth;return n.width=i,n.height=a,r=n.getContext(`2d`),r.beginPath(),r.moveTo(0,0),r.lineTo(i,0),r.lineTo(i,a),r.lineTo(0,a),r.closePath(),r.translate(i/2,a/2),r.fillStyle=e.toLive(r),this._applyPatternGradientTransform(r,e),r.fill(),r.createPattern(n,`no-repeat`)},handleFiller:function(e,t,n){var r,i;return n.toLive?n.gradientUnits===`percentage`||n.gradientTransform||n.patternTransform?(r=-this.width/2,i=-this.height/2,e.translate(r,i),e[t]=this._applyPatternGradientTransformText(n),{offsetX:r,offsetY:i}):(e[t]=n.toLive(e,this),this._applyPatternGradientTransform(e,n)):(e[t]=n,{offsetX:0,offsetY:0})},_setStrokeStyles:function(e,t){return e.lineWidth=t.strokeWidth,e.lineCap=this.strokeLineCap,e.lineDashOffset=this.strokeDashOffset,e.lineJoin=this.strokeLineJoin,e.miterLimit=this.strokeMiterLimit,this.handleFiller(e,`strokeStyle`,t.stroke)},_setFillStyles:function(e,t){return this.handleFiller(e,`fillStyle`,t.fill)},_renderChar:function(e,t,n,r,i,a,o){var s=this._getStyleDeclaration(n,r),c=this.getCompleteStyleDeclaration(n,r),l=e===`fillText`&&c.fill,u=e===`strokeText`&&c.stroke&&c.strokeWidth,d,f;!u&&!l||(t.save(),l&&(d=this._setFillStyles(t,c)),u&&(f=this._setStrokeStyles(t,c)),t.font=this._getFontDeclaration(c),s&&s.textBackgroundColor&&this._removeShadow(t),s&&s.deltaY&&(o+=s.deltaY),l&&t.fillText(i,a-d.offsetX,o-d.offsetY),u&&t.strokeText(i,a-f.offsetX,o-f.offsetY),t.restore())},setSuperscript:function(e,t){return this._setScript(e,t,this.superscript)},setSubscript:function(e,t){return this._setScript(e,t,this.subscript)},_setScript:function(e,t,n){var r=this.get2DCursorLocation(e,!0),i=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,`fontSize`),a=this.getValueOfPropertyAt(r.lineIndex,r.charIndex,`deltaY`),o={fontSize:i*n.size,deltaY:a+i*n.baseline};return this.setSelectionStyles(o,e,t),this},_getLineLeftOffset:function(e){var t=this.getLineWidth(e),n=this.width-t,r=this.textAlign,i=this.direction,a,o=0,a=this.isEndOfWrapping(e);return r===`justify`||r===`justify-center`&&!a||r===`justify-right`&&!a||r===`justify-left`&&!a?0:(r===`center`&&(o=n/2),r===`right`&&(o=n),r===`justify-center`&&(o=n/2),r===`justify-right`&&(o=n),i===`rtl`&&(o-=n),o)},_clearCache:function(){this.__lineWidths=[],this.__lineHeights=[],this.__charBounds=[]},_shouldClearDimensionCache:function(){var e=this._forceClearCache;return e||=this.hasStateChanged(`_dimensionAffectingProps`),e&&(this.dirty=!0,this._forceClearCache=!1),e},getLineWidth:function(e){if(this.__lineWidths[e]!==void 0)return this.__lineWidths[e];var t=this.measureLine(e).width;return this.__lineWidths[e]=t,t},_getWidthOfCharSpacing:function(){return this.charSpacing===0?0:this.fontSize*this.charSpacing/1e3},getValueOfPropertyAt:function(e,t,n){var r=this._getStyleDeclaration(e,t);return r&&typeof r[n]<`u`?r[n]:this[n]},_renderTextDecoration:function(e,t){if(!(!this[t]&&!this.styleHas(t))){for(var n,r,i,a,o,s,c,l,u=this._getLeftOffset(),d=this._getTopOffset(),f,p,m,h,g,_,v,y,b=this.path,x=this._getWidthOfCharSpacing(),S=this.offsets[t],C=0,w=this._textLines.length;C<w;C++){if(n=this.getHeightOfLine(C),!this[t]&&!this.styleHas(t,C)){d+=n;continue}c=this._textLines[C],_=n/this.lineHeight,a=this._getLineLeftOffset(C),p=0,m=0,l=this.getValueOfPropertyAt(C,0,t),y=this.getValueOfPropertyAt(C,0,`fill`),f=d+_*(1-this._fontSizeFraction),r=this.getHeightOfChar(C,0),o=this.getValueOfPropertyAt(C,0,`deltaY`);for(var T=0,E=c.length;T<E;T++)if(h=this.__charBounds[C][T],g=this.getValueOfPropertyAt(C,T,t),v=this.getValueOfPropertyAt(C,T,`fill`),i=this.getHeightOfChar(C,T),s=this.getValueOfPropertyAt(C,T,`deltaY`),b&&g&&v)e.save(),e.fillStyle=y,e.translate(h.renderLeft,h.renderTop),e.rotate(h.angle),e.fillRect(-h.kernedWidth/2,S*i+s,h.kernedWidth,this.fontSize/15),e.restore();else if((g!==l||v!==y||i!==r||s!==o)&&m>0){var D=u+a+p;this.direction===`rtl`&&(D=this.width-D-m),l&&y&&(e.fillStyle=y,e.fillRect(D,f+S*r+o,m,this.fontSize/15)),p=h.left,m=h.width,l=g,y=v,r=i,o=s}else m+=h.kernedWidth;var D=u+a+p;this.direction===`rtl`&&(D=this.width-D-m),e.fillStyle=v,g&&v&&e.fillRect(D,f+S*r+o,m-x,this.fontSize/15),d+=n}this._removeShadow(e)}},_getFontDeclaration:function(e,n){var r=e||this,i=this.fontFamily,a=t.Text.genericFonts.indexOf(i.toLowerCase())>-1,o=i===void 0||i.indexOf(`'`)>-1||i.indexOf(`,`)>-1||i.indexOf(`"`)>-1||a?r.fontFamily:`"`+r.fontFamily+`"`;return[t.isLikelyNode?r.fontWeight:r.fontStyle,t.isLikelyNode?r.fontStyle:r.fontWeight,n?this.CACHE_FONT_SIZE+`px`:r.fontSize+`px`,o].join(` `)},render:function(e){this.visible&&(this.canvas&&this.canvas.skipOffscreen&&!this.group&&!this.isOnScreen()||(this._shouldClearDimensionCache()&&this.initDimensions(),this.callSuper(`render`,e)))},_splitTextIntoLines:function(e){for(var n=e.split(this._reNewline),r=Array(n.length),i=[`
|
|
460
|
+
`],a=[],o=0;o<n.length;o++)r[o]=t.util.string.graphemeSplit(n[o]),a=a.concat(r[o],i);return a.pop(),{_unwrappedLines:r,lines:n,graphemeText:a,graphemeLines:r}},toObject:function(e){var n=r.concat(e),i=this.callSuper(`toObject`,n);return i.styles=t.util.stylesToArray(this.styles,this.text),i.path&&=this.path.toObject(),i},set:function(e,t){this.callSuper(`set`,e,t);var n=!1,r=!1;if(typeof e==`object`)for(var i in e)i===`path`&&this.setPathInfo(),n||=this._dimensionAffectingProps.indexOf(i)!==-1,r||=i===`path`;else n=this._dimensionAffectingProps.indexOf(e)!==-1,r=e===`path`;return r&&this.setPathInfo(),n&&(this.initDimensions(),this.setCoords()),this},complexity:function(){return 1}}),t.Text.ATTRIBUTE_NAMES=t.SHARED_ATTRIBUTES.concat(`x y dx dy font-family font-style font-weight font-size letter-spacing text-decoration text-anchor`.split(` `)),t.Text.DEFAULT_SVG_FONT_SIZE=16,t.Text.fromElement=function(e,r,i){if(!e)return r(null);var a=t.parseAttributes(e,t.Text.ATTRIBUTE_NAMES),o=a.textAnchor||`left`;if(i=t.util.object.extend(i?n(i):{},a),i.top=i.top||0,i.left=i.left||0,a.textDecoration){var s=a.textDecoration;s.indexOf(`underline`)!==-1&&(i.underline=!0),s.indexOf(`overline`)!==-1&&(i.overline=!0),s.indexOf(`line-through`)!==-1&&(i.linethrough=!0),delete i.textDecoration}`dx`in a&&(i.left+=a.dx),`dy`in a&&(i.top+=a.dy),`fontSize`in i||(i.fontSize=t.Text.DEFAULT_SVG_FONT_SIZE);var c=``;`textContent`in e?c=e.textContent:`firstChild`in e&&e.firstChild!==null&&`data`in e.firstChild&&e.firstChild.data!==null&&(c=e.firstChild.data),c=c.replace(/^\s+|\s+$|\n+/g,``).replace(/\s+/g,` `);var l=i.strokeWidth;i.strokeWidth=0;var u=new t.Text(c,i),d=u.getScaledHeight()/u.height,f=((u.height+u.strokeWidth)*u.lineHeight-u.height)*d,p=u.getScaledHeight()+f,m=0;o===`center`&&(m=u.getScaledWidth()/2),o===`right`&&(m=u.getScaledWidth()),u.set({left:u.left-m,top:u.top-(p-u.fontSize*(.07+u._fontSizeFraction))/u.lineHeight,strokeWidth:typeof l<`u`?l:1}),r(u)},t.Text.fromObject=function(e,r){var i=n(e),a=e.path;return delete i.path,t.Object._fromObject(`Text`,i,function(n){n.styles=t.util.stylesFromArray(e.styles,e.text),a?t.Object._fromObject(`Path`,a,function(e){n.set(`path`,e),r(n)},`path`):r(n)},`text`)},t.Text.genericFonts=[`sans-serif`,`serif`,`cursive`,`fantasy`,`monospace`],t.util.createAccessors&&t.util.createAccessors(t.Text)}(e),function(){t.util.object.extend(t.Text.prototype,{isEmptyStyles:function(e){if(!this.styles||typeof e<`u`&&!this.styles[e])return!0;var t=typeof e>`u`?this.styles:{line:this.styles[e]};for(var n in t)for(var r in t[n])for(var i in t[n][r])return!1;return!0},styleHas:function(e,t){if(!this.styles||!e||e===``||typeof t<`u`&&!this.styles[t])return!1;var n=typeof t>`u`?this.styles:{0:this.styles[t]};for(var r in n)for(var i in n[r])if(typeof n[r][i][e]<`u`)return!0;return!1},cleanStyle:function(e){if(!this.styles||!e||e===``)return!1;var t=this.styles,n=0,r,i,a=!0,o=0,s;for(var c in t){for(var l in r=0,t[c]){var s=t[c][l],u=s.hasOwnProperty(e);n++,u?(i?s[e]!==i&&(a=!1):i=s[e],s[e]===this[e]&&delete s[e]):a=!1,Object.keys(s).length===0?delete t[c][l]:r++}r===0&&delete t[c]}for(var d=0;d<this._textLines.length;d++)o+=this._textLines[d].length;a&&n===o&&(this[e]=i,this.removeStyle(e))},removeStyle:function(e){if(!(!this.styles||!e||e===``)){var t=this.styles,n,r,i;for(r in t){for(i in n=t[r],n)delete n[i][e],Object.keys(n[i]).length===0&&delete n[i];Object.keys(n).length===0&&delete t[r]}}},_extendStyles:function(e,n){var r=this.get2DCursorLocation(e);this._getLineStyle(r.lineIndex)||this._setLineStyle(r.lineIndex),this._getStyleDeclaration(r.lineIndex,r.charIndex)||this._setStyleDeclaration(r.lineIndex,r.charIndex,{}),t.util.object.extend(this._getStyleDeclaration(r.lineIndex,r.charIndex),n)},get2DCursorLocation:function(e,t){typeof e>`u`&&(e=this.selectionStart);for(var n=t?this._unwrappedTextLines:this._textLines,r=n.length,i=0;i<r;i++){if(e<=n[i].length)return{lineIndex:i,charIndex:e};e-=n[i].length+this.missingNewlineOffset(i)}return{lineIndex:i-1,charIndex:n[i-1].length<e?n[i-1].length:e}},getSelectionStyles:function(e,t,n){typeof e>`u`&&(e=this.selectionStart||0),typeof t>`u`&&(t=this.selectionEnd||e);for(var r=[],i=e;i<t;i++)r.push(this.getStyleAtPosition(i,n));return r},getStyleAtPosition:function(e,t){var n=this.get2DCursorLocation(e);return(t?this.getCompleteStyleDeclaration(n.lineIndex,n.charIndex):this._getStyleDeclaration(n.lineIndex,n.charIndex))||{}},setSelectionStyles:function(e,t,n){typeof t>`u`&&(t=this.selectionStart||0),typeof n>`u`&&(n=this.selectionEnd||t);for(var r=t;r<n;r++)this._extendStyles(r,e);return this._forceClearCache=!0,this},_getStyleDeclaration:function(e,t){var n=this.styles&&this.styles[e];return n?n[t]:null},getCompleteStyleDeclaration:function(e,t){for(var n=this._getStyleDeclaration(e,t)||{},r={},i,a=0;a<this._styleProperties.length;a++)i=this._styleProperties[a],r[i]=typeof n[i]>`u`?this[i]:n[i];return r},_setStyleDeclaration:function(e,t,n){this.styles[e][t]=n},_deleteStyleDeclaration:function(e,t){delete this.styles[e][t]},_getLineStyle:function(e){return!!this.styles[e]},_setLineStyle:function(e){this.styles[e]={}},_deleteLineStyle:function(e){delete this.styles[e]}})}(),function(){function e(e){e.textDecoration&&(e.textDecoration.indexOf(`underline`)>-1&&(e.underline=!0),e.textDecoration.indexOf(`line-through`)>-1&&(e.linethrough=!0),e.textDecoration.indexOf(`overline`)>-1&&(e.overline=!0),delete e.textDecoration)}t.IText=t.util.createClass(t.Text,t.Observable,{type:`i-text`,selectionStart:0,selectionEnd:0,selectionColor:`rgba(17,119,255,0.3)`,isEditing:!1,editable:!0,editingBorderColor:`rgba(102,153,255,0.25)`,cursorWidth:2,cursorColor:``,cursorDelay:1e3,cursorDuration:600,caching:!0,hiddenTextareaContainer:null,_reSpace:/\s|\n/,_currentCursorOpacity:0,_selectionDirection:null,_abortCursorAnimation:!1,__widthOfSpace:[],inCompositionMode:!1,initialize:function(e,t){this.callSuper(`initialize`,e,t),this.initBehavior()},setSelectionStart:function(e){e=Math.max(e,0),this._updateAndFire(`selectionStart`,e)},setSelectionEnd:function(e){e=Math.min(e,this.text.length),this._updateAndFire(`selectionEnd`,e)},_updateAndFire:function(e,t){this[e]!==t&&(this._fireSelectionChanged(),this[e]=t),this._updateTextarea()},_fireSelectionChanged:function(){this.fire(`selection:changed`),this.canvas&&this.canvas.fire(`text:selection:changed`,{target:this})},initDimensions:function(){this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this.callSuper(`initDimensions`)},render:function(e){this.clearContextTop(),this.callSuper(`render`,e),this.cursorOffsetCache={},this.renderCursorOrSelection()},_render:function(e){this.callSuper(`_render`,e)},clearContextTop:function(e){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var t=this.canvas.contextTop,n=this.canvas.viewportTransform;t.save(),t.transform(n[0],n[1],n[2],n[3],n[4],n[5]),this.transform(t),this._clearTextArea(t),e||t.restore()}},renderCursorOrSelection:function(){if(!(!this.isEditing||!this.canvas||!this.canvas.contextTop)){var e=this._getCursorBoundaries(),t=this.canvas.contextTop;this.clearContextTop(!0),this.selectionStart===this.selectionEnd?this.renderCursor(e,t):this.renderSelection(e,t),t.restore()}},_clearTextArea:function(e){var t=this.width+4,n=this.height+4;e.clearRect(-t/2,-n/2,t,n)},_getCursorBoundaries:function(e){typeof e>`u`&&(e=this.selectionStart);var t=this._getLeftOffset(),n=this._getTopOffset(),r=this._getCursorBoundariesOffsets(e);return{left:t,top:n,leftOffset:r.left,topOffset:r.top}},_getCursorBoundariesOffsets:function(e){if(this.cursorOffsetCache&&`top`in this.cursorOffsetCache)return this.cursorOffsetCache;var t,n,r,i=0,a=0,o,s=this.get2DCursorLocation(e);r=s.charIndex,n=s.lineIndex;for(var c=0;c<n;c++)i+=this.getHeightOfLine(c);t=this._getLineLeftOffset(n);var l=this.__charBounds[n][r];return l&&(a=l.left),this.charSpacing!==0&&r===this._textLines[n].length&&(a-=this._getWidthOfCharSpacing()),o={top:i,left:t+(a>0?a:0)},this.direction===`rtl`&&(o.left*=-1),this.cursorOffsetCache=o,this.cursorOffsetCache},renderCursor:function(e,t){var n=this.get2DCursorLocation(),r=n.lineIndex,i=n.charIndex>0?n.charIndex-1:0,a=this.getValueOfPropertyAt(r,i,`fontSize`),o=this.scaleX*this.canvas.getZoom(),s=this.cursorWidth/o,c=e.topOffset,l=this.getValueOfPropertyAt(r,i,`deltaY`);c+=(1-this._fontSizeFraction)*this.getHeightOfLine(r)/this.lineHeight-a*(1-this._fontSizeFraction),this.inCompositionMode&&this.renderSelection(e,t),t.fillStyle=this.cursorColor||this.getValueOfPropertyAt(r,i,`fill`),t.globalAlpha=this.__isMousedown?1:this._currentCursorOpacity,t.fillRect(e.left+e.leftOffset-s/2,c+e.top+l,s,a)},renderSelection:function(e,t){for(var n=this.inCompositionMode?this.hiddenTextarea.selectionStart:this.selectionStart,r=this.inCompositionMode?this.hiddenTextarea.selectionEnd:this.selectionEnd,i=this.textAlign.indexOf(`justify`)!==-1,a=this.get2DCursorLocation(n),o=this.get2DCursorLocation(r),s=a.lineIndex,c=o.lineIndex,l=a.charIndex<0?0:a.charIndex,u=o.charIndex<0?0:o.charIndex,d=s;d<=c;d++){var f=this._getLineLeftOffset(d)||0,p=this.getHeightOfLine(d),m=0,h=0,g=0;if(d===s&&(h=this.__charBounds[s][l].left),d>=s&&d<c)g=i&&!this.isEndOfWrapping(d)?this.width:this.getLineWidth(d)||5;else if(d===c)if(u===0)g=this.__charBounds[c][u].left;else{var _=this._getWidthOfCharSpacing();g=this.__charBounds[c][u-1].left+this.__charBounds[c][u-1].width-_}m=p,(this.lineHeight<1||d===c&&this.lineHeight>1)&&(p/=this.lineHeight);var v=e.left+f+h,y=g-h,b=p,x=0;this.inCompositionMode?(t.fillStyle=this.compositionColor||`black`,b=1,x=p):t.fillStyle=this.selectionColor,this.direction===`rtl`&&(v=this.width-v-y),t.fillRect(v,e.top+e.topOffset+x,y,b),e.topOffset+=m}},getCurrentCharFontSize:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,`fontSize`)},getCurrentCharColor:function(){var e=this._getCurrentCharIndex();return this.getValueOfPropertyAt(e.l,e.c,`fill`)},_getCurrentCharIndex:function(){var e=this.get2DCursorLocation(this.selectionStart,!0),t=e.charIndex>0?e.charIndex-1:0;return{l:e.lineIndex,c:t}}}),t.IText.fromObject=function(n,r){var i=t.util.stylesFromArray(n.styles,n.text),a=Object.assign({},n,{styles:i});if(e(a),a.styles)for(var o in a.styles)for(var s in a.styles[o])e(a.styles[o][s]);t.Object._fromObject(`IText`,a,r,`text`)}}(),function(){var e=t.util.object.clone;t.util.object.extend(t.IText.prototype,{initBehavior:function(){this.initAddedHandler(),this.initRemovedHandler(),this.initCursorSelectionHandlers(),this.initDoubleClickSimulation(),this.mouseMoveHandler=this.mouseMoveHandler.bind(this)},onDeselect:function(){this.isEditing&&this.exitEditing(),this.selected=!1},initAddedHandler:function(){var e=this;this.on(`added`,function(){var t=e.canvas;t&&(t._hasITextHandlers||(t._hasITextHandlers=!0,e._initCanvasHandlers(t)),t._iTextInstances=t._iTextInstances||[],t._iTextInstances.push(e))})},initRemovedHandler:function(){var e=this;this.on(`removed`,function(){var n=e.canvas;n&&(n._iTextInstances=n._iTextInstances||[],t.util.removeFromArray(n._iTextInstances,e),n._iTextInstances.length===0&&(n._hasITextHandlers=!1,e._removeCanvasHandlers(n)))})},_initCanvasHandlers:function(e){e._mouseUpITextHandler=function(){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.__isMousedown=!1})},e.on(`mouse:up`,e._mouseUpITextHandler)},_removeCanvasHandlers:function(e){e.off(`mouse:up`,e._mouseUpITextHandler)},_tick:function(){this._currentTickState=this._animateCursor(this,1,this.cursorDuration,`_onTickComplete`)},_animateCursor:function(e,t,n,r){var i;return i={isAborted:!1,abort:function(){this.isAborted=!0}},e.animate(`_currentCursorOpacity`,t,{duration:n,onComplete:function(){i.isAborted||e[r]()},onChange:function(){e.canvas&&e.selectionStart===e.selectionEnd&&e.renderCursorOrSelection()},abort:function(){return i.isAborted}}),i},_onTickComplete:function(){var e=this;this._cursorTimeout1&&clearTimeout(this._cursorTimeout1),this._cursorTimeout1=setTimeout(function(){e._currentTickCompleteState=e._animateCursor(e,0,this.cursorDuration/2,`_tick`)},100)},initDelayedCursor:function(e){var t=this,n=e?0:this.cursorDelay;this.abortCursorAnimation(),this._currentCursorOpacity=1,this._cursorTimeout2=setTimeout(function(){t._tick()},n)},abortCursorAnimation:function(){var e=this._currentTickState||this._currentTickCompleteState,t=this.canvas;this._currentTickState&&this._currentTickState.abort(),this._currentTickCompleteState&&this._currentTickCompleteState.abort(),clearTimeout(this._cursorTimeout1),clearTimeout(this._cursorTimeout2),this._currentCursorOpacity=0,e&&t&&t.clearContext(t.contextTop||t.contextContainer)},selectAll:function(){return this.selectionStart=0,this.selectionEnd=this._text.length,this._fireSelectionChanged(),this._updateTextarea(),this},getSelectedText:function(){return this._text.slice(this.selectionStart,this.selectionEnd).join(``)},findWordBoundaryLeft:function(e){var t=0,n=e-1;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)t++,n--;for(;/\S/.test(this._text[n])&&n>-1;)t++,n--;return e-t},findWordBoundaryRight:function(e){var t=0,n=e;if(this._reSpace.test(this._text[n]))for(;this._reSpace.test(this._text[n]);)t++,n++;for(;/\S/.test(this._text[n])&&n<this._text.length;)t++,n++;return e+t},findLineBoundaryLeft:function(e){for(var t=0,n=e-1;!/\n/.test(this._text[n])&&n>-1;)t++,n--;return e-t},findLineBoundaryRight:function(e){for(var t=0,n=e;!/\n/.test(this._text[n])&&n<this._text.length;)t++,n++;return e+t},searchWordBoundary:function(e,n){for(var r=this._text,i=this._reSpace.test(r[e])?e-1:e,a=r[i],o=t.reNonWord;!o.test(a)&&i>0&&i<r.length;)i+=n,a=r[i];return o.test(a)&&(i+=n===1?0:1),i},selectWord:function(e){e||=this.selectionStart;var t=this.searchWordBoundary(e,-1),n=this.searchWordBoundary(e,1);this.selectionStart=t,this.selectionEnd=n,this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()},selectLine:function(e){e||=this.selectionStart;var t=this.findLineBoundaryLeft(e),n=this.findLineBoundaryRight(e);return this.selectionStart=t,this.selectionEnd=n,this._fireSelectionChanged(),this._updateTextarea(),this},enterEditing:function(e){if(!(this.isEditing||!this.editable))return this.canvas&&(this.canvas.calcOffset(),this.exitEditingOnOthers(this.canvas)),this.isEditing=!0,this.initHiddenTextarea(e),this.hiddenTextarea.focus(),this.hiddenTextarea.value=this.text,this._updateTextarea(),this._saveEditingProps(),this._setEditingProps(),this._textBeforeEdit=this.text,this._tick(),this.fire(`editing:entered`),this._fireSelectionChanged(),this.canvas?(this.canvas.fire(`text:editing:entered`,{target:this}),this.initMouseMoveHandler(),this.canvas.requestRenderAll(),this):this},exitEditingOnOthers:function(e){e._iTextInstances&&e._iTextInstances.forEach(function(e){e.selected=!1,e.isEditing&&e.exitEditing()})},initMouseMoveHandler:function(){this.canvas.on(`mouse:move`,this.mouseMoveHandler)},mouseMoveHandler:function(e){if(!(!this.__isMousedown||!this.isEditing)){document.activeElement!==this.hiddenTextarea&&this.hiddenTextarea.focus();var t=this.getSelectionStartFromPointer(e.e),n=this.selectionStart,r=this.selectionEnd;(t!==this.__selectionStartOnMouseDown||n===r)&&(n===t||r===t)||(t>this.__selectionStartOnMouseDown?(this.selectionStart=this.__selectionStartOnMouseDown,this.selectionEnd=t):(this.selectionStart=t,this.selectionEnd=this.__selectionStartOnMouseDown),(this.selectionStart!==n||this.selectionEnd!==r)&&(this.restartCursorIfNeeded(),this._fireSelectionChanged(),this._updateTextarea(),this.renderCursorOrSelection()))}},_setEditingProps:function(){this.hoverCursor=`text`,this.canvas&&(this.canvas.defaultCursor=this.canvas.moveCursor=`text`),this.borderColor=this.editingBorderColor,this.hasControls=this.selectable=!1,this.lockMovementX=this.lockMovementY=!0},fromStringToGraphemeSelection:function(e,n,r){var i=r.slice(0,e),a=t.util.string.graphemeSplit(i).length;if(e===n)return{selectionStart:a,selectionEnd:a};var o=r.slice(e,n);return{selectionStart:a,selectionEnd:a+t.util.string.graphemeSplit(o).length}},fromGraphemeToStringSelection:function(e,t,n){var r=n.slice(0,e).join(``).length;return e===t?{selectionStart:r,selectionEnd:r}:{selectionStart:r,selectionEnd:r+n.slice(e,t).join(``).length}},_updateTextarea:function(){if(this.cursorOffsetCache={},this.hiddenTextarea){if(!this.inCompositionMode){var e=this.fromGraphemeToStringSelection(this.selectionStart,this.selectionEnd,this._text);this.hiddenTextarea.selectionStart=e.selectionStart,this.hiddenTextarea.selectionEnd=e.selectionEnd}this.updateTextareaPosition()}},updateFromTextArea:function(){if(this.hiddenTextarea){this.cursorOffsetCache={},this.text=this.hiddenTextarea.value,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords());var e=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value);this.selectionEnd=this.selectionStart=e.selectionEnd,this.inCompositionMode||(this.selectionStart=e.selectionStart),this.updateTextareaPosition()}},updateTextareaPosition:function(){if(this.selectionStart===this.selectionEnd){var e=this._calcTextareaPosition();this.hiddenTextarea.style.left=e.left,this.hiddenTextarea.style.top=e.top}},_calcTextareaPosition:function(){if(!this.canvas)return{x:1,y:1};var e=this.inCompositionMode?this.compositionStart:this.selectionStart,n=this._getCursorBoundaries(e),r=this.get2DCursorLocation(e),i=r.lineIndex,a=r.charIndex,o=this.getValueOfPropertyAt(i,a,`fontSize`)*this.lineHeight,s=n.leftOffset,c=this.calcTransformMatrix(),l={x:n.left+s,y:n.top+n.topOffset+o},u=this.canvas.getRetinaScaling(),d=this.canvas.upperCanvasEl,f=d.width/u,p=d.height/u,m=f-o,h=p-o,g=d.clientWidth/f,_=d.clientHeight/p;return l=t.util.transformPoint(l,c),l=t.util.transformPoint(l,this.canvas.viewportTransform),l.x*=g,l.y*=_,l.x<0&&(l.x=0),l.x>m&&(l.x=m),l.y<0&&(l.y=0),l.y>h&&(l.y=h),l.x+=this.canvas._offset.left,l.y+=this.canvas._offset.top,{left:l.x+`px`,top:l.y+`px`,fontSize:o+`px`,charHeight:o}},_saveEditingProps:function(){this._savedProps={hasControls:this.hasControls,borderColor:this.borderColor,lockMovementX:this.lockMovementX,lockMovementY:this.lockMovementY,hoverCursor:this.hoverCursor,selectable:this.selectable,defaultCursor:this.canvas&&this.canvas.defaultCursor,moveCursor:this.canvas&&this.canvas.moveCursor}},_restoreEditingProps:function(){this._savedProps&&(this.hoverCursor=this._savedProps.hoverCursor,this.hasControls=this._savedProps.hasControls,this.borderColor=this._savedProps.borderColor,this.selectable=this._savedProps.selectable,this.lockMovementX=this._savedProps.lockMovementX,this.lockMovementY=this._savedProps.lockMovementY,this.canvas&&(this.canvas.defaultCursor=this._savedProps.defaultCursor,this.canvas.moveCursor=this._savedProps.moveCursor))},exitEditing:function(){var e=this._textBeforeEdit!==this.text,t=this.hiddenTextarea;return this.selected=!1,this.isEditing=!1,this.selectionEnd=this.selectionStart,t&&(t.blur&&t.blur(),t.parentNode&&t.parentNode.removeChild(t)),this.hiddenTextarea=null,this.abortCursorAnimation(),this._restoreEditingProps(),this._currentCursorOpacity=0,this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this.fire(`editing:exited`),e&&this.fire(`modified`),this.canvas&&(this.canvas.off(`mouse:move`,this.mouseMoveHandler),this.canvas.fire(`text:editing:exited`,{target:this}),e&&this.canvas.fire(`object:modified`,{target:this})),this},_removeExtraneousStyles:function(){for(var e in this.styles)this._textLines[e]||delete this.styles[e]},removeStyleFromTo:function(e,t){var n=this.get2DCursorLocation(e,!0),r=this.get2DCursorLocation(t,!0),i=n.lineIndex,a=n.charIndex,o=r.lineIndex,s=r.charIndex,c,l;if(i!==o){if(this.styles[i])for(c=a;c<this._unwrappedTextLines[i].length;c++)delete this.styles[i][c];if(this.styles[o])for(c=s;c<this._unwrappedTextLines[o].length;c++)l=this.styles[o][c],l&&(this.styles[i]||(this.styles[i]={}),this.styles[i][a+c-s]=l);for(c=i+1;c<=o;c++)delete this.styles[c];this.shiftLineStyles(o,i-o)}else if(this.styles[i]){l=this.styles[i];var u=s-a,d,f;for(c=a;c<s;c++)delete l[c];for(f in this.styles[i])d=parseInt(f,10),d>=s&&(l[d-u]=l[f],delete l[f])}},shiftLineStyles:function(t,n){var r=e(this.styles);for(var i in this.styles){var a=parseInt(i,10);a>t&&(this.styles[a+n]=r[a],r[a-n]||delete this.styles[a])}},restartCursorIfNeeded:function(){(!this._currentTickState||this._currentTickState.isAborted||!this._currentTickCompleteState||this._currentTickCompleteState.isAborted)&&this.initDelayedCursor()},insertNewlineStyleObject:function(t,n,r,i){var a,o={},s=!1,c=this._unwrappedTextLines[t].length===n;for(var l in r||=1,this.shiftLineStyles(t,r),this.styles[t]&&(a=this.styles[t][n===0?n:n-1]),this.styles[t]){var u=parseInt(l,10);u>=n&&(s=!0,o[u-n]=this.styles[t][l],c&&n===0||delete this.styles[t][l])}var d=!1;for(s&&!c&&(this.styles[t+r]=o,d=!0),d&&r--;r>0;)i&&i[r-1]?this.styles[t+r]={0:e(i[r-1])}:a?this.styles[t+r]={0:e(a)}:delete this.styles[t+r],r--;this._forceClearCache=!0},insertCharStyleObject:function(t,n,r,i){this.styles||={};var a=this.styles[t],o=a?e(a):{};for(var s in r||=1,o){var c=parseInt(s,10);c>=n&&(a[c+r]=o[c],o[c-r]||delete a[c])}if(this._forceClearCache=!0,i){for(;r--;)Object.keys(i[r]).length&&(this.styles[t]||(this.styles[t]={}),this.styles[t][n+r]=e(i[r]));return}if(a)for(var l=a[n?n-1:1];l&&r--;)this.styles[t][n+r]=e(l)},insertNewStyleBlock:function(e,t,n){for(var r=this.get2DCursorLocation(t,!0),i=[0],a=0,o=0;o<e.length;o++)e[o]===`
|
|
461
|
+
`?(a++,i[a]=0):i[a]++;i[0]>0&&(this.insertCharStyleObject(r.lineIndex,r.charIndex,i[0],n),n&&=n.slice(i[0]+1)),a&&this.insertNewlineStyleObject(r.lineIndex,r.charIndex+i[0],a);for(var o=1;o<a;o++)i[o]>0?this.insertCharStyleObject(r.lineIndex+o,0,i[o],n):n&&this.styles[r.lineIndex+o]&&n[0]&&(this.styles[r.lineIndex+o][0]=n[0]),n&&=n.slice(i[o]+1);i[o]>0&&this.insertCharStyleObject(r.lineIndex+o,0,i[o],n)},setSelectionStartEndWithShift:function(e,t,n){n<=e?(t===e?this._selectionDirection=`left`:this._selectionDirection===`right`&&(this._selectionDirection=`left`,this.selectionEnd=e),this.selectionStart=n):n>e&&n<t?this._selectionDirection===`right`?this.selectionEnd=n:this.selectionStart=n:(t===e?this._selectionDirection=`right`:this._selectionDirection===`left`&&(this._selectionDirection=`right`,this.selectionStart=t),this.selectionEnd=n)},setSelectionInBoundaries:function(){var e=this.text.length;this.selectionStart>e?this.selectionStart=e:this.selectionStart<0&&(this.selectionStart=0),this.selectionEnd>e?this.selectionEnd=e:this.selectionEnd<0&&(this.selectionEnd=0)}})}(),t.util.object.extend(t.IText.prototype,{initDoubleClickSimulation:function(){this.__lastClickTime=+new Date,this.__lastLastClickTime=+new Date,this.__lastPointer={},this.on(`mousedown`,this.onMouseDown)},onMouseDown:function(e){if(this.canvas){this.__newClickTime=+new Date;var t=e.pointer;this.isTripleClick(t)&&(this.fire(`tripleclick`,e),this._stopEvent(e.e)),this.__lastLastClickTime=this.__lastClickTime,this.__lastClickTime=this.__newClickTime,this.__lastPointer=t,this.__lastIsEditing=this.isEditing,this.__lastSelected=this.selected}},isTripleClick:function(e){return this.__newClickTime-this.__lastClickTime<500&&this.__lastClickTime-this.__lastLastClickTime<500&&this.__lastPointer.x===e.x&&this.__lastPointer.y===e.y},_stopEvent:function(e){e.preventDefault&&e.preventDefault(),e.stopPropagation&&e.stopPropagation()},initCursorSelectionHandlers:function(){this.initMousedownHandler(),this.initMouseupHandler(),this.initClicks()},doubleClickHandler:function(e){this.isEditing&&this.selectWord(this.getSelectionStartFromPointer(e.e))},tripleClickHandler:function(e){this.isEditing&&this.selectLine(this.getSelectionStartFromPointer(e.e))},initClicks:function(){this.on(`mousedblclick`,this.doubleClickHandler),this.on(`tripleclick`,this.tripleClickHandler)},_mouseDownHandler:function(e){!this.canvas||!this.editable||e.e.button&&e.e.button!==1||(this.__isMousedown=!0,this.selected&&(this.inCompositionMode=!1,this.setCursorByClick(e.e)),this.isEditing&&(this.__selectionStartOnMouseDown=this.selectionStart,this.selectionStart===this.selectionEnd&&this.abortCursorAnimation(),this.renderCursorOrSelection()))},_mouseDownHandlerBefore:function(e){!this.canvas||!this.editable||e.e.button&&e.e.button!==1||(this.selected=this===this.canvas._activeObject)},initMousedownHandler:function(){this.on(`mousedown`,this._mouseDownHandler),this.on(`mousedown:before`,this._mouseDownHandlerBefore)},initMouseupHandler:function(){this.on(`mouseup`,this.mouseUpHandler)},mouseUpHandler:function(e){if(this.__isMousedown=!1,!(!this.editable||this.group||e.transform&&e.transform.actionPerformed||e.e.button&&e.e.button!==1)){if(this.canvas){var t=this.canvas._activeObject;if(t&&t!==this)return}this.__lastSelected&&!this.__corner?(this.selected=!1,this.__lastSelected=!1,this.enterEditing(e.e),this.selectionStart===this.selectionEnd?this.initDelayedCursor(!0):this.renderCursorOrSelection()):this.selected=!0}},setCursorByClick:function(e){var t=this.getSelectionStartFromPointer(e),n=this.selectionStart,r=this.selectionEnd;e.shiftKey?this.setSelectionStartEndWithShift(n,r,t):(this.selectionStart=t,this.selectionEnd=t),this.isEditing&&(this._fireSelectionChanged(),this._updateTextarea())},getSelectionStartFromPointer:function(e){for(var t=this.getLocalPointer(e),n=0,r=0,i=0,a=0,o=0,s,c,l=0,u=this._textLines.length;l<u&&i<=t.y;l++)i+=this.getHeightOfLine(l)*this.scaleY,o=l,l>0&&(a+=this._textLines[l-1].length+this.missingNewlineOffset(l-1));s=this._getLineLeftOffset(o),r=s*this.scaleX,c=this._textLines[o],this.direction===`rtl`&&(t.x=this.width*this.scaleX-t.x+r);for(var d=0,f=c.length;d<f&&(n=r,r+=this.__charBounds[o][d].kernedWidth*this.scaleX,r<=t.x);d++)a++;return this._getNewSelectionStartFromOffset(t,n,r,a,f)},_getNewSelectionStartFromOffset:function(e,t,n,r,i){var a=e.x-t,o=n-e.x,s=r+(o>a||o<0?0:1);return this.flipX&&(s=i-s),s>this._text.length&&(s=this._text.length),s}}),t.util.object.extend(t.IText.prototype,{initHiddenTextarea:function(){this.hiddenTextarea=t.document.createElement(`textarea`),this.hiddenTextarea.setAttribute(`autocapitalize`,`off`),this.hiddenTextarea.setAttribute(`autocorrect`,`off`),this.hiddenTextarea.setAttribute(`autocomplete`,`off`),this.hiddenTextarea.setAttribute(`spellcheck`,`false`),this.hiddenTextarea.setAttribute(`data-fabric-hiddentextarea`,``),this.hiddenTextarea.setAttribute(`wrap`,`off`);var e=this._calcTextareaPosition();this.hiddenTextarea.style.cssText=`position: absolute; top: `+e.top+`; left: `+e.left+`; z-index: -999; opacity: 0; width: 1px; height: 1px; font-size: 1px; padding-top: `+e.fontSize+`;`,this.hiddenTextareaContainer?this.hiddenTextareaContainer.appendChild(this.hiddenTextarea):t.document.body.appendChild(this.hiddenTextarea),t.util.addListener(this.hiddenTextarea,`keydown`,this.onKeyDown.bind(this)),t.util.addListener(this.hiddenTextarea,`keyup`,this.onKeyUp.bind(this)),t.util.addListener(this.hiddenTextarea,`input`,this.onInput.bind(this)),t.util.addListener(this.hiddenTextarea,`copy`,this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,`cut`,this.copy.bind(this)),t.util.addListener(this.hiddenTextarea,`paste`,this.paste.bind(this)),t.util.addListener(this.hiddenTextarea,`compositionstart`,this.onCompositionStart.bind(this)),t.util.addListener(this.hiddenTextarea,`compositionupdate`,this.onCompositionUpdate.bind(this)),t.util.addListener(this.hiddenTextarea,`compositionend`,this.onCompositionEnd.bind(this)),!this._clickHandlerInitialized&&this.canvas&&(t.util.addListener(this.canvas.upperCanvasEl,`click`,this.onClick.bind(this)),this._clickHandlerInitialized=!0)},keysMap:{9:`exitEditing`,27:`exitEditing`,33:`moveCursorUp`,34:`moveCursorDown`,35:`moveCursorRight`,36:`moveCursorLeft`,37:`moveCursorLeft`,38:`moveCursorUp`,39:`moveCursorRight`,40:`moveCursorDown`},keysMapRtl:{9:`exitEditing`,27:`exitEditing`,33:`moveCursorUp`,34:`moveCursorDown`,35:`moveCursorLeft`,36:`moveCursorRight`,37:`moveCursorRight`,38:`moveCursorUp`,39:`moveCursorLeft`,40:`moveCursorDown`},ctrlKeysMapUp:{67:`copy`,88:`cut`},ctrlKeysMapDown:{65:`selectAll`},onClick:function(){this.hiddenTextarea&&this.hiddenTextarea.focus()},onKeyDown:function(e){if(this.isEditing){var t=this.direction===`rtl`?this.keysMapRtl:this.keysMap;if(e.keyCode in t)this[t[e.keyCode]](e);else if(e.keyCode in this.ctrlKeysMapDown&&(e.ctrlKey||e.metaKey))this[this.ctrlKeysMapDown[e.keyCode]](e);else return;e.stopImmediatePropagation(),e.preventDefault(),e.keyCode>=33&&e.keyCode<=40?(this.inCompositionMode=!1,this.clearContextTop(),this.renderCursorOrSelection()):this.canvas&&this.canvas.requestRenderAll()}},onKeyUp:function(e){if(!this.isEditing||this._copyDone||this.inCompositionMode){this._copyDone=!1;return}if(e.keyCode in this.ctrlKeysMapUp&&(e.ctrlKey||e.metaKey))this[this.ctrlKeysMapUp[e.keyCode]](e);else return;e.stopImmediatePropagation(),e.preventDefault(),this.canvas&&this.canvas.requestRenderAll()},onInput:function(e){var n=this.fromPaste;if(this.fromPaste=!1,e&&e.stopPropagation(),this.isEditing){var r=this._splitTextIntoLines(this.hiddenTextarea.value).graphemeText,i=this._text.length,a=r.length,o,s,c=a-i,l=this.selectionStart,u=this.selectionEnd,d=l!==u,f,p,m;if(this.hiddenTextarea.value===``){this.styles={},this.updateFromTextArea(),this.fire(`changed`),this.canvas&&(this.canvas.fire(`text:changed`,{target:this}),this.canvas.requestRenderAll());return}var h=this.fromStringToGraphemeSelection(this.hiddenTextarea.selectionStart,this.hiddenTextarea.selectionEnd,this.hiddenTextarea.value),g=l>h.selectionStart;d?(o=this._text.slice(l,u),c+=u-l):a<i&&(o=g?this._text.slice(u+c,u):this._text.slice(l,l-c)),s=r.slice(h.selectionEnd-c,h.selectionEnd),o&&o.length&&(s.length&&(f=this.getSelectionStyles(l,l+1,!1),f=s.map(function(){return f[0]})),d?(p=l,m=u):g?(p=u-o.length,m=u):(p=u,m=u+o.length),this.removeStyleFromTo(p,m)),s.length&&(n&&s.join(``)===t.copiedText&&!t.disableStyleCopyPaste&&(f=t.copiedTextStyle),this.insertNewStyleBlock(s,l,f)),this.updateFromTextArea(),this.fire(`changed`),this.canvas&&(this.canvas.fire(`text:changed`,{target:this}),this.canvas.requestRenderAll())}},onCompositionStart:function(){this.inCompositionMode=!0},onCompositionEnd:function(){this.inCompositionMode=!1},onCompositionUpdate:function(e){this.compositionStart=e.target.selectionStart,this.compositionEnd=e.target.selectionEnd,this.updateTextareaPosition()},copy:function(){this.selectionStart!==this.selectionEnd&&(t.copiedText=this.getSelectedText(),t.disableStyleCopyPaste?t.copiedTextStyle=null:t.copiedTextStyle=this.getSelectionStyles(this.selectionStart,this.selectionEnd,!0),this._copyDone=!0)},paste:function(){this.fromPaste=!0},_getClipboardData:function(e){return e&&e.clipboardData||t.window.clipboardData},_getWidthBeforeCursor:function(e,t){var n=this._getLineLeftOffset(e),r;return t>0&&(r=this.__charBounds[e][t-1],n+=r.left+r.width),n},getDownCursorOffset:function(e,t){var n=this._getSelectionForOffset(e,t),r=this.get2DCursorLocation(n),i=r.lineIndex;if(i===this._textLines.length-1||e.metaKey||e.keyCode===34)return this._text.length-n;var a=r.charIndex,o=this._getWidthBeforeCursor(i,a),s=this._getIndexOnLine(i+1,o);return this._textLines[i].slice(a).length+s+1+this.missingNewlineOffset(i)},_getSelectionForOffset:function(e,t){return e.shiftKey&&this.selectionStart!==this.selectionEnd&&t?this.selectionEnd:this.selectionStart},getUpCursorOffset:function(e,t){var n=this._getSelectionForOffset(e,t),r=this.get2DCursorLocation(n),i=r.lineIndex;if(i===0||e.metaKey||e.keyCode===33)return-n;var a=r.charIndex,o=this._getWidthBeforeCursor(i,a),s=this._getIndexOnLine(i-1,o),c=this._textLines[i].slice(0,a),l=this.missingNewlineOffset(i-1);return-this._textLines[i-1].length+s-c.length+(1-l)},_getIndexOnLine:function(e,t){for(var n=this._textLines[e],r=this._getLineLeftOffset(e),i=0,a,o,s=0,c=n.length;s<c;s++)if(a=this.__charBounds[e][s].width,r+=a,r>t){o=!0;var l=r-a,u=r,d=Math.abs(l-t);i=Math.abs(u-t)<d?s:s-1;break}return o||(i=n.length-1),i},moveCursorDown:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorUpOrDown(`Down`,e)},moveCursorUp:function(e){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorUpOrDown(`Up`,e)},_moveCursorUpOrDown:function(e,t){var n=`get`+e+`CursorOffset`,r=this[n](t,this._selectionDirection===`right`);t.shiftKey?this.moveCursorWithShift(r):this.moveCursorWithoutShift(r),r!==0&&(this.setSelectionInBoundaries(),this.abortCursorAnimation(),this._currentCursorOpacity=1,this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorWithShift:function(e){var t=this._selectionDirection===`left`?this.selectionStart+e:this.selectionEnd+e;return this.setSelectionStartEndWithShift(this.selectionStart,this.selectionEnd,t),e!==0},moveCursorWithoutShift:function(e){return e<0?(this.selectionStart+=e,this.selectionEnd=this.selectionStart):(this.selectionEnd+=e,this.selectionStart=this.selectionEnd),e!==0},moveCursorLeft:function(e){this.selectionStart===0&&this.selectionEnd===0||this._moveCursorLeftOrRight(`Left`,e)},_move:function(e,t,n){var r;if(e.altKey)r=this[`findWordBoundary`+n](this[t]);else if(e.metaKey||e.keyCode===35||e.keyCode===36)r=this[`findLineBoundary`+n](this[t]);else return this[t]+=n===`Left`?-1:1,!0;if(typeof r<`u`&&this[t]!==r)return this[t]=r,!0},_moveLeft:function(e,t){return this._move(e,t,`Left`)},_moveRight:function(e,t){return this._move(e,t,`Right`)},moveCursorLeftWithoutShift:function(e){var t=!0;return this._selectionDirection=`left`,this.selectionEnd===this.selectionStart&&this.selectionStart!==0&&(t=this._moveLeft(e,`selectionStart`)),this.selectionEnd=this.selectionStart,t},moveCursorLeftWithShift:function(e){if(this._selectionDirection===`right`&&this.selectionStart!==this.selectionEnd)return this._moveLeft(e,`selectionEnd`);if(this.selectionStart!==0)return this._selectionDirection=`left`,this._moveLeft(e,`selectionStart`)},moveCursorRight:function(e){this.selectionStart>=this._text.length&&this.selectionEnd>=this._text.length||this._moveCursorLeftOrRight(`Right`,e)},_moveCursorLeftOrRight:function(e,t){var n=`moveCursor`+e+`With`;this._currentCursorOpacity=1,t.shiftKey?n+=`Shift`:n+=`outShift`,this[n](t)&&(this.abortCursorAnimation(),this.initDelayedCursor(),this._fireSelectionChanged(),this._updateTextarea())},moveCursorRightWithShift:function(e){if(this._selectionDirection===`left`&&this.selectionStart!==this.selectionEnd)return this._moveRight(e,`selectionStart`);if(this.selectionEnd!==this._text.length)return this._selectionDirection=`right`,this._moveRight(e,`selectionEnd`)},moveCursorRightWithoutShift:function(e){var t=!0;return this._selectionDirection=`right`,this.selectionStart===this.selectionEnd?(t=this._moveRight(e,`selectionStart`),this.selectionEnd=this.selectionStart):this.selectionStart=this.selectionEnd,t},removeChars:function(e,t){typeof t>`u`&&(t=e+1),this.removeStyleFromTo(e,t),this._text.splice(e,t-e),this.text=this._text.join(``),this.set(`dirty`,!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()},insertChars:function(e,n,r,i){typeof i>`u`&&(i=r),i>r&&this.removeStyleFromTo(r,i);var a=t.util.string.graphemeSplit(e);this.insertNewStyleBlock(a,r,n),this._text=[].concat(this._text.slice(0,r),a,this._text.slice(i)),this.text=this._text.join(``),this.set(`dirty`,!0),this._shouldClearDimensionCache()&&(this.initDimensions(),this.setCoords()),this._removeExtraneousStyles()}}),function(){var e=t.util.toFixed,n=/ +/g;t.util.object.extend(t.Text.prototype,{_toSVG:function(){var e=this._getSVGLeftTopOffsets(),t=this._getSVGTextAndBg(e.textTop,e.textLeft);return this._wrapSVGTextAndBg(t)},toSVG:function(e){return this._createBaseSVGMarkup(this._toSVG(),{reviver:e,noStyle:!0,withShadow:!0})},_getSVGLeftTopOffsets:function(){return{textLeft:-this.width/2,textTop:-this.height/2,lineTop:this.getHeightOfLine(0)}},_wrapSVGTextAndBg:function(e){var t=!0,n=this.getSvgTextDecoration(this);return[e.textBgRects.join(``),` <text xml:space="preserve" `,this.fontFamily?`font-family="`+this.fontFamily.replace(/"/g,`'`)+`" `:``,this.fontSize?`font-size="`+this.fontSize+`" `:``,this.fontStyle?`font-style="`+this.fontStyle+`" `:``,this.fontWeight?`font-weight="`+this.fontWeight+`" `:``,n?`text-decoration="`+n+`" `:``,`style="`,this.getSvgStyles(t),`"`,this.addPaintOrder(),` >`,e.textSpans.join(``),`</text>
|
|
462
|
+
`]},_getSVGTextAndBg:function(e,t){var n=[],r=[],i=e,a;this._setSVGBg(r);for(var o=0,s=this._textLines.length;o<s;o++)a=this._getLineLeftOffset(o),(this.textBackgroundColor||this.styleHas(`textBackgroundColor`,o))&&this._setSVGTextLineBg(r,o,t+a,i),this._setSVGTextLineText(n,o,t+a,i),i+=this.getHeightOfLine(o);return{textSpans:n,textBgRects:r}},_createTextCharSpan:function(r,i,a,o){var s=r!==r.trim()||r.match(n),c=this.getSvgSpanStyles(i,s),l=c?`style="`+c+`"`:``,u=i.deltaY,d=``,f=t.Object.NUM_FRACTION_DIGITS;return u&&(d=` dy="`+e(u,f)+`" `),[`<tspan x="`,e(a,f),`" y="`,e(o,f),`" `,d,l,`>`,t.util.string.escapeXml(r),`</tspan>`].join(``)},_setSVGTextLineText:function(e,n,r,i){var a=this.getHeightOfLine(n),o=this.textAlign.indexOf(`justify`)!==-1,s,c,l=``,u,d,f=0,p=this._textLines[n],m;i+=a*(1-this._fontSizeFraction)/this.lineHeight;for(var h=0,g=p.length-1;h<=g;h++)m=h===g||this.charSpacing,l+=p[h],u=this.__charBounds[n][h],f===0?(r+=u.kernedWidth-u.width,f+=u.width):f+=u.kernedWidth,o&&!m&&this._reSpaceAndTab.test(p[h])&&(m=!0),m||=(s||=this.getCompleteStyleDeclaration(n,h),c=this.getCompleteStyleDeclaration(n,h+1),t.util.hasStyleChanged(s,c,!0)),m&&(d=this._getStyleDeclaration(n,h)||{},e.push(this._createTextCharSpan(l,d,r,i)),l=``,s=c,r+=f,f=0)},_pushTextBgRect:function(n,r,i,a,o,s){var c=t.Object.NUM_FRACTION_DIGITS;n.push(` <rect `,this._getFillAttributes(r),` x="`,e(i,c),`" y="`,e(a,c),`" width="`,e(o,c),`" height="`,e(s,c),`"></rect>
|
|
463
|
+
`)},_setSVGTextLineBg:function(e,t,n,r){for(var i=this._textLines[t],a=this.getHeightOfLine(t)/this.lineHeight,o=0,s=0,c,l,u=this.getValueOfPropertyAt(t,0,`textBackgroundColor`),d=0,f=i.length;d<f;d++)c=this.__charBounds[t][d],l=this.getValueOfPropertyAt(t,d,`textBackgroundColor`),l===u?o+=c.kernedWidth:(u&&this._pushTextBgRect(e,u,n+s,r,o,a),s=c.left,o=c.width,u=l);l&&this._pushTextBgRect(e,l,n+s,r,o,a)},_getFillAttributes:function(e){var n=e&&typeof e==`string`?new t.Color(e):``;return!n||!n.getSource()||n.getAlpha()===1?`fill="`+e+`"`:`opacity="`+n.getAlpha()+`" fill="`+n.setAlpha(1).toRgb()+`"`},_getSVGLineTopOffset:function(e){for(var t=0,n=0,r=0;r<e;r++)t+=this.getHeightOfLine(r);return n=this.getHeightOfLine(r),{lineTop:t,offset:(this._fontSizeMult-this._fontSizeFraction)*n/(this.lineHeight*this._fontSizeMult)}},getSvgStyles:function(e){return t.Object.prototype.getSvgStyles.call(this,e)+` white-space: pre;`}})}(),function(e){var t=e.fabric||={};t.Textbox=t.util.createClass(t.IText,t.Observable,{type:`textbox`,minWidth:20,dynamicMinWidth:2,__cachedLines:null,lockScalingFlip:!0,noScaleCache:!1,_dimensionAffectingProps:t.Text.prototype._dimensionAffectingProps.concat(`width`),_wordJoiners:/[ \t\r]/,splitByGrapheme:!1,initDimensions:function(){this.__skipDimension||(this.isEditing&&this.initDelayedCursor(),this.clearContextTop(),this._clearCache(),this.dynamicMinWidth=0,this._styleMap=this._generateStyleMap(this._splitText()),this.dynamicMinWidth>this.width&&this._set(`width`,this.dynamicMinWidth),this.textAlign.indexOf(`justify`)!==-1&&this.enlargeSpaces(),this.height=this.calcTextHeight(),this.saveState({propertySet:`_dimensionAffectingProps`}))},_generateStyleMap:function(e){for(var t=0,n=0,r=0,i={},a=0;a<e.graphemeLines.length;a++)e.graphemeText[r]===`
|
|
464
|
+
`&&a>0?(n=0,r++,t++):!this.splitByGrapheme&&this._reSpaceAndTab.test(e.graphemeText[r])&&a>0&&(n++,r++),i[a]={line:t,offset:n},r+=e.graphemeLines[a].length,n+=e.graphemeLines[a].length;return i},styleHas:function(e,n){if(this._styleMap&&!this.isWrapping){var r=this._styleMap[n];r&&(n=r.line)}return t.Text.prototype.styleHas.call(this,e,n)},isEmptyStyles:function(e){if(!this.styles)return!0;var t=0,n=e+1,r,i,a=!1,o=this._styleMap[e],s=this._styleMap[e+1];for(var c in o&&(e=o.line,t=o.offset),s&&(n=s.line,a=n===e,r=s.offset),i=typeof e>`u`?this.styles:{line:this.styles[e]},i)for(var l in i[c])if(l>=t&&(!a||l<r))for(var u in i[c][l])return!1;return!0},_getStyleDeclaration:function(e,t){if(this._styleMap&&!this.isWrapping){var n=this._styleMap[e];if(!n)return null;e=n.line,t=n.offset+t}return this.callSuper(`_getStyleDeclaration`,e,t)},_setStyleDeclaration:function(e,t,n){var r=this._styleMap[e];e=r.line,t=r.offset+t,this.styles[e][t]=n},_deleteStyleDeclaration:function(e,t){var n=this._styleMap[e];e=n.line,t=n.offset+t,delete this.styles[e][t]},_getLineStyle:function(e){var t=this._styleMap[e];return!!this.styles[t.line]},_setLineStyle:function(e){var t=this._styleMap[e];this.styles[t.line]={}},_wrapText:function(e,t){var n=[],r;for(this.isWrapping=!0,r=0;r<e.length;r++)n=n.concat(this._wrapLine(e[r],r,t));return this.isWrapping=!1,n},_measureWord:function(e,t,n){var r=0,i,a=!0;n||=0;for(var o=0,s=e.length;o<s;o++){var c=this._getGraphemeBox(e[o],t,o+n,i,a);r+=c.kernedWidth,i=e[o]}return r},_wrapLine:function(e,n,r,i){var a=0,o=this.splitByGrapheme,s=[],c=[],l=o?t.util.string.graphemeSplit(e):e.split(this._wordJoiners),u=``,d=0,f=o?``:` `,p=0,m=0,h=0,g=!0,_=this._getWidthOfCharSpacing(),i=i||0;l.length===0&&l.push([]),r-=i;for(var v=0;v<l.length;v++)u=o?l[v]:t.util.string.graphemeSplit(l[v]),p=this._measureWord(u,n,d),d+=u.length,a+=m+p-_,a>r&&!g?(s.push(c),c=[],a=p,g=!0):a+=_,!g&&!o&&c.push(f),c=c.concat(u),m=o?0:this._measureWord([f],n,d),d++,g=!1,p>h&&(h=p);return v&&s.push(c),h+i>this.dynamicMinWidth&&(this.dynamicMinWidth=h-_+i),s},isEndOfWrapping:function(e){return!this._styleMap[e+1]||this._styleMap[e+1].line!==this._styleMap[e].line},missingNewlineOffset:function(e){return this.splitByGrapheme?this.isEndOfWrapping(e)?1:0:1},_splitTextIntoLines:function(e){for(var n=t.Text.prototype._splitTextIntoLines.call(this,e),r=this._wrapText(n.lines,this.width),i=Array(r.length),a=0;a<r.length;a++)i[a]=r[a].join(``);return n.lines=i,n.graphemeLines=r,n},getMinWidth:function(){return Math.max(this.minWidth,this.dynamicMinWidth)},_removeExtraneousStyles:function(){var e={};for(var t in this._styleMap)this._textLines[t]&&(e[this._styleMap[t].line]=1);for(var t in this.styles)e[t]||delete this.styles[t]},toObject:function(e){return this.callSuper(`toObject`,[`minWidth`,`splitByGrapheme`].concat(e))}}),t.Textbox.fromObject=function(e,n){var r=t.util.stylesFromArray(e.styles,e.text),i=Object.assign({},e,{styles:r});return t.Object._fromObject(`Textbox`,i,n,`text`)}}(e),function(){var e=t.controlsUtils,n=e.scaleSkewCursorStyleHandler,r=e.scaleCursorStyleHandler,i=e.scalingEqually,a=e.scalingYOrSkewingX,o=e.scalingXOrSkewingY,s=e.scaleOrSkewActionName,c=t.Object.prototype.controls;if(c.ml=new t.Control({x:-.5,y:0,cursorStyleHandler:n,actionHandler:o,getActionName:s}),c.mr=new t.Control({x:.5,y:0,cursorStyleHandler:n,actionHandler:o,getActionName:s}),c.mb=new t.Control({x:0,y:.5,cursorStyleHandler:n,actionHandler:a,getActionName:s}),c.mt=new t.Control({x:0,y:-.5,cursorStyleHandler:n,actionHandler:a,getActionName:s}),c.tl=new t.Control({x:-.5,y:-.5,cursorStyleHandler:r,actionHandler:i}),c.tr=new t.Control({x:.5,y:-.5,cursorStyleHandler:r,actionHandler:i}),c.bl=new t.Control({x:-.5,y:.5,cursorStyleHandler:r,actionHandler:i}),c.br=new t.Control({x:.5,y:.5,cursorStyleHandler:r,actionHandler:i}),c.mtr=new t.Control({x:0,y:-.5,actionHandler:e.rotationWithSnapping,cursorStyleHandler:e.rotationStyleHandler,offsetY:-40,withConnection:!0,actionName:`rotate`}),t.Textbox){var l=t.Textbox.prototype.controls={};l.mtr=c.mtr,l.tr=c.tr,l.br=c.br,l.tl=c.tl,l.bl=c.bl,l.mt=c.mt,l.mb=c.mb,l.mr=new t.Control({x:.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:n,actionName:`resizing`}),l.ml=new t.Control({x:-.5,y:0,actionHandler:e.changeWidth,cursorStyleHandler:n,actionName:`resizing`})}}()})(X);var yv={lockScalingFlip:!0,originY:`center`,originX:`center`,lockMovementX:!0,lockMovementY:!0,borderColor:`transparent`};function bv(e=36){let t=``;for(let n=0;n<e;n+=1)t+=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`.charAt(Math.floor(Math.random()*62));return t}function xv(e){let t=new X.fabric.Canvas(e,{width:1,height:1});t.preserveObjectStacking=!0,t.selection=!1,t.renderOnAddRemove=!1;let n=K().config.textureSize;n&&(X.fabric.textureSize=n);let r={...K().config.objectDefaults?.global,...yv};Object.keys(r).forEach(e=>{X.fabric.Object.prototype[e]=r[e]}),t.on(`object:added`,e=>{var t;e.target&&!((t=e.target?.data)!=null&&t.id)&&(e.target.data||(e.target.data={}),e.target.data.id=bv(10))});let i=X.fabric.Object.prototype.controls;return Object.keys(i).forEach(e=>{delete i[e]}),t}var Sv=null;function Cv(e){Sv=e}var wv=class{constructor(){y(this,`maxZoom`,2),y(this,`minZoom`,1),y(this,`step`,.05),this.allowUserZoom&&this.bindMouseWheel(),G.subscribe(e=>e.stageSize,()=>{setTimeout(()=>{this.fitToScreen()},1)})}get allowUserZoom(){return K().config?.tools?.zoom?.allowUserZoom??!0}get currentZoom(){return K().zoom}zoomIn(e=this.step){this.set(this.currentZoom+e)}canZoomIn(e=this.step){return this.currentZoom+e<=this.maxZoom}canZoomOut(e=this.step){return this.currentZoom-e>=this.minZoom}zoomOut(e=this.step){this.set(this.currentZoom-e)}set(e,t=!0){if(e<this.minZoom||e>this.maxZoom)return;let n=N.round(K().original.width*e,0),r=N.round(K().original.height*e,0);J().setZoom(e),t&&J().setDimensions({width:n,height:r}),K().setZoom(e)}fitToScreen(){var e;if(!((e=K().config.tools?.zoom)!=null&&e.fitImageToScreen))return;let{width:t,height:n}=K().stageSize,r=Math.max(n,1),i=Math.max(t,1);if(K().original.height>r||K().original.width>i){let e=Math.min(r/K().original.height,i/K().original.width);this.minZoom=Math.min(e,1)}else this.minZoom=1;this.set(this.minZoom)}bindMouseWheel(){J().on(`mouse:wheel`,e=>{e.e.preventDefault(),e.e.stopPropagation(),Sv??(e.e.deltaY<0?this.zoomIn():this.zoomOut())})}};function Tv(e){return new Promise(t=>{X.fabric.util.loadImage(e,e=>t(new X.fabric.Image(e)),null,K().config.crossOrigin?`anonymous`:void 0)})}function Ev(){return!K().config.image&&!K().config.blankCanvasSize&&(!J()||J().getObjects().length===0)}var Dv=class{constructor(){y(this,`minWidth`,50),y(this,`minHeight`,50)}resize(e,t,{applyZoom:n=!1,resizeHelper:r=!0}={}){let i=K().zoom;J().setWidth(e*(n?i:1)),J().setHeight(t*(n?i:1)),K().setOriginal(e,t),r&&q().transform.resetStraightenAnchor()}async addMainImage(e,t=`mainImage`){var n,r;K().toggleLoading(t);let i=await Tv(e);if(i)return this.clear(),i.set(qu),i.name=El.MainImage,J().add(i),this.resize(i.width,i.height),i.center(),i.setCoords(),q().zoom.fitToScreen(),K().toggleLoading(!1),(r=(n=K().config).onMainImageLoaded)==null||r.call(n,i),i}openNew(e,t,n){return e=Math.max(this.minWidth,e),t=Math.max(this.minHeight,t),this.clear(),this.resize(e,t),J().backgroundColor=n,q().zoom.fitToScreen(),K().toggleLoading(`newCanvas`),requestAnimationFrame(()=>{K().toggleLoading(!1)}),Promise.resolve({width:e,height:t})}getMainImage(){return J().getObjects().find(e=>e.name===El.MainImage)}render(){J().requestRenderAll()}async loadInitialContent(){var e;let t=K().config.image,n=K().config.blankCanvasSize,r=K().config.state;if(t&&t.endsWith(`json`)){let e=await Ku(t);await q().import.loadState(e)}else t&&t.startsWith(`{"canvas`)?await q().import.loadState(t):t?await this.addMainImage(t):r?await q().import.loadState(r):n&&await this.openNew(n.width,n.height);return Ev()&&(e=K().config.ui?.openImageDialog)!=null&&e.show&&K().togglePanel(`newImage`,!0),new Promise(e=>{setTimeout(()=>{q().history.addInitial(),e()},10)})}clear(){J().clear(),q().frame.remove(),q().transform.resetStraightenAnchor()}};function Ov(e){return e.name===El.Sticker&&`forEachObject`in e}var kv=[`fontSize`,`fontFamily`,`left`,`top`,`width`,`height`,`scaleX`,`scaleY`,`flipX`,`flipY`,`angle`,`src`,`strokeWidth`];function Av(e={}){J().fire(`object:modified`,jv(e))}function jv(e){return{values:e,sizeOrPositionChanged:Mv(e)}}function Mv(e){return Object.keys(e).some(e=>kv.includes(e))}function Nv(){K().fabric.on(`selection:created`,e=>{var t;(t=e.selected)!=null&&t[0]&&!Pv(e)&&Fv(e.selected[0])}),K().fabric.on(`selection:updated`,e=>{Pv(e)||Fv(e.selected?.[0])}),K().fabric.on(`selection:cleared`,()=>{Fv()})}function Pv(e){var t;let[n]=Xu(e.selected?.[0]),r=n===K().activeTool;return K().dirty&&(!((t=e.selected)!=null&&t[0])||!r)?(e.deselected&&q().objects.select(e.deselected[0]),!0):!1}function Fv(e){e?.data.id!==K().objects.active.id&&(K().objects.setActive(e??null),K().activeTool!==V.DRAW&&Yu())}var Iv=class{constructor(){this.syncObjects(),Nv(),K().fabric.on(`text:editing:entered`,()=>{K().objects.setIsEditingText(!0)}),K().fabric.on(`text:editing:exited`,()=>{K().objects.setIsEditingText(!1)}),K().fabric.on(`object:added`,()=>{this.syncObjects()}),K().fabric.on(`object:removed`,()=>{this.syncObjects()})}getAll(){return J().getObjects().filter(e=>{var t;return!((t=e?.data)!=null&&t.pixieInternal)})}get(e){return this.getAll().find(t=>t.name===e)}getById(e){return this.getAll().find(t=>t.data.id===e)}isActive(e){let t=typeof e==`string`?e:e.data.id;return K().objects.active?.id===t}getActive(){return J().getActiveObject()}has(e){return this.getAll().findIndex(t=>t.name===e)>-1}select(e){let t=typeof e==`string`?this.getById(e):e;t&&(J().setActiveObject(t),J().requestRenderAll())}deselectActive(){J().discardActiveObject(),J().requestRenderAll()}setValues(e,t){if(t||=this.getActive(),!t)return;let n=!1;Ov(t)&&e.fill&&e.fill!==t.fill&&t.forEachObject(t=>t.set(`fill`,e.fill)),Tl(t)?((e.fontFamily!==t.fontFamily||e.fontSize!==t.fontSize)&&(n=!0),t.selectionStart===t.selectionEnd?t.set(e):t.setSelectionStyles(e)):t.set(e),n?setTimeout(()=>{J().requestRenderAll()},50):J().requestRenderAll(),K().objects.setActive(t),Av(e)}move(e,t=1,n){n||=this.getActive(),n&&(e===`up`?this.setValues({top:n.top-t}):e===`down`?this.setValues({top:n.top+t}):e===`left`?this.setValues({left:n.left-t}):e===`right`&&this.setValues({left:n.left+t}),q().canvas.render())}bringToFront(e){e||=this.getActive(),e&&(e.bringToFront(),q().canvas.render())}sendToBack(e){e||=this.getActive(),e&&(e.sendToBack(),q().canvas.render())}flipHorizontally(e){e||=this.getActive(),e&&(this.setValues({flipX:!e.flipX}),q().canvas.render())}duplicate(e){let t=e||this.getActive();t&&(this.deselectActive(),t.clone(e=>{e.set({left:t.left+40,top:t.top+40,data:{...t.data,id:bv(10)},name:t.name}),J().add(e),this.select(e),q().canvas.render()}))}delete(e){e||=this.getActive(),e&&(this.deselectActive(),J().remove(e),J().requestRenderAll(),q().history.addHistoryItem({name:`deletedObject`}))}syncObjects(){let e=this.getAll().map(e=>({name:e.name,selectable:e.selectable??!1,id:e.data.id}));G.setState({objects:{...K().objects,all:e}})}},Lv={frame:null,fonts:[]};function Rv(e){return e.state||=Ju(),{...e.state||Ju(),name:e.name,id:bv(15)}}function zv(e){return e?/^[a-zA-Z][a-zA-Z\d+\-.]*?:/.test(e):!1}function Bv(e){return e?zv(e)?e:`${K().config.baseUrl?`${K().config.baseUrl}/`:``}${e}`:``}var Vv=class{constructor(){y(this,`loadedAssets`,{})}loadAsset(e,t={type:`js`}){e=e.startsWith(`//`)?`${window.location.protocol}${e}`:e;let n=this.loadedAssets[e]?.state;return n===`loaded`&&!t.force?new Promise(e=>e()):((!n||this.loadedAssets[e].doc!==t.document||t.force&&n===`loaded`)&&(this.loadedAssets[e]={state:new Promise(n=>{let r={url:zv(e)?e:`assets/${e}`,id:Hv(e,t.id),resolve:n,parentEl:t.parentEl,document:t.document};t.type===`css`?this.loadStyleAsset(r):this.loadScriptAsset(r)}),doc:t.document}),this.loadedAssets[e].state)}isLoadingOrLoaded(e){return this.loadedAssets[e]!=null}loadStyleAsset(e){var t;let n=e.document||document,r=e.parentEl||n.head,i=n.createElement(`link`),a=Hv(e.url,e.id);i.rel=`stylesheet`,i.id=a,i.href=e.url;try{r.querySelector(`#${a}`)&&((t=r.querySelector(`#${a}`))==null||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state=`loaded`,e.resolve()},r.appendChild(i)}loadScriptAsset(e){var t;let n=e.document||document,r=e.parentEl||n.body,i=n.createElement(`script`),a=Hv(e.url,e.id);i.async=!0,i.id=a,i.src=e.url;try{r.querySelector(`#${a}`)&&((t=r.querySelector(`#${a}`))==null||t.remove())}catch{}i.onload=()=>{this.loadedAssets[e.url].state=`loaded`,e.resolve()},(r||r).appendChild(i)}};function Hv(e,t){return t||btoa(e.split(`/`).pop())}var Uv=new Vv;function Wv(e){return`be-fonts-${e}`}function Gv(e,t){let n=t.document||document,r=[],i=[],a=[];if(e.forEach(e=>{`google`in e&&e.google?r.push(e):`src`in e&&i.push(e)}),r!=null&&r.length){let r=t.weights||[400],i=e.map(e=>`${e.family}:${r.join(`,`)}`).join(`|`),o=Uv.loadAsset(`https://fonts.googleapis.com/css?family=${i}&display=swap`,{type:`css`,id:Wv(t.id),force:t.forceAssetLoad,document:n});a.push(o)}if(i!=null&&i.length){let e=i.map(async e=>{let r=Array.from(n.fonts.values()).find(t=>t.family===e.family);if(r)return r.loaded;let i=new FontFace(e.family,`url(${t!=null&&t.prefixSrc?t.prefixSrc(e.src):e.src})`,e.descriptors);return n.fonts.add(i),i.load()});a=a.concat(e)}return Promise.all(a)}var Kv=class{async undo(){if(this.canUndo()){let e=K().history.items[K().history.pointer-1];await this.load(e)}}async redo(){if(this.canRedo()){let e=K().history.items[K().history.pointer+1];await this.load(e)}}canUndo(){return K().history.canUndo}canRedo(){return K().history.canRedo}reload(){return this.load(K().history.items[K().history.pointer])}replaceCurrent(){let e=K().history.items[K().history.pointer],t=[...K().history.items];t[K().history.pointer]=Rv({name:e.name,state:e})}addHistoryItem(e){let t=Rv(e),n=[...K().history.items.slice(0,K().history.pointer+1),t];K().history.update(n.length-1,n)}load(e){return e={...e,editor:e.editor||Lv},new Promise(t=>{Gv(qv(e.canvas.objects),{prefixSrc:Bv,id:`pixie-fonts`}).finally(()=>{J().loadFromJSON(e.canvas,()=>{q().zoom.set(1),e.canvasWidth&&e.canvasHeight&&q().canvas.resize(e.canvasWidth,e.canvasHeight,{resizeHelper:!1,applyZoom:!1}),q().frame.remove(),e.editor.frame&&q().frame.add(e.editor.frame.name,e.editor.frame.sizePercent),q().objects.syncObjects(),q().objects.getAll().forEach(e=>{if(!e.data.pixieInternal&&e.originX===`left`&&e.originY===`top`){let t=e.getPointByOrigin(`center`,`center`);e.set(`left`,t.x),e.set(`top`,t.y)}e.set({...yv}),e.type===`i-text`&&(e.padding=K().config.tools?.text?.controlsPadding)}),q().canvas.render(),J().calcOffset(),q().zoom.fitToScreen(),K().history.updatePointerById(e.id),q().transform.resetStraightenAnchor(),t()})})})}addInitial(e){!K().history.items.find(e=>e.name===`initial`)&&(e||!Ev())&&this.addHistoryItem({name:`initial`,state:e})}};function qv(e){let t=[];return e.forEach(e=>{if(!Tl(e))return;let n=(K().config.tools?.text?.items)?.find(t=>t.family===e.fontFamily);n&&t.push(n)}),t}var Jv=class{canMerge(){return q().objects.getAll().filter(e=>e.name!==El.MainImage).length>0}async apply(){K().toggleLoading(`merge`);let e=q().export.getDataUrl();e&&await q().canvas.addMainImage(e,`merge`)}},Yv=[{name:`grayscale`},{name:`blackWhite`,fabricType:`blackwhite`},{name:`sharpen`,uses:`Convolute`,matrix:[0,-1,0,-1,5,-1,0,-1,0]},{name:`invert`},{name:`vintage`},{name:`polaroid`},{name:`kodachrome`},{name:`technicolor`},{name:`brownie`},{name:`sepia`},{name:`removeColor`,fabricType:`removecolor`,options:{distance:{type:`slider`,current:.1,min:0,max:1,step:.01},color:{current:`#fff`,type:`colorPicker`}}},{name:`brightness`,options:{brightness:{type:`slider`,current:.1,min:-1,max:1,step:.1}}},{name:`gamma`,options:{red:{type:`slider`,current:.1,min:.2,max:2.2,step:.003921},green:{type:`slider`,current:.1,min:.2,max:2.2,step:.003921},blue:{type:`slider`,current:.1,min:.2,max:2.2,step:.003921}},apply:e=>{e.gamma=[e.red,e.green,e.blue]}},{name:`noise`,options:{noise:{type:`slider`,current:40,min:1,max:600}}},{name:`pixelate`,options:{blocksize:{type:`slider`,min:1,max:40,current:6}}},{name:`blur`,uses:`Convolute`,matrix:[1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9,1/9]},{name:`emboss`,uses:`Convolute`,matrix:[1,1,1,1,.7,-1,-1,-1,-1]},{name:`blendColor`,fabricType:`blendcolor`,options:{alpha:{type:`slider`,current:.5,min:.1,max:1,step:.1},mode:{current:`add`,type:`select`,available:[{key:`add`},{key:`multiply`},{key:`subtract`},{key:`diff`},{key:`screen`},{key:`lighten`},{key:`darken`}]},color:{type:`colorPicker`,current:`#FF4081`}}}],Xv={grayscale:B(`grayscale`),blackWhite:B(`Black & White`),sharpen:B(`Sharpen`),invert:B(`Invert`),vintage:B(`Vintage`),polaroid:B(`Polaroid`),kodachrome:B(`Kodachrome`),technicolor:B(`Technicolor`),brownie:B(`Brownie`),sepia:B(`Sepia`),removeColor:B(`Remove Color`),brightness:B(`Brightness`),gamma:B(`Gamma`),noise:B(`Noise`),pixelate:B(`Pixelate`),blur:B(`Blur`),emboss:B(`Emboss`),blendColor:B(`Blend Color`)},Zv={distance:B(`distance`),color:B(`color`),brightness:B(`brightness`),red:B(`red`),green:B(`green`),blue:B(`blue`),noise:B(`noise`),blocksize:B(`blocksize`),mode:B(`mode`),alpha:B(`alpha`)};function Qv(e){return e&&e.charAt(0).toUpperCase()+e.slice(1)}var $v=class{constructor(){G.subscribe(e=>e.history.pointer,()=>{this.syncState()})}apply(e){K().filter.select(e,this.hasOptions(e));let t=this.getByName(e);if(this.isApplied(t.name)){this.remove(t.name);return}let n=this.create(t);this.getImages().forEach(e=>{var t;(t=e.filters)==null||t.push(n),e.applyFilters()}),this.syncState(),q().canvas.render()}remove(e){K().filter.deselect(e);let t=this.getByName(e);this.getImages().forEach(e=>{var n;let r=this.findFilterIndex(t.name,e.filters);(n=e.filters)==null||n.splice(r,1),e.applyFilters()}),this.syncState(),q().canvas.render()}getAll(){return Yv}getByName(e){return Yv.find(t=>t.name===e)}isApplied(e){let t=q().canvas.getMainImage();return t?this.findFilterIndex(e,t.filters)>-1:!1}applyValue(e,t,n){let r=this.getByName(e);this.getImages().forEach(e=>{let i=(e.filters||[]).find(e=>e.type.toLowerCase()===r.name.toLowerCase());i&&(i[t]=n,r.apply&&r.apply(i,t,n),e.applyFilters())}),q().canvas.render()}addCustom(e,t,n,r){let i=X.fabric.Image.filters;i[Qv(e)]=X.fabric.util.createClass(i.BaseFilter,t),i[Qv(e)].fromObject=i.BaseFilter.fromObject,Yv.push({name:e,options:n,initialConfig:r})}create(e){let t=e.initialConfig||{},n;return e.uses?(t.matrix=e.matrix,n=new X.fabric.Image.filters[Qv(e.uses)](t)):(Object.entries(e.options||{}).forEach(([e,n])=>{t[e]=n.current}),n=new X.fabric.Image.filters[Qv(e.name)](t)),n.name=e.name,n}hasOptions(e){return!!this.getByName(e).options}findFilterIndex(e,t){if(!(t!=null&&t.length))return-1;let n=this.getByName(e);return t.findIndex(e=>this.configMatchesFabricFilter(n,e))}syncState(){let e=[];(this.getImages()[0]?.filters||[]).forEach(t=>{let n=this.getByFabricFilter(t);n&&e.push(n.name)}),G.setState({filter:{...K().filter,applied:e}})}getByFabricFilter(e){return Yv.find(t=>this.configMatchesFabricFilter(t,e))}configMatchesFabricFilter(e,t){let n=t.type.toLowerCase().replace(` `,``);return n===e.fabricType||n===e.name?!0:n===`convolute`&&this.matrixAreEqual(e.matrix,t.matrix)}matrixAreEqual(e,t){if(!e||!t||e.length!==t.length)return!1;for(let n=e.length;n--;)if(e[n]!==t[n])return!1;return!0}getImages(){return q().objects.getAll().filter(e=>e.name===El.Image||e.name===El.MainImage)}};function ey(e){return e.width<ty(e.usePercentages)&&(e.width=ty(e.usePercentages),e.maintainAspect&&(e.height=oy(e.width,e.usePercentages))),e.width>ny(e.usePercentages)&&(e.width=ny(e.usePercentages),e.maintainAspect&&(e.height=oy(e.width,e.usePercentages))),e.height<ry(e.usePercentages)&&(e.height=ry(e.usePercentages),e.maintainAspect&&(e.width=ay(e.height,e.usePercentages))),e.height>iy(e.usePercentages)&&(e.height=iy(e.usePercentages),e.maintainAspect&&(e.width=ay(e.height,e.usePercentages))),e}function ty(e){let t=K().config.tools?.resize?.minWidth||50;return e?Math.ceil(t*100/K().original.width):t}function ny(e){let t=K().config.tools?.resize?.maxWidth||2400;return e?Math.ceil(t*100/K().original.width):t}function ry(e){let t=K().config.tools?.resize?.minHeight||50;return e?Math.ceil(t*100/K().original.height):t}function iy(e){let t=K().config.tools?.resize?.maxHeight||2400;return e?Math.ceil(t*100/K().original.height):t}function ay(e,t){if(t)return e;let n=K().original.height/e;return Math.floor(K().original.width/n)}function oy(e,t){if(t)return e;let n=K().original.width/e;return Math.floor(K().original.height/n)}var sy=class{apply(e){let{width:t,height:n,usePercentages:r}=ey(e),i=Math.ceil(K().original.width),a=Math.ceil(K().original.height),o=Math.ceil(t),s=Math.ceil(n),c,l;r?(c=t/100,l=n/100):(c=t/K().original.width,l=n/K().original.height),!(i===o&&a===s)&&this.resize(c,l)}resize(e,t){q().zoom.set(1,!1);let n=Math.round(K().original.height*t),r=Math.round(K().original.width*e);q().canvas.resize(r,n,{applyZoom:!1,resizeHelper:!0}),q().objects.getAll().forEach(n=>{let r=n.scaleX||1,i=n.scaleY||1,a=n.left||0,o=n.top||0,s=r*e,c=i*t,l=a*e,u=o*t;n.scaleX=s,n.scaleY=c,n.left=l,n.top=u,n.setCoords()}),q().zoom.fitToScreen(),J().requestRenderAll()}};function cy(e,t){t.innerZone!==null&&(t=t,ly(e,t),uy(e,t),dy(e,t))}function ly(e,t){t.innerZone.style.width=`${e.width}px`,t.innerZone.style.height=`${e.height}px`,t.innerZone.style.transform=`translate(${e.left}px, ${e.top}px)`}function uy(e,t){let n=K().canvasSize.width,r=K().canvasSize.height;t.maskTop.style.height=`${e.top}px`,t.maskTop.style.width=`${n}px`,t.maskLeft.style.top=`${e.top}px`,t.maskLeft.style.height=`${e.height}px`,t.maskLeft.style.width=`${e.left}px`;let i=e.left+e.width;t.maskRight.style.left=`${i}px`,t.maskRight.style.top=`${e.top}px`,t.maskRight.style.height=`${e.height}px`,t.maskRight.style.width=`${n-i}px`,t.maskBottom.style.height=`${r-(e.top+e.height)}px`,t.maskBottom.style.width=`${n}px`}function dy(e,t){let n=(e.width-2)/3;t.lineVer1.style.height=`${e.height}px`,t.lineVer1.style.transform=`translate(${n}px, 0)`,t.lineVer2.style.height=`${e.height}px`,t.lineVer2.style.transform=`translate(${n*2}px, 0)`;let r=(e.height-2)/3;t.lineHor1.style.width=`${e.width}px`,t.lineHor1.style.transform=`translate(0, ${r}px)`,t.lineHor2.style.width=`${e.width}px`,t.lineHor2.style.transform=`translate(0, ${r*2}px)`}function fy(e,t,n){let r=t,i=n;return e&&(n*e>t?i=t/e:r=n*e),{width:Math.floor(r),height:Math.floor(i)}}function py(e){if(!e)return null;let t=e.split(`:`);return parseInt(t[0])/parseInt(t[1])}function my(e,t=null){let n={width:e.width,height:e.height,top:0,left:0,angle:0};if(t){let e=fy(t,n.width,n.height);n.width=e.width,n.height=e.height}return n.left=(e.width-n.width)/2,n.top=(e.height-n.height)/2,n}var hy=class{constructor(){y(this,`refs`,null)}apply(e){let t=q().frame.active.config?.name,n=q().frame.active.currentSizeInPercent;return q().frame.active.hide(),q().merge.apply().then(()=>{q().canvas.resize(Math.round(e.width),Math.round(e.height),{applyZoom:!0,resizeHelper:!0});let r=q().canvas.getMainImage();r.cropX=Math.round(e.left),r.cropY=Math.round(e.top),r.width=Math.round(e.width),r.height=Math.round(e.height),r.viewportCenter(),t&&q().frame.add(t,n),q().zoom.fitToScreen(),q().canvas.render()})}drawZone(e){var t;(t=this.refs)!=null&&t.current&&(K().crop.setCropzoneRect(e),cy(e,this.refs.current))}resetCropzone(e){let t=K().canvasSize,n=py(e);if(!t)return;K().crop.setAspectRatio(e);let r=my(t,n);this.drawZone(r)}registerRefs(e){this.refs=e}},gy=class{getShapeByName(e){return(K().config.tools?.shapes?.items)?.find(t=>t.name===e)||null}addBasicShape(e){let t=this.getShapeByName(e);if(!t)return null;let{width:n,height:r,...i}=K().config.objectDefaults?.shape||{},a={...i,...t.options},o;if(t.name===`circle`)o=new X.fabric.Circle({...a,radius:100});else if(t.name===`ellipse`)o=new X.fabric.Ellipse({...a,rx:100,ry:50});else if(t.type===`Path`)o=new X.fabric.Path(a.path,{displayName:t.name,...a});else{let e=t.type;o=new X.fabric[e]({...a,width:150,height:150})}return this.addAndPositionShape(o,El.Shape,{width:n,height:r}),o}addSticker(e,t){let n=(K().config.tools?.stickers?.items)?.find(t=>t.name===e);if(!n)return Promise.resolve();if(n.type===`svg`){let e=_y(n,t);return this.addSvgSticker(e)}return this.addRegularSticker(n,t)}addRegularSticker(e,t){return new Promise(n=>{X.fabric.util.loadImage(_y(e,t),e=>{let{width:t,height:r,...i}=K().config.objectDefaults?.sticker||{},a=new X.fabric.Image(e,i);this.addAndPositionShape(a,El.Sticker,{width:t,height:r}),n()})})}addSvgSticker(e,t=El.Sticker){return new Promise(n=>{X.fabric.loadSVGFromURL(e,(e,r)=>{let{width:i,height:a,...o}=K().config.objectDefaults?.sticker||{},s=X.fabric.util.groupSVGElements(e,r);s.set(o),this.addAndPositionShape(s,t,{width:i,height:a}),n()})})}addAndPositionShape(e,t,{width:n}){e.name=t,e.scaleX=1,e.scaleY=1,J().add(e);let r=n||K().original.width*K().zoom/4;e.scaleToWidth(Math.min(150,r)),e.viewportCenter(),e.setCoords(),q().canvas.render(),J().setActiveObject(e)}};function _y(e,t){return Bv(`images/stickers/${e.name}/${t}.${e.type}`)}var vy=class{constructor(e){y(this,`patternCache`,[]),this.activeFrame=e}fillParts(e){this.patternCache.forEach(t=>{this.fillPartWithPattern(t,e)})}fillPartWithPattern(e,t){if(!this.activeFrame.parts)return;e.canvas=new X.fabric.StaticCanvas(null),e.canvas.add(e.img);let n=new X.fabric.Pattern({source:e.canvas.getElement(),repeat:t===`repeat`?`repeat`:`no-repeat`});this.activeFrame.parts[e.name]&&this.activeFrame.parts[e.name].set(`fill`,n)}scale(e){if(!this.activeFrame.config||!this.patternCache)return;let t=this.activeFrame.config.mode;e/=J().getRetinaScaling(),this.patternCache.forEach(n=>{this.activeFrame.parts&&(n.name===`top`||n.name===`bottom`?t===`stretch`?(this.scalePatternToWidth(n.img,this.activeFrame.parts.top.getScaledWidth()),this.scalePatternToHeight(n.img,e)):n.img.scaleToHeight(e):n.name===`left`||n.name===`right`?t===`stretch`?(this.scalePatternToWidth(n.img,e),this.scalePatternToHeight(n.img,this.activeFrame.parts.left.getScaledHeight())):n.img.scaleToWidth(e):t===`stretch`?(this.scalePatternToWidth(n.img,e),this.scalePatternToHeight(n.img,e)):n.img.scaleToWidth(e),n.canvas.setDimensions({width:n.img.getScaledWidth(),height:n.img.getScaledHeight()}))}),q().canvas.render()}scalePatternToWidth(e,t){if(!e.width)return;let n=e.getBoundingRect().width/e.getScaledWidth();e.set(`scaleX`,t/e.width/n),e.setCoords()}scalePatternToHeight(e,t){if(!e.height)return;let n=e.getBoundingRect().height/e.getScaledHeight();e.set(`scaleY`,t/e.height/n),e.setCoords()}load(e){let t=this.activeFrame.getPartNames().map(t=>new Promise(n=>{let r={...qu,originX:`left`,originY:`top`};K().config.crossOrigin&&(r.crossOrigin=`anonymous`),X.fabric.Image.fromURL(this.getPartUrl(e,t),e=>{n({name:t,img:e})},r)}));return Promise.all(t).then(t=>{this.patternCache=t,this.fillParts(e.mode)})}getPartUrl(e,t){return Bv(`images/frames/${e.name}/${t}.png`)}},yy=class{constructor(e,t){this.activeFrame=e,this.patterns=t}get defaultColor(){return K().config.objectDefaults?.global?.fill}build(e,t){if(this.createParts(e),this.resize(t),this.activeFrame.config=e,e.mode===`basic`){q().canvas.render();return}this.patterns.load(e).then(()=>{this.patterns.scale(t),q().canvas.render()})}createParts(e){let t={};this.activeFrame.getPartNames().forEach(n=>{let r=e.mode===`basic`?this.defaultColor:void 0;t[n]=new X.fabric.Rect({...qu,fill:r,originX:`left`,originY:`top`,name:`frame.rect.${n}`,objectCaching:!1,data:{pixieInternal:!0}}),J().add(t[n])}),this.activeFrame.parts=t}resize(e){let t=K().original.width,n=K().original.height,r=this.activeFrame,i=e;r.parts&&(r.parts.topLeft.set({width:i,height:i}),r.parts.topRight.set({left:t-r.parts.topLeft.getScaledWidth(),width:i,height:i}),r.parts.top.set({left:r.parts.topLeft.getScaledWidth()-1,width:t-r.parts.topLeft.getScaledWidth()-r.parts.topRight.getScaledWidth()+3,height:i}),r.parts.bottomLeft.set({top:n-r.parts.topLeft.getScaledHeight(),width:i,height:i}),r.parts.left.set({top:r.parts.topLeft.getScaledHeight()-1,width:i,height:n-r.parts.topLeft.getScaledHeight()-r.parts.bottomLeft.getScaledHeight()+3}),r.parts.bottomRight.set({left:t-r.parts.bottomLeft.getScaledWidth(),top:n-r.parts.topRight.getScaledWidth(),width:i,height:i}),r.parts.bottom.set({left:r.parts.top.left,top:n-r.parts.top.getScaledHeight(),width:r.parts.top.getScaledWidth(),height:i}),r.parts.right.set({left:t-r.parts.left.getScaledWidth(),top:r.parts.left.top,width:r.parts.left.width,height:r.parts.left.getScaledHeight()}))}},by=class{constructor(){y(this,`corners`,[`topLeft`,`topRight`,`bottomLeft`,`bottomRight`]),y(this,`sides`,[`top`,`right`,`bottom`,`left`]),y(this,`parts`,null),y(this,`config`,null),y(this,`currentSizeInPercent`,100)}getPartNames(){return[...this.corners,...this.sides]}hide(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!1})),q().canvas.render())}show(){this.parts&&(Object.values(this.parts).forEach(e=>e.set({visible:!0})),q().canvas.render())}remove(){this.parts&&(this.config=null,Object.values(this.parts).forEach(e=>{J().remove(e)}),this.parts=null,q().canvas.render())}is(e){return this.config?this.config.name===e.name:!1}changeColor(e){this.config?.mode!==`basic`||!this.parts||(Object.values(this.parts).forEach(t=>{t.set(`fill`,e)}),q().canvas.render())}getMinSize(){return this.config?.size.min??1}getMaxSize(){return this.config?.size.max??35}},xy=class{constructor(){y(this,`patterns`),y(this,`builder`),y(this,`active`),this.active=new by,this.patterns=new vy(this.active),this.builder=new yy(this.active,this.patterns),J().on(`object:added`,()=>{Object.values(this.active.parts||[]).forEach(e=>e.moveTo(98))})}add(e,t){let n=this.getByName(e);if(!n||this.active.is(n))return;this.active.remove(),this.active.currentSizeInPercent=t??n.size.default;let r=this.calcFrameSizeInPixels(this.active.currentSizeInPercent);this.builder.build(n,r),K().frame.select(n)}resize(e){if(!this.active.parts||!this.active.config)return;e?this.active.currentSizeInPercent=e:e=this.active.currentSizeInPercent;let t=this.calcFrameSizeInPixels(e);this.builder.resize(t),this.patterns.scale(t),q().canvas.render()}changeColor(e){this.active.changeColor(e)}remove(){this.active.remove(),K().frame.deselect()}getByName(e){let t=K().config.tools?.frame?.items;if(t)return t.find(t=>t.name===e)}getActiveFrameConfig(){return this.active.config}calcFrameSizeInPixels(e){let t=Math.min(K().original.width,K().original.height);return Math.ceil(e/100*t)}},Sy=class{constructor(){y(this,`minWidth`,250)}add(e,t={}){if(e||=K().config.tools?.text?.defaultText,!e)return;let n={...K().config.objectDefaults?.text,...t,name:El.Text,padding:K().config.tools?.text?.controlsPadding,editingBorderColor:Go.fill},r=new X.fabric.IText(e,n);J().add(r),t.left==null&&t.top==null&&this.autoPositionText(r),q().objects.select(r)}autoPositionText(e){let t=J().getWidth(),n=J().getHeight(),r=Math.min(J().getWidth(),this.minWidth);e.scaleToWidth(Math.max(t/3,r)),e.getScaledHeight()>n&&e.scaleToHeight(n-e.getScaledHeight()-20),e.viewportCenter(),J().getObjects(`i-text`).forEach(t=>{if(t!==e&&t.intersectsWithObject(e)){let n=t.top-e.top+t.getScaledHeight(),r=e.top+n;r>K().original.height-t.getScaledHeight()&&(r=0),e.set(`top`,r),e.setCoords()}})}selectOrAddText(e,t={}){if(K().objects.active.isText)return!1;let n=q().objects.getAll().find(e=>Tl(e));return n?(q().objects.select(n),!1):(this.add(e,t),!0)}},Cy=e=>{let t=new X.fabric.PatternBrush(e);return t.getPatternSrc=function(){let e=X.fabric.document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(`2d`);return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(0,5),t.lineTo(10,5),t.closePath(),t.stroke(),e},t},wy=e=>{let t=new X.fabric.PatternBrush(e);return t.getPatternSrc=function(){let e=document.createElement(`canvas`);e.width=10,e.height=10;let t=e.getContext(`2d`);return t.strokeStyle=this.color,t.lineWidth=5,t.beginPath(),t.moveTo(5,0),t.lineTo(5,10),t.closePath(),t.stroke(),e},t},Ty=e=>{let t=new X.fabric.PatternBrush(e);return t.getPatternSrc=function(){let e=this.width/2,t=document.createElement(`canvas`),n=new X.fabric.Rect({width:e,height:e,angle:45,fill:this.color}),r=n.getBoundingRect().width;t.width=r+5,t.height=r+5,n.set({left:r/2,top:r/2});let i=t.getContext(`2d`);return n.render(i),t},t},Ey=e=>{let t=new X.fabric.PatternBrush(e);return t.getPatternSrc=function(){let e=document.createElement(`canvas`);e.width=12,e.height=12;let t=e.getContext(`2d`);return t.fillStyle=this.color,t.fillRect(0,0,10,10),e},t},Dy=class{constructor(){y(this,`customBrushes`,{VLineBrush:Cy,HLineBrush:wy,DiamondBrush:Ty,SquareBrush:Ey}),y(this,`currentBrush`,{type:`PencilBrush`,color:K().config.objectDefaults?.global?.fill,width:qo[1]}),y(this,`onPathCreated`,e=>{e.path.name=El.Drawing,e.path.set(Oy()),K().setDirty(!0)})}enable(){J().on(`path:created`,this.onPathCreated),J().isDrawingMode=!0,this.setBrushType(this.currentBrush.type),this.setBrushSize(this.currentBrush.width)}disable(){J().off(`path:created`,this.onPathCreated),J().isDrawingMode=!1}getBrushType(){return this.currentBrush.type}setBrushType(e){this.currentBrush.type=e,J().freeDrawingBrush=e in X.fabric?new X.fabric[e](J()):this.customBrushes[e](J()),this.applyBrushStyles()}applyBrushStyles(){Object.keys(this.currentBrush).forEach(e=>{J().freeDrawingBrush[e]=this.currentBrush[e]});let e=J().freeDrawingBrush;e.getPatternSrc&&(e.source=e.getPatternSrc.call(e))}setBrushSize(e){this.currentBrush.width=e,this.applyBrushStyles()}getBrushSize(){return this.currentBrush.width}setBrushColor(e){this.currentBrush.color=e,this.applyBrushStyles()}getBrushColor(){return this.currentBrush.color}};function Oy(){let e={...qu};return delete e.strokeWidth,e}async function ky(e,t=!0,n=!0){let r=await Tv(e);if(r)return new Promise(e=>{r.name=El.Image,r.opacity=0;let i=K().original.width,a=K().original.height;if(t&&(r.width>=i||r.height>=a)){let e=i-.1*i,t=a-.1*a,n=1/Math.min(t/r.getScaledHeight(),e/r.getScaledWidth());r.scaleX*=1/n,r.scaleY*=1/n}K().fabric.add(r),n&&K().fabric.setActiveObject(r),r.viewportCenter(),r.setCoords(),K().fabric.requestRenderAll(),q().zoom.fitToScreen(),r.animate(`opacity`,`1`,{duration:425,onChange:()=>{K().fabric.requestRenderAll()},onComplete:()=>{e(r)}})})}function Ay(e){return/(?:\.([^.]+))?$/.exec(e)?.[1]||``}function jy(e){let t={md:`text/markdown`,markdown:`text/markdown`,mp4:`video/mp4`,mp3:`audio/mp3`,svg:`image/svg+xml`,jpg:`image/jpeg`,png:`image/png`,gif:`image/gif`,yaml:`text/yaml`,yml:`text/yaml`,log:`text/plain`},n=e.name?Ay(e.name):null;return e.type?e.type:n&&n in t?t[n]:`application/octet-stream`}var My=class{constructor(e,t){y(this,`id`),y(this,`fingerprint`),y(this,`name`),y(this,`relativePath`,``),y(this,`size`),y(this,`mime`,``),y(this,`extension`,``),y(this,`native`),y(this,`lastModified`),y(this,`cachedData`),this.id=$u(),this.name=e.name,this.size=e.size,this.mime=jy(e),this.lastModified=e.lastModified,this.extension=Ay(e.name)||`bin`,this.native=e,t=t||e.webkitRelativePath||``,t=t.replace(/^\/+/g,``),t&&t.split(`/`).length>1&&(this.relativePath=t),this.fingerprint=Ny({name:this.name,size:this.size,mime:this.mime,lastModified:this.lastModified})}get data(){return new Promise(e=>{this.cachedData&&e(this.cachedData);let t=new FileReader;t.addEventListener(`load`,()=>{this.cachedData=t.result,e(this.cachedData)}),this.extension===`json`?t.readAsText(this.native):t.readAsDataURL(this.native)})}};function Ny({name:e,mime:t,size:n,relativePath:r,lastModified:i}){let a=`be`;return typeof e==`string`&&(a+=`-${Fy(e.toLowerCase())}`),t&&(a+=`-${t}`),typeof r==`string`&&(a+=`-${Fy(r.toLowerCase())}`),n!==void 0&&(a+=`-${n}`),i!==void 0&&(a+=`-${i}`),a}function Py(e){return e.charCodeAt(0).toString(32)}function Fy(e){let t=``;return e.replace(/[^A-Z0-9]/gi,e=>(t+=`-${Py(e)}`,`/`))+t}function Iy(e={}){let t=document.querySelector(`#hidden-file-upload-input`);t&&t.remove();let n=document.createElement(`input`);return n.type=`file`,n.multiple=e.multiple??!1,n.classList.add(`hidden`),n.style.display=`none`,n.style.visibility=`hidden`,n.id=`hidden-file-upload-input`,n.accept=Ly(e),e.directory&&(n.webkitdirectory=!0),document.body.appendChild(n),n}function Ly({extensions:e=[],types:t=[]}){let n=[];return e!=null&&e.length&&(e=e.map(e=>e.startsWith(`.`)?e:`.${e}`),n.push(e.join(`,`))),t!=null&&t.length&&n.push(t.join(`,`)),n.join(`,`)}function Ry(e={}){return new Promise(t=>{let n=Iy(e);n.onchange=e=>{let r=e.target.files;if(!r)return t([]);t(Array.from(r).filter(e=>e.name!==`.DS_Store`).map(e=>new My(e))),n.remove()},document.body.appendChild(n),n.click()})}function zy(e,t){if(e==null)return 0;switch(t){case`KB`:return e*1024;case`MB`:return e*1024**2;case`GB`:return e*1024**3;case`TB`:return e*1024**4;case`PB`:return e*1024**5;default:return e}}var By=(e=>(e.image=`image/*`,e.audio=`audio/*`,e.text=`text/*`,e.json=`application/json`,e.video=`video/mp4,video/mpeg,video/x-m4v,video/*`,e))(By||{});function Vy(e,t=1){if(e==null||Number.isNaN(e))return``;let n=e<0,r=[`B`,`KB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`];if(n&&(e=-e),e<1)return`${(n?`-`:``)+e} B`;let i=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/1024**i);let a=r[i];return e>=10||e%1==0?`${(n?`-`:``)+e.toFixed(0)} ${a}`:`${(n?`-`:``)+e.toFixed(t)} ${a}`}function Hy(e,t){this.text=e||=``,this.hasWild=~e.indexOf(`*`),this.separator=t,this.parts=e.split(t)}Hy.prototype.match=function(e){var t=!0,n=this.parts,r,i=n.length,a;if(typeof e==`string`||e instanceof String)if(!this.hasWild&&this.text!=e)t=!1;else{for(a=(e||``).split(this.separator),r=0;t&&r<i;r++)n[r]!==`*`&&(t=r<a.length?n[r]===a[r]:!1);t&&=a}else if(typeof e.splice==`function`)for(t=[],r=e.length;r--;)this.match(e[r])&&(t[t.length]=e[r]);else if(typeof e==`object`)for(var o in t={},e)this.match(o)&&(t[o]=e[o]);return t};var Uy=function(e,t,n){var r=new Hy(e,n||/[\/\.]/);return typeof t<`u`?r.match(t):r},Wy=/[\/\+\.]/,Gy=Io(function(e,t){function n(t){var n=Uy(t,e,Wy);return n&&n.length>=2}return t?n(t.split(`;`)[0]):n});function Ky(e,t){if(!t)return;let{maxFileSize:n,allowedFileTypes:r,blockedFileTypes:i}=t;if(n&&e.size!=null&&e.size>n)return B("`:file` exceeds maximum allowed size of :size",{values:{file:e.name,size:Vy(n)}});if(r!=null&&r.length&&!qy(e,r)||i!=null&&i.length&&qy(e,i))return B(`This file type is not allowed`)}function qy(e,t){return t.map(e=>e.split(`,`)).flat().some(t=>{if(t.includes(`/`))return e.mime?Gy(e.mime.replace(/;.*?$/,``),t):!1;let n=t.replace(`.`,``).toLowerCase();return n&&e.extension?e.extension.toLowerCase()===n:!1})}var Jy=class{async uploadAndAddImage(e=!0){let t=await this.openUploadWindow();await this.openUploadedFile(t,e)}async uploadAndReplaceMainImage(){let e=await this.openUploadWindow();e&&await this.openBackgroundImage(e)}async uploadAndOpenStateFile(){let e=await this.openUploadWindow(Xy);e&&await this.loadState(await e.data)}async addImageFromUrl(e,t=!0){await ky(e,K().config.tools?.import?.fitOverlayToScreen??!0,t),q().history.addHistoryItem({name:`overlayImage`})}async addImageFromData(e,t=!0){await ky(e,K().config.tools?.import?.fitOverlayToScreen??!0,t),q().history.addHistoryItem({name:`overlayImage`})}async openUploadedFile(e,t=!0){if(!e)return;let n=await e.data;switch(e.extension){case`json`:await this.loadState(n);break;case`svg`:await q().shape.addSvgSticker(n,El.Image),q().history.addHistoryItem({name:`overlayImage`});break;default:await this.addImageFromData(n,t)}}async loadState(e){K().toggleLoading(`state`),await Gu();let t;t=typeof e==`string`?e.endsWith(`.json`)?await Ku(e):JSON.parse(e):e,t.history?K().history.reset(t.history):await q().history.addInitial(t),await q().history.reload(),K().toggleLoading(!1)}async openUploadWindow(e){var t,n;e||=Yy();let r=(await Ry(e))[0];return this.fileIsValid(r)?((n=(t=K().config).onFileOpen)==null||n.call(t,r),r):null}async openBackgroundImage(e){await Gu();let t;t=e instanceof HTMLImageElement?e.src:e instanceof My?await e.data:e;let n=await q().canvas.addMainImage(t);return await q().history.addInitial(),n}fileIsValid(e){let t=Ky(e,{maxFileSize:K().config.tools?.import?.maxFileSize??zy(10,`MB`),allowedFileTypes:[...K().config.tools?.import?.validImgExtensions??[],`json`]});return t?(ad.danger(t),!1):!0}};function Yy(){let e=K().config.tools?.import?.validImgExtensions;return e?{extensions:e}:{types:[By.image]}}var Xy={types:[`.json`,By.json]},Zy=class{constructor(){y(this,`watermark`,null),y(this,`lineStyle`,{stroke:`rgba(255,255,255,0.3)`,strokeWidth:5,strokeLineCap:`round`,strokeLineJoin:`round`})}add(e){this.createGroup(),this.addText(e),this.addLines(),J().add(this.watermark),q().canvas.render()}remove(){this.watermark&&(J().remove(this.watermark),this.watermark=null,q().canvas.render())}createGroup(){this.watermark=new X.fabric.Group(void 0,{...qu,width:K().original.width,height:K().original.height,excludeFromExport:!0,top:0,left:0,originX:`left`,originY:`top`})}addText(e){var t;let n=new X.fabric.Text(e,{fill:`rgba(255,255,255,0.3)`,strokeWidth:2,stroke:`rgba(255,255,255,0.4)`,originX:`center`,originY:`center`,fontWeight:600,fontSize:150,fontFamily:`Courier New`});n.scaleToWidth(K().original.width/2),(t=this.watermark)==null||t.add(n)}addLines(){if(!this.watermark)return;let e=this.watermark?.getObjects(`text`)[0],t=K().original.width/2,n=K().original.height/2,r=e.width/4,i=new X.fabric.Line(void 0,this.lineStyle),a=new X.fabric.Line(void 0,this.lineStyle),o=new X.fabric.Line(void 0,this.lineStyle),s=new X.fabric.Line(void 0,this.lineStyle);this.watermark.add(i,a,o,s),i.set({x1:r,y1:-100,x2:t,y2:-n}),a.set({x1:r,y1:100,x2:t,y2:n}),o.set({x1:-r,y1:-100,x2:-t,y2:-n}),s.set({x1:-r,y1:100,x2:-t,y2:n})}},Qy={exports:{}};(function(e,t){(function(e,t){t()})(Fo,function(){function t(e,t){return typeof t>`u`?t={autoBom:!1}:typeof t!=`object`&&(t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([``,e],{type:e.type}):e}function n(e,t,n){var r=new XMLHttpRequest;r.open(`GET`,e),r.responseType=`blob`,r.onload=function(){s(r.response,t,n)},r.onerror=function(){console.error(`could not download file`)},r.send()}function r(e){var t=new XMLHttpRequest;t.open(`HEAD`,e,!1);try{t.send()}catch{}return 200<=t.status&&299>=t.status}function i(e){try{e.dispatchEvent(new MouseEvent(`click`))}catch{var t=document.createEvent(`MouseEvents`);t.initMouseEvent(`click`,!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var a=typeof window==`object`&&window.window===window?window:typeof self==`object`&&self.self===self?self:typeof Fo==`object`&&Fo.global===Fo?Fo:void 0,o=a.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),s=a.saveAs||(typeof window!=`object`||window!==a?function(){}:`download`in HTMLAnchorElement.prototype&&!o?function(e,t,o){var s=a.URL||a.webkitURL,c=document.createElement(`a`);t=t||e.name||`download`,c.download=t,c.rel=`noopener`,typeof e==`string`?(c.href=e,c.origin===location.origin?i(c):r(c.href)?n(e,t,o):i(c,c.target=`_blank`)):(c.href=s.createObjectURL(e),setTimeout(function(){s.revokeObjectURL(c.href)},4e4),setTimeout(function(){i(c)},0))}:`msSaveOrOpenBlob`in navigator?function(e,a,o){if(a=a||e.name||`download`,typeof e!=`string`)navigator.msSaveOrOpenBlob(t(e,o),a);else if(r(e))n(e,a,o);else{var s=document.createElement(`a`);s.href=e,s.target=`_blank`,setTimeout(function(){i(s)})}}:function(e,t,r,i){if(i||=open(``,`_blank`),i&&(i.document.title=i.document.body.innerText=`downloading...`),typeof e==`string`)return n(e,t,r);var s=e.type===`application/octet-stream`,c=/constructor/i.test(a.HTMLElement)||a.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||s&&c||o)&&typeof FileReader<`u`){var u=new FileReader;u.onloadend=function(){var e=u.result;e=l?e:e.replace(/^data:[^;]*;/,`data:attachment/file;`),i?i.location.href=e:location=e,i=null},u.readAsDataURL(e)}else{var d=a.URL||a.webkitURL,f=d.createObjectURL(e);i?i.location=f:location.href=f,i=null,setTimeout(function(){d.revokeObjectURL(f)},4e4)}});a.saveAs=s.saveAs=s,e.exports=s})})(Qy);var $y=Qy.exports;function eb(e,t,n){t||=``,n||=512;let r=atob(e),i=[];for(let e=0;e<r.length;e+=n){let t=r.slice(e,e+n),a=Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);let o=new Uint8Array(a);i.push(o)}return new Blob(i,{type:t})}var tb=class{save(e,t,n){var r,i;let a=K().config.tools?.export;e||=a?.defaultName,t=this.getFormat(t),n=this.getQuality(n);let o=`${e}.${t}`;this.applyWaterMark();let s=t===`json`?this.getJsonState():this.getDataUrl(t,n);if(q().watermark.remove(),s)if(K().config.saveUrl)fetch(K().config.saveUrl,{method:`POST`,body:JSON.stringify({data:s,filename:o,format:t})});else if(K().config.onSave)(i=(r=K().config).onSave)==null||i.call(r,s,o,t);else{let e=this.getCanvasBlob(t,s);$y.saveAs(e,o)}}getDataUrl(e,t){try{return e===`svg`?J().toSVG():J().toDataURL({format:this.getFormat(e),quality:this.getQuality(t),multiplier:Math.max(K().original.width/J().width,K().original.height/J().height)})}catch(e){e.message.toLowerCase().includes(`tainted`)&&ad.danger(B(`Could not export canvas with external image.`))}return null}getCanvasBlob(e,t){if(e===`json`)return new Blob([t],{type:`application/json`});if(e===`svg`)return new Blob([t],{type:`image/svg+xml`});let n=`image/${e}`;return t=t.replace(/data:image\/([a-z]*)?;base64,/,``),eb(t,n)}getJsonState(){return JSON.stringify({...Ju(),history:K().history})}applyWaterMark(){let e=K().config.watermarkText;e&&q().watermark.add(e)}getFormat(e){let t=K().config.tools?.export;return e=e||t?.defaultFormat||`png`,e===`jpg`&&(e=`jpeg`),e}getQuality(e){let t=K().config.tools?.export;return e=e||t?.defaultQuality||.8,e}},nb=class{constructor(){y(this,`previewRect`,null)}async apply(e){this.previewRect||this.showPreview(),this.updatePreview(e),J().remove(this.previewRect),J().clipPath=this.previewRect;let t=q().export.getDataUrl();t&&q().canvas.clear(),this.hidePreview(),t&&await q().canvas.addMainImage(t),J().clipPath=void 0}getPreviewRadius(){return this.previewRect?.rx||0}updatePreview(e){this.previewRect&&(this.previewRect.set({rx:e,ry:e}),q().canvas.render())}showPreview(){let e=K().original.width*.04;this.previewRect=new X.fabric.Rect({width:K().original.width,height:K().original.height,rx:e,ry:e,objectCaching:!1,fill:`transparent`,name:`round.rect`,data:{pixieInternal:!0},stroke:`rgba(255,255,255,0.8)`,strokeWidth:3,strokeDashArray:[4,4],selectable:!1,evented:!1}),J().add(this.previewRect),this.previewRect.moveTo(99),this.previewRect.viewportCenter(),q().canvas.render()}hidePreview(){this.previewRect&&=(J().remove(this.previewRect),q().canvas.render(),null)}},rb=class{get straightenAnchor(){return J().getObjects().find(e=>e.name===El.StraightenAnchor)}rotateLeft(){this.rotateFixed(-90)}rotateRight(){this.rotateFixed(90)}straighten(e){this.storeObjectsRelationToHelper(),q().objects.deselectActive();let t=(this.straightenAnchor.data.rotateAngle||0)+e,n=this.getImageScale(t,this.straightenAnchor);this.straightenAnchor.angle=t,this.straightenAnchor.scaleX=n,this.straightenAnchor.scaleY=n,this.straightenAnchor.data.straightenAngle=e,this.transformObjectsBasedOnHelper()}flip(e){let t=e===`horizontal`?`flipY`:`flipX`;q().objects.getAll().forEach(e=>{e[t]=!e[t]}),q().canvas.render()}rotateFixed(e){q().zoom.set(1,!1),q().objects.deselectActive();let t=this.straightenAnchor.data.rotateAngle||0;e=Math.round(e/90)*90;let n=t+(this.straightenAnchor.data.straightenAngle||0)+e;q().canvas.resize(K().original.height,K().original.width,{applyZoom:!1,resizeHelper:!1}),this.storeObjectsRelationToHelper(),this.straightenAnchor.rotate(n),this.straightenAnchor.data.rotateAngle=t+e,this.straightenAnchor.center(),this.transformObjectsBasedOnHelper(),q().frame.resize(q().frame.active.currentSizeInPercent),requestAnimationFrame(()=>{q().zoom.fitToScreen()})}getImageScale(e,t){e=X.fabric.util.degreesToRadians(e);let n=K().original.width,r=K().original.height,i=n/2,a=r/2,o=t.width/2,s=t.height/2,c=Math.sqrt(i**2+a**2),l=Math.asin(a/c),u=(e%(Math.PI*2)+Math.PI*4)%(Math.PI*2);u>Math.PI&&(u-=Math.PI),u>Math.PI/2&&u<=Math.PI&&(u=Math.PI/2-(u-Math.PI/2));let d=Math.PI/2-l-Math.abs(u),f=Math.abs(l-Math.abs(u)),p=Math.cos(d)*c,m=Math.cos(f)*c;return Math.max(m/o,p/s)}storeObjectsRelationToHelper(){q().objects.getAll().forEach(e=>{if(e!==this.straightenAnchor){let t=X.fabric.util.multiplyTransformMatrices(X.fabric.util.invertTransform(this.straightenAnchor.calcTransformMatrix()),e.calcTransformMatrix());e.data={...e.data,relationToCanvas:t}}})}transformObjectsBasedOnHelper(){q().objects.getAll().forEach(e=>{if(e.data.relationToCanvas){let t=X.fabric.util.multiplyTransformMatrices(this.straightenAnchor.calcTransformMatrix(),e.data.relationToCanvas),n=X.fabric.util.qrDecompose(t);e.set({flipX:!1,flipY:!1}),e.setPositionByOrigin({x:n.translateX,y:n.translateY},`center`,`center`),e.set(n),e.setCoords(),e.data.relationToCanvas=null}})}resetStraightenAnchor(){let e=this.straightenAnchor;e&&J().remove(e);let t=new X.fabric.Rect({...qu,name:El.StraightenAnchor,visible:!1,width:K().original.width,height:K().original.height,data:{pixieInternal:!0,straightenAngle:0,rotateAngle:0}});J().add(t),t.viewportCenter()}};function ib(e){let t=xv(e);K().editor.fabric=t,G.setState({fabric:t}),K().editor.tools={canvas:new Dv,objects:new Iv,zoom:new wv,history:new Kv,filter:new $v,resize:new sy,crop:new hy,merge:new Jv,shape:new gy,frame:new xy,text:new Sy,draw:new Dy,transform:new rb,import:new Jy,watermark:new Zy,export:new tb,corners:new nb}}function ab(e,t){let n=new ResizeObserver(e=>{let n=e[0].contentRect;t({width:n.width,height:n.height})});return e.current&&n.observe(e.current),()=>{e.current&&n.unobserve(e.current)}}function ob(e){let t=e.getBoundingClientRect();return{top:t.top,right:t.right,bottom:t.bottom,left:t.left,width:t.width,height:t.height}}var sb=`flex flex-shrink-0 items-center justify-between px-12 py-[9px] w-full h-[54px]`,cb={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,position:`absolute`},transition:{type:`tween`,duration:.15}};function lb(e,{padding:t,equalWidth:n,variant:r}={}){switch(e){case`2xs`:return r===`link`?`text-xs`:`text-xs h-24 ${n?`w-24`:t||`px-10`}`;case`xs`:return r===`link`?`text-xs`:`text-xs h-30 ${n?`w-30`:t||`px-14`}`;case`sm`:return r===`link`?`text-sm`:`text-sm h-36 ${n?`w-36`:t||`px-18`}`;case`md`:return r===`link`?`text-base`:`text-base h-42 ${n?`w-42`:t||`px-22`}`;case`lg`:return r===`link`?`text-lg`:`text-base h-50 ${n?`w-50`:t||`px-26`}`;case`xl`:return r===`link`?`text-xl`:`text-lg h-60 ${n?`w-60`:t||`px-32`}`;default:return e||``}}function ub(e){let{variant:t,shadow:n,whitespace:r=`whitespace-nowrap`,display:i=`inline-flex`}=e,a={...e,border:e.border||`border`},o=[];return t===`outline`?o=db(a):t===`text`?o=fb(a):t===`flat`||t===`raised`?o=mb(a):t===`link`&&(o=pb(a)),[...o,n||t===`raised`&&`shadow-md`,r,i,t&&`align-middle flex-shrink-0 items-center transition-button duration-200`,`select-none appearance-none no-underline outline-none disabled:pointer-events-none disabled:cursor-default`]}function db({color:e,border:t}){let n=`disabled:text-disabled disabled:bg-transparent disabled:border-disabled-bg`;switch(e){case`primary`:return[`text-primary bg-transparent ${t} border-primary/50`,`hover:bg-primary/hover hover:border-primary`,n];case`danger`:return[`text-danger bg-transparent ${t} border-danger/50`,`hover:bg-danger/4 hover:border-danger`,n];case`positive`:return[`text-positive bg-transparent ${t} border-positive/50`,`hover:bg-positive/4 hover:border-positive`,n];case`paper`:return[`text bg-paper ${t}`,`hover:bg-hover`,n];case`white`:return[`text-white bg-transparent border border-white`,`hover:bg-white/20`,`disabled:text-white/70 disabled:border-white/70 disabled:bg-transparent`];default:return[`bg-transparent ${t}`,`hover:bg-hover`,n]}}function fb({color:e}){let t=`disabled:text-disabled disabled:bg-transparent`;switch(e){case`primary`:return[`text-primary bg-transparent border-transparent`,`hover:bg-primary/4`,t];case`danger`:return[`text-danger bg-transparent border-transparent`,`hover:bg-danger/4`,t];case`positive`:return[`text-positive bg-transparent border-transparent`,`hover:bg-positive/4`,t];case`white`:return[`text-white bg-transparent border-transparent`,`hover:bg-white/20`,`disabled:text-white/70 disabled:bg-transparent`];default:return[`bg-transparent border-transparent`,`hover:bg-hover`,t]}}function pb({color:e}){switch(e){case`primary`:return[`text-primary`,`hover:underline`,`disabled:text-disabled`];case`danger`:return[`text-danger`,`hover:underline`,`disabled:text-disabled`];default:return[`text-main`,`hover:underline`,`disabled:text-disabled`]}}function mb({color:e,border:t}){let n=`disabled:text-disabled disabled:bg-disabled disabled:border-transparent disabled:shadow-none`;switch(e){case`primary`:return[`text-on-primary bg-primary ${t} border-primary`,`hover:bg-primary-dark hover:border-primary-dark`,n];case`danger`:return[`text-white bg-danger ${t} border-danger`,`hover:bg-danger/90 hover:border-danger/90`,n];case`chip`:return[`text-main bg-chip ${t} border-chip`,`hover:bg-chip/90 hover:border-chip/90`,n];case`paper`:return[`text-main bg-paper ${t} border-paper`,`hover:bg-paper/90 hover:border-paper/90`,n];case`white`:return[`text-black bg-white ${t} border-white`,`hover:bg-white`,n];default:return[`bg ${t} border-background`,`hover:bg-hover`,n]}}function hb(e){return e&&(t=>{t.currentTarget.contains(t.target)&&e(t)})}var gb=(0,l.forwardRef)((e,t)=>{let{children:n,color:r=null,variant:i,radius:a,shadow:o,whitespace:s,justify:c=`justify-center`,className:l,href:u,form:d,border:f,elementType:p,to:h,relative:g,replace:_,end:v,display:y,type:b=`button`,onClick:x,onPointerDown:S,onPointerUp:C,onKeyDown:w,...T}=e,E=p||(u?`a`:`button`),D=E===`a`;return(0,m.jsx)(E,{ref:t,form:D?void 0:d,href:u,to:h,relative:g,type:D?void 0:b,replace:_,end:v,onPointerDown:hb(S),onPointerUp:hb(C),onClick:hb(x),onKeyDown:hb(w),className:H(`focus-visible:ring`,ub({variant:i,color:r,border:f,whitespace:s,display:y}),a,c,l),...T,children:n})}),_b=l.default.forwardRef(({children:e,startIcon:t,endIcon:n,size:r=`sm`,sizeClassName:i,className:a,equalWidth:o=!1,radius:s=`rounded-button`,variant:c=`text`,disabled:l,elementType:u,to:d,replace:f,href:p,download:h,...g},_)=>(0,m.jsxs)(gb,{className:H(`font-semibold`,i||lb(r,{equalWidth:o,variant:c}),a),ref:_,radius:s,variant:c,disabled:l,to:l?void 0:d,href:l?void 0:p,download:l?void 0:h,elementType:l?void 0:u,replace:l?void 0:f,...g,children:[t&&(0,m.jsx)(vb,{position:`start`,icon:t,size:r}),e,n&&(0,m.jsx)(vb,{position:`end`,icon:n,size:r})]}));function vb({icon:e,position:t,size:n}){let r=H(`m-auto`,{"-ml-4 mr-8":t===`start`,"-mr-4 ml-8":t===`end`},e.props.className);return l.default.cloneElement(e,{className:r,size:n})}var yb=(0,l.createContext)(null);function bb(){return(0,l.useContext)(yb)}var xb=U((0,m.jsx)(`path`,{d:`M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41L9 16.17z`}),`CheckOutlined`),Sb=l.default.forwardRef((e,t)=>{let{startIcon:n,capitalizeFirst:r,children:i,description:a,endIcon:o,endSection:s,isDisabled:c,isActive:l,isSelected:u,showCheckmark:d,elementType:f=`div`,radius:p,padding:h,...g}=e;!n&&d&&(n=(0,m.jsx)(xb,{size:`sm`,className:H(`text-primary`,!u&&`invisible`)}));let _=H(`icon-sm rounded overflow-hidden flex-shrink-0`,!c&&`text-muted`),v=H(!c&&`text-muted`);return(0,m.jsxs)(f,{...g,"aria-disabled":c,className:Cb(e),ref:t,children:[n&&(0,m.jsx)(`div`,{className:_,children:n}),(0,m.jsxs)(`div`,{className:H(`min-w-auto mr-auto w-full overflow-hidden overflow-ellipsis`,r&&`first-letter:capitalize`),children:[i,a&&(0,m.jsx)(`div`,{className:H(`mt-4 whitespace-normal text-xs`,c?`text-disabled`:`text-muted`),children:a})]}),(o||s)&&(0,m.jsx)(`div`,{className:o?_:v,children:o||s})]})});function Cb({className:e,isSelected:t,isActive:n,isDisabled:r,showCheckmark:i,endIcon:a,endSection:o,radius:s,padding:c}){let l=``;l=r?`text-disabled pointer-events-none`:t?n?`bg-primary/focus`:`bg-primary/selected hover:bg-primary/focus`:n?`hover:bg-fg-base/15 bg-focus`:`hover:bg-hover`;let u;return u=c||(i?a||o?`pl-8 pr-8 py-8`:`pl-8 pr-24 py-8`:`px-20 py-8`),H(`w-full select-none outline-none cursor-pointer`,`text-sm truncate flex items-center gap-10`,!r&&`text-main`,u,l,e,s)}function wb({children:e,value:t,startIcon:n,endIcon:r,endSection:i,description:a,capitalizeFirst:o,textLabel:s,isDisabled:c,onSelected:l,onClick:u,...d}){let{collection:f,showCheckmark:p,virtualFocus:h,listboxId:g,role:_,listItemsRef:v,handleItemSelection:y,state:{selectedValues:b,activeIndex:x,setActiveIndex:S}}=bb(),C=b.includes(t),w=f.get(t)?.index,T=x===w;if(w==null)return null;let E=T&&!c?-1:0;return(0,m.jsx)(Sb,{...d,onFocus:()=>{h||S(w)},onPointerEnter:e=>{S(w),h||e.currentTarget.focus()},onPointerDown:e=>{h&&e.preventDefault()},onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),y(t),l?.())},onClick:e=>{y(t),l?.(),u?.(e)},ref:e=>v.current[w]=e,id:`${g}-${w}`,role:_===`menu`?`menuitem`:`option`,tabIndex:h?void 0:E,"aria-selected":T&&C,showCheckmark:p,isDisabled:c,isActive:T,isSelected:C,startIcon:n,description:a,endIcon:r,endSection:i,capitalizeFirst:o,"data-value":t,children:e})}var Tb={exports:{}};(function(e){(function(){var t=Object.assign;typeof t!=`function`&&(t=function(){var e=arguments,t=arguments[0];if(t==null)throw TypeError(`Cannot convert undefined or null to object`);t=Object(t);for(var n=1;n<e.length;n++)if(e[n]&&typeof e[n]==`object`)for(var r in e[n])t[r]=e[n][r];return t});function n(e){var t=e+``,n=t.indexOf(`...`);return n>=0&&(n<t.indexOf(`)`)||t.indexOf(`arguments`)>=0)}function r(e,r){r||={};var i=r.vargs||n(e),a=Object.create(null),o=[],s=[],c,l=new WeakMap,u=r.maxAge>0&&r.maxAge<1/0?function(e,t,n){return setTimeout(function(){if(n){t.splice(e,1),n.splice(e,1);return}t instanceof WeakMap?t.delete(e):delete t[e]},r.maxAge)}:0,d=r.equals?r.equals:function(e,t){return e===t},f=r.maxArgs,p=r.serializer,m,h;return e.length===1&&!r.equals&&!i?(m=(function(t){var n=typeof t;if(!p&&(n===`object`&&t||n===`function`)){var r;return l.get(t)||(!u||u(t,l),l.set(t,r=e.call(this,t)),r)}var i=n===`number`||n===`boolean`||t==null?t:n===`string`?JSON.stringify(t):p(t);return a[i]||(!u||u(i,a),a[i]=e.call(this,t))}).bind(this),h=1):m=(function(){var t=arguments.length;if(!t&&c!=null)return s[c];var n=f||t,r;for(r=o.length-1;r>=0;r--)if(!(!f&&o[r].length!==n)){for(var i=n-1;i>=0&&d(o[r][i],arguments[i]);i--)if(i===0)return s[r]}return r=o.length-(r+1),!t&&c==null&&(c=r),!u||u(r,s,o),s[r]=e.apply(this,o[r]=arguments)}).bind(this),m.clear=function(){l=new WeakMap,a=Object.create(null),o=[],s=[],c=void 0},m.keys=function(){return h?null:o.slice()},m.values=function(){return h?null:s.slice()},m.keyValues=function(){return h?{primitives:t({},a),objects:l}:null},m}e.exports=r,typeof window<`u`&&(window.nanomemoize=r)}).call(Fo)})(Tb);var Eb=Tb.exports,Db=Io(Eb);function Ob({children:e,label:t,index:n}){let r=(0,l.useId)();return(0,m.jsxs)(`div`,{role:`group`,className:H(n!==0&&`border-t my-4`),"aria-labelledby":t?`be-select-${r}`:void 0,children:[t&&(0,m.jsx)(`div`,{className:`block uppercase text-muted text-xs px-16 py-10`,role:`presentation`,id:`be-select-${r}`,"aria-hidden":`true`,children:t}),e]})}var kb=Db(({maxItems:e,children:t,items:n,inputValue:r})=>{let i=jb({children:t,items:n}),a=Ab({collection:i,inputValue:r});return e&&(i=new Map([...i.entries()].slice(0,e)),a=new Map([...a.entries()].slice(0,e))),{collection:i,filteredCollection:a}}),Ab=Db(({collection:e,inputValue:t})=>{let n=new Map,r=t?`${t}`.toLowerCase().trim():``;if(!r)n=e;else{let t=0;e.forEach((e,i)=>{(e.item?JSON.stringify(e.item):e.textLabel).toLowerCase().trim().includes(r)&&n.set(i,{...e,index:t++})})}return n}),jb=Db(({children:e,items:t})=>{let n;n=t&&typeof e==`function`?t.map(t=>e(t)):e;let r=new Map,i=0,a=(e,n,a,o)=>{let s=i++,c=n?t?.[a].items[o]:t?.[s];r.set(e.props.value,{index:s,element:e,textLabel:Mb(e),item:c,section:n,isDisabled:e.props.isDisabled,value:e.props.value})};return l.Children.forEach(n,(e,t)=>{(0,l.isValidElement)(e)&&(e.type===Ob?l.Children.forEach(e.props.children,(n,r)=>{a(n,e,t,r)}):a(e))}),r});function Mb(e){var t;let n=e.props.children;return e.props.textLabel?e.props.textLabel:(t=n?.props)!=null&&t.message?n.props.message:`${n}`||``}var Nb=Math.min,Pb=Math.max,Fb=Math.round,Ib=Math.floor,Lb=e=>({x:e,y:e}),Rb={left:`right`,right:`left`,bottom:`top`,top:`bottom`},zb={start:`end`,end:`start`};function Bb(e,t,n){return Pb(e,Nb(t,n))}function Vb(e,t){return typeof e==`function`?e(t):e}function Hb(e){return e.split(`-`)[0]}function Ub(e){return e.split(`-`)[1]}function Wb(e){return e===`x`?`y`:`x`}function Gb(e){return e===`y`?`height`:`width`}function Kb(e){return[`top`,`bottom`].includes(Hb(e))?`y`:`x`}function qb(e){return Wb(Kb(e))}function Jb(e,t,n){n===void 0&&(n=!1);let r=Ub(e),i=qb(e),a=Gb(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$b(o)),[o,$b(o)]}function Yb(e){let t=$b(e);return[Xb(e),t,Xb(t)]}function Xb(e){return e.replace(/start|end/g,e=>zb[e])}function Zb(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function Qb(e,t,n,r){let i=Ub(e),a=Zb(Hb(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Xb)))),a}function $b(e){return e.replace(/left|right|bottom|top/g,e=>Rb[e])}function ex(e){return{top:0,right:0,bottom:0,left:0,...e}}function tx(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ex(e)}function nx(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function rx(e,t,n){let{reference:r,floating:i}=e,a=Kb(t),o=qb(t),s=Gb(o),c=Hb(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Ub(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}var ix=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rx(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=rx(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function ax(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=Vb(t,e),m=tx(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=nx(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(h)))==null||n?h:h.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=nx(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}var ox=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Vb(e,t)||{};if(l==null)return{};let d=tx(u),f={x:n,y:r},p=qb(i),m=Gb(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Nb(d[_],T),D=Nb(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Bb(O,A,k),M=!c.arrow&&Ub(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),sx=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Vb(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Hb(r),_=Hb(o)===o,v=await(s.isRTL==null?void 0:s.isRTL(c.floating)),y=d||(_||!m?[$b(o)]:Yb(o));!d&&p!==`none`&&y.push(...Qb(o,m,p,v));let b=[o,...y],x=await ax(t,h),S=[],C=i.flip?.overflows||[];if(l&&S.push(x[g]),u){let e=Jb(r,a,v);S.push(x[e[0]],x[e[1]])}if(C=[...C,{placement:r,overflows:S}],!S.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=b[e];if(t)return{data:{index:e,overflows:C},reset:{placement:t}};let n=C.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=C.map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};async function cx(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hb(n),s=Ub(n),c=Kb(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=Vb(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:0,crossAxis:0,alignmentAxis:null,...d};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var lx=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await cx(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ux=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=Vb(e,t),l={x:n,y:r},u=await ax(t,c),d=Kb(Hb(i)),f=Wb(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=Bb(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=Bb(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r}}}}},dx=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){let{placement:n,rects:r,platform:i,elements:a}=t,{apply:o=()=>{},...s}=Vb(e,t),c=await ax(t,s),l=Hb(n),u=Ub(n),d=Kb(n)===`y`,{width:f,height:p}=r.floating,m,h;l===`top`||l===`bottom`?(m=l,h=u===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?`start`:`end`)?`left`:`right`):(h=l,m=u===`end`?`top`:`bottom`);let g=p-c.top-c.bottom,_=f-c.left-c.right,v=Nb(p-c[m],g),y=Nb(f-c[h],_),b=!t.middlewareData.shift,x=v,S=y;if(d?S=u||b?Nb(y,_):_:x=u||b?Nb(v,g):g,b&&!u){let e=Pb(c.left,0),t=Pb(c.right,0),n=Pb(c.top,0),r=Pb(c.bottom,0);d?S=f-2*(e!==0||t!==0?e+t:Pb(c.left,c.right)):x=p-2*(n!==0||r!==0?n+r:Pb(c.top,c.bottom))}await o({...t,availableWidth:S,availableHeight:x});let C=await i.getDimensions(a.floating);return f!==C.width||p!==C.height?{reset:{rects:!0}}:{}}}};function fx(e){return hx(e)?(e.nodeName||``).toLowerCase():`#document`}function px(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function mx(e){return((hx(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function hx(e){return e instanceof Node||e instanceof px(e).Node}function gx(e){return e instanceof Element||e instanceof px(e).Element}function _x(e){return e instanceof HTMLElement||e instanceof px(e).HTMLElement}function vx(e){return typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof px(e).ShadowRoot}function yx(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Tx(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function bx(e){return[`table`,`td`,`th`].includes(fx(e))}function xx(e){let t=Cx(),n=Tx(e);return n.transform!==`none`||n.perspective!==`none`||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||[`transform`,`perspective`,`filter`].some(e=>(n.willChange||``).includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>(n.contain||``).includes(e))}function Sx(e){let t=Dx(e);for(;_x(t)&&!wx(t);){if(xx(t))return t;t=Dx(t)}return null}function Cx(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}function wx(e){return[`html`,`body`,`#document`].includes(fx(e))}function Tx(e){return px(e).getComputedStyle(e)}function Ex(e){return gx(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Dx(e){if(fx(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||vx(e)&&e.host||mx(e);return vx(t)?t.host:t}function Ox(e){let t=Dx(e);return wx(t)?e.ownerDocument?e.ownerDocument.body:e.body:_x(t)&&yx(t)?t:Ox(t)}function kx(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ox(e),i=r===e.ownerDocument?.body,a=px(r);return i?t.concat(a,a.visualViewport||[],yx(r)?r:[],a.frameElement&&n?kx(a.frameElement):[]):t.concat(r,kx(r,[],n))}function Ax(e){let t=Tx(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=_x(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Fb(n)!==a||Fb(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function jx(e){return gx(e)?e:e.contextElement}function Mx(e){let t=jx(e);if(!_x(t))return Lb(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Ax(t),o=(a?Fb(n.width):n.width)/r,s=(a?Fb(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Nx=Lb(0);function Px(e){let t=px(e);return!Cx()||!t.visualViewport?Nx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fx(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==px(e)?!1:t}function Ix(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=jx(e),o=Lb(1);t&&(r?gx(r)&&(o=Mx(r)):o=Mx(e));let s=Fx(a,n,r)?Px(a):Lb(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=px(a),t=r&&gx(r)?px(r):r,n=e,i=n.frameElement;for(;i&&r&&t!==n;){let e=Mx(i),t=i.getBoundingClientRect(),r=Tx(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=px(i),i=n.frameElement}}return nx({width:u,height:d,x:c,y:l})}var Lx=[`:popover-open`,`:modal`];function Rx(e){return Lx.some(t=>{try{return e.matches(t)}catch{return!1}})}function zx(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=mx(r),s=t?Rx(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Lb(1),u=Lb(0),d=_x(r);if((d||!d&&!a)&&((fx(r)!==`body`||yx(o))&&(c=Ex(r)),_x(r))){let e=Ix(r);l=Mx(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x,y:n.y*l.y-c.scrollTop*l.y+u.y}}function Bx(e){return Array.from(e.getClientRects())}function Vx(e){return Ix(mx(e)).left+Ex(e).scrollLeft}function Hx(e){let t=mx(e),n=Ex(e),r=e.ownerDocument.body,i=Pb(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Pb(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Vx(e),s=-n.scrollTop;return Tx(r).direction===`rtl`&&(o+=Pb(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Ux(e,t){let n=px(e),r=mx(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Cx();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}function Wx(e,t){let n=Ix(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=_x(e)?Mx(e):Lb(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Gx(e,t,n){let r;if(t===`viewport`)r=Ux(e,n);else if(t===`document`)r=Hx(mx(e));else if(gx(t))r=Wx(t,n);else{let n=Px(e);r={...t,x:t.x-n.x,y:t.y-n.y}}return nx(r)}function Kx(e,t){let n=Dx(e);return n===t||!gx(n)||wx(n)?!1:Tx(n).position===`fixed`||Kx(n,t)}function qx(e,t){let n=t.get(e);if(n)return n;let r=kx(e,[],!1).filter(e=>gx(e)&&fx(e)!==`body`),i=null,a=Tx(e).position===`fixed`,o=a?Dx(e):e;for(;gx(o)&&!wx(o);){let t=Tx(o),n=xx(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&[`absolute`,`fixed`].includes(i.position)||yx(o)&&!n&&Kx(e,o))?r=r.filter(e=>e!==o):i=t,o=Dx(o)}return t.set(e,r),r}function Jx(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Rx(t)?[]:qx(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Gx(t,n,i);return e.top=Pb(r.top,e.top),e.right=Nb(r.right,e.right),e.bottom=Nb(r.bottom,e.bottom),e.left=Pb(r.left,e.left),e},Gx(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Yx(e){let{width:t,height:n}=Ax(e);return{width:t,height:n}}function Xx(e,t,n){let r=_x(t),i=mx(t),a=n===`fixed`,o=Ix(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=Lb(0);if(r||!r&&!a)if((fx(t)!==`body`||yx(i))&&(s=Ex(t)),r){let e=Ix(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&(c.x=Vx(i));return{x:o.left+s.scrollLeft-c.x,y:o.top+s.scrollTop-c.y,width:o.width,height:o.height}}function Zx(e){return Tx(e).position===`static`}function Qx(e,t){return!_x(e)||Tx(e).position===`fixed`?null:t?t(e):e.offsetParent}function $x(e,t){let n=px(e);if(Rx(e))return n;if(!_x(e)){let t=Dx(e);for(;t&&!wx(t);){if(gx(t)&&!Zx(t))return t;t=Dx(t)}return n}let r=Qx(e,t);for(;r&&bx(r)&&Zx(r);)r=Qx(r,t);return r&&wx(r)&&Zx(r)&&!xx(r)?n:r||Sx(e)||n}var eS=async function(e){let t=this.getOffsetParent||$x,n=this.getDimensions,r=await n(e.floating);return{reference:Xx(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tS(e){return Tx(e).direction===`rtl`}var nS={convertOffsetParentRelativeRectToViewportRelativeRect:zx,getDocumentElement:mx,getClippingRect:Jx,getOffsetParent:$x,getElementRects:eS,getClientRects:Bx,getDimensions:Yx,getScale:Mx,isElement:gx,isRTL:tS};function rS(e,t){let n=null,r,i=mx(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let{left:l,top:u,width:d,height:f}=e.getBoundingClientRect();if(s||t(),!d||!f)return;let p=Ib(u),m=Ib(i.clientWidth-(l+d)),h=Ib(i.clientHeight-(u+f)),g=Ib(l),_={rootMargin:-p+`px `+-m+`px `+-h+`px `+-g+`px`,threshold:Pb(0,Nb(1,c))||1},v=!0;function y(e){let t=e[0].intersectionRatio;if(t!==c){if(!v)return o();t?o(!1,t):r=setTimeout(()=>{o(!1,1e-7)},1e3)}v=!1}try{n=new IntersectionObserver(y,{..._,root:i.ownerDocument})}catch{n=new IntersectionObserver(y,_)}n.observe(e)}return o(!0),a}function iS(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=jx(e),u=i||a?[...l?kx(l):[],...kx(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?rS(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?Ix(e):null;c&&g();function g(){let t=Ix(e);h&&(t.x!==h.x||t.y!==h.y||t.width!==h.width||t.height!==h.height)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var aS=lx,oS=ux,sS=sx,cS=dx,lS=ox,uS=(e,t,n)=>{let r=new Map,i={platform:nS,...n},a={...i.platform,_c:r};return ix(e,t,{...i,platform:a})},dS=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:lS({element:r.current,padding:i}).fn(n):r?lS({element:r,padding:i}).fn(n):{}}}},fS=typeof document<`u`?l.useLayoutEffect:l.useEffect;function pS(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!pS(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pS(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function mS(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function hS(e,t){let n=mS(e);return Math.round(t*n)/n}function gS(e){let t=l.useRef(e);return fS(()=>{t.current=e}),t}function _S(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:d}=e,[f,p]=l.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,h]=l.useState(r);pS(m,r)||h(r);let[g,_]=l.useState(null),[v,y]=l.useState(null),b=l.useCallback(e=>{e!=w.current&&(w.current=e,_(e))},[_]),x=l.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[y]),S=a||g,C=o||v,w=l.useRef(null),T=l.useRef(null),E=l.useRef(f),D=gS(c),O=gS(i),k=l.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:m};O.current&&(e.platform=O.current),uS(w.current,T.current,e).then(e=>{let t={...e,isPositioned:!0};A.current&&!pS(E.current,t)&&(E.current=t,u.flushSync(()=>{p(t)}))})},[m,t,n,O]);fS(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,p(e=>({...e,isPositioned:!1})))},[d]);let A=l.useRef(!1);fS(()=>(A.current=!0,()=>{A.current=!1}),[]),fS(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(D.current)return D.current(S,C,k);k()}},[S,C,k,D]);let j=l.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),M=l.useMemo(()=>({reference:S,floating:C}),[S,C]),N=l.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=hS(M.floating,f.x),r=hS(M.floating,f.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...mS(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,f.x,f.y]);return l.useMemo(()=>({...f,update:k,refs:j,elements:M,floatingStyles:N}),[f,k,j,M,N])}function vS(e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}function yS({floatingWidth:e,ref:t,disablePositioning:n=!1,placement:r=`bottom`,offset:i=2,showArrow:a=!1,maxHeight:o,shiftCrossAxis:s=!0,fallbackPlacements:c}){let u=(0,l.useRef)(null),d={placement:r,strategy:`fixed`};n||(d.whileElementsMounted=iS,d.middleware=[aS(i),oS({padding:16,crossAxis:s,mainAxis:!0}),sS({padding:16,fallbackPlacements:c}),cS({apply({rects:t,availableHeight:n,availableWidth:r,elements:i}){e===`matchTrigger`&&o!=null?Object.assign(i.floating.style,{width:`${t.reference.width}px`,maxWidth:`${r}`,maxHeight:`${Math.min(n,o)}px`}):o!=null&&Object.assign(i.floating.style,{maxHeight:`${Math.min(n,o)}px`})},padding:16})],a&&d.middleware.push(dS({element:u})));let f=_S(d),p=(0,l.useMemo)(()=>vS([t,f.refs.setReference]),[f.refs.setReference,t]),{x:m,y:h}=f.middlewareData.arrow||{},g={left:m,top:h,right:``,bottom:``,[{top:`bottom`,right:`left`,bottom:`top`,left:`right`}[f.placement.split(`-`)[0]]]:`-4px`};return{...f,reference:p,arrowRef:u,arrowStyle:g}}function bS(e,t){let{children:n,items:r,role:i=`listbox`,virtualFocus:a,focusLoopingMode:o=`stay`,autoFocusFirstItem:s=!0,onItemSelected:c,clearInputOnItemSelection:u,blurReferenceOnItemSelection:d,floatingWidth:f=`matchTrigger`,floatingMinWidth:p,floatingMaxHeight:m,offset:h,placement:g,showCheckmark:_,showEmptyMessage:v,maxItems:y,isAsync:b,allowCustomValue:x,clearSelectionOnInputClear:S}=e,C=e.selectionMode||`none`,w=`${(0,l.useId)()}-listbox`,[T,E]=pv(e.inputValue,e.defaultInputValue||``,e.onInputValueChange),[D,O]=(0,l.useState)(`all`),k=kb({children:n,items:r,inputValue:b?void 0:T,maxItems:y}),A=D===`all`?k.collection:k.filteredCollection,j=(0,l.useRef)([]),M=(0,l.useMemo)(()=>[...A.values()].map(e=>e.isDisabled?null:e.textLabel),[A]),{selectedValues:N,selectValues:P}=SS(e),[ee,F]=pv(e.isOpen,e.defaultIsOpen,e.onOpenChange),[te,ne]=(0,l.useState)(null),re=yS({floatingWidth:f,ref:t,placement:g,offset:h,maxHeight:m??420,shiftCrossAxis:!a}),{refs:I,strategy:ie,x:ae,y:L}=re,oe=C===`none`?void 0:A.get(N[0]),se=C===`none`||oe==null?void 0:oe.index,ce=e=>{if(C!==`none`){let t=[...A.values()][e];t&&P(t.value)}},le=(0,l.useCallback)((e,t)=>{var n,r;let i=[...A.values()],s=!i.find(e=>!e.isDisabled),c=A.size-1;if(t==null||!A.size||t>c||t<0||s){ne(null);return}t=xS(i,t,o,e),ne(t),t!=null&&(a?(n=j.current[t])==null||n.scrollIntoView({block:`nearest`}):(r=j.current[t])==null||r.focus())},[A,a,o]);return{handleItemSelection:e=>{let t=I.reference.current;C===`none`?t&&`focus`in t&&t.focus():P(e),a&&(E(u?``:`${e}`),d&&t&&`blur`in t&&t.blur()),O(`all`),F(!1),c?.(e),ne(null)},onInputChange:(0,l.useCallback)(e=>{E(e.target.value),O(e.target.value.trim()?`filtered`:`all`),e.target.value?F(!0):S&&P(``),s&&te==null?le(`increment`,0):ne(null)},[E,F,O,P,S,le,s,te]),focusLoopingMode:o,floatingWidth:f,floatingMinWidth:p,floatingMaxHeight:m,showCheckmark:_,collection:A,collections:k,virtualFocus:a,focusItem:le,showEmptyMessage:v&&!!T,allowCustomValue:x,refs:I,reference:re.reference,floating:I.setFloating,positionStyle:{position:ie,top:L??``,left:ae??``},listContent:M,listItemsRef:j,listboxId:w,role:i,state:{activeIndex:te,setActiveIndex:ne,selectedIndex:se,setSelectedIndex:ce,selectionMode:C,selectedValues:N,selectValues:P,inputValue:T,setInputValue:E,isOpen:ee,setIsOpen:F,setActiveCollection:O}}}function xS(e,t,n,r){var i;let a=e.length-1;for(;(i=e[t])!=null&&i.isDisabled;)if(r===`increment`){if(t++,t>=a)if(n===`loop`)t=0;else return n===`stay`?t-1:null}else if(t--,t<0)if(n===`loop`)t=a;else return n===`stay`?t+1:null;return t}function SS(e){let{selectionMode:t,allowEmptySelection:n}=e,r=t===`single`||t===`multiple`,[i,a]=pv(r?e.selectedValue:void 0,r?e.defaultSelectedValue:void 0,r?e.onSelectionChange:void 0),o=(0,l.useMemo)(()=>typeof i>`u`?[]:Array.isArray(i)?i:[i],[i]);return{selectedValues:o,selectValues:(0,l.useCallback)(e=>{let r=Array.isArray(e)?e:[e];t===`single`?a(r[0]):r.forEach(e=>{let t=o.indexOf(e);t===-1?(o.push(e),a([...o])):(o.length>1||n)&&(o.splice(t,1),a([...o]))})},[n,o,t,a])}}var CS=768;function wS(){return V_()||typeof window>`u`?Vu().is_mobile_device??!1:window.screen.width<=CS}var TS=null,ES=new Set,DS=new Map,OS=!1,kS=!1;function AS(e,t){for(let n of ES)n(e,t)}function jS(e){return!(e.metaKey||!tv()&&e.altKey||e.ctrlKey||e.key===`Control`||e.key===`Shift`||e.key===`Meta`)}function MS(e){OS=!0,jS(e)&&(TS=`keyboard`,AS(`keyboard`,e))}function NS(e){TS=`pointer`,(e.type===`mousedown`||e.type===`pointerdown`)&&(OS=!0,AS(`pointer`,e))}function PS(e){fv(e)&&(OS=!0,TS=`virtual`)}function FS(e){e.target===window||e.target===document||(!OS&&!kS&&(TS=`virtual`,AS(`virtual`,e)),OS=!1,kS=!1)}function IS(){OS=!1,kS=!0}function LS(e){if(typeof window>`u`||DS.get(K_(e)))return;let t=K_(e),n=G_(e),r=t.HTMLElement.prototype.focus;t.HTMLElement.prototype.focus=function(){OS=!0,r.apply(this,arguments)},n.addEventListener(`keydown`,MS,!0),n.addEventListener(`keyup`,MS,!0),n.addEventListener(`click`,PS,!0),t.addEventListener(`focus`,FS,!0),t.addEventListener(`blur`,IS,!1),typeof PointerEvent<`u`?(n.addEventListener(`pointerdown`,NS,!0),n.addEventListener(`pointermove`,NS,!0),n.addEventListener(`pointerup`,NS,!0)):(n.addEventListener(`mousedown`,NS,!0),n.addEventListener(`mousemove`,NS,!0),n.addEventListener(`mouseup`,NS,!0)),t.addEventListener(`beforeunload`,()=>{RS(e)},{once:!0}),DS.set(t,{focus:r})}var RS=(e,t)=>{let n=K_(e),r=G_(e);t&&r.removeEventListener(`DOMContentLoaded`,t),DS.has(n)&&(n.HTMLElement.prototype.focus=DS.get(n).focus,r.removeEventListener(`keydown`,MS,!0),r.removeEventListener(`keyup`,MS,!0),r.removeEventListener(`click`,PS,!0),n.removeEventListener(`focus`,FS,!0),n.removeEventListener(`blur`,IS,!1),typeof PointerEvent<`u`?(r.removeEventListener(`pointerdown`,NS,!0),r.removeEventListener(`pointermove`,NS,!0),r.removeEventListener(`pointerup`,NS,!0)):(r.removeEventListener(`mousedown`,NS,!0),r.removeEventListener(`mousemove`,NS,!0),r.removeEventListener(`mouseup`,NS,!0)),DS.delete(n))};function zS(e){let t=G_(e),n;return t.readyState===`loading`?(n=()=>{LS(e)},t.addEventListener(`DOMContentLoaded`,n)):LS(e),()=>RS(e,n)}typeof document<`u`&&zS();function BS(){return TS}function VS(e){let t=G_(e);if(BS()===`virtual`){let n=t.activeElement;ov(()=>{t.activeElement===n&&e.isConnected&&J_(e)})}else J_(e)}function HS(e){let t=K_(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:n,visibility:r}=e.style,i=n!==`none`&&r!==`hidden`&&r!==`collapse`;if(i){let{getComputedStyle:t}=e.ownerDocument.defaultView,{display:n,visibility:r}=t(e);i=n!==`none`&&r!==`hidden`&&r!==`collapse`}return i}function US(e,t){return!e.hasAttribute(`hidden`)&&!e.hasAttribute(`data-react-aria-prevent-focus`)&&(e.nodeName===`DETAILS`&&t&&t.nodeName!==`SUMMARY`?e.hasAttribute(`open`):!0)}function WS(e,t){return e.nodeName!==`#comment`&&HS(e)&&US(e,t)&&(!e.parentElement||WS(e.parentElement,e))}var GS=l.default.createContext(null),KS=null;function qS(e){let{children:t,contain:n,restoreFocus:r,autoFocus:i}=e,a=(0,l.useRef)(null),o=(0,l.useRef)(null),s=(0,l.useRef)([]),{parentNode:c}=(0,l.useContext)(GS)||{},u=(0,l.useMemo)(()=>new mC({scopeRef:s}),[s]);I_(()=>{let e=c||hC.root;if(hC.getTreeNode(e.scopeRef)&&KS&&!aC(KS,e.scopeRef)){let t=hC.getTreeNode(KS);t&&(e=t)}e.addChild(u),hC.addNode(u)},[u,c]),I_(()=>{let e=hC.getTreeNode(s);e&&(e.contain=!!n)},[n]),I_(()=>{let e=a.current?.nextSibling,t=[];for(;e&&e!==o.current;)t.push(e),e=e.nextSibling;s.current=t},[t]),lC(s,r,n),tC(s,n),dC(s,r,n),cC(s,i),(0,l.useEffect)(()=>{let e=G_(s.current?s.current[0]:void 0).activeElement,t=null;if(rC(e,s.current)){for(let n of hC.traverse())n.scopeRef&&rC(e,n.scopeRef.current)&&(t=n);t===hC.getTreeNode(s)&&(KS=t.scopeRef)}},[s]),I_(()=>()=>{var e,t;let n=((t=hC.getTreeNode(s))==null||(e=t.parent)==null?void 0:e.scopeRef)??null;(s===KS||aC(s,KS))&&(!n||hC.getTreeNode(n))&&(KS=n),hC.removeTreeNode(s)},[s]);let d=(0,l.useMemo)(()=>YS(s),[]),f=(0,l.useMemo)(()=>({focusManager:d,parentNode:u}),[u,d]);return l.default.createElement(GS.Provider,{value:f},l.default.createElement(`span`,{"data-focus-scope-start":!0,hidden:!0,ref:a}),t,l.default.createElement(`span`,{"data-focus-scope-end":!0,hidden:!0,ref:o}))}function JS(){return(0,l.useContext)(GS)?.focusManager}function YS(e){return{focusNext(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||G_(n[0]).activeElement,c=n[0].previousElementSibling,l=fC($S(n),{tabbable:i,accept:o},n);l.currentNode=rC(s,n)?s:c;let u=l.nextNode();return!u&&a&&(l.currentNode=c,u=l.nextNode()),u&&oC(u,!0),u},focusPrevious(t={}){let n=e.current,{from:r,tabbable:i,wrap:a,accept:o}=t,s=r||G_(n[0]).activeElement,c=n[n.length-1].nextElementSibling,l=fC($S(n),{tabbable:i,accept:o},n);l.currentNode=rC(s,n)?s:c;let u=l.previousNode();return!u&&a&&(l.currentNode=c,u=l.previousNode()),u&&oC(u,!0),u},focusFirst(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=fC($S(n),{tabbable:r,accept:i},n);a.currentNode=n[0].previousElementSibling;let o=a.nextNode();return o&&oC(o,!0),o},focusLast(t={}){let n=e.current,{tabbable:r,accept:i}=t,a=fC($S(n),{tabbable:r,accept:i},n);a.currentNode=n[n.length-1].nextElementSibling;let o=a.previousNode();return o&&oC(o,!0),o}}}var XS=[`input:not([disabled]):not([type=hidden])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`a[href]`,`area[href]`,`summary`,`iframe`,`object`,`embed`,`audio[controls]`,`video[controls]`,`[contenteditable]`],ZS=XS.join(`:not([hidden]),`)+`,[tabindex]:not([disabled]):not([hidden])`;XS.push(`[tabindex]:not([tabindex="-1"]):not([disabled])`);var QS=XS.join(`:not([hidden]):not([tabindex="-1"]),`);function $S(e){return e[0].parentElement}function eC(e){let t=hC.getTreeNode(KS);for(;t&&t.scopeRef!==e;){if(t.contain)return!1;t=t.parent}return!0}function tC(e,t){let n=(0,l.useRef)(),r=(0,l.useRef)();I_(()=>{let i=e.current;if(!t){r.current&&=(cancelAnimationFrame(r.current),void 0);return}let a=G_(i?i[0]:void 0),o=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!eC(e)||t.isComposing)return;let n=a.activeElement,r=e.current;if(!r||!rC(n,r))return;let i=fC($S(r),{tabbable:!0},r);if(!n)return;i.currentNode=n;let o=t.shiftKey?i.previousNode():i.nextNode();o||=(i.currentNode=t.shiftKey?r[r.length-1].nextElementSibling:r[0].previousElementSibling,t.shiftKey?i.previousNode():i.nextNode()),t.preventDefault(),o&&oC(o,!0)},s=t=>{(!KS||aC(KS,e))&&rC(t.target,e.current)?(KS=e,n.current=t.target):eC(e)&&!iC(t.target,e)?n.current?n.current.focus():KS&&KS.current&&sC(KS.current):eC(e)&&(n.current=t.target)},c=t=>{r.current&&cancelAnimationFrame(r.current),r.current=requestAnimationFrame(()=>{if(a.activeElement&&eC(e)&&!iC(a.activeElement,e))if(KS=e,a.body.contains(t.target)){var r;n.current=t.target,(r=n.current)==null||r.focus()}else KS.current&&sC(KS.current)})};return a.addEventListener(`keydown`,o,!1),a.addEventListener(`focusin`,s,!1),i?.forEach(e=>e.addEventListener(`focusin`,s,!1)),i?.forEach(e=>e.addEventListener(`focusout`,c,!1)),()=>{a.removeEventListener(`keydown`,o,!1),a.removeEventListener(`focusin`,s,!1),i?.forEach(e=>e.removeEventListener(`focusin`,s,!1)),i?.forEach(e=>e.removeEventListener(`focusout`,c,!1))}},[e,t]),I_(()=>()=>{r.current&&cancelAnimationFrame(r.current)},[r])}function nC(e){return iC(e)}function rC(e,t){return!e||!t?!1:t.some(t=>t.contains(e))}function iC(e,t=null){if(e instanceof Element&&e.closest(`[data-react-aria-top-layer]`))return!0;for(let{scopeRef:n}of hC.traverse(hC.getTreeNode(t)))if(n&&rC(e,n.current))return!0;return!1}function aC(e,t){let n=hC.getTreeNode(t)?.parent;for(;n;){if(n.scopeRef===e)return!0;n=n.parent}return!1}function oC(e,t=!1){if(e!=null&&!t)try{VS(e)}catch{}else if(e!=null)try{e.focus()}catch{}}function sC(e,t=!0){let n=e[0].previousElementSibling,r=$S(e),i=fC(r,{tabbable:t},e);i.currentNode=n;let a=i.nextNode();t&&!a&&(r=$S(e),i=fC(r,{tabbable:!1},e),i.currentNode=n,a=i.nextNode()),oC(a)}function cC(e,t){let n=l.default.useRef(t);(0,l.useEffect)(()=>{n.current&&(KS=e,!rC(G_(e.current?e.current[0]:void 0).activeElement,KS.current)&&e.current&&sC(e.current)),n.current=!1},[e])}function lC(e,t,n){I_(()=>{if(t||n)return;let r=e.current,i=G_(r?r[0]:void 0),a=t=>{let n=t.target;rC(n,e.current)?KS=e:nC(n)||(KS=null)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,t,n])}function uC(e){let t=hC.getTreeNode(KS);for(;t&&t.scopeRef!==e;){if(t.nodeToRestore)return!1;t=t.parent}return t?.scopeRef===e}function dC(e,t,n){let r=(0,l.useRef)(typeof document<`u`?G_(e.current?e.current[0]:void 0).activeElement:null);I_(()=>{let r=e.current,i=G_(r?r[0]:void 0);if(!t||n)return;let a=()=>{(!KS||aC(KS,e))&&rC(i.activeElement,e.current)&&(KS=e)};return i.addEventListener(`focusin`,a,!1),r?.forEach(e=>e.addEventListener(`focusin`,a,!1)),()=>{i.removeEventListener(`focusin`,a,!1),r?.forEach(e=>e.removeEventListener(`focusin`,a,!1))}},[e,n]),I_(()=>{let r=G_(e.current?e.current[0]:void 0);if(!t)return;let i=t=>{if(t.key!==`Tab`||t.altKey||t.ctrlKey||t.metaKey||!eC(e)||t.isComposing)return;let n=r.activeElement;if(!rC(n,e.current))return;let i=hC.getTreeNode(e);if(!i)return;let a=i.nodeToRestore,o=fC(r.body,{tabbable:!0});o.currentNode=n;let s=t.shiftKey?o.previousNode():o.nextNode();if((!a||!r.body.contains(a)||a===r.body)&&(a=void 0,i.nodeToRestore=void 0),(!s||!rC(s,e.current))&&a){o.currentNode=a;do s=t.shiftKey?o.previousNode():o.nextNode();while(rC(s,e.current));t.preventDefault(),t.stopPropagation(),s?oC(s,!0):nC(a)?oC(a,!0):n.blur()}};return n||r.addEventListener(`keydown`,i,!0),()=>{n||r.removeEventListener(`keydown`,i,!0)}},[e,t,n]),I_(()=>{let n=G_(e.current?e.current[0]:void 0);if(!t)return;let i=hC.getTreeNode(e);if(i)return i.nodeToRestore=r.current??void 0,()=>{let r=hC.getTreeNode(e);if(!r)return;let i=r.nodeToRestore;if(t&&i&&(rC(n.activeElement,e.current)||n.activeElement===n.body&&uC(e))){let t=hC.clone();requestAnimationFrame(()=>{if(n.activeElement===n.body){let n=t.getTreeNode(e);for(;n;){if(n.nodeToRestore&&n.nodeToRestore.isConnected){oC(n.nodeToRestore);return}n=n.parent}for(n=t.getTreeNode(e);n;){if(n.scopeRef&&n.scopeRef.current&&hC.getTreeNode(n.scopeRef)){sC(n.scopeRef.current,!0);return}n=n.parent}}})}}},[e,t])}function fC(e,t,n){let r=t!=null&&t.tabbable?QS:ZS,i=G_(e).createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode(e){var i;return!(t==null||(i=t.from)==null)&&i.contains(e)?NodeFilter.FILTER_REJECT:e.matches(r)&&WS(e)&&(!n||rC(e,n))&&(!(t!=null&&t.accept)||t.accept(e))?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});return t!=null&&t.from&&(i.currentNode=t.from),i}var pC=class e{get size(){return this.fastMap.size}getTreeNode(e){return this.fastMap.get(e)}addTreeNode(e,t,n){let r=this.fastMap.get(t??null);if(!r)return;let i=new mC({scopeRef:e});r.addChild(i),i.parent=r,this.fastMap.set(e,i),n&&(i.nodeToRestore=n)}addNode(e){this.fastMap.set(e.scopeRef,e)}removeTreeNode(e){if(e===null)return;let t=this.fastMap.get(e);if(!t)return;let n=t.parent;for(let e of this.traverse())e!==t&&t.nodeToRestore&&e.nodeToRestore&&t.scopeRef&&t.scopeRef.current&&rC(e.nodeToRestore,t.scopeRef.current)&&(e.nodeToRestore=t.nodeToRestore);let r=t.children;n&&(n.removeChild(t),r.size>0&&r.forEach(e=>n&&n.addChild(e))),this.fastMap.delete(t.scopeRef)}*traverse(e=this.root){if(e.scopeRef!=null&&(yield e),e.children.size>0)for(let t of e.children)yield*this.traverse(t)}clone(){let t=new e;for(let e of this.traverse())t.addTreeNode(e.scopeRef,e.parent?.scopeRef??null,e.nodeToRestore);return t}constructor(){this.fastMap=new Map,this.root=new mC({scopeRef:null}),this.fastMap.set(null,this.root)}},mC=class{addChild(e){this.children.add(e),e.parent=this}removeChild(e){this.children.delete(e),e.parent=void 0}constructor(e){this.children=new Set,this.contain=!1,this.scopeRef=e.scopeRef}},hC=new pC;function gC(){let{width:e,height:t}=uv();return{"--be-viewport-height":`${t}px`,"--be-viewport-width":`${e}px`}}var _C={initial:{opacity:0,y:5},animate:{opacity:1,y:0},exit:{opacity:0,y:5},transition:{type:`tween`,duration:.125}},vC=(0,l.forwardRef)(({children:e,style:t,autoFocus:n=!1,restoreFocus:r=!0,isDismissable:i,isContextMenu:a,isOpen:o,onClose:s,triggerRef:c,arrowRef:l,arrowStyle:u,onPointerLeave:d,onPointerEnter:f},p)=>{let h=gC(),g=cv(p),{domProps:_}=bC({isDismissable:i,isOpen:o,onClose:s,triggerRef:c,isContextMenu:a},g);return(0,m.jsx)(x_.div,{className:`isolate z-popover`,role:`presentation`,ref:g,style:{...h,...t,position:`fixed`},..._C,...q_(_,{onPointerLeave:d,onPointerEnter:f}),children:(0,m.jsx)(qS,{restoreFocus:r,autoFocus:n,contain:!1,children:e})})}),yC=[];function bC({onClose:e,isDismissable:t=!0,triggerRef:n,isContextMenu:r=!1},i){let a=(0,l.useRef)({isPointerDown:!1,isContextMenu:r,onClose:e}),o=a.current;o.isContextMenu=r,o.onClose=e;let s=(0,l.useCallback)(e=>{let t=e.target;if(t){let e=t.ownerDocument;if(!e||!e.documentElement.contains(t))return!1}return i.current&&!i.current.contains(t)},[i]),c=(0,l.useCallback)(()=>yC[yC.length-1]===i,[i]),u=(0,l.useCallback)(()=>{c()&&o.onClose()},[c,o]),d=(0,l.useCallback)(e=>{var t;return n.current&&`contains`in n.current?(t=n.current).contains?.call(t,e):!1},[n]),f=(0,l.useCallback)(e=>{d(e.target)||c()&&(e.stopPropagation(),e.preventDefault())},[d,c]),p=(0,l.useCallback)(e=>{d(e.target)||(c()&&(e.stopPropagation(),e.preventDefault()),(!o.isContextMenu||e.button!==2)&&u())},[d,u,o,c]);return(0,l.useEffect)(()=>{yC.push(i);let e=e=>{s(e)&&(f(e),a.current.isPointerDown=!0)},t=e=>{a.current.isPointerDown&&s(e)&&(a.current.isPointerDown=!1,p(e))},r=e=>{e.preventDefault(),s(e)&&u()},c=e=>{if(!n.current)return;let t=e.target,r;n.current instanceof Node?r=n.current:`contextElement`in n.current&&(r=n.current.contextElement),(!(t instanceof Node)||!r||t.contains(r))&&o.onClose()};return document.addEventListener(`pointerdown`,e,!0),document.addEventListener(`pointerup`,t,!0),document.addEventListener(`contextmenu`,r,!0),document.addEventListener(`scroll`,c,!0),()=>{let n=yC.indexOf(i);n>=0&&yC.splice(n,1),document.removeEventListener(`pointerdown`,e,!0),document.removeEventListener(`pointerup`,t,!0),document.removeEventListener(`contextmenu`,r,!0),document.removeEventListener(`scroll`,c,!0)}},[i,s,o,p,f,n,d,u]),{domProps:{onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),u())}}}}var xC={initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.2}};function SC({position:e=`absolute`,className:t,isTransparent:n=!1,disableInitialTransition:r,...i}){return(0,m.jsx)(x_.div,{...i,className:H(t,!n&&`bg-background/80`,`inset-0 z-10 h-full w-full`,e,`backdrop-blur-sm`),"aria-hidden":!0,initial:r?void 0:{opacity:0},animate:{opacity:1},exit:{opacity:0},...xC,transition:{duration:.15}})}var CC=(0,l.forwardRef)(({children:e,autoFocus:t=!1,restoreFocus:n=!0,isDismissable:r,isOpen:i,onClose:a},o)=>{let s=gC(),c=cv(o);return(0,m.jsxs)(`div`,{className:`fixed inset-0 isolate z-tray`,style:s,children:[(0,m.jsx)(SC,{onClick:()=>{r&&a()}},`tray-underlay`),(0,m.jsx)(x_.div,{ref:c,className:`absolute bottom-0 left-0 right-0 z-20 mx-auto max-h-tray w-full max-w-375 overflow-hidden rounded-t pb-safe-area`,role:`presentation`,initial:{opacity:0,y:`100%`},animate:{opacity:1,y:0},exit:{opacity:0,y:`100%`},transition:{type:`tween`,duration:.2},children:(0,m.jsx)(qS,{restoreFocus:n,autoFocus:t,contain:!0,children:e})})]})});function wC(e,t){if(e===t)return!0;if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t),i=n.length;if(r.length!==i)return!1;for(let r=0;r<i;r++){let i=n[r];if(e[i]!==t[i]||!Object.prototype.hasOwnProperty.call(t,i))return!1}return!0}function TC(){let{i18n:e}=Bu(e=>e.data);return{locale:e,localeCode:e?.language||`en`,lines:e?.lines}}function EC(e,{message:t,values:n}){let r=t.match(/\[(.+?)]/),i=n?.count;if(r&&r[1]&&!Number.isNaN(i)){let[n,a]=r,o=a.split(`|`);if(!o.length)return t;let s=DC(e).select(i),c=o.find(e=>e.startsWith(s));c||=o[0];let l=c.substring(c.indexOf(` `)+1);return t.replace(n,l)}return t}var DC=Db(e=>new Intl.PluralRules(e));function OC(e,t){return e==null?!1:Object.hasOwn===void 0?Object.hasOwnProperty(t):Object.hasOwn(e,t)}var Z=(0,l.memo)(e=>{let{message:t,values:n}=e,{lines:r,localeCode:i}=TC(),a;if(a=OC(r,t)?r?.[t]:OC(r,t?.toLowerCase())?r?.[t?.toLowerCase()]:t,!n||!a)return(0,m.jsx)(l.Fragment,{children:a});a=EC(i,{message:a,values:n});let o=[],s=[];if(Object.entries(n).forEach(([e,t])=>{typeof t==`function`?s.push(e):(0,l.isValidElement)(t)?o.push(e):t!=null&&(a=a?.replace(`:${e}`,`${t}`))}),s.length||o.length){let e=[];if(s.length){let t=s.join(``);e.push(`(<[${t}]>.+?<\\/[${t}]>)`)}if(o.length){let t=o.join(`|`);e.push(`(:(?:${t}))`)}let t=new RegExp(e.join(`|`),`gm`);return(0,m.jsx)(l.Fragment,{children:a.split(t).filter(Boolean).map((e,t)=>{if(e.startsWith(`<`)&&e.endsWith(`>`)){let r=e.match(/<([a-z]+)>(.+?)<\/([a-z]+)>/);if(r){let[,e,i]=r,a=n?.[e];if(typeof a==`function`)return(0,l.cloneElement)(a(i),{key:t})}}if(e.startsWith(`:`)){let r=e.replace(`:`,``),i=n?.[r];if((0,l.isValidElement)(i))return(0,l.cloneElement)(i,{key:t})}return e})})}return(0,m.jsx)(l.Fragment,{children:a})},kC);function kC(e,t){let{values:n,...r}=e,{values:i,...a}=t;return wC(i,n)&&wC(r,a)}function AC({listbox:e,children:t,isLoading:n,mobileOverlay:r=CC,searchField:i,onClose:a,prepend:o,className:s,...c}){let d=wS(),{floatingWidth:f,floatingMinWidth:p=`min-w-180`,collection:h,showEmptyMessage:g,state:{isOpen:_,setIsOpen:v},positionStyle:y,floating:b,refs:x}=e,S=!o&&d?r:vC,C=H(`text-base sm:text-sm outline-none bg max-h-inherit flex flex-col`,!o&&`shadow-xl border py-4`,s,S===vC&&`rounded-panel`,S===vC&&f===`auto`?`max-w-288 ${p}`:``),w=(0,l.useMemo)(()=>{let e=0,t=[];return[...h.values()].reduce((n,r)=>{if(!r.section)n.push((0,l.cloneElement)(r.element,{key:r.element.key||r.element.props.value}));else if(!t.includes(r.section)){let i=(0,l.cloneElement)(r.section,{key:r.section.key||e,index:e});n.push(i),t.push(r.section),e++}return n},[])},[h]),T=w.length>0||g&&!n,E=T?(0,m.jsxs)(`div`,{className:C,role:`presentation`,children:[i,(0,m.jsx)(jC,{isLoading:n,...c,children:w})]}):null;return(0,m.jsxs)(yb.Provider,{value:e,children:[t,o?E:Fu&&(0,u.createPortal)((0,m.jsx)(M_,{children:_&&T&&(0,m.jsx)(S,{triggerRef:x.reference,restoreFocus:!0,isOpen:_,onClose:()=>{a?.(),v(!1)},isDismissable:!0,style:y,ref:b,children:E})}),Fu)]})}function jC({className:e,children:t,isLoading:n,...r}){let{role:i,listboxId:a,virtualFocus:o,focusItem:s,state:{activeIndex:c,setActiveIndex:u,selectedIndex:d}}=bb(),f=(0,l.useRef)(!0),p=(0,l.useRef)(null);return(0,l.useEffect)(()=>()=>u(null),[u]),(0,l.useEffect)(()=>{if(f.current){let e=c??d;e==null&&!o?requestAnimationFrame(()=>{var e;(e=p.current)==null||e.focus({preventScroll:!0})}):e!=null&&requestAnimationFrame(()=>{s(`increment`,e)})}f.current=!1},[c,d,s,o]),(0,m.jsx)(`div`,{tabIndex:o?void 0:-1,role:i,id:a,className:`flex-auto overflow-y-auto overscroll-contain outline-none`,ref:p,...r,children:t.length?t:(0,m.jsx)(MC,{})})}function MC(){return(0,m.jsx)(`div`,{className:`px-8 py-4 text-sm italic text-muted`,children:(0,m.jsx)(Z,{message:`There are no items matching your query`})})}function NC({state:{isOpen:e,setIsOpen:t,selectedIndex:n,activeIndex:r,setInputValue:i,setActiveIndex:a},focusLoopingMode:o,collection:s,focusItem:c,handleItemSelection:l,allowCustomValue:u}){let d=r=>{if(!(e||!r.currentTarget.contains(r.target))){if(r.key===`ArrowDown`)return r.preventDefault(),t(!0),c(`increment`,n??0),!0;if(r.key===`ArrowUp`)return r.preventDefault(),t(!0),c(`decrement`,n??s.size-1),!0;if(r.key===`Enter`||r.key===`Space`)return r.preventDefault(),t(!0),c(`increment`,n??0),!0}},f=n=>{let i=Math.max(0,s.size-1);if(!(!e||!n.currentTarget.contains(n.target)))switch(n.key){case`ArrowDown`:return n.preventDefault(),r==null?c(`increment`,0):r>=i?o===`loop`?c(`increment`,0):o===`deselect`&&a(null):c(`increment`,r+1),!0;case`ArrowUp`:return n.preventDefault(),r==null?c(`decrement`,i):r<=0?o===`loop`?c(`decrement`,i):o===`deselect`&&a(null):c(`decrement`,r-1),!0;case`Home`:return n.preventDefault(),c(`increment`,0),!0;case`End`:return n.preventDefault(),c(`decrement`,i),!0;case`Tab`:return t(!1),!0}};return{handleTriggerKeyDown:d,handleListboxKeyboardNavigation:f,handleListboxSearchFieldKeydown:n=>{var a,o;if(n.key===`Enter`&&r!=null&&s.size){n.preventDefault();let[e,t]=[...s.entries()][r];e&&(l(e),(o=(a=t.element.props).onSelected)==null||o.call(a));return}n.key===`Escape`&&e&&(t(!1),u||i(``)),d(n)||f(n)}}}var PC=new Map;function FC(e){let{localeCode:t}=TC(),n=t+(e?Object.entries(e).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(PC.has(n))return PC.get(n);let r=new Intl.Collator(t,e);return PC.set(n,r),r}function IC(){let e=FC({usage:`search`,sensitivity:`base`}),t=(0,l.useRef)({search:``,timeout:void 0}).current,n=(n,r)=>{let i=r??0;for(;i!=null;){let r=n[i]?.slice(0,t.search.length);if(r&&e.compare(r,t.search)===0)return i;if(i<n.length-1)i++;else return null}return null};return{findMatchingItem:(e,r,i=0)=>{let a=LC(e.key);if(!a||e.ctrlKey||e.metaKey)return null;a===` `&&t.search.trim().length>0&&(e.preventDefault(),e.stopPropagation()),t.search+=a;let o=n(r,i);return o??=n(r,0),clearTimeout(t.timeout),t.timeout=setTimeout(()=>{t.search=``},500),o??null}}}function LC(e){return e.length===1||!/^[A-Z]/i.test(e)?e:``}function RC(e,{noSSR:t}={noSSR:!0}){let n=typeof window<`u`&&typeof window.matchMedia==`function`,[r,i]=(0,l.useState)(t?()=>n?window.matchMedia(e).matches:!1:null);return(0,l.useEffect)(()=>{if(!n)return;let r=window.matchMedia(e),a=()=>{i(r.matches)};return r.addEventListener(`change`,a),t||a(),()=>{r.removeEventListener(`change`,a)}},[n,e,t]),typeof window>`u`?null:r}function zC(e){return RC(`(max-width: 768px)`,e)}var BC=U((0,m.jsx)(`path`,{d:`M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z`}),`SearchOutlined`),VC=e=>e.type===`checkbox`,HC=e=>e instanceof Date,UC=e=>e==null,WC=e=>typeof e==`object`,GC=e=>!UC(e)&&!Array.isArray(e)&&WC(e)&&!HC(e),KC=e=>GC(e)&&e.target?VC(e.target)?e.target.checked:e.target.value:e,qC=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,JC=(e,t)=>e.has(qC(t)),YC=e=>{let t=e.constructor&&e.constructor.prototype;return GC(t)&&t.hasOwnProperty(`isPrototypeOf`)},XC=typeof window<`u`&&typeof window.HTMLElement<`u`&&typeof document<`u`;function ZC(e){let t,n=Array.isArray(e);if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(XC&&(e instanceof Blob||e instanceof FileList))&&(n||GC(e)))if(t=n?[]:{},!n&&!YC(e))t=e;else for(let n in e)e.hasOwnProperty(n)&&(t[n]=ZC(e[n]));else return e;return t}var QC=e=>Array.isArray(e)?e.filter(Boolean):[],$C=e=>e===void 0,ew=(e,t,n)=>{if(!t||!GC(e))return n;let r=QC(t.split(/[,[\].]+?/)).reduce((e,t)=>UC(e)?e:e[t],e);return $C(r)||r===e?$C(e[t])?n:e[t]:r},tw=e=>typeof e==`boolean`,nw=e=>/^\w*$/.test(e),rw=e=>QC(e.replace(/["|']|\]/g,``).split(/\.|\[/)),iw=(e,t,n)=>{let r=-1,i=nw(t)?[t]:rw(t),a=i.length,o=a-1;for(;++r<a;){let t=i[r],a=n;if(r!==o){let n=e[t];a=GC(n)||Array.isArray(n)?n:isNaN(+i[r+1])?{}:[]}if(t===`__proto__`)return;e[t]=a,e=e[t]}return e},aw={BLUR:`blur`,FOCUS_OUT:`focusout`,CHANGE:`change`},ow={onBlur:`onBlur`,onChange:`onChange`,onSubmit:`onSubmit`,onTouched:`onTouched`,all:`all`},sw=l.default.createContext(null),cw=()=>l.default.useContext(sw),lw=(e,t,n,r=!0)=>{let i={defaultValues:t._defaultValues};for(let a in e)Object.defineProperty(i,a,{get:()=>{let i=a;return t._proxyFormState[i]!==ow.all&&(t._proxyFormState[i]=!r||ow.all),n&&(n[i]=!0),e[i]}});return i},uw=e=>GC(e)&&!Object.keys(e).length,dw=(e,t,n,r)=>{n(e);let{name:i,...a}=e;return uw(a)||Object.keys(a).length>=Object.keys(t).length||Object.keys(a).find(e=>t[e]===(!r||ow.all))},fw=e=>Array.isArray(e)?e:[e],pw=(e,t,n)=>!e||!t||e===t||fw(e).some(e=>e&&(n?e===t:e.startsWith(t)||t.startsWith(e)));function mw(e){let t=l.default.useRef(e);t.current=e,l.default.useEffect(()=>{let n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}function hw(e){let t=cw(),{control:n=t.control,disabled:r,name:i,exact:a}=e||{},[o,s]=l.default.useState(n._formState),c=l.default.useRef(!0),u=l.default.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1}),d=l.default.useRef(i);return d.current=i,mw({disabled:r,next:e=>c.current&&pw(d.current,e.name,a)&&dw(e,u.current,n._updateFormState)&&s({...n._formState,...e}),subject:n._subjects.state}),l.default.useEffect(()=>(c.current=!0,u.current.isValid&&n._updateValid(!0),()=>{c.current=!1}),[n]),lw(o,n,u.current,!1)}var gw=e=>typeof e==`string`,_w=(e,t,n,r,i)=>gw(e)?(r&&t.watch.add(e),ew(n,e,i)):Array.isArray(e)?e.map(e=>(r&&t.watch.add(e),ew(n,e))):(r&&(t.watchAll=!0),n);function vw(e){let t=cw(),{control:n=t.control,name:r,defaultValue:i,disabled:a,exact:o}=e||{},s=l.default.useRef(r);s.current=r,mw({disabled:a,subject:n._subjects.values,next:e=>{pw(s.current,e.name,o)&&u(ZC(_w(s.current,n._names,e.values||n._formValues,!1,i)))}});let[c,u]=l.default.useState(n._getWatch(r,i));return l.default.useEffect(()=>n._removeUnmounted()),c}function yw(e){let t=cw(),{name:n,disabled:r,control:i=t.control,shouldUnregister:a}=e,o=JC(i._names.array,n),s=vw({control:i,name:n,defaultValue:ew(i._formValues,n,ew(i._defaultValues,n,e.defaultValue)),exact:!0}),c=hw({control:i,name:n}),u=l.default.useRef(i.register(n,{...e.rules,value:s,...tw(e.disabled)?{disabled:e.disabled}:{}}));return l.default.useEffect(()=>{let e=i._options.shouldUnregister||a,t=(e,t)=>{let n=ew(i._fields,e);n&&(n._f.mount=t)};if(t(n,!0),e){let e=ZC(ew(i._options.defaultValues,n));iw(i._defaultValues,n,e),$C(ew(i._formValues,n))&&iw(i._formValues,n,e)}return()=>{(o?e&&!i._state.action:e)?i.unregister(n):t(n,!1)}},[n,i,o,a]),l.default.useEffect(()=>{ew(i._fields,n)&&i._updateDisabledField({disabled:r,fields:i._fields,name:n,value:ew(i._fields,n)._f.value})},[r,n,i]),{field:{name:n,value:s,...tw(r)||c.disabled?{disabled:c.disabled||r}:{},onChange:l.default.useCallback(e=>u.current.onChange({target:{value:KC(e),name:n},type:aw.CHANGE}),[n]),onBlur:l.default.useCallback(()=>u.current.onBlur({target:{value:ew(i._formValues,n),name:n},type:aw.BLUR}),[n,i]),ref:e=>{let t=ew(i._fields,n);t&&e&&(t._f.ref={focus:()=>e.focus(),select:()=>e.select(),setCustomValidity:t=>e.setCustomValidity(t),reportValidity:()=>e.reportValidity()})}},formState:c,fieldState:Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!ew(c.errors,n)},isDirty:{enumerable:!0,get:()=>!!ew(c.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!ew(c.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!ew(c.validatingFields,n)},error:{enumerable:!0,get:()=>ew(c.errors,n)}})}}function bw(e={}){let{size:t=`md`,startAppend:n,endAppend:r,className:i,labelPosition:a,labelDisplay:o=`block`,inputClassName:s,inputWrapperClassName:c,unstyled:l,invalid:u,disabled:d,background:f=`bg-transparent`,flexibleHeight:p,inputShadow:m=`shadow-sm`,descriptionPosition:h=`bottom`,inputRing:g,inputFontSize:_,labelSuffix:v}={...e};if(l)return{label:``,input:s||``,wrapper:i||``,inputWrapper:c||``,adornment:``,append:{size:``,radius:``},size:{font:``,height:``},description:``,error:``};let y=ww({size:e.size,flexibleHeight:p});_&&(y.font=_);let b=n||r,x=g||`focus:ring ${u?`focus:ring-danger/focus focus:border-danger/60`:`focus:ring-primary/focus focus:border-primary/60`}`,S=Cw(e);return{label:H(o,`first-letter:capitalize text-left whitespace-nowrap`,d&&`text-disabled`,y.font,v?``:a===`side`?`mr-16`:`mb-4`),input:H(`block text-left relative w-full appearance-none transition-shadow text`,f,S.input,xw(e),!d&&`${x} focus:outline-none ${m}`,d&&`text-disabled cursor-not-allowed`,s,y.font,y.height,Sw(e)),adornment:Tw(t),append:{size:lb(t),radius:S.append},wrapper:H(i,y.font,{"flex items-center":a===`side`}),inputWrapper:H(`isolate relative`,c,b&&`flex items-stretch`),size:y,description:`text-muted ${h===`bottom`?`pt-10`:`pb-10`} text-xs`,error:`text-danger pt-10 text-xs`}}function xw({startAppend:e,endAppend:t,inputBorder:n,invalid:r}){if(n)return n;let i=e||t,a=r?`border-danger`:`border-divider`;return i?e?`${a} border-y border-r`:`${a} border-y border-l`:`${a} border`}function Sw({startAdornment:e,endAdornment:t,inputRadius:n}){return n===`rounded-full`?H(e?`pl-54`:`pl-28`,t?`pr-54`:`pr-28`):H(e?`pl-46`:`pl-12`,t?`pr-46`:`pr-12`)}function Cw(e){let{startAppend:t,endAppend:n,inputRadius:r}=e,i=t||n;return r===`rounded-full`?{input:H(!i&&`rounded-full`,t&&`rounded-r-full rounded-l-none`,n&&`rounded-l-full rounded-r-none`),append:t?`rounded-l-full`:`rounded-r-full`}:r===`rounded-none`?{input:``,append:``}:r?{input:r,append:r}:{input:H(!i&&`rounded-input`,t&&`rounded-r-input rounded-l-none`,n&&`rounded-l-input rounded-r-none`),append:t?`rounded-l-input`:`rounded-r-input`}}function ww({size:e,flexibleHeight:t}){switch(e){case`2xs`:return{font:`text-xs`,height:t?`min-h-24`:`h-24`};case`xs`:return{font:`text-xs`,height:t?`min-h-30`:`h-30`};case`sm`:return{font:`text-sm`,height:t?`min-h-36`:`h-36`};case`lg`:return{font:`text-md md:text-lg`,height:t?`min-h-50`:`h-50`};case`xl`:return{font:`text-xl`,height:t?`min-h-60`:`h-60`};default:return{font:`text-sm`,height:t?`min-h-42`:`h-42`}}}function Tw(e){switch(e){case`2xs`:return`icon-2xs`;case`xs`:return`icon-xs`;case`sm`:return`icon-sm`;case`md`:return`icon-sm`;case`lg`:return`icon-lg`;case`xl`:return`icon-xl`;default:return``}}function Ew({children:e,direction:t,className:n,position:r=t===`start`?`left-0`:`right-0`}){return e?(0,m.jsx)(`div`,{className:H(`pointer-events-none absolute top-0 z-10 flex h-full min-w-42 items-center justify-center text-muted`,r,n),children:e}):null}function Dw(e,t){let n=t?.copy??!0,r=n?{...e}:e;return Object.keys(r).forEach(e=>{let n=e;t!=null&&t.arrays&&Array.isArray(r[n])&&r[n].length===0?delete r[n]:t!=null&&t.deep&&r[n]&&typeof r[n]==`object`?(r[n]=Dw(r[n],t),Object.keys(r[n]).length===0&&delete r[n]):(r[n]==null||r[n]===``)&&delete r[n]}),n?r:e}var Ow=l.default.forwardRef((e,t)=>{let{children:n,description:r,errorMessage:i,descriptionProps:a={},errorMessageProps:o={},startAdornment:s,endAdornment:c,adornmentPosition:l,startAppend:u,endAppend:d,fieldClassNames:f,disabled:p,wrapperProps:h}=e;return(0,m.jsxs)(`div`,{className:f.wrapper,ref:t,...h,children:[(0,m.jsx)(kw,{...e}),(0,m.jsxs)(`div`,{className:f.inputWrapper,children:[(0,m.jsx)(Ew,{direction:`start`,className:f.adornment,position:l,children:s}),u&&(0,m.jsx)(Aw,{style:f.append,disabled:p,children:u}),n,d&&(0,m.jsx)(Aw,{style:f.append,disabled:p,children:d}),(0,m.jsx)(Ew,{direction:`end`,className:f.adornment,position:l,children:c})]}),r&&!i&&(0,m.jsx)(`div`,{className:f.description,...a,children:r}),i&&(0,m.jsx)(`div`,{className:f.error,...o,children:i})]})});function kw({labelElementType:e,fieldClassNames:t,labelProps:n,label:r,labelSuffix:i,labelSuffixPosition:a=`spaced`,required:o}){if(!r)return null;let s=(0,m.jsxs)(e||`label`,{className:t.label,...n,children:[r,o&&(0,m.jsx)(`span`,{className:`text-danger`,children:` *`})]});return i?(0,m.jsxs)(`div`,{className:H(`mb-4 flex w-full gap-4`,a===`spaced`?`items-end`:`items-center`),children:[s,(0,m.jsx)(`div`,{className:H(`text-xs text-muted`,a===`spaced`?`ml-auto`:``),children:i})]}):s}function Aw({children:e,style:t,disabled:n}){return l.default.cloneElement(e,{...e.props,disabled:e.props.disabled||n,...Dw(t)})}function jw({autoFocus:e,autoSelectText:t},n){let r=(0,l.useRef)(e);(0,l.useEffect)(()=>{r.current&&n.current&&requestAnimationFrame(()=>{var e;(e=n.current)==null||e.focus(),t&&n.current?.nodeName.toLowerCase()===`input`&&n.current.select()}),r.current=!1},[n,t])}function Mw(e){let{focusRef:t,labelElementType:n=`label`,label:r,labelSuffix:i,labelSuffixPosition:a,autoFocus:o,autoSelectText:s,labelPosition:c,descriptionPosition:u,size:d,errorMessage:f,description:p,flexibleHeight:m,startAdornment:h,endAdornment:g,startAppend:_,adornmentPosition:v,endAppend:y,className:b,inputClassName:x,inputWrapperClassName:S,unstyled:C,background:w,invalid:T,disabled:E,id:D,inputRadius:O,inputBorder:k,inputShadow:A,inputRing:j,inputFontSize:M,...N}=e;jw(e,t);let P=(0,l.useId)(),ee=D||P,F=`${ee}-label`,te=`${ee}-description`,ne=`${ee}-error`,re={id:F,htmlFor:n===`label`?ee:void 0},I={id:te},ie={id:ne},ae={"aria-label":!e.label&&!e[`aria-label`]&&e.placeholder?e.placeholder:e[`aria-label`],"aria-invalid":T||void 0,id:ee,disabled:E,...N},L=[];r&&L.push(re.id),ae[`aria-labelledby`]&&L.push(ae[`aria-labelledby`]),ae[`aria-labelledby`]=L.length?L.join(` `):void 0;let oe=[];return p&&oe.push(I.id),f&&oe.push(ie.id),ae[`aria-describedby`]&&oe.push(ae[`aria-describedby`]),ae[`aria-describedby`]=oe.length?oe.join(` `):void 0,{fieldProps:{errorMessageProps:ie,descriptionProps:I,labelProps:re,disabled:E,label:r,labelSuffix:i,labelSuffixPosition:a,autoFocus:o,autoSelectText:s,labelPosition:c,descriptionPosition:u,size:d,errorMessage:f,description:p,flexibleHeight:m,startAdornment:h,endAdornment:g,startAppend:_,adornmentPosition:v,endAppend:y,className:b,inputClassName:x,inputWrapperClassName:S,unstyled:C,background:w,invalid:T},inputProps:ae}}var Nw=(0,l.forwardRef)(({inputElementType:e=`input`,flexibleHeight:t,inputRef:n,inputTestId:r,...i},a)=>{let o=cv(n),{fieldProps:s,inputProps:c}=Mw({...i,focusRef:o}),l=e===`textarea`,u=l?`textarea`:`input`,d=bw({...i,flexibleHeight:t||e===`textarea`});return e===`textarea`&&!i.unstyled&&(d.input=`${d.input} py-12`),(0,m.jsx)(Ow,{ref:a,fieldClassNames:d,...s,children:(0,m.jsx)(u,{"data-testid":r,ref:o,...c,rows:l?c.rows||4:void 0,className:d.input})})});l.default.forwardRef(({name:e,...t},n)=>{let{field:{onChange:r,onBlur:i,value:a=``,ref:o},fieldState:{invalid:s,error:c}}=yw({name:e});return(0,m.jsx)(Nw,{ref:n,...q_({onChange:r,onBlur:i,value:a??``,invalid:s,errorMessage:c?.message,inputRef:o,name:e},t)})});var Pw=(0,l.forwardRef)((e,t)=>{let{searchPlaceholder:n,showSearchField:r,children:[i,a],floatingWidth:o=`auto`,isLoading:s}=e,c=(0,l.useId)(),u=zC(),d=bS({...e,clearInputOnItemSelection:!0,showEmptyMessage:r,floatingWidth:u?`auto`:o,virtualFocus:r,role:r?`listbox`:`menu`,focusLoopingMode:r?`stay`:`loop`,children:a.props.children},t),{state:{isOpen:f,setIsOpen:p,activeIndex:h,inputValue:g,setInputValue:_},listboxId:v,focusItem:y,listContent:b,reference:x,onInputChange:S}=d,{handleTriggerKeyDown:C,handleListboxKeyboardNavigation:w,handleListboxSearchFieldKeydown:T}=NC(d),{findMatchingItem:E}=IC();return(0,m.jsx)(AC,{onClick:e=>e.stopPropagation(),listbox:d,onKeyDownCapture:r?void 0:e=>{if(!f)return;let t=E(e,b,h);t!=null&&y(`increment`,t)},onKeyDown:w,onClose:r?()=>_(``):void 0,"aria-labelledby":c,isLoading:s,searchField:r?(0,m.jsx)(Nw,{size:`sm`,placeholder:n,startAdornment:(0,m.jsx)(BC,{}),className:`flex-shrink-0 px-8 pb-8 pt-4`,autoFocus:!0,"aria-expanded":f?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":f?v:void 0,"aria-autocomplete":`list`,autoComplete:`off`,autoCorrect:`off`,spellCheck:`false`,value:g,onChange:S,onKeyDown:e=>{T(e)}}):null,children:(0,l.cloneElement)(i,{id:c,"aria-expanded":f?`true`:`false`,"aria-haspopup":`menu`,"aria-controls":f?v:void 0,ref:x,onKeyDown:C,onClick:hb(e=>{var t,n;(n=(t=i.props)?.onClick)==null||n.call(t,e),p(!f)})})})});function Fw({children:e}){return e}function Iw({item:e,button:t}){return(0,m.jsxs)(Pw,{children:[t,(0,m.jsx)(Fw,{children:(e.menuItems||[]).map(e=>(0,m.jsx)(wb,{value:e.label,onSelected:()=>{e.action(K().editor)},children:e.label},e.label))})]})}var Q=(0,l.forwardRef)(({children:e,size:t=`md`,iconSize:n=t&&t.length<=3?t:`md`,variant:r=`text`,radius:i=`rounded-button`,className:a,padding:o,equalWidth:s=!0,badge:c,...u},d)=>{let f=H(lb(t,{padding:o,equalWidth:s,variant:r}),a,c&&`relative`);return(0,m.jsxs)(gb,{...u,ref:d,radius:i,variant:r,className:f,children:[(0,l.cloneElement)(e,{size:n}),c]})});function Lw({icon:e,className:t,size:n}){let r;return r=l.default.isValidElement(e)?l.default.cloneElement(e,{className:`svg-iconEl`}):typeof e==`string`?(0,m.jsx)(`img`,{className:`w-font h-font`,src:e,alt:``}):Array.isArray(e)?l.default.createElement($o(e),{size:n}):l.default.createElement(e,{size:n}),(0,m.jsx)(`span`,{className:H(t,`leading-none`),children:r})}var Rw=l.default.memo(Lw);function zw({value:e}){return e?typeof e==`string`?(0,m.jsx)(Z,{message:e}):(0,m.jsx)(Z,{...e}):null}function Bw({item:e}){let t=e.label?(0,m.jsx)(Hw,{item:e}):(0,m.jsx)(Vw,{item:e});return e.menuItems?(0,m.jsx)(Iw,{item:e,button:t}):l.default.cloneElement(t,{onClick:()=>{var t;(t=e.action)==null||t.call(e,K().editor)}})}var Vw=(0,l.forwardRef)(({item:e,...t},n)=>(0,m.jsx)(Q,{ref:n,radius:`rounded-full`,size:`sm`,...t,children:(0,m.jsx)(Rw,{icon:e.icon})})),Hw=(0,l.forwardRef)(({item:e,...t},n)=>(0,m.jsx)(_b,{ref:n,radius:`rounded-full`,size:`xs`,color:e.buttonColor||`primary`,variant:e.buttonVariant||`flat`,startIcon:e.icon&&(0,m.jsx)(Rw,{icon:e.icon}),...t,children:(0,m.jsx)(zw,{value:e.label})}));function Uw({children:e,color:t,variant:n,radius:r=`rounded-button`,size:i,className:a,value:o,onChange:s,multiple:c,disabled:u}){let d=e=>o===void 0?!1:c?o.includes(e):e===o,f=e=>{let t=[...o],n=o.indexOf(e);return n>-1?t.splice(n,1):t.push(e),t},p=l.default.Children.map(e,(a,o)=>{if(l.default.isValidElement(a)){let p=d(a.props.value),m=p?`primary`:t;return l.default.cloneElement(a,{color:p?`primary`:t,variant:n,size:i,radius:null,disabled:a.props.disabled||u,...a.props,onClick:e=>{a.props.onClick&&a.props.onClick(e),s&&(c?s?.(f(a.props.value)):s?.(a.props.value))},className:H(a.props.className,p?`z-20`:`z-10`,Ww(o,e,r,m))})}});return(0,m.jsx)(`div`,{className:H(r,`isolate inline-flex`,a),children:p})}function Ww(e,t,n,r){return e===0?H(n,`rounded-tr-none rounded-br-none`,!r&&`border-r-transparent disabled:border-r-transparent`):e===t.length-1?H(n,`rounded-tl-none rounded-bl-none -ml-1`):H(`rounded-none -ml-1`,!r&&`border-r-transparent disabled:border-r-transparent`)}var Gw=U((0,m.jsx)(`path`,{d:`M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z`}),`UndoOutlined`),Kw=U((0,m.jsx)(`path`,{d:`M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z`}),`RedoOutlined`);function qw(){let e=G(e=>e.history.canUndo),t=G(e=>e.history.canRedo);return(0,m.jsxs)(Uw,{variant:`outline`,children:[(0,m.jsx)(Q,{equalWidth:!1,size:`xs`,padding:`pl-12 pr-10`,radius:`rounded-full`,disabled:!e,onClick:()=>{q().history.undo()},children:(0,m.jsx)(Gw,{})},`undo`),(0,m.jsx)(Q,{equalWidth:!1,padding:`pl-10 pr-12`,size:`xs`,radius:`rounded-full`,disabled:!t,onClick:()=>{q().history.redo()},children:(0,m.jsx)(Kw,{})},`redo`)]})}var Jw=U((0,m.jsx)(`path`,{d:`M19 13H5v-2h14v2z`}),`RemoveOutlined`),Yw=U((0,m.jsx)(`path`,{d:`M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z`}),`AddOutlined`);function Xw(){var e,t;let n=G(e=>e.zoom)||1;return G(e=>e.config.tools?.zoom?.allowUserZoom)??!0?(0,m.jsxs)(`div`,{className:`flex items-center select-none`,children:[(0,m.jsx)(Q,{size:`sm`,disabled:!((e=q().zoom)!=null&&e.canZoomOut()),onClick:()=>{q().zoom.zoomOut(q().zoom.step)},children:(0,m.jsx)(Jw,{})}),(0,m.jsxs)(`div`,{className:`w-[4ch] text-sm text-center`,children:[Math.round(n*100),`%`]}),(0,m.jsx)(Q,{size:`sm`,disabled:!((t=q().zoom)!=null&&t.canZoomIn()),onClick:()=>{q().zoom.zoomIn(q().zoom.step)},children:(0,m.jsx)(Yw,{})})]}):null}function Zw({item:e}){switch(e.type){case`undoWidget`:return(0,m.jsx)(qw,{});case`zoomWidget`:return(0,m.jsx)(Xw,{});case`button`:return(0,m.jsx)(Bw,{item:e});case`image`:return(0,m.jsx)(`img`,{className:`h-30 object-cover`,src:Bv(e.src),alt:``});default:return null}}var Qw=U((0,m.jsx)(`path`,{d:`M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12 19 6.41z`}),`CloseOutlined`);function $w(){var e;let t=G(e=>e.config.ui?.mode===zo.OVERLAY),{width:n}=G(e=>e.stageSize),r=n<=700;return r&&(e=K().config.ui)!=null&&e.forceOverlayModeOnMobile&&(t=!0),{isModal:t,isMobile:r}}function eT(){let{isModal:e,isMobile:t}=$w(),n=G(e=>e.config.ui?.allowEditorClose)??!0,r=G(e=>e.config.ui?.menubar?.items),{left:i,center:a,right:o}=(0,l.useMemo)(()=>tT(r||[],t),[r,t]),s=e&&t&&n&&(0,m.jsx)(Q,{size:`sm`,className:`ml-10`,onClick:()=>{K().editor.close()},children:(0,m.jsx)(Qw,{})});return(0,m.jsxs)(x_.div,{className:sb,...cb,children:[(0,m.jsx)(`div`,{className:`mr-auto flex items-center gap-8`,children:i.map((e,t)=>(0,m.jsx)(Zw,{item:e},t))}),(0,m.jsx)(`div`,{className:`flex items-center gap-10`,children:a.map((e,t)=>(0,m.jsx)(Zw,{item:e},t))}),(0,m.jsx)(`div`,{className:`ml-auto flex items-center gap-8`,children:o.map((e,t)=>(0,m.jsx)(Zw,{item:e},t))}),s]})}function tT(e,t){let n={left:[],center:[],right:[]};(e||[]).filter(e=>!t&&!e.mobileOnly||t&&!e.desktopOnly).forEach(e=>{e.align===`left`?n.left.push({...e,position:e.position??1}):e.align===`right`?n.right.push({...e,position:e.position??1}):n.center.push({...e,position:e.position??1})});let r=Object.entries(n).map(([e,t])=>[e,t.sort((e,t)=>(e.position??0)-(t.position??0))]);return Object.fromEntries(r)}function nT(){return(0,m.jsx)(`div`,{className:`text-sm`,children:`${G(e=>e.crop.zoneRect?.width)||1}x${G(e=>e.crop.zoneRect?.height)||1}`})}function rT(){let e=G(e=>e.activeTool);return(0,m.jsxs)(x_.div,{className:sb,...cb,children:[(0,m.jsx)(iT,{}),aT(e),(0,m.jsx)(oT,{})]})}function iT(){let{isMobile:e}=$w(),t=G(e=>e.dirty);return e?(0,m.jsx)(Q,{size:`sm`,onClick:()=>{K().cancelChanges()},children:(0,m.jsx)(Qw,{})}):(0,m.jsx)(_b,{variant:`outline`,size:`xs`,startIcon:(0,m.jsx)(Qw,{}),radius:`rounded-full`,className:`min-w-92`,onClick:()=>{K().cancelChanges()},children:t?(0,m.jsx)(Z,{message:`Cancel`}):(0,m.jsx)(Z,{message:`Close`})})}function aT(e){if(!e)return null;let t=(0,m.jsx)(`div`,{className:`capitalize text-sm`,children:(0,m.jsx)(Z,{message:e})});switch(e){case V.CROP:return K().config.tools?.crop?.allowCustomRatio??!0?(0,m.jsx)(nT,{}):t;default:return t}}function oT(){let{isMobile:e}=$w(),t=G(e=>e.dirty);return e?(0,m.jsx)(Q,{size:`sm`,disabled:!t,onClick:()=>{K().applyChanges()},children:(0,m.jsx)(xb,{})}):(0,m.jsx)(_b,{variant:`flat`,color:`primary`,size:`xs`,disabled:!t,startIcon:(0,m.jsx)(xb,{}),radius:`rounded-full`,onClick:()=>{K().applyChanges()},children:(0,m.jsx)(Z,{message:`Apply`})})}function sT(){return(0,m.jsx)(M_,{initial:!1,children:G(e=>e.activeTool)?(0,m.jsx)(rT,{},`activeToolbar`):(0,m.jsx)(eT,{},`mainToolbar`)})}var cT={newCanvas:B(`Loading Canvas`),mainImage:B(`Loading Image`),state:B(`Loading State`),merge:B(`Processing Image`)};function lT(){let[e,t]=(0,l.useState)(!1);return(0,l.useEffect)(()=>{G.subscribe(e=>e.loading,e=>{e&&t(e)})},[]),(0,m.jsx)(M_,{children:e&&(0,m.jsx)(x_.div,{initial:{y:`60%`,opacity:0},animate:{y:0,opacity:1},exit:{y:`-60%`,opacity:0},transition:{type:`tween`,duration:.3},onAnimationComplete:()=>{setTimeout(()=>{t(!1)},400)},className:`absolute z-loading-indicator inset-0 m-auto p-6 w-144 h-32 text-center text-sm bg-paper rounded-full shadow-lg`,children:(0,m.jsx)(Z,{...cT[e]})})})}function uT(e,t,n){return Math.max(t,Math.min(e,n))}var dT={toVector(e,t){return e===void 0&&(e=t),Array.isArray(e)?e:[e,e]},add(e,t){return[e[0]+t[0],e[1]+t[1]]},sub(e,t){return[e[0]-t[0],e[1]-t[1]]},addTo(e,t){e[0]+=t[0],e[1]+=t[1]},subTo(e,t){e[0]-=t[0],e[1]-=t[1]}};function fT(e,t,n){return t===0||Math.abs(t)===1/0?e**(n*5):e*t*n/(t+n*e)}function pT(e,t,n,r=.15){return r===0?uT(e,t,n):e<t?-fT(t-e,n-t,r)+t:e>n?+fT(e-n,n-t,r)+n:e}function mT(e,[t,n],[r,i]){let[[a,o],[s,c]]=e;return[pT(t,a,o,r),pT(n,s,c,i)]}function hT(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function gT(e){var t=hT(e,`string`);return typeof t==`symbol`?t:String(t)}function _T(e,t,n){return t=gT(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function vT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function yT(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?vT(Object(n),!0).forEach(function(t){_T(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):vT(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}var bT={pointer:{start:`down`,change:`move`,end:`up`},mouse:{start:`down`,change:`move`,end:`up`},touch:{start:`start`,change:`move`,end:`end`},gesture:{start:`start`,change:`change`,end:`end`}};function xT(e){return e?e[0].toUpperCase()+e.slice(1):``}var ST=[`enter`,`leave`];function CT(e=!1,t){return e&&!ST.includes(t)}function wT(e,t=``,n=!1){let r=bT[e],i=r&&r[t]||t;return`on`+xT(e)+xT(i)+(CT(n,i)?`Capture`:``)}var TT=[`gotpointercapture`,`lostpointercapture`];function ET(e){let t=e.substring(2).toLowerCase(),n=!!~t.indexOf(`passive`);n&&(t=t.replace(`passive`,``));let r=TT.includes(t)?`capturecapture`:`capture`,i=!!~t.indexOf(r);return i&&(t=t.replace(`capture`,``)),{device:t,capture:i,passive:n}}function DT(e,t=``){let n=bT[e];return e+(n&&n[t]||t)}function OT(e){return`touches`in e}function kT(e){return OT(e)?`touch`:`pointerType`in e?e.pointerType:`mouse`}function AT(e){return Array.from(e.touches).filter(t=>{var n,r;return t.target===e.currentTarget||((n=e.currentTarget)==null||(r=n.contains)==null?void 0:r.call(n,t.target))})}function jT(e){return e.type===`touchend`||e.type===`touchcancel`?e.changedTouches:e.targetTouches}function MT(e){return OT(e)?jT(e)[0]:e}function NT(e,t){try{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);return{angle:-(Math.atan2(n,r)*180)/Math.PI,distance:o,origin:[i,a]}}catch{}return null}function PT(e){return AT(e).map(e=>e.identifier)}function FT(e,t){let[n,r]=Array.from(e.touches).filter(e=>t.includes(e.identifier));return NT(n,r)}function IT(e){let t=MT(e);return OT(e)?t.identifier:t.pointerId}function LT(e){let t=MT(e);return[t.clientX,t.clientY]}var RT=40,zT=800;function BT(e){let{deltaX:t,deltaY:n,deltaMode:r}=e;return r===1?(t*=RT,n*=RT):r===2&&(t*=zT,n*=zT),[t,n]}function VT(e){let t={};if(`buttons`in e&&(t.buttons=e.buttons),`shiftKey`in e){let{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a}=e;Object.assign(t,{shiftKey:n,altKey:r,metaKey:i,ctrlKey:a})}return t}function HT(e,...t){return typeof e==`function`?e(...t):e}function UT(){}function WT(...e){return e.length===0?UT:e.length===1?e[0]:function(){let t;for(let n of e)t=n.apply(this,arguments)||t;return t}}function GT(e,t){return Object.assign({},t,e||{})}var KT=32,qT=class{constructor(e,t,n){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())}get state(){return this.ctrl.state[this.key]}set state(e){this.ctrl.state[this.key]=e}get shared(){return this.ctrl.state.shared}get eventStore(){return this.ctrl.gestureEventStores[this.key]}get timeoutStore(){return this.ctrl.gestureTimeoutStores[this.key]}get config(){return this.ctrl.config[this.key]}get sharedConfig(){return this.ctrl.config.shared}get handler(){return this.ctrl.handlers[this.key]}reset(){let{state:e,shared:t,ingKey:n,args:r}=this;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=[[-1/0,1/0],[-1/0,1/0]],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}start(e){let t=this.state,n=this.config;t._active||(this.reset(),this.computeInitial(),t._active=!0,t.target=e.target,t.currentTarget=e.currentTarget,t.lastOffset=n.from?HT(n.from,t):t.offset,t.offset=t.lastOffset,t.startTime=t.timeStamp=e.timeStamp)}computeValues(e){let t=this.state;t._values=e,t.values=this.config.transform(e)}computeInitial(){let e=this.state;e._initial=e._values,e.initial=e.values}compute(e){let{state:t,config:n,shared:r}=this;t.args=this.args;let i=0;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,VT(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){let e=t._delta.map(Math.abs);dT.addTo(t._distance,e)}this.axisIntent&&this.axisIntent(e);let[a,o]=t._movement,[s,c]=n.threshold,{_step:l,values:u}=t;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;let d=[0,0];if(n.hasCustomTransform){let[e,t]=u;d[0]=l[0]===!1?0:e-l[0],d[1]=l[1]===!1?0:t-l[1]}else d[0]=l[0]===!1?0:a-l[0],d[1]=l[1]===!1?0:o-l[1];this.restrictToAxis&&!t._blocked&&this.restrictToAxis(d);let f=t.offset,p=t._active&&!t._blocked||t.active;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=HT(n.bounds,t)),this.setup&&this.setup()),t.movement=d,this.computeOffset()));let[m,h]=t.offset,[[g,_],[v,y]]=t._bounds;t.overflow=[m<g?-1:m>_?1:0,h<v?-1:h>y?1:0],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;let b=t._active&&n.rubberband||[0,0];if(t.offset=mT(t._bounds,t.offset,b),t.delta=dT.sub(t.offset,f),this.computeMovement(),p&&(!t.last||i>KT)){t.delta=dT.sub(t.offset,f);let e=t.delta.map(Math.abs);dT.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)}}emit(){let e=this.state,t=this.shared,n=this.config;if(e._active||this.clean(),(e._blocked||!e.intentional)&&!e._force&&!n.triggerAllEvents)return;let r=this.handler(yT(yT(yT({},t),e),{},{[this.aliasKey]:e.values}));r!==void 0&&(e.memo=r)}clean(){this.eventStore.clean(),this.timeoutStore.clean()}};function JT([e,t],n){let r=Math.abs(e),i=Math.abs(t);if(r>i&&r>n)return`x`;if(i>r&&i>n)return`y`}var YT=class extends qT{constructor(...e){super(...e),_T(this,`aliasKey`,`xy`)}reset(){super.reset(),this.state.axis=void 0}init(){this.state.offset=[0,0],this.state.lastOffset=[0,0]}computeOffset(){this.state.offset=dT.add(this.state.lastOffset,this.state.movement)}computeMovement(){this.state.movement=dT.sub(this.state.offset,this.state.lastOffset)}axisIntent(e){let t=this.state,n=this.config;if(!t.axis&&e){let r=typeof n.axisThreshold==`object`?n.axisThreshold[kT(e)]:n.axisThreshold;t.axis=JT(t._movement,r)}t._blocked=(n.lockDirection||!!n.axis)&&!t.axis||!!n.axis&&n.axis!==t.axis}restrictToAxis(e){if(this.config.axis||this.config.lockDirection)switch(this.state.axis){case`x`:e[1]=0;break;case`y`:e[0]=0;break}}},XT=e=>e,ZT=.15,QT={enabled(e=!0){return e},eventOptions(e,t,n){return yT(yT({},n.shared.eventOptions),e)},preventDefault(e=!1){return e},triggerAllEvents(e=!1){return e},rubberband(e=0){switch(e){case!0:return[ZT,ZT];case!1:return[0,0];default:return dT.toVector(e)}},from(e){if(typeof e==`function`)return e;if(e!=null)return dT.toVector(e)},transform(e,t,n){let r=e||n.shared.transform;return this.hasCustomTransform=!!r,r||XT},threshold(e){return dT.toVector(e,0)}},$T=0,eE=yT(yT({},QT),{},{axis(e,t,{axis:n}){if(this.lockDirection=n===`lock`,!this.lockDirection)return n},axisThreshold(e=$T){return e},bounds(e={}){if(typeof e==`function`)return t=>eE.bounds(e(t));if(`current`in e)return()=>e.current;if(typeof HTMLElement==`function`&&e instanceof HTMLElement)return e;let{left:t=-1/0,right:n=1/0,top:r=-1/0,bottom:i=1/0}=e;return[[t,n],[r,i]]}}),tE={ArrowRight:(e,t=1)=>[e*t,0],ArrowLeft:(e,t=1)=>[-1*e*t,0],ArrowUp:(e,t=1)=>[0,-1*e*t],ArrowDown:(e,t=1)=>[0,e*t]},nE=class extends YT{constructor(...e){super(...e),_T(this,`ingKey`,`dragging`)}reset(){super.reset();let e=this.state;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)}setup(){let e=this.state;if(e._bounds instanceof HTMLElement){let t=e._bounds.getBoundingClientRect(),n=e.currentTarget.getBoundingClientRect(),r={left:t.left-n.left+e.offset[0],right:t.right-n.right+e.offset[0],top:t.top-n.top+e.offset[1],bottom:t.bottom-n.bottom+e.offset[1]};e._bounds=eE.bounds(r)}}cancel(){let e=this.state;e.canceled||(e.canceled=!0,e._active=!1,setTimeout(()=>{this.compute(),this.emit()},0))}setActive(){this.state._active=this.state._pointerActive||this.state._keyboardActive}clean(){this.pointerClean(),this.state._pointerActive=!1,this.state._keyboardActive=!1,super.clean()}pointerDown(e){let t=this.config,n=this.state;if(e.buttons!=null&&(Array.isArray(t.pointerButtons)?!t.pointerButtons.includes(e.buttons):t.pointerButtons!==-1&&t.pointerButtons!==e.buttons))return;let r=this.ctrl.setEventIds(e);t.pointerCapture&&e.target.setPointerCapture(e.pointerId),!(r&&r.size>1&&n._pointerActive)&&(this.start(e),this.setupPointer(e),n._pointerId=IT(e),n._pointerActive=!0,this.computeValues(LT(e)),this.computeInitial(),t.preventScrollAxis&&kT(e)!==`mouse`?(n._active=!1,this.setupScrollPrevention(e)):t.delay>0?(this.setupDelayTrigger(e),t.triggerAllEvents&&(this.compute(e),this.emit())):this.startPointerDrag(e))}startPointerDrag(e){let t=this.state;t._active=!0,t._preventScroll=!0,t._delayed=!1,this.compute(e),this.emit()}pointerMove(e){let t=this.state,n=this.config;if(!t._pointerActive)return;let r=IT(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;let i=LT(e);if(document.pointerLockElement===e.target?t._delta=[e.movementX,e.movementY]:(t._delta=dT.sub(i,t._values),this.computeValues(i)),dT.addTo(t._movement,t._delta),this.compute(e),t._delayed&&t.intentional){this.timeoutStore.remove(`dragDelay`),t.active=!1,this.startPointerDrag(e);return}if(n.preventScrollAxis&&!t._preventScroll)if(t.axis)if(t.axis===n.preventScrollAxis||n.preventScrollAxis===`xy`){t._active=!1,this.clean();return}else{this.timeoutStore.remove(`startPointerDrag`),this.startPointerDrag(e);return}else return;this.emit()}pointerUp(e){this.ctrl.setEventIds(e);try{this.config.pointerCapture&&e.target.hasPointerCapture(e.pointerId)&&e.target.releasePointerCapture(e.pointerId)}catch{}let t=this.state,n=this.config;if(!t._active||!t._pointerActive)return;let r=IT(e);if(t._pointerId!==void 0&&r!==t._pointerId)return;this.state._pointerActive=!1,this.setActive(),this.compute(e);let[i,a]=t._distance;if(t.tap=i<=n.tapsThreshold&&a<=n.tapsThreshold,t.tap&&n.filterTaps)t._force=!0;else{let[e,r]=t._delta,[i,a]=t._movement,[o,s]=n.swipe.velocity,[c,l]=n.swipe.distance,u=n.swipe.duration;if(t.elapsedTime<u){let n=Math.abs(e/t.timeDelta),u=Math.abs(r/t.timeDelta);n>o&&Math.abs(i)>c&&(t.swipe[0]=Math.sign(e)),u>s&&Math.abs(a)>l&&(t.swipe[1]=Math.sign(r))}}this.emit()}pointerClick(e){!this.state.tap&&e.detail>0&&(e.preventDefault(),e.stopPropagation())}setupPointer(e){let t=this.config,n=t.device;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)))}pointerClean(){this.config.pointerLock&&document.pointerLockElement===this.state.currentTarget&&document.exitPointerLock()}preventScroll(e){this.state._preventScroll&&e.cancelable&&e.preventDefault()}setupScrollPrevention(e){this.state._preventScroll=!1,rE(e);let t=this.eventStore.add(this.sharedConfig.window,`touch`,`change`,this.preventScroll.bind(this),{passive:!1});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)}setupDelayTrigger(e){this.state._delayed=!0,this.timeoutStore.add(`dragDelay`,()=>{this.state._step=[0,0],this.startPointerDrag(e)},this.config.delay)}keyDown(e){let t=tE[e.key];if(t){let n=this.state,r=e.shiftKey?10:e.altKey?.1:1;this.start(e),n._delta=t(this.config.keyboardDisplacement,r),n._keyboardActive=!0,dT.addTo(n._movement,n._delta),this.compute(e),this.emit()}}keyUp(e){e.key in tE&&(this.state._keyboardActive=!1,this.setActive(),this.compute(e),this.emit())}bind(e){let t=this.config.device;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),{capture:!0,passive:!1})}};function rE(e){`persist`in e&&typeof e.persist==`function`&&e.persist()}var iE=typeof window<`u`&&window.document&&window.document.createElement;function aE(){return iE&&`ontouchstart`in window}function oE(){return aE()||iE&&window.navigator.maxTouchPoints>1}function sE(){return iE&&`onpointerdown`in window}function cE(){return iE&&`exitPointerLock`in window.document}function lE(){try{return`constructor`in GestureEvent}catch{return!1}}var uE={isBrowser:iE,gesture:lE(),touch:aE(),touchscreen:oE(),pointer:sE(),pointerLock:cE()},dE=250,fE=180,pE=.5,mE=50,hE=250,gE=10,_E={mouse:0,touch:0,pen:8},vE=yT(yT({},eE),{},{device(e,t,{pointer:{touch:n=!1,lock:r=!1,mouse:i=!1}={}}){return this.pointerLock=r&&uE.pointerLock,uE.touch&&n?`touch`:this.pointerLock?`mouse`:uE.pointer&&!i?`pointer`:uE.touch?`touch`:`mouse`},preventScrollAxis(e,t,{preventScroll:n}){if(this.preventScrollDelay=typeof n==`number`?n:n||n===void 0&&e?dE:void 0,!(!uE.touchscreen||n===!1))return e||(n===void 0?void 0:`y`)},pointerCapture(e,t,{pointer:{capture:n=!0,buttons:r=1,keys:i=!0}={}}){return this.pointerButtons=r,this.keys=i,!this.pointerLock&&this.device===`pointer`&&n},threshold(e,t,{filterTaps:n=!1,tapsThreshold:r=3,axis:i=void 0}){let a=dT.toVector(e,n?r:i?1:0);return this.filterTaps=n,this.tapsThreshold=r,a},swipe({velocity:e=pE,distance:t=mE,duration:n=hE}={}){return{velocity:this.transform(dT.toVector(e)),distance:this.transform(dT.toVector(t)),duration:n}},delay(e=0){switch(e){case!0:return fE;case!1:return 0;default:return e}},axisThreshold(e){return e?yT(yT({},_E),e):_E},keyboardDisplacement(e=gE){return e}});function yE(e){let[t,n]=e.overflow,[r,i]=e._delta,[a,o]=e._direction;(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])}var bE=30,xE=100,SE=class extends qT{constructor(...e){super(...e),_T(this,`ingKey`,`pinching`),_T(this,`aliasKey`,`da`)}init(){this.state.offset=[1,0],this.state.lastOffset=[1,0],this.state._pointerEvents=new Map}reset(){super.reset();let e=this.state;e._touchIds=[],e.canceled=!1,e.cancel=this.cancel.bind(this),e.turns=0}computeOffset(){let{type:e,movement:t,lastOffset:n}=this.state;e===`wheel`?this.state.offset=dT.add(t,n):this.state.offset=[(1+t[0])*n[0],t[1]+n[1]]}computeMovement(){let{offset:e,lastOffset:t}=this.state;this.state.movement=[e[0]/t[0],e[1]-t[1]]}axisIntent(){let e=this.state,[t,n]=e._movement;if(!e.axis){let r=Math.abs(t)*bE-Math.abs(n);r<0?e.axis=`angle`:r>0&&(e.axis=`scale`)}}restrictToAxis(e){this.config.lockDirection&&(this.state.axis===`scale`?e[1]=0:this.state.axis===`angle`&&(e[0]=0))}cancel(){let e=this.state;e.canceled||setTimeout(()=>{e.canceled=!0,e._active=!1,this.compute(),this.emit()},0)}touchStart(e){this.ctrl.setEventIds(e);let t=this.state,n=this.ctrl.touchIds;if(t._active&&t._touchIds.every(e=>n.has(e))||n.size<2)return;this.start(e),t._touchIds=Array.from(n).slice(0,2);let r=FT(e,t._touchIds);r&&this.pinchStart(e,r)}pointerStart(e){if(e.buttons!=null&&e.buttons%2!=1)return;this.ctrl.setEventIds(e),e.target.setPointerCapture(e.pointerId);let t=this.state,n=t._pointerEvents,r=this.ctrl.pointerIds;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;this.start(e);let i=NT(...Array.from(n.values()));i&&this.pinchStart(e,i)}pinchStart(e,t){let n=this.state;n.origin=t.origin,this.computeValues([t.distance,t.angle]),this.computeInitial(),this.compute(e),this.emit()}touchMove(e){if(!this.state._active)return;let t=FT(e,this.state._touchIds);t&&this.pinchMove(e,t)}pointerMove(e){let t=this.state._pointerEvents;if(t.has(e.pointerId)&&t.set(e.pointerId,e),!this.state._active)return;let n=NT(...Array.from(t.values()));n&&this.pinchMove(e,n)}pinchMove(e,t){let n=this.state,r=n._values[1],i=t.angle-r,a=0;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()}touchEnd(e){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())}pointerEnd(e){let t=this.state;this.ctrl.setEventIds(e);try{e.target.releasePointerCapture(e.pointerId)}catch{}t._pointerEvents.has(e.pointerId)&&t._pointerEvents.delete(e.pointerId),t._active&&t._pointerEvents.size<2&&(t._active=!1,this.compute(e),this.emit())}gestureStart(e){e.cancelable&&e.preventDefault();let t=this.state;t._active||(this.start(e),this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY],this.compute(e),this.emit())}gestureMove(e){if(e.cancelable&&e.preventDefault(),!this.state._active)return;let t=this.state;this.computeValues([e.scale,e.rotation]),t.origin=[e.clientX,e.clientY];let n=t._movement;t._movement=[e.scale-1,e.rotation],t._delta=dT.sub(t._movement,n),this.compute(e),this.emit()}gestureEnd(e){this.state._active&&(this.state._active=!1,this.compute(e),this.emit())}wheel(e){let t=this.config.modifierKey;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)))}wheelStart(e){this.start(e),this.wheelChange(e)}wheelChange(e){`uv`in e||e.cancelable&&e.preventDefault();let t=this.state;t._delta=[-BT(e)[1]/xE*t.offset[0],0],dT.addTo(t._movement,t._delta),yE(t),this.state.origin=[e.clientX,e.clientY],this.compute(e),this.emit()}wheelEnd(){this.state._active&&(this.state._active=!1,this.compute(),this.emit())}bind(e){let t=this.config.device;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})}},CE=yT(yT({},QT),{},{device(e,t,{shared:n,pointer:{touch:r=!1}={}}){if(n.target&&!uE.touch&&uE.gesture)return`gesture`;if(uE.touch&&r)return`touch`;if(uE.touchscreen){if(uE.pointer)return`pointer`;if(uE.touch)return`touch`}},bounds(e,t,{scaleBounds:n={},angleBounds:r={}}){let i=e=>{let t=GT(HT(n,e),{min:-1/0,max:1/0});return[t.min,t.max]},a=e=>{let t=GT(HT(r,e),{min:-1/0,max:1/0});return[t.min,t.max]};return typeof n!=`function`&&typeof r!=`function`?[i(),a()]:e=>[i(e),a(e)]},threshold(e,t,n){return this.lockDirection=n.axis===`lock`,dT.toVector(e,this.lockDirection?[.1,3]:0)},modifierKey(e){return e===void 0?`ctrlKey`:e},pinchOnWheel(e=!0){return e}});yT(yT({},eE),{},{mouseOnly:(e=!0)=>e}),yT(yT({},eE),{},{mouseOnly:(e=!0)=>e});var wE=new Map,TE=new Map;function EE(e){wE.set(e.key,e.engine),TE.set(e.key,e.resolver)}var DE={key:`drag`,engine:nE,resolver:vE},OE={key:`pinch`,engine:SE,resolver:CE};function kE(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function AE(e,t){if(e==null)return{};var n=kE(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}var jE={target(e){if(e)return()=>`current`in e?e.current:e},enabled(e=!0){return e},window(e=uE.isBrowser?window:void 0){return e},eventOptions({passive:e=!0,capture:t=!1}={}){return{passive:e,capture:t}},transform(e){return e}},ME=[`target`,`eventOptions`,`window`,`enabled`,`transform`];function NE(e={},t){let n={};for(let[r,i]of Object.entries(t))switch(typeof i){case`function`:n[r]=i.call(n,e[r],r,e);break;case`object`:n[r]=NE(e[r],i);break;case`boolean`:i&&(n[r]=e[r]);break}return n}function PE(e,t,n={}){let r=e,{target:i,eventOptions:a,window:o,enabled:s,transform:c}=r,l=AE(r,ME);if(n.shared=NE({target:i,eventOptions:a,window:o,enabled:s,transform:c},jE),t){let e=TE.get(t);n[t]=NE(yT({shared:n.shared},l),e)}else for(let e in l){let t=TE.get(e);t&&(n[e]=NE(yT({shared:n.shared},l[e]),t))}return n}var FE=class{constructor(e,t){_T(this,`_listeners`,new Set),this._ctrl=e,this._gestureKey=t}add(e,t,n,r,i){let a=this._listeners,o=DT(t,n),s=yT(yT({},this._gestureKey?this._ctrl.config[this._gestureKey].eventOptions:{}),i);e.addEventListener(o,r,s);let c=()=>{e.removeEventListener(o,r,s),a.delete(c)};return a.add(c),c}clean(){this._listeners.forEach(e=>e()),this._listeners.clear()}},IE=class{constructor(){_T(this,`_timeouts`,new Map)}add(e,t,n=140,...r){this.remove(e),this._timeouts.set(e,window.setTimeout(t,n,...r))}remove(e){let t=this._timeouts.get(e);t&&window.clearTimeout(t)}clean(){this._timeouts.forEach(e=>void window.clearTimeout(e)),this._timeouts.clear()}},LE=class{constructor(e){_T(this,`gestures`,new Set),_T(this,`_targetEventStore`,new FE(this)),_T(this,`gestureEventStores`,{}),_T(this,`gestureTimeoutStores`,{}),_T(this,`handlers`,{}),_T(this,`config`,{}),_T(this,`pointerIds`,new Set),_T(this,`touchIds`,new Set),_T(this,`state`,{shared:{shiftKey:!1,metaKey:!1,ctrlKey:!1,altKey:!1}}),zE(this,e)}setEventIds(e){if(OT(e))return this.touchIds=new Set(PT(e)),this.touchIds;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}applyHandlers(e,t){this.handlers=e,this.nativeHandlers=t}applyConfig(e,t){this.config=PE(e,t,this.config)}clean(){this._targetEventStore.clean();for(let e of this.gestures)this.gestureEventStores[e].clean(),this.gestureTimeoutStores[e].clean()}effect(){return this.config.shared.target&&this.bind(),()=>this._targetEventStore.clean()}bind(...e){let t=this.config.shared,n={},r;if(!(t.target&&(r=t.target(),!r))){if(t.enabled){for(let t of this.gestures){let i=this.config[t],a=BE(n,i.eventOptions,!!r);i.enabled&&new(wE.get(t))(this,e,t).bind(a)}let i=BE(n,t.eventOptions,!!r);for(let t in this.nativeHandlers)i(t,``,n=>this.nativeHandlers[t](yT(yT({},this.state.shared),{},{event:n,args:e})),void 0,!0)}for(let e in n)n[e]=WT(...n[e]);if(!r)return n;for(let e in n){let{device:t,capture:i,passive:a}=ET(e);this._targetEventStore.add(r,t,``,n[e],{capture:i,passive:a})}}}};function RE(e,t){e.gestures.add(t),e.gestureEventStores[t]=new FE(e,t),e.gestureTimeoutStores[t]=new IE}function zE(e,t){t.drag&&RE(e,`drag`),t.wheel&&RE(e,`wheel`),t.scroll&&RE(e,`scroll`),t.move&&RE(e,`move`),t.pinch&&RE(e,`pinch`),t.hover&&RE(e,`hover`)}var BE=(e,t,n)=>(r,i,a,o={},s=!1)=>{let c=o.capture??t.capture,l=o.passive??t.passive,u=s?r:wT(r,i,c);n&&l&&(u+=`Passive`),e[u]=e[u]||[],e[u].push(a)},VE=/^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;function HE(e){let t={},n={},r=new Set;for(let i in e)VE.test(i)?(r.add(RegExp.lastMatch),n[i]=e[i]):t[i]=e[i];return[n,t,r]}function UE(e,t,n,r,i,a){if(!e.has(n)||!wE.has(r))return;let o=n+`Start`,s=n+`End`;i[r]=e=>{let r;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},a[r]=a[r]||{}}function WE(e,t){let[n,r,i]=HE(e),a={};return UE(i,n,`onDrag`,`drag`,a,t),UE(i,n,`onWheel`,`wheel`,a,t),UE(i,n,`onScroll`,`scroll`,a,t),UE(i,n,`onPinch`,`pinch`,a,t),UE(i,n,`onMove`,`move`,a,t),UE(i,n,`onHover`,`hover`,a,t),{handlers:a,config:t,nativeHandlers:r}}function GE(e,t={},n,r){let i=l.default.useMemo(()=>new LE(e),[]);if(i.applyHandlers(e,r),i.applyConfig(t,n),l.default.useEffect(i.effect.bind(i)),l.default.useEffect(()=>i.clean.bind(i),[]),t.target===void 0)return i.bind.bind(i)}function KE(e){return e.forEach(EE),function(e,t){let{handlers:n,nativeHandlers:r,config:i}=WE(e,t||{});return GE(n,i,void 0,r)}}function qE({e,rect:t,deltaX:n,deltaY:r}){return{rect:t,x:e.clientX,y:e.clientY,deltaX:n??0,deltaY:r??0,nativeEvent:e}}function JE({onMoveStart:e,onMove:t,onMoveEnd:n,minimumMovement:r=0,preventDefault:i,stopPropagation:a=!0,onPress:o,onLongPress:s,...c}){let u=(0,l.useRef)({lastPosition:{x:0,y:0},started:!1,longPressTriggered:!1}).current,{addGlobalListener:d,removeGlobalListener:f}=sv(),p=t=>{!u.el||e?.(t,u.el)===!1||(u.originalTouchAction=u.el.style.touchAction,u.el.style.touchAction=`none`,u.originalUserSelect=document.documentElement.style.userSelect,document.documentElement.style.userSelect=`none`,u.started=!0)},m=n=>{if(n.button===0&&u.id==null){if(u.started=!1,c.onPointerDown?.call(c,n)===!1)return;a&&n.stopPropagation(),i&&n.preventDefault(),u.id=n.pointerId,u.el=n.currentTarget,u.lastPosition={x:n.clientX,y:n.clientY},s&&(u.longPressTimer=setTimeout(()=>{s(n,u.el),u.longPressTriggered=!0},400)),(e||t)&&d(window,`pointermove`,h,!1),d(window,`pointerup`,g,!1),d(window,`pointercancel`,g,!1)}},h=e=>{if(e.pointerId===u.id){let n=e.clientX-u.lastPosition.x,i=e.clientY-u.lastPosition.y;(Math.abs(n)>=r||Math.abs(i)>=r)&&!u.started&&p(e),u.started&&(t?.(e,n,i),u.lastPosition={x:e.clientX,y:e.clientY})}},g=e=>{var t;if(e.pointerId===u.id){u.longPressTimer&&clearTimeout(u.longPressTimer);let r=u.longPressTriggered;u.longPressTriggered=!1,u.started&&n?.(e),u.el&&(e.type!==`pointercancel`&&((t=c.onPointerUp)==null||t.call(c,e,u.el),e.target&&u.el.contains(e.target)&&(r?s?.(e,u.el):o?.(e,u.el))),document.documentElement.style.userSelect=u.originalUserSelect||``,u.el.style.touchAction=u.originalTouchAction||``),u.id=void 0,u.started=!1,f(window,`pointermove`,h,!1),f(window,`pointerup`,g,!1),f(window,`pointercancel`,g,!1)}};return{domProps:{onPointerDown:hb(m)}}}function YE(e,t){let n={...e};n.left=Math.max(0,n.left);let r=n.left-e.left;r>0&&(n.width-=r),n.top=Math.max(0,n.top);let i=n.top-e.top;return i>0&&(n.height-=i),n.width=Math.min(n.width,t.width-n.left),n.height=Math.min(n.height,t.height-n.top),n}function XE(e){return{left:e.left,top:e.top,width:e.width,height:e.height}}var ZE=(e=>(e.topLeft=`topLeft`,e.topRight=`topRight`,e.bottomLeft=`bottomLeft`,e.bottomRight=`bottomRight`,e))(ZE||{}),$={},QE=(e={})=>{Cv(null),$=e};function $E({aspectRatio:e,boundaryRef:t,boundaryRect:n,restrictWithinBoundary:r=!0,minWidth:i=50,minHeight:a=50,...o}){let{domProps:s}=JE({onMoveStart:(e,r)=>{var i;let a=e.target;if(!a.dataset.resizeHandle||Sv||(QE({currentRect:XE(r.getBoundingClientRect()),resizeDir:a.dataset.resizeHandle}),!$.currentRect))return!1;Cv(`resize`),n?$.boundaryRect=n:t!=null&&t.current&&($.boundaryRect=XE(t.current.getBoundingClientRect())),$.currentRect&&$.boundaryRect&&($.currentRect.left-=$.boundaryRect.left,$.currentRect.top-=$.boundaryRect.top),$.initialAspectRatio=$.currentRect.width/$.currentRect.height,(i=o.onResizeStart)==null||i.call(o,qE({rect:$.currentRect,e}))},onMove:(t,n,r)=>{var s;if(!$.resizeDir||!$.currentRect)return;let c=e===`initial`?$.initialAspectRatio:e,l=eD($.currentRect,n,r,c),u=tD(l,i,a,c);(s=o.onResize)==null||s.call(o,qE({rect:u,e:t,deltaX:n,deltaY:r})),$.currentRect=l},onMoveEnd:e=>{var t;$.currentRect&&((t=o.onResizeEnd)==null||t.call(o,qE({rect:$.currentRect,e}))),QE()}});return{resizeProps:s}}function eD(e,t,n,r){let i={...e},a={...e};return $.resizeDir===`topRight`?(a.width=Math.floor(a.width+t),r?a.height=Math.floor(a.width/r):a.height=Math.floor(a.height-n),a.top=Math.floor(a.top+(i.height-a.height))):$.resizeDir===`bottomRight`?(a.width=Math.floor(a.width+t),r?a.height=Math.floor(a.width/r):a.height=Math.floor(a.height+n)):$.resizeDir===`topLeft`?(a.width=Math.floor(a.width-t),r?a.height=Math.floor(a.width/r):a.height=Math.floor(a.height-n),a.left=Math.floor(a.left+(i.width-a.width)),a.top=Math.floor(a.top+(i.height-a.height))):$.resizeDir===`bottomLeft`&&(a.width=Math.floor(a.width-t),r?a.height=Math.floor(a.width/r):a.height=Math.floor(a.height+n),a.left=Math.floor(a.left+t)),a}function tD(e,t,n,r){let i=$.resizeDir===`bottomLeft`||$.resizeDir===`topLeft`,a=$.resizeDir===`topRight`||$.resizeDir===`topLeft`,o={...e};o.width=Math.max(t,e.width),o.height=Math.max(n,e.height);let s=o.width-e.width;i&&s>0&&(o.left-=s);let c=o.height-e.height;if(a&&c>0&&(o.top-=c),$.boundaryRect&&(o=YE(o,$.boundaryRect)),r){let e=o.width,t=o.height,n=fy(r,o.width,o.height);o.width=n.width,o.height=n.height,a&&(o.top+=t-o.height),i&&(o.left+=e-o.width)}return o}function nD({position:e,inset:t=!1}){let n=rD(e,t);return(0,m.jsx)(`div`,{"data-resize-handle":e,className:`border-white absolute w-20 h-20 ${n}`})}function rD(e,t){let n=t?`left-0`:`-left-5`,r=t?`top-0`:`-top-5`,i=t?`bottom-0`:`-bottom-5`,a=t?`right-0`:`-right-5`;switch(e){case ZE.topLeft:return`${n} ${r} border-l-4 border-t-4 cursor-nwse-resize`;case ZE.topRight:return`${a} ${r} border-r-4 border-t-4 cursor-nesw-resize`;case ZE.bottomRight:return`${a} ${i} border-r-4 border-b-4 cursor-se-resize`;case ZE.bottomLeft:return`${n} ${i} border-l-4 border-b-4 cursor-sw-resize`;default:return``}}var iD=(e=>(e.top=`maskTop`,e.right=`maskRight`,e.bottom=`maskBottom`,e.left=`maskLeft`,e))(iD||{});function aD({position:e,refs:t}){return(0,m.jsx)(`div`,{className:`cropzone-transition bg-black/50 bottom absolute ${oD(e)}`,ref:n=>t.current[e]=n})}function oD(e){switch(e){case`maskTop`:return`left-0 top-0`;case`maskBottom`:return`bottom-0 left-0`;default:return``}}function sD({name:e,refs:t}){return(0,m.jsx)(`div`,{className:H(`cropzone-transition pointer-events-none absolute left-0 top-0 bg-white/50`,e.startsWith(`lineHor`)?`h-px`:`w-px`),ref:n=>{t.current[e]=n}})}function cD(e,t,n){return Math.min(Math.max(e,t),n)}var lD={};function uD({boundaryRef:e,boundaryRect:t,minimumMovement:n,restrictWithinBoundary:r=!0,...i}){let{domProps:a}=JE({minimumMovement:n,onMoveStart:(n,r)=>{var a;if(Sv)return!1;lD={currentRect:XE(r.getBoundingClientRect())},Cv(`move`),t?lD.boundaryRect=t:e!=null&&e.current&&(lD.boundaryRect=XE(e.current.getBoundingClientRect())),lD.currentRect&&lD.boundaryRect&&(lD.currentRect.left-=lD.boundaryRect.left,lD.currentRect.top-=lD.boundaryRect.top),(a=i.onMoveStart)==null||a.call(i,qE({rect:lD.currentRect,e:n}))},onMove:(e,t,n)=>{var a;if(!lD.currentRect)return;let o={...lD.currentRect,left:lD.currentRect.left+t,top:lD.currentRect.top+n},s={...o};lD.boundaryRect&&r&&(s.left=cD(o.left,0,lD.boundaryRect.width-o.width),s.top=cD(o.top,0,lD.boundaryRect.height-o.height)),(a=i.onMove)==null||a.call(i,qE({rect:s,e,deltaX:t,deltaY:n})),lD.currentRect=o},onMoveEnd:e=>{var t;lD.currentRect&&((t=i.onMoveEnd)==null||t.call(i,qE({rect:lD.currentRect,e})),Cv(null),lD={})}});return{moveProps:a}}function dD(){let e=(0,l.useRef)({}),[t,n]=(0,l.useState)(!0),r=G(e=>e.canvasSize),i=G(e=>e.config.tools?.crop?.cropzone),a=G(e=>e.config.tools?.crop?.defaultRatio)||null,o=G(e=>e.crop.selectedAspectRatio)||null,{moveProps:s}=uD({boundaryRect:r,onMoveStart:()=>n(!0),onMove:e=>q().crop.drawZone(e.rect),onMoveEnd:()=>n(!1)}),{resizeProps:c}=$E({boundaryRect:r,minHeight:50,minWidth:50,aspectRatio:py(o),onResizeStart:()=>n(!0),onResize:e=>q().crop.drawZone(e.rect),onResizeEnd:()=>n(!1)});return(0,l.useLayoutEffect)(()=>{q().crop.registerRefs(e),q().crop.resetCropzone(a)},[a,r]),(0,m.jsxs)(`div`,{className:H(`cropzone absolute z-cropzone isolate left-0 top-0 w-full h-full overflow-hidden`,t&&`moving`),onPointerDown:e=>{e.stopPropagation(),e.preventDefault()},children:[(0,m.jsxs)(`div`,{className:`cropzone-transition border-white/50 absolute z-10 left-0 top-0 border`,...q_(c,s),ref:t=>e.current.innerZone=t,children:[!(i!=null&&i.hideTopLeft)&&(0,m.jsx)(nD,{position:ZE.topLeft,inset:!0}),!(i!=null&&i.hideTopRight)&&(0,m.jsx)(nD,{position:ZE.topRight,inset:!0}),!(i!=null&&i.hideBottomLeft)&&(0,m.jsx)(nD,{position:ZE.bottomLeft,inset:!0}),!(i!=null&&i.hideBottomRight)&&(0,m.jsx)(nD,{position:ZE.bottomRight,inset:!0}),(0,m.jsx)(sD,{name:`lineVer1`,refs:e}),(0,m.jsx)(sD,{name:`lineVer2`,refs:e}),(0,m.jsx)(sD,{name:`lineHor1`,refs:e}),(0,m.jsx)(sD,{name:`lineHor2`,refs:e})]}),(0,m.jsx)(aD,{refs:e,position:iD.top}),(0,m.jsx)(aD,{refs:e,position:iD.left}),(0,m.jsx)(aD,{refs:e,position:iD.right}),(0,m.jsx)(aD,{refs:e,position:iD.bottom})]})}var fD=U((0,m.jsx)(`path`,{d:`M 7 2 C 6.448 2 6 2.448 6 3 C 6 3.552 6.448 4 7 4 L 20 4 L 20 17 C 20 17.552 20.448 18 21 18 C 21.552 18 22 17.552 22 17 L 22 4 C 22 2.895 21.105 2 20 2 L 7 2 z M 4 6 C 2.895 6 2 6.895 2 8 L 2 20 C 2 21.105 2.895 22 4 22 L 16 22 C 17.105 22 18 21.105 18 20 L 18 8 C 18 6.895 17.105 6 16 6 L 4 6 z M 10 10 C 10.552 10 11 10.448 11 11 L 11 13 L 13 13 C 13.552 13 14 13.448 14 14 C 14 14.552 13.552 15 13 15 L 11 15 L 11 17 C 11 17.552 10.552 18 10 18 C 9.448 18 9 17.552 9 17 L 9 15 L 7 15 C 6.448 15 6 14.552 6 14 C 6 13.448 6.448 13 7 13 L 9 13 L 9 11 C 9 10.448 9.448 10 10 10 z`})),pD=U((0,m.jsx)(`path`,{d:`M 11 3 L 2 21 L 11 21 L 11 3 z M 13 3 L 13 21 L 22 21 L 13 3 z M 9 11.472656 L 9 19 L 5.2363281 19 L 9 11.472656 z`})),mD=U((0,m.jsx)(`path`,{d:`M 16.476562 2.4511719 C 16.392047 2.4657656 16.308531 2.5061719 16.238281 2.5761719 L 14.130859 4.6835938 C 13.956859 4.8575938 13.956859 5.1394531 14.130859 5.3144531 L 16.238281 7.4238281 C 16.519281 7.7048281 17 7.5054219 17 7.1074219 L 17 6 L 20 6 L 20 9 A 1.0001 1.0001 0 1 0 22 9 L 22 6 C 22 4.9069372 21.093063 4 20 4 L 17 4 L 17 2.8925781 C 17 2.5940781 16.730109 2.4073906 16.476562 2.4511719 z M 4 5 C 2.9069372 5 2 5.9069372 2 7 L 2 14 C 2 15.093063 2.9069372 16 4 16 L 7 16 L 7 19 C 7 20.105 7.895 21 9 21 L 16 21 C 17.105 21 18 20.105 18 19 L 18 12 C 18 10.895 17.105 10 16 10 L 13 10 L 13 7 C 13 5.9069372 12.093063 5 11 5 L 4 5 z M 4 7 L 11 7 L 11 14 L 4 14 L 4 7 z`})),hD=U((0,m.jsx)(`path`,{d:`M 10 2 L 9 3 L 3 3 L 3 5 L 21 5 L 21 3 L 15 3 L 14 2 L 10 2 z M 4.3652344 7 L 5.8925781 20.263672 C 6.0245781 21.253672 6.877 22 7.875 22 L 16.123047 22 C 17.121047 22 17.974422 21.254859 18.107422 20.255859 L 19.634766 7 L 4.3652344 7 z`})),gD={width:120,height:30},_D=[{name:`Duplicate`,icon:fD,onClick:()=>{q().objects.duplicate()}},{name:`Flip`,icon:pD,onClick:()=>{q().objects.flipHorizontally()}},{name:`Bring to front`,icon:mD,onClick:()=>{q().objects.bringToFront()}},{name:`Delete`,icon:hD,onClick:()=>{q().objects.delete()}}],vD=l.default.forwardRef((e,t)=>(0,m.jsx)(`div`,{ref:t,className:`${G(e=>e.objects.active.isMoving)?`opacity-0`:`opacity-100`} absolute z-obj-box left-0 top-0 flex items-center text-white bg-controls rounded shadow transition-opacity overflow-hidden`,children:_D.map(e=>{let t=e.icon;return(0,m.jsx)(Q,{size:`sm`,className:`w-30 h-30 hover:bg-white/hover`,radius:`rounded-none`,onClick:e.onClick,children:(0,m.jsx)(t,{})},e.name)})}));function yD(e,t){if(!t)return;let n=e.angle||0,r=n>168&&n<188?-30:-15,i=K().canvasSize,a=K().stageSize,o=gD,s=i.top-a.top,c=i.left-a.left,l=a.width-(c+i.width),u=a.height-(s+i.height),d=-s,f=-(i.left-a.left),p=i.width-o.width+l,m=i.height-o.height+u,h=e.getBoundingRect(),g=h.top-o.height+r,_=h.left+h.width/2-o.width/2;g=Math.min(m,Math.max(d,g)),_=Math.min(p,Math.max(f,_)),t.style.transform=`translate(${_}px, ${g}px) rotate(0deg)`}function bD(e){let t=q().objects.getActive();if(!t||!e.rect.angle)return;let n=X.fabric.util.radiansToDegrees(e.rect.angle);n!==t.angle&&q().objects.setValues({angle:n})}function xD(e){let t=e.rect.width/2,n=e.rect.height/2;q().objects.setValues({left:(e.rect.left+t)/K().zoom,top:(e.rect.top+n)/K().zoom})}function SD(e){let t=q().objects.getActive();if(!t)return;let n={};Tl(t)?(e.deltaX>0||t.getScaledHeight()>=20&&t.getScaledWidth()>=20)&&(n.fontSize=(t.fontSize||1)+e.deltaX):(t.width&&(n.scaleX=e.rect.width/K().zoom/t.width),t.height&&(n.scaleY=e.rect.height/K().zoom/t.height)),q().objects.setValues(n)}function CD(e,t){let n=q().objects.getActive();if(!n||!e.current)return;let r=e.current,i=X.fabric.util.degreesToRadians(n.angle??0),a=Math.round(n.getScaledWidth()*K().zoom),o=Math.round(n.getScaledHeight()*K().zoom),s=Math.round((n.left??0)*K().zoom),c=Math.round((n.top??0)*K().zoom),l=n.originX===`center`?a/2:0,u=n.originY===`center`?o/2:0;n.padding&&(a+=n.padding*2,o+=n.padding*2,s-=n.padding,c-=n.padding),r.style.width=`${a}px`,r.style.height=`${o}px`,r.style.transform=`translate(${s-l}px, ${c-u}px) rotate(${i}rad)`,q().canvas.render(),yD(n,t.current)}function wD(){var e;let t=q().objects.getActive();Tl(t)&&(t.enterEditing(),(e=t.hiddenTextarea)==null||e.focus())}function TD(){return(0,m.jsx)(`div`,{className:`absolute -bottom-20 left-1/2 w-2 h-20 bg-white cursor-default -translate-x-1/2`,children:(0,m.jsx)(`div`,{"data-rotate-handle":!0,className:`w-18 h-18 absolute -bottom-10 -left-8 bg-white rounded-full cursor-move`})})}var ED={};function DD(e){let{domProps:t}=JE({onMoveStart:(t,n)=>{var r;if(!t.target.dataset.rotateHandle||Sv)return!1;let i=XE(n.getBoundingClientRect());if(!i)return!1;let a=n.style.transform.match(/rotate\((.+?)\)/)?.[1],[o=`0`]=a?a.split(`,`):[];kD({currentRect:i,centerX:i.left+i.width/2,centerY:i.top+i.height/2,startAngle:parseFloat(o)}),Cv(`rotate`),ED.startAngle=OD(t),(r=e.onRotateStart)==null||r.call(e,qE({rect:i,e:t}))},onMove:(t,n,r)=>{var i;if(!ED.currentRect)return;let a={...ED.currentRect};a.angle=OD(t),a.left+=n,a.top+=r,(i=e.onRotate)==null||i.call(e,qE({rect:a,e:t,deltaX:n,deltaY:r})),ED.currentRect=a},onMoveEnd:t=>{var n;ED.currentRect&&((n=e.onRotateEnd)==null||n.call(e,qE({rect:ED.currentRect,e:t}))),kD()}});return{rotateProps:t}}function OD(e){let t={x:ED.centerX||0,y:ED.centerY||0};return Math.atan2(t.y-e.pageY,t.x-e.pageX)-(ED.startAngle||0)}var kD=(e={})=>{Cv(null),ED=e};function AD(){let e=(0,l.useRef)(null),t=(0,l.useRef)(null),n=G(e=>e.objects.active.id),r=G(e=>e.objects.isEditingText),i=G(e=>e.zoom),a=jD(),o=(0,l.useRef)(null),s=(0,l.useCallback)(()=>{o.current?(clearTimeout(o.current),o.current=null,wD()):o.current=setTimeout(()=>{o.current=null},300)},[]),{moveProps:c}=uD({boundaryRef:K().canvasRef,restrictWithinBoundary:!1,onMoveEnd:()=>{K().objects.setActiveIsMoving(!1)},onMove:e=>{K().objects.setActiveIsMoving(!0),xD(e)}});a.lockMovement&&(c={});let{resizeProps:u}=$E({minWidth:50,minHeight:50,aspectRatio:a.unlockAspectRatio?null:`initial`,boundaryRef:a.containWithinCanvas?K().canvasRef:void 0,restrictWithinBoundary:!1,onResizeEnd:()=>{K().objects.setActiveIsMoving(!1)},onResize:e=>{K().objects.setActiveIsMoving(!0),SD(e)}}),{rotateProps:d}=DD({boundaryRef:K().canvasRef,onRotateEnd:()=>{K().objects.setActiveIsMoving(!1)},onRotate:e=>{K().objects.setActiveIsMoving(!0),bD(e)}});return(0,l.useEffect)(()=>{J()&&K().editor.on(`object:modified`,n=>{n.sizeOrPositionChanged&&CD(e,t)})},[]),(0,l.useEffect)(()=>{CD(e,t)},[n,i,r]),(0,m.jsxs)(`div`,{className:n&&!r?`block`:`hidden`,children:[(0,m.jsxs)(`div`,{ref:e,...q_(d,u,c),onClick:s,className:`absolute z-obj-box border-2 border-white shadow-md cursor-move`,children:[!a.hideTopLeft&&(0,m.jsx)(nD,{position:ZE.topLeft}),!a.hideTopRight&&(0,m.jsx)(nD,{position:ZE.topRight}),!a.hideBottomLeft&&(0,m.jsx)(nD,{position:ZE.bottomLeft}),!a.hideBottomRight&&(0,m.jsx)(nD,{position:ZE.bottomRight}),!a.hideRotatingPoint&&(0,m.jsx)(TD,{})]}),(0,m.jsx)(vD,{ref:t})]})}function jD(){let e=q().objects.getActive();if(!e||!e.name)return{};let t=K().config.objectControls||{},n=e.name;return{...t.global,...t[n]}}function MD(){let e=G(e=>e.activeTool===V.CROP),t=G(e=>e.objects.active.id);return(0,m.jsxs)(`div`,{children:[e&&(0,m.jsx)(dD,{}),t&&(0,m.jsx)(AD,{})]})}var ND=KE([DE,OE]),PD=l.default.forwardRef((e,t)=>{let[n,r]=(0,l.useState)(!1);return(0,l.useEffect)(()=>G.subscribe(e=>e.loading,e=>{r(!e)}),[]),(0,m.jsx)(FD,{children:(0,m.jsxs)(x_.div,{initial:{opacity:0},variants:{visible:{opacity:1,transition:{duration:.35,delay:.5}},hidden:{opacity:0,transition:{duration:0}}},animate:n?`visible`:`hidden`,className:`relative m-auto w-max`,style:{backgroundImage:`url(${Bv(`images/empty-canvas-bg.png`)})`},children:[(0,m.jsx)(MD,{}),(0,m.jsx)(`canvas`,{ref:t})]})})});function FD({children:e}){let t=(0,l.useRef)(null);return(0,m.jsx)(`div`,{ref:t,className:`w-full h-full overflow-hidden touch-none flex`,...ND({onPinch:e=>{if(!q().zoom.allowUserZoom||!ID(e))return e.cancel();e.direction[0]===1?q().zoom.zoomIn(.01):q().zoom.zoomOut(.01),e.event.stopPropagation(),e.event.preventDefault()},onDrag:e=>{if(e.pinching||!ID(e))return e.cancel();t.current.scrollLeft-=e.delta[0],t.current.scrollTop-=e.delta[1]}})(),children:e})}function ID(e){return!(J().findTarget(e.event,!1)||J().isDrawingMode)}function LD({actionBtn:e,children:t,className:n}){return(0,m.jsxs)(`div`,{className:H(n,`flex gap-16 items-center h-full`),children:[e&&(0,m.jsx)(`div`,{className:`flex-shrink-0`,children:e}),(0,m.jsx)(`div`,{className:`w-full flex-auto`,children:t}),e&&(0,m.jsx)(`div`,{className:`w-96`})]})}function RD(){return(RD=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function zD(e,t){if(e==null)return{};var n,r,i={},a=Object.keys(e);for(r=0;r<a.length;r++)t.indexOf(n=a[r])>=0||(i[n]=e[n]);return i}function BD(e){var t=(0,l.useRef)(e),n=(0,l.useRef)(function(e){t.current&&t.current(e)});return t.current=e,n.current}var VD=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},HD=function(e){return`touches`in e},UD=function(e){return e&&e.ownerDocument.defaultView||self},WD=function(e,t,n){var r=e.getBoundingClientRect(),i=HD(t)?function(e,t){for(var n=0;n<e.length;n++)if(e[n].identifier===t)return e[n];return e[0]}(t.touches,n):t;return{left:VD((i.pageX-(r.left+UD(e).pageXOffset))/r.width),top:VD((i.pageY-(r.top+UD(e).pageYOffset))/r.height)}},GD=function(e){!HD(e)&&e.preventDefault()},KD=l.default.memo(function(e){var t=e.onMove,n=e.onKey,r=zD(e,[`onMove`,`onKey`]),i=(0,l.useRef)(null),a=BD(t),o=BD(n),s=(0,l.useRef)(null),c=(0,l.useRef)(!1),u=(0,l.useMemo)(function(){var e=function(e){GD(e),(HD(e)?e.touches.length>0:e.buttons>0)&&i.current?a(WD(i.current,e,s.current)):n(!1)},t=function(){return n(!1)};function n(n){var r=c.current,a=UD(i.current),o=n?a.addEventListener:a.removeEventListener;o(r?`touchmove`:`mousemove`,e),o(r?`touchend`:`mouseup`,t)}return[function(e){var t=e.nativeEvent,r=i.current;if(r&&(GD(t),!function(e,t){return t&&!HD(e)}(t,c.current)&&r)){if(HD(t)){c.current=!0;var o=t.changedTouches||[];o.length&&(s.current=o[0].identifier)}r.focus(),a(WD(r,t,s.current)),n(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),o({left:t===39?.05:t===37?-.05:0,top:t===40?.05:t===38?-.05:0}))},n]},[o,a]),d=u[0],f=u[1],p=u[2];return(0,l.useEffect)(function(){return p},[p]),l.default.createElement(`div`,RD({},r,{onTouchStart:d,onMouseDown:d,className:`react-colorful__interactive`,ref:i,onKeyDown:f,tabIndex:0,role:`slider`}))}),qD=function(e){return e.filter(Boolean).join(` `)},JD=function(e){var t=e.color,n=e.left,r=e.top,i=r===void 0?.5:r,a=qD([`react-colorful__pointer`,e.className]);return l.default.createElement(`div`,{className:a,style:{top:100*i+`%`,left:100*n+`%`}},l.default.createElement(`div`,{className:`react-colorful__pointer-fill`,style:{backgroundColor:t}}))},YD=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n},XD=function(e){return iO(ZD(e))},ZD=function(e){return e[0]===`#`&&(e=e.substring(1)),e.length<6?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?YD(parseInt(e[3]+e[3],16)/255,2):1}:{r:parseInt(e.substring(0,2),16),g:parseInt(e.substring(2,4),16),b:parseInt(e.substring(4,6),16),a:e.length===8?YD(parseInt(e.substring(6,8),16)/255,2):1}},QD=function(e){return rO(tO(e))},$D=function(e){var t=e.s,n=e.v,r=e.a,i=(200-t)*n/100;return{h:YD(e.h),s:YD(i>0&&i<200?t*n/100/(i<=100?i:200-i)*100:0),l:YD(i/2),a:YD(r,2)}},eO=function(e){var t=$D(e);return`hsl(`+t.h+`, `+t.s+`%, `+t.l+`%)`},tO=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:YD(255*[r,s,o,o,c,r][l]),g:YD(255*[c,r,r,s,o,o][l]),b:YD(255*[o,o,c,r,r,s][l]),a:YD(i,2)}},nO=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},rO=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i<1?nO(YD(255*i)):``;return`#`+nO(t)+nO(n)+nO(r)+a},iO=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:YD(60*(s<0?s+6:s)),s:YD(a?o/a*100:0),v:YD(a/255*100),a:i}},aO=l.default.memo(function(e){var t=e.hue,n=e.onChange,r=qD([`react-colorful__hue`,e.className]);return l.default.createElement(`div`,{className:r},l.default.createElement(KD,{onMove:function(e){n({h:360*e.left})},onKey:function(e){n({h:VD(t+360*e.left,0,360)})},"aria-label":`Hue`,"aria-valuenow":YD(t),"aria-valuemax":`360`,"aria-valuemin":`0`},l.default.createElement(JD,{className:`react-colorful__hue-pointer`,left:t/360,color:eO({h:t,s:100,v:100,a:1})})))}),oO=l.default.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:eO({h:t.h,s:100,v:100,a:1})};return l.default.createElement(`div`,{className:`react-colorful__saturation`,style:r},l.default.createElement(KD,{onMove:function(e){n({s:100*e.left,v:100-100*e.top})},onKey:function(e){n({s:VD(t.s+100*e.left,0,100),v:VD(t.v-100*e.top,0,100)})},"aria-label":`Color`,"aria-valuetext":`Saturation `+YD(t.s)+`%, Brightness `+YD(t.v)+`%`},l.default.createElement(JD,{className:`react-colorful__saturation-pointer`,top:1-t.v/100,left:t.s/100,color:eO(t)})))}),sO=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},cO=function(e,t){return e.toLowerCase()===t.toLowerCase()||sO(ZD(e),ZD(t))};function lO(e,t,n){var r=BD(n),i=(0,l.useState)(function(){return e.toHsva(t)}),a=i[0],o=i[1],s=(0,l.useRef)({color:t,hsva:a});return(0,l.useEffect)(function(){if(!e.equal(t,s.current.color)){var n=e.toHsva(t);s.current={hsva:n,color:t},o(n)}},[t,e]),(0,l.useEffect)(function(){var t;sO(a,s.current.hsva)||e.equal(t=e.fromHsva(a),s.current.color)||(s.current={hsva:a,color:t},r(t))},[a,e,r]),[a,(0,l.useCallback)(function(e){o(function(t){return Object.assign({},t,e)})},[])]}var uO=typeof window<`u`?l.useLayoutEffect:l.useEffect,dO=function(){return typeof __webpack_nonce__<`u`?__webpack_nonce__:void 0},fO=new Map,pO=function(e){uO(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!fO.has(t)){var n=t.createElement(`style`);n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,fO.set(t,n);var r=dO();r&&n.setAttribute(`nonce`,r),t.head.appendChild(n)}},[])},mO=function(e){var t=e.className,n=e.colorModel,r=e.color,i=r===void 0?n.defaultColor:r,a=e.onChange,o=zD(e,[`className`,`colorModel`,`color`,`onChange`]),s=(0,l.useRef)(null);pO(s);var c=lO(n,i,a),u=c[0],d=c[1],f=qD([`react-colorful`,t]);return l.default.createElement(`div`,RD({},o,{ref:s,className:f}),l.default.createElement(oO,{hsva:u,onChange:d}),l.default.createElement(aO,{hue:u.h,onChange:d,className:`react-colorful__last-control`}))},hO={defaultColor:`000`,toHsva:XD,fromHsva:function(e){return QD({h:e.h,s:e.s,v:e.v,a:1})},equal:cO},gO=function(e){return l.default.createElement(mO,RD({},e,{colorModel:hO}))},_O=/^#?([0-9A-F]{3,8})$/i,vO=function(e){var t=e.color,n=t===void 0?``:t,r=e.onChange,i=e.onBlur,a=e.escape,o=e.validate,s=e.format,c=e.process,u=zD(e,[`color`,`onChange`,`onBlur`,`escape`,`validate`,`format`,`process`]),d=(0,l.useState)(function(){return a(n)}),f=d[0],p=d[1],m=BD(r),h=BD(i),g=(0,l.useCallback)(function(e){var t=a(e.target.value);p(t),o(t)&&m(c?c(t):t)},[a,c,o,m]),_=(0,l.useCallback)(function(e){o(e.target.value)||p(a(n)),h(e)},[n,a,o,h]);return(0,l.useEffect)(function(){p(a(n))},[n,a]),l.default.createElement(`input`,RD({},u,{value:s?s(f):f,spellCheck:`false`,onChange:g,onBlur:_}))},yO=function(e){return`#`+e},bO=function(e){var t=e.prefixed,n=e.alpha,r=zD(e,[`prefixed`,`alpha`]),i=(0,l.useCallback)(function(e){return e.replace(/([^0-9A-F]+)/gi,``).substring(0,n?8:6)},[n]),a=(0,l.useCallback)(function(e){return function(e,t){var n=_O.exec(e),r=n?n[1].length:0;return r===3||r===6||!!t&&r===4||!!t&&r===8}(e,n)},[n]);return l.default.createElement(vO,RD({},r,{escape:i,format:t?yO:void 0,process:yO,validate:a}))},xO={};xO={alpha:`ألفا`,black:`أسود`,blue:`أزرق`,"blue purple":`أرجواني مزرق`,brightness:`السطوع`,brown:`بني`,"brown yellow":`أصفر بني`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`سماوي`,"cyan blue":`أزرق سماوي`,dark:`داكن`,gray:`رمادي`,grayish:`مائل للرمادي`,green:`أخضر`,"green cyan":`سماوي مخضر`,hue:`درجة اللون`,light:`فاتح`,lightness:`الإضاءة`,magenta:`أرجواني`,"magenta pink":`أرجواني وردي`,orange:`برتقالي`,"orange yellow":`أصفر برتقالي`,pale:`باهت`,pink:`وردي`,"pink red":`أحمر وردي`,purple:`أرجواني`,"purple magenta":`بنفسجي`,red:`أحمر`,"red orange":`برتقالي محمر`,saturation:`التشبع`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} شفاف`,"very dark":`داكن جدًا`,"very light":`فاتح جدًا`,vibrant:`ساطع`,white:`أبيض`,yellow:`أصفر`,"yellow green":`أخضر مصفر`};var SO={};SO={alpha:`Алфа`,black:`черно`,blue:`Синьо`,"blue purple":`синьо лилаво`,brightness:`Яркост`,brown:`кафяво`,"brown yellow":`кафяво жълто`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`циан`,"cyan blue":`циан синьо`,dark:`тъмно`,gray:`сиво`,grayish:`сивкав`,green:`Зелено`,"green cyan":`зелен циан`,hue:`Оттенък`,light:`светло`,lightness:`Лекота`,magenta:`магента`,"magenta pink":`магента розово`,orange:`оранжево`,"orange yellow":`оранжево жълто`,pale:`бледо`,pink:`розово`,"pink red":`розово червено`,purple:`лилаво`,"purple magenta":`лилаво магента`,red:`Червено`,"red orange":`червен портокал`,saturation:`Наситеност`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} прозрачен`,"very dark":`много тъмно`,"very light":`много светло`,vibrant:` ярко`,white:`бяло`,yellow:`жълто`,"yellow green":`жълто зелен`};var CO={};CO={alpha:`Alfa`,black:`černá`,blue:`Modrá`,"blue purple":`modrofialová`,brightness:`Jas`,brown:`hnědá`,"brown yellow":`hnědožlutá`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`tyrkysová`,"cyan blue":`tyrkysovomodrá`,dark:`tmavá`,gray:`šedá`,grayish:`našedlá`,green:`Zelená`,"green cyan":`zelenotyrkysová`,hue:`Odstín`,light:`světlá`,lightness:`Světlost`,magenta:`purpurová`,"magenta pink":`purpurově růžová`,orange:`oranžová`,"orange yellow":`oranžovožlutá`,pale:`bledá`,pink:`růžová`,"pink red":`růžovočervená`,purple:`fialová`,"purple magenta":`fialově purpurová`,red:`Červená`,"red orange":`červenooranžová`,saturation:`Sytost`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} průhledné`,"very dark":`velmi tmavá`,"very light":`velmi světlá`,vibrant:`zářivá`,white:`bílá`,yellow:`žlutá`,"yellow green":`žlutozelená`};var wO={};wO={alpha:`Alfa`,black:`sort`,blue:`Blå`,"blue purple":`blålilla`,brightness:`Lysstyrke`,brown:`brun`,"brown yellow":`brungul`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cyan`,"cyan blue":`cyan blå`,dark:`mørk`,gray:`grå`,grayish:`grålig`,green:`Grøn`,"green cyan":`grøn cyan`,hue:`Tone`,light:`lys`,lightness:`Lyshed`,magenta:`magenta`,"magenta pink":`magenta pink`,orange:`orange`,"orange yellow":`orangegul`,pale:`bleg`,pink:`lyserød`,"pink red":`lyserødlig rød`,purple:`lilla`,"purple magenta":`lilla magenta`,red:`Rød`,"red orange":`rødorange`,saturation:`Farvemætning`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gennemsigtig`,"very dark":`meget mørk`,"very light":`meget lys`,vibrant:`klar`,white:`hvid`,yellow:`gul`,"yellow green":`gulgrøn`};var TO={};TO={alpha:`Alpha`,black:`Schwarz`,blue:`Blau`,"blue purple":`Blaulila`,brightness:`Helligkeit`,brown:`Braun`,"brown yellow":`Braungelb`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`Cyan`,"cyan blue":`Cyanblau`,dark:`dunkles`,gray:`Grau`,grayish:`gräuliches`,green:`Grün`,"green cyan":`Grüncyan`,hue:`Farbton`,light:`helles`,lightness:`Leuchtkraft`,magenta:`Magenta`,"magenta pink":`Magentarosa`,orange:`Orange`,"orange yellow":`Orangegelb`,pale:`blasses`,pink:`Rosa`,"pink red":`Rosarot`,purple:`Lila`,"purple magenta":`Lilamagenta`,red:`Rot`,"red orange":`Rotorange`,saturation:`Sättigung`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, zu ${e.percentTransparent} transparent`,"very dark":`sehr dunkles`,"very light":`sehr helles`,vibrant:`lebhaftes`,white:`Weiß`,yellow:`Gelb`,"yellow green":`Gelbgrün`};var EO={};EO={alpha:`Άλφα`,black:`μαύρο`,blue:`Μπλε`,"blue purple":`μπλε μωβ`,brightness:`Φωτεινότητα`,brown:`καφέ`,"brown yellow":`καφέ κίτρινο`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`κυανό`,"cyan blue":`κυανό μπλε`,dark:`σκούρο`,gray:`γκρι`,grayish:`γκριζωπό`,green:`Πράσινο`,"green cyan":`πράσινο κυανό`,hue:`Τόνος`,light:`ανοιχτό`,lightness:`Φωτεινότητα`,magenta:`ματζέντα`,"magenta pink":`ματζέντα ροζ`,orange:`πορτοκαλί`,"orange yellow":`πορτοκαλί κίτρινο`,pale:`ανοιχτό`,pink:`ροζ`,"pink red":`ροζ κόκκινο`,purple:`μωβ`,"purple magenta":`μωβ ματζέντα`,red:`Κόκκινο`,"red orange":`κόκκινο πορτοκαλί`,saturation:`Κορεσμός`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} διαφανές`,"very dark":`πολύ σκούρο`,"very light":`πολύ ανοιχτό`,vibrant:`έντονο`,white:`λευκό`,yellow:`κίτρινο`,"yellow green":`κίτρινο πράσινο`};var DO={};DO={hue:`Hue`,saturation:`Saturation`,lightness:`Lightness`,brightness:`Brightness`,red:`Red`,green:`Green`,blue:`Blue`,alpha:`Alpha`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":`very dark`,dark:`dark`,light:`light`,"very light":`very light`,pale:`pale`,grayish:`grayish`,vibrant:`vibrant`,black:`black`,white:`white`,gray:`gray`,pink:`pink`,"pink red":`pink red`,"red orange":`red orange`,brown:`brown`,orange:`orange`,"orange yellow":`orange yellow`,"brown yellow":`brown yellow`,yellow:`yellow`,"yellow green":`yellow green`,"green cyan":`green cyan`,cyan:`cyan`,"cyan blue":`cyan blue`,"blue purple":`blue purple`,purple:`purple`,"purple magenta":`purple magenta`,magenta:`magenta`,"magenta pink":`magenta pink`};var OO={};OO={alpha:`Alpha`,black:`negro`,blue:`Azul`,"blue purple":`púrpura azulado`,brightness:`Brillo`,brown:`marrón`,"brown yellow":`amarillo amarronado`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cian`,"cyan blue":`azul cian`,dark:`oscuro`,gray:`gris`,grayish:`grisáceo`,green:`Verde`,"green cyan":`cian verdoso`,hue:`Tono`,light:`claro`,lightness:`Luminosidad`,magenta:`magenta`,"magenta pink":`rosa magenta`,orange:`naranja`,"orange yellow":`amarillo anaranjado`,pale:`pálido`,pink:`rosa`,"pink red":`rojo rosado`,purple:`morado`,"purple magenta":`magenta violáceo`,red:`Rojo`,"red orange":`naranja rojizo`,saturation:`Saturación`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":`muy oscuro`,"very light":`muy claro`,vibrant:`intenso`,white:`blanco`,yellow:`amarillo`,"yellow green":`verde amarillento`};var kO={};kO={alpha:`Alfa`,black:`must`,blue:`Sinine`,"blue purple":`sinakaslilla`,brightness:`Heledus`,brown:`pruun`,"brown yellow":`pruunikaskollane`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`tsüaan`,"cyan blue":`tsüaansinine`,dark:`tume`,gray:`hall`,grayish:`hallikas`,green:`Roheline`,"green cyan":`tsüaanroheline`,hue:`Värv`,light:`valgus`,lightness:`Valgus`,magenta:`magentapunane`,"magenta pink":`magentaroosa`,orange:`oranž`,"orange yellow":`oranžikaskollane`,pale:`kahvatu`,pink:`roosa`,"pink red":`vaarikapunane`,purple:`lilla`,"purple magenta":`purpurne magenta`,red:`Punane`,"red orange":`punakasoranž`,saturation:`Küllastus`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läbipaistev`,"very dark":`väga tume`,"very light":`väga hele`,vibrant:`ere`,white:`valge`,yellow:`kollane`,"yellow green":`kollakasroheline`};var AO={};AO={alpha:`Alpha`,black:`musta`,blue:`Sininen`,"blue purple":`sinivioletti`,brightness:`Kirkkaus`,brown:`ruskea`,"brown yellow":`ruskeankeltainen`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`syaani`,"cyan blue":`syaaninsininen`,dark:`tumma`,gray:`harmaa`,grayish:`harmahtava`,green:`Vihreä`,"green cyan":`vihreänsyaani`,hue:`Sävy`,light:`vaalea`,lightness:`Valomäärä`,magenta:`magenta`,"magenta pink":`magentapinkki`,orange:`oranssi`,"orange yellow":`oranssinkeltainen`,pale:`vaalea`,pink:`pinkki`,"pink red":`vaaleanpunainen`,purple:`violetti`,"purple magenta":`violettimagenta`,red:`Punainen`,"red orange":`punaoranssi`,saturation:`Värikylläisyys`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} läpinäkyvä`,"very dark":`hyvin tumma`,"very light":`erittäin vaalea`,vibrant:`eloisa`,white:`valkea`,yellow:`keltainen`,"yellow green":`keltavihreä`};var jO={};jO={alpha:`Alpha`,black:`Noir`,blue:`Bleu`,"blue purple":`Violet bleu`,brightness:`Luminosité`,brown:`Brun`,"brown yellow":`Jaune brun`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`Cyan`,"cyan blue":`Bleu cyan`,dark:`Sombre`,gray:`Gris`,grayish:`Grisâtre`,green:`Vert`,"green cyan":`Cyan vert`,hue:`Teinte`,light:`Clair`,lightness:`Luminosité`,magenta:`Magenta`,"magenta pink":`Rose magenta`,orange:`Orange`,"orange yellow":`Jaune orangé`,pale:`Pâle`,pink:`Rose`,"pink red":`Rouge rosé`,purple:`Violet`,"purple magenta":`Magenta violet`,red:`Rouge`,"red orange":`Orange rouge`,saturation:`Saturation`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":`Très sombre`,"very light":`Très clair`,vibrant:`Vif`,white:`Blanc`,yellow:`Jaune`,"yellow green":`Vert jaune`};var MO={};MO={alpha:`אלפא`,black:`שחור`,blue:`כחול`,"blue purple":`כחול סגול`,brightness:`בהירות`,brown:`חום`,"brown yellow":`חום צהוב`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`טורקיז`,"cyan blue":`כחול ציאן`,dark:`כהה`,gray:`אפור`,grayish:`אפרפר`,green:`ירוק`,"green cyan":`ציאן ירוק`,hue:`גוון`,light:`אור`,lightness:`כמות אור`,magenta:`מג'נטה`,"magenta pink":`ורוד מג'נטה`,orange:`כתום`,"orange yellow":`כתום צהוב`,pale:`חיוור`,pink:`ורוד`,"pink red":`ורוד אדום`,purple:`סגול`,"purple magenta":`מג'נטה סגול`,red:`אדום`,"red orange":`כתום אדום`,saturation:`רוויה`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} שקוף`,"very dark":`כהה מאוד`,"very light":`בהיר מאוד`,vibrant:`תוסס`,white:`לבן`,yellow:`צהוב`,"yellow green":`צהוב ירוק`};var NO={};NO={alpha:`Alfa`,black:`crno`,blue:`Plava`,"blue purple":`plavo ljubičasta`,brightness:`Svjetlina`,brown:`smeđa`,"brown yellow":`smeđe žuta`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cijan`,"cyan blue":`cijan plava`,dark:`tamno`,gray:`siva`,grayish:`sivkasto`,green:`Zelena`,"green cyan":`zelena cijan`,hue:`Nijansa`,light:`svjetlo`,lightness:`Osvijetljenost`,magenta:`magenta`,"magenta pink":`magentno ružičasta`,orange:`narančasta`,"orange yellow":`narančasto žuta`,pale:`blijeda`,pink:`ružičasta`,"pink red":`ružičasto crvena`,purple:`ljubičasta`,"purple magenta":`ljubičasta magenta`,red:`Crvena`,"red orange":`crveno narančasta`,saturation:`Zasićenost`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirnosti`,"very dark":`jako tamna`,"very light":`vrlo svijetlo`,vibrant:`vibrantna`,white:`bijela`,yellow:`žuto`,"yellow green":`žuto zelena`};var PO={};PO={alpha:`Alfa`,black:`fekete`,blue:`Kék`,"blue purple":`kék lila`,brightness:`Fényesség`,brown:`barna`,"brown yellow":`barna sárga`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`ciánkék`,"cyan blue":`ciánkék`,dark:`sötét`,gray:`szürke`,grayish:`szürkés`,green:`Zöld`,"green cyan":`zöld ciánkék`,hue:`Színárnyalat`,light:`világos`,lightness:`Világosság`,magenta:`bíbor`,"magenta pink":`bíbor rózsaszín`,orange:`narancs`,"orange yellow":`narancssárga`,pale:`halvány`,pink:`rózsaszín`,"pink red":`rózsaszín piros`,purple:`lila`,"purple magenta":`lila bíbor`,red:`Piros`,"red orange":`piros narancs`,saturation:`Telítettség`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} átlátszó`,"very dark":`nagyon sötét`,"very light":`nagyon világos`,vibrant:`élénk`,white:`fehér`,yellow:`sárga`,"yellow green":`sárga zöld`};var FO={};FO={alpha:`Alfa`,black:`nero`,blue:`Blu`,"blue purple":`blu viola`,brightness:`Luminosità`,brown:`marrone`,"brown yellow":`giallo bruno`,colorName:e=>`${e.hue} ${e.chroma} ${e.lightness}`,cyan:`ciano`,"cyan blue":`blu ciano`,dark:`scuro`,gray:`grigio`,grayish:`grigiastro`,green:`Verde`,"green cyan":`verde ciano`,hue:`Tonalità`,light:`chiaro`,lightness:`Luminosità`,magenta:`magenta`,"magenta pink":`rosa magenta`,orange:`arancio`,"orange yellow":`giallo arancio`,pale:`tenue`,pink:`rosa`,"pink red":`rosa rosso`,purple:`viola`,"purple magenta":`viola magenta`,red:`Rosso`,"red orange":`rosso arancio`,saturation:`Saturazione`,transparentColorName:e=>`${e.hue} ${e.chroma} ${e.lightness}, trasparenza ${e.percentTransparent}`,"very dark":`molto scuro`,"very light":`molto chiaro`,vibrant:`vivace`,white:`bianco`,yellow:`giallo`,"yellow green":`giallo verde`};var IO={};IO={alpha:`アルファ`,black:`ブラック`,blue:`青`,"blue purple":`ブルーパープル`,brightness:`明るさ`,brown:`ブラウン`,"brown yellow":`ブラウンイエロー`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`シアン`,"cyan blue":`シアンブルー`,dark:`ダーク`,gray:`グレー`,grayish:`グレイッシュ`,green:`緑`,"green cyan":`グリーンシアン`,hue:`色相`,light:`ライト`,lightness:`明度`,magenta:`マゼンタ`,"magenta pink":`マゼンタピンク`,orange:`オレンジ`,"orange yellow":`オレンジイエロー`,pale:`ペール`,pink:`ピンク`,"pink red":`ピンクレッド`,purple:`パープル`,"purple magenta":`パープルマゼンタ`,red:`赤`,"red orange":`レッドオレンジ`,saturation:`彩度`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":`最も暗い`,"very light":`ベリーライト`,vibrant:`鮮やか`,white:`ホワイト`,yellow:`イエロー`,"yellow green":`イエローグリーン`};var LO={};LO={alpha:`알파`,black:`검은색`,blue:`파랑`,"blue purple":`청자색`,brightness:`명도`,brown:`갈색`,"brown yellow":`황갈색`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`청록색`,"cyan blue":`청록색`,dark:`다크`,gray:`회색`,grayish:`회갈색`,green:`초록`,"green cyan":`청록색`,hue:`색조`,light:`라이트`,lightness:`밝기`,magenta:`자홍색`,"magenta pink":`마젠타 핑크`,orange:`주황색`,"orange yellow":`불그스름한 노랑`,pale:`흙색`,pink:`분홍색`,"pink red":`핑크 레드`,purple:`자주색`,"purple magenta":`보라빛 자홍색`,red:`빨강`,"red orange":`붉은 주황색`,saturation:`채도`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 투명도`,"very dark":`매우 어두운`,"very light":`매우 연함`,vibrant:`강렬한`,white:`흰색`,yellow:`노란색`,"yellow green":`연두색`};var RO={};RO={alpha:`Alfa`,black:`juoda`,blue:`Mėlyna`,"blue purple":`melsvai violetinė`,brightness:`Ryškumas`,brown:`ruda`,"brown yellow":`rusvai geltona`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`žalsvai mėlyna`,"cyan blue":`žalsvai mėlyna`,dark:`tamsi`,gray:`pilka`,grayish:`pilkšva`,green:`Žalia`,"green cyan":`žalsvai mėlyna`,hue:`Atspalvis`,light:`šviesi`,lightness:`Šviesumas`,magenta:`rausvai raudona`,"magenta pink":`purpurinė`,orange:`oranžinė`,"orange yellow":`oranžinio atspalvio geltona`,pale:`blyški`,pink:`rožinė`,"pink red":`rožinė raudona`,purple:`violetinė`,"purple magenta":`purpurinė rausvai raudona`,red:`Raudona`,"red orange":`rausvai oranžinė`,saturation:`Įsotinimas`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} skaidri`,"very dark":`labai tamsi`,"very light":`labai šviesi`,vibrant:`ryški`,white:`balta`,yellow:`geltona`,"yellow green":`gelsvai žalia`};var zO={};zO={alpha:`Alfa`,black:`melns`,blue:`Zila`,"blue purple":`zili violets`,brightness:`Spilgtums`,brown:`brūns`,"brown yellow":`brūni dzeltens`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`ciāns`,"cyan blue":`ciāna zils`,dark:`tumšs`,gray:`pelēks`,grayish:`pelēcīgs`,green:`Zaļa`,"green cyan":`zaļš ciāns`,hue:`Nokrāsa`,light:`gaišs`,lightness:`Gaišums`,magenta:`fuksiju`,"magenta pink":`fuksiju rozā`,orange:`oranžs`,"orange yellow":`oranži dzeltens`,pale:`bāls`,pink:`rozā`,"pink red":`rozīgi sarkans`,purple:`violets`,"purple magenta":`violets fuksiju`,red:`Sarkana`,"red orange":`sarkanīgi oranžs`,saturation:`Piesātinājums`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} caurspīdīgs`,"very dark":`ļoti tumšs`,"very light":`ļoti gaišs`,vibrant:`košs`,white:`balts`,yellow:`dzeltens`,"yellow green":`dzelteni zaļš`};var BO={};BO={alpha:`Alfa`,black:`svart`,blue:`Blå`,"blue purple":`blålilla`,brightness:`Lysstyrke`,brown:`brun`,"brown yellow":`brungul`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cyan`,"cyan blue":`cyanblå`,dark:`mørk`,gray:`grå`,grayish:`gråaktig`,green:`Grønn`,"green cyan":`grønncyan`,hue:`Fargetone`,light:`lys`,lightness:`Lyshet`,magenta:`magenta`,"magenta pink":`magentarosa`,orange:`oransje`,"orange yellow":`oransjegul`,pale:`blek`,pink:`rosa`,"pink red":`rosarød`,purple:`lilla`,"purple magenta":`lillamagenta`,red:`Rød`,"red orange":`rødoransje`,saturation:`Metning`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} gjennomsiktig`,"very dark":`svært mørk`,"very light":`svært lys`,vibrant:`levende`,white:`hvit`,yellow:`gul`,"yellow green":`gulgrønn`};var VO={};VO={alpha:`Alfa`,black:`zwart`,blue:`Blauw`,"blue purple":`paarsblauw`,brightness:`Helderheid`,brown:`bruin`,"brown yellow":`bruingeel`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cyaan`,"cyan blue":`cyaanblauw`,dark:`donker`,gray:`grijs`,grayish:`grijsachtig`,green:`Groen`,"green cyan":`cyaangroen`,hue:`Kleurtoon`,light:`licht`,lightness:`Lichtsterkte`,magenta:`magenta`,"magenta pink":`magentaroze`,orange:`oranje`,"orange yellow":`oranjegeel`,pale:`bleek`,pink:`roze`,"pink red":`rozerood`,purple:`paars`,"purple magenta":`magentapaars`,red:`Rood`,"red orange":`roodoranje`,saturation:`Verzadiging`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparant`,"very dark":`heel donker`,"very light":`heel licht`,vibrant:`levendig`,white:`wit`,yellow:`geel`,"yellow green":`geelgroen`};var HO={};HO={alpha:`Alfa`,black:`czarny`,blue:`Niebieski`,"blue purple":`niebiesko-fioletowy`,brightness:`Jasność`,brown:`brązowy`,"brown yellow":`brązowo-żółty`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cyjanowy`,"cyan blue":`cyjanowo-niebieski`,dark:`ciemny`,gray:`szary`,grayish:`szarawy`,green:`Zielony`,"green cyan":`zielono-cyjanowy`,hue:`Odcień`,light:`jasny`,lightness:`Jaskrawość`,magenta:`purpurowy`,"magenta pink":`purpurowo-różowy`,orange:`pomarańczowy`,"orange yellow":`pomarańczowo-żółty`,pale:`blady`,pink:`różowy`,"pink red":`różowo-czerwony`,purple:`fioletowy`,"purple magenta":`fioletowo-purpurowy`,red:`Czerwony`,"red orange":`czerwono-pomarańczowy`,saturation:`Nasycenie`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} przezroczystości`,"very dark":`bardzo ciemny`,"very light":`bardzo jasny`,vibrant:`intensywny`,white:`biały`,yellow:`żółty`,"yellow green":`żółto-zielony`};var UO={};UO={alpha:`Alfa`,black:`preto`,blue:`Azul`,"blue purple":`roxo azulado`,brightness:`Brilho`,brown:`marrom`,"brown yellow":`marrom amarelado`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`ciano`,"cyan blue":`azul-ciano`,dark:`escuro`,gray:`cinza`,grayish:`acinzentado`,green:`Verde`,"green cyan":`verde-ciano`,hue:`Matiz`,light:`claro`,lightness:`Luminosidade`,magenta:`magenta`,"magenta pink":`rosa-magenta`,orange:`laranja`,"orange yellow":`amarelo alaranjado`,pale:`pálido`,pink:`rosa`,"pink red":`rosa avermelhado`,purple:`roxo`,"purple magenta":`roxo-magenta`,red:`Vermelho`,"red orange":`laranja avermelhado`,saturation:`Saturação`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":`muito escuro`,"very light":`muito claro`,vibrant:`vibrante`,white:`branco`,yellow:`amarelo`,"yellow green":`verde amarelado`};var WO={};WO={alpha:`Alfa`,black:`preto`,blue:`Azul`,"blue purple":`azul-púrpura`,brightness:`Luminosidade`,brown:`castanho`,"brown yellow":`amarelo-castanho`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`ciano`,"cyan blue":`azul-ciano`,dark:`escuro`,gray:`cinzento`,grayish:`acinzentado`,green:`Verde`,"green cyan":`verde-ciano`,hue:`Tonalidade`,light:`claro`,lightness:`Claridade`,magenta:`magenta`,"magenta pink":`rosa-magenta`,orange:`laranja`,"orange yellow":`amarelo-laranja`,pale:`pálido`,pink:`cor-de-rosa`,"pink red":`vermelho-rosa`,purple:`púrpura`,"purple magenta":`púrpura-magenta`,red:`Vermelho`,"red orange":`laranja-vermelho`,saturation:`Saturação`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparente`,"very dark":`muito escuro`,"very light":`muito claro`,vibrant:`vibrante`,white:`branco`,yellow:`amarelo`,"yellow green":`verde-amarelo`};var GO={};GO={alpha:`Alfa`,black:`negru`,blue:`Albastru`,"blue purple":`albastru-violet`,brightness:`Luminozitate`,brown:`maro`,"brown yellow":`galben maro`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`bleu`,"cyan blue":`albastru-bleu`,dark:`închis`,gray:`gri`,grayish:`cenușiu`,green:`Verde`,"green cyan":`verde bleu`,hue:`Nuanță`,light:`deschis`,lightness:`Luminozitate`,magenta:`fucsia`,"magenta pink":`roz-fucsia`,orange:`portocaliu`,"orange yellow":`galben-portocaliu`,pale:`pal`,pink:`roz`,"pink red":`roz-roșu`,purple:`violet`,"purple magenta":`violet-fucsia`,red:`Roșu`,"red orange":`portocaliu-roșu`,saturation:`Saturație`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} transparent`,"very dark":`foarte închis`,"very light":`foarte deschis`,vibrant:`plin de viață`,white:`alb`,yellow:`galben`,"yellow green":`galben-verde`};var KO={};KO={alpha:`Альфа`,black:`черный`,blue:`Синий`,"blue purple":`сине-фиолетовый`,brightness:`Яркость`,brown:`коричневый`,"brown yellow":`коричнево-желтый`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`голубой`,"cyan blue":`цвет морской волны`,dark:`темный`,gray:`серый`,grayish:`сероватый`,green:`Зеленый`,"green cyan":`сине-зеленый`,hue:`Оттенок`,light:`светлый`,lightness:`Освещенность`,magenta:`пурпурный`,"magenta pink":`пурпурно-розовый`,orange:`оранжевый`,"orange yellow":`оранжево-желтый`,pale:`бледный`,pink:`розовый`,"pink red":`розово-красный`,purple:`фиолетовый`,"purple magenta":`фиолетово-пурпурный`,red:`Красный`,"red orange":`красно-оранжевый`,saturation:`Насыщенность`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозрачный на ${e.percentTransparent}`,"very dark":`очень темный`,"very light":`очень светлый`,vibrant:`яркий`,white:`белый`,yellow:`желтый`,"yellow green":`желто-зеленый`};var qO={};qO={alpha:`Alfa`,black:`čierna`,blue:`Modrá`,"blue purple":`modrofialová`,brightness:`Jas`,brown:`hnedá`,"brown yellow":`hnedožltá`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`azúrová`,"cyan blue":`azúrová modrá`,dark:`tmavá`,gray:`sivá`,grayish:`sivastá`,green:`Zelená`,"green cyan":`zelená azúrová`,hue:`Odtieň`,light:`svetlá`,lightness:`Svetlosť`,magenta:`purpurová`,"magenta pink":`ružová purpurová`,orange:`oranžová`,"orange yellow":`oranžovožltá`,pale:`bledá`,pink:`ružová`,"pink red":`ružovočervená`,purple:`fialová`,"purple magenta":`fialová purpurová`,red:`Červená`,"red orange":`červenooranžová`,saturation:`Sýtosť`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} priehľadná`,"very dark":`veľmi tmavá`,"very light":`veľmi svetlá`,vibrant:`energická`,white:`biela`,yellow:`žltá`,"yellow green":`žltozelená`};var JO={};JO={alpha:`Alfa`,black:`črna`,blue:`Modra`,"blue purple":`modro vijolična`,brightness:`Svetlost`,brown:`rjava`,"brown yellow":`rjavo rumena`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cian`,"cyan blue":`cian modra`,dark:`temna`,gray:`siva`,grayish:`sivkasta`,green:`Zelena`,"green cyan":`zelena cian`,hue:`Barva`,light:`svetla`,lightness:`Lahkost`,magenta:`škrlatna`,"magenta pink":`škrlatno roza`,orange:`oranžna`,"orange yellow":`oranžno rumena`,pale:`bleda`,pink:`roza`,"pink red":`roza rdeča`,purple:`vijolična`,"purple magenta":`vijolično škrlatna`,red:`Rdeča`,"red orange":`rdeče oranžna`,saturation:`Nasičenost`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozorna`,"very dark":`zelo temna`,"very light":`zelo svetla`,vibrant:`živahna`,white:`bela`,yellow:`rumena`,"yellow green":`rumeno zelena`};var YO={};YO={alpha:`Alfa`,black:`crno`,blue:`Plava`,"blue purple":`plavoljubičasta`,brightness:`Osvetljenost`,brown:`smeđa`,"brown yellow":`smeđežuta`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cijan`,"cyan blue":`cijan plava`,dark:`tamno`,gray:`siva`,grayish:`sivkasta`,green:`Zelena`,"green cyan":`zeleno cijan`,hue:`Nijansa`,light:`svetla`,lightness:`Osvetljenje`,magenta:`purpurnocrvena`,"magenta pink":`magenta ružičasta`,orange:`narandžasta`,"orange yellow":`narandžastožuta`,pale:`bledo`,pink:`ružičasta`,"pink red":`ružičastocrvena`,purple:`ljubičasta`,"purple magenta":`ljubičasta magenta`,red:`Crvena`,"red orange":`crvenonarandžasta`,saturation:`Zasićenje`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} prozirna`,"very dark":`veoma tamno`,"very light":`vrlo svetlo`,vibrant:`živopisna`,white:`bela`,yellow:`žuto`,"yellow green":`žutozelena`};var XO={};XO={alpha:`Alfa`,black:`svart`,blue:`Blått`,"blue purple":`blålila`,brightness:`Ljusstyrka`,brown:`brun`,"brown yellow":`brungul`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`cyan`,"cyan blue":`cyanblå`,dark:`mörk`,gray:`grå`,grayish:`gråaktig`,green:`Grönt`,"green cyan":`grön cyan`,hue:`Nyans`,light:`ljus`,lightness:`Ljushet`,magenta:`magenta`,"magenta pink":`magentarosa`,orange:`orange`,"orange yellow":`orangegul`,pale:`blek`,pink:`rosa`,"pink red":`rosaröd`,purple:`lila`,"purple magenta":`lila magenta`,red:`Rött`,"red orange":`rödorange`,saturation:`Mättnad`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} genomskinlig`,"very dark":`mycket mörk`,"very light":`mycket ljus`,vibrant:`livfull`,white:`vit`,yellow:`gul`,"yellow green":`gulgrön`};var ZO={};ZO={alpha:`Alfa`,black:`siyah`,blue:`Mavi`,"blue purple":`mavi mor`,brightness:`Parlaklık`,brown:`kahverengi`,"brown yellow":`kahverengi sarı`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`camgöbeği`,"cyan blue":`camgöbeği mavi`,dark:`koyu`,gray:`gri`,grayish:`grimsi`,green:`Yeşil`,"green cyan":`yeşil camgöbeği`,hue:`Ton`,light:`açık`,lightness:`Canlılık`,magenta:`eflatun`,"magenta pink":`eflatun pembe`,orange:`turuncu`,"orange yellow":`turuncu sarı`,pale:`solgun`,pink:`pembe`,"pink red":`pembe kırmızı`,purple:`mor`,"purple magenta":`mor eflatun`,red:`Kırmızı`,"red orange":`kırmızı portakal`,saturation:`Doygunluk`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} saydam`,"very dark":`çok koyu`,"very light":`çok açık`,vibrant:`canlı`,white:`beyaz`,yellow:`sarı`,"yellow green":`sarı yeşil`};var QO={};QO={alpha:`Альфа`,black:`чорний`,blue:`Синій`,"blue purple":`синьо-фіолетовий`,brightness:`Яскравість`,brown:`коричневий`,"brown yellow":`коричнево-жовтий`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`блакитний`,"cyan blue":`синьо-блакитний`,dark:`темний`,gray:`сірий`,grayish:`сіруватий`,green:`Зелений`,"green cyan":`зелено-блакитний`,hue:`Тон`,light:`світлий`,lightness:`Освітленість`,magenta:`пурпуровий`,"magenta pink":`пурпурово-рожевий`,orange:`помаранчевий`,"orange yellow":`помаранчево-жовтий`,pale:`блідий`,pink:`рожевий`,"pink red":`рожево-червоний`,purple:`фіолетовий`,"purple magenta":`фіолетово-пурпуровий`,red:`Червоний`,"red orange":`червоно-помаранчевий`,saturation:`Насиченість`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, прозорий на ${e.percentTransparent}`,"very dark":`дуже темний`,"very light":`дуже світлий`,vibrant:`яскравий`,white:`білий`,yellow:`жовтий`,"yellow green":`жовто-зелений`};var $O={};$O={alpha:`Alpha`,black:`黑色`,blue:`蓝色`,"blue purple":`蓝紫色`,brightness:`亮度`,brown:`棕色的`,"brown yellow":`棕黄色`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`蓝绿色`,"cyan blue":`青蓝色`,dark:`深色`,gray:`灰色`,grayish:`浅灰色的`,green:`绿色`,"green cyan":`绿青色`,hue:`色相`,light:`浅色`,lightness:`明亮度`,magenta:`紫红色`,"magenta pink":`紫粉色`,orange:`橙色`,"orange yellow":`橙黄色`,pale:`苍白的`,pink:`粉色`,"pink red":`粉红色`,purple:`紫色`,"purple magenta":`紫洋红色`,red:`红色`,"red orange":`红橙色`,saturation:`饱和度`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":`很暗`,"very light":`很浅`,vibrant:`生机勃勃`,white:`白色`,yellow:`黄色`,"yellow green":`黄色/绿色`};var ek={};ek={alpha:`Alpha`,black:`黑`,blue:`藍色`,"blue purple":`藍紫`,brightness:`亮度`,brown:`棕`,"brown yellow":`棕黃`,colorName:e=>`${e.lightness} ${e.chroma} ${e.hue}`,cyan:`青`,"cyan blue":`青藍`,dark:`暗`,gray:`灰`,grayish:`偏灰`,green:`綠色`,"green cyan":`青綠`,hue:`色相`,light:`淺`,lightness:`明亮`,magenta:`洋紅`,"magenta pink":`淺洋紅`,orange:`橙`,"orange yellow":`橙黃`,pale:`淡`,pink:`粉紅`,"pink red":`粉紅`,purple:`紫`,"purple magenta":`紫洋紅`,red:`紅色`,"red orange":`橙紅`,saturation:`飽和度`,transparentColorName:e=>`${e.lightness} ${e.chroma} ${e.hue}, ${e.percentTransparent} 透明`,"very dark":`很暗`,"very light":`很淺`,vibrant:`鮮豔`,white:`白`,yellow:`黃`,"yellow green":`黃綠`};var tk={};tk={"ar-AE":xO,"bg-BG":SO,"cs-CZ":CO,"da-DK":wO,"de-DE":TO,"el-GR":EO,"en-US":DO,"es-ES":OO,"et-EE":kO,"fi-FI":AO,"fr-FR":jO,"he-IL":MO,"hr-HR":NO,"hu-HU":PO,"it-IT":FO,"ja-JP":IO,"ko-KR":LO,"lt-LT":RO,"lv-LV":zO,"nb-NO":BO,"nl-NL":VO,"pl-PL":HO,"pt-BR":UO,"pt-PT":WO,"ro-RO":GO,"ru-RU":KO,"sk-SK":qO,"sl-SI":JO,"sr-SP":YO,"sv-SE":XO,"tr-TR":ZO,"uk-UA":QO,"zh-CN":$O,"zh-TW":ek};var nk=Symbol.for(`react-aria.i18n.locale`),rk=Symbol.for(`react-aria.i18n.strings`),ik,ak=class e{getStringForLocale(e,t){let n=this.getStringsForLocale(t)[e];if(!n)throw Error(`Could not find intl message ${e} in ${t} locale`);return n}getStringsForLocale(e){let t=this.strings[e];return t||(t=ok(e,this.strings,this.defaultLocale),this.strings[e]=t),t}static getGlobalDictionaryForPackage(t){if(typeof window>`u`)return null;let n=window[nk];if(ik===void 0){let t=window[rk];if(!t)return null;ik={};for(let r in t)ik[r]=new e({[n]:t[r]},n)}let r=ik?.[t];if(!r)throw Error(`Strings for package "${t}" were not included by LocalizedStringProvider. Please add it to the list passed to createLocalizedStringDictionary.`);return r}constructor(e,t=`en-US`){this.strings=Object.fromEntries(Object.entries(e).filter(([,e])=>e)),this.defaultLocale=t}};function ok(e,t,n=`en-US`){if(t[e])return t[e];let r=sk(e);if(t[r])return t[r];for(let e in t)if(e.startsWith(r+`-`))return t[e];return t[n]}function sk(e){return Intl.Locale?new Intl.Locale(e).language:e.split(`-`)[0]}var ck=new Map,lk=new Map,uk=class{format(e,t){let n=this.strings.getStringForLocale(e,this.locale);return typeof n==`function`?n(t,this):n}plural(e,t,n=`cardinal`){let r=t[`=`+e];if(r)return typeof r==`function`?r():r;let i=this.locale+`:`+n,a=ck.get(i);return a||(a=new Intl.PluralRules(this.locale,{type:n}),ck.set(i,a)),r=t[a.select(e)]||t.other,typeof r==`function`?r():r}number(e){let t=lk.get(this.locale);return t||(t=new Intl.NumberFormat(this.locale),lk.set(this.locale,t)),t.format(e)}select(e,t){let n=e[t]||e.other;return typeof n==`function`?n():n}constructor(e,t){this.locale=e,this.strings=t}},dk=new Map,fk=!1;try{fk=new Intl.NumberFormat(`de-DE`,{signDisplay:`exceptZero`}).resolvedOptions().signDisplay===`exceptZero`}catch{}var pk=!1;try{pk=new Intl.NumberFormat(`de-DE`,{style:`unit`,unit:`degree`}).resolvedOptions().style===`unit`}catch{}var mk={degree:{narrow:{default:`°`,"ja-JP":` 度`,"zh-TW":`度`,"sl-SI":` °`}}},hk=class{format(e){let t=``;if(t=!fk&&this.options.signDisplay!=null?_k(this.numberFormatter,this.options.signDisplay,e):this.numberFormatter.format(e),this.options.style===`unit`&&!pk){let{unit:e,unitDisplay:n=`short`,locale:r}=this.resolvedOptions();if(!e)return t;let i=mk[e]?.[n];t+=i[r]||i.default}return t}formatToParts(e){return this.numberFormatter.formatToParts(e)}formatRange(e,t){if(typeof this.numberFormatter.formatRange==`function`)return this.numberFormatter.formatRange(e,t);if(t<e)throw RangeError(`End date must be >= start date`);return`${this.format(e)} – ${this.format(t)}`}formatRangeToParts(e,t){if(typeof this.numberFormatter.formatRangeToParts==`function`)return this.numberFormatter.formatRangeToParts(e,t);if(t<e)throw RangeError(`End date must be >= start date`);let n=this.numberFormatter.formatToParts(e),r=this.numberFormatter.formatToParts(t);return[...n.map(e=>({...e,source:`startRange`})),{type:`literal`,value:` – `,source:`shared`},...r.map(e=>({...e,source:`endRange`}))]}resolvedOptions(){let e=this.numberFormatter.resolvedOptions();return!fk&&this.options.signDisplay!=null&&(e={...e,signDisplay:this.options.signDisplay}),!pk&&this.options.style===`unit`&&(e={...e,style:`unit`,unit:this.options.unit,unitDisplay:this.options.unitDisplay}),e}constructor(e,t={}){this.numberFormatter=gk(e,t),this.options=t}};function gk(e,t={}){let{numberingSystem:n}=t;if(n&&e.includes(`-nu-`)&&(e.includes(`-u-`)||(e+=`-u-`),e+=`-nu-${n}`),t.style===`unit`&&!pk){var r;let{unit:e,unitDisplay:n=`short`}=t;if(!e)throw Error(`unit option must be provided with style: "unit"`);if(!((r=mk[e])!=null&&r[n]))throw Error(`Unsupported unit ${e} with unitDisplay = ${n}`);t={...t,style:`decimal`}}let i=e+(t?Object.entries(t).sort((e,t)=>e[0]<t[0]?-1:1).join():``);if(dk.has(i))return dk.get(i);let a=new Intl.NumberFormat(e,t);return dk.set(i,a),a}function _k(e,t,n){if(t===`auto`)return e.format(n);if(t===`never`)return e.format(Math.abs(n));{let r=!1;if(t===`always`?r=n>0||Object.is(n,0):t===`exceptZero`&&(Object.is(n,-0)||Object.is(n,0)?n=Math.abs(n):r=n>0),r){let t=e.format(-n),r=e.format(n),i=t.replace(r,``).replace(/\u200e|\u061C/,``);return[...i].length,t.replace(r,`!!!`).replace(i,`+`).replace(`!!!`,r)}else return e.format(n)}}function vk(e){return e&&e.__esModule?e.default:e}var yk=new ak(vk(tk));function bk(e){let t=Dk.parse(e)||kk.parse(e)||Mk.parse(e);if(t)return t;throw Error(`Invalid color value: `+e)}var xk=.68,Sk=.85,Ck=.55,wk=.001,Tk=[[0,`pink`],[15,`red`],[48,`orange`],[94,`yellow`],[135,`green`],[175,`cyan`],[264,`blue`],[284,`purple`],[320,`magenta`],[349,`pink`]],Ek=class{toHexInt(){return this.toFormat(`rgb`).toHexInt()}getChannelValue(e){if(e in this)return this[e];throw Error(`Unsupported color channel: `+e)}withChannelValue(e,t){if(e in this){let n=this.clone();return n[e]=t,n}throw Error(`Unsupported color channel: `+e)}getChannelName(e,t){return(ak.getGlobalDictionaryForPackage(`@react-stately/color`)||yk).getStringForLocale(e,t)}getColorSpaceAxes(e){let{xChannel:t,yChannel:n}=e,r=t||this.getColorChannels().find(e=>e!==n),i=n||this.getColorChannels().find(e=>e!==r);return{xChannel:r,yChannel:i,zChannel:this.getColorChannels().find(e=>e!==r&&e!==i)}}getColorName(e){let[t,n,r]=Nk(this),i=ak.getGlobalDictionaryForPackage(`@react-stately/color`)||yk;if(t>.999)return i.getStringForLocale(`white`,e);if(t<.001)return i.getStringForLocale(`black`,e);let a;[a,t]=this.getOklchHue(t,n,r,e);let o=``,s=``;n<=.1&&n>=wk?s=t>=.7?`pale`:`grayish`:n>=.15&&(s=`vibrant`),t<.3?o=`very dark`:t<Ck?o=`dark`:t<.7||(o=t<.85?`light`:`very light`),s&&=i.getStringForLocale(s,e),o&&=i.getStringForLocale(o,e);let c=this.getChannelValue(`alpha`),l=new uk(e,i);if(c<1){let t=new hk(e,{style:`percent`}).format(1-c);return l.format(`transparentColorName`,{lightness:o,chroma:s,hue:a,percentTransparent:t}).replace(/\s+/g,` `).trim()}else return l.format(`colorName`,{lightness:o,chroma:s,hue:a}).replace(/\s+/g,` `).trim()}getOklchHue(e,t,n,r){let i=ak.getGlobalDictionaryForPackage(`@react-stately/color`)||yk;if(t<wk)return[i.getStringForLocale(`gray`,r),e];for(let t=0;t<Tk.length;t++){let[a,o]=Tk[t],[s,c]=Tk[t+1]||[360,`pink`];if(n>=a&&n<s)return o===`orange`&&(e<xk?o=`brown`:e=e-xk+Ck),n>a+(s-a)/2&&o!==c?o=`${o} ${c}`:o===`yellow`&&e<Sk&&(o=`yellow green`),[i.getStringForLocale(o,r).toLocaleLowerCase(r),e]}throw Error(`Unexpected hue`)}getHueName(e){let[t,n,r]=Nk(this),[i]=this.getOklchHue(t,n,r,e);return i}},Dk=class e extends Ek{static parse(t){let n=[];if(/^#[\da-f]+$/i.test(t)&&[4,5,7,9].includes(t.length)){let e=(t.length<6?t.replace(/[^#]/gi,`$&$&`):t).slice(1).split(``);for(;e.length>0;)n.push(parseInt(e.splice(0,2).join(``),16));n[3]=n[3]===void 0?void 0:n[3]/255}let r=t.match(/^rgba?\((.*)\)$/);return r!=null&&r[1]&&(n=r[1].split(`,`).map(e=>Number(e.trim())),n=n.map((e,t)=>mv(e,0,t<3?255:1))),n.length<3?void 0:new e(n[0],n[1],n[2],n[3]??1)}toString(e=`css`){switch(e){case`hex`:return`#`+(this.red.toString(16).padStart(2,`0`)+this.green.toString(16).padStart(2,`0`)+this.blue.toString(16).padStart(2,`0`)).toUpperCase();case`hexa`:return`#`+(this.red.toString(16).padStart(2,`0`)+this.green.toString(16).padStart(2,`0`)+this.blue.toString(16).padStart(2,`0`)+Math.round(this.alpha*255).toString(16).padStart(2,`0`)).toUpperCase();case`rgb`:return`rgb(${this.red}, ${this.green}, ${this.blue})`;case`css`:case`rgba`:return`rgba(${this.red}, ${this.green}, ${this.blue}, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case`hex`:case`hexa`:case`rgb`:case`rgba`:return this;case`hsb`:case`hsba`:return this.toHSB();case`hsl`:case`hsla`:return this.toHSL();default:throw Error(`Unsupported color conversion: rgb -> `+e)}}toHexInt(){return this.red<<16|this.green<<8|this.blue}toHSB(){let e=this.red/255,t=this.green/255,n=this.blue/255,r=Math.min(e,t,n),i=Math.max(e,t,n),a=i-r,o=i===0?0:a/i,s=0;if(a!==0){switch(i){case e:s=(t-n)/a+(t<n?6:0);break;case t:s=(n-e)/a+2;break;case n:s=(e-t)/a+4;break}s/=6}return new kk(_v(s*360,2),_v(o*100,2),_v(i*100,2),this.alpha)}toHSL(){let e=this.red/255,t=this.green/255,n=this.blue/255,r=Math.min(e,t,n),i=Math.max(e,t,n),a=(i+r)/2,o=i-r,s,c;if(o===0)s=c=0;else{switch(c=o/(a<.5?i+r:2-i-r),i){case e:s=(t-n)/o+(t<n?6:0);break;case t:s=(n-e)/o+2;break;case n:s=(e-t)/o+4;break}s/=6}return new Mk(_v(s*360,2),_v(c*100,2),_v(a*100,2),this.alpha)}clone(){return new e(this.red,this.green,this.blue,this.alpha)}getChannelRange(e){switch(e){case`red`:case`green`:case`blue`:return{minValue:0,maxValue:255,step:1,pageSize:17};case`alpha`:return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw Error(`Unknown color channel: `+e)}}getChannelFormatOptions(e){switch(e){case`red`:case`green`:case`blue`:return{style:`decimal`};case`alpha`:return{style:`percent`};default:throw Error(`Unknown color channel: `+e)}}formatChannelValue(e,t){let n=this.getChannelFormatOptions(e),r=this.getChannelValue(e);return new hk(t,n).format(r)}getColorSpace(){return`rgb`}getColorChannels(){return e.colorChannels}constructor(e,t,n,r){super(),this.red=e,this.green=t,this.blue=n,this.alpha=r}};Dk.colorChannels=[`red`,`green`,`blue`];var Ok=/hsb\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsba\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/,kk=class e extends Ek{static parse(t){let n;if(n=t.match(Ok)){let[t,r,i,a]=(n[1]??n[2]).split(`,`).map(e=>Number(e.trim().replace(`%`,``)));return new e(jk(t,360),mv(r,0,100),mv(i,0,100),mv(a??1,0,1))}}toString(e=`css`){switch(e){case`css`:return this.toHSL().toString(`css`);case`hex`:return this.toRGB().toString(`hex`);case`hexa`:return this.toRGB().toString(`hexa`);case`hsb`:return`hsb(${this.hue}, ${_v(this.saturation,2)}%, ${_v(this.brightness,2)}%)`;case`hsba`:return`hsba(${this.hue}, ${_v(this.saturation,2)}%, ${_v(this.brightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case`hsb`:case`hsba`:return this;case`hsl`:case`hsla`:return this.toHSL();case`rgb`:case`rgba`:return this.toRGB();default:throw Error(`Unsupported color conversion: hsb -> `+e)}}toHSL(){let e=this.saturation/100,t=this.brightness/100,n=t*(1-e/2);return e=n===0||n===1?0:(t-n)/Math.min(n,1-n),new Mk(_v(this.hue,2),_v(e*100,2),_v(n*100,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,n=this.brightness/100,r=(r,i=(r+e/60)%6)=>n-t*n*Math.max(Math.min(i,4-i,1),0);return new Dk(Math.round(r(5)*255),Math.round(r(3)*255),Math.round(r(1)*255),this.alpha)}clone(){return new e(this.hue,this.saturation,this.brightness,this.alpha)}getChannelRange(e){switch(e){case`hue`:return{minValue:0,maxValue:360,step:1,pageSize:15};case`saturation`:case`brightness`:return{minValue:0,maxValue:100,step:1,pageSize:10};case`alpha`:return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw Error(`Unknown color channel: `+e)}}getChannelFormatOptions(e){switch(e){case`hue`:return{style:`unit`,unit:`degree`,unitDisplay:`narrow`};case`saturation`:case`brightness`:case`alpha`:return{style:`percent`};default:throw Error(`Unknown color channel: `+e)}}formatChannelValue(e,t){let n=this.getChannelFormatOptions(e),r=this.getChannelValue(e);return(e===`saturation`||e===`brightness`)&&(r/=100),new hk(t,n).format(r)}getColorSpace(){return`hsb`}getColorChannels(){return e.colorChannels}constructor(e,t,n,r){super(),this.hue=e,this.saturation=t,this.brightness=n,this.alpha=r}};kk.colorChannels=[`hue`,`saturation`,`brightness`];var Ak=/hsl\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%)\)|hsla\(([-+]?\d+(?:.\d+)?\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d+(?:.\d+)?%\s*,\s*[-+]?\d(.\d+)?)\)/;function jk(e,t){return(e%t+t)%t}var Mk=class e extends Ek{static parse(t){let n;if(n=t.match(Ak)){let[t,r,i,a]=(n[1]??n[2]).split(`,`).map(e=>Number(e.trim().replace(`%`,``)));return new e(jk(t,360),mv(r,0,100),mv(i,0,100),mv(a??1,0,1))}}toString(e=`css`){switch(e){case`hex`:return this.toRGB().toString(`hex`);case`hexa`:return this.toRGB().toString(`hexa`);case`hsl`:return`hsl(${this.hue}, ${_v(this.saturation,2)}%, ${_v(this.lightness,2)}%)`;case`css`:case`hsla`:return`hsla(${this.hue}, ${_v(this.saturation,2)}%, ${_v(this.lightness,2)}%, ${this.alpha})`;default:return this.toFormat(e).toString(e)}}toFormat(e){switch(e){case`hsl`:case`hsla`:return this;case`hsb`:case`hsba`:return this.toHSB();case`rgb`:case`rgba`:return this.toRGB();default:throw Error(`Unsupported color conversion: hsl -> `+e)}}toHSB(){let e=this.saturation/100,t=this.lightness/100,n=t+e*Math.min(t,1-t);return e=n===0?0:2*(1-t/n),new kk(_v(this.hue,2),_v(e*100,2),_v(n*100,2),this.alpha)}toRGB(){let e=this.hue,t=this.saturation/100,n=this.lightness/100,r=t*Math.min(n,1-n),i=(t,i=(t+e/30)%12)=>n-r*Math.max(Math.min(i-3,9-i,1),-1);return new Dk(Math.round(i(0)*255),Math.round(i(8)*255),Math.round(i(4)*255),this.alpha)}clone(){return new e(this.hue,this.saturation,this.lightness,this.alpha)}getChannelRange(e){switch(e){case`hue`:return{minValue:0,maxValue:360,step:1,pageSize:15};case`saturation`:case`lightness`:return{minValue:0,maxValue:100,step:1,pageSize:10};case`alpha`:return{minValue:0,maxValue:1,step:.01,pageSize:.1};default:throw Error(`Unknown color channel: `+e)}}getChannelFormatOptions(e){switch(e){case`hue`:return{style:`unit`,unit:`degree`,unitDisplay:`narrow`};case`saturation`:case`lightness`:case`alpha`:return{style:`percent`};default:throw Error(`Unknown color channel: `+e)}}formatChannelValue(e,t){let n=this.getChannelFormatOptions(e),r=this.getChannelValue(e);return(e===`saturation`||e===`lightness`)&&(r/=100),new hk(t,n).format(r)}getColorSpace(){return`hsl`}getColorChannels(){return e.colorChannels}constructor(e,t,n,r){super(),this.hue=e,this.saturation=t,this.lightness=n,this.alpha=r}};Mk.colorChannels=[`hue`,`saturation`,`lightness`];function Nk(e){let t=e.toFormat(`rgb`),n=t.getChannelValue(`red`)/255,r=t.getChannelValue(`green`)/255,i=t.getChannelValue(`blue`)/255;[n,r,i]=Fk(n,r,i);let[a,o,s]=Lk(n,r,i),[c,l,u]=Rk(a,o,s);return Pk(c,l,u)}function Pk(e,t,n){var r=Math.atan2(n,t)*180/Math.PI;return[e,Math.sqrt(t**2+n**2),r>=0?r:r+360]}function Fk(e,t,n){return[Ik(e),Ik(t),Ik(n)]}function Ik(e){let t=e<0?-1:1,n=Math.abs(e);return n<=.04045?e/12.92:t*((n+.055)/1.055)**2.4}function Lk(e,t,n){return zk([.4123907992659595,.35758433938387796,.1804807884018343,.21263900587151036,.7151686787677559,.07219231536073371,.01933081871559185,.11919477979462599,.9505321522496606],e,t,n)}function Rk(e,t,n){let r=[.819022437996703,.3619062600528904,-.1288737815209879,.0329836539323885,.9292868615863434,.0361446663506424,.0481771893596242,.2642395317527308,.6335478284694309],i=[.210454268309314,.7936177747023054,-.0040720430116193,1.9779985324311684,-2.42859224204858,.450593709617411,.0259040424655478,.7827717124575296,-.8086757549230774],[a,o,s]=zk(r,e,t,n);return zk(i,Math.cbrt(a),Math.cbrt(o),Math.cbrt(s))}function zk(e,t,n,r){return[e[0]*t+e[1]*n+e[2]*r,e[3]*t+e[4]*n+e[5]*r,e[6]*t+e[7]*n+e[8]*r]}var Bk=[{color:`rgb(255, 255, 255)`,name:B(`White`)},{color:`rgb(239,245,245)`,name:B(`Solitude`)},{color:`rgb(245,213,174)`,name:B(`Wheat`)},{color:`rgb(253,227,167)`,name:B(`Cape Honey`)},{color:`rgb(242,222,186)`,name:B(`Milk punch`)},{color:`rgb(97,118,75)`,name:B(`Dingy`),foreground:`rgb(255, 255, 255)`},{color:`rgb(4, 147, 114)`,name:B(`Aquamarine`),foreground:`rgb(255, 255, 255)`},{color:`rgb(222,245,229)`,name:B(`Cosmic Latte`)},{color:`rgb(233,119,119)`,name:B(`Geraldine`),foreground:`rgb(90,14,14)`},{color:`rgb(247,164,164)`,name:B(`Sundown`)},{color:`rgb(30,139,195)`,name:B(`Pelorous`),foreground:`rgb(255, 255, 255)`},{color:`rgb(142,68,173)`,name:B(`Deep Lilac`),foreground:`rgb(255, 255, 255)`},{color:`rgb(108,74,182)`,name:B(`Blue marguerite`),foreground:`rgb(255, 255, 255)`},{color:`rgb(139,126,116)`,name:B(`Americano`),foreground:`rgb(255, 255, 255)`},{color:`rgb(0,0,0)`,name:B(`Black`),foreground:`rgb(255, 255, 255)`},{color:`rgb(64,66,88)`,name:B(`Blue zodiac`),foreground:`rgb(255, 255, 255)`},{color:`rgb(101,100,124)`,name:B(`Comet`),foreground:`rgb(255, 255, 255)`}];function Vk({onChange:e,value:t,colors:n}){return(0,m.jsx)(`div`,{className:`flex flex-wrap gap-6`,children:n.map(n=>{let r=t===n;return(0,m.jsx)(gb,{onClick:()=>{e?.(n)},className:H(`relative block flex-shrink-0 w-26 h-26 border rounded`,r&&`shadow-md`),style:{backgroundColor:n},children:r&&(0,m.jsx)(`span`,{className:`absolute inset-0 m-auto rounded-full w-8 h-8 bg-white`})},n)})})}var Hk=Bk.map(({color:e})=>e).slice(0,14);function Uk({defaultValue:e,onChange:t,colorPresets:n,showInput:r}){let[i,a]=(0,l.useState)(e),o=n||Hk,s=bw({size:`sm`});return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(gO,{className:`!w-auto`,color:i,onChange:e=>{t?.(e),a(e)}}),(0,m.jsxs)(`div`,{className:`px-12 py-20`,children:[o&&(0,m.jsx)(Vk,{colors:o,onChange:e=>{if(e){let n=bk(e).toString(`hex`);t?.(n),a(n)}},value:i}),r&&(0,m.jsx)(`div`,{className:`pt-20`,children:(0,m.jsx)(bO,{autoComplete:`off`,role:`textbox`,autoCorrect:`off`,spellCheck:`false`,required:!0,"aria-label":`Hex color`,prefixed:!0,className:s.input,color:i,onChange:e=>{t?.(e),a(e)}})})]})]})}var Wk=l.default.createContext(null);function Gk(){return(0,l.useContext)(Wk)}function Kk(){let{lines:e,localeCode:t}=TC();return{trans:(0,l.useCallback)(n=>qk({...n,lines:e,localeCode:t}),[e,t])}}var qk=Db(e=>{let{lines:t,message:n,values:r,localeCode:i}=e;return n==null?``:(n=t?.[n]||t?.[n.toLowerCase()]||n,r&&(n=EC(i,e),Object.entries(r).forEach(([e,t])=>{n=n.replace(`:${e}`,`${t}`)})),n)},{equals:wC,callTimeout:0});function Jk({onDismiss:e}){let{trans:t}=Kk(),n=()=>{e&&e()};return(0,m.jsx)(`button`,{className:`sr-only`,"aria-label":t(B(`Dismiss`)),tabIndex:-1,onClick:n})}function Yk(e){let{type:t=`modal`,dialogProps:n,...r}=(0,l.useContext)(Wk),{children:i,className:a,size:o=`md`,background:s,radius:c=`rounded`,maxWidth:u=`max-w-dialog`,...d}=e,f=null;(t===`popover`||t===`tray`)&&(f=(0,m.jsx)(Jk,{onDismiss:r.close}));let p=o===`fullscreenTakeover`||t===`tray`,h=H(`mx-auto pointer-events-auto outline-none flex flex-col overflow-hidden`,s||`bg`,t!==`tray`&&Xk(o),t===`tray`&&`rounded-t border-b-bg`,o!==`fullscreenTakeover`&&`shadow-2xl border max-h-dialog`,!p&&`${c} ${u}`,a);return(0,m.jsxs)(`div`,{...q_({role:`dialog`,tabIndex:-1},n,d),style:{...e.style,"--be-dialog-padding":`24px`},"aria-modal":!0,className:h,children:[l.Children.toArray(i).map(e=>(0,l.isValidElement)(e)?(0,l.cloneElement)(e,{size:e.props.size??o}):e),f]})}function Xk(e){switch(e){case`2xs`:return`w-256`;case`xs`:return`w-320`;case`sm`:return`w-384`;case`md`:return`w-440`;case`lg`:return`w-620`;case`xl`:return`w-780`;case`2xl`:return`w-850`;case`fullscreen`:return`w-1280`;case`fullscreenTakeover`:return`w-full h-full`;default:return e}}var Zk=U((0,m.jsx)(`path`,{d:`M7.41 8.59 12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z`}),`KeyboardArrowDownOutlined`),Qk=(0,l.forwardRef)(({children:e,autoFocus:t=!1,restoreFocus:n=!0,isDismissable:r=!0,isOpen:i=!1,placement:a=`center`,onClose:o},s)=>{let c=gC(),l=cv(s);return(0,m.jsxs)(`div`,{className:`fixed inset-0 isolate z-modal`,style:c,onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),e.preventDefault(),o())},children:[(0,m.jsx)(SC,{onClick:()=>{r&&o()}},`modal-underlay`),(0,m.jsx)(x_.div,{ref:l,className:H(`pointer-events-none absolute inset-0 z-20 flex h-full w-full`,a===`center`&&`items-center justify-center`,a===`top`&&`items-start justify-center pt-40`),role:`presentation`,initial:{opacity:0,scale:a===`top`?1:.7},animate:{opacity:1,scale:1},exit:{opacity:0,scale:1},transition:{duration:.1},children:(0,m.jsx)(qS,{restoreFocus:n,autoFocus:t,contain:!0,children:e})})]})});function $k({x:e,y:t},n){return{getBoundingClientRect(){return{x:e,y:t,width:0,height:0,top:t,right:e,bottom:t,left:e}},contextElement:n}}function eA(e){let t=(0,l.useRef)(e);return(0,l.useEffect)(()=>{t.current=e}),(0,l.useMemo)(()=>(...e)=>t.current?.call(t,...e),[])}function tA(e){let{children:t,type:n,disableInitialTransition:r,isDismissable:i=!0,moveFocusToDialog:a=!0,returnFocusToTrigger:o=!0,triggerOnHover:s=!1,triggerOnContextMenu:c=!1,usePortal:d=!0,mobileType:f,alwaysReturnCurrentValueOnClose:p}=e,h=(0,l.useRef)(null),g=c&&!e.triggerRef?h:e.triggerRef,_=(0,l.useRef)(e.value),[v,y]=pv(e.isOpen,e.defaultIsOpen,e.onOpenChange),[b,x]=pv(e.value,e.defaultValue,e.onValueChange);zC()&&n===`popover`&&(n=f||`modal`);let S=(0,l.useRef)(null),{x:C,y:w,reference:T,strategy:E,refs:D}=yS({...e,disablePositioning:n===`modal`}),O=n===`popover`?{position:E,top:w??``,left:C??``}:{},k=(0,l.useId)(),A=`${k}-label`,j=`${k}-description`,M=`${k}-form`,N=eA(e.onClose),P=(0,l.useCallback)(e=>{typeof e>`u`&&p&&(e=b);let t=typeof e<`u`?e:_.current;N?.(t,{initialValue:_.current,valueChanged:t!==_.current}),y(!1)},[N,y,b,p]),ee=(0,l.useCallback)(()=>{y(!0),_.current=e.value},[e.value,y]);I_(()=>{g!=null&&g.current&&D.reference.current!==g.current&&T(g.current)},[T,g?.current,D]);let F=(0,l.useMemo)(()=>({"aria-labelledby":A,"aria-describedby":j}),[A,j]),te;te=n===`modal`?Qk:n===`tray`?CC:vC;let ne=(0,l.useMemo)(()=>({dialogProps:F,type:n,labelId:A,descriptionId:j,isDismissable:i,close:P,value:b,initialValue:_.current,setValue:x,formId:M}),[P,j,F,M,A,n,i,b,x]);s&&=n===`popover`;let re={onPointerEnter:hb(e=>{ee()}),onPointerLeave:hb(e=>{S.current=setTimeout(()=>{P()},150)})},I={onPointerEnter:hb(e=>{S.current&&clearTimeout(S.current)}),onPointerLeave:hb(e=>{P()})},ie={onContextMenu:hb(e=>{e.preventDefault(),h.current=$k({x:e.clientX,y:e.clientY},e.currentTarget),ee()})},ae={onClick:hb(e=>{e.stopPropagation(),v?P():ee()})},{dialogTrigger:L,dialog:oe}=nA(t,ne),se=(0,m.jsx)(M_,{initial:!r,children:v&&(0,m.jsx)(Wk.Provider,{value:ne,children:(0,m.jsx)(te,{...s?I:{},ref:D.setFloating,triggerRef:D.reference,style:O,restoreFocus:o,autoFocus:a,isOpen:v,onClose:P,isDismissable:i,isContextMenu:c,placement:e.placement,children:oe})})});return(0,m.jsxs)(l.Fragment,{children:[L&&(0,l.cloneElement)(L,q_({...!g&&!c?{ref:T}:{},...c?{}:ae,...s?re:{},...c?ie:{}},{...L.props})),d?Fu&&(0,u.createPortal)(se,Fu):se]})}function nA(e,t){let n=Array.isArray(e)?e:l.Children.toArray(e),r=n.length===2?n[1]:n[0];return r=typeof r==`function`?r(t):r,n.length===2?{dialogTrigger:n[0],dialog:r}:{dialog:r}}function rA(e){let{label:t,className:n,value:r,onChange:i,size:a,width:o=`w-max`}=e,s=G(e=>e.config.ui?.colorPresets?.items)||[],c=bw({size:a}),[u,d]=(0,l.useState)(r),[f,p]=(0,l.useState)(!1),h=e=>{d(e),i?.(e)};return(0,m.jsxs)(`div`,{className:H(n,o),children:[t&&(0,m.jsx)(`span`,{className:c.label,children:t}),(0,m.jsxs)(tA,{type:`popover`,isOpen:f,onOpenChange:p,children:[(0,m.jsxs)(gb,{className:H(c.input,`inline-flex items-center`),"aria-label":e[`aria-label`],children:[(0,m.jsx)(`span`,{className:`block flex-shrink-0 mr-5 border rounded h-2/4 aspect-square`,style:{backgroundColor:u}}),(0,m.jsx)(iA,{isActive:f,className:c.adornment})]}),(0,m.jsx)(Yk,{size:`auto`,children:(0,m.jsx)(Uk,{onChange:h,defaultValue:u,colorPresets:s})})]})]})}function iA({isActive:e,className:t}){return(0,m.jsx)(Zk,{size:`sm`,className:`transition-transform ml-auto flex-shrink-0 ${e?`rotate-180`:`rotate-0`} ${t}`})}function aA(e){let{size:t=`md`,inline:n,label:r,showValueLabel:i=!!r,className:a,width:o=`w-full`,slider:s,children:c,trackColor:l=`primary`,fillColor:u=`primary`}=e,{domProps:d,trackRef:f,getThumbPercent:p,getThumbValueLabel:h,labelId:g,groupId:_,thumbIds:v,isDisabled:y,numberFormatter:b,minValue:x,maxValue:S,step:C,values:w,getValueLabel:T}=s,E=``,D=Math.max([...b.format(x)].length,[...b.format(S)].length,[...b.format(C)].length);T?E=T(w[0]):w.length===1?E=h(0):w.length===2&&(E=`${h(0)} – ${h(1)}`,D=3+2*Math.max(D,[...b.format(x)].length,[...b.format(S)].length));let O=bw({size:t,disabled:y,labelDisplay:`flex`});return(0,m.jsxs)(`div`,{className:H(`touch-none`,a,o,{"flex items-center":n}),role:`group`,id:_,children:[(r||i)&&(0,m.jsxs)(`div`,{className:H(O.label,`select-none`),children:[r&&(0,m.jsx)(`label`,{onClick:()=>{var e;(e=document.getElementById(v[0]))==null||e.focus()},id:g,htmlFor:_,children:r}),i&&(0,m.jsx)(`output`,{htmlFor:v[0],className:`ml-auto text-right`,"aria-live":`off`,style:D?{width:`${D}ch`,minWidth:`${D}ch`}:void 0,children:E})]}),(0,m.jsxs)(`div`,{ref:f,className:H(`relative`,oA(e)),...d,role:`presentation`,children:[(0,m.jsx)(`div`,{className:H(`absolute inset-0 m-auto rounded`,cA(l,y),sA(t))}),(0,m.jsx)(`div`,{className:H(`absolute inset-0 my-auto rounded`,lA(u,y),sA(t)),style:{width:`${Math.max(p(0)*100,0)}%`}}),c]})]})}function oA({size:e,wrapperHeight:t}){if(t)return t;switch(e){case`xs`:return`h-14`;case`sm`:return`h-20`;default:return`h-30`}}function sA(e){switch(e){case`xs`:return`h-2`;case`sm`:return`h-3`;default:return`h-4`}}function cA(e,t){switch(t&&(e=`disabled`),e){case`disabled`:return`bg-slider-disabled/60`;case`primary`:return`bg-primary-light`;case`neutral`:return`bg-divider`;default:return e}}function lA(e,t){switch(t&&(e=`disabled`),e){case`disabled`:return`bg-slider-disabled`;case`primary`:return`bg-primary`;default:return e}}function uA(e={}){let{localeCode:t}=TC();return(0,l.useMemo)(()=>new hk(t,e),[t,e])}function dA({minValue:e=0,maxValue:t=100,isDisabled:n=!1,step:r=1,formatOptions:i,onChangeEnd:a,onPointerDown:o,label:s,getValueLabel:c,showThumbOnHoverOnly:u,thumbSize:d,onPointerMove:f,...p}){let[m,h]=(0,l.useState)(!1),g=uA(i),{addGlobalListener:_,removeGlobalListener:v}=sv(),y=(0,l.useRef)(null),[b,x]=pv(p.value?p.value:void 0,p.defaultValue??[e],p.onChange),S=(0,l.useRef)(null);S.current=b;let[C,w]=(0,l.useState)(Array(b.length).fill(!1)),T=(0,l.useRef)(null);T.current=C;function E(e){return g.format(e)}let D=e=>T.current?.[e]||!1,O=e=>E(b[e]),k=t=>t===0?e:b[t-1],A=e=>e===b.length-1?t:b[e+1],j=(e,t)=>{if(n||!ie(e)||!S.current)return;let i=k(e),a=A(e);t=gv(t,i,a,r),S.current=fA(S.current,e,t),x(S.current)},M=(e,t)=>{if(n||!ie(e))return;let r=T.current?.[e];T.current=fA(T.current||[],e,t),w(T.current),a&&r&&!T.current.some(Boolean)&&a(S.current||[])},[N,P]=(0,l.useState)(void 0),ee=n=>{let r=Math.min(1,(n-e)/(t-e));return isNaN(r)?0:r},F=e=>ee(S.current[e]),te=(e,t)=>{j(e,re(t))},ne=t=>Math.round((t-e)/r)*r+e,re=n=>cD(ne(n*(t-e)+e),e,t),I=(0,l.useRef)(Array(b.length).fill(!0)),ie=e=>I.current[e],ae=(e,t)=>{I.current[e]=t},L=(0,l.useRef)(null),oe=(0,l.useRef)(void 0),se=e=>{if(!(e.pointerType===`mouse`&&(e.button!==0||e.altKey||e.ctrlKey||e.metaKey))&&(o?.(),y.current&&!n&&b.every((e,t)=>!C[t]))){let t=y.current.offsetWidth,n=y.current.getBoundingClientRect().left,r=re((e.clientX-n)/t),i,a=b.findIndex(e=>r-e<0);if(a===0)i=a;else if(a===-1)i=b.length-1;else{let e=b[a-1],t=b[a];i=Math.abs(e-r)<Math.abs(t-r)?a-1:a}i>=0&&ie(i)?(e.preventDefault(),L.current=i,P(i),oe.current=e.pointerId,M(L.current,!0),j(i,r),_(window,`pointerup`,de,!1)):L.current=null}},ce=(0,l.useRef)(null),{domProps:le}=JE({onPointerDown:se,onMoveStart(){ce.current=null},onMove(e,t){let n=y.current?.offsetWidth||0;if(ce.current??=F(L.current||0)*n,ce.current+=t,L.current!=null&&y.current){let e=cD(ce.current/n,0,1);te(L.current,e)}},onMoveEnd(){L.current!=null&&(M(L.current,!1),L.current=null)}}),ue=q_(le,{onPointerEnter:()=>{h(!0)},onPointerLeave:()=>{h(!1)},onPointerMove:e=>{f?.(e)}}),de=e=>{e.pointerId===oe.current&&(L.current!=null&&(M(L.current,!1),L.current=null),v(window,`pointerup`,de,!1))},fe=(0,l.useId)();return{domProps:ue,trackRef:y,isDisabled:n,step:r,values:b,minValue:e,maxValue:t,focusedThumb:N,labelId:s?`${fe}-label`:void 0,groupId:`${fe}-group`,thumbIds:[...Array(b.length)].map((e,t)=>`${fe}-thumb-${t}`),numberFormatter:g,getThumbPercent:F,getThumbMinValue:k,getThumbMaxValue:A,getThumbValueLabel:O,isThumbDragging:D,setThumbValue:j,updateDraggedThumbs:M,setThumbEditable:ae,setFocusedThumb:P,getValueLabel:c,isPointerOver:m,showThumbOnHoverOnly:u,thumbSize:d}}function fA(e,t,n){return e[t]===n?e:[...e.slice(0,t),n,...e.slice(t+1)]}function pA({index:e,slider:t,isDisabled:n,ariaLabel:r,inputRef:i,onBlur:a,fillColor:o=`primary`}){let s=cv(i),{addGlobalListener:c,removeGlobalListener:u}=sv(),{step:d,values:f,focusedThumb:p,labelId:h,thumbIds:g,isDisabled:_,getThumbPercent:v,getThumbMinValue:y,getThumbMaxValue:b,getThumbValueLabel:x,setThumbValue:S,updateDraggedThumbs:C,isThumbDragging:w,setThumbEditable:T,setFocusedThumb:E,isPointerOver:D,showThumbOnHoverOnly:O,thumbSize:k=`w-18 h-18`}=t,A=w(e),j=f[e];T(e,!n);let M=n||_,N=(0,l.useCallback)(()=>{s.current&&s.current.focus({preventScroll:!0})},[s]),P=p===e;(0,l.useEffect)(()=>{P&&N()},[P,N]);let ee=(0,l.useRef)(void 0),F=t=>{t.pointerId===ee.current&&(N(),C(e,!1),u(window,`pointerup`,F,!1))};return(0,m.jsx)(`div`,{role:`presentation`,className:H(`outline-none rounded-full top-1/2 -translate-y-1/2 -translate-x-1/2 absolute inset-0 transition-button duration-200`,k,!M&&`shadow-md`,mA({fillColor:o,isDisabled:M,isDragging:A}),!O||O&&A||D?`visible`:`invisible`),style:{left:`${Math.max(v(e)*100,0)}%`},onPointerDown:t=>{t.button!==0||t.altKey||t.ctrlKey||t.metaKey||(N(),ee.current=t.pointerId,C(e,!0),c(window,`pointerup`,F,!1))},children:(0,m.jsx)(`input`,{id:g[e],onKeyDown:hb(()=>{C(e,!0)}),onKeyUp:hb(()=>{C(e,!1)}),ref:s,tabIndex:M?void 0:0,min:y(e),max:b(e),step:d,value:j,disabled:M,"aria-label":r,"aria-labelledby":h,"aria-orientation":`horizontal`,"aria-valuetext":x(e),onFocus:()=>{E(e)},onBlur:t=>{E(void 0),C(e,!1),a?.(t)},onChange:t=>{S(e,parseFloat(t.target.value))},type:`range`,className:`sr-only`})})}function mA({isDisabled:e,isDragging:t,fillColor:n}){return e?`bg-slider-disabled cursor-default`:n&&n!==`primary`?n:H(`hover:bg-primary-dark`,t?`bg-primary-dark`:`bg-primary`)}function hA({inputRef:e,onBlur:t,...n}){let{onChange:r,onChangeEnd:i,value:a,defaultValue:o,...s}=n,c={...s,value:a==null?void 0:[a],defaultValue:o==null?void 0:[o],onChange:e=>{r?.(e[0])},onChangeEnd:e=>{i?.(e[0])}},l=dA(c);return(0,m.jsx)(aA,{...c,slider:l,children:(0,m.jsx)(pA,{fillColor:n.fillColor,index:0,slider:l,inputRef:e,onBlur:t})})}var gA=l.default.forwardRef((e,t)=>{let{value:n=0,minValue:r=0,maxValue:i=100,size:a=`md`,isIndeterminate:o=!1,className:s,position:c=`relative`,trackColor:l,fillColor:u=`border-primary`,...d}=e;n=cD(n,r,i);let f=vA(a),p=(n-r)/(i-r),h=uA({style:`percent`}),g=``;!o&&!g&&(g=h.format(p));let _={},v={};if(!o){let e=(n-r)/(i-r)*100,t;e>0&&e<=50?(t=-180+e/50*180,_.transform=`rotate(${t}deg)`,v.transform=`rotate(-180deg)`):e>50&&(t=-180+(e-50)/50*180,_.transform=`rotate(0deg)`,v.transform=`rotate(${t}deg)`)}return(0,m.jsxs)(`div`,{...d,"aria-valuenow":o?void 0:n,"aria-valuemin":r,"aria-valuemax":i,"aria-valuetext":o?void 0:g,role:`progressbar`,ref:t,className:H(`progress-circle`,c,f,o&&`indeterminate`,s),children:[(0,m.jsx)(`div`,{className:H(f,l,`rounded-full border-4`)}),(0,m.jsxs)(`div`,{className:H(`fills absolute left-0 top-0 h-full w-full`,o&&`progress-circle-fills-animate`),children:[(0,m.jsx)(_A,{circleSize:f,subMaskStyle:_,isIndeterminate:o,className:`rotate-180`,fillColor:u,subMaskClassName:H(o&&`progress-circle-fill-submask-1-animate`)}),(0,m.jsx)(_A,{circleSize:f,subMaskStyle:v,isIndeterminate:o,fillColor:u,subMaskClassName:H(o&&`progress-circle-fill-submask-2-animate`)})]})]})});function _A({subMaskStyle:e,subMaskClassName:t,className:n,circleSize:r,isIndeterminate:i,fillColor:a}){return(0,m.jsx)(`div`,{className:H(`absolute h-full w-1/2 origin-[100%] overflow-hidden`,n),children:(0,m.jsx)(`div`,{className:H(`h-full w-full origin-[100%] rotate-180 overflow-hidden`,!i&&`transition-transform duration-100`,t),style:e,children:(0,m.jsx)(`div`,{className:H(r,a,`rounded-full border-4`)})})})}function vA(e){switch(e){case`xs`:return`w-20 h-20`;case`sm`:return`w-24 h-24`;case`md`:return`w-32 h-32`;case`lg`:return`w-42 h-42`;default:return e}}function yA({isLoading:e,icon:t}){let n=(0,l.useRef)(null),{trans:r}=Kk(),[i,a]=(0,l.useState)(!1),{state:{isOpen:o,inputValue:s}}=bb(),c=(0,l.useRef)(s);return(0,l.useEffect)(()=>{e&&!i?(n.current===null&&(n.current=setTimeout(()=>{a(!0)},500)),s!==c.current&&(clearTimeout(n.current),n.current=setTimeout(()=>{a(!0)},500))):e||(a(!1),clearTimeout(n.current),n.current=null),c.current=s},[e,i,s]),i&&(o||e)?(0,m.jsx)(gA,{"aria-label":r({message:`Loading`}),size:`sm`,isIndeterminate:!0}):t||(0,m.jsx)(Zk,{})}function bA(e,t){let n=zC(),{hideCaret:r,placeholder:i=(0,m.jsx)(Z,{message:`Select an option...`}),selectedValue:a,onItemSelected:o,onOpenChange:s,onInputValueChange:c,onSelectionChange:l,selectionMode:u,minWidth:d=`min-w-128`,children:f,searchPlaceholder:p,showEmptyMessage:h,showSearchField:g,defaultInputValue:_,inputValue:v,isLoading:y,isAsync:b,valueClassName:x,floatingWidth:S=n?`auto`:`matchTrigger`,...C}=e,w=bS({...e,clearInputOnItemSelection:!0,showEmptyMessage:h||g,floatingWidth:S,selectionMode:`single`,role:`listbox`,virtualFocus:g},t),{state:{selectedValues:T,isOpen:E,setIsOpen:D,activeIndex:O,setSelectedIndex:k,inputValue:A,setInputValue:j},collections:M,focusItem:N,listboxId:P,reference:ee,refs:F,listContent:te,onInputChange:ne}=w,{fieldProps:re,inputProps:I}=Mw({...C,focusRef:F.reference}),ie=M.collection.get(T[0]),ae=ie?(0,m.jsxs)(`span`,{className:`flex items-center gap-10`,children:[ie.element.props.startIcon,(0,m.jsx)(`span`,{className:H(`overflow-hidden overflow-ellipsis whitespace-nowrap`,x),children:ie.element.props.children})]}):(0,m.jsx)(`span`,{className:`italic`,children:i}),L=bw({...e,endAdornment:!0}),{handleTriggerKeyDown:oe,handleListboxKeyboardNavigation:se,handleListboxSearchFieldKeydown:ce}=NC(w),{findMatchingItem:le}=IC(),ue=e=>{if(!E)return;let t=le(e,te,O);t!=null&&N(`increment`,t)},de=e=>{if(E)return;let t=le(e,te,O);t!=null&&k(t)};return(0,m.jsx)(AC,{listbox:w,onKeyDownCapture:g?void 0:ue,onKeyDown:se,onClose:g?()=>j(``):void 0,isLoading:y,searchField:g&&(0,m.jsx)(Nw,{size:e.size===`xs`||e.size===`sm`?`xs`:`sm`,placeholder:p,startAdornment:(0,m.jsx)(BC,{}),className:`flex-shrink-0 px-8 pb-8 pt-4`,autoFocus:!0,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?P:void 0,"aria-autocomplete":`list`,autoComplete:`off`,autoCorrect:`off`,spellCheck:`false`,value:A,onChange:ne,onKeyDown:e=>{ce(e)}}),children:(0,m.jsx)(Ow,{fieldClassNames:L,...re,endAdornment:!r&&(0,m.jsx)(yA,{isLoading:y}),children:(0,m.jsx)(`button`,{...I,type:`button`,"data-selected-value":ie?.value,"aria-expanded":E?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":E?P:void 0,ref:ee,onKeyDown:oe,onKeyDownCapture:g?void 0:de,disabled:C.disabled,onClick:()=>{D(!E)},className:H(L.input,!re.unstyled&&d),children:ae})})})}var xA=l.default.forwardRef(bA);function SA(){let e=G(e=>e.filter.selected);if(!e)return null;let t=q().filter.getByName(e).options,n=(t,n)=>{var r;(r=q().filter)==null||r.applyValue(e,t,n),K().setDirty(!0)},r=q().canvas.getMainImage().filters,i=q().filter.findFilterIndex(e,r),a=r?.[i];return t?(0,m.jsx)(LD,{children:(0,m.jsx)(`div`,{className:`max-w-240 pt-10 mx-auto`,children:Object.entries(t).map(([e,t])=>{let r,i=a?a[e]:t.current;return t.type===`slider`?r=(0,m.jsx)(hA,{label:(0,m.jsx)(`span`,{className:`capitalize`,children:(0,m.jsx)(Z,{...Zv[e]})}),minValue:t.min,maxValue:t.max,step:t.step,defaultValue:i,formatOptions:{style:`percent`},size:`sm`,onChange:t=>{n(e,t)}}):t.type===`colorPicker`?r=(0,m.jsx)(rA,{label:(0,m.jsx)(Z,{...Zv[e]}),size:`sm`,width:`w-full`,value:i,onChange:t=>{n(e,t)}}):t.type===`select`&&(r=(0,m.jsx)(xA,{selectionMode:`single`,size:`sm`,label:(0,m.jsx)(Z,{...Zv[e]}),defaultValue:i,onSelectionChange:t=>{n(e,t)},children:t.available.map(e=>(0,m.jsx)(wb,{value:e.key,children:(0,m.jsx)(`span`,{className:`capitalize`,children:(0,m.jsx)(Z,{message:e.key})})},e.key))})),(0,m.jsx)(`div`,{className:`pb-10`,children:r},e)})})}):null}function CA(){let e=G(e=>e.frame.active)?.mode===`basic`,t=(0,l.useCallback)(e=>`${e}%`,[]);return(0,m.jsx)(LD,{className:`pb-18 pt-6`,children:(0,m.jsxs)(`div`,{className:`max-w-288 m-auto`,children:[e&&(0,m.jsx)(rA,{className:`mb-20`,width:`w-full`,size:`sm`,label:(0,m.jsx)(Z,{message:`Color`}),value:q().frame.builder.defaultColor,onChange:e=>{q().frame.active.changeColor(e)}}),(0,m.jsx)(hA,{size:`sm`,label:(0,m.jsx)(Z,{message:`Size`}),step:1,minValue:q().frame.active.getMinSize(),maxValue:q().frame.active.getMaxSize(),defaultValue:q().frame.active.currentSizeInPercent,getValueLabel:t,onChange:e=>{q().frame.resize(e)}})]})})}var wA=l.default.createContext(null);function TA(){let{tabsRef:e,selectedTab:t}=(0,l.useContext)(wA),[n,r]=(0,l.useState)({width:void 0,transform:void 0,className:void 0});return I_(()=>{if(t!=null&&e.current){let n=e.current[t];if(!n)return;r(e=>({width:`${n.offsetWidth}px`,transform:`translateX(${n.offsetLeft}px)`,className:e.width===void 0?``:`transition-all`}))}},[r,t,e]),(0,m.jsx)(`div`,{className:H(`absolute bottom-0 left-0 h-2 bg-primary`,n.className),role:`presentation`,style:{width:n.width,transform:n.transform}})}function EA({children:e,center:t,expand:n,className:r}){let i=l.Children.toArray(e);return(0,m.jsx)(qS,{children:(0,m.jsxs)(`div`,{className:H(`flex relative max-w-full overflow-auto border-b max-sm:hidden-scrollbar md:compact-scrollbar`,r),role:`tablist`,"aria-orientation":`horizontal`,children:[i.map((e,r)=>(0,l.isValidElement)(e)?(0,l.cloneElement)(e,{index:r,className:H(e.props.className,n&&`flex-auto`,t&&r===0&&`ml-auto`,t&&r===i.length-1&&`mr-auto`)}):null),(0,m.jsx)(TA,{})]})})}function DA(e){let{size:t=`md`,children:n,className:r,isLazy:i,overflow:a=`overflow-hidden`}=e,o=(0,l.useRef)([]),s=(0,l.useId)(),[c,u]=pv(e.selectedTab,e.defaultSelectedTab||0,e.onTabChange),d=(0,l.useMemo)(()=>({selectedTab:c,setSelectedTab:u,tabsRef:o,size:t,isLazy:i,id:s}),[c,s,i,u,t]);return(0,m.jsx)(wA.Provider,{value:d,children:(0,m.jsx)(`div`,{className:H(r,a,`max-w-full`),children:n})})}var OA=U((0,m.jsx)(`path`,{d:`M12 17c3.31 0 6-2.69 6-6V3h-2.5v8c0 1.93-1.57 3.5-3.5 3.5S8.5 12.93 8.5 11V3H6v8c0 3.31 2.69 6 6 6zm-7 2v2h14v-2H5z`}),`FormatUnderlinedOutlined`),kA=U((0,m.jsx)(`path`,{d:`M10 19h4v-3h-4v3zM5 4v3h5v3h4V7h5V4H5zM3 14h18v-2H3v2z`}),`FormatStrikethroughOutlined`),AA=U((0,m.jsx)(`path`,{d:`M10 4v3h2.21l-3.42 8H6v3h8v-3h-2.21l3.42-8H18V4h-8z`}),`FormatItalicOutlined`),jA=U((0,m.jsx)(`path`,{d:`M3 21h18v-2H3v2zm6-4h12v-2H9v2zm-6-4h18v-2H3v2zm6-4h12V7H9v2zM3 3v2h18V3H3z`}),`FormatAlignRightOutlined`),MA=U((0,m.jsx)(`path`,{d:`M15 15H3v2h12v-2zm0-8H3v2h12V7zM3 13h18v-2H3v2zm0 8h18v-2H3v2zM3 3v2h18V3H3z`}),`FormatAlignLeftOutlined`),NA=U((0,m.jsx)(`path`,{d:`M7 15v2h10v-2H7zm-4 6h18v-2H3v2zm0-8h18v-2H3v2zm4-6v2h10V7H7zM3 3v2h18V3H3z`}),`FormatAlignCenterOutlined`);function PA(){return(0,m.jsxs)(`div`,{className:`flex gap-20 justify-center`,children:[(0,m.jsx)(FA,{}),(0,m.jsx)(IA,{}),(0,m.jsx)(LA,{})]})}function FA(){let e=G(e=>e.objects.active.editableProps.fontSize)??40,{trans:t}=Kk();return(0,m.jsx)(Nw,{type:`number`,size:`xs`,"aria-label":t({message:`Font Size`}),min:1,max:300,className:`w-64 flex-shrink-0`,value:e,onChange:e=>{q().objects.setValues({fontSize:e.target.valueAsNumber}),K().setDirty(!0)}})}function IA(){let e=G(e=>e.objects.active.editableProps.fontStyle),t=G(e=>e.objects.active.editableProps.underline),n=G(e=>e.objects.active.editableProps.linethrough),[r,i]=(0,l.useState)([e,t&&`underline`,n&&`linethrough`]);return(0,m.jsxs)(Uw,{size:`xs`,variant:`outline`,radius:`rounded`,value:r,multiple:!0,onChange:e=>{i(e),q().objects.setValues({underline:e.includes(`underline`),linethrough:e.includes(`linethrough`),fontStyle:e.includes(`italic`)?`italic`:``}),K().setDirty(!0)},children:[(0,m.jsx)(Q,{value:`underline`,children:(0,m.jsx)(OA,{})}),(0,m.jsx)(Q,{value:`linethrough`,children:(0,m.jsx)(kA,{})}),(0,m.jsx)(Q,{value:`italic`,children:(0,m.jsx)(AA,{})})]})}function LA(){return(0,m.jsxs)(Uw,{size:`xs`,variant:`outline`,radius:`rounded`,value:G(e=>e.objects.active.editableProps.textAlign),onChange:e=>{q().objects.setValues({textAlign:e}),K().setDirty(!0)},children:[(0,m.jsx)(Q,{value:`left`,children:(0,m.jsx)(MA,{})}),(0,m.jsx)(Q,{value:`center`,children:(0,m.jsx)(NA,{})}),(0,m.jsx)(Q,{value:`right`,children:(0,m.jsx)(jA,{})})]})}function RA({children:e,className:t}){let{selectedTab:n,isLazy:r}=(0,l.useContext)(wA),i=l.Children.toArray(e).filter(e=>!!e),a;if(r){let e=i[n];a=(0,l.isValidElement)(e)?(0,l.cloneElement)(i[n],{index:n}):null}else a=i.map((e,t)=>{if((0,l.isValidElement)(e)){let r=t===n;return(0,l.cloneElement)(e,{index:t,"aria-hidden":!r,className:r?e.props.className:H(e.props.className,`hidden`)})}return null});return(0,m.jsx)(`div`,{className:t,children:a})}function zA({className:e,children:t,index:n,...r}){let{id:i}=(0,l.useContext)(wA),[a,o]=(0,l.useState)(0),s=(0,l.useRef)(null);return I_(()=>{if(s!=null&&s.current){let e=()=>{o(fC(s.current,{tabbable:!0}).nextNode()?void 0:0)};e();let t=new MutationObserver(e);return t.observe(s.current,{subtree:!0,childList:!0,attributes:!0,attributeFilter:[`tabIndex`,`disabled`]}),()=>{t.disconnect()}}},[s]),(0,m.jsx)(`div`,{tabIndex:a,ref:s,id:`${i}-${n}-tabpanel`,"aria-labelledby":`${i}-${n}-tab`,className:H(e,`focus-visible:outline-primary-light`),role:`tabpanel`,...r,children:t})}var BA=[{type:`linear`,coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{color:`#ffe47b`,offset:0},{color:`rgb(111,154,211)`,offset:1}]},{type:`linear`,coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{color:`#ff4040`,offset:0},{color:`#e6399b`,offset:1}]},{type:`linear`,coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:`rgb(166,111,213)`},{offset:.5,color:`rgba(106, 72, 215, 0.5)`},{offset:1,color:`#200772`}]},{type:`radial`,coords:{r1:100,r2:10,x1:0,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:`#FF4F4F`},{offset:1,color:`rgb(255, 239, 64)`}]},{type:`radial`,coords:{r1:100,r2:10,x1:0,y1:0,x2:20,y2:20},colorStops:[{offset:0,color:`#ffe47b`},{offset:.5,color:`rgb(111,154,211)`},{offset:1,color:`rgb(166,111,213)`}]},{type:`radial`,coords:{r1:50,r2:80,x1:45,y1:45,x2:52,y2:50},colorStops:[{offset:0,color:`rgb(155, 237, 0)`},{offset:1,color:`rgba(0, 164, 128,0.4)`}]},{type:`linear`,coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:`#9ecb2d`},{offset:.5,color:`#72aa00`},{offset:1,color:`#bfd255`}]},{type:`radial`,coords:{r1:100,r2:50,x1:30,y1:0,x2:0,y2:0},colorStops:[{offset:0,color:`#aebcbf`},{offset:1,color:`#0a0809`}]},{type:`linear`,coords:{x1:-80,y1:0,x2:80,y2:0},colorStops:[{offset:0,color:`#ffffff`},{offset:1,color:`#f6f6f6`}]},{type:`linear`,coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:`#fefcea`},{offset:1,color:`#f1da36`}]},{type:`linear`,coords:{x1:-90,y1:-90,x2:90,y2:90},colorStops:[{offset:0,color:`rgb(166,111,213)`},{offset:.5,color:`rgba(106, 72, 215, 0.5)`},{offset:1,color:`#ff1a00`}]},{type:`linear`,coords:{x1:0,y1:-120,x2:0,y2:120},colorStops:[{offset:0,color:`#b7deed`},{offset:1,color:`#21b4e2`}]},{type:`linear`,coords:{x1:-80,y1:100,x2:80,y2:-100},colorStops:[{offset:0,color:`#ffe47b`},{offset:1,color:`rgb(111,154,211)`}]}],VA=U((0,m.jsx)(`path`,{d:`M19.51 3.08 3.08 19.51c.09.34.27.65.51.9.25.24.56.42.9.51L20.93 4.49c-.19-.69-.73-1.23-1.42-1.41zM11.88 3 3 11.88v2.83L14.71 3h-2.83zM5 3c-1.1 0-2 .9-2 2v2l4-4H5zm14 18c.55 0 1.05-.22 1.41-.59.37-.36.59-.86.59-1.41v-2l-4 4h2zm-9.71 0h2.83L21 12.12V9.29L9.29 21z`}),`TextureOutlined`),HA=U((0,m.jsx)(`path`,{d:`M11 9h2v2h-2V9zm-2 2h2v2H9v-2zm4 0h2v2h-2v-2zm2-2h2v2h-2V9zM7 9h2v2H7V9zm12-6H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 18H7v-2h2v2zm4 0h-2v-2h2v2zm4 0h-2v-2h2v2zm2-7h-2v2h2v2h-2v-2h-2v2h-2v-2h-2v2H9v-2H7v2H5v-2h2v-2H5V5h14v6z`}),`GradientOutlined`),UA=U((0,m.jsx)(`path`,{d:`M18 20H4V6h9V4H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-9h-2v9zm-7.79-3.17-1.96-2.36L5.5 18h11l-3.54-4.71zM20 4V1h-2v3h-3c.01.01 0 2 0 2h3v2.99c.01.01 2 0 2 0V6h3V4h-3z`}),`AddPhotoAlternateOutlined`);function WA({property:e}){let{trans:t}=Kk(),n=G(t=>t.objects.active.editableProps[e]);return(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-14`,children:[(0,m.jsx)(rA,{className:`flex-shrink-0`,size:`xs`,"aria-label":t({message:`Color`}),value:typeof n==`string`?n:Go.fill,onChange:t=>{q().objects.setValues({[e]:t}),K().setDirty(!0)}}),(0,m.jsx)(GA,{type:`gradient`,property:e}),(0,m.jsx)(GA,{type:`texture`,property:e})]})}function GA({type:e,property:t}){let n=e===`texture`?(0,m.jsx)(VA,{}):(0,m.jsx)(HA,{});return(0,m.jsx)(l.Fragment,{children:(0,m.jsxs)(tA,{type:`popover`,children:[(0,m.jsx)(_b,{className:`flex-shrink-0`,id:`${e}-panel-trigger`,variant:`outline`,size:`xs`,startIcon:n,endIcon:(0,m.jsx)(Zk,{}),children:(0,m.jsx)(`span`,{className:`capitalize`,children:e===`gradient`?(0,m.jsx)(Z,{message:`Gradient`}):(0,m.jsx)(Z,{message:`Texture`})})}),(0,m.jsx)(Yk,{size:`auto`,children:(0,m.jsx)(`div`,{className:`grid gap-8 grid-cols-5-min-content p-10 bg-paper rounded shadow-md`,children:(0,m.jsx)(KA,{property:t,type:e})})})]})})}function KA({type:e,property:t}){let{close:n}=Gk(),r=Array.from(Array(e===`gradient`?BA.length:28).keys()),i=`w-56 h-56 bg border shadow-sm hover:scale-110`,a=r.map(r=>{let a=Bv(`images/${e}s/${r}.png`);return(0,m.jsx)(gb,{radius:`rounded`,className:i,style:{backgroundImage:`url(${a})`},"aria-label":`Select ${e} #${r}`,onClick:async()=>{n();let i=e===`gradient`?new X.fabric.Gradient(BA[r]):await JA(a);q().objects.setValues({[t]:i}),K().setDirty(!0)}},r)});return e===`texture`&&a.unshift((0,m.jsx)(qA,{property:t,className:i},`upload-btn`)),(0,m.jsx)(l.Fragment,{children:a})}function qA({className:e,property:t}){let{close:n}=Gk();return(0,m.jsx)(gb,{radius:`rounded`,className:e,"aria-label":`Upload an image`,onClick:async()=>{let e=await q().import.openUploadWindow();if(n(),e){let n=await JA(await e.data);q().objects.setValues({[t]:n})}},children:(0,m.jsx)(UA,{className:`icon-md`})})}function JA(e){return new Promise(t=>{X.fabric.util.loadImage(e,e=>{t(new X.fabric.Pattern({source:e,repeat:`repeat`}))})})}function YA(){let e=G(e=>e.objects.active.editableProps.opacity);return(0,m.jsx)(hA,{className:`max-w-240 w-full mx-auto`,"aria-label":`Opacity`,value:e,minValue:.1,step:.1,maxValue:1,onChange:e=>{q().objects.setValues({opacity:e}),K().setDirty(!0)}})}function XA(){let{trans:e}=Kk(),t=G(e=>e.objects.active.editableProps.stroke),n=G(e=>e.objects.active.editableProps.strokeWidth);return(0,m.jsxs)(`div`,{className:`flex items-center gap-40`,children:[(0,m.jsx)(rA,{className:`ml-auto flex-shrink-0`,size:`xs`,value:t,"aria-label":e({message:`Outline Color`}),onChange:e=>{q().objects.setValues({stroke:e}),K().setDirty(!0)}}),(0,m.jsx)(hA,{"aria-label":`Outline Width`,className:`max-w-240 mr-auto flex-shrink-0`,value:n,onChange:e=>{q().objects.setValues({strokeWidth:e}),K().setDirty(!0)}})]})}var ZA=U((0,m.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-4.86 8.86-3 3.87L9 13.14 6 17h12l-3.86-5.14z`}),`ImageOutlined`);function QA(){return(0,m.jsx)(`div`,{className:`flex justify-center`,children:(0,m.jsx)(_b,{type:`button`,variant:`outline`,size:`xs`,startIcon:(0,m.jsx)(ZA,{}),radius:`rounded-full`,onClick:async()=>{let e=await q().import.openUploadWindow();if(e){let t=q().objects.getActive();if(t&&`setSrc`in t){let n=await e.data;t.setSrc(n,()=>{Av({src:n}),q().canvas.render()})}}},children:(0,m.jsx)(Z,{message:`Replace Image`})})})}var $A={color:`rgba(0, 0, 0, 0.6)`,blur:3,offsetX:-1,offsetY:0};function ej(){let{trans:e}=Kk(),t=G(e=>e.objects.active.editableProps.shadow)||$A;return(0,m.jsxs)(`div`,{className:`flex items-center gap-40`,children:[(0,m.jsx)(rA,{className:`ml-auto flex-shrink-0`,value:t.color,size:`xs`,"aria-label":e({message:`Shadow Color`}),onChange:e=>{q().objects.setValues({shadow:tj({color:e})}),K().setDirty(!0)}}),(0,m.jsx)(hA,{"aria-label":`Shadow Blur`,className:`max-w-240 mr-auto flex-shrink-0`,defaultValue:t.blur,onChange:e=>{q().objects.setValues({shadow:tj({blur:e})}),K().setDirty(!0)}})]})}function tj(e){let t=q().objects.getActive()?.shadow;return t?(Object.entries(e).forEach(([e,n])=>{t[e]=n}),t):new X.fabric.Shadow({...$A,...e})}function nj({index:e,className:t,isDisabled:n,children:r,padding:i,elementType:a=`button`,to:o,relative:s,width:c=`min-w-min`}){let{selectedTab:u,setSelectedTab:d,tabsRef:f,size:p=`md`,id:h}=(0,l.useContext)(wA),g=e===u,_=JS(),v=i||(p===`sm`?`px-12`:`px-18`),y=H(`tracking-wide overflow-hidden capitalize text-sm flex items-center justify-center outline-none transition-colors`,`focus-visible:ring focus-visible:ring-2 ring-inset rounded whitespace-nowrap cursor-pointer`,c,rj({isDisabled:n,isSelected:g}),t,p===`md`&&`${v} h-48`,p===`sm`&&`${v} h-32`,n&&`pointer-events-none`),b=e=>{switch(e.key){case`ArrowLeft`:_?.focusPrevious();break;case`ArrowRight`:_?.focusNext();break;case`Home`:_?.focusFirst();break;case`End`:_?.focusLast();break}},x=g?0:-1;return(0,m.jsx)(a,{disabled:n,id:`${h}-${e}-tab`,"aria-controls":`${h}-${e}-tabpanel`,type:`button`,role:`tab`,"aria-selected":g,tabIndex:n?void 0:x,onKeyDown:b,onClick:()=>{d(e)},to:o,relative:s,className:y,ref:t=>{f.current&&t&&(f.current[e]=t)},children:r})}function rj({isDisabled:e,isSelected:t}){return e?`text-disabled cursor-default`:t?`text-primary`:`text-muted hover:text-main`}function ij(){let e=G(e=>e.objects.active);return(0,m.jsxs)(DA,{size:`sm`,className:`pb-18 pt-6`,children:[(0,m.jsxs)(EA,{center:!0,children:[e.isText&&(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Font`})}),!e.isImage&&(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Color`})}),!e.isImage&&(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Background`})}),e.isImage&&(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Image`})}),(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Opacity`})}),(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Outline`})}),(0,m.jsx)(nj,{children:(0,m.jsx)(Z,{message:`Shadow`})})]}),(0,m.jsxs)(RA,{className:`pt-16 h-50`,children:[e.isText&&(0,m.jsx)(zA,{children:(0,m.jsx)(PA,{})},`font`),!e.isImage&&(0,m.jsx)(zA,{children:(0,m.jsx)(WA,{property:`fill`})}),!e.isImage&&(0,m.jsx)(zA,{children:(0,m.jsx)(WA,{property:`backgroundColor`})}),e.isImage&&(0,m.jsx)(zA,{children:(0,m.jsx)(QA,{})}),(0,m.jsx)(zA,{children:(0,m.jsx)(YA,{})}),(0,m.jsx)(zA,{children:(0,m.jsx)(XA,{})}),(0,m.jsx)(zA,{children:(0,m.jsx)(ej,{})})]})]})}function aj(){return(0,m.jsx)(LD,{actionBtn:!zC()&&(0,m.jsx)(_b,{size:`sm`,color:`primary`,variant:`outline`,onClick:()=>{q().text.add(),K().setDirty(!0)},children:(0,m.jsx)(Z,{message:`New Text`})}),children:(0,m.jsx)(ij,{})})}var oj=U((0,m.jsx)(`path`,{d:`m20 12-1.41-1.41L13 16.17V4h-2v12.17l-5.58-5.59L4 12l8 8 8-8z`}),`ArrowDownwardOutlined`),sj=500,cj={},lj=!1,uj=null,dj=null,fj=e=>{var t;for(let n in cj)n!==e&&((t=cj[n])==null||t.call(cj,!0),delete cj[n])},pj=(0,l.forwardRef)(({children:e,label:t,placement:n=`top`,offset:r=10,variant:i=`neutral`,delay:a=1500,isDisabled:o,usePortal:s=!0,...c},d)=>{let{x:f,y:p,reference:h,strategy:g,arrowRef:_,arrowStyle:v,refs:y}=yS({placement:n,offset:r,ref:d,showArrow:!0}),[b,x]=(0,l.useState)(!1),S=(0,l.useId)(),C=(0,l.useRef)(),w=()=>{clearTimeout(C.current),C.current=void 0,fj(S),cj[S]=T,lj=!0,x(!0),uj&&=(clearTimeout(uj),null),dj&&=(clearTimeout(dj),null)},T=(0,l.useCallback)(e=>{e?(clearTimeout(C.current),C.current=void 0,x(!1)):C.current||=setTimeout(()=>{C.current=void 0,x(!1)},sj),uj&&=(clearTimeout(uj),null),lj&&(dj&&clearTimeout(dj),dj=setTimeout(()=>{delete cj[S],dj=null,lj=!1},sj))},[S]),E=()=>{fj(S),cj[S]=T,!b&&!uj&&!lj?uj=setTimeout(()=>{uj=null,lj=!0,w()},a):b||w()},D=e=>{!e&&a>0&&!C.current?E():w()};(0,l.useEffect)(()=>()=>{clearTimeout(C.current),cj[S]&&delete cj[S]},[S]),(0,l.useEffect)(()=>{let e=e=>{e.key===`Escape`&&T(!0)};if(b)return document.addEventListener(`keydown`,e,!0),()=>{document.removeEventListener(`keydown`,e,!0)}},[b,T]);let O=(0,m.jsx)(M_,{children:b&&(0,m.jsxs)(x_.div,{..._C,ref:y.setFloating,id:S,role:`tooltip`,onPointerEnter:()=>{D(!0)},onPointerLeave:()=>{T()},className:H(`z-tooltip my-4 max-w-240 break-words rounded px-8 py-4 text-xs text-white shadow`,i===`positive`&&`bg-positive`,i===`danger`&&`bg-danger`,i===`neutral`&&`bg-toast`),style:{position:g,top:p??``,left:f??``},children:[(0,m.jsx)(`div`,{ref:_,className:`absolute h-8 w-8 rotate-45 bg-inherit`,style:v}),t]})});return(0,m.jsxs)(l.Fragment,{children:[(0,l.cloneElement)(e,q_({"aria-describedby":b?S:void 0,ref:h,onPointerEnter:e=>{e.pointerType===`mouse`&&D()},onFocus:e=>{e.target.matches(`:focus-visible`)&&D(!0)},onPointerLeave:e=>{e.pointerType===`mouse`&&T()},onPointerDown:()=>{T(!0)},onBlur:()=>{T()},"aria-label":typeof t==`string`?t:t.props.message},c)),s?Fu&&(0,u.createPortal)(O,Fu):O]})});function mj(){let e=hj(G(e=>e.activeToolOverlay),G(e=>e.objects.active.id)),[t,n]=(0,l.useState)(!0);return(0,m.jsxs)(`div`,{className:`relative z-tool-overlay text-sm`,children:[e&&(0,m.jsx)(`div`,{className:H(`absolute right-16 text-muted z-50 transition-all`,!t&&`rotate-180`,t?`-top-144`:`-top-40`),children:(0,m.jsx)(pj,{label:t?(0,m.jsx)(Z,{message:`Hide options`}):(0,m.jsx)(Z,{message:`Show options`}),children:(0,m.jsx)(Q,{variant:`outline`,radius:`rounded-lg`,size:`xs`,onClick:()=>{n(!t)},children:(0,m.jsx)(oj,{})})})}),(0,m.jsx)(M_,{children:e&&t&&(0,m.jsx)(x_.div,{initial:{y:0,opacity:0},animate:{y:`-100%`,opacity:1},exit:{y:0,opacity:0},transition:{type:`tween`,duration:.15},className:`absolute inset-x-0 gap-16 px-5vw bg bg-opacity-95 border-t`,children:e},`tool-controls-overlay`)})]})}function hj(e,t){switch(e){case bl.Filter:return(0,m.jsx)(SA,{});case bl.Frame:return(0,m.jsx)(CA,{});case bl.Text:return t&&(0,m.jsx)(aj,{});case bl.ActiveObject:return t&&(0,m.jsx)(ij,{});default:return null}}var gj=U((0,m.jsx)(`path`,{d:`M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm3.59-13L12 10.59 8.41 7 7 8.41 10.59 12 7 15.59 8.41 17 12 13.41 15.59 17 17 15.59 13.41 12 17 8.41z`}),`CancelOutlined`);function _j({filter:e}){let t=G(t=>t.filter.applied.includes(e)),n=q().filter.hasOptions(e),r=H(`block flex-shrink-0 rounded`,{"text-primary border-primary":t}),i=Xv[e],a=(0,m.jsxs)(l.Fragment,{children:[(0,m.jsxs)(`div`,{className:`relative`,children:[(0,m.jsx)(vj,{filter:e}),t&&(0,m.jsx)(yj,{filter:e,hasOptions:n})]}),(0,m.jsx)(`div`,{className:`mt-4 text-center text-xs capitalize`,children:i?(0,m.jsx)(Z,{...i}):e})]});return t&&n?(0,m.jsx)(`div`,{className:r,children:a}):(0,m.jsx)(gb,{className:r,onClick:()=>{t?q().filter.remove(e):q().filter.apply(e)},children:a})}function vj({filter:e}){let t=H(`m-auto w-96 h-56 border rounded object-cover`,{shadow:G(t=>t.filter.selected===e)});return(0,m.jsx)(`img`,{src:Bv(`images/filter/${e}.jpg`),className:t,alt:``})}function yj({filter:e,hasOptions:t}){return(0,m.jsxs)(`div`,{className:`flex items-center justify-center bg-background/70 absolute inset-0 border-2 border-primary rounded`,children:[t?(0,m.jsx)(Q,{color:`primary`,size:`md`,onClick:()=>{q().filter.remove(e)},children:(0,m.jsx)(gj,{})}):(0,m.jsx)(gj,{className:`svg-icon icon-md`}),t&&(0,m.jsx)(bj,{filter:e,hasOptions:t})]})}function bj({filter:e,hasOptions:t}){return(0,m.jsx)(Q,{color:`primary`,size:`md`,onClick:()=>{K().activeToolOverlay===bl.Filter&&K().filter.selected===e?K().setActiveTool(K().activeTool,null):K().filter.select(e,t)},children:(0,m.jsx)(ts,{})})}var xj=(0,l.forwardRef)(({children:e,className:t,gap:n=`gap-10`},r)=>{let i=l.default.Children.map(e,(t,n)=>l.default.isValidElement(t)?l.default.cloneElement(t,{isFirst:n===0,isLast:l.default.Children.count(e)===n+1}):t);return(0,m.jsx)(`div`,{ref:r,className:H(`tiny-scrollbar pb-4 overflow-x-auto relative flex items-center`,n,t),children:i})});function Sj({isFirst:e,isLast:t,children:n,className:r}){return(0,m.jsx)(`div`,{className:H(r,`flex-shrink-0`,{"ml-auto":e,"mr-auto":t}),children:n})}function Cj(){let e=G(e=>e.config.tools?.filter?.items)||[];return(0,l.useEffect)(()=>{q().filter.syncState()},[]),(0,m.jsx)(xj,{children:e.map(e=>(0,m.jsx)(Sj,{children:(0,m.jsx)(_j,{filter:e})},e))})}var wj=U((0,m.jsx)(`path`,{d:`M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zM9 6c0-1.66 1.34-3 3-3s3 1.34 3 3v2H9V6zm9 14H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z`}),`LockOutlined`),Tj=U((0,m.jsx)(`path`,{d:`M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h2c0-1.66 1.34-3 3-3s3 1.34 3 3v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z`}),`LockOpenOutlined`),Ej=U((0,m.jsx)(`path`,{d:`M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z`}),`CheckBoxOutlineBlankOutlined`),Dj=U((0,m.jsx)(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z`}),`CheckBox`),Oj=U((0,m.jsx)(`path`,{d:`M19,3H5C3.9,3,3,3.9,3,5v14c0,1.1,0.9,2,2,2h14c1.1,0,2-0.9,2-2V5C21,3.9,20.1,3,19,3z M17,13H7v-2h10V13z`}),`CheckBox`),kj=(0,l.forwardRef)((e,t)=>{let{size:n=`md`,children:r,className:i,icon:a,checkedIcon:o,disabled:s,isIndeterminate:c,errorMessage:u,invalid:d,orientation:f=`horizontal`,onChange:p,autoFocus:h,required:g,value:_,name:v,inputTestId:y}=e,b=bw({...e,label:r}),x=a||Ej,S=o||(c?Oj:Dj),C=cv(t);jw({autoFocus:h},C),(0,l.useEffect)(()=>{C.current&&(C.current.indeterminate=c||!1)});let[w,T]=pv(e.checked,e.defaultChecked||!1),E=(0,l.useCallback)(e=>{p?.(e),T(e.target.checked)},[p,T]),D=H(`select-none`,i,d&&`text-danger`,!d&&s&&`text-disabled`),O,k=d?`text-danger`:null;return c?(O=Oj,k||=`text-primary`):w?(O=S,k||=`text-primary`):(O=x,k||=`text-muted`),(0,m.jsxs)(`div`,{children:[(0,m.jsx)(`label`,{className:D,children:(0,m.jsxs)(`div`,{className:H(`relative flex items-center`,f===`vertical`&&`flex-col flex-col-reverse`),children:[(0,m.jsx)(`input`,{className:`absolute left-0 top-0 h-24 w-24 appearance-none overflow-hidden rounded outline-none ring-inset transition-shadow focus-visible:ring`,type:`checkbox`,"aria-checked":c?`mixed`:w,"aria-invalid":d||void 0,onChange:E,ref:C,required:g,disabled:s,value:_,name:v,"data-testid":y}),(0,m.jsx)(O,{size:n,className:H(`pointer-events-none`,s?`text-disabled`:k)}),r&&(0,m.jsx)(`div`,{className:H(`first-letter:capitalize`,b.size.font,f===`vertical`?`mb-6`:`ml-6`),children:r})]})}),u&&(0,m.jsx)(`div`,{className:b.error,children:u})]})});function Aj(){let{trans:e}=Kk(),{minWidth:t=50,minHeight:n=50,maxHeight:r=2400,maxWidth:i=2400}=G(e=>e.config.tools?.resize)||{},a=G(e=>e.original),o=G(e=>e.resize.formValue);(0,l.useEffect)(()=>{K().resize.setFormValue({...a})},[a]),(0,l.useEffect)(()=>{K().setDirty(!0)},[]);let s=e=>{let t={...o,width:e};o.maintainAspect&&(t.height=oy(e,o.usePercentages)),K().resize.setFormValue(t)},c=e=>{let t={...o,height:e};e&&o.maintainAspect&&(t.width=ay(e,o.usePercentages)),K().resize.setFormValue(t)},u=e=>{let t={...o,maintainAspect:e};e&&(t.height=oy(t.width,t.usePercentages)),K().resize.setFormValue(t)};return(0,m.jsxs)(`form`,{className:`flex items-center justify-center gap-16 w-full`,onSubmit:e=>{e.preventDefault(),K().applyChanges()},children:[(0,m.jsx)(Nw,{type:`number`,min:t,max:i,size:`sm`,className:`w-full max-w-112`,label:(0,m.jsx)(Z,{message:`Width`}),value:o.width,onChange:e=>{s(e.target.valueAsNumber)}}),(0,m.jsx)(`div`,{className:`mt-24`,children:(0,m.jsx)(kj,{size:`md`,checked:o.maintainAspect,onChange:e=>{u(!o.maintainAspect)},"aria-label":e({message:`Maintain aspect ratio`}),checkedIcon:wj,icon:Tj})}),(0,m.jsx)(Nw,{type:`number`,min:n,max:r,size:`sm`,className:`w-full max-w-112`,label:(0,m.jsx)(Z,{message:`Height`}),value:o.height,onChange:e=>{c(e.target.valueAsNumber)}}),(0,m.jsx)(`button`,{type:`submit`,className:`hidden`,children:(0,m.jsx)(Z,{message:`Resize`})})]})}function jj(){let e=G(e=>e.config.tools?.crop?.presets)||[],t=G(e=>e.crop.selectedAspectRatio),n=G(e=>e.config.tools?.crop?.allowCustomRatio)??!0;return(0,m.jsx)(xj,{gap:`gap-18`,children:e.filter(e=>e.ratio||!e.ratio&&n).map(e=>(0,m.jsx)(Sj,{children:(0,m.jsxs)(gb,{onClick:()=>q().crop.resetCropzone(e.ratio),className:`flex flex-col items-center justify-between cursor-pointer h-56`,children:[(0,m.jsx)(Mj,{preset:e,selectedRatio:t}),(0,m.jsx)(Nj,{preset:e,selectedRatio:t})]})},e.ratio||e.name))})}function Mj({preset:e,selectedRatio:t}){let n=40,r=30;if(e.ratio){let t=py(e.ratio);({width:n,height:r}=fy(t,n,r))}let i=H(`border-2`,{"border-dotted":e.ratio===null,"border-primary":t===e.ratio});return(0,m.jsx)(`div`,{style:{width:`${n}px`,height:`${r}px`},className:i})}function Nj({preset:e,selectedRatio:t}){return(0,m.jsx)(`div`,{className:H(`mt-4 text-center text-xs`,{"text-primary":t===e.ratio}),children:e.name?(0,m.jsx)(Z,{message:e.name}):e.ratio})}var Pj=U((0,m.jsx)(`path`,{d:`M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z`}),`FlipOutlined`);function Fj(){return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(Q,{size:`sm`,onClick:()=>{q().transform.flip(`vertical`),K().setDirty(!0)},children:(0,m.jsx)(Pj,{})}),(0,m.jsx)(Q,{size:`sm`,onClick:()=>{q().transform.flip(`horizontal`),K().setDirty(!0)},children:(0,m.jsx)(Pj,{className:`rotate-90`})})]})}var Ij=U((0,m.jsx)(`path`,{d:`M7.11 8.53 5.7 7.11C4.8 8.27 4.24 9.61 4.07 11h2.02c.14-.87.49-1.72 1.02-2.47zM6.09 13H4.07c.17 1.39.72 2.73 1.62 3.89l1.41-1.42c-.52-.75-.87-1.59-1.01-2.47zm1.01 5.32c1.16.9 2.51 1.44 3.9 1.61V17.9c-.87-.15-1.71-.49-2.46-1.03L7.1 18.32zM13 4.07V1L8.45 5.55 13 10V6.09c2.84.48 5 2.94 5 5.91s-2.16 5.43-5 5.91v2.02c3.95-.49 7-3.85 7-7.93s-3.05-7.44-7-7.93z`}),`RotateLeftOutlined`),Lj=U((0,m.jsx)(`path`,{d:`M15.55 5.55 11 1v3.07C7.06 4.56 4 7.92 4 12s3.05 7.44 7 7.93v-2.02c-2.84-.48-5-2.94-5-5.91s2.16-5.43 5-5.91V10l4.55-4.45zM19.93 11c-.17-1.39-.72-2.73-1.62-3.89l-1.42 1.42c.54.75.88 1.6 1.02 2.47h2.02zM13 17.9v2.02c1.39-.17 2.74-.71 3.9-1.61l-1.44-1.44c-.75.54-1.59.89-2.46 1.03zm3.89-2.42 1.42 1.41c.9-1.16 1.45-2.5 1.62-3.89h-2.02c-.14.87-.48 1.72-1.02 2.48z`}),`RotateRightOutlined`);function Rj(){return(0,m.jsxs)(`div`,{children:[(0,m.jsx)(Q,{size:`sm`,onClick:()=>{q().transform.rotateLeft(),K().setDirty(!0)},children:(0,m.jsx)(Ij,{})}),(0,m.jsx)(Q,{size:`sm`,onClick:()=>{q().transform.rotateRight(),K().setDirty(!0)},children:(0,m.jsx)(Lj,{})})]})}function zj(){return(0,m.jsxs)(`div`,{className:`flex items-center justify-center gap-16`,children:[(0,m.jsx)(Fj,{}),(0,m.jsx)(Bj,{}),(0,m.jsx)(Rj,{})]})}function Bj(){let e=(0,l.useRef)(null),{domProps:t,groupId:n,thumbIds:r,trackRef:i,getThumbValueLabel:a}=dA({minValue:-45,maxValue:45,step:1,defaultValue:[K().crop.straightenAngle],onChange:t=>{let n=t[0];q().transform.straighten(n),K().crop.setTransformAngle(n),K().setDirty(!0),e.current.style.transform=`translateX(${n}px)`}});return(0,m.jsx)(`div`,{id:n,role:`group`,className:`flex-auto flex-shrink-0 max-w-320 touch-none isolate`,children:(0,m.jsxs)(`div`,{...t,ref:i,className:`h-36 relative`,children:[(0,m.jsxs)(`output`,{htmlFor:r[0],"aria-live":`off`,className:`absolute left-1/2 top-1/2 w-40 text-center bg -translate-x-1/2 -translate-y-1/2 z-10`,children:[a(0),`°`]}),(0,m.jsx)(Vj,{ref:e})]})})}var Vj=l.default.forwardRef((e,t)=>{let n=[...Array(80).keys()],r=n.map(e=>(0,m.jsx)(`circle`,{cx:2+e*10,cy:`20`,r:e%5?.75:2},e));return(0,m.jsx)(`div`,{className:`relative h-full cursor-pointer overflow-hidden`,children:(0,m.jsx)(`svg`,{ref:t,style:{width:n.length*10},className:`absolute -left-80 h-full fill-current`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,focusable:`false`,children:r})})});function Hj(){return(0,l.useEffect)(()=>(K().setDirty(!0),q().frame.active.hide(),()=>{q().frame.active.show()}),[]),(0,m.jsxs)(`div`,{className:`pb-16`,children:[(0,m.jsx)(`div`,{className:`mb-10`,children:(0,m.jsx)(zj,{})}),(0,m.jsx)(jj,{})]})}var Uj=U((0,m.jsx)(`path`,{d:`M 16 6 C 12.484375 6 9.273438 7.070313 6.90625 8.84375 C 4.539063 10.617188 3 13.15625 3 16 C 3 18.84375 4.539063 21.382813 6.90625 23.15625 C 9.273438 24.929688 12.484375 26 16 26 C 19.515625 26 22.726563 24.929688 25.09375 23.15625 C 27.460938 21.382813 29 18.84375 29 16 C 29 13.15625 27.460938 10.617188 25.09375 8.84375 C 22.726563 7.070313 19.515625 6 16 6 Z M 16 8 C 19.109375 8 21.898438 8.957031 23.875 10.4375 C 25.851563 11.917969 27 13.875 27 16 C 27 18.125 25.851563 20.082031 23.875 21.5625 C 21.898438 23.042969 19.109375 24 16 24 C 12.890625 24 10.101563 23.042969 8.125 21.5625 C 6.148438 20.082031 5 18.125 5 16 C 5 13.875 6.148438 11.917969 8.125 10.4375 C 10.101563 8.957031 12.890625 8 16 8 Z `})),Wj=U((0,m.jsx)(`path`,{d:`M 16 4 C 9.382813 4 4 9.382813 4 16 C 4 22.617188 9.382813 28 16 28 C 22.617188 28 28 22.617188 28 16 C 28 9.382813 22.617188 4 16 4 Z M 16 6 C 21.535156 6 26 10.464844 26 16 C 26 21.535156 21.535156 26 16 26 C 10.464844 26 6 21.535156 6 16 C 6 10.464844 10.464844 6 16 6 Z `})),Gj=U((0,m.jsx)(`path`,{d:`M 3 6 L 3 26 L 29 26 L 29 6 Z M 5 8 L 27 8 L 27 24 L 5 24 Z `})),Kj=U((0,m.jsx)(`path`,{d:`M 16 4.90625 L 15.125 6.40625 L 4.71875 24.5 L 3.875 26 L 28.125 26 L 27.28125 24.5 L 16.875 6.40625 Z M 16 8.9375 L 24.65625 24 L 7.34375 24 Z `}));function qj(){return(0,m.jsx)(xj,{children:(G(e=>e.config.tools?.shapes?.items)||[]).map(e=>(0,m.jsx)(Sj,{children:(0,m.jsx)(Q,{variant:`outline`,radius:`rounded-2xl`,size:`xl`,onClick:()=>{q().shape.addBasicShape(e.name),K().setDirty(!0)},children:(0,m.jsx)(Jj,{shape:e})})},e.name))})}function Jj({shape:e}){return e.type===`Path`?(0,m.jsx)(`svg`,{className:`m-auto w-36 h-36`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 -100 512 700`,children:(0,m.jsx)(`path`,{className:`fill-transparent stroke-current`,d:e.options?.path,strokeWidth:25})}):l.default.cloneElement(Yj[e.name],{className:`w-30 h-30`})}var Yj={circle:(0,m.jsx)(Wj,{viewBox:`0 0 32 32`}),square:(0,m.jsx)(Gj,{viewBox:`0 0 32 32`}),triangle:(0,m.jsx)(Kj,{viewBox:`0 0 32 32`}),ellipse:(0,m.jsx)(Uj,{viewBox:`0 0 32 32`})};function Xj(e,t,n){let r=n.initialDeps??[],i;return()=>{var a,o,s,c;let l;n.key&&(a=n.debug)!=null&&a.call(n)&&(l=Date.now());let u=e();if(!(u.length!==r.length||u.some((e,t)=>r[t]!==e)))return i;r=u;let d;if(n.key&&(o=n.debug)!=null&&o.call(n)&&(d=Date.now()),i=t(...u),n.key&&(s=n.debug)!=null&&s.call(n)){let e=Math.round((Date.now()-l)*100)/100,t=Math.round((Date.now()-d)*100)/100,r=t/16,i=(e,t)=>{for(e=String(e);e.length<t;)e=` `+e;return e};`${i(t,5)}${i(e,5)}`,`${Math.max(0,Math.min(120-120*r,120))}`,n?.key}return(c=n?.onChange)==null||c.call(n,i),i}}function Zj(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var Qj=(e,t)=>Math.abs(e-t)<1,$j=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},eM=e=>e,tM=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let e=t;e<=n;e++)r.push(e);return r},nM=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(e=>{let t=e[0];if(t!=null&&t.borderBoxSize){let e=t.borderBoxSize[0];if(e){i({width:e.inlineSize,height:e.blockSize});return}}i(n.getBoundingClientRect())});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},rM={passive:!0},iM=typeof window>`u`?!0:`onscrollend`in window,aM=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=0,a=iM?()=>{}:$j(r,()=>{t(i,!1)},e.options.isScrollingResetDelay),o=r=>()=>{i=n[e.options.horizontal?`scrollLeft`:`scrollTop`],a(),t(i,r)},s=o(!0),c=o(!1);return c(),n.addEventListener(`scroll`,s,rM),n.addEventListener(`scrollend`,c,rM),()=>{n.removeEventListener(`scroll`,s),n.removeEventListener(`scrollend`,c)}},oM=(e,t,n)=>{if(t!=null&&t.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?`width`:`height`])},sM=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;let o=e+t;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:o,behavior:n})},cM=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollDirection=null,this.scrollAdjustments=0,this.measureElementCache=new Map,this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{this._measureElement(e.target,e)})}));return{disconnect:()=>t()?.disconnect(),observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{Object.entries(e).forEach(([t,n])=>{typeof n>`u`&&delete e[t]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:eM,rangeExtractor:tM,onChange:()=>{},measureElement:oM,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,...e}},this.notify=(e,t)=>{var n,r;let{startIndex:i,endIndex:a}=this.range??{startIndex:void 0,endIndex:void 0},o=this.calculateRange();(e||i!==o?.startIndex||a!==o?.endIndex)&&((r=(n=this.options).onChange)==null||r.call(n,this,t))},this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.scrollElement=null},this._didMount=()=>(this.measureElementCache.forEach(this.observer.observe),()=>{this.observer.disconnect(),this.cleanup()}),this._willUpdate=()=>{let e=this.options.getScrollElement();this.scrollElement!==e&&(this.cleanup(),this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this._scrollToOffset(this.scrollOffset,{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.notify(!1,!1)})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{this.scrollAdjustments=0,this.scrollDirection=t?this.scrollOffset<e?`forward`:`backward`:null,this.scrollOffset=e;let n=this.isScrolling;this.isScrolling=t,this.notify(n!==t,t)})))},this.getSize=()=>this.scrollRect[this.options.horizontal?`width`:`height`],this.getMeasurementOptions=Xj(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey],(e,t,n,r)=>(this.pendingMeasuredCacheIndexes=[],{count:e,paddingStart:t,scrollMargin:n,getItemKey:r}),{key:!1}),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurements=Xj(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r},i)=>{let a=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];let o=this.measurementsCache.slice(0,a);for(let s=a;s<e;s++){let e=r(s),a=this.options.lanes===1?o[s-1]:this.getFurthestMeasurement(o,s),c=a?a.end+this.options.gap:t+n,l=i.get(e),u=typeof l==`number`?l:this.options.estimateSize(s),d=c+u,f=a?a.lane:s%this.options.lanes;o[s]={index:s,start:c,size:u,end:d,key:e,lane:f}}return this.measurementsCache=o,o},{key:!1,debug:()=>this.options.debug}),this.calculateRange=Xj(()=>[this.getMeasurements(),this.getSize(),this.scrollOffset],(e,t,n)=>this.range=e.length>0&&t>0?uM({measurements:e,outerSize:t,scrollOffset:n}):null,{key:!1,debug:()=>this.options.debug}),this.getIndexes=Xj(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(e,t,n,r)=>t===null?[]:e({startIndex:t.startIndex,endIndex:t.endIndex,overscan:n,count:r}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(`${t}`,-1)},this._measureElement=(e,t)=>{let n=this.measurementsCache[this.indexFromElement(e)];if(!n||!e.isConnected){this.measureElementCache.forEach((t,n)=>{t===e&&(this.observer.unobserve(e),this.measureElementCache.delete(n))});return}let r=this.measureElementCache.get(n.key);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.measureElementCache.set(n.key,e));let i=this.options.measureElement(e,t,this);this.resizeItem(n,i)},this.resizeItem=(e,t)=>{let n=t-(this.itemSizeCache.get(e.key)??e.size);n!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange===void 0?e.start<this.scrollOffset+this.scrollAdjustments:this.shouldAdjustScrollPositionOnItemSizeChange(e,n,this))&&this._scrollToOffset(this.scrollOffset,{adjustments:this.scrollAdjustments+=n,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(e.index),this.itemSizeCache=new Map(this.itemSizeCache.set(e.key,t)),this.notify(!0,!1))},this.measureElement=e=>{e&&this._measureElement(e,void 0)},this.getVirtualItems=Xj(()=>[this.getIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();return Zj(t[lM(0,t.length-1,e=>Zj(t[e]).start,e)])},this.getOffsetForAlignment=(e,t)=>{let n=this.getSize();t===`auto`&&(t=e<=this.scrollOffset?`start`:e>=this.scrollOffset+n?`end`:`start`),t===`start`?e=e:t===`end`?e-=n:t===`center`&&(e-=n/2);let r=this.options.horizontal?`scrollWidth`:`scrollHeight`,i=(this.scrollElement?`document`in this.scrollElement?this.scrollElement.document.documentElement[r]:this.scrollElement[r]:0)-this.getSize();return Math.max(Math.min(i,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=Zj(this.getMeasurements()[e]);if(t===`auto`)if(n.end>=this.scrollOffset+this.getSize()-this.options.scrollPaddingEnd)t=`end`;else if(n.start<=this.scrollOffset+this.options.scrollPaddingStart)t=`start`;else return[this.scrollOffset,t];let r=t===`end`?n.end+this.options.scrollPaddingEnd:n.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(r,t),t]},this.isDynamicMode=()=>this.measureElementCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(e,{align:t=`start`,behavior:n}={})=>{this.cancelScrollToIndex(),n===`smooth`&&this.isDynamicMode(),this._scrollToOffset(this.getOffsetForAlignment(e,t),{adjustments:void 0,behavior:n})},this.scrollToIndex=(e,{align:t=`auto`,behavior:n}={})=>{e=Math.max(0,Math.min(e,this.options.count-1)),this.cancelScrollToIndex(),n===`smooth`&&this.isDynamicMode();let[r,i]=this.getOffsetForIndex(e,t);this._scrollToOffset(r,{adjustments:void 0,behavior:n}),n!==`smooth`&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.measureElementCache.has(this.options.getItemKey(e))){let[t]=this.getOffsetForIndex(e,i);Qj(t,this.scrollOffset)||this.scrollToIndex(e,{align:i,behavior:n})}else this.scrollToIndex(e,{align:i,behavior:n})}))},this.scrollBy=(e,{behavior:t}={})=>{this.cancelScrollToIndex(),t===`smooth`&&this.isDynamicMode(),this._scrollToOffset(this.scrollOffset+e,{adjustments:void 0,behavior:t})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;return t=e.length===0?this.options.paddingStart:this.options.lanes===1?e[e.length-1]?.end??0:Math.max(...e.slice(-this.options.lanes).map(e=>e.end)),t-this.options.scrollMargin+this.options.paddingEnd},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{var e,t;this.itemSizeCache=new Map,(t=(e=this.options).onChange)==null||t.call(e,this,!1)},this.setOptions(e),this.scrollRect=this.options.initialRect,this.scrollOffset=typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset,this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}),this.notify(!1,!1)}},lM=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function uM({measurements:e,outerSize:t,scrollOffset:n}){let r=e.length-1,i=lM(0,r,t=>e[t].start,n),a=i;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:i,endIndex:a}}var dM=typeof document<`u`?l.useLayoutEffect:l.useEffect;function fM(e){let t=l.useReducer(()=>({}),{})[1],n={...e,onChange:(n,r)=>{var i;r?(0,u.flushSync)(t):t(),(i=e.onChange)==null||i.call(e,n,r)}},[r]=l.useState(()=>new cM(n));return r.setOptions(n),l.useEffect(()=>r._didMount(),[]),dM(()=>r._willUpdate()),r}function pM(e){return fM({observeElementRect:nM,observeElementOffset:aM,scrollToFn:sM,...e})}function mM(){let e=G(e=>e.config.ui?.activeTheme);return G(t=>(t.config.ui?.themes||[]).find(t=>t.name===e))}function hM({category:e}){let t=mM(),n=e.name,r=e.list?e.list:Array.from(Array(e.items).keys()),i=(0,l.useRef)(null),a=pM({horizontal:!0,count:r.length,getScrollElement:()=>i.current,estimateSize:(0,l.useCallback)(()=>52,[]),overscan:5});return(0,l.useEffect)(()=>{a.scrollToIndex(0)},[n]),(0,m.jsx)(l.Fragment,{children:(0,m.jsx)(`div`,{ref:i,className:`tiny-scrollbar overflow-x-auto overflow-y-hidden`,style:{height:`52px`},children:(0,m.jsx)(`div`,{className:`h-full relative mx-auto`,style:{width:`${a.getTotalSize()}px`},children:a.getVirtualItems().map(n=>{let i=`${r[n.index]}`;return(0,m.jsx)(`div`,{className:`absolute top-0 left-0 h-full`,style:{width:`${n.size}px`,transform:`translateX(${n.start}px)`},children:(0,m.jsx)(_b,{variant:`outline`,radius:`rounded-xl`,size:`md`,equalWidth:!0,onClick:async()=>{await q().shape.addSticker(e.name,i),K().setDirty(!0)},children:(0,m.jsx)(`img`,{className:H(`m-auto m-auto w-28 h-28`,e.invertPreview&&t?.isDark&&`invert`),src:_y(e,i),alt:i})})},n.index)})})})})}function gM(){let e=G(e=>e.config.tools?.stickers?.items)||[],[t,n]=(0,l.useState)(e[0]);return(0,m.jsxs)(`div`,{className:`h-92`,children:[(0,m.jsx)(`div`,{className:`mb-10 w-full hide-scrollbar overflow-x-auto overflow-y-hidden flex`,children:(0,m.jsx)(Uw,{value:t,onChange:e=>n(e),variant:`outline`,radius:`rounded-full`,className:`mx-auto`,children:e.map(e=>{let n=t===e,r=Wo[e.name];return(0,m.jsx)(_b,{size:`xs`,color:n?`primary`:null,value:e,children:(0,m.jsx)(`span`,{className:`capitalize`,children:r?(0,m.jsx)(Z,{...r}):e.name})},e.name)})})}),t&&(0,m.jsx)(hM,{category:t})]})}function _M(){let e=G(e=>e.config.tools?.frame?.items)||[],t=G(e=>e.frame.active);return(0,l.useEffect)(()=>{K().frame.active&&K().frame.showOptionsPanel()},[]),(0,m.jsx)(xj,{children:e.map(e=>{let n=Bv(`images/frames/${e.name}/thumbnail.png`),r=t?.name===e.name;return(0,m.jsx)(Sj,{children:(0,m.jsxs)(`button`,{type:`button`,className:`border-2 overflow-hidden relative rounded border cursor-pointer ${r?`border-primary`:``}`,onClick:()=>{K().setDirty(!0),r?q().frame.remove():q().frame.add(e.name)},children:[r&&(0,m.jsx)(vM,{}),(0,m.jsx)(`img`,{draggable:`false`,className:`w-64 h-64`,src:n,alt:e.name})]})},e.name)})})}function vM(){return(0,m.jsx)(`span`,{className:`bg-background/70 absolute inset-0 text-primary`,children:(0,m.jsx)(gj,{className:`svg-icon icon-md absolute inset-0 block m-auto`})})}function yM(){let e=G(e=>e.config.tools?.text?.items);return(0,l.useEffect)(()=>{e&&Gv(e,{prefixSrc:Bv,id:`pixie-fonts`}).catch(()=>{})},[e]),(0,l.useEffect)(()=>{q().text.selectOrAddText()&&K().setDirty(!0)},[]),(0,m.jsx)(xj,{className:`pt-6`,children:(e||[]).map(e=>(0,m.jsx)(Sj,{children:(0,m.jsx)(bM,{fontConfig:e})},e.family))})}function bM({fontConfig:e}){let t=G(e=>e.objects.active.editableProps.fontFamily);return(0,m.jsx)(`button`,{type:`button`,className:H(`block px-6 w-110 h-68 text-sm bg border rounded-2xl`,{"border-primary":t===e.family,"text-primary":t===e.family}),style:{fontFamily:e.family.includes(`"`)?e.family:`"${e.family}"`,fontWeight:e.descriptors?.weight||`normal`},onClick:async()=>{q().text.selectOrAddText(),K().setDirty(!0),q().objects.setValues({fontFamily:e.family})},children:e.family})}var xM=U((0,m.jsx)(`path`,{d:`M290.7 57.4L57.4 290.7c-25 25-25 65.5 0 90.5l80 80c12 12 28.3 18.7 45.3 18.7H288h9.4H512c17.7 0 32-14.3 32-32s-14.3-32-32-32H387.9L518.6 285.3c25-25 25-65.5 0-90.5L381.3 57.4c-25-25-65.5-25-90.5 0zM297.4 416H288l-105.4 0-80-80L227.3 211.3 364.7 348.7 297.4 416z`}),`EraserFA`,`0 0 576 512`);function SM(){return(0,l.useEffect)(()=>(q().draw.enable(),()=>{q().draw.disable()}),[]),(0,m.jsxs)(xj,{gap:`gap-16`,children:[(0,m.jsx)(Sj,{children:(0,m.jsx)(rA,{size:`sm`,label:(0,m.jsx)(Z,{message:`Brush Color`}),value:q().draw.currentBrush.color,onChange:e=>{q().draw.setBrushColor(e)}})}),(0,m.jsx)(Sj,{children:(0,m.jsx)(wM,{})}),(0,m.jsx)(Sj,{children:(0,m.jsx)(CM,{})})]})}function CM(){let e=G(e=>e.config.tools?.draw?.brushSizes)||[],[t,n]=(0,l.useState)(q().draw.currentBrush.width);return(0,m.jsx)(xA,{selectionMode:`single`,selectedValue:t,onSelectionChange:e=>{n(e),q().draw.setBrushSize(e)},size:`sm`,label:(0,m.jsx)(Z,{message:`Brush Size`}),children:e.map(e=>(0,m.jsx)(wb,{value:e,children:(0,m.jsxs)(`div`,{className:`flex items-center`,children:[(0,m.jsx)(`div`,{className:`flex-shrink-0 mr-8 border-[3px] rounded-full`,style:{width:`${e}px`,height:`${e}px`}}),e]})},e))})}function wM(){let e=G(e=>e.config.tools?.draw?.brushTypes)||[],t=mM(),[n,r]=(0,l.useState)(q().draw.currentBrush.type);return(0,m.jsx)(xA,{selectionMode:`single`,selectedValue:n,onSelectionChange:e=>{r(e),q().draw.setBrushType(e)},size:`sm`,label:(0,m.jsx)(Z,{message:`Brush Type`}),children:e.map(e=>(0,m.jsx)(wb,{value:e,children:(0,m.jsxs)(`div`,{className:`flex items-center`,children:[e===`EraserBrush`?(0,m.jsx)(xM,{className:`mr-8`}):(0,m.jsx)(`img`,{className:`flex-shrink-0 mr-8 w-24 h-24`,src:TM(e,t?.isDark),alt:``}),(0,m.jsx)(Z,{message:e.replace(/([A-Z])/g,` $1`).trim()})]})},e))})}function TM(e,t=!1){let n=e.replace(`Brush`,``).toLowerCase();return Bv(`images/brushes/${t?`white`:`black`}/${n}.png`)}function EM(){let{trans:e}=Kk(),t=G(e=>e.corners.radius);return(0,l.useEffect)(()=>(K().setDirty(!0),q().corners.showPreview(),()=>q().corners.hidePreview()),[]),(0,m.jsx)(`div`,{className:`max-w-320 mx-auto`,children:(0,m.jsx)(hA,{minValue:1,maxValue:300,label:e({message:`Radius`}),getValueLabel:e=>`${e}px`,onChange:e=>{q().corners.updatePreview(e),K().corners.setRadius(e)},value:t})})}var DM={initial:{y:`130%`,opacity:0},animate:{y:0,opacity:1},exit:{y:`130%`,opacity:0,left:0,position:`absolute`,overflowY:`hidden`},transition:{type:`tween`,duration:.15}};function OM({activeTool:e}){let t=kM(e);return(0,m.jsx)(x_.div,{className:`relative h-full w-full text-sm bg select-none overflow-hidden`,...DM,children:t})}function kM(e){switch(e){case V.FILTER:return(0,m.jsx)(Cj,{});case V.RESIZE:return(0,m.jsx)(Aj,{});case V.CROP:return(0,m.jsx)(Hj,{});case V.DRAW:return(0,m.jsx)(SM,{});case V.TEXT:return(0,m.jsx)(yM,{});case V.SHAPES:return(0,m.jsx)(qj,{});case V.STICKERS:return(0,m.jsx)(gM,{});case V.FRAME:return(0,m.jsx)(_M,{});case V.CORNERS:return(0,m.jsx)(EM,{});default:return null}}function AM({className:e}){let t=G(e=>e.activeTool);return(0,m.jsx)(`nav`,{className:H(`z-navbar min-h-86 flex-shrink-0 px-16 relative overflow-hidden`,e),children:(0,m.jsx)(M_,{initial:!1,children:t?(0,m.jsx)(OM,{activeTool:t},`tool-controls`):(0,m.jsx)(jM,{},`nav-items`)})})}function jM(){let e=G(e=>e.config.ui?.nav?.items)||[];return(0,m.jsx)(x_.div,{className:`w-full h-full bg-inherit`,...DM,children:(0,m.jsx)(xj,{children:e.map(e=>(0,m.jsx)(Sj,{children:(0,m.jsx)(MM,{item:e})},e.name))})})}function MM({item:e}){let t=()=>{typeof e.action==`string`?Yu(e.action):typeof e.action==`function`&&e.action(K().editor)},n=vs[e.name];return(0,m.jsxs)(gb,{variant:`outline`,color:`paper`,className:`flex-col flex-shrink-0 w-68 h-68`,radius:`rounded-2xl`,onClick:t,children:[(0,m.jsx)(`div`,{className:`mb-1`,children:(0,m.jsx)(Rw,{className:`icon-md`,icon:e.icon})}),(0,m.jsx)(`div`,{className:`mt-6 text-xs capitalize max-w-[90%] overflow-hidden overflow-ellipsis`,children:n?(0,m.jsx)(Z,{...n}):e.name})]})}function NM(){let e=G(e=>e.history.items),t=G(e=>e.history.pointer);return(0,m.jsxs)(x_.div,{..._C,className:`absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-10 py-2 mb-4 font-medium text-sm border-b flex items-center`,children:[(0,m.jsx)(Z,{message:`History`}),(0,m.jsx)(Q,{size:`xs`,className:`ml-auto flex-shrink-0`,onClick:()=>{K().togglePanel(`history`,!1)},children:(0,m.jsx)(Qw,{})})]}),(0,m.jsx)(`div`,{className:`p-10`,children:e.map(n=>{let r=n.id===e[t].id,i=gs[n.name],a=i.icon&&l.default.createElement(i.icon,{className:`icon-sm`});return(0,m.jsx)(_b,{onClick:()=>{r||q().history.load(n)},variant:`outline`,color:r?`primary`:null,size:`sm`,className:H(`w-full mb-8`,r&&`pointer-events-none`),justify:`justify-start`,startIcon:a,children:(0,m.jsx)(Z,{...i.name})},n.id)})})]})}function PM(e){let{children:t,className:n,color:r,onDismiss:i,leftAdornment:a,rightAdornment:o,hideDismissButton:s=!1,size:c,showDivider:u,justify:d=`justify-between`,titleFontWeight:f=`font-semibold`,titleTextSize:p=c===`xs`?`text-xs`:`text-sm`,closeButtonSize:h=c===`xs`?`xs`:`sm`,actions:g}=e,{labelId:_,isDismissable:v,close:y}=(0,l.useContext)(Wk);return(0,m.jsxs)(`div`,{className:H(n,`flex flex-shrink-0 items-center gap-10`,f,u&&`border-b`,FM(e),r||`text-main`,d),children:[a,(0,m.jsx)(`h3`,{id:_,className:H(p,`mr-auto leading-5 opacity-90`),children:t}),o,g,v&&!s&&(0,m.jsx)(Q,{"aria-label":`Dismiss`,onClick:()=>{i?i():y()},size:h,className:H(`-mr-8 text-muted`,o&&`sr-only`),children:(0,m.jsx)(Qw,{})})]})}function FM({size:e,padding:t}){if(t)return t;switch(e){case`2xs`:case`xs`:return`px-14 py-4`;case`sm`:return`px-18 py-4`;default:return`px-24 py-6`}}var IM=(0,l.forwardRef)((e,t)=>{let{children:n,className:r,padding:i,size:a,...o}=e;return(0,m.jsx)(`div`,{...o,ref:t,className:H(r,LM(e),`overflow-y-auto overflow-x-hidden overscroll-contain text-sm flex-auto`),children:n})});function LM({size:e,padding:t}){if(t)return t;switch(e){case`xs`:return`p-14`;case`sm`:return`p-18`;default:return`px-24 py-20`}}function RM(){return(0,m.jsx)(tA,{isOpen:G(e=>e.openPanels.newImage),disableInitialTransition:!0,type:`modal`,isDismissable:!1,children:(0,m.jsx)(zM,{})})}function zM(){let[e,t]=(0,l.useState)(`default`);return(0,m.jsxs)(Yk,{className:`text-center max-w-max text-main`,size:`auto`,children:[(0,m.jsx)(PM,{padding:`px-24 pt-24 pb-12`,showDivider:!1,children:(0,m.jsx)(Z,{message:`Open a photo or design to get started`})}),(0,m.jsx)(IM,{children:e===`default`?(0,m.jsx)(BM,{setActivePanel:t}):(0,m.jsx)(HM,{setActivePanel:t})})]})}function BM({setActivePanel:e}){return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(_b,{className:`mr-20`,size:`sm`,variant:`raised`,color:`primary`,onClick:()=>{q().import.uploadAndReplaceMainImage()},children:(0,m.jsx)(Z,{message:`Open Photo`})}),(0,m.jsx)(_b,{variant:`outline`,size:`sm`,color:`primary`,onClick:()=>{e(`newCanvas`)},children:(0,m.jsx)(Z,{message:`Create New`})}),(0,m.jsx)(VM,{})]})}function VM(){let e=G(e=>e.config.ui?.openImageDialog?.sampleImages);return e!=null&&e.length?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(`div`,{className:`relative py-20 text-main`,children:[(0,m.jsx)(`hr`,{className:`absolute h-1 border-none bg-divider w-full top inset-0 m-auto`}),(0,m.jsx)(`span`,{className:`text-sm bg px-6 relative`,children:(0,m.jsx)(Z,{message:`or use sample`})})]}),(0,m.jsx)(`ul`,{className:`flex items-center gap-16`,children:e.map(e=>(0,m.jsx)(`li`,{className:`shrink-0`,children:(0,m.jsx)(`button`,{type:`button`,onClick:async()=>{typeof e.action==`function`?e.action():e.url.endsWith(`.json`)?(await Ku(Bv(e.url)),K().togglePanel(`newImage`,!1)):(await q().import.openBackgroundImage(Bv(e.url)),K().togglePanel(`newImage`,!1))},children:(0,m.jsx)(`img`,{className:`w-80 h-80 rounded overflow-hidden transition-shadow hover:shadow-md`,src:Bv(e.thumbnail),alt:``})})},e.url||e.thumbnail))})]}):null}function HM({setActivePanel:e}){let[t,n]=(0,l.useState)({width:800,height:600,bgColor:`transparent`});return(0,m.jsxs)(`form`,{onSubmit:e=>{e.preventDefault();let{width:n,height:r,bgColor:i}=t;n&&r&&(K().setConfig({blankCanvasSize:{width:n,height:r}}),q().canvas.openNew(n,r,i),K().togglePanel(`newImage`,!1),q().history.addInitial())},children:[(0,m.jsx)(Nw,{type:`number`,label:(0,m.jsx)(Z,{message:`Width`}),value:t.width,min:1,required:!0,className:`mb-16`,onChange:e=>{n({...t,width:e.target.valueAsNumber})}}),(0,m.jsx)(Nw,{type:`number`,label:(0,m.jsx)(Z,{message:`Height`}),value:t.height,min:1,required:!0,className:`mb-16`,onChange:e=>{n({...t,height:e.target.valueAsNumber})}}),(0,m.jsx)(rA,{onChange:e=>{n({...t,bgColor:e})},className:`mb-16`,value:t.bgColor,label:(0,m.jsx)(Z,{message:`Background color`})}),(0,m.jsxs)(`div`,{className:`text-right`,children:[(0,m.jsx)(_b,{size:`sm`,variant:`text`,className:`mr-10`,onClick:()=>{e(`default`)},children:(0,m.jsx)(Z,{message:`Cancel`})}),(0,m.jsx)(_b,{size:`sm`,type:`submit`,variant:`raised`,color:`primary`,children:(0,m.jsx)(Z,{message:`Create`})})]})]})}var UM=(0,l.forwardRef)((e,t)=>{let n=bw(e),{label:r,children:i,size:a,className:o,orientation:s=`horizontal`,disabled:c,required:u,invalid:d,errorMessage:f,description:p}=e,h={},g=(0,l.useId)(),_=e.name||g;return(0,m.jsxs)(`fieldset`,{"aria-describedby":p?`${g}-description`:void 0,ref:t,className:H(`text-left`,o),children:[r&&(0,m.jsx)(`legend`,{className:n.label,...h,children:r}),(0,m.jsx)(`div`,{className:H(`flex`,r?`mt-6`:`mt-0`,s===`vertical`?`flex-col gap-10`:`flex-row gap-16`),children:l.Children.map(i,e=>{if((0,l.isValidElement)(e))return(0,l.cloneElement)(e,{name:_,size:a,invalid:e.props.invalid||d||void 0,disabled:e.props.disabled||c,required:e.props.required||u})})}),p&&!f&&(0,m.jsx)(`div`,{className:n.description,id:`${g}-description`,children:p}),f&&(0,m.jsx)(`div`,{className:n.error,children:f})]})}),WM=(0,l.forwardRef)((e,t)=>{let{children:n,autoFocus:r,size:i,invalid:a,isFirst:o,...s}=e,c=cv(t);jw({autoFocus:r},c);let l=GM(i);return(0,m.jsxs)(`label`,{className:H(`inline-flex gap-8 select-none items-center whitespace-nowrap align-middle`,l.label,e.disabled&&`text-disabled pointer-events-none`,e.invalid&&`text-danger`),children:[(0,m.jsx)(`input`,{type:`radio`,className:H(`focus-visible:ring outline-none`,`rounded-full transition-button border-2 appearance-none`,`border-text-muted disabled:border-disabled-fg checked:border-primary checked:hover:border-primary-dark`,`before:bg-primary disabled:before:bg-disabled-fg before:hover:bg-primary-dark`,`before:h-full before:w-full before:block before:rounded-full before:scale-10 before:opacity-0 before:transition before:duration-200`,`checked:before:scale-[.65] checked:before:opacity-100`,l.circle),ref:c,...s}),n&&(0,m.jsx)(`span`,{children:n})]})});function GM(e){switch(e){case`xs`:return{circle:`h-12 w-12`,label:`text-xs`};case`sm`:return{circle:`h-16 w-16`,label:`text-sm`};case`lg`:return{circle:`h-24 w-24`,label:`text-lg`};default:return{circle:`h-20 w-20`,label:`text-base`}}}function KM(){return(0,m.jsx)(tA,{isOpen:G(e=>e.openPanels.export),onOpenChange:e=>{e||K().togglePanel(`export`,!1)},type:`modal`,children:(0,m.jsx)(qM,{})})}function qM(){let[e,t]=(0,l.useState)(()=>({filename:K().config.tools?.export?.defaultName||`image`,format:K().config.tools?.export?.defaultFormat||`jpeg`,quality:K().config.tools?.export?.defaultQuality||.8}));return(0,m.jsx)(Yk,{className:`text-center max-w-max text-main`,size:`auto`,children:(0,m.jsx)(IM,{children:(0,m.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),q().export.save(e.filename,e.format,e.quality),K().togglePanel(`export`,!1)},children:[(0,m.jsx)(Nw,{required:!0,size:`sm`,label:(0,m.jsx)(Z,{message:`Save As`}),value:e.filename,onChange:n=>{t({...e,filename:n.target.value})}}),(0,m.jsxs)(UM,{size:`sm`,className:`my-20`,"aria-label":`Image format`,children:[(0,m.jsx)(WM,{value:`jpeg`,checked:e.format===`jpeg`,onChange:n=>{t({...e,format:n.target.value})},children:`JPEG`}),(0,m.jsx)(WM,{value:`png`,checked:e.format===`png`,onChange:n=>{t({...e,format:n.target.value})},children:`PNG`}),(0,m.jsx)(WM,{value:`json`,checked:e.format===`json`,onChange:n=>{t({...e,format:n.target.value})},children:`JSON`})]}),(0,m.jsx)(hA,{size:`sm`,minValue:.1,step:.1,maxValue:1,value:e.quality,onChange:n=>{t({...e,quality:n})},formatOptions:{style:`percent`},label:(0,m.jsx)(Z,{message:`Quality`})}),(0,m.jsx)(_b,{variant:`raised`,color:`primary`,type:`submit`,className:`mt-20 w-full`,size:`sm`,children:(0,m.jsx)(Z,{message:`Save`})})]})})})}function JM(){let e=G(e=>e.objects.all),t=G(e=>e.objects.active.id);return(0,m.jsxs)(x_.div,{..._C,className:`absolute bottom-20 right-20 w-224 max-w-[calc(100%-40px)] max-h-[calc(100%-40px)] bg-paper shadow-xl border focus:outline-none rounded overflow-hidden`,children:[(0,m.jsxs)(`div`,{className:`px-10 py-2 mb-4 font-medium text-sm border-b flex items-center`,children:[(0,m.jsx)(Z,{message:`Objects`}),(0,m.jsx)(Q,{size:`xs`,className:`ml-auto flex-shrink-0`,onClick:()=>{K().togglePanel(`objects`,!1)},children:(0,m.jsx)(Qw,{})})]}),(0,m.jsx)(`div`,{className:`p-8`,children:e.map(e=>{let n=e.id===t,r=e.name;if(!r)return null;let i=Dl[r],a=i.icon&&l.default.createElement(i.icon,{className:`icon-sm`});return(0,m.jsx)(_b,{onClick:()=>{n||!e.selectable||q().objects.select(e.id)},variant:`outline`,color:n?`primary`:null,size:`sm`,className:H(`w-full mb-8`,(n||!e.selectable)&&`pointer-events-none`),justify:`justify-start`,startIcon:a,children:(0,m.jsx)(Z,{...i.name})},e.id)})})]})}function YM(){let e=G(e=>e.openPanels.history),t=G(e=>e.openPanels.objects);return(0,m.jsxs)(`div`,{className:`z-modal`,children:[(0,m.jsxs)(M_,{children:[e&&(0,m.jsx)(NM,{},`historyPanel`),t&&(0,m.jsx)(JM,{},`objListPanel`)]}),(0,m.jsx)(RM,{}),(0,m.jsx)(KM,{})]})}function XM(){return XM=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},XM.apply(this,arguments)}var ZM;(function(e){e.Pop=`POP`,e.Push=`PUSH`,e.Replace=`REPLACE`})(ZM||={});function QM(e,t){if(e===!1||e===null||typeof e>`u`)throw Error(t)}function $M(e){let{pathname:t=`/`,search:n=``,hash:r=``}=e;return n&&n!==`?`&&(t+=n.charAt(0)===`?`?n:`?`+n),r&&r!==`#`&&(t+=r.charAt(0)===`#`?r:`#`+r),t}function eN(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}var tN;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(tN||={});function nN(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function rN(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?eN(e):e;return{pathname:n?n.startsWith(`/`)?n:iN(n,t):t,search:uN(r),hash:dN(i)}}function iN(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function aN(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in <Link to="..."> and the router will parse it for you.`}function oN(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function sN(e,t){let n=oN(e);return t?n.map((t,n)=>n===e.length-1?t.pathname:t.pathnameBase):n.map(e=>e.pathnameBase)}function cN(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=eN(e):(i=XM({},e),QM(!i.pathname||!i.pathname.includes(`?`),aN(`?`,`pathname`,`search`,i)),QM(!i.pathname||!i.pathname.includes(`#`),aN(`#`,`pathname`,`hash`,i)),QM(!i.search||!i.search.includes(`#`),aN(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=rN(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var lN=e=>e.join(`/`).replace(/\/\/+/g,`/`),uN=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,dN=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,fN=[`post`,`put`,`patch`,`delete`];new Set(fN);var pN=[`get`,...fN];new Set(pN);function mN(){return mN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},mN.apply(this,arguments)}var hN=l.createContext(null),gN=l.createContext(null),_N=l.createContext(null),vN=l.createContext({outlet:null,matches:[],isDataRoute:!1});function yN(e,t){let{relative:n}=t===void 0?{}:t;bN()||QM(!1);let{basename:r,navigator:i}=l.useContext(gN),{hash:a,pathname:o,search:s}=TN(e,{relative:n}),c=o;return r!==`/`&&(c=o===`/`?r:lN([r,o])),i.createHref({pathname:c,search:s,hash:a})}function bN(){return l.useContext(_N)!=null}function xN(){return bN()||QM(!1),l.useContext(_N).location}function SN(e){l.useContext(gN).static||l.useLayoutEffect(e)}function CN(){let{isDataRoute:e}=l.useContext(vN);return e?jN():wN()}function wN(){bN()||QM(!1);let e=l.useContext(hN),{basename:t,future:n,navigator:r}=l.useContext(gN),{matches:i}=l.useContext(vN),{pathname:a}=xN(),o=JSON.stringify(sN(i,n.v7_relativeSplatPath)),s=l.useRef(!1);return SN(()=>{s.current=!0}),l.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=cN(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:lN([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}function TN(e,t){let{relative:n}=t===void 0?{}:t,{future:r}=l.useContext(gN),{matches:i}=l.useContext(vN),{pathname:a}=xN(),o=JSON.stringify(sN(i,r.v7_relativeSplatPath));return l.useMemo(()=>cN(e,JSON.parse(o),a,n===`path`),[e,o,a,n])}var EN=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(EN||{}),DN=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(DN||{});function ON(e){let t=l.useContext(hN);return t||QM(!1),t}function kN(e){let t=l.useContext(vN);return t||QM(!1),t}function AN(e){let t=kN(),n=t.matches[t.matches.length-1];return n.route.id||QM(!1),n.route.id}function jN(){let{router:e}=ON(EN.UseNavigateStable),t=AN(DN.UseNavigateStable),n=l.useRef(!1);return SN(()=>{n.current=!0}),l.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,mN({fromRouteId:t},i)))},[e,t])}new Promise(()=>{});function MN(){return MN=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},MN.apply(this,arguments)}function NN(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function PN(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function FN(e,t){return e.button===0&&(!t||t===`_self`)&&!PN(e)}var IN=[`onClick`,`relative`,`reloadDocument`,`replace`,`state`,`target`,`to`,`preventScrollReset`,`unstable_viewTransition`],LN=`6`;try{window.__reactRouterVersion=LN}catch{}var RN=typeof window<`u`&&typeof window.document<`u`&&typeof window.document.createElement<`u`,zN=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,BN=l.forwardRef(function(e,t){let{onClick:n,relative:r,reloadDocument:i,replace:a,state:o,target:s,to:c,preventScrollReset:u,unstable_viewTransition:d}=e,f=NN(e,IN),{basename:p}=l.useContext(gN),m,h=!1;if(typeof c==`string`&&zN.test(c)&&(m=c,RN))try{let e=new URL(window.location.href),t=c.startsWith(`//`)?new URL(e.protocol+c):new URL(c),n=nN(t.pathname,p);t.origin===e.origin&&n!=null?c=n+t.search+t.hash:h=!0}catch{}let g=yN(c,{relative:r}),_=UN(c,{replace:a,state:o,target:s,preventScrollReset:u,relative:r,unstable_viewTransition:d});function v(e){n&&n(e),e.defaultPrevented||_(e)}return l.createElement(`a`,MN({},f,{href:m||g,onClick:h||i?n:v,ref:t,target:s}))}),VN;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(VN||={});var HN;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(HN||={});function UN(e,t){let{target:n,replace:r,state:i,preventScrollReset:a,relative:o,unstable_viewTransition:s}=t===void 0?{}:t,c=CN(),u=xN(),d=TN(e,{relative:o});return l.useCallback(t=>{FN(t,n)&&(t.preventDefault(),c(e,{replace:r===void 0?$M(u)===$M(d):r,state:i,preventScrollReset:a,relative:o,unstable_viewTransition:s}))},[u,c,d,r,i,n,e,a,o,s])}var WN=U((0,m.jsx)(`path`,{d:`M11 15h2v2h-2v-2zm0-8h2v6h-2V7zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z`}),`ErrorOutlineOutlined`),GN=U((0,m.jsx)(`path`,{d:`M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z`}),`CheckCircleOutlined`),KN={opacity:0,y:50,scale:.3},qN={opacity:1,y:0,scale:1},JN={opacity:0,scale:.5};function YN(){return(0,m.jsx)(`div`,{className:`pointer-events-none relative`,children:(0,m.jsx)(M_,{initial:!1,children:rd(e=>e.toasts).map(e=>(0,m.jsx)(`div`,{className:H(`fixed z-toast mx-auto p-20`,e.position===`bottom-center`?`bottom-0 left-0 right-0`:`bottom-0 right-0`),children:(0,m.jsxs)(x_.div,{initial:e.disableEnterAnimation?void 0:KN,animate:e.disableEnterAnimation?void 0:qN,exit:e.disableExitAnimation?void 0:JN,className:H(`pointer-events-auto mx-auto flex max-h-100 min-h-50 w-min min-w-288 max-w-500 items-center gap-10 rounded-lg border bg-paper bg-paper py-6 pl-16 pr-6 text-sm text-main shadow-lg`),onPointerEnter:()=>e.timer?.pause(),onPointerLeave:()=>e.timer?.resume(),role:`alert`,"aria-live":e.type===`danger`?`assertive`:`polite`,children:[e.type===`danger`&&(0,m.jsx)(WN,{className:`flex-shrink-0 text-danger`,size:`md`}),e.type===`loading`&&(0,m.jsx)(gA,{size:`sm`,className:`flex-shrink-0`,isIndeterminate:!0}),e.type===`positive`&&(0,m.jsx)(GN,{className:`flex-shrink-0 text-positive`,size:`md`}),(0,m.jsx)(`div`,{className:`mr-auto w-max overflow-hidden overflow-ellipsis`,"data-testid":`toast-message`,children:(0,m.jsx)(zw,{value:e.message})}),e.action&&(0,m.jsx)(_b,{variant:`text`,color:`primary`,size:`sm`,className:`flex-shrink-0`,onFocus:()=>e.timer?.pause(),onBlur:()=>e.timer?.resume(),onClick:()=>id().remove(e.id),elementType:BN,to:e.action.action,children:(0,m.jsx)(zw,{value:e.action.label})}),e.type!==`loading`&&(0,m.jsx)(Q,{onFocus:()=>e.timer?.pause(),onBlur:()=>e.timer?.resume(),type:`button`,className:`flex-shrink-0`,onClick:()=>{id().remove(e.id)},size:`sm`,children:(0,m.jsx)(Qw,{})})]})},e.id))})})}function XN(e){return tv()?e.metaKey:e.ctrlKey}function ZN(e){switch(e.key){case`z`:XN(e)&&(e.preventDefault(),e.stopPropagation(),e.shiftKey?q().history.redo():q().history.undo());break;case`ArrowUp`:e.preventDefault(),e.stopPropagation(),q().objects.move(`up`);break;case`ArrowRight`:e.preventDefault(),e.stopPropagation(),q().objects.move(`right`);break;case`ArrowDown`:e.preventDefault(),e.stopPropagation(),q().objects.move(`down`);break;case`ArrowLeft`:e.preventDefault(),e.stopPropagation(),q().objects.move(`left`);break;case`Delete`:e.preventDefault(),e.stopPropagation(),q().objects.delete();break;case`v`:XN(e)&&(e.preventDefault(),e.stopPropagation(),QN());break}}async function QN(){try{let e=await navigator.clipboard.read();for(let t of e)for(let e of t.types)if(e.startsWith(`image/`)){let n=await t.getType(e),r=new FileReader;r.onload=e=>{var t;(t=e.target)!=null&&t.result&&q().import.addImageFromData(e.target.result)},r.readAsDataURL(n);return}}catch(e){console.error(e)}}var $N=new Map,eP=new Map,tP={status:`inactive`};async function*nP(e){let t=[];for(let n of e.items)if(n.kind===`file`){let e=n.webkitGetAsEntry();e&&t.push(e)}for(let e of t)if(e.isFile){if(e.name===`.DS_Store`)continue;yield new My(await iP(e),e.fullPath)}else e.isDirectory&&(yield*rP(e))}async function*rP(e){let t=e.createReader(),n;do{n=await new Promise((e,n)=>{t.readEntries(e,n)});for(let e of n)if(e.isFile){if(e.name===`.DS_Store`)continue;yield new My(await iP(e),e.fullPath)}else e.isDirectory&&(yield*rP(e))}while(n.length>0)}function iP(e){return new Promise((t,n)=>e.file(t,n))}async function aP(e){let t=[];for await(let n of e)t.push(n);return t}var oP=400;function sP({id:e,disabled:t,ref:n,...r}){let i=(0,l.useRef)({dragOverElements:new Set,dropActivateTimer:void 0}).current,a=(0,l.useRef)(r);a.current=r,(0,l.useLayoutEffect)(()=>(eP.set(e,{...eP.get(e),disabled:t,id:e,ref:n}),()=>{eP.delete(e)}),[e,a,t,n]);let o=e=>{let t=a.current,r=t.allowDragEventsFromItself||n.current!==e.ref?.current;return!!(e!=null&&e.type&&r&&t.types.includes(e.type)&&(!t.acceptsDrop||t.acceptsDrop(e)))},s=e=>{var t,n;let r=cP(e);r&&((n=(t=a.current).onDragLeave)==null||n.call(t,r))};return{droppableProps:t?{}:{onDragOver:e=>{var t,n;e.preventDefault(),e.stopPropagation();let r=cP(e);r&&o(r)&&((n=(t=a.current).onDragOver)==null||n.call(t,r,e))},onDragEnter:e=>{var t,n;if(e.stopPropagation(),i.dragOverElements.add(e.target),i.dragOverElements.size>1)return;let r=cP(e);r&&o(r)&&((n=(t=a.current).onDragEnter)==null||n.call(t,r),clearTimeout(i.dropActivateTimer),typeof a.current.onDropActivate==`function`&&(i.dropActivateTimer=setTimeout(()=>{var e,t;r&&((t=(e=a.current).onDropActivate)==null||t.call(e,r))},oP)))},onDragLeave:e=>{e.stopPropagation(),i.dragOverElements.delete(e.target);for(let t of i.dragOverElements)e.currentTarget.contains(t)||i.dragOverElements.delete(t);if(i.dragOverElements.size>0)return;let t=cP(e);t&&o(t)&&(s(e),clearTimeout(i.dropActivateTimer))},onDrop:async e=>{var t,n,r,c;e.preventDefault(),e.stopPropagation(),i.dragOverElements.clear(),s(e),clearTimeout(i.dropActivateTimer);let l=cP(e);l&&((n=(t=a.current).onDragLeave)==null||n.call(t,l),o(l)&&((c=(r=a.current).onDrop)==null||c.call(r,l)))}}}}function cP(e){if(tP.dragTargetId!=null)return $N.get(tP.dragTargetId);if(e.dataTransfer.types.includes(`Files`))return{type:`nativeFile`,el:null,ref:null,getData:()=>aP(nP(e.dataTransfer))}}function lP(){let e=G(e=>e.config.ui?.visible)??!0,t=G(e=>e.config.ui?.nav?.position)??`bottom`,n=G(e=>e.config.ui?.menubar?.position)??`top`,r=G(e=>e.config.ui?.allowEditorClose)??!0,i=(0,l.useRef)(null),a=(0,l.useRef)(null),{isModal:o,isMobile:s}=$w(),{droppableProps:c}=sP({id:`pixie-root`,ref:a,types:[`nativeFile`],onDrop:(0,l.useCallback)(async e=>{if(K().activeTool||K().dirty||e.type!==`nativeFile`)return;let t=await e.getData();q().import.fileIsValid(t[0])&&(K().config.tools?.import?.openDroppedImageAsBackground??!1?await q().import.openBackgroundImage(t[0]):await q().import.openUploadedFile(t[0]))},[])});(0,l.useEffect)(()=>{var e;K().fabric||(G.setState({canvasRef:i}),ib(i.current),(e=K().config.ui)!=null&&e.defaultTool&&K().setActiveTool(K().config.ui?.defaultTool,null),q().canvas.loadInitialContent().then(()=>{var e,t;(t=(e=K().config).onLoad)==null||t.call(e,K().editor)}));let t=ab(a,()=>{K().setStageSize(ob(a.current))}),n=ab(i,()=>{K().setCanvasSize(ob(i.current))});return()=>{t(),n()}},[a]);let u={visible:{opacity:1,scale:1,display:`flex`},hidden:{opacity:0,transitionEnd:{display:`none`}}},d=H(`pixie-root flex flex-col overflow-hidden bg-background text-main no-tap-highlight w-full h-full`,{relative:!o,"fixed inset-0 w-full h-full z-20":o,"shadow-lg border rounded-md m-auto max-h-[calc(100vh-90px)] max-w-[calc(100vw-90px)]":o&&!s});return(0,m.jsxs)(N_,{features:F_,strict:!0,children:[o&&e&&!s&&r&&(0,m.jsx)(Q,{className:`z-20 fixed right-2 top-2 text-white`,size:`lg`,onClick:()=>{K().editor.close()},children:(0,m.jsx)(Qw,{})}),o&&e&&(0,m.jsx)(SC,{position:`fixed`,disableInitialTransition:!0}),(0,m.jsxs)(x_.div,{initial:!1,variants:u,animate:e?`visible`:`hidden`,className:d,children:[n===`top`&&(0,m.jsx)(sT,{}),t===`top`&&(0,m.jsx)(AM,{className:`pt-14`}),(0,m.jsxs)(`main`,{className:`relative flex-auto my-20 overflow-hidden outline-none`,tabIndex:-1,...q_(c,{onKeyDownCapture:ZN}),ref:a,children:[(0,m.jsx)(lT,{}),(0,m.jsx)(PD,{ref:i})]}),(0,m.jsx)(mj,{}),t===`bottom`&&(0,m.jsx)(AM,{}),n===`bottom`&&(0,m.jsx)(sT,{}),(0,m.jsx)(YM,{}),(0,m.jsx)(YN,{})]})]})}(function(){fabric.Object.ENLIVEN_PROPS.push(`eraser`);var e=fabric.Object.prototype._drawClipPath,t=fabric.Object.prototype.needsItsOwnCache,n=fabric.Object.prototype.toObject,r=fabric.Object.prototype.getSvgCommons,i=fabric.Object.prototype._createBaseClipPathSVGMarkup,a=fabric.Object.prototype._createBaseSVGMarkup;fabric.Object.prototype.cacheProperties.push(`eraser`),fabric.Object.prototype.stateProperties.push(`eraser`),fabric.util.object.extend(fabric.Object.prototype,{erasable:!0,eraser:void 0,needsItsOwnCache:function(){return t.call(this)||!!this.eraser},_drawClipPath:function(t,n){if(e.call(this,t,n),this.eraser){var r=this._getNonTransformedDimensions();this.eraser.isType(`eraser`)&&this.eraser.set({width:r.x,height:r.y}),e.call(this,t,this.eraser)}},toObject:function(e){var t=n.call(this,[`erasable`].concat(e));return this.eraser&&!this.eraser.excludeFromExport&&(t.eraser=this.eraser.toObject(e)),t},getSvgCommons:function(){return r.call(this)+(this.eraser?`mask="url(#`+this.eraser.clipPathId+`)" `:``)},_createEraserSVGMarkup:function(e){return this.eraser?(this.eraser.clipPathId=`MASK_`+ fabric.Object.__uid++,[`<mask id="`,this.eraser.clipPathId,`" >`,this.eraser.toSVG(e),`</mask>`,`
|
|
465
|
+
`].join(``)):``},_createBaseClipPathSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),i.call(this,e,t)].join(``)},_createBaseSVGMarkup:function(e,t){return[this._createEraserSVGMarkup(t&&t.reviver),a.call(this,e,t)].join(``)}});var o=fabric.Group.prototype._restoreObjectsState;fabric.util.object.extend(fabric.Group.prototype,{_addEraserPathToObjects:function(e){this._objects.forEach(function(t){fabric.EraserBrush.prototype._addPathToObjectEraser.call(fabric.EraserBrush.prototype,t,e)})},applyEraserToObjects:function(){var e=this,t=this.eraser;if(t){delete this.eraser;var n=e.calcTransformMatrix();t.clone(function(t){var r=e.clipPath;t.getObjects(`path`).forEach(function(t){var i=fabric.util.multiplyTransformMatrices(n,t.calcTransformMatrix());fabric.util.applyTransformToObject(t,i),r?r.clone(function(r){var i=fabric.EraserBrush.prototype.applyClipPathToPath.call(fabric.EraserBrush.prototype,t,r,n);e._addEraserPathToObjects(i)},[`absolutePositioned`,`inverted`]):e._addEraserPathToObjects(t)})})}},_restoreObjectsState:function(){return this.erasable===!0&&this.applyEraserToObjects(),o.call(this)}}),fabric.Eraser=fabric.util.createClass(fabric.Group,{type:`eraser`,originX:`center`,originY:`center`,drawObject:function(e){e.save(),e.fillStyle=`black`,e.fillRect(-this.width/2,-this.height/2,this.width,this.height),e.restore(),this.callSuper(`drawObject`,e)},_getBounds:function(){},_toSVG:function(e){var t=[`<g `,`COMMON_PARTS`,` >
|
|
466
|
+
`],n=[`<rect `,`fill="white" `,`x="`,-this.width/2,`" y="`,-this.height/2,`" width="`,this.width,`" height="`,this.height,`" />
|
|
467
|
+
`].join(``);t.push(` `,n);for(var r=0,i=this._objects.length;r<i;r++)t.push(` `,this._objects[r].toSVG(e));return t.push(`</g>
|
|
468
|
+
`),t}}),fabric.Eraser.fromObject=function(e,t){var n=e.objects;fabric.util.enlivenObjects(n,function(n){var r=fabric.util.object.clone(e,!0);delete r.objects,fabric.util.enlivenObjectEnlivables(e,r,function(){t&&t(new fabric.Eraser(n,r,!0))})})};var s=fabric.Canvas.prototype._renderOverlay;fabric.util.object.extend(fabric.Canvas.prototype,{isErasing:function(){return this.isDrawingMode&&this.freeDrawingBrush&&this.freeDrawingBrush.type===`eraser`&&this.freeDrawingBrush._isErasing},_renderOverlay:function(e){s.call(this,e),this.isErasing()&&!this.freeDrawingBrush.inverted&&this.freeDrawingBrush._render()}}),fabric.EraserBrush=fabric.util.createClass(fabric.PencilBrush,{type:`eraser`,inverted:!1,_isErasing:!1,_isErasable:function(e){return e.erasable!==!1},_prepareCollectionTraversal:function(e,t,n){e.forEachObject(function(r){r.forEachObject&&r.erasable===`deep`?this._prepareCollectionTraversal(r,t,n):!this.inverted&&r.erasable&&r.visible?(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)):this.inverted&&r.visible&&(r.erasable&&r.eraser?(r.eraser.inverted=!0,r.dirty=!0,e.dirty=!0,n.eraser.push(r),n.collection.push(e)):(r.visible=!1,e.dirty=!0,n.visibility.push(r),n.collection.push(e)))},this)},preparePattern:function(){this._patternCanvas||=fabric.util.createCanvasElement();var e=this._patternCanvas;e.width=this.canvas.width,e.height=this.canvas.height;var t=e.getContext(`2d`);if(this.canvas._isRetinaScaling()){var n=this.canvas.getRetinaScaling();this.canvas.__initRetinaScaling(n,e,t)}var r=this.canvas.backgroundImage,i=r&&this._isErasable(r),a=this.canvas.overlayImage,o=a&&this._isErasable(a);if(!this.inverted&&(r&&!i||this.canvas.backgroundColor))i&&(this.canvas.backgroundImage=void 0),this.canvas._renderBackground(t),i&&(this.canvas.backgroundImage=r);else if(this.inverted&&r&&i){var c=this.canvas.backgroundColor;this.canvas.backgroundColor=void 0,this.canvas._renderBackground(t),this.canvas.backgroundColor=c}t.save(),t.transform.apply(t,this.canvas.viewportTransform);var l={visibility:[],eraser:[],collection:[]};if(this._prepareCollectionTraversal(this.canvas,t,l),this.canvas._renderObjects(t,this.canvas._objects),l.visibility.forEach(function(e){e.visible=!0}),l.eraser.forEach(function(e){e.eraser.inverted=!1,e.dirty=!0}),l.collection.forEach(function(e){e.dirty=!0}),t.restore(),!this.inverted&&(a&&!o||this.canvas.overlayColor))o&&(this.canvas.overlayImage=void 0),s.call(this.canvas,t),o&&(this.canvas.overlayImage=a);else if(this.inverted&&a&&o){var c=this.canvas.overlayColor;this.canvas.overlayColor=void 0,s.call(this.canvas,t),this.canvas.overlayColor=c}},_setBrushStyles:function(e){this.callSuper(`_setBrushStyles`,e),e.strokeStyle=`black`},_saveAndTransform:function(e){this.callSuper(`_saveAndTransform`,e),this._setBrushStyles(e),e.globalCompositeOperation=e===this.canvas.getContext()?`destination-out`:`source-over`},needsFullRender:function(){return!0},onMouseDown:function(e,t){this.canvas._isMainEvent(t.e)&&(this._prepareForDrawing(e),this._captureDrawingPath(e),this.preparePattern(),this._isErasing=!0,this.canvas.fire(`erasing:start`),this._render())},_render:function(){var e;this.inverted||(e=this.canvas.getContext(),this.callSuper(`_render`,e)),e=this.canvas.contextTop,this.canvas.clearContext(e),this.callSuper(`_render`,e),e.save();var t=1/this.canvas.getRetinaScaling();e.scale(t,t),e.globalCompositeOperation=`source-in`,e.drawImage(this._patternCanvas,0,0),e.restore()},createPath:function(e){var t=this.callSuper(`createPath`,e);return t.globalCompositeOperation=this.inverted?`source-over`:`destination-out`,t.stroke=this.inverted?`white`:`black`,t},applyClipPathToPath:function(e,t,n){var r=fabric.util.invertTransform(e.calcTransformMatrix()),i=t.calcTransformMatrix(),a=t.absolutePositioned?r:fabric.util.multiplyTransformMatrices(r,n);return t.absolutePositioned=!1,fabric.util.applyTransformToObject(t,fabric.util.multiplyTransformMatrices(a,i)),e.clipPath=e.clipPath?fabric.util.mergeClipPaths(t,e.clipPath):t,e},clonePathWithClipPath:function(e,t,n){var r=t.calcTransformMatrix(),i=t.clipPath,a=this;e.clone(function(e){i.clone(function(t){n(a.applyClipPathToPath(e,t,r))},[`absolutePositioned`,`inverted`])})},_addPathToObjectEraser:function(e,t){var n=this;if(e.forEachObject&&e.erasable===`deep`){var r=e._objects.filter(function(e){return e.erasable});r.length>0&&e.clipPath?this.clonePathWithClipPath(t,e,function(e){r.forEach(function(t){n._addPathToObjectEraser(t,e)})}):r.length>0&&r.forEach(function(e){n._addPathToObjectEraser(e,t)});return}var i=e.eraser;i||(i=new fabric.Eraser,e.eraser=i),t.clone(function(t){var r=fabric.util.multiplyTransformMatrices(fabric.util.invertTransform(e.calcTransformMatrix()),t.calcTransformMatrix());fabric.util.applyTransformToObject(t,r),i.addWithUpdate(t),e.set(`dirty`,!0),e.fire(`erasing:end`,{path:t}),e.group&&Array.isArray(n.__subTargets)&&n.__subTargets.push(e)})},applyEraserToCanvas:function(e){var t=this.canvas,n={};return[`backgroundImage`,`overlayImage`].forEach(function(r){var i=t[r];i&&i.erasable&&(this._addPathToObjectEraser(i,e),n[r]=i)},this),n},_finalizeAndAddPath:function(){var e=this.canvas.contextTop,t=this.canvas;e.closePath(),this.decimate&&(this._points=this.decimatePoints(this._points,this.decimate)),t.clearContext(t.contextTop),this._isErasing=!1;var n=this._points&&this._points.length>1?this.convertPointsToSVGPath(this._points):null;if(!n||this._isEmptySVGPath(n)){t.fire(`erasing:end`),t.requestRenderAll();return}var r=this.createPath(n);r.setCoords(),t.fire(`before:path:created`,{path:r});var i=this.applyEraserToCanvas(r),a=this;this.__subTargets=[];var o=[];t.forEachObject(function(e){e.erasable&&e.intersectsWithObject(r,!0,!0)&&(a._addPathToObjectEraser(e,r),o.push(e))}),t.fire(`erasing:end`,{path:r,targets:o,subTargets:this.__subTargets,drawables:i}),delete this.__subTargets,t.requestRenderAll(),this._resetShadow(),t.fire(`path:created`,{path:r})}})})(),N.enableBoundaryChecking(!1);var uP=class e{constructor(e){if(y(this,`tools`,{}),y(this,`fabric`,null),e.sentryDsn&&Ro({dsn:e.sentryDsn}),b(Zu),!e.selector)throw Error(`Pixie required "selector" option.`);let t=document.querySelector(e.selector);t&&(t.classList.add(`pi`),Lu(t),this.setConfig(e),G.setState({editor:this}),(0,h.createRoot)(t).render((0,m.jsx)(l.default.StrictMode,{children:(0,m.jsx)(lP,{})})))}get state(){return K()}get defaultConfig(){return e.defaultConfig}open(e={}){return new Promise(async t=>{var n;Object.keys(e).length?await this.resetEditor({...ml(e,{ui:{visible:!0},image:e.image||K().config.image,state:e.state||K().config.state,blankCanvasSize:e.blankCanvasSize||K().config.blankCanvasSize})}):(n=K().config.ui)!=null&&n.visible||K().setConfig({ui:{visible:!0}}),t()})}close(){var e,t,n;(e=K().config.ui)!=null&&e.visible&&(this.setConfig({ui:{visible:!1}}),(n=(t=K().config).onClose)==null||n.call(t))}setConfig(e){K().setConfig(e)}uploadAndAddImage(){return q().import.uploadAndAddImage()}uploadAndReplaceMainImage(){return q().import.uploadAndReplaceMainImage()}uploadAndOpenStateFile(){return q().import.uploadAndOpenStateFile()}newCanvas(e,t,n){return q().canvas.openNew(e,t,n)}getState(e){return JSON.stringify(Ju(e))}setState(e){return q().import.loadState(e)}async setStateFromUrl(e){let t=await Ku(e);return q().import.loadState(t)}openTool(e){Yu(e)}applyChanges(){K().applyChanges()}cancelChanges(){K().cancelChanges()}async resetEditor(e){await Gu(e),await q().canvas.loadInitialContent()}togglePanel(e,t){e===`objects`&&K().togglePanel(`history`,!1),e===`history`&&K().togglePanel(`objects`,!1),K().togglePanel(e,t)}on(e,t){var n;(n=this.fabric)==null||n.on(e,t)}isDirty(){return K().dirty}get(e){return this.tools[e]}notify(e){return ad(e)}static init(e){return new Promise(t=>{let n=e.onLoad;e.onLoad=e=>{n?.(e),t(e)},new this(e)})}};y(uP,`defaultConfig`,xs),y(uP,`version`,bs);var dP=uP,fP={text:{replaceDefault:!0,defaultCategory:`handwriting`,items:[{family:`Montserrat Light`,src:`customFonts/Montserrat-Light.woff2`},{family:`Montserrat Regular`,src:`customFonts/Montserrat-Regular.woff2`},{family:`Montserrat Bold`,src:`customFonts/Montserrat-Bold.woff2`},{family:`Montserrat Black`,src:`customFonts/Montserrat-Black.woff2`},{family:`Roboto Light`,src:`customFonts/Roboto-Light.woff2`},{family:`Roboto Regular`,src:`customFonts/Roboto-Regular.woff2`},{family:`Roboto Bold`,src:`customFonts/Roboto-Bold.woff2`},{family:`Roboto Black`,src:`customFonts/Roboto-Black.woff2`},{family:`Lato Light`,src:`customFonts/Lato-Light.woff2`},{family:`Lato Regular`,src:`customFonts/Lato-Regular.woff2`},{family:`Lato Bold`,src:`customFonts/Lato-Bold.woff2`},{family:`Lato Black`,src:`customFonts/Lato-Black.woff2`},{family:`Rubik Light`,src:`customFonts/Rubik-Light.woff2`},{family:`Rubik Regular`,src:`customFonts/Rubik-Regular.woff2`},{family:`Rubik Bold`,src:`customFonts/Rubik-Bold.woff2`},{family:`Rubik Black`,src:`customFonts/Rubik-Black.woff2`},{family:`Bebas Neue Light`,src:`customFonts/BebasNeueLight.woff2`},{family:`Bebas Neue Regular`,src:`customFonts/BebasNeueRegular.woff2`},{family:`Bebas Neue Book`,src:`customFonts/BebasNeueBook.woff2`},{family:`Bebas Neue Bold`,src:`customFonts/BebasNeueBold.woff2`},{family:`Arial`,src:`customFonts/ArialMT.woff2`},{family:`Arial Bold`,src:`customFonts/Arial-BoldMT.woff2`}]}},pP=(e,t=`application/octet-stream`)=>fetch(`data:${t};base64,${e}`).then(e=>e.blob());function mP(e,t){if(e===`json`)return new Blob([t],{type:`application/json`});if(e===`svg`)return new Blob([t],{type:`image/svg+xml`});let n=`image/${e}`;return t=t.replace(/data:image\/([a-z]*)?;base64,/,``),pP(t,n)}var hP=(0,m.jsx)(p.LoadingOutlined,{style:{fontSize:48},spin:!0}),gP=({currentImageLink:e,newLink:t,onSave:n,uploadImageResultIsLoading:r})=>{let c=o.t(),[u,d]=(0,l.useState)(),[h,_]=(0,l.useState)(),{__:v}=s.v(),y=i.en(),b=i.tn(),x=i.$t(s.x),S=i.$t(o.b),C=i.$t(s.ot),w=(0,l.useRef)(!1),[T,E]=(0,l.useState)(),D=s.h(i.Ir.FILE_PROXY_EVENT_ID);(0,l.useEffect)(()=>{(async()=>{let t;try{t=await(await fetch(e)).blob()}catch{if(t=await D.fire({url:e,project:C}).filter(e=>e instanceof Blob)[0],!t){let n=c.get(i._n.em_token)||await i.Rt.getInstance(b,a.n);t=await(await fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${n}`}})).blob()}}if(t){let e=new FileReader;e.onload=()=>{T?.tools.import.openBackgroundImage(u),e.result!==u&&(d(e.result),_(t.type))},e.readAsDataURL(t)}})().catch(e=>console.log(e))},[e,t,d,c,u,T,D,C,b]);let O=(0,l.useCallback)(()=>{d(null),_(null),y(o.i()),y(o.p()),y(o.f(i.Yn.UPLOAD_IMAGE_MODAL))},[y]),k=(0,l.useRef)();k.current=async function(e,t,r){let i=await mP(r,e);n&&n(new File([i],t,{lastModified:new Date().getTime(),type:i.type}))};let A=(0,l.useCallback)(e=>{if(e&&!(w.current&&T)){w.current=!0;let e=x.locale?x.locale.replace(`_`,`-`):`ru-RU`,t=x.theme===`system`?matchMedia(`(prefers-color-scheme: dark)`).matches?i.Dn:i.Un:x.theme;dP.init({selector:`#pixie-editor`,baseUrl:s.t()+`assets/pixie`,image:u,activeLanguage:e,languages:g(e,v),tools:fP,ui:{menubar:{replaceDefaultItems:!0,items:[{type:`undoWidget`,align:`left`},{type:`zoomWidget`,align:`center`,desktopOnly:!0},{type:`button`,icon:(0,m.jsx)(p.HistoryOutlined,{style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:e=>{e.togglePanel(`history`)}},{type:`button`,icon:(0,m.jsx)(p.CloseOutlined,{style:{fontSize:20}}),align:`right`,desktopOnly:!0,action:()=>O()}]},nav:{position:`top`},activeTheme:t,mode:`inline`,forceOverlayModeOnMobile:!1},onSave:async function(e,t,n){k.current(e,t,n)}}).then(e=>{E(e)}).catch(e=>console.log(e))}},[x.theme,u,T,E,x.locale,v,O]),j=(0,l.useCallback)(()=>{T?.tools.export.save(e?.split(`/`).pop().split(`.`)[0],h?.split(`/`)[1])},[T,e,h]);return(0,m.jsxs)(f.Modal,{afterOpenChange:A,width:`100%`,style:{maxWidth:`100%`,minHeight:`100vh`},className:`image-editor-modal blocks-modal`,centered:!0,closable:!1,zIndex:1100,mask:!1,open:S,footer:[(0,m.jsx)(f.Button,{className:`em-analytics__profile-cancel`,onClick:O,children:v(`Cancel`)},`Cancel`),(0,m.jsx)(f.Button,{className:`em-analytics__profile-updapixiete`,id:`save`,type:`primary`,onClick:j,children:v(`Update`)},`Ok`)],children:[r&&(0,m.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,m.jsx)(f.Spin,{size:`large`,indicator:hP})}),(0,m.jsx)(`div`,{id:`pixie-editor`})]})},_P=(0,m.jsx)(p.LoadingOutlined,{style:{fontSize:48},spin:!0}),vP=({currentImageLink:e,newLink:t,onSave:n,uploadImageResultIsLoading:r})=>(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(`div`,{children:(0,m.jsxs)(`div`,{className:`image-preview`,children:[r&&(0,m.jsx)(`div`,{style:{position:`absolute`,height:`100%`,width:`100%`,display:`flex`,alignItems:`center`,justifyContent:`center`,background:`var(--colorBgLayout)`,zIndex:10,opacity:.7},children:(0,m.jsx)(f.Spin,{size:`large`,indicator:_P})}),(t||e)&&(0,m.jsx)(`img`,{alt:`uploadedImage`,src:t||e})]})}),(0,m.jsx)(gP,{currentImageLink:e,newLink:t,onSave:n,uploadImageResultIsLoading:r})]}),yP=function(e,t){return yP=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},yP(e,t)};function bP(e,t){yP(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var xP=function(){return xP=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},xP.apply(this,arguments)};function SP(e,t,n,r){var i,a=!1,o=0;function s(){i&&clearTimeout(i)}function c(){s(),a=!0}typeof t!=`boolean`&&(r=n,n=t,t=void 0);function l(){var c=this,l=Date.now()-o,u=arguments;if(a)return;function d(){o=Date.now(),n.apply(c,u)}function f(){i=void 0}r&&!i&&d(),s(),r===void 0&&l>e?d():t!==!0&&(i=setTimeout(r?f:d,r===void 0?e-l:e))}return l.cancel=c,l}var CP={Pixel:`Pixel`,Percent:`Percent`},wP={unit:CP.Percent,value:.8};function TP(e){return typeof e==`number`?{unit:CP.Percent,value:e*100}:typeof e==`string`?e.match(/^(\d*(\.\d+)?)px$/)?{unit:CP.Pixel,value:parseFloat(e)}:e.match(/^(\d*(\.\d+)?)%$/)?{unit:CP.Percent,value:parseFloat(e)}:wP:wP}var EP=function(e){bP(t,e);function t(t){var n=e.call(this,t)||this;return n.lastScrollTop=0,n.actionTriggered=!1,n.startY=0,n.currentY=0,n.dragging=!1,n.maxPullDownDistance=0,n.getScrollableTarget=function(){return n.props.scrollableTarget instanceof HTMLElement?n.props.scrollableTarget:typeof n.props.scrollableTarget==`string`?document.getElementById(n.props.scrollableTarget):(n.props.scrollableTarget,null)},n.onStart=function(e){n.lastScrollTop||(n.dragging=!0,e instanceof MouseEvent?n.startY=e.pageY:e instanceof TouchEvent&&(n.startY=e.touches[0].pageY),n.currentY=n.startY,n._infScroll&&(n._infScroll.style.willChange=`transform`,n._infScroll.style.transition=`transform 0.2s cubic-bezier(0,0,0.31,1)`))},n.onMove=function(e){n.dragging&&(e instanceof MouseEvent?n.currentY=e.pageY:e instanceof TouchEvent&&(n.currentY=e.touches[0].pageY),!(n.currentY<n.startY)&&(n.currentY-n.startY>=Number(n.props.pullDownToRefreshThreshold)&&n.setState({pullToRefreshThresholdBreached:!0}),!(n.currentY-n.startY>n.maxPullDownDistance*1.5)&&n._infScroll&&(n._infScroll.style.overflow=`visible`,n._infScroll.style.transform=`translate3d(0px, `+(n.currentY-n.startY)+`px, 0px)`)))},n.onEnd=function(){n.startY=0,n.currentY=0,n.dragging=!1,n.state.pullToRefreshThresholdBreached&&(n.props.refreshFunction&&n.props.refreshFunction(),n.setState({pullToRefreshThresholdBreached:!1})),requestAnimationFrame(function(){n._infScroll&&(n._infScroll.style.overflow=`auto`,n._infScroll.style.transform=`none`,n._infScroll.style.willChange=`unset`)})},n.onScrollListener=function(e){typeof n.props.onScroll==`function`&&setTimeout(function(){return n.props.onScroll&&n.props.onScroll(e)},0);var t=n.props.height||n._scrollableNode?e.target:document.documentElement.scrollTop?document.documentElement:document.body;n.actionTriggered||((n.props.inverse?n.isElementAtTop(t,n.props.scrollThreshold):n.isElementAtBottom(t,n.props.scrollThreshold))&&n.props.hasMore&&(n.actionTriggered=!0,n.setState({showLoader:!0}),n.props.next&&n.props.next()),n.lastScrollTop=t.scrollTop)},n.state={showLoader:!1,pullToRefreshThresholdBreached:!1,prevDataLength:t.dataLength},n.throttledOnScrollListener=SP(150,n.onScrollListener).bind(n),n.onStart=n.onStart.bind(n),n.onMove=n.onMove.bind(n),n.onEnd=n.onEnd.bind(n),n}return t.prototype.componentDidMount=function(){if(this.props.dataLength===void 0)throw Error(`mandatory prop "dataLength" is missing. The prop is needed when loading more content. Check README.md for usage`);if(this._scrollableNode=this.getScrollableTarget(),this.el=this.props.height?this._infScroll:this._scrollableNode||window,this.el&&this.el.addEventListener(`scroll`,this.throttledOnScrollListener),typeof this.props.initialScrollY==`number`&&this.el&&this.el instanceof HTMLElement&&this.el.scrollHeight>this.props.initialScrollY&&this.el.scrollTo(0,this.props.initialScrollY),this.props.pullDownToRefresh&&this.el&&(this.el.addEventListener(`touchstart`,this.onStart),this.el.addEventListener(`touchmove`,this.onMove),this.el.addEventListener(`touchend`,this.onEnd),this.el.addEventListener(`mousedown`,this.onStart),this.el.addEventListener(`mousemove`,this.onMove),this.el.addEventListener(`mouseup`,this.onEnd),this.maxPullDownDistance=this._pullDown&&this._pullDown.firstChild&&this._pullDown.firstChild.getBoundingClientRect().height||0,this.forceUpdate(),typeof this.props.refreshFunction!=`function`))throw Error(`Mandatory prop "refreshFunction" missing.
|
|
469
|
+
Pull Down To Refresh functionality will not work
|
|
470
|
+
as expected. Check README.md for usage'`)},t.prototype.componentWillUnmount=function(){this.el&&(this.el.removeEventListener(`scroll`,this.throttledOnScrollListener),this.props.pullDownToRefresh&&(this.el.removeEventListener(`touchstart`,this.onStart),this.el.removeEventListener(`touchmove`,this.onMove),this.el.removeEventListener(`touchend`,this.onEnd),this.el.removeEventListener(`mousedown`,this.onStart),this.el.removeEventListener(`mousemove`,this.onMove),this.el.removeEventListener(`mouseup`,this.onEnd)))},t.prototype.componentDidUpdate=function(e){this.props.dataLength!==e.dataLength&&(this.actionTriggered=!1,this.setState({showLoader:!1}))},t.getDerivedStateFromProps=function(e,t){return e.dataLength===t.prevDataLength?null:xP(xP({},t),{prevDataLength:e.dataLength})},t.prototype.isElementAtTop=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=TP(t);return r.unit===CP.Pixel?e.scrollTop<=r.value+n-e.scrollHeight+1:e.scrollTop<=r.value/100+n-e.scrollHeight+1},t.prototype.isElementAtBottom=function(e,t){t===void 0&&(t=.8);var n=e===document.body||e===document.documentElement?window.screen.availHeight:e.clientHeight,r=TP(t);return r.unit===CP.Pixel?e.scrollTop+n>=e.scrollHeight-r.value:e.scrollTop+n>=r.value/100*e.scrollHeight},t.prototype.render=function(){var e=this,t=xP({height:this.props.height||`auto`,overflow:`auto`,WebkitOverflowScrolling:`touch`},this.props.style),n=this.props.hasChildren||!!(this.props.children&&this.props.children instanceof Array&&this.props.children.length),r=this.props.pullDownToRefresh&&this.props.height?{overflow:`auto`}:{};return l.default.createElement(`div`,{style:r,className:`infinite-scroll-component__outerdiv`},l.default.createElement(`div`,{className:`infinite-scroll-component `+(this.props.className||``),ref:function(t){return e._infScroll=t},style:t},this.props.pullDownToRefresh&&l.default.createElement(`div`,{style:{position:`relative`},ref:function(t){return e._pullDown=t}},l.default.createElement(`div`,{style:{position:`absolute`,left:0,right:0,top:-1*this.maxPullDownDistance}},this.state.pullToRefreshThresholdBreached?this.props.releaseToRefreshContent:this.props.pullDownToRefreshContent)),this.props.children,!this.state.showLoader&&!n&&this.props.hasMore&&this.props.loader,this.state.showLoader&&this.props.hasMore&&this.props.loader,!this.props.hasMore&&this.props.endMessage))},t}(l.Component);function DP(e,t){if(e==null)return{};var n=OP(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i<a.length;i++)r=a[i],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function OP(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a<r.length;a++)i=r[a],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function kP(){return kP=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},kP.apply(this,arguments)}function AP(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function jP(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?AP(Object(n),!0).forEach(function(t){MP(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):AP(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function MP(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var NP={breakpointCols:void 0,className:void 0,columnClassName:void 0,children:void 0,columnAttrs:void 0,column:void 0},PP=2,FP=class extends l.default.Component{constructor(e){super(e),this.reCalculateColumnCount=this.reCalculateColumnCount.bind(this),this.reCalculateColumnCountDebounce=this.reCalculateColumnCountDebounce.bind(this);let t;t=this.props.breakpointCols&&this.props.breakpointCols.default?this.props.breakpointCols.default:parseInt(this.props.breakpointCols)||PP,this.state={columnCount:t}}componentDidMount(){this.reCalculateColumnCount(),window&&window.addEventListener(`resize`,this.reCalculateColumnCountDebounce)}componentDidUpdate(){this.reCalculateColumnCount()}componentWillUnmount(){window&&window.removeEventListener(`resize`,this.reCalculateColumnCountDebounce)}reCalculateColumnCountDebounce(){if(!window||!window.requestAnimationFrame){this.reCalculateColumnCount();return}window.cancelAnimationFrame&&window.cancelAnimationFrame(this._lastRecalculateAnimationFrame),this._lastRecalculateAnimationFrame=window.requestAnimationFrame(()=>{this.reCalculateColumnCount()})}reCalculateColumnCount(){let e=window&&window.innerWidth||1/0,t=this.props.breakpointCols;typeof t!=`object`&&(t={default:parseInt(t)||PP});let n=1/0,r=t.default||PP;for(let i in t){let a=parseInt(i);a>0&&e<=a&&a<n&&(n=a,r=t[i])}r=Math.max(1,parseInt(r)||1),this.state.columnCount!==r&&this.setState({columnCount:r})}itemsInColumns(){let e=this.state.columnCount,t=Array(e),n=l.default.Children.toArray(this.props.children);for(let r=0;r<n.length;r++){let i=r%e;t[i]||(t[i]=[]),t[i].push(n[r])}return t}renderColumns(){let{column:e,columnAttrs:t={},columnClassName:n}=this.props,r=this.itemsInColumns(),i=`${100/r.length}%`,a=n;a&&typeof a!=`string`&&(this.logDeprecated(`The property "columnClassName" requires a string`),a===void 0&&(a=`my-masonry-grid_column`));let o=jP(jP(jP({},e),t),{},{style:jP(jP({},t.style),{},{width:i}),className:a});return r.map((e,t)=>l.default.createElement(`div`,kP({},o,{key:t}),e))}logDeprecated(e){console.error(`[Masonry]`,e)}render(){let e=this.props,{children:t,breakpointCols:n,columnClassName:r,columnAttrs:i,column:a,className:o}=e,s=DP(e,[`children`,`breakpointCols`,`columnClassName`,`columnAttrs`,`column`,`className`]),c=o;return typeof o!=`string`&&(this.logDeprecated(`The property "className" requires a string`),o===void 0&&(c=`my-masonry-grid`)),l.default.createElement(`div`,kP({},s,{className:c}),this.renderColumns())}};FP.defaultProps=NP;var IP=`emailmaker`,LP=({setCurrentImageLink:e,setModalHeight:t,setModalWidth:n,setImageStockList:r,imageStockList:i,currentReq:a,setCurrentReq:u,inputRef:d,setStockLink:h,customRequest:g})=>{let[_,v]=(0,l.useState)(!1),[y,b]=(0,l.useState)(2),{__:x}=s.v(),[S]=o.D(),[C]=o.E(),w=async()=>{_||(v(!0),C({query:a,page:y}).then(e=>{r(t=>[...t,...e.data.results]),v(!1),b(e=>e+1)}).catch(()=>{v(!1)}))};(0,l.useEffect)(()=>{a.keywords!==``&&T()},[a.color,a.orientation]);let T=async()=>{let e=await C({query:a,page:1});e.data.results.length>0&&(r(e.data.results),setTimeout(()=>{n(1060),t(`84vh`)},0))},[E,D]=(0,l.useState)(null),O=(e,t,n)=>{try{let r=new URL(e),i=r.pathname.split(`/`).filter(Boolean),a=i.pop()||``,o=i.join(`/`),s=`https://${r.host}${o?`/`+o:``}`,c=`https://px2.racs.rest/${a}`,l=r.search?r.search.slice(1):``;return`${c}?${`${l?`${l}&w=${t}&q=${n}`:`w=644&q=96`}&proxy_url=${s}`}`}catch{return e}},k=(t,n,r)=>{S(n.download_location),D(r),setTimeout(()=>D(null),2e3),h(`${t.raw}&w=1200&q=96`),e(`${t.raw}&w=1200&q=96`),g(`${t.raw}&w=1200&q=96`)};return(0,m.jsxs)(`div`,{className:`stock-tab`,children:[(0,m.jsxs)(f.Form,{onValuesChange:T,className:i.length>0?`serach-results`:``,children:[(0,m.jsxs)(f.Row,{gutter:24,children:[(0,m.jsx)(f.Col,{span:i.length>0?``:24,children:(0,m.jsx)(f.Form.Item,{className:`stock-search-input`,children:(0,m.jsx)(f.Input,{onKeyDown:e=>e.code===`Space`&&T(),onPressEnter:e=>T(),allowClear:!0,size:i.length>0?`medium`:`large`,placeholder:x(`Search image`),value:a.keywords,onChange:e=>u(t=>({...t,keywords:e.target.value})),ref:d,spellCheck:`false`,suffix:(0,m.jsx)(p.SearchOutlined,{onClick:T,className:`cards-search__search-icon, input-icon`,style:{fontSize:`16px`,cursor:`pointer`}})})})}),i.length>0&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Radio.Group,{defaultValue:``,onChange:e=>u(t=>({...t,orientation:e.target.value})),children:[(0,m.jsx)(f.Tooltip,{title:x(`All`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{value:``,children:(0,m.jsx)(c.c,{icon:`MixedView`})})}),(0,m.jsx)(f.Tooltip,{title:x(`Landscape`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{value:`landscape`,children:(0,m.jsx)(c.c,{icon:`LandscapeView`})})}),(0,m.jsx)(f.Tooltip,{title:x(`Portrait`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{value:`portrait`,children:(0,m.jsx)(c.c,{icon:`PortraitView`})})}),(0,m.jsx)(f.Tooltip,{title:x(`Squarish`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{value:`squarish`,children:(0,m.jsx)(c.c,{icon:`SquareView`})})})]})}),(0,m.jsx)(f.Col,{children:(0,m.jsxs)(f.Radio.Group,{defaultValue:``,className:`stock-color-filter`,onChange:e=>u(t=>({...t,color:e.target.value})),children:[(0,m.jsx)(f.Tooltip,{title:x(`All`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`all-colors`,value:``,children:`All`})}),(0,m.jsx)(f.Tooltip,{title:x(`Black`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`black-color`,value:`black`,children:`B`})}),(0,m.jsx)(f.Tooltip,{title:x(`Black and White`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`bw-color`,value:`black_and_white`,children:`B&§W`})}),(0,m.jsx)(f.Tooltip,{title:x(`White`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`white-color`,value:`white`,children:`W`})}),(0,m.jsx)(f.Tooltip,{title:x(`Orange`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`orange-color`,value:`orange`,children:`O`})}),(0,m.jsx)(f.Tooltip,{title:x(`Red`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`red-color`,value:`red`,children:`R`})}),(0,m.jsx)(f.Tooltip,{title:x(`Purple`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`purple-color`,value:`purple`,children:`P`})}),(0,m.jsx)(f.Tooltip,{title:x(`Magenta`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`magenta-color`,value:`magenta`,children:`M`})}),(0,m.jsx)(f.Tooltip,{title:x(`Green`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`green-color`,value:`green`,children:`G`})}),(0,m.jsx)(f.Tooltip,{title:x(`Teal`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`teal-color`,value:`teal`,children:`T`})}),(0,m.jsx)(f.Tooltip,{title:x(`Blue`),placement:`top`,children:(0,m.jsx)(f.Radio.Button,{className:`blue-color`,value:`blue`,children:`Blue`})})]})})]})]}),i.length>0&&(0,m.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,m.jsx)(`div`,{className:`ant-divider ant-divider-horizontal`,role:`separator`})})]}),(0,m.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:i.length>0&&(0,m.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,m.jsx)(EP,{dataLength:i&&i.length,next:w,hasMore:i,endMessage:(0,m.jsxs)(f.Divider,{plain:!0,children:[x("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:null,children:(0,m.jsx)(FP,{breakpointCols:{default:3},className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:i.map(e=>(0,m.jsxs)(`div`,{className:`list-item`,onClick:()=>k(e.urls,e.links,e.id),children:[(0,m.jsx)(`img`,{className:E===e.id?`loaded-image`:``,width:`322px`,src:O(e.urls.raw,644,96),alt:e.description,onLoad:e=>e.target.parentNode.classList.add(`loaded`)}),(0,m.jsxs)(`p`,{className:`creator-info`,onClick:e=>e.stopPropagation(),children:[`Photo by`,` `,(0,m.jsx)(`a`,{target:`_blank`,href:`${e.user.links.html}?utm_source=${IP}&utm_medium=referral`,rel:`noreferrer`,children:e.user.name}),` `,`on`,` `,(0,m.jsx)(`a`,{target:`_blank`,href:`https://unsplash.com/?utm_source=${IP}&utm_medium=referral`,rel:`noreferrer`,children:`Unsplash`})]}),E===e.id&&(0,m.jsx)(f.Spin,{className:`ant-spin`,indicator:(0,m.jsx)(p.LoadingOutlined,{spin:!0})})]},e.id))})})})})]})},RP=({images:e,transitionDuration:t=1e3})=>{let[n,r]=(0,l.useState)([]);return(0,l.useEffect)(()=>{if(e.length>0){let t=e[e.length-1];r(e=>[...e,{src:t,opacity:0}]),setTimeout(()=>{r(e=>e.map((t,n)=>n===e.length-1?{...t,opacity:1}:t))},1e3)}},[e]),(0,m.jsx)(`div`,{className:`slideshow-container`,children:n.map((e,n)=>(0,m.jsx)(`img`,{src:`data:image/jpeg;base64, ${e.src}`,alt:`Slide ${n+1}`,className:`slideshow-image`,style:{opacity:e.opacity,transition:`opacity ${t}ms linear`}},n))})};function zP({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:r,setIsImageUploaded:a,aiImageRequest:c,imageAiList:u,setImageAiList:f,isLoadingAi:p,setIsLoadingAi:m}){let{__:h}=s.v(),g=i.I(),_=s.i(),v=s.dt(),{emailId:y,blockId:b,projectId:x}=(0,d.useParams)(),[S]=o.O(),[C,{data:w=[]}]=o.C(),T=g?.sendAIImageRequest||S,E=g?.trigger||C,D=g?.handleLimitUsageEmitter||s.h(i.Ir.ON_LIMIT_ID),[O,k]=(0,l.useState)(0),[A,j]=(0,l.useState)(null),[M,N]=(0,l.useState)(!1),[P,ee]=(0,l.useState)(h(`Evaluating the task`)),[F,te]=(0,l.useState)(!1),ne=y||b,{limits:re}=g?.limits?g:{limits:{ai_img_limit:0}},{ai_img_limit:I}=re,ie=I>0&&O>=I,ae=!!(g.limits&&g.counters)&&i.tr.isPlugin,L=(0,l.useCallback)(()=>{D.fire({name:`AiImgCount`,count:O+1})},[D,O]),oe=(0,l.useMemo)(()=>!ie&&(!ae||I===0||O<I),[ie,ae,O,I]),se=(0,l.useCallback)(async()=>{ee(h(`Evaluating the task`)),c!==``&&!p&&(m(!0),te(!0),f([]),v({event:`submit_form`,action:`ai_image_generation`,entity_id:y,project_id:x}),T({body:{project_id:x,request:`create-image`,connection:`midjourney`,message:c}}).then(({data:e,error:t})=>{if(t)throw t;if(e.data.status===401)throw Error(i.Rn);e?.data.status===200?(e?.data.task.id&&(ee(e.data.task.message),j(e.data.task.id)),e.message&&_.success({id:`AI_IMAGE_SEND_SUCCESS`,message:e.message,placement:`bottomRight`,data:c}),E({task_id:e?.data.task.id,entity_id:ne})):(m(!1),te(!1),_.error({id:`AI_IMAGE_SEND_ERROR`,message:e?.message||h(`Something went wrong, please try again`),placement:`bottomRight`,data:c,innerException:e}))}).catch(e=>{m(!1),te(!1),(e?.error||e?.data)&&_.fromError(`AI_IMAGE_SEND_ERROR`,c,e.error||e)}))},[c,p,m,te,f,v,y,x,T,_,E,ne,h]),ce=(0,l.useCallback)(()=>{oe?(ae&&(k(e=>e+1),L()),se()):ae&&_.error({message:h(`The usage limit has been exceeded`),description:h(`The maximum number of requests for the current subscription period has been reached.
|
|
471
|
+
Select the appropriate plan to fulfil more requests`),placement:`bottomRight`})},[oe,ae,k,L,se,_,h]);(0,l.useEffect)(()=>{ae&&k(g?.counters?.ai_img_counter||0)},[g,ae]);let le=(0,l.useCallback)(e=>{if(!r){a(!0);let n=e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);if(!n)return;let r=n[1],i=n[2],o=atob(i),s=Array(o.length);for(let e=0;e<o.length;e++)s[e]=o.charCodeAt(e);let c=new Blob([new Uint8Array(s)],{type:`image/${r}`});t({file:new File([c],`image.jpeg`,{type:c.type})})}},[r,a,t]),ue=(0,l.useCallback)(e=>{e.status!==`error`&&e.status!==`Canceled`?e.images?(ee(e.status),e.progress===100&&(f(e.images),ee(h(`Evaluating the task`)),j(null),te(!1))):(f([e.data]),m(!1)):(m(!1),te(!1),_.error({id:`AI_IMAGE_GET_ERROR`,message:h(`Something went wrong, please try again`),placement:`bottomRight`,data:A}))},[f,ee,h,m,e,A,_,te]);return(0,l.useEffect)(()=>{w.length>1&&ue(w[w.length-1])},[w,ue]),(0,l.useEffect)(()=>{(p||u.length>0)&&setTimeout(()=>{let t=550;n.current&&(t=n.current.offsetHeight+68),e(t)},0)},[n,w,u.length,p,e]),{aiImageCounter:O,setAiImageCounter:k,currentAiImgLimits:I,isFieldsDisabled:ie,canGenerateImage:oe,aiImageRequest:c,imageAiList:u,setImageAiList:f,isLoadingAi:p,setIsLoadingAi:m,loadingDuringGeneration:F,setLoadingDuringGeneration:te,requestStatus:P,setRequestStatus:ee,handleGenerate:ce,handleLimitAiImgCount:L,convertBase64ToFile:le,isShiftPressed:M,setIsShiftPressed:N,currentReqId:A,setCurrentReqId:j,limitsInPlugin:ae}}var BP=(0,l.memo)(({className:e,onClick:t})=>(0,m.jsx)(`div`,{className:`image-ai__arrow image-ai__arrow--next ${e||``}`,onClick:t,children:(0,m.jsx)(f.Button,{className:`image-ai__arrow-btn image-ai__arrow-btn--next`,size:`large`,icon:(0,m.jsx)(p.ArrowRightOutlined,{})})}));BP.displayName=`SampleNextArrow`;var VP=(0,l.memo)(({className:e,onClick:t})=>(0,m.jsx)(`div`,{className:`image-ai__arrow image-ai__arrow--prev ${e||``}`,onClick:t,children:(0,m.jsx)(f.Button,{className:`image-ai__arrow-btn image-ai__arrow-btn--prev`,size:`large`,icon:(0,m.jsx)(p.ArrowLeftOutlined,{})})}));VP.displayName=`SamplePrevArrow`;var HP=({setModalHeight:e,customRequest:t,aiTabRef:n,inputAiRef:r,isImageUploaded:i,setIsImageUploaded:a,aiImageRequest:o,setAiImageRequest:u,imageAiList:d,setImageAiList:h,isLoadingAi:g,setIsLoadingAi:_})=>{let{aiImageCounter:v,currentAiImgLimits:y,loadingDuringGeneration:b,requestStatus:x,handleGenerate:S,convertBase64ToFile:C,isShiftPressed:w,setIsShiftPressed:T,limitsInPlugin:E}=zP({setModalHeight:e,customRequest:t,aiTabRef:n,isImageUploaded:i,setIsImageUploaded:a,aiImageRequest:o,imageAiList:d,setImageAiList:h,isLoadingAi:g,setIsLoadingAi:_}),{__:D}=s.v(),[O,k]=(0,l.useState)(!1),A=(0,l.useCallback)(()=>k(!0),[]),j=(0,l.useCallback)(()=>k(!1),[]),M=(0,l.useCallback)(e=>u(e.target.value),[u]),N=(0,l.useCallback)(e=>{e.key===`Shift`?T(!0):e.key===`Enter`&&!w&&(e.preventDefault(),S())},[w,S,T]),P=(0,l.useCallback)(e=>{e.key===`Shift`&&T(!1)},[T]);return(0,m.jsxs)(`div`,{className:`image-ai`,children:[E&&(0,m.jsx)(c.s,{text:`images`,counter:v,limits:y,wrapperStyles:{marginTop:-25}}),(0,m.jsx)(f.Row,{gutter:24,className:`image-ai__row`,children:(0,m.jsx)(f.Col,{span:24,children:(0,m.jsx)(f.Form.Item,{style:{margin:0},children:(0,m.jsxs)(`span`,{className:`ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${O?` ant-input-affix-wrapper-focused`:``}`,children:[(0,m.jsx)(f.Input.TextArea,{ref:r,onKeyDown:N,onKeyUp:P,onFocus:A,onBlur:j,autoSize:!0,allowClear:!0,className:`text-area-input-hybrid image-ai__textarea`,placeholder:D(`Generate image`),value:o,onChange:M,spellCheck:`false`}),(0,m.jsx)(`span`,{className:`ant-input-suffix image-ai__input-suffix`,children:g||b?(0,m.jsx)(p.LoadingOutlined,{className:`input-icon image-ai__input-icon`,spin:!0}):(0,m.jsx)(c.c,{icon:`AI`,className:`input-icon image-ai__input-icon`,onClick:S})})]})})})}),(g||d.length>0)&&(0,m.jsxs)(f.Carousel,{dotPosition:`top`,arrows:!0,nextArrow:(0,m.jsx)(BP,{}),prevArrow:(0,m.jsx)(VP,{}),className:`image-ai__carousel`,children:[g&&(0,m.jsx)(`div`,{className:`image-ai__loading`,children:(0,m.jsxs)(`div`,{className:`spin`,children:[(0,m.jsx)(p.LoadingOutlined,{style:{fontSize:48},spin:!0}),(0,m.jsx)(`p`,{className:`status`,children:x})]})}),d.length>0&&d.map((e,t)=>(0,m.jsxs)(`div`,{className:`image-ai__image-item`,children:[(0,m.jsx)(RP,{images:d}),(0,m.jsx)(`div`,{className:`buttons`,children:d.length>0&&(0,m.jsx)(f.Button,{onClick:()=>C(`data:image/jpeg;base64, ${e}`),icon:(0,m.jsx)(p.CheckOutlined,{}),children:D(`Use this one`)})})]},t))]})]})},UP=({setNewLink:e,setCurrentImageLink:t,setModalHeight:n,setModalWidth:r,setImageGifList:i,imageGifList:a,currentReqGif:c,setCurrentReqGif:u,inputRef:d,setStockLink:h,customRequest:g})=>{let{__:_}=s.v(),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(!1),[S,C]=(0,l.useState)(25),[w]=o.T(),T=async()=>{b||(x(!0),w({query:c,page:S}).then(e=>{i(t=>[...t,...e.data.data]),x(!1),C(e=>e+25)}).catch(()=>{x(!1)}))},E=async()=>{let e=await w({query:c,page:0});e?.data?.data?.length>0&&(i(e.data.data),setTimeout(()=>{n(`84vh`),r(1060)},0))},D=(e,n)=>{y(n),setTimeout(()=>{y(null)},2e3),h(`${e}`),t(`${e}`),g(`${e}`)},O={default:3},k=(0,m.jsx)(p.LoadingOutlined,{style:{fontSize:20},spin:!0});return(0,m.jsxs)(`div`,{className:`stock-tab`,children:[(0,m.jsxs)(f.Form,{onValuesChange:E,className:a.length>0?`serach-results`:``,children:[(0,m.jsx)(f.Row,{gutter:24,children:(0,m.jsx)(f.Col,{span:a.length>0?``:24,children:(0,m.jsx)(f.Form.Item,{className:`stock-search-input`,children:(0,m.jsx)(f.Input,{onKeyDown:e=>e.code===`Space`&&E(),onPressEnter:e=>E(),allowClear:!0,size:a.length>0?`medium`:`large`,placeholder:_(`Search GIFs`),value:c.keywords,onChange:e=>u(t=>({...t,keywords:e.target.value})),ref:d,spellCheck:`false`,suffix:(0,m.jsx)(p.SearchOutlined,{onClick:E,className:`cards-search__search-icon, input-icon`,style:{fontSize:`16px`,cursor:`pointer`}})})})})}),a.length>0&&(0,m.jsx)(`div`,{className:`blocks-search__divider-wrapper`,children:(0,m.jsx)(`div`,{className:`ant-divider ant-divider-horizontal blocks-search__divider`,role:`separator`})})]}),(0,m.jsx)(`div`,{className:`serach-output-wrapper`,style:{marginRight:-10},children:a.length>0&&(0,m.jsx)(`div`,{id:`scrollableDiv`,style:{width:`100%`,height:`calc(84vh - 148px)`,overflow:`auto`,paddingTop:24,paddingRight:14,paddingLeft:24,marginLeft:-24,lineHeight:`0`,boxSizing:`unset`},children:(0,m.jsx)(EP,{dataLength:a&&a.length,next:T,hasMore:a,endMessage:(0,m.jsxs)(f.Divider,{plain:!0,children:[_("That`s all we could find."),` 🤐`]}),scrollableTarget:`scrollableDiv`,style:{overflow:`visible`},loader:(0,m.jsx)(f.Spin,{indicator:k}),children:(0,m.jsx)(FP,{breakpointCols:O,className:`my-masonry-grid`,columnClassName:`my-masonry-grid_column`,children:a.map((e,t)=>(0,m.jsxs)(`div`,{className:`list-item`,onClick:()=>D(e.images.downsized.url,e.id),children:[(0,m.jsx)(`img`,{className:v===e.id?`loaded-image`:``,width:`322px`,src:`${e.images.downsized.url}`,alt:e.title,onLoad:e=>e.target.parentNode.classList.add(`loaded`)}),(0,m.jsx)(`a`,{rel:`noreferrer`,href:`https://giphy.com/`,target:`_blank`,onClick:e=>e.stopPropagation(),children:(0,m.jsx)(`div`,{className:`overlay-image`,style:{backgroundImage:`url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAkCAYAAAB/up84AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABSBJREFUeNrsWjFv2zoQVoMW8BZ18xaN3qLRW9QtW9OtW92to98vaPoP3K1b1S1b3c2jvWlUNm3lw1s8Mpu3PAo4Iocr70jKlp0COuCQlpKPx/t43x1pv3h8fEwGeT5yNoTgeclLZvza6NgxXoNaGRktjE6MpjC2NVqh92bwt4HxBI1ro0s0dgN2tvD5a8a/9vkq0M+xYKdG81A7Gp6pyBjZddrnO6N36Hkbqyn8u4L3vYC0hjLHeAbPVhC4TwAK/ewNvLsEhyxgFXLK2l/D4tvnOVrUiPEh1k/JjvLYyWENdeTcKazBBr6AdY4AqBTmbkIzhO4gvMumYLxAYKzgPTvhBBajYNwCksHYhOyYiow1KONaKYlfO8bPEWyGEfi5Iu+Vjizg7EzB3xvwWTMxWkHG4mDnMF6BnSnYncLzHWGG4BqiwZkKQMC7I0cOVTCJhvRUKNgNCmCOxhNmrBEWzwGi0Y6rIihbsnOH/JgE2hshKrLZv4Px9yhj1twafRlid/UIGWvlFdlVLirIkIM12nETGLeO2tTPECBUZuT/a7JBMpSxUybYLjulUCN2iEpHQoyuGWZJUCa8R/VGSZvGB0iOdjAO9n8EtC2zUxICSIoW0ICTmA53DCDKQzWZg89XAXZ2B2iMavBnjDKpBX6B1tnAM5aqQgGhnU2D6GmHuqw7AkaOPmP/bsHpFC1kTLqVhglS6fFNgX1MCXUHO1zR1h5AFOoSc1jjmKx/An/1PoBQasBSoZZ3hpyaOrg0IW2sRkG8JsU8CaCaLckAhfi6AG0cmeuzkyMQMtL+SiySkY3oA/EgGeICK0UOZYQKVsQpDAjm2BpsaAGQLMKnMdok3yLtpKS70yT7OUBcm7UTHb5grk5y1Csrj40MqUbUpgW7NXo+RunckODkQvdXM37iwm7b1VA7lAaVB4jUUZOUIzNxfOougAwy3GUN0qWG2IJJ09V2NcvIFE8c54nQelEHFM6C6chUhI+WZjjffDQkrenPhqmlrAC9Naof/aLhXZeNNfMZOk+MtPOVRjNmTpfcCut0+biGZ3PBj1ywWTOfqV3v+yjLFuDPRs8Ddu05vLtmsuHQ0s73wehvR0t7aGkPevfCM5fcGr0MbOW9NSSFwF52cP5KcLIv+X4EUGbCemcOqpoz73/haE4CZNkRjAR20vwENXHRc2bWEMyQuUuGVe4hc6K6rBmg7pKN0XdGX7dts9E3Rr8afUATFl1PqgLAG6T3AoX1nSVtMP9l5r5FVyiu+D14/YssRHOheGVQYNMeinrhsMcV2WVPRR1rIRT4QmiA5r4G6oxp0y6ZzFh4LvhmB84MHz1xta9vWQMrcFR/3iF+7DmEu2YoyTshRbuMvGE9hnwGPQR1tdR04aCueKrqAIgiu/AqcCf1JXPhfuoYosGHn4Hgqa6AnCK4IfSkCa1eCJRxLGnn+mX0rfDOJok4AsQAUpwQlND2++HIgNiOVO1LVRIgtXDPs0bpunEU08vktHLMpoJS1/d9qEo6h6gAzq7RRaPV+QmBeICzUUh2fIHzk0s3HedXwkEy2ReQmjn4XDzDjqkN4D/J04/y/np5KbSrrtbwAyx+kTxdf9tfpvSZIW9O3FScHJAF8PEFc5F2lQzSi5wJheoG3U/t0xYOcgBAcOHuAkr7mY9ditoAiCz2q8uvEcD8gJpSDuGNl5hfnaTJ0/fpheMUr4CitHCO6fqdesj359xh1tWiqggfdUCmcz9ZivZ7+BnQM5P/BRgABx8sJWqTxoYAAAAASUVORK5CYII=)`}})}),v===e.id&&(0,m.jsx)(f.Spin,{className:`ant-spin`,indicator:(0,m.jsx)(p.LoadingOutlined,{spin:!0})})]},e.id+t))})})})})]})},WP=`IMG`,GP=`BACKGROUND`,KP=`GALLERY`,qP=`EDITOR`,JP=`UPLOAD`,YP=`STOCK`,XP=`GIF`,ZP=`AI`,{Dragger:QP}=f.Upload;t.default=()=>{let e=i.I(),{__:t}=s.v(),n=i.en(),{projectId:r}=(0,d.useParams)(),[a,u]=c.S(),[h]=o.w(),{modal:g}=f.App.useApp(),_=s.i(),v=i.$t(s.S),y=i.$t(s.x),b=i.$t(o.v),x=i.$t(o.s),S=i.$t(o.o),[C,w]=(0,l.useState)(``),[T,E]=(0,l.useState)(``),[D,O]=(0,l.useState)(``),[k,A]=(0,l.useState)(``),[j,M]=(0,l.useState)(JP),[N,P]=(0,l.useState)({width:``,height:``,size:``,format:``}),[ee,F]=(0,l.useState)(`success`),[te,ne]=(0,l.useState)(!1),re=l.default.useRef(null),I=l.default.useRef(null),ie=l.default.useRef(null),ae=l.default.useRef(null),L=l.default.useRef(null),oe=l.default.useRef(null),se=l.default.useRef(null),ce=l.default.useRef(null),le=l.default.useRef(null),[ue,de]=(0,l.useState)(`auto`),[fe,pe]=(0,l.useState)(572),[me,he]=(0,l.useState)(null),[ge,_e]=(0,l.useState)(!1),[ve,ye]=(0,l.useState)({keywords:``,color:``,orientation:``}),[be,xe]=(0,l.useState)({keywords:``}),[Se,Ce]=(0,l.useState)([]),[R,we]=(0,l.useState)([]),[Te,Ee]=(0,l.useState)([]),[De,Oe]=(0,l.useState)(!1),[ke,Ae]=(0,l.useState)(``),[je,Me]=(0,l.useState)(!1),[Ne,Pe]=(0,l.useState)(0),Fe=i.$t(s.ot),Ie=s.h(i.Ir.FILE_PROXY_EVENT_ID),Le=!(v||y.id?.toString()!==Fe?.members?.owner.ID),z=e=>{let t=e.target.value;E(t),me&&clearTimeout(me),he(setTimeout(()=>Re(t),1e3))},Re=async e=>{if(e)try{let t=await ze(e);Ve({url:e}),t&&We(t)&&Ge({file:t})}catch(e){console.error(`Ошибка при обработке URL:`,e)}},ze=async e=>{try{let t=(await Ie.fire({url:e,project:Fe})).filter(e=>e instanceof Blob)[0];if(t)return t;let n=`https://api.emailmaker.ru/tools/file-proxy.php?url=${encodeURIComponent(e)}`,r=await fetch(n);if(!r.ok)throw Error(`Server returned ${r.status}`);let i=await r.blob();return new File([i],e.split(`/`).pop(),{type:i.type})}catch(e){console.error(`Ошибка при скачивании файла:`,e)}};document.onpaste=function(t){let n=t.clipboardData.items[0];if(j===JP&&k){if(n?.type?.indexOf(`image`)===0&&e.imageCenterLocalUploadEnabled!==!1){let e=n.getAsFile();We(e);let t={file:e};E(``),Ge(t)}n.type.indexOf(`text`)===0&&n.getAsString(e=>{e.slice(0,4)===`http`?(E(``),w(e),Ve({url:e})):e.toString().slice(1,5)===`meta`&&(E(``),w(e.toString().split(`"`)[1]),Ve({url:e.toString().split(`"`)[1]}))})}};let Be=(0,l.useMemo)(()=>({IMG:x,BACKGROUND:S}),[x,S]);(0,l.useEffect)(()=>{let e=e=>{let t=null;b.includes(`UPLOAD_BACKGROUND_MODAL`)?(t=GP,A(GP)):b.includes(`UPLOAD_IMAGE_MODAL`)&&(A(WP),t=WP),Be[t]&&(w(Be[t]),M(e))};b===i.Yn.UPLOAD_IMAGE_MODAL||b===i.Yn.UPLOAD_BACKGROUND_MODAL?e(qP):b===i.Yn.UPLOAD_IMAGE_MODAL_AI||b===i.Yn.UPLOAD_BACKGROUND_MODAL_AI?(Le?(Me(!0),Pe(2)):e(ZP),setTimeout(()=>le.current?.focus({cursor:`start`}),100)):b===i.Yn.UPLOAD_IMAGE_MODAL_UPLOAD||b===i.Yn.UPLOAD_BACKGROUND_MODAL_UPLOAD?(e(JP),setTimeout(()=>oe.current?.focus({cursor:`start`}),100)):b===i.Yn.UPLOAD_IMAGE_MODAL_STOCK||b===i.Yn.UPLOAD_BACKGROUND_MODAL_STOCK?(Le?(Me(!0),Pe(3)):e(YP),setTimeout(()=>ce.current?.focus({cursor:`start`}),100)):b===i.Yn.UPLOAD_IMAGE_MODAL_GIF||b===i.Yn.UPLOAD_BACKGROUND_MODAL_GIF?(Le?(Me(!0),Pe(3)):e(XP),setTimeout(()=>se.current?.focus({cursor:`start`}),100)):b===i.Yn.UPLOAD_IMAGE_MODAL_EDIT||b===i.Yn.UPLOAD_BACKGROUND_MODAL_EDIT?(Le?(Me(!0),Pe(5)):e(qP),n(o.h(i.Yn.IMAGE_EDITOR_MODAL))):A(``)},[b,n,Le,Be]);let Ve=(0,l.useCallback)(({url:e=C||``})=>{w(e),k===WP&&n(o.u(e)),k===GP&&n(o.l(e)),setTimeout(()=>{ye({keywords:``,color:``,orientation:``}),xe({keywords:``}),we([]),Ce([]),A(``),Ae(``),Oe(!1),O(``),E(``),M(JP)},200),n(o.f()),n(o.p())},[C,n,k]);(0,l.useEffect)(()=>{let e=T||D;e?s.k(e).then(t=>{F(t),pe(572),setTimeout(()=>{let e=0;I.current&&(e=I.current.offsetHeight+62),de(e)},0),Ve(e)}).catch(e=>{F(e)}):F(``)},[T,D,Ve]),(0,l.useEffect)(()=>{C&&h(C).then(({data:e})=>{P({width:e?.width,height:e?.height,size:(e?.fileSize/1024).toFixed(2),format:e?.format})})},[C,h]);let He=()=>{n(o.f()),setTimeout(()=>{w(``),E(``),we([]),we([]),ye({keywords:``,color:``,orientation:``}),xe({keywords:``}),de(`auto`),!De&&Ae(``),pe(572),M(JP)},200)},Ue=e=>{e===KP?g.success({maskClosable:!0,centered:!0,title:t(`Coming soon`),content:t(`The feature is under development.`),okText:t(`Ok. I'll be waiting`),onOk:()=>{}}):e===qP&&C===``?g.warning({maskClosable:!0,centered:!0,title:t(``),content:t(`To preview and edit the uploaded image`),okText:t(`Upload Image`),onOk:()=>{M(JP)}}):(setTimeout(()=>{let t=0,n=0;e===JP&&re.current?(ve.keywords===``&&oe.current?.focus({cursor:`start`}),t=300,n=572):e===qP&&I.current?(t=I.current.offsetHeight+62,n=572):e===YP&&ie.current?(ve.keywords===``&&ce.current?.focus({cursor:`start`}),t=130,n=572,R.length>0&&(n=1060,t=`84vh`)):e===XP&&ae.current?(ve.keywords===``&&se.current?.focus({cursor:`start`}),t=130,n=572,Se.length>0&&(n=1060,t=`84vh`)):e===ZP&&L.current&&(ke===``&&Te.length===0?(le.current?.focus({cursor:`start`}),t=130):t=L.current.offsetHeight+82,n=572),de(t),pe(n)},0),M(e))};(0,l.useEffect)(()=>{ve.keywords===``&&(oe?.current?.focus({cursor:`start`}),we([]),setTimeout(()=>{de(`auto`),pe(572)},0))},[ve,we,de,pe]);let We=e=>{let t=e.type===`image/jpeg`||e.type===`image/png`||e.type===`image/jpg`||e.type===`image/webp`||e.type===`image/gif`||e.type===`image/svg+xml`;return t||_.error({id:`IMAGE_UPLOAD_WRONG_FORMAT`,data:e,message:`Upload`,description:`You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!`}),t},Ge=({file:n})=>{let i=n.type===`image/svg+xml`,o=n.type===`image/webp`,s=async n=>{_e(!0);let r=n.file;try{r.type!==`image/gif`&&(n.file=await c.C(r,{maxSizeMB:e.compressMaxSize||.45,maxWidthOrHeight:e.compressMaxWidthOrHeight||2e3})),a(n).then(({error:e,data:n})=>{if(e)_.fromError(`IMAGE_UPLOAD_ERROR`,r,e);else{let e=c.r(n);e.error?_.error({id:`IMAGE_UPLOAD_ERROR`,data:r,innerException:e.error.status===400?n?.data||n?.[0]?.data:void 0,message:e.error.code||t(`Upload failed`),description:e.error.message||t(`File upload failed with status 400`)}):e.file_url&&(de(`auto`),ne(!1),Ve({url:e.file_url}),_.success({id:`IMAGE_UPLOAD_SUCCESS`,data:r,message:t(`The image was successfully uploaded.`)}))}}).catch(e=>{}).finally(()=>{_e(!1)})}catch(e){console.error(e),_e(!1)}},l=(e,t)=>{let n=new FileReader;n.onload=function(n){let r=n.target.result,i=new Blob([r],{type:`image/svg+xml;charset=utf-8`}),a=URL.createObjectURL(i),o=new Image;o.onload=function(){let n=document.createElement(`canvas`);n.width=o.width*2,n.height=o.height*2,n.getContext(`2d`).drawImage(o,0,0,n.width,n.height),n.toBlob(n=>{t(new File([n],e.name.replace(`.svg`,`.png`),{type:`image/png`})),URL.revokeObjectURL(a)},`image/png`)},o.src=a},n.readAsText(e)},u=(e,t,n=90)=>{let r=new Image;r.src=URL.createObjectURL(e),r.onload=()=>{let e=document.createElement(`canvas`);e.width=r.width,e.height=r.height;let i=e.getContext(`2d`);i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`,i.drawImage(r,0,0,e.width,e.height),e.toBlob(e=>{t(new File([e],`converted.jpg`,{type:`image/jpeg`}))},`image/jpeg`,n/100)},r.onerror=e=>{console.error(`Error loading image:`,e),t(null)}},d=e=>{let t=new Image;t.src=URL.createObjectURL(e),t.onload=()=>{s({user_id:y.id,folder:r,file:e})}};i?l(n,e=>d(e)):o?u(n,e=>d(e)):d(n)},Ke=e=>Ge({file:e}),qe=[{label:t(`Upload`),key:JP,children:(0,m.jsxs)(`div`,{ref:re,style:{paddingBottom:24},children:[e.imageCenterLocalUploadEnabled!==!1&&(0,m.jsxs)(QP,{showUploadList:!1,name:`Image`,beforeUpload:We,customRequest:Ge,style:{marginBottom:10},multiple:!1,accept:`image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml`,children:[(0,m.jsx)(`p`,{className:`ant-upload-drag-icon`,children:(0,m.jsx)(p.InboxOutlined,{})}),(0,m.jsx)(`p`,{className:`ant-upload-text`,children:t(`Click to select, paste from the clipboard, or drag and drop`)}),(0,m.jsx)(`p`,{className:`ant-upload-hint`,children:t(`Accepted formats: PNG, JPG, WEBP, SVG or GIF.`)})]}),(0,m.jsx)(f.Form,{style:{padding:`0 2px 0 2px`},children:(0,m.jsx)(f.Form.Item,{validateStatus:ee,children:(0,m.jsx)(f.Input,{ref:oe,allowClear:!0,size:`large`,placeholder:t(`Paste image URL here`),value:T,onChange:z,spellCheck:`false`})})})]})}];e.imageCenterStockEnabled&&!Le&&qe.push({label:t(`Stock`),key:YP,children:(0,m.jsx)(`div`,{ref:ie,style:{paddingBottom:24},children:(0,m.jsx)(LP,{currentReq:ve,setCurrentReq:ye,imageStockList:R,setImageStockList:we,setModalWidth:pe,setModalHeight:de,setStockLink:O,setCurrentImageLink:w,inputRef:ce,customRequest:Re})})}),e.imageCenterGifEnabled&&!Le&&qe.push({label:t(`GIF`),key:XP,children:(0,m.jsx)(`div`,{ref:ae,style:{paddingBottom:24},children:(0,m.jsx)(UP,{currentReqGif:be,setCurrentReqGif:xe,imageGifList:Se,setImageGifList:Ce,setModalWidth:pe,setModalHeight:de,setStockLink:O,setCurrentImageLink:w,inputRef:se,customRequest:Re})})}),e.elementAIimageEnabled&&!Le&&qe.push({label:t(`AI`),key:ZP,children:(0,m.jsx)(`div`,{ref:L,style:{paddingBottom:24},children:(0,m.jsx)(HP,{setModalHeight:de,customRequest:Ge,aiImageRequest:ke,setAiImageRequest:Ae,imageAiList:Te,setImageAiList:Ee,isLoadingAi:De,setIsLoadingAi:Oe,aiTabRef:L,inputAiRef:le,isImageUploaded:te,setIsImageUploaded:ne})})}),e.imageCenterEditorEnabled&&qe.push({label:``,key:qP,children:(0,m.jsx)(`div`,{ref:I,children:(0,m.jsx)(vP,{currentImageLink:C,newLink:T,imageSize:N,onSave:Ke,uploadImageResultIsLoading:u.isLoading||!1})})});let Je=(0,m.jsx)(p.LoadingOutlined,{style:{fontSize:32,margin:-16},spin:!0});return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(f.Modal,{width:fe,className:`image-center blocks-modal`,title:t(`Image Center`),centered:!0,style:{minHeight:390},open:!!k,onOk:Ve,onCancel:He,footer:j===qP?(0,m.jsx)(m.Fragment,{}):null,children:(0,m.jsx)(f.Spin,{spinning:ge,indicator:Je,children:(0,m.jsx)(f.Tabs,{activeKey:j,onChange:Ue,items:qe,style:{height:ue,minHeight:130}})})}),(0,m.jsx)(o.r,{open:je,onCancel:()=>Me(!1),initialSlide:Ne})]})}});
|