@lightspeed/crane-api 2.4.1-rc.0 → 2.4.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/dist/index.d.mts +26 -1
- package/dist/index.d.ts +26 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -7235,17 +7235,40 @@ declare const LayoutSettingsSchema: z.ZodObject<{
|
|
|
7235
7235
|
type LayoutDesignOverride = z.infer<typeof LayoutDesignOverrideSchema>;
|
|
7236
7236
|
type LayoutSettings = z.infer<typeof LayoutSettingsSchema>;
|
|
7237
7237
|
|
|
7238
|
+
declare const CatalogLayoutSlotSchema: z.ZodEnum<{
|
|
7239
|
+
CONTROLS: "CONTROLS";
|
|
7240
|
+
FOOTER: "FOOTER";
|
|
7241
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7242
|
+
}>;
|
|
7243
|
+
declare const CategoryLayoutSlotSchema: z.ZodEnum<{
|
|
7244
|
+
CONTROLS: "CONTROLS";
|
|
7245
|
+
FOOTER: "FOOTER";
|
|
7246
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7247
|
+
MAIN_TITLE: "MAIN_TITLE";
|
|
7248
|
+
}>;
|
|
7249
|
+
declare const ProductLayoutSlotSchema: z.ZodEnum<{
|
|
7250
|
+
FOOTER: "FOOTER";
|
|
7251
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7252
|
+
TOP_BAR: "TOP_BAR";
|
|
7253
|
+
GALLERY: "GALLERY";
|
|
7254
|
+
SIDEBAR: "SIDEBAR";
|
|
7255
|
+
DESCRIPTION: "DESCRIPTION";
|
|
7256
|
+
REVIEW_LIST: "REVIEW_LIST";
|
|
7257
|
+
RELATED_PRODUCTS: "RELATED_PRODUCTS";
|
|
7258
|
+
}>;
|
|
7238
7259
|
declare const CatalogLayoutSlot: {
|
|
7239
7260
|
readonly PRODUCT_LIST: "CONTROLS";
|
|
7240
7261
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7241
7262
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7242
7263
|
};
|
|
7264
|
+
type CatalogLayoutSlot = z.infer<typeof CatalogLayoutSlotSchema>;
|
|
7243
7265
|
declare const CategoryLayoutSlot: {
|
|
7244
7266
|
readonly CATEGORY_TITLE: "MAIN_TITLE";
|
|
7245
7267
|
readonly PRODUCT_LIST: "CONTROLS";
|
|
7246
7268
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7247
7269
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7248
7270
|
};
|
|
7271
|
+
type CategoryLayoutSlot = z.infer<typeof CategoryLayoutSlotSchema>;
|
|
7249
7272
|
declare const ProductLayoutSlot: {
|
|
7250
7273
|
readonly TOP_BAR: "TOP_BAR";
|
|
7251
7274
|
readonly GALLERY: "GALLERY";
|
|
@@ -7256,6 +7279,7 @@ declare const ProductLayoutSlot: {
|
|
|
7256
7279
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7257
7280
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7258
7281
|
};
|
|
7282
|
+
type ProductLayoutSlot = z.infer<typeof ProductLayoutSlotSchema>;
|
|
7259
7283
|
|
|
7260
7284
|
declare const ManifestSchema: z.ZodObject<{
|
|
7261
7285
|
version: z.ZodString;
|
|
@@ -10485,11 +10509,12 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
10485
10509
|
}, z.core.$strict>>;
|
|
10486
10510
|
layouts: z.ZodArray<z.ZodObject<{
|
|
10487
10511
|
id: z.ZodString;
|
|
10488
|
-
sectionId: z.ZodString
|
|
10512
|
+
sectionId: z.ZodPipe<z.ZodString, z.ZodTransform<"category" | "catalog" | "product", string>>;
|
|
10489
10513
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10490
10514
|
path: z.ZodString;
|
|
10491
10515
|
size: z.ZodNumber;
|
|
10492
10516
|
}, z.core.$strict>>>;
|
|
10517
|
+
templateContent: z.ZodOptional<z.ZodString>;
|
|
10493
10518
|
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10494
10519
|
type: z.ZodLiteral<"INPUTBOX">;
|
|
10495
10520
|
label: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -7236,17 +7236,40 @@ declare const LayoutSettingsSchema: z.ZodObject<{
|
|
|
7236
7236
|
type LayoutDesignOverride = z.infer<typeof LayoutDesignOverrideSchema>;
|
|
7237
7237
|
type LayoutSettings = z.infer<typeof LayoutSettingsSchema>;
|
|
7238
7238
|
|
|
7239
|
+
declare const CatalogLayoutSlotSchema: z.ZodEnum<{
|
|
7240
|
+
CONTROLS: "CONTROLS";
|
|
7241
|
+
FOOTER: "FOOTER";
|
|
7242
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7243
|
+
}>;
|
|
7244
|
+
declare const CategoryLayoutSlotSchema: z.ZodEnum<{
|
|
7245
|
+
CONTROLS: "CONTROLS";
|
|
7246
|
+
FOOTER: "FOOTER";
|
|
7247
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7248
|
+
MAIN_TITLE: "MAIN_TITLE";
|
|
7249
|
+
}>;
|
|
7250
|
+
declare const ProductLayoutSlotSchema: z.ZodEnum<{
|
|
7251
|
+
FOOTER: "FOOTER";
|
|
7252
|
+
CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7253
|
+
TOP_BAR: "TOP_BAR";
|
|
7254
|
+
GALLERY: "GALLERY";
|
|
7255
|
+
SIDEBAR: "SIDEBAR";
|
|
7256
|
+
DESCRIPTION: "DESCRIPTION";
|
|
7257
|
+
REVIEW_LIST: "REVIEW_LIST";
|
|
7258
|
+
RELATED_PRODUCTS: "RELATED_PRODUCTS";
|
|
7259
|
+
}>;
|
|
7239
7260
|
declare const CatalogLayoutSlot: {
|
|
7240
7261
|
readonly PRODUCT_LIST: "CONTROLS";
|
|
7241
7262
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7242
7263
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7243
7264
|
};
|
|
7265
|
+
type CatalogLayoutSlot = z.infer<typeof CatalogLayoutSlotSchema>;
|
|
7244
7266
|
declare const CategoryLayoutSlot: {
|
|
7245
7267
|
readonly CATEGORY_TITLE: "MAIN_TITLE";
|
|
7246
7268
|
readonly PRODUCT_LIST: "CONTROLS";
|
|
7247
7269
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7248
7270
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7249
7271
|
};
|
|
7272
|
+
type CategoryLayoutSlot = z.infer<typeof CategoryLayoutSlotSchema>;
|
|
7250
7273
|
declare const ProductLayoutSlot: {
|
|
7251
7274
|
readonly TOP_BAR: "TOP_BAR";
|
|
7252
7275
|
readonly GALLERY: "GALLERY";
|
|
@@ -7257,6 +7280,7 @@ declare const ProductLayoutSlot: {
|
|
|
7257
7280
|
readonly BOTTOM_BAR: "FOOTER";
|
|
7258
7281
|
readonly CUSTOM_SLOT: "CUSTOM_SLOT";
|
|
7259
7282
|
};
|
|
7283
|
+
type ProductLayoutSlot = z.infer<typeof ProductLayoutSlotSchema>;
|
|
7260
7284
|
|
|
7261
7285
|
declare const ManifestSchema: z.ZodObject<{
|
|
7262
7286
|
version: z.ZodString;
|
|
@@ -10486,11 +10510,12 @@ declare const ManifestSchema: z.ZodObject<{
|
|
|
10486
10510
|
}, z.core.$strict>>;
|
|
10487
10511
|
layouts: z.ZodArray<z.ZodObject<{
|
|
10488
10512
|
id: z.ZodString;
|
|
10489
|
-
sectionId: z.ZodString
|
|
10513
|
+
sectionId: z.ZodPipe<z.ZodString, z.ZodTransform<"category" | "catalog" | "product", string>>;
|
|
10490
10514
|
assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
10491
10515
|
path: z.ZodString;
|
|
10492
10516
|
size: z.ZodNumber;
|
|
10493
10517
|
}, z.core.$strict>>>;
|
|
10518
|
+
templateContent: z.ZodOptional<z.ZodString>;
|
|
10494
10519
|
content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10495
10520
|
type: z.ZodLiteral<"INPUTBOX">;
|
|
10496
10521
|
label: z.ZodString;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createSSRApp as Ce,getCurrentInstance as Le,ref as y,computed as a,reactive as f}from"vue";import{renderToString as be}from"vue/server-renderer";import{z as m}from"zod";function B(e){return{app:Ce(e)}}const x=new Map;function g(){const e=(r,i,l,s,v,d,c,u)=>{x.set(r._uid,{context:y(i),content:y(l),design:y(s),defaults:y(v),site:y(d?.site??{}),category:y(d?.category),storeData:y(d?.storeData),globalDesign:y(c),tileId:y(u??void 0)})},t=(r,i,l,s,v,d,c)=>{const u=x.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=s,u.site.value=v.site??{},u.category.value=v.category,u.globalDesign.value=d,u.storeData.value=v.storeData,u.tileId.value=c)},n=Le()?.appContext.app._uid??-1,o=x.get(n);return{init:e,update:t,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site,category:o?.category,storeData:o?.storeData,globalDesign:o?.globalDesign,tileId:o?.tileId}}function _e(e,t){return{init:()=>{const{app:n}=B(e);return t?.init?.(n),{mount:(o,r)=>{g().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign,r.data.tileId),t?.mount?.(n,o,r),n.mount(o)},update:o=>{g().update(n,o.data.content,o.data.design,o.data.defaults,o.data.externalContent,o.context.globalDesign,o.data.tileId),t?.update?.(n,o)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function Re(e){const t={appName:"",blockName:"",version:"",scriptUrl:"",imageBuckets:{},globalDesign:{}};return{component:e,initState(n,o,r,i){g().init(n,t,o,r,i,{},{},void 0)},updateState(n,o,r,i){g().update(n,o,r,i,{},{},void 0)}}}function ye(e,t){return{init:()=>{const{app:n}=B(e);return t?.init?.(n),{render:async(o,r)=>(g().init(n,o,r.content,r.design,r.defaults,r.externalContent,o.globalDesign,r.tileId),t?.render?.(n,o,r),{html:await be(n,{context:o}),state:{context:o,data:r}})}}}}const Se={SOLID:"solid",GRADIENT:"gradient",NONE:"none"},$={SCROLL_TO_TILE:"SCROLL_TO_TILE",HYPER_LINK:"HYPER_LINK",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};m.enum(Object.values($));const he=$,M={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};m.enum(Object.values(M));const Ae=M,U={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};m.enum(Object.values(U));const Ne=U,P={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};m.enum(Object.values(P));const De=P,K={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};m.enum(Object.values(K));const Ge=K,z={COLOR:"COLOR",GRADIENT:"GRADIENT"};m.enum(Object.values(z));const we=z,F={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"};m.enum(Object.values(F));const xe=F;var X=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(X||{}),Y=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e[e.CollectionDescriptor=14]="CollectionDescriptor",e[e.CollectionAsset=15]="CollectionAsset",e))(Y||{}),V=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(V||{});const I={TEXTAREA:"TEXTAREA",INPUTBOX:"INPUTBOX",SELECTBOX:"SELECTBOX",IMAGE:"IMAGE",TOGGLE:"TOGGLE",BUTTON:"BUTTON",DECK:"DECK",MENU:"MENU",NAVIGATION_MENU:"NAVIGATION_MENU",LOGO:"LOGO",INFO:"INFO",DIVIDER:"DIVIDER",PRODUCT_SELECTOR:"PRODUCT_SELECTOR",CATEGORY_SELECTOR:"CATEGORY_SELECTOR"};m.enum(Object.values(I));const j={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};m.enum(Object.values(j));const ke=j,W={CONTENT:"Content",DESIGN:"Design"};m.enum(Object.values(W));const Be=W,H={TEXT:"TEXT",IMAGE:"IMAGE"};m.enum(Object.values(H));const $e=H;class Me{type="STRUCTURED_COLOR";raw;hex;hsl;rgba;auto;constructor({raw:t,hex:n,hsl:o,rgba:r,auto:i}){this.raw=t,this.hex=n,this.hsl=o,this.rgba=r,this.auto=i}}function Ue(e){if(e!==void 0)return{...e,type:"STRUCTURED_COLOR"}}var J=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(J||{}),q=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(q||{});const Pe={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Ke={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},ze={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Q={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"};m.enum(Object.values(Q));const Fe=Q;function N(e,t="#000000"){return typeof e=="string"?e.startsWith("global.")?t:e:e&&e.hex?e.hex:t}function Xe(e,t,n){const o=e/255,r=t/255,i=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),s=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),v=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4);return .2126*l+.7152*s+.0722*v}function Ye(e){const t=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,"#$1$1$2$2$3$3"),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null}function Z(e){const t=Ye(e);return t?Xe(t.r,t.g,t.b)<=.5:!0}function ee(e,t="#808080",n="#FFFFFF"){return Z(e)?n:t}function Ve(e,t={}){const{defaultFont:n="inherit",defaultSize:o=16,defaultColor:r="#000000",defaultWeight:i="normal"}=t;if(e&&!e.visible)return{display:"none"};if(!e)return{fontFamily:n,fontSize:`${o}px`,color:r,fontWeight:i,fontStyle:"normal"};const l=e.size!==void 0?`${e.size}px`:`${o}px`,s=e.font||n,v=N(e.color,r),d=e.bold?"bold":i,c=e.italic?"italic":"normal";return{fontFamily:s,fontSize:l,color:v,fontWeight:d,fontStyle:c}}function te(e,t={}){const{direction:n="to right",fallbackColor:o=""}=t;if(!e?.background)return o?{backgroundColor:o}:{};const{background:r}=e;if(r.type==="solid"&&r.solid?.color)return{backgroundColor:N(r.solid.color,o)};if(r.type==="gradient"&&r.gradient){const{fromColor:i,toColor:l}=r.gradient,s=N(i,o),v=N(l,o);return s!==""&&v!==""?{backgroundImage:`linear-gradient(${n}, ${s}, ${v})`}:{}}return o?{backgroundColor:o}:{}}function je(e,t={}){return a(()=>te(e,t))}const We={small:{fontSize:"14px",padding:"8px 16px"},medium:{fontSize:"16px",padding:"10px 20px"},large:{fontSize:"18px",padding:"12px 24px"}};function He(e,t={}){const n={...We,...t.sizes};return a(()=>{if(!e?.visible)return{display:"none"};const o={fontFamily:e.font??"inherit",fontWeight:"400"},r=e.size??"medium",i=n[r]??n.medium;o.fontSize=i.fontSize,o.padding=i.padding;const l=N(e.color,"#000000"),s=e.appearance;switch(s){case"outline-button":o.backgroundColor="transparent",o.color=l,o.border=`2px solid ${l}`;break;case"text-link":o.backgroundColor="transparent",o.color=l,o.border="none",o.padding="0",o.textDecoration="none";break;case"solid-button":case void 0:default:o.backgroundColor=l,o.color=ee(l),o.border=`1px solid ${l}`;break}if(s!=="text-link")switch(e.style){case"pill":o.borderRadius="999px";break;case"round-corner":o.borderRadius="4px";break;case"rectangle":case void 0:default:o.borderRadius="0";break}else o.borderRadius="0";return o})}function ne(e){return!e||e.length===0?"en":e.find(t=>t.selected)?.code??e.find(t=>t.main)?.code??"en"}function Je(){const e=g(),t=a(()=>e.site?.value);return{currentLanguage:a(()=>ne(t.value?.languages))}}function qe(){return globalThis.window.instantsite}const S={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function Qe(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function Ze(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function et(e,t){if("pageUrl"in e)return e.pageUrl;const n=Ze(e);switch(n){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":return"/"}if(t){const o=t.find(r=>r.pageId===n);if(o)return o.url}return"/"}function tt(e){if("categoryId"in e)return e.categoryId}function nt(e){if(!e||e.length===0)return"";const t=e.find(n=>n.selected);return!t||t.main?"":`/${t.code}`}const oe=(e,t,n)=>{if(!e||t)return;const{type:o,link:r,email:i,phone:l}=e,s=g(),v=s.site?.value?.pages,d=s.site?.value?.languages,c=nt(d),u=et(e,v),O=tt(e);switch(o){case S.HYPER_LINK:if(r){const p=e.linkTarget??"_blank";return()=>window.open(r,p)}break;case S.GO_TO_STORE:case S.GO_TO_STORE_LINK:return()=>window.open(`${c}/products`,"_self");case S.GO_TO_CATEGORY:case S.GO_TO_CATEGORY_LINK:const h=n?.find(p=>p.id===O)?.url;return h===void 0?()=>window.open(`${c}/404`,"_self"):()=>window.open(h,"_self");case S.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case S.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case S.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const p=Qe(e);document.getElementById(`tile-${p}`)?.scrollIntoView()};break;case S.GO_TO_PAGE:if(u)return()=>window.open(`${c}${u}`,"_self");break;default:console.error(`Unknown type of ActionLink: ${o}`)}};function re(e){if(!e||e.length===0)return[];const t=[];function n(o){if(t.push({id:o.id,name:o.name,url:o.urlPath}),o.children&&o.children.length>0)for(const r of o.children)n(r)}for(const o of e)n(o);return t}function ot(e){return"title"in e&&"type"in e}function rt(e,t,n,o){const r=a(()=>{const R=e.value[t];if(R!==void 0){if(ot(R))return R;throw new Error(`Element ${t} is not action link`)}}),i=a(()=>r.value?.title),l=a(()=>r.value?.type),s=a(()=>r.value?.link),v=a(()=>r.value?.email),d=a(()=>r.value?.phone),c=a(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),u=a(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),O=a(()=>r.value?.pageUrl),h=a(()=>!!i.value),p=a(()=>!!s.value),A=oe(r.value,n,o);return f({title:i,type:l,link:s,email:v,phone:d,tileDivId:c,pageId:u,pageUrl:O,hasTitle:h,hasLink:p,performAction:A})}function ae(e,t){const n=g(),o=a(()=>!!n.site?.value?.isPreviewMode),r=a(()=>{const l=n.category?.value?.categoryTree;return re(l)}),i=a(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return rt(i,e,o.value,r.value)}function ie({content:e,elementName:t,errorMessage:n,validatorFn:o}){return a(()=>{const r=e.value?.[t];if(r!==void 0){if(o(r))return r;throw new Error(n)}})}function at(e){return typeof e=="object"&&e!==null&&"categories"in e}function it(e){return a(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function lt(e){return e!==void 0}function ut(e){return!!e?.trim()}function st({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:ut(t)?t:e}function ct(e,t){return lt(e)&&t}function le({itemId:e,id:t,alt:n,name:o,nameTranslated:r,customName:i,enabled:l,productsCount:s,url:v,imageUrl:d,thumbnailImageUrl:c,imageBorderInfo:u,selectionType:O}){return{itemId:e||t.toString(),id:t,alt:n,name:st({name:o,customName:i,selectionType:O}),nameTranslated:r,label:o,enabled:l,url:v,productsCount:s,imageUrl:d,thumbnailImageUrl:c,imageBorderInfo:u,showCategory:ct(t,l)}}function ue(e,t,n){const o=g(),r=a(()=>t!==void 0?t:o.content.value),i=ie({content:r,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:at}),l=a(()=>n??o.storeData?.value),s=a(()=>i.value?.categories.selectionType??"ROOT"),v=a(()=>l.value?.categories??[]),d=a(()=>i.value?.categories?.categoryIds??[]),c=a(()=>{const h=it(v);return s.value==="MANUAL"?i.value?.categories?.items?.flatMap(p=>{const A=h.value[p.id];return A?[le({...p,...A,selectionType:s.value})]:[]})??[]:l?.value?.categories.map(p=>le({...p,selectionType:s.value}))??[]}),u=a(()=>c.value.length>0),O=a(()=>c.value!==void 0&&c.value.length>0);return f({categories:c,categoryIds:d,hasContent:u,hasCategories:O})}function dt(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function se(e,t,n){const o=g(),r=a(()=>t!==void 0?t:o.content.value),i=ie({content:r,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:dt}),l=a(()=>n??o.storeData?.value),s=a(()=>i.value===void 0?"ALL":i.value.products?.selectionType??"MANUAL"),v=a(()=>i.value?.products?.productIds??[]),d=a(()=>i.value?.product?.id),c=a(()=>typeof i.value?.categoryId=="number"?i.value.categoryId:void 0),u=a(()=>{if(s.value==="ALL")return l?.value?.products??[];if(s.value==="CATEGORY")return c.value===0?l?.value?.products.filter(R=>R?.defaultCategoryId===0)??[]:l?.value?.products.filter(R=>c.value&&R?.categoryIds?.includes(c.value))??[];const A=d.value?[d.value]:v.value??[];return l?.value?.products?.filter(R=>A.includes(R.id))??[]}),O=a(()=>l?.value?.categories.filter(A=>A.id===c?.value)??[]),h=a(()=>u.value.length>0),p=a(()=>u.value!==void 0&&u.value.length>0);return f({products:u,categories:O,categoryId:c,hasContent:h,hasProducts:p})}function vt(e){return"bucket"in e&&"set"in e}function D(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function gt(e,t){const n=a(()=>{const d=e.value[t];if(d!==void 0){if(vt(d))return d;throw new Error(`Element ${t} is not image`)}}),o=a(()=>n.value===void 0?"":g().context.value.imageBuckets?.[n.value?.bucket]),r=a(()=>n.value!==void 0),i=a(()=>D(n.value?.set?.["cropped-webp-100x200"]?.url,o.value)),l=a(()=>D(n.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),s=a(()=>D(n.value?.set?.["webp-200x200"]?.url,o.value)),v=a(()=>D(n.value?.set?.["webp-2000x2000"]?.url,o.value));return f({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:s,highResolutionDesktopImage:v})}function ce(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return gt(o,e)}function ft(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),o=a(()=>n.value!==void 0&&n.value.length>0),r=a(()=>n.value);return f({hasContent:o,value:r})}function de(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return ft(o,e)}function Ot(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),o=a(()=>n.value!==void 0),r=a(()=>n.value);return f({hasContent:o,value:r})}function ve(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Ot(o,e)}function Et(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),o=a(()=>n.value!==void 0&&n.value.length>0),r=a(()=>n.value);return f({hasContent:o,value:r})}function ge(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Et(o,e)}function pt(e){return"enabled"in e}function Tt(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(pt(i))return i;throw new Error(`Element ${t} is not toggle`)}}),o=a(()=>n.value!==void 0),r=a(()=>n.value?.enabled);return f({hasContent:o,value:r})}function fe(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Tt(o,e)}function Oe(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}function Ee(e,t,n,o){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const r=e.settings[n];if(r===void 0)return r;switch(t){case I.TEXTAREA:return ge(n,e.settings);case I.INPUTBOX:return de(n,e.settings);case I.SELECTBOX:return ve(n,e.settings);case I.IMAGE:return ce(n,e.settings);case I.TOGGLE:return fe(n,e.settings);case I.BUTTON:return ae(n,e.settings);case I.CATEGORY_SELECTOR:return ue(n,e.settings,o);case I.PRODUCT_SELECTOR:return se(n,e.settings,o);case I.DECK:return mt(e,n,o);default:return}}function mt(e,t,n){const o=a(()=>{const l=e.settings[t];if(l!==void 0){if(Oe(l))return l;throw new Error(`Element ${t} is not of DECK type`)}}),r=a(()=>o.value!==void 0&&o.value.cards.length>0),i=a(()=>o.value?.cards);return f({hasContent:r,cards:i,getReactiveRef:(l,s,v)=>Ee(l,s,v,n)})}function It(e){const t=g(),n=a(()=>t.storeData?.value),o=a(()=>{const l=t.content.value[e];if(l!==void 0){if(Oe(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),r=a(()=>o.value!==void 0&&o.value.cards.length>0),i=a(()=>o.value?.cards);return f({hasContent:r,cards:i,getReactiveRef:(l,s,v)=>Ee(l,s,v,n.value)})}function Ct(e){return"type"in e&&("text"in e||"image"in e)}function G(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function Lt(){const e=g(),t=a(()=>{const l=e.content.value.logo;if(l!==void 0){if(Ct(l))return l;throw new Error("Element logo is not LOGO")}}),n=a(()=>t.value?.type),o=a(()=>t.value?.text),r=a(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=a(()=>({lowResolutionMobileImage:G(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:G(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:G(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:G(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return f({type:n,text:o,image:i})}function bt(e){return e!==null&&"items"in e}function pe(e){const t=g(),n=a(()=>{const u=t.content.value[e];if(u!==void 0){if(bt(u))return u;throw new Error(`Element ${e} is not an menu`)}}),o=a(()=>!!t.site?.value?.isPreviewMode),r=a(()=>{const u=t.category?.value?.categoryTree;return re(u)}),i=a(()=>n.value!==void 0);function l(u){if(u)try{return new URL(u).pathname}catch{return u}}function s(u){return u?.map(O=>({...O,url:l(O.url)??O.url}))}const v=a(()=>s(r.value));function d(u){const O=oe(u,o.value,v.value);return{...u,performAction:O,nestedItems:u.nestedItems?.map(d)}}const c=a(()=>n.value?.items?n.value.items.map(d):[]);return f({hasContent:i,items:c})}const _t="menu";function Rt(){return pe(_t)}function yt(){return globalThis.craneSharedTranslation??{}}function St(){const e=g(),t=a(()=>e.site?.value),n=a(()=>yt()),o=a(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=o.value,s=i[l]?.[r];if(s!==void 0)return s;if(l!=="en"){const v=i.en?.[r];if(v!==void 0)return v}return r},currentLanguageCode:o}}function ht(e){const t=g(),n=a(()=>t.design.value[e]),o=a(()=>{const l=n.value?.items;return l!==void 0&&Object.keys(l).length>0}),r=a(()=>n.value?.items),i=a(()=>n.value?.sortable??!1);return f({hasItems:o,items:r,sortable:i})}function Te(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);return n===void 0?void 0:e.fontFamily?.[n]?.replaceAll("_"," ")}function w(e,t,n){return t?Te(e,t):Te(e,n)}function me(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function k(e,t,n){return t?me(e,t):me(e,n)}function Ie(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function C(e,t,n){return t?Ie(e,t):Ie(e,n)}function At(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:C(e,t?.color,n?.color)}}function Nt(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:C(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:C(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:C(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),o=a(()=>n.value?.background);return f({background:o})}function Dt(e){const t=g(),n=a(()=>{const d=t.design.value[e],c=t.defaults.value[e],u=t.globalDesign.value;return{appearance:d?.appearance??c?.appearance,font:w(u,d?.font,c?.font),size:d?.size??c?.size,style:d?.style??c?.style,color:C(u,d?.color,c?.color),visible:d?.visible??c?.visible??!1}}),o=a(()=>n.value?.appearance),r=a(()=>n.value?.font),i=a(()=>n.value?.size),l=a(()=>n.value?.style),s=a(()=>n.value?.color),v=a(()=>n.value?.visible);return f({appearance:o,font:r,size:i,style:l,color:s,visible:v.value??!1})}function Gt(e){const t=g(),n=a(()=>{const i=t.design.value[e],l=t.defaults.value[e],s=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:C(s,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:C(s,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:C(s,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),o=a(()=>n.value?.overlay),r=a(()=>n.value?.visible);return f({overlay:o,visible:r})}function wt(){const e=g(),t=a(()=>e.design.value.layout),n=a(()=>t.value);return f({layout:n})}function xt(){const e=g();return a(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,o=e.globalDesign.value;return{font:w(o,t?.font,n?.font),size:k(o,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:C(o,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:At(o,t?.frame,n?.frame)}})}function kt(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),o=a(()=>n.value?.value);return f({value:o})}function Bt(e){const t=g(),n=a(()=>{const d=t.design.value[e],c=t.defaults.value[e],u=t.globalDesign.value;return{font:w(u,d?.font,c?.font),size:k(u,d?.size,c?.size),bold:d?.bold??c?.bold,italic:d?.italic??c?.italic,color:C(u,d?.color,c?.color),visible:d?.visible??c?.visible??!1}}),o=a(()=>n.value?.font),r=a(()=>n.value?.size),i=a(()=>n.value?.bold),l=a(()=>n.value?.italic),s=a(()=>n.value?.color),v=a(()=>n.value?.visible);return f({font:o,size:r,bold:i,italic:l,color:s,visible:v})}function $t(e){const t=g(),n=a(()=>{const c=t.design.value[e],u=t.defaults.value[e],O=t.globalDesign.value;return{font:w(O,c?.font,u?.font),size:k(O,c?.size,u?.size),bold:c?.bold??u?.bold,italic:c?.italic??u?.italic,color:C(O,c?.color,u?.color),visible:c?.visible??u?.visible??!1,whiteSpace:"pre-wrap"}}),o=a(()=>n.value?.font),r=a(()=>n.value?.size),i=a(()=>n.value?.bold),l=a(()=>n.value?.italic),s=a(()=>n.value?.color),v=a(()=>n.value?.visible),d=a(()=>n.value?.whiteSpace);return f({font:o,size:r,bold:i,italic:l,color:s,visible:v,whiteSpace:d})}function Mt(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),o=a(()=>n.value?.enabled);return f({enabled:o})}const Ut={configuration:e=>({metadata:{...e.metadata},sections:[...e.sections]})};function E(e){return t=>{const{type:n}=t;return"type"in t?t:{type:e,...t}}}function T(e){return t=>{const{type:n,defaults:o,...r}=t,i=o?E(e)(o):void 0;return{type:e,...r,...i!==void 0?{defaults:i}:{}}}}const Pt={inputbox:T("INPUTBOX"),textarea:T("TEXTAREA"),button:T("BUTTON"),image:T("IMAGE"),toggle:T("TOGGLE"),selectbox:T("SELECTBOX"),deck:T("DECK"),menu:T("MENU"),navigationMenu:T("NAVIGATION_MENU"),logo:T("LOGO"),productSelector:T("PRODUCT_SELECTOR"),categorySelector:T("CATEGORY_SELECTOR"),divider:T("DIVIDER"),info:T("INFO"),default:{inputbox:E("INPUTBOX"),textarea:E("TEXTAREA"),button:E("BUTTON"),selectbox:E("SELECTBOX"),image:E("IMAGE"),toggle:E("TOGGLE"),divider:E("DIVIDER"),info:E("INFO"),deck:E("DECK"),logo:E("LOGO"),menu:E("MENU"),navigationMenu:E("NAVIGATION_MENU"),productSelector:E("PRODUCT_SELECTOR"),categorySelector:E("CATEGORY_SELECTOR")}};function L(e){return t=>{const{type:n}=t;return"type"in t?t:{type:e,...t}}}function b(e){return t=>{const{type:n,defaults:o,...r}=t,i=o?L(e)(o):void 0;return{type:e,...r,...i!==void 0?{defaults:i}:{}}}}const Kt={text:b("TEXT"),button:b("BUTTON"),image:b("IMAGE"),toggle:b("TOGGLE"),selectbox:b("SELECTBOX"),background:b("BACKGROUND"),colorPicker:b("COLOR_PICKER"),logo:b("LOGO"),divider:b("DIVIDER"),info:b("INFO"),accordion:b("ACCORDION"),default:{text:L("TEXT"),button:L("BUTTON"),image:L("IMAGE"),toggle:L("TOGGLE"),selectbox:L("SELECTBOX"),background:L("BACKGROUND"),colorPicker:L("COLOR_PICKER"),logo:L("LOGO"),accordion:L("ACCORDION"),info:L("INFO")}};function _(e){return t=>{const{type:n,defaults:o,...r}=t,i=o,l=i&&!("type"in i)?{...i,type:e}:o;return{type:e,...r,...l!==void 0?{defaults:l}:{}}}}const zt={init:e=>({...e}),designOverride:{text:_("TEXT"),button:_("BUTTON"),image:_("IMAGE"),toggle:_("TOGGLE"),selectbox:_("SELECTBOX"),background:_("BACKGROUND"),colorPicker:_("COLOR_PICKER"),logo:_("LOGO"),divider:_("DIVIDER"),info:_("INFO"),accordion:_("ACCORDION")}},Ft={init:e=>e},Xt={configuration:e=>({...e}),page:e=>({...e})},Yt={default:e=>{const{type:t,...n}=e;return{type:"default",...n}},custom:e=>{const{type:t,...n}=e;return{type:"custom",...n}},store:(e={})=>{const{type:t,...n}=e;return{type:"store",...n}}},Vt={init:e=>({...e})};export{V as ActionLinkTypeEnum,we as BackgroundStyleEnum,Ne as ButtonAppearanceEnum,Ge as ButtonShapeEnum,De as ButtonSizeEnum,he as ButtonTypeEnum,Pe as CatalogLayoutSlot,Ke as CategoryLayoutSlot,Me as Color,Y as ConfigTypeEnum,ke as DesignEditorType,I as EditorTypes,J as ImageSet,q as InstantsiteJsEvent,$e as LogoTypeEnum,Se as OverlayType,Ae as OverlayTypeEnum,X as PluginTypeEnum,ze as ProductLayoutSlot,xe as SectionTypeEnum,Fe as TemplateCategoriesList,Be as ValidationTypeEnum,Ue as asStructuredColor,Ut as collection,Pt as content,Re as createLayoutApp,Ve as createTextStyle,_e as createVueClientApp,ye as createVueServerApp,Kt as design,te as getBackgroundStyle,N as getColorHex,ee as getContrastTextColor,ne as getCurrentLanguageCode,Z as isColorDark,zt as layout,Yt as section,Ft as showcase,Xt as template,Vt as translation,ht as useAccordionElementDesign,Nt as useBackgroundElementDesign,je as useBackgroundStyle,ae as useButtonElementContent,Dt as useButtonElementDesign,He as useButtonStyles,ue as useCategorySelectorElementContent,Je as useCurrentLanguage,It as useDeckElementContent,ce as useImageElementContent,Gt as useImageElementDesign,de as useInputboxElementContent,qe as useInstantsiteJsApi,wt as useLayoutElementDesign,Lt as useLogoElementContent,xt as useLogoElementDesign,pe as useMenuElementContent,Rt as useNavigationMenuElementContent,se as useProductSelectorElementContent,ve as useSelectboxElementContent,kt as useSelectboxElementDesign,Bt as useTextElementDesign,ge as useTextareaElementContent,$t as useTextareaElementDesign,fe as useToggleElementContent,Mt as useToggleElementDesign,St as useTranslation,g as useVueBaseProps};
|
|
1
|
+
import{createSSRApp as _e,getCurrentInstance as Re,ref as y,computed as a,reactive as f}from"vue";import{renderToString as ye}from"vue/server-renderer";import{z as E}from"zod";function B(e){return{app:_e(e)}}const x=new Map;function g(){const e=(r,i,l,s,v,d,c,u)=>{x.set(r._uid,{context:y(i),content:y(l),design:y(s),defaults:y(v),site:y(d?.site??{}),category:y(d?.category),storeData:y(d?.storeData),globalDesign:y(c),tileId:y(u??void 0)})},t=(r,i,l,s,v,d,c)=>{const u=x.get(r._uid);u!==void 0&&(u.content.value=i,u.design.value=l,u.defaults.value=s,u.site.value=v.site??{},u.category.value=v.category,u.globalDesign.value=d,u.storeData.value=v.storeData,u.tileId.value=c)},n=Re()?.appContext.app._uid??-1,o=x.get(n);return{init:e,update:t,context:o?.context,content:o?.content,design:o?.design,defaults:o?.defaults,site:o?.site,category:o?.category,storeData:o?.storeData,globalDesign:o?.globalDesign,tileId:o?.tileId}}function Se(e,t){return{init:()=>{const{app:n}=B(e);return t?.init?.(n),{mount:(o,r)=>{g().init(n,r.context,r.data.content,r.data.design,r.data.defaults,r.data.externalContent,r.context.globalDesign,r.data.tileId),t?.mount?.(n,o,r),n.mount(o)},update:o=>{g().update(n,o.data.content,o.data.design,o.data.defaults,o.data.externalContent,o.context.globalDesign,o.data.tileId),t?.update?.(n,o)},unmount:()=>{t?.unmount?.(n),n.unmount()}}}}}function he(e){const t={appName:"",blockName:"",version:"",scriptUrl:"",imageBuckets:{},globalDesign:{}};return{component:e,initState(n,o,r,i){g().init(n,t,o,r,i,{},{},void 0)},updateState(n,o,r,i){g().update(n,o,r,i,{},{},void 0)}}}function Ae(e,t){return{init:()=>{const{app:n}=B(e);return t?.init?.(n),{render:async(o,r)=>(g().init(n,o,r.content,r.design,r.defaults,r.externalContent,o.globalDesign,r.tileId),t?.render?.(n,o,r),{html:await ye(n,{context:o}),state:{context:o,data:r}})}}}}const Ne={SOLID:"solid",GRADIENT:"gradient",NONE:"none"},M={SCROLL_TO_TILE:"SCROLL_TO_TILE",HYPER_LINK:"HYPER_LINK",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};E.enum(Object.values(M));const De=M,U={COLOR:"COLOR",GRADIENT:"GRADIENT",NONE:"NONE"};E.enum(Object.values(U));const Ge=U,$={SOLID:"SOLID",OUTLINE:"OUTLINE",TEXT:"TEXT"};E.enum(Object.values($));const we=$,P={SMALL:"SMALL",MEDIUM:"MEDIUM",LARGE:"LARGE"};E.enum(Object.values(P));const xe=P,K={ROUND_CORNER:"ROUND_CORNER",RECTANGLE:"RECTANGLE",PILL:"PILL"};E.enum(Object.values(K));const ke=K,z={COLOR:"COLOR",GRADIENT:"GRADIENT"};E.enum(Object.values(z));const Be=z,F={SECTION:"SECTION",HEADER:"HEADER",FOOTER:"FOOTER"};E.enum(Object.values(F));const Me=F;var X=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.Misc=2]="Misc",e[e.Layout=3]="Layout",e[e.Asset=4]="Asset",e[e.SharedFiles=5]="SharedFiles",e))(X||{}),Y=(e=>(e[e.Server=0]="Server",e[e.Client=1]="Client",e[e.SectionSetting=2]="SectionSetting",e[e.SectionShowcase=3]="SectionShowcase",e[e.SectionAsset=4]="SectionAsset",e[e.TemplateDescriptor=5]="TemplateDescriptor",e[e.PageTemplateDescriptor=6]="PageTemplateDescriptor",e[e.TemplateAsset=7]="TemplateAsset",e[e.Layout=8]="Layout",e[e.LayoutSettings=9]="LayoutSettings",e[e.LayoutAsset=10]="LayoutAsset",e[e.SlotServer=11]="SlotServer",e[e.SlotClient=12]="SlotClient",e[e.SharedTranslation=13]="SharedTranslation",e[e.CollectionDescriptor=14]="CollectionDescriptor",e[e.CollectionAsset=15]="CollectionAsset",e))(Y||{}),j=(e=>(e.SCROLL_TO_TILE="SCROLL_TO_TILE",e.HYPER_LINK="HYPER_LINK",e.MAIL_LINK="MAIL_LINK",e.TEL_LINK="TEL_LINK",e.GO_TO_STORE="GO_TO_STORE",e.GO_TO_STORE_LINK="GO_TO_STORE_LINK",e.GO_TO_PAGE="GO_TO_PAGE",e))(j||{});const I={TEXTAREA:"TEXTAREA",INPUTBOX:"INPUTBOX",SELECTBOX:"SELECTBOX",IMAGE:"IMAGE",TOGGLE:"TOGGLE",BUTTON:"BUTTON",DECK:"DECK",MENU:"MENU",NAVIGATION_MENU:"NAVIGATION_MENU",LOGO:"LOGO",INFO:"INFO",DIVIDER:"DIVIDER",PRODUCT_SELECTOR:"PRODUCT_SELECTOR",CATEGORY_SELECTOR:"CATEGORY_SELECTOR"};E.enum(Object.values(I));const V={TEXT:"TEXT",BUTTON:"BUTTON",IMAGE:"IMAGE",TOGGLE:"TOGGLE",SELECTBOX:"SELECTBOX",BACKGROUND:"BACKGROUND",COLOR_PICKER:"COLOR_PICKER",LOGO:"LOGO",DIVIDER:"DIVIDER",INFO:"INFO",ACCORDION:"ACCORDION"};E.enum(Object.values(V));const Ue=V,W={CONTENT:"Content",DESIGN:"Design"};E.enum(Object.values(W));const $e=W,H={TEXT:"TEXT",IMAGE:"IMAGE"};E.enum(Object.values(H));const Pe=H;class Ke{type="STRUCTURED_COLOR";raw;hex;hsl;rgba;auto;constructor({raw:t,hex:n,hsl:o,rgba:r,auto:i}){this.raw=t,this.hex=n,this.hsl=o,this.rgba=r,this.auto=i}}function ze(e){if(e!==void 0)return{...e,type:"STRUCTURED_COLOR"}}var J=(e=>(e.ORIGINAL="original",e.WEBP_LOW_RES="webp-200x200",e.WEBP_HI_2X_RES="webp-2000x2000",e.MOBILE_WEBP_LOW_RES="cropped-webp-100x200",e.MOBILE_WEBP_HI_RES="cropped-webp-1000x2000",e))(J||{}),q=(e=>(e.TILE_LOADED="tile-loaded",e.TILE_UNLOADED="tile-unloaded",e))(q||{});const Q={PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},Z={CATEGORY_TITLE:"MAIN_TITLE",PRODUCT_LIST:"CONTROLS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"},ee={TOP_BAR:"TOP_BAR",GALLERY:"GALLERY",SIDEBAR:"SIDEBAR",DESCRIPTION:"DESCRIPTION",REVIEW_LIST:"REVIEW_LIST",RELATED_PRODUCTS:"RELATED_PRODUCTS",BOTTOM_BAR:"FOOTER",CUSTOM_SLOT:"CUSTOM_SLOT"};E.enum(Object.values(Q)),E.enum(Object.values(Z)),E.enum(Object.values(ee));const te={apparel_footwear:"apparel_footwear",vape_smoke:"vape_smoke",home_garden:"home_garden",sport_outdoor:"sport_outdoor",jewelry_accessories:"jewelry_accessories",pet_animals:"pet_animals",bikes:"bikes",health_beauty:"health_beauty",gift_shop:"gift_shop",electronics:"electronics",other:"other"};E.enum(Object.values(te));const Fe=te;function N(e,t="#000000"){return typeof e=="string"?e.startsWith("global.")?t:e:e&&e.hex?e.hex:t}function Xe(e,t,n){const o=e/255,r=t/255,i=n/255,l=o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4),s=r<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4),v=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4);return .2126*l+.7152*s+.0722*v}function Ye(e){const t=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,"#$1$1$2$2$3$3"),n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t);return n?{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16)}:null}function ne(e){const t=Ye(e);return t?Xe(t.r,t.g,t.b)<=.5:!0}function oe(e,t="#808080",n="#FFFFFF"){return ne(e)?n:t}function je(e,t={}){const{defaultFont:n="inherit",defaultSize:o=16,defaultColor:r="#000000",defaultWeight:i="normal"}=t;if(e&&!e.visible)return{display:"none"};if(!e)return{fontFamily:n,fontSize:`${o}px`,color:r,fontWeight:i,fontStyle:"normal"};const l=e.size!==void 0?`${e.size}px`:`${o}px`,s=e.font||n,v=N(e.color,r),d=e.bold?"bold":i,c=e.italic?"italic":"normal";return{fontFamily:s,fontSize:l,color:v,fontWeight:d,fontStyle:c}}function re(e,t={}){const{direction:n="to right",fallbackColor:o=""}=t;if(!e?.background)return o?{backgroundColor:o}:{};const{background:r}=e;if(r.type==="solid"&&r.solid?.color)return{backgroundColor:N(r.solid.color,o)};if(r.type==="gradient"&&r.gradient){const{fromColor:i,toColor:l}=r.gradient,s=N(i,o),v=N(l,o);return s!==""&&v!==""?{backgroundImage:`linear-gradient(${n}, ${s}, ${v})`}:{}}return o?{backgroundColor:o}:{}}function Ve(e,t={}){return a(()=>re(e,t))}const We={small:{fontSize:"14px",padding:"8px 16px"},medium:{fontSize:"16px",padding:"10px 20px"},large:{fontSize:"18px",padding:"12px 24px"}};function He(e,t={}){const n={...We,...t.sizes};return a(()=>{if(!e?.visible)return{display:"none"};const o={fontFamily:e.font??"inherit",fontWeight:"400"},r=e.size??"medium",i=n[r]??n.medium;o.fontSize=i.fontSize,o.padding=i.padding;const l=N(e.color,"#000000"),s=e.appearance;switch(s){case"outline-button":o.backgroundColor="transparent",o.color=l,o.border=`2px solid ${l}`;break;case"text-link":o.backgroundColor="transparent",o.color=l,o.border="none",o.padding="0",o.textDecoration="none";break;case"solid-button":case void 0:default:o.backgroundColor=l,o.color=oe(l),o.border=`1px solid ${l}`;break}if(s!=="text-link")switch(e.style){case"pill":o.borderRadius="999px";break;case"round-corner":o.borderRadius="4px";break;case"rectangle":case void 0:default:o.borderRadius="0";break}else o.borderRadius="0";return o})}function ae(e){return!e||e.length===0?"en":e.find(t=>t.selected)?.code??e.find(t=>t.main)?.code??"en"}function Je(){const e=g(),t=a(()=>e.site?.value);return{currentLanguage:a(()=>ae(t.value?.languages))}}function qe(){return globalThis.window.instantsite}const S={HYPER_LINK:"HYPER_LINK",SCROLL_TO_TILE:"SCROLL_TO_TILE",MAIL_LINK:"MAIL_LINK",TEL_LINK:"TEL_LINK",GO_TO_STORE:"GO_TO_STORE",GO_TO_STORE_LINK:"GO_TO_STORE_LINK",GO_TO_PAGE:"GO_TO_PAGE",GO_TO_CATEGORY:"GO_TO_CATEGORY",GO_TO_CATEGORY_LINK:"GO_TO_CATEGORY_LINK"};function Qe(e){if("tileId"in e)return e.tileId;if("tileIdForScroll"in e)return e.tileIdForScroll}function Ze(e){if("pageId"in e)return e.pageId;if("pageIdForNavigate"in e)return e.pageIdForNavigate}function et(e,t){if("pageUrl"in e)return e.pageUrl;const n=Ze(e);switch(n){case"products":return"/products";case"cart":return"/cart";case"account":return"/account";case"search":return"/search";case"home":return"/"}if(t){const o=t.find(r=>r.pageId===n);if(o)return o.url}return"/"}function tt(e){if("categoryId"in e)return e.categoryId}function nt(e){if(!e||e.length===0)return"";const t=e.find(n=>n.selected);return!t||t.main?"":`/${t.code}`}const ie=(e,t,n)=>{if(!e||t)return;const{type:o,link:r,email:i,phone:l}=e,s=g(),v=s.site?.value?.pages,d=s.site?.value?.languages,c=nt(d),u=et(e,v),O=tt(e);switch(o){case S.HYPER_LINK:if(r){const T=e.linkTarget??"_blank";return()=>window.open(r,T)}break;case S.GO_TO_STORE:case S.GO_TO_STORE_LINK:return()=>window.open(`${c}/products`,"_self");case S.GO_TO_CATEGORY:case S.GO_TO_CATEGORY_LINK:const h=n?.find(T=>T.id===O)?.url;return h===void 0?()=>window.open(`${c}/404`,"_self"):()=>window.open(h,"_self");case S.MAIL_LINK:if(i)return()=>window.open(`mailto:${i}`,"_self");break;case S.TEL_LINK:if(l)return()=>window.open(`tel:${l}`,"_self");break;case S.SCROLL_TO_TILE:if(typeof document<"u")return()=>{const T=Qe(e);document.getElementById(`tile-${T}`)?.scrollIntoView()};break;case S.GO_TO_PAGE:if(u)return()=>window.open(`${c}${u}`,"_self");break;default:console.error(`Unknown type of ActionLink: ${o}`)}};function le(e){if(!e||e.length===0)return[];const t=[];function n(o){if(t.push({id:o.id,name:o.name,url:o.urlPath}),o.children&&o.children.length>0)for(const r of o.children)n(r)}for(const o of e)n(o);return t}function ot(e){return"title"in e&&"type"in e}function rt(e,t,n,o){const r=a(()=>{const R=e.value[t];if(R!==void 0){if(ot(R))return R;throw new Error(`Element ${t} is not action link`)}}),i=a(()=>r.value?.title),l=a(()=>r.value?.type),s=a(()=>r.value?.link),v=a(()=>r.value?.email),d=a(()=>r.value?.phone),c=a(()=>r.value?.tileId?`tile-${r.value?.tileId}`:null),u=a(()=>r.value?.type==="GO_TO_STORE_LINK"?"products":r.value?.pageId),O=a(()=>r.value?.pageUrl),h=a(()=>!!i.value),T=a(()=>!!s.value),A=ie(r.value,n,o);return f({title:i,type:l,link:s,email:v,phone:d,tileDivId:c,pageId:u,pageUrl:O,hasTitle:h,hasLink:T,performAction:A})}function ue(e,t){const n=g(),o=a(()=>!!n.site?.value?.isPreviewMode),r=a(()=>{const l=n.category?.value?.categoryTree;return le(l)}),i=a(()=>t!==void 0?t:n.content.value!==void 0?n.content.value:{});return rt(i,e,o.value,r.value)}function se({content:e,elementName:t,errorMessage:n,validatorFn:o}){return a(()=>{const r=e.value?.[t];if(r!==void 0){if(o(r))return r;throw new Error(n)}})}function at(e){return typeof e=="object"&&e!==null&&"categories"in e}function it(e){return a(()=>e.value.reduce((t,n)=>(t[n.id]=n,t),{}))}function lt(e){return e!==void 0}function ut(e){return!!e?.trim()}function st({name:e,customName:t,selectionType:n}){return n==="ROOT"?e:ut(t)?t:e}function ct(e,t){return lt(e)&&t}function ce({itemId:e,id:t,alt:n,name:o,nameTranslated:r,customName:i,enabled:l,productsCount:s,url:v,imageUrl:d,thumbnailImageUrl:c,imageBorderInfo:u,selectionType:O}){return{itemId:e||t.toString(),id:t,alt:n,name:st({name:o,customName:i,selectionType:O}),nameTranslated:r,label:o,enabled:l,url:v,productsCount:s,imageUrl:d,thumbnailImageUrl:c,imageBorderInfo:u,showCategory:ct(t,l)}}function de(e,t,n){const o=g(),r=a(()=>t!==void 0?t:o.content.value),i=se({content:r,elementName:e,errorMessage:`Element ${e} is not a category selector type`,validatorFn:at}),l=a(()=>n??o.storeData?.value),s=a(()=>i.value?.categories.selectionType??"ROOT"),v=a(()=>l.value?.categories??[]),d=a(()=>i.value?.categories?.categoryIds??[]),c=a(()=>{const h=it(v);return s.value==="MANUAL"?i.value?.categories?.items?.flatMap(T=>{const A=h.value[T.id];return A?[ce({...T,...A,selectionType:s.value})]:[]})??[]:l?.value?.categories.map(T=>ce({...T,selectionType:s.value}))??[]}),u=a(()=>c.value.length>0),O=a(()=>c.value!==void 0&&c.value.length>0);return f({categories:c,categoryIds:d,hasContent:u,hasCategories:O})}function dt(e){return typeof e=="object"&&e!==null&&("products"in e||"product"in e)}function ve(e,t,n){const o=g(),r=a(()=>t!==void 0?t:o.content.value),i=se({content:r,elementName:e,errorMessage:`Element ${e} is not a product selector type`,validatorFn:dt}),l=a(()=>n??o.storeData?.value),s=a(()=>i.value===void 0?"ALL":i.value.products?.selectionType??"MANUAL"),v=a(()=>i.value?.products?.productIds??[]),d=a(()=>i.value?.product?.id),c=a(()=>typeof i.value?.categoryId=="number"?i.value.categoryId:void 0),u=a(()=>{if(s.value==="ALL")return l?.value?.products??[];if(s.value==="CATEGORY")return c.value===0?l?.value?.products.filter(R=>R?.defaultCategoryId===0)??[]:l?.value?.products.filter(R=>c.value&&R?.categoryIds?.includes(c.value))??[];const A=d.value?[d.value]:v.value??[];return l?.value?.products?.filter(R=>A.includes(R.id))??[]}),O=a(()=>l?.value?.categories.filter(A=>A.id===c?.value)??[]),h=a(()=>u.value.length>0),T=a(()=>u.value!==void 0&&u.value.length>0);return f({products:u,categories:O,categoryId:c,hasContent:h,hasProducts:T})}function vt(e){return"bucket"in e&&"set"in e}function D(e,t){const n=new RegExp(/^https?:\/\//);return e!=null&&n.test(e)?e:`${t}/${e}`}function gt(e,t){const n=a(()=>{const d=e.value[t];if(d!==void 0){if(vt(d))return d;throw new Error(`Element ${t} is not image`)}}),o=a(()=>n.value===void 0?"":g().context.value.imageBuckets?.[n.value?.bucket]),r=a(()=>n.value!==void 0),i=a(()=>D(n.value?.set?.["cropped-webp-100x200"]?.url,o.value)),l=a(()=>D(n.value?.set?.["cropped-webp-1000x2000"]?.url,o.value)),s=a(()=>D(n.value?.set?.["webp-200x200"]?.url,o.value)),v=a(()=>D(n.value?.set?.["webp-2000x2000"]?.url,o.value));return f({hasContent:r,lowResolutionMobileImage:i,highResolutionMobileImage:l,lowResolutionDesktopImage:s,highResolutionDesktopImage:v})}function ge(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return gt(o,e)}function ft(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not inputbox`)}}),o=a(()=>n.value!==void 0&&n.value.length>0),r=a(()=>n.value);return f({hasContent:o,value:r})}function fe(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return ft(o,e)}function Ot(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not selectbox`)}}),o=a(()=>n.value!==void 0),r=a(()=>n.value);return f({hasContent:o,value:r})}function Oe(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Ot(o,e)}function Et(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(typeof i=="string")return i;throw new Error(`Element ${t} is not textarea`)}}),o=a(()=>n.value!==void 0&&n.value.length>0),r=a(()=>n.value);return f({hasContent:o,value:r})}function Ee(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Et(o,e)}function pt(e){return"enabled"in e}function Tt(e,t){const n=a(()=>{const i=e.value[t];if(i!==void 0){if(pt(i))return i;throw new Error(`Element ${t} is not toggle`)}}),o=a(()=>n.value!==void 0),r=a(()=>n.value?.enabled);return f({hasContent:o,value:r})}function pe(e,t){const n=g(),o=a(()=>t!==void 0?t:n.content.value);return Tt(o,e)}function Te(e){if(typeof e!="object"||e===null)return!1;const t=e;return Array.isArray(t.cards)&&t.cards.every(n=>typeof n.settings=="object"&&n.settings!==null)}function me(e,t,n,o){if(e==null)throw Error("Could not get a reactive ref for undefined Card");const r=e.settings[n];if(r===void 0)return r;switch(t){case I.TEXTAREA:return Ee(n,e.settings);case I.INPUTBOX:return fe(n,e.settings);case I.SELECTBOX:return Oe(n,e.settings);case I.IMAGE:return ge(n,e.settings);case I.TOGGLE:return pe(n,e.settings);case I.BUTTON:return ue(n,e.settings);case I.CATEGORY_SELECTOR:return de(n,e.settings,o);case I.PRODUCT_SELECTOR:return ve(n,e.settings,o);case I.DECK:return mt(e,n,o);default:return}}function mt(e,t,n){const o=a(()=>{const l=e.settings[t];if(l!==void 0){if(Te(l))return l;throw new Error(`Element ${t} is not of DECK type`)}}),r=a(()=>o.value!==void 0&&o.value.cards.length>0),i=a(()=>o.value?.cards);return f({hasContent:r,cards:i,getReactiveRef:(l,s,v)=>me(l,s,v,n)})}function It(e){const t=g(),n=a(()=>t.storeData?.value),o=a(()=>{const l=t.content.value[e];if(l!==void 0){if(Te(l))return l;throw new Error(`Element ${e} is not of DECK type`)}}),r=a(()=>o.value!==void 0&&o.value.cards.length>0),i=a(()=>o.value?.cards);return f({hasContent:r,cards:i,getReactiveRef:(l,s,v)=>me(l,s,v,n.value)})}function Ct(e){return"type"in e&&("text"in e||"image"in e)}function G(e,t){const n=new RegExp(/^https?:\/\//);return e!==void 0&&n.test(e)?e:`${t}/${e}`}function Lt(){const e=g(),t=a(()=>{const l=e.content.value.logo;if(l!==void 0){if(Ct(l))return l;throw new Error("Element logo is not LOGO")}}),n=a(()=>t.value?.type),o=a(()=>t.value?.text),r=a(()=>t.value?.image===void 0?"":e.context.value.imageBuckets?.[t.value.image.bucket]),i=a(()=>({lowResolutionMobileImage:G(t.value?.image?.set?.["cropped-webp-100x200"]?.url,r.value),highResolutionMobileImage:G(t.value?.image?.set?.["cropped-webp-1000x2000"]?.url,r.value),lowResolutionDesktopImage:G(t.value?.image?.set?.["webp-200x200"]?.url,r.value),highResolutionDesktopImage:G(t.value?.image?.set?.["webp-2000x2000"]?.url,r.value)}));return f({type:n,text:o,image:i})}function bt(e){return e!==null&&"items"in e}function Ie(e){const t=g(),n=a(()=>{const u=t.content.value[e];if(u!==void 0){if(bt(u))return u;throw new Error(`Element ${e} is not an menu`)}}),o=a(()=>!!t.site?.value?.isPreviewMode),r=a(()=>{const u=t.category?.value?.categoryTree;return le(u)}),i=a(()=>n.value!==void 0);function l(u){if(u)try{return new URL(u).pathname}catch{return u}}function s(u){return u?.map(O=>({...O,url:l(O.url)??O.url}))}const v=a(()=>s(r.value));function d(u){const O=ie(u,o.value,v.value);return{...u,performAction:O,nestedItems:u.nestedItems?.map(d)}}const c=a(()=>n.value?.items?n.value.items.map(d):[]);return f({hasContent:i,items:c})}const _t="menu";function Rt(){return Ie(_t)}function yt(){return globalThis.craneSharedTranslation??{}}function St(){const e=g(),t=a(()=>e.site?.value),n=a(()=>yt()),o=a(()=>{const r=t.value?.languages;return r?r.find(i=>i.selected)?.code??r.find(i=>i.main)?.code??"en":"en"});return{t:r=>{const i=n.value;if(!i||Object.keys(i).length===0)return r;const l=o.value,s=i[l]?.[r];if(s!==void 0)return s;if(l!=="en"){const v=i.en?.[r];if(v!==void 0)return v}return r},currentLanguageCode:o}}function ht(e){const t=g(),n=a(()=>t.design.value[e]),o=a(()=>{const l=n.value?.items;return l!==void 0&&Object.keys(l).length>0}),r=a(()=>n.value?.items),i=a(()=>n.value?.sortable??!1);return f({hasItems:o,items:r,sortable:i})}function Ce(e,t){if(t===void 0)return;if(!t.startsWith("global."))return t.replaceAll("_"," ");const n=t.split(".").at(2);return n===void 0?void 0:e.fontFamily?.[n]?.replaceAll("_"," ")}function w(e,t,n){return t?Ce(e,t):Ce(e,n)}function Le(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.textSize?e.textSize[n]:void 0}function k(e,t,n){return t?Le(e,t):Le(e,n)}function be(e,t){if(t===void 0)return;if(typeof t!="string"||!t.startsWith("global."))return t;const n=t.split(".").at(2);if(n!==void 0)return e.color?e.color[n]:void 0}function C(e,t,n){return t?be(e,t):be(e,n)}function At(e,t,n){return{visible:t?.visible??n?.visible??!1,width:t?.width??n?.width??1,color:C(e,t?.color,n?.color)}}function Nt(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e],l=t.globalDesign.value;return{background:{type:r?.background?.type??i?.background?.type,solid:{color:C(l,r?.background?.solid?.color,i?.background?.solid?.color)},gradient:{fromColor:C(l,r?.background?.gradient?.fromColor,i?.background?.gradient?.fromColor),toColor:C(l,r?.background?.gradient?.toColor,i?.background?.gradient?.toColor)}}}}),o=a(()=>n.value?.background);return f({background:o})}function Dt(e){const t=g(),n=a(()=>{const d=t.design.value[e],c=t.defaults.value[e],u=t.globalDesign.value;return{appearance:d?.appearance??c?.appearance,font:w(u,d?.font,c?.font),size:d?.size??c?.size,style:d?.style??c?.style,color:C(u,d?.color,c?.color),visible:d?.visible??c?.visible??!1}}),o=a(()=>n.value?.appearance),r=a(()=>n.value?.font),i=a(()=>n.value?.size),l=a(()=>n.value?.style),s=a(()=>n.value?.color),v=a(()=>n.value?.visible);return f({appearance:o,font:r,size:i,style:l,color:s,visible:v.value??!1})}function Gt(e){const t=g(),n=a(()=>{const i=t.design.value[e],l=t.defaults.value[e],s=t.globalDesign.value;return{overlay:{type:i?.overlay?.type??l?.overlay?.type,solid:{color:C(s,i?.overlay?.solid?.color,l?.overlay?.solid?.color)},gradient:{fromColor:C(s,i?.overlay?.gradient?.fromColor,l?.overlay?.gradient?.fromColor),toColor:C(s,i?.overlay?.gradient?.toColor,l?.overlay?.gradient?.toColor)}},visible:i?.visible??l?.visible??!1}}),o=a(()=>n.value?.overlay),r=a(()=>n.value?.visible);return f({overlay:o,visible:r})}function wt(){const e=g(),t=a(()=>e.design.value.layout),n=a(()=>t.value);return f({layout:n})}function xt(){const e=g();return a(()=>{const t=e.design.value.logo,n=e.defaults.value.logo,o=e.globalDesign.value;return{font:w(o,t?.font,n?.font),size:k(o,t?.size,n?.size),bold:t?.bold??n?.bold,italic:t?.italic??n?.italic,color:C(o,t?.color,n?.color),visible:t?.visible??n?.visible??!1,spacing:t?.spacing??n?.spacing??0,capitalization:t?.capitalization??n?.capitalization??"none",frame:At(o,t?.frame,n?.frame)}})}function kt(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{value:r?.value??i?.value}}),o=a(()=>n.value?.value);return f({value:o})}function Bt(e){const t=g(),n=a(()=>{const d=t.design.value[e],c=t.defaults.value[e],u=t.globalDesign.value;return{font:w(u,d?.font,c?.font),size:k(u,d?.size,c?.size),bold:d?.bold??c?.bold,italic:d?.italic??c?.italic,color:C(u,d?.color,c?.color),visible:d?.visible??c?.visible??!1}}),o=a(()=>n.value?.font),r=a(()=>n.value?.size),i=a(()=>n.value?.bold),l=a(()=>n.value?.italic),s=a(()=>n.value?.color),v=a(()=>n.value?.visible);return f({font:o,size:r,bold:i,italic:l,color:s,visible:v})}function Mt(e){const t=g(),n=a(()=>{const c=t.design.value[e],u=t.defaults.value[e],O=t.globalDesign.value;return{font:w(O,c?.font,u?.font),size:k(O,c?.size,u?.size),bold:c?.bold??u?.bold,italic:c?.italic??u?.italic,color:C(O,c?.color,u?.color),visible:c?.visible??u?.visible??!1,whiteSpace:"pre-wrap"}}),o=a(()=>n.value?.font),r=a(()=>n.value?.size),i=a(()=>n.value?.bold),l=a(()=>n.value?.italic),s=a(()=>n.value?.color),v=a(()=>n.value?.visible),d=a(()=>n.value?.whiteSpace);return f({font:o,size:r,bold:i,italic:l,color:s,visible:v,whiteSpace:d})}function Ut(e){const t=g(),n=a(()=>{const r=t.design.value[e],i=t.defaults.value[e];return{enabled:r?.enabled??i?.enabled}}),o=a(()=>n.value?.enabled);return f({enabled:o})}const $t={configuration:e=>({metadata:{...e.metadata},sections:[...e.sections]})};function p(e){return t=>{const{type:n}=t;return"type"in t?t:{type:e,...t}}}function m(e){return t=>{const{type:n,defaults:o,...r}=t,i=o?p(e)(o):void 0;return{type:e,...r,...i!==void 0?{defaults:i}:{}}}}const Pt={inputbox:m("INPUTBOX"),textarea:m("TEXTAREA"),button:m("BUTTON"),image:m("IMAGE"),toggle:m("TOGGLE"),selectbox:m("SELECTBOX"),deck:m("DECK"),menu:m("MENU"),navigationMenu:m("NAVIGATION_MENU"),logo:m("LOGO"),productSelector:m("PRODUCT_SELECTOR"),categorySelector:m("CATEGORY_SELECTOR"),divider:m("DIVIDER"),info:m("INFO"),default:{inputbox:p("INPUTBOX"),textarea:p("TEXTAREA"),button:p("BUTTON"),selectbox:p("SELECTBOX"),image:p("IMAGE"),toggle:p("TOGGLE"),divider:p("DIVIDER"),info:p("INFO"),deck:p("DECK"),logo:p("LOGO"),menu:p("MENU"),navigationMenu:p("NAVIGATION_MENU"),productSelector:p("PRODUCT_SELECTOR"),categorySelector:p("CATEGORY_SELECTOR")}};function L(e){return t=>{const{type:n}=t;return"type"in t?t:{type:e,...t}}}function b(e){return t=>{const{type:n,defaults:o,...r}=t,i=o?L(e)(o):void 0;return{type:e,...r,...i!==void 0?{defaults:i}:{}}}}const Kt={text:b("TEXT"),button:b("BUTTON"),image:b("IMAGE"),toggle:b("TOGGLE"),selectbox:b("SELECTBOX"),background:b("BACKGROUND"),colorPicker:b("COLOR_PICKER"),logo:b("LOGO"),divider:b("DIVIDER"),info:b("INFO"),accordion:b("ACCORDION"),default:{text:L("TEXT"),button:L("BUTTON"),image:L("IMAGE"),toggle:L("TOGGLE"),selectbox:L("SELECTBOX"),background:L("BACKGROUND"),colorPicker:L("COLOR_PICKER"),logo:L("LOGO"),accordion:L("ACCORDION"),info:L("INFO")}};function _(e){return t=>{const{type:n,defaults:o,...r}=t,i=o,l=i&&!("type"in i)?{...i,type:e}:o;return{type:e,...r,...l!==void 0?{defaults:l}:{}}}}const zt={init:e=>({...e}),designOverride:{text:_("TEXT"),button:_("BUTTON"),image:_("IMAGE"),toggle:_("TOGGLE"),selectbox:_("SELECTBOX"),background:_("BACKGROUND"),colorPicker:_("COLOR_PICKER"),logo:_("LOGO"),divider:_("DIVIDER"),info:_("INFO"),accordion:_("ACCORDION")}},Ft={init:e=>e},Xt={configuration:e=>({...e}),page:e=>({...e})},Yt={default:e=>{const{type:t,...n}=e;return{type:"default",...n}},custom:e=>{const{type:t,...n}=e;return{type:"custom",...n}},store:(e={})=>{const{type:t,...n}=e;return{type:"store",...n}}},jt={init:e=>({...e})};export{j as ActionLinkTypeEnum,Be as BackgroundStyleEnum,we as ButtonAppearanceEnum,ke as ButtonShapeEnum,xe as ButtonSizeEnum,De as ButtonTypeEnum,Q as CatalogLayoutSlot,Z as CategoryLayoutSlot,Ke as Color,Y as ConfigTypeEnum,Ue as DesignEditorType,I as EditorTypes,J as ImageSet,q as InstantsiteJsEvent,Pe as LogoTypeEnum,Ne as OverlayType,Ge as OverlayTypeEnum,X as PluginTypeEnum,ee as ProductLayoutSlot,Me as SectionTypeEnum,Fe as TemplateCategoriesList,$e as ValidationTypeEnum,ze as asStructuredColor,$t as collection,Pt as content,he as createLayoutApp,je as createTextStyle,Se as createVueClientApp,Ae as createVueServerApp,Kt as design,re as getBackgroundStyle,N as getColorHex,oe as getContrastTextColor,ae as getCurrentLanguageCode,ne as isColorDark,zt as layout,Yt as section,Ft as showcase,Xt as template,jt as translation,ht as useAccordionElementDesign,Nt as useBackgroundElementDesign,Ve as useBackgroundStyle,ue as useButtonElementContent,Dt as useButtonElementDesign,He as useButtonStyles,de as useCategorySelectorElementContent,Je as useCurrentLanguage,It as useDeckElementContent,ge as useImageElementContent,Gt as useImageElementDesign,fe as useInputboxElementContent,qe as useInstantsiteJsApi,wt as useLayoutElementDesign,Lt as useLogoElementContent,xt as useLogoElementDesign,Ie as useMenuElementContent,Rt as useNavigationMenuElementContent,ve as useProductSelectorElementContent,Oe as useSelectboxElementContent,kt as useSelectboxElementDesign,Bt as useTextElementDesign,Ee as useTextareaElementContent,Mt as useTextareaElementDesign,pe as useToggleElementContent,Ut as useToggleElementDesign,St as useTranslation,g as useVueBaseProps};
|