@grapesjs/studio-sdk-plugins 1.0.28 → 1.0.29

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 (50) hide show
  1. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  2. package/dist/canvasAbsoluteMode/index.es.js +98 -97
  3. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  4. package/dist/canvasFullSize/index.cjs.js +8 -7
  5. package/dist/canvasFullSize/index.es.js +145 -138
  6. package/dist/canvasFullSize/index.umd.js +9 -8
  7. package/dist/canvasFullSize/typesSchema.d.ts +5 -0
  8. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  9. package/dist/googleFontsAssetProvider/index.es.js +11 -11
  10. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  11. package/dist/iconifyComponent/index.cjs.js +2 -2
  12. package/dist/iconifyComponent/index.es.js +13 -13
  13. package/dist/iconifyComponent/index.umd.js +2 -2
  14. package/dist/index.cjs.d.ts +1 -0
  15. package/dist/index.cjs.js +192 -95
  16. package/dist/index.d.ts +1 -0
  17. package/dist/index.es.d.ts +1 -0
  18. package/dist/index.es.js +7577 -7242
  19. package/dist/index.umd.js +192 -95
  20. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  21. package/dist/layoutSidebarButtons/index.es.js +156 -154
  22. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  23. package/dist/presetPrintable/index.cjs.js +4 -4
  24. package/dist/presetPrintable/index.es.js +59 -59
  25. package/dist/presetPrintable/index.umd.js +1 -1
  26. package/dist/prosemirror/index.cjs.js +5 -5
  27. package/dist/prosemirror/index.es.js +100 -100
  28. package/dist/prosemirror/index.umd.js +1 -1
  29. package/dist/rteTinyMce/index.cjs.js +2 -2
  30. package/dist/rteTinyMce/index.es.js +10 -10
  31. package/dist/rteTinyMce/index.umd.js +1 -1
  32. package/dist/shapeDividerComponent/index.cjs.d.ts +3 -0
  33. package/dist/shapeDividerComponent/index.cjs.js +97 -0
  34. package/dist/shapeDividerComponent/index.d.ts +3 -0
  35. package/dist/shapeDividerComponent/index.es.d.ts +3 -0
  36. package/dist/shapeDividerComponent/index.es.js +427 -0
  37. package/dist/shapeDividerComponent/index.umd.js +97 -0
  38. package/dist/shapeDividerComponent/shared.d.ts +3 -0
  39. package/dist/shapeDividerComponent/types.d.ts +10 -0
  40. package/dist/shapeDividerComponent/typesSchema.d.ts +9 -0
  41. package/dist/swiperComponent/index.cjs.js +9 -9
  42. package/dist/swiperComponent/index.es.js +130 -122
  43. package/dist/swiperComponent/index.umd.js +5 -5
  44. package/dist/tableComponent/index.cjs.js +1 -1
  45. package/dist/tableComponent/index.es.js +9 -9
  46. package/dist/tableComponent/index.umd.js +1 -1
  47. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  48. package/dist/youtubeAssetProvider/index.es.js +34 -34
  49. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  50. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- (function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T():typeof define=="function"&&define.amd?define(T):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_swiperComponent=T())})(this,function(){"use strict";const E="app.grapesjs.com",T="app-stage.grapesjs.com",H=[E,"app2.grapesjs.com",T,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",se=({isDev:e,isStage:l})=>`${e?"":`https://${l?T:E}`}/api`,ne=()=>{const e=le()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(l=>e.endsWith(l)))},ie=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";async function re({path:e,baseApiUrl:l,method:a="GET",headers:s={},params:i,body:b}){const f=`${l||se({isDev:!1,isStage:!1})}${e}`,p={method:a,headers:{"Content-Type":"application/json",...s}};b&&(p.body=JSON.stringify(b));const u=i?new URLSearchParams(i).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,p);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}var x=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(x||{});const j={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function ce(e){const l=e;return l.init=a=>s=>e(s,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:s,cleanup:i}){let b="",c=!1;const f=ne(),p=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),i()},u=(o={})=>{var w;const{error:h,sdkLicense:t}=o,n=(w=o.plan)==null?void 0:w.category;if(!(t||o.license)||h)p(h||"Invalid license");else if(n){const I=j[l],F=j[n];I>F&&p({pluginRequiredPlan:l,licensePlan:n})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(s){const o=await ue({licenseKey:s,pluginName:a,baseApiUrl:b});o&&u(o)}else p("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:s}=e;try{return(await re({baseApiUrl:s,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const S=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},s=[],i=[];for(const c in e){const{value:f,...p}=e[c];s.push({id:c,name:c,changeProp:!0,category:l.category,...p}),a[c]=f,!oe(f)&&i.push(c);const{subTraits:u={}}=p;for(const o in p.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:i,props:a,traits:s}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const s=`${a.id||a.name}`,i=a.changeProp?`change:${s}`:`change:attributes:${s}`;e.on(i,()=>U(e,s)),U(e,s)}})},U=(e,l)=>{const a=e.getTrait(l),s=a.get("category"),i=a.get("subTraits")||{},c=(Object.values(i).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=i[a.getValue()],p=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:s,...u})),{at:p})},he=(e,l)=>{l.forEach(a=>{const s=ie(a);s!==a&&e.has(s)&&e.set({[a]:e.get(s),[s]:void 0})})},v="swiper",N=`${v}-slide`,L=`${v}-wrapper`,k=`${v}-nav-prev`,D=`${v}-nav-next`,A=`${v}-pagination`,M=`${v}-scrollbar`,d={slider:`<svg viewBox="0 0 24 24">
1
+ (function(E,T){typeof exports=="object"&&typeof module<"u"?module.exports=T():typeof define=="function"&&define.amd?define(T):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_swiperComponent=T())})(this,function(){"use strict";const E="app.grapesjs.com",T="app-stage.grapesjs.com",H=[E,"app2.grapesjs.com",T,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],te="license:check:start",ae="license:check:end",le=()=>typeof window<"u",ie=({isDev:e,isStage:l})=>`${e?"":`https://${l?T:E}`}/api`,ne=()=>{const e=le()&&window.location.hostname;return!!e&&(H.includes(e)||H.some(l=>e.endsWith(l)))},se=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(l,a)=>(a?"-":"")+l.toLowerCase()),oe=e=>typeof e<"u";async function re({path:e,baseApiUrl:l,method:a="GET",headers:i={},params:s,body:b}){const f=`${l||ie({isDev:!1,isStage:!1})}${e}`,p={method:a,headers:{"Content-Type":"application/json",...i}};b&&(p.body=JSON.stringify(b));const u=s?new URLSearchParams(s).toString():"",o=u?`?${u}`:"",h=await fetch(`${f}${o}`,p);if(!h.ok)throw new Error(`HTTP error! status: ${h.status}`);return h.json()}var x=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(x||{});const j={[x.free]:0,[x.startup]:10,[x.business]:20,[x.enterprise]:30};function ce(e){const l=e;return l.init=a=>i=>e(i,a),l}const de=e=>ce(e);async function pe({editor:e,plan:l,pluginName:a,licenseKey:i,cleanup:s}){let b="",c=!1;const f=ne(),p=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),s()},u=(o={})=>{var w;const{error:h,sdkLicense:t}=o,n=(w=o.plan)==null?void 0:w.category;if(!(t||o.license)||h)p(h||"Invalid license");else if(n){const I=j[l],$=j[n];I>$&&p({pluginRequiredPlan:l,licensePlan:n})}};e.on(te,o=>{b=o==null?void 0:o.baseApiUrl,c=!0}),e.on(ae,o=>{u(o)}),setTimeout(async()=>{if(!c){if(f)return;if(i){const o=await ue({licenseKey:i,pluginName:a,baseApiUrl:b});o&&u(o)}else p("The `licenseKey` option not provided")}},2e3)}async function ue(e){const{licenseKey:l,pluginName:a,baseApiUrl:i}=e;try{return(await re({baseApiUrl:i,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 S=(e,l)=>{var a;return!!((a=e==null?void 0:e.classList)!=null&&a.contains(l))},be=(e,l={})=>{var b;const a={},i=[],s=[];for(const c in e){const{value:f,...p}=e[c];i.push({id:c,name:c,changeProp:!0,category:l.category,...p}),a[c]=f,!oe(f)&&s.push(c);const{subTraits:u={}}=p;for(const o in p.subTraits)(b=u[o])==null||b.forEach(h=>{const t=h.id||h.name;a[t]=h.value})}return{propKeys:Object.keys(a),propsNoValues:s,props:a,traits:i}},fe=(e,l)=>{l.forEach(a=>{if(a.subTraits){const i=`${a.id||a.name}`,s=a.changeProp?`change:${i}`:`change:attributes:${i}`;e.on(s,()=>U(e,i)),U(e,i)}})},U=(e,l)=>{const a=e.getTrait(l),i=a.get("category"),s=a.get("subTraits")||{},c=(Object.values(s).flat()||[]).map(u=>u.id||u.name);e.removeTrait(c);const f=s[a.getValue()],p=e.getTraitIndex(l)+1;f&&e.addTrait(f.map(u=>({category:i,...u})),{at:p})},he=(e,l)=>{l.forEach(a=>{const i=se(a);i!==a&&e.has(i)&&e.set({[a]:e.get(i),[i]:void 0})})},v="swiper",M=`${v}-slide`,L=`${v}-wrapper`,k=`${v}-nav-prev`,D=`${v}-nav-next`,A=`${v}-pagination`,O=`${v}-scrollbar`,d={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>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={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 s;const a=(s=e.getView())==null?void 0:s.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,s;l?e.append([{type:k},{type:D}]):((a=e.findFirstType(k))==null||a.remove(),(s=e.findFirstType(D))==null||s.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:"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(A)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(A);a==null||a.remove(),l!=="none"&&e.append({type:A}),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(M),setValue:({component:e,value:l})=>{const a=e.findFirstType(M);a==null||a.remove(),l&&e.append({type:M}),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:K,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:K,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:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",$="swiper",_=`${$}-`,me=(e,l)=>{const{Components:a,Blocks:s,Commands:i}=e,{block:b}=l,c=be(ve),f="core:preview",p=i.events,u=function(t){const n=this,O=window,w=n.__onLoad,I=n.__activeSlide,F=n.__inPreview,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={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(z)?z:r(z),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&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:R,tabletSlidesPerView:g}=t,C=r(R);m.breakpoints[C]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:R,mobileSlidesPerView:g}=t,C=r(R);m.breakpoints[C]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!F&&(m.simulateTouch=!1),I&&(m.initialSlide=I);const G=new O.Swiper(n,m);w==null||w(G)};if(O.Swiper)ee();else{const{head:m}=document,G=Array.isArray(W)?[...W]:[W],R=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},C=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=C.bind(null,P),m.appendChild(y)}else ee()};g(R),C(G)}},o=(t=0)=>({type:N,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:b&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,$),model:{defaults:()=>({name:Y,icon:d.slider,classes:$,draggable:(t,n)=>!n.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:A}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${f}`,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:N,components:{type:"text",components:{type:"textnode",content:`Slide ${t+1}`}}}},toJSON(...t){const n=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(O=>delete n[O]),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(v),s.remove(v)}},ge="Nav Prev",ye="Nav Next",B=`${_}button-prev`,V=`${_}button-next`,Se=e=>{const{Components:l}=e,a=s=>({type:"svg",selectable:!1,hoverable:!1,attributes:{viewBox:"0 0 27 44"},components:{type:"svg-in",tagName:"path",attributes:{d:s,fill:"currentColor"}}});return l.addType(k,{isComponent:s=>S(s,B),model:{defaults:{name:ge,classes:B,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:`
24
+ </svg>`},K={id:"swiper-responsive",label:"Responsive",icon:d.responsive},Z={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:D}]):((a=e.findFirstType(k))==null||a.remove(),(i=e.findFirstType(D))==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(A)?e.get("pagination")||"bullets":"none",setValue:({component:e,value:l})=>{const a=e.findFirstType(A);a==null||a.remove(),l!=="none"&&e.append({type:A}),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:K,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:K,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:Z,type:"checkbox",label:"Allow touch move",tip:"Allow touch interactions",value:!0},grabCursor:{category:Z,type:"checkbox",label:"Grab cursor",tip:'If enabled, the user will see the "grab" cursor when hover the slider',value:!1}},Y="Slider",F="swiper",_=`${F}-`,me=(e,l)=>{const{Components:a,Blocks:i,Commands:s}=e,{block:b}=l,c=be(ve),f="core:preview",p=s.events,u=function(t){const n=this,N=window,w=n.__onLoad,I=n.__activeSlide,$=n.__inPreview,Ne=N._isEditor&&!$?t.autoplayEditor:!0,{cdnScript:W,cdnStyle:q,slidesPerView:z}=t||{},r=m=>isNaN(m)?void 0:parseFloat(m),ee=()=>{const m={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(z)?z:r(z),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&&Ne&&{delay:t.autoplayDelay,disableOnInteraction:t.autoplayDisableOnInteraction,pauseOnMouseEnter:t.autoplayPauseOnMouseEnter,reverseDirection:t.autoplayReverseDirection,stopOnLastSlide:t.autoplayStopOnLastSlide,waitForTransition:t.autoplayWaitForTransition}};if(t.tablet){const{tabletBreakpoint:R,tabletSlidesPerView:g}=t,C=r(R);m.breakpoints[C]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.tabletSlidesPerGroup),spaceBetween:r(t.tabletSpaceBetween)}}if(t.mobile){const{mobileBreakpoint:R,mobileSlidesPerView:g}=t,C=r(R);m.breakpoints[C]={slidesPerView:isNaN(g)?g:r(g),slidesPerGroup:r(t.mobileSlidesPerGroup),spaceBetween:r(t.mobileSpaceBetween)}}w&&!$&&(m.simulateTouch=!1),I&&(m.initialSlide=I);const G=new N.Swiper(n,m);w==null||w(G)};if(N.Swiper)ee();else{const{head:m}=document,G=Array.isArray(W)?[...W]:[W],R=Array.isArray(q)?[...q]:[q],g=P=>{if(P.length){const y=document.createElement("link");y.href=P.shift(),y.rel="stylesheet",m.appendChild(y),g(P)}},C=P=>{if(P.length){const y=document.createElement("script");y.src=P.shift(),y.onerror=y.onload=C.bind(null,P),m.appendChild(y)}else ee()};g(R),C(G)}},o=(t=0)=>({type:M,style:{padding:"50px"},components:{type:"text",components:{type:"textnode",content:`Slide ${t}`}}}),h=a.getType("default").model;return a.addType(v,{block:b&&{label:Y,media:d.slider,category:"Extra",select:!0,...l.block},isComponent:t=>S(t,F),model:{defaults:()=>({name:Y,icon:d.slider,classes:F,draggable:(t,n)=>!n.is(v),components:[{type:L,components:[o(1),o(2),o(3)]},{type:A}],script:u,cdnScript:l.cdnScript,cdnStyle:l.cdnStyle,"script-props":["cdnScript","cdnStyle",...c.propKeys],...c.props,traits:[...c.traits]}),init(){const{em:t}=this;fe(this,c.traits),he(this,c.propKeys),this.listenTo(t,`${p.runCommand}${f}`,this.onPreviewOn),this.listenTo(t,`${p.stopCommand}${f}`,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=h.prototype.toJSON.apply(this,t);return c.propsNoValues.forEach(N=>delete n[N]),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(v),i.remove(v)}},ge="Nav Prev",ye="Nav Next",B=`${_}button-prev`,V=`${_}button-next`,Se=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=>S(i,B),model:{defaults:{name:ge,classes:B,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
25
  .${B} {
26
26
  color: inherit;
27
27
  }
28
28
  .${B}:after {
29
29
  content: none;
30
30
  }
31
- `}}}),l.addType(D,{extend:k,isComponent:s=>S(s,V),model:{defaults:{name:ye,classes:V,components:a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
31
+ `}}}),l.addType(D,{extend:k,isComponent:i=>S(i,V),model:{defaults:{name:ye,classes:V,components:a("M27,22L27,22L5,44l-2.1-2.1L22.8,22L2.9,2.1L5,0L27,22L27,22z"),styles:`
32
32
  .${V} {
33
33
  color: inherit;
34
34
  }
35
35
  .${V}:after {
36
36
  content: none;
37
37
  }
38
- `}}}),()=>{l.removeType(k),l.removeType(D)}},we=e=>{const{Components:l}=e,a=`${_}pagination`;return l.addType(A,{isComponent:s=>S(s,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(D)}},we=e=>{const{Components:l}=e,a=`${_}pagination`;return l.addType(A,{isComponent:i=>S(i,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(A)}},Pe="Scrollbar",X=`${_}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(M)}},Te="Slide",J=`${_}slide`,xe=e=>{const{Components:l}=e;return l.addType(N,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,s)=>s.is(L)}}}),()=>{l.removeType(N)}},Le="Wrapper",Q=`${_}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:s=>S(s,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,copyable:!1,removable:!1,draggable:!1,highlightable:!1,droppable:s=>s.is(N)},init(){const s=this.components();this.listenTo(s,"add remove",this.updateSlider)},updateSlider(s){const i=this.closestType(v);if(i){const b=i.getView();i.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(s.index())},100)})}}}}),()=>{l.removeType(L)}},Ae="swiperComponent",_e=x.startup;return de(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},s=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:_e,licenseKey:a.licenseKey,pluginName:Ae,cleanup:()=>{s.forEach(i=>i())}})})});
45
+ `}}}),()=>{l.removeType(A)}},Pe="Scrollbar",X=`${_}scrollbar`,Ee=e=>{const{Components:l}=e;return l.addType(O,{isComponent:a=>S(a,X),model:{defaults:{name:Pe,classes:X,copyable:!1,highlightable:!1,removable:!1,selectable:!1,hoverable:!1,layerable:!1,droppable:!1,draggable:!1}}}),()=>{l.removeType(O)}},Te="Slide",J=`${_}slide`,xe=e=>{const{Components:l}=e;return l.addType(M,{isComponent:a=>S(a,J),model:{defaults:{name:Te,classes:J,icon:d.slider,draggable:(a,i)=>i.is(L)}}}),()=>{l.removeType(M)}},Le="Wrapper",Q=`${_}wrapper`,ke=e=>{const{Components:l}=e,{events:a}=l;return l.addType(L,{isComponent:i=>S(i,Q),model:{defaults:{name:Le,icon:d.slider,classes:Q,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 s=this.closestType(v);if(s){const b=s.getView();s.reloadSlider(),this.em.once(a.scriptMount,()=>{setTimeout(()=>{var c;return(c=b.getSwiper())==null?void 0:c.slideTo(i.index())},100)})}}}}),()=>{l.removeType(L)}},Ae="swiperComponent",_e=x.startup;return de(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=[me(e,a),Se(e),ke(e),xe(e),we(e),Ee(e)];pe({editor:e,plan:_e,licenseKey:a.licenseKey,pluginName:Ae,cleanup:()=>{i.forEach(s=>s())}})})});
@@ -1 +1 @@
1
- "use strict";function re(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}const O="app.grapesjs.com",F="app-stage.grapesjs.com",ie="app2.grapesjs.com",he="app-stage2.grapesjs.com",T=[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",be=({isDev:e,isStage:t})=>`${e?"":`https://${t?F:O}`}/api`,ge=()=>{const e=ue()&&window.location.hostname;return!!e&&(T.includes(e)||T.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:n,body:s}){const a=`${t||be({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),$=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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 L={[y.free]:0,[y.startup]:10,[y.business]:20,[y.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,cleanup:n}){let s="",r=!1;const a=ge(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,w=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(w){const V=L[t],z=L[w];V>z&&c({pluginRequiredPlan:t,licensePlan:w})}};e.on(de,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(ve,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await ye({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("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(n){return console.error("Error during SDK license check:",n),!1}}const Ce="tableComponent",He=y.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>'},p="table",W="thead",_="tfoot",x="tbody",g="row",b="cell",M="clipboardTable",Re=[p,W,_,x,g,b],A=e=>e.em.get(M)||[],Pe=e=>e.every(t=>t.is(b)),k=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,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(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand($.layoutToggle,d)},Ve=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:U(l)?l({y:n,x:s}):l}:void 0}))}))}),j="Table settings",K=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},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=A(e);return t.length&&Pe(t)},E=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},Y=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(M,n)},G=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!X(e))return;const n=A(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},Be=e=>{const{component:t}=e;t.is(b)&&(J(e),Y({...e,opts:{temporary:!0}}))},xe=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:()=>E(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>E({...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:()=>Be(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:()=>G(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>G({...e,after:!0})}]}]},Q="Row settings",Ie=e=>e.every(t=>t.is(g)),R=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},N=e=>{const{component:t,editor:o,after:l}=e,n=R(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},ee=e=>{var t;(t=R(e))==null||t.remove(e.opts)},te=e=>{const t=R(e);t&&e.editor.em.set(M,[t])},Z=e=>{var a;const{editor:t,after:o}=e,l=R(e);if(!l||!le(e))return;const s=A(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},Me=e=>{R(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=A(e);return t.length&&Ie(t)},ke=e=>{const t=R(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})=>ke({...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)]},D=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((n,s)=>{const{rowspan:r,colspan:a}=D(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function C(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const I=e=>e.closestType(g);function De(e,{x:t,y:o,rows:l,cols:n}){var a;let s=I(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=I(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=D(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();I(n).append({type:b},{at:c+1})}De(e,{x:o,y:t,rows:s-1,cols:r})}}}}function Se(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function Te(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=C(s,a,c),f=C(s,h,d);if(u&&f){ne(s),s=se(e);const w=[],P=C(s,a,c).cell;P.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let V=a;V<=h;V++){const z=C(s,V,m);if(!z)continue;const{cell:S}=z;S!==P&&w.push(S)}w.forEach(m=>{t.mergeContent&&P.append(m.components().models),m.remove()}),r.setSelected(P),Se(e)}}const ae="Cell settings",Le="Merge cells",Ee="Split cell",Ge=e=>e.closestType(g),H=e=>{var t;return(t=Ge(e))==null?void 0:t.parent()},Ne=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=D(l);return!(s<2&&n<2)},Ze=e=>{const o=e.editor.getSelectedAll()[0],l=H(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||H(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=C(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Oe=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=H(o[0]);Te(l,{mergeContent:!0})},Fe=e=>{k(e,{id:"tableCellSettings",header:{label:ae}})},Ue=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Fe({...e,event:o})},{id:i.tableCellMerge,label:Le,icon:v[i.tableCellMerge],onClick:()=>Oe(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Ee,icon:v[i.tableCellSplit],onClick:()=>Ze(e),disabled:!Ne(e)}]},...xe(e),...oe(e)],$e=e=>{const t=e[0]&&H(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=C(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})},We=function(e,t={}){const o={block:{},...t},{Components:l}=e,n={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(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,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:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Ve(x,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...q({editor:a,component:c,opts:o}),...r]}}}),l.addType(W,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(_,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(x,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{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:r,editor:a,component:c})=>[...Ue({editor:a,component:c,opts:o}),...r]}}});const s=re((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&$e(d)},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(p),Re.forEach(r=>l.removeType(r))}})},_e=me(We);module.exports=_e;
1
+ "use strict";function re(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}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",be=({isDev:e,isStage:t})=>`${e?"":`https://${t?F:O}`}/api`,ge=()=>{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:n,body:s}){const a=`${t||be({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),$=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.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 L={[y.free]:0,[y.startup]:10,[y.business]:20,[y.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,cleanup:n}){let s="",r=!1;const a=ge(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,w=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(w){const V=L[t],z=L[w];V>z&&c({pluginRequiredPlan:t,licensePlan:w})}};e.on(de,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(ve,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await ye({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("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(n){return console.error("Error during SDK license check:",n),!1}}const Ce="tableComponent",He=y.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>'},p="table",W="thead",_="tfoot",x="tbody",g="row",b="cell",M="clipboardTable",Re=[p,W,_,x,g,b],A=e=>e.em.get(M)||[],Pe=e=>e.every(t=>t.is(b)),k=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,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(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand($.layoutToggle,d)},Ve=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:U(l)?l({y:n,x:s}):l}:void 0}))}))}),j="Table settings",K=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},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=A(e);return t.length&&Pe(t)},E=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},Y=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},J=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(M,n)},G=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!X(e))return;const n=A(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},Be=e=>{const{component:t}=e;t.is(b)&&(J(e),Y({...e,opts:{temporary:!0}}))},xe=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:()=>E(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>E({...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:()=>Be(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:()=>G(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>G({...e,after:!0})}]}]},Q="Row settings",Ie=e=>e.every(t=>t.is(g)),R=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},N=e=>{const{component:t,editor:o,after:l}=e,n=R(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},ee=e=>{var t;(t=R(e))==null||t.remove(e.opts)},te=e=>{const t=R(e);t&&e.editor.em.set(M,[t])},Z=e=>{var a;const{editor:t,after:o}=e,l=R(e);if(!l||!le(e))return;const s=A(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},Me=e=>{R(e)&&(te(e),ee({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=A(e);return t.length&&Ie(t)},ke=e=>{const t=R(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})=>ke({...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)]},D=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((n,s)=>{const{rowspan:r,colspan:a}=D(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function C(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const I=e=>e.closestType(g);function De(e,{x:t,y:o,rows:l,cols:n}){var a;let s=I(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=I(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=D(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();I(n).append({type:b},{at:c+1})}De(e,{x:o,y:t,rows:s-1,cols:r})}}}}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 r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function Se(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=C(s,a,c),f=C(s,h,d);if(u&&f){ne(s),s=se(e);const w=[],P=C(s,a,c).cell;P.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let V=a;V<=h;V++){const z=C(s,V,m);if(!z)continue;const{cell:T}=z;T!==P&&w.push(T)}w.forEach(m=>{t.mergeContent&&P.append(m.components().models),m.remove()}),r.setSelected(P),Te(e)}}const ae="Cell settings",Le="Merge cells",Ee="Split cell",Ge=e=>e.closestType(g),H=e=>{var t;return(t=Ge(e))==null?void 0:t.parent()},Ne=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=D(l);return!(s<2&&n<2)},Ze=e=>{const o=e.editor.getSelectedAll()[0],l=H(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=H(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||H(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=C(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Oe=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=H(o[0]);Se(l,{mergeContent:!0})},Fe=e=>{k(e,{id:"tableCellSettings",header:{label:ae}})},Ue=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Fe({...e,event:o})},{id:i.tableCellMerge,label:Le,icon:v[i.tableCellMerge],onClick:()=>Oe(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Ee,icon:v[i.tableCellSplit],onClick:()=>Ze(e),disabled:!Ne(e)}]},...xe(e),...oe(e)],$e=e=>{const t=e[0]&&H(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=C(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})},We=function(e,t={}){const o={block:{},...t},{Components:l}=e,n={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(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,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:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Ve(x,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...q({editor:a,component:c,opts:o}),...r]}}}),l.addType(W,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(_,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(x,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{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:r,editor:a,component:c})=>[...Ue({editor:a,component:c,opts:o}),...r]}}});const s=re((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&$e(d)},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(p),Re.forEach(r=>l.removeType(r))}})},_e=me(We);module.exports=_e;
@@ -14,7 +14,7 @@ function re(e, t, o) {
14
14
  l && (a = e.apply(s, n), s = n = null, clearTimeout(l), l = null);
15
15
  }, d;
