domma-cms 0.9.6 → 0.10.0

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.
package/admin/js/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import{getSidebarConfig as Y}from"./config/sidebar-config.js";import{views as q}from"./views/index.js";import{api as o,getUser as m,isAuthenticated as c,logout as z}from"./api.js";$(()=>{(async()=>{try{const t=c()?await o.settings.get():null;Domma.theme.init({theme:t?.adminTheme||"charcoal-dark",persist:!0})}catch{Domma.theme.init({theme:"charcoal-dark",persist:!0})}})();const N=["jb-company","jb-agent","jb-candidate"],W=["/job-board","/my-profile"];function b(t){return t&&N.includes(t.role)}function w(t){return W.some(e=>t===e||t.startsWith(e+"/"))}R.use(async(t,e,a)=>{if(t.path==="/login"||t.path==="/reset-password")return a();if(!c()){R.navigate("/login");return}if(b(m())&&!w(t.path)){R.navigate("/job-board");return}a()});let p=null;async function I(){if(!c())return{};try{const[t,e,a,i,s,n,h,g,u,C,r,d,F]=await Promise.all([o.pages.list().catch(()=>[]),o.media.list().catch(()=>[]),o.users.list().catch(()=>[]),o.plugins.list().catch(()=>[]),o.collections.list().catch(()=>[]),o.forms.list().catch(()=>[]),o.themes.list().catch(()=>[]),o.views.list().catch(()=>[]),o.actions.list().catch(()=>[]),o.blocks.list().catch(()=>[]),o.navigation.get().catch(()=>({})),o.layouts.get().catch(()=>({})),o.get("/collections/roles/entries?limit=100").catch(()=>({entries:[]}))]),T=r.items||[],J=T.filter(D=>!D.hidden).length,L=T.length,H=i.filter(D=>D.enabled).length,B=i.length;return{pages:t.length,media:e.length,users:a.length,plugins:B>0?`${H}/${B}`:null,collections:s.length,forms:n.length,themes:h.length,views:g.length,actions:u.length,blocks:C.length,navigation:L>0?`${J}/${L}`:null,layouts:Object.keys(d).length,roles:(F.entries||[]).length}}catch{return{}}}async function y(){try{return(await o.get("/auth/permissions")).permissions||[]}catch{return[]}}async function V(){try{return await o.get("/settings/db-status")}catch{return{configured:!1}}}async function k(t){p&&$("#admin-sidebar").empty();const[e,a,i]=await Promise.all([I(),V(),c()?o.settings.get().catch(()=>({})):Promise.resolve({})]),s=i.adminBrand||{},n=s.title||"CMS Admin",h=s.icon||"layout",g=s.logo||"",u=$("#admin-topbar .topbar-brand");g?u.html(`<img src="${l(g)}" class="topbar-brand-logo" alt="${l(n)}"><span class="topbar-brand-text">${l(n)}</span>`):u.html(`<span data-icon="${l(h)}"></span><span class="topbar-brand-text">${l(n)}</span>`),Domma.icons.scan("#admin-topbar .topbar-brand");const C=A.map(r=>{if(!r.countKey)return r;const d=e[r.countKey];return{...r,badge:d!=null&&d>0?String(d):null}});if(p=Domma.elements.sidebar("#admin-sidebar",{header:{title:n,icon:h},items:Y(t,e,C),collapsible:!0,collapseAt:992,push:!0,contentSelector:".dashboard-main",top:"60px"}),K(),O(),a?.configured){const r=$("#admin-sidebar").find(".sidebar-header-title").first();r.length&&!r.find(".db-badge").length&&r.append('<span class="db-badge" title="MongoDB connected" style="display:inline-flex;align-items:center;background:#16a34a;color:#fff;font-size:10px;font-weight:700;padding:2px 6px;border-radius:9999px;letter-spacing:.5px;margin-left:6px;vertical-align:middle;line-height:1;">DB</span>')}}function K(){$("#admin-sidebar .sidebar-link").each(function(){const t=$(this).find(".sidebar-text").text().trim();t&&$(this).attr("data-tooltip",t)}),E.tooltip("#admin-sidebar [data-tooltip]",{placement:"right"})}function O(){const t="sidebar_collapsed_sections",e=new Set(S.get(t)||[]);$("#admin-sidebar .sidebar-heading").each(function(){const a=$(this);a.addClass("sidebar-heading--collapsible"),a.append('<span class="sidebar-heading-toggle"><span data-icon="chevron-down"></span></span>');const i=a.text().trim();if(e.has(i)){a.addClass("is-collapsed");let s=a.next();for(;s.length&&!s.hasClass("sidebar-heading")&&!s.hasClass("sidebar-divider");)s.hide(),s=s.next()}a.on("click",function(){const s=!a.hasClass("is-collapsed");a.toggleClass("is-collapsed",s);let n=a.next();for(;n.length&&!n.hasClass("sidebar-heading")&&!n.hasClass("sidebar-divider");)n.toggle(!s),n=n.next();s?e.add(i):e.delete(i),S.set(t,[...e])})}),Domma.icons.scan("#admin-sidebar")}M.subscribe("router:afterChange",({to:t})=>{p&&t.path!=="/login"&&t.path!=="/reset-password"&&p.setActive("#"+t.path)});const U=[{path:"/",view:"dashboard",title:"Dashboard - Domma CMS"},{path:"/pages",view:"pages",title:"Pages - Domma CMS"},{path:"/pages/new",view:"pageEditor",title:"New Page - Domma CMS"},{path:"/pages/edit/*",view:"pageEditor",title:"Edit Page - Domma CMS"},{path:"/media",view:"media",title:"Media - Domma CMS"},{path:"/navigation",view:"navigation",title:"Navigation - Domma CMS"},{path:"/layouts",view:"layouts",title:"Layouts - Domma CMS"},{path:"/settings",view:"settings",title:"Settings - Domma CMS"},{path:"/users",view:"users",title:"Users - Domma CMS"},{path:"/users/new",view:"userEditor",title:"New User - Domma CMS"},{path:"/users/edit/:id",view:"userEditor",title:"Edit User - Domma CMS"},{path:"/plugins",view:"plugins",title:"Plugins - Domma CMS"},{path:"/documentation",view:"documentation",title:"Usage - Domma CMS"},{path:"/tutorials",view:"tutorials",title:"Tutorials - Domma CMS"},{path:"/api-reference",view:"apiReference",title:"API Reference - Domma CMS"},{path:"/collections",view:"collections",title:"Collections - Domma CMS"},{path:"/collections/new",view:"collectionEditor",title:"New Collection - Domma CMS"},{path:"/collections/edit/:slug",view:"collectionEditor",title:"Edit Collection - Domma CMS"},{path:"/collections/:slug/entries",view:"collectionEntries",title:"Entries - Domma CMS"},{path:"/forms",view:"forms",title:"Forms - Domma CMS"},{path:"/forms/new",view:"formEditor",title:"New Form - Domma CMS"},{path:"/forms/edit/:slug",view:"formEditor",title:"Edit Form - Domma CMS"},{path:"/forms/:slug/submissions",view:"formSubmissions",title:"Submissions - Domma CMS"},{path:"/views",view:"viewsList",title:"Views - Domma CMS"},{path:"/views/new",view:"viewEditor",title:"New View - Domma CMS"},{path:"/views/edit/:slug",view:"viewEditor",title:"Edit View - Domma CMS"},{path:"/views/:slug/preview",view:"viewPreview",title:"View Preview - Domma CMS"},{path:"/actions",view:"actionsList",title:"Actions - Domma CMS"},{path:"/actions/new",view:"actionEditor",title:"New Action - Domma CMS"},{path:"/actions/edit/:slug",view:"actionEditor",title:"Edit Action - Domma CMS"},{path:"/pro/docs",view:"proDocs",title:"Pro Documentation - Domma CMS"},{path:"/blocks",view:"blocks",title:"Blocks - Domma CMS"},{path:"/blocks/new",view:"blockEditor",title:"New Block - Domma CMS"},{path:"/blocks/edit/:name",view:"blockEditor",title:"Edit Block - Domma CMS"},{path:"/my-profile",view:"myProfile",title:"My Profile - Domma CMS"},{path:"/roles",view:"roles",title:"Roles & Permissions - Domma CMS"},{path:"/roles/edit/:id",view:"roleEditor",title:"Edit Role - Domma CMS"},{path:"/effects",view:"effects",title:"Effects - Domma CMS"},{path:"/login",view:"login",title:"Sign in - Domma CMS",onEnter:()=>{$("#admin-sidebar").hide(),$("#admin-topbar").hide()}},{path:"/reset-password",view:"login",title:"Reset Password - Domma CMS",onEnter:()=>{$("#admin-sidebar").hide(),$("#admin-topbar").hide()}}];M.subscribe("router:afterChange",async({to:t,from:e})=>{if(!(t.path==="/login"||t.path==="/reset-password")){if(b(m())&&!w(t.path)){R.navigate("/job-board");return}if($("#admin-sidebar").show(),$("#admin-topbar").show(),e?.path==="/login"||e?.path==="/reset-password"){$("#topbar-user-name").remove(),await j();const a=await y();k(a)}_()}}),M.subscribe("router:afterChange",()=>{setTimeout(()=>{$(".btn-primary, .btn-danger").length&&Domma.effects.reveal(".btn-primary, .btn-danger",{animation:"fade",stagger:40,duration:300})},50)});const x="cms_card_states",f=S.get(x)||{};M.subscribe("router:afterChange",()=>{setTimeout(()=>{$("#view-container .card-collapsible").each(function(){const t=$(this).find(".card-header h2, .card-header h3").first().text().trim();t&&f[t]==="collapsed"&&$(this).addClass("card-collapsed")})},200)}),$("#view-container").on("click",".card-collapsible .card-header",function(t){if($(t.target).closest("button, a").length)return;const e=$(this).closest(".card");e.toggleClass("card-collapsed");const a=$(this).find("h2, h3").first().text().trim();a&&(f[a]=e.hasClass("card-collapsed")?"collapsed":"open",S.set(x,f))}),document.addEventListener("keydown",t=>{if(!(t.ctrlKey||t.metaKey)||t.key!=="s"||window.location.hash==="#/login"||window.location.hash.startsWith("#/reset-password"))return;const e=document.querySelector("#view-container .view-header button.btn-primary");e&&(t.preventDefault(),e.click())});const P={...q},v=[...U];let A=[];async function j(){if(c())try{const t=await o.plugins.adminConfig();A=t.sidebar||[],t.routes?.length&&v.push(...t.routes);for(const[e,a]of Object.entries(t.views||{}))try{const i=await import(`/plugins/${a.entry}`);P[e]=i[a.exportName]}catch{}}catch{}}function _(){const t=m();if(!t||$("#topbar-user-name").length)return;const a={admin:"Admin",manager:"Manager",editor:"Editor",subscriber:"Subscriber","jb-company":"Company","jb-agent":"Agent","jb-candidate":"Candidate"}[t.role]||t.role;$("#topbar-user").html(`
1
+ import{getSidebarConfig as Y}from"./config/sidebar-config.js";import{views as q}from"./views/index.js?v=4";import{api as n,getUser as m,isAuthenticated as c,logout as z}from"./api.js";$(()=>{(async()=>{try{const t=c()?await n.settings.get():null;Domma.theme.init({theme:t?.adminTheme||"charcoal-dark",persist:!0})}catch{Domma.theme.init({theme:"charcoal-dark",persist:!0})}})();const N=["jb-company","jb-agent","jb-candidate"],W=["/job-board","/my-profile"];function b(t){return t&&N.includes(t.role)}function w(t){return W.some(e=>t===e||t.startsWith(e+"/"))}R.use(async(t,e,a)=>{if(t.path==="/login"||t.path==="/reset-password")return a();if(!c()){R.navigate("/login");return}if(b(m())&&!w(t.path)){R.navigate("/job-board");return}a()});let p=null;async function I(){if(!c())return{};try{const[t,e,a,i,s,o,h,g,u,C,r,d,F]=await Promise.all([n.pages.list().catch(()=>[]),n.media.list().catch(()=>[]),n.users.list().catch(()=>[]),n.plugins.list().catch(()=>[]),n.collections.list().catch(()=>[]),n.forms.list().catch(()=>[]),n.themes.list().catch(()=>[]),n.views.list().catch(()=>[]),n.actions.list().catch(()=>[]),n.blocks.list().catch(()=>[]),n.navigation.get().catch(()=>({})),n.layouts.get().catch(()=>({})),n.get("/collections/roles/entries?limit=100").catch(()=>({entries:[]}))]),T=r.items||[],J=T.filter(D=>!D.hidden).length,L=T.length,H=i.filter(D=>D.enabled).length,B=i.length;return{pages:t.length,media:e.length,users:a.length,plugins:B>0?`${H}/${B}`:null,collections:s.length,forms:o.length,themes:h.length,views:g.length,actions:u.length,blocks:C.length,navigation:L>0?`${J}/${L}`:null,layouts:Object.keys(d).length,roles:(F.entries||[]).length}}catch{return{}}}async function y(){try{return(await n.get("/auth/permissions")).permissions||[]}catch{return[]}}async function V(){try{return await n.get("/settings/db-status")}catch{return{configured:!1}}}async function k(t){p&&$("#admin-sidebar").empty();const[e,a,i]=await Promise.all([I(),V(),c()?n.settings.get().catch(()=>({})):Promise.resolve({})]),s=i.adminBrand||{},o=s.title||"CMS Admin",h=s.icon||"layout",g=s.logo||"",u=$("#admin-topbar .topbar-brand");g?u.html(`<img src="${l(g)}" class="topbar-brand-logo" alt="${l(o)}"><span class="topbar-brand-text">${l(o)}</span>`):u.html(`<span data-icon="${l(h)}"></span><span class="topbar-brand-text">${l(o)}</span>`),Domma.icons.scan("#admin-topbar .topbar-brand");const C=A.map(r=>{if(!r.countKey)return r;const d=e[r.countKey];return{...r,badge:d!=null&&d>0?String(d):null}});if(p=Domma.elements.sidebar("#admin-sidebar",{header:{title:o,icon:h},items:Y(t,e,C),collapsible:!0,collapseAt:992,push:!0,contentSelector:".dashboard-main",top:"60px"}),K(),O(),a?.configured){const r=$("#admin-sidebar").find(".sidebar-header-title").first();r.length&&!r.find(".db-badge").length&&r.append('<span class="db-badge" title="MongoDB connected" style="display:inline-flex;align-items:center;background:#16a34a;color:#fff;font-size:10px;font-weight:700;padding:2px 6px;border-radius:9999px;letter-spacing:.5px;margin-left:6px;vertical-align:middle;line-height:1;">DB</span>')}}function K(){$("#admin-sidebar .sidebar-link").each(function(){const t=$(this).find(".sidebar-text").text().trim();t&&E.tooltip(this,{content:t,position:"right"})})}function O(){const t="sidebar_collapsed_sections",e=new Set(S.get(t)||[]);$("#admin-sidebar .sidebar-heading").each(function(){const a=$(this);a.addClass("sidebar-heading--collapsible"),a.append('<span class="sidebar-heading-toggle"><span data-icon="chevron-down"></span></span>');const i=a.text().trim();if(e.has(i)){a.addClass("is-collapsed");let s=a.next();for(;s.length&&!s.hasClass("sidebar-heading")&&!s.hasClass("sidebar-divider");)s.hide(),s=s.next()}a.on("click",function(){const s=!a.hasClass("is-collapsed");a.toggleClass("is-collapsed",s);let o=a.next();for(;o.length&&!o.hasClass("sidebar-heading")&&!o.hasClass("sidebar-divider");)o.toggle(!s),o=o.next();s?e.add(i):e.delete(i),S.set(t,[...e])})}),Domma.icons.scan("#admin-sidebar")}M.subscribe("router:afterChange",({to:t})=>{p&&t.path!=="/login"&&t.path!=="/reset-password"&&p.setActive("#"+t.path)});const U=[{path:"/",view:"dashboard",title:"Dashboard - Domma CMS"},{path:"/pages",view:"pages",title:"Pages - Domma CMS"},{path:"/pages/new",view:"pageEditor",title:"New Page - Domma CMS"},{path:"/pages/edit/*",view:"pageEditor",title:"Edit Page - Domma CMS"},{path:"/media",view:"media",title:"Media - Domma CMS"},{path:"/navigation",view:"navigation",title:"Navigation - Domma CMS"},{path:"/layouts",view:"layouts",title:"Layouts - Domma CMS"},{path:"/settings",view:"settings",title:"Settings - Domma CMS"},{path:"/users",view:"users",title:"Users - Domma CMS"},{path:"/users/new",view:"userEditor",title:"New User - Domma CMS"},{path:"/users/edit/:id",view:"userEditor",title:"Edit User - Domma CMS"},{path:"/plugins",view:"plugins",title:"Plugins - Domma CMS"},{path:"/documentation",view:"documentation",title:"Usage - Domma CMS"},{path:"/tutorials",view:"tutorials",title:"Tutorials - Domma CMS"},{path:"/api-reference",view:"apiReference",title:"API Reference - Domma CMS"},{path:"/collections",view:"collections",title:"Collections - Domma CMS"},{path:"/collections/new",view:"collectionEditor",title:"New Collection - Domma CMS"},{path:"/collections/edit/:slug",view:"collectionEditor",title:"Edit Collection - Domma CMS"},{path:"/collections/:slug/entries",view:"collectionEntries",title:"Entries - Domma CMS"},{path:"/forms",view:"forms",title:"Forms - Domma CMS"},{path:"/forms/new",view:"formEditor",title:"New Form - Domma CMS"},{path:"/forms/edit/:slug",view:"formEditor",title:"Edit Form - Domma CMS"},{path:"/forms/:slug/submissions",view:"formSubmissions",title:"Submissions - Domma CMS"},{path:"/views",view:"viewsList",title:"Views - Domma CMS"},{path:"/views/new",view:"viewEditor",title:"New View - Domma CMS"},{path:"/views/edit/:slug",view:"viewEditor",title:"Edit View - Domma CMS"},{path:"/views/:slug/preview",view:"viewPreview",title:"View Preview - Domma CMS"},{path:"/actions",view:"actionsList",title:"Actions - Domma CMS"},{path:"/actions/new",view:"actionEditor",title:"New Action - Domma CMS"},{path:"/actions/edit/:slug",view:"actionEditor",title:"Edit Action - Domma CMS"},{path:"/pro/docs",view:"proDocs",title:"Pro Documentation - Domma CMS"},{path:"/blocks",view:"blocks",title:"Blocks - Domma CMS"},{path:"/blocks/new",view:"blockEditor",title:"New Block - Domma CMS"},{path:"/blocks/edit/:name",view:"blockEditor",title:"Edit Block - Domma CMS"},{path:"/my-profile",view:"myProfile",title:"My Profile - Domma CMS"},{path:"/roles",view:"roles",title:"Roles & Permissions - Domma CMS"},{path:"/roles/edit/:id",view:"roleEditor",title:"Edit Role - Domma CMS"},{path:"/effects",view:"effects",title:"Effects - Domma CMS"},{path:"/login",view:"login",title:"Sign in - Domma CMS",onEnter:()=>{$("#admin-sidebar").hide(),$("#admin-topbar").hide()}},{path:"/reset-password",view:"login",title:"Reset Password - Domma CMS",onEnter:()=>{$("#admin-sidebar").hide(),$("#admin-topbar").hide()}}];M.subscribe("router:afterChange",async({to:t,from:e})=>{if(!(t.path==="/login"||t.path==="/reset-password")){if(b(m())&&!w(t.path)){R.navigate("/job-board");return}if($("#admin-sidebar").show(),$("#admin-topbar").show(),e?.path==="/login"||e?.path==="/reset-password"){$("#topbar-user-name").remove(),await j();const a=await y();k(a)}_()}}),M.subscribe("router:afterChange",()=>{setTimeout(()=>{$(".btn-primary, .btn-danger").length&&Domma.effects.reveal(".btn-primary, .btn-danger",{animation:"fade",stagger:40,duration:300})},50)});const x="cms_card_states",f=S.get(x)||{};M.subscribe("router:afterChange",()=>{setTimeout(()=>{$("#view-container .card-collapsible").each(function(){const t=$(this).find(".card-header h2, .card-header h3").first().text().trim();t&&f[t]==="collapsed"&&$(this).addClass("card-collapsed")})},200)}),$("#view-container").on("click",".card-collapsible .card-header",function(t){if($(t.target).closest("button, a").length)return;const e=$(this).closest(".card");e.toggleClass("card-collapsed");const a=$(this).find("h2, h3").first().text().trim();a&&(f[a]=e.hasClass("card-collapsed")?"collapsed":"open",S.set(x,f))}),document.addEventListener("keydown",t=>{if(!(t.ctrlKey||t.metaKey)||t.key!=="s"||window.location.hash==="#/login"||window.location.hash.startsWith("#/reset-password"))return;const e=document.querySelector("#view-container .view-header button.btn-primary");e&&(t.preventDefault(),e.click())});const P={...q},v=[...U];let A=[];async function j(){if(c())try{const t=await n.plugins.adminConfig();A=t.sidebar||[],t.routes?.length&&v.push(...t.routes);for(const[e,a]of Object.entries(t.views||{}))try{const i=await import(`/plugins/${a.entry}`);P[e]=i[a.exportName]}catch{}}catch{}}function _(){const t=m();if(!t||$("#topbar-user-name").length)return;const a={admin:"Admin",manager:"Manager",editor:"Editor",subscriber:"Subscriber","jb-company":"Company","jb-agent":"Agent","jb-candidate":"Candidate"}[t.role]||t.role;$("#topbar-user").html(`
2
2
  <span id="topbar-user-name" class="topbar-user-name">${l(t.name)}</span>
3
3
  <span class="topbar-role-badge topbar-role-badge--${l(t.role)}">${a}</span>
4
4
  `),$("#topbar-actions").html(`
@@ -14,4 +14,4 @@ import{getSidebarConfig as Y}from"./config/sidebar-config.js";import{views as q}
14
14
  <span data-icon="log-out"></span>
15
15
  <span>Sign out</span>
16
16
  </a>
17
- `),$("#topbar-logout-btn").on("click",i=>{i.preventDefault(),z()}),Domma.icons.scan("#admin-topbar"),E.tooltip("#topbar-actions [data-tooltip]",{placement:"bottom"})}function l(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(async()=>{if(!c()&&!window.location.hash.startsWith("#/reset-password"))window.location.hash="#/login";else{const i=(window.location.hash||"#/").slice(1)||"/";if(b(m())&&!w(i)&&(window.location.hash="#/job-board"),await j(),m()){const n=await y();await k(n),_()}}R.init({container:"#view-container",routes:v,views:P,default:"/",transitions:{enter:"fadeIn",leave:"fadeOut",duration:150}});const t=R._extractParams.bind(R);R._extractParams=function(i,s){if(i.endsWith("/*")){const n=i.slice(0,-2);return s.startsWith(n+"/")?{}:null}return t(i,s)};const e=(window.location.hash||"#/").slice(1)||"/";v.filter(i=>i.path.endsWith("/*")).some(i=>e.startsWith(i.path.slice(0,-2)+"/"))&&R._handleRouteChange()})()});
17
+ `),$("#topbar-logout-btn").on("click",i=>{i.preventDefault(),z()}),Domma.icons.scan("#admin-topbar"),E.tooltip("#topbar-actions [data-tooltip]",{placement:"bottom"})}function l(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}(async()=>{if(!c()&&!window.location.hash.startsWith("#/reset-password"))window.location.hash="#/login";else{const i=(window.location.hash||"#/").slice(1)||"/";if(b(m())&&!w(i)&&(window.location.hash="#/job-board"),await j(),m()){const o=await y();await k(o),_()}}R.init({container:"#view-container",routes:v,views:P,default:"/",transitions:{enter:"fadeIn",leave:"fadeOut",duration:150}});const t=R._extractParams.bind(R);R._extractParams=function(i,s){if(i.endsWith("/*")){const o=i.slice(0,-2);return s.startsWith(o+"/")?{}:null}return t(i,s)};const e=(window.location.hash||"#/").slice(1)||"/";v.filter(i=>i.path.endsWith("/*")).some(i=>e.startsWith(i.path.slice(0,-2)+"/"))&&R._handleRouteChange()})()});
@@ -0,0 +1,7 @@
1
+ const j=[{key:"header-body",group:"Basic",label:"Header + Body",thumb:"\u25A4"},{key:"basic",group:"Basic",label:"Body only",thumb:"\u25AD"},{key:"header-body-footer",group:"Basic",label:"Header + Body + Footer",thumb:"\u2630"},{key:"no-header-footer",group:"Basic",label:"Body + Footer (no header)",thumb:"\u25A5"},{key:"icon-top",group:"Icon",label:"Icon top (stacked)",thumb:"\u2B06\u2605"},{key:"icon-inline",group:"Icon",label:"Icon inline",thumb:"\u2605\u25B6"},{key:"image-top",group:"Image",label:"Image top",thumb:"\u{1F5BC}"},{key:"image-overlay",group:"Image",label:"Image + overlay title",thumb:"\u{1F5BC}\u2726"},{key:"thumb-left",group:"Image",label:"Thumbnail left",thumb:"\u{1F5BC}\u2590"},{key:"thumb-right",group:"Image",label:"Thumbnail right",thumb:"\u258C\u{1F5BC}"},{key:"wide-left-image",group:"Image",label:"Wide image left",thumb:"\u{1F5BC}\u258D"},{key:"full-bg",group:"Image",label:"Full background",thumb:"\u{1F5BC}"},{key:"split-half",group:"Image",label:"Split half",thumb:"\u2592\u2590"},{key:"avatar-profile",group:"People",label:"Avatar / Profile",thumb:"\u{1F464}"},{key:"stat-metric",group:"People",label:"Stat / Metric",thumb:"\u{1F4CA}"},{key:"quote-testimonial",group:"People",label:"Quote / Testimonial",thumb:"\u201C"},{key:"rating-review",group:"People",label:"Rating / Review",thumb:"\u2605"},{key:"activity-feed",group:"People",label:"Activity feed",thumb:"\u{1F514}"},{key:"callout",group:"Content",label:"Callout",thumb:"\u{1F4A1}"},{key:"code-snippet",group:"Content",label:"Code snippet",thumb:"</>"},{key:"file-document",group:"Content",label:"File / Document",thumb:"\u{1F4C4}"},{key:"tag-cloud",group:"Content",label:"Tag cloud",thumb:"\u{1F3F7}"},{key:"video-media",group:"Media",label:"Video / Media",thumb:"\u25B6"},{key:"location-map",group:"Special",label:"Location / Map",thumb:"\u{1F4CD}"},{key:"step-numbered",group:"Special",label:"Step / Numbered",thumb:"\u2460"},{key:"corner-badge",group:"Special",label:"Corner badge",thumb:"\u{1F3F7}"},{key:"badge-band",group:"Special",label:"Badge band",thumb:"\u2B1B"},{key:"glass-gradient-border",group:"Special",label:"Glass gradient border",thumb:"\u25C8"},{key:"timeline-entry",group:"Special",label:"Timeline entry",thumb:"\u2022\u2014"},{key:"before-after",group:"Compare",label:"Before / After",thumb:"\u2194"},{key:"pricing",group:"Compare",label:"Pricing card",thumb:"\xA3"},{key:"feature-comparison",group:"Compare",label:"Feature comparison",thumb:"\u2611"},{key:"progress-goal",group:"Compare",label:"Progress / Goal",thumb:"\u25B0"}],q=["clean","gradient","glass","accent","dark","glow"],M=["indigo","ocean","sunset","forest","rose","midnight","aurora","fire","lagoon","dusk","lime","gold","arctic","slate"],B={indigo:"#6366f1,#8b5cf6",ocean:"#0891b2,#2563eb",sunset:"#f59e0b,#ef4444",forest:"#10b981,#0d9488",rose:"#fb7185,#e11d48",midnight:"#1e1b4b,#4338ca",aurora:"#06b6d4,#6366f1",fire:"#ef4444,#f97316",lagoon:"#06b6d4,#0e7490",dusk:"#7c3aed,#db2777",lime:"#84cc16,#10b981",gold:"#f59e0b,#b45309",arctic:"#bae6fd,#e0f2fe",slate:"#475569,#1e293b"},T=["activity","airpods","airport","alert-circle","alert-warning","ambulance","angry","annoyed","apartment","arch","archive","arrow-down","arrow-down-left","arrow-down-right","arrow-left","arrow-right","arrow-up","arrow-up-left","arrow-up-right","astonished","at-sign","attachment","award","badge","ban","bandage","bank","banknote","barbell","barcode","barn","baseball","basketball","battery","battery-charging","bauble","bell","bell-off","bells","bicycle","bitcoin","blood-drop","blush","bold","bone","book","book-closed","book-open","bookmark","bookmark-filled","bowling","box","boxing-glove","brain","bridge","briefcase","building","bus","cabin","cake","calculator","calendar","camera","camera-off","candy-cane","capsule","car","cart","cart-add","cash","cast","castle","chart-area","chart-bar","chart-bar-horizontal","chart-candlestick","chart-line","chart-pie","chat","chat-alt","check","check-circle","check-circle-filled","check-square","chevron-down","chevron-left","chevron-right","chevron-up","chevrons-down","chevrons-left","chevrons-right","chevrons-up","church","circle","circle-filled","clear-format","clipboard","clipboard-check","clipboard-list","clock","close","cloud","cloud-download","cloud-drizzle","cloud-lightning","cloud-off","cloud-rain","cloud-sun","cloud-upload","code","code-block","code-inline","cog","coins","columns","comment","compass","component","confused","cool","copy","corner-down-left","corner-down-right","corner-up-left","corner-up-right","court","cpu","credit-card","crown","crutch","cry","currency-dollar","currency-euro","currency-pound","cycling","database","dead","desktop","disappointed","dna","document","document-add","document-check","document-remove","document-text","dollar-sign","dome","dot","dots-horizontal","dots-vertical","download","droplet","droplets","dumbbell","edit","embed","emoji-happy","emoji-sad","euro-sign","exclamation","expand","expressionless","external-link","eye","eye-medical","eye-off","factory","fast-forward","feather","file-code","file-text","file-zip","fill","film","filter","fire","first-aid","fishing","flag","fog","folder","folder-add","folder-minus","folder-open","folder-plus","folder-remove","football","fortress","fuel","gamepad","garage","gauge","gift","git-branch","github","globe","golf","grid","grin","growth","hard-drive","hash","haze","heading-1","heading-2","heading-3","headphones","heart","heart-eyes","heart-filled","heart-pulse","heartbeat","help-circle","holly","home","hospital","hotel","house","image","image-add","images","inbox","indent","info","info-filled","investment","invoice","italic","joy","joystick","key","kettlebell","keyboard","laptop","laugh","layers","layout","library","lighthouse","lightning","link","link-2","link-add","linkedin","list","list-bullet","list-numbered","loader","loading","lock","log-in","log-out","lungs","mail","mail-open","map","map-pin","mask","maximize","medal","medical-cross","menu","menu-alt","message-circle","message-square","mic","mic-off","microscope","minimize","minus","minus-circle","minus-square","monitor","monument","moon","moon-star","more-horizontal","more-vertical","mosque","motorcycle","mountain","mouse","mouse-pointer","move","museum","music","nerd","neutral","notification","obelisk","office","outdent","package","palette","panel-bottom","panel-left","panel-right","panel-top","paperclip","parking","pause","pause-filled","percent","phone","phone-call","phone-incoming","phone-off","phone-outgoing","piggy-bank","pill","pill-bottle","pin","play","play-circle","play-filled","plug","plus","plus-circle","plus-square","podium","pound-sign","printer","pulse","pyramid","qrcode","question","quote","racket","radio","rage","rain","rainbow","receipt","redo","refresh","refresh-cw","reindeer","rewind","road","rotate-ccw","rotate-cw","router","rss","running","sad","safe","save","scale","scale-weight","school","search","send","server","settings","share","share-2","share-alt","shield","shield-alert","shield-check","shield-x","shipping","shocked","shopping-bag","shrink","sick","sidebar-left","sidebar-right","silly","skate","ski","skip-back","skip-forward","skyscraper","sleepy","sleigh","sliders","smartphone","smartwatch","smile","snow","snowflake","snowman","sob","soccer","sort","sparkles","speaker","spinner","square","stadium","star","star-decoration","star-eyes","star-filled","stethoscope","stop","stop-filled","stopwatch","store","strikethrough","sun","sunrise","sunset","surfboard","surprised","swimming","sync","syringe","tablet","tablet-smartphone","tag","tags","target","taxi","temple","tennis","tent","terminal","test-tube","text-center","text-left","text-right","thermometer","thermometer-medical","thermometer-sun","thinking","thumb-down","thumb-up","tongue","tool","tooth","tower","train-station","trash","tree","trending-down","trending-neutral","trending-up","trophy","truck","tv","tv-minimal","twitter","type","umbrella","underline","undo","university","unlink","unlock","upload","usb","user","user-add","user-check","user-group","user-plus","user-remove","users","vaccine","van","vault","video","video-off","volleyball","volume","volume-down","volume-mute","volume-off","volume-up","wallet","warehouse","warning","warning-filled","watch","webcam","wheelchair","whistle","wifi","wifi-off","wind","windmill","wink","wreath","x","x-circle","x-circle-filled","yoga","youtube","zany","zap"];let y=null,a=null,w=null,L=null;export const CardBuilder={open(e,t={}){y||(w=e,L=t,a={layout:"header-body",variant:"clean",gradient:"indigo",title:"",subtitle:"",icon:"",iconLayout:"inline",image:"",body:"",footer:"",hover:!1,collapsible:!1,value:"",delta:"",progress:"50",price:"",period:"",lang:"JavaScript",filename:"",filesize:"",filetype:"PDF",rating:"5",duration:"",address:"",step:"1",badge:"New",tags:"",calloutType:"info",font:"",fontSize:"",borderless:!1,shadow:"",rounded:"",textAlign:"",padding:""},O())},close(){S()}};function A(){const e=a,t=[];e.layout!=="header-body"&&t.push(`layout="${e.layout}"`),e.title&&t.push(`title="${e.title}"`),e.subtitle&&t.push(`subtitle="${e.subtitle}"`),e.icon&&t.push(`icon="${e.icon}"`),e.icon&&e.iconLayout==="stacked"&&t.push('icon-layout="stacked"'),e.image&&t.push(`image="${e.image}"`),e.variant!=="clean"&&t.push(`variant="${e.variant}"`),e.variant==="gradient"&&e.gradient!=="indigo"&&t.push(`gradient="${e.gradient}"`),e.hover&&t.push("hover"),e.collapsible&&t.push('collapsible="true"'),e.font&&t.push(`font="${e.font}"`),e.fontSize&&t.push(`font-size="${e.fontSize}"`),e.borderless&&t.push("borderless"),e.shadow&&t.push(`shadow="${e.shadow}"`),e.rounded&&t.push(`rounded="${e.rounded}"`),e.textAlign&&t.push(`text-align="${e.textAlign}"`),e.padding&&t.push(`padding="${e.padding}"`),e.footer&&!["pricing","feature-comparison","activity-feed","before-after","progress-goal"].includes(e.layout)&&t.push(`footer="${e.footer}"`);const o={"stat-metric":()=>{e.value&&t.push(`value="${e.value}"`),e.delta&&t.push(`delta="${e.delta}"`),e.progress&&t.push(`progress="${e.progress}"`)},pricing:()=>{e.price&&t.push(`price="${e.price}"`),e.period&&t.push(`period="${e.period}"`)},"code-snippet":()=>t.push(`lang="${e.lang}"`),"file-document":()=>{t.push(`filename="${e.filename}"`),e.filesize&&t.push(`filesize="${e.filesize}"`),e.filetype&&t.push(`filetype="${e.filetype}"`)},"rating-review":()=>t.push(`rating="${e.rating}"`),"video-media":()=>{e.duration&&t.push(`duration="${e.duration}"`)},"location-map":()=>{e.address&&t.push(`address="${e.address}"`)},"step-numbered":()=>t.push(`step="${e.step}"`),"corner-badge":()=>{e.badge&&t.push(`badge="${e.badge}"`)},"badge-band":()=>{e.badge&&t.push(`badge="${e.badge}"`)},"tag-cloud":()=>{e.tags&&t.push(`tags="${e.tags}"`)},"avatar-profile":()=>{e.tags&&t.push(`tags="${e.tags}"`)},callout:()=>{e.calloutType&&t.push(`callout-type="${e.calloutType}"`)},"split-half":()=>{}};o[e.layout]&&o[e.layout]();const n=t.length?" "+t.join(" "):"",i=e.body.trim()||"Content here.",d={"before-after":`[before]Before item 1 \xB7 Before item 2[/before]
2
+ [after]After item 1 \xB7 After item 2[/after]`,pricing:`[feature]Feature one[/feature]
3
+ [feature]Feature two[/feature]`,"feature-comparison":`[feature]Included feature[/feature]
4
+ [feature excluded]Excluded feature[/feature]`,"activity-feed":'[activity user="Alice" action="published a page" time="2 min ago"]',"progress-goal":`[milestone done]Phase 1[/milestone]
5
+ [milestone]Phase 2[/milestone]`}[e.layout]||i;return`[card${n}]
6
+ ${d}
7
+ [/card]`}function S(){y&&(y.remove(),y=null,a=null)}function R(){const e=A(),t=w.selectionStart,o=w.selectionEnd;w.value=w.value.slice(0,t)+e+w.value.slice(o),w.selectionStart=w.selectionEnd=t+e.length,w.dispatchEvent(new Event("input",{bubbles:!0})),w.focus(),S()}function O(){y=document.createElement("div"),Object.assign(y.style,{position:"fixed",inset:"0",background:"rgba(0,0,0,.6)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:"9999",padding:"24px",isolation:"isolate"});const e=document.createElement("div");Object.assign(e.style,{background:"var(--dm-surface,#1e293b)",border:"1px solid var(--dm-border,#334155)",borderRadius:"14px",width:"100%",maxWidth:"860px",maxHeight:"90vh",display:"flex",flexDirection:"column",boxShadow:"0 24px 64px rgba(0,0,0,.6)",overflow:"hidden"});const t=r("div","display:flex;align-items:center;justify-content:space-between;padding:14px 20px;border-bottom:1px solid var(--dm-border,#334155);flex-shrink:0"),o=r("span","font-weight:700;color:var(--dm-text,#f1f5f9);font-size:14px");o.textContent="Insert Card";const n=r("button","background:var(--dm-border,#334155);border:none;color:var(--dm-text-muted,#94a3b8);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:14px");n.textContent="\u2715",n.addEventListener("click",S),t.appendChild(o),t.appendChild(n);const i=r("div","display:grid;grid-template-columns:280px 1fr;flex:1;overflow:hidden");i.appendChild(N()),i.appendChild(ae());const l=r("div","display:flex;justify-content:flex-end;gap:10px;padding:12px 20px;border-top:1px solid var(--dm-border,#334155);flex-shrink:0"),d=r("button","padding:8px 18px;border-radius:8px;border:none;background:var(--dm-border,#334155);color:var(--dm-text-muted,#94a3b8);font-size:12px;font-weight:700;cursor:pointer");d.textContent="Cancel",d.addEventListener("click",S);const c=r("button","padding:8px 18px;border-radius:8px;border:none;background:#6366f1;color:#fff;font-size:12px;font-weight:700;cursor:pointer");c.textContent="Insert Card",c.addEventListener("click",R),l.appendChild(d),l.appendChild(c),e.appendChild(t),e.appendChild(i),e.appendChild(l),y.appendChild(e),y.addEventListener("click",b=>{b.target===y&&S()}),document.body.appendChild(y),P(),g()}function r(e,t=""){const o=document.createElement(e);return t&&(o.style.cssText=t),o}const E="padding:7px 10px;border-radius:7px;border:1px solid var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text,#e2e8f0);font-size:12px;font-family:inherit;width:100%";function N(){const e=r("div","padding:18px;border-right:1px solid var(--dm-border,#334155);display:flex;flex-direction:column;gap:14px;overflow-y:auto");e.appendChild(s("Layout",G()));const t=r("div","display:contents");t.id="cb-dyn-fields",e.appendChild(t),e.appendChild(D()),e.appendChild(s("Style",H()));const o=r("div");return o.id="cb-grad-wrap",o.style.display=a.variant==="gradient"?"":"none",o.appendChild(s("Gradient",U())),e.appendChild(o),e.appendChild(s("Options",Y())),e.appendChild(D()),e.appendChild(J()),e}function G(){const e=r("select",E+";cursor:pointer"),t={};return j.forEach(o=>{(t[o.group]=t[o.group]||[]).push(o)}),Object.entries(t).forEach(([o,n])=>{const i=document.createElement("optgroup");i.label=o,n.forEach(l=>{const d=document.createElement("option");d.value=l.key,d.textContent=`${l.thumb} ${l.label}`,l.key===a.layout&&(d.selected=!0),i.appendChild(d)}),e.appendChild(i)}),e.addEventListener("change",()=>{a.layout=e.value,P(),g()}),e}function H(){const e=r("div","display:grid;grid-template-columns:repeat(3,1fr);gap:5px"),t={clean:"background:#f8fafc;color:#374151;border:2px solid #e2e8f0",gradient:"background:linear-gradient(135deg,#6366f1,#8b5cf6);color:#fff;border:2px solid transparent",glass:"background:rgba(255,255,255,.06);color:#94a3b8;border:2px dashed #334155",accent:"background:#fff;color:#4338ca;border-left:4px solid #6366f1;border-top:2px solid #e2e8f0;border-right:2px solid #e2e8f0;border-bottom:2px solid #e2e8f0",dark:"background:#0f172a;color:#818cf8;border:2px solid #334155",glow:"color:#818cf8;border:2px solid #6366f1;box-shadow:0 0 6px rgba(99,102,241,.4)"};return q.forEach(o=>{const n=r("div",`padding:6px 4px;border-radius:7px;font-size:10px;font-weight:700;text-align:center;cursor:pointer;${t[o]}`);n.textContent=o.charAt(0).toUpperCase()+o.slice(1),n.dataset.variant=o,o===a.variant&&(n.style.outline="2px solid #6366f1"),n.addEventListener("click",()=>{a.variant=o,e.querySelectorAll("[data-variant]").forEach(l=>{l.style.outline=""}),n.style.outline="2px solid #6366f1";const i=document.getElementById("cb-grad-wrap");i&&(i.style.display=o==="gradient"?"":"none"),g()}),e.appendChild(n)}),e}function U(){const e=r("div","display:flex;flex-wrap:wrap;gap:7px");return M.forEach(t=>{const[o,n]=(B[t]||"#6366f1,#8b5cf6").split(","),i=r("div",`width:28px;height:28px;border-radius:50%;background:linear-gradient(135deg,${o},${n});cursor:pointer;border:2px solid transparent;transition:border-color .15s`);i.title=t,t===a.gradient&&(i.style.borderColor="#fff"),i.addEventListener("click",()=>{a.gradient=t,e.querySelectorAll("div").forEach(l=>{l.style.borderColor="transparent"}),i.style.borderColor="#fff",g()}),e.appendChild(i)}),e}function Y(){const e=r("div","display:flex;gap:6px");return["hover","collapsible"].forEach(t=>{const o=r("div"),n=i=>{o.style.cssText=`flex:1;padding:6px 8px;border-radius:7px;border:1px solid;font-size:11px;font-weight:700;text-align:center;cursor:pointer;${i?"border-color:#6366f1;background:#1e1b4b;color:#a5b4fc":"border-color:var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text-muted,#64748b)"}`};n(a[t]),o.textContent=t.charAt(0).toUpperCase()+t.slice(1),o.addEventListener("click",()=>{a[t]=!a[t],n(a[t]),g()}),e.appendChild(o)}),e}function z(e,t){const o=r("select",E+";cursor:pointer");return t.forEach(([n,i])=>{const l=document.createElement("option");l.value=n,l.textContent=i,n===a[e]&&(l.selected=!0),o.appendChild(l)}),o.addEventListener("change",()=>{a[e]=o.value,g()}),o}function V(e,t){const o=r("div"),n=i=>{o.style.cssText=`flex:1;padding:6px 8px;border-radius:7px;border:1px solid;font-size:11px;font-weight:700;text-align:center;cursor:pointer;${i?"border-color:#6366f1;background:#1e1b4b;color:#a5b4fc":"border-color:var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text-muted,#64748b)"}`};return n(a[e]),o.textContent=t,o.addEventListener("click",()=>{a[e]=!a[e],n(a[e]),g()}),o}function W(){const e=r("div","display:flex;gap:6px");return[["","Left"],["center","Centre"],["right","Right"]].forEach(([t,o])=>{const n=r("div"),i=l=>{n.style.cssText=`flex:1;padding:5px 4px;border-radius:7px;border:1px solid;font-size:11px;font-weight:700;text-align:center;cursor:pointer;${l?"border-color:#6366f1;background:#1e1b4b;color:#a5b4fc":"border-color:var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text-muted,#64748b)"}`};i(a.textAlign===t),n.textContent=o,n.addEventListener("click",()=>{a.textAlign=t,e.querySelectorAll("div").forEach((l,d)=>i([["","Left"],["center","Centre"],["right","Right"]][d][0]===t)),g()}),e.appendChild(n)}),e}function J(){const e=r("div","display:flex;flex-direction:column;gap:14px"),t=r("div","font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--dm-text-muted,#475569)");t.textContent="Presentation",e.appendChild(t);const o=r("div","display:grid;grid-template-columns:1fr 1fr;gap:10px"),n=(l,d)=>{const c=r("div","display:flex;flex-direction:column;gap:5px"),b=r("div","font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--dm-text-muted,#475569)");b.textContent=l,c.appendChild(b),c.appendChild(d),o.appendChild(c)};n("Font",z("font",[["","Default"],["serif","Serif"],["mono","Mono"]])),n("Size",z("fontSize",[["","Default"],["sm","Small"],["lg","Large"],["xl","XL"]])),n("Shadow",z("shadow",[["","Default"],["none","None"],["md","Medium"],["lg","Large"]])),n("Padding",z("padding",[["","Default"],["compact","Compact"],["spacious","Spacious"]])),n("Corners",z("rounded",[["","Default"],["none","Square"],["sm","Small"],["lg","Large"],["full","Full"]])),e.appendChild(o),e.appendChild(s("Align",W()));const i=r("div","display:flex;gap:6px");return i.appendChild(V("borderless","Borderless")),e.appendChild(i),e}function s(e,t){const o=r("div","display:flex;flex-direction:column;gap:5px"),n=r("div","font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--dm-text-muted,#475569)");return n.textContent=e,o.appendChild(n),o.appendChild(t),o}function D(){return r("div","height:1px;background:var(--dm-border,#334155);margin:2px 0")}function p(e,t){const o=r("input",E);return o.type="text",t&&(o.placeholder=t),o.value=a[e]||"",o.addEventListener("input",()=>{a[e]=o.value,g()}),o}function Q(e,t){const o=r("select",E+";cursor:pointer");return t.forEach(n=>{const i=document.createElement("option");i.value=n,i.textContent=n,n===a[e]&&(i.selected=!0),o.appendChild(i)}),o.addEventListener("change",()=>{a[e]=o.value,g()}),o}const X={"icon-top":["subtitle","icon","iconLayout"],"icon-inline":["subtitle","icon","iconLayout"],"image-top":["image"],"image-overlay":["image"],"thumb-left":["image"],"thumb-right":["image"],"wide-left-image":["image"],"full-bg":["image"],"split-half":["image"],"avatar-profile":["subtitle","icon","tags"],"stat-metric":["value","delta","progress"],"quote-testimonial":["subtitle","icon"],callout:["calloutType","icon"],"video-media":["image","duration"],"location-map":["address"],"step-numbered":["step"],"corner-badge":["icon","badge"],"badge-band":["icon","badge"],"rating-review":["rating","subtitle","icon"],"tag-cloud":["tags"],"activity-feed":[],"code-snippet":["lang"],"file-document":["filename","filesize","filetype"],"before-after":[],pricing:["price","period"],"feature-comparison":["subtitle"],"progress-goal":["progress"],"timeline-entry":["subtitle","badge"],"glass-gradient-border":[]},Z=new Set(["basic","no-header-footer","code-snippet","file-document","stat-metric"]),K=new Set(["stat-metric","file-document"]),ee=new Set(["pricing","feature-comparison","activity-feed","before-after","progress-goal"]);function P(){const e=document.getElementById("cb-dyn-fields");if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);const t=a.layout,o=X[t]||[];Z.has(t)||e.appendChild(s("Title",p("title","Card heading"))),o.forEach(n=>{const i={subtitle:()=>s("Subtitle",p("subtitle","Secondary line")),icon:()=>s("Icon",oe()),iconLayout:()=>s("Icon layout",re()),image:()=>s("Image",ie()),value:()=>s("Value",p("value","\xA324,980")),delta:()=>s("Delta",p("delta","\u2191 12.4%")),progress:()=>s("Progress %",p("progress","50")),price:()=>s("Price",p("price","\xA329")),period:()=>s("Period",p("period","per month")),lang:()=>s("Language",p("lang","JavaScript")),filename:()=>s("Filename",p("filename","document.pdf")),filesize:()=>s("File size",p("filesize","2.4 MB")),filetype:()=>s("File type",p("filetype","PDF")),rating:()=>s("Rating (1\u20135)",p("rating","5")),duration:()=>s("Duration",p("duration","4:32")),address:()=>s("Address",p("address","12 Main St")),step:()=>s("Step number",p("step","1")),badge:()=>s("Badge label",p("badge","New")),tags:()=>s("Tags (comma-separated)",p("tags","Design, CSS")),calloutType:()=>s("Type",Q("calloutType",["info","warn","success","error"]))};i[n]&&e.appendChild(i[n]())}),K.has(t)||e.appendChild(s("Body content",te())),ee.has(t)||e.appendChild(s("Footer",p("footer","")))}function te(){const e=r("textarea",E+";resize:vertical;min-height:60px;line-height:1.5");return e.value=a.body||"",e.addEventListener("input",()=>{a.body=e.value,g()}),e}function oe(){const e=r("div","display:flex;gap:6px"),t=r("input",E+";flex:1");t.type="text",t.placeholder="icon name",t.value=a.icon||"",t.addEventListener("input",()=>{a.icon=t.value,g()});const o=r("button","padding:0 10px;height:34px;background:var(--dm-border,#334155);border:none;color:var(--dm-text-muted,#94a3b8);border-radius:7px;font-size:13px;cursor:pointer;flex-shrink:0");return o.title="Browse icons",o.textContent="\u2605",o.addEventListener("click",()=>F(n=>{a.icon=n,t.value=n,g()})),e.appendChild(t),e.appendChild(o),e}function re(){const e=r("div","display:flex;gap:6px");return["inline","stacked"].forEach(t=>{const o=r("div"),n=i=>{o.style.cssText=`flex:1;padding:6px;border-radius:7px;border:1px solid;font-size:11px;font-weight:700;text-align:center;cursor:pointer;${i?"border-color:#6366f1;background:#1e1b4b;color:#a5b4fc":"border-color:var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text-muted,#64748b)"}`};n(a.iconLayout===t),o.textContent=t.charAt(0).toUpperCase()+t.slice(1),o.addEventListener("click",()=>{a.iconLayout=t,e.querySelectorAll("div").forEach((i,l)=>n(["inline","stacked"][l]===t)),g()}),e.appendChild(o)}),e}function ne(){return new Promise(async e=>{let t=[];L&&typeof L.onMediaBrowse=="function"&&(t=await L.onMediaBrowse()||[]);const o=document.createElement("dialog");o.style.cssText="margin:auto;padding:0;border:none;border-radius:12px;background:var(--dm-surface,#1e293b);width:min(700px,95vw);max-height:80vh;overflow:hidden;display:flex;flex-direction:column;box-shadow:0 25px 60px rgba(0,0,0,.5)";const n=document.createElement("style");n.textContent="dialog.cb-media-picker::backdrop{background:rgba(0,0,0,.75)}",o.className="cb-media-picker";const i=m=>{o.close(),o.remove(),n.remove(),e(m)},l=r("div","display:flex;justify-content:space-between;align-items:center;flex-shrink:0;padding:16px 20px;border-bottom:1px solid var(--dm-border,#334155)"),d=r("div","font-weight:700;font-size:14px;color:var(--dm-text,#f1f5f9)");d.textContent="Select Image";const c=r("button","background:var(--dm-border,#334155);border:none;color:var(--dm-text-muted,#94a3b8);border-radius:6px;width:26px;height:26px;cursor:pointer;font-size:14px");c.textContent="\xD7",c.addEventListener("click",()=>i(null)),o.addEventListener("cancel",()=>i(null)),l.appendChild(d),l.appendChild(c);const b=r("div","padding:16px;overflow-y:auto;flex:1"),k=r("div","display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px"),v=t.filter(m=>/\.(png|jpe?g|gif|webp|svg)$/i.test(m.name||""));if(v.length)v.forEach(m=>{const u=r("div","display:flex;flex-direction:column;gap:6px;cursor:pointer;border:2px solid transparent;border-radius:8px;padding:6px"),h=document.createElement("img");h.src=m.url,h.alt=m.name||"",h.style.cssText="width:100%;height:80px;object-fit:cover;border-radius:6px;display:block";const x=r("div","font-size:9px;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--dm-text-muted,#94a3b8)");x.textContent=m.name||m.url,u.appendChild(h),u.appendChild(x),u.addEventListener("mouseenter",()=>{u.style.borderColor="#6366f1"}),u.addEventListener("mouseleave",()=>{u.style.borderColor="transparent"}),u.addEventListener("click",()=>i(m.url)),k.appendChild(u)});else{const m=r("div","color:var(--dm-text-muted,#94a3b8);font-size:13px;padding:20px;text-align:center");m.textContent="No images uploaded yet.",k.appendChild(m)}b.appendChild(k),o.appendChild(l),o.appendChild(b),document.head.appendChild(n),document.body.appendChild(o),o.showModal()})}function ie(){const e=r("div","display:flex;gap:6px"),t=r("input",E+";flex:1");t.type="text",t.placeholder="/media/image.jpg",t.value=a.image||"",t.addEventListener("input",()=>{a.image=t.value,g()});const o=r("button","padding:0 10px;height:34px;background:var(--dm-border,#334155);border:none;color:var(--dm-text-muted,#94a3b8);border-radius:7px;font-size:13px;cursor:pointer;flex-shrink:0");return o.title="Browse media",o.textContent="\u{1F4C1}",o.addEventListener("click",async()=>{const n=await ne();n&&(a.image=n,t.value=n,g())}),e.appendChild(t),e.appendChild(o),e}function ae(){const e=r("div","padding:20px;background:var(--dm-surface,#f8fafc);display:flex;flex-direction:column;gap:14px;overflow-y:auto"),t=r("div","font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--dm-text-muted,#94a3b8)");t.textContent="Live Preview";const o=r("div","flex:1;display:flex;align-items:flex-start;justify-content:center");o.id="cb-preview-area";const n=r("div","font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.07em;color:var(--dm-text-muted,#94a3b8);margin-bottom:6px");n.textContent="Shortcode";const i=r("div","background:var(--dm-surface,#1e293b);border:1px solid var(--dm-border,#334155);border-radius:8px;padding:10px 14px;font-family:monospace;font-size:11px;color:var(--dm-primary,#a5b4fc);line-height:1.8;white-space:pre-wrap;word-break:break-all");return i.id="cb-snippet",e.appendChild(t),e.appendChild(o),e.appendChild(n),e.appendChild(i),e}function g(){const e=document.getElementById("cb-preview-area");if(!e)return;for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(de());const t=document.getElementById("cb-snippet");t&&(t.textContent=A())}function de(){const e=a,[t,o]=(B[e.gradient]||"#6366f1,#8b5cf6").split(","),n=`linear-gradient(135deg,${t},${o})`,i={clean:"background:var(--dm-surface,#fff);border:1px solid var(--dm-border,#e5e7eb);box-shadow:0 1px 4px rgba(0,0,0,.06)",gradient:`background:${n};color:#fff`,glass:"background:rgba(255,255,255,.12);backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.25);box-shadow:0 4px 24px rgba(0,0,0,.12)",accent:"background:var(--dm-surface,#fff);border-top:1px solid var(--dm-border,#e5e7eb);border-right:1px solid var(--dm-border,#e5e7eb);border-bottom:1px solid var(--dm-border,#e5e7eb);border-left:4px solid #6366f1",dark:"background:#0f172a;color:#e2e8f0;border:1px solid #1e293b",glow:"background:var(--dm-surface,#fff);border:1px solid #6366f1;box-shadow:0 0 0 3px rgba(99,102,241,.15),0 0 20px rgba(99,102,241,.3)"},l=e.variant==="gradient"?`background:${n};color:#fff;padding:12px 16px`:"background:var(--dm-border,#f3f4f6);color:var(--dm-text,#111);padding:12px 16px",d=r("div");d.style.cssText=`width:100%;max-width:300px;border-radius:12px;overflow:hidden;font-size:13px;font-family:system-ui,sans-serif;${i[e.variant]||i.clean}`;const c={serif:"Georgia,serif",mono:"'SF Mono','Fira Code',monospace"};e.font&&c[e.font]&&(d.style.fontFamily=c[e.font]);const b={sm:"11px",lg:"15px",xl:"17px"};e.fontSize&&b[e.fontSize]&&(d.style.fontSize=b[e.fontSize]),e.borderless&&(d.style.border="none");const k={none:"none",md:"0 4px 12px rgba(0,0,0,.1)",lg:"0 10px 30px rgba(0,0,0,.18)"};e.shadow&&k[e.shadow]!==void 0&&(d.style.boxShadow=k[e.shadow]);const v={none:"0",sm:"4px",lg:"20px",full:"9999px"};if(e.rounded&&v[e.rounded]!==void 0&&(d.style.borderRadius=v[e.rounded]),e.textAlign&&(d.style.textAlign=e.textAlign),new Set(["image-top","image-overlay","thumb-left","thumb-right","wide-left-image","full-bg","split-half","video-media"]).has(e.layout)){const f=r("div","height:120px;background-size:cover;background-position:center;display:flex;align-items:center;justify-content:center;font-size:2rem;background-color:var(--dm-border,#e2e8f0)");e.image&&(f.style.backgroundImage=`url('${e.image}')`),e.image||(f.textContent="\u{1F5BC}"),d.appendChild(f)}if(!new Set(["basic","no-header-footer","image-overlay","stat-metric","quote-testimonial","activity-feed","before-after","code-snippet","file-document","glass-gradient-border"]).has(e.layout)&&e.title){const f=r("div",l),C=r("div","font-weight:700");C.textContent=e.title,f.appendChild(C),d.appendChild(f)}const h=e.variant==="dark"?"color:#94a3b8;":e.variant==="gradient"?"color:rgba(255,255,255,.85);":"",x=r("div",`padding:13px 16px;${h}`);if(new Set(["before-after","pricing","feature-comparison","activity-feed","progress-goal"]).has(e.layout)){const f=r("em","font-size:11px;color:var(--dm-text-muted,#9ca3af)");f.textContent="Simplified preview \u2014 full render on save.",x.appendChild(f)}else if(e.layout==="stat-metric"){const f=r("div","font-size:2rem;font-weight:800");f.textContent=e.value||"\u2014";const C=r("div","font-size:.8rem;opacity:.7");if(C.textContent=e.title||"",x.appendChild(C),x.appendChild(f),e.delta){const _=r("div","font-size:.78rem;font-weight:600;color:#10b981");_.textContent=e.delta,x.appendChild(_)}}else x.textContent=e.body||"Card body content.";if(e.padding){const f=e.padding==="compact"?"8px 12px":"24px 28px";x.style.padding=f}if(d.appendChild(x),e.footer){const f=e.variant==="gradient"?"rgba(255,255,255,.6)":"var(--dm-text-muted,#9ca3af)",C=r("div",`padding:9px 16px;border-top:1px solid rgba(128,128,128,.15);font-size:11px;color:${f}`);C.textContent=e.footer,d.appendChild(C)}return d}function F(e){const t=r("div","position:fixed;inset:0;background:rgba(0,0,0,.7);display:flex;align-items:center;justify-content:center;z-index:10000;padding:24px"),o=r("div","background:var(--dm-surface,#1e293b);border:1px solid var(--dm-border,#475569);border-radius:12px;padding:16px;width:100%;max-width:520px;max-height:70vh;display:flex;flex-direction:column;gap:12px"),n=r("div","display:flex;gap:8px"),i=r("input","flex:1;padding:8px 12px;border-radius:8px;border:1px solid var(--dm-border,#334155);background:var(--dm-surface,#0f172a);color:var(--dm-text,#e2e8f0);font-size:13px;font-family:inherit");i.type="text",i.placeholder="Search icons\u2026";const l=r("button","padding:8px 14px;background:var(--dm-border,#334155);border:none;border-radius:8px;color:var(--dm-text-muted,#94a3b8);font-size:12px;cursor:pointer");l.textContent="\u2715 Close",l.addEventListener("click",()=>t.remove()),n.appendChild(i),n.appendChild(l);const d=r("div","display:grid;grid-template-columns:repeat(auto-fill,minmax(52px,1fr));gap:6px;overflow-y:auto;max-height:400px");let c=null;const b=r("button","padding:8px 18px;background:#6366f1;border:none;border-radius:8px;color:#fff;font-size:12px;font-weight:700;cursor:pointer;align-self:flex-end");b.textContent="Select an icon";function k(v){for(;d.firstChild;)d.removeChild(d.firstChild);(v?T.filter(u=>u.includes(v.toLowerCase())):T).slice(0,120).forEach(u=>{const h=r("div","display:flex;flex-direction:column;align-items:center;gap:4px;padding:8px 4px;border-radius:8px;cursor:pointer;border:2px solid transparent;background:var(--dm-surface,#0f172a)"),x=document.createElement("span");x.setAttribute("data-icon",u),x.style.fontSize="20px";const $=r("div","font-size:8px;color:var(--dm-text-muted,#475569);text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%");$.textContent=u,h.appendChild(x),h.appendChild($),h.addEventListener("click",()=>{c&&(c.style.borderColor="transparent"),h.style.borderColor="#6366f1",c=h,b.textContent=`Use: ${u}`}),h.addEventListener("dblclick",()=>{e(u),t.remove()}),d.appendChild(h)}),typeof I<"u"&&I.scan&&I.scan(d)}i.addEventListener("input",()=>k(i.value)),k(""),b.addEventListener("click",()=>{if(c){const v=c.querySelector("[data-icon]").getAttribute("data-icon");e(v),t.remove()}}),o.appendChild(n),o.appendChild(d),o.appendChild(b),t.appendChild(o),t.addEventListener("click",v=>{v.target===t&&t.remove()}),document.body.appendChild(t),i.focus()}export function openIconPicker(e){F(e)}
@@ -1,4 +1,4 @@
1
- function re(){I.register("bold",{viewBox:"0 0 24 24",path:"M7 5H14a3 3 0 0 1 0 6H7V5zM7 11H15a3 3 0 0 1 0 6H7V11z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("italic",{viewBox:"0 0 24 24",path:"M11 5h4M9 19h4M13 5l-2 14",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("strikethrough",{viewBox:"0 0 24 24",path:"M16 4H9a3 3 0 0 0 0 6h6a3 3 0 0 1 0 6H6M3 12h18",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("quote",{viewBox:"0 0 24 24",path:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zM15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("eye",{viewBox:"0 0 24 24",path:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("expand",{viewBox:"0 0 24 24",path:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("columns",{viewBox:"0 0 24 24",path:"M3 4h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM12 4v16",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("card",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M3 9h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("help-circle",{viewBox:"0 0 24 24",path:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 17h.01M12 13a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("spacer-insert",{viewBox:"0 0 24 24",paths:["M3 8h18","M3 16h18","M12 8v8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("icon-pick",{viewBox:"0 0 24 24",paths:["M4 4h6v6H4z","M14 4h6v6h-6z","M4 14h6v6H4z","M14 14h6v6h-6z"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("colour-picker",{viewBox:"0 0 24 24",paths:["M12 2a5 5 0 0 1 5 5c0 3-5 10-5 10S7 10 7 7a5 5 0 0 1 5-5z","M12 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("btn-insert",{viewBox:"0 0 24 24",paths:["M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z","M8 12h8M12 9v6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("link-shortcode",{viewBox:"0 0 24 24",paths:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("layout-list",{viewBox:"0 0 24 24",paths:["M3 5h18M3 9h18","M3 14h4v6H3zM9 14h12M9 17h8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("sparkles",{viewBox:"0 0 24 24",paths:["M12 3L13.5 8.5H19L14.5 11.5L16 17L12 14L8 17L9.5 11.5L5 8.5H10.5L12 3Z","M19 3L19.7 5.3H22L20.2 6.6L20.9 9L19 7.7L17.1 9L17.8 6.6L16 5.3H18.3L19 3Z","M5 13L5.5 14.7H7L5.8 15.5L6.3 17.2L5 16.3L3.7 17.2L4.2 15.5L3 14.7H4.5L5 13Z"],stroke:"currentColor",fill:"none",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("accordion-insert",{viewBox:"0 0 24 24",paths:["M3 4h18","M3 8h18","M8 11l4 4 4-4","M3 16h18","M3 20h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("hero",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5z","M7 8h10M7 11h6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("text-style",{viewBox:"0 0 24 24",paths:["M4 7V5h16v2","M9 19h6","M12 5v14","M5 12h14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("css-code",{viewBox:"0 0 24 24",paths:["M9 9l-6 3 6 3","M15 9l6 3-6 3","M13 5l-2 14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}export function wrapSelection(t,e,h){const i=t.selectionStart,c=t.selectionEnd,o=t.value,l=o.substring(i,c);l?(t.value=o.substring(0,i)+e+l+h+o.substring(c),t.selectionStart=i+e.length,t.selectionEnd=c+e.length):(t.value=o.substring(0,i)+e+h+o.substring(i),t.selectionStart=t.selectionEnd=i+e.length),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function insertAtCursor(t,e){const h=t.selectionStart,i=t.value;t.value=i.substring(0,h)+e+i.substring(h),t.selectionStart=t.selectionEnd=h+e.length,t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function attachEditorKeybindings(t){t.addEventListener("keydown",e=>{if(e.key==="Tab"){e.preventDefault();const i=t.selectionStart;if(e.shiftKey){const c=t.value.lastIndexOf(`
1
+ function re(){I.register("bold",{viewBox:"0 0 24 24",path:"M7 5H14a3 3 0 0 1 0 6H7V5zM7 11H15a3 3 0 0 1 0 6H7V11z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("italic",{viewBox:"0 0 24 24",path:"M11 5h4M9 19h4M13 5l-2 14",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("strikethrough",{viewBox:"0 0 24 24",path:"M16 4H9a3 3 0 0 0 0 6h6a3 3 0 0 1 0 6H6M3 12h18",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("quote",{viewBox:"0 0 24 24",path:"M3 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1zM15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("eye",{viewBox:"0 0 24 24",path:"M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zM12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("expand",{viewBox:"0 0 24 24",path:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("columns",{viewBox:"0 0 24 24",path:"M3 4h18a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM12 4v16",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("card",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z","M3 9h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("help-circle",{viewBox:"0 0 24 24",path:"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10zM12 17h.01M12 13a2 2 0 0 0 2-2 2 2 0 0 0-2-2 2 2 0 0 0-2 2",stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("spacer-insert",{viewBox:"0 0 24 24",paths:["M3 8h18","M3 16h18","M12 8v8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("icon-pick",{viewBox:"0 0 24 24",paths:["M4 4h6v6H4z","M14 4h6v6h-6z","M4 14h6v6H4z","M14 14h6v6h-6z"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("colour-picker",{viewBox:"0 0 24 24",paths:["M12 2a5 5 0 0 1 5 5c0 3-5 10-5 10S7 10 7 7a5 5 0 0 1 5-5z","M12 7a1 1 0 1 0 0-2 1 1 0 0 0 0 2"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("btn-insert",{viewBox:"0 0 24 24",paths:["M3 7a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7z","M8 12h8M12 9v6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("link-shortcode",{viewBox:"0 0 24 24",paths:["M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71","M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("layout-list",{viewBox:"0 0 24 24",paths:["M3 5h18M3 9h18","M3 14h4v6H3zM9 14h12M9 17h8"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("sparkles",{viewBox:"0 0 24 24",paths:["M12 3L13.5 8.5H19L14.5 11.5L16 17L12 14L8 17L9.5 11.5L5 8.5H10.5L12 3Z","M19 3L19.7 5.3H22L20.2 6.6L20.9 9L19 7.7L17.1 9L17.8 6.6L16 5.3H18.3L19 3Z","M5 13L5.5 14.7H7L5.8 15.5L6.3 17.2L5 16.3L3.7 17.2L4.2 15.5L3 14.7H4.5L5 13Z"],stroke:"currentColor",fill:"none",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("accordion-insert",{viewBox:"0 0 24 24",paths:["M3 4h18","M3 8h18","M8 11l4 4 4-4","M3 16h18","M3 20h18"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("banner-insert",{viewBox:"0 0 24 24",paths:["M3 6h18","M3 10h18","M3 14h12"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("hero",{viewBox:"0 0 24 24",paths:["M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5z","M7 8h10M7 11h6"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("text-style",{viewBox:"0 0 24 24",paths:["M4 7V5h16v2","M9 19h6","M12 5v14","M5 12h14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"}),I.register("css-code",{viewBox:"0 0 24 24",paths:["M9 9l-6 3 6 3","M15 9l6 3-6 3","M13 5l-2 14"],stroke:"currentColor",fill:"none",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})}export function wrapSelection(t,e,h){const i=t.selectionStart,c=t.selectionEnd,o=t.value,l=o.substring(i,c);l?(t.value=o.substring(0,i)+e+l+h+o.substring(c),t.selectionStart=i+e.length,t.selectionEnd=c+e.length):(t.value=o.substring(0,i)+e+h+o.substring(i),t.selectionStart=t.selectionEnd=i+e.length),t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function insertAtCursor(t,e){const h=t.selectionStart,i=t.value;t.value=i.substring(0,h)+e+i.substring(h),t.selectionStart=t.selectionEnd=h+e.length,t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}export function attachEditorKeybindings(t){t.addEventListener("keydown",e=>{if(e.key==="Tab"){e.preventDefault();const i=t.selectionStart;if(e.shiftKey){const c=t.value.lastIndexOf(`
2
2
  `,i-1)+1,o=t.value.substring(c).match(/^ {1,2}/);o&&(t.value=t.value.substring(0,c)+t.value.substring(c+o[0].length),t.selectionStart=t.selectionEnd=Math.max(c,i-o[0].length),t.dispatchEvent(new Event("input",{bubbles:!0})),E.toast("Dedented",{type:"info",duration:800}))}else t.value=t.value.substring(0,i)+" "+t.value.substring(i),t.selectionStart=t.selectionEnd=i+2,t.dispatchEvent(new Event("input",{bubbles:!0})),E.toast("Indented",{type:"info",duration:800});return}if(!(e.ctrlKey||e.metaKey))return;const h=e.key.toLowerCase();if(h==="z")e.preventDefault(),document.execCommand("undo"),E.toast("Undo",{type:"info",duration:1200});else if(h==="y")e.preventDefault(),document.execCommand("redo"),E.toast("Redo",{type:"info",duration:1200});else if(h==="x"&&t.selectionStart===t.selectionEnd){e.preventDefault();const i=t.value.lastIndexOf(`
3
3
  `,t.selectionStart-1)+1,c=t.value.indexOf(`
4
4
  `,t.selectionStart),o=c===-1?t.value.length:c+1;t.setSelectionRange(i,o),document.execCommand("cut"),t.dispatchEvent(new Event("input",{bubbles:!0})),E.toast("Line cut",{type:"info",duration:1200})}else if(h==="c"&&t.selectionStart===t.selectionEnd){e.preventDefault();const i=t.selectionStart,c=t.value.lastIndexOf(`
@@ -37,7 +37,7 @@ ${t||"Content"}
37
37
  [/fireworks]`,insert:!0},{label:"Celebrate",snippet:()=>'[celebrate theme="auto" intensity="medium" /]',insert:!0}];function se(t,e){const h=document.querySelector(".editor-effects-dropdown-menu");if(h){h.remove();return}const i=document.createElement("div");i.className="editor-effects-dropdown-menu",le.forEach(function(r){if(r.category){const d=document.createElement("div");d.className="editor-effects-category",d.textContent=r.category,i.appendChild(d)}else{const d=document.createElement("button");d.type="button",d.className="editor-effects-item",d.textContent=r.label,d.addEventListener("click",function(){if(i.remove(),r.insert)insertAtCursor(t,r.snippet(""));else{const a=t.selectionStart,b=t.selectionEnd,n=t.value.substring(a,b),s=r.snippet(n);t.value=t.value.substring(0,a)+s+t.value.substring(b),t.selectionStart=a,t.selectionEnd=a+s.length,t.dispatchEvent(new Event("input",{bubbles:!0})),t.focus()}}),i.appendChild(d)}});const c=e.getBoundingClientRect(),o=e.closest(".editor-toolbar").getBoundingClientRect();i.style.top=c.bottom-o.top+4+"px",i.style.left=c.left-o.left+"px",e.closest(".editor-toolbar").appendChild(i);function l(r){!i.contains(r.target)&&r.target!==e&&(i.remove(),document.removeEventListener("click",l,!0))}setTimeout(function(){document.addEventListener("click",l,!0)},0)}const Z=["activity","airpods","airport","alert-circle","alert-warning","ambulance","angry","annoyed","apartment","arch","archive","arrow-down","arrow-down-left","arrow-down-right","arrow-left","arrow-right","arrow-up","arrow-up-left","arrow-up-right","astonished","at-sign","attachment","award","badge","ban","bandage","bank","banknote","barbell","barcode","barn","baseball","basketball","battery","battery-charging","bauble","bell","bell-off","bells","bicycle","bitcoin","blood-drop","blush","bold","bone","book","book-closed","book-open","bookmark","bookmark-filled","bowling","box","boxing-glove","brain","bridge","briefcase","building","bus","cabin","cake","calculator","calendar","camera","camera-off","candy-cane","capsule","car","cart","cart-add","cash","cast","castle","chart-area","chart-bar","chart-bar-horizontal","chart-candlestick","chart-line","chart-pie","chat","chat-alt","check","check-circle","check-circle-filled","check-square","chevron-down","chevron-left","chevron-right","chevron-up","chevrons-down","chevrons-left","chevrons-right","chevrons-up","church","circle","circle-filled","clear-format","clipboard","clipboard-check","clipboard-list","clock","close","cloud","cloud-download","cloud-drizzle","cloud-lightning","cloud-off","cloud-rain","cloud-sun","cloud-upload","code","code-block","code-inline","cog","coins","columns","comment","compass","component","confused","cool","copy","corner-down-left","corner-down-right","corner-up-left","corner-up-right","court","cpu","credit-card","crown","crutch","cry","currency-dollar","currency-euro","currency-pound","cycling","database","dead","desktop","disappointed","dna","document","document-add","document-check","document-remove","document-text","dollar-sign","dome","dot","dots-horizontal","dots-vertical","download","droplet","droplets","dumbbell","edit","embed","emoji-happy","emoji-sad","euro-sign","exclamation","expand","expressionless","external-link","eye","eye-medical","eye-off","factory","fast-forward","feather","file-code","file-text","file-zip","fill","film","filter","fire","first-aid","fishing","flag","fog","folder","folder-add","folder-minus","folder-open","folder-plus","folder-remove","football","fortress","fuel","gamepad","garage","gauge","gift","git-branch","github","globe","golf","grid","grin","growth","hard-drive","hash","haze","heading-1","heading-2","heading-3","headphones","heart","heart-eyes","heart-filled","heart-pulse","heartbeat","help-circle","holly","home","hospital","hotel","house","image","image-add","images","inbox","indent","info","info-filled","investment","invoice","italic","joy","joystick","key","kettlebell","keyboard","laptop","laugh","layers","layout","library","lighthouse","lightning","link","link-2","link-add","linkedin","list","list-bullet","list-numbered","loader","loading","lock","log-in","log-out","lungs","mail","mail-open","map","map-pin","mask","maximize","medal","medical-cross","menu","menu-alt","message-circle","message-square","mic","mic-off","microscope","minimize","minus","minus-circle","minus-square","monitor","monument","moon","moon-star","more-horizontal","more-vertical","mosque","motorcycle","mountain","mouse","mouse-pointer","move","museum","music","nerd","neutral","notification","obelisk","office","outdent","package","palette","panel-bottom","panel-left","panel-right","panel-top","paperclip","parking","pause","pause-filled","percent","phone","phone-call","phone-incoming","phone-off","phone-outgoing","piggy-bank","pill","pill-bottle","pin","play","play-circle","play-filled","plug","plus","plus-circle","plus-square","podium","pound-sign","printer","pulse","pyramid","qrcode","question","quote","racket","radio","rage","rain","rainbow","receipt","redo","refresh","refresh-cw","reindeer","rewind","road","rotate-ccw","rotate-cw","router","rss","running","sad","safe","save","scale","scale-weight","school","search","send","server","settings","share","share-2","share-alt","shield","shield-alert","shield-check","shield-x","shipping","shocked","shopping-bag","shrink","sick","sidebar-left","sidebar-right","silly","skate","ski","skip-back","skip-forward","skyscraper","sleepy","sleigh","sliders","smartphone","smartwatch","smile","snow","snowflake","snowman","sob","soccer","sort","sparkles","speaker","spinner","square","stadium","star","star-decoration","star-eyes","star-filled","stethoscope","stop","stop-filled","stopwatch","store","strikethrough","sun","sunrise","sunset","surfboard","surprised","swimming","sync","syringe","tablet","tablet-smartphone","tag","tags","target","taxi","temple","tennis","tent","terminal","test-tube","text-center","text-left","text-right","thermometer","thermometer-medical","thermometer-sun","thinking","thumb-down","thumb-up","tongue","tool","tooth","tower","train-station","trash","tree","trending-down","trending-neutral","trending-up","trophy","truck","tv","tv-minimal","twitter","type","umbrella","underline","undo","university","unlink","unlock","upload","usb","user","user-add","user-check","user-group","user-plus","user-remove","users","vaccine","van","vault","video","video-off","volleyball","volume","volume-down","volume-mute","volume-off","volume-up","wallet","warehouse","warning","warning-filled","watch","webcam","wheelchair","whistle","wifi","wifi-off","wind","windmill","wink","wreath","x","x-circle","x-circle-filled","yoga","youtube","zany","zap"];function ce(t,e,h){const i=document.querySelector(".editor-spacer-picker");if(i){i.remove();return}const c=document.createElement("div");c.className="editor-spacer-picker";const o=document.createElement("div");o.className="editor-spacer-picker-label",o.textContent="Spacer height",c.appendChild(o);const l=document.createElement("div");l.className="editor-spacer-picker-row";const r=document.createElement("input");r.type="range",r.className="editor-spacer-slider",r.min="4",r.max="200",r.step="4",r.value=h;const d=document.createElement("span");d.className="editor-spacer-slider-value",d.textContent=h+"px",r.addEventListener("input",function(){d.textContent=this.value+"px"}),l.appendChild(r),l.appendChild(d),c.appendChild(l);const a=document.createElement("button");a.type="button",a.className="btn btn-primary btn-sm editor-spacer-insert-btn",a.textContent="Insert",c.appendChild(a);function b(v){!c.contains(v.target)&&v.target!==e&&(c.remove(),document.removeEventListener("click",b,!0))}a.addEventListener("click",function(){c.remove(),document.removeEventListener("click",b,!0),insertAtCursor(t,`[spacer size="${r.value}" /]
38
38
  `)});const n=e.getBoundingClientRect(),s=e.closest(".editor-toolbar").getBoundingClientRect();c.style.top=n.bottom-s.top+4+"px";const p=n.left-s.left;c.style.left=Math.min(p,s.width-240-8)+"px",e.closest(".editor-toolbar").appendChild(c),setTimeout(function(){document.addEventListener("click",b,!0)},0)}function ae(t,e){const h=document.querySelector(".editor-icon-picker");if(h){h.remove();return}const i=document.createElement("div");i.className="editor-icon-picker";const c=document.createElement("input");c.type="text",c.className="form-input editor-icon-picker-search",c.placeholder="Search icons\u2026",i.appendChild(c);const o=document.createElement("div");o.className="editor-icon-picker-size-row";const l=document.createElement("label");l.textContent="Size (px)";const r=document.createElement("input");r.type="number",r.className="form-input editor-icon-picker-size",r.placeholder="default",r.min="8",r.max="256",o.appendChild(l),o.appendChild(r),i.appendChild(o);const d=document.createElement("div");d.className="editor-icon-picker-grid",i.appendChild(d);function a(k){!i.contains(k.target)&&k.target!==e&&(i.remove(),document.removeEventListener("click",a,!0))}function b(k){d.textContent="";const g=k?Z.filter(w=>w.includes(k.toLowerCase())):Z;if(g.length===0){const w=document.createElement("div");w.className="editor-icon-picker-empty",w.textContent="No icons found",d.appendChild(w);return}g.forEach(function(w){const C=document.createElement("button");C.type="button",C.className="editor-icon-picker-item";const S=document.createElement("span");S.setAttribute("data-icon",w);const x=document.createElement("span");x.textContent=w,C.appendChild(S),C.appendChild(x),C.addEventListener("click",function(){i.remove(),document.removeEventListener("click",a,!0);const j=r.value.trim(),M=j?`[icon name="${w}" size="${j}" /]`:`[icon name="${w}" /]`;insertAtCursor(t,M)}),d.appendChild(C)}),Domma.icons.scan(d)}b(""),c.addEventListener("input",function(){b(this.value.trim())});const n=e.getBoundingClientRect(),s=e.closest(".editor-toolbar").getBoundingClientRect();i.style.top=n.bottom-s.top+4+"px";const p=n.left-s.left,v=320,y=s.width;i.style.left=Math.min(p,y-v-8)+"px",e.closest(".editor-toolbar").appendChild(i),requestAnimationFrame(function(){c.focus()}),setTimeout(function(){document.addEventListener("click",a,!0)},0)}function de(t,e,h,i){const c=document.querySelector(".editor-toolbar-dropdown");if(c){c.remove();return}const o=document.createElement("div");o.className="editor-toolbar-dropdown",h.forEach(function(b){const n=document.createElement("button");if(n.type="button",n.className="editor-toolbar-dropdown-item",b.icon){const p=document.createElement("span");p.setAttribute("data-icon",b.icon),n.appendChild(p)}const s=document.createElement("span");s.textContent=b.label,n.appendChild(s),n.addEventListener("click",function(){o.remove(),document.removeEventListener("click",a,!0),U(b.action,t,e,i)}),o.appendChild(n)});const l=e.getBoundingClientRect(),r=e.closest(".editor-toolbar").getBoundingClientRect();o.style.top=l.bottom-r.top+4+"px";const d=l.left-r.left;o.style.left=Math.min(d,r.width-180-8)+"px",e.closest(".editor-toolbar").appendChild(o),Domma.icons.scan(o);function a(b){!o.contains(b.target)&&b.target!==e&&(o.remove(),document.removeEventListener("click",a,!0))}setTimeout(function(){document.addEventListener("click",a,!0)},0)}function U(t,e,h,i){const{spacerDefault:c,handlers:o}=i;if(typeof t=="function")t(e);else if(t==="block")if(o.block)o.block(e);else{const l=e.selectionStart,r='[block template="" /]';e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+17,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="button")if(o.button)o.button(e);else{const l=e.selectionStart,r=e.selectionEnd,a=`[button href="" variant="primary"]${e.value.substring(l,r)||"Click me"}[/button]`;e.value=e.value.substring(0,l)+a+e.value.substring(r),e.selectionStart=e.selectionEnd=l+14,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="linksc")if(o.linksc)o.linksc(e);else{const l=e.selectionStart,r=e.selectionEnd,a=`[link href=""]${e.value.substring(l,r)||"Link text"}[/link]`;e.value=e.value.substring(0,l)+a+e.value.substring(r),e.selectionStart=e.selectionEnd=l+12,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="colourpick"){const l=e.selectionStart;document.getElementById("dm-colour-overlay")?.remove();const r=document.createElement("div");r.id="dm-colour-overlay",r.style.cssText="position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;background:rgba(0,0,0,.5);";const d=document.createElement("div");d.style.cssText="background:var(--dm-surface,#1e1e2e);border:1px solid var(--dm-border,#3a3a5c);border-radius:12px;padding:1.75rem 2rem;display:flex;flex-direction:column;align-items:center;gap:1.25rem;min-width:260px;box-shadow:0 16px 48px rgba(0,0,0,.55);";const a=document.createElement("p");a.textContent="Colour Picker",a.style.cssText="margin:0;font-weight:700;font-size:1rem;letter-spacing:.02em;";const b=document.createElement("input");b.type="color",b.value="#000000",b.style.cssText="width:160px;height:110px;cursor:pointer;border:none;background:none;padding:0;border-radius:6px;overflow:hidden;";const n=document.createElement("div");n.style.cssText="display:flex;align-items:center;gap:.5rem;";const s=document.createElement("input");s.type="text",s.value="#000000",s.className="form-input",s.style.cssText="font-family:monospace;width:100px;text-transform:uppercase;letter-spacing:.05em;";const p=document.createElement("button");p.type="button",p.className="btn btn-ghost btn-sm",p.textContent="Copy";const v=document.createElement("button");v.type="button",v.className="btn btn-primary btn-sm",v.textContent="Insert";const y=()=>r.remove();b.addEventListener("input",()=>{s.value=b.value}),s.addEventListener("input",()=>{/^#[0-9a-f]{6}$/i.test(s.value)&&(b.value=s.value)}),p.addEventListener("click",()=>{const k=document.createElement("input");k.value=s.value,document.body.appendChild(k),k.select(),document.execCommand("copy"),k.remove(),p.textContent="Copied!",setTimeout(()=>{p.textContent="Copy"},1500)}),v.addEventListener("click",()=>{e.selectionStart=e.selectionEnd=l,insertAtCursor(e,s.value),y()}),r.addEventListener("click",k=>{k.target===r&&y()}),n.appendChild(s),n.appendChild(p),n.appendChild(v),d.appendChild(a),d.appendChild(b),d.appendChild(n),r.appendChild(d),document.body.appendChild(r)}else if(t==="link")o.link&&o.link(e);else if(t==="image")o.image&&o.image(e);else if(t==="card")if(o.card)o.card(e);else{const l=e.selectionStart,r=e.selectionEnd,a=`[card title="Card Title"]
39
39
  ${e.value.substring(l,r)||"Content here"}
40
- [/card]`;e.value=e.value.substring(0,l)+a+e.value.substring(r),e.selectionStart=l+13,e.selectionEnd=l+23,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="hero"){const l=e.selectionStart,r=e.selectionEnd,a=`[hero title="Hero Title" tagline="A short tagline" size="lg" variant="gradient-blue"]
40
+ [/card]`;e.value=e.value.substring(0,l)+a+e.value.substring(r),e.selectionStart=l+13,e.selectionEnd=l+23,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="hero")if(o.hero)o.hero(e);else{const l=e.selectionStart,r=e.selectionEnd,a=`[hero title="Hero Title" tagline="A short tagline" size="lg"]
41
41
  ${e.value.substring(l,r)||"Optional body content here."}
42
42
  [/hero]`;e.value=e.value.substring(0,l)+a+e.value.substring(r),e.selectionStart=e.selectionEnd=l+a.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="grid")if(o.grid)o.grid(e);else{const l=e.selectionStart,r=`[grid cols="2" gap="4"]
43
43
  [col]
@@ -60,10 +60,10 @@ Describe this event.
60
60
  [item]Item 2[/item]
61
61
  [item]Item 3[/item]
62
62
  [/listgroup]
63
- `);else if(t==="collection")o.collection?o.collection(e):insertAtCursor(e,'[collection slug="" display="table" /]');else if(t==="view")o.view&&o.view(e);else if(t==="cta")o.cta&&o.cta(e);else if(t==="form")o.form?o.form(e):insertAtCursor(e,'[form slug="" /]');else if(t==="tabs")o.tabs&&o.tabs(e);else if(t==="accordion")if(o.accordion)o.accordion(e);else{const l=e.selectionStart,r=`[accordion]
63
+ `);else if(t==="collection")o.collection?o.collection(e):insertAtCursor(e,'[collection slug="" display="table" /]');else if(t==="view")o.view&&o.view(e);else if(t==="cta")o.cta&&o.cta(e);else if(t==="form")o.form?o.form(e):insertAtCursor(e,'[form slug="" /]');else if(t==="tabs")o.tabs&&o.tabs(e);else if(t==="banner")o.banner&&o.banner(e);else if(t==="accordion")if(o.accordion)o.accordion(e);else{const l=e.selectionStart,r=`[accordion]
64
64
  [item title="Item 1"]Content here.[/item]
65
65
  [item title="Item 2"]Content here.[/item]
66
66
  [/accordion]
67
- `;e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+r.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="text"){let n=function(m,u){const f=document.createElement("div"),L=document.createElement("label");return L.style.cssText=a,L.textContent=m,f.appendChild(L),f.appendChild(u),f},s=function(m){const u=document.createElement("select");return u.style.cssText=b,[["","\u2014 default \u2014"],...m].forEach(([f,L])=>{const H=document.createElement("option");H.value=f,H.textContent=L,u.appendChild(H)}),u},p=function(m,u){const f=document.createElement("input");return f.type="text",f.placeholder=m||"",f.value=u||"",f.style.cssText=b,f},v=function(m){const u=document.createElement("label");u.style.cssText="display:flex;align-items:center;gap:.5rem;cursor:pointer;";const f=document.createElement("input");f.type="checkbox";const L=document.createElement("span");return L.style.cssText="font-size:.85em;color:var(--dm-text,#eee);",L.textContent=m,u.appendChild(f),u.appendChild(L),{wrap:u,cb:f}},y=function(m,u){const f=document.createElement("div");return f.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:.5rem;",f.appendChild(m),f.appendChild(u),f},k=function(m){const u=document.createElement("div");return u.style.cssText="border-top:1px solid var(--dm-border,#333);padding-top:.5rem;margin-top:.1rem;font-size:.65rem;font-weight:700;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.08em;",u.textContent=m,u},q=function(){const m=[];C.value&&m.push(`font-size:${Y[C.value]||C.value}`);const u=parseFloat(S.value);!isNaN(u)&&u>0&&m.push(`font-size:${u}pt`),M.checked?m.push("font-weight:700"):x.value&&m.push(`font-weight:${ee[x.value]||x.value}`),O.checked&&m.push("font-style:italic");const f=W.value.trim();f&&m.push(`color:${X[f]||f}`),z.value&&m.push(`font-family:${ne[z.value]}`),T.value&&m.push(`text-transform:${oe[T.value]}`),N.value&&m.push(`text-decoration:${ie[N.value]}`),B.value&&m.push(`letter-spacing:${te[B.value]}`),A.value&&(m.push("display:block"),m.push(`text-align:${A.value}`)),R.value.trim()&&m.push(R.value.trim()),D.style.cssText=m.join(";"),D.textContent=w.value||"Preview text"};const l=e.selectionStart,r=e.selectionEnd,d=e.value.substring(l,r)||"",a="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;",b="width:100%;padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;",g=document.createElement("div");g.style.cssText="padding:1rem;display:flex;flex-direction:column;gap:.6rem;overflow-y:auto;max-height:75vh;";const w=p("Text to style\u2026",d);g.appendChild(n("Content",w)),g.appendChild(k("Typography"));const C=s([["xs","xs \u2014 0.75rem"],["sm","sm \u2014 0.875rem"],["base","base \u2014 1rem"],["lg","lg \u2014 1.125rem"],["xl","xl \u2014 1.25rem"],["2xl","2xl \u2014 1.5rem"],["3xl","3xl \u2014 1.875rem"],["4xl","4xl \u2014 2.25rem"]]),S=p("pt value (overrides Size)");g.appendChild(y(n("Size",C),n("Point Size (pt)",S)));const x=s([["thin","Thin (100)"],["light","Light (300)"],["normal","Normal (400)"],["medium","Medium (500)"],["semibold","Semibold (600)"],["bold","Bold (700)"],["extrabold","Extrabold (800)"],["black","Black (900)"]]),{wrap:j,cb:M}=v("Bold (overrides Weight)"),{wrap:Q,cb:O}=v("Italic"),V=document.createElement("div");V.style.cssText="display:flex;flex-direction:column;gap:.4rem;justify-content:flex-end;",V.appendChild(j),V.appendChild(Q),g.appendChild(y(n("Weight",x),V)),g.appendChild(k("Appearance"));const W=p("e.g. primary, #ff0000"),z=s([["Georgia","Georgia (serif)"],["Arial","Arial (sans-serif)"],["Verdana","Verdana (sans-serif)"],["Courier New","Courier New (mono)"],["Times New Roman","Times New Roman (serif)"],["Trebuchet MS","Trebuchet MS"]]);g.appendChild(y(n("Colour",W),n("Font",z))),g.appendChild(k("Formatting"));const T=s([["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]),N=s([["underline","Underline"],["line-through","Line-through"],["none","None"]]);g.appendChild(y(n("Transform",T),n("Decoration",N)));const B=s([["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]),A=s([["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]);g.appendChild(y(n("Spacing",B),n("Align",A))),g.appendChild(k("Advanced"));const R=p("e.g. margin-top:1rem;display:block");g.appendChild(n("Style",R));const _=p("CSS class(es)"),F=p("ID");g.appendChild(y(n("Class",_),n("ID",F)));const G=document.createElement("div");G.style.cssText="padding:.75rem;background:var(--dm-surface-subtle,#111);border-radius:4px;min-height:2.5rem;display:flex;align-items:center;";const D=document.createElement("span");D.textContent=d||"Preview text",G.appendChild(D),g.appendChild(n("Preview",G));const X={primary:"var(--dm-color-primary)",secondary:"var(--dm-color-secondary)",muted:"var(--dm-text-muted)",danger:"var(--dm-color-danger)",success:"var(--dm-color-success)",warning:"var(--dm-color-warning)",info:"var(--dm-color-info)"},Y={xs:".75rem",sm:".875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},ee={thin:"100",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},te={tight:"-0.05em",normal:"0em",wide:"0.05em",wider:"0.1em"},ne={Georgia:"Georgia,serif",Arial:"Arial,sans-serif",Verdana:"Verdana,sans-serif","Courier New":"'Courier New',monospace","Times New Roman":"'Times New Roman',serif","Trebuchet MS":"'Trebuchet MS',sans-serif"},oe={upper:"uppercase",lower:"lowercase",capitalize:"capitalize",none:"none"},ie={underline:"underline","line-through":"line-through",none:"none"};M.addEventListener("change",()=>{x.disabled=M.checked,M.checked&&(x.value=""),q()}),[C,x,z,T,N,B,A].forEach(m=>{m.addEventListener("change",q)}),[W,w,R,S].forEach(m=>{m.addEventListener("input",q)}),O.addEventListener("change",q);const P=document.createElement("button");P.type="button",P.className="btn btn-primary",P.textContent="Insert",g.appendChild(P);const K=E.modal({title:"Style Text",size:"md"});K.element.appendChild(g),K.open(),P.addEventListener("click",()=>{const m=w.value;if(!m.trim())return;const u=[];C.value&&u.push(`size="${C.value}"`);const f=parseFloat(S.value);!isNaN(f)&&f>0&&u.push(`point-size="${f}"`),M.checked?u.push("bold"):x.value&&u.push(`weight="${x.value}"`),O.checked&&u.push("italic"),W.value.trim()&&u.push(`color="${W.value.trim()}"`),z.value&&u.push(`font="${z.value}"`),T.value&&u.push(`transform="${T.value}"`),N.value&&u.push(`decoration="${N.value}"`),B.value&&u.push(`spacing="${B.value}"`),A.value&&u.push(`align="${A.value}"`),R.value.trim()&&u.push(`style="${R.value.trim().replace(/"/g,"&quot;")}"`),_.value.trim()&&u.push(`class="${_.value.trim()}"`),F.value.trim()&&u.push(`id="${F.value.trim()}"`);const H=`[text${u.length?" "+u.join(" "):""}]${m}[/text]`;K.close(),insertAtCursor(e,H),e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()})}else t==="help"&&o.help&&o.help(e)}const J=[{icon:"bold",title:"Bold (Ctrl+B)",action:t=>wrapSelection(t,"**","**")},{icon:"italic",title:"Italic (Ctrl+I)",action:t=>wrapSelection(t,"_","_")},{icon:"strikethrough",title:"Strikethrough",action:t=>wrapSelection(t,"~~","~~")},"|",{type:"dropdown",icon:"heading-1",title:"Headings",items:[{label:"Heading 1",icon:"heading-1",action:t=>insertLine(t,"# ")},{label:"Heading 2",icon:"heading-2",action:t=>insertLine(t,"## ")},{label:"Heading 3",icon:"heading-3",action:t=>insertLine(t,"### ")}]},"|",{icon:"list-bullet",title:"Bullet list",action:t=>insertLine(t,"- ")},{icon:"list-numbered",title:"Numbered list",action:t=>insertLine(t,"1. ")},"|",{type:"dropdown",icon:"quote",title:"Paragraph",items:[{label:"Blockquote",icon:"quote",action:t=>insertLine(t,"> ")},{label:"Horizontal rule",icon:"minus-circle",action:t=>insertAtCursor(t,`
67
+ `;e.value=e.value.substring(0,l)+r+e.value.substring(l),e.selectionStart=e.selectionEnd=l+r.length,e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()}else if(t==="text"){let n=function(m,u){const f=document.createElement("div"),L=document.createElement("label");return L.style.cssText=a,L.textContent=m,f.appendChild(L),f.appendChild(u),f},s=function(m){const u=document.createElement("select");return u.style.cssText=b,[["","\u2014 default \u2014"],...m].forEach(([f,L])=>{const P=document.createElement("option");P.value=f,P.textContent=L,u.appendChild(P)}),u},p=function(m,u){const f=document.createElement("input");return f.type="text",f.placeholder=m||"",f.value=u||"",f.style.cssText=b,f},v=function(m){const u=document.createElement("label");u.style.cssText="display:flex;align-items:center;gap:.5rem;cursor:pointer;";const f=document.createElement("input");f.type="checkbox";const L=document.createElement("span");return L.style.cssText="font-size:.85em;color:var(--dm-text,#eee);",L.textContent=m,u.appendChild(f),u.appendChild(L),{wrap:u,cb:f}},y=function(m,u){const f=document.createElement("div");return f.style.cssText="display:grid;grid-template-columns:1fr 1fr;gap:.5rem;",f.appendChild(m),f.appendChild(u),f},k=function(m){const u=document.createElement("div");return u.style.cssText="border-top:1px solid var(--dm-border,#333);padding-top:.5rem;margin-top:.1rem;font-size:.65rem;font-weight:700;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.08em;",u.textContent=m,u},q=function(){const m=[];C.value&&m.push(`font-size:${Y[C.value]||C.value}`);const u=parseFloat(S.value);!isNaN(u)&&u>0&&m.push(`font-size:${u}pt`),M.checked?m.push("font-weight:700"):x.value&&m.push(`font-weight:${ee[x.value]||x.value}`),O.checked&&m.push("font-style:italic");const f=W.value.trim();f&&m.push(`color:${X[f]||f}`),z.value&&m.push(`font-family:${ne[z.value]}`),T.value&&m.push(`text-transform:${oe[T.value]}`),N.value&&m.push(`text-decoration:${ie[N.value]}`),B.value&&m.push(`letter-spacing:${te[B.value]}`),A.value&&(m.push("display:block"),m.push(`text-align:${A.value}`)),R.value.trim()&&m.push(R.value.trim()),D.style.cssText=m.join(";"),D.textContent=w.value||"Preview text"};const l=e.selectionStart,r=e.selectionEnd,d=e.value.substring(l,r)||"",a="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;",b="width:100%;padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;",g=document.createElement("div");g.style.cssText="padding:1rem;display:flex;flex-direction:column;gap:.6rem;overflow-y:auto;max-height:75vh;";const w=p("Text to style\u2026",d);g.appendChild(n("Content",w)),g.appendChild(k("Typography"));const C=s([["xs","xs \u2014 0.75rem"],["sm","sm \u2014 0.875rem"],["base","base \u2014 1rem"],["lg","lg \u2014 1.125rem"],["xl","xl \u2014 1.25rem"],["2xl","2xl \u2014 1.5rem"],["3xl","3xl \u2014 1.875rem"],["4xl","4xl \u2014 2.25rem"]]),S=p("pt value (overrides Size)");g.appendChild(y(n("Size",C),n("Point Size (pt)",S)));const x=s([["thin","Thin (100)"],["light","Light (300)"],["normal","Normal (400)"],["medium","Medium (500)"],["semibold","Semibold (600)"],["bold","Bold (700)"],["extrabold","Extrabold (800)"],["black","Black (900)"]]),{wrap:j,cb:M}=v("Bold (overrides Weight)"),{wrap:Q,cb:O}=v("Italic"),V=document.createElement("div");V.style.cssText="display:flex;flex-direction:column;gap:.4rem;justify-content:flex-end;",V.appendChild(j),V.appendChild(Q),g.appendChild(y(n("Weight",x),V)),g.appendChild(k("Appearance"));const W=p("e.g. primary, #ff0000"),z=s([["Georgia","Georgia (serif)"],["Arial","Arial (sans-serif)"],["Verdana","Verdana (sans-serif)"],["Courier New","Courier New (mono)"],["Times New Roman","Times New Roman (serif)"],["Trebuchet MS","Trebuchet MS"]]);g.appendChild(y(n("Colour",W),n("Font",z))),g.appendChild(k("Formatting"));const T=s([["upper","Uppercase"],["lower","Lowercase"],["capitalize","Capitalise"],["none","None"]]),N=s([["underline","Underline"],["line-through","Line-through"],["none","None"]]);g.appendChild(y(n("Transform",T),n("Decoration",N)));const B=s([["tight","Tight"],["normal","Normal"],["wide","Wide"],["wider","Wider"]]),A=s([["left","Left"],["center","Centre"],["right","Right"],["justify","Justify"]]);g.appendChild(y(n("Spacing",B),n("Align",A))),g.appendChild(k("Advanced"));const R=p("e.g. margin-top:1rem;display:block");g.appendChild(n("Style",R));const _=p("CSS class(es)"),F=p("ID");g.appendChild(y(n("Class",_),n("ID",F)));const G=document.createElement("div");G.style.cssText="padding:.75rem;background:var(--dm-surface-subtle,#111);border-radius:4px;min-height:2.5rem;display:flex;align-items:center;";const D=document.createElement("span");D.textContent=d||"Preview text",G.appendChild(D),g.appendChild(n("Preview",G));const X={primary:"var(--dm-color-primary)",secondary:"var(--dm-color-secondary)",muted:"var(--dm-text-muted)",danger:"var(--dm-color-danger)",success:"var(--dm-color-success)",warning:"var(--dm-color-warning)",info:"var(--dm-color-info)"},Y={xs:".75rem",sm:".875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.875rem","4xl":"2.25rem"},ee={thin:"100",light:"300",normal:"400",medium:"500",semibold:"600",bold:"700",extrabold:"800",black:"900"},te={tight:"-0.05em",normal:"0em",wide:"0.05em",wider:"0.1em"},ne={Georgia:"Georgia,serif",Arial:"Arial,sans-serif",Verdana:"Verdana,sans-serif","Courier New":"'Courier New',monospace","Times New Roman":"'Times New Roman',serif","Trebuchet MS":"'Trebuchet MS',sans-serif"},oe={upper:"uppercase",lower:"lowercase",capitalize:"capitalize",none:"none"},ie={underline:"underline","line-through":"line-through",none:"none"};M.addEventListener("change",()=>{x.disabled=M.checked,M.checked&&(x.value=""),q()}),[C,x,z,T,N,B,A].forEach(m=>{m.addEventListener("change",q)}),[W,w,R,S].forEach(m=>{m.addEventListener("input",q)}),O.addEventListener("change",q);const H=document.createElement("button");H.type="button",H.className="btn btn-primary",H.textContent="Insert",g.appendChild(H);const K=E.modal({title:"Style Text",size:"md"});K.element.appendChild(g),K.open(),H.addEventListener("click",()=>{const m=w.value;if(!m.trim())return;const u=[];C.value&&u.push(`size="${C.value}"`);const f=parseFloat(S.value);!isNaN(f)&&f>0&&u.push(`point-size="${f}"`),M.checked?u.push("bold"):x.value&&u.push(`weight="${x.value}"`),O.checked&&u.push("italic"),W.value.trim()&&u.push(`color="${W.value.trim()}"`),z.value&&u.push(`font="${z.value}"`),T.value&&u.push(`transform="${T.value}"`),N.value&&u.push(`decoration="${N.value}"`),B.value&&u.push(`spacing="${B.value}"`),A.value&&u.push(`align="${A.value}"`),R.value.trim()&&u.push(`style="${R.value.trim().replace(/"/g,"&quot;")}"`),_.value.trim()&&u.push(`class="${_.value.trim()}"`),F.value.trim()&&u.push(`id="${F.value.trim()}"`);const P=`[text${u.length?" "+u.join(" "):""}]${m}[/text]`;K.close(),insertAtCursor(e,P),e.dispatchEvent(new Event("input",{bubbles:!0})),e.focus()})}else t==="help"&&o.help&&o.help(e)}const J=[{icon:"bold",title:"Bold (Ctrl+B)",action:t=>wrapSelection(t,"**","**")},{icon:"italic",title:"Italic (Ctrl+I)",action:t=>wrapSelection(t,"_","_")},{icon:"strikethrough",title:"Strikethrough",action:t=>wrapSelection(t,"~~","~~")},"|",{type:"dropdown",icon:"heading-1",title:"Headings",items:[{label:"Heading 1",icon:"heading-1",action:t=>insertLine(t,"# ")},{label:"Heading 2",icon:"heading-2",action:t=>insertLine(t,"## ")},{label:"Heading 3",icon:"heading-3",action:t=>insertLine(t,"### ")}]},"|",{icon:"list-bullet",title:"Bullet list",action:t=>insertLine(t,"- ")},{icon:"list-numbered",title:"Numbered list",action:t=>insertLine(t,"1. ")},"|",{type:"dropdown",icon:"quote",title:"Paragraph",items:[{label:"Blockquote",icon:"quote",action:t=>insertLine(t,"> ")},{label:"Horizontal rule",icon:"minus-circle",action:t=>insertAtCursor(t,`
68
68
  ---
69
- `)}]},"|",{type:"dropdown",icon:"code-inline",title:"Code",items:[{label:"Inline code",icon:"code-inline",action:t=>wrapSelection(t,"`","`")},{label:"Code block",icon:"code-block",action:t=>wrapSelection(t,"\n```\n","\n```\n")}]},"|",{type:"dropdown",icon:"plus-circle",title:"Insert",items:[{label:"Accordion",icon:"accordion-insert",action:"accordion"},{label:"Badge",icon:"badge",action:"badge"},{label:"Block",icon:"layout",action:"block"},{label:"Button",icon:"btn-insert",action:"button"},{label:"Card",icon:"card",action:"card"},{label:"Colour Picker",icon:"colour-picker",action:"colourpick"},{label:"Collection",icon:"database",action:"collection"},{label:"CTA Button",icon:"mouse-pointer",action:"cta"},{label:"Form",icon:"file-text",action:"form"},{label:"Grid",icon:"columns",action:"grid"},{label:"Hero",icon:"hero",action:"hero"},{label:"Icon",icon:"icon-pick",action:"iconpick"},{label:"Image",icon:"image-add",action:"image"},{label:"Link",icon:"link-shortcode",action:"linksc"},{label:"List Group",icon:"list",action:"listgroup"},{label:"Spacer",icon:"spacer-insert",action:"spacerpick"},{label:"Tabs",icon:"layout-list",action:"tabs"},{label:"Text",icon:"text-style",action:"text"},{label:"Timeline",icon:"activity",action:"timeline"},{label:"View",icon:"eye",action:"view"}]},"|",{icon:"sparkles",title:"Effects",action:"effects"},{icon:"help-circle",title:"Editor help",action:"help"}];export function createToolbar(t,e,h={}){re();const i={link:null,image:null,card:null,grid:null,help:null,effects:null,collection:null,view:null,cta:null,form:null,button:null,linksc:null,tabs:null,accordion:null},c=h.spacerDefault??40,o=t.get(0),l=e.get(0);l.textContent="",J.forEach((n,s)=>{if(n==="|"){const p=document.createElement("span");p.className="editor-toolbar-sep",l.appendChild(p)}else{const p=document.createElement("button");p.className=n.type==="dropdown"?"editor-toolbar-btn editor-toolbar-dropdown-trigger":"editor-toolbar-btn",p.setAttribute("data-tooltip",n.title),p.setAttribute("data-idx",String(s)),p.type="button";const v=document.createElement("span");if(v.setAttribute("data-icon",n.icon),p.appendChild(v),n.type==="dropdown"){const y=document.createElement("span");y.className="editor-toolbar-caret",y.textContent="\u25BE",p.appendChild(y)}l.appendChild(p)}});const r=document.createElement("div");r.className="editor-toolbar-right",[{mode:"split",icon:"columns",label:"Split view",active:!0},{mode:"write",icon:"file-text",label:"Write only",active:!1},{mode:"preview",icon:"eye",label:"Preview only",active:!1}].forEach(n=>{const s=document.createElement("button");s.className="editor-view-btn"+(n.active?" active":""),s.setAttribute("data-mode",n.mode),s.setAttribute("data-tooltip",n.label),s.type="button";const p=document.createElement("span");p.setAttribute("data-icon",n.icon),s.appendChild(p),r.appendChild(s)});const d=document.createElement("span");d.className="editor-toolbar-sep",r.appendChild(d);const a=document.createElement("button");a.id="fullscreen-btn",a.className="editor-toolbar-btn",a.setAttribute("data-tooltip","Toggle fullscreen"),a.type="button";const b=document.createElement("span");return b.setAttribute("data-icon","expand"),a.appendChild(b),r.appendChild(a),l.appendChild(r),Domma.icons.scan(),l.querySelectorAll("[data-tooltip]").forEach(n=>{E.tooltip(n,{content:n.getAttribute("data-tooltip"),position:"top"})}),e.on("click",".editor-toolbar-btn[data-idx]",function(){const n=parseInt($(this).data("idx"),10),s=J[n];if(!s||s==="|")return;const p=e.get(0).querySelector(`[data-idx="${n}"]`),v={spacerDefault:c,handlers:i};s.type==="dropdown"?de(o,p,s.items,v):U(s.action,o,p,v)}),attachEditorKeybindings(o),o.addEventListener("keydown",n=>{const s=n.key.toLowerCase();(n.ctrlKey||n.metaKey)&&(s==="b"?(n.preventDefault(),wrapSelection(o,"**","**")):s==="i"?(n.preventDefault(),wrapSelection(o,"_","_")):s==="k"&&(n.preventDefault(),i.link&&i.link(o)))}),{$toolbar:e,onLink(n){i.link=n},onImage(n){i.image=n},onCard(n){i.card=n},onGrid(n){i.grid=n},onHelp(n){i.help=n},onEffects(n){i.effects=n},onCollection(n){i.collection=n},onBlock(n){i.block=n},onView(n){i.view=n},onCta(n){i.cta=n},onForm(n){i.form=n},onButton(n){i.button=n},onLinkShortcode(n){i.linksc=n},onTabs(n){i.tabs=n},onAccordion(n){i.accordion=n},onListGroup(n){i.listgroup=n}}}
69
+ `)}]},"|",{type:"dropdown",icon:"code-inline",title:"Code",items:[{label:"Inline code",icon:"code-inline",action:t=>wrapSelection(t,"`","`")},{label:"Code block",icon:"code-block",action:t=>wrapSelection(t,"\n```\n","\n```\n")}]},"|",{type:"dropdown",icon:"plus-circle",title:"Insert",items:[{label:"Accordion",icon:"accordion-insert",action:"accordion"},{label:"Banner",icon:"banner-insert",action:"banner"},{label:"Badge",icon:"badge",action:"badge"},{label:"Block",icon:"layout",action:"block"},{label:"Button",icon:"btn-insert",action:"button"},{label:"Card",icon:"card",action:"card"},{label:"Colour Picker",icon:"colour-picker",action:"colourpick"},{label:"Collection",icon:"database",action:"collection"},{label:"CTA Button",icon:"mouse-pointer",action:"cta"},{label:"Form",icon:"file-text",action:"form"},{label:"Grid",icon:"columns",action:"grid"},{label:"Hero",icon:"hero",action:"hero"},{label:"Icon",icon:"icon-pick",action:"iconpick"},{label:"Image",icon:"image-add",action:"image"},{label:"Link",icon:"link-shortcode",action:"linksc"},{label:"List Group",icon:"list",action:"listgroup"},{label:"Spacer",icon:"spacer-insert",action:"spacerpick"},{label:"Tabs",icon:"layout-list",action:"tabs"},{label:"Text",icon:"text-style",action:"text"},{label:"Timeline",icon:"activity",action:"timeline"},{label:"View",icon:"eye",action:"view"}]},"|",{icon:"sparkles",title:"Effects",action:"effects"},{icon:"help-circle",title:"Editor help",action:"help"}];export function createToolbar(t,e,h={}){re();const i={link:null,image:null,card:null,grid:null,help:null,effects:null,collection:null,view:null,cta:null,form:null,button:null,linksc:null,tabs:null,accordion:null,hero:null,banner:null},c=h.spacerDefault??40,o=t.get(0),l=e.get(0);l.textContent="",J.forEach((n,s)=>{if(n==="|"){const p=document.createElement("span");p.className="editor-toolbar-sep",l.appendChild(p)}else{const p=document.createElement("button");p.className=n.type==="dropdown"?"editor-toolbar-btn editor-toolbar-dropdown-trigger":"editor-toolbar-btn",p.setAttribute("data-tooltip",n.title),p.setAttribute("data-idx",String(s)),p.type="button";const v=document.createElement("span");if(v.setAttribute("data-icon",n.icon),p.appendChild(v),n.type==="dropdown"){const y=document.createElement("span");y.className="editor-toolbar-caret",y.textContent="\u25BE",p.appendChild(y)}l.appendChild(p)}});const r=document.createElement("div");r.className="editor-toolbar-right",[{mode:"split",icon:"columns",label:"Split view",active:!0},{mode:"write",icon:"file-text",label:"Write only",active:!1},{mode:"preview",icon:"eye",label:"Preview only",active:!1}].forEach(n=>{const s=document.createElement("button");s.className="editor-view-btn"+(n.active?" active":""),s.setAttribute("data-mode",n.mode),s.setAttribute("data-tooltip",n.label),s.type="button";const p=document.createElement("span");p.setAttribute("data-icon",n.icon),s.appendChild(p),r.appendChild(s)});const d=document.createElement("span");d.className="editor-toolbar-sep",r.appendChild(d);const a=document.createElement("button");a.id="fullscreen-btn",a.className="editor-toolbar-btn",a.setAttribute("data-tooltip","Toggle fullscreen"),a.type="button";const b=document.createElement("span");return b.setAttribute("data-icon","expand"),a.appendChild(b),r.appendChild(a),l.appendChild(r),Domma.icons.scan(),l.querySelectorAll("[data-tooltip]").forEach(n=>{E.tooltip(n,{content:n.getAttribute("data-tooltip"),position:"top"})}),e.on("click",".editor-toolbar-btn[data-idx]",function(){const n=parseInt($(this).data("idx"),10),s=J[n];if(!s||s==="|")return;const p=e.get(0).querySelector(`[data-idx="${n}"]`),v={spacerDefault:c,handlers:i};s.type==="dropdown"?de(o,p,s.items,v):U(s.action,o,p,v)}),attachEditorKeybindings(o),o.addEventListener("keydown",n=>{const s=n.key.toLowerCase();(n.ctrlKey||n.metaKey)&&(s==="b"?(n.preventDefault(),wrapSelection(o,"**","**")):s==="i"?(n.preventDefault(),wrapSelection(o,"_","_")):s==="k"&&(n.preventDefault(),i.link&&i.link(o)))}),{$toolbar:e,onLink(n){i.link=n},onImage(n){i.image=n},onCard(n){i.card=n},onGrid(n){i.grid=n},onHelp(n){i.help=n},onEffects(n){i.effects=n},onCollection(n){i.collection=n},onBlock(n){i.block=n},onView(n){i.view=n},onCta(n){i.cta=n},onForm(n){i.form=n},onButton(n){i.button=n},onLinkShortcode(n){i.linksc=n},onTabs(n){i.tabs=n},onAccordion(n){i.accordion=n},onHero(n){i.hero=n},onBanner(n){i.banner=n},onListGroup(n){i.listgroup=n}}}
@@ -0,0 +1 @@
1
+ import{openIconPicker as d}from"./card-builder.js";const s="display:block;font-size:.7rem;font-weight:600;color:var(--dm-text-muted,#aaa);text-transform:uppercase;letter-spacing:.05em;margin-bottom:.25rem;",a="width:100%;padding:.4rem .6rem;background:var(--dm-input-bg,#1a1a1a);border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text,#eee);font-size:.9em;box-sizing:border-box;";export function makeField(r,t){const e=document.createElement("div"),n=document.createElement("label");return n.style.cssText=s,n.textContent=r,e.appendChild(n),e.appendChild(t),e}export function makeSelect(r){const t=document.createElement("select");return t.style.cssText=a,r.forEach(([e,n])=>{const o=document.createElement("option");o.value=e,o.textContent=n,t.appendChild(o)}),t}export function makeTextInput(r="",t=""){const e=document.createElement("input");return e.type="text",e.placeholder=r,e.value=t,e.style.cssText=a,e}export function makeCheckbox(r){const t=document.createElement("label");t.style.cssText="display:flex;align-items:center;gap:.5rem;cursor:pointer;";const e=document.createElement("input");e.type="checkbox";const n=document.createElement("span");return n.style.cssText="font-size:.85em;color:var(--dm-text,#eee);",n.textContent=r,t.appendChild(e),t.appendChild(n),t}export function makeIconInput(r="",t=""){const e=document.createElement("div");e.style.cssText="display:flex;gap:.35rem;";const n=makeTextInput(r,t);n.style.flex="1";const o=document.createElement("button");return o.type="button",o.title="Browse icons",o.textContent="\u229E",o.style.cssText="padding:.35rem .55rem;background:transparent;border:1px solid var(--dm-border,#333);border-radius:4px;color:var(--dm-text-muted,#aaa);cursor:pointer;font-size:.85em;flex-shrink:0;",o.addEventListener("click",()=>d(c=>{n.value=c,n.dispatchEvent(new Event("input",{bubbles:!0}))})),e.appendChild(n),e.appendChild(o),{el:e,input:n}}export function makeLivePreview(){const r=document.createElement("pre");return r.style.cssText="background:var(--dm-surface-subtle,#111);border:1px solid var(--dm-border,#333);border-radius:4px;padding:.5rem .75rem;font-size:.75em;color:var(--dm-text-muted,#aaa);white-space:pre-wrap;word-break:break-all;margin:0;max-height:120px;overflow:auto;",r.textContent="",{el:r,update(t){r.textContent=t}}}