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AK,MAC/E,CACA,WAAA,CAAY,EAAO,GACH,UAAV,GACF,KAAK,OAAO,KAAK,QAAS,CACxB,QACA,MACA,WAAY,YACZ,QAAS,GAGf,GAEF,cAAc,QAAU,WAAW,OACnC,IAAI,aAAe,cACnB,SAAS,OAAO,GACd,OAAO,IAAI,aAAa,EAC1B,QAEE","file":"/npm/@oplayer/mpegts@1.2.26-beta.0/dist/index.es.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.37.0.\n * Original file: /npm/@oplayer/mpegts@1.2.26-beta.0/dist/index.es.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * name: @oplayer/mpegts\n * version: v1.2.26-beta.0\n * description: mpegts.js plugin for oplayer\n * author: shiyiya\n * homepage: https://github.com/shiyiya/oplayer\n */\nimport { loadSDK } from \"@oplayer/core\";\nconst PLUGIN_NAME = \"oplayer-plugin-mpegts\";\nconst REG = /(flv|ts|m2ts)(#|\\?|$)/i;\nconst defaultMatcher = (_, source) => {\n  if (source.format && [\"flv\", \"m2ts\", \"mpegts\"].includes(source.format)) {\n    return true;\n  }\n  return (source.format === \"auto\" || typeof source.format === \"undefined\") && REG.test(source.src);\n};\nconst _MpegtsPlugin = class _MpegtsPlugin {\n  constructor(options) {\n    this.key = \"mpegts\";\n    this.name = PLUGIN_NAME;\n    this.version = \"1.2.26-beta.0\";\n    this.options = {\n      matcher: defaultMatcher,\n      config: void 0\n    };\n    Object.assign(this.options, options);\n  }\n  apply(player) {\n    this.player = player;\n    return this;\n  }\n  async load(_ref, source) {\n    var _a;\n    let $video = _ref.$video, options = _ref.options;\n    const _this$options = this.options, matcher = _this$options.matcher, library = _this$options.library;\n    if (!matcher($video, source)) return false;\n    if (!_MpegtsPlugin.library) {\n      _MpegtsPlugin.library = globalThis.mpegts || //@ts-expect-error\n      (library ? await loadSDK(library, \"mpegts\") : (await import(\"mpegts.js/dist/mpegts.js\")).default);\n      _MpegtsPlugin.library.LoggingControl.applyConfig({\n        enableAll: false\n      });\n    }\n    if (!_MpegtsPlugin.library.isSupported()) return false;\n    _MpegtsPlugin.library.LoggingControl.addLogListener(this.logListener.bind(this));\n    this.instance = _MpegtsPlugin.library.createPlayer({\n      url: source.src,\n      isLive: options.isLive,\n      type: source.format || ((_a = REG.exec(source.src)) == null ? void 0 : _a[0])\n      // could also be mpegts, m2ts, flv\n    }, this.options.config);\n    this.instance.attachMediaElement($video);\n    this.instance.load();\n    return this;\n  }\n  destroy() {\n    var _a;\n    (_a = this.instance) == null ? void 0 : _a.destroy();\n    _MpegtsPlugin.library.LoggingControl.removeLogListener(this.logListener.bind(this));\n  }\n  logListener(level, msg) {\n    if (level === \"error\") {\n      this.player.emit(\"error\", {\n        level,\n        msg,\n        pluginName: PLUGIN_NAME,\n        message: msg\n      });\n    }\n  }\n};\n_MpegtsPlugin.library = globalThis.mpegts;\nlet MpegtsPlugin = _MpegtsPlugin;\nfunction create(options) {\n  return new MpegtsPlugin(options);\n}\nexport {\n  create as default\n};\n"]}