@occluze/tether 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/config.js", "../src/client.js", "../src/fragments.js", "../src/loader.js", "../src/selling-plans.js", "../src/dom.js", "../src/cart.js", "../src/status.js", "../src/product.js", "../src/collection.js", "../src/api-version.js", "../src/markets.js", "../src/diagnose.js", "../src/index.js"],
4
- "sourcesContent": ["/**\n * Runtime config. One shared object, mutated by configure(), read everywhere.\n */\n\nexport const DEFAULTS = {\n // Shopify Storefront API\n domain: '', // 'your-store.myshopify.com'\n token: '', // public Storefront API access token\n apiVersion: '2026-07',\n country: undefined, // ISO code, e.g. 'NL' -> @inContext(country: NL)\n language: undefined, // e.g. 'NL' -> @inContext(language: NL)\n locale: undefined, // Intl locale for money/dates, e.g. 'nl-NL'\n markets: null, // { detect: true, locales: { de: { country: 'DE', language: 'DE' } }, cookie, remember } (markets.js)\n\n // Markup\n prefix: 'tether', // attribute prefix: tether-product, tether-bind, ...\n productPath: '/product', // Webflow CMS template path for products\n collectionPath: '/collection',\n\n // Fetching\n metafields: [], // ['custom.material', { namespace, key }]\n imagesFirst: 25,\n variantsFirst: 100,\n sellingPlanGroupsFirst: 10,\n sellingPlansFirst: 25,\n collectionFirst: 24,\n retries: 2,\n\n // Cart\n storageKey: null, // defaults to `tether:cart:<domain>`\n cartDrawerOpenClass: 'is-open',\n openCartOnAdd: true,\n checkoutTarget: '_self', // '_self' or '_blank'\n\n // Subscriptions\n defaultPurchase: 'one-time', // 'one-time' | 'subscription'\n\n // Mounting\n autoMount: true, // mount document on DOMContentLoaded\n observe: false, // auto-mount nodes added later (CMS load-more, filters)\n\n // Formatting\n formatMoney: null, // (money, locale) => string\n\n // Hooks (all optional)\n onLayoutChange: null, // (reason) => void. Default refreshes ScrollTrigger if present\n onCartOpen: null, // (drawers) => void, e.g. lock scroll\n onCartClose: null, // (drawers) => void\n onLineEnter: null, // (node) => void, animate a new cart line in\n onLineLeave: null, // (node, done) => void, animate out, then call done()\n onValueChange: null, // (el, previousText) => void, e.g. text scramble\n onError: null, // (error, context) => void\n\n debug: false,\n};\n\nexport const cfg = { ...DEFAULTS };\n\nexport function configure(overrides = {}) {\n Object.keys(cfg).forEach((k) => delete cfg[k]);\n Object.assign(cfg, DEFAULTS, overrides);\n if (cfg.domain) cfg.domain = String(cfg.domain).replace(/^https?:\\/\\//, '').replace(/\\/.*$/, '');\n if (!cfg.storageKey) cfg.storageKey = `${cfg.prefix}:cart:${cfg.domain}`;\n if (cfg.apiVersion === 'unstable') warn('apiVersion \"unstable\" changes without notice. Pin a dated version (e.g. 2026-07).');\n return cfg;\n}\n\nexport const isConfigured = () => Boolean(cfg.domain && cfg.token);\n\nexport function log(...a) { if (cfg.debug) console.log(`[${cfg.prefix}]`, ...a); }\nexport function warn(...a) { console.warn(`[${cfg.prefix}]`, ...a); }\n\nexport function reportError(err, context) {\n warn(context, err && err.message ? err.message : err);\n if (typeof cfg.onError === 'function') {\n try { cfg.onError(err, context); } catch { /* never let a hook break us */ }\n }\n}\n", "/**\n * Storefront API client: one fetch wrapper with @inContext, retries and\n * readable errors. Exposed as Tether.query() for anything Tether doesn't cover.\n */\nimport { cfg, log } from './config.js';\n\nexport class TetherError extends Error {\n constructor(message, { status, errors, userErrors, code } = {}) {\n super(message);\n this.name = 'TetherError';\n this.code = code || (status ? `HTTP_${status}` : 'ERROR');\n this.status = status;\n this.errors = errors;\n this.userErrors = userErrors;\n }\n}\n\nexport function endpoint() {\n return `https://${cfg.domain}/api/${cfg.apiVersion}/graphql.json`;\n}\n\n/**\n * Adds @inContext(country, language) to the first operation in the document,\n * so prices, currency and translations follow the configured market.\n * Operations are always written first, fragments after, so the first match is\n * the operation.\n */\nexport function withContext(query, ctx = cfg) {\n const args = [];\n if (ctx.country) args.push(`country: ${String(ctx.country).toUpperCase()}`);\n if (ctx.language) args.push(`language: ${String(ctx.language).toUpperCase().replace('-', '_')}`);\n if (!args.length || /@inContext/.test(query)) return query;\n\n return query.replace(\n /^(\\s*(?:query|mutation)\\s+\\w+\\s*(?:\\([^)]*\\))?)/,\n `$1 @inContext(${args.join(', ')})`,\n );\n}\n\nconst sleep = (ms) => new Promise((r) => setTimeout(r, ms));\n\nexport async function gql(query, variables = {}, { context = true } = {}) {\n if (!cfg.domain || !cfg.token) {\n throw new TetherError('Tether is not configured: domain and token are required', { code: 'NOT_CONFIGURED' });\n }\n\n const body = JSON.stringify({ query: context ? withContext(query) : query, variables });\n let attempt = 0;\n\n for (;;) {\n let res;\n try {\n res = await fetch(endpoint(), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Shopify-Storefront-Access-Token': cfg.token,\n },\n body,\n });\n } catch (err) {\n if (attempt++ < cfg.retries) { await sleep(300 * 2 ** attempt); continue; }\n throw new TetherError(`Network error: ${err.message}`, { code: 'NETWORK' });\n }\n\n if (res.status === 430) throw new TetherError('Shopify security rejection (430)', { status: 430 });\n\n const retryable = res.status === 429 || res.status >= 500;\n if (retryable && attempt++ < cfg.retries) {\n log('retry', res.status, attempt);\n await sleep(300 * 2 ** attempt);\n continue;\n }\n\n let json;\n try { json = await res.json(); } catch {\n throw new TetherError(`Invalid response (${res.status})`, { status: res.status });\n }\n\n if (json.errors?.length) {\n // Token without unauthenticated_read_product_inventory: drop the field and retry.\n const inventoryDenied = json.errors.some((e) => /quantityAvailable/.test(e.message || ''));\n if (inventoryDenied && /\\bquantityAvailable\\b/.test(body)) {\n log('no inventory permission, retrying without quantityAvailable');\n return gql(query.replace(/\\bquantityAvailable\\b/g, ''), variables, { context });\n }\n const throttled = json.errors.some((e) => e.extensions?.code === 'THROTTLED');\n if (throttled && attempt++ < cfg.retries) { await sleep(500 * 2 ** attempt); continue; }\n throw new TetherError(json.errors.map((e) => e.message).join(' | '), {\n status: res.status, errors: json.errors,\n });\n }\n if (!res.ok) throw new TetherError(`HTTP ${res.status}`, { status: res.status });\n\n return json.data;\n }\n}\n\n/** Throws on mutation userErrors, returns the payload otherwise. */\nexport function unwrap(payload, name) {\n if (!payload) throw new TetherError(`${name}: empty response`);\n const errs = payload.userErrors || [];\n if (errs.length) {\n throw new TetherError(errs.map((e) => e.message).join(' | '), { userErrors: errs });\n }\n return payload;\n}\n", "/**\n * GraphQL fragments. Built at call time because counts and metafields come\n * from config. Operations put these AFTER the operation (see withContext).\n */\nimport { cfg } from './config.js';\n\nconst MONEY = 'amount currencyCode';\nconst IMAGE = 'url altText width height';\n\nexport function metafieldIdentifiers() {\n return (cfg.metafields || []).map((m) => {\n if (typeof m === 'string') {\n const i = m.indexOf('.');\n return { namespace: m.slice(0, i), key: m.slice(i + 1) };\n }\n return m;\n }).filter((m) => m.namespace && m.key);\n}\n\nfunction metafieldsField() {\n const ids = metafieldIdentifiers();\n if (!ids.length) return '';\n const list = ids\n .map((m) => `{namespace: ${JSON.stringify(m.namespace)}, key: ${JSON.stringify(m.key)}}`)\n .join(', ');\n return `metafields(identifiers: [${list}]) {\n namespace key type value\n reference { ... on MediaImage { image { ${IMAGE} } } }\n }`;\n}\n\nexport const SELLING_PLAN_FIELDS = `\n id name description recurringDeliveries\n options { name value }\n priceAdjustments {\n orderCount\n adjustmentValue {\n __typename\n ... on SellingPlanPercentagePriceAdjustment { adjustmentPercentage }\n ... on SellingPlanFixedAmountPriceAdjustment { adjustmentAmount { ${MONEY} } }\n ... on SellingPlanFixedPriceAdjustment { price { ${MONEY} } }\n }\n }`;\n\nexport const ALLOCATION_FIELDS = `\n sellingPlan { id }\n checkoutChargeAmount { ${MONEY} }\n remainingBalanceChargeAmount { ${MONEY} }\n priceAdjustments {\n price { ${MONEY} }\n compareAtPrice { ${MONEY} }\n perDeliveryPrice { ${MONEY} }\n unitPrice { ${MONEY} }\n }`;\n\nexport function productFragment() {\n return `\nfragment TetherProduct on Product {\n id handle title description descriptionHtml productType vendor tags\n availableForSale publishedAt onlineStoreUrl requiresSellingPlan\n seo { title description }\n featuredImage { ${IMAGE} }\n images(first: ${cfg.imagesFirst}) { nodes { ${IMAGE} } }\n options { name optionValues { name swatch { color image { previewImage { ${IMAGE} } } } } }\n priceRange { minVariantPrice { ${MONEY} } maxVariantPrice { ${MONEY} } }\n compareAtPriceRange { minVariantPrice { ${MONEY} } maxVariantPrice { ${MONEY} } }\n ${metafieldsField()}\n sellingPlanGroups(first: ${cfg.sellingPlanGroupsFirst}) {\n nodes {\n name appName\n options { name values }\n sellingPlans(first: ${cfg.sellingPlansFirst}) { nodes { ${SELLING_PLAN_FIELDS} } }\n }\n }\n variants(first: ${cfg.variantsFirst}) {\n nodes {\n id title availableForSale currentlyNotInStock quantityAvailable sku barcode\n selectedOptions { name value }\n image { ${IMAGE} }\n price { ${MONEY} }\n compareAtPrice { ${MONEY} }\n unitPrice { ${MONEY} }\n sellingPlanAllocations(first: ${cfg.sellingPlansFirst}) { nodes { ${ALLOCATION_FIELDS} } }\n }\n }\n}`;\n}\n\nexport function cartFragment() {\n return `\nfragment TetherCart on Cart {\n id checkoutUrl totalQuantity note createdAt updatedAt\n attributes { key value }\n buyerIdentity { countryCode email }\n discountCodes { code applicable }\n cost {\n subtotalAmount { ${MONEY} }\n totalAmount { ${MONEY} }\n checkoutChargeAmount { ${MONEY} }\n }\n lines(first: 100) {\n nodes {\n id quantity\n attributes { key value }\n cost {\n totalAmount { ${MONEY} }\n subtotalAmount { ${MONEY} }\n amountPerQuantity { ${MONEY} }\n compareAtAmountPerQuantity { ${MONEY} }\n }\n discountAllocations { discountedAmount { ${MONEY} } }\n sellingPlanAllocation {\n sellingPlan { id name description recurringDeliveries options { name value } }\n checkoutChargeAmount { ${MONEY} }\n priceAdjustments { price { ${MONEY} } compareAtPrice { ${MONEY} } perDeliveryPrice { ${MONEY} } }\n }\n merchandise {\n ... on ProductVariant {\n id title sku availableForSale requiresShipping\n image { ${IMAGE} }\n price { ${MONEY} }\n compareAtPrice { ${MONEY} }\n selectedOptions { name value }\n product { id title handle vendor featuredImage { ${IMAGE} } }\n }\n }\n ... on ComponentizableCartLine {\n lineComponents {\n id quantity\n merchandise { ... on ProductVariant { id title product { title handle } } }\n }\n }\n }\n }\n}`;\n}\n\nexport function collectionFields() {\n return `\n id handle title description descriptionHtml\n image { ${IMAGE} }\n seo { title description }`;\n}\n", "/**\n * Data loading. Products are batched per tick into one request and cached for\n * the lifetime of the page (survives Barba/Swup page swaps).\n */\nimport { cfg, log } from './config.js';\nimport { gql, TetherError } from './client.js';\nimport { productFragment, collectionFields } from './fragments.js';\n\nconst productCache = new Map(); // key -> Promise<product>\nlet pending = [];\nconst resolvers = new Map();\nlet scheduled = false;\n// Bumped by clearProductCache(): responses to requests sent before that (e.g. in the old\n// market after a country switch) still reach their callers but never refill the cache.\nlet generation = 0;\n\nconst isGid = (v) => typeof v === 'string' && v.startsWith('gid://');\n\n/** Accepts a handle, numeric id, gid or a full product URL. */\nexport function normalizeProductKey(raw) {\n const v = String(raw ?? '').trim();\n if (!v) return null;\n if (isGid(v)) return v;\n if (/^\\d+$/.test(v)) return `gid://shopify/Product/${v}`;\n const m = v.match(/\\/products\\/([^/?#]+)/);\n return m ? m[1] : v;\n}\n\n/** Put a product we already have (from a collection query) in the cache. */\nexport function primeProduct(product) {\n if (!product) return;\n const p = Promise.resolve(product);\n productCache.set(product.handle, p);\n productCache.set(product.id, p);\n}\n\nexport function getProduct(rawKey) {\n const key = normalizeProductKey(rawKey);\n if (!key) return Promise.reject(new TetherError('empty product key', { code: 'NOT_FOUND' }));\n if (productCache.has(key)) return productCache.get(key);\n\n const p = new Promise((resolve, reject) => {\n resolvers.set(key, { resolve, reject });\n pending.push(key);\n if (!scheduled) {\n scheduled = true;\n setTimeout(flush, 0);\n }\n });\n productCache.set(key, p);\n return p;\n}\n\nasync function flush() {\n scheduled = false;\n const gen = generation;\n const keys = pending.splice(0);\n if (!keys.length) return;\n\n const ids = keys.filter(isGid);\n const handles = keys.filter((k) => !isGid(k));\n const defs = [];\n const parts = [];\n const vars = {};\n\n if (ids.length) {\n defs.push('$ids: [ID!]!');\n vars.ids = ids;\n parts.push('byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }');\n }\n handles.forEach((h, i) => {\n defs.push(`$h${i}: String!`);\n vars[`h${i}`] = h;\n parts.push(`h${i}: product(handle: $h${i}) { ...TetherProduct }`);\n });\n\n const query = `query TetherProducts(${defs.join(', ')}) {\\n ${parts.join('\\n ')}\\n}\\n${productFragment()}`;\n log('fetch products', keys);\n\n const settle = (k, fn) => {\n const r = resolvers.get(k);\n resolvers.delete(k);\n if (r) fn(r);\n };\n\n try {\n const data = await gql(query, vars);\n const got = new Map();\n (data.byId || []).forEach((p) => { if (p) got.set(p.id, p); });\n handles.forEach((h, i) => { if (data[`h${i}`]) got.set(h, data[`h${i}`]); });\n\n keys.forEach((k) => settle(k, (r) => {\n if (got.has(k)) { if (gen === generation) primeProduct(got.get(k)); r.resolve(got.get(k)); } else {\n if (gen === generation) productCache.delete(k); // don't cache misses: a fix in Shopify works on next load\n r.reject(new TetherError(`Product not found: ${k}`, { code: 'NOT_FOUND' }));\n }\n }));\n } catch (err) {\n keys.forEach((k) => settle(k, (r) => { if (gen === generation) productCache.delete(k); r.reject(err); }));\n }\n}\n\nexport function clearProductCache() { productCache.clear(); generation++; }\n\n/**\n * A page of products from a collection (by handle) or from a search query.\n * Returns { collection, products, pageInfo }.\n */\nexport async function getProducts({\n collection, query, first = cfg.collectionFirst, after = null, sortKey, reverse = false, filters,\n} = {}) {\n const fragment = productFragment();\n\n if (collection) {\n const data = await gql(`query TetherCollection($handle: String!, $first: Int!, $after: String, $sortKey: ProductCollectionSortKeys, $reverse: Boolean, $filters: [ProductFilter!]) {\n collection(handle: $handle) {\n ${collectionFields()}\n products(first: $first, after: $after, sortKey: $sortKey, reverse: $reverse, filters: $filters) {\n nodes { ...TetherProduct }\n pageInfo { hasNextPage endCursor }\n }\n }\n}\n${fragment}`, {\n handle: collection, first, after, sortKey: sortKey || undefined, reverse, filters: filters || undefined,\n });\n if (!data.collection) throw new TetherError(`Collection not found: ${collection}`, { code: 'NOT_FOUND' });\n const { products, ...rest } = data.collection;\n products.nodes.forEach(primeProduct);\n return { collection: rest, products: products.nodes, pageInfo: products.pageInfo };\n }\n\n const data = await gql(`query TetherSearch($first: Int!, $after: String, $query: String, $sortKey: ProductSortKeys, $reverse: Boolean) {\n products(first: $first, after: $after, query: $query, sortKey: $sortKey, reverse: $reverse) {\n nodes { ...TetherProduct }\n pageInfo { hasNextPage endCursor }\n }\n}\n${fragment}`, { first, after, query: query || undefined, sortKey: sortKey || undefined, reverse });\n data.products.nodes.forEach(primeProduct);\n return { collection: null, products: data.products.nodes, pageInfo: data.products.pageInfo };\n}\n\nexport async function getRecommendations(productId, intent = 'RELATED') {\n const data = await gql(`query TetherRecs($id: ID!, $intent: ProductRecommendationIntent) {\n productRecommendations(productId: $id, intent: $intent) { ...TetherProduct }\n}\n${productFragment()}`, { id: productId, intent });\n const list = data.productRecommendations || [];\n list.forEach(primeProduct);\n return list;\n}\n", "/**\n * Pure helpers for Shopify selling plans (subscriptions). No DOM, easy to test.\n */\n\nexport const GID = {\n product: (v) => toGid(v, 'Product'),\n variant: (v) => toGid(v, 'ProductVariant'),\n sellingPlan: (v) => toGid(v, 'SellingPlan'),\n};\n\nexport function toGid(value, type) {\n const v = String(value ?? '').trim();\n if (!v) return null;\n if (v.startsWith('gid://')) return v;\n if (/^\\d+$/.test(v)) return `gid://shopify/${type}/${v}`;\n return v;\n}\n\n/** All plans of a product, flattened, each with its group attached. */\nexport function allPlans(product) {\n const groups = product?.sellingPlanGroups?.nodes || [];\n return groups.flatMap((g) => (g.sellingPlans?.nodes || []).map((p) => ({ ...p, group: g })));\n}\n\nexport function hasPlans(product) {\n return allPlans(product).length > 0;\n}\n\n/** The allocation of `planId` on `variant`, or null when the variant isn't in that plan. */\nexport function allocationFor(variant, planId) {\n if (!variant || !planId) return null;\n return (variant.sellingPlanAllocations?.nodes || []).find((a) => a.sellingPlan?.id === planId) || null;\n}\n\n/** Plans that can actually be bought with this variant. */\nexport function plansForVariant(product, variant) {\n return allPlans(product).filter((p) => allocationFor(variant, p.id));\n}\n\n/** Price per delivery for a variant on a plan (falls back to the one-time price). */\nexport function planPrice(variant, planId) {\n const a = allocationFor(variant, planId);\n const adj = a?.priceAdjustments?.[0];\n return adj?.perDeliveryPrice || adj?.price || variant?.price || null;\n}\n\n/** What the customer pays at checkout for this plan (prepaid plans charge more up front). */\nexport function planCheckoutCharge(variant, planId) {\n const a = allocationFor(variant, planId);\n return a?.checkoutChargeAmount || a?.priceAdjustments?.[0]?.price || variant?.price || null;\n}\n\n/** Savings of a plan vs the one-time price, as { amount, percentage }. */\nexport function planSavings(variant, planId) {\n const base = parseFloat(variant?.price?.amount);\n const sub = parseFloat(planPrice(variant, planId)?.amount);\n if (!Number.isFinite(base) || !Number.isFinite(sub) || base <= 0 || sub >= base) {\n return { amount: null, percentage: 0 };\n }\n return {\n amount: { amount: (base - sub).toFixed(2), currencyCode: variant.price.currencyCode },\n percentage: Math.round((1 - sub / base) * 100),\n };\n}\n\n/**\n * The plan's own discount description, independent of a variant:\n * '10%', or a fixed amount / fixed price.\n */\nexport function planAdjustment(plan) {\n const v = plan?.priceAdjustments?.[0]?.adjustmentValue;\n if (!v) return null;\n switch (v.__typename) {\n case 'SellingPlanPercentagePriceAdjustment': return { type: 'percentage', value: v.adjustmentPercentage };\n case 'SellingPlanFixedAmountPriceAdjustment': return { type: 'amount', value: v.adjustmentAmount };\n case 'SellingPlanFixedPriceAdjustment': return { type: 'price', value: v.price };\n default: return null;\n }\n}\n\n/**\n * Finds a plan by id, numeric id, name or option value (case-insensitive),\n * so Webflow editors can write tether-default-plan=\"Every month\".\n */\nexport function findPlan(product, ref) {\n if (!ref) return null;\n const plans = allPlans(product);\n const gid = GID.sellingPlan(ref);\n const needle = String(ref).trim().toLowerCase();\n return plans.find((p) => p.id === gid)\n || plans.find((p) => p.name.toLowerCase() === needle)\n || plans.find((p) => (p.options || []).some((o) => String(o.value).toLowerCase() === needle))\n || null;\n}\n", "/**\n * DOM helpers. Attribute names go through attr() so the prefix is configurable\n * (e.g. prefix: 'wfs' for markup that uses wfs-* attributes).\n */\nimport { cfg, warn } from './config.js';\n\nexport const attr = (name) => `${cfg.prefix}-${name}`;\nexport const sel = (name, value) =>\n value === undefined ? `[${attr(name)}]` : `[${attr(name)}=\"${value}\"]`;\nexport const get = (el, name) => el.getAttribute(attr(name));\nexport const has = (el, name) => el.hasAttribute(attr(name));\nexport const dataKey = () => `data-${cfg.prefix}-key`;\n\n/**\n * productPath '/product' -> /product/<handle>.\n * Templates: '/product?handle={handle}' (one static page for every product,\n * with tether-product=\"url:handle\"), '/p/{id}' (numeric product id).\n */\nexport function productUrl(handle, id) {\n const path = cfg.productPath || '/product';\n if (!/\\{(handle|id)\\}/.test(path)) return `${path.replace(/\\/$/, '')}/${handle}`;\n const numeric = id ? String(id).split('/').pop() : '';\n return path.replace(/\\{handle\\}/g, encodeURIComponent(handle || '')).replace(/\\{id\\}/g, encodeURIComponent(numeric));\n}\n\nexport const qsa = (root, s) => (root ? [...root.querySelectorAll(s)] : []);\n\n/** Elements in `root` whose nearest `scopeSelector` ancestor is `root` itself. */\nexport const scoped = (root, s, scopeSelector) =>\n qsa(root, s).filter((el) => el.closest(scopeSelector) === root);\n\nexport function emit(name, detail, target = document) {\n target.dispatchEvent(new CustomEvent(`${cfg.prefix}:${name}`, { detail, bubbles: true }));\n}\n\nexport function formatMoney(money) {\n if (!money) return '';\n if (typeof cfg.formatMoney === 'function') return cfg.formatMoney(money, cfg.locale);\n const amount = parseFloat(money.amount);\n if (Number.isNaN(amount)) return '';\n try {\n return new Intl.NumberFormat(cfg.locale || undefined, {\n style: 'currency', currency: money.currencyCode,\n }).format(amount);\n } catch {\n return `${money.currencyCode} ${amount.toFixed(2)}`;\n }\n}\n\nexport function formatDate(iso) {\n if (!iso) return '';\n try { return new Date(iso).toLocaleDateString(cfg.locale || undefined); } catch { return ''; }\n}\n\n/** Shopify CDN resize via max-width / max-height / crop attributes on the element. */\nexport function cdnUrl(url, el) {\n if (!url || !el) return url;\n const w = el.getAttribute('max-width');\n const h = el.getAttribute('max-height');\n const crop = el.getAttribute('crop');\n if (!w && !h) return url;\n try {\n const u = new URL(url);\n if (w) u.searchParams.set('width', w);\n if (h) u.searchParams.set('height', h);\n if (crop) u.searchParams.set('crop', crop);\n return u.toString();\n } catch { return url; }\n}\n\nexport function setImage(el, url, alt) {\n if (!url) return;\n const src = cdnUrl(url, el);\n if (el.tagName === 'IMG') {\n el.removeAttribute('srcset');\n el.removeAttribute('sizes');\n el.setAttribute('src', src);\n if (alt != null) el.setAttribute('alt', alt);\n if (!el.getAttribute('loading')) el.setAttribute('loading', 'lazy');\n } else {\n el.style.backgroundImage = `url(\"${src}\")`;\n }\n}\n\nexport function setText(el, v) {\n const text = v == null ? '' : String(v);\n if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') el.value = text;\n else el.textContent = text;\n}\n\nexport const readText = (el) => (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' ? el.value : el.textContent);\n\n/** setText that reports changes to cfg.onValueChange (for scramble/roll effects). */\nexport function setTextTracked(el, v) {\n const before = readText(el);\n setText(el, v);\n const after = readText(el);\n if (before !== after && el.dataset.tetherSeen && typeof cfg.onValueChange === 'function') {\n try { cfg.onValueChange(el, before); } catch { /* ignore */ }\n }\n el.dataset.tetherSeen = '1';\n}\n\nexport function show(el, visible) {\n const k = 'tetherPrevDisplay';\n if (visible) {\n if (el.dataset[k] !== undefined) {\n el.style.display = el.dataset[k];\n delete el.dataset[k];\n } else if (el.style.display === 'none') {\n el.style.display = '';\n }\n } else {\n if (el.dataset[k] === undefined) el.dataset[k] = el.style.display || '';\n el.style.display = 'none';\n }\n}\n\nexport function setSelected(el, selected) {\n el.classList.toggle('is-selected', selected);\n el.setAttribute('aria-pressed', selected ? 'true' : 'false');\n if (el.tagName === 'INPUT' && (el.type === 'radio' || el.type === 'checkbox')) el.checked = selected;\n const input = el.querySelector?.('input[type=\"radio\"],input[type=\"checkbox\"]');\n if (input) input.checked = selected;\n}\n\n// ---------------------------------------------------------------------------\n// Repeaters: the first child in Webflow is the template, the rest is removed.\n// ---------------------------------------------------------------------------\n\nconst templates = new WeakMap();\n\n/** True once a repeater's template has been captured (it may be empty after that). */\nexport const hasTemplate = (container) => Boolean(templates.get(container));\n\nfunction template(container) {\n if (!templates.has(container)) {\n const tpl = container.firstElementChild?.cloneNode(true) ?? null;\n templates.set(container, tpl);\n container.innerHTML = '';\n }\n return templates.get(container);\n}\n\n/** Rebuilds the list on every render. Fine for images, tags, options. */\nexport function repeat(container, items, render) {\n const tpl = template(container);\n if (!tpl) { warn('repeater without a template child', container); return; }\n container.innerHTML = '';\n items.forEach((item, i) => {\n const node = tpl.cloneNode(true);\n render(node, item, i);\n container.appendChild(node);\n });\n}\n\n/**\n * Keyed repeater: keeps existing nodes, inserts new ones, removes old ones.\n * Used for cart lines, so values can animate and lines can slide in/out.\n */\nexport function repeatKeyed(container, items, keyOf, render, { onEnter, onLeave } = {}) {\n const tpl = template(container);\n if (!tpl) { warn('repeater without a template child', container); return; }\n\n const KEY = dataKey();\n const LEAVING = `data-${cfg.prefix}-leaving`;\n const live = () => [...container.children].filter((n) => n.hasAttribute(KEY) && !n.hasAttribute(LEAVING));\n\n const existing = new Map(live().map((n) => [n.getAttribute(KEY), n]));\n const wanted = [];\n const fresh = new Set();\n\n items.forEach((item, i) => {\n const k = String(keyOf(item, i));\n let node = existing.get(k);\n if (node) existing.delete(k);\n else {\n node = tpl.cloneNode(true);\n node.setAttribute(KEY, k);\n fresh.add(node);\n }\n render(node, item, i, fresh.has(node));\n wanted.push(node);\n });\n\n const staying = wanted.filter((n) => !fresh.has(n));\n const current = live().filter((n) => staying.includes(n));\n const orderOk = current.length === staying.length && current.every((n, i) => n === staying[i]);\n\n if (!orderOk) {\n existing.forEach((n) => n.remove());\n wanted.forEach((n) => container.appendChild(n));\n return;\n }\n\n wanted.forEach((node, i) => {\n if (!fresh.has(node)) return;\n const prev = wanted[i - 1];\n if (prev && prev.parentNode === container) prev.after(node);\n else container.prepend(node);\n if (onEnter) { try { onEnter(node); } catch { /* ignore */ } }\n });\n\n existing.forEach((node) => {\n node.setAttribute(LEAVING, '');\n node.removeAttribute(KEY);\n node.style.pointerEvents = 'none';\n node.inert = true;\n const done = () => node.remove();\n if (onLeave) { try { onLeave(node, done); } catch { done(); } } else done();\n });\n}\n\n// ---------------------------------------------------------------------------\n// Layout notifications: async renders change page height after your\n// page-transition hooks ran. Debounced, then cfg.onLayoutChange or a default.\n// ---------------------------------------------------------------------------\n\nlet layoutTimer = null;\n\nexport function notifyLayoutChanged(reason) {\n clearTimeout(layoutTimer);\n layoutTimer = setTimeout(() => {\n if (typeof cfg.onLayoutChange === 'function') cfg.onLayoutChange(reason);\n else if (window.ScrollTrigger?.refresh) window.ScrollTrigger.refresh();\n emit('layout-changed', { reason });\n }, 120);\n}\n\nexport function watchImages(root, reason) {\n const imgs = qsa(root, 'img').filter((i) => !i.complete);\n if (!imgs.length) return;\n let left = imgs.length;\n const done = () => { if (--left === 0) notifyLayoutChanged(`${reason}:images`); };\n imgs.forEach((img) => {\n img.addEventListener('load', done, { once: true });\n img.addEventListener('error', done, { once: true });\n });\n}\n\nexport function busy(el, fn) {\n if (el.getAttribute('aria-busy') === 'true') return Promise.resolve();\n el.setAttribute('aria-busy', 'true');\n return Promise.resolve().then(fn).finally(() => el.removeAttribute('aria-busy'));\n}\n\nexport function parseJSONAttr(el, name) {\n const raw = el && get(el, name);\n if (!raw) return null;\n try { return JSON.parse(raw); } catch { warn(`invalid JSON in ${attr(name)}`, el); return null; }\n}\n\n/** {a: 1} or [{key, value}] -> [{key, value}] as Shopify wants it. */\nexport function toAttributes(obj) {\n if (!obj) return [];\n if (Array.isArray(obj)) return obj.map((a) => ({ key: String(a.key), value: String(a.value ?? '') }));\n return Object.entries(obj).map(([key, value]) => ({ key, value: String(value ?? '') }));\n}\n", "/**\n * Cart: Shopify Cart API, state in localStorage, document-wide rendering.\n *\n * Every mutation is queued, so fast clicking never races. All public methods\n * return the updated cart.\n */\nimport { cfg, log, reportError } from './config.js';\nimport { gql, unwrap, TetherError } from './client.js';\nimport { cartFragment } from './fragments.js';\nimport { getProduct } from './loader.js';\nimport { allPlans, GID } from './selling-plans.js';\nimport {\n attr, sel, get, qsa, emit, formatMoney, setText, setTextTracked, setImage, show,\n repeat, repeatKeyed, toAttributes, productUrl, notifyLayoutChanged,\n} from './dom.js';\n\n/** Accepts many shapes and returns a Shopify CartLineInput. */\nexport function toLineInput(input, quantity = 1, opts = {}) {\n const src = typeof input === 'object' && input !== null ? input : { variantId: input, quantity, ...opts };\n const merchandiseId = GID.variant(src.merchandiseId || src.variantId || src.id);\n if (!merchandiseId) throw new TetherError('add(): variantId is required');\n const line = { merchandiseId, quantity: Math.max(1, parseInt(src.quantity ?? 1, 10) || 1) };\n const plan = src.sellingPlanId || src.sellingPlan;\n if (plan) line.sellingPlanId = GID.sellingPlan(plan);\n const attrs = toAttributes(src.attributes);\n if (attrs.length) line.attributes = attrs;\n return line;\n}\n\nfunction mutation(name, args, inner) {\n return `mutation Tether_${name}(${args}) {\n ${name}(${inner}) { cart { ...TetherCart } userErrors { field message } }\n}\n${cartFragment()}`;\n}\n\nconst isMissingCart = (err) => /does not exist|not found|invalid id/i.test(err?.message || '');\n\nexport const Cart = {\n state: null,\n _chain: Promise.resolve(),\n\n id() { try { return localStorage.getItem(cfg.storageKey); } catch { return null; } },\n _setId(id) {\n try {\n if (id) localStorage.setItem(cfg.storageKey, id);\n else localStorage.removeItem(cfg.storageKey);\n } catch { /* private mode */ }\n },\n\n get lines() { return this.state?.lines?.nodes || []; },\n get count() { return this.state?.totalQuantity || 0; },\n\n lastError: null,\n\n _queue(fn) {\n const run = this._chain.then(fn, fn).then((value) => {\n if (this.lastError) { this.lastError = null; this.render(); }\n return value;\n }, (err) => {\n // tether-show=\"cart-error\" becomes visible until the next successful cart call.\n this.lastError = err;\n this.render();\n emit('cart-error', { error: err });\n throw err;\n });\n this._chain = run.catch(() => {});\n return run;\n },\n\n _commit(cart, reason) {\n this.state = cart;\n if (cart?.id) this._setId(cart.id);\n this.render();\n emit('cart-updated', { cart, reason });\n return cart;\n },\n\n async init() {\n const id = this.id();\n if (!id) { this.state = null; this.render(); return null; }\n try {\n const data = await gql(`query TetherCart($id: ID!) { cart(id: $id) { ...TetherCart } }\\n${cartFragment()}`, { id });\n if (!data.cart) { this._setId(null); this.state = null; } else this.state = data.cart;\n } catch (err) {\n reportError(err, 'cart load failed');\n this.lastError = err;\n // Keep the cart id on network/API errors: the cart is probably fine, Shopify isn't reachable.\n if (isMissingCart(err)) this._setId(null);\n this.state = null;\n }\n this.render();\n return this.state;\n },\n\n async _create(input = {}) {\n const buyerIdentity = cfg.country ? { countryCode: String(cfg.country).toUpperCase() } : undefined;\n const data = await gql(\n mutation('cartCreate', '$input: CartInput!', 'input: $input'),\n { input: { buyerIdentity, ...input } },\n );\n return unwrap(data.cartCreate, 'cartCreate').cart;\n },\n\n /** Runs a cart mutation; creates a fresh cart if ours expired. */\n async _mutate(name, args, inner, variables, createInput) {\n const cartId = this.id();\n if (!cartId) return createInput ? this._create(createInput) : null;\n try {\n const data = await gql(mutation(name, `$cartId: ID!, ${args}`, `cartId: $cartId, ${inner}`), { ...variables, cartId });\n return unwrap(data[name], name).cart;\n } catch (err) {\n if (createInput && isMissingCart(err)) {\n log('cart expired, creating a new one');\n this._setId(null);\n return this._create(createInput);\n }\n throw err;\n }\n },\n\n /**\n * add('gid://shopify/ProductVariant/1', 2)\n * add({ variantId, quantity, sellingPlanId, attributes })\n * add([line, line]) // bundles / build-a-box in one request\n */\n add(input, quantity = 1, opts = {}) {\n const lines = (Array.isArray(input) ? input : [input]).map((l) => toLineInput(l, quantity, opts));\n return this._queue(async () => {\n const cart = await this._mutate('cartLinesAdd', '$lines: [CartLineInput!]!', 'lines: $lines', { lines }, { lines });\n this._commit(cart, 'add');\n emit('added', { cart, lines });\n if (cfg.openCartOnAdd) this.open();\n return cart;\n });\n },\n\n /**\n * updateLine(lineId, 3)\n * updateLine(lineId, { quantity, sellingPlanId, attributes })\n * sellingPlanId: null switches a line back to one-time purchase.\n */\n updateLine(lineId, patch) {\n const p = typeof patch === 'number' ? { quantity: patch } : { ...patch };\n if (p.quantity !== undefined && p.quantity <= 0) return this.removeLine(lineId);\n\n const line = { id: lineId };\n if (p.quantity !== undefined) line.quantity = p.quantity;\n if ('sellingPlanId' in p) line.sellingPlanId = p.sellingPlanId ? GID.sellingPlan(p.sellingPlanId) : null;\n if (p.attributes) line.attributes = toAttributes(p.attributes);\n if (p.merchandiseId || p.variantId) line.merchandiseId = GID.variant(p.merchandiseId || p.variantId);\n\n return this._queue(async () => this._commit(\n await this._mutate('cartLinesUpdate', '$lines: [CartLineUpdateInput!]!', 'lines: $lines', { lines: [line] }),\n 'update',\n ));\n },\n\n removeLine(lineIds) {\n const ids = Array.isArray(lineIds) ? lineIds : [lineIds];\n return this._queue(async () => this._commit(\n await this._mutate('cartLinesRemove', '$lineIds: [ID!]!', 'lineIds: $lineIds', { lineIds: ids }),\n 'remove',\n ));\n },\n\n clear() {\n const ids = this.lines.map((l) => l.id);\n if (!ids.length) return Promise.resolve(this.state);\n return this.removeLine(ids);\n },\n\n setNote(note) {\n return this._queue(async () => this._commit(\n await this._mutate('cartNoteUpdate', '$note: String!', 'note: $note', { note: note ?? '' }, { note: note ?? '' }),\n 'note',\n ));\n },\n\n /** Cart-level attributes, merged with existing ones. Value '' removes a key. */\n setAttributes(obj) {\n const merged = new Map((this.state?.attributes || []).map((a) => [a.key, a.value]));\n toAttributes(obj).forEach((a) => merged.set(a.key, a.value));\n const attributes = [...merged].filter(([, v]) => v !== '').map(([key, value]) => ({ key, value }));\n return this._queue(async () => this._commit(\n await this._mutate('cartAttributesUpdate', '$attributes: [AttributeInput!]!', 'attributes: $attributes', { attributes }, { attributes }),\n 'attributes',\n ));\n },\n\n /** Replaces the discount codes. Pass [] to remove all. */\n setDiscountCodes(codes) {\n const discountCodes = (Array.isArray(codes) ? codes : [codes]).map((c) => String(c).trim()).filter(Boolean);\n return this._queue(async () => this._commit(\n await this._mutate('cartDiscountCodesUpdate', '$discountCodes: [String!]!', 'discountCodes: $discountCodes', { discountCodes }, { discountCodes }),\n 'discount',\n ));\n },\n\n applyDiscount(code) {\n const current = (this.state?.discountCodes || []).map((d) => d.code);\n return this.setDiscountCodes([...new Set([...current, code])]);\n },\n\n removeDiscount(code) {\n return this.setDiscountCodes((this.state?.discountCodes || []).map((d) => d.code).filter((c) => c !== code));\n },\n\n /** { countryCode, email, phone } \u2014 changes currency/prices for that market. */\n setBuyerIdentity(buyerIdentity, { create = true } = {}) {\n return this._queue(async () => {\n const cart = await this._mutate('cartBuyerIdentityUpdate', '$buyerIdentity: CartBuyerIdentityInput!', 'buyerIdentity: $buyerIdentity', { buyerIdentity }, create ? { buyerIdentity } : null)\n .catch((err) => {\n if (create || !isMissingCart(err)) throw err;\n this._setId(null); // expired cart: forget it instead of creating an empty one\n return null;\n });\n return this._commit(cart, 'buyer-identity');\n });\n },\n\n /**\n * Goes to Shopify checkout. With checkoutTarget '_blank' the tab is opened\n * inside the click (Safari blocks window.open after an await) and gets its\n * URL once we have it.\n */\n async checkout(target = cfg.checkoutTarget) {\n const id = this.id();\n if (!id) return null;\n const tab = target === '_blank' ? window.open('', '_blank') : null;\n if (tab) { try { tab.opener = null; } catch { /* ignore */ } }\n\n try {\n const data = await gql('query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }', { id });\n const url = data.cart?.checkoutUrl;\n if (!url) throw new TetherError('No checkoutUrl (cart empty or expired)');\n emit('checkout', { url, cart: this.state });\n if (tab && !tab.closed) tab.location.href = url;\n else window.location.href = url;\n return url;\n } catch (err) {\n if (tab) tab.close();\n reportError(err, 'checkout failed');\n return null;\n }\n },\n\n // -------------------------------------------------------------- drawer\n\n drawers() { return qsa(document, sel('cart-drawer')); },\n\n isOpen() { return this.drawers().some((d) => d.classList.contains(cfg.cartDrawerOpenClass)); },\n\n open() {\n if (this.isOpen()) return;\n const ds = this.drawers().filter((d) => get(d, 'cart-drawer') !== 'manual');\n ds.forEach((d) => { d.classList.add(cfg.cartDrawerOpenClass); d.setAttribute('aria-hidden', 'false'); });\n if (typeof cfg.onCartOpen === 'function') cfg.onCartOpen(ds);\n emit('cart-toggled', { open: true });\n },\n\n close() {\n if (!this.isOpen()) return;\n const ds = this.drawers();\n ds.forEach((d) => { d.classList.remove(cfg.cartDrawerOpenClass); d.setAttribute('aria-hidden', 'true'); });\n if (typeof cfg.onCartClose === 'function') cfg.onCartClose(ds);\n emit('cart-toggled', { open: false });\n },\n\n toggle() { if (this.isOpen()) this.close(); else this.open(); },\n\n // -------------------------------------------------------------- render\n\n render() {\n const cart = this.state;\n const count = cart ? cart.totalQuantity : 0;\n const money = (k) => (cart ? formatMoney(cart.cost?.[k]) : '');\n\n qsa(document, sel('cart-count')).forEach((el) => setTextTracked(el, count));\n qsa(document, sel('cart-subtotal')).forEach((el) => setTextTracked(el, money('subtotalAmount')));\n qsa(document, sel('cart-total')).forEach((el) => setTextTracked(el, money('totalAmount')));\n qsa(document, sel('cart-checkout-charge')).forEach((el) => setTextTracked(el, money('checkoutChargeAmount')));\n\n const hasSub = this.lines.some((l) => l.sellingPlanAllocation);\n const conds = {\n 'cart-empty': count === 0,\n 'cart-filled': count > 0,\n 'cart-has-subscription': hasSub,\n 'cart-no-subscription': !hasSub,\n 'cart-has-discount': (cart?.discountCodes || []).some((d) => d.applicable),\n 'cart-error': Boolean(this.lastError),\n };\n qsa(document, sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (k in conds && !el.closest(sel('product'))) show(el, conds[k]);\n });\n\n qsa(document, `textarea${sel('cart-note')},input${sel('cart-note')}`).forEach((el) => {\n if (document.activeElement !== el) el.value = cart?.note || '';\n });\n\n qsa(document, sel('cart-discounts')).forEach((container) => {\n repeat(container, cart?.discountCodes || [], (node, d) => {\n node.setAttribute(attr('discount-code'), d.code);\n const t = node.querySelector(sel('discount', 'code')) || (node.firstElementChild ? null : node);\n if (t) setText(t, d.code);\n node.classList.toggle('is-inapplicable', !d.applicable);\n });\n });\n\n qsa(document, sel('cart-lines')).forEach((container) => {\n repeatKeyed(container, this.lines, (l) => l.id, (node, line) => renderLine(node, line), {\n onEnter: cfg.onLineEnter, onLeave: cfg.onLineLeave,\n });\n });\n\n if (cart) notifyLayoutChanged('cart');\n },\n};\n\nfunction lineValue(line, key) {\n const m = line.merchandise || {};\n const plan = line.sellingPlanAllocation?.sellingPlan;\n switch (key) {\n case 'title': return m.product?.title;\n case 'product-title': return m.product?.title;\n case 'variant-title': return m.title === 'Default Title' ? '' : m.title;\n case 'options': return (m.selectedOptions || [])\n .filter((o) => o.value !== 'Default Title').map((o) => `${o.name}: ${o.value}`).join(', ');\n case 'vendor': return m.product?.vendor;\n case 'sku': return m.sku;\n case 'price': return formatMoney(line.cost?.amountPerQuantity || m.price);\n case 'compare-at-price': return formatMoney(line.cost?.compareAtAmountPerQuantity || m.compareAtPrice);\n case 'line-total': return formatMoney(line.cost?.totalAmount);\n case 'line-subtotal': return formatMoney(line.cost?.subtotalAmount);\n case 'quantity': return line.quantity;\n case 'plan': return plan?.name || '';\n case 'plan-description': return plan?.description || '';\n case 'components': return (line.lineComponents || [])\n .map((c) => `${c.quantity} \u00D7 ${c.merchandise?.product?.title || ''}`).join(', ');\n default:\n if (key.startsWith('attribute:')) {\n const k = key.slice('attribute:'.length);\n return (line.attributes || []).find((a) => a.key === k)?.value || '';\n }\n return undefined;\n }\n}\n\nfunction renderLine(node, line) {\n const m = line.merchandise || {};\n const isSub = Boolean(line.sellingPlanAllocation);\n node.setAttribute(attr('line-id'), line.id);\n node.classList.toggle('is-subscription', isSub);\n\n qsa(node, sel('line')).forEach((el) => {\n const key = get(el, 'line');\n if (key === 'image') return setImage(el, m.image?.url || m.product?.featuredImage?.url, m.product?.title);\n if (key === 'url') return el.setAttribute('href', productUrl(m.product?.handle, m.product?.id));\n const v = lineValue(line, key);\n if (v !== undefined) setTextTracked(el, v);\n return undefined;\n });\n\n const lineConds = {\n subscription: isSub,\n 'one-time': !isSub,\n 'on-sale': parseFloat(line.cost?.compareAtAmountPerQuantity?.amount) > parseFloat(line.cost?.amountPerQuantity?.amount),\n 'has-components': (line.lineComponents || []).length > 0,\n };\n qsa(node, sel('line-show')).forEach((el) => {\n const k = get(el, 'line-show');\n if (k in lineConds) show(el, lineConds[k]);\n });\n\n // Change frequency in the cart: <select tether-line-plan> lists the product's plans.\n qsa(node, `select${sel('line-plan')}`).forEach((select) => {\n const handle = m.product?.handle;\n if (!handle) return;\n getProduct(handle).then((product) => {\n const plans = allPlans(product);\n const allowOneTime = !product.requiresSellingPlan && get(select, 'line-plan') !== 'subscription-only';\n const want = [\n ...(allowOneTime ? [{ value: '', label: select.getAttribute(attr('one-time-label')) || 'One-time purchase' }] : []),\n ...plans.map((p) => ({ value: p.id, label: p.name })),\n ];\n const sig = want.map((w) => w.value).join('|');\n if (select.dataset.tetherSig !== sig) {\n select.innerHTML = '';\n want.forEach((w) => {\n const o = document.createElement('option');\n o.value = w.value; o.textContent = w.label;\n select.appendChild(o);\n });\n select.dataset.tetherSig = sig;\n }\n select.value = line.sellingPlanAllocation?.sellingPlan?.id || '';\n show(select, plans.length > 0);\n }).catch((err) => reportError(err, 'line plan options'));\n });\n}\n\n", "/**\n * Where a product scope gets its key from, and the loading / ready / error /\n * not-found state of a scope (so a failing API never leaves a broken page).\n */\nimport { attr, sel, get, scoped, show } from './dom.js';\n\n/**\n * tether-product values:\n * \"coffee-box\" handle, numeric id, gid or product URL (as before)\n * \"url:handle\" ?handle=... from the page URL (any param name: \"url:p\" -> ?p=)\n * \"url:path\" the last segment of the page path (/shop/coffee-box -> coffee-box)\n * Returns { key, fromUrl, raw }. key is null when the URL has no value.\n */\nexport function resolveProductKey(el, location = window.location) {\n const raw = (get(el, 'product') || '').trim();\n if (!raw.toLowerCase().startsWith('url:')) return { key: raw || null, fromUrl: false, raw };\n const what = raw.slice(4).trim();\n let key = null;\n if (what.toLowerCase() === 'path') {\n const parts = location.pathname.split('/').filter(Boolean);\n key = parts.length ? safeDecode(parts[parts.length - 1]) : null;\n } else {\n key = new URLSearchParams(location.search).get(what || 'handle');\n }\n key = key && key.trim() ? key.trim() : null;\n return { key, fromUrl: true, raw };\n}\n\nfunction safeDecode(s) { try { return decodeURIComponent(s); } catch { return s; } }\n\n/** Values of tether-show that follow the scope state. */\nexport const STATUS_KEYS = ['loading', 'ready', 'error', 'not-found'];\n\nexport const isNotFound = (err) => err?.code === 'NOT_FOUND';\n\n/** Product scopes and lists both own their state elements; the nearest one wins. */\nexport const boundary = () => ['product', 'collection', 'products', 'recommendations'].map((n) => sel(n)).join(',');\n\n/** True when `el` belongs to the scope `root` (not to a nested product or list). */\nexport const ownedBy = (el, root) => el === root || el.parentElement?.closest(boundary()) === root;\n\n/**\n * Sets tether-state (loading | ready | error) and tether-error (not-found or an\n * error code) on `root`, toggles tether-show=\"loading|ready|error|not-found\"\n * inside it, and disables add-to-cart buttons when there's no product.\n */\nexport function setScopeStatus(root, status, err) {\n const notFound = status === 'not-found';\n root.setAttribute(attr('state'), notFound ? 'error' : status);\n if (status === 'error' || notFound) root.setAttribute(attr('error'), notFound ? 'not-found' : (err?.code || 'error'));\n else root.removeAttribute(attr('error'));\n\n scoped(root, sel('show'), boundary()).forEach((el) => {\n const k = get(el, 'show');\n if (!STATUS_KEYS.includes(k)) return;\n const visible = k === status;\n show(el, visible);\n // Blocks hidden by a Webflow class (display: none) still need to appear.\n if (visible && typeof getComputedStyle === 'function' && getComputedStyle(el).display === 'none') {\n el.style.display = el.getAttribute(attr('display')) || 'block';\n }\n });\n\n if (status === 'error' || notFound) {\n scoped(root, sel('add-to-cart'), boundary()).forEach((btn) => {\n btn.classList.add('is-disabled');\n if ('disabled' in btn) btn.disabled = true;\n });\n }\n}\n", "/**\n * ProductScope: everything inside [tether-product=\"<handle>\"] binds to one\n * Shopify product: options, variants, quantity, subscriptions, add to cart.\n */\nimport { cfg, reportError } from './config.js';\nimport {\n attr, sel, get, has, qsa, scoped, emit, formatMoney, formatDate, setText, setImage, show,\n setSelected, repeat, productUrl, notifyLayoutChanged, watchImages, busy, parseJSONAttr, toAttributes,\n} from './dom.js';\nimport { Cart } from './cart.js';\nimport { STATUS_KEYS, ownedBy } from './status.js';\nimport {\n allPlans, allocationFor, planPrice, planCheckoutCharge, planSavings, planAdjustment, findPlan, GID,\n} from './selling-plans.js';\n\nexport const scopes = new WeakMap(); // element -> ProductScope\n\nconst productSel = () => sel('product');\n\nfunction metafieldValue(product, ref) {\n const i = ref.indexOf('.');\n const ns = ref.slice(0, i);\n const key = ref.slice(i + 1);\n const mf = (product.metafields || []).find((m) => m && m.namespace === ns && m.key === key);\n return mf || null;\n}\n\nexport class ProductScope {\n constructor(root, product) {\n this.root = root;\n this.product = product;\n this.selected = {};\n this.variant = null;\n this.quantity = Math.max(0, parseInt(get(root, 'quantity') ?? '1', 10) || (has(root, 'quantity') ? 0 : 1));\n this.plans = allPlans(product);\n this.purchase = 'one-time';\n this.planId = null;\n\n scopes.set(root, this);\n root.setAttribute(attr('state'), 'ready');\n root.removeAttribute(attr('error'));\n\n this.initSelection();\n this.initPurchase();\n this.renderProduct();\n this.bind();\n this.renderVariant();\n\n watchImages(root, 'product');\n notifyLayoutChanged('product');\n emit('product-ready', { product, scope: this }, root);\n }\n\n /** New data for the same product (e.g. after a country switch). Keeps the selection. */\n update(product) {\n const variantId = this.variant?.id;\n this.product = product;\n this.plans = allPlans(product);\n if (this.planId && !this.plans.some((p) => p.id === this.planId)) this.planId = this.plans[0]?.id || null;\n if (!this.plans.length && this.purchase === 'subscription') this.purchase = 'one-time';\n const v = product.variants.nodes.find((x) => x.id === variantId);\n if (v) { this.selected = {}; v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; }); }\n this.root.setAttribute(attr('state'), 'ready');\n this.root.removeAttribute(attr('error'));\n this.renderProduct();\n this.renderVariant();\n notifyLayoutChanged('product');\n emit('product-updated', { product, scope: this }, this.root);\n }\n\n /** Matching elements in this scope, including the root itself (e.g. a card link with tether-bind=\"link\"). */\n $(s) {\n const inner = scoped(this.root, s, productSel());\n return this.root.matches(s) ? [this.root, ...inner] : inner;\n }\n\n // ------------------------------------------------------------ state\n\n initSelection() {\n const vs = this.product.variants.nodes;\n const first = vs.find((v) => v.availableForSale) || vs[0];\n if (first) first.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n\n const param = new URLSearchParams(window.location.search).get('variant') || get(this.root, 'variant');\n if (param) {\n const gid = GID.variant(param);\n const match = vs.find((v) => v.id === gid);\n if (match) {\n this.selected = {};\n match.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n }\n }\n }\n\n initPurchase() {\n if (!this.plans.length) return;\n const params = new URLSearchParams(window.location.search);\n const fromUrl = findPlan(this.product, params.get('selling_plan'));\n const fromAttr = findPlan(this.product, get(this.root, 'default-plan'));\n this.planId = (fromUrl || fromAttr || this.plans[0]).id;\n\n const wanted = fromUrl ? 'subscription' : (get(this.root, 'default-purchase') || cfg.defaultPurchase);\n this.purchase = this.product.requiresSellingPlan || wanted === 'subscription' ? 'subscription' : 'one-time';\n }\n\n findVariant() {\n return this.product.variants.nodes.find((v) =>\n v.selectedOptions.every((o) => this.selected[o.name] === o.value)) || null;\n }\n\n isValueAvailable(name, value) {\n return this.product.variants.nodes.some((v) =>\n v.availableForSale && v.selectedOptions.every((o) =>\n (o.name === name ? o.value === value : this.selected[o.name] === o.value)));\n }\n\n get plan() { return this.plans.find((p) => p.id === this.planId) || null; }\n\n /** True when the current variant can be bought on the selected plan. */\n get subscriptionAvailable() {\n return Boolean(this.variant && this.plans.some((p) => allocationFor(this.variant, p.id)));\n }\n\n get isSubscription() {\n return this.purchase === 'subscription' && Boolean(allocationFor(this.variant, this.planId));\n }\n\n /** What would be added to the cart right now. */\n getLine() {\n if (!this.variant) return null;\n const line = { merchandiseId: this.variant.id, quantity: this.quantity };\n if (this.isSubscription) line.sellingPlanId = this.planId;\n const attrs = this.collectAttributes();\n if (attrs.length) line.attributes = attrs;\n return line;\n }\n\n collectAttributes() {\n const fixed = toAttributes(parseJSONAttr(this.root, 'line-attributes'));\n const inputs = this.$(sel('line-attribute')).map((el) => {\n const key = get(el, 'line-attribute');\n let value;\n if (el.type === 'checkbox') value = el.checked ? (el.value && el.value !== 'on' ? el.value : 'Yes') : '';\n else if (el.type === 'radio') value = el.checked ? el.value : null;\n else value = el.value;\n return value == null || value === '' ? null : { key, value: String(value) };\n }).filter(Boolean);\n return [...fixed, ...inputs];\n }\n\n // ------------------------------------------------------------ actions\n\n select(name, value) {\n if (this.selected[name] === value) return;\n this.selected[name] = value;\n this.renderVariant();\n }\n\n selectVariant(id) {\n const v = this.product.variants.nodes.find((x) => x.id === GID.variant(id));\n if (!v) return;\n this.selected = {};\n v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n this.renderVariant();\n }\n\n setPurchase(mode) {\n const next = mode === 'subscription' ? 'subscription' : 'one-time';\n if (next === 'one-time' && this.product.requiresSellingPlan) return;\n if (this.purchase === next) return;\n this.purchase = next;\n this.renderVariant();\n }\n\n selectPlan(ref) {\n const p = findPlan(this.product, ref);\n if (!p) return;\n this.planId = p.id;\n this.purchase = 'subscription';\n this.renderVariant();\n }\n\n setQuantity(n) {\n const min = has(this.root, 'quantity') ? 0 : 1;\n this.quantity = Math.max(min, parseInt(n, 10) || 0);\n this.$(sel('qty')).forEach((i) => setText(i, this.quantity));\n this.renderVariant();\n }\n\n async addToCart() {\n if (!this.variant?.availableForSale) return null;\n const line = this.getLine();\n if (!line || line.quantity < 1) return null;\n const cart = await Cart.add(line);\n emit('product-added', { product: this.product, variant: this.variant, line }, this.root);\n return cart;\n }\n\n // ------------------------------------------------------------ events\n\n bind() {\n const own = (el) => el && el.closest(productSel()) === this.root;\n\n this.root.addEventListener('click', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n\n const opt = t.closest(sel('option-value'));\n if (own(opt) && opt.closest(sel('option-list'))) {\n e.preventDefault();\n this.select(get(opt.closest(sel('option-list')), 'option-list'), get(opt, 'option-value'));\n return;\n }\n\n const plan = t.closest(sel('plan-value'));\n if (own(plan)) { e.preventDefault(); this.selectPlan(get(plan, 'plan-value')); return; }\n\n const purchase = t.closest(`${sel('purchase')}:not(select)`);\n if (own(purchase)) {\n if (purchase.tagName !== 'INPUT') e.preventDefault();\n this.setPurchase(get(purchase, 'purchase'));\n return;\n }\n\n const plus = t.closest(sel('qty-plus'));\n if (own(plus)) { e.preventDefault(); this.setQuantity(this.quantity + 1); return; }\n const minus = t.closest(sel('qty-minus'));\n if (own(minus)) { e.preventDefault(); this.setQuantity(this.quantity - 1); return; }\n\n const add = t.closest(sel('add-to-cart'));\n if (own(add)) { e.preventDefault(); this.onAddClick(add); }\n });\n\n this.root.addEventListener('change', (e) => {\n const t = e.target;\n if (!own(t)) return;\n if (t.matches(`select${sel('option')}`)) this.select(get(t, 'option'), t.value);\n else if (t.matches(`select${sel('variant-select')}`)) this.selectVariant(t.value);\n else if (t.matches(`select${sel('plan')}`)) {\n if (t.value) this.selectPlan(t.value); else this.setPurchase('one-time');\n } else if (t.matches(`select${sel('purchase')}`)) this.setPurchase(t.value);\n else if (t.matches(sel('qty'))) this.setQuantity(t.value);\n });\n }\n\n onAddClick(btn) {\n const label = btn.querySelector(sel('add-label')) || btn;\n const busyText = get(btn, 'adding-text');\n const write = (txt) => setText(label, txt);\n if (label.dataset.tetherLabel === undefined) label.dataset.tetherLabel = label.tagName === 'INPUT' ? label.value : label.textContent;\n\n busy(btn, async () => {\n if (busyText) write(busyText);\n try { await this.addToCart(); } catch (err) {\n reportError(err, 'add to cart failed');\n emit('error', { error: err, context: 'add-to-cart' }, this.root);\n } finally {\n if (busyText) write(label.dataset.tetherLabel);\n }\n }).then(() => {\n // Restore mode-dependent labels (subscribe-text / soldout-text) after aria-busy is cleared.\n this.renderVariant();\n });\n }\n\n // ------------------------------------------------------------ render\n\n renderProduct() {\n const p = this.product;\n\n this.$(sel('bind')).forEach((el) => {\n const key = get(el, 'bind');\n switch (key) {\n case 'title': return setText(el, p.title);\n case 'description': el.innerHTML = p.descriptionHtml || ''; return undefined;\n case 'description-text': return setText(el, p.description);\n case 'vendor': return setText(el, p.vendor);\n case 'type': return setText(el, p.productType);\n case 'handle': return setText(el, p.handle);\n case 'published-at': return setText(el, formatDate(p.publishedAt));\n case 'min-price': return setText(el, formatMoney(p.priceRange.minVariantPrice));\n case 'max-price': return setText(el, formatMoney(p.priceRange.maxVariantPrice));\n case 'featured-image': return setImage(el, p.featuredImage?.url, p.featuredImage?.altText || p.title);\n case 'url':\n case 'link':\n el.setAttribute('href', productUrl(p.handle, p.id));\n if (key === 'url' && !el.firstElementChild && !el.textContent.trim()) setText(el, p.title);\n return undefined;\n case 'images':\n return repeat(el, p.images.nodes, (node, img) => {\n const target = node.matches(`img,${sel('bind', 'image')}`) ? node : node.querySelector('img') || node;\n setImage(target, img.url, img.altText || p.title);\n });\n case 'tags': {\n const exclude = (el.getAttribute('exclude') || '').split(',').map((s) => s.trim()).filter(Boolean);\n return repeat(el, p.tags.filter((t) => !exclude.includes(t)), (node, tag) => setText(node, tag));\n }\n default:\n // image:2 = the second product image (falls back to the featured image)\n if (key && /^image:\\d+$/.test(key)) {\n const img = p.images.nodes[parseInt(key.slice(6), 10) - 1] || p.featuredImage;\n return setImage(el, img?.url, img?.altText || p.title);\n }\n if (key && key.startsWith('metafield:')) {\n const mf = metafieldValue(p, key.slice('metafield:'.length));\n if (!mf) return setText(el, '');\n if (mf.reference?.image) return setImage(el, mf.reference.image.url, mf.reference.image.altText);\n if (mf.type === 'rich_text_field' || mf.type === 'multi_line_text_field') {\n el.textContent = mf.value; el.style.whiteSpace = 'pre-line'; return undefined;\n }\n return setText(el, mf.value);\n }\n return undefined;\n }\n });\n\n this.$(sel('option-list')).forEach((container) => {\n const name = get(container, 'option-list');\n const opt = p.options.find((o) => o.name === name);\n if (!opt || (opt.optionValues.length <= 1 && has(container, 'hide-single'))) return show(container, false);\n return repeat(container, opt.optionValues, (node, v) => {\n node.setAttribute(attr('option-value'), v.name);\n const t = node.querySelector(sel('bind', 'option-value'));\n if (t) setText(t, v.name); else if (!node.firstElementChild) setText(node, v.name);\n const sw = node.querySelector(sel('bind', 'swatch'));\n if (sw && v.swatch?.color) sw.style.backgroundColor = v.swatch.color;\n if (sw && v.swatch?.image?.previewImage) setImage(sw, v.swatch.image.previewImage.url, v.name);\n });\n });\n\n this.$(`select${sel('option')}`).forEach((s) => {\n const opt = p.options.find((o) => o.name === get(s, 'option'));\n if (!opt) return show(s, false);\n s.innerHTML = '';\n opt.optionValues.forEach((v) => s.appendChild(new Option(v.name, v.name)));\n return undefined;\n });\n\n this.$(`select${sel('variant-select')}`).forEach((s) => {\n s.innerHTML = '';\n p.variants.nodes.forEach((v) => s.appendChild(new Option(v.title, v.id)));\n });\n\n // Subscriptions\n this.$(sel('plan-list')).forEach((container) => {\n // Value = selling plan group name. Empty, \"true\", \"all\" or \"*\" = every plan\n // (Webflow's Designer doesn't always allow empty attribute values).\n const raw = (get(container, 'plan-list') || '').trim();\n const group = ['', 'true', 'all', '*'].includes(raw.toLowerCase()) ? null : raw;\n const plans = this.plans.filter((pl) => !group || pl.group.name === group);\n repeat(container, plans, (node, plan) => {\n node.setAttribute(attr('plan-value'), plan.id);\n if (!node.firstElementChild && !node.querySelector(sel('plan-bind'))) setText(node, plan.name);\n });\n });\n\n this.$(`select${sel('plan')}`).forEach((s) => {\n s.innerHTML = '';\n if (!p.requiresSellingPlan && get(s, 'plan') !== 'subscription-only') {\n s.appendChild(new Option(s.getAttribute(attr('one-time-label')) || 'One-time purchase', ''));\n }\n this.plans.forEach((pl) => s.appendChild(new Option(pl.name, pl.id)));\n });\n }\n\n renderVariant() {\n const p = this.product;\n let v = this.findVariant();\n if (!v) {\n [v] = p.variants.nodes;\n if (v) {\n this.selected = {};\n v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n }\n }\n this.variant = v;\n if (!v) return;\n\n // A plan the variant isn't in -> pick the first one it is in.\n if (this.plans.length && !allocationFor(v, this.planId)) {\n const alt = this.plans.find((pl) => allocationFor(v, pl.id));\n if (alt) this.planId = alt.id;\n }\n\n const sub = this.isSubscription;\n const oneTimePrice = v.price;\n const subPrice = this.planId ? planPrice(v, this.planId) : null;\n const price = sub ? subPrice : oneTimePrice;\n const compareAt = sub ? (allocationFor(v, this.planId)?.priceAdjustments?.[0]?.compareAtPrice || v.compareAtPrice) : v.compareAtPrice;\n const onSale = compareAt && parseFloat(compareAt.amount) > parseFloat(price.amount);\n const discountPct = onSale ? Math.round((1 - parseFloat(price.amount) / parseFloat(compareAt.amount)) * 100) : 0;\n const savings = this.planId ? planSavings(v, this.planId) : { amount: null, percentage: 0 };\n const plan = this.plan;\n const total = { amount: (parseFloat(price.amount) * Math.max(1, this.quantity)).toFixed(2), currencyCode: price.currencyCode };\n\n this.$(sel('bind')).forEach((el) => {\n switch (get(el, 'bind')) {\n case 'price': return setText(el, formatMoney(price));\n case 'total-price': return setText(el, formatMoney(total));\n case 'one-time-price': return setText(el, formatMoney(oneTimePrice));\n case 'subscription-price': return setText(el, formatMoney(subPrice));\n case 'subscription-savings': return setText(el, savings.percentage ? `${savings.percentage}%` : '');\n case 'subscription-savings-amount': return setText(el, formatMoney(savings.amount));\n case 'checkout-charge': return setText(el, formatMoney(sub ? planCheckoutCharge(v, this.planId) : price));\n case 'plan-name': return setText(el, plan?.name || '');\n case 'plan-description': return setText(el, plan?.description || '');\n case 'plan-group': return setText(el, plan?.group?.name || '');\n case 'compare-at-price': return setText(el, onSale ? formatMoney(compareAt) : '');\n case 'unit-price': return setText(el, formatMoney(v.unitPrice));\n case 'discount-percentage': return setText(el, `${discountPct}%`);\n case 'discount-amount':\n return setText(el, onSale ? formatMoney({\n amount: String(parseFloat(compareAt.amount) - parseFloat(price.amount)),\n currencyCode: price.currencyCode,\n }) : '');\n case 'variant-title': return setText(el, v.title);\n case 'variant-id': return setText(el, v.id);\n case 'sku': return setText(el, v.sku);\n case 'barcode': return setText(el, v.barcode);\n case 'stock': return setText(el, v.quantityAvailable ?? '');\n case 'quantity': return setText(el, this.quantity);\n case 'variant-image': return setImage(el, v.image?.url || p.featuredImage?.url, v.image?.altText || p.title);\n default: return undefined;\n }\n });\n\n this.$(sel('option-selected')).forEach((el) => setText(el, this.selected[get(el, 'option-selected')] || ''));\n\n this.$(sel('option-list')).forEach((container) => {\n const name = get(container, 'option-list');\n qsa(container, sel('option-value')).forEach((node) => {\n const value = get(node, 'option-value');\n setSelected(node, this.selected[name] === value);\n const unavailable = !this.isValueAvailable(name, value);\n node.classList.toggle('is-unavailable', unavailable);\n node.setAttribute('data-unavailable', unavailable ? 'true' : 'false');\n });\n });\n\n this.$(`select${sel('option')}`).forEach((s) => { s.value = this.selected[get(s, 'option')] || ''; });\n this.$(`select${sel('variant-select')}`).forEach((s) => { s.value = v.id; });\n\n // Subscription UI\n this.$(sel('purchase')).forEach((el) => {\n if (el.tagName === 'SELECT') { el.value = this.purchase; return; }\n const mode = get(el, 'purchase');\n setSelected(el, mode === this.purchase);\n const unavailable = mode === 'subscription' ? !this.subscriptionAvailable : p.requiresSellingPlan;\n el.classList.toggle('is-unavailable', unavailable);\n });\n\n this.$(sel('plan-value')).forEach((node) => {\n const id = get(node, 'plan-value');\n const planObj = this.plans.find((pl) => pl.id === id);\n const inVariant = Boolean(allocationFor(v, id));\n setSelected(node, sub && id === this.planId);\n node.classList.toggle('is-unavailable', !inVariant);\n qsa(node, sel('plan-bind')).forEach((el) => {\n const adj = planAdjustment(planObj);\n const s = planSavings(v, id);\n switch (get(el, 'plan-bind')) {\n case 'name': return setText(el, planObj?.name);\n case 'description': return setText(el, planObj?.description || '');\n case 'price': return setText(el, formatMoney(planPrice(v, id)));\n case 'savings': return setText(el, s.percentage ? `${s.percentage}%` : '');\n case 'savings-amount': return setText(el, formatMoney(s.amount));\n case 'adjustment':\n if (!adj) return setText(el, '');\n return setText(el, adj.type === 'percentage' ? `${adj.value}%` : formatMoney(adj.value));\n default: return undefined;\n }\n });\n });\n\n this.$(`select${sel('plan')}`).forEach((s) => { s.value = sub ? this.planId : ''; });\n\n const conds = {\n 'in-stock': v.availableForSale,\n 'out-of-stock': !v.availableForSale,\n 'backorder': v.availableForSale && v.currentlyNotInStock,\n 'on-sale': Boolean(onSale),\n 'not-on-sale': !onSale,\n 'has-variants': p.variants.nodes.length > 1,\n 'single-variant': p.variants.nodes.length === 1,\n 'low-stock': v.quantityAvailable != null && v.quantityAvailable > 0 && v.quantityAvailable <= 5,\n 'subscription-available': this.subscriptionAvailable,\n 'subscription-unavailable': !this.subscriptionAvailable,\n 'subscription-only': Boolean(p.requiresSellingPlan),\n 'one-time-available': !p.requiresSellingPlan,\n 'subscription-selected': sub,\n 'one-time-selected': !sub,\n 'has-savings': sub ? savings.percentage > 0 : Boolean(onSale),\n // scope state (see status.js)\n 'loading': false,\n 'ready': true,\n 'error': false,\n 'not-found': false,\n };\n this.$(sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (!(k in conds)) return;\n // State blocks of a list nested in this product belong to that list.\n if (STATUS_KEYS.includes(k) && !ownedBy(el, this.root)) return;\n show(el, conds[k]);\n });\n\n this.root.classList.toggle('is-subscription', sub);\n this.root.setAttribute(attr('purchase-mode'), sub ? 'subscription' : 'one-time');\n\n this.$(sel('add-to-cart')).forEach((btn) => {\n const disabled = !v.availableForSale;\n btn.classList.toggle('is-disabled', disabled);\n if ('disabled' in btn) btn.disabled = disabled;\n const soldOut = get(btn, 'soldout-text');\n const subText = get(btn, 'subscribe-text');\n if (soldOut || subText) {\n const label = btn.querySelector(sel('add-label')) || btn;\n if (label.dataset.tetherLabel === undefined) label.dataset.tetherLabel = label.tagName === 'INPUT' ? label.value : label.textContent;\n let text = label.dataset.tetherLabel;\n if (sub && subText) text = subText;\n if (disabled && soldOut) text = soldOut;\n if (btn.getAttribute('aria-busy') !== 'true') setText(label, text);\n }\n });\n\n emit('variant-changed', {\n product: p, variant: v, selected: { ...this.selected },\n purchase: this.purchase, sellingPlanId: sub ? this.planId : null,\n }, this.root);\n }\n}\n", "/**\n * Product lists: [tether-collection=\"handle\"] or [tether-products=\"search query\"].\n * The first child of [tether-list] is the card template; every card becomes a\n * product scope, so all product attributes work inside cards (including\n * quick-add with a subscription toggle).\n */\nimport { reportError } from './config.js';\nimport { attr, sel, get, has, scoped, emit, setText, setImage, repeat, notifyLayoutChanged, busy } from './dom.js';\nimport { getProducts, getRecommendations, getProduct } from './loader.js';\nimport { setScopeStatus, isNotFound } from './status.js';\n\nexport const listSelector = () => `${sel('collection')},${sel('products')},${sel('recommendations')}`;\n\nexport class ListScope {\n constructor(root) {\n this.root = root;\n this.products = [];\n this.pageInfo = null;\n this.collection = null;\n setScopeStatus(root, 'loading');\n root.addEventListener('click', (e) => {\n const more = e.target.closest?.(sel('load-more'));\n if (more && more.closest(listSelector()) === root) {\n e.preventDefault();\n busy(more, () => this.load(true));\n }\n });\n }\n\n $(s) { return scoped(this.root, s, listSelector()); }\n\n options() {\n const r = this.root;\n const opts = {\n first: parseInt(get(r, 'limit') || '', 10) || undefined,\n sortKey: get(r, 'sort') || undefined,\n reverse: get(r, 'reverse') === 'true',\n };\n if (has(r, 'collection')) opts.collection = get(r, 'collection');\n else opts.query = get(r, 'products') || '';\n return opts;\n }\n\n async load(more = false) {\n const token = (this.loadToken = (this.loadToken || 0) + 1);\n const stale = () => token !== this.loadToken;\n try {\n if (has(this.root, 'recommendations')) {\n const key = get(this.root, 'recommendations');\n const base = await getProduct(key);\n const recs = await getRecommendations(base.id, get(this.root, 'intent') || 'RELATED');\n if (stale()) return;\n const limit = parseInt(get(this.root, 'limit') || '', 10);\n this.products = limit ? recs.slice(0, limit) : recs;\n } else {\n const res = await getProducts({ ...this.options(), after: more ? this.pageInfo?.endCursor : null });\n if (stale()) return;\n this.collection = res.collection;\n this.pageInfo = res.pageInfo;\n this.products = more ? [...this.products, ...res.products] : res.products;\n }\n this.render();\n setScopeStatus(this.root, 'ready');\n emit('list-ready', { products: this.products, collection: this.collection }, this.root);\n } catch (err) {\n if (stale()) return;\n // Keep what's already rendered on a failed \"load more\"; otherwise show the error state.\n if (!more) setScopeStatus(this.root, isNotFound(err) ? 'not-found' : 'error', err);\n reportError(err, 'list load failed');\n emit('error', { error: err, context: 'list' }, this.root);\n }\n }\n\n render() {\n const c = this.collection;\n this.$(sel('collection-bind')).forEach((el) => {\n switch (get(el, 'collection-bind')) {\n case 'title': return setText(el, c?.title || '');\n case 'description': el.innerHTML = c?.descriptionHtml || ''; return undefined;\n case 'image': return setImage(el, c?.image?.url, c?.image?.altText || c?.title);\n case 'count': return setText(el, this.products.length);\n default: return undefined;\n }\n });\n\n this.$(sel('list')).forEach((container) => {\n repeat(container, this.products, (node, p) => {\n node.setAttribute(attr('product'), p.handle);\n node.removeAttribute(attr('state'));\n });\n // Cards are new elements: mount them (product data is already cached).\n emit('list-rendered', { container }, this.root);\n });\n\n const empty = this.products.length === 0;\n this.$(sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (k === 'list-empty') el.style.display = empty ? '' : 'none';\n if (k === 'list-filled') el.style.display = empty ? 'none' : '';\n });\n this.$(sel('load-more')).forEach((el) => { el.style.display = this.pageInfo?.hasNextPage ? '' : 'none'; });\n notifyLayoutChanged('list');\n }\n}\n\n", "/**\n * Shopify API versions are quarterly (YYYY-01, -04, -07, -10) and supported for 12 months.\n * Tether pins a dated version and never targets `unstable` (it changes without notice).\n */\n\nconst parse = (v) => {\n const m = /^(\\d{4})-(01|04|07|10)$/.exec(String(v || ''));\n return m ? { y: +m[1], m: +m[2] } : null;\n};\nconst fmt = (y, m) => `${y}-${String(m).padStart(2, '0')}`;\n\nexport const isDatedVersion = (v) => Boolean(parse(v));\n\n/** '2026-07' -> '2026-10', '2026-10' -> '2027-01'. */\nexport function nextApiVersion(v, steps = 1) {\n const p = parse(v);\n if (!p) throw new Error(`not a quarterly Shopify API version: ${v}`);\n const q = p.y * 4 + (p.m - 1) / 3 + steps;\n return fmt(Math.floor(q / 4), (q % 4) * 3 + 1);\n}\n\n/** Support window of a version, relative to `now`. */\nexport function apiVersionStatus(version, now = new Date()) {\n if (version === 'unstable') return { version, ok: false, note: '\"unstable\" changes without notice: pin a dated version such as 2026-07' };\n const p = parse(version);\n if (!p) return { version, ok: false, note: 'not a quarterly version (YYYY-01, -04, -07 or -10)' };\n const released = new Date(Date.UTC(p.y, p.m - 1, 1));\n const supportedUntil = new Date(Date.UTC(p.y + 1, p.m - 1, 1));\n const monthsLeft = (supportedUntil - now) / (30.44 * 24 * 3600 * 1000);\n let note = `supported until about ${supportedUntil.toISOString().slice(0, 7)}`;\n if (released > now) note = 'not released yet (release candidate at best)';\n else if (monthsLeft <= 0) note = 'no longer supported: Shopify falls back to the oldest supported version. Upgrade (see README)';\n else if (monthsLeft < 3) note = `${note}: plan the upgrade to ${nextApiVersion(version)} or later (see README)`;\n return { version, ok: released <= now && monthsLeft > 0, monthsLeft: Math.round(monthsLeft), next: nextApiVersion(version), note };\n}\n", "/**\n * Markets: which country/language prices, currency and translations follow.\n *\n * markets: {\n * detect: true, // or a list: ['saved', 'server', 'webflow']\n * locales: { // Webflow Localization: locale subdirectory or <html lang>\n * de: { country: 'DE', language: 'DE', locale: 'de-DE' },\n * 'fr-be': { country: 'BE', language: 'FR' },\n * },\n * cookie: 'tether_country', // a cookie your server/Worker sets (e.g. from cf-ipcountry)\n * remember: true, // keep the visitor's tether-country-select choice\n * }\n *\n * Sources, first match wins per field:\n * saved the visitor's own choice (localStorage), from tether-country-select / Tether.setCountry()\n * server window.TETHER_COUNTRY, <meta name=\"tether-country\" content=\"DE\">, or the cookie\n * webflow locale subdirectory (/de/...) or <html lang=\"de-DE\">, through `locales`\n * then the static `country` / `language` config. Without `detect`, only `saved` applies\n * (so a country select keeps working across pages); `detect: false` turns even that off. Tether never calls an IP lookup service:\n * a country from the visitor's IP only comes from your own server (see README).\n */\nimport { cfg } from './config.js';\nimport { gql } from './client.js';\n\nconst COUNTRY = /^[A-Z]{2}$/;\n// Shopify LanguageCode values with a region; others are the plain ISO 639-1 code.\nconst REGIONAL_LANGUAGES = new Set(['PT_BR', 'PT_PT', 'ZH_CN', 'ZH_TW']);\n\nexport const storageKey = () => `${cfg.prefix}:market:${cfg.domain}`;\n\nconst defaultEnv = () => ({\n document: typeof document !== 'undefined' ? document : null,\n location: typeof window !== 'undefined' ? window.location : null,\n storage: (() => { try { return window.localStorage; } catch { return null; } })(),\n global: typeof window !== 'undefined' ? window : {},\n});\n\nexport function toCountry(v) {\n const c = String(v || '').trim().toUpperCase();\n return COUNTRY.test(c) && c !== 'XX' && c !== 'T1' ? c : null; // XX/T1: Cloudflare's unknown/Tor\n}\n\n/** 'de-DE' -> 'DE', 'pt-BR' -> 'PT_BR', 'en' -> 'EN'. */\nexport function toLanguage(v) {\n const raw = String(v || '').trim().replace('-', '_').toUpperCase();\n if (!raw) return null;\n if (REGIONAL_LANGUAGES.has(raw)) return raw;\n const primary = raw.split('_')[0];\n return /^[A-Z]{2,3}$/.test(primary) ? primary : null;\n}\n\nfunction readCookie(doc, name) {\n if (!doc || !name) return null;\n const hit = String(doc.cookie || '').split(';').map((c) => c.trim()).find((c) => c.startsWith(`${name}=`));\n return hit ? decodeURIComponent(hit.slice(name.length + 1)) : null;\n}\n\nconst lookup = (locales, key) => {\n if (!locales || !key) return null;\n const k = String(key).toLowerCase();\n const found = Object.keys(locales).find((x) => x.toLowerCase() === k);\n return found ? locales[found] : null;\n};\n\nconst readers = {\n saved(m, env) {\n if (m.remember === false || !env.storage) return null;\n try { return JSON.parse(env.storage.getItem(storageKey()) || 'null'); } catch { return null; }\n },\n server(m, env) {\n const meta = (name) => env.document?.querySelector?.(`meta[name=\"${name}\"]`)?.getAttribute('content');\n const country = env.global.TETHER_COUNTRY || meta('tether-country') || readCookie(env.document, m.cookie || 'tether_country');\n const language = env.global.TETHER_LANGUAGE || meta('tether-language');\n return { country, language };\n },\n webflow(m, env) {\n const segment = (env.location?.pathname || '/').split('/').filter(Boolean)[0];\n const fromPath = lookup(m.locales, segment);\n if (fromPath) return fromPath;\n const lang = env.document?.documentElement?.getAttribute('lang');\n if (!lang) return null;\n const mapped = lookup(m.locales, lang) || lookup(m.locales, lang.split('-')[0]);\n if (mapped) return { locale: lang, ...mapped };\n if (m.locales && m.strict) return null;\n // Unmapped: language from <html lang>, country only from a region subtag (de-CH -> CH).\n const region = lang.split('-')[1];\n return { language: lang, country: region && region.length === 2 ? region : null, locale: lang };\n },\n};\n\n/**\n * Returns { country, language, locale, sources } with only the fields found.\n * Pure apart from reading the DOM/storage: easy to test.\n */\nexport function detectMarket(markets = cfg.markets, env = defaultEnv()) {\n const m = markets || {};\n if (m.detect === false) return {};\n // Without detect, only the visitor's own choice (from a country select) is applied.\n const list = !m.detect ? ['saved'] : m.detect === true ? ['saved', 'server', 'webflow'] : [].concat(m.detect);\n markets = m;\n const out = { sources: {} };\n list.forEach((name) => {\n const r = readers[name]?.(markets, env);\n if (!r) return;\n const vals = { country: toCountry(r.country), language: toLanguage(r.language), locale: r.locale || null };\n Object.entries(vals).forEach(([k, v]) => {\n if (v && !out[k]) { out[k] = v; out.sources[k] = name; }\n });\n });\n return out;\n}\n\nexport function rememberMarket(market) {\n if (cfg.markets?.remember === false) return;\n try { localStorage.setItem(storageKey(), JSON.stringify({ country: market.country, language: market.language || undefined })); } catch { /* private mode */ }\n}\n\nlet localizationPromise = null;\nexport function clearLocalization() { localizationPromise = null; }\n\n/** Countries the store sells to (Shopify Markets), with currency. Cached per page. */\nexport function getLocalization() {\n if (!localizationPromise) {\n localizationPromise = gql(`query TetherLocalization {\n localization {\n country { isoCode name currency { isoCode symbol } }\n language { isoCode name }\n availableCountries { isoCode name currency { isoCode symbol } availableLanguages { isoCode name } }\n }\n}`).then((d) => d.localization).catch((err) => { localizationPromise = null; throw err; });\n }\n return localizationPromise;\n}\n", "/**\n * Tether.diagnose(): one call in the browser console that explains what's\n * wrong on a page. Logs a readable report and returns it as an object.\n *\n * await Tether.diagnose()\n * await Tether.diagnose({ silent: true }) // just the object\n */\nimport { cfg, isConfigured } from './config.js';\nimport { gql, endpoint } from './client.js';\nimport { attr, sel, get, qsa, hasTemplate } from './dom.js';\nimport { getProduct } from './loader.js';\nimport { allPlans } from './selling-plans.js';\nimport { resolveProductKey, boundary } from './status.js';\nimport { apiVersionStatus } from './api-version.js';\nimport { detectMarket } from './markets.js';\n\nexport { apiVersionStatus };\n\nconst mask = (t) => (t ? `${String(t).slice(0, 4)}\u2026${String(t).slice(-4)} (${String(t).length} chars)` : '(missing)');\n\nfunction describe(el) {\n const id = el.id ? `#${el.id}` : '';\n const cls = el.className && typeof el.className === 'string' ? `.${el.className.trim().split(/\\s+/).slice(0, 2).join('.')}` : '';\n return `<${el.tagName.toLowerCase()}${id}${cls}>`;\n}\n\n/** Markup problems that don't need the network. */\nexport function checkMarkup(root = document) {\n const problems = [];\n const add = (level, message, el) => problems.push({ level, message, element: el ? describe(el) : undefined, el });\n const inProduct = (el) => Boolean(el.closest(sel('product')));\n const listSel = `${sel('collection')},${sel('products')},${sel('recommendations')}`;\n\n qsa(root, sel('product')).forEach((el) => {\n if (el.closest(listSel) && el.closest(sel('list'))) return; // list cards get their handle at render time\n const { key, fromUrl, raw } = resolveProductKey(el);\n if (!raw) add('error', `${attr('product')} has no value. Bind it to the Shopify handle (CMS field), or use \"url:handle\".`, el);\n else if (fromUrl && !key) add('warn', `${attr('product')}=\"${raw}\" but this URL has no value for it (e.g. ?handle=my-product).`, el);\n });\n\n const productOnly = ['bind', 'option-list', 'option', 'variant-select', 'add-to-cart', 'purchase', 'plan-list', 'plan', 'qty', 'line-attribute'];\n productOnly.forEach((name) => {\n qsa(root, sel(name)).forEach((el) => {\n if (inProduct(el)) return;\n if (name === 'line-attribute' && el.closest(sel('group'))) return;\n add('warn', `${attr(name)} outside any ${attr('product')}: it does nothing here.`, el);\n });\n });\n\n qsa(root, sel('group-add')).forEach((el) => {\n if (!el.closest(sel('group'))) add('warn', `${attr('group-add')} outside a ${attr('group')}.`, el);\n });\n\n [...qsa(root, sel('option-list')), ...qsa(root, sel('plan-list')), ...qsa(root, sel('cart-lines')), ...qsa(root, sel('list'))]\n .forEach((el) => {\n if (!el.firstElementChild && !hasTemplate(el)) {\n add('warn', 'Repeater without a template child: put one example element inside it.', el);\n }\n });\n\n qsa(root, listSel).forEach((el) => {\n if (!qsa(el, sel('list')).length) add('error', `List without a ${attr('list')} child: products have nowhere to render.`, el);\n });\n\n const known = new Set([\n 'in-stock', 'out-of-stock', 'backorder', 'low-stock', 'on-sale', 'not-on-sale', 'has-variants', 'single-variant',\n 'subscription-available', 'subscription-unavailable', 'subscription-only', 'one-time-available',\n 'subscription-selected', 'one-time-selected', 'has-savings', 'loading', 'ready', 'error', 'not-found',\n 'cart-empty', 'cart-filled', 'cart-has-subscription', 'cart-no-subscription', 'cart-has-discount', 'cart-error',\n 'list-empty', 'list-filled',\n ]);\n qsa(root, sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (!known.has(k)) add('warn', `Unknown ${attr('show')}=\"${k}\".`, el);\n });\n\n qsa(root, sel('bind')).forEach((el) => {\n const k = get(el, 'bind') || '';\n if (!k.startsWith('metafield:')) return;\n const ref = k.slice(10);\n const listed = (cfg.metafields || []).some((m) => (typeof m === 'string' ? m : `${m.namespace}.${m.key}`) === ref);\n if (!listed) add('error', `${attr('bind')}=\"${k}\" but \"${ref}\" is not in config.metafields, so it stays empty.`, el);\n });\n\n if (qsa(root, sel('cart-open')).length && !qsa(root, sel('cart-drawer')).length) {\n add('warn', `${attr('cart-open')} exists but there is no ${attr('cart-drawer')} on this page.`);\n }\n if (qsa(root, sel('cart-drawer')).length > 1) add('warn', `More than one ${attr('cart-drawer')}.`);\n\n qsa(root, `[${attr('state')}=\"error\"]`).forEach((el) => {\n if (el.matches(boundary())) add('error', `Scope failed to load (${get(el, 'error') || 'error'}).`, el);\n });\n\n return problems;\n}\n\nexport async function diagnose({ root = document, silent = false, version, now = new Date() } = {}) {\n const report = {\n version,\n config: {\n domain: cfg.domain || '(missing)',\n token: mask(cfg.token),\n apiVersion: cfg.apiVersion,\n endpoint: cfg.domain ? endpoint() : null,\n country: cfg.country, language: cfg.language, locale: cfg.locale, markets: cfg.markets || null,\n prefix: cfg.prefix, productPath: cfg.productPath, metafields: cfg.metafields,\n autoMount: cfg.autoMount, observe: cfg.observe, onError: typeof cfg.onError === 'function',\n },\n apiVersion: apiVersionStatus(cfg.apiVersion, now),\n market: cfg.markets?.detect ? detectMarket(cfg.markets) : null,\n reachable: false,\n shop: null,\n latencyMs: null,\n products: [],\n sellingPlans: [],\n problems: [],\n };\n\n if (!isConfigured()) {\n report.problems.push({ level: 'error', message: 'TETHER_CONFIG needs domain and token.' });\n } else {\n const t0 = Date.now();\n try {\n const data = await gql('query TetherDiagnose { shop { name primaryDomain { url } paymentSettings { currencyCode } } }', {}, { context: false });\n report.reachable = true;\n report.shop = { name: data.shop?.name, url: data.shop?.primaryDomain?.url, currency: data.shop?.paymentSettings?.currencyCode };\n } catch (err) {\n const hint = err.status === 401 || err.status === 403\n ? 'Token rejected: use the public Storefront token from the Headless channel, not an Admin token.'\n : err.status === 404 ? 'Store or API version not found: check domain (x.myshopify.com) and apiVersion.' : '';\n report.problems.push({ level: 'error', message: `Storefront API not reachable: ${err.message}${hint ? `. ${hint}` : ''}` });\n }\n report.latencyMs = Date.now() - t0;\n\n if (report.reachable) {\n const keys = [...new Set(qsa(root, sel('product')).map((el) => resolveProductKey(el).key).filter(Boolean))].slice(0, 20);\n const results = await Promise.allSettled(keys.map((k) => getProduct(k)));\n results.forEach((r, i) => {\n if (r.status === 'fulfilled') {\n const p = r.value;\n const plans = allPlans(p);\n report.products.push({ key: keys[i], handle: p.handle, title: p.title, plans: plans.length, requiresSellingPlan: p.requiresSellingPlan });\n plans.forEach((pl) => report.sellingPlans.push({ product: p.handle, group: pl.group?.name, plan: pl.name, id: pl.id }));\n } else {\n report.products.push({ key: keys[i], error: r.reason?.message });\n report.problems.push({ level: 'error', message: `Product \"${keys[i]}\": ${r.reason?.message}. Is it published to the Headless channel?` });\n }\n });\n }\n }\n\n if (!report.apiVersion.ok || (report.apiVersion.monthsLeft ?? 99) < 3) {\n report.problems.push({ level: report.apiVersion.ok ? 'warn' : 'error', message: `apiVersion ${cfg.apiVersion}: ${report.apiVersion.note}` });\n }\n if (typeof document !== 'undefined') report.problems.push(...checkMarkup(root));\n\n if (!silent) print(report);\n return report;\n}\n\nfunction print(r) {\n const c = console;\n const errors = r.problems.filter((p) => p.level === 'error').length;\n c.group?.(`[${cfg.prefix}] diagnose: ${errors ? `${errors} error(s)` : 'no errors'}, ${r.problems.length - errors} warning(s)`);\n c.log('version', r.version, '| API', r.apiVersion.version, `(${r.apiVersion.note})`);\n c.log('config', r.config);\n if (r.market) c.log('market detected', r.market, '(in use:', r.config.country, r.config.language, ')');\n c.log(r.reachable ? `Storefront API reachable: ${r.shop?.name} (${r.latencyMs} ms)` : 'Storefront API NOT reachable');\n if (r.products.length) (c.table || c.log)(r.products);\n if (r.sellingPlans.length) (c.table || c.log)(r.sellingPlans);\n else if (r.reachable) c.log('No selling plans on the products of this page.');\n r.problems.forEach((p) => (p.level === 'error' ? c.error : c.warn)(p.message, p.el || ''));\n c.groupEnd?.();\n}\n", "/**\n * Tether \u2014 Shopify <-> Webflow (or any HTML) sync via the Storefront API.\n *\n * <script>window.TETHER_CONFIG = { domain: 'x.myshopify.com', token: '...' }</script>\n * <script src=\"tether.min.js\" defer></script>\n *\n * With page transitions (Barba, Swup): set autoMount: false, call\n * Tether.init() once and Tether.mount(container) after every page enter.\n */\nimport { cfg, configure, isConfigured, log, warn, reportError } from './config.js';\nimport { gql, TetherError, withContext } from './client.js';\nimport { Cart } from './cart.js';\nimport { ProductScope, scopes } from './product.js';\nimport { ListScope, listSelector } from './collection.js';\nimport {\n getProduct, getProducts, getRecommendations, clearProductCache, primeProduct, normalizeProductKey,\n} from './loader.js';\nimport * as plans from './selling-plans.js';\nimport { resolveProductKey, setScopeStatus, isNotFound } from './status.js';\nimport { diagnose } from './diagnose.js';\nimport { detectMarket, rememberMarket, getLocalization, clearLocalization, toCountry, toLanguage } from './markets.js';\nimport { attr, sel, get, qsa, emit, formatMoney, busy, parseJSONAttr, toAttributes } from './dom.js';\n\nexport const VERSION = '0.3.5';\n\nconst mountedProducts = new WeakSet();\nconst mountedLists = new WeakSet();\n// Live roots, for re-rendering after a country switch (pruned when disconnected).\nconst liveProducts = new Set();\nconst liveLists = new Set();\nconst requestToken = new WeakMap(); // product root -> latest request, so a slow old response can't win\n\nfunction pruneLive() {\n liveProducts.forEach((el) => { if (!el.isConnected) liveProducts.delete(el); });\n liveLists.forEach((l) => { if (!l.root.isConnected) liveLists.delete(l); });\n}\nlet initPromise = null;\nlet observer = null;\n\nfunction within(root, selector) {\n return [...(root.matches?.(selector) ? [root] : []), ...qsa(root, selector)];\n}\n\n/** Mount every product scope and product list inside `root`. Safe to call repeatedly. */\nexport function mount(root = document) {\n if (!isConfigured()) return 0;\n let count = 0;\n pruneLive(); // page transitions detach old roots: don't keep them alive\n\n within(root, listSelector()).forEach((el) => {\n if (mountedLists.has(el)) return;\n mountedLists.add(el);\n count++;\n const list = new ListScope(el);\n liveLists.add(list);\n el.addEventListener(`${cfg.prefix}:list-rendered`, (e) => mount(e.detail.container));\n list.load();\n });\n\n within(root, sel('product')).forEach((el) => { if (mountProduct(el)) count++; });\n\n renderCountrySelects(root);\n\n qsa(root, sel('account-link')).forEach((a) => {\n a.setAttribute('href', `https://${cfg.domain}/account`);\n });\n\n Cart.render();\n log(`mounted ${count} scope(s)`, root);\n return count;\n}\n\n/** Mounts one product root. Returns true when a product request was started. */\nfunction mountProduct(el) {\n if (mountedProducts.has(el)) return false;\n const { key, fromUrl, raw } = resolveProductKey(el);\n if (!key) {\n if (fromUrl) {\n // Dynamic product page opened without ?handle= (or an empty path).\n mountedProducts.add(el);\n setScopeStatus(el, 'not-found');\n emit('product-not-found', { key: null, source: raw }, el);\n } else if (!el.closest(listSelector())) {\n // List cards get their handle when the list renders.\n warn(`[${attr('product')}] without a value. Bind it to the Shopify handle field, or use \"url:handle\".`, el);\n }\n return false;\n }\n mountedProducts.add(el);\n liveProducts.add(el);\n const token = {};\n requestToken.set(el, token);\n const current = () => requestToken.get(el) === token;\n // A rendered scope keeps showing its content while it refreshes (e.g. country switch).\n if (!scopes.get(el)) setScopeStatus(el, 'loading');\n else el.setAttribute(attr('state'), 'updating');\n getProduct(key)\n .then((p) => {\n if (!current()) return;\n const existing = scopes.get(el);\n if (existing) existing.update(p);\n // eslint-disable-next-line no-new\n else new ProductScope(el, p);\n applyPageTitle(el, p);\n })\n .catch((err) => {\n if (!current()) return;\n const notFound = isNotFound(err);\n setScopeStatus(el, notFound ? 'not-found' : 'error', err);\n if (notFound) {\n emit('product-not-found', { key, source: raw }, el);\n // A typo in a URL isn't worth an alert; a CMS item pointing at a deleted product is.\n if (fromUrl) log(`product not found: ${key}`); else reportError(err, `product ${key}`);\n } else {\n reportError(err, `product ${key}`);\n emit('error', { error: err, context: 'product', key }, el);\n }\n });\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// Markets: country select + switching\n// ---------------------------------------------------------------------------\n\n/**\n * select[tether-country-select]: countries the store sells to (Shopify Markets).\n * tether-country-label=\"{name} ({currency})\" sets the option text ({name}, {code}, {currency}, {symbol}).\n * tether-country-bind=\"name|code|currency|symbol\" shows the current country anywhere.\n */\nfunction renderCountrySelects(root = document) {\n const selects = within(root, `select${sel('country-select')}`);\n const binds = within(root, sel('country-bind'));\n if (!selects.length && !binds.length) return Promise.resolve();\n return getLocalization().then((loc) => {\n const current = (cfg.country || loc.country?.isoCode || '').toUpperCase();\n const countries = [...(loc.availableCountries || [])].sort((a, b) => a.name.localeCompare(b.name, cfg.locale || undefined));\n const info = countries.find((c) => c.isoCode === current) || loc.country;\n const fill = (tpl, c) => tpl.replace(/\\{name\\}/g, c.name).replace(/\\{code\\}/g, c.isoCode)\n .replace(/\\{currency\\}/g, c.currency?.isoCode || '').replace(/\\{symbol\\}/g, c.currency?.symbol || '');\n selects.forEach((s) => {\n const tpl = s.getAttribute(attr('country-label')) || '{name} ({currency})';\n s.innerHTML = '';\n countries.forEach((c) => s.appendChild(new Option(fill(tpl, c), c.isoCode)));\n s.value = current;\n if (s.value !== current) s.selectedIndex = -1; // a country the store doesn't sell to\n s.disabled = countries.length < 2 && !s.hasAttribute(attr('always-enabled'));\n });\n binds.forEach((el) => {\n const k = get(el, 'country-bind') || 'name';\n const v = { name: info?.name, code: info?.isoCode, currency: info?.currency?.isoCode, symbol: info?.currency?.symbol }[k];\n el.textContent = v || '';\n });\n }).catch((err) => reportError(err, 'country select'));\n}\n\n/**\n * Switches the market: prices, currency and translations follow (@inContext), the cart's\n * buyerIdentity.countryCode is updated, and every product and list on the page re-renders.\n * Tether.setCountry('DE') Tether.setCountry('BE', { language: 'FR' })\n */\nexport async function setCountry(code, { language, remember = true } = {}) {\n const country = toCountry(code);\n if (!country) throw new TetherError(`Not a country code: ${code}`, { code: 'INVALID_COUNTRY' });\n const lang = language === undefined ? cfg.language : toLanguage(language);\n const changed = country !== String(cfg.country || '').toUpperCase() || lang !== cfg.language;\n cfg.country = country;\n cfg.language = lang || undefined;\n if (remember) rememberMarket({ country, language: lang });\n if (!changed) { renderCountrySelects(); return Cart.state; }\n\n clearProductCache();\n const jobs = [];\n if (language !== undefined) clearLocalization(); // country names follow the language\n // Only an existing cart moves; switching country never creates one.\n if (Cart.id()) jobs.push(Cart.setBuyerIdentity({ countryCode: country }, { create: false }).catch((err) => reportError(err, 'cart country')));\n\n pruneLive();\n liveLists.forEach((list) => jobs.push(list.load()));\n liveProducts.forEach((el) => {\n if (el.closest(listSelector())) return; // re-rendered by its list\n mountedProducts.delete(el);\n mountProduct(el);\n });\n\n renderCountrySelects();\n emit('country-changed', { country, language: cfg.language });\n await Promise.all(jobs);\n return Cart.state;\n}\n\n/** tether-page-title=\"{title} | My shop\" on a product root sets document.title (dynamic product pages). */\nfunction applyPageTitle(el, p) {\n const tpl = get(el, 'page-title');\n if (!tpl || typeof document === 'undefined') return;\n document.title = tpl.replace(/\\{title\\}/g, p.title).replace(/\\{vendor\\}/g, p.vendor || '').replace(/\\{type\\}/g, p.productType || '');\n}\n\n/** Call before a page transition removes `root` (closes the drawer etc.). */\nexport function unmount() {\n Cart.close();\n}\n\nexport function getScope(el) {\n const root = el?.closest?.(sel('product'));\n return root ? scopes.get(root) || null : null;\n}\n\n// ---------------------------------------------------------------------------\n// Document-wide controls (delegated, so they survive page swaps)\n// ---------------------------------------------------------------------------\n\nlet controlsBound = false;\n\nfunction bindControls() {\n if (controlsBound) return;\n controlsBound = true;\n\n document.addEventListener('click', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n\n if (t.closest(sel('cart-open'))) { e.preventDefault(); Cart.toggle(); return; }\n if (t.closest(sel('cart-close'))) { e.preventDefault(); Cart.close(); return; }\n\n const clear = t.closest(sel('cart-clear'));\n if (clear) { e.preventDefault(); busy(clear, () => Cart.clear().catch((err) => reportError(err, 'cart clear'))); return; }\n\n const checkout = t.closest(sel('checkout'));\n if (checkout) { e.preventDefault(); busy(checkout, () => Cart.checkout()); return; }\n\n const line = t.closest(dataKeySel());\n if (line && line.closest(sel('cart-lines'))) {\n const id = line.getAttribute(`data-${cfg.prefix}-key`);\n const current = Cart.lines.find((l) => l.id === id);\n const run = (fn) => { e.preventDefault(); fn().catch((err) => reportError(err, 'cart line')); };\n if (t.closest(sel('line-remove'))) return run(() => Cart.removeLine(id));\n if (current && t.closest(sel('line-plus'))) return run(() => Cart.updateLine(id, current.quantity + 1));\n if (current && t.closest(sel('line-minus'))) return run(() => Cart.updateLine(id, current.quantity - 1));\n }\n\n const removeCode = t.closest(sel('discount-remove'));\n if (removeCode) {\n e.preventDefault();\n const code = removeCode.closest(sel('discount-code'))?.getAttribute(attr('discount-code'));\n if (code) Cart.removeDiscount(code).catch((err) => reportError(err, 'discount'));\n return;\n }\n\n const groupBtn = t.closest(sel('group-add'));\n if (groupBtn) { e.preventDefault(); busy(groupBtn, () => addGroup(groupBtn)); }\n });\n\n document.addEventListener('change', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n const lineEl = t.closest(dataKeySel());\n const id = lineEl?.getAttribute(`data-${cfg.prefix}-key`);\n if (id && t.matches(`input${sel('line', 'quantity')}`)) {\n Cart.updateLine(id, parseInt(t.value, 10) || 0).catch((err) => reportError(err, 'cart line'));\n } else if (id && t.matches(`select${sel('line-plan')}`)) {\n Cart.updateLine(id, { sellingPlanId: t.value || null }).catch((err) => reportError(err, 'cart line plan'));\n } else if (t.matches(`select${sel('country-select')}`)) {\n if (t.value) setCountry(t.value).catch((err) => reportError(err, 'country'));\n } else if (t.matches(sel('cart-note'))) {\n Cart.setNote(t.value).catch((err) => reportError(err, 'cart note'));\n }\n });\n\n document.addEventListener('submit', (e) => {\n const form = e.target.closest?.(sel('discount-form'));\n if (!form) return;\n e.preventDefault();\n const input = form.querySelector(sel('discount-input')) || form.querySelector('input');\n const code = input?.value.trim();\n if (!code) return;\n busy(form, async () => {\n try {\n const cart = await Cart.applyDiscount(code);\n const ok = (cart?.discountCodes || []).find((d) => d.code.toLowerCase() === code.toLowerCase())?.applicable;\n form.classList.toggle('is-invalid', !ok);\n emit(ok ? 'discount-applied' : 'discount-invalid', { code }, form);\n if (ok && input) input.value = '';\n } catch (err) { form.classList.add('is-invalid'); reportError(err, 'discount'); }\n });\n });\n\n document.addEventListener('keydown', (e) => { if (e.key === 'Escape' && Cart.isOpen()) Cart.close(); });\n}\n\nfunction dataKeySel() { return `[data-${cfg.prefix}-key]`; }\n\n/**\n * [tether-group] + [tether-group-add]: adds every product scope inside the\n * group in one request. Bundles, build-a-box, \"complete the set\".\n * Lines get attribute _group (and the group's tether-line-attributes).\n */\nexport async function addGroup(btn) {\n const group = btn.closest(sel('group'));\n if (!group) return null;\n const name = get(group, 'group');\n const extra = toAttributes(parseJSONAttr(group, 'line-attributes'));\n const groupAttrs = name ? [{ key: '_group', value: name }, ...extra] : extra;\n\n const lines = qsa(group, sel('product'))\n .map((el) => scopes.get(el))\n .filter((s) => s && s.variant?.availableForSale && s.quantity > 0)\n .map((s) => {\n const l = s.getLine();\n l.attributes = [...(l.attributes || []), ...groupAttrs];\n return l;\n });\n\n if (!lines.length) { warn('group-add: nothing selected'); return null; }\n try {\n const cart = await Cart.add(lines);\n emit('group-added', { group: name, lines }, group);\n return cart;\n } catch (err) { reportError(err, 'group add'); return null; }\n}\n\n// ---------------------------------------------------------------------------\n// Init\n// ---------------------------------------------------------------------------\n\nexport function init(overrides = {}) {\n if (initPromise && !Object.keys(overrides).length) return initPromise;\n configure({ ...(window.TETHER_CONFIG || {}), ...overrides });\n\n if (!isConfigured()) {\n warn('TETHER_CONFIG is missing domain or token. Tether is idle.');\n initPromise = Promise.resolve(null);\n return initPromise;\n }\n\n // Detected market (saved choice, server hint, Webflow locale) wins over the static config.\n const market = detectMarket(cfg.markets);\n if (market.country) cfg.country = market.country;\n if (market.language) cfg.language = market.language;\n if (market.locale && !overrides.locale && !window.TETHER_CONFIG?.locale) cfg.locale = market.locale;\n if (market.sources && Object.keys(market.sources).length) log('market', market);\n\n bindControls();\n if (cfg.observe) startObserver();\n\n initPromise = Cart.init().then(async (cart) => {\n // A saved cart from another market: move it to this one, so prices match the page.\n const want = cfg.country ? String(cfg.country).toUpperCase() : null;\n if (cart && want && cart.buyerIdentity?.countryCode && cart.buyerIdentity.countryCode !== want) {\n try { cart = await Cart.setBuyerIdentity({ countryCode: want }, { create: false }); } catch (err) { reportError(err, 'cart country'); }\n }\n emit('ready', { cart });\n return api;\n });\n return initPromise;\n}\n\nfunction startObserver() {\n if (observer || typeof MutationObserver === 'undefined') return;\n let t = null;\n const queued = new Set();\n observer = new MutationObserver((muts) => {\n muts.forEach((m) => m.addedNodes.forEach((n) => { if (n.nodeType === 1) queued.add(n); }));\n clearTimeout(t);\n t = setTimeout(() => { queued.forEach((n) => { if (n.isConnected) mount(n); }); queued.clear(); }, 50);\n });\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport const api = {\n VERSION,\n init,\n mount,\n unmount,\n get config() { return cfg; },\n get ready() { return initPromise || Promise.resolve(null); },\n query: gql,\n withContext,\n cart: Cart,\n getProduct,\n getProducts,\n getRecommendations,\n getScope,\n addGroup,\n primeProduct,\n normalizeProductKey,\n clearProductCache,\n formatMoney,\n plans,\n TetherError,\n resolveProductKey,\n setCountry,\n detectMarket: (markets) => detectMarket(markets || cfg.markets),\n getLocalization,\n diagnose: (opts) => diagnose({ ...opts, version: VERSION }),\n on(name, fn) {\n const h = (e) => fn(e.detail, e);\n document.addEventListener(`${cfg.prefix}:${name}`, h);\n return () => document.removeEventListener(`${cfg.prefix}:${name}`, h);\n },\n};\n\nexport default api;\n\n// Auto-start for the plain <script> setup.\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n window.Tether = api;\n const auto = window.TETHER_CONFIG && window.TETHER_CONFIG.autoMount !== false;\n if (auto) {\n const start = () => init().then(() => mount(document));\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, { once: true });\n else start();\n }\n}\n"],
5
- "mappings": "mGAIO,IAAMA,GAAW,CAEtB,OAAQ,GACR,MAAO,GACP,WAAY,UACZ,QAAS,OACT,SAAU,OACV,OAAQ,OACR,QAAS,KAGT,OAAQ,SACR,YAAa,WACb,eAAgB,cAGhB,WAAY,CAAC,EACb,YAAa,GACb,cAAe,IACf,uBAAwB,GACxB,kBAAmB,GACnB,gBAAiB,GACjB,QAAS,EAGT,WAAY,KACZ,oBAAqB,UACrB,cAAe,GACf,eAAgB,QAGhB,gBAAiB,WAGjB,UAAW,GACX,QAAS,GAGT,YAAa,KAGb,eAAgB,KAChB,WAAY,KACZ,YAAa,KACb,YAAa,KACb,YAAa,KACb,cAAe,KACf,QAAS,KAET,MAAO,EACT,EAEaC,EAAM,CAAE,GAAGD,EAAS,EAE1B,SAASE,GAAUC,EAAY,CAAC,EAAG,CACxC,cAAO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AAO,cAAc,YAAc,IAC9D,CACR,IAAMkB,EAAQ,IAAMzB,GAAK,EAAE,KAAK,IAAM5F,GAAM,QAAQ,CAAC,EACjD,SAAS,aAAe,UAAW,SAAS,iBAAiB,mBAAoBqH,EAAO,CAAE,KAAM,EAAK,CAAC,EACrGA,EAAM,CACb",
6
- "names": ["DEFAULTS", "cfg", "configure", "overrides", "k", "warn", "isConfigured", "log", "a", "reportError", "err", "context", "TetherError", "message", "status", "errors", "userErrors", "code", "endpoint", "cfg", "withContext", "query", "ctx", "args", "sleep", "ms", "r", "gql", "variables", "context", "_a", "body", "attempt", "res", "err", "log", "json", "e", "unwrap", "payload", "name", "errs", "MONEY", "IMAGE", "metafieldIdentifiers", "cfg", "m", "i", "metafieldsField", "ids", "SELLING_PLAN_FIELDS", "ALLOCATION_FIELDS", "productFragment", "cartFragment", "collectionFields", "productCache", "pending", "resolvers", "scheduled", "generation", "isGid", "v", "normalizeProductKey", "raw", "m", "primeProduct", "product", "p", "getProduct", "rawKey", "key", "TetherError", "resolve", "reject", "flush", "gen", "keys", "ids", "handles", "k", "defs", "parts", "vars", "h", "i", "query", "productFragment", "log", "settle", "fn", "r", "data", "gql", "got", "err", "clearProductCache", "getProducts", "collection", "first", "cfg", "after", "sortKey", "reverse", "filters", "fragment", "collectionFields", "products", "rest", "getRecommendations", "productId", "intent", "list", "selling_plans_exports", "__export", "GID", "allPlans", "allocationFor", "findPlan", "hasPlans", "planAdjustment", "planCheckoutCharge", "planPrice", "planSavings", "plansForVariant", "toGid", "v", "value", "type", "product", "_a", "g", "p", "variant", "planId", "a", "adj", "_b", "base", "sub", "plan", "ref", "plans", "gid", "needle", "o", "attr", "name", "cfg", "sel", "value", "get", "el", "has", "dataKey", "productUrl", "handle", "id", "path", "numeric", "qsa", "root", "s", "scoped", "scopeSelector", "emit", "detail", "target", "formatMoney", "money", "amount", "formatDate", "iso", "cdnUrl", "url", "w", "h", "crop", "u", "setImage", "alt", "src", "setText", "v", "text", "readText", "setTextTracked", "before", "after", "show", "visible", "k", "setSelected", "selected", "_a", "input", "templates", "hasTemplate", "container", "template", "_b", "tpl", "repeat", "items", "render", "warn", "item", "node", "repeatKeyed", "keyOf", "onEnter", "onLeave", "KEY", "LEAVING", "live", "n", "existing", "wanted", "fresh", "i", "staying", "current", "prev", "done", "layoutTimer", "notifyLayoutChanged", "reason", "watchImages", "imgs", "left", "img", "busy", "fn", "parseJSONAttr", "raw", "toAttributes", "obj", "a", "key", "toLineInput", "input", "quantity", "opts", "_a", "src", "merchandiseId", "GID", "TetherError", "line", "plan", "attrs", "toAttributes", "mutation", "name", "args", "inner", "cartFragment", "isMissingCart", "err", "Cart", "cfg", "id", "_b", "fn", "run", "value", "emit", "cart", "reason", "data", "gql", "reportError", "buyerIdentity", "unwrap", "variables", "createInput", "cartId", "log", "lines", "l", "lineId", "patch", "p", "lineIds", "ids", "note", "obj", "merged", "a", "attributes", "v", "key", "codes", "discountCodes", "c", "code", "current", "d", "create", "target", "tab", "url", "qsa", "sel", "ds", "get", "count", "money", "k", "formatMoney", "el", "setTextTracked", "hasSub", "conds", "show", "container", "repeat", "node", "attr", "t", "setText", "repeatKeyed", "renderLine", "notifyLayoutChanged", "lineValue", "_c", "_d", "_e", "_f", "_g", "_h", "_i", "m", "o", "isSub", "setImage", "productUrl", "lineConds", "select", "handle", "getProduct", "product", "plans", "allPlans", "want", "sig", "w", "resolveProductKey", "el", "location", "raw", "get", "what", "key", "parts", "safeDecode", "s", "STATUS_KEYS", "isNotFound", "err", "boundary", "n", "sel", "ownedBy", "root", "_a", "setScopeStatus", "status", "notFound", "attr", "scoped", "k", "visible", "show", "btn", "scopes", "productSel", "sel", "metafieldValue", "product", "ref", "i", "ns", "key", "m", "ProductScope", "root", "_a", "get", "has", "allPlans", "attr", "watchImages", "notifyLayoutChanged", "emit", "_b", "variantId", "p", "v", "x", "o", "s", "inner", "scoped", "vs", "first", "param", "gid", "GID", "match", "params", "fromUrl", "findPlan", "fromAttr", "wanted", "cfg", "name", "value", "allocationFor", "line", "attrs", "fixed", "toAttributes", "parseJSONAttr", "inputs", "el", "id", "mode", "next", "n", "min", "setText", "cart", "Cart", "own", "e", "t", "opt", "plan", "purchase", "plus", "minus", "add", "btn", "label", "busyText", "write", "txt", "busy", "err", "reportError", "_c", "formatDate", "formatMoney", "setImage", "productUrl", "repeat", "node", "img", "target", "exclude", "tag", "mf", "container", "show", "sw", "raw", "group", "plans", "pl", "alt", "sub", "oneTimePrice", "subPrice", "planPrice", "price", "compareAt", "onSale", "discountPct", "savings", "planSavings", "total", "_d", "_e", "planCheckoutCharge", "qsa", "setSelected", "unavailable", "planObj", "inVariant", "adj", "planAdjustment", "conds", "k", "STATUS_KEYS", "ownedBy", "disabled", "soldOut", "subText", "text", "listSelector", "sel", "ListScope", "root", "setScopeStatus", "e", "_a", "_b", "more", "busy", "s", "scoped", "r", "opts", "get", "has", "token", "stale", "key", "base", "getProduct", "recs", "getRecommendations", "limit", "res", "getProducts", "emit", "err", "isNotFound", "reportError", "c", "el", "setText", "setImage", "container", "repeat", "node", "p", "attr", "empty", "k", "notifyLayoutChanged", "parse", "v", "m", "fmt", "y", "nextApiVersion", "v", "steps", "p", "parse", "q", "fmt", "apiVersionStatus", "version", "now", "released", "supportedUntil", "monthsLeft", "note", "COUNTRY", "REGIONAL_LANGUAGES", "storageKey", "cfg", "defaultEnv", "toCountry", "v", "c", "toLanguage", "raw", "primary", "readCookie", "doc", "name", "hit", "lookup", "locales", "key", "k", "found", "x", "readers", "m", "env", "meta", "_a", "_b", "_c", "country", "language", "segment", "fromPath", "lang", "mapped", "region", "detectMarket", "markets", "list", "out", "r", "vals", "rememberMarket", "market", "localizationPromise", "clearLocalization", "getLocalization", "gql", "d", "err", "mask", "describe", "el", "id", "cls", "checkMarkup", "root", "problems", "add", "level", "message", "inProduct", "sel", "listSel", "qsa", "key", "fromUrl", "raw", "resolveProductKey", "attr", "name", "hasTemplate", "known", "k", "get", "ref", "cfg", "m", "boundary", "diagnose", "silent", "version", "now", "_a", "_b", "_c", "_d", "_e", "_f", "_g", "report", "endpoint", "apiVersionStatus", "detectMarket", "isConfigured", "t0", "data", "gql", "err", "hint", "keys", "getProduct", "r", "i", "p", "plans", "allPlans", "pl", "print", "c", "errors", "VERSION", "mountedProducts", "mountedLists", "liveProducts", "liveLists", "requestToken", "pruneLive", "el", "l", "initPromise", "observer", "within", "root", "selector", "_a", "qsa", "mount", "isConfigured", "count", "listSelector", "list", "ListScope", "cfg", "e", "sel", "mountProduct", "renderCountrySelects", "a", "Cart", "log", "key", "fromUrl", "raw", "resolveProductKey", "setScopeStatus", "emit", "warn", "attr", "token", "current", "scopes", "getProduct", "p", "existing", "ProductScope", "applyPageTitle", "err", "notFound", "isNotFound", "reportError", "selects", "binds", "getLocalization", "loc", "countries", "b", "info", "c", "fill", "tpl", "_b", "s", "k", "get", "v", "setCountry", "code", "language", "remember", "country", "toCountry", "TetherError", "lang", "toLanguage", "changed", "rememberMarket", "clearProductCache", "jobs", "clearLocalization", "unmount", "getScope", "controlsBound", "bindControls", "t", "clear", "busy", "checkout", "line", "dataKeySel", "id", "run", "fn", "removeCode", "groupBtn", "addGroup", "lineEl", "form", "input", "cart", "ok", "btn", "group", "name", "extra", "toAttributes", "parseJSONAttr", "groupAttrs", "lines", "init", "overrides", "configure", "market", "detectMarket", "startObserver", "want", "api", "queued", "muts", "m", "n", "gql", "withContext", "getProducts", "getRecommendations", "primeProduct", "normalizeProductKey", "formatMoney", "selling_plans_exports", "markets", "opts", "diagnose", "h", "index_default", "start"]
3
+ "sources": ["../src/config.js", "../src/client.js", "../src/cart.js", "../src/fragments.js", "../src/loader.js", "../src/selling-plans.js", "../src/dom.js", "../src/product.js", "../src/status.js", "../src/collection.js", "../src/mounting.js", "../src/lazy-iife.js", "../src/index.js"],
4
+ "sourcesContent": ["/**\n * Runtime config. One shared object, mutated by configure(), read everywhere.\n */\n\nexport const DEFAULTS = {\n // Shopify Storefront API\n domain: '', // 'your-store.myshopify.com'\n token: '', // public Storefront API access token\n apiVersion: '2026-07',\n country: undefined, // ISO code, e.g. 'NL' -> @inContext(country: NL)\n language: undefined, // e.g. 'NL' -> @inContext(language: NL)\n locale: undefined, // Intl locale for money/dates, e.g. 'nl-NL'\n markets: null, // { detect: true, locales: { de: { country: 'DE', language: 'DE' } }, cookie, remember } (markets.js)\n\n // Markup\n prefix: 'tether', // attribute prefix: tether-product, tether-bind, ...\n productPath: '/product', // Webflow CMS template path for products\n collectionPath: '/collection',\n\n // Fetching\n metafields: [], // ['custom.material', { namespace, key }]\n imagesFirst: 25,\n variantsFirst: 100,\n sellingPlanGroupsFirst: 10,\n sellingPlansFirst: 25,\n collectionFirst: 24,\n retries: 2,\n\n // Cart\n storageKey: null, // defaults to `tether:cart:<domain>`\n cartDrawerOpenClass: 'is-open',\n openCartOnAdd: true,\n cartFocus: true, // move focus into the open cart, keep Tab inside it, restore it on close\n checkoutTarget: '_self', // '_self' or '_blank'\n\n // Subscriptions\n defaultPurchase: 'one-time', // 'one-time' | 'subscription'\n\n // Mounting\n autoMount: true, // mount document on DOMContentLoaded\n observe: false, // auto-mount nodes added later (CMS load-more, filters)\n partsUrl: null, // folder of tether.markets/diagnose(.min).js for the <script> build (default: next to it)\n\n // Formatting\n formatMoney: null, // (money, locale) => string\n\n // Hooks (all optional)\n onLayoutChange: null, // (reason) => void. Default refreshes ScrollTrigger if present\n onCartOpen: null, // (drawers) => void, e.g. lock scroll\n onCartClose: null, // (drawers) => void\n onLineEnter: null, // (node) => void, animate a new cart line in\n onLineLeave: null, // (node, done) => void, animate out, then call done()\n onValueChange: null, // (el, previousText) => void, e.g. text scramble\n onError: null, // (error, context) => void\n\n debug: false,\n};\n\nexport const cfg = { ...DEFAULTS };\n\nexport function configure(overrides = {}) {\n Object.keys(cfg).forEach((k) => delete cfg[k]);\n Object.assign(cfg, DEFAULTS, overrides);\n if (cfg.domain) cfg.domain = String(cfg.domain).replace(/^https?:\\/\\//, '').replace(/\\/.*$/, '');\n if (!cfg.storageKey) cfg.storageKey = `${cfg.prefix}:cart:${cfg.domain}`;\n if (cfg.apiVersion === 'unstable') warn('apiVersion \"unstable\" changes without notice. Pin a dated version (e.g. 2026-07).');\n return cfg;\n}\n\nexport const isConfigured = () => Boolean(cfg.domain && cfg.token);\n\nexport function log(...a) { if (cfg.debug) console.log(`[${cfg.prefix}]`, ...a); }\nexport function warn(...a) { console.warn(`[${cfg.prefix}]`, ...a); }\n\nexport function reportError(err, context) {\n warn(context, err && err.message ? err.message : err);\n if (typeof cfg.onError === 'function') {\n try { cfg.onError(err, context); } catch { /* never let a hook break us */ }\n }\n}\n", "/**\n * Storefront API client: one fetch wrapper with @inContext, retries and\n * readable errors. Exposed as Tether.query() for anything Tether doesn't cover.\n */\nimport { cfg, log } from './config.js';\n\nexport class TetherError extends Error {\n constructor(message, { status, errors, userErrors, code } = {}) {\n super(message);\n this.name = 'TetherError';\n this.code = code || (status ? `HTTP_${status}` : 'ERROR');\n this.status = status;\n this.errors = errors;\n this.userErrors = userErrors;\n }\n}\n\nexport function endpoint() {\n return `https://${cfg.domain}/api/${cfg.apiVersion}/graphql.json`;\n}\n\n/**\n * Adds @inContext(country, language) to the first operation in the document,\n * so prices, currency and translations follow the configured market.\n * Operations are always written first, fragments after, so the first match is\n * the operation.\n */\nexport function withContext(query, ctx = cfg) {\n const args = [];\n if (ctx.country) args.push(`country: ${String(ctx.country).toUpperCase()}`);\n if (ctx.language) args.push(`language: ${String(ctx.language).toUpperCase().replace('-', '_')}`);\n if (!args.length || /@inContext/.test(query)) return query;\n\n return query.replace(\n /^(\\s*(?:query|mutation)\\s+\\w+\\s*(?:\\([^)]*\\))?)/,\n `$1 @inContext(${args.join(', ')})`,\n );\n}\n\nconst sleep = (ms) => new Promise((r) => setTimeout(r, ms));\n\nexport async function gql(query, variables = {}, { context = true } = {}) {\n if (!cfg.domain || !cfg.token) {\n throw new TetherError('Tether is not configured: domain and token are required', { code: 'NOT_CONFIGURED' });\n }\n\n const body = JSON.stringify({ query: context ? withContext(query) : query, variables });\n let attempt = 0;\n\n for (;;) {\n let res;\n try {\n res = await fetch(endpoint(), {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'X-Shopify-Storefront-Access-Token': cfg.token,\n },\n body,\n });\n } catch (err) {\n if (attempt++ < cfg.retries) { await sleep(300 * 2 ** attempt); continue; }\n throw new TetherError(`Network error: ${err.message}`, { code: 'NETWORK' });\n }\n\n if (res.status === 430) throw new TetherError('Shopify security rejection (430)', { status: 430 });\n\n const retryable = res.status === 429 || res.status >= 500;\n if (retryable && attempt++ < cfg.retries) {\n log('retry', res.status, attempt);\n await sleep(300 * 2 ** attempt);\n continue;\n }\n\n let json;\n try { json = await res.json(); } catch {\n throw new TetherError(`Invalid response (${res.status})`, { status: res.status });\n }\n\n if (json.errors?.length) {\n // Token without unauthenticated_read_product_inventory: drop the field and retry.\n const inventoryDenied = json.errors.some((e) => /quantityAvailable/.test(e.message || ''));\n if (inventoryDenied && /\\bquantityAvailable\\b/.test(body)) {\n log('no inventory permission, retrying without quantityAvailable');\n return gql(query.replace(/\\bquantityAvailable\\b/g, ''), variables, { context });\n }\n const throttled = json.errors.some((e) => e.extensions?.code === 'THROTTLED');\n if (throttled && attempt++ < cfg.retries) { await sleep(500 * 2 ** attempt); continue; }\n throw new TetherError(json.errors.map((e) => e.message).join(' | '), {\n status: res.status, errors: json.errors,\n });\n }\n if (!res.ok) throw new TetherError(`HTTP ${res.status}`, { status: res.status });\n\n return json.data;\n }\n}\n\n/** Throws on mutation userErrors, returns the payload otherwise. */\nexport function unwrap(payload, name) {\n if (!payload) throw new TetherError(`${name}: empty response`);\n const errs = payload.userErrors || [];\n if (errs.length) {\n throw new TetherError(errs.map((e) => e.message).join(' | '), { userErrors: errs });\n }\n return payload;\n}\n", "/**\n * Cart: Shopify Cart API, state in localStorage, document-wide rendering.\n *\n * Every mutation is queued, so fast clicking never races. All public methods\n * return the updated cart.\n */\nimport { cfg, log, reportError } from './config.js';\nimport { gql, unwrap, TetherError } from './client.js';\nimport { cartFragment } from './fragments.js';\nimport { getProduct } from './loader.js';\nimport { allPlans, GID } from './selling-plans.js';\nimport {\n attr, sel, get, qsa, emit, formatMoney, setText, setTextTracked, setImage, show,\n repeat, repeatKeyed, toAttributes, productUrl, notifyLayoutChanged,\n} from './dom.js';\n\n/** Accepts many shapes and returns a Shopify CartLineInput. */\nexport function toLineInput(input, quantity = 1, opts = {}) {\n const src = typeof input === 'object' && input !== null ? input : { variantId: input, quantity, ...opts };\n const merchandiseId = GID.variant(src.merchandiseId || src.variantId || src.id);\n if (!merchandiseId) throw new TetherError('add(): variantId is required');\n const line = { merchandiseId, quantity: Math.max(1, parseInt(src.quantity ?? 1, 10) || 1) };\n const plan = src.sellingPlanId || src.sellingPlan;\n if (plan) line.sellingPlanId = GID.sellingPlan(plan);\n const attrs = toAttributes(src.attributes);\n if (attrs.length) line.attributes = attrs;\n return line;\n}\n\nfunction mutation(name, args, inner) {\n return `mutation Tether_${name}(${args}){${name}(${inner}){cart{...TetherCart}userErrors{field message}}}${cartFragment()}`;\n}\n\nconst FOCUSABLE = 'a[href],button:not([disabled]),input:not([disabled]),select:not([disabled]),textarea:not([disabled]),[tabindex]:not([tabindex=\"-1\"])';\nlet returnFocus = null;\n\n/** Focusable elements inside an open drawer, in order (visible ones only). */\nexport const focusables = (d) => qsa(d, FOCUSABLE).filter((el) => el.offsetParent !== null || el === document.activeElement);\n\n/** aria-expanded on the open buttons; dialog semantics on drawers (unless the markup has its own). */\nfunction ariaState(open) {\n qsa(document, sel('cart-open')).forEach((b) => b.setAttribute('aria-expanded', String(open)));\n qsa(document, sel('cart-drawer')).forEach((d) => {\n if (!d.hasAttribute('role')) d.setAttribute('role', 'dialog');\n if (!d.hasAttribute('aria-label') && !d.hasAttribute('aria-labelledby')) d.setAttribute('aria-label', get(d, 'cart-label') || 'Cart');\n d.setAttribute('aria-modal', String(open));\n if (!d.classList.contains(cfg.cartDrawerOpenClass)) d.setAttribute('aria-hidden', 'true');\n });\n}\n\nconst isMissingCart = (err) => /does not exist|not found|invalid id/i.test(err?.message || '');\n\nexport const Cart = {\n state: null,\n _chain: Promise.resolve(),\n\n id() { try { return localStorage.getItem(cfg.storageKey); } catch { return null; } },\n _setId(id) {\n try {\n if (id) localStorage.setItem(cfg.storageKey, id);\n else localStorage.removeItem(cfg.storageKey);\n } catch { /* private mode */ }\n },\n\n get lines() { return this.state?.lines?.nodes || []; },\n get count() { return this.state?.totalQuantity || 0; },\n\n lastError: null,\n\n _queue(fn) {\n const run = this._chain.then(fn, fn).then((value) => {\n if (this.lastError) { this.lastError = null; this.render(); }\n return value;\n }, (err) => {\n // tether-show=\"cart-error\" becomes visible until the next successful cart call.\n this.lastError = err;\n this.render();\n emit('cart-error', { error: err });\n throw err;\n });\n this._chain = run.catch(() => {});\n return run;\n },\n\n _commit(cart, reason) {\n this.state = cart;\n if (cart?.id) this._setId(cart.id);\n this.render();\n emit('cart-updated', { cart, reason });\n return cart;\n },\n\n async init() {\n const id = this.id();\n if (!id) { this.state = null; this.render(); return null; }\n try {\n const data = await gql(`query TetherCart($id:ID!){cart(id:$id){...TetherCart}}${cartFragment()}`, { id });\n if (!data.cart) { this._setId(null); this.state = null; } else this.state = data.cart;\n } catch (err) {\n reportError(err, 'cart load failed');\n this.lastError = err;\n // Keep the cart id on network/API errors: the cart is probably fine, Shopify isn't reachable.\n if (isMissingCart(err)) this._setId(null);\n this.state = null;\n }\n this.render();\n return this.state;\n },\n\n async _create(input = {}) {\n const buyerIdentity = cfg.country ? { countryCode: String(cfg.country).toUpperCase() } : undefined;\n const data = await gql(\n mutation('cartCreate', '$input: CartInput!', 'input: $input'),\n { input: { buyerIdentity, ...input } },\n );\n return unwrap(data.cartCreate, 'cartCreate').cart;\n },\n\n /** Runs a cart mutation; creates a fresh cart if ours expired. */\n async _mutate(name, args, inner, variables, createInput) {\n const cartId = this.id();\n if (!cartId) return createInput ? this._create(createInput) : null;\n try {\n const data = await gql(mutation(name, `$cartId: ID!, ${args}`, `cartId: $cartId, ${inner}`), { ...variables, cartId });\n return unwrap(data[name], name).cart;\n } catch (err) {\n if (createInput && isMissingCart(err)) {\n log('cart expired, creating a new one');\n this._setId(null);\n return this._create(createInput);\n }\n throw err;\n }\n },\n\n /**\n * add('gid://shopify/ProductVariant/1', 2)\n * add({ variantId, quantity, sellingPlanId, attributes })\n * add([line, line]) // bundles / build-a-box in one request\n */\n add(input, quantity = 1, opts = {}) {\n const lines = (Array.isArray(input) ? input : [input]).map((l) => toLineInput(l, quantity, opts));\n return this._queue(async () => {\n const cart = await this._mutate('cartLinesAdd', '$lines: [CartLineInput!]!', 'lines: $lines', { lines }, { lines });\n this._commit(cart, 'add');\n emit('added', { cart, lines });\n if (cfg.openCartOnAdd) this.open();\n return cart;\n });\n },\n\n /**\n * updateLine(lineId, 3)\n * updateLine(lineId, { quantity, sellingPlanId, attributes })\n * sellingPlanId: null switches a line back to one-time purchase.\n */\n updateLine(lineId, patch) {\n const p = typeof patch === 'number' ? { quantity: patch } : { ...patch };\n if (p.quantity !== undefined && p.quantity <= 0) return this.removeLine(lineId);\n\n const line = { id: lineId };\n if (p.quantity !== undefined) line.quantity = p.quantity;\n if ('sellingPlanId' in p) line.sellingPlanId = p.sellingPlanId ? GID.sellingPlan(p.sellingPlanId) : null;\n if (p.attributes) line.attributes = toAttributes(p.attributes);\n if (p.merchandiseId || p.variantId) line.merchandiseId = GID.variant(p.merchandiseId || p.variantId);\n\n return this._queue(async () => this._commit(\n await this._mutate('cartLinesUpdate', '$lines: [CartLineUpdateInput!]!', 'lines: $lines', { lines: [line] }),\n 'update',\n ));\n },\n\n removeLine(lineIds) {\n const ids = Array.isArray(lineIds) ? lineIds : [lineIds];\n return this._queue(async () => this._commit(\n await this._mutate('cartLinesRemove', '$lineIds: [ID!]!', 'lineIds: $lineIds', { lineIds: ids }),\n 'remove',\n ));\n },\n\n clear() {\n const ids = this.lines.map((l) => l.id);\n if (!ids.length) return Promise.resolve(this.state);\n return this.removeLine(ids);\n },\n\n setNote(note) {\n return this._queue(async () => this._commit(\n await this._mutate('cartNoteUpdate', '$note: String!', 'note: $note', { note: note ?? '' }, { note: note ?? '' }),\n 'note',\n ));\n },\n\n /** Cart-level attributes, merged with existing ones. Value '' removes a key. */\n setAttributes(obj) {\n const merged = new Map((this.state?.attributes || []).map((a) => [a.key, a.value]));\n toAttributes(obj).forEach((a) => merged.set(a.key, a.value));\n const attributes = [...merged].filter(([, v]) => v !== '').map(([key, value]) => ({ key, value }));\n return this._queue(async () => this._commit(\n await this._mutate('cartAttributesUpdate', '$attributes: [AttributeInput!]!', 'attributes: $attributes', { attributes }, { attributes }),\n 'attributes',\n ));\n },\n\n /** Replaces the discount codes. Pass [] to remove all. */\n setDiscountCodes(codes) {\n const discountCodes = (Array.isArray(codes) ? codes : [codes]).map((c) => String(c).trim()).filter(Boolean);\n return this._queue(async () => this._commit(\n await this._mutate('cartDiscountCodesUpdate', '$discountCodes: [String!]!', 'discountCodes: $discountCodes', { discountCodes }, { discountCodes }),\n 'discount',\n ));\n },\n\n applyDiscount(code) {\n const current = (this.state?.discountCodes || []).map((d) => d.code);\n return this.setDiscountCodes([...new Set([...current, code])]);\n },\n\n removeDiscount(code) {\n return this.setDiscountCodes((this.state?.discountCodes || []).map((d) => d.code).filter((c) => c !== code));\n },\n\n /** { countryCode, email, phone } \u2014 changes currency/prices for that market. */\n setBuyerIdentity(buyerIdentity, { create = true } = {}) {\n return this._queue(async () => {\n const cart = await this._mutate('cartBuyerIdentityUpdate', '$buyerIdentity: CartBuyerIdentityInput!', 'buyerIdentity: $buyerIdentity', { buyerIdentity }, create ? { buyerIdentity } : null)\n .catch((err) => {\n if (create || !isMissingCart(err)) throw err;\n this._setId(null); // expired cart: forget it instead of creating an empty one\n return null;\n });\n return this._commit(cart, 'buyer-identity');\n });\n },\n\n /**\n * Goes to Shopify checkout. With checkoutTarget '_blank' the tab is opened\n * inside the click (Safari blocks window.open after an await) and gets its\n * URL once we have it.\n */\n async checkout(target = cfg.checkoutTarget) {\n const id = this.id();\n if (!id) return null;\n const tab = target === '_blank' ? window.open('', '_blank') : null;\n if (tab) { try { tab.opener = null; } catch { /* ignore */ } }\n\n try {\n const data = await gql('query TetherCheckout($id: ID!) { cart(id: $id) { checkoutUrl } }', { id });\n const url = data.cart?.checkoutUrl;\n if (!url) throw new TetherError('No checkoutUrl (cart empty or expired)');\n emit('checkout', { url, cart: this.state });\n if (tab && !tab.closed) tab.location.href = url;\n else window.location.href = url;\n return url;\n } catch (err) {\n if (tab) tab.close();\n reportError(err, 'checkout failed');\n return null;\n }\n },\n\n // -------------------------------------------------------------- drawer\n\n drawers() { return qsa(document, sel('cart-drawer')); },\n\n isOpen() { return this.drawers().some((d) => d.classList.contains(cfg.cartDrawerOpenClass)); },\n\n open() {\n if (this.isOpen()) return;\n const ds = this.drawers().filter((d) => get(d, 'cart-drawer') !== 'manual');\n ds.forEach((d) => { d.classList.add(cfg.cartDrawerOpenClass); d.setAttribute('aria-hidden', 'false'); });\n ariaState(true);\n if (cfg.cartFocus !== false && ds[0]) {\n // Move focus into the cart (after the open transition has made it visible).\n returnFocus = document.activeElement;\n setTimeout(() => {\n const target = focusables(ds[0])[0] || ds[0];\n if (target === ds[0] && !ds[0].hasAttribute('tabindex')) ds[0].tabIndex = -1;\n target.focus?.({ preventScroll: true });\n }, 60);\n }\n if (typeof cfg.onCartOpen === 'function') cfg.onCartOpen(ds);\n emit('cart-toggled', { open: true });\n },\n\n close() {\n if (!this.isOpen()) return;\n const ds = this.drawers();\n const hadFocus = ds.some((d) => d.contains(document.activeElement));\n ds.forEach((d) => { d.classList.remove(cfg.cartDrawerOpenClass); d.setAttribute('aria-hidden', 'true'); });\n ariaState(false);\n if (hadFocus && returnFocus?.isConnected) returnFocus.focus({ preventScroll: true });\n returnFocus = null;\n if (typeof cfg.onCartClose === 'function') cfg.onCartClose(ds);\n emit('cart-toggled', { open: false });\n },\n\n toggle() { if (this.isOpen()) this.close(); else this.open(); },\n\n // -------------------------------------------------------------- render\n\n render() {\n const cart = this.state;\n const count = cart ? cart.totalQuantity : 0;\n const money = (k) => (cart ? formatMoney(cart.cost?.[k]) : '');\n\n ariaState(this.isOpen());\n qsa(document, sel('cart-count')).forEach((el) => setTextTracked(el, count));\n qsa(document, sel('cart-subtotal')).forEach((el) => setTextTracked(el, money('subtotalAmount')));\n qsa(document, sel('cart-total')).forEach((el) => setTextTracked(el, money('totalAmount')));\n qsa(document, sel('cart-checkout-charge')).forEach((el) => setTextTracked(el, money('checkoutChargeAmount')));\n\n const hasSub = this.lines.some((l) => l.sellingPlanAllocation);\n const conds = {\n 'cart-empty': count === 0,\n 'cart-filled': count > 0,\n 'cart-has-subscription': hasSub,\n 'cart-no-subscription': !hasSub,\n 'cart-has-discount': (cart?.discountCodes || []).some((d) => d.applicable),\n 'cart-error': Boolean(this.lastError),\n };\n qsa(document, sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (k in conds && !el.closest(sel('product'))) show(el, conds[k]);\n });\n\n qsa(document, `textarea${sel('cart-note')},input${sel('cart-note')}`).forEach((el) => {\n if (document.activeElement !== el) el.value = cart?.note || '';\n });\n\n qsa(document, sel('cart-discounts')).forEach((container) => {\n repeat(container, cart?.discountCodes || [], (node, d) => {\n node.setAttribute(attr('discount-code'), d.code);\n const t = node.querySelector(sel('discount', 'code')) || (node.firstElementChild ? null : node);\n if (t) setText(t, d.code);\n node.classList.toggle('is-inapplicable', !d.applicable);\n });\n });\n\n qsa(document, sel('cart-lines')).forEach((container) => {\n repeatKeyed(container, this.lines, (l) => l.id, (node, line) => renderLine(node, line), {\n onEnter: cfg.onLineEnter, onLeave: cfg.onLineLeave,\n });\n });\n\n if (cart) notifyLayoutChanged('cart');\n },\n};\n\nfunction lineValue(line, key) {\n const m = line.merchandise || {};\n const plan = line.sellingPlanAllocation?.sellingPlan;\n switch (key) {\n case 'title': return m.product?.title;\n case 'product-title': return m.product?.title;\n case 'variant-title': return m.title === 'Default Title' ? '' : m.title;\n case 'options': return (m.selectedOptions || [])\n .filter((o) => o.value !== 'Default Title').map((o) => `${o.name}: ${o.value}`).join(', ');\n case 'vendor': return m.product?.vendor;\n case 'sku': return m.sku;\n case 'price': return formatMoney(line.cost?.amountPerQuantity || m.price);\n case 'compare-at-price': return formatMoney(line.cost?.compareAtAmountPerQuantity || m.compareAtPrice);\n case 'line-total': return formatMoney(line.cost?.totalAmount);\n case 'line-subtotal': return formatMoney(line.cost?.subtotalAmount);\n case 'quantity': return line.quantity;\n case 'plan': return plan?.name || '';\n case 'plan-description': return plan?.description || '';\n case 'components': return (line.lineComponents || [])\n .map((c) => `${c.quantity} \u00D7 ${c.merchandise?.product?.title || ''}`).join(', ');\n default:\n if (key.startsWith('attribute:')) {\n const k = key.slice('attribute:'.length);\n return (line.attributes || []).find((a) => a.key === k)?.value || '';\n }\n return undefined;\n }\n}\n\nfunction renderLine(node, line) {\n const m = line.merchandise || {};\n const isSub = Boolean(line.sellingPlanAllocation);\n node.setAttribute(attr('line-id'), line.id);\n node.classList.toggle('is-subscription', isSub);\n\n qsa(node, sel('line')).forEach((el) => {\n const key = get(el, 'line');\n if (key === 'image') return setImage(el, m.image?.url || m.product?.featuredImage?.url, m.product?.title);\n if (key === 'url') return el.setAttribute('href', productUrl(m.product?.handle, m.product?.id));\n const v = lineValue(line, key);\n if (v !== undefined) setTextTracked(el, v);\n return undefined;\n });\n\n const lineConds = {\n subscription: isSub,\n 'one-time': !isSub,\n 'on-sale': parseFloat(line.cost?.compareAtAmountPerQuantity?.amount) > parseFloat(line.cost?.amountPerQuantity?.amount),\n 'has-components': (line.lineComponents || []).length > 0,\n };\n qsa(node, sel('line-show')).forEach((el) => {\n const k = get(el, 'line-show');\n if (k in lineConds) show(el, lineConds[k]);\n });\n\n // Change frequency in the cart: <select tether-line-plan> lists the product's plans.\n qsa(node, `select${sel('line-plan')}`).forEach((select) => {\n const handle = m.product?.handle;\n if (!handle) return;\n getProduct(handle).then((product) => {\n const plans = allPlans(product);\n const allowOneTime = !product.requiresSellingPlan && get(select, 'line-plan') !== 'subscription-only';\n const want = [\n ...(allowOneTime ? [{ value: '', label: select.getAttribute(attr('one-time-label')) || 'One-time purchase' }] : []),\n ...plans.map((p) => ({ value: p.id, label: p.name })),\n ];\n const sig = want.map((w) => w.value).join('|');\n if (select.dataset.tetherSig !== sig) {\n select.innerHTML = '';\n want.forEach((w) => {\n const o = document.createElement('option');\n o.value = w.value; o.textContent = w.label;\n select.appendChild(o);\n });\n select.dataset.tetherSig = sig;\n }\n select.value = line.sellingPlanAllocation?.sellingPlan?.id || '';\n show(select, plans.length > 0);\n }).catch((err) => reportError(err, 'line plan options'));\n });\n}\n\n", "/**\n * GraphQL fragments. Built at call time because counts and metafields come\n * from config. Operations put these AFTER the operation (see withContext).\n */\nimport { cfg } from './config.js';\n\nconst MONEY = 'amount currencyCode';\nconst IMAGE = 'url altText width height';\n\nexport function metafieldIdentifiers() {\n return (cfg.metafields || []).map((m) => {\n if (typeof m === 'string') {\n const i = m.indexOf('.');\n return { namespace: m.slice(0, i), key: m.slice(i + 1) };\n }\n return m;\n }).filter((m) => m.namespace && m.key);\n}\n\nfunction metafieldsField() {\n const ids = metafieldIdentifiers();\n if (!ids.length) return '';\n const list = ids\n .map((m) => `{namespace: ${JSON.stringify(m.namespace)}, key: ${JSON.stringify(m.key)}}`)\n .join(', ');\n return `metafields(identifiers:[${list}]){namespace key type value reference{... on MediaImage{image{${IMAGE}}}}}`;\n}\n\nexport const SELLING_PLAN_FIELDS = ` id name description recurringDeliveries options{name value}priceAdjustments{orderCount adjustmentValue{__typename ... on SellingPlanPercentagePriceAdjustment{adjustmentPercentage}... on SellingPlanFixedAmountPriceAdjustment{adjustmentAmount{${MONEY}}}... on SellingPlanFixedPriceAdjustment{price{${MONEY}}}}}`;\n\nexport const ALLOCATION_FIELDS = ` sellingPlan{id}checkoutChargeAmount{${MONEY}}remainingBalanceChargeAmount{${MONEY}}priceAdjustments{price{${MONEY}}compareAtPrice{${MONEY}}perDeliveryPrice{${MONEY}}unitPrice{${MONEY}}}`;\n\nexport function productFragment() {\n return ` fragment TetherProduct on Product{id handle title description descriptionHtml productType vendor tags availableForSale publishedAt onlineStoreUrl requiresSellingPlan seo{title description}featuredImage{${IMAGE}}images(first:${cfg.imagesFirst}){nodes{${IMAGE}}}options{name optionValues{name swatch{color image{previewImage{${IMAGE}}}}}}priceRange{minVariantPrice{${MONEY}}maxVariantPrice{${MONEY}}}compareAtPriceRange{minVariantPrice{${MONEY}}maxVariantPrice{${MONEY}}}${metafieldsField()} sellingPlanGroups(first:${cfg.sellingPlanGroupsFirst}){nodes{name appName options{name values}sellingPlans(first:${cfg.sellingPlansFirst}){nodes{${SELLING_PLAN_FIELDS}}}}}variants(first:${cfg.variantsFirst}){nodes{id title availableForSale currentlyNotInStock quantityAvailable sku barcode selectedOptions{name value}image{${IMAGE}}price{${MONEY}}compareAtPrice{${MONEY}}unitPrice{${MONEY}}sellingPlanAllocations(first:${cfg.sellingPlansFirst}){nodes{${ALLOCATION_FIELDS}}}}}}`;\n}\n\nexport function cartFragment() {\n return ` fragment TetherCart on Cart{id checkoutUrl totalQuantity note createdAt updatedAt attributes{key value}buyerIdentity{countryCode email}discountCodes{code applicable}cost{subtotalAmount{${MONEY}}totalAmount{${MONEY}}checkoutChargeAmount{${MONEY}}}lines(first:100){nodes{id quantity attributes{key value}cost{totalAmount{${MONEY}}subtotalAmount{${MONEY}}amountPerQuantity{${MONEY}}compareAtAmountPerQuantity{${MONEY}}}discountAllocations{discountedAmount{${MONEY}}}sellingPlanAllocation{sellingPlan{id name description recurringDeliveries options{name value}}checkoutChargeAmount{${MONEY}}priceAdjustments{price{${MONEY}}compareAtPrice{${MONEY}}perDeliveryPrice{${MONEY}}}}merchandise{... on ProductVariant{id title sku availableForSale requiresShipping image{${IMAGE}}price{${MONEY}}compareAtPrice{${MONEY}}selectedOptions{name value}product{id title handle vendor featuredImage{${IMAGE}}}}}... on ComponentizableCartLine{lineComponents{id quantity merchandise{... on ProductVariant{id title product{title handle}}}}}}}}`;\n}\n\nexport function collectionFields() {\n return `\n id handle title description descriptionHtml\n image { ${IMAGE} }\n seo { title description }`;\n}\n", "/**\n * Data loading. Products are batched per tick into one request and cached for\n * the lifetime of the page (survives Barba/Swup page swaps).\n */\nimport { cfg, log } from './config.js';\nimport { gql, TetherError } from './client.js';\nimport { productFragment, collectionFields } from './fragments.js';\n\nconst productCache = new Map(); // key -> Promise<product>\nlet pending = [];\nconst resolvers = new Map();\nlet scheduled = false;\n// Bumped by clearProductCache(): responses to requests sent before that (e.g. in the old\n// market after a country switch) still reach their callers but never refill the cache.\nlet generation = 0;\n\nconst isGid = (v) => typeof v === 'string' && v.startsWith('gid://');\n\n/** Accepts a handle, numeric id, gid or a full product URL. */\nexport function normalizeProductKey(raw) {\n const v = String(raw ?? '').trim();\n if (!v) return null;\n if (isGid(v)) return v;\n if (/^\\d+$/.test(v)) return `gid://shopify/Product/${v}`;\n const m = v.match(/\\/products\\/([^/?#]+)/);\n return m ? m[1] : v;\n}\n\n/** Put a product we already have (from a collection query) in the cache. */\nexport function primeProduct(product) {\n if (!product) return;\n const p = Promise.resolve(product);\n productCache.set(product.handle, p);\n productCache.set(product.id, p);\n}\n\nexport function getProduct(rawKey) {\n const key = normalizeProductKey(rawKey);\n if (!key) return Promise.reject(new TetherError('empty product key', { code: 'NOT_FOUND' }));\n if (productCache.has(key)) return productCache.get(key);\n\n const p = new Promise((resolve, reject) => {\n resolvers.set(key, { resolve, reject });\n pending.push(key);\n if (!scheduled) {\n scheduled = true;\n setTimeout(flush, 0);\n }\n });\n productCache.set(key, p);\n return p;\n}\n\nasync function flush() {\n scheduled = false;\n const gen = generation;\n const keys = pending.splice(0);\n if (!keys.length) return;\n\n const ids = keys.filter(isGid);\n const handles = keys.filter((k) => !isGid(k));\n const defs = [];\n const parts = [];\n const vars = {};\n\n if (ids.length) {\n defs.push('$ids: [ID!]!');\n vars.ids = ids;\n parts.push('byId: nodes(ids: $ids) { ... on Product { ...TetherProduct } }');\n }\n handles.forEach((h, i) => {\n defs.push(`$h${i}: String!`);\n vars[`h${i}`] = h;\n parts.push(`h${i}: product(handle: $h${i}) { ...TetherProduct }`);\n });\n\n const query = `query TetherProducts(${defs.join(',')}){${parts.join(' ')}}${productFragment()}`;\n log('fetch products', keys);\n\n const settle = (k, fn) => {\n const r = resolvers.get(k);\n resolvers.delete(k);\n if (r) fn(r);\n };\n\n try {\n const data = await gql(query, vars);\n const got = new Map();\n (data.byId || []).forEach((p) => { if (p) got.set(p.id, p); });\n handles.forEach((h, i) => { if (data[`h${i}`]) got.set(h, data[`h${i}`]); });\n\n keys.forEach((k) => settle(k, (r) => {\n if (got.has(k)) { if (gen === generation) primeProduct(got.get(k)); r.resolve(got.get(k)); } else {\n if (gen === generation) productCache.delete(k); // don't cache misses: a fix in Shopify works on next load\n r.reject(new TetherError(`Product not found: ${k}`, { code: 'NOT_FOUND' }));\n }\n }));\n } catch (err) {\n keys.forEach((k) => settle(k, (r) => { if (gen === generation) productCache.delete(k); r.reject(err); }));\n }\n}\n\nexport function clearProductCache() { productCache.clear(); generation++; }\n\n/**\n * A page of products from a collection (by handle) or from a search query.\n * Returns { collection, products, pageInfo }.\n */\nexport async function getProducts({\n collection, query, first = cfg.collectionFirst, after = null, sortKey, reverse = false, filters,\n} = {}) {\n const fragment = productFragment();\n\n if (collection) {\n const data = await gql(`query TetherCollection($handle:String!,$first:Int!,$after:String,$sortKey:ProductCollectionSortKeys,$reverse:Boolean,$filters:[ProductFilter!]){collection(handle:$handle){${collectionFields()} products(first:$first,after:$after,sortKey:$sortKey,reverse:$reverse,filters:$filters){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}}${fragment}`, {\n handle: collection, first, after, sortKey: sortKey || undefined, reverse, filters: filters || undefined,\n });\n if (!data.collection) throw new TetherError(`Collection not found: ${collection}`, { code: 'NOT_FOUND' });\n const { products, ...rest } = data.collection;\n products.nodes.forEach(primeProduct);\n return { collection: rest, products: products.nodes, pageInfo: products.pageInfo };\n }\n\n const data = await gql(`query TetherSearch($first:Int!,$after:String,$query:String,$sortKey:ProductSortKeys,$reverse:Boolean){products(first:$first,after:$after,query:$query,sortKey:$sortKey,reverse:$reverse){nodes{...TetherProduct}pageInfo{hasNextPage endCursor}}}${fragment}`, { first, after, query: query || undefined, sortKey: sortKey || undefined, reverse });\n data.products.nodes.forEach(primeProduct);\n return { collection: null, products: data.products.nodes, pageInfo: data.products.pageInfo };\n}\n\nexport async function getRecommendations(productId, intent = 'RELATED') {\n const data = await gql(`query TetherRecs($id:ID!,$intent:ProductRecommendationIntent){productRecommendations(productId:$id,intent:$intent){...TetherProduct}}${productFragment()}`, { id: productId, intent });\n const list = data.productRecommendations || [];\n list.forEach(primeProduct);\n return list;\n}\n", "/**\n * Pure helpers for Shopify selling plans (subscriptions). No DOM, easy to test.\n */\n\nexport const GID = {\n product: (v) => toGid(v, 'Product'),\n variant: (v) => toGid(v, 'ProductVariant'),\n sellingPlan: (v) => toGid(v, 'SellingPlan'),\n};\n\nexport function toGid(value, type) {\n const v = String(value ?? '').trim();\n if (!v) return null;\n if (v.startsWith('gid://')) return v;\n if (/^\\d+$/.test(v)) return `gid://shopify/${type}/${v}`;\n return v;\n}\n\n/** All plans of a product, flattened, each with its group attached. */\nexport function allPlans(product) {\n const groups = product?.sellingPlanGroups?.nodes || [];\n return groups.flatMap((g) => (g.sellingPlans?.nodes || []).map((p) => ({ ...p, group: g })));\n}\n\nexport function hasPlans(product) {\n return allPlans(product).length > 0;\n}\n\n/** The allocation of `planId` on `variant`, or null when the variant isn't in that plan. */\nexport function allocationFor(variant, planId) {\n if (!variant || !planId) return null;\n return (variant.sellingPlanAllocations?.nodes || []).find((a) => a.sellingPlan?.id === planId) || null;\n}\n\n/** Plans that can actually be bought with this variant. */\nexport function plansForVariant(product, variant) {\n return allPlans(product).filter((p) => allocationFor(variant, p.id));\n}\n\n/** Price per delivery for a variant on a plan (falls back to the one-time price). */\nexport function planPrice(variant, planId) {\n const a = allocationFor(variant, planId);\n const adj = a?.priceAdjustments?.[0];\n return adj?.perDeliveryPrice || adj?.price || variant?.price || null;\n}\n\n/** What the customer pays at checkout for this plan (prepaid plans charge more up front). */\nexport function planCheckoutCharge(variant, planId) {\n const a = allocationFor(variant, planId);\n return a?.checkoutChargeAmount || a?.priceAdjustments?.[0]?.price || variant?.price || null;\n}\n\n/** Savings of a plan vs the one-time price, as { amount, percentage }. */\nexport function planSavings(variant, planId) {\n const base = parseFloat(variant?.price?.amount);\n const sub = parseFloat(planPrice(variant, planId)?.amount);\n if (!Number.isFinite(base) || !Number.isFinite(sub) || base <= 0 || sub >= base) {\n return { amount: null, percentage: 0 };\n }\n return {\n amount: { amount: (base - sub).toFixed(2), currencyCode: variant.price.currencyCode },\n percentage: Math.round((1 - sub / base) * 100),\n };\n}\n\n/**\n * The plan's own discount description, independent of a variant:\n * '10%', or a fixed amount / fixed price.\n */\nexport function planAdjustment(plan) {\n const v = plan?.priceAdjustments?.[0]?.adjustmentValue;\n if (!v) return null;\n switch (v.__typename) {\n case 'SellingPlanPercentagePriceAdjustment': return { type: 'percentage', value: v.adjustmentPercentage };\n case 'SellingPlanFixedAmountPriceAdjustment': return { type: 'amount', value: v.adjustmentAmount };\n case 'SellingPlanFixedPriceAdjustment': return { type: 'price', value: v.price };\n default: return null;\n }\n}\n\n/**\n * Finds a plan by id, numeric id, name or option value (case-insensitive),\n * so Webflow editors can write tether-default-plan=\"Every month\".\n */\nexport function findPlan(product, ref) {\n if (!ref) return null;\n const plans = allPlans(product);\n const gid = GID.sellingPlan(ref);\n const needle = String(ref).trim().toLowerCase();\n return plans.find((p) => p.id === gid)\n || plans.find((p) => p.name.toLowerCase() === needle)\n || plans.find((p) => (p.options || []).some((o) => String(o.value).toLowerCase() === needle))\n || null;\n}\n", "/**\n * DOM helpers. Attribute names go through attr() so the prefix is configurable\n * (e.g. prefix: 'wfs' for markup that uses wfs-* attributes).\n */\nimport { cfg, warn } from './config.js';\n\nexport const attr = (name) => `${cfg.prefix}-${name}`;\nexport const sel = (name, value) =>\n value === undefined ? `[${attr(name)}]` : `[${attr(name)}=\"${value}\"]`;\nexport const get = (el, name) => el.getAttribute(attr(name));\nexport const has = (el, name) => el.hasAttribute(attr(name));\nexport const dataKey = () => `data-${cfg.prefix}-key`;\n\n/**\n * productPath '/product' -> /product/<handle>.\n * Templates: '/product?handle={handle}' (one static page for every product,\n * with tether-product=\"url:handle\"), '/p/{id}' (numeric product id).\n */\nexport function productUrl(handle, id) {\n const path = cfg.productPath || '/product';\n if (!/\\{(handle|id)\\}/.test(path)) return `${path.replace(/\\/$/, '')}/${handle}`;\n const numeric = id ? String(id).split('/').pop() : '';\n return path.replace(/\\{handle\\}/g, encodeURIComponent(handle || '')).replace(/\\{id\\}/g, encodeURIComponent(numeric));\n}\n\nexport const qsa = (root, s) => (root ? [...root.querySelectorAll(s)] : []);\n\n/** Elements in `root` whose nearest `scopeSelector` ancestor is `root` itself. */\nexport const scoped = (root, s, scopeSelector) =>\n qsa(root, s).filter((el) => el.closest(scopeSelector) === root);\n\nexport function emit(name, detail, target = document) {\n target.dispatchEvent(new CustomEvent(`${cfg.prefix}:${name}`, { detail, bubbles: true }));\n}\n\nexport function formatMoney(money) {\n if (!money) return '';\n if (typeof cfg.formatMoney === 'function') return cfg.formatMoney(money, cfg.locale);\n const amount = parseFloat(money.amount);\n if (Number.isNaN(amount)) return '';\n try {\n return new Intl.NumberFormat(cfg.locale || undefined, {\n style: 'currency', currency: money.currencyCode,\n }).format(amount);\n } catch {\n return `${money.currencyCode} ${amount.toFixed(2)}`;\n }\n}\n\nexport function formatDate(iso) {\n if (!iso) return '';\n try { return new Date(iso).toLocaleDateString(cfg.locale || undefined); } catch { return ''; }\n}\n\n/** Shopify CDN resize via max-width / max-height / crop attributes on the element. */\nexport function cdnUrl(url, el) {\n if (!url || !el) return url;\n const w = el.getAttribute('max-width');\n const h = el.getAttribute('max-height');\n const crop = el.getAttribute('crop');\n if (!w && !h) return url;\n try {\n const u = new URL(url);\n if (w) u.searchParams.set('width', w);\n if (h) u.searchParams.set('height', h);\n if (crop) u.searchParams.set('crop', crop);\n return u.toString();\n } catch { return url; }\n}\n\nexport function setImage(el, url, alt) {\n if (!url) return;\n const src = cdnUrl(url, el);\n if (el.tagName === 'IMG') {\n el.removeAttribute('srcset');\n el.removeAttribute('sizes');\n el.setAttribute('src', src);\n if (alt != null) el.setAttribute('alt', alt);\n if (!el.getAttribute('loading')) el.setAttribute('loading', 'lazy');\n } else {\n el.style.backgroundImage = `url(\"${src}\")`;\n }\n}\n\nexport function setText(el, v) {\n const text = v == null ? '' : String(v);\n if (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA') el.value = text;\n else el.textContent = text;\n}\n\nexport const readText = (el) => (el.tagName === 'INPUT' || el.tagName === 'TEXTAREA' ? el.value : el.textContent);\n\n/** setText that reports changes to cfg.onValueChange (for scramble/roll effects). */\nexport function setTextTracked(el, v) {\n const before = readText(el);\n setText(el, v);\n const after = readText(el);\n if (before !== after && el.dataset.tetherSeen && typeof cfg.onValueChange === 'function') {\n try { cfg.onValueChange(el, before); } catch { /* ignore */ }\n }\n el.dataset.tetherSeen = '1';\n}\n\nexport function show(el, visible) {\n const k = 'tetherPrevDisplay';\n if (visible) {\n if (el.dataset[k] !== undefined) {\n el.style.display = el.dataset[k];\n delete el.dataset[k];\n } else if (el.style.display === 'none') {\n el.style.display = '';\n }\n } else {\n if (el.dataset[k] === undefined) el.dataset[k] = el.style.display || '';\n el.style.display = 'none';\n }\n}\n\nexport function setSelected(el, selected) {\n el.classList.toggle('is-selected', selected);\n el.setAttribute('aria-pressed', selected ? 'true' : 'false');\n if (el.tagName === 'INPUT' && (el.type === 'radio' || el.type === 'checkbox')) el.checked = selected;\n const input = el.querySelector?.('input[type=\"radio\"],input[type=\"checkbox\"]');\n if (input) input.checked = selected;\n}\n\n// ---------------------------------------------------------------------------\n// Repeaters: the first child in Webflow is the template, the rest is removed.\n// ---------------------------------------------------------------------------\n\nconst templates = new WeakMap();\n\n/** True once a repeater's template has been captured (it may be empty after that). */\nexport const hasTemplate = (container) => Boolean(templates.get(container));\n\nfunction template(container) {\n if (!templates.has(container)) {\n const tpl = container.firstElementChild?.cloneNode(true) ?? null;\n templates.set(container, tpl);\n container.innerHTML = '';\n }\n return templates.get(container);\n}\n\n/** Rebuilds the list on every render. Fine for images, tags, options. */\nexport function repeat(container, items, render) {\n const tpl = template(container);\n if (!tpl) { warn('repeater without a template child', container); return; }\n container.innerHTML = '';\n items.forEach((item, i) => {\n const node = tpl.cloneNode(true);\n render(node, item, i);\n container.appendChild(node);\n });\n}\n\n/**\n * Keyed repeater: keeps existing nodes, inserts new ones, removes old ones.\n * Used for cart lines, so values can animate and lines can slide in/out.\n */\nexport function repeatKeyed(container, items, keyOf, render, { onEnter, onLeave } = {}) {\n const tpl = template(container);\n if (!tpl) { warn('repeater without a template child', container); return; }\n\n const KEY = dataKey();\n const LEAVING = `data-${cfg.prefix}-leaving`;\n const live = () => [...container.children].filter((n) => n.hasAttribute(KEY) && !n.hasAttribute(LEAVING));\n\n const existing = new Map(live().map((n) => [n.getAttribute(KEY), n]));\n const wanted = [];\n const fresh = new Set();\n\n items.forEach((item, i) => {\n const k = String(keyOf(item, i));\n let node = existing.get(k);\n if (node) existing.delete(k);\n else {\n node = tpl.cloneNode(true);\n node.setAttribute(KEY, k);\n fresh.add(node);\n }\n render(node, item, i, fresh.has(node));\n wanted.push(node);\n });\n\n const staying = wanted.filter((n) => !fresh.has(n));\n const current = live().filter((n) => staying.includes(n));\n const orderOk = current.length === staying.length && current.every((n, i) => n === staying[i]);\n\n if (!orderOk) {\n existing.forEach((n) => n.remove());\n wanted.forEach((n) => container.appendChild(n));\n return;\n }\n\n wanted.forEach((node, i) => {\n if (!fresh.has(node)) return;\n const prev = wanted[i - 1];\n if (prev && prev.parentNode === container) prev.after(node);\n else container.prepend(node);\n if (onEnter) { try { onEnter(node); } catch { /* ignore */ } }\n });\n\n existing.forEach((node) => {\n node.setAttribute(LEAVING, '');\n node.removeAttribute(KEY);\n node.style.pointerEvents = 'none';\n node.inert = true;\n const done = () => node.remove();\n if (onLeave) { try { onLeave(node, done); } catch { done(); } } else done();\n });\n}\n\n// ---------------------------------------------------------------------------\n// Layout notifications: async renders change page height after your\n// page-transition hooks ran. Debounced, then cfg.onLayoutChange or a default.\n// ---------------------------------------------------------------------------\n\nlet layoutTimer = null;\n\nexport function notifyLayoutChanged(reason) {\n clearTimeout(layoutTimer);\n layoutTimer = setTimeout(() => {\n if (typeof cfg.onLayoutChange === 'function') cfg.onLayoutChange(reason);\n else if (window.ScrollTrigger?.refresh) window.ScrollTrigger.refresh();\n emit('layout-changed', { reason });\n }, 120);\n}\n\nexport function watchImages(root, reason) {\n const imgs = qsa(root, 'img').filter((i) => !i.complete);\n if (!imgs.length) return;\n let left = imgs.length;\n const done = () => { if (--left === 0) notifyLayoutChanged(`${reason}:images`); };\n imgs.forEach((img) => {\n img.addEventListener('load', done, { once: true });\n img.addEventListener('error', done, { once: true });\n });\n}\n\nexport function busy(el, fn) {\n if (el.getAttribute('aria-busy') === 'true') return Promise.resolve();\n el.setAttribute('aria-busy', 'true');\n return Promise.resolve().then(fn).finally(() => el.removeAttribute('aria-busy'));\n}\n\nexport function parseJSONAttr(el, name) {\n const raw = el && get(el, name);\n if (!raw) return null;\n try { return JSON.parse(raw); } catch { warn(`invalid JSON in ${attr(name)}`, el); return null; }\n}\n\n/** {a: 1} or [{key, value}] -> [{key, value}] as Shopify wants it. */\nexport function toAttributes(obj) {\n if (!obj) return [];\n if (Array.isArray(obj)) return obj.map((a) => ({ key: String(a.key), value: String(a.value ?? '') }));\n return Object.entries(obj).map(([key, value]) => ({ key, value: String(value ?? '') }));\n}\n", "/**\n * ProductScope: everything inside [tether-product=\"<handle>\"] binds to one\n * Shopify product: options, variants, quantity, subscriptions, add to cart.\n */\nimport { cfg, reportError } from './config.js';\nimport {\n attr, sel, get, has, qsa, scoped, emit, formatMoney, formatDate, setText, setImage, show,\n setSelected, repeat, productUrl, notifyLayoutChanged, watchImages, busy, parseJSONAttr, toAttributes,\n} from './dom.js';\nimport { Cart } from './cart.js';\nimport { STATUS_KEYS, ownedBy } from './status.js';\nimport {\n allPlans, allocationFor, planPrice, planCheckoutCharge, planSavings, planAdjustment, findPlan, GID,\n} from './selling-plans.js';\n\nexport const scopes = new WeakMap(); // element -> ProductScope\n\nconst productSel = () => sel('product');\n\nfunction metafieldValue(product, ref) {\n const i = ref.indexOf('.');\n const ns = ref.slice(0, i);\n const key = ref.slice(i + 1);\n const mf = (product.metafields || []).find((m) => m && m.namespace === ns && m.key === key);\n return mf || null;\n}\n\nexport class ProductScope {\n constructor(root, product) {\n this.root = root;\n this.product = product;\n this.selected = {};\n this.variant = null;\n this.quantity = Math.max(0, parseInt(get(root, 'quantity') ?? '1', 10) || (has(root, 'quantity') ? 0 : 1));\n this.plans = allPlans(product);\n this.purchase = 'one-time';\n this.planId = null;\n\n scopes.set(root, this);\n root.setAttribute(attr('state'), 'ready');\n root.removeAttribute(attr('error'));\n\n this.initSelection();\n this.initPurchase();\n this.renderProduct();\n this.bind();\n this.renderVariant();\n\n watchImages(root, 'product');\n notifyLayoutChanged('product');\n emit('product-ready', { product, scope: this }, root);\n }\n\n /** New data for the same product (e.g. after a country switch). Keeps the selection. */\n update(product) {\n const variantId = this.variant?.id;\n this.product = product;\n this.plans = allPlans(product);\n if (this.planId && !this.plans.some((p) => p.id === this.planId)) this.planId = this.plans[0]?.id || null;\n if (!this.plans.length && this.purchase === 'subscription') this.purchase = 'one-time';\n const v = product.variants.nodes.find((x) => x.id === variantId);\n if (v) { this.selected = {}; v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; }); }\n this.root.setAttribute(attr('state'), 'ready');\n this.root.removeAttribute(attr('error'));\n this.renderProduct();\n this.renderVariant();\n notifyLayoutChanged('product');\n emit('product-updated', { product, scope: this }, this.root);\n }\n\n /** Matching elements in this scope, including the root itself (e.g. a card link with tether-bind=\"link\"). */\n $(s) {\n const inner = scoped(this.root, s, productSel());\n return this.root.matches(s) ? [this.root, ...inner] : inner;\n }\n\n // ------------------------------------------------------------ state\n\n initSelection() {\n const vs = this.product.variants.nodes;\n const first = vs.find((v) => v.availableForSale) || vs[0];\n if (first) first.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n\n const param = new URLSearchParams(window.location.search).get('variant') || get(this.root, 'variant');\n if (param) {\n const gid = GID.variant(param);\n const match = vs.find((v) => v.id === gid);\n if (match) {\n this.selected = {};\n match.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n }\n }\n }\n\n initPurchase() {\n if (!this.plans.length) return;\n const params = new URLSearchParams(window.location.search);\n const fromUrl = findPlan(this.product, params.get('selling_plan'));\n const fromAttr = findPlan(this.product, get(this.root, 'default-plan'));\n this.planId = (fromUrl || fromAttr || this.plans[0]).id;\n\n const wanted = fromUrl ? 'subscription' : (get(this.root, 'default-purchase') || cfg.defaultPurchase);\n this.purchase = this.product.requiresSellingPlan || wanted === 'subscription' ? 'subscription' : 'one-time';\n }\n\n findVariant() {\n return this.product.variants.nodes.find((v) =>\n v.selectedOptions.every((o) => this.selected[o.name] === o.value)) || null;\n }\n\n isValueAvailable(name, value) {\n return this.product.variants.nodes.some((v) =>\n v.availableForSale && v.selectedOptions.every((o) =>\n (o.name === name ? o.value === value : this.selected[o.name] === o.value)));\n }\n\n get plan() { return this.plans.find((p) => p.id === this.planId) || null; }\n\n /** True when the current variant can be bought on the selected plan. */\n get subscriptionAvailable() {\n return Boolean(this.variant && this.plans.some((p) => allocationFor(this.variant, p.id)));\n }\n\n get isSubscription() {\n return this.purchase === 'subscription' && Boolean(allocationFor(this.variant, this.planId));\n }\n\n /** What would be added to the cart right now. */\n getLine() {\n if (!this.variant) return null;\n const line = { merchandiseId: this.variant.id, quantity: this.quantity };\n if (this.isSubscription) line.sellingPlanId = this.planId;\n const attrs = this.collectAttributes();\n if (attrs.length) line.attributes = attrs;\n return line;\n }\n\n collectAttributes() {\n const fixed = toAttributes(parseJSONAttr(this.root, 'line-attributes'));\n const inputs = this.$(sel('line-attribute')).map((el) => {\n const key = get(el, 'line-attribute');\n let value;\n if (el.type === 'checkbox') value = el.checked ? (el.value && el.value !== 'on' ? el.value : 'Yes') : '';\n else if (el.type === 'radio') value = el.checked ? el.value : null;\n else value = el.value;\n return value == null || value === '' ? null : { key, value: String(value) };\n }).filter(Boolean);\n return [...fixed, ...inputs];\n }\n\n // ------------------------------------------------------------ actions\n\n select(name, value) {\n if (this.selected[name] === value) return;\n this.selected[name] = value;\n this.renderVariant();\n }\n\n selectVariant(id) {\n const v = this.product.variants.nodes.find((x) => x.id === GID.variant(id));\n if (!v) return;\n this.selected = {};\n v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n this.renderVariant();\n }\n\n setPurchase(mode) {\n const next = mode === 'subscription' ? 'subscription' : 'one-time';\n if (next === 'one-time' && this.product.requiresSellingPlan) return;\n if (this.purchase === next) return;\n this.purchase = next;\n this.renderVariant();\n }\n\n selectPlan(ref) {\n const p = findPlan(this.product, ref);\n if (!p) return;\n this.planId = p.id;\n this.purchase = 'subscription';\n this.renderVariant();\n }\n\n setQuantity(n) {\n const min = has(this.root, 'quantity') ? 0 : 1;\n this.quantity = Math.max(min, parseInt(n, 10) || 0);\n this.$(sel('qty')).forEach((i) => setText(i, this.quantity));\n this.renderVariant();\n }\n\n async addToCart() {\n if (!this.variant?.availableForSale) return null;\n const line = this.getLine();\n if (!line || line.quantity < 1) return null;\n const cart = await Cart.add(line);\n emit('product-added', { product: this.product, variant: this.variant, line }, this.root);\n return cart;\n }\n\n // ------------------------------------------------------------ events\n\n bind() {\n const own = (el) => el && el.closest(productSel()) === this.root;\n\n this.root.addEventListener('click', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n\n const opt = t.closest(sel('option-value'));\n if (own(opt) && opt.closest(sel('option-list'))) {\n e.preventDefault();\n this.select(get(opt.closest(sel('option-list')), 'option-list'), get(opt, 'option-value'));\n return;\n }\n\n const plan = t.closest(sel('plan-value'));\n if (own(plan)) { e.preventDefault(); this.selectPlan(get(plan, 'plan-value')); return; }\n\n const purchase = t.closest(`${sel('purchase')}:not(select)`);\n if (own(purchase)) {\n if (purchase.tagName !== 'INPUT') e.preventDefault();\n this.setPurchase(get(purchase, 'purchase'));\n return;\n }\n\n const plus = t.closest(sel('qty-plus'));\n if (own(plus)) { e.preventDefault(); this.setQuantity(this.quantity + 1); return; }\n const minus = t.closest(sel('qty-minus'));\n if (own(minus)) { e.preventDefault(); this.setQuantity(this.quantity - 1); return; }\n\n const add = t.closest(sel('add-to-cart'));\n if (own(add)) { e.preventDefault(); this.onAddClick(add); }\n });\n\n this.root.addEventListener('change', (e) => {\n const t = e.target;\n if (!own(t)) return;\n if (t.matches(`select${sel('option')}`)) this.select(get(t, 'option'), t.value);\n else if (t.matches(`select${sel('variant-select')}`)) this.selectVariant(t.value);\n else if (t.matches(`select${sel('plan')}`)) {\n if (t.value) this.selectPlan(t.value); else this.setPurchase('one-time');\n } else if (t.matches(`select${sel('purchase')}`)) this.setPurchase(t.value);\n else if (t.matches(sel('qty'))) this.setQuantity(t.value);\n });\n }\n\n onAddClick(btn) {\n const label = btn.querySelector(sel('add-label')) || btn;\n const busyText = get(btn, 'adding-text');\n const write = (txt) => setText(label, txt);\n if (label.dataset.tetherLabel === undefined) label.dataset.tetherLabel = label.tagName === 'INPUT' ? label.value : label.textContent;\n\n busy(btn, async () => {\n if (busyText) write(busyText);\n try { await this.addToCart(); } catch (err) {\n reportError(err, 'add to cart failed');\n emit('error', { error: err, context: 'add-to-cart' }, this.root);\n } finally {\n if (busyText) write(label.dataset.tetherLabel);\n }\n }).then(() => {\n // Restore mode-dependent labels (subscribe-text / soldout-text) after aria-busy is cleared.\n this.renderVariant();\n });\n }\n\n // ------------------------------------------------------------ render\n\n renderProduct() {\n const p = this.product;\n\n this.$(sel('bind')).forEach((el) => {\n const key = get(el, 'bind') || '';\n const txt = {\n title: p.title,\n 'description-text': p.description,\n vendor: p.vendor,\n type: p.productType,\n handle: p.handle,\n }[key];\n if (txt !== undefined) return setText(el, txt);\n switch (key) {\n case 'description': el.innerHTML = p.descriptionHtml || ''; return undefined;\n case 'published-at': return setText(el, formatDate(p.publishedAt));\n case 'min-price': return setText(el, formatMoney(p.priceRange.minVariantPrice));\n case 'max-price': return setText(el, formatMoney(p.priceRange.maxVariantPrice));\n case 'featured-image': return setImage(el, p.featuredImage?.url, p.featuredImage?.altText || p.title);\n case 'url':\n case 'link':\n el.setAttribute('href', productUrl(p.handle, p.id));\n if (key === 'url' && !el.firstElementChild && !el.textContent.trim()) setText(el, p.title);\n return undefined;\n case 'images':\n return repeat(el, p.images.nodes, (node, img) => {\n const target = node.matches(`img,${sel('bind', 'image')}`) ? node : node.querySelector('img') || node;\n setImage(target, img.url, img.altText || p.title);\n });\n case 'tags': {\n const exclude = (el.getAttribute('exclude') || '').split(',').map((s) => s.trim()).filter(Boolean);\n return repeat(el, p.tags.filter((t) => !exclude.includes(t)), (node, tag) => setText(node, tag));\n }\n default:\n // image:2 = the second product image (falls back to the featured image)\n if (/^image:\\d+$/.test(key)) {\n const img = p.images.nodes[key.slice(6) - 1] || p.featuredImage;\n return setImage(el, img?.url, img?.altText || p.title);\n }\n if (key.startsWith('metafield:')) {\n const mf = metafieldValue(p, key.slice(10));\n if (!mf) return setText(el, '');\n if (mf.reference?.image) return setImage(el, mf.reference.image.url, mf.reference.image.altText);\n if (/^(rich_text|multi_line_text)_field$/.test(mf.type)) el.style.whiteSpace = 'pre-line';\n return setText(el, mf.value);\n }\n return undefined;\n }\n });\n\n this.$(sel('option-list')).forEach((container) => {\n const name = get(container, 'option-list');\n const opt = p.options.find((o) => o.name === name);\n if (!opt || (opt.optionValues.length <= 1 && has(container, 'hide-single'))) return show(container, false);\n return repeat(container, opt.optionValues, (node, v) => {\n node.setAttribute(attr('option-value'), v.name);\n const t = node.querySelector(sel('bind', 'option-value'));\n if (t) setText(t, v.name); else if (!node.firstElementChild) setText(node, v.name);\n const sw = node.querySelector(sel('bind', 'swatch'));\n if (sw && v.swatch?.color) sw.style.backgroundColor = v.swatch.color;\n if (sw && v.swatch?.image?.previewImage) setImage(sw, v.swatch.image.previewImage.url, v.name);\n });\n });\n\n this.$(`select${sel('option')}`).forEach((s) => {\n const opt = p.options.find((o) => o.name === get(s, 'option'));\n if (!opt) return show(s, false);\n s.innerHTML = '';\n opt.optionValues.forEach((v) => s.appendChild(new Option(v.name, v.name)));\n return undefined;\n });\n\n this.$(`select${sel('variant-select')}`).forEach((s) => {\n s.innerHTML = '';\n p.variants.nodes.forEach((v) => s.appendChild(new Option(v.title, v.id)));\n });\n\n // Subscriptions\n this.$(sel('plan-list')).forEach((container) => {\n // Value = selling plan group name. Empty, \"true\", \"all\" or \"*\" = every plan\n // (Webflow's Designer doesn't always allow empty attribute values).\n const raw = (get(container, 'plan-list') || '').trim();\n const group = ['', 'true', 'all', '*'].includes(raw.toLowerCase()) ? null : raw;\n const plans = this.plans.filter((pl) => !group || pl.group.name === group);\n repeat(container, plans, (node, plan) => {\n node.setAttribute(attr('plan-value'), plan.id);\n if (!node.firstElementChild && !node.querySelector(sel('plan-bind'))) setText(node, plan.name);\n });\n });\n\n this.$(`select${sel('plan')}`).forEach((s) => {\n s.innerHTML = '';\n if (!p.requiresSellingPlan && get(s, 'plan') !== 'subscription-only') {\n s.appendChild(new Option(s.getAttribute(attr('one-time-label')) || 'One-time purchase', ''));\n }\n this.plans.forEach((pl) => s.appendChild(new Option(pl.name, pl.id)));\n });\n }\n\n renderVariant() {\n const p = this.product;\n let v = this.findVariant();\n if (!v) {\n [v] = p.variants.nodes;\n if (v) {\n this.selected = {};\n v.selectedOptions.forEach((o) => { this.selected[o.name] = o.value; });\n }\n }\n this.variant = v;\n if (!v) return;\n\n // A plan the variant isn't in -> pick the first one it is in.\n if (this.plans.length && !allocationFor(v, this.planId)) {\n const alt = this.plans.find((pl) => allocationFor(v, pl.id));\n if (alt) this.planId = alt.id;\n }\n\n const sub = this.isSubscription;\n const oneTimePrice = v.price;\n const subPrice = this.planId ? planPrice(v, this.planId) : null;\n const price = sub ? subPrice : oneTimePrice;\n const compareAt = sub ? (allocationFor(v, this.planId)?.priceAdjustments?.[0]?.compareAtPrice || v.compareAtPrice) : v.compareAtPrice;\n const onSale = compareAt && parseFloat(compareAt.amount) > parseFloat(price.amount);\n const discountPct = onSale ? Math.round((1 - parseFloat(price.amount) / parseFloat(compareAt.amount)) * 100) : 0;\n const savings = this.planId ? planSavings(v, this.planId) : { amount: null, percentage: 0 };\n const plan = this.plan;\n const total = { amount: (parseFloat(price.amount) * Math.max(1, this.quantity)).toFixed(2), currencyCode: price.currencyCode };\n\n const fm = formatMoney;\n const pct = (n) => (n ? `${n}%` : '');\n // Text binds: name -> value (functions, so only the binds on the page are computed).\n const text = {\n price: () => fm(price),\n 'total-price': () => fm(total),\n 'one-time-price': () => fm(oneTimePrice),\n 'subscription-price': () => fm(subPrice),\n 'subscription-savings': () => pct(savings.percentage),\n 'subscription-savings-amount': () => fm(savings.amount),\n 'checkout-charge': () => fm(sub ? planCheckoutCharge(v, this.planId) : price),\n 'plan-name': () => plan?.name,\n 'plan-description': () => plan?.description,\n 'plan-group': () => plan?.group?.name,\n 'compare-at-price': () => (onSale ? fm(compareAt) : ''),\n 'unit-price': () => fm(v.unitPrice),\n 'discount-percentage': () => `${discountPct}%`,\n 'discount-amount': () => (onSale ? fm({ amount: String(parseFloat(compareAt.amount) - parseFloat(price.amount)), currencyCode: price.currencyCode }) : ''),\n 'variant-title': () => v.title,\n 'variant-id': () => v.id,\n sku: () => v.sku,\n barcode: () => v.barcode,\n stock: () => v.quantityAvailable,\n quantity: () => this.quantity,\n };\n this.$(sel('bind')).forEach((el) => {\n const k = get(el, 'bind');\n if (k === 'variant-image') setImage(el, v.image?.url || p.featuredImage?.url, v.image?.altText || p.title);\n else if (text[k]) setText(el, text[k]());\n });\n\n this.$(sel('option-selected')).forEach((el) => setText(el, this.selected[get(el, 'option-selected')] || ''));\n\n this.$(sel('option-list')).forEach((container) => {\n const name = get(container, 'option-list');\n qsa(container, sel('option-value')).forEach((node) => {\n const value = get(node, 'option-value');\n setSelected(node, this.selected[name] === value);\n const unavailable = !this.isValueAvailable(name, value);\n node.classList.toggle('is-unavailable', unavailable);\n node.setAttribute('data-unavailable', unavailable ? 'true' : 'false');\n });\n });\n\n this.$(`select${sel('option')}`).forEach((s) => { s.value = this.selected[get(s, 'option')] || ''; });\n this.$(`select${sel('variant-select')}`).forEach((s) => { s.value = v.id; });\n\n // Subscription UI\n this.$(sel('purchase')).forEach((el) => {\n if (el.tagName === 'SELECT') { el.value = this.purchase; return; }\n const mode = get(el, 'purchase');\n setSelected(el, mode === this.purchase);\n const unavailable = mode === 'subscription' ? !this.subscriptionAvailable : p.requiresSellingPlan;\n el.classList.toggle('is-unavailable', unavailable);\n });\n\n this.$(sel('plan-value')).forEach((node) => {\n const id = get(node, 'plan-value');\n const planObj = this.plans.find((pl) => pl.id === id);\n const inVariant = Boolean(allocationFor(v, id));\n setSelected(node, sub && id === this.planId);\n node.classList.toggle('is-unavailable', !inVariant);\n qsa(node, sel('plan-bind')).forEach((el) => {\n const adj = planAdjustment(planObj);\n const s = planSavings(v, id);\n const k = get(el, 'plan-bind');\n const val = {\n name: () => planObj?.name,\n description: () => planObj?.description,\n price: () => fm(planPrice(v, id)),\n savings: () => pct(s.percentage),\n 'savings-amount': () => fm(s.amount),\n adjustment: () => (!adj ? '' : adj.type === 'percentage' ? `${adj.value}%` : fm(adj.value)),\n }[k];\n if (val) setText(el, val());\n });\n });\n\n this.$(`select${sel('plan')}`).forEach((s) => { s.value = sub ? this.planId : ''; });\n\n const conds = {\n 'in-stock': v.availableForSale,\n 'out-of-stock': !v.availableForSale,\n 'backorder': v.availableForSale && v.currentlyNotInStock,\n 'on-sale': Boolean(onSale),\n 'not-on-sale': !onSale,\n 'has-variants': p.variants.nodes.length > 1,\n 'single-variant': p.variants.nodes.length === 1,\n 'low-stock': v.quantityAvailable != null && v.quantityAvailable > 0 && v.quantityAvailable <= 5,\n 'subscription-available': this.subscriptionAvailable,\n 'subscription-unavailable': !this.subscriptionAvailable,\n 'subscription-only': Boolean(p.requiresSellingPlan),\n 'one-time-available': !p.requiresSellingPlan,\n 'subscription-selected': sub,\n 'one-time-selected': !sub,\n 'has-savings': sub ? savings.percentage > 0 : Boolean(onSale),\n // scope state (see status.js)\n 'loading': false,\n 'ready': true,\n 'error': false,\n 'not-found': false,\n };\n this.$(sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (!(k in conds)) return;\n // State blocks of a list nested in this product belong to that list.\n if (STATUS_KEYS.includes(k) && !ownedBy(el, this.root)) return;\n show(el, conds[k]);\n });\n\n this.root.classList.toggle('is-subscription', sub);\n this.root.setAttribute(attr('purchase-mode'), sub ? 'subscription' : 'one-time');\n\n this.$(sel('add-to-cart')).forEach((btn) => {\n const disabled = !v.availableForSale;\n btn.classList.toggle('is-disabled', disabled);\n btn.setAttribute('aria-disabled', String(disabled));\n if ('disabled' in btn) btn.disabled = disabled;\n const soldOut = get(btn, 'soldout-text');\n const subText = get(btn, 'subscribe-text');\n if (soldOut || subText) {\n const label = btn.querySelector(sel('add-label')) || btn;\n if (label.dataset.tetherLabel === undefined) label.dataset.tetherLabel = label.tagName === 'INPUT' ? label.value : label.textContent;\n let text = label.dataset.tetherLabel;\n if (sub && subText) text = subText;\n if (disabled && soldOut) text = soldOut;\n if (btn.getAttribute('aria-busy') !== 'true') setText(label, text);\n }\n });\n\n emit('variant-changed', {\n product: p, variant: v, selected: { ...this.selected },\n purchase: this.purchase, sellingPlanId: sub ? this.planId : null,\n }, this.root);\n }\n}\n", "/**\n * Where a product scope gets its key from, and the loading / ready / error /\n * not-found state of a scope (so a failing API never leaves a broken page).\n */\nimport { attr, sel, get, scoped, show } from './dom.js';\n\n/**\n * tether-product values:\n * \"coffee-box\" handle, numeric id, gid or product URL (as before)\n * \"url:handle\" ?handle=... from the page URL (any param name: \"url:p\" -> ?p=)\n * \"url:path\" the last segment of the page path (/shop/coffee-box -> coffee-box)\n * Returns { key, fromUrl, raw }. key is null when the URL has no value.\n */\nexport function resolveProductKey(el, location = window.location) {\n const raw = (get(el, 'product') || '').trim();\n if (!raw.toLowerCase().startsWith('url:')) return { key: raw || null, fromUrl: false, raw };\n const what = raw.slice(4).trim();\n let key = null;\n if (what.toLowerCase() === 'path') {\n const parts = location.pathname.split('/').filter(Boolean);\n key = parts.length ? safeDecode(parts[parts.length - 1]) : null;\n } else {\n key = new URLSearchParams(location.search).get(what || 'handle');\n }\n key = key && key.trim() ? key.trim() : null;\n return { key, fromUrl: true, raw };\n}\n\nfunction safeDecode(s) { try { return decodeURIComponent(s); } catch { return s; } }\n\n/** Values of tether-show that follow the scope state. */\nexport const STATUS_KEYS = ['loading', 'ready', 'error', 'not-found'];\n\nexport const isNotFound = (err) => err?.code === 'NOT_FOUND';\n\n/** Product scopes and lists both own their state elements; the nearest one wins. */\nexport const boundary = () => ['product', 'collection', 'products', 'recommendations'].map((n) => sel(n)).join(',');\n\n/** True when `el` belongs to the scope `root` (not to a nested product or list). */\nexport const ownedBy = (el, root) => el === root || el.parentElement?.closest(boundary()) === root;\n\n/**\n * Sets tether-state (loading | ready | error) and tether-error (not-found or an\n * error code) on `root`, toggles tether-show=\"loading|ready|error|not-found\"\n * inside it, and disables add-to-cart buttons when there's no product.\n */\nexport function setScopeStatus(root, status, err) {\n const notFound = status === 'not-found';\n root.setAttribute(attr('state'), notFound ? 'error' : status);\n if (status === 'error' || notFound) root.setAttribute(attr('error'), notFound ? 'not-found' : (err?.code || 'error'));\n else root.removeAttribute(attr('error'));\n\n scoped(root, sel('show'), boundary()).forEach((el) => {\n const k = get(el, 'show');\n if (!STATUS_KEYS.includes(k)) return;\n const visible = k === status;\n show(el, visible);\n // Blocks hidden by a Webflow class (display: none) still need to appear.\n if (visible && typeof getComputedStyle === 'function' && getComputedStyle(el).display === 'none') {\n el.style.display = el.getAttribute(attr('display')) || 'block';\n }\n });\n\n if (status === 'error' || notFound) {\n scoped(root, sel('add-to-cart'), boundary()).forEach((btn) => {\n btn.classList.add('is-disabled');\n btn.setAttribute('aria-disabled', 'true');\n if ('disabled' in btn) btn.disabled = true;\n });\n }\n}\n", "/**\n * Product lists: [tether-collection=\"handle\"] or [tether-products=\"search query\"].\n * The first child of [tether-list] is the card template; every card becomes a\n * product scope, so all product attributes work inside cards (including\n * quick-add with a subscription toggle).\n */\nimport { reportError } from './config.js';\nimport { attr, sel, get, has, scoped, emit, setText, setImage, repeat, notifyLayoutChanged, busy } from './dom.js';\nimport { getProducts, getRecommendations, getProduct } from './loader.js';\nimport { setScopeStatus, isNotFound } from './status.js';\n\nexport const listSelector = () => `${sel('collection')},${sel('products')},${sel('recommendations')}`;\n\nexport class ListScope {\n constructor(root) {\n this.root = root;\n this.products = [];\n this.pageInfo = null;\n this.collection = null;\n setScopeStatus(root, 'loading');\n root.addEventListener('click', (e) => {\n const more = e.target.closest?.(sel('load-more'));\n if (more && more.closest(listSelector()) === root) {\n e.preventDefault();\n busy(more, () => this.load(true));\n }\n });\n }\n\n $(s) { return scoped(this.root, s, listSelector()); }\n\n options() {\n const r = this.root;\n const opts = {\n first: parseInt(get(r, 'limit') || '', 10) || undefined,\n sortKey: get(r, 'sort') || undefined,\n reverse: get(r, 'reverse') === 'true',\n };\n if (has(r, 'collection')) opts.collection = get(r, 'collection');\n else opts.query = get(r, 'products') || '';\n return opts;\n }\n\n async load(more = false) {\n const token = (this.loadToken = (this.loadToken || 0) + 1);\n const stale = () => token !== this.loadToken;\n try {\n if (has(this.root, 'recommendations')) {\n const key = get(this.root, 'recommendations');\n const base = await getProduct(key);\n const recs = await getRecommendations(base.id, get(this.root, 'intent') || 'RELATED');\n if (stale()) return;\n const limit = parseInt(get(this.root, 'limit') || '', 10);\n this.products = limit ? recs.slice(0, limit) : recs;\n } else {\n const res = await getProducts({ ...this.options(), after: more ? this.pageInfo?.endCursor : null });\n if (stale()) return;\n this.collection = res.collection;\n this.pageInfo = res.pageInfo;\n this.products = more ? [...this.products, ...res.products] : res.products;\n }\n this.render();\n setScopeStatus(this.root, 'ready');\n emit('list-ready', { products: this.products, collection: this.collection }, this.root);\n } catch (err) {\n if (stale()) return;\n // Keep what's already rendered on a failed \"load more\"; otherwise show the error state.\n if (!more) setScopeStatus(this.root, isNotFound(err) ? 'not-found' : 'error', err);\n reportError(err, 'list load failed');\n emit('error', { error: err, context: 'list' }, this.root);\n }\n }\n\n render() {\n const c = this.collection;\n this.$(sel('collection-bind')).forEach((el) => {\n switch (get(el, 'collection-bind')) {\n case 'title': return setText(el, c?.title || '');\n case 'description': el.innerHTML = c?.descriptionHtml || ''; return undefined;\n case 'image': return setImage(el, c?.image?.url, c?.image?.altText || c?.title);\n case 'count': return setText(el, this.products.length);\n default: return undefined;\n }\n });\n\n this.$(sel('list')).forEach((container) => {\n repeat(container, this.products, (node, p) => {\n node.setAttribute(attr('product'), p.handle);\n node.removeAttribute(attr('state'));\n });\n // Cards are new elements: mount them (product data is already cached).\n emit('list-rendered', { container }, this.root);\n });\n\n const empty = this.products.length === 0;\n this.$(sel('show')).forEach((el) => {\n const k = get(el, 'show');\n if (k === 'list-empty') el.style.display = empty ? '' : 'none';\n if (k === 'list-filled') el.style.display = empty ? 'none' : '';\n });\n this.$(sel('load-more')).forEach((el) => { el.style.display = this.pageInfo?.hasNextPage ? '' : 'none'; });\n notifyLayoutChanged('list');\n }\n}\n\n", "/** Product scopes and lists that are mounted, shared by index.js and the optional markets part. */\nimport { cfg, log, warn, reportError } from './config.js';\nimport { ProductScope, scopes } from './product.js';\nimport { listSelector } from './collection.js';\nimport { getProduct } from './loader.js';\nimport { resolveProductKey, setScopeStatus, isNotFound } from './status.js';\nimport { attr, get, qsa, emit } from './dom.js';\n\nexport const mountedProducts = new WeakSet();\nexport const mountedLists = new WeakSet();\n// Live roots, for re-rendering after a country switch (pruned when disconnected).\nexport const liveProducts = new Set();\nexport const liveLists = new Set();\nconst requestToken = new WeakMap(); // product root -> latest request, so a slow old response can't win\n\nexport function pruneLive() {\n liveProducts.forEach((el) => { if (!el.isConnected) liveProducts.delete(el); });\n liveLists.forEach((l) => { if (!l.root.isConnected) liveLists.delete(l); });\n}\nexport function within(root, selector) {\n return [...(root.matches?.(selector) ? [root] : []), ...qsa(root, selector)];\n}\n\nexport /** Mounts one product root. Returns true when a product request was started. */\nfunction mountProduct(el) {\n if (mountedProducts.has(el)) return false;\n const { key, fromUrl, raw } = resolveProductKey(el);\n if (!key) {\n if (fromUrl) {\n // Dynamic product page opened without ?handle= (or an empty path).\n mountedProducts.add(el);\n setScopeStatus(el, 'not-found');\n emit('product-not-found', { key: null, source: raw }, el);\n } else if (!el.closest(listSelector())) {\n // List cards get their handle when the list renders.\n warn(`[${attr('product')}] without a value. Bind it to the Shopify handle field, or use \"url:handle\".`, el);\n }\n return false;\n }\n mountedProducts.add(el);\n liveProducts.add(el);\n const token = {};\n requestToken.set(el, token);\n const current = () => requestToken.get(el) === token;\n // A rendered scope keeps showing its content while it refreshes (e.g. country switch).\n if (!scopes.get(el)) setScopeStatus(el, 'loading');\n else el.setAttribute(attr('state'), 'updating');\n getProduct(key)\n .then((p) => {\n if (!current()) return;\n const existing = scopes.get(el);\n if (existing) existing.update(p);\n // eslint-disable-next-line no-new\n else new ProductScope(el, p);\n applyPageTitle(el, p);\n })\n .catch((err) => {\n if (!current()) return;\n const notFound = isNotFound(err);\n setScopeStatus(el, notFound ? 'not-found' : 'error', err);\n if (notFound) {\n emit('product-not-found', { key, source: raw }, el);\n // A typo in a URL isn't worth an alert; a CMS item pointing at a deleted product is.\n if (fromUrl) log(`product not found: ${key}`); else reportError(err, `product ${key}`);\n } else {\n reportError(err, `product ${key}`);\n emit('error', { error: err, context: 'product', key }, el);\n }\n });\n return true;\n}\n\n/** tether-page-title=\"{title} | My shop\" on a product root sets document.title (dynamic product pages). */\nfunction applyPageTitle(el, p) {\n const tpl = get(el, 'page-title');\n if (!tpl || typeof document === 'undefined') return;\n document.title = tpl.replace(/\\{title\\}/g, p.title).replace(/\\{vendor\\}/g, p.vendor || '').replace(/\\{type\\}/g, p.productType || '');\n}\n\n\n/** Product scopes that failed on a network/API error: loaded again when the browser is back online. */\nexport function retryFailed() {\n pruneLive();\n liveProducts.forEach((el) => {\n if (el.getAttribute(attr('state')) !== 'error' || el.getAttribute(attr('error')) === 'not-found') return;\n mountedProducts.delete(el);\n mountProduct(el);\n });\n}\n", "/**\n * <script> build: optional parts are separate files next to tether(.min).js, e.g.\n * tether.markets.min.js, loaded on first use. Override the folder with config.partsUrl.\n */\nimport * as config from './config.js';\nimport * as client from './client.js';\nimport * as dom from './dom.js';\nimport * as fragments from './fragments.js';\nimport * as loader from './loader.js';\nimport * as sellingPlans from './selling-plans.js';\nimport * as status from './status.js';\nimport * as cart from './cart.js';\nimport * as product from './product.js';\nimport * as collection from './collection.js';\nimport * as mounting from './mounting.js';\n\nconst { cfg } = config;\n\n/** The modules a part may use, shared instead of bundled twice (scripts/build.mjs maps imports to these). */\nexport const coreModules = {\n 'config.js': config, 'client.js': client, 'dom.js': dom, 'fragments.js': fragments, 'loader.js': loader,\n 'selling-plans.js': sellingPlans, 'status.js': status, 'cart.js': cart, 'product.js': product,\n 'collection.js': collection, 'mounting.js': mounting,\n};\n\nconst self = typeof document !== 'undefined' ? document.currentScript?.src || '' : '';\nconst parts = {};\n\nexport function loadPart(name) {\n if (parts[name]) return parts[name];\n const base = cfg.partsUrl || self.replace(/[^/]*$/, '');\n const min = /\\.min\\.js(\\?|$)/.test(self) || !self ? '.min' : '';\n const url = `${base.replace(/\\/?$/, '/')}tether.${name}${min}.js`;\n parts[name] = new Promise((resolve, reject) => {\n const s = document.createElement('script');\n s.src = url;\n s.async = true;\n s.onload = () => (window.Tether?.__parts?.[name] ? resolve(window.Tether.__parts[name]) : reject(new Error(`${url} did not register`)));\n s.onerror = () => { delete parts[name]; reject(new Error(`Could not load ${url}. Host it next to the Tether script, or set partsUrl.`)); };\n document.head.appendChild(s);\n });\n return parts[name];\n}\n", "/**\n * Tether \u2014 Shopify <-> Webflow (or any HTML) sync via the Storefront API.\n *\n * <script>window.TETHER_CONFIG = { domain: 'x.myshopify.com', token: '...' }</script>\n * <script src=\"tether.min.js\" defer></script>\n *\n * With page transitions (Barba, Swup): set autoMount: false, call\n * Tether.init() once and Tether.mount(container) after every page enter.\n */\nimport { cfg, configure, isConfigured, log, warn, reportError } from './config.js';\nimport { gql, TetherError, withContext } from './client.js';\nimport { Cart, focusables } from './cart.js';\nimport { scopes } from './product.js';\nimport { ListScope, listSelector } from './collection.js';\nimport {\n getProduct, getProducts, getRecommendations, clearProductCache, primeProduct, normalizeProductKey,\n} from './loader.js';\nimport * as plans from './selling-plans.js';\nimport { resolveProductKey } from './status.js';\nimport { attr, sel, get, qsa, emit, formatMoney, busy, parseJSONAttr, toAttributes } from './dom.js';\nimport { loadPart, coreModules } from './lazy.js';\nimport { mountedLists, liveLists, pruneLive, within, mountProduct, retryFailed } from './mounting.js';\n\nexport const VERSION = '0.4.0';\n\nlet initPromise = null;\nlet observer = null;\n\n/** Mount every product scope and product list inside `root`. Safe to call repeatedly. */\nexport function mount(root = document) {\n if (!isConfigured()) return 0;\n let count = 0;\n pruneLive(); // page transitions detach old roots: don't keep them alive\n\n within(root, listSelector()).forEach((el) => {\n if (mountedLists.has(el)) return;\n mountedLists.add(el);\n count++;\n const list = new ListScope(el);\n liveLists.add(list);\n el.addEventListener(`${cfg.prefix}:list-rendered`, (e) => mount(e.detail.container));\n list.load();\n });\n\n within(root, sel('product')).forEach((el) => { if (mountProduct(el)) count++; });\n\n // The country select lives in the optional markets part: load it only when the page uses it.\n if (within(root, `${sel('country-select')},${sel('country-bind')}`).length) {\n loadPart('markets').then((m) => m.renderCountrySelects(root)).catch((err) => reportError(err, 'markets'));\n }\n\n qsa(root, sel('account-link')).forEach((a) => {\n a.setAttribute('href', `https://${cfg.domain}/account`);\n });\n\n Cart.render();\n log(`mounted ${count} scope(s)`, root);\n return count;\n}\n\n// ---------------------------------------------------------------------------\n// Markets: country select + switching\n// ---------------------------------------------------------------------------\n\n/** Call before a page transition removes `root` (closes the drawer etc.). */\nexport function unmount() {\n Cart.close();\n}\n\nexport function getScope(el) {\n const root = el?.closest?.(sel('product'));\n return root ? scopes.get(root) || null : null;\n}\n\n// ---------------------------------------------------------------------------\n// Document-wide controls (delegated, so they survive page swaps)\n// ---------------------------------------------------------------------------\n\nlet controlsBound = false;\n\nfunction bindControls() {\n if (controlsBound) return;\n controlsBound = true;\n\n document.addEventListener('click', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n\n if (t.closest(sel('cart-open'))) { e.preventDefault(); Cart.toggle(); return; }\n if (t.closest(sel('cart-close'))) { e.preventDefault(); Cart.close(); return; }\n\n const clear = t.closest(sel('cart-clear'));\n if (clear) { e.preventDefault(); busy(clear, () => Cart.clear().catch((err) => reportError(err, 'cart clear'))); return; }\n\n const checkout = t.closest(sel('checkout'));\n if (checkout) { e.preventDefault(); busy(checkout, () => Cart.checkout()); return; }\n\n const line = t.closest(dataKeySel());\n if (line && line.closest(sel('cart-lines'))) {\n const id = line.getAttribute(`data-${cfg.prefix}-key`);\n const current = Cart.lines.find((l) => l.id === id);\n const run = (fn) => { e.preventDefault(); fn().catch((err) => reportError(err, 'cart line')); };\n if (t.closest(sel('line-remove'))) return run(() => Cart.removeLine(id));\n if (current && t.closest(sel('line-plus'))) return run(() => Cart.updateLine(id, current.quantity + 1));\n if (current && t.closest(sel('line-minus'))) return run(() => Cart.updateLine(id, current.quantity - 1));\n }\n\n const removeCode = t.closest(sel('discount-remove'));\n if (removeCode) {\n e.preventDefault();\n const code = removeCode.closest(sel('discount-code'))?.getAttribute(attr('discount-code'));\n if (code) Cart.removeDiscount(code).catch((err) => reportError(err, 'discount'));\n return;\n }\n\n const groupBtn = t.closest(sel('group-add'));\n if (groupBtn) { e.preventDefault(); busy(groupBtn, () => addGroup(groupBtn)); }\n });\n\n document.addEventListener('change', (e) => {\n const t = e.target;\n if (!t?.closest) return;\n const lineEl = t.closest(dataKeySel());\n const id = lineEl?.getAttribute(`data-${cfg.prefix}-key`);\n if (id && t.matches(`input${sel('line', 'quantity')}`)) {\n Cart.updateLine(id, parseInt(t.value, 10) || 0).catch((err) => reportError(err, 'cart line'));\n } else if (id && t.matches(`select${sel('line-plan')}`)) {\n Cart.updateLine(id, { sellingPlanId: t.value || null }).catch((err) => reportError(err, 'cart line plan'));\n } else if (t.matches(`select${sel('country-select')}`)) {\n if (t.value) setCountry(t.value).catch((err) => reportError(err, 'country'));\n } else if (t.matches(sel('cart-note'))) {\n Cart.setNote(t.value).catch((err) => reportError(err, 'cart note'));\n }\n });\n\n document.addEventListener('submit', (e) => {\n const form = e.target.closest?.(sel('discount-form'));\n if (!form) return;\n e.preventDefault();\n const input = form.querySelector(sel('discount-input')) || form.querySelector('input');\n const code = input?.value.trim();\n if (!code) return;\n busy(form, async () => {\n try {\n const cart = await Cart.applyDiscount(code);\n const ok = (cart?.discountCodes || []).find((d) => d.code.toLowerCase() === code.toLowerCase())?.applicable;\n form.classList.toggle('is-invalid', !ok);\n emit(ok ? 'discount-applied' : 'discount-invalid', { code }, form);\n if (ok && input) input.value = '';\n } catch (err) { form.classList.add('is-invalid'); reportError(err, 'discount'); }\n });\n });\n\n // Back online after a failed load: try the failed products and lists again.\n window.addEventListener('online', () => {\n retryFailed();\n liveLists.forEach((l) => { if (l.root.getAttribute(attr('state')) === 'error') l.load(); });\n });\n\n document.addEventListener('keydown', (e) => {\n if (!Cart.isOpen()) return;\n if (e.key === 'Escape') { Cart.close(); return; }\n if (e.key !== 'Tab' || cfg.cartFocus === false) return;\n // Keep Tab inside the open cart.\n const d = Cart.drawers().find((x) => x.classList.contains(cfg.cartDrawerOpenClass));\n const f = d ? focusables(d) : [];\n if (!f.length) return;\n const first = f[0];\n const last = f[f.length - 1];\n if (!d.contains(document.activeElement) || (e.shiftKey && document.activeElement === first) || (!e.shiftKey && document.activeElement === last)) {\n e.preventDefault();\n (e.shiftKey ? last : first).focus();\n }\n });\n}\n\nfunction dataKeySel() { return `[data-${cfg.prefix}-key]`; }\n\n/**\n * [tether-group] + [tether-group-add]: adds every product scope inside the\n * group in one request. Bundles, build-a-box, \"complete the set\".\n * Lines get attribute _group (and the group's tether-line-attributes).\n */\nexport async function addGroup(btn) {\n const group = btn.closest(sel('group'));\n if (!group) return null;\n const name = get(group, 'group');\n const extra = toAttributes(parseJSONAttr(group, 'line-attributes'));\n const groupAttrs = name ? [{ key: '_group', value: name }, ...extra] : extra;\n\n const lines = qsa(group, sel('product'))\n .map((el) => scopes.get(el))\n .filter((s) => s && s.variant?.availableForSale && s.quantity > 0)\n .map((s) => {\n const l = s.getLine();\n l.attributes = [...(l.attributes || []), ...groupAttrs];\n return l;\n });\n\n if (!lines.length) { warn('group-add: nothing selected'); return null; }\n try {\n const cart = await Cart.add(lines);\n emit('group-added', { group: name, lines }, group);\n return cart;\n } catch (err) { reportError(err, 'group add'); return null; }\n}\n\n// ---------------------------------------------------------------------------\n// Init\n// ---------------------------------------------------------------------------\n\nexport function init(overrides = {}) {\n if (initPromise && !Object.keys(overrides).length) return initPromise;\n configure({ ...(window.TETHER_CONFIG || {}), ...overrides });\n\n if (!isConfigured()) {\n warn('TETHER_CONFIG is missing domain or token. Tether is idle.');\n initPromise = Promise.resolve(null);\n return initPromise;\n }\n\n bindControls();\n if (cfg.observe) startObserver();\n\n initPromise = applyMarket(overrides).then(() => Cart.init()).then(async (cart) => {\n // A saved cart from another market: move it to this one, so prices match the page.\n const want = cfg.country ? String(cfg.country).toUpperCase() : null;\n if (cart && want && cart.buyerIdentity?.countryCode && cart.buyerIdentity.countryCode !== want) {\n try { cart = await Cart.setBuyerIdentity({ countryCode: want }, { create: false }); } catch (err) { reportError(err, 'cart country'); }\n }\n emit('ready', { cart });\n return api;\n });\n return initPromise;\n}\n\n/**\n * Detected market (saved choice, server hint, Webflow locale) wins over the static config.\n * Without markets.detect only the visitor's saved choice applies, read here without loading\n * the markets part.\n */\nasync function applyMarket(overrides) {\n const m = cfg.markets || {};\n if (m.detect === false) return;\n let market = null;\n if (m.detect) {\n try { market = (await loadPart('markets')).detectMarket(m); } catch (err) { reportError(err, 'markets'); return; }\n } else if (m.remember !== false) {\n try { market = JSON.parse(localStorage.getItem(`${cfg.prefix}:market:${cfg.domain}`) || 'null'); } catch { /* none */ }\n if (market && !/^[A-Z]{2}$/.test(market.country || '')) market = null;\n }\n if (!market) return;\n if (market.country) cfg.country = market.country;\n if (market.language) cfg.language = market.language;\n if (market.locale && !overrides.locale && !window.TETHER_CONFIG?.locale) cfg.locale = market.locale;\n log('market', market);\n}\n\n/** Tether.setCountry('DE'): loads the markets part on first use. */\nexport function setCountry(code, opts) {\n return loadPart('markets').then((m) => m.setCountry(code, opts));\n}\n\nfunction startObserver() {\n if (observer || typeof MutationObserver === 'undefined') return;\n let t = null;\n const queued = new Set();\n observer = new MutationObserver((muts) => {\n muts.forEach((m) => m.addedNodes.forEach((n) => { if (n.nodeType === 1) queued.add(n); }));\n clearTimeout(t);\n t = setTimeout(() => { queued.forEach((n) => { if (n.isConnected) mount(n); }); queued.clear(); }, 50);\n });\n observer.observe(document.body, { childList: true, subtree: true });\n}\n\nexport const api = {\n VERSION,\n init,\n mount,\n unmount,\n get config() { return cfg; },\n get ready() { return initPromise || Promise.resolve(null); },\n query: gql,\n withContext,\n cart: Cart,\n getProduct,\n getProducts,\n getRecommendations,\n getScope,\n addGroup,\n primeProduct,\n normalizeProductKey,\n clearProductCache,\n formatMoney,\n plans,\n TetherError,\n resolveProductKey,\n setCountry,\n detectMarket: (markets) => loadPart('markets').then((m) => m.detectMarket(markets || cfg.markets)),\n getLocalization: () => loadPart('markets').then((m) => m.getLocalization()),\n diagnose: (opts) => loadPart('diagnose').then((m) => m.diagnose({ ...opts, version: VERSION })),\n __core: coreModules,\n __parts: {},\n on(name, fn) {\n const h = (e) => fn(e.detail, e);\n document.addEventListener(`${cfg.prefix}:${name}`, h);\n return () => document.removeEventListener(`${cfg.prefix}:${name}`, h);\n },\n};\n\nexport default api;\n\n// Auto-start for the plain <script> setup.\nif (typeof window !== 'undefined' && typeof document !== 'undefined') {\n window.Tether = api;\n const auto = window.TETHER_CONFIG && window.TETHER_CONFIG.autoMount !== false;\n if (auto) {\n const start = () => init().then(() => mount(document));\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', start, { once: true });\n else start();\n }\n}\n"],
5
+ "mappings": "kGAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,cAAAE,GAAA,QAAAC,EAAA,cAAAC,GAAA,iBAAAC,GAAA,QAAAC,EAAA,gBAAAC,EAAA,SAAAC,IAIO,IAAMN,GAAW,CAEtB,OAAQ,GACR,MAAO,GACP,WAAY,UACZ,QAAS,OACT,SAAU,OACV,OAAQ,OACR,QAAS,KAGT,OAAQ,SACR,YAAa,WACb,eAAgB,cAGhB,WAAY,CAAC,EACb,YAAa,GACb,cAAe,IACf,uBAAwB,GACxB,kBAAmB,GACnB,gBAAiB,GACjB,QAAS,EAGT,WAAY,KACZ,oBAAqB,UACrB,cAAe,GACf,UAAW,GACX,eAAgB,QAGhB,gBAAiB,WAGjB,UAAW,GACX,QAAS,GACT,SAAU,KAGV,YAAa,KAGb,eAAgB,KAChB,WAAY,KACZ,YAAa,KACb,YAAa,KACb,YAAa,KACb,cAAe,KACf,QAAS,KAET,MAAO,EACT,EAEaC,EAAM,CAAE,GAAGD,EAAS,EAE1B,SAASE,GAAUK,EAAY,CAAC,EAAG,CACxC,cAAO,KAAKN,CAAG,EAAE,QAASO,GAAM,OAAOP,EAAIO,CAAC,CAAC,EAC7C,OAAO,OAAOP,EAAKD,GAAUO,CAAS,EAClCN,EAAI,SAAQA,EAAI,OAAS,OAAOA,EAAI,MAAM,EAAE,QAAQ,eAAgB,EAAE,EAAE,QAAQ,QAAS,EAAE,GAC1FA,EAAI,aAAYA,EAAI,WAAa,GAAGA,EAAI,MAAM,SAASA,EAAI,MAAM,IAClEA,EAAI,aAAe,YAAYK,EAAK,mFAAmF,EACpHL,CACT,CAEO,IAAME,GAAe,IAAM,GAAQF,E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ACjD,SAAS,aAAe,UAAW,SAAS,iBAAiB,mBAAoBiG,EAAO,CAAE,KAAM,EAAK,CAAC,EACrGA,EAAM,CACb",
6
+ "names": ["config_exports", "__export", "DEFAULTS", "cfg", "configure", "isConfigured", "log", "reportError", "warn", "overrides", "k", "a", "err", "context", "client_exports", "__export", "TetherError", "endpoint", "gql", "unwrap", "withContext", "TetherError", "message", "status", "errors", "userErrors", "code", "endpoint", "cfg", "withContext", "query", "ctx", "args", "sleep", "ms", "r", "gql", "variables", "context", "body", "attempt", "res", "err", "log", "json", "e", "unwrap", "payload", "name", "errs", "cart_exports", "__export", "Cart", "focusables", "toLineInput", "fragments_exports", "__export", "ALLOCATION_FIELDS", "SELLING_PLAN_FIELDS", "cartFragment", "collectionFields", "metafieldIdentifiers", "productFragment", "MONEY", "IMAGE", "metafieldIdentifiers", "cfg", "m", "i", "metafieldsField", "ids", "SELLING_PLAN_FIELDS", "ALLOCATION_FIELDS", "productFragment", "cartFragment", "collectionFields", "loader_exports", "__export", "clearProductCache", "getProduct", "getProducts", "getRecommendations", "normalizeProductKey", "primeProduct", "productCache", "pending", "resolvers", "scheduled", "generation", "isGid", "v", "normalizeProductKey", "raw", "m", "primeProduct", "product", "p", "getProduct", "rawKey", "key", "TetherError", "resolve", "reject", "flush", "gen", "keys", "ids", "handles", "k", "defs", "parts", "vars", "h", "i", "query", "productFragment", "log", "settle", "fn", "r", "data", "gql", "got", "err", "clearProductCache", "getProducts", "collection", "first", "cfg", "after", "sortKey", "reverse", "filters", "fragment", "collectionFields", "products", "rest", "getRecommendations", "productId", "intent", "list", "selling_plans_exports", "__export", "GID", "allPlans", "allocationFor", "findPlan", "hasPlans", "planAdjustment", "planCheckoutCharge", "planPrice", "planSavings", "plansForVariant", "toGid", "v", "value", "type", "product", "g", "p", "variant", "planId", "a", "adj", "base", "sub", "plan", "ref", "plans", "gid", "needle", "dom_exports", "__export", "attr", "busy", "cdnUrl", "dataKey", "emit", "formatDate", "formatMoney", "get", "has", "hasTemplate", "notifyLayoutChanged", "parseJSONAttr", "productUrl", "qsa", "readText", "repeat", "repeatKeyed", "scoped", "sel", "setImage", "setSelected", "setText", "setTextTracked", "show", "toAttributes", "watchImages", "attr", "name", "cfg", "sel", "value", "get", "el", "has", "dataKey", "productUrl", "handle", "id", "path", "numeric", "qsa", "root", "s", "scoped", "scopeSelector", "emit", "detail", "target", "formatMoney", "money", "amount", "formatDate", "iso", "cdnUrl", "url", "w", "h", "crop", "u", "setImage", "alt", "src", "setText", "v", "text", "readText", "setTextTracked", "before", "after", "show", "visible", "k", "setSelected", "selected", "input", "templates", "hasTemplate", "container", "template", "tpl", "repeat", "items", "render", "warn", "item", "i", "node", "repeatKeyed", "keyOf", "onEnter", "onLeave", "KEY", "LEAVING", "live", "n", "existing", "wanted", "fresh", "staying", "current", "prev", "done", "layoutTimer", "notifyLayoutChanged", "reason", "watchImages", "imgs", "left", "img", "busy", "fn", "parseJSONAttr", "raw", "toAttributes", "obj", "a", "key", "toLineInput", "input", "quantity", "opts", "src", "merchandiseId", "GID", "TetherError", "line", "plan", "attrs", "toAttributes", "mutation", "name", "args", "inner", "cartFragment", "FOCUSABLE", "returnFocus", "focusables", "d", "qsa", "el", "ariaState", "open", "sel", "b", "get", "cfg", "isMissingCart", "err", "Cart", "id", "fn", "run", "value", "emit", "cart", "reason", "data", "gql", "reportError", "buyerIdentity", "unwrap", "variables", "createInput", "cartId", "log", "lines", "l", "lineId", "patch", "p", "lineIds", "ids", "note", "obj", "merged", "a", "attributes", "v", "key", "codes", "discountCodes", "c", "code", "current", "create", "target", "tab", "url", "ds", "hadFocus", "count", "money", "k", "formatMoney", "setTextTracked", "hasSub", "conds", "show", "container", "repeat", "node", "attr", "t", "setText", "repeatKeyed", "renderLine", "notifyLayoutChanged", "lineValue", "m", "o", "isSub", "setImage", "productUrl", "lineConds", "select", "handle", "getProduct", "product", "plans", "allPlans", "want", "sig", "w", "product_exports", "__export", "ProductScope", "scopes", "status_exports", "__export", "STATUS_KEYS", "boundary", "isNotFound", "ownedBy", "resolveProductKey", "setScopeStatus", "resolveProductKey", "el", "location", "raw", "get", "what", "key", "parts", "safeDecode", "s", "STATUS_KEYS", "isNotFound", "err", "boundary", "n", "sel", "ownedBy", "root", "setScopeStatus", "status", "notFound", "attr", "scoped", "k", "visible", "show", "btn", "scopes", "productSel", "sel", "metafieldValue", "product", "ref", "i", "ns", "key", "m", "ProductScope", "root", "get", "has", "allPlans", "attr", "watchImages", "notifyLayoutChanged", "emit", "variantId", "p", "v", "x", "o", "s", "inner", "scoped", "vs", "first", "param", "gid", "GID", "match", "params", "fromUrl", "findPlan", "fromAttr", "wanted", "cfg", "name", "value", "allocationFor", "line", "attrs", "fixed", "toAttributes", "parseJSONAttr", "inputs", "el", "id", "mode", "next", "n", "min", "setText", "cart", "Cart", "own", "e", "t", "opt", "plan", "purchase", "plus", "minus", "add", "btn", "label", "busyText", "write", "txt", "busy", "err", "reportError", "formatDate", "formatMoney", "setImage", "productUrl", "repeat", "node", "img", "target", "exclude", "tag", "mf", "container", "show", "sw", "raw", "group", "plans", "pl", "alt", "sub", "oneTimePrice", "subPrice", "planPrice", "price", "compareAt", "onSale", "discountPct", "savings", "planSavings", "total", "fm", "pct", "text", "planCheckoutCharge", "k", "qsa", "setSelected", "unavailable", "planObj", "inVariant", "adj", "planAdjustment", "val", "conds", "STATUS_KEYS", "ownedBy", "disabled", "soldOut", "subText", "collection_exports", "__export", "ListScope", "listSelector", "listSelector", "sel", "ListScope", "root", "setScopeStatus", "e", "more", "busy", "s", "scoped", "r", "opts", "get", "has", "token", "stale", "key", "base", "getProduct", "recs", "getRecommendations", "limit", "res", "getProducts", "emit", "err", "isNotFound", "reportError", "c", "el", "setText", "setImage", "container", "repeat", "node", "p", "attr", "empty", "k", "notifyLayoutChanged", "mounting_exports", "__export", "liveLists", "liveProducts", "mountProduct", "mountedLists", "mountedProducts", "pruneLive", "retryFailed", "within", "mountedProducts", "mountedLists", "liveProducts", "liveLists", "requestToken", "pruneLive", "el", "l", "within", "root", "selector", "qsa", "mountProduct", "key", "fromUrl", "raw", "resolveProductKey", "setScopeStatus", "emit", "listSelector", "warn", "attr", "token", "current", "scopes", "getProduct", "p", "existing", "ProductScope", "applyPageTitle", "err", "notFound", "isNotFound", "log", "reportError", "tpl", "get", "retryFailed", "cfg", "config_exports", "coreModules", "client_exports", "dom_exports", "fragments_exports", "loader_exports", "selling_plans_exports", "status_exports", "cart_exports", "product_exports", "collection_exports", "mounting_exports", "self", "parts", "loadPart", "name", "base", "min", "url", "resolve", "reject", "s", "VERSION", "initPromise", "observer", "mount", "root", "isConfigured", "count", "pruneLive", "within", "listSelector", "el", "mountedLists", "list", "ListScope", "liveLists", "cfg", "e", "sel", "mountProduct", "loadPart", "m", "err", "reportError", "qsa", "a", "Cart", "log", "unmount", "getScope", "scopes", "controlsBound", "bindControls", "clear", "busy", "checkout", "line", "dataKeySel", "id", "current", "l", "run", "fn", "removeCode", "code", "attr", "groupBtn", "addGroup", "setCountry", "form", "input", "ok", "d", "emit", "retryFailed", "x", "f", "focusables", "first", "last", "btn", "group", "name", "get", "extra", "toAttributes", "parseJSONAttr", "groupAttrs", "lines", "s", "warn", "cart", "init", "overrides", "configure", "startObserver", "applyMarket", "want", "api", "market", "opts", "t", "queued", "muts", "n", "gql", "withContext", "getProduct", "getProducts", "getRecommendations", "primeProduct", "normalizeProductKey", "clearProductCache", "formatMoney", "selling_plans_exports", "TetherError", "resolveProductKey", "markets", "coreModules", "h", "index_default", "start"]
7
7
  }