{"version":3,"sources":["jsdelivr-header.js","/npm/@mediamonks/fast-image-sequence@1.2.0/fast-image-sequence.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,MAAM,EACJ,MACA,OAAS,GACT,SAAW,EACX,WAAA,CAAY,GACV,KAAK,MAAQ,CACjB,CACE,SAAI,GACF,OAAO,KAAK,OAAO,MAAM,QAAkB,IAAZ,EAAE,SAAmB,KACxD,CACE,cAAM,GACJ,OAAO,IAAI,SAAQ,MAAO,EAAG,KAC3B,QAAmB,IAAf,KAAK,MACP,EAAE,KAAK,WACJ,CACH,MAAM,EAAI,KAAK,OAAO,KAAK,OAAO,OAAS,GAC3C,EAAI,EAAE,aAAa,MAAM,GAAM,EAAE,KAAI,OAAM,IAAM,MAAO,GAChE,IAEA,CACE,gBAAM,GACJ,OAAO,KAAK,OAAO,MAAM,GAAM,EAAE,aAAY,YACjD,CACE,YAAA,GACE,KAAK,OAAO,SAAS,GAAM,EAAE,gBACjC,CACE,KAAA,GACE,KAAK,OAAO,SAAS,GAAM,EAAE,SACjC,EAqBA,MAAM,EACJ,WAAY,EACZ,SAAU,EACV,MACA,OACA,QACA,WAAA,CAAY,EAAG,GACb,KAAK,QAAU,EAAG,KAAK,MAAQ,CACnC,CACE,SAAI,GACF,QAAoB,IAAhB,KAAK,SAAsB,KAAK,QAClC,OAAO,KAAK,MAClB,CACE,SAAI,CAAM,GACR,IAAM,KAAK,SAAW,KAAK,eAAgB,KAAK,OAAS,EAC7D,CACE,YAAI,GACF,OAAO,KAAK,QAAQ,YAAY,KAAK,MAAM,MAC/C,CACE,KAAA,GACE,KAAK,eAAgB,KAAK,YAAS,CACvC,CACE,gBAAM,GACJ,OAAO,KAAK,QAAQ,WAAW,KACnC,CACE,YAAA,GACE,KAAK,SAAW,KAAK,kBAAkB,aAAe,KAAK,OAAO,QAAS,KAAK,YAAS,GAAS,KAAK,SAAU,CACrH,EAGA,MAAM,EACJ,sBAAwB,CACtB,YAAQ,EAC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K,OAAS,GAAK,KAAK,QAAQ,eAChK,KAAK,aAAe,KAAK,QAAQ,cAAgB,KAAK,QAAQ,UAAU,EAAG,EAAG,KAAK,OAAO,MAAO,KAAK,OAAO,SAAU,KAAK,aAAe,KAAK,QAAQ,aAAe,KAAK,iBAAmB,KAAO,KAAK,QAAQ,UAAU,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,EAAG,KAAK,MAAQ,EAAG,KAAK,OAAS,GAAI,KAAK,eAAiB,GAAI,KAAK,aAAc,CACtU,CACE,OAAA,GACE,IAAK,MAAM,KAAK,KAAK,QACnB,KAAK,kBAAoB,EAAE,QAAQ,QAAU,KAAO,EAAE,SAAQ,IAAM,KAAK,sBAC/E,CACE,cAAA,CAAe,GACb,MAAM,EAAK,GAAM,GAAG,KAAK,IAAQ,IAAJ,GAAS,QAAQ,GAAG,SAAS,EAAG,QAC7D,IAAI,EAAI,GAAG,KAAK,QAAQ,kBAAkB,KAAK,OAAO,iBAAiB,KAAK,QAAQ,oBAAoB,KAAK,QAAQ,4BACzG,EAAE,KAAK,mCAAmC,KAAK,kBAAkB,KAAK,UAElF,IAAK,MAAM,KAAK,KAAK,QAAS,CAC5B,MAAQ,SAAU,EAAG,WAAY,EAAG,UAAW,EAAG,UAAW,GAAM,EAAE,gBACrE,GAAK,QAAQ,EAAE,UAhnBX,IAgnBqB,EAAE,KAAa,SAhnBtB,IAgnBiC,EAAE,KAAa,SAAW,YAAY,EAAE,mBAAmB,iBAAiB,KAAK,IAAI,EAAE,QAAQ,UAAY,eAAiB,MAErL,EAlpBA,SAAW,EAAG,GACZ,EAAE,YAAc,GAAG,GACrB,CAipBI,CAAE,EAAG,EACT,S","file":"/npm/@mediamonks/fast-image-sequence@1.2.0/fast-image-sequence.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/@mediamonks/fast-image-sequence@1.2.0/fast-image-sequence.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","class g {\n  index;\n  images = [];\n  priority = 0;\n  constructor(e) {\n    this.index = e;\n  }\n  get image() {\n    return this.images.find((e) => e.image !== void 0)?.image;\n  }\n  async getImage() {\n    return new Promise(async (e, t) => {\n      if (this.image !== void 0)\n        e(this.image);\n      else {\n        const s = this.images[this.images.length - 1];\n        s ? s.fetchImage().then((i) => e(i)).catch(() => t()) : t();\n      }\n    });\n  }\n  async fetchImage() {\n    return this.images.find((e) => e.available)?.fetchImage();\n  }\n  releaseImage() {\n    this.images.forEach((e) => e.releaseImage());\n  }\n  reset() {\n    this.images.forEach((e) => e.reset());\n  }\n}\nfunction v() {\n  const o = document.createElement(\"pre\");\n  return Object.assign(o.style, {\n    position: \"absolute\",\n    top: \"0\",\n    left: \"0\",\n    backgroundColor: \"rgba(0, 0, 0, 0.5)\",\n    color: \"white\",\n    padding: \"8px\",\n    fontSize: \"12px\",\n    zIndex: \"1000\",\n    lineHeight: \"20px\",\n    margin: 0,\n    width: \"calc(100% - 16px)\"\n  }), o;\n}\nfunction b(o, e) {\n  o.textContent = `${e}`;\n}\nclass I {\n  available = !0;\n  loading = !1;\n  frame;\n  _image;\n  context;\n  constructor(e, t) {\n    this.context = e, this.frame = t;\n  }\n  get image() {\n    if (this._image !== void 0 && !this.loading)\n      return this._image;\n  }\n  set image(e) {\n    e !== this._image && (this.releaseImage(), this._image = e);\n  }\n  get imageURL() {\n    return this.context.getImageURL(this.frame.index);\n  }\n  reset() {\n    this.releaseImage(), this._image = void 0;\n  }\n  async fetchImage() {\n    return this.context.fetchImage(this);\n  }\n  releaseImage() {\n    this._image && (this._image instanceof ImageBitmap && this._image.close(), this._image = void 0), this.loading = !1;\n  }\n}\nconst f = 0, x = 1, p = 2;\nclass m {\n  static defaultOptions = {\n    tarURL: void 0,\n    imageURL: void 0,\n    useWorker: !C(),\n    maxCachedImages: 32,\n    maxConnectionLimit: 4,\n    available: void 0,\n    image: void 0,\n    timeout: -1\n  };\n  options;\n  index = -0;\n  initialized = !1;\n  context;\n  constructor(e, t, s) {\n    this.context = e, this.index = t, this.options = { ...m.defaultOptions, ...s }, this.initFrames();\n  }\n  initFrames() {\n    this.context.frames.forEach((e) => e.images[this.index] ||= new I(this, e));\n  }\n  get type() {\n    return p;\n  }\n  get maxCachedImages() {\n    const e = this.initialized ? this.images.filter((t) => t.available).length : this.context.options.frames;\n    return u(Math.floor(this.options.maxCachedImages), 1, e);\n  }\n  get images() {\n    return this.context.frames.map((e) => e.images[this.index]);\n  }\n  /**\n   * Set the maximum number of images to cache.\n   * @param maxCache - The maximum number of images to cache.\n   * @param onProgress - A callback function that is called with the progress of the loading.\n   */\n  setMaxCachedImages(e, t) {\n    return this.options.maxCachedImages = e, this.context.onLoadProgress(t);\n  }\n  getImageURL(e) {\n  }\n  checkImageAvailability() {\n    for (const e of this.images)\n      e.available = this.available(e, e.available);\n    if (!this.images[0]?.available)\n      throw new Error(`No image available for index 0 in ImageSource${this.index} (${this.images[0]?.imageURL})`);\n  }\n  async loadResources() {\n    this.checkImageAvailability(), this.initialized = !0;\n  }\n  process(e) {\n    e();\n    let { numLoading: t, numLoaded: s } = this.getLoadStatus();\n    const i = this.options.maxConnectionLimit, a = this.images.filter((r) => r.available && r.image === void 0 && !r.loading && r.frame.priority).sort((r, h) => r.frame.priority - h.frame.priority), c = this.images.filter((r) => r.available && r.image !== void 0 && !r.loading).sort((r, h) => h.frame.priority - r.frame.priority).shift()?.frame.priority ?? 1e10;\n    for (; t < i && a.length > 0; ) {\n      const r = a.shift();\n      (r.frame.priority < c || s < this.maxCachedImages - t) && (r.loading = !0, this.fetchImage(r).then((h) => {\n        r.loading && (r.loading = !1, r.image = h, e(), this.releaseImageWithLowestPriority());\n      }).catch((h) => {\n        r.reset(), console.error(h);\n      })), t++;\n    }\n  }\n  getLoadStatus() {\n    const e = this.images.filter((a) => a.loading).length, t = this.images.filter((a) => a.image !== void 0).length, s = this.maxCachedImages;\n    return { progress: Math.max(0, t - e) / Math.max(1, s), numLoading: e, numLoaded: t, maxLoaded: s };\n  }\n  async fetchImage(e) {\n    return this.options.image ? this.options.image(e.frame.index) : new Promise((t, s) => {\n      s(\"Not implemented\");\n    });\n  }\n  destruct() {\n    this.images.forEach((e) => e.reset());\n  }\n  available(e, t = !0) {\n    return this.options.available ? t && this.options.available(e.frame.index) : t;\n  }\n  releaseImageWithLowestPriority() {\n    const e = this.images.filter((t) => t.image !== void 0 && !t.loading);\n    if (e.length > this.maxCachedImages) {\n      const t = e.sort((s, i) => s.frame.priority - i.frame.priority).pop();\n      t && t.releaseImage();\n    }\n  }\n}\nfunction y(o, e) {\n  return new Promise((t, s) => {\n    const i = new XMLHttpRequest();\n    i.open(\"GET\", o, !0), i.responseType = \"arraybuffer\", i.onprogress = function(a) {\n      if (a.lengthComputable && e) {\n        const n = a.loaded / a.total;\n        e(n);\n      }\n    }, i.onload = function() {\n      i.status === 200 ? (e && e(1), t(i.response)) : s(new Error(`Error ${i.status}: ${i.statusText}`));\n    }, i.onerror = function() {\n      s(new Error(\"Request failed\"));\n    }, i.send();\n  });\n}\nfunction L(o, e) {\n  return new Promise((t, s) => {\n    o.onerror = (i) => s(i), o.decoding = \"async\", o.src = e, o.decode().then(() => {\n      t(o);\n    }).catch((i) => {\n      console.error(i), s(i);\n    });\n  });\n}\nconst R = `let buffer;\n\nself.onmessage = async (e) => {\n    if (e.data.cmd === 'init') {\n        buffer = e.data.buffer;\n    } else if (e.data.cmd === 'load') {\n        loadImage(e.data.offset, e.data.size, e.data.index);\n    }\n};\n\nasync function loadImage(offset, size, index) {\n    const view = new Uint8Array(buffer, offset, size);\n    const blob = new Blob([view], {});\n    const imageBitmap = await createImageBitmap(blob);\n    postMessage({msg: 'done', imageBitmap, index}, [imageBitmap]);\n}`;\nclass F {\n  fileInfo = [];\n  buffer;\n  options;\n  worker;\n  resolve = [];\n  defaultOptions = {\n    useWorker: !0\n  };\n  constructor(e, t = {}) {\n    this.buffer = e, this.options = { ...this.defaultOptions, ...t };\n    let s = 0;\n    for (; s < this.buffer.byteLength - 512; ) {\n      const i = this.readFileName(s);\n      if (i.length == 0)\n        break;\n      const a = this.readFileSize(s);\n      this.fileInfo.push({\n        name: i,\n        size: a,\n        header_offset: s\n      }), s += 512 + 512 * Math.trunc(a / 512), a % 512 && (s += 512);\n    }\n  }\n  getInfo(e) {\n    return this.fileInfo.find((t) => t.name.includes(e));\n  }\n  getImage(e, t) {\n    return this.options.useWorker ? (this.worker || (this.worker = this.createWorker()), new Promise((s, i) => {\n      const a = this.getInfo(e);\n      a && !this.resolve[t] ? (this.resolve[t] = s, this.worker.postMessage({ cmd: \"load\", offset: a.header_offset + 512, size: a.size, index: t })) : i(\"Image already loading from tar\");\n    })) : new Promise((s, i) => {\n      const a = this.getBlob(e, \"image\");\n      a !== void 0 ? createImageBitmap(a).then((n) => {\n        s(n);\n      }).catch(() => {\n        i();\n      }) : i();\n    });\n  }\n  destruct() {\n    this.worker && this.worker.terminate(), this.resolve = [];\n  }\n  readFileName(e) {\n    const t = new Uint8Array(this.buffer, e, 100), s = t.indexOf(0);\n    return new TextDecoder().decode(t.slice(0, s));\n  }\n  readFileSize(e) {\n    const t = new Uint8Array(this.buffer, e + 124, 12);\n    let s = \"\";\n    for (let i = 0; i < 11; i++)\n      s += String.fromCharCode(t[i]);\n    return parseInt(s, 8);\n  }\n  // worker functionality\n  getBlob(e, t = \"\") {\n    const s = this.getInfo(e);\n    if (s) {\n      const i = new Uint8Array(this.buffer, s.header_offset + 512, s.size);\n      return new Blob([i], { type: t });\n    }\n  }\n  createWorker() {\n    const e = new Blob([R], { type: \"application/javascript\" }), t = new Worker(URL.createObjectURL(e));\n    return t.addEventListener(\"message\", (s) => {\n      const i = this.resolve[s.data.index];\n      this.resolve[s.data.index] = void 0, i ? i(s.data.imageBitmap) : s.data.imageBitmap.close();\n    }), t.postMessage({ cmd: \"init\", buffer: this.buffer }, [this.buffer]), t;\n  }\n}\nclass k extends m {\n  tarball;\n  tarLoadProgress = 0;\n  get type() {\n    return x;\n  }\n  async loadResources() {\n    if (this.options.tarURL !== void 0) {\n      const e = await y(this.options.tarURL, (t) => {\n        this.tarLoadProgress = t;\n      });\n      this.tarball = new F(e, { useWorker: this.options.useWorker }), this.context.log(\"Tarball\", this.tarball);\n    }\n    return super.loadResources();\n  }\n  getImageURL(e) {\n    return this.options.imageURL ? this.options.imageURL(e) : void 0;\n  }\n  getLoadStatus() {\n    const e = super.getLoadStatus();\n    return e.progress = this.tarLoadProgress / 2 + e.progress / 2, e;\n  }\n  async fetchImage(e) {\n    return new Promise((t, s) => {\n      e.available ? this.tarball?.getImage(e.imageURL || \"\", e.frame.index).then((i) => {\n        t(i);\n      }).catch((i) => {\n        s(i);\n      }) : s(`Image not available or already loading ${e.imageURL} ${e.loading}`);\n    });\n  }\n  destruct() {\n    super.destruct(), this.tarball?.destruct(), this.tarball = void 0;\n  }\n  available(e, t = !0) {\n    return t = t && e.imageURL !== void 0 && this.tarball?.getInfo(e.imageURL) !== void 0, super.available(e, t);\n  }\n}\nconst P = `self.onmessage = async (e) => {\n    if (e.data.cmd === 'load') {\n        await loadImage(e.data.url, e.data.index);\n    }\n};\n\nasync function loadImage(url, index) {\n    const response = await fetch(url);\n    if (!response.ok) throw \"network error\";\n    const imageBitmap = await createImageBitmap(await response.blob());\n    postMessage({msg: 'done', imageBitmap, index}, [imageBitmap]);\n}`;\nclass U {\n  index = -1e10;\n  worker;\n  resolve;\n  constructor() {\n    const e = new Blob([P], { type: \"application/javascript\" }), t = new Worker(URL.createObjectURL(e));\n    t.addEventListener(\"message\", (s) => {\n      this.resolve && s.data.index === this.index ? this.resolve(s.data.imageBitmap) : s.data.imageBitmap.close();\n    }), this.worker = t;\n  }\n  load(e, t) {\n    return this.index = e, new Promise((s, i) => {\n      this.resolve = s, this.worker.postMessage({ cmd: \"load\", url: t, index: e });\n    });\n  }\n  abort() {\n    this.index = -1e10, this.resolve = void 0;\n  }\n}\nconst d = [];\nfunction z() {\n  return d.length === 0 && d.push(new U()), d.shift();\n}\nfunction O(o) {\n  o.abort(), d.push(o);\n}\nclass A extends m {\n  get type() {\n    return f;\n  }\n  getImageURL(e) {\n    return this.options.imageURL ? new URL(this.options.imageURL(e), window.location.href).href : void 0;\n  }\n  async fetchImage(e) {\n    return new Promise((t, s) => {\n      if (e.imageURL)\n        if (this.options.useWorker) {\n          const i = z();\n          i.load(this.index, e.imageURL).then((a) => {\n            t(a), O(i);\n          }).catch((a) => s(a));\n        } else {\n          const i = new Image();\n          L(i, e.imageURL).then(() => {\n            t(i);\n          }).catch((a) => s(a));\n        }\n      else\n        s(\"Image url not set or image already loading\");\n    });\n  }\n}\nfunction C() {\n  return typeof navigator < \"u\" && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);\n}\nfunction u(o, e, t) {\n  return Math.min(Math.max(o, e), t);\n}\nclass w {\n  static defaultOptions = {\n    frames: 1,\n    src: [],\n    loop: !1,\n    poster: void 0,\n    fillStyle: \"#00000000\",\n    objectFit: \"cover\",\n    clearCanvas: !1,\n    // clear canvas before drawing\n    showDebugInfo: !1,\n    name: \"FastImageSequence\",\n    horizontalAlign: 0.5,\n    verticalAlign: 0.5,\n    scale: 1\n  };\n  canvas;\n  options;\n  width = 0;\n  height = 0;\n  frame = 0;\n  log;\n  frames = [];\n  sources = [];\n  context;\n  tickFunctions = [];\n  startTime = -1;\n  animationRequestId = 0;\n  container;\n  resizeObserver;\n  mutationObserver;\n  inViewportObserver;\n  forceRedraw = !0;\n  speed = 0;\n  prevFrame = 0;\n  direction = 1;\n  lastFrameDrawn = -1;\n  destructed = !1;\n  logElement;\n  initialized = !1;\n  posterImage;\n  timeFrameVisible = 0;\n  lastImageDrawn;\n  inViewport = !1;\n  containerWidth = 0;\n  containerHeight = 0;\n  /**\n   * Creates an instance of FastImageSequence.\n   *\n   * @param {HTMLElement} container - The HTML element where the image sequence will be displayed.\n   * @param {FastImageSequenceOptions} options - The options for the image sequence.\n   *\n   * @throws {Error} If the number of frames is less than or equal to 0.\n   */\n  constructor(e, t) {\n    if (this.options = { ...w.defaultOptions, ...t }, this.options.frames <= 0)\n      throw new Error(\"FastImageSequence: frames must be greater than 0\");\n    this.container = e, this.canvas = document.createElement(\"canvas\"), this.context = this.canvas.getContext(\"2d\"), this.context.fillStyle = this.options.fillStyle, this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), Object.assign(this.canvas.style, {\n      inset: \"0\",\n      width: \"100%\",\n      height: \"100%\",\n      margin: \"0\",\n      display: \"block\"\n    }), this.container.appendChild(this.canvas), this.resizeObserver = new ResizeObserver(() => {\n      this.forceRedraw = !0, this.containerWidth = e.offsetWidth, this.containerHeight = e.offsetHeight, this.lastFrameDrawn < 0 && this.posterImage && this.drawImage(this.posterImage);\n    }), this.resizeObserver.observe(this.canvas), this.mutationObserver = new MutationObserver(() => {\n      this.container.isConnected || (console.error(\"FastImageSequence: container is not connected to the DOM, fast image sequence will be destroyed\"), this.destruct());\n    }), this.mutationObserver.observe(e, { childList: !0 }), this.inViewportObserver = new IntersectionObserver((i) => {\n      for (const a of i)\n        this.inViewport = a.isIntersecting;\n    }), this.inViewportObserver.observe(this.canvas), this.frames = Array.from({ length: this.options.frames }, (i, a) => new g(a)), this.log = this.options.showDebugInfo ? console.log : () => {\n    };\n    const s = this.options.src instanceof Array ? this.options.src : [this.options.src];\n    this.sources = s.map((i, a) => i.tarURL !== void 0 ? new k(this, a, i) : i.imageURL !== void 0 ? new A(this, a, i) : new m(this, a, i)), this.loadResources().then(() => {\n      this.initialized = !0, this.log(\"Frames\", this.frames), this.log(\"Options\", this.options), this.options.showDebugInfo && (this.logElement = v(), this.container.appendChild(this.logElement), this.tick(() => this.logDebugStatus(this.logElement))), this.drawingLoop(-1);\n    });\n  }\n  /**\n   * Get whether the image sequence is playing.\n   */\n  get playing() {\n    return this.speed !== 0;\n  }\n  /**\n   * Get whether the image sequence is paused.\n   */\n  get paused() {\n    return !this.playing;\n  }\n  /**\n   * Get the current progress of the image sequence loading.\n   */\n  get loadProgress() {\n    return this.sources.reduce((e, t) => e + t.getLoadStatus().progress, 0) / this.sources.length;\n  }\n  /**\n   * Get the current progress of the image sequence.\n   * @returns {number} - The current progress of the image sequence.\n   */\n  get progress() {\n    return this.index / (this.options.frames - 1);\n  }\n  /**\n   * Set the current progress of the image sequence.\n   * @param {number} value - The progress value to set.\n   */\n  set progress(e) {\n    this.frame = (this.options.frames - 1) * e;\n  }\n  /**\n   * Set the scale of the image sequence. Default is 1.\n   * @param value\n   */\n  set scale(e) {\n    this.forceRedraw = this.options.scale !== e, this.options.scale = e;\n  }\n  /**\n   * Get the scale of the image sequence.\n   * @returns {number} - The scale of the image sequence.\n   */\n  get scale() {\n    return this.options.scale;\n  }\n  /**\n   * Set the horizontal alignment of the image sequence. Default is 0.5.\n   * @param value\n   */\n  set horizontalAlign(e) {\n    this.forceRedraw = this.options.scale !== e, this.options.horizontalAlign = e;\n  }\n  /**\n   * Get the horizontal alignment of the image sequence.\n   */\n  get horizontalAlign() {\n    return this.options.horizontalAlign;\n  }\n  /**\n   * Set the vertical alignment of the image sequence. Default is 0.5.\n   * @param value\n   */\n  set verticalAlign(e) {\n    this.forceRedraw = this.options.scale !== e, this.options.verticalAlign = e;\n  }\n  /**\n   * Get the vertical alignment of the image sequence.\n   */\n  get verticalAlign() {\n    return this.options.verticalAlign;\n  }\n  /**\n   * Get the first ImageSource from the sources array.\n   * @returns {ImageSource} - The first ImageSource object in the sources array.\n   */\n  get src() {\n    return this.sources[0];\n  }\n  /**\n   * Set number of frames in the image sequence.\n   */\n  set frameCount(e) {\n    for (const s of this.frames)\n      s.reset();\n    this.forceRedraw = !0;\n    const t = Math.max(1, e | 0);\n    this.options.frames = t, t < this.frames.length ? this.frames = Array.from({ length: t }, (s, i) => new g(i)) : t > this.frames.length && (this.frames = this.frames.concat(Array.from({ length: t - this.frames.length }, (s, i) => new g(i + this.frames.length))));\n    for (const s of this.sources)\n      s.initFrames(), s.checkImageAvailability();\n  }\n  /**\n   * Get number of frames in the image sequence.\n   */\n  get frameCount() {\n    return this.options.frames;\n  }\n  get index() {\n    return this.wrapIndex(this.frame);\n  }\n  /**\n   * Returns a promise that resolves when the image sequence is ready to play.\n   */\n  ready() {\n    return new Promise((e) => {\n      const t = () => {\n        this.sources.every((s) => s.initialized) ? e() : setTimeout(t, 16);\n      };\n      t();\n    });\n  }\n  /**\n   * Register a tick function to be called on every frame update.\n   *\n   * @param func - The function to be called.\n   */\n  tick(e) {\n    this.tickFunctions.push(e);\n  }\n  /**\n   * Start playing the image sequence at a specified frame rate.\n   * @param {number} [fps=30] - The frame rate to play the sequence at.\n   */\n  play(e = 30) {\n    this.speed = e;\n  }\n  /**\n   * Stop playing the image sequence.\n   */\n  stop() {\n    this.speed = 0;\n  }\n  /**\n   * Get the image of a specific frame.\n   * @param {number} index - The index of the frame.\n   * @returns {Promise<HTMLImageElement | ImageBitmap | undefined>} - A promise that resolves with the image of the frame.\n   */\n  async getFrameImage(e) {\n    return await this.frames[this.wrapIndex(e)].fetchImage();\n  }\n  /**\n   * Register a callback function that is called with the progress of the loading.\n   * The function returns a promise that resolves when progress reaches 1.\n   * @param onProgress - A callback function that is called with the progress of the loading.\n   */\n  async onLoadProgress(e) {\n    let t = this.loadProgress;\n    return new Promise((s) => {\n      const i = () => {\n        this.loadProgress >= 1 ? (e && e(1), s(!0)) : (e && t !== this.loadProgress && (e(this.loadProgress), t = this.loadProgress), setTimeout(i, 16));\n      };\n      i();\n    });\n  }\n  /**\n   * Destruct the FastImageSequence instance.\n   */\n  destruct() {\n    this.destructed || (this.destructed = !0, this.animationRequestId && cancelAnimationFrame(this.animationRequestId), this.resizeObserver.disconnect(), this.mutationObserver.disconnect(), this.inViewportObserver.disconnect(), this.container.removeChild(this.canvas), this.logElement && (this.container.removeChild(this.logElement), this.logElement = void 0), this.canvas.replaceWith(this.canvas.cloneNode(!0)), this.sources.forEach((e) => e.destruct()), this.frames.forEach((e) => e.releaseImage()));\n  }\n  /**\n   * Set the size and alignment of the image sequence on the canvas.\n   *\n   * @param {Partial<FastImageSequenceDisplayOptions>} options - An object containing the size and alignment options.\n   * @property {string} options.objectFit - How the image should be resized to fit the canvas. It can be either 'contain' or 'cover'.\n   * @property {number} options.horizontalAlign - The horizontal alignment of the image. It should be a number between 0 and 1.\n   * @property {number} options.verticalAlign - The vertical alignment of the image. It should be a number between 0 and 1.\n   */\n  setDisplayOptions(e) {\n    this.options = { ...this.options, ...e }, this.forceRedraw = !0;\n  }\n  setLoadingPriority() {\n    const e = this.index;\n    for (const t of this.frames)\n      t.priority = Math.abs(t.index + 0.25 - e), this.options.loop && (t.priority = Math.min(t.priority, this.options.frames - t.priority));\n  }\n  async loadResources() {\n    if (this.options.poster) {\n      this.log(\"Poster image\", this.options.poster);\n      const e = new Image();\n      e.src = this.options.poster, await e.decode().then(() => {\n        this.posterImage = e, this.lastFrameDrawn < 0 && this.drawImage(this.posterImage);\n      }).catch((t) => this.log(t));\n    }\n    await Promise.all(this.sources.map((e) => e.loadResources())), await this.getFrameImage(0);\n  }\n  wrapIndex(e) {\n    const t = e | 0;\n    return this.wrapFrame(t);\n  }\n  wrapFrame(e) {\n    return this.options.loop ? (e % this.options.frames + this.options.frames) % this.options.frames : u(e, 0, this.options.frames - 1);\n  }\n  async drawingLoop(e = 0) {\n    if (this.destructed)\n      return;\n    e /= 1e3;\n    const t = this.initialized ? this.startTime < 0 ? 1 / 60 : Math.min(e - this.startTime, 1 / 30) : 0;\n    if (this.startTime = e > 0 ? e : -1, this.frame - this.prevFrame < 0 && (this.direction = -1), this.frame - this.prevFrame > 0 && (this.direction = 1), this.frame += this.speed * t, this.frame = this.wrapFrame(this.frame), this.inViewport) {\n      const s = this.index;\n      for (const a of this.frames) {\n        a.priority = Math.abs(a.index - s);\n        let n = Math.sign(this.frame - this.prevFrame);\n        if (this.options.loop) {\n          const c = this.options.frames - a.priority;\n          c < a.priority && (a.priority = c);\n        }\n        a.priority += this.direction * n === -1 ? this.frames.length : 0;\n      }\n      this.frames.sort((a, n) => n.priority - a.priority);\n      const i = this.frames.filter((a) => a.image !== void 0).pop();\n      i && this.drawFrame(i);\n    }\n    this.wrapIndex(this.frame) === this.wrapIndex(this.prevFrame) ? this.timeFrameVisible += t : this.timeFrameVisible = 0, this.process(), this.tickFunctions.forEach((s) => s(t)), this.prevFrame = this.frame, this.animationRequestId = requestAnimationFrame((s) => this.drawingLoop(s));\n  }\n  drawFrame(e) {\n    const t = e.image;\n    !t || e.index >= this.options.frames || (this.lastFrameDrawn = e.index, this.drawImage(t));\n  }\n  drawImage(e) {\n    const t = e.naturalWidth || e.width || e.videoWidth, s = e.naturalHeight || e.height || e.videoHeight, i = this.containerWidth / this.containerHeight, a = t / s;\n    if (this.width = Math.max(this.width, t), this.height = Math.max(this.height, s), this.options.objectFit === \"contain\") {\n      const h = (i > a ? this.height * i : this.width) | 0, l = (i > a ? this.height : this.width / i) | 0;\n      (this.canvas.width !== h || this.canvas.height !== l) && (this.canvas.width = h, this.canvas.height = l);\n    } else {\n      const h = (i > a ? this.width : this.height * i) | 0, l = (i > a ? this.width / i : this.height) | 0;\n      (this.canvas.width !== h || this.canvas.height !== l) && (this.canvas.width = h, this.canvas.height = l);\n    }\n    const n = this.options.scale, c = (this.canvas.width - this.width * n) * this.options.horizontalAlign, r = (this.canvas.height - this.height * n) * this.options.verticalAlign;\n    (this.forceRedraw || this.options.clearCanvas) && this.context.clearRect(0, 0, this.canvas.width, this.canvas.height), (this.forceRedraw || this.options.clearCanvas || this.lastImageDrawn !== e) && (this.context.drawImage(e, 0, 0, t, s, c, r, this.width * n, this.height * n), this.lastImageDrawn = e), this.forceRedraw = !1;\n  }\n  process() {\n    for (const e of this.sources)\n      this.timeFrameVisible >= e.options.timeout / 1e3 && e.process(() => this.setLoadingPriority());\n  }\n  logDebugStatus(e) {\n    const t = (i) => `${Math.abs(i * 100).toFixed(1).padStart(5, \" \")}%`;\n    let s = `${this.options.name} - frames: ${this.frames.length}, loop: ${this.options.loop}, objectFit: ${this.options.objectFit}\n loadProgress ${t(this.loadProgress)}, last frame drawn ${this.lastFrameDrawn}/${this.index}\n`;\n    for (const i of this.sources) {\n      const { progress: a, numLoading: n, numLoaded: c, maxLoaded: r } = i.getLoadStatus();\n      s += ` src[${i.index}] ${i.type === f ? \"image:\" : i.type === p ? \"code: \" : \"tar:  \"} ${t(a)}, numLoading: ${n}, numLoaded: ${c}/${r}${i.options.useWorker ? \", use worker\" : \"\"}\n`;\n    }\n    b(e, s);\n  }\n}\nexport {\n  w as FastImageSequence,\n  u as clamp,\n  C as isMobile\n};\n"]}