{
  "version": 3,
  "sources": ["/cdn/shop/t/182/assets/standard-actions-override.js?bj_drop004_lead=202607101050"],
  "sourcesContent": ["/**\n * Standard Actions configuration for Dawn.\n *\n * Storefront Renderer injects the Shopify Standard Actions bundle\n * (`window.Shopify.actions.{updateCart,openCart,getCart,\u2026}`). This file\n * overrides the bundle's built-in Dawn refresh path with an explicit,\n * in-theme version so forks that change Dawn's cart contract keep\n * working. Remove this file and the built-in defaults take over.\n *\n *   - openCart   \u2014 opens <cart-drawer>; falls back to /cart.\n *   - updateCart \u2014 after the Storefront API mutation, refreshes the\n *     affected cart sections and publishes `cart-update` so Dawn's\n *     pubsub subscribers react.\n *   - other actions (getCart, etc.) keep the default implementation.\n */\n\n// Cart custom elements that advertise sections via getSectionsToRender().\n// If Dawn adds a new cart custom element, add its tag here.\nconst DAWN_CART_TAGS = ['cart-drawer', 'cart-items', 'cart-drawer-items', 'cart-notification'];\n\n// Sections that Dawn's own pubsub subscribers refresh (cart.js's\n// CartItems#onCartUpdate fetches and replaces these directly when\n// cart-update fires; cart-drawer.js's renderContents handles the\n// drawer body). We skip them here to avoid double-rendering.\n// Format is '<element-tag>:<getSectionsToRender entry id>'.\n// If you change which sections those subscribers refresh, update this set.\nconst DAWN_PUBSUB_REFRESHED_SECTIONS = new Set([\n  'cart-drawer:cart-drawer',\n  'cart-drawer-items:CartDrawer',\n  'cart-items:main-cart-items',\n]);\n\n// Walk every mounted Dawn cart custom element, collect the sections it\n// wants rendered, and dedupe. Returns a Map keyed by section id, each\n// entry pointing at the DOM mount and the selector used to extract the\n// fresh fragment.\nfunction collectCartSections() {\n  const sections = new Map();\n\n  for (const el of document.querySelectorAll(DAWN_CART_TAGS.join(','))) {\n    let entries;\n    try {\n      entries = el.getSectionsToRender?.();\n    } catch {\n      continue;\n    }\n\n    const tag = el.tagName.toLowerCase();\n    for (const entry of entries ?? []) {\n      if (DAWN_PUBSUB_REFRESHED_SECTIONS.has(`${tag}:${entry.id}`)) continue;\n\n      const sectionId = entry.section ?? entry.id;\n      if (!sectionId || sections.has(sectionId)) continue;\n\n      // Two patterns coexist in getSectionsToRender():\n      //   - cart-items style: entry.section is the parent Liquid section\n      //     id, entry.selector is a child node inside it.\n      //   - cart-drawer / cart-notification style: entry.id IS the mount;\n      //     there is no parent wrapper.\n      const root = entry.section ? document.getElementById(entry.id) : document;\n      if (!root) continue;\n\n      const mount = entry.selector\n        ? (root.querySelector(entry.selector) ?? (entry.section ? root : null))\n        : document.getElementById(entry.id);\n      if (!mount) continue;\n\n      sections.set(sectionId, {\n        mount,\n        extractSelector: entry.selector || '.shopify-section',\n      });\n    }\n  }\n\n  return sections;\n}\n\n// After a Storefront API mutation, refresh every Dawn cart section\n// that isn't already refreshed by Dawn's own pubsub subscribers, then\n// publish 'cart-update' so the subscribers run.\n//\n// We always fetch /cart.js (with sections= when we have any) so that\n// `cartData` is defined for subscribers. quick-add-bulk.js reads\n// `event.cartData.items` unconditionally \u2014 publishing without cartData\n// makes it throw.\nasync function refreshDawnCartUI() {\n  const sections = collectCartSections();\n  const sectionsQuery = sections.size\n    ? `?sections=${[...sections.keys()].join(',')}`\n    : '';\n  // `routes` is a Dawn global, but don't assume it's defined.\n  const cartUrl = (typeof routes !== 'undefined' && routes?.cart_url) || '/cart';\n  const url = `${cartUrl}.js${sectionsQuery}`;\n  const cartData = await fetch(url, { headers: { Accept: 'application/json' } })\n    .then((r) => (r.ok ? r.json() : null))\n    .catch(() => null);\n\n  if (cartData?.sections) {\n    for (const [id, { mount, extractSelector }] of sections) {\n      const html = cartData.sections[id];\n      if (!html) continue;\n      const source = new DOMParser()\n        .parseFromString(html, 'text/html')\n        .querySelector(extractSelector);\n      if (source) mount.replaceChildren(...source.childNodes);\n    }\n  }\n\n  // Hand off to Dawn's existing subscribers. cartData is the full\n  // Cart Ajax payload (items, item_count, token, \u2026) plus sections;\n  // quick-add-bulk.js and price-per-item.js read it directly.\n  publish(PUB_SUB_EVENTS.cartUpdate, {\n    source: 'external-refresh',\n    cartData: cartData ?? undefined,\n  });\n}\n\nfunction initStandardActions() {\n  const actions = window.Shopify?.actions;\n  if (!actions) return;\n\n  actions.openCart.configure({\n    async handler(defaultHandler) {\n      const drawer = document.querySelector('cart-drawer');\n      if (drawer && typeof drawer.open === 'function') {\n        drawer.open();\n        return;\n      }\n      return defaultHandler();\n    },\n  });\n\n  actions.updateCart.configure({\n    // Dawn doesn't currently listen for shopify:cart:* events, but the\n    // bundle requires an eventTarget. document is the conventional root.\n    eventTarget: () => document,\n    async handler(defaultHandler) {\n      const result = await defaultHandler();\n      try {\n        await refreshDawnCartUI();\n      } catch (error) {\n        console.error('[Dawn] Standard Actions cart refresh failed; reloading.', error);\n        window.location.reload();\n      }\n      return result;\n    },\n  });\n}\n\n// Run immediately if the standard-actions bundle has already attached\n// `Shopify.actions`; otherwise wait for DOMContentLoaded, which fires after\n// all module scripts have executed regardless of document order.\nif (window.Shopify?.actions) {\n  initStandardActions();\n} else {\n  document.addEventListener('DOMContentLoaded', initStandardActions, { once: true });\n}\n\n\n/* BJ Drop 004 Lead tracking patch 2026-07-09 */\n(function() {\n  if (window.__bjDrop004LeadPatchInstalled) return;\n  window.__bjDrop004LeadPatchInstalled = true;\n\n  function isDrop004() {\n    return /\\/collections\\/drop-004(?:$|[?#\\/])/i.test(window.location.pathname + window.location.search + window.location.hash);\n  }\n\n  function parseSubscriptionBody(body) {\n    var out = { email: '', listId: 'U5eJHp' };\n    try {\n      var raw = typeof body === 'string' ? body : '';\n      if (!raw && body && typeof body.text === 'function') return out;\n      if (raw && raw.charAt(0) !== '{') {\n        var params = new URLSearchParams(raw);\n        out.email = params.get('email') || '';\n        out.listId = params.get('g') || params.get('list_id') || out.listId;\n        return out;\n      }\n      var payload = raw ? JSON.parse(raw) : null;\n      var attrs = payload && payload.data && payload.data.attributes;\n      var profileAttrs = attrs && attrs.profile && attrs.profile.data && attrs.profile.data.attributes;\n      var listRel = payload && payload.data && payload.data.relationships && payload.data.relationships.list;\n      out.email = (profileAttrs && profileAttrs.email) || '';\n      out.listId = (listRel && listRel.data && listRel.data.id) || out.listId;\n    } catch(err) {}\n    return out;\n  }\n\n  function fireLead(email, listId) {\n    if (!isDrop004()) return;\n    var key = 'bj_drop004_lead_' + (email || 'unknown').toLowerCase();\n    try { if (window.sessionStorage && window.sessionStorage.getItem(key)) return; } catch(err) {}\n    try { if (window.sessionStorage) window.sessionStorage.setItem(key, '1'); } catch(err) {}\n\n    try {\n      if (window.Shopify && window.Shopify.analytics && typeof window.Shopify.analytics.publish === 'function') {\n        window.Shopify.analytics.publish('bj_drop004_lead', {\n          email: email || undefined,\n          list_id: listId || 'U5eJHp',\n          source: 'drop_004_signup',\n          page_url: window.location.href\n        });\n      }\n    } catch(err) {}\n\n    try {\n      if (typeof window.fbq === 'function') {\n        window.fbq('track', 'Lead', {\n          content_name: 'Drop 004 signup',\n          content_category: 'newsletter',\n          source: 'drop_footer',\n          list_id: listId || 'U5eJHp'\n        });\n      }\n    } catch(err) {}\n  }\n\n  window.__bjDrop004LeadFire = fireLead;\n\n  if (typeof window.fetch === 'function') {\n    var originalFetch = window.fetch;\n    window.fetch = function(input, init) {\n      var url = '';\n      try { url = typeof input === 'string' ? input : (input && input.url) || ''; } catch(err) {}\n      var body = init && init.body;\n      var parsed = /(a\\.klaviyo\\.com\\/client\\/subscriptions|manage\\.kmail-lists\\.com\\/ajax\\/subscriptions\\/subscribe)/i.test(url) ? parseSubscriptionBody(body) : null;\n      return originalFetch.apply(this, arguments).then(function(response) {\n        try {\n          if (parsed && (response.ok || response.status === 202)) fireLead(parsed.email, parsed.listId);\n        } catch(err) {}\n        return response;\n      });\n    };\n  }\n})();\n"],
  "mappings": "AAkBA,MAAM,eAAiB,CAAC,cAAe,aAAc,oBAAqB,mBAAmB,EAQvF,+BAAiC,IAAI,IAAI,CAC7C,0BACA,+BACA,4BACF,CAAC,EAMD,SAAS,qBAAsB,CAC7B,MAAM,SAAW,IAAI,IAErB,UAAW,MAAM,SAAS,iBAAiB,eAAe,KAAK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