@emailmaker/emailmaker 1.0.107-dev.3 → 1.0.107-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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.aa9efbce.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/4aaa358b2.js +903 -0
- package/static/core/50ff48bc.js +4 -0
- package/static/core/5282795d2.js +6 -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/cec8d739.js +11 -0
- package/static/core/cf45bf332.js +598 -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.aa9efbce.html} +0 -0
- /package/iframe/{iframe.80d62b88.html → iframe.aa9efbce.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
package/static/core/e5bff179.js
DELETED
|
@@ -1,1302 +0,0 @@
|
|
|
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)}})();import { s as e } from "./d6d2d2d0.js";
|
|
2
|
-
import "./4091ba5b.js";
|
|
3
|
-
import { B as t, Bt as n, Ft as r, K as i, P as a, c as o, k as s, r as c, v as l } from "./cdc9ba92.js";
|
|
4
|
-
import { I as u, Rt as d } from "./4ac4908c.js";
|
|
5
|
-
import "./a513adfd.js";
|
|
6
|
-
import { a as f, i as p, r as m } from "./a2fa7b5b.js";
|
|
7
|
-
import { a as h, d as g, i as _, l as v, n as y, r as b, u as x } from "./972b15b0.js";
|
|
8
|
-
import { $t as S, en as C } from "./5fa1772b.js";
|
|
9
|
-
import "./eb029366.js";
|
|
10
|
-
import { O as w, at as T, b as ee, h as te, i as E, t as D, ut as ne, v as O, x as k, xt as A } from "./df1a1225.js";
|
|
11
|
-
import { C as j, D as M, E as N, O as re, T as ie, b as ae, f as P, h as oe, i as F, l as se, o as ce, p as I, r as le, s as L, t as ue, u as de, v as fe, w as pe } from "./3469930c.js";
|
|
12
|
-
import { f as me, o as he, r as ge, s as R } from "./2b250af6.js";
|
|
13
|
-
//#region src/modules/components/ImagePreview/ImagePreview.scss
|
|
14
|
-
var z = /* @__PURE__ */ e(x()), _e = A(), B = /* @__PURE__ */ e(g()), V = /* @__PURE__ */ e(n()), H = v(), U = (e, t = "application/octet-stream") => fetch(`data:${t};base64,${e}`).then((e) => e.blob());
|
|
15
|
-
function ve(e, t) {
|
|
16
|
-
if (e === "json") return new Blob([t], { type: "application/json" });
|
|
17
|
-
if (e === "svg") return new Blob([t], { type: "image/svg+xml" });
|
|
18
|
-
let n = `image/${e}`;
|
|
19
|
-
return t = t.replace(/data:image\/([a-z]*)?;base64,/, ""), U(t, n);
|
|
20
|
-
}
|
|
21
|
-
var ye = /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
22
|
-
style: { fontSize: 48 },
|
|
23
|
-
spin: !0
|
|
24
|
-
}), be = ({ currentImageLink: e, newLink: n, onSave: i, uploadImageResultIsLoading: s }) => {
|
|
25
|
-
let u = ue(), [h, g] = (0, V.useState)(), [v, x] = (0, V.useState)(), { __: S } = O(), C = p(), w = f(), E = m(ee), ne = m(ae), k = m(T), A = (0, V.useRef)(!1), [j, M] = (0, V.useState)(), N = te(r.FILE_PROXY_EVENT_ID);
|
|
26
|
-
(0, V.useEffect)(() => {
|
|
27
|
-
(async () => {
|
|
28
|
-
let t;
|
|
29
|
-
try {
|
|
30
|
-
t = await (await fetch(e)).blob();
|
|
31
|
-
} catch {
|
|
32
|
-
if (t = await N.fire({
|
|
33
|
-
url: e,
|
|
34
|
-
project: k
|
|
35
|
-
}).filter((e) => e instanceof Blob)[0], !t) {
|
|
36
|
-
let n = u.get(o.em_token) || await d.getInstance(w, c);
|
|
37
|
-
t = await (await fetch(`https://app.emailmaker.ru/api/wp-json/cors-proxy/v1/get?url=${encodeURIComponent(e)}`, { headers: { authorization: `Bearer ${n}` } })).blob();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if (t) {
|
|
41
|
-
let e = new FileReader();
|
|
42
|
-
e.onload = () => {
|
|
43
|
-
j?.tools.import.openBackgroundImage(h), e.result !== h && (g(e.result), x(t.type));
|
|
44
|
-
}, e.readAsDataURL(t);
|
|
45
|
-
}
|
|
46
|
-
})().catch((e) => console.log(e));
|
|
47
|
-
}, [
|
|
48
|
-
e,
|
|
49
|
-
n,
|
|
50
|
-
g,
|
|
51
|
-
u,
|
|
52
|
-
h,
|
|
53
|
-
j,
|
|
54
|
-
N,
|
|
55
|
-
k,
|
|
56
|
-
w
|
|
57
|
-
]);
|
|
58
|
-
let re = (0, V.useCallback)(() => {
|
|
59
|
-
g(null), x(null), C(F()), C(I()), C(P(t.UPLOAD_IMAGE_MODAL));
|
|
60
|
-
}, [C]), ie = (0, V.useRef)();
|
|
61
|
-
ie.current = async function(e, t, n) {
|
|
62
|
-
let r = await ve(n, e);
|
|
63
|
-
i && i(new File([r], t, {
|
|
64
|
-
lastModified: (/* @__PURE__ */ new Date()).getTime(),
|
|
65
|
-
type: r.type
|
|
66
|
-
}));
|
|
67
|
-
};
|
|
68
|
-
let oe = (0, V.useCallback)((e) => {
|
|
69
|
-
if (e && !(A.current && j)) {
|
|
70
|
-
A.current = !0;
|
|
71
|
-
let e = E.locale ? E.locale.replace("_", "-") : "ru-RU", t = E.theme === "system" ? matchMedia("(prefers-color-scheme: dark)").matches ? l : a : E.theme;
|
|
72
|
-
b.init({
|
|
73
|
-
selector: "#pixie-editor",
|
|
74
|
-
baseUrl: D() + "assets/pixie",
|
|
75
|
-
image: h,
|
|
76
|
-
activeLanguage: e,
|
|
77
|
-
languages: _(e, S),
|
|
78
|
-
tools: y,
|
|
79
|
-
ui: {
|
|
80
|
-
menubar: {
|
|
81
|
-
replaceDefaultItems: !0,
|
|
82
|
-
items: [
|
|
83
|
-
{
|
|
84
|
-
type: "undoWidget",
|
|
85
|
-
align: "left"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: "zoomWidget",
|
|
89
|
-
align: "center",
|
|
90
|
-
desktopOnly: !0
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
type: "button",
|
|
94
|
-
icon: /* @__PURE__ */ (0, H.jsx)(z.HistoryOutlined, { style: { fontSize: 20 } }),
|
|
95
|
-
align: "right",
|
|
96
|
-
desktopOnly: !0,
|
|
97
|
-
action: (e) => {
|
|
98
|
-
e.togglePanel("history");
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
type: "button",
|
|
103
|
-
icon: /* @__PURE__ */ (0, H.jsx)(z.CloseOutlined, { style: { fontSize: 20 } }),
|
|
104
|
-
align: "right",
|
|
105
|
-
desktopOnly: !0,
|
|
106
|
-
action: () => re()
|
|
107
|
-
}
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
nav: { position: "top" },
|
|
111
|
-
activeTheme: t,
|
|
112
|
-
mode: "inline",
|
|
113
|
-
forceOverlayModeOnMobile: !1
|
|
114
|
-
},
|
|
115
|
-
onSave: async function(e, t, n) {
|
|
116
|
-
ie.current(e, t, n);
|
|
117
|
-
}
|
|
118
|
-
}).then((e) => {
|
|
119
|
-
M(e);
|
|
120
|
-
}).catch((e) => console.log(e));
|
|
121
|
-
}
|
|
122
|
-
}, [
|
|
123
|
-
E.theme,
|
|
124
|
-
h,
|
|
125
|
-
j,
|
|
126
|
-
M,
|
|
127
|
-
E.locale,
|
|
128
|
-
S,
|
|
129
|
-
re
|
|
130
|
-
]), se = (0, V.useCallback)(() => {
|
|
131
|
-
j?.tools.export.save(e?.split("/").pop().split(".")[0], v?.split("/")[1]);
|
|
132
|
-
}, [
|
|
133
|
-
j,
|
|
134
|
-
e,
|
|
135
|
-
v
|
|
136
|
-
]);
|
|
137
|
-
return /* @__PURE__ */ (0, H.jsxs)(B.Modal, {
|
|
138
|
-
afterOpenChange: oe,
|
|
139
|
-
width: "100%",
|
|
140
|
-
style: {
|
|
141
|
-
maxWidth: "100%",
|
|
142
|
-
minHeight: "100vh"
|
|
143
|
-
},
|
|
144
|
-
className: "image-editor-modal blocks-modal",
|
|
145
|
-
centered: !0,
|
|
146
|
-
closable: !1,
|
|
147
|
-
zIndex: 1100,
|
|
148
|
-
mask: !1,
|
|
149
|
-
open: ne,
|
|
150
|
-
footer: [/* @__PURE__ */ (0, H.jsx)(B.Button, {
|
|
151
|
-
className: "em-analytics__profile-cancel",
|
|
152
|
-
onClick: re,
|
|
153
|
-
children: S("Cancel")
|
|
154
|
-
}, "Cancel"), /* @__PURE__ */ (0, H.jsx)(B.Button, {
|
|
155
|
-
className: "em-analytics__profile-updapixiete",
|
|
156
|
-
id: "save",
|
|
157
|
-
type: "primary",
|
|
158
|
-
onClick: se,
|
|
159
|
-
children: S("Update")
|
|
160
|
-
}, "Ok")],
|
|
161
|
-
children: [s && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
162
|
-
style: {
|
|
163
|
-
position: "absolute",
|
|
164
|
-
height: "100%",
|
|
165
|
-
width: "100%",
|
|
166
|
-
display: "flex",
|
|
167
|
-
alignItems: "center",
|
|
168
|
-
justifyContent: "center",
|
|
169
|
-
background: "var(--colorBgLayout)",
|
|
170
|
-
zIndex: 10,
|
|
171
|
-
opacity: .7
|
|
172
|
-
},
|
|
173
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Spin, {
|
|
174
|
-
size: "large",
|
|
175
|
-
indicator: ye
|
|
176
|
-
})
|
|
177
|
-
}), /* @__PURE__ */ (0, H.jsx)("div", { id: "pixie-editor" })]
|
|
178
|
-
});
|
|
179
|
-
}, xe = /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
180
|
-
style: { fontSize: 48 },
|
|
181
|
-
spin: !0
|
|
182
|
-
}), Se = ({ currentImageLink: e, newLink: t, onSave: n, uploadImageResultIsLoading: r }) => /* @__PURE__ */ (0, H.jsxs)(H.Fragment, { children: [/* @__PURE__ */ (0, H.jsx)("div", { children: /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
183
|
-
className: "image-preview",
|
|
184
|
-
children: [r && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
185
|
-
style: {
|
|
186
|
-
position: "absolute",
|
|
187
|
-
height: "100%",
|
|
188
|
-
width: "100%",
|
|
189
|
-
display: "flex",
|
|
190
|
-
alignItems: "center",
|
|
191
|
-
justifyContent: "center",
|
|
192
|
-
background: "var(--colorBgLayout)",
|
|
193
|
-
zIndex: 10,
|
|
194
|
-
opacity: .7
|
|
195
|
-
},
|
|
196
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Spin, {
|
|
197
|
-
size: "large",
|
|
198
|
-
indicator: xe
|
|
199
|
-
})
|
|
200
|
-
}), (t || e) && /* @__PURE__ */ (0, H.jsx)("img", {
|
|
201
|
-
alt: "uploadedImage",
|
|
202
|
-
src: t || e
|
|
203
|
-
})]
|
|
204
|
-
}) }), /* @__PURE__ */ (0, H.jsx)(be, {
|
|
205
|
-
currentImageLink: e,
|
|
206
|
-
newLink: t,
|
|
207
|
-
onSave: n,
|
|
208
|
-
uploadImageResultIsLoading: r
|
|
209
|
-
})] }), W = "emailmaker", Ce = ({ setCurrentImageLink: e, setModalHeight: t, setModalWidth: n, setImageStockList: r, imageStockList: i, currentReq: a, setCurrentReq: o, inputRef: s, setStockLink: c, customRequest: l }) => {
|
|
210
|
-
let [u, d] = (0, V.useState)(!1), [f, p] = (0, V.useState)(2), { __: m } = O(), [h] = M(), [g] = N(), _ = async () => {
|
|
211
|
-
u || (d(!0), g({
|
|
212
|
-
query: a,
|
|
213
|
-
page: f
|
|
214
|
-
}).then((e) => {
|
|
215
|
-
r((t) => [...t, ...e.data.results]), d(!1), p((e) => e + 1);
|
|
216
|
-
}).catch(() => {
|
|
217
|
-
d(!1);
|
|
218
|
-
}));
|
|
219
|
-
};
|
|
220
|
-
(0, V.useEffect)(() => {
|
|
221
|
-
a.keywords !== "" && v();
|
|
222
|
-
}, [a.color, a.orientation]);
|
|
223
|
-
let v = async () => {
|
|
224
|
-
let e = await g({
|
|
225
|
-
query: a,
|
|
226
|
-
page: 1
|
|
227
|
-
});
|
|
228
|
-
e.data.results.length > 0 && (r(e.data.results), setTimeout(() => {
|
|
229
|
-
n(1060), t("84vh");
|
|
230
|
-
}, 0));
|
|
231
|
-
}, [y, b] = (0, V.useState)(null), x = (e, t, n) => {
|
|
232
|
-
try {
|
|
233
|
-
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) : "";
|
|
234
|
-
return `${c}?${`${l ? `${l}&w=${t}&q=${n}` : "w=644&q=96"}&proxy_url=${s}`}`;
|
|
235
|
-
} catch {
|
|
236
|
-
return e;
|
|
237
|
-
}
|
|
238
|
-
}, w = (t, n, r) => {
|
|
239
|
-
h(n.download_location), b(r), setTimeout(() => b(null), 2e3), c(`${t.raw}&w=1200&q=96`), e(`${t.raw}&w=1200&q=96`), l(`${t.raw}&w=1200&q=96`);
|
|
240
|
-
};
|
|
241
|
-
return /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
242
|
-
className: "stock-tab",
|
|
243
|
-
children: [/* @__PURE__ */ (0, H.jsxs)(B.Form, {
|
|
244
|
-
onValuesChange: v,
|
|
245
|
-
className: i.length > 0 ? "serach-results" : "",
|
|
246
|
-
children: [/* @__PURE__ */ (0, H.jsxs)(B.Row, {
|
|
247
|
-
gutter: 24,
|
|
248
|
-
children: [/* @__PURE__ */ (0, H.jsx)(B.Col, {
|
|
249
|
-
span: i.length > 0 ? "" : 24,
|
|
250
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Form.Item, {
|
|
251
|
-
className: "stock-search-input",
|
|
252
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Input, {
|
|
253
|
-
onKeyDown: (e) => e.code === "Space" && v(),
|
|
254
|
-
onPressEnter: (e) => v(),
|
|
255
|
-
allowClear: !0,
|
|
256
|
-
size: i.length > 0 ? "medium" : "large",
|
|
257
|
-
placeholder: m("Search image"),
|
|
258
|
-
value: a.keywords,
|
|
259
|
-
onChange: (e) => o((t) => ({
|
|
260
|
-
...t,
|
|
261
|
-
keywords: e.target.value
|
|
262
|
-
})),
|
|
263
|
-
ref: s,
|
|
264
|
-
spellCheck: "false",
|
|
265
|
-
suffix: /* @__PURE__ */ (0, H.jsx)(z.SearchOutlined, {
|
|
266
|
-
onClick: v,
|
|
267
|
-
className: "cards-search__search-icon, input-icon",
|
|
268
|
-
style: {
|
|
269
|
-
fontSize: "16px",
|
|
270
|
-
cursor: "pointer"
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
})
|
|
274
|
-
})
|
|
275
|
-
}), i.length > 0 && /* @__PURE__ */ (0, H.jsxs)(H.Fragment, { children: [/* @__PURE__ */ (0, H.jsx)(B.Col, { children: /* @__PURE__ */ (0, H.jsxs)(B.Radio.Group, {
|
|
276
|
-
defaultValue: "",
|
|
277
|
-
onChange: (e) => o((t) => ({
|
|
278
|
-
...t,
|
|
279
|
-
orientation: e.target.value
|
|
280
|
-
})),
|
|
281
|
-
children: [
|
|
282
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
283
|
-
title: m("All"),
|
|
284
|
-
placement: "top",
|
|
285
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
286
|
-
value: "",
|
|
287
|
-
children: /* @__PURE__ */ (0, H.jsx)(R, { icon: "MixedView" })
|
|
288
|
-
})
|
|
289
|
-
}),
|
|
290
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
291
|
-
title: m("Landscape"),
|
|
292
|
-
placement: "top",
|
|
293
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
294
|
-
value: "landscape",
|
|
295
|
-
children: /* @__PURE__ */ (0, H.jsx)(R, { icon: "LandscapeView" })
|
|
296
|
-
})
|
|
297
|
-
}),
|
|
298
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
299
|
-
title: m("Portrait"),
|
|
300
|
-
placement: "top",
|
|
301
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
302
|
-
value: "portrait",
|
|
303
|
-
children: /* @__PURE__ */ (0, H.jsx)(R, { icon: "PortraitView" })
|
|
304
|
-
})
|
|
305
|
-
}),
|
|
306
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
307
|
-
title: m("Squarish"),
|
|
308
|
-
placement: "top",
|
|
309
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
310
|
-
value: "squarish",
|
|
311
|
-
children: /* @__PURE__ */ (0, H.jsx)(R, { icon: "SquareView" })
|
|
312
|
-
})
|
|
313
|
-
})
|
|
314
|
-
]
|
|
315
|
-
}) }), /* @__PURE__ */ (0, H.jsx)(B.Col, { children: /* @__PURE__ */ (0, H.jsxs)(B.Radio.Group, {
|
|
316
|
-
defaultValue: "",
|
|
317
|
-
className: "stock-color-filter",
|
|
318
|
-
onChange: (e) => o((t) => ({
|
|
319
|
-
...t,
|
|
320
|
-
color: e.target.value
|
|
321
|
-
})),
|
|
322
|
-
children: [
|
|
323
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
324
|
-
title: m("All"),
|
|
325
|
-
placement: "top",
|
|
326
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
327
|
-
className: "all-colors",
|
|
328
|
-
value: "",
|
|
329
|
-
children: "All"
|
|
330
|
-
})
|
|
331
|
-
}),
|
|
332
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
333
|
-
title: m("Black"),
|
|
334
|
-
placement: "top",
|
|
335
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
336
|
-
className: "black-color",
|
|
337
|
-
value: "black",
|
|
338
|
-
children: "B"
|
|
339
|
-
})
|
|
340
|
-
}),
|
|
341
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
342
|
-
title: m("Black and White"),
|
|
343
|
-
placement: "top",
|
|
344
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
345
|
-
className: "bw-color",
|
|
346
|
-
value: "black_and_white",
|
|
347
|
-
children: "B&§W"
|
|
348
|
-
})
|
|
349
|
-
}),
|
|
350
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
351
|
-
title: m("White"),
|
|
352
|
-
placement: "top",
|
|
353
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
354
|
-
className: "white-color",
|
|
355
|
-
value: "white",
|
|
356
|
-
children: "W"
|
|
357
|
-
})
|
|
358
|
-
}),
|
|
359
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
360
|
-
title: m("Orange"),
|
|
361
|
-
placement: "top",
|
|
362
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
363
|
-
className: "orange-color",
|
|
364
|
-
value: "orange",
|
|
365
|
-
children: "O"
|
|
366
|
-
})
|
|
367
|
-
}),
|
|
368
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
369
|
-
title: m("Red"),
|
|
370
|
-
placement: "top",
|
|
371
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
372
|
-
className: "red-color",
|
|
373
|
-
value: "red",
|
|
374
|
-
children: "R"
|
|
375
|
-
})
|
|
376
|
-
}),
|
|
377
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
378
|
-
title: m("Purple"),
|
|
379
|
-
placement: "top",
|
|
380
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
381
|
-
className: "purple-color",
|
|
382
|
-
value: "purple",
|
|
383
|
-
children: "P"
|
|
384
|
-
})
|
|
385
|
-
}),
|
|
386
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
387
|
-
title: m("Magenta"),
|
|
388
|
-
placement: "top",
|
|
389
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
390
|
-
className: "magenta-color",
|
|
391
|
-
value: "magenta",
|
|
392
|
-
children: "M"
|
|
393
|
-
})
|
|
394
|
-
}),
|
|
395
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
396
|
-
title: m("Green"),
|
|
397
|
-
placement: "top",
|
|
398
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
399
|
-
className: "green-color",
|
|
400
|
-
value: "green",
|
|
401
|
-
children: "G"
|
|
402
|
-
})
|
|
403
|
-
}),
|
|
404
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
405
|
-
title: m("Teal"),
|
|
406
|
-
placement: "top",
|
|
407
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
408
|
-
className: "teal-color",
|
|
409
|
-
value: "teal",
|
|
410
|
-
children: "T"
|
|
411
|
-
})
|
|
412
|
-
}),
|
|
413
|
-
/* @__PURE__ */ (0, H.jsx)(B.Tooltip, {
|
|
414
|
-
title: m("Blue"),
|
|
415
|
-
placement: "top",
|
|
416
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Radio.Button, {
|
|
417
|
-
className: "blue-color",
|
|
418
|
-
value: "blue",
|
|
419
|
-
children: "Blue"
|
|
420
|
-
})
|
|
421
|
-
})
|
|
422
|
-
]
|
|
423
|
-
}) })] })]
|
|
424
|
-
}), i.length > 0 && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
425
|
-
className: "blocks-search__divider-wrapper",
|
|
426
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
427
|
-
className: "ant-divider ant-divider-horizontal",
|
|
428
|
-
role: "separator"
|
|
429
|
-
})
|
|
430
|
-
})]
|
|
431
|
-
}), /* @__PURE__ */ (0, H.jsx)("div", {
|
|
432
|
-
className: "serach-output-wrapper",
|
|
433
|
-
style: { marginRight: -10 },
|
|
434
|
-
children: i.length > 0 && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
435
|
-
id: "scrollableDiv",
|
|
436
|
-
style: {
|
|
437
|
-
width: "100%",
|
|
438
|
-
height: "calc(84vh - 148px)",
|
|
439
|
-
overflow: "auto",
|
|
440
|
-
paddingTop: 24,
|
|
441
|
-
paddingRight: 14,
|
|
442
|
-
paddingLeft: 24,
|
|
443
|
-
marginLeft: -24,
|
|
444
|
-
lineHeight: "0",
|
|
445
|
-
boxSizing: "unset"
|
|
446
|
-
},
|
|
447
|
-
children: /* @__PURE__ */ (0, H.jsx)(C, {
|
|
448
|
-
dataLength: i && i.length,
|
|
449
|
-
next: _,
|
|
450
|
-
hasMore: i,
|
|
451
|
-
endMessage: /* @__PURE__ */ (0, H.jsxs)(B.Divider, {
|
|
452
|
-
plain: !0,
|
|
453
|
-
children: [m("That`s all we could find."), " 🤐"]
|
|
454
|
-
}),
|
|
455
|
-
scrollableTarget: "scrollableDiv",
|
|
456
|
-
style: { overflow: "visible" },
|
|
457
|
-
loader: null,
|
|
458
|
-
children: /* @__PURE__ */ (0, H.jsx)(S, {
|
|
459
|
-
breakpointCols: { default: 3 },
|
|
460
|
-
className: "my-masonry-grid",
|
|
461
|
-
columnClassName: "my-masonry-grid_column",
|
|
462
|
-
children: i.map((e) => /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
463
|
-
className: "list-item",
|
|
464
|
-
onClick: () => w(e.urls, e.links, e.id),
|
|
465
|
-
children: [
|
|
466
|
-
/* @__PURE__ */ (0, H.jsx)("img", {
|
|
467
|
-
className: y === e.id ? "loaded-image" : "",
|
|
468
|
-
width: "322px",
|
|
469
|
-
src: x(e.urls.raw, 644, 96),
|
|
470
|
-
alt: e.description,
|
|
471
|
-
onLoad: (e) => e.target.parentNode.classList.add("loaded")
|
|
472
|
-
}),
|
|
473
|
-
/* @__PURE__ */ (0, H.jsxs)("p", {
|
|
474
|
-
className: "creator-info",
|
|
475
|
-
onClick: (e) => e.stopPropagation(),
|
|
476
|
-
children: [
|
|
477
|
-
"Photo by",
|
|
478
|
-
" ",
|
|
479
|
-
/* @__PURE__ */ (0, H.jsx)("a", {
|
|
480
|
-
target: "_blank",
|
|
481
|
-
href: `${e.user.links.html}?utm_source=${W}&utm_medium=referral`,
|
|
482
|
-
rel: "noreferrer",
|
|
483
|
-
children: e.user.name
|
|
484
|
-
}),
|
|
485
|
-
" ",
|
|
486
|
-
"on",
|
|
487
|
-
" ",
|
|
488
|
-
/* @__PURE__ */ (0, H.jsx)("a", {
|
|
489
|
-
target: "_blank",
|
|
490
|
-
href: `https://unsplash.com/?utm_source=${W}&utm_medium=referral`,
|
|
491
|
-
rel: "noreferrer",
|
|
492
|
-
children: "Unsplash"
|
|
493
|
-
})
|
|
494
|
-
]
|
|
495
|
-
}),
|
|
496
|
-
y === e.id && /* @__PURE__ */ (0, H.jsx)(B.Spin, {
|
|
497
|
-
className: "ant-spin",
|
|
498
|
-
indicator: /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, { spin: !0 })
|
|
499
|
-
})
|
|
500
|
-
]
|
|
501
|
-
}, e.id))
|
|
502
|
-
})
|
|
503
|
-
})
|
|
504
|
-
})
|
|
505
|
-
})]
|
|
506
|
-
});
|
|
507
|
-
}, we = ({ images: e, transitionDuration: t = 1e3 }) => {
|
|
508
|
-
let [n, r] = (0, V.useState)([]);
|
|
509
|
-
return (0, V.useEffect)(() => {
|
|
510
|
-
if (e.length > 0) {
|
|
511
|
-
let t = e[e.length - 1];
|
|
512
|
-
r((e) => [...e, {
|
|
513
|
-
src: t,
|
|
514
|
-
opacity: 0
|
|
515
|
-
}]), setTimeout(() => {
|
|
516
|
-
r((e) => e.map((t, n) => n === e.length - 1 ? {
|
|
517
|
-
...t,
|
|
518
|
-
opacity: 1
|
|
519
|
-
} : t));
|
|
520
|
-
}, 1e3);
|
|
521
|
-
}
|
|
522
|
-
}, [e]), /* @__PURE__ */ (0, H.jsx)("div", {
|
|
523
|
-
className: "slideshow-container",
|
|
524
|
-
children: n.map((e, n) => /* @__PURE__ */ (0, H.jsx)("img", {
|
|
525
|
-
src: `data:image/jpeg;base64, ${e.src}`,
|
|
526
|
-
alt: `Slide ${n + 1}`,
|
|
527
|
-
className: "slideshow-image",
|
|
528
|
-
style: {
|
|
529
|
-
opacity: e.opacity,
|
|
530
|
-
transition: `opacity ${t}ms linear`
|
|
531
|
-
}
|
|
532
|
-
}, n))
|
|
533
|
-
});
|
|
534
|
-
};
|
|
535
|
-
//#endregion
|
|
536
|
-
//#region src/modules/components/ImageAI/useImageAIGeneration.ts
|
|
537
|
-
function Te({ setModalHeight: e, customRequest: t, aiTabRef: n, isImageUploaded: a, setIsImageUploaded: o, aiImageRequest: c, imageAiList: l, setImageAiList: d, isLoadingAi: f, setIsLoadingAi: p }) {
|
|
538
|
-
let { __: m } = O(), h = u(), g = E(), _ = ne(), { emailId: v, blockId: y, projectId: b } = (0, _e.useParams)(), [x] = re(), [S, { data: C = [] }] = j(), w = h?.sendAIImageRequest || x, T = h?.trigger || S, ee = h?.handleLimitUsageEmitter || te(r.ON_LIMIT_ID), [D, k] = (0, V.useState)(0), [A, M] = (0, V.useState)(null), [N, ie] = (0, V.useState)(!1), [ae, P] = (0, V.useState)(m("Evaluating the task")), [oe, F] = (0, V.useState)(!1), se = v || y, { limits: ce } = h?.limits ? h : { limits: { ai_img_limit: 0 } }, { ai_img_limit: I } = ce, le = I > 0 && D >= I, L = !!(h.limits && h.counters) && i.isPlugin, ue = (0, V.useCallback)(() => {
|
|
539
|
-
ee.fire({
|
|
540
|
-
name: "AiImgCount",
|
|
541
|
-
count: D + 1
|
|
542
|
-
});
|
|
543
|
-
}, [ee, D]), de = (0, V.useMemo)(() => !le && (!L || I === 0 || D < I), [
|
|
544
|
-
le,
|
|
545
|
-
L,
|
|
546
|
-
D,
|
|
547
|
-
I
|
|
548
|
-
]), fe = (0, V.useCallback)(async () => {
|
|
549
|
-
P(m("Evaluating the task")), c !== "" && !f && (p(!0), F(!0), d([]), _({
|
|
550
|
-
event: "submit_form",
|
|
551
|
-
action: "ai_image_generation",
|
|
552
|
-
entity_id: v,
|
|
553
|
-
project_id: b
|
|
554
|
-
}), w({ body: {
|
|
555
|
-
project_id: b,
|
|
556
|
-
request: "create-image",
|
|
557
|
-
connection: "midjourney",
|
|
558
|
-
message: c
|
|
559
|
-
} }).then(({ data: e, error: t }) => {
|
|
560
|
-
if (t) throw t;
|
|
561
|
-
if (e.data.status === 401) throw Error(s);
|
|
562
|
-
e?.data.status === 200 ? (e?.data.task.id && (P(e.data.task.message), M(e.data.task.id)), e.message && g.success({
|
|
563
|
-
id: "AI_IMAGE_SEND_SUCCESS",
|
|
564
|
-
message: e.message,
|
|
565
|
-
placement: "bottomRight",
|
|
566
|
-
data: c
|
|
567
|
-
}), T({
|
|
568
|
-
task_id: e?.data.task.id,
|
|
569
|
-
entity_id: se
|
|
570
|
-
})) : (p(!1), F(!1), g.error({
|
|
571
|
-
id: "AI_IMAGE_SEND_ERROR",
|
|
572
|
-
message: e?.message || m("Something went wrong, please try again"),
|
|
573
|
-
placement: "bottomRight",
|
|
574
|
-
data: c,
|
|
575
|
-
innerException: e
|
|
576
|
-
}));
|
|
577
|
-
}).catch((e) => {
|
|
578
|
-
p(!1), F(!1), (e?.error || e?.data) && g.fromError("AI_IMAGE_SEND_ERROR", c, e.error || e);
|
|
579
|
-
}));
|
|
580
|
-
}, [
|
|
581
|
-
c,
|
|
582
|
-
f,
|
|
583
|
-
p,
|
|
584
|
-
F,
|
|
585
|
-
d,
|
|
586
|
-
_,
|
|
587
|
-
v,
|
|
588
|
-
b,
|
|
589
|
-
w,
|
|
590
|
-
g,
|
|
591
|
-
T,
|
|
592
|
-
se,
|
|
593
|
-
m
|
|
594
|
-
]), pe = (0, V.useCallback)(() => {
|
|
595
|
-
de ? (L && (k((e) => e + 1), ue()), fe()) : L && g.error({
|
|
596
|
-
message: m("The usage limit has been exceeded"),
|
|
597
|
-
description: m("The maximum number of requests for the current subscription period has been reached.\nSelect the appropriate plan to fulfil more requests"),
|
|
598
|
-
placement: "bottomRight"
|
|
599
|
-
});
|
|
600
|
-
}, [
|
|
601
|
-
de,
|
|
602
|
-
L,
|
|
603
|
-
k,
|
|
604
|
-
ue,
|
|
605
|
-
fe,
|
|
606
|
-
g,
|
|
607
|
-
m
|
|
608
|
-
]);
|
|
609
|
-
(0, V.useEffect)(() => {
|
|
610
|
-
L && k(h?.counters?.ai_img_counter || 0);
|
|
611
|
-
}, [h, L]);
|
|
612
|
-
let me = (0, V.useCallback)((e) => {
|
|
613
|
-
if (!a) {
|
|
614
|
-
o(!0);
|
|
615
|
-
let n = e.match(/^data:image\/([A-Za-z-+/]+);base64,(.+)$/);
|
|
616
|
-
if (!n) return;
|
|
617
|
-
let r = n[1], i = n[2], a = atob(i), s = Array(a.length);
|
|
618
|
-
for (let e = 0; e < a.length; e++) s[e] = a.charCodeAt(e);
|
|
619
|
-
let c = new Blob([new Uint8Array(s)], { type: `image/${r}` });
|
|
620
|
-
t({ file: new File([c], "image.jpeg", { type: c.type }) });
|
|
621
|
-
}
|
|
622
|
-
}, [
|
|
623
|
-
a,
|
|
624
|
-
o,
|
|
625
|
-
t
|
|
626
|
-
]), he = (0, V.useCallback)((e) => {
|
|
627
|
-
e.status !== "error" && e.status !== "Canceled" ? e.images ? (P(e.status), e.progress === 100 && (d(e.images), P(m("Evaluating the task")), M(null), F(!1))) : (d([e.data]), p(!1)) : (p(!1), F(!1), g.error({
|
|
628
|
-
id: "AI_IMAGE_GET_ERROR",
|
|
629
|
-
message: m("Something went wrong, please try again"),
|
|
630
|
-
placement: "bottomRight",
|
|
631
|
-
data: A
|
|
632
|
-
}));
|
|
633
|
-
}, [
|
|
634
|
-
d,
|
|
635
|
-
P,
|
|
636
|
-
m,
|
|
637
|
-
p,
|
|
638
|
-
e,
|
|
639
|
-
A,
|
|
640
|
-
g,
|
|
641
|
-
F
|
|
642
|
-
]);
|
|
643
|
-
return (0, V.useEffect)(() => {
|
|
644
|
-
C.length > 1 && he(C[C.length - 1]);
|
|
645
|
-
}, [C, he]), (0, V.useEffect)(() => {
|
|
646
|
-
(f || l.length > 0) && setTimeout(() => {
|
|
647
|
-
let t = 550;
|
|
648
|
-
n.current && (t = n.current.offsetHeight + 68), e(t);
|
|
649
|
-
}, 0);
|
|
650
|
-
}, [
|
|
651
|
-
n,
|
|
652
|
-
C,
|
|
653
|
-
l.length,
|
|
654
|
-
f,
|
|
655
|
-
e
|
|
656
|
-
]), {
|
|
657
|
-
aiImageCounter: D,
|
|
658
|
-
setAiImageCounter: k,
|
|
659
|
-
currentAiImgLimits: I,
|
|
660
|
-
isFieldsDisabled: le,
|
|
661
|
-
canGenerateImage: de,
|
|
662
|
-
aiImageRequest: c,
|
|
663
|
-
imageAiList: l,
|
|
664
|
-
setImageAiList: d,
|
|
665
|
-
isLoadingAi: f,
|
|
666
|
-
setIsLoadingAi: p,
|
|
667
|
-
loadingDuringGeneration: oe,
|
|
668
|
-
setLoadingDuringGeneration: F,
|
|
669
|
-
requestStatus: ae,
|
|
670
|
-
setRequestStatus: P,
|
|
671
|
-
handleGenerate: pe,
|
|
672
|
-
handleLimitAiImgCount: ue,
|
|
673
|
-
convertBase64ToFile: me,
|
|
674
|
-
isShiftPressed: N,
|
|
675
|
-
setIsShiftPressed: ie,
|
|
676
|
-
currentReqId: A,
|
|
677
|
-
setCurrentReqId: M,
|
|
678
|
-
limitsInPlugin: L
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
//#endregion
|
|
682
|
-
//#region src/modules/components/ImageAI/ImageAI.tsx
|
|
683
|
-
var Ee = (0, V.memo)(({ className: e, onClick: t }) => /* @__PURE__ */ (0, H.jsx)("div", {
|
|
684
|
-
className: `image-ai__arrow image-ai__arrow--next ${e || ""}`,
|
|
685
|
-
onClick: t,
|
|
686
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Button, {
|
|
687
|
-
className: "image-ai__arrow-btn image-ai__arrow-btn--next",
|
|
688
|
-
size: "large",
|
|
689
|
-
icon: /* @__PURE__ */ (0, H.jsx)(z.ArrowRightOutlined, {})
|
|
690
|
-
})
|
|
691
|
-
}));
|
|
692
|
-
Ee.displayName = "SampleNextArrow";
|
|
693
|
-
var G = (0, V.memo)(({ className: e, onClick: t }) => /* @__PURE__ */ (0, H.jsx)("div", {
|
|
694
|
-
className: `image-ai__arrow image-ai__arrow--prev ${e || ""}`,
|
|
695
|
-
onClick: t,
|
|
696
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Button, {
|
|
697
|
-
className: "image-ai__arrow-btn image-ai__arrow-btn--prev",
|
|
698
|
-
size: "large",
|
|
699
|
-
icon: /* @__PURE__ */ (0, H.jsx)(z.ArrowLeftOutlined, {})
|
|
700
|
-
})
|
|
701
|
-
}));
|
|
702
|
-
G.displayName = "SamplePrevArrow";
|
|
703
|
-
var De = ({ setModalHeight: e, customRequest: t, aiTabRef: n, inputAiRef: r, isImageUploaded: i, setIsImageUploaded: a, aiImageRequest: o, setAiImageRequest: s, imageAiList: c, setImageAiList: l, isLoadingAi: u, setIsLoadingAi: d }) => {
|
|
704
|
-
let { aiImageCounter: f, currentAiImgLimits: p, loadingDuringGeneration: m, requestStatus: h, handleGenerate: g, convertBase64ToFile: _, isShiftPressed: v, setIsShiftPressed: y, limitsInPlugin: b } = Te({
|
|
705
|
-
setModalHeight: e,
|
|
706
|
-
customRequest: t,
|
|
707
|
-
aiTabRef: n,
|
|
708
|
-
isImageUploaded: i,
|
|
709
|
-
setIsImageUploaded: a,
|
|
710
|
-
aiImageRequest: o,
|
|
711
|
-
imageAiList: c,
|
|
712
|
-
setImageAiList: l,
|
|
713
|
-
isLoadingAi: u,
|
|
714
|
-
setIsLoadingAi: d
|
|
715
|
-
}), { __: x } = O(), [S, C] = (0, V.useState)(!1), w = (0, V.useCallback)(() => C(!0), []), T = (0, V.useCallback)(() => C(!1), []), ee = (0, V.useCallback)((e) => s(e.target.value), [s]), te = (0, V.useCallback)((e) => {
|
|
716
|
-
e.key === "Shift" ? y(!0) : e.key === "Enter" && !v && (e.preventDefault(), g());
|
|
717
|
-
}, [
|
|
718
|
-
v,
|
|
719
|
-
g,
|
|
720
|
-
y
|
|
721
|
-
]), E = (0, V.useCallback)((e) => {
|
|
722
|
-
e.key === "Shift" && y(!1);
|
|
723
|
-
}, [y]);
|
|
724
|
-
return /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
725
|
-
className: "image-ai",
|
|
726
|
-
children: [
|
|
727
|
-
b && /* @__PURE__ */ (0, H.jsx)(he, {
|
|
728
|
-
text: "images",
|
|
729
|
-
counter: f,
|
|
730
|
-
limits: p,
|
|
731
|
-
wrapperStyles: { marginTop: -25 }
|
|
732
|
-
}),
|
|
733
|
-
/* @__PURE__ */ (0, H.jsx)(B.Row, {
|
|
734
|
-
gutter: 24,
|
|
735
|
-
className: "image-ai__row",
|
|
736
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Col, {
|
|
737
|
-
span: 24,
|
|
738
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Form.Item, {
|
|
739
|
-
style: { margin: 0 },
|
|
740
|
-
children: /* @__PURE__ */ (0, H.jsxs)("span", {
|
|
741
|
-
className: `ant-input-affix-wrapper ant-input-affix-wrapper-lg image-ai__input-affix-wrapper${S ? " ant-input-affix-wrapper-focused" : ""}`,
|
|
742
|
-
children: [/* @__PURE__ */ (0, H.jsx)(B.Input.TextArea, {
|
|
743
|
-
ref: r,
|
|
744
|
-
onKeyDown: te,
|
|
745
|
-
onKeyUp: E,
|
|
746
|
-
onFocus: w,
|
|
747
|
-
onBlur: T,
|
|
748
|
-
autoSize: !0,
|
|
749
|
-
allowClear: !0,
|
|
750
|
-
className: "text-area-input-hybrid image-ai__textarea",
|
|
751
|
-
placeholder: x("Generate image"),
|
|
752
|
-
value: o,
|
|
753
|
-
onChange: ee,
|
|
754
|
-
spellCheck: "false"
|
|
755
|
-
}), /* @__PURE__ */ (0, H.jsx)("span", {
|
|
756
|
-
className: "ant-input-suffix image-ai__input-suffix",
|
|
757
|
-
children: u || m ? /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
758
|
-
className: "input-icon image-ai__input-icon",
|
|
759
|
-
spin: !0
|
|
760
|
-
}) : /* @__PURE__ */ (0, H.jsx)(R, {
|
|
761
|
-
icon: "AI",
|
|
762
|
-
className: "input-icon image-ai__input-icon",
|
|
763
|
-
onClick: g
|
|
764
|
-
})
|
|
765
|
-
})]
|
|
766
|
-
})
|
|
767
|
-
})
|
|
768
|
-
})
|
|
769
|
-
}),
|
|
770
|
-
(u || c.length > 0) && /* @__PURE__ */ (0, H.jsxs)(B.Carousel, {
|
|
771
|
-
dotPosition: "top",
|
|
772
|
-
arrows: !0,
|
|
773
|
-
nextArrow: /* @__PURE__ */ (0, H.jsx)(Ee, {}),
|
|
774
|
-
prevArrow: /* @__PURE__ */ (0, H.jsx)(G, {}),
|
|
775
|
-
className: "image-ai__carousel",
|
|
776
|
-
children: [u && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
777
|
-
className: "image-ai__loading",
|
|
778
|
-
children: /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
779
|
-
className: "spin",
|
|
780
|
-
children: [/* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
781
|
-
style: { fontSize: 48 },
|
|
782
|
-
spin: !0
|
|
783
|
-
}), /* @__PURE__ */ (0, H.jsx)("p", {
|
|
784
|
-
className: "status",
|
|
785
|
-
children: h
|
|
786
|
-
})]
|
|
787
|
-
})
|
|
788
|
-
}), c.length > 0 && c.map((e, t) => /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
789
|
-
className: "image-ai__image-item",
|
|
790
|
-
children: [/* @__PURE__ */ (0, H.jsx)(we, { images: c }), /* @__PURE__ */ (0, H.jsx)("div", {
|
|
791
|
-
className: "buttons",
|
|
792
|
-
children: c.length > 0 && /* @__PURE__ */ (0, H.jsx)(B.Button, {
|
|
793
|
-
onClick: () => _(`data:image/jpeg;base64, ${e}`),
|
|
794
|
-
icon: /* @__PURE__ */ (0, H.jsx)(z.CheckOutlined, {}),
|
|
795
|
-
children: x("Use this one")
|
|
796
|
-
})
|
|
797
|
-
})]
|
|
798
|
-
}, t))]
|
|
799
|
-
})
|
|
800
|
-
]
|
|
801
|
-
});
|
|
802
|
-
}, Oe = ({ setNewLink: e, setCurrentImageLink: t, setModalHeight: n, setModalWidth: r, setImageGifList: i, imageGifList: a, currentReqGif: o, setCurrentReqGif: s, inputRef: c, setStockLink: l, customRequest: u }) => {
|
|
803
|
-
let { __: d } = O(), [f, p] = (0, V.useState)(null), [m, h] = (0, V.useState)(!1), [g, _] = (0, V.useState)(25), [v] = ie(), y = async () => {
|
|
804
|
-
m || (h(!0), v({
|
|
805
|
-
query: o,
|
|
806
|
-
page: g
|
|
807
|
-
}).then((e) => {
|
|
808
|
-
i((t) => [...t, ...e.data.data]), h(!1), _((e) => e + 25);
|
|
809
|
-
}).catch(() => {
|
|
810
|
-
h(!1);
|
|
811
|
-
}));
|
|
812
|
-
}, b = async () => {
|
|
813
|
-
let e = await v({
|
|
814
|
-
query: o,
|
|
815
|
-
page: 0
|
|
816
|
-
});
|
|
817
|
-
e?.data?.data?.length > 0 && (i(e.data.data), setTimeout(() => {
|
|
818
|
-
n("84vh"), r(1060);
|
|
819
|
-
}, 0));
|
|
820
|
-
}, x = (e, n) => {
|
|
821
|
-
p(n), setTimeout(() => {
|
|
822
|
-
p(null);
|
|
823
|
-
}, 2e3), l(`${e}`), t(`${e}`), u(`${e}`);
|
|
824
|
-
}, w = { default: 3 }, T = /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
825
|
-
style: { fontSize: 20 },
|
|
826
|
-
spin: !0
|
|
827
|
-
});
|
|
828
|
-
return /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
829
|
-
className: "stock-tab",
|
|
830
|
-
children: [/* @__PURE__ */ (0, H.jsxs)(B.Form, {
|
|
831
|
-
onValuesChange: b,
|
|
832
|
-
className: a.length > 0 ? "serach-results" : "",
|
|
833
|
-
children: [/* @__PURE__ */ (0, H.jsx)(B.Row, {
|
|
834
|
-
gutter: 24,
|
|
835
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Col, {
|
|
836
|
-
span: a.length > 0 ? "" : 24,
|
|
837
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Form.Item, {
|
|
838
|
-
className: "stock-search-input",
|
|
839
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Input, {
|
|
840
|
-
onKeyDown: (e) => e.code === "Space" && b(),
|
|
841
|
-
onPressEnter: (e) => b(),
|
|
842
|
-
allowClear: !0,
|
|
843
|
-
size: a.length > 0 ? "medium" : "large",
|
|
844
|
-
placeholder: d("Search GIFs"),
|
|
845
|
-
value: o.keywords,
|
|
846
|
-
onChange: (e) => s((t) => ({
|
|
847
|
-
...t,
|
|
848
|
-
keywords: e.target.value
|
|
849
|
-
})),
|
|
850
|
-
ref: c,
|
|
851
|
-
spellCheck: "false",
|
|
852
|
-
suffix: /* @__PURE__ */ (0, H.jsx)(z.SearchOutlined, {
|
|
853
|
-
onClick: b,
|
|
854
|
-
className: "cards-search__search-icon, input-icon",
|
|
855
|
-
style: {
|
|
856
|
-
fontSize: "16px",
|
|
857
|
-
cursor: "pointer"
|
|
858
|
-
}
|
|
859
|
-
})
|
|
860
|
-
})
|
|
861
|
-
})
|
|
862
|
-
})
|
|
863
|
-
}), a.length > 0 && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
864
|
-
className: "blocks-search__divider-wrapper",
|
|
865
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
866
|
-
className: "ant-divider ant-divider-horizontal blocks-search__divider",
|
|
867
|
-
role: "separator"
|
|
868
|
-
})
|
|
869
|
-
})]
|
|
870
|
-
}), /* @__PURE__ */ (0, H.jsx)("div", {
|
|
871
|
-
className: "serach-output-wrapper",
|
|
872
|
-
style: { marginRight: -10 },
|
|
873
|
-
children: a.length > 0 && /* @__PURE__ */ (0, H.jsx)("div", {
|
|
874
|
-
id: "scrollableDiv",
|
|
875
|
-
style: {
|
|
876
|
-
width: "100%",
|
|
877
|
-
height: "calc(84vh - 148px)",
|
|
878
|
-
overflow: "auto",
|
|
879
|
-
paddingTop: 24,
|
|
880
|
-
paddingRight: 14,
|
|
881
|
-
paddingLeft: 24,
|
|
882
|
-
marginLeft: -24,
|
|
883
|
-
lineHeight: "0",
|
|
884
|
-
boxSizing: "unset"
|
|
885
|
-
},
|
|
886
|
-
children: /* @__PURE__ */ (0, H.jsx)(C, {
|
|
887
|
-
dataLength: a && a.length,
|
|
888
|
-
next: y,
|
|
889
|
-
hasMore: a,
|
|
890
|
-
endMessage: /* @__PURE__ */ (0, H.jsxs)(B.Divider, {
|
|
891
|
-
plain: !0,
|
|
892
|
-
children: [d("That`s all we could find."), " 🤐"]
|
|
893
|
-
}),
|
|
894
|
-
scrollableTarget: "scrollableDiv",
|
|
895
|
-
style: { overflow: "visible" },
|
|
896
|
-
loader: /* @__PURE__ */ (0, H.jsx)(B.Spin, { indicator: T }),
|
|
897
|
-
children: /* @__PURE__ */ (0, H.jsx)(S, {
|
|
898
|
-
breakpointCols: w,
|
|
899
|
-
className: "my-masonry-grid",
|
|
900
|
-
columnClassName: "my-masonry-grid_column",
|
|
901
|
-
children: a.map((e, t) => /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
902
|
-
className: "list-item",
|
|
903
|
-
onClick: () => x(e.images.downsized.url, e.id),
|
|
904
|
-
children: [
|
|
905
|
-
/* @__PURE__ */ (0, H.jsx)("img", {
|
|
906
|
-
className: f === e.id ? "loaded-image" : "",
|
|
907
|
-
width: "322px",
|
|
908
|
-
src: `${e.images.downsized.url}`,
|
|
909
|
-
alt: e.title,
|
|
910
|
-
onLoad: (e) => e.target.parentNode.classList.add("loaded")
|
|
911
|
-
}),
|
|
912
|
-
/* @__PURE__ */ (0, H.jsx)("a", {
|
|
913
|
-
rel: "noreferrer",
|
|
914
|
-
href: "https://giphy.com/",
|
|
915
|
-
target: "_blank",
|
|
916
|
-
onClick: (e) => e.stopPropagation(),
|
|
917
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
918
|
-
className: "overlay-image",
|
|
919
|
-
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=)" }
|
|
920
|
-
})
|
|
921
|
-
}),
|
|
922
|
-
f === e.id && /* @__PURE__ */ (0, H.jsx)(B.Spin, {
|
|
923
|
-
className: "ant-spin",
|
|
924
|
-
indicator: /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, { spin: !0 })
|
|
925
|
-
})
|
|
926
|
-
]
|
|
927
|
-
}, e.id + t))
|
|
928
|
-
})
|
|
929
|
-
})
|
|
930
|
-
})
|
|
931
|
-
})]
|
|
932
|
-
});
|
|
933
|
-
}, ke = "IMG", Ae = "BACKGROUND", je = "GALLERY", K = "EDITOR", q = "UPLOAD", Me = "STOCK", Ne = "GIF", Pe = "AI", { Dragger: Fe } = B.Upload, Ie = () => {
|
|
934
|
-
let e = u(), { __: n } = O(), i = p(), { projectId: a } = (0, _e.useParams)(), [o, s] = me(), [c] = pe(), { modal: l } = B.App.useApp(), d = E(), f = m(k), g = m(ee), _ = m(fe), v = m(L), y = m(ce), [b, x] = (0, V.useState)(""), [S, C] = (0, V.useState)(""), [D, ne] = (0, V.useState)(""), [A, j] = (0, V.useState)(""), [M, N] = (0, V.useState)(q), [re, ie] = (0, V.useState)({
|
|
935
|
-
width: "",
|
|
936
|
-
height: "",
|
|
937
|
-
size: "",
|
|
938
|
-
format: ""
|
|
939
|
-
}), [ae, F] = (0, V.useState)("success"), [ue, he] = (0, V.useState)(!1), R = V.default.useRef(null), U = V.default.useRef(null), ve = V.default.useRef(null), ye = V.default.useRef(null), be = V.default.useRef(null), xe = V.default.useRef(null), W = V.default.useRef(null), we = V.default.useRef(null), Te = V.default.useRef(null), [Ee, G] = (0, V.useState)("auto"), [Ie, J] = (0, V.useState)(572), [Le, Re] = (0, V.useState)(null), [ze, Be] = (0, V.useState)(!1), [Y, Ve] = (0, V.useState)({
|
|
940
|
-
keywords: "",
|
|
941
|
-
color: "",
|
|
942
|
-
orientation: ""
|
|
943
|
-
}), [He, Ue] = (0, V.useState)({ keywords: "" }), [We, Ge] = (0, V.useState)([]), [Ke, X] = (0, V.useState)([]), [qe, Je] = (0, V.useState)([]), [Ye, Xe] = (0, V.useState)(!1), [Ze, Qe] = (0, V.useState)(""), [$e, et] = (0, V.useState)(!1), [tt, nt] = (0, V.useState)(0), rt = m(T), it = te(r.FILE_PROXY_EVENT_ID), Z = !(f || g.id?.toString() !== rt?.members?.owner.ID), at = (e) => {
|
|
944
|
-
let t = e.target.value;
|
|
945
|
-
C(t), Le && clearTimeout(Le), Re(setTimeout(() => ot(t), 1e3));
|
|
946
|
-
}, ot = async (e) => {
|
|
947
|
-
if (e) try {
|
|
948
|
-
let t = await st(e);
|
|
949
|
-
Q({ url: e }), t && dt(t) && ft({ file: t });
|
|
950
|
-
} catch (e) {
|
|
951
|
-
console.error("Ошибка при обработке URL:", e);
|
|
952
|
-
}
|
|
953
|
-
}, st = async (e) => {
|
|
954
|
-
try {
|
|
955
|
-
let t = (await it.fire({
|
|
956
|
-
url: e,
|
|
957
|
-
project: rt
|
|
958
|
-
})).filter((e) => e instanceof Blob)[0];
|
|
959
|
-
if (t) return t;
|
|
960
|
-
let n = `https://api.emailmaker.ru/tools/file-proxy.php?url=${encodeURIComponent(e)}`, r = await fetch(n);
|
|
961
|
-
if (!r.ok) throw Error(`Server returned ${r.status}`);
|
|
962
|
-
let i = await r.blob();
|
|
963
|
-
return new File([i], e.split("/").pop(), { type: i.type });
|
|
964
|
-
} catch (e) {
|
|
965
|
-
console.error("Ошибка при скачивании файла:", e);
|
|
966
|
-
}
|
|
967
|
-
};
|
|
968
|
-
document.onpaste = function(t) {
|
|
969
|
-
let n = t.clipboardData.items[0];
|
|
970
|
-
if (M === q && A) {
|
|
971
|
-
if (n?.type?.indexOf("image") === 0 && e.imageCenterLocalUploadEnabled !== !1) {
|
|
972
|
-
let e = n.getAsFile();
|
|
973
|
-
dt(e);
|
|
974
|
-
let t = { file: e };
|
|
975
|
-
C(""), ft(t);
|
|
976
|
-
}
|
|
977
|
-
n.type.indexOf("text") === 0 && n.getAsString((e) => {
|
|
978
|
-
e.slice(0, 4) === "http" ? (C(""), x(e), Q({ url: e })) : e.toString().slice(1, 5) === "meta" && (C(""), x(e.toString().split("\"")[1]), Q({ url: e.toString().split("\"")[1] }));
|
|
979
|
-
});
|
|
980
|
-
}
|
|
981
|
-
};
|
|
982
|
-
let ct = (0, V.useMemo)(() => ({
|
|
983
|
-
IMG: v,
|
|
984
|
-
BACKGROUND: y
|
|
985
|
-
}), [v, y]);
|
|
986
|
-
(0, V.useEffect)(() => {
|
|
987
|
-
let e = (e) => {
|
|
988
|
-
let t = null;
|
|
989
|
-
_.includes("UPLOAD_BACKGROUND_MODAL") ? (t = Ae, j(Ae)) : _.includes("UPLOAD_IMAGE_MODAL") && (j(ke), t = ke), ct[t] && (x(ct[t]), N(e));
|
|
990
|
-
};
|
|
991
|
-
_ === t.UPLOAD_IMAGE_MODAL || _ === t.UPLOAD_BACKGROUND_MODAL ? e(K) : _ === t.UPLOAD_IMAGE_MODAL_AI || _ === t.UPLOAD_BACKGROUND_MODAL_AI ? (Z ? (et(!0), nt(2)) : e(Pe), setTimeout(() => Te.current?.focus({ cursor: "start" }), 100)) : _ === t.UPLOAD_IMAGE_MODAL_UPLOAD || _ === t.UPLOAD_BACKGROUND_MODAL_UPLOAD ? (e(q), setTimeout(() => xe.current?.focus({ cursor: "start" }), 100)) : _ === t.UPLOAD_IMAGE_MODAL_STOCK || _ === t.UPLOAD_BACKGROUND_MODAL_STOCK ? (Z ? (et(!0), nt(3)) : e(Me), setTimeout(() => we.current?.focus({ cursor: "start" }), 100)) : _ === t.UPLOAD_IMAGE_MODAL_GIF || _ === t.UPLOAD_BACKGROUND_MODAL_GIF ? (Z ? (et(!0), nt(3)) : e(Ne), setTimeout(() => W.current?.focus({ cursor: "start" }), 100)) : _ === t.UPLOAD_IMAGE_MODAL_EDIT || _ === t.UPLOAD_BACKGROUND_MODAL_EDIT ? (Z ? (et(!0), nt(5)) : e(K), i(oe(t.IMAGE_EDITOR_MODAL))) : j("");
|
|
992
|
-
}, [
|
|
993
|
-
_,
|
|
994
|
-
i,
|
|
995
|
-
Z,
|
|
996
|
-
ct
|
|
997
|
-
]);
|
|
998
|
-
let Q = (0, V.useCallback)(({ url: e = b || "" }) => {
|
|
999
|
-
x(e), A === ke && i(de(e)), A === Ae && i(se(e)), setTimeout(() => {
|
|
1000
|
-
Ve({
|
|
1001
|
-
keywords: "",
|
|
1002
|
-
color: "",
|
|
1003
|
-
orientation: ""
|
|
1004
|
-
}), Ue({ keywords: "" }), X([]), Ge([]), j(""), Qe(""), Xe(!1), ne(""), C(""), N(q);
|
|
1005
|
-
}, 200), i(P()), i(I());
|
|
1006
|
-
}, [
|
|
1007
|
-
b,
|
|
1008
|
-
i,
|
|
1009
|
-
A
|
|
1010
|
-
]);
|
|
1011
|
-
(0, V.useEffect)(() => {
|
|
1012
|
-
let e = S || D;
|
|
1013
|
-
e ? w(e).then((t) => {
|
|
1014
|
-
F(t), J(572), setTimeout(() => {
|
|
1015
|
-
let e = 0;
|
|
1016
|
-
U.current && (e = U.current.offsetHeight + 62), G(e);
|
|
1017
|
-
}, 0), Q(e);
|
|
1018
|
-
}).catch((e) => {
|
|
1019
|
-
F(e);
|
|
1020
|
-
}) : F("");
|
|
1021
|
-
}, [
|
|
1022
|
-
S,
|
|
1023
|
-
D,
|
|
1024
|
-
Q
|
|
1025
|
-
]), (0, V.useEffect)(() => {
|
|
1026
|
-
b && c(b).then(({ data: e }) => {
|
|
1027
|
-
ie({
|
|
1028
|
-
width: e?.width,
|
|
1029
|
-
height: e?.height,
|
|
1030
|
-
size: (e?.fileSize / 1024).toFixed(2),
|
|
1031
|
-
format: e?.format
|
|
1032
|
-
});
|
|
1033
|
-
});
|
|
1034
|
-
}, [b, c]);
|
|
1035
|
-
let lt = () => {
|
|
1036
|
-
i(P()), setTimeout(() => {
|
|
1037
|
-
x(""), C(""), X([]), X([]), Ve({
|
|
1038
|
-
keywords: "",
|
|
1039
|
-
color: "",
|
|
1040
|
-
orientation: ""
|
|
1041
|
-
}), Ue({ keywords: "" }), G("auto"), !Ye && Qe(""), J(572), N(q);
|
|
1042
|
-
}, 200);
|
|
1043
|
-
}, ut = (e) => {
|
|
1044
|
-
e === je ? l.success({
|
|
1045
|
-
maskClosable: !0,
|
|
1046
|
-
centered: !0,
|
|
1047
|
-
title: n("Coming soon"),
|
|
1048
|
-
content: n("The feature is under development."),
|
|
1049
|
-
okText: n("Ok. I'll be waiting"),
|
|
1050
|
-
onOk: () => {}
|
|
1051
|
-
}) : e === K && b === "" ? l.warning({
|
|
1052
|
-
maskClosable: !0,
|
|
1053
|
-
centered: !0,
|
|
1054
|
-
title: n(""),
|
|
1055
|
-
content: n("To preview and edit the uploaded image"),
|
|
1056
|
-
okText: n("Upload Image"),
|
|
1057
|
-
onOk: () => {
|
|
1058
|
-
N(q);
|
|
1059
|
-
}
|
|
1060
|
-
}) : (setTimeout(() => {
|
|
1061
|
-
let t = 0, n = 0;
|
|
1062
|
-
e === q && R.current ? (Y.keywords === "" && xe.current?.focus({ cursor: "start" }), t = 300, n = 572) : e === K && U.current ? (t = U.current.offsetHeight + 62, n = 572) : e === Me && ve.current ? (Y.keywords === "" && we.current?.focus({ cursor: "start" }), t = 130, n = 572, Ke.length > 0 && (n = 1060, t = "84vh")) : e === Ne && ye.current ? (Y.keywords === "" && W.current?.focus({ cursor: "start" }), t = 130, n = 572, We.length > 0 && (n = 1060, t = "84vh")) : e === Pe && be.current && (Ze === "" && qe.length === 0 ? (Te.current?.focus({ cursor: "start" }), t = 130) : t = be.current.offsetHeight + 82, n = 572), G(t), J(n);
|
|
1063
|
-
}, 0), N(e));
|
|
1064
|
-
};
|
|
1065
|
-
(0, V.useEffect)(() => {
|
|
1066
|
-
Y.keywords === "" && (xe?.current?.focus({ cursor: "start" }), X([]), setTimeout(() => {
|
|
1067
|
-
G("auto"), J(572);
|
|
1068
|
-
}, 0));
|
|
1069
|
-
}, [
|
|
1070
|
-
Y,
|
|
1071
|
-
X,
|
|
1072
|
-
G,
|
|
1073
|
-
J
|
|
1074
|
-
]);
|
|
1075
|
-
let dt = (e) => {
|
|
1076
|
-
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";
|
|
1077
|
-
return t || d.error({
|
|
1078
|
-
id: "IMAGE_UPLOAD_WRONG_FORMAT",
|
|
1079
|
-
data: e,
|
|
1080
|
-
message: "Upload",
|
|
1081
|
-
description: "You can only upload JPG/JPEG/PNG/WEBP/GIF/SVG file!"
|
|
1082
|
-
}), t;
|
|
1083
|
-
}, ft = ({ file: t }) => {
|
|
1084
|
-
let r = t.type === "image/svg+xml", i = t.type === "image/webp", s = async (t) => {
|
|
1085
|
-
Be(!0);
|
|
1086
|
-
let r = t.file;
|
|
1087
|
-
try {
|
|
1088
|
-
r.type !== "image/gif" && (t.file = await h(r, {
|
|
1089
|
-
maxSizeMB: e.compressMaxSize || .45,
|
|
1090
|
-
maxWidthOrHeight: e.compressMaxWidthOrHeight || 2e3
|
|
1091
|
-
})), o(t).then(({ error: e, data: t }) => {
|
|
1092
|
-
if (e) d.fromError("IMAGE_UPLOAD_ERROR", r, e);
|
|
1093
|
-
else {
|
|
1094
|
-
let e = ge(t);
|
|
1095
|
-
e.error ? d.error({
|
|
1096
|
-
id: "IMAGE_UPLOAD_ERROR",
|
|
1097
|
-
data: r,
|
|
1098
|
-
innerException: e.error.status === 400 ? t?.data || t?.[0]?.data : void 0,
|
|
1099
|
-
message: e.error.code || n("Upload failed"),
|
|
1100
|
-
description: e.error.message || n("File upload failed with status 400")
|
|
1101
|
-
}) : e.file_url && (G("auto"), he(!1), Q({ url: e.file_url }), d.success({
|
|
1102
|
-
id: "IMAGE_UPLOAD_SUCCESS",
|
|
1103
|
-
data: r,
|
|
1104
|
-
message: n("The image was successfully uploaded.")
|
|
1105
|
-
}));
|
|
1106
|
-
}
|
|
1107
|
-
}).catch((e) => {}).finally(() => {
|
|
1108
|
-
Be(!1);
|
|
1109
|
-
});
|
|
1110
|
-
} catch (e) {
|
|
1111
|
-
console.error(e), Be(!1);
|
|
1112
|
-
}
|
|
1113
|
-
}, c = (e, t) => {
|
|
1114
|
-
let n = new FileReader();
|
|
1115
|
-
n.onload = function(n) {
|
|
1116
|
-
let r = n.target.result, i = new Blob([r], { type: "image/svg+xml;charset=utf-8" }), a = URL.createObjectURL(i), o = new Image();
|
|
1117
|
-
o.onload = function() {
|
|
1118
|
-
let n = document.createElement("canvas");
|
|
1119
|
-
n.width = o.width * 2, n.height = o.height * 2, n.getContext("2d").drawImage(o, 0, 0, n.width, n.height), n.toBlob((n) => {
|
|
1120
|
-
t(new File([n], e.name.replace(".svg", ".png"), { type: "image/png" })), URL.revokeObjectURL(a);
|
|
1121
|
-
}, "image/png");
|
|
1122
|
-
}, o.src = a;
|
|
1123
|
-
}, n.readAsText(e);
|
|
1124
|
-
}, l = (e, t, n = 90) => {
|
|
1125
|
-
let r = new Image();
|
|
1126
|
-
r.src = URL.createObjectURL(e), r.onload = () => {
|
|
1127
|
-
let e = document.createElement("canvas");
|
|
1128
|
-
e.width = r.width, e.height = r.height;
|
|
1129
|
-
let i = e.getContext("2d");
|
|
1130
|
-
i.imageSmoothingEnabled = !0, i.imageSmoothingQuality = "high", i.drawImage(r, 0, 0, e.width, e.height), e.toBlob((e) => {
|
|
1131
|
-
t(new File([e], "converted.jpg", { type: "image/jpeg" }));
|
|
1132
|
-
}, "image/jpeg", n / 100);
|
|
1133
|
-
}, r.onerror = (e) => {
|
|
1134
|
-
console.error("Error loading image:", e), t(null);
|
|
1135
|
-
};
|
|
1136
|
-
}, u = (e) => {
|
|
1137
|
-
let t = new Image();
|
|
1138
|
-
t.src = URL.createObjectURL(e), t.onload = () => {
|
|
1139
|
-
s({
|
|
1140
|
-
user_id: g.id,
|
|
1141
|
-
folder: a,
|
|
1142
|
-
file: e
|
|
1143
|
-
});
|
|
1144
|
-
};
|
|
1145
|
-
};
|
|
1146
|
-
r ? c(t, (e) => u(e)) : i ? l(t, (e) => u(e)) : u(t);
|
|
1147
|
-
}, pt = (e) => ft({ file: e }), $ = [{
|
|
1148
|
-
label: n("Upload"),
|
|
1149
|
-
key: q,
|
|
1150
|
-
children: /* @__PURE__ */ (0, H.jsxs)("div", {
|
|
1151
|
-
ref: R,
|
|
1152
|
-
style: { paddingBottom: 24 },
|
|
1153
|
-
children: [e.imageCenterLocalUploadEnabled !== !1 && /* @__PURE__ */ (0, H.jsxs)(Fe, {
|
|
1154
|
-
showUploadList: !1,
|
|
1155
|
-
name: "Image",
|
|
1156
|
-
beforeUpload: dt,
|
|
1157
|
-
customRequest: ft,
|
|
1158
|
-
style: { marginBottom: 10 },
|
|
1159
|
-
multiple: !1,
|
|
1160
|
-
accept: "image/png, image/jpeg, image/jpg, image/webp, image/gif, image/svg+xml",
|
|
1161
|
-
children: [
|
|
1162
|
-
/* @__PURE__ */ (0, H.jsx)("p", {
|
|
1163
|
-
className: "ant-upload-drag-icon",
|
|
1164
|
-
children: /* @__PURE__ */ (0, H.jsx)(z.InboxOutlined, {})
|
|
1165
|
-
}),
|
|
1166
|
-
/* @__PURE__ */ (0, H.jsx)("p", {
|
|
1167
|
-
className: "ant-upload-text",
|
|
1168
|
-
children: n("Click to select, paste from the clipboard, or drag and drop")
|
|
1169
|
-
}),
|
|
1170
|
-
/* @__PURE__ */ (0, H.jsx)("p", {
|
|
1171
|
-
className: "ant-upload-hint",
|
|
1172
|
-
children: n("Accepted formats: PNG, JPG, WEBP, SVG or GIF.")
|
|
1173
|
-
})
|
|
1174
|
-
]
|
|
1175
|
-
}), /* @__PURE__ */ (0, H.jsx)(B.Form, {
|
|
1176
|
-
style: { padding: "0 2px 0 2px" },
|
|
1177
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Form.Item, {
|
|
1178
|
-
validateStatus: ae,
|
|
1179
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Input, {
|
|
1180
|
-
ref: xe,
|
|
1181
|
-
allowClear: !0,
|
|
1182
|
-
size: "large",
|
|
1183
|
-
placeholder: n("Paste image URL here"),
|
|
1184
|
-
value: S,
|
|
1185
|
-
onChange: at,
|
|
1186
|
-
spellCheck: "false"
|
|
1187
|
-
})
|
|
1188
|
-
})
|
|
1189
|
-
})]
|
|
1190
|
-
})
|
|
1191
|
-
}];
|
|
1192
|
-
e.imageCenterStockEnabled && !Z && $.push({
|
|
1193
|
-
label: n("Stock"),
|
|
1194
|
-
key: Me,
|
|
1195
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
1196
|
-
ref: ve,
|
|
1197
|
-
style: { paddingBottom: 24 },
|
|
1198
|
-
children: /* @__PURE__ */ (0, H.jsx)(Ce, {
|
|
1199
|
-
currentReq: Y,
|
|
1200
|
-
setCurrentReq: Ve,
|
|
1201
|
-
imageStockList: Ke,
|
|
1202
|
-
setImageStockList: X,
|
|
1203
|
-
setModalWidth: J,
|
|
1204
|
-
setModalHeight: G,
|
|
1205
|
-
setStockLink: ne,
|
|
1206
|
-
setCurrentImageLink: x,
|
|
1207
|
-
inputRef: we,
|
|
1208
|
-
customRequest: ot
|
|
1209
|
-
})
|
|
1210
|
-
})
|
|
1211
|
-
}), e.imageCenterGifEnabled && !Z && $.push({
|
|
1212
|
-
label: n("GIF"),
|
|
1213
|
-
key: Ne,
|
|
1214
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
1215
|
-
ref: ye,
|
|
1216
|
-
style: { paddingBottom: 24 },
|
|
1217
|
-
children: /* @__PURE__ */ (0, H.jsx)(Oe, {
|
|
1218
|
-
currentReqGif: He,
|
|
1219
|
-
setCurrentReqGif: Ue,
|
|
1220
|
-
imageGifList: We,
|
|
1221
|
-
setImageGifList: Ge,
|
|
1222
|
-
setModalWidth: J,
|
|
1223
|
-
setModalHeight: G,
|
|
1224
|
-
setStockLink: ne,
|
|
1225
|
-
setCurrentImageLink: x,
|
|
1226
|
-
inputRef: W,
|
|
1227
|
-
customRequest: ot
|
|
1228
|
-
})
|
|
1229
|
-
})
|
|
1230
|
-
}), e.elementAIimageEnabled && !Z && $.push({
|
|
1231
|
-
label: n("AI"),
|
|
1232
|
-
key: Pe,
|
|
1233
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
1234
|
-
ref: be,
|
|
1235
|
-
style: { paddingBottom: 24 },
|
|
1236
|
-
children: /* @__PURE__ */ (0, H.jsx)(De, {
|
|
1237
|
-
setModalHeight: G,
|
|
1238
|
-
customRequest: ft,
|
|
1239
|
-
aiImageRequest: Ze,
|
|
1240
|
-
setAiImageRequest: Qe,
|
|
1241
|
-
imageAiList: qe,
|
|
1242
|
-
setImageAiList: Je,
|
|
1243
|
-
isLoadingAi: Ye,
|
|
1244
|
-
setIsLoadingAi: Xe,
|
|
1245
|
-
aiTabRef: be,
|
|
1246
|
-
inputAiRef: Te,
|
|
1247
|
-
isImageUploaded: ue,
|
|
1248
|
-
setIsImageUploaded: he
|
|
1249
|
-
})
|
|
1250
|
-
})
|
|
1251
|
-
}), e.imageCenterEditorEnabled && $.push({
|
|
1252
|
-
label: "",
|
|
1253
|
-
key: K,
|
|
1254
|
-
children: /* @__PURE__ */ (0, H.jsx)("div", {
|
|
1255
|
-
ref: U,
|
|
1256
|
-
children: /* @__PURE__ */ (0, H.jsx)(Se, {
|
|
1257
|
-
currentImageLink: b,
|
|
1258
|
-
newLink: S,
|
|
1259
|
-
imageSize: re,
|
|
1260
|
-
onSave: pt,
|
|
1261
|
-
uploadImageResultIsLoading: s.isLoading || !1
|
|
1262
|
-
})
|
|
1263
|
-
})
|
|
1264
|
-
});
|
|
1265
|
-
let mt = /* @__PURE__ */ (0, H.jsx)(z.LoadingOutlined, {
|
|
1266
|
-
style: {
|
|
1267
|
-
fontSize: 32,
|
|
1268
|
-
margin: -16
|
|
1269
|
-
},
|
|
1270
|
-
spin: !0
|
|
1271
|
-
});
|
|
1272
|
-
return /* @__PURE__ */ (0, H.jsxs)(H.Fragment, { children: [/* @__PURE__ */ (0, H.jsx)(B.Modal, {
|
|
1273
|
-
width: Ie,
|
|
1274
|
-
className: "image-center blocks-modal",
|
|
1275
|
-
title: n("Image Center"),
|
|
1276
|
-
centered: !0,
|
|
1277
|
-
style: { minHeight: 390 },
|
|
1278
|
-
open: !!A,
|
|
1279
|
-
onOk: Q,
|
|
1280
|
-
onCancel: lt,
|
|
1281
|
-
footer: M === K ? /* @__PURE__ */ (0, H.jsx)(H.Fragment, {}) : null,
|
|
1282
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Spin, {
|
|
1283
|
-
spinning: ze,
|
|
1284
|
-
indicator: mt,
|
|
1285
|
-
children: /* @__PURE__ */ (0, H.jsx)(B.Tabs, {
|
|
1286
|
-
activeKey: M,
|
|
1287
|
-
onChange: ut,
|
|
1288
|
-
items: $,
|
|
1289
|
-
style: {
|
|
1290
|
-
height: Ee,
|
|
1291
|
-
minHeight: 130
|
|
1292
|
-
}
|
|
1293
|
-
})
|
|
1294
|
-
})
|
|
1295
|
-
}), /* @__PURE__ */ (0, H.jsx)(le, {
|
|
1296
|
-
open: $e,
|
|
1297
|
-
onCancel: () => et(!1),
|
|
1298
|
-
initialSlide: tt
|
|
1299
|
-
})] });
|
|
1300
|
-
};
|
|
1301
|
-
//#endregion
|
|
1302
|
-
export { Ie as default };
|