1"use strict";(self.webpackChunkcampari_wdf=self.webpackChunkcampari_wdf||[]).push([[4739],{6822(e,t,r){r.d(t,{Ay:function(){return X}});var i=r(2504),a=r(8831),n=r(8562);function s(e,t,r,i){Object.defineProperty(e,t,{get:r,set:i,enumerable:!0,configurable:!0})}function c(e,t){return Object.keys(t).forEach(function(r){"default"===r||"__esModule"===r||e.hasOwnProperty(r)||Object.defineProperty(e,r,{enumerable:!0,get:function(){return t[r]}})}),e}s({},"Liquid",function(){return J});var o={},u={};function d(e){return void 0!==e.retailers}s(u,"isProductVariant",function(){return d});var l,p,h={};s(h,"ItemOptionType",function(){return l}),(p=l||(l={}))[p.Unknown=0]="Unknown",p[p.GiftCard=1]="GiftCard",p[p.Engraving=2]="Engraving";var m={};function y(e){return"variantId"in e&&!("identifier"in e)}function g(e){return"identifier"in e&&e.quantity>0}s(m,"isAddItem",function(){return y}),s(m,"isUpdateItem",function(){return g});var f={};s(f,"HttpError",function(){return v});class v{constructor(e){this.error=e.error,this.message=e.error?.message||e.statusText,this.status=e.status}}c(o,u),c(o,{}),c(o,{}),c(o,{}),c(o,{}),c(o,h),c(o,{}
1),c(o,m),c(o,{}),c(o,{}),c(o,f),c({},o);const w={platform:"none",env:null,apiUrl:null,minibarUrl:null,pdpFunctionUrl:"https://liquid-product-v1-7s7rhms6ea-uc.a.run.app",checkoutFunctionUrl:"https://checkout-mw.liquidapp.cloud",mapsUrl:"https://utils.liquidcheckout.com",recaptchaV3SiteKey:"6LfSIhEdAAAAAHDK2H80jIua0mJCdkpVheBlPyql",clientId:void 0},b={staging:{env:"staging",apiUrl:"https://api-staging.liquidcheckout.com",minibarUrl:"https://cart-api-staging.liquidcheckout.com"},production:{env:"production",apiUrl:"https://api.liquidcheckout.com",minibarUrl:"https://cart-api.liquidcheckout.com"}};function k(e){const t=Object.values(function(e){const t=e.reduce((e,t)=>{const r=t.productBundle?.id,i=e[r];return e[r]=i?{...i,items:[...i.items,t]}:{...t.productBundle,items:[t]},e},{});return Object.values(t).filter(e=>!e.id||e.componentProductData.length===e.items.length)}(e)).reduce((e,t)=>t.id?e+function(e){return e.items.reduce((t,r)=>{const i=e.componentProductData.find(e=>String(e.productId)===String(r.productGroup.product.id)),a=i?.quantity||1;return(t+Number(r.product.price))*a},0)}(t)*t.items[0].quantity:e+t.items.reduce((e,t)=>e+(t.itemOptions?.type===l.Engraving?50*t.quantity:0)+t.product.price*t.quantity,0),0);return Number(t.toFixed(2))}const E={formattedAddress:"79 Madison Ave, New York, NY 10016, USA",address1:"79 Madison Avenue",streetNumber:"79",city:"Manhattan",latitude:40.7441619,longitude:-73.98531249999999,state:"NY",zipCode:"10016",placeId:"liquidDefaultAddress"};var I;I||(I={});class S{static#e=(()=>{this.storage={}})();static verifyLocalStorage(){if(!1===this.hasLocalStorage)return!1;try{localStorage.getItem("item"),S.hasLocalStorage=!0}catch{S.hasLocalStorage=!1}return S.hasLocalStorage}static set(e,t){this.verifyLocalStorage()&&localStorage.setItem(e.toString(),JSON.stringify(t)),this.storage[e]=JSON.stringify(t)}static get(e){const t=this.verifyLocalStorage()?localStorage.getItem(e.toString()):this.storage[e];return t?JSON.parse(t):null}}const x=e=>e.toString().match(/^GROUPING-/i)||e.toString().match(/^BUNDLE-\d/i),A=e=>{let t=0;if("string"!=typeof e)return t;if(0===e.trim().length)return t;for(let r=0;r<e.length;r++){t=(t<<5)-t+e.charCodeAt(r),t&=t}return t},C=(e,t,r)=>{const i=[r,e].filter(Boolean).join(":");let a;switch(t?.type){case l.Engraving:return A(`${i}:${t.line1??""}:${t.line2??""}:${t.line3??""}:${t.line4??""}`);case l.GiftCard:return a=[i,...t.recipients||[],t.sender].filter(Boolean).sort().join(":").toLowerCase(),A(a);default:return A(`${i}`)}},U="Unauthorized domain";class P{static#e=(()=>{this.authorizedDomain=!0})();get host(){return w.apiUrl}async get(e,t={},r={}){return await this.request(this.url(e,t,r),{...r,method:"GET"})}async post(e,t={},r={}){return await this.request(this.url(e),{body:await this.body(t),method:"POST",...r})}async put(e,t={},r={}){return await this.request(this.url(e),{body:await this.body(t),method:"PUT",...r})}async request(e,t={}){if(!P.authorizedDomain)return;const{decamelizeKeys:r,...i}=t,n={Accept:"application/json","Content-Type":"application/json","X-App":"liquid-cloud","X-Version":"1.1.5-beta.0",...await this.headers()};"object"==typeof i.body&&(i.body=JSON.stringify(this.decamelizeKeys(i.body,t)));const s=await fetch(e.toString(),{headers:n,...i}),c=await s.json();if(s.status>=200&&s.status<300)return(0,a.camelizeKeys)(c,(e,t)=>e.toString().match(/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i)||x(e)?e:t(e));throw 403===s.status&&c.error===U&&(console.error(U),P.authorizedDomain=!1),new v({statusText:"",error:c?.error||{message:Object.values(c?.errors||{}).join(", ")},status:s.status,url:e,headers:n})}async headers(){return{}}async minibarHeaders(){return{Authorization:`Bearer ${(await w.credentials.getToken()).accessToken}`}}getClientId(){return w.credentials?.clientId}url(e,t={},r={}){t=this.decamelizeKeys(t,r);const i=new URL([this.host,this.prefix,this.model,e,this.suffix].filter(e=>e).join("/"));return Object.keys(t).forEach(e=>this.handleSearchParams(i,e,t[e])),i}handleSearchParams(e,t,r){Array.isArray(r)?r.forEach(r=>e.searchParams.append(`${t}[]`,r)):e.searchParams.append(t,r)}async body(e){return e}decamelizeKeys(e,t){return!1!==t.decamelizeKeys?(0,a.decamelizeKeys)(e):e}constructor(){this.model="",this.prefix="api/v2",this.suffix=""}}var q=P;const N=new i.wQ.Entity("addresses"),j=new i.wQ.Entity("shippingMethods"),D=new i.wQ.Entity("giftCardThemes"),T=new i.wQ.Entity("retailers",{address:N,shippingMethods:[j]}),_=new i.wQ.Entity("products",{giftCardTheme:D,variants:[{retailers:[{retailer:T,shippingMethod:j}]}]});class O extends q{async getProducts(e,t){const r=await this.post("multi_select",{ids:e,...t});return r?.entities?.products&&Object.keys(r.entities.products).forEac
1h(e=>{r.entities.products[e].id=e}),(0,i.NU)(r,{products:[_]},r.entities).products}async body(e){return{...e,clientId:this.getClientId()}}async headers(){return{"X-Header-Convention":"camel"}}constructor(...e){super(...e),this.model="retailers",this.prefix="api/v3"}}const $={onDemand:[{pattern:/Delivery under an hour/gi,replacement:"Arrives in 60 mins",shortReplacement:"60 mins"},{pattern:/Delivery in (\d+(?:\.\d+)?-\d+(?:\.\d+)?) minutes/gi,replacement:"Arrives in $1 min",shortReplacement:"$1 min"},{pattern:/Delivery in (\d+(?:\.\d+)?-\d+(?:\.\d+)?) hours/gi,replacement:"Arrives in $1 hrs",shortReplacement:"$1 hrs"}],shipped:[{pattern:/Shipment \(?(\d+(?:-\d+)?)\s?(?:business )?(days)\)?/gi,replacement:"Ships in $1 $2"},{pattern:/Usually ships within (\d+-\d+) business days/gi,replacement:"Ships in $1 days"}]};function z({deliveryType:e,deliveryExpectation:t,customerPlacement:r}){if("engraved"===e){const e="Ships in 10 days";return{shortDeliveryExpectation:e,deliveryExpectation:e}}if(["backOrder","back_order"].includes(r)){const e="On backorder";return{shortDeliveryExpectation:e,deliveryExpectation:e}}return($[e]||[]).reduce((e,{pattern:t,replacement:r,shortReplacement:i})=>(e.deliveryExpectation=e.deliveryExpectation.replace(t,r),e.shortDeliveryExpectation=i?e.shortDeliveryExpectation.replace(t,i):e.deliveryExpectation,e),{deliveryExpectation:t,shortDeliveryExpectation:t})}class L{async get(e,t){const r=t.shipAddress||t.latitude||t.shipState,i=r?t:{...t,latitude:E.latitude,longitude:E.longitude,shipState:E.state},a=await this.productApi.getProducts(e,i);return r||e.every(e=>e.includes("GIFTCARD"))||Object.values(a).forEach(e=>e.variants=[]),this.sortRetailers(a)}sortRetailers(e){return e?(Object.values(e).forEach(e=>{e.variants?.forEach(e=>{d(e)&&(e.retailers=e.retailers.sort(e=>"onDemand"===e.type?-1:"engraved"===e.type?1:0).map(e=>(e.shippingMethod={...e.shippingMethod,...z({deliveryType:e.type,deliveryExpectation:e.shippingMethod.deliveryExpectation,customerPlacement:e.customerPlacement})},e)))})}),e):e}constructor(){this.productApi=new O}}class M extends q{async getToken(e){return this.token&&!this.isTokenExpired(this.token)||(this.token=await this.get("",{clientId:e}),this.token.expiresIn=Math.floor(Date.now()/1e3)+this.token.expiresIn),this.token}isTokenExpired(e){return!e||Math.floor(Date.now()/1e3)>e.expiresIn}constructor(...e){super(...e),this.model="liquid/tokens",this.prefix="api/v1",this.token=null}}class R{constructor(e,t){this.tokenApi=new M,this.clientId=e,this.clientSecret=t}async authenticate(){return await this.tokenApi.getToken(this.clientId),this}async getToken(){return this.token&&!this.isTokenExpired(this.token)||(this.token=await this.tokenApi.getToken(this.clientId)),this.token}isTokenExpired(e){return!e||Math.floor(Date.now()/1e3)>e.createdAt+e.expiresIn}}class K extends q{get host(){return w.minibarUrl}async headers(){return await this.minibarHeaders()}getCart(e){return this.get(`${e}`)}create(){const e=(0,n.A)();return this.post("",{storefrontCartId:e})}update(e,t){return this.put(`${e}`,t)}constructor(...e){super(...e),this.model="cart"}}class B{async get(e){if(e)return await this.cartApi.getCart(e);return await this.cartApi.create()}async update(e,t){const r=t.cartItems?.map(e=>y(e)?this.buildCartItem(e):g(e)?(e.options||delete e.options,{...e,productBundleExternalId:e.bundleExternalId}):e);return await this.cartApi.update(e,{...t,cartItems:r})}mapCart(e){return e.itemCount=e.cartItems.reduce((e,t)=>e+t.quantity,0),e.subtotal=k(e.cartItems),e.cartItems.forEach(e=>{e.retailerName=e.retailerName||e.supplierName;const t=z({deliveryType:(0,a.camelize)(e.deliveryMethod),deliveryExpectation:e.deliveryExpectation,customerPlacement:e.customerPlacement});e.deliveryExpectation=t.deliveryExpectation,e.shortDeliveryExpectation=t.shortDeliveryExpectation,e.supplierName&&delete e.supplierName}),e}buildCartItem(e){const{variantId:t,options:r,bundleExternalId:i,customerPlacement:a,quantity:n}=e;return r&&(r.line1||r.line2||r.line3||r.line4)&&(r.type=l.Engraving),r&&r.sender&&(r.type=l.GiftCard),{...e,identifier:C(t,r,i),productBundleExternalId:i,customerPlacement:a||"standard",quantity:n??1,options:r?.type?r:void 0}}constructor(){this.cartApi=new K}}class G extends q{get host(){return w.checkoutFunctionUrl}async createCheckoutUrl(e){const{order:t}=await this.post("",e);return t}async headers(){return await this.minibarHeaders()}async body(e){return{...e,env:w.env}}constructor(...e){super(...e),this.prefix=""}}class H{async createCheckoutUrl(e){return await this.checkoutApi.createCheckoutUrl({...e,address:{...e.address,name:e.address.name||"Guest Account"}})}constructor(){this.checkoutApi=new G}}class V extends q{get host(){return w.mapsUrl}async getCaptchaToken(){let e=0;return new Promise((t,r)=>{const i=setInterval(()=>{if(window.grecaptcha?.enterprise?.execute){clearInterval(i);const e=window.grecaptcha.enterprise.execute(w.recaptchaV3SiteKey,{action:"submit"})||"";t(e)}else e++,e>100&&(clearInterval(i),r("Recaptcha not loaded"))},100)})}async getPlacePredictions(e){const t=await this.getCaptchaToken(),{predictions:r}=await this.get("autocomplete/json",{input:e,re_captcha_token:t,components:"country:us"});return r.map(({description:e,placeId:t})=>({description:e,placeId:t}))}async getPlaceDetails(e){const t=await this.getCaptchaToken(),r=new
1URLSearchParams({placeid:e,re_captcha_token:t}),{result:i}=await this.get(`details/json?${r}`),{formattedAddress:a,addressComponents:n,geometry:s,placeId:c}=i,o=["street_number","premise","route","sublocality","locality","administrative_area_level_1","postal_code"].reduce((e,t)=>(e[t]=n.find(({types:e})=>e.includes(t)),e),{});return o.street_number||(o.street_number=o.premise),o.city=o.sublocality||o.locality,{formattedAddress:a,address1:[o?.street_number?.longName,o?.route?.longName].join(" "),streetNumber:o?.street_number?.longName,city:o?.city?.longName,latitude:s.location.lat,longitude:s.location.lng,state:o?.administrative_area_level_1?.shortName,zipCode:o?.postal_code?.longName,placeId:c}}constructor(...e){super(...e),this.prefix="maps/api/place"}}class F{initializeRecaptcha(){const e="liquid-recaptcha";if(document.getElementById(e))return!0;const t=document.createElement("script");return t.src=`https://www.google.com/recaptcha/enterprise.js?render=${w.recaptchaV3SiteKey}`,t.id=e,t.async=!0,document.body.appendChild(t),!0}async search(e){return this.initializeRecaptcha(),this.mapsApi.getPlacePredictions(e.search)}async get(e){return this.initializeRecaptcha(),await this.mapsApi.getPlaceDetails(e.placeId)}constructor(){this.mapsApi=new V}}class J{constructor(e={}){this.cartService=new B,this.productService=new L,this.checkoutService=new H,this.addressService=new F;const{clientId:t,clientSecret:r,apiUrl:i,env:a}=e;if(!t)throw new Error("clientId is required");Object.assign(w,b[a]||b.production),w.credentials=new R(t,r),w.apiUrl=i||w.apiUrl}async product(e){const{ids:t,...r}=e;return await this.productService.get(t,r)}async cart(e){const{id:t,...r}=e||{},i=Object.keys(r).length>0,a=t&&i,n=a?await this.cartService.update(Number(t),e):await this.cartService.get(Number(t));if(!n)throw new Error("Cart not found");if(!a&&i){const t=await this.cartService.update(n.id,e);return this.cartService.mapCart(t)}return this.cartService.mapCart(n)}async address(e){const{search:t}=e,{placeId:r}=e;if(r)return await this.addressService.get({placeId:r});if(t)return await this.addressService.search({search:t});throw new Error("Invalid params")}async checkout(e){return await this.checkoutService.createCheckoutUrl({...e})}async authenticate(){return await w.credentials.authenticate(),this}}const Q=async(e={})=>new J(e).authenticate();try{window.Liquid=Q}catch(e){}var X=8792==r.j?Q:null}}]);
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.