@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36

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 (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
- (function(R,A){typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(R=typeof globalThis<"u"?globalThis:R||self,R.StudioSdkPlugins_flexComponent=A())})(this,function(){"use strict";const R="app.grapesjs.com",A="app-stage.grapesjs.com",at=[R,"app2.grapesjs.com",A,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],St="license:check:start",yt="license:check:end",bt=()=>typeof window<"u",Pt=({isDev:n,isStage:t,isPlatform:e})=>`${n?"":`https://${t?A:R}`}/${e?"platform-api":"api"}`,zt=()=>{const n=bt()&&window.location.hostname;return!!n&&(at.includes(n)||at.some(t=>n.endsWith(t)))};function Ct(n){return typeof n=="function"}async function xt({path:n,baseApiUrl:t,method:e="GET",headers:s={},params:i,body:a}){const c=`${t||Pt({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 $=(n=>(n.free="free",n.startup="startup",n.business="business",n.enterprise="enterprise",n))($||{}),ot=(n=>(n.web="web",n.email="email",n.document="document",n.react="react",n))(ot||{});const rt={[$.free]:0,[$.startup]:10,[$.business]:20,[$.enterprise]:30};function wt(n){const t=n;return t.init=e=>s=>n(s,e),t}const It=n=>wt(n);async function vt({editor:n,plan:t,pluginName:e,licenseKey:s,onLicenseCheckResponse:i,cleanup:a}){let o="",c=!1;const p=zt(),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=rt[t],b=rt[S];v>b&&u({pluginRequiredPlan:t,licensePlan:S})}};n.on(St,r=>{o=r==null?void 0:r.baseApiUrl,c=!0}),n.on(yt,r=>{i==null||i(r),f(r)}),setTimeout(async()=>{if(!c){if(p)return;if(s){const r=await Gt({licenseKey:s,pluginName:e,baseApiUrl:o});i==null||i(r),r&&f(r)}else u("The `licenseKey` option not provided")}},2e3)}async function Gt(n){const{licenseKey:t,pluginName:e,baseApiUrl:s}=n;try{return(await xt({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 lt=n=>t=>{var e;return((e=t.getAttribute)==null?void 0:e.call(t,K))===n},Et=(...n)=>t=>n.some(e=>t.is(e)),Tt=(...n)=>(t,e)=>n.some(s=>e.is(s)),ct="gjs-plg-",K="data-type-role",B=class B{constructor(t){this.config=t}getSize(t){var e;return(e=this.config)!=null&&e.getSize?this.config.getSize(t):et(t.componentColumn,B.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({[B.CSS_FLEX_BASIS]:i},{partial:a})}}};B.CSS_FLEX_BASIS="flex-basis";let J=B;const F=class F{constructor(t){this.config=t}isGapSupported(){return!0}getGap(t){var e;return(e=this.config)!=null&&e.getGap?this.config.getGap(t):et(t.componentRow,F.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({[F.CSS_GAP]:i},{partial:a})}}};F.CSS_GAP="gap";let q=F;const U=class U{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=et(t.componentRow,U.CSS_FLEX_DIRECTION,!0);return e==="column"||e==="column-reverse"}};U.CSS_FLEX_DIRECTION="flex-direction";let Z=U;const O=class O{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(O.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(O.MJML_COLUMN_TYPE)&&s.addAttributes({width:`${parseFloat(i)}%`},{partial:a})}}};O.MJML_COLUMN_TYPE="mj-column";let Q=O;const k=class k{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(k.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)}};k.MJML_SECTION_TYPE="mj-section";let tt=k;class Rt{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 M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(t){const e=`${t.projectType}-${t.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(e)||(H(t)?this.handlerCache.set(e,{sizeHandler:new Q(t),gapHandler:new tt(t),parentSizeHandler:new Rt(t)}):this.handlerCache.set(e,{sizeHandler:new J(t),gapHandler:new q(t),parentSizeHandler:new Z(t)})),this.handlerCache.get(e)}}function T(n){return M.getInstance().getHandlers(n)}const pt=n=>{n.style.display="none"},dt=n=>{n.style.display="block"},V=n=>+parseFloat(`${n}`).toFixed(2),H=n=>n.projectType===ot.email,At=n=>n?["top","bottom"]:["left","right"],$t=n=>{const t=n.parent();return t?t.components().models.indexOf(n)===0:!1},Mt=n=>{const t=n.parent();if(!t)return!1;const e=t.components().models;return e.indexOf(n)===e.length-1},Ht=n=>{const t=n.parent();if(!t)return!1;const e=t.components().models;return e.length>1&&n.index()===e.length-1},Lt=(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},X=n=>n==="top"||n==="bottom",Nt=(n,t)=>!!($t(n)&&(t==="left"||t==="top")||Mt(n)&&(t==="right"||t==="bottom")),Vt=n=>{const t=n.parent();return t?t.components().models.length>1:!1},ut=(n,t)=>n==="right"||n==="bottom"?t>0:t<0,et=(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},ht=(n,t,e)=>{const s=nt({componentRow:n,isVertical:t},e),i=n.components().models;return s*(i.length-1)},j=(n,t)=>T(t).parentSizeHandler.isLayoutVertical({componentRow:n}),_=(n,t)=>T(t).sizeHandler.getSize(n),nt=(n,t)=>{if(t!=null&&t.disableGapHandler)return 0;const{gapHandler:e,parentSizeHandler:s}=T(t);if(!e.isGapSupported())return 0;const i=e.getGap(n),a=s.getParentSize(n);return i/100*a},st=(n,t)=>T(t).parentSizeHandler.getParentSize(n),D=(n,t)=>{T(t).sizeHandler.setSize(n)},gt=(n,t)=>{const e=_(n,t);D({...n,sizeValue:`${e}%`,partial:!1},t)},ft=(n,t)=>{if(t!=null&&t.disableGapHandler)return;const{gapHandler:e}=T(t);e.isGapSupported()&&e.setGap(n)},jt=(n,t)=>{const e=n.getStyle().gap;if(!e)return;const s=n.components().models,i={componentRow:n,isVertical:j(n,t)};s.map(a=>gt({...i,componentColumn:a},t)),ft({...i,gapValue:String(e),partial:!1},t)};function _t(n,t){const{Blocks:e}=n,{typeColumn:s,typeRow:i,blocks:a}=t;if(a===!1||H(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=Ct(a)?a({blocks:u}):u;return f.forEach(r=>e.add(r.id,r)),()=>{f.forEach(r=>e.remove(r.id))}}const Dt=(n,t)=>{const{Components:e}=n,{typeRow:s,typeColumn:i,extendTypeColumn:a}=t,o=`${ct}${i}`,p=!!i&&!!e.getType(i)&&!a;if(!(!i||p||H(t)))return e.addType(i,{isComponent:lt(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:Tt(s),attributes:{[K]:i},styles:`
1
+ (function(E,A){typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_flexComponent=A())})(this,function(){"use strict";const E="app.grapesjs.com",A="app-stage.grapesjs.com",oe=[E,"app2.grapesjs.com",A,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Pe="license:check:end",me=()=>typeof window<"u",Se=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?A:E}`}/${s?"platform-api":"api"}`,ze=()=>{const t=me()&&window.location.hostname;return!!t&&(oe.includes(t)||oe.some(e=>t.endsWith(e)))};function xe(t){return typeof t=="function"}async function ve({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:i,body:a}){const l=`${e||Se({isDev:!1,isStage:!1})}${t}`,p={method:s,headers:{"Content-Type":"application/json",...n}};a&&(p.body=JSON.stringify(a));const g=i?new URLSearchParams(i).toString():"",f=g?`?${g}`:"",r=await fetch(`${l}${f}`,p);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),K=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(K||{}),re=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(re||{});const le={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Re(t){const e=t;return e.init=s=>n=>t(n,s),e}const we=t=>Re(t);async function Ge({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:i,cleanup:a}){let o="",l;const p=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),a()},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)p(h||"Invalid license");else if(b){const G=le[e],m=le[b];G>m&&p({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(K.settings)&&(l=t.runCommand(K.settings),o=(l==null?void 0:l.baseUrl)||"");const f=r=>{i==null||i(r),r&&g(r)};if(!l){t.onReady(async()=>{if(!ze())if(n){const r=await Ie({licenseKey:n,pluginName:s,baseApiUrl:o});f(r)}else p("The `licenseKey` option not provided")});return}if(l.licensePlan||l.licenseError){const r=Ce(l);f(r);return}t.on(Pe,r=>f(r))}const Ce=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Ie(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await ve({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const ce=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,J))===t},Te=(...t)=>e=>t.some(s=>e.is(s)),Ee=(...t)=>(e,s)=>t.some(n=>s.is(n)),pe="gjs-plg-",J="data-type-role",_=class _{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):se(e.componentColumn,_.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:a}=e;n.addStyle({[_.CSS_FLEX_BASIS]:i},{partial:a})}}};_.CSS_FLEX_BASIS="flex-basis";let q=_;const F=class F{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):se(e.componentRow,F.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:i,partial:a}=e;n.addStyle({[F.CSS_GAP]:i},{partial:a})}}};F.CSS_GAP="gap";let Z=F;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:s,isVertical:n}=e,i=s.getEl();return i?n?i.clientHeight:i.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=se(e.componentRow,X.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};X.CSS_FLEX_DIRECTION="flex-direction";let Q=X;const O=class O{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(O.MJML_COLUMN_TYPE)){const a=s.getAttributes().width;if(a&&(a.includes("%")||!isNaN(parseFloat(a))))return parseFloat(a);const o=s.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:a}=e;n.is(O.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(i)}%`},{partial:a})}}};O.MJML_COLUMN_TYPE="mj-column";let ee=O;const Y=class Y{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(Y.MJML_SECTION_TYPE)){const i=s.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};Y.MJML_SECTION_TYPE="mj-section";let te=Y;class Ae{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,i=s.getEl();if(!i)return 0;let a=i;if(i.tagName!=="TABLE"){const l=i.querySelectorAll("table");l.length&&(a=l[0])}return n?a.clientHeight:a.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new ee(e),gapHandler:new te(e),parentSizeHandler:new Ae(e)}):this.handlerCache.set(s,{sizeHandler:new q(e),gapHandler:new Z(e),parentSizeHandler:new Q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const ue=t=>{t.style.display="none"},de=t=>{t.style.display="block"},V=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===re.email,Le=t=>t?["top","bottom"]:["left","right"],Me=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},$e=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},De=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},He=(t,e,s,n)=>{const a=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return a>=0&&a<n?a:-1},k=t=>t==="top"||t==="bottom",Ve=(t,e)=>!!(Me(t)&&(e==="left"||e==="top")||$e(t)&&(e==="right"||e==="bottom")),Ne=t=>{const e=t.parent();return e?e.components().models.length>1:!1},ge=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,se=(t,e,s=!1)=>{const n=!s,i=t.getEl();if(!i)return n?0:"";const o=window.getComputedStyle(i)[e]||"";if(n){let l;return typeof o=="string"?(l=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(o)||0,l}return o},he=(t,e,s)=>{const n=ne({componentRow:t,isVertical:e},s),i=t.components().models;return n*(i.length-1)},N=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),j=(t,e)=>T(e).sizeHandler.getSize(t),ne=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const i=s.getGap(t),a=n.getParentSize(t);return i/100*a},ie=(t,e)=>T(e).parentSizeHandler.getParentSize(t),B=(t,e)=>{T(e).sizeHandler.setSize(t)},fe=(t,e)=>{const s=j(t,e);B({...t,sizeValue:`${s}%`,partial:!1},e)},ye=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},je=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,i={componentRow:t,isVertical:N(t,e)};n.map(a=>fe({...i,componentColumn:a},e)),ye({...i,gapValue:String(s),partial:!1},e)};function Be(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:i,blocks:a}=e;if(a===!1||$(e))return;const o=r=>({type:i,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),l=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(h=>`<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
3
+ </div>`,p=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:o(h)}),g=[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=xe(a)?a({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const _e=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeColumn:a}=e,o=`${pe}${i}`,p=!!i&&!!s.getType(i)&&!a;if(!(!i||p||$(e)))return s.addType(i,{isComponent:ce(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:Ee(n),attributes:{[J]:i},styles:`
4
4
  .${o} {
5
5
  flex-grow: 1;
6
6
  }
