|
|
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["jellyfin-apiclient"]=t():e["jellyfin-apiclient"]=t()}(self,(function(){return function(){"use strict";var e={628:function(e,t,r){function n(e,t){if(!e)throw new Error("obj cannot be null!");e._callbacks=e._callbacks||{};var r=e._callbacks[t];return r||(e._callbacks[t]=[],r=e._callbacks[t]),r}r.d(t,{default:function(){return he}});var i={on:function(e,t,r){n(e,t).push(r)},off:function(e,t,r){var i=n(e,t),a=i.indexOf(r);-1!==a&&i.splice(a,1)},trigger:function(e,t){var r={type:t},i=[];i.push(r);for(var a=arguments[2]||[],o=0,s=a.length;o<s;o++)i.push(a[o]);var l=n(e,t).slice(0);l.forEach((function(t){t.apply(e,i)}))}};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function o(e){console.log(e)}function s(e){var t=e.cache;t&&t.put("data",new Response(JSON.stringify(e.localData))).catch(o)}function l(e){this.cache=e,this.localData={}}var u=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);try{self&&self.caches&&caches.open("embydata").then(l.bind(this))}catch(e){console.log("Error opening cache: ".concat(e))}}var t,r,n;return t=e,n=[{key:"getInstance",value:function(){return e.instance||(e.instance=new e),e.instance}}],(r=[{key:"setItem",value:function(e,t){localStorage.setItem(e,t);var r=this.localData;r&&r[e]!==t&&(r[e]=t,s(this))}},{key:"getItem",value:function(e){return localStorage.getItem(e)}},{key:"removeItem",value:function(e){localStorage.removeItem(e);var t=this.localData;t&&(t[e]=null,delete t[e],s(this))}}])&&a(t.prototype,r),n&&a(t,n),e}().getInstance();function c(e){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var h={timeupdate:1e4,volumechange:3e3};function v(e){g(e),e.accessToken()&&!1!==e.enableAutomaticBitrateDetection&&setTimeout(f.bind(e),6e3)}function f(){this.accessToken()&&this.detectBitrate()}function g(e){e.detectTimeout&&clearTimeout(e.detectTimeout)}function y(e,t,r){var n=new RegExp(t,"ig");return e.replace(n,r)}function p(e,t,r){i.trigger(e,"requestfail",[{url:t,status:r.status,errorCode:r.headers?r.headers.get("X-Application-Error-Code"):null}])}function m(e){var t=[];for(var r in e){var n=e[r];null!=n&&""!==n&&t.push("".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(n)))}return t.join("&")}function S(e,t,r){return new Promise((function(n,i){var a=setTimeout(i,r);(t=t||{}).credentials="same-origin",fetch(e,t).then((function(e){clearTimeout(a),n(e)})).catch((function(e){clearTimeout(a),i(e)}))}))}function I(e){var t=e.headers||{};"json"===e.dataType&&(t.accept="application/json");var r={headers:t,method:e.type,credentials:"same-origin"},n=e.contentType;return e.data&&("string"==typeof e.data?r.body=e.data:(r.body=m(e.data),n=n||"application/x-www-form-urlencoded; charset=UTF-8")),n&&(t["Content-Type"]=n),e.timeout?S(e.url,r,e.timeout):fetch(e.url,r)}function w(e){"function"==typeof e.reportPlaybackProgressCancel&&e.reportPlaybackProgressCancel()}function k(e,t){e._endPointInfo=t}function T(e,t){return(t=t||0)>=20?Promise.reject():function(e){var t=[],r=[],n=e.serverInfo();return n.LocalAddress&&-1===r.indexOf(n.LocalAddress)&&(t.push({url:n.LocalAddress,timeout:0}),r.push(t[t.length-1].url)),n.ManualAddress&&-1===r.indexOf(n.ManualAddress)&&(t.push({url:n.ManualAddress,timeout:100}),r.push(t[t.length-1].url)),n.RemoteAddress&&-1===r.indexOf(n.RemoteAddress)&&(t.push({url:n.RemoteAddress,timeout:200}),r.push(t[t.length-1].url)),console.log("tryReconnect: "+r.join("|")),new Promise((function(r,n){va
|