@lightspeed/crane 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,23 +1,39 @@
1
- import*as de from"path";import g,{resolve as u,parse as X,dirname as Be,relative as mn,basename as hn,sep as Me}from"path";import yn from"cac";import{red as gn,yellow as $n,green as K}from"kolorist";import qe from"prompts";import bn from"adm-zip";import*as ue from"fs";import h,{existsSync as $,statSync as En,rename as Ue,unlink as ze,promises as $e,writeFileSync as He,readFileSync as Tn,createReadStream as wn}from"fs";import{glob as f,globSync as Ve}from"glob";import{normalizePath as _n,defineConfig as Xe,build as W,createServer as Sn}from"vite";import{SectionTypeEnum as w,BackgroundStyleEnum as be,ButtonAppearanceEnum as Cn,ButtonSizeEnum as On,ButtonShapeEnum as jn,OverlayTypeEnum as fe,DesignEditorType as k,ValidationTypeEnum as z,PluginTypeEnum as O,ConfigTypeEnum as y,TemplatePageEnum as v}from"@lightspeed/crane-api";import{pathToFileURL as Ke}from"url";import In from"tinycolor2";import vn from"ajv/dist/2020.js";import An from"ajv-formats";import Ln from"node:zlib";import{promisify as Dn}from"node:util";import{JSONPath as Pn}from"jsonpath-plus";import{builtinModules as We}from"module";import{viteExternalsPlugin as Ye}from"vite-plugin-externals";import Rn from"vite-plugin-compression";import Nn from"@vitejs/plugin-vue";import xn from"vite-tsconfig-paths";import kn from"vite-plugin-checker";import{encode as Fn}from"@jridgewell/sourcemap-codec";import b from"node:fs";import F from"node:path";import _ from"node:process";import{fileURLToPath as Gn}from"node:url";import{readFile as Je}from"fs/promises";import*as G from"process";import P from"process";import Bn,{AxiosError as Ze}from"axios";import{ConcurrencyManager as Mn}from"axios-concurrency";import{inc as qn}from"semver";import Un from"cli-progress";const zn="2.0.2",E={[w.SECTION]:{source:"sections",dist:"dist/sections"},[w.HEADER]:{source:"headers",dist:"dist/headers"},[w.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 Hn="https://blockbuster.ecwid.com",Vn="/api/v1/custom-apps/resources/sections/upload",Xn="/api/v1/custom-apps/resources/templates/upload",Kn="/api/v1/custom-apps/manifests/sections",Wn="/api/v1/custom-apps/manifests/templates",Yn=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],Y={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 B(e){return(await import(Ke(e).href)).default}function Ee(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function A(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 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:A(e.color)}}function Te(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:A(o.at(0))},gradient:{fromColor:A(o.at(0)),toColor:A(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(Cn)}`)}}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(On)}`)}}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(jn)}`)}}function li(e){const t=ri(e.appearance),o=ai(e.size),s=ci(e.shape),n=Ee(e.font),i=A(e.color),r=e.visible;return Te({appearance:t,size:o,style:s,font:n,color:i,visible:r})}function pi(e){const t=A(e.color);return Te({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:A(o.at(0))},gradient:{fromColor:A(o.at(0)),toColor:A(o.at(1))}}}}function fi(e){const t=Ee(e.font),o=A(e.color),s=tt(e.size);return{font:t,color:o,size:s,frame:si(e.frame)}}function mi(e){const t=Ee(e.font),o=A(e.color),s=tt(e.size);return Te({font:t,color:o,size:s})}function we(e,t){if(t.defaults===void 0)return;let o={};switch(e){case k.TEXT:{o=mi(t.defaults);break}case k.BUTTON:{o=li(t.defaults);break}case k.IMAGE:{o=ui(t.defaults);break}case k.BACKGROUND:{o=ii(t.defaults);break}case k.COLOR_PICKER:{o=pi(t.defaults);break}case k.LOGO:{o=fi(t.defaults);break}case k.TOGGLE:case k.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=we(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=we(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=we(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 H(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"&&H(n,t)}}async function _e(e){const t=u(process.cwd(),e),o=await B(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(K(e))},N="_temp",$i="dist",S="dist/sections",J="dist/headers",Z="dist/footers",L="dist/templates",Q="layouts",nt="preview",j=`dist/${Q}`,bi=[S,J,Z,L,j],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 Ei="Resource name can only contain alphanumeric characters, dashes, and underscores";function Ti(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:Ei}}function wi(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function x(e,t){try{const o=u(process.cwd(),t?`${e}${N}.mjs`:`${e}.mjs`),s=`?timestamp=${Date.now()}`;return(await import(Ke(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 _i(e){return g.parse(e).name}function Si(e){return e.replace(/\\/g,"/")}function Ci(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Se(e){return Ci(Si(e))}function lt(e){const t=Se(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 Oi(){const e=`${j}/{product,catalog,category}/*`;return(await f(e,{ignore:["node_modules/**"]})).map(lt)}async function ji(e){return _e(`${j}/${e.sectionId}/${e.layoutId}/js/settings/translations.mjs`)}async function Ii(e){try{const t=u(process.cwd(),`${j}/${e.sectionId}/${e.layoutId}/js/settings/content.mjs`),o=await B(t);return H(o,e.translations),o}catch(t){throw new Error(`Content descriptor for layout [${e.layoutId}] is either invalid or undefined: ${t}`)}}async function vi(e){try{const t=u(process.cwd(),`${j}/${e.sectionId}/${e.layoutId}/js/settings/design.mjs`),o=await B(t);return ot(o),H(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`${j}/${e}/${t}/${o.join("/")}`}const ne=(e=w.SECTION)=>E[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:()=>`${L}/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}},Ai={$schema:pt,$id:dt,title:ut,description:ft,type:mt,$defs:ht},yt={__proto__:null,$defs:ht,$id:dt,$schema:pt,default:Ai,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",Et="Custom section for a Custom Template",Tt="object",wt={"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}},Li={$schema:gt,$id:$t,title:bt,description:Et,type:Tt,$defs:wt},_t={__proto__:null,$defs:wt,$id:$t,$schema:gt,default:Li,description:Et,title:bt,type:Tt},St="https://json-schema.org/draft/2020-12/schema",Ct="https://lightspeedhq.com/template-custom-content.schema.json",Ot="Custom Section :: Content Configuration",jt="Content tab configuration of a Custom Section for a Custom Template",It="object",vt={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}},Di={$schema:St,$id:Ct,title:Ot,description:jt,type:It,$defs:vt},At={__proto__:null,$defs:vt,$id:Ct,$schema:St,default:Di,description:jt,title:Ot,type:It},Lt="https://json-schema.org/draft/2020-12/schema",Dt="https://lightspeedhq.com/template-custom-design.schema.json",Pt="Custom Section :: Design Configuration",Rt="Design tab configuration of a Custom Section for a Custom Template",Nt="object",xt={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}},Pi={$schema:Lt,$id:Dt,title:Pt,description:Rt,type:Nt,$defs:xt},kt={__proto__:null,$defs:xt,$id:Dt,$schema:Lt,default:Pi,description:Rt,title:Pt,type:Nt},Ft="https://json-schema.org/draft/2020-12/schema",Gt="https://lightspeedhq.com/section-content.schema.json",Bt="Custom Section - Content",Mt="The content of a custom section",qt="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"}}}},Ht=!1,Ri={$schema:Ft,$id:Gt,title:Bt,description:Mt,type:qt,patternProperties:Ut,$defs:zt,additionalProperties:Ht},Vt={__proto__:null,$defs:zt,$id:Gt,$schema:Ft,additionalProperties:Ht,default:Ri,description:Mt,patternProperties:Ut,title:Bt,type:qt},Xt="https://json-schema.org/draft/2020-12/schema",Kt="https://lightspeedhq.com/section-layout.schema.json",Wt="Section Layout Schema",Yt="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"},layoutIcon:{type:"string",description:"Icon identifier used in the layout selector",enum:["HEADER_LEFT","HEADER_CENTER_LOGO_BURGER","HEADER_CENTER_LOGO_COMPACT","HEADER_CENTER_LOGO_DETAILED","HEADER_LEFT_LOGO_BURGER","HEADER_LEFT_LOGO_COMPACT","HEADER_LEFT_LOGO_DETAILED","HEADER_LEFT_LOGO_SEARCH","HEADER_LEFT_LOGO_TEXT","TEXT_ONE_COLUMN","TEXT_TITLE_LEFT","TEXT_SUBTITLE_RIGHT","TEXT_TWO_COLUMNS","TEXT_CENTER","TEXT_DESCRIPTION_RIGHT","CTA_BANNER_LEFT","CTA_BANNER_RIGHT","CTA_BANNER_CENTER","CTA_BANNER_BOTTOM","CTA_PROMO_BAR_LEFT","CTA_PROMO_BAR_RIGHT","CTA_STORY_LEFT","CTA_STORY_RIGHT","CTA_FULLWIDTH_CENTER","CTA_FULLWIDTH_LEFT","COVER_FULLSCREEN_CENTER","COVER_FULLSCREEN_LEFT","COVER_FULLSCREEN_CENTER_LEFT","COVER_FULLSCREEN_RIGHT","COVER_FULLSCREEN_BOTTOM","COVER_FULLSCREEN_BOTTOM_RIGHT","COVER_FULLSCREEN_BOTTOM_LEFT","COVER_FULLSCREEN_TOP","COVER_SIDEBAR_RIGHT","COVER_SIDEBAR_LEFT","COVER_HALFSCREEN_LEFT","COVER_HALFSCREEN_CENTER","COVER_COLLAGE_BOTTOM","COVER_COLLAGE_LEFT","IMAGE_SUBTITLE_RIGHT","IMAGE_TITLE_LEFT","IMAGE_LEFT","IMAGE_RIGHT","IMAGE_CENTER","IMAGE_SIDE_TITLE","LOCATION_MAP_RIGHT","LOCATION_MAP_LEFT","LOCATION_IMAGE_RIGHT","LOCATION_IMAGE_LEFT","LOCATION_BACKGROUND_RIGHT","LOCATION_BACKGROUND_LEFT","LOCATION_FULL","LOCATION_SHORT","REVIEWS_MINIMAL","REVIEWS_CARDS","REVIEWS","REVIEWS_CLASSIC","REVIEWS_FULLSCREEN_BG","REVIEWS_FULLSCREEN_SIDEBAR_LEFT","REVIEWS_FULLSCREEN_SIDEBAR_RIGHT","REVIEWS_CARDS_PHOTO","REVIEWS_PHOTO_SPEECH_RIGHT","REVIEWS_PHOTO_SPEECH_LEFT","REVIEWS_SOCIAL_FEED","REVIEWS_ADAPTIVE","FEATURES_CLASSIC_CENTER","FEATURES_CLASSIC_LEFT","FEATURES_ACCORDION","FEATURES_MINIMAL","FEATURES_SMALL_ICONS","FEATURES_CAROUSEL","FEATURES_IMAGE_LEFT","FEATURES_IMAGE_RIGHT","ANNOUNCEMENT_CENTER","SLIDER_FULLSCREEN_CENTER","SLIDER_FULLSCREEN_LEFT"]},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:Xt,$id:Kt,title:Wt,description:Yt,type:Jt,items:Zt,$defs:Qt},eo={__proto__:null,$defs:Qt,$id:Kt,$schema:Xt,default:Ni,description:Yt,items:Zt,title:Wt,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,xi={$schema:to,$id:oo,title:so,description:no,type:io,patternProperties:ro,additionalProperties:ao},Ce={__proto__:null,$id:oo,$schema:to,additionalProperties:ao,default:xi,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:[]}},ki={$schema:co,$id:lo,title:po,description:uo,type:fo,patternProperties:mo,$defs:ho},yo={__proto__:null,$defs:ho,$id:lo,$schema:co,default:ki,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",Eo="The content of a custom section",To="object",wo={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,Fi={$schema:go,$id:$o,title:bo,description:Eo,type:To,$defs:wo,additionalProperties:_o},So={__proto__:null,$defs:wo,$id:$o,$schema:go,additionalProperties:_o,default:Fi,description:Eo,title:bo,type:To},Co="https://json-schema.org/draft/2020-12/schema",Oo="https://lightspeedhq.com/section-showcase.schema.json",jo="Custom Section - Showcase settings",Io="The setting of a showcase",vo="object",Ao=["showcaseId","previewImage"],Lo=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],Gi={$schema:Co,$id:Oo,title:jo,description:Io,type:vo,required:Ao,allOf:Lo},Do={__proto__:null,$id:Oo,$schema:Co,allOf:Lo,default:Gi,description:Io,required:Ao,title:jo,type:vo},Po="https://json-schema.org/draft/2020-12/schema",Ro="https://lightspeedhq.com/template.schema.json",No="Custom Template",xo="A custom template enclosing the necessary custom and default blocks",ko="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},categories:{description:"List of template categories for Template Market filtering",type:"array",items:{type:"string",enum:["apparel_footwear","vape_smoke","home_garden","sport_outdoor","jewelry_accessories","pet_animals","bikes","health_beauty","gift_shop","electronics","other"]},uniqueItems:!0}},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}},Go=["metadata","sections"],Bi={$schema:Po,$id:Ro,title:No,description:xo,type:ko,properties:Fo,required:Go},Bo={__proto__:null,$id:Ro,$schema:Po,default:Bi,description:xo,properties:Fo,required:Go,title:No,type:ko},Mo="https://json-schema.org/draft/2020-12/schema",qo="https://lightspeedhq.com/showcase_overrides.schema.json",Uo="Showcase overrides",zo="Overrides for the showcase",Ho="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"}},Mi={$schema:Mo,$id:qo,title:Uo,description:zo,type:Ho,properties:Vo},Xo={__proto__:null,$id:qo,$schema:Mo,default:Mi,description:zo,properties:Vo,title:Uo,type:Ho},Ko="https://json-schema.org/draft/2020-12/schema",Wo="https://lightspeedhq.com/common.schema.json",Yo="Common Type Definitions",Jo="Common type definitions, used throughout other schemas",Zo="object",Qo={label_type:{type:"string",pattern:"^\\$.+"}},qi={$schema:Ko,$id:Wo,title:Yo,description:Jo,type:Zo,$defs:Qo},es={__proto__:null,$defs:Qo,$id:Wo,$schema:Ko,default:qi,description:Jo,title:Yo,type:Zo};function ie(e){return $(`${J}/${e}`)?w.HEADER:$(`${Z}/${e}`)?w.FOOTER:w.SECTION}function Oe(e){const t=ie(e);return E[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 w.HEADER:return Ui;default:return{}}}function os(e){switch(e){case w.HEADER:return zi;default:return{}}}function Hi({validationType:e,sectionType:t}){switch(e){case z.CONTENT:return ts(t);case z.DESIGN:return os(t);default:return{}}}function Vi({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 Xi({type:e,mandatorySettings:t}){return Object.keys(t).find(o=>t[o].type===e)}function Ki({sectionSettings:e,mandatorySettings:t}){const o=[];return Object.entries(e).forEach(([s,n])=>{const i=Xi({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 Wi({type:e,mandatorySettings:t}){return Object.keys(t).findLast(o=>t[o].type===e)}function Yi({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=Wi({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=Hi({validationType:e,sectionType:s});return n===void 0||ct(n)?[]:[...Vi({sectionSettings:o,mandatorySettings:n}),...Ki({sectionSettings:o,mandatorySettings:n}),...Yi({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:T}of c)ss(l,d,t,T,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 x(s,!1),i=[];return er(t,n,"",i),i}const V=[So,yo,Vt,eo,Do,Bo,yt,_t,At,kt,Xo,es];function M(e,t){const o=new vn({allErrors:!0,schemas:e});return An(o),o.getSchema(t.$id)||o.compile(t)}function or(){return M(V,Bo)}function he(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const sr=e=>(()=>{const t=Oe(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:M(V,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:M(V,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:M(V,eo),sectionName:e.name,type:e.type}]:[],{source:`./${o}/${e.name}/settings/translations.ts`,dist:g.resolve(`${t}/${e.name}/js/settings/translations`),ajv:M(V,Ce),type:e.type},...e.showcaseEntryPoints.map(s=>({source:`./${o}/${e.name}/showcases/${X(s).name}.ts`,dist:g.resolve(`${t}/${e.name}/js/showcases/${X(s).name}`),ajv:M(V,s.indexOf("translations")===-1?Do:Ce),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 Pn({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=Oe(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 x(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 T=l[d],R=t[d];if(!R){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' is not defined in content.ts`,keyword:"invalid-showcase-element"});return}if(T.type!==R.type){o.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${d}`,message:`Element '${d}' type mismatch: showcase has type '${T.type}' but content.ts has type '${R.type}'`,keyword:"type-mismatch"});return}T.type==="DECK"&&R.type==="DECK"&&o.push(...rr(T,R,d,a.replace(".mjs","")))})}return o}async function cr(e){const t=await x(e.dist,!1),o={},s=[],n=Oe(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=Dn(Ln.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=En(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/${X(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 x(t,!1),n=M(V,Ce);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=[...We,...We.map(e=>`node:${e}`)],fr=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],cs=e=>({pluginType:O.Server,define:as,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...ur,...fr],inlineDynamicImports:!0,...e,outDir:e.outDir}),ls=e=>({pluginType:O.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:O.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),mr=e=>({pluginType:O.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),je=e=>({pluginType:O.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),hr=()=>Rn({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})}}),Er=()=>{const e=process.env.npm_lifecycle_event;return kn({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},D={VUE:Nn(),TS_CONFIG_PATHS:xn(),CHECKER:Er()};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 Tr(){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 wr=Tr();class _r{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,"+wr(this.toString())}}function Sr(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 Cr(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 Or=Object.prototype.toString;function jr(e){return Or.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 Ir=/\w/;class vr{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(`
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(`
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"?Ir.test(s[r])?c||(this.rawSegments.push(l),c=!0):(this.rawSegments.push(l),c=!1):this.rawSegments.push(l)}s[r]===`
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(`
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=`
8
- `,oe={insertLeft:!1,insertRight:!1,storeName:!1};class Ge{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 Ge(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 vr(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?Cr(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 _r(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=Sr(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(jr(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 T=d[0];T<d[1];T+=1)n[T]=!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]===`
9
- `));else for(a=c.start;a<l;){if(!n[a]){const d=this.original[a];d===`
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",Ar=e=>`import translation from '${e}';
11
- ${us};
12
- `,Lr=(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||!Lr(o,t))return null;const s=o.split("?")[0],n=Be(s),i=_n(mn(n,ds)),r=Ar(i),a=new Ge(t);return a.prepend(r),{code:a.toString()}}}},Dr={[O.Server]:[D.VUE,D.TS_CONFIG_PATHS,$r(),hr(),fs()],[O.Client]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,Ye({vue:"EcVue"}),fs()],[O.Misc]:[D.TS_CONFIG_PATHS,D.CHECKER],[O.Layout]:[D.VUE,D.TS_CONFIG_PATHS,D.CHECKER,Ye({vue:["EcExternals","Vue"]})],[O.Asset]:[br()],[O.SharedFiles]:[D.TS_CONFIG_PATHS]},Pr={[y.Server]:cs({outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/main/server`}),[y.Client]:ls({outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/main/client`}),[y.SectionSetting]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/settings`}),[y.SectionShowcase]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/js/showcases`}),[y.SectionAsset]:je({outDir:({name:e,sectionType:t})=>`./${E[t].dist}/${e}/assets`}),[y.TemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:()=>`./${L}/js`}),[y.PageTemplateDescriptor]:re({entryFileNames:`[name]${N}.mjs`,outDir:({name:e})=>`./${L}/${e}`}),[y.TemplateAsset]:je({outDir:()=>`./${L}/assets`}),[y.Layout]:mr({outDir:({name:e,sectionId:t})=>`./${j}/${t}/${e}`}),[y.LayoutSettings]:re({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${j}/${t}/${e}/js/settings`}),[y.LayoutAsset]:je({outDir:({name:e,sectionId:t})=>`./${j}/${t}/${e}/assets`}),[y.SlotServer]:cs({outDir:({name:e,layoutId:t,sectionId:o})=>`./${j}/${o}/${t}/slots/${e}/js/main/server`}),[y.SlotClient]:ls({outDir:({name:e,layoutId:t,sectionId:o})=>`./${j}/${o}/${t}/slots/${e}/js/main/client`}),[y.SharedTranslation]:{pluginType:O.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function Rr(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=w.SECTION}){const r=Pr[o],a=r.define,c=r.ssrOptions,l=r.entryFileNames,d=r.chunkFileNames,T=r.assetFileNames,R=r.inlineDynamicImports,fn=r.externalOption;return{plugins:Dr[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:Rr(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:R,entryFileNames:l,chunkFileNames:d,assetFileNames:T}}},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 xr(e){rs(e.assetsEntrypoints),await C({entryPoints:[e.clientEntrypoint],configType:y.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([C({entryPoints:e.settingsEntryPoints,configType:y.LayoutSettings,name:e.name,sectionId:e.sectionId}),C({entryPoints:e.assetsEntrypoints,configType:y.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function kr(e){e===void 0||e.length===0||await Promise.all(e.map(t=>xr(t)))}async function Fr(e){const t=Xe(ms({name:e.name,entryPoints:e.serverEntrypoint,configType:y.Server,sectionType:e.type}));return rs(e.assetEntryPoints),await W({configFile:!1,...t}),await is(m.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([C({entryPoints:e.clientEntrypoint,configType:y.Client,name:e.name,sectionType:e.type}),C({entryPoints:e.settingsEntryPoints,configType:y.SectionSetting,name:e.name,sectionType:e.type}),C({entryPoints:e.showcaseEntryPoints,configType:y.SectionShowcase,name:e.name,sectionType:e.type}),C({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 Gr(){const e=u(process.cwd(),"shared/translation.ts");$(e)&&await C({entryPoints:["shared/translation.ts"],configType:y.SharedTranslation})}async function Br(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=Se(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 Mr(e){const t=await ji(e),[o,s]=await Promise.all([Ii({...e,translations:t}),vi({...e,translations:t})]);return{...e,contentEditors:o,designEditors:s}}async function qr(){const e=`${j}/{product,catalog,category}/*/slots/*`,t=await f(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(hs).map(Mr))}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 C({entryPoints:[e.serverEntrypoint],configType:y.SlotServer,...t}),await is(m.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await C({entryPoints:[e.clientEntrypoint],configType:y.SlotClient,...t})}async function Hr(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",Es="object",Ts={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},categories:{description:"List of template categories for Template Market filtering",type:"array",items:{type:"string",enum:["apparel_footwear","vape_smoke","home_garden","sport_outdoor","jewelry_accessories","pet_animals","bikes","health_beauty","gift_shop","electronics","other"]},uniqueItems:!0}},required:["name","description","cover_image"],additionalProperties:!1},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},ws=["metadata","header","footer"],_s=!1,Vr={$schema:ys,$id:gs,title:$s,description:bs,type:Es,properties:Ts,required:ws,additionalProperties:_s},Xr={__proto__:null,$id:gs,$schema:ys,additionalProperties:_s,default:Vr,description:bs,properties:Ts,required:ws,title:$s,type:Es},Ss="https://json-schema.org/draft/2020-12/schema",Cs="https://lightspeedhq.com/header_footer.schema.json",Os="Header/Footer definition for a page template",js="object",Is=["type","id"],vs={type:{type:"string",enum:["custom","default"]},id:{type:"string"},showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},As=!1,Ls=[{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"}}}}],Kr={$schema:Ss,$id:Cs,title:Os,type:js,required:Is,properties:vs,additionalProperties:As,allOf:Ls},Wr={__proto__:null,$id:Cs,$schema:Ss,additionalProperties:As,allOf:Ls,default:Kr,properties:vs,required:Is,title:Os,type:js},Ds="https://json-schema.org/draft/2020-12/schema",Ps="https://lightspeedhq.com/page.schema.json",Rs="Homepage",Ns="Homepage enclosing the necessary custom and default blocks",xs="object",ks={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,Gs=["sections"],Yr={$schema:Ds,$id:Ps,title:Rs,description:Ns,type:xs,properties:ks,additionalProperties:Fs,required:Gs},Jr={__proto__:null,$id:Ps,$schema:Ds,additionalProperties:Fs,default:Yr,description:Ns,properties:ks,required:Gs,title:Rs,type:xs},Bs="https://json-schema.org/draft/2020-12/schema",Ms="https://lightspeedhq.com/page.schema.json",qs="Custom Page",Us="A custom page enclosing the necessary custom and default blocks",zs="object",Hs={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,Xs=["sections"],Zr={$schema:Bs,$id:Ms,title:qs,description:Us,type:zs,properties:Hs,additionalProperties:Vs,required:Xs},Ie={__proto__:null,$id:Ms,$schema:Bs,additionalProperties:Vs,default:Zr,description:Us,properties:Hs,required:Xs,title:qs,type:zs},Ks="https://json-schema.org/draft/2020-12/schema",Ws="https://lightspeedhq.com/store-section.schema.json",Ys="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:Ks,$id:Ws,title:Ys,description:Js,type:Zs,allOf:Qs},ea={__proto__:null,$id:Ws,$schema:Ks,allOf:Qs,default:Qr,description:Js,title:Ys,type:Zs};function ta(e){switch(e){case v.PRODUCT:return"product";case v.CATALOG:return"catalog";case v.CATEGORY:return"category";default:return null}}const oa=[So,yt,_t,Xo,kt,At,ea,Wr,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:M(oa,r),templatePageType:a})};return s(e.catalogEntrypoint,"catalog",Ie,v.CATALOG),s(e.productEntrypoint,"product",Ie,v.PRODUCT),s(e.homeEntrypoint,"home",Jr,v.HOME),s(e.categoryEntrypoint,"category",Ie,v.CATEGORY),s(e.configurationEntrypoint,"configuration",Xr,v.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=>Se(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 x(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=S){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 x(`${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=S){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 x(`${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=S){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 x(`${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 ve(e,t,o,s=S){t.showcase_overrides!==void 0&&(await pa(e,t,o,s),await da(e,t,o,s),await ua(e,t,o,s))}function Ae(e,t,o,s=S){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 ve(e,t,0,J),Ae(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 ve(e,t,o,Z),Ae(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"?$(`${S}/${s.id}`)?(await ve(i,s,n),Ae(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(Me),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([C({entryPoints:e.assets,configType:y.TemplateAsset}),C({entryPoints:e.templates,configType:y.TemplateDescriptor})]),e.templates.reduce(async(o,s)=>{const n=await o,i=`${L}/js/${X(s).name}`,r=await x(i,!0);return{...n,...pr(t,r,i,await ya(r))}},Promise.resolve({}))}async function Ea({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 C({entryPoints:i,configType:y.PageTemplateDescriptor,name:s.name}),{...n,...await la(s,t)}},Promise.resolve({}))??{}}async function Ta(e){const t=await $a(),o=await Promise.all([ba(t),Ea({templateBuildConfig:t,layoutBuildConfigs:e})]);return o.some(s=>!ct(s))?o.reduce((s,n)=>({...s,...n}),{}):{}}function wa(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 _a(e){return Object.entries(E).find(t=>t[1].source===e)?.[0]}async function Sa(){const e=await f("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const o=Be(t).split(Me),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}`]}),T=await f(`**/${s}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),R=await f(`**/${s}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:s,type:_a(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:T.at(0),assetsEntrypoints:R}}))}function Ca(){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 Oa(){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,X(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 Ca();try{const[t,o,s]=await Promise.all([Nr(),Sa(),Ur()]),n=o.map(wa);await Gr();const i={...await dr(),...await Br(n),...await Ta(t)};Object.keys(i).length===0?(await Promise.all([Hr(s),kr(t),Oa()]),p.info(`Build successful:
1
+ import*as ct from"fs";import V,{existsSync as re,statSync as ni,rename as pn,unlink as un,writeFileSync as fn,readFileSync as oi,promises as _t,createReadStream as si}from"fs";import*as Oe from"path";import W,{resolve as U,parse as He,dirname as dn,relative as ri,basename as ii,sep as hn}from"path";import ai from"cac";import{red as ci,yellow as li,green as Le}from"kolorist";import St from"prompts";import pi from"adm-zip";import{glob as z,globSync as mn}from"glob";import{normalizePath as ui,defineConfig as yn,build as qe,createServer as fi}from"vite";import{SectionTypeEnum as ue,ValidationTypeEnum as Me,PluginTypeEnum as Ee,ConfigTypeEnum as Y,BackgroundStyleEnum as Tt,ButtonAppearanceEnum as di,ButtonSizeEnum as hi,ButtonShapeEnum as mi,OverlayTypeEnum as lt,DesignEditorType as Pe,TemplatePageEnum as be,ReservedTemplatePageNameEnum as yi}from"@lightspeed/crane-api";import{pathToFileURL as gn,URL as gi}from"url";import $i from"ajv/dist/2020.js";import Ei from"ajv-formats";import bi from"node:zlib";import{promisify as _i}from"node:util";import{JSONPath as Si}from"jsonpath-plus";import{builtinModules as $n}from"module";import{viteExternalsPlugin as En}from"vite-plugin-externals";import Ti from"vite-plugin-compression";import wi from"@vitejs/plugin-vue";import Ci from"vite-tsconfig-paths";import Ai from"vite-plugin-checker";import{encode as Ri}from"@jridgewell/sourcemap-codec";import*as ie from"process";import Oi from"tinycolor2";import se from"node:fs";import ye from"node:path";import ae from"node:process";import bn from"util";import{fileURLToPath as vi}from"node:url";import{readFile as _n}from"fs/promises";import Ii,{AxiosError as Sn}from"axios";import{ConcurrencyManager as Li}from"axios-concurrency";import{inc as ji}from"semver";import xi from"cli-progress";const Ni="2.0.3",ce={[ue.SECTION]:{source:"sections",dist:"dist/sections"},[ue.HEADER]:{source:"headers",dist:"dist/headers"},[ue.FOOTER]:{source:"footers",dist:"dist/footers"}};var K=(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))(K||{});const Pi="https://blockbuster.ecwid.com",Di="/api/v1/custom-apps/resources/sections/upload",ki="/api/v1/custom-apps/resources/templates/upload",Fi="/api/v1/custom-apps/manifests/sections",Hi="/api/v1/custom-apps/manifests/templates",Mi=5,Gi=3,Bi=[K.Server,K.Client,K.ClientChunks,K.ClientAsset,K.Asset],qi=[K.LayoutClient,K.LayoutAsset],Ui=[K.SlotServer,K.SlotClient,K.SlotClientChunks,K.SlotClientAsset],zi=[K.Dependency,K.TemplateAsset,K.SourceCode],Ue={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.`},Tn={catalog:"products",category:"category",product:"product"},Ki=e=>Tn[e],wn=e=>e in Tn;function Qe(e,t=2){if(!+e)return"0 Bytes";const n=1024,o=t<0?0:t,s=["Bytes","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],i=Math.floor(Math.log(e)/Math.log(n));return`${parseFloat((e/n**i).toFixed(o))} ${s[i]}`}const I={error:e=>console.log(ci(e)),warn:e=>console.log(li(e)),info:e=>console.log(Le(e))},je="_temp",Xi="dist",le="dist/sections",ze="dist/headers",Ke="dist/footers",Ce="dist/templates",Xe="layouts",Cn="preview",_e=`dist/${Xe}`,Vi=[le,ze,Ke,Ce,_e],An=2*1024*1024,Rn=500*1024;function pt(e){return!!e}function On(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}const Wi="Resource name can only contain alphanumeric characters, dashes, and underscores";function Yi(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 Zi(e){return e===!0?!0:typeof e=="string"&&e.trim().length===0}async function xe(e,t){try{const n=U(process.cwd(),t?`${e}${je}.mjs`:`${e}.mjs`),o=`?timestamp=${Date.now()}`;return(await import(gn(n).href+o)).default}catch(n){const o=`File [${e}${t?je:""}.mjs] is either invalid or undefined`,s=n instanceof Error?n.message:o;throw new Error(s)}}function vn(e){return Object.keys(e).length===0}function Qi(e){return W.parse(e).name}function Ji(e){return e.split("-").filter(Boolean).map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")}function ea(e){return e.replace(/\\/g,"/")}function ta(e){return e.replace(/^dist\/layouts\//,"").replace(/^layouts\//,"")}function Je(e){return ta(ea(e))}function na(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[n,o]=t;if(!wn(n))throw new Error(`Layout cannot be placed in a non-storefront section: ${n}`);const s=Ki(n);return{id:o,sectionId:n,pageId:s}}const oa={catalog:"products",category:"category",product:"product"};async function sa(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[n,o]=t;return{id:o,sectionId:n}}async function ra(e){return Promise.all(e.map(async t=>{const n=t.sectionId,o=oa[n];return{id:t.id,sectionId:n,pageId:o}}))}async function ia(){const e=`${_e}/{product,catalog,category}/*`,t=await z(e,{ignore:["node_modules/**"]});return Promise.all(t.map(sa))}async function aa(){const e=await ia();return await ra(e)}function Ve(e,t,...n){if(!e||!t)throw new Error(`Cannot build layout path. Invalid parameters - sectionId: "${e}", layoutId: "${t}"`);return`${_e}/${e}/${t}/${n.join("/")}`}const et=(e=ue.SECTION)=>ce[e].dist,We={[K.Server]:{type:"server_js_compressed",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,sectionType:t})=>`${et(t)}/${e}/js/main/server/`},[K.Client]:{type:"client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${et(t)}/${e}/js/main/client/`},[K.ClientChunks]:{type:"client_js_chunks",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${et(t)}/${e}/js/main/client/chunks/`,fileName:"*"},[K.ClientAsset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${et(t)}/${e}/js/main/client/assets/`},[K.Asset]:{type:"assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,sectionType:t})=>`${et(t)}/${e}/assets/`},[K.TemplateAsset]:{type:"template_assets",fileName:"*",isSingleton:!1,toPath:()=>`${Ce}/assets/`},[K.Dependency]:{type:"dependencies",fileName:"package.json",isSingleton:!0,toPath:()=>{}},[K.SourceCode]:{type:"source_code",fileName:"source-code.zip",isSingleton:!0,toPath:()=>{}},[K.LayoutClient]:{type:"layout_client_js",fileName:"index.mjs",isSingleton:!0,toPath:({sectionId:e,layoutId:t})=>Ve(e,t,"")},[K.LayoutAsset]:{type:"layout_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t})=>Ve(e,t,"assets/")},[K.SlotServer]:{type:"slot_server_js",fileName:"server.js.gz",isSingleton:!0,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ve(e,t,"slots",n,"js/main/server/")},[K.SlotClient]:{type:"slot_client_js",fileName:"client.js",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ve(e,t,"slots",n,"js/main/client/")},[K.SlotClientChunks]:{type:"slot_client_js_chunks",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ve(e,t,"slots",n,"js/main/client/chunks/")},[K.SlotClientAsset]:{type:"slot_client_assets",fileName:"*",isSingleton:!1,toPath:({sectionId:e,layoutId:t,slotId:n})=>Ve(e,t,"slots",n,"js/main/client/assets/")}},In="https://json-schema.org/draft/2020-12/schema",Ln="https://lightspeedhq.com/template-default.schema.json",jn="Default Section",xn="Default section for a Custom Template",Nn="object",Pn={"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}},ca={$schema:In,$id:Ln,title:jn,description:xn,type:Nn,$defs:Pn},Dn={__proto__:null,$defs:Pn,$id:Ln,$schema:In,default:ca,description:xn,title:jn,type:Nn},kn="https://json-schema.org/draft/2020-12/schema",Fn="https://lightspeedhq.com/template-custom.schema.json",Hn="Custom Section",Mn="Custom section for a Custom Template",Gn="object",Bn={"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}},la={$schema:kn,$id:Fn,title:Hn,description:Mn,type:Gn,$defs:Bn},qn={__proto__:null,$defs:Bn,$id:Fn,$schema:kn,default:la,description:Mn,title:Hn,type:Gn},Un="https://json-schema.org/draft/2020-12/schema",zn="https://lightspeedhq.com/template-custom-content.schema.json",Kn="Custom Section :: Content Configuration",Xn="Content tab configuration of a Custom Section for a Custom Template",Vn="object",Wn={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}},pa={$schema:Un,$id:zn,title:Kn,description:Xn,type:Vn,$defs:Wn},Yn={__proto__:null,$defs:Wn,$id:zn,$schema:Un,default:pa,description:Xn,title:Kn,type:Vn},Zn="https://json-schema.org/draft/2020-12/schema",Qn="https://lightspeedhq.com/template-custom-design.schema.json",Jn="Custom Section :: Design Configuration",eo="Design tab configuration of a Custom Section for a Custom Template",to="object",no={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}},ua={$schema:Zn,$id:Qn,title:Jn,description:eo,type:to,$defs:no},oo={__proto__:null,$defs:no,$id:Qn,$schema:Zn,default:ua,description:eo,title:Jn,type:to},so="https://json-schema.org/draft/2020-12/schema",ro="https://lightspeedhq.com/section-content.schema.json",io="Custom Section - Content",ao="The content of a custom section",co="object",lo={"^.*$":{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"}}]}},po={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:"#/$defs/ImageDefaults"}},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"}}}},uo=!1,fa={$schema:so,$id:ro,title:io,description:ao,type:co,patternProperties:lo,$defs:po,additionalProperties:uo},fo={__proto__:null,$defs:po,$id:ro,$schema:so,additionalProperties:uo,default:fa,description:ao,patternProperties:lo,title:io,type:co},ho="https://json-schema.org/draft/2020-12/schema",mo="https://lightspeedhq.com/section-layout.schema.json",yo="Section Layout Schema",go="Schema for validating section layout configurations",$o="array",Eo={type:"object",required:["layoutId","selectedContentSettings","selectedDesignSettings"],properties:{layoutId:{type:"string",description:"Unique identifier for the layout"},layoutIcon:{type:"string",description:"Icon identifier used in the layout selector",enum:["HEADER_LEFT","HEADER_CENTER_LOGO_BURGER","HEADER_CENTER_LOGO_COMPACT","HEADER_CENTER_LOGO_DETAILED","HEADER_LEFT_LOGO_BURGER","HEADER_LEFT_LOGO_COMPACT","HEADER_LEFT_LOGO_DETAILED","HEADER_LEFT_LOGO_SEARCH","HEADER_LEFT_LOGO_TEXT","TEXT_ONE_COLUMN","TEXT_TITLE_LEFT","TEXT_SUBTITLE_RIGHT","TEXT_TWO_COLUMNS","TEXT_CENTER","TEXT_DESCRIPTION_RIGHT","CTA_BANNER_LEFT","CTA_BANNER_RIGHT","CTA_BANNER_CENTER","CTA_BANNER_BOTTOM","CTA_PROMO_BAR_LEFT","CTA_PROMO_BAR_RIGHT","CTA_STORY_LEFT","CTA_STORY_RIGHT","CTA_FULLWIDTH_CENTER","CTA_FULLWIDTH_LEFT","COVER_FULLSCREEN_CENTER","COVER_FULLSCREEN_LEFT","COVER_FULLSCREEN_CENTER_LEFT","COVER_FULLSCREEN_RIGHT","COVER_FULLSCREEN_BOTTOM","COVER_FULLSCREEN_BOTTOM_RIGHT","COVER_FULLSCREEN_BOTTOM_LEFT","COVER_FULLSCREEN_TOP","COVER_SIDEBAR_RIGHT","COVER_SIDEBAR_LEFT","COVER_HALFSCREEN_LEFT","COVER_HALFSCREEN_CENTER","COVER_COLLAGE_BOTTOM","COVER_COLLAGE_LEFT","IMAGE_SUBTITLE_RIGHT","IMAGE_TITLE_LEFT","IMAGE_LEFT","IMAGE_RIGHT","IMAGE_CENTER","IMAGE_SIDE_TITLE","LOCATION_MAP_RIGHT","LOCATION_MAP_LEFT","LOCATION_IMAGE_RIGHT","LOCATION_IMAGE_LEFT","LOCATION_BACKGROUND_RIGHT","LOCATION_BACKGROUND_LEFT","LOCATION_FULL","LOCATION_SHORT","REVIEWS_MINIMAL","REVIEWS_CARDS","REVIEWS","REVIEWS_CLASSIC","REVIEWS_FULLSCREEN_BG","REVIEWS_FULLSCREEN_SIDEBAR_LEFT","REVIEWS_FULLSCREEN_SIDEBAR_RIGHT","REVIEWS_CARDS_PHOTO","REVIEWS_PHOTO_SPEECH_RIGHT","REVIEWS_PHOTO_SPEECH_LEFT","REVIEWS_SOCIAL_FEED","REVIEWS_ADAPTIVE","FEATURES_CLASSIC_CENTER","FEATURES_CLASSIC_LEFT","FEATURES_ACCORDION","FEATURES_MINIMAL","FEATURES_SMALL_ICONS","FEATURES_CAROUSEL","FEATURES_IMAGE_LEFT","FEATURES_IMAGE_RIGHT","ANNOUNCEMENT_CENTER","SLIDER_FULLSCREEN_CENTER","SLIDER_FULLSCREEN_LEFT"]},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},bo={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}},da={$schema:ho,$id:mo,title:yo,description:go,type:$o,items:Eo,$defs:bo},_o={__proto__:null,$defs:bo,$id:mo,$schema:ho,default:da,description:go,items:Eo,title:yo,type:$o},So="https://json-schema.org/draft/2020-12/schema",To="https://lightspeedhq.com/sections/section-translation.schema.json",wo="Custom Section - Translations",Co="The translation of the section's labels",Ao="object",Ro={"^[a-z]{2}(_([a-z]{2}|[A-Z]{2}|[0-9]{3}))?$":{type:"object",patternProperties:{"^\\$.*$":{type:"string"}},additionalProperties:!1}},Oo=!1,ha={$schema:So,$id:To,title:wo,description:Co,type:Ao,patternProperties:Ro,additionalProperties:Oo},wt={__proto__:null,$id:To,$schema:So,additionalProperties:Oo,default:ha,description:Co,patternProperties:Ro,title:wo,type:Ao},vo="https://json-schema.org/draft/2020-12/schema",Io="https://lightspeedhq.com/section-design.schema.json",Lo="Custom Section - Design",jo="The design of a custom section",xo="object",No={"^.*$":{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}},Po={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:[]}},ma={$schema:vo,$id:Io,title:Lo,description:jo,type:xo,patternProperties:No,$defs:Po},Do={__proto__:null,$defs:Po,$id:Io,$schema:vo,default:ma,description:jo,patternProperties:No,title:Lo,type:xo},ko="https://json-schema.org/draft/2020-12/schema",Fo="https://lightspeedhq.com/section-commons.schema.json",Ho="Custom Section - Content",Mo="The content of a custom section",Go="object",Bo={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"}}}},qo=!1,ya={$schema:ko,$id:Fo,title:Ho,description:Mo,type:Go,$defs:Bo,additionalProperties:qo},Uo={__proto__:null,$defs:Bo,$id:Fo,$schema:ko,additionalProperties:qo,default:ya,description:Mo,title:Ho,type:Go},zo="https://json-schema.org/draft/2020-12/schema",Ko="https://lightspeedhq.com/section-showcase.schema.json",Xo="Custom Section - Showcase settings",Vo="The setting of a showcase",Wo="object",Yo=["showcaseId","previewImage"],Zo=[{properties:{showcaseId:{description:"Showcase id of the section",type:"string"},previewImage:{$ref:"section-commons.schema.json#/$defs/Image"}}},{$ref:"../showcase_overrides.schema.json"}],ga={$schema:zo,$id:Ko,title:Xo,description:Vo,type:Wo,required:Yo,allOf:Zo},Qo={__proto__:null,$id:Ko,$schema:zo,allOf:Zo,default:ga,description:Vo,required:Yo,title:Xo,type:Wo},Jo="https://json-schema.org/draft/2020-12/schema",es="https://lightspeedhq.com/template.schema.json",ts="Custom Template",ns="A custom template enclosing the necessary custom and default blocks",os="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|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},categories:{description:"List of template categories for Template Market filtering",type:"array",items:{type:"string",enum:["apparel_footwear","vape_smoke","home_garden","sport_outdoor","jewelry_accessories","pet_animals","bikes","health_beauty","gift_shop","electronics","other"]},uniqueItems:!0}},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}},rs=["metadata","sections"],$a={$schema:Jo,$id:es,title:ts,description:ns,type:os,properties:ss,required:rs},is={__proto__:null,$id:es,$schema:Jo,default:$a,description:ns,properties:ss,required:rs,title:ts,type:os},as="https://json-schema.org/draft/2020-12/schema",cs="https://lightspeedhq.com/showcase_overrides.schema.json",ls="Showcase overrides",ps="Overrides for the showcase",us="object",fs={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"}},Ea={$schema:as,$id:cs,title:ls,description:ps,type:us,properties:fs},ds={__proto__:null,$id:cs,$schema:as,default:Ea,description:ps,properties:fs,title:ls,type:us},hs="https://json-schema.org/draft/2020-12/schema",ms="https://lightspeedhq.com/common.schema.json",ys="Common Type Definitions",gs="Common type definitions, used throughout other schemas",$s="object",Es={label_type:{type:"string",pattern:"^\\$.+"}},ba={$schema:hs,$id:ms,title:ys,description:gs,type:$s,$defs:Es},bs={__proto__:null,$defs:Es,$id:ms,$schema:hs,default:ba,description:gs,title:ys,type:$s};function De(e){return re(`${ze}/${e}`)?ue.HEADER:re(`${Ke}/${e}`)?ue.FOOTER:ue.SECTION}function Ct(e){const t=De(e);return ce[t].dist}const _a={menu:{type:"NAVIGATION_MENU"},logo:{type:"LOGO"}},Sa={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 _s(e){switch(e){case ue.HEADER:return _a;default:return{}}}function Ss(e){switch(e){case ue.HEADER:return Sa;default:return{}}}function Ta({validationType:e,sectionType:t}){switch(e){case Me.CONTENT:return _s(t);case Me.DESIGN:return Ss(t);default:return{}}}function wa({sectionSettings:e,mandatorySettings:t}){const n=[];return Object.entries(e).filter(([o])=>t[o]!==void 0).forEach(([o,s])=>{const i=t[o];s.type!==i.type&&n.push({instancePath:o,keyword:"type-mismatch",message:`Editor type "${s.type}" for reserved key "${o}" does not match the required type "${i.type}".`})}),n}function Ca({type:e,mandatorySettings:t}){return Object.keys(t).find(n=>t[n].type===e)}function Aa({sectionSettings:e,mandatorySettings:t}){const n=[];return Object.entries(e).forEach(([o,s])=>{const i=Ca({type:s.type,mandatorySettings:t});i&&o!==i&&n.push({instancePath:o,keyword:"key-mismatch",message:`Editor key "${o}" for overriden content type "${s.type}" does not match the required key name "${i}".`})}),n}function Ra({type:e,mandatorySettings:t}){return Object.keys(t).findLast(n=>t[n].type===e)}function Oa({sectionSettings:e,mandatorySettings:t}){const n=[],o=Object.values(t).map(({type:i})=>i),s=Object.values(e).map(({type:i})=>i);return new Set(s.filter(i=>o.includes(i))).forEach(i=>{if(s.filter(r=>r===i).length>1){const r=Ra({type:i,mandatorySettings:t});n.push({instancePath:r,keyword:"duplicate-type",message:`Editor type "${i}" can only be used once.`})}}),n}function va(e,t){const{sectionSettings:n,sectionType:o}=t,s=Ta({validationType:e,sectionType:o});return s===void 0||vn(s)?[]:[...wa({sectionSettings:n,mandatorySettings:s}),...Aa({sectionSettings:n,mandatorySettings:s}),...Oa({sectionSettings:n,mandatorySettings:s})]}function Ia(e,t){const n=[];if(!e.cards?.defaultCardContent)return n;const o=e.cards.defaultCardContent.settings;for(const[s,i]of Object.entries(o)){const r=i;r?.type==="IMAGE"&&n.push({key:s,editor:r,path:`${t}/cards/defaultCardContent/settings/${s}`})}return n}function La(e,t){const n=e[t];if(n?.type==="IMAGE")return n}function Ts(e,t,n,o,s){const i=La(n,e);if(i?.type!=="IMAGE")return;const r=t.static,a=i.static;(r??!1)!==(a??!1)&&s.push({instancePath:o,message:`Both "${e} content and design editor need to have same value for attribute static`,keyword:"image-editor-mismatch"})}function ja(e,t,n,o){for(const[s,i]of Object.entries(e)){const r=i,a=`/${s}`;if(r.type==="IMAGE")Ts(s,r,t,a,o);else if(r.type==="DECK"){const c=Ia(r,a);for(const{key:l,editor:f,path:E}of c)Ts(l,f,t,E,o)}}}async function xa(e,t,n){if(!e.sectionName||e.validationType!==Me.CONTENT)return[];const o=W.resolve(`${n}/${e.sectionName}/js/settings/design`),s=await xe(o,!1),i=[];return ja(t,s,"",i),i}const Ge=[Uo,Do,fo,_o,Qo,is,Dn,qn,Yn,oo,ds,bs];function ke(e,t){const n=new $i({allErrors:!0,schemas:e});return Ei(n),n.getSchema(t.$id)||n.compile(t)}function Na(){return ke(Ge,is)}function ut(e){return e.map(t=>({instancePath:t.instancePath,message:t.message??"",keyword:t.keyword}))}const Pa=e=>(()=>{const t=Ct(e.name),n=t.split("/").pop()?.toLowerCase();return[{source:`./${n}/${e.name}/settings/content.ts`,dist:W.resolve(`${t}/${e.name}/js/settings/content`),ajv:ke(Ge,fo),validationType:Me.CONTENT,sectionName:e.name,type:e.type},{source:`./${n}/${e.name}/settings/design.ts`,dist:W.resolve(`${t}/${e.name}/js/settings/design`),ajv:ke(Ge,Do),validationType:Me.DESIGN,sectionName:e.name,type:e.type},...V.existsSync(`./${n}/${e.name}/settings/layout.ts`)?[{source:`./${n}/${e.name}/settings/layout.ts`,dist:W.resolve(`${t}/${e.name}/js/settings/layout`),ajv:ke(Ge,_o),sectionName:e.name,type:e.type}]:[],{source:`./${n}/${e.name}/settings/translations.ts`,dist:W.resolve(`${t}/${e.name}/js/settings/translations`),ajv:ke(Ge,wt),type:e.type},...e.showcaseEntryPoints.map(o=>({source:`./${n}/${e.name}/showcases/${He(o).name}.ts`,dist:W.resolve(`${t}/${e.name}/js/showcases/${He(o).name}`),ajv:ke(Ge,o.indexOf("translations")===-1?Qo:wt),type:e.type,sectionName:e.name}))]})();function Da(e){const t=s=>{const i=(s??"").split("/").filter(r=>r.length>0);return i.length===0?"$":`$${i.map(r=>`.${r}`).join("")}`};let n=0,o=0;Object.keys(e).forEach(s=>{const i=e[s];n=Math.max(n,Math.max(...i.map(r=>t(r.instancePath).length))),o=Math.max(o,Math.max(...i.map(r=>r.message.length)))}),Object.keys(e).forEach(s=>{const i=e[s].filter((r,a,c)=>a===c.findIndex(l=>`${r.instancePath}${r.message}${r.keyword}`==`${l.instancePath}${l.message}${l.keyword}`));I.error(s),i.filter(r=>r.keyword!=="if").forEach(r=>{I.error(`${t(r.instancePath).padEnd(n," ")} | ${r.message.padEnd(o," ")} | ${r.keyword||"-"}`)})})}function ka(e,t){if(e.validationType===void 0||e.sectionName===void 0)return[];const{sectionName:n,validationType:o}=e,s=De(n);return[...va(o,{sectionSettings:t,sectionType:s})]}function ws(e,t){return Si({path:"$..set..url",json:t,resultType:"value"}).map(n=>{if(new RegExp(/^https?:\/\//).test(n))return null;const o=`${e}/assets/${n}`;return re(o)?null:{message:`Image ${n} is missing from assets folder`,keyword:"missing-asset"}}).filter(n=>n!==null)}function Fa(e,t,n,o){const s=[],i=t.cards?.defaultCardContent?.settings;if(!i)return s;const r=new Set(Object.keys(i));return e.cards.forEach((a,c)=>{const l=a.settings;l&&Object.keys(l).forEach(f=>{r.has(f)||s.push({instancePath:`showcases/${o}/content/${n}/cards/${c}/settings/${f}`,message:`Setting '${f}' is not defined in content.ts defaultCardContent.settings`,keyword:"invalid-deck-card-setting"})})}),s}async function Ha(e,t){const n=[];if(!e.source||!e.source.includes("/sections/")||e.validationType!==Me.CONTENT||!e.sectionName)return n;const o=Ct(e.sectionName),s=W.resolve(`${o}/${e.sectionName}/js/showcases`);if(!re(s))return n;const i=V.readdirSync(s).filter(a=>a.endsWith(".mjs")&&a!=="translations.mjs").map(async a=>{const c=W.resolve(`${s}/${a.replace(".mjs","")}`),l=await xe(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(f=>{const E=l[f],u=t[f];if(!u){n.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${f}`,message:`Element '${f}' is not defined in content.ts`,keyword:"invalid-showcase-element"});return}if(E.type!==u.type){n.push({instancePath:`showcases/${a.replace(".mjs","")}/content/${f}`,message:`Element '${f}' type mismatch: showcase has type '${E.type}' but content.ts has type '${u.type}'`,keyword:"type-mismatch"});return}E.type==="DECK"&&u.type==="DECK"&&n.push(...Fa(E,u,f,a.replace(".mjs","")))})}return n}async function Ma(e){const t=await xe(e.dist,!1),n={},o=[],s=Ct(e.sectionName??""),i=s.split("/").pop()?.toLowerCase();if(e.ajv(t)||o.push(...ut(e.ajv.errors??[])),o.push(...ka(e,t),...ws(`${i}/${e.sectionName}`,t),...await xa(e,t,s)),e.source&&e.source.includes("/sections/")&&e.validationType===Me.CONTENT){const r=await Ha(e,t);o.push(...r)}return o.length>0&&(n[e.source]=o),n}async function Ga(e){const t=_i(bi.gunzip),n=await V.promises.readFile(e);return(await t(n)).length}async function Cs(e,t){const n=We[e],o=W.resolve(`${n.toPath(t)}${n.fileName}`),s=await Ga(o);if(s>Rn)throw I.error(`Size of individual server file must not exceed threshold [${Qe(Rn)}]!`),I.error(`${`File: ${o}`.padEnd(o.length+10)}| ${Qe(s)}`),new Error("Invalid server file size")}function As(e){const t=e.reduce((n,o)=>{const s=ni(o);return s.size>An&&(n[o]=Qe(s.size)),n},{});if(Object.keys(t).length!==0){const n=Math.max(...Object.keys(t).map(o=>o.length));I.error(`Size of individual assets must not exceed threshold [${Qe(An)}]!`);for(const o in t)I.error(`${`File: ${o}`.padEnd(n+10)}| ${t[o]}`);throw new Error("Invalid asset file size")}}function Ba(e,t,n,o){const s={};return e(t)&&o===void 0?pn(`${n}${je}.mjs`,`${n}.mjs`,()=>{}):(un(`${n}${je}.mjs`,()=>{}),s[W.resolve(`./templates/${He(n).name}.ts`)]=[...ut(e.errors??[]),...o??[]]),s}async function qa(){const e={},t="dist/shared/translation",n=W.resolve(process.cwd(),`${t}.mjs`);if(!re(n))return e;try{const o=await xe(t,!1),s=ke(Ge,wt);s(o)||(e[t]=ut(s.errors??[]))}catch(o){e[t]=[{instancePath:"shared/translation.ts",message:`Failed to load translation file: ${o.message}`,keyword:"import"}]}return e}const Rs={"process.env":{NODE_ENV:"production"}},Ua=[...$n,...$n.map(e=>`node:${e}`)],za=[/@vue\/compiler-dom/,/@vue\/runtime-dom/,/@vue\/server-renderer/,/@vue\/compiler-ssr/,/@vue\/shared/],Os=e=>({pluginType:Ee.Server,define:Rs,ssr:!0,ssrOptions:{noExternal:!0},entryFileNames:"server.js",externalOption:[...Ua,...za],inlineDynamicImports:!0,...e,outDir:e.outDir}),vs=e=>({pluginType:Ee.Client,define:Rs,ssr:!1,entryFileNames:"client.js",assetFileNames:"assets/[name].[ext]",chunkFileNames:"chunks/[name].js",inlineDynamicImports:!1,...e,outDir:e.outDir}),tt=e=>({pluginType:Ee.Misc,ssr:!1,...e,entryFileNames:e.entryFileNames,outDir:e.outDir}),Ka=e=>({pluginType:Ee.Layout,ssr:!1,entryFileNames:"index.mjs",...e,outDir:e.outDir}),At=e=>({pluginType:Ee.Asset,ssr:!1,assetFileNames:"[name].[ext]",...e,outDir:e.outDir}),Xa=()=>Ti({ext:".gz",algorithm:"gzip"}),Va="/* EXTERNAL_IMPORTS_START */",Wa="/* EXTERNAL_IMPORTS_END */",Ya=()=>({name:"external-imports-wrapper-plugin",enforce:"post",apply:"build",generateBundle(e,t){for(const n of Object.keys(t)){const o=t[n];if(o.type==="chunk"){const s=/import.*\?commonjs-external["'];/g,i=o.code.match(s);if(i!==null){const r=i.join(""),a=Va+r+Wa,c=o.code.replace(s,"");o.code=a+c}}}}}),Za=()=>({name:"disable-json-plugin",enforce:"pre",apply:"build",configResolved(e){const t=e.plugins?.findIndex(n=>n?.name==="vite:json");t!==-1&&(e.plugins[t]={name:"vite:json",load:()=>null,transform:()=>null})}}),Qa=()=>{const e=process.env.npm_lifecycle_event;return Ai({typescript:!0,vueTsc:!1,eslint:e==="test"?!1:{lintCommand:`eslint --max-warnings=0 "./sections/**/*.{js,ts,vue}" --cache --cache-location "./build/eslintcache/${e}.json"`}})},Ae={VUE:wi(),TS_CONFIG_PATHS:Ci(),CHECKER:Qa()};class $t{constructor(t){this.bits=t instanceof $t?t.bits.slice():[]}add(t){this.bits[t>>5]|=1<<(t&31)}has(t){return!!(this.bits[t>>5]&1<<(t&31))}}class it{constructor(t,n,o){this.start=t,this.end=n,this.original=o,this.intro="",this.outro="",this.content=o,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 it(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 n=this;for(;n;)t(n),n=n.next}eachPrevious(t){let n=this;for(;n;)t(n),n=n.previous}edit(t,n,o){return this.content=t,o||(this.intro="",this.outro=""),this.storeName=n,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 n=t-this.start,o=this.original.slice(0,n),s=this.original.slice(n);this.original=o;const i=new it(t,this.end,s);return i.outro=this.outro,this.outro="",this.end=t,this.edited?(i.edit("",!1),this.content=""):this.content=o,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 n=this.content.replace(t,"");if(n.length)return n!==this.content&&(this.split(this.start+n.length).edit("",void 0,!0),this.edited&&this.edit(n,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 n=this.content.replace(t,"");if(n.length){if(n!==this.content){const o=this.split(this.end-n.length);this.edited&&o.edit(n,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 Ja(){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 ec=Ja();class tc{constructor(t){this.version=3,this.file=t.file,this.sources=t.sources,this.sourcesContent=t.sourcesContent,this.names=t.names,this.mappings=Ri(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,"+ec(this.toString())}}function nc(e){const t=e.split(`
2
+ `),n=t.filter(i=>/^\t+/.test(i)),o=t.filter(i=>/^ {2,}/.test(i));if(n.length===0&&o.length===0)return null;if(n.length>=o.length)return" ";const s=o.reduce((i,r)=>{const a=/^ +/.exec(r)[0].length;return Math.min(a,i)},1/0);return new Array(s+1).join(" ")}function oc(e,t){const n=e.split(/[/\\]/),o=t.split(/[/\\]/);for(n.pop();n[0]===o[0];)n.shift(),o.shift();if(n.length){let s=n.length;for(;s--;)n[s]=".."}return n.concat(o).join("/")}const sc=Object.prototype.toString;function rc(e){return sc.call(e)==="[object Object]"}function Is(e){const t=e.split(`
3
+ `),n=[];for(let o=0,s=0;o<t.length;o++)n.push(s),s+=t[o].length+1;return function(s){let i=0,r=n.length;for(;i<r;){const l=i+r>>1;s<n[l]?r=l:i=l+1}const a=i-1,c=s-n[a];return{line:a,column:c}}}const ic=/\w/;class ac{constructor(t){this.hires=t,this.generatedCodeLine=0,this.generatedCodeColumn=0,this.raw=[],this.rawSegments=this.raw[this.generatedCodeLine]=[],this.pending=null}addEdit(t,n,o,s){if(n.length){const i=n.length-1;let r=n.indexOf(`
4
+ `,0),a=-1;for(;r>=0&&i>r;){const l=[this.generatedCodeColumn,t,o.line,o.column];s>=0&&l.push(s),this.rawSegments.push(l),this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=r,r=n.indexOf(`
5
+ `,r+1)}const c=[this.generatedCodeColumn,t,o.line,o.column];s>=0&&c.push(s),this.rawSegments.push(c),this.advance(n.slice(a+1))}else this.pending&&(this.rawSegments.push(this.pending),this.advance(n));this.pending=null}addUneditedChunk(t,n,o,s,i){let r=n.start,a=!0,c=!1;for(;r<n.end;){if(this.hires||a||i.has(r)){const l=[this.generatedCodeColumn,t,s.line,s.column];this.hires==="boundary"?ic.test(o[r])?c||(this.rawSegments.push(l),c=!0):(this.rawSegments.push(l),c=!1):this.rawSegments.push(l)}o[r]===`
6
+ `?(s.line+=1,s.column=0,this.generatedCodeLine+=1,this.raw[this.generatedCodeLine]=this.rawSegments=[],this.generatedCodeColumn=0,a=!0):(s.column+=1,this.generatedCodeColumn+=1,a=!1),r+=1}this.pending=null}advance(t){if(!t)return;const n=t.split(`
7
+ `);if(n.length>1){for(let o=0;o<n.length-1;o++)this.generatedCodeLine++,this.raw[this.generatedCodeLine]=this.rawSegments=[];this.generatedCodeColumn=0}this.generatedCodeColumn+=n[n.length-1].length}}const nt=`
8
+ `,Ye={insertLeft:!1,insertRight:!1,storeName:!1};class ln{constructor(t,n={}){const o=new it(0,t.length,t);Object.defineProperties(this,{original:{writable:!0,value:t},outro:{writable:!0,value:""},intro:{writable:!0,value:""},firstChunk:{writable:!0,value:o},lastChunk:{writable:!0,value:o},lastSearchedChunk:{writable:!0,value:o},byStart:{writable:!0,value:{}},byEnd:{writable:!0,value:{}},filename:{writable:!0,value:n.filename},indentExclusionRanges:{writable:!0,value:n.indentExclusionRanges},sourcemapLocations:{writable:!0,value:new $t},storedNames:{writable:!0,value:{}},indentStr:{writable:!0,value:void 0},ignoreList:{writable:!0,value:n.ignoreList}}),this.byStart[0]=o,this.byEnd[t.length]=o}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,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byEnd[t];return o?o.appendLeft(n):this.intro+=n,this}appendRight(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byStart[t];return o?o.appendRight(n):this.outro+=n,this}clone(){const t=new ln(this.original,{filename:this.filename});let n=this.firstChunk,o=t.firstChunk=t.lastSearchedChunk=n.clone();for(;n;){t.byStart[o.start]=o,t.byEnd[o.end]=o;const s=n.next,i=s&&s.clone();i&&(o.next=i,i.previous=o,o=i),n=s}return t.lastChunk=o,this.indentExclusionRanges&&(t.indentExclusionRanges=this.indentExclusionRanges.slice()),t.sourcemapLocations=new $t(this.sourcemapLocations),t.intro=this.intro,t.outro=this.outro,t}generateDecodedMap(t){t=t||{};const n=0,o=Object.keys(this.storedNames),s=new ac(t.hires),i=Is(this.original);return this.intro&&s.advance(this.intro),this.firstChunk.eachNext(r=>{const a=i(r.start);r.intro.length&&s.advance(r.intro),r.edited?s.addEdit(n,r.content,a,r.storeName?o.indexOf(r.original):-1):s.addUneditedChunk(n,r,this.original,a,this.sourcemapLocations),r.outro.length&&s.advance(r.outro)}),{file:t.file?t.file.split(/[/\\]/).pop():void 0,sources:[t.source?oc(t.file||"",t.source):t.file||""],sourcesContent:t.includeContent?[this.original]:void 0,names:o,mappings:s.raw,x_google_ignoreList:this.ignoreList?[n]:void 0}}generateMap(t){return new tc(this.generateDecodedMap(t))}_ensureindentStr(){this.indentStr===void 0&&(this.indentStr=nc(this.original))}_getRawIndentString(){return this._ensureindentStr(),this.indentStr}getIndentString(){return this._ensureindentStr(),this.indentStr===null?" ":this.indentStr}indent(t,n){const o=/^[^\r\n]/gm;if(rc(t)&&(n=t,t=void 0),t===void 0&&(this._ensureindentStr(),t=this.indentStr||" "),t==="")return this;n=n||{};const s={};n.exclude&&(typeof n.exclude[0]=="number"?[n.exclude]:n.exclude).forEach(f=>{for(let E=f[0];E<f[1];E+=1)s[E]=!0});let i=n.indentStart!==!1;const r=l=>i?`${t}${l}`:(i=!0,l);this.intro=this.intro.replace(o,r);let a=0,c=this.firstChunk;for(;c;){const l=c.end;if(c.edited)s[a]||(c.content=c.content.replace(o,r),c.content.length&&(i=c.content[c.content.length-1]===`
9
+ `));else for(a=c.start;a<l;){if(!s[a]){const f=this.original[a];f===`
10
+ `?i=!0:f!=="\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(o,r),this}insert(){throw new Error("magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)")}insertLeft(t,n){return Ye.insertLeft||(console.warn("magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"),Ye.insertLeft=!0),this.appendLeft(t,n)}insertRight(t,n){return Ye.insertRight||(console.warn("magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"),Ye.insertRight=!0),this.prependRight(t,n)}move(t,n,o){if(o>=t&&o<=n)throw new Error("Cannot move a selection inside itself");this._split(t),this._split(n),this._split(o);const s=this.byStart[t],i=this.byEnd[n],r=s.previous,a=i.next,c=this.byStart[o];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=s),c&&(c.previous=i),s.previous||(this.firstChunk=i.next),i.next||(this.lastChunk=s.previous,this.lastChunk.next=null),s.previous=l,i.next=c||null,l||(this.firstChunk=s),c||(this.lastChunk=i),this}overwrite(t,n,o,s){return s=s||{},this.update(t,n,o,{...s,overwrite:!s.contentOnly})}update(t,n,o,s){if(typeof o!="string")throw new TypeError("replacement content must be a string");for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(n>this.original.length)throw new Error("end is out of bounds");if(t===n)throw new Error("Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead");this._split(t),this._split(n),s===!0&&(Ye.storeName||(console.warn("The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"),Ye.storeName=!0),s={storeName:!0});const i=s!==void 0?s.storeName:!1,r=s!==void 0?s.overwrite:!1;if(i){const l=this.original.slice(t,n);Object.defineProperty(this.storedNames,l,{writable:!0,value:!0,enumerable:!0})}const a=this.byStart[t],c=this.byEnd[n];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(o,i,!r)}else{const l=new it(t,n,"").edit(o,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,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byEnd[t];return o?o.prependLeft(n):this.intro=n+this.intro,this}prependRight(t,n){if(typeof n!="string")throw new TypeError("inserted content must be a string");this._split(t);const o=this.byStart[t];return o?o.prependRight(n):this.outro=n+this.outro,this}remove(t,n){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(t===n)return this;if(t<0||n>this.original.length)throw new Error("Character is out of bounds");if(t>n)throw new Error("end must be greater than start");this._split(t),this._split(n);let o=this.byStart[t];for(;o;)o.intro="",o.outro="",o.edit(""),o=n>o.end?this.byStart[o.end]:null;return this}reset(t,n){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;if(t===n)return this;if(t<0||n>this.original.length)throw new Error("Character is out of bounds");if(t>n)throw new Error("end must be greater than start");this._split(t),this._split(n);let o=this.byStart[t];for(;o;)o.reset(),o=n>o.end?this.byStart[o.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(nt);if(t!==-1)return this.outro.substr(t+1);let n=this.outro,o=this.lastChunk;do{if(o.outro.length>0){if(t=o.outro.lastIndexOf(nt),t!==-1)return o.outro.substr(t+1)+n;n=o.outro+n}if(o.content.length>0){if(t=o.content.lastIndexOf(nt),t!==-1)return o.content.substr(t+1)+n;n=o.content+n}if(o.intro.length>0){if(t=o.intro.lastIndexOf(nt),t!==-1)return o.intro.substr(t+1)+n;n=o.intro+n}}while(o=o.previous);return t=this.intro.lastIndexOf(nt),t!==-1?this.intro.substr(t+1)+n:this.intro+n}slice(t=0,n=this.original.length){for(;t<0;)t+=this.original.length;for(;n<0;)n+=this.original.length;let o="",s=this.firstChunk;for(;s&&(s.start>t||s.end<=t);){if(s.start<n&&s.end>=n)return o;s=s.next}if(s&&s.edited&&s.start!==t)throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);const i=s;for(;s;){s.intro&&(i!==s||s.start===t)&&(o+=s.intro);const r=s.start<n&&s.end>=n;if(r&&s.edited&&s.end!==n)throw new Error(`Cannot use replaced character ${n} as slice end anchor.`);const a=i===s?t-s.start:0,c=r?s.content.length+n-s.end:s.content.length;if(o+=s.content.slice(a,c),s.outro&&(!r||s.end===n)&&(o+=s.outro),r)break;s=s.next}return o}snip(t,n){const o=this.clone();return o.remove(0,t),o.remove(n,o.original.length),o}_split(t){if(this.byStart[t]||this.byEnd[t])return;let n=this.lastSearchedChunk;const o=t>n.end;for(;n;){if(n.contains(t))return this._splitChunk(n,t);n=o?this.byStart[n.end]:this.byEnd[n.start]}}_splitChunk(t,n){if(t.edited&&t.content.length){const s=Is(this.original)(n);throw new Error(`Cannot split a chunk that has already been edited (${s.line}:${s.column} \u2013 "${t.original}")`)}const o=t.split(n);return this.byEnd[n]=t,this.byStart[n]=o,this.byEnd[o.end]=o,t===this.lastChunk&&(this.lastChunk=o),this.lastSearchedChunk=t,!0}toString(){let t=this.intro,n=this.firstChunk;for(;n;)t+=n.toString(),n=n.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,n=0;do n+=t.intro.length+t.content.length+t.outro.length;while(t=t.next);return n}trimLines(){return this.trim("[\\r\\n]")}trim(t){return this.trimStart(t).trimEnd(t)}trimEndAborted(t){const n=new RegExp((t||"\\s")+"+$");if(this.outro=this.outro.replace(n,""),this.outro.length)return!0;let o=this.lastChunk;do{const s=o.end,i=o.trimEnd(n);if(o.end!==s&&(this.lastChunk===o&&(this.lastChunk=o.next),this.byEnd[o.end]=o,this.byStart[o.next.start]=o.next,this.byEnd[o.next.end]=o.next),i)return!0;o=o.previous}while(o);return!1}trimEnd(t){return this.trimEndAborted(t),this}trimStartAborted(t){const n=new RegExp("^"+(t||"\\s")+"+");if(this.intro=this.intro.replace(n,""),this.intro.length)return!0;let o=this.firstChunk;do{const s=o.end,i=o.trimStart(n);if(o.end!==s&&(o===this.lastChunk&&(this.lastChunk=o.next),this.byEnd[o.end]=o,this.byStart[o.next.start]=o.next,this.byEnd[o.next.end]=o.next),i)return!0;o=o.next}while(o);return!1}trimStart(t){return this.trimStartAborted(t),this}hasChanged(){return this.original!==this.toString()}_replaceRegexp(t,n){function o(i,r){return typeof n=="string"?n.replace(/\$(\$|&|\d+)/g,(a,c)=>c==="$"?"$":c==="&"?i[0]:+c<i.length?i[+c]:`$${c}`):n(...i,i.index,r,i.groups)}function s(i,r){let a;const c=[];for(;a=i.exec(r);)c.push(a);return c}if(t.global)s(t,this.original).forEach(r=>{if(r.index!=null){const a=o(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=o(i,this.original);r!==i[0]&&this.overwrite(i.index,i.index+i[0].length,r)}}return this}_replaceString(t,n){const{original:o}=this,s=o.indexOf(t);return s!==-1&&this.overwrite(s,s+t.length,n),this}replace(t,n){return typeof t=="string"?this._replaceString(t,n):this._replaceRegexp(t,n)}_replaceAllString(t,n){const{original:o}=this,s=t.length;for(let i=o.indexOf(t);i!==-1;i=o.indexOf(t,i+s))o.slice(i,i+s)!==n&&this.overwrite(i,i+s,n);return this}replaceAll(t,n){if(typeof t=="string")return this._replaceAllString(t,n);if(!t.global)throw new TypeError("MagicString.prototype.replaceAll called with a non-global RegExp argument");return this._replaceRegexp(t,n)}}const Ls=U(process.cwd(),"shared/translation.ts"),js="globalThis.craneSharedTranslation = translation",cc=e=>`import translation from '${e}';
11
+ ${js};
12
+ `,lc=(e,t)=>{const n=e.split("?")[0],o=ii(n);return(o==="server.ts"||o==="client.ts")&&!t.includes(js)},xs=()=>{let e=!1;return{name:"static-translation-plugin",enforce:"pre",apply:"build",buildStart(){e=re(Ls)},transform(t,n){if(!e||!lc(n,t))return null;const o=n.split("?")[0],s=dn(o),i=ui(ri(s,Ls)),r=cc(i),a=new ln(t);return a.prepend(r),{code:a.toString()}}}},pc={[Ee.Server]:[Ae.VUE,Ae.TS_CONFIG_PATHS,Ya(),Xa(),xs()],[Ee.Client]:[Ae.VUE,Ae.TS_CONFIG_PATHS,Ae.CHECKER,En({vue:"EcVue"}),xs()],[Ee.Misc]:[Ae.TS_CONFIG_PATHS,Ae.CHECKER],[Ee.Layout]:[Ae.VUE,Ae.TS_CONFIG_PATHS,Ae.CHECKER,En({vue:["EcExternals","Vue"]})],[Ee.Asset]:[Za()],[Ee.SharedFiles]:[Ae.TS_CONFIG_PATHS]},uc={[Y.Server]:Os({outDir:({name:e,sectionType:t})=>`./${ce[t].dist}/${e}/js/main/server`}),[Y.Client]:vs({outDir:({name:e,sectionType:t})=>`./${ce[t].dist}/${e}/js/main/client`}),[Y.SectionSetting]:tt({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${ce[t].dist}/${e}/js/settings`}),[Y.SectionShowcase]:tt({entryFileNames:"[name].mjs",outDir:({name:e,sectionType:t})=>`./${ce[t].dist}/${e}/js/showcases`}),[Y.SectionAsset]:At({outDir:({name:e,sectionType:t})=>`./${ce[t].dist}/${e}/assets`}),[Y.TemplateDescriptor]:tt({entryFileNames:`[name]${je}.mjs`,outDir:()=>`./${Ce}/js`}),[Y.PageTemplateDescriptor]:tt({entryFileNames:`[name]${je}.mjs`,outDir:({name:e})=>`./${Ce}/${e}`}),[Y.TemplateAsset]:At({outDir:()=>`./${Ce}/assets`}),[Y.Layout]:Ka({outDir:({name:e,sectionId:t})=>`./${_e}/${t}/${e}`}),[Y.LayoutSettings]:tt({entryFileNames:"[name].mjs",outDir:({name:e,sectionId:t})=>`./${_e}/${t}/${e}/js/settings`}),[Y.LayoutAsset]:At({outDir:({name:e,sectionId:t})=>`./${_e}/${t}/${e}/assets`}),[Y.SlotServer]:Os({outDir:({name:e,layoutId:t,sectionId:n})=>`./${_e}/${n}/${t}/slots/${e}/js/main/server`}),[Y.SlotClient]:vs({outDir:({name:e,layoutId:t,sectionId:n})=>`./${_e}/${n}/${t}/slots/${e}/js/main/client`}),[Y.SharedTranslation]:{pluginType:Ee.SharedFiles,ssr:!1,inlineDynamicImports:!0,entryFileNames:"translation.mjs",outDir:()=>"./dist/shared"}};function fc(e){switch(typeof e){case"string":return[U(process.cwd(),e)];case"object":return e.map(t=>U(process.cwd(),t));default:return[]}}function Ns({name:e,entryPoints:t,configType:n,layoutId:o,sectionId:s,sectionType:i=ue.SECTION}){const r=uc[n],a=r.define,c=r.ssrOptions,l=r.entryFileNames,f=r.chunkFileNames,E=r.assetFileNames,u=r.inlineDynamicImports,L=r.externalOption;return{plugins:pc[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:o,sectionId:s}),emptyOutDir:!0,minify:"terser",terserOptions:{compress:{drop_console:!1,pure_getters:!0}},rollupOptions:{external:L,preserveEntrySignatures:"strict",input:fc(t),treeshake:{moduleSideEffects:!1},output:{validate:!0,inlineDynamicImports:u,entryFileNames:l,chunkFileNames:f,assetFileNames:E}}},assetsInclude:["**/*.json"]}}async function dc(){const e={ignore:["node_modules/**","dist/**"]},t=await z(`./${Xe}/{product,category,catalog}/*/Main.vue`,e);return await Promise.all(t.map(async n=>{const{id:o,sectionId:s,pageId:i}=na(n),[r,a]=await Promise.all([z(`./${Xe}/${s}/${o}/settings/{content,design,translations}.{js,ts}`,e),z(`./${Xe}/${s}/${o}/assets/*`,e)]);return{name:o,sectionId:s,pageId:i,clientEntrypoint:n,settingsEntryPoints:r,assetsEntrypoints:a}}))}async function hc(e){As(e.assetsEntrypoints),await ge({entryPoints:[e.clientEntrypoint],configType:Y.Layout,name:e.name,sectionId:e.sectionId}),await Promise.all([ge({entryPoints:e.settingsEntryPoints,configType:Y.LayoutSettings,name:e.name,sectionId:e.sectionId}),ge({entryPoints:e.assetsEntrypoints,configType:Y.LayoutAsset,name:e.name,sectionId:e.sectionId})])}async function mc(e){e===void 0||e.length===0||await Promise.all(e.map(t=>hc(t)))}async function yc(e){const t=yn(Ns({name:e.name,entryPoints:e.serverEntrypoint,configType:Y.Server,sectionType:e.type}));return As(e.assetEntryPoints),await qe({configFile:!1,...t}),await Cs(K.Server,{sectionId:e.name,sectionType:e.type}),await Promise.all([ge({entryPoints:e.clientEntrypoint,configType:Y.Client,name:e.name,sectionType:e.type}),ge({entryPoints:e.settingsEntryPoints,configType:Y.SectionSetting,name:e.name,sectionType:e.type}),ge({entryPoints:e.showcaseEntryPoints,configType:Y.SectionShowcase,name:e.name,sectionType:e.type}),ge({entryPoints:e.assetEntryPoints,configType:Y.SectionAsset,name:e.name,sectionType:e.type})]),await Pa(e).reduce(async(n,o)=>{const s=await n,i=await Ma(o);return{...s,...i}},Promise.resolve({}))}async function gc(){const e=U(process.cwd(),"shared/translation.ts");re(e)&&await ge({entryPoints:["shared/translation.ts"],configType:Y.SharedTranslation})}async function $c(e){return e.reduce(async(t,n)=>{const o=await t,s=await yc(n);return{...o,...s}},Promise.resolve({}))}async function ve(e){return(await import(gn(e).href+`?t=${Date.now()}`)).default}function Rt(e,t){return Object.keys(e).reduce((n,o)=>{const s=e[o],i=t[o];return On(s)&&On(i)?n[o]=Rt(s,i):n[o]=s,n},{...t})}function Ec({contentSettings:e,sectionType:t}){const n=_s(t);return Rt(e,n)}function bc({designSettings:e,sectionType:t}){const n=Ss(t);return Rt(e,n)}function Ot(e){if(e!==void 0)return e.startsWith("global.")?{type:"GLOBAL_FONT",font:e}:{type:"PRESET_FONT",font:e}}function Re(e){if(e===void 0)return;if(e.startsWith("global."))return{type:"GLOBAL_COLOR",raw:e};const t=Oi(e);return{type:"STRUCTURED_COLOR",raw:e,hex:t.toHex8String(),hsl:t.toHsl(),rgba:t.toRgb(),auto:!1}}function Ps(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 _c(e){if(e!==void 0)return{...e,color:Re(e.color)}}function vt(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function Sc(e){if(e!==void 0)switch(e){case Tt.COLOR:return"solid";case Tt.GRADIENT:return"gradient";default:throw new Error(`Unknown background type: ${e}. Right options: ${Object.keys(Tt)}`)}}function Tc({style:e,color:t}){const n=Array.isArray(t)?t:[t,t];return{background:{type:Sc(e),solid:{color:Re(n.at(0))},gradient:{fromColor:Re(n.at(0)),toColor:Re(n.at(1))}}}}function wc(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(di)}`)}}function Cc(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(hi)}`)}}function Ac(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(mi)}`)}}function Rc(e){const t=wc(e.appearance),n=Cc(e.size),o=Ac(e.shape),s=Ot(e.font),i=Re(e.color),r=e.visible;return vt({appearance:t,size:n,style:o,font:s,color:i,visible:r})}function Oc(e){const t=Re(e.color);return vt({color:t})}function vc(e){if(e!==void 0)switch(e){case lt.COLOR:return"solid";case lt.GRADIENT:return"gradient";case lt.NONE:return"none";default:throw new Error(`Unknown image overlay type: ${e}. Right options: ${Object.keys(lt)}`)}}function Ic(e){const t=e.color,n=Array.isArray(t)?t:[t,t];return{overlay:{type:vc(e.overlay),solid:{color:Re(n.at(0))},gradient:{fromColor:Re(n.at(0)),toColor:Re(n.at(1))}}}}function Lc(e){const t=Ot(e.font),n=Re(e.color),o=Ps(e.size);return{font:t,color:n,size:o,frame:_c(e.frame)}}function jc(e){const t=Ot(e.font),n=Re(e.color),o=Ps(e.size);return vt({font:t,color:n,size:o})}function It(e,t){if(t.defaults===void 0)return;let n={};switch(e){case Pe.TEXT:{n=jc(t.defaults);break}case Pe.BUTTON:{n=Rc(t.defaults);break}case Pe.IMAGE:{n=Ic(t.defaults);break}case Pe.BACKGROUND:{n=Tc(t.defaults);break}case Pe.COLOR_PICKER:{n=Oc(t.defaults);break}case Pe.LOGO:{n=Lc(t.defaults);break}case Pe.TOGGLE:case Pe.SELECTBOX:break;default:throw new Error(`Unknown design editor type: ${e}`)}return n}function xc(e){const t={};return Object.keys(e).forEach(n=>{const o=e[n],s=o.type,i=It(s,o);i&&o.defaults?t[n]={...o,defaults:i}:t[n]=o}),t}function Nc(e){return e===void 0?e:e.map(t=>{if(t.type!==void 0&&t.defaults!==void 0&&t.fieldName!==void 0){const n={...It(t.type,t)??t.defaults,type:t.defaults.type??t.type};return{type:t.type,fieldName:t.fieldName,defaults:n}}return t})}function Lt(e){if(e===void 0)return;const t={};return Object.keys(e).forEach(n=>{const o=e[n],s=o.type,i=It(s,{defaults:o});i!==void 0?t[n]={...o,...i}:t[n]=o}),t}function Pc(e,t){if(!t)return;const n=e[t];return n===void 0?{en:t}:n}function Dc(e){const t={};for(const n in e){const o=e[n];for(const s in o){const i=t[s],r=o[s];if(i===void 0){const a={};a[n]=r,t[s]=a}else i[n]=r}}return t}function kc(e){return e.every(t=>t==null||typeof t=="string"||typeof t=="number"||typeof t=="boolean")}function Be(e,t){if(e==null||typeof e!="object")return e;if(Array.isArray(e))return kc(e)?e:e.map(s=>Be(s,t));const n=e,o={};for(const s in n){const i=n[s];typeof i=="string"&&i.startsWith("$")?o[s]=Pc(t,i):typeof i=="object"&&i!==null?o[s]=Be(i,t):o[s]=i}return o}async function ft(e){return e?Dc(e):{}}async function Fc(e,t=le){const n=U(process.cwd(),`${t}/${e}/js/settings/translations.mjs`);return await ve(n)}async function ot(e,t=le){const n=U(process.cwd(),`${t}/${e}/js/showcases/translations.mjs`);return await ve(n)}async function Hc(e,t){const n=U(process.cwd(),`${_e}/${t}/${e}/js/settings/translations.mjs`);return await ve(n)}async function Ds(e,t,n){const o=n?Ec({contentSettings:e,sectionType:n}):e;return Be(o,t)}async function Mc(e,t=le){try{const n=U(ie.cwd(),`${t}/${e}/js/settings/content.mjs`);return await ve(n)}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Gc(e,t,n=le){const o=await Mc(e,n);return await Ds(o,t,De(e))}async function ks(e,t,n){const o=n?bc({designSettings:e,sectionType:n}):e,s=xc(o);return Be(s,t)}async function Bc(e,t=le){try{const n=U(ie.cwd(),`${t}/${e}/js/settings/design.mjs`);return await ve(n)}catch(n){const o=n;throw new Error(`Design settings is invalid or undefined. Error ${o.stack}`)}}async function qc(e,t,n=le){const o=await Bc(e,n);return ks(o,t,De(e))}async function Uc(e,t){return Promise.all(e.map(async n=>{const o=n.design?Lt(n.design):void 0,s={...n,design:o??n.design};return Be(s,t)}))}async function zc(e,t=le){try{const n=await z("*.mjs",{cwd:U(ie.cwd(),`${t}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(n.map(async o=>{const s=U(ie.cwd(),`${t}/${e}/js/showcases/${o}`);return await ve(s)}))}catch(n){throw new Error(`Showcases is invalid or undefined. Error ${n}`)}}async function Kc(e,t,n=le){const o=await zc(e,n);return Uc(o,t)}async function Xc(e){return e?.map(t=>({...t,selectedDesignSettings:Nc(t.selectedDesignSettings)??t.selectedDesignSettings}))??[]}async function Vc(e,t=le){try{const n=U(ie.cwd(),`${t}/${e}/js/settings/layout.mjs`);return re(n)?await ve(n):[]}catch{throw new Error(`Layout descriptor for section [${e}] is either invalid or undefined`)}}async function Wc(e,t=le){const n=await Vc(e,t);return await Xc(n)}function Yc(e){let t={};const n=U(ie.cwd(),`${Cn}/shared/analytics.json`);if(!re(n))return 0;try{const o=oi(n,"utf-8");t=JSON.parse(o)}catch(o){console.warn("Error processing analytics.json file",o)}return t[e]||0}function Zc(){try{const e=U(ie.cwd(),`${Cn}/shared/analytics.json`);re(e)&&fn(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}async function dt(e,t){const n=await Fc(e,ce[t].dist),o=await ft(n),s=await ot(e,ce[t].dist),i=await ft(s),r=await Gc(e,o,ce[t].dist),a=await qc(e,o,ce[t].dist),c=await Kc(e,i,ce[t].dist),l=await Wc(e,ce[t].dist),f=Yc(e);return{id:e,type:t,name:{en:e},contentEditors:r,designEditors:a,layouts:l,showcases:c,previewCount:f}}async function Qc(){const e=await z("*/",{cwd:U(ie.cwd(),`${le}/`)}),t=await z("*/",{cwd:U(ie.cwd(),`${ze}/`)}),n=await z("*/",{cwd:U(ie.cwd(),`${Ke}/`)});return Promise.all([...e.map(async o=>dt(o,ue.SECTION)),...t.map(async o=>dt(o,ue.HEADER)),...n.map(async o=>dt(o,ue.FOOTER))])}async function Jc(e){if(!e||e.type!=="custom")return;const t=De(e.id),n=await ot(e.id,ce[t].dist);e.showcase_overrides!==void 0&&(Be(e.showcase_overrides,n),e.showcase_overrides.design&&Lt(e.showcase_overrides.design))}async function el(e){const t=e.filter(n=>n.type==="custom");await Promise.all(t.map(n=>Jc(n)))}function tl(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[n,o,,s]=t;if(!wn(n))throw new Error(`Slot cannot be placed in a non-storefront section: ${n}`);return{id:s,sectionId:n,layoutId:o}}async function nl(e){return Promise.all(e.map(async t=>{const n=await ft(t.translationsSettings),o=await Ds(t.content,n),s=await ks(t.design,n);return{id:t.id,sectionId:t.sectionId,layoutId:t.layoutId,contentEditors:o,designEditors:s}}))}async function ol(e,t){try{const n=Oe.resolve(process.cwd(),`${_e}/${t}/${e}/js/settings/content.mjs`);return await ve(n)}catch(n){throw new Error(`Content descriptor for layout [${e}] is either invalid or undefined: ${n}`)}}async function sl(e,t){try{const n=Oe.resolve(process.cwd(),`${_e}/${t}/${e}/js/settings/design.mjs`);return await ve(n)}catch(n){throw new Error(`Design descriptor for layout [${e}] is either invalid or undefined: ${n}`)}}async function rl(e){const t=Je(e).split("/"),[n,o,,s]=t,i=await Hc(o,n),r=await ol(o,n),a=await sl(o,n);return{id:s,sectionId:n,layoutId:o,content:r,design:a,translationsSettings:i}}async function il(){const e=`${_e}/{product,catalog,category}/*/slots/*`,t=await z(e,{ignore:["node_modules/**"]});return await Promise.all(t.map(rl))}async function al(){const e=await il();return await nl(e)}async function cl(){const e={ignore:["node_modules/**","dist/**"]},t=await z(`${Xe}/{product,category,catalog}/*/slots/*/server.ts`,e);return Promise.all(t.map(async n=>{const{id:o,sectionId:s,layoutId:i}=tl(n),r=(await z(`${Xe}/${s}/${i}/slots/${o}/client.{js,ts}`,e))[0];if(r===void 0)throw new Error(`Cannot find client entrypoint file for slot ${o} of section ${s}`);return{id:o,sectionId:s,layoutId:i,serverEntrypoint:n,clientEntrypoint:r}}))}async function ll(e){const t={name:e.id,layoutId:e.layoutId,sectionId:e.sectionId};await ge({entryPoints:[e.serverEntrypoint],configType:Y.SlotServer,...t}),await Cs(K.SlotServer,{slotId:e.id,layoutId:e.layoutId,sectionId:e.sectionId}),await ge({entryPoints:[e.clientEntrypoint],configType:Y.SlotClient,...t})}async function pl(e){e===void 0||e.length===0||await e.reduce(async(t,n)=>{await t,await ll(n)},Promise.resolve())}const Fs="https://json-schema.org/draft/2020-12/schema",Hs="https://lightspeedhq.com/metadata.schema.json",Ms="Custom Multi Page Template metadata",Gs="Metadata of a multi page template",Bs="object",qs={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},categories:{description:"List of template categories for Template Market filtering",type:"array",items:{type:"string",enum:["apparel_footwear","vape_smoke","home_garden","sport_outdoor","jewelry_accessories","pet_animals","bikes","health_beauty","gift_shop","electronics","other"]},uniqueItems:!0}},required:["name","description","cover_image"],additionalProperties:!1},header:{$ref:"./header_footer.schema.json"},footer:{$ref:"./header_footer.schema.json"}},Us=["metadata","header","footer"],zs=!1,ul={$schema:Fs,$id:Hs,title:Ms,description:Gs,type:Bs,properties:qs,required:Us,additionalProperties:zs},fl={__proto__:null,$id:Hs,$schema:Fs,additionalProperties:zs,default:ul,description:Gs,properties:qs,required:Us,title:Ms,type:Bs},Ks="https://json-schema.org/draft/2020-12/schema",Xs="https://lightspeedhq.com/header_footer.schema.json",Vs="Header/Footer definition for a page template",Ws="object",Ys=["type","id"],Zs={type:{type:"string",enum:["custom","default"]},id:{type:"string"},showcase_id:{type:"string"},showcase_overrides:{$ref:"../showcase_overrides.schema.json"}},Qs=!1,Js=[{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"}}}}],dl={$schema:Ks,$id:Xs,title:Vs,type:Ws,required:Ys,properties:Zs,additionalProperties:Qs,allOf:Js},hl={__proto__:null,$id:Xs,$schema:Ks,additionalProperties:Qs,allOf:Js,default:dl,properties:Zs,required:Ys,title:Vs,type:Ws},er="https://json-schema.org/draft/2020-12/schema",tr="https://lightspeedhq.com/page.schema.json",nr="Homepage",or="Homepage enclosing the necessary custom and default blocks",sr="object",rr={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}},ir=!1,ar=["sections"],ml={$schema:er,$id:tr,title:nr,description:or,type:sr,properties:rr,additionalProperties:ir,required:ar},yl={__proto__:null,$id:tr,$schema:er,additionalProperties:ir,default:ml,description:or,properties:rr,required:ar,title:nr,type:sr},cr="https://json-schema.org/draft/2020-12/schema",lr="https://lightspeedhq.com/page.schema.json",pr="Custom Page",ur="A custom page enclosing the necessary custom and default blocks",fr="object",dr={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"]}}]}}},hr=!1,mr=["sections"],gl={$schema:cr,$id:lr,title:pr,description:ur,type:fr,properties:dr,additionalProperties:hr,required:mr},jt={__proto__:null,$id:lr,$schema:cr,additionalProperties:hr,default:gl,description:ur,properties:dr,required:mr,title:pr,type:fr},yr="https://json-schema.org/draft/2020-12/schema",gr="https://lightspeedhq.com/page.schema.json",$r="Custom page",Er="Custom page enclosing the necessary custom and default blocks",br="object",_r={metadata:{description:"Metadata of custom page",type:"object",properties:{title:{type:"string",description:"Title of the custom page"}},required:["title"],additionalProperties:!1},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:0,uniqueItems:!1}},Sr=!1,Tr=["sections"],$l={$schema:yr,$id:gr,title:$r,description:Er,type:br,properties:_r,additionalProperties:Sr,required:Tr},El={__proto__:null,$id:gr,$schema:yr,additionalProperties:Sr,default:$l,description:Er,properties:_r,required:Tr,title:$r,type:br},wr="https://json-schema.org/draft/2020-12/schema",Cr="https://lightspeedhq.com/store-section.schema.json",Ar="Store Section",Rr="Store section for a custom page",Or="object",vr=[{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}],bl={$schema:wr,$id:Cr,title:Ar,description:Rr,type:Or,allOf:vr},_l={__proto__:null,$id:Cr,$schema:wr,allOf:vr,default:bl,description:Rr,title:Ar,type:Or};function Sl(e){switch(e){case be.PRODUCT:return"product";case be.CATALOG:return"catalog";case be.CATEGORY:return"category";default:return null}}const Tl=[Uo,Dn,qn,ds,oo,Yn,_l,hl,bs],wl=e=>{const t=[],n={},o=(s,i,r,a)=>{if(!s){n[e.name]||(n[e.name]=[]),n[e.name].push({instancePath:`/templates/${e.name}/${i}`,message:`Missing file: ${i}`,keyword:"required"});return}t.push({templateName:e.name,source:s,dist:W.resolve(`dist/templates/${e.name}/${i}`),ajv:ke(Tl,r),templatePageType:a})};return o(e.catalogEntrypoint,"catalog",jt,be.CATALOG),o(e.productEntrypoint,"product",jt,be.PRODUCT),o(e.homeEntrypoint,"home",yl,be.HOME),o(e.categoryEntrypoint,"category",jt,be.CATEGORY),o(e.configurationEntrypoint,"configuration",fl,be.CUSTOM),e.customEntrypoint?.forEach(s=>{o(s,He(s).name,El,be.CUSTOM)}),[t,n]};function Cl({section:e,context:t,normalizedPaths:n}){const o=Sl(t.templatePageType);if(o===null)return{instancePath:`/sections/${e.id}/id`,message:`Source folder not found for template page type "${t.templatePageType}".`,keyword:"source_folder_not_found"};const s=`${o}/${e.id}`;return n.some(i=>i.startsWith(s))?null:{instancePath:`/sections/${e.id}/id`,message:`Source layout for section "${e.id}" not found in "layouts/${o}/${e.id}".`,keyword:"layout_not_found"}}function Al(e){const{type:t,id:n}=e;return t==="store"&&n!==void 0&&n!==""}async function Rl({content:e,context:t,layoutBuildConfigs:n}){const o=n.map(s=>Je(s.clientEntrypoint));return e.sections.filter(Al).map(s=>Cl({section:s,context:t,normalizedPaths:o})).filter(s=>s!==null)}function Ol(e){return"sections"in e}async function vl(e,t){const n=await xe(e.dist,!0),o={},s=[];if(e.ajv(n)?pn(`${e.dist}${je}.mjs`,`${e.dist}.mjs`,()=>{}):(s.push(...ut(e.ajv.errors??[])),un(`${e.dist}${je}.mjs`,()=>{})),Ol(n)&&t!==void 0){const i=await Rl({content:n,context:e,layoutBuildConfigs:t});s.push(...i)}return s.length>0&&(o[e.source]=s),o}const Il=async(e,t)=>{const[n,o]=wl(e);return(await Promise.all(n.map(s=>vl(s,t)))).reduce((s,i)=>(Object.entries(i).forEach(([r,a])=>{s[r]=s[r]?[...s[r],...a]:[...a]}),s),{...o})};async function Ll(e,t,n,o=le){if(t.showcase_overrides?.content!==void 0)if(!re(`${o}/${t.id}/js/settings/content.mjs`))e.push({instancePath:`/sections/${n}/showcase_overrides/content`,message:"Content descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const s=await xe(`${o}/${t.id}/js/settings/content`,!1),i=new Set(Object.keys(s));Object.keys(t.showcase_overrides.content).every(r=>i.has(r))||e.push({instancePath:`/sections/${n}/showcase_overrides/content`,message:"Content descriptor must be a subset of the default content descriptor",keyword:"type"})}}async function jl(e,t,n,o=le){if(t.showcase_overrides?.design!==void 0)if(!re(`${o}/${t.id}/js/settings/design.mjs`))e.push({instancePath:`/sections/${n}/showcase_overrides/design`,message:"Design descriptor is overridden, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const s=await xe(`${o}/${t.id}/js/settings/design`,!1),i=new Set(Object.keys(s));Object.keys(t.showcase_overrides.design).every(r=>i.has(r))||e.push({instancePath:`/sections/${n}/showcase_overrides/design`,message:"Design descriptor must be a subset of the default design descriptor",keyword:"type"})}}async function xl(e,t,n,o=le){if(t.showcase_overrides?.layoutId!==void 0)if(!re(`${o}/${t.id}/js/settings/layout.mjs`))e.push({instancePath:`/sections/${n}/showcase_overrides/layout`,message:"Layout id descriptor is set, please provide a default descriptor in the block's settings folder",keyword:"required"});else{const s=await xe(`${o}/${t.id}/js/settings/layout`,!1);new Set(s.map(i=>i.layoutId)).has(t.showcase_overrides.layoutId)||e.push({instancePath:`/sections/${n}/showcase_overrides/layout`,message:"Layout id descriptor must be a valid id in the default layout descriptor",keyword:"type"})}}async function xt(e,t,n,o=le){t.showcase_overrides!==void 0&&(await Ll(e,t,n,o),await jl(e,t,n,o),await xl(e,t,n,o))}function Nt(e,t,n,o=le){t.showcase_id!==void 0&&(re(`${o}/${t.id}/js/showcases/${t.showcase_id}.mjs`)||e.push({instancePath:`/sections/${n}/showcase-id`,message:"Custom section must have a corresponding showcase defined in case showcase_id is specified",keyword:"required"}))}async function Nl(e,t){const n=t.id==="header"&&t.type==="default",o=re(`${ze}/${t.id}`);!n&&!o&&e.push({instancePath:"/sections/0/id",message:"The first section must be a `header`",keyword:"required"}),o&&(await xt(e,t,0,ze),Nt(e,t,0,ze))}async function Pl(e,t,n){const o=t.id==="footer"&&t.type==="default",s=re(`${Ke}/${t.id}`);!o&&!s&&e.push({instancePath:`/sections/${n}/id`,message:"The last section must be a `footer`",keyword:"required"}),s&&(await xt(e,t,n,Ke),Nt(e,t,n,Ke))}async function Dl(e,t){t.showcase_overrides&&e.push(...ws(`sections/${t.id}`,t.showcase_overrides))}async function kl(e){const t=await e.sections.reduce(async(n,o,s)=>{const i=await n;return s===0?await Nl(i,o):s===e.sections.length-1?await Pl(i,o,e.sections.length-1):o.type==="custom"?re(`${le}/${o.id}`)?(await xt(i,o,s),Nt(i,o,s),await Dl(i,o)):i.push({instancePath:`/sections/${s}/id`,message:"Custom section must have a corresponding block defined",keyword:"required"}):o.type==="default"&&(o.id==="header"&&i.push({instancePath:`/sections/${s}/id`,message:"Header can only be placed as the first section",keyword:"required"}),o.id==="footer"&&i.push({instancePath:`/sections/${s}/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 Fl(e){return(await z(`**/${e}/pages/*.{js,ts}`,{ignore:["node_modules/**","dist/**"]})).filter(t=>{const n=He(t).name.toLowerCase();return!Object.values(yi).includes(n)})}async function Hl(){const e=await z("./templates/*",{ignore:["templates/assets/**","templates/**.{js,ts}","node_modules/**","dist/**"]}).catch(t=>(I.error(`Error while getting page template entry points: ${t}`),[]));return Promise.all(e.map(async t=>{const n=t.split(hn),o=n.pop()??"default";if(n.pop()===void 0)throw new Error("Cannot determine template with custom pages, outer directory is undefined");const s=await z(`**/${o}/configuration.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),i=await z(`**/${o}/pages/home.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await z(`**/${o}/pages/category.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await z(`**/${o}/pages/catalog.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await z(`**/${o}/pages/product.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await Fl(o);return{name:o,configurationEntrypoint:s.at(0),homeEntrypoint:i.at(0),categoryEntrypoint:r.at(0),catalogEntrypoint:a.at(0),productEntrypoint:c.at(0),customEntrypoint:l.length>0?l:void 0}}))}async function Ml(){const e=await z("./templates/**.{js,ts}",{ignore:["node_modules/**","dist/**"]}),t=await z("./templates/assets/*",{ignore:["node_modules/**","dist/**"]});return{pageTemplates:await Hl(),templates:e,assets:t}}async function Gl(e){if(e.templates.length===0&&e.pageTemplates?.length===0)return{};const t=Na();return await Promise.all([ge({entryPoints:e.assets,configType:Y.TemplateAsset}),ge({entryPoints:e.templates,configType:Y.TemplateDescriptor})]),e.templates.reduce(async(n,o)=>{const s=await n,i=`${Ce}/js/${He(o).name}`,r=await xe(i,!0);return{...s,...Ba(t,r,i,await kl(r))}},Promise.resolve({}))}async function Bl({templateBuildConfig:e,layoutBuildConfigs:t}){return e.pageTemplates?.reduce(async(n,o)=>{const s=await n,i=[o.configurationEntrypoint,o.homeEntrypoint,o.categoryEntrypoint,o.catalogEntrypoint,o.productEntrypoint,...o.customEntrypoint??[]].filter(pt);if(i.length===0)throw new Error("No entry points provided for page template");return await ge({entryPoints:i,configType:Y.PageTemplateDescriptor,name:o.name}),{...s,...await Il(o,t)}},Promise.resolve({}))??{}}async function ql(e){const t=await Ml(),n=await Promise.all([Gl(t),Bl({templateBuildConfig:t,layoutBuildConfigs:e})]);return n.some(o=>!vn(o))?n.reduce((o,s)=>({...o,...s}),{}):{}}function Ul(e){return{name:e.name,type:e.type,serverEntrypoint:e.serverEntrypoint,clientEntrypoint:[e.clientEntrypoint].filter(pt).flat(),settingsEntryPoints:[e.contentSettingsEntrypoint,e.designSettingsEntrypoint,e.layoutSettingsEntrypoint,e.settingsTranslationsEntrypoint].filter(pt),showcaseEntryPoints:[...e.showcasesEntrypoints??[],e.showcasesTranslationsEntrypoint].filter(pt),assetEntryPoints:e.assetsEntrypoints??[]}}function zl(e){return Object.entries(ce).find(t=>t[1].source===e)?.[0]}async function Kl(){const e=await z("**/server.{js,ts}",{ignore:["node_modules/**","dist/**","templates/**","layouts/**"]});return Promise.all(e.map(async t=>{const n=dn(t).split(hn),o=n.pop()??"default",s=n.pop();if(s===void 0)throw new Error("Cannot determine type of section, outer directory is undefined");const i=await z(`**/${o}/client.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),r=await z(`**/${o}/settings/content.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),a=await z(`**/${o}/settings/design.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),c=await z(`**/${o}/settings/layout.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),l=await z(`**/${o}/settings/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),f=await z(`**/${o}/showcases/*.{js,ts}`,{ignore:["node_modules/**","dist/**",`**/${o}/showcases/translations.{js,ts}`]}),E=await z(`**/${o}/showcases/translations.{js,ts}`,{ignore:["node_modules/**","dist/**"]}),u=await z(`**/${o}/assets/*`,{ignore:["node_modules/**","dist/**"]});return{name:o,type:zl(s),serverEntrypoint:t,clientEntrypoint:i.at(0),contentSettingsEntrypoint:r.at(0),designSettingsEntrypoint:a.at(0),layoutSettingsEntrypoint:c.at(0),settingsTranslationsEntrypoint:l.at(0),showcasesEntrypoints:f,showcasesTranslationsEntrypoint:E.at(0),assetsEntrypoints:u}}))}function Xl(){return Promise.all([_t.rm("dist",{recursive:!0,force:!0}),_t.rm("source-code",{recursive:!0,force:!0}),_t.rm("source-code.zip",{force:!0})])}async function Vl(){const e=new pi,t=["node_modules/**/*","dist/**/*","build/**/*",".git/**/*","**/assets/**/*","crane.config.json"],n=await z("**/*",{cwd:U(process.cwd()),ignore:t,dot:!0,nodir:!0});try{n.forEach(i=>{const r=U(process.cwd(),i);e.addLocalFile(r,He(i).dir)});const o=We[K.SourceCode].fileName,s=U(process.cwd(),o);await e.writeZipPromise(s)}catch(o){throw I.error("Error while zipping source files"),o}}async function Pt(e=!1){await Xl();try{const[t,n,o]=await Promise.all([dc(),Kl(),cl()]),s=n.map(Ul);await gc();const i={...await qa(),...await $c(s),...await ql(t)};Object.keys(i).length===0?(await Promise.all([pl(o),mc(t),Vl()]),I.info(`Build successful:
13
13
  For preview run: npx @lightspeed/crane@latest preview
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 C({entryPoints:e,configType:t,name:o,sectionType:s,sectionId:n,layoutId:i}){if(e.length!==0){const r=Xe(ms({name:o,entryPoints:e,configType:t,sectionType:s,sectionId:n,layoutId:i}));await W({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 q(e,t,o,s){const n=de.join(e,s?.[o]??o);en(de.join(t,o),n)}function ja(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(Gn(import.meta.url),"../..",e)}function Ia(){const e=U("package.json");return e!==""?JSON.parse(b.readFileSync(e,"utf8")):{}}async function va(e){try{const t=e,o=_.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`),_.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=>q(s,r,d,i));const a=JSON.parse(b.readFileSync(F.join(r,"package.json"),"utf-8"));a.name=e;const c=Ia();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}`),_.exit(1)}}function De(e,t,o,s){try{const n=_.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`),_.exit(1)):h.mkdirSync(r);const a=U(e);h.readdirSync(a).forEach(async c=>q(r,a,c)),p.info(`${s} ${o} created`)}catch(n){p.error(`Error while creating ${s}: ${n.message}`),_.exit(1)}}function Pe(e){const t=_.cwd(),o=U(`template/${e}`),s=g.join(t,e);h.existsSync(s)||(h.mkdirSync(s),h.readdirSync(o).forEach(async n=>q(s,o,n)))}function Aa(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):Aa(s,n,i)})}function Re(){try{const e=_.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}`),_.exit(1)}}async function La(e){Re(),De("template/sections/example-section","sections",e,"Section")}async function Da(e){Re(),De("template/footers/example-footer","footers",e,"Footer")}async function Pa(e){Re(),De("template/headers/example-header","headers",e,"Header")}async function Ra(){try{const e=_.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=>{q(r,i,l)});continue}for(const l of a){if(l==="assets"){q(r,i,l);continue}if(c.includes(l)){const{name:d}=await qe({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?(q(r,i,l,{[l]:d}),s=!0):p.info(`Skipped: ${l}`)}else q(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}`),_.exit(1)}}async function Na(e){const{targetPath:t,renameFiles:o,sourcePath:s,onTemplateCreated:n}=ja(e);try{const i=_.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`),_.exit(1)):b.mkdirSync(r),c.forEach(l=>q(r,a,l,o)),Pe("headers"),Pe("footers"),Pe("layouts"),n()}catch(i){p.error(`Error while creating template descriptors: ${i.message}`),_.exit(1)}}function ye({deploymentContext:e,sectionType:t=w.SECTION}){const o=e.pathContext,s=o.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),n=s===void 0?Ve(o.fileName):Ve(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=>Zn.flatMap(o=>{const s={config:e,currentSection:t.id,pathContext:te[o]};return ye({deploymentContext:s,sectionType:t.type})})),ka=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})})),Ga=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 Ba=e=>`\x1B[32m${e}\x1B[0m`,Ma=(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:`|${Ba("{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 Ha(e,t,o=S){try{const s=u(P.cwd(),`${o}/${e}/js/settings/content.mjs`),n=await B(s),i=ie(e),r=Ua({contentSettings:n,sectionType:i});return H(r,t),r}catch{throw new Error(`Content descriptor for section [${e}] is either invalid or undefined`)}}async function Va(e,t,o=S){try{const s=u(P.cwd(),`${o}/${e}/js/settings/design.mjs`),n=await B(s),i=ie(e),r=za({designSettings:n,sectionType:i});return ot(r),H(r,t),r}catch(s){const n=s;throw new Error(`Design settings is invalid or undefined. Error ${n.stack}`)}}async function Xa(e,t,o=S){try{const s=await f("*.mjs",{cwd:u(P.cwd(),`${o}/${e}/js/showcases/`),ignore:"**/translations.mjs"});return Promise.all(s.map(async n=>{const i=u(P.cwd(),`${o}/${e}/js/showcases/${n}`),r=await B(i);return st(r.design),H(r,t),r}))}catch(s){throw new Error(`Showcases is invalid or undefined. Error ${s}`)}}async function Ka(e,t=S){try{const o=u(P.cwd(),`${t}/${e}/js/settings/layout.mjs`);if(!$(o))return[];const s=await B(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 Wa(e,t=S){return _e(`${t}/${e}/js/settings/translations.mjs`)}async function sn(e,t=S){return _e(`${t}/${e}/js/showcases/translations.mjs`)}function Ya(e){let t={};const o=u(P.cwd(),`${nt}/shared/analytics.json`);if(!$(o))return 0;try{const s=Tn(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(P.cwd(),`${nt}/shared/analytics.json`);$(e)&&He(e,JSON.stringify({},null,2),"utf-8")}catch(e){console.warn("Can not clean up preview analytics.json file",e)}}async function xe(e,t){const o=await Wa(e,E[t].dist),s=await sn(e,E[t].dist),n=await Ha(e,o,E[t].dist),i=await Va(e,o,E[t].dist),r=await Xa(e,s,E[t].dist),a=await Ka(e,E[t].dist),c=Ya(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(P.cwd(),`${S}/`)}),t=await f("*/",{cwd:u(P.cwd(),`${J}/`)}),o=await f("*/",{cwd:u(P.cwd(),`${Z}/`)});return Promise.all([...e.map(async s=>xe(s,w.SECTION)),...t.map(async s=>xe(s,w.HEADER)),...o.map(async s=>xe(s,w.FOOTER))])}async function ke(e){if(!e||e.type!=="custom")return;const t=ie(e.id),o=await sn(e.id,E[t].dist);e.showcase_overrides!==void 0&&(H(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=>ke(o)))}async function Fe(e){try{return await B(u(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Qa(e){const t=await f(`${L}/js/**.mjs`,{ignore:[`${L}/js/**${N}.mjs`]});return Promise.all(t.map(async o=>{const s=await Fe(o);return await nn(s.sections),{id:`${e}_${X(o).name}`,descriptor:s}}))}function ec(e){return e in v?v[e]:v.CUSTOM}async function tc(e){const t=await f(`${L}/${e}/*.mjs`,{ignore:[`${L}/${e}/configuration*.mjs`]});return Promise.all(t.map(async o=>{const{sections:s}=await Fe(o),n=_i(o);return await nn(s),{sections:s,id:n,type:ec(n.toUpperCase())}}))}async function oc(e){const t=await f(`${L}/**/configuration*.mjs`,{});return Promise.all(t.map(async o=>{const s=await Fe(o);await ke(s.header),await ke(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},I=qa();let rn=Date.now();const an=e=>2**e*500;async function ic(){const e=await Je(u(G.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(G.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=qn(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,He(u(G.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?Xn:Vn;return e.config.axios.post(i,{file:wn(u(G.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=>Ma(r,I,nc,n,rn)}).then(r=>(I.increment(),r)).catch(async r=>{if(cn(s,r))return await on(an(s)),ln(e,t,o,s+1);throw I.increment(),r})}function pc(e){return I.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=[...xa(e),...ka(e),...Fa(e),...Ga(e)];return pc(t)}function uc(e){return e.includes(`
17
- `)}function fc(e,t,o){return e.split(`
18
- `).map((s,n)=>n>=o?t+s:s).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
- `):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?Wn:Kn;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(G.cwd(),r))))throw new Error(Y.INCORRECT_DISTRIBUTION_FOLDER($i));const t=e??Hn;p.info("Custom application deployment :: Started");const o=Bn.create({baseURL:t});Mn(o,Yn),p.info("Loading configuration files ...");const s=await Promise.all([ic(),ac(),Za(),Oi(),qr()]).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=>{I.stop(),r.response?.status===404?p.error(ce(r,Y.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,Y.ASSET_FILES_UPLOAD)),G.exit(1)}).finally(()=>{I.increment(),I.stop()}),I.update({speed:"N/A",status:"Finalising deployment"}),await pn(s).catch(r=>{I.stop(),r.response?.status===404?p.error(ce(r,Y.DEPRECATED_VERSION_DEPLOYMENT)):p.error(ce(r,Y.MANIFEST_DEPLOYMENT)),G.exit(1)}).finally(()=>{I.increment(),I.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){I.stop(),p.error(ce(t,Y.DEFAULT)),G.exit(1)}finally{Ja()}}async function hc(e,t){const o=u(`${e}/ssr-server.ts`),s=u(t);await W({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 W({build:{lib:{entry:o,formats:["es"],fileName:()=>"preview.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await W({build:{lib:{entry:s,formats:["es"],fileName:()=>"utils.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await W({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 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 Ec(e){const t=e.replace(/\\/g,"/"),o=t.match(/sections\/([^/]+)/),s=t.match(/shared\/components/);return!!(o||s)}function Tc(e,t){return async o=>{Ec(o)&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(async()=>{await t()},1e3))}}function wc(e,t){const o=$c(),s=bc(o,e),n=Tc(o,s);e.watcher.add(t),e.watcher.on("add",n),e.watcher.on("change",n),e.watcher.on("unlink",n)}async function _c(){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 Sc(){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 Sn({configFile:e,root:process.cwd()});return await s.listen(),wc(s,[t,o]),s}async function Cc(){await Le(),await gc(),console.log(`
14
+ For deploy run: npx @lightspeed/crane@latest deploy`)):(I.error("Error during build:"),Da(i))}catch(t){I.error(`Error while building: ${t.message}`),e||process.exit(1)}}async function ge({entryPoints:e,configType:t,name:n,sectionType:o,sectionId:s,layoutId:i}){if(e.length!==0){const r=yn(Ns({name:n,entryPoints:e,configType:t,sectionType:o,sectionId:s,layoutId:i}));await qe({configFile:!1,...r})}}function Wl(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Dt={},Ir;function kt(){return Ir||(Ir=1,(function(e){e.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1,e.find=(t,n)=>t.nodes.find(o=>o.type===n),e.exceedsLimit=(t,n,o=1,s)=>s===!1||!e.isInteger(t)||!e.isInteger(n)?!1:(Number(n)-Number(t))/Number(o)>=s,e.escapeNode=(t,n=0,o)=>{const s=t.nodes[n];s&&(o&&s.type===o||s.type==="open"||s.type==="close")&&s.escaped!==!0&&(s.value="\\"+s.value,s.escaped=!0)},e.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1,e.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1,e.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0,e.reduce=t=>t.reduce((n,o)=>(o.type==="text"&&n.push(o.value),o.type==="range"&&(o.type="text"),n),[]),e.flatten=(...t)=>{const n=[],o=s=>{for(let i=0;i<s.length;i++){const r=s[i];if(Array.isArray(r)){o(r);continue}r!==void 0&&n.push(r)}return n};return o(t),n}})(Dt)),Dt}var Ft,Lr;function Ht(){if(Lr)return Ft;Lr=1;const e=kt();return Ft=(t,n={})=>{const o=(s,i={})=>{const r=n.escapeInvalid&&e.isInvalidBrace(i),a=s.invalid===!0&&n.escapeInvalid===!0;let c="";if(s.value)return(r||a)&&e.isOpenOrClose(s)?"\\"+s.value:s.value;if(s.value)return s.value;if(s.nodes)for(const l of s.nodes)c+=o(l);return c};return o(t)},Ft}/*!
15
+ * is-number <https://github.com/jonschlinkert/is-number>
16
+ *
17
+ * Copyright (c) 2014-present, Jon Schlinkert.
18
+ * Released under the MIT License.
19
+ */var Mt,jr;function Yl(){return jr||(jr=1,Mt=function(e){return typeof e=="number"?e-e===0:typeof e=="string"&&e.trim()!==""?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}),Mt}/*!
20
+ * to-regex-range <https://github.com/micromatch/to-regex-range>
21
+ *
22
+ * Copyright (c) 2015-present, Jon Schlinkert.
23
+ * Released under the MIT License.
24
+ */var Gt,xr;function Zl(){if(xr)return Gt;xr=1;const e=Yl(),t=(_,$,R)=>{if(e(_)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if($===void 0||_===$)return String(_);if(e($)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let p={relaxZeros:!0,...R};typeof p.strictZeros=="boolean"&&(p.relaxZeros=p.strictZeros===!1);let b=String(p.relaxZeros),m=String(p.shorthand),w=String(p.capture),g=String(p.wrap),A=_+":"+$+"="+b+m+w+g;if(t.cache.hasOwnProperty(A))return t.cache[A].result;let v=Math.min(_,$),x=Math.max(_,$);if(Math.abs(v-x)===1){let k=_+"|"+$;return p.capture?`(${k})`:p.wrap===!1?k:`(?:${k})`}let H=O(_)||O($),N={min:_,max:$,a:v,b:x},S=[],q=[];if(H&&(N.isPadded=H,N.maxLen=String(N.max).length),v<0){let k=x<0?Math.abs(x):1;q=i(k,Math.abs(v),N,p),v=N.a=0}return x>=0&&(S=i(v,x,N,p)),N.negatives=q,N.positives=S,N.result=n(q,S),p.capture===!0?N.result=`(${N.result})`:p.wrap!==!1&&S.length+q.length>1&&(N.result=`(?:${N.result})`),t.cache[A]=N,N.result};function n(_,$,R){let p=r(_,$,"-",!1)||[],b=r($,_,"",!1)||[],m=r(_,$,"-?",!0)||[];return p.concat(m).concat(b).join("|")}function o(_,$){let R=1,p=1,b=f(_,R),m=new Set([$]);for(;_<=b&&b<=$;)m.add(b),R+=1,b=f(_,R);for(b=E($+1,p)-1;_<b&&b<=$;)m.add(b),p+=1,b=E($+1,p)-1;return m=[...m],m.sort(c),m}function s(_,$,R){if(_===$)return{pattern:_,count:[],digits:0};let p=a(_,$),b=p.length,m="",w=0;for(let g=0;g<b;g++){let[A,v]=p[g];A===v?m+=A:A!=="0"||v!=="9"?m+=L(A,v):w++}return w&&(m+=R.shorthand===!0?"\\d":"[0-9]"),{pattern:m,count:[w],digits:b}}function i(_,$,R,p){let b=o(_,$),m=[],w=_,g;for(let A=0;A<b.length;A++){let v=b[A],x=s(String(w),String(v),p),H="";if(!R.isPadded&&g&&g.pattern===x.pattern){g.count.length>1&&g.count.pop(),g.count.push(x.count[0]),g.string=g.pattern+u(g.count),w=v+1;continue}R.isPadded&&(H=B(v,R,p)),x.string=H+x.pattern+u(x.count),m.push(x),w=v+1,g=x}return m}function r(_,$,R,p,b){let m=[];for(let w of _){let{string:g}=w;!p&&!l($,"string",g)&&m.push(R+g),p&&l($,"string",g)&&m.push(R+g)}return m}function a(_,$){let R=[];for(let p=0;p<_.length;p++)R.push([_[p],$[p]]);return R}function c(_,$){return _>$?1:$>_?-1:0}function l(_,$,R){return _.some(p=>p[$]===R)}function f(_,$){return Number(String(_).slice(0,-$)+"9".repeat($))}function E(_,$){return _-_%Math.pow(10,$)}function u(_){let[$=0,R=""]=_;return R||$>1?`{${$+(R?","+R:"")}}`:""}function L(_,$,R){return`[${_}${$-_===1?"":"-"}${$}]`}function O(_){return/^-?(0+)\d/.test(_)}function B(_,$,R){if(!$.isPadded)return _;let p=Math.abs($.maxLen-String(_).length),b=R.relaxZeros!==!1;switch(p){case 0:return"";case 1:return b?"0?":"0";case 2:return b?"0{0,2}":"00";default:return b?`0{0,${p}}`:`0{${p}}`}}return t.cache={},t.clearCache=()=>t.cache={},Gt=t,Gt}/*!
25
+ * fill-range <https://github.com/jonschlinkert/fill-range>
26
+ *
27
+ * Copyright (c) 2014-present, Jon Schlinkert.
28
+ * Licensed under the MIT License.
29
+ */var Bt,Nr;function Pr(){if(Nr)return Bt;Nr=1;const e=bn,t=Zl(),n=p=>p!==null&&typeof p=="object"&&!Array.isArray(p),o=p=>b=>p===!0?Number(b):String(b),s=p=>typeof p=="number"||typeof p=="string"&&p!=="",i=p=>Number.isInteger(+p),r=p=>{let b=`${p}`,m=-1;if(b[0]==="-"&&(b=b.slice(1)),b==="0")return!1;for(;b[++m]==="0";);return m>0},a=(p,b,m)=>typeof p=="string"||typeof b=="string"?!0:m.stringify===!0,c=(p,b,m)=>{if(b>0){let w=p[0]==="-"?"-":"";w&&(p=p.slice(1)),p=w+p.padStart(w?b-1:b,"0")}return m===!1?String(p):p},l=(p,b)=>{let m=p[0]==="-"?"-":"";for(m&&(p=p.slice(1),b--);p.length<b;)p="0"+p;return m?"-"+p:p},f=(p,b,m)=>{p.negatives.sort((x,H)=>x<H?-1:x>H?1:0),p.positives.sort((x,H)=>x<H?-1:x>H?1:0);let w=b.capture?"":"?:",g="",A="",v;return p.positives.length&&(g=p.positives.map(x=>l(String(x),m)).join("|")),p.negatives.length&&(A=`-(${w}${p.negatives.map(x=>l(String(x),m)).join("|")})`),g&&A?v=`${g}|${A}`:v=g||A,b.wrap?`(${w}${v})`:v},E=(p,b,m,w)=>{if(m)return t(p,b,{wrap:!1,...w});let g=String.fromCharCode(p);if(p===b)return g;let A=String.fromCharCode(b);return`[${g}-${A}]`},u=(p,b,m)=>{if(Array.isArray(p)){let w=m.wrap===!0,g=m.capture?"":"?:";return w?`(${g}${p.join("|")})`:p.join("|")}return t(p,b,m)},L=(...p)=>new RangeError("Invalid range arguments: "+e.inspect(...p)),O=(p,b,m)=>{if(m.strictRanges===!0)throw L([p,b]);return[]},B=(p,b)=>{if(b.strictRanges===!0)throw new TypeError(`Expected step "${p}" to be a number`);return[]},_=(p,b,m=1,w={})=>{let g=Number(p),A=Number(b);if(!Number.isInteger(g)||!Number.isInteger(A)){if(w.strictRanges===!0)throw L([p,b]);return[]}g===0&&(g=0),A===0&&(A=0);let v=g>A,x=String(p),H=String(b),N=String(m);m=Math.max(Math.abs(m),1);let S=r(x)||r(H)||r(N),q=S?Math.max(x.length,H.length,N.length):0,k=S===!1&&a(p,b,w)===!1,M=w.transform||o(k);if(w.toRegex&&m===1)return E(l(p,q),l(b,q),!0,w);let P={negatives:[],positives:[]},Z=h=>P[h<0?"negatives":"positives"].push(Math.abs(h)),$e=[],J=0;for(;v?g>=A:g<=A;)w.toRegex===!0&&m>1?Z(g):$e.push(c(M(g,J),q,k)),g=v?g-m:g+m,J++;return w.toRegex===!0?m>1?f(P,w,q):u($e,null,{wrap:!1,...w}):$e},$=(p,b,m=1,w={})=>{if(!i(p)&&p.length>1||!i(b)&&b.length>1)return O(p,b,w);let g=w.transform||(k=>String.fromCharCode(k)),A=`${p}`.charCodeAt(0),v=`${b}`.charCodeAt(0),x=A>v,H=Math.min(A,v),N=Math.max(A,v);if(w.toRegex&&m===1)return E(H,N,!1,w);let S=[],q=0;for(;x?A>=v:A<=v;)S.push(g(A,q)),A=x?A-m:A+m,q++;return w.toRegex===!0?u(S,null,{wrap:!1,options:w}):S},R=(p,b,m,w={})=>{if(b==null&&s(p))return[p];if(!s(p)||!s(b))return O(p,b,w);if(typeof m=="function")return R(p,b,1,{transform:m});if(n(m))return R(p,b,0,m);let g={...w};return g.capture===!0&&(g.wrap=!0),m=m||g.step||1,i(m)?i(p)&&i(b)?_(p,b,m,g):$(p,b,Math.max(Math.abs(m),1),g):m!=null&&!n(m)?B(m,g):R(p,b,1,m)};return Bt=R,Bt}var qt,Dr;function Ql(){if(Dr)return qt;Dr=1;const e=Pr(),t=kt();return qt=(o,s={})=>{const i=(r,a={})=>{const c=t.isInvalidBrace(a),l=r.invalid===!0&&s.escapeInvalid===!0,f=c===!0||l===!0,E=s.escapeInvalid===!0?"\\":"";let u="";if(r.isOpen===!0)return E+r.value;if(r.isClose===!0)return console.log("node.isClose",E,r.value),E+r.value;if(r.type==="open")return f?E+r.value:"(";if(r.type==="close")return f?E+r.value:")";if(r.type==="comma")return r.prev.type==="comma"?"":f?r.value:"|";if(r.value)return r.value;if(r.nodes&&r.ranges>0){const L=t.reduce(r.nodes),O=e(...L,{...s,wrap:!1,toRegex:!0,strictZeros:!0});if(O.length!==0)return L.length>1&&O.length>1?`(${O})`:O}if(r.nodes)for(const L of r.nodes)u+=i(L,r);return u};return i(o)},qt}var Ut,kr;function Jl(){if(kr)return Ut;kr=1;const e=Pr(),t=Ht(),n=kt(),o=(i="",r="",a=!1)=>{const c=[];if(i=[].concat(i),r=[].concat(r),!r.length)return i;if(!i.length)return a?n.flatten(r).map(l=>`{${l}}`):r;for(const l of i)if(Array.isArray(l))for(const f of l)c.push(o(f,r,a));else for(let f of r)a===!0&&typeof f=="string"&&(f=`{${f}}`),c.push(Array.isArray(f)?o(l,f,a):l+f);return n.flatten(c)};return Ut=(i,r={})=>{const a=r.rangeLimit===void 0?1e3:r.rangeLimit,c=(l,f={})=>{l.queue=[];let E=f,u=f.queue;for(;E.type!=="brace"&&E.type!=="root"&&E.parent;)E=E.parent,u=E.queue;if(l.invalid||l.dollar){u.push(o(u.pop(),t(l,r)));return}if(l.type==="brace"&&l.invalid!==!0&&l.nodes.length===2){u.push(o(u.pop(),["{}"]));return}if(l.nodes&&l.ranges>0){const _=n.reduce(l.nodes);if(n.exceedsLimit(..._,r.step,a))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let $=e(..._,r);$.length===0&&($=t(l,r)),u.push(o(u.pop(),$)),l.nodes=[];return}const L=n.encloseBrace(l);let O=l.queue,B=l;for(;B.type!=="brace"&&B.type!=="root"&&B.parent;)B=B.parent,O=B.queue;for(let _=0;_<l.nodes.length;_++){const $=l.nodes[_];if($.type==="comma"&&l.type==="brace"){_===1&&O.push(""),O.push("");continue}if($.type==="close"){u.push(o(u.pop(),O,L));continue}if($.value&&$.type!=="open"){O.push(o(O.pop(),$.value));continue}$.nodes&&c($,l)}return O};return n.flatten(c(i))},Ut}var zt,Fr;function ep(){return Fr||(Fr=1,zt={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
30
+ `,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}),zt}var Kt,Hr;function tp(){if(Hr)return Kt;Hr=1;const e=Ht(),{MAX_LENGTH:t,CHAR_BACKSLASH:n,CHAR_BACKTICK:o,CHAR_COMMA:s,CHAR_DOT:i,CHAR_LEFT_PARENTHESES:r,CHAR_RIGHT_PARENTHESES:a,CHAR_LEFT_CURLY_BRACE:c,CHAR_RIGHT_CURLY_BRACE:l,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_RIGHT_SQUARE_BRACKET:E,CHAR_DOUBLE_QUOTE:u,CHAR_SINGLE_QUOTE:L,CHAR_NO_BREAK_SPACE:O,CHAR_ZERO_WIDTH_NOBREAK_SPACE:B}=ep();return Kt=($,R={})=>{if(typeof $!="string")throw new TypeError("Expected a string");const p=R||{},b=typeof p.maxLength=="number"?Math.min(t,p.maxLength):t;if($.length>b)throw new SyntaxError(`Input length (${$.length}), exceeds max characters (${b})`);const m={type:"root",input:$,nodes:[]},w=[m];let g=m,A=m,v=0;const x=$.length;let H=0,N=0,S;const q=()=>$[H++],k=M=>{if(M.type==="text"&&A.type==="dot"&&(A.type="text"),A&&A.type==="text"&&M.type==="text"){A.value+=M.value;return}return g.nodes.push(M),M.parent=g,M.prev=A,A=M,M};for(k({type:"bos"});H<x;)if(g=w[w.length-1],S=q(),!(S===B||S===O)){if(S===n){k({type:"text",value:(R.keepEscaping?S:"")+q()});continue}if(S===E){k({type:"text",value:"\\"+S});continue}if(S===f){v++;let M;for(;H<x&&(M=q());){if(S+=M,M===f){v++;continue}if(M===n){S+=q();continue}if(M===E&&(v--,v===0))break}k({type:"text",value:S});continue}if(S===r){g=k({type:"paren",nodes:[]}),w.push(g),k({type:"text",value:S});continue}if(S===a){if(g.type!=="paren"){k({type:"text",value:S});continue}g=w.pop(),k({type:"text",value:S}),g=w[w.length-1];continue}if(S===u||S===L||S===o){const M=S;let P;for(R.keepQuotes!==!0&&(S="");H<x&&(P=q());){if(P===n){S+=P+q();continue}if(P===M){R.keepQuotes===!0&&(S+=P);break}S+=P}k({type:"text",value:S});continue}if(S===c){N++;const P={type:"brace",open:!0,close:!1,dollar:A.value&&A.value.slice(-1)==="$"||g.dollar===!0,depth:N,commas:0,ranges:0,nodes:[]};g=k(P),w.push(g),k({type:"open",value:S});continue}if(S===l){if(g.type!=="brace"){k({type:"text",value:S});continue}const M="close";g=w.pop(),g.close=!0,k({type:M,value:S}),N--,g=w[w.length-1];continue}if(S===s&&N>0){if(g.ranges>0){g.ranges=0;const M=g.nodes.shift();g.nodes=[M,{type:"text",value:e(g)}]}k({type:"comma",value:S}),g.commas++;continue}if(S===i&&N>0&&g.commas===0){const M=g.nodes;if(N===0||M.length===0){k({type:"text",value:S});continue}if(A.type==="dot"){if(g.range=[],A.value+=S,A.type="range",g.nodes.length!==3&&g.nodes.length!==5){g.invalid=!0,g.ranges=0,A.type="text";continue}g.ranges++,g.args=[];continue}if(A.type==="range"){M.pop();const P=M[M.length-1];P.value+=A.value+S,A=P,g.ranges--;continue}k({type:"dot",value:S});continue}k({type:"text",value:S})}do if(g=w.pop(),g.type!=="root"){g.nodes.forEach(Z=>{Z.nodes||(Z.type==="open"&&(Z.isOpen=!0),Z.type==="close"&&(Z.isClose=!0),Z.nodes||(Z.type="text"),Z.invalid=!0)});const M=w[w.length-1],P=M.nodes.indexOf(g);M.nodes.splice(P,1,...g.nodes)}while(w.length>0);return k({type:"eos"}),m},Kt}var Xt,Mr;function np(){if(Mr)return Xt;Mr=1;const e=Ht(),t=Ql(),n=Jl(),o=tp(),s=(i,r={})=>{let a=[];if(Array.isArray(i))for(const c of i){const l=s.create(c,r);Array.isArray(l)?a.push(...l):a.push(l)}else a=[].concat(s.create(i,r));return r&&r.expand===!0&&r.nodupes===!0&&(a=[...new Set(a)]),a};return s.parse=(i,r={})=>o(i,r),s.stringify=(i,r={})=>e(typeof i=="string"?s.parse(i,r):i,r),s.compile=(i,r={})=>(typeof i=="string"&&(i=s.parse(i,r)),t(i,r)),s.expand=(i,r={})=>{typeof i=="string"&&(i=s.parse(i,r));let a=n(i,r);return r.noempty===!0&&(a=a.filter(Boolean)),r.nodupes===!0&&(a=[...new Set(a)]),a},s.create=(i,r={})=>i===""||i.length<3?[i]:r.expand!==!0?s.compile(i,r):s.expand(i,r),Xt=s,Xt}var Vt={},Wt,Gr;function ht(){if(Gr)return Wt;Gr=1;const e=W,t="\\\\/",n=`[^${t}]`,o="\\.",s="\\+",i="\\?",r="\\/",a="(?=.)",c="[^/]",l=`(?:${r}|$)`,f=`(?:^|${r})`,E=`${o}{1,2}${l}`,u=`(?!${o})`,L=`(?!${f}${E})`,O=`(?!${o}{0,1}${l})`,B=`(?!${E})`,_=`[^.${r}]`,$=`${c}*?`,R={DOT_LITERAL:o,PLUS_LITERAL:s,QMARK_LITERAL:i,SLASH_LITERAL:r,ONE_CHAR:a,QMARK:c,END_ANCHOR:l,DOTS_SLASH:E,NO_DOT:u,NO_DOTS:L,NO_DOT_SLASH:O,NO_DOTS_SLASH:B,QMARK_NO_DOT:_,STAR:$,START_ANCHOR:f},p={...R,SLASH_LITERAL:`[${t}]`,QMARK:n,STAR:`${n}*?`,DOTS_SLASH:`${o}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${t}])${o}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`},b={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return Wt={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:b,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:e.sep,extglobChars(m){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${m.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(m){return m===!0?p:R}},Wt}var Br;function mt(){return Br||(Br=1,(function(e){const t=W,n=process.platform==="win32",{REGEX_BACKSLASH:o,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:r}=ht();e.isObject=a=>a!==null&&typeof a=="object"&&!Array.isArray(a),e.hasRegexChars=a=>i.test(a),e.isRegexChar=a=>a.length===1&&e.hasRegexChars(a),e.escapeRegex=a=>a.replace(r,"\\$1"),e.toPosixSlashes=a=>a.replace(o,"/"),e.removeBackslashes=a=>a.replace(s,c=>c==="\\"?"":c),e.supportsLookbehinds=()=>{const a=process.version.slice(1).split(".").map(Number);return a.length===3&&a[0]>=9||a[0]===8&&a[1]>=10},e.isWindows=a=>a&&typeof a.windows=="boolean"?a.windows:n===!0||t.sep==="\\",e.escapeLast=(a,c,l)=>{const f=a.lastIndexOf(c,l);return f===-1?a:a[f-1]==="\\"?e.escapeLast(a,c,f-1):`${a.slice(0,f)}\\${a.slice(f)}`},e.removePrefix=(a,c={})=>{let l=a;return l.startsWith("./")&&(l=l.slice(2),c.prefix="./"),l},e.wrapOutput=(a,c={},l={})=>{const f=l.contains?"":"^",E=l.contains?"":"$";let u=`${f}(?:${a})${E}`;return c.negated===!0&&(u=`(?:^(?!${u}).*$)`),u}})(Vt)),Vt}var Yt,qr;function op(){if(qr)return Yt;qr=1;const e=mt(),{CHAR_ASTERISK:t,CHAR_AT:n,CHAR_BACKWARD_SLASH:o,CHAR_COMMA:s,CHAR_DOT:i,CHAR_EXCLAMATION_MARK:r,CHAR_FORWARD_SLASH:a,CHAR_LEFT_CURLY_BRACE:c,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_PLUS:E,CHAR_QUESTION_MARK:u,CHAR_RIGHT_CURLY_BRACE:L,CHAR_RIGHT_PARENTHESES:O,CHAR_RIGHT_SQUARE_BRACKET:B}=ht(),_=p=>p===a||p===o,$=p=>{p.isPrefix!==!0&&(p.depth=p.isGlobstar?1/0:1)};return Yt=(p,b)=>{const m=b||{},w=p.length-1,g=m.parts===!0||m.scanToEnd===!0,A=[],v=[],x=[];let H=p,N=-1,S=0,q=0,k=!1,M=!1,P=!1,Z=!1,$e=!1,J=!1,h=!1,fe=!1,Te=!1,pe=!1,d=0,y,F,D={value:"",depth:0,isGlob:!1};const me=()=>N>=w,Ie=()=>H.charCodeAt(N+1),ee=()=>(y=F,H.charCodeAt(++N));for(;N<w;){F=ee();let j;if(F===o){h=D.backslashes=!0,F=ee(),F===c&&(J=!0);continue}if(J===!0||F===c){for(d++;me()!==!0&&(F=ee());){if(F===o){h=D.backslashes=!0,ee();continue}if(F===c){d++;continue}if(J!==!0&&F===i&&(F=ee())===i){if(k=D.isBrace=!0,P=D.isGlob=!0,pe=!0,g===!0)continue;break}if(J!==!0&&F===s){if(k=D.isBrace=!0,P=D.isGlob=!0,pe=!0,g===!0)continue;break}if(F===L&&(d--,d===0)){J=!1,k=D.isBrace=!0,pe=!0;break}}if(g===!0)continue;break}if(F===a){if(A.push(N),v.push(D),D={value:"",depth:0,isGlob:!1},pe===!0)continue;if(y===i&&N===S+1){S+=2;continue}q=N+1;continue}if(m.noext!==!0&&(F===E||F===n||F===t||F===u||F===r)===!0&&Ie()===l){if(P=D.isGlob=!0,Z=D.isExtglob=!0,pe=!0,F===r&&N===S&&(Te=!0),g===!0){for(;me()!==!0&&(F=ee());){if(F===o){h=D.backslashes=!0,F=ee();continue}if(F===O){P=D.isGlob=!0,pe=!0;break}}continue}break}if(F===t){if(y===t&&($e=D.isGlobstar=!0),P=D.isGlob=!0,pe=!0,g===!0)continue;break}if(F===u){if(P=D.isGlob=!0,pe=!0,g===!0)continue;break}if(F===f){for(;me()!==!0&&(j=ee());){if(j===o){h=D.backslashes=!0,ee();continue}if(j===B){M=D.isBracket=!0,P=D.isGlob=!0,pe=!0;break}}if(g===!0)continue;break}if(m.nonegate!==!0&&F===r&&N===S){fe=D.negated=!0,S++;continue}if(m.noparen!==!0&&F===l){if(P=D.isGlob=!0,g===!0){for(;me()!==!0&&(F=ee());){if(F===l){h=D.backslashes=!0,F=ee();continue}if(F===O){pe=!0;break}}continue}break}if(P===!0){if(pe=!0,g===!0)continue;break}}m.noext===!0&&(Z=!1,P=!1);let te=H,Ze="",we="";S>0&&(Ze=H.slice(0,S),H=H.slice(S),q-=S),te&&P===!0&&q>0?(te=H.slice(0,q),we=H.slice(q)):P===!0?(te="",we=H):te=H,te&&te!==""&&te!=="/"&&te!==H&&_(te.charCodeAt(te.length-1))&&(te=te.slice(0,-1)),m.unescape===!0&&(we&&(we=e.removeBackslashes(we)),te&&h===!0&&(te=e.removeBackslashes(te)));const de={prefix:Ze,input:p,start:S,base:te,glob:we,isBrace:k,isBracket:M,isGlob:P,isExtglob:Z,isGlobstar:$e,negated:fe,negatedExtglob:Te};if(m.tokens===!0&&(de.maxDepth=0,_(F)||v.push(D),de.tokens=v),m.parts===!0||m.tokens===!0){let j;for(let ne=0;ne<A.length;ne++){const Et=j?j+1:S,C=A[ne],X=p.slice(Et,C);m.tokens&&(ne===0&&S!==0?(v[ne].isPrefix=!0,v[ne].value=Ze):v[ne].value=X,$(v[ne]),de.maxDepth+=v[ne].depth),(ne!==0||X!=="")&&x.push(X),j=C}if(j&&j+1<p.length){const ne=p.slice(j+1);x.push(ne),m.tokens&&(v[v.length-1].value=ne,$(v[v.length-1]),de.maxDepth+=v[v.length-1].depth)}de.slashes=A,de.parts=x}return de},Yt}var Zt,Ur;function sp(){if(Ur)return Zt;Ur=1;const e=ht(),t=mt(),{MAX_LENGTH:n,POSIX_REGEX_SOURCE:o,REGEX_NON_SPECIAL_CHARS:s,REGEX_SPECIAL_CHARS_BACKREF:i,REPLACEMENTS:r}=e,a=(f,E)=>{if(typeof E.expandRange=="function")return E.expandRange(...f,E);f.sort();const u=`[${f.join("-")}]`;try{new RegExp(u)}catch{return f.map(O=>t.escapeRegex(O)).join("..")}return u},c=(f,E)=>`Missing ${f}: "${E}" - use "\\\\${E}" to match literal characters`,l=(f,E)=>{if(typeof f!="string")throw new TypeError("Expected a string");f=r[f]||f;const u={...E},L=typeof u.maxLength=="number"?Math.min(n,u.maxLength):n;let O=f.length;if(O>L)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${L}`);const B={type:"bos",value:"",output:u.prepend||""},_=[B],$=u.capture?"":"?:",R=t.isWindows(E),p=e.globChars(R),b=e.extglobChars(p),{DOT_LITERAL:m,PLUS_LITERAL:w,SLASH_LITERAL:g,ONE_CHAR:A,DOTS_SLASH:v,NO_DOT:x,NO_DOT_SLASH:H,NO_DOTS_SLASH:N,QMARK:S,QMARK_NO_DOT:q,STAR:k,START_ANCHOR:M}=p,P=C=>`(${$}(?:(?!${M}${C.dot?v:m}).)*?)`,Z=u.dot?"":x,$e=u.dot?S:q;let J=u.bash===!0?P(u):k;u.capture&&(J=`(${J})`),typeof u.noext=="boolean"&&(u.noextglob=u.noext);const h={input:f,index:-1,start:0,dot:u.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:_};f=t.removePrefix(f,h),O=f.length;const fe=[],Te=[],pe=[];let d=B,y;const F=()=>h.index===O-1,D=h.peek=(C=1)=>f[h.index+C],me=h.advance=()=>f[++h.index]||"",Ie=()=>f.slice(h.index+1),ee=(C="",X=0)=>{h.consumed+=C,h.index+=X},te=C=>{h.output+=C.output!=null?C.output:C.value,ee(C.value)},Ze=()=>{let C=1;for(;D()==="!"&&(D(2)!=="("||D(3)==="?");)me(),h.start++,C++;return C%2===0?!1:(h.negated=!0,h.start++,!0)},we=C=>{h[C]++,pe.push(C)},de=C=>{h[C]--,pe.pop()},j=C=>{if(d.type==="globstar"){const X=h.braces>0&&(C.type==="comma"||C.type==="brace"),T=C.extglob===!0||fe.length&&(C.type==="pipe"||C.type==="paren");C.type!=="slash"&&C.type!=="paren"&&!X&&!T&&(h.output=h.output.slice(0,-d.output.length),d.type="star",d.value="*",d.output=J,h.output+=d.output)}if(fe.length&&C.type!=="paren"&&(fe[fe.length-1].inner+=C.value),(C.value||C.output)&&te(C),d&&d.type==="text"&&C.type==="text"){d.value+=C.value,d.output=(d.output||"")+C.value;return}C.prev=d,_.push(C),d=C},ne=(C,X)=>{const T={...b[X],conditions:1,inner:""};T.prev=d,T.parens=h.parens,T.output=h.output;const G=(u.capture?"(":"")+T.open;we("parens"),j({type:C,value:X,output:h.output?"":A}),j({type:"paren",extglob:!0,value:me(),output:G}),fe.push(T)},Et=C=>{let X=C.close+(u.capture?")":""),T;if(C.type==="negate"){let G=J;if(C.inner&&C.inner.length>1&&C.inner.includes("/")&&(G=P(u)),(G!==J||F()||/^\)+$/.test(Ie()))&&(X=C.close=`)$))${G}`),C.inner.includes("*")&&(T=Ie())&&/^\.[^\\/.]+$/.test(T)){const Q=l(T,{...E,fastpaths:!1}).output;X=C.close=`)${Q})${G})`}C.prev.type==="bos"&&(h.negatedExtglob=!0)}j({type:"paren",extglob:!0,value:y,output:X}),de("parens")};if(u.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(f)){let C=!1,X=f.replace(i,(T,G,Q,he,oe,bt)=>he==="\\"?(C=!0,T):he==="?"?G?G+he+(oe?S.repeat(oe.length):""):bt===0?$e+(oe?S.repeat(oe.length):""):S.repeat(Q.length):he==="."?m.repeat(Q.length):he==="*"?G?G+he+(oe?J:""):J:G?T:`\\${T}`);return C===!0&&(u.unescape===!0?X=X.replace(/\\/g,""):X=X.replace(/\\+/g,T=>T.length%2===0?"\\\\":T?"\\":"")),X===f&&u.contains===!0?(h.output=f,h):(h.output=t.wrapOutput(X,h,E),h)}for(;!F();){if(y=me(),y==="\0")continue;if(y==="\\"){const T=D();if(T==="/"&&u.bash!==!0||T==="."||T===";")continue;if(!T){y+="\\",j({type:"text",value:y});continue}const G=/^\\+/.exec(Ie());let Q=0;if(G&&G[0].length>2&&(Q=G[0].length,h.index+=Q,Q%2!==0&&(y+="\\")),u.unescape===!0?y=me():y+=me(),h.brackets===0){j({type:"text",value:y});continue}}if(h.brackets>0&&(y!=="]"||d.value==="["||d.value==="[^")){if(u.posix!==!1&&y===":"){const T=d.value.slice(1);if(T.includes("[")&&(d.posix=!0,T.includes(":"))){const G=d.value.lastIndexOf("["),Q=d.value.slice(0,G),he=d.value.slice(G+2),oe=o[he];if(oe){d.value=Q+oe,h.backtrack=!0,me(),!B.output&&_.indexOf(d)===1&&(B.output=A);continue}}}(y==="["&&D()!==":"||y==="-"&&D()==="]")&&(y=`\\${y}`),y==="]"&&(d.value==="["||d.value==="[^")&&(y=`\\${y}`),u.posix===!0&&y==="!"&&d.value==="["&&(y="^"),d.value+=y,te({value:y});continue}if(h.quotes===1&&y!=='"'){y=t.escapeRegex(y),d.value+=y,te({value:y});continue}if(y==='"'){h.quotes=h.quotes===1?0:1,u.keepQuotes===!0&&j({type:"text",value:y});continue}if(y==="("){we("parens"),j({type:"paren",value:y});continue}if(y===")"){if(h.parens===0&&u.strictBrackets===!0)throw new SyntaxError(c("opening","("));const T=fe[fe.length-1];if(T&&h.parens===T.parens+1){Et(fe.pop());continue}j({type:"paren",value:y,output:h.parens?")":"\\)"}),de("parens");continue}if(y==="["){if(u.nobracket===!0||!Ie().includes("]")){if(u.nobracket!==!0&&u.strictBrackets===!0)throw new SyntaxError(c("closing","]"));y=`\\${y}`}else we("brackets");j({type:"bracket",value:y});continue}if(y==="]"){if(u.nobracket===!0||d&&d.type==="bracket"&&d.value.length===1){j({type:"text",value:y,output:`\\${y}`});continue}if(h.brackets===0){if(u.strictBrackets===!0)throw new SyntaxError(c("opening","["));j({type:"text",value:y,output:`\\${y}`});continue}de("brackets");const T=d.value.slice(1);if(d.posix!==!0&&T[0]==="^"&&!T.includes("/")&&(y=`/${y}`),d.value+=y,te({value:y}),u.literalBrackets===!1||t.hasRegexChars(T))continue;const G=t.escapeRegex(d.value);if(h.output=h.output.slice(0,-d.value.length),u.literalBrackets===!0){h.output+=G,d.value=G;continue}d.value=`(${$}${G}|${d.value})`,h.output+=d.value;continue}if(y==="{"&&u.nobrace!==!0){we("braces");const T={type:"brace",value:y,output:"(",outputIndex:h.output.length,tokensIndex:h.tokens.length};Te.push(T),j(T);continue}if(y==="}"){const T=Te[Te.length-1];if(u.nobrace===!0||!T){j({type:"text",value:y,output:y});continue}let G=")";if(T.dots===!0){const Q=_.slice(),he=[];for(let oe=Q.length-1;oe>=0&&(_.pop(),Q[oe].type!=="brace");oe--)Q[oe].type!=="dots"&&he.unshift(Q[oe].value);G=a(he,u),h.backtrack=!0}if(T.comma!==!0&&T.dots!==!0){const Q=h.output.slice(0,T.outputIndex),he=h.tokens.slice(T.tokensIndex);T.value=T.output="\\{",y=G="\\}",h.output=Q;for(const oe of he)h.output+=oe.output||oe.value}j({type:"brace",value:y,output:G}),de("braces"),Te.pop();continue}if(y==="|"){fe.length>0&&fe[fe.length-1].conditions++,j({type:"text",value:y});continue}if(y===","){let T=y;const G=Te[Te.length-1];G&&pe[pe.length-1]==="braces"&&(G.comma=!0,T="|"),j({type:"comma",value:y,output:T});continue}if(y==="/"){if(d.type==="dot"&&h.index===h.start+1){h.start=h.index+1,h.consumed="",h.output="",_.pop(),d=B;continue}j({type:"slash",value:y,output:g});continue}if(y==="."){if(h.braces>0&&d.type==="dot"){d.value==="."&&(d.output=m);const T=Te[Te.length-1];d.type="dots",d.output+=y,d.value+=y,T.dots=!0;continue}if(h.braces+h.parens===0&&d.type!=="bos"&&d.type!=="slash"){j({type:"text",value:y,output:m});continue}j({type:"dot",value:y,output:m});continue}if(y==="?"){if(!(d&&d.value==="(")&&u.noextglob!==!0&&D()==="("&&D(2)!=="?"){ne("qmark",y);continue}if(d&&d.type==="paren"){const G=D();let Q=y;if(G==="<"&&!t.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(d.value==="("&&!/[!=<:]/.test(G)||G==="<"&&!/<([!=]|\w+>)/.test(Ie()))&&(Q=`\\${y}`),j({type:"text",value:y,output:Q});continue}if(u.dot!==!0&&(d.type==="slash"||d.type==="bos")){j({type:"qmark",value:y,output:q});continue}j({type:"qmark",value:y,output:S});continue}if(y==="!"){if(u.noextglob!==!0&&D()==="("&&(D(2)!=="?"||!/[!=<:]/.test(D(3)))){ne("negate",y);continue}if(u.nonegate!==!0&&h.index===0){Ze();continue}}if(y==="+"){if(u.noextglob!==!0&&D()==="("&&D(2)!=="?"){ne("plus",y);continue}if(d&&d.value==="("||u.regex===!1){j({type:"plus",value:y,output:w});continue}if(d&&(d.type==="bracket"||d.type==="paren"||d.type==="brace")||h.parens>0){j({type:"plus",value:y});continue}j({type:"plus",value:w});continue}if(y==="@"){if(u.noextglob!==!0&&D()==="("&&D(2)!=="?"){j({type:"at",extglob:!0,value:y,output:""});continue}j({type:"text",value:y});continue}if(y!=="*"){(y==="$"||y==="^")&&(y=`\\${y}`);const T=s.exec(Ie());T&&(y+=T[0],h.index+=T[0].length),j({type:"text",value:y});continue}if(d&&(d.type==="globstar"||d.star===!0)){d.type="star",d.star=!0,d.value+=y,d.output=J,h.backtrack=!0,h.globstar=!0,ee(y);continue}let C=Ie();if(u.noextglob!==!0&&/^\([^?]/.test(C)){ne("star",y);continue}if(d.type==="star"){if(u.noglobstar===!0){ee(y);continue}const T=d.prev,G=T.prev,Q=T.type==="slash"||T.type==="bos",he=G&&(G.type==="star"||G.type==="globstar");if(u.bash===!0&&(!Q||C[0]&&C[0]!=="/")){j({type:"star",value:y,output:""});continue}const oe=h.braces>0&&(T.type==="comma"||T.type==="brace"),bt=fe.length&&(T.type==="pipe"||T.type==="paren");if(!Q&&T.type!=="paren"&&!oe&&!bt){j({type:"star",value:y,output:""});continue}for(;C.slice(0,3)==="/**";){const at=f[h.index+4];if(at&&at!=="/")break;C=C.slice(3),ee("/**",3)}if(T.type==="bos"&&F()){d.type="globstar",d.value+=y,d.output=P(u),h.output=d.output,h.globstar=!0,ee(y);continue}if(T.type==="slash"&&T.prev.type!=="bos"&&!he&&F()){h.output=h.output.slice(0,-(T.output+d.output).length),T.output=`(?:${T.output}`,d.type="globstar",d.output=P(u)+(u.strictSlashes?")":"|$)"),d.value+=y,h.globstar=!0,h.output+=T.output+d.output,ee(y);continue}if(T.type==="slash"&&T.prev.type!=="bos"&&C[0]==="/"){const at=C[1]!==void 0?"|$":"";h.output=h.output.slice(0,-(T.output+d.output).length),T.output=`(?:${T.output}`,d.type="globstar",d.output=`${P(u)}${g}|${g}${at})`,d.value+=y,h.output+=T.output+d.output,h.globstar=!0,ee(y+me()),j({type:"slash",value:"/",output:""});continue}if(T.type==="bos"&&C[0]==="/"){d.type="globstar",d.value+=y,d.output=`(?:^|${g}|${P(u)}${g})`,h.output=d.output,h.globstar=!0,ee(y+me()),j({type:"slash",value:"/",output:""});continue}h.output=h.output.slice(0,-d.output.length),d.type="globstar",d.output=P(u),d.value+=y,h.output+=d.output,h.globstar=!0,ee(y);continue}const X={type:"star",value:y,output:J};if(u.bash===!0){X.output=".*?",(d.type==="bos"||d.type==="slash")&&(X.output=Z+X.output),j(X);continue}if(d&&(d.type==="bracket"||d.type==="paren")&&u.regex===!0){X.output=y,j(X);continue}(h.index===h.start||d.type==="slash"||d.type==="dot")&&(d.type==="dot"?(h.output+=H,d.output+=H):u.dot===!0?(h.output+=N,d.output+=N):(h.output+=Z,d.output+=Z),D()!=="*"&&(h.output+=A,d.output+=A)),j(X)}for(;h.brackets>0;){if(u.strictBrackets===!0)throw new SyntaxError(c("closing","]"));h.output=t.escapeLast(h.output,"["),de("brackets")}for(;h.parens>0;){if(u.strictBrackets===!0)throw new SyntaxError(c("closing",")"));h.output=t.escapeLast(h.output,"("),de("parens")}for(;h.braces>0;){if(u.strictBrackets===!0)throw new SyntaxError(c("closing","}"));h.output=t.escapeLast(h.output,"{"),de("braces")}if(u.strictSlashes!==!0&&(d.type==="star"||d.type==="bracket")&&j({type:"maybe_slash",value:"",output:`${g}?`}),h.backtrack===!0){h.output="";for(const C of h.tokens)h.output+=C.output!=null?C.output:C.value,C.suffix&&(h.output+=C.suffix)}return h};return l.fastpaths=(f,E)=>{const u={...E},L=typeof u.maxLength=="number"?Math.min(n,u.maxLength):n,O=f.length;if(O>L)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${L}`);f=r[f]||f;const B=t.isWindows(E),{DOT_LITERAL:_,SLASH_LITERAL:$,ONE_CHAR:R,DOTS_SLASH:p,NO_DOT:b,NO_DOTS:m,NO_DOTS_SLASH:w,STAR:g,START_ANCHOR:A}=e.globChars(B),v=u.dot?m:b,x=u.dot?w:b,H=u.capture?"":"?:",N={negated:!1,prefix:""};let S=u.bash===!0?".*?":g;u.capture&&(S=`(${S})`);const q=Z=>Z.noglobstar===!0?S:`(${H}(?:(?!${A}${Z.dot?p:_}).)*?)`,k=Z=>{switch(Z){case"*":return`${v}${R}${S}`;case".*":return`${_}${R}${S}`;case"*.*":return`${v}${S}${_}${R}${S}`;case"*/*":return`${v}${S}${$}${R}${x}${S}`;case"**":return v+q(u);case"**/*":return`(?:${v}${q(u)}${$})?${x}${R}${S}`;case"**/*.*":return`(?:${v}${q(u)}${$})?${x}${S}${_}${R}${S}`;case"**/.*":return`(?:${v}${q(u)}${$})?${_}${R}${S}`;default:{const $e=/^(.*?)\.(\w+)$/.exec(Z);if(!$e)return;const J=k($e[1]);return J?J+_+$e[2]:void 0}}},M=t.removePrefix(f,N);let P=k(M);return P&&u.strictSlashes!==!0&&(P+=`${$}?`),P},Zt=l,Zt}var Qt,zr;function rp(){if(zr)return Qt;zr=1;const e=W,t=op(),n=sp(),o=mt(),s=ht(),i=a=>a&&typeof a=="object"&&!Array.isArray(a),r=(a,c,l=!1)=>{if(Array.isArray(a)){const $=a.map(p=>r(p,c,l));return p=>{for(const b of $){const m=b(p);if(m)return m}return!1}}const f=i(a)&&a.tokens&&a.input;if(a===""||typeof a!="string"&&!f)throw new TypeError("Expected pattern to be a non-empty string");const E=c||{},u=o.isWindows(c),L=f?r.compileRe(a,c):r.makeRe(a,c,!1,!0),O=L.state;delete L.state;let B=()=>!1;if(E.ignore){const $={...c,ignore:null,onMatch:null,onResult:null};B=r(E.ignore,$,l)}const _=($,R=!1)=>{const{isMatch:p,match:b,output:m}=r.test($,L,c,{glob:a,posix:u}),w={glob:a,state:O,regex:L,posix:u,input:$,output:m,match:b,isMatch:p};return typeof E.onResult=="function"&&E.onResult(w),p===!1?(w.isMatch=!1,R?w:!1):B($)?(typeof E.onIgnore=="function"&&E.onIgnore(w),w.isMatch=!1,R?w:!1):(typeof E.onMatch=="function"&&E.onMatch(w),R?w:!0)};return l&&(_.state=O),_};return r.test=(a,c,l,{glob:f,posix:E}={})=>{if(typeof a!="string")throw new TypeError("Expected input to be a string");if(a==="")return{isMatch:!1,output:""};const u=l||{},L=u.format||(E?o.toPosixSlashes:null);let O=a===f,B=O&&L?L(a):a;return O===!1&&(B=L?L(a):a,O=B===f),(O===!1||u.capture===!0)&&(u.matchBase===!0||u.basename===!0?O=r.matchBase(a,c,l,E):O=c.exec(B)),{isMatch:!!O,match:O,output:B}},r.matchBase=(a,c,l,f=o.isWindows(l))=>(c instanceof RegExp?c:r.makeRe(c,l)).test(e.basename(a)),r.isMatch=(a,c,l)=>r(c,l)(a),r.parse=(a,c)=>Array.isArray(a)?a.map(l=>r.parse(l,c)):n(a,{...c,fastpaths:!1}),r.scan=(a,c)=>t(a,c),r.compileRe=(a,c,l=!1,f=!1)=>{if(l===!0)return a.output;const E=c||{},u=E.contains?"":"^",L=E.contains?"":"$";let O=`${u}(?:${a.output})${L}`;a&&a.negated===!0&&(O=`^(?!${O}).*$`);const B=r.toRegex(O,c);return f===!0&&(B.state=a),B},r.makeRe=(a,c={},l=!1,f=!1)=>{if(!a||typeof a!="string")throw new TypeError("Expected a non-empty string");let E={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(a[0]==="."||a[0]==="*")&&(E.output=n.fastpaths(a,c)),E.output||(E=n(a,c)),r.compileRe(E,c,l,f)},r.toRegex=(a,c)=>{try{const l=c||{};return new RegExp(a,l.flags||(l.nocase?"i":""))}catch(l){if(c&&c.debug===!0)throw l;return/$^/}},r.constants=s,Qt=r,Qt}var Jt,Kr;function ip(){return Kr||(Kr=1,Jt=rp()),Jt}var en,Xr;function ap(){if(Xr)return en;Xr=1;const e=bn,t=np(),n=ip(),o=mt(),s=a=>a===""||a==="./",i=a=>{const c=a.indexOf("{");return c>-1&&a.indexOf("}",c)>-1},r=(a,c,l)=>{c=[].concat(c),a=[].concat(a);let f=new Set,E=new Set,u=new Set,L=0,O=$=>{u.add($.output),l&&l.onResult&&l.onResult($)};for(let $=0;$<c.length;$++){let R=n(String(c[$]),{...l,onResult:O},!0),p=R.state.negated||R.state.negatedExtglob;p&&L++;for(let b of a){let m=R(b,!0);(p?!m.isMatch:m.isMatch)&&(p?f.add(m.output):(f.delete(m.output),E.add(m.output)))}}let _=(L===c.length?[...u]:[...E]).filter($=>!f.has($));if(l&&_.length===0){if(l.failglob===!0)throw new Error(`No matches found for "${c.join(", ")}"`);if(l.nonull===!0||l.nullglob===!0)return l.unescape?c.map($=>$.replace(/\\/g,"")):c}return _};return r.match=r,r.matcher=(a,c)=>n(a,c),r.isMatch=(a,c,l)=>n(c,l)(a),r.any=r.isMatch,r.not=(a,c,l={})=>{c=[].concat(c).map(String);let f=new Set,E=[],u=O=>{l.onResult&&l.onResult(O),E.push(O.output)},L=new Set(r(a,c,{...l,onResult:u}));for(let O of E)L.has(O)||f.add(O);return[...f]},r.contains=(a,c,l)=>{if(typeof a!="string")throw new TypeError(`Expected a string: "${e.inspect(a)}"`);if(Array.isArray(c))return c.some(f=>r.contains(a,f,l));if(typeof c=="string"){if(s(a)||s(c))return!1;if(a.includes(c)||a.startsWith("./")&&a.slice(2).includes(c))return!0}return r.isMatch(a,c,{...l,contains:!0})},r.matchKeys=(a,c,l)=>{if(!o.isObject(a))throw new TypeError("Expected the first argument to be an object");let f=r(Object.keys(a),c,l),E={};for(let u of f)E[u]=a[u];return E},r.some=(a,c,l)=>{let f=[].concat(a);for(let E of[].concat(c)){let u=n(String(E),l);if(f.some(L=>u(L)))return!0}return!1},r.every=(a,c,l)=>{let f=[].concat(a);for(let E of[].concat(c)){let u=n(String(E),l);if(!f.every(L=>u(L)))return!1}return!0},r.all=(a,c,l)=>{if(typeof a!="string")throw new TypeError(`Expected a string: "${e.inspect(a)}"`);return[].concat(c).every(f=>n(f,l)(a))},r.capture=(a,c,l)=>{let f=o.isWindows(l),u=n.makeRe(String(a),{...l,capture:!0}).exec(f?o.toPosixSlashes(c):c);if(u)return u.slice(1).map(L=>L===void 0?"":L)},r.makeRe=(...a)=>n.makeRe(...a),r.scan=(...a)=>n.scan(...a),r.parse=(a,c)=>{let l=[];for(let f of[].concat(a||[]))for(let E of t(String(f),c))l.push(n.parse(E,c));return l},r.braces=(a,c)=>{if(typeof a!="string")throw new TypeError("Expected a string");return c&&c.nobrace===!0||!i(a)?[a]:t(a,c)},r.braceExpand=(a,c)=>{if(typeof a!="string")throw new TypeError("Expected a string");return r.braces(a,{...c,expand:!0})},r.hasBraces=i,en=r,en}var cp=ap();const lp=Wl(cp);function Vr(e,t,n){ct.statSync(e).isDirectory()?(ct.mkdirSync(t,{recursive:!0}),ct.readdirSync(e).forEach(o=>{const s=Oe.resolve(e,o),i=Oe.resolve(t,o);Vr(s,i,n)})):lp.isMatch(e,n)||ct.copyFileSync(e,t)}function Fe(e,t,n,o,s=[]){const i=Oe.join(e,o?.[n]??n);Vr(Oe.join(t,n),i,s)}function pp(e){return{renameFiles:{"example-template":`${e}`},targetPath:e,sourcePath:"template/page-templates",onTemplateCreated:()=>I.info(`Template [${e}] with pages structure named has been created`)}}function Ne(e){return ye.resolve(vi(import.meta.url),"../..",e)}function up(){const e=Ne("package.json");return e!==""?JSON.parse(se.readFileSync(e,"utf8")):{}}async function fp(e){try{const t=e,n=ae.cwd(),o=ye.join(n,t),s=["templates","headers","preview","footers","reference","page-templates","layouts"],i={_gitignore:".gitignore"};se.existsSync(o)?(I.error(`App with the name: ${e} already exists. If you'd like to override it, delete previous version first`),ae.exit(1)):se.mkdirSync(o);const r=Ne("template");se.readdirSync(r).filter(f=>f!=="package.json").filter(f=>!s.includes(f)).forEach(async f=>Fe(o,r,f,i));const a=JSON.parse(se.readFileSync(ye.join(r,"package.json"),"utf-8"));a.name=e;const c=up();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=ye.join(o,"package.json");se.writeFileSync(l,`${JSON.stringify(a,null,2)}
31
+ `),I.info(`App ${e} created`)}catch(t){I.error(`Error while creating app: ${t.message}`),ae.exit(1)}}function tn(e,t,n,o){try{const s=ae.cwd(),i=W.join(s,t);V.existsSync(i)||V.mkdirSync(i);const r=W.join(s,t,n);V.existsSync(r)?(I.error(`${o} with the name: ${n} already exists. If you'd like to override it, delete previous version first`),ae.exit(1)):V.mkdirSync(r);const a=Ne(e);V.readdirSync(a).forEach(async c=>Fe(r,a,c)),I.info(`${o} ${n} created`)}catch(s){I.error(`Error while creating ${o}: ${s.message}`),ae.exit(1)}}function nn(e){const t=ae.cwd(),n=Ne(`template/${e}`),o=W.join(t,e);V.existsSync(o)||(V.mkdirSync(o),V.readdirSync(n).forEach(async s=>Fe(o,n,s)))}function dp(e,t,n){if(!V.existsSync(n)){V.copyFileSync(t,n);return}const o=V.readFileSync(t),s=V.readFileSync(n);o.equals(s)||I.warn(`File "${e.name}" exists but differs from template. File will be skipped, this may lead to issues.`)}function Wr(e,t){const n=V.readdirSync(e,{withFileTypes:!0});V.existsSync(t)||V.mkdirSync(t,{recursive:!0}),n.forEach(o=>{const s=W.join(e,o.name),i=W.join(t,o.name);o.isDirectory()?Wr(s,i):dp(o,s,i)})}function on(){try{const e=ae.cwd(),t=W.join(e,"shared"),n=Ne("template/shared");if(!V.existsSync(n))return;Wr(n,t)}catch(e){I.error(`Error while processing shared folder: ${e.message}`),ae.exit(1)}}async function hp(e){on(),tn("template/sections/example-section","sections",e,"Section")}async function mp(e){on(),tn("template/footers/example-footer","footers",e,"Footer")}async function yp(e){on(),tn("template/headers/example-header","headers",e,"Header")}async function gp(e,t){try{const n=ae.cwd(),o=ye.join(n,"templates"),s=Ne("template/page-templates/example-template/pages");se.existsSync(ye.join(o,e))||(I.error(`Template with the name: [${e}] doesn't exists. Please create a template first.`),ae.exit(1)),se.existsSync(ye.join(o,e,"pages",`${t}.ts`))&&(I.error(`Page with the name: [${t}.ts] already exists. If you'd like to override it, delete previous version first`),ae.exit(1));const i=se.readFileSync(ye.join(s,"custom.ts"),"utf-8").replace(/title\s*:\s*'Custom Page'/,`title: '${Ji(t)}'`),r=ye.join(o,e,"pages",`${t}.ts`);se.writeFileSync(r,i),I.info(`Page [${t}.ts] created for template ${e}`)}catch(n){I.error(`Error while creating page: ${n.message}`),ae.exit(1)}}async function $p(){try{const e=ae.cwd(),t=Ne("template/reference"),n=se.readdirSync(t);let o=!1;for(const s of n){const i=ye.join(t,s),r=ye.join(e,s);se.existsSync(r)||se.mkdirSync(r,{recursive:!0});const a=se.readdirSync(i),c=se.readdirSync(r);if(s==="shared"){a.forEach(l=>{Fe(r,i,l)});continue}for(const l of a){if(l==="assets"){Fe(r,i,l);continue}if(c.includes(l)){const{name:f}=await St({type:"text",name:"name",message:`The "${l}" already exists in ${s} directory: provide a new name to keep both or press Esc to skip this one.`});f?(Fe(r,i,l,{[l]:f}),o=!0):I.info(`Skipped: ${l}`)}else Fe(r,i,l)}}I.info("Reference templates have been added to the app"),o&&I.warn("Some files or folders were renamed to avoid conflicts. Template files may need to be updated to reflect these changes.")}catch(e){I.error(`Error while creating template descriptors: ${e.message}`),ae.exit(1)}}const Ep=["**/example-template/pages/custom.ts"];async function bp(e){const{targetPath:t,renameFiles:n,sourcePath:o,onTemplateCreated:s}=pp(e);try{const i=ae.cwd(),r=ye.join(i,"templates"),a=Ne(o),c=se.readdirSync(a);se.existsSync(r)?se.existsSync(ye.join(r,t))&&(I.error(`Template with the name: ${e} already exists. If you'd like to override it, delete previous version first`),ae.exit(1)):se.mkdirSync(r),c.forEach(l=>Fe(r,a,l,n,Ep)),nn("headers"),nn("footers"),nn("layouts"),s()}catch(i){I.error(`Error while creating template descriptors: ${i.message}`),ae.exit(1)}}function yt({deploymentContext:e,sectionType:t=ue.SECTION}){const n=e.pathContext,o=n.toPath({sectionId:e.currentSection,sectionType:t,layoutId:e.layoutId,slotId:e.slotId}),s=o===void 0?mn(n.fileName):mn(n.fileName,{cwd:U(process.cwd(),o),ignore:n.ignore});return(n.isSingleton?s.splice(0):s).map(i=>({url:i,sectionType:t,context:e}))}const _p=e=>e.app.sections.flatMap(t=>Bi.flatMap(n=>{const o={config:e,currentSection:t.id,pathContext:We[n]};return yt({deploymentContext:o,sectionType:t.type})})),Sp=e=>zi.flatMap(t=>{const n={config:e,pathContext:We[t]};return yt({deploymentContext:n})}),Tp=e=>e.app.layouts.flatMap(t=>qi.flatMap(n=>{const o={config:e,pathContext:We[n],currentSection:t.sectionId,layoutId:t.id};return yt({deploymentContext:o})})),wp=e=>e.app.slots.flatMap(t=>Ui.flatMap(n=>{const o={config:e,pathContext:We[n],currentSection:t.sectionId,layoutId:t.layoutId,slotId:t.id};return yt({deploymentContext:o})}));async function Yr(e){await new Promise(t=>setTimeout(t,e))}const Cp=e=>`\x1B[32m${e}\x1B[0m`,Ap=(e,t,n,o,s)=>{if(!e.total)return;const{loaded:i}=e,r=(Date.now()-s)/1e3;n.value+=i-o.value,o.value=i,t.update({speed:`${Qe(n.value/r,2)}/s`})},Rp=()=>new xi.SingleBar({format:`|${Cp("{bar}")}| {status} || {percentage}% || {value}/{total} Files || Speed: {speed}`,barCompleteChar:"\u2588",barIncompleteChar:"\u2591"});async function sn(e){try{return await ve(Oe.resolve(process.cwd(),e))}catch{throw new Error(`Template file [${e}] is either invalid or undefined`)}}async function Op(e){const t=await z(`${Ce}/js/**.mjs`,{ignore:[`${Ce}/js/**${je}.mjs`]});return Promise.all(t.map(async n=>{const o=await sn(n);return await el(o.sections),{id:`${e}_${Oe.parse(n).name}`,descriptor:o}}))}function vp(e){return e in be?be[e]:be.CUSTOM}async function rn(e,t){const n=e.design?Lt(e.design):void 0,o={...e,design:n??e.design},s=await ft(t);return Be(o,s)}function an(e){return e.type==="custom"&&e.id!==void 0&&e.showcase_overrides!==void 0}async function Ip(e){if(an(e)){const t=await ot(e.id,ce[De(e.id)].dist);return{...e,showcase_overrides:await rn(e.showcase_overrides,t)}}return e}async function Lp(e){const t=an(e.header)?{...e.header,showcase_overrides:await rn(e.header.showcase_overrides,await ot(e.header.id,ce[De(e.header.id)].dist))}:e.header,n=an(e.footer)?{...e.footer,showcase_overrides:await rn(e.footer.showcase_overrides,await ot(e.footer.id,ce[De(e.footer.id)].dist))}:e.footer;return{...e,header:t,footer:n}}async function jp(e){const t=await Promise.all(e.pages.map(async o=>({...o,sections:await Promise.all(o.sections.map(s=>Ip(s)))}))),n=await Lp(e.configuration);return{id:e.id,descriptor:{...n,pages:t}}}async function xp(e){return Promise.all(e.map(t=>jp(t)))}async function Np(e){const t=await z(`${Ce}/${e}/*.mjs`,{ignore:[`${Ce}/${e}/configuration*.mjs`]});return Promise.all(t.map(async n=>{const{sections:o,metadata:s}=await sn(n),i=Qi(n);return{type:vp(i.toUpperCase()),id:i,sections:o,metadata:s}}))}async function Pp(e){const t=await z(`${Ce}/**/configuration*.mjs`,{});return Promise.all(t.map(async n=>{const o=Oe.basename(Oe.dirname(n));return{id:`${e}_${o}`,configuration:await sn(n),pages:await Np(o)}}))}async function Dp(e){const t=await Pp(e);return xp(t)}async function kp(e){return[...await Op(e),...await Dp(e)]}const Fp={value:0},Se=Rp();let Zr=Date.now();const Qr=e=>2**e*500;async function Hp(){const e=await _n(U(ie.cwd(),"crane.config.json")),t=JSON.parse(e.toString());return{appClientId:t.app_client_id,appSecretKey:btoa(t.app_secret_key)}}function Mp(e){return typeof e=="object"&&e!==null&&"version"in e&&typeof e.version=="string"}async function Gp(){const e=U(ie.cwd(),"package.json"),t=await _n(e),n=JSON.parse(t.toString());if(Mp(n))return n;throw new Error(`Package file located at path: ${e} does not contain a version field`)}async function Bp(e){const t=ji(e.version,"patch");if(t===null)throw Error("Error while incrementing app version");e.version=t,fn(U(ie.cwd(),"package.json"),`${JSON.stringify(e,null,2)}
32
+ `)}function qp(e){return e instanceof Sn&&(e.code==="ECONNRESET"||e.response?.status!==void 0&&e.response?.status>=500&&e.response?.status<600)}function Jr(e,t){return e<Gi&&qp(t)}async function ei(e,t,n,o){const s={value:0},i=e.config.app.templates.length>0?ki:Di;return e.config.axios.post(i,{file:si(U(ie.cwd(),n!==void 0?n+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=>Ap(r,Se,Fp,s,Zr)}).then(r=>(Se.increment(),r)).catch(async r=>{if(Jr(o,r))return await Yr(Qr(o)),ei(e,t,n,o+1);throw Se.increment(),r})}function Up(e){return Se.start(e.length+1,0,{speed:"N/A",status:"Deployment in progress"}),e.map(t=>{const n=t.context,o=n.pathContext.toPath({sectionId:n.currentSection,sectionType:t.sectionType,layoutId:n.layoutId,slotId:n.slotId});return ei(n,t.url,o,0)})}function zp(e){const t=[..._p(e),...Sp(e),...Tp(e),...wp(e)];return Up(t)}function Kp(e){return e.includes(`
33
+ `)}function Xp(e,t,n){return e.split(`
34
+ `).map((o,s)=>s>=n?t+o:o).join(`
35
+ `)}function st(e,t){const n=[];if(e instanceof Sn){e.response?.status!==void 0&&n.push(` HTTP Status Code: ${e.response.status}`);const i=e.response?.data;if(i?.errorCode&&n.push(` Error Code: ${i.errorCode}`),i?.errorMessage){const r=Kp(i.errorMessage)?Xp(i.errorMessage," ",1):i.errorMessage;n.push(` Error Message: ${r}`)}}const o=n.length>0?n.join(`
36
+ `):e?.message??"Unknown error";if(!t||t.length===0)return o;const s=n.length>0?`
37
+ `:" ";return`${t}${s}${o}`}async function ti(e,t=0){const n=e.app.templates.length>0?Hi:Fi;return e.axios.post(n,{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 o=>{if(Jr(t,o))return await Yr(Qr(t)),ti(e,t+1);throw o})}async function Vp(e){try{if(!Vi.some(r=>re(U(ie.cwd(),r))))throw new Error(Ue.INCORRECT_DISTRIBUTION_FOLDER(Xi));const t=e??Pi;I.info("Custom application deployment :: Started");const n=Ii.create({baseURL:t});Li(n,Mi),I.info("Loading configuration files ...");const o=await Promise.all([Hp(),Gp(),Qc(),aa(),al()]).then(async([r,a,c,l,f])=>({axios:n,app:{crane:r,packageJson:a,sections:c,layouts:l,slots:f,templates:await kp(r.appClientId)}}));I.info("Uploading files ..."),Zr=Date.now(),await Promise.all(zp(o)).catch(r=>{Se.stop(),r.response?.status===404?I.error(st(r,Ue.DEPRECATED_VERSION_DEPLOYMENT)):I.error(st(r,Ue.ASSET_FILES_UPLOAD)),ie.exit(1)}).finally(()=>{Se.increment(),Se.stop()}),Se.update({speed:"N/A",status:"Finalising deployment"}),await ti(o).catch(r=>{Se.stop(),r.response?.status===404?I.error(st(r,Ue.DEPRECATED_VERSION_DEPLOYMENT)):I.error(st(r,Ue.MANIFEST_DEPLOYMENT)),ie.exit(1)}).finally(()=>{Se.increment(),Se.stop()});const s=o.app.sections.map(r=>r.id),i=o.app.packageJson.version;I.info("Custom application deployment :: Successful"),I.info(`Current app version: ${i}`),I.info(`Deployed sections: ${s.sort().join(", ")}`),await Bp(o.app.packageJson),o.app.templates.length>0&&I.info(`Deployed templates: ${o.app.templates.map(r=>r.id).sort().join(", ")}`),o.app.slots.length>0&&I.info(`Deployed slots: ${o.app.slots.map(r=>r.id).sort().join(", ")}`)}catch(t){Se.stop(),I.error(st(t,Ue.DEFAULT)),ie.exit(1)}finally{Zc()}}function Wp(){return{name:"app-block-api",configureServer(e){e.middlewares.use(async(t,n,o)=>{e.moduleGraph.invalidateAll();const s=new gi(t.url||"",`http://${t.headers.host}`);if(s.pathname==="/api/v1/block-config"&&t.method==="GET"){const i=s.searchParams.get("section"),r=s.searchParams.get("type")||"SECTION";if(!i){n.statusCode=400,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify({error:"Missing blockId parameter"}));return}const a=ue[r]||ue.SECTION;try{const c=await dt(i,a);n.statusCode=200,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify(c))}catch(c){n.statusCode=500,n.setHeader("Content-Type","application/json"),n.end(JSON.stringify({error:c.message}))}return}o()})}}}async function Yp(e,t){const n=U(`${e}/ssr-server.ts`),o=U(t);await qe({build:{lib:{entry:n,formats:["es"],fileName:()=>"ssr-server.mjs"},outDir:o,emptyOutDir:!1,minify:!1,rollupOptions:{external:["http","fs","@swc/core","module-from-string","linkedom"],output:{entryFileNames:"ssr-server.mjs"}},target:"esnext"}})}async function Zp(e,t){const n=U(`${e}/shared/preview.ts`),o=U(`${e}/shared/utils.ts`),s=U(`${e}/shared/api-routes.ts`),i=U(t);await qe({build:{lib:{entry:n,formats:["es"],fileName:()=>"preview.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"preview.js"}},target:"esnext"}}),await qe({build:{lib:{entry:o,formats:["es"],fileName:()=>"utils.js"},outDir:i,emptyOutDir:!1,minify:!1,rollupOptions:{output:{entryFileNames:"utils.js"}},target:"esnext"}}),await qe({build:{lib:{entry:s,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 Qp(){const e="preview",t=`${e}/shared`,n="vite.config.js",o=`${e}/sections`,s=`${o}/preview.html`;[e,o].forEach(r=>{V.existsSync(r)||V.mkdirSync(r,{recursive:!0})});const i=Ne("template/preview");V.copyFileSync(`${i}/${n}`,`${e}/${n}`),await Yp(i,e),V.copyFileSync(`${i}/sections/preview.html`,s),V.existsSync(t)||V.mkdirSync(t),await Zp(i,t)}function Jp(){return{timeout:null,inProgress:!1,hasPending:!1}}function eu(e,t){const n=async()=>{e.inProgress=!0;try{await Pt(!0),t.ws.send({type:"full-reload",path:"*"})}catch(o){console.error("Build error:",o)}finally{e.inProgress=!1,e.hasPending&&(e.hasPending=!1,setTimeout(()=>n(),0))}};return async()=>{if(e.inProgress){e.hasPending=!0;return}await n()}}function tu(e){const t=e.replace(/\\/g,"/"),n=t.match(/sections\/([^/]+)/),o=t.match(/shared\/components/);return!!(n||o)}function nu(e,t){return async n=>{tu(n)&&(e.timeout&&clearTimeout(e.timeout),e.timeout=setTimeout(async()=>{await t()},1e3))}}function ou(e,t){const n=Jp(),o=eu(n,e),s=nu(n,o);e.watcher.add(t),e.watcher.on("add",s),e.watcher.on("change",s),e.watcher.on("unlink",s)}async function su(){const e=W.resolve(process.cwd(),"preview/ssr-server.mjs");if(!V.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:n,port:o}=await t.startServer();return{server:n,port:o}}async function ru(){const e=W.resolve(process.cwd(),"preview/vite.config.js"),t=W.resolve(process.cwd(),"/sections/**/*"),n=W.resolve(process.cwd(),"/shared/components/*"),o=await fi({configFile:e,root:process.cwd(),plugins:[Wp()]});return await o.listen(),ou(o,[t,n]),o}async function iu(){await Pt(),await Qp(),console.log(`
22
38
  \u{1F4E6} Starting preview servers...
23
- `);let e=null,t=null;if(process.platform!=="win32"){const n=await _c();e=n.server,t=n.port,process.env.PREVIEW_SSR_PORT=String(t)}const o=await Sc(),s=()=>{e&&e.close(),o.close(),process.exit(0)};return process.on("SIGINT",s),process.on("SIGTERM",s),o}const Oc={deploy:["url"],init:[""],build:["generatePreview"]};function jc(e,t){return e.options.length!==0&&Object.keys(t).length===1}function Ic(e){return e.includes("-h")||e.includes("--help")}function vc(e,t){return Object.keys(t).some(o=>o!=="--"&&!e.hasOption(o)&&!Oc[e.rawName]?.includes(o))}function Ac(e){return e.length!==0}function Lc(e,t,o){return e.matchedCommand!==void 0&&(jc(e.matchedCommand,o)||Ic(e.rawArgs)||vc(e.matchedCommand,e.options)||Ac(t))}function Dc(e,t,o){e.matchedCommand&&!Lc(e,t,o)?e.runMatchedCommand():e.outputHelp()}function dn(e){if(wi(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:o}=Ti(e);return o&&console.log(o),t}async function un(e,t,o,s){const n=(await qe({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 Pc(e,t){try{const{app:o,section:s,header:n,footer:i,template:r,referenceTemplate:a}=e;await le(t,"app",K("init --app <name>"),va,o),await le(t,"section",K("init --section <name>"),La,s),await le(t,"header",K("init --header <name>"),Pa,n),await le(t,"footer",K("init --footer <name>"),Da,i),await le(t,"template",K("init --template <name>"),Na,r),a&&await Ra()}catch(o){p.error(`Error while executing init operation: ${o.message}`),process.exit(1)}}function Rc(){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=>Pc(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()=>Cc()),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});Dc(e,t.args,t.options)}catch(e){p.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{Rc as run};
39
+ `);let e=null,t=null;if(process.platform!=="win32"){const s=await su();e=s.server,t=s.port,process.env.PREVIEW_SSR_PORT=String(t)}const n=await ru(),o=()=>{e&&e.close(),n.close(),process.exit(0)};return process.on("SIGINT",o),process.on("SIGTERM",o),n}const au={deploy:["url"],init:[""],build:["generatePreview"]};function cu(e,t){return e.options.length!==0&&Object.keys(t).length===1}function lu(e){return e.includes("-h")||e.includes("--help")}function pu(e,t){return Object.keys(t).some(n=>n!=="--"&&!e.hasOption(n)&&!au[e.rawName]?.includes(n))}function uu(e){return e.length!==0}function fu(e,t,n){return e.matchedCommand!==void 0&&(cu(e.matchedCommand,n)||lu(e.rawArgs)||pu(e.matchedCommand,e.options)||uu(t))}function du(e,t,n){e.matchedCommand&&!fu(e,t,n)?e.runMatchedCommand():e.outputHelp()}function gt(e){if(Zi(e))return console.log("Please specify a name for your resource."),!1;const{isValid:t,errorMessage:n}=Yi(e);return n&&console.log(n),t}async function cn(e){const t=await St({type:"text",name:"name",message:`Please specify a name for your ${e}:`});if(t.name!==void 0){const n=W.basename(t.name);return gt(n)?n:cn(e)}}async function hu(e,t,n,o){const s=await cn(t);return s===void 0?(console.log(`You can use ${n} to directly specify the name of the ${t}.`),e.outputHelp()):o(s)}async function rt(e,t,n,o,s){if(s!==void 0)if(!gt(s))await hu(e,t,n,o);else{const i=W.basename(s.toString());await o(i)}}function mu(){V.existsSync("./templates")||(I.error(`No template found. Please create a template first using ${Le("init --template <name>")}`),process.exit(1));const e=V.readdirSync("./templates",{withFileTypes:!0}).filter(t=>t.isDirectory()).map(t=>t.name).filter(t=>t!=="assets");return e.length===0&&(I.error(`No template found. Please create a template first using ${Le("init --template <name>")}`),process.exit(1)),e}async function yu(e){const t=mu();if(typeof e=="string"||typeof e=="number"){if(t.includes(e.toString()))return e.toString();gt(e)?I.warn(`Template [${e}] doesn't exist`):I.error(`[${e}] is an invalid template name.`)}const n=await St({type:"select",name:"choice",message:"Please choose a template:",choices:t.map(o=>({title:o,value:o}))});return n.choice||(I.error("No template selected"),process.exit(1)),n.choice}async function gu(e,t){if(typeof t=="string"||typeof t=="number"){if(gt(t))return t.toString();I.error(`${t} is invalid name.`)}return cn(e)}async function $u(e,t,n){const o=await yu(t),s=await gu("page",n);if(s===void 0)return console.log(`You can use ${Le("init --page <name>")} to directly specify the name of the page.`),e.outputHelp();await gp(o,s)}async function Eu(e,t){try{const{app:n,section:o,header:s,footer:i,template:r,referenceTemplate:a,page:c}=e;await rt(t,"app",Le("init --app <name>"),fp,n),await rt(t,"section",Le("init --section <name>"),hp,o),await rt(t,"header",Le("init --header <name>"),yp,s),await rt(t,"footer",Le("init --footer <name>"),mp,i),c===void 0?await rt(t,"template",Le("init --template <name>"),bp,r):await $u(t,r,c),a&&await $p()}catch(n){I.error(`Error while executing init operation: ${n.message}`),process.exit(1)}}function bu(){try{const e=ai("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. ").option("--page [name]","Create the file necessary for one custom page with the given name, this can be repeated for each custom page.").allowUnknownOptions().action(async n=>Eu(n,e)),e.command("build","Builds your resource code").allowUnknownOptions().action(()=>Pt()),e.command("preview","Runs a local server to preview resources").allowUnknownOptions().action(async()=>iu()),e.command("deploy","Deploys your resource code").allowUnknownOptions().action(()=>Vp(e.options.url)),e.version(Ni),e.usage("<action> <resource>");const t=e.parse(process.argv,{run:!1});du(e,t.args,t.options)}catch(e){I.error(`Error while parsing input: ${e.message}`),process.exit(1)}}export{bu as run};