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,IAAM,EAAa,OAAI,YACpD,EAAO,UAAS,SAAS,GACvB,EAAS,EACT,GACF,IACA,EAAO,QAAQ,EAAK,SAAS,IAAM,EAAa,OAAI,eACtD,GAEJ,GACF,UAGA","file":"/npm/@alloc/fontfaceobserver-es@2.3.2/dist/fontfaceobserver.mjs","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@alloc/fontfaceobserver-es@2.3.2/dist/fontfaceobserver.mjs\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// src/dom.js\nfunction addListener(element, event, listener) {\n  element.addEventListener(event, listener);\n}\nfunction append(parent, child) {\n  parent.appendChild(child);\n}\nfunction createElement(tagName) {\n  return document.createElement(tagName);\n}\nfunction createText(text) {\n  return document.createTextNode(text);\n}\nfunction remove(element) {\n  element.parentNode && element.parentNode.removeChild(element);\n}\nfunction style(element, style2) {\n  element.style.cssText = style2;\n}\nfunction waitForBody(callback) {\n  return callback();\n}\n\n// src/ruler.js\nvar Ruler = class {\n  constructor(text) {\n    var style2 = \"max-width:none;display:inline-block;position:absolute;height:100%;width:100%;overflow:scroll;font-size:16px;\";\n    this.element = createElement(\"div\");\n    this.element.setAttribute(\"aria-hidden\", \"true\");\n    append(this.element, createText(text));\n    this.collapsible = createElement(\"span\");\n    this.expandable = createElement(\"span\");\n    this.collapsibleInner = createElement(\"span\");\n    this.expandableInner = createElement(\"span\");\n    this.lastOffsetWidth = -1;\n    style(this.collapsible, style2);\n    style(this.expandable, style2);\n    style(this.expandableInner, style2);\n    style(\n      this.collapsibleInner,\n      \"display:inline-block;width:200%;height:200%;font-size:16px;max-width:none;\"\n    );\n    append(this.collapsible, this.collapsibleInner);\n    append(this.expandable, this.expandableInner);\n    append(this.element, this.collapsible);\n    append(this.element, this.expandable);\n  }\n  /**\n   * @return {Element}\n   */\n  getElement() {\n    return this.element;\n  }\n  /**\n   * @param {string} font\n   */\n  setFont(font) {\n    style(\n      this.element,\n      \"max-width:none;min-width:20px;min-height:20px;display:inline-block;overflow:hidden;position:absolute;width:auto;margin:0;padding:0;top:-999px;white-space:nowrap;font-synthesis:none;font:\" + font + \";\"\n    );\n  }\n  /**\n   * @return {number}\n   */\n  getWidth() {\n    return this.element.offsetWidth;\n  }\n  /**\n   * @param {string} width\n   */\n  setWidth(width) {\n    this.element.style.width = width + \"px\";\n  }\n  /**\n   * @private\n   *\n   * @return {boolean}\n   */\n  reset() {\n    var offsetWidth = this.getWidth(), width = offsetWidth + 100;\n    this.expandableInner.style.width = width + \"px\";\n    this.expandable.scrollLeft = width;\n    this.collapsible.scrollLeft = this.collapsible.scrollWidth + 100;\n    if (this.lastOffsetWidth !== offsetWidth) {\n      this.lastOffsetWidth = offsetWidth;\n      return true;\n    } else {\n      return false;\n    }\n  }\n  /**\n   * @private\n   * @param {function(number)} callback\n   */\n  onScroll(callback) {\n    if (this.reset() && this.element.parentNode !== null) {\n      callback(this.lastOffsetWidth);\n    }\n  }\n  /**\n   * @param {function(number)} callback\n   */\n  onResize(callback) {\n    var that = this;\n    function onScroll() {\n      that.onScroll(callback);\n    }\n    addListener(this.collapsible, \"scroll\", onScroll);\n    addListener(this.expandable, \"scroll\", onScroll);\n    this.reset();\n  }\n};\n\n// src/observer.js\nvar FontFaceObserver = class _FontFaceObserver {\n  constructor(family, descriptors = {}, context = window) {\n    this[\"family\"] = family;\n    this[\"style\"] = descriptors.style || \"normal\";\n    this[\"weight\"] = descriptors.weight || \"normal\";\n    this[\"stretch\"] = descriptors.stretch || \"normal\";\n    this[\"context\"] = context;\n  }\n  /**\n   * @type {null|boolean}\n   */\n  static HAS_WEBKIT_FALLBACK_BUG = null;\n  /**\n   * @type {null|boolean}\n   */\n  static HAS_SAFARI_10_BUG = null;\n  /**\n   * @type {null|boolean}\n   */\n  static SUPPORTS_STRETCH = null;\n  /**\n   * @type {null|boolean}\n   */\n  static SUPPORTS_NATIVE_FONT_LOADING = null;\n  /**\n   * @type {number}\n   */\n  static DEFAULT_TIMEOUT = 3e3;\n  /**\n   * @return {string}\n   */\n  static getUserAgent = function() {\n    return window.navigator.userAgent;\n  };\n  /**\n   * @return {string}\n   */\n  static getNavigatorVendor = function() {\n    return window.navigator.vendor;\n  };\n  /**\n   * Returns true if this browser is WebKit and it has the fallback bug\n   * which is present in WebKit 536.11 and earlier.\n   *\n   * @return {boolean}\n   */\n  static hasWebKitFallbackBug = function() {\n    if (_FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG === null) {\n      var match = /AppleWebKit\\/([0-9]+)(?:\\.([0-9]+))/.exec(\n        _FontFaceObserver.getUserAgent()\n      );\n      _FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG = !!match && (parseInt(match[1], 10) < 536 || parseInt(match[1], 10) === 536 && parseInt(match[2], 10) <= 11);\n    }\n    return _FontFaceObserver.HAS_WEBKIT_FALLBACK_BUG;\n  };\n  /**\n   * Returns true if the browser has the Safari 10 bugs. The\n   * native font load API in Safari 10 has two bugs that cause\n   * the document.fonts.load and FontFace.prototype.load methods\n   * to return promises that don't reliably get settled.\n   *\n   * The bugs are described in more detail here:\n   *  - https://bugs.webkit.org/show_bug.cgi?id=165037\n   *  - https://bugs.webkit.org/show_bug.cgi?id=164902\n   *\n   * If the browser is made by Apple, and has native font\n   * loading support, it is potentially affected. But the API\n   * was fixed around AppleWebKit version 603, so any newer\n   * versions that that does not contain the bug.\n   *\n   * @return {boolean}\n   */\n  static hasSafari10Bug = function(context) {\n    if (_FontFaceObserver.HAS_SAFARI_10_BUG === null) {\n      if (_FontFaceObserver.supportsNativeFontLoading(context) && /Apple/.test(_FontFaceObserver.getNavigatorVendor())) {\n        var match = /AppleWebKit\\/([0-9]+)(?:\\.([0-9]+))(?:\\.([0-9]+))/.exec(\n          _FontFaceObserver.getUserAgent()\n        );\n        _FontFaceObserver.HAS_SAFARI_10_BUG = !!match && parseInt(match[1], 10) < 603;\n      } else {\n        _FontFaceObserver.HAS_SAFARI_10_BUG = false;\n      }\n    }\n    return _FontFaceObserver.HAS_SAFARI_10_BUG;\n  };\n  /**\n   * Returns true if the browser supports the native font loading\n   * API.\n   *\n   * @return {boolean}\n   */\n  static supportsNativeFontLoading = function(context) {\n    if (_FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING === null) {\n      _FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING = !!context.document[\"fonts\"];\n    }\n    return _FontFaceObserver.SUPPORTS_NATIVE_FONT_LOADING;\n  };\n  /**\n   * Returns true if the browser supports font-style in the font\n   * short-hand syntax.\n   *\n   * @return {boolean}\n   */\n  static supportStretch = function() {\n    if (_FontFaceObserver.SUPPORTS_STRETCH === null) {\n      var div = createElement(\"div\");\n      try {\n        div.style.font = \"condensed 100px sans-serif\";\n      } catch (e) {\n      }\n      _FontFaceObserver.SUPPORTS_STRETCH = div.style.font !== \"\";\n    }\n    return _FontFaceObserver.SUPPORTS_STRETCH;\n  };\n  /**\n   * @private\n   *\n   * @param {string} family\n   * @return {string}\n   */\n  getStyle(family) {\n    return [\n      this[\"style\"],\n      this[\"weight\"],\n      _FontFaceObserver.supportStretch() ? this[\"stretch\"] : \"\",\n      \"100px\",\n      family\n    ].join(\" \");\n  }\n  /**\n   * Returns the current time in milliseconds\n   *\n   * @return {number}\n   */\n  getTime() {\n    return (/* @__PURE__ */ new Date()).getTime();\n  }\n  /**\n   * @param {string=} text Optional test string to use for detecting if a font is available.\n   * @param {number=} timeout Optional timeout for giving up on font load detection and rejecting the promise (defaults to 3 seconds).\n   * @return {Promise.<fontface.FontFaceObserver.}\n   */\n  load(text, timeout) {\n    var that = this;\n    var testString = text || \"BESbswy\";\n    var timeoutId = 0;\n    var timeoutValue = timeout || _FontFaceObserver.DEFAULT_TIMEOUT;\n    var start = that.getTime();\n    return new Promise(function(resolve, reject) {\n      if (_FontFaceObserver.supportsNativeFontLoading(that[\"context\"]) && !_FontFaceObserver.hasSafari10Bug(that[\"context\"])) {\n        var loader = new Promise(function(resolve2, reject2) {\n          var check = function() {\n            var now = that.getTime();\n            if (now - start >= timeoutValue) {\n              reject2(new Error(\"\" + timeoutValue + \"ms timeout exceeded\"));\n            } else {\n              that[\"context\"].document.fonts.load(that.getStyle('\"' + that[\"family\"] + '\"'), testString).then(function(fonts) {\n                if (fonts.length >= 1) {\n                  resolve2();\n                } else {\n                  setTimeout(check, 25);\n                }\n              }, reject2);\n            }\n          };\n          check();\n        });\n        var timer = new Promise(function(resolve2, reject2) {\n          timeoutId = setTimeout(function() {\n            reject2(new Error(\"\" + timeoutValue + \"ms timeout exceeded\"));\n          }, timeoutValue);\n        });\n        Promise.race([timer, loader]).then(function() {\n          clearTimeout(timeoutId);\n          resolve(that);\n        }, reject);\n      } else {\n        waitForBody(function() {\n          var rulerA = new Ruler(testString);\n          var rulerB = new Ruler(testString);\n          var rulerC = new Ruler(testString);\n          var widthA = -1;\n          var widthB = -1;\n          var widthC = -1;\n          var fallbackWidthA = -1;\n          var fallbackWidthB = -1;\n          var fallbackWidthC = -1;\n          var container = createElement(\"div\");\n          function removeContainer() {\n            if (container.parentNode !== null) {\n              remove(container.parentNode, container);\n            }\n          }\n          function check() {\n            if (widthA != -1 && widthB != -1 || widthA != -1 && widthC != -1 || widthB != -1 && widthC != -1) {\n              if (widthA == widthB || widthA == widthC || widthB == widthC) {\n                if (_FontFaceObserver.hasWebKitFallbackBug()) {\n                  if (widthA == fallbackWidthA && widthB == fallbackWidthA && widthC == fallbackWidthA || widthA == fallbackWidthB && widthB == fallbackWidthB && widthC == fallbackWidthB || widthA == fallbackWidthC && widthB == fallbackWidthC && widthC == fallbackWidthC) {\n                    return;\n                  }\n                }\n                removeContainer();\n                clearTimeout(timeoutId);\n                resolve(that);\n              }\n            }\n          }\n          container.dir = \"ltr\";\n          rulerA.setFont(that.getStyle(\"sans-serif\"));\n          rulerB.setFont(that.getStyle(\"serif\"));\n          rulerC.setFont(that.getStyle(\"monospace\"));\n          append(container, rulerA.getElement());\n          append(container, rulerB.getElement());\n          append(container, rulerC.getElement());\n          append(that[\"context\"].document.body, container);\n          fallbackWidthA = rulerA.getWidth();\n          fallbackWidthB = rulerB.getWidth();\n          fallbackWidthC = rulerC.getWidth();\n          function checkForTimeout() {\n            var now = that.getTime();\n            if (now - start >= timeoutValue) {\n              removeContainer();\n              reject(new Error(\"\" + timeoutValue + \"ms timeout exceeded\"));\n            } else {\n              var hidden = that[\"context\"].document[\"hidden\"];\n              if (hidden === true || hidden === void 0) {\n                widthA = rulerA.getWidth();\n                widthB = rulerB.getWidth();\n                widthC = rulerC.getWidth();\n                check();\n              }\n              timeoutId = setTimeout(checkForTimeout, 50);\n            }\n          }\n          checkForTimeout();\n          rulerA.onResize(function(width) {\n            widthA = width;\n            check();\n          });\n          rulerA.setFont(that.getStyle('\"' + that[\"family\"] + '\",sans-serif'));\n          rulerB.onResize(function(width) {\n            widthB = width;\n            check();\n          });\n          rulerB.setFont(that.getStyle('\"' + that[\"family\"] + '\",serif'));\n          rulerC.onResize(function(width) {\n            widthC = width;\n            check();\n          });\n          rulerC.setFont(that.getStyle('\"' + that[\"family\"] + '\",monospace'));\n        });\n      }\n    });\n  }\n};\nexport {\n  FontFaceObserver\n};\n"]}