{
  "version": 3,
  "sources": ["/cdn/shop/t/8/assets/krtkl-category-page.js?rev=2"],
  "sourcesContent": ["(() => {\n  const categories = {\n    accessories: 'Accessories',\n    underwear: 'Underwear',\n    't-shirts': 'T-Shirts',\n    polo: 'Polo',\n    sweats: 'Sweats',\n    knitwear: 'Knitwear',\n    shirts: 'Shirts',\n    jackets: 'Jackets',\n    pants: 'Pants',\n    jerseys: 'Jerseys',\n    sets: 'Sets'\n  };\n  const category = new URLSearchParams(location.search).get('krtkl_category');\n  if (location.pathname !== '/collections/all' || !Object.hasOwn(categories, category)) return;\n\n  const classify = (title) => {\n    const name = title.toLowerCase();\n    if (/keyholder|\\bcap\\b|socks|mafla|\\bring\\b|belt|throw|tote bag/.test(name)) return 'accessories';\n    if (/brief/.test(name)) return 'underwear';\n    if (/polo/.test(name)) return 'polo';\n    if (/hoodie set|track\\s?set/.test(name)) return 'sets';\n    if (/pullover|crewneck|hoodie/.test(name)) return 'sweats';\n    if (/knitwear/.test(name)) return 'knitwear';\n    if (/button up/.test(name)) return 'shirts';\n    if (/jacket/.test(name)) return 'jackets';\n    if (/pants|jeans|short/.test(name)) return 'pants';\n    if (/jersey/.test(name)) return 'jerseys';\n    if (/\\btee\\b|t-shirt/.test(name)) return 't-shirts';\n    return null;\n  };\n\n  const wrapper = document.querySelector('.collection-wrapper');\n  const heading = document.querySelector('main h1');\n  if (!wrapper) return;\n  wrapper.hidden = true;\n  wrapper.style.display = 'none';\n  if (heading) heading.textContent = categories[category];\n  document.title = categories[category] + ' | KRTKL';\n\n  const style = document.createElement('style');\n  style.textContent =     '.krtkl-category-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:28px 12px;padding:20px max(20px,4vw) 64px}' +\n    '.krtkl-category-card{position:relative;min-width:0;color:inherit;text-decoration:none}' +\n    '.krtkl-category-card img{display:block;width:100%;aspect-ratio:1;object-fit:cover;background:#f2f2f2}' +\n    '.krtkl-category-card .title{display:block;margin-top:10px;font-size:13px;line-height:1.4;font-weight:600}' +\n    '.krtkl-category-card .price,.krtkl-category-card .status{display:block;margin-top:3px;font-size:12px;line-height:1.4}' +\n    '.krtkl-category-card .status{position:absolute;top:10px;right:10px;z-index:1;display:block;margin:0;padding:7px 10px;background:#fff;color:#111;font-size:12px;line-height:1.2}' +\n    '.krtkl-category-message{padding:30px max(20px,4vw) 70px}' +\n    '@media(max-width:749px){.krtkl-category-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 8px;padding:16px 12px 48px}}';\n  document.head.append(style);\n  const grid = document.createElement('div');\n  grid.className = 'krtkl-category-message';\n  grid.setAttribute('role', 'status');\n  grid.setAttribute('aria-label', categories[category] + ' products');\n  grid.textContent = 'Loading products...';\n  wrapper.after(grid);\n\n  const preview = new URLSearchParams(location.search).get('preview_theme_id');\n  const money = new Intl.NumberFormat('en-MY', { style: 'currency', currency: 'MYR', maximumFractionDigits: 2 });\n  const appendMessage = (message) => {\n    grid.className = 'krtkl-category-message';\n    grid.textContent = message;\n  };\n  const makeCard = (product) => {\n    const link = document.createElement('a');\n    link.className = 'krtkl-category-card';\n    const url = new URL('/products/' + encodeURIComponent(product.handle), location.origin);\n    if (preview) url.searchParams.set('preview_theme_id', preview);\n    link.href = url.href;\n    if (product.images && product.images[0]) {\n      const image = document.createElement('img');\n      const src = new URL(product.images[0].src);\n      src.searchParams.set('width', '600');\n      image.src = src.href;\n      image.alt = product.title;\n      image.loading = 'lazy';\n      link.append(image);\n    }\n    const title = document.createElement('span');\n    title.className = 'title';\n    title.textContent = product.title;\n    link.append(title);\n    const prices = (product.variants || []).map((variant) => Number(variant.price)).filter(Number.isFinite);\n    if (prices.length) {\n      const price = document.createElement('span');\n      price.className = 'price';\n      price.textContent = money.format(Math.min(...prices));\n      link.append(price);\n    }\n    if (!(product.variants || []).some((variant) => variant.available)) {\n      const status = document.createElement('span');\n      status.className = 'status';\n      status.textContent = 'Sold out';\n      link.append(status);\n    }\n    return link;\n  };\n\n  (async () => {\n    try {\n      const products = [];\n      for (let page = 1; page <= 20; page++) {\n        const response = await fetch('/products.json?limit=250&page=' + page, { credentials: 'same-origin' });\n        if (!response.ok) throw new Error('Catalog unavailable');\n        const data = await response.json();\n        if (!Array.isArray(data.products)) throw new Error('Invalid catalog');\n        products.push(...data.products);\n        if (data.products.length < 250) break;\n      }\n      const matched = products.filter((product) => classify(product.title) === category);\n      if (!matched.length) {\n        appendMessage('No products in this category yet.');\n        return;\n      }\n      grid.className = 'krtkl-category-grid';\n      grid.removeAttribute('role');\n      grid.replaceChildren(...matched.map(makeCard));\n    } catch (error) {\n      appendMessage('Products could not be loaded. Please refresh the page.');\n      console.error('[KRTKL category preview]', error);\n    }\n  })();\n})();\n"],
  "mappings": "CAAC,IAAM,CACL,MAAM,WAAa,CACjB,YAAa,cACb,UAAW,YACX,WAAY,WACZ,KAAM,OACN,OAAQ,SACR,SAAU,WACV,OAAQ,SACR,QAAS,UACT,MAAO,QACP,QAAS,UACT,KAAM,MACR,EACM,SAAW,IAAI,gBAAgB,SAAS,MAAM,EAAE,IAAI,gBAAgB,EAC1E,GAAI,SAAS,WAAa,oBAAsB,CAAC,OAAO,OAAO,WAAY,QAAQ,EAAG,OAEtF,MAAM,SAAY,OAAU,CAC1B,MAAM,KAAO,MAAM,YAAY,EAC/B,MAAI,6DAA6D,KAAK,IAAI,EAAU,cAChF,QAAQ,KAAK,IAAI,EAAU,YAC3B,OAAO,KAAK,IAAI,EAAU,OAC1B,yBAAyB,KAAK,IAAI,EAAU,OAC5C,2BAA2B,KAAK,IAAI,EAAU,SAC9C,WAAW,KAAK,IAAI,EAAU,WAC9B,YAAY,KAAK,IAAI,EAAU,SAC/B,SAAS,KAAK,IAAI,EAAU,UAC5B,oBAAoB,KAAK,IAAI,EAAU,QACvC,SAAS,KAAK,IAAI,EAAU,UAC5B,kBAAkB,KAAK,IAAI,EAAU,WAClC,IACT,EAEM,QAAU,SAAS,cAAc,qBAAqB,EACtD,QAAU,SAAS,cAAc,SAAS,EAChD,GAAI,CAAC,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