16
16
  }
17
- const O = "app.grapesjs.com", F = "app-stage.grapesjs.com", ie = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", T = [
17
+ const O = "app.grapesjs.com", F = "app-stage.grapesjs.com", ie = "app2.grapesjs.com", he = "app-stage2.grapesjs.com", S = [
18
18
  O,
19
19
  ie,
20
20
  F,
@@ -29,7 +29,7 @@ const O = "app.grapesjs.com", F = "app-stage.grapesjs.com", ie = "app2.grapesjs.
29
29
  // For Sandpack demos
30
30
  ], de = "license:check:start", ve = "license:check:end", ue = () => typeof window < "u", be = ({ isDev: e, isStage: t }) => `${e ? "" : `https://${t ? F : O}`}/api`, ge = () => {
31
31
  const e = ue() && window.location.hostname;
32
- return !!e && (T.includes(e) || T.some((t) => e.endsWith(t)));
32
+ return !!e && (S.includes(e) || S.some((t) => e.endsWith(t)));
33
33
  };
34
34
  function U(e) {
35
35
  return typeof e == "function";
@@ -55,7 +55,7 @@ async function pe({
55
55
  throw new Error(`HTTP error! status: ${u.status}`);
56
56
  return u.json();
57
57
  }
58
- var y = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(y || {}), $ = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.projectFiles = "studio:projectFiles", 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.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))($ || {});
58
+ var y = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(y || {}), $ = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", 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.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))($ || {});
59
59
  const L = {
60
60
  [y.free]: 0,
61
61
  [y.startup]: 10,
@@ -472,7 +472,7 @@ function ne(e) {
472
472
  }
473
473
  }
