Files
ArtPlayer/docs/compiled/artplayer-plugin-chapter.mjs.map
T
Harvey Zack c911928166 feat: add danmuku plugin documentation and i18n setup
- Created a new documentation file for the danmuku plugin with interactive code execution.
- Added comprehensive i18n setup instructions, including default language settings, language imports, and examples for adding and modifying languages.
- Introduced a test file to verify the integration of the danmuku plugin.
2025-08-17 12:09:50 +08:00

1 line
29 KiB
Plaintext

{"mappings":"C,A,S,C,C,C,C,C,C,C,C,C,C,C,C,C,C,C,E,I,E,A,a,O,W,W,A,a,O,K,K,A,a,O,O,O,A,a,O,O,O,C,E,E,A,Y,O,C,C,E,E,C,C,E,C,E,E,C,E,C,E,E,E,K,E,C,E,E,A,a,O,Q,A,Y,O,O,O,E,O,O,C,I,C,Q,S,E,C,C,C,E,G,C,C,C,E,C,C,G,C,C,C,E,C,C,G,C,C,E,C,O,C,C,E,C,I,E,A,Y,O,C,C,E,E,C,C,E,C,G,C,G,E,O,E,E,C,G,G,E,O,E,E,C,G,G,G,A,U,O,E,O,E,G,I,E,A,M,uB,E,I,O,E,I,C,mB,C,C,E,O,C,S,C,E,I,E,C,C,E,C,E,C,E,C,O,A,M,E,E,C,E,E,K,C,C,E,I,E,C,C,E,C,I,E,M,C,G,C,C,E,C,E,C,I,C,E,O,C,E,E,E,O,C,E,C,O,C,C,E,C,O,C,S,E,C,E,I,E,E,O,C,G,M,A,C,I,E,C,E,E,E,C,C,E,e,C,C,E,E,M,C,S,C,E,I,C,E,C,E,I,C,M,C,E,I,C,O,C,E,I,C,O,C,C,C,E,E,O,C,E,E,K,C,E,E,M,C,E,E,O,C,K,E,E,S,C,K,E,E,S,C,K,E,E,C,C,E,E,Q,C,S,C,C,C,E,C,C,E,C,C,S,C,C,C,E,E,O,C,C,E,C,E,A,E,O,c,C,E,O,C,I,W,O,C,C,E,A,C,G,C,C,E,C,E,I,I,E,E,E,E,M,C,I,E,C,C,E,E,G,E,C,I,E,E,E,A,C,U,O,S,A,a,O,O,O,O,C,E,A,Y,O,Q,O,G,E,O,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BAAsB,CAAG,CADlC,C,E,C,2B,Q,iD,O,E,C,M,C,S,C,C,C,C,C,C,C,ECtNA,EAAO,OAAO,CAAG,0xC,E,C,E,C,Q,C,S,C,C,C,C,C,C,C,ECAjB,EAAQ,cAAc,CAAG,SAAU,CAAC,EAClC,OAAO,GAAK,EAAE,UAAU,CAAG,EAAI,CAAC,QAAS,CAAC,CAC5C,EAEA,EAAQ,iBAAiB,CAAG,SAAU,CAAC,EACrC,OAAO,cAAc,CAAC,EAAG,aAAc,CAAC,MAAO,CAAA,CAAI,EACrD,EAEA,EAAQ,SAAS,CAAG,SAAU,CAAM,CAAE,CAAI,EAkBxC,OAjBA,OAAO,IAAI,CAAC,GAAQ,OAAO,CAAC,SAAU,CAAG,EAE7B,YAAR,GACA,AAAQ,eAAR,GACA,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,EAAM,IAK7C,OAAO,cAAc,CAAC,EAAM,EAAK,CAC/B,WAAY,CAAA,EACZ,IAAK,WACH,OAAO,CAAM,CAAC,EAAI,AACpB,CACF,EACF,GAEO,CACT,EAEA,EAAQ,MAAM,CAAG,SAAU,CAAI,CAAE,CAAQ,CAAE,CAAG,EAC5C,OAAO,cAAc,CAAC,EAAM,EAAU,CACpC,WAAY,CAAA,EACZ,IAAK,CACP,EACF,C,E,C,E,E,C,Q,C,Q,oB,C,G,G,C,Q,C,C,C,kB,gB,K,O","sources":["<anon>","packages/artplayer-plugin-chapter/src/index.js","node_modules/@parcel/runtime-js/lib/bundles/runtime-3d3e8628bac64a11.js","node_modules/@parcel/transformer-js/src/esmodule-helpers.js"],"sourcesContent":["// modules are defined as an array\n// [ module function, map of requires ]\n//\n// map of requires is short require name -> numeric require\n//\n// anything defined in a previous bundle is accessed via the\n// orig method which is the require for previous bundles\n\n(function (\n modules,\n entry,\n mainEntry,\n parcelRequireName,\n externals,\n distDir,\n publicUrl,\n devServer\n) {\n /* eslint-disable no-undef */\n var globalObject =\n typeof globalThis !== 'undefined'\n ? globalThis\n : typeof self !== 'undefined'\n ? self\n : typeof window !== 'undefined'\n ? window\n : typeof global !== 'undefined'\n ? global\n : {};\n /* eslint-enable no-undef */\n\n // Save the require from previous bundle to this closure if any\n var previousRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n\n var importMap = previousRequire.i || {};\n var cache = previousRequire.cache || {};\n // Do not use `require` to prevent Webpack from trying to bundle this call\n var nodeRequire =\n typeof module !== 'undefined' &&\n typeof module.require === 'function' &&\n module.require.bind(module);\n\n function newRequire(name, jumped) {\n if (!cache[name]) {\n if (!modules[name]) {\n if (externals[name]) {\n return externals[name];\n }\n // if we cannot find the module within our internal map or\n // cache jump to the current global require ie. the last bundle\n // that was added to the page.\n var currentRequire =\n typeof globalObject[parcelRequireName] === 'function' &&\n globalObject[parcelRequireName];\n if (!jumped && currentRequire) {\n return currentRequire(name, true);\n }\n\n // If there are other bundles on this page the require from the\n // previous one is saved to 'previousRequire'. Repeat this as\n // many times as there are bundles until the module is found or\n // we exhaust the require chain.\n if (previousRequire) {\n return previousRequire(name, true);\n }\n\n // Try the node require function if it exists.\n if (nodeRequire && typeof name === 'string') {\n return nodeRequire(name);\n }\n\n var err = new Error(\"Cannot find module '\" + name + \"'\");\n err.code = 'MODULE_NOT_FOUND';\n throw err;\n }\n\n localRequire.resolve = resolve;\n localRequire.cache = {};\n\n var module = (cache[name] = new newRequire.Module(name));\n\n modules[name][0].call(\n module.exports,\n localRequire,\n module,\n module.exports,\n globalObject\n );\n }\n\n return cache[name].exports;\n\n function localRequire(x) {\n var res = localRequire.resolve(x);\n return res === false ? {} : newRequire(res);\n }\n\n function resolve(x) {\n var id = modules[name][1][x];\n return id != null ? id : x;\n }\n }\n\n function Module(moduleName) {\n this.id = moduleName;\n this.bundle = newRequire;\n this.require = nodeRequire;\n this.exports = {};\n }\n\n newRequire.isParcelRequire = true;\n newRequire.Module = Module;\n newRequire.modules = modules;\n newRequire.cache = cache;\n newRequire.parent = previousRequire;\n newRequire.distDir = distDir;\n newRequire.publicUrl = publicUrl;\n newRequire.devServer = devServer;\n newRequire.i = importMap;\n newRequire.register = function (id, exports) {\n modules[id] = [\n function (require, module) {\n module.exports = exports;\n },\n {},\n ];\n };\n\n // Only insert newRequire.load when it is actually used.\n // The code in this file is linted against ES5, so dynamic import is not allowed.\n // INSERT_LOAD_HERE\n\n Object.defineProperty(newRequire, 'root', {\n get: function () {\n return globalObject[parcelRequireName];\n },\n });\n\n globalObject[parcelRequireName] = newRequire;\n\n for (var i = 0; i < entry.length; i++) {\n newRequire(entry[i]);\n }\n\n if (mainEntry) {\n // Expose entry point to Node, AMD or browser globals\n // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js\n var mainExports = newRequire(mainEntry);\n\n // CommonJS\n if (typeof exports === 'object' && typeof module !== 'undefined') {\n module.exports = mainExports;\n\n // RequireJS\n } else if (typeof define === 'function' && define.amd) {\n define(function () {\n return mainExports;\n });\n }\n }\n})({\"1LLzi\":[function(require,module,exports,__globalThis) {\nvar parcelHelpers = require(\"@parcel/transformer-js/src/esmodule-helpers.js\");\nparcelHelpers.defineInteropFlag(exports);\nparcelHelpers.export(exports, \"default\", ()=>artplayerPluginChapter);\nvar _styleLess = require(\"bundle-text:./style.less\");\nvar _styleLessDefault = parcelHelpers.interopDefault(_styleLess);\nfunction artplayerPluginChapter(option = {}) {\n return (art)=>{\n const { $player } = art.template;\n const { setStyle, append, clamp, query, isMobile, addClass, removeClass } = art.constructor.utils;\n const html = `\n <div class=\"art-chapter\">\n <div class=\"art-chapter-inner\">\n <div class=\"art-progress-hover\"></div>\n <div class=\"art-progress-loaded\"></div>\n <div class=\"art-progress-played\"></div>\n </div>\n </div>\n `;\n let titleTimer = null;\n let $chapters = [];\n const $progress = art.query('.art-control-progress');\n const $inner = art.query('.art-control-progress-inner');\n const $control = append($inner, '<div class=\"art-chapters\"></div>');\n const $title = append($inner, '<div class=\"art-chapter-title\"></div>');\n function showTitle({ $chapter, width }) {\n const title = $chapter.dataset.title.trim();\n if (title) {\n setStyle($title, 'display', 'flex');\n $title.textContent = title;\n const titleWidth = $title.clientWidth;\n if (width <= titleWidth / 2) setStyle($title, 'left', 0);\n else if (width > $inner.clientWidth - titleWidth / 2) setStyle($title, 'left', `${$inner.clientWidth - titleWidth}px`);\n else setStyle($title, 'left', `${width - titleWidth / 2}px`);\n } else setStyle($title, 'display', 'none');\n }\n function update(chapters = []) {\n $chapters = [];\n $control.textContent = '';\n removeClass($player, 'artplayer-plugin-chapter');\n if (!Array.isArray(chapters)) return;\n if (!chapters.length) return;\n if (!art.duration) return;\n chapters = chapters.sort((a, b)=>a.start - b.start);\n for(let i = 0; i < chapters.length; i++){\n const chapter = chapters[i];\n const nextChapter = chapters[i + 1];\n if (chapter.end === Infinity) chapter.end = art.duration;\n if (typeof chapter.start !== 'number' || typeof chapter.end !== 'number' || typeof chapter.title !== 'string') throw new TypeError('Illegal chapter data type');\n if (chapter.start < 0 || chapter.end > art.duration || chapter.start >= chapter.end) throw new Error('Illegal chapter time point');\n if (nextChapter && chapter.end > nextChapter.start) throw new Error('Illegal chapter time point');\n }\n if (chapters[0].start > 0) chapters.unshift({\n start: 0,\n end: chapters[0].start,\n title: ''\n });\n if (chapters[chapters.length - 1].end < art.duration) chapters.push({\n start: chapters[chapters.length - 1].end,\n end: art.duration,\n title: ''\n });\n for(let i = 0; i < chapters.length - 1; i++)if (chapters[i].end !== chapters[i + 1].start) chapters.splice(i + 1, 0, {\n start: chapters[i].end,\n end: chapters[i + 1].start,\n title: ''\n });\n $chapters = chapters.map((chapter)=>{\n const $chapter = append($control, html);\n const start = clamp(chapter.start, 0, art.duration);\n const end = clamp(chapter.end, 0, art.duration);\n const duration = end - start;\n const percentage = duration / art.duration;\n $chapter.dataset.start = start;\n $chapter.dataset.end = end;\n $chapter.dataset.duration = duration;\n $chapter.dataset.title = chapter.title.trim();\n $chapter.style.width = `${percentage * 100}%`;\n return {\n $chapter,\n $hover: query('.art-progress-hover', $chapter),\n $loaded: query('.art-progress-loaded', $chapter),\n $played: query('.art-progress-played', $chapter)\n };\n });\n addClass($player, 'artplayer-plugin-chapter');\n art.emit('setBar', 'loaded', art.loaded || 0);\n }\n art.on('setBar', (type, percentage, event)=>{\n if (!$chapters.length) return;\n for(let i = 0; i < $chapters.length; i++){\n const { $chapter, $loaded, $played, $hover } = $chapters[i];\n const $target = {\n hover: $hover,\n loaded: $loaded,\n played: $played\n }[type];\n if (!$target) return;\n const width = $control.clientWidth * percentage;\n const currentTime = art.duration * percentage;\n const duration = Number.parseFloat($chapter.dataset.duration);\n const start = Number.parseFloat($chapter.dataset.start);\n const end = Number.parseFloat($chapter.dataset.end);\n if (currentTime < start) setStyle($target, 'width', 0);\n if (currentTime > end) setStyle($target, 'width', '100%');\n if (currentTime >= start && currentTime <= end) {\n const percentage = (currentTime - start) / duration;\n setStyle($target, 'width', `${percentage * 100}%`);\n if (isMobile) {\n if (type === 'played' && event) {\n showTitle({\n $chapter,\n width\n });\n clearTimeout(titleTimer);\n titleTimer = setTimeout(()=>{\n setStyle($title, 'display', 'none');\n }, 500);\n }\n } else if (type === 'hover') showTitle({\n $chapter,\n width\n });\n }\n }\n });\n if (!isMobile) art.proxy($progress, 'mouseleave', ()=>{\n if (!$chapters.length) return;\n setStyle($title, 'display', 'none');\n });\n art.once('video:loadedmetadata', ()=>update(option.chapters));\n return {\n name: 'artplayerPluginChapter',\n update: ({ chapters })=>update(chapters)\n };\n };\n}\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-chapter';\n let $style = document.getElementById(id);\n if (!$style) {\n $style = document.createElement('style');\n $style.id = id;\n if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{\n document.head.appendChild($style);\n });\n else (document.head || document.documentElement).appendChild($style);\n }\n $style.textContent = (0, _styleLessDefault.default);\n}\nif (typeof window !== 'undefined') window.artplayerPluginChapter = artplayerPluginChapter;\n\n},{\"bundle-text:./style.less\":\"e5E4m\",\"@parcel/transformer-js/src/esmodule-helpers.js\":\"5lQoW\"}],\"e5E4m\":[function(require,module,exports,__globalThis) {\nmodule.exports = \".artplayer-plugin-chapter .art-control-progress-inner{background-color:#0000!important;height:100%!important}.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-hover,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-loaded,.artplayer-plugin-chapter .art-control-progress-inner>.art-progress-played{display:none!important}.artplayer-plugin-chapter .art-control-thumbnails{bottom:calc(var(--art-bottom-gap) + 64px)!important}.artplayer-plugin-chapter .art-chapters{z-index:0;align-items:center;gap:4px;height:100%;display:flex;position:absolute;inset:0;transform:scaleY(1.25)}.artplayer-plugin-chapter .art-chapters .art-chapter{align-items:center;height:100%;display:flex}.artplayer-plugin-chapter .art-chapters .art-chapter .art-chapter-inner{cursor:pointer;width:100%;height:50%;transition:height var(--art-transition-duration)ease;background-color:var(--art-progress-color);border-radius:10px;position:relative;overflow:hidden}.artplayer-plugin-chapter .art-chapters .art-chapter:hover .art-chapter-inner{height:100%}.artplayer-plugin-chapter .art-chapter-title{z-index:70;border-radius:var(--art-border-radius);white-space:nowrap;background-color:var(--art-tip-background);padding:3px 5px;font-size:14px;line-height:1;display:none;position:absolute;top:-50px;left:0}\";\n\n},{}],\"5lQoW\":[function(require,module,exports,__globalThis) {\nexports.interopDefault = function(a) {\n return a && a.__esModule ? a : {\n default: a\n };\n};\nexports.defineInteropFlag = function(a) {\n Object.defineProperty(a, '__esModule', {\n value: true\n });\n};\nexports.exportAll = function(source, dest) {\n Object.keys(source).forEach(function(key) {\n if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return;\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function() {\n return source[key];\n }\n });\n });\n return dest;\n};\nexports.export = function(dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get\n });\n};\n\n},{}]},[\"1LLzi\"], \"1LLzi\", \"parcelRequire4dc0\", {})\nlet {default: _default, } = parcelRequire4dc0(\"1LLzi\");\nexport {_default as default, };\n\n//# sourceMappingURL=index.js.map\n","import style from 'bundle-text:./style.less'\n\nexport default function artplayerPluginChapter(option = {}) {\n return (art) => {\n const { $player } = art.template\n const { setStyle, append, clamp, query, isMobile, addClass, removeClass } = art.constructor.utils\n\n const html = `\n <div class=\"art-chapter\">\n <div class=\"art-chapter-inner\">\n <div class=\"art-progress-hover\"></div>\n <div class=\"art-progress-loaded\"></div>\n <div class=\"art-progress-played\"></div>\n </div>\n </div>\n `\n\n let titleTimer = null\n let $chapters = []\n\n const $progress = art.query('.art-control-progress')\n const $inner = art.query('.art-control-progress-inner')\n const $control = append($inner, '<div class=\"art-chapters\"></div>')\n const $title = append($inner, '<div class=\"art-chapter-title\"></div>')\n\n function showTitle({ $chapter, width }) {\n const title = $chapter.dataset.title.trim()\n if (title) {\n setStyle($title, 'display', 'flex')\n $title.textContent = title\n const titleWidth = $title.clientWidth\n if (width <= titleWidth / 2) {\n setStyle($title, 'left', 0)\n }\n else if (width > $inner.clientWidth - titleWidth / 2) {\n setStyle($title, 'left', `${$inner.clientWidth - titleWidth}px`)\n }\n else {\n setStyle($title, 'left', `${width - titleWidth / 2}px`)\n }\n }\n else {\n setStyle($title, 'display', 'none')\n }\n }\n\n function update(chapters = []) {\n $chapters = []\n $control.textContent = ''\n removeClass($player, 'artplayer-plugin-chapter')\n\n if (!Array.isArray(chapters))\n return\n if (!chapters.length)\n return\n if (!art.duration)\n return\n\n chapters = chapters.sort((a, b) => a.start - b.start)\n\n for (let i = 0; i < chapters.length; i++) {\n const chapter = chapters[i]\n const nextChapter = chapters[i + 1]\n\n if (chapter.end === Infinity) {\n chapter.end = art.duration\n }\n\n if (\n typeof chapter.start !== 'number'\n || typeof chapter.end !== 'number'\n || typeof chapter.title !== 'string'\n ) {\n throw new TypeError('Illegal chapter data type')\n }\n\n if (chapter.start < 0 || chapter.end > art.duration || chapter.start >= chapter.end) {\n throw new Error('Illegal chapter time point')\n }\n\n if (nextChapter && chapter.end > nextChapter.start) {\n throw new Error('Illegal chapter time point')\n }\n }\n\n if (chapters[0].start > 0) {\n chapters.unshift({ start: 0, end: chapters[0].start, title: '' })\n }\n\n if (chapters[chapters.length - 1].end < art.duration) {\n chapters.push({ start: chapters[chapters.length - 1].end, end: art.duration, title: '' })\n }\n\n for (let i = 0; i < chapters.length - 1; i++) {\n if (chapters[i].end !== chapters[i + 1].start) {\n chapters.splice(i + 1, 0, {\n start: chapters[i].end,\n end: chapters[i + 1].start,\n title: '',\n })\n }\n }\n\n $chapters = chapters.map((chapter) => {\n const $chapter = append($control, html)\n const start = clamp(chapter.start, 0, art.duration)\n const end = clamp(chapter.end, 0, art.duration)\n const duration = end - start\n const percentage = duration / art.duration\n $chapter.dataset.start = start\n $chapter.dataset.end = end\n $chapter.dataset.duration = duration\n $chapter.dataset.title = chapter.title.trim()\n $chapter.style.width = `${percentage * 100}%`\n\n return {\n $chapter,\n $hover: query('.art-progress-hover', $chapter),\n $loaded: query('.art-progress-loaded', $chapter),\n $played: query('.art-progress-played', $chapter),\n }\n })\n\n addClass($player, 'artplayer-plugin-chapter')\n art.emit('setBar', 'loaded', art.loaded || 0)\n }\n\n art.on('setBar', (type, percentage, event) => {\n if (!$chapters.length)\n return\n\n for (let i = 0; i < $chapters.length; i++) {\n const { $chapter, $loaded, $played, $hover } = $chapters[i]\n\n const $target = {\n hover: $hover,\n loaded: $loaded,\n played: $played,\n }[type]\n\n if (!$target)\n return\n\n const width = $control.clientWidth * percentage\n const currentTime = art.duration * percentage\n const duration = Number.parseFloat($chapter.dataset.duration)\n const start = Number.parseFloat($chapter.dataset.start)\n const end = Number.parseFloat($chapter.dataset.end)\n\n if (currentTime < start) {\n setStyle($target, 'width', 0)\n }\n\n if (currentTime > end) {\n setStyle($target, 'width', '100%')\n }\n\n if (currentTime >= start && currentTime <= end) {\n const percentage = (currentTime - start) / duration\n setStyle($target, 'width', `${percentage * 100}%`)\n\n if (isMobile) {\n if (type === 'played' && event) {\n showTitle({ $chapter, width })\n clearTimeout(titleTimer)\n titleTimer = setTimeout(() => {\n setStyle($title, 'display', 'none')\n }, 500)\n }\n }\n else {\n if (type === 'hover') {\n showTitle({ $chapter, width })\n }\n }\n }\n }\n })\n\n if (!isMobile) {\n art.proxy($progress, 'mouseleave', () => {\n if (!$chapters.length)\n return\n setStyle($title, 'display', 'none')\n })\n }\n\n art.once('video:loadedmetadata', () => update(option.chapters))\n\n return {\n name: 'artplayerPluginChapter',\n update: ({ chapters }) => update(chapters),\n }\n }\n}\n\nif (typeof document !== 'undefined') {\n const id = 'artplayer-plugin-chapter'\n let $style = document.getElementById(id)\n if (!$style) {\n $style = document.createElement('style')\n $style.id = id\n if (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', () => {\n document.head.appendChild($style)\n })\n }\n else {\n (document.head || document.documentElement).appendChild($style)\n }\n }\n $style.textContent = style\n}\n\nif (typeof window !== 'undefined') {\n window.artplayerPluginChapter = artplayerPluginChapter\n}\n","module.exports = \"78c751325fe725df\";","exports.interopDefault = function (a) {\n return a && a.__esModule ? a : {default: a};\n};\n\nexports.defineInteropFlag = function (a) {\n Object.defineProperty(a, '__esModule', {value: true});\n};\n\nexports.exportAll = function (source, dest) {\n Object.keys(source).forEach(function (key) {\n if (\n key === 'default' ||\n key === '__esModule' ||\n Object.prototype.hasOwnProperty.call(dest, key)\n ) {\n return;\n }\n\n Object.defineProperty(dest, key, {\n enumerable: true,\n get: function () {\n return source[key];\n },\n });\n });\n\n return dest;\n};\n\nexports.export = function (dest, destName, get) {\n Object.defineProperty(dest, destName, {\n enumerable: true,\n get: get,\n });\n};\n"],"names":["modules","entry","mainEntry","parcelRequireName","externals","distDir","publicUrl","devServer","globalObject","globalThis","self","window","global","previousRequire","importMap","i","cache","nodeRequire","module","require","bind","newRequire","name","jumped","currentRequire","err","Error","code","localRequire","resolve","x","id","Module","call","exports","res","isParcelRequire","moduleName","bundle","parent","register","Object","defineProperty","get","length","mainExports","define","amd","__globalThis","parcelHelpers","defineInteropFlag","export","artplayerPluginChapter","_styleLess","_styleLessDefault","interopDefault","option","art","$player","template","setStyle","append","clamp","query","isMobile","addClass","removeClass","utils","html","titleTimer","$chapters","$progress","$inner","$control","$title","showTitle","$chapter","width","title","dataset","trim","textContent","titleWidth","clientWidth","update","chapters","Array","isArray","duration","sort","a","b","start","chapter","nextChapter","end","Infinity","TypeError","unshift","push","splice","map","percentage","style","$hover","$loaded","$played","emit","loaded","on","type","event","$target","hover","played","currentTime","Number","parseFloat","clearTimeout","setTimeout","proxy","once","document","$style","getElementById","createElement","readyState","addEventListener","head","appendChild","documentElement","default","__esModule","value","exportAll","source","dest","keys","forEach","key","prototype","hasOwnProperty","enumerable","destName","_default","parcelRequire4dc0"],"version":3,"file":"index.js.map"}