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,KAAK,QAAS,4BAA6B8D,GCtD/C,SAAuBmB,GAC5B,IAAK,MAAM1G,KAASlF,OAAO6L,KAAKC,MAAO,CACrC,MAAMC,EAAWH,EAAc,MAAL1G,OAAK,EAALA,EAAOsD,MAC7BuD,GACFA,EAAS7G,EAEb,CAEA,IAAK,MAAM8G,KAAaJ,EACtBK,iBAAiBD,EAAWJ,EAASI,GAEzC,CDwDEE,CAV+D,CAC7DC,mBAAoBrD,EACpB,mBAAoB7D,EACpB,oBAAqB6B,EACrB,iBAAkBI,EAClB,iBAAkBS,EAClB,sBAAuBQ,EACvB,cAAeoB,GAInB","sources":["webpack://lange/./scripts/common/liquid-global.ts","webpack://lange/./scripts/integrations/google/utils.ts","webpack://lange/./scripts/integrations/google/events/add-to-cart.ts","webpack://lange/./scripts/integrations/google/events/remove-from-cart.ts","webpack://lange/./scripts/integrations/google/events/view-cart.ts","webpack://lange/./scripts/integrations/google/events/view-item.ts","webpack://lange/./scripts/integrations/google/events/view-item-list.ts","webpack://lange/./scripts/integrations/google/index.ts","webpack://lange/./scripts/integrations/common.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/naming-convention */\n/**\n * Do not use this export. This is a hacky fix to a strange inlining optimization performed by\n * webpack where it removes this module and points identifiers directly to the global values.\n * Without this export, webpack fails to understand that `window.__ofir` must also be inlined.\n *\n * @type {unknown}\n */\nexport const __ofir: unknown = window.__ofir;\n\n/**\n * Cart should never be undefined\n */\nexport const Cart: OfirLiquidGlobals.Cart = window.__ofir?.Cart;\n\n/**\n * Checkout is undefined if user is not loading a checkout page.\n *\n * @type {OfirLiquidGlobals.Checkout}\n */\nexport const Checkout: OfirLiquidGlobals.Checkout = window.__ofir?.Checkout;\n\n/**\n * Collection is undefined if user is not loading a product or collection page.\n *\n * @type {OfirLiquidGlobals.Collection}\n */\nexport const Collection: OfirLiquidGlobals.Collection = window.__ofir?.Collection;\n\n/**\n * Customer is undefined if user is not logged in.\n *\n * @type {OfirLiquidGlobals.Customer}\n */\nexport const Customer: OfirLiquidGlobals.Customer = window.__ofir?.Customer;\n\n/**\n * GiftCard is undefined if user is not on gift card page.\n *\n * @type {OfirLiquidGlobals.GiftCard}\n */\nexport const GiftCard: OfirLiquidGlobals.GiftCard = window.__ofir?.GiftCard;\n\n/**\n * Order is undefined unless user is on thank_you page, order status page or account/order detail\n * page.\n *\n * @type {OfirLiquidGlobals.Order}\n */\nexport const Order: OfirLiquidGlobals.Order = window.__ofir?.Order;\n\n/** @type {OfirLiquidGlobals.Page} */\nexport const Page: OfirLiquidGlobals.Page = window.__ofir?.Page;\n\n/** @type {OfirLiquidGlobals.Pagination} */\nexport const Pagination: OfirLiquidGlobals.Pagination = window.__ofir?.Pagination;\n\n/**\n * Product is undefined if not accessing a product page template.\n *\n * @type {OfirLiquidGlobals.Product}\n */\nexport const Product: OfirLiquidGlobals.Product = window.__ofir?.Product;\n\n/** @type {OfirLiquidGlobals.Request} */\nexport const Request: OfirLiquidGlobals.Request = window.__ofir?.Request;\n\n/** @type {OfirLiquidGlobals.Scripts} */\nexport const Scripts: OfirLiquidGlobals.Scripts = window.__ofir?.Scripts;\n\n/** @type {OfirLiquidGlobals.Search} */\nexport const Search: OfirLiquidGlobals.Search = window.__ofir?.Search;\n\n/** @type {OfirLiquidGlobals.SearchEngineListing} */\nexport const SearchEngineListing: OfirLiquidGlobals.SearchEngineListing =\n  window.__ofir?.SearchEngineListing;\n\n/** @type {OfirLiquidGlobals.SectionSettings} */\nexport const SectionSettings: OfirLiquidGlobals.SectionSettings = window.__ofir?.SectionSettings;\n\n/** @type {OfirLiquidGlobals.Shop} */\nexport const Shop: OfirLiquidGlobals.Shop = window.__ofir?.Shop;\n\n/** @type {OfirLiquidGlobals.Template} */\nexport const Template: OfirLiquidGlobals.Template = window.__ofir?.Template;\n\n/** @type {OfirLiquidGlobals.Theme} */\nexport const Theme: OfirLiquidGlobals.Theme = window.__ofir?.Theme;\n\n/** @type {OfirLiquidGlobals.ThemeSettings} */\nexport const ThemeSettings: OfirLiquidGlobals.ThemeSettings = window.__ofir?.ThemeSettings;\n","import type * as GoogleTag from '@integrabeauty/google-tag';\nimport * as LiquidGlobal from '../../common/liquid-global.js';\n\nexport const GOOGLE_ANALYTICS_4_PROPERTY_ID = 'G-T4G3DP9D07';\nexport const GOOGLE_ADWORDS_PROPERTY_ID = 'AW-10932822801';\n\n/**\n * Convert a raw phone number (e.g. from user input) to the E.164 format, which means it must be 11\n * to 15 digits including a plus sign (+) prefix and country code with no dashes, parentheses, or\n * spaces.\n *\n * @see https://support.google.com/google-ads/answer/9888145\n */\nexport function phoneInputToE164(value: string) {\n  if (!value) {\n    return;\n  }\n\n  let phone = value.replace(/[^0-9]/g, '');\n  phone = phone.length === 10 ? `1${phone}` : phone;\n  phone = `+${phone}`;\n  return phone;\n}\n\nexport function getUserAddressProvince() {\n  if (LiquidGlobal.Order?.shipping_address?.province) {\n    return LiquidGlobal.Order?.shipping_address?.province;\n  }\n\n  if (LiquidGlobal.Order?.shipping_address?.province_code) {\n    return LiquidGlobal.Order?.shipping_address?.province_code;\n  }\n\n  if (LiquidGlobal.Customer?.default_address?.province) {\n    return LiquidGlobal.Customer?.default_address?.province;\n  }\n\n  if (LiquidGlobal.Customer?.default_address?.province_code) {\n    return LiquidGlobal.Customer?.default_address?.province_code;\n  }\n}\n\n/**\n * Per the docs, \"If your site doesn't collect one of the above fields, remove the field entirely\n * rather than leaving it blank.\" so we only set a field if it is not empty.\n *\n * @todo we can also use billing address and specify an array of addresses\n *\n * @see https://support.google.com/google-ads/answer/9888656\n * @see https://support.google.com/google-ads/answer/9888145\n */\nexport function buildUserData() {\n  const data: GoogleTag.UserData = {};\n  if (!LiquidGlobal.Customer && !LiquidGlobal.Order) {\n    return;\n  }\n\n  data.email = LiquidGlobal.Order?.email ?\n    LiquidGlobal.Order.email : LiquidGlobal.Customer.email;\n\n  data.phone_number = LiquidGlobal.Order?.shipping_address ?\n    phoneInputToE164(LiquidGlobal.Order.shipping_address.phone) :\n    phoneInputToE164(LiquidGlobal.Customer.phone);\n\n  const address: GoogleTag.MailingAddress = {};\n\n  address.first_name = LiquidGlobal.Order?.customer?.first_name ?? LiquidGlobal.Customer.first_name;\n  address.last_name = LiquidGlobal.Order?.customer?.last_name ?? LiquidGlobal.Customer.last_name;\n\n  if (LiquidGlobal.Order?.shipping_address) {\n    address.street = LiquidGlobal.Order.shipping_address.address1;\n    address.city = LiquidGlobal.Order.shipping_address.city;\n    address.postal_code = LiquidGlobal.Order.shipping_address.zip;\n    address.country = LiquidGlobal.Order.shipping_address.country_code;\n  } else if (LiquidGlobal.Customer?.default_address) {\n    address.street = LiquidGlobal.Customer.default_address.address1;\n    address.city = LiquidGlobal.Customer.default_address.city;\n    address.postal_code = LiquidGlobal.Customer.default_address.zip;\n    address.country = LiquidGlobal.Customer.default_address.country_code;\n  }\n\n  address.region = getUserAddressProvince();\n\n  // For address, first name, last name, postal code, and country are required. You can optionally\n  // provide street address, city, and region as additional match keys.\n  if (address.first_name && address.last_name && address.postal_code && address.country) {\n    data.address = address;\n  }\n\n  // According to https://support.google.com/google-ads/answer/9888145, At least one of the\n  // following fields must be provided:\n  //\n  // * Email\n  // * Address\n  // * Phone number (must be provided in conjunction with email, or full name and address)\n  //\n  // So what this basically means if that either email or address is required.\n  if (data.email || data.address) {\n    return data;\n  }\n\n  return null;\n}\n","import * as LiquidGlobal from '../../../common/liquid-global.js';\nimport * as utils from '../utils.js';\n\n/**\n * @todo also send events to universal analytics, google adwords?\n * @todo enhanced commerce\n *\n * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#add_to_cart\n */\nexport function onAddToCart(event: OfirCustomEvents.AddToCartEvent) {\n  if (typeof event.detail !== 'object' || event.detail === null) {\n    return;\n  }\n\n  if (!event.detail.success) {\n    return;\n  }\n\n  if (!Array.isArray(event.detail.items)) {\n    return;\n  }\n\n  let totalValue = 0;\n  const ga4Items = [];\n  const awItems = [];\n  for (const item of event.detail.items) {\n    totalValue += item.quantity * item.line_price / 100;\n    ga4Items.push({\n      item_brand: 'ofir',\n      item_id: item.sku,\n      item_name: item.title,\n      item_category: item.product_type,\n      price: item.price / 100,\n      quantity: item.quantity\n    });\n\n    awItems.push({\n      brand: 'ofir',\n      id: item.sku,\n      name: item.title,\n      category: item.product_type,\n      price: item.price / 100,\n      quantity: item.quantity\n    });\n  }\n\n  /**\n   * TODO: specify item_variant, to do this we need variant title in the emitting event\n   *\n   * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#add_to_cart\n   * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#add_to_cart_item\n   */\n  gtag('event', 'add_to_cart', {\n    currency: LiquidGlobal.Shop.currency || 'USD',\n    items: ga4Items,\n    value: totalValue,\n    send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n  });\n\n  gtag('event', 'add_to_cart', {\n    currency: LiquidGlobal.Shop.currency || 'USD',\n    items: awItems,\n    value: totalValue,\n    send_to: utils.GOOGLE_ADWORDS_PROPERTY_ID\n  });\n}\n","import * as LiquidGlobal from '../../../common/liquid-global.js';\nimport * as utils from '../utils.js';\n\n/**\n * Responsible for emitting both GA4 and GoogleAds ecommerce event.\n *\n * @see https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_or_remove_an_item_from_a_shopping_cart\n */\nexport function onLineItemRemoved(event: WindowEventMap['line-item-removed']) {\n  if (typeof event.detail !== 'object' || event.detail === null) {\n    return;\n  }\n\n  const lineItem = event.detail.item;\n  const ga4Items = [];\n  ga4Items.push({\n    index: 1,\n    item_brand: 'ofir',\n    item_category: lineItem.product_type,\n    item_id: lineItem.sku,\n    item_name: lineItem.title,\n    price: lineItem.final_price / 100,\n    quantity: lineItem.quantity\n  });\n\n  gtag('event', 'remove_from_cart', {\n    currency: LiquidGlobal.Shop.currency || 'USD',\n    items: ga4Items,\n    value: lineItem.final_price / 100 * lineItem.quantity,\n    send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n  });\n\n  const awItems = [];\n  awItems.push({\n    brand: 'ofir',\n    category: lineItem.product_type,\n    id: lineItem.sku,\n    name: lineItem.title,\n    price: lineItem.final_price / 100,\n    quantity: lineItem.quantity\n  });\n\n  gtag('event', 'remove_from_cart', {\n    items: awItems,\n    send_to: utils.GOOGLE_ADWORDS_PROPERTY_ID\n  });\n}\n","import * as LiquidGlobal from '../../../common/liquid-global.js';\nimport * as utils from '../utils.js';\n\n/**\n * Responsible for emitting both GA4 and GoogleAds ecommerce event.\n *\n * TODO: Implement GoogleAds specific event or confirm GA4 events are being properly forwarded\n *\n * @see https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#add_or_remove_an_item_from_a_shopping_cart\n */\nexport function onViewCart(event: OfirCustomEvents.ViewCartEvent) {\n  if (typeof event.detail !== 'object' || event.detail === null) {\n    return;\n  }\n\n  if (!Array.isArray(event.detail.items)) {\n    return;\n  }\n\n  let totalValue = 0;\n  let index = 1;\n  const items = [];\n  for (const item of event.detail.items) {\n    totalValue += item.quantity * item.line_price / 100;\n    items.push({\n      item_id: `${item.sku}`,\n      item_name: item.product_title,\n      index,\n      item_brand: 'ofir',\n      item_category: item.product_type,\n      item_list_id: `${LiquidGlobal.Collection?.id}` || 'none',\n      item_list_name: LiquidGlobal.Collection?.handle || 'none',\n      item_variant: item.variant_title,\n      price: item.price / 100,\n      quantity: item.quantity\n    });\n    index = index + 1;\n  }\n\n  gtag('event', 'view_cart', {\n    currency: LiquidGlobal.Shop.currency || 'USD',\n    value: totalValue,\n    items,\n    send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n  });\n}\n","import * as LiquidGlobal from '../../../common/liquid-global.js';\nimport * as utils from '../utils.js';\n\n/**\n * Responsible for emitting both GA4 and GoogleAds ecommerce event.\n *\n * TODO: Implement GoogleAds specific event or confirm GA4 events are being properly forwarded\n *\n * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#view_item\n * @see https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#view_item_details\n */\nexport function onViewItem(event: WindowEventMap['ofir-view-item']) {\n  if (typeof event.detail !== 'object' || event.detail === null) {\n    return;\n  }\n\n  if (LiquidGlobal.Template.name !== 'product') {\n    return;\n  }\n\n  gtag('event', 'view_item', {\n    currency: LiquidGlobal.Shop.currency || 'USD',\n    items: [\n      {\n        item_brand: 'ofir',\n        item_id: event.detail.sku,\n        item_category: event.detail.product_type,\n        item_name: event.detail.product_title,\n        item_variant: event.detail.variant_id.toString() ?? '',\n        price: event.detail.price / 100\n      }\n    ],\n    value: event.detail.price / 100,\n    send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n  });\n\n  // See https://developers.google.com/google-ads/api/docs/dynamic-remarketing/prerequisites. Per\n  // the docs, \"the event name you use can be a custom event name of your choosing or one of our\n  // recommended standard events. It doesn't need to match any specific value for the purpose of\n  // implementing dynamic remarketing, as long as the event data parameters (ecomm_pagetype,\n  // ecomm_prodid, and ecomm_totalvalue in this example) are correctly set.\"\n  //\n  //\n  // TODO: setup the dynamic properties too\n  gtag('event', 'view_item', {\n    currency: 'USD',\n    ecomm_pagetype: 'product',\n    ecomm_prodid: event.detail.sku,\n    ecomm_totalvalue: event.detail.price / 100,\n    items: [\n      {\n        category: event.detail.product_type,\n        google_business_vertical: 'retail',\n        id: event.detail.sku,\n        name: event.detail.product_title,\n        price: event.detail.price / 100\n      }\n    ],\n    value: event.detail.price / 100,\n    send_to: utils.GOOGLE_ADWORDS_PROPERTY_ID\n  });\n}\n","import * as LiquidGlobal from '../../../common/liquid-global.js';\nimport * as utils from '../utils.js';\n\n/**\n * Responsible for emitting both GA4 and GoogleAds ecommerce event.\n *\n * TODO: Implement GoogleAds specific event or confirm GA4 events are being properly forwarded\n *\n * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#view_item_list\n * @see https://developers.google.com/analytics/devguides/collection/ga4/ecommerce?client_type=gtag#select_an_item_from_a_list\n */\nexport function onViewItemList(event: WindowEventMap['ofir-view-item-list']) {\n  if (typeof event.detail !== 'object' || event.detail === null) {\n    return;\n  }\n\n  if (LiquidGlobal.Template.name !== 'collection') {\n    return;\n  }\n\n  const ga4Items = [];\n  const awItems = [];\n  let position = 1;\n\n  for (const product of event.detail.products) {\n    ga4Items.push({\n      index: position,\n      item_brand: 'ofir',\n      item_category: product.type,\n      item_id: product.selected_or_first_available_variant.sku,\n      item_name: product.title,\n      item_variant: product.subtitle,\n      price: product.selected_or_first_available_variant.price / 100,\n      quantity: 1,\n      currency: LiquidGlobal.Shop.currency || 'USD'\n    });\n\n    awItems.push({\n      brand: 'ofir',\n      category: product.type,\n      id: product.selected_or_first_available_variant.sku,\n      index: position,\n      name: product.title,\n      list_name: event.detail.name,\n      price: product.variants?.length > 0 ? product.variants[0].price / 100 : 0,\n      quantity: 1,\n      variant: product.subtitle\n    });\n\n    position++;\n  }\n\n  // we do not set item list id/name per item because it is set at the \"event level\". same goes for\n  // currency. see the detailed docs in the reference link.\n  gtag('event', 'view_item_list', {\n    item_list_id: event.detail.id,\n    item_list_name: event.detail.name,\n    items: ga4Items,\n    send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n  });\n\n  gtag('event', 'view_item_list', {\n    items: awItems,\n    send_to: utils.GOOGLE_ADWORDS_PROPERTY_ID\n  });\n}\n","import '@integrabeauty/custom-events';\nimport type * as _GoogleTag from '@integrabeauty/google-tag';\nimport * as LiquidGlobal from '../../common/liquid-global.js';\nimport * as common from '../common.js';\nimport * as GoogleEvents from './events/index.js';\nimport * as utils from './utils.js';\n\nfunction onDOMContentLoaded() {\n  if (LiquidGlobal.Template.name !== 'product' && LiquidGlobal.Template.name !== 'collection' &&\n    LiquidGlobal.Template.name !== 'cart' && !location.href.includes('checkouts')) {\n    gtag('event', 'page_view', {\n      page_title: document.title,\n      page_location: location.href,\n      page_path: location.pathname,\n      send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID\n    });\n  }\n}\n\n/**\n * Handles form-submit events by sending a sign_up event to Google Analytics.\n */\nfunction onFormSubmit(event: WindowEventMap['form-submit']) {\n  const formType = event.detail.form_type;\n  if (formType) {\n    window.gtag('event', 'sign_up', {\n      method: formType,\n      send_to: utils.GOOGLE_ANALYTICS_4_PROPERTY_ID,\n      form_name: event.detail.form_name,\n      form_location: event.detail.form_location\n    });\n  }\n}\n\nfunction main() {\n// Enhanced conversions\n  const userData = utils.buildUserData();\n  if (userData) {\n    gtag('set', 'user_data', userData);\n  }\n\n  const config: Config = {\n    allow_ad_personalization_signals: true,\n    allow_enhanced_conversions: true,\n    allow_google_signals: true,\n    anonymize_ip: false,\n    conversion_linker: true\n  };\n\n  if (LiquidGlobal.Customer?.id) {\n    config.user_id = `${LiquidGlobal.Customer.id}`;\n  }\n\n  gtag('config', utils.GOOGLE_ANALYTICS_4_PROPERTY_ID, config);\n  gtag('config', utils.GOOGLE_ADWORDS_PROPERTY_ID, config);\n\n  // Gather and send custom dimensions. In GA4 we need to attach these to some event. We cannot use\n  // the implicit page view from config. We could disable page view from config and send an explicit\n  // page view but that seems to be detected as a history change instead of a page view.\n\n  const dimensions = <Record<string, string>>{};\n  const url = new URL(location.href);\n  const couponCode = url.searchParams.get('couponcode');\n  if (couponCode) {\n    dimensions.coupon_code_url_parameter = couponCode.toUpperCase();\n  }\n\n  const affiliate = url.searchParams.get('aff') || url.searchParams.get('affiliate');\n  if (affiliate && affiliate !== '{affiliate}') {\n    dimensions.affiliate_url_parameter = affiliate.toUpperCase();\n  }\n\n  const placement = url.searchParams.get('placement');\n  if (placement && placement !== '{placement}') {\n    dimensions.placement_url_parameter = placement.toUpperCase();\n  }\n\n  const adId = url.searchParams.get('ad.id');\n  if (adId && adId !== '{ad.id}') {\n    dimensions.ad_id_url_parameter = adId;\n  }\n\n  if (window.Shopify?.theme?.name) {\n    dimensions.shopify_theme = window.Shopify.theme.name;\n  }\n\n  if (Object.keys(dimensions).length > 0) {\n    window.gtag('event', 'capture_custom_dimensions', dimensions);\n  }\n\n  const registry = <Record<string, (...args: unknown[]) => void>>{\n    'DOMContentLoaded': onDOMContentLoaded,\n    'ofir-add-to-cart': GoogleEvents.onAddToCart,\n    'line-item-removed': GoogleEvents.onLineItemRemoved,\n    'ofir-view-cart': GoogleEvents.onViewCart,\n    'ofir-view-item': GoogleEvents.onViewItem,\n    'ofir-view-item-list': GoogleEvents.onViewItemList,\n    'form-submit': onFormSubmit\n  };\n\n  common.setupRegistry(registry);\n}\n\n/**\n * Shopify's Google Analytics app adds googletagmanager scripts later than this script is executed.\n * I don't think it has to be here and should be removed when we confirm that those events could be\n * removed and default Shopify events from the google-web-pixel app are enough.\n */\nfunction waitForGtag(callback: () => void) {\n  // eslint-disable-next-line @typescript-eslint/no-deprecated\n  if (typeof gtag !== 'undefined') {\n    callback();\n  } else {\n    setTimeout(() => waitForGtag(callback), 100);\n  }\n}\n\nwaitForGtag(main);\n","/**\n * Appends a script element in the head that loads its url async.\n *\n * @todo set crossorigin or other attributes?\n *\n * @param url The script url to load\n * @returns A promise that resolves to a load event or rejects with an error event\n */\nexport function loadScript(url: string) {\n  return new Promise<Event>((resolve, reject) => {\n    const script = document.createElement('script');\n    script.async = true;\n    script.addEventListener('load', resolve);\n    script.addEventListener('error', reject);\n    document.head.append(script);\n    script.src = url;\n  });\n}\n\n/**\n * Search the queue for events that have already fired. For each event, search for whether we have a\n * listener for the event. If found, directly dispatch the event to the listener. This fixes the\n * issue where the script that loads the registry does not add its event listeners until after the\n * event has fired.\n *\n * Then register event listeners for each key of the registry.\n *\n * We cannot restrict the type of parameters to the callback because we have some special callbacks\n * such as the callback for the global error event. However, most of the time the callback is just\n * one parameter, event of type Event.\n *\n * @param registry An event registry\n */\nexport function setupRegistry(registry: Record<string, (...args: unknown[]) => void>) {\n  for (const event of window.ofir.queue) {\n    const listener = registry[event?.type];\n    if (listener) {\n      listener(event);\n    }\n  }\n\n  for (const eventType in registry) {\n    addEventListener(eventType, registry[eventType]);\n  }\n}\n"],"names":["window","__ofir","_window$__ofir","Cart","_window$__ofir2","Checkout","Collection","_window$__ofir3","Customer","_window$__ofir4","Order","_window$__ofir5","GiftCard","_window$__ofir6","Shop","_window$__ofir7","Page","_window$__ofir8","Pagination","_window$__ofir9","Product","_window$__ofir0","Request","_window$__ofir1","Scripts","_window$__ofir10","Search","_window$__ofir11","SearchEngineListing","_window$__ofir12","SectionSettings","_window$__ofir13","Template","_window$__ofir14","_window$__ofir15","Theme","_window$__ofir16","ThemeSettings","GOOGLE_ANALYTICS_4_PROPERTY_ID","GOOGLE_ADWORDS_PROPERTY_ID","phoneInputToE164","value","phone","replace","length","buildUserData","_LiquidGlobal$Order5","_LiquidGlobal$Order6","_LiquidGlobal$Order$c","_LiquidGlobal$Order7","_LiquidGlobal$Order$c2","_LiquidGlobal$Order8","_LiquidGlobal$Order9","_LiquidGlobal$Custome5","data","email","phone_number","shipping_address","address","_LiquidGlobal$Order","_LiquidGlobal$Order3","_LiquidGlobal$Custome","_LiquidGlobal$Custome3","_LiquidGlobal$Order2","_LiquidGlobal$Order4","_LiquidGlobal$Custome2","_LiquidGlobal$Custome4","first_name","customer","last_name","street","address1","city","postal_code","zip","country","country_code","default_address","region","province","province_code","onAddToCart","event","detail","success","Array","isArray","items","totalValue","ga4Items","awItems","item","quantity","line_price","push","item_brand","item_id","sku","item_name","title","item_category","product_type","price","brand","id","name","category","gtag","currency","send_to","onLineItemRemoved","lineItem","index","final_price","onViewCart","_LiquidGlobal$Collect","_LiquidGlobal$Collect2","product_title","item_list_id","item_list_name","handle","item_variant","variant_title","onViewItem","_event$detail$variant","variant_id","toString","ecomm_pagetype","ecomm_prodid","ecomm_totalvalue","google_business_vertical","onViewItemList","position","product","products","_product$variants","type","selected_or_first_available_variant","subtitle","list_name","variants","variant","onDOMContentLoaded","location","href","includes","page_title","document","page_location","page_path","pathname","onFormSubmit","formType","form_type","method","form_name","form_location","waitForGtag","callback","setTimeout","_window$Shopify","userData","config","allow_ad_personalization_signals","allow_enhanced_conversions","allow_google_signals","anonymize_ip","conversion_linker","user_id","dimensions","url","URL","couponCode","searchParams","get","coupon_code_url_parameter","toUpperCase","affiliate","affiliate_url_parameter","placement","placement_url_parameter","adId","ad_id_url_parameter","Shopify","theme","shopify_theme","Object","keys","registry","ofir","queue","listener","eventType","addEventListener","setupRegistry","DOMContentLoaded"],"sourceRoot":""}