@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1 +1 @@
1
- (function(P,k){typeof exports=="object"&&typeof module<"u"?module.exports=k():typeof define=="function"&&define.amd?define(k):(P=typeof globalThis<"u"?globalThis:P||self,P.StudioSdkPlugins_lightGalleryComponent=k())})(this,function(){"use strict";const P="app.grapesjs.com",k="app-stage.grapesjs.com",X=[P,"app2.grapesjs.com",k,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],pe="license:check:start",ue="license:check:end",he=()=>typeof window<"u",ge=({isDev:e,isStage:n,isPlatform:t})=>`${e?"":`https://${n?k:P}`}/${t?"platform-api":"api"}`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(X.includes(e)||X.some(n=>e.endsWith(n)))};async function de({path:e,baseApiUrl:n,method:t="GET",headers:l={},params:o,body:u}){const p=`${n||ge({isDev:!1,isStage:!1})}${e}`,h={method:t,headers:{"Content-Type":"application/json",...l}};u&&(h.body=JSON.stringify(u));const c=o?new URLSearchParams(o).toString():"",b=c?`?${c}`:"",s=await fetch(`${p}${b}`,h);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{});const Y={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function me(e){const n=e;return n.init=t=>l=>e(l,t),n}const ye=e=>me(e);async function fe({editor:e,plan:n,pluginName:t,licenseKey:l,onLicenseCheckResponse:o,cleanup:u}){let r="",p=!1;const h=be(),c=s=>{console.warn("Cleanup plugin:",t,"Reason:",s),u()},b=(s={})=>{var V;const{error:O,sdkLicense:C}=s,S=(V=s.plan)==null?void 0:V.category;if(!(C||s.license)||O)c(O||"Invalid license");else if(S){const M=Y[n],H=Y[S];M>H&&c({pluginRequiredPlan:n,licensePlan:S})}};e.on(pe,s=>{r=s==null?void 0:s.baseApiUrl,p=!0}),e.on(ue,s=>{o==null||o(s),b(s)}),setTimeout(async()=>{if(!p){if(h)return;if(l){const s=await ve({licenseKey:l,pluginName:t,baseApiUrl:r});o==null||o(s),s&&b(s)}else c("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:n,pluginName:t,baseApiUrl:l}=e;try{return(await de({baseApiUrl:l,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const W=(e,n)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,n))},Te="lightGalleryComponent",we=L.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",ee=`${T}-item`,$="data-lightgallery",te=`${$}-item`,N="toggle",w={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},Z={propKeys:[],props:{},traits:[]},_=(e,n={})=>{var o;const t={},l=[];for(const u in e){const{value:r,...p}=e[u];l.push({id:u,name:u,changeProp:!0,category:n.category,...p}),t[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(o=h[c])==null||o.forEach(b=>{const s=b.id||b.name;t[s]=b.value})}return{propKeys:Object.keys(t),props:t,traits:l}},F=(e,n)=>{const t=e.getTrait(n),l=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=o[t.getValue()],h=e.getTraitIndex(n)+1;p&&e.addTrait(p.map(c=>({category:l,...c})),{at:h})},q=(e,n)=>{n.forEach(t=>{const l=e.getTrait(t);if(!l||!l.get("subTraits"))return;const o=l.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(o,()=>F(e,t)),F(e,t)})},Se=(e,n,t)=>{const o=e.getTrait(n).get("subTraits")||{},r=(Object.values(o).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),t)},xe={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var t,l;return(l=(t=n.target)==null?void 0:t.getView())==null?void 0:l.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ae={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Pe={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},m="sourceType",j="data-iframe",R={name:"href",type:"file",label:"Image Source"},K={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},J={name:"data-poster",label:"Video Poster",type:"file"},ae={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},le={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},ke={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var o,u;const t=n.target,l=(o=t==null?void 0:t.closestType(T))==null?void 0:o.getView();if(l&&t){const r=((u=l.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(t.getEl());p>=0&&l.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[K,J],external:[ae]},options:[{id:"image",label:R.label||"",icon:w.image},{id:"video",label:K.label||"",icon:w.video},{id:"external",label:ae.label||"",icon:w.external}]},subHtml:le},ne="lgThumbnail",Le="lgVideo",oe="lgAutoplay",ie="lgZoom",G="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,n={}){const{Blocks:t,Components:l}=e,o="LightGallery",u="LightGallery Item",r={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Le,oe,ie],cdnScript:[`${G}/lightgallery.min.js`,`${G}/plugins/thumbnail/lg-thumbnail.min.js`,`${G}/plugins/video/lg-video.min.js`,`${G}/plugins/autoplay/lg-autoplay.min.js`,`${G}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${G}/css/lightgallery-bundle.min.css`,...n},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,b=function(a){const i=this,g=window,{plugins:y,cdnScript:x,cdnStyle:D,inline:se,lgLicenseKey:Ee,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var z;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(y||[]).map(B=>g[B])};se&&(d.container=i,d.closable=!1);const Q=(z=g.lightGallery)==null?void 0:z.call(g,i,d);se&&Q.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,Q=Array.isArray(x)?[...x]:[x],z=Array.isArray(D)?[...D]:[D],B=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),B(I)}},ce=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ce.bind(null,I),d.appendChild(v)}else re()};B(z),ce(Q)}},s=a=>{const i=a.getTrait(N);if(!h||!i)return;const{toolbar:g}=a,y={id:N,label:h,command:()=>setTimeout(()=>i.runCommand(),100)};!g.find(D=>D.id===y.id)&&(g==null||g.unshift(y))};let O=[];const C=r.plugins||[],S=_(xe),U=C.includes(ne)?_(Ae):Z,V=C.includes(oe)?_(Ie):Z,M=C.includes(ie)?_(Pe):Z;l.addType(T,{block:p&&{label:o,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:a=>W(a,$),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:w.gallery,draggable:(a,i)=>!i.is(T),attributes:{[$]:!0},components:{type:ee},script:b,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...S.propKeys,...U.propKeys,...V.propKeys,...M.propKeys],...S.props,...U.props,...V.props,...M.props,traits:[...S.traits,...U.traits,...V.traits,...M.traits]},init(){q(this,["thumbnail"]),q(this,["autoplay"]),q(this,["zoom"])},initToolbar(){s(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,l.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const a=this.getLightGallery();a==null||a.destroy()},disableLgInCanvas(){const a=this.getLightGallery();a.lgOpened=!0},isInlineGallery(){var i;const a=this.getLightGallery();return((i=a==null?void 0:a.settings)==null?void 0:i.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:i}=a,g=this.getLightGallery();O=i.getSpots(),setTimeout(()=>i.removeSpots()),g.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(i=>this.em.Canvas.addSpot(i.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const i=this.getLightGallery();if(i.__lgOpened)return i.closeGallery(!0);i.lgOpened=!1,i.openGallery(a)}}});const H=_(ke);l.addType(ee,{isComponent:a=>W(a,te)||a.tagName==="A"&&W(a.parentElement,$),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[te]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...H.props,traits:[...H.traits]},init(){const a=[m].map(i=>`change:${i}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Se(this,m,this.triggerGalleryUpdate)},initToolbar(){s(this)},initScriptUpdate(){const a=[le.name].map(i=>`change:attributes:${i}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var i;(i=this.closestType(T))==null||i.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:i}=this,{init:g}=a;if(i[m]||g){F(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([K.name,J.name,j]);const x=this.getTrait(R.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([j]):y===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[j]?this.set(m,E.external):(a[K.name]||a[J.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:we,licenseKey:r.licenseKey,pluginName:Te,cleanup:()=>{t.remove(T),l.removeType(T)}})})});
1
+ (function(L,G){typeof exports=="object"&&typeof module<"u"?module.exports=G():typeof define=="function"&&define.amd?define(G):(L=typeof globalThis<"u"?globalThis:L||self,L.StudioSdkPlugins_lightGalleryComponent=G())})(this,function(){"use strict";const L="app.grapesjs.com",G="app-stage.grapesjs.com",Y=[L,"app2.grapesjs.com",G,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ue="license:check:end",ge=()=>typeof window<"u",he=({isDev:e,isStage:l,isPlatform:t})=>`${e?"":`https://${l?G:L}`}/${t?"platform-api":"api"}`,be=()=>{const e=ge()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};async function de({path:e,baseApiUrl:l,method:t="GET",headers:o={},params:i,body:g}){const n=`${l||he({isDev:!1,isStage:!1})}${e}`,u={method:t,headers:{"Content-Type":"application/json",...o}};g&&(u.body=JSON.stringify(g));const p=i?new URLSearchParams(i).toString():"",b=p?`?${p}`:"",r=await fetch(`${n}${b}`,u);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var k=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(k||{}),F=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(F||{});const ee={[k.free]:0,[k.startup]:10,[k.business]:20,[k.enterprise]:30};function ye(e){const l=e;return l.init=t=>o=>e(o,t),l}const me=e=>ye(e);async function fe({editor:e,plan:l,pluginName:t,licenseKey:o,onLicenseCheckResponse:i,cleanup:g}){let c="",n;const u=r=>{console.warn("Cleanup plugin:",t,"Reason:",r),g()},p=(r={})=>{var M;const{error:O,sdkLicense:V}=r,x=(M=r.plan)==null?void 0:M.category;if(!(V||r.license)||O)u(O||"Invalid license");else if(x){const R=ee[l],K=ee[x];R>K&&u({pluginRequiredPlan:l,licensePlan:x})}};e.Commands.has(F.settings)&&(n=e.runCommand(F.settings),c=(n==null?void 0:n.baseUrl)||"");const b=r=>{i==null||i(r),r&&p(r)};if(!n){e.onReady(async()=>{if(!be())if(o){const r=await Te({licenseKey:o,pluginName:t,baseApiUrl:c});b(r)}else u("The `licenseKey` option not provided")});return}if(n.licensePlan||n.licenseError){const r=ve(n);b(r);return}e.on(ue,r=>b(r))}const ve=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Te(e){const{licenseKey:l,pluginName:t,baseApiUrl:o}=e;try{return(await de({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const W=(e,l)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,l))},we="lightGalleryComponent",xe=k.startup;var S=(e=>(e.image="image",e.video="video",e.external="external",e))(S||{});const T="lightGallery",te=`${T}-item`,B="data-lightgallery",ae=`${B}-item`,$="toggle",w={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',gallery:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},Z={propKeys:[],props:{},traits:[]},D=(e,l={})=>{var i;const t={},o=[];for(const g in e){const{value:c,...n}=e[g];o.push({id:g,name:g,changeProp:!0,category:l.category,...n}),t[g]=c;const{subTraits:u={}}=n;for(const p in n.subTraits)(i=u[p])==null||i.forEach(b=>{const r=b.id||b.name;t[r]=b.value})}return{propKeys:Object.keys(t),props:t,traits:o}},q=(e,l)=>{const t=e.getTrait(l),o=t.get("category"),i=t.get("subTraits")||{},c=(Object.values(i).flat()||[]).map(p=>p.id||p.name);e.removeTrait(c);const n=i[t.getValue()],u=e.getTraitIndex(l)+1;n&&e.addTrait(n.map(p=>({category:o,...p})),{at:u})},C=(e,l)=>{l.forEach(t=>{const o=e.getTrait(t);if(!o||!o.get("subTraits"))return;const i=o.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(i,()=>q(e,t)),q(e,t)})},Pe=(e,l,t)=>{const i=e.getTrait(l).get("subTraits")||{},c=(Object.values(i).flat()||[]).map(u=>{const p=u.name||u.id;return u.changeProp?`change:${p}`:`change:attributes:${p}`}),n=Array.from(new Set(c));n.length&&e.on(n.join(" "),t)},Ae={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var t,o;return(o=(t=l.target)==null?void 0:t.getView())==null?void 0:o.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ie={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Le={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Ge={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},y="sourceType",N="data-iframe",J={name:"href",type:"file",label:"Image Source"},j={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},Q={name:"data-poster",label:"Video Poster",type:"file"},oe={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},le={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},ke={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var i,g;const t=l.target,o=(i=t==null?void 0:t.closestType(T))==null?void 0:i.getView();if(o&&t){const c=((g=o.getLightGallery())==null?void 0:g.items)||[],n=Array.from(c).indexOf(t.getEl());n>=0&&o.toggleGallery(n)}}},[y]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[J],video:[j,Q],external:[oe]},options:[{id:"image",label:J.label||"",icon:w.image},{id:"video",label:j.label||"",icon:w.video},{id:"external",label:oe.label||"",icon:w.external}]},subHtml:le},se="lgThumbnail",Se="lgVideo",ie="lgAutoplay",ne="lgZoom",E="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return me(function(e,l={}){const{Blocks:t,Components:o}=e,i="LightGallery",g="LightGallery Item",c={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[se,Se,ie,ne],cdnScript:[`${E}/lightgallery.min.js`,`${E}/plugins/thumbnail/lg-thumbnail.min.js`,`${E}/plugins/video/lg-video.min.js`,`${E}/plugins/autoplay/lg-autoplay.min.js`,`${E}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${E}/css/lightgallery-bundle.min.css`,...l},{block:n,toolbarIconOpen:u,defaultSrc:p}=c,b=function(a){const s=this,h=window,{plugins:m,cdnScript:P,cdnStyle:_,inline:re,lgLicenseKey:Ee,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),ce=()=>{var H;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(m||[]).map(z=>h[z])};re&&(d.container=s,d.closable=!1);const X=(H=h.lightGallery)==null?void 0:H.call(h,s,d);re&&X.openGallery()};if(h.lightGallery)ce();else{const{head:d}=document,X=Array.isArray(P)?[...P]:[P],H=Array.isArray(_)?[..._]:[_],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(I)}},pe=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=pe.bind(null,I),d.appendChild(v)}else ce()};z(H),pe(X)}},r=a=>{const s=a.getTrait($);if(!u||!s)return;const{toolbar:h}=a,m={id:$,label:u,command:()=>setTimeout(()=>s.runCommand(),100)};!h.find(_=>_.id===m.id)&&(h==null||h.unshift(m))};let O=[];const V=c.plugins||[],x=D(Ae),U=V.includes(se)?D(Ie):Z,M=V.includes(ie)?D(Le):Z,R=V.includes(ne)?D(Ge):Z;o.addType(T,{block:n&&{label:i,media:w.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>W(a,B),extendFn:["init","initToolbar"],model:{defaults:{name:i,icon:w.gallery,draggable:(a,s)=>!s.is(T),attributes:{[B]:!0},components:{type:te},script:b,selector:"",exThumbImage:"",cdnScript:c.cdnScript,cdnStyle:c.cdnStyle,plugins:c.plugins,lgLicenseKey:c.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...x.propKeys,...U.propKeys,...M.propKeys,...R.propKeys],...x.props,...U.props,...M.props,...R.props,traits:[...x.traits,...U.traits,...M.traits,...R.traits]},init(){C(this,["thumbnail"]),C(this,["autoplay"]),C(this,["zoom"])},initToolbar(){r(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,o.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const a=this.getLightGallery();a==null||a.destroy()},disableLgInCanvas(){const a=this.getLightGallery();a.lgOpened=!0},isInlineGallery(){var s;const a=this.getLightGallery();return((s=a==null?void 0:a.settings)==null?void 0:s.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:s}=a,h=this.getLightGallery();O=s.getSpots(),setTimeout(()=>s.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(s=>this.em.Canvas.addSpot(s.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const s=this.getLightGallery();if(s.__lgOpened)return s.closeGallery(!0);s.lgOpened=!1,s.openGallery(a)}}});const K=D(ke);o.addType(te,{isComponent:a=>W(a,ae)||a.tagName==="A"&&W(a.parentElement,B),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:g,icon:w.galleryItem,attributes:{[ae]:!0,href:p},components:{type:"image",attributes:{alt:"Image",src:p}},...K.props,traits:[...K.traits]},init(){const a=[y].map(s=>`change:${s}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Pe(this,y,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[le.name].map(s=>`change:attributes:${s}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var s;(s=this.closestType(T))==null||s.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:s}=this,{init:h}=a;if(s[y]||h){q(this,y);const m=this.getTrait(y).getValue();if(m===S.image){this.removeAttributes([j.name,Q.name,N]);const P=this.getTrait(J.name);P.setValue(P.getValue()||p)}else m===S.video?this.removeAttributes([N]):m===S.external&&this.addAttributes({[N]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[N]?this.set(y,S.external):(a[j.name]||a[Q.name])&&this.set(y,S.video)}}}),fe({editor:e,plan:xe,licenseKey:c.licenseKey,pluginName:we,cleanup:()=>{t.remove(T),o.removeType(T)}})})});
@@ -1,4 +1,4 @@
1
- "use strict";const A="app.grapesjs.com",v="app-stage.grapesjs.com",N="app2.grapesjs.com",D="app-stage2.grapesjs.com",y=[A,N,v,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],k="license:check:start",E="license:check:end",$=()=>typeof window<"u",U=({isDev:t,isStage:a,isPlatform:i})=>`${t?"":`https://${a?v:A}`}/${i?"platform-api":"api"}`,P=()=>{const t=$()&&window.location.hostname;return!!t&&(y.includes(t)||y.some(a=>t.endsWith(a)))};async function _({path:t,baseApiUrl:a,method:i="GET",headers:o={},params:s,body:l}){const m=`${a||U({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...o}};l&&(u.body=JSON.stringify(l));const c=s?new URLSearchParams(s).toString():"",d=c?`?${c}`:"",n=await fetch(`${m}${d}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var g=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(g||{});const T={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function x(t){const a=t;return a.init=i=>o=>t(o,i),a}const S=t=>x(t);async function O({editor:t,plan:a,pluginName:i,licenseKey:o,onLicenseCheckResponse:s,cleanup:l}){let p="",m=!1;const u=P(),c=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),l()},d=(n={})=>{var b;const{error:f,sdkLicense:e}=n,r=(b=n.plan)==null?void 0:b.category;if(!(e||n.license)||f)c(f||"Invalid license");else if(r){const w=T[a],I=T[r];w>I&&c({pluginRequiredPlan:a,licensePlan:r})}};t.on(k,n=>{p=n==null?void 0:n.baseApiUrl,m=!0}),t.on(E,n=>{s==null||s(n),d(n)}),setTimeout(async()=>{if(!m){if(u)return;if(o){const n=await W({licenseKey:o,pluginName:i,baseApiUrl:p});s==null||s(n),n&&d(n)}else c("The `licenseKey` option not provided")}},2e3)}async function W(t){const{licenseKey:a,pluginName:i,baseApiUrl:o}=t;try{return(await _({baseApiUrl:o,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const j="linkImageComponent",C=g.startup,L=function(t,a={}){const{Components:i,Blocks:o}=t,s="link-image",l="Link Image",p="link-image",{model:m,view:u}=t.Components.getType("image"),c=i.getType("link").model.getDefaults().traits,d=m.getDefaults().traits,n=c.filter(e=>e!=="title"),f=d.filter(e=>e.name!=="customAttributes").map(e=>typeof e=="string"?{name:e}:e).map(e=>({...e,getValue({component:r}){var h;return(h=r.components().at(0).getTrait(e.name))==null?void 0:h.getValue()},setValue({component:r,value:h,options:b}){var w;(w=r.components().at(0).getTrait(e.name))==null||w.setValue(h,b)}}));i.addType(s,{isComponent:e=>{var r;return e.tagName==="A"&&((r=e.children)==null?void 0:r.length)===1&&e.children[0].tagName==="IMG"},block:{label:l,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:l,classes:p,resizable:{ratioDefault:!0},traits:[...f,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
1
+ "use strict";const w="app.grapesjs.com",D="app-stage.grapesjs.com",G="app2.grapesjs.com",k="app-stage2.grapesjs.com",P=[w,G,D,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],I="license:check:end",L=()=>typeof window<"u",x=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?D:w}`}/${a?"platform-api":"api"}`,E=()=>{const e=L()&&window.location.hostname;return!!e&&(P.includes(e)||P.some(o=>e.endsWith(o)))};async function M({path:e,baseApiUrl:o,method:a="GET",headers:r={},params:i,body:g}){const n=`${o||x({isDev:!1,isStage:!1})}${e}`,c={method:a,headers:{"Content-Type":"application/json",...r}};g&&(c.body=JSON.stringify(g));const d=i?new URLSearchParams(i).toString():"",u=d?`?${d}`:"",s=await fetch(`${n}${u}`,c);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{}),T=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(T||{});const A={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function N(e){const o=e;return o.init=a=>r=>e(r,a),o}const O=e=>N(e);async function B({editor:e,plan:o,pluginName:a,licenseKey:r,onLicenseCheckResponse:i,cleanup:g}){let p="",n;const c=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),g()},d=(s={})=>{var y;const{error:f,sdkLicense:t}=s,l=(y=s.plan)==null?void 0:y.category;if(!(t||s.license)||f)c(f||"Invalid license");else if(l){const v=A[o],R=A[l];v>R&&c({pluginRequiredPlan:o,licensePlan:l})}};e.Commands.has(T.settings)&&(n=e.runCommand(T.settings),p=(n==null?void 0:n.baseUrl)||"");const u=s=>{i==null||i(s),s&&d(s)};if(!n){e.onReady(async()=>{if(!E())if(r){const s=await $({licenseKey:r,pluginName:a,baseApiUrl:p});u(s)}else c("The `licenseKey` option not provided")});return}if(n.licensePlan||n.licenseError){const s=U(n);u(s);return}e.on(I,s=>u(s))}const U=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function $(e){const{licenseKey:o,pluginName:a,baseApiUrl:r}=e;try{return(await M({baseApiUrl:r,path:`/sdk/${o||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const j="linkImageComponent",_=b.startup,F=function(e,o={}){const{Components:a,Blocks:r}=e,i="link-image",g="Link Image",p="link-image",{model:n,view:c}=e.Components.getType("image"),d=a.getType("link").model.getDefaults().traits,u=n.getDefaults().traits,s=d.filter(t=>t!=="title"),f=u.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var h;return(h=l.components().at(0).getTrait(t.name))==null?void 0:h.getValue()},setValue({component:l,value:h,options:y}){var v;(v=l.components().at(0).getTrait(t.name))==null||v.setValue(h,y)}}));a.addType(i,{isComponent:t=>{var l;return t.tagName==="A"&&((l=t.children)==null?void 0:l.length)===1&&t.children[0].tagName==="IMG"},block:{label:g,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:g,classes:p,resizable:{ratioDefault:!0},traits:[...f,...s],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
2
2
  .${p} {
3
3
  display: inline-block;
4
4
  overflow: hidden;
@@ -9,4 +9,4 @@
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  }
12
- `},init(){const e=this.components().at(0);e==null||e.set({layerable:!1,locked:!0})}},view:{onActive(e){u.prototype.onActive.call(this,e)}}}),O({editor:t,licenseKey:a.licenseKey,plan:C,pluginName:j,cleanup:()=>{i.removeType(s),o.remove(s)}})},M=S(L);module.exports=M;
12
+ `},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){c.prototype.onActive.call(this,t)}}}),B({editor:e,licenseKey:o.licenseKey,plan:_,pluginName:j,cleanup:()=>{a.removeType(i),r.remove(i)}})},W=O(F);module.exports=W;
@@ -1,8 +1,8 @@
1
- const A = "app.grapesjs.com", v = "app-stage.grapesjs.com", N = "app2.grapesjs.com", D = "app-stage2.grapesjs.com", y = [
2
- A,
3
- N,
4
- v,
1
+ const w = "app.grapesjs.com", D = "app-stage.grapesjs.com", G = "app2.grapesjs.com", k = "app-stage2.grapesjs.com", P = [
2
+ w,
3
+ G,
5
4
  D,
5
+ k,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,130 +11,143 @@ const A = "app.grapesjs.com", v = "app-stage.grapesjs.com", N = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], k = "license:check:start", E = "license:check:end", $ = () => typeof window < "u", U = ({
14
+ ], I = "license:check:end", L = () => typeof window < "u", x = ({
15
15
  isDev: e,
16
- isStage: a,
17
- isPlatform: i
18
- }) => `${e ? "" : `https://${a ? v : A}`}/${i ? "platform-api" : "api"}`, P = () => {
19
- const e = $() && window.location.hostname;
20
- return !!e && (y.includes(e) || y.some((a) => e.endsWith(a)));
16
+ isStage: o,
17
+ isPlatform: a
18
+ }) => `${e ? "" : `https://${o ? D : w}`}/${a ? "platform-api" : "api"}`, E = () => {
19
+ const e = L() && window.location.hostname;
20
+ return !!e && (P.includes(e) || P.some((o) => e.endsWith(o)));
21
21
  };
22
- async function _({
22
+ async function M({
23
23
  path: e,
24
- baseApiUrl: a,
25
- method: i = "GET",
26
- headers: o = {},
27
- params: s,
28
- body: c
24
+ baseApiUrl: o,
25
+ method: a = "GET",
26
+ headers: r = {},
27
+ params: i,
28
+ body: g
29
29
  }) {
30
- const m = `${a || U({ isDev: !1, isStage: !1 })}${e}`, u = {
31
- method: i,
30
+ const n = `${o || x({ isDev: !1, isStage: !1 })}${e}`, c = {
31
+ method: a,
32
32
  headers: {
33
33
  "Content-Type": "application/json",
34
- ...o
34
+ ...r
35
35
  }
36
36
  };
37
- c && (u.body = JSON.stringify(c));
38
- const l = s ? new URLSearchParams(s).toString() : "", d = l ? `?${l}` : "", n = await fetch(`${m}${d}`, u);
39
- if (!n.ok)
40
- throw new Error(`HTTP error! status: ${n.status}`);
41
- return n.json();
37
+ g && (c.body = JSON.stringify(g));
38
+ const d = i ? new URLSearchParams(i).toString() : "", u = d ? `?${d}` : "", s = await fetch(`${n}${u}`, c);
39
+ if (!s.ok)
40
+ throw new Error(`HTTP error! status: ${s.status}`);
41
+ return s.json();
42
42
  }
43
- var g = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(g || {});
44
- const T = {
45
- [g.free]: 0,
46
- [g.startup]: 10,
47
- [g.business]: 20,
48
- [g.enterprise]: 30
43
+ var b = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(b || {}), T = /* @__PURE__ */ ((e) => (e.toastAdd = "studio:toastAdd", e.toastRemove = "studio:toastRemove", e.dialogOpen = "studio:dialogOpen", e.dialogClose = "studio:dialogClose", e.dialogExportCode = "studio:dialogExportCode", e.dialogImportCode = "studio:dialogImportCode", e.sidebarLeftSet = "studio:sidebarLeft:set", e.sidebarLeftGet = "studio:sidebarLeft:get", e.sidebarLeftToggle = "studio:sidebarLeft:toggle", e.sidebarRightSet = "studio:sidebarRight:set", e.sidebarRightGet = "studio:sidebarRight:get", e.sidebarRightToggle = "studio:sidebarRight:toggle", e.sidebarTopSet = "studio:sidebarTop:set", e.sidebarTopGet = "studio:sidebarTop:get", e.sidebarTopToggle = "studio:sidebarTop:toggle", e.sidebarBottomSet = "studio:sidebarBottom:set", e.sidebarBottomGet = "studio:sidebarBottom:get", e.sidebarBottomToggle = "studio:sidebarBottom:toggle", e.symbolAdd = "studio:symbolAdd", e.symbolDetach = "studio:symbolDetach", e.symbolOverride = "studio:symbolOverride", e.symbolPropagateStyles = "studio:propagateStyles", e.getPagesConfig = "studio:getPagesConfig", e.setPagesConfig = "studio:setPagesConfig", e.getPageSettings = "studio:getPageSettings", e.setPageSettings = "studio:setPageSettings", e.clearPage = "studio:clearPage", e.projectFiles = "studio:projectFiles", e.validateCode = "studio:validateCode", e.canvasReload = "studio:canvasReload", e.getBlocksPanel = "studio:getBlocksPanel", e.setBlocksPanel = "studio:setBlocksPanel", e.getStateContextMenu = "studio:getStateContextMenu", e.setStateContextMenu = "studio:setStateContextMenu", e.contextMenuComponent = "studio:contextMenuComponent", e.layoutAdd = "studio:layoutAdd", e.layoutRemove = "studio:layoutRemove", e.layoutToggle = "studio:layoutToggle", e.layoutUpdate = "studio:layoutUpdate", e.layoutGet = "studio:layoutGet", e.layoutConfigGet = "studio:layoutConfigGet", e.layoutConfigSet = "studio:layoutConfigSet", e.layoutComponentAdd = "studio:layoutComponentAdd", e.layoutComponentGet = "studio:layoutComponentGet", e.layoutComponentRemove = "studio:layoutComponentRemove", e.layoutComponentRender = "studio:layoutComponentRender", e.getStateTheme = "studio:getStateTheme", e.setStateTheme = "studio:setStateTheme", e.settings = "studio:settings", e.assetProviderGet = "studio:assetProviderGet", e.assetProviderAdd = "studio:assetProviderAdd", e.assetProviderRemove = "studio:assetProviderRemove", e.fontGet = "studio:fontGet", e.fontAdd = "studio:fontAdd", e.fontRemove = "studio:fontRemove", e.fontManagerOpen = "studio:fontManagerOpen", e.menuFontLoad = "studio:menuFontLoad", e.toggleStateDataSource = "studio:toggleStateDataSource", e.getStateDataSource = "studio:getStateDataSource", e.dataSourceSetGlobalData = "studio:dataSourceSetGlobalData", e.dataSourceSetImporter = "studio:dataSourceSetImporter", e.dataSourceSetExporter = "studio:dataSourceSetExporter", e.setDragAbsolute = "studio:setDragAbsolute", e))(T || {});
44
+ const A = {
45
+ [b.free]: 0,
46
+ [b.startup]: 10,
47
+ [b.business]: 20,
48
+ [b.enterprise]: 30
49
49
  };
50
- function x(e) {
51
- const a = e;
52
- return a.init = (i) => (o) => e(o, i), a;
50
+ function N(e) {
51
+ const o = e;
52
+ return o.init = (a) => (r) => e(r, a), o;
53
53
  }
54
- const S = (e) => /* @__PURE__ */ x(e);
55
- async function O({
54
+ const O = (e) => /* @__PURE__ */ N(e);
55
+ async function B({
56
56
  editor: e,
57
- plan: a,
58
- pluginName: i,
59
- licenseKey: o,
60
- onLicenseCheckResponse: s,
61
- cleanup: c
57
+ plan: o,
58
+ pluginName: a,
59
+ licenseKey: r,
60
+ onLicenseCheckResponse: i,
61
+ cleanup: g
62
62
  }) {
63
- let p = "", m = !1;
64
- const u = P(), l = (n) => {
65
- console.warn("Cleanup plugin:", i, "Reason:", n), c();
66
- }, d = (n = {}) => {
67
- var b;
68
- const { error: f, sdkLicense: t } = n, r = (b = n.plan) == null ? void 0 : b.category;
69
- if (!(t || n.license) || f)
70
- l(f || "Invalid license");
71
- else if (r) {
72
- const w = T[a], I = T[r];
73
- w > I && l({ pluginRequiredPlan: a, licensePlan: r });
63
+ let p = "", n;
64
+ const c = (s) => {
65
+ console.warn("Cleanup plugin:", a, "Reason:", s), g();
66
+ }, d = (s = {}) => {
67
+ var y;
68
+ const { error: f, sdkLicense: t } = s, l = (y = s.plan) == null ? void 0 : y.category;
69
+ if (!(t || s.license) || f)
70
+ c(f || "Invalid license");
71
+ else if (l) {
72
+ const v = A[o], R = A[l];
73
+ v > R && c({ pluginRequiredPlan: o, licensePlan: l });
74
74
  }
75
75
  };
76
- e.on(k, (n) => {
77
- p = n == null ? void 0 : n.baseApiUrl, m = !0;
78
- }), e.on(E, (n) => {
79
- s == null || s(n), d(n);
80
- }), setTimeout(async () => {
81
- if (!m) {
82
- if (u) return;
83
- if (o) {
84
- const n = await W({ licenseKey: o, pluginName: i, baseApiUrl: p });
85
- s == null || s(n), n && d(n);
86
- } else
87
- l("The `licenseKey` option not provided");
88
- }
89
- }, 2e3);
76
+ e.Commands.has(T.settings) && (n = e.runCommand(T.settings), p = (n == null ? void 0 : n.baseUrl) || "");
77
+ const u = (s) => {
78
+ i == null || i(s), s && d(s);
79
+ };
80
+ if (!n) {
81
+ e.onReady(async () => {
82
+ if (!E())
83
+ if (r) {
84
+ const s = await $({ licenseKey: r, pluginName: a, baseApiUrl: p });
85
+ u(s);
86
+ } else
87
+ c("The `licenseKey` option not provided");
88
+ });
89
+ return;
90
+ }
91
+ if (n.licensePlan || n.licenseError) {
92
+ const s = U(n);
93
+ u(s);
94
+ return;
95
+ }
96
+ e.on(I, (s) => u(s));
90
97
  }
91
- async function W(e) {
92
- const { licenseKey: a, pluginName: i, baseApiUrl: o } = e;
98
+ const U = (e) => ({
99
+ sdkLicense: e.license,
100
+ license: e.license,
101
+ error: e.licenseError,
102
+ plan: e.licensePlan
103
+ });
104
+ async function $(e) {
105
+ const { licenseKey: o, pluginName: a, baseApiUrl: r } = e;
93
106
  try {
94
- return (await _({
95
- baseApiUrl: o,
96
- path: `/sdk/${a || "na"}`,
107
+ return (await M({
108
+ baseApiUrl: r,
109
+ path: `/sdk/${o || "na"}`,
97
110
  method: "POST",
98
111
  params: {
99
112
  d: window.location.hostname,
100
- pn: i
113
+ pn: a
101
114
  }
102
115
  })).result || {};
103
- } catch (s) {
104
- return console.error("Error during SDK license check:", s), !1;
116
+ } catch (i) {
117
+ return console.error("Error during SDK license check:", i), !1;
105
118
  }
106
119
  }
107
- const j = "linkImageComponent", C = g.startup, L = function(e, a = {}) {
108
- const { Components: i, Blocks: o } = e, s = "link-image", c = "Link Image", p = "link-image", { model: m, view: u } = e.Components.getType("image"), l = i.getType("link").model.getDefaults().traits, d = m.getDefaults().traits, n = l.filter((t) => t !== "title"), f = d.filter((t) => t.name !== "customAttributes").map((t) => typeof t == "string" ? { name: t } : t).map(
120
+ const j = "linkImageComponent", _ = b.startup, F = function(e, o = {}) {
121
+ const { Components: a, Blocks: r } = e, i = "link-image", g = "Link Image", p = "link-image", { model: n, view: c } = e.Components.getType("image"), d = a.getType("link").model.getDefaults().traits, u = n.getDefaults().traits, s = d.filter((t) => t !== "title"), f = u.filter((t) => t.name !== "customAttributes").map((t) => typeof t == "string" ? { name: t } : t).map(
109
122
  (t) => ({
110
123
  ...t,
111
- getValue({ component: r }) {
124
+ getValue({ component: l }) {
112
125
  var h;
113
- return (h = r.components().at(0).getTrait(t.name)) == null ? void 0 : h.getValue();
126
+ return (h = l.components().at(0).getTrait(t.name)) == null ? void 0 : h.getValue();
114
127
  },
115
- setValue({ component: r, value: h, options: b }) {
116
- var w;
117
- (w = r.components().at(0).getTrait(t.name)) == null || w.setValue(h, b);
128
+ setValue({ component: l, value: h, options: y }) {
129
+ var v;
130
+ (v = l.components().at(0).getTrait(t.name)) == null || v.setValue(h, y);
118
131
  }
119
132
  })
120
133
  );
121
- i.addType(s, {
134
+ a.addType(i, {
122
135
  isComponent: (t) => {
123
- var r;
124
- return t.tagName === "A" && ((r = t.children) == null ? void 0 : r.length) === 1 && t.children[0].tagName === "IMG";
136
+ var l;
137
+ return t.tagName === "A" && ((l = t.children) == null ? void 0 : l.length) === 1 && t.children[0].tagName === "IMG";
125
138
  },
126
139
  block: {
127
- label: c,
140
+ label: g,
128
141
  media: '<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'
129
142
  },
130
143
  extend: "link",
131
144
  extendFn: ["init"],
132
145
  model: {
133
146
  defaults: {
134
- name: c,
147
+ name: g,
135
148
  classes: p,
136
149
  resizable: { ratioDefault: !0 },
137
- traits: [...f, ...n],
150
+ traits: [...f, ...s],
138
151
  droppable: !1,
139
152
  stylable: [
140
153
  "width",
@@ -176,19 +189,19 @@ const j = "linkImageComponent", C = g.startup, L = function(e, a = {}) {
176
189
  },
177
190
  view: {
178
191
  onActive(t) {
179
- u.prototype.onActive.call(this, t);
192
+ c.prototype.onActive.call(this, t);
180
193
  }
181
194
  }
182
- }), O({
195
+ }), B({
183
196
  editor: e,
184
- licenseKey: a.licenseKey,
185
- plan: C,
197
+ licenseKey: o.licenseKey,
198
+ plan: _,
186
199
  pluginName: j,
187
200
  cleanup: () => {
188
- i.removeType(s), o.remove(s);
201
+ a.removeType(i), r.remove(i);
189
202
  }
190
203
  });
191
- }, M = S(L);
204
+ }, W = O(F);
192
205
  export {
193
- M as default
206
+ W as default
194
207
  };
@@ -1,4 +1,4 @@
1
- (function(m,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_linkImageComponent=d())})(this,function(){"use strict";const m="app.grapesjs.com",d="app-stage.grapesjs.com",A=[m,"app2.grapesjs.com",d,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],v="license:check:start",D="license:check:end",N=()=>typeof window<"u",k=({isDev:e,isStage:s,isPlatform:a})=>`${e?"":`https://${s?d:m}`}/${a?"platform-api":"api"}`,E=()=>{const e=N()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(s=>e.endsWith(s)))};async function _({path:e,baseApiUrl:s,method:a="GET",headers:o={},params:i,body:c}){const g=`${s||k({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...o}};c&&(h.body=JSON.stringify(c));const r=i?new URLSearchParams(i).toString():"",f=r?`?${r}`:"",n=await fetch(`${g}${f}`,h);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var u=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(u||{});const I={[u.free]:0,[u.startup]:10,[u.business]:20,[u.enterprise]:30};function P(e){const s=e;return s.init=a=>o=>e(o,a),s}const S=e=>P(e);async function $({editor:e,plan:s,pluginName:a,licenseKey:o,onLicenseCheckResponse:i,cleanup:c}){let p="",g=!1;const h=E(),r=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),c()},f=(n={})=>{var y;const{error:w,sdkLicense:t}=n,l=(y=n.plan)==null?void 0:y.category;if(!(t||n.license)||w)r(w||"Invalid license");else if(l){const T=I[s],M=I[l];T>M&&r({pluginRequiredPlan:s,licensePlan:l})}};e.on(v,n=>{p=n==null?void 0:n.baseApiUrl,g=!0}),e.on(D,n=>{i==null||i(n),f(n)}),setTimeout(async()=>{if(!g){if(h)return;if(o){const n=await x({licenseKey:o,pluginName:a,baseApiUrl:p});i==null||i(n),n&&f(n)}else r("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:s,pluginName:a,baseApiUrl:o}=e;try{return(await _({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const O="linkImageComponent",U=u.startup;return S(function(e,s={}){const{Components:a,Blocks:o}=e,i="link-image",c="Link Image",p="link-image",{model:g,view:h}=e.Components.getType("image"),r=a.getType("link").model.getDefaults().traits,f=g.getDefaults().traits,n=r.filter(t=>t!=="title"),w=f.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var b;return(b=l.components().at(0).getTrait(t.name))==null?void 0:b.getValue()},setValue({component:l,value:b,options:y}){var T;(T=l.components().at(0).getTrait(t.name))==null||T.setValue(b,y)}}));a.addType(i,{isComponent:t=>{var l;return t.tagName==="A"&&((l=t.children)==null?void 0:l.length)===1&&t.children[0].tagName==="IMG"},block:{label:c,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:c,classes:p,resizable:{ratioDefault:!0},traits:[...w,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
1
+ (function(d,f){typeof exports=="object"&&typeof module<"u"?module.exports=f():typeof define=="function"&&define.amd?define(f):(d=typeof globalThis<"u"?globalThis:d||self,d.StudioSdkPlugins_linkImageComponent=f())})(this,function(){"use strict";const d="app.grapesjs.com",f="app-stage.grapesjs.com",w=[d,"app2.grapesjs.com",f,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],R="license:check:end",I=()=>typeof window<"u",k=({isDev:e,isStage:s,isPlatform:n})=>`${e?"":`https://${s?f:d}`}/${n?"platform-api":"api"}`,G=()=>{const e=I()&&window.location.hostname;return!!e&&(w.includes(e)||w.some(s=>e.endsWith(s)))};async function x({path:e,baseApiUrl:s,method:n="GET",headers:r={},params:i,body:g}){const a=`${s||k({isDev:!1,isStage:!1})}${e}`,c={method:n,headers:{"Content-Type":"application/json",...r}};g&&(c.body=JSON.stringify(g));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",o=await fetch(`${a}${u}`,c);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{}),P=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(P||{});const D={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function L(e){const s=e;return s.init=n=>r=>e(r,n),s}const E=e=>L(e);async function M({editor:e,plan:s,pluginName:n,licenseKey:r,onLicenseCheckResponse:i,cleanup:g}){let p="",a;const c=o=>{console.warn("Cleanup plugin:",n,"Reason:",o),g()},b=(o={})=>{var T;const{error:v,sdkLicense:t}=o,l=(T=o.plan)==null?void 0:T.category;if(!(t||o.license)||v)c(v||"Invalid license");else if(l){const A=D[s],$=D[l];A>$&&c({pluginRequiredPlan:s,licensePlan:l})}};e.Commands.has(P.settings)&&(a=e.runCommand(P.settings),p=(a==null?void 0:a.baseUrl)||"");const u=o=>{i==null||i(o),o&&b(o)};if(!a){e.onReady(async()=>{if(!G())if(r){const o=await N({licenseKey:r,pluginName:n,baseApiUrl:p});u(o)}else c("The `licenseKey` option not provided")});return}if(a.licensePlan||a.licenseError){const o=O(a);u(o);return}e.on(R,o=>u(o))}const O=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function N(e){const{licenseKey:s,pluginName:n,baseApiUrl:r}=e;try{return(await x({baseApiUrl:r,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const B="linkImageComponent",U=h.startup;return E(function(e,s={}){const{Components:n,Blocks:r}=e,i="link-image",g="Link Image",p="link-image",{model:a,view:c}=e.Components.getType("image"),b=n.getType("link").model.getDefaults().traits,u=a.getDefaults().traits,o=b.filter(t=>t!=="title"),v=u.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var y;return(y=l.components().at(0).getTrait(t.name))==null?void 0:y.getValue()},setValue({component:l,value:y,options:T}){var A;(A=l.components().at(0).getTrait(t.name))==null||A.setValue(y,T)}}));n.addType(i,{isComponent:t=>{var l;return t.tagName==="A"&&((l=t.children)==null?void 0:l.length)===1&&t.children[0].tagName==="IMG"},block:{label:g,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:g,classes:p,resizable:{ratioDefault:!0},traits:[...v,...o],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
2
2
  .${p} {
3
3
  display: inline-block;
4
4
  overflow: hidden;
@@ -9,4 +9,4 @@
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  }
12
- `},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){h.prototype.onActive.call(this,t)}}}),$({editor:e,licenseKey:s.licenseKey,plan:U,pluginName:O,cleanup:()=>{a.removeType(i),o.remove(i)}})})});
12
+ `},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){c.prototype.onActive.call(this,t)}}}),M({editor:e,licenseKey:s.licenseKey,plan:U,pluginName:B,cleanup:()=>{n.removeType(i),r.remove(i)}})})});
@@ -1,11 +1,11 @@
1
- "use strict";const D="app.grapesjs.com",C="app-stage.grapesjs.com",S="app2.grapesjs.com",x="app-stage2.grapesjs.com",v=[D,S,C,x,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",U="license:check:end",k=()=>typeof window<"u",W=({isDev:t,isStage:s,isPlatform:i})=>`${t?"":`https://${s?C:D}`}/${i?"platform-api":"api"}`,j=()=>{const t=k()&&window.location.hostname;return!!t&&(v.includes(t)||v.some(s=>t.endsWith(s)))};async function B({path:t,baseApiUrl:s,method:i="GET",headers:e={},params:o,body:a}){const c=`${s||W({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...e}};a&&(u.body=JSON.stringify(a));const r=o?new URLSearchParams(o).toString():"",p=r?`?${r}`:"",n=await fetch(`${c}${p}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var y=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(y||{});const _={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function K(t){const s=t;return s.init=i=>e=>t(e,i),s}const G=t=>K(t);async function F({editor:t,plan:s,pluginName:i,licenseKey:e,onLicenseCheckResponse:o,cleanup:a}){let l="",c=!1;const u=j(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),a()},p=(n={})=>{var P;const{error:h,sdkLicense:A}=n,m=(P=n.plan)==null?void 0:P.category;if(!(A||n.license)||h)r(h||"Invalid license");else if(m){const b=_[s],H=_[m];b>H&&r({pluginRequiredPlan:s,licensePlan:m})}};t.on(O,n=>{l=n==null?void 0:n.baseApiUrl,c=!0}),t.on(U,n=>{o==null||o(n),p(n)}),setTimeout(async()=>{if(!c){if(u)return;if(e){const n=await R({licenseKey:e,pluginName:i,baseApiUrl:l});o==null||o(n),n&&p(n)}else r("The `licenseKey` option not provided")}},2e3)}async function R(t){const{licenseKey:s,pluginName:i,baseApiUrl:e}=t;try{return(await B({baseApiUrl:e,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const N="gjs-plg-",q="listPagesComponent",X=y.startup;function Y(t,s,i){let e,o,a,l,c;const u=s;function r(){const n=Date.now()-l;n<u&&n>=0?e=setTimeout(r,u-n):(e=null,c=t.apply(a,o),a=o=null)}const p=function(){return a=this,o=arguments,l=Date.now(),e||(e=setTimeout(r,u)),c};return p.clear=function(){e&&(clearTimeout(e),e=null)},p.flush=function(){e&&(c=t.apply(a,o),a=o=null,clearTimeout(e),e=null)},p}const $="page://",g="list-pages",f="list-pages-item",d="list-pages-link",Z=t=>t.components().reduce((s,i)=>{var l;const e=i.findFirstType(d),o=(l=e==null?void 0:e.attributes.attributes)==null?void 0:l.href,a=o!=null&&o.startsWith($)?o.replace($,""):"";if(a&&e){const c=s[a];c?c.push(e):s[a]=[e]}return s},{}),I="data-type-role",J="page_root",z=t=>s=>s.is(t),Q=t=>(s,i)=>i.is(t),w=t=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,I))===t},tt=function(t,s={}){const{Blocks:i,Components:e,Pages:o}=t,{licenseKey:a,block:l={}}=s,c="List Pages",u="List Pages Item",r="Link",p=`${N}${g}`,n=`${N}${d}`,h='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',A='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(g,{block:l&&{label:c,media:h,category:"Extra",select:!0,...s.block},isComponent:w(g),model:{defaults:{tagName:"ul",name:c,[J]:"",classes:p,attributes:{[I]:g,role:"navigation"},droppable:z(f),styles:`
2
- .${p} {
1
+ "use strict";const B="app.grapesjs.com",O="app-stage.grapesjs.com",$="app2.grapesjs.com",N="app-stage2.grapesjs.com",G=[B,$,O,N,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:end",U=()=>typeof window<"u",F=({isDev:e,isStage:s,isPlatform:a})=>`${e?"":`https://${s?O:B}`}/${a?"platform-api":"api"}`,j=()=>{const e=U()&&window.location.hostname;return!!e&&(G.includes(e)||G.some(s=>e.endsWith(s)))};async function W({path:e,baseApiUrl:s,method:a="GET",headers:t={},params:n,body:r}){const i=`${s||F({isDev:!1,isStage:!1})}${e}`,l={method:a,headers:{"Content-Type":"application/json",...t}};r&&(l.body=JSON.stringify(r));const p=n?new URLSearchParams(n).toString():"",c=p?`?${p}`:"",o=await fetch(`${i}${c}`,l);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var b=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(b||{}),E=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(E||{});const V={[b.free]:0,[b.startup]:10,[b.business]:20,[b.enterprise]:30};function K(e){const s=e;return s.init=a=>t=>e(t,a),s}const m=e=>K(e);async function q({editor:e,plan:s,pluginName:a,licenseKey:t,onLicenseCheckResponse:n,cleanup:r}){let g="",i;const l=o=>{console.warn("Cleanup plugin:",a,"Reason:",o),r()},p=(o={})=>{var h;const{error:P,sdkLicense:L}=o,u=(h=o.plan)==null?void 0:h.category;if(!(L||o.license)||P)l(P||"Invalid license");else if(u){const T=V[s],I=V[u];T>I&&l({pluginRequiredPlan:s,licensePlan:u})}};e.Commands.has(E.settings)&&(i=e.runCommand(E.settings),g=(i==null?void 0:i.baseUrl)||"");const c=o=>{n==null||n(o),o&&p(o)};if(!i){e.onReady(async()=>{if(!j())if(t){const o=await Y({licenseKey:t,pluginName:a,baseApiUrl:g});c(o)}else l("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const o=X(i);c(o);return}e.on(_,o=>c(o))}const X=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Y(e){const{licenseKey:s,pluginName:a,baseApiUrl:t}=e;try{return(await W({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const x="gjs-plg-",Z="listPagesComponent",J=b.startup;function z(e,s,a){let t,n,r,g,i;const l=s;function p(){const o=Date.now()-g;o<l&&o>=0?t=setTimeout(p,l-o):(t=null,i=e.apply(r,n),r=n=null)}const c=function(){return r=this,n=arguments,g=Date.now(),t||(t=setTimeout(p,l)),i};return c.clear=function(){t&&(clearTimeout(t),t=null)},c.flush=function(){t&&(i=e.apply(r,n),r=n=null,clearTimeout(t),t=null)},c}const k="page://",d="list-pages",f="list-pages-item",y="list-pages-link",Q=e=>e.components().reduce((s,a)=>{var g;const t=a.findFirstType(y),n=(g=t==null?void 0:t.attributes.attributes)==null?void 0:g.href,r=n!=null&&n.startsWith(k)?n.replace(k,""):"";if(r&&t){const i=s[r];i?i.push(t):s[r]=[t]}return s},{}),A="data-type-role",S="page_root",C=e=>s=>s.is(e),ee=e=>(s,a)=>a.is(e),M=e=>s=>{var a;return((a=s.getAttribute)==null?void 0:a.call(s,A))===e},te=function(e,s={}){const{Blocks:a,Components:t,Pages:n}=e,{licenseKey:r,block:g={}}=s,i="List Pages",l="List Pages Item",p="Link",c=`${x}${d}`,o=`${x}${y}`,P='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',L='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';t.addType(d,{block:g&&{label:i,media:P,category:"Extra",select:!0,...s.block},isComponent:M(d),model:{defaults:{tagName:"ul",name:i,[S]:"",classes:c,attributes:{[A]:d,role:"navigation"},droppable:C(f),styles:`
2
+ .${c} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=Y(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const m=this.em.Pages.getAll(),E=this.components(),P=Z(this);m.forEach((b,H)=>{const V=b.id,L=b.getName(),T=P[V];T?T==null||T.forEach(M=>{M.getInnerHTML()!==L&&M.components(L)}):E.add({type:f,components:[{type:d,attributes:{href:`page://${V}`},components:{type:"textnode",content:L}}]},{at:H})})}}}),e.addType(f,{isComponent:w(f),model:{defaults:{name:u,tagName:"li",icon:A,attributes:{[I]:f},components:{type:d},draggable:Q(g)}}}),e.addType(d,{extend:"link",isComponent:w(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:m=>m.closestType(f)},name:r,classes:n,attributes:{[I]:d},components:{type:"textnode",content:"Item"},styles:`
8
- .${n} {
7
+ `},init(){this.syncPageItems=z(this.syncPageItems.bind(this),0),this.listenTo(this.em,n.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const u=this.em.Pages.getAll(),H=this.components(),h=Q(this);u.forEach((T,I)=>{const D=T.id,R=T.getName(),v=h[D];v?v==null||v.forEach(w=>{w.getInnerHTML()!==R&&w.components(R)}):H.add({type:f,components:[{type:y,attributes:{href:`page://${D}`},components:{type:"textnode",content:R}}]},{at:I})})}}}),t.addType(f,{isComponent:M(f),model:{defaults:{name:l,tagName:"li",icon:L,attributes:{[A]:f},components:{type:y},draggable:ee(d)}}}),t.addType(y,{extend:"link",isComponent:M(y),model:{defaults:{removable:!1,copyable:!1,delegate:{move:u=>u.closestType(f)},name:p,classes:o,attributes:{[A]:y},components:{type:"textnode",content:"Item"},styles:`
8
+ .${o} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),F({editor:t,licenseKey:a,plan:X,pluginName:q,cleanup:()=>{i.remove(g),e.removeType(g)}})},et=G(tt);module.exports=et;
11
+ `}}}),q({editor:e,licenseKey:r,plan:J,pluginName:Z,cleanup:()=>{a.remove(d),t.removeType(d)}})},se=m(te);module.exports=se;