@wix/cli-app 1.1.139 → 1.1.140

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.
Files changed (62) hide show
  1. package/build/{AddPermissionCommand-7JSFSDHK.js → AddPermissionCommand-NSY6CEE2.js} +2 -2
  2. package/build/{DevCommand-2Q7AUUFO.js → DevCommand-6THKB2UT.js} +10 -10
  3. package/build/{GenerateCommand-SGE7RW5B.js → GenerateCommand-IGVE2TFF.js} +9 -9
  4. package/build/{GenerateCommand-SGE7RW5B.js.map → GenerateCommand-IGVE2TFF.js.map} +1 -1
  5. package/build/{LogsCommand-Z3ZFWXRZ.js → LogsCommand-SS45T57U.js} +3 -3
  6. package/build/PreviewCommand-AODTRQTM.js +19 -0
  7. package/build/ReleaseCommand-JAX34O2L.js +23 -0
  8. package/build/{ServeCommand-LXDCHXMI.js → ServeCommand-BM55BCOU.js} +3 -3
  9. package/build/{build-5YGGI7BS.js → build-J2HETDZI.js} +6 -6
  10. package/build/{chunk-6Y76ODLQ.js → chunk-2FVKEIJ5.js} +6 -6
  11. package/build/{chunk-QYPLCT5B.js → chunk-2SVNVOOM.js} +2 -2
  12. package/build/{chunk-4OEENWJ2.js → chunk-5VOHUEJZ.js} +6 -6
  13. package/build/{chunk-77QRLTEW.js → chunk-DWZY66UM.js} +7 -7
  14. package/build/{chunk-XVTQMWYF.js → chunk-HNOVIS2K.js} +3 -3
  15. package/build/{chunk-VIMDBBS7.js → chunk-JFZ53YPS.js} +2 -2
  16. package/build/{chunk-Z4YOWDFB.js → chunk-LU5CPJ2T.js} +24 -3
  17. package/build/{chunk-Z4YOWDFB.js.map → chunk-LU5CPJ2T.js.map} +1 -1
  18. package/build/{chunk-NZLGBI2J.js → chunk-M7YMXDBL.js} +4 -4
  19. package/build/{chunk-BQP36DXK.js → chunk-N3CKEHS4.js} +4 -4
  20. package/build/{chunk-UYQGHBTE.js → chunk-NWTT6SK7.js} +2 -2
  21. package/build/{chunk-3F37CLLG.js → chunk-O5EPBPLV.js} +2 -2
  22. package/build/{chunk-KMAKXP7M.js → chunk-PJN63LQ2.js} +2 -2
  23. package/build/{chunk-ZB45Z5HF.js → chunk-RKBUTYIV.js} +3 -3
  24. package/build/{chunk-RVBAYSWR.js → chunk-WMF3LWOK.js} +2 -2
  25. package/build/{chunk-LYKHENNA.js → chunk-XEBT3FLD.js} +2 -2
  26. package/build/{chunk-TTFLIV5F.js → chunk-YDV74I64.js} +14 -2
  27. package/build/{chunk-TTFLIV5F.js.map → chunk-YDV74I64.js.map} +1 -1
  28. package/build/{chunk-EA7P2QKZ.js → chunk-ZGQVB5ZC.js} +15 -7
  29. package/build/{chunk-EA7P2QKZ.js.map → chunk-ZGQVB5ZC.js.map} +1 -1
  30. package/build/index.js +23 -23
  31. package/build/platform-sdk/editor.js +2 -2
  32. package/build/platform-sdk/editor.js.map +1 -1
  33. package/build/{preview-NU6OB6KY.js → preview-Y6J3H7N7.js} +12 -12
  34. package/build/{release-LT2ZID2B.js → release-W36V57VM.js} +14 -14
  35. package/build/{render-command-6VCFCUBB.js → render-command-ZPLZEDG3.js} +5 -5
  36. package/package.json +3 -3
  37. package/build/PreviewCommand-OIQUGALX.js +0 -19
  38. package/build/ReleaseCommand-CFRWCWNC.js +0 -23
  39. /package/build/{AddPermissionCommand-7JSFSDHK.js.map → AddPermissionCommand-NSY6CEE2.js.map} +0 -0
  40. /package/build/{DevCommand-2Q7AUUFO.js.map → DevCommand-6THKB2UT.js.map} +0 -0
  41. /package/build/{LogsCommand-Z3ZFWXRZ.js.map → LogsCommand-SS45T57U.js.map} +0 -0
  42. /package/build/{PreviewCommand-OIQUGALX.js.map → PreviewCommand-AODTRQTM.js.map} +0 -0
  43. /package/build/{ReleaseCommand-CFRWCWNC.js.map → ReleaseCommand-JAX34O2L.js.map} +0 -0
  44. /package/build/{ServeCommand-LXDCHXMI.js.map → ServeCommand-BM55BCOU.js.map} +0 -0
  45. /package/build/{build-5YGGI7BS.js.map → build-J2HETDZI.js.map} +0 -0
  46. /package/build/{chunk-6Y76ODLQ.js.map → chunk-2FVKEIJ5.js.map} +0 -0
  47. /package/build/{chunk-QYPLCT5B.js.map → chunk-2SVNVOOM.js.map} +0 -0
  48. /package/build/{chunk-4OEENWJ2.js.map → chunk-5VOHUEJZ.js.map} +0 -0
  49. /package/build/{chunk-77QRLTEW.js.map → chunk-DWZY66UM.js.map} +0 -0
  50. /package/build/{chunk-XVTQMWYF.js.map → chunk-HNOVIS2K.js.map} +0 -0
  51. /package/build/{chunk-VIMDBBS7.js.map → chunk-JFZ53YPS.js.map} +0 -0
  52. /package/build/{chunk-NZLGBI2J.js.map → chunk-M7YMXDBL.js.map} +0 -0
  53. /package/build/{chunk-BQP36DXK.js.map → chunk-N3CKEHS4.js.map} +0 -0
  54. /package/build/{chunk-UYQGHBTE.js.map → chunk-NWTT6SK7.js.map} +0 -0
  55. /package/build/{chunk-3F37CLLG.js.map → chunk-O5EPBPLV.js.map} +0 -0
  56. /package/build/{chunk-KMAKXP7M.js.map → chunk-PJN63LQ2.js.map} +0 -0
  57. /package/build/{chunk-ZB45Z5HF.js.map → chunk-RKBUTYIV.js.map} +0 -0
  58. /package/build/{chunk-RVBAYSWR.js.map → chunk-WMF3LWOK.js.map} +0 -0
  59. /package/build/{chunk-LYKHENNA.js.map → chunk-XEBT3FLD.js.map} +0 -0
  60. /package/build/{preview-NU6OB6KY.js.map → preview-Y6J3H7N7.js.map} +0 -0
  61. /package/build/{release-LT2ZID2B.js.map → release-W36V57VM.js.map} +0 -0
  62. /package/build/{render-command-6VCFCUBB.js.map → render-command-ZPLZEDG3.js.map} +0 -0
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-3F37CLLG.js";
6
+ } from "./chunk-O5EPBPLV.js";
7
7
  import {
8
8
  runCommand
9
- } from "./chunk-NZLGBI2J.js";
10
- import "./chunk-RVBAYSWR.js";
9
+ } from "./chunk-M7YMXDBL.js";
10
+ import "./chunk-WMF3LWOK.js";
11
11
  import "./chunk-3QFT6UQF.js";
12
- import "./chunk-KMAKXP7M.js";
12
+ import "./chunk-PJN63LQ2.js";
13
13
  import {
14
14
  external_exports,
15
15
  package_default,
16
16
  require_react
17
- } from "./chunk-Z4YOWDFB.js";
17
+ } from "./chunk-LU5CPJ2T.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-6VCFCUBB.js");
3381
- const { build } = await import("./build-5YGGI7BS.js");
3380
+ const { runCommand: runCommand2 } = await import("./render-command-ZPLZEDG3.js");
3381
+ const { build } = await import("./build-J2HETDZI.js");
3382
3382
  await runCommand2(command, services, build);
3383
3383
  });
3384
3384
 