474
474
  }
475
- function Se(e) {
475
+ function Te(e) {
476
476
  const t = [];
477
477
  e.components().forEach((o) => {
478
478
  o.components().length || t.push(o);
@@ -496,7 +496,7 @@ const B = (e, t = {}) => {
496
496
  endPos: s
497
497
  };
498
498
  };
499
- function Te(e, t = {}) {
499
+ function Se(e, t = {}) {
500
500
  const o = B(e), { startPos: l, endPos: n } = o;
501
501
  let { grid: s } = o;
502
502
  const { em: r } = e;
@@ -514,12 +514,12 @@ function Te(e, t = {}) {
514
514
  for (let V = a; V <= h; V++) {
515
515
  const z = C(s, V, m);
516
516
  if (!z) continue;
517
- const { cell: S } = z;
518
- S !== P && w.push(S);
517
+ const { cell: T } = z;
518
+ T !== P && w.push(T);
519
519
  }
520
520
  w.forEach((m) => {
521
521
  t.mergeContent && P.append(m.components().models), m.remove();
522
- }), r.setSelected(P), Se(e);
522
+ }), r.setSelected(P), Te(e);
523
523
  }
524
524
  }
525
525
  const ae = "Cell settings", Le = "Merge cells", Ee = "Split cell", Ge = (e) => e.closestType(g), H = (e) => {
@@ -551,7 +551,7 @@ const ae = "Cell settings", Le = "Merge cells", Ee = "Split cell", Ge = (e) => e
551
551
  const { editor: t } = e;
552
552
  if (!ce(e)) return;
553
553
  const o = t.getSelectedAll(), l = H(o[0]);
554
- Te(l, { mergeContent: !0 });
554
+ Se(l, { mergeContent: !0 });
555
555
  }, Fe = (e) => {
556
556
  k(e, {
557
557
  id: "tableCellSettings",
@@ -1 +1 @@
1
- (function(V,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(V=typeof globalThis<"u"?globalThis:V||self,V.StudioSdkPlugins_tableComponent=w())})(this,function(){"use strict";function V(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}const w="app.grapesjs.com",L="app-stage.grapesjs.com",E=[w,"app2.grapesjs.com",L,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ie="license:check:start",he="license:check:end",de=()=>typeof window<"u",ve=({isDev:e,isStage:t})=>`${e?"":`https://${t?L:w}`}/api`,ue=()=>{const e=de()&&window.location.hostname;return!!e&&(E.includes(e)||E.some(t=>e.endsWith(t)))};function G(e){return typeof e=="function"}async function be({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:n,body:s}){const a=`${t||ve({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),N=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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))(N||{});const O={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function ge(e){const t=e;return t.init=o=>l=>e(l,o),t}const pe=e=>ge(e);async function fe({editor:e,plan:t,pluginName:o,licenseKey:l,cleanup:n}){let s="",r=!1;const a=ue(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,P=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(P){const A=O[t],I=O[P];A>I&&c({pluginRequiredPlan:t,licensePlan:P})}};e.on(ie,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(he,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await me({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("The `licenseKey` option not provided")}},2e3)}async function me(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(n){return console.error("Error during SDK license check:",n),!1}}const we="tableComponent",ye=y.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>'},p="table",Z="thead",F="tfoot",M="tbody",g="row",b="cell",k="clipboardTable",Ce=[p,Z,F,M,g,b],x=e=>e.em.get(k)||[],He=e=>e.every(t=>t.is(b)),D=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,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};G(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand(N.layoutToggle,d)},Re=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:G(l)?l({y:n,x:s}):l}:void 0}))}))}),_="Table settings",U=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},Pe=e=>{var t;(t=U(e))==null||t.remove(e.opts)},Ve=e=>{const t=U(e);t&&(e.editor.select(t),D(e,{id:"tableSettings",header:{label:_}}))},$=e=>[{id:i.table,icon:v[i.table],label:"Table",items:[{id:i.tableSettings,label:_,icon:v[i.tableSettings],onClick:({event:o})=>Ve({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:v[i.tableDelete],onClick:()=>Pe(e)}]}],W=({editor:e})=>{const t=x(e);return t.length&&He(t)},j=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},K=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},q=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(k,n)},X=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!W(e))return;const n=x(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},ze=e=>{const{component:t}=e;t.is(b)&&(q(e),K({...e,opts:{temporary:!0}}))},Ae=e=>{const t=W(e);return[{id:i.tableColumnItems,icon:v[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:v[i.tableColumnInsertBefore],onClick:()=>j(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>j({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:v[i.tableColumnDelete],onClick:()=>K(e)},{id:i.tableColumnCut,label:"Cut column",icon:v[i.tableColumnCut],onClick:()=>ze(e)},{id:i.tableColumnCopy,label:"Copy column",icon:v[i.tableColumnCopy],onClick:()=>q(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:v[i.tableColumnPasteBefore],disabled:!t,onClick:()=>X(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>X({...e,after:!0})}]}]},Y="Row settings",xe=e=>e.every(t=>t.is(g)),C=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},J=e=>{const{component:t,editor:o,after:l}=e,n=C(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},Q=e=>{var t;(t=C(e))==null||t.remove(e.opts)},ee=e=>{const t=C(e);t&&e.editor.em.set(k,[t])},te=e=>{var a;const{editor:t,after:o}=e,l=C(e);if(!l||!le(e))return;const s=x(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},Be=e=>{C(e)&&(ee(e),Q({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=x(e);return t.length&&xe(t)},Ie=e=>{const t=C(e);t&&(e.editor.select(t),D(e,{id:"tableRowSettings",header:{label:Y}}))},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:()=>J(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:v[i.tableRowInsertAfter],onClick:()=>J({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:v[i.tableRowDelete],onClick:()=>Q(e)},{id:i.tableRowProperties,label:Y,icon:v[i.tableRowProperties],onClick:({event:l})=>Ie({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:v[i.tableRowCut],onClick:()=>Be(e)},{id:i.tableRowCopy,label:"Copy row",icon:v[i.tableRowCopy],onClick:()=>ee(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:v[i.tableRowPasteBefore],disabled:!t,onClick:()=>te(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:v[i.tableRowPasteAfter],disabled:!t,onClick:()=>te({...e,after:!0})}]},...$(e)]},S=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((n,s)=>{const{rowspan:r,colspan:a}=S(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function H(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const T=e=>e.closestType(g);function Me(e,{x:t,y:o,rows:l,cols:n}){var a;let s=T(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=T(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=S(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();T(n).append({type:b},{at:c+1})}Me(e,{x:o,y:t,rows:s-1,cols:r})}}}}function ke(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function De(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=H(s,a,c),f=H(s,h,d);if(u&&f){ne(s),s=se(e);const P=[],z=H(s,a,c).cell;z.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let A=a;A<=h;A++){const I=H(s,A,m);if(!I)continue;const{cell:re}=I;re!==z&&P.push(re)}P.forEach(m=>{t.mergeContent&&z.append(m.components().models),m.remove()}),r.setSelected(z),ke(e)}}const ae="Cell settings",Se="Merge cells",Te="Split cell",Le=e=>e.closestType(g),R=e=>{var t;return(t=Le(e))==null?void 0:t.parent()},Ee=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=S(l);return!(s<2&&n<2)},Ge=e=>{const o=e.editor.getSelectedAll()[0],l=R(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||R(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=H(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Ne=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=R(o[0]);De(l,{mergeContent:!0})},Oe=e=>{D(e,{id:"tableCellSettings",header:{label:ae}})},Ze=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Oe({...e,event:o})},{id:i.tableCellMerge,label:Se,icon:v[i.tableCellMerge],onClick:()=>Ne(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Te,icon:v[i.tableCellSplit],onClick:()=>Ge(e),disabled:!Ee(e)}]},...Ae(e),...oe(e)],Fe=e=>{const t=e[0]&&R(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=H(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})};return pe(function(e,t={}){const o={block:{},...t},{Components:l}=e,n={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(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,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:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Re(M,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...$({editor:a,component:c,opts:o}),...r]}}}),l.addType(Z,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(F,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(M,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{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:r,editor:a,component:c})=>[...Ze({editor:a,component:c,opts:o}),...r]}}});const s=V((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&Fe(d)},0);e.on("component:select",s),fe({editor:e,plan:ye,pluginName:we,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",s),e.Blocks.remove(p),Ce.forEach(r=>l.removeType(r))}})})});
1
+ (function(V,w){typeof exports=="object"&&typeof module<"u"?module.exports=w():typeof define=="function"&&define.amd?define(w):(V=typeof globalThis<"u"?globalThis:V||self,V.StudioSdkPlugins_tableComponent=w())})(this,function(){"use strict";function V(e,t,o){let l,n,s,r,a;const c=t;function h(){const u=Date.now()-r;u<c&&u>=0?l=setTimeout(h,c-u):(l=null,a=e.apply(s,n),s=n=null)}const d=function(){return s=this,n=arguments,r=Date.now(),l||(l=setTimeout(h,c)),a};return d.clear=function(){l&&(clearTimeout(l),l=null)},d.flush=function(){l&&(a=e.apply(s,n),s=n=null,clearTimeout(l),l=null)},d}const w="app.grapesjs.com",L="app-stage.grapesjs.com",E=[w,"app2.grapesjs.com",L,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ie="license:check:start",he="license:check:end",de=()=>typeof window<"u",ve=({isDev:e,isStage:t})=>`${e?"":`https://${t?L:w}`}/api`,ue=()=>{const e=de()&&window.location.hostname;return!!e&&(E.includes(e)||E.some(t=>e.endsWith(t)))};function G(e){return typeof e=="function"}async function be({path:e,baseApiUrl:t,method:o="GET",headers:l={},params:n,body:s}){const a=`${t||ve({isDev:!1,isStage:!1})}${e}`,c={method:o,headers:{"Content-Type":"application/json",...l}};s&&(c.body=JSON.stringify(s));const h=n?new URLSearchParams(n).toString():"",d=h?`?${h}`:"",u=await fetch(`${a}${d}`,c);if(!u.ok)throw new Error(`HTTP error! status: ${u.status}`);return u.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{}),N=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.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))(N||{});const O={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function ge(e){const t=e;return t.init=o=>l=>e(l,o),t}const pe=e=>ge(e);async function fe({editor:e,plan:t,pluginName:o,licenseKey:l,cleanup:n}){let s="",r=!1;const a=ue(),c=d=>{console.warn("Cleanup plugin:",o,"Reason:",d),n()},h=(d={})=>{var m;const{error:u,sdkLicense:f}=d,P=(m=d.plan)==null?void 0:m.category;if(!(f||d.license)||u)c(u||"Invalid license");else if(P){const A=O[t],I=O[P];A>I&&c({pluginRequiredPlan:t,licensePlan:P})}};e.on(ie,d=>{s=d==null?void 0:d.baseApiUrl,r=!0}),e.on(he,d=>{h(d)}),setTimeout(async()=>{if(!r){if(a)return;if(l){const d=await me({licenseKey:l,pluginName:o,baseApiUrl:s});d&&h(d)}else c("The `licenseKey` option not provided")}},2e3)}async function me(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(n){return console.error("Error during SDK license check:",n),!1}}const we="tableComponent",ye=y.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>'},p="table",Z="thead",F="tfoot",M="tbody",g="row",b="cell",k="clipboardTable",Ce=[p,Z,F,M,g,b],x=e=>e.em.get(k)||[],He=e=>e.every(t=>t.is(b)),D=(e,t)=>{const{editor:o,event:l,opts:n}=e,s=l.currentTarget||l.target,{x:r,y:a,width:c,height:h}=s.getBoundingClientRect(),d={style:{width:240,height:300},placer:{type:"popover",closeOnClickAway:!0,x:r,y:a,w:c,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};G(n.openSettings)?n.openSettings({...e,layoutProps:d}):o.runCommand(N.layoutToggle,d)},Re=(e,{rows:t=1,cells:o=5,text:l}={})=>({type:e,components:Array.from(Array(t).keys()).map(n=>({type:g,components:Array.from(Array(o).keys()).map(s=>({type:b,components:l?{type:"text",content:G(l)?l({y:n,x:s}):l}:void 0}))}))}),_="Table settings",U=e=>{const{component:t}=e;return t.is(p)?t:t.closestType(p)},Pe=e=>{var t;(t=U(e))==null||t.remove(e.opts)},Ve=e=>{const t=U(e);t&&(e.editor.select(t),D(e,{id:"tableSettings",header:{label:_}}))},$=e=>[{id:i.table,icon:v[i.table],label:"Table",items:[{id:i.tableSettings,label:_,icon:v[i.tableSettings],onClick:({event:o})=>Ve({...e,event:o})},{id:i.tableDelete,label:"Delete table",icon:v[i.tableDelete],onClick:()=>Pe(e)}]}],W=({editor:e})=>{const t=x(e);return t.length&&He(t)},j=({component:e,editor:t,after:o})=>{if(!e.is(b))return;const l=e.closestType(p),n=e.closestType(g),s=e.index()+(o?1:0);l==null||l.findType(g).forEach(a=>a.append({type:b},{at:s}));const r=n==null?void 0:n.components().at(s);r&&t.select(r)},K=({component:e,opts:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index();o==null||o.findType(g).forEach(n=>{var s;return(s=n.components().at(l))==null?void 0:s.remove(t)})},q=({component:e,editor:t})=>{if(!e.is(b))return;const o=e.closestType(p),l=e.index(),n=(o==null?void 0:o.findType(g).map(s=>s.components().at(l)))||[];n.length&&t.em.set(k,n)},X=e=>{const{component:t,editor:o,after:l}=e;if(!t.is(b)||!W(e))return;const n=x(o),s=t.closestType(p),r=t.index()+(l?1:0);s==null||s.findType(g).forEach((a,c)=>{const h=n[c],d=(h==null?void 0:h.clone())||{type:b};a.append(d,{at:r})})},ze=e=>{const{component:t}=e;t.is(b)&&(q(e),K({...e,opts:{temporary:!0}}))},Ae=e=>{const t=W(e);return[{id:i.tableColumnItems,icon:v[i.tableColumn],label:"Column",items:[{id:i.tableColumnInsertBefore,label:"Insert column before",icon:v[i.tableColumnInsertBefore],onClick:()=>j(e)},{id:i.tableColumnInsertAfter,label:"Insert column after",icon:v[i.tableColumnInsertAfter],onClick:()=>j({...e,after:!0})},{id:i.tableColumnDelete,label:"Delete column",icon:v[i.tableColumnDelete],onClick:()=>K(e)},{id:i.tableColumnCut,label:"Cut column",icon:v[i.tableColumnCut],onClick:()=>ze(e)},{id:i.tableColumnCopy,label:"Copy column",icon:v[i.tableColumnCopy],onClick:()=>q(e)},{id:i.tableColumnPasteBefore,label:"Paste column before",icon:v[i.tableColumnPasteBefore],disabled:!t,onClick:()=>X(e)},{id:i.tableColumnPasteAfter,label:"Paste column after",icon:v[i.tableColumnPasteAfter],disabled:!t,onClick:()=>X({...e,after:!0})}]}]},Y="Row settings",xe=e=>e.every(t=>t.is(g)),C=e=>{const{component:t}=e,o=t.is(b),l=t.is(g);if(!(!o&&!l))return l?t:t.closestType(g)},J=e=>{const{component:t,editor:o,after:l}=e,n=C(e);if(!n)return;const s=n.index()+(l?1:0),r=n.components().length,a=Array.from(Array(r).keys()).map(()=>({type:b})),c=n.parent();if(c){const h=c.append({type:g,components:a},{at:s})[0];if(t.is(b)&&h){const d=t.index(),u=h.components().at(d);u&&o.select(u)}}},Q=e=>{var t;(t=C(e))==null||t.remove(e.opts)},ee=e=>{const t=C(e);t&&e.editor.em.set(k,[t])},te=e=>{var a;const{editor:t,after:o}=e,l=C(e);if(!l||!le(e))return;const s=x(t)[0],r=l.index()+(o?1:0);s&&((a=l.parent())==null||a.append(s.clone(),{at:r}))},Be=e=>{C(e)&&(ee(e),Q({...e,opts:{temporary:!0}}))},le=({editor:e})=>{const t=x(e);return t.length&&xe(t)},Ie=e=>{const t=C(e);t&&(e.editor.select(t),D(e,{id:"tableRowSettings",header:{label:Y}}))},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:()=>J(e)},{id:i.tableRowInsertAfter,label:"Insert row after",icon:v[i.tableRowInsertAfter],onClick:()=>J({...e,after:!0})},{id:i.tableRowDelete,label:"Delete row",icon:v[i.tableRowDelete],onClick:()=>Q(e)},{id:i.tableRowProperties,label:Y,icon:v[i.tableRowProperties],onClick:({event:l})=>Ie({...e,event:l})},{id:i.tableRowCut,label:"Cut row",icon:v[i.tableRowCut],onClick:()=>Be(e)},{id:i.tableRowCopy,label:"Copy row",icon:v[i.tableRowCopy],onClick:()=>ee(e)},{id:i.tableRowPasteBefore,label:"Paste row before",icon:v[i.tableRowPasteBefore],disabled:!t,onClick:()=>te(e)},{id:i.tableRowPasteAfter,label:"Paste row after",icon:v[i.tableRowPasteAfter],disabled:!t,onClick:()=>te({...e,after:!0})}]},...$(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 se(e){const t=[];return e.components().forEach((o,l)=>{o.components().each((n,s)=>{const{rowspan:r,colspan:a}=T(n);if(t[l])for(;t[l][s];)s++;for(let c=l;c<l+r;c++){t[c]||(t[c]=[]);for(let h=s;h<s+a;h++)t[c][h]={real:c===l&&h===s,cell:n,rowspan:r,colspan:a}}})}),t}function H(e,t,o){var l;return(l=e[o])==null?void 0:l[t]}const S=e=>e.closestType(g);function Me(e,{x:t,y:o,rows:l,cols:n}){var a;let s=S(e[o][t].cell),r;for(let c=1;c<=l;c++)if(s=(a=s==null?void 0:s.parent())==null?void 0:a.components().at(s.index()+1),s){for(r=t;r>=0;r--){const{cell:h}=e[o+c][r],d=S(h);if(d===s){for(let u=1;u<=n;u++){const f=h.index();d.append({type:b},{at:f+1})}break}}if(r===-1){const d=s.components().at(0).index();for(let u=1;u<=n;u++)s.append({type:b},{at:d})}}}function ne(e){for(let t=0;t<e.length;t++)for(let o=0;o<e[t].length;o++){const n=e[t][o].cell;if(n.em.selected.hasComponent(n)){const{rowspan:s,colspan:r}=T(n);if(r>1||s>1){n.addAttributes({colspan:1,rowspan:1});for(let a=0;a<r-1;a++){const c=n.index();S(n).append({type:b},{at:c+1})}Me(e,{x:o,y:t,rows:s-1,cols:r})}}}}function ke(e){const t=[];e.components().forEach(o=>{o.components().length||t.push(o)}),t.forEach(o=>o.remove())}const B=(e,t={})=>{var r;const o=se(e),{em:l}=e;let n,s;for(let a=0;a<o.length;a++)for(let c=0;c<o[a].length;c++){const h=o[a][c];if((r=t.selected)!=null&&r.includes(h.cell)||l.selected.hasComponent(h.cell)){const d={x:c,y:a};n||(n=d),s=d}}return{grid:o,startPos:n,endPos:s}};function De(e,t={}){const o=B(e),{startPos:l,endPos:n}=o;let{grid:s}=o;const{em:r}=e;if(!l||!n)return;const a=l.x,c=l.y,h=n.x,d=n.y,u=H(s,a,c),f=H(s,h,d);if(u&&f){ne(s),s=se(e);const P=[],z=H(s,a,c).cell;z.addAttributes({colspan:h-a+1,rowspan:d-c+1});for(let m=c;m<=d;m++)for(let A=a;A<=h;A++){const I=H(s,A,m);if(!I)continue;const{cell:re}=I;re!==z&&P.push(re)}P.forEach(m=>{t.mergeContent&&z.append(m.components().models),m.remove()}),r.setSelected(z),ke(e)}}const ae="Cell settings",Te="Merge cells",Se="Split cell",Le=e=>e.closestType(g),R=e=>{var t;return(t=Le(e))==null?void 0:t.parent()},Ee=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]),l=t[0];if(!o||!(l!=null&&l.is(b))||t.length>1)return!1;const{rowspan:n,colspan:s}=T(l);return!(s<2&&n<2)},Ge=e=>{const o=e.editor.getSelectedAll()[0],l=R(o),{grid:n}=B(l);ne(n)},ce=e=>{const t=e.editor.getSelectedAll(),o=R(t[0]);if(!o||t.length<2||t.some(a=>!a.is(b)||R(a)!==o))return!1;const{grid:l,startPos:n,endPos:s}=B(o),{em:r}=o;if(!n||!s)return!1;for(let a=n.y;a<=s.y;a++)for(let c=n.x;c<=s.x;c++){const h=H(l,c,a);if(!h||!r.selected.hasComponent(h.cell))return!1}return!0},Ne=e=>{const{editor:t}=e;if(!ce(e))return;const o=t.getSelectedAll(),l=R(o[0]);De(l,{mergeContent:!0})},Oe=e=>{D(e,{id:"tableCellSettings",header:{label:ae}})},Ze=e=>[{id:i.tableCellItems,icon:v[i.tableCellProperties],label:"Cell",items:[{id:i.tableCellProperties,label:ae,icon:v[i.tableCellProperties],onClick:({event:o})=>Oe({...e,event:o})},{id:i.tableCellMerge,label:Te,icon:v[i.tableCellMerge],onClick:()=>Ne(e),disabled:!ce(e)},{id:i.tableCellSplit,label:Se,icon:v[i.tableCellSplit],onClick:()=>Ge(e),disabled:!Ee(e)}]},...Ae(e),...oe(e)],Fe=e=>{const t=e[0]&&R(e[0]);if(!t)return;const{grid:o,startPos:l,endPos:n}=B(t,{selected:e});if(!l||!n)return;const s=[];for(let r=l.y;r<=n.y;r++)for(let a=l.x;a<=n.x;a++){const c=H(o,a,r);c&&s.push(c.cell)}s.length&&t.em.setSelected(s,{fromCell:!0})};return pe(function(e,t={}){const o={block:{},...t},{Components:l}=e,n={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(p,{block:o.block&&{label:"Table",media:v.table,category:"Extra",content:{type:p,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:r,value:a,emitUpdate:c}){const h=r.find("caption")[0];a?!h&&r.append({type:"text",tagName:"caption",components:{type:"textnode",content:"Caption"}}):h==null||h.remove(),c(),e.refresh({tools:!0})},getValue(r){return!!r.component.find("caption")[0]}}],components:Re(M,{rows:5}),contextMenu:({items:r,editor:a,component:c})=>[...$({editor:a,component:c,opts:o}),...r]}}}),l.addType(Z,{model:{defaults:{icon:v.tableHead,...n}}}),l.addType(F,{model:{defaults:{icon:v.tableFoot,...n}}}),l.addType(M,{model:{defaults:{icon:v.tableRowProperties,...n}}}),l.addType(g,{model:{defaults:{icon:v.tableRowProperties,emptyState:!0,highlightable:!1,stylable:["height","text-align","border-width","border-style","border-color"],traits:[],contextMenu:({items:r,editor:a,component:c})=>[...oe({editor:a,component:c,opts:o}),...r]}}}),l.addType(b,{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:r,editor:a,component:c})=>[...Ze({editor:a,component:c,opts:o}),...r]}}});const s=V((r,a)=>{var u;const c=e.getSelectedAll(),h=!!((u=a==null?void 0:a.event)!=null&&u.shiftKey);if(c.length<2||!h||a.fromCell)return;const d=c.map(f=>f.is(b)?f:f.closestType(b)).filter(Boolean);d.length===c.length&&Fe(d)},0);e.on("component:select",s),fe({editor:e,plan:ye,pluginName:we,licenseKey:o.licenseKey,cleanup:()=>{e.off("component:select",s),e.Blocks.remove(p),Ce.forEach(r=>l.removeType(r))}})})});
@@ -1 +1 @@
1
- "use strict";var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{}),h=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.projectFiles="studio:projectFiles",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.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))(h||{});const P="app.grapesjs.com",A="app-stage.grapesjs.com",I="app2.grapesjs.com",k="app-stage2.grapesjs.com",f=[P,I,A,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],U="license:check:start",D="license:check:end",x=()=>typeof window<"u",G=({isDev:e,isStage:o})=>`${e?"":`https://${o?A:P}`}/api`,O=()=>{const e=x()&&window.location.hostname;return!!e&&(f.includes(e)||f.some(o=>e.endsWith(o)))};async function M({path:e,baseApiUrl:o,method:a="GET",headers:n={},params:l,body:u}){const t=`${o||G({isDev:!1,isStage:!1})}${e}`,i={method:a,headers:{"Content-Type":"application/json",...n}};u&&(i.body=JSON.stringify(u));const c=l?new URLSearchParams(l).toString():"",s=c?`?${c}`:"",r=await fetch(`${t}${s}`,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const v={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function $(e){const o=e;return o.init=a=>n=>e(n,a),o}const E=e=>$(e);async function j({editor:e,plan:o,pluginName:a,licenseKey:n,cleanup:l}){let u="",p=!1;const t=O(),i=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),l()},c=(s={})=>{var b;const{error:r,sdkLicense:y}=s,d=(b=s.plan)==null?void 0:b.category;if(!(y||s.license)||r)i(r||"Invalid license");else if(d){const L=v[o],R=v[d];L>R&&i({pluginRequiredPlan:o,licensePlan:d})}};e.on(U,s=>{u=s==null?void 0:s.baseApiUrl,p=!0}),e.on(D,s=>{c(s)}),setTimeout(async()=>{if(!p){if(t)return;if(n){const s=await B({licenseKey:n,pluginName:a,baseApiUrl:u});s&&c(s)}else i("The `licenseKey` option not provided")}},2e3)}async function B(e){const{licenseKey:o,pluginName:a,baseApiUrl:n}=e;try{return(await M({baseApiUrl:n,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const N=e=>{const o={};for(const a of Object.keys(e)){let n=e[a];n&&(Array.isArray(n)?n=n.map(l=>l.toString()).join(","):n=n.toString(),o[a]=n)}return new URLSearchParams(o)},T="youtube-video",W=e=>{const{apiKey:o,searchParams:a,thumbnailQuality:n="high"}=e,l=(t={})=>{const c="https://www.googleapis.com/youtube/v3/search",s=N(t);return`${c}?${s}`},u=t=>{var i,c,s;return((i=t[n])==null?void 0:i.url)||((c=t.high)==null?void 0:c.url)||((s=t.medium)==null?void 0:s.url)||t.default.url},p=t=>{const i=u(t.snippet.thumbnails);return{id:t.id.videoId,src:`https://www.youtube.com/watch?v=${t.id.videoId}`,name:t.snippet.title,type:T,customData:{thumbnailUrl:i,videoItem:t}}};return{id:"youtube",types:[T],label:({editor:t})=>t.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:t,pageCustomData:i}){var b;const c={maxResults:25,q:t,pageToken:i==null?void 0:i.token,type:["video"],key:o},s=a==null?void 0:a({searchValue:t}),r={...c,...s};r.part?r.part.includes("snippet")||r.part.push("snippet"):r.part=["snippet"];const d=await(await fetch(l(r))).json();return(b=d.items)!=null&&b.length?{items:d.items.map(p),nextPageCustomData:{token:d.nextPageToken},isLastPage:!d.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:t,onSelect:i})=>({type:"column",onClick:()=>i(t),htmlAttrs:{title:t.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=t.customData)==null?void 0:c.thumbnailUrl}" alt="${t.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:t.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},Y={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},_="youtubeAssetProvider",K=g.startup,F=function(e,o){var c;const{skipVideoComponent:a,i18n:n={}}=o,l=W(o);e.runCommand(h.assetProviderAdd,{provider:l});const u="search-on-youtube",p="video",t=(c=e.Components.getType(p))==null?void 0:c.model.prototype,i=s=>{e.Assets.open({modalTitle:e.I18n.t("youtubeAssetProvider.modalTitle"),providerId:l.id,typeId:l.types[0],providers:[],types:[],select:r=>{e.Assets.close(),s.set({videoId:r.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!a&&t&&e.Components.addType(p,{model:{getYoutubeTraits(){const[s,...r]=t.getYoutubeTraits.apply(this);return[s,{id:u,type:"button",label:e.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>i(this)},...r]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:s}=this,r=s.get("provider")||"";r!=null&&r.startsWith("yt")&&i(s)}}}),e.I18n.addMessages({en:Y,...n}),j({editor:e,licenseKey:o.licenseKey,plan:K,pluginName:_,cleanup:()=>{e.runCommand(h.assetProviderRemove,{id:l.id}),!a&&t&&e.Components.addType(p,{model:{getYoutubeTraits(){return t.getYoutubeTraits.apply(this).filter(s=>s.id!==u)}}})}})},q=E(F);module.exports=q;
1
+ "use strict";var g=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(g||{}),h=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",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.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))(h||{});const T="app.grapesjs.com",A="app-stage.grapesjs.com",I="app2.grapesjs.com",k="app-stage2.grapesjs.com",f=[T,I,A,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],U="license:check:start",D="license:check:end",x=()=>typeof window<"u",G=({isDev:e,isStage:o})=>`${e?"":`https://${o?A:T}`}/api`,O=()=>{const e=x()&&window.location.hostname;return!!e&&(f.includes(e)||f.some(o=>e.endsWith(o)))};async function M({path:e,baseApiUrl:o,method:a="GET",headers:n={},params:l,body:u}){const t=`${o||G({isDev:!1,isStage:!1})}${e}`,i={method:a,headers:{"Content-Type":"application/json",...n}};u&&(i.body=JSON.stringify(u));const c=l?new URLSearchParams(l).toString():"",s=c?`?${c}`:"",r=await fetch(`${t}${s}`,i);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const v={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function $(e){const o=e;return o.init=a=>n=>e(n,a),o}const E=e=>$(e);async function j({editor:e,plan:o,pluginName:a,licenseKey:n,cleanup:l}){let u="",p=!1;const t=O(),i=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),l()},c=(s={})=>{var b;const{error:r,sdkLicense:y}=s,d=(b=s.plan)==null?void 0:b.category;if(!(y||s.license)||r)i(r||"Invalid license");else if(d){const L=v[o],R=v[d];L>R&&i({pluginRequiredPlan:o,licensePlan:d})}};e.on(U,s=>{u=s==null?void 0:s.baseApiUrl,p=!0}),e.on(D,s=>{c(s)}),setTimeout(async()=>{if(!p){if(t)return;if(n){const s=await B({licenseKey:n,pluginName:a,baseApiUrl:u});s&&c(s)}else i("The `licenseKey` option not provided")}},2e3)}async function B(e){const{licenseKey:o,pluginName:a,baseApiUrl:n}=e;try{return(await M({baseApiUrl:n,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(l){return console.error("Error during SDK license check:",l),!1}}const N=e=>{const o={};for(const a of Object.keys(e)){let n=e[a];n&&(Array.isArray(n)?n=n.map(l=>l.toString()).join(","):n=n.toString(),o[a]=n)}return new URLSearchParams(o)},P="youtube-video",W=e=>{const{apiKey:o,searchParams:a,thumbnailQuality:n="high"}=e,l=(t={})=>{const c="https://www.googleapis.com/youtube/v3/search",s=N(t);return`${c}?${s}`},u=t=>{var i,c,s;return((i=t[n])==null?void 0:i.url)||((c=t.high)==null?void 0:c.url)||((s=t.medium)==null?void 0:s.url)||t.default.url},p=t=>{const i=u(t.snippet.thumbnails);return{id:t.id.videoId,src:`https://www.youtube.com/watch?v=${t.id.videoId}`,name:t.snippet.title,type:P,customData:{thumbnailUrl:i,videoItem:t}}};return{id:"youtube",types:[P],label:({editor:t})=>t.I18n.t("youtubeAssetProvider.providerLabel"),search:{reloadOnInput:!0,debounceMs:1e3},async onLoad({searchValue:t,pageCustomData:i}){var b;const c={maxResults:25,q:t,pageToken:i==null?void 0:i.token,type:["video"],key:o},s=a==null?void 0:a({searchValue:t}),r={...c,...s};r.part?r.part.includes("snippet")||r.part.push("snippet"):r.part=["snippet"];const d=await(await fetch(l(r))).json();return(b=d.items)!=null&&b.length?{items:d.items.map(p),nextPageCustomData:{token:d.nextPageToken},isLastPage:!d.nextPageToken}:{items:[],isLastPage:!0}},itemLayout:({assetProps:t,onSelect:i})=>({type:"column",onClick:()=>i(t),htmlAttrs:{title:t.name},style:{borderWidth:"1px",borderRadius:8,overflow:"hidden",cursor:"pointer"},children:[{type:"custom",render:()=>{var c;return`<img src="${(c=t.customData)==null?void 0:c.thumbnailUrl}" alt="${t.name}" style="width: 100%; height: 100px; object-fit: cover">`}},{type:"text",content:t.name,style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,paddingRight:8}}]})}},Y={youtubeAssetProvider:{searchBtn:"Search on YouTube",modalTitle:"Select YouTube Video",providerLabel:"YouTube Videos"}},_="youtubeAssetProvider",K=g.startup,F=function(e,o){var c;const{skipVideoComponent:a,i18n:n={}}=o,l=W(o);e.runCommand(h.assetProviderAdd,{provider:l});const u="search-on-youtube",p="video",t=(c=e.Components.getType(p))==null?void 0:c.model.prototype,i=s=>{e.Assets.open({modalTitle:e.I18n.t("youtubeAssetProvider.modalTitle"),providerId:l.id,typeId:l.types[0],providers:[],types:[],select:r=>{e.Assets.close(),s.set({videoId:r.attributes.id})},content:{header:{addUrl:!1,upload:!1}}})};!a&&t&&e.Components.addType(p,{model:{getYoutubeTraits(){const[s,...r]=t.getYoutubeTraits.apply(this);return[s,{id:u,type:"button",label:e.I18n.t("youtubeAssetProvider.searchBtn"),command:()=>i(this)},...r]}},view:{events:()=>({dblclick:"onActive"}),onActive(){const{model:s}=this,r=s.get("provider")||"";r!=null&&r.startsWith("yt")&&i(s)}}}),e.I18n.addMessages({en:Y,...n}),j({editor:e,licenseKey:o.licenseKey,plan:K,pluginName:_,cleanup:()=>{e.runCommand(h.assetProviderRemove,{id:l.id}),!a&&t&&e.Components.addType(p,{model:{getYoutubeTraits(){return t.getYoutubeTraits.apply(this).filter(s=>s.id!==u)}}})}})},q=E(F);module.exports=q;