PageSourceSearch

https://marketplace.mainstreet.co.in/cdn/shop/t/70/assets/spectrum-sdk.js?v=39443963607569225581789637758

js mainstreet.co.in collected 2026-10-06 13:07:12 UTC 46,427 bytes, 10 lines download raw bytes

1(function(){if(window.Spectrum)return;const VERSION="1.10.1",_config={};function configure(options={}){Object.assign(_config,options)}function _root(){return _config.root||window.Shopify?.routes?.root||"/"}function _defaultMoneyFormat(){return _config.moneyFormat||window.theme?.money_format||"{{amount}}"}const _JSON_HEADERS={"Content-Type":"application/json"};async function _request(endpoint,{method="GET",body,signal}={}){const options={method,signal};body!==void 0&&(body instanceof FormData?options.body=body:(options.headers=_JSON_HEADERS,options.body=JSON.stringify(body)));const res=await fetch(`${_root()}${endpoint}`,options);if(!res.ok){let message=`Request to ${endpoint} failed (${res.status})`;try{const data2=await res.json();data2.description&&(message=data2.description)}catch{}throw new Error(message)}const data=await res.json();if(typeof data.status=="number"&&data.status>=400&&data.description)throw new Error(data.description);return data}async function _requestHTML(url,{signal}={}){const res=await fetch(url,{signal});if(!res.ok)throw new Error(`Section request failed (${res.status})`);return res.text()}function _proxyBase(){const url=window.__spectrumAi?.baseProxyUrl;return url?url.replace(/\/+$/,""):null}function _customer(){return window.__spectrumAi?.customer||null}function _isLoggedIn(){return!!_customer()}function _normalizeSuccess(data){return{ok:!0,data}}function _normalizeError(raw,fallbackCode){let message="Unknown error",code=fallbackCode||"UNKNOWN";return raw&&typeof raw=="object"?(typeof raw.error=="string"?message=raw.error:typeof raw.message=="string"&&(message=raw.message),typeof raw.code=="string"&&(code=raw.code)):typeof raw=="string"&&(message=raw),{ok:!1,error:{message,code}}}function _pickDefined(obj){if(!obj)return{};const result={};for(const k of Object.keys(obj))obj[k]!==void 0&&obj[k]!==null&&(result[k]=obj[k]);return result}function _toQueryString(params){return params?Object.keys(params).filter(k=>params[k]!==void 0&&params[k]!==null).map(k=>`${encodeURIComponent(k)}=${encodeURIComponent(params[k])}`).join("&"):""}function _buildUrl(base,path,queryParams){let url=base+(path||"");const qs=_toQueryString(queryParams);return qs&&(url+="?"+qs),url}async function _getJSON(url,{signal}={}){try{const res=await fetch(url,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",signal}),body=await res.json();return res.ok?_normalizeSuccess(body):_normalizeError(body,`HTTP_${res.status}`)}catch(err){return err.name==="AbortError"?_normalizeError({error:"Request aborted",code:"ABORTED"},"ABORTED"):_normalizeError({error:err.message,code:"NETWORK_ERROR"},"NETWORK_ERROR")}}async function _postJSON(url,body,{signal}={}){try{const res=await fetch(url,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},credentials:"same-origin",body:JSON.stringify(body),signal}),data=await res.json();return res.ok?_normalizeSuccess(data):_normalizeError(data,`HTTP_${res.status}`)}catch(err){return err.name==="AbortError"?_normalizeError({error:"Request aborted",code:"ABORTED"},"ABORTED"):_normalizeError({error:err.message,code:"NETWORK_ERROR"},"NETWORK_ERROR")}}async function _postFormData(url,formData,{signal}={}){try{const res=await fetch(url,{method:"POST",credentials:"same-origin",body:formData,signal}),data=await res.json();return res.ok?_normalizeSuccess(data):_normalizeError(data,`HTTP_${res.status}`)}catch(err){return err.name==="AbortError"?_normalizeError({error:"Request aborted",code:"ABORTED"},"ABORTED"):_normalizeError({error:err.message,code:"NETWORK_ERROR"},"NETWORK_ERROR")}}function _track(name,properties){try{window.__spectrumAi?.analytics?.trackEvent(name,properties)}catch{}}function _emit(name,detail){try{window.__spectrumAi?.emit?.(name,detail)}catch{}}function _numericId(gid){return gid?.split("/").pop()||gid}function _currency(){return window.Shopify?.currency?.active}function _wishlistAddProps(wishlistId,data,guest){const props={product:{id:_numericId(data.shopifyProductGid)},wishlistId,guest};return data.handle&&(props.product.handle=data.handle),data.title&&(props.product.title=data.title),data.image&&(props.product.image=data.image),data.shopifyVariantGid&&(props.variant={id:_numericId(data.shopifyVariantGid)}),data.metadata?.priceAtAdd!=null&&(props.price={amount:data.metadata.priceAtAdd,currencyCode:data.metadata.currencyCode}),props}function _wishlistCartVariantId(item,opts){const raw=opts?.variant_id??opts?.variantId??opts?.shopify_variant_id??opts?.shopifyVariantId??opts?.shopifyVariantGid??item?.variant_id??item?.variantId??item?.shopify_variant_id??item?.shopifyVariantId??item?.shopifyVariantGid;return _numericId(raw)}function _wishlistAddToCartProps(wishlistId,item,line,opts){const metadata=item?.metadata&&typeof item.metadata=="object"?item.metadata:{};return _pickDefined({wishlist_id:wishlistId??item?.wishlistId??item?.wishlist_id,wishlist_item_id:opts?.wishlist_item_id??opts?.wishlistItemId??item?.itemId??item?.id,product_id:_numericId(opts?.product_id??opts?.productId??opts?.shopify_product_id??opts?.shopifyProductId??opts?.shopifyProductGid??item?.product_id??item?.productId??item?.shopify_product_id??item?.shopifyProductId??item?.shopifyProductGid),product_handle:opts?.product_handle??opts?.productHandle??item?.handle??item?.productHandle,product_title:opts?.product_title??opts?.productTitle??item?.title,variant_id:_numericId(line?.id),quantity:Number(line?.quantity||1),guest:opts?.guest??!_isLoggedIn(),surface:opts?.surface??item?.surface??metadata.surface,placement:opts?.placement??item?.placement??metadata.placement})}function _autoApplyBestCoupon(){try{const tags=document.querySelectorAll('script[id^="pa-data-"]');let bestCode=null,bestSavings=0;for(const tag of tags){let items;try{items=JSON.parse(tag.textContent)}catch{continue}if(!Array.isArray(items)||!items.length)continue;
1const key=tag.id.replace("pa-data-",""),priceEl=document.querySelector(`[data-pa-id="${key}"]`),priceCents=priceEl?parseInt(priceEl.getAttribute("data-variant-price"),10):0;if(priceCents)for(const item of items){if(!item.code)continue;const savings=priceAdjustments.calcSavings(item,priceCents);savings>bestSavings&&(bestSavings=savings,bestCode=item.code)}}bestCode&&cart.applyCoupon(bestCode)}catch{}}function _detectThemeCartSections(){const ids=new Set,addEnclosingSection=el=>{const section=el?.closest?.('[id^="shopify-section-"]');section?.id&&ids.add(section.id.replace("shopify-section-",""))};return addEnclosingSection(document.querySelector('cart-drawer, dialog.cart-drawer__dialog, dialog[class*="cart-drawer" i], [class*="cart-drawer__inner" i]')),addEnclosingSection(document.querySelector('cart-icon, [class*="cart-icon" i]')),[...ids]}function _cartSectionsToRequest(){const hasNotification=!!document.querySelector("cart-notification"),hasDrawer=!!document.querySelector("cart-drawer"),standard=hasNotification&&!hasDrawer?["cart-notification-product","cart-notification-button","cart-icon-bubble"]:["cart-drawer","cart-icon-bubble","cart-notification"],detected=_detectThemeCartSections();return[...new Set([...detected,...standard])].slice(0,5)}function _applyCartSections(sections2){if(!(!sections2||typeof sections2!="object"))for(const[sectionId,html]of Object.entries(sections2)){if(typeof html!="string"||!html)continue;const target=document.getElementById(`shopify-section-${sectionId}`);if(target)try{const incoming=new DOMParser().parseFromString(html,"text/html").getElementById(`shopify-section-${sectionId}`);incoming&&(target.innerHTML=incoming.innerHTML)}catch{}}}async function _refreshDetectedSections(){const detected=_detectThemeCartSections();if(detected.length===0)return;const path=window.location.pathname||"/";try{const res=await fetch(`${path}?sections=${encodeURIComponent(detected.slice(0,5).join(","))}`,{credentials:"same-origin"});if(!res.ok)return;const sections2=await res.json().catch(()=>null);_applyCartSections(sections2)}catch{}}function _openCartDrawer(){const cartDrawerEl=document.querySelector("cart-drawer");if(cartDrawerEl){for(const method of["open","show","showDialog","openDrawer"])if(typeof cartDrawerEl[method]=="function")try{return cartDrawerEl[method](),!0}catch{}}const cartNotificationEl=document.querySelector("cart-notification");if(cartNotificationEl&&typeof cartNotificationEl.open=="function")try{return cartNotificationEl.open(),!0}catch{}const ariaToggle=document.querySelector('[aria-controls="cart-drawer"], [aria-controls="CartDrawer"]');if(ariaToggle instanceof HTMLElement)return ariaToggle.click(),!0;const dataToggle=document.querySelector('[data-cart-drawer-toggle], [data-action="open-cart"]');if(dataToggle instanceof HTMLElement)return dataToggle.click(),!0;const cartIconButton=document.querySelector("cart-icon")?.closest("button, a")||document.querySelector("button:has(cart-icon), a:has(cart-icon)");if(cartIconButton instanceof HTMLElement)return cartIconButton.click(),!0;const cartDialog=document.querySelector('dialog.cart-drawer__dialog, dialog[class*="cart-drawer" i]');if(cartDialog instanceof HTMLDialogElement&&!cartDialog.open)try{return cartDialog.showModal(),!0}catch{}return!1}function _dispatchCartUpdateEvents({items,sections:sections2,sourceId}){const detail={resource:"cart",sourceId:sourceId||"spectrum-sdk",data:{items,sections:sections2}},names=["cart:update","cart:updated","cart:refresh","cart:item-added","cart:build"];for(const name of names){try{document.dispatchEvent(new CustomEvent(name,{detail,bubbles:!0}))}catch{}try{window.dispatchEvent(new CustomEvent(name,{detail}))}catch{}}}let _dawnCartFixInjected=!1;function _ensureDawnCartFixStyle(){if(_dawnCartFixInjected)return;if(document.querySelector("style[data-spectrum-cart-fix]")){_dawnCartFixInjected=!0;return}const style=document.createElement("style");style.setAttribute("data-spectrum-cart-fix",""),style.textContent=`
2    .product-option { font-size: 1.4rem; word-break: break-word; }
3    .product-option * { display: inline; margin: 0; }
4    .product-option + .product-option { margin-top: 0.4rem; }
5    .cart-item__error { display: flex; align-items: flex-start; margin-top: 1rem; }
6    .cart-item__error-text { font-size: 1.2rem; }
7    .cart-item__error-text + svg { flex-shrink: 0; width: 1.2rem; margin-right: 0.7rem; }
8    .cart-item__error-text:empty + svg { display: none; }
9  `,(document.head||document.documentElement).appendChild(style),_dawnCartFixInjected=!0}async function _integrateCartAdd(cartResponse,items,sourceId){_ensureDawnCartFixStyle();const sections2=cartResponse?.sections;if(sections2){const drawer=document.querySelector("cart-drawer");if(drawer&&typeof drawer.renderContents=="function")try{drawer.renderContents(cartResponse),drawer.classList.contains("is-empty")&&drawer.classList.remove("is-empty"),_dispatchCartUpdateEvents({items,sections:sections2,sourceId});return}catch{}const notification=document.querySelector("cart-notification");if(notification&&typeof notification.renderContents=="function")try{notification.renderContents(cartResponse),notification.classList.contains("is-empty")&&notification.classList.remove("is-empty"),_dispatchCartUpdateEvents({items,sections:sections2,sourceId});return}catch{}}_applyCartSections(sections2),await _refreshDetectedSections(),_openCartDrawer(),_dispatchCartUpdateEvents({items,sections:sections2,sourceId})}const cart={get({signal}={}){return _request("cart.js",{signal})},async add(items,{signal,sections:sections2}={}){const payload=Array.isArray(items)?items:[items],body={items:payload};sections2&&(body.sections=sections2);const result=await _request("cart/add.js",{method:"POST",body,signal});return _emit("cart:added",{items:payload,response:result}),_emit("cart:updated",{source:"add",response:result}),_autoApplyBestCoupon(),result},async addFromForm(formData,{signal}={}){const result=await _request("cart/add.js",{method:"POST",body:formData,signal});return _emit("cart:added",{source:"form",response:result}),_emit("cart:updated",{source:"add",response:result}),_autoApplyBestCoupon(),result},async addAndOpen(items,{signal,sections:sections2,sourceId}={}){const itemsArray=Array.isArray(items)?items:[items],sectionsToRequest=sections2||_cartSectionsToRequest(),response=await this.add(itemsArray,{signal,sections:sectionsToRequest});return response&&response.ok===!1||await _integrateCartAdd(response,itemsArray,sourceId),response}
9,async integrateAfterAdd(cartResponse,{items,sourceId}={}){const itemsArray=items?Array.isArray(items)?items:[items]:[];await _integrateCartAdd(cartResponse,itemsArray,sourceId)},async change(data,{signal,sections:sections2}={}){const body=sections2?{...data,sections:sections2}:data,result=await _request("cart/change.js",{method:"POST",body,signal}),removed=Number(data&&data.quantity)===0;return _emit(removed?"cart:removed":"cart:updated",{source:"change",request:data,response:result}),result},async update(data,{signal,sections:sections2}={}){const body=sections2?{...data,sections:sections2}:data,result=await _request("cart/update.js",{method:"POST",body,signal});return _emit("cart:updated",{source:"update",request:data,response:result}),result},async clear({signal}={}){const result=await _request("cart/clear.js",{method:"POST",signal});return _emit("cart:removed",{source:"clear",response:result}),_emit("cart:updated",{source:"clear",response:result}),result},async applyCoupon(code){if(!code)return!1;try{return await fetch(`${_root()}discount/${encodeURIComponent(code)}`),_emit("cart:updated",{source:"applyCoupon",code}),!0}catch{return!1}}},products={getByHandle(handle,{signal}={}){return _request(`products/${handle}.js`,{signal})},getRecommendations(productId,{intent="related",limit,signal}={}){let url=`recommendations/products.json?product_id=${productId}&intent=${intent}`;return limit!=null&&(url+=`&limit=${limit}`),_request(url,{signal})}},_RV_STORAGE_KEY="spectrum:rv:product-handles",_RV_CAP=20,recentlyViewed={getHistory(){try{const raw=window.localStorage.getItem(_RV_STORAGE_KEY);if(!raw)return[];const parsed=JSON.parse(raw);return Array.isArray(parsed)?parsed.filter(h=>typeof h=="string"&&h.length>0):[]}catch{return[]}},push(handle){if(!(typeof handle!="string"||handle===""))try{const filtered=recentlyViewed.getHistory().filter(h=>h!==handle),next=[handle,...filtered].slice(0,_RV_CAP);window.localStorage.setItem(_RV_STORAGE_KEY,JSON.stringify(next))}catch{}},clear(){try{window.localStorage.removeItem(_RV_STORAGE_KEY)}catch{}}},sections={fetch(url,{signal}={}){return _requestHTML(url,{signal})}},platform={loadFeatures(features){window.Shopify?.loadFeatures?.(features)},payments:{isReady(){return!!window.Shopify?.PaymentButton},init(){return window.Shopify?.PaymentButton?(window.Shopify.PaymentButton.init(),!0):!1},isExpressReady(){return!!window.Shopify?.StorefrontExpressButtons},expressInit(){return window.Shopify?.StorefrontExpressButtons?(window.Shopify.StorefrontExpressButtons.initialize(),!0):!1}},xr:{get isReady(){return!!window.ShopifyXR},addModels(models){window.ShopifyXR?.addModels(models)},setupElements(){window.ShopifyXR?.setupXRElements()},createModelViewer(element){return window.Shopify?.ModelViewerUI?new window.Shopify.ModelViewerUI(element):null}}},priceAdjustments={reinit(){document.dispatchEvent(new CustomEvent("pa:reinit"))},calcSavings(item,priceCents){return!item?.discount_type||!item.discount_value?0:item.discount_type==="percentage"?Math.round(priceCents*item.discount_value/100):item.discount_type==="amount"||item.discount_type==="fixed"?Math.round(item.discount_value*100):0},findBest(items,priceCents){if(!Array.isArray(items)||!priceCents)return null;let best=null,bestSavings=0;for(const item of items){const savings=this.calcSavings(item,priceCents);savings>bestSavings&&(bestSavings=savings,best=item)}return best?{item:best,savings:bestSavings}:null},async applyBestCoupon(items,priceCents){const best=this.findBest(items,priceCents);if(!best?.item.code)return null;try{return await cart.applyCoupon(best.item.code)?best:null}catch{return null}}};function _formatWithDelimiters(cents,precision,thousands,decimal){if(isNaN(cents)||cents==null)return"0";const parts=(cents/100).toFixed(precision).split("."),dollars=parts[0].replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${thousands}`),remainder=parts[1]?`${decimal}${parts[1]}`:"";return dollars+remainder}function _formatMoney(cents,format){typeof cents=="string"&&(cents=cents.replace(".","")),cents=parseInt(cents,10)||0;const formatString=format||_defaultMoneyFormat(),placeholderRegex=/\{\{\s*(\w+)\s*\}\}/,match=formatString.match(placeholderRegex);if(!match)return formatString;let value;switch(match[1]){case"amount":value=_formatWithDelimiters(cents,2,",",".");break;case"amount_no_decimals":value=_formatWithDelimiters(cents,0,",",".");break;case"amount_with_comma_separator":value=_formatWithDelimiters(cents,2,".",",");break;case"amount_no_decimals_with_comma_separator":value=_formatWithDelimiters(cents,0,".",",");break;case"amount_with_apostrophe_separator":value=_formatWithDelimiters(cents,2,"'",".");break;case"amount_with_period_and_space_separator":value=_formatWithDelimiters(cents,2," ",".");break;default:value=_formatWithDelimiters(cents,2,",",".")}return formatString.replace(placeholderRegex,value)}const money={format(cents,format){return _formatMoney(cents,format)}},_GUEST_STORAGE_KEY="__spectrum_wishlist_guest";function _getGuestItems(){try{const raw=localStorage.getItem(_GUEST_STORAGE_KEY);if(!raw)return[];const parsed=JSON.parse(raw);return Array.isArray(parsed.items)?parsed.items:[]}catch{return[]}}function _addGuestItem(item){try{const items=_getGuestItems();if(items.some(existing=>
9existing.shopifyProductGid===item.shopifyProductGid&&(existing.shopifyVariantGid||null)===(item.shopifyVariantGid||null)))return;const entry=Object.assign({},item);entry.addedAt||(entry.addedAt=new Date().toISOString()),items.push(entry),localStorage.setItem(_GUEST_STORAGE_KEY,JSON.stringify({items}))}catch{}}function _removeGuestItem(productGid){try{const filtered=_getGuestItems().filter(i=>i.shopifyProductGid!==productGid);localStorage.setItem(_GUEST_STORAGE_KEY,JSON.stringify({items:filtered}))}catch{}}function _clearGuestItems(){try{localStorage.removeItem(_GUEST_STORAGE_KEY)}catch{}}function _mergeGuestToServer(){const base=_proxyBase();return base?_postJSON(_buildUrl(`${base}/wishlist`,"/merge"),{items:_getGuestItems()}):Promise.resolve(_normalizeError("Proxy not configured","NO_PROXY"))}const reviews={async getReviews(productHandle,opts){const base=_proxyBase();return base?_getJSON(_buildUrl(`${base}/reviews`,`/${encodeURIComponent(productHandle)}`,_pickDefined(opts))):_normalizeError("Proxy not configured","NO_PROXY")},async getAllReviews(opts){const base=_proxyBase();return base?_getJSON(_buildUrl(`${base}/reviews`,"/all",_pickDefined(opts))):_normalizeError("Proxy not configured","NO_PROXY")},async submitReview(data){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/reviews`,""),data);if(result.ok){const product={};data.productId!=null&&(product.id=String(data.productId)),data.productHandle&&(product.handle=data.productHandle);const props={rating:data.rating,product:Object.keys(product).length>0?product:void 0,mediaCount:Array.isArray(data.media)?data.media.length:0};data.__spectrumVariant&&(props.__spectrumVariant=data.__spectrumVariant),_track("review_submit",props),_emit("review:submitted",data)}return result},async voteOnReview(reviewId,voteType,opts){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/reviews`,`/${encodeURIComponent(reviewId)}/vote`),{voteType});if(result.ok){const props={reviewId,voteType};opts?.__spectrumVariant&&(props.__spectrumVariant=opts.__spectrumVariant),(opts?.productId!=null||opts?.productHandle)&&(props.product={},opts.productId!=null&&(props.product.id=String(opts.productId)),opts.productHandle&&(props.product.handle=opts.productHandle)),_track("review_vote",props);const emitPayload={reviewId,voteType};opts?.__spectrumVariant&&(emitPayload.__spectrumVariant=opts.__spectrumVariant),_emit("review:voted",emitPayload)}return result},async getStats(productHandle){const base=_proxyBase();return base?_getJSON(_buildUrl(`${base}/reviews`,`/stats/${encodeURIComponent(productHandle)}`)):_normalizeError("Proxy not configured","NO_PROXY")},async uploadMedia(file){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const formData=new FormData;return formData.append("file",file),_postFormData(_buildUrl(`${base}/reviews`,"/media/upload"),formData)}},wishlist={async getWishlists(opts){const base=_proxyBase();return base?_getJSON(_buildUrl(`${base}/wishlist`,"",_pickDefined(opts))):_normalizeError("Proxy not configured","NO_PROXY")},async createWishlist(name){const base=_proxyBase();return base?_postJSON(_buildUrl(`${base}/wishlist`,""),{name}):_normalizeError("Proxy not configured","NO_PROXY")},async updateWishlist(id,data){const base=_proxyBase();return base?_postJSON(_buildUrl(`${base}/wishlist`,`/${encodeURIComponent(id)}/update`),data):_normalizeError("Proxy not configured","NO_PROXY")},async deleteWishlist(id){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/wishlist`,`/${encodeURIComponent(id)}/delete`),{});return result.ok&&_emit("wishlist:cleared",{wishlistId:id}),result},async addItem(wishlistId,data){if(!_isLoggedIn())return _addGuestItem(data),_track("wishlist_add",_wishlistAddProps(wishlistId,data,!0)),_emit("wishlist:added",data),_normalizeSuccess({guest:!0});const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/wishlist`,`/${encodeURIComponent(wishlistId)}/items`),data);return result.ok&&(_track("wishlist_add",_wishlistAddProps(wishlistId,data,!1)),_emit("wishlist:added",data)),result},async addItemToCart(wishlistId,item,opts={}){const variantId=_wishlistCartVariantId(item,opts);if(!variantId)throw new Error("Wishlist item is missing a variant id");const quantity=Number(opts.quantity??item?.quantity??1)||1,line={id:variantId,quantity},response=opts.openCart?await cart.addAndOpen(line,{signal:opts.signal,sections:opts.sections,sourceId:opts.sourceId||"spectrum-wishlist"}):await cart.add(line,{signal:opts.signal,sections:opts.sections});return response&&response.ok===!1||_track("wishlist:add_to_cart",_wishlistAddToCartProps(wishlistId,item,line,opts)),response},async removeItem(wishlistId,itemId,metadata){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/wishlist`,`/${encodeURIComponent(wishlistId)}/items/${encodeURIComponent(itemId)}/delete`),{});if(result.ok){const trackProps={wishlistId,itemId};
9metadata?.productGid&&(trackProps.product={id:_numericId(metadata.productGid)},metadata.handle&&(trackProps.product.handle=metadata.handle)),trackProps.guest=!1,_track("wishlist_remove",trackProps),_emit("wishlist:removed",{wishlistId,itemId})}return result},async updateItem(wishlistId,itemId,data){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/wishlist`,`/${encodeURIComponent(wishlistId)}/items/${encodeURIComponent(itemId)}/update`),data);return result.ok&&_emit("wishlist:item:updated",{wishlistId,itemId,changes:data}),result},async removeByProduct(productGid,metadata){const guest=!_isLoggedIn(),removeProps={product:{id:_numericId(productGid)},guest};if(metadata?.handle&&(removeProps.product.handle=metadata.handle),metadata?.title&&(removeProps.product.title=metadata.title),guest)return _removeGuestItem(productGid),_track("wishlist_remove",removeProps),_emit("wishlist:removed",{shopifyProductGid:productGid}),_normalizeSuccess({guest:!0,removedCount:1});const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/wishlist`,"/items/remove-by-product"),{shopifyProductGid:productGid});return result.ok&&(_track("wishlist_remove",removeProps),_emit("wishlist:removed",{shopifyProductGid:productGid})),result},async getShared(shareToken,opts){const base=_proxyBase();return base?_getJSON(_buildUrl(`${base}/wishlist`,`/shared/${encodeURIComponent(shareToken)}`,_pickDefined(opts))):_normalizeError("Proxy not configured","NO_PROXY")}};async function _searchJSON(url,{signal}={}){try{const res=await fetch(url,{method:"GET",headers:{Accept:"application/json"},credentials:"same-origin",signal}),body=await res.json();return!res.ok||body.success===!1?_normalizeError({error:body.error||`Search request failed (${res.status})`,code:body.code},body.code||`HTTP_${res.status}`):_normalizeSuccess(body.data)}catch(err){return err.name==="AbortError"?_normalizeError({error:"Request aborted",code:"ABORTED"},"ABORTED"):_normalizeError({error:err.message,code:"NETWORK_ERROR"},"NETWORK_ERROR")}}let _predictiveController=null,_autoCompleteController=null;const _predictiveCache=new Map,_PREDICTIVE_CACHE_TTL=3e4,_PREDICTIVE_CACHE_MAX=50;function _predictiveCacheKey(q,opts){const filterStr=opts.filters?JSON.stringify(opts.filters):"",sortStr=opts.sort||"";return`${q}|${sortStr}|${filterStr}`}function _predictiveCacheGet(key){const entry=_predictiveCache.get(key);return entry?Date.now()-entry.ts>_PREDICTIVE_CACHE_TTL?(_predictiveCache.delete(key),null):(_predictiveCache.delete(key),_predictiveCache.set(key,entry),entry.result):null}function _predictiveCacheSet(key,result){if(_predictiveCache.size>=_PREDICTIVE_CACHE_MAX){const oldest=_predictiveCache.keys().next().value;_predictiveCache.delete(oldest)}_predictiveCache.set(key,{result,ts:Date.now()})}const _VA_MAX_TRIPLETS=10;function _buildViewActivityParam(){try{const raw=localStorage.getItem("__spectrum_activity_context");if(!raw)return null;const state=JSON.parse(raw),activity=state&&state.activity,views=activity&&(activity.product_views||activity.productViews);if(!views||!Array.isArray(views.recent))return null;const rawCounts=views.counts_by_product_id||views.countsByProductId,counts=rawCounts&&typeof rawCounts=="object"?rawCounts:{},triplets=[];for(const entry of views.recent){if(triplets.length>=_VA_MAX_TRIPLETS)break;if(!entry)continue;const productId=typeof entry.product_id=="string"&&entry.product_id?entry.product_id:typeof entry.productId=="string"&&entry.productId?entry.productId:null;if(!productId)continue;const seconds=Math.floor(Number(entry.viewed_at!=null?entry.viewed_at:entry.viewedAt)/1e3);if(!Number.isFinite(seconds)||seconds<=0)continue;const count=Math.max(1,Math.floor(Number(counts[productId]))||1);triplets.push(`${productId}:${count}:${seconds}`)}return triplets.length>0?triplets.join(","):null}catch{return null}}const _RECENT_STORAGE_KEY="__spectrum_search_recent",_RECENT_MAX=20;function _getRecentSearches(){try{const raw=localStorage.getItem(_RECENT_STORAGE_KEY);if(!raw)return[];const parsed=JSON.parse(raw);return Array.isArray(parsed)?parsed:[]}catch{return[]}}function _saveRecentSearches(searches){try{localStorage.setItem(_RECENT_STORAGE_KEY,JSON.stringify(searches))}catch{}}const search={async query(q,opts={}){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const params={};if(q&&(params.q=q),opts.sort&&(params.sort=opts.sort),opts.page&&(params.page=opts.page),opts.hitsPerPage&&(params.hitsPerPage=opts.hitsPerPage),opts.filters)for(const[key,value]of Object.entries(opts.filters))value!=null&&(params[key]=value);const va=_buildViewActivityParam();va&&(params.va=va);const url=_buildUrl(`${base}/search`,"",params),result=await _searchJSON(url,{signal:opts.signal});return result.ok&&result.data&&result.data.redirect&&(window.location.href=result.data.redirect),result},async getFacets(q,opts={}){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const params={};if(q&&(params.q=q),opts.filters)for(const[key,value]of Object.entries(opts.filters))value!=null&&(params[key]=value);const url=_buildUrl(`${base}/facets`,"",params);return _searchJSON(url,{signal:opts.signal})},async predictive(q,opts={}){_predictiveController&&_predictiveController.abort(),_predictiveController=new AbortController;const cacheKey=_predictiveCacheKey(q,opts),cached=_predictiveCacheGet(cacheKey);if(cached)return cached;const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const va=_buildViewActivityParam(),params={};if(q&&(params.q=q),opts.sort&&(params.sort=opts.sort),opts.page&&(params.page=opts.page),opts.hitsPerPage&&(params.hitsPerPage=opts.hitsPerPage),opts.filters)for(const[key,value]of Object.entries(opts.filters))value!=null&&(params[key]=value);va&&(params.va=va);const url=_buildUrl(`${base}/search`,"",params),result=await _searchJSON(url,{signal:_predictiveController.signal});return!result.ok&&result.error&&result.error.code==="ABORTED"?null:(result.ok&&_predictiveCacheSet(cacheKey,result),result.ok&&result.data&&result.data.redirect&&(window.location.href=result.data.redirect),result)},async autoComplete(q,opts={}){_autoCompleteController&&_autoCompleteController.abort(),_autoCompleteController=new AbortController;const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const params={};if(q&&(params.q=q),opts.filters)for(const[key,value]of Object.entries(opts.filters))value!=null&&(params[key]=value);const url=_buildUrl(`${base}/search/autocomplete`,"",params),result=await _searchJSON(url,{signal:_autoCompleteController.signal});return!result.ok&&result.error&&result.error.code==="ABORTED"?null:result},getRecent(){return _getRecentSearches()},addRecent(query){if(!query||typeof query!="string")return;const trimmed=query.trim();if(!trimmed)return;const filtered=_getRecentSearches().filter(s=>s!==trimmed);filtered.unshift(trimmed),_saveRecentSearches(filtered.slice(0,_RECENT_MAX))},clearRecent(){try{localStorage.removeItem(_RECENT_STORAGE_KEY)}catch{}},async recommendInlineFilters(q,opts={}){const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const params={};if(q&&(params.q=q),opts.filters)for(const[key,value]of Object.entries(opts.filters))value!=null&&(params[key]=value);const url=_buildUrl(`${base}/search/recommendInlineFilters`,"",params);return _searchJSON(url,{signal:opts.signal})}}
9,events={emit(name,detail){_emit(name,detail)},on(name,callback){const evt=`$spectrum:${name}`;return document.addEventListener(evt,callback),()=>document.removeEventListener(evt,callback)},off(name,callback){document.removeEventListener(`$spectrum:${name}`,callback)}};function getActiveCurrency(){return _currency()}let _activeUnmutedVideo=null;class SpectrumVideo extends HTMLElement{static get observedAttributes(){return["data-src","data-sources"]}connectedCallback(){this._state="idle",this._video=null,this._loadObserver=null,this._visibilityObserver=null,this._wantsPlay=!1,this.style.display||(this.style.display="block"),this.style.position||(this.style.position="relative"),this.style.overflow="hidden",this._setupLoad()}disconnectedCallback(){this._teardown(),_activeUnmutedVideo===this&&(_activeUnmutedVideo=null)}attributeChangedCallback(name,oldVal,newVal){oldVal!==newVal&&this._state!=="idle"&&(this.unload(),this._setupLoad())}play(){if(this._wantsPlay=!0,!this._video){this._loadVideo();return}this._state==="ready"&&this._video.play().catch(()=>{})}pause(){this._video&&this._video.pause()}load(){this._video||this._loadVideo()}unload(){this._state==="idle"&&!this._video||(this._video&&(this._video.pause(),this._video.removeAttribute("src"),this._video.load(),this._video.remove(),this._video=null),this._showPoster(),this._wantsPlay=!1,this._state="idle",this._dispatch("unloaded"))}mute(){this._video&&(this._video.muted=!0),_activeUnmutedVideo===this&&(_activeUnmutedVideo=null),this._dispatch("mute")}unmute(){_activeUnmutedVideo&&_activeUnmutedVideo!==this&&_activeUnmutedVideo.mute(),_activeUnmutedVideo=this,this._video&&(this._video.muted=!1),this._dispatch("unmute")}get playing(){return this._state==="ready"&&this._video&&!this._video.paused}get loaded(){return this._state==="ready"}get muted(){return this._video?this._video.muted:!0}_setupLoad(){const mode=this.dataset.load||"viewport";if(mode==="eager"){this._loadVideo();return}if(mode==="hover"){this._hoverHandler=()=>{this._loadVideo(),this.removeEventListener("pointerenter",this._hoverHandler)},this.addEventListener("pointerenter",this._hoverHandler);return}if(mode==="click"){this._clickHandler=()=>{this._wantsPlay=!0,this._loadVideo(),this.removeEventListener("click",this._clickHandler)},this.addEventListener("click",this._clickHandler);return}const margin=this.dataset.preloadMargin||"200px",observer=new IntersectionObserver(([entry])=>{entry.isIntersecting&&(this._loadVideo(),observer.disconnect(),this._loadObserver===observer&&(this._loadObserver=null))},{rootMargin:margin});this._loadObserver=observer,observer.observe(this)}_loadVideo(){if(this._state!=="idle")return;this._state="loading";const video=document.createElement("video");video.muted=!0,video.setAttribute("muted",""),video.loop=this.hasAttribute("data-loop"),video.playsInline=!0,video.setAttribute("playsinline",""),video.setAttribute("webkit-playsinline",""),video.setAttribute("disablepictureinpicture",""),video.preload="metadata",this.dataset.autoplay&&video.setAttribute("autoplay",""),this.dataset.poster&&(video.poster=this.dataset.poster),Object.assign(video.style,{position:"absolute",inset:"0",width:"100%",height:"100%",objectFit:"cover"}),video.addEventListener("loadedmetadata",()=>this._onCanPlay(),{once:!0}),video.addEventListener("error",e=>this._onError(e),{once:!0}),this._video=video,this.appendChild(video),video.src=this._pickSource(),video.load()}_pickSource(){const sourcesAttr=this.dataset.sources;if(sourcesAttr)try{const sources=JSON.parse(sourcesAttr);if(Array.isArray(sources)&&sources.length>0){const target=this.clientWidth*(window.devicePixelRatio||1),sorted=sources.slice().sort((a,b)=>a.width-b.width);return(sorted.find(s=>s.width>=target)||sorted[sorted.length-1]).url}}catch{}return this.dataset.src||""}_onCanPlay(){this._state="ready",this._hidePoster(),this._dispatch("loaded",{src:this._video.src}),this.dataset.autoplay?this._setupVisibility():this._wantsPlay&&this._video.play().catch(()=>{}),this._wantsPlay=!1}_onError(_e){const errorMsg=this._video?.error?.message||"Video load failed",errorCode=this._video?.error?.code;this._state="idle",this._video&&(this._video.remove(),this._video=null),this._showPoster(),this._dispatch("error",{error:errorMsg,code:errorCode})}_setupVisibility(){if(!this.dataset.autoplay)return;const rawThreshold=this.dataset.visibilityThreshold,parsed=rawThreshold==null?.5:parseFloat(rawThreshold),threshold=Number.isFinite(parsed)&&parsed>=0&&parsed<=1?parsed:.5;this._visibilityObserver=new IntersectionObserver(([entry])=>{entry.isIntersecting?(this._video?.play().catch(()=>{}),this._dispatch("play")):(this._video?.pause(),this._dispatch("pause"))},{threshold}),this._visibilityObserver.observe(this)}_hidePoster(){const img=this.querySelector(":scope > img");img&&(img.style.display="none")}_showPoster(){const img=this.querySelector(":scope > img");img&&(img.style.display="")}_teardown(){this._loadObserver&&(this._loadObserver.disconnect(),this._loadObserver=null),this._visibilityObserver&&(this._visibilityObserver.disconnect(),this._visibilityObserver=null),this._hoverHandler&&(this.removeEventListener("pointerenter",this._hoverHandler),this._hoverHandler=null),this._clickHandler&&(this.removeEventListener("click",this._clickHandler),this._clickHandler=null),this._video&&(this._video.pause(),this._video=null)}_dispatch(name,detail={}){this.dispatchEvent(new CustomEvent(`spectrum-video:${name}`,{bubbles:!0,detail}))}}typeof customElements<"u"&&!customElements.get("spectrum-video")&&
9customElements.define("spectrum-video",SpectrumVideo);const _COUNTDOWN_TICK_MS=1e3,_COUNTDOWN_STORAGE_PREFIX="__spectrum_countdown_";function _zonedToEpoch(year,month,day,hour,minute,tz){const targetMs=Date.UTC(year,month-1,day,hour,minute,0);let guess=targetMs;for(let i=0;i<3;i++){const parts=_zonedParts(guess,tz),diffMs=Date.UTC(parts.year,parts.month-1,parts.day,parts.hour,parts.minute,0)-targetMs;if(diffMs===0)break;guess-=diffMs}return guess}function _zonedParts(epochMs,tz){const parts=new Intl.DateTimeFormat("en-CA",{timeZone:tz,year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",hour12:!1}).formatToParts(new Date(epochMs)),map={};for(const p of parts)map[p.type]=p.value;const hourValue=map.hour==="24"?0:parseInt(map.hour,10);return{year:parseInt(map.year,10),month:parseInt(map.month,10),day:parseInt(map.day,10),hour:hourValue,minute:parseInt(map.minute,10)}}function _daysSinceEpoch(year,month,day){return Math.floor(Date.UTC(year,month-1,day,12)/864e5)}function _nextOccurrence(rule,from,tz){const start=_zonedParts(from,tz);let{year,month,day}=start;for(let i=0;i<400;i++){const matches=_occurrencesOnDay(rule,year,month,day,tz);for(const epochMs of matches)if(epochMs>=from)return epochMs;const nextDayEpoch=_zonedToEpoch(year,month,day,12,0,tz)+864e5,nextParts=_zonedParts(nextDayEpoch,tz);year=nextParts.year,month=nextParts.month,day=nextParts.day}throw new Error("SpectrumCountdown: no upcoming occurrence within search window")}function _occurrencesOnDay(rule,year,month,day,tz){switch(rule.every){case"hour":{const result=[];for(let h=0;h<24;h+=rule.interval)result.push(_zonedToEpoch(year,month,day,h,rule.atMinute,tz));return result}case"day":return _daysSinceEpoch(year,month,day)%rule.interval!==0?[]:[_zonedToEpoch(year,month,day,rule.atHour,rule.atMinute,tz)];case"month":return day!==rule.dayOfMonth?[]:((year-1970)*12+(month-1))%rule.interval!==0?[]:[_zonedToEpoch(year,month,day,rule.atHour,rule.atMinute,tz)];default:return[]}}function _splitDuration(remainingMs){const totalSeconds=Math.max(0,Math.floor(remainingMs/1e3));return{days:Math.floor(totalSeconds/86400),hours:Math.floor(totalSeconds%86400/3600),minutes:Math.floor(totalSeconds%3600/60),seconds:totalSeconds%60}}class SpectrumCountdown{constructor(config){this._config=SpectrumCountdown._normalizeConfig(config),this._listeners={tick:[],expire:[],enter:[],exit:[]},this._running=!1,this._timeoutId=null,this._anchor=null,this._expired=!1,this._lastSnapshot=null,this._constructionTime=Date.now(),this._tick=this._tick.bind(this),this._onVisibilityChange=this._onVisibilityChange.bind(this)}static _normalizeConfig(config){const{kind}=config;if(kind==="duration")return{kind:"duration",ms:config.ms,persist:config.persist||"none",persistKey:typeof config.persistKey=="string"&&config.persistKey.length>0?config.persistKey:null};if(kind==="epoch")return{kind:"epoch",endsAt:config.endsAt,startsAt:typeof config.startsAt=="number"?config.startsAt:null};if(kind==="recurring")return{kind:"recurring",recurrence:config.recurrence,occurrenceDurationMs:typeof config.occurrenceDurationMs=="number"?config.occurrenceDurationMs:0,tz:typeof config.tz=="string"&&config.tz.length>0?config.tz:Intl.DateTimeFormat().resolvedOptions().timeZone};throw new Error(`SpectrumCountdown: unknown kind "${kind}"`)}on(event,fn){const list=this._listeners[event];return!list||typeof fn!="function"?()=>{}:(list.push(fn),()=>{const idx=list.indexOf(fn);idx!==-1&&list.splice(idx,1)})}start(){this._running||(this._running=!0,this._config.kind==="duration"&&this._initDurationAnchor(),document.addEventListener("visibilitychange",this._onVisibilityChange),this._tick())}destroy(){this._running=!1,this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null),document.removeEventListener("visibilitychange",this._onVisibilityChange),this._listeners={tick:[],expire:[],enter:[],exit:[]},this._lastSnapshot=null,this._expired=!1,this._anchor=null}_onVisibilityChange(){document.visibilityState==="visible"&&(this._timeoutId!==null&&(clearTimeout(this._timeoutId),this._timeoutId=null),this._running&&this._tick())}_storageBackend(){const c=this._config;return c.kind!=="duration"||c.persist==="none"?null:c.persist==="session"?window.sessionStorage:window.localStorage}_storageKey(){const c=this._config;return`${_COUNTDOWN_STORAGE_PREFIX}${c.persistKey}_${c.ms}`}_initDurationAnchor(){if(this._anchor!==null)return;const storage=this._storageBackend();if(!storage){this._anchor=Date.now();return}const key=this._storageKey(),raw=storage.getItem(key);if(raw)try{const parsed=JSON.parse(raw);if(typeof parsed.startedAt=="number"&&Number.isFinite(parsed.startedAt)){this._anchor=parsed.startedAt;return}}catch{}this._anchor=Date.now(),storage.setItem(key,JSON.stringify({startedAt:this._anchor}))}_tick(){this._running&&(this._config.kind==="recurring"?this._tickRecurring():this._tickTerminal())}_tickTerminal(){const c=this._config,now=Date.now();let startedAt,totalMs,endsAt;c.kind==="duration"?(startedAt=this._anchor,totalMs=c.ms,endsAt=this._anchor+c.ms):(startedAt=c.startsAt!==null?c.startsAt:this._constructionTime,totalMs=Math.max(1,c.endsAt-startedAt),endsAt=c.endsAt);const remainingMs=Math.max(0,endsAt-now);if(this._dispatchTick(this._buildTickState(remainingMs,totalMs,void 0)),remainingMs<=0){this._expired||(this._expired=!0,this._dispatch("expire"));return}this._scheduleTick(_COUNTDOWN_TICK_MS)}_tickRecurring(){const c=this._config,now=Date.now(),snap=SpectrumCountdown._computeRecurringSnapshot(c.recurrence,c.occurrenceDurationMs,now,c.tz);this._fireRecurringTransitions(this._lastSnapshot,snap,c.occurrenceDurationMs);let totalMs,remainingMs;snap.state==="in"?(totalMs=c.occurrenceDurationMs,remainingMs=Math.max(0,snap.windowEnd-now)):(totalMs=Math.max(1,snap.nextStart-now),remainingMs=totalMs),this._dispatchTick(this._buildTickState(remainingMs,totalMs,snap.state)),this._lastSnapshot=snap;const target=snap.state==="in"?snap.windowEnd:snap.nextStart,delay=Math.max(50,Math.min(_COUNTDOWN_TICK_MS,target-now));this._scheduleTick(delay)}static _computeRecurringSnapshot(rule,durationMs,now,tz){if(durationMs>0){const candidateStart=_nextOccurrence(rule,now-durationMs,tz);return candidateStart<=now&&candidateStart+durationMs>now?{state:"in",windowStart:candidateStart,windowEnd:candidateStart+durationMs,nextStart:null}:{state:"before",windowStart:null,windowEnd:null,nextStart:candidateStart>now?candidateStart:_nextOccurrence(rule,now,tz)}}return{state:"before",windowStart:null,windowEnd:null,nextStart:_nextOccurrence(rule,now+1,tz)}}_fireRecurringTransitions(prev,current,durationMs){if(prev===null)return;if(durationMs===0){current.nextStart!==prev.nextStart&&this._dispatch("enter");return}const sameWindow=prev.state==="in"&&current.state==="in"&&prev.windowStart===current.windowStart,sameBefore=prev.state==="before"&&current.state==="before"&&prev.nextStart===current.nextStart;sameWindow||sameBefore||(prev.state==="in"&&this._dispatch("exit"),current.state==="in"&&this._dispatch("enter"),prev.state==="before"&&current.state==="before"&&(this._dispatch("enter"),this._dispatch("exit")))}_scheduleTick(delayMs){this._timeoutId=setTimeout(this._tick,delayMs)}_buildTickState(remainingMs,totalMs,state){const safeRemaining=Math.max(0,remainingMs),safeTotal=totalMs>0?totalMs:1,percent=Math.max(0,Math.min(100,(safeTotal-safeRemaining)/safeTotal*100)),split=_splitDuration(safeRemaining),out={remainingMs:safeRemaining,totalMs:safeTotal,percent,days:split.days,hours:split.hours,minutes:split.minutes,seconds:split.seconds};return state!==void 0&&(out.state=state),out}
9_dispatchTick(state){this._dispatchListeners("tick",state)}_dispatch(event){this._dispatchListeners(event,void 0)}_dispatchListeners(event,payload){const list=this._listeners[event];if(!list||list.length===0)return;const snapshot=list.slice();for(const fn of snapshot)try{payload===void 0?fn():fn(payload)}catch(err){console.warn(`SpectrumCountdown: ${event} listener threw`,err)}}}const SpectrumSDK={VERSION,configure,getActiveCurrency,cart,products,recentlyViewed,sections,platform,priceAdjustments,money,reviews,wishlist,search,events,native:{async getCheckoutUrl({cartType="default",slug}={}){if(cartType==="default"){const res=await fetch(`${_root()}checkout`,{redirect:"follow",credentials:"include"});if(!res.url)throw new Error("Failed to resolve default checkout URL");return res.url}if(cartType==="bundle"){if(!slug)throw new Error("slug required for bundle cart");const bundleApi=window.__spectrumAi?.bundle;if(!bundleApi)throw new Error("Bundle cart SDK not loaded");const result=await bundleApi.getCart(slug);if(!result?.ok)throw new Error("Failed to fetch bundle cart");const url=result.data?.checkoutUrl;if(!url)throw new Error("Bundle cart has no checkout URL");return url}throw new Error(`Unsupported cartType: ${cartType}`)},async expressCheckout({lines,discountCodes}={}){if(!lines?.length)return _normalizeError("lines is required","MISSING_LINES");const base=_proxyBase();if(!base)return _normalizeError("Proxy not configured","NO_PROXY");const result=await _postJSON(_buildUrl(`${base}/express-checkout`,"/create-cart"),{lines:lines.map(l=>({variant_id:Number(l.variantId),quantity:Number(l.quantity||1),properties:l.properties&&typeof l.properties=="object"&&!Array.isArray(l.properties)?l.properties:void 0})),discount_codes:discountCodes?.length?discountCodes:void 0});return result.ok?result.data?.checkout_url?_normalizeSuccess({checkoutUrl:result.data.checkout_url,cartId:result.data.cart_id}):_normalizeError("No checkout URL in response","MISSING_CHECKOUT_URL"):result}},VideoElement:SpectrumVideo,Countdown:SpectrumCountdown};window.Spectrum=SpectrumSDK;try{const _rvPathMatch=window.location.pathname.match(/\/products\/([^/?#]+)/);_rvPathMatch&&_rvPathMatch[1]&&recentlyViewed.push(_rvPathMatch[1])}catch{}if(_isLoggedIn()){const guestItems=_getGuestItems();guestItems.length>0&&_mergeGuestToServer().then(result=>{result.ok&&_clearGuestItems();const merged=result.ok?result.data?.merged??guestItems.length:0,duplicates=result.ok?result.data?.duplicates??0:0;_track("wishlist_merge",{itemsMerged:merged,duplicatesSkipped:duplicates}),_emit("wishlist:merged",{})})}})();
10//# sourceMappingURL=/cdn/shop/t/70/assets/spectrum-sdk.js.map?v=39443963607569225581789637758

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.