@wix/cli-app 1.1.105 → 1.1.107
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-5HJLGPUL.js → AddPermissionCommand-7E5GD5VD.js} +2 -2
- package/build/{DevCommand-O4AVWD2I.js → DevCommand-BWRRKEE6.js} +28 -10
- package/build/{DevCommand-O4AVWD2I.js.map → DevCommand-BWRRKEE6.js.map} +1 -1
- package/build/{GenerateCommand-XEQQK5JD.js → GenerateCommand-IO6ENBOG.js} +202 -239
- package/build/GenerateCommand-IO6ENBOG.js.map +1 -0
- package/build/{LogsCommand-HHARSMTM.js → LogsCommand-C62QNN65.js} +3 -3
- package/build/PreviewCommand-YAYKKYRN.js +19 -0
- package/build/ReleaseCommand-77SWCHH2.js +23 -0
- package/build/{ServeCommand-ZQZOJ63N.js → ServeCommand-NDUXIY75.js} +3 -3
- package/build/{build-CKOKPVS4.js → build-ZO7CXGLN.js} +6 -6
- package/build/{chunk-T5HHDBBR.js → chunk-5ZI5USPK.js} +1 -2
- package/build/{chunk-T5HHDBBR.js.map → chunk-5ZI5USPK.js.map} +1 -1
- package/build/{chunk-NESQKXHK.js → chunk-657KFISY.js} +2 -2
- package/build/{chunk-VRX2SASY.js → chunk-6X7N6N75.js} +45 -49
- package/build/chunk-6X7N6N75.js.map +1 -0
- package/build/{chunk-QWGSCUAB.js → chunk-77PR2TSF.js} +2 -2
- package/build/{chunk-HTKY5GAL.js → chunk-7B3P7MZT.js} +3 -3
- package/build/{chunk-TNGKK55S.js → chunk-AKBVXZXO.js} +678 -14
- package/build/chunk-AKBVXZXO.js.map +1 -0
- package/build/{chunk-3Y3QPJVH.js → chunk-EC7IFTLG.js} +2 -2
- package/build/{chunk-Z7PH47TC.js → chunk-EH63OURU.js} +2 -2
- package/build/{chunk-CO4OJ24E.js → chunk-GFXZXRO4.js} +2 -2
- package/build/{chunk-KZR2NRBV.js → chunk-HJXYDXED.js} +5 -5
- package/build/{chunk-6CEINMWS.js → chunk-HNIJZROR.js} +37 -61
- package/build/chunk-HNIJZROR.js.map +1 -0
- package/build/{chunk-PSM7UCFC.js → chunk-MK5OQBNN.js} +2 -2
- package/build/{chunk-2ZFPKAA7.js → chunk-OSDDOY2U.js} +238 -200
- package/build/chunk-OSDDOY2U.js.map +1 -0
- package/build/{chunk-VPA32CST.js → chunk-PSN6WZCB.js} +12 -15
- package/build/{chunk-VPA32CST.js.map → chunk-PSN6WZCB.js.map} +1 -1
- package/build/{chunk-MUQK7XXX.js → chunk-TZ37SYKU.js} +2 -2
- package/build/{chunk-QW6EMQHB.js → chunk-VCFM6SMQ.js} +668 -344
- package/build/{chunk-QW6EMQHB.js.map → chunk-VCFM6SMQ.js.map} +1 -1
- package/build/{chunk-3DCWSSD4.js → chunk-VJAMKDBT.js} +3 -3
- package/build/{chunk-JXDZLNJ2.js → chunk-VV6PV2NF.js} +5 -5
- package/build/index.js +24 -24
- package/build/platform-sdk/editor.js +3 -3
- package/build/platform-sdk/editor.js.map +1 -1
- package/build/{preview-G7E66NY4.js → preview-ZGAFDUGX.js} +15 -15
- package/build/preview-ZGAFDUGX.js.map +1 -0
- package/build/{release-A7DVRFRM.js → release-YOEGOFAT.js} +15 -15
- package/build/{render-command-WD7XORKY.js → render-command-FI2MU2Z5.js} +6 -6
- package/package.json +4 -5
- package/templates/site-plugin/files/plugin.tsx.ejs +2 -0
- package/build/GenerateCommand-XEQQK5JD.js.map +0 -1
- package/build/PreviewCommand-TDECELOR.js +0 -19
- package/build/ReleaseCommand-53VLVKUO.js +0 -23
- package/build/chunk-2ZFPKAA7.js.map +0 -1
- package/build/chunk-6CEINMWS.js.map +0 -1
- package/build/chunk-TNGKK55S.js.map +0 -1
- package/build/chunk-VRX2SASY.js.map +0 -1
- package/build/preview-G7E66NY4.js.map +0 -1
- /package/build/{AddPermissionCommand-5HJLGPUL.js.map → AddPermissionCommand-7E5GD5VD.js.map} +0 -0
- /package/build/{LogsCommand-HHARSMTM.js.map → LogsCommand-C62QNN65.js.map} +0 -0
- /package/build/{PreviewCommand-TDECELOR.js.map → PreviewCommand-YAYKKYRN.js.map} +0 -0
- /package/build/{ReleaseCommand-53VLVKUO.js.map → ReleaseCommand-77SWCHH2.js.map} +0 -0
- /package/build/{ServeCommand-ZQZOJ63N.js.map → ServeCommand-NDUXIY75.js.map} +0 -0
- /package/build/{build-CKOKPVS4.js.map → build-ZO7CXGLN.js.map} +0 -0
- /package/build/{chunk-NESQKXHK.js.map → chunk-657KFISY.js.map} +0 -0
- /package/build/{chunk-QWGSCUAB.js.map → chunk-77PR2TSF.js.map} +0 -0
- /package/build/{chunk-HTKY5GAL.js.map → chunk-7B3P7MZT.js.map} +0 -0
- /package/build/{chunk-3Y3QPJVH.js.map → chunk-EC7IFTLG.js.map} +0 -0
- /package/build/{chunk-Z7PH47TC.js.map → chunk-EH63OURU.js.map} +0 -0
- /package/build/{chunk-CO4OJ24E.js.map → chunk-GFXZXRO4.js.map} +0 -0
- /package/build/{chunk-KZR2NRBV.js.map → chunk-HJXYDXED.js.map} +0 -0
- /package/build/{chunk-PSM7UCFC.js.map → chunk-MK5OQBNN.js.map} +0 -0
- /package/build/{chunk-MUQK7XXX.js.map → chunk-TZ37SYKU.js.map} +0 -0
- /package/build/{chunk-3DCWSSD4.js.map → chunk-VJAMKDBT.js.map} +0 -0
- /package/build/{chunk-JXDZLNJ2.js.map → chunk-VV6PV2NF.js.map} +0 -0
- /package/build/{release-A7DVRFRM.js.map → release-YOEGOFAT.js.map} +0 -0
- /package/build/{render-command-WD7XORKY.js.map → render-command-FI2MU2Z5.js.map} +0 -0
|
@@ -2,11 +2,11 @@ import { createRequire as _createRequire } from 'node:module';
|
|
|
2
2
|
const require = _createRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
readAppManifest
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OSDDOY2U.js";
|
|
6
6
|
import {
|
|
7
7
|
getAppManifestPath,
|
|
8
8
|
writeJson
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VCFM6SMQ.js";
|
|
10
10
|
import {
|
|
11
11
|
init_esm_shims
|
|
12
12
|
} from "./chunk-4EFJZ3GQ.js";
|
|
@@ -29,4 +29,4 @@ export {
|
|
|
29
29
|
writeAppManifestFile,
|
|
30
30
|
readAppManifestFile
|
|
31
31
|
};
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-VJAMKDBT.js.map
|
|
@@ -3,13 +3,13 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
addUserFields,
|
|
5
5
|
reportCommandStartEvent
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GFXZXRO4.js";
|
|
7
7
|
import {
|
|
8
8
|
messages_default
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5ZI5USPK.js";
|
|
10
10
|
import {
|
|
11
11
|
DebugLogProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-657KFISY.js";
|
|
13
13
|
import {
|
|
14
14
|
AccountAuthProvider,
|
|
15
15
|
BiProvider,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
package_default,
|
|
24
24
|
render,
|
|
25
25
|
require_react
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-VCFM6SMQ.js";
|
|
27
27
|
import {
|
|
28
28
|
__toESM,
|
|
29
29
|
init_esm_shims
|
|
@@ -113,4 +113,4 @@ export {
|
|
|
113
113
|
renderCommand,
|
|
114
114
|
runCommand
|
|
115
115
|
};
|
|
116
|
-
//# sourceMappingURL=chunk-
|
|
116
|
+
//# sourceMappingURL=chunk-VV6PV2NF.js.map
|
package/build/index.js
CHANGED
|
@@ -3,18 +3,18 @@ const require = _createRequire(import.meta.url);
|
|
|
3
3
|
import {
|
|
4
4
|
createI18nT,
|
|
5
5
|
docsExtensionTypeSchema
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-7B3P7MZT.js";
|
|
7
7
|
import {
|
|
8
8
|
runCommand
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-VV6PV2NF.js";
|
|
10
|
+
import "./chunk-GFXZXRO4.js";
|
|
11
|
+
import "./chunk-5ZI5USPK.js";
|
|
12
|
+
import "./chunk-657KFISY.js";
|
|
13
13
|
import {
|
|
14
14
|
package_default,
|
|
15
15
|
require_react,
|
|
16
16
|
z
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-VCFM6SMQ.js";
|
|
18
18
|
import {
|
|
19
19
|
__commonJS,
|
|
20
20
|
__require,
|
|
@@ -3377,8 +3377,8 @@ var {
|
|
|
3377
3377
|
// src/commands/build.ts
|
|
3378
3378
|
init_esm_shims();
|
|
3379
3379
|
var buildCommand = (services) => createCommand("build").action(async (_, command) => {
|
|
3380
|
-
const { runCommand: runCommand2 } = await import("./render-command-
|
|
3381
|
-
const { build } = await import("./build-
|
|
3380
|
+
const { runCommand: runCommand2 } = await import("./render-command-FI2MU2Z5.js");
|
|
3381
|
+
const { build } = await import("./build-ZO7CXGLN.js");
|
|
3382
3382
|
await runCommand2(command, services, build);
|
|
3383
3383
|
});
|
|
3384
3384
|
|
|
@@ -3388,8 +3388,8 @@ var import_react = __toESM(require_react(), 1);
|
|
|
3388
3388
|
var devCommand = (services) => {
|
|
3389
3389
|
const t = createI18nT();
|
|
3390
3390
|
return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).action(async (options, command) => {
|
|
3391
|
-
const { DevCommand } = await import("./DevCommand-
|
|
3392
|
-
const { renderCommand } = await import("./render-command-
|
|
3391
|
+
const { DevCommand } = await import("./DevCommand-BWRRKEE6.js");
|
|
3392
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3393
3393
|
const { https = false } = options;
|
|
3394
3394
|
await renderCommand(command, services, /* @__PURE__ */ import_react.default.createElement(DevCommand, { https }), {
|
|
3395
3395
|
watchForModelChanges: true
|
|
@@ -3465,17 +3465,17 @@ var previewCommand = (services) => {
|
|
|
3465
3465
|
).hideHelp()
|
|
3466
3466
|
).action(async (options, command) => {
|
|
3467
3467
|
const { site, baseUrl, json } = options;
|
|
3468
|
-
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-
|
|
3468
|
+
const { renderCommand, runCommand: runCommand2 } = await import("./render-command-FI2MU2Z5.js");
|
|
3469
3469
|
if (json) {
|
|
3470
3470
|
return runCommand2(command, services, async (model) => {
|
|
3471
|
-
const { nonInteractivePreview } = await import("./preview-
|
|
3471
|
+
const { nonInteractivePreview } = await import("./preview-ZGAFDUGX.js");
|
|
3472
3472
|
return nonInteractivePreview(services, model, {
|
|
3473
3473
|
baseUrl,
|
|
3474
3474
|
siteId: site
|
|
3475
3475
|
});
|
|
3476
3476
|
});
|
|
3477
3477
|
}
|
|
3478
|
-
const { PreviewCommand } = await import("./PreviewCommand-
|
|
3478
|
+
const { PreviewCommand } = await import("./PreviewCommand-YAYKKYRN.js");
|
|
3479
3479
|
await renderCommand(
|
|
3480
3480
|
command,
|
|
3481
3481
|
services,
|
|
@@ -3492,8 +3492,8 @@ var addPermissionCommand = (services) => {
|
|
|
3492
3492
|
return createCommand("add-permission").description("adding a permission to the app").addOption(
|
|
3493
3493
|
new Option("-p, --permission-id <id>", t("the permission id to add"))
|
|
3494
3494
|
).action(async (options, command) => {
|
|
3495
|
-
const { renderCommand } = await import("./render-command-
|
|
3496
|
-
const { AddPermissionCommand } = await import("./AddPermissionCommand-
|
|
3495
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3496
|
+
const { AddPermissionCommand } = await import("./AddPermissionCommand-7E5GD5VD.js");
|
|
3497
3497
|
const { permissionId = "" } = options;
|
|
3498
3498
|
await renderCommand(
|
|
3499
3499
|
command,
|
|
@@ -3509,8 +3509,8 @@ var import_react4 = __toESM(require_react(), 1);
|
|
|
3509
3509
|
var serveCommand = (services) => {
|
|
3510
3510
|
const t = createI18nT();
|
|
3511
3511
|
return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
|
|
3512
|
-
const { renderCommand } = await import("./render-command-
|
|
3513
|
-
const { ServeCommandDeprecated } = await import("./ServeCommand-
|
|
3512
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3513
|
+
const { ServeCommandDeprecated } = await import("./ServeCommand-NDUXIY75.js");
|
|
3514
3514
|
await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
|
|
3515
3515
|
});
|
|
3516
3516
|
};
|
|
@@ -3525,8 +3525,8 @@ var generateCommand = (services) => {
|
|
|
3525
3525
|
t("generate_command.type_flag"),
|
|
3526
3526
|
validateDocsExtensionType
|
|
3527
3527
|
).description(t("generate_command.description")).action(async (options, command) => {
|
|
3528
|
-
const { GenerateCommand } = await import("./GenerateCommand-
|
|
3529
|
-
const { renderCommand } = await import("./render-command-
|
|
3528
|
+
const { GenerateCommand } = await import("./GenerateCommand-IO6ENBOG.js");
|
|
3529
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3530
3530
|
const { type } = options;
|
|
3531
3531
|
await renderCommand(
|
|
3532
3532
|
command,
|
|
@@ -3550,8 +3550,8 @@ var logsCommand = (services) => {
|
|
|
3550
3550
|
validateVersion
|
|
3551
3551
|
).action(async (options, command) => {
|
|
3552
3552
|
const { version } = options;
|
|
3553
|
-
const { renderCommand } = await import("./render-command-
|
|
3554
|
-
const { LogsCommand } = await import("./LogsCommand-
|
|
3553
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3554
|
+
const { LogsCommand } = await import("./LogsCommand-C62QNN65.js");
|
|
3555
3555
|
await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
|
|
3556
3556
|
});
|
|
3557
3557
|
};
|
|
@@ -3584,8 +3584,8 @@ var releaseCommand = (services) => {
|
|
|
3584
3584
|
t("app_preview_command_def.option.json")
|
|
3585
3585
|
).hideHelp()
|
|
3586
3586
|
).action(async (options, command) => {
|
|
3587
|
-
const { renderCommand } = await import("./render-command-
|
|
3588
|
-
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-
|
|
3587
|
+
const { renderCommand } = await import("./render-command-FI2MU2Z5.js");
|
|
3588
|
+
const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-77SWCHH2.js");
|
|
3589
3589
|
const { baseUrl, site, comment, json } = options;
|
|
3590
3590
|
const versionType = options.versionType ? {
|
|
3591
3591
|
major: ReleaseVersionType.MAJOR,
|
|
@@ -3599,7 +3599,7 @@ var releaseCommand = (services) => {
|
|
|
3599
3599
|
};
|
|
3600
3600
|
if (json) {
|
|
3601
3601
|
return runCommand(command, services, async (model) => {
|
|
3602
|
-
const { nonInteractiveRelease } = await import("./release-
|
|
3602
|
+
const { nonInteractiveRelease } = await import("./release-YOEGOFAT.js");
|
|
3603
3603
|
return nonInteractiveRelease(services, model, props);
|
|
3604
3604
|
});
|
|
3605
3605
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as be,b as Ee}from"./chunk-BBFFXVJD.js";import{a as ve}from"./chunk-MAZR75DI.js";import"./chunk-NHYZDMR5.js";import{c as Qe,d as Ze}from"./chunk-7EYXEF6M.js";import{b as ye,d as we,e as Xe,f as l,g as a,h,i as w,j as d}from"./chunk-SBZEOPXX.js";var xe=ye(lt=>{"use strict";Object.defineProperty(lt,"__esModule",{value:!0});lt.EventType=void 0;var Ce;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(Ce||(lt.EventType=Ce={}))});var Ot=ye(m=>{"use strict";var ti=m&&m.__createBinding||(Object.create?function(i,t,e,n){n===void 0&&(n=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(i,n,s)}:function(i,t,e,n){n===void 0&&(n=e),i[n]=t[e]}),ei=m&&m.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),ii=m&&m.__importStar||function(){var i=function(t){return i=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},i(t)};return function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=i(t),s=0;s<n.length;s++)n[s]!=="default"&&ti(e,t,n[s]);return ei(e,t),e}}();Object.defineProperty(m,"__esModule",{value:!0});m.EventType=m.WixSDKTypes=void 0;var ni=ii((Ze(),Xe(Qe)));m.WixSDKTypes=ni;var si=xe();Object.defineProperty(m,"EventType",{enumerable:!0,get:function(){return si.EventType}})});var G=we(Ot(),1);var S=class S{constructor(){l(this,"uid",0);l(this,"callbacks",new Map);l(this,"inTransaction",!1);l(this,"isSilent",!1);l(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 n=e();if(n&&n.hasOwnProperty("then"))try{return this.notifyWithStep(t,S.EventSteps.Start),n=await n,this.notifyWithStep(t,S.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},S.EventSteps.Error),s}else return this.notify(t),n}};l(S,"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}),l(S,"EventSteps",{Start:"start",End:"end",Error:"error"});var kt=S,ht=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ht||{}),Lt=(i=>(i.EditorReady="EditorReady",i))(Lt||{});var v=(i=>(i.ApplicationInit="ApplicationInit",i.ApplicationExecute="ApplicationExecute",i.ApplicationRemoved="ApplicationRemoved",i.ApplicationLoad="ApplicationLoad",i.ApplicationApiInit="ApplicationApiInit",i.CustomEvent="CustomEvent",i.HostEvent="HostEvent",i.EditorReady="EditorReady",i))(v||{}),Ft=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 kt{constructor(){super(...arguments);l(this,"factories",new Ft)}},pt=class pt{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);pt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(pt,"allowedEvents",[G.EventType.componentSelectionChanged,G.EventType.appInstalled,G.EventType.appUpdateCompleted,G.EventType.removeAppCompleted]);var Me=pt;var A=class i extends Error{constructor(e,n,s){let r=e?` ${e}`:"",o=`[${s}]#${n}`;super(`${o}.${r}`);l(this,"state",{});l(this,"displayName");l(this,"prefix");l(this,"errorMessage");l(this,"parent");l(this,"messages",[]);l(this,"code");this.displayName=o,this.errorMessage=e,this.prefix=s,this.code=n,this.name=o,Object.defineProperty(this,"message",{get:()=>this.getDisplayMessage()}),Error.captureStackTrace&&Error.captureStackTrace(this,i)}get parentError(){let e=this.parent;if(!e)return null;if(this.parent instanceof i)return this.parent;let n=e.name??"[Unknown Error]";return{getBreadcrumbs(){return[n]},getMessage(){return[n,e.message??"unknown error message"].join(`
|
|
2
2
|
`)}}}getDisplayMessage(){return[(this.parentError?this.getBreadcrumbs():[]).join(" -> "),this.getMessage()].filter(n=>n.trim().length).join(`
|
|
3
|
-
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,
|
|
3
|
+
`)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,u])=>(u&&c.push(` \u2013 ${p}: ${u}`),c),[]).join(`
|
|
4
4
|
`),n=this.messages.reduce((c,p)=>(c.push(` - ${p.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,n].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 E(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var jt=class extends A{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},ri=E(jt);var $=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))($||{}),$t=class extends A{constructor(e,n){super(e,n,"EP Context Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},J=E($t);async function oi(i,t){if(!i?.type)return i;switch(i.type){case"componentSelectionChanged":let e=i.componentRefs||[],n=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:i.type,components:n};default:return i}}var Wt=class{constructor(t,e,n){l(this,"events");l(this,"subscribe");l(this,"commit");l(this,"startTransaction");l(this,"silent");this.appDefinitionId=t,this.privateAPI=n,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 n=>{let s=n.meta?.appDefinitionId===this.appDefinitionId||n.meta?.appDefinitionId===null,r=()=>oi(n.payload,this.privateAPI);t==="*"?e(await r()):n.type===v.CustomEvent?t===n.payload?.type&&!s&&e(await r()):n.type===v.HostEvent&&t===n.payload?.type&&s&&e(await r())})}},ai=200,ci=50,O,qt,Me,ut=class{constructor(t){h(this,O);l(this,"injectionUUID");l(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,u(this,O,qt).call(this)||u(this,O,Me).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let n=!1,s,r=0,o=()=>{n||(s=setTimeout(()=>{if(r++,r<ci){r%10===0&&console.log(J($.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=J($.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},ai))};o(),u(this,O,qt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};O=new WeakSet,qt=function(){return globalThis[this.injectionUUID]?.promise},Me=function(){let t,e=new Promise(n=>{t=n});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(n=>{e.then(n)})};var Ft="__ENVIRONMENT_CONTEXT_KEY",Pt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(Pt||{}),dt=class dt{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[Ft])throw J($.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[Ft]=new dt(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[Ft]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};l(dt,"status",new ut("environment"));var N=dt,Y="__APPLICATION_CONTEXT_KEY",ft=class ft{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new Wt(t.appDefinitionId?t.appDefinitionId:null,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 N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[Y])}getContext(){return this.context}getAppDefinitionId(){return this.context.appDefinitionId}getManifestContextId(){return this.context.manifestContextId}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]}};l(ft,"status",new ut("application"));var y=ft;var Ke=we(Ot());var tt=i=>`"editor-platform-transport": ${i}`,De=i=>tt(`[Internal Error] ${i}`),Se="\u0192",Ne="\u2202",Oe="_get_",ke="_set_",mt="+",Re="-",Ht="\xB7",Xt="\xD7",Qt="\xB0",Le=i=>i[0]===Xt?"":i,_e=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",li=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),pi=i=>W(i.split(Ht)),W=i=>i.map(Le).filter(Boolean).join(".");function xt(i,t){return{marker:i,...t}}var hi=xt("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",Qt)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),ui=xt("M",{shouldUse:i=>i instanceof Map,serialize:(i,t)=>{i.forEach((e,n)=>{t(n,e)})},deserialize:{create:()=>new Map,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.set(t,e)}}}),di=xt("S",{shouldUse:i=>i instanceof Set,serialize:(i,t)=>{let e=0;i.forEach(n=>{t(`${e++}`,n)})},deserialize:{create:()=>new Set,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.add(e)}}}),zt=xt("O",{shouldUse:i=>typeof i=="object",serialize:(i,t)=>{let e=n=>{let r=Reflect.ownKeys(n).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let p=Reflect.get(i,c);t(c,p)}):t("",Qt);let o=Reflect.getPrototypeOf(n);!o||o?.hasOwnProperty("__proto__")||e(o)};e(i)},deserialize:{create:()=>({}),has:(i,t)=>!!i[t],append:(i,t,e)=>{i[t]=e}}}),Ue=[hi,di,ui];function fi(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Pi(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Le).filter(Boolean);return o.slice(1).reduce((c,p)=>({context:c.context[c.pointer],pointer:p}),{context:i,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(d=>o.join(".").startsWith(d))){t(o,{...n(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,{...n(o),value:r});return}let c=Ue.find(p=>p.shouldUse(r))??zt;if(c){c.serialize(r,(p,d)=>{s(d,[...o,`${Xt}${c.marker}`,p])});return}};return s(i)}var mi=(i,t)=>{if(!li(i))throw new Error(tt("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(pi(r),(...c)=>o.context[o.pointer](...c)),n(r,Se)};return Pi(i,(r,{value:o,context:c,pointer:p})=>{let d=r.slice(1).join(Ht),f=fi(c,p);if(f?.get||f?.set){f?.get&&t(W([...r,Oe]),()=>c[p]),f?.set&&t(W([...r,ke]),V=>{c[p]=V});let D=[f?.get?mt:Re,f?.set?mt:Re];n(d,`${Ne}${D.join("")}`)}else typeof o=="function"?s(d,{context:c,pointer:p}):n(d,o)}),e},gi=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(Ht),c=zt,p=null;for(let d=0;d<o.length;d++){let f=o[d];if(f[0]===Xt){let D=c.deserialize.has(r,p);if(c=[zt,...Ue].find(V=>V.marker===f[1]),!c)throw new Error(tt(`unknown marker "${f[1]}"`));D||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===Qt)return e;if(s?.toString()===Se)c.deserialize.append(r,p,t(W(o)));else if(s?.toString()[0]===Ne){let d=s?.toString()[1]===mt,f=s?.toString()[2]===mt,D={};if(d){let V=t(W([...o,Oe]));D.get=()=>V()}f&&(D.set=t(W([...o,ke]))),Object.defineProperty(r,p,D)}else c.deserialize.append(r,p,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(i.data).length/1024).toFixed(2)}Kb`});function je(){let i=globalThis.performance;if(i&&i.now)return i.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*n)),s+=1;return t}var X=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(X||{}),M=class i{constructor(t,e){l(this,"correlationId",`M-${je()}`);l(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:mi(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,gi(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Bt=class extends M{constructor(t){super("Cleanup",t)}},Vt=class extends M{constructor(t){super("Response",t)}},gt=class extends M{constructor(t){super("Response",t)}},Gt=class extends M{constructor(t){super("Call",t)}},Kt=(i,t)=>`${i}_${t}`,Et,bt,q,C,Yt=class{constructor(t){h(this,Et,new FinalizationRegistry(t=>{this.postMessage(new Bt(t))}));h(this,bt,{[X.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,q)[e],n&&delete a(this,C)[n]},[X.Response]:async t=>{let e=t.payload.callId,n=t.payload.errorMessage;if(n)if(t.payload.errorStack){let r=new Error(n);r.stack=t.payload.errorStack,a(this,C)[e]?.reject(r)}else a(this,C)[e]?.reject(n);else{let s=t.payload.response;a(this,C)[e]?.resolve(s)}delete a(this,C)[e]},[X.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,q)[e];if(!n){this.postMessage(new gt({callId:t.payload.callId,errorMessage:tt("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Vt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new gt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,q,{});h(this,C,{});l(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=M.fromEvent(t.data,(n,s)=>{let r=this.replaceTransferredFunction(n,s);return a(this,Et).register(r,{functionMarkerKey:Kt(n,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,n){let s=Kt(t,e);a(this,q)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Gt({callId:s,functionMarkerKey:Kt(t,e),props:n})),new Promise((r,o)=>{a(this,C)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};Et=new WeakMap,bt=new WeakMap,q=new WeakMap,C=new WeakMap;var It=class extends Yt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(tt('wrong exposed API instance, "type" property is required'));this.queue.push(new M(X.ExposeAPI,e)),this.flush()}};var H=(i=>(i.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",i.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",i.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",i.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",i))(H||{});var K,T,Ct,Fe,Jt=class{constructor(t,e){h(this,Ct);h(this,K,new Set);h(this,T);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,T,t),u(this,Ct,Fe).call(this)}dispose(){a(this,T)&&(a(this,T).close(),a(this,T).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,T=new WeakMap,Ct=new WeakSet,Fe=function(){let t=a(this,T);if(!t){console.warn(De("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Q,Z,R,$e,We,qe,At=class extends Jt{constructor(e,n){super(e,n);h(this,R);h(this,Q,!1);h(this,Z,`consumer-${je()}`);u(this,R,$e).call(this);let s={type:H.Ping};e(JSON.stringify(s))}};Q=new WeakMap,Z=new WeakMap,R=new WeakSet,$e=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case H.Pong:{u(this,R,We).call(this);break}case H.Port:{u(this,R,qe).call(this,n.targetMemberId,e.ports?.[0]);break}}}catch{}})},We=function(){if(a(this,Q))return;w(this,Q,!0);let e={type:H.RequestPort,memberId:a(this,Z)};this.postMessage(JSON.stringify(e))},qe=function(e,n){if(e===a(this,Z)){if(!n)throw new Error(De("no port at consumer handshake"));this.setActivePort(n)}};var yt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},wt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new It(s).expose(e)})}};var vt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new It(s).expose(e)})}};var Tt=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)})}},re=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(re||{}),Mt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await N.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext(t){await y.inject(t)}},Ii={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,it,_t,nt,Dt,ze,te=class extends Mt{constructor(){super(re.Frame,Pt.Frame);h(this,Dt);h(this,et,new b);h(this,it,new Tt(a(this,et)));h(this,_t);h(this,nt);u(this,Dt,ze).call(this)}async initEnvironment(e){let{applicationPrivateAPI:n,privateAPI:s,context:r}=e,o=e.context?.appDefinitionId??e.appDefinitionId,c=e.context?e.context:{appDefinitionId:o};w(this,nt,n),w(this,_t,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,et),applicationAPIs:o?{[o]:a(this,nt)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,it).notify(e)}subscribe(e){a(this,it).subscribe(e)}};et=new WeakMap,it=new WeakMap,_t=new WeakMap,nt=new WeakMap,Dt=new WeakSet,ze=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=Ii[n],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 _=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(_||{}),ee=class extends A{constructor(e,n){super(e,n,"EP Application Container Error");l(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=E(ee),Ai="__APPLICATION_REGISTRY_KEY";async function yi(i,t,e){let n=new Function(Y,Ai,e),s,r=o=>{if(s)throw k(_.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw k(_.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};n.call(null,new y(o,await N.getInstance()),r)}catch(o){throw k(_.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let p=i.subscribe(d=>{let f=setTimeout(()=>{clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);d.type===v.ApplicationInit&&d.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var L,st,P,ie=class{constructor(t,e){h(this,L,{});h(this,st);h(this,P);w(this,st,t),w(this,P,e),a(this,P).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===Ke.EventType.removeAppCompleted&&a(this,P).withEvent(a(this,P).factories.createApplicationRemovedEvent(n.payload.appDefinitionId),()=>this.removeApplication(n.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),n=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,n),n}setApplication(t,e){a(this,L)[t]=e,a(this,P).withEvent(a(this,P).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,P).withEvent(a(this,P).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw k(_.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(n)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw k(_.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,P).withEvent(a(this,P).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:n}=await yi(a(this,P),t,e);return n})}};L=new WeakMap,st=new WeakMap,P=new WeakMap;var z,rt,ot,U,at,ne=class extends Mt{constructor(){super(re.Worker,Pt.Worker);h(this,z,new b);h(this,rt,new Tt(a(this,z)));h(this,ot,null);h(this,U);h(this,at,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,U,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,z),privateApi:a(this,U),applicationAPIs:{}}),w(this,ot,new ie(a(this,U),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,U))return e(this);a(this,at).push(e)})}};z=new WeakMap,rt=new WeakMap,ot=new WeakMap,U=new WeakMap,at=new WeakMap;var Zt="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",B,Be,Ve,Rt=class{constructor(){h(this,B)}isEnvironmentApiExposed(){return!!globalThis[Zt]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),y.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,B,Be).call(this),globalThis[Zt]=!0):e&&(u(this,B,Ve).call(this),globalThis[Zt]=!0)}};B=new WeakSet,Be=function(){vt.exposeAPI(new ne)},Ve=function(){wt.exposeAPI(new te)};var se=class extends A{constructor(e,n){super(e,n,"EP EnvironmentAPI Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Xi=E(se);new Rt().expose();var oe=class extends A{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Ge=E(oe);function wi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var vi=30*60*1e3,Ei=()=>{let i;return{getAuthHeaders:async()=>{let t=await y.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw Ge("EmptyAppDefinitionId");return(!i||wi(i.expires,vi))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(Ge("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},m=class i{constructor(t,e=[]){this.ShapeConstructor=t,this.selectedMethods=e}withPublicMethod(t){return new i(this.ShapeConstructor,[...this.selectedMethods,t])}build(){if(!this.selectedMethods.length)throw new Error("methods are not defined for the SDK shape");let t=this.selectedMethods.reduce((e,n)=>({...e,[n]:s=>{let r=new this.ShapeConstructor(s?.applicationContext);return r[n]?r[n].bind(r):()=>{console.error(`"${n}" is not defined in the SDK shape`)}}}),{});return Ee(t)}},ae=class extends A{constructor(t,e){super(t,e,"Base SDK Error")}},bi=E(ae),g=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:y.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getManifestContextId(){return(await this.getApplicationContext()).getManifestContextId()}async getRequiredManifestContextId(){let t=await this.getManifestContextId();if(!t)throw bi("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},ce=class extends g{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){return(await this.getPlatformPrivateAPI()).info.getAppInstance(await this.getAppDefinitionId())}},on=new m(ce).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),Nt=class extends g{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},an=new m(Nt).withPublicMethod("addEventListener").build(),le=class extends g{async getSelection(){let t=await this.getPlatformPrivateAPI(),e=await t.components.getSelectedComponents();return Promise.all(e.map(n=>t.components.getComponent(n)))}async onSelectionChange(t){new Nt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},cn=new m(le).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),pe=class extends g{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}async getSiteDirection(){return(await this.getPlatformPrivateAPI()).info.getSiteDirection()}async siteHasCustomClasses(){return(await this.getPlatformPrivateAPI()).info.siteHasCustomClasses()}},ln=new m(pe).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").build(),ct=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(ct||{}),he=class extends A{constructor(t,e){super(t,e,"Widget Error")}},St=E(he),Je="underline";function Ci(i){return i.map(t=>He({font:t}).family).filter(Boolean)}function He(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=xi(i.font);t.cssVariableName=e;let s=n.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 i?.textDecoration&&(t.underline=i.textDecoration===Je),t.family=t.family?.trim().replace(/['"]+/g,""),t}function xi(i){let t=i.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var F=class i{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 i(e,this.privateAPI):null}},x,j,ue=class extends g{constructor(){super(...arguments);h(this,x)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,x,j).call(this);if(await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");let r=Ci(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,x,j).call(this);return await n.refComponents.isRefComponent(s)?new F(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await u(this,x,j).call(this);if(await s.refComponents.isRefComponent(r))return new F(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await u(this,x,j).call(this);if(!await e.refComponents.isRefComponent(n))throw St(ct.NotAvailableMethod,"not available for the current component type");return new F(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,x,j).call(this);if(!await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");return new F(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,x,j).call(this);return new F(s,n).getNestedWidget(e)}};x=new WeakSet,j=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw St(ct.UndefinedCompRef);return s};var Ti=new m(ue).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),pn=Ti.build();function Mi(i){return`${i.cssVariableName?`var(${i.cssVariableName}, `:""}${i.italic?"italic ":""}${i.bold?"bold ":""}${i.size||16}px ${i.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${i.cssVariableName?")":""}`}function Ri(i){if(!i)return null;let t=i,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function Ye(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var _i={transformFontInternalValue:i=>{if(i){let{theme:t,cssVariableName:e,bold:n,italic:s,underline:r,...o}=i;return{...o,style:{bold:n,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},de=class extends g{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Ri(t),r=Ye(s);return await n.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:p})=>{s={color:o,theme:c,cssVariableName:p},r=Ye(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=He(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:_i.transformFontInternalValue(s)},(o,c)=>{r={font:Mi(o),textDecoration:o.underline?Je:void 0},e?.onChange?.(r)}),r}},hn=new m(de).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),fe=class extends g{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},un=new m(fe).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),Pe=class extends g{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},dn=new m(Pe).withPublicMethod("openDashboardModal").build(),me=class extends g{async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e)}async setStyles(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setStyles(n,t)}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e)}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,t)}async getState(){return null}async setState(){return null}async getStateDefinitions(){return null}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onContextualManifestChange(n,t)}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,t)}catch{}}},fn=new m(me).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").build(),ge=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)}},Pn=new m(ge).withPublicMethod("set").withPublicMethod("get").build(),Ie=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)}},mn=new m(Ie).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),Di=()=>{let i=new URLSearchParams(window.location.search),t=i.has("essentials")?JSON.parse(i.get("essentials")):void 0,{monitoring:e,...n}=t||{},s=i.get("appDefinitionId"),{context:r,config:o}=e||{},c=be({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0});return{environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:n}},Si=()=>({environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),Ae={host:()=>typeof importScripts=="function"?Si():Di(),auth:Ei};var wn=()=>{let i=Ae.host(),t=Ae.auth();ve({auth:t,host:i}).enableContext("module")};export{wn 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(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var Ut=class extends A{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},ri=b(Ut);var W=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))(W||{}),Wt=class extends A{constructor(e,n){super(e,n,"EP Context Error");l(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 oi(i,t){if(!i?.type)return i;switch(i.type){case"componentSelectionChanged":let e=i.componentRefs||[],n=await Promise.all(e.map(s=>t.components.getComponent(s)));return{type:i.type,components:n};default:return i}}var $t=class{constructor(t,e,n){l(this,"events");l(this,"subscribe");l(this,"commit");l(this,"startTransaction");l(this,"silent");this.appDefinitionId=t,this.privateAPI=n,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 n=>{let s=n.meta?.appDefinitionId===this.appDefinitionId||n.meta?.appDefinitionId===null,r=()=>oi(n.payload,this.privateAPI);t==="*"?e(await r()):n.type===v.CustomEvent?t===n.payload?.type&&!s&&e(await r()):n.type===v.HostEvent&&t===n.payload?.type&&s&&e(await r())})}},ai=200,ci=50,O,qt,Te,dt=class{constructor(t){h(this,O);l(this,"injectionUUID");l(this,"injectionUUID_Deprecated");this.injectionUUID_Deprecated=`__${t}_CONTEXT_INJECTION_STATUS_KEY`,this.injectionUUID=`__${t}_CONTEXT_INJECTION_STATUS_KEY#0.1`,d(this,O,qt).call(this)||d(this,O,Te).call(this)}resolveInjected(){globalThis[this.injectionUUID]?.resolve()}waitInjected(){return new Promise((t,e)=>{let n=!1,s,r=0,o=()=>{n||(s=setTimeout(()=>{if(r++,r<ci){r%10===0&&console.log(J(W.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=J(W.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},ai))};o(),d(this,O,qt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};O=new WeakSet,qt=function(){return globalThis[this.injectionUUID]?.promise},Te=function(){let t,e=new Promise(n=>{t=n});globalThis[this.injectionUUID]={promise:e,resolve:t},globalThis[this.injectionUUID_Deprecated]=new Promise(n=>{e.then(n)})};var jt="__ENVIRONMENT_CONTEXT_KEY",Pt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(Pt||{}),ut=class ut{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[jt])throw J(W.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[jt]=new ut(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}};l(ut,"status",new dt("environment"));var N=ut,Y="__APPLICATION_CONTEXT_KEY",ft=class ft{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new $t(t.appDefinitionId?t.appDefinitionId:null,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[Y])throw J(W.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[Y]=new ft(t,await N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[Y])}getContext(){return this.context}getAppDefinitionId(){return this.context.appDefinitionId}getManifestContextId(){return this.context.manifestContextId}getEvents(){return this.events}getEnvironmentContext(){return this.environment}getPrivateAPI(){return this.environment.getPrivateAPI()}getPrivateApplicationAPI(){let t=this.getAppDefinitionId();if(!t)throw J(W.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};l(ft,"status",new dt("application"));var y=ft;var Ke=we(Ot());var tt=i=>`"editor-platform-transport": ${i}`,De=i=>tt(`[Internal Error] ${i}`),Se="\u0192",Ne="\u2202",Oe="_get_",ke="_set_",It="+",Re="-",Ht="\xB7",Xt="\xD7",Qt="\xB0",Fe=i=>i[0]===Xt?"":i,_e=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",li=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),pi=i=>$(i.split(Ht)),$=i=>i.map(Fe).filter(Boolean).join(".");function xt(i,t){return{marker:i,...t}}var hi=xt("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",Qt)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),di=xt("M",{shouldUse:i=>i instanceof Map,serialize:(i,t)=>{i.forEach((e,n)=>{t(n,e)})},deserialize:{create:()=>new Map,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.set(t,e)}}}),ui=xt("S",{shouldUse:i=>i instanceof Set,serialize:(i,t)=>{let e=0;i.forEach(n=>{t(`${e++}`,n)})},deserialize:{create:()=>new Set,has:(i,t)=>i.has(t),append:(i,t,e)=>{i.add(e)}}}),zt=xt("O",{shouldUse:i=>typeof i=="object",serialize:(i,t)=>{let e=n=>{let r=Reflect.ownKeys(n).filter(c=>c!=="constructor").filter(c=>typeof c!="symbol");r.length?r.filter(c=>c!=="constructor").filter(c=>typeof c!="symbol").forEach(c=>{let p=Reflect.get(i,c);t(c,p)}):t("",Qt);let o=Reflect.getPrototypeOf(n);!o||o?.hasOwnProperty("__proto__")||e(o)};e(i)},deserialize:{create:()=>({}),has:(i,t)=>!!i[t],append:(i,t,e)=>{i[t]=e}}}),Le=[hi,ui,di];function fi(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Pi(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Fe).filter(Boolean);return o.slice(1).reduce((c,p)=>({context:c.context[c.pointer],pointer:p}),{context:i,pointer:o[0]})},s=(r,o=[])=>{if(e.has(r)&&e.get(r)?.some(u=>o.join(".").startsWith(u))){t(o,{...n(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,{...n(o),value:r});return}let c=Le.find(p=>p.shouldUse(r))??zt;if(c){c.serialize(r,(p,u)=>{s(u,[...o,`${Xt}${c.marker}`,p])});return}};return s(i)}var Ii=(i,t)=>{if(!li(i))throw new Error(tt("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(pi(r),(...c)=>o.context[o.pointer](...c)),n(r,Se)};return Pi(i,(r,{value:o,context:c,pointer:p})=>{let u=r.slice(1).join(Ht),f=fi(c,p);if(f?.get||f?.set){f?.get&&t($([...r,Oe]),()=>c[p]),f?.set&&t($([...r,ke]),V=>{c[p]=V});let D=[f?.get?It:Re,f?.set?It:Re];n(u,`${Ne}${D.join("")}`)}else typeof o=="function"?s(u,{context:c,pointer:p}):n(u,o)}),e},gi=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(Ht),c=zt,p=null;for(let u=0;u<o.length;u++){let f=o[u];if(f[0]===Xt){let D=c.deserialize.has(r,p);if(c=[zt,...Le].find(V=>V.marker===f[1]),!c)throw new Error(tt(`unknown marker "${f[1]}"`));D||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===Qt)return e;if(s?.toString()===Se)c.deserialize.append(r,p,t($(o)));else if(s?.toString()[0]===Ne){let u=s?.toString()[1]===It,f=s?.toString()[2]===It,D={};if(u){let V=t($([...o,Oe]));D.get=()=>V()}f&&(D.set=t($([...o,ke]))),Object.defineProperty(r,p,D)}else c.deserialize.append(r,p,s);return e},{[Symbol("transferred object")]:`${(JSON.stringify(i.data).length/1024).toFixed(2)}Kb`});function Ue(){let i=globalThis.performance;if(i&&i.now)return i.now();let t="",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=e.length,s=0,r=10;for(;s<r;)t+=e.charAt(Math.floor(Math.random()*n)),s+=1;return t}var X=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(X||{}),T=class i{constructor(t,e){l(this,"correlationId",`M-${Ue()}`);l(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:Ii(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,gi(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Bt=class extends T{constructor(t){super("Cleanup",t)}},Vt=class extends T{constructor(t){super("Response",t)}},gt=class extends T{constructor(t){super("Response",t)}},Gt=class extends T{constructor(t){super("Call",t)}},Kt=(i,t)=>`${i}_${t}`,bt,Et,q,C,Yt=class{constructor(t){h(this,bt,new FinalizationRegistry(t=>{this.postMessage(new Bt(t))}));h(this,Et,{[X.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,q)[e],n&&delete a(this,C)[n]},[X.Response]:async t=>{let e=t.payload.callId,n=t.payload.errorMessage;if(n)if(t.payload.errorStack){let r=new Error(n);r.stack=t.payload.errorStack,a(this,C)[e]?.reject(r)}else a(this,C)[e]?.reject(n);else{let s=t.payload.response;a(this,C)[e]?.resolve(s)}delete a(this,C)[e]},[X.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,q)[e];if(!n){this.postMessage(new gt({callId:t.payload.callId,errorMessage:tt("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Vt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new gt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,q,{});h(this,C,{});l(this,"queue",[]);this.port=t,this.port.onmessage=e=>{this.onMessage(e)}}onMessage(t){let e=T.fromEvent(t.data,(n,s)=>{let r=this.replaceTransferredFunction(n,s);return a(this,bt).register(r,{functionMarkerKey:Kt(n,s)}),r});a(this,Et)[e.type]?.(e),this.messageEvents[e.type]?.(e)}postMessage(t){this.port.postMessage(t.serialize(this.registerTransferredFunction.bind(this)))}registerTransferredFunction(t,e,n){let s=Kt(t,e);a(this,q)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Gt({callId:s,functionMarkerKey:Kt(t,e),props:n})),new Promise((r,o)=>{a(this,C)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};bt=new WeakMap,Et=new WeakMap,q=new WeakMap,C=new WeakMap;var mt=class extends Yt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(tt('wrong exposed API instance, "type" property is required'));this.queue.push(new T(X.ExposeAPI,e)),this.flush()}};var H=(i=>(i.Ping="EDITOR_PLATFORM_TRANSPORT_EVENT:__Ping",i.RequestPort="EDITOR_PLATFORM_TRANSPORT_EVENT:__RequestPort",i.Pong="EDITOR_PLATFORM_TRANSPORT_EVENT:__Pong",i.Port="EDITOR_PLATFORM_TRANSPORT_EVENT:__Port",i))(H||{});var K,M,Ct,je,Jt=class{constructor(t,e){h(this,Ct);h(this,K,new Set);h(this,M);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,M,t),d(this,Ct,je).call(this)}dispose(){a(this,M)&&(a(this,M).close(),a(this,M).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,M=new WeakMap,Ct=new WeakSet,je=function(){let t=a(this,M);if(!t){console.warn(De("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Q,Z,R,We,$e,qe,At=class extends Jt{constructor(e,n){super(e,n);h(this,R);h(this,Q,!1);h(this,Z,`consumer-${Ue()}`);d(this,R,We).call(this);let s={type:H.Ping};e(JSON.stringify(s))}};Q=new WeakMap,Z=new WeakMap,R=new WeakSet,We=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case H.Pong:{d(this,R,$e).call(this);break}case H.Port:{d(this,R,qe).call(this,n.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))},qe=function(e,n){if(e===a(this,Z)){if(!n)throw new Error(De("no port at consumer handshake"));this.setActivePort(n)}};var yt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},wt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new mt(s).expose(e)})}};var vt=class i extends yt{constructor(){super(...arguments);l(this,"handshake",new At(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new mt(s).expose(e)})}};var Mt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case Lt.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)})}},re=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(re||{}),Tt=class{constructor(t,e){this.type=t,this.envType=e}async injectEnvironmentContext({events:t,privateApi:e}){await N.inject({environment:this.envType,events:t,privateApi:e,applicationAPIs:{}})}async injectApplicationContext(t){await y.inject(t)}},mi={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,it,_t,nt,Dt,ze,te=class extends Tt{constructor(){super(re.Frame,Pt.Frame);h(this,Dt);h(this,et,new E);h(this,it,new Mt(a(this,et)));h(this,_t);h(this,nt);d(this,Dt,ze).call(this)}async initEnvironment(e){let{applicationPrivateAPI:n,privateAPI:s,context:r}=e,o=e.context?.appDefinitionId??e.appDefinitionId,c=e.context?e.context:{appDefinitionId:o};w(this,nt,n),w(this,_t,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,et),applicationAPIs:o?{[o]:a(this,nt)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,it).notify(e)}subscribe(e){a(this,it).subscribe(e)}};et=new WeakMap,it=new WeakMap,_t=new WeakMap,nt=new WeakMap,Dt=new WeakSet,ze=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=mi[n],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 _=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(_||{}),ee=class extends A{constructor(e,n){super(e,n,"EP Application Container Error");l(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(ee),Ai="__APPLICATION_REGISTRY_KEY";async function yi(i,t,e){let n=new Function(Y,Ai,e),s,r=o=>{if(s)throw k(_.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw k(_.ApplicationExecuteError,"Application has different type").withMessage("expected type",t.type).withMessage("received type",o.type);s=o};try{let o={...t};n.call(null,new y(o,await N.getInstance()),r)}catch(o){throw k(_.ApplicationExecuteError,o.message).withAppDefinitionId(t.appDefinitionId).withParentError(o)}return new Promise((o,c)=>{let p=i.subscribe(u=>{let f=setTimeout(()=>{clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called, threw by timeout").withAppDefinitionId(t.appDefinitionId))},5e3);u.type===v.ApplicationInit&&u.meta.appDefinitionId===t.appDefinitionId&&(clearTimeout(f),p(),s||c(k(_.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var F,st,P,ie=class{constructor(t,e){h(this,F,{});h(this,st);h(this,P);w(this,st,t),w(this,P,e),a(this,P).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===Ke.EventType.removeAppCompleted&&a(this,P).withEvent(a(this,P).factories.createApplicationRemovedEvent(n.payload.appDefinitionId),()=>this.removeApplication(n.payload.appDefinitionId));break}}})}async runApplication(t){let e=await this.loadApplication(t),n=await this.executeApplication(t,e);return this.setApplication(t.appDefinitionId,n),n}setApplication(t,e){a(this,F)[t]=e,a(this,P).withEvent(a(this,P).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,st).applicationManager.setApplication(e)})}getApplication(t){return a(this,F)[t]}getAppDefinitionIds(){return Object.keys(a(this,F))}removeApplication(t){delete a(this,F)[t]}async loadApplication(t){let e=t.url;return a(this,P).withEvent(a(this,P).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw k(_.ApplicationLoadError).withUrl(e).withAppDefinitionId(t.appDefinitionId).withParentError(n)}})}async loadApplicationBundle(t){let e=await fetch(t,{method:"GET"});if(!(e.status>=200&&e.status<=299))throw k(_.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,P).withEvent(a(this,P).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:n}=await yi(a(this,P),t,e);return n})}};F=new WeakMap,st=new WeakMap,P=new WeakMap;var z,rt,ot,L,at,ne=class extends Tt{constructor(){super(re.Worker,Pt.Worker);h(this,z,new E);h(this,rt,new Mt(a(this,z)));h(this,ot,null);h(this,L);h(this,at,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,L,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,z),privateApi:a(this,L),applicationAPIs:{}}),w(this,ot,new ie(a(this,L),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,L))return e(this);a(this,at).push(e)})}};z=new WeakMap,rt=new WeakMap,ot=new WeakMap,L=new WeakMap,at=new WeakMap;var Zt="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",B,Be,Ve,Rt=class{constructor(){h(this,B)}isEnvironmentApiExposed(){return!!globalThis[Zt]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),y.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,B,Be).call(this),globalThis[Zt]=!0):e&&(d(this,B,Ve).call(this),globalThis[Zt]=!0)}};B=new WeakSet,Be=function(){vt.exposeAPI(new ne)},Ve=function(){wt.exposeAPI(new te)};var se=class extends A{constructor(e,n){super(e,n,"EP EnvironmentAPI Error");l(this,"state",{})}withUrl(e){return this.state={...this.state,url:e},this}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Xi=b(se);new Rt().expose();var oe=class extends A{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},Ge=b(oe);function wi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var vi=30*60*1e3,bi=()=>{let i;return{getAuthHeaders:async()=>{let t=await y.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw Ge("EmptyAppDefinitionId");return(!i||wi(i.expires,vi))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(Ge("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},I=class i{constructor(t,e=[]){this.ShapeConstructor=t,this.selectedMethods=e}withPublicMethod(t){return new i(this.ShapeConstructor,[...this.selectedMethods,t])}build(){if(!this.selectedMethods.length)throw new Error("methods are not defined for the SDK shape");let t=this.selectedMethods.reduce((e,n)=>({...e,[n]:s=>{let r=new this.ShapeConstructor(s?.applicationContext);return r[n]?r[n].bind(r):()=>{console.error(`"${n}" is not defined in the SDK shape`)}}}),{});return be(t)}},ae=class extends A{constructor(t,e){super(t,e,"Base SDK Error")}},Ei=b(ae),g=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:y.getInstance()}async getAppDefinitionId(){return(await this.getApplicationContext()).getAppDefinitionId()}async getManifestContextId(){return(await this.getApplicationContext()).getManifestContextId()}async getRequiredManifestContextId(){let t=await this.getManifestContextId();if(!t)throw Ei("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},ce=class extends g{async getPrivateAPI(){return(await this.getApplicationContext()).getPrivateApplicationAPI()}async getPublicAPI(t){return(await this.getPlatformPrivateAPI()).applicationManager.getPublicApplicationAPI(t)}async getAppInstance(){return(await this.getPlatformPrivateAPI()).info.getAppInstance(await this.getAppDefinitionId())}},on=new I(ce).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),Nt=class extends g{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},an=new I(Nt).withPublicMethod("addEventListener").build(),le=class extends g{async getSelection(){let t=await this.getPlatformPrivateAPI(),e=await t.components.getSelectedComponents();return Promise.all(e.map(n=>t.components.getComponent(n)))}async onSelectionChange(t){new Nt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},cn=new I(le).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),pe=class extends g{async getViewMode(){return(await this.getPlatformPrivateAPI()).info.getViewMode()}async getLanguageCode(){return(await this.getPlatformPrivateAPI()).info.getLanguageCode()}async getSiteDirection(){return(await this.getPlatformPrivateAPI()).info.getSiteDirection()}async siteHasCustomClasses(){return(await this.getPlatformPrivateAPI()).info.siteHasCustomClasses()}},ln=new I(pe).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").build(),ct=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(ct||{}),he=class extends A{constructor(t,e){super(t,e,"Widget Error")}},St=b(he),Je="underline";function Ci(i){return i.map(t=>He({font:t}).family).filter(Boolean)}function He(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=xi(i.font);t.cssVariableName=e;let s=n.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 i?.textDecoration&&(t.underline=i.textDecoration===Je),t.family=t.family?.trim().replace(/['"]+/g,""),t}function xi(i){let t=i.trim(),e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{variableName:e[1],fallbackValue:e[2]?.trim()??""}:{variableName:void 0,fallbackValue:t}}var j=class i{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 i(e,this.privateAPI):null}},x,U,de=class extends g{constructor(){super(...arguments);h(this,x)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");let r=Ci(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return await n.refComponents.isRefComponent(s)?new j(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await d(this,x,U).call(this);if(await s.refComponents.isRefComponent(r))return new j(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await d(this,x,U).call(this);if(!await e.refComponents.isRefComponent(n))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);if(!await n.refComponents.isRefComponent(s))throw St(ct.NotAvailableMethod,"not available for the current component type");return new j(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await d(this,x,U).call(this);return new j(s,n).getNestedWidget(e)}};x=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw St(ct.UndefinedCompRef);return s};var Mi=new I(de).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),pn=Mi.build();function Ti(i){return`${i.cssVariableName?`var(${i.cssVariableName}, `:""}${i.italic?"italic ":""}${i.bold?"bold ":""}${i.size||16}px ${i.family?.split(",").map(t=>`"${t.replace(/['"]+/g,"")}"`).join(",")||"serif"}${i.cssVariableName?")":""}`}function Ri(i){if(!i)return null;let t=i,e=t.match(/var\((--[\w-]+),\s*(.+)\)/);return e?{cssVariableName:e[1],color:e[2]}:{color:t}}function Ye(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var _i={transformFontInternalValue:i=>{if(i){let{theme:t,cssVariableName:e,bold:n,italic:s,underline:r,...o}=i;return{...o,style:{bold:n,italic:s,underline:r},editorKey:e||t||""}}else return{editorKey:"font_7",family:"helvetica-w01-roman",size:16,style:{}}}},ue=class extends g{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Ri(t),r=Ye(s);return await n.inputs.openColorPicker({color:s?.cssVariableName||s?.theme||s?.color},({color:o,theme:c,cssVariableTheme:p})=>{s={color:o,theme:c,cssVariableName:p},r=Ye(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=He(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:_i.transformFontInternalValue(s)},(o,c)=>{r={font:Ti(o),textDecoration:o.underline?Je:void 0},e?.onChange?.(r)}),r}},hn=new I(ue).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),fe=class extends g{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},dn=new I(fe).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),Pe=class extends g{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},un=new I(Pe).withPublicMethod("openDashboardModal").build(),Ie=class extends g{async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e)}async setStyles(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setStyles(n,t)}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e)}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,t)}async getPresetDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getPresetDefinitions(e)}async getAppliedPreset(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getAppliedPreset(e)}async applyPreset(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.applyPreset(n,t)}async getState(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getState(e)}async setState(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setState(n,t)}async getStateDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStateDefinitions(e)}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onContextualManifestChange(n,t)}async selectFont(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!0})}catch{}}async selectFontFamily(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,{...t,showWeights:!1})}catch{}}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,t)}catch{}}async selectFontWeight(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectFontWeight(n,t)}},fn=new I(Ie).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").build(),ge=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)}},Pn=new I(ge).withPublicMethod("set").withPublicMethod("get").build(),me=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)}},In=new I(me).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),Di=()=>{let i=new URLSearchParams(window.location.search),t=i.has("essentials")?JSON.parse(i.get("essentials")):void 0,{monitoring:e,...n}=t||{},s=i.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:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,essentials:n}},Si=()=>({environment:{},applicationContext:y.getInstance(),channel:{observeState:async()=>({disconnect(){}})}}),Ae={host:()=>typeof importScripts=="function"?Si():Di(),auth:bi};var wn=()=>{let i=Ae.host(),t=Ae.auth();ve({auth:t,host:i}).enableContext("module")};export{wn as enableClient};
|
|
8
8
|
//# sourceMappingURL=editor.js.map
|