@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,4 +1,4 @@
1
- (function(T,x){typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(T=typeof globalThis<"u"?globalThis:T||self,T.StudioSdkPlugins_swiperComponent=x())})(this,function(){"use strict";const T="app.grapesjs.com",x="app-stage.grapesjs.com",j=[T,"app2.grapesjs.com",x,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ae="license:check:start",le="license:check:end",ie=()=>typeof window<"u",ne=({isDev:e,isStage:l,isPlatform:a})=>`${e?"":`https://${l?x:T}`}/${a?"platform-api":"api"}`,se=()=>{const e=ie()&&window.location.hostname;return!!e&&(j.includes(e)||j.some(l=>e.endsWith(l)))},oe=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),re=e=>typeof e<"u";async function ce({path:e,baseApiUrl:l,method:a="GET",headers:i={},params:n,body:f}){const u=`${l||ne({isDev:!1,isStage:!1})}${e}`,b={method:a,headers:{"Content-Type":"application/json",...i}};f&&(b.body=JSON.stringify(f));const p=n?new URLSearchParams(n).toString():"",v=p?`?${p}`:"",s=await fetch(`${u}${v}`,b);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var A=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(A||{});const U={[A.free]:0,[A.startup]:10,[A.business]:20,[A.enterprise]:30};function de(e){const l=e;return l.init=a=>i=>e(i,a),l}const pe=e=>de(e);async function ue({editor:e,plan:l,pluginName:a,licenseKey:i,onLicenseCheckResponse:n,cleanup:f}){let c="",u=!1;const b=se(),p=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),f()},v=(s={})=>{var B;const{error:t,sdkLicense:o}=s,y=(B=s.plan)==null?void 0:B.category;if(!(o||s.license)||t)p(t||"Invalid license");else if(y){const I=U[l],F=U[y];I>F&&p({pluginRequiredPlan:l,licensePlan:y})}};e.on(ae,s=>{c=s==null?void 0:s.baseApiUrl,u=!0}),e.on(le,s=>{n==null||n(s),v(s)}),setTimeout(async()=>{if(!u){if(b)return;if(i){const s=await be({licenseKey:i,pluginName:a,baseApiUrl:c});n==null||n(s),s&&v(s)}else p("The `licenseKey` option not provided")}},2e3)}async function be(e){const{licenseKey:l,pluginName:a,baseApiUrl:i}=e;try{return(await ce({baseApiUrl:i,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const P=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},fe=(e,l={})=>{var f;const a={},i=[],n=[];for(const c in e){const{value:u,...b}=e[c];i.push({id:c,name:c,changeProp:!0,category:l.category,...b}),a[c]=u,!re(u)&&n.push(c);const{subTraits:p={}}=b;for(const v in b.subTraits)(f=p[v])==null||f.forEach(s=>{const t=s.id||s.name;a[t]=s.value})}return{propKeys:Object.keys(a),propsNoValues:n,props:a,traits:i}},he=(e,l)=>{l.forEach(a=>{if(a.subTraits){const i=`${a.id||a.name}`,n=a.changeProp?`change:${i}`:`change:attributes:${i}`;e.on(n,()=>K(e,i)),K(e,i)}})},K=(e,l)=>{const a=e.getTrait(l),i=a.get("category"),n=a.get("subTraits")||{},c=(Object.values(n).flat()||[]).map(p=>p.id||p.name);e.removeTrait(c);const u=n[a.getValue()],b=e.getTraitIndex(l)+1;u&&e.addTrait(u.map(p=>({category:i,...p})),{at:b})},me=(e,l)=>{l.forEach(a=>{const i=oe(a);i!==a&&e.has(i)&&e.set({[a]:e.get(i),[i]:void 0})})},h="swiper",M=`${h}-slide`,L=`${h}-wrapper`,k=`${h}-nav-prev`,V=`${h}-nav-next`,_=`${h}-pagination`,O=`${h}-scrollbar`,d={slider:`<svg viewBox="0 0 24 24">
1
+ (function(T,x){typeof exports=="object"&&typeof module<"u"?module.exports=x():typeof define=="function"&&define.amd?define(x):(T=typeof globalThis<"u"?globalThis:T||self,T.StudioSdkPlugins_swiperComponent=x())})(this,function(){"use strict";const T="app.grapesjs.com",x="app-stage.grapesjs.com",U=[T,"app2.grapesjs.com",x,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],le="license:check:end",oe=()=>typeof window<"u",se=({isDev:e,isStage:l,isPlatform:a})=>`${e?"":`https://${l?x:T}`}/${a?"platform-api":"api"}`,ie=()=>{const e=oe()&&window.location.hostname;return!!e&&(U.includes(e)||U.some(l=>e.endsWith(l)))},ne=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),re=e=>typeof e<"u";async function ce({path:e,baseApiUrl:l,method:a="GET",headers:o={},params:s,body:f}){const d=`${l||se({isDev:!1,isStage:!1})}${e}`,u={method:a,headers:{"Content-Type":"application/json",...o}};f&&(u.body=JSON.stringify(f));const b=s?new URLSearchParams(s).toString():"",h=b?`?${b}`:"",i=await fetch(`${d}${h}`,u);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}var A=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(A||{}),F=(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))(F||{});const Z={[A.free]:0,[A.startup]:10,[A.business]:20,[A.enterprise]:30};function de(e){const l=e;return l.init=a=>o=>e(o,a),l}const pe=e=>de(e);async function ue({editor:e,plan:l,pluginName:a,licenseKey:o,onLicenseCheckResponse:s,cleanup:f}){let c="",d;const u=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),f()},b=(i={})=>{var B;const{error:t,sdkLicense:n}=i,w=(B=i.plan)==null?void 0:B.category;if(!(n||i.license)||t)u(t||"Invalid license");else if(w){const G=Z[l],W=Z[w];G>W&&u({pluginRequiredPlan:l,licensePlan:w})}};e.Commands.has(F.settings)&&(d=e.runCommand(F.settings),c=(d==null?void 0:d.baseUrl)||"");const h=i=>{s==null||s(i),i&&b(i)};if(!d){e.onReady(async()=>{if(!ie())if(o){const i=await fe({licenseKey:o,pluginName:a,baseApiUrl:c});h(i)}else u("The `licenseKey` option not provided")});return}if(d.licensePlan||d.licenseError){const i=be(d);h(i);return}e.on(le,i=>h(i))}const be=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function fe(e){const{licenseKey:l,pluginName:a,baseApiUrl:o}=e;try{return(await ce({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const P=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},ge=(e,l={})=>{var f;const a={},o=[],s=[];for(const c in e){const{value:d,...u}=e[c];o.push({id:c,name:c,changeProp:!0,category:l.category,...u}),a[c]=d,!re(d)&&s.push(c);const{subTraits:b={}}=u;for(const h in u.subTraits)(f=b[h])==null||f.forEach(i=>{const t=i.id||i.name;a[t]=i.value})}return{propKeys:Object.keys(a),propsNoValues:s,props:a,traits:o}},he=(e,l)=>{l.forEach(a=>{if(a.subTraits){const o=`${a.id||a.name}`,s=a.changeProp?`change:${o}`:`change:attributes:${o}`;e.on(s,()=>K(e,o)),K(e,o)}})},K=(e,l)=>{const a=e.getTrait(l),o=a.get("category"),s=a.get("subTraits")||{},c=(Object.values(s).flat()||[]).map(b=>b.id||b.name);e.removeTrait(c);const d=s[a.getValue()],u=e.getTraitIndex(l)+1;d&&e.addTrait(d.map(b=>({category:o,...b})),{at:u})},ve=(e,l)=>{l.forEach(a=>{const o=ne(a);o!==a&&e.has(o)&&e.set({[a]:e.get(o),[o]:void 0})})},g="swiper",M=`${g}-slide`,L=`${g}-wrapper`,k=`${g}-nav-prev`,I=`${g}-nav-next`,R=`${g}-pagination`,O=`${g}-scrollbar`,p={slider:`<svg viewBox="0 0 24 24">
2
2
  <path d="M22 7.6c0-1-.5-1.6-1.3-1.6H3.4C2.5 6 2 6.7 2 7.6v9.8c0 1 .5 1.6 1.3 1.6h17.4c.8 0 1.3-.6 1.3-1.6V7.6zM21 18H3V7h18v11z" fill-rule="nonzero"/>
3
3
  <path d="M4 12.5L6 14v-3zM20 12.5L18 14v-3z"/>
4
4
  </svg>`,effect:`<svg viewBox="0 0 24 24">
@@ -21,25 +21,25 @@
21
21
  <path d="M2 12c0 5 4 9 9 9 2.4 0 4.7-1 6.4-2.6l-1.5-1.5A6.7 6.7 0 0 1 11 19a7 7 0 1 1 7-7h-3l4 4h.1l3.9-4h-3a9 9 0 0 0-18 0Z"/>
22
22
  </svg>`,prev:'<svg viewBox="0 0 24 24"><path d="M15.4 16.6 10.8 12l4.6-4.6L14 6l-6 6 6 6 1.4-1.4Z"/></svg>',next:'<svg viewBox="0 0 24 24"><path d="m8.6 16.6 4.6-4.6-4.6-4.6L10 6l6 6-6 6-1.4-1.4Z"/></svg>',add:`<svg viewBox="0 0 24 24">
23
23
  <path d="M12 20a8 8 0 1 1 0-16 8 8 0 0 1 0 16m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m1 5h-2v4H7v2h4v4h2v-4h4v-2h-4V7Z"/>
24
- </svg>`},Z={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Y={id:"swiper-extra",label:"Extra",icon:d.extra},ve={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:d.reload},{id:"p",label:"Previous slide",icon:d.prev},{id:"n",label:"Next slide",icon:d.next},{id:"a",label:"Add new slide",icon:d.add}],setValue:({component:e,value:l})=>{var i;const a=(i=e.getView())==null?void 0:i.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,i;l?e.append([{type:k},{type:V}]):((a=e.findFirstType(k))==null||a.remove(),(i=e.findFirstType(V))==null||i.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:d.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:d.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"checkbox",name:"autoplayEditor",label:"Autoplay in editor",tip:"Allow autoplay to run while editing in the canvas. Note: this may make selecting and editing slides difficult as they will automatically change.",changeProp:!0,value:!1},{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:d.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(_)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(_);a==null||a.remove(),l!=="none"&&e.append({type:_}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:d.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(O),setValue:({component:e,value:l})=>{const a=e.findFirstType(O);a==null||a.remove(),l&&e.append({type:O}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:d.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Z,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:Z,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:Y,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Y,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},X="Slider",W="swiper",N=`${W}-`,ge=(e,l)=>{const{Components:a,Blocks:i,Commands:n}=e,{block:f}=l,c=fe(ve),u="core:preview",b=n.events,p=function(t){const o=this,y=window,D=o.__onLoad,B=o.__activeSlide,I=o.__inPreview,F=y._isEditor&&!I?t.autoplayEditor:!0,{cdnScript:q,cdnStyle:z,slidesPerView:G}=t||{},r=S=>isNaN(S)?void 0:parseFloat(S),te=()=>{const S=o.parentElement;S&&(S.style.minWidth="0");const E={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(G)?G:r(G),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:o.querySelector(".swiper-button-next"),prevEl:o.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:o.querySelector(".swiper-pagination")},scrollbar:{el:o.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&F&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:C,tabletSlidesPerView:g}=t,m=r(C);E.breakpoints[m]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:C,mobileSlidesPerView:g}=t,m=r(C);E.breakpoints[m]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}D&&!I&&(E.simulateTouch=!1),B&&(E.initialSlide=B);const H=new y.Swiper(o,E);D==null||D(H)};if(y.Swiper)te();else{const{head:S}=document,E=Array.isArray(q)?[...q]:[q],H=Array.isArray(z)?[...z]:[z],C=m=>{if(m.length){const w=document.createElement("link");w.href=m.shift(),w.rel="stylesheet",S.prepend(w),C(m)}},g=m=>{if(m.length){const w=document.createElement("script");w.src=m.shift(),w.onerror=w.onload=g.bind(null,m),S.appendChild(w)}else te()};C(H),g(E)}},v=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),s=a.getType("default").model;return a.addType(h,{block:f&&{label:X,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,W),model:{defaults:()=>({name:X,icon:d.slider,classes:W,draggable:(t,o)=>!o.is(h),components:[{type:L,components:[v(1),v(2),v(3)]},{type:_}],script:p,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;he(this,c.traits),me(this,c.propKeys),this.listenTo(t,`${b.runCommand}${u}`,this.onPreviewOn),this.listenTo(t,`${b.stopCommand}${u}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var o;const t=((o=this.findFirstType(L))==null?void 0:o.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const o=s.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(y=>delete o[y]),delete o["script-props"],o}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=o=>o.on("slideChange",()=>this.__activeSlide=o.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(h),i.remove(h)}},ye="Nav Prev",Se="Nav Next",R=`${N}button-prev`,$=`${N}button-next`,we=e=>{const{Components:l}=e,a=i=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:i,fill:"currentColor"}}});return l.addType(k,{isComponent:i=>P(i,R),model:{defaults:{name:ye,classes:R,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
25
- .${R} {
24
+ </svg>`},Y={id:"swiper-responsive",label:"Responsive",icon:p.responsive},X={id:"swiper-extra",label:"Extra",icon:p.extra},ye={actions:{type:"radio",label:!1,labelToTitle:!0,options:[{id:"r",label:"Reload slider",icon:p.reload},{id:"p",label:"Previous slide",icon:p.prev},{id:"n",label:"Next slide",icon:p.next},{id:"a",label:"Add new slide",icon:p.add}],setValue:({component:e,value:l})=>{var o;const a=(o=e.getView())==null?void 0:o.getSwiper();switch(l){case"r":e.reloadSlider();break;case"p":a==null||a.slidePrev();break;case"n":a==null||a.slideNext();break;case"a":e.addSlide();break}}},vertical:{type:"checkbox",label:"Vertical",value:!1},loop:{type:"checkbox",label:"Loop",value:!1},freeMode:{type:"checkbox",label:"Free mode",value:!1},autoHeight:{type:"checkbox",label:"Auto height",value:!1},navigation:{type:"checkbox",label:"Navigation",getValue:({component:e})=>!!e.findFirstType(k),setValue:({component:e,value:l})=>{var a,o;l?e.append([{type:k},{type:I}]):((a=e.findFirstType(k))==null||a.remove(),(o=e.findFirstType(I))==null||o.remove()),e.set({navigation:l})}},initialSlide:{type:"number",label:"Initial slide",min:0,value:"0"},speed:{type:"number",label:"Speed",tip:"Transition duration (in ms)",step:500,min:0,value:300},effect:{category:{id:"swiper-effect",label:"Effects",icon:p.effect},type:"select",label:"Effect Type",value:"slide",options:[{id:"slide",label:"Slide"},{id:"fade",label:"Fade"},{id:"cube",label:"Cube"},{id:"coverflow",label:"Coverflow"},{id:"flip",label:"Flip"},{id:"cards",label:"Cards"}],subTraits:{slide:[{type:"number",name:"slidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"slidesPerGroup",label:"Slides per group",tip:"Numbers of slides for group sliding",changeProp:!0,min:1,value:1},{type:"number",name:"spaceBetween",label:"Space between",tip:"Distance between slides in px",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetBefore",label:"Slides offset before",tip:"Add additional slide offset in the beginning of the container (in px, before all slides)",changeProp:!0,min:0,value:0},{type:"number",name:"slidesOffsetAfter",label:"Slides offset after",tip:"Add additional slide offset in the end of the container (in px, after all slides)",changeProp:!0,min:0,value:0},{type:"checkbox",name:"centeredSlides",label:"Centered slides",tip:"If enabled, the active slide will be centered",changeProp:!0,value:!1}],fade:[{type:"checkbox",name:"crossFade",tip:"Enables slides cross fade",label:"Cross fade",changeProp:!0,value:!1}],cube:[{type:"checkbox",name:"cubeEffectShadow",label:"Shadow",changeProp:!0,value:!0},{type:"checkbox",name:"cubeEffectSlideShadows",label:"Slide shadows",changeProp:!0,value:!0},{type:"number",name:"cubeEffectShadowOffset",label:"Shadow offset",changeProp:!0,value:20},{type:"number",name:"cubeEffectShadowScale",label:"Shadow scale",changeProp:!0,value:.94}],coverflow:[{type:"number",name:"coverflowEffectDepth",tip:"Depth offset in px (slides translate in Z axis)",label:"Depth",changeProp:!0,min:0,value:100},{type:"number",name:"coverflowEffectModifier",tip:"Effect multiplier",label:"Modifier",changeProp:!0,step:.1,min:0,value:1},{type:"number",name:"coverflowEffectRotate",tip:"Slide rotate in degrees",label:"Rotate",changeProp:!0,min:0,value:50},{type:"number",name:"coverflowEffectScale",tip:"Slide scale effect",label:"Scale",changeProp:!0,min:0,step:.1,value:1},{type:"number",name:"coverflowEffectStretch",tip:"Stretch space between slides (in px)",label:"Stretch",changeProp:!0,min:0,value:0},{type:"checkbox",name:"coverflowEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadow",changeProp:!0,value:!0}],flip:[{type:"checkbox",name:"flipEffectLimitRotation",tip:"Limit edge slides rotation",label:"Limit rotation",changeProp:!0,value:!0},{type:"checkbox",name:"flipEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}],cards:[{type:"number",name:"cardsEffectPerSlideOffset",tip:"Offset distance per slide (in px)",label:"Slide offset",changeProp:!0,min:0,value:8},{type:"number",name:"cardsEffectPerSlideRotate",tip:"Rotate angle per slide (in degrees)",label:"Slide rotate",changeProp:!0,min:0,value:2},{type:"checkbox",name:"cardsEffectRotate",tip:"Enables cards rotation",label:"Rotate",changeProp:!0,value:!0},{type:"checkbox",name:"cardsEffectSlideShadows",tip:"Enables slides shadows",label:"Slide shadows",changeProp:!0,value:!0}]}},autoplay:{category:{id:"swiper-autoplay",label:"Autoplay",icon:p.autoplay},type:"checkbox",label:"Enable Autoplay",value:!1,subTraits:{true:[{type:"checkbox",name:"autoplayEditor",label:"Autoplay in editor",tip:"Allow autoplay to run while editing in the canvas. Note: this may make selecting and editing slides difficult as they will automatically change.",changeProp:!0,value:!1},{type:"number",name:"autoplayDelay",label:"Delay",changeProp:!0,value:3e3},{type:"checkbox",name:"autoplayDisableOnInteraction",label:"Disable on interaction",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayWaitForTransition",label:"Wait for transition",changeProp:!0,value:!0},{type:"checkbox",name:"autoplayPauseOnMouseEnter",label:"Pause on mouse enter",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayReverseDirection",label:"Reverse direction",changeProp:!0,value:!1},{type:"checkbox",name:"autoplayStopOnLastSlide",label:"Stop on last slide",changeProp:!0,value:!1}]}},pagination:{category:{id:"swiper-pagination",label:"Pagination",icon:p.pagination},type:"select",label:"Pagination Type",options:[{id:"none",label:"None"},{id:"bullets",label:"Bullets"},{id:"progressbar",label:"Progressbar"},{id:"fraction",label:"Fraction"}],getValue:({component:e})=>e.findFirstType(R)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(R);a==null||a.remove(),l!=="none"&&e.append({type:R}),e.set({pagination:l})},subTraits:{bullets:[{type:"checkbox",name:"dynamicBullets",label:"Dynamic bullets",changeProp:!0,value:!1},{type:"checkbox",name:"clickableBullets",label:"Clickable bullets",changeProp:!0,value:!0}],progressbar:[{type:"checkbox",name:"progressbarOpposite",label:"Progress opposite",changeProp:!0,value:!1}]}},scrollbar:{category:{id:"swiper-scrollbar",label:"Scrollbar",icon:p.scrollbar},type:"checkbox",label:"Enable Scrollbar",getValue:({component:e})=>!!e.findFirstType(O),setValue:({component:e,value:l})=>{const a=e.findFirstType(O);a==null||a.remove(),l&&e.append({type:O}),e.set({scrollbar:l})},subTraits:{false:[],true:[{type:"checkbox",name:"scrollbarDraggable",label:"Draggable",changeProp:!0,value:!1},{type:"checkbox",name:"scrollbarHide",label:"Hide",tip:"Hide scrollbar automatically after user interaction",changeProp:!0,value:!0}]}},parallax:{category:{id:"swiper-parallax",label:"Parallax",icon:p.parallax},type:"checkbox",label:"Enable Parallax",value:!1},mobile:{category:Y,type:"checkbox",label:"Enable mobile breakpoint",value:!1,subTraits:{true:[{type:"number",name:"mobileBreakpoint",label:"Mobile breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:460},{type:"number",name:"mobileSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"mobileSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},tablet:{category:Y,type:"checkbox",label:"Enable tablet breakpoint",value:!1,subTraits:{true:[{type:"number",name:"tabletBreakpoint",label:"Tablet breakpoint",tip:"Slide values below will be applied when the screen width is greater than this value",changeProp:!0,min:1,value:991},{type:"number",name:"tabletSlidesPerView",label:"Slides per view",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSlidesPerGroup",label:"Slides per group",changeProp:!0,min:1,value:1},{type:"number",name:"tabletSpaceBetween",label:"Space between",changeProp:!0,min:0,value:0}]}},allowTouchMove:{category:X,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:X,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},J="Slider",C="swiper",_=`${C}-`,we=(e,l)=>{const{Components:a,Blocks:o,Commands:s}=e,{block:f}=l,c=ge(ye),d="core:preview",u=s.events,b=function(t){const n=this,w=window,D=n.__onLoad,B=n.__activeSlide,G=n.__inPreview,W=w._isEditor&&!G?t.autoplayEditor:!0,{cdnScript:q,cdnStyle:z,slidesPerView:H}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ae=()=>{const m=n.parentElement;m&&(m.style.minWidth="0");const E={loop:t.loop,speed:t.speed,initialSlide:t.initialSlide,direction:t.vertical?"vertical":"horizontal",effect:t.effect,freeMode:t.freeMode,parallax:t.parallax,autoHeight:t.autoHeight,allowTouchMove:t.allowTouchMove,grabCursor:t.grabCursor,simulateTouch:!0,breakpoints:{},slidesPerView:isNaN(H)?H:r(H),slidesPerGroup:r(t.slidesPerGroup),spaceBetween:r(t.spaceBetween),slidesOffsetBefore:r(t.slidesOffsetBefore),slidesOffsetAfter:r(t.slidesOffsetAfter),centeredSlides:t.centeredSlides,fadeEffect:{crossFade:t.crossFade},cubeEffect:{shadow:t.cubeEffectShadow,slideShadows:t.cubeEffectSlideShadows,shadowOffset:r(t.cubeEffectShadowOffset),shadowScale:r(t.cubeEffectShadowScale)},coverflowEffect:{depth:r(t.coverflowEffectDepth),modifier:r(t.coverflowEffectModifier),rotate:r(t.coverflowEffectRotate),scale:r(t.coverflowEffectScale),stretch:r(t.coverflowEffectStretch),slideShadows:t.coverflowEffectSlideShadows},flipEffect:{limitRotation:t.flipEffectLimitRotation,slideShadows:t.flipEffectSlideShadows},cardsEffect:{perSlideOffset:r(t.cardsEffectPerSlideOffset),perSlideRotate:r(t.cardsEffectPerSlideRotate),rotate:t.cardsEffectRotate,slideShadows:t.cardsEffectSlideShadows},navigation:{nextEl:n.querySelector(".swiper-button-next"),prevEl:n.querySelector(".swiper-button-prev")},pagination:{type:t.pagination||"bullets",dynamicBullets:t.dynamicBullets,clickable:t.clickableBullets,progressbarOpposite:t.progressbarOpposite,el:n.querySelector(".swiper-pagination")},scrollbar:{el:n.querySelector(".swiper-scrollbar"),draggable:t.scrollbarDraggable,hide:t.scrollbarHide},autoplay:t.autoplay&&W&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:N,tabletSlidesPerView:y}=t,v=r(N);E.breakpoints[v]={slidesPerView:isNaN(y)?y:r(y),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:N,mobileSlidesPerView:y}=t,v=r(N);E.breakpoints[v]={slidesPerView:isNaN(y)?y:r(y),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}D&&!G&&(E.simulateTouch=!1),B&&(E.initialSlide=B);const j=new w.Swiper(n,E);D==null||D(j)};if(w.Swiper)ae();else{const{head:m}=document,E=Array.isArray(q)?[...q]:[q],j=Array.isArray(z)?[...z]:[z],N=v=>{if(v.length){const S=document.createElement("link");S.href=v.shift(),S.rel="stylesheet",m.prepend(S),N(v)}},y=v=>{if(v.length){const S=document.createElement("script");S.src=v.shift(),S.onerror=S.onload=y.bind(null,v),m.appendChild(S)}else ae()};N(j),y(E)}},h=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),i=a.getType("default").model;return a.addType(g,{block:f&&{label:J,media:p.slider,category:"Extra",select:!0,...l.block},isComponent:t=>P(t,C),model:{defaults:()=>({name:J,icon:p.slider,classes:C,draggable:(t,n)=>!n.is(g),components:[{type:L,components:[h(1),h(2),h(3)]},{type:R}],script:b,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;he(this,c.traits),ve(this,c.propKeys),this.listenTo(t,`${u.runCommand}${d}`,this.onPreviewOn),this.listenTo(t,`${u.stopCommand}${d}`,this.onPreviewOff)},onPreviewOn(){this.__inPreview=!0,this.reloadSlider()},onPreviewOff(){this.__inPreview=!1,this.reloadSlider()},reloadSlider(){this.trigger("rerender")},addSlide(){const t=this.findFirstType(L);t==null||t.append(this.getNewSlideComponentDef())},getNewSlideComponentDef(){var n;const t=((n=this.findFirstType(L))==null?void 0:n.components().length)||0;return{type:M,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const n=i.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(w=>delete n[w]),delete n["script-props"],n}},view:{init(){this.listenTo(this.model,a.events.scriptUnmount,this.destroySwiper)},getSwiper(){return this.el.swiper},destroySwiper(){var t;(t=this.getSwiper())==null||t.destroy()},onRender(){const t=this.el;t.__onLoad=n=>n.on("slideChange",()=>this.__activeSlide=n.activeIndex),t.__activeSlide=this.__activeSlide,t.__inPreview=this.model.__inPreview}}}),()=>{a.removeType(g),o.remove(g)}},me="Nav Prev",Se="Nav Next",V=`${_}button-prev`,$=`${_}button-next`,Pe=e=>{const{Components:l}=e,a=o=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:o,fill:"currentColor"}}});return l.addType(k,{isComponent:o=>P(o,V),model:{defaults:{name:me,classes:V,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,components:a("M0,22L22,0l2.1,2.1L4.2,22l19.9,19.9L22,44L0,22L0,22L0,22z"),styles:`
25
+ .${V} {
26
26
  color: inherit;
27
27
  }
28
- .${R}:after {
28
+ .${V}:after {
29
29
  content: none;
30
30
  }
31
- `}}}),l.addType(V,{extend:k,isComponent:i=>P(i,$),model:{defaults:{name:Se,classes:$,components:a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
31
+ `}}}),l.addType(I,{extend:k,isComponent:o=>P(o,$),model:{defaults:{name:Se,classes:$,components:a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
32
32
  .${$} {
33
33
  color: inherit;
34
34
  }
35
35
  .${$}:after {
36
36
  content: none;
37
37
  }
38
- `}}}),()=>{l.removeType(k),l.removeType(V)}},Pe=e=>{const{Components:l}=e,a=`${N}pagination`;return l.addType(_,{isComponent:i=>P(i,a),model:{defaults:{name:"Pagination",classes:a,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
38
+ `}}}),()=>{l.removeType(k),l.removeType(I)}},Ee=e=>{const{Components:l}=e,a=`${_}pagination`;return l.addType(R,{isComponent:o=>P(o,a),model:{defaults:{name:"Pagination",classes:a,copyable:!1,highlightable:!1,droppable:!1,draggable:!1,selectable:!1,hoverable:!1,layerable:!1,styles:`
39
39
  .${a}-bullet-active {
40
40
  background-color: currentColor;
41
41
  }
42
42
  .${a}-progressbar-fill {
43
43
  --swiper-pagination-color: currentColor;
44
44
  }
45
- `}}}),()=>{l.removeType(_)}},Ee="Scrollbar",J=`${N}scrollbar`,Te=e=>{const{Components:l}=e;return l.addType(O,{isComponent:a=>P(a,J),model:{defaults:{name:Ee,classes:J,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(O)}},xe="Slide",Q=`${N}slide`,Ae=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,Q),model:{defaults:{name:xe,classes:Q,icon:d.slider,draggable:(a,i)=>i.is(L)}}}),()=>{l.removeType(M)}},Le="Wrapper",ee=`${N}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:i=>P(i,ee),model:{defaults:{name:Le,icon:d.slider,classes:ee,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:i=>i.is(M)},init(){const i=this.components();this.listenTo(i,"add remove",this.updateSlider)},updateSlider(i){const n=this.closestType(h);if(n){const f=n.getView();n.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=f.getSwiper())==null?void 0:c.slideTo(i.index())},100)})}}}}),()=>{l.removeType(L)}},_e="swiperComponent",Ne=A.startup;return pe(function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},i=[ge(e,a),we(e),ke(e),Ae(e),Pe(e),Te(e)];ue({editor:e,plan:Ne,licenseKey:a.licenseKey,pluginName:_e,cleanup:()=>{i.forEach(n=>n())}})})});
45
+ `}}}),()=>{l.removeType(R)}},Te="Scrollbar",Q=`${_}scrollbar`,xe=e=>{const{Components:l}=e;return l.addType(O,{isComponent:a=>P(a,Q),model:{defaults:{name:Te,classes:Q,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(O)}},Ae="Slide",ee=`${_}slide`,Le=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>P(a,ee),model:{defaults:{name:Ae,classes:ee,icon:p.slider,draggable:(a,o)=>o.is(L)}}}),()=>{l.removeType(M)}},ke="Wrapper",te=`${_}wrapper`,Re=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:o=>P(o,te),model:{defaults:{name:ke,icon:p.slider,classes:te,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:o=>o.is(M)},init(){const o=this.components();this.listenTo(o,"add remove",this.updateSlider)},updateSlider(o){const s=this.closestType(g);if(s){const f=s.getView();s.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=f.getSwiper())==null?void 0:c.slideTo(o.index())},100)})}}}}),()=>{l.removeType(L)}},_e="swiperComponent",Ne=A.startup;return pe(function(e,l={}){const a={block:{},cdnScript:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js",cdnStyle:"https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css",...l},o=[we(e,a),Pe(e),Re(e),Le(e),Ee(e),xe(e)];ue({editor:e,plan:Ne,licenseKey:a.licenseKey,pluginName:_e,cleanup:()=>{o.forEach(s=>s())}})})});
@@ -1 +1 @@
1
- "use strict";function ce(e,t,o){let l,a,s,c,n;const r=t;function h(){const d=Date.now()-c;d<r&&d>=0?l=setTimeout(h,r-d):(l=null,n=e.apply(s,a),s=a=null)}const u=function(){return s=this,a=arguments,c=Date.now(),l||(l=setTimeout(h,r)),n};return u.clear=function(){l&&(clearTimeout(l),l=null)},u.flush=function(){l&&(n=e.apply(s,a),s=a=null,clearTimeout(l),l=null)},u}const O="app.grapesjs.com",F="app-stage.grapesjs.com",ie="app2.grapesjs.com",he="app-stage2.grapesjs.com",S=[O,ie,F,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],de="license:check:start",ve="license:check:end",ue=()=>typeof window<"u",ge=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?F:O}`}/${o?"platform-api":"api"}`,be=()=>{const e=ue()&&window.location.hostname;return!!e&&(S.includes(e)||S.some(t=>e.endsWith(t)))};function U(e){return typeof e=="function"}async function pe({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:a,body:s}){const n=`${t||ge({isDev:!1,isStage:!1})}${e}`,r={method:o,headers:{"Content-Type":"application/json",...l}};s&&(r.body=JSON.stringify(s));const h=a?new URLSearchParams(a).toString():"",u=h?`?${h}`:"",d=await fetch(`${n}${u}`,r);if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}var C=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(C||{}),$=(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.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))($||{});const E={[C.free]:0,[C.startup]:10,[C.business]:20,[C.enterprise]:30};function fe(e){const t=e;return t.init=o=>l=>e(l,o),t}const me=e=>fe(e);async function we({editor:e,plan:t,pluginName:o,licenseKey:l,onLicenseCheckResponse:a,cleanup:s}){let c="",n=!1;const r=be(),h=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),s()},u=(d={})=>{var y;const{error:p,sdkLicense:V}=d,m=(y=d.plan)==null?void 0:y.category;if(!(V||d.license)||p)h(p||"Invalid license");else if(m){const z=E[t],A=E[m];z>A&&h({pluginRequiredPlan:t,licensePlan:m})}};e.on(de,d=>{c=d==null?void 0:d.baseApiUrl,n=!0}),e.on(ve,d=>{a==null||a(d),u(d)}),setTimeout(async()=>{if(!n){if(r)return;if(l){const d=await ye({licenseKey:l,pluginName:o,baseApiUrl:c});a==null||a(d),d&&u(d)}else h("The `licenseKey` option not provided")}},2e3)}async function ye(e){const{licenseKey:t,pluginName:o,baseApiUrl:l}=e;try{return(await pe({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const Ce="tableComponent",He=C.startup;var i=(e=>(e.table="table",e.tableSettings="tableSettings",e.tableDelete="tableDelete",e.tableHead="tableHead",e.tableFoot="tableFoot",e.tableCellItems="tableCellItems",e.tableCellProperties="tableCellProperties",e.tableCellMerge="tableCellMerge",e.tableCellSplit="tableCellSplit",e.tableRowItems="tableRowItems",e.tableRowInsertBefore="tableRowInsertBefore",e.tableRowInsertAfter="tableRowInsertAfter",e.tableRowDelete="tableRowDelete",e.tableRowProperties="tableRowProperties",e.tableRowCut="tableRowCut",e.tableRowCopy="tableRowCopy",e.tableRowPasteBefore="tableRowPasteBefore",e.tableRowPasteAfter="tableRowPasteAfter",e.tableColumn="tableColumn",e.tableColumnItems="tableColumnItems",e.tableColumnInsertBefore="tableColumnInsertBefore",e.tableColumnInsertAfter="tableColumnInsertAfter",e.tableColumnDelete="tableColumnDelete",e.tableColumnCut="tableColumnCut",e.tableColumnCopy="tableColumnCopy",e.tableColumnPasteBefore="tableColumnPasteBefore",e.tableColumnPasteAfter="tableColumnPasteAfter",e))(i||{});const v={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},f="table",W="thead",_="tfoot",I="tbody",b="row",g="cell",D="clipboardTable",Re=[f,W,_,I,b,g],x=e=>e.em.get(D)||[],Pe=e=>e.every(t=>t.is(g)),k=(e,t)=>{const{editor:o,event:l,opts:a}=e,s=l.currentTarget||l.target,{x:c,y:n,width:r,height:h}=s.getBoundingClientRect(),u={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:c,y:n,w:r,h},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...t};U(a.openSettings)?a.openSettings({...e,layoutProps:u}):o.runCommand($.layoutToggle,u)},Ve=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(a=>({type:b,components:Array.from(Array(o).keys()).map(s=>({type:g,components:l?{type:"text",content:U(l)?l({y:a,x:s}):l}:void 0}))}))}),j="Table settings",K=e=>{const{component:t}=e;return t.is(f)?t:t.closestType(f)},ze=e=>{var t;(t=K(e))==null||t.remove(e.opts)},Ae=e=>{const t=K(e);t&&(e.editor.select(t),k(e,{id:"tableSettings",header:{label:j}}))},q=e=>[{id:i.table,icon:v[i.table],label:"Table",items:[{id:i.tableSettings,label:j,icon:v[i.tableSettings],onClick:({event:o})=>Ae({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:v[i.tableDelete],onClick:()=>ze(e)}]}],X=({editor:e})=>{const t=x(e);return t.length&&Pe(t)},G=({component:e,editor:t,after:o})=>{if(!e.is(g))return;const l=e.closestType(f),a=e.closestType(b),s=e.index()+(o?1:0);l==null||l.findType(b).forEach(n=>n.append({type:g},{at:s}));const c=a==null?void 0:a.components().at(s);c&&t.select(c)},Y=({component:e,opts:t})=>{if(!e.is(g))return;const o=e.closestType(f),l=e.index();o==null||o.findType(b).forEach(a=>{var s;return(s=a.components().at(l))==null?void 0:s.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(g))return;const o=e.closestType(f),l=e.index(),a=(o==null?void 0:o.findType(b).map(s=>s.components().at(l)))||[];a.length&&t.em.set(D,a)},L=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(g)||!X(e))return;const a=x(o),s=t.closestType(f),c=t.index()+(l?1:0);s==null||s.findType(b).forEach((n,r)=>{const h=a[r],u=(h==null?void 0:h.clone())||{type:g};n.append(u,{at:c})})},xe=e=>{const{component:t}=e;t.is(g)&&(J(e),Y({...e,opts:{temporary:!0}}))},Be=e=>{const t=X(e);return[{id:i.tableColumnItems,icon:v[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:v[i.tableColumnInsertBefore],onClick:()=>G(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>G({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:v[i.tableColumnDelete],onClick:()=>Y(e)},{id:i.tableColumnCut,label:"Cut column",icon:v[i.tableColumnCut],onClick:()=>xe(e)},{id:i.tableColumnCopy,label:"Copy column",icon:v[i.tableColumnCopy],onClick:()=>J(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:v[i.tableColumnPasteBefore],disabled:!t,onClick:()=>L(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>L({...e,after:!0})}]}]},Q="Row settings",Ie=e=>e.every(t=>t.is(b)),P=e=>{const{component:t}=e,o=t.is(g),l=t.is(b);if(!(!o&&!l))return l?t:t.closestType(b)},N=e=>{const{component:t,editor:o,after:l}=e,a=P(e);if(!a)return;const s=a.index()+(l?1:0),c=a.components().length,n=Array.from(Array(c).keys()).map(()=>({type:g})),r=a.parent();if(r){const h=r.append({type:b,components:n},{at:s})[0];if(t.is(g)&&h){const u=t.index(),d=h.components().at(u);d&&o.select(d)}}},ee=e=>{var t;(t=P(e))==null||t.remove(e.opts)},te=e=>{const t=P(e);t&&e.editor.em.set(D,[t])},Z=e=>{var n;const{editor:t,after:o}=e,l=P(e);if(!l||!le(e))return;const s=x(t)[0],c=l.index()+(o?1:0);s&&((n=l.parent())==null||n.append(s.clone(),{at:c}))},Me=e=>{P(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=x(e);return t.length&&Ie(t)},De=e=>{const t=P(e);t&&(e.editor.select(t),k(e,{id:"tableRowSettings",header:{label:Q}}))},oe=e=>{const t=le(e);return[{id:i.tableRowItems,icon:v[i.tableRowProperties],label:"Row",items:[{id:i.tableRowInsertBefore,label:"Insert row before",icon:v[i.tableRowInsertBefore],onClick:()=>N(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:v[i.tableRowInsertAfter],onClick:()=>N({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:v[i.tableRowDelete],onClick:()=>ee(e)},{id:i.tableRowProperties,label:Q,icon:v[i.tableRowProperties],onClick:({event:l})=>De({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:v[i.tableRowCut],onClick:()=>Me(e)},{id:i.tableRowCopy,label:"Copy row",icon:v[i.tableRowCopy],onClick:()=>te(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:v[i.tableRowPasteBefore],disabled:!t,onClick:()=>Z(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:v[i.tableRowPasteAfter],disabled:!t,onClick:()=>Z({...e,after:!0})}]},...q(e)]},T=e=>{const t=e.attributes.attributes||{},o=parseInt(`${t.rowspan||1}`,10),l=parseInt(`${t.colspan||1}`,10);return{rowspan:o,colspan:l}};function ae(e){const t=[];return e.components().forEach((o,l)=>{o.components().each((a,s)=>{const{rowspan:c,colspan:n}=T(a);if(t[l])for(;t[l][s];)s++;for(let r=l;r<l+c;r++){t[r]||(t[r]=[]);for(let h=s;h<s+n;h++)t[r][h]={real:r===l&&h===s,cell:a,rowspan:c,colspan:n}}})}),t}function H(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const M=e=>e.closestType(b);function ke(e,{x:t,y:o,rows:l,cols:a}){var n;let s=M(e[o][t].cell),c;for(let r=1;r<=l;r++)if(s=(n=s==null?void 0:s.parent())==null?void 0:n.components().at(s.index()+1),s){for(c=t;c>=0;c--){const{cell:h}=e[o+r][c],u=M(h);if(u===s){for(let d=1;d<=a;d++){const p=h.index();u.append({type:g},{at:p+1})}break}}if(c===-1){const u=s.components().at(0).index();for(let d=1;d<=a;d++)s.append({type:g},{at:u})}}}function se(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const a=e[t][o].cell;if(a.em.selected.hasComponent(a)){const{rowspan:s,colspan:c}=T(a);if(c>1||s>1){a.addAttributes({colspan:1,rowspan:1});for(let n=0;n<c-1;n++){const r=a.index();M(a).append({type:g},{at:r+1})}ke(e,{x:o,y:t,rows:s-1,cols:c})}}}}function Te(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var c;const o=ae(e),{em:l}=e;let a,s;for(let n=0;n<o.length;n++)for(let r=0;r<o[n].length;r++){const h=o[n][r];if((c=t.selected)!=null&&c.includes(h.cell)||l.selected.hasComponent(h.cell)){const u={x:r,y:n};a||(a=u),s=u}}return{grid:o,startPos:a,endPos:s}};function Se(e,t={}){const o=B(e),{startPos:l,endPos:a}=o;let{grid:s}=o;const{em:c}=e;if(!l||!a)return;const n=l.x,r=l.y,h=a.x,u=a.y,d=H(s,n,r),p=H(s,h,u);if(d&&p){se(s),s=ae(e);const V=[],m=H(s,n,r).cell;m.addAttributes({colspan:h-n+1,rowspan:u-r+1});for(let w=r;w<=u;w++)for(let y=n;y<=h;y++){const z=H(s,y,w);if(!z)continue;const{cell:A}=z;A!==m&&V.push(A)}V.forEach(w=>{t.mergeContent&&m.append(w.components().models),w.remove()}),c.setSelected(m),Te(e)}}const ne="Cell settings",Ee="Merge cells",Ge="Split cell",Le=e=>e.closestType(b),R=e=>{var t;return(t=Le(e))==null?void 0:t.parent()},Ne=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]),l=t[0];if(!o||!(l!=null&&l.is(g))||t.length>1)return!1;const{rowspan:a,colspan:s}=T(l);return!(s<2&&a<2)},Ze=e=>{const o=e.editor.getSelectedAll()[0],l=R(o),{grid:a}=B(l);se(a)},re=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]);if(!o||t.length<2||t.some(n=>!n.is(g)||R(n)!==o))return!1;const{grid:l,startPos:a,endPos:s}=B(o),{em:c}=o;if(!a||!s)return!1;for(let n=a.y;n<=s.y;n++)for(let r=a.x;r<=s.x;r++){const h=H(l,r,n);if(!h||!c.selected.hasComponent(h.cell))return!1}return!0},Oe=e=>{const{editor:t}=e;if(!re(e))return;const o=t.getSelectedAll(),l=R(o[0]);Se(l,{mergeContent:!0})},Fe=e=>{k(e,{id:"tableCellSettings",header:{label:ne}})},Ue=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ne,icon:v[i.tableCellProperties],onClick:({event:o})=>Fe({...e,event:o})},{id:i.tableCellMerge,label:Ee,icon:v[i.tableCellMerge],onClick:()=>Oe(e),disabled:!re(e)},{id:i.tableCellSplit,label:Ge,icon:v[i.tableCellSplit],onClick:()=>Ze(e),disabled:!Ne(e)}]},...Be(e),...oe(e)],$e=e=>{const t=e[0]&&R(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:a}=B(t,{selected:e});if(!l||!a)return;const s=[];for(let c=l.y;c<=a.y;c++)for(let n=l.x;n<=a.x;n++){const r=H(o,n,c);r&&s.push(r.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})},We=function(e,t={}){const o={block:{},...t},{Components:l}=e,a={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};l.addType(f,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:f,style:{width:"100%"}},select:!0,...o.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:v.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:c,value:n,emitUpdate:r}){const h=c.find("caption")[0];n?!h&&c.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),r(),e.refresh({tools:!0})},getValue(c){return!!c.component.find("caption")[0]}}],components:Ve(I,{rows:5}),contextMenu:({items:c,editor:n,component:r})=>[...q({editor:n,component:r,opts:o}),...c]}}}),l.addType(W,{model:{defaults:{icon:v.tableHead,...a}}}),l.addType(_,{model:{defaults:{icon:v.tableFoot,...a}}}),l.addType(I,{model:{defaults:{icon:v.tableRowProperties,...a}}}),l.addType(b,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:c,editor:n,component:r})=>[...oe({editor:n,component:r,opts:o}),...c]}}}),l.addType(g,{model:{defaults:{icon:v.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:c,editor:n,component:r})=>[...Ue({editor:n,component:r,opts:o}),...c]}}});const s=ce((c,n)=>{var d;const r=e.getSelectedAll(),h=!!((d=n==null?void 0:n.event)!=null&&d.shiftKey);if(r.length<2||!h||n.fromCell)return;const u=r.map(p=>p.is(g)?p:p.closestType(g)).filter(Boolean);u.length===r.length&&$e(u)},0);e.on("component:select",s),we({editor:e,plan:He,pluginName:Ce,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",s),e.Blocks.remove(f),Re.forEach(c=>l.removeType(c))}})},_e=me(We);module.exports=_e;
1
+ "use strict";function ce(e,t,o){let l,s,n,c,a;const r=t;function h(){const d=Date.now()-c;d<r&&d>=0?l=setTimeout(h,r-d):(l=null,a=e.apply(n,s),n=s=null)}const v=function(){return n=this,s=arguments,c=Date.now(),l||(l=setTimeout(h,r)),a};return v.clear=function(){l&&(clearTimeout(l),l=null)},v.flush=function(){l&&(a=e.apply(n,s),n=s=null,clearTimeout(l),l=null)},v}const F="app.grapesjs.com",U="app-stage.grapesjs.com",ie="app2.grapesjs.com",he="app-stage2.grapesjs.com",S=[F,ie,U,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],de="license:check:end",ve=()=>typeof window<"u",ue=({isDev:e,isStage:t,isPlatform:o})=>`${e?"":`https://${t?U:F}`}/${o?"platform-api":"api"}`,ge=()=>{const e=ve()&&window.location.hostname;return!!e&&(S.includes(e)||S.some(t=>e.endsWith(t)))};function $(e){return typeof e=="function"}async function be({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:s,body:n}){const a=`${t||ue({isDev:!1,isStage:!1})}${e}`,r={method:o,headers:{"Content-Type":"application/json",...l}};n&&(r.body=JSON.stringify(n));const h=s?new URLSearchParams(s).toString():"",v=h?`?${h}`:"",d=await fetch(`${a}${v}`,r);if(!d.ok)throw new Error(`HTTP error! status: ${d.status}`);return d.json()}var C=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(C||{}),x=(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))(x||{});const E={[C.free]:0,[C.startup]:10,[C.business]:20,[C.enterprise]:30};function pe(e){const t=e;return t.init=o=>l=>e(l,o),t}const fe=e=>pe(e);async function me({editor:e,plan:t,pluginName:o,licenseKey:l,onLicenseCheckResponse:s,cleanup:n}){let c="",a;const r=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var y;const{error:p,sdkLicense:V}=d,m=(y=d.plan)==null?void 0:y.category;if(!(V||d.license)||p)r(p||"Invalid license");else if(m){const z=E[t],A=E[m];z>A&&r({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(x.settings)&&(a=e.runCommand(x.settings),c=(a==null?void 0:a.baseUrl)||"");const v=d=>{s==null||s(d),d&&h(d)};if(!a){e.onReady(async()=>{if(!ge())if(l){const d=await ye({licenseKey:l,pluginName:o,baseApiUrl:c});v(d)}else r("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const d=we(a);v(d);return}e.on(de,d=>v(d))}const we=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function ye(e){const{licenseKey:t,pluginName:o,baseApiUrl:l}=e;try{return(await be({baseApiUrl:l,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const Ce="tableComponent",He=C.startup;var i=(e=>(e.table="table",e.tableSettings="tableSettings",e.tableDelete="tableDelete",e.tableHead="tableHead",e.tableFoot="tableFoot",e.tableCellItems="tableCellItems",e.tableCellProperties="tableCellProperties",e.tableCellMerge="tableCellMerge",e.tableCellSplit="tableCellSplit",e.tableRowItems="tableRowItems",e.tableRowInsertBefore="tableRowInsertBefore",e.tableRowInsertAfter="tableRowInsertAfter",e.tableRowDelete="tableRowDelete",e.tableRowProperties="tableRowProperties",e.tableRowCut="tableRowCut",e.tableRowCopy="tableRowCopy",e.tableRowPasteBefore="tableRowPasteBefore",e.tableRowPasteAfter="tableRowPasteAfter",e.tableColumn="tableColumn",e.tableColumnItems="tableColumnItems",e.tableColumnInsertBefore="tableColumnInsertBefore",e.tableColumnInsertAfter="tableColumnInsertAfter",e.tableColumnDelete="tableColumnDelete",e.tableColumnCut="tableColumnCut",e.tableColumnCopy="tableColumnCopy",e.tableColumnPasteBefore="tableColumnPasteBefore",e.tableColumnPasteAfter="tableColumnPasteAfter",e))(i||{});const u={table:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableSettings:'<svg viewBox="0 0 24 24"><path d="M5 4h14a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2m0 4v4h6V8H5m8 0v4h6V8h-6m-8 6v4h6v-4H5m8 0v4h6v-4h-6Z"/></svg>',tableDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 6v12h14V6H5z"/><path d="m14.4 8.6 1 1-2.3 2.4 2.3 2.4-1 1-2.4-2.3-2.4 2.3-1-1 2.3-2.4-2.3-2.4 1-1 2.4 2.3z"/></svg>',tableHead:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableFoot:'<svg viewBox="0 0 24 24" data-test="1" style="transform: rotate(180deg);"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm-8 11H5v3h6v-3Zm8 0h-6v3h6v-3Zm0-5h-6v3h6v-3ZM5 13h6v-3H5v3Z"/></svg>',tableColumn:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14Zm0 9h-4v5h4v-5Zm-6 0H9v5h4v-5Zm0-7H9v5h4V6Zm6 0h-4v5h4V6Z"/></svg>',tableCellItems:"",tableCellProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zm-8 9H5v5h6v-5zm8 0h-6v5h6v-5zm-8-7H5v5h6V6z"/></svg>',tableCellMerge:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6l2-2h14zM5 16v2h3v-2H5zm14-5h-9v7h9v-7zm0-5h-4v3h4V6zM8 6H5v3h3V6zm5 0h-3v3h3V6zm-8 8h3v-3H5v3z"/></svg>',tableCellSplit:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM8 15.5H5V18h3v-2.5zm11-5h-9V18h9v-7.5zm-2.5 1 1 1-2 2 2 2-1 1-2-2-2 2-1-1 2-2-2-2 1-1 2 2 2-2zm-8.5-1H5v3h3v-3zM19 6h-4v2.5h4V6zM8 6H5v2.5h3V6zm5 0h-3v2.5h3V6z"/></svg>',tableRowItems:"",tableRowInsertBefore:'<svg viewBox="0 0 24 24"><path d="M6 4a1 1 0 1 1 0 2H5v6h14V6h-1a1 1 0 0 1 0-2h2c.6 0 1 .4 1 1v13a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5c0-.6.4-1 1-1h2zm5 10H5v4h6v-4zm8 0h-6v4h6v-4zM12 3c.5 0 1 .4 1 .9V6h2a1 1 0 0 1 0 2h-2v2a1 1 0 0 1-2 .1V8H9a1 1 0 0 1 0-2h2V4c0-.6.4-1 1-1z"/></svg>',tableRowInsertAfter:'<svg viewBox="0 0 24 24"><path d="M12 13c.5 0 1 .4 1 .9V16h2a1 1 0 0 1 .1 2H13v2a1 1 0 0 1-2 .1V18H9a1 1 0 0 1-.1-2H11v-2c0-.6.4-1 1-1zm6 7a1 1 0 0 1 0-2h1v-6H5v6h1a1 1 0 0 1 0 2H4a1 1 0 0 1-1-1V6c0-1.1.9-2 2-2h14a2 2 0 0 1 2 2v13c0 .5-.4 1-.9 1H18zM11 6H5v4h6V6zm8 0h-6v4h6V6z"/></svg>',tableRowDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm0 2H5v3h2.5v2H5v2h2.5v2H5v3h14v-3h-2.5v-2H19v-2h-2.5V9H19V6zm-4.7 1.8 1.2 1L13 12l2.6 3.3-1.2 1-2.3-3-2.3 3-1.2-1L11 12 8.5 8.7l1.2-1 2.3 3 2.3-3z"/></svg>',tableRowProperties:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zM5 15v3h6v-3H5zm14 0h-6v3h6v-3zm0-9h-6v3h6V6zM5 9h6V6H5v3z"/></svg>',tableRowCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M22 3v5H9l3 3 2-2h4l-4 4 1 1h.5c.4 0 .8 0 1.2.3.5.2.9.4 1.2.8.7.6 1 1.3 1 2.2.2.8 0 1.5-.6 2l-.8.5-1 .2c-.4 0-.8 0-1.2-.3a3.9 3.9 0 0 1-2.1-2.2c-.2-.5-.3-1-.2-1.5l-1-1-1 1c0 .5 0 1-.2 1.5-.1.5-.4 1-.9 1.4-.3.4-.7.6-1.2.8l-1.2.3c-.4 0-.7 0-1-.2-.3 0-.6-.3-.8-.5-.5-.5-.8-1.2-.7-2a3 3 0 0 1 1-2.2A3.7 3.7 0 0 1 8.6 14H9l1-1-4-4-.5-1a3.3 3.3 0 0 1 0-2c0-.4.3-.7.5-1l2 2V3h14zM8.5 15.3h-.3a2.6 2.6 0 0 0-.8.4 2.5 2.5 0 0 0-.9 1.1l-.1.4v.7l.2.5.5.2h.7a2.5 2.5 0 0 0 .8-.3L9 18l.4-.4.2-.4.1-.4v-.7a1 1 0 0 0-.2-.5 1 1 0 0 0-.4-.2h-.5zm7 0H15a1 1 0 0 0-.4.3 1 1 0 0 0-.2.5 1.5 1.5 0 0 0 0 .7v.4a2.8 2.8 0 0 0 .5.7h.1a2.8 2.8 0 0 0 .8.6l.4.1h.7l.5-.2.2-.5v-.7a2.6 2.6 0 0 0-.3-.8 2.4 2.4 0 0 0-.7-.7 2.5 2.5 0 0 0-.8-.3h-.3zM12 11.6c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zm8.5-7.1h-11v2h11v-2z"/></svg>',tableRowCopy:'<svg viewBox="0 0 24 24"><path d="M22 11v7H6v-7h16zm-2 2H8v3h12v-3zm-1-6v2H4v5H2V7h17z"/></svg>',tableRowPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h12v-4h2v4c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 7v5H8V8h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableRowPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V11h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h14c0 1-.8 2-1.9 2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm10 11v5H8v-5h14zm-1.5 1.5h-11v2h11v-2zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnItems:"",tableColumnInsertBefore:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a1 1 0 0 1-1-1v-2a1 1 0 0 1 2 0v1h8V6H5v1a1 1 0 1 1-2 0V5c0-.6.4-1 1-1h15zm0 9h-4v5h4v-5zM8 8c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H9v2a1 1 0 0 1-2 .1V13H5a1 1 0 0 1-.1-2H7V9c0-.6.4-1 1-1zm11-2h-4v5h4V6z"/></svg>',tableColumnInsertAfter:'<svg viewBox="0 0 24 24"><path d="M20 4c.6 0 1 .4 1 1v2a1 1 0 0 1-2 0V6h-8v12h8v-1a1 1 0 0 1 2 0v2c0 .5-.4 1-.9 1H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h15zM9 13H5v5h4v-5zm7-5c.5 0 1 .4 1 .9V11h2a1 1 0 0 1 .1 2H17v2a1 1 0 0 1-2 .1V13h-2a1 1 0 0 1-.1-2H15V9c0-.6.4-1 1-1zM9 6H5v5h4V6z"/></svg>',tableColumnDelete:'<svg viewBox="0 0 24 24"><path d="M19 4a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h14zm-4 4h-2V6h-2v2H9V6H5v12h4v-2h2v2h2v-2h2v2h4V6h-4v2zm.3.5 1 1.2-3 2.3 3 2.3-1 1.2L12 13l-3.3 2.6-1-1.2 3-2.3-3-2.3 1-1.2L12 11l3.3-2.5z"/></svg>',tableColumnCut:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M7.2 4.5a3 3 0 0 1 2.2 1A3.7 3.7 0 0 1 10.5 8v.5l1 1 4-4 1-.5a3.3 3.3 0 0 1 2 0c.4 0 .7.3 1 .5L17 8h4v13h-6V10l-1.5 1.5.5.5v4l-2.5-2.5-1 1v.5c0 .4 0 .8-.3 1.2-.2.5-.4.9-.8 1.2-.6.7-1.3 1-2.2 1-.8.2-1.5 0-2-.6l-.5-.8-.2-1c0-.4 0-.8.3-1.2A3.9 3.9 0 0 1 7 12.7c.5-.2 1-.3 1.5-.2l1-1-1-1c-.5 0-1 0-1.5-.2-.5-.1-1-.4-1.4-.9-.4-.3-.6-.7-.8-1.2L4.5 7c0-.4 0-.7.2-1 0-.3.3-.6.5-.8.5-.5 1.2-.8 2-.7zm12.3 5h-3v10h3v-10zM8 13.8h-.3l-.4.2a2.8 2.8 0 0 0-.7.4v.1a2.8 2.8 0 0 0-.6.8l-.1.4v.7l.2.5.5.2h.7a2.6 2.6 0 0 0 .8-.3 2.4 2.4 0 0 0 .7-.7 2.5 2.5 0 0 0 .3-.8 1.5 1.5 0 0 0 0-.8 1 1 0 0 0-.2-.4 1 1 0 0 0-.5-.2H8zm3.5-3.7c-.4 0-.7.1-1 .4-.3.3-.4.6-.4 1s.1.7.4 1c.3.3.6.4 1 .4s.7-.1 1-.4c.3-.3.4-.6.4-1s-.1-.7-.4-1c-.3-.3-.6-.4-1-.4zM7 5.8h-.4a1 1 0 0 0-.5.3 1 1 0 0 0-.2.5v.7a2.5 2.5 0 0 0 .3.8l.2.3h.1l.4.4.4.2.4.1h.7L9 9l.2-.4a1.6 1.6 0 0 0 0-.8 2.6 2.6 0 0 0-.3-.8 2.5 2.5 0 0 0-1.2-1l-.4-.1H7z"/></svg>',tableColumnCopy:'<svg viewBox="0 0 24 24"><path d="M17 6v16h-7V6h7zm-2 2h-3v12h3V8zm-2-6v2H8v15H6V2h7z"/></svg>',tableColumnPasteBefore:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V18c0 1-.8 2-1.9 2H11v-2h7V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v2H4V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm-2 7v12H4V8h6zM8.5 9.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>',tableColumnPasteAfter:'<svg viewBox="0 0 24 24"><path fill-rule="evenodd" d="M12 1a3 3 0 0 1 2.8 2H18c1 0 2 .8 2 1.9V7h-2V5h-2v1c0 .6-.4 1-1 1H9a1 1 0 0 1-1-1V5H6v13h7v2H6c-1 0-2-.8-2-1.9V5c0-1 .8-2 1.9-2h3.3A3 3 0 0 1 12 1zm8 7v12h-6V8h6zm-1.5 1.5h-3v9h3v-9zM12 3a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"/></svg>'},f="table",W="thead",_="tfoot",M="tbody",b="row",g="cell",D="clipboardTable",Re=[f,W,_,M,b,g],B=e=>e.em.get(D)||[],Pe=e=>e.every(t=>t.is(g)),T=(e,t)=>{const{editor:o,event:l,opts:s}=e,n=l.currentTarget||l.target,{x:c,y:a,width:r,height:h}=n.getBoundingClientRect(),v={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:c,y:a,w:r,h},layout:{type:"tabs",value:"props",tabs:[{id:"styles",label:"Styles",children:{type:"panelStyles"}},{id:"props",label:"Properties",children:{type:"panelProperties",style:{padding:"14px 7px"}}}]},...t};$(s.openSettings)?s.openSettings({...e,layoutProps:v}):o.runCommand(x.layoutToggle,v)},Ve=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(s=>({type:b,components:Array.from(Array(o).keys()).map(n=>({type:g,components:l?{type:"text",content:$(l)?l({y:s,x:n}):l}:void 0}))}))}),j="Table settings",K=e=>{const{component:t}=e;return t.is(f)?t:t.closestType(f)},ze=e=>{var t;(t=K(e))==null||t.remove(e.opts)},Ae=e=>{const t=K(e);t&&(e.editor.select(t),T(e,{id:"tableSettings",header:{label:j}}))},q=e=>[{id:i.table,icon:u[i.table],label:"Table",items:[{id:i.tableSettings,label:j,icon:u[i.tableSettings],onClick:({event:o})=>Ae({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:u[i.tableDelete],onClick:()=>ze(e)}]}],X=({editor:e})=>{const t=B(e);return t.length&&Pe(t)},G=({component:e,editor:t,after:o})=>{if(!e.is(g))return;const l=e.closestType(f),s=e.closestType(b),n=e.index()+(o?1:0);l==null||l.findType(b).forEach(a=>a.append({type:g},{at:n}));const c=s==null?void 0:s.components().at(n);c&&t.select(c)},Y=({component:e,opts:t})=>{if(!e.is(g))return;const o=e.closestType(f),l=e.index();o==null||o.findType(b).forEach(s=>{var n;return(n=s.components().at(l))==null?void 0:n.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(g))return;const o=e.closestType(f),l=e.index(),s=(o==null?void 0:o.findType(b).map(n=>n.components().at(l)))||[];s.length&&t.em.set(D,s)},N=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(g)||!X(e))return;const s=B(o),n=t.closestType(f),c=t.index()+(l?1:0);n==null||n.findType(b).forEach((a,r)=>{const h=s[r],v=(h==null?void 0:h.clone())||{type:g};a.append(v,{at:c})})},xe=e=>{const{component:t}=e;t.is(g)&&(J(e),Y({...e,opts:{temporary:!0}}))},Be=e=>{const t=X(e);return[{id:i.tableColumnItems,icon:u[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:u[i.tableColumnInsertBefore],onClick:()=>G(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:u[i.tableColumnInsertAfter],onClick:()=>G({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:u[i.tableColumnDelete],onClick:()=>Y(e)},{id:i.tableColumnCut,label:"Cut column",icon:u[i.tableColumnCut],onClick:()=>xe(e)},{id:i.tableColumnCopy,label:"Copy column",icon:u[i.tableColumnCopy],onClick:()=>J(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:u[i.tableColumnPasteBefore],disabled:!t,onClick:()=>N(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:u[i.tableColumnPasteAfter],disabled:!t,onClick:()=>N({...e,after:!0})}]}]},Q="Row settings",Ie=e=>e.every(t=>t.is(b)),P=e=>{const{component:t}=e,o=t.is(g),l=t.is(b);if(!(!o&&!l))return l?t:t.closestType(b)},Z=e=>{const{component:t,editor:o,after:l}=e,s=P(e);if(!s)return;const n=s.index()+(l?1:0),c=s.components().length,a=Array.from(Array(c).keys()).map(()=>({type:g})),r=s.parent();if(r){const h=r.append({type:b,components:a},{at:n})[0];if(t.is(g)&&h){const v=t.index(),d=h.components().at(v);d&&o.select(d)}}},ee=e=>{var t;(t=P(e))==null||t.remove(e.opts)},te=e=>{const t=P(e);t&&e.editor.em.set(D,[t])},O=e=>{var a;const{editor:t,after:o}=e,l=P(e);if(!l||!le(e))return;const n=B(t)[0],c=l.index()+(o?1:0);n&&((a=l.parent())==null||a.append(n.clone(),{at:c}))},Me=e=>{P(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=B(e);return t.length&&Ie(t)},ke=e=>{const t=P(e);t&&(e.editor.select(t),T(e,{id:"tableRowSettings",header:{label:Q}}))},oe=e=>{const t=le(e);return[{id:i.tableRowItems,icon:u[i.tableRowProperties],label:"Row",items:[{id:i.tableRowInsertBefore,label:"Insert row before",icon:u[i.tableRowInsertBefore],onClick:()=>Z(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:u[i.tableRowInsertAfter],onClick:()=>Z({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:u[i.tableRowDelete],onClick:()=>ee(e)},{id:i.tableRowProperties,label:Q,icon:u[i.tableRowProperties],onClick:({event:l})=>ke({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:u[i.tableRowCut],onClick:()=>Me(e)},{id:i.tableRowCopy,label:"Copy row",icon:u[i.tableRowCopy],onClick:()=>te(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:u[i.tableRowPasteBefore],disabled:!t,onClick:()=>O(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:u[i.tableRowPasteAfter],disabled:!t,onClick:()=>O({...e,after:!0})}]},...q(e)]},L=e=>{const t=e.attributes.attributes||{},o=parseInt(`${t.rowspan||1}`,10),l=parseInt(`${t.colspan||1}`,10);return{rowspan:o,colspan:l}};function se(e){const t=[];return e.components().forEach((o,l)=>{o.components().each((s,n)=>{const{rowspan:c,colspan:a}=L(s);if(t[l])for(;t[l][n];)n++;for(let r=l;r<l+c;r++){t[r]||(t[r]=[]);for(let h=n;h<n+a;h++)t[r][h]={real:r===l&&h===n,cell:s,rowspan:c,colspan:a}}})}),t}function H(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const k=e=>e.closestType(b);function De(e,{x:t,y:o,rows:l,cols:s}){var a;let n=k(e[o][t].cell),c;for(let r=1;r<=l;r++)if(n=(a=n==null?void 0:n.parent())==null?void 0:a.components().at(n.index()+1),n){for(c=t;c>=0;c--){const{cell:h}=e[o+r][c],v=k(h);if(v===n){for(let d=1;d<=s;d++){const p=h.index();v.append({type:g},{at:p+1})}break}}if(c===-1){const v=n.components().at(0).index();for(let d=1;d<=s;d++)n.append({type:g},{at:v})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const s=e[t][o].cell;if(s.em.selected.hasComponent(s)){const{rowspan:n,colspan:c}=L(s);if(c>1||n>1){s.addAttributes({colspan:1,rowspan:1});for(let a=0;a<c-1;a++){const r=s.index();k(s).append({type:g},{at:r+1})}De(e,{x:o,y:t,rows:n-1,cols:c})}}}}function Te(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const I=(e,t={})=>{var c;const o=se(e),{em:l}=e;let s,n;for(let a=0;a<o.length;a++)for(let r=0;r<o[a].length;r++){const h=o[a][r];if((c=t.selected)!=null&&c.includes(h.cell)||l.selected.hasComponent(h.cell)){const v={x:r,y:a};s||(s=v),n=v}}return{grid:o,startPos:s,endPos:n}};function Le(e,t={}){const o=I(e),{startPos:l,endPos:s}=o;let{grid:n}=o;const{em:c}=e;if(!l||!s)return;const a=l.x,r=l.y,h=s.x,v=s.y,d=H(n,a,r),p=H(n,h,v);if(d&&p){ne(n),n=se(e);const V=[],m=H(n,a,r).cell;m.addAttributes({colspan:h-a+1,rowspan:v-r+1});for(let w=r;w<=v;w++)for(let y=a;y<=h;y++){const z=H(n,y,w);if(!z)continue;const{cell:A}=z;A!==m&&V.push(A)}V.forEach(w=>{t.mergeContent&&m.append(w.components().models),w.remove()}),c.setSelected(m),Te(e)}}const ae="Cell settings",Se="Merge cells",Ee="Split cell",Ge=e=>e.closestType(b),R=e=>{var t;return(t=Ge(e))==null?void 0:t.parent()},Ne=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]),l=t[0];if(!o||!(l!=null&&l.is(g))||t.length>1)return!1;const{rowspan:s,colspan:n}=L(l);return!(n<2&&s<2)},Ze=e=>{const o=e.editor.getSelectedAll()[0],l=R(o),{grid:s}=I(l);ne(s)},re=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]);if(!o||t.length<2||t.some(a=>!a.is(g)||R(a)!==o))return!1;const{grid:l,startPos:s,endPos:n}=I(o),{em:c}=o;if(!s||!n)return!1;for(let a=s.y;a<=n.y;a++)for(let r=s.x;r<=n.x;r++){const h=H(l,r,a);if(!h||!c.selected.hasComponent(h.cell))return!1}return!0},Oe=e=>{const{editor:t}=e;if(!re(e))return;const o=t.getSelectedAll(),l=R(o[0]);Le(l,{mergeContent:!0})},Fe=e=>{T(e,{id:"tableCellSettings",header:{label:ae}})},Ue=e=>[{id:i.tableCellItems,icon:u[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:u[i.tableCellProperties],onClick:({event:o})=>Fe({...e,event:o})},{id:i.tableCellMerge,label:Se,icon:u[i.tableCellMerge],onClick:()=>Oe(e),disabled:!re(e)},{id:i.tableCellSplit,label:Ee,icon:u[i.tableCellSplit],onClick:()=>Ze(e),disabled:!Ne(e)}]},...Be(e),...oe(e)],$e=e=>{const t=e[0]&&R(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:s}=I(t,{selected:e});if(!l||!s)return;const n=[];for(let c=l.y;c<=s.y;c++)for(let a=l.x;a<=s.x;a++){const r=H(o,a,c);r&&n.push(r.cell)}n.length&&t.em.setSelected(n,{fromCell:!0})},We=function(e,t={}){const o={block:{},...t},{Components:l}=e,s={copyable:!1,emptyState:!0,highlightable:!1,stylable:["color","font-family","font-size","font-weight","line-height","text-align","vertical-align","background-color","border-width","border-style","border-color"]};l.addType(f,{block:o.block&&{label:"Table",media:u.table,category:"Extra",content:{type:f,style:{width:"100%"}},select:!0,...o.block},model:{defaults:{emptyState:!0,highlightable:!1,icon:u.table,stylable:["width","height","margin","font-family","font-size","font-weight","line-height","text-align","background","background-color","border-width","border-style","border-color"],traits:[{type:"number",min:0,name:"cellspacing",label:"Cell spacing"},{type:"number",min:0,name:"cellpadding",label:"Cell padding"},{id:"tableCaption",type:"checkbox",label:"Caption",setValue({component:c,value:a,emitUpdate:r}){const h=c.find("caption")[0];a?!h&&c.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),r(),e.refresh({tools:!0})},getValue(c){return!!c.component.find("caption")[0]}}],components:Ve(M,{rows:5}),contextMenu:({items:c,editor:a,component:r})=>[...q({editor:a,component:r,opts:o}),...c]}}}),l.addType(W,{model:{defaults:{icon:u.tableHead,...s}}}),l.addType(_,{model:{defaults:{icon:u.tableFoot,...s}}}),l.addType(M,{model:{defaults:{icon:u.tableRowProperties,...s}}}),l.addType(b,{model:{defaults:{icon:u.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:c,editor:a,component:r})=>[...oe({editor:a,component:r,opts:o}),...c]}}}),l.addType(g,{model:{defaults:{icon:u.tableCellProperties,emptyState:{styleOut:"height: 1px"},stylable:["width","height","padding","background","background-color","text-align","vertical-align","border-width","border-style","border-color"],traits:[{id:"tableCellType",type:"select",options:[{value:"td",name:"Cell"},{value:"th",name:"Header Cell"}],label:"Cell type",name:"tagName",changeProp:!0},{id:"tableCellScope",type:"select",options:[{value:!1,name:"None"},{value:"row",name:"Row"},{value:"col",name:"Column"},{value:"rowgroup",name:"Row group"},{value:"colgroup",name:"Column group"}],label:"Scope",name:"scope"}],contextMenu:({items:c,editor:a,component:r})=>[...Ue({editor:a,component:r,opts:o}),...c]}}});const n=ce((c,a)=>{var d;const r=e.getSelectedAll(),h=!!((d=a==null?void 0:a.event)!=null&&d.shiftKey);if(r.length<2||!h||a.fromCell)return;const v=r.map(p=>p.is(g)?p:p.closestType(g)).filter(Boolean);v.length===r.length&&$e(v)},0);e.on("component:select",n),me({editor:e,plan:He,pluginName:Ce,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",n),e.Blocks.remove(f),Re.forEach(c=>l.removeType(c))}})},_e=fe(We);module.exports=_e;