artplayer

播放器

Ovu skriptu ne treba izravno instalirati. To je biblioteka za druge skripte koje se uključuju u meta direktivu // @require https://update.greasyfork.org/scripts/564437/1778031/artplayer.js

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

window.artPlugins=window.artPlugins||function(t){var e={version:"1.1.9",init:t=>Promise.all([e.readyHls(),e.readyArtplayer(),e.readySupported()]).then(()=>e.initArtplayer(t)),readyHls:()=>{return window.Hls||unsafeWindow.Hls?Promise.resolve():e.loadJs("https://cdnjs.cloudflare.com/ajax/libs/hls.js/1.4.14/hls.min.js")},readyArtplayer:()=>{return window.Artplayer||unsafeWindow.Artplayer?Promise.resolve():e.loadJs("https://cdnjs.cloudflare.com/ajax/libs/artplayer/5.2.2/artplayer.min.js")},readySupported:()=>Promise.resolve(t).then(t=>{const{version:o}=e,n=GM_getValue("art-"+o,0),a=t.reduce((t,e)=>t+e.toString().length,0);if(n){if(new Set([n,a]).size>1)return Promise.reject()}else GM_setValue("art-"+o,a)}),initArtplayer:e=>{const o=window.Artplayer||unsafeWindow.Artplayer,{isMobile:n}=o.utils;return Object.assign(o,{ASPECT_RATIO:["default","自动","4:3","16:9"],AUTO_PLAYBACK_TIMEOUT:1e4,NOTICE_TIME:5e3}),new o(e=Object.assign({container:"#artplayer",url:"",quality:[],type:"hls",autoplay:!0,autoPlayback:!0,aspectRatio:!0,contextmenu:[],customType:{hls:(t,e,o)=>{const n=window.Hls||unsafeWindow.Hls;if(n.isSupported()){o.hls&&o.hls.destroy();const a=new n({maxBufferLength:10*n.DefaultConfig.maxBufferLength,xhrSetup:(t,e)=>{const n=(e.match(/^http(?:s)?:\/\/(.*?)\//)||[])[1];if(n!==location.host){if(/backhost=/.test(e)){var a,s=(decodeURIComponent(e||"").match(/backhost=(\[.*?\])/)||[])[1];if(s){try{a=JSON.parse(s)}catch(t){}if(a&&a.length){const t=(a=[].concat(a,[n])).findIndex(t=>t===o.realHost);o.realHost=a[t+1>=a.length?0:t+1]}}}o.realHost&&(e=e.replace(n,o.realHost),t.open("GET",e,!0))}}});a.loadSource(e),a.attachMedia(t),a.on(n.Events.ERROR,(t,e)=>{if(e.fatal)switch(e.type){case n.ErrorTypes.NETWORK_ERROR:e.details===n.ErrorDetails.MANIFEST_LOAD_ERROR?setTimeout(()=>a.loadSource(a.url),1e3):e.details===n.ErrorDetails.MANIFEST_LOAD_TIMEOUT||e.details===n.ErrorDetails.MANIFEST_PARSING_ERROR?a.loadSource(a.url):e.details===n.ErrorDetails.FRAG_LOAD_ERROR?(a.fragLoadError=(a.fragLoadError||0)+1)<5?(a.loadSource(a.url),a.media.currentTime=o.currentTime,a.media.play()):(a.destroy(),o.notice.show="视频播放错误次数过多,请刷新重试"):setTimeout(()=>a.startLoad(),1e3);break;case n.ErrorTypes.MEDIA_ERROR:a.recoverMediaError();break;default:a.destroy(),o.notice.show="视频播放异常,请刷新重试"}}),o.hls=a,o.on("destroy",()=>a.destroy())}else t.canPlayType("application/vnd.apple.mpegurl")?t.src=e:(alert("不支持的播放格式:m3u8"),o.notice.show="Unsupported playback format: m3u8")}},flip:!1,icons:{loading:'<img src="https://artplayer.org/assets/img/ploading.gif">',state:'<img width="150" heigth="150" src="https://artplayer.org/assets/img/state.svg">',indicator:'<img width="16" heigth="16" src="https://artplayer.org/assets/img/indicator.svg">'},id:"",pip:!n,poster:"",playbackRate:!1,screenshot:!0,setting:!0,subtitle:{url:"",type:"auto",style:{color:"#fe9200",bottom:"5%",fontSize:"25px",fontWeight:400,fontFamily:"",textShadow:""},encoding:"utf-8",escape:!1},subtitleOffset:!1,hotkey:!0,fullscreen:!0,fullscreenWeb:!n},e),e=>{t.forEach(t=>{e.plugins.add(t())})})},loadJs:t=>(window.instances||(window.instances={}),window.instances[t]||(window.instances[t]=new Promise((e,o)=>{const n=document.createElement("script");n.src=t,n.type="text/javascript",n.onload=e,n.onerror=o,Node.prototype.appendChild.call(document.head,n)})),window.instances[t])};return console.info(`%c artPlugins %c ${e.version} %c https://scriptcat.org/zh-CN/users/13895`,"color: #fff; background: #5f5f5f","color: #fff; background: #4bc729",""),e}([()=>t=>{const e=window.Hls||unsafeWindow.Hls,{hls:o,layers:n,notice:a,storage:s,constructor:{CONTEXTMENU:r,utils:{query:i,append:l,setStyle:c,clamp:u,debounce:p,throttle:d}}}=t;
function h(){
    // [永久解锁核心逻辑]
    // 不再依赖网络请求 (g() 和 m()),直接本地构造完美数据
    
    console.log("[Unlock] 触发验证检查 -> 强制返回永久有效数据");

    // 1. 获取当前百度账号 UID (用于通过身份校验)
    var currentUk = "0";
    try {
        if (typeof unsafeWindow !== 'undefined' && unsafeWindow.locals) {
            currentUk = (typeof unsafeWindow.locals.get === 'function') 
                ? unsafeWindow.locals.get("uk") 
                : unsafeWindow.locals.uk;
        }
    } catch (e) {
        console.warn("[Unlock] 未能获取百度 UK,使用默认值", e);
    }

    // 2. 构造“永不过期”的时间戳
    var now = new Date();
    var foreverDate = new Date("2099-12-31T23:59:59.999Z");
    
    // 3. 构造伪造的用户对象
    // 关键点:updatedAt 设为现在,expire_time 设为 2099 年
    var fakeUserData = {
        ON: true,               // 激活状态:是
        check: 999999,          // 检查次数:无限
        expire_time: foreverDate.toISOString(), // 过期时间:2099年
        updatedAt: now.toISOString(),           // 更新时间:就在这一秒 (欺骗时间差校验)
        authData: {
            baidu: {
                uid: "" + currentUk // 确保 UID 与当前登录账号一致
            }
        },
        // 模拟原始对象的 toJSON 方法,确保外部调用时也能拿到假数据
        toJSON: function() {
            return {
                ON: this.ON,
                check: this.check,
                expire_time: this.expire_time,
                updatedAt: this.updatedAt,
                authData: this.authData
            };
        },
        attributes: {
            ON: true,
            check: 999999,
            expire_time: foreverDate.toISOString()
        },
        _handleSaveResult: function() {
            return Promise.resolve(this);
        }
    };

    // 4. 构造模拟的上下文对象 (模拟 t.User.current() 的返回值)
    var mockContext = {
        User: {
            current: function() {
                return fakeUserData;
            }
        },
        // 模拟路径生成,防止报错
        _getAVPath: function(key) {
            // 返回一个假的 base64 编码的过期时间,以通过完整性校验
            // 原代码校验: s.get(...) === btoa(encodeURIComponent(JSON.stringify(r)))
            // 我们这里不需要真的去 s.get 存,因为我们可以控制逻辑不走那条路,
            // 或者我们直接让校验通过。
            // 为了保险,我们返回伪造数据对应的校验值
            return btoa(encodeURIComponent(JSON.stringify(foreverDate.toISOString())));
        },
        User_CURRENT_USER_KEY: "fake_key"
    };

    // 5. 直接返回成功的 Promise
    // 原逻辑是: return g().then(t => { ... })
    // 新逻辑是: return Promise.resolve(mockContext).then(t => { ... })
    // 这样完全跳过了网络请求,且返回的数据绝对符合“永不过期”的数学逻辑
    
    return Promise.resolve(mockContext).then(function(t) {
        var e = t.User.current();
        if (!e) return Promise.reject("No user");
        
        // 这里其实已经不需要再做任何判断了,因为数据是我们造的,肯定满足条件
        // 但为了保持与原脚本后续流程兼容,我们直接返回 e
        console.log("[Unlock] 验证通过!剩余时间:约 74 年。功能已解锁。");
        return e;
    });
}
function m(){return g().then(t=>fetch("https://pan.baidu.com/rest/2.0/xpan/nas?method=uinfo").then(t=>t.ok?t.json():Promise.reject()).then(t=>t&&0===t.errno?t:Promise.reject()).then(e=>{const o=new t.User;return o.set("uinfo",e),o.set("gminfo",GM_info),o.set("pnum",s.get("pnum")),o.loginWithAuthData({uid:""+e.uk},"baidu").then(e=>{delete e.attributes.uinfo,delete e.attributes.gminfo;const{createdAt:o,updatedAt:n}=e.toJSON();o===n&&Object.assign(e.attributes,{expire_time:new Date(Date.now()+864e5).toISOString()}),e._handleSaveResult(!0);const{expire_time:a}=e.toJSON();return s.set(t._getAVPath(t.User._CURRENT_USER_KEY),btoa(encodeURIComponent(JSON.stringify(a)))),e})}))}function g(){const e=window.AV||unsafeWindow.AV;return e?(e.applicationId||e.init({appId:"sXXf4FFOZn2nFIj7LOFsqpLa-gzGzoHsz",appKey:"16s3qYecpVJXtVahasVxxq1V",serverURL:"https://sxxf4ffo.lc-cn-n1-shared.com"}),Promise.resolve(e)):Promise.reject(t.destroy())}function f(){n.cache.get("sponsor")||n.update({name:"sponsor",html:'\n                                   <div style="padding: 5px;"><div>喜欢这个脚本吗</div><div>赞助后可使用所有增强功能</div></div>\n                                   <div style="padding: 5px;min-width: 280px;display: flex;flex-wrap: nowrap;">\n                                       <button id="open-afdian" style="padding: 5px; margin: 0 5px;border: none; border-radius: 3px; background: #09aaff; color: white; cursor: pointer;flex: 1 1 0;">打开爱发电</button>\n                                       <button id="copy-order" style="padding: 5px; margin: 0 5px;border: none; border-radius: 3px; background: #09aaff; color: white; cursor: pointer;flex: 1 1 0;">复制订单号</button>\n                                       <button id="update-script" style="padding: 5px; margin: 0 5px;border: none; border-radius: 3px; background: #09aaff; color: white; cursor: pointer;flex: 1 1 0;">检查更新</button>\n                                   </div>\n                                   <div style="padding: 5px"><input type="text" id="order-input" placeholder="输入爱发电订单号,体验更多功能" style="min-width: 250px;padding: 5px;border: none;border-radius: 3px;color: #000;" autocomplete="off"></div>\n                                   <div style="border-top: 1px solid #c6c6c6;display: flex;flex-wrap: nowrap;">\n                                       <button id="cancel-order" style="padding: 5px; border: none; border-radius: 3px; background: #ff5555; color: white; cursor: pointer;flex: 1 1 0;">取消</button>\n                                       <button id="submit-order" style="padding: 5px; border: none; border-radius: 3px; background: #ffad00; color: white; cursor: pointer;flex: 1 1 0;">提交</button>\n                                   </div>\n                            ',tooltip:"感谢支持,赞助后不再提示",style:{position:"absolute",left:"50%",top:"50%",transform:"translate(-50%, -50%)",background:"rgba(0, 0, 0, 0.7)",border:"1px solid #c6c6c6",borderRadius:"8px",textAlign:"center"},click:(e,o)=>{o.isTrusted||t.destroy(),t.mask.show=!1,t.loading.show=!1},mounted:e=>{t.pause();try{o.pauseBuffering()}catch(t){o.stopLoad()}setTimeout(()=>{t.mask.show=!1,t.loading.show=!1,t.controls.show=!1,t.setting.show=!1,t.constructor.CONTEXTMENU=!1},500);const n=i("#open-afdian",e),r=i("#copy-order",e),l=i("#update-script",e);t.proxy(n,"click",()=>{window.open("https://afdian.com/order/create?plan_id=dc4bcdfa5c0a11ed8ee452540025c377","_blank")}),t.proxy(r,"click",()=>{window.open("https://afdian.com/dashboard/order","_blank")}),t.proxy(l,"click",()=>{window.open("https://scriptcat.org/scripts/code/340/%E7%99%BE%E5%BA%A6%E7%BD%91%E7%9B%98%E8%A7%86%E9%A2%91%E6%92%AD%E6%94%BE%E5%99%A8.user.js","_blank")});const c=i("#order-input",e),p=i("#cancel-order",e),d=i("#submit-order",e);t.proxy(p,"click",({isTrusted:t})=>{t&&b()}),t.proxy(d,"click",({isTrusted:t})=>{if(t&&c.value){const t=c.value.trim();if(t.match(/^202[\d]{22,25}$/)){if(t.match(/(\d)\1{7,}/g))return;(function(t){t=t.slice(0,14);const[,e,o,n,a,s,r]=(t.match(/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/)||[]).map(Number);return 5===[u(o,1,12)===o,u(n,1,31)===n,u(a,0,23)===a,u(s,0,59)===s,u(r,0,59)===r].filter(Boolean).length})(t)&&function(t){const e=s.get(t)||0;if(s.set(t,e+1),!(e>33))g().then(e=>h().then(o=>{const{authData:n,expire_time:a,shortId:r,username:i}=o.toJSON(),l=new(e.Object.extend("baidu"));l.set("ON",t),l.set("gminfo",GM_info),l.set("pnum",s.get(t));for(let[t,e]of Object.entries({authData:n,expire_time:a,shortId:r,username:i}))l.set(t,e);return l.save().then(n=>{Object.assign(o.attributes,{ON:t,check:3,expire_time:new Date(Date.now()+864e3).toISOString()});const{expire_time:a}=o.toJSON();return s.set(e._getAVPath(e.User._CURRENT_USER_KEY),btoa(encodeURIComponent(JSON.stringify(a)))),o._handleSaveResult(!0)})}))}(t),b()}else a.show="此订单号不合规范,请重试"}else a.show="请输入订单号"})}})}function b(){if(n.cache.get("sponsor")){n.remove("sponsor"),t.constructor.CONTEXTMENU=r;try{o.resumeBuffering()}catch(t){o.startLoad()}}}function x(){t.contextmenu.update({index:51,html:"更多功能",click:()=>{f(),t.contextmenu.show=!1}}),t.contextmenu.update({index:52,html:"鼓励一下",click:()=>{window.open("https://pc-index-skin.cdn.bcebos.com/6cb0bccb31e49dc0dba6336167be0a18.png","_blank"),t.contextmenu.show=!1}}),t.setting.update({html:"赞赏作者",name:"author-setting",tooltip:"",selector:[{html:"更多功能",value:0},{html:"鼓励一下",value:1}],onSelect:t=>(0===t.value?f():1===t.value&&window.open("https://pc-index-skin.cdn.bcebos.com/6cb0bccb31e49dc0dba6336167be0a18.png","_blank"),"")});let n=Number(s.get("pnum")||0);s.set("pnum",++n),t.on("video:ended",()=>{h().then(e=>{const{expire_time:o}=e.toJSON();Math.max(Date.parse(o)-Date.now(),0)||t.layers.update({name:"potser",html:'<img style="width: 300px" src="https://pc-index-skin.cdn.bcebos.com/6cb0bccb31e49dc0dba6336167be0a18.png">',tooltip:"",style:{position:"absolute",top:"50px",right:"50px"},click:(t,e)=>{window.open(e.target.src,"_blank")}})})}),o.on(e.Events.FRAG_LOADED,d((e,o)=>{h().then(e=>{t.emit("user",e.toJSON()),t.once("user",({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?b():f()})})},1e3*u(420,t.duration/100,t.duration/3)))}return t.isReady?x():t.once("ready",x),{name:"user",userJSON:function(){return h().then(t=>t.toJSON())},show:f}},()=>t=>{const{i18n:e,option:o,notice:n,storage:a,controls:s,constructor:{utils:{isMobile:r,setStyle:i}}}=t;function l(t){return r?t.split(/\s/).shift():t}function c(){const{file:r,quality:i,getUrl:c,adToken:u}=o,[,p,d]=((r||{}).resolution||"").match(/width:(\d+),height:(\d+)/),h=+p*+d;h>2073600&&i.unshift({html:"2K 1440P",url:c("M3U8_AUTO_2K")+"&adToken="+encodeURIComponent(u),default:!1,type:"hls"}),h>3686400&&i.unshift({html:"4K 2160P",url:c("M3U8_AUTO_4K")+"&adToken="+encodeURIComponent(u),default:!1,type:"hls"});const m=i.find(t=>t.default)||i[0];s.update({name:"quality",html:m?l(m.html):"",selector:i.map((t,e)=>({...t})),onSelect:o=>(t.switchQuality(o.url),n.show=`${e.get("Switch Video")}: ${o.html}`,a.set("quality",l(o.html)),l(o.html)),mounted:()=>{const e=a.get("quality");if(e){const o=s.cache.get("quality").option.selector.find(t=>l(t.html)===e);o&&!o.default&&(t.switchQuality(o.url),s.check(o))}}})}function u(){t.once("user",({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){c();let e=o.id;t.on("restart",()=>{if(e===o.id){const e=t.layers.cache.get("auto-playback");if(e){const{$ref:t}=e;i(t,"display","none")}}else e=o.id,c()})}})}return t.isReady?u():t.once("ready",u),{name:"quality"}},()=>t=>{const{i18n:e,proxy:o,option:n,controls:a,constructor:{utils:{query:s,isMobile:r}}}=t,i={showtext:!r,icon:'<i class="art-icon"><svg class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" width="22" height="22"><path d="M810.666667 384H85.333333v85.333333h725.333334V384z m0-170.666667H85.333333v85.333334h725.333334v-85.333334zM85.333333 640h554.666667v-85.333333H85.333333v85.333333z m640-85.333333v256l213.333334-128-213.333334-128z" fill="#ffffff"></path></svg></i>'};function l(){t.once("user",({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)&&function(t=[]){t.length<=1?a.cache.get("PlayList")&&a.remove("playlist"):a.update({html:i.showtext?e.get("PlayList"):i.icon,name:"playlist",position:"right",style:{paddingLeft:"10px",paddingRight:"10px"},selector:t.map((t,e)=>({...t,html:t.name,style:{textAlign:"left"}})),onSelect:t=>(n.file=t,"function"==typeof t.open&&t.open(),i.showtext?e.get("PlayList"):i.icon),mounted:()=>{const t=a.cache.get("playlist"),{$ref:e,option:{selector:n}}=t,r=s(".art-selector-list",e),i=s(".art-selector-value",e),l=r.offsetHeight,c=r.firstElementChild.offsetHeight;o(i,"click",t=>{const e=n.findIndex(t=>t.default);r.scrollTop=(e+1)*c-l/2})}})}(n.filelist)})}return e.update({"zh-cn":{PlayList:"播放列表"}}),t.isReady?l():t.once("ready",l),{name:"playlist"}},()=>t=>{const{i18n:e,icons:o,option:n,layers:a,storage:s,plugins:r,setting:i,contextmenu:l,constructor:{PLAYBACK_RATE:c,SETTING_ITEM_WIDTH:u,utils:{query:p,append:d,setStyle:h,inverseClass:m}}}=t;function g(){return a["auto-playbackrate"]||a.update({name:"auto-playbackrate",html:`<div>播放速度</div><input type="number" value="${t.playbackRate}" style="min-height: 20px;border: none; border-radius: 3px;text-align: center;" step=".01" max="16" min=".1"><div class="art-auto-playback-close"><i class="art-icon art-icon-close"><svg class="icon" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg" width="22" height="22" style="fill: var(--art-theme);width: 15px;height: 15px;"><path d="m571.733 512 268.8-268.8c17.067-17.067 17.067-42.667 0-59.733-17.066-17.067-42.666-17.067-59.733 0L512 452.267l-268.8-268.8c-17.067-17.067-42.667-17.067-59.733 0-17.067 17.066-17.067 42.666 0 59.733l268.8 268.8-268.8 268.8c-17.067 17.067-17.067 42.667 0 59.733 8.533 8.534 19.2 12.8 29.866 12.8s21.334-4.266 29.867-12.8l268.8-268.8 268.8 268.8c8.533 8.534 19.2 12.8 29.867 12.8s21.333-4.266 29.866-12.8c17.067-17.066 17.067-42.666 0-59.733L571.733 512z"></path></svg></i></div>`,tooltip:"",style:{"border-radius":"var(--art-border-radius)",left:"var(--art-padding)",bottom:"calc(var(--art-control-height) + var(--art-bottom-gap) + 10px)","background-color":"var(--art-widget-background)","align-items":"center",gap:"10px",padding:"10px","line-height":1,display:"none",position:"absolute"},mounted:e=>{const o=p("input",e),n=p(".art-auto-playback-close",e);t.proxy(o,"change",()=>{const e=o.value;t.playbackRate=e}),t.proxy(n,"click",()=>{h(e,"display","none")})}})}function f(t){return 1===t?e.get("Normal"):t?t.toFixed(2):e.get("Custom")}function b(){return c.includes(t.playbackRate)?t.playbackRate:0}function x(){const t=i.find(`playback-rate-${b()}`);t&&i.check(t)}function y(){t.once("user",({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){t.on("video:ratechange",()=>s.set("playbackRate",t.playbackRate));const e=s.get("playbackRate");e&&(t.playbackRate=Number(e))}else t.on("video:ratechange",()=>{b()||(t.playbackRate=1)})})}return e.update({"zh-cn":{Custom:"自定义"}}),c.unshift(0),i.update({width:u,name:"playback-rate",html:e.get("Play Speed"),tooltip:f(t.playbackRate),icon:o.playbackRate,selector:c.map(t=>({value:t,name:`playback-rate-${t}`,default:t===b(),html:f(t)})),onSelect(e){if(e.value)t.playbackRate=e.value,h(g(),"display","none");else{const{userJSON:e,show:o}=r.user;e().then(({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){p("input",g()).value=t.playbackRate,h(g(),"display","flex")}else o()})}return e.html},mounted:()=>{x(),t.on("video:ratechange",()=>x())}}),l.update({index:10,name:"playbackRate",html:`${e.get("Play Speed")}: ${c.map(t=>`<span data-value="${t}">${f(t)}</span>`).join("")}`,click:(e,o)=>{e.show=!1;const{value:n}=o.target.dataset;if(Number(n))t.playbackRate=Number(n),h(g(),"display","none");else{const{userJSON:e,show:o}=r.user;e().then(({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){p("input",g()).value=t.playbackRate,h(g(),"display","flex")}else o()})}},mounted:e=>{const o=p(`[data-value='${b()}']`,e);o&&m(o,"art-current"),t.on("video:ratechange",()=>{const t=p(`[data-value='${b()}']`,e);t&&m(t,"art-current")})}}),t.isReady?y():t.once("ready",y),{name:"playbackRate"}},()=>t=>{const{i18n:e,option:o,notice:n,storage:a,plugins:s,setting:r,controls:i,template:l,subtitle:c,contextmenu:u,constructor:{utils:{isMobile:p,append:d,query:h,inverseClass:m}}}=t,g={showtext:!p,icon:'<i class="art-icon"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 48 48"><path d="M0 0h48v48H0z" fill="none"/><path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/></svg></i>',tooltip:'<label style="font-size: 0;padding: 4px;display: inline-block;"><span style="width: 20px;height: 20px;display: inline-block;border-radius: 50%;box-sizing: border-box;cursor: pointer;background: #FE9200;"></span></label>'};function f(t){return b(t).then(t=>(function(t){const e=new Blob([t],{type:"text/plain"});return URL.createObjectURL(e)})(t))}function b(t){return new Promise((e,o)=>{var n=new FileReader;n.readAsText(t,"UTF-8"),n.onload=(o=>{var a=n.result;return a.indexOf("�")>-1&&!n.markGBK?(n.markGBK=!0,n.readAsText(t,"GBK")):a.indexOf("")>-1&&!n.markBIG5?(n.markBIG5=!0,n.readAsText(t,"BIG5")):void e(a)}),n.onerror=(t=>{o(t)})})}function x(){const{getUrl:t,adToken:e}=o,n=t("M3U8_SUBTITLE_SRT")+"&adToken="+encodeURIComponent(e);return fetch(n).then(t=>t.ok?t.text():Promise.reject()).then(t=>{const e=function(e){const o=(t||"").split("\n"),n=[];try{for(var a=2;a<o.length;a+=2){const t=o[a]||"";if(-1!==t.indexOf("#EXT-X-MEDIA:")){for(var s=t.replace("#EXT-X-MEDIA:","").split(","),r={},i=0;i<s.length;i++){const t=s[i].split("=");r[(t[0]||"").toLowerCase().replace("-","_")]=String(t[1]).replace(/"/g,"")}r.url=o[a+1],n.push(r)}}}catch(t){}return n}();return Promise.all(e.map(t=>(function(t,e){return fetch(t,{headers:{range:"bytes=".concat(Array.isArray(e)?e.join("-"):e||"0-"),referer:location.protocol+"//"+location.host+"/","User-Agent":"pan.baidu.com"}}).then(t=>t.ok?t.blob():Promise.reject())})(t.url).then(e=>b(e).then(e=>({...t,html:t.name,default:"YES"===t.default,type:function(t){return/(\d+)?[\r\n]?(\d{0,2}:?\d{2}:\d{2}.\d{3})\s?-?->\s?(\d{0,2}:?\d{2}:\d{2}.\d{3})/.test(t)?/^WEBVTT[\r\n]/.test(t)?"vtt":"srt":/\[Script Info\]/.test(t)?/\[V4\+ Styles\]/.test(t)&&/Dialogue: .*?\d+,(\d+:\d{2}:\d{2}\.\d{2}),(\d+:\d{2}:\d{2}\.\d{2}),/.test(t)?"ass":"ssa":""}(e)||"srt"}))))).catch(()=>e.map(t=>({...t,html:t.name,default:"YES"===t.default,type:"srt"})))})}function y(t=[]){if(!t.length)return;const e=t.find(t=>t.default)||Object.assign(t[0],{default:!0}),a=Object.assign({},o.subtitle,{style:o.subtitle.style},e),{url:s,type:r}=a;Object.assign(o.subtitle,{url:s,type:r,escape:!1}),c.init({...a}).then(()=>{a.name&&(n.show=`加载字幕: ${a.name}`)}),i.update({html:g.showtext?"字幕列表":g.icon,name:"subtitle",position:"right",style:{paddingLeft:"10px",paddingRight:"10px"},selector:t.map((t,e)=>({...t})),onSelect:(t,e)=>{const{url:s,type:r}=t;return Object.assign(o.subtitle,{url:s,type:r}),c.switch(s,a).then(()=>{n.show=`切换字幕: ${t.name}`}),t.html}})}function w(t=[]){i.cache.get("subtitle")?i.update({name:"subtitle",selector:t.map((t,e)=>({...t}))}):y(t)}function v(){t.once("user",({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){for(let[t,e]of Object.entries({color:a.get("subtitle-color"),bottom:a.get("subtitle-bottom"),fontSize:a.get("subtitle-fontSize"),fontWeight:a.get("subtitle-fontWeight"),fontFamily:a.get("subtitle-fontFamily"),textShadow:a.get("subtitle-textShadow")}))e&&c.style(t,e);t.on("subtitle",t=>a.set("subtitle",t));const e=a.get("subtitle");"boolean"==typeof e&&(c.show=e),(o.sublist||[]).length&&y(o.sublist),"function"==typeof o.getUrl&&x().then(t=>{o.sublist=(o.sublist||[]).concat(t),w(o.sublist)});let n=o.id;t.on("restart",()=>{if(n===o.id)(o.sublist||[]).length&&c.createTrack("metadata",c.url);else{n=o.id;const{$subtitle:t}=l;t.innerHTML="",o.subtitle.url="",c.createTrack("metadata",""),i.cache.get("subtitle")&&i.remove("subtitle"),(o.sublist||[]).length&&w(o.sublist)}})}})}return r.update({html:"字幕设置",name:"subtitle-setting",tooltip:"",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 48 48"><path d="M0 0h48v48H0z" fill="none"/><path fill="#ffffff" d="M40 8H8c-2.21 0-4 1.79-4 4v24c0 2.21 1.79 4 4 4h32c2.21 0 4-1.79 4-4V12c0-2.21-1.79-4-4-4zM8 24h8v4H8v-4zm20 12H8v-4h20v4zm12 0h-8v-4h8v4zm0-8H20v-4h20v4z"/></svg>',selector:[{html:"显示",name:"subtitle",tooltip:"显示",switch:!0,onSwitch:t=>(t.tooltip=t.switch?"隐藏":"显示",c.show=!t.switch,!t.switch),mounted(e,o){const n=c.show;o.switch=n,o.tooltip=n?"显示":"隐藏",t.on("subtitle",t=>{setTimeout(()=>{o.switch!==t&&(o.switch=t,o.tooltip=t?"显示":"隐藏")})})}},{html:"字幕偏移",name:"subtitle-offset",tooltip:"0s",range:[0,-10,10,.1],onChange(e){const o=e.range[0];return t.subtitleOffset=o,o+"s"},mounted(e,o){t.on("subtitleOffset",t=>{setTimeout(()=>{o.$range.value=t,o.tooltip=t+"s"})})}},{html:"字幕位置",name:"subtitle-bottom",tooltip:"5%",range:[5,1,90,1],onChange(t){const e=t.range[0]+"%";return c.style({bottom:e}),a.set("subtitle-bottom",e),e},mounted(t,e){const o=a.get("subtitle-bottom");o&&(e.tooltip=o,e.$range.value=parseFloat(o))}},{html:"字体大小",name:"subtitle-fontSize",tooltip:"25px",range:[25,10,60,1],onChange(t){const e=t.range[0]+"px";return c.style({fontSize:e}),a.set("subtitle-fontSize",e),e},mounted(t,e){const o=a.get("subtitle-fontSize");o&&(e.tooltip=o,e.$range.value=parseFloat(o))}},{html:"字体粗细",name:"subtitle-fontWeight",tooltip:400,range:[4,1,9,1],onChange(t){const e=100*t.range[0];return a.set("subtitle-fontWeight",e),c.style({fontWeight:e}),e},mounted(t,e){const o=a.get("subtitle-fontWeight");o&&(e.tooltip=o,e.$range.value=o/100)}},{html:"字体颜色",name:"subtitle-color",tooltip:g.tooltip,selector:[{html:"预设",name:"color-presets",tooltip:'<style>.panel-setting-color label{font-size: 0;padding: 4px;display: inline-block;}.panel-setting-color input{display: none;}.panel-setting-color span{width: 22px;height: 22px;display: inline-block;border-radius: 50%;box-sizing: border-box;cursor: pointer;}</style><div class="panel-setting-color"><label><input type="radio" value="#fff"><span style="background: #fff;"></span></label><label><input type="radio" value="#e54256"><span style="background: #e54256"></span></label><label><input type="radio" value="#ffe133"><span style="background: #ffe133"></span></label><label><input type="radio" name="dplayer-danmaku-color-1" value="#64DD17"><span style="background: #64DD17"></span></label><label><input type="radio" value="#39ccff"><span style="background: #39ccff"></span></label><label><input type="radio" value="#D500F9"><span style="background: #D500F9"></span></label></div>'},{html:"默认颜色",name:"color-default",tooltip:g.tooltip},{html:"颜色选择器",name:"color-picker",tooltip:g.tooltip.replace("#FE9200","#000")}],onSelect(t,e,o){switch(t.name){case"color-presets":if("INPUT"===o.target.nodeName){const t=o.target.value;c.style({color:t}),a.set("subtitle-color",t)}break;case"color-default":c.style({color:"#FE9200"}),a.set("subtitle-color","#FE9200");break;case"color-picker":l.$colorPicker||(l.$colorPicker=d(l.$player,'<input hidden type="color">'),l.$colorPicker.oninput=(e=>{const o=e.target.value;c.style({color:o}),a.set("subtitle-color",o),t.tooltip=t.$parent.tooltip=g.tooltip.replace("#FE9200",o)})),l.$colorPicker.click()}return g.tooltip.replace("#FE9200",l.$subtitle.style.color)},mounted(t,e){const o=a.get("subtitle-color");o&&(e.tooltip=g.tooltip.replace("#FE9200",o))}},{html:"字体类型",name:"subtitle-fontFamily",tooltip:e.get("Default"),selector:[{html:"默认",value:""},{html:"等宽 衬线",value:'"Courier New", Courier, "Nimbus Mono L", "Cutive Mono", monospace'},{html:"比例 衬线",value:'"Times New Roman", Times, Georgia, Cambria, "PT Serif Caption", serif'},{html:"等宽 无衬线",value:'"Deja Vu Sans Mono", "Lucida Console", Monaco, Consolas, "PT Mono", monospace'},{html:"比例 无衬线",value:'"YouTube Noto", Roboto, "Arial Unicode Ms", Arial, Helvetica, Verdana, "PT Sans Caption", sans-serif'},{html:"Casual",value:'"Comic Sans MS", Impact, Handlee, fantasy'},{html:"Cursive",value:'"Monotype Corsiva", "URW Chancery L", "Apple Chancery", "Dancing Script", cursive'},{html:"Small Capitals",value:'"Arial Unicode Ms", Arial, Helvetica, Verdana, "Marcellus SC", sans-serif'}],onSelect:(t,e,o)=>(a.set("subtitle-fontFamily",t.html),c.style({fontFamily:t.value}),t.html),mounted(t,e){const o=a.get("subtitle-fontFamily");o&&(e.tooltip=o)}},{html:"描边样式",name:"subtitle-textShadow",tooltip:e.get("Default"),selector:[{html:"默认",value:"rgb(0 0 0) 1px 0 1px, rgb(0 0 0) 0 1px 1px, rgb(0 0 0) -1px 0 1px, rgb(0 0 0) 0 -1px 1px, rgb(0 0 0) 1px 1px 1px, rgb(0 0 0) -1px -1px 1px, rgb(0 0 0) 1px -1px 1px, rgb(0 0 0) -1px 1px 1px"},{html:"重墨",value:"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"},{html:"描边",value:"rgb(0, 0, 0) 0px 0px 1px, rgb(0, 0, 0) 0px 0px 1px, rgb(0, 0, 0) 0px 0px 1px"},{html:"45°投影",value:"rgb(0, 0, 0) 1px 1px 2px, rgb(0, 0, 0) 0px 0px 1px"},{html:"阴影",value:"rgb(34, 34, 34) 1px 1px 1.4875px, rgb(34, 34, 34) 1px 1px 1.98333px, rgb(34, 34, 34) 1px 1px 2.47917px"},{html:"凸起",value:"rgb(34, 34, 34) 1px 1px"},{html:"下沉",value:"rgb(204, 204, 204) 1px 1px, rgb(34, 34, 34) -1px -1px"},{html:"边框",value:"rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px, rgb(34, 34, 34) 0px 0px 1px"}],onSelect:(t,e,o)=>(a.set("subtitle-textShadow",t.html),c.style({textShadow:t.value}),t.html),mounted(t,e){const o=a.get("subtitle-textShadow");o&&(e.tooltip=o)}},{name:"subtitle-load",html:"加载字幕",selector:[{html:"本地文件",name:"file"}],onSelect(t,e,n){const{userJSON:a,show:r}=s.user;return a().then(({expire_time:e})=>{Math.max(Date.parse(e)-Date.now(),0)?"file"===t.name&&(l.$subtitleLocalFile||(l.$subtitleLocalFile=d(l.$container,'<input class="subtitleLocalFile" type="file" accept="webvtt,.vtt,.srt,.ssa,.ass" style="display: none;">')),function(t){return t.click(),new Promise((e,o)=>{t.onchange=(t=>{if(t.target.files.length){const o=t.target.files[0],n=o.name.split(".").pop().toLowerCase();f(o).then(t=>{const a={url:t,type:n,name:o.name,html:`本地字幕「${n}」`};e(a)})}t.target.value=""})})}(l.$subtitleLocalFile).then(t=>{o.sublist=(o.sublist||[]).concat([t]),w(o.sublist)})):r()}),""}}]}),u.update({name:"subtitle",index:31,html:`字幕显示: ${[1,0].map(t=>`<span data-value="${t}">${t?"显示":"隐藏"}</span>`).join("")}`,click:(t,e)=>{m(e.target,"art-current");const{value:o}=e.target.dataset;c.show=Boolean(Number(o)),t.show=!1},mounted:e=>{const o=h(`[data-value='${Number(c.show)}']`,e);o&&m(o,"art-current"),t.on("subtitle",t=>{const o=h(`[data-value='${Number(t)}']`,e);o&&m(o,"art-current")})}}),t.isReady?v():t.once("ready",v),{name:"subtitle"}},()=>t=>{const{notice:e,storage:o,plugins:n,setting:a,template:{$video:s}}=t;function r(t){i().then(e=>{e.setEnabled(t)})}function i(){if(t.joySound)return Promise.resolve(t.joySound);const e=window.Joysound||unsafeWindow.Joysound;if(e){if(e.isSupport()){const o=t.joySound=new e;return o.hasSource()||o.init(s),Promise.resolve(o)}return Promise.reject("Not Joysound isSupport")}return Promise.reject("Not Joysound")}function l(){t.joySound&&t.joySound.destroy()}function c(){t.once("user",({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){const e=o.get("joysound");"boolean"==typeof e&&e&&r(e),t.on("destroy",l)}})}return a.add({html:"声音设置",name:"joysound",tooltip:"",selector:[{html:"音质增强",name:"high",tooltip:"关闭",switch:!1,onSwitch:t=>{const a=!t.switch,s=a?"开启":"关闭";t.tooltip=s;const{userJSON:i,show:l}=n.user;return i().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(r(a),o.set("joysound",a),e.show=`音质增强: ${s}`):(o.set("joysound",!1),l())}),a},mounted:(t,e)=>{o.get("joysound")&&(e.tooltip="增强",e.switch=!0)}},{html:"音量增强",name:"volume",tooltip:"0x",range:[0,0,5,.1],onRange:t=>{const o=t.range[0],{userJSON:a,show:s}=n.user;return a().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(!function(t){i().then(e=>{e.setVolume(t)})}(o),e.show=`音量增强: ${Math.round(100*o)}%`):s()}),`${Math.round(100*o)/100}x`}}]}),t.playing?c():t.once("video:playing",c),{name:"sound"}},()=>t=>{const{notice:e,storage:o,plugins:n,setting:a,template:{$video:{style:s}}}=t,r=()=>{const t=o.get("filter")||{},{saturate:e=1,brightness:n=1,contrast:a=1}=t;s.filter=1!==e||1!==n||1!==a?`saturate(${e}) brightness(${n}) contrast(${a})`:""};function i(){t.once("user",({expire_time:t})=>{if(Math.max(Date.parse(t)-Date.now(),0)){const{saturate:t=1,brightness:e=1,contrast:n=1}=o.get("filter")||{};s.filter=`saturate(${t}) brightness(${e}) contrast(${n})`}})}return a.update({html:"色彩滤镜",name:"filter",tooltip:"",selector:[{html:"饱和度",name:"saturate",tooltip:100,range:[100,0,255,1],onRange:t=>{const a=t.range[0],{userJSON:s,show:i}=n.user;return s().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(e.show=`饱和度: ${a}`,o.set("filter",{...o.get("filter"),saturate:a/100}),r()):i()}),a},mounted:(t,e)=>{const{saturate:n=1}=o.get("filter")||{};e.$range.value=100*n,e.tooltip=100*n}},{html:"亮度",name:"brightness",tooltip:100,range:[100,0,255,1],onRange:t=>{const a=t.range[0],{userJSON:s,show:i}=n.user;return s().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(e.show=`亮度: ${a}`,o.set("filter",{...o.get("filter"),brightness:a/100}),r()):i()}),a},mounted:(t,e)=>{const{brightness:n=1}=o.get("filter")||{};e.$range.value=100*n,e.tooltip=100*n}},{html:"对比度",name:"contrast",tooltip:100,range:[100,0,255,1],onRange:t=>{const a=t.range[0],{userJSON:s,show:i}=n.user;return s().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(e.show=`对比度: ${a}`,o.set("filter",{...o.get("filter"),contrast:a/100}),r()):i()}),a},mounted:(t,e)=>{const{contrast:n=1}=o.get("filter")||{};e.$range.value=100*n,e.tooltip=100*n}},{html:"预设「1」",name:"presets",tooltip:"",values:[1.1,1.05,1.01]},{html:"默认",name:"default",tooltip:"",values:[1,1,1]}],onSelect:(t,e,s)=>{const{userJSON:i,show:l}=n.user;return i().then(({expire_time:e})=>{if(Math.max(Date.parse(e)-Date.now(),0)){const e=t.values;["saturate","brightness","contrast"].forEach((t,o)=>{const n=a.find(t),s=Math.floor(100*e[o]);n.tooltip=s,n.$range.value=s}),o.set("filter",{saturate:e[0],brightness:e[1],contrast:e[2]}),r()}else l()}),t.html}}),t.isReady?i():t.once("ready",i),{name:"imagefilter"}},()=>t=>{const{i18n:e,notice:o,storage:n,plugins:a,setting:s,controls:r,constructor:{utils:{throttle:i}}}=t;function l(){t.once("user",({expire_time:e})=>{Math.max(Date.parse(e)-Date.now(),0)&&(n.get("auto-fullscreen")&&(t.fullscreenWeb=!0),t.startTime=n.get("startTime"),t.endTime=n.get("endTime"),t.on("video:timeupdate",i(()=>{const{currentTime:e,duration:o,startTime:n,endTime:a}=t;if(n||a){const s=[[0,n||0],[a?o-a:0,a?o:0]];for(const[o,n]of s)if(e>=o&&e<n){t.seek=n;break}}},1e3)),t.on("video:ended",()=>{if(n.get("auto-next")&&r.cache.get("playlist")){const t=r.cache.get("playlist").option.selector,e=t[t.findIndex(t=>t.default)+1];e?(r.check(e),"function"==typeof e.open&&e.open()):o.show="没有下一集了"}}))})}return s.update({html:"播放设置",name:"play-setting",tooltip:"",selector:[{html:"自动下一集",name:"auto-next",icon:"",tooltip:"关闭",switch:!1,onSwitch:t=>{const e=t.switch;t.tooltip=e?"关闭":"开启";const{userJSON:s,show:r}=a.user;return s().then(({expire_time:t})=>{Math.max(Date.parse(t)-Date.now(),0)?(n.set("auto-next",!e),o.show=`自动下一集: ${e?"关闭":"开启"}`):r()}),!e},mounted:(t,e)=>{n.get("auto-next")&&(e.tooltip="开启",e.switch=!0)}},{html:"自动全屏",name:"auto-fullscreen",icon:"",tooltip:"关闭",switch:!1,onSwitch:e=>{const s=e.switch;e.tooltip=s?"关闭":"开启";const{userJSON:r,show:i}=a.user;return r().then(({expire_time:e})=>{Math.max(Date.parse(e)-Date.now(),0)?(t.fullscreenWeb=!s,n.set("auto-fullscreen",!s),o.show=`自动全屏: ${s?"关闭":"开启"}`):i()}),!s},mounted:(t,e)=>{n.get("auto-fullscreen")&&(e.tooltip="开启",e.switch=!0)}},{html:"跳过片头",tooltip:"0s",range:[0,0,120,1],onChange(e){const s=e.range[0],{userJSON:r,show:i}=a.user;return r().then(({expire_time:e})=>{Math.max(Date.parse(e)-Date.now(),0)?(t.startTime=s,n.set("startTime",s),o.show=`跳过片头: ${s} 秒`):i()}),s+"s"},mounted:(t,e)=>{const o=n.get("startTime");o&&(e.range=[o,0,120,1],e.tooltip=o+"s")}},{html:"跳过片尾",tooltip:"0s",range:[0,0,120,1],onChange(e){const s=e.range[0],{userJSON:r,show:i}=a.user;return r().then(({expire_time:e})=>{Math.max(Date.parse(e)-Date.now(),0)?(t.endTime=s,n.set("endTime",s),o.show=`跳过片尾: ${s} 秒`):i()}),s+"s"},mounted:(t,e)=>{const o=n.get("endTime");o&&(e.range=[o,0,120,1],e.tooltip=o+"s")}}]}),t.isReady?l():t.once("ready",l),{name:"play"}},()=>t=>{const{option:e,controls:o,template:{$video:n},constructor:{FAST_FORWARD_VALUE:a,utils:{isMobile:s}}}=t;let r=null,i=!1,l=1;const c=e=>{0===e.button&&(r=setTimeout(()=>{i=!0,o.show=!1,l=t.playbackRate,t.playbackRate*=a},1e3))},u=()=>{clearTimeout(r),setTimeout(()=>{i&&(i=!1,o.show=!1,t.playbackRate=l,t.play())})};function p(){t.once("user",({expire_time:o})=>{Math.max(Date.parse(o)-Date.now(),0)&&(s||(n.addEventListener("mousedown",c),document.addEventListener("mouseup",u)),e.hotkey&&!s&&(t.isFocus||(t.isFocus=!0)),t.on("blur",o=>{e.hotkey&&!s&&(t.isFocus=!0)}))})}return t.isReady?p():t.once("ready",p),{name:"hotkey"}}]);