@@ -3443,8 +3443,8 @@ var devCommand = (services) => {
3443
3443
  return createCommand("dev").option("-s, --https", t("dev_command_def.option.https")).option("--port <port>", t("dev_command_def.option.port"), validatePort).addOption(
3444
3444
  new Option("--origin <url>", t("dev_command_def.option.origin")).argParser(validateBase).hideHelp()
3445
3445
  ).action(async (options, command) => {
3446
- const { DevCommand } = await import("./DevCommand-2Q7AUUFO.js");
3447
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3446
+ const { DevCommand } = await import("./DevCommand-6THKB2UT.js");
3447
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3448
3448
  const { https = false, origin, port } = options;
3449
3449
  await renderCommand(
3450
3450
  command,
@@ -3483,17 +3483,17 @@ var previewCommand = (services) => {
3483
3483
  ).hideHelp()
3484
3484
  ).action(async (options, command) => {
3485
3485
  const { site, baseUrl, json } = options;
3486
- const { renderCommand, runCommand: runCommand2 } = await import("./render-command-6VCFCUBB.js");
3486
+ const { renderCommand, runCommand: runCommand2 } = await import("./render-command-ZPLZEDG3.js");
3487
3487
  if (json) {
3488
3488
  return runCommand2(command, services, async (model) => {
3489
- const { nonInteractivePreview } = await import("./preview-NU6OB6KY.js");
3489
+ const { nonInteractivePreview } = await import("./preview-Y6J3H7N7.js");
3490
3490
  return nonInteractivePreview(services, model, {
3491
3491
  baseUrl,
3492
3492
  siteId: site
3493
3493
  });
3494
3494
  });
3495
3495
  }
3496
- const { PreviewCommand } = await import("./PreviewCommand-OIQUGALX.js");
3496
+ const { PreviewCommand } = await import("./PreviewCommand-AODTRQTM.js");
3497
3497
  await renderCommand(
3498
3498
  command,
3499
3499
  services,
@@ -3510,8 +3510,8 @@ var addPermissionCommand = (services) => {
3510
3510
  return createCommand("add-permission").description("adding a permission to the app").addOption(
3511
3511
  new Option("-p, --permission-id <id>", t("the permission id to add"))
3512
3512
  ).action(async (options, command) => {
3513
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3514
- const { AddPermissionCommand } = await import("./AddPermissionCommand-7JSFSDHK.js");
3513
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3514
+ const { AddPermissionCommand } = await import("./AddPermissionCommand-NSY6CEE2.js");
3515
3515
  const { permissionId = "" } = options;
3516
3516
  await renderCommand(
3517
3517
  command,
@@ -3527,8 +3527,8 @@ var import_react4 = __toESM(require_react(), 1);
3527
3527
  var serveCommand = (services) => {
3528
3528
  const t = createI18nT();
3529
3529
  return createCommand("serve").description(t("serve_command_def.description")).action(async (_, command) => {
3530
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3531
- const { ServeCommandDeprecated } = await import("./ServeCommand-LXDCHXMI.js");
3530
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3531
+ const { ServeCommandDeprecated } = await import("./ServeCommand-BM55BCOU.js");
3532
3532
  await renderCommand(command, services, /* @__PURE__ */ import_react4.default.createElement(ServeCommandDeprecated, null));
3533
3533
  });
3534
3534
  };
@@ -3543,8 +3543,8 @@ var generateCommand = (services) => {
3543
3543
  t("generate_command.type_flag"),
3544
3544
  validateDocsExtensionType
3545
3545
  ).description(t("generate_command.description")).action(async (options, command) => {
3546
- const { GenerateCommand } = await import("./GenerateCommand-SGE7RW5B.js");
3547
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3546
+ const { GenerateCommand } = await import("./GenerateCommand-IGVE2TFF.js");
3547
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3548
3548
  const { type } = options;
3549
3549
  await renderCommand(
3550
3550
  command,
@@ -3568,8 +3568,8 @@ var logsCommand = (services) => {
3568
3568
  validateVersion
3569
3569
  ).action(async (options, command) => {
3570
3570
  const { version } = options;
3571
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3572
- const { LogsCommand } = await import("./LogsCommand-Z3ZFWXRZ.js");
3571
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3572
+ const { LogsCommand } = await import("./LogsCommand-SS45T57U.js");
3573
3573
  await renderCommand(command, services, /* @__PURE__ */ import_react6.default.createElement(LogsCommand, { version }));
3574
3574
  });
3575
3575
  };
@@ -3602,8 +3602,8 @@ var releaseCommand = (services) => {
3602
3602
  t("app_preview_command_def.option.json")
3603
3603
  ).hideHelp()
3604
3604
  ).action(async (options, command) => {
3605
- const { renderCommand } = await import("./render-command-6VCFCUBB.js");
3606
- const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-CFRWCWNC.js");
3605
+ const { renderCommand } = await import("./render-command-ZPLZEDG3.js");
3606
+ const { ReleaseCommand, ReleaseVersionType } = await import("./ReleaseCommand-JAX34O2L.js");
3607
3607
  const { baseUrl, site, comment, json } = options;
3608
3608
  const versionType = options.versionType ? {
3609
3609
  major: ReleaseVersionType.MAJOR,
@@ -3617,7 +3617,7 @@ var releaseCommand = (services) => {
3617
3617
  };
3618
3618
  if (json) {
3619
3619
  return runCommand(command, services, async (model) => {
3620
- const { nonInteractiveRelease } = await import("./release-LT2ZID2B.js");
3620
+ const { nonInteractiveRelease } = await import("./release-W36V57VM.js");
3621
3621
  return nonInteractiveRelease(services, model, props);
3622
3622
  });
3623
3623
  }
@@ -1,8 +1,8 @@
1
- import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-RJD2G2AE.js";import"./chunk-Y4HYNW3N.js";import{c as fi,d as Pi}from"./chunk-7EYXEF6M.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var gi=A&&A.__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]}),mi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__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"&&gi(e,t,n[s]);return mi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{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,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"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(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});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||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.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:C.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:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=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(`
1
+ import{a as ke}from"./chunk-EZGPNUD5.js";import{a as Ne}from"./chunk-RJD2G2AE.js";import"./chunk-Y4HYNW3N.js";import{c as fi,d as Pi}from"./chunk-7EYXEF6M.js";import{b as Se,d as Oe,e as ui,f as l,g as a,h,i as w,j as u}from"./chunk-SBZEOPXX.js";var Fe=Se(ht=>{"use strict";Object.defineProperty(ht,"__esModule",{value:!0});ht.EventType=void 0;var We;(function(i){i.removeAppCompleted="removeAppCompleted",i.componentSelectionChanged="componentSelectionChanged",i.appInstalled="appInstalled",i.appUpdateCompleted="appUpdateCompleted"})(We||(ht.EventType=We={}))});var Ut=Se(A=>{"use strict";var mi=A&&A.__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]}),gi=A&&A.__setModuleDefault||(Object.create?function(i,t){Object.defineProperty(i,"default",{enumerable:!0,value:t})}:function(i,t){i.default=t}),Ii=A&&A.__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"&&mi(e,t,n[s]);return gi(e,t),e}}();Object.defineProperty(A,"__esModule",{value:!0});A.EventType=A.WixSDKTypes=void 0;var wi=Ii((Pi(),ui(fi)));A.WixSDKTypes=wi;var Ai=Fe();Object.defineProperty(A,"EventType",{enumerable:!0,get:function(){return Ai.EventType}})});var H=Oe(Ut(),1);var O=class O{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,O.EventSteps.Start),n=await n,this.notifyWithStep(t,O.EventSteps.End),n}catch(s){throw this.notifyWithStep({...t,meta:{...t.meta,error:s}},O.EventSteps.Error),s}else return this.notify(t),n}};l(O,"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(O,"EventSteps",{Start:"start",End:"end",Error:"error"});var $t=O,ut=(i=>(i.WorkerSpawn="WorkerSpawn",i.HostEvent="HostEvent",i.ApplicationsSpecsReceived="ApplicationsSpecsReceived",i.InitApplicationApi="InitApplicationApi",i.RunApplication="RunApplication",i.getApplicationApi="getApplicationApi",i.IframeInit="IframeInit",i))(ut||{}),qt=(i=>(i.EditorReady="EditorReady",i))(qt||{});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||{}),jt=class{createApplicationRemovedEvent(t){return{type:"ApplicationRemoved",payload:{appDefinitionId:t},meta:{bi:{evid:C.biEvents.PLATFORM_WORKER_SPAWN,appDefId:t}}}}createApplicationLoadEvent(t,e){return{type:"ApplicationLoad",payload:{appDefinitionId:t.appDefinitionId,url:e},meta:{bi:{evid:C.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:C.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:C.biEvents.PLATFORM_APP_API_INIT,appDefId:t,scope:e}}}}},C=class extends $t{constructor(){super(...arguments);l(this,"factories",new jt)}},dt=class dt{constructor(t){this.events=t}mapToPlatformHostEvent(t){if(typeof t=="string")try{t=JSON.parse(t)}catch{}return{type:ut.HostEvent,payload:{type:t.args.eventType,...t.args.eventPayload},meta:{appDefinitionId:t.appDefinitionId??null,intent:t.intent}}}notify(t){let e=this.mapToPlatformHostEvent(t);dt.allowedEvents.includes(e.payload.type)&&this.events.notify(e)}};l(dt,"allowedEvents",[H.EventType.componentSelectionChanged,H.EventType.appInstalled,H.EventType.appUpdateCompleted,H.EventType.removeAppCompleted]);var Le=dt;var I=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
3
  `)}getMessage(){let e=Object.entries(this.state).reduce((c,[p,d])=>(d&&c.push(` \u2013 ${p}: ${d}`),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 y(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var zt=class extends I{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},yi=y(zt);var j=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))(j||{}),Bt=class extends I{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}},Y=y(Bt);async function xi(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 Vt=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=()=>xi(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())})}},vi=200,bi=50,k,Gt,Ue,ft=class{constructor(t){h(this,k);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,k,Gt).call(this)||u(this,k,Ue).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<bi){r%10===0&&console.log(Y(j.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=Y(j.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},vi))};o(),u(this,k,Gt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};k=new WeakSet,Gt=function(){return globalThis[this.injectionUUID]?.promise},Ue=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 Kt="__ENVIRONMENT_CONTEXT_KEY",mt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(mt||{}),Pt=class Pt{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[Kt])throw Y(j.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[Kt]=new Pt(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[Kt]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};l(Pt,"status",new ft("environment"));var N=Pt,J="__APPLICATION_CONTEXT_KEY",gt=class gt{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new Vt(t.appDefinitionId?t.appDefinitionId:null,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[J])throw Y(j.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[J]=new gt(t,await N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[J])}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 Y(j.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};l(gt,"status",new ft("application"));var x=gt;var ti=Oe(Ut());var et=i=>`"editor-platform-transport": ${i}`,qe=i=>et(`[Internal Error] ${i}`),ze="\u0192",Ke="\u2202",Be="_get_",Ve="_set_",It="+",$e="-",ee="\xB7",ie="\xD7",ne="\xB0",Ge=i=>i[0]===ie?"":i,je=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",Ci=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),Ei=i=>q(i.split(ee)),q=i=>i.map(Ge).filter(Boolean).join(".");function _t(i,t){return{marker:i,...t}}var Mi=_t("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",ne)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),_i=_t("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)}}}),Ti=_t("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)}}}),Jt=_t("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("",ne);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}}}),He=[Mi,Ti,_i];function Ri(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Di(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Ge).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&&!je(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),je(r)){t(o,{...n(o),value:r});return}let c=He.find(p=>p.shouldUse(r))??Jt;if(c){c.serialize(r,(p,d)=>{s(d,[...o,`${ie}${c.marker}`,p])});return}};return s(i)}var Si=(i,t)=>{if(!Ci(i))throw new Error(et("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(Ei(r),(...c)=>o.context[o.pointer](...c)),n(r,ze)};return Di(i,(r,{value:o,context:c,pointer:p})=>{let d=r.slice(1).join(ee),f=Ri(c,p);if(f?.get||f?.set){f?.get&&t(q([...r,Be]),()=>c[p]),f?.set&&t(q([...r,Ve]),G=>{c[p]=G});let S=[f?.get?It:$e,f?.set?It:$e];n(d,`${Ke}${S.join("")}`)}else typeof o=="function"?s(d,{context:c,pointer:p}):n(d,o)}),e},Oi=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(ee),c=Jt,p=null;for(let d=0;d<o.length;d++){let f=o[d];if(f[0]===ie){let S=c.deserialize.has(r,p);if(c=[Jt,...He].find(G=>G.marker===f[1]),!c)throw new Error(et(`unknown marker "${f[1]}"`));S||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===ne)return e;if(s?.toString()===ze)c.deserialize.append(r,p,t(q(o)));else if(s?.toString()[0]===Ke){let d=s?.toString()[1]===It,f=s?.toString()[2]===It,S={};if(d){let G=t(q([...o,Be]));S.get=()=>G()}f&&(S.set=t(q([...o,Ve]))),Object.defineProperty(r,p,S)}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 Q=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(Q||{}),T=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:Si(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,Oi(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Yt=class extends T{constructor(t){super("Cleanup",t)}},Xt=class extends T{constructor(t){super("Response",t)}},wt=class extends T{constructor(t){super("Response",t)}},Qt=class extends T{constructor(t){super("Call",t)}},Ht=(i,t)=>`${i}_${t}`,Ct,Et,z,E,Zt=class{constructor(t){h(this,Ct,new FinalizationRegistry(t=>{this.postMessage(new Yt(t))}));h(this,Et,{[Q.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,z)[e],n&&delete a(this,E)[n]},[Q.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,E)[e]?.reject(r)}else a(this,E)[e]?.reject(n);else{let s=t.payload.response;a(this,E)[e]?.resolve(s)}delete a(this,E)[e]},[Q.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,z)[e];if(!n){this.postMessage(new wt({callId:t.payload.callId,errorMessage:et("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Xt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new wt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,z,{});h(this,E,{});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,Ct).register(r,{functionMarkerKey:Ht(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=Ht(t,e);a(this,z)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Qt({callId:s,functionMarkerKey:Ht(t,e),props:n})),new Promise((r,o)=>{a(this,E)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};Ct=new WeakMap,Et=new WeakMap,z=new WeakMap,E=new WeakMap;var At=class extends Zt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(et('wrong exposed API instance, "type" property is required'));this.queue.push(new T(Q.ExposeAPI,e)),this.flush()}};var X=(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))(X||{});var K,_,Mt,Ye,te=class{constructor(t,e){h(this,Mt);h(this,K,new Set);h(this,_);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,_,t),u(this,Mt,Ye).call(this)}dispose(){a(this,_)&&(a(this,_).close(),a(this,_).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,_=new WeakMap,Mt=new WeakSet,Ye=function(){let t=a(this,_);if(!t){console.warn(qe("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Z,tt,R,Xe,Qe,Ze,yt=class extends te{constructor(e,n){super(e,n);h(this,R);h(this,Z,!1);h(this,tt,`consumer-${Je()}`);u(this,R,Xe).call(this);let s={type:X.Ping};e(JSON.stringify(s))}};Z=new WeakMap,tt=new WeakMap,R=new WeakSet,Xe=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case X.Pong:{u(this,R,Qe).call(this);break}case X.Port:{u(this,R,Ze).call(this,n.targetMemberId,e.ports?.[0]);break}}}catch{}})},Qe=function(){if(a(this,Z))return;w(this,Z,!0);let e={type:X.RequestPort,memberId:a(this,tt)};this.postMessage(JSON.stringify(e))},Ze=function(e,n){if(e===a(this,tt)){if(!n)throw new Error(qe("no port at consumer handshake"));this.setActivePort(n)}};var xt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},vt=class i extends xt{constructor(){super(...arguments);l(this,"handshake",new yt(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new At(s).expose(e)})}};var bt=class i extends xt{constructor(){super(...arguments);l(this,"handshake",new yt(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new At(s).expose(e)})}};var Tt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case qt.EditorReady:this.platformAppEvents.notify({...t,type:v.EditorReady});break;case ut.HostEvent:this.platformAppEvents.notify({...t,type:v.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},pe=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(pe||{}),Rt=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 x.inject(t)}},Ni={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"},it,nt,St,st,Ot,ei,re=class extends Rt{constructor(){super(pe.Frame,mt.Frame);h(this,Ot);h(this,it,new C);h(this,nt,new Tt(a(this,it)));h(this,St);h(this,st);u(this,Ot,ei).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,st,n),w(this,St,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,it),applicationAPIs:o?{[o]:a(this,st)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,nt).notify(e)}subscribe(e){a(this,nt).subscribe(e)}};it=new WeakMap,nt=new WeakMap,St=new WeakMap,st=new WeakMap,Ot=new WeakSet,ei=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=Ni[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 D=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(D||{}),oe=class extends I{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}},W=y(oe),ki="__APPLICATION_REGISTRY_KEY";async function Wi(i,t,e){let n=new Function(J,ki,e),s,r=o=>{if(s)throw W(D.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw W(D.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 x(o,await N.getInstance()),r)}catch(o){throw W(D.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(W(D.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(W(D.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var F,rt,m,ae=class{constructor(t,e){h(this,F,{});h(this,rt);h(this,m);w(this,rt,t),w(this,m,e),a(this,m).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===ti.EventType.removeAppCompleted&&a(this,m).withEvent(a(this,m).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,m).withEvent(a(this,m).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,rt).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,m).withEvent(a(this,m).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw W(D.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 W(D.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:n}=await Wi(a(this,m),t,e);return n})}};F=new WeakMap,rt=new WeakMap,m=new WeakMap;var B,ot,at,L,ct,ce=class extends Rt{constructor(){super(pe.Worker,mt.Worker);h(this,B,new C);h(this,ot,new Tt(a(this,B)));h(this,at,null);h(this,L);h(this,ct,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,L,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,B),privateApi:a(this,L),applicationAPIs:{}}),w(this,at,new ae(a(this,L),a(this,B))),a(this,ct).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,ot).notify(e)}subscribe(e){a(this,ot).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,at).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,L))return e(this);a(this,ct).push(e)})}};B=new WeakMap,ot=new WeakMap,at=new WeakMap,L=new WeakMap,ct=new WeakMap;var se="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",V,ii,ni,Dt=class{constructor(){h(this,V)}isEnvironmentApiExposed(){return!!globalThis[se]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),x.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,V,ii).call(this),globalThis[se]=!0):e&&(u(this,V,ni).call(this),globalThis[se]=!0)}};V=new WeakSet,ii=function(){bt.exposeAPI(new ce)},ni=function(){vt.exposeAPI(new re)};var le=class extends I{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}},Pn=y(le);import{wixContext as b}from"@wix/sdk-context";function si(){let i=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(i)return{initWixModules(n,s){return he(()=>i(n,s))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof b.client<"u"?b.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,e=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof b.elevatedClient<"u"?b.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!e))return{initWixModules(n,s){if(s){if(!e)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return he(()=>e.use(n))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return he(()=>t.use(n))},fetchWithAuth:(n,s)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(n,s)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(n,s,r){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(n,s,r)}}}function he(i){let t=globalThis.__wix_context__,e={client:b.client,elevatedClient:b.elevatedClient},n;globalThis.__wix_context__=void 0,b.client=void 0,b.elevatedClient=void 0,typeof $wixContext<"u"&&(n={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return i()}finally{globalThis.__wix_context__=t,b.client=e.client,b.elevatedClient=e.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=n.client,$wixContext.elevatedClient=n.elevatedClient)}}function ri(i,t){return{...i,...Object.fromEntries(t.map(e=>[e,(...n)=>{let s=si();if(!s)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return s.initWixModules(i)[e].apply(void 0,n)}]))}}function oi(i){return ri({__type:"host",create:t=>Object.entries(i).reduce((e,[n,s])=>({...e,[n]:s(t)}),{})},Object.keys(i))}new Dt().expose();var de=class extends I{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},ai=y(de);function Fi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var Li=30*60*1e3,Ui=()=>{let i;return{getAuthHeaders:async()=>{let t=await x.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw ai("EmptyAppDefinitionId");return(!i||Fi(i.expires,Li))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(ai("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},P=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 oi(t)}},ue=class extends I{constructor(t,e){super(t,e,"Base SDK Error")}},$i=y(ue),g=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:x.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 $i("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},fe=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())}},Rn=new P(fe).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),kt=class extends g{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},Dn=new P(kt).withPublicMethod("addEventListener").build(),Pe=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 kt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},Sn=new P(Pe).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),ge=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()}async getThemeCustomProperties(t){return(await this.getPlatformPrivateAPI()).info.getThemeCustomProperties(t)}async getSiteFonts(t){return(await this.getPlatformPrivateAPI()).info.getSiteFonts(t)}},On=new P(ge).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").withPublicMethod("getSiteFonts").build(),lt=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(lt||{}),me=class extends I{constructor(t,e){super(t,e,"Widget Error")}},Nt=y(me),li="underline";function ji(i){return i.map(t=>pi({font:t}).family).filter(Boolean)}function pi(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=qi(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===li),t.family=t.family?.trim().replace(/['"]+/g,""),t}function qi(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 $=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}},M,U,Ie=class extends g{constructor(){super(...arguments);h(this,M)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);if(await n.refComponents.isRefComponent(s))throw Nt(lt.NotAvailableMethod,"not available for the current component type");let r=ji(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);return await n.refComponents.isRefComponent(s)?new $(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await u(this,M,U).call(this);if(await s.refComponents.isRefComponent(r))return new $(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await u(this,M,U).call(this);if(!await e.refComponents.isRefComponent(n))throw Nt(lt.NotAvailableMethod,"not available for the current component type");return new $(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);if(!await n.refComponents.isRefComponent(s))throw Nt(lt.NotAvailableMethod,"not available for the current component type");return new $(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);return new $(s,n).getNestedWidget(e)}};M=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Nt(lt.UndefinedCompRef);return s};var zi=new P(Ie).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),Nn=zi.build();function Ki(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 Bi(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 ci(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var Vi={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:{}}}},we=class extends g{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Bi(t),r=ci(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=ci(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=pi(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:Vi.transformFontInternalValue(s)},(o,c)=>{r={font:Ki(o),textDecoration:o.underline?li:void 0},e?.onChange?.(r)}),r}},kn=new P(we).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),Ae=class extends g{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},Wn=new P(Ae).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),ye=class extends g{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},Fn=new P(ye).withPublicMethod("openDashboardModal").build(),xe=class extends g{constructor(t=null,e=[]){super(t),this.overriddenApplicationContext=t,this.childPath=e}async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e,this.childPath)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e,this.childPath)}async setStyles({cssProperties:t,cssCustomProperties:e}={}){let n=await this.getPlatformPrivateAPI(),s=await this.getRequiredManifestContextId();return n.builderComponent.setStyles(s,this.childPath,{cssProperties:t,cssCustomProperties:e})}async removeStyles(t={}){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.removeStyles(n,this.childPath,t)}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e,this.childPath)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e,this.childPath)}async getResolvedData({dataItemKey:t}){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getResolvedData(n,this.childPath,{dataItemKey:t})}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,this.childPath,t)}async getPresetDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getPresetDefinitions(e,this.childPath)}async getAppliedPreset(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getAppliedPreset(e,this.childPath)}async applyPreset(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.applyPreset(n,this.childPath,t)}async getDisplayGroupDefinitions(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getDisplayGroupDefinitions(n,this.childPath,t)}async getState(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getState(e,this.childPath)}async setState(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setState(n,this.childPath,t)}async getStateDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStateDefinitions(e,this.childPath)}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onChange(n,this.childPath,t)}async selectFont(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,this.childPath,{...t,showWeights:!0})}catch{}}async selectFontFamily(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,this.childPath,{...t,showWeights:!1})}catch{}}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,this.childPath,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,this.childPath,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,this.childPath,t)}catch{}}async selectFontWeight(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return{weight:await e.builderComponent.selectFontWeight(n,this.childPath,t)}}async selectTextTheme(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectTextTheme(n,t)}async getArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getSelectedArrayIndex(n,this.childPath,t)}async setArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setSelectedArrayIndex(n,this.childPath,t)}async resetArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.resetSelectedArrayIndex(n,this.childPath,t)}},Ln=new P(xe).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").withPublicMethod("getArrayItemsSelectedIndex").withPublicMethod("setArrayItemsSelectedIndex").withPublicMethod("resetArrayItemsSelectedIndex").build(),ve=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)}},Un=new P(ve).withPublicMethod("set").withPublicMethod("get").build(),be=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)}},$n=new P(be).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),hi=(i=>(i.UndefinedCompRef="UndefinedCompRef",i))(hi||{}),Ce=class extends I{constructor(t,e){super(t,e,"Controllers Error")}},Gi=y(Ce),Lt,di,Ee=class extends g{constructor(){super(...arguments);h(this,Lt)}async get(){return(await this.getPlatformPrivateAPI()).controllers.get(await this.getAppDefinitionId(),await u(this,Lt,di).call(this))}};Lt=new WeakSet,di=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Gi(hi.UndefinedCompRef);return s};var jn=new P(Ee).withPublicMethod("get").build(),Wt=class{constructor(t,e,n,s){this.privateAPI=t,this.compRef=e,this.bindingTargetId=n,this.config=s}update(t){return this.privateAPI.bindings.update(this.compRef,this.bindingTargetId,{config:t.config,role:t.role})}delete(){return this.privateAPI.bindings.delete(this.compRef,this.bindingTargetId)}get connectionConfig(){return this.config}},Me=class extends g{async get(t){let e=await this.getPlatformPrivateAPI(),n=await e.components.getSelectedComponents();if(n.length!==1)return null;let[s]=n,r=e.bindings.get(t.id,s);return r?new Wt(e,s,t.id,r):null}},qn=new P(Me).withPublicMethod("get").build(),_e=class{constructor(t,e,n,s){this.privateAPI=t,this.compRef=e,this.dataItemTarget=n,this.name=s}select(){return this.privateAPI.bindings.openDataBindingPanel(this.dataItemTarget.id)}createBinding(t){return this.privateAPI.bindings.create(this.compRef,{dataItemId:this.dataItemTarget.id,bindingItemType:"dataBinding",...t})?new Wt(this.privateAPI,this.compRef,this.dataItemTarget.id,JSON.stringify(t)):null}},Te=class extends g{async list(t){let e=await this.getPlatformPrivateAPI(),n=await e.components.getSelectedComponents();if(n.length!==1)return[];let[s]=n;return await e.bindings.canCreateBindingsProvider(s)?[new _e(e,s,t,"dataBinding")]:[]}},zn=new P(Te).withPublicMethod("list").build(),Re=class{constructor(t){l(this,"getContextIds",()=>{throw new Error("Not implemented yet")});l(this,"openItemSelector",t=>{throw new Error("Not implemented yet")});this.applicationContext=t}async workspaceAPI(){return await(await this.applicationContext).getPrivateAPI().workspace}},pt,Ft=class{constructor(t){h(this,pt);w(this,pt,new Re(t))}getAPI(){return a(this,pt)}};pt=new WeakMap;var Hi=()=>{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=ke({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0}),p=x.getInstance(),d=new Ft(p);return{environment:{},applicationContext:p,channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,workspace:d.getAPI(),essentials:n}},Ji=()=>{let i=x.getInstance(),t=new Ft(i);return{environment:{},applicationContext:i,channel:{observeState:async()=>({disconnect(){}})},workspace:t.getAPI()}},De={host:()=>typeof importScripts=="function"?Ji():Hi(),auth:Ui};var Hn=()=>{let i=De.host(),t=De.auth();Ne({auth:t,host:i}).enableContext("module")};export{Hn 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 y(i){return function t(e,n=""){let s=new i(n,e);return Error.captureStackTrace&&Error.captureStackTrace(s,t),s}}var zt=class extends I{constructor(e,n){super(e,n,"Editor Platform Internal Error");l(this,"state",{})}withHost(e){return this.state={...this.state,host:e},this}},yi=y(zt);var j=(i=>(i.IncorrectEnvironment="IncorrectEnvironment",i))(j||{}),Bt=class extends I{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}},Y=y(Bt);async function xi(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 Vt=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=()=>xi(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())})}},vi=200,bi=50,k,Gt,Ue,ft=class{constructor(t){h(this,k);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,k,Gt).call(this)||u(this,k,Ue).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<bi){r%10===0&&console.log(Y(j.IncorrectEnvironment,"contexts are not resolved, still re-trying").withMessage(`try number ${r}`).message),o();return}if(!n){let c=Y(j.IncorrectEnvironment,"contexts are not resolved, threw by timeout");e(c)}},vi))};o(),u(this,k,Gt).call(this)?.then(()=>{n=!0,clearTimeout(s),t()})})}};k=new WeakSet,Gt=function(){return globalThis[this.injectionUUID]?.promise},Ue=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 Kt="__ENVIRONMENT_CONTEXT_KEY",gt=(i=>(i.Worker="Worker",i.Frame="Frame",i.ComponentPanel="ComponentPanel",i))(gt||{}),Pt=class Pt{constructor(t){this.environmentContext=t}static async inject(t){if(globalThis[Kt])throw Y(j.IncorrectEnvironment,"Environment context already exists and should not be overridden");globalThis[Kt]=new Pt(t),this.status.resolveInjected()}static async getInstance(){return await this.status.waitInjected(),globalThis[Kt]}getPrivateAPI(){return this.environmentContext.privateApi}getEvents(){return this.environmentContext.events}getApplicationAPIs(){return this.environmentContext.applicationAPIs??{}}getEnvironment(){return this.environmentContext.environment}};l(Pt,"status",new ft("environment"));var N=Pt,J="__APPLICATION_CONTEXT_KEY",mt=class mt{constructor(t,e){l(this,"events");this.context=t,this.environment=e,this.events=new Vt(t.appDefinitionId?t.appDefinitionId:null,this.environment.getEvents(),this.environment.getPrivateAPI())}static async inject(t){if(globalThis[J])throw Y(j.IncorrectEnvironment,"Application context already exists and should not be overridden");globalThis[J]=new mt(t,await N.getInstance()),this.status.resolveInjected()}static async getInstance(){return typeof __APPLICATION_CONTEXT_KEY<"u"?__APPLICATION_CONTEXT_KEY:(await this.status.waitInjected(),globalThis[J])}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 Y(j.IncorrectEnvironment,"appDefinitionId is not available");return this.environment.getApplicationAPIs()[t]}};l(mt,"status",new ft("application"));var x=mt;var ti=Oe(Ut());var et=i=>`"editor-platform-transport": ${i}`,qe=i=>et(`[Internal Error] ${i}`),ze="\u0192",Ke="\u2202",Be="_get_",Ve="_set_",It="+",$e="-",ee="\xB7",ie="\xD7",ne="\xB0",Ge=i=>i[0]===ie?"":i,je=i=>i===null||typeof i>"u"||typeof i=="symbol"||typeof i=="number"||typeof i=="boolean"||typeof i=="function"||typeof i=="string",Ci=i=>!!i&&typeof i=="object"&&!Array.isArray(i)&&!(i instanceof Date)&&!(i instanceof Set)&&!(i instanceof Map),Ei=i=>q(i.split(ee)),q=i=>i.map(Ge).filter(Boolean).join(".");function _t(i,t){return{marker:i,...t}}var Mi=_t("A",{shouldUse:i=>Array.isArray(i),serialize:(i,t)=>{i.length?i.forEach((e,n)=>{t(`${n}`,e)}):t("",ne)},deserialize:{create:()=>[],has:(i,t)=>!(typeof i[t]>"u"),append:(i,t,e)=>{i.push(e)}}}),_i=_t("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)}}}),Ti=_t("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)}}}),Jt=_t("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("",ne);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}}}),He=[Mi,Ti,_i];function Ri(i,t){let e=i;for(;e;){let n=Object.getOwnPropertyDescriptor(e,t);if(n)return n;e=Reflect.getPrototypeOf(e)}return null}function Di(i,t){let e=new WeakMap,n=r=>{let o=r.slice(1).map(Ge).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&&!je(r)&&(e.has(r)&&e.set(r,[]),e.set(r,[...e.get(r)??[],o.join(".")])),je(r)){t(o,{...n(o),value:r});return}let c=He.find(p=>p.shouldUse(r))??Jt;if(c){c.serialize(r,(p,d)=>{s(d,[...o,`${ie}${c.marker}`,p])});return}};return s(i)}var Si=(i,t)=>{if(!Ci(i))throw new Error(et("only objects are serializable at the root level"));let e={data:[]},n=(r,o)=>{e.data.push([r,o])},s=(r,o)=>{t(Ei(r),(...c)=>o.context[o.pointer](...c)),n(r,ze)};return Di(i,(r,{value:o,context:c,pointer:p})=>{let d=r.slice(1).join(ee),f=Ri(c,p);if(f?.get||f?.set){f?.get&&t(q([...r,Be]),()=>c[p]),f?.set&&t(q([...r,Ve]),G=>{c[p]=G});let S=[f?.get?It:$e,f?.set?It:$e];n(d,`${Ke}${S.join("")}`)}else typeof o=="function"?s(d,{context:c,pointer:p}):n(d,o)}),e},Oi=(i,t)=>typeof i!="object"||i===null?i:i.data.reduce((e,[n,s])=>{let r=e,o=n.split(ee),c=Jt,p=null;for(let d=0;d<o.length;d++){let f=o[d];if(f[0]===ie){let S=c.deserialize.has(r,p);if(c=[Jt,...He].find(G=>G.marker===f[1]),!c)throw new Error(et(`unknown marker "${f[1]}"`));S||(r[p]=c.deserialize.create()),r=r[p]}else p=f}if(s?.toString()===ne)return e;if(s?.toString()===ze)c.deserialize.append(r,p,t(q(o)));else if(s?.toString()[0]===Ke){let d=s?.toString()[1]===It,f=s?.toString()[2]===It,S={};if(d){let G=t(q([...o,Be]));S.get=()=>G()}f&&(S.set=t(q([...o,Ve]))),Object.defineProperty(r,p,S)}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 Q=(i=>(i.ExposeAPI="ExposeAPI",i.Call="Call",i.Response="Response",i.Cleanup="Cleanup",i))(Q||{}),T=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:Si(this.payload,(e,n)=>{t(this.correlationId,e,n)})})}static fromEvent(t,e){let n=JSON.parse(t);return new i(n.type,Oi(n.payload,s=>e(n.correlationId,s))).withParentCorrelationId(n.correlationId)}},Yt=class extends T{constructor(t){super("Cleanup",t)}},Xt=class extends T{constructor(t){super("Response",t)}},wt=class extends T{constructor(t){super("Response",t)}},Qt=class extends T{constructor(t){super("Call",t)}},Ht=(i,t)=>`${i}_${t}`,Ct,Et,z,E,Zt=class{constructor(t){h(this,Ct,new FinalizationRegistry(t=>{this.postMessage(new Yt(t))}));h(this,Et,{[Q.Cleanup]:t=>{let e=t.payload.functionMarkerKey,n=t.payload.callId;delete a(this,z)[e],n&&delete a(this,E)[n]},[Q.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,E)[e]?.reject(r)}else a(this,E)[e]?.reject(n);else{let s=t.payload.response;a(this,E)[e]?.resolve(s)}delete a(this,E)[e]},[Q.Call]:async t=>{let e=t.payload.functionMarkerKey,n=a(this,z)[e];if(!n){this.postMessage(new wt({callId:t.payload.callId,errorMessage:et("function is not available")}));return}try{let s=await n.value(...t.payload.props??[]);this.postMessage(new Xt({callId:t.payload.callId,response:s}))}catch(s){this.postMessage(new wt({callId:t.payload.callId,errorMessage:s.message,errorStack:s.stack}))}}});h(this,z,{});h(this,E,{});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,Ct).register(r,{functionMarkerKey:Ht(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=Ht(t,e);a(this,z)[s]={path:e,value:n}}replaceTransferredFunction(t,e){return(...n)=>{let s=`CALL-${crypto.randomUUID()}`;return this.postMessage(new Qt({callId:s,functionMarkerKey:Ht(t,e),props:n})),new Promise((r,o)=>{a(this,E)[s]={resolve:r,reject:o}})}}flush(){this.queue.forEach(t=>{this.postMessage(t)}),this.queue=[]}};Ct=new WeakMap,Et=new WeakMap,z=new WeakMap,E=new WeakMap;var At=class extends Zt{constructor(){super(...arguments);l(this,"messageEvents",{})}expose(e){if(!e.type)throw new Error(et('wrong exposed API instance, "type" property is required'));this.queue.push(new T(Q.ExposeAPI,e)),this.flush()}};var X=(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))(X||{});var K,_,Mt,Ye,te=class{constructor(t,e){h(this,Mt);h(this,K,new Set);h(this,_);this.postMessage=t,this.onMessage=e}setActivePort(t){this.dispose(),w(this,_,t),u(this,Mt,Ye).call(this)}dispose(){a(this,_)&&(a(this,_).close(),a(this,_).onmessage=null)}onHandshake(t){return a(this,K).add(t),()=>{a(this,K).delete(t)}}};K=new WeakMap,_=new WeakMap,Mt=new WeakSet,Ye=function(){let t=a(this,_);if(!t){console.warn(qe("port is required no notify onHandshake listeners"));return}a(this,K).forEach(e=>e(t))};var Z,tt,R,Xe,Qe,Ze,yt=class extends te{constructor(e,n){super(e,n);h(this,R);h(this,Z,!1);h(this,tt,`consumer-${Je()}`);u(this,R,Xe).call(this);let s={type:X.Ping};e(JSON.stringify(s))}};Z=new WeakMap,tt=new WeakMap,R=new WeakSet,Xe=function(){this.onMessage(e=>{try{let n=JSON.parse(e.data);switch(n.type){case X.Pong:{u(this,R,Qe).call(this);break}case X.Port:{u(this,R,Ze).call(this,n.targetMemberId,e.ports?.[0]);break}}}catch{}})},Qe=function(){if(a(this,Z))return;w(this,Z,!0);let e={type:X.RequestPort,memberId:a(this,tt)};this.postMessage(JSON.stringify(e))},Ze=function(e,n){if(e===a(this,tt)){if(!n)throw new Error(qe("no port at consumer handshake"));this.setActivePort(n)}};var xt=class{get onConnect(){return this.handshake.onHandshake.bind(this.handshake)}},vt=class i extends xt{constructor(){super(...arguments);l(this,"handshake",new yt(e=>{globalThis.parent.postMessage(e,"*")},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new At(s).expose(e)})}};var bt=class i extends xt{constructor(){super(...arguments);l(this,"handshake",new yt(e=>{globalThis.postMessage(e)},e=>{globalThis.addEventListener("message",e)}))}static exposeAPI(e){new i().onConnect(s=>{new At(s).expose(e)})}};var Tt=class{constructor(t){this.platformAppEvents=t}notify(t){switch(t.type){case qt.EditorReady:this.platformAppEvents.notify({...t,type:v.EditorReady});break;case ut.HostEvent:this.platformAppEvents.notify({...t,type:v.HostEvent});break}}subscribe(t){this.platformAppEvents.subscribe(e=>{t(e)})}},pe=(i=>(i.Frame="PLATFORM_FRAME_API",i.Worker="PLATFORM_WORKER_API",i))(pe||{}),Rt=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 x.inject(t)}},Ni={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"},it,nt,St,st,Ot,ei,re=class extends Rt{constructor(){super(pe.Frame,gt.Frame);h(this,Ot);h(this,it,new C);h(this,nt,new Tt(a(this,it)));h(this,St);h(this,st);u(this,Ot,ei).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,st,n),w(this,St,s),await this.injectEnvironmentContext({privateApi:s,events:a(this,it),applicationAPIs:o?{[o]:a(this,st)}:{}}),await this.injectApplicationContext(c)}notify(e){a(this,nt).notify(e)}subscribe(e){a(this,nt).subscribe(e)}};it=new WeakMap,nt=new WeakMap,St=new WeakMap,st=new WeakMap,Ot=new WeakSet,ei=function(){if(typeof globalThis?.document?.head?.prepend=="function"){let n=new URL(globalThis.location.href).searchParams.get("editorType")==="CLASSIC"?"classic":"studio",s=Ni[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 D=(i=>(i.ApplicationLoadError="ApplicationLoadError",i.ApplicationFetchError="ApplicationFetchError",i.ApplicationExecuteError="ApplicationExecuteError",i))(D||{}),oe=class extends I{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}},W=y(oe),ki="__APPLICATION_REGISTRY_KEY";async function Wi(i,t,e){let n=new Function(J,ki,e),s,r=o=>{if(s)throw W(D.ApplicationExecuteError,"Application registry called more than once").withAppDefinitionId(t.appDefinitionId);if(o.type!==t.type)throw W(D.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 x(o,await N.getInstance()),r)}catch(o){throw W(D.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(W(D.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(W(D.ApplicationExecuteError,"Application registry was not called").withAppDefinitionId(t.appDefinitionId)),o({instance:s}))})})}var F,rt,g,ae=class{constructor(t,e){h(this,F,{});h(this,rt);h(this,g);w(this,rt,t),w(this,g,e),a(this,g).subscribe(n=>{switch(n.type){case v.HostEvent:{n.payload.type===ti.EventType.removeAppCompleted&&a(this,g).withEvent(a(this,g).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,g).withEvent(a(this,g).factories.createApplicationApiInitEvent(t,e?.api?.private?"private":"public"),()=>{a(this,rt).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,g).withEvent(a(this,g).factories.createApplicationLoadEvent(t,e),async()=>{try{return await this.loadApplicationBundle(e)}catch(n){throw W(D.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 W(D.ApplicationFetchError).withUrl(t);return e.text()}async executeApplication(t,e){return a(this,g).withEvent(a(this,g).factories.createApplicationExecuteEvent(t,t.url),async()=>{let{instance:n}=await Wi(a(this,g),t,e);return n})}};F=new WeakMap,rt=new WeakMap,g=new WeakMap;var B,ot,at,L,ct,ce=class extends Rt{constructor(){super(pe.Worker,gt.Worker);h(this,B,new C);h(this,ot,new Tt(a(this,B)));h(this,at,null);h(this,L);h(this,ct,[])}create(){}async initEnvironment(e){let{buildPrivateAPI:n}=e;w(this,L,await n({type:"EDITOR_ADDON"})),await this.injectEnvironmentContext({events:a(this,B),privateApi:a(this,L),applicationAPIs:{}}),w(this,at,new ae(a(this,L),a(this,B))),a(this,ct).forEach(s=>s(this))}async notify(e){await this.waitReady(),a(this,ot).notify(e)}subscribe(e){a(this,ot).subscribe(e)}async runApplication(e){await this.waitReady(),await a(this,at).runApplication(e)}waitReady(){return new Promise(e=>{if(a(this,L))return e(this);a(this,ct).push(e)})}};B=new WeakMap,ot=new WeakMap,at=new WeakMap,L=new WeakMap,ct=new WeakMap;var se="$_EP_TRANSPORT_ENV_CONTEXT_GUARD",V,ii,ni,Dt=class{constructor(){h(this,V)}isEnvironmentApiExposed(){return!!globalThis[se]}async getContexts(){let[t,e]=await Promise.all([N.getInstance(),x.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,V,ii).call(this),globalThis[se]=!0):e&&(u(this,V,ni).call(this),globalThis[se]=!0)}};V=new WeakSet,ii=function(){bt.exposeAPI(new ce)},ni=function(){vt.exposeAPI(new re)};var le=class extends I{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}},Pn=y(le);import{wixContext as b}from"@wix/sdk-context";function si(){let i=typeof $wixContext<"u"&&$wixContext.initWixModules?$wixContext.initWixModules:typeof globalThis.__wix_context__<"u"&&globalThis.__wix_context__.initWixModules?globalThis.__wix_context__.initWixModules:void 0;if(i)return{initWixModules(n,s){return he(()=>i(n,s))},fetchWithAuth(){throw new Error("fetchWithAuth is not available in this context")},graphql(){throw new Error("graphql is not available in this context")}};let t=typeof $wixContext<"u"?$wixContext.client:typeof b.client<"u"?b.client:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.client:void 0,e=typeof $wixContext<"u"?$wixContext.elevatedClient:typeof b.elevatedClient<"u"?b.elevatedClient:typeof globalThis.__wix_context__<"u"?globalThis.__wix_context__.elevatedClient:void 0;if(!(!t&&!e))return{initWixModules(n,s){if(s){if(!e)throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");return he(()=>e.use(n))}if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return he(()=>t.use(n))},fetchWithAuth:(n,s)=>{if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.fetchWithAuth(n,s)},getAuth(){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.auth},async graphql(n,s,r){if(!t)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return t.graphql(n,s,r)}}}function he(i){let t=globalThis.__wix_context__,e={client:b.client,elevatedClient:b.elevatedClient},n;globalThis.__wix_context__=void 0,b.client=void 0,b.elevatedClient=void 0,typeof $wixContext<"u"&&(n={client:$wixContext?.client,elevatedClient:$wixContext?.elevatedClient},delete $wixContext.client,delete $wixContext.elevatedClient);try{return i()}finally{globalThis.__wix_context__=t,b.client=e.client,b.elevatedClient=e.elevatedClient,typeof $wixContext<"u"&&($wixContext.client=n.client,$wixContext.elevatedClient=n.elevatedClient)}}function ri(i,t){return{...i,...Object.fromEntries(t.map(e=>[e,(...n)=>{let s=si();if(!s)throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");return s.initWixModules(i)[e].apply(void 0,n)}]))}}function oi(i){return ri({__type:"host",create:t=>Object.entries(i).reduce((e,[n,s])=>({...e,[n]:s(t)}),{})},Object.keys(i))}new Dt().expose();var de=class extends I{constructor(e,n){super(e,n,"Auth Strategy Error");l(this,"state",{})}withAppDefinitionId(e){return this.state={...this.state,appDefinitionId:e},this}},ai=y(de);function Fi(i,t){let e=Date.now(),n=i?new Date(i).getTime():null;return n&&n-e>t}var Li=30*60*1e3,Ui=()=>{let i;return{getAuthHeaders:async()=>{let t=await x.getInstance(),e=t.getAppDefinitionId(),n=t.getPrivateAPI();if(!e)throw ai("EmptyAppDefinitionId");return(!i||Fi(i.expires,Li))&&(i=await n.auth.getAccessToken(e,await n.info.getMetaSiteId())),i?.token?{headers:{Authorization:i.token}}:(console.error(ai("EmptyAppAuthInstance").withAppDefinitionId(e)),{headers:{Authorization:""}})}}},P=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 oi(t)}},ue=class extends I{constructor(t,e){super(t,e,"Base SDK Error")}},$i=y(ue),m=class{constructor(t=null){this.overriddenApplicationContext=t}getApplicationContext(){return this.overriddenApplicationContext?this.overriddenApplicationContext:x.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 $i("ManifestContextIdRequired");return t}async getEnvironmentContext(){return(await this.getApplicationContext()).getEnvironmentContext()}async getPlatformPrivateAPI(){return(await this.getApplicationContext()).getPrivateAPI()}},fe=class extends m{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())}},Rn=new P(fe).withPublicMethod("getPrivateAPI").withPublicMethod("getPublicAPI").withPublicMethod("getAppInstance").build(),kt=class extends m{async addEventListener(t,e){return(await this.getApplicationContext()).getEvents().addEventListener(t,e)}},Dn=new P(kt).withPublicMethod("addEventListener").build(),Pe=class extends m{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 kt(this.getApplicationContext()).addEventListener("componentSelectionChanged",n=>{t(n.components)})}},Sn=new P(Pe).withPublicMethod("onSelectionChange").withPublicMethod("getSelection").build(),me=class extends m{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()}async getThemeCustomProperties(t){return(await this.getPlatformPrivateAPI()).info.getThemeCustomProperties(t)}async getSiteFonts(t){return(await this.getPlatformPrivateAPI()).info.getSiteFonts(t)}},On=new P(me).withPublicMethod("getViewMode").withPublicMethod("getLanguageCode").withPublicMethod("getSiteDirection").withPublicMethod("siteHasCustomClasses").withPublicMethod("getThemeCustomProperties").withPublicMethod("getSiteFonts").build(),lt=(i=>(i.UndefinedCompRef="UndefinedCompRef",i.NotAvailableMethod="NotAvailableMethod",i))(lt||{}),ge=class extends I{constructor(t,e){super(t,e,"Widget Error")}},Nt=y(ge),li="underline";function ji(i){return i.map(t=>pi({font:t}).family).filter(Boolean)}function pi(i){let t={family:void 0,size:void 0};if(i?.font){let{variableName:e,fallbackValue:n}=qi(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===li),t.family=t.family?.trim().replace(/['"]+/g,""),t}function qi(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 $=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}},M,U,Ie=class extends m{constructor(){super(...arguments);h(this,M)}async setPreloadFonts(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);if(await n.refComponents.isRefComponent(s))throw Nt(lt.NotAvailableMethod,"not available for the current component type");let r=ji(e);await n.customElement.setPreloadFonts(s,r)}async getProp(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);return await n.refComponents.isRefComponent(s)?new $(s,n).getProp(e):n.customElement.getAttribute(s,e)}async setProp(e,n){let s=await this.getPlatformPrivateAPI(),r=await u(this,M,U).call(this);if(await s.refComponents.isRefComponent(r))return new $(r,s).setProp(e,n);await s.customElement.setAttribute(r,e,n)}async getDesignPreset(){let e=await this.getPlatformPrivateAPI(),n=await u(this,M,U).call(this);if(!await e.refComponents.isRefComponent(n))throw Nt(lt.NotAvailableMethod,"not available for the current component type");return new $(n,e).getDesignPreset()}async setDesignPreset(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);if(!await n.refComponents.isRefComponent(s))throw Nt(lt.NotAvailableMethod,"not available for the current component type");return new $(s,n).setDesignPreset(e)}async getNestedWidget(e){let n=await this.getPlatformPrivateAPI(),s=await u(this,M,U).call(this);return new $(s,n).getNestedWidget(e)}};M=new WeakSet,U=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Nt(lt.UndefinedCompRef);return s};var zi=new P(Ie).withPublicMethod("getNestedWidget").withPublicMethod("setDesignPreset").withPublicMethod("getDesignPreset").withPublicMethod("setProp").withPublicMethod("getProp").withPublicMethod("setPreloadFonts"),Nn=zi.build();function Ki(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 Bi(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 ci(i){return i?i.cssVariableName?`var(${i.cssVariableName}, ${i.color})`:i.color:""}var Vi={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:{}}}},we=class extends m{async selectColor(t,e){let n=await this.getPlatformPrivateAPI(),s=Bi(t),r=ci(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=ci(s),e?.onChange?.(r)}),r}async selectFont(t,e){let n=await this.getPlatformPrivateAPI(),s=pi(t),r=t;return await n.inputs.openFontPickerV2({...e,panelSectionsDefinition:{htmlTag:"hidden"},componentStyle:Vi.transformFontInternalValue(s)},(o,c)=>{r={font:Ki(o),textDecoration:o.underline?li:void 0},e?.onChange?.(r)}),r}},kn=new P(we).withPublicMethod("selectColor").withPublicMethod("selectFont").build(),Ae=class extends m{async openLanguageSupportPanel(){return(await this.getPlatformPrivateAPI()).panels.openLanguageSupportPanel()}async openFontsUploadPanel(){return(await this.getPlatformPrivateAPI()).panels.openFontsUploadPanel()}},Wn=new P(Ae).withPublicMethod("openLanguageSupportPanel").withPublicMethod("openFontsUploadPanel").build(),ye=class extends m{async openDashboardModal(t){return(await this.getPlatformPrivateAPI()).panels.openDashboardPanel(await this.getAppDefinitionId(),t)}},Fn=new P(ye).withPublicMethod("openDashboardModal").build(),xe=class extends m{constructor(t=null,e=[]){super(t),this.overriddenApplicationContext=t,this.childPath=e}async getStyleDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyleDefinitions(e,this.childPath)}async getStyles(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStyles(e,this.childPath)}async setStyles({cssProperties:t,cssCustomProperties:e}={}){let n=await this.getPlatformPrivateAPI(),s=await this.getRequiredManifestContextId();return n.builderComponent.setStyles(s,this.childPath,{cssProperties:t,cssCustomProperties:e})}async removeStyles(t={}){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.removeStyles(n,this.childPath,t)}async getDataDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getDataDefinitions(e,this.childPath)}async getData(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getData(e,this.childPath)}async getResolvedData({dataItemKey:t}){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getResolvedData(n,this.childPath,{dataItemKey:t})}async setData(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setData(n,this.childPath,t)}async getPresetDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getPresetDefinitions(e,this.childPath)}async getAppliedPreset(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getAppliedPreset(e,this.childPath)}async applyPreset(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.applyPreset(n,this.childPath,t)}async getDisplayGroupDefinitions(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getDisplayGroupDefinitions(n,this.childPath,t)}async getState(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getState(e,this.childPath)}async setState(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setState(n,this.childPath,t)}async getStateDefinitions(){let t=await this.getPlatformPrivateAPI(),e=await this.getRequiredManifestContextId();return t.builderComponent.getStateDefinitions(e,this.childPath)}async onChange(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.onChange(n,this.childPath,t)}async selectFont(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,this.childPath,{...t,showWeights:!0})}catch{}}async selectFontFamily(t){try{let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return await e.builderComponent.selectFont(n,this.childPath,{...t,showWeights:!1})}catch{}}async selectMedia(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectMedia(n,this.childPath,t)}async selectLink(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectLink(n,this.childPath,t)}async selectColor(t){let e=await this.getPlatformPrivateAPI();try{let n=await this.getRequiredManifestContextId();return await e.builderComponent.selectColor(n,this.childPath,t)}catch{}}async selectFontWeight(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return{weight:await e.builderComponent.selectFontWeight(n,this.childPath,t)}}async selectTextTheme(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.selectTextTheme(n,t)}async getArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.getArrayItemsSelectedIndex(n,this.childPath,t)}async setArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.setArrayItemsSelectedIndex(n,this.childPath,t)}async resetArrayItemsSelectedIndex(t){let e=await this.getPlatformPrivateAPI(),n=await this.getRequiredManifestContextId();return e.builderComponent.resetArrayItemsSelectedIndex(n,this.childPath,t)}},Ln=new P(xe).withPublicMethod("getDataDefinitions").withPublicMethod("getData").withPublicMethod("getResolvedData").withPublicMethod("setData").withPublicMethod("getStyleDefinitions").withPublicMethod("getStyles").withPublicMethod("setStyles").withPublicMethod("removeStyles").withPublicMethod("getPresetDefinitions").withPublicMethod("getAppliedPreset").withPublicMethod("applyPreset").withPublicMethod("getDisplayGroupDefinitions").withPublicMethod("getState").withPublicMethod("setState").withPublicMethod("onChange").withPublicMethod("getStateDefinitions").withPublicMethod("selectFont").withPublicMethod("selectFontFamily").withPublicMethod("selectMedia").withPublicMethod("selectLink").withPublicMethod("selectColor").withPublicMethod("selectFontWeight").withPublicMethod("selectTextTheme").withPublicMethod("getArrayItemsSelectedIndex").withPublicMethod("setArrayItemsSelectedIndex").withPublicMethod("resetArrayItemsSelectedIndex").build(),ve=class extends m{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)}},Un=new P(ve).withPublicMethod("set").withPublicMethod("get").build(),be=class extends m{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)}},$n=new P(be).withPublicMethod("getTheme").withPublicMethod("getData").withPublicMethod("getStyle").withPublicMethod("selectColor").withPublicMethod("selectLink").withPublicMethod("selectMedia").withPublicMethod("setData").withPublicMethod("setStyle").withPublicMethod("translate").build(),hi=(i=>(i.UndefinedCompRef="UndefinedCompRef",i))(hi||{}),Ce=class extends I{constructor(t,e){super(t,e,"Controllers Error")}},Gi=y(Ce),Lt,di,Ee=class extends m{constructor(){super(...arguments);h(this,Lt)}async get(){return(await this.getPlatformPrivateAPI()).controllers.get(await this.getAppDefinitionId(),await u(this,Lt,di).call(this))}};Lt=new WeakSet,di=async function(){let s=(await(await this.getPlatformPrivateAPI()).components.getSelectedComponents())[0];if(!s)throw Gi(hi.UndefinedCompRef);return s};var jn=new P(Ee).withPublicMethod("get").build(),Wt=class{constructor(t,e,n,s){this.privateAPI=t,this.compRef=e,this.bindingTargetId=n,this.config=s}update(t){return this.privateAPI.bindings.update(this.compRef,this.bindingTargetId,{config:t.config,role:t.role})}delete(){return this.privateAPI.bindings.delete(this.compRef,this.bindingTargetId)}get connectionConfig(){return this.config}},Me=class extends m{async get(t){let e=await this.getPlatformPrivateAPI(),n=await e.components.getSelectedComponents();if(n.length!==1)return null;let[s]=n,r=e.bindings.get(t.id,s);return r?new Wt(e,s,t.id,r):null}},qn=new P(Me).withPublicMethod("get").build(),_e=class{constructor(t,e,n,s){this.privateAPI=t,this.compRef=e,this.dataItemTarget=n,this.name=s}select(){return this.privateAPI.bindings.openDataBindingPanel(this.dataItemTarget.id)}createBinding(t){return this.privateAPI.bindings.create(this.compRef,{dataItemId:this.dataItemTarget.id,bindingItemType:"dataBinding",...t})?new Wt(this.privateAPI,this.compRef,this.dataItemTarget.id,JSON.stringify(t)):null}},Te=class extends m{async list(t){let e=await this.getPlatformPrivateAPI(),n=await e.components.getSelectedComponents();if(n.length!==1)return[];let[s]=n;return await e.bindings.canCreateBindingsProvider(s)?[new _e(e,s,t,"dataBinding")]:[]}},zn=new P(Te).withPublicMethod("list").build(),Re=class{constructor(t){l(this,"getContextIds",()=>{throw new Error("Not implemented yet")});l(this,"openItemSelector",t=>{throw new Error("Not implemented yet")});l(this,"apps",{startInstallFlow:async t=>(await this.workspaceAPI()).apps.startInstallFlow(t),startPurchasePlanFlow:async t=>(await this.workspaceAPI()).apps.startPurchasePlanFlow(t),startUpdateFlow:async t=>(await this.workspaceAPI()).apps.startUpdateFlow(t),openContactSupport:async t=>(await this.workspaceAPI()).apps.openContactSupport(t)});this.applicationContext=t}async workspaceAPI(){return await(await this.applicationContext).getPrivateAPI().workspace}},pt,Ft=class{constructor(t){h(this,pt);w(this,pt,new Re(t))}getAPI(){return a(this,pt)}};pt=new WeakMap;var Hi=()=>{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=ke({hostContext:{appId:s,...r},monitoringConfig:o,sentrySDK:typeof window<"u"?window.Sentry:void 0}),p=x.getInstance(),d=new Ft(p);return{environment:{},applicationContext:p,channel:{observeState:async()=>({disconnect(){}})},getMonitoringClient:c,workspace:d.getAPI(),essentials:n}},Ji=()=>{let i=x.getInstance(),t=new Ft(i);return{environment:{},applicationContext:i,channel:{observeState:async()=>({disconnect(){}})},workspace:t.getAPI()}},De={host:()=>typeof importScripts=="function"?Ji():Hi(),auth:Ui};var Hn=()=>{let i=De.host(),t=De.auth();Ne({auth:t,host:i}).enableContext("module")};export{Hn as enableClient};
8
8
  //# sourceMappingURL=editor.js.map