mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-08 10:56:15 -08:00
Add unescape utility function and
artplayerPluginMultipleSubtitles plugin
This commit is contained in:
1 parent
3db53c425e
commit
89b8525f2f
47 files changed
+2982
-75
No files matched your search
@@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
- 在移动端,点击视频会切换控制栏的显示与隐藏
|
||||
- 由于功能不常用,删除 `art.loop` 区间播放功能
|
||||
- 字幕轨添加 `label` 属性,用于在移动设备上显示字幕名字
|
||||
- 添加 `unescape` 工具函数
|
||||
- 添加 `artplayerPluginMultipleSubtitles` 插件,用于显示合并后的字幕文件
|
||||
|
||||
## [5.0.9] - 2023-5-14
|
||||
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
plugins: [
|
||||
artplayerPluginMultipleSubtitles({
|
||||
subtitles: [
|
||||
{
|
||||
name: 'chinese',
|
||||
url: '/assets/sample/subtitle.cn.srt',
|
||||
},
|
||||
{
|
||||
name: 'japanese',
|
||||
url: '/assets/sample/subtitle.jp.srt',
|
||||
}
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
// 自定义你自己的样式,请勿复制以下代码
|
||||
// Customize your own style, please do not copy the following code
|
||||
const style = `
|
||||
.art-subtitle-chinese {
|
||||
color: red;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.art-subtitle-japanese {
|
||||
color: yellow;
|
||||
font-size: 12px;
|
||||
}
|
||||
`;
|
||||
|
||||
const $style = document.getElementById('artplayer-subtitle-style');
|
||||
if ($style) {
|
||||
$style.textContent = style;
|
||||
} else {
|
||||
const $style = document.createElement('style');
|
||||
$style.id = 'artplayer-subtitle-style';
|
||||
$style.textContent = style;
|
||||
document.head.appendChild($style);
|
||||
}
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof l[o]&&l[o];if(!r&&n)return n(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){var d=p(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd&&define((function(){return d}))}}({"16V0T":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var n=e("bundle-text:./style.less"),l=o.interopDefault(n);function a(){return e=>{!function(e){const{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number);r(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);const{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;const c="artplayer-plugin-control";l(r,c);const d=o(t,'<div class="apa-control-current"></div>'),s=o(t,'<div class="apa-control-duration"></div>'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t<f.length;t++)e.on(f[t],(()=>{d.innerText=n(e.currentTime),s.innerText=n(e.duration)}));return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(e){e?l(r,c):i(r,c)}}}}if(r.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:26","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){const e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{height:70px;width:400px;-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{width:15%;justify-content:center;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,o,n){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof l[o]&&l[o];if(!r&&n)return n(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=p(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):n&&(this[n]=d)}}({"16V0T":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>a);var n=e("bundle-text:./style.less"),l=o.interopDefault(n);function a(){return e=>{!function(e){let{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number),n=o[0],l=o[1]/100;r(n+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);let{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;let c="artplayer-plugin-control";l(r,c);let d=o(t,'<div class="apa-control-current"></div>'),s=o(t,'<div class="apa-control-duration"></div>'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t<f.length;t++)e.on(f[t],()=>{d.innerText=n(e.currentTime),s.innerText=n(e.duration)});return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(state){state?l(r,c):i(r,c)}}}}if(a.env="production",a.version="2.0.0",a.build="2023-11-23 23:22:00","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){let e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;width:400px;height:70px;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{justify-content:center;width:15%;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof a[o]&&a[o];if(!r&&n)return n(t,!0);if(l)return l(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){var d=p(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd&&define((function(){return d}))}}({eacU2:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var n=e("bundle-text:./style.less"),a=o.interopDefault(n);function l(){return function(e){!function(e){var t=e.constructor,r=t.version,o=t.utils.errorHandle,n=r.split(".").map(Number);o(n[0]+n[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"))}(e);var t=e.template,r=t.$bottom,o=t.$player,n=e.constructor.utils,a=n.append,i=n.secondToTime,u=n.addClass,p=n.removeClass,c=n.hasClass;if(!n.isMobile){var d="artplayer-plugin-control";u(o,d);for(var s=a(r,'<div class="apa-control-current"></div>'),f=a(r,'<div class="apa-control-duration"></div>'),y=["video:loadedmetadata","video:timeupdate","video:progress"],g=0;g<y.length;g++)e.on(y[g],(function(){s.innerText=i(e.currentTime),f.innerText=i(e.duration)}));return{name:"artplayerPluginControl",get enable(){return c(o,d)},set enable(e){e?u(o,d):p(o,d)}}}}}if(r.default=l,l.env="production",l.version="2.0.0",l.build="2023-08-26 16:47:27","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){var i=document.createElement("style");i.id="artplayer-plugin-control",i.textContent=a.default,document.head.appendChild(i)}"undefined"!=typeof window&&(window.artplayerPluginControl=l)},{"bundle-text:./style.less":"kok3H","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kok3H:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{height:70px;width:400px;-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:rgba(0,0,0,.7);background-image:none;border-radius:10px;align-items:center;margin-left:-200px;top:auto;bottom:10px;left:50%;right:auto;overflow:visible;box-shadow:0 10px 15px -3px rgba(0,0,0,.2),0 4px 6px -4px rgba(0,0,0,.2)}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{width:15%;justify-content:center;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["eacU2"],"eacU2","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,o,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof a[o]&&a[o];if(!r&&n)return n(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(l)return l(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=p(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):n&&(this[n]=d)}}({eacU2:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return l});var n=e("bundle-text:./style.less"),a=o.interopDefault(n);function l(){return function(e){r=(t=e.constructor).version,(0,t.utils.errorHandle)((o=r.split(".").map(Number))[0]+o[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,o,n=e.template,a=n.$bottom,i=n.$player,u=e.constructor.utils,p=u.append,c=u.secondToTime,d=u.addClass,s=u.removeClass,f=u.hasClass;if(!u.isMobile){var y="artplayer-plugin-control";d(i,y);for(var g=p(a,'<div class="apa-control-current"></div>'),m=p(a,'<div class="apa-control-duration"></div>'),b=["video:loadedmetadata","video:timeupdate","video:progress"],x=0;x<b.length;x++)e.on(b[x],function(){g.innerText=c(e.currentTime),m.innerText=c(e.duration)});return{name:"artplayerPluginControl",get enable(){return f(i,y)},set enable(state){state?d(i,y):s(i,y)}}}}}if(l.env="production",l.version="2.0.0",l.build="2023-11-23 23:22:00","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){var i=document.createElement("style");i.id="artplayer-plugin-control",i.textContent=a.default,document.head.appendChild(i)}"undefined"!=typeof window&&(window.artplayerPluginControl=l)},{"bundle-text:./style.less":"kok3H","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kok3H:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{backdrop-filter:saturate(180%)blur(20px);background-color:rgba(0,0,0,.7);background-image:none;border-radius:10px;align-items:center;width:400px;height:70px;margin-left:-200px;top:auto;bottom:10px;left:50%;right:auto;overflow:visible;box-shadow:0 10px 15px -3px rgba(0,0,0,.2),0 4px 6px -4px rgba(0,0,0,.2)}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{justify-content:center;width:15%;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["eacU2"],"eacU2","parcelRequire4dc0");
|
||||
@@ -4,4 +4,70 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[i]&&a[i],o=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!o[e]){if(!t[e]){var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(e,!0);if(s)return s(e,!0);if(l&&"string"==typeof e)return l(e);var d=new Error("Cannot find module '"+e+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},p.cache={};var m=o[e]=new u.Module(e);t[e][0].call(m.exports,p,m,m.exports,this)}return o[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=o,u.parent=s,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var d=0;d<e.length;d++)u(e[d]);if(n){var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}}({bgm6t:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),s=t("./setting"),o=i.interopDefault(s),l=t("./heatmap"),u=i.interopDefault(l);function d(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=5,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,o.default)(e,n),t.heatmap&&(0,u.default)(e,n,t.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=d,d.env="production",d.version="5.0.1",d.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),s=i.interopDefault(a);class o{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(t,e,i,r,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[r]&&a[r],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,i){if(!s[e]){if(!t[e]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof a[r]&&a[r];if(!i&&n)return n(e,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(o)return o(e,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof e)return l(e);var d=Error("Cannot find module '"+e+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var r=t[e][1][i];return null!=r?r:i},p.cache={};var m=s[e]=new u.Module(e);t[e][0].call(m.exports,p,m,m.exports,this)}return s[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(u,"root",{get:function(){return a[r]}}),a[r]=u;for(var d=0;d<e.length;d++)u(e[d]);if(i){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var m=u(i);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):n&&(this[n]=m)}}({bgm6t:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>d);var n=t("./danmuku"),a=r.interopDefault(n),o=t("./setting"),s=r.interopDefault(o),l=t("./heatmap"),u=r.interopDefault(l);function d(t){return e=>{!function(t){let{version:e,utils:{errorHandle:i}}=t.constructor,r=e.split(".").map(Number),n=r[0],a=r[1]/100;i(n+a>=5,`Artplayer.js@${e} \u{4E0D}\u{517C}\u{5BB9}\u{8BE5}\u{5F39}\u{5E55}\u{5E93}\u{FF0C}\u{8BF7}\u{66F4}\u{65B0}\u{5230} Artplayer.js@5.x.x \u{7248}\u{672C}\u{4EE5}\u{4E0A}`)}(e);let i=new a.default(e,t);return(0,s.default)(e,i),t.heatmap&&(0,u.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}d.env="production",d.version="5.0.1",d.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i);var n=t("./bilibili"),a=t("./getDanmuTop"),o=r.interopDefault(a);class s{constructor(e,i){let{constructor:r,template:n}=e;if(this.utils=r.utils,this.validator=r.validator,this.$danmuku=n.$danmuku,this.$player=n.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(i),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){//
|
||||
}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){let{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[1]}filter(t,e){return this.queue.filter(e=>e.$state===t).map(e)}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){let t=this.$refs.pop();if(t)return t;let e=document.createElement("div");return e.style.cssText=`
|
||||
user-select: none;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
pointer-events: none;
|
||||
perspective: 500px;
|
||||
display: inline-block;
|
||||
will-change: transform;
|
||||
font-weight: normal;
|
||||
line-height: 1.125;
|
||||
visibility: hidden;
|
||||
font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;
|
||||
text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;
|
||||
`,e}getReady(){let{currentTime:t}=this.art;return this.queue.filter(e=>"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1)}getEmits(){let t=[],{clientWidth:e}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",r=>{let n=r.$ref.offsetTop,a=this.getLeft(r.$ref)-i,o=r.$ref.clientHeight,s=r.$ref.clientWidth,l=a+s,u=e-l,d=l/r.$restTime,m={};m.top=n,m.left=a,m.height=o,m.width=s,m.right=u,m.speed=d,m.distance=l,m.time=r.$restTime,m.mode=r.mode,t.push(m)}),t}getFontSize(t){let{clamp:e}=this.utils,{clientHeight:i}=this.$player;if("number"==typeof t)return e(t,12,i);if("string"==typeof t&&t.endsWith("%")){let r=parseFloat(t)/100;return e(i*r,12,i)}return s.option.fontSize}postMessage(t={}){return new Promise(e=>{if(this.option.useWorker&&this.worker&&this.worker.postMessage)t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:r}=i;r.id===t.id&&e(r)};else{let i=(0,o.default)(t);e({top:i})}})}async load(){try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,this.utils.errorHandle(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.art.emit("artplayerPluginDanmuku:loaded",this.danmus),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(t=>this.emit(t))}catch(t){throw this.art.emit("artplayerPluginDanmuku:error",t),t}return this}config(t){let{clamp:e}=this.utils;return this.option=Object.assign({},s.option,this.option,t),this.validator(this.option,s.scheme),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(Math.floor(this.option.lockTime),0,60),this.option.maxLength=e(this.option.maxLength,0,500),this.option.minWidth=e(this.option.minWidth,0,500),this.option.maxWidth=e(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}makeWait(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(e.$state="stop",0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition="transform 0s linear 0s"}}),this}reset(){return this.queue.forEach(t=>this.makeWait(t)),this}update(){return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let t=this.getReady(),{clientWidth:e,clientHeight:i}=this.$player;for(let r=0;r<t.length;r++){let n=t[r];n.$ref=this.getRef(),n.$ref.innerText=n.text,this.$danmuku.appendChild(n.$ref),n.$ref.style.left=`${e}px`,n.$ref.style.opacity=this.option.opacity,n.$ref.style.fontSize=`${this.option.fontSize}px`,n.$ref.style.color=n.color,n.$ref.style.border=n.border?`1px solid ${n.color}`:null,n.$ref.style.backgroundColor=n.border?"rgb(0 0 0 / 50%)":null,n.$ref.style.marginLeft="0px",n.$lastStartTime=Date.now(),n.$restTime=this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed;let a={mode:n.mode,height:n.$ref.clientHeight,speed:(e+n.$ref.clientWidth)/n.$restTime},{top:o}=await this.postMessage({target:a,emits:this.getEmits(),antiOverlap:this.option.antiOverlap,clientWidth:e,clientHeight:i,marginBottom:this.marginBottom,marginTop:this.marginTop});if(n.$ref){if(this.isStop||void 0===o)n.$state="ready",this.$refs.push(n.$ref),n.$ref=null;else switch(n.$state="emit",n.$ref.style.visibility="visible",n.mode){case 0:{n.$ref.style.top=`${o}px`;let t=e+n.$ref.clientWidth;n.$ref.style.transform=`translateX(${-t}px)`,n.$ref.style.transition=`transform ${n.$restTime}s linear 0s`;break}case 1:n.$ref.style.left="50%",n.$ref.style.top=`${o}px`,n.$ref.style.marginLeft=`-${n.$ref.clientWidth/2}px`}}}}this.isStop||this.update()}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:sho
Line truncated
|
||||
<div class="art-danmuku-emitter" style="max-width: ${i.maxWidth?`${i.maxWidth}px`:"100%"}">
|
||||
<div class="art-danmuku-left">
|
||||
<div class="art-danmuku-style">
|
||||
<div class="art-danmuku-style-panel">
|
||||
<div class="art-danmuku-style-panel-inner">
|
||||
<div class="art-danmuku-style-panel-title">u{6A21}\u{5F0F}</div>
|
||||
<div class="art-danmuku-style-panel-modes">
|
||||
<div class="art-danmuku-style-panel-mode art-current" data-mode="0">u{6EDA}\u{52A8}</div>
|
||||
<div class="art-danmuku-style-panel-mode" data-mode="1">u{9759}\u{6B62}</div>
|
||||
</div>
|
||||
<div class="art-danmuku-style-panel-title">u{989C}\u{8272}</div>
|
||||
<div class="art-danmuku-style-panel-colors">
|
||||
${a.join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input class="art-danmuku-input" maxlength="${i.maxLength}" placeholder="\u{53D1}\u{4E2A}\u{5F39}\u{5E55}\u{89C1}\u{8BC1}\u{5F53}\u{4E0B}" />
|
||||
</div>
|
||||
<div class="art-danmuku-send">u{53D1}\u{9001}</div>
|
||||
</div>
|
||||
`),u=c(".art-danmuku-style",s),m=c(".art-danmuku-input",s),h=c(".art-danmuku-send",s),f=c(".art-danmuku-style-panel-inner",s),y=c(".art-danmuku-style-panel-modes",s),k=c(".art-danmuku-style-panel-colors",s),x=i.mount||d(n,'<div class="art-layer-danmuku-emitter"></div>');t.option.backdrop&&l(f,"art-backdrop-filter"),i.theme&&l(s,`art-danmuku-theme-${i.theme}`);let v=null,w=i.mode,$=i.color;function D(){let r={mode:w,color:$,border:!0,text:m.value.trim()};null===v&&i.beforeEmit(r)&&(m.value="",e.emit(r),l(h,"art-disabled"),function t(e){e<=0?(v=null,h.innerText="发送",o(h,"art-disabled")):(h.innerText=e,v=setTimeout(()=>t(e-1),1e3))}(i.lockTime),t.emit("artplayerPluginDanmuku:emit",r))}function B(){r.clientWidth<i.minWidth?(d(x,s),p(x,"display","flex"),l(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom","40px")):(d(r,s),p(x,"display","none"),o(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom",null))}d(u,b),t.proxy(h,"click",D),t.proxy(m,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),D())}),t.proxy(y,"click",t=>{let{dataset:e}=t.target;e.mode&&(w=Number(e.mode),g(t.target,"art-current"))}),t.proxy(k,"click",t=>{let{dataset:e}=t.target;e.color&&($=e.color,g(t.target,"art-current"))}),B(),t.on("resize",()=>{t.isInput||B()}),t.on("destroy",()=>{i.mount&&s.parentElement===i.mount&&i.mount.removeChild(s)})}(),t.controls.add({position:"right",name:"danmuku",click:function(){e.isHide?(e.show(),t.notice.show="弹幕显示",p(k,"display",null),p(x,"display","none")):(e.hide(),t.notice.show="弹幕隐藏",p(k,"display","none"),p(x,"display",null))},mounted(e){d(e,k),d(e,x),f(e,"弹幕开关"),p(x,"display","none"),t.on("artplayerPluginDanmuku:hide",()=>{p(k,"display","none"),p(x,"display",null)}),t.on("artplayerPluginDanmuku:show",()=>{p(k,"display",null),p(x,"display","none")})}}),t.setting.add({width:260,name:"danmuku",html:"弹幕设置",tooltip:"更多",icon:v,selector:[{width:a,html:"播放速度",icon:"",tooltip:"适中",selector:[{html:"极慢",time:10},{html:"较慢",time:7.5},{default:!0,html:"适中",time:5},{html:"较快",time:2.5},{html:"极快",time:1}],onSelect:function(t){return e.config({speed:t.time}),t.html}},{width:a,html:"字体大小",icon:"",tooltip:"适中",selector:[{html:"极小",fontSize:"4%"},{html:"较小",fontSize:"5%"},{default:!0,html:"适中",fontSize:"6%"},{html:"较大",fontSize:"7%"},{html:"极大",fontSize:"8%"}],onSelect:function(t){return e.config({fontSize:t.fontSize}),t.html}},{width:a,html:"不透明度",icon:"",tooltip:"100%",selector:[{default:!0,opacity:1,html:"100%"},{opacity:.75,html:"75%"},{opacity:.5,html:"50%"},{opacity:.25,html:"25%"},{opacity:0,html:"0%"}],onSelect:function(t){return e.config({opacity:t.opacity}),t.html}},{width:a,html:"显示范围",icon:"",tooltip:"3/4",selector:[{html:"1/4",margin:[10,"75%"]},{html:"半屏",margin:[10,"50%"]},{default:!0,html:"3/4",margin:[10,"25%"]},{html:"满屏",margin:[10,10]}],onSelect:function(t){return e.config({margin:t.margin}),t.html}},{html:"弹幕防重叠",icon:"",tooltip:i.antiOverlap?"开启":"关闭",switch:i.antiOverlap,onSwitch:t=>(e.config({antiOverlap:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)},{html:"同步视频速度",icon:"",tooltip:i.synchronousPlayback?"开启":"关闭",switch:i.synchronousPlayback,onSwitch:t=>(e.config({synchronousPlayback:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)}]})}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-danmuku")){let t=document.createElement("style");t.id="artplayer-plugin-danmuku",t.textContent=a.default,document.head.appendChild(t)}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/danmu-on.svg":"4KfW9","bundle-text:./img/danmu-off.svg":"9UR3U","bundle-text:./img/danmu-config.svg":"4MPCW","bundle-text:./img/danmu-style.svg":"7lV5Q","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(t,e,i){e.exports='.art-danmuku-emitter{background-color:#ffffff4d;border-radius:5px;width:100%;max-width:100%;height:32px;font-size:12px;line-height:1;display:flex;position:relative}.art-danmuku-emitter .art-backdrop-filter{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3!important}.art-danmuku-emitter .art-danmuku-left{border-radius:3px 0 0 3px;flex:1;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style{justify-content:center;align-items:center;width:32px;display:flex;position:relative}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{z-index:999;width:200px;padding-bottom:10px;display:none;position:absolute;bottom:30px;left:-85px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner{background-color:#000000e6;border-radius:3px;flex-direction:column;padding:10px 10px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-title{margin-bottom:10px;font-size:13px
Line truncated
|
||||
<svg viewBox="0 0 ${d.w} ${d.h}">
|
||||
<defs>
|
||||
<linearGradient id="heatmap-solids" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" />
|
||||
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" id="heatmap-start" />
|
||||
<stop offset="0%" style="stop-color:var(--art-progress-color);stop-opacity:1" id="heatmap-stop" />
|
||||
<stop offset="100%" style="stop-color:var(--art-progress-color);stop-opacity:1" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path fill="url(#heatmap-solids)" d="${b}"></path>
|
||||
</svg>
|
||||
`,s=r("#heatmap-start",o),l=r("#heatmap-stop",o),s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{s&&l&&(s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{s&&l&&"played"===t&&(s.setAttribute("offset",`${100*e}%`),l.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>u()),t.on("resize",()=>u()),t.on("artplayerPluginDanmuku:loaded",()=>u()),t.on("artplayerPluginDanmuku:points",t=>u(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0");
|
||||
@@ -4,4 +4,36 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],s=i.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!s[e]){if(!t[e]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!0);if(i)return i(e,!0);if(u&&"string"==typeof e)return u(e);var c=new Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=s[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return s[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=s,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c<e.length;c++)l(e[c]);if(r){var p=l(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd&&define((function(){return p}))}}({"40mNk":[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var a=t("./danmuku"),o=n.interopDefault(a),i=t("./setting"),s=n.interopDefault(i),u=t("./heatmap"),l=n.interopDefault(u);function c(t){return function(e){!function(t){var e=t.constructor,r=e.version,n=e.utils.errorHandle,a=r.split(".").map(Number);n(a[0]+a[1]/100>=5,"Artplayer.js@".concat(r," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"))}(e);var r=new(0,o.default)(e,t);return(0,s.default)(e,r),t.heatmap&&(0,l.default)(e,r,t.heatmap),{name:"artplayerPluginDanmuku",emit:r.emit.bind(r),load:r.load.bind(r),config:r.config.bind(r),hide:r.hide.bind(r),show:r.show.bind(r),reset:r.reset.bind(r),get option(){return r.option},get isHide(){return r.isHide},get isStop(){return r.isStop}}}}r.default=c,c.env="production",c.version="5.0.1",c.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return b}));var a=t("@swc/helpers/src/_async_to_generator.mjs"),o=n.interopDefault(a),i=t("@swc/helpers/src/_class_call_check.mjs"),s=n.interopDefault(i),u=t("@swc/helpers/src/_create_class.mjs"),l=n.interopDefault(u),c=t("@swc/helpers/src/_object_spread.mjs"),p=n.interopDefault(c),f=t("@swc/helpers/src/_object_spread_props.mjs"),d=n.interopDefault(f),m=t("@swc/helpers/src/_ts_generator.mjs"),h=n.interopDefault(m),y=t("./bilibili"),g=t("./getDanmuTop"),v=n.interopDefault(g),b=function(){"use strict";function e(r,n){(0,s.default)(this,e);var a=r.constructor,o=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=o.$danmuku,this.$player=o.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,l.default)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter((function(e){return e.$state===t})).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shaLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(t,e,r,n,a){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!u[e]){if(!t[e]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(e,!0);// Try the node require function if it exists.
|
||||
if(s&&"string"==typeof e)return s(e);var c=Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=u[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return u[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=u,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c<e.length;c++)l(e[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var p=l(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd?define(function(){return p}):a&&(this[a]=p)}}({"40mNk":[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return c});var a=t("./danmuku"),o=n.interopDefault(a),i=t("./setting"),u=n.interopDefault(i),s=t("./heatmap"),l=n.interopDefault(s);function c(t){return function(e){n=(r=e.constructor).version,(0,r.utils.errorHandle)((a=n.split(".").map(Number))[0]+a[1]/100>=5,"Artplayer.js@".concat(n," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"));var r,n,a,i=new o.default(e,t);return(0,u.default)(e,i),t.heatmap&&(0,l.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}c.env="production",c.version="5.0.1",c.build="2023-11-23 23:22:00","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return d});var a=t("@swc/helpers/_/_async_to_generator"),o=t("@swc/helpers/_/_class_call_check"),i=t("@swc/helpers/_/_create_class"),u=t("@swc/helpers/_/_object_spread"),s=t("@swc/helpers/_/_object_spread_props"),l=t("@swc/helpers/_/_ts_generator"),c=t("./bilibili"),p=t("./getDanmuTop"),f=n.interopDefault(p),d=/*#__PURE__*/function(){function e(r,n){(0,o._)(this,e);var a=r.constructor,i=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){//
|
||||
}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,i._)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter(function(e){return e.$state===t}).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',e}},{key:"getReady",value:function(){var t=this.art.currentTime;return this.queue.filter(function(e){return"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1})}},{key:"getEmits",value:function(){var t=this,e=[],r=this.$player.clientWidth,n=this.getLeft(this.$player);return this.filter("emit",function(a){var o=a.$ref.offsetTop,i=t.getLeft(a.$ref)-n,u=a.$ref.clientHeight,s=a.$ref.clientWidth,l=i+s,c=r-l,p=l/a.$restTime,f={};f.top=o,f.left=i,f.height=u,f.width=s,f.right=c,f.speed=p,f.distance=l,f.time=a.$restTime,f.mode=a.mode,e.push(f)}),e}},{key:"getFontSize",value:function(t){var r=this.utils.clamp,n=this.$player.clientHeight;return"number"==typeof t?r(t,12,n):"string"==typeof t&&t.endsWith("%")?r(n*(parseFloat(t)/100),12,n):e.option.fontSize}},{key:"postMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this;return new Promise(function(r){e.option.useWorker&&e.worker&&e.worker.postMessage?(t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var n=e.data;n.id===t.id&&r(n)}):r({top:(0,f.default)(t)})})}},{key:"load",value:function(){var t=this;return(0,a._)(function(){var e;return(0,l._)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,8,,9]),"function"!=typeof t.option.danmuku)return[3,2];return[4,t.option.danmuku()];case 1:case 3:case 5:return t.danmus=r.sent(),[3,7];case 2:if("function"!=typeof t.option.danmuku.then)return[3,4];return[4,t.option.danmuku];case 4:if("string"!=typeof t.option.danmuku)return[3,6];return[4,(0,c.bilibiliDanmuParseFromUrl)(t.option.danmuku)];case 6:t.danmus=t.option.danmuku,r.label=7;case 7:return t.utils.errorHandle(Array.isArray(t.danmus),"Danmuku need return an array as result"),t.art.emit("artplayerPluginDanmuku:loaded",t.danmus),t.queue=[],t.$danmuku.innerText="",t.danmus.forEach(function(e){return t.emit(e)}),[3,9];case 8:throw e=r.sent(),t.art.emit("artplayerPluginDanmuku:error",e),e;case 9:return[2,t]}})})()}},{key:"config",value:function(t){var r=this.utils.clamp;return this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.speed=r(this.option.speed,1,10),this.option.opacity=r(this.option.opacity,0,1),this.option.lockTime=r(Math.floor(this.option.lockTime),0,60),this.option.maxLength=r(this.option.maxLength,0,500),this.option.minWidth=r(this.option.minWidth,0,500),this.option.maxWidth=r(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}},{key:"makeWait",value:function(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}},{key:"continue",value:function(){var t=this.$player.clientWidth;return this.filter("stop",function(e){if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){var r=t+e.$ref.clientWidth;e.$ref.style.transform="translateX(".concat(-r,"px)"),e.$ref.style.transition="transform ".concat(e.$restTime,"s linear 0s")}}),this}},{key:"suspend",value:function(){var tLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return i}),n.export(r,"__assign",function(){return u}),n.export(r,"__rest",function(){return s}),n.export(r,"__decorate",function(){return l}),n.export(r,"__param",function(){return c}),n.export(r,"__esDecorate",function(){return p}),n.export(r,"__runInitializers",function(){return f}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return m}),n.export(r,"__metadata",function(){return h}),n.export(r,"__awaiter",function(){return y}),n.export(r,"__generator",function(){return g}),n.export(r,"__createBinding",function(){return v}),n.export(r,"__exportStar",function(){return _}),n.export(r,"__values",function(){return b}),n.export(r,"__read",function(){return k}),/** @deprecated */n.export(r,"__spread",function(){return x}),/** @deprecated */n.export(r,"__spreadArrays",function(){return w}),n.export(r,"__spreadArray",function(){return D}),n.export(r,"__await",function(){return j}),n.export(r,"__asyncGenerator",function(){return S}),n.export(r,"__asyncDelegator",function(){return C}),n.export(r,"__asyncValues",function(){return O}),n.export(r,"__makeTemplateObject",function(){return B}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return A}),n.export(r,"__classPrivateFieldGet",function(){return P}),n.export(r,"__classPrivateFieldSet",function(){return M}),n.export(r,"__classPrivateFieldIn",function(){return T}),n.export(r,"__addDisposableResource",function(){return W}),n.export(r,"__disposeResources",function(){return H});var a=t("@swc/helpers/_/_type_of"),o=function(t,e){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var u=function(){return(u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function s(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>e.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)0>e.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function l(t,e,r,n){var a,o=arguments.length,i=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function c(t,e){return function(r,n){e(r,n,t)}}function p(t,e,r,n,a,o){function i(t){if(void 0!==t&&"function"!=typeof t)throw TypeError("Function expected");return t}for(var u,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",c=!e&&t?n.static?t:t.prototype:null,p=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,d=r.length-1;d>=0;d--){var m={};for(var h in n)m[h]="access"===h?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(t){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(i(t||null))};var y=(0,r[d])("accessor"===s?{get:p.get,set:p.set}:p[l],m);if("accessor"===s){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw TypeError("Object expected");(u=i(y.get))&&(p.get=u),(u=i(y.set))&&(p.set=u),(u=i(y.init))&&a.unshift(u)}else(u=i(y))&&("field"===s?a.unshift(u):p[l]=u)}c&&Object.defineProperty(c,n.name,p),f=!0}function f(t,e,r){for(var n=arguments.length>2,a=0;a<e.length;a++)r=n?e[a].call(t,r):e[a].call(t);return n?r:void 0}function d(t){return(void 0===t?"undefined":(0,a._)(t))==="symbol"?t:"".concat(t)}function m(t,e,r){return(void 0===e?"undefined":(0,a._)(e))==="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function h(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function y(t,e,r,n){return new(r||(r=Promise))(function(a,o){function i(t){try{s(n.next(t))}catch(t){o(t)}}function u(t){try{s(n.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(i,u)}s((n=n.apply(t,e||[])).next())})}function g(t,e){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Sym
Line truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],u=a.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);if(a)return a(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=u[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({"92dvd":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');const a=e.auto||"Auto",u=e.title||"Quality",l=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=l[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:u,icon:i.default,width:200,selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}n.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],l=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=d(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):r&&(this[r]=f)}}({"92dvd":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>a);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],i=o[1]/100;n(r+i>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');let a=e.auto||"Auto",l=e.title||"Quality",u=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=u[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:l,icon:i.default,width:200,selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}a.env="production",a.version="2.0.0",a.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[r]&&i[r],a=u.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!a[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var f=a[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({gZVrQ:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),i=r.interopDefault(o);function u(e){return function(t){!function(e){var t=e.constructor,n=t.version,r=t.utils.errorHandle,o=n.split(".").map(Number);r(o[0]+o[1]/100>=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o,u,a,l=t.dash||window.dash;r(l&&l.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=l.getBitrateInfoListFor("video"),c=l.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=l.getSettings(),g=f[c],v=(null==h||null===(o=h.streaming)||void 0===o||null===(u=o.abr)||void 0===u||null===(a=u.autoSwitchBitrate)||void 0===a?void 0:a.video)?d:p(g),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:v,style:{padding:"0 10px"},selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:v,html:s,icon:i.default,width:200,selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginDashQuality"}}}n.default=u,u.env="production",u.version="2.0.0",u.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[o]&&i[o],l=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(u)return u(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=d(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):r&&(this[r]=f)}}({gZVrQ:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return u});var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function u(e){return function(t){o=(n=t.constructor).version,(0,n.utils.errorHandle)((r=o.split(".").map(Number))[0]+r[1]/100>=5,"Artplayer.js@".concat(o," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var n,o,r,l=t.template.$video,a=t.constructor.utils.errorHandle;function d(){var n,o,r,u=t.dash||window.dash;a(u&&u.getVideoElement()===l,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=u.getBitrateInfoListFor("video"),c=u.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=u.getSettings(),v=f[c],g=(null==h?void 0:null===(r=h.streaming)||void 0===r?void 0:null===(o=r.abr)||void 0===o?void 0:null===(n=o.autoSwitchBitrate)||void 0===n?void 0:n.video)?d:p(v),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:g,style:{padding:"0 10px"},selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:g,html:s,icon:i.default,width:200,selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",d),t.on("restart",d),{name:"artplayerPluginDashQuality"}}}u.env="production",u.version="2.0.0",u.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(s&&"string"==typeof t)return s(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new a.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=i,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return l[o]}}),l[o]=a;for(var f=0;f<t.length;f++)a(t[f]);if(n){var c=a(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),a=r.levels[r.currentLevel],f=a?s(a):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(s&&"string"==typeof t)return s(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[o]}}),l[o]=f;for(var a=0;a<t.length;a++)f(t[a]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=f(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):r&&(this[r]=c)}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>i);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],l=o[1]/100;n(r+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');let i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.levels[r.currentLevel],a=f?s(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:a,style:{padding:"0 10px"},selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:a,html:u,icon:l.default,width:200,selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof l[r]&&l[r];if(!n&&o)return o(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s<t.length;s++)f(t[s]);if(n){var c=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({"34JKw":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){!function(e){var t=e.constructor,n=t.version,r=t.utils.errorHandle,o=n.split(".").map(Number);r(o[0]+o[1]/100>=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o=t.hls||window.hls;r(o&&o.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');var i=e.auto||"Auto",u=e.title||"Quality",a=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=o.levels[o.currentLevel],s=f?a(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:u,icon:l.default,width:200,selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,r,o){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof l[r]&&l[r];if(!n&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s<t.length;s++)f(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=f(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):o&&(this[o]=c)}}({"34JKw":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",function(){return i});var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){r=(n=t.constructor).version,(0,n.utils.errorHandle)((o=r.split(".").map(Number))[0]+o[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"));var n,r,o,u=t.template.$video,a=t.constructor.utils.errorHandle;function f(){var n=t.hls||window.hls;a(n&&n.media===u,'Cannot find instance of HLS from "art.hls" or "window.hls"');var r=e.auto||"Auto",o=e.title||"Quality",i=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=n.levels[n.currentLevel],s=f?i(f):r;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:o,icon:l.default,width:200,selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",f),t.on("restart",f),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0");
|
||||
@@ -4,4 +4,24 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,s){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[r]&&o[r],a=i.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!a[t]){if(!e[t]){var s="function"==typeof o[r]&&o[r];if(!n&&s)return s(t,!0);if(i)return i(t,!0);if(d&&"string"==typeof t)return d(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var u=a[t]=new f.Module(t);e[t][0].call(u.exports,l,u,u.exports,this)}return a[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=a,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return o[r]}}),o[r]=f;for(var c=0;c<t.length;c++)f(t[c]);if(n){var u=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({aFKtw:[function(e,t,n){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n);class r{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:n=0}){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:n},"*")}static async onMessage(e){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');const{type:t,data:n,id:s}=e.data;if("commit"===t)try{if(n.match(/\bresolve\((.*?)\)/)){const e=`return new Promise(function(resolve){\n${n}\n})`,t=await new Function(e)();r.postMessage({type:"response",data:t,id:s})}else{const e=new Function(n)();r.postMessage({type:"response",data:e,id:s})}}catch(e){throw r.postMessage({type:"error",data:e.message,id:s}),e}}static inject(){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');r.postMessage({type:"inject"}),window.addEventListener("message",r.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw new Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw new Error('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:n,id:r}=e.data;if("inject"===t)this.injected=!0;this.promises[r]&&("error"===t?this.promises[r].reject(new Error(n)):this.promises[r].resove(n),delete this.promises[r]),this.messageCallback&&this.messageCallback({type:t,data:n})}postMessage({type:e,data:t}){return new Promise(((n,r)=>{(function s(){if(this.destroyed)r(new Error("The instance has been destroyed"));else if(this.injected){const s=Date.now();this.promises[s]={resove:n,reject:r},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)}))}commit(e){if("function"!=typeof e)throw new Error('"commit.callback" needs to be a function');const t=e.toString(),n=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:n})}message(e){if("function"!=typeof e)throw new Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}n.default=r,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,s){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],a=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!a[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var s="function"==typeof o[n]&&o[n];if(!r&&s)return s(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(f&&"string"==typeof t)return f(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var u=a[t]=new d.Module(t);e[t][0].call(u.exports,c,u,u.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=i,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return o[n]}}),o[n]=d;for(var l=0;l<t.length;l++)d(t[l]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var u=d(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):s&&(this[s]=u)}}({aFKtw:[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);class n{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:r=0}){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:r},"*")}static async onMessage(e){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');let{type:t,data:r,id:s}=e.data;if("commit"===t)try{if(r.match(/\bresolve\((.*?)\)/)){let e=`return new Promise(function(resolve){
|
||||
${r}
|
||||
})`,t=await Function(e)();n.postMessage({type:"response",data:t,id:s})}else{let e=Function(r)();n.postMessage({type:"response",data:e,id:s})}}catch(e){throw n.postMessage({type:"error",data:e.message,id:s}),e}}static inject(){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');n.postMessage({type:"inject"}),window.addEventListener("message",n.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw Error('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){let{type:t,data:r,id:n}=e.data;"inject"===t&&(this.injected=!0),this.promises[n]&&("error"===t?this.promises[n].reject(Error(r)):this.promises[n].resove(r),delete this.promises[n]),this.messageCallback&&this.messageCallback({type:t,data:r})}postMessage({type:e,data:t}){return new Promise((r,n)=>{(function s(){if(this.destroyed)n(Error("The instance has been destroyed"));else if(this.injected){let s=Date.now();this.promises[s]={resove:r,reject:n},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)})}commit(e){if("function"!=typeof e)throw Error('"commit.callback" needs to be a function');let t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}message(e){if("function"!=typeof e)throw Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}r.default=n,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0");
|
||||
@@ -4,4 +4,35 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof s[n]&&s[n],i=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!i[r]){if(!e[r]){var o="function"==typeof s[n]&&s[n];if(!t&&o)return o(r,!0);if(a)return a(r,!0);if(c&&"string"==typeof r)return c(r);var f=new Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=i[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return i[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=i,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return s[n]}}),s[n]=u;for(var f=0;f<r.length;f++)u(r[f]);if(t){var l=u(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define((function(){return l}))}}({akNoT:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",(function(){return p}));var o=e("@swc/helpers/src/_async_to_generator.mjs"),s=n.interopDefault(o),a=e("@swc/helpers/src/_class_call_check.mjs"),i=n.interopDefault(a),c=e("@swc/helpers/src/_create_class.mjs"),u=n.interopDefault(c),f=e("@swc/helpers/src/_ts_generator.mjs"),l=n.interopDefault(f),p=function(){"use strict";function e(r){var t=r.iframe,n=r.url;if((0,i.default)(this,e),t instanceof HTMLIFrameElement==!1)throw new Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof n)throw new Error('"option.url" needs to be a string');this.url=n,this.$iframe=t,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=function(){return null},this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}return(0,u.default)(e,[{key:"onMessage",value:function(e){var r=e.data,t=r.type,n=r.data,o=r.id;if("inject"===t)this.injected=!0;this.promises[o]&&("error"===t?this.promises[o].reject(new Error(n)):this.promises[o].resove(n),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:n})}},{key:"postMessage",value:function(e){var r=e.type,t=e.data,n=this;return new Promise((function(e,o){(function n(){if(this.destroyed)o(new Error("The instance has been destroyed"));else if(this.injected){var s=Date.now();this.promises[s]={resove:e,reject:o},this.$iframe.contentWindow.postMessage({type:r,data:t,id:s},"*")}else setTimeout(n.bind(this),200)}).call(n)}))}},{key:"commit",value:function(e){if("function"!=typeof e)throw new Error('"commit.callback" needs to be a function');var r=e.toString(),t=r.substring(r.indexOf("{")+1,r.lastIndexOf("}"));return this.postMessage({type:"commit",data:t})}},{key:"message",value:function(e){if("function"!=typeof e)throw new Error('"message.callback" needs to be a function');this.messageCallback=e}},{key:"destroy",value:function(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}],[{key:"iframe",get:function(){return window.top!==window}},{key:"postMessage",value:function(r){var t=r.type,n=r.data,o=r.id,s=void 0===o?0:o;if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:n,id:s},"*")}},{key:"onMessage",value:function(r){return(0,s.default)((function(){var t,n,o,s,a,i,c,u;return(0,l.default)(this,(function(f){switch(f.label){case 0:if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');return t=r.data,n=t.type,o=t.data,s=t.id,"commit"===n?[3,1]:[3,7];case 1:return f.trys.push([1,5,,6]),o.match(/\bresolve\((.*?)\)/)?(a="return new Promise(function(resolve){\n".concat(o,"\n})"),[4,new Function(a)()]):[3,3];case 2:return i=f.sent(),e.postMessage({type:"response",data:i,id:s}),[3,4];case 3:c=new Function(o)(),e.postMessage({type:"response",data:c,id:s}),f.label=4;case 4:return[3,6];case 5:throw u=f.sent(),e.postMessage({type:"error",data:u.message,id:s}),u;case 6:case 7:return[3,8];case 8:return[2]}}))}))()}},{key:"inject",value:function(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}}]),e}();"undefined"!=typeof window&&(window.ArtplayerPluginIframe=p)},{"@swc/helpers/src/_async_to_generator.mjs":"9vSoD","@swc/helpers/src/_class_call_check.mjs":"iwG1v","@swc/helpers/src/_create_class.mjs":"6rgu9","@swc/helpers/src/_ts_generator.mjs":"8UZjC","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9vSoD":[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineILine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,r,t,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],s=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!s[r]){if(!e[r]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!t&&o)return o(r,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(r,!0);// Try the node require function if it exists.
|
||||
if(c&&"string"==typeof r)return c(r);var f=Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=s[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return s[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var f=0;f<r.length;f++)u(r[f]);if(t){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var l=u(t);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):o&&(this[o]=l)}}({akNoT:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",function(){return c});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_class_call_check"),a=e("@swc/helpers/_/_create_class"),s=e("@swc/helpers/_/_ts_generator"),c=/*#__PURE__*/function(){function e(r){var t=r.iframe,n=r.url;if((0,i._)(this,e),t instanceof HTMLIFrameElement==!1)throw Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof n)throw Error('"option.url" needs to be a string');this.url=n,this.$iframe=t,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=function(){return null},this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}return(0,a._)(e,[{key:"onMessage",value:function(e){var r=e.data,t=r.type,n=r.data,o=r.id;"inject"===t&&(this.injected=!0),this.promises[o]&&("error"===t?this.promises[o].reject(Error(n)):this.promises[o].resove(n),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:n})}},{key:"postMessage",value:function(e){var r=e.type,t=e.data,n=this;return new Promise(function(e,o){(function n(){if(this.destroyed)o(Error("The instance has been destroyed"));else if(this.injected){var i=Date.now();this.promises[i]={resove:e,reject:o},this.$iframe.contentWindow.postMessage({type:r,data:t,id:i},"*")}else setTimeout(n.bind(this),200)}).call(n)})}},{key:"commit",value:function(e){if("function"!=typeof e)throw Error('"commit.callback" needs to be a function');var r=e.toString(),t=r.substring(r.indexOf("{")+1,r.lastIndexOf("}"));return this.postMessage({type:"commit",data:t})}},{key:"message",value:function(e){if("function"!=typeof e)throw Error('"message.callback" needs to be a function');this.messageCallback=e}},{key:"destroy",value:function(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}],[{key:"iframe",get:function(){return window.top!==window}},{key:"postMessage",value:function(r){var t=r.type,n=r.data,o=r.id;if(!e.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:n,id:void 0===o?0:o},"*")}},{key:"onMessage",value:function(r){return(0,o._)(function(){var t,n,o,i,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:if(!e.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');if(n=(t=r.data).type,o=t.data,i=t.id,"commit"===n)return[3,1];return[3,7];case 1:if(s.trys.push([1,5,,6]),!o.match(/\bresolve\((.*?)\)/))return[3,3];return[4,Function("return new Promise(function(resolve){\n".concat(o,"\n})"))()];case 2:return a=s.sent(),e.postMessage({type:"response",data:a,id:i}),[3,4];case 3:c=Function(o)(),e.postMessage({type:"response",data:c,id:i}),s.label=4;case 4:return[3,6];case 5:throw u=s.sent(),e.postMessage({type:"error",data:u.message,id:i}),u;case 6:case 7:return[3,8];case 8:return[2]}})})()}},{key:"inject",value:function(){if(!e.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}}]),e}();"undefined"!=typeof window&&(window.ArtplayerPluginIframe=c)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_class_call_check":"9iJMm","@swc/helpers/_/_create_class":"21IOT","@swc/helpers/_/_ts_generator":"6Xyd0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,r,t,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){t(e);return}s.done?r(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function s(e){o(a,n,i,s,c,"next",e)}function c(e){o(a,n,i,s,c,"throw",e)}s(void 0)})}}n.defineInteropFlag(t),n.export(t,"_async_to_generator",function(){return i}),n.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,r,t){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||r.hasOwnProperty(t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}],"9iJMm":[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,r){if(!(e instanceof r))throw TypeError("Cannot call a class as a function")}n.defineInteropFlag(t),n.export(t,"_class_call_check",function(){return o}),n.export(t,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"__extends",function(){return a}),n.export(t,"__assign",function(){return s}),n.export(t,"__rest",function(){return c}),n.export(t,"__decorate",function(){return u}),n.export(t,"__param",function(){return f}),n.export(t,"__esDecorate",function(){return l}),n.export(t,"__runInitializers",function(){return p}),n.export(t,"__propKey",function(){return d}),n.export(t,"__setFunctionName",function(){return y}),n.export(t,"__metadata",function(){return _}),n.export(t,"__awaiter",function(){return h}),n.export(t,"__generator",function(){return m}),n.export(t,"__createBinding",function(){return v}),n.export(t,"__exportStar",function(){return b}),n.export(t,"__values",function(){return w}),n.export(t,"__read",function(){return g}),/** @deprecated */n.export(t,"__spread",function(){return j}),/** @deprecated */n.export(t,"__spreadArrays",function(){return x}),n.export(t,"__spreadArray",function(){return O}),n.export(t,"__await",function(){return P}),n.export(t,"__asyncGenerator",function(){return E}),n.export(t,"__asyncDelegator",function(){return S}),n.export(t,"__asyncValues",function(){return T}),n.export(t,"__makeTemplateObject",function(){return k}),n.export(t,"__importStar",function(){return I}),n.export(t,"__importDefault",function(){return D}),n.export(t,"__classPrivateFieldGet",function(){return F}),n.export(t,"__classPrivateFieldSet",function(){return A}),n.export(t,"__classPrivateFieldIn",function(){return R}),n.export(t,"__addDisposableResource",function(){return C}),n.export(t,"__disposeResources",function(){return N});var o=e("@swc/helpers/_/_type_of"),i=function(e,r){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)};function a(e,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}i(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var s=function(){return(s=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function c(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>r.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>r.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]]);return t}function u(e,r,t,n){var o,i=arguments.length,a=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(r,t,a):o(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a}function f(e,r){return function(t,n){r(t,n,e)}}function l(e,r,t,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",f=!r&&e?n.static?e:e.prototype:null,l=r||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=t.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,t[d])("accessor"===c?{get:l.get,set:l.set}:l[u],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(s=a(h.get))&&(l.get=s),(s=a(h.set))&&(l.set=s),(s=a(h.init))&&o.unshift(s)}else(s=a(h))&&("field"===c?o.unshift(s):l[u]=s)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,r,t){for(var n=arguments.length>2,o=0;o<r.length;o++)t=n?r[o].call(e,t):r[o].call(e);return n?t:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function y(e,r,t){return(void 0===r?"undefined":(0,o._)(r))==="symbol"&&(r=r.description?"[".concat(r.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:t?"".concat(t," ",r):r})}function _(e,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,r)}function h(e,r,t,n){return new(t||(t=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?o(e.value):((r=e.value)instanceof t?r:new t(function(e){e(r)})).then(a,s)}c((n=n.apply(e,r||[])).next())})}function m(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Sym
Line truncated
|
||||
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,i,r){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[i]&&a[i],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!s[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(o)return o(t,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},d.cache={};var c=s[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return s[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=o,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=u(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):r&&(this[r]=c)}}({"4Kbf6":[function(e,t,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>s);var r=e("./parser");function a(e){let t={"&":"&","<":"<",">":">","'":"'",""":'"'},n=RegExp(`(${Object.keys(t).join("|")})`,"g");return e.replace(n,e=>t[e]||e)}async function o(e){let{getExt:t,srtToVtt:n,assToVtt:i}=Artplayer.utils,r=await fetch(e.url),a=await r.arrayBuffer(),o=new TextDecoder(e.encoding||"utf-8"),s=o.decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}function s({subtitles:e}){return async t=>{let n=await Promise.all(e.map(o)),i=function(e,t){let n=new r.WebVTTParser,i=new r.WebVTTSerializer,a=n.parse("","metadata");for(let i=0;i<e.length;i++){let r=t[i],o=n.parse(e[i],"metadata");for(let e=0;e<o.cues.length;e++){let t=o.cues[e];for(let e=0;e<t.tree.children.length;e++){let n=t.tree.children[e];n.value=`<div class="art-subtitle-${r.name}">${n.value}</div>`}}if(0===a.cues.length)a.cues=o.cues;else for(let e=0;e<a.cues.length;e++)a.cues[e].tree.children.push(...o.cues[e]?.tree?.children||[])}return i.serialize(a.cues)}(n,e),s=URL.createObjectURL(new Blob([i],{type:"text/vtt"}));t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:s,type:"vtt",onVttLoad:a})}}s.env="production",s.version="1.0.0",s.build="2023-11-23 23:22:06","undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=s)},{"./parser":"cU78l","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],cU78l:[function(e,t,n){!// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":"\xa0"}),this.entities=t,this.parse=function(n,a){// global search and replace for \0
|
||||
n=n.replace(/\0/g,"�");var o=Date.now(),s=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:s+1,col:t})}var m=l[s],g=m.length,h="WEBVTT",v=0,b=h.length;/* HEADER */for("\uFEFF"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&" "!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=l[s]&&void 0!=l[s];){if(p("No blank line after the signature."),-1!=l[s].indexOf("-->")){u=!0;break}s++}/* CUE LOOP */for(;void 0!=l[s];){for(;!u&&""==l[s];)s++;if(!u&&void 0==l[s])break;/* CUE CREATION */T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var T,x=!0;if(-1==l[s].indexOf("-->")){/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/if(T.id=l[s],/^NOTE($|[ \t])/.test(T.id)){for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&p("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(T.id)){var y=[],w=!1;for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[s]),s++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(y.join("\n"));continue}if(""==l[++s]||void 0==l[s]){p("Cue identifier cannot be standalone.");continue}if(-1==l[s].indexOf("-->")){x=!1,p("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */u=!1;var O=new i(l[s],p),P=0;if(c.length>0&&(P=c[c.length-1].startTime),x&&!O.parse(T,P)){/* BAD CUE LOOP */for(/* BAD CUE */T=null,s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){u=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){p("Blank line missing before cue."),u=!0;break}""!=T.text&&(T.text+="\n"),T.text+=l[s],s++}/* CUE TEXT PROCESSING */var j=new r(T.text,p,a,t);T.tree=j.parse(T.startTime,T.endTime),c.push(T)}/* END */return c.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:c,errors:d,time:Date.now()-o,styles:f}}},i=function(e,t){var n=/[\u0020\t\f]/,i=/[^\u0020\t\f]/,e=e,r=0,a=function(e){t(e,r+1)};function o(t){for(;void 0!=e[r]&&t.test(e[r]);)r++}function s(t){for(var n="";void 0!=e[r]&&t.test(e[r]);)n+=e[r],r++;return n}/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */function l(){var t,n,i,o,l="minutes";// 3
|
||||
if(void 0==e[r]){a("No timestamp found.");return}// 4
|
||||
if(!/\d/.test(e[r])){a("Timestamp must start with a character in the range 0-9.");return}// 8
|
||||
if((// 5-7
|
||||
(t=s(/\d/)).length>2||parseInt(t,10)>59)&&(l="hours"),":"!=e[r]){a("No time unit separator found.");return}if(r++,2!=// 9-11
|
||||
(n=s(/\d/)).length){a("Must be exactly two digits.");return}// 12
|
||||
if("hours"==l||":"==e[r]){if(":"!=e[r]){a("No seconds found or minutes is greater than 59.");return}if(r++,2!=(i=s(/\d/)).length){a("Must be exactly two digits.");return}}else{if(2!=t.length){a("Must be exactly two digits.");return}i=n,n=t,t="0"}// 13
|
||||
if("."!=e[r]){a('No decimal separator (".") found.');return}if(r++,3!=// 14-16
|
||||
(o=s(/\d/)).length){a("Milliseconds must be given in three digits.");return}// 17
|
||||
if(parseInt(n,10)>59){a("You cannot have more than 59 minutes.");return}if(parseInt(i,10)>59){a("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(n,10)+parseInt(i,10)+parseInt(o,10)/1e3}this.parse=function(t,s){if(o(n),t.startTime=l(),void 0!=t.startTime){// 6-8
|
||||
if(t.startTime<s&&a("Start timestamp is not greater than or equal to start timestamp of previous cue."),i.test(e[r])&&a("Timestamp not separated from '-->' by whitespace."),o(n),"-"!=e[r]||"-"!=e[++r]||">"!=e[++r]){a("No valid timestamp separator found.");return}if(r++,i.test(e[r])&&a("'-->' not separated from timestamp by whitespace."),o(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&a("End timestamp is not greater than start timestamp."),i.test(e[r]),o(n),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var i=e.split(n),r=[],o=0;o<i.length;o++)if(""!=i[o]){var s=i[o].indexOf(":"),l=i[o].slice(0,s),u=i[o].slice(s+1);if(-1!=r.indexOf(l)&&a("Duplicate setting."),r.push(l),""==u){a("No value for setting defined.");return}if("vertical"==l){if("rl"!=u&&"lr"!=u){a("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=u}else if("line"==l){if(/,/.test(u)){var f=u.split(",");u=f[0];var c=f[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(u)){a("Line position takes a number or percentage.");continue}if(-1!=u.indexOf("-",1)){a("Line position can only have '-' at the start.");continue}if(-1!=u.indexOf("%")&&u.indexOf("%")!=u.length-1){a("Line position can only have '%' at the end.");continue}if("-"==u[0]&&"%"==u[u.length-1]){a("Line position cannot be a negative percentage.");continue}var d=u,p=!1;if("%"==u[u.length-1]&&(p=!0,d=u.slice(0,u.length-1),parseInt(u,10)>100)){a("Line position cannot be >100%.");continue}if(""===d||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==c){if(!["start","center","end"].includes(c)){a("Line alignment needs to be one of start, center or end");continue}t.lineAlign=c}t.snapToLines=!p,t.linePosition=parseFloat(d),parseFloat(d).toString()!==d&&(t.nonSerializable=!0)}else if("position"==l){if(/,/.test(u)){var f=u.split(",");u=f[0];var m=f[1]}if("%"!=u[u.length-1]){a("Text position must be a percentage.");continue}if(parseInt(u,10)>100||0>parseInt(u,10)){a("Text position needs to be between 0 and 100%.");continue}if(""===(d=u.slice(0,u.length-1))||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==m){if(!["line-left","center","line-right"].includes(m)){a("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=m}t.textPosition=parseFloat(d)}else if("size"==l){if("%"!=u[u.length-1]){a("Size must be a percentage.");continue}if(parseInt(u,10)>100){a("Size cannot be >100%.");continue}var g=u.slice(0,u.length-1);if(void 0===g||""===g||isNaN(g)){a("Size needs to be a number"),g=100;continue}if((g=parseFloat(g))<0||g>100){a("Size needs to be between 0 and 100%.");continue}t.size=g}else if("align"==l){var h=["start","center","end","left","right"];if(-1==h.indexOf(u)){a("Alignment can only be set to one of "+h.join(", ")+".");continue}t.alignment=u}else a("Invalid setting.")}}(e.substring(r),t),!0}},this.parseTimestamp=function(){var t=l();if(void 0!=e[r]){a("Timestamp must not have trailing characters.");return}return t}},r=function(e,t,n,r){this.entities=r;var a=this,e=e,o=0,s=function(e){"metadata"!=n&&t(e,o+1)};this.parse=function(t,l){var u={children:[]},f=u,c=[];function d(e){f.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:f}),f=f.children[f.children.length-1]}for(;void 0!=e[o];){var p=function(){for(var t="data",n="",i="",l=[];void 0!=e[o-1]||0==o;){var u=e[o];if("data"==t){if("&"==u)i=u,t="escape";else if("<"==u&&""==n)t="tag";else{if("<"==u||void 0==u)return["text",n];n+=u}}else if("escape"==t){if("<"==u||void 0==u){let e;return s("Incorrect escape."),(e=i.match(/^&#([0-9]+)$/))?n+=String.fromCharCode(e[1]):a.entities[i]?n+=a.entities[i]:n+=i,["text",n]}if("&"==u)s("Incorrect escape."),n+=i,i=u;else if(/[a-z#0-9]/i.test(u))i+=u;else if(";"==u){let e;(e=i.match(/^&#(x?[0-9]+)$/))?n+=String.fromCharCode("0"+e[1]):a.entities[i+u]?n+=a.entities[i+u]:(e=Object.keys(r).find(e=>i.startsWith(e)))?n+=a.entities[e]+i.slice(e.length)+u:(s("Incorrect escape."),n+=i+";"),t="data"}else s("Incorrect escape."),n+=i+u,t="data"}else if("tag"==t){if(" "==u||"\n"==u||"\f"==u||" "==u)t="start tag annotation";else if("."==u)t="start tag class";else if("/"==u)t="end tag";else if(/\d/.test(u))n=u,t="timestamp tag";else{if(">"==u||void 0==u)return">"==u&&o++,["start tag","",[],""];n=u,t="start tag"}}else if("start tag"==t){if(" "==u||"\f"==u||" "==u)t="start tag annotation";else if("\n"==u)i=u,t="start tag annotation";else if("."==u)t="start tag class";else{if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,[],""];n+=u}}else if("start tag class"==t){if(" "==u||"\f"==u||" "==u)i&&l.push(i),i="",t="start tag annotation";else if("\n"==u)i&&l.push(i),i=u,t="start tag annotation";else if("."==u)i&&l.push(i),i="";else{if(">"==u||void 0==u)return">"==u&&o++,i&&l.push(i),["start tag",n,l,""];i+=u}}else if("start tag annotation"==t){if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,l,i=i.split(/[\u0020\t\f\r\n]+/).filter(fuLine truncated
|
||||
;// 8
|
||||
o++}}();if("text"==p[0])f.children.push({type:"text",value:p[1],parent:f});else if("start tag"==p[0]){"chapters"==n&&s("Start tags not allowed in chapter title text.");var m=p[1];"v"!=m&&"lang"!=m&&""!=p[3]&&s("Only <v> and <lang> can have an annotation."),"c"==m||"i"==m||"b"==m||"u"==m||"ruby"==m?d(p):"rt"==m&&"ruby"==f.name?d(p):"v"==m?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&s("<v> cannot be nested inside itself."),d(p),f.value=p[3]// annotation
|
||||
,p[3]||s("<v> requires an annotation.")):"lang"==m?(d(p),f.value=p[3]// language
|
||||
):s("Incorrect start tag.")}else if("end tag"==p[0])"chapters"==n&&s("End tags not allowed in chapter title text."),p[1]==f.name?f=f.parent:"ruby"==p[1]&&"rt"==f.name?f=f.parent.parent:s("Incorrect end tag.");else if("timestamp"==p[0]){"chapters"==n&&s("Timestamp not allowed in chapter title text.");var g=new i(p[1],s).parseTimestamp();void 0!=g&&((g<=t||g>=l)&&s("Timestamp must be between start timestamp and end timestamp."),c.length>0&&c[c.length-1]>=g&&s("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:g,parent:f}),c.push(g))}}for(;f.parent;)"v"!=f.name&&s("Required end tag missing."),f=f.parent;return function e(t){let n={...t};return t.children&&(n.children=t.children.map(e)),n.parent&&delete n.parent,n}(u)}},a=function(){function t(e){let t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),n=0,i=0,r=0;return e>=3600&&(n=Math.floor(e/3600)),i=Math.floor((e-3600*n)/60),r=Math.floor(e-3600*n-60*i),(n?n+":":"")+(""+i).padStart(2,"0")+":"+(""+r).padStart(2,"0")+"."+t}this.serialize=function(n,i){var r,a="WEBVTT\n\n";if(i)for(var o=0;o<i.length;o++)a+="STYLE\n"+i[o]+"\n\n";for(var o=0;o<n.length;o++)a+=(void 0!==(r=n[o]).id?r.id+"\n":"")+t(r.startTime)+" --> "+t(r.endTime)+function(t){var n="";let i=Object.keys(e).filter(n=>t[n]!==e[n]);return i.includes("direction")&&(n+=" vertical:"+t.direction),i.includes("alignment")&&(n+=" align:"+t.alignment),i.includes("size")&&(n+=" size:"+t.size+"%"),(i.includes("lineAlign")||i.includes("linePosition"))&&(n+=" line:"+t.linePosition+(t.snapToLines?"":"%")+(t.lineAlign&&t.lineAlign!=e.lineAlign?","+t.lineAlign:"")),(i.includes("textPosition")||i.includes("positionAlign"))&&(n+=" position:"+t.textPosition+"%"+(t.positionAlign&&t.positionAlign!==e.positionAlign?","+t.positionAlign:"")),n}(r)+"\n"+function e(n){for(var i="",r=0;r<n.length;r++){var a=n[r];if("text"==a.type)i+=a.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==a.type){if(i+="<"+a.name,a.classes)for(var o=0;o<a.classes.length;o++)i+="."+a.classes[o];a.value&&(i+=" "+a.value),i+=">",a.children&&(i+=e(a.children)),i+="</"+a.name+">"}else"timestamp"==a.type?i+="<"+t(a.value)+">":i+="<"+a.value+">"}return i}(r.tree.children)+"\n\n";return a}};function o(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=i,e.WebVTTCueTextParser=r,e.WebVTTSerializer=a}"undefined"!=typeof window&&o(window),o(n)}()},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["4Kbf6"],"4Kbf6","parcelRequire4dc0");
|
||||
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],s=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=s[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=a,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var l=0;l<t.length;l++)c(t[l]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=c(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):o&&(this[o]=f)}}({"2hz0c":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return d});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_object_spread"),a=e("@swc/helpers/_/_object_spread_props"),s=e("@swc/helpers/_/_to_consumable_array"),u=e("@swc/helpers/_/_ts_generator"),c=e("./parser");function l(e){var t={"&":"&","<":"<",">":">","'":"'",""":'"'},r=RegExp("(".concat(Object.keys(t).join("|"),")"),"g");return e.replace(r,function(e){return t[e]||e})}function f(e){return p.apply(this,arguments)}function p(){return(p=(0,o._)(function(e){var t,r,n,o,i,a;return(0,u._)(this,function(s){switch(s.label){case 0:return r=(t=Artplayer.utils).getExt,n=t.srtToVtt,o=t.assToVtt,[4,fetch(e.url)];case 1:return[4,s.sent().arrayBuffer()];case 2:switch(i=s.sent(),a=new TextDecoder(e.encoding||"utf-8").decode(i),e.type||r(e.url)){case"srt":return[2,n(a)];case"ass":return[2,o(a)];case"vtt":return[2,a];default:return[2,""]}return[2]}})})).apply(this,arguments)}function d(e){var t,r=e.subtitles;return t=(0,o._)(function(e){var t,n;return(0,u._)(this,function(o){switch(o.label){case 0:return[4,Promise.all(r.map(f))];case 1:return t=function(e,t){for(var r=new c.WebVTTParser,n=new c.WebVTTSerializer,o=r.parse("","metadata"),i=0;i<e.length;i++){for(var a,u,l,f=t[i],p=r.parse(e[i],"metadata"),d=0;d<p.cues.length;d++)for(var _=p.cues[d],h=0;h<_.tree.children.length;h++){var m=_.tree.children[h];m.value='<div class="art-subtitle-'.concat(f.name,'">').concat(m.value,"</div>")}if(0===o.cues.length)o.cues=p.cues;else for(var y=0;y<o.cues.length;y++)(a=o.cues[y].tree.children).push.apply(a,(0,s._)((null===(l=p.cues[y])||void 0===l?void 0:null===(u=l.tree)||void 0===u?void 0:u.children)||[]))}return n.serialize(o.cues)}(o.sent(),r),n=URL.createObjectURL(new Blob([t],{type:"text/vtt"})),e.option.subtitle.escape=!1,e.subtitle.init((0,a._)((0,i._)({},e.option.subtitle),{url:n,type:"vtt",onVttLoad:l})),[2]}})}),function(e){return t.apply(this,arguments)}}d.env="production",d.version="1.0.0",d.build="2023-11-23 23:22:07","undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=d)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_object_spread":"9agdF","@swc/helpers/_/_object_spread_props":"gJNH2","@swc/helpers/_/_to_consumable_array":"iwLF0","@swc/helpers/_/_ts_generator":"6Xyd0","./parser":"8YYw5","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){r(e);return}s.done?t(u):Promise.resolve(u).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(e){o(a,n,i,s,u,"next",e)}function u(e){o(a,n,i,s,u,"throw",e)}s(void 0)})}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",function(){return i}),n.export(r,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"9agdF":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_object_spread",function(){return i}),n.export(r,"_",function(){return i});var o=e("./_define_property.js");function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){(0,o._define_property)(e,t,r[t])})}return e}},{"./_define_property.js":"3NGsL","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"3NGsL":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n.defineInteropFlag(r),n.export(r,"_define_property",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gJNH2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return a}),n.export(r,"__assign",function(){return s}),n.export(r,"__rest",function(){return u}),n.export(r,"__decorate",function(){return c}),n.export(r,"__param",function(){return l}),n.export(r,"__esDecorate",function(){return f}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return _}),n.export(r,"__metadata",function(){return h}),n.export(r,"__awaiter",function(){return m}),n.export(r,"__generator",function(){return y}),n.export(r,"__createBinding",function(){return v}),n.export(r,"__exportStar",function(){return g}),n.export(r,"__values",function(){return b}),n.export(r,"__read",function(){return j}),/** @deprecated */n.export(r,"__spread",function(){return w}),/** @deprecated */n.export(r,"__spreadArrays",function(){return x}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return T}),n.export(r,"__asyncGenerator",function(){return P}),n.export(r,"__asyncDelegator",function(){return S}),n.export(r,"__asyncValues",function(){return I}),n.export(r,"__makeTemplateObject",function(){return E}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return A}),n.export(r,"__classPrivateFieldGet",function(){return k}),n.export(r,"__classPrivateFieldSet",function(){return W}),n.export(r,"__classPrivateFieldIn",function(){return z}),n.export(r,"__addDisposableResource",function(){return N}),n.export(r,"__disposeResources",function(){return R});var o=e("@swc/helpers/_/_type_of"),i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){return function(r,n){t(r,n,e)}}function f(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var m=(0,r[d])("accessor"===u?{get:f.get,set:f.set}:f[c],_);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(s=a(m.get))&&(f.get=s),(s=a(m.set))&&(f.set=s),(s=a(m.init))&&o.unshift(s)}else(s=a(m))&&("field"===u?o.unshift(s):f[c]=s)}l&&Object.defineProperty(l,n.name,f),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function _(e,t,r){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})}function y(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Sym
Line truncated
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":"\xa0"}),this.entities=t,this.parse=function(r,n){// global search and replace for \0
|
||||
r=r.replace(/\0/g,"�");var a=Date.now(),s=0,u=r.split(/\r\n|\r|\n/),c=!1,l=[],f=[],p=[];function d(e,t){p.push({message:e,line:s+1,col:t})}var _=u[s],h=_.length,m="WEBVTT",y=0,v=m.length;/* HEADER */for("\uFEFF"===_[0]&&(y=1,v+=1),(h<v||_.indexOf(m)!==0+y||h>v&&" "!==_[v]&&" "!==_[v])&&d('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=u[s]&&void 0!=u[s];){if(d("No blank line after the signature."),-1!=u[s].indexOf("-->")){c=!0;break}s++}/* CUE LOOP */for(;void 0!=u[s];){for(;!c&&""==u[s];)s++;if(!c&&void 0==u[s])break;/* CUE CREATION */g=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var g,b=!0;if(-1==u[s].indexOf("-->")){/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/if(g.id=u[s],/^NOTE($|[ \t])/.test(g.id)){for(s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&d("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(g.id)){var j=[],w=!1;for(s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&(d("Cannot have timestamp in a style block."),w=!0),j.push(u[s]),s++;if(f.length){d("Style blocks cannot appear after the first cue.");continue}w||l.push(j.join("\n"));continue}if(""==u[++s]||void 0==u[s]){d("Cue identifier cannot be standalone.");continue}if(-1==u[s].indexOf("-->")){b=!1,d("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */c=!1;var x=new o(u[s],d),O=0;if(f.length>0&&(O=f[f.length-1].startTime),b&&!x.parse(g,O)){/* BAD CUE LOOP */for(/* BAD CUE */g=null,s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){c=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){d("Blank line missing before cue."),c=!0;break}""!=g.text&&(g.text+="\n"),g.text+=u[s],s++}/* CUE TEXT PROCESSING */var T=new i(g.text,d,n,t);g.tree=T.parse(g.startTime,g.endTime),f.push(g)}/* END */return f.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:f,errors:p,time:Date.now()-a,styles:l}}},o=function(e,t){var r=/[\u0020\t\f]/,n=/[^\u0020\t\f]/,e=e,o=0,i=function(e){t(e,o+1)};function a(t){for(;void 0!=e[o]&&t.test(e[o]);)o++}function s(t){for(var r="";void 0!=e[o]&&t.test(e[o]);)r+=e[o],o++;return r}/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */function u(){var t,r,n,a,u="minutes";// 3
|
||||
if(void 0==e[o]){i("No timestamp found.");return}// 4
|
||||
if(!/\d/.test(e[o])){i("Timestamp must start with a character in the range 0-9.");return}// 8
|
||||
if((// 5-7
|
||||
(t=s(/\d/)).length>2||parseInt(t,10)>59)&&(u="hours"),":"!=e[o]){i("No time unit separator found.");return}if(o++,2!=// 9-11
|
||||
(r=s(/\d/)).length){i("Must be exactly two digits.");return}// 12
|
||||
if("hours"==u||":"==e[o]){if(":"!=e[o]){i("No seconds found or minutes is greater than 59.");return}if(o++,2!=(n=s(/\d/)).length){i("Must be exactly two digits.");return}}else{if(2!=t.length){i("Must be exactly two digits.");return}n=r,r=t,t="0"}// 13
|
||||
if("."!=e[o]){i('No decimal separator (".") found.');return}if(o++,3!=// 14-16
|
||||
(a=s(/\d/)).length){i("Milliseconds must be given in three digits.");return}// 17
|
||||
if(parseInt(r,10)>59){i("You cannot have more than 59 minutes.");return}if(parseInt(n,10)>59){i("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(r,10)+parseInt(n,10)+parseInt(a,10)/1e3}this.parse=function(t,s){if(a(r),t.startTime=u(),void 0!=t.startTime){// 6-8
|
||||
if(t.startTime<s&&i("Start timestamp is not greater than or equal to start timestamp of previous cue."),n.test(e[o])&&i("Timestamp not separated from '-->' by whitespace."),a(r),"-"!=e[o]||"-"!=e[++o]||">"!=e[++o]){i("No valid timestamp separator found.");return}if(o++,n.test(e[o])&&i("'-->' not separated from timestamp by whitespace."),a(r),t.endTime=u(),void 0!=t.endTime)return t.endTime<=t.startTime&&i("End timestamp is not greater than start timestamp."),n.test(e[o]),a(r),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var n=e.split(r),o=[],a=0;a<n.length;a++)if(""!=n[a]){var s=n[a].indexOf(":"),u=n[a].slice(0,s),c=n[a].slice(s+1);if(-1!=o.indexOf(u)&&i("Duplicate setting."),o.push(u),""==c){i("No value for setting defined.");return}if("vertical"==u){if("rl"!=c&&"lr"!=c){i("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=c}else if("line"==u){if(/,/.test(c)){var l=c.split(",");c=l[0];var f=l[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(c)){i("Line position takes a number or percentage.");continue}if(-1!=c.indexOf("-",1)){i("Line position can only have '-' at the start.");continue}if(-1!=c.indexOf("%")&&c.indexOf("%")!=c.length-1){i("Line position can only have '%' at the end.");continue}if("-"==c[0]&&"%"==c[c.length-1]){i("Line position cannot be a negative percentage.");continue}var p=c,d=!1;if("%"==c[c.length-1]&&(d=!0,p=c.slice(0,c.length-1),parseInt(c,10)>100)){i("Line position cannot be >100%.");continue}if(""===p||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==f){if(!["start","center","end"].includes(f)){i("Line alignment needs to be one of start, center or end");continue}t.lineAlign=f}t.snapToLines=!d,t.linePosition=parseFloat(p),parseFloat(p).toString()!==p&&(t.nonSerializable=!0)}else if("position"==u){if(/,/.test(c)){var l=c.split(",");c=l[0];var _=l[1]}if("%"!=c[c.length-1]){i("Text position must be a percentage.");continue}if(parseInt(c,10)>100||0>parseInt(c,10)){i("Text position needs to be between 0 and 100%.");continue}if(""===(p=c.slice(0,c.length-1))||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==_){if(!["line-left","center","line-right"].includes(_)){i("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=_}t.textPosition=parseFloat(p)}else if("size"==u){if("%"!=c[c.length-1]){i("Size must be a percentage.");continue}if(parseInt(c,10)>100){i("Size cannot be >100%.");continue}var h=c.slice(0,c.length-1);if(void 0===h||""===h||isNaN(h)){i("Size needs to be a number"),h=100;continue}if((h=parseFloat(h))<0||h>100){i("Size needs to be between 0 and 100%.");continue}t.size=h}else if("align"==u){var m=["start","center","end","left","right"];if(-1==m.indexOf(c)){i("Alignment can only be set to one of "+m.join(", ")+".");continue}t.alignment=c}else i("Invalid setting.")}}(e.substring(o),t),!0}},this.parseTimestamp=function(){var t=u();if(void 0!=e[o]){i("Timestamp must not have trailing characters.");return}return t}},i=function(e,t,r,i){this.entities=i;var a=this,e=e,s=0,u=function(e){"metadata"!=r&&t(e,s+1)};this.parse=function(t,c){var l={children:[]},f=l,p=[];function d(e){f.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:f}),f=f.children[f.children.length-1]}for(;void 0!=e[s];){var _=function(){for(var t="data",r="",n="",o=[];void 0!=e[s-1]||0==s;){var c=e[s];if("data"==t){if("&"==c)n=c,t="escape";else if("<"==c&&""==r)t="tag";else{if("<"==c||void 0==c)return["text",r];r+=c}}else if("escape"==t){if("<"==c||void 0==c){u("Incorrect escape.");var l=void 0;return(l=n.match(/^&#([0-9]+)$/))?r+=String.fromCharCode(l[1]):a.entities[n]?r+=a.entities[n]:r+=n,["text",r]}if("&"==c)u("Incorrect escape."),r+=n,n=c;else if(/[a-z#0-9]/i.test(c))n+=c;else if(";"==c){var f=void 0;(f=n.match(/^&#(x?[0-9]+)$/))?r+=String.fromCharCode("0"+f[1]):a.entities[n+c]?r+=a.entities[n+c]:(f=Object.keys(i).find(function(e){return n.startsWith(e)}))?r+=a.entities[f]+n.slice(f.length)+c:(u("Incorrect escape."),r+=n+";"),t="data"}else u("Incorrect escape."),r+=n+c,t="data"}else if("tag"==t){if(" "==c||"\n"==c||"\f"==c||" "==c)t="start tag annotation";else if("."==c)t="start tag class";else if("/"==c)t="end tag";else if(/\d/.test(c))r=c,t="timestamp tag";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag","",[],""];r=c,t="start tag"}}else if("start tag"==t){if(" "==c||"\f"==c||" "==c)t="start tag annotation";else if("\n"==c)n=c,t="start tag annotation";else if("."==c)t="start tag class";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,[],""];r+=c}}else if("start tag class"==t){if(" "==c||"\f"==c||" "==c)n&&o.push(n),n="",t="start tag annotation";else if("\n"==c)n&&o.push(n),n=c,t="start tag annotation";else if("."==c)n&&o.push(n),n="";else{if(">"==c||void 0==c)return">"==c&&s++,n&&o.push(n),["start tag",r,o,""];n+=c}}else if("start tag annotation"==t){if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,o,n=n.split(Line truncated
|
||||
;// 8
|
||||
s++}}();if("text"==_[0])f.children.push({type:"text",value:_[1],parent:f});else if("start tag"==_[0]){"chapters"==r&&u("Start tags not allowed in chapter title text.");var h=_[1];"v"!=h&&"lang"!=h&&""!=_[3]&&u("Only <v> and <lang> can have an annotation."),"c"==h||"i"==h||"b"==h||"u"==h||"ruby"==h?d(_):"rt"==h&&"ruby"==f.name?d(_):"v"==h?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&u("<v> cannot be nested inside itself."),d(_),f.value=_[3]// annotation
|
||||
,_[3]||u("<v> requires an annotation.")):"lang"==h?(d(_),f.value=_[3]// language
|
||||
):u("Incorrect start tag.")}else if("end tag"==_[0])"chapters"==r&&u("End tags not allowed in chapter title text."),_[1]==f.name?f=f.parent:"ruby"==_[1]&&"rt"==f.name?f=f.parent.parent:u("Incorrect end tag.");else if("timestamp"==_[0]){"chapters"==r&&u("Timestamp not allowed in chapter title text.");var m=new o(_[1],u).parseTimestamp();void 0!=m&&((m<=t||m>=c)&&u("Timestamp must be between start timestamp and end timestamp."),p.length>0&&p[p.length-1]>=m&&u("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:m,parent:f}),p.push(m))}}for(;f.parent;)"v"!=f.name&&u("Required end tag missing."),f=f.parent;return function e(t){var r=(0,n._)({},t);return t.children&&(r.children=t.children.map(e)),r.parent&&delete r.parent,r}(l)}},a=function(){function t(e){var t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),r=0,n=0,o=0;return e>=3600&&(r=Math.floor(e/3600)),n=Math.floor((e-3600*r)/60),o=Math.floor(e-3600*r-60*n),(r?r+":":"")+(""+n).padStart(2,"0")+":"+(""+o).padStart(2,"0")+"."+t}this.serialize=function(r,n){var o="WEBVTT\n\n";if(n)for(var i=0;i<n.length;i++)o+="STYLE\n"+n[i]+"\n\n";for(var i=0;i<r.length;i++)o+=function(r){var n,o;return(void 0!==r.id?r.id+"\n":"")+t(r.startTime)+" --> "+t(r.endTime)+(n="",(o=Object.keys(e).filter(function(t){return r[t]!==e[t]})).includes("direction")&&(n+=" vertical:"+r.direction),o.includes("alignment")&&(n+=" align:"+r.alignment),o.includes("size")&&(n+=" size:"+r.size+"%"),(o.includes("lineAlign")||o.includes("linePosition"))&&(n+=" line:"+r.linePosition+(r.snapToLines?"":"%")+(r.lineAlign&&r.lineAlign!=e.lineAlign?","+r.lineAlign:"")),(o.includes("textPosition")||o.includes("positionAlign"))&&(n+=" position:"+r.textPosition+"%"+(r.positionAlign&&r.positionAlign!==e.positionAlign?","+r.positionAlign:"")),n)+"\n"+function e(r){for(var n="",o=0;o<r.length;o++){var i=r[o];if("text"==i.type)n+=i.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==i.type){if(n+="<"+i.name,i.classes)for(var a=0;a<i.classes.length;a++)n+="."+i.classes[a];i.value&&(n+=" "+i.value),n+=">",i.children&&(n+=e(i.children)),n+="</"+i.name+">"}else"timestamp"==i.type?n+="<"+t(i.value)+">":n+="<"+i.value+">"}return n}(r.tree.children)+"\n\n"}(r[i]);return o}};function s(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=o,e.WebVTTCueTextParser=i,e.WebVTTSerializer=a}"undefined"!=typeof window&&s(window),s(r)}()},{"@swc/helpers/_/_object_spread":"9agdF"}]},["2hz0c"],"2hz0c","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(l)return l(t,!0);if(s&&"string"==typeof t)return s(t);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=l,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return i[r]}}),i[r]=f;for(var a=0;a<t.length;a++)f(t[a]);if(n){var c=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({YTqB2:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("./getVttArray"),i=r.interopDefault(o);function l(e){return async t=>{const{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await(0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",(async i=>{n(e,"display","block");const{second:l,width:s}=function(e,t){const{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth);return{width:i,second:i/n.clientWidth*e.duration}}(t,i),f=u.find((e=>l>=e.start&&l<=e.end));if(!f)return n(e,"display","none");n(e,"backgroundImage",`url(${f.url})`),n(e,"height",`${f.h}px`),n(e,"width",`${f.w}px`),n(e,"backgroundPosition",`-${f.x}px -${f.y}px`),s<=f.w/2?n(e,"left",0):s>o.clientWidth-f.w/2?n(e,"left",o.clientWidth-f.w+"px"):n(e,"left",s-f.w/2+"px")})),l(o,"mouseleave",(()=>{n(e,"display","none")})),t.on("hover",(t=>{t||n(e,"display","none")}))}}),{name:"artplayerPluginVttThumbnail"}}}n.default=l,l.env="production",l.version="1.0.0",l.build="2023-08-26 16:47:22","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){function r(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=(t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))),u=Number(l)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+u}e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=async function(e=""){const t=(await(await fetch(e)).text()).split(/[\n\r]/gm).filter((e=>e.trim())),n=[];for(let o=1;o<t.length;o+=2){const i=t[o],l=t[o+1];if(!l.trim())continue;const u=/((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)(?: ?--> ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,s=i.match(u),f=/(.*)#(\w{4})=(.*)/i,a=l.match(f),c=Math.floor(r(s[1])),d=Math.floor(r(s[2])),p=e.split("/");p.pop(),p.push(a[1]);const h={start:c,end:d,url:p.join("/")},m=a[2].split(""),g=a[3].split(",");for(let e=0;e<m.length;e++)h[m[e]]=g[e];n.push(h)}return n}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["YTqB2"],"YTqB2","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,r,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(l)return l(t,!0);// Try the node require function if it exists.
|
||||
if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var d=u[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=l,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var s=0;s<t.length;s++)a(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=a(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):o&&(this[o]=d)}}({YTqB2:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",()=>l);var o=e("./getVttArray"),i=r.interopDefault(o);function l(e){return async t=>{let{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await (0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",async i=>{n(e,"display","block");let{second:l,width:f}=function(e,t){let{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth),l=i/n.clientWidth*e.duration;return{width:i,second:l}}(t,i),a=u.find(e=>l>=e.start&&l<=e.end);if(!a)return n(e,"display","none");n(e,"backgroundImage",`url(${a.url})`),n(e,"height",`${a.h}px`),n(e,"width",`${a.w}px`),n(e,"backgroundPosition",`-${a.x}px -${a.y}px`),f<=a.w/2?n(e,"left",0):f>o.clientWidth-a.w/2?n(e,"left",`${o.clientWidth-a.w}px`):n(e,"left",`${f-a.w/2}px`)}),l(o,"mouseleave",()=>{n(e,"display","none")}),t.on("hover",t=>{t||n(e,"display","none")})}}),{name:"artplayerPluginVttThumbnail"}}}l.env="production",l.version="1.0.0",l.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=Number((t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))))/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+l}async function i(e=""){let t=await (await fetch(e)).text(),n=t.split(/[\n\r]/gm).filter(e=>e.trim()),r=[];for(let t=1;t<n.length;t+=2){let i=n[t],l=n[t+1];if(!l.trim())continue;let u=/((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)(?: ?--> ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,f=i.match(u),a=/(.*)#(\w{4})=(.*)/i,s=l.match(a),d=Math.floor(o(f[1])),p=Math.floor(o(f[2])),c=s[1],h=/^\/|((https?|ftp|file):\/\/)/i.test(c);if(!h){let t=e.split("/");t.pop(),t.push(c),c=t.join("/")}let m={start:d,end:p,url:c},g=s[2].split(""),y=s[3].split(",");for(let e=0;e<g.length;e++)m[g[e]]=y[e];r.push(m)}return r}r.defineInteropFlag(n),r.export(n,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["YTqB2"],"YTqB2","parcelRequire4dc0");
|
||||
@@ -4,4 +4,35 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[n]&&i[n],c=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!c[t]){if(!e[t]){var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);if(u)return u(t,!0);if(a&&"string"==typeof t)return a(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=c[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return c[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=c,s.parent=u,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){var l=s(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define((function(){return l}))}}({"2Oq25":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var o=e("@swc/helpers/src/_async_to_generator.mjs"),i=n.interopDefault(o),u=e("@swc/helpers/src/_ts_generator.mjs"),c=n.interopDefault(u),a=e("./getVttArray"),s=n.interopDefault(a);function f(e){return t=(0,i.default)((function(t){var r,n,o,u,a,f,l;return(0,c.default)(this,(function(p){switch(p.label){case 0:return r=t.constructor,n=r.utils,o=n.setStyle,u=n.clamp,a=t.template.$progress,f=t.events.proxy,[4,(0,s.default)(e.vtt)];case 1:return l=p.sent(),t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted:function(e){f(a,"mousemove",function(){var r=(0,i.default)((function(r){var n,i,s,f;return(0,c.default)(this,(function(c){return o(e,"display","block"),n=function(e,t){var r=e.template.$progress,n=r.getBoundingClientRect().left,o=u(t.pageX-n,0,r.clientWidth);return{width:o,second:o/r.clientWidth*e.duration}}(t,r),i=n.second,s=n.width,(f=l.find((function(e){return i>=e.start&&i<=e.end})))?(o(e,"backgroundImage","url(".concat(f.url,")")),o(e,"height","".concat(f.h,"px")),o(e,"width","".concat(f.w,"px")),o(e,"backgroundPosition","-".concat(f.x,"px -").concat(f.y,"px")),s<=f.w/2?o(e,"left",0):s>a.clientWidth-f.w/2?o(e,"left","".concat(a.clientWidth-f.w,"px")):o(e,"left","".concat(s-f.w/2,"px")),[2]):[2,o(e,"display","none")]}))}));return function(e){return r.apply(this,arguments)}}()),f(a,"mouseleave",(function(){o(e,"display","none")})),t.on("hover",(function(t){t||o(e,"display","none")}))}}),[2,{name:"artplayerPluginVttThumbnail"}]}}))})),function(e){return t.apply(this,arguments)};var t}r.default=f,f.env="production",f.version="1.0.0",f.build="2023-08-26 16:47:23","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=f)},{"@swc/helpers/src/_async_to_generator.mjs":"9vSoD","@swc/helpers/src/_ts_generator.mjs":"8UZjC","./getVttArray":"iUpz3","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9vSoD":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_async_to_generator.js")},{"../esm/_async_to_generator.js":"eONSn","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var u=e.apply(t,r);function c(e){o(u,n,i,c,a,"next",e)}function a(e){o(u,n,i,c,a,"throw",e)}c(void 0)}))}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",(function(){return i})),n.export(r,"_",(function(){return i}))},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"8UZjC":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_ts_generator.js")},{"../esm/_ts_generator.js":"6Xyd0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"6Xyd0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_",(function(){return o.__generator})),n.export(r,"_ts_generator",(function(){return o.__generator})Line truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],u=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(c&&"string"==typeof t)return c(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=u[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=u,s.parent=a,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var l=s(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):o&&(this[o]=l)}}({"2Oq25":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return c});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_ts_generator"),a=e("./getVttArray"),u=n.interopDefault(a);function c(e){var t;return t=(0,o._)(function(t){var r,n,a,c,s,f;return(0,i._)(this,function(l){switch(l.label){case 0:return n=(r=t.constructor.utils).setStyle,a=r.clamp,c=t.template.$progress,s=t.events.proxy,[4,(0,u.default)(e.vtt)];case 1:return f=l.sent(),t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted:function(e){var r;s(c,"mousemove",(r=(0,o._)(function(r){var o,u,s,l;return(0,i._)(this,function(i){var p,d,y,_;return(n(e,"display","block"),d=(p=t.template.$progress).getBoundingClientRect().left,_=(y=a(r.pageX-d,0,p.clientWidth))/p.clientWidth*t.duration,u=(o={width:y,second:_}).second,s=o.width,l=f.find(function(e){return u>=e.start&&u<=e.end}))?(n(e,"backgroundImage","url(".concat(l.url,")")),n(e,"height","".concat(l.h,"px")),n(e,"width","".concat(l.w,"px")),n(e,"backgroundPosition","-".concat(l.x,"px -").concat(l.y,"px")),s<=l.w/2?n(e,"left",0):s>c.clientWidth-l.w/2?n(e,"left","".concat(c.clientWidth-l.w,"px")):n(e,"left","".concat(s-l.w/2,"px")),[2]):[2,n(e,"display","none")]})}),function(e){return r.apply(this,arguments)})),s(c,"mouseleave",function(){n(e,"display","none")}),t.on("hover",function(t){t||n(e,"display","none")})}}),[2,{name:"artplayerPluginVttThumbnail"}]}})}),function(e){return t.apply(this,arguments)}}c.env="production",c.version="1.0.0",c.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=c)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_ts_generator":"6Xyd0","./getVttArray":"iUpz3","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function u(e){o(a,n,i,u,c,"next",e)}function c(e){o(a,n,i,u,c,"throw",e)}u(void 0)})}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",function(){return i}),n.export(r,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"6Xyd0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_",function(){return o.__generator}),n.export(r,"_ts_generator",function(){return o.__generator});var o=e("tslib")},{tslib:"c0d7h","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],c0d7h:[function(e,t,r){/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return a}),n.export(r,"__assign",function(){return u}),n.export(r,"__rest",function(){return c}),n.export(r,"__decorate",function(){return s}),n.export(r,"__param",function(){return f}),n.export(r,"__esDecorate",function(){return l}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return y}),n.export(r,"__metadata",function(){return _}),n.export(r,"__awaiter",function(){return h}),n.export(r,"__generator",function(){return v}),n.export(r,"__createBinding",function(){return m}),n.export(r,"__exportStar",function(){return b}),n.export(r,"__values",function(){return g}),n.export(r,"__read",function(){return w}),/** @deprecated */n.export(r,"__spread",function(){return x}),/** @deprecated */n.export(r,"__spreadArrays",function(){return j}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return P}),n.export(r,"__asyncGenerator",function(){return S}),n.export(r,"__asyncDelegator",function(){return E}),n.export(r,"__asyncValues",function(){return T}),n.export(r,"__makeTemplateObject",function(){return D}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return k}),n.export(r,"__classPrivateFieldGet",function(){return R}),n.export(r,"__classPrivateFieldSet",function(){return A}),n.export(r,"__classPrivateFieldIn",function(){return M}),n.export(r,"__addDisposableResource",function(){return W}),n.export(r,"__disposeResources",function(){return q});var o=e("@swc/helpers/_/_type_of"),i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function f(e,t){return function(r,n){t(r,n,e)}}function l(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,c=n.kind,s="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,r[d])("accessor"===c?{get:l.get,set:l.set}:l[s],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(u=a(h.get))&&(l.get=u),(u=a(h.set))&&(l.set=u),(u=a(h.init))&&o.unshift(u)}else(u=a(h))&&("field"===c?o.unshift(u):l[s]=u)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function y(e,t,r){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function _(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,u)}c((n=n.apply(e,t||[])).next())})}function v(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Sym
Line truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,o){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof r[n]&&r[n],l=s.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!l[t]){if(!e[t]){var o="function"==typeof r[n]&&r[n];if(!i&&o)return o(t,!0);if(s)return s(t,!0);if(h&&"string"==typeof t)return h(t);var d=new Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},p.cache={};var u=l[t]=new a.Module(t);e[t][0].call(u.exports,p,u,u.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=l,a.parent=s,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return r[n]}}),r[n]=a;for(var d=0;d<t.length;d++)a(t[d]);if(i){var u=a(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({eoujN:[function(e,t,i){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=e("./emitter"),r=n.interopDefault(o),s=e("./utils");class l extends r.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},l.DEFAULTS,e)),this.video=l.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",l.ondragover),this.option.fileInput.addEventListener("drop",l.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();const t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);const{fileInput:t,number:i,width:n,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";const e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach((e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)})),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){const e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){const t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){const t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);const i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then((()=>this.start()));const{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const r=this.creatScreenshotDate(),l=this.creatCanvas(),h=l.getContext("2d");this.emit("canvas",l);const a=r.map(((i,n)=>()=>new Promise((r=>{this.video.oncanplay=()=>{h.drawImage(this.video,i.x,i.y,e,o),l.toBlob((e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()}))},this.video.currentTime=i.time}))));return this.processing=!0,(0,s.runPromisesInSeries)(a).then((()=>{this.processing=!1,this.emit("done")})).catch((e=>{throw this.processing=!1,this.emit("error",e.message),e}))}creatScreenshotDate(){const{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length<e;){const e=s[s.length-1];s.push(e+r)}return s.map(((e,o)=>({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i})))}creatCLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,i,n,o){/* eslint-disable no-undef */var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof r[n]&&r[n],l=s.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,i){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof r[n]&&r[n];if(!i&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(s)return s(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},p.cache={};var u=l[t]=new h.Module(t);e[t][0].call(u.exports,p,u,u.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.exports={}},h.modules=e,h.cache=l,h.parent=s,h.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(h,"root",{get:function(){return r[n]}}),r[n]=h;for(var d=0;d<t.length;d++)h(t[d]);if(i){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var u=h(i);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):o&&(this[o]=u)}}({eoujN:[function(e,t,i){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=e("./emitter"),r=n.interopDefault(o),s=e("./utils");class l extends r.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},l.DEFAULTS,e)),this.video=l.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",l.ondragover),this.option.fileInput.addEventListener("drop",l.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:n,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),!("INPUT"===t.tagName&&"file"===t.type)){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let r=this.creatScreenshotDate(),l=this.creatCanvas(),a=l.getContext("2d");this.emit("canvas",l);let h=r.map((i,n)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),l.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()})},this.video.currentTime=i.time}));return this.processing=!0,(0,s.runPromisesInSeries)(h).then(()=>{this.processing=!1,this.emit("done")}).catch(e=>{throw this.processing=!1,this.emit("error",e.message),e})}creatScreenshotDate(){let{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length<e;){let e=s[s.length-1];s.push(e+r)}return s.map((e,o)=>({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i}))}creatCanvas(){let{number:e,width:t,height:i,column:n}=this.option,o=document.createElement("canvas"),r=o.getContext("2d");return o.width=t*n,o.height=Math.ceil(e/n)*i+30,r.fillStyle="black",r.fillRect(0,0,o.width,o.height),r.font="14px Georgia",r.fillStyle="#fff",r.fillText(`From: https://artplayer.org/, Number: ${e}, Width: ${t}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");let e=document.createElement("a"),t=`${(0,s.getFileName)(this.file.name)}.png`;return e.download=t,e.href=this.thumbnailUrl,document.body.appendChild(e),e.click(),document.body.removeChild(e),this.emit("download",t),this}errorHandle(e,t){if(!e)throw this.emit("error",t),Error(t)}destroy(){this.option.fileInput.removeEventListener("change",this.inputChange),this.option.fileInput.removeEventListener("dragover",l.ondragover),this.option.fileInput.removeEventListener("drop",l.ondrop),Line truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof s[n]&&s[n],a=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){var o="function"==typeof s[n]&&s[n];if(!r&&o)return o(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=a,c.parent=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return s[n]}}),s[n]=c;for(var u=0;u<t.length;u++)c(t[u]);if(r){var f=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({esZVA:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return v}));var o=e("@swc/helpers/src/_assert_this_initialized.mjs"),s=n.interopDefault(o),i=e("@swc/helpers/src/_class_call_check.mjs"),a=n.interopDefault(i),l=e("@swc/helpers/src/_create_class.mjs"),c=n.interopDefault(l),u=e("@swc/helpers/src/_inherits.mjs"),f=n.interopDefault(u),p=e("@swc/helpers/src/_create_super.mjs"),h=n.interopDefault(p),d=e("./emitter"),m=n.interopDefault(d),_=e("./utils"),v=function(e){"use strict";(0,f.default)(r,e);var t=(0,h.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.default)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,s.default)(e)),e.ondrop=e.ondrop.bind((0,s.default)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,c.default)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,s=r.width,i=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==n.tagName||"file"!==n.type){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=(0,_.clamp)(o,10,1e3),this.option.width=(0,_.clamp)(s,10,1e3),this.option.column=(0,_.clamp)(i,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,_.sleep)(1e3).then((function(){return e.start()}));var t=this.option,r=t.width,n=t.number,o=t.begin,s=t.end,i=this.video.videoHeight/this.video.videoWidth*r;this.option.height=i,this.option.begin=(0,_.clamp)(o,0,this.video.duration),this.option.end=(0,_.clamp)(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),c=l.getContext("2d");this.emit("canvas",l);var u=a.map((function(t,o){return function(){return new Promise((function(s){e.video.oncanplay=function(){c.drawImage(e.video,t.x,t.y,r,i),l.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplaLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof i[n]&&i[n],a=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!a[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(s)return s(t,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof t)return l(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new u.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=a,u.parent=s,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=u(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):o&&(this[o]=f)}}({esZVA:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return p});var o=e("@swc/helpers/_/_assert_this_initialized"),i=e("@swc/helpers/_/_class_call_check"),s=e("@swc/helpers/_/_create_class"),a=e("@swc/helpers/_/_inherits"),l=e("@swc/helpers/_/_create_super"),u=e("./emitter"),c=n.interopDefault(u),f=e("./utils"),p=/*#__PURE__*/function(e){(0,a._)(r,e);var t=(0,l._)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,i._)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,o._)(e)),e.ondrop=e.ondrop.bind((0,o._)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,s._)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,i=r.width,s=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),!("INPUT"===n.tagName&&"file"===n.type)){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))}),this.option.number=(0,f.clamp)(o,10,1e3),this.option.width=(0,f.clamp)(i,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,r=t.width,n=t.number,o=t.begin,i=t.end,s=this.video.videoHeight/this.video.videoWidth*r;this.option.height=s,this.option.begin=(0,f.clamp)(o,0,this.video.duration),this.option.end=(0,f.clamp)(i||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),u=l.getContext("2d");this.emit("canvas",l);var c=a.map(function(t,o){return function(){return new Promise(function(i){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,r,s),l.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplay=null,i()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(c).then(function(){e.processing=!1,e.emit("done")}).catch(function(t){throw e.processing=!1,e.emit("error",t.message),t})}},{key:"creatScreenshotDate",value:function(){for(var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,i=e.begin,s=this.duration/t,a=[i+s];a.length<t;){var l=a[a.length-1];a.push(l+s)}return a.map(function(e,t){return{time:e-s/2,x:t%o*r,y:Math.floor(t/o)*n}})}},{key:"creatCanvas",value:function(){var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,i=document.createElement("canvas"),s=i.getContext("2d");return i.width=r*o,i.height=Math.ceil(t/o)*n+30,s.fillStyle="black",s.fillRect(0,0,i.width,i.height),s.font="14px Georgia",s.fillStyle="#fff",s.fillText("From: https://artplayer.org/, Number: ".concat(t,", Width: ").concat(r,", Height: ").concat(n,", Column: ").concat(o),10,i.height-11),i}},{key:"download",value:function(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");var e=document.createElement("a"),t="".concat(Line truncated
|
||||
@@ -55,6 +55,10 @@
|
||||
<a
|
||||
href="/?libs=./uncompiled/artplayer-plugin-vtt-thumbnail/index.js&example=vtt.thumbnail">artplayer-plugin-vtt-thumbnail</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles">artplayer-plugin-multiple-subtitles</a>
|
||||
</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li class="title">Tools</li>
|
||||
|
||||
@@ -0,0 +1,962 @@
|
||||
// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
|
||||
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
||||
/* eslint-disable no-undef */
|
||||
var globalObject =
|
||||
typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof self !== 'undefined'
|
||||
? self
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
: typeof global !== 'undefined'
|
||||
? global
|
||||
: {};
|
||||
/* eslint-enable no-undef */
|
||||
|
||||
// Save the require from previous bundle to this closure if any
|
||||
var previousRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
|
||||
var cache = previousRequire.cache || {};
|
||||
// Do not use `require` to prevent Webpack from trying to bundle this call
|
||||
var nodeRequire =
|
||||
typeof module !== 'undefined' &&
|
||||
typeof module.require === 'function' &&
|
||||
module.require.bind(module);
|
||||
|
||||
function newRequire(name, jumped) {
|
||||
if (!cache[name]) {
|
||||
if (!modules[name]) {
|
||||
// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var currentRequire =
|
||||
typeof globalObject[parcelRequireName] === 'function' &&
|
||||
globalObject[parcelRequireName];
|
||||
if (!jumped && currentRequire) {
|
||||
return currentRequire(name, true);
|
||||
}
|
||||
|
||||
// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if (previousRequire) {
|
||||
return previousRequire(name, true);
|
||||
}
|
||||
|
||||
// Try the node require function if it exists.
|
||||
if (nodeRequire && typeof name === 'string') {
|
||||
return nodeRequire(name);
|
||||
}
|
||||
|
||||
var err = new Error("Cannot find module '" + name + "'");
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
}
|
||||
|
||||
localRequire.resolve = resolve;
|
||||
localRequire.cache = {};
|
||||
|
||||
var module = (cache[name] = new newRequire.Module(name));
|
||||
|
||||
modules[name][0].call(
|
||||
module.exports,
|
||||
localRequire,
|
||||
module,
|
||||
module.exports,
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
return cache[name].exports;
|
||||
|
||||
function localRequire(x) {
|
||||
var res = localRequire.resolve(x);
|
||||
return res === false ? {} : newRequire(res);
|
||||
}
|
||||
|
||||
function resolve(x) {
|
||||
var id = modules[name][1][x];
|
||||
return id != null ? id : x;
|
||||
}
|
||||
}
|
||||
|
||||
function Module(moduleName) {
|
||||
this.id = moduleName;
|
||||
this.bundle = newRequire;
|
||||
this.exports = {};
|
||||
}
|
||||
|
||||
newRequire.isParcelRequire = true;
|
||||
newRequire.Module = Module;
|
||||
newRequire.modules = modules;
|
||||
newRequire.cache = cache;
|
||||
newRequire.parent = previousRequire;
|
||||
newRequire.register = function (id, exports) {
|
||||
modules[id] = [
|
||||
function (require, module) {
|
||||
module.exports = exports;
|
||||
},
|
||||
{},
|
||||
];
|
||||
};
|
||||
|
||||
Object.defineProperty(newRequire, 'root', {
|
||||
get: function () {
|
||||
return globalObject[parcelRequireName];
|
||||
},
|
||||
});
|
||||
|
||||
globalObject[parcelRequireName] = newRequire;
|
||||
|
||||
for (var i = 0; i < entry.length; i++) {
|
||||
newRequire(entry[i]);
|
||||
}
|
||||
|
||||
if (mainEntry) {
|
||||
// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var mainExports = newRequire(mainEntry);
|
||||
|
||||
// CommonJS
|
||||
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
||||
module.exports = mainExports;
|
||||
|
||||
// RequireJS
|
||||
} else if (typeof define === 'function' && define.amd) {
|
||||
define(function () {
|
||||
return mainExports;
|
||||
});
|
||||
|
||||
// <script>
|
||||
} else if (globalName) {
|
||||
this[globalName] = mainExports;
|
||||
}
|
||||
}
|
||||
})({"LGGZX":[function(require,module,exports) {
|
||||
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
|
||||
parcelHelpers.defineInteropFlag(exports);
|
||||
parcelHelpers.export(exports, "default", ()=>artplayerPluginMultipleSubtitles);
|
||||
var _parser = require("./parser");
|
||||
function unescape(str) {
|
||||
const map = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
"'": "'",
|
||||
""": '"'
|
||||
};
|
||||
const reg = new RegExp(`(${Object.keys(map).join("|")})`, "g");
|
||||
return str.replace(reg, (tag)=>map[tag] || tag);
|
||||
}
|
||||
async function loadSubtitleAsVtt(option) {
|
||||
const { getExt, srtToVtt, assToVtt } = Artplayer.utils;
|
||||
const response = await fetch(option.url);
|
||||
const buffer = await response.arrayBuffer();
|
||||
const decoder = new TextDecoder(option.encoding || "utf-8");
|
||||
const text = decoder.decode(buffer);
|
||||
switch(option.type || getExt(option.url)){
|
||||
case "srt":
|
||||
return srtToVtt(text);
|
||||
case "ass":
|
||||
return assToVtt(text);
|
||||
case "vtt":
|
||||
return text;
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
function mergeVtts(vtts, subtitles) {
|
||||
const parser = new (0, _parser.WebVTTParser)();
|
||||
const seri = new (0, _parser.WebVTTSerializer)();
|
||||
const result = parser.parse("", "metadata");
|
||||
for(let i = 0; i < vtts.length; i++){
|
||||
const option = subtitles[i];
|
||||
const tree = parser.parse(vtts[i], "metadata");
|
||||
for(let j = 0; j < tree.cues.length; j++){
|
||||
const cue = tree.cues[j];
|
||||
for(let k = 0; k < cue.tree.children.length; k++){
|
||||
const children = cue.tree.children[k];
|
||||
children.value = `<div class="art-subtitle-${option.name}">${children.value}</div>`;
|
||||
}
|
||||
}
|
||||
if (result.cues.length === 0) result.cues = tree.cues;
|
||||
else for(let l = 0; l < result.cues.length; l++)result.cues[l].tree.children.push(...tree.cues[l]?.tree?.children || []);
|
||||
}
|
||||
return seri.serialize(result.cues);
|
||||
}
|
||||
function artplayerPluginMultipleSubtitles({ subtitles }) {
|
||||
return async (art)=>{
|
||||
const vtts = await Promise.all(subtitles.map(loadSubtitleAsVtt));
|
||||
const vtt = mergeVtts(vtts, subtitles);
|
||||
const url = URL.createObjectURL(new Blob([
|
||||
vtt
|
||||
], {
|
||||
type: "text/vtt"
|
||||
}));
|
||||
art.option.subtitle.escape = false;
|
||||
art.subtitle.init({
|
||||
...art.option.subtitle,
|
||||
url,
|
||||
type: "vtt",
|
||||
onVttLoad: unescape
|
||||
});
|
||||
};
|
||||
}
|
||||
artplayerPluginMultipleSubtitles.env = "development";
|
||||
artplayerPluginMultipleSubtitles.version = "1.0.0";
|
||||
artplayerPluginMultipleSubtitles.build = "2023-11-23 22:22:14";
|
||||
if (typeof window !== "undefined") window["artplayerPluginMultipleSubtitles"] = artplayerPluginMultipleSubtitles;
|
||||
|
||||
},{"@parcel/transformer-js/src/esmodule-helpers.js":"5dUr6","./parser":"eko7u"}],"5dUr6":[function(require,module,exports) {
|
||||
exports.interopDefault = function(a) {
|
||||
return a && a.__esModule ? a : {
|
||||
default: a
|
||||
};
|
||||
};
|
||||
exports.defineInteropFlag = function(a) {
|
||||
Object.defineProperty(a, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
};
|
||||
exports.exportAll = function(source, dest) {
|
||||
Object.keys(source).forEach(function(key) {
|
||||
if (key === "default" || key === "__esModule" || dest.hasOwnProperty(key)) return;
|
||||
Object.defineProperty(dest, key, {
|
||||
enumerable: true,
|
||||
get: function() {
|
||||
return source[key];
|
||||
}
|
||||
});
|
||||
});
|
||||
return dest;
|
||||
};
|
||||
exports.export = function(dest, destName, get) {
|
||||
Object.defineProperty(dest, destName, {
|
||||
enumerable: true,
|
||||
get: get
|
||||
});
|
||||
};
|
||||
|
||||
},{}],"eko7u":[function(require,module,exports) {
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
(function() {
|
||||
var defaultCueSettings = {
|
||||
direction: "horizontal",
|
||||
snapToLines: true,
|
||||
linePosition: "auto",
|
||||
lineAlign: "start",
|
||||
textPosition: "auto",
|
||||
positionAlign: "auto",
|
||||
size: 100,
|
||||
alignment: "center"
|
||||
};
|
||||
var WebVTTParser = function(entities) {
|
||||
if (!entities) entities = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
"&lrm": "\u200E",
|
||||
"&rlm": "\u200F",
|
||||
" ": "\xa0"
|
||||
};
|
||||
this.entities = entities;
|
||||
this.parse = function(input, mode) {
|
||||
// global search and replace for \0
|
||||
input = input.replace(/\0/g, "\uFFFD");
|
||||
var NEWLINE = /\r\n|\r|\n/, startTime = Date.now(), linePos = 0, lines = input.split(NEWLINE), alreadyCollected = false, styles = [], cues = [], errors = [];
|
||||
function err(message, col) {
|
||||
errors.push({
|
||||
message: message,
|
||||
line: linePos + 1,
|
||||
col: col
|
||||
});
|
||||
}
|
||||
var line = lines[linePos], lineLength = line.length, signature = "WEBVTT", bom = 0, signature_length = signature.length;
|
||||
/* Byte order mark */ if (line[0] === "\uFEFF") {
|
||||
bom = 1;
|
||||
signature_length += 1;
|
||||
}
|
||||
/* SIGNATURE */ if (lineLength < signature_length || line.indexOf(signature) !== 0 + bom || lineLength > signature_length && line[signature_length] !== " " && line[signature_length] !== " ") err('No valid signature. (File needs to start with "WEBVTT".)');
|
||||
linePos++;
|
||||
/* HEADER */ while(lines[linePos] != "" && lines[linePos] != undefined){
|
||||
err("No blank line after the signature.");
|
||||
if (lines[linePos].indexOf("-->") != -1) {
|
||||
alreadyCollected = true;
|
||||
break;
|
||||
}
|
||||
linePos++;
|
||||
}
|
||||
/* CUE LOOP */ while(lines[linePos] != undefined){
|
||||
var cue;
|
||||
while(!alreadyCollected && lines[linePos] == "")linePos++;
|
||||
if (!alreadyCollected && lines[linePos] == undefined) break;
|
||||
/* CUE CREATION */ cue = Object.assign({}, defaultCueSettings, {
|
||||
id: "",
|
||||
startTime: 0,
|
||||
endTime: 0,
|
||||
pauseOnExit: false,
|
||||
direction: "horizontal",
|
||||
snapToLines: true,
|
||||
linePosition: "auto",
|
||||
lineAlign: "start",
|
||||
textPosition: "auto",
|
||||
positionAlign: "auto",
|
||||
size: 100,
|
||||
alignment: "center",
|
||||
text: "",
|
||||
tree: null
|
||||
});
|
||||
var parseTimings = true;
|
||||
if (lines[linePos].indexOf("-->") == -1) {
|
||||
cue.id = lines[linePos];
|
||||
/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/ if (/^NOTE($|[ \t])/.test(cue.id)) {
|
||||
linePos++;
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined){
|
||||
if (lines[linePos].indexOf("-->") != -1) err("Cannot have timestamp in a comment.");
|
||||
linePos++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/* STYLES */ if (/^STYLE($|[ \t])/.test(cue.id)) {
|
||||
var style = [];
|
||||
var invalid = false;
|
||||
linePos++;
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined){
|
||||
if (lines[linePos].indexOf("-->") != -1) {
|
||||
err("Cannot have timestamp in a style block.");
|
||||
invalid = true;
|
||||
}
|
||||
style.push(lines[linePos]);
|
||||
linePos++;
|
||||
}
|
||||
if (cues.length) {
|
||||
err("Style blocks cannot appear after the first cue.");
|
||||
continue;
|
||||
}
|
||||
if (!invalid) styles.push(style.join("\n"));
|
||||
continue;
|
||||
}
|
||||
linePos++;
|
||||
if (lines[linePos] == "" || lines[linePos] == undefined) {
|
||||
err("Cue identifier cannot be standalone.");
|
||||
continue;
|
||||
}
|
||||
if (lines[linePos].indexOf("-->") == -1) {
|
||||
parseTimings = false;
|
||||
err("Cue identifier needs to be followed by timestamp.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* TIMINGS */ alreadyCollected = false;
|
||||
var timings = new WebVTTCueTimingsAndSettingsParser(lines[linePos], err);
|
||||
var previousCueStart = 0;
|
||||
if (cues.length > 0) previousCueStart = cues[cues.length - 1].startTime;
|
||||
if (parseTimings && !timings.parse(cue, previousCueStart)) {
|
||||
/* BAD CUE */ cue = null;
|
||||
linePos++;
|
||||
/* BAD CUE LOOP */ while(lines[linePos] != "" && lines[linePos] != undefined){
|
||||
if (lines[linePos].indexOf("-->") != -1) {
|
||||
alreadyCollected = true;
|
||||
break;
|
||||
}
|
||||
linePos++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
linePos++;
|
||||
/* CUE TEXT LOOP */ while(lines[linePos] != "" && lines[linePos] != undefined){
|
||||
if (lines[linePos].indexOf("-->") != -1) {
|
||||
err("Blank line missing before cue.");
|
||||
alreadyCollected = true;
|
||||
break;
|
||||
}
|
||||
if (cue.text != "") cue.text += "\n";
|
||||
cue.text += lines[linePos];
|
||||
linePos++;
|
||||
}
|
||||
/* CUE TEXT PROCESSING */ var cuetextparser = new WebVTTCueTextParser(cue.text, err, mode, entities);
|
||||
cue.tree = cuetextparser.parse(cue.startTime, cue.endTime);
|
||||
cues.push(cue);
|
||||
}
|
||||
cues.sort(function(a, b) {
|
||||
if (a.startTime < b.startTime) return -1;
|
||||
if (a.startTime > b.startTime) return 1;
|
||||
if (a.endTime > b.endTime) return -1;
|
||||
if (a.endTime < b.endTime) return 1;
|
||||
return 0;
|
||||
});
|
||||
/* END */ return {
|
||||
cues: cues,
|
||||
errors: errors,
|
||||
time: Date.now() - startTime,
|
||||
styles: styles
|
||||
};
|
||||
};
|
||||
};
|
||||
var WebVTTCueTimingsAndSettingsParser = function(line, errorHandler) {
|
||||
var SPACE = /[\u0020\t\f]/, NOSPACE = /[^\u0020\t\f]/, line = line, pos = 0, err = function(message) {
|
||||
errorHandler(message, pos + 1);
|
||||
}, spaceBeforeSetting = true;
|
||||
function skip(pattern) {
|
||||
while(line[pos] != undefined && pattern.test(line[pos]))pos++;
|
||||
}
|
||||
function collect(pattern) {
|
||||
var str = "";
|
||||
while(line[pos] != undefined && pattern.test(line[pos])){
|
||||
str += line[pos];
|
||||
pos++;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */ function timestamp() {
|
||||
var units = "minutes", val1, val2, val3, val4;
|
||||
// 3
|
||||
if (line[pos] == undefined) {
|
||||
err("No timestamp found.");
|
||||
return;
|
||||
}
|
||||
// 4
|
||||
if (!/\d/.test(line[pos])) {
|
||||
err("Timestamp must start with a character in the range 0-9.");
|
||||
return;
|
||||
}
|
||||
// 5-7
|
||||
val1 = collect(/\d/);
|
||||
if (val1.length > 2 || parseInt(val1, 10) > 59) units = "hours";
|
||||
// 8
|
||||
if (line[pos] != ":") {
|
||||
err("No time unit separator found.");
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
// 9-11
|
||||
val2 = collect(/\d/);
|
||||
if (val2.length != 2) {
|
||||
err("Must be exactly two digits.");
|
||||
return;
|
||||
}
|
||||
// 12
|
||||
if (units == "hours" || line[pos] == ":") {
|
||||
if (line[pos] != ":") {
|
||||
err("No seconds found or minutes is greater than 59.");
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
val3 = collect(/\d/);
|
||||
if (val3.length != 2) {
|
||||
err("Must be exactly two digits.");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (val1.length != 2) {
|
||||
err("Must be exactly two digits.");
|
||||
return;
|
||||
}
|
||||
val3 = val2;
|
||||
val2 = val1;
|
||||
val1 = "0";
|
||||
}
|
||||
// 13
|
||||
if (line[pos] != ".") {
|
||||
err('No decimal separator (".") found.');
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
// 14-16
|
||||
val4 = collect(/\d/);
|
||||
if (val4.length != 3) {
|
||||
err("Milliseconds must be given in three digits.");
|
||||
return;
|
||||
}
|
||||
// 17
|
||||
if (parseInt(val2, 10) > 59) {
|
||||
err("You cannot have more than 59 minutes.");
|
||||
return;
|
||||
}
|
||||
if (parseInt(val3, 10) > 59) {
|
||||
err("You cannot have more than 59 seconds.");
|
||||
return;
|
||||
}
|
||||
return parseInt(val1, 10) * 3600 + parseInt(val2, 10) * 60 + parseInt(val3, 10) + parseInt(val4, 10) / 1000;
|
||||
}
|
||||
/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */ function parseSettings(input, cue) {
|
||||
var settings = input.split(SPACE), seen = [];
|
||||
for(var i = 0; i < settings.length; i++){
|
||||
if (settings[i] == "") continue;
|
||||
var index = settings[i].indexOf(":"), setting = settings[i].slice(0, index), value = settings[i].slice(index + 1);
|
||||
if (seen.indexOf(setting) != -1) err("Duplicate setting.");
|
||||
seen.push(setting);
|
||||
if (value == "") {
|
||||
err("No value for setting defined.");
|
||||
return;
|
||||
}
|
||||
if (setting == "vertical") {
|
||||
if (value != "rl" && value != "lr") {
|
||||
err("Writing direction can only be set to 'rl' or 'rl'.");
|
||||
continue;
|
||||
}
|
||||
cue.direction = value;
|
||||
} else if (setting == "line") {
|
||||
if (/,/.test(value)) {
|
||||
var comp = value.split(",");
|
||||
value = comp[0];
|
||||
var lineAlign = comp[1];
|
||||
}
|
||||
if (!/^[-\d](\d*)(\.\d+)?%?$/.test(value)) {
|
||||
err("Line position takes a number or percentage.");
|
||||
continue;
|
||||
}
|
||||
if (value.indexOf("-", 1) != -1) {
|
||||
err("Line position can only have '-' at the start.");
|
||||
continue;
|
||||
}
|
||||
if (value.indexOf("%") != -1 && value.indexOf("%") != value.length - 1) {
|
||||
err("Line position can only have '%' at the end.");
|
||||
continue;
|
||||
}
|
||||
if (value[0] == "-" && value[value.length - 1] == "%") {
|
||||
err("Line position cannot be a negative percentage.");
|
||||
continue;
|
||||
}
|
||||
var numVal = value;
|
||||
var isPercent = false;
|
||||
if (value[value.length - 1] == "%") {
|
||||
isPercent = true;
|
||||
numVal = value.slice(0, value.length - 1);
|
||||
if (parseInt(value, 10) > 100) {
|
||||
err("Line position cannot be >100%.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (numVal === "" || isNaN(numVal) || !isFinite(numVal)) {
|
||||
err("Line position needs to be a number");
|
||||
continue;
|
||||
}
|
||||
if (lineAlign !== undefined) {
|
||||
if (![
|
||||
"start",
|
||||
"center",
|
||||
"end"
|
||||
].includes(lineAlign)) {
|
||||
err("Line alignment needs to be one of start, center or end");
|
||||
continue;
|
||||
}
|
||||
cue.lineAlign = lineAlign;
|
||||
}
|
||||
cue.snapToLines = !isPercent;
|
||||
cue.linePosition = parseFloat(numVal);
|
||||
if (parseFloat(numVal).toString() !== numVal) cue.nonSerializable = true;
|
||||
} else if (setting == "position") {
|
||||
if (/,/.test(value)) {
|
||||
var comp = value.split(",");
|
||||
value = comp[0];
|
||||
var positionAlign = comp[1];
|
||||
}
|
||||
if (value[value.length - 1] != "%") {
|
||||
err("Text position must be a percentage.");
|
||||
continue;
|
||||
}
|
||||
if (parseInt(value, 10) > 100 || parseInt(value, 10) < 0) {
|
||||
err("Text position needs to be between 0 and 100%.");
|
||||
continue;
|
||||
}
|
||||
numVal = value.slice(0, value.length - 1);
|
||||
if (numVal === "" || isNaN(numVal) || !isFinite(numVal)) {
|
||||
err("Line position needs to be a number");
|
||||
continue;
|
||||
}
|
||||
if (positionAlign !== undefined) {
|
||||
if (![
|
||||
"line-left",
|
||||
"center",
|
||||
"line-right"
|
||||
].includes(positionAlign)) {
|
||||
err("Position alignment needs to be one of line-left, center or line-right");
|
||||
continue;
|
||||
}
|
||||
cue.positionAlign = positionAlign;
|
||||
}
|
||||
cue.textPosition = parseFloat(numVal);
|
||||
} else if (setting == "size") {
|
||||
if (value[value.length - 1] != "%") {
|
||||
err("Size must be a percentage.");
|
||||
continue;
|
||||
}
|
||||
if (parseInt(value, 10) > 100) {
|
||||
err("Size cannot be >100%.");
|
||||
continue;
|
||||
}
|
||||
var size = value.slice(0, value.length - 1);
|
||||
if (size === undefined || size === "" || isNaN(size)) {
|
||||
err("Size needs to be a number");
|
||||
size = 100;
|
||||
continue;
|
||||
} else {
|
||||
size = parseFloat(size);
|
||||
if (size < 0 || size > 100) {
|
||||
err("Size needs to be between 0 and 100%.");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
cue.size = size;
|
||||
} else if (setting == "align") {
|
||||
var alignValues = [
|
||||
"start",
|
||||
"center",
|
||||
"end",
|
||||
"left",
|
||||
"right"
|
||||
];
|
||||
if (alignValues.indexOf(value) == -1) {
|
||||
err("Alignment can only be set to one of " + alignValues.join(", ") + ".");
|
||||
continue;
|
||||
}
|
||||
cue.alignment = value;
|
||||
} else err("Invalid setting.");
|
||||
}
|
||||
}
|
||||
this.parse = function(cue, previousCueStart) {
|
||||
skip(SPACE);
|
||||
cue.startTime = timestamp();
|
||||
if (cue.startTime == undefined) return;
|
||||
if (cue.startTime < previousCueStart) err("Start timestamp is not greater than or equal to start timestamp of previous cue.");
|
||||
if (NOSPACE.test(line[pos])) err("Timestamp not separated from '-->' by whitespace.");
|
||||
skip(SPACE);
|
||||
// 6-8
|
||||
if (line[pos] != "-") {
|
||||
err("No valid timestamp separator found.");
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
if (line[pos] != "-") {
|
||||
err("No valid timestamp separator found.");
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
if (line[pos] != ">") {
|
||||
err("No valid timestamp separator found.");
|
||||
return;
|
||||
}
|
||||
pos++;
|
||||
if (NOSPACE.test(line[pos])) err("'-->' not separated from timestamp by whitespace.");
|
||||
skip(SPACE);
|
||||
cue.endTime = timestamp();
|
||||
if (cue.endTime == undefined) return;
|
||||
if (cue.endTime <= cue.startTime) err("End timestamp is not greater than start timestamp.");
|
||||
if (NOSPACE.test(line[pos])) spaceBeforeSetting = false;
|
||||
skip(SPACE);
|
||||
parseSettings(line.substring(pos), cue);
|
||||
return true;
|
||||
};
|
||||
this.parseTimestamp = function() {
|
||||
var ts = timestamp();
|
||||
if (line[pos] != undefined) {
|
||||
err("Timestamp must not have trailing characters.");
|
||||
return;
|
||||
}
|
||||
return ts;
|
||||
};
|
||||
};
|
||||
var WebVTTCueTextParser = function(line, errorHandler, mode, entities) {
|
||||
this.entities = entities;
|
||||
var self = this;
|
||||
var line = line, pos = 0, err = function(message) {
|
||||
if (mode == "metadata") return;
|
||||
errorHandler(message, pos + 1);
|
||||
};
|
||||
this.parse = function(cueStart, cueEnd) {
|
||||
function removeCycles(tree) {
|
||||
const cyclelessTree = {
|
||||
...tree
|
||||
};
|
||||
if (tree.children) cyclelessTree.children = tree.children.map(removeCycles);
|
||||
if (cyclelessTree.parent) delete cyclelessTree.parent;
|
||||
return cyclelessTree;
|
||||
}
|
||||
var result = {
|
||||
children: []
|
||||
}, current = result, timestamps = [];
|
||||
function attach(token) {
|
||||
current.children.push({
|
||||
type: "object",
|
||||
name: token[1],
|
||||
classes: token[2],
|
||||
children: [],
|
||||
parent: current
|
||||
});
|
||||
current = current.children[current.children.length - 1];
|
||||
}
|
||||
function inScope(name) {
|
||||
var node = current;
|
||||
while(node){
|
||||
if (node.name == name) return true;
|
||||
node = node.parent;
|
||||
}
|
||||
return;
|
||||
}
|
||||
while(line[pos] != undefined){
|
||||
var token = nextToken();
|
||||
if (token[0] == "text") current.children.push({
|
||||
type: "text",
|
||||
value: token[1],
|
||||
parent: current
|
||||
});
|
||||
else if (token[0] == "start tag") {
|
||||
if (mode == "chapters") err("Start tags not allowed in chapter title text.");
|
||||
var name = token[1];
|
||||
if (name != "v" && name != "lang" && token[3] != "") err("Only <v> and <lang> can have an annotation.");
|
||||
if (name == "c" || name == "i" || name == "b" || name == "u" || name == "ruby") attach(token);
|
||||
else if (name == "rt" && current.name == "ruby") attach(token);
|
||||
else if (name == "v") {
|
||||
if (inScope("v")) err("<v> cannot be nested inside itself.");
|
||||
attach(token);
|
||||
current.value = token[3] // annotation
|
||||
;
|
||||
if (!token[3]) err("<v> requires an annotation.");
|
||||
} else if (name == "lang") {
|
||||
attach(token);
|
||||
current.value = token[3] // language
|
||||
;
|
||||
} else err("Incorrect start tag.");
|
||||
} else if (token[0] == "end tag") {
|
||||
if (mode == "chapters") err("End tags not allowed in chapter title text.");
|
||||
// XXX check <ruby> content
|
||||
if (token[1] == current.name) current = current.parent;
|
||||
else if (token[1] == "ruby" && current.name == "rt") current = current.parent.parent;
|
||||
else err("Incorrect end tag.");
|
||||
} else if (token[0] == "timestamp") {
|
||||
if (mode == "chapters") err("Timestamp not allowed in chapter title text.");
|
||||
var timings = new WebVTTCueTimingsAndSettingsParser(token[1], err), timestamp = timings.parseTimestamp();
|
||||
if (timestamp != undefined) {
|
||||
if (timestamp <= cueStart || timestamp >= cueEnd) err("Timestamp must be between start timestamp and end timestamp.");
|
||||
if (timestamps.length > 0 && timestamps[timestamps.length - 1] >= timestamp) err("Timestamp must be greater than any previous timestamp.");
|
||||
current.children.push({
|
||||
type: "timestamp",
|
||||
value: timestamp,
|
||||
parent: current
|
||||
});
|
||||
timestamps.push(timestamp);
|
||||
}
|
||||
}
|
||||
}
|
||||
while(current.parent){
|
||||
if (current.name != "v") err("Required end tag missing.");
|
||||
current = current.parent;
|
||||
}
|
||||
return removeCycles(result);
|
||||
};
|
||||
function nextToken() {
|
||||
var state = "data", result = "", buffer = "", classes = [];
|
||||
while(line[pos - 1] != undefined || pos == 0){
|
||||
var c = line[pos];
|
||||
if (state == "data") {
|
||||
if (c == "&") {
|
||||
buffer = c;
|
||||
state = "escape";
|
||||
} else if (c == "<" && result == "") state = "tag";
|
||||
else if (c == "<" || c == undefined) return [
|
||||
"text",
|
||||
result
|
||||
];
|
||||
else result += c;
|
||||
} else if (state == "escape") {
|
||||
if (c == "<" || c == undefined) {
|
||||
err("Incorrect escape.");
|
||||
let m;
|
||||
if (m = buffer.match(/^&#([0-9]+)$/)) result += String.fromCharCode(m[1]);
|
||||
else if (self.entities[buffer]) result += self.entities[buffer];
|
||||
else result += buffer;
|
||||
return [
|
||||
"text",
|
||||
result
|
||||
];
|
||||
} else if (c == "&") {
|
||||
err("Incorrect escape.");
|
||||
result += buffer;
|
||||
buffer = c;
|
||||
} else if (/[a-z#0-9]/i.test(c)) buffer += c;
|
||||
else if (c == ";") {
|
||||
let m;
|
||||
if (m = buffer.match(/^&#(x?[0-9]+)$/)) // we prepend "0" so that x20 be interpreted as hexadecim (0x20)
|
||||
result += String.fromCharCode("0" + m[1]);
|
||||
else if (self.entities[buffer + c]) result += self.entities[buffer + c];
|
||||
else if (m = Object.keys(entities).find((n)=>buffer.startsWith(n))) result += self.entities[m] + buffer.slice(m.length) + c;
|
||||
else {
|
||||
err("Incorrect escape.");
|
||||
result += buffer + ";";
|
||||
}
|
||||
state = "data";
|
||||
} else {
|
||||
err("Incorrect escape.");
|
||||
result += buffer + c;
|
||||
state = "data";
|
||||
}
|
||||
} else if (state == "tag") {
|
||||
if (c == " " || c == "\n" || c == "\f" || c == " ") state = "start tag annotation";
|
||||
else if (c == ".") state = "start tag class";
|
||||
else if (c == "/") state = "end tag";
|
||||
else if (/\d/.test(c)) {
|
||||
result = c;
|
||||
state = "timestamp tag";
|
||||
} else if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
return [
|
||||
"start tag",
|
||||
"",
|
||||
[],
|
||||
""
|
||||
];
|
||||
} else {
|
||||
result = c;
|
||||
state = "start tag";
|
||||
}
|
||||
} else if (state == "start tag") {
|
||||
if (c == " " || c == "\f" || c == " ") state = "start tag annotation";
|
||||
else if (c == "\n") {
|
||||
buffer = c;
|
||||
state = "start tag annotation";
|
||||
} else if (c == ".") state = "start tag class";
|
||||
else if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
return [
|
||||
"start tag",
|
||||
result,
|
||||
[],
|
||||
""
|
||||
];
|
||||
} else result += c;
|
||||
} else if (state == "start tag class") {
|
||||
if (c == " " || c == "\f" || c == " ") {
|
||||
if (buffer) classes.push(buffer);
|
||||
buffer = "";
|
||||
state = "start tag annotation";
|
||||
} else if (c == "\n") {
|
||||
if (buffer) classes.push(buffer);
|
||||
buffer = c;
|
||||
state = "start tag annotation";
|
||||
} else if (c == ".") {
|
||||
if (buffer) classes.push(buffer);
|
||||
buffer = "";
|
||||
} else if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
if (buffer) classes.push(buffer);
|
||||
return [
|
||||
"start tag",
|
||||
result,
|
||||
classes,
|
||||
""
|
||||
];
|
||||
} else buffer += c;
|
||||
} else if (state == "start tag annotation") {
|
||||
if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
buffer = buffer.split(/[\u0020\t\f\r\n]+/).filter(function(item) {
|
||||
if (item) return true;
|
||||
}).join(" ");
|
||||
return [
|
||||
"start tag",
|
||||
result,
|
||||
classes,
|
||||
buffer
|
||||
];
|
||||
} else buffer += c;
|
||||
} else if (state == "end tag") {
|
||||
if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
return [
|
||||
"end tag",
|
||||
result
|
||||
];
|
||||
} else result += c;
|
||||
} else if (state == "timestamp tag") {
|
||||
if (c == ">" || c == undefined) {
|
||||
if (c == ">") pos++;
|
||||
return [
|
||||
"timestamp",
|
||||
result
|
||||
];
|
||||
} else result += c;
|
||||
} else err("Never happens.") // The joke is it might.
|
||||
;
|
||||
// 8
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
};
|
||||
var WebVTTSerializer = function() {
|
||||
function serializeTimestamp(seconds) {
|
||||
const ms = ("00" + (seconds - Math.floor(seconds)).toFixed(3) * 1000).slice(-3);
|
||||
let h = 0, m = 0, s = 0;
|
||||
if (seconds >= 3600) h = Math.floor(seconds / 3600);
|
||||
m = Math.floor((seconds - 3600 * h) / 60);
|
||||
s = Math.floor(seconds - 3600 * h - 60 * m);
|
||||
return (h ? h + ":" : "") + ("" + m).padStart(2, "0") + ":" + ("" + s).padStart(2, "0") + "." + ms;
|
||||
}
|
||||
function serializeCueSettings(cue) {
|
||||
var result = "";
|
||||
const nonDefaultSettings = Object.keys(defaultCueSettings).filter((s)=>cue[s] !== defaultCueSettings[s]);
|
||||
if (nonDefaultSettings.includes("direction")) result += " vertical:" + cue.direction;
|
||||
if (nonDefaultSettings.includes("alignment")) result += " align:" + cue.alignment;
|
||||
if (nonDefaultSettings.includes("size")) result += " size:" + cue.size + "%";
|
||||
if (nonDefaultSettings.includes("lineAlign") || nonDefaultSettings.includes("linePosition")) result += " line:" + cue.linePosition + (cue.snapToLines ? "" : "%") + (cue.lineAlign && cue.lineAlign != defaultCueSettings.lineAlign ? "," + cue.lineAlign : "");
|
||||
if (nonDefaultSettings.includes("textPosition") || nonDefaultSettings.includes("positionAlign")) result += " position:" + cue.textPosition + "%" + (cue.positionAlign && cue.positionAlign !== defaultCueSettings.positionAlign ? "," + cue.positionAlign : "");
|
||||
return result;
|
||||
}
|
||||
function serializeTree(tree) {
|
||||
var result = "";
|
||||
for(var i = 0; i < tree.length; i++){
|
||||
var node = tree[i];
|
||||
if (node.type == "text") result += node.value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
||||
else if (node.type == "object") {
|
||||
result += "<" + node.name;
|
||||
if (node.classes) for(var y = 0; y < node.classes.length; y++)result += "." + node.classes[y];
|
||||
if (node.value) result += " " + node.value;
|
||||
result += ">";
|
||||
if (node.children) result += serializeTree(node.children);
|
||||
result += "</" + node.name + ">";
|
||||
} else if (node.type == "timestamp") result += "<" + serializeTimestamp(node.value) + ">";
|
||||
else result += "<" + node.value + ">";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function serializeCue(cue) {
|
||||
return (cue.id !== undefined ? cue.id + "\n" : "") + serializeTimestamp(cue.startTime) + " --> " + serializeTimestamp(cue.endTime) + serializeCueSettings(cue) + "\n" + serializeTree(cue.tree.children) + "\n\n";
|
||||
}
|
||||
function serializeStyle(style) {
|
||||
return "STYLE\n" + style + "\n\n";
|
||||
}
|
||||
this.serialize = function(cues, styles) {
|
||||
var result = "WEBVTT\n\n";
|
||||
if (styles) for(var i = 0; i < styles.length; i++)result += serializeStyle(styles[i]);
|
||||
for(var i = 0; i < cues.length; i++)result += serializeCue(cues[i]);
|
||||
return result;
|
||||
};
|
||||
};
|
||||
function exportify(object) {
|
||||
object.WebVTTParser = WebVTTParser;
|
||||
object.WebVTTCueTimingsAndSettingsParser = WebVTTCueTimingsAndSettingsParser;
|
||||
object.WebVTTCueTextParser = WebVTTCueTextParser;
|
||||
object.WebVTTSerializer = WebVTTSerializer;
|
||||
}
|
||||
if (typeof window !== "undefined") exportify(window);
|
||||
exportify(exports);
|
||||
})();
|
||||
|
||||
},{}]},["LGGZX"], "LGGZX", "parcelRequire4dc0")
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAgEwB;AAhExB;AAEA,SAAS,SAAS,GAAG;IACjB,MAAM,MAAM;QACR,SAAS;QACT,QAAQ;QACR,QAAQ;QACR,SAAS;QACT,UAAU;IACd;IACA,MAAM,MAAM,IAAI,OAAO,CAAC,CAAC,EAAE,OAAO,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;IAC1D,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,MAAQ,GAAG,CAAC,IAAI,IAAI;AACjD;AAEA,eAAe,kBAAkB,MAAM;IACnC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,KAAK;IACtD,MAAM,WAAW,MAAM,MAAM,OAAO,GAAG;IACvC,MAAM,SAAS,MAAM,SAAS,WAAW;IACzC,MAAM,UAAU,IAAI,YAAY,OAAO,QAAQ,IAAI;IACnD,MAAM,OAAO,QAAQ,MAAM,CAAC;IAC5B,OAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,GAAG;QACpC,KAAK;YACD,OAAO,SAAS;QAEpB,KAAK;YACD,OAAO,SAAS;QAEpB,KAAK;YACD,OAAO;QAEX;YACI,OAAO;IACf;AACJ;AAEA,SAAS,UAAU,IAAI,EAAE,SAAS;IAC9B,MAAM,SAAS,IAAI,CAAA,GAAA,oBAAY,AAAD;IAC9B,MAAM,OAAO,IAAI,CAAA,GAAA,wBAAgB,AAAD;IAChC,MAAM,SAAS,OAAO,KAAK,CAAC,IAAI;IAEhC,IAAK,IAAI,IAAI,GAAG,IAAI,KAAK,MAAM,EAAE,IAAK;QAClC,MAAM,SAAS,SAAS,CAAC,EAAE;QAC3B,MAAM,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE;QAEnC,IAAK,IAAI,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC,MAAM,EAAE,IAAK;YACvC,MAAM,MAAM,KAAK,IAAI,CAAC,EAAE;YACxB,IAAK,IAAI,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAK;gBAC/C,MAAM,WAAW,IAAI,IAAI,CAAC,QAAQ,CAAC,EAAE;gBACrC,SAAS,KAAK,GAAG,CAAC,yBAAyB,EAAE,OAAO,IAAI,CAAC,EAAE,EAAE,SAAS,KAAK,CAAC,MAAM,CAAC;YACvF;QACJ;QAEA,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,GACvB,OAAO,IAAI,GAAG,KAAK,IAAI;aAEvB,IAAK,IAAI,IAAI,GAAG,IAAI,OAAO,IAAI,CAAC,MAAM,EAAE,IACpC,OAAO,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,IAAK,KAAK,IAAI,CAAC,EAAE,EAAE,MAAM,YAAY,EAAE;IAGpF;IAEA,OAAO,KAAK,SAAS,CAAC,OAAO,IAAI;AACrC;AAEe,SAAS,iCAAiC,EAAE,SAAS,EAAE;IAClE,OAAO,OAAO;QACV,MAAM,OAAO,MAAM,QAAQ,GAAG,CAAC,UAAU,GAAG,CAAC;QAC7C,MAAM,MAAM,UAAU,MAAM;QAC5B,MAAM,MAAM,IAAI,eAAe,CAAC,IAAI,KAAK;YAAC;SAAI,EAAE;YAAE,MAAM;QAAW;QAEnE,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG;QAE7B,IAAI,QAAQ,CAAC,IAAI,CAAC;YACd,GAAG,IAAI,MAAM,CAAC,QAAQ;YACtB;YACA,MAAM;YACN,WAAW;QACf;IACJ;AACJ;AACA,iCAAiC,GAAG;AACpC,iCAAiC,OAAO;AACxC,iCAAiC,KAAK;AAEtC,IAAI,OAAO,WAAW,aAClB,MAAM,CAAC,mCAAmC,GAAG;;;ACrFjD,QAAQ,cAAc,GAAG,SAAU,CAAC;IAClC,OAAO,KAAK,EAAE,UAAU,GAAG,IAAI;QAAC,SAAS;IAAC;AAC5C;AAEA,QAAQ,iBAAiB,GAAG,SAAU,CAAC;IACrC,OAAO,cAAc,CAAC,GAAG,cAAc;QAAC,OAAO;IAAI;AACrD;AAEA,QAAQ,SAAS,GAAG,SAAU,MAAM,EAAE,IAAI;IACxC,OAAO,IAAI,CAAC,QAAQ,OAAO,CAAC,SAAU,GAAG;QACvC,IAAI,QAAQ,aAAa,QAAQ,gBAAgB,KAAK,cAAc,CAAC,MACnE;QAGF,OAAO,cAAc,CAAC,MAAM,KAAK;YAC/B,YAAY;YACZ,KAAK;gBACH,OAAO,MAAM,CAAC,IAAI;YACpB;QACF;IACF;IAEA,OAAO;AACT;AAEA,QAAQ,MAAM,GAAG,SAAU,IAAI,EAAE,QAAQ,EAAE,GAAG;IAC5C,OAAO,cAAc,CAAC,MAAM,UAAU;QACpC,YAAY;QACZ,KAAK;IACP;AACF;;;AC9BA,mDAAmD;AACnD,oDAAoD;AAEpD,2EAA2E;AAE1E,CAAA;IACC,IAAI,qBAAqB;QACvB,WAAU;QACV,aAAY;QACZ,cAAa;QACb,WAAU;QACV,cAAa;QACb,eAAc;QACd,MAAK;QACL,WAAU;IACZ;IAEA,IAAI,eAAe,SAAS,QAAQ;QAClC,IAAI,CAAC,UACH,WAAW;YACT,QAAQ;YACR,OAAO;YACP,OAAO;YACP,QAAQ;YACR,QAAQ;YACR,SAAS;QACX;QAEF,IAAI,CAAC,QAAQ,GAAG;QAChB,IAAI,CAAC,KAAK,GAAG,SAAS,KAAK,EAAE,IAAI;YAC/B,mCAAmC;YACnC,QAAQ,MAAM,OAAO,CAAC,OAAO;YAC7B,IAAI,UAAU,cACV,YAAY,KAAK,GAAG,IACpB,UAAU,GACV,QAAQ,MAAM,KAAK,CAAC,UACpB,mBAAmB,OACnB,SAAS,EAAE,EACX,OAAO,EAAE,EACT,SAAS,EAAE;YACf,SAAS,IAAI,OAAO,EAAE,GAAG;gBACvB,OAAO,IAAI,CAAC;oBAAC,SAAQ;oBAAS,MAAK,UAAQ;oBAAG,KAAI;gBAAG;YACvD;YAEA,IAAI,OAAO,KAAK,CAAC,QAAQ,EACrB,aAAa,KAAK,MAAM,EACxB,YAAY,UACZ,MAAM,GACN,mBAAmB,UAAU,MAAM;YAEvC,mBAAmB,GACnB,IAAI,IAAI,CAAC,EAAE,KAAK,UAAU;gBACxB,MAAM;gBACN,oBAAoB;YACtB;YACA,aAAa,GACb,IACE,aAAa,oBACb,KAAK,OAAO,CAAC,eAAe,IAAE,OAC9B,aAAa,oBACb,IAAI,CAAC,iBAAiB,KAAK,OAC3B,IAAI,CAAC,iBAAiB,KAAK,KAE3B,IAAI;YAGN;YAEA,UAAU,GACV,MAAM,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,UAAW;gBACzD,IAAI;gBACJ,IAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,IAAI;oBACtC,mBAAmB;oBACnB;gBACF;gBACA;YACF;YAEA,YAAY,GACZ,MAAM,KAAK,CAAC,QAAQ,IAAI,UAAW;gBACjC,IAAI;gBACJ,MAAM,CAAC,oBAAoB,KAAK,CAAC,QAAQ,IAAI,GAC3C;gBAEF,IAAG,CAAC,oBAAoB,KAAK,CAAC,QAAQ,IAAI,WACxC;gBAEF,gBAAgB,GAChB,MAAM,OAAO,MAAM,CAAC,CAAC,GAAG,oBAAoB;oBAC1C,IAAG;oBACH,WAAU;oBACV,SAAQ;oBACR,aAAY;oBACZ,WAAU;oBACV,aAAY;oBACZ,cAAa;oBACb,WAAU;oBACV,cAAa;oBACb,eAAc;oBACd,MAAK;oBACL,WAAU;oBACV,MAAK;oBACL,MAAK;gBACP;gBAEA,IAAI,eAAe;gBAEnB,IAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,IAAI;oBACtC,IAAI,EAAE,GAAG,KAAK,CAAC,QAAQ;oBAEvB;;;WAGC,GACD,IAAG,iBAAiB,IAAI,CAAC,IAAI,EAAE,GAAG;wBAChC;wBACA,MAAM,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,UAAW;4BACzD,IAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,IAClC,IAAI;4BACN;wBACF;wBACA;oBACF;oBAEA,UAAU,GACV,IAAG,kBAAkB,IAAI,CAAC,IAAI,EAAE,GAAG;wBACjC,IAAI,QAAQ,EAAE;wBACd,IAAI,UAAU;wBACd;wBACA,MAAM,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,UAAW;4BACzD,IAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,IAAI;gCACtC,IAAI;gCACJ,UAAU;4BACZ;4BACA,MAAM,IAAI,CAAC,KAAK,CAAC,QAAQ;4BACzB;wBACF;wBACA,IAAG,KAAK,MAAM,EAAE;4BACd,IAAI;4BACJ;wBACF;wBACA,IAAI,CAAC,SACH,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC;wBAEzB;oBACF;oBAEA;oBAEA,IAAG,KAAK,CAAC,QAAQ,IAAI,MAAM,KAAK,CAAC,QAAQ,IAAI,WAAW;wBACtD,IAAI;wBACJ;oBACF;oBAEA,IAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,IAAI;wBACtC,eAAe;wBACf,IAAI;wBACJ;oBACF;gBACF;gLine truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof l[o]&&l[o];if(!r&&n)return n(t,!0);if(a)return a(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){var d=p(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd&&define((function(){return d}))}}({"16V0T":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var n=e("bundle-text:./style.less"),l=o.interopDefault(n);function a(){return e=>{!function(e){const{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number);r(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);const{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;const c="artplayer-plugin-control";l(r,c);const d=o(t,'<div class="apa-control-current"></div>'),s=o(t,'<div class="apa-control-duration"></div>'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t<f.length;t++)e.on(f[t],(()=>{d.innerText=n(e.currentTime),s.innerText=n(e.duration)}));return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(e){e?l(r,c):i(r,c)}}}}if(r.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:26","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){const e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{height:70px;width:400px;-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{width:15%;justify-content:center;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,o,n){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof l[o]&&l[o],i=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof l[o]&&l[o];if(!r&&n)return n(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=a,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return l[o]}}),l[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=p(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):n&&(this[n]=d)}}({"16V0T":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",()=>a);var n=e("bundle-text:./style.less"),l=o.interopDefault(n);function a(){return e=>{!function(e){let{version:t,utils:{errorHandle:r}}=e.constructor,o=t.split(".").map(Number),n=o[0],l=o[1]/100;r(n+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginControl@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(e);let{template:{$bottom:t,$player:r},constructor:{utils:{append:o,secondToTime:n,addClass:l,removeClass:i,hasClass:u,isMobile:p}}}=e;if(p)return;let c="artplayer-plugin-control";l(r,c);let d=o(t,'<div class="apa-control-current"></div>'),s=o(t,'<div class="apa-control-duration"></div>'),f=["video:loadedmetadata","video:timeupdate","video:progress"];for(let t=0;t<f.length;t++)e.on(f[t],()=>{d.innerText=n(e.currentTime),s.innerText=n(e.duration)});return{name:"artplayerPluginControl",get enable(){return u(r,c)},set enable(state){state?l(r,c):i(r,c)}}}}if(a.env="production",a.version="2.0.0",a.build="2023-11-23 23:22:00","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){let e=document.createElement("style");e.id="artplayer-plugin-control",e.textContent=l.default,document.head.appendChild(e)}"undefined"!=typeof window&&(window.artplayerPluginControl=a)},{"bundle-text:./style.less":"klrMD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],klrMD:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3;background-image:none;border-radius:10px;align-items:center;width:400px;height:70px;margin-left:-200px;inset:auto auto 10px 50%;overflow:visible;box-shadow:0 10px 15px -3px #0003,0 4px 6px -4px #0003}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{justify-content:center;width:15%;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["16V0T"],"16V0T","parcelRequire4dc0");
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,o,n){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){var n="function"==typeof a[o]&&a[o];if(!r&&n)return n(t,!0);if(l)return l(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){var d=p(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd&&define((function(){return d}))}}({eacU2:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var n=e("bundle-text:./style.less"),a=o.interopDefault(n);function l(){return function(e){!function(e){var t=e.constructor,r=t.version,o=t.utils.errorHandle,n=r.split(".").map(Number);o(n[0]+n[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"))}(e);var t=e.template,r=t.$bottom,o=t.$player,n=e.constructor.utils,a=n.append,i=n.secondToTime,u=n.addClass,p=n.removeClass,c=n.hasClass;if(!n.isMobile){var d="artplayer-plugin-control";u(o,d);for(var s=a(r,'<div class="apa-control-current"></div>'),f=a(r,'<div class="apa-control-duration"></div>'),y=["video:loadedmetadata","video:timeupdate","video:progress"],g=0;g<y.length;g++)e.on(y[g],(function(){s.innerText=i(e.currentTime),f.innerText=i(e.duration)}));return{name:"artplayerPluginControl",get enable(){return c(o,d)},set enable(e){e?u(o,d):p(o,d)}}}}}if(r.default=l,l.env="production",l.version="2.0.0",l.build="2023-08-26 16:47:27","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){var i=document.createElement("style");i.id="artplayer-plugin-control",i.textContent=a.default,document.head.appendChild(i)}"undefined"!=typeof window&&(window.artplayerPluginControl=l)},{"bundle-text:./style.less":"kok3H","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kok3H:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{height:70px;width:400px;-webkit-backdrop-filter:saturate(180%)blur(20px);backdrop-filter:saturate(180%)blur(20px);background-color:rgba(0,0,0,.7);background-image:none;border-radius:10px;align-items:center;margin-left:-200px;top:auto;bottom:10px;left:50%;right:auto;overflow:visible;box-shadow:0 10px 15px -3px rgba(0,0,0,.2),0 4px 6px -4px rgba(0,0,0,.2)}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{width:15%;justify-content:center;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["eacU2"],"eacU2","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,o,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof a[o]&&a[o],i=l.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function p(t,r){if(!i[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof a[o]&&a[o];if(!r&&n)return n(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(l)return l(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}s.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},s.cache={};var d=i[t]=new p.Module(t);e[t][0].call(d.exports,s,d,d.exports,this)}return i[t].exports;function s(e){var t=s.resolve(e);return!1===t?{}:p(t)}}p.isParcelRequire=!0,p.Module=function(e){this.id=e,this.bundle=p,this.exports={}},p.modules=e,p.cache=i,p.parent=l,p.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(p,"root",{get:function(){return a[o]}}),a[o]=p;for(var c=0;c<t.length;c++)p(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=p(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):n&&(this[n]=d)}}({eacU2:[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r),o.export(r,"default",function(){return l});var n=e("bundle-text:./style.less"),a=o.interopDefault(n);function l(){return function(e){r=(t=e.constructor).version,(0,t.utils.errorHandle)((o=r.split(".").map(Number))[0]+o[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginControl@").concat(l.version,". Please update it to version Artplayer.js@5.x.x"));var t,r,o,n=e.template,a=n.$bottom,i=n.$player,u=e.constructor.utils,p=u.append,c=u.secondToTime,d=u.addClass,s=u.removeClass,f=u.hasClass;if(!u.isMobile){var y="artplayer-plugin-control";d(i,y);for(var g=p(a,'<div class="apa-control-current"></div>'),m=p(a,'<div class="apa-control-duration"></div>'),b=["video:loadedmetadata","video:timeupdate","video:progress"],x=0;x<b.length;x++)e.on(b[x],function(){g.innerText=c(e.currentTime),m.innerText=c(e.duration)});return{name:"artplayerPluginControl",get enable(){return f(i,y)},set enable(state){state?d(i,y):s(i,y)}}}}}if(l.env="production",l.version="2.0.0",l.build="2023-11-23 23:22:00","undefined"!=typeof document&&!document.getElementById("artplayer-plugin-control")){var i=document.createElement("style");i.id="artplayer-plugin-control",i.textContent=a.default,document.head.appendChild(i)}"undefined"!=typeof window&&(window.artplayerPluginControl=l)},{"bundle-text:./style.less":"kok3H","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],kok3H:[function(e,t,r){t.exports=".artplayer-plugin-control{--art-control-height:46px;--art-control-icon-scale:1.1}.artplayer-plugin-control .apa-control-current,.artplayer-plugin-control .apa-control-duration{display:flex}.artplayer-plugin-control .art-control-time,.artplayer-plugin-control .art-controls-center{display:none}.artplayer-plugin-control .art-settings{bottom:85px}.artplayer-plugin-control .art-bottom{backdrop-filter:saturate(180%)blur(20px);background-color:rgba(0,0,0,.7);background-image:none;border-radius:10px;align-items:center;width:400px;height:70px;margin-left:-200px;top:auto;bottom:10px;left:50%;right:auto;overflow:visible;box-shadow:0 10px 15px -3px rgba(0,0,0,.2),0 4px 6px -4px rgba(0,0,0,.2)}.artplayer-plugin-control .art-bottom .art-progress{width:70%}.artplayer-plugin-control .art-bottom .art-controls{width:100%}.artplayer-plugin-control .art-bottom .apa-control-current,.artplayer-plugin-control .art-bottom .apa-control-duration{justify-content:center;width:15%;font-size:12px;line-height:1;display:flex;position:absolute;top:10px}.artplayer-plugin-control .art-bottom .apa-control-current{left:0}.artplayer-plugin-control .art-bottom .apa-control-duration{right:0}.apa-control-current,.apa-control-duration{display:none}"},{}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["eacU2"],"eacU2","parcelRequire4dc0");
|
||||
@@ -4,4 +4,70 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,n,i,r){var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof a[i]&&a[i],o=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,n){if(!o[e]){if(!t[e]){var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(e,!0);if(s)return s(e,!0);if(l&&"string"==typeof e)return l(e);var d=new Error("Cannot find module '"+e+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(n){var i=t[e][1][n];return null!=i?i:n},p.cache={};var m=o[e]=new u.Module(e);t[e][0].call(m.exports,p,m,m.exports,this)}return o[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=o,u.parent=s,u.register=function(e,n){t[e]=[function(t,e){e.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var d=0;d<e.length;d++)u(e[d]);if(n){var m=u(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd&&define((function(){return m}))}}({bgm6t:[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./danmuku"),a=i.interopDefault(r),s=t("./setting"),o=i.interopDefault(s),l=t("./heatmap"),u=i.interopDefault(l);function d(t){return e=>{!function(t){const{version:e,utils:{errorHandle:n}}=t.constructor,i=e.split(".").map(Number);n(i[0]+i[1]/100>=5,`Artplayer.js@${e} 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上`)}(e);const n=new(0,a.default)(e,t);return(0,o.default)(e,n),t.heatmap&&(0,u.default)(e,n,t.heatmap),{name:"artplayerPluginDanmuku",emit:n.emit.bind(n),load:n.load.bind(n),config:n.config.bind(n),hide:n.hide.bind(n),show:n.show.bind(n),reset:n.reset.bind(n),get option(){return n.option},get isHide(){return n.isHide},get isStop(){return n.isStop}}}}n.default=d,d.env="production",d.version="5.0.1",d.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,n){var i=t("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n);var r=t("./bilibili"),a=t("./getDanmuTop"),s=i.interopDefault(a);class o{constructor(e,n){const{constructor:i,template:r}=e;if(this.utils=i.utils,this.validator=i.validator,this.$danmuku=r.$danmuku,this.$player=r.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){const{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[0]}get marginBottom(){const{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:n}=this.$player;if("number"==typeof e)return t(e,0,n);if("string"==typeof e&&e.endsWith("%")){return t(n*(parseFloat(e)/100),0,n)}return o.option.margin[1]}filter(t,e){return this.queue.filter((e=>e.$state===t)).map(e)}getLeft(t){const e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){const t=this.$refs.pop();if(t)return t;const e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(t,e,i,r,n){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[r]&&a[r],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(e,i){if(!s[e]){if(!t[e]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var n="function"==typeof a[r]&&a[r];if(!i&&n)return n(e,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(o)return o(e,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof e)return l(e);var d=Error("Cannot find module '"+e+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var r=t[e][1][i];return null!=r?r:i},p.cache={};var m=s[e]=new u.Module(e);t[e][0].call(m.exports,p,m,m.exports,this)}return s[e].exports;function p(t){var e=p.resolve(t);return!1===e?{}:u(e)}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=t,u.cache=s,u.parent=o,u.register=function(e,i){t[e]=[function(t,e){e.exports=i},{}]},Object.defineProperty(u,"root",{get:function(){return a[r]}}),a[r]=u;for(var d=0;d<e.length;d++)u(e[d]);if(i){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var m=u(i);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=m:"function"==typeof define&&define.amd?define(function(){return m}):n&&(this[n]=m)}}({bgm6t:[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i),r.export(i,"default",()=>d);var n=t("./danmuku"),a=r.interopDefault(n),o=t("./setting"),s=r.interopDefault(o),l=t("./heatmap"),u=r.interopDefault(l);function d(t){return e=>{!function(t){let{version:e,utils:{errorHandle:i}}=t.constructor,r=e.split(".").map(Number),n=r[0],a=r[1]/100;i(n+a>=5,`Artplayer.js@${e} \u{4E0D}\u{517C}\u{5BB9}\u{8BE5}\u{5F39}\u{5E55}\u{5E93}\u{FF0C}\u{8BF7}\u{66F4}\u{65B0}\u{5230} Artplayer.js@5.x.x \u{7248}\u{672C}\u{4EE5}\u{4E0A}`)}(e);let i=new a.default(e,t);return(0,s.default)(e,i),t.heatmap&&(0,u.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}d.env="production",d.version="5.0.1",d.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDanmuku=d)},{"./danmuku":"4ns48","./setting":"lO8OT","./heatmap":"8AxLD","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4ns48":[function(t,e,i){var r=t("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(i);var n=t("./bilibili"),a=t("./getDanmuTop"),o=r.interopDefault(a);class s{constructor(e,i){let{constructor:r,template:n}=e;if(this.utils=r.utils,this.validator=r.validator,this.$danmuku=n.$danmuku,this.$player=n.$player,this.art=e,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(i),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){//
|
||||
}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),e.on("video:play",this.start),e.on("video:playing",this.start),e.on("video:pause",this.stop),e.on("video:waiting",this.stop),e.on("resize",this.reset),e.on("destroy",this.destroy),this.load()}static get option(){return{danmuku:[],speed:5,margin:["2%","25%"],opacity:1,color:"#FFFFFF",mode:0,fontSize:25,filter:()=>!0,antiOverlap:!0,useWorker:!0,synchronousPlayback:!1,lockTime:5,maxLength:100,minWidth:200,maxWidth:400,mount:void 0,theme:"dark",heatmap:!1,points:[],beforeEmit:()=>!0}}static get scheme(){return{danmuku:"array|function|string",speed:"number",margin:"array",opacity:"number",color:"string",mode:"number",fontSize:"number|string",filter:"function",antiOverlap:"boolean",useWorker:"boolean",synchronousPlayback:"boolean",lockTime:"number",maxLength:"number",minWidth:"number",maxWidth:"number",mount:"undefined|htmldivelement",theme:"string",heatmap:"object|boolean",points:"array",beforeEmit:"function"}}get isRotate(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}get marginTop(){let{clamp:t}=this.utils,e=this.option.margin[0],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[0]}get marginBottom(){let{clamp:t}=this.utils,e=this.option.margin[1],{clientHeight:i}=this.$player;if("number"==typeof e)return t(e,0,i);if("string"==typeof e&&e.endsWith("%")){let r=parseFloat(e)/100;return t(i*r,0,i)}return s.option.margin[1]}filter(t,e){return this.queue.filter(e=>e.$state===t).map(e)}getLeft(t){let e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}getRef(){let t=this.$refs.pop();if(t)return t;let e=document.createElement("div");return e.style.cssText=`
|
||||
user-select: none;
|
||||
position: absolute;
|
||||
white-space: pre;
|
||||
pointer-events: none;
|
||||
perspective: 500px;
|
||||
display: inline-block;
|
||||
will-change: transform;
|
||||
font-weight: normal;
|
||||
line-height: 1.125;
|
||||
visibility: hidden;
|
||||
font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;
|
||||
text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;
|
||||
`,e}getReady(){let{currentTime:t}=this.art;return this.queue.filter(e=>"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1)}getEmits(){let t=[],{clientWidth:e}=this.$player,i=this.getLeft(this.$player);return this.filter("emit",r=>{let n=r.$ref.offsetTop,a=this.getLeft(r.$ref)-i,o=r.$ref.clientHeight,s=r.$ref.clientWidth,l=a+s,u=e-l,d=l/r.$restTime,m={};m.top=n,m.left=a,m.height=o,m.width=s,m.right=u,m.speed=d,m.distance=l,m.time=r.$restTime,m.mode=r.mode,t.push(m)}),t}getFontSize(t){let{clamp:e}=this.utils,{clientHeight:i}=this.$player;if("number"==typeof t)return e(t,12,i);if("string"==typeof t&&t.endsWith("%")){let r=parseFloat(t)/100;return e(i*r,12,i)}return s.option.fontSize}postMessage(t={}){return new Promise(e=>{if(this.option.useWorker&&this.worker&&this.worker.postMessage)t.id=Date.now(),this.worker.postMessage(t),this.worker.onmessage=i=>{let{data:r}=i;r.id===t.id&&e(r)};else{let i=(0,o.default)(t);e({top:i})}})}async load(){try{"function"==typeof this.option.danmuku?this.danmus=await this.option.danmuku():"function"==typeof this.option.danmuku.then?this.danmus=await this.option.danmuku:"string"==typeof this.option.danmuku?this.danmus=await (0,n.bilibiliDanmuParseFromUrl)(this.option.danmuku):this.danmus=this.option.danmuku,this.utils.errorHandle(Array.isArray(this.danmus),"Danmuku need return an array as result"),this.art.emit("artplayerPluginDanmuku:loaded",this.danmus),this.queue=[],this.$danmuku.innerText="",this.danmus.forEach(t=>this.emit(t))}catch(t){throw this.art.emit("artplayerPluginDanmuku:error",t),t}return this}config(t){let{clamp:e}=this.utils;return this.option=Object.assign({},s.option,this.option,t),this.validator(this.option,s.scheme),this.option.speed=e(this.option.speed,1,10),this.option.opacity=e(this.option.opacity,0,1),this.option.lockTime=e(Math.floor(this.option.lockTime),0,60),this.option.maxLength=e(this.option.maxLength,0,500),this.option.minWidth=e(this.option.minWidth,0,500),this.option.maxWidth=e(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}makeWait(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}continue(){let{clientWidth:t}=this.$player;return this.filter("stop",e=>{if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){let i=t+e.$ref.clientWidth;e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition=`transform ${e.$restTime}s linear 0s`}}),this}suspend(){let{clientWidth:t}=this.$player;return this.filter("emit",e=>{if(e.$state="stop",0===e.mode){let i=t-(this.getLeft(e.$ref)-this.getLeft(this.$player));e.$ref.style.transform=`translateX(${-i}px)`,e.$ref.style.transition="transform 0s linear 0s"}}),this}reset(){return this.queue.forEach(t=>this.makeWait(t)),this}update(){return this.timer=window.requestAnimationFrame(async()=>{if(this.art.playing&&!this.isHide){this.filter("emit",t=>{let e=(Date.now()-t.$lastStartTime)/1e3;t.$restTime-=e,t.$lastStartTime=Date.now(),t.$restTime<=0&&this.makeWait(t)});let t=this.getReady(),{clientWidth:e,clientHeight:i}=this.$player;for(let r=0;r<t.length;r++){let n=t[r];n.$ref=this.getRef(),n.$ref.innerText=n.text,this.$danmuku.appendChild(n.$ref),n.$ref.style.left=`${e}px`,n.$ref.style.opacity=this.option.opacity,n.$ref.style.fontSize=`${this.option.fontSize}px`,n.$ref.style.color=n.color,n.$ref.style.border=n.border?`1px solid ${n.color}`:null,n.$ref.style.backgroundColor=n.border?"rgb(0 0 0 / 50%)":null,n.$ref.style.marginLeft="0px",n.$lastStartTime=Date.now(),n.$restTime=this.option.synchronousPlayback&&this.art.playbackRate?this.option.speed/Number(this.art.playbackRate):this.option.speed;let a={mode:n.mode,height:n.$ref.clientHeight,speed:(e+n.$ref.clientWidth)/n.$restTime},{top:o}=await this.postMessage({target:a,emits:this.getEmits(),antiOverlap:this.option.antiOverlap,clientWidth:e,clientHeight:i,marginBottom:this.marginBottom,marginTop:this.marginTop});if(n.$ref){if(this.isStop||void 0===o)n.$state="ready",this.$refs.push(n.$ref),n.$ref=null;else switch(n.$state="emit",n.$ref.style.visibility="visible",n.mode){case 0:{n.$ref.style.top=`${o}px`;let t=e+n.$ref.clientWidth;n.$ref.style.transform=`translateX(${-t}px)`,n.$ref.style.transition=`transform ${n.$restTime}s linear 0s`;break}case 1:n.$ref.style.left="50%",n.$ref.style.top=`${o}px`,n.$ref.style.marginLeft=`-${n.$ref.clientWidth/2}px`}}}}this.isStop||this.update()}),this}stop(){return this.isStop=!0,this.suspend(),window.cancelAnimationFrame(this.timer),this.art.emit("artplayerPluginDanmuku:stop"),this}start(){return this.isStop=!1,this.continue(),this.update(),this.art.emit("artplayerPluginDanmuku:start"),this}show(){return this.isHide=!1,this.start(),this.$danmuku.style.display="block",this.art.emit("artplayerPluginDanmuku:sho
Line truncated
|
||||
<div class="art-danmuku-emitter" style="max-width: ${i.maxWidth?`${i.maxWidth}px`:"100%"}">
|
||||
<div class="art-danmuku-left">
|
||||
<div class="art-danmuku-style">
|
||||
<div class="art-danmuku-style-panel">
|
||||
<div class="art-danmuku-style-panel-inner">
|
||||
<div class="art-danmuku-style-panel-title">u{6A21}\u{5F0F}</div>
|
||||
<div class="art-danmuku-style-panel-modes">
|
||||
<div class="art-danmuku-style-panel-mode art-current" data-mode="0">u{6EDA}\u{52A8}</div>
|
||||
<div class="art-danmuku-style-panel-mode" data-mode="1">u{9759}\u{6B62}</div>
|
||||
</div>
|
||||
<div class="art-danmuku-style-panel-title">u{989C}\u{8272}</div>
|
||||
<div class="art-danmuku-style-panel-colors">
|
||||
${a.join("")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input class="art-danmuku-input" maxlength="${i.maxLength}" placeholder="\u{53D1}\u{4E2A}\u{5F39}\u{5E55}\u{89C1}\u{8BC1}\u{5F53}\u{4E0B}" />
|
||||
</div>
|
||||
<div class="art-danmuku-send">u{53D1}\u{9001}</div>
|
||||
</div>
|
||||
`),u=c(".art-danmuku-style",s),m=c(".art-danmuku-input",s),h=c(".art-danmuku-send",s),f=c(".art-danmuku-style-panel-inner",s),y=c(".art-danmuku-style-panel-modes",s),k=c(".art-danmuku-style-panel-colors",s),x=i.mount||d(n,'<div class="art-layer-danmuku-emitter"></div>');t.option.backdrop&&l(f,"art-backdrop-filter"),i.theme&&l(s,`art-danmuku-theme-${i.theme}`);let v=null,w=i.mode,$=i.color;function D(){let r={mode:w,color:$,border:!0,text:m.value.trim()};null===v&&i.beforeEmit(r)&&(m.value="",e.emit(r),l(h,"art-disabled"),function t(e){e<=0?(v=null,h.innerText="发送",o(h,"art-disabled")):(h.innerText=e,v=setTimeout(()=>t(e-1),1e3))}(i.lockTime),t.emit("artplayerPluginDanmuku:emit",r))}function B(){r.clientWidth<i.minWidth?(d(x,s),p(x,"display","flex"),l(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom","40px")):(d(r,s),p(x,"display","none"),o(s,"art-danmuku-mount"),i.mount||p(n,"marginBottom",null))}d(u,b),t.proxy(h,"click",D),t.proxy(m,"keypress",t=>{"Enter"===t.key&&(t.preventDefault(),D())}),t.proxy(y,"click",t=>{let{dataset:e}=t.target;e.mode&&(w=Number(e.mode),g(t.target,"art-current"))}),t.proxy(k,"click",t=>{let{dataset:e}=t.target;e.color&&($=e.color,g(t.target,"art-current"))}),B(),t.on("resize",()=>{t.isInput||B()}),t.on("destroy",()=>{i.mount&&s.parentElement===i.mount&&i.mount.removeChild(s)})}(),t.controls.add({position:"right",name:"danmuku",click:function(){e.isHide?(e.show(),t.notice.show="弹幕显示",p(k,"display",null),p(x,"display","none")):(e.hide(),t.notice.show="弹幕隐藏",p(k,"display","none"),p(x,"display",null))},mounted(e){d(e,k),d(e,x),f(e,"弹幕开关"),p(x,"display","none"),t.on("artplayerPluginDanmuku:hide",()=>{p(k,"display","none"),p(x,"display",null)}),t.on("artplayerPluginDanmuku:show",()=>{p(k,"display",null),p(x,"display","none")})}}),t.setting.add({width:260,name:"danmuku",html:"弹幕设置",tooltip:"更多",icon:v,selector:[{width:a,html:"播放速度",icon:"",tooltip:"适中",selector:[{html:"极慢",time:10},{html:"较慢",time:7.5},{default:!0,html:"适中",time:5},{html:"较快",time:2.5},{html:"极快",time:1}],onSelect:function(t){return e.config({speed:t.time}),t.html}},{width:a,html:"字体大小",icon:"",tooltip:"适中",selector:[{html:"极小",fontSize:"4%"},{html:"较小",fontSize:"5%"},{default:!0,html:"适中",fontSize:"6%"},{html:"较大",fontSize:"7%"},{html:"极大",fontSize:"8%"}],onSelect:function(t){return e.config({fontSize:t.fontSize}),t.html}},{width:a,html:"不透明度",icon:"",tooltip:"100%",selector:[{default:!0,opacity:1,html:"100%"},{opacity:.75,html:"75%"},{opacity:.5,html:"50%"},{opacity:.25,html:"25%"},{opacity:0,html:"0%"}],onSelect:function(t){return e.config({opacity:t.opacity}),t.html}},{width:a,html:"显示范围",icon:"",tooltip:"3/4",selector:[{html:"1/4",margin:[10,"75%"]},{html:"半屏",margin:[10,"50%"]},{default:!0,html:"3/4",margin:[10,"25%"]},{html:"满屏",margin:[10,10]}],onSelect:function(t){return e.config({margin:t.margin}),t.html}},{html:"弹幕防重叠",icon:"",tooltip:i.antiOverlap?"开启":"关闭",switch:i.antiOverlap,onSwitch:t=>(e.config({antiOverlap:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)},{html:"同步视频速度",icon:"",tooltip:i.synchronousPlayback?"开启":"关闭",switch:i.synchronousPlayback,onSwitch:t=>(e.config({synchronousPlayback:!t.switch}),t.tooltip=t.switch?"关闭":"开启",!t.switch)}]})}if("undefined"!=typeof document&&!document.getElementById("artplayer-plugin-danmuku")){let t=document.createElement("style");t.id="artplayer-plugin-danmuku",t.textContent=a.default,document.head.appendChild(t)}},{"bundle-text:./style.less":"hViDo","bundle-text:./img/danmu-on.svg":"4KfW9","bundle-text:./img/danmu-off.svg":"9UR3U","bundle-text:./img/danmu-config.svg":"4MPCW","bundle-text:./img/danmu-style.svg":"7lV5Q","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],hViDo:[function(t,e,i){e.exports='.art-danmuku-emitter{background-color:#ffffff4d;border-radius:5px;width:100%;max-width:100%;height:32px;font-size:12px;line-height:1;display:flex;position:relative}.art-danmuku-emitter .art-backdrop-filter{backdrop-filter:saturate(180%)blur(20px);background-color:#000000b3!important}.art-danmuku-emitter .art-danmuku-left{border-radius:3px 0 0 3px;flex:1;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style{justify-content:center;align-items:center;width:32px;display:flex;position:relative}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel{z-index:999;width:200px;padding-bottom:10px;display:none;position:absolute;bottom:30px;left:-85px}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner{background-color:#000000e6;border-radius:3px;flex-direction:column;padding:10px 10px 0;display:flex}.art-danmuku-emitter .art-danmuku-left .art-danmuku-style .art-danmuku-style-panel .art-danmuku-style-panel-inner .art-danmuku-style-panel-title{margin-bottom:10px;font-size:13px
Line truncated
|
||||
<svg viewBox="0 0 ${d.w} ${d.h}">
|
||||
<defs>
|
||||
<linearGradient id="heatmap-solids" x1="0%" y1="0%" x2="100%" y2="0%">
|
||||
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" />
|
||||
<stop offset="0%" style="stop-color:var(--art-theme);stop-opacity:${m.opacity}" id="heatmap-start" />
|
||||
<stop offset="0%" style="stop-color:var(--art-progress-color);stop-opacity:1" id="heatmap-stop" />
|
||||
<stop offset="100%" style="stop-color:var(--art-progress-color);stop-opacity:1" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<path fill="url(#heatmap-solids)" d="${b}"></path>
|
||||
</svg>
|
||||
`,s=r("#heatmap-start",o),l=r("#heatmap-stop",o),s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`)}t.on("video:timeupdate",()=>{s&&l&&(s.setAttribute("offset",`${100*t.played}%`),l.setAttribute("offset",`${100*t.played}%`))}),t.on("setBar",(t,e)=>{s&&l&&"played"===t&&(s.setAttribute("offset",`${100*e}%`),l.setAttribute("offset",`${100*e}%`))}),t.on("ready",()=>u()),t.on("resize",()=>u()),t.on("artplayerPluginDanmuku:loaded",()=>u()),t.on("artplayerPluginDanmuku:points",t=>u(t))}})}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}]},["bgm6t"],"bgm6t","parcelRequire4dc0");
|
||||
@@ -4,4 +4,36 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(t,e,r,n,a){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],s=i.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!s[e]){if(!t[e]){var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!0);if(i)return i(e,!0);if(u&&"string"==typeof e)return u(e);var c=new Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=s[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return s[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=s,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c<e.length;c++)l(e[c]);if(r){var p=l(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd&&define((function(){return p}))}}({"40mNk":[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var a=t("./danmuku"),o=n.interopDefault(a),i=t("./setting"),s=n.interopDefault(i),u=t("./heatmap"),l=n.interopDefault(u);function c(t){return function(e){!function(t){var e=t.constructor,r=e.version,n=e.utils.errorHandle,a=r.split(".").map(Number);n(a[0]+a[1]/100>=5,"Artplayer.js@".concat(r," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"))}(e);var r=new(0,o.default)(e,t);return(0,s.default)(e,r),t.heatmap&&(0,l.default)(e,r,t.heatmap),{name:"artplayerPluginDanmuku",emit:r.emit.bind(r),load:r.load.bind(r),config:r.config.bind(r),hide:r.hide.bind(r),show:r.show.bind(r),reset:r.reset.bind(r),get option(){return r.option},get isHide(){return r.isHide},get isStop(){return r.isStop}}}}r.default=c,c.env="production",c.version="5.0.1",c.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return b}));var a=t("@swc/helpers/src/_async_to_generator.mjs"),o=n.interopDefault(a),i=t("@swc/helpers/src/_class_call_check.mjs"),s=n.interopDefault(i),u=t("@swc/helpers/src/_create_class.mjs"),l=n.interopDefault(u),c=t("@swc/helpers/src/_object_spread.mjs"),p=n.interopDefault(c),f=t("@swc/helpers/src/_object_spread_props.mjs"),d=n.interopDefault(f),m=t("@swc/helpers/src/_ts_generator.mjs"),h=n.interopDefault(m),y=t("./bilibili"),g=t("./getDanmuTop"),v=n.interopDefault(g),b=function(){"use strict";function e(r,n){(0,s.default)(this,e);var a=r.constructor,o=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=o.$danmuku,this.$player=o.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("85d40535eae5f839"))}catch(t){}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,l.default)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter((function(e){return e.$state===t})).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shaLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(t,e,r,n,a){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function l(e,r){if(!u[e]){if(!t[e]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var a="function"==typeof o[n]&&o[n];if(!r&&a)return a(e,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(e,!0);// Try the node require function if it exists.
|
||||
if(s&&"string"==typeof e)return s(e);var c=Error("Cannot find module '"+e+"'");throw c.code="MODULE_NOT_FOUND",c}f.resolve=function(r){var n=t[e][1][r];return null!=n?n:r},f.cache={};var p=u[e]=new l.Module(e);t[e][0].call(p.exports,f,p,p.exports,this)}return u[e].exports;function f(t){var e=f.resolve(t);return!1===e?{}:l(e)}}l.isParcelRequire=!0,l.Module=function(t){this.id=t,this.bundle=l,this.exports={}},l.modules=t,l.cache=u,l.parent=i,l.register=function(e,r){t[e]=[function(t,e){e.exports=r},{}]},Object.defineProperty(l,"root",{get:function(){return o[n]}}),o[n]=l;for(var c=0;c<e.length;c++)l(e[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var p=l(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=p:"function"==typeof define&&define.amd?define(function(){return p}):a&&(this[a]=p)}}({"40mNk":[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return c});var a=t("./danmuku"),o=n.interopDefault(a),i=t("./setting"),u=n.interopDefault(i),s=t("./heatmap"),l=n.interopDefault(s);function c(t){return function(e){n=(r=e.constructor).version,(0,r.utils.errorHandle)((a=n.split(".").map(Number))[0]+a[1]/100>=5,"Artplayer.js@".concat(n," 不兼容该弹幕库,请更新到 Artplayer.js@5.x.x 版本以上"));var r,n,a,i=new o.default(e,t);return(0,u.default)(e,i),t.heatmap&&(0,l.default)(e,i,t.heatmap),{name:"artplayerPluginDanmuku",emit:i.emit.bind(i),load:i.load.bind(i),config:i.config.bind(i),hide:i.hide.bind(i),show:i.show.bind(i),reset:i.reset.bind(i),get option(){return i.option},get isHide(){return i.isHide},get isStop(){return i.isStop}}}}c.env="production",c.version="5.0.1",c.build="2023-11-23 23:22:00","undefined"!=typeof window&&(window.artplayerPluginDanmuku=c)},{"./danmuku":"jgffw","./setting":"d3V7t","./heatmap":"dXFn2","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jgffw:[function(t,e,r){var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return d});var a=t("@swc/helpers/_/_async_to_generator"),o=t("@swc/helpers/_/_class_call_check"),i=t("@swc/helpers/_/_create_class"),u=t("@swc/helpers/_/_object_spread"),s=t("@swc/helpers/_/_object_spread_props"),l=t("@swc/helpers/_/_ts_generator"),c=t("./bilibili"),p=t("./getDanmuTop"),f=n.interopDefault(p),d=/*#__PURE__*/function(){function e(r,n){(0,o._)(this,e);var a=r.constructor,i=r.template;if(this.utils=a.utils,this.validator=a.validator,this.$danmuku=i.$danmuku,this.$player=i.$player,this.art=r,this.danmus=[],this.queue=[],this.option={},this.$refs=[],this.isStop=!1,this.isHide=!1,this.timer=null,this.config(n),this.option.useWorker)try{this.worker=new Worker(t("e55e9b30c441298a"))}catch(t){//
|
||||
}this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.reset=this.reset.bind(this),this.destroy=this.destroy.bind(this),r.on("video:play",this.start),r.on("video:playing",this.start),r.on("video:pause",this.stop),r.on("video:waiting",this.stop),r.on("resize",this.reset),r.on("destroy",this.destroy),this.load()}return(0,i._)(e,[{key:"isRotate",get:function(){return this.art.plugins.autoOrientation&&this.art.plugins.autoOrientation.state}},{key:"marginTop",get:function(){var t=this.utils.clamp,r=this.option.margin[0],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[0]}},{key:"marginBottom",get:function(){var t=this.utils.clamp,r=this.option.margin[1],n=this.$player.clientHeight;return"number"==typeof r?t(r,0,n):"string"==typeof r&&r.endsWith("%")?t(n*(parseFloat(r)/100),0,n):e.option.margin[1]}},{key:"filter",value:function(t,e){return this.queue.filter(function(e){return e.$state===t}).map(e)}},{key:"getLeft",value:function(t){var e=t.getBoundingClientRect();return this.isRotate?e.top:e.left}},{key:"getRef",value:function(){var t=this.$refs.pop();if(t)return t;var e=document.createElement("div");return e.style.cssText='\n user-select: none;\n position: absolute;\n white-space: pre;\n pointer-events: none;\n perspective: 500px;\n display: inline-block;\n will-change: transform;\n font-weight: normal;\n line-height: 1.125;\n visibility: hidden;\n font-family: SimHei, "Microsoft JhengHei", Arial, Helvetica, sans-serif;\n text-shadow: rgb(0, 0, 0) 1px 0px 1px, rgb(0, 0, 0) 0px 1px 1px, rgb(0, 0, 0) 0px -1px 1px, rgb(0, 0, 0) -1px 0px 1px;\n ',e}},{key:"getReady",value:function(){var t=this.art.currentTime;return this.queue.filter(function(e){return"ready"===e.$state||"wait"===e.$state&&t+.1>=e.time&&e.time>=t-.1})}},{key:"getEmits",value:function(){var t=this,e=[],r=this.$player.clientWidth,n=this.getLeft(this.$player);return this.filter("emit",function(a){var o=a.$ref.offsetTop,i=t.getLeft(a.$ref)-n,u=a.$ref.clientHeight,s=a.$ref.clientWidth,l=i+s,c=r-l,p=l/a.$restTime,f={};f.top=o,f.left=i,f.height=u,f.width=s,f.right=c,f.speed=p,f.distance=l,f.time=a.$restTime,f.mode=a.mode,e.push(f)}),e}},{key:"getFontSize",value:function(t){var r=this.utils.clamp,n=this.$player.clientHeight;return"number"==typeof t?r(t,12,n):"string"==typeof t&&t.endsWith("%")?r(n*(parseFloat(t)/100),12,n):e.option.fontSize}},{key:"postMessage",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=this;return new Promise(function(r){e.option.useWorker&&e.worker&&e.worker.postMessage?(t.id=Date.now(),e.worker.postMessage(t),e.worker.onmessage=function(e){var n=e.data;n.id===t.id&&r(n)}):r({top:(0,f.default)(t)})})}},{key:"load",value:function(){var t=this;return(0,a._)(function(){var e;return(0,l._)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,8,,9]),"function"!=typeof t.option.danmuku)return[3,2];return[4,t.option.danmuku()];case 1:case 3:case 5:return t.danmus=r.sent(),[3,7];case 2:if("function"!=typeof t.option.danmuku.then)return[3,4];return[4,t.option.danmuku];case 4:if("string"!=typeof t.option.danmuku)return[3,6];return[4,(0,c.bilibiliDanmuParseFromUrl)(t.option.danmuku)];case 6:t.danmus=t.option.danmuku,r.label=7;case 7:return t.utils.errorHandle(Array.isArray(t.danmus),"Danmuku need return an array as result"),t.art.emit("artplayerPluginDanmuku:loaded",t.danmus),t.queue=[],t.$danmuku.innerText="",t.danmus.forEach(function(e){return t.emit(e)}),[3,9];case 8:throw e=r.sent(),t.art.emit("artplayerPluginDanmuku:error",e),e;case 9:return[2,t]}})})()}},{key:"config",value:function(t){var r=this.utils.clamp;return this.option=Object.assign({},e.option,this.option,t),this.validator(this.option,e.scheme),this.option.speed=r(this.option.speed,1,10),this.option.opacity=r(this.option.opacity,0,1),this.option.lockTime=r(Math.floor(this.option.lockTime),0,60),this.option.maxLength=r(this.option.maxLength,0,500),this.option.minWidth=r(this.option.minWidth,0,500),this.option.maxWidth=r(this.option.maxWidth,0,1/0),t.fontSize&&(this.option.fontSize=this.getFontSize(this.option.fontSize),this.reset()),this.art.emit("artplayerPluginDanmuku:config",this.option),this}},{key:"makeWait",value:function(t){t.$state="wait",t.$ref&&(t.$ref.style.visibility="hidden",t.$ref.style.marginLeft="0px",t.$ref.style.transform="translateX(0px)",t.$ref.style.transition="transform 0s linear 0s",this.$refs.push(t.$ref),t.$ref=null)}},{key:"continue",value:function(){var t=this.$player.clientWidth;return this.filter("stop",function(e){if(e.$state="emit",e.$lastStartTime=Date.now(),0===e.mode){var r=t+e.$ref.clientWidth;e.$ref.style.transform="translateX(".concat(-r,"px)"),e.$ref.style.transition="transform ".concat(e.$restTime,"s linear 0s")}}),this}},{key:"suspend",value:function(){var tLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=t("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return i}),n.export(r,"__assign",function(){return u}),n.export(r,"__rest",function(){return s}),n.export(r,"__decorate",function(){return l}),n.export(r,"__param",function(){return c}),n.export(r,"__esDecorate",function(){return p}),n.export(r,"__runInitializers",function(){return f}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return m}),n.export(r,"__metadata",function(){return h}),n.export(r,"__awaiter",function(){return y}),n.export(r,"__generator",function(){return g}),n.export(r,"__createBinding",function(){return v}),n.export(r,"__exportStar",function(){return _}),n.export(r,"__values",function(){return b}),n.export(r,"__read",function(){return k}),/** @deprecated */n.export(r,"__spread",function(){return x}),/** @deprecated */n.export(r,"__spreadArrays",function(){return w}),n.export(r,"__spreadArray",function(){return D}),n.export(r,"__await",function(){return j}),n.export(r,"__asyncGenerator",function(){return S}),n.export(r,"__asyncDelegator",function(){return C}),n.export(r,"__asyncValues",function(){return O}),n.export(r,"__makeTemplateObject",function(){return B}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return A}),n.export(r,"__classPrivateFieldGet",function(){return P}),n.export(r,"__classPrivateFieldSet",function(){return M}),n.export(r,"__classPrivateFieldIn",function(){return T}),n.export(r,"__addDisposableResource",function(){return W}),n.export(r,"__disposeResources",function(){return H});var a=t("@swc/helpers/_/_type_of"),o=function(t,e){return(o=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function i(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var u=function(){return(u=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};function s(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&0>e.indexOf(n)&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols)for(var a=0,n=Object.getOwnPropertySymbols(t);a<n.length;a++)0>e.indexOf(n[a])&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]]);return r}function l(t,e,r,n){var a,o=arguments.length,i=o<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(t,e,r,n);else for(var u=t.length-1;u>=0;u--)(a=t[u])&&(i=(o<3?a(i):o>3?a(e,r,i):a(e,r))||i);return o>3&&i&&Object.defineProperty(e,r,i),i}function c(t,e){return function(r,n){e(r,n,t)}}function p(t,e,r,n,a,o){function i(t){if(void 0!==t&&"function"!=typeof t)throw TypeError("Function expected");return t}for(var u,s=n.kind,l="getter"===s?"get":"setter"===s?"set":"value",c=!e&&t?n.static?t:t.prototype:null,p=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),f=!1,d=r.length-1;d>=0;d--){var m={};for(var h in n)m[h]="access"===h?{}:n[h];for(var h in n.access)m.access[h]=n.access[h];m.addInitializer=function(t){if(f)throw TypeError("Cannot add initializers after decoration has completed");o.push(i(t||null))};var y=(0,r[d])("accessor"===s?{get:p.get,set:p.set}:p[l],m);if("accessor"===s){if(void 0===y)continue;if(null===y||"object"!=typeof y)throw TypeError("Object expected");(u=i(y.get))&&(p.get=u),(u=i(y.set))&&(p.set=u),(u=i(y.init))&&a.unshift(u)}else(u=i(y))&&("field"===s?a.unshift(u):p[l]=u)}c&&Object.defineProperty(c,n.name,p),f=!0}function f(t,e,r){for(var n=arguments.length>2,a=0;a<e.length;a++)r=n?e[a].call(t,r):e[a].call(t);return n?r:void 0}function d(t){return(void 0===t?"undefined":(0,a._)(t))==="symbol"?t:"".concat(t)}function m(t,e,r){return(void 0===e?"undefined":(0,a._)(e))==="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(t,"name",{configurable:!0,value:r?"".concat(r," ",e):e})}function h(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}function y(t,e,r,n){return new(r||(r=Promise))(function(a,o){function i(t){try{s(n.next(t))}catch(t){o(t)}}function u(t){try{s(n.throw(t))}catch(t){o(t)}}function s(t){var e;t.done?a(t.value):((e=t.value)instanceof r?e:new r(function(t){t(e)})).then(i,u)}s((n=n.apply(t,e||[])).next())})}function g(t,e){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Sym
Line truncated
|
||||
+19
-1
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],u=a.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);if(a)return a(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=u[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return u[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=u,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({"92dvd":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');const a=e.auto||"Auto",u=e.title||"Quality",l=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=l[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:u,icon:i.default,width:200,selector:l.map(((e,t)=>({html:s(e),level:t,default:c===e}))),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}n.default=a,a.env="production",a.version="2.0.0",a.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[o]&&i[o],l=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=a,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=d(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):r&&(this[r]=f)}}({"92dvd":[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>a);var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function a(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],i=o[1]/100;n(r+i>=5,`Artplayer.js@${t} is not compatible the artplayerPluginDashQuality@${a.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.dash||window.dash;o(r&&r.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');let a=e.auto||"Auto",l=e.title||"Quality",u=r.getBitrateInfoListFor("video"),d=r.getQualityFor("video"),s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.getSettings(),c=u[d],p=f?.streaming?.abr?.autoSwitchBitrate?.video?a:s(c),h={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:p,style:{padding:"0 10px"},selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:e=>(h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html)}),e.setting&&t.setting.update({name:"dash-quality",tooltip:p,html:l,icon:i.default,width:200,selector:u.map((e,t)=>({html:s(e),level:t,default:c===e})),onSelect:function(e){return h.streaming.abr.autoSwitchBitrate.video=!1,r.updateSettings(h),r.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginDashQuality"}}}a.env="production",a.version="2.0.0",a.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginDashQuality=a)},{"bundle-text:./image.svg":"kcayM","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],kcayM:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["92dvd"],"92dvd","parcelRequire4dc0");
|
||||
+19
-1
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[r]&&i[r],a=u.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!a[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(u)return u(t,!0);if(l&&"string"==typeof t)return l(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},c.cache={};var f=a[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[r]}}),i[r]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){var f=d(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({gZVrQ:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),i=r.interopDefault(o);function u(e){return function(t){!function(e){var t=e.constructor,n=t.version,r=t.utils.errorHandle,o=n.split(".").map(Number);r(o[0]+o[1]/100>=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o,u,a,l=t.dash||window.dash;r(l&&l.getVideoElement()===n,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=l.getBitrateInfoListFor("video"),c=l.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=l.getSettings(),g=f[c],v=(null==h||null===(o=h.streaming)||void 0===o||null===(u=o.abr)||void 0===u||null===(a=u.autoSwitchBitrate)||void 0===a?void 0:a.video)?d:p(g),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:v,style:{padding:"0 10px"},selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:v,html:s,icon:i.default,width:200,selector:f.map((function(e,t){return{html:p(e),level:t,default:g===e}})),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,l.updateSettings(m),l.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginDashQuality"}}}n.default=u,u.env="production",u.version="2.0.0",u.build="2023-08-26 16:47:25","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[o]&&i[o],l=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,n){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof i[o]&&i[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(u)return u(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}c.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},c.cache={};var f=l[t]=new d.Module(t);e[t][0].call(f.exports,c,f,f.exports,this)}return l[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=l,d.parent=u,d.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(d,"root",{get:function(){return i[o]}}),i[o]=d;for(var s=0;s<t.length;s++)d(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=d(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):r&&(this[r]=f)}}({gZVrQ:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",function(){return u});var r=e("bundle-text:./image.svg"),i=o.interopDefault(r);function u(e){return function(t){o=(n=t.constructor).version,(0,n.utils.errorHandle)((r=o.split(".").map(Number))[0]+r[1]/100>=5,"Artplayer.js@".concat(o," is not compatible the artplayerPluginDashQuality@").concat(u.version,". Please update it to version Artplayer.js@5.x.x"));var n,o,r,l=t.template.$video,a=t.constructor.utils.errorHandle;function d(){var n,o,r,u=t.dash||window.dash;a(u&&u.getVideoElement()===l,'Cannot find instance of Dash from "art.dash" or "window.dash"');var d=e.auto||"Auto",s=e.title||"Quality",f=u.getBitrateInfoListFor("video"),c=u.getQualityFor("video"),p=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},h=u.getSettings(),v=f[c],g=(null==h?void 0:null===(r=h.streaming)||void 0===r?void 0:null===(o=r.abr)||void 0===o?void 0:null===(n=o.autoSwitchBitrate)||void 0===n?void 0:n.video)?d:p(v),m={streaming:{abr:{autoSwitchBitrate:{}}}};e.control&&t.controls.update({name:"dash-quality",position:"right",html:g,style:{padding:"0 10px"},selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}}),e.setting&&t.setting.update({name:"dash-quality",tooltip:g,html:s,icon:i.default,width:200,selector:f.map(function(e,t){return{html:p(e),level:t,default:v===e}}),onSelect:function(e){return m.streaming.abr.autoSwitchBitrate.video=!1,u.updateSettings(m),u.setQualityFor("video",e.level,!0),e.html}})}return t.on("ready",d),t.on("restart",d),{name:"artplayerPluginDashQuality"}}}u.env="production",u.version="2.0.0",u.build="2023-11-23 23:21:59","undefined"!=typeof window&&(window.artplayerPluginDashQuality=u)},{"bundle-text:./image.svg":"gI7Xh","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gI7Xh:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["gZVrQ"],"gZVrQ","parcelRequire4dc0");
|
||||
+19
-1
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,o,r){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[t]){if(!e[t]){var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);if(i)return i(t,!0);if(s&&"string"==typeof t)return s(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new a.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=i,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return l[o]}}),l[o]=a;for(var f=0;f<t.length;f++)a(t[f]);if(n){var c=a(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{!function(e){const{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number);n(o[0]+o[1]/100>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);const{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){const r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');const i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),a=r.levels[r.currentLevel],f=a?s(a):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:f,style:{padding:"0 10px"},selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:f,html:u,icon:l.default,width:200,selector:r.levels.map(((e,t)=>({html:s(e),level:e.level||t,default:a===e}))),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,o,r){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[o]&&l[o],u=i.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof l[o]&&l[o];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(s&&"string"==typeof t)return s(t);var a=Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var o=e[t][1][n];return null!=o?o:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[o]}}),l[o]=f;for(var a=0;a<t.length;a++)f(t[a]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=f(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):r&&(this[r]=c)}}({eEHR6:[function(e,t,n){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(n),o.export(n,"default",()=>i);var r=e("bundle-text:./image.svg"),l=o.interopDefault(r);function i(e){return t=>{!function(e){let{version:t,utils:{errorHandle:n}}=e.constructor,o=t.split(".").map(Number),r=o[0],l=o[1]/100;n(r+l>=5,`Artplayer.js@${t} is not compatible the artplayerPluginHlsQuality@${i.version}. Please update it to version Artplayer.js@5.x.x`)}(t);let{$video:n}=t.template,{errorHandle:o}=t.constructor.utils;function r(){let r=t.hls||window.hls;o(r&&r.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');let i=e.auto||"Auto",u=e.title||"Quality",s=e.getResolution||(e=>(e.height||"Unknown ")+"P"),f=r.levels[r.currentLevel],a=f?s(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:a,style:{padding:"0 10px"},selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:e=>(r.currentLevel=e.level,t.loading.show=!0,e.html)}),e.setting&&t.setting.update({name:"hls-quality",tooltip:a,html:u,icon:l.default,width:200,selector:r.levels.map((e,t)=>({html:s(e),level:e.level||t,default:f===e})),onSelect:function(e){return r.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",r),t.on("restart",r),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"5VXix","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"5VXix":[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["eEHR6"],"eEHR6","parcelRequire4dc0");
|
||||
+19
-1
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof l[r]&&l[r];if(!n&&o)return o(t,!0);if(i)return i(t,!0);if(a&&"string"==typeof t)return a(t);var s=new Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s<t.length;s++)f(t[s]);if(n){var c=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({"34JKw":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){!function(e){var t=e.constructor,n=t.version,r=t.utils.errorHandle,o=n.split(".").map(Number);r(o[0]+o[1]/100>=5,"Artplayer.js@".concat(n," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"))}(t);var n=t.template.$video,r=t.constructor.utils.errorHandle;function o(){var o=t.hls||window.hls;r(o&&o.media===n,'Cannot find instance of HLS from "art.hls" or "window.hls"');var i=e.auto||"Auto",u=e.title||"Quality",a=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=o.levels[o.currentLevel],s=f?a(f):i;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:u,icon:l.default,width:200,selector:o.levels.map((function(e,t){return{html:a(e),level:e.level||t,default:f===e}})),onSelect:function(e){return o.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",o),t.on("restart",o),{name:"artplayerPluginHlsQuality"}}}n.default=i,i.env="production",i.version="2.0.0",i.build="2023-08-26 16:47:24","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,r,o){/* eslint-disable no-undef */var l="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof l[r]&&l[r],u=i.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof l[r]&&l[r];if(!n&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return l[r]}}),l[r]=f;for(var s=0;s<t.length;s++)f(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=f(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):o&&(this[o]=c)}}({"34JKw":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",function(){return i});var o=e("bundle-text:./image.svg"),l=r.interopDefault(o);function i(e){return function(t){r=(n=t.constructor).version,(0,n.utils.errorHandle)((o=r.split(".").map(Number))[0]+o[1]/100>=5,"Artplayer.js@".concat(r," is not compatible the artplayerPluginHlsQuality@").concat(i.version,". Please update it to version Artplayer.js@5.x.x"));var n,r,o,u=t.template.$video,a=t.constructor.utils.errorHandle;function f(){var n=t.hls||window.hls;a(n&&n.media===u,'Cannot find instance of HLS from "art.hls" or "window.hls"');var r=e.auto||"Auto",o=e.title||"Quality",i=e.getResolution||function(e){return(e.height||"Unknown ")+"P"},f=n.levels[n.currentLevel],s=f?i(f):r;e.control&&t.controls.update({name:"hls-quality",position:"right",html:s,style:{padding:"0 10px"},selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}}),e.setting&&t.setting.update({name:"hls-quality",tooltip:s,html:o,icon:l.default,width:200,selector:n.levels.map(function(e,t){return{html:i(e),level:e.level||t,default:f===e}}),onSelect:function(e){return n.currentLevel=e.level,t.loading.show=!0,e.html}})}return t.on("ready",f),t.on("restart",f),{name:"artplayerPluginHlsQuality"}}}i.env="production",i.version="2.0.0",i.build="2023-11-23 23:21:58","undefined"!=typeof window&&(window.artplayerPluginHlsQuality=i)},{"bundle-text:./image.svg":"jPEUe","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],jPEUe:[function(e,t,n){t.exports='<svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="24" height="24"><path d="M870.4 176H153.6c-49.472 0-89.6 40.128-89.6 89.6v492.736c0 49.472 40.128 89.6 89.6 89.6h716.8c49.472 0 89.6-40.128 89.6-89.6V265.6c0-49.472-40.128-89.6-89.6-89.6zm0 492.8h-44.8s-29.696-65.792-89.6-89.6-134.4 89.6-134.4 89.6-66.56-71.808-134.4-224S153.6 624 153.6 624V265.6h716.8v403.2zM668.8 489.6c37.056 0 67.2-30.144 67.2-67.264 0-37.056-30.144-67.2-67.2-67.2-37.12.064-67.2 30.208-67.2 67.264 0 37.12 30.08 67.2 67.2 67.2z" fill="#fff"/></svg>'},{}],iWrD0:[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["34JKw"],"34JKw","parcelRequire4dc0");
|
||||
@@ -4,4 +4,24 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,s){var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[r]&&o[r],a=i.cache||{},d="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!a[t]){if(!e[t]){var s="function"==typeof o[r]&&o[r];if(!n&&s)return s(t,!0);if(i)return i(t,!0);if(d&&"string"==typeof t)return d(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}l.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},l.cache={};var u=a[t]=new f.Module(t);e[t][0].call(u.exports,l,u,u.exports,this)}return a[t].exports;function l(e){var t=l.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=a,f.parent=i,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return o[r]}}),o[r]=f;for(var c=0;c<t.length;c++)f(t[c]);if(n){var u=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({aFKtw:[function(e,t,n){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n);class r{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:n=0}){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:n},"*")}static async onMessage(e){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');const{type:t,data:n,id:s}=e.data;if("commit"===t)try{if(n.match(/\bresolve\((.*?)\)/)){const e=`return new Promise(function(resolve){\n${n}\n})`,t=await new Function(e)();r.postMessage({type:"response",data:t,id:s})}else{const e=new Function(n)();r.postMessage({type:"response",data:e,id:s})}}catch(e){throw r.postMessage({type:"error",data:e.message,id:s}),e}}static inject(){if(!r.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');r.postMessage({type:"inject"}),window.addEventListener("message",r.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw new Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw new Error('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){const{type:t,data:n,id:r}=e.data;if("inject"===t)this.injected=!0;this.promises[r]&&("error"===t?this.promises[r].reject(new Error(n)):this.promises[r].resove(n),delete this.promises[r]),this.messageCallback&&this.messageCallback({type:t,data:n})}postMessage({type:e,data:t}){return new Promise(((n,r)=>{(function s(){if(this.destroyed)r(new Error("The instance has been destroyed"));else if(this.injected){const s=Date.now();this.promises[s]={resove:n,reject:r},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)}))}commit(e){if("function"!=typeof e)throw new Error('"commit.callback" needs to be a function');const t=e.toString(),n=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:n})}message(e){if("function"!=typeof e)throw new Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}n.default=r,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=r)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,s){/* eslint-disable no-undef */var o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof o[n]&&o[n],a=i.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function d(t,r){if(!a[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var s="function"==typeof o[n]&&o[n];if(!r&&s)return s(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(i)return i(t,!0);// Try the node require function if it exists.
|
||||
if(f&&"string"==typeof t)return f(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}c.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},c.cache={};var u=a[t]=new d.Module(t);e[t][0].call(u.exports,c,u,u.exports,this)}return a[t].exports;function c(e){var t=c.resolve(e);return!1===t?{}:d(t)}}d.isParcelRequire=!0,d.Module=function(e){this.id=e,this.bundle=d,this.exports={}},d.modules=e,d.cache=a,d.parent=i,d.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(d,"root",{get:function(){return o[n]}}),o[n]=d;for(var l=0;l<t.length;l++)d(t[l]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var u=d(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):s&&(this[s]=u)}}({aFKtw:[function(e,t,r){e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(r);class n{static get iframe(){return window.top!==window}static postMessage({type:e,data:t,id:r=0}){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:e,data:t,id:r},"*")}static async onMessage(e){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');let{type:t,data:r,id:s}=e.data;if("commit"===t)try{if(r.match(/\bresolve\((.*?)\)/)){let e=`return new Promise(function(resolve){
|
||||
${r}
|
||||
})`,t=await Function(e)();n.postMessage({type:"response",data:t,id:s})}else{let e=Function(r)();n.postMessage({type:"response",data:e,id:s})}}catch(e){throw n.postMessage({type:"error",data:e.message,id:s}),e}}static inject(){if(!n.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');n.postMessage({type:"inject"}),window.addEventListener("message",n.onMessage)}constructor({iframe:e,url:t}){if(e instanceof HTMLIFrameElement==!1)throw Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof t)throw Error('"option.url" needs to be a string');this.url=t,this.$iframe=e,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=()=>null,this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}onMessage(e){let{type:t,data:r,id:n}=e.data;"inject"===t&&(this.injected=!0),this.promises[n]&&("error"===t?this.promises[n].reject(Error(r)):this.promises[n].resove(r),delete this.promises[n]),this.messageCallback&&this.messageCallback({type:t,data:r})}postMessage({type:e,data:t}){return new Promise((r,n)=>{(function s(){if(this.destroyed)n(Error("The instance has been destroyed"));else if(this.injected){let s=Date.now();this.promises[s]={resove:r,reject:n},this.$iframe.contentWindow.postMessage({type:e,data:t,id:s},"*")}else setTimeout(s.bind(this),200)}).call(this)})}commit(e){if("function"!=typeof e)throw Error('"commit.callback" needs to be a function');let t=e.toString(),r=t.substring(t.indexOf("{")+1,t.lastIndexOf("}"));return this.postMessage({type:"commit",data:r})}message(e){if("function"!=typeof e)throw Error('"message.callback" needs to be a function');this.messageCallback=e}destroy(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}r.default=n,"undefined"!=typeof window&&(window.ArtplayerPluginIframe=n)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}]},["aFKtw"],"aFKtw","parcelRequire4dc0");
|
||||
@@ -4,4 +4,35 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,r,t,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof s[n]&&s[n],i=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!i[r]){if(!e[r]){var o="function"==typeof s[n]&&s[n];if(!t&&o)return o(r,!0);if(a)return a(r,!0);if(c&&"string"==typeof r)return c(r);var f=new Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=i[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return i[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=i,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return s[n]}}),s[n]=u;for(var f=0;f<r.length;f++)u(r[f]);if(t){var l=u(t);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define((function(){return l}))}}({akNoT:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",(function(){return p}));var o=e("@swc/helpers/src/_async_to_generator.mjs"),s=n.interopDefault(o),a=e("@swc/helpers/src/_class_call_check.mjs"),i=n.interopDefault(a),c=e("@swc/helpers/src/_create_class.mjs"),u=n.interopDefault(c),f=e("@swc/helpers/src/_ts_generator.mjs"),l=n.interopDefault(f),p=function(){"use strict";function e(r){var t=r.iframe,n=r.url;if((0,i.default)(this,e),t instanceof HTMLIFrameElement==!1)throw new Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof n)throw new Error('"option.url" needs to be a string');this.url=n,this.$iframe=t,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=function(){return null},this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}return(0,u.default)(e,[{key:"onMessage",value:function(e){var r=e.data,t=r.type,n=r.data,o=r.id;if("inject"===t)this.injected=!0;this.promises[o]&&("error"===t?this.promises[o].reject(new Error(n)):this.promises[o].resove(n),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:n})}},{key:"postMessage",value:function(e){var r=e.type,t=e.data,n=this;return new Promise((function(e,o){(function n(){if(this.destroyed)o(new Error("The instance has been destroyed"));else if(this.injected){var s=Date.now();this.promises[s]={resove:e,reject:o},this.$iframe.contentWindow.postMessage({type:r,data:t,id:s},"*")}else setTimeout(n.bind(this),200)}).call(n)}))}},{key:"commit",value:function(e){if("function"!=typeof e)throw new Error('"commit.callback" needs to be a function');var r=e.toString(),t=r.substring(r.indexOf("{")+1,r.lastIndexOf("}"));return this.postMessage({type:"commit",data:t})}},{key:"message",value:function(e){if("function"!=typeof e)throw new Error('"message.callback" needs to be a function');this.messageCallback=e}},{key:"destroy",value:function(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}],[{key:"iframe",get:function(){return window.top!==window}},{key:"postMessage",value:function(r){var t=r.type,n=r.data,o=r.id,s=void 0===o?0:o;if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:n,id:s},"*")}},{key:"onMessage",value:function(r){return(0,s.default)((function(){var t,n,o,s,a,i,c,u;return(0,l.default)(this,(function(f){switch(f.label){case 0:if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');return t=r.data,n=t.type,o=t.data,s=t.id,"commit"===n?[3,1]:[3,7];case 1:return f.trys.push([1,5,,6]),o.match(/\bresolve\((.*?)\)/)?(a="return new Promise(function(resolve){\n".concat(o,"\n})"),[4,new Function(a)()]):[3,3];case 2:return i=f.sent(),e.postMessage({type:"response",data:i,id:s}),[3,4];case 3:c=new Function(o)(),e.postMessage({type:"response",data:c,id:s}),f.label=4;case 4:return[3,6];case 5:throw u=f.sent(),e.postMessage({type:"error",data:u.message,id:s}),u;case 6:case 7:return[3,8];case 8:return[2]}}))}))()}},{key:"inject",value:function(){if(!e.iframe)throw new Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}}]),e}();"undefined"!=typeof window&&(window.ArtplayerPluginIframe=p)},{"@swc/helpers/src/_async_to_generator.mjs":"9vSoD","@swc/helpers/src/_class_call_check.mjs":"iwG1v","@swc/helpers/src/_create_class.mjs":"6rgu9","@swc/helpers/src/_ts_generator.mjs":"8UZjC","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9vSoD":[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineILine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,r,t,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],s=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(r,t){if(!s[r]){if(!e[r]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!t&&o)return o(r,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(r,!0);// Try the node require function if it exists.
|
||||
if(c&&"string"==typeof r)return c(r);var f=Error("Cannot find module '"+r+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(t){var n=e[r][1][t];return null!=n?n:t},p.cache={};var l=s[r]=new u.Module(r);e[r][0].call(l.exports,p,l,l.exports,this)}return s[r].exports;function p(e){var r=p.resolve(e);return!1===r?{}:u(r)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=a,u.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var f=0;f<r.length;f++)u(r[f]);if(t){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var l=u(t);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):o&&(this[o]=l)}}({akNoT:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"default",function(){return c});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_class_call_check"),a=e("@swc/helpers/_/_create_class"),s=e("@swc/helpers/_/_ts_generator"),c=/*#__PURE__*/function(){function e(r){var t=r.iframe,n=r.url;if((0,i._)(this,e),t instanceof HTMLIFrameElement==!1)throw Error('"option.iframe" needs to be a HTMLIFrameElement');if("string"!=typeof n)throw Error('"option.url" needs to be a string');this.url=n,this.$iframe=t,this.promises={},this.injected=!1,this.destroyed=!1,this.messageCallback=function(){return null},this.onMessage=this.onMessage.bind(this),window.addEventListener("message",this.onMessage),this.$iframe.src=this.url}return(0,a._)(e,[{key:"onMessage",value:function(e){var r=e.data,t=r.type,n=r.data,o=r.id;"inject"===t&&(this.injected=!0),this.promises[o]&&("error"===t?this.promises[o].reject(Error(n)):this.promises[o].resove(n),delete this.promises[o]),this.messageCallback&&this.messageCallback({type:t,data:n})}},{key:"postMessage",value:function(e){var r=e.type,t=e.data,n=this;return new Promise(function(e,o){(function n(){if(this.destroyed)o(Error("The instance has been destroyed"));else if(this.injected){var i=Date.now();this.promises[i]={resove:e,reject:o},this.$iframe.contentWindow.postMessage({type:r,data:t,id:i},"*")}else setTimeout(n.bind(this),200)}).call(n)})}},{key:"commit",value:function(e){if("function"!=typeof e)throw Error('"commit.callback" needs to be a function');var r=e.toString(),t=r.substring(r.indexOf("{")+1,r.lastIndexOf("}"));return this.postMessage({type:"commit",data:t})}},{key:"message",value:function(e){if("function"!=typeof e)throw Error('"message.callback" needs to be a function');this.messageCallback=e}},{key:"destroy",value:function(){this.destroyed=!0,window.removeEventListener("message",this.onMessage)}}],[{key:"iframe",get:function(){return window.top!==window}},{key:"postMessage",value:function(r){var t=r.type,n=r.data,o=r.id;if(!e.iframe)throw Error('The "ArtplayerPluginIframe.postMessage" method can only be used in iframe');window.parent.postMessage({type:t,data:n,id:void 0===o?0:o},"*")}},{key:"onMessage",value:function(r){return(0,o._)(function(){var t,n,o,i,a,c,u;return(0,s._)(this,function(s){switch(s.label){case 0:if(!e.iframe)throw Error('The "ArtplayerPluginIframe.onMessage" method can only be used in iframe');if(n=(t=r.data).type,o=t.data,i=t.id,"commit"===n)return[3,1];return[3,7];case 1:if(s.trys.push([1,5,,6]),!o.match(/\bresolve\((.*?)\)/))return[3,3];return[4,Function("return new Promise(function(resolve){\n".concat(o,"\n})"))()];case 2:return a=s.sent(),e.postMessage({type:"response",data:a,id:i}),[3,4];case 3:c=Function(o)(),e.postMessage({type:"response",data:c,id:i}),s.label=4;case 4:return[3,6];case 5:throw u=s.sent(),e.postMessage({type:"error",data:u.message,id:i}),u;case 6:case 7:return[3,8];case 8:return[2]}})})()}},{key:"inject",value:function(){if(!e.iframe)throw Error('The "ArtplayerPluginIframe.inject" method can only be used in iframe');e.postMessage({type:"inject"}),window.addEventListener("message",e.onMessage)}}]),e}();"undefined"!=typeof window&&(window.ArtplayerPluginIframe=c)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_class_call_check":"9iJMm","@swc/helpers/_/_create_class":"21IOT","@swc/helpers/_/_ts_generator":"6Xyd0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,r,t,n,o,i,a){try{var s=e[i](a),c=s.value}catch(e){t(e);return}s.done?r(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var r=this,t=arguments;return new Promise(function(n,i){var a=e.apply(r,t);function s(e){o(a,n,i,s,c,"next",e)}function c(e){o(a,n,i,s,c,"throw",e)}s(void 0)})}}n.defineInteropFlag(t),n.export(t,"_async_to_generator",function(){return i}),n.export(t,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,r,t){t.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},t.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},t.exportAll=function(e,r){return Object.keys(e).forEach(function(t){"default"===t||"__esModule"===t||r.hasOwnProperty(t)||Object.defineProperty(r,t,{enumerable:!0,get:function(){return e[t]}})}),r},t.export=function(e,r,t){Object.defineProperty(e,r,{enumerable:!0,get:t})}},{}],"9iJMm":[function(e,r,t){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,r){if(!(e instanceof r))throw TypeError("Cannot call a class as a function")}n.defineInteropFlag(t),n.export(t,"_class_call_check",function(){return o}),n.export(t,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(t),n.export(t,"__extends",function(){return a}),n.export(t,"__assign",function(){return s}),n.export(t,"__rest",function(){return c}),n.export(t,"__decorate",function(){return u}),n.export(t,"__param",function(){return f}),n.export(t,"__esDecorate",function(){return l}),n.export(t,"__runInitializers",function(){return p}),n.export(t,"__propKey",function(){return d}),n.export(t,"__setFunctionName",function(){return y}),n.export(t,"__metadata",function(){return _}),n.export(t,"__awaiter",function(){return h}),n.export(t,"__generator",function(){return m}),n.export(t,"__createBinding",function(){return v}),n.export(t,"__exportStar",function(){return b}),n.export(t,"__values",function(){return w}),n.export(t,"__read",function(){return g}),/** @deprecated */n.export(t,"__spread",function(){return j}),/** @deprecated */n.export(t,"__spreadArrays",function(){return x}),n.export(t,"__spreadArray",function(){return O}),n.export(t,"__await",function(){return P}),n.export(t,"__asyncGenerator",function(){return E}),n.export(t,"__asyncDelegator",function(){return S}),n.export(t,"__asyncValues",function(){return T}),n.export(t,"__makeTemplateObject",function(){return k}),n.export(t,"__importStar",function(){return I}),n.export(t,"__importDefault",function(){return D}),n.export(t,"__classPrivateFieldGet",function(){return F}),n.export(t,"__classPrivateFieldSet",function(){return A}),n.export(t,"__classPrivateFieldIn",function(){return R}),n.export(t,"__addDisposableResource",function(){return C}),n.export(t,"__disposeResources",function(){return N});var o=e("@swc/helpers/_/_type_of"),i=function(e,r){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])})(e,r)};function a(e,r){if("function"!=typeof r&&null!==r)throw TypeError("Class extends value "+String(r)+" is not a constructor or null");function t(){this.constructor=e}i(e,r),e.prototype=null===r?Object.create(r):(t.prototype=r.prototype,new t)}var s=function(){return(s=Object.assign||function(e){for(var r,t=1,n=arguments.length;t<n;t++)for(var o in r=arguments[t])Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o]);return e}).apply(this,arguments)};function c(e,r){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>r.indexOf(n)&&(t[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>r.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(t[n[o]]=e[n[o]]);return t}function u(e,r,t,n){var o,i=arguments.length,a=i<3?r:null===n?n=Object.getOwnPropertyDescriptor(r,t):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,r,t,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(r,t,a):o(r,t))||a);return i>3&&a&&Object.defineProperty(r,t,a),a}function f(e,r){return function(t,n){r(t,n,e)}}function l(e,r,t,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,c=n.kind,u="getter"===c?"get":"setter"===c?"set":"value",f=!r&&e?n.static?e:e.prototype:null,l=r||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=t.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,t[d])("accessor"===c?{get:l.get,set:l.set}:l[u],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(s=a(h.get))&&(l.get=s),(s=a(h.set))&&(l.set=s),(s=a(h.init))&&o.unshift(s)}else(s=a(h))&&("field"===c?o.unshift(s):l[u]=s)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,r,t){for(var n=arguments.length>2,o=0;o<r.length;o++)t=n?r[o].call(e,t):r[o].call(e);return n?t:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function y(e,r,t){return(void 0===r?"undefined":(0,o._)(r))==="symbol"&&(r=r.description?"[".concat(r.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:t?"".concat(t," ",r):r})}function _(e,r){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,r)}function h(e,r,t,n){return new(t||(t=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function s(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?o(e.value):((r=e.value)instanceof t?r:new t(function(e){e(r)})).then(a,s)}c((n=n.apply(e,r||[])).next())})}function m(e,r){var t,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Sym
Line truncated
|
||||
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
.DS_Store
|
||||
yarn.lock
|
||||
package-lock.json
|
||||
test
|
||||
coverage
|
||||
.nyc_output
|
||||
.parcel-cache
|
||||
.cache
|
||||
docs
|
||||
@@ -0,0 +1 @@
|
||||
package-lock=false
|
||||
@@ -0,0 +1,11 @@
|
||||
# artplayer-plugin-multiple-subtitles
|
||||
|
||||
multiple subtitles plugin for ArtPlayer
|
||||
|
||||
## Demo
|
||||
|
||||
[https://artplayer.org](https://artplayer.org/?libs=./uncompiled/artplayer-plugin-multiple-subtitles/index.js&example=multiple.subtitles)
|
||||
|
||||
## License
|
||||
|
||||
MIT © Harvey Zack
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,i,r){/* eslint-disable no-undef */var a="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},o="function"==typeof a[i]&&a[i],s=o.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,n){if(!s[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var r="function"==typeof a[i]&&a[i];if(!n&&r)return r(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(o)return o(t,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof t)return l(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}d.resolve=function(n){var i=e[t][1][n];return null!=i?i:n},d.cache={};var c=s[t]=new u.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return s[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=s,u.parent=o,u.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(u,"root",{get:function(){return a[i]}}),a[i]=u;for(var f=0;f<t.length;f++)u(t[f]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var c=u(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd?define(function(){return c}):r&&(this[r]=c)}}({"4Kbf6":[function(e,t,n){var i=e("@parcel/transformer-js/src/esmodule-helpers.js");i.defineInteropFlag(n),i.export(n,"default",()=>s);var r=e("./parser");function a(e){let t={"&":"&","<":"<",">":">","'":"'",""":'"'},n=RegExp(`(${Object.keys(t).join("|")})`,"g");return e.replace(n,e=>t[e]||e)}async function o(e){let{getExt:t,srtToVtt:n,assToVtt:i}=Artplayer.utils,r=await fetch(e.url),a=await r.arrayBuffer(),o=new TextDecoder(e.encoding||"utf-8"),s=o.decode(a);switch(e.type||t(e.url)){case"srt":return n(s);case"ass":return i(s);case"vtt":return s;default:return""}}function s({subtitles:e}){return async t=>{let n=await Promise.all(e.map(o)),i=function(e,t){let n=new r.WebVTTParser,i=new r.WebVTTSerializer,a=n.parse("","metadata");for(let i=0;i<e.length;i++){let r=t[i],o=n.parse(e[i],"metadata");for(let e=0;e<o.cues.length;e++){let t=o.cues[e];for(let e=0;e<t.tree.children.length;e++){let n=t.tree.children[e];n.value=`<div class="art-subtitle-${r.name}">${n.value}</div>`}}if(0===a.cues.length)a.cues=o.cues;else for(let e=0;e<a.cues.length;e++)a.cues[e].tree.children.push(...o.cues[e]?.tree?.children||[])}return i.serialize(a.cues)}(n,e),s=URL.createObjectURL(new Blob([i],{type:"text/vtt"}));t.option.subtitle.escape=!1,t.subtitle.init({...t.option.subtitle,url:s,type:"vtt",onVttLoad:a})}}s.env="production",s.version="1.0.0",s.build="2023-11-23 23:22:06","undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=s)},{"./parser":"cU78l","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],cU78l:[function(e,t,n){!// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":"\xa0"}),this.entities=t,this.parse=function(n,a){// global search and replace for \0
|
||||
n=n.replace(/\0/g,"�");var o=Date.now(),s=0,l=n.split(/\r\n|\r|\n/),u=!1,f=[],c=[],d=[];function p(e,t){d.push({message:e,line:s+1,col:t})}var m=l[s],g=m.length,h="WEBVTT",v=0,b=h.length;/* HEADER */for("\uFEFF"===m[0]&&(v=1,b+=1),(g<b||m.indexOf(h)!==0+v||g>b&&" "!==m[b]&&" "!==m[b])&&p('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=l[s]&&void 0!=l[s];){if(p("No blank line after the signature."),-1!=l[s].indexOf("-->")){u=!0;break}s++}/* CUE LOOP */for(;void 0!=l[s];){for(;!u&&""==l[s];)s++;if(!u&&void 0==l[s])break;/* CUE CREATION */T=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var T,x=!0;if(-1==l[s].indexOf("-->")){/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/if(T.id=l[s],/^NOTE($|[ \t])/.test(T.id)){for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&p("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(T.id)){var y=[],w=!1;for(s++;""!=l[s]&&void 0!=l[s];)-1!=l[s].indexOf("-->")&&(p("Cannot have timestamp in a style block."),w=!0),y.push(l[s]),s++;if(c.length){p("Style blocks cannot appear after the first cue.");continue}w||f.push(y.join("\n"));continue}if(""==l[++s]||void 0==l[s]){p("Cue identifier cannot be standalone.");continue}if(-1==l[s].indexOf("-->")){x=!1,p("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */u=!1;var O=new i(l[s],p),P=0;if(c.length>0&&(P=c[c.length-1].startTime),x&&!O.parse(T,P)){/* BAD CUE LOOP */for(/* BAD CUE */T=null,s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){u=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=l[s]&&void 0!=l[s];){if(-1!=l[s].indexOf("-->")){p("Blank line missing before cue."),u=!0;break}""!=T.text&&(T.text+="\n"),T.text+=l[s],s++}/* CUE TEXT PROCESSING */var j=new r(T.text,p,a,t);T.tree=j.parse(T.startTime,T.endTime),c.push(T)}/* END */return c.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:c,errors:d,time:Date.now()-o,styles:f}}},i=function(e,t){var n=/[\u0020\t\f]/,i=/[^\u0020\t\f]/,e=e,r=0,a=function(e){t(e,r+1)};function o(t){for(;void 0!=e[r]&&t.test(e[r]);)r++}function s(t){for(var n="";void 0!=e[r]&&t.test(e[r]);)n+=e[r],r++;return n}/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */function l(){var t,n,i,o,l="minutes";// 3
|
||||
if(void 0==e[r]){a("No timestamp found.");return}// 4
|
||||
if(!/\d/.test(e[r])){a("Timestamp must start with a character in the range 0-9.");return}// 8
|
||||
if((// 5-7
|
||||
(t=s(/\d/)).length>2||parseInt(t,10)>59)&&(l="hours"),":"!=e[r]){a("No time unit separator found.");return}if(r++,2!=// 9-11
|
||||
(n=s(/\d/)).length){a("Must be exactly two digits.");return}// 12
|
||||
if("hours"==l||":"==e[r]){if(":"!=e[r]){a("No seconds found or minutes is greater than 59.");return}if(r++,2!=(i=s(/\d/)).length){a("Must be exactly two digits.");return}}else{if(2!=t.length){a("Must be exactly two digits.");return}i=n,n=t,t="0"}// 13
|
||||
if("."!=e[r]){a('No decimal separator (".") found.');return}if(r++,3!=// 14-16
|
||||
(o=s(/\d/)).length){a("Milliseconds must be given in three digits.");return}// 17
|
||||
if(parseInt(n,10)>59){a("You cannot have more than 59 minutes.");return}if(parseInt(i,10)>59){a("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(n,10)+parseInt(i,10)+parseInt(o,10)/1e3}this.parse=function(t,s){if(o(n),t.startTime=l(),void 0!=t.startTime){// 6-8
|
||||
if(t.startTime<s&&a("Start timestamp is not greater than or equal to start timestamp of previous cue."),i.test(e[r])&&a("Timestamp not separated from '-->' by whitespace."),o(n),"-"!=e[r]||"-"!=e[++r]||">"!=e[++r]){a("No valid timestamp separator found.");return}if(r++,i.test(e[r])&&a("'-->' not separated from timestamp by whitespace."),o(n),t.endTime=l(),void 0!=t.endTime)return t.endTime<=t.startTime&&a("End timestamp is not greater than start timestamp."),i.test(e[r]),o(n),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var i=e.split(n),r=[],o=0;o<i.length;o++)if(""!=i[o]){var s=i[o].indexOf(":"),l=i[o].slice(0,s),u=i[o].slice(s+1);if(-1!=r.indexOf(l)&&a("Duplicate setting."),r.push(l),""==u){a("No value for setting defined.");return}if("vertical"==l){if("rl"!=u&&"lr"!=u){a("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=u}else if("line"==l){if(/,/.test(u)){var f=u.split(",");u=f[0];var c=f[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(u)){a("Line position takes a number or percentage.");continue}if(-1!=u.indexOf("-",1)){a("Line position can only have '-' at the start.");continue}if(-1!=u.indexOf("%")&&u.indexOf("%")!=u.length-1){a("Line position can only have '%' at the end.");continue}if("-"==u[0]&&"%"==u[u.length-1]){a("Line position cannot be a negative percentage.");continue}var d=u,p=!1;if("%"==u[u.length-1]&&(p=!0,d=u.slice(0,u.length-1),parseInt(u,10)>100)){a("Line position cannot be >100%.");continue}if(""===d||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==c){if(!["start","center","end"].includes(c)){a("Line alignment needs to be one of start, center or end");continue}t.lineAlign=c}t.snapToLines=!p,t.linePosition=parseFloat(d),parseFloat(d).toString()!==d&&(t.nonSerializable=!0)}else if("position"==l){if(/,/.test(u)){var f=u.split(",");u=f[0];var m=f[1]}if("%"!=u[u.length-1]){a("Text position must be a percentage.");continue}if(parseInt(u,10)>100||0>parseInt(u,10)){a("Text position needs to be between 0 and 100%.");continue}if(""===(d=u.slice(0,u.length-1))||isNaN(d)||!isFinite(d)){a("Line position needs to be a number");continue}if(void 0!==m){if(!["line-left","center","line-right"].includes(m)){a("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=m}t.textPosition=parseFloat(d)}else if("size"==l){if("%"!=u[u.length-1]){a("Size must be a percentage.");continue}if(parseInt(u,10)>100){a("Size cannot be >100%.");continue}var g=u.slice(0,u.length-1);if(void 0===g||""===g||isNaN(g)){a("Size needs to be a number"),g=100;continue}if((g=parseFloat(g))<0||g>100){a("Size needs to be between 0 and 100%.");continue}t.size=g}else if("align"==l){var h=["start","center","end","left","right"];if(-1==h.indexOf(u)){a("Alignment can only be set to one of "+h.join(", ")+".");continue}t.alignment=u}else a("Invalid setting.")}}(e.substring(r),t),!0}},this.parseTimestamp=function(){var t=l();if(void 0!=e[r]){a("Timestamp must not have trailing characters.");return}return t}},r=function(e,t,n,r){this.entities=r;var a=this,e=e,o=0,s=function(e){"metadata"!=n&&t(e,o+1)};this.parse=function(t,l){var u={children:[]},f=u,c=[];function d(e){f.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:f}),f=f.children[f.children.length-1]}for(;void 0!=e[o];){var p=function(){for(var t="data",n="",i="",l=[];void 0!=e[o-1]||0==o;){var u=e[o];if("data"==t){if("&"==u)i=u,t="escape";else if("<"==u&&""==n)t="tag";else{if("<"==u||void 0==u)return["text",n];n+=u}}else if("escape"==t){if("<"==u||void 0==u){let e;return s("Incorrect escape."),(e=i.match(/^&#([0-9]+)$/))?n+=String.fromCharCode(e[1]):a.entities[i]?n+=a.entities[i]:n+=i,["text",n]}if("&"==u)s("Incorrect escape."),n+=i,i=u;else if(/[a-z#0-9]/i.test(u))i+=u;else if(";"==u){let e;(e=i.match(/^&#(x?[0-9]+)$/))?n+=String.fromCharCode("0"+e[1]):a.entities[i+u]?n+=a.entities[i+u]:(e=Object.keys(r).find(e=>i.startsWith(e)))?n+=a.entities[e]+i.slice(e.length)+u:(s("Incorrect escape."),n+=i+";"),t="data"}else s("Incorrect escape."),n+=i+u,t="data"}else if("tag"==t){if(" "==u||"\n"==u||"\f"==u||" "==u)t="start tag annotation";else if("."==u)t="start tag class";else if("/"==u)t="end tag";else if(/\d/.test(u))n=u,t="timestamp tag";else{if(">"==u||void 0==u)return">"==u&&o++,["start tag","",[],""];n=u,t="start tag"}}else if("start tag"==t){if(" "==u||"\f"==u||" "==u)t="start tag annotation";else if("\n"==u)i=u,t="start tag annotation";else if("."==u)t="start tag class";else{if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,[],""];n+=u}}else if("start tag class"==t){if(" "==u||"\f"==u||" "==u)i&&l.push(i),i="",t="start tag annotation";else if("\n"==u)i&&l.push(i),i=u,t="start tag annotation";else if("."==u)i&&l.push(i),i="";else{if(">"==u||void 0==u)return">"==u&&o++,i&&l.push(i),["start tag",n,l,""];i+=u}}else if("start tag annotation"==t){if(">"==u||void 0==u)return">"==u&&o++,["start tag",n,l,i=i.split(/[\u0020\t\f\r\n]+/).filter(fuLine truncated
|
||||
;// 8
|
||||
o++}}();if("text"==p[0])f.children.push({type:"text",value:p[1],parent:f});else if("start tag"==p[0]){"chapters"==n&&s("Start tags not allowed in chapter title text.");var m=p[1];"v"!=m&&"lang"!=m&&""!=p[3]&&s("Only <v> and <lang> can have an annotation."),"c"==m||"i"==m||"b"==m||"u"==m||"ruby"==m?d(p):"rt"==m&&"ruby"==f.name?d(p):"v"==m?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&s("<v> cannot be nested inside itself."),d(p),f.value=p[3]// annotation
|
||||
,p[3]||s("<v> requires an annotation.")):"lang"==m?(d(p),f.value=p[3]// language
|
||||
):s("Incorrect start tag.")}else if("end tag"==p[0])"chapters"==n&&s("End tags not allowed in chapter title text."),p[1]==f.name?f=f.parent:"ruby"==p[1]&&"rt"==f.name?f=f.parent.parent:s("Incorrect end tag.");else if("timestamp"==p[0]){"chapters"==n&&s("Timestamp not allowed in chapter title text.");var g=new i(p[1],s).parseTimestamp();void 0!=g&&((g<=t||g>=l)&&s("Timestamp must be between start timestamp and end timestamp."),c.length>0&&c[c.length-1]>=g&&s("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:g,parent:f}),c.push(g))}}for(;f.parent;)"v"!=f.name&&s("Required end tag missing."),f=f.parent;return function e(t){let n={...t};return t.children&&(n.children=t.children.map(e)),n.parent&&delete n.parent,n}(u)}},a=function(){function t(e){let t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),n=0,i=0,r=0;return e>=3600&&(n=Math.floor(e/3600)),i=Math.floor((e-3600*n)/60),r=Math.floor(e-3600*n-60*i),(n?n+":":"")+(""+i).padStart(2,"0")+":"+(""+r).padStart(2,"0")+"."+t}this.serialize=function(n,i){var r,a="WEBVTT\n\n";if(i)for(var o=0;o<i.length;o++)a+="STYLE\n"+i[o]+"\n\n";for(var o=0;o<n.length;o++)a+=(void 0!==(r=n[o]).id?r.id+"\n":"")+t(r.startTime)+" --> "+t(r.endTime)+function(t){var n="";let i=Object.keys(e).filter(n=>t[n]!==e[n]);return i.includes("direction")&&(n+=" vertical:"+t.direction),i.includes("alignment")&&(n+=" align:"+t.alignment),i.includes("size")&&(n+=" size:"+t.size+"%"),(i.includes("lineAlign")||i.includes("linePosition"))&&(n+=" line:"+t.linePosition+(t.snapToLines?"":"%")+(t.lineAlign&&t.lineAlign!=e.lineAlign?","+t.lineAlign:"")),(i.includes("textPosition")||i.includes("positionAlign"))&&(n+=" position:"+t.textPosition+"%"+(t.positionAlign&&t.positionAlign!==e.positionAlign?","+t.positionAlign:"")),n}(r)+"\n"+function e(n){for(var i="",r=0;r<n.length;r++){var a=n[r];if("text"==a.type)i+=a.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==a.type){if(i+="<"+a.name,a.classes)for(var o=0;o<a.classes.length;o++)i+="."+a.classes[o];a.value&&(i+=" "+a.value),i+=">",a.children&&(i+=e(a.children)),i+="</"+a.name+">"}else"timestamp"==a.type?i+="<"+t(a.value)+">":i+="<"+a.value+">"}return i}(r.tree.children)+"\n\n";return a}};function o(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=i,e.WebVTTCueTextParser=r,e.WebVTTSerializer=a}"undefined"!=typeof window&&o(window),o(n)}()},{}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["4Kbf6"],"4Kbf6","parcelRequire4dc0");
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
/*!
|
||||
* artplayer-plugin-multiple-subtitles.js v1.0.0
|
||||
* Github: https://github.com/zhw2590582/ArtPlayer
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],s=a.cache||{},u="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!s[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(u&&"string"==typeof t)return u(t);var l=Error("Cannot find module '"+t+"'");throw l.code="MODULE_NOT_FOUND",l}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=s[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return s[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=s,c.parent=a,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return i[n]}}),i[n]=c;for(var l=0;l<t.length;l++)c(t[l]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=c(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):o&&(this[o]=f)}}({"2hz0c":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return d});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_object_spread"),a=e("@swc/helpers/_/_object_spread_props"),s=e("@swc/helpers/_/_to_consumable_array"),u=e("@swc/helpers/_/_ts_generator"),c=e("./parser");function l(e){var t={"&":"&","<":"<",">":">","'":"'",""":'"'},r=RegExp("(".concat(Object.keys(t).join("|"),")"),"g");return e.replace(r,function(e){return t[e]||e})}function f(e){return p.apply(this,arguments)}function p(){return(p=(0,o._)(function(e){var t,r,n,o,i,a;return(0,u._)(this,function(s){switch(s.label){case 0:return r=(t=Artplayer.utils).getExt,n=t.srtToVtt,o=t.assToVtt,[4,fetch(e.url)];case 1:return[4,s.sent().arrayBuffer()];case 2:switch(i=s.sent(),a=new TextDecoder(e.encoding||"utf-8").decode(i),e.type||r(e.url)){case"srt":return[2,n(a)];case"ass":return[2,o(a)];case"vtt":return[2,a];default:return[2,""]}return[2]}})})).apply(this,arguments)}function d(e){var t,r=e.subtitles;return t=(0,o._)(function(e){var t,n;return(0,u._)(this,function(o){switch(o.label){case 0:return[4,Promise.all(r.map(f))];case 1:return t=function(e,t){for(var r=new c.WebVTTParser,n=new c.WebVTTSerializer,o=r.parse("","metadata"),i=0;i<e.length;i++){for(var a,u,l,f=t[i],p=r.parse(e[i],"metadata"),d=0;d<p.cues.length;d++)for(var _=p.cues[d],h=0;h<_.tree.children.length;h++){var m=_.tree.children[h];m.value='<div class="art-subtitle-'.concat(f.name,'">').concat(m.value,"</div>")}if(0===o.cues.length)o.cues=p.cues;else for(var y=0;y<o.cues.length;y++)(a=o.cues[y].tree.children).push.apply(a,(0,s._)((null===(l=p.cues[y])||void 0===l?void 0:null===(u=l.tree)||void 0===u?void 0:u.children)||[]))}return n.serialize(o.cues)}(o.sent(),r),n=URL.createObjectURL(new Blob([t],{type:"text/vtt"})),e.option.subtitle.escape=!1,e.subtitle.init((0,a._)((0,i._)({},e.option.subtitle),{url:n,type:"vtt",onVttLoad:l})),[2]}})}),function(e){return t.apply(this,arguments)}}d.env="production",d.version="1.0.0",d.build="2023-11-23 23:22:07","undefined"!=typeof window&&(window.artplayerPluginMultipleSubtitles=d)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_object_spread":"9agdF","@swc/helpers/_/_object_spread_props":"gJNH2","@swc/helpers/_/_to_consumable_array":"iwLF0","@swc/helpers/_/_ts_generator":"6Xyd0","./parser":"8YYw5","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){r(e);return}s.done?t(u):Promise.resolve(u).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function s(e){o(a,n,i,s,u,"next",e)}function u(e){o(a,n,i,s,u,"throw",e)}s(void 0)})}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",function(){return i}),n.export(r,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"9agdF":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_object_spread",function(){return i}),n.export(r,"_",function(){return i});var o=e("./_define_property.js");function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){(0,o._define_property)(e,t,r[t])})}return e}},{"./_define_property.js":"3NGsL","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"3NGsL":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}n.defineInteropFlag(r),n.export(r,"_define_property",function(){return o}),n.export(r,"_",function(){return o})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],gJNH2:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOLine truncated
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return a}),n.export(r,"__assign",function(){return s}),n.export(r,"__rest",function(){return u}),n.export(r,"__decorate",function(){return c}),n.export(r,"__param",function(){return l}),n.export(r,"__esDecorate",function(){return f}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return _}),n.export(r,"__metadata",function(){return h}),n.export(r,"__awaiter",function(){return m}),n.export(r,"__generator",function(){return y}),n.export(r,"__createBinding",function(){return v}),n.export(r,"__exportStar",function(){return g}),n.export(r,"__values",function(){return b}),n.export(r,"__read",function(){return j}),/** @deprecated */n.export(r,"__spread",function(){return w}),/** @deprecated */n.export(r,"__spreadArrays",function(){return x}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return T}),n.export(r,"__asyncGenerator",function(){return P}),n.export(r,"__asyncDelegator",function(){return S}),n.export(r,"__asyncValues",function(){return I}),n.export(r,"__makeTemplateObject",function(){return E}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return A}),n.export(r,"__classPrivateFieldGet",function(){return k}),n.export(r,"__classPrivateFieldSet",function(){return W}),n.export(r,"__classPrivateFieldIn",function(){return z}),n.export(r,"__addDisposableResource",function(){return N}),n.export(r,"__disposeResources",function(){return R});var o=e("@swc/helpers/_/_type_of"),i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function u(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function c(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function l(e,t){return function(r,n){t(r,n,e)}}function f(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,u=n.kind,c="getter"===u?"get":"setter"===u?"set":"value",l=!t&&e?n.static?e:e.prototype:null,f=t||(l?Object.getOwnPropertyDescriptor(l,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var _={};for(var h in n)_[h]="access"===h?{}:n[h];for(var h in n.access)_.access[h]=n.access[h];_.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var m=(0,r[d])("accessor"===u?{get:f.get,set:f.set}:f[c],_);if("accessor"===u){if(void 0===m)continue;if(null===m||"object"!=typeof m)throw TypeError("Object expected");(s=a(m.get))&&(f.get=s),(s=a(m.set))&&(f.set=s),(s=a(m.init))&&o.unshift(s)}else(s=a(m))&&("field"===u?o.unshift(s):f[c]=s)}l&&Object.defineProperty(l,n.name,f),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function _(e,t,r){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function m(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,s)}u((n=n.apply(e,t||[])).next())})}function y(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Sym
Line truncated
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
function(){var e={direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center"},t=function(t){t||(t={"&":"&","<":"<",">":">","&lrm":"","&rlm":""," ":"\xa0"}),this.entities=t,this.parse=function(r,n){// global search and replace for \0
|
||||
r=r.replace(/\0/g,"�");var a=Date.now(),s=0,u=r.split(/\r\n|\r|\n/),c=!1,l=[],f=[],p=[];function d(e,t){p.push({message:e,line:s+1,col:t})}var _=u[s],h=_.length,m="WEBVTT",y=0,v=m.length;/* HEADER */for("\uFEFF"===_[0]&&(y=1,v+=1),(h<v||_.indexOf(m)!==0+y||h>v&&" "!==_[v]&&" "!==_[v])&&d('No valid signature. (File needs to start with "WEBVTT".)'),s++;""!=u[s]&&void 0!=u[s];){if(d("No blank line after the signature."),-1!=u[s].indexOf("-->")){c=!0;break}s++}/* CUE LOOP */for(;void 0!=u[s];){for(;!c&&""==u[s];)s++;if(!c&&void 0==u[s])break;/* CUE CREATION */g=Object.assign({},e,{id:"",startTime:0,endTime:0,pauseOnExit:!1,direction:"horizontal",snapToLines:!0,linePosition:"auto",lineAlign:"start",textPosition:"auto",positionAlign:"auto",size:100,alignment:"center",text:"",tree:null});var g,b=!0;if(-1==u[s].indexOf("-->")){/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/if(g.id=u[s],/^NOTE($|[ \t])/.test(g.id)){for(s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&d("Cannot have timestamp in a comment."),s++;continue}/* STYLES */if(/^STYLE($|[ \t])/.test(g.id)){var j=[],w=!1;for(s++;""!=u[s]&&void 0!=u[s];)-1!=u[s].indexOf("-->")&&(d("Cannot have timestamp in a style block."),w=!0),j.push(u[s]),s++;if(f.length){d("Style blocks cannot appear after the first cue.");continue}w||l.push(j.join("\n"));continue}if(""==u[++s]||void 0==u[s]){d("Cue identifier cannot be standalone.");continue}if(-1==u[s].indexOf("-->")){b=!1,d("Cue identifier needs to be followed by timestamp.");continue}}/* TIMINGS */c=!1;var x=new o(u[s],d),O=0;if(f.length>0&&(O=f[f.length-1].startTime),b&&!x.parse(g,O)){/* BAD CUE LOOP */for(/* BAD CUE */g=null,s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){c=!0;break}s++}continue}/* CUE TEXT LOOP */for(s++;""!=u[s]&&void 0!=u[s];){if(-1!=u[s].indexOf("-->")){d("Blank line missing before cue."),c=!0;break}""!=g.text&&(g.text+="\n"),g.text+=u[s],s++}/* CUE TEXT PROCESSING */var T=new i(g.text,d,n,t);g.tree=T.parse(g.startTime,g.endTime),f.push(g)}/* END */return f.sort(function(e,t){return e.startTime<t.startTime?-1:e.startTime>t.startTime?1:e.endTime>t.endTime?-1:e.endTime<t.endTime?1:0}),{cues:f,errors:p,time:Date.now()-a,styles:l}}},o=function(e,t){var r=/[\u0020\t\f]/,n=/[^\u0020\t\f]/,e=e,o=0,i=function(e){t(e,o+1)};function a(t){for(;void 0!=e[o]&&t.test(e[o]);)o++}function s(t){for(var r="";void 0!=e[o]&&t.test(e[o]);)r+=e[o],o++;return r}/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */function u(){var t,r,n,a,u="minutes";// 3
|
||||
if(void 0==e[o]){i("No timestamp found.");return}// 4
|
||||
if(!/\d/.test(e[o])){i("Timestamp must start with a character in the range 0-9.");return}// 8
|
||||
if((// 5-7
|
||||
(t=s(/\d/)).length>2||parseInt(t,10)>59)&&(u="hours"),":"!=e[o]){i("No time unit separator found.");return}if(o++,2!=// 9-11
|
||||
(r=s(/\d/)).length){i("Must be exactly two digits.");return}// 12
|
||||
if("hours"==u||":"==e[o]){if(":"!=e[o]){i("No seconds found or minutes is greater than 59.");return}if(o++,2!=(n=s(/\d/)).length){i("Must be exactly two digits.");return}}else{if(2!=t.length){i("Must be exactly two digits.");return}n=r,r=t,t="0"}// 13
|
||||
if("."!=e[o]){i('No decimal separator (".") found.');return}if(o++,3!=// 14-16
|
||||
(a=s(/\d/)).length){i("Milliseconds must be given in three digits.");return}// 17
|
||||
if(parseInt(r,10)>59){i("You cannot have more than 59 minutes.");return}if(parseInt(n,10)>59){i("You cannot have more than 59 seconds.");return}return 3600*parseInt(t,10)+60*parseInt(r,10)+parseInt(n,10)+parseInt(a,10)/1e3}this.parse=function(t,s){if(a(r),t.startTime=u(),void 0!=t.startTime){// 6-8
|
||||
if(t.startTime<s&&i("Start timestamp is not greater than or equal to start timestamp of previous cue."),n.test(e[o])&&i("Timestamp not separated from '-->' by whitespace."),a(r),"-"!=e[o]||"-"!=e[++o]||">"!=e[++o]){i("No valid timestamp separator found.");return}if(o++,n.test(e[o])&&i("'-->' not separated from timestamp by whitespace."),a(r),t.endTime=u(),void 0!=t.endTime)return t.endTime<=t.startTime&&i("End timestamp is not greater than start timestamp."),n.test(e[o]),a(r),/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */function(e,t){for(var n=e.split(r),o=[],a=0;a<n.length;a++)if(""!=n[a]){var s=n[a].indexOf(":"),u=n[a].slice(0,s),c=n[a].slice(s+1);if(-1!=o.indexOf(u)&&i("Duplicate setting."),o.push(u),""==c){i("No value for setting defined.");return}if("vertical"==u){if("rl"!=c&&"lr"!=c){i("Writing direction can only be set to 'rl' or 'rl'.");continue}t.direction=c}else if("line"==u){if(/,/.test(c)){var l=c.split(",");c=l[0];var f=l[1]}if(!/^[-\d](\d*)(\.\d+)?%?$/.test(c)){i("Line position takes a number or percentage.");continue}if(-1!=c.indexOf("-",1)){i("Line position can only have '-' at the start.");continue}if(-1!=c.indexOf("%")&&c.indexOf("%")!=c.length-1){i("Line position can only have '%' at the end.");continue}if("-"==c[0]&&"%"==c[c.length-1]){i("Line position cannot be a negative percentage.");continue}var p=c,d=!1;if("%"==c[c.length-1]&&(d=!0,p=c.slice(0,c.length-1),parseInt(c,10)>100)){i("Line position cannot be >100%.");continue}if(""===p||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==f){if(!["start","center","end"].includes(f)){i("Line alignment needs to be one of start, center or end");continue}t.lineAlign=f}t.snapToLines=!d,t.linePosition=parseFloat(p),parseFloat(p).toString()!==p&&(t.nonSerializable=!0)}else if("position"==u){if(/,/.test(c)){var l=c.split(",");c=l[0];var _=l[1]}if("%"!=c[c.length-1]){i("Text position must be a percentage.");continue}if(parseInt(c,10)>100||0>parseInt(c,10)){i("Text position needs to be between 0 and 100%.");continue}if(""===(p=c.slice(0,c.length-1))||isNaN(p)||!isFinite(p)){i("Line position needs to be a number");continue}if(void 0!==_){if(!["line-left","center","line-right"].includes(_)){i("Position alignment needs to be one of line-left, center or line-right");continue}t.positionAlign=_}t.textPosition=parseFloat(p)}else if("size"==u){if("%"!=c[c.length-1]){i("Size must be a percentage.");continue}if(parseInt(c,10)>100){i("Size cannot be >100%.");continue}var h=c.slice(0,c.length-1);if(void 0===h||""===h||isNaN(h)){i("Size needs to be a number"),h=100;continue}if((h=parseFloat(h))<0||h>100){i("Size needs to be between 0 and 100%.");continue}t.size=h}else if("align"==u){var m=["start","center","end","left","right"];if(-1==m.indexOf(c)){i("Alignment can only be set to one of "+m.join(", ")+".");continue}t.alignment=c}else i("Invalid setting.")}}(e.substring(o),t),!0}},this.parseTimestamp=function(){var t=u();if(void 0!=e[o]){i("Timestamp must not have trailing characters.");return}return t}},i=function(e,t,r,i){this.entities=i;var a=this,e=e,s=0,u=function(e){"metadata"!=r&&t(e,s+1)};this.parse=function(t,c){var l={children:[]},f=l,p=[];function d(e){f.children.push({type:"object",name:e[1],classes:e[2],children:[],parent:f}),f=f.children[f.children.length-1]}for(;void 0!=e[s];){var _=function(){for(var t="data",r="",n="",o=[];void 0!=e[s-1]||0==s;){var c=e[s];if("data"==t){if("&"==c)n=c,t="escape";else if("<"==c&&""==r)t="tag";else{if("<"==c||void 0==c)return["text",r];r+=c}}else if("escape"==t){if("<"==c||void 0==c){u("Incorrect escape.");var l=void 0;return(l=n.match(/^&#([0-9]+)$/))?r+=String.fromCharCode(l[1]):a.entities[n]?r+=a.entities[n]:r+=n,["text",r]}if("&"==c)u("Incorrect escape."),r+=n,n=c;else if(/[a-z#0-9]/i.test(c))n+=c;else if(";"==c){var f=void 0;(f=n.match(/^&#(x?[0-9]+)$/))?r+=String.fromCharCode("0"+f[1]):a.entities[n+c]?r+=a.entities[n+c]:(f=Object.keys(i).find(function(e){return n.startsWith(e)}))?r+=a.entities[f]+n.slice(f.length)+c:(u("Incorrect escape."),r+=n+";"),t="data"}else u("Incorrect escape."),r+=n+c,t="data"}else if("tag"==t){if(" "==c||"\n"==c||"\f"==c||" "==c)t="start tag annotation";else if("."==c)t="start tag class";else if("/"==c)t="end tag";else if(/\d/.test(c))r=c,t="timestamp tag";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag","",[],""];r=c,t="start tag"}}else if("start tag"==t){if(" "==c||"\f"==c||" "==c)t="start tag annotation";else if("\n"==c)n=c,t="start tag annotation";else if("."==c)t="start tag class";else{if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,[],""];r+=c}}else if("start tag class"==t){if(" "==c||"\f"==c||" "==c)n&&o.push(n),n="",t="start tag annotation";else if("\n"==c)n&&o.push(n),n=c,t="start tag annotation";else if("."==c)n&&o.push(n),n="";else{if(">"==c||void 0==c)return">"==c&&s++,n&&o.push(n),["start tag",r,o,""];n+=c}}else if("start tag annotation"==t){if(">"==c||void 0==c)return">"==c&&s++,["start tag",r,o,n=n.split(Line truncated
|
||||
;// 8
|
||||
s++}}();if("text"==_[0])f.children.push({type:"text",value:_[1],parent:f});else if("start tag"==_[0]){"chapters"==r&&u("Start tags not allowed in chapter title text.");var h=_[1];"v"!=h&&"lang"!=h&&""!=_[3]&&u("Only <v> and <lang> can have an annotation."),"c"==h||"i"==h||"b"==h||"u"==h||"ruby"==h?d(_):"rt"==h&&"ruby"==f.name?d(_):"v"==h?(function(e){for(var t=f;t;){if("v"==t.name)return!0;t=t.parent}}(0)&&u("<v> cannot be nested inside itself."),d(_),f.value=_[3]// annotation
|
||||
,_[3]||u("<v> requires an annotation.")):"lang"==h?(d(_),f.value=_[3]// language
|
||||
):u("Incorrect start tag.")}else if("end tag"==_[0])"chapters"==r&&u("End tags not allowed in chapter title text."),_[1]==f.name?f=f.parent:"ruby"==_[1]&&"rt"==f.name?f=f.parent.parent:u("Incorrect end tag.");else if("timestamp"==_[0]){"chapters"==r&&u("Timestamp not allowed in chapter title text.");var m=new o(_[1],u).parseTimestamp();void 0!=m&&((m<=t||m>=c)&&u("Timestamp must be between start timestamp and end timestamp."),p.length>0&&p[p.length-1]>=m&&u("Timestamp must be greater than any previous timestamp."),f.children.push({type:"timestamp",value:m,parent:f}),p.push(m))}}for(;f.parent;)"v"!=f.name&&u("Required end tag missing."),f=f.parent;return function e(t){var r=(0,n._)({},t);return t.children&&(r.children=t.children.map(e)),r.parent&&delete r.parent,r}(l)}},a=function(){function t(e){var t=("00"+1e3*(e-Math.floor(e)).toFixed(3)).slice(-3),r=0,n=0,o=0;return e>=3600&&(r=Math.floor(e/3600)),n=Math.floor((e-3600*r)/60),o=Math.floor(e-3600*r-60*n),(r?r+":":"")+(""+n).padStart(2,"0")+":"+(""+o).padStart(2,"0")+"."+t}this.serialize=function(r,n){var o="WEBVTT\n\n";if(n)for(var i=0;i<n.length;i++)o+="STYLE\n"+n[i]+"\n\n";for(var i=0;i<r.length;i++)o+=function(r){var n,o;return(void 0!==r.id?r.id+"\n":"")+t(r.startTime)+" --> "+t(r.endTime)+(n="",(o=Object.keys(e).filter(function(t){return r[t]!==e[t]})).includes("direction")&&(n+=" vertical:"+r.direction),o.includes("alignment")&&(n+=" align:"+r.alignment),o.includes("size")&&(n+=" size:"+r.size+"%"),(o.includes("lineAlign")||o.includes("linePosition"))&&(n+=" line:"+r.linePosition+(r.snapToLines?"":"%")+(r.lineAlign&&r.lineAlign!=e.lineAlign?","+r.lineAlign:"")),(o.includes("textPosition")||o.includes("positionAlign"))&&(n+=" position:"+r.textPosition+"%"+(r.positionAlign&&r.positionAlign!==e.positionAlign?","+r.positionAlign:"")),n)+"\n"+function e(r){for(var n="",o=0;o<r.length;o++){var i=r[o];if("text"==i.type)n+=i.value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");else if("object"==i.type){if(n+="<"+i.name,i.classes)for(var a=0;a<i.classes.length;a++)n+="."+i.classes[a];i.value&&(n+=" "+i.value),n+=">",i.children&&(n+=e(i.children)),n+="</"+i.name+">"}else"timestamp"==i.type?n+="<"+t(i.value)+">":n+="<"+i.value+">"}return n}(r.tree.children)+"\n\n"}(r[i]);return o}};function s(e){e.WebVTTParser=t,e.WebVTTCueTimingsAndSettingsParser=o,e.WebVTTCueTextParser=i,e.WebVTTSerializer=a}"undefined"!=typeof window&&s(window),s(r)}()},{"@swc/helpers/_/_object_spread":"9agdF"}]},["2hz0c"],"2hz0c","parcelRequire4dc0");
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"license": "MIT",
|
||||
"version": "1.0.0",
|
||||
"name": "artplayer-plugin-multiple-subtitles",
|
||||
"types": "types/artplayer-plugin-multiple-subtitles.d.ts",
|
||||
"description": "multiple subtitles plugin for ArtPlayer",
|
||||
"main": "dist/artplayer-plugin-multiple-subtitles.js",
|
||||
"legacy": "dist/artplayer-plugin-multiple-subtitles.legacy.js",
|
||||
"author": "Harvey Zack <laozhaochaguan@gmail.com>",
|
||||
"browserslist": "last 1 Chrome version",
|
||||
"homepage": "https://artplayer.org",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/zhw2590582/ArtPlayer.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/zhw2590582/ArtPlayer/issues"
|
||||
},
|
||||
"keywords": [
|
||||
"html5",
|
||||
"video",
|
||||
"player"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
import { WebVTTParser, WebVTTSerializer } from './parser';
|
||||
|
||||
function unescape(str) {
|
||||
const map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
''': "'",
|
||||
'"': '"',
|
||||
};
|
||||
const reg = new RegExp(`(${Object.keys(map).join('|')})`, 'g');
|
||||
return str.replace(reg, (tag) => map[tag] || tag);
|
||||
}
|
||||
|
||||
async function loadSubtitleAsVtt(option) {
|
||||
const { getExt, srtToVtt, assToVtt } = Artplayer.utils;
|
||||
const response = await fetch(option.url);
|
||||
const buffer = await response.arrayBuffer();
|
||||
const decoder = new TextDecoder(option.encoding || 'utf-8');
|
||||
const text = decoder.decode(buffer);
|
||||
switch (option.type || getExt(option.url)) {
|
||||
case 'srt': {
|
||||
return srtToVtt(text);
|
||||
}
|
||||
case 'ass': {
|
||||
return assToVtt(text);
|
||||
}
|
||||
case 'vtt': {
|
||||
return text;
|
||||
}
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function mergeVtts(vtts, subtitles) {
|
||||
const parser = new WebVTTParser();
|
||||
const seri = new WebVTTSerializer();
|
||||
const result = parser.parse('', 'metadata');
|
||||
|
||||
for (let i = 0; i < vtts.length; i++) {
|
||||
const option = subtitles[i];
|
||||
const tree = parser.parse(vtts[i], 'metadata');
|
||||
|
||||
for (let j = 0; j < tree.cues.length; j++) {
|
||||
const cue = tree.cues[j];
|
||||
for (let k = 0; k < cue.tree.children.length; k++) {
|
||||
const children = cue.tree.children[k];
|
||||
children.value = `<div class="art-subtitle-${option.name}">${children.value}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (result.cues.length === 0) {
|
||||
result.cues = tree.cues;
|
||||
} else {
|
||||
for (let l = 0; l < result.cues.length; l++) {
|
||||
result.cues[l].tree.children.push(...(tree.cues[l]?.tree?.children || []));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return seri.serialize(result.cues);
|
||||
}
|
||||
|
||||
export default function artplayerPluginMultipleSubtitles({ subtitles }) {
|
||||
return async (art) => {
|
||||
const vtts = await Promise.all(subtitles.map(loadSubtitleAsVtt));
|
||||
const vtt = mergeVtts(vtts, subtitles);
|
||||
const url = URL.createObjectURL(new Blob([vtt], { type: 'text/vtt' }));
|
||||
|
||||
art.option.subtitle.escape = false;
|
||||
|
||||
art.subtitle.init({
|
||||
...art.option.subtitle,
|
||||
url,
|
||||
type: 'vtt',
|
||||
onVttLoad: unescape,
|
||||
});
|
||||
};
|
||||
}
|
||||
artplayerPluginMultipleSubtitles.env = process.env.NODE_ENV;
|
||||
artplayerPluginMultipleSubtitles.version = process.env.APP_VER;
|
||||
artplayerPluginMultipleSubtitles.build = process.env.BUILD_DATE;
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
window['artplayerPluginMultipleSubtitles'] = artplayerPluginMultipleSubtitles;
|
||||
}
|
||||
@@ -0,0 +1,888 @@
|
||||
// Any copyright is dedicated to the Public Domain.
|
||||
// http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
// Not intended to be fast, but if you can make it faster, please help out!
|
||||
|
||||
(function () {
|
||||
var defaultCueSettings = {
|
||||
direction:"horizontal",
|
||||
snapToLines:true,
|
||||
linePosition:"auto",
|
||||
lineAlign:"start",
|
||||
textPosition:"auto",
|
||||
positionAlign:"auto",
|
||||
size:100,
|
||||
alignment:"center",
|
||||
};
|
||||
|
||||
var WebVTTParser = function(entities) {
|
||||
if (!entities) {
|
||||
entities = {
|
||||
"&": "&",
|
||||
"<": "<",
|
||||
">": ">",
|
||||
"&lrm": "\u200e",
|
||||
"&rlm": "\u200f",
|
||||
" ": "\u00A0"
|
||||
}
|
||||
}
|
||||
this.entities = entities
|
||||
this.parse = function(input, mode) {
|
||||
// global search and replace for \0
|
||||
input = input.replace(/\0/g, '\uFFFD');
|
||||
var NEWLINE = /\r\n|\r|\n/,
|
||||
startTime = Date.now(),
|
||||
linePos = 0,
|
||||
lines = input.split(NEWLINE),
|
||||
alreadyCollected = false,
|
||||
styles = [],
|
||||
cues = [],
|
||||
errors = []
|
||||
function err(message, col) {
|
||||
errors.push({message:message, line:linePos+1, col:col})
|
||||
}
|
||||
|
||||
var line = lines[linePos],
|
||||
lineLength = line.length,
|
||||
signature = "WEBVTT",
|
||||
bom = 0,
|
||||
signature_length = signature.length
|
||||
|
||||
/* Byte order mark */
|
||||
if (line[0] === "\ufeff") {
|
||||
bom = 1
|
||||
signature_length += 1
|
||||
}
|
||||
/* SIGNATURE */
|
||||
if (
|
||||
lineLength < signature_length ||
|
||||
line.indexOf(signature) !== 0+bom ||
|
||||
lineLength > signature_length &&
|
||||
line[signature_length] !== " " &&
|
||||
line[signature_length] !== "\t"
|
||||
) {
|
||||
err("No valid signature. (File needs to start with \"WEBVTT\".)")
|
||||
}
|
||||
|
||||
linePos++
|
||||
|
||||
/* HEADER */
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined) {
|
||||
err("No blank line after the signature.")
|
||||
if(lines[linePos].indexOf("-->") != -1) {
|
||||
alreadyCollected = true
|
||||
break
|
||||
}
|
||||
linePos++
|
||||
}
|
||||
|
||||
/* CUE LOOP */
|
||||
while(lines[linePos] != undefined) {
|
||||
var cue
|
||||
while(!alreadyCollected && lines[linePos] == "") {
|
||||
linePos++
|
||||
}
|
||||
if(!alreadyCollected && lines[linePos] == undefined)
|
||||
break
|
||||
|
||||
/* CUE CREATION */
|
||||
cue = Object.assign({}, defaultCueSettings, {
|
||||
id:"",
|
||||
startTime:0,
|
||||
endTime:0,
|
||||
pauseOnExit:false,
|
||||
direction:"horizontal",
|
||||
snapToLines:true,
|
||||
linePosition:"auto",
|
||||
lineAlign:"start",
|
||||
textPosition:"auto",
|
||||
positionAlign:"auto",
|
||||
size:100,
|
||||
alignment:"center",
|
||||
text:"",
|
||||
tree:null
|
||||
})
|
||||
|
||||
var parseTimings = true
|
||||
|
||||
if(lines[linePos].indexOf("-->") == -1) {
|
||||
cue.id = lines[linePos]
|
||||
|
||||
/* COMMENTS
|
||||
Not part of the specification's parser as these would just be ignored. However,
|
||||
we want them to be conforming and not get "Cue identifier cannot be standalone".
|
||||
*/
|
||||
if(/^NOTE($|[ \t])/.test(cue.id)) { // .startsWith fails in Chrome
|
||||
linePos++
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined) {
|
||||
if(lines[linePos].indexOf("-->") != -1)
|
||||
err("Cannot have timestamp in a comment.")
|
||||
linePos++
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
/* STYLES */
|
||||
if(/^STYLE($|[ \t])/.test(cue.id)) {
|
||||
var style = []
|
||||
var invalid = false
|
||||
linePos++
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined) {
|
||||
if(lines[linePos].indexOf("-->") != -1) {
|
||||
err("Cannot have timestamp in a style block.")
|
||||
invalid = true
|
||||
}
|
||||
style.push(lines[linePos])
|
||||
linePos++
|
||||
}
|
||||
if(cues.length) {
|
||||
err("Style blocks cannot appear after the first cue.")
|
||||
continue
|
||||
}
|
||||
if (!invalid) {
|
||||
styles.push(style.join('\n'))
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
linePos++
|
||||
|
||||
if(lines[linePos] == "" || lines[linePos] == undefined) {
|
||||
err("Cue identifier cannot be standalone.")
|
||||
continue
|
||||
}
|
||||
|
||||
if(lines[linePos].indexOf("-->") == -1) {
|
||||
parseTimings = false
|
||||
err("Cue identifier needs to be followed by timestamp.")
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
/* TIMINGS */
|
||||
alreadyCollected = false
|
||||
var timings = new WebVTTCueTimingsAndSettingsParser(lines[linePos], err)
|
||||
var previousCueStart = 0
|
||||
if(cues.length > 0) {
|
||||
previousCueStart = cues[cues.length-1].startTime
|
||||
}
|
||||
if(parseTimings && !timings.parse(cue, previousCueStart)) {
|
||||
/* BAD CUE */
|
||||
|
||||
cue = null
|
||||
linePos++
|
||||
|
||||
/* BAD CUE LOOP */
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined) {
|
||||
if(lines[linePos].indexOf("-->") != -1) {
|
||||
alreadyCollected = true
|
||||
break
|
||||
}
|
||||
linePos++
|
||||
}
|
||||
continue
|
||||
}
|
||||
linePos++
|
||||
|
||||
/* CUE TEXT LOOP */
|
||||
while(lines[linePos] != "" && lines[linePos] != undefined) {
|
||||
if(lines[linePos].indexOf("-->") != -1) {
|
||||
err("Blank line missing before cue.")
|
||||
alreadyCollected = true
|
||||
break
|
||||
}
|
||||
if(cue.text != "")
|
||||
cue.text += "\n"
|
||||
cue.text += lines[linePos]
|
||||
linePos++
|
||||
}
|
||||
|
||||
/* CUE TEXT PROCESSING */
|
||||
var cuetextparser = new WebVTTCueTextParser(cue.text, err, mode, entities)
|
||||
cue.tree = cuetextparser.parse(cue.startTime, cue.endTime)
|
||||
cues.push(cue)
|
||||
}
|
||||
cues.sort(function(a, b) {
|
||||
if (a.startTime < b.startTime)
|
||||
return -1
|
||||
if (a.startTime > b.startTime)
|
||||
return 1
|
||||
if (a.endTime > b.endTime)
|
||||
return -1
|
||||
if (a.endTime < b.endTime)
|
||||
return 1
|
||||
return 0
|
||||
})
|
||||
/* END */
|
||||
return {cues:cues, errors:errors, time:Date.now()-startTime, styles: styles}
|
||||
}
|
||||
}
|
||||
|
||||
var WebVTTCueTimingsAndSettingsParser = function(line, errorHandler) {
|
||||
var SPACE = /[\u0020\t\f]/,
|
||||
NOSPACE = /[^\u0020\t\f]/,
|
||||
line = line,
|
||||
pos = 0,
|
||||
err = function(message) {
|
||||
errorHandler(message, pos+1)
|
||||
},
|
||||
spaceBeforeSetting = true
|
||||
function skip(pattern) {
|
||||
while(
|
||||
line[pos] != undefined &&
|
||||
pattern.test(line[pos])
|
||||
) {
|
||||
pos++
|
||||
}
|
||||
}
|
||||
function collect(pattern) {
|
||||
var str = ""
|
||||
while(
|
||||
line[pos] != undefined &&
|
||||
pattern.test(line[pos])
|
||||
) {
|
||||
str += line[pos]
|
||||
pos++
|
||||
}
|
||||
return str
|
||||
}
|
||||
/* http://dev.w3.org/html5/webvtt/#collect-a-webvtt-timestamp */
|
||||
function timestamp() {
|
||||
var units = "minutes",
|
||||
val1,
|
||||
val2,
|
||||
val3,
|
||||
val4
|
||||
// 3
|
||||
if(line[pos] == undefined) {
|
||||
err("No timestamp found.")
|
||||
return
|
||||
}
|
||||
// 4
|
||||
if(!/\d/.test(line[pos])) {
|
||||
err("Timestamp must start with a character in the range 0-9.")
|
||||
return
|
||||
}
|
||||
// 5-7
|
||||
val1 = collect(/\d/)
|
||||
if(val1.length > 2 || parseInt(val1, 10) > 59) {
|
||||
units = "hours"
|
||||
}
|
||||
// 8
|
||||
if(line[pos] != ":") {
|
||||
err("No time unit separator found.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
// 9-11
|
||||
val2 = collect(/\d/)
|
||||
if(val2.length != 2) {
|
||||
err("Must be exactly two digits.")
|
||||
return
|
||||
}
|
||||
// 12
|
||||
if(units == "hours" || line[pos] == ":") {
|
||||
if(line[pos] != ":") {
|
||||
err("No seconds found or minutes is greater than 59.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
val3 = collect(/\d/)
|
||||
if(val3.length != 2) {
|
||||
err("Must be exactly two digits.")
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if (val1.length != 2) {
|
||||
err("Must be exactly two digits.")
|
||||
return
|
||||
}
|
||||
val3 = val2
|
||||
val2 = val1
|
||||
val1 = "0"
|
||||
}
|
||||
// 13
|
||||
if(line[pos] != ".") {
|
||||
err("No decimal separator (\".\") found.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
// 14-16
|
||||
val4 = collect(/\d/)
|
||||
if(val4.length != 3) {
|
||||
err("Milliseconds must be given in three digits.")
|
||||
return
|
||||
}
|
||||
// 17
|
||||
if(parseInt(val2, 10) > 59) {
|
||||
err("You cannot have more than 59 minutes.")
|
||||
return
|
||||
}
|
||||
if(parseInt(val3, 10) > 59) {
|
||||
err("You cannot have more than 59 seconds.")
|
||||
return
|
||||
}
|
||||
return parseInt(val1, 10) * 60 * 60 + parseInt(val2, 10) * 60 + parseInt(val3, 10) + parseInt(val4, 10) / 1000
|
||||
}
|
||||
|
||||
/* http://dev.w3.org/html5/webvtt/#parse-the-webvtt-settings */
|
||||
function parseSettings(input, cue) {
|
||||
var settings = input.split(SPACE),
|
||||
seen = []
|
||||
for(var i=0; i < settings.length; i++) {
|
||||
if(settings[i] == "")
|
||||
continue
|
||||
|
||||
var index = settings[i].indexOf(':'),
|
||||
setting = settings[i].slice(0, index),
|
||||
value = settings[i].slice(index + 1)
|
||||
|
||||
if(seen.indexOf(setting) != -1) {
|
||||
err("Duplicate setting.")
|
||||
}
|
||||
seen.push(setting)
|
||||
|
||||
if(value == "") {
|
||||
err("No value for setting defined.")
|
||||
return
|
||||
}
|
||||
|
||||
if(setting == "vertical") { // writing direction
|
||||
if(value != "rl" && value != "lr") {
|
||||
err("Writing direction can only be set to 'rl' or 'rl'.")
|
||||
continue
|
||||
}
|
||||
cue.direction = value
|
||||
} else if(setting == "line") { // line position and optionally line alignment
|
||||
if (/,/.test(value)) {
|
||||
var comp = value.split(',')
|
||||
value = comp[0]
|
||||
var lineAlign = comp[1]
|
||||
}
|
||||
if(!/^[-\d](\d*)(\.\d+)?%?$/.test(value)) {
|
||||
err("Line position takes a number or percentage.")
|
||||
continue
|
||||
}
|
||||
if(value.indexOf("-", 1) != -1) {
|
||||
err("Line position can only have '-' at the start.")
|
||||
continue
|
||||
}
|
||||
if(value.indexOf("%") != -1 && value.indexOf("%") != value.length-1) {
|
||||
err("Line position can only have '%' at the end.")
|
||||
continue
|
||||
}
|
||||
if(value[0] == "-" && value[value.length-1] == "%") {
|
||||
err("Line position cannot be a negative percentage.")
|
||||
continue
|
||||
}
|
||||
var numVal = value;
|
||||
var isPercent = false;
|
||||
if(value[value.length-1] == "%") {
|
||||
isPercent = true;
|
||||
numVal = value.slice(0, value.length-1)
|
||||
if(parseInt(value, 10) > 100) {
|
||||
err("Line position cannot be >100%.")
|
||||
continue
|
||||
}
|
||||
}
|
||||
if (numVal === '' || isNaN(numVal) || !isFinite(numVal)) {
|
||||
err("Line position needs to be a number")
|
||||
continue
|
||||
}
|
||||
if (lineAlign !== undefined) {
|
||||
if (!["start", "center", "end"].includes(lineAlign)) {
|
||||
err("Line alignment needs to be one of start, center or end")
|
||||
continue
|
||||
}
|
||||
cue.lineAlign = lineAlign
|
||||
}
|
||||
cue.snapToLines = !isPercent;
|
||||
cue.linePosition = parseFloat(numVal)
|
||||
if (parseFloat(numVal).toString() !== numVal) {
|
||||
cue.nonSerializable = true;
|
||||
}
|
||||
} else if(setting == "position") { // text position and optional positionAlign
|
||||
if (/,/.test(value)) {
|
||||
var comp = value.split(',')
|
||||
value = comp[0]
|
||||
var positionAlign = comp[1]
|
||||
}
|
||||
if(value[value.length-1] != "%") {
|
||||
err("Text position must be a percentage.")
|
||||
continue
|
||||
}
|
||||
if(parseInt(value, 10) > 100 || parseInt(value, 10) < 0) {
|
||||
err("Text position needs to be between 0 and 100%.")
|
||||
continue
|
||||
}
|
||||
numVal = value.slice(0, value.length-1)
|
||||
if (numVal === '' || isNaN(numVal) || !isFinite(numVal)) {
|
||||
err("Line position needs to be a number")
|
||||
continue
|
||||
}
|
||||
if (positionAlign !== undefined) {
|
||||
if (!["line-left", "center", "line-right"].includes(positionAlign)) {
|
||||
err("Position alignment needs to be one of line-left, center or line-right")
|
||||
continue
|
||||
}
|
||||
cue.positionAlign = positionAlign
|
||||
}
|
||||
cue.textPosition = parseFloat(numVal)
|
||||
} else if(setting == "size") { // size
|
||||
if(value[value.length-1] != "%") {
|
||||
err("Size must be a percentage.")
|
||||
continue
|
||||
}
|
||||
if(parseInt(value, 10) > 100) {
|
||||
err("Size cannot be >100%.")
|
||||
continue
|
||||
}
|
||||
var size = value.slice(0, value.length -1)
|
||||
if (size === undefined || size === "" || isNaN(size)) {
|
||||
err("Size needs to be a number")
|
||||
size = 100
|
||||
continue
|
||||
} else {
|
||||
size = parseFloat(size)
|
||||
if (size < 0 || size > 100) {
|
||||
err("Size needs to be between 0 and 100%.")
|
||||
continue;
|
||||
}
|
||||
}
|
||||
cue.size = size
|
||||
} else if(setting == "align") { // alignment
|
||||
var alignValues = ["start", "center", "end", "left", "right"]
|
||||
if(alignValues.indexOf(value) == -1) {
|
||||
err("Alignment can only be set to one of " + alignValues.join(", ") + ".")
|
||||
continue
|
||||
}
|
||||
cue.alignment = value
|
||||
} else {
|
||||
err("Invalid setting.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.parse = function(cue, previousCueStart) {
|
||||
skip(SPACE)
|
||||
cue.startTime = timestamp()
|
||||
if(cue.startTime == undefined) {
|
||||
return
|
||||
}
|
||||
if(cue.startTime < previousCueStart) {
|
||||
err("Start timestamp is not greater than or equal to start timestamp of previous cue.")
|
||||
}
|
||||
if(NOSPACE.test(line[pos])) {
|
||||
err("Timestamp not separated from '-->' by whitespace.")
|
||||
}
|
||||
skip(SPACE)
|
||||
// 6-8
|
||||
if(line[pos] != "-") {
|
||||
err("No valid timestamp separator found.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
if(line[pos] != "-") {
|
||||
err("No valid timestamp separator found.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
if(line[pos] != ">") {
|
||||
err("No valid timestamp separator found.")
|
||||
return
|
||||
}
|
||||
pos++
|
||||
if(NOSPACE.test(line[pos])) {
|
||||
err("'-->' not separated from timestamp by whitespace.")
|
||||
}
|
||||
skip(SPACE)
|
||||
cue.endTime = timestamp()
|
||||
if(cue.endTime == undefined) {
|
||||
return
|
||||
}
|
||||
if(cue.endTime <= cue.startTime) {
|
||||
err("End timestamp is not greater than start timestamp.")
|
||||
}
|
||||
|
||||
if(NOSPACE.test(line[pos])) {
|
||||
spaceBeforeSetting = false
|
||||
}
|
||||
skip(SPACE)
|
||||
parseSettings(line.substring(pos), cue)
|
||||
return true
|
||||
}
|
||||
this.parseTimestamp = function() {
|
||||
var ts = timestamp()
|
||||
if(line[pos] != undefined) {
|
||||
err("Timestamp must not have trailing characters.")
|
||||
return
|
||||
}
|
||||
return ts
|
||||
}
|
||||
}
|
||||
|
||||
var WebVTTCueTextParser = function(line, errorHandler, mode, entities) {
|
||||
this.entities = entities
|
||||
var self = this
|
||||
var line = line,
|
||||
pos = 0,
|
||||
err = function(message) {
|
||||
if(mode == "metadata")
|
||||
return
|
||||
errorHandler(message, pos+1)
|
||||
}
|
||||
|
||||
this.parse = function(cueStart, cueEnd) {
|
||||
function removeCycles(tree) {
|
||||
const cyclelessTree = {...tree};
|
||||
if (tree.children) {
|
||||
cyclelessTree.children = tree.children.map(removeCycles);
|
||||
}
|
||||
if (cyclelessTree.parent) {
|
||||
delete cyclelessTree.parent;
|
||||
}
|
||||
return cyclelessTree;
|
||||
}
|
||||
|
||||
var result = {children:[]},
|
||||
current = result,
|
||||
timestamps = []
|
||||
|
||||
function attach(token) {
|
||||
current.children.push({type:"object", name:token[1], classes:token[2], children:[], parent:current})
|
||||
current = current.children[current.children.length-1]
|
||||
}
|
||||
function inScope(name) {
|
||||
var node = current
|
||||
while(node) {
|
||||
if(node.name == name)
|
||||
return true
|
||||
node = node.parent
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
while(line[pos] != undefined) {
|
||||
var token = nextToken()
|
||||
if(token[0] == "text") {
|
||||
current.children.push({type:"text", value:token[1], parent:current})
|
||||
} else if(token[0] == "start tag") {
|
||||
if(mode == "chapters")
|
||||
err("Start tags not allowed in chapter title text.")
|
||||
var name = token[1]
|
||||
if(name != "v" && name != "lang" && token[3] != "") {
|
||||
err("Only <v> and <lang> can have an annotation.")
|
||||
}
|
||||
if(
|
||||
name == "c" ||
|
||||
name == "i" ||
|
||||
name == "b" ||
|
||||
name == "u" ||
|
||||
name == "ruby"
|
||||
) {
|
||||
attach(token)
|
||||
} else if(name == "rt" && current.name == "ruby") {
|
||||
attach(token)
|
||||
} else if(name == "v") {
|
||||
if(inScope("v")) {
|
||||
err("<v> cannot be nested inside itself.")
|
||||
}
|
||||
attach(token)
|
||||
current.value = token[3] // annotation
|
||||
if(!token[3]) {
|
||||
err("<v> requires an annotation.")
|
||||
}
|
||||
} else if(name == "lang") {
|
||||
attach(token)
|
||||
current.value = token[3] // language
|
||||
} else {
|
||||
err("Incorrect start tag.")
|
||||
}
|
||||
} else if(token[0] == "end tag") {
|
||||
if(mode == "chapters")
|
||||
err("End tags not allowed in chapter title text.")
|
||||
// XXX check <ruby> content
|
||||
if(token[1] == current.name) {
|
||||
current = current.parent
|
||||
} else if(token[1] == "ruby" && current.name == "rt") {
|
||||
current = current.parent.parent
|
||||
} else {
|
||||
err("Incorrect end tag.")
|
||||
}
|
||||
} else if(token[0] == "timestamp") {
|
||||
if(mode == "chapters")
|
||||
err("Timestamp not allowed in chapter title text.")
|
||||
var timings = new WebVTTCueTimingsAndSettingsParser(token[1], err),
|
||||
timestamp = timings.parseTimestamp()
|
||||
if(timestamp != undefined) {
|
||||
if(timestamp <= cueStart || timestamp >= cueEnd) {
|
||||
err("Timestamp must be between start timestamp and end timestamp.")
|
||||
}
|
||||
if(timestamps.length > 0 && timestamps[timestamps.length-1] >= timestamp) {
|
||||
err("Timestamp must be greater than any previous timestamp.")
|
||||
}
|
||||
current.children.push({type:"timestamp", value:timestamp, parent:current})
|
||||
timestamps.push(timestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
while(current.parent) {
|
||||
if(current.name != "v") {
|
||||
err("Required end tag missing.")
|
||||
}
|
||||
current = current.parent
|
||||
}
|
||||
return removeCycles(result)
|
||||
}
|
||||
|
||||
function nextToken() {
|
||||
var state = "data",
|
||||
result = "",
|
||||
buffer = "",
|
||||
classes = []
|
||||
while(line[pos-1] != undefined || pos == 0) {
|
||||
var c = line[pos]
|
||||
if(state == "data") {
|
||||
if(c == "&") {
|
||||
buffer = c
|
||||
state = "escape"
|
||||
} else if(c == "<" && result == "") {
|
||||
state = "tag"
|
||||
} else if(c == "<" || c == undefined) {
|
||||
return ["text", result]
|
||||
} else {
|
||||
result += c
|
||||
}
|
||||
} else if(state == "escape") {
|
||||
if(c == "<" || c == undefined) {
|
||||
err("Incorrect escape.")
|
||||
let m;
|
||||
if (m = buffer.match(/^&#([0-9]+)$/)) {
|
||||
result += String.fromCharCode(m[1])
|
||||
} else {
|
||||
if(self.entities[buffer]) {
|
||||
result += self.entities[buffer]
|
||||
} else {
|
||||
result += buffer
|
||||
}
|
||||
}
|
||||
return ["text", result]
|
||||
} else if(c == "&") {
|
||||
err("Incorrect escape.")
|
||||
result += buffer
|
||||
buffer = c
|
||||
} else if(/[a-z#0-9]/i.test(c)) {
|
||||
buffer += c
|
||||
} else if(c == ";") {
|
||||
let m;
|
||||
if (m = buffer.match(/^&#(x?[0-9]+)$/)) {
|
||||
// we prepend "0" so that x20 be interpreted as hexadecim (0x20)
|
||||
result += String.fromCharCode("0" + m[1])
|
||||
} else if(self.entities[buffer + c]) {
|
||||
result += self.entities[buffer + c]
|
||||
} else if (m = Object.keys(entities).find(n => buffer.startsWith(n))) { // partial match
|
||||
result += self.entities[m] + buffer.slice(m.length) + c
|
||||
} else {
|
||||
err("Incorrect escape.")
|
||||
result += buffer + ";"
|
||||
}
|
||||
state = "data"
|
||||
} else {
|
||||
err("Incorrect escape.")
|
||||
result += buffer + c
|
||||
state = "data"
|
||||
}
|
||||
} else if(state == "tag") {
|
||||
if(c == "\t" || c == "\n" || c == "\f" || c == " ") {
|
||||
state = "start tag annotation"
|
||||
} else if(c == ".") {
|
||||
state = "start tag class"
|
||||
} else if(c == "/") {
|
||||
state = "end tag"
|
||||
} else if(/\d/.test(c)) {
|
||||
result = c
|
||||
state = "timestamp tag"
|
||||
} else if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
return ["start tag", "", [], ""]
|
||||
} else {
|
||||
result = c
|
||||
state = "start tag"
|
||||
}
|
||||
} else if(state == "start tag") {
|
||||
if(c == "\t" || c == "\f" || c == " ") {
|
||||
state = "start tag annotation"
|
||||
} else if(c == "\n") {
|
||||
buffer = c
|
||||
state = "start tag annotation"
|
||||
} else if(c == ".") {
|
||||
state = "start tag class"
|
||||
} else if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
return ["start tag", result, [], ""]
|
||||
} else {
|
||||
result += c
|
||||
}
|
||||
} else if(state == "start tag class") {
|
||||
if(c == "\t" || c == "\f" || c == " ") {
|
||||
if (buffer) {
|
||||
classes.push(buffer)
|
||||
}
|
||||
buffer = ""
|
||||
state = "start tag annotation"
|
||||
} else if(c == "\n") {
|
||||
if (buffer) {
|
||||
classes.push(buffer)
|
||||
}
|
||||
buffer = c
|
||||
state = "start tag annotation"
|
||||
} else if(c == ".") {
|
||||
if (buffer) {
|
||||
classes.push(buffer)
|
||||
}
|
||||
buffer = ""
|
||||
} else if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
if (buffer) {
|
||||
classes.push(buffer)
|
||||
}
|
||||
return ["start tag", result, classes, ""]
|
||||
} else {
|
||||
buffer += c
|
||||
}
|
||||
} else if(state == "start tag annotation") {
|
||||
if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
buffer = buffer.split(/[\u0020\t\f\r\n]+/).filter(function(item) { if(item) return true }).join(" ")
|
||||
return ["start tag", result, classes, buffer]
|
||||
} else {
|
||||
buffer +=c
|
||||
}
|
||||
} else if(state == "end tag") {
|
||||
if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
return ["end tag", result]
|
||||
} else {
|
||||
result += c
|
||||
}
|
||||
} else if(state == "timestamp tag") {
|
||||
if(c == ">" || c == undefined) {
|
||||
if(c == ">") {
|
||||
pos++
|
||||
}
|
||||
return ["timestamp", result]
|
||||
} else {
|
||||
result += c
|
||||
}
|
||||
} else {
|
||||
err("Never happens.") // The joke is it might.
|
||||
}
|
||||
// 8
|
||||
pos++
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var WebVTTSerializer = function() {
|
||||
function serializeTimestamp(seconds) {
|
||||
const ms = ("00" + (seconds - Math.floor(seconds)).toFixed(3)*1000).slice(-3);
|
||||
let h = 0, m = 0, s = 0;
|
||||
if (seconds >= 3600) {
|
||||
h = Math.floor(seconds/3600);
|
||||
}
|
||||
m = Math.floor((seconds - 3600*h) / 60);
|
||||
s = Math.floor(seconds - 3600*h - 60*m);
|
||||
return (h ? h + ":" : "") + ("" + m).padStart(2, "0") + ":" + ("" + s).padStart(2, "0") + "." + ms;
|
||||
}
|
||||
function serializeCueSettings(cue) {
|
||||
var result = ""
|
||||
const nonDefaultSettings = Object.keys(defaultCueSettings).filter(s => cue[s] !== defaultCueSettings[s]);
|
||||
if (nonDefaultSettings.includes("direction")) {
|
||||
result+= " vertical:" + cue.direction
|
||||
}
|
||||
if (nonDefaultSettings.includes("alignment")) {
|
||||
result+= " align:" + cue.alignment
|
||||
}
|
||||
if (nonDefaultSettings.includes("size")) {
|
||||
result+= " size:" + cue.size + "%"
|
||||
}
|
||||
if (nonDefaultSettings.includes("lineAlign") || nonDefaultSettings.includes("linePosition")) {
|
||||
result += " line:" + cue.linePosition + (cue.snapToLines ? "" : "%") + (cue.lineAlign && cue.lineAlign != defaultCueSettings.lineAlign ? "," + cue.lineAlign : "")
|
||||
}
|
||||
if (nonDefaultSettings.includes("textPosition") || nonDefaultSettings.includes("positionAlign")) {
|
||||
result += " position:" + cue.textPosition + "%" + (cue.positionAlign && cue.positionAlign !== defaultCueSettings.positionAlign ? "," + cue.positionAlign : "")
|
||||
}
|
||||
return result
|
||||
}
|
||||
function serializeTree(tree) {
|
||||
var result = ""
|
||||
for (var i = 0; i < tree.length; i++) {
|
||||
var node = tree[i]
|
||||
if(node.type == "text") {
|
||||
result += node.value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||
} else if(node.type == "object") {
|
||||
result += "<" + node.name
|
||||
if(node.classes) {
|
||||
for(var y = 0; y < node.classes.length; y++) {
|
||||
result += "." + node.classes[y]
|
||||
}
|
||||
}
|
||||
if(node.value) {
|
||||
result += " " + node.value
|
||||
}
|
||||
result += ">"
|
||||
if(node.children)
|
||||
result += serializeTree(node.children)
|
||||
result += "</" + node.name + ">"
|
||||
} else if(node.type == "timestamp") {
|
||||
result += "<" + serializeTimestamp(node.value) + ">"
|
||||
} else {
|
||||
result += "<" + node.value + ">"
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
function serializeCue(cue) {
|
||||
return (cue.id !== undefined ? cue.id + "\n" : "")
|
||||
+ serializeTimestamp(cue.startTime)
|
||||
+ " --> "
|
||||
+ serializeTimestamp(cue.endTime)
|
||||
+ serializeCueSettings(cue)
|
||||
+ "\n" + serializeTree(cue.tree.children) + "\n\n"
|
||||
}
|
||||
function serializeStyle(style) {
|
||||
return "STYLE\n" + style + "\n\n"
|
||||
}
|
||||
this.serialize = function(cues, styles) {
|
||||
var result = "WEBVTT\n\n"
|
||||
if (styles) {
|
||||
for(var i=0;i<styles.length;i++) {
|
||||
result += serializeStyle(styles[i])
|
||||
}
|
||||
}
|
||||
for(var i=0;i<cues.length;i++) {
|
||||
result += serializeCue(cues[i])
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
function exportify(object) {
|
||||
object.WebVTTParser = WebVTTParser
|
||||
object.WebVTTCueTimingsAndSettingsParser = WebVTTCueTimingsAndSettingsParser
|
||||
object.WebVTTCueTextParser = WebVTTCueTextParser
|
||||
object.WebVTTSerializer = WebVTTSerializer
|
||||
}
|
||||
if (typeof window !== 'undefined') exportify(window);
|
||||
if (typeof exports !== 'undefined') exportify(exports);
|
||||
})()
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
import type Artplayer from 'artplayer';
|
||||
|
||||
export = artplayerPluginMultipleSubtitles;
|
||||
export as namespace artplayerPluginMultipleSubtitles;
|
||||
|
||||
declare const artplayerPluginMultipleSubtitles: (option: {
|
||||
subtitles: {
|
||||
url?: string;
|
||||
name?: string;
|
||||
type?: 'vtt' | 'srt' | 'ass';
|
||||
encoding?: string;
|
||||
}[];
|
||||
}) => (art: Artplayer) => {
|
||||
name: 'artplayerPluginMultipleSubtitles';
|
||||
};
|
||||
+19
-1
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,n,r,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},s="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function f(t,n){if(!u[t]){if(!e[t]){var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);if(l)return l(t,!0);if(s&&"string"==typeof t)return s(t);var a=new Error("Cannot find module '"+t+"'");throw a.code="MODULE_NOT_FOUND",a}d.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},d.cache={};var c=u[t]=new f.Module(t);e[t][0].call(c.exports,d,c,c.exports,this)}return u[t].exports;function d(e){var t=d.resolve(e);return!1===t?{}:f(t)}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=u,f.parent=l,f.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(f,"root",{get:function(){return i[r]}}),i[r]=f;for(var a=0;a<t.length;a++)f(t[a]);if(n){var c=f(n);"object"==typeof exports&&"undefined"!=typeof module?module.exports=c:"function"==typeof define&&define.amd&&define((function(){return c}))}}({YTqB2:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n);var o=e("./getVttArray"),i=r.interopDefault(o);function l(e){return async t=>{const{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await(0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",(async i=>{n(e,"display","block");const{second:l,width:s}=function(e,t){const{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth);return{width:i,second:i/n.clientWidth*e.duration}}(t,i),f=u.find((e=>l>=e.start&&l<=e.end));if(!f)return n(e,"display","none");n(e,"backgroundImage",`url(${f.url})`),n(e,"height",`${f.h}px`),n(e,"width",`${f.w}px`),n(e,"backgroundPosition",`-${f.x}px -${f.y}px`),s<=f.w/2?n(e,"left",0):s>o.clientWidth-f.w/2?n(e,"left",o.clientWidth-f.w+"px"):n(e,"left",s-f.w/2+"px")})),l(o,"mouseleave",(()=>{n(e,"display","none")})),t.on("hover",(t=>{t||n(e,"display","none")}))}}),{name:"artplayerPluginVttThumbnail"}}}n.default=l,l.env="production",l.version="1.0.0",l.build="2023-08-26 16:47:22","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){function r(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=(t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))),u=Number(l)/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+u}e("@parcel/transformer-js/src/esmodule-helpers.js").defineInteropFlag(n),n.default=async function(e=""){const t=(await(await fetch(e)).text()).split(/[\n\r]/gm).filter((e=>e.trim())),n=[];for(let o=1;o<t.length;o+=2){const i=t[o],l=t[o+1];if(!l.trim())continue;const u=/((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)(?: ?--> ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,s=i.match(u),f=/(.*)#(\w{4})=(.*)/i,a=l.match(f),c=Math.floor(r(s[1])),d=Math.floor(r(s[2])),p=e.split("/");p.pop(),p.push(a[1]);const h={start:c,end:d,url:p.join("/")},m=a[2].split(""),g=a[3].split(",");for(let e=0;e<m.length;e++)h[m[e]]=g[e];n.push(h)}return n}},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach((function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})})),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["YTqB2"],"YTqB2","parcelRequire4dc0");
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,n,r,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},l="function"==typeof i[r]&&i[r],u=l.cache||{},f="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,n){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[r]&&i[r];if(!n&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(l)return l(t,!0);// Try the node require function if it exists.
|
||||
if(f&&"string"==typeof t)return f(t);var s=Error("Cannot find module '"+t+"'");throw s.code="MODULE_NOT_FOUND",s}p.resolve=function(n){var r=e[t][1][n];return null!=r?r:n},p.cache={};var d=u[t]=new a.Module(t);e[t][0].call(d.exports,p,d,d.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=u,a.parent=l,a.register=function(t,n){e[t]=[function(e,t){t.exports=n},{}]},Object.defineProperty(a,"root",{get:function(){return i[r]}}),i[r]=a;for(var s=0;s<t.length;s++)a(t[s]);if(n){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var d=a(n);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=d:"function"==typeof define&&define.amd?define(function(){return d}):o&&(this[o]=d)}}({YTqB2:[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");r.defineInteropFlag(n),r.export(n,"default",()=>l);var o=e("./getVttArray"),i=r.interopDefault(o);function l(e){return async t=>{let{constructor:{utils:{setStyle:n,clamp:r}},template:{$progress:o},events:{proxy:l}}=t,u=await (0,i.default)(e.vtt);return t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted(e){l(o,"mousemove",async i=>{n(e,"display","block");let{second:l,width:f}=function(e,t){let{$progress:n}=e.template,{left:o}=n.getBoundingClientRect(),i=r(t.pageX-o,0,n.clientWidth),l=i/n.clientWidth*e.duration;return{width:i,second:l}}(t,i),a=u.find(e=>l>=e.start&&l<=e.end);if(!a)return n(e,"display","none");n(e,"backgroundImage",`url(${a.url})`),n(e,"height",`${a.h}px`),n(e,"width",`${a.w}px`),n(e,"backgroundPosition",`-${a.x}px -${a.y}px`),f<=a.w/2?n(e,"left",0):f>o.clientWidth-a.w/2?n(e,"left",`${o.clientWidth-a.w}px`):n(e,"left",`${f-a.w/2}px`)}),l(o,"mouseleave",()=>{n(e,"display","none")}),t.on("hover",t=>{t||n(e,"display","none")})}}),{name:"artplayerPluginVttThumbnail"}}}l.env="production",l.version="1.0.0",l.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=l)},{"./getVttArray":"4IFMi","@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"4IFMi":[function(e,t,n){var r=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e){var t,n,r,o=e.split("."),i=o[0].split(":")||[],l=Number((t=o[1]||"0",n=3,r="0",t.length>n?String(t):((n-=t.length)>r.length&&(r+=r.repeat(n/r.length)),String(t)+r.slice(0,n))))/1e3;return 3600*Number(i[i.length-3]||0)+60*Number(i[i.length-2]||0)+Number(i[i.length-1]||0)+l}async function i(e=""){let t=await (await fetch(e)).text(),n=t.split(/[\n\r]/gm).filter(e=>e.trim()),r=[];for(let t=1;t<n.length;t+=2){let i=n[t],l=n[t+1];if(!l.trim())continue;let u=/((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)(?: ?--> ?)((?:[0-9]{2}:)?(?:[0-9]{2}:)?[0-9]{2}(?:.[0-9]{3})?)/,f=i.match(u),a=/(.*)#(\w{4})=(.*)/i,s=l.match(a),d=Math.floor(o(f[1])),p=Math.floor(o(f[2])),c=s[1],h=/^\/|((https?|ftp|file):\/\/)/i.test(c);if(!h){let t=e.split("/");t.pop(),t.push(c),c=t.join("/")}let m={start:d,end:p,url:c},g=s[2].split(""),y=s[3].split(",");for(let e=0;e<g.length;e++)m[g[e]]=y[e];r.push(m)}return r}r.defineInteropFlag(n),r.export(n,"default",()=>i)},{"@parcel/transformer-js/src/esmodule-helpers.js":"9pCYc"}],"9pCYc":[function(e,t,n){n.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},n.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},n.exportAll=function(e,t){return Object.keys(e).forEach(function(n){"default"===n||"__esModule"===n||t.hasOwnProperty(n)||Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[n]}})}),t},n.export=function(e,t,n){Object.defineProperty(e,t,{enumerable:!0,get:n})}},{}]},["YTqB2"],"YTqB2","parcelRequire4dc0");
|
||||
+32
-1
@@ -4,4 +4,35 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},u="function"==typeof i[n]&&i[n],c=u.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!c[t]){if(!e[t]){var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);if(u)return u(t,!0);if(a&&"string"==typeof t)return a(t);var f=new Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=c[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return c[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=c,s.parent=u,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){var l=s(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd&&define((function(){return l}))}}({"2Oq25":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r);var o=e("@swc/helpers/src/_async_to_generator.mjs"),i=n.interopDefault(o),u=e("@swc/helpers/src/_ts_generator.mjs"),c=n.interopDefault(u),a=e("./getVttArray"),s=n.interopDefault(a);function f(e){return t=(0,i.default)((function(t){var r,n,o,u,a,f,l;return(0,c.default)(this,(function(p){switch(p.label){case 0:return r=t.constructor,n=r.utils,o=n.setStyle,u=n.clamp,a=t.template.$progress,f=t.events.proxy,[4,(0,s.default)(e.vtt)];case 1:return l=p.sent(),t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted:function(e){f(a,"mousemove",function(){var r=(0,i.default)((function(r){var n,i,s,f;return(0,c.default)(this,(function(c){return o(e,"display","block"),n=function(e,t){var r=e.template.$progress,n=r.getBoundingClientRect().left,o=u(t.pageX-n,0,r.clientWidth);return{width:o,second:o/r.clientWidth*e.duration}}(t,r),i=n.second,s=n.width,(f=l.find((function(e){return i>=e.start&&i<=e.end})))?(o(e,"backgroundImage","url(".concat(f.url,")")),o(e,"height","".concat(f.h,"px")),o(e,"width","".concat(f.w,"px")),o(e,"backgroundPosition","-".concat(f.x,"px -").concat(f.y,"px")),s<=f.w/2?o(e,"left",0):s>a.clientWidth-f.w/2?o(e,"left","".concat(a.clientWidth-f.w,"px")):o(e,"left","".concat(s-f.w/2,"px")),[2]):[2,o(e,"display","none")]}))}));return function(e){return r.apply(this,arguments)}}()),f(a,"mouseleave",(function(){o(e,"display","none")})),t.on("hover",(function(t){t||o(e,"display","none")}))}}),[2,{name:"artplayerPluginVttThumbnail"}]}}))})),function(e){return t.apply(this,arguments)};var t}r.default=f,f.env="production",f.version="1.0.0",f.build="2023-08-26 16:47:23","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=f)},{"@swc/helpers/src/_async_to_generator.mjs":"9vSoD","@swc/helpers/src/_ts_generator.mjs":"8UZjC","./getVttArray":"iUpz3","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"9vSoD":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_async_to_generator.js")},{"../esm/_async_to_generator.js":"eONSn","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,u){try{var c=e[i](u),a=c.value}catch(e){return void r(e)}c.done?t(a):Promise.resolve(a).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,i){var u=e.apply(t,r);function c(e){o(u,n,i,c,a,"next",e)}function a(e){o(u,n,i,c,a,"throw",e)}c(void 0)}))}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",(function(){return i})),n.export(r,"_",(function(){return i}))},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach((function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})})),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"8UZjC":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return o._}));var o=e("../esm/_ts_generator.js")},{"../esm/_ts_generator.js":"6Xyd0","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],"6Xyd0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_",(function(){return o.__generator})),n.export(r,"_ts_generator",(function(){return o.__generator})Line truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},a="function"==typeof i[n]&&i[n],u=a.cache||{},c="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function s(t,r){if(!u[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(a)return a(t,!0);// Try the node require function if it exists.
|
||||
if(c&&"string"==typeof t)return c(t);var f=Error("Cannot find module '"+t+"'");throw f.code="MODULE_NOT_FOUND",f}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var l=u[t]=new s.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return u[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:s(t)}}s.isParcelRequire=!0,s.Module=function(e){this.id=e,this.bundle=s,this.exports={}},s.modules=e,s.cache=u,s.parent=a,s.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(s,"root",{get:function(){return i[n]}}),i[n]=s;for(var f=0;f<t.length;f++)s(t[f]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var l=s(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):o&&(this[o]=l)}}({"2Oq25":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return c});var o=e("@swc/helpers/_/_async_to_generator"),i=e("@swc/helpers/_/_ts_generator"),a=e("./getVttArray"),u=n.interopDefault(a);function c(e){var t;return t=(0,o._)(function(t){var r,n,a,c,s,f;return(0,i._)(this,function(l){switch(l.label){case 0:return n=(r=t.constructor.utils).setStyle,a=r.clamp,c=t.template.$progress,s=t.events.proxy,[4,(0,u.default)(e.vtt)];case 1:return f=l.sent(),t.controls.add({name:"thumbnails",position:"top",index:20,style:e.style||{},mounted:function(e){var r;s(c,"mousemove",(r=(0,o._)(function(r){var o,u,s,l;return(0,i._)(this,function(i){var p,d,y,_;return(n(e,"display","block"),d=(p=t.template.$progress).getBoundingClientRect().left,_=(y=a(r.pageX-d,0,p.clientWidth))/p.clientWidth*t.duration,u=(o={width:y,second:_}).second,s=o.width,l=f.find(function(e){return u>=e.start&&u<=e.end}))?(n(e,"backgroundImage","url(".concat(l.url,")")),n(e,"height","".concat(l.h,"px")),n(e,"width","".concat(l.w,"px")),n(e,"backgroundPosition","-".concat(l.x,"px -").concat(l.y,"px")),s<=l.w/2?n(e,"left",0):s>c.clientWidth-l.w/2?n(e,"left","".concat(c.clientWidth-l.w,"px")):n(e,"left","".concat(s-l.w/2,"px")),[2]):[2,n(e,"display","none")]})}),function(e){return r.apply(this,arguments)})),s(c,"mouseleave",function(){n(e,"display","none")}),t.on("hover",function(t){t||n(e,"display","none")})}}),[2,{name:"artplayerPluginVttThumbnail"}]}})}),function(e){return t.apply(this,arguments)}}c.env="production",c.version="1.0.0",c.build="2023-11-23 23:21:56","undefined"!=typeof window&&(window.artplayerPluginVttThumbnail=c)},{"@swc/helpers/_/_async_to_generator":"eONSn","@swc/helpers/_/_ts_generator":"6Xyd0","./getVttArray":"iUpz3","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],eONSn:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");function o(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){r(e);return}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var a=e.apply(t,r);function u(e){o(a,n,i,u,c,"next",e)}function c(e){o(a,n,i,u,c,"throw",e)}u(void 0)})}}n.defineInteropFlag(r),n.export(r,"_async_to_generator",function(){return i}),n.export(r,"_",function(){return i})},{"@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],iWrD0:[function(e,t,r){r.interopDefault=function(e){return e&&e.__esModule?e:{default:e}},r.defineInteropFlag=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.exportAll=function(e,t){return Object.keys(e).forEach(function(r){"default"===r||"__esModule"===r||t.hasOwnProperty(r)||Object.defineProperty(t,r,{enumerable:!0,get:function(){return e[r]}})}),t},r.export=function(e,t,r){Object.defineProperty(e,t,{enumerable:!0,get:r})}},{}],"6Xyd0":[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"_",function(){return o.__generator}),n.export(r,"_ts_generator",function(){return o.__generator});var o=e("tslib")},{tslib:"c0d7h","@parcel/transformer-js/src/esmodule-helpers.js":"iWrD0"}],c0d7h:[function(e,t,r){/******************************************************************************
|
||||
Copyright (c) Microsoft Corporation.
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
||||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
PERFORMANCE OF THIS SOFTWARE.
|
||||
***************************************************************************** *//* global Reflect, Promise, SuppressedError, Symbol */var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"__extends",function(){return a}),n.export(r,"__assign",function(){return u}),n.export(r,"__rest",function(){return c}),n.export(r,"__decorate",function(){return s}),n.export(r,"__param",function(){return f}),n.export(r,"__esDecorate",function(){return l}),n.export(r,"__runInitializers",function(){return p}),n.export(r,"__propKey",function(){return d}),n.export(r,"__setFunctionName",function(){return y}),n.export(r,"__metadata",function(){return _}),n.export(r,"__awaiter",function(){return h}),n.export(r,"__generator",function(){return v}),n.export(r,"__createBinding",function(){return m}),n.export(r,"__exportStar",function(){return b}),n.export(r,"__values",function(){return g}),n.export(r,"__read",function(){return w}),/** @deprecated */n.export(r,"__spread",function(){return x}),/** @deprecated */n.export(r,"__spreadArrays",function(){return j}),n.export(r,"__spreadArray",function(){return O}),n.export(r,"__await",function(){return P}),n.export(r,"__asyncGenerator",function(){return S}),n.export(r,"__asyncDelegator",function(){return E}),n.export(r,"__asyncValues",function(){return T}),n.export(r,"__makeTemplateObject",function(){return D}),n.export(r,"__importStar",function(){return F}),n.export(r,"__importDefault",function(){return k}),n.export(r,"__classPrivateFieldGet",function(){return R}),n.export(r,"__classPrivateFieldSet",function(){return A}),n.export(r,"__classPrivateFieldIn",function(){return M}),n.export(r,"__addDisposableResource",function(){return W}),n.export(r,"__disposeResources",function(){return q});var o=e("@swc/helpers/_/_type_of"),i=function(e,t){return(i=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function a(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}i(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var u=function(){return(u=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function c(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)0>t.indexOf(n[o])&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(r[n[o]]=e[n[o]]);return r}function s(e,t,r,n){var o,i=arguments.length,a=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var u=e.length-1;u>=0;u--)(o=e[u])&&(a=(i<3?o(a):i>3?o(t,r,a):o(t,r))||a);return i>3&&a&&Object.defineProperty(t,r,a),a}function f(e,t){return function(r,n){t(r,n,e)}}function l(e,t,r,n,o,i){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var u,c=n.kind,s="getter"===c?"get":"setter"===c?"set":"value",f=!t&&e?n.static?e:e.prototype:null,l=t||(f?Object.getOwnPropertyDescriptor(f,n.name):{}),p=!1,d=r.length-1;d>=0;d--){var y={};for(var _ in n)y[_]="access"===_?{}:n[_];for(var _ in n.access)y.access[_]=n.access[_];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");i.push(a(e||null))};var h=(0,r[d])("accessor"===c?{get:l.get,set:l.set}:l[s],y);if("accessor"===c){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(u=a(h.get))&&(l.get=u),(u=a(h.set))&&(l.set=u),(u=a(h.init))&&o.unshift(u)}else(u=a(h))&&("field"===c?o.unshift(u):l[s]=u)}f&&Object.defineProperty(f,n.name,l),p=!0}function p(e,t,r){for(var n=arguments.length>2,o=0;o<t.length;o++)r=n?t[o].call(e,r):t[o].call(e);return n?r:void 0}function d(e){return(void 0===e?"undefined":(0,o._)(e))==="symbol"?e:"".concat(e)}function y(e,t,r){return(void 0===t?"undefined":(0,o._)(t))==="symbol"&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function _(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function h(e,t,r,n){return new(r||(r=Promise))(function(o,i){function a(e){try{c(n.next(e))}catch(e){i(e)}}function u(e){try{c(n.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(a,u)}c((n=n.apply(e,t||[])).next())})}function v(e,t){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"==typeof Sym
Line truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,i,n,o){var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof r[n]&&r[n],l=s.cache||{},h="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function a(t,i){if(!l[t]){if(!e[t]){var o="function"==typeof r[n]&&r[n];if(!i&&o)return o(t,!0);if(s)return s(t,!0);if(h&&"string"==typeof t)return h(t);var d=new Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},p.cache={};var u=l[t]=new a.Module(t);e[t][0].call(u.exports,p,u,u.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:a(t)}}a.isParcelRequire=!0,a.Module=function(e){this.id=e,this.bundle=a,this.exports={}},a.modules=e,a.cache=l,a.parent=s,a.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(a,"root",{get:function(){return r[n]}}),r[n]=a;for(var d=0;d<t.length;d++)a(t[d]);if(i){var u=a(i);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}}({eoujN:[function(e,t,i){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=e("./emitter"),r=n.interopDefault(o),s=e("./utils");class l extends r.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},l.DEFAULTS,e)),this.video=l.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",l.ondragover),this.option.fileInput.addEventListener("drop",l.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();const t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);const{fileInput:t,number:i,width:n,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==t.tagName||"file"!==t.type){t.style.position="relative";const e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach((e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)})),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){const e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){const t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){const t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);const i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then((()=>this.start()));const{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);const r=this.creatScreenshotDate(),l=this.creatCanvas(),h=l.getContext("2d");this.emit("canvas",l);const a=r.map(((i,n)=>()=>new Promise((r=>{this.video.oncanplay=()=>{h.drawImage(this.video,i.x,i.y,e,o),l.toBlob((e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()}))},this.video.currentTime=i.time}))));return this.processing=!0,(0,s.runPromisesInSeries)(a).then((()=>{this.processing=!1,this.emit("done")})).catch((e=>{throw this.processing=!1,this.emit("error",e.message),e}))}creatScreenshotDate(){const{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length<e;){const e=s[s.length-1];s.push(e+r)}return s.map(((e,o)=>({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i})))}creatCLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,i,n,o){/* eslint-disable no-undef */var r="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof r[n]&&r[n],l=s.cache||{},a="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function h(t,i){if(!l[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof r[n]&&r[n];if(!i&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(s)return s(t,!0);// Try the node require function if it exists.
|
||||
if(a&&"string"==typeof t)return a(t);var d=Error("Cannot find module '"+t+"'");throw d.code="MODULE_NOT_FOUND",d}p.resolve=function(i){var n=e[t][1][i];return null!=n?n:i},p.cache={};var u=l[t]=new h.Module(t);e[t][0].call(u.exports,p,u,u.exports,this)}return l[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:h(t)}}h.isParcelRequire=!0,h.Module=function(e){this.id=e,this.bundle=h,this.exports={}},h.modules=e,h.cache=l,h.parent=s,h.register=function(t,i){e[t]=[function(e,t){t.exports=i},{}]},Object.defineProperty(h,"root",{get:function(){return r[n]}}),r[n]=h;for(var d=0;d<t.length;d++)h(t[d]);if(i){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var u=h(i);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd?define(function(){return u}):o&&(this[o]=u)}}({eoujN:[function(e,t,i){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(i);var o=e("./emitter"),r=n.interopDefault(o),s=e("./utils");class l extends r.default{constructor(e={}){super(),this.processing=!1,this.option={},this.setup(Object.assign({},l.DEFAULTS,e)),this.video=l.creatVideo(),this.duration=0,this.inputChange=this.inputChange.bind(this),this.ondrop=this.ondrop.bind(this),this.option.fileInput.addEventListener("change",this.inputChange),this.option.fileInput.addEventListener("dragover",l.ondragover),this.option.fileInput.addEventListener("drop",l.ondrop)}static get DEFAULTS(){return{number:60,width:160,height:90,column:10,begin:0,end:NaN}}static ondragover(e){e.preventDefault()}ondrop(e){e.preventDefault();let t=e.dataTransfer.files[0];this.loadVideo(t)}setup(e={}){this.option=Object.assign({},this.option,e);let{fileInput:t,number:i,width:n,column:o}=this.option;if(this.errorHandle(t instanceof Element,"The 'fileInput' is not a Element"),!("INPUT"===t.tagName&&"file"===t.type)){t.style.position="relative";let e=document.createElement("input");e.type="file",e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.left="0",e.style.top="0",e.style.right="0",e.style.bottom="0",e.style.opacity="0",t.appendChild(e),this.option.fileInput=e}return["number","width","column","begin","end"].forEach(e=>{this.errorHandle("number"==typeof this.option[e],`The '${e}' is not a number`)}),this.option.number=(0,s.clamp)(i,10,1e3),this.option.width=(0,s.clamp)(n,10,1e3),this.option.column=(0,s.clamp)(o,1,1e3),this}static creatVideo(){let e=document.createElement("video");return e.style.position="absolute",e.style.top="-9999px",e.style.left="-9999px",e.muted=!0,e.controls=!0,document.body.appendChild(e),e}inputChange(e){let t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}loadVideo(e){if(e){let t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,`Playback of this file format is not supported: ${e.type}`);let i=URL.createObjectURL(e);this.videoUrl=i,this.file=e,this.emit("file",this.file),this.video.src=i,this.emit("video",this.video)}}start(){if(!this.video.duration)return(0,s.sleep)(1e3).then(()=>this.start());let{width:e,number:t,begin:i,end:n}=this.option,o=this.video.videoHeight/this.video.videoWidth*e;this.option.height=o,this.option.begin=(0,s.clamp)(i,0,this.video.duration),this.option.end=(0,s.clamp)(n||this.video.duration,i,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=t/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,`The preview density cannot be greater than 1, but got ${this.density}`);let r=this.creatScreenshotDate(),l=this.creatCanvas(),a=l.getContext("2d");this.emit("canvas",l);let h=r.map((i,n)=>()=>new Promise(r=>{this.video.oncanplay=()=>{a.drawImage(this.video,i.x,i.y,e,o),l.toBlob(e=>{this.thumbnailUrl&&URL.revokeObjectURL(this.thumbnailUrl),this.thumbnailUrl=URL.createObjectURL(e),this.emit("update",this.thumbnailUrl,(n+1)/t),this.video.oncanplay=null,r()})},this.video.currentTime=i.time}));return this.processing=!0,(0,s.runPromisesInSeries)(h).then(()=>{this.processing=!1,this.emit("done")}).catch(e=>{throw this.processing=!1,this.emit("error",e.message),e})}creatScreenshotDate(){let{number:e,width:t,height:i,column:n,begin:o}=this.option,r=this.duration/e,s=[o+r];for(;s.length<e;){let e=s[s.length-1];s.push(e+r)}return s.map((e,o)=>({time:e-r/2,x:o%n*t,y:Math.floor(o/n)*i}))}creatCanvas(){let{number:e,width:t,height:i,column:n}=this.option,o=document.createElement("canvas"),r=o.getContext("2d");return o.width=t*n,o.height=Math.ceil(e/n)*i+30,r.fillStyle="black",r.fillRect(0,0,o.width,o.height),r.font="14px Georgia",r.fillStyle="#fff",r.fillText(`From: https://artplayer.org/, Number: ${e}, Width: ${t}, Height: ${i}, Column: ${n}`,10,o.height-11),o}download(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");let e=document.createElement("a"),t=`${(0,s.getFileName)(this.file.name)}.png`;return e.download=t,e.href=this.thumbnailUrl,document.body.appendChild(e),e.click(),document.body.removeChild(e),this.emit("download",t),this}errorHandle(e,t){if(!e)throw this.emit("error",t),Error(t)}destroy(){this.option.fileInput.removeEventListener("change",this.inputChange),this.option.fileInput.removeEventListener("dragover",l.ondragover),this.option.fileInput.removeEventListener("drop",l.ondrop),Line truncated
|
||||
@@ -4,4 +4,22 @@
|
||||
* (c) 2017-2023 Harvey Zack
|
||||
* Released under the MIT License.
|
||||
*/
|
||||
!function(e,t,r,n,o){var s="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},i="function"==typeof s[n]&&s[n],a=i.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){var o="function"==typeof s[n]&&s[n];if(!r&&o)return o(t,!0);if(i)return i(t,!0);if(l&&"string"==typeof t)return l(t);var u=new Error("Cannot find module '"+t+"'");throw u.code="MODULE_NOT_FOUND",u}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new c.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=a,c.parent=i,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return s[n]}}),s[n]=c;for(var u=0;u<t.length;u++)c(t[u]);if(r){var f=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd&&define((function(){return f}))}}({esZVA:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",(function(){return v}));var o=e("@swc/helpers/src/_assert_this_initialized.mjs"),s=n.interopDefault(o),i=e("@swc/helpers/src/_class_call_check.mjs"),a=n.interopDefault(i),l=e("@swc/helpers/src/_create_class.mjs"),c=n.interopDefault(l),u=e("@swc/helpers/src/_inherits.mjs"),f=n.interopDefault(u),p=e("@swc/helpers/src/_create_super.mjs"),h=n.interopDefault(p),d=e("./emitter"),m=n.interopDefault(d),_=e("./utils"),v=function(e){"use strict";(0,f.default)(r,e);var t=(0,h.default)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,a.default)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,s.default)(e)),e.ondrop=e.ondrop.bind((0,s.default)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,c.default)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,s=r.width,i=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),"INPUT"!==n.tagName||"file"!==n.type){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach((function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))})),this.option.number=(0,_.clamp)(o,10,1e3),this.option.width=(0,_.clamp)(s,10,1e3),this.option.column=(0,_.clamp)(i,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,_.sleep)(1e3).then((function(){return e.start()}));var t=this.option,r=t.width,n=t.number,o=t.begin,s=t.end,i=this.video.videoHeight/this.video.videoWidth*r;this.option.height=i,this.option.begin=(0,_.clamp)(o,0,this.video.duration),this.option.end=(0,_.clamp)(s||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),c=l.getContext("2d");this.emit("canvas",l);var u=a.map((function(t,o){return function(){return new Promise((function(s){e.video.oncanplay=function(){c.drawImage(e.video,t.x,t.y,r,i),l.toBlob((function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplaLine truncated
|
||||
!// modules are defined as an array
|
||||
// [ module function, map of requires ]
|
||||
//
|
||||
// map of requires is short require name -> numeric require
|
||||
//
|
||||
// anything defined in a previous bundle is accessed via the
|
||||
// orig method which is the require for previous bundles
|
||||
function(e,t,r,n,o){/* eslint-disable no-undef */var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof i[n]&&i[n],a=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function u(t,r){if(!a[t]){if(!e[t]){// if we cannot find the module within our internal map or
|
||||
// cache jump to the current global require ie. the last bundle
|
||||
// that was added to the page.
|
||||
var o="function"==typeof i[n]&&i[n];if(!r&&o)return o(t,!0);// If there are other bundles on this page the require from the
|
||||
// previous one is saved to 'previousRequire'. Repeat this as
|
||||
// many times as there are bundles until the module is found or
|
||||
// we exhaust the require chain.
|
||||
if(s)return s(t,!0);// Try the node require function if it exists.
|
||||
if(l&&"string"==typeof t)return l(t);var c=Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){var n=e[t][1][r];return null!=n?n:r},p.cache={};var f=a[t]=new u.Module(t);e[t][0].call(f.exports,p,f,f.exports,this)}return a[t].exports;function p(e){var t=p.resolve(e);return!1===t?{}:u(t)}}u.isParcelRequire=!0,u.Module=function(e){this.id=e,this.bundle=u,this.exports={}},u.modules=e,u.cache=a,u.parent=s,u.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(u,"root",{get:function(){return i[n]}}),i[n]=u;for(var c=0;c<t.length;c++)u(t[c]);if(r){// Expose entry point to Node, AMD or browser globals
|
||||
// Based on https://github.com/ForbesLindesay/umd/blob/master/template.js
|
||||
var f=u(r);// CommonJS
|
||||
"object"==typeof exports&&"undefined"!=typeof module?module.exports=f:"function"==typeof define&&define.amd?define(function(){return f}):o&&(this[o]=f)}}({esZVA:[function(e,t,r){var n=e("@parcel/transformer-js/src/esmodule-helpers.js");n.defineInteropFlag(r),n.export(r,"default",function(){return p});var o=e("@swc/helpers/_/_assert_this_initialized"),i=e("@swc/helpers/_/_class_call_check"),s=e("@swc/helpers/_/_create_class"),a=e("@swc/helpers/_/_inherits"),l=e("@swc/helpers/_/_create_super"),u=e("./emitter"),c=n.interopDefault(u),f=e("./utils"),p=/*#__PURE__*/function(e){(0,a._)(r,e);var t=(0,l._)(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,i._)(this,r),(e=t.call(this)).processing=!1,e.option={},e.setup(Object.assign({},r.DEFAULTS,n)),e.video=r.creatVideo(),e.duration=0,e.inputChange=e.inputChange.bind((0,o._)(e)),e.ondrop=e.ondrop.bind((0,o._)(e)),e.option.fileInput.addEventListener("change",e.inputChange),e.option.fileInput.addEventListener("dragover",r.ondragover),e.option.fileInput.addEventListener("drop",r.ondrop),e}return(0,s._)(r,[{key:"ondrop",value:function(e){e.preventDefault();var t=e.dataTransfer.files[0];this.loadVideo(t)}},{key:"setup",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=this;this.option=Object.assign({},this.option,e);var r=this.option,n=r.fileInput,o=r.number,i=r.width,s=r.column;if(this.errorHandle(n instanceof Element,"The 'fileInput' is not a Element"),!("INPUT"===n.tagName&&"file"===n.type)){n.style.position="relative";var a=document.createElement("input");a.type="file",a.style.position="absolute",a.style.width="100%",a.style.height="100%",a.style.left="0",a.style.top="0",a.style.right="0",a.style.bottom="0",a.style.opacity="0",n.appendChild(a),this.option.fileInput=a}return["number","width","column","begin","end"].forEach(function(e){t.errorHandle("number"==typeof t.option[e],"The '".concat(e,"' is not a number"))}),this.option.number=(0,f.clamp)(o,10,1e3),this.option.width=(0,f.clamp)(i,10,1e3),this.option.column=(0,f.clamp)(s,1,1e3),this}},{key:"inputChange",value:function(e){var t=this.option.fileInput.files[0];this.loadVideo(t),e.target.value=""}},{key:"loadVideo",value:function(e){if(e){var t=this.video.canPlayType(e.type);this.errorHandle("maybe"===t||"probably"===t,"Playback of this file format is not supported: ".concat(e.type));var r=URL.createObjectURL(e);this.videoUrl=r,this.file=e,this.emit("file",this.file),this.video.src=r,this.emit("video",this.video)}}},{key:"start",value:function(){var e=this;if(!this.video.duration)return(0,f.sleep)(1e3).then(function(){return e.start()});var t=this.option,r=t.width,n=t.number,o=t.begin,i=t.end,s=this.video.videoHeight/this.video.videoWidth*r;this.option.height=s,this.option.begin=(0,f.clamp)(o,0,this.video.duration),this.option.end=(0,f.clamp)(i||this.video.duration,o,this.video.duration),this.errorHandle(this.option.end>this.option.begin,"End time must be greater than the start time"),this.duration=this.option.end-this.option.begin,this.density=n/this.duration,this.errorHandle(this.file&&this.video,"Please select the video file first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment..."),this.errorHandle(this.density<=1,"The preview density cannot be greater than 1, but got ".concat(this.density));var a=this.creatScreenshotDate(),l=this.creatCanvas(),u=l.getContext("2d");this.emit("canvas",l);var c=a.map(function(t,o){return function(){return new Promise(function(i){e.video.oncanplay=function(){u.drawImage(e.video,t.x,t.y,r,s),l.toBlob(function(t){e.thumbnailUrl&&URL.revokeObjectURL(e.thumbnailUrl),e.thumbnailUrl=URL.createObjectURL(t),e.emit("update",e.thumbnailUrl,(o+1)/n),e.video.oncanplay=null,i()})},e.video.currentTime=t.time})}});return this.processing=!0,(0,f.runPromisesInSeries)(c).then(function(){e.processing=!1,e.emit("done")}).catch(function(t){throw e.processing=!1,e.emit("error",t.message),t})}},{key:"creatScreenshotDate",value:function(){for(var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,i=e.begin,s=this.duration/t,a=[i+s];a.length<t;){var l=a[a.length-1];a.push(l+s)}return a.map(function(e,t){return{time:e-s/2,x:t%o*r,y:Math.floor(t/o)*n}})}},{key:"creatCanvas",value:function(){var e=this.option,t=e.number,r=e.width,n=e.height,o=e.column,i=document.createElement("canvas"),s=i.getContext("2d");return i.width=r*o,i.height=Math.ceil(t/o)*n+30,s.fillStyle="black",s.fillRect(0,0,i.width,i.height),s.font="14px Georgia",s.fillStyle="#fff",s.fillText("From: https://artplayer.org/, Number: ".concat(t,", Width: ").concat(r,", Height: ").concat(n,", Column: ").concat(o),10,i.height-11),i}},{key:"download",value:function(){this.errorHandle(this.file&&this.thumbnailUrl,"Download does not seem to be ready, please create preview first"),this.errorHandle(!this.processing,"There is currently a task in progress, please wait a moment...");var e=document.createElement("a"),t="".concat(Line truncated
|
||||
@@ -107,23 +107,6 @@ art.on('restart', (url) => {
|
||||
});
|
||||
```
|
||||
|
||||
## `loop`
|
||||
|
||||
当出现区间循环时触发
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{6}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('loop', (start, end) => {
|
||||
console.info('loop', start, end);
|
||||
});
|
||||
```
|
||||
|
||||
## `pause`
|
||||
|
||||
当播放器暂停时触发
|
||||
|
||||
@@ -661,36 +661,6 @@ art.on('ready', () => {
|
||||
});
|
||||
```
|
||||
|
||||
## `loop`
|
||||
|
||||
- Type: `Setter/Getter`
|
||||
- Parameter: `Array`
|
||||
|
||||
Set and obtain interval sequential playback in seconds
|
||||
|
||||
<div className="run-code">▶ Run Code</div>
|
||||
|
||||
```js{8}
|
||||
var art = new Artplayer({
|
||||
container: '.artplayer-app',
|
||||
url: '/assets/sample/video.mp4',
|
||||
});
|
||||
|
||||
art.on('ready', () => {
|
||||
console.info(art.loop);
|
||||
art.loop = [5, 10];
|
||||
console.info(art.loop);
|
||||
});
|
||||
```
|
||||
|
||||
:::warning Tip
|
||||
|
||||
To delete interval looping, just set `loop` to `[]`
|
||||
|
||||
`art.loop` and `art.option.loop` aer two different things, please don't mix them up
|
||||
|
||||
:::
|
||||
|
||||
## `autoHeight`
|
||||
|
||||
- Type: `Setter/Getter`
|
||||
|
||||
@@ -32,3 +32,15 @@ export function escape(str) {
|
||||
})[tag] || tag,
|
||||
);
|
||||
}
|
||||
|
||||
export function unescape(str) {
|
||||
const map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
''': "'",
|
||||
'"': '"',
|
||||
};
|
||||
const reg = new RegExp(`(${Object.keys(map).join('|')})`, 'g');
|
||||
return str.replace(reg, (tag) => map[tag] || tag);
|
||||
}
|
||||
Reference in new issue
Block a user