7
- `}}}),()=>{e.removeType(i)}},Bt=(n,t)=>{const{Components:e}=n,{typeRow:s,typeColumn:i,extendTypeRow:a}=t,o=`${ct}${s}`,p=!!s&&!!e.getType(s)&&!a;if(!(!s||p||H(t)))return e.addType(s,{isComponent:lt(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:{[K]:s},droppable:Et(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:`
7
+ `}}}),()=>{s.removeType(i)}},Fe=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeRow:a}=e,o=`${pe}${n}`,p=!!n&&!!s.getType(n)&&!a;if(!(!n||p||$(e)))return s.addType(n,{isComponent:ce(n),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:{[J]:n},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:`
8
8
  .${o} {
9
9
  display: flex;
10
10
  align-items: stretch;
11
11
  flex-wrap: nowrap;
12
12
  }
13
- `}}}),()=>{e.removeType(s)}},Ft="flexComponent",Ot=$.startup;class Xt{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 Yt{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=j(o,i),f=Lt(p,e,u,c.length);f!==-1&&(a.adjacentIdx=f);const r={componentColumn:t,componentRow:o,isVertical:u};if(a.startPercent=_(r,i),typeof a.adjacentIdx<"u"){const g=c[a.adjacentIdx];a.neighborStartPercent=_({...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&&j(e,this.opts)};s==null||s.forEach(a=>gt({...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=X(e),u=st({componentRow:a,isVertical:p},o),f=ht(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=ut(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;D({...x,sizeValue:`${V(l)}%`},o),D({...x,componentColumn:b,sizeValue:`${V(d)}%`},o)}else{const b=Math.max(c,Math.min(g,v));D({...x,sizeValue:`${V(b)}%`},o)}}updateSnapResize(t,e,s){const i=this.getState(t),a=t.parent(),o=X(e),c=st({componentRow:a,isVertical:o},this.opts),p=ht(a,o,this.opts),u=c-p,f=s/u*100,r=ut(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 Ut{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=st({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+_({...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=_({...r,componentColumn:P},a),l=z-z/g*b;D({...w,componentColumn:P,sizeValue:`${V(l)}%`},a)}),ft({...w,gapValue:`${V(p)}%`},a)}finishGapAdjust(t){jt(t,this.opts)}}class kt{constructor(t,e,s){this.editor=t,this.registry=e,this.opts=s,this.resizeHandler=new Yt(t,e,s),this.gapHandler=new Ut(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 Y="gs-flex-spots",mt=`${Y}__handle-size`,Wt=`${Y}__handle-gap`;function Kt(n,t){const{Canvas:e}=n,s="flex-resize-spot";let i,a,o,c,p=null,u=null;const f=new Xt,r=new kt(n,f,t),g=()=>{var l;i=document.createElement("div"),i.className=Y,i.style.display="none",a=document.createElement("div"),a.className=`${Y}__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=X(y);m.className=`${mt} ${mt}-${y} gjs-resizer-h gjs-cv-unscale`,m.style.cssText=`
13
+ `}}}),()=>{s.removeType(n)}},Oe="flexComponent",ke=L.startup;class Ue{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,s){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(s),this.registerResizableChild(s),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,s){const n=e.get("type"),i=s.get("type");return this.typeRelationships.has(n)?this.typeRelationships.get(n).has(i):!1}}class Xe{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,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,s,n){const{opts:i}=this,a=this.getState(e);a.direction=s,a.startX=n.clientX,a.startY=n.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,p=l.findIndex(h=>h.cid===e.cid),g=N(o,i),f=He(p,s,g,l.length);f!==-1&&(a.adjacentIdx=f);const r={componentColumn:e,componentRow:o,isVertical:g};if(a.startPercent=j(r,i),typeof a.adjacentIdx<"u"){const h=l[a.adjacentIdx];a.neighborStartPercent=j({...r,componentColumn:h},i)}}updateResizeByDelta(e,s,n){const i=this.getState(e),a=e.parent();!i.resizing||!a||(i.snapEnabled?this.updateSnapResize(e,s,n):this.updateContinuesResize(e,s,n))}finishResize(e){const s=e.parent(),n=s==null?void 0:s.components().models,i={componentRow:s,isVertical:!!s&&N(s,this.opts)};n==null||n.forEach(a=>fe({...i,componentColumn:a},this.opts)),this.clearState(e)}updateContinuesResize(e,s,n){const i=this.getState(e),a=e.parent(),{opts:o}=this;if(!a)return;const l=o.minItemPercent??0,p=k(s),g=ie({componentRow:a,isVertical:p},o),f=he(a,p,this.opts),h=100-f/g*100,I=n/(g-f)*h,{startPercent:b=0,neighborStartPercent:x=0}=i,v={componentRow:a,isVertical:p,componentColumn:e,partial:!0},G=ge(s,n)?b+Math.abs(I):b-Math.abs(I);if(typeof i.adjacentIdx<"u"){const m=a.components().models[i.adjacentIdx],R=b+x,S=R-l,c=Math.min(S,Math.max(l,G)),u=R-c;B({...v,sizeValue:`${V(c)}%`},o),B({...v,componentColumn:m,sizeValue:`${V(u)}%`},o)}else{const m=Math.max(l,Math.min(h,G));B({...v,sizeValue:`${V(m)}%`},o)}}updateSnapResize(e,s,n){const i=this.getState(e),a=e.parent(),o=k(s),l=ie({componentRow:a,isVertical:o},this.opts),p=he(a,o,this.opts),g=l-p,f=n/g*100,r=ge(s,n),{startPercent:h=0,snapDivisions:I=12}=i,b=r?h+Math.abs(f):h-Math.abs(f),x=100/I,v=Math.floor(b/x)*x,G=Math.ceil(b/x)*x,m=Math.abs(G-b),R=Math.abs(b-v),S=x*.2,z=m<R?G:v;if(z>0&&z<100&&(m<S||R<S)&&i.lastSnappedPercent!==z){i.lastSnappedPercent=z;let y=Math.abs(z-h)/100*g;(r&&(s==="left"||s==="top")||!r&&(s==="right"||s==="bottom"))&&(y=-y),this.updateContinuesResize(e,s,y)}else m>=S&&R>=S&&(i.lastSnappedPercent=void 0)}}class Ye{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n}updateGapByDelta(e,s,n,i){if(!this.registry.isGapAdjustableParent(e))return;const{opts:a}=this,o=Math.max(0,n+s),l=ie({componentRow:e,isVertical:i},a),p=o/l*100,g=e.components().models,f=g.length-1,r={componentRow:e,isVertical:i},h=g.reduce((S,z)=>S+j({...r,componentColumn:z},a),0),b=100-p*f,x=a.minItemPercent||5;if(b<x*g.length)return;const G=100-f*p,m=h-G,R={componentRow:e,isVertical:i,partial:!0};g.map(S=>{const z=j({...r,componentColumn:S},a),c=z-z/h*m;B({...R,componentColumn:S,sizeValue:`${V(c)}%`},a)}),ye({...R,gapValue:`${V(p)}%`},a)}finishGapAdjust(e){je(e,this.opts)}}class We{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeHandler=new Xe(e,s,n),this.gapHandler=new Ye(e,s,n)}startResize(e,s,n){this.resizeHandler.startResize(e,s,n)}updateResizeByDelta(e,s,n){this.resizeHandler.updateResizeByDelta(e,s,n)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,s,n,i){this.gapHandler.updateGapByDelta(e,s,n,i)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const s=e.parent();return s?this.registry.isValidRelationship(s,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const U="gs-flex-spots",be=`${U}__handle-size`,Ke=`${U}__handle-gap`;function Je(t,e){const{Canvas:s}=t,n="flex-resize-spot";let i,a,o,l,p=null,g=null;const f=new Ue,r=new We(t,f,e),h=()=>{var c;i=document.createElement("div"),i.className=U,i.style.display="none",a=document.createElement("div"),a.className=`${U}__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(([u,y])=>{const P=u,d=k(P);y.className=`${be} ${be}-${P} gjs-resizer-h gjs-cv-unscale`,y.style.cssText=`
14
14
  pointer-events: all;
15
15
  position: absolute;
16
16
  z-index: 1;
17
- cursor: ${h?"ns-resize":"ew-resize"};
18
- ${h?"left: 50%;":"top: 50%;"}
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&&!H(t)&&(c=document.createElement("div"),c.className=Wt,c.style.cssText=`
17
+ cursor: ${d?"ns-resize":"ew-resize"};
18
+ ${d?"left: 50%;":"top: 50%;"}
19
+ ${P==="left"?"left: 0px;":""}
20
+ ${P==="right"?"right: 0px;":""}
21
+ ${P==="top"?"top: 0px;":""}
22
+ ${P==="bottom"?"bottom: 0px;":""}
23
+ `,y.addEventListener("pointerdown",I(P)),a.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(l=document.createElement("div"),l.className=Ke,l.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
- `,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=L=>{const G=n.Canvas.getZoomMultiplier(),N=(L.clientX-m)*G,W=(L.clientY-y)*G,it=X(l)?W:N;r.updateResizeByDelta(p,l,it)},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=j(d,t),y=nt({componentRow:d,isVertical:m},t),h=l.clientX,I=l.clientY;l.target.setPointerCapture(l.pointerId);const L=N=>{const W=n.Canvas.getZoomMultiplier(),it=m?(N.clientY-I)*W:(N.clientX-h)*W;r.updateGapByDelta(d,it,y,m)},G=()=>{r.finishGapAdjust(d),l.target.releasePointerCapture(l.pointerId),document.removeEventListener("pointermove",L),document.removeEventListener("pointerup",G)};document.addEventListener("pointermove",L),document.addEventListener("pointerup",G)},C=l=>{const d=l.component;if(!d||!i||(p=d,u=d.parent(),!u))return;const m=u;dt(i);const y=l.getStyle();a&&Object.assign(a.style,y);const h=j(m,t),I=At(h);if(Object.values(o).forEach(pt),I.forEach(G=>{if(Nt(d,G))return;const N=o[G];dt(N)}),T(t).gapHandler.isGapSupported()&&c&&Vt(d)){const G=nt({componentRow:m,isVertical:h},t);x(G,h,Ht(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&&(pt(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(),H(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)}}return It(function(n,t={}){const e={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...t},s=[Bt(n,e),Dt(n,e)],i=Kt(n,e),a=_t(n,e);vt({editor:n,licenseKey:e.licenseKey,plan:Ot,pluginName:Ft,cleanup:()=>{s.forEach(o=>o==null?void 0:o()),i(),a==null||a()}})})});
33
+ `,l.addEventListener("pointerdown",b()),a.appendChild(l)),i.append(a),(c=s.getSpotsEl())==null||c.appendChild(i)},I=c=>u=>{if(!p)return;u.stopPropagation(),u.preventDefault(),r.startResize(p,c,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=D=>{const C=t.Canvas.getZoomMultiplier(),H=(D.clientX-y)*C,W=(D.clientY-P)*C,ae=k(c)?W:H;r.updateResizeByDelta(p,c,ae)},w=()=>{r.finishResize(p),u.target.releasePointerCapture(u.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",w)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",w)},b=()=>c=>{if(!g)return;const u=g;c.stopPropagation(),c.preventDefault();const y=N(u,e),P=ne({componentRow:u,isVertical:y},e),d=c.clientX,w=c.clientY;c.target.setPointerCapture(c.pointerId);const D=H=>{const W=t.Canvas.getZoomMultiplier(),ae=y?(H.clientY-w)*W:(H.clientX-d)*W;r.updateGapByDelta(u,ae,P,y)},C=()=>{r.finishGapAdjust(u),c.target.releasePointerCapture(c.pointerId),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",D),document.addEventListener("pointerup",C)},x=c=>{const u=c.component;if(!u||!i||(p=u,g=u.parent(),!g))return;const y=g;de(i);const P=c.getStyle();a&&Object.assign(a.style,P);const d=N(y,e),w=Le(d);if(Object.values(o).forEach(ue),w.forEach(C=>{if(Ve(u,C))return;const H=o[C];de(H)}),T(e).gapHandler.isGapSupported()&&l&&Ne(u)){const C=ne({componentRow:y,isVertical:d},e);v(C,d,De(u))}},v=(c,u,y=!1)=>{const P=e.gapHandleSize,d=l.style;if(u){d.height=`${P}px`;const w=l.offsetHeight;y?(d.top=`-${(c+w)/2}px`,d.bottom=""):(d.bottom=`-${(c+w)/2}px`,d.top=""),d.width="50%",d.left="50%",d.transform="translateX(-50%)",d.cursor="row-resize"}else{d.width=`${P}px`;const w=l.offsetWidth;y?(d.left=`-${(c+w)/2}px`,d.right=""):(d.right=`-${(c+w)/2}px`,d.left=""),d.height="50%",d.top="50%",d.transform="translateY(-50%)",d.cursor="col-resize"}},G=()=>{i&&(ue(i),p=null,g=null)},m=()=>{s.removeSpots({type:n});const c=t.getSelected(),u=c==null?void 0:c.parent();c&&u&&f.isValidRelationship(u,c)?s.addSpot({type:n,component:c}):G()},R=()=>{const c=s.getSpots().filter(u=>u.type===n)[0];c&&x(c)},S=(c,u)=>{f.registerTypeRelationship(c,u)};t.onReady(()=>{h(),$(e)?S("mj-section","mj-column"):S(e.typeRow,e.typeColumn)});const z="component:toggled";return t.on(s.events.spot,R),t.on(z,m),()=>{t.off(s.events.spot,R),t.off(z,m)}}return we(function(t,e={}){const s={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},n=[Fe(t,s),_e(t,s)],i=Je(t,s),a=Be(t,s);Ge({editor:t,licenseKey:s.licenseKey,plan:ke,pluginName:Oe,cleanup:()=>{n.forEach(o=>o==null?void 0:o()),i(),a==null||a()}})})});
@@ -1,6 +1,6 @@
1
- "use strict";const k="app.grapesjs.com",U="app-stage.grapesjs.com",B="app2.grapesjs.com",C="app-stage2.grapesjs.com",D=[k,B,U,C,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],W="license:check:start",F="license:check:end",G=()=>typeof window<"u",K=({isDev:s,isStage:c,isPlatform:r})=>`${s?"":`https://${c?U:k}`}/${r?"platform-api":"api"}`,Z=()=>{const s=G()&&window.location.hostname;return!!s&&(D.includes(s)||D.some(c=>s.endsWith(c)))};async function q({path:s,baseApiUrl:c,method:r="GET",headers:l={},params:a,body:m}){const f=`${c||K({isDev:!1,isStage:!1})}${s}`,b={method:r,headers:{"Content-Type":"application/json",...l}};m&&(b.body=JSON.stringify(m));const d=a?new URLSearchParams(a).toString():"",v=d?`?${d}`:"",n=await fetch(`${f}${v}`,b);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var w=(s=>(s.free="free",s.startup="startup",s.business="business",s.enterprise="enterprise",s))(w||{});const H={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function z(s){const c=s;return c.init=r=>l=>s(l,r),c}const J=s=>z(s);async function R({editor:s,plan:c,pluginName:r,licenseKey:l,onLicenseCheckResponse:a,cleanup:m}){let h="",f=!1;const b=Z(),d=n=>{console.warn("Cleanup plugin:",r,"Reason:",n),m()},v=(n={})=>{var A;const{error:p,sdkLicense:E}=n,y=(A=n.plan)==null?void 0:A.category;if(!(E||n.license)||p)d(p||"Invalid license");else if(y){const j=H[c],t=H[y];j>t&&d({pluginRequiredPlan:c,licensePlan:y})}};s.on(W,n=>{h=n==null?void 0:n.baseApiUrl,f=!0}),s.on(F,n=>{a==null||a(n),v(n)}),setTimeout(async()=>{if(!f){if(b)return;if(l){const n=await X({licenseKey:l,pluginName:r,baseApiUrl:h});a==null||a(n),n&&v(n)}else d("The `licenseKey` option not provided")}},2e3)}async function X(s){const{licenseKey:c,pluginName:r,baseApiUrl:l}=s;try{return(await q({baseApiUrl:l,path:`/sdk/${c||"na"}`,method:"POST",params:{d:window.location.hostname,pn:r}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const Y="gjs-plg-",Q="fsLightboxComponent",tt=w.startup,$="data-fslightbox",N="data-type",et="fslightbox-open",L="fslightbox",x={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},st=function(s,c={}){const{Blocks:r,Components:l}=s,a="Lightbox",m=`${Y}${L}`,h={toolbarIconOpen:x.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...c},{block:f,toolbarIconOpen:b,defaultSrc:d}=h,v=function(t){const e=this,i="data-fslightbox",o=window,g=()=>{var M;const u=o.refreshFsLightbox;u==null||u();const O=e.getAttribute(i);if((M=o.fsLightboxInstances)==null||M[O],!o._isEditor)return;Array.from(document.querySelectorAll(`[${i}]`)).forEach(T=>{const S=T.onclick;T.onclick=function(I){I.preventDefault();const P=T;!P.__skipLb&&(S==null||S(I)),P.__skipLb=!0}})};if(o.refreshFsLightbox)g();else{const u=document.createElement("script");u.src=t.cdnScript,u.onload=g,document.head.appendChild(u)}},n=t=>({id:`${L}-open-lb`,label:b,command:()=>{const e=t.getView();e==null||e.toggleLightbox()}}),p="source-type",E={type:"radio",name:p,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:x.image},{id:"video",label:"Video",icon:x.video},{id:"el",label:"Custom Element",icon:x.external}],labelToTitle:!0},y={id:"href-image",name:"href",type:"file",label:"Source Image"},V={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},A={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},j={image:[y],video:[V],el:[A]};l.addType(L,{block:f&&{label:a,media:x.imageLightbox,category:"Extra",select:!0,...h.block},isComponent:t=>{var e;return(e=t.hasAttribute)==null?void 0:e.call(t,$)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:a,icon:x.imageLightbox,classes:m,draggable:(t,e)=>!e.is(L),attributes:{[$]:"lightbox",[N]:"image",href:d},components:{type:"image",src:d},script:v,cdnScript:h.cdnScript,"script-props":["attributes","cdnScript"],[p]:"image",traits:[E,{name:$,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(t,e){var o;const i=(o=e.target)==null?void 0:o.getView();i==null||i.toggleLightbox()}}],styles:`
2
- .${m} {
1
+ "use strict";const N="app.grapesjs.com",S="app-stage.grapesjs.com",U="app2.grapesjs.com",H="app-stage2.grapesjs.com",V=[N,U,S,H,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],F="license:check:end",W=()=>typeof window<"u",K=({isDev:e,isStage:n,isPlatform:c})=>`${e?"":`https://${n?S:N}`}/${c?"platform-api":"api"}`,Z=()=>{const e=W()&&window.location.hostname;return!!e&&(V.includes(e)||V.some(n=>e.endsWith(n)))};async function q({path:e,baseApiUrl:n,method:c="GET",headers:l={},params:r,body:f}){const g=`${n||K({isDev:!1,isStage:!1})}${e}`,u={method:c,headers:{"Content-Type":"application/json",...l}};f&&(u.body=JSON.stringify(f));const y=r?new URLSearchParams(r).toString():"",v=y?`?${y}`:"",s=await fetch(`${g}${v}`,u);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{}),j=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(j||{});const m={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function z(e){const n=e;return n.init=c=>l=>e(l,c),n}const J=e=>z(e);async function X({editor:e,plan:n,pluginName:c,licenseKey:l,onLicenseCheckResponse:r,cleanup:f}){let h="",g;const u=s=>{console.warn("Cleanup plugin:",c,"Reason:",s),f()},y=(s={})=>{var E;const{error:p,sdkLicense:I}=s,T=(E=s.plan)==null?void 0:E.category;if(!(I||s.license)||p)u(p||"Invalid license");else if(T){const O=m[n],t=m[T];O>t&&u({pluginRequiredPlan:n,licensePlan:T})}};e.Commands.has(j.settings)&&(g=e.runCommand(j.settings),h=(g==null?void 0:g.baseUrl)||"");const v=s=>{r==null||r(s),s&&y(s)};if(!g){e.onReady(async()=>{if(!Z())if(l){const s=await Q({licenseKey:l,pluginName:c,baseApiUrl:h});v(s)}else u("The `licenseKey` option not provided")});return}if(g.licensePlan||g.licenseError){const s=Y(g);v(s);return}e.on(F,s=>v(s))}const Y=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Q(e){const{licenseKey:n,pluginName:c,baseApiUrl:l}=e;try{return(await q({baseApiUrl:l,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:c}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const C="gjs-plg-",ee="fsLightboxComponent",te=w.startup,D="data-fslightbox",G="data-type",oe="fslightbox-open",A="fslightbox",P={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},se=function(e,n={}){const{Blocks:c,Components:l}=e,r="Lightbox",f=`${C}${A}`,h={toolbarIconOpen:P.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...n},{block:g,toolbarIconOpen:u,defaultSrc:y}=h,v=function(t){const o=this,a="data-fslightbox",i=window,b=()=>{var B;const d=i.refreshFsLightbox;d==null||d();const k=o.getAttribute(a);if((B=i.fsLightboxInstances)==null||B[k],!i._isEditor)return;Array.from(document.querySelectorAll(`[${a}]`)).forEach(L=>{const x=L.onclick;L.onclick=function(_){_.preventDefault();const $=L;!$.__skipLb&&(x==null||x(_)),$.__skipLb=!0}})};if(i.refreshFsLightbox)b();else{const d=document.createElement("script");d.src=t.cdnScript,d.onload=b,document.head.appendChild(d)}},s=t=>({id:`${A}-open-lb`,label:u,command:()=>{const o=t.getView();o==null||o.toggleLightbox()}}),p="source-type",I={type:"radio",name:p,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:P.image},{id:"video",label:"Video",icon:P.video},{id:"el",label:"Custom Element",icon:P.external}],labelToTitle:!0},T={id:"href-image",name:"href",type:"file",label:"Source Image"},M={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},E={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},O={image:[T],video:[M],el:[E]};l.addType(A,{block:g&&{label:r,media:P.imageLightbox,category:"Extra",select:!0,...h.block},isComponent:t=>{var o;return(o=t.hasAttribute)==null?void 0:o.call(t,D)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:r,icon:P.imageLightbox,classes:f,draggable:(t,o)=>!o.is(A),attributes:{[D]:"lightbox",[G]:"image",href:y},components:{type:"image",src:y},script:v,cdnScript:h.cdnScript,"script-props":["attributes","cdnScript"],[p]:"image",traits:[I,{name:D,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(t,o){var i;const a=(i=o.target)==null?void 0:i.getView();a==null||a.toggleLightbox()}}],styles:`
2
+ .${f} {
3
3
  display: inline-block;
4
4
  padding: 10px;
5
5
  }
6
- `},init(){const t=[p].map(e=>`change:${e}`).join(" ");this.on(t,this.updateTraits),this.on(`change:${p}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(t,e,i){if(i.adjust)return;const g=this.get(p)==="video"?"video":"image";this.addAttributes({[N]:g,href:""})},adjustSourceType(){const t=this.get(p),e=this.getAttributes().href||"",i={adjust:!0};if(t==="video"){const o=e.includes("youtube.com")?"youtube":"video";this.addAttributes({[N]:o},i)}else t!=="el"&&e.startsWith("#")?this.set(p,"el",i):t==="image"&&this.addAttributes({[N]:"image"},i)},updateTraits(t={}){const{changed:e}=this,{init:i}=t;if(e[E.name]||i){this.removeTrait([y.name,V.name,A.name]);const o=this.get(p)||"image",g=this.getTraitIndex(p)+1;this.addTrait(j[o],{at:g})}},initToolbar(){if(!b)return;const{toolbar:t}=this,e=n(this);!t.find(o=>o.id===e.id)&&(t==null||t.unshift(e))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var T;const{em:t,el:e,model:i}=this,{Canvas:o}=t,g=i.getAttributes()[$],{defaultView:u,documentElement:O}=e.ownerDocument,_=(T=u.fsLightboxInstances)==null?void 0:T[g];if(O.classList.contains(et))_.close();else{e.__skipLb=!1;let S;_.props.onOpen=()=>{S=o.getSpots(),setTimeout(()=>o.removeSpots())},_.props.onClose=()=>{S.forEach(I=>o.addSpot(I.attributes))},e.click()}}}}),R({editor:s,plan:tt,licenseKey:h.licenseKey,pluginName:Q,cleanup:()=>{r.remove(L),l.removeType(L)}})},nt=J(st);module.exports=nt;
6
+ `},init(){const t=[p].map(o=>`change:${o}`).join(" ");this.on(t,this.updateTraits),this.on(`change:${p}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(t,o,a){if(a.adjust)return;const b=this.get(p)==="video"?"video":"image";this.addAttributes({[G]:b,href:""})},adjustSourceType(){const t=this.get(p),o=this.getAttributes().href||"",a={adjust:!0};if(t==="video"){const i=o.includes("youtube.com")?"youtube":"video";this.addAttributes({[G]:i},a)}else t!=="el"&&o.startsWith("#")?this.set(p,"el",a):t==="image"&&this.addAttributes({[G]:"image"},a)},updateTraits(t={}){const{changed:o}=this,{init:a}=t;if(o[I.name]||a){this.removeTrait([T.name,M.name,E.name]);const i=this.get(p)||"image",b=this.getTraitIndex(p)+1;this.addTrait(O[i],{at:b})}},initToolbar(){if(!u)return;const{toolbar:t}=this,o=s(this);!t.find(i=>i.id===o.id)&&(t==null||t.unshift(o))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var L;const{em:t,el:o,model:a}=this,{Canvas:i}=t,b=a.getAttributes()[D],{defaultView:d,documentElement:k}=o.ownerDocument,R=(L=d.fsLightboxInstances)==null?void 0:L[b];if(k.classList.contains(oe))R.close();else{o.__skipLb=!1;let x;R.props.onOpen=()=>{x=i.getSpots(),setTimeout(()=>i.removeSpots())},R.props.onClose=()=>{x.forEach(_=>i.addSpot(_.attributes))},o.click()}}}}),X({editor:e,plan:te,licenseKey:h.licenseKey,pluginName:ee,cleanup:()=>{c.remove(A),l.removeType(A)}})},ie=J(se);module.exports=ie;