{
  "version": 3,
  "sources": ["/cdn/shop/t/95/assets/font-faces-from-stylesheet.js?cb=20261119"],
  "sourcesContent": ["/**\n * Registers the @font-face rules of a stylesheet that loads without blocking the page, with `font-display: swap`.\n *\n * Markup (see snippets/font-apotek-cond.liquid):\n *   <link rel=\"stylesheet\" href=\"\u2026\" media=\"print\" crossorigin data-font-faces-source>\n *\n * The link is inert (`media=\"print\"`), so its own @font-face rules never apply; this script copies each one into a\n * FontFace with `display: swap` and adds it to `document.fonts`. The face is added unloaded: the browser fetches\n * a file only when text on the page uses it, and shows the fallback font until then, never invisible text.\n * The font URLs, weights and styles stay the stylesheet's, so a change in the kit reaches the page.\n *\n * `crossorigin` is required to read `sheet.cssRules` of another origin (the host must answer with\n * `Access-Control-Allow-Origin`; Adobe Fonts does). If the rules cannot be read the stylesheet is applied as a\n * normal one, so the font still loads, with the font-display the stylesheet declares.\n */\n(function registerFontFacesFromStylesheets() {\n  'use strict';\n\n  var SOURCE_SELECTOR = 'link[data-font-faces-source]';\n  var FONT_FACE_RULE = 5; // CSSRule.FONT_FACE_RULE\n  var COPIED_DESCRIPTORS = [\n    ['weight', 'font-weight'],\n    ['style', 'font-style'],\n    ['stretch', 'font-stretch'],\n    ['unicodeRange', 'unicode-range'],\n  ];\n\n  if (!('fonts' in document) || typeof FontFace !== 'function') return;\n\n  function createFontFace(rule) {\n    var declared = rule.style;\n    var descriptors = { display: 'swap' };\n    COPIED_DESCRIPTORS.forEach(function (pair) {\n      var value = declared.getPropertyValue(pair[1]);\n      if (value) descriptors[pair[0]] = value;\n    });\n    return new FontFace(declared.getPropertyValue('font-family'), declared.getPropertyValue('src'), descriptors);\n  }\n\n  function isFontFaceRule(rule) {\n    return rule.type === FONT_FACE_RULE;\n  }\n\n  function readRules(link) {\n    try {\n      return Array.prototype.slice.call(link.sheet.cssRules);\n    } catch (error) {\n      return null;\n    }\n  }\n\n  function registerFontFaces(link) {\n    var rules = readRules(link);\n    if (!rules) {\n      link.media = 'all';\n      return;\n    }\n    rules.filter(isFontFaceRule).forEach(function (rule) {\n      document.fonts.add(createFontFace(rule));\n    });\n  }\n\n  function whenLoaded(link) {\n    if (link.sheet) registerFontFaces(link);\n    else link.addEventListener('load', function () { registerFontFaces(link); }, { once: true });\n  }\n\n  document.querySelectorAll(SOURCE_SELECTOR).forEach(whenLoaded);\n})();\n"],
  "mappings": "CAeC,UAA4C,CAC3C,aAEA,IAAI,gBAAkB,+BAClB,eAAiB,EACjB,mBAAqB,CACvB,CAAC,SAAU,aAAa,EACxB,CAAC,QAAS,YAAY,EACtB,CAAC,UAAW,cAAc,EAC1B,CAAC,eAAgB,eAAe,CAClC,EAEA,GAAI,EAAE,UAAW,WAAa,OAAO,UAAa,WAAY,OAE9D,SAAS,eAAe,KAAM,CAC5B,IAAI,SAAW,KAAK,MAChB,YAAc,CAAE,QAAS,MAAO,EACpC,0BAAmB,QAAQ,SAAU,KAAM,CACzC,IAAI,MAAQ,SAAS,iBAAiB,KAAK,CAAC,CAAC,EACzC,QAAO,YAAY,KAAK,CAAC,CAAC,EAAI,MACpC,CAAC,EACM,IAAI,SAAS,SAAS,iBAAiB,aAAa,EAAG,SAAS,iBAAiB,KAAK,EAAG,WAAW,CAC7G,CAEA,SAAS,eAAe,KAAM,CAC5B,OAAO,KAAK,OAAS,cACvB,CAEA,SAAS,UAAU,KAAM,CACvB,GAAI,CACF,OAAO,MAAM,UAAU,MAAM,KAAK,KAAK,MAAM,QAAQ,CACvD,OAAS,MAAO,CACd,OAAO,IACT,CACF,CAEA,SAAS,kBAAkB,KAAM,CAC/B,IAAI,MAAQ,UAAU,IAAI,EAC1B,GAAI,CAAC,MAAO,CACV,KAAK,MAAQ,MACb,MACF,CACA,MAAM,OAAO,cAAc,EAAE,QAAQ,SAAU,KAAM,CACnD,SAAS,MAAM,IAAI,eAAe,IAAI,CAAC,CACzC,CAAC,CACH,CAEA,SAAS,WAAW,KAAM,CACpB,KAAK,MAAO,kBAAkB,IAAI,EACjC,KAAK,iBAAiB,OAAQ,UAAY,CAAE,kBAAkB,IAAI,CAAG,EAAG,CAAE,KAAM,EAAK,CAAC,CAC7F,CAEA,SAAS,iBAAiB,eAAe,EAAE,QAAQ,UAAU,CAC/D,GAAG",
  "names": []
}
