@wix/cli-app 1.1.77 → 1.1.78
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/build/{AddPermissionCommand-SVUH6FLA.js → AddPermissionCommand-KLPHA4NW.js} +2 -2
- package/build/{CreateVersionCommand-EHACNST7.js → CreateVersionCommand-N3DC2R3M.js} +11 -11
- package/build/{DevCommand-YTY5HL5B.js → DevCommand-Y4Q7JP4O.js} +23 -13
- package/build/DevCommand-Y4Q7JP4O.js.map +1 -0
- package/build/{GenerateCommand-H5RBUAOO.js → GenerateCommand-NA7CUA6C.js} +6 -6
- package/build/GenerateCommand-NA7CUA6C.js.map +1 -0
- package/build/{LogsCommand-OQ5ZTMPU.js → LogsCommand-HIZEAFSC.js} +4 -4
- package/build/LogsCommand-HIZEAFSC.js.map +1 -0
- package/build/PreviewCommand-TLJWPIJ4.js +20 -0
- package/build/ReleaseCommand-RRCGNQQO.js +30 -0
- package/build/{ServeCommand-5XIDLDRD.js → ServeCommand-O6PLUS6G.js} +11 -11
- package/build/{build-CWK35NP3.js → build-KB2AR55I.js} +6 -6
- package/build/{chunk-AEQRWHOK.js → chunk-4OEXVINX.js} +4 -4
- package/build/{chunk-DTRJYPJ6.js → chunk-4PELKKGA.js} +3 -3
- package/build/{chunk-MQPSPJDT.js → chunk-5U6HXCYR.js} +2 -2
- package/build/{chunk-JC3UWRCF.js → chunk-6CAKKWKU.js} +2 -2
- package/build/{chunk-26XRU4KJ.js → chunk-B3GNRQOK.js} +76 -28
- package/build/{chunk-26XRU4KJ.js.map → chunk-B3GNRQOK.js.map} +1 -1
- package/build/{chunk-NK25TMJC.js → chunk-FM46W7SH.js} +2 -2
- package/build/{chunk-XNGPRKR5.js → chunk-IGZ5ODNO.js} +7 -4
- package/build/{chunk-XNGPRKR5.js.map → chunk-IGZ5ODNO.js.map} +1 -1
- package/build/{chunk-KQXQ2VNQ.js → chunk-J3AQ4ASQ.js} +2 -2
- package/build/{chunk-BDXJ4FYP.js → chunk-JDPWKUTP.js} +2 -2
- package/build/{chunk-3OBCDS57.js → chunk-KJYQFBGE.js} +10 -8
- package/build/{chunk-3OBCDS57.js.map → chunk-KJYQFBGE.js.map} +1 -1
- package/build/{chunk-VOXROGQF.js → chunk-NDDJZNHP.js} +2 -2
- package/build/{chunk-Q6TAXFJ2.js → chunk-P3PY53HC.js} +35 -12
- package/build/{chunk-Q6TAXFJ2.js.map → chunk-P3PY53HC.js.map} +1 -1
- package/build/{chunk-YQ56SFHN.js → chunk-SPSTNPIH.js} +2 -2
- package/build/{chunk-WNJYTBW4.js → chunk-SSESAFQW.js} +4 -4
- package/build/chunk-SSESAFQW.js.map +1 -0
- package/build/{chunk-VHRWAAKM.js → chunk-TQ4ASC3D.js} +4 -4
- package/build/{chunk-QCX62BPJ.js → chunk-XEMGQN6O.js} +2 -2
- package/build/{chunk-IRM3PDR7.js → chunk-YWY23HT5.js} +7 -7
- package/build/index.js +25 -25
- package/build/platform-sdk/editor.js +3 -3
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/{preview-HKDFI7IZ.js → preview-6FYRANJA.js} +13 -13
- package/build/{release-ANN66CA7.js → release-O6HVO2SD.js} +15 -15
- package/build/{render-command-M5NRI7RH.js → render-command-5MD3QGQO.js} +5 -5
- package/package.json +3 -3
- package/build/DevCommand-YTY5HL5B.js.map +0 -1
- package/build/GenerateCommand-H5RBUAOO.js.map +0 -1
- package/build/LogsCommand-OQ5ZTMPU.js.map +0 -1
- package/build/PreviewCommand-UNVH3PH4.js +0 -20
- package/build/ReleaseCommand-TJ527UQO.js +0 -30
- package/build/chunk-WNJYTBW4.js.map +0 -1
- /package/build/{AddPermissionCommand-SVUH6FLA.js.map → AddPermissionCommand-KLPHA4NW.js.map} +0 -0
- /package/build/{CreateVersionCommand-EHACNST7.js.map → CreateVersionCommand-N3DC2R3M.js.map} +0 -0
- /package/build/{PreviewCommand-UNVH3PH4.js.map → PreviewCommand-TLJWPIJ4.js.map} +0 -0
- /package/build/{ReleaseCommand-TJ527UQO.js.map → ReleaseCommand-RRCGNQQO.js.map} +0 -0
- /package/build/{ServeCommand-5XIDLDRD.js.map → ServeCommand-O6PLUS6G.js.map} +0 -0
- /package/build/{build-CWK35NP3.js.map → build-KB2AR55I.js.map} +0 -0
- /package/build/{chunk-AEQRWHOK.js.map → chunk-4OEXVINX.js.map} +0 -0
- /package/build/{chunk-DTRJYPJ6.js.map → chunk-4PELKKGA.js.map} +0 -0
- /package/build/{chunk-MQPSPJDT.js.map → chunk-5U6HXCYR.js.map} +0 -0
- /package/build/{chunk-JC3UWRCF.js.map → chunk-6CAKKWKU.js.map} +0 -0
- /package/build/{chunk-NK25TMJC.js.map → chunk-FM46W7SH.js.map} +0 -0
- /package/build/{chunk-KQXQ2VNQ.js.map → chunk-J3AQ4ASQ.js.map} +0 -0
- /package/build/{chunk-BDXJ4FYP.js.map → chunk-JDPWKUTP.js.map} +0 -0
- /package/build/{chunk-VOXROGQF.js.map → chunk-NDDJZNHP.js.map} +0 -0
- /package/build/{chunk-YQ56SFHN.js.map → chunk-SPSTNPIH.js.map} +0 -0
- /package/build/{chunk-VHRWAAKM.js.map → chunk-TQ4ASC3D.js.map} +0 -0
- /package/build/{chunk-QCX62BPJ.js.map → chunk-XEMGQN6O.js.map} +0 -0
- /package/build/{chunk-IRM3PDR7.js.map → chunk-YWY23HT5.js.map} +0 -0
- /package/build/{preview-HKDFI7IZ.js.map → preview-6FYRANJA.js.map} +0 -0
- /package/build/{release-ANN66CA7.js.map → release-O6HVO2SD.js.map} +0 -0
- /package/build/{render-command-M5NRI7RH.js.map → render-command-5MD3QGQO.js.map} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
createRendererToString,
|
|
6
6
|
isCliError,
|
|
7
7
|
require_react
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-B3GNRQOK.js";
|
|
9
9
|
import {
|
|
10
10
|
__toESM,
|
|
11
11
|
init_esm_shims
|
|
@@ -58,4 +58,4 @@ function createLogger({
|
|
|
58
58
|
export {
|
|
59
59
|
createLogger
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-SPSTNPIH.js.map
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
useResolveDashboardExtensionUrl,
|
|
6
6
|
useResolvePlatformUrl,
|
|
7
7
|
useSite
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-P3PY53HC.js";
|
|
9
9
|
import {
|
|
10
10
|
Box_default,
|
|
11
11
|
CliError,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
require_react,
|
|
22
22
|
useExtensions,
|
|
23
23
|
useTranslation
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-B3GNRQOK.js";
|
|
25
25
|
import {
|
|
26
26
|
__toESM,
|
|
27
27
|
init_esm_shims
|
|
@@ -57,7 +57,7 @@ var PlatformViewer = () => {
|
|
|
57
57
|
const { site } = useSite();
|
|
58
58
|
const resolvePlatformUrl = useResolvePlatformUrl();
|
|
59
59
|
const resolveDashboardExtensionUrl = useResolveDashboardExtensionUrl();
|
|
60
|
-
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, hasSinglePlatform(PlatformType.Dashboard()) ? /* @__PURE__ */ import_react.default.createElement(Box_default, { flexDirection: "row" }, /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "general.open_preview.title_single" }), /* @__PURE__ */ import_react.default.createElement(
|
|
60
|
+
return /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, hasSinglePlatform(PlatformType.Dashboard()) ? dashboardExtensions[0] && /* @__PURE__ */ import_react.default.createElement(Box_default, { flexDirection: "row" }, /* @__PURE__ */ import_react.default.createElement(Trans, { i18nKey: "general.open_preview.title_single" }), /* @__PURE__ */ import_react.default.createElement(
|
|
61
61
|
PlatformLink,
|
|
62
62
|
{
|
|
63
63
|
withPointer: false,
|
|
@@ -89,4 +89,4 @@ export {
|
|
|
89
89
|
assertBuildOutputExists,
|
|
90
90
|
PlatformViewer
|
|
91
91
|
};
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-SSESAFQW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/files/assert-build-output-exists.ts","../src/components/Platform/PlatformViewer.tsx"],"sourcesContent":["import { pathExists } from '@wix/cli-fs';\nimport {\n getAppBuildFolder,\n getAppManifestPath,\n} from '@wix/cli-app-definitions';\nimport { CliErrorCode, CliError } from '@wix/cli-error';\n\nexport async function assertBuildOutputExists(projectFolder: string) {\n const buildFolder = getAppBuildFolder(projectFolder);\n const manifestPath = getAppManifestPath(projectFolder);\n\n if (!(await pathExists(buildFolder)) || !(await pathExists(manifestPath))) {\n throw new CliError({\n code: CliErrorCode.BuiltProjectNeeded(),\n cause: null,\n });\n }\n}\n","import React from 'react';\nimport type { FC } from 'react';\nimport { Trans, useTranslation } from '@wix/cli-i18n';\nimport { Box, Link, PointerSmallIcon, Text } from '@wix/cli-ui-kit';\nimport { PlatformType } from '@wix/cli-app-definitions';\nimport { useExtensions } from '../extensions/useExtensions.js';\nimport {\n useResolveDashboardExtensionUrl,\n useResolvePlatformUrl,\n} from '../extensions/utils.js';\nimport { usePlatform } from './usePlatform.js';\nimport { useSite } from '../../site/useSite.js';\n\ninterface PlatformLinkProps {\n url: string;\n label: string;\n withPointer?: boolean;\n}\n\nconst PlatformLink: FC<PlatformLinkProps> = ({\n url,\n label,\n withPointer = true,\n}) => {\n return (\n <Box>\n <Box marginRight={1}>\n {withPointer && <PointerSmallIcon />}\n <Box marginLeft={1}>\n <Link url={url}>{label}</Link>\n </Box>\n </Box>\n </Box>\n );\n};\n\nexport const PlatformViewer: FC = () => {\n const { t } = useTranslation();\n const { isPlatformExists, hasSinglePlatform } = usePlatform();\n const { dashboardExtensions } = useExtensions();\n const { site } = useSite();\n const resolvePlatformUrl = useResolvePlatformUrl();\n const resolveDashboardExtensionUrl = useResolveDashboardExtensionUrl();\n\n return (\n <>\n {hasSinglePlatform(PlatformType.Dashboard()) ? (\n dashboardExtensions[0] && (\n <Box flexDirection=\"row\">\n <Trans i18nKey=\"general.open_preview.title_single\" />\n <PlatformLink\n withPointer={false}\n url={resolveDashboardExtensionUrl(dashboardExtensions[0])}\n label={t('general.platform.dashboard')}\n />\n </Box>\n )\n ) : (\n <Box flexDirection=\"column\">\n <Trans i18nKey=\"general.open_preview.title_multiple\" />\n <Box paddingLeft={2} flexDirection=\"column\">\n {isPlatformExists(PlatformType.Site()) &&\n (site.viewUrl ? (\n <PlatformLink\n url={resolvePlatformUrl(PlatformType.Site())}\n label={t('general.platform.site')}\n />\n ) : (\n <Box marginRight={1}>\n <PointerSmallIcon />\n <Box marginLeft={1}>\n <Text skin=\"secondary\" underline>\n {t('general.platform.unpublished_site')}\n </Text>\n </Box>\n </Box>\n ))}\n {isPlatformExists(PlatformType.Editor()) && (\n <PlatformLink\n url={resolvePlatformUrl(PlatformType.Editor())}\n label={t('general.platform.editor')}\n />\n )}\n {isPlatformExists(PlatformType.Dashboard()) && (\n <PlatformLink\n url={resolveDashboardExtensionUrl(dashboardExtensions[0]!)}\n label={t('general.platform.dashboard')}\n />\n )}\n </Box>\n </Box>\n )}\n </>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAOA,eAAsB,wBAAwB,eAAuB;AACnE,QAAM,cAAc,kBAAkB,aAAa;AACnD,QAAM,eAAe,mBAAmB,aAAa;AAErD,MAAI,CAAE,MAAM,WAAW,WAAW,KAAM,CAAE,MAAM,WAAW,YAAY,GAAI;AACzE,UAAM,IAAI,SAAS;AAAA,MACjB,MAAM,aAAa,mBAAmB;AAAA,MACtC,OAAO;AAAA,IACT,CAAC;AAAA,EACH;AACF;;;ACjBA;AAAA,mBAAkB;AAmBlB,IAAM,eAAsC,CAAC;AAAA,EAC3C;AAAA,EACA;AAAA,EACA,cAAc;AAChB,MAAM;AACJ,SACE,6BAAAA,QAAA,cAAC,mBACC,6BAAAA,QAAA,cAAC,eAAI,aAAa,KACf,eAAe,6BAAAA,QAAA,cAAC,sBAAiB,GAClC,6BAAAA,QAAA,cAAC,eAAI,YAAY,KACf,6BAAAA,QAAA,cAAC,QAAK,OAAW,KAAM,CACzB,CACF,CACF;AAEJ;AAEO,IAAM,iBAAqB,MAAM;AACtC,QAAM,EAAE,EAAE,IAAI,eAAe;AAC7B,QAAM,EAAE,kBAAkB,kBAAkB,IAAI,YAAY;AAC5D,QAAM,EAAE,oBAAoB,IAAI,cAAc;AAC9C,QAAM,EAAE,KAAK,IAAI,QAAQ;AACzB,QAAM,qBAAqB,sBAAsB;AACjD,QAAM,+BAA+B,gCAAgC;AAErE,SACE,6BAAAA,QAAA,2BAAAA,QAAA,gBACG,kBAAkB,aAAa,UAAU,CAAC,IACzC,oBAAoB,CAAC,KACnB,6BAAAA,QAAA,cAAC,eAAI,eAAc,SACjB,6BAAAA,QAAA,cAAC,SAAM,SAAQ,qCAAoC,GACnD,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,aAAa;AAAA,MACb,KAAK,6BAA6B,oBAAoB,CAAC,CAAC;AAAA,MACxD,OAAO,EAAE,4BAA4B;AAAA;AAAA,EACvC,CACF,IAGF,6BAAAA,QAAA,cAAC,eAAI,eAAc,YACjB,6BAAAA,QAAA,cAAC,SAAM,SAAQ,uCAAsC,GACrD,6BAAAA,QAAA,cAAC,eAAI,aAAa,GAAG,eAAc,YAChC,iBAAiB,aAAa,KAAK,CAAC,MAClC,KAAK,UACJ,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,mBAAmB,aAAa,KAAK,CAAC;AAAA,MAC3C,OAAO,EAAE,uBAAuB;AAAA;AAAA,EAClC,IAEA,6BAAAA,QAAA,cAAC,eAAI,aAAa,KAChB,6BAAAA,QAAA,cAAC,sBAAiB,GAClB,6BAAAA,QAAA,cAAC,eAAI,YAAY,KACf,6BAAAA,QAAA,cAAC,QAAK,MAAK,aAAY,WAAS,QAC7B,EAAE,mCAAmC,CACxC,CACF,CACF,IAEH,iBAAiB,aAAa,OAAO,CAAC,KACrC,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,mBAAmB,aAAa,OAAO,CAAC;AAAA,MAC7C,OAAO,EAAE,yBAAyB;AAAA;AAAA,EACpC,GAED,iBAAiB,aAAa,UAAU,CAAC,KACxC,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,KAAK,6BAA6B,oBAAoB,CAAC,CAAE;AAAA,MACzD,OAAO,EAAE,4BAA4B;AAAA;AAAA,EACvC,CAEJ,CACF,CAEJ;AAEJ;","names":["React"]}
|
|
@@ -2,13 +2,13 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
addUserFields
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-FM46W7SH.js";
|
|
6
6
|
import {
|
|
7
7
|
messages_default
|
|
8
8
|
} from "./chunk-OYI3BYDM.js";
|
|
9
9
|
import {
|
|
10
10
|
DebugLogProvider
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JDPWKUTP.js";
|
|
12
12
|
import {
|
|
13
13
|
AccountAuthProvider,
|
|
14
14
|
BiProvider,
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
getDebugLogFilePath,
|
|
22
22
|
isLoggedInToAccount,
|
|
23
23
|
require_react
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-B3GNRQOK.js";
|
|
25
25
|
import {
|
|
26
26
|
__toESM,
|
|
27
27
|
init_esm_shims
|
|
@@ -63,4 +63,4 @@ export {
|
|
|
63
63
|
log,
|
|
64
64
|
executeCommand
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=chunk-
|
|
66
|
+
//# sourceMappingURL=chunk-TQ4ASC3D.js.map
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
useHttpClient,
|
|
18
18
|
wixCliAppsFlowTunnelCreationStatusSrc11Evid5233,
|
|
19
19
|
z
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-B3GNRQOK.js";
|
|
21
21
|
import {
|
|
22
22
|
__commonJS,
|
|
23
23
|
__dirname,
|
|
@@ -892,4 +892,4 @@ init_esm_shims();
|
|
|
892
892
|
export {
|
|
893
893
|
useTunnel
|
|
894
894
|
};
|
|
895
|
-
//# sourceMappingURL=chunk-
|
|
895
|
+
//# sourceMappingURL=chunk-XEMGQN6O.js.map
|
|
@@ -5,19 +5,19 @@ import {
|
|
|
5
5
|
} from "./chunk-FH6U3Y37.js";
|
|
6
6
|
import {
|
|
7
7
|
useWixCliAppBi
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-NDDJZNHP.js";
|
|
9
9
|
import {
|
|
10
10
|
PreviewCommand
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-KJYQFBGE.js";
|
|
12
12
|
import {
|
|
13
13
|
assertBuildOutputExists
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SSESAFQW.js";
|
|
15
15
|
import {
|
|
16
16
|
useARMClient
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-P3PY53HC.js";
|
|
18
18
|
import {
|
|
19
19
|
useBackendComponents
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-6CAKKWKU.js";
|
|
21
21
|
import {
|
|
22
22
|
Alert,
|
|
23
23
|
Box_default,
|
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
useDevCenterClient,
|
|
45
45
|
useProjectModel,
|
|
46
46
|
useTranslation
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-B3GNRQOK.js";
|
|
48
48
|
import {
|
|
49
49
|
__toESM,
|
|
50
50
|
init_esm_shims
|
|
@@ -416,4 +416,4 @@ export {
|
|
|
416
416
|
ReleaseVersionType,
|
|
417
417
|
ReleaseCommand
|
|
418
418
|
};
|
|
419
|
-
//# sourceMappingURL=chunk-
|
|
419
|
+
//# sourceMappingURL=chunk-YWY23HT5.js.map
|
package/build/index.js
CHANGED
|
@@ -2,18 +2,18 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
createI18nT
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5U6HXCYR.js";
|
|
6
6
|
import {
|
|
7
7
|
runCommand
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-4OEXVINX.js";
|
|
9
|
+
import "./chunk-FM46W7SH.js";
|
|
10
10
|
import "./chunk-OYI3BYDM.js";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-JDPWKUTP.js";
|
|
12
12
|
import {
|
|
13
13
|
require_react,
|
|
14
14
|
version,
|
|
15
15
|
z
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-B3GNRQOK.js";
|
|
17
17
|
import {
|
|
18
18
|
__commonJS,
|
|
19
19
|
__require,
|
|
@@ -3376,8 +3376,8 @@ var {
|
|
|
3376
3376
|
// src/commands/build.ts
|
|
3377
3377
|
init_esm_shims();
|
|
3378
3378
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3379
|
-
const { runCommand: runCommand2 } = await import("./render-command-
|
|
3380
|
-
const { build } = await import("./build-
|
|
3379
|
+
const { runCommand: runCommand2 } = await import("./render-command-5MD3QGQO.js");
|
|
3380
|
+
const { build } = await import("./build-KB2AR55I.js");
|
|
3381
3381
|
await runCommand2(command, services, build);
|
|
3382
3382
|
});
|
|
3383
3383
|
|
|
@@ -3387,8 +3387,8 @@ var import_react = __toESM(require_react(), 1);
|
|
|
3387
3387
|
var devCommand = (services) => {
|
|
3388
3388
|
const t = createI18nT();
|
|
3389
3389
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).action(async (options, command) => {
|
|
3390
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3391
|
-
const { renderCommand } = await import("./render-command-
|
|
3390
|
+
const { DevCommand } = await import("./DevCommand-Y4Q7JP4O.js");
|
|
3391
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3392
3392
|
const { https = false } = options;
|
|
3393
3393
|
await renderCommand(command, services, /* @__PURE__ */ import_react.default.createElement(DevCommand, { https }), {
|
|
3394
3394
|
watchForModelChanges: true
|
|
@@ -3457,17 +3457,17 @@ var previewCommand = (services) => {
|
|
|
3457
3457
|
).hideHelp()
|
|
3458
3458
|
).action(async (options, command) => {
|
|
3459
3459
|
const { site, baseUrl, json } = options;
|
|
3460
|
-
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-
|
|
3460
|
+
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-5MD3QGQO.js");
|
|
3461
3461
|
if (json) {
|
|
3462
3462
|
return runCommand2(command, services, async (model) => {
|
|
3463
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3463
|
+
const { nonInteractivePreview } = await import("./preview-6FYRANJA.js");
|
|
3464
3464
|
return nonInteractivePreview(services, model, {
|
|
3465
3465
|
baseUrl,
|
|
3466
3466
|
siteId: site
|
|
3467
3467
|
});
|
|
3468
3468
|
});
|
|
3469
3469
|
}
|
|
3470
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3470
|
+
const { PreviewCommand } = await import("./PreviewCommand-TLJWPIJ4.js");
|
|
3471
3471
|
await renderCommand(
|
|
3472
3472
|
command,
|
|
3473
3473
|
services,
|
|
@@ -3499,8 +3499,8 @@ var createVersionCommand = (services) => {
|
|
|
3499
3499
|
validateBase
|
|
3500
3500
|
).action(async (options, command) => {
|
|
3501
3501
|
const { VersionType } = await import("./types.impl-CD4WWRUK.js");
|
|
3502
|
-
const { renderCommand } = await import("./render-command-
|
|
3503
|
-
const { CreateVersionCommand, CreateVersionCommandDeprecated } = await import("./CreateVersionCommand-
|
|
3502
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3503
|
+
const { CreateVersionCommand, CreateVersionCommandDeprecated } = await import("./CreateVersionCommand-N3DC2R3M.js");
|
|
3504
3504
|
const {
|
|
3505
3505
|
approvePreview = false,
|
|
3506
3506
|
versionType: versionTypeString,
|
|
@@ -3536,8 +3536,8 @@ var addPermissionCommand = (services) => {
|
|
|
3536
3536
|
return createCommand("add-permission").description("adding a permission to the app").addOption(
|
|
3537
3537
|
new Option("-p, --permission-id <id>", t("the permission id to add"))
|
|
3538
3538
|
).action(async (options, command) => {
|
|
3539
|
-
const { renderCommand } = await import("./render-command-
|
|
3540
|
-
const { AddPermissionCommand } = await import("./AddPermissionCommand-
|
|
3539
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3540
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-KLPHA4NW.js");
|
|
3541
3541
|
const { permissionId = "" } = options;
|
|
3542
3542
|
await renderCommand(
|
|
3543
3543
|
command,
|
|
@@ -3551,8 +3551,8 @@ var addPermissionCommand = (services) => {
|
|
|
3551
3551
|
init_esm_shims();
|
|
3552
3552
|
var import_react5 = __toESM(require_react(), 1);
|
|
3553
3553
|
var serveCommand = (services) => createCommand("serve").action(async (_, command) => {
|
|
3554
|
-
const { renderCommand } = await import("./render-command-
|
|
3555
|
-
const { ServeCommand } = await import("./ServeCommand-
|
|
3554
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3555
|
+
const { ServeCommand } = await import("./ServeCommand-O6PLUS6G.js");
|
|
3556
3556
|
await renderCommand(command, services, /* @__PURE__ */ import_react5.default.createElement(ServeCommand, null));
|
|
3557
3557
|
});
|
|
3558
3558
|
|
|
@@ -3562,8 +3562,8 @@ var import_react6 = __toESM(require_react(), 1);
|
|
|
3562
3562
|
var generateCommand = (services) => {
|
|
3563
3563
|
const t = createI18nT();
|
|
3564
3564
|
return createCommand("generate").description(t("generate_command.description")).action(async (options, command) => {
|
|
3565
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3566
|
-
const { renderCommand } = await import("./render-command-
|
|
3565
|
+
const { GenerateCommand } = await import("./GenerateCommand-NA7CUA6C.js");
|
|
3566
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3567
3567
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(GenerateCommand, null), {
|
|
3568
3568
|
skipProjectValidation: true
|
|
3569
3569
|
});
|
|
@@ -3581,8 +3581,8 @@ var logsCommand = (services) => {
|
|
|
3581
3581
|
validateVersion
|
|
3582
3582
|
).action(async (options, command) => {
|
|
3583
3583
|
const { version: version2 } = options;
|
|
3584
|
-
const { renderCommand } = await import("./render-command-
|
|
3585
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3584
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3585
|
+
const { LogsCommand } = await import("./LogsCommand-HIZEAFSC.js");
|
|
3586
3586
|
await renderCommand(command, services, /* @__PURE__ */ import_react7.default.createElement(LogsCommand, { version: version2 }));
|
|
3587
3587
|
});
|
|
3588
3588
|
};
|
|
@@ -3618,8 +3618,8 @@ var releaseCommand = (services) => {
|
|
|
3618
3618
|
t("app_preview_command_def.option.json")
|
|
3619
3619
|
).hideHelp()
|
|
3620
3620
|
).action(async (options, command) => {
|
|
3621
|
-
const { renderCommand } = await import("./render-command-
|
|
3622
|
-
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-
|
|
3621
|
+
const { renderCommand } = await import("./render-command-5MD3QGQO.js");
|
|
3622
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-RRCGNQQO.js");
|
|
3623
3623
|
const { baseUrl, site, comment, approveMinor = false, json } = options;
|
|
3624
3624
|
const versionType = options.versionType ? {
|
|
3625
3625
|
major: ReleaseVersionType.MAJOR,
|
|
@@ -3634,7 +3634,7 @@ var releaseCommand = (services) => {
|
|
|
3634
3634
|
};
|
|
3635
3635
|
if (json) {
|
|
3636
3636
|
return runCommand(command, services, async (model) => {
|
|
3637
|
-
const { nonInteractiveRelease } = await import("./release-
|
|
3637
|
+
const { nonInteractiveRelease } = await import("./release-O6HVO2SD.js");
|
|
3638
3638
|
return nonInteractiveRelease(services, model, props);
|
|
3639
3639
|
});
|
|
3640
3640
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as ve,b as Ee}from"./chunk-64LGSUHT.js";import{a as we}from"./chunk-EERHWVVD.js";import"./chunk-42XIZ4MH.js";import{c as Xe,d as Qe}from"./chunk-7EYXEF6M.js";import{b as ge,d as Ie,e as He,f as p,g as a,h as l,i as w,j as u}from"./chunk-SBZEOPXX.js";var Te=ge(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.EventType=void 0;var be;(function(n){n.removeAppCompleted="removeAppCompleted",n.componentSelectionChanged="componentSelectionChanged",n.appInstalled="appInstalled",n.appUpdateCompleted="appUpdateCompleted"})(be||(pt.EventType=be={}))});var kt=ge(A=>{"use strict";var Ze=A&&A.__createBinding||(Object.create?function(n,t,e,i){i===void 0&&(i=e);var s=Object.getOwnPropertyDescriptor(t,e);(!s||("get"in s?!t.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return t[e]}}),Object.defineProperty(n,i,s)}:function(n,t,e,i){i===void 0&&(i=e),n[i]=t[e]}),tn=A&&A.__setModuleDefault||(Object.create?function(n,t){Object.defineProperty(n,"default",{enumerable:!0,value:t})}:function(n,t){n.default=t}),en=A&&A.__importStar||function(){var n=function(t){return n=Object.getOwnPropertyNames||function(e){var i=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(i[i.length]=s);return i},n(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var i=n(t),s=0;s<i.length;s++)i[s]!=="default"&&Ze(e,t,i[s]);return tn(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var nn=en((Qe(),He(Xe)));A.WixSDKTypes=nn;var sn=Te();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return sn.EventType}})});var V=Ie(kt(),1);var D=class D{constructor(){p(this,"uid",0);p(this,"callbacks",new Map);p(this,"inTransaction",!1);p(this,"isSilent",!1);p(this,"queue",[])}silent(t=!0){this.isSilent=t}startTransaction(){this.inTransaction=!0}commit(){this.inTransaction=!1;let t=this.queue;this.queue=[],this.isSilent||t.forEach(e=>{this.notify(e)})}notify(t){this.isSilent||(this.inTransaction?this.queue.push(t):this.callbacks.forEach(e=>{e(t)}))}subscribe(t){let e=this.uid++;return this.callbacks.set(e,t),()=>{this.callbacks.delete(e)}}notifyWithStep(t,e){this.notify({...t,meta:{...t.meta,step:e}})}async withEvent(t,e){let i=e();if(i&&i.hasOwnProperty("then"))try{return this.notifyWithStep(t,D.EventSteps.Start),i=await i,this.notifyWithStep(t,D.EventSteps.End),i}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},D.EventSteps.Error),s}else return this.notify(t),i}};p(D,"biEvents",{PLATFORM_WORKER_SPAWN:123,PLATFORM_APP_RUNNER_INIT_APP_API:124,PLATFORM_APP_RUNNER_RUN_APP:125,PLATFORM_APP_RUNNER_REMOVE_APP:126,PLATFORM_WORKER_APP_BUNDLE_LOAD:127,PLATFORM_WORKER_APP_BUNDLE_EXECUTE:128,PLATFORM_IFRAME_INIT:129,PLATFORM_APP_API_INIT:130,PLATFORM_APP_API_GET:131}),p(D,"EventSteps",{Start:"start",End:"end",Error:"error"});var Lt=D,ht=(n=>(n.WorkerSpawn="WorkerSpawn",n.HostEvent="HostEvent",n.ApplicationsSpecsReceived="ApplicationsSpecsReceived",n.InitApplicationApi="InitApplicationApi",n.RunApplication="RunApplication",n.getApplicationApi="getApplicationApi",n.IframeInit="IframeInit",n))(ht||{}),Ut=(n=>(n.EditorReady="EditorReady",n))(Ut||{});var v=(n=>(n.ApplicationInit="ApplicationInit",n.ApplicationExecute="ApplicationExecute",n.ApplicationRemoved="ApplicationRemoved",n.ApplicationLoad="ApplicationLoad",n.ApplicationApiInit="ApplicationApiInit",n.CustomEvent="CustomEvent",n.HostEvent="HostEvent",n.EditorReady="EditorReady",n))(v||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_APP_BUNDLE_LOAD,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationExecuteEvent(t,e){return{type:"ApplicationExecute",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:E.biEvents.PLATFORM_WORKER_APP_BUNDLE_EXECUTE,appDefId:t.appDefinitionId,appType:t.appType,bundleUrl:e}}}}createApplicationApiInitEvent(t,e){return{type:"ApplicationApiInit",payload:{appDefinitionId:t},meta:{bi:{evid:E.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},E=class extends Lt{constructor(){super(...arguments);p(this,"factories",new jt)}},lt=class lt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ht.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);lt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};p(lt,"allowedEvents",[V.EventType.componentSelectionChanged,V.EventType.appInstalled,V.EventType.appUpdateCompleted,V.EventType.removeAppCompleted]);var xe=lt;var g=class n extends Error{constructor(e,i,s){let r=e?` ${e}`:"",o=`[${s}]#${i}`;super(`${o}.${r}`);p(this,"state",{});p(this,"displayName");p(this,"prefix");p(this,"errorMessage");p(this,"parent");p(this,"messages",[]);p(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=i,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,n)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof n)return this.parent;let i=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[i]},getMessage(){return[i,e.message??"unknown error message"].join(`
|
|
2
2
|
`)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(i=>i.trim().length).join(`
|
|
3
|
-
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[h,
|
|
3
|
+
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[h,d])=>(d&&c.push(` \u2013 ${h}: ${d}`),c),[]).join(`
|
|
4
4
|
`),i=this.messages.reduce((c,h)=>(c.push(` - ${h.join(" ")}`),c),[]).join(`
|
|
5
5
|
`),s=this.parentError,r=s?["",s.getMessage(),""].join(`
|
|
6
6
|
`):"",o=this.errorMessage?`${this.displayName}: ${this.errorMessage}`:this.displayName;return[r,o,e,i].filter(c=>c.trim().length).join(`
|
|
7
|
-
`)}getBreadcrumbs(){let e=this.parentError;return e?[...e.getBreadcrumbs(),this.displayName]:[this.displayName]}withParentError(e){return this.parent=e,this}withMessage(...e){return this.messages.push(e),this}};function b(n){return function t(e,i=""){let s=new n(i,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var Lt=class extends y{constructor(e,i){super(e,i,"Editor Platform Internal Error");p(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},nn=b(Lt);var j=(n=>(n.IncorrectEnvironment="IncorrectEnvironment",n))(j||{}),Ut=class extends y{constructor(e,i){super(e,i,"EP Context Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},V=b(Ut);async function sn(n,t){if(!n?.type)return n;switch(n.type){case"componentSelectionChanged":let e=n.componentRefs||[],i=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:n.type,components:i};default:return n}}var Ft=class{constructor(t,e,i){p(this,"events");p(this,"subscribe");p(this,"commit");p(this,"startTransaction");p(this,"silent");this.appDefinitionId=t,this.privateAPI=i,this.events=e,this.subscribe=e.subscribe.bind(e),this.commit=e.commit.bind(e),this.startTransaction=e.startTransaction.bind(e),this.silent=e.silent.bind(e)}notify(t){this.events.notify({type:t.type,payload:t.payload,meta:{appDefinitionId:this.appDefinitionId}})}notifyCustomEvent(t,e){this.notify({type:E.CustomEvent,payload:{...e,type:t}})}addEventListener(t,e){return this.events.subscribe(async i=>{let s=i.meta?.appDefinitionId===this.appDefinitionId||i.meta?.appDefinitionId===null,r=()=>sn(i.payload,this.privateAPI);t==="*"?e(await r()):i.type===E.CustomEvent?t===i.payload?.type&&!s&&e(await r()):i.type===E.HostEvent&&t===i.payload?.type&&s&&e(await r())})}},rn=200,on=50,D,$t,be,pt=class{constructor(t){l(this,D);p(this,"injectionUUID");p(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,d(this,D,$t).call(this)||d(this,D,be).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let i=!1,s,r=0,o=()=>{i||(s=setTimeout(()=>{if(r++,r<on){r%10===0&&console.log(V(j.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!i){let c=V(j.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},rn))};o(),d(this,D,$t).call(this)?.then(()=>{i=!0,clearTimeout(s),t()})})}};D=new WeakSet,$t=function(){return globalThis[this.injectionUUID]?.promise},be=function(){let t,e=new Promise(i=>{t=i});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(i=>{e.then(i)})};var jt="__ENVIRONMENT_CONTEXT_KEY",ut=(n=>(n.Worker="Worker",n.Frame="Frame",n.ComponentPanel="ComponentPanel",n))(ut||{}),lt=class lt{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[jt])throw V(j.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[jt]=new lt(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[jt]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};p(lt,"status",new pt("environment"));var M=lt,G="__APPLICATION_CONTEXT_KEY",ht=class ht{constructor(t,e){p(this,"events");this.applicationContext=t,this.environment=e,this.events=new Ft(this.applicationContext.appDefinitionId,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[G])throw V(j.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[G]=new ht(t,await M.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[G])}getAppDefinitionId(){return this.applicationContext.appDefinitionId}getBindings(){return this.applicationContext}getEvents(){return this.events}getEnvironmentContext(){return this.environment}getPrivateAPI(){return this.environment.getPrivateAPI()}getPrivateApplicationAPI(){let t=this.getAppDefinitionId();if(!t)throw V(j.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};p(ht,"status",new pt("application"));var P=ht;var Fe=ye(Mt());var Q=n=>`"editor-platform-transport": ${n}`,Ce=n=>Q(`[Internal Error] ${n}`),_e="\u0192",Re="\u2202",Oe="_get_",Ne="_set_",dt="+",Te="-",Yt="\xB7",Jt="\xD7",Ht="\xB0",Me=n=>n[0]===Jt?"":n,xe=n=>n===null||typeof n>"u"||typeof n=="symbol"||typeof n=="number"||typeof n=="boolean"||typeof n=="function"||typeof n=="string",an=n=>!!n&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof Set)&&!(n instanceof Map),cn=n=>U(n.split(Yt)),U=n=>n.map(Me).filter(Boolean).join(".");function vt(n,t){return{marker:n,...t}}var pn=vt("A",{shouldUse:n=>Array.isArray(n),serialize:(n,t)=>{n.length?n.forEach((e,i)=>{t(`${i}`,e)}):t("",Ht)},deserialize:{create:()=>[],has:(n,t)=>!(typeof n[t]>"u"),append:(n,t,e)=>{n.push(e)}}}),ln=vt("M",{shouldUse:n=>n instanceof Map,serialize:(n,t)=>{n.forEach((e,i)=>{t(i,e)})},deserialize:{create:()=>new Map,has:(n,t)=>n.has(t),append:(n,t,e)=>{n.set(t,e)}}}),hn=vt("S",{shouldUse:n=>n instanceof Set,serialize:(n,t)=>{let e=0;n.forEach(i=>{t(`${e++}`,i)})},deserialize:{create:()=>new Set,has:(n,t)=>n.has(t),append:(n,t,e)=>{n.add(e)}}}),Kt=vt("O",{shouldUse:n=>typeof n=="object",serialize:(n,t)=>{let e=i=>{let r=Reflect.ownKeys(i).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let h=Reflect.get(n,c);t(c,h)}):t("",Ht);let o=Reflect.getPrototypeOf(i);!o||o?.hasOwnProperty("__proto__")||e(o)};e(n)},deserialize:{create:()=>({}),has:(n,t)=>!!n[t],append:(n,t,e)=>{n[t]=e}}}),De=[pn,hn,ln];function un(n,t){let e=n;for(;e;){let i=Object.getOwnPropertyDescriptor(e,t);if(i)return i;e=Reflect.getPrototypeOf(e)}return null}function dn(n,t){let e=new WeakMap,i=r=>{let o=r.slice(1).map(Me).filter(Boolean);return o.slice(1).reduce((c,h)=>({context:c.context[c.pointer],pointer:h}),{context:n,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(u=>o.join(".").startsWith(u))){t(o,{...i(o),value:"[Circular]"});return}if(r&&!xe(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),xe(r)){t(o,{...i(o),value:r});return}let c=De.find(h=>h.shouldUse(r))??Kt;if(c){c.serialize(r,(h,u)=>{s(u,[...o,`${Jt}${c.marker}`,h])});return}};return s(n)}var fn=(n,t)=>{if(!an(n))throw new Error(Q("only objects are serializable at the root level"));let e={data:[]},i=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(cn(r),(...c)=>o.context[o.pointer](...c)),i(r,_e)};return dn(n,(r,{value:o,context:c,pointer:h})=>{let u=r.slice(1).join(Yt),f=un(c,h);if(f?.get||f?.set){f?.get&&t(U([...r,Oe]),()=>c[h]),f?.set&&t(U([...r,Ne]),B=>{c[h]=B});let O=[f?.get?dt:Te,f?.set?dt:Te];i(u,`${Re}${O.join("")}`)}else typeof o=="function"?s(u,{context:c,pointer:h}):i(u,o)}),e},An=(n,t)=>typeof n!="object"||n===null?n:n.data.reduce((e,[i,s])=>{let r=e,o=i.split(Yt),c=Kt,h=null;for(let u=0;u<o.length;u++){let f=o[u];if(f[0]===Jt){let O=c.deserialize.has(r,h);if(c=[Kt,...De].find(B=>B.marker===f[1]),!c)throw new Error(Q(`unknown marker "${f[1]}"`));O||(r[h]=c.deserialize.create()),r=r[h]}else h=f}if(s?.toString()===Ht)return e;if(s?.toString()===_e)c.deserialize.append(r,h,t(U(o)));else if(s?.toString()[0]===Re){let u=s?.toString()[1]===dt,f=s?.toString()[2]===dt,O={};if(u){let B=t(U([...o,Oe]));O.get=()=>B()}f&&(O.set=t(U([...o,Ne]))),Object.defineProperty(r,h,O)}else c.deserialize.append(r,h,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(n.data).length/1024).toFixed(2)}Kb`});function Se(){let n=globalThis.performance;if(n&&n.now)return n.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*i)),s+=1;return t}var J=(n=>(n.ExposeAPI="ExposeAPI",n.Call="Call",n.Response="Response",n.Cleanup="Cleanup",n))(J||{}),C=class n{constructor(t,e){p(this,"correlationId",`M-${Se()}`);p(this,"parentCorrelationId");this.type=t,this.payload=e}withParentCorrelationId(t){return this.parentCorrelationId=t,this}serialize(t){return JSON.stringify({parentCorrelationId:this.parentCorrelationId,correlationId:this.correlationId,type:this.type,payload:fn(this.payload,(e,i)=>{t(this.correlationId,e,i)})})}static fromEvent(t,e){let i=JSON.parse(t);return new n(i.type,An(i.payload,s=>e(i.correlationId,s))).withParentCorrelationId(i.correlationId)}},zt=class extends C{constructor(t){super("Cleanup",t)}},Bt=class extends C{constructor(t){super("Response",t)}},ft=class extends C{constructor(t){super("Response",t)}},qt=class extends C{constructor(t){super("Call",t)}},Wt=(n,t)=>`${n}_${t}`,gt,wt,F,T,Gt=class{constructor(t){l(this,gt,new FinalizationRegistry(t=>{this.postMessage(new zt(t))}));l(this,wt,{[J.Cleanup]:t=>{let e=t.payload.functionMarkerKey,i=t.payload.callId;delete a(this,F)[e],i&&delete a(this,T)[i]},[J.Response]:async t=>{let e=t.payload.callId,i=t.payload.errorMessage;if(i)if(t.payload.errorStack){let r=new Error(i);r.stack=t.payload.errorStack,a(this,T)[e]?.reject(r)}else a(this,T)[e]?.reject(i);else{let s=t.payload.response;a(this,T)[e]?.resolve(s)}delete a(this,T)[e]},[J.Call]:async t=>{let e=t.payload.functionMarkerKey,i=a(this,F)[e];if(!i){this.postMessage(new ft({callId:t.payload.callId,errorMessage:Q("function is not available")}));return}try{let s=await i.value(...t.payload.props??[]);this.postMessage(new Bt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new ft({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});l(this,F,{});l(this,T,{});p(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=C.fromEvent(t.data,(i,s)=>{let r=this.replaceTransferredFunction(i,s);return a(this,gt).register(r,{functionMarkerKey:Wt(i,s)}),r});a(this,wt)[e.type]?.(e),this.messageEvents[e.type]?.(e)}postMessage(t){this.port.postMessage(t.serialize(this.registerTransferredFunction.bind(this)))}registerTransferredFunction(t,e,i){let s=Wt(t,e);a(this,F)[s]={path:e,value:i}}replaceTransferredFunction(t,e){return(...i)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new qt({callId:s,functionMarkerKey:Wt(t,e),props:i})),new Promise((r,o)=>{a(this,T)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};gt=new WeakMap,wt=new WeakMap,F=new WeakMap,T=new WeakMap;var At=class extends Gt{constructor(){super(...arguments);p(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(Q('wrong exposed API instance, "type" property is required'));this.queue.push(new C(J.ExposeAPI,e)),this.flush()}};var Y=(n=>(n.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",n.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",n.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",n.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",n))(Y||{});var $,x,Et,ke,Vt=class{constructor(t,e){l(this,Et);l(this,$,new Set);l(this,x);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,x,t),d(this,Et,ke).call(this)}dispose(){a(this,x)&&(a(this,x).close(),a(this,x).onmessage=null)}onHandshake(t){return a(this,$).add(t),()=>{a(this,$).delete(t)}}};$=new WeakMap,x=new WeakMap,Et=new WeakSet,ke=function(){let t=a(this,x);if(!t){console.warn(Ce("port is required no notify onHandshake listeners"));return}a(this,$).forEach(e=>e(t))};var H,X,_,Le,je,Ue,mt=class extends Vt{constructor(e,i){super(e,i);l(this,_);l(this,H,!1);l(this,X,`consumer-${Se()}`);d(this,_,Le).call(this);let s={type:Y.Ping};e(JSON.stringify(s))}};H=new WeakMap,X=new WeakMap,_=new WeakSet,Le=function(){this.onMessage(e=>{try{let i=JSON.parse(e.data);switch(i.type){case Y.Pong:{d(this,_,je).call(this);break}case Y.Port:{d(this,_,Ue).call(this,i.targetMemberId,e.ports?.[0]);break}}}catch{}})},je=function(){if(a(this,H))return;w(this,H,!0);let e={type:Y.RequestPort,memberId:a(this,X)};this.postMessage(JSON.stringify(e))},Ue=function(e,i){if(e===a(this,X)){if(!i)throw new Error(Ce("no port at consumer handshake"));this.setActivePort(i)}};var yt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},Pt=class n extends yt{constructor(){super(...arguments);p(this,"handshake",new mt(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new n().onConnect(s=>{new At(s).expose(e)})}};var It=class n extends yt{constructor(){super(...arguments);p(this,"handshake",new mt(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new n().onConnect(s=>{new At(s).expose(e)})}};var bt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case kt.EditorReady:this.platformAppEvents.notify({...t,type:E.EditorReady});break;case ct.HostEvent:this.platformAppEvents.notify({...t,type:E.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},ie=(n=>(n.Frame="PLATFORM_FRAME_API",n.Worker="PLATFORM_WORKER_API",n))(ie||{}),Tt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await M.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext({appDefinitionId:t}){await P.inject({appDefinitionId:t,appDefinitionName:""})}},mn={classic:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css",studio:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css"},Z,tt,Ct,et,_t,$e,Qt=class extends Tt{constructor(){super(ie.Frame,ut.Frame);l(this,_t);l(this,Z,new v);l(this,tt,new bt(a(this,Z)));l(this,Ct);l(this,et);d(this,_t,$e).call(this)}async initEnvironment(e){let{applicationPrivateAPI:i,privateAPI:s,appDefinitionId:r}=e;w(this,et,i),w(this,Ct,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,Z),applicationAPIs:{[r]:a(this,et)}}),await this.injectApplicationContext({appDefinitionId:r})}notify(e){a(this,tt).notify(e)}subscribe(e){a(this,tt).subscribe(e)}};Z=new WeakMap,tt=new WeakMap,Ct=new WeakMap,et=new WeakMap,_t=new WeakSet,$e=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let i=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=mn[i],r=s&&!!document.querySelectorAll(`link[type="text/css"][href="${s}"]`)?.length;if(s&&!r){let o=document.createElement("link");o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href",s),globalThis.document.head.prepend(o)}}};var R=(n=>(n.ApplicationLoadError="ApplicationLoadError",n.ApplicationFetchError="ApplicationFetchError",n.ApplicationExecuteError="ApplicationExecuteError",n))(R||{}),Zt=class extends y{constructor(e,i){super(e,i,"EP Application Container Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}withApiMethod(e){return this.state={...this.state,apiMethod:e},this}withApiType(e){return this.state={...this.state,apiType:e},this}},S=b(Zt),yn="__APPLICATION_REGISTRY_KEY";async function Pn(n,t,e){let i=new Function(G,yn,e),s,r=o=>{if(s)throw S(R.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw S(R.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};i.call(null,new P(o,await M.getInstance()),r)}catch(o){throw S(R.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let h=n.subscribe(u=>{let f=setTimeout(()=>{clearTimeout(f),h(),s||c(S(R.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);u.type===E.ApplicationInit&&u.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),h(),s||c(S(R.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var k,nt,A,te=class{constructor(t,e){l(this,k,{});l(this,nt);l(this,A);w(this,nt,t),w(this,A,e),a(this,A).subscribe(i=>{switch(i.type){case E.HostEvent:{i.payload.type===Fe.EventType.removeAppCompleted&&a(this,A).withEvent(a(this,A).factories.createApplicationRemovedEvent(i.payload.appDefinitionId),()=>this.removeApplication(i.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),i=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,i),i}setApplication(t,e){a(this,k)[t]=e,a(this,A).withEvent(a(this,A).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,nt).applicationManager.setApplication(e)})}getApplication(t){return a(this,k)[t]}getAppDefinitionIds(){return Object.keys(a(this,k))}removeApplication(t){delete a(this,k)[t]}async loadApplication(t){let e=t.url;return a(this,A).withEvent(a(this,A).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(i){throw S(R.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(i)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw S(R.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,A).withEvent(a(this,A).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:i}=await Pn(a(this,A),t,e);return i})}};k=new WeakMap,nt=new WeakMap,A=new WeakMap;var W,it,st,L,rt,ee=class extends Tt{constructor(){super(ie.Worker,ut.Worker);l(this,W,new v);l(this,it,new bt(a(this,W)));l(this,st,null);l(this,L);l(this,rt,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:i}=e;w(this,L,await i({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,W),privateApi:a(this,L),applicationAPIs:{}}),w(this,st,new te(a(this,L),a(this,W))),a(this,rt).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,it).notify(e)}subscribe(e){a(this,it).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,st).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,L))return e(this);a(this,rt).push(e)})}};W=new WeakMap,it=new WeakMap,st=new WeakMap,L=new WeakMap,rt=new WeakMap;var Xt="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",K,We,Ke,xt=class{constructor(){l(this,K)}isEnvironmentApiExposed(){return!!globalThis[Xt]}async getContexts(){let[t,e]=await Promise.all([M.getInstance(),P.getInstance()]);return{environmentContext:t,applicationContext:e}}expose(){if(this.isEnvironmentApiExposed())return;let t=typeof importScripts=="function",e=globalThis.self&&globalThis.top&&globalThis.self!==globalThis.top;t?(d(this,K,We).call(this),globalThis[Xt]=!0):e&&(d(this,K,Ke).call(this),globalThis[Xt]=!0)}};K=new WeakSet,We=function(){It.exposeAPI(new ee)},Ke=function(){Pt.exposeAPI(new Qt)};var ne=class extends y{constructor(e,i){super(e,i,"EP EnvironmentAPI Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Yn=b(ne);new xt().expose();var se=class extends y{constructor(e,i){super(e,i,"Auth Strategy Error");p(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},ze=b(se);function In(n,t){let e=Date.now(),i=n?new Date(n).getTime():null;return i&&i-e>t}var gn=30*60*1e3,wn=()=>{let n;return{getAuthHeaders:async()=>{let t=await P.getInstance(),e=t.getBindings(),i=t.getPrivateAPI();if(!e.appDefinitionId)throw ze("EmptyAppDefinitionId");return(!n||In(n.expires,gn))&&(n=await i.auth.getAccessToken(e.appDefinitionId,await i.info.getMetaSiteId())),n?.token?{headers:{Authorization:n.token}}:(console.error(ze("EmptyAppAuthInstance").withAppDefinitionId(e.appDefinitionId)),{headers:{Authorization:""}})}}},I=class{constructor(t,e){this.namespace=t,this.shapeConstructor=e}build(){let t=new this.shapeConstructor,i=Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(s=>s!=="constructor"&&typeof t[s]=="function").reduce((s,r)=>({...s,[r]:o=>{if(o?.applicationContext){let c=t.withApplicationContext(o.applicationContext);return c[r].bind(c)}else return t[r].bind(t)}}),{});return Ie(i)}},g=class{constructor(t=null){this.overrideApplicationContext=t}getApplicationContext(){return this.overrideApplicationContext?this.overrideApplicationContext:P.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}async getContextBindings(){return(await this.getApplicationContext()).getBindings()}withApplicationContext(t){return new this.constructor(t)}},re=class extends g{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){let t=await this.getPlatformPrivateAPI(),e=await this.getContextBindings();return t.info.getAppInstance(e.appDefinitionId)}},ni=new I("application",re).build(),Ot=class extends g{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},ii=new I("events",Ot).build(),Nt,oe=class extends g{constructor(){super(...arguments);l(this,Nt,new Ot(this.getApplicationContext()))}async getSelection(){let e=await this.getPlatformPrivateAPI(),i=await e.components.getSelectedComponents();return Promise.all(i.map(s=>e.components.getComponent(s)))}onSelectionChange(e){a(this,Nt).addEventListener("componentSelectionChanged",i=>{e(i.components)})}};Nt=new WeakMap;var si=new I("elements",oe).build(),ae=class extends g{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}},ri=new I("info",ae).build(),ce=(n=>(n.UndefinedCompRef="UndefinedCompRef",n.NotAvailableMethod="NotAvailableMethod",n))(ce||{}),pe=class extends y{constructor(t,e){super(t,e,"Widget Error")}},Be=b(pe),Ge="underline";function En(n){return n.map(t=>Ve({font:t}).family).filter(Boolean)}function Ve(n){let t={family:void 0,size:void 0};if(n?.font){let{variableName:e,fallbackValue:i}=vn(n.font);t.cssVariableName=e;let s=i.match(/(?:(["']).*?\1|\S)+/g)||[];for(let r=0;r<s.length;r++){let o=s[r];switch(o){case"bold":t.bold=!0;break;case"italic":t.italic=!0;break;default:o?.endsWith("px")?t.size=parseInt(o,10):r===s.length-1?t.family=o:t.family=(t.family||"")+" "+o}}}return n?.textDecoration&&(t.underline=n.textDecoration===Ge),t.family=t.family?.trim().replace(/['"]+/g,""),t}function vn(n){let t=n.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var z,Rt,le=class extends g{constructor(){super(...arguments);l(this,z)}async getProp(e){let i=await this.getPlatformPrivateAPI(),s=await d(this,z,Rt).call(this);return await i.refComponents.isRefComponent(s)?(await i.refComponents.getProps(s))?.[e]:i.customElement.getAttribute(s,e)}async setProp(e,i){let s=await this.getPlatformPrivateAPI(),r=await d(this,z,Rt).call(this);await s.refComponents.isRefComponent(r)?await s.refComponents.setProps(r,{[e]:i}):await s.customElement.setAttribute(r,e,i)}async setPreloadFonts(e){let i=await this.getPlatformPrivateAPI(),s=await d(this,z,Rt).call(this);if(await i.refComponents.isRefComponent(s))throw Be(ce.NotAvailableMethod,"not available for the current component type");let r=En(e);await i.customElement.setPreloadFonts(s,r)}};z=new WeakSet,Rt=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Be(ce.UndefinedCompRef);return s};var bn=new I("widget",le),oi=bn.build();function Tn(n){return`${n.cssVariableName?`var(${n.cssVariableName}, `:""}${n.italic?"italic ":""}${n.bold?"bold ":""}${n.size||16}px ${n.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${n.cssVariableName?")":""}`}function xn(n){if(!n)return null;let t=n,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function qe(n){return n?n.cssVariableName?`var(${n.cssVariableName}, ${n.color})`:n.color:""}var Cn={transformFontInternalValue:n=>{if(n){let{theme:t,cssVariableName:e,bold:i,italic:s,underline:r,...o}=n;return{...o,style:{bold:i,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},he=class extends g{async selectColor(t,e){let i=await this.getPlatformPrivateAPI(),s=xn(t),r=qe(s);return await i.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:h})=>{s={color:o,theme:c,cssVariableName:h},r=qe(s),e?.onChange?.(r)}),r}async selectFont(t,e){let i=await this.getPlatformPrivateAPI(),s=Ve(t),r=t;return await i.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:Cn.transformFontInternalValue(s)},(o,c)=>{r={font:Tn(o),textDecoration:o.underline?Ge:void 0},e?.onChange?.(r)}),r}},ai=new I("inputs",he).build(),ue=class extends g{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},ci=new I("panels",ue).build(),de=class extends g{async get(t){return(await this.getPlatformPrivateAPI()).userPreferences.get(await this.getAppDefinitionId(),t)}async set(t){return(await this.getPlatformPrivateAPI()).userPreferences.set(await this.getAppDefinitionId(),t)}},pi=new I("preferences",de).build(),fe=class extends g{async getData(){return(await this.getPlatformPrivateAPI()).externalPanels.getData()}async setData(t){return(await this.getPlatformPrivateAPI()).externalPanels.setData(t)}async getStyle(){return(await this.getPlatformPrivateAPI()).externalPanels.getStyle()}async setStyle(t){return(await this.getPlatformPrivateAPI()).externalPanels.setStyle(t)}async getTheme(){return(await this.getPlatformPrivateAPI()).externalPanels.getTheme()}async selectMedia(){return(await this.getPlatformPrivateAPI()).externalPanels.selectMedia()}async selectLink(...t){return(await this.getPlatformPrivateAPI()).externalPanels.selectLink(...t)}async selectColor(...t){return async()=>(await this.getPlatformPrivateAPI()).externalPanels.selectColor(...t)}async translate(t,e){return(await this.getPlatformPrivateAPI()).externalPanels.translate(t,e)}},li=new I("externalPanels",fe).build(),_n=()=>{let n=new URLSearchParams(window.location.search),t=n.has("essentials")?JSON.parse(n.get("essentials")):void 0,{monitoring:e,...i}=t||{},s=n.get("appDefinitionId"),{context:r,config:o}=e||{},c=ge({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{environment:{},applicationContext:P.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:i}},Rn=()=>({environment:{},applicationContext:P.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),Ae={host:()=>typeof importScripts=="function"?Rn():_n(),auth:wn};var Ai=()=>{let n=Ae.host(),t=Ae.auth();Pe({auth:t,host:n}).enableContext("module")};export{Ai as enableClient};
|
|
7
|
+
`)}getBreadcrumbs(){let e=this.parentError;return e?[...e.getBreadcrumbs(),this.displayName]:[this.displayName]}withParentError(e){return this.parent=e,this}withMessage(...e){return this.messages.push(e),this}};function b(n){return function t(e,i=""){let s=new n(i,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var Ft=class extends g{constructor(e,i){super(e,i,"Editor Platform Internal Error");p(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},rn=b(Ft);var $=(n=>(n.IncorrectEnvironment="IncorrectEnvironment",n))($||{}),Wt=class extends g{constructor(e,i){super(e,i,"EP Context Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},J=b(Wt);async function on(n,t){if(!n?.type)return n;switch(n.type){case"componentSelectionChanged":let e=n.componentRefs||[],i=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:n.type,components:i};default:return n}}var Kt=class{constructor(t,e,i){p(this,"events");p(this,"subscribe");p(this,"commit");p(this,"startTransaction");p(this,"silent");this.appDefinitionId=t,this.privateAPI=i,this.events=e,this.subscribe=e.subscribe.bind(e),this.commit=e.commit.bind(e),this.startTransaction=e.startTransaction.bind(e),this.silent=e.silent.bind(e)}notify(t){this.events.notify({type:t.type,payload:t.payload,meta:{appDefinitionId:this.appDefinitionId}})}notifyCustomEvent(t,e){this.notify({type:v.CustomEvent,payload:{...e,type:t}})}addEventListener(t,e){return this.events.subscribe(async i=>{let s=i.meta?.appDefinitionId===this.appDefinitionId||i.meta?.appDefinitionId===null,r=()=>on(i.payload,this.privateAPI);t==="*"?e(await r()):i.type===v.CustomEvent?t===i.payload?.type&&!s&&e(await r()):i.type===v.HostEvent&&t===i.payload?.type&&s&&e(await r())})}},an=200,cn=50,S,Bt,Ce,ut=class{constructor(t){l(this,S);p(this,"injectionUUID");p(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,u(this,S,Bt).call(this)||u(this,S,Ce).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let i=!1,s,r=0,o=()=>{i||(s=setTimeout(()=>{if(r++,r<cn){r%10===0&&console.log(J($.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!i){let c=J($.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},an))};o(),u(this,S,Bt).call(this)?.then(()=>{i=!0,clearTimeout(s),t()})})}};S=new WeakSet,Bt=function(){return globalThis[this.injectionUUID]?.promise},Ce=function(){let t,e=new Promise(i=>{t=i});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(i=>{e.then(i)})};var $t="__ENVIRONMENT_CONTEXT_KEY",mt=(n=>(n.Worker="Worker",n.Frame="Frame",n.ComponentPanel="ComponentPanel",n))(mt||{}),dt=class dt{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[$t])throw J($.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[$t]=new dt(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[$t]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};p(dt,"status",new ut("environment"));var M=dt,Y="__APPLICATION_CONTEXT_KEY",ft=class ft{constructor(t,e){p(this,"events");this.applicationContext=t,this.environment=e,this.events=new Kt(this.applicationContext.appDefinitionId,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[Y])throw J($.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[Y]=new ft(t,await M.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[Y])}getAppDefinitionId(){return this.applicationContext.appDefinitionId}getBindings(){return this.applicationContext}getEvents(){return this.events}getEnvironmentContext(){return this.environment}getPrivateAPI(){return this.environment.getPrivateAPI()}getPrivateApplicationAPI(){let t=this.getAppDefinitionId();if(!t)throw J($.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};p(ft,"status",new ut("application"));var I=ft;var Ke=Ie(kt());var tt=n=>`"editor-platform-transport": ${n}`,Oe=n=>tt(`[Internal Error] ${n}`),Ne="\u0192",De="\u2202",Me="_get_",Se="_set_",At="+",Re="-",Xt="\xB7",Qt="\xD7",Zt="\xB0",ke=n=>n[0]===Qt?"":n,_e=n=>n===null||typeof n>"u"||typeof n=="symbol"||typeof n=="number"||typeof n=="boolean"||typeof n=="function"||typeof n=="string",pn=n=>!!n&&typeof n=="object"&&!Array.isArray(n)&&!(n instanceof Date)&&!(n instanceof Set)&&!(n instanceof Map),ln=n=>W(n.split(Xt)),W=n=>n.map(ke).filter(Boolean).join(".");function xt(n,t){return{marker:n,...t}}var hn=xt("A",{shouldUse:n=>Array.isArray(n),serialize:(n,t)=>{n.length?n.forEach((e,i)=>{t(`${i}`,e)}):t("",Zt)},deserialize:{create:()=>[],has:(n,t)=>!(typeof n[t]>"u"),append:(n,t,e)=>{n.push(e)}}}),un=xt("M",{shouldUse:n=>n instanceof Map,serialize:(n,t)=>{n.forEach((e,i)=>{t(i,e)})},deserialize:{create:()=>new Map,has:(n,t)=>n.has(t),append:(n,t,e)=>{n.set(t,e)}}}),dn=xt("S",{shouldUse:n=>n instanceof Set,serialize:(n,t)=>{let e=0;n.forEach(i=>{t(`${e++}`,i)})},deserialize:{create:()=>new Set,has:(n,t)=>n.has(t),append:(n,t,e)=>{n.add(e)}}}),qt=xt("O",{shouldUse:n=>typeof n=="object",serialize:(n,t)=>{let e=i=>{let r=Reflect.ownKeys(i).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let h=Reflect.get(n,c);t(c,h)}):t("",Zt);let o=Reflect.getPrototypeOf(i);!o||o?.hasOwnProperty("__proto__")||e(o)};e(n)},deserialize:{create:()=>({}),has:(n,t)=>!!n[t],append:(n,t,e)=>{n[t]=e}}}),Le=[hn,dn,un];function fn(n,t){let e=n;for(;e;){let i=Object.getOwnPropertyDescriptor(e,t);if(i)return i;e=Reflect.getPrototypeOf(e)}return null}function mn(n,t){let e=new WeakMap,i=r=>{let o=r.slice(1).map(ke).filter(Boolean);return o.slice(1).reduce((c,h)=>({context:c.context[c.pointer],pointer:h}),{context:n,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(d=>o.join(".").startsWith(d))){t(o,{...i(o),value:"[Circular]"});return}if(r&&!_e(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),_e(r)){t(o,{...i(o),value:r});return}let c=Le.find(h=>h.shouldUse(r))??qt;if(c){c.serialize(r,(h,d)=>{s(d,[...o,`${Qt}${c.marker}`,h])});return}};return s(n)}var An=(n,t)=>{if(!pn(n))throw new Error(tt("only objects are serializable at the root level"));let e={data:[]},i=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(ln(r),(...c)=>o.context[o.pointer](...c)),i(r,Ne)};return mn(n,(r,{value:o,context:c,pointer:h})=>{let d=r.slice(1).join(Xt),f=fn(c,h);if(f?.get||f?.set){f?.get&&t(W([...r,Me]),()=>c[h]),f?.set&&t(W([...r,Se]),G=>{c[h]=G});let N=[f?.get?At:Re,f?.set?At:Re];i(d,`${De}${N.join("")}`)}else typeof o=="function"?s(d,{context:c,pointer:h}):i(d,o)}),e},Pn=(n,t)=>typeof n!="object"||n===null?n:n.data.reduce((e,[i,s])=>{let r=e,o=i.split(Xt),c=qt,h=null;for(let d=0;d<o.length;d++){let f=o[d];if(f[0]===Qt){let N=c.deserialize.has(r,h);if(c=[qt,...Le].find(G=>G.marker===f[1]),!c)throw new Error(tt(`unknown marker "${f[1]}"`));N||(r[h]=c.deserialize.create()),r=r[h]}else h=f}if(s?.toString()===Zt)return e;if(s?.toString()===Ne)c.deserialize.append(r,h,t(W(o)));else if(s?.toString()[0]===De){let d=s?.toString()[1]===At,f=s?.toString()[2]===At,N={};if(d){let G=t(W([...o,Me]));N.get=()=>G()}f&&(N.set=t(W([...o,Se]))),Object.defineProperty(r,h,N)}else c.deserialize.append(r,h,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(n.data).length/1024).toFixed(2)}Kb`});function je(){let n=globalThis.performance;if(n&&n.now)return n.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*i)),s+=1;return t}var X=(n=>(n.ExposeAPI="ExposeAPI",n.Call="Call",n.Response="Response",n.Cleanup="Cleanup",n))(X||{}),R=class n{constructor(t,e){p(this,"correlationId",`M-${je()}`);p(this,"parentCorrelationId");this.type=t,this.payload=e}withParentCorrelationId(t){return this.parentCorrelationId=t,this}serialize(t){return JSON.stringify({parentCorrelationId:this.parentCorrelationId,correlationId:this.correlationId,type:this.type,payload:An(this.payload,(e,i)=>{t(this.correlationId,e,i)})})}static fromEvent(t,e){let i=JSON.parse(t);return new n(i.type,Pn(i.payload,s=>e(i.correlationId,s))).withParentCorrelationId(i.correlationId)}},Gt=class extends R{constructor(t){super("Cleanup",t)}},Vt=class extends R{constructor(t){super("Response",t)}},Pt=class extends R{constructor(t){super("Response",t)}},Yt=class extends R{constructor(t){super("Call",t)}},zt=(n,t)=>`${n}_${t}`,Et,bt,K,T,Jt=class{constructor(t){l(this,Et,new FinalizationRegistry(t=>{this.postMessage(new Gt(t))}));l(this,bt,{[X.Cleanup]:t=>{let e=t.payload.functionMarkerKey,i=t.payload.callId;delete a(this,K)[e],i&&delete a(this,T)[i]},[X.Response]:async t=>{let e=t.payload.callId,i=t.payload.errorMessage;if(i)if(t.payload.errorStack){let r=new Error(i);r.stack=t.payload.errorStack,a(this,T)[e]?.reject(r)}else a(this,T)[e]?.reject(i);else{let s=t.payload.response;a(this,T)[e]?.resolve(s)}delete a(this,T)[e]},[X.Call]:async t=>{let e=t.payload.functionMarkerKey,i=a(this,K)[e];if(!i){this.postMessage(new Pt({callId:t.payload.callId,errorMessage:tt("function is not available")}));return}try{let s=await i.value(...t.payload.props??[]);this.postMessage(new Vt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new Pt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});l(this,K,{});l(this,T,{});p(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=R.fromEvent(t.data,(i,s)=>{let r=this.replaceTransferredFunction(i,s);return a(this,Et).register(r,{functionMarkerKey:zt(i,s)}),r});a(this,bt)[e.type]?.(e),this.messageEvents[e.type]?.(e)}postMessage(t){this.port.postMessage(t.serialize(this.registerTransferredFunction.bind(this)))}registerTransferredFunction(t,e,i){let s=zt(t,e);a(this,K)[s]={path:e,value:i}}replaceTransferredFunction(t,e){return(...i)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Yt({callId:s,functionMarkerKey:zt(t,e),props:i})),new Promise((r,o)=>{a(this,T)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};Et=new WeakMap,bt=new WeakMap,K=new WeakMap,T=new WeakMap;var yt=class extends Jt{constructor(){super(...arguments);p(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(tt('wrong exposed API instance, "type" property is required'));this.queue.push(new R(X.ExposeAPI,e)),this.flush()}};var H=(n=>(n.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",n.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",n.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",n.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",n))(H||{});var B,C,Tt,Ue,Ht=class{constructor(t,e){l(this,Tt);l(this,B,new Set);l(this,C);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,C,t),u(this,Tt,Ue).call(this)}dispose(){a(this,C)&&(a(this,C).close(),a(this,C).onmessage=null)}onHandshake(t){return a(this,B).add(t),()=>{a(this,B).delete(t)}}};B=new WeakMap,C=new WeakMap,Tt=new WeakSet,Ue=function(){let t=a(this,C);if(!t){console.warn(Oe("port is required no notify onHandshake listeners"));return}a(this,B).forEach(e=>e(t))};var Q,Z,_,Fe,$e,We,gt=class extends Ht{constructor(e,i){super(e,i);l(this,_);l(this,Q,!1);l(this,Z,`consumer-${je()}`);u(this,_,Fe).call(this);let s={type:H.Ping};e(JSON.stringify(s))}};Q=new WeakMap,Z=new WeakMap,_=new WeakSet,Fe=function(){this.onMessage(e=>{try{let i=JSON.parse(e.data);switch(i.type){case H.Pong:{u(this,_,$e).call(this);break}case H.Port:{u(this,_,We).call(this,i.targetMemberId,e.ports?.[0]);break}}}catch{}})},$e=function(){if(a(this,Q))return;w(this,Q,!0);let e={type:H.RequestPort,memberId:a(this,Z)};this.postMessage(JSON.stringify(e))},We=function(e,i){if(e===a(this,Z)){if(!i)throw new Error(Oe("no port at consumer handshake"));this.setActivePort(i)}};var It=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},wt=class n extends It{constructor(){super(...arguments);p(this,"handshake",new gt(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new n().onConnect(s=>{new yt(s).expose(e)})}};var vt=class n extends It{constructor(){super(...arguments);p(this,"handshake",new gt(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new n().onConnect(s=>{new yt(s).expose(e)})}};var Ct=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case Ut.EditorReady:this.platformAppEvents.notify({...t,type:v.EditorReady});break;case ht.HostEvent:this.platformAppEvents.notify({...t,type:v.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},oe=(n=>(n.Frame="PLATFORM_FRAME_API",n.Worker="PLATFORM_WORKER_API",n))(oe||{}),Rt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await M.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext({appDefinitionId:t}){await I.inject({appDefinitionId:t,appDefinitionName:""})}},yn={classic:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-default.global.css",studio:"https://www.unpkg.com/@wix/design-system/dist/statics/tokens-studio.global.css"},et,nt,Ot,it,Nt,Be,ee=class extends Rt{constructor(){super(oe.Frame,mt.Frame);l(this,Nt);l(this,et,new E);l(this,nt,new Ct(a(this,et)));l(this,Ot);l(this,it);u(this,Nt,Be).call(this)}async initEnvironment(e){let{applicationPrivateAPI:i,privateAPI:s,appDefinitionId:r}=e;w(this,it,i),w(this,Ot,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,et),applicationAPIs:{[r]:a(this,it)}}),await this.injectApplicationContext({appDefinitionId:r})}notify(e){a(this,nt).notify(e)}subscribe(e){a(this,nt).subscribe(e)}};et=new WeakMap,nt=new WeakMap,Ot=new WeakMap,it=new WeakMap,Nt=new WeakSet,Be=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let i=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=yn[i],r=s&&!!document.querySelectorAll(`link[type="text/css"][href="${s}"]`)?.length;if(s&&!r){let o=document.createElement("link");o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),o.setAttribute("href",s),globalThis.document.head.prepend(o)}}};var O=(n=>(n.ApplicationLoadError="ApplicationLoadError",n.ApplicationFetchError="ApplicationFetchError",n.ApplicationExecuteError="ApplicationExecuteError",n))(O||{}),ne=class extends g{constructor(e,i){super(e,i,"EP Application Container Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}withApiMethod(e){return this.state={...this.state,apiMethod:e},this}withApiType(e){return this.state={...this.state,apiType:e},this}},k=b(ne),gn="__APPLICATION_REGISTRY_KEY";async function In(n,t,e){let i=new Function(Y,gn,e),s,r=o=>{if(s)throw k(O.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw k(O.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};i.call(null,new I(o,await M.getInstance()),r)}catch(o){throw k(O.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let h=n.subscribe(d=>{let f=setTimeout(()=>{clearTimeout(f),h(),s||c(k(O.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);d.type===v.ApplicationInit&&d.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),h(),s||c(k(O.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var L,st,m,ie=class{constructor(t,e){l(this,L,{});l(this,st);l(this,m);w(this,st,t),w(this,m,e),a(this,m).subscribe(i=>{switch(i.type){case v.HostEvent:{i.payload.type===Ke.EventType.removeAppCompleted&&a(this,m).withEvent(a(this,m).factories.createApplicationRemovedEvent(i.payload.appDefinitionId),()=>this.removeApplication(i.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),i=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,i),i}setApplication(t,e){a(this,L)[t]=e,a(this,m).withEvent(a(this,m).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,st).applicationManager.setApplication(e)})}getApplication(t){return a(this,L)[t]}getAppDefinitionIds(){return Object.keys(a(this,L))}removeApplication(t){delete a(this,L)[t]}async loadApplication(t){let e=t.url;return a(this,m).withEvent(a(this,m).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(i){throw k(O.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(i)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw k(O.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,m).withEvent(a(this,m).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:i}=await In(a(this,m),t,e);return i})}};L=new WeakMap,st=new WeakMap,m=new WeakMap;var z,rt,ot,j,at,se=class extends Rt{constructor(){super(oe.Worker,mt.Worker);l(this,z,new E);l(this,rt,new Ct(a(this,z)));l(this,ot,null);l(this,j);l(this,at,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:i}=e;w(this,j,await i({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,z),privateApi:a(this,j),applicationAPIs:{}}),w(this,ot,new ie(a(this,j),a(this,z))),a(this,at).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,rt).notify(e)}subscribe(e){a(this,rt).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,ot).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,j))return e(this);a(this,at).push(e)})}};z=new WeakMap,rt=new WeakMap,ot=new WeakMap,j=new WeakMap,at=new WeakMap;var te="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",q,ze,qe,_t=class{constructor(){l(this,q)}isEnvironmentApiExposed(){return!!globalThis[te]}async getContexts(){let[t,e]=await Promise.all([M.getInstance(),I.getInstance()]);return{environmentContext:t,applicationContext:e}}expose(){if(this.isEnvironmentApiExposed())return;let t=typeof importScripts=="function",e=globalThis.self&&globalThis.top&&globalThis.self!==globalThis.top;t?(u(this,q,ze).call(this),globalThis[te]=!0):e&&(u(this,q,qe).call(this),globalThis[te]=!0)}};q=new WeakSet,ze=function(){vt.exposeAPI(new se)},qe=function(){wt.exposeAPI(new ee)};var re=class extends g{constructor(e,i){super(e,i,"EP EnvironmentAPI Error");p(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Xn=b(re);new _t().expose();var ae=class extends g{constructor(e,i){super(e,i,"Auth Strategy Error");p(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Ge=b(ae);function wn(n,t){let e=Date.now(),i=n?new Date(n).getTime():null;return i&&i-e>t}var vn=30*60*1e3,En=()=>{let n;return{getAuthHeaders:async()=>{let t=await I.getInstance(),e=t.getBindings(),i=t.getPrivateAPI();if(!e.appDefinitionId)throw Ge("EmptyAppDefinitionId");return(!n||wn(n.expires,vn))&&(n=await i.auth.getAccessToken(e.appDefinitionId,await i.info.getMetaSiteId())),n?.token?{headers:{Authorization:n.token}}:(console.error(Ge("EmptyAppAuthInstance").withAppDefinitionId(e.appDefinitionId)),{headers:{Authorization:""}})}}},P=class{constructor(t,e){this.namespace=t,this.shapeConstructor=e}build(){let t=new this.shapeConstructor,i=Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(s=>s!=="constructor"&&typeof t[s]=="function").reduce((s,r)=>({...s,[r]:o=>{if(o?.applicationContext){let c=t.withApplicationContext(o.applicationContext);return c[r].bind(c)}else return t[r].bind(t)}}),{});return ve(i)}},y=class{constructor(t=null){this.overrideApplicationContext=t}getApplicationContext(){return this.overrideApplicationContext?this.overrideApplicationContext:I.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}async getContextBindings(){return(await this.getApplicationContext()).getBindings()}withApplicationContext(t){return new this.constructor(t)}},ce=class extends y{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){let t=await this.getPlatformPrivateAPI(),e=await this.getContextBindings();return t.info.getAppInstance(e.appDefinitionId)}},ri=new P("application",ce).build(),Mt=class extends y{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},oi=new P("events",Mt).build(),St,pe=class extends y{constructor(){super(...arguments);l(this,St,new Mt(this.getApplicationContext()))}async getSelection(){let e=await this.getPlatformPrivateAPI(),i=await e.components.getSelectedComponents();return Promise.all(i.map(s=>e.components.getComponent(s)))}onSelectionChange(e){a(this,St).addEventListener("componentSelectionChanged",i=>{e(i.components)})}};St=new WeakMap;var ai=new P("elements",pe).build(),le=class extends y{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}},ci=new P("info",le).build(),ct=(n=>(n.UndefinedCompRef="UndefinedCompRef",n.NotAvailableMethod="NotAvailableMethod",n))(ct||{}),he=class extends g{constructor(t,e){super(t,e,"Widget Error")}},Dt=b(he),Ye="underline";function bn(n){return n.map(t=>Je({font:t}).family).filter(Boolean)}function Je(n){let t={family:void 0,size:void 0};if(n?.font){let{variableName:e,fallbackValue:i}=Tn(n.font);t.cssVariableName=e;let s=i.match(/(?:(["']).*?\1|\S)+/g)||[];for(let r=0;r<s.length;r++){let o=s[r];switch(o){case"bold":t.bold=!0;break;case"italic":t.italic=!0;break;default:o?.endsWith("px")?t.size=parseInt(o,10):r===s.length-1?t.family=o:t.family=(t.family||"")+" "+o}}}return n?.textDecoration&&(t.underline=n.textDecoration===Ye),t.family=t.family?.trim().replace(/['"]+/g,""),t}function Tn(n){let t=n.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var F=class n{constructor(t,e){this.compRef=t,this.privateAPI=e}async getProp(t){return(await this.privateAPI.refComponents.getProps(this.compRef))?.[t]}async setProp(t,e){await this.privateAPI.refComponents.setProps(this.compRef,{[t]:e})}async getDesignPreset(){return this.privateAPI.designPresets.getDesignPresetName(this.compRef)}async setDesignPreset(t){await this.privateAPI.designPresets.setDesignPresetByName(this.compRef,t)}async getNestedWidget(t){let e=await this.privateAPI.refComponents.findComponentBySelector(this.compRef,t);return e?new n(e,this.privateAPI):null}},x,U,ue=class extends y{constructor(){super(...arguments);l(this,x)}async setPreloadFonts(e){let i=await this.getPlatformPrivateAPI(),s=await u(this,x,U).call(this);if(await i.refComponents.isRefComponent(s))throw Dt(ct.NotAvailableMethod,"not available for the current component type");let r=bn(e);await i.customElement.setPreloadFonts(s,r)}async getProp(e){let i=await this.getPlatformPrivateAPI(),s=await u(this,x,U).call(this);return await i.refComponents.isRefComponent(s)?new F(s,i).getProp(e):i.customElement.getAttribute(s,e)}async setProp(e,i){let s=await this.getPlatformPrivateAPI(),r=await u(this,x,U).call(this);if(await s.refComponents.isRefComponent(r))return new F(r,s).setProp(e,i);await s.customElement.setAttribute(r,e,i)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),i=await u(this,x,U).call(this);if(!await e.refComponents.isRefComponent(i))throw Dt(ct.NotAvailableMethod,"not available for the current component type");return new F(i,e).getDesignPreset()}async setDesignPreset(e){let i=await this.getPlatformPrivateAPI(),s=await u(this,x,U).call(this);if(!await i.refComponents.isRefComponent(s))throw Dt(ct.NotAvailableMethod,"not available for the current component type");return new F(s,i).setDesignPreset(e)}async getNestedWidget(e){let i=await this.getPlatformPrivateAPI(),s=await u(this,x,U).call(this);return new F(s,i).getNestedWidget(e)}};x=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Dt(ct.UndefinedCompRef);return s};var xn=new P("widget",ue),pi=xn.build();function Cn(n){return`${n.cssVariableName?`var(${n.cssVariableName}, `:""}${n.italic?"italic ":""}${n.bold?"bold ":""}${n.size||16}px ${n.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${n.cssVariableName?")":""}`}function Rn(n){if(!n)return null;let t=n,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function Ve(n){return n?n.cssVariableName?`var(${n.cssVariableName}, ${n.color})`:n.color:""}var _n={transformFontInternalValue:n=>{if(n){let{theme:t,cssVariableName:e,bold:i,italic:s,underline:r,...o}=n;return{...o,style:{bold:i,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},de=class extends y{async selectColor(t,e){let i=await this.getPlatformPrivateAPI(),s=Rn(t),r=Ve(s);return await i.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:h})=>{s={color:o,theme:c,cssVariableName:h},r=Ve(s),e?.onChange?.(r)}),r}async selectFont(t,e){let i=await this.getPlatformPrivateAPI(),s=Je(t),r=t;return await i.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:_n.transformFontInternalValue(s)},(o,c)=>{r={font:Cn(o),textDecoration:o.underline?Ye:void 0},e?.onChange?.(r)}),r}},li=new P("inputs",de).build(),fe=class extends y{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},hi=new P("panels",fe).build(),me=class extends y{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},On=new P("modals",me),ui=On.build(),Ae=class extends y{async get(t){return(await this.getPlatformPrivateAPI()).userPreferences.get(await this.getAppDefinitionId(),t)}async set(t){return(await this.getPlatformPrivateAPI()).userPreferences.set(await this.getAppDefinitionId(),t)}},di=new P("preferences",Ae).build(),Pe=class extends y{async getData(){return(await this.getPlatformPrivateAPI()).externalPanels.getData()}async setData(t){return(await this.getPlatformPrivateAPI()).externalPanels.setData(t)}async getStyle(){return(await this.getPlatformPrivateAPI()).externalPanels.getStyle()}async setStyle(t){return(await this.getPlatformPrivateAPI()).externalPanels.setStyle(t)}async getTheme(){return(await this.getPlatformPrivateAPI()).externalPanels.getTheme()}async selectMedia(){return(await this.getPlatformPrivateAPI()).externalPanels.selectMedia()}async selectLink(...t){return(await this.getPlatformPrivateAPI()).externalPanels.selectLink(...t)}async selectColor(...t){return async()=>(await this.getPlatformPrivateAPI()).externalPanels.selectColor(...t)}async translate(t,e){return(await this.getPlatformPrivateAPI()).externalPanels.translate(t,e)}},fi=new P("externalPanels",Pe).build(),Nn=()=>{let n=new URLSearchParams(window.location.search),t=n.has("essentials")?JSON.parse(n.get("essentials")):void 0,{monitoring:e,...i}=t||{},s=n.get("appDefinitionId"),{context:r,config:o}=e||{},c=Ee({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{environment:{},applicationContext:I.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:i}},Dn=()=>({environment:{},applicationContext:I.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),ye={host:()=>typeof importScripts=="function"?Dn():Nn(),auth:En};var gi=()=>{let n=ye.host(),t=ye.auth();we({auth:t,host:n}).enableContext("module")};export{gi as enableClient};
|
|
8
8
|
//# sourceMappingURL=editor.js.map
|