@grapesjs/studio-sdk-plugins 1.0.10 → 1.0.11

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 (41) hide show
  1. package/dist/dialogComponent/index.cjs.js +2 -2
  2. package/dist/dialogComponent/index.es.js +4 -3
  3. package/dist/dialogComponent/index.umd.js +7 -7
  4. package/dist/fsLightboxComponent/index.cjs.js +2 -2
  5. package/dist/fsLightboxComponent/index.es.js +4 -3
  6. package/dist/fsLightboxComponent/index.umd.js +2 -2
  7. package/dist/index.cjs.d.ts +1 -0
  8. package/dist/index.cjs.js +59 -15
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.d.ts +1 -0
  11. package/dist/index.es.js +3891 -2910
  12. package/dist/index.umd.js +66 -22
  13. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  14. package/dist/lightGalleryComponent/index.es.js +21 -20
  15. package/dist/lightGalleryComponent/index.umd.js +1 -1
  16. package/dist/listPagesComponent/index.cjs.js +4 -4
  17. package/dist/listPagesComponent/index.es.js +4 -3
  18. package/dist/listPagesComponent/index.umd.js +3 -3
  19. package/dist/prosemirror/index.cjs.js +1 -1
  20. package/dist/prosemirror/index.es.js +4 -2
  21. package/dist/prosemirror/index.umd.js +1 -1
  22. package/dist/swiperComponent/components/Swiper.d.ts +12 -0
  23. package/dist/swiperComponent/components/SwiperNavigation.d.ts +7 -0
  24. package/dist/swiperComponent/components/SwiperPagination.d.ts +3 -0
  25. package/dist/swiperComponent/components/SwiperScrollbar.d.ts +5 -0
  26. package/dist/swiperComponent/components/SwiperSlide.d.ts +5 -0
  27. package/dist/swiperComponent/components/SwiperWrapper.d.ts +5 -0
  28. package/dist/swiperComponent/index.cjs.d.ts +3 -0
  29. package/dist/swiperComponent/index.cjs.js +45 -0
  30. package/dist/swiperComponent/index.d.ts +3 -0
  31. package/dist/swiperComponent/index.es.d.ts +3 -0
  32. package/dist/swiperComponent/index.es.js +1082 -0
  33. package/dist/swiperComponent/index.umd.js +45 -0
  34. package/dist/swiperComponent/types.d.ts +13 -0
  35. package/dist/swiperComponent/typesSchema.d.ts +19 -0
  36. package/dist/swiperComponent/utils.d.ts +23 -0
  37. package/dist/tableComponent/index.cjs.js +1 -1
  38. package/dist/tableComponent/index.es.js +4 -3
  39. package/dist/tableComponent/index.umd.js +1 -1
  40. package/dist/utils.d.ts +36 -1
  41. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";const ie="app.grapesjs.com",re="app-stage.grapesjs.com",Y=[ie,re,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ue="license:check:start",he="license:check:end",ge=()=>typeof window<"u",be=({isDev:e,isStage:l})=>`${e?"":`https://${l?re:ie}`}/api`,me=()=>{const e=ge()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};var E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{});async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||be({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const ee={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function ye(e){const l=e;return l.init=a=>n=>e(n,a),l}const ve=e=>ye(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=me(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var L;const{error:b,sdkLicense:C}=i,T=(L=i.plan)==null?void 0:L.category;if(!(C||i.license)||b)h(b||"Invalid license");else if(T){const G=ee[l],V=ee[T];G>V&&h({pluginRequiredPlan:l,licensePlan:T})}};e.on(ue,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(he,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await Te({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function Te(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,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 z=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))};var P=(e=>(e.image="image",e.video="video",e.external="external",e))(P||{});const k="lightGallery",te=`${k}-item`,D="data-lightgallery",ae=`${D}-item`,H="toggle",I={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>'},B={propKeys:[],props:{},traits:[]},M=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},W=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},we=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).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(" "),a)},Se={[H]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.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}},xe={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"}]}}},ke={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}]}}},Ie={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}]}}},f="sourceType",U="data-iframe",R={name:"href",type:"file",label:"Image Source"},N={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},F={name:"data-poster",label:"Video Poster",type:"file"},ne={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ce={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[H]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(k))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[N,F],external:[ne]},options:[{id:"image",label:R.label||"",icon:I.image},{id:"video",label:N.label||"",icon:I.video},{id:"external",label:ne.label||"",icon:I.external}]},subHtml:ce},Ae="lightGalleryComponent",le="lgThumbnail",Pe="lgVideo",oe="lgAutoplay",se="lgZoom",A="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ee=function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:I.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[le,Pe,oe,se],cdnScript:[`${A}/lightgallery.min.js`,`${A}/plugins/thumbnail/lg-thumbnail.min.js`,`${A}/plugins/video/lg-video.min.js`,`${A}/plugins/autoplay/lg-autoplay.min.js`,`${A}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${A}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:d,cdnScript:w,cdnStyle:O,inline:J,lgLicenseKey:pe,...y}=t||{},S=m=>isNaN(m)?void 0:parseInt(m,10),Q=()=>{var $;const m={...y,licenseKey:pe,speed:S(y.speed),startAnimationDuration:S(y.startAnimationDuration),thumbMargin:S(y.thumbMargin),thumbWidth:S(y.thumbWidth),slideShowInterval:S(y.slideShowInterval),scale:S(y.scale),enableZoomAfter:S(y.enableZoomAfter),plugins:(d||[]).map(K=>g[K])};J&&(m.container=o,m.closable=!1);const j=($=g.lightGallery)==null?void 0:$.call(g,o,m);J&&j.openGallery()};if(g.lightGallery)Q();else{const{head:m}=document,j=Array.isArray(w)?[...w]:[w],$=Array.isArray(O)?[...O]:[O],K=x=>{if(x.length){const v=document.createElement("link");v.href=x.shift(),v.rel="stylesheet",m.appendChild(v),K(x)}},X=x=>{if(x.length){const v=document.createElement("script");v.src=x.shift(),v.onerror=v.onload=X.bind(null,x),m.appendChild(v)}else Q()};K($),X(j)}},b=t=>{const o=t.getTrait(H);if(!h||!o)return;const{toolbar:g}=t,d={id:H,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(O=>O.id===d.id)&&(g==null||g.unshift(d))};let C=[];const T=r.plugins||[],_=M(Se),L=T.includes(le)?M(xe):B,G=T.includes(oe)?M(ke):B,V=T.includes(se)?M(Ie):B;n.addType(k,{block:p&&{label:s,media:I.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>z(t,D),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:I.gallery,draggable:(t,o)=>!o.is(k),attributes:{[D]:!0},components:{type:te},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",..._.propKeys,...L.propKeys,...G.propKeys,...V.propKeys],..._.props,...L.props,...G.props,...V.props,traits:[..._.traits,...L.traits,...G.traits,...V.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const t=n.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();C=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();C.forEach(o=>this.em.Canvas.addSpot(o.attributes)),C=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const q=M(Le);n.addType(te,{isComponent:t=>z(t,ae)||t.tagName==="A"&&z(t.parentElement,D),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:I.galleryItem,attributes:{[ae]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...q.props,traits:[...q.traits]},init(){const t=[f].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),we(this,f,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ce.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(k))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[f]||g){Z(this,f);const d=this.getTrait(f).getValue();if(d===P.image){this.removeAttributes([N.name,F.name,U]);const w=this.getTrait(R.name);w.setValue(w.getValue()||c)}else d===P.video?this.removeAttributes([U]):d===P.external&&this.addAttributes({[U]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[U]?this.set(f,P.external):(t[N.name]||t[F.name])&&this.set(f,P.video)}}}),fe({editor:e,plan:E.free,licenseKey:r.licenseKey,pluginName:Ae,cleanup:()=>{a.remove(k),n.removeType(k)}})},Ce=ve(Ee);module.exports=Ce;
