@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.37

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 (92) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +185 -159
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/clientToolsProcessors.d.ts +1 -2
  5. package/dist/aiChat/components/utils.d.ts +1 -0
  6. package/dist/aiChat/components/utilsTw.d.ts +11 -0
  7. package/dist/aiChat/index.cjs.js +75 -75
  8. package/dist/aiChat/index.es.js +9122 -8628
  9. package/dist/aiChat/index.js +75 -75
  10. package/dist/aiChat/index.umd.js +75 -75
  11. package/dist/aiChat/projectGeneration.d.ts +17 -0
  12. package/dist/animationComponent/index.cjs.js +3 -3
  13. package/dist/animationComponent/index.es.js +221 -195
  14. package/dist/animationComponent/index.umd.js +3 -3
  15. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  16. package/dist/canvasAbsoluteMode/index.es.js +199 -173
  17. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  18. package/dist/canvasEmptyState/index.cjs.js +1 -1
  19. package/dist/canvasEmptyState/index.es.js +149 -123
  20. package/dist/canvasEmptyState/index.umd.js +1 -1
  21. package/dist/canvasFullSize/index.cjs.js +9 -9
  22. package/dist/canvasFullSize/index.es.js +186 -160
  23. package/dist/canvasFullSize/index.umd.js +9 -9
  24. package/dist/canvasGridMode/index.cjs.js +5 -5
  25. package/dist/canvasGridMode/index.es.js +263 -237
  26. package/dist/canvasGridMode/index.umd.js +2 -2
  27. package/dist/canvasScreenshot/index.cjs.js +1 -1
  28. package/dist/canvasScreenshot/index.es.js +168 -142
  29. package/dist/canvasScreenshot/index.umd.js +1 -1
  30. package/dist/dataSourceEjs/index.cjs.js +9 -9
  31. package/dist/dataSourceEjs/index.es.js +271 -245
  32. package/dist/dataSourceEjs/index.umd.js +9 -9
  33. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  34. package/dist/dataSourceHandlebars/index.es.js +232 -206
  35. package/dist/dataSourceHandlebars/index.umd.js +8 -8
  36. package/dist/dialogComponent/index.cjs.js +14 -14
  37. package/dist/dialogComponent/index.es.js +157 -131
  38. package/dist/dialogComponent/index.umd.js +14 -14
  39. package/dist/flexComponent/index.cjs.js +13 -13
  40. package/dist/flexComponent/index.es.js +497 -471
  41. package/dist/flexComponent/index.umd.js +13 -13
  42. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  43. package/dist/fsLightboxComponent/index.es.js +189 -163
  44. package/dist/fsLightboxComponent/index.umd.js +3 -3
  45. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  46. package/dist/googleFontsAssetProvider/index.es.js +175 -149
  47. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  48. package/dist/iconifyComponent/index.cjs.js +2 -2
  49. package/dist/iconifyComponent/index.es.js +207 -181
  50. package/dist/iconifyComponent/index.umd.js +2 -2
  51. package/dist/index.cjs.js +36 -36
  52. package/dist/index.es.js +917 -891
  53. package/dist/index.umd.js +36 -36
  54. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  55. package/dist/layoutSidebarButtons/index.es.js +192 -166
  56. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  57. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  58. package/dist/lightGalleryComponent/index.es.js +265 -239
  59. package/dist/lightGalleryComponent/index.umd.js +1 -1
  60. package/dist/linkImageComponent/index.cjs.js +2 -2
  61. package/dist/linkImageComponent/index.es.js +121 -95
  62. package/dist/linkImageComponent/index.umd.js +2 -2
  63. package/dist/listPagesComponent/index.cjs.js +5 -5
  64. package/dist/listPagesComponent/index.es.js +171 -145
  65. package/dist/listPagesComponent/index.umd.js +5 -5
  66. package/dist/presetPrintable/index.cjs.js +3 -3
  67. package/dist/presetPrintable/index.es.js +227 -201
  68. package/dist/presetPrintable/index.umd.js +3 -3
  69. package/dist/prosemirror/index.cjs.js +7 -7
  70. package/dist/prosemirror/index.es.js +457 -431
  71. package/dist/prosemirror/index.umd.js +8 -8
  72. package/dist/rendererReact/index.cjs.js +1 -1
  73. package/dist/rendererReact/index.es.js +248 -223
  74. package/dist/rendererReact/index.js +1 -1
  75. package/dist/rendererReact/index.umd.js +1 -1
  76. package/dist/rteTinyMce/index.cjs.js +2 -2
  77. package/dist/rteTinyMce/index.es.js +150 -124
  78. package/dist/rteTinyMce/index.umd.js +2 -2
  79. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  80. package/dist/shapeDividerComponent/index.es.js +143 -117
  81. package/dist/shapeDividerComponent/index.umd.js +4 -4
  82. package/dist/swiperComponent/index.cjs.js +9 -9
  83. package/dist/swiperComponent/index.es.js +218 -192
  84. package/dist/swiperComponent/index.umd.js +7 -7
  85. package/dist/tableComponent/index.cjs.js +1 -1
  86. package/dist/tableComponent/index.es.js +275 -249
  87. package/dist/tableComponent/index.umd.js +1 -1
  88. package/dist/types.d.ts +1 -1
  89. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  90. package/dist/youtubeAssetProvider/index.es.js +134 -108
  91. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  92. package/package.json +2 -2
@@ -1 +1 @@
1
- (function(h,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_layoutSidebarButtons=v())})(this,function(){"use strict";var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{}),v=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(v||{}),M=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(M||{});const k="app.grapesjs.com",R="app-stage.grapesjs.com",I=[k,"app2.grapesjs.com",R,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$="license:check:start",H="license:check:end",j=()=>typeof window<"u",W=({isDev:e,isStage:a,isPlatform:o})=>`${e?"":`https://${a?R:k}`}/${o?"platform-api":"api"}`,m=()=>{const e=j()&&window.location.hostname;return!!e&&(I.includes(e)||I.some(a=>e.endsWith(a)))};async function K({path:e,baseApiUrl:a,method:o="GET",headers:r={},params:s,body:P}){const d=`${a||W({isDev:!1,isStage:!1})}${e}`,b={method:o,headers:{"Content-Type":"application/json",...r}};P&&(b.body=JSON.stringify(P));const g=s?new URLSearchParams(s).toString():"",u=g?`?${g}`:"",t=await fetch(`${d}${u}`,b);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const x={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function V(e){const a=e;return a.init=o=>r=>e(r,o),a}const F=e=>V(e);async function q({editor:e,plan:a,pluginName:o,licenseKey:r,onLicenseCheckResponse:s,cleanup:P}){let f="",d=!1;const b=m(),g=t=>{console.warn("Cleanup plugin:",o,"Reason:",t),P()},u=(t={})=>{var i;const{error:B,sdkLicense:l}=t,c=(i=t.plan)==null?void 0:i.category;if(!(l||t.license)||B)g(B||"Invalid license");else if(c){const y=x[a],p=x[c];y>p&&g({pluginRequiredPlan:a,licensePlan:c})}};e.on($,t=>{f=t==null?void 0:t.baseApiUrl,d=!0}),e.on(H,t=>{s==null||s(t),u(t)}),setTimeout(async()=>{if(!d){if(b)return;if(r){const t=await C({licenseKey:r,pluginName:o,baseApiUrl:f});s==null||s(t),t&&u(t)}else g("The `licenseKey` option not provided")}},2e3)}async function C(e){const{licenseKey:a,pluginName:o,baseApiUrl:r}=e;try{return(await K({baseApiUrl:r,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}var T=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(T||{});const O="sidebarButtonsTarget",D=(e,a)=>{const{id:o,icon:r,label:s,tooltip:P,className:f,skipSelfClose:d,removeLayouts:b,layoutComponent:g,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:B}=a,l=o;return{id:E(o),type:"button",icon:r,tooltip:s||P,className:f,editorEvents:{[`${M.layoutToggleId}${l}`]:({fromEvent:c,setState:n,editor:i})=>{n({active:c.isOpen}),setTimeout(()=>i.refresh({tools:!0}),20)}},onClick:({editor:c,state:n})=>{var w;if(n.active&&d)return;const i=(u==null?void 0:u.placer)||{type:"static",layoutId:O},y={...i,skipCleanup:i.type==="static"},p=b||Object.keys(T).filter(G=>G!==l);N(c,{removeLayouts:p,layout:{placer:y}});const L={id:l,placer:i,header:(u==null?void 0:u.header)??{label:s,close:!d},layout:g,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},A=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...B,layoutCommand:L,sidebarButtonProps:e}))||L;c.runCommand(v.layoutToggle,{...A})}}},E=e=>`button__${e}`,N=(e,a={})=>{(a.removeLayouts||Object.keys(T)).forEach(r=>e.runCommand(v.layoutRemove,{id:r,layout:a.layout}))},_=e=>{const a=(e==null?void 0:e.breakpointTablet)??1024,o=(e==null?void 0:e.breakpointMobile)??768,r={},s=[{id:T.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:T.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:T.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:T.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:l,editor:c})=>{var p;const n=c.getSelected(),i={type:"image",src:l.src};let y;if(n!=null&&n.is("image"))return n.set("src",l.src);n&&c.Components.canMove(n,i)?y=n.append(i)[0]:n||(y=(p=c.getWrapper())==null?void 0:p.append(i)[0]),y&&c.select(y,{scroll:!0})}}}],P=[...s,{id:T.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],f={id:O,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},d={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},b={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},g=l=>({breakpoint:l,breakpointTablet:a,breakpointMobile:o}),u=(l,c,n)=>{const i=g(c),y={pluginOpts:e,breakpointProps:i},p=l.map(A=>{const w=D(A,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:A.id,buttonIds:T,buttonProps:w,sidebarButtonProps:A,...i,createSidebarButton:G=>D({...A,...G},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:T,sidebarButtons:p,...i,createSidebarButton:A=>D({...A,layoutCommand:{...n==null?void 0:n.layoutCommand,...A.layoutCommand}},y)}):p).filter(Boolean)},t=(l,c,n)=>{var p;const i=g(n),y={pluginOpts:e,breakpointProps:i};return((p=e==null?void 0:e.rootLayout)==null?void 0:p.call(e,{sidebarButtons:c,rootLayout:l,layoutSidebarLeft:d,layoutSidebarTarget:f,...i,createSidebarButton:L=>D({...L},y)}))??l};if(a){const l=u(P,a);r[a]=t({type:"row",style:{height:"100%"},children:[{...d,children:l},f,b]},l,a)}if(o){const l={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},c=P.map(i=>({...i,layoutCommand:l})),n=u(c,o,{layoutCommand:l});r[o]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:n}]},n,o)}const B=u(s,0);return{default:t({type:"row",style:{height:"100%"},children:[{...d,children:B},f,b,{type:"sidebarRight"}]},B,0),responsive:r}},U="layoutSidebarButtons",Z=h.free,S=F(function(e,a={}){const{Commands:o}=e,r=o.events,s={...a};(()=>{if(e.runCommand(v.layoutConfigGet)||s.skipLayoutConfig===!0)return;const d=_(s);e.runCommand(v.layoutConfigSet,{...d})})(),o.add(`${U}:toggleButton`,(f,d,b)=>{const g=document.getElementById(E(b==null?void 0:b.id));g==null||g.click()}),e.on(`${r.runCommand}core:preview`,()=>{N(e)}),q({editor:e,licenseKey:s.licenseKey,plan:Z,pluginName:U,cleanup:()=>{e.runCommand(v.layoutConfigSet)}})});return S.createLayoutConfig=e=>_(e),S});
1
+ (function(v,p){typeof exports=="object"&&typeof module<"u"?module.exports=p():typeof define=="function"&&define.amd?define(p):(v=typeof globalThis<"u"?globalThis:v||self,v.StudioSdkPlugins_layoutSidebarButtons=p())})(this,function(){"use strict";var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{}),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||{}),D=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(D||{});const G="app.grapesjs.com",M="app-stage.grapesjs.com",I=[G,"app2.grapesjs.com",M,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],m="license:check:end",H=()=>typeof window<"u",j=({isDev:e,isStage:o,isPlatform:a})=>`${e?"":`https://${o?M:G}`}/${a?"platform-api":"api"}`,S=()=>{if(!H())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},W=()=>{const e=S();return!!e&&(I.includes(e)||I.some(o=>e.endsWith(o)))};async function F({path:e,baseApiUrl:o,method:a="GET",headers:c={},params:i,body:T}){const r=`${o||j({isDev:!1,isStage:!1})}${e}`,d={method:a,headers:{"Content-Type":"application/json",...c}};T&&(d.body=JSON.stringify(T));const b=i?new URLSearchParams(i).toString():"",u=b?`?${b}`:"",t=await fetch(`${r}${u}`,d);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}const x={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function V(e){const o=e;return o.init=a=>c=>e(c,a),o}const C=e=>V(e);async function K({editor:e,plan:o,pluginName:a,licenseKey:c,onLicenseCheckResponse:i,cleanup:T}){let h="",r;const d=t=>{console.warn("Cleanup plugin:",a,"Reason:",t),T()},b=(t={})=>{var l;const{error:A,sdkLicense:s}=t,g=(l=t.plan)==null?void 0:l.category;if(!(s||t.license)||A)d(A||"Invalid license");else if(g){const y=x[o],f=x[g];y>f&&d({pluginRequiredPlan:o,licensePlan:g})}};e.Commands.has(p.settings)&&(r=e.runCommand(p.settings),h=(r==null?void 0:r.baseUrl)||"");const u=t=>{i==null||i(t),t&&b(t)};if(!r){e.onReady(async()=>{if(!W())if(c){const t=await Z({licenseKey:c,pluginName:a,baseApiUrl:h});u(t)}else d("The `licenseKey` option not provided")});return}if(r.licensePlan||r.licenseError){const t=q(r);u(t);return}e.on(m,t=>u(t))}const q=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Z(e){const{licenseKey:o,pluginName:a,baseApiUrl:c}=e;try{return(await F({baseApiUrl:c,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}}var P=(e=>(e.panelBlocks="panelBlocks",e.panelPagesLayers="panelPagesLayers",e.panelGlobalStyles="panelGlobalStyles",e.panelSidebarTabs="panelSidebarTabs",e.panelAssets="panelAssets",e.aiChatPanel="aiChatPanel",e.panelDataSources="panelDataSources",e))(P||{});const O="sidebarButtonsTarget",R=(e,o)=>{const{id:a,icon:c,label:i,tooltip:T,className:h,skipSelfClose:r,removeLayouts:d,layoutComponent:b,layoutCommand:u}=e,{pluginOpts:t,breakpointProps:A}=o,s=a;return{id:E(a),type:"button",icon:c,tooltip:i||T,className:h,editorEvents:{[`${D.layoutToggleId}${s}`]:({fromEvent:g,setState:n,editor:l})=>{n({active:g.isOpen}),setTimeout(()=>l.refresh({tools:!0}),20)}},onClick:({editor:g,state:n})=>{var w;if(n.active&&r)return;const l=(u==null?void 0:u.placer)||{type:"static",layoutId:O},y={...l,skipCleanup:l.type==="static"},f=d||Object.keys(P).filter(k=>k!==s);N(g,{removeLayouts:f,layout:{placer:y}});const B={id:s,placer:l,header:(u==null?void 0:u.header)??{label:i,close:!r},layout:b,style:{width:280,height:"100%",borderRightWidth:1,...u==null?void 0:u.style}},L=((w=t==null?void 0:t.sidebarLayoutCommand)==null?void 0:w.call(t,{...A,layoutCommand:B,sidebarButtonProps:e}))||B;g.runCommand(p.layoutToggle,{...L})}}},E=e=>`button__${e}`,N=(e,o={})=>{(o.removeLayouts||Object.keys(P)).forEach(c=>e.runCommand(p.layoutRemove,{id:c,layout:o.layout}))},U=e=>{const o=(e==null?void 0:e.breakpointTablet)??1024,a=(e==null?void 0:e.breakpointMobile)??768,c={},i=[{id:P.panelBlocks,icon:"plusBox",label:"Blocks",layoutComponent:{type:"panelBlocks"}},{id:P.panelPagesLayers,icon:"layers",label:"Pages & Layers",layoutComponent:{type:"panelPagesLayers"}},{id:P.panelGlobalStyles,icon:'<svg viewBox="0 0 24 24"> <path d="M20 14H6c-2.2 0-4 1.8-4 4s1.8 4 4 4h14a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2M6 20c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m.3-8L13 5.3a2 2 0 0 1 2.8 0l2.8 2.8c.8.8.8 2 0 2.8l-.9 1.1H6.3M2 13.5V4c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1.5l-8 8Z"/></svg>',label:"Global Styles",layoutComponent:{type:"panelGlobalStyles"}},{id:P.panelAssets,icon:'<svg viewBox="0 0 24 24"><path d="M22,16V4A2,2 0 0,0 20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16M11,12L13.03,14.71L16,11L20,16H8M2,6V20A2,2 0 0,0 4,22H18V20H4V6" /></svg>',label:"Assets",layoutComponent:{type:"panelAssets",content:{itemsPerRow:2,header:{addUrl:!1}},style:{padding:7},onSelect:({assetProps:s,editor:g})=>{var f;const n=g.getSelected(),l={type:"image",src:s.src};let y;if(n!=null&&n.is("image"))return n.set("src",s.src);n&&g.Components.canMove(n,l)?y=n.append(l)[0]:n||(y=(f=g.getWrapper())==null?void 0:f.append(l)[0]),y&&g.select(y,{scroll:!0})}}}],T=[...i,{id:P.panelSidebarTabs,layoutCommand:{header:!1},icon:'<svg viewBox="0 0 24 24"><path d="M17.5 12a1.5 1.5 0 0 1-1.5-1.5A1.5 1.5 0 0 1 17.5 9a1.5 1.5 0 0 1 1.5 1.5 1.5 1.5 0 0 1-1.5 1.5m-3-4A1.5 1.5 0 0 1 13 6.5 1.5 1.5 0 0 1 14.5 5 1.5 1.5 0 0 1 16 6.5 1.5 1.5 0 0 1 14.5 8m-5 0A1.5 1.5 0 0 1 8 6.5 1.5 1.5 0 0 1 9.5 5 1.5 1.5 0 0 1 11 6.5 1.5 1.5 0 0 1 9.5 8m-3 4A1.5 1.5 0 0 1 5 10.5 1.5 1.5 0 0 1 6.5 9 1.5 1.5 0 0 1 8 10.5 1.5 1.5 0 0 1 6.5 12M12 3a9 9 0 0 0-9 9 9 9 0 0 0 9 9 1.5 1.5 0 0 0 1.5-1.5c0-.4-.2-.7-.4-1-.2-.3-.4-.6-.4-1a1.5 1.5 0 0 1 1.5-1.5H16a5 5 0 0 0 5-5c0-4.4-4-8-9-8Z"/></svg>',label:"Styles & Props",layoutComponent:{type:"panelSidebarTabs"}}],h={id:O,type:"column",className:"gs-cmp-layout-sidebar-target",style:{overflow:"hidden"}},r={type:"sidebarLeft",resizable:!1,style:{padding:"10px 5px",alignItems:"center",width:45,gap:10},children:[]},d={type:"canvasSidebarTop",sidebarTop:{leftContainer:{buttons:[]}}},b=s=>({breakpoint:s,breakpointTablet:o,breakpointMobile:a}),u=(s,g,n)=>{const l=b(g),y={pluginOpts:e,breakpointProps:l},f=s.map(L=>{const w=R(L,y);return e!=null&&e.sidebarButton?e.sidebarButton({id:L.id,buttonIds:P,buttonProps:w,sidebarButtonProps:L,...l,createSidebarButton:k=>R({...L,...k},y)}):w}).filter(Boolean);return(e!=null&&e.sidebarButtons?e==null?void 0:e.sidebarButtons({buttonIds:P,sidebarButtons:f,...l,createSidebarButton:L=>R({...L,layoutCommand:{...n==null?void 0:n.layoutCommand,...L.layoutCommand}},y)}):f).filter(Boolean)},t=(s,g,n)=>{var f;const l=b(n),y={pluginOpts:e,breakpointProps:l};return((f=e==null?void 0:e.rootLayout)==null?void 0:f.call(e,{sidebarButtons:g,rootLayout:s,layoutSidebarLeft:r,layoutSidebarTarget:h,...l,createSidebarButton:B=>R({...B},y)}))??s};if(o){const s=u(T,o);c[o]=t({type:"row",style:{height:"100%"},children:[{...r,children:s},h,d]},s,o)}if(a){const s={placer:{type:"absolute",position:"left"},style:{height:"calc(100% - 40px)"}},g=T.map(l=>({...l,layoutCommand:s})),n=u(g,a,{layoutCommand:s});c[a]=t({type:"column",style:{height:"100%"},children:[{type:"sidebarTop",leftContainer:{buttons:[]}},{type:"canvas",grow:!0},{type:"sidebarBottom",style:{padding:"0 5px",alignItems:"center",gap:10,minHeight:39},children:n}]},n,a)}const A=u(i,0);return{default:t({type:"row",style:{height:"100%"},children:[{...r,children:A},h,d,{type:"sidebarRight"}]},A,0),responsive:c}},_="layoutSidebarButtons",z=v.free,$=C(function(e,o={}){const{Commands:a}=e,c=a.events,i={...o};(()=>{if(e.runCommand(p.layoutConfigGet)||i.skipLayoutConfig===!0)return;const r=U(i);e.runCommand(p.layoutConfigSet,{...r})})(),a.add(`${_}:toggleButton`,(h,r,d)=>{const b=document.getElementById(E(d==null?void 0:d.id));b==null||b.click()}),e.on(`${c.runCommand}core:preview`,()=>{N(e)}),K({editor:e,licenseKey:i.licenseKey,plan:z,pluginName:_,cleanup:()=>{e.runCommand(p.layoutConfigSet)}})});return $.createLayoutConfig=e=>U(e),$});
@@ -1 +1 @@
1
- "use strict";const se="app.grapesjs.com",re="app-stage.grapesjs.com",ue="app2.grapesjs.com",he="app-stage2.grapesjs.com",Y=[se,ue,re,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ge="license:check:start",be="license:check:end",me=()=>typeof window<"u",de=({isDev:e,isStage:n,isPlatform:t})=>`${e?"":`https://${n?re:se}`}/${t?"platform-api":"api"}`,ye=()=>{const e=me()&&window.location.hostname;return!!e&&(Y.includes(e)||Y.some(n=>e.endsWith(n)))};async function ve({path:e,baseApiUrl:n,method:t="GET",headers:l={},params:o,body:u}){const p=`${n||de({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 G=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(G||{});const ee={[G.free]:0,[G.startup]:10,[G.business]:20,[G.enterprise]:30};function fe(e){const n=e;return n.init=t=>l=>e(l,t),n}const Te=e=>fe(e);async function we({editor:e,plan:n,pluginName:t,licenseKey:l,onLicenseCheckResponse:o,cleanup:u}){let r="",p=!1;const h=ye(),c=s=>{console.warn("Cleanup plugin:",t,"Reason:",s),u()},b=(s={})=>{var k;const{error:P,sdkLicense:V}=s,T=(k=s.plan)==null?void 0:k.category;if(!(V||s.license)||P)c(P||"Invalid license");else if(T){const O=ee[n],$=ee[T];O>$&&c({pluginRequiredPlan:n,licensePlan:T})}};e.on(ge,s=>{r=s==null?void 0:s.baseApiUrl,p=!0}),e.on(be,s=>{o==null||o(s),b(s)}),setTimeout(async()=>{if(!p){if(h)return;if(l){const s=await Se({licenseKey:l,pluginName:t,baseApiUrl:r});o==null||o(s),s&&b(s)}else c("The `licenseKey` option not provided")}},2e3)}async function Se(e){const{licenseKey:n,pluginName:t,baseApiUrl:l}=e;try{return(await ve({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 B=(e,n)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,n))},xe="lightGalleryComponent",Ie=G.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const I="lightGallery",te=`${I}-item`,U="data-lightgallery",ae=`${U}-item`,j="toggle",A={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:[]},_=(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})},Z=(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)})},Ae=(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)},Pe={[j]:{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}},ke={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}]}}},Ee={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",K="data-iframe",q={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},J={name:"data-poster",label:"Video Poster",type:"file"},le={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ce={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Ge={[j]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var o,u;const t=n.target,l=(o=t==null?void 0:t.closestType(I))==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)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[q],video:[H,J],external:[le]},options:[{id:"image",label:q.label||"",icon:A.image},{id:"video",label:H.label||"",icon:A.video},{id:"external",label:le.label||"",icon:A.external}]},subHtml:ce},ne="lgThumbnail",Ve="lgVideo",oe="lgAutoplay",ie="lgZoom",L="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Oe=function(e,n={}){const{Blocks:t,Components:l}=e,o="LightGallery",u="LightGallery Item",r={toolbarIconOpen:A.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Ve,oe,ie],cdnScript:[`${L}/lightgallery.min.js`,`${L}/plugins/thumbnail/lg-thumbnail.min.js`,`${L}/plugins/video/lg-video.min.js`,`${L}/plugins/autoplay/lg-autoplay.min.js`,`${L}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${L}/css/lightgallery-bundle.min.css`,...n},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,b=function(a){const i=this,g=window,{plugins:d,cdnScript:w,cdnStyle:C,inline:R,lgLicenseKey:pe,...y}=a||{},S=m=>isNaN(m)?void 0:parseInt(m,10),Q=()=>{var D;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(N=>g[N])};R&&(m.container=i,m.closable=!1);const z=(D=g.lightGallery)==null?void 0:D.call(g,i,m);R&&z.openGallery()};if(g.lightGallery)Q();else{const{head:m}=document,z=Array.isArray(w)?[...w]:[w],D=Array.isArray(C)?[...C]:[C],N=x=>{if(x.length){const v=document.createElement("link");v.href=x.shift(),v.rel="stylesheet",m.appendChild(v),N(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()};N(D),X(z)}},s=a=>{const i=a.getTrait(j);if(!h||!i)return;const{toolbar:g}=a,d={id:j,label:h,command:()=>setTimeout(()=>i.runCommand(),100)};!g.find(C=>C.id===d.id)&&(g==null||g.unshift(d))};let P=[];const V=r.plugins||[],T=_(Pe),M=V.includes(ne)?_(ke):W,k=V.includes(oe)?_(Le):W,O=V.includes(ie)?_(Ee):W;l.addType(I,{block:p&&{label:o,media:A.gallery,category:"Extra",select:!0,...r.block},isComponent:a=>B(a,U),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:A.gallery,draggable:(a,i)=>!i.is(I),attributes:{[U]:!0},components:{type:te},script:b,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...T.propKeys,...M.propKeys,...k.propKeys,...O.propKeys],...T.props,...M.props,...k.props,...O.props,traits:[...T.traits,...M.traits,...k.traits,...O.traits]},init(){Z(this,["thumbnail"]),Z(this,["autoplay"]),Z(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();P=i.getSpots(),setTimeout(()=>i.removeSpots()),g.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();P.forEach(i=>this.em.Canvas.addSpot(i.attributes)),P=[],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 $=_(Ge);l.addType(te,{isComponent:a=>B(a,ae)||a.tagName==="A"&&B(a.parentElement,U),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:A.galleryItem,attributes:{[ae]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...$.props,traits:[...$.traits]},init(){const a=[f].map(i=>`change:${i}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ae(this,f,this.triggerGalleryUpdate)},initToolbar(){s(this)},initScriptUpdate(){const a=[ce.name].map(i=>`change:attributes:${i}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var i;(i=this.closestType(I))==null||i.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:i}=this,{init:g}=a;if(i[f]||g){F(this,f);const d=this.getTrait(f).getValue();if(d===E.image){this.removeAttributes([H.name,J.name,K]);const w=this.getTrait(q.name);w.setValue(w.getValue()||c)}else d===E.video?this.removeAttributes([K]):d===E.external&&this.addAttributes({[K]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[K]?this.set(f,E.external):(a[H.name]||a[J.name])&&this.set(f,E.video)}}}),we({editor:e,plan:Ie,licenseKey:r.licenseKey,pluginName:xe,cleanup:()=>{t.remove(I),l.removeType(I)}})},Ce=Te(Oe);module.exports=Ce;
1
+ "use strict";const re="app.grapesjs.com",ce="app-stage.grapesjs.com",ge="app2.grapesjs.com",he="app-stage2.grapesjs.com",ee=[re,ge,ce,he,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],be="license:check:end",de=()=>typeof window<"u",ye=({isDev:e,isStage:l,isPlatform:t})=>`${e?"":`https://${l?ce:re}`}/${t?"platform-api":"api"}`,me=()=>{if(!de())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},ve=()=>{const e=me();return!!e&&(ee.includes(e)||ee.some(l=>e.endsWith(l)))};async function fe({path:e,baseApiUrl:l,method:t="GET",headers:o={},params:n,body:g}){const i=`${l||ye({isDev:!1,isStage:!1})}${e}`,u={method:t,headers:{"Content-Type":"application/json",...o}};g&&(u.body=JSON.stringify(g));const p=n?new URLSearchParams(n).toString():"",b=p?`?${p}`:"",r=await fetch(`${i}${b}`,u);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var E=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(E||{}),Z=(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))(Z||{});const te={[E.free]:0,[E.startup]:10,[E.business]:20,[E.enterprise]:30};function Te(e){const l=e;return l.init=t=>o=>e(o,t),l}const we=e=>Te(e);async function xe({editor:e,plan:l,pluginName:t,licenseKey:o,onLicenseCheckResponse:n,cleanup:g}){let c="",i;const u=r=>{console.warn("Cleanup plugin:",t,"Reason:",r),g()},p=(r={})=>{var G;const{error:I,sdkLicense:O}=r,T=(G=r.plan)==null?void 0:G.category;if(!(O||r.license)||I)u(I||"Invalid license");else if(T){const M=te[l],_=te[T];M>_&&u({pluginRequiredPlan:l,licensePlan:T})}};e.Commands.has(Z.settings)&&(i=e.runCommand(Z.settings),c=(i==null?void 0:i.baseUrl)||"");const b=r=>{n==null||n(r),r&&p(r)};if(!i){e.onReady(async()=>{if(!ve())if(o){const r=await Ae({licenseKey:o,pluginName:t,baseApiUrl:c});b(r)}else u("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const r=Pe(i);b(r);return}e.on(be,r=>b(r))}const Pe=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function Ae(e){const{licenseKey:l,pluginName:t,baseApiUrl:o}=e;try{return(await fe({baseApiUrl:o,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(n){return console.error("Error during SDK license check:",n),!1}}const z=(e,l)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,l))},Le="lightGalleryComponent",Ie=E.startup;var S=(e=>(e.image="image",e.video="video",e.external="external",e))(S||{});const A="lightGallery",ae=`${A}-item`,j="data-lightgallery",oe=`${j}-item`,N="toggle",L={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>'},F={propKeys:[],props:{},traits:[]},V=(e,l={})=>{var n;const t={},o=[];for(const g in e){const{value:c,...i}=e[g];o.push({id:g,name:g,changeProp:!0,category:l.category,...i}),t[g]=c;const{subTraits:u={}}=i;for(const p in i.subTraits)(n=u[p])==null||n.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"),n=t.get("subTraits")||{},c=(Object.values(n).flat()||[]).map(p=>p.id||p.name);e.removeTrait(c);const i=n[t.getValue()],u=e.getTraitIndex(l)+1;i&&e.addTrait(i.map(p=>({category:o,...p})),{at:u})},W=(e,l)=>{l.forEach(t=>{const o=e.getTrait(t);if(!o||!o.get("subTraits"))return;const n=o.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(n,()=>q(e,t)),q(e,t)})},Ge=(e,l,t)=>{const n=e.getTrait(l).get("subTraits")||{},c=(Object.values(n).flat()||[]).map(u=>{const p=u.name||u.id;return u.changeProp?`change:${p}`:`change:attributes:${p}`}),i=Array.from(new Set(c));i.length&&e.on(i.join(" "),t)},ke={[N]:{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}},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"}]}}},Ee={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}]}}},Oe={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",J={name:"href",type:"file",label:"Image Source"},H={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},C={name:"data-poster",label:"Video Poster",type:"file"},le={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},pe={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Me={[N]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var n,g;const t=l.target,o=(n=t==null?void 0:t.closestType(A))==null?void 0:n.getView();if(o&&t){const c=((g=o.getLightGallery())==null?void 0:g.items)||[],i=Array.from(c).indexOf(t.getEl());i>=0&&o.toggleGallery(i)}}},[f]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[J],video:[H,C],external:[le]},options:[{id:"image",label:J.label||"",icon:L.image},{id:"video",label:H.label||"",icon:L.video},{id:"external",label:le.label||"",icon:L.external}]},subHtml:pe},se="lgThumbnail",De="lgVideo",ne="lgAutoplay",ie="lgZoom",k="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2",Ve=function(e,l={}){const{Blocks:t,Components:o}=e,n="LightGallery",g="LightGallery Item",c={toolbarIconOpen:L.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[se,De,ne,ie],cdnScript:[`${k}/lightgallery.min.js`,`${k}/plugins/thumbnail/lg-thumbnail.min.js`,`${k}/plugins/video/lg-video.min.js`,`${k}/plugins/autoplay/lg-autoplay.min.js`,`${k}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${k}/css/lightgallery-bundle.min.css`,...l},{block:i,toolbarIconOpen:u,defaultSrc:p}=c,b=function(a){const s=this,h=window,{plugins:y,cdnScript:w,cdnStyle:D,inline:Q,lgLicenseKey:ue,...m}=a||{},x=d=>isNaN(d)?void 0:parseInt(d,10),X=()=>{var B;const d={...m,licenseKey:ue,speed:x(m.speed),startAnimationDuration:x(m.startAnimationDuration),thumbMargin:x(m.thumbMargin),thumbWidth:x(m.thumbWidth),slideShowInterval:x(m.slideShowInterval),scale:x(m.scale),enableZoomAfter:x(m.enableZoomAfter),plugins:(y||[]).map($=>h[$])};Q&&(d.container=s,d.closable=!1);const K=(B=h.lightGallery)==null?void 0:B.call(h,s,d);Q&&K.openGallery()};if(h.lightGallery)X();else{const{head:d}=document,K=Array.isArray(w)?[...w]:[w],B=Array.isArray(D)?[...D]:[D],$=P=>{if(P.length){const v=document.createElement("link");v.href=P.shift(),v.rel="stylesheet",d.appendChild(v),$(P)}},Y=P=>{if(P.length){const v=document.createElement("script");v.src=P.shift(),v.onerror=v.onload=Y.bind(null,P),d.appendChild(v)}else X()};$(B),Y(K)}},r=a=>{const s=a.getTrait(N);if(!u||!s)return;const{toolbar:h}=a,y={id:N,label:u,command:()=>setTimeout(()=>s.runCommand(),100)};!h.find(D=>D.id===y.id)&&(h==null||h.unshift(y))};let I=[];const O=c.plugins||[],T=V(ke),R=O.includes(se)?V(Se):F,G=O.includes(ne)?V(Ee):F,M=O.includes(ie)?V(Oe):F;o.addType(A,{block:i&&{label:n,media:L.gallery,category:"Extra",select:!0,...c.block},isComponent:a=>z(a,j),extendFn:["init","initToolbar"],model:{defaults:{name:n,icon:L.gallery,draggable:(a,s)=>!s.is(A),attributes:{[j]:!0},components:{type:ae},script:b,selector:"",exThumbImage:"",cdnScript:c.cdnScript,cdnStyle:c.cdnStyle,plugins:c.plugins,lgLicenseKey:c.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...T.propKeys,...R.propKeys,...G.propKeys,...M.propKeys],...T.props,...R.props,...G.props,...M.props,traits:[...T.traits,...R.traits,...G.traits,...M.traits]},init(){W(this,["thumbnail"]),W(this,["autoplay"]),W(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();I=s.getSpots(),setTimeout(()=>s.removeSpots()),h.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();I.forEach(s=>this.em.Canvas.addSpot(s.attributes)),I=[],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 _=V(Me);o.addType(ae,{isComponent:a=>z(a,oe)||a.tagName==="A"&&z(a.parentElement,j),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:g,icon:L.galleryItem,attributes:{[oe]:!0,href:p},components:{type:"image",attributes:{alt:"Image",src:p}},..._.props,traits:[..._.traits]},init(){const a=[f].map(s=>`change:${s}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Ge(this,f,this.triggerGalleryUpdate)},initToolbar(){r(this)},initScriptUpdate(){const a=[pe.name].map(s=>`change:attributes:${s}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var s;(s=this.closestType(A))==null||s.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:s}=this,{init:h}=a;if(s[f]||h){q(this,f);const y=this.getTrait(f).getValue();if(y===S.image){this.removeAttributes([H.name,C.name,U]);const w=this.getTrait(J.name);w.setValue(w.getValue()||p)}else y===S.video?this.removeAttributes([U]):y===S.external&&this.addAttributes({[U]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[U]?this.set(f,S.external):(a[H.name]||a[C.name])&&this.set(f,S.video)}}}),xe({editor:e,plan:Ie,licenseKey:c.licenseKey,pluginName:Le,cleanup:()=>{t.remove(A),o.removeType(A)}})},Re=we(Ve);module.exports=Re;