@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33

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 (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1,14 +1,14 @@
1
- (function(f,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(f=typeof globalThis<"u"?globalThis:f||self,f.StudioSdkPlugins_dialogComponent=v())})(this,function(){"use strict";const f="app.grapesjs.com",v="app-stage.grapesjs.com",L=[f,"app2.grapesjs.com",v,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],x="license:check:start",S="license:check:end",_=()=>typeof window<"u",k=({isDev:n,isStage:s})=>`${n?"":`https://${s?v:f}`}/api`,j=()=>{const n=_()&&window.location.hostname;return!!n&&(L.includes(n)||L.some(s=>n.endsWith(s)))};async function N({path:n,baseApiUrl:s,method:i="GET",headers:t={},params:p,body:l}){const u=`${s||k({isDev:!1,isStage:!1})}${n}`,r={method:i,headers:{"Content-Type":"application/json",...t}};l&&(r.body=JSON.stringify(l));const d=p?new URLSearchParams(p).toString():"",o=d?`?${d}`:"",c=await fetch(`${u}${o}`,r);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var b=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(b||{});const C={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function $(n){const s=n;return s.init=i=>t=>n(t,i),s}const D=n=>$(n);async function A({editor:n,plan:s,pluginName:i,licenseKey:t,cleanup:p}){let l="",g=!1;const u=j(),r=o=>{console.warn("Cleanup plugin:",i,"Reason:",o),p()},d=(o={})=>{var e;const{error:c,sdkLicense:W}=o,T=(e=o.plan)==null?void 0:e.category;if(!(W||o.license)||c)r(c||"Invalid license");else if(T){const E=C[s],w=C[T];E>w&&r({pluginRequiredPlan:s,licensePlan:T})}};n.on(x,o=>{l=o==null?void 0:o.baseApiUrl,g=!0}),n.on(S,o=>{d(o)}),setTimeout(async()=>{if(!g){if(u)return;if(t){const o=await I({licenseKey:t,pluginName:i,baseApiUrl:l});o&&d(o)}else r("The `licenseKey` option not provided")}},2e3)}async function I(n){const{licenseKey:s,pluginName:i,baseApiUrl:t}=n;try{return(await N({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(p){return console.error("Error during SDK license check:",p),!1}}const O=(...n)=>n.map(s=>`[data-gjs-type="${s}"]`).join(","),q="dialogComponent";return D(function(n,s={}){const{Blocks:i,Components:t}=n,{licenseKey:p}=s,l="gjs-plg-dialog",g="gjs-plg-dialog-overlay",u="gjs-plg-dialog-content",r="gjs-plg-dialog-close",d="gjs-plg-dialog-title",o="gjs-plg-dialog-body",c="gjs-plg-dialog-description",W="gjs-plg-dialog-placeholder";i.add(l,{label:"Dialog",media:`
1
+ (function(b,W){typeof exports=="object"&&typeof module<"u"?module.exports=W():typeof define=="function"&&define.amd?define(W):(b=typeof globalThis<"u"?globalThis:b||self,b.StudioSdkPlugins_dialogComponent=W())})(this,function(){"use strict";const b="app.grapesjs.com",W="app-stage.grapesjs.com",O=[b,"app2.grapesjs.com",W,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",j="license:check:end",C=()=>typeof window<"u",N=({isDev:n,isStage:l,isPlatform:r})=>`${n?"":`https://${l?W:b}`}/${r?"platform-api":"api"}`,$=()=>{const n=C()&&window.location.hostname;return!!n&&(O.includes(n)||O.some(l=>n.endsWith(l)))};async function k({path:n,baseApiUrl:l,method:r="GET",headers:o={},params:a,body:i}){const d=`${l||N({isDev:!1,isStage:!1})}${n}`,p={method:r,headers:{"Content-Type":"application/json",...o}};i&&(p.body=JSON.stringify(i));const c=a?new URLSearchParams(a).toString():"",g=c?`?${c}`:"",t=await fetch(`${d}${g}`,p);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}var E=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(E||{});const x={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function D(n){const l=n;return l.init=r=>o=>n(o,r),l}const A=n=>D(n);async function I({editor:n,plan:l,pluginName:r,licenseKey:o,onLicenseCheckResponse:a,cleanup:i}){let u="",d=!1;const p=$(),c=t=>{console.warn("Cleanup plugin:",r,"Reason:",t),i()},g=(t={})=>{var f;const{error:m,sdkLicense:L}=t,s=(f=t.plan)==null?void 0:f.category;if(!(L||t.license)||m)c(m||"Invalid license");else if(s){const w=x[l],T=x[s];w>T&&c({pluginRequiredPlan:l,licensePlan:s})}};n.on(_,t=>{u=t==null?void 0:t.baseApiUrl,d=!0}),n.on(j,t=>{a==null||a(t),g(t)}),setTimeout(async()=>{if(!d){if(p)return;if(o){const t=await q({licenseKey:o,pluginName:r,baseApiUrl:u});a==null||a(t),t&&g(t)}else c("The `licenseKey` option not provided")}},2e3)}async function q(n){const{licenseKey:l,pluginName:r,baseApiUrl:o}=n;try{return(await k({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const S=(...n)=>n.map(l=>`[data-gjs-type="${l}"]`).join(","),U="dialogComponent";return A(function(n,l={}){const{Blocks:r,Components:o}=n,{licenseKey:a}=l,i="gjs-plg-dialog",u="gjs-plg-dialog-overlay",d="gjs-plg-dialog-content",p="gjs-plg-dialog-close",c="gjs-plg-dialog-title",g="gjs-plg-dialog-body",t="gjs-plg-dialog-description",m="gjs-plg-dialog-placeholder";r.add(i,{label:"Dialog",media:`
2
2
  <svg viewBox="0 0 24 24">
3
3
  <path d="M4 4h16v10H8l-4 4V4z"></path>
4
4
  </svg>
5
- `,category:"Extra",content:{type:l},activate:!0,...s.block}),t.addType(l,{model:{defaults:{tagName:"div",attributes:{class:l,"data-type-role":l},components:[{type:g},{type:W}],draggable:O("wrapper"),droppable:O(l),styles:`
6
- .${l} {
5
+ `,category:"Extra",content:{type:i},activate:!0,...l.block}),o.addType(i,{model:{defaults:{tagName:"div",attributes:{class:i,"data-type-role":i},components:[{type:u},{type:m}],draggable:S("wrapper"),droppable:S(i),styles:`
6
+ .${i} {
7
7
  position: relative;
8
8
  z-index: 1;
9
9
  }
10
- `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(a){var e;(e=a.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(a){const e=this;function E(h){const m=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),y=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function P(){m.style.display="none"}h?(e._onCloseWhenPressingX=P,y.addEventListener("click",e._onCloseWhenPressingX)):(y.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function w(h){const m=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(P){P.key==="Escape"&&(m.style.display="none")}h?(e._onCloseWhenPressingEsc=y,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function U(h){const m=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){m.style.display="flex"}h?(e._onOpenWhenLeavingWindow=y,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function X(h){const m=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){const P=document.documentElement.scrollTop;h&&P>=Number(h)&&(m.style.display="flex")}h?(e._onOpenWhenScrollingToLevel=y,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}E(a.closeWhenPressingX),w(a.closeWhenPressingEsc),U(a.openWhenLeavingWindow),X(a.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const a=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');a.style.display="flex"}}}),t.addType(g,{model:{defaults:{tagName:"div",attributes:{class:g,"data-type-role":g},components:{type:u},droppable:!1,draggable:!1,styles:`
11
- .${g} {
10
+ `,traits:[{type:"button",label:"Open dialog",name:"onActive",changeProp:!0,command(s){var e;(e=s.getSelected())==null||e.trigger("active")}},{type:"checkbox",label:"Close when pressing X",name:"closeWhenPressingX",default:!0,changeProp:!0},{type:"checkbox",label:"Close when pressing ESC",name:"closeWhenPressingEsc",default:!0,changeProp:!0},{type:"checkbox",label:"Open when leaving the window",name:"openWhenLeavingWindow",default:!1,changeProp:!0},{type:"number",label:"Open when scrolling to level",name:"openWhenScrollingToLevel",default:0,changeProp:!0}],"script-props":["closeWhenPressingX","closeWhenPressingEsc","openWhenLeavingWindow","openWhenScrollingToLevel"],script:function(s){const e=this;function f(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]'),y=e.querySelector('[data-type-role="gjs-plg-dialog-close"]');function P(){v.style.display="none"}h?(e._onCloseWhenPressingX=P,y.addEventListener("click",e._onCloseWhenPressingX)):(y.removeEventListener("click",e._onCloseWhenPressingX),e._onCloseWhenPressingX=null)}function w(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(P){P.key==="Escape"&&(v.style.display="none")}h?(e._onCloseWhenPressingEsc=y,e.addEventListener("keydown",e._onCloseWhenPressingEsc)):(e.removeEventListener("keydown",e._onCloseWhenPressingEsc),e._onCloseWhenPressingEsc=null)}function T(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){v.style.display="flex"}h?(e._onOpenWhenLeavingWindow=y,document.addEventListener("mouseleave",e._onOpenWhenLeavingWindow)):(document.removeEventListener("mouseleave",e._onOpenWhenLeavingWindow),e._onOpenWhenLeavingWindow=null)}function X(h){const v=e.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');function y(){const P=document.documentElement.scrollTop;h&&P>=Number(h)&&(v.style.display="flex")}h?(e._onOpenWhenScrollingToLevel=y,document.addEventListener("scroll",e._onOpenWhenScrollingToLevel)):(document.removeEventListener("scroll",e._onOpenWhenScrollingToLevel),e._onOpenWhenScrollingToLevel=null)}f(s.closeWhenPressingX),w(s.closeWhenPressingEsc),T(s.openWhenLeavingWindow),X(s.openWhenScrollingToLevel)}},init(){this.on("active",this.handleOpenWhenClickPlaceholder)},handleOpenWhenClickPlaceholder(){this.view.el.querySelector('[data-type-role="gjs-plg-dialog-placeholder"]').addEventListener("click",()=>{const e=this.view.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');e.style.display="flex"})}},view:{onActive(){const s=this.el.querySelector('[data-type-role="gjs-plg-dialog-overlay"]');s.style.display="flex"}}}),o.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:{type:d},droppable:!1,draggable:!1,styles:`
11
+ .${u} {
12
12
  position: fixed;
13
13
  top: 0;
14
14
  left: 0;
@@ -19,8 +19,8 @@
19
19
  justify-content: center;
20
20
  background-color: rgba(0, 0, 0, 0.5);
21
21
  }
22
- `}}}),t.addType(u,{model:{defaults:{tagName:"div",attributes:{class:u,"data-type-role":u},components:[{type:r},{type:d},{type:o}],droppable:!1,draggable:!1,styles:`
23
- .${u} {
22
+ `}}}),o.addType(d,{model:{defaults:{tagName:"div",attributes:{class:d,"data-type-role":d},components:[{type:p},{type:c},{type:g}],droppable:!1,draggable:!1,styles:`
23
+ .${d} {
24
24
  position: relative;
25
25
  background-color: #fff;
26
26
  border-radius: 10px;
@@ -30,8 +30,8 @@
30
30
  height: 600px;
31
31
  box-sizing: border-box;
32
32
  }
33
- `}}}),t.addType(r,{model:{defaults:{tagName:"button",attributes:{class:r,"data-type-role":r},components:"&times;",droppable:!1,draggable:!1,styles:`
34
- .${r} {
33
+ `}}}),o.addType(p,{model:{defaults:{tagName:"button",attributes:{class:p,"data-type-role":p},components:"&times;",droppable:!1,draggable:!1,styles:`
34
+ .${p} {
35
35
  position: absolute;
36
36
  top: 10px;
37
37
  right: 10px;
@@ -42,18 +42,18 @@
42
42
  font-size: 20px;
43
43
  cursor: pointer;
44
44
  }
45
- `}}}),t.addType(d,{model:{defaults:{tagName:"h2",attributes:{class:d,"data-type-role":d},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
- .${d} {
45
+ `}}}),o.addType(c,{model:{defaults:{tagName:"h2",attributes:{class:c,"data-type-role":c},components:"Dialog Title",editable:!0,droppable:!1,draggable:!1,styles:`
46
+ .${c} {
47
47
  margin: 0;
48
48
  padding: 0 40px 20px 0;
49
49
  }
50
- `}}}),t.addType(o,{model:{defaults:{tagName:"div",attributes:{class:o,"data-type-role":o},components:[{type:c}],styles:`
51
- .${o} {
50
+ `}}}),o.addType(g,{model:{defaults:{tagName:"div",attributes:{class:g,"data-type-role":g},components:[{type:t}],styles:`
51
+ .${g} {
52
52
  height: 90%;
53
53
  overflow: auto;
54
54
  }
55
- `}}}),t.addType(c,{model:{defaults:{tagName:"p",attributes:{class:c,"data-type-role":c},components:"This is a customizable dialog!",editable:!0,styles:`
56
- .${c} {
55
+ `}}}),o.addType(t,{model:{defaults:{tagName:"p",attributes:{class:t,"data-type-role":t},components:"This is a customizable dialog!",editable:!0,styles:`
56
+ .${t} {
57
57
  margin: 0;
58
58
  }
59
- `}}}),t.addType(W,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:W,"data-type-role":W},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:a,el:e}=this,E="core:preview",w=a.Commands.events;this.listenTo(a,`${w.runCommand}${E}`,()=>{e.style.display="none"}),this.listenTo(a,`${w.stopCommand}${E}`,()=>{e.style.display=""})}}}),A({editor:n,licenseKey:p,plan:b.startup,pluginName:q,cleanup:()=>{i.remove(l),t.removeType(l)}})})});
59
+ `}}}),o.addType(m,{model:{toHTML(){return""},defaults:{tagName:"button",attributes:{class:m,"data-type-role":m},components:"Dialog (click me to open)",droppable:!1,draggable:!1}},view:{init(){const{em:s,el:e}=this,f="core:preview",w=s.Commands.events;this.listenTo(s,`${w.runCommand}${f}`,()=>{e.style.display="none"}),this.listenTo(s,`${w.stopCommand}${f}`,()=>{e.style.display=""})}}}),I({editor:n,licenseKey:a,plan:E.startup,pluginName:U,cleanup:()=>{r.remove(i),o.removeType(i)}})})});
@@ -1,26 +1,26 @@
1
- "use strict";const pe="app.grapesjs.com",de="app-stage.grapesjs.com",Se="app2.grapesjs.com",ye="app-stage2.grapesjs.com",se=[pe,Se,de,ye,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],be="license:check:start",Ce="license:check:end",Pe=()=>typeof window<"u",ze=({isDev:n,isStage:e})=>`${n?"":`https://${e?de:pe}`}/api`,xe=()=>{const n=Pe()&&window.location.hostname;return!!n&&(se.includes(n)||se.some(e=>n.endsWith(e)))};function we(n){return typeof n=="function"}async function Ie({path:n,baseApiUrl:e,method:t="GET",headers:s={},params:i,body:a}){const l=`${e||ze({isDev:!1,isStage:!1})}${n}`,c={method:t,headers:{"Content-Type":"application/json",...s}};a&&(c.body=JSON.stringify(a));const g=i?new URLSearchParams(i).toString():"",p=g?`?${g}`:"",u=await fetch(`${l}${p}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var $=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))($||{}),ue=(n=>(n.web="web",n.email="email",n.document="document",n.react="react",n))(ue||{});const ie={[$.free]:0,[$.startup]:10,[$.business]:20,[$.enterprise]:30};function ve(n){const e=n;return e.init=t=>s=>n(s,t),e}const Re=n=>ve(n);async function Ge({editor:n,plan:e,pluginName:t,licenseKey:s,cleanup:i}){let a="",o=!1;const l=xe(),c=p=>{console.warn("Cleanup plugin:",t,"Reason:",p),i()},g=(p={})=>{var y;const{error:u,sdkLicense:f}=p,I=(y=p.plan)==null?void 0:y.category;if(!(f||p.license)||u)c(u||"Invalid license");else if(I){const v=ie[e],R=ie[I];v>R&&c({pluginRequiredPlan:e,licensePlan:I})}};n.on(be,p=>{a=p==null?void 0:p.baseApiUrl,o=!0}),n.on(Ce,p=>{g(p)}),setTimeout(async()=>{if(!o){if(l)return;if(s){const p=await Ee({licenseKey:s,pluginName:t,baseApiUrl:a});p&&g(p)}else c("The `licenseKey` option not provided")}},2e3)}async function Ee(n){const{licenseKey:e,pluginName:t,baseApiUrl:s}=n;try{return(await Ie({baseApiUrl:s,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const he=n=>e=>{var t;return((t=e.getAttribute)==null?void 0:t.call(e,te))===n},Te=(...n)=>e=>n.some(t=>e.is(t)),Le=(...n)=>(e,t)=>n.some(s=>t.is(s)),ge="gjs-plg-",te="data-type-role",N=class N{constructor(e){this.config=e}getSize(e){var t;return(t=this.config)!=null&&t.getSize?this.config.getSize(e):ne(e.componentColumn,N.CSS_FLEX_BASIS)}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:i,partial:a}=e;s.addStyle({[N.CSS_FLEX_BASIS]:i},{partial:a})}}};N.CSS_FLEX_BASIS="flex-basis";let W=N;const j=class j{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var t;return(t=this.config)!=null&&t.getGap?this.config.getGap(e):ne(e.componentRow,j.CSS_GAP)}setGap(e){var t;if((t=this.config)!=null&&t.setGap)this.config.setGap(e);else{const{componentRow:s,gapValue:i,partial:a}=e;s.addStyle({[j.CSS_GAP]:i},{partial:a})}}};j.CSS_GAP="gap";let K=j;const X=class X{constructor(e){this.config=e}getParentSize(e){var a;if((a=this.config)!=null&&a.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,i=t.getEl();return i?s?i.clientHeight:i.clientWidth:0}isLayoutVertical(e){var s;if((s=this.config)!=null&&s.isParentVertical)return this.config.isParentVertical(e);const t=ne(e.componentRow,X.CSS_FLEX_DIRECTION,!0);return t==="column"||t==="column-reverse"}};X.CSS_FLEX_DIRECTION="flex-direction";let J=X;const _=class _{constructor(e){this.config=e}getSize(e){var s;if((s=this.config)!=null&&s.getSize)return this.config.getSize(e);const t=e.componentColumn;if(t.is(_.MJML_COLUMN_TYPE)){const a=t.getAttributes().width;if(a&&(a.includes("%")||!isNaN(parseFloat(a))))return parseFloat(a);const o=t.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var t;if((t=this.config)!=null&&t.setSize)this.config.setSize(e);else{const{componentColumn:s,sizeValue:i,partial:a}=e;s.is(_.MJML_COLUMN_TYPE)&&s.addAttributes({width:`${parseFloat(i)}%`},{partial:a})}}};_.MJML_COLUMN_TYPE="mj-column";let q=_;const Y=class Y{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var s;if((s=this.config)!=null&&s.getGap)return this.config.getGap(e);const{componentRow:t}=e;if(t.is(Y.MJML_SECTION_TYPE)){const i=t.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(e){var t,s;(s=(t=this.config)==null?void 0:t.setGap)==null||s.call(t,e)}};Y.MJML_SECTION_TYPE="mj-section";let Z=Y;class $e{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:t,isVertical:s}=e,i=t.getEl();if(!i)return 0;let a=i;if(i.tagName!=="TABLE"){const l=i.querySelectorAll("table");l.length&&(a=l[0])}return s?a.clientHeight:a.clientWidth}isLayoutVertical(e){var t;return(t=this.config)!=null&&t.isParentVertical?this.config.isParentVertical(e):!1}}class A{constructor(){this.handlerCache=new Map}static getInstance(){return A.instance||(A.instance=new A),A.instance}getHandlers(e){const t=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(t)||(H(e)?this.handlerCache.set(t,{sizeHandler:new q(e),gapHandler:new Z(e),parentSizeHandler:new $e(e)}):this.handlerCache.set(t,{sizeHandler:new W(e),gapHandler:new K(e),parentSizeHandler:new J(e)})),this.handlerCache.get(t)}}function E(n){return A.getInstance().getHandlers(n)}const ae=n=>{n.style.display="none"},oe=n=>{n.style.display="block"},M=n=>+parseFloat(`${n}`).toFixed(2),H=n=>n.projectType===ue.email,Ae=n=>n?["top","bottom"]:["left","right"],He=n=>{const e=n.parent();return e?e.components().models.indexOf(n)===0:!1},Me=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.indexOf(n)===t.length-1},Ve=n=>{const e=n.parent();if(!e)return!1;const t=e.components().models;return t.length>1&&n.index()===t.length-1},Ne=(n,e,t,s)=>{const a=n+(t?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return a>=0&&a<s?a:-1},k=n=>n==="top"||n==="bottom",je=(n,e)=>!!(He(n)&&(e==="left"||e==="top")||Me(n)&&(e==="right"||e==="bottom")),_e=n=>{const e=n.parent();return e?e.components().models.length>1:!1},re=(n,e)=>n==="right"||n==="bottom"?e>0:e<0,ne=(n,e,t=!1)=>{const s=!t,i=n.getEl();if(!i)return s?0:"";const o=window.getComputedStyle(i)[e]||"";if(s){let l;return typeof o=="string"?(l=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(o)||0,l}return o},ce=(n,e,t)=>{const s=Q({componentRow:n,isVertical:e},t),i=n.components().models;return s*(i.length-1)},D=(n,e)=>E(e).parentSizeHandler.isLayoutVertical({componentRow:n}),B=(n,e)=>E(e).sizeHandler.getSize(n),Q=(n,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:t,parentSizeHandler:s}=E(e);if(!t.isGapSupported())return 0;const i=t.getGap(n),a=s.getParentSize(n);return i/100*a},ee=(n,e)=>E(e).parentSizeHandler.getParentSize(n),V=(n,e)=>{E(e).sizeHandler.setSize(n)},fe=(n,e)=>{const t=B(n,e);V({...n,sizeValue:`${t}%`,partial:!1},e)},me=(n,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:t}=E(e);t.isGapSupported()&&t.setGap(n)},De=(n,e)=>{const t=n.getStyle().gap;if(!t)return;const s=n.components().models,i={componentRow:n,isVertical:D(n,e)};s.map(a=>fe({...i,componentColumn:a},e)),me({...i,gapValue:String(t),partial:!1},e)};function Be(n,e){const{Blocks:t}=n,{typeColumn:s,typeRow:i,blocks:a}=e;if(a===!1||H(e))return;const o=u=>({type:i,components:u.map(f=>({type:s,style:{"flex-basis":`${f}%`}}))}),l=u=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
2
- ${u.map(f=>`<div style="flex-basis: ${f}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
3
- </div>`,c=(u,f)=>({id:`flex-row-${f.join("-")}`,label:u,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(f),content:o(f)}),g=[c("1 Column",[100]),c("2 Columns 50/50",[50,50]),c("2 Columns 25/75",[25,75]),c("2 Columns 75/25",[75,25]),c("3 Columns",[33.33,33.33,33.33]),c("3 Columns 50/25/25",[50,25,25]),c("3 Columns 25/50/25",[25,50,25]),c("3 Columns 25/25/50",[25,25,50]),c("4 Columns",[25,25,25,25]),c("5 Columns",[20,20,20,20,20])],p=we(a)?a({blocks:g}):g;return p.forEach(u=>t.add(u.id,u)),()=>{p.forEach(u=>t.remove(u.id))}}const Fe=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:i,extendTypeColumn:a}=e,o=`${ge}${i}`,c=!!i&&!!t.getType(i)&&!a;if(!(!i||c||H(e)))return t.addType(i,{isComponent:he(i),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:Le(s),attributes:{[te]:i},styles:`
1
+ "use strict";const pt="app.grapesjs.com",dt="app-stage.grapesjs.com",St="app2.grapesjs.com",yt="app-stage2.grapesjs.com",st=[pt,St,dt,yt,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],bt="license:check:start",Pt="license:check:end",zt=()=>typeof window<"u",Ct=({isDev:n,isStage:t,isPlatform:e})=>`${n?"":`https://${t?dt:pt}`}/${e?"platform-api":"api"}`,xt=()=>{const n=zt()&&window.location.hostname;return!!n&&(st.includes(n)||st.some(t=>n.endsWith(t)))};function wt(n){return typeof n=="function"}async function It({path:n,baseApiUrl:t,method:e="GET",headers:s={},params:i,body:a}){const c=`${t||Ct({isDev:!1,isStage:!1})}${n}`,p={method:e,headers:{"Content-Type":"application/json",...s}};a&&(p.body=JSON.stringify(a));const u=i?new URLSearchParams(i).toString():"",f=u?`?${u}`:"",r=await fetch(`${c}${f}`,p);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var A=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))(A||{}),ut=(n=>(n.web="web",n.email="email",n.document="document",n.react="react",n))(ut||{});const it={[A.free]:0,[A.startup]:10,[A.business]:20,[A.enterprise]:30};function vt(n){const t=n;return t.init=e=>s=>n(s,e),t}const Gt=n=>vt(n);async function Et({editor:n,plan:t,pluginName:e,licenseKey:s,onLicenseCheckResponse:i,cleanup:a}){let o="",c=!1;const p=xt(),u=r=>{console.warn("Cleanup plugin:",e,"Reason:",r),a()},f=(r={})=>{var x;const{error:g,sdkLicense:E}=r,S=(x=r.plan)==null?void 0:x.category;if(!(E||r.license)||g)u(g||"Invalid license");else if(S){const v=it[t],b=it[S];v>b&&u({pluginRequiredPlan:t,licensePlan:S})}};n.on(bt,r=>{o=r==null?void 0:r.baseApiUrl,c=!0}),n.on(Pt,r=>{i==null||i(r),f(r)}),setTimeout(async()=>{if(!c){if(p)return;if(s){const r=await Rt({licenseKey:s,pluginName:e,baseApiUrl:o});i==null||i(r),r&&f(r)}else u("The `licenseKey` option not provided")}},2e3)}async function Rt(n){const{licenseKey:t,pluginName:e,baseApiUrl:s}=n;try{return(await It({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:e}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const ht=n=>t=>{var e;return((e=t.getAttribute)==null?void 0:e.call(t,et))===n},Tt=(...n)=>t=>n.some(e=>t.is(e)),$t=(...n)=>(t,e)=>n.some(s=>e.is(s)),gt="gjs-plg-",et="data-type-role",N=class N{constructor(t){this.config=t}getSize(t){var e;return(e=this.config)!=null&&e.getSize?this.config.getSize(t):nt(t.componentColumn,N.CSS_FLEX_BASIS)}setSize(t){var e;if((e=this.config)!=null&&e.setSize)this.config.setSize(t);else{const{componentColumn:s,sizeValue:i,partial:a}=t;s.addStyle({[N.CSS_FLEX_BASIS]:i},{partial:a})}}};N.CSS_FLEX_BASIS="flex-basis";let W=N;const j=class j{constructor(t){this.config=t}isGapSupported(){return!0}getGap(t){var e;return(e=this.config)!=null&&e.getGap?this.config.getGap(t):nt(t.componentRow,j.CSS_GAP)}setGap(t){var e;if((e=this.config)!=null&&e.setGap)this.config.setGap(t);else{const{componentRow:s,gapValue:i,partial:a}=t;s.addStyle({[j.CSS_GAP]:i},{partial:a})}}};j.CSS_GAP="gap";let K=j;const Y=class Y{constructor(t){this.config=t}getParentSize(t){var a;if((a=this.config)!=null&&a.getParentSize)return this.config.getParentSize(t);const{componentRow:e,isVertical:s}=t,i=e.getEl();return i?s?i.clientHeight:i.clientWidth:0}isLayoutVertical(t){var s;if((s=this.config)!=null&&s.isParentVertical)return this.config.isParentVertical(t);const e=nt(t.componentRow,Y.CSS_FLEX_DIRECTION,!0);return e==="column"||e==="column-reverse"}};Y.CSS_FLEX_DIRECTION="flex-direction";let J=Y;const _=class _{constructor(t){this.config=t}getSize(t){var s;if((s=this.config)!=null&&s.getSize)return this.config.getSize(t);const e=t.componentColumn;if(e.is(_.MJML_COLUMN_TYPE)){const a=e.getAttributes().width;if(a&&(a.includes("%")||!isNaN(parseFloat(a))))return parseFloat(a);const o=e.parent();return 100/(o?o.components().length:1)}return 0}setSize(t){var e;if((e=this.config)!=null&&e.setSize)this.config.setSize(t);else{const{componentColumn:s,sizeValue:i,partial:a}=t;s.is(_.MJML_COLUMN_TYPE)&&s.addAttributes({width:`${parseFloat(i)}%`},{partial:a})}}};_.MJML_COLUMN_TYPE="mj-column";let q=_;const U=class U{constructor(t){this.config=t}isGapSupported(){return!1}getGap(t){var s;if((s=this.config)!=null&&s.getGap)return this.config.getGap(t);const{componentRow:e}=t;if(e.is(U.MJML_SECTION_TYPE)){const i=e.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(t){var e,s;(s=(e=this.config)==null?void 0:e.setGap)==null||s.call(e,t)}};U.MJML_SECTION_TYPE="mj-section";let Z=U;class At{constructor(t){this.config=t}getParentSize(t){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(t);const{componentRow:e,isVertical:s}=t,i=e.getEl();if(!i)return 0;let a=i;if(i.tagName!=="TABLE"){const c=i.querySelectorAll("table");c.length&&(a=c[0])}return s?a.clientHeight:a.clientWidth}isLayoutVertical(t){var e;return(e=this.config)!=null&&e.isParentVertical?this.config.isParentVertical(t):!1}}class H{constructor(){this.handlerCache=new Map}static getInstance(){return H.instance||(H.instance=new H),H.instance}getHandlers(t){const e=`${t.projectType}-${t.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(e)||(M(t)?this.handlerCache.set(e,{sizeHandler:new q(t),gapHandler:new Z(t),parentSizeHandler:new At(t)}):this.handlerCache.set(e,{sizeHandler:new W(t),gapHandler:new K(t),parentSizeHandler:new J(t)})),this.handlerCache.get(e)}}function R(n){return H.getInstance().getHandlers(n)}const at=n=>{n.style.display="none"},ot=n=>{n.style.display="block"},L=n=>+parseFloat(`${n}`).toFixed(2),M=n=>n.projectType===ut.email,Ht=n=>n?["top","bottom"]:["left","right"],Mt=n=>{const t=n.parent();return t?t.components().models.indexOf(n)===0:!1},Lt=n=>{const t=n.parent();if(!t)return!1;const e=t.components().models;return e.indexOf(n)===e.length-1},Vt=n=>{const t=n.parent();if(!t)return!1;const e=t.components().models;return e.length>1&&n.index()===e.length-1},Nt=(n,t,e,s)=>{const a=n+(e?t==="top"?-1:t==="bottom"?1:0:t==="left"?-1:t==="right"?1:0);return a>=0&&a<s?a:-1},O=n=>n==="top"||n==="bottom",jt=(n,t)=>!!(Mt(n)&&(t==="left"||t==="top")||Lt(n)&&(t==="right"||t==="bottom")),_t=n=>{const t=n.parent();return t?t.components().models.length>1:!1},rt=(n,t)=>n==="right"||n==="bottom"?t>0:t<0,nt=(n,t,e=!1)=>{const s=!e,i=n.getEl();if(!i)return s?0:"";const o=window.getComputedStyle(i)[t]||"";if(s){let c;return typeof o=="string"?(c=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(c)&&(c=0)):c=Number(o)||0,c}return o},lt=(n,t,e)=>{const s=Q({componentRow:n,isVertical:t},e),i=n.components().models;return s*(i.length-1)},D=(n,t)=>R(t).parentSizeHandler.isLayoutVertical({componentRow:n}),B=(n,t)=>R(t).sizeHandler.getSize(n),Q=(n,t)=>{if(t!=null&&t.disableGapHandler)return 0;const{gapHandler:e,parentSizeHandler:s}=R(t);if(!e.isGapSupported())return 0;const i=e.getGap(n),a=s.getParentSize(n);return i/100*a},tt=(n,t)=>R(t).parentSizeHandler.getParentSize(n),V=(n,t)=>{R(t).sizeHandler.setSize(n)},ft=(n,t)=>{const e=B(n,t);V({...n,sizeValue:`${e}%`,partial:!1},t)},mt=(n,t)=>{if(t!=null&&t.disableGapHandler)return;const{gapHandler:e}=R(t);e.isGapSupported()&&e.setGap(n)},Dt=(n,t)=>{const e=n.getStyle().gap;if(!e)return;const s=n.components().models,i={componentRow:n,isVertical:D(n,t)};s.map(a=>ft({...i,componentColumn:a},t)),mt({...i,gapValue:String(e),partial:!1},t)};function Bt(n,t){const{Blocks:e}=n,{typeColumn:s,typeRow:i,blocks:a}=t;if(a===!1||M(t))return;const o=r=>({type:i,components:r.map(g=>({type:s,style:{"flex-basis":`${g}%`}}))}),c=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
2
+ ${r.map(g=>`<div style="flex-basis: ${g}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
3
+ </div>`,p=(r,g)=>({id:`flex-row-${g.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:c(g),content:o(g)}),u=[p("1 Column",[100]),p("2 Columns 50/50",[50,50]),p("2 Columns 25/75",[25,75]),p("2 Columns 75/25",[75,25]),p("3 Columns",[33.33,33.33,33.33]),p("3 Columns 50/25/25",[50,25,25]),p("3 Columns 25/50/25",[25,50,25]),p("3 Columns 25/25/50",[25,25,50]),p("4 Columns",[25,25,25,25]),p("5 Columns",[20,20,20,20,20])],f=wt(a)?a({blocks:u}):u;return f.forEach(r=>e.add(r.id,r)),()=>{f.forEach(r=>e.remove(r.id))}}const Ft=(n,t)=>{const{Components:e}=n,{typeRow:s,typeColumn:i,extendTypeColumn:a}=t,o=`${gt}${i}`,p=!!i&&!!e.getType(i)&&!a;if(!(!i||p||M(t)))return e.addType(i,{isComponent:ht(i),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:$t(s),attributes:{[et]:i},styles:`
4
4
  .${o} {
5
5
  flex-grow: 1;
6
6
  }
7
- `}}}),()=>{t.removeType(i)}},ke=(n,e)=>{const{Components:t}=n,{typeRow:s,typeColumn:i,extendTypeRow:a}=e,o=`${ge}${s}`,c=!!s&&!!t.getType(s)&&!a;if(!(!s||c||H(e)))return t.addType(s,{isComponent:he(s),model:{defaults:{name:"Row",classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[te]:s},droppable:Te(i),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
7
+ `}}}),()=>{e.removeType(i)}},Ot=(n,t)=>{const{Components:e}=n,{typeRow:s,typeColumn:i,extendTypeRow:a}=t,o=`${gt}${s}`,p=!!s&&!!e.getType(s)&&!a;if(!(!s||p||M(t)))return e.addType(s,{isComponent:ht(s),model:{defaults:{name:"Row",classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[et]:s},droppable:Tt(i),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:t.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:t.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
8
8
  .${o} {
9
9
  display: flex;
10
10
  align-items: stretch;
11
11
  flex-wrap: nowrap;
12
12
  }
13
- `}}}),()=>{t.removeType(s)}},Oe="flexComponent",Xe=$.startup;class Ye{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,t){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(t),this.registerResizableChild(t),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,t){const s=e.get("type"),i=t.get("type");return this.typeRelationships.has(s)?this.typeRelationships.get(s).has(i):!1}}class Ue{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,t,s){const{opts:i}=this,a=this.getState(e);a.direction=t,a.startX=s.clientX,a.startY=s.clientY,a.resizing=!0,a.lastSnappedPercent=void 0;const o=e.parent();if(!o||!this.registry.isValidRelationship(o,e))return;a.snapEnabled=o.get("snap")??i.snapEnabled,a.snapDivisions=o.get("snap-divisions")??i.snapDivisions??12;const l=o.components().models,c=l.findIndex(f=>f.cid===e.cid),g=D(o,i),p=Ne(c,t,g,l.length);p!==-1&&(a.adjacentIdx=p);const u={componentColumn:e,componentRow:o,isVertical:g};if(a.startPercent=B(u,i),typeof a.adjacentIdx<"u"){const f=l[a.adjacentIdx];a.neighborStartPercent=B({...u,componentColumn:f},i)}}updateResizeByDelta(e,t,s){const i=this.getState(e),a=e.parent();!i.resizing||!a||(i.snapEnabled?this.updateSnapResize(e,t,s):this.updateContinuesResize(e,t,s))}finishResize(e){const t=e.parent(),s=t==null?void 0:t.components().models,i={componentRow:t,isVertical:!!t&&D(t,this.opts)};s==null||s.forEach(a=>fe({...i,componentColumn:a},this.opts)),this.clearState(e)}updateContinuesResize(e,t,s){const i=this.getState(e),a=e.parent(),{opts:o}=this;if(!a)return;const l=o.minItemPercent??0,c=k(t),g=ee({componentRow:a,isVertical:c},o),p=ce(a,c,this.opts),f=100-p/g*100,I=s/(g-p)*f,{startPercent:P=0,neighborStartPercent:y=0}=i,v={componentRow:a,isVertical:c,componentColumn:e,partial:!0},R=re(t,s)?P+Math.abs(I):P-Math.abs(I);if(typeof i.adjacentIdx<"u"){const z=a.components().models[i.adjacentIdx],x=P+y,b=x-l,r=Math.min(b,Math.max(l,R)),d=x-r;V({...v,sizeValue:`${M(r)}%`},o),V({...v,componentColumn:z,sizeValue:`${M(d)}%`},o)}else{const z=Math.max(l,Math.min(f,R));V({...v,sizeValue:`${M(z)}%`},o)}}updateSnapResize(e,t,s){const i=this.getState(e),a=e.parent(),o=k(t),l=ee({componentRow:a,isVertical:o},this.opts),c=ce(a,o,this.opts),g=l-c,p=s/g*100,u=re(t,s),{startPercent:f=0,snapDivisions:I=12}=i,P=u?f+Math.abs(p):f-Math.abs(p),y=100/I,v=Math.floor(P/y)*y,R=Math.ceil(P/y)*y,z=Math.abs(R-P),x=Math.abs(P-v),b=y*.2,C=z<x?R:v;if(C>0&&C<100&&(z<b||x<b)&&i.lastSnappedPercent!==C){i.lastSnappedPercent=C;let m=Math.abs(C-f)/100*g;(u&&(t==="left"||t==="top")||!u&&(t==="right"||t==="bottom"))&&(m=-m),this.updateContinuesResize(e,t,m)}else z>=b&&x>=b&&(i.lastSnappedPercent=void 0)}}class We{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s}updateGapByDelta(e,t,s,i){if(!this.registry.isGapAdjustableParent(e))return;const{opts:a}=this,o=Math.max(0,s+t),l=ee({componentRow:e,isVertical:i},a),c=o/l*100,g=e.components().models,p=g.length-1,u={componentRow:e,isVertical:i},f=g.reduce((b,C)=>b+B({...u,componentColumn:C},a),0),P=100-c*p,y=a.minItemPercent||5;if(P<y*g.length)return;const R=100-p*c,z=f-R,x={componentRow:e,isVertical:i,partial:!0};g.map(b=>{const C=B({...u,componentColumn:b},a),r=C-C/f*z;V({...x,componentColumn:b,sizeValue:`${M(r)}%`},a)}),me({...x,gapValue:`${M(c)}%`},a)}finishGapAdjust(e){De(e,this.opts)}}class Ke{constructor(e,t,s){this.editor=e,this.registry=t,this.opts=s,this.resizeHandler=new Ue(e,t,s),this.gapHandler=new We(e,t,s)}startResize(e,t,s){this.resizeHandler.startResize(e,t,s)}updateResizeByDelta(e,t,s){this.resizeHandler.updateResizeByDelta(e,t,s)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,t,s,i){this.gapHandler.updateGapByDelta(e,t,s,i)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const t=e.parent();return t?this.registry.isValidRelationship(t,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const O="gs-flex-spots",le=`${O}__handle-size`,Je=`${O}__handle-gap`;function qe(n,e){const{Canvas:t}=n,s="flex-resize-spot";let i,a,o,l,c=null,g=null;const p=new Ye,u=new Ke(n,p,e),f=()=>{var r;i=document.createElement("div"),i.className=O,i.style.display="none",a=document.createElement("div"),a.className=`${O}__handles`,a.style.position="absolute",a.style.pointerEvents="none",a.style.zIndex="21",o={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(o).forEach(([d,m])=>{const S=d,h=k(S);m.className=`${le} ${le}-${S} gjs-resizer-h gjs-cv-unscale`,m.style.cssText=`
13
+ `}}}),()=>{e.removeType(s)}},Xt="flexComponent",Yt=A.startup;class Ut{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(t){this.resizableChildTypes.add(t)}registerGapAdjustableParent(t){this.gapAdjustableParentTypes.add(t)}registerTypeRelationship(t,e){this.typeRelationships.has(t)||this.typeRelationships.set(t,new Set),this.typeRelationships.get(t).add(e),this.registerResizableChild(e),this.registerGapAdjustableParent(t)}isResizableChild(t){return this.resizableChildTypes.has(t.get("type"))}isGapAdjustableParent(t){return this.gapAdjustableParentTypes.has(t.get("type"))}isValidRelationship(t,e){const s=t.get("type"),i=e.get("type");return this.typeRelationships.has(s)?this.typeRelationships.get(s).has(i):!1}}class kt{constructor(t,e,s){this.editor=t,this.registry=e,this.opts=s,this.resizeState=new WeakMap}getState(t){return this.resizeState.has(t)||this.resizeState.set(t,{}),this.resizeState.get(t)}clearState(t){return this.resizeState.delete(t)}startResize(t,e,s){const{opts:i}=this,a=this.getState(t);a.direction=e,a.startX=s.clientX,a.startY=s.clientY,a.resizing=!0,a.lastSnappedPercent=void 0;const o=t.parent();if(!o||!this.registry.isValidRelationship(o,t))return;a.snapEnabled=o.get("snap")??i.snapEnabled,a.snapDivisions=o.get("snap-divisions")??i.snapDivisions??12;const c=o.components().models,p=c.findIndex(g=>g.cid===t.cid),u=D(o,i),f=Nt(p,e,u,c.length);f!==-1&&(a.adjacentIdx=f);const r={componentColumn:t,componentRow:o,isVertical:u};if(a.startPercent=B(r,i),typeof a.adjacentIdx<"u"){const g=c[a.adjacentIdx];a.neighborStartPercent=B({...r,componentColumn:g},i)}}updateResizeByDelta(t,e,s){const i=this.getState(t),a=t.parent();!i.resizing||!a||(i.snapEnabled?this.updateSnapResize(t,e,s):this.updateContinuesResize(t,e,s))}finishResize(t){const e=t.parent(),s=e==null?void 0:e.components().models,i={componentRow:e,isVertical:!!e&&D(e,this.opts)};s==null||s.forEach(a=>ft({...i,componentColumn:a},this.opts)),this.clearState(t)}updateContinuesResize(t,e,s){const i=this.getState(t),a=t.parent(),{opts:o}=this;if(!a)return;const c=o.minItemPercent??0,p=O(e),u=tt({componentRow:a,isVertical:p},o),f=lt(a,p,this.opts),g=100-f/u*100,E=s/(u-f)*g,{startPercent:S=0,neighborStartPercent:C=0}=i,x={componentRow:a,isVertical:p,componentColumn:t,partial:!0},v=rt(e,s)?S+Math.abs(E):S-Math.abs(E);if(typeof i.adjacentIdx<"u"){const b=a.components().models[i.adjacentIdx],w=S+C,P=w-c,l=Math.min(P,Math.max(c,v)),d=w-l;V({...x,sizeValue:`${L(l)}%`},o),V({...x,componentColumn:b,sizeValue:`${L(d)}%`},o)}else{const b=Math.max(c,Math.min(g,v));V({...x,sizeValue:`${L(b)}%`},o)}}updateSnapResize(t,e,s){const i=this.getState(t),a=t.parent(),o=O(e),c=tt({componentRow:a,isVertical:o},this.opts),p=lt(a,o,this.opts),u=c-p,f=s/u*100,r=rt(e,s),{startPercent:g=0,snapDivisions:E=12}=i,S=r?g+Math.abs(f):g-Math.abs(f),C=100/E,x=Math.floor(S/C)*C,v=Math.ceil(S/C)*C,b=Math.abs(v-S),w=Math.abs(S-x),P=C*.2,z=b<w?v:x;if(z>0&&z<100&&(b<P||w<P)&&i.lastSnappedPercent!==z){i.lastSnappedPercent=z;let m=Math.abs(z-g)/100*u;(r&&(e==="left"||e==="top")||!r&&(e==="right"||e==="bottom"))&&(m=-m),this.updateContinuesResize(t,e,m)}else b>=P&&w>=P&&(i.lastSnappedPercent=void 0)}}class Wt{constructor(t,e,s){this.editor=t,this.registry=e,this.opts=s}updateGapByDelta(t,e,s,i){if(!this.registry.isGapAdjustableParent(t))return;const{opts:a}=this,o=Math.max(0,s+e),c=tt({componentRow:t,isVertical:i},a),p=o/c*100,u=t.components().models,f=u.length-1,r={componentRow:t,isVertical:i},g=u.reduce((P,z)=>P+B({...r,componentColumn:z},a),0),S=100-p*f,C=a.minItemPercent||5;if(S<C*u.length)return;const v=100-f*p,b=g-v,w={componentRow:t,isVertical:i,partial:!0};u.map(P=>{const z=B({...r,componentColumn:P},a),l=z-z/g*b;V({...w,componentColumn:P,sizeValue:`${L(l)}%`},a)}),mt({...w,gapValue:`${L(p)}%`},a)}finishGapAdjust(t){Dt(t,this.opts)}}class Kt{constructor(t,e,s){this.editor=t,this.registry=e,this.opts=s,this.resizeHandler=new kt(t,e,s),this.gapHandler=new Wt(t,e,s)}startResize(t,e,s){this.resizeHandler.startResize(t,e,s)}updateResizeByDelta(t,e,s){this.resizeHandler.updateResizeByDelta(t,e,s)}finishResize(t){this.resizeHandler.finishResize(t)}updateGapByDelta(t,e,s,i){this.gapHandler.updateGapByDelta(t,e,s,i)}finishGapAdjust(t){this.gapHandler.finishGapAdjust(t)}canResize(t){const e=t.parent();return e?this.registry.isValidRelationship(e,t):!1}canAdjustGap(t){return this.registry.isGapAdjustableParent(t)}}const X="gs-flex-spots",ct=`${X}__handle-size`,Jt=`${X}__handle-gap`;function qt(n,t){const{Canvas:e}=n,s="flex-resize-spot";let i,a,o,c,p=null,u=null;const f=new Ut,r=new Kt(n,f,t),g=()=>{var l;i=document.createElement("div"),i.className=X,i.style.display="none",a=document.createElement("div"),a.className=`${X}__handles`,a.style.position="absolute",a.style.pointerEvents="none",a.style.zIndex="21",o={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(o).forEach(([d,m])=>{const y=d,h=O(y);m.className=`${ct} ${ct}-${y} gjs-resizer-h gjs-cv-unscale`,m.style.cssText=`
14
14
  pointer-events: all;
15
15
  position: absolute;
16
16
  z-index: 1;
17
17
  cursor: ${h?"ns-resize":"ew-resize"};
18
18
  ${h?"left: 50%;":"top: 50%;"}
19
- ${S==="left"?"left: 0px;":""}
20
- ${S==="right"?"right: 0px;":""}
21
- ${S==="top"?"top: 0px;":""}
22
- ${S==="bottom"?"bottom: 0px;":""}
23
- `,m.addEventListener("pointerdown",I(S)),a.appendChild(m)}),!e.disableGapHandler&&!H(e)&&(l=document.createElement("div"),l.className=Je,l.style.cssText=`
19
+ ${y==="left"?"left: 0px;":""}
20
+ ${y==="right"?"right: 0px;":""}
21
+ ${y==="top"?"top: 0px;":""}
22
+ ${y==="bottom"?"bottom: 0px;":""}
23
+ `,m.addEventListener("pointerdown",E(y)),a.appendChild(m)}),!t.disableGapHandler&&!M(t)&&(c=document.createElement("div"),c.className=Jt,c.style.cssText=`
24
24
  position: absolute;
25
25
  background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
26
26
  border-width: 2px;
@@ -30,4 +30,4 @@
30
30
  pointer-events: all;
31
31
  max-width: 3rem;
32
32
  max-height: 3rem;
33
- `,l.addEventListener("pointerdown",P()),a.appendChild(l)),i.append(a),(r=t.getSpotsEl())==null||r.appendChild(i)},I=r=>d=>{if(!c)return;d.stopPropagation(),d.preventDefault(),u.startResize(c,r,d);const m=d.clientX,S=d.clientY;d.target.setPointerCapture(d.pointerId);const h=T=>{const G=n.Canvas.getZoomMultiplier(),L=(T.clientX-m)*G,F=(T.clientY-S)*G,U=k(r)?F:L;u.updateResizeByDelta(c,r,U)},w=()=>{u.finishResize(c),d.target.releasePointerCapture(d.pointerId),document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",w)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",w)},P=()=>r=>{if(!g)return;const d=g;r.stopPropagation(),r.preventDefault();const m=D(d,e),S=Q({componentRow:d,isVertical:m},e),h=r.clientX,w=r.clientY;r.target.setPointerCapture(r.pointerId);const T=L=>{const F=n.Canvas.getZoomMultiplier(),U=m?(L.clientY-w)*F:(L.clientX-h)*F;u.updateGapByDelta(d,U,S,m)},G=()=>{u.finishGapAdjust(d),r.target.releasePointerCapture(r.pointerId),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",G)};document.addEventListener("pointermove",T),document.addEventListener("pointerup",G)},y=r=>{const d=r.component;if(!d||!i||(c=d,g=d.parent(),!g))return;const m=g;oe(i);const S=r.getStyle();a&&Object.assign(a.style,S);const h=D(m,e),w=Ae(h);if(Object.values(o).forEach(ae),w.forEach(G=>{if(je(d,G))return;const L=o[G];oe(L)}),E(e).gapHandler.isGapSupported()&&l&&_e(d)){const G=Q({componentRow:m,isVertical:h},e);v(G,h,Ve(d))}},v=(r,d,m=!1)=>{const S=e.gapHandleSize,h=l.style;if(d){h.height=`${S}px`;const w=l.offsetHeight;m?(h.top=`-${(r+w)/2}px`,h.bottom=""):(h.bottom=`-${(r+w)/2}px`,h.top=""),h.width="50%",h.left="50%",h.transform="translateX(-50%)",h.cursor="row-resize"}else{h.width=`${S}px`;const w=l.offsetWidth;m?(h.left=`-${(r+w)/2}px`,h.right=""):(h.right=`-${(r+w)/2}px`,h.left=""),h.height="50%",h.top="50%",h.transform="translateY(-50%)",h.cursor="col-resize"}},R=()=>{i&&(ae(i),c=null,g=null)},z=()=>{t.removeSpots({type:s});const r=n.getSelected(),d=r==null?void 0:r.parent();r&&d&&p.isValidRelationship(d,r)?t.addSpot({type:s,component:r}):R()},x=()=>{const r=t.getSpots().filter(d=>d.type===s)[0];r&&y(r)},b=(r,d)=>{p.registerTypeRelationship(r,d)};n.onReady(()=>{f(),H(e)?b("mj-section","mj-column"):b(e.typeRow,e.typeColumn)});const C="component:toggled";return n.on(t.events.spot,x),n.on(C,z),()=>{n.off(t.events.spot,x),n.off(C,z)}}const Ze=function(n,e={}){const t={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},s=[ke(n,t),Fe(n,t)],i=qe(n,t),a=Be(n,t);Ge({editor:n,licenseKey:t.licenseKey,plan:Xe,pluginName:Oe,cleanup:()=>{s.forEach(o=>o==null?void 0:o()),i(),a==null||a()}})},Qe=Re(Ze);module.exports=Qe;
33
+ `,c.addEventListener("pointerdown",S()),a.appendChild(c)),i.append(a),(l=e.getSpotsEl())==null||l.appendChild(i)},E=l=>d=>{if(!p)return;d.stopPropagation(),d.preventDefault(),r.startResize(p,l,d);const m=d.clientX,y=d.clientY;d.target.setPointerCapture(d.pointerId);const h=T=>{const G=n.Canvas.getZoomMultiplier(),$=(T.clientX-m)*G,F=(T.clientY-y)*G,k=O(l)?F:$;r.updateResizeByDelta(p,l,k)},I=()=>{r.finishResize(p),d.target.releasePointerCapture(d.pointerId),document.removeEventListener("pointermove",h),document.removeEventListener("pointerup",I)};document.addEventListener("pointermove",h),document.addEventListener("pointerup",I)},S=()=>l=>{if(!u)return;const d=u;l.stopPropagation(),l.preventDefault();const m=D(d,t),y=Q({componentRow:d,isVertical:m},t),h=l.clientX,I=l.clientY;l.target.setPointerCapture(l.pointerId);const T=$=>{const F=n.Canvas.getZoomMultiplier(),k=m?($.clientY-I)*F:($.clientX-h)*F;r.updateGapByDelta(d,k,y,m)},G=()=>{r.finishGapAdjust(d),l.target.releasePointerCapture(l.pointerId),document.removeEventListener("pointermove",T),document.removeEventListener("pointerup",G)};document.addEventListener("pointermove",T),document.addEventListener("pointerup",G)},C=l=>{const d=l.component;if(!d||!i||(p=d,u=d.parent(),!u))return;const m=u;ot(i);const y=l.getStyle();a&&Object.assign(a.style,y);const h=D(m,t),I=Ht(h);if(Object.values(o).forEach(at),I.forEach(G=>{if(jt(d,G))return;const $=o[G];ot($)}),R(t).gapHandler.isGapSupported()&&c&&_t(d)){const G=Q({componentRow:m,isVertical:h},t);x(G,h,Vt(d))}},x=(l,d,m=!1)=>{const y=t.gapHandleSize,h=c.style;if(d){h.height=`${y}px`;const I=c.offsetHeight;m?(h.top=`-${(l+I)/2}px`,h.bottom=""):(h.bottom=`-${(l+I)/2}px`,h.top=""),h.width="50%",h.left="50%",h.transform="translateX(-50%)",h.cursor="row-resize"}else{h.width=`${y}px`;const I=c.offsetWidth;m?(h.left=`-${(l+I)/2}px`,h.right=""):(h.right=`-${(l+I)/2}px`,h.left=""),h.height="50%",h.top="50%",h.transform="translateY(-50%)",h.cursor="col-resize"}},v=()=>{i&&(at(i),p=null,u=null)},b=()=>{e.removeSpots({type:s});const l=n.getSelected(),d=l==null?void 0:l.parent();l&&d&&f.isValidRelationship(d,l)?e.addSpot({type:s,component:l}):v()},w=()=>{const l=e.getSpots().filter(d=>d.type===s)[0];l&&C(l)},P=(l,d)=>{f.registerTypeRelationship(l,d)};n.onReady(()=>{g(),M(t)?P("mj-section","mj-column"):P(t.typeRow,t.typeColumn)});const z="component:toggled";return n.on(e.events.spot,w),n.on(z,b),()=>{n.off(e.events.spot,w),n.off(z,b)}}const Zt=function(n,t={}){const e={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...t},s=[Ot(n,e),Ft(n,e)],i=qt(n,e),a=Bt(n,e);Et({editor:n,licenseKey:e.licenseKey,plan:Yt,pluginName:Xt,cleanup:()=>{s.forEach(o=>o==null?void 0:o()),i(),a==null||a()}})},Qt=Gt(Zt);module.exports=Qt;