1
+ "use strict";require("grapesjs");const ie="app.grapesjs.com",re="app-stage.grapesjs.com",Y=[ie,re,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ue="license:check:start",he="license:check:end",ge=()=>typeof window<"u",be=({isDev:e,isStage:l})=>`${e?"":`https://${l?re:ie}`}/api`,me=()=>{const e=ge()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(l=>e.endsWith(l)))};var E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{});async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||be({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const ee={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function ye(e){const l=e;return l.init=a=>n=>e(n,a),l}const ve=e=>ye(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=me(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var L;const{error:b,sdkLicense:C}=i,T=(L=i.plan)==null?void 0:L.category;if(!(C||i.license)||b)h(b||"Invalid license");else if(T){const G=ee[l],V=ee[T];G>V&&h({pluginRequiredPlan:l,licensePlan:T})}};e.on(ue,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(he,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await Te({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function Te(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,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 z=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))};var P=(e=>(e.image="image",e.video="video",e.external="external",e))(P||{});const k="lightGallery",te=`${k}-item`,D="data-lightgallery",ae=`${D}-item`,H="toggle",I={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>'},B={propKeys:[],props:{},traits:[]},M=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},W=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},we=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).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(" "),a)},Se={[H]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.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}},xe={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"}]}}},ke={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}]}}},Ie={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}]}}},f="sourceType",U="data-iframe",R={name:"href",type:"file",label:"Image Source"},N={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},F={name:"data-poster",label:"Video Poster",type:"file"},ne={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ce={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[H]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(k))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[N,F],external:[ne]},options:[{id:"image",label:R.label||"",icon:I.image},{id:"video",label:N.label||"",icon:I.video},{id:"external",label:ne.label||"",icon:I.external}]},subHtml:ce},Ae="lightGalleryComponent",le="lgThumbnail",Pe="lgVideo",oe="lgAutoplay",se="lgZoom",A="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ee=function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:I.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[le,Pe,oe,se],cdnScript:[`${A}/lightgallery.min.js`,`${A}/plugins/thumbnail/lg-thumbnail.min.js`,`${A}/plugins/video/lg-video.min.js`,`${A}/plugins/autoplay/lg-autoplay.min.js`,`${A}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${A}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:d,cdnScript:w,cdnStyle:O,inline:J,lgLicenseKey:pe,...y}=t||{},S=m=>isNaN(m)?void 0:parseInt(m,10),Q=()=>{var $;const m={...y,licenseKey:pe,speed:S(y.speed),startAnimationDuration:S(y.startAnimationDuration),thumbMargin:S(y.thumbMargin),thumbWidth:S(y.thumbWidth),slideShowInterval:S(y.slideShowInterval),scale:S(y.scale),enableZoomAfter:S(y.enableZoomAfter),plugins:(d||[]).map(K=>g[K])};J&&(m.container=o,m.closable=!1);const j=($=g.lightGallery)==null?void 0:$.call(g,o,m);J&&j.openGallery()};if(g.lightGallery)Q();else{const{head:m}=document,j=Array.isArray(w)?[...w]:[w],$=Array.isArray(O)?[...O]:[O],K=x=>{if(x.length){const v=document.createElement("link");v.href=x.shift(),v.rel="stylesheet",m.appendChild(v),K(x)}},X=x=>{if(x.length){const v=document.createElement("script");v.src=x.shift(),v.onerror=v.onload=X.bind(null,x),m.appendChild(v)}else Q()};K($),X(j)}},b=t=>{const o=t.getTrait(H);if(!h||!o)return;const{toolbar:g}=t,d={id:H,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(O=>O.id===d.id)&&(g==null||g.unshift(d))};let C=[];const T=r.plugins||[],_=M(Se),L=T.includes(le)?M(xe):B,G=T.includes(oe)?M(ke):B,V=T.includes(se)?M(Ie):B;n.addType(k,{block:p&&{label:s,media:I.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>z(t,D),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:I.gallery,draggable:(t,o)=>!o.is(k),attributes:{[D]:!0},components:{type:te},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",..._.propKeys,...L.propKeys,...G.propKeys,...V.propKeys],..._.props,...L.props,...G.props,...V.props,traits:[..._.traits,...L.traits,...G.traits,...V.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const t=n.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();C=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();C.forEach(o=>this.em.Canvas.addSpot(o.attributes)),C=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const q=M(Le);n.addType(te,{isComponent:t=>z(t,ae)||t.tagName==="A"&&z(t.parentElement,D),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:I.galleryItem,attributes:{[ae]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...q.props,traits:[...q.traits]},init(){const t=[f].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),we(this,f,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ce.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(k))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[f]||g){Z(this,f);const d=this.getTrait(f).getValue();if(d===P.image){this.removeAttributes([N.name,F.name,U]);const w=this.getTrait(R.name);w.setValue(w.getValue()||c)}else d===P.video?this.removeAttributes([U]):d===P.external&&this.addAttributes({[U]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[U]?this.set(f,P.external):(t[N.name]||t[F.name])&&this.set(f,P.video)}}}),fe({editor:e,plan:E.startup,licenseKey:r.licenseKey,pluginName:Ae,cleanup:()=>{a.remove(k),n.removeType(k)}})},Ce=ve(Ee);module.exports=Ce;
@@ -1,3 +1,4 @@
1
+ import "grapesjs";
1
2
  const ie = "app.grapesjs.com", re = "app-stage.grapesjs.com", Y = [
2
3
  ie,
3
4
  re,
@@ -9,12 +10,12 @@ const ie = "app.grapesjs.com", re = "app-stage.grapesjs.com", Y = [
9
10
  // For stackblitz.com demos
10
11
  "-sandpack.codesandbox.io"
11
12
  // For Sandpack demos
12
- ], ue = "license:check:start", he = "license:check:end", ge = () => typeof window < "u", be = ({ isDev: e, isStage: l }) => `${e ? "" : `https://${l ? re : ie}`}/api`, de = () => {
13
+ ], ue = "license:check:start", he = "license:check:end", ge = () => typeof window < "u", be = ({ isDev: e, isStage: l }) => `${e ? "" : `https://${l ? re : ie}`}/api`, me = () => {
13
14
  const e = ge() && window.location.hostname;
14
15
  return !!e && (Y.includes(e) || Y.some((l) => e.endsWith(l)));
15
16
  };
16
17
  var E = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(E || {});
17
- async function me({
18
+ async function de({
18
19
  path: e,
19
20
  baseApiUrl: l,
20
21
  method: a = "GET",
@@ -54,7 +55,7 @@ async function fe({
54
55
  cleanup: s
55
56
  }) {
56
57
  let u = "", r = !1;
57
- const p = de(), h = (i) => {
58
+ const p = me(), h = (i) => {
58
59
  console.warn("Cleanup plugin:", a, "Reason:", i), s();
59
60
  }, c = (i = {}) => {
60
61
  var L;
@@ -84,7 +85,7 @@ async function fe({
84
85
  async function Te(e) {
85
86
  const { licenseKey: l, pluginName: a, baseApiUrl: n } = e;
86
87
  try {
87
- return (await me({
88
+ return (await de({
88
89
  baseApiUrl: n,
89
90
  path: `/sdk/${l || "na"}`,
90
91
  method: "POST",
@@ -540,9 +541,9 @@ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-
540
541
  cdnStyle: `${A}/css/lightgallery-bundle.min.css`,
541
542
  ...l
542
543
  }, { block: p, toolbarIconOpen: h, defaultSrc: c } = r, i = function(t) {
543
- const o = this, g = window, { plugins: m, cdnScript: w, cdnStyle: O, inline: J, lgLicenseKey: pe, ...y } = t || {}, S = (d) => isNaN(d) ? void 0 : parseInt(d, 10), Q = () => {
544
+ const o = this, g = window, { plugins: d, cdnScript: w, cdnStyle: O, inline: J, lgLicenseKey: pe, ...y } = t || {}, S = (m) => isNaN(m) ? void 0 : parseInt(m, 10), Q = () => {
544
545
  var $;
545
- const d = {
546
+ const m = {
546
547
  ...y,
547
548
  licenseKey: pe,
548
549
  speed: S(y.speed),
@@ -552,24 +553,24 @@ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-
552
553
  slideShowInterval: S(y.slideShowInterval),
553
554
  scale: S(y.scale),
554
555
  enableZoomAfter: S(y.enableZoomAfter),
555
- plugins: (m || []).map((K) => g[K])
556
+ plugins: (d || []).map((K) => g[K])
556
557
  };
557
- J && (d.container = o, d.closable = !1);
558
- const j = ($ = g.lightGallery) == null ? void 0 : $.call(g, o, d);
558
+ J && (m.container = o, m.closable = !1);
559
+ const j = ($ = g.lightGallery) == null ? void 0 : $.call(g, o, m);
559
560
  J && j.openGallery();
560
561
  };
561
562
  if (g.lightGallery)
562
563
  Q();
563
564
  else {
564
- const { head: d } = document, j = Array.isArray(w) ? [...w] : [w], $ = Array.isArray(O) ? [...O] : [O], K = (x) => {
565
+ const { head: m } = document, j = Array.isArray(w) ? [...w] : [w], $ = Array.isArray(O) ? [...O] : [O], K = (x) => {
565
566
  if (x.length) {
566
567
  const v = document.createElement("link");
567
- v.href = x.shift(), v.rel = "stylesheet", d.appendChild(v), K(x);
568
+ v.href = x.shift(), v.rel = "stylesheet", m.appendChild(v), K(x);
568
569
  }
569
570
  }, X = (x) => {
570
571
  if (x.length) {
571
572
  const v = document.createElement("script");
572
- v.src = x.shift(), v.onerror = v.onload = X.bind(null, x), d.appendChild(v);
573
+ v.src = x.shift(), v.onerror = v.onload = X.bind(null, x), m.appendChild(v);
573
574
  } else
574
575
  Q();
575
576
  };
@@ -578,12 +579,12 @@ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-
578
579
  }, b = (t) => {
579
580
  const o = t.getTrait(H);
580
581
  if (!h || !o) return;
581
- const { toolbar: g } = t, m = {
582
+ const { toolbar: g } = t, d = {
582
583
  id: H,
583
584
  label: h,
584
585
  command: () => setTimeout(() => o.runCommand(), 100)
585
586
  };
586
- !g.find((O) => O.id === m.id) && (g == null || g.unshift(m));
587
+ !g.find((O) => O.id === d.id) && (g == null || g.unshift(d));
587
588
  };
588
589
  let C = [];
589
590
  const T = r.plugins || [], _ = M(Se), L = T.includes(le) ? M(xe) : B, G = T.includes(oe) ? M(ke) : B, V = T.includes(se) ? M(Ie) : B;
@@ -715,12 +716,12 @@ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-
715
716
  const { changed: o } = this, { init: g } = t;
716
717
  if (o[f] || g) {
717
718
  Z(this, f);
718
- const m = this.getTrait(f).getValue();
719
- if (m === P.image) {
719
+ const d = this.getTrait(f).getValue();
720
+ if (d === P.image) {
720
721
  this.removeAttributes([N.name, F.name, U]);
721
722
  const w = this.getTrait(R.name);
722
723
  w.setValue(w.getValue() || c);
723
- } else m === P.video ? this.removeAttributes([U]) : m === P.external && this.addAttributes({ [U]: !0 });
724
+ } else d === P.video ? this.removeAttributes([U]) : d === P.external && this.addAttributes({ [U]: !0 });
724
725
  }
725
726
  },
726
727
  initSourceType() {
@@ -730,14 +731,14 @@ const k = "lightGallery", te = `${k}-item`, D = "data-lightgallery", ae = `${D}-
730
731
  }
731
732
  }), fe({
732
733
  editor: e,
733
- plan: E.free,
734
+ plan: E.startup,
734
735
  licenseKey: r.licenseKey,
735
736
  pluginName: Ae,
736
737
  cleanup: () => {
737
738
  a.remove(k), n.removeType(k);
738
739
  }
739
740
  });
740
- }, Ce = ve(Ee);
741
+ }, Ge = ve(Ee);
741
742
  export {
742
- Ce as default
743
+ Ge as default
743
744
  };
@@ -1 +1 @@
1
- (function(L,A){typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(L=typeof globalThis<"u"?globalThis:L||self,L.StudioSdkPlugins_lightGalleryComponent=A())})(this,function(){"use strict";const L="app.grapesjs.com",A="app-stage.grapesjs.com",Q=[L,A,"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:l})=>`${e?"":`https://${l?A:L}`}/api`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(Q.includes(e)||Q.some(l=>e.endsWith(l)))};var P=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(P||{});async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:i,body:u}){const p=`${l||ge({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=i?new URLSearchParams(i).toString():"",s=c?`?${c}`:"",b=await fetch(`${p}${s}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const X={[P.free]:0,[P.startup]:10,[P.business]:20,[P.enterprise]:30};function me(e){const l=e;return l.init=a=>n=>e(n,a),l}const ye=e=>me(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:i}){let u="",r=!1;const p=be(),h=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),i()},c=(s={})=>{var G;const{error:b,sdkLicense:O}=s,S=(G=s.plan)==null?void 0:G.category;if(!(O||s.license)||b)h(b||"Invalid license");else if(S){const _=X[l],M=X[S];_>M&&h({pluginRequiredPlan:l,licensePlan:S})}};e.on(pe,s=>{u=s==null?void 0:s.baseApiUrl,r=!0}),e.on(ue,s=>{c(s)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const s=await ve({licenseKey:n,pluginName:a,baseApiUrl:u});s&&c(s)}else h("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,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 B=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))};var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",Y=`${T}-item`,K="data-lightgallery",ee=`${K}-item`,U="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>'},W={propKeys:[],props:{},traits:[]},V=(e,l={})=>{var i;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(i=h[c])==null||i.forEach(s=>{const b=s.id||s.name;a[b]=s.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),i=a.get("subTraits")||{},r=(Object.values(i).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=i[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},R=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const i=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(i,()=>Z(e,a)),Z(e,a)})},Te=(e,l,a)=>{const i=e.getTrait(l).get("subTraits")||{},r=(Object.values(i).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(" "),a)},we={[U]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.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}},Se={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"}]}}},xe={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}]}}},ke={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",D="data-iframe",F={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},q={name:"data-poster",label:"Video Poster",type:"file"},te={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ae={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Ie={[U]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var i,u;const a=l.target,n=(i=a==null?void 0:a.closestType(T))==null?void 0:i.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[F],video:[H,q],external:[te]},options:[{id:"image",label:F.label||"",icon:w.image},{id:"video",label:H.label||"",icon:w.video},{id:"external",label:te.label||"",icon:w.external}]},subHtml:ae},Le="lightGalleryComponent",ne="lgThumbnail",Ae="lgVideo",le="lgAutoplay",oe="lgZoom",C="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,l={}){const{Blocks:a,Components:n}=e,i="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,Ae,le,oe],cdnScript:[`${C}/lightgallery.min.js`,`${C}/plugins/thumbnail/lg-thumbnail.min.js`,`${C}/plugins/video/lg-video.min.js`,`${C}/plugins/autoplay/lg-autoplay.min.js`,`${C}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${C}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,s=function(t){const o=this,g=window,{plugins:y,cdnScript:x,cdnStyle:$,inline:se,lgLicenseKey:Pe,...f}=t||{},k=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var N;const d={...f,licenseKey:Pe,speed:k(f.speed),startAnimationDuration:k(f.startAnimationDuration),thumbMargin:k(f.thumbMargin),thumbWidth:k(f.thumbWidth),slideShowInterval:k(f.slideShowInterval),scale:k(f.scale),enableZoomAfter:k(f.enableZoomAfter),plugins:(y||[]).map(z=>g[z])};se&&(d.container=o,d.closable=!1);const J=(N=g.lightGallery)==null?void 0:N.call(g,o,d);se&&J.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,J=Array.isArray(x)?[...x]:[x],N=Array.isArray($)?[...$]:[$],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(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()};z(N),ce(J)}},b=t=>{const o=t.getTrait(U);if(!h||!o)return;const{toolbar:g}=t,y={id:U,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find($=>$.id===y.id)&&(g==null||g.unshift(y))};let O=[];const S=r.plugins||[],j=V(we),G=S.includes(ne)?V(Se):W,_=S.includes(le)?V(xe):W,M=S.includes(oe)?V(ke):W;n.addType(T,{block:p&&{label:i,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>B(t,K),extendFn:["init","initToolbar"],model:{defaults:{name:i,icon:w.gallery,draggable:(t,o)=>!o.is(T),attributes:{[K]:!0},components:{type:Y},script:s,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...j.propKeys,...G.propKeys,..._.propKeys,...M.propKeys],...j.props,...G.props,..._.props,...M.props,traits:[...j.traits,...G.traits,..._.traits,...M.traits]},init(){R(this,["thumbnail"]),R(this,["autoplay"]),R(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const t=n.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();O=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();O.forEach(o=>this.em.Canvas.addSpot(o.attributes)),O=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const ie=V(Ie);n.addType(Y,{isComponent:t=>B(t,ee)||t.tagName==="A"&&B(t.parentElement,K),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[ee]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...ie.props,traits:[...ie.traits]},init(){const t=[m].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Te(this,m,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ae.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(T))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[m]||g){Z(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([H.name,q.name,D]);const x=this.getTrait(F.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([D]):y===E.external&&this.addAttributes({[D]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[D]?this.set(m,E.external):(t[H.name]||t[q.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:P.free,licenseKey:r.licenseKey,pluginName:Le,cleanup:()=>{a.remove(T),n.removeType(T)}})})});
1
+ (function(L,A){typeof exports=="object"&&typeof module<"u"?module.exports=A(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],A):(L=typeof globalThis<"u"?globalThis:L||self,L.StudioSdkPlugins_lightGalleryComponent=A())})(this,function(){"use strict";const L="app.grapesjs.com",A="app-stage.grapesjs.com",Q=[L,A,"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:l})=>`${e?"":`https://${l?A:L}`}/api`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(Q.includes(e)||Q.some(l=>e.endsWith(l)))};var P=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(P||{});async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:i,body:u}){const p=`${l||ge({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=i?new URLSearchParams(i).toString():"",s=c?`?${c}`:"",b=await fetch(`${p}${s}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}const X={[P.free]:0,[P.startup]:10,[P.business]:20,[P.enterprise]:30};function me(e){const l=e;return l.init=a=>n=>e(n,a),l}const ye=e=>me(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:i}){let u="",r=!1;const p=be(),h=s=>{console.warn("Cleanup plugin:",a,"Reason:",s),i()},c=(s={})=>{var G;const{error:b,sdkLicense:O}=s,S=(G=s.plan)==null?void 0:G.category;if(!(O||s.license)||b)h(b||"Invalid license");else if(S){const _=X[l],M=X[S];_>M&&h({pluginRequiredPlan:l,licensePlan:S})}};e.on(pe,s=>{u=s==null?void 0:s.baseApiUrl,r=!0}),e.on(ue,s=>{c(s)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const s=await ve({licenseKey:n,pluginName:a,baseApiUrl:u});s&&c(s)}else h("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,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 B=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))};var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",Y=`${T}-item`,j="data-lightgallery",ee=`${j}-item`,K="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>'},W={propKeys:[],props:{},traits:[]},V=(e,l={})=>{var i;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(i=h[c])==null||i.forEach(s=>{const b=s.id||s.name;a[b]=s.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),i=a.get("subTraits")||{},r=(Object.values(i).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=i[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},R=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const i=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(i,()=>Z(e,a)),Z(e,a)})},Te=(e,l,a)=>{const i=e.getTrait(l).get("subTraits")||{},r=(Object.values(i).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(" "),a)},we={[K]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.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}},Se={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"}]}}},xe={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}]}}},ke={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",U="data-iframe",F={name:"href",type:"file",label:"Image Source"},D={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},q={name:"data-poster",label:"Video Poster",type:"file"},te={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ae={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Ie={[K]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var i,u;const a=l.target,n=(i=a==null?void 0:a.closestType(T))==null?void 0:i.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[F],video:[D,q],external:[te]},options:[{id:"image",label:F.label||"",icon:w.image},{id:"video",label:D.label||"",icon:w.video},{id:"external",label:te.label||"",icon:w.external}]},subHtml:ae},Le="lightGalleryComponent",ne="lgThumbnail",Ae="lgVideo",le="lgAutoplay",oe="lgZoom",C="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,l={}){const{Blocks:a,Components:n}=e,i="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,Ae,le,oe],cdnScript:[`${C}/lightgallery.min.js`,`${C}/plugins/thumbnail/lg-thumbnail.min.js`,`${C}/plugins/video/lg-video.min.js`,`${C}/plugins/autoplay/lg-autoplay.min.js`,`${C}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${C}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,s=function(t){const o=this,g=window,{plugins:y,cdnScript:x,cdnStyle:$,inline:se,lgLicenseKey:Pe,...f}=t||{},k=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var N;const d={...f,licenseKey:Pe,speed:k(f.speed),startAnimationDuration:k(f.startAnimationDuration),thumbMargin:k(f.thumbMargin),thumbWidth:k(f.thumbWidth),slideShowInterval:k(f.slideShowInterval),scale:k(f.scale),enableZoomAfter:k(f.enableZoomAfter),plugins:(y||[]).map(z=>g[z])};se&&(d.container=o,d.closable=!1);const J=(N=g.lightGallery)==null?void 0:N.call(g,o,d);se&&J.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,J=Array.isArray(x)?[...x]:[x],N=Array.isArray($)?[...$]:[$],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(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()};z(N),ce(J)}},b=t=>{const o=t.getTrait(K);if(!h||!o)return;const{toolbar:g}=t,y={id:K,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find($=>$.id===y.id)&&(g==null||g.unshift(y))};let O=[];const S=r.plugins||[],H=V(we),G=S.includes(ne)?V(Se):W,_=S.includes(le)?V(xe):W,M=S.includes(oe)?V(ke):W;n.addType(T,{block:p&&{label:i,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>B(t,j),extendFn:["init","initToolbar"],model:{defaults:{name:i,icon:w.gallery,draggable:(t,o)=>!o.is(T),attributes:{[j]:!0},components:{type:Y},script:s,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...H.propKeys,...G.propKeys,..._.propKeys,...M.propKeys],...H.props,...G.props,..._.props,...M.props,traits:[...H.traits,...G.traits,..._.traits,...M.traits]},init(){R(this,["thumbnail"]),R(this,["autoplay"]),R(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){const t=n.events.scriptUnmount;t&&this.listenTo(this.model,t,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();O=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();O.forEach(o=>this.em.Canvas.addSpot(o.attributes)),O=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const ie=V(Ie);n.addType(Y,{isComponent:t=>B(t,ee)||t.tagName==="A"&&B(t.parentElement,j),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[ee]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...ie.props,traits:[...ie.traits]},init(){const t=[m].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Te(this,m,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ae.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(T))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[m]||g){Z(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([D.name,q.name,U]);const x=this.getTrait(F.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([U]):y===E.external&&this.addAttributes({[U]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[U]?this.set(m,E.external):(t[D.name]||t[q.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:P.startup,licenseKey:r.licenseKey,pluginName:Le,cleanup:()=>{a.remove(T),n.removeType(T)}})})});
@@ -1,11 +1,11 @@
1
- "use strict";function x(e,s,i){let t,o,a,p,c;const r=s;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,c=e.apply(a,o),a=o=null)}const n=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),c};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},n}const E="page://",m="list-pages",d="list-pages-item",g="list-pages-link",R=e=>e.components().reduce((s,i)=>{var p;const t=i.findFirstType(g),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(E)?o.replace(E,""):"";if(a&&t){const c=s[a];c?c.push(t):s[a]=[t]}return s},{}),$="app.grapesjs.com",_="app-stage.grapesjs.com",k=[$,_,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",D="license:check:end",U=()=>typeof window<"u",W=({isDev:e,isStage:s})=>`${e?"":`https://${s?_:$}`}/api`,O=()=>{const e=U()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(s=>e.endsWith(s)))};var f=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(f||{});async function B({path:e,baseApiUrl:s,method:i="GET",headers:t={},params:o,body:a}){const c=`${s||W({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...t}};a&&(r.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",n=u?`?${u}`:"",l=await fetch(`${c}${n}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}const v={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function K(e){const s=e;return s.init=i=>t=>e(t,i),s}const j=e=>K(e);async function F({editor:e,plan:s,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=O(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),o()},u=(n={})=>{var P;const{error:l,sdkLicense:I}=n,h=(P=n.plan)==null?void 0:P.category;if(!(I||n.license)||l)r(l||"Invalid license");else if(h){const H=v[s],b=v[h];H>b&&r({pluginRequiredPlan:s,licensePlan:h})}};e.on(S,n=>{a=n==null?void 0:n.baseApiUrl,p=!0}),e.on(D,n=>{u(n)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const n=await G({licenseKey:t,pluginName:i,baseApiUrl:a});n&&u(n)}else r("The `licenseKey` option not provided")}},2e3)}async function G(e){const{licenseKey:s,pluginName:i,baseApiUrl:t}=e;try{return(await B({baseApiUrl:t,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 M="gjs-plg-",q="listPagesComponent",T="data-type-role",X="page_root",Y=e=>s=>s.is(e),Z=e=>(s,i)=>i.is(e),w=e=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,T))===e},J=function(e,s={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=s,c="List Pages",r="List Pages Item",u="Link",n=`${M}${m}`,l=`${M}${g}`,I='<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>',h='<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(m,{block:p&&{label:c,media:I,category:"Extra",select:!0,...s.block},isComponent:w(m),model:{defaults:{tagName:"ul",name:c,[X]:"",classes:n,attributes:{[T]:m},droppable:Y(d),styles:`
1
+ "use strict";require("grapesjs");function x(e,s,i){let t,o,a,p,c;const l=s;function u(){const r=Date.now()-p;r<l&&r>=0?t=setTimeout(u,l-r):(t=null,c=e.apply(a,o),a=o=null)}const n=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,l)),c};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},n}const E="page://",m="list-pages",d="list-pages-item",g="list-pages-link",R=e=>e.components().reduce((s,i)=>{var p;const t=i.findFirstType(g),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(E)?o.replace(E,""):"";if(a&&t){const c=s[a];c?c.push(t):s[a]=[t]}return s},{}),$="app.grapesjs.com",_="app-stage.grapesjs.com",k=[$,_,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",D="license:check:end",U=()=>typeof window<"u",W=({isDev:e,isStage:s})=>`${e?"":`https://${s?_:$}`}/api`,O=()=>{const e=U()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(s=>e.endsWith(s)))};var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});async function B({path:e,baseApiUrl:s,method:i="GET",headers:t={},params:o,body:a}){const c=`${s||W({isDev:!1,isStage:!1})}${e}`,l={method:i,headers:{"Content-Type":"application/json",...t}};a&&(l.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",n=u?`?${u}`:"",r=await fetch(`${c}${n}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}const v={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function K(e){const s=e;return s.init=i=>t=>e(t,i),s}const j=e=>K(e);async function F({editor:e,plan:s,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=O(),l=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),o()},u=(n={})=>{var P;const{error:r,sdkLicense:I}=n,f=(P=n.plan)==null?void 0:P.category;if(!(I||n.license)||r)l(r||"Invalid license");else if(f){const H=v[s],b=v[f];H>b&&l({pluginRequiredPlan:s,licensePlan:f})}};e.on(S,n=>{a=n==null?void 0:n.baseApiUrl,p=!0}),e.on(D,n=>{u(n)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const n=await G({licenseKey:t,pluginName:i,baseApiUrl:a});n&&u(n)}else l("The `licenseKey` option not provided")}},2e3)}async function G(e){const{licenseKey:s,pluginName:i,baseApiUrl:t}=e;try{return(await B({baseApiUrl:t,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 M="gjs-plg-",q="listPagesComponent",T="data-type-role",X="page_root",Y=e=>s=>s.is(e),Z=e=>(s,i)=>i.is(e),w=e=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,T))===e},J=function(e,s={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=s,c="List Pages",l="List Pages Item",u="Link",n=`${M}${m}`,r=`${M}${g}`,I='<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>',f='<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(m,{block:p&&{label:c,media:I,category:"Extra",select:!0,...s.block},isComponent:w(m),model:{defaults:{tagName:"ul",name:c,[X]:"",classes:n,attributes:{[T]:m},droppable:Y(d),styles:`
2
2
  .${n} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=x(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const y=this.em.Pages.getAll(),P=this.components(),H=R(this);y.forEach((b,N)=>{const V=b.id,A=b.getName(),L=H[V];L?L==null||L.forEach(C=>{C.getInnerHTML()!==A&&C.components(A)}):P.add({type:d,components:[{type:g,attributes:{href:`page://${V}`},components:{type:"textnode",content:A}}]},{at:N})})}}}),t.addType(d,{isComponent:w(d),model:{defaults:{name:r,tagName:"li",icon:h,attributes:{[T]:d},components:{type:g},draggable:Z(m)}}}),t.addType(g,{extend:"link",isComponent:w(g),model:{defaults:{removable:!1,copyable:!1,delegate:{move:y=>y.closestType(d)},name:u,classes:l,attributes:{[T]:g},components:{type:"textnode",content:"Item"},styles:`
8
- .${l} {
7
+ `},init(){this.syncPageItems=x(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const y=this.em.Pages.getAll(),P=this.components(),H=R(this);y.forEach((b,N)=>{const V=b.id,A=b.getName(),L=H[V];L?L==null||L.forEach(C=>{C.getInnerHTML()!==A&&C.components(A)}):P.add({type:d,components:[{type:g,attributes:{href:`page://${V}`},components:{type:"textnode",content:A}}]},{at:N})})}}}),t.addType(d,{isComponent:w(d),model:{defaults:{name:l,tagName:"li",icon:f,attributes:{[T]:d},components:{type:g},draggable:Z(m)}}}),t.addType(g,{extend:"link",isComponent:w(g),model:{defaults:{removable:!1,copyable:!1,delegate:{move:y=>y.closestType(d)},name:u,classes:r,attributes:{[T]:g},components:{type:"textnode",content:"Item"},styles:`
8
+ .${r} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),F({editor:e,licenseKey:a,plan:f.free,pluginName:q,cleanup:()=>{i.remove(m),t.removeType(m)}})},z=j(J);module.exports=z;
11
+ `}}}),F({editor:e,licenseKey:a,plan:h.startup,pluginName:q,cleanup:()=>{i.remove(m),t.removeType(m)}})},z=j(J);module.exports=z;
@@ -1,3 +1,4 @@
1
+ import "grapesjs";
1
2
  function x(e, s, i) {
2
3
  let t, o, a, p, c;
3
4
  const r = s;
@@ -216,13 +217,13 @@ const M = "gjs-plg-", q = "listPagesComponent", T = "data-type-role", X = "page_
216
217
  }), F({
217
218
  editor: e,
218
219
  licenseKey: a,
219
- plan: f.free,
220
+ plan: f.startup,
220
221
  pluginName: q,
221
222
  cleanup: () => {
222
223
  i.remove(m), t.removeType(m);
223
224
  }
224
225
  });
225
- }, z = j(J);
226
+ }, Q = j(J);
226
227
  export {
227
- z as default
228
+ Q as default
228
229
  };
@@ -1,5 +1,5 @@
1
- (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_listPagesComponent=g())})(this,function(){"use strict";function y(e,n,i){let t,o,a,p,c;const r=n;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,c=e.apply(a,o),a=o=null)}const s=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),c};return s.clear=function(){t&&(clearTimeout(t),t=null)},s.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},s}const g="page://",m="list-pages",f="list-pages-item",d="list-pages-link",N=e=>e.components().reduce((n,i)=>{var p;const t=i.findFirstType(d),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(g)?o.replace(g,""):"";if(a&&t){const c=n[a];c?c.push(t):n[a]=[t]}return n},{}),E="app.grapesjs.com",k="app-stage.grapesjs.com",v=[E,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",R="license:check:end",D=()=>typeof window<"u",U=({isDev:e,isStage:n})=>`${e?"":`https://${n?k:E}`}/api`,W=()=>{const e=D()&&window.location.hostname;return!!e&&(v.includes(e)||v.some(n=>e.endsWith(n)))};var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});async function O({path:e,baseApiUrl:n,method:i="GET",headers:t={},params:o,body:a}){const c=`${n||U({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...t}};a&&(r.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",s=u?`?${u}`:"",l=await fetch(`${c}${s}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}const M={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function B(e){const n=e;return n.init=i=>t=>e(t,i),n}const K=e=>B(e);async function j({editor:e,plan:n,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=W(),r=s=>{console.warn("Cleanup plugin:",i,"Reason:",s),o()},u=(s={})=>{var L;const{error:l,sdkLicense:w}=s,P=(L=s.plan)==null?void 0:L.category;if(!(w||s.license)||l)r(l||"Invalid license");else if(P){const C=M[n],I=M[P];C>I&&r({pluginRequiredPlan:n,licensePlan:P})}};e.on(S,s=>{a=s==null?void 0:s.baseApiUrl,p=!0}),e.on(R,s=>{u(s)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const s=await F({licenseKey:t,pluginName:i,baseApiUrl:a});s&&u(s)}else r("The `licenseKey` option not provided")}},2e3)}async function F(e){const{licenseKey:n,pluginName:i,baseApiUrl:t}=e;try{return(await O({baseApiUrl:t,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const _="gjs-plg-",G="listPagesComponent",b="data-type-role",q="page_root",X=e=>n=>n.is(e),Y=e=>(n,i)=>i.is(e),A=e=>n=>{var i;return((i=n.getAttribute)==null?void 0:i.call(n,b))===e};return K(function(e,n={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=n,c="List Pages",r="List Pages Item",u="Link",s=`${_}${m}`,l=`${_}${d}`,w='<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>',P='<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(m,{block:p&&{label:c,media:w,category:"Extra",select:!0,...n.block},isComponent:A(m),model:{defaults:{tagName:"ul",name:c,[q]:"",classes:s,attributes:{[b]:m},droppable:X(f),styles:`
2
- .${s} {
1
+ (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g(require("grapesjs")):typeof define=="function"&&define.amd?define(["grapesjs"],g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_listPagesComponent=g())})(this,function(){"use strict";function y(e,s,i){let t,o,a,p,c;const r=s;function u(){const l=Date.now()-p;l<r&&l>=0?t=setTimeout(u,r-l):(t=null,c=e.apply(a,o),a=o=null)}const n=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,r)),c};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},n}const g="page://",m="list-pages",f="list-pages-item",d="list-pages-link",N=e=>e.components().reduce((s,i)=>{var p;const t=i.findFirstType(d),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(g)?o.replace(g,""):"";if(a&&t){const c=s[a];c?c.push(t):s[a]=[t]}return s},{}),E="app.grapesjs.com",k="app-stage.grapesjs.com",v=[E,k,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",R="license:check:end",D=()=>typeof window<"u",U=({isDev:e,isStage:s})=>`${e?"":`https://${s?k:E}`}/api`,W=()=>{const e=D()&&window.location.hostname;return!!e&&(v.includes(e)||v.some(s=>e.endsWith(s)))};var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});async function j({path:e,baseApiUrl:s,method:i="GET",headers:t={},params:o,body:a}){const c=`${s||U({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...t}};a&&(r.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",n=u?`?${u}`:"",l=await fetch(`${c}${n}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}const M={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function O(e){const s=e;return s.init=i=>t=>e(t,i),s}const B=e=>O(e);async function K({editor:e,plan:s,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=W(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),o()},u=(n={})=>{var L;const{error:l,sdkLicense:w}=n,P=(L=n.plan)==null?void 0:L.category;if(!(w||n.license)||l)r(l||"Invalid license");else if(P){const C=M[s],I=M[P];C>I&&r({pluginRequiredPlan:s,licensePlan:P})}};e.on(S,n=>{a=n==null?void 0:n.baseApiUrl,p=!0}),e.on(R,n=>{u(n)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const n=await F({licenseKey:t,pluginName:i,baseApiUrl:a});n&&u(n)}else r("The `licenseKey` option not provided")}},2e3)}async function F(e){const{licenseKey:s,pluginName:i,baseApiUrl:t}=e;try{return(await j({baseApiUrl:t,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 _="gjs-plg-",G="listPagesComponent",b="data-type-role",q="page_root",X=e=>s=>s.is(e),Y=e=>(s,i)=>i.is(e),A=e=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,b))===e};return B(function(e,s={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=s,c="List Pages",r="List Pages Item",u="Link",n=`${_}${m}`,l=`${_}${d}`,w='<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>',P='<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(m,{block:p&&{label:c,media:w,category:"Extra",select:!0,...s.block},isComponent:A(m),model:{defaults:{tagName:"ul",name:c,[q]:"",classes:n,attributes:{[b]:m},droppable:X(f),styles:`
2
+ .${n} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
@@ -8,4 +8,4 @@
8
8
  .${l} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),j({editor:e,licenseKey:a,plan:h.free,pluginName:G,cleanup:()=>{i.remove(m),t.removeType(m)}})})});
11
+ `}}}),K({editor:e,licenseKey:a,plan:h.startup,pluginName:G,cleanup:()=>{i.remove(m),t.removeType(m)}})})});