@lightspeed/crane 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cli.mjs +15 -15
  3. package/package.json +3 -3
  4. package/template/footers/example-footer/client.ts +1 -0
  5. package/template/footers/example-footer/server.ts +1 -0
  6. package/template/headers/example-header/client.ts +1 -0
  7. package/template/headers/example-header/server.ts +1 -0
  8. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/client.ts +1 -0
  9. package/template/layouts/catalog/example-catalog/slots/custom-bottom-bar/server.ts +1 -0
  10. package/template/preview/shared/api-routes.ts +170 -4
  11. package/template/preview/shared/preview.ts +20 -2
  12. package/template/preview/shared/utils.ts +3 -2
  13. package/template/preview/ssr-server.ts +3 -2
  14. package/template/preview/vite.config.js +4 -2
  15. package/template/reference/sections/featured-products/client.ts +1 -0
  16. package/template/reference/sections/featured-products/server.ts +1 -0
  17. package/template/reference/sections/intro-slider/client.ts +1 -0
  18. package/template/reference/sections/intro-slider/server.ts +1 -0
  19. package/template/reference/sections/tag-lines/client.ts +1 -0
  20. package/template/reference/sections/tag-lines/composables/highlighted-text-image-list.ts +2 -1
  21. package/template/reference/sections/tag-lines/server.ts +1 -0
  22. package/template/reference/sections/trending-categories/client.ts +1 -0
  23. package/template/reference/sections/trending-categories/server.ts +1 -0
  24. package/template/reference/shared/utils/styles.ts +1 -0
  25. package/template/sections/example-section/client.ts +1 -0
  26. package/template/sections/example-section/server.ts +1 -0
  27. package/template/sections/example-section/showcases/1.ts +2 -22
  28. package/template/sections/example-section/showcases/2.ts +2 -22
  29. package/template/sections/example-section/showcases/3.ts +2 -22
  30. package/template/sections/example-section/showcases/translations.ts +4 -142
package/dist/cli.mjs CHANGED
@@ -1,23 +1,23 @@
1
- import mn from"cac";import*as de from"path";import g,{resolve as u,parse as K,dirname as Ge,relative as hn,basename as yn,sep as Be}from"path";import{red as gn,yellow as $n,green as V}from"kolorist";import Me from"prompts";import b from"node:fs";import R from"node:path";import T from"node:process";import*as ue from"fs";import h,{existsSync as $,statSync as bn,rename as Ue,unlink as ze,promises as $e,writeFileSync as Xe,readFileSync as wn,createReadStream as En}from"fs";import{pathToFileURL as He}from"url";import{fileURLToPath as Tn}from"node:url";import Sn from"adm-zip";import{glob as f,globSync as Ke}from"glob";import{normalizePath as jn,defineConfig as Ve,build as Y,createServer as _n}from"vite";import{SectionTypeEnum as S,BackgroundStyleEnum as be,ButtonAppearanceEnum as Cn,ButtonSizeEnum as vn,ButtonShapeEnum as On,OverlayTypeEnum as fe,DesignEditorType as F,ValidationTypeEnum as z,PluginTypeEnum as C,ConfigTypeEnum as y,TemplatePageEnum as I}from"@lightspeed/crane-api";import In from"tinycolor2";import Dn from"ajv/dist/2020.js";import Pn from"ajv-formats";import An from"node:zlib";import{promisify as xn}from"node:util";import{JSONPath as Ln}from"jsonpath-plus";import{builtinModules as Ye}from"module";import{viteExternalsPlugin as We}from"vite-plugin-externals";import Nn from"vite-plugin-compression";import kn from"@vitejs/plugin-vue";import Rn from"vite-tsconfig-paths";import Fn from"vite-plugin-checker";import{encode as qn}from"@jridgewell/sourcemap-codec";import Gn,{AxiosError as Je}from"axios";import{ConcurrencyManager as Bn}from"axios-concurrency";import{readFile as Ze}from"fs/promises";import*as q from"process";import x from"process";import{inc as Mn}from"semver";import Un from"cli-progress";function se(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**i).toFixed(s))} ${n[i]}`}const p={error:e=>console.log(gn(e)),warn:e=>console.log($n(e)),info:e=>console.log(V(e))},N="_temp",zn="dist",j="dist/sections",W="dist/headers",J="dist/footers",D="dist/templates",Z="layouts",Qe="preview",v=`dist/${Z}`,Xn=[j,W,J,D,v],et=2*1024*1024,tt=500*1024;function me(e){return!!e}function ot(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Hn="Resource name can only contain alphanumeric characters, dashes, and underscores";function Kn(e){if(typeof e=="string"||typeof e=="number"){const t=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(t)return{isValid:t,errorMessage:null}}return{isValid:!1,errorMessage:Hn}}function Vn(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function k(e,t){try{const o=u(process.cwd(),t?`${e}${N}.mjs`:`${e}.mjs`),s=`?timestamp=${Date.now()}`;return(await import(He(o).href+s)).default}catch(o){const s=`File [${e}${t?N:""}.mjs] is either invalid or undefined`,n=o instanceof Error?o.message:s;throw new Error(n)}}function st(e){return Object.keys(e).length===0}function Yn(e){return g.parse(e).name}function nt(e,t){ue.statSync(e).isDirectory()?(ue.mkdirSync(t,{recursive:!0}),ue.readdirSync(e).forEach(o=>{const s=de.resolve(e,o),n=de.resolve(t,o);nt(s,n)})):ue.copyFileSync(e,t)}function G(e,t,o,s){const n=de.join(e,s?.[o]??o);nt(de.join(t,o),n)}function Wn(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>p.info(`Template [${e}] with pages structure named has been created`)}}function B(e){return R.resolve(Tn(import.meta.url),"../..",e)}function Jn(){const e=B("package.json");return e!==""?JSON.parse(b.readFileSync(e,"utf8")):{}}async function Zn(e){try{const t=e,o=T.cwd(),s=R.join(o,t),n=["templates","headers","preview","footers","reference","page-templates","layouts"],i={_gitignore:".gitignore"};b.existsSync(s)?(p.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(s);const r=B("template");b.readdirSync(r).filter(d=>d!=="package.json").filter(d=>!n.includes(d)).forEach(async d=>G(s,r,d,i));const a=JSON.parse(b.readFileSync(R.join(r,"package.json"),"utf-8"));a.name=e;const c=Jn();c.version&&(a.dependencies["@lightspeed/crane-api"]=c.dependencies["@lightspeed/crane-api"]),c.dependencies["@lightspeed/eslint-config-crane"]&&(a.dependencies["@lightspeed/eslint-config-crane"]=c.dependencies["@lightspeed/eslint-config-crane"]);const l=R.join(s,"package.json");b.writeFileSync(l,`${JSON.stringify(a,null,2)}
2
- `),p.info(`App ${e} created`)}catch(t){p.error(`Error while creating app: ${t.message}`),T.exit(1)}}function we(e,t,o,s){try{const n=T.cwd(),i=g.join(n,t);h.existsSync(i)||h.mkdirSync(i);const r=g.join(n,t,o);h.existsSync(r)?(p.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):h.mkdirSync(r);const a=B(e);h.readdirSync(a).forEach(async c=>G(r,a,c)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),T.exit(1)}}function Ee(e){const t=T.cwd(),o=B(`template/${e}`),s=g.join(t,e);h.existsSync(s)||(h.mkdirSync(s),h.readdirSync(o).forEach(async n=>G(s,o,n)))}function Qn(e,t,o){if(!h.existsSync(o)){h.copyFileSync(t,o);return}const s=h.readFileSync(t),n=h.readFileSync(o);s.equals(n)||p.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function it(e,t){const o=h.readdirSync(e,{withFileTypes:!0});h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),i=g.join(t,s.name);s.isDirectory()?it(n,i):Qn(s,n,i)})}function Te(){try{const e=T.cwd(),t=g.join(e,"shared"),o=B("template/shared");if(!h.existsSync(o))return;it(o,t)}catch(e){p.error(`Error while processing shared folder: ${e.message}`),T.exit(1)}}async function ei(e){Te(),we("template/sections/example-section","sections",e,"Section")}async function ti(e){const{targetPath:t,renameFiles:o,sourcePath:s,onTemplateCreated:n}=Wn(e);try{const i=T.cwd(),r=R.join(i,"templates"),a=B(s),c=b.readdirSync(a);b.existsSync(r)?b.existsSync(R.join(r,t))&&(p.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),T.exit(1)):b.mkdirSync(r),c.forEach(l=>G(r,a,l,o)),Ee("headers"),Ee("footers"),Ee("layouts"),n()}catch(i){p.error(`Error while creating template descriptors: ${i.message}`),T.exit(1)}}async function oi(){try{const e=T.cwd(),t=B("template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const i=R.join(t,n),r=R.join(e,n);b.existsSync(r)||b.mkdirSync(r,{recursive:!0});const a=b.readdirSync(i),c=b.readdirSync(r);if(n==="shared"){a.forEach(l=>{G(r,i,l)});continue}for(const l of a){if(l==="assets"){G(r,i,l);continue}if(c.includes(l)){const{name:d}=await Me({type:"text",name:"name",message:`The "${l}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});d?(G(r,i,l,{[l]:d}),s=!0):p.info(`Skipped: ${l}`)}else G(r,i,l)}}p.info("Reference templates have been added to the app"),s&&p.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){p.error(`Error while creating template descriptors: ${e.message}`),T.exit(1)}}const w={[S.SECTION]:{source:"sections",dist:"dist/sections"},[S.HEADER]:{source:"headers",dist:"dist/headers"},[S.FOOTER]:{source:"footers",dist:"dist/footers"}};var m=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e))(m||{});const si="https://blockbuster.ecwid.com",ni="/api/v1/custom-apps/resources/sections/upload",ii="/api/v1/custom-apps/resources/templates/upload",ri="/api/v1/custom-apps/manifests/sections",ai="/api/v1/custom-apps/manifests/templates",ci=5,li=3,pi=[m.Server,m.Client,m.ClientChunks,m.ClientAsset,m.Asset],di=[m.LayoutClient,m.LayoutAsset],ui=[m.SlotServer,m.SlotClient,m.SlotClientChunks,m.SlotClientAsset],fi=[m.Dependency,m.TemplateAsset,m.SourceCode],Q={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",INCORRECT_DISTRIBUTION_FOLDER:e=>`Distribution folder [${e}] is not found or has incorrect structure, please execute the build command first.`},rt={catalog:"products",category:"category",product:"product"},mi=e=>rt[e],at=e=>e in rt;async function M(e){return(await import(He(e).href)).default}function Se(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function P(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=In(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function ct(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}function hi(e){if(e!==void 0)return{...e,color:P(e.color)}}function je(e){return Object.fromEntries(Object.entries(e).filter(([t,o])=>o!==void 0))}function yi(e){if(e!==void 0)switch(e){case be.COLOR:return"solid";case be.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(be)}`)}}function gi({style:e,color:t}){const o=Array.isArray(t)?t:[t,t];return{background:{type:yi(e),solid:{color:P(o.at(0))},gradient:{fromColor:P(o.at(0)),toColor:P(o.at(1))}}}}function $i(e){if(e!==void 0)switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(Cn)}`)}}function bi(e){if(e!==void 0)switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(vn)}`)}}function wi(e){if(e!==void 0)switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(On)}`)}}function Ei(e){const t=$i(e.appearance),o=bi(e.size),s=wi(e.shape),n=Se(e.font),i=P(e.color),r=e.visible;return je({appearance:t,size:o,style:s,font:n,color:i,visible:r})}function Ti(e){if(e!==void 0)switch(e){case fe.COLOR:return"solid";case fe.GRADIENT:return"gradient";case fe.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(fe)}`)}}function Si(e){const t=e.color,o=Array.isArray(t)?t:[t,t];return{overlay:{type:Ti(e.overlay),solid:{color:P(o.at(0))},gradient:{fromColor:P(o.at(0)),toColor:P(o.at(1))}}}}function ji(e){const t=Se(e.font),o=P(e.color),s=ct(e.size);return je({font:t,color:o,size:s})}function _i(e){const t=P(e.color);return je({color:t})}function Ci(e){const t=Se(e.font),o=P(e.color),s=ct(e.size);return{font:t,color:o,size:s,frame:hi(e.frame)}}function _e(e,t){if(t.defaults===void 0)return;let o={};switch(e){case F.TEXT:{o=ji(t.defaults);break}case F.BUTTON:{o=Ei(t.defaults);break}case F.IMAGE:{o=Si(t.defaults);break}case F.BACKGROUND:{o=gi(t.defaults);break}case F.COLOR_PICKER:{o=_i(t.defaults);break}case F.LOGO:{o=Ci(t.defaults);break}case F.TOGGLE:case F.SELECTBOX:break;default:throw new Error(`Unknown design editor type: ${e}`)}return o}function lt(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type,n=_e(s,o);n&&(e[t].defaults=n)})}function vi(e){e!==void 0&&e.forEach(t=>{if(t.type!==void 0&&t.defaults!==void 0){const o=_e(t.type,t);o&&(t.defaults=o,t.defaults.type=t.type)}})}function pt(e){e!==void 0&&Object.keys(e).forEach(t=>{const o=e[t],s=o.type,n=_e(s,{defaults:o});n&&(e[t]={...e[t],...n})})}function Oi(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function Ii(e){const t={};for(const o in e){const s=e[o];for(const n in s){const i=t[n],r=s[n];if(i===void 0){const a={};a[o]=r,t[n]=a}else i[o]=r}}return t}function X(e,t){if(!e||typeof e!="object")return;const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&!Array.isArray(e)?o[s]=Oi(t,n):typeof n=="object"&&X(n,t)}}async function Ce(e){const t=u(process.cwd(),e),o=await M(t);return Ii(o)}function Di(e){return e.replace(/\\/g,"/")}function Pi(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function ve(e){return Pi(Di(e))}function dt(e){const t=ve(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[o,s]=t;if(!at(o))throw new Error(`Layout cannot be placed in a non-storefront section: ${o}`);const n=mi(o);return{id:s,sectionId:o,pageId:n}}async function Ai(){const e=`${v}/{product,catalog,category}/*`;return(await f(e,{ignore:["node_modules/**"]})).map(dt)}async function xi(e){return Ce(`${v}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function Li(e){try{const t=u(process.cwd(),`${v}/${e.sectionId}/${e.layoutId}/js/settings/content.mjs`),o=await M(t);return X(o,e.translations),o}catch(t){throw new Error(`Content descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}async function Ni(e){try{const t=u(process.cwd(),`${v}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await M(t);return lt(o),X(o,e.translations),o}catch(t){throw new Error(`Design descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}function ee(e,t,...o){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${v}/${e}/${t}/${o.join("/")}`}const ne=(e=S.SECTION)=>w[e].dist,te={[m.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/server/`},[m.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/`},[m.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[m.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/assets/`},[m.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/assets/`},[m.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${D}/assets/`},[m.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[m.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[m.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>ee(e,t,"")},[m.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>ee(e,t,"assets/")},[m.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/server/")},[m.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/")},[m.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/chunks/")},[m.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/assets/")}},ut="https://json-schema.org/draft/2020-12/schema",ft="https://lightspeedhq.com/template-default.schema.json",mt="Default Section",ht="Default section for a Custom Template",yt="object",gt={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},ki={$schema:ut,$id:ft,title:mt,description:ht,type:yt,$defs:gt},$t={__proto__:null,$defs:gt,$id:ft,$schema:ut,default:ki,description:ht,title:mt,type:yt},bt="https://json-schema.org/draft/2020-12/schema",wt="https://lightspeedhq.com/template-custom.schema.json",Et="Custom Section",Tt="Custom section for a Custom Template",St="object",jt={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},Ri={$schema:bt,$id:wt,title:Et,description:Tt,type:St,$defs:jt},_t={__proto__:null,$defs:jt,$id:wt,$schema:bt,default:Ri,description:Tt,title:Et,type:St},Ct="https://json-schema.org/draft/2020-12/schema",vt="https://lightspeedhq.com/template-custom-content.schema.json",Ot="Custom Section :: Content Configuration",It="Content tab configuration of a Custom Section for a Custom Template",Dt="object",Pt={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{$ref:"common.schema.json#/$defs/label_type"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title","buttonType"],additionalProperties:!0},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},static:{type:"boolean"},imageData:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{type:"object"},MOBILE_WEBP_HI_RES:{type:"object"},WEBP_LOW_RES:{type:"object"},WEBP_HI_2X_RES:{type:"object"},ORIGINAL:{type:"object"}},additionalProperties:!1,minProperties:1},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!0},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!0},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",$ref:"common.schema.json#/$defs/label_type"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]},product_selector:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"PRODUCT_SELECTOR"},product:{type:"object",properties:{id:{type:"number"}}},products:{type:"object",properties:{productIds:{type:"array",items:{type:"number"}}}},categoryId:{type:"number"},maxProducts:{type:"number"}},required:["type"],additionalProperties:!1},category_selector:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"CATEGORY_SELECTOR"},categories:{type:"object",properties:{categoryIds:{type:"array",items:{type:"number"}}}},maxCategories:{type:"number"}},required:["type"],additionalProperties:!1}},Fi={$schema:Ct,$id:vt,title:Ot,description:It,type:Dt,$defs:Pt},At={__proto__:null,$defs:Pt,$id:vt,$schema:Ct,default:Fi,description:It,title:Ot,type:Dt},xt="https://json-schema.org/draft/2020-12/schema",Lt="https://lightspeedhq.com/template-custom-design.schema.json",Nt="Custom Section :: Design Configuration",kt="Design tab configuration of a Custom Section for a Custom Template",Rt="object",Ft={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the button",type:"boolean"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},static:{type:"boolean"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},info:{type:"object",properties:{type:{description:"Type of the info",type:"string",const:"INFO"},font:{description:"Default font for the info",type:"string"},size:{description:"Default size for the info",type:"integer",minimum:1},bold:{description:"Default boldness for the info",type:"boolean"},italic:{description:"Default italic style for the info",type:"boolean"},color:{description:"Default color for the info",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the info",type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{oneOf:[{description:"Default color for frame on logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for frame on logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},qi={$schema:xt,$id:Lt,title:Nt,description:kt,type:Rt,$defs:Ft},qt={__proto__:null,$defs:Ft,$id:Lt,$schema:xt,default:qi,description:kt,title:Nt,type:Rt},Gt="https://json-schema.org/draft/2020-12/schema",Bt="https://lightspeedhq.com/section-content.schema.json",Mt="Custom Section - Content",Ut="The content of a custom section",zt="object",Xt={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO","DIVIDER","PRODUCT_SELECTOR","CATEGORY_SELECTOR"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}},{if:{properties:{type:{const:"PRODUCT_SELECTOR"}}},then:{$ref:"#/$defs/ProductSelector"}},{if:{properties:{type:{const:"CATEGORY_SELECTOR"}}},then:{$ref:"#/$defs/CategorySelector"}}]}},Ht={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},static:{type:"boolean"},defaults:{$ref:"section-commons.schema.json#/$defs/Image"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{type:{const:"DECK"},cards:{description:"Cards of the content configuration element",type:"object",properties:{defaultCardContent:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}},required:["label","settings"]}},required:["defaultCardContent"]},label:{$ref:"../common.schema.json#/$defs/label_type"},addButtonLabel:{$ref:"../common.schema.json#/$defs/label_type"},maxCards:{type:"number"}},required:["cards","maxCards","label","addButtonLabel","type"]},ProductSelector:{type:"object",properties:{type:{const:"PRODUCT_SELECTOR"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ProductSelectorDefaults"}},required:["type","label"]},ProductSelectorDefaults:{type:"object",properties:{maxProducts:{type:"number"}}},CategorySelector:{type:"object",properties:{type:{const:"CATEGORY_SELECTOR"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/CategorySelectorDefaults"}},required:["type","label"]},CategorySelectorDefaults:{type:"object",properties:{maxCategories:{type:"number"}}}},Kt=!1,Gi={$schema:Gt,$id:Bt,title:Mt,description:Ut,type:zt,patternProperties:Xt,$defs:Ht,additionalProperties:Kt},Vt={__proto__:null,$defs:Ht,$id:Bt,$schema:Gt,additionalProperties:Kt,default:Gi,description:Ut,patternProperties:Xt,title:Mt,type:zt},Yt="https://json-schema.org/draft/2020-12/schema",Wt="https://lightspeedhq.com/section-layout.schema.json",Jt="Section Layout Schema",Zt="Schema for validating section layout configurations",Qt="array",eo={type:"object",required:["layoutId","selectedContentSettings","selectedDesignSettings"],properties:{layoutId:{type:"string",description:"Unique identifier for the layout"},selectedContentSettings:{type:"array",description:"Array of selected content settings (field names only)",items:{type:"string"}},selectedDesignSettings:{type:"array",description:"Array of selected design settings with optional overrides",items:{$ref:"#/$defs/selectionItem"}}},additionalProperties:!1},to={selectionItem:{type:"object",description:"Pick a design field by name; optionally override its defaults for this layout.",required:["fieldName"],properties:{fieldName:{type:"string"},type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]},defaults:{type:"object",description:"Design editor defaults; shape depends on the type property"}},allOf:[{if:{required:["type"],properties:{type:{const:"TEXT"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/TextDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"IMAGE"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ImageDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"BUTTON"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ButtonDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"BACKGROUND"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/BackgroundDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"TOGGLE"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ToggleDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"COLOR_PICKER"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ColorPickerDefaults"}}}},{if:{required:["type"],properties:{type:{const:"RATING"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/RatingDefaults"}}}},{if:{required:["type"],properties:{type:{const:"SELECTBOX"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/SelectboxDefaults"}}}},{if:{required:["type"],properties:{type:{const:"SOCIAL_PROFILES"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/SocialProfilesDefaults"}}}},{if:{required:["type"],properties:{type:{const:"LOGO"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/LogoDesignDefaults"}}}},{if:{required:["defaults"]},then:{required:["type"]}}],additionalProperties:!1}},Bi={$schema:Yt,$id:Wt,title:Jt,description:Zt,type:Qt,items:eo,$defs:to},oo={__proto__:null,$defs:to,$id:Wt,$schema:Yt,default:Bi,description:Zt,items:eo,title:Jt,type:Qt},so="https://json-schema.org/draft/2020-12/schema",no="https://lightspeedhq.com/sections/section-translation.schema.json",io="Custom Section - Translations",ro="The translation of the section's labels",ao="object",co={"^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},lo=!1,Mi={$schema:so,$id:no,title:io,description:ro,type:ao,patternProperties:co,additionalProperties:lo},Oe={__proto__:null,$id:no,$schema:so,additionalProperties:lo,default:Mi,description:ro,patternProperties:co,title:io,type:ao},po="https://json-schema.org/draft/2020-12/schema",uo="https://lightspeedhq.com/section-design.schema.json",fo="Custom Section - Design",mo="The design of a custom section",ho="object",yo={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR_PICKER"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}}],additionalProperties:!0}},go={Text:{type:"object",properties:{type:{const:"TEXT"},label:{$ref:"../common.schema.json#/$defs/label_type"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},static:{type:"boolean"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},text:{type:"string"},button:{type:"object",properties:{title:{type:"string"},link:{type:"string"}},additionalProperties:!0}},required:["type","text"],additionalProperties:!0},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:[]}},Ui={$schema:po,$id:uo,title:fo,description:mo,type:ho,patternProperties:yo,$defs:go},$o={__proto__:null,$defs:go,$id:uo,$schema:po,default:Ui,description:mo,patternProperties:yo,title:fo,type:ho},bo="https://json-schema.org/draft/2020-12/schema",wo="https://lightspeedhq.com/section-commons.schema.json",Eo="Custom Section - Content",To="The content of a custom section",So="object",jo={Image:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},MOBILE_WEBP_HI_RES:{$ref:"#/$defs/ImageInfo"},WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},WEBP_HI_2X_RES:{$ref:"#/$defs/ImageInfo"},ORIGINAL:{$ref:"#/$defs/ImageInfo"}},additionalProperties:!1,minProperties:1},borderInfo:{$ref:"#/$defs/BorderInfo"}},additionalProperties:!1,required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},_o=!1,zi={$schema:bo,$id:wo,title:Eo,description:To,type:So,$defs:jo,additionalProperties:_o},Co={__proto__:null,$defs:jo,$id:wo,$schema:bo,additionalProperties:_o,default:zi,description:To,title:Eo,type:So},vo="https://json-schema.org/draft/2020-12/schema",Oo="https://lightspeedhq.com/section-showcase.schema.json",Io="Custom Section - Showcase settings",Do="The setting of a showcase",Po="object",Ao=["showcaseId","previewImage"],xo=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],Xi={$schema:vo,$id:Oo,title:Io,description:Do,type:Po,required:Ao,allOf:xo},Lo={__proto__:null,$id:Oo,$schema:vo,allOf:xo,default:Xi,description:Do,required:Ao,title:Io,type:Po},No="https://json-schema.org/draft/2020-12/schema",ko="https://lightspeedhq.com/template.schema.json",Ro="Custom Template",Fo="A custom template enclosing the necessary custom and default blocks",qo="object",Go={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},Bo=["metadata","sections"],Hi={$schema:No,$id:ko,title:Ro,description:Fo,type:qo,properties:Go,required:Bo},Mo={__proto__:null,$id:ko,$schema:No,default:Hi,description:Fo,properties:Go,required:Bo,title:Ro,type:qo},Uo="https://json-schema.org/draft/2020-12/schema",zo="https://lightspeedhq.com/showcase_overrides.schema.json",Xo="Showcase overrides",Ho="Overrides for the showcase",Ko="object",Vo={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU","INFO","PRODUCT_SELECTOR","CATEGORY_SELECTOR"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}},{if:{properties:{type:{const:"PRODUCT_SELECTOR"}}},then:{$ref:"template-custom-content.schema.json#/$defs/product_selector"}},{if:{properties:{type:{const:"CATEGORY_SELECTOR"}}},then:{$ref:"template-custom-content.schema.json#/$defs/category_selector"}}]}}},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/info"}}]}}},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",$ref:"common.schema.json#/$defs/label_type"}},Ki={$schema:Uo,$id:zo,title:Xo,description:Ho,type:Ko,properties:Vo},Yo={__proto__:null,$id:zo,$schema:Uo,default:Ki,description:Ho,properties:Vo,title:Xo,type:Ko},Wo="https://json-schema.org/draft/2020-12/schema",Jo="https://lightspeedhq.com/common.schema.json",Zo="Common Type Definitions",Qo="Common type definitions, used throughout other schemas",es="object",ts={label_type:{type:"string",pattern:"^\\$.+"}},Vi={$schema:Wo,$id:Jo,title:Zo,description:Qo,type:es,$defs:ts},os={__proto__:null,$defs:ts,$id:Jo,$schema:Wo,default:Vi,description:Qo,title:Zo,type:es};function ie(e){return $(`${W}/${e}`)?S.HEADER:$(`${J}/${e}`)?S.FOOTER:S.SECTION}function Ie(e){const t=ie(e);return w[t].dist}const Yi={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Wi={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function ss(e){switch(e){case S.HEADER:return Yi;default:return{}}}function ns(e){switch(e){case S.HEADER:return Wi;default:return{}}}function Ji({validationType:e,sectionType:t}){switch(e){case z.CONTENT:return ss(t);case z.DESIGN:return ns(t);default:return{}}}function Zi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const i=t[s];n.type!==i.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${i.type}".`})}),o}function Qi({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function er({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=Qi({type:n.type,mandatorySettings:t});i&&s!==i&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${i}".`})}),o}function tr({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function or({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:i})=>i),n=Object.values(e).map(({type:i})=>i);return new Set(n.filter(i=>s.includes(i))).forEach(i=>{if(n.filter(r=>r===i).length>1){const r=tr({type:i,mandatorySettings:t});o.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),o}function sr(e,t){const{sectionSettings:o,sectionType:s}=t,n=Ji({validationType:e,sectionType:s});return n===void 0||st(n)?[]:[...Zi({sectionSettings:o,mandatorySettings:n}),...er({sectionSettings:o,mandatorySettings:n}),...or({sectionSettings:o,mandatorySettings:n})]}function nr(e,t){const o=[];if(!e.cards?.defaultCardContent)return o;const s=e.cards.defaultCardContent.settings;for(const[n,i]of Object.entries(s)){const r=i;r?.type==="IMAGE"&&o.push({key:n,editor:r,path:`${t}/cards/defaultCardContent/settings/${n}`})}return o}function ir(e,t){const o=e[t];if(o?.type==="IMAGE")return o}function is(e,t,o,s,n){const i=ir(o,e);if(i?.type!=="IMAGE")return;const r=t.static,a=i.static;(r??!1)!==(a??!1)&&n.push({instancePath:s,message:`Both "${e} content and design editor need to have same value for attribute static`,keyword:"image-editor-mismatch"})}function rr(e,t,o,s){for(const[n,i]of Object.entries(e)){const r=i,a=`/${n}`;if(r.type==="IMAGE")is(n,r,t,a,s);else if(r.type==="DECK"){const c=nr(r,a);for(const{key:l,editor:d,path:E}of c)is(l,d,t,E,s)}}}async function ar(e,t,o){if(!e.sectionName||e.validationType!==z.CONTENT)return[];const s=g.resolve(`${o}/${e.sectionName}/js/settings/design`),n=await k(s,!1),i=[];return rr(t,n,"",i),i}const H=[Co,$o,Vt,oo,Lo,Mo,$t,_t,At,qt,Yo,os];function U(e,t){const o=new Dn({allErrors:!0,schemas:e});return Pn(o),o.getSchema(t.$id)||o.compile(t)}function cr(){return U(H,Mo)}function he(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const lr=e=>(()=>{const t=Ie(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/content`),ajv:U(H,Vt),validationType:z.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/design`),ajv:U(H,$o),validationType:z.DESIGN,sectionName:e.name,type:e.type},...h.existsSync(`./${o}/${e.name}/settings/layout.ts`)?[{source:`./${o}/${e.name}/settings/layout.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/layout`),ajv:U(H,oo),sectionName:e.name,type:e.type}]:[],{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:U(H,Oe),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${K(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${K(s).name}`),ajv:U(H,s.indexOf("translations")===-1?Lo:Oe),type:e.type,sectionName:e.name}))]})();function pr(e){const t=n=>{const i=(n??"").split("/").filter(r=>r.length>0);return i.length===0?"$":`$${i.map(r=>`.${r}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const i=e[n];o=Math.max(o,Math.max(...i.map(r=>t(r.instancePath).length))),s=Math.max(s,Math.max(...i.map(r=>r.message.length)))}),Object.keys(e).forEach(n=>{const i=e[n].filter((r,a,c)=>a===c.findIndex(l=>`${r.instancePath}${r.message}${r.keyword}`==`${l.instancePath}${l.message}${l.keyword}`));p.error(n),i.filter(r=>r.keyword!=="if").forEach(r=>{p.error(`${t(r.instancePath).padEnd(o," ")} | ${r.message.padEnd(s," ")} | ${r.keyword||"-"}`)})})}function dr(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=ie(o);return[...sr(s,{sectionSettings:t,sectionType:n})]}function rs(e,t){return Ln({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return $(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}function ur(e,t,o,s){const n=[],i=t.cards?.defaultCardContent?.settings;if(!i)return n;const r=new Set(Object.keys(i));return e.cards.forEach((a,c)=>{const l=a.settings;l&&Object.keys(l).forEach(d=>{r.has(d)||n.push({instancePath:`showcases/${s}/content/${o}/cards/${c}/settings/${d}`,message:`Setting '${d}' is not defined in content.ts defaultCardContent.settings`,keyword:"invalid-deck-card-setting"})})}),n}async function fr(e,t){const o=[];if(!e.source||!e.source.includes("/sections/")||e.validationType!==z.CONTENT||!e.sectionName)return o;const s=Ie(e.sectionName),n=g.resolve(`${s}/${e.sectionName}/js/showcases`);if(!$(n))return o;const i=h.readdirSync(n).filter(a=>a.endsWith(".mjs")&&a!=="translations.mjs").map(async a=>{const c=g.resolve(`${n}/${a.replace(".mjs","")}`),l=await k(c,!1);return{showcaseFile:a,showcaseData:l}}),r=await Promise.all(i);for(const{showcaseFile:a,showcaseData:c}of r){if(!c.content)continue;const l=c.content;Object.keys(l).forEach(d=>{const E=l[d],L=t[d];if(!L){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' is not defined in content.ts`,keyword:"invalid-showcase-element"});return}if(E.type!==L.type){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' type mismatch: showcase has type '${E.type}' but content.ts has type '${L.type}'`,keyword:"type-mismatch"});return}E.type==="DECK"&&L.type==="DECK"&&o.push(...ur(E,L,d,a.replace(".mjs","")))})}return o}async function mr(e){const t=await k(e.dist,!1),o={},s=[],n=Ie(e.sectionName??""),i=n.split("/").pop()?.toLowerCase();if(e.ajv(t)||s.push(...he(e.ajv.errors??[])),s.push(...dr(e,t),...rs(`${i}/${e.sectionName}`,t),...await ar(e,t,n)),e.source&&e.source.includes("/sections/")&&e.validationType===z.CONTENT){const r=await fr(e,t);s.push(...r)}return s.length>0&&(o[e.source]=s),o}async function hr(e){const t=xn(An.gunzip),o=await h.promises.readFile(e);return(await t(o)).length}async function as(e,t){const o=te[e],s=g.resolve(`${o.toPath(t)}${o.fileName}`),n=await hr(s);if(n>tt)throw p.error(`Size of individual server file must not exceed threshold [${se(tt)}]!`),p.error(`${`File: ${s}`.padEnd(s.length+10)}| ${se(n)}`),new Error("Invalid server file size")}function cs(e){const t=e.reduce((o,s)=>{const n=bn(s);return n.size>et&&(o[s]=se(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));p.error(`Size of individual assets must not exceed threshold [${se(et)}]!`);for(const s in t)p.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function yr(e,t,o,s){const n={};return e(t)&&s===void 0?Ue(`${o}${N}.mjs`,`${o}.mjs`,()=>{}):(ze(`${o}${N}.mjs`,()=>{}),n[g.resolve(`./templates/${K(o).name}.ts`)]=[...he(e.errors??[]),...s??[]]),n}async function gr(){const e={},t="dist/shared/translation",o=g.resolve(process.cwd(),`${t}.mjs`);if(!$(o))return e;try{const s=await k(t,!1),n=U(H,Oe);n(s)||(e[t]=he(n.errors??[]))}catch(s){e[t]=[{instancePath:"shared/translation.ts",message:`Failed to load translation file: ${s.message}`,keyword:"import"}]}return e}const ls={"process.env":{NODE_ENV:"production"}},$r=[...Ye,...Ye.map(e=>`node:${e}`)],br=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],ps=e=>({pluginType:C.Server,define:ls,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...$r,...br],inlineDynamicImports:!0,...e,outDir:e.outDir}),ds=e=>({pluginType:C.Client,define:ls,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),re=e=>({pluginType:C.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),wr=e=>({pluginType:C.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),De=e=>({pluginType:C.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),Er=()=>Nn({ext:".gz",algorithm:"gzip"}),Tr="/* EXTERNAL_IMPORTS_START */",Sr="/* EXTERNAL_IMPORTS_END */",jr=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,i=s.code.match(n);if(i!==null){const r=i.join(""),a=Tr+r+Sr,c=s.code.replace(n,"");s.code=a+c}}}}}),_r=()=>({name:"disable-json-plugin",enforce:"pre",apply:"build",configResolved(e){const t=e.plugins?.findIndex(o=>o?.name==="vite:json");t!==-1&&(e.plugins[t]={name:"vite:json",load:()=>null,transform:()=>null})}}),Cr=()=>{const e=process.env.npm_lifecycle_event;return Fn({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},A={VUE:kn(),TS_CONFIG_PATHS:Rn(),CHECKER:Cr()};class ge{constructor(t){this.bits=t instanceof ge?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class pe{constructor(t,o,s){this.start=t,this.end=o,this.original=s,this.intro="",this.outro="",this.content=s,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new pe(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let o=this;for(;o;)t(o),o=o.next}eachPrevious(t){let o=this;for(;o;)t(o),o=o.previous}edit(t,o,s){return this.content=t,s||(this.intro="",this.outro=""),this.storeName=o,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const o=t-this.start,s=this.original.slice(0,o),n=this.original.slice(o);this.original=s;const i=new pe(t,this.end,n);return i.outro=this.outro,this.outro="",this.end=t,this.edited?(i.edit("",!1),this.content=""):this.content=s,i.next=this.next,i.next&&(i.next.previous=i),i.previous=this,this.next=i,i}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const o=this.content.replace(t,"");if(o.length)return o!==this.content&&(this.split(this.start+o.length).edit("",void 0,!0),this.edited&&this.edit(o,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const o=this.content.replace(t,"");if(o.length){if(o!==this.content){const s=this.split(this.end-o.length);this.edited&&s.edit(o,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function vr(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?e=>globalThis.btoa(unescape(encodeURIComponent(e))):typeof Buffer=="function"?e=>Buffer.from(e,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const Or=vr();class Ir{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=qn(t.mappings),typeof t.x_google_ignoreList<"u"&&(this.x_google_ignoreList=t.x_google_ignoreList)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Or(this.toString())}}function Dr(e){const t=e.split(`
3
- `),o=t.filter(i=>/^\t+/.test(i)),s=t.filter(i=>/^ {2,}/.test(i));if(o.length===0&&s.length===0)return null;if(o.length>=s.length)return" ";const n=s.reduce((i,r)=>{const a=/^ +/.exec(r)[0].length;return Math.min(a,i)},1/0);return new Array(n+1).join(" ")}function Pr(e,t){const o=e.split(/[/\\]/),s=t.split(/[/\\]/);for(o.pop();o[0]===s[0];)o.shift(),s.shift();if(o.length){let n=o.length;for(;n--;)o[n]=".."}return o.concat(s).join("/")}const Ar=Object.prototype.toString;function xr(e){return Ar.call(e)==="[object Object]"}function us(e){const t=e.split(`
4
- `),o=[];for(let s=0,n=0;s<t.length;s++)o.push(n),n+=t[s].length+1;return function(n){let i=0,r=o.length;for(;i<r;){const l=i+r>>1;n<o[l]?r=l:i=l+1}const a=i-1,c=n-o[a];return{line:a,column:c}}}const Lr=/\w/;class Nr{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,o,s,n){if(o.length){const i=o.length-1;let r=o.indexOf(`
1
+ import*as de from"path";import g,{resolve as u,parse as K,dirname as Ge,relative as mn,basename as hn,sep as Be}from"path";import yn from"cac";import{red as gn,yellow as $n,green as V}from"kolorist";import Me from"prompts";import bn from"adm-zip";import*as ue from"fs";import h,{existsSync as $,statSync as wn,rename as Ue,unlink as ze,promises as $e,writeFileSync as Xe,readFileSync as En,createReadStream as Tn}from"fs";import{glob as f,globSync as He}from"glob";import{normalizePath as Sn,defineConfig as Ke,build as Y,createServer as jn}from"vite";import{SectionTypeEnum as T,BackgroundStyleEnum as be,ButtonAppearanceEnum as _n,ButtonSizeEnum as Cn,ButtonShapeEnum as vn,OverlayTypeEnum as fe,DesignEditorType as R,ValidationTypeEnum as z,PluginTypeEnum as C,ConfigTypeEnum as y,TemplatePageEnum as I}from"@lightspeed/crane-api";import{pathToFileURL as Ve}from"url";import On from"tinycolor2";import In from"ajv/dist/2020.js";import Dn from"ajv-formats";import Pn from"node:zlib";import{promisify as An}from"node:util";import{JSONPath as xn}from"jsonpath-plus";import{builtinModules as Ye}from"module";import{viteExternalsPlugin as We}from"vite-plugin-externals";import Ln from"vite-plugin-compression";import Nn from"@vitejs/plugin-vue";import kn from"vite-tsconfig-paths";import Rn from"vite-plugin-checker";import{encode as Fn}from"@jridgewell/sourcemap-codec";import b from"node:fs";import F from"node:path";import S from"node:process";import{fileURLToPath as qn}from"node:url";import{readFile as Je}from"fs/promises";import*as q from"process";import x from"process";import Gn,{AxiosError as Ze}from"axios";import{ConcurrencyManager as Bn}from"axios-concurrency";import{inc as Mn}from"semver";import Un from"cli-progress";const zn="2.0.0",w={[T.SECTION]:{source:"sections",dist:"dist/sections"},[T.HEADER]:{source:"headers",dist:"dist/headers"},[T.FOOTER]:{source:"footers",dist:"dist/footers"}};var m=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.ClientChunks=2]="ClientChunks",e[e.ClientAsset=3]="ClientAsset",e[e.Asset=4]="Asset",e[e.TemplateAsset=5]="TemplateAsset",e[e.Dependency=6]="Dependency",e[e.SourceCode=7]="SourceCode",e[e.LayoutClient=8]="LayoutClient",e[e.LayoutAsset=9]="LayoutAsset",e[e.SlotServer=10]="SlotServer",e[e.SlotClient=11]="SlotClient",e[e.SlotClientChunks=12]="SlotClientChunks",e[e.SlotClientAsset=13]="SlotClientAsset",e))(m||{});const Xn="https://blockbuster.ecwid.com",Hn="/api/v1/custom-apps/resources/sections/upload",Kn="/api/v1/custom-apps/resources/templates/upload",Vn="/api/v1/custom-apps/manifests/sections",Yn="/api/v1/custom-apps/manifests/templates",Wn=5,Jn=3,Zn=[m.Server,m.Client,m.ClientChunks,m.ClientAsset,m.Asset],Qn=[m.LayoutClient,m.LayoutAsset],ei=[m.SlotServer,m.SlotClient,m.SlotClientChunks,m.SlotClientAsset],ti=[m.Dependency,m.TemplateAsset,m.SourceCode],W={DEFAULT:"Error while deploying:",ASSET_FILES_UPLOAD:"Error while uploading asset files:",MANIFEST_DEPLOYMENT:"Error while deploying manifest file:",DEPRECATED_VERSION_DEPLOYMENT:"You are using a non-supported version of crane. Please update to the latest crane version to continue.",INCORRECT_DISTRIBUTION_FOLDER:e=>`Distribution folder [${e}] is not found or has incorrect structure, please execute the build command first.`},Qe={catalog:"products",category:"category",product:"product"},oi=e=>Qe[e],et=e=>e in Qe;async function G(e){return(await import(Ve(e).href)).default}function we(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function D(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=On(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function tt(e){if(e!==void 0)return typeof e=="string"&&e.startsWith("global.")?{type:"GLOBAL_TEXT_SIZE",size:e}:{type:"NUMERIC_TEXT_SIZE",size:Number(e)}}function si(e){if(e!==void 0)return{...e,color:D(e.color)}}function Ee(e){return Object.fromEntries(Object.entries(e).filter(([t,o])=>o!==void 0))}function ni(e){if(e!==void 0)switch(e){case be.COLOR:return"solid";case be.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(be)}`)}}function ii({style:e,color:t}){const o=Array.isArray(t)?t:[t,t];return{background:{type:ni(e),solid:{color:D(o.at(0))},gradient:{fromColor:D(o.at(0)),toColor:D(o.at(1))}}}}function ri(e){if(e!==void 0)switch(e){case"SOLID":return"solid-button";case"OUTLINE":return"outline-button";case"TEXT":return"text-link";default:throw new Error(`Unknown button appearance: ${e}. Right options: ${Object.keys(_n)}`)}}function ai(e){if(e!==void 0)switch(e){case"SMALL":return"small";case"MEDIUM":return"medium";case"LARGE":return"large";default:throw new Error(`Unknown button size: ${e}. Right options: ${Object.keys(Cn)}`)}}function ci(e){if(e!==void 0)switch(e){case"ROUND_CORNER":return"round-corner";case"RECTANGLE":return"rectangle";case"PILL":return"pill";default:throw new Error(`Unknown button shape: ${e}. Right options: ${Object.keys(vn)}`)}}function li(e){const t=ri(e.appearance),o=ai(e.size),s=ci(e.shape),n=we(e.font),i=D(e.color),r=e.visible;return Ee({appearance:t,size:o,style:s,font:n,color:i,visible:r})}function pi(e){const t=D(e.color);return Ee({color:t})}function di(e){if(e!==void 0)switch(e){case fe.COLOR:return"solid";case fe.GRADIENT:return"gradient";case fe.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(fe)}`)}}function ui(e){const t=e.color,o=Array.isArray(t)?t:[t,t];return{overlay:{type:di(e.overlay),solid:{color:D(o.at(0))},gradient:{fromColor:D(o.at(0)),toColor:D(o.at(1))}}}}function fi(e){const t=we(e.font),o=D(e.color),s=tt(e.size);return{font:t,color:o,size:s,frame:si(e.frame)}}function mi(e){const t=we(e.font),o=D(e.color),s=tt(e.size);return Ee({font:t,color:o,size:s})}function Te(e,t){if(t.defaults===void 0)return;let o={};switch(e){case R.TEXT:{o=mi(t.defaults);break}case R.BUTTON:{o=li(t.defaults);break}case R.IMAGE:{o=ui(t.defaults);break}case R.BACKGROUND:{o=ii(t.defaults);break}case R.COLOR_PICKER:{o=pi(t.defaults);break}case R.LOGO:{o=fi(t.defaults);break}case R.TOGGLE:case R.SELECTBOX:break;default:throw new Error(`Unknown design editor type: ${e}`)}return o}function ot(e){Object.keys(e).forEach(t=>{const o=e[t],s=o.type,n=Te(s,o);n&&(e[t].defaults=n)})}function hi(e){e!==void 0&&e.forEach(t=>{if(t.type!==void 0&&t.defaults!==void 0){const o=Te(t.type,t);o&&(t.defaults=o,t.defaults.type=t.type)}})}function st(e){e!==void 0&&Object.keys(e).forEach(t=>{const o=e[t],s=o.type,n=Te(s,{defaults:o});n&&(e[t]={...e[t],...n})})}function yi(e,t){if(!t)return;const o=e[t];return o===void 0?{en:t}:o}function gi(e){const t={};for(const o in e){const s=e[o];for(const n in s){const i=t[n],r=s[n];if(i===void 0){const a={};a[o]=r,t[n]=a}else i[o]=r}}return t}function X(e,t){if(!e||typeof e!="object")return;const o=e;for(const s in o){const n=o[s];typeof n=="string"&&n.startsWith("$")&&!Array.isArray(e)?o[s]=yi(t,n):typeof n=="object"&&X(n,t)}}async function Se(e){const t=u(process.cwd(),e),o=await G(t);return gi(o)}function se(e,t=2){if(!+e)return"0 Bytes";const o=1024,s=t<0?0:t,n=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(e)/Math.log(o));return`${parseFloat((e/o**i).toFixed(s))} ${n[i]}`}const p={error:e=>console.log(gn(e)),warn:e=>console.log($n(e)),info:e=>console.log(V(e))},N="_temp",$i="dist",j="dist/sections",J="dist/headers",Z="dist/footers",P="dist/templates",Q="layouts",nt="preview",v=`dist/${Q}`,bi=[j,J,Z,P,v],it=2*1024*1024,rt=500*1024;function me(e){return!!e}function at(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const wi="Resource name can only contain alphanumeric characters, dashes, and underscores";function Ei(e){if(typeof e=="string"||typeof e=="number"){const t=/^[a-zA-Z0-9_-]+$/.test(e.toString());if(t)return{isValid:t,errorMessage:null}}return{isValid:!1,errorMessage:wi}}function Ti(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function k(e,t){try{const o=u(process.cwd(),t?`${e}${N}.mjs`:`${e}.mjs`),s=`?timestamp=${Date.now()}`;return(await import(Ve(o).href+s)).default}catch(o){const s=`File [${e}${t?N:""}.mjs] is either invalid or undefined`,n=o instanceof Error?o.message:s;throw new Error(n)}}function ct(e){return Object.keys(e).length===0}function Si(e){return g.parse(e).name}function ji(e){return e.replace(/\\/g,"/")}function _i(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function je(e){return _i(ji(e))}function lt(e){const t=je(e).split("/");if(t.length<2)throw new Error(`Invalid layout path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/[...path]`);const[o,s]=t;if(!et(o))throw new Error(`Layout cannot be placed in a non-storefront section: ${o}`);const n=oi(o);return{id:s,sectionId:o,pageId:n}}async function Ci(){const e=`${v}/{product,catalog,category}/*`;return(await f(e,{ignore:["node_modules/**"]})).map(lt)}async function vi(e){return Se(`${v}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function Oi(e){try{const t=u(process.cwd(),`${v}/${e.sectionId}/${e.layoutId}/js/settings/content.mjs`),o=await G(t);return X(o,e.translations),o}catch(t){throw new Error(`Content descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}async function Ii(e){try{const t=u(process.cwd(),`${v}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await G(t);return ot(o),X(o,e.translations),o}catch(t){throw new Error(`Design descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}function ee(e,t,...o){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${v}/${e}/${t}/${o.join("/")}`}const ne=(e=T.SECTION)=>w[e].dist,te={[m.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/server/`},[m.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/`},[m.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[m.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/js/main/client/assets/`},[m.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${ne(t)}/${e}/assets/`},[m.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${P}/assets/`},[m.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[m.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[m.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>ee(e,t,"")},[m.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>ee(e,t,"assets/")},[m.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/server/")},[m.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/")},[m.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/chunks/")},[m.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:o})=>ee(e,t,"slots",o,"js/main/client/assets/")}},pt="https://json-schema.org/draft/2020-12/schema",dt="https://lightspeedhq.com/template-default.schema.json",ut="Default Section",ft="Default section for a Custom Template",mt="object",ht={"default-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"default"},id:{description:"Identification of the section",type:"string",pattern:"^((header|cover|announcement_bar|slider|special_offer|customer_review|company_info|shipping_payment|location|store|footer)(_\\d{3})?)$"},showcase_id:{description:"Showcase id of the section",type:"string"}},required:["type","id"],additionalProperties:!1}},Di={$schema:pt,$id:dt,title:ut,description:ft,type:mt,$defs:ht},yt={__proto__:null,$defs:ht,$id:dt,$schema:pt,default:Di,description:ft,title:ut,type:mt},gt="https://json-schema.org/draft/2020-12/schema",$t="https://lightspeedhq.com/template-custom.schema.json",bt="Custom Section",wt="Custom section for a Custom Template",Et="object",Tt={"custom-section":{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"custom"},id:{description:"Identification of the section",type:"string"},showcase_id:{description:"Showcase id of the section",type:"string"},showcase_overrides:{$ref:"showcase_overrides.schema.json"}},required:["type","id"],additionalProperties:!1}},Pi={$schema:gt,$id:$t,title:bt,description:wt,type:Et,$defs:Tt},St={__proto__:null,$defs:Tt,$id:$t,$schema:gt,default:Pi,description:wt,title:bt,type:Et},jt="https://json-schema.org/draft/2020-12/schema",_t="https://lightspeedhq.com/template-custom-content.schema.json",Ct="Custom Section :: Content Configuration",vt="Content tab configuration of a Custom Section for a Custom Template",Ot="object",It={input_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"INPUTBOX"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},text_area:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TEXTAREA"},text:{$ref:"common.schema.json#/$defs/label_type"}},required:["type","text"],additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"BUTTON"},title:{$ref:"common.schema.json#/$defs/label_type"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["type","title","buttonType"],additionalProperties:!0},image:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"IMAGE"},static:{type:"boolean"},imageData:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{type:"object"},MOBILE_WEBP_HI_RES:{type:"object"},WEBP_LOW_RES:{type:"object"},WEBP_HI_2X_RES:{type:"object"},ORIGINAL:{type:"object"}},additionalProperties:!1,minProperties:1},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},toggle:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"TOGGLE"},enabled:{type:"boolean"}},required:["type"],additionalProperties:!0},select_box:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"SELECTBOX"},value:{type:"string"}},required:["type"],additionalProperties:!0},logo:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"LOGO"},logoType:{description:"Type of the logo content",type:"string",enum:["TEXT","IMAGE"]},text:{description:"Logo content text",$ref:"common.schema.json#/$defs/label_type"},imageData:{type:"object",properties:{set:{type:"object"},borderInfo:{type:"object"},bucket:{type:"string"}},required:["set"]}},required:["type"],additionalProperties:!1},menu:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"MENU"}},required:["type"],additionalProperties:!1},deck:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"DECK"},cards:{type:"array",items:{type:"object",properties:{settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}}]}},minProperties:1}},required:["settings"]}}},required:["type","cards"]},product_selector:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"PRODUCT_SELECTOR"},product:{type:"object",properties:{id:{type:"number"}}},products:{type:"object",properties:{productIds:{type:"array",items:{type:"number"}}}},categoryId:{type:"number"},maxProducts:{type:"number"}},required:["type"],additionalProperties:!1},category_selector:{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",const:"CATEGORY_SELECTOR"},categories:{type:"object",properties:{categoryIds:{type:"array",items:{type:"number"}}}},maxCategories:{type:"number"}},required:["type"],additionalProperties:!1}},Ai={$schema:jt,$id:_t,title:Ct,description:vt,type:Ot,$defs:It},Dt={__proto__:null,$defs:It,$id:_t,$schema:jt,default:Ai,description:vt,title:Ct,type:Ot},Pt="https://json-schema.org/draft/2020-12/schema",At="https://lightspeedhq.com/template-custom-design.schema.json",xt="Custom Section :: Design Configuration",Lt="Design tab configuration of a Custom Section for a Custom Template",Nt="object",kt={text:{type:"object",properties:{type:{description:"Type of the text",type:"string",const:"TEXT"},font:{description:"Default font for the text",type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text",type:"boolean"},italic:{description:"Default italic style for the text",type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the text",type:"boolean"}},additionalProperties:!1},button:{type:"object",properties:{type:{description:"Type of the button",type:"string",const:"BUTTON"},font:{description:"Default font for the button",type:"string"},size:{description:"Default size for the button",type:"string",enum:["SMALL","MEDIUM","LARGE"]},appearance:{description:"Default appearance for the button",type:"string",enum:["SOLID","OUTLINE","TEXT"]},shape:{description:"Default shape for the button",type:"string",enum:["ROUND_CORNER","RECTANGLE","PILL"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the button",type:"boolean"}},additionalProperties:!1},image:{type:"object",properties:{type:{description:"Type of the image",type:"string",const:"IMAGE"},static:{type:"boolean"},overlay:{description:"Default overlay for the image",type:"string",enum:["COLOR","GRADIENT","NONE"]}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default color for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},toggle:{type:"object",properties:{type:{description:"Type of the toggle",type:"string",const:"TOGGLE"},enabled:{description:"Default enabled status for the toggle",type:"boolean"}},additionalProperties:!1},info:{type:"object",properties:{type:{description:"Type of the info",type:"string",const:"INFO"},font:{description:"Default font for the info",type:"string"},size:{description:"Default size for the info",type:"integer",minimum:1},bold:{description:"Default boldness for the info",type:"boolean"},italic:{description:"Default italic style for the info",type:"boolean"},color:{description:"Default color for the info",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},visible:{description:"Default visibility for the info",type:"boolean"}},required:["type"],additionalProperties:!1},select_box:{type:"object",properties:{type:{description:"Type of the checkbox",type:"string",const:"SELECTBOX"},value:{description:"Default option for the checkbox",type:"string"}},additionalProperties:!1},background:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},logo:{type:"object",properties:{type:{description:"Type of the logo",type:"string",const:"LOGO"},font:{description:"Default font for the text logo",type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{description:"Default boldness for the text logo",type:"boolean"},italic:{description:"Default italic style for the text logo",type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{description:"Default visibility for the logo",type:"boolean"},spacing:{description:"Default spacing size for the text logo",type:"integer",minimum:1,exclusiveMaximum:10},capitalization:{description:"Default capitalization style for the text logo",type:"string",enum:["none","all","small"]},frame:{description:"Default frame for the text logo",type:"object",properties:{visible:{description:"Default visibility for the frame on text logo",type:"boolean"},width:{description:"Default width size for the frame on text logo",type:"integer",minimum:1,exclusiveMaximum:50},color:{oneOf:[{description:"Default color for frame on logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for frame on logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}},required:["visible","width","color"],additionalProperties:!1}},additionalProperties:!1}},xi={$schema:Pt,$id:At,title:xt,description:Lt,type:Nt,$defs:kt},Rt={__proto__:null,$defs:kt,$id:At,$schema:Pt,default:xi,description:Lt,title:xt,type:Nt},Ft="https://json-schema.org/draft/2020-12/schema",qt="https://lightspeedhq.com/section-content.schema.json",Gt="Custom Section - Content",Bt="The content of a custom section",Mt="object",Ut={"^.*$":{type:"object",properties:{type:{type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","INFO","DECK","MENU","NAVIGATION_MENU","LOGO","DIVIDER","PRODUCT_SELECTOR","CATEGORY_SELECTOR"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"#/$defs/Deck"}},{if:{properties:{type:{const:"MENU"}}},then:{$ref:"#/$defs/Menu"}},{if:{properties:{type:{const:"NAVIGATION_MENU"}}},then:{$ref:"#/$defs/NavigationMenu"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}},{if:{properties:{type:{const:"PRODUCT_SELECTOR"}}},then:{$ref:"#/$defs/ProductSelector"}},{if:{properties:{type:{const:"CATEGORY_SELECTOR"}}},then:{$ref:"#/$defs/CategorySelector"}}]}},zt={Inputbox:{type:"object",properties:{type:{const:"INPUTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/InputboxDefaults"}},required:["type","label","placeholder"]},Textarea:{type:"object",properties:{type:{const:"TEXTAREA"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/TextareaDefaults"}},required:["type","label","placeholder"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ButtonDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},static:{type:"boolean"},defaults:{$ref:"section-commons.schema.json#/$defs/Image"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDefaults"}},required:["type","label","description"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},placeholder:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label","placeholder","description","options"]},Menu:{type:"object",properties:{type:{const:"MENU"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},NavigationMenu:{type:"object",properties:{type:{const:"NAVIGATION_MENU"}},required:["type"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoEditorButton"},defaults:{$ref:"#/$defs/InfoDefaults"}},required:["type","label","description"]},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},InputboxDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},TextareaDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"}},required:["text"]},ButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},buttonType:{type:"string",enum:["SCROLL_TO_TILE","HYPER_LINK","MAIL_LINK","TEL_LINK","GO_TO_STORE_LINK","GO_TO_PAGE"]},link:{type:"string",format:"uri"},linkTarget:{type:"string"},email:{type:"string"},phone:{type:"string"},tileId:{type:"string"}},required:["title"]},ImageDefaults:{type:"object",properties:{imageData:{$ref:"section-commons.schema.json#/$defs/Image"}}},ToggleDefaults:{type:"object",properties:{enabled:{type:"boolean"}}},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}}},InfoDefaults:{type:"object",properties:{text:{$ref:"../common.schema.json#/$defs/label_type"},button:{$ref:"#/$defs/InfoButtonDefaults"}}},SelectboxOption:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},value:{type:"string"}}},InfoEditorButton:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string"}}},InfoButtonDefaults:{type:"object",properties:{title:{$ref:"../common.schema.json#/$defs/label_type"},link:{type:"string",minLength:0}}},Deck:{type:"object",properties:{type:{const:"DECK"},cards:{description:"Cards of the content configuration element",type:"object",properties:{defaultCardContent:{type:"object",properties:{label:{$ref:"../common.schema.json#/$defs/label_type"},settings:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the settings configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX"]}},required:["type"],allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"#/$defs/Inputbox"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"#/$defs/Textarea"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/ButtonDefaults"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}}]}},minProperties:1}},required:["label","settings"]}},required:["defaultCardContent"]},label:{$ref:"../common.schema.json#/$defs/label_type"},addButtonLabel:{$ref:"../common.schema.json#/$defs/label_type"},maxCards:{type:"number"}},required:["cards","maxCards","label","addButtonLabel","type"]},ProductSelector:{type:"object",properties:{type:{const:"PRODUCT_SELECTOR"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ProductSelectorDefaults"}},required:["type","label"]},ProductSelectorDefaults:{type:"object",properties:{maxProducts:{type:"number"}}},CategorySelector:{type:"object",properties:{type:{const:"CATEGORY_SELECTOR"},label:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/CategorySelectorDefaults"}},required:["type","label"]},CategorySelectorDefaults:{type:"object",properties:{maxCategories:{type:"number"}}}},Xt=!1,Li={$schema:Ft,$id:qt,title:Gt,description:Bt,type:Mt,patternProperties:Ut,$defs:zt,additionalProperties:Xt},Ht={__proto__:null,$defs:zt,$id:qt,$schema:Ft,additionalProperties:Xt,default:Li,description:Bt,patternProperties:Ut,title:Gt,type:Mt},Kt="https://json-schema.org/draft/2020-12/schema",Vt="https://lightspeedhq.com/section-layout.schema.json",Yt="Section Layout Schema",Wt="Schema for validating section layout configurations",Jt="array",Zt={type:"object",required:["layoutId","selectedContentSettings","selectedDesignSettings"],properties:{layoutId:{type:"string",description:"Unique identifier for the layout"},selectedContentSettings:{type:"array",description:"Array of selected content settings (field names only)",items:{type:"string"}},selectedDesignSettings:{type:"array",description:"Array of selected design settings with optional overrides",items:{$ref:"#/$defs/selectionItem"}}},additionalProperties:!1},Qt={selectionItem:{type:"object",description:"Pick a design field by name; optionally override its defaults for this layout.",required:["fieldName"],properties:{fieldName:{type:"string"},type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]},defaults:{type:"object",description:"Design editor defaults; shape depends on the type property"}},allOf:[{if:{required:["type"],properties:{type:{const:"TEXT"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/TextDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"IMAGE"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ImageDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"BUTTON"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ButtonDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"BACKGROUND"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/BackgroundDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"TOGGLE"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ToggleDesignDefaults"}}}},{if:{required:["type"],properties:{type:{const:"COLOR_PICKER"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/ColorPickerDefaults"}}}},{if:{required:["type"],properties:{type:{const:"RATING"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/RatingDefaults"}}}},{if:{required:["type"],properties:{type:{const:"SELECTBOX"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/SelectboxDefaults"}}}},{if:{required:["type"],properties:{type:{const:"SOCIAL_PROFILES"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/SocialProfilesDefaults"}}}},{if:{required:["type"],properties:{type:{const:"LOGO"}}},then:{required:["defaults"],properties:{defaults:{$ref:"./section-design.schema.json#/$defs/LogoDesignDefaults"}}}},{if:{required:["defaults"]},then:{required:["type"]}}],additionalProperties:!1}},Ni={$schema:Kt,$id:Vt,title:Yt,description:Wt,type:Jt,items:Zt,$defs:Qt},eo={__proto__:null,$defs:Qt,$id:Vt,$schema:Kt,default:Ni,description:Wt,items:Zt,title:Yt,type:Jt},to="https://json-schema.org/draft/2020-12/schema",oo="https://lightspeedhq.com/sections/section-translation.schema.json",so="Custom Section - Translations",no="The translation of the section's labels",io="object",ro={"^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},ao=!1,ki={$schema:to,$id:oo,title:so,description:no,type:io,patternProperties:ro,additionalProperties:ao},_e={__proto__:null,$id:oo,$schema:to,additionalProperties:ao,default:ki,description:no,patternProperties:ro,title:so,type:io},co="https://json-schema.org/draft/2020-12/schema",lo="https://lightspeedhq.com/section-design.schema.json",po="Custom Section - Design",uo="The design of a custom section",fo="object",mo={"^.*$":{type:"object",properties:{type:{type:"string",enum:["TEXT","IMAGE","BUTTON","BACKGROUND","TOGGLE","COLOR_PICKER","RATING","SELECTBOX","SOCIAL_PROFILES","LOGO","INFO","DIVIDER"]}},required:["type"],allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"#/$defs/Text"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"#/$defs/Image"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"#/$defs/Button"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"#/$defs/Background"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"#/$defs/Toggle"}},{if:{properties:{type:{const:"COLOR_PICKER"}}},then:{$ref:"#/$defs/Color"}},{if:{properties:{type:{const:"RATING"}}},then:{$ref:"#/$defs/Rating"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"#/$defs/Selectbox"}},{if:{properties:{type:{const:"SOCIAL_PROFILES"}}},then:{$ref:"#/$defs/SocialProfile"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"#/$defs/Logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"#/$defs/Info"}},{if:{properties:{type:{const:"DIVIDER"}}},then:{$ref:"#/$defs/Divider"}}],additionalProperties:!0}},ho={Text:{type:"object",properties:{type:{const:"TEXT"},label:{$ref:"../common.schema.json#/$defs/label_type"},sizes:{type:"array",items:{type:"integer"}},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/TextDesignDefaults"}},required:["type","label"]},Image:{type:"object",properties:{type:{const:"IMAGE"},label:{$ref:"../common.schema.json#/$defs/label_type"},static:{type:"boolean"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ImageDesignDefaults"}},required:["type","label"]},Button:{type:"object",properties:{type:{const:"BUTTON"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAutoColor:{type:["boolean","null"]},enableAlphaColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},hideSize:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ButtonDesignDefaults"}},required:["type","label"]},Background:{type:"object",properties:{type:{const:"BACKGROUND"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/BackgroundDesignDefaults"}},required:["type","label"]},Toggle:{type:"object",properties:{type:{const:"TOGGLE"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},defaults:{$ref:"#/$defs/ToggleDesignDefaults"}},required:["type","label"]},Color:{type:"object",properties:{type:{const:"COLOR_PICKER"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},defaults:{$ref:"#/$defs/ColorPickerDefaults"}},required:["type","label"]},Rating:{type:"object",properties:{type:{const:"RATING"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},hideVisibleToggle:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/RatingDefaults"}},required:["type","label"]},Selectbox:{type:"object",properties:{type:{const:"SELECTBOX"},label:{$ref:"../common.schema.json#/$defs/label_type"},description:{$ref:"../common.schema.json#/$defs/label_type"},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SelectboxDefaults"}},required:["type","label"]},SocialProfile:{type:"object",properties:{type:{const:"SOCIAL_PROFILES"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},enableAlphaColor:{type:["boolean","null"]},enableAutoColor:{type:["boolean","null"]},options:{type:"array",items:{$ref:"#/$defs/SelectboxOption"}},defaults:{$ref:"#/$defs/SocialProfilesDefaults"}},required:["type","label"]},Logo:{type:"object",properties:{type:{const:"LOGO"},label:{$ref:"../common.schema.json#/$defs/label_type"},colors:{type:"array",items:{type:"string",pattern:"^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{8})$"}},sizes:{type:"array",items:{type:"integer"}},defaults:{$ref:"#/$defs/LogoDesignDefaults"}},required:["type"]},Info:{type:"object",properties:{type:{const:"INFO"},text:{type:"string"},button:{type:"object",properties:{title:{type:"string"},link:{type:"string"}},additionalProperties:!0}},required:["type","text"],additionalProperties:!0},Divider:{type:"object",properties:{type:{const:"DIVIDER"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:["type","label"]},TextDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the text",type:"integer",minimum:1},{description:"Default global size string for the text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},ImageDesignDefaults:{type:"object",properties:{overlay:{type:"string"},visible:{type:"boolean"}},if:{properties:{overlay:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the image overlay",type:"array",items:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the image overlay",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the image overlay",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}},required:[]},ButtonDesignDefaults:{type:"object",properties:{appearance:{type:"string",enum:["SOLID","OUTLINE","TEXT"]},font:{type:"string"},size:{type:"string",enum:["SMALL","MEDIUM","LARGE"]},style:{type:"string",enum:["round-corner","rectangle","pill"]},color:{oneOf:[{description:"Default color for the button",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the button",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},BackgroundDesignDefaults:{type:"object",properties:{type:{description:"Type of the background",type:"string",const:"BACKGROUND"},style:{description:"Style of the background",type:"string",enum:["COLOR","GRADIENT"]}},if:{properties:{style:{const:"GRADIENT"}}},then:{properties:{color:{description:"Default colors for the background",type:"array",items:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},minItems:2,maxItems:2}}},else:{properties:{color:{oneOf:[{description:"Default color for the background",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the background",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]}}}},ToggleDesignDefaults:{type:"object",properties:{enabled:{type:"boolean"}},required:[]},ColorPickerDefaults:{type:"object",properties:{appearance:{$ref:"section-commons.schema.json#/$defs/Color"}},required:[]},RatingDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},style:{type:"string"}},required:[]},SelectboxDefaults:{type:"object",properties:{value:{type:"string"}},required:[]},SocialProfilesDefaults:{type:"object",properties:{color:{$ref:"section-commons.schema.json#/$defs/Color"},visible:{type:"boolean"},appearance:{type:"string"}},required:[]},LogoDesignDefaults:{type:"object",properties:{font:{type:"string"},size:{oneOf:[{description:"Default size for the logo text",type:"integer",minimum:1},{description:"Default global size string for the logo text",type:"string",enum:["global.textSize.title","global.textSize.subtitle","global.textSize.body"]}]},bold:{type:"boolean"},italic:{type:"boolean"},color:{oneOf:[{description:"Default color for the logo text",type:"string",pattern:"^#([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$"},{description:"Default global color string for the logo text",type:"string",enum:["global.color.title","global.color.body","global.color.button","global.color.link","global.color.background"]}]},visible:{type:"boolean"}},required:[]},SelectboxOption:{type:"object",properties:{value:{type:"string"},label:{$ref:"../common.schema.json#/$defs/label_type"}},required:[]}},Ri={$schema:co,$id:lo,title:po,description:uo,type:fo,patternProperties:mo,$defs:ho},yo={__proto__:null,$defs:ho,$id:lo,$schema:co,default:Ri,description:uo,patternProperties:mo,title:po,type:fo},go="https://json-schema.org/draft/2020-12/schema",$o="https://lightspeedhq.com/section-commons.schema.json",bo="Custom Section - Content",wo="The content of a custom section",Eo="object",To={Image:{type:"object",properties:{set:{type:"object",properties:{MOBILE_WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},MOBILE_WEBP_HI_RES:{$ref:"#/$defs/ImageInfo"},WEBP_LOW_RES:{$ref:"#/$defs/ImageInfo"},WEBP_HI_2X_RES:{$ref:"#/$defs/ImageInfo"},ORIGINAL:{$ref:"#/$defs/ImageInfo"}},additionalProperties:!1,minProperties:1},borderInfo:{$ref:"#/$defs/BorderInfo"}},additionalProperties:!1,required:["set"]},ImageInfo:{type:"object",properties:{url:{type:"string"},width:{type:"integer",minimum:0},height:{type:"integer",minimum:0}}},BorderInfo:{type:"object",properties:{homogeneity:{type:"boolean"},color:{$ref:"#/$defs/RGBA"}}},RGBA:{type:"object",properties:{r:{type:"integer",minimum:0,maximum:255},g:{type:"integer",minimum:0,maximum:255},b:{type:"integer",minimum:0,maximum:255},a:{type:"number",format:"double",minimum:0,maximum:1}},required:["r","g","b","a"]},HSL:{type:"object",properties:{h:{type:"number",format:"double"},s:{type:"number",format:"double"},l:{type:"number",format:"double"},a:{type:"number",format:"double"}},required:["h","s","l","a"]},Overlay:{type:"object",properties:{type:{type:"string",enum:["solid","gradient","none"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Solid:{type:"object",properties:{color:{$ref:"#/$defs/Color"}}},Gradient:{type:"object",properties:{fromColor:{$ref:"#/$defs/Color"},toColor:{$ref:"#/$defs/Color"}}},Background:{type:"object",properties:{type:{type:"string",enum:["solid","gradient"]},solid:{$ref:"#/$defs/Solid"},gradient:{$ref:"#/$defs/Gradient"}}},Color:{type:"object",properties:{raw:{type:"string"},hex:{type:"string"},auto:{type:"boolean"},rgba:{$ref:"#/$defs/RGBA"},hsl:{$ref:"#/$defs/HSL"}}}},So=!1,Fi={$schema:go,$id:$o,title:bo,description:wo,type:Eo,$defs:To,additionalProperties:So},jo={__proto__:null,$defs:To,$id:$o,$schema:go,additionalProperties:So,default:Fi,description:wo,title:bo,type:Eo},_o="https://json-schema.org/draft/2020-12/schema",Co="https://lightspeedhq.com/section-showcase.schema.json",vo="Custom Section - Showcase settings",Oo="The setting of a showcase",Io="object",Do=["showcaseId","previewImage"],Po=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],qi={$schema:_o,$id:Co,title:vo,description:Oo,type:Io,required:Do,allOf:Po},Ao={__proto__:null,$id:Co,$schema:_o,allOf:Po,default:qi,description:Oo,required:Do,title:vo,type:Io},xo="https://json-schema.org/draft/2020-12/schema",Lo="https://lightspeedhq.com/template.schema.json",No="Custom Template",ko="A custom template enclosing the necessary custom and default blocks",Ro="object",Fo={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)?(company\\.site|ecwid\\.qa)($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},sections:{description:"List of sections contained by this template",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"default"}}},then:{$ref:"template-default.schema.json#/$defs/default-section"}},{if:{properties:{type:{const:"custom"}}},then:{$ref:"template-custom.schema.json#/$defs/custom-section"}}]},minItems:1,uniqueItems:!1}},qo=["metadata","sections"],Gi={$schema:xo,$id:Lo,title:No,description:ko,type:Ro,properties:Fo,required:qo},Go={__proto__:null,$id:Lo,$schema:xo,default:Gi,description:ko,properties:Fo,required:qo,title:No,type:Ro},Bo="https://json-schema.org/draft/2020-12/schema",Mo="https://lightspeedhq.com/showcase_overrides.schema.json",Uo="Showcase overrides",zo="Overrides for the showcase",Xo="object",Ho={content:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the content configuration element",type:"string",enum:["INPUTBOX","TEXTAREA","BUTTON","IMAGE","TOGGLE","SELECTBOX","LOGO","DECK","MENU","NAVIGATION_MENU","INFO","PRODUCT_SELECTOR","CATEGORY_SELECTOR"]}},allOf:[{if:{properties:{type:{const:"INPUTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/input_box"}},{if:{properties:{type:{const:"TEXTAREA"}}},then:{$ref:"template-custom-content.schema.json#/$defs/text_area"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-content.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-content.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-content.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-content.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"DECK"}}},then:{$ref:"template-custom-content.schema.json#/$defs/deck"}},{if:{properties:{type:{const:"PRODUCT_SELECTOR"}}},then:{$ref:"template-custom-content.schema.json#/$defs/product_selector"}},{if:{properties:{type:{const:"CATEGORY_SELECTOR"}}},then:{$ref:"template-custom-content.schema.json#/$defs/category_selector"}}]}}},design:{type:"object",patternProperties:{".*":{type:"object",properties:{type:{description:"Type of the design configuration element",type:"string",enum:["TEXT","BUTTON","IMAGE","TOGGLE","SELECTBOX","BACKGROUND","LOGO"]}},allOf:[{if:{properties:{type:{const:"TEXT"}}},then:{$ref:"template-custom-design.schema.json#/$defs/text"}},{if:{properties:{type:{const:"BUTTON"}}},then:{$ref:"template-custom-design.schema.json#/$defs/button"}},{if:{properties:{type:{const:"IMAGE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/image"}},{if:{properties:{type:{const:"TOGGLE"}}},then:{$ref:"template-custom-design.schema.json#/$defs/toggle"}},{if:{properties:{type:{const:"SELECTBOX"}}},then:{$ref:"template-custom-design.schema.json#/$defs/select_box"}},{if:{properties:{type:{const:"BACKGROUND"}}},then:{$ref:"template-custom-design.schema.json#/$defs/background"}},{if:{properties:{type:{const:"LOGO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/logo"}},{if:{properties:{type:{const:"INFO"}}},then:{$ref:"template-custom-design.schema.json#/$defs/info"}}]}}},layoutId:{description:"Layout ID for the showcase",type:"string"},blockName:{description:"Section name for the showcase",$ref:"common.schema.json#/$defs/label_type"}},Bi={$schema:Bo,$id:Mo,title:Uo,description:zo,type:Xo,properties:Ho},Ko={__proto__:null,$id:Mo,$schema:Bo,default:Bi,description:zo,properties:Ho,title:Uo,type:Xo},Vo="https://json-schema.org/draft/2020-12/schema",Yo="https://lightspeedhq.com/common.schema.json",Wo="Common Type Definitions",Jo="Common type definitions, used throughout other schemas",Zo="object",Qo={label_type:{type:"string",pattern:"^\\$.+"}},Mi={$schema:Vo,$id:Yo,title:Wo,description:Jo,type:Zo,$defs:Qo},es={__proto__:null,$defs:Qo,$id:Yo,$schema:Vo,default:Mi,description:Jo,title:Wo,type:Zo};function ie(e){return $(`${J}/${e}`)?T.HEADER:$(`${Z}/${e}`)?T.FOOTER:T.SECTION}function Ce(e){const t=ie(e);return w[t].dist}const Ui={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},zi={logo:{type:"LOGO",colors:["#FFFFFF66","#0000004D","#00000099","#64C7FF66","#F9947266","#C794CD66","#FFD17466"],sizes:[18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60],defaults:{font:"global.fontFamily.body",size:40,bold:!0,italic:!1,color:"#313131",visible:!0,spacing:2,capitalization:"all",frame:{visible:!0,width:3,color:"#313131"}}}};function ts(e){switch(e){case T.HEADER:return Ui;default:return{}}}function os(e){switch(e){case T.HEADER:return zi;default:return{}}}function Xi({validationType:e,sectionType:t}){switch(e){case z.CONTENT:return ts(t);case z.DESIGN:return os(t);default:return{}}}function Hi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).filter(([s])=>t[s]!==void 0).forEach(([s,n])=>{const i=t[s];n.type!==i.type&&o.push({instancePath:s,keyword:"type-mismatch",message:`Editor type "${n.type}" for reserved key "${s}" does not match the required type "${i.type}".`})}),o}function Ki({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function Vi({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=Ki({type:n.type,mandatorySettings:t});i&&s!==i&&o.push({instancePath:s,keyword:"key-mismatch",message:`Editor key "${s}" for overriden content type "${n.type}" does not match the required key name "${i}".`})}),o}function Yi({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Wi({sectionSettings:e,mandatorySettings:t}){const o=[],s=Object.values(t).map(({type:i})=>i),n=Object.values(e).map(({type:i})=>i);return new Set(n.filter(i=>s.includes(i))).forEach(i=>{if(n.filter(r=>r===i).length>1){const r=Yi({type:i,mandatorySettings:t});o.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),o}function Ji(e,t){const{sectionSettings:o,sectionType:s}=t,n=Xi({validationType:e,sectionType:s});return n===void 0||ct(n)?[]:[...Hi({sectionSettings:o,mandatorySettings:n}),...Vi({sectionSettings:o,mandatorySettings:n}),...Wi({sectionSettings:o,mandatorySettings:n})]}function Zi(e,t){const o=[];if(!e.cards?.defaultCardContent)return o;const s=e.cards.defaultCardContent.settings;for(const[n,i]of Object.entries(s)){const r=i;r?.type==="IMAGE"&&o.push({key:n,editor:r,path:`${t}/cards/defaultCardContent/settings/${n}`})}return o}function Qi(e,t){const o=e[t];if(o?.type==="IMAGE")return o}function ss(e,t,o,s,n){const i=Qi(o,e);if(i?.type!=="IMAGE")return;const r=t.static,a=i.static;(r??!1)!==(a??!1)&&n.push({instancePath:s,message:`Both "${e} content and design editor need to have same value for attribute static`,keyword:"image-editor-mismatch"})}function er(e,t,o,s){for(const[n,i]of Object.entries(e)){const r=i,a=`/${n}`;if(r.type==="IMAGE")ss(n,r,t,a,s);else if(r.type==="DECK"){const c=Zi(r,a);for(const{key:l,editor:d,path:E}of c)ss(l,d,t,E,s)}}}async function tr(e,t,o){if(!e.sectionName||e.validationType!==z.CONTENT)return[];const s=g.resolve(`${o}/${e.sectionName}/js/settings/design`),n=await k(s,!1),i=[];return er(t,n,"",i),i}const H=[jo,yo,Ht,eo,Ao,Go,yt,St,Dt,Rt,Ko,es];function B(e,t){const o=new In({allErrors:!0,schemas:e});return Dn(o),o.getSchema(t.$id)||o.compile(t)}function or(){return B(H,Go)}function he(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const sr=e=>(()=>{const t=Ce(e.name),o=t.split("/").pop()?.toLowerCase();return[{source:`./${o}/${e.name}/settings/content.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/content`),ajv:B(H,Ht),validationType:z.CONTENT,sectionName:e.name,type:e.type},{source:`./${o}/${e.name}/settings/design.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/design`),ajv:B(H,yo),validationType:z.DESIGN,sectionName:e.name,type:e.type},...h.existsSync(`./${o}/${e.name}/settings/layout.ts`)?[{source:`./${o}/${e.name}/settings/layout.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/layout`),ajv:B(H,eo),sectionName:e.name,type:e.type}]:[],{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:B(H,_e),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${K(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${K(s).name}`),ajv:B(H,s.indexOf("translations")===-1?Ao:_e),type:e.type,sectionName:e.name}))]})();function nr(e){const t=n=>{const i=(n??"").split("/").filter(r=>r.length>0);return i.length===0?"$":`$${i.map(r=>`.${r}`).join("")}`};let o=0,s=0;Object.keys(e).forEach(n=>{const i=e[n];o=Math.max(o,Math.max(...i.map(r=>t(r.instancePath).length))),s=Math.max(s,Math.max(...i.map(r=>r.message.length)))}),Object.keys(e).forEach(n=>{const i=e[n].filter((r,a,c)=>a===c.findIndex(l=>`${r.instancePath}${r.message}${r.keyword}`==`${l.instancePath}${l.message}${l.keyword}`));p.error(n),i.filter(r=>r.keyword!=="if").forEach(r=>{p.error(`${t(r.instancePath).padEnd(o," ")} | ${r.message.padEnd(s," ")} | ${r.keyword||"-"}`)})})}function ir(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:o,validationType:s}=e,n=ie(o);return[...Ji(s,{sectionSettings:t,sectionType:n})]}function ns(e,t){return xn({path:"$..set..url",json:t,resultType:"value"}).map(o=>{if(new RegExp(/^https?:\/\//).test(o))return null;const s=`${e}/assets/${o}`;return $(s)?null:{message:`Image ${o} is missing from assets folder`,keyword:"missing-asset"}}).filter(o=>o!==null)}function rr(e,t,o,s){const n=[],i=t.cards?.defaultCardContent?.settings;if(!i)return n;const r=new Set(Object.keys(i));return e.cards.forEach((a,c)=>{const l=a.settings;l&&Object.keys(l).forEach(d=>{r.has(d)||n.push({instancePath:`showcases/${s}/content/${o}/cards/${c}/settings/${d}`,message:`Setting '${d}' is not defined in content.ts defaultCardContent.settings`,keyword:"invalid-deck-card-setting"})})}),n}async function ar(e,t){const o=[];if(!e.source||!e.source.includes("/sections/")||e.validationType!==z.CONTENT||!e.sectionName)return o;const s=Ce(e.sectionName),n=g.resolve(`${s}/${e.sectionName}/js/showcases`);if(!$(n))return o;const i=h.readdirSync(n).filter(a=>a.endsWith(".mjs")&&a!=="translations.mjs").map(async a=>{const c=g.resolve(`${n}/${a.replace(".mjs","")}`),l=await k(c,!1);return{showcaseFile:a,showcaseData:l}}),r=await Promise.all(i);for(const{showcaseFile:a,showcaseData:c}of r){if(!c.content)continue;const l=c.content;Object.keys(l).forEach(d=>{const E=l[d],L=t[d];if(!L){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' is not defined in content.ts`,keyword:"invalid-showcase-element"});return}if(E.type!==L.type){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' type mismatch: showcase has type '${E.type}' but content.ts has type '${L.type}'`,keyword:"type-mismatch"});return}E.type==="DECK"&&L.type==="DECK"&&o.push(...rr(E,L,d,a.replace(".mjs","")))})}return o}async function cr(e){const t=await k(e.dist,!1),o={},s=[],n=Ce(e.sectionName??""),i=n.split("/").pop()?.toLowerCase();if(e.ajv(t)||s.push(...he(e.ajv.errors??[])),s.push(...ir(e,t),...ns(`${i}/${e.sectionName}`,t),...await tr(e,t,n)),e.source&&e.source.includes("/sections/")&&e.validationType===z.CONTENT){const r=await ar(e,t);s.push(...r)}return s.length>0&&(o[e.source]=s),o}async function lr(e){const t=An(Pn.gunzip),o=await h.promises.readFile(e);return(await t(o)).length}async function is(e,t){const o=te[e],s=g.resolve(`${o.toPath(t)}${o.fileName}`),n=await lr(s);if(n>rt)throw p.error(`Size of individual server file must not exceed threshold [${se(rt)}]!`),p.error(`${`File: ${s}`.padEnd(s.length+10)}| ${se(n)}`),new Error("Invalid server file size")}function rs(e){const t=e.reduce((o,s)=>{const n=wn(s);return n.size>it&&(o[s]=se(n.size)),o},{});if(Object.keys(t).length!==0){const o=Math.max(...Object.keys(t).map(s=>s.length));p.error(`Size of individual assets must not exceed threshold [${se(it)}]!`);for(const s in t)p.error(`${`File: ${s}`.padEnd(o+10)}| ${t[s]}`);throw new Error("Invalid asset file size")}}function pr(e,t,o,s){const n={};return e(t)&&s===void 0?Ue(`${o}${N}.mjs`,`${o}.mjs`,()=>{}):(ze(`${o}${N}.mjs`,()=>{}),n[g.resolve(`./templates/${K(o).name}.ts`)]=[...he(e.errors??[]),...s??[]]),n}async function dr(){const e={},t="dist/shared/translation",o=g.resolve(process.cwd(),`${t}.mjs`);if(!$(o))return e;try{const s=await k(t,!1),n=B(H,_e);n(s)||(e[t]=he(n.errors??[]))}catch(s){e[t]=[{instancePath:"shared/translation.ts",message:`Failed to load translation file: ${s.message}`,keyword:"import"}]}return e}const as={"process.env":{NODE_ENV:"production"}},ur=[...Ye,...Ye.map(e=>`node:${e}`)],fr=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],cs=e=>({pluginType:C.Server,define:as,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...ur,...fr],inlineDynamicImports:!0,...e,outDir:e.outDir}),ls=e=>({pluginType:C.Client,define:as,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),re=e=>({pluginType:C.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),mr=e=>({pluginType:C.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),ve=e=>({pluginType:C.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),hr=()=>Ln({ext:".gz",algorithm:"gzip"}),yr="/* EXTERNAL_IMPORTS_START */",gr="/* EXTERNAL_IMPORTS_END */",$r=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const o of Object.keys(t)){const s=t[o];if(s.type==="chunk"){const n=/import.*\?commonjs-external["'];/g,i=s.code.match(n);if(i!==null){const r=i.join(""),a=yr+r+gr,c=s.code.replace(n,"");s.code=a+c}}}}}),br=()=>({name:"disable-json-plugin",enforce:"pre",apply:"build",configResolved(e){const t=e.plugins?.findIndex(o=>o?.name==="vite:json");t!==-1&&(e.plugins[t]={name:"vite:json",load:()=>null,transform:()=>null})}}),wr=()=>{const e=process.env.npm_lifecycle_event;return Rn({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},A={VUE:Nn(),TS_CONFIG_PATHS:kn(),CHECKER:wr()};class ge{constructor(t){this.bits=t instanceof ge?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class pe{constructor(t,o,s){this.start=t,this.end=o,this.original=s,this.intro="",this.outro="",this.content=s,this.storeName=!1,this.edited=!1,this.previous=null,this.next=null}appendLeft(t){this.outro+=t}appendRight(t){this.intro=this.intro+t}clone(){const t=new pe(this.start,this.end,this.original);return t.intro=this.intro,t.outro=this.outro,t.content=this.content,t.storeName=this.storeName,t.edited=this.edited,t}contains(t){return this.start<t&&t<this.end}eachNext(t){let o=this;for(;o;)t(o),o=o.next}eachPrevious(t){let o=this;for(;o;)t(o),o=o.previous}edit(t,o,s){return this.content=t,s||(this.intro="",this.outro=""),this.storeName=o,this.edited=!0,this}prependLeft(t){this.outro=t+this.outro}prependRight(t){this.intro=t+this.intro}reset(){this.intro="",this.outro="",this.edited&&(this.content=this.original,this.storeName=!1,this.edited=!1)}split(t){const o=t-this.start,s=this.original.slice(0,o),n=this.original.slice(o);this.original=s;const i=new pe(t,this.end,n);return i.outro=this.outro,this.outro="",this.end=t,this.edited?(i.edit("",!1),this.content=""):this.content=s,i.next=this.next,i.next&&(i.next.previous=i),i.previous=this,this.next=i,i}toString(){return this.intro+this.content+this.outro}trimEnd(t){if(this.outro=this.outro.replace(t,""),this.outro.length)return!0;const o=this.content.replace(t,"");if(o.length)return o!==this.content&&(this.split(this.start+o.length).edit("",void 0,!0),this.edited&&this.edit(o,this.storeName,!0)),!0;if(this.edit("",void 0,!0),this.intro=this.intro.replace(t,""),this.intro.length)return!0}trimStart(t){if(this.intro=this.intro.replace(t,""),this.intro.length)return!0;const o=this.content.replace(t,"");if(o.length){if(o!==this.content){const s=this.split(this.end-o.length);this.edited&&s.edit(o,this.storeName,!0),this.edit("",void 0,!0)}return!0}else if(this.edit("",void 0,!0),this.outro=this.outro.replace(t,""),this.outro.length)return!0}}function Er(){return typeof globalThis<"u"&&typeof globalThis.btoa=="function"?e=>globalThis.btoa(unescape(encodeURIComponent(e))):typeof Buffer=="function"?e=>Buffer.from(e,"utf-8").toString("base64"):()=>{throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.")}}const Tr=Er();class Sr{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=Fn(t.mappings),typeof t.x_google_ignoreList<"u"&&(this.x_google_ignoreList=t.x_google_ignoreList)}toString(){return JSON.stringify(this)}toUrl(){return"data:application/json;charset=utf-8;base64,"+Tr(this.toString())}}function jr(e){const t=e.split(`
2
+ `),o=t.filter(i=>/^\t+/.test(i)),s=t.filter(i=>/^ {2,}/.test(i));if(o.length===0&&s.length===0)return null;if(o.length>=s.length)return" ";const n=s.reduce((i,r)=>{const a=/^ +/.exec(r)[0].length;return Math.min(a,i)},1/0);return new Array(n+1).join(" ")}function _r(e,t){const o=e.split(/[/\\]/),s=t.split(/[/\\]/);for(o.pop();o[0]===s[0];)o.shift(),s.shift();if(o.length){let n=o.length;for(;n--;)o[n]=".."}return o.concat(s).join("/")}const Cr=Object.prototype.toString;function vr(e){return Cr.call(e)==="[object Object]"}function ps(e){const t=e.split(`
3
+ `),o=[];for(let s=0,n=0;s<t.length;s++)o.push(n),n+=t[s].length+1;return function(n){let i=0,r=o.length;for(;i<r;){const l=i+r>>1;n<o[l]?r=l:i=l+1}const a=i-1,c=n-o[a];return{line:a,column:c}}}const Or=/\w/;class Ir{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,o,s,n){if(o.length){const i=o.length-1;let r=o.indexOf(`
5
4
  `,0),a=-1;for(;r>=0&&i>r;){const l=[this.generatedCodeColumn,t,s.line,s.column];n>=0&&l.push(n),this.rawSegments.push(l),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=r,r=o.indexOf(`
6
- `,r+1)}const c=[this.generatedCodeColumn,t,s.line,s.column];n>=0&&c.push(n),this.rawSegments.push(c),this.advance(o.slice(a+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(o));this.pending=null}addUneditedChunk(t,o,s,n,i){let r=o.start,a=!0,c=!1;for(;r<o.end;){if(this.hires||a||i.has(r)){const l=[this.generatedCodeColumn,t,n.line,n.column];this.hires==="boundary"?Lr.test(s[r])?c||(this.rawSegments.push(l),c=!0):(this.rawSegments.push(l),c=!1):this.rawSegments.push(l)}s[r]===`
5
+ `,r+1)}const c=[this.generatedCodeColumn,t,s.line,s.column];n>=0&&c.push(n),this.rawSegments.push(c),this.advance(o.slice(a+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(o));this.pending=null}addUneditedChunk(t,o,s,n,i){let r=o.start,a=!0,c=!1;for(;r<o.end;){if(this.hires||a||i.has(r)){const l=[this.generatedCodeColumn,t,n.line,n.column];this.hires==="boundary"?Or.test(s[r])?c||(this.rawSegments.push(l),c=!0):(this.rawSegments.push(l),c=!1):this.rawSegments.push(l)}s[r]===`
7
6
  `?(n.line+=1,n.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=!0):(n.column+=1,this.generatedCodeColumn+=1,a=!1),r+=1}this.pending=null}advance(t){if(!t)return;const o=t.split(`
8
7
  `);if(o.length>1){for(let s=0;s<o.length-1;s++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=o[o.length-1].length}}const ae=`
9
- `,oe={insertLeft:!1,insertRight:!1,storeName:!1};class qe{constructor(t,o={}){const s=new pe(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:s},lastChunk:{writable:!0,value:s},lastSearchedChunk:{writable:!0,value:s},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:o.filename},indentExclusionRanges:{writable:!0,value:o.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new ge},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:o.ignoreList}}),this.byStart[0]=s,this.byEnd[t.length]=s}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byEnd[t];return s?s.appendLeft(o):this.intro+=o,this}appendRight(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byStart[t];return s?s.appendRight(o):this.outro+=o,this}clone(){const t=new qe(this.original,{filename:this.filename});let o=this.firstChunk,s=t.firstChunk=t.lastSearchedChunk=o.clone();for(;o;){t.byStart[s.start]=s,t.byEnd[s.end]=s;const n=o.next,i=n&&n.clone();i&&(s.next=i,i.previous=s,s=i),o=n}return t.lastChunk=s,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new ge(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const o=0,s=Object.keys(this.storedNames),n=new Nr(t.hires),i=us(this.original);return this.intro&&n.advance(this.intro),this.firstChunk.eachNext(r=>{const a=i(r.start);r.intro.length&&n.advance(r.intro),r.edited?n.addEdit(o,r.content,a,r.storeName?s.indexOf(r.original):-1):n.addUneditedChunk(o,r,this.original,a,this.sourcemapLocations),r.outro.length&&n.advance(r.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?Pr(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:s,mappings:n.raw,x_google_ignoreList:this.ignoreList?[o]:void 0}}generateMap(t){return new Ir(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Dr(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,o){const s=/^[^\r\n]/gm;if(xr(t)&&(o=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;o=o||{};const n={};o.exclude&&(typeof o.exclude[0]=="number"?[o.exclude]:o.exclude).forEach(d=>{for(let E=d[0];E<d[1];E+=1)n[E]=!0});let i=o.indentStart!==!1;const r=l=>i?`${t}${l}`:(i=!0,l);this.intro=this.intro.replace(s,r);let a=0,c=this.firstChunk;for(;c;){const l=c.end;if(c.edited)n[a]||(c.content=c.content.replace(s,r),c.content.length&&(i=c.content[c.content.length-1]===`
8
+ `,oe={insertLeft:!1,insertRight:!1,storeName:!1};class qe{constructor(t,o={}){const s=new pe(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:s},lastChunk:{writable:!0,value:s},lastSearchedChunk:{writable:!0,value:s},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:o.filename},indentExclusionRanges:{writable:!0,value:o.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new ge},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:o.ignoreList}}),this.byStart[0]=s,this.byEnd[t.length]=s}addSourcemapLocation(t){this.sourcemapLocations.add(t)}append(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.outro+=t,this}appendLeft(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byEnd[t];return s?s.appendLeft(o):this.intro+=o,this}appendRight(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byStart[t];return s?s.appendRight(o):this.outro+=o,this}clone(){const t=new qe(this.original,{filename:this.filename});let o=this.firstChunk,s=t.firstChunk=t.lastSearchedChunk=o.clone();for(;o;){t.byStart[s.start]=s,t.byEnd[s.end]=s;const n=o.next,i=n&&n.clone();i&&(s.next=i,i.previous=s,s=i),o=n}return t.lastChunk=s,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new ge(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const o=0,s=Object.keys(this.storedNames),n=new Ir(t.hires),i=ps(this.original);return this.intro&&n.advance(this.intro),this.firstChunk.eachNext(r=>{const a=i(r.start);r.intro.length&&n.advance(r.intro),r.edited?n.addEdit(o,r.content,a,r.storeName?s.indexOf(r.original):-1):n.addUneditedChunk(o,r,this.original,a,this.sourcemapLocations),r.outro.length&&n.advance(r.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?_r(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:s,mappings:n.raw,x_google_ignoreList:this.ignoreList?[o]:void 0}}generateMap(t){return new Sr(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=jr(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,o){const s=/^[^\r\n]/gm;if(vr(t)&&(o=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;o=o||{};const n={};o.exclude&&(typeof o.exclude[0]=="number"?[o.exclude]:o.exclude).forEach(d=>{for(let E=d[0];E<d[1];E+=1)n[E]=!0});let i=o.indentStart!==!1;const r=l=>i?`${t}${l}`:(i=!0,l);this.intro=this.intro.replace(s,r);let a=0,c=this.firstChunk;for(;c;){const l=c.end;if(c.edited)n[a]||(c.content=c.content.replace(s,r),c.content.length&&(i=c.content[c.content.length-1]===`
10
9
  `));else for(a=c.start;a<l;){if(!n[a]){const d=this.original[a];d===`
11
- `?i=!0:d!=="\r"&&i&&(i=!1,a===c.start||(this._splitChunk(c,a),c=c.next),c.prependRight(t))}a+=1}a=c.end,c=c.next}return this.outro=this.outro.replace(s,r),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,o){return oe.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),oe.insertLeft=!0),this.appendLeft(t,o)}insertRight(t,o){return oe.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),oe.insertRight=!0),this.prependRight(t,o)}move(t,o,s){if(s>=t&&s<=o)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(o),this._split(s);const n=this.byStart[t],i=this.byEnd[o],r=n.previous,a=i.next,c=this.byStart[s];if(!c&&i===this.lastChunk)return this;const l=c?c.previous:this.lastChunk;return r&&(r.next=a),a&&(a.previous=r),l&&(l.next=n),c&&(c.previous=i),n.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=n.previous,this.lastChunk.next=null),n.previous=l,i.next=c||null,l||(this.firstChunk=n),c||(this.lastChunk=i),this}overwrite(t,o,s,n){return n=n||{},this.update(t,o,s,{...n,overwrite:!n.contentOnly})}update(t,o,s,n){if(typeof s!="string")throw new TypeError("replacement content must be a string");for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(o>this.original.length)throw new Error("end is out of bounds");if(t===o)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(t),this._split(o),n===!0&&(oe.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),oe.storeName=!0),n={storeName:!0});const i=n!==void 0?n.storeName:!1,r=n!==void 0?n.overwrite:!1;if(i){const l=this.original.slice(t,o);Object.defineProperty(this.storedNames,l,{writable:!0,value:!0,enumerable:!0})}const a=this.byStart[t],c=this.byEnd[o];if(a){let l=a;for(;l!==c;){if(l.next!==this.byStart[l.end])throw new Error("Cannot overwrite across a split point");l=l.next,l.edit("",!1)}a.edit(s,i,!r)}else{const l=new pe(t,o,"").edit(s,i);c.next=l,l.previous=c}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byEnd[t];return s?s.prependLeft(o):this.intro=o+this.intro,this}prependRight(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byStart[t];return s?s.prependRight(o):this.outro=o+this.outro,this}remove(t,o){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(t===o)return this;if(t<0||o>this.original.length)throw new Error("Character is out of bounds");if(t>o)throw new Error("end must be greater than start");this._split(t),this._split(o);let s=this.byStart[t];for(;s;)s.intro="",s.outro="",s.edit(""),s=o>s.end?this.byStart[s.end]:null;return this}reset(t,o){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(t===o)return this;if(t<0||o>this.original.length)throw new Error("Character is out of bounds");if(t>o)throw new Error("end must be greater than start");this._split(t),this._split(o);let s=this.byStart[t];for(;s;)s.reset(),s=o>s.end?this.byStart[s.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(ae);if(t!==-1)return this.outro.substr(t+1);let o=this.outro,s=this.lastChunk;do{if(s.outro.length>0){if(t=s.outro.lastIndexOf(ae),t!==-1)return s.outro.substr(t+1)+o;o=s.outro+o}if(s.content.length>0){if(t=s.content.lastIndexOf(ae),t!==-1)return s.content.substr(t+1)+o;o=s.content+o}if(s.intro.length>0){if(t=s.intro.lastIndexOf(ae),t!==-1)return s.intro.substr(t+1)+o;o=s.intro+o}}while(s=s.previous);return t=this.intro.lastIndexOf(ae),t!==-1?this.intro.substr(t+1)+o:this.intro+o}slice(t=0,o=this.original.length){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;let s="",n=this.firstChunk;for(;n&&(n.start>t||n.end<=t);){if(n.start<o&&n.end>=o)return s;n=n.next}if(n&&n.edited&&n.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const i=n;for(;n;){n.intro&&(i!==n||n.start===t)&&(s+=n.intro);const r=n.start<o&&n.end>=o;if(r&&n.edited&&n.end!==o)throw new Error(`Cannot use replaced character ${o} as slice end anchor.`);const a=i===n?t-n.start:0,c=r?n.content.length+o-n.end:n.content.length;if(s+=n.content.slice(a,c),n.outro&&(!r||n.end===o)&&(s+=n.outro),r)break;n=n.next}return s}snip(t,o){const s=this.clone();return s.remove(0,t),s.remove(o,s.original.length),s}_split(t){if(this.byStart[t]||this.byEnd[t])return;let o=this.lastSearchedChunk;const s=t>o.end;for(;o;){if(o.contains(t))return this._splitChunk(o,t);o=s?this.byStart[o.end]:this.byEnd[o.start]}}_splitChunk(t,o){if(t.edited&&t.content.length){const n=us(this.original)(o);throw new Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} \u2013 "${t.original}")`)}const s=t.split(o);return this.byEnd[o]=t,this.byStart[o]=s,this.byEnd[s.end]=s,t===this.lastChunk&&(this.lastChunk=s),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,o=this.firstChunk;for(;o;)t+=o.toString(),o=o.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,o=0;do o+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return o}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const o=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(o,""),this.outro.length)return!0;let s=this.lastChunk;do{const n=s.end,i=s.trimEnd(o);if(s.end!==n&&(this.lastChunk===s&&(this.lastChunk=s.next),this.byEnd[s.end]=s,this.byStart[s.next.start]=s.next,this.byEnd[s.next.end]=s.next),i)return!0;s=s.previous}while(s);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const o=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(o,""),this.intro.length)return!0;let s=this.firstChunk;do{const n=s.end,i=s.trimStart(o);if(s.end!==n&&(s===this.lastChunk&&(this.lastChunk=s.next),this.byEnd[s.end]=s,this.byStart[s.next.start]=s.next,this.byEnd[s.next.end]=s.next),i)return!0;s=s.next}while(s);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,o){function s(i,r){return typeof o=="string"?o.replace(/\$(\$|&|\d+)/g,(a,c)=>c==="$"?"$":c==="&"?i[0]:+c<i.length?i[+c]:`$${c}`):o(...i,i.index,r,i.groups)}function n(i,r){let a;const c=[];for(;a=i.exec(r);)c.push(a);return c}if(t.global)n(t,this.original).forEach(r=>{if(r.index!=null){const a=s(r,this.original);a!==r[0]&&this.overwrite(r.index,r.index+r[0].length,a)}});else{const i=this.original.match(t);if(i&&i.index!=null){const r=s(i,this.original);r!==i[0]&&this.overwrite(i.index,i.index+i[0].length,r)}}return this}_replaceString(t,o){const{original:s}=this,n=s.indexOf(t);return n!==-1&&this.overwrite(n,n+t.length,o),this}replace(t,o){return typeof t=="string"?this._replaceString(t,o):this._replaceRegexp(t,o)}_replaceAllString(t,o){const{original:s}=this,n=t.length;for(let i=s.indexOf(t);i!==-1;i=s.indexOf(t,i+n))s.slice(i,i+n)!==o&&this.overwrite(i,i+n,o);return this}replaceAll(t,o){if(typeof t=="string")return this._replaceAllString(t,o);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,o)}}const fs=u(process.cwd(),"shared/translation.ts"),ms="globalThis.craneSharedTranslation = translation",kr=e=>`import translation from '${e}';
12
- ${ms};
13
- `,Rr=(e,t)=>{const o=e.split("?")[0],s=yn(o);return(s==="server.ts"||s==="client.ts")&&!t.includes(ms)},hs=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=$(fs)},transform(t,o){if(!e||!Rr(o,t))return null;const s=o.split("?")[0],n=Ge(s),i=jn(hn(n,fs)),r=kr(i),a=new qe(t);return a.prepend(r),{code:a.toString()}}}},Fr={[C.Server]:[A.VUE,A.TS_CONFIG_PATHS,jr(),Er(),hs()],[C.Client]:[A.VUE,A.TS_CONFIG_PATHS,A.CHECKER,We({vue:"EcVue"}),hs()],[C.Misc]:[A.TS_CONFIG_PATHS,A.CHECKER],[C.Layout]:[A.VUE,A.TS_CONFIG_PATHS,A.CHECKER,We({vue:["EcExternals","Vue"]})],[C.Asset]:[_r()],[C.SharedFiles]:[A.TS_CONFIG_PATHS]},qr={[y.Server]:ps({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/main/server`}),[y.Client]:ds({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/main/client`}),[y.SectionSetting]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/settings`}),[y.SectionShowcase]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/showcases`}),[y.SectionAsset]:De({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/assets`}),[y.TemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:()=>`./${D}/js`}),[y.PageTemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:({name:e})=>`./${D}/${e}`}),[y.TemplateAsset]:De({outDir:()=>`./${D}/assets`}),[y.Layout]:wr({outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}`}),[y.LayoutSettings]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}/js/settings`}),[y.LayoutAsset]:De({outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}/assets`}),[y.SlotServer]:ps({outDir:({name:e,layoutId:t,sectionId:o})=>`./${v}/${o}/${t}/slots/${e}/js/main/server`}),[y.SlotClient]:ds({outDir:({name:e,layoutId:t,sectionId:o})=>`./${v}/${o}/${t}/slots/${e}/js/main/client`}),[y.SharedTranslation]:{pluginType:C.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function Gr(e){switch(typeof e){case"string":return[u(process.cwd(),e)];case"object":return e.map(t=>u(process.cwd(),t));default:return[]}}function ys({name:e,entryPoints:t,configType:o,layoutId:s,sectionId:n,sectionType:i=S.SECTION}){const r=qr[o],a=r.define,c=r.ssrOptions,l=r.entryFileNames,d=r.chunkFileNames,E=r.assetFileNames,L=r.inlineDynamicImports,fn=r.externalOption;return{plugins:Fr[r.pluginType],ssr:c,define:a,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:r.ssr,outDir:r.outDir({name:e,sectionType:i,layoutId:s,sectionId:n}),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1,pure_getters:!0}},rollupOptions:{external:fn,preserveEntrySignatures:"strict",input:Gr(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:l,chunkFileNames:d,assetFileNames:E}}},assetsInclude:["**/*.json"]}}async function Br(){const e={ignore:["node_modules/**","dist/**"]},t=await f(`./${Z}/{product,category,catalog}/*/Main.vue`,e);return await Promise.all(t.map(async o=>{const{id:s,sectionId:n,pageId:i}=dt(o),[r,a]=await Promise.all([f(`./${Z}/${n}/${s}/settings/{content,design,translations}.{js,ts}`,e),f(`./${Z}/${n}/${s}/assets/*`,e)]);return{name:s,sectionId:n,pageId:i,clientEntrypoint:o,settingsEntryPoints:r,assetsEntrypoints:a}}))}async function Mr(e){cs(e.assetsEntrypoints),await _({entryPoints:[e.clientEntrypoint],configType:y.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([_({entryPoints:e.settingsEntryPoints,configType:y.LayoutSettings,name:e.name,sectionId:e.sectionId}),_({entryPoints:e.assetsEntrypoints,configType:y.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function Ur(e){e===void 0||e.length===0||await Promise.all(e.map(t=>Mr(t)))}async function zr(e){const t=Ve(ys({name:e.name,entryPoints:e.serverEntrypoint,configType:y.Server,sectionType:e.type}));return cs(e.assetEntryPoints),await Y({configFile:!1,...t}),await as(m.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([_({entryPoints:e.clientEntrypoint,configType:y.Client,name:e.name,sectionType:e.type}),_({entryPoints:e.settingsEntryPoints,configType:y.SectionSetting,name:e.name,sectionType:e.type}),_({entryPoints:e.showcaseEntryPoints,configType:y.SectionShowcase,name:e.name,sectionType:e.type}),_({entryPoints:e.assetEntryPoints,configType:y.SectionAsset,name:e.name,sectionType:e.type})]),await lr(e).reduce(async(o,s)=>{const n=await o,i=await mr(s);return{...n,...i}},Promise.resolve({}))}async function Xr(){const e=u(process.cwd(),"shared/translation.ts");$(e)&&await _({entryPoints:["shared/translation.ts"],configType:y.SharedTranslation})}async function Hr(e){return e.reduce(async(t,o)=>{const s=await t,n=await zr(o);return{...s,...n}},Promise.resolve({}))}function gs(e){const t=ve(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[o,s,,n]=t;if(!at(o))throw new Error(`Slot cannot be placed in a non-storefront section: ${o}`);return{id:n,sectionId:o,layoutId:s}}async function Kr(e){const t=await xi(e),[o,s]=await Promise.all([Li({...e,translations:t}),Ni({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function Vr(){const e=`${v}/{product,catalog,category}/*/slots/*`,t=await f(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(gs).map(Kr))}async function Yr(){const e={ignore:["node_modules/**","dist/**"]},t=await f(`${Z}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async o=>{const{id:s,sectionId:n,layoutId:i}=gs(o),r=(await f(`${Z}/${n}/${i}/slots/${s}/client.{js,ts}`,e))[0];if(r===void 0)throw new Error(`Cannot find client entrypoint file for slot ${s} of section ${n}`);return{id:s,sectionId:n,layoutId:i,serverEntrypoint:o,clientEntrypoint:r}}))}async function Wr(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await _({entryPoints:[e.serverEntrypoint],configType:y.SlotServer,...t}),await as(m.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await _({entryPoints:[e.clientEntrypoint],configType:y.SlotClient,...t})}async function Jr(e){e===void 0||e.length===0||await e.reduce(async(t,o)=>{await t,await Wr(o)},Promise.resolve())}const $s="https://json-schema.org/draft/2020-12/schema",bs="https://lightspeedhq.com/metadata.schema.json",ws="Custom Multi Page Template metadata",Es="Metadata of a multi page template",Ts="object",Ss={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},js=["metadata","header","footer"],_s=!1,Zr={$schema:$s,$id:bs,title:ws,description:Es,type:Ts,properties:Ss,required:js,additionalProperties:_s},Qr={__proto__:null,$id:bs,$schema:$s,additionalProperties:_s,default:Zr,description:Es,properties:Ss,required:js,title:ws,type:Ts},Cs="https://json-schema.org/draft/2020-12/schema",vs="https://lightspeedhq.com/header_footer.schema.json",Os="Header/Footer definition for a page template",Is="object",Ds=["type","id"],Ps={type:{type:"string",enum:["custom","default"]},id:{type:"string"},showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},As=!1,xs=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}},{if:{properties:{type:{const:"custom"}}},then:{properties:{showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}}}}],ea={$schema:Cs,$id:vs,title:Os,type:Is,required:Ds,properties:Ps,additionalProperties:As,allOf:xs},ta={__proto__:null,$id:vs,$schema:Cs,additionalProperties:As,allOf:xs,default:ea,properties:Ps,required:Ds,title:Os,type:Is},Ls="https://json-schema.org/draft/2020-12/schema",Ns="https://lightspeedhq.com/page.schema.json",ks="Homepage",Rs="Homepage enclosing the necessary custom and default blocks",Fs="object",qs={sections:{description:"List of sections contained by this page",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"custom"}}},then:{$ref:"../template-custom.schema.json#/$defs/custom-section"}},{if:{properties:{type:{const:"default"}}},then:{$ref:"../template-default.schema.json#/$defs/default-section"}},{not:{properties:{id:{enum:["header","footer"]}},required:["id"]}}]},minItems:1,uniqueItems:!1}},Gs=!1,Bs=["sections"],oa={$schema:Ls,$id:Ns,title:ks,description:Rs,type:Fs,properties:qs,additionalProperties:Gs,required:Bs},sa={__proto__:null,$id:Ns,$schema:Ls,additionalProperties:Gs,default:oa,description:Rs,properties:qs,required:Bs,title:ks,type:Fs},Ms="https://json-schema.org/draft/2020-12/schema",Us="https://lightspeedhq.com/page.schema.json",zs="Custom Page",Xs="A custom page enclosing the necessary custom and default blocks",Hs="object",Ks={sections:{description:"List of sections contained by this page",type:"array",minItems:1,maxItems:1,uniqueItems:!1,contains:{type:"object",properties:{type:{const:"store"}},required:["type"]},items:{type:"object",required:["type"],allOf:[{if:{properties:{type:{const:"store"}}},then:{$ref:"./store-section.schema.json"},else:{properties:{type:{description:"Type of the section",type:"string"},id:{description:"Unique identifier for the section",type:"string"}},required:["type","id"]}}]}}},Vs=!1,Ys=["sections"],na={$schema:Ms,$id:Us,title:zs,description:Xs,type:Hs,properties:Ks,additionalProperties:Vs,required:Ys},Pe={__proto__:null,$id:Us,$schema:Ms,additionalProperties:Vs,default:na,description:Xs,properties:Ks,required:Ys,title:zs,type:Hs},Ws="https://json-schema.org/draft/2020-12/schema",Js="https://lightspeedhq.com/store-section.schema.json",Zs="Store Section",Qs="Store section for a custom page",en="object",tn=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"store"},id:{description:"Layout identifier of the section. When not provided, the section will use the default layout.",type:"string"}},required:["type"],additionalProperties:!1}],ia={$schema:Ws,$id:Js,title:Zs,description:Qs,type:en,allOf:tn},ra={__proto__:null,$id:Js,$schema:Ws,allOf:tn,default:ia,description:Qs,title:Zs,type:en};function aa(e){switch(e){case I.PRODUCT:return"product";case I.CATALOG:return"catalog";case I.CATEGORY:return"category";default:return null}}const ca=[Co,$t,_t,Yo,qt,At,ra,ta,os],la=e=>{const t=[],o={},s=(n,i,r,a)=>{if(!n){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${i}`,message:`Missing file: ${i}`,keyword:"required"});return}t.push({templateName:e.name,source:n,dist:g.resolve(`dist/templates/${e.name}/${i}`),ajv:U(ca,r),templatePageType:a})};return s(e.catalogEntrypoint,"catalog",Pe,I.CATALOG),s(e.productEntrypoint,"product",Pe,I.PRODUCT),s(e.homeEntrypoint,"home",sa,I.HOME),s(e.categoryEntrypoint,"category",Pe,I.CATEGORY),s(e.configurationEntrypoint,"configuration",Qr,I.CUSTOM),[t,o]};function pa({section:e,context:t,normalizedPaths:o}){const s=aa(t.templatePageType);if(s===null)return{instancePath:`/sections/${e.id}/id`,message:`Source folder not found for template page type "${t.templatePageType}".`,keyword:"source_folder_not_found"};const n=`${s}/${e.id}`;return o.some(i=>i.startsWith(n))?null:{instancePath:`/sections/${e.id}/id`,message:`Source layout for section "${e.id}" not found in "layouts/${s}/${e.id}".`,keyword:"layout_not_found"}}function da(e){const{type:t,id:o}=e;return t==="store"&&o!==void 0&&o!==""}async function ua({content:e,context:t,layoutBuildConfigs:o}){const s=o.map(n=>ve(n.clientEntrypoint));return e.sections.filter(da).map(n=>pa({section:n,context:t,normalizedPaths:s})).filter(n=>n!==null)}function fa(e){return"sections"in e}async function ma(e,t){const o=await k(e.dist,!0),s={},n=[];if(e.ajv(o)?Ue(`${e.dist}${N}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...he(e.ajv.errors??[])),ze(`${e.dist}${N}.mjs`,()=>{})),fa(o)&&t!==void 0){const i=await ua({content:o,context:e,layoutBuildConfigs:t});n.push(...i)}return n.length>0&&(s[e.source]=n),s}const ha=async(e,t)=>{const[o,s]=la(e);return(await Promise.all(o.map(n=>ma(n,t)))).reduce((n,i)=>(Object.entries(i).forEach(([r,a])=>{n[r]=n[r]?[...n[r],...a]:[...a]}),n),{...s})};async function ya(e,t,o,s=j){if(t.showcase_overrides?.content!==void 0)if(!$(`${s}/${t.id}/js/settings/content.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/content`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.content).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function ga(e,t,o,s=j){if(t.showcase_overrides?.design!==void 0)if(!$(`${s}/${t.id}/js/settings/design.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/design`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.design).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}}async function $a(e,t,o,s=j){if(t.showcase_overrides?.layoutId!==void 0)if(!$(`${s}/${t.id}/js/settings/layout.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor is set, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/layout`,!1);new Set(n.map(i=>i.layoutId)).has(t.showcase_overrides.layoutId)||e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor must be a valid id in the default layout descriptor",keyword:"type"})}}async function Ae(e,t,o,s=j){t.showcase_overrides!==void 0&&(await ya(e,t,o,s),await ga(e,t,o,s),await $a(e,t,o,s))}function xe(e,t,o,s=j){t.showcase_id!==void 0&&($(`${s}/${t.id}/js/showcases/${t.showcase_id}.mjs`)||e.push({instancePath:`/sections/${o}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}async function ba(e,t){const o=t.id==="header"&&t.type==="default",s=$(`${W}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await Ae(e,t,0,W),xe(e,t,0,W))}async function wa(e,t,o){const s=t.id==="footer"&&t.type==="default",n=$(`${J}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await Ae(e,t,o,J),xe(e,t,o,J))}async function Ea(e,t){t.showcase_overrides&&e.push(...rs(`sections/${t.id}`,t.showcase_overrides))}async function Ta(e){const t=await e.sections.reduce(async(o,s,n)=>{const i=await o;return n===0?await ba(i,s):n===e.sections.length-1?await wa(i,s,e.sections.length-1):s.type==="custom"?$(`${j}/${s.id}`)?(await Ae(i,s,n),xe(i,s,n),await Ea(i,s)):i.push({instancePath:`/sections/${n}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):s.type==="default"&&(s.id==="header"&&i.push({instancePath:`/sections/${n}/id`,message:"Header can only be placed as the first section",keyword:"required"}),s.id==="footer"&&i.push({instancePath:`/sections/${n}/id`,message:"Footer can only be placed as the last section",keyword:"required"})),i},Promise.resolve([]));return t.length>0?t:void 0}async function Sa(){const e=await f("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(p.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const o=t.split(Be),s=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const n=await f(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await f(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await f(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await f(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await f(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:n.at(0),homeEntrypoint:i.at(0),categoryEntrypoint:r.at(0),catalogEntrypoint:a.at(0),productEntrypoint:c.at(0)}}))}async function ja(){const e=await f("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await f("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Sa(),templates:e,assets:t}}async function _a(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=cr();return await Promise.all([_({entryPoints:e.assets,configType:y.TemplateAsset}),_({entryPoints:e.templates,configType:y.TemplateDescriptor})]),e.templates.reduce(async(o,s)=>{const n=await o,i=`${D}/js/${K(s).name}`,r=await k(i,!0);return{...n,...yr(t,r,i,await Ta(r))}},Promise.resolve({}))}async function Ca({templateBuildConfig:e,layoutBuildConfigs:t}){return e.pageTemplates?.reduce(async(o,s)=>{const n=await o,i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint].filter(me);if(i.length===0)throw new Error("No entry points provided for page template");return await _({entryPoints:i,configType:y.PageTemplateDescriptor,name:s.name}),{...n,...await ha(s,t)}},Promise.resolve({}))??{}}async function va(e){const t=await ja(),o=await Promise.all([_a(t),Ca({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!st(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function Oa(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(me).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(me),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(me),assetEntryPoints:e.assetsEntrypoints??[]}}function Ia(e){return Object.entries(w).find(t=>t[1].source===e)?.[0]}async function Da(){const e=await f("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const o=Ge(t).split(Be),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const i=await f(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await f(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await f(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await f(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await f(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await f(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),E=await f(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),L=await f(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:Ia(n),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:c.at(0),settingsTranslationsEntrypoint:l.at(0),showcasesEntrypoints:d,showcasesTranslationsEntrypoint:E.at(0),assetsEntrypoints:L}}))}function Pa(){return Promise.all([$e.rm("dist",{recursive:!0,force:!0}),$e.rm("source-code",{recursive:!0,force:!0}),$e.rm("source-code.zip",{force:!0})])}async function Aa(){const e=new Sn,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await f("**/*",{cwd:u(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(i=>{const r=u(process.cwd(),i);e.addLocalFile(r,K(i).dir)});const s=te[m.SourceCode].fileName,n=u(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw p.error("Error while zipping source files"),s}}async function Le(e=!1){await Pa();try{const[t,o,s]=await Promise.all([Br(),Da(),Yr()]),n=o.map(Oa);await Xr();const i={...await gr(),...await Hr(n),...await va(t)};Object.keys(i).length===0?(await Promise.all([Jr(s),Ur(t),Aa()]),p.info(`Build successful:
10
+ `?i=!0:d!=="\r"&&i&&(i=!1,a===c.start||(this._splitChunk(c,a),c=c.next),c.prependRight(t))}a+=1}a=c.end,c=c.next}return this.outro=this.outro.replace(s,r),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,o){return oe.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),oe.insertLeft=!0),this.appendLeft(t,o)}insertRight(t,o){return oe.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),oe.insertRight=!0),this.prependRight(t,o)}move(t,o,s){if(s>=t&&s<=o)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(o),this._split(s);const n=this.byStart[t],i=this.byEnd[o],r=n.previous,a=i.next,c=this.byStart[s];if(!c&&i===this.lastChunk)return this;const l=c?c.previous:this.lastChunk;return r&&(r.next=a),a&&(a.previous=r),l&&(l.next=n),c&&(c.previous=i),n.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=n.previous,this.lastChunk.next=null),n.previous=l,i.next=c||null,l||(this.firstChunk=n),c||(this.lastChunk=i),this}overwrite(t,o,s,n){return n=n||{},this.update(t,o,s,{...n,overwrite:!n.contentOnly})}update(t,o,s,n){if(typeof s!="string")throw new TypeError("replacement content must be a string");for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(o>this.original.length)throw new Error("end is out of bounds");if(t===o)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(t),this._split(o),n===!0&&(oe.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),oe.storeName=!0),n={storeName:!0});const i=n!==void 0?n.storeName:!1,r=n!==void 0?n.overwrite:!1;if(i){const l=this.original.slice(t,o);Object.defineProperty(this.storedNames,l,{writable:!0,value:!0,enumerable:!0})}const a=this.byStart[t],c=this.byEnd[o];if(a){let l=a;for(;l!==c;){if(l.next!==this.byStart[l.end])throw new Error("Cannot overwrite across a split point");l=l.next,l.edit("",!1)}a.edit(s,i,!r)}else{const l=new pe(t,o,"").edit(s,i);c.next=l,l.previous=c}return this}prepend(t){if(typeof t!="string")throw new TypeError("outro content must be a string");return this.intro=t+this.intro,this}prependLeft(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byEnd[t];return s?s.prependLeft(o):this.intro=o+this.intro,this}prependRight(t,o){if(typeof o!="string")throw new TypeError("inserted content must be a string");this._split(t);const s=this.byStart[t];return s?s.prependRight(o):this.outro=o+this.outro,this}remove(t,o){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(t===o)return this;if(t<0||o>this.original.length)throw new Error("Character is out of bounds");if(t>o)throw new Error("end must be greater than start");this._split(t),this._split(o);let s=this.byStart[t];for(;s;)s.intro="",s.outro="",s.edit(""),s=o>s.end?this.byStart[s.end]:null;return this}reset(t,o){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;if(t===o)return this;if(t<0||o>this.original.length)throw new Error("Character is out of bounds");if(t>o)throw new Error("end must be greater than start");this._split(t),this._split(o);let s=this.byStart[t];for(;s;)s.reset(),s=o>s.end?this.byStart[s.end]:null;return this}lastChar(){if(this.outro.length)return this.outro[this.outro.length-1];let t=this.lastChunk;do{if(t.outro.length)return t.outro[t.outro.length-1];if(t.content.length)return t.content[t.content.length-1];if(t.intro.length)return t.intro[t.intro.length-1]}while(t=t.previous);return this.intro.length?this.intro[this.intro.length-1]:""}lastLine(){let t=this.outro.lastIndexOf(ae);if(t!==-1)return this.outro.substr(t+1);let o=this.outro,s=this.lastChunk;do{if(s.outro.length>0){if(t=s.outro.lastIndexOf(ae),t!==-1)return s.outro.substr(t+1)+o;o=s.outro+o}if(s.content.length>0){if(t=s.content.lastIndexOf(ae),t!==-1)return s.content.substr(t+1)+o;o=s.content+o}if(s.intro.length>0){if(t=s.intro.lastIndexOf(ae),t!==-1)return s.intro.substr(t+1)+o;o=s.intro+o}}while(s=s.previous);return t=this.intro.lastIndexOf(ae),t!==-1?this.intro.substr(t+1)+o:this.intro+o}slice(t=0,o=this.original.length){for(;t<0;)t+=this.original.length;for(;o<0;)o+=this.original.length;let s="",n=this.firstChunk;for(;n&&(n.start>t||n.end<=t);){if(n.start<o&&n.end>=o)return s;n=n.next}if(n&&n.edited&&n.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const i=n;for(;n;){n.intro&&(i!==n||n.start===t)&&(s+=n.intro);const r=n.start<o&&n.end>=o;if(r&&n.edited&&n.end!==o)throw new Error(`Cannot use replaced character ${o} as slice end anchor.`);const a=i===n?t-n.start:0,c=r?n.content.length+o-n.end:n.content.length;if(s+=n.content.slice(a,c),n.outro&&(!r||n.end===o)&&(s+=n.outro),r)break;n=n.next}return s}snip(t,o){const s=this.clone();return s.remove(0,t),s.remove(o,s.original.length),s}_split(t){if(this.byStart[t]||this.byEnd[t])return;let o=this.lastSearchedChunk;const s=t>o.end;for(;o;){if(o.contains(t))return this._splitChunk(o,t);o=s?this.byStart[o.end]:this.byEnd[o.start]}}_splitChunk(t,o){if(t.edited&&t.content.length){const n=ps(this.original)(o);throw new Error(`Cannot split a chunk that has already been edited (${n.line}:${n.column} \u2013 "${t.original}")`)}const s=t.split(o);return this.byEnd[o]=t,this.byStart[o]=s,this.byEnd[s.end]=s,t===this.lastChunk&&(this.lastChunk=s),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,o=this.firstChunk;for(;o;)t+=o.toString(),o=o.next;return t+this.outro}isEmpty(){let t=this.firstChunk;do if(t.intro.length&&t.intro.trim()||t.content.length&&t.content.trim()||t.outro.length&&t.outro.trim())return!1;while(t=t.next);return!0}length(){let t=this.firstChunk,o=0;do o+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return o}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const o=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(o,""),this.outro.length)return!0;let s=this.lastChunk;do{const n=s.end,i=s.trimEnd(o);if(s.end!==n&&(this.lastChunk===s&&(this.lastChunk=s.next),this.byEnd[s.end]=s,this.byStart[s.next.start]=s.next,this.byEnd[s.next.end]=s.next),i)return!0;s=s.previous}while(s);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const o=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(o,""),this.intro.length)return!0;let s=this.firstChunk;do{const n=s.end,i=s.trimStart(o);if(s.end!==n&&(s===this.lastChunk&&(this.lastChunk=s.next),this.byEnd[s.end]=s,this.byStart[s.next.start]=s.next,this.byEnd[s.next.end]=s.next),i)return!0;s=s.next}while(s);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,o){function s(i,r){return typeof o=="string"?o.replace(/\$(\$|&|\d+)/g,(a,c)=>c==="$"?"$":c==="&"?i[0]:+c<i.length?i[+c]:`$${c}`):o(...i,i.index,r,i.groups)}function n(i,r){let a;const c=[];for(;a=i.exec(r);)c.push(a);return c}if(t.global)n(t,this.original).forEach(r=>{if(r.index!=null){const a=s(r,this.original);a!==r[0]&&this.overwrite(r.index,r.index+r[0].length,a)}});else{const i=this.original.match(t);if(i&&i.index!=null){const r=s(i,this.original);r!==i[0]&&this.overwrite(i.index,i.index+i[0].length,r)}}return this}_replaceString(t,o){const{original:s}=this,n=s.indexOf(t);return n!==-1&&this.overwrite(n,n+t.length,o),this}replace(t,o){return typeof t=="string"?this._replaceString(t,o):this._replaceRegexp(t,o)}_replaceAllString(t,o){const{original:s}=this,n=t.length;for(let i=s.indexOf(t);i!==-1;i=s.indexOf(t,i+n))s.slice(i,i+n)!==o&&this.overwrite(i,i+n,o);return this}replaceAll(t,o){if(typeof t=="string")return this._replaceAllString(t,o);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,o)}}const ds=u(process.cwd(),"shared/translation.ts"),us="globalThis.craneSharedTranslation = translation",Dr=e=>`import translation from '${e}';
11
+ ${us};
12
+ `,Pr=(e,t)=>{const o=e.split("?")[0],s=hn(o);return(s==="server.ts"||s==="client.ts")&&!t.includes(us)},fs=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=$(ds)},transform(t,o){if(!e||!Pr(o,t))return null;const s=o.split("?")[0],n=Ge(s),i=Sn(mn(n,ds)),r=Dr(i),a=new qe(t);return a.prepend(r),{code:a.toString()}}}},Ar={[C.Server]:[A.VUE,A.TS_CONFIG_PATHS,$r(),hr(),fs()],[C.Client]:[A.VUE,A.TS_CONFIG_PATHS,A.CHECKER,We({vue:"EcVue"}),fs()],[C.Misc]:[A.TS_CONFIG_PATHS,A.CHECKER],[C.Layout]:[A.VUE,A.TS_CONFIG_PATHS,A.CHECKER,We({vue:["EcExternals","Vue"]})],[C.Asset]:[br()],[C.SharedFiles]:[A.TS_CONFIG_PATHS]},xr={[y.Server]:cs({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/main/server`}),[y.Client]:ls({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/main/client`}),[y.SectionSetting]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/settings`}),[y.SectionShowcase]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/js/showcases`}),[y.SectionAsset]:ve({outDir:({name:e,sectionType:t})=>`./${w[t].dist}/${e}/assets`}),[y.TemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:()=>`./${P}/js`}),[y.PageTemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:({name:e})=>`./${P}/${e}`}),[y.TemplateAsset]:ve({outDir:()=>`./${P}/assets`}),[y.Layout]:mr({outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}`}),[y.LayoutSettings]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}/js/settings`}),[y.LayoutAsset]:ve({outDir:({name:e,sectionId:t})=>`./${v}/${t}/${e}/assets`}),[y.SlotServer]:cs({outDir:({name:e,layoutId:t,sectionId:o})=>`./${v}/${o}/${t}/slots/${e}/js/main/server`}),[y.SlotClient]:ls({outDir:({name:e,layoutId:t,sectionId:o})=>`./${v}/${o}/${t}/slots/${e}/js/main/client`}),[y.SharedTranslation]:{pluginType:C.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function Lr(e){switch(typeof e){case"string":return[u(process.cwd(),e)];case"object":return e.map(t=>u(process.cwd(),t));default:return[]}}function ms({name:e,entryPoints:t,configType:o,layoutId:s,sectionId:n,sectionType:i=T.SECTION}){const r=xr[o],a=r.define,c=r.ssrOptions,l=r.entryFileNames,d=r.chunkFileNames,E=r.assetFileNames,L=r.inlineDynamicImports,fn=r.externalOption;return{plugins:Ar[r.pluginType],ssr:c,define:a,resolve:{alias:{"@":"/src"}},css:{preprocessorOptions:{scss:{api:"modern-compiler"}}},build:{ssr:r.ssr,outDir:r.outDir({name:e,sectionType:i,layoutId:s,sectionId:n}),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1,pure_getters:!0}},rollupOptions:{external:fn,preserveEntrySignatures:"strict",input:Lr(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:L,entryFileNames:l,chunkFileNames:d,assetFileNames:E}}},assetsInclude:["**/*.json"]}}async function Nr(){const e={ignore:["node_modules/**","dist/**"]},t=await f(`./${Q}/{product,category,catalog}/*/Main.vue`,e);return await Promise.all(t.map(async o=>{const{id:s,sectionId:n,pageId:i}=lt(o),[r,a]=await Promise.all([f(`./${Q}/${n}/${s}/settings/{content,design,translations}.{js,ts}`,e),f(`./${Q}/${n}/${s}/assets/*`,e)]);return{name:s,sectionId:n,pageId:i,clientEntrypoint:o,settingsEntryPoints:r,assetsEntrypoints:a}}))}async function kr(e){rs(e.assetsEntrypoints),await _({entryPoints:[e.clientEntrypoint],configType:y.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([_({entryPoints:e.settingsEntryPoints,configType:y.LayoutSettings,name:e.name,sectionId:e.sectionId}),_({entryPoints:e.assetsEntrypoints,configType:y.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function Rr(e){e===void 0||e.length===0||await Promise.all(e.map(t=>kr(t)))}async function Fr(e){const t=Ke(ms({name:e.name,entryPoints:e.serverEntrypoint,configType:y.Server,sectionType:e.type}));return rs(e.assetEntryPoints),await Y({configFile:!1,...t}),await is(m.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([_({entryPoints:e.clientEntrypoint,configType:y.Client,name:e.name,sectionType:e.type}),_({entryPoints:e.settingsEntryPoints,configType:y.SectionSetting,name:e.name,sectionType:e.type}),_({entryPoints:e.showcaseEntryPoints,configType:y.SectionShowcase,name:e.name,sectionType:e.type}),_({entryPoints:e.assetEntryPoints,configType:y.SectionAsset,name:e.name,sectionType:e.type})]),await sr(e).reduce(async(o,s)=>{const n=await o,i=await cr(s);return{...n,...i}},Promise.resolve({}))}async function qr(){const e=u(process.cwd(),"shared/translation.ts");$(e)&&await _({entryPoints:["shared/translation.ts"],configType:y.SharedTranslation})}async function Gr(e){return e.reduce(async(t,o)=>{const s=await t,n=await Fr(o);return{...s,...n}},Promise.resolve({}))}function hs(e){const t=je(e).split("/");if(t.length<4||t[2]!=="slots")throw new Error(`Invalid slot path: ${e}. Expected format: [dist/]layouts/{sectionId}/{layoutId}/slots/{slotId}/[...path]`);const[o,s,,n]=t;if(!et(o))throw new Error(`Slot cannot be placed in a non-storefront section: ${o}`);return{id:n,sectionId:o,layoutId:s}}async function Br(e){const t=await vi(e),[o,s]=await Promise.all([Oi({...e,translations:t}),Ii({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function Mr(){const e=`${v}/{product,catalog,category}/*/slots/*`,t=await f(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(hs).map(Br))}async function Ur(){const e={ignore:["node_modules/**","dist/**"]},t=await f(`${Q}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async o=>{const{id:s,sectionId:n,layoutId:i}=hs(o),r=(await f(`${Q}/${n}/${i}/slots/${s}/client.{js,ts}`,e))[0];if(r===void 0)throw new Error(`Cannot find client entrypoint file for slot ${s} of section ${n}`);return{id:s,sectionId:n,layoutId:i,serverEntrypoint:o,clientEntrypoint:r}}))}async function zr(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await _({entryPoints:[e.serverEntrypoint],configType:y.SlotServer,...t}),await is(m.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await _({entryPoints:[e.clientEntrypoint],configType:y.SlotClient,...t})}async function Xr(e){e===void 0||e.length===0||await e.reduce(async(t,o)=>{await t,await zr(o)},Promise.resolve())}const ys="https://json-schema.org/draft/2020-12/schema",gs="https://lightspeedhq.com/metadata.schema.json",$s="Custom Multi Page Template metadata",bs="Metadata of a multi page template",ws="object",Es={metadata:{type:"object",properties:{name:{description:"Name of the template",type:"string",minLength:2,maxLength:60},description:{description:"Short description of the template",type:"string",minLength:2,maxLength:150},preview_url:{description:"Preview url of the demo website",type:"string",format:"uri",pattern:"^(https?)://([^.]+?\\.)company\\.site($|/[A-Za-z0-9\\-._~:/?#\\[\\]@!$&'()*+,;=]*)?$"},cover_image:{type:"object",properties:{set:{description:"Name of the image set",type:"object",patternProperties:{".*":{type:"object",properties:{url:{description:"Path to the preview image relative to the 'assets' folder for a specific resolution",type:"string"}},required:["url"],additionalProperties:!1}}}},required:["set"],additionalProperties:!1}},required:["name","description","cover_image"],additionalProperties:!1},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},Ts=["metadata","header","footer"],Ss=!1,Hr={$schema:ys,$id:gs,title:$s,description:bs,type:ws,properties:Es,required:Ts,additionalProperties:Ss},Kr={__proto__:null,$id:gs,$schema:ys,additionalProperties:Ss,default:Hr,description:bs,properties:Es,required:Ts,title:$s,type:ws},js="https://json-schema.org/draft/2020-12/schema",_s="https://lightspeedhq.com/header_footer.schema.json",Cs="Header/Footer definition for a page template",vs="object",Os=["type","id"],Is={type:{type:"string",enum:["custom","default"]},id:{type:"string"},showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},Ds=!1,Ps=[{if:{properties:{type:{const:"default"}}},then:{properties:{id:{enum:["header","footer"]}}}},{if:{properties:{type:{const:"custom"}}},then:{properties:{showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}}}}],Vr={$schema:js,$id:_s,title:Cs,type:vs,required:Os,properties:Is,additionalProperties:Ds,allOf:Ps},Yr={__proto__:null,$id:_s,$schema:js,additionalProperties:Ds,allOf:Ps,default:Vr,properties:Is,required:Os,title:Cs,type:vs},As="https://json-schema.org/draft/2020-12/schema",xs="https://lightspeedhq.com/page.schema.json",Ls="Homepage",Ns="Homepage enclosing the necessary custom and default blocks",ks="object",Rs={sections:{description:"List of sections contained by this page",type:"array",items:{type:"object",properties:{type:{description:"Type of the section",type:"string",enum:["custom","default"]}},allOf:[{if:{properties:{type:{const:"custom"}}},then:{$ref:"../template-custom.schema.json#/$defs/custom-section"}},{if:{properties:{type:{const:"default"}}},then:{$ref:"../template-default.schema.json#/$defs/default-section"}},{not:{properties:{id:{enum:["header","footer"]}},required:["id"]}}]},minItems:1,uniqueItems:!1}},Fs=!1,qs=["sections"],Wr={$schema:As,$id:xs,title:Ls,description:Ns,type:ks,properties:Rs,additionalProperties:Fs,required:qs},Jr={__proto__:null,$id:xs,$schema:As,additionalProperties:Fs,default:Wr,description:Ns,properties:Rs,required:qs,title:Ls,type:ks},Gs="https://json-schema.org/draft/2020-12/schema",Bs="https://lightspeedhq.com/page.schema.json",Ms="Custom Page",Us="A custom page enclosing the necessary custom and default blocks",zs="object",Xs={sections:{description:"List of sections contained by this page",type:"array",minItems:1,maxItems:1,uniqueItems:!1,contains:{type:"object",properties:{type:{const:"store"}},required:["type"]},items:{type:"object",required:["type"],allOf:[{if:{properties:{type:{const:"store"}}},then:{$ref:"./store-section.schema.json"},else:{properties:{type:{description:"Type of the section",type:"string"},id:{description:"Unique identifier for the section",type:"string"}},required:["type","id"]}}]}}},Hs=!1,Ks=["sections"],Zr={$schema:Gs,$id:Bs,title:Ms,description:Us,type:zs,properties:Xs,additionalProperties:Hs,required:Ks},Oe={__proto__:null,$id:Bs,$schema:Gs,additionalProperties:Hs,default:Zr,description:Us,properties:Xs,required:Ks,title:Ms,type:zs},Vs="https://json-schema.org/draft/2020-12/schema",Ys="https://lightspeedhq.com/store-section.schema.json",Ws="Store Section",Js="Store section for a custom page",Zs="object",Qs=[{type:"object",properties:{type:{description:"Type of the section",type:"string",const:"store"},id:{description:"Layout identifier of the section. When not provided, the section will use the default layout.",type:"string"}},required:["type"],additionalProperties:!1}],Qr={$schema:Vs,$id:Ys,title:Ws,description:Js,type:Zs,allOf:Qs},ea={__proto__:null,$id:Ys,$schema:Vs,allOf:Qs,default:Qr,description:Js,title:Ws,type:Zs};function ta(e){switch(e){case I.PRODUCT:return"product";case I.CATALOG:return"catalog";case I.CATEGORY:return"category";default:return null}}const oa=[jo,yt,St,Ko,Rt,Dt,ea,Yr,es],sa=e=>{const t=[],o={},s=(n,i,r,a)=>{if(!n){o[e.name]||(o[e.name]=[]),o[e.name].push({instancePath:`/templates/${e.name}/${i}`,message:`Missing file: ${i}`,keyword:"required"});return}t.push({templateName:e.name,source:n,dist:g.resolve(`dist/templates/${e.name}/${i}`),ajv:B(oa,r),templatePageType:a})};return s(e.catalogEntrypoint,"catalog",Oe,I.CATALOG),s(e.productEntrypoint,"product",Oe,I.PRODUCT),s(e.homeEntrypoint,"home",Jr,I.HOME),s(e.categoryEntrypoint,"category",Oe,I.CATEGORY),s(e.configurationEntrypoint,"configuration",Kr,I.CUSTOM),[t,o]};function na({section:e,context:t,normalizedPaths:o}){const s=ta(t.templatePageType);if(s===null)return{instancePath:`/sections/${e.id}/id`,message:`Source folder not found for template page type "${t.templatePageType}".`,keyword:"source_folder_not_found"};const n=`${s}/${e.id}`;return o.some(i=>i.startsWith(n))?null:{instancePath:`/sections/${e.id}/id`,message:`Source layout for section "${e.id}" not found in "layouts/${s}/${e.id}".`,keyword:"layout_not_found"}}function ia(e){const{type:t,id:o}=e;return t==="store"&&o!==void 0&&o!==""}async function ra({content:e,context:t,layoutBuildConfigs:o}){const s=o.map(n=>je(n.clientEntrypoint));return e.sections.filter(ia).map(n=>na({section:n,context:t,normalizedPaths:s})).filter(n=>n!==null)}function aa(e){return"sections"in e}async function ca(e,t){const o=await k(e.dist,!0),s={},n=[];if(e.ajv(o)?Ue(`${e.dist}${N}.mjs`,`${e.dist}.mjs`,()=>{}):(n.push(...he(e.ajv.errors??[])),ze(`${e.dist}${N}.mjs`,()=>{})),aa(o)&&t!==void 0){const i=await ra({content:o,context:e,layoutBuildConfigs:t});n.push(...i)}return n.length>0&&(s[e.source]=n),s}const la=async(e,t)=>{const[o,s]=sa(e);return(await Promise.all(o.map(n=>ca(n,t)))).reduce((n,i)=>(Object.entries(i).forEach(([r,a])=>{n[r]=n[r]?[...n[r],...a]:[...a]}),n),{...s})};async function pa(e,t,o,s=j){if(t.showcase_overrides?.content!==void 0)if(!$(`${s}/${t.id}/js/settings/content.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/content`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.content).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function da(e,t,o,s=j){if(t.showcase_overrides?.design!==void 0)if(!$(`${s}/${t.id}/js/settings/design.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/design`,!1),i=new Set(Object.keys(n));Object.keys(t.showcase_overrides.design).every(r=>i.has(r))||e.push({instancePath:`/sections/${o}/showcase_overrides/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}}async function ua(e,t,o,s=j){if(t.showcase_overrides?.layoutId!==void 0)if(!$(`${s}/${t.id}/js/settings/layout.mjs`))e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor is set, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const n=await k(`${s}/${t.id}/js/settings/layout`,!1);new Set(n.map(i=>i.layoutId)).has(t.showcase_overrides.layoutId)||e.push({instancePath:`/sections/${o}/showcase_overrides/layout`,message:"Layout id descriptor must be a valid id in the default layout descriptor",keyword:"type"})}}async function Ie(e,t,o,s=j){t.showcase_overrides!==void 0&&(await pa(e,t,o,s),await da(e,t,o,s),await ua(e,t,o,s))}function De(e,t,o,s=j){t.showcase_id!==void 0&&($(`${s}/${t.id}/js/showcases/${t.showcase_id}.mjs`)||e.push({instancePath:`/sections/${o}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}async function fa(e,t){const o=t.id==="header"&&t.type==="default",s=$(`${J}/${t.id}`);!o&&!s&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),s&&(await Ie(e,t,0,J),De(e,t,0,J))}async function ma(e,t,o){const s=t.id==="footer"&&t.type==="default",n=$(`${Z}/${t.id}`);!s&&!n&&e.push({instancePath:`/sections/${o}/id`,message:"The last section must be a `footer`",keyword:"required"}),n&&(await Ie(e,t,o,Z),De(e,t,o,Z))}async function ha(e,t){t.showcase_overrides&&e.push(...ns(`sections/${t.id}`,t.showcase_overrides))}async function ya(e){const t=await e.sections.reduce(async(o,s,n)=>{const i=await o;return n===0?await fa(i,s):n===e.sections.length-1?await ma(i,s,e.sections.length-1):s.type==="custom"?$(`${j}/${s.id}`)?(await Ie(i,s,n),De(i,s,n),await ha(i,s)):i.push({instancePath:`/sections/${n}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):s.type==="default"&&(s.id==="header"&&i.push({instancePath:`/sections/${n}/id`,message:"Header can only be placed as the first section",keyword:"required"}),s.id==="footer"&&i.push({instancePath:`/sections/${n}/id`,message:"Footer can only be placed as the last section",keyword:"required"})),i},Promise.resolve([]));return t.length>0?t:void 0}async function ga(){const e=await f("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(p.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const o=t.split(Be),s=o.pop()??"default";if(o.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const n=await f(`**/${s}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await f(`**/${s}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await f(`**/${s}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await f(`**/${s}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await f(`**/${s}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]});return{name:s,configurationEntrypoint:n.at(0),homeEntrypoint:i.at(0),categoryEntrypoint:r.at(0),catalogEntrypoint:a.at(0),productEntrypoint:c.at(0)}}))}async function $a(){const e=await f("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await f("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await ga(),templates:e,assets:t}}async function ba(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=or();return await Promise.all([_({entryPoints:e.assets,configType:y.TemplateAsset}),_({entryPoints:e.templates,configType:y.TemplateDescriptor})]),e.templates.reduce(async(o,s)=>{const n=await o,i=`${P}/js/${K(s).name}`,r=await k(i,!0);return{...n,...pr(t,r,i,await ya(r))}},Promise.resolve({}))}async function wa({templateBuildConfig:e,layoutBuildConfigs:t}){return e.pageTemplates?.reduce(async(o,s)=>{const n=await o,i=[s.configurationEntrypoint,s.homeEntrypoint,s.categoryEntrypoint,s.catalogEntrypoint,s.productEntrypoint].filter(me);if(i.length===0)throw new Error("No entry points provided for page template");return await _({entryPoints:i,configType:y.PageTemplateDescriptor,name:s.name}),{...n,...await la(s,t)}},Promise.resolve({}))??{}}async function Ea(e){const t=await $a(),o=await Promise.all([ba(t),wa({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!ct(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function Ta(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(me).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(me),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(me),assetEntryPoints:e.assetsEntrypoints??[]}}function Sa(e){return Object.entries(w).find(t=>t[1].source===e)?.[0]}async function ja(){const e=await f("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const o=Ge(t).split(Be),s=o.pop()??"default",n=o.pop();if(n===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const i=await f(`**/${s}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await f(`**/${s}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await f(`**/${s}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await f(`**/${s}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await f(`**/${s}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),d=await f(`**/${s}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${s}/showcases/translations.{js,ts}`]}),E=await f(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),L=await f(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:Sa(n),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:c.at(0),settingsTranslationsEntrypoint:l.at(0),showcasesEntrypoints:d,showcasesTranslationsEntrypoint:E.at(0),assetsEntrypoints:L}}))}function _a(){return Promise.all([$e.rm("dist",{recursive:!0,force:!0}),$e.rm("source-code",{recursive:!0,force:!0}),$e.rm("source-code.zip",{force:!0})])}async function Ca(){const e=new bn,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],o=await f("**/*",{cwd:u(process.cwd()),ignore:t,dot:!0,nodir:!0});try{o.forEach(i=>{const r=u(process.cwd(),i);e.addLocalFile(r,K(i).dir)});const s=te[m.SourceCode].fileName,n=u(process.cwd(),s);await e.writeZipPromise(n)}catch(s){throw p.error("Error while zipping source files"),s}}async function Pe(e=!1){await _a();try{const[t,o,s]=await Promise.all([Nr(),ja(),Ur()]),n=o.map(Ta);await qr();const i={...await dr(),...await Gr(n),...await Ea(t)};Object.keys(i).length===0?(await Promise.all([Xr(s),Rr(t),Ca()]),p.info(`Build successful:
14
13
  For preview run: npx @lightspeed/crane@latest preview
15
- For deploy run: npx @lightspeed/crane@latest deploy`)):(p.error("Error during build:"),pr(i))}catch(t){p.error(`Error while building: ${t.message}`),e||process.exit(1)}}async function _({entryPoints:e,configType:t,name:o,sectionType:s,sectionId:n,layoutId:i}){if(e.length!==0){const r=Ve(ys({name:o,entryPoints:e,configType:t,sectionType:s,sectionId:n,layoutId:i}));await Y({configFile:!1,...r})}}async function on(e){await new Promise(t=>setTimeout(t,e))}function ye({deploymentContext:e,sectionType:t=S.SECTION}){const o=e.pathContext,s=o.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),n=s===void 0?Ke(o.fileName):Ke(o.fileName,{cwd:u(process.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(i=>({url:i,sectionType:t,context:e}))}const xa=e=>e.app.sections.flatMap(t=>pi.flatMap(o=>{const s={config:e,currentSection:t.id,pathContext:te[o]};return ye({deploymentContext:s,sectionType:t.type})})),La=e=>fi.flatMap(t=>{const o={config:e,pathContext:te[t]};return ye({deploymentContext:o})}),Na=e=>e.app.layouts.flatMap(t=>di.flatMap(o=>{const s={config:e,pathContext:te[o],currentSection:t.sectionId,layoutId:t.id};return ye({deploymentContext:s})})),ka=e=>e.app.slots.flatMap(t=>ui.flatMap(o=>{const s={config:e,pathContext:te[o],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return ye({deploymentContext:s})})),Ra=e=>`\x1B[32m${e}\x1B[0m`,Fa=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:i}=e,r=(Date.now()-n)/1e3;o.value+=i-s.value,s.value=i,t.update({speed:`${se(o.value/r,2)}/s`})},qa=()=>new Un.SingleBar({format:`|${Ra("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function Ne(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],i=t[s];return ot(n)&&ot(i)?o[s]=Ne(n,i):o[s]=n,o},{...t})}function Ga({contentSettings:e,sectionType:t}){const o=ss(t);return Ne(e,o)}function Ba({designSettings:e,sectionType:t}){const o=ns(t);return Ne(e,o)}async function Ma(e,t,o=j){try{const s=u(x.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await M(s),i=ie(e),r=Ga({contentSettings:n,sectionType:i});return X(r,t),r}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Ua(e,t,o=j){try{const s=u(x.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await M(s),i=ie(e),r=Ba({designSettings:n,sectionType:i});return lt(r),X(r,t),r}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function za(e,t,o=j){try{const s=await f("*.mjs",{cwd:u(x.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const i=u(x.cwd(),`${o}/${e}/js/showcases/${n}`),r=await M(i);return pt(r.design),X(r,t),r}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Xa(e,t=j){try{const o=u(x.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!$(o))return[];const s=await M(o);return s.forEach(n=>vi(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Ha(e,t=j){return Ce(`${t}/${e}/js/settings/translations.mjs`)}async function sn(e,t=j){return Ce(`${t}/${e}/js/showcases/translations.mjs`)}function Ka(e){let t={};const o=u(x.cwd(),`${Qe}/shared/analytics.json`);if(!$(o))return 0;try{const s=wn(o,"utf-8");t=JSON.parse(s)}catch(s){console.warn("Error processing analytics.json file",s)}return t[e]||0}function Va(){try{const e=u(x.cwd(),`${Qe}/shared/analytics.json`);$(e)&&Xe(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}async function ke(e,t){const o=await Ha(e,w[t].dist),s=await sn(e,w[t].dist),n=await Ma(e,o,w[t].dist),i=await Ua(e,o,w[t].dist),r=await za(e,s,w[t].dist),a=await Xa(e,w[t].dist),c=Ka(e);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:i,layouts:a,showcases:r,previewCount:c}}async function Ya(){const e=await f("*/",{cwd:u(x.cwd(),`${j}/`)}),t=await f("*/",{cwd:u(x.cwd(),`${W}/`)}),o=await f("*/",{cwd:u(x.cwd(),`${J}/`)});return Promise.all([...e.map(async s=>ke(s,S.SECTION)),...t.map(async s=>ke(s,S.HEADER)),...o.map(async s=>ke(s,S.FOOTER))])}async function Re(e){if(!e||e.type!=="custom")return;const t=ie(e.id),o=await sn(e.id,w[t].dist);e.showcase_overrides!==void 0&&(X(e.showcase_overrides,o),e.showcase_overrides.design&&pt(e.showcase_overrides.design))}async function nn(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>Re(o)))}async function Fe(e){try{return await M(u(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Wa(e){const t=await f(`${D}/js/**.mjs`,{ignore:[`${D}/js/**${N}.mjs`]});return Promise.all(t.map(async o=>{const s=await Fe(o);return await nn(s.sections),{id:`${e}_${K(o).name}`,descriptor:s}}))}function Ja(e){return e in I?I[e]:I.CUSTOM}async function Za(e){const t=await f(`${D}/${e}/*.mjs`,{ignore:[`${D}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await Fe(o),n=Yn(o);return await nn(s),{sections:s,id:n,type:Ja(n.toUpperCase())}}))}async function Qa(e){const t=await f(`${D}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await Fe(o);await Re(s.header),await Re(s.footer);const n=g.basename(g.dirname(o)),i=await Za(n);return{id:`${e}_${n}`,descriptor:{...s,pages:i}}}))}async function ec(e){return[...await Wa(e),...await Qa(e)]}const tc={value:0},O=qa();let rn=Date.now();const an=e=>2**e*500;async function oc(){const e=await Ze(u(q.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function sc(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function nc(){const e=u(q.cwd(),"package.json"),t=await Ze(e),o=JSON.parse(t.toString());if(sc(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function ic(e){const t=Mn(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,Xe(u(q.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
16
- `)}function rc(e){return e instanceof Je&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function cn(e,t){return e<li&&rc(t)}async function ln(e,t,o,s){const n={value:0},i=e.config.app.templates.length>0?ii:ni;return e.config.axios.post(i,{file:En(u(q.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.layoutId!==void 0&&{layoutId:e.layoutId},...e.slotId!==void 0&&{slotId:e.slotId},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:r=>Fa(r,O,tc,n,rn)}).then(r=>(O.increment(),r)).catch(async r=>{if(cn(s,r))return await on(an(s)),ln(e,t,o,s+1);throw O.increment(),r})}function ac(e){return O.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath({sectionId:o.currentSection,sectionType:t.sectionType,layoutId:o.layoutId,slotId:o.slotId});return ln(o,t.url,s,0)})}function cc(e){const t=[...xa(e),...La(e),...Na(e),...ka(e)];return ac(t)}function lc(e){return e.includes(`
17
- `)}function pc(e,t,o){return e.split(`
14
+ For deploy run: npx @lightspeed/crane@latest deploy`)):(p.error("Error during build:"),nr(i))}catch(t){p.error(`Error while building: ${t.message}`),e||process.exit(1)}}async function _({entryPoints:e,configType:t,name:o,sectionType:s,sectionId:n,layoutId:i}){if(e.length!==0){const r=Ke(ms({name:o,entryPoints:e,configType:t,sectionType:s,sectionId:n,layoutId:i}));await Y({configFile:!1,...r})}}function en(e,t){ue.statSync(e).isDirectory()?(ue.mkdirSync(t,{recursive:!0}),ue.readdirSync(e).forEach(o=>{const s=de.resolve(e,o),n=de.resolve(t,o);en(s,n)})):ue.copyFileSync(e,t)}function M(e,t,o,s){const n=de.join(e,s?.[o]??o);en(de.join(t,o),n)}function va(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>p.info(`Template [${e}] with pages structure named has been created`)}}function U(e){return F.resolve(qn(import.meta.url),"../..",e)}function Oa(){const e=U("package.json");return e!==""?JSON.parse(b.readFileSync(e,"utf8")):{}}async function Ia(e){try{const t=e,o=S.cwd(),s=F.join(o,t),n=["templates","headers","preview","footers","reference","page-templates","layouts"],i={_gitignore:".gitignore"};b.existsSync(s)?(p.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),S.exit(1)):b.mkdirSync(s);const r=U("template");b.readdirSync(r).filter(d=>d!=="package.json").filter(d=>!n.includes(d)).forEach(async d=>M(s,r,d,i));const a=JSON.parse(b.readFileSync(F.join(r,"package.json"),"utf-8"));a.name=e;const c=Oa();c.version&&(a.dependencies["@lightspeed/crane-api"]=c.dependencies["@lightspeed/crane-api"]),c.dependencies["@lightspeed/eslint-config-crane"]&&(a.dependencies["@lightspeed/eslint-config-crane"]=c.dependencies["@lightspeed/eslint-config-crane"]);const l=F.join(s,"package.json");b.writeFileSync(l,`${JSON.stringify(a,null,2)}
15
+ `),p.info(`App ${e} created`)}catch(t){p.error(`Error while creating app: ${t.message}`),S.exit(1)}}function Ae(e,t,o,s){try{const n=S.cwd(),i=g.join(n,t);h.existsSync(i)||h.mkdirSync(i);const r=g.join(n,t,o);h.existsSync(r)?(p.error(`${s} with the name: ${o} already exists. If you'd like to override it, delete previous version first`),S.exit(1)):h.mkdirSync(r);const a=U(e);h.readdirSync(a).forEach(async c=>M(r,a,c)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),S.exit(1)}}function xe(e){const t=S.cwd(),o=U(`template/${e}`),s=g.join(t,e);h.existsSync(s)||(h.mkdirSync(s),h.readdirSync(o).forEach(async n=>M(s,o,n)))}function Da(e,t,o){if(!h.existsSync(o)){h.copyFileSync(t,o);return}const s=h.readFileSync(t),n=h.readFileSync(o);s.equals(n)||p.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function tn(e,t){const o=h.readdirSync(e,{withFileTypes:!0});h.existsSync(t)||h.mkdirSync(t,{recursive:!0}),o.forEach(s=>{const n=g.join(e,s.name),i=g.join(t,s.name);s.isDirectory()?tn(n,i):Da(s,n,i)})}function Le(){try{const e=S.cwd(),t=g.join(e,"shared"),o=U("template/shared");if(!h.existsSync(o))return;tn(o,t)}catch(e){p.error(`Error while processing shared folder: ${e.message}`),S.exit(1)}}async function Pa(e){Le(),Ae("template/sections/example-section","sections",e,"Section")}async function Aa(e){Le(),Ae("template/footers/example-footer","footers",e,"Footer")}async function xa(e){Le(),Ae("template/headers/example-header","headers",e,"Header")}async function La(){try{const e=S.cwd(),t=U("template/reference"),o=b.readdirSync(t);let s=!1;for(const n of o){const i=F.join(t,n),r=F.join(e,n);b.existsSync(r)||b.mkdirSync(r,{recursive:!0});const a=b.readdirSync(i),c=b.readdirSync(r);if(n==="shared"){a.forEach(l=>{M(r,i,l)});continue}for(const l of a){if(l==="assets"){M(r,i,l);continue}if(c.includes(l)){const{name:d}=await Me({type:"text",name:"name",message:`The "${l}" already exists in ${n} directory: provide a new name to keep both or press Esc to skip this one.`});d?(M(r,i,l,{[l]:d}),s=!0):p.info(`Skipped: ${l}`)}else M(r,i,l)}}p.info("Reference templates have been added to the app"),s&&p.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){p.error(`Error while creating template descriptors: ${e.message}`),S.exit(1)}}async function Na(e){const{targetPath:t,renameFiles:o,sourcePath:s,onTemplateCreated:n}=va(e);try{const i=S.cwd(),r=F.join(i,"templates"),a=U(s),c=b.readdirSync(a);b.existsSync(r)?b.existsSync(F.join(r,t))&&(p.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),S.exit(1)):b.mkdirSync(r),c.forEach(l=>M(r,a,l,o)),xe("headers"),xe("footers"),xe("layouts"),n()}catch(i){p.error(`Error while creating template descriptors: ${i.message}`),S.exit(1)}}function ye({deploymentContext:e,sectionType:t=T.SECTION}){const o=e.pathContext,s=o.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),n=s===void 0?He(o.fileName):He(o.fileName,{cwd:u(process.cwd(),s),ignore:o.ignore});return(o.isSingleton?n.splice(0):n).map(i=>({url:i,sectionType:t,context:e}))}const ka=e=>e.app.sections.flatMap(t=>Zn.flatMap(o=>{const s={config:e,currentSection:t.id,pathContext:te[o]};return ye({deploymentContext:s,sectionType:t.type})})),Ra=e=>ti.flatMap(t=>{const o={config:e,pathContext:te[t]};return ye({deploymentContext:o})}),Fa=e=>e.app.layouts.flatMap(t=>Qn.flatMap(o=>{const s={config:e,pathContext:te[o],currentSection:t.sectionId,layoutId:t.id};return ye({deploymentContext:s})})),qa=e=>e.app.slots.flatMap(t=>ei.flatMap(o=>{const s={config:e,pathContext:te[o],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return ye({deploymentContext:s})}));async function on(e){await new Promise(t=>setTimeout(t,e))}const Ga=e=>`\x1B[32m${e}\x1B[0m`,Ba=(e,t,o,s,n)=>{if(!e.total)return;const{loaded:i}=e,r=(Date.now()-n)/1e3;o.value+=i-s.value,s.value=i,t.update({speed:`${se(o.value/r,2)}/s`})},Ma=()=>new Un.SingleBar({format:`|${Ga("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});function Ne(e,t){return Object.keys(e).reduce((o,s)=>{const n=e[s],i=t[s];return at(n)&&at(i)?o[s]=Ne(n,i):o[s]=n,o},{...t})}function Ua({contentSettings:e,sectionType:t}){const o=ts(t);return Ne(e,o)}function za({designSettings:e,sectionType:t}){const o=os(t);return Ne(e,o)}async function Xa(e,t,o=j){try{const s=u(x.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await G(s),i=ie(e),r=Ua({contentSettings:n,sectionType:i});return X(r,t),r}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Ha(e,t,o=j){try{const s=u(x.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await G(s),i=ie(e),r=za({designSettings:n,sectionType:i});return ot(r),X(r,t),r}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function Ka(e,t,o=j){try{const s=await f("*.mjs",{cwd:u(x.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const i=u(x.cwd(),`${o}/${e}/js/showcases/${n}`),r=await G(i);return st(r.design),X(r,t),r}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Va(e,t=j){try{const o=u(x.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!$(o))return[];const s=await G(o);return s.forEach(n=>hi(n.selectedDesignSettings)),s}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Ya(e,t=j){return Se(`${t}/${e}/js/settings/translations.mjs`)}async function sn(e,t=j){return Se(`${t}/${e}/js/showcases/translations.mjs`)}function Wa(e){let t={};const o=u(x.cwd(),`${nt}/shared/analytics.json`);if(!$(o))return 0;try{const s=En(o,"utf-8");t=JSON.parse(s)}catch(s){console.warn("Error processing analytics.json file",s)}return t[e]||0}function Ja(){try{const e=u(x.cwd(),`${nt}/shared/analytics.json`);$(e)&&Xe(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}async function ke(e,t){const o=await Ya(e,w[t].dist),s=await sn(e,w[t].dist),n=await Xa(e,o,w[t].dist),i=await Ha(e,o,w[t].dist),r=await Ka(e,s,w[t].dist),a=await Va(e,w[t].dist),c=Wa(e);return{id:e,type:t,name:{en:e},contentEditors:n,designEditors:i,layouts:a,showcases:r,previewCount:c}}async function Za(){const e=await f("*/",{cwd:u(x.cwd(),`${j}/`)}),t=await f("*/",{cwd:u(x.cwd(),`${J}/`)}),o=await f("*/",{cwd:u(x.cwd(),`${Z}/`)});return Promise.all([...e.map(async s=>ke(s,T.SECTION)),...t.map(async s=>ke(s,T.HEADER)),...o.map(async s=>ke(s,T.FOOTER))])}async function Re(e){if(!e||e.type!=="custom")return;const t=ie(e.id),o=await sn(e.id,w[t].dist);e.showcase_overrides!==void 0&&(X(e.showcase_overrides,o),e.showcase_overrides.design&&st(e.showcase_overrides.design))}async function nn(e){const t=e.filter(o=>o.type==="custom");await Promise.all(t.map(o=>Re(o)))}async function Fe(e){try{return await G(u(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Qa(e){const t=await f(`${P}/js/**.mjs`,{ignore:[`${P}/js/**${N}.mjs`]});return Promise.all(t.map(async o=>{const s=await Fe(o);return await nn(s.sections),{id:`${e}_${K(o).name}`,descriptor:s}}))}function ec(e){return e in I?I[e]:I.CUSTOM}async function tc(e){const t=await f(`${P}/${e}/*.mjs`,{ignore:[`${P}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await Fe(o),n=Si(o);return await nn(s),{sections:s,id:n,type:ec(n.toUpperCase())}}))}async function oc(e){const t=await f(`${P}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await Fe(o);await Re(s.header),await Re(s.footer);const n=g.basename(g.dirname(o)),i=await tc(n);return{id:`${e}_${n}`,descriptor:{...s,pages:i}}}))}async function sc(e){return[...await Qa(e),...await oc(e)]}const nc={value:0},O=Ma();let rn=Date.now();const an=e=>2**e*500;async function ic(){const e=await Je(u(q.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function rc(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function ac(){const e=u(q.cwd(),"package.json"),t=await Je(e),o=JSON.parse(t.toString());if(rc(o))return o;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function cc(e){const t=Mn(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,Xe(u(q.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
16
+ `)}function lc(e){return e instanceof Ze&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function cn(e,t){return e<Jn&&lc(t)}async function ln(e,t,o,s){const n={value:0},i=e.config.app.templates.length>0?Kn:Hn;return e.config.axios.post(i,{file:Tn(u(q.cwd(),o!==void 0?o+t:t))},{params:{appClientId:e.config.app.crane.appClientId,type:e.pathContext.type,version:e.config.app.packageJson.version,...e.currentSection!==void 0&&{block:e.currentSection},...e.layoutId!==void 0&&{layoutId:e.layoutId},...e.slotId!==void 0&&{slotId:e.slotId},...!["dependencies","source_code"].includes(e.pathContext.type)&&{fileName:t}},headers:{"Content-Type":"multipart/form-data",Authorization:`Bearer ${e.config.app.crane.appSecretKey}`},onUploadProgress:r=>Ba(r,O,nc,n,rn)}).then(r=>(O.increment(),r)).catch(async r=>{if(cn(s,r))return await on(an(s)),ln(e,t,o,s+1);throw O.increment(),r})}function pc(e){return O.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const o=t.context,s=o.pathContext.toPath({sectionId:o.currentSection,sectionType:t.sectionType,layoutId:o.layoutId,slotId:o.slotId});return ln(o,t.url,s,0)})}function dc(e){const t=[...ka(e),...Ra(e),...Fa(e),...qa(e)];return pc(t)}function uc(e){return e.includes(`
17
+ `)}function fc(e,t,o){return e.split(`
18
18
  `).map((s,n)=>n>=o?t+s:s).join(`
19
- `)}function ce(e,t){const o=[];if(e instanceof Je){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const i=e.response?.data;if(i?.errorCode&&o.push(` Error Code: ${i.errorCode}`),i?.errorMessage){const r=lc(i.errorMessage)?pc(i.errorMessage," ",1):i.errorMessage;o.push(` Error Message: ${r}`)}}const s=o.length>0?o.join(`
19
+ `)}function ce(e,t){const o=[];if(e instanceof Ze){e.response?.status!==void 0&&o.push(` HTTP Status Code: ${e.response.status}`);const i=e.response?.data;if(i?.errorCode&&o.push(` Error Code: ${i.errorCode}`),i?.errorMessage){const r=uc(i.errorMessage)?fc(i.errorMessage," ",1):i.errorMessage;o.push(` Error Message: ${r}`)}}const s=o.length>0?o.join(`
20
20
  `):e?.message??"Unknown error";if(!t||t.length===0)return s;const n=o.length>0?`
21
- `:" ";return`${t}${n}${s}`}async function pn(e,t=0){const o=e.app.templates.length>0?ai:ri;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,layouts:e.app.layouts,slots:e.app.slots,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(cn(t,s))return await on(an(t)),pn(e,t+1);throw s})}async function dc(e){try{if(!Xn.some(r=>$(u(q.cwd(),r))))throw new Error(Q.INCORRECT_DISTRIBUTION_FOLDER(zn));const t=e??si;p.info("Custom application deployment :: Started");const o=Gn.create({baseURL:t});Bn(o,ci),p.info("Loading configuration files ...");const s=await Promise.all([oc(),nc(),Ya(),Ai(),Vr()]).then(async([r,a,c,l,d])=>({axios:o,app:{crane:r,packageJson:a,sections:c,layouts:l,slots:d,templates:await ec(r.appClientId)}}));p.info("Uploading files ..."),rn=Date.now(),await Promise.all(cc(s)).catch(r=>{O.stop(),r.response?.status===404?p.error(ce(r,Q.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,Q.ASSET_FILES_UPLOAD)),q.exit(1)}).finally(()=>{O.increment(),O.stop()}),O.update({speed:"N/A",status:"Finalising deployment"}),await pn(s).catch(r=>{O.stop(),r.response?.status===404?p.error(ce(r,Q.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,Q.MANIFEST_DEPLOYMENT)),q.exit(1)}).finally(()=>{O.increment(),O.stop()});const n=s.app.sections.map(r=>r.id),i=s.app.packageJson.version;p.info("Custom application deployment :: Successful"),p.info(`Current app version: ${i}`),p.info(`Deployed sections: ${n.sort().join(", ")}`),await ic(s.app.packageJson),s.app.templates.length>0&&p.info(`Deployed templates: ${s.app.templates.map(r=>r.id).sort().join(", ")}`),s.app.slots.length>0&&p.info(`Deployed slots: ${s.app.slots.map(r=>r.id).sort().join(", ")}`)}catch(t){O.stop(),p.error(ce(t,Q.DEFAULT)),q.exit(1)}finally{Va()}}const uc="1.4.2";async function fc(e){Te(),we("template/headers/example-header","headers",e,"Header")}async function mc(e){Te(),we("template/footers/example-footer","footers",e,"Footer")}const hc={deploy:["url"],init:[""],build:["generatePreview"]};function yc(e,t){return e.options.length!==0&&Object.keys(t).length===1}function gc(e){return e.includes("-h")||e.includes("--help")}function $c(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!hc[e.rawName]?.includes(o))}function bc(e){return e.length!==0}function wc(e,t,o){return e.matchedCommand!==void 0&&(yc(e.matchedCommand,o)||gc(e.rawArgs)||$c(e.matchedCommand,e.options)||bc(t))}function Ec(e,t,o){e.matchedCommand&&!wc(e,t,o)?e.runMatchedCommand():e.outputHelp()}async function Tc(e,t){const o=u(`${e}/ssr-server.ts`),s=u(t);await Y({build:{lib:{entry:o,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:s,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function Sc(e,t){const o=u(`${e}/shared/preview.ts`),s=u(`${e}/shared/utils.ts`),n=u(`${e}/shared/api-routes.ts`),i=u(t);await Y({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await Y({build:{lib:{entry:s,formats:["es"],fileName:()=>"utils.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await Y({build:{lib:{entry:n,formats:["es"],fileName:()=>"api-routes.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{external:["path","fs","http","https","url","stream","util","events","buffer"],output:{entryFileNames:"api-routes.js"}},target:"esnext"}})}async function jc(){const e="preview",t=`${e}/shared`,o="vite.config.js",s=`${e}/sections`,n=`${s}/preview.html`;[e,s].forEach(r=>{h.existsSync(r)||h.mkdirSync(r,{recursive:!0})});const i=B("template/preview");h.existsSync(`${e}/${o}`)||h.copyFileSync(`${i}/${o}`,`${e}/${o}`),await Tc(i,e),h.existsSync(n)||h.copyFileSync(`${i}/sections/preview.html`,n),h.existsSync(t)||(h.mkdirSync(t),await Sc(i,t))}function _c(){return{timeout:null,inProgress:!1,hasPending:!1}}function Cc(e,t){const o=async()=>{e.inProgress=!0;try{await Le(!0),t.ws.send({type:"full-reload",path:"*"})}catch(s){console.error("Build error:",s)}finally{e.inProgress=!1,e.hasPending&&(e.hasPending=!1,setTimeout(()=>o(),0))}};return async()=>{if(e.inProgress){e.hasPending=!0;return}await o()}}function vc(e){const t=e.replace(/\\/g,"/"),o=t.match(/sections\/([^/]+)/),s=t.match(/shared\/components/);return!!(o||s)}function Oc(e,t){return async o=>{vc(o)&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(async()=>{await t()},1e3))}}function Ic(e,t){const o=_c(),s=Cc(o,e),n=Oc(o,s);e.watcher.add(t),e.watcher.on("add",n),e.watcher.on("change",n),e.watcher.on("unlink",n)}async function Dc(){const e=g.resolve(process.cwd(),"preview/ssr-server.mjs");if(!h.existsSync(e))throw console.warn(`\u26A0\uFE0F SSR server not found at ${e}`),new Error(`SSR server not found at ${e}`);process.env.PREVIEW_SSR_PORT="0";const t=await import(e),{server:o,port:s}=await t.startServer();return{server:o,port:s}}async function Pc(){const e=g.resolve(process.cwd(),"preview/vite.config.js"),t=g.resolve(process.cwd(),"/sections/**/*"),o=g.resolve(process.cwd(),"/shared/components/*"),s=await _n({configFile:e,root:process.cwd()});return await s.listen(),Ic(s,[t,o]),s}async function Ac(){await Le(),await jc(),console.log(`
21
+ `:" ";return`${t}${n}${s}`}async function pn(e,t=0){const o=e.app.templates.length>0?Yn:Vn;return e.axios.post(o,{version:e.app.packageJson.version,name:"Custom Block App",blocks:e.app.sections,templates:e.app.templates,layouts:e.app.layouts,slots:e.app.slots,compressionEnabled:!0,externalizationEnabled:!0,vueVersion:e.app.packageJson.dependencies.vue},{params:{appClientId:e.app.crane.appClientId},headers:{Authorization:`Bearer ${e.app.crane.appSecretKey}`}}).catch(async s=>{if(cn(t,s))return await on(an(t)),pn(e,t+1);throw s})}async function mc(e){try{if(!bi.some(r=>$(u(q.cwd(),r))))throw new Error(W.INCORRECT_DISTRIBUTION_FOLDER($i));const t=e??Xn;p.info("Custom application deployment :: Started");const o=Gn.create({baseURL:t});Bn(o,Wn),p.info("Loading configuration files ...");const s=await Promise.all([ic(),ac(),Za(),Ci(),Mr()]).then(async([r,a,c,l,d])=>({axios:o,app:{crane:r,packageJson:a,sections:c,layouts:l,slots:d,templates:await sc(r.appClientId)}}));p.info("Uploading files ..."),rn=Date.now(),await Promise.all(dc(s)).catch(r=>{O.stop(),r.response?.status===404?p.error(ce(r,W.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,W.ASSET_FILES_UPLOAD)),q.exit(1)}).finally(()=>{O.increment(),O.stop()}),O.update({speed:"N/A",status:"Finalising deployment"}),await pn(s).catch(r=>{O.stop(),r.response?.status===404?p.error(ce(r,W.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,W.MANIFEST_DEPLOYMENT)),q.exit(1)}).finally(()=>{O.increment(),O.stop()});const n=s.app.sections.map(r=>r.id),i=s.app.packageJson.version;p.info("Custom application deployment :: Successful"),p.info(`Current app version: ${i}`),p.info(`Deployed sections: ${n.sort().join(", ")}`),await cc(s.app.packageJson),s.app.templates.length>0&&p.info(`Deployed templates: ${s.app.templates.map(r=>r.id).sort().join(", ")}`),s.app.slots.length>0&&p.info(`Deployed slots: ${s.app.slots.map(r=>r.id).sort().join(", ")}`)}catch(t){O.stop(),p.error(ce(t,W.DEFAULT)),q.exit(1)}finally{Ja()}}async function hc(e,t){const o=u(`${e}/ssr-server.ts`),s=u(t);await Y({build:{lib:{entry:o,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:s,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function yc(e,t){const o=u(`${e}/shared/preview.ts`),s=u(`${e}/shared/utils.ts`),n=u(`${e}/shared/api-routes.ts`),i=u(t);await Y({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await Y({build:{lib:{entry:s,formats:["es"],fileName:()=>"utils.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await Y({build:{lib:{entry:n,formats:["es"],fileName:()=>"api-routes.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{external:["path","fs","http","https","url","stream","util","events","buffer"],output:{entryFileNames:"api-routes.js"}},target:"esnext"}})}async function gc(){const e="preview",t=`${e}/shared`,o="vite.config.js",s=`${e}/sections`,n=`${s}/preview.html`;[e,s].forEach(r=>{h.existsSync(r)||h.mkdirSync(r,{recursive:!0})});const i=U("template/preview");h.existsSync(`${e}/${o}`)||h.copyFileSync(`${i}/${o}`,`${e}/${o}`),await hc(i,e),h.existsSync(n)||h.copyFileSync(`${i}/sections/preview.html`,n),h.existsSync(t)||(h.mkdirSync(t),await yc(i,t))}function $c(){return{timeout:null,inProgress:!1,hasPending:!1}}function bc(e,t){const o=async()=>{e.inProgress=!0;try{await Pe(!0),t.ws.send({type:"full-reload",path:"*"})}catch(s){console.error("Build error:",s)}finally{e.inProgress=!1,e.hasPending&&(e.hasPending=!1,setTimeout(()=>o(),0))}};return async()=>{if(e.inProgress){e.hasPending=!0;return}await o()}}function wc(e){const t=e.replace(/\\/g,"/"),o=t.match(/sections\/([^/]+)/),s=t.match(/shared\/components/);return!!(o||s)}function Ec(e,t){return async o=>{wc(o)&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(async()=>{await t()},1e3))}}function Tc(e,t){const o=$c(),s=bc(o,e),n=Ec(o,s);e.watcher.add(t),e.watcher.on("add",n),e.watcher.on("change",n),e.watcher.on("unlink",n)}async function Sc(){const e=g.resolve(process.cwd(),"preview/ssr-server.mjs");if(!h.existsSync(e))throw console.warn(`\u26A0\uFE0F SSR server not found at ${e}`),new Error(`SSR server not found at ${e}`);process.env.PREVIEW_SSR_PORT="0";const t=await import(e),{server:o,port:s}=await t.startServer();return{server:o,port:s}}async function jc(){const e=g.resolve(process.cwd(),"preview/vite.config.js"),t=g.resolve(process.cwd(),"/sections/**/*"),o=g.resolve(process.cwd(),"/shared/components/*"),s=await jn({configFile:e,root:process.cwd()});return await s.listen(),Tc(s,[t,o]),s}async function _c(){await Pe(),await gc(),console.log(`
22
22
  \u{1F4E6} Starting preview servers...
23
- `);let e=null,t=null;if(process.platform!=="win32"){const n=await Dc();e=n.server,t=n.port,process.env.PREVIEW_SSR_PORT=String(t)}const o=await Pc(),s=()=>{e&&e.close(),o.close(),process.exit(0)};return process.on("SIGINT",s),process.on("SIGTERM",s),o}function dn(e){if(Vn(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Kn(e);return o&&console.log(o),t}async function un(e,t,o,s){const n=(await Me({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(n===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(n);return dn(i)?s(i):un(e,t,o,s)}async function le(e,t,o,s,n){if(n!==void 0)if(!dn(n))await un(e,t,o,s);else{const i=g.basename(n.toString());await s(i)}}async function xc(e,t){try{const{app:o,section:s,header:n,footer:i,template:r,referenceTemplate:a}=e;await le(t,"app",V("init --app <name>"),Zn,o),await le(t,"section",V("init --section <name>"),ei,s),await le(t,"header",V("init --header <name>"),fc,n),await le(t,"footer",V("init --footer <name>"),mc,i),await le(t,"template",V("init --template <name>"),ti,r),a&&await oi()}catch(o){p.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function Lc(){try{const e=mn("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").allowUnknownOptions().action(async o=>xc(o,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>Le()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(async()=>Ac()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>dc(e.options.url)),e.version(uc),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});Ec(e,t.args,t.options)}catch(e){p.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Lc as run};
23
+ `);let e=null,t=null;if(process.platform!=="win32"){const n=await Sc();e=n.server,t=n.port,process.env.PREVIEW_SSR_PORT=String(t)}const o=await jc(),s=()=>{e&&e.close(),o.close(),process.exit(0)};return process.on("SIGINT",s),process.on("SIGTERM",s),o}const Cc={deploy:["url"],init:[""],build:["generatePreview"]};function vc(e,t){return e.options.length!==0&&Object.keys(t).length===1}function Oc(e){return e.includes("-h")||e.includes("--help")}function Ic(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Cc[e.rawName]?.includes(o))}function Dc(e){return e.length!==0}function Pc(e,t,o){return e.matchedCommand!==void 0&&(vc(e.matchedCommand,o)||Oc(e.rawArgs)||Ic(e.matchedCommand,e.options)||Dc(t))}function Ac(e,t,o){e.matchedCommand&&!Pc(e,t,o)?e.runMatchedCommand():e.outputHelp()}function dn(e){if(Ti(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Ei(e);return o&&console.log(o),t}async function un(e,t,o,s){const n=(await Me({type:"text",name:"name",message:`Please specify a name for your ${t}:`})).name;if(n===void 0)return console.log(`You can use ${o} to directly specify the name of the ${t}.`),e.outputHelp();const i=g.basename(n);return dn(i)?s(i):un(e,t,o,s)}async function le(e,t,o,s,n){if(n!==void 0)if(!dn(n))await un(e,t,o,s);else{const i=g.basename(n.toString());await s(i)}}async function xc(e,t){try{const{app:o,section:s,header:n,footer:i,template:r,referenceTemplate:a}=e;await le(t,"app",V("init --app <name>"),Ia,o),await le(t,"section",V("init --section <name>"),Pa,s),await le(t,"header",V("init --header <name>"),xa,n),await le(t,"footer",V("init --footer <name>"),Aa,i),await le(t,"template",V("init --template <name>"),Na,r),a&&await La()}catch(o){p.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function Lc(){try{const e=yn("crane");e.option("-h, --help","Display this message"),e.command("init","Initialize a new resource in the form of a directory.").option("--app [name]","Creates an app folder inside your current directory.").option("--section [name]","Creates the files necessary for one custom section with the given name, this can be repeated for each section.").option("--header [name]","Creates the files necessary for one custom header with the given name, this can be repeated for each header.").option("--footer [name]","Creates the files necessary for one custom footer with the given name, this can be repeated for each footer.").option("--template [name]","Creates the directory and files necessary to build a custom template inside your app folder.").option("--reference-template","Adds files necessary for the reference templates inside your app folder. ").allowUnknownOptions().action(async o=>xc(o,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>Pe()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(async()=>_c()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>mc(e.options.url)),e.version(zn),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});Ac(e,t.args,t.options)}catch(e){p.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Lc as run};