Poblem with Premium License

491 views
Skip to first unread message

Fulcanelly Hri

unread,
Feb 19, 2021, 5:40:31 PM2/19/21
to Video DownloadHelper Q&A

Hello, dated December 17, 2020 I bought the premium license for life for Chrome in Windows 7, at first everything was fine, until it began to let me download only one file, waiting if I wanted to download more files, until I restarted the computer, allowing me to download just one again. Now it continues to download only one and when I check the configuration in the license section the following appears:

Video DownloadHelper 7.5.0.0

Video DownloadHelper

Versión 7.5.0.0

Idioma del Navegador: es

Compilación de la plataforma

Compilado el Tue Feb 16 2021 16:00:41 GMT+0100 (Central European Standard Time)

Opciones de compilación: browser=chrome, noyt=true

Plataforma

Plataforma Win x86-64

Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36

Aplicación Auxiliar instalada

Encontrada Aplicación Auxiliar: VdhCoApp 1.6.0

Ruta de la Aplicación Auxiliar: E:\Program Files\net.downloadhelper.coapp\bin\net.downloadhelper.coapp-win-64.exe

Volver a comprobar

Verificando licencia

Registrar una licencia existente Adquirir una licencia de conversión About Chrome licenses

I would like to solve the problem or if you can change the license for Firefox if the problem is the browser. Thanks.

jcv...@gmail.com

unread,
Feb 20, 2021, 2:47:03 AM2/20/21
to Video DownloadHelper Q&A
did you check your Chrome is synchronized with your purchase account ?
jerome

Fulcanelly Hri

unread,
Feb 20, 2021, 4:15:48 AM2/20/21
to Video DownloadHelper Q&A
Thanks for answering. Checked, everything was always synchronized as it appears in the chrome settings.
Configuración_ Gestionar qué sincronizas.jpg

mig

unread,
Feb 20, 2021, 5:54:37 AM2/20/21
to Video DownloadHelper Q&A
Could it be that you purchased a license from the Chrome web store while logged in your browser as another user ? You should be able to see your purchased license from the Google wallet: https://wallet.google.com/

Fulcanelly Hri

unread,
Feb 20, 2021, 6:48:46 AM2/20/21
to Video DownloadHelper Q&A
The license was purchased with the same account, it has been with the same user for years and when it was purchased it worked until mid-January, which is when it began to have problems, the configuration was never modified.
COMPRA DOWNLOADHELPER.jpg

jcv...@gmail.com

unread,
Feb 22, 2021, 3:32:03 AM2/22/21
to Video DownloadHelper Q&A
I sent you an email.

jerome

Fulcanelly Hri

unread,
Feb 22, 2021, 6:20:52 PM2/22/21
to Video DownloadHelper Q&A
Thanks for the email but the license doesn't work. I observed the instructions to another colleague and in the developer mode console it gives the following error message in case it was of help


"!function(e){var t={};function n(a){if(t[a])return t[a].exports;var i=t[a]={i:a,l:!1,exports:{}};return e[a].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,a){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:a})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=350)}({10:function(e,t){e.exports={buildDate:"Tue Feb 16 2021 16:00:41 GMT+0100 (Central European Standard Time)",buildOptions:{browser:"chrome",noyt:"true"},prod:!0}},350:function(e,t,n){e.exports=n(351)},351:function(e,t,n){"use strict";var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function r(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var c=n(352).info;n(353),window.CollapsibleSection=function(e){function t(e){i(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={open:n.props.open||!1},n}return r(t,React.Component),a(t,[{key:"componentWillReceiveProps",value:function(e){e.open!=this.props.open&&this.setState({open:!!e.open})}},{key:"toggle",value:function(){var e=this;return function(){e.setState({open:!e.state.open})}}},{key:"render",value:function(){return React.createElement("div",{className:"collapsible-section"},React.createElement("div",{className:"section-header "+(this.state.open?"section-open":"section-close"),onClick:this.toggle()},React.createElement("div",{className:"open-close-sign"},this.state.open?"⊖":"⊕"),React.createElement("span",{className:"title"},this.props.title)),React.createElement(Collapse,{isOpen:this.state.open},React.createElement(Card,null,React.createElement(CardBody,null,this.props.content))))}}]),t}(),window.AddonInfoPanel=function(e){function t(e){i(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.state={manifest:browser.runtime.getManifest(),build:null};var a=n;return weh.rpc.call("getBuild").then(function(e){a.setState({build:e})}),n}return r(t,React.Component),a(t,[{key:"render",value:function(){var e=this,t=this.state.manifest.version_name||this.state.manifest.version,n=React.createElement("div",null,React.createElement("div",null,this.state.manifest.name),React.createElement("div",null,weh._("version",t)),React.createElement("div",null,weh._("browser_locale",browser.i18n.getUILanguage())),this.state.build&&React.createElement("div",null,React.createElement("div",null,this.state.build.prod?weh._("prod_build"):weh._("dev_build")),React.createElement("div",null,weh._("built_on",this.state.build.buildDate)),Object.keys(this.state.build.buildOptions).length>0&&React.createElement("div",null,weh._("build_options",Object.keys(this.state.build.buildOptions).sort().map(function(t){return t+"="+e.state.build.buildOptions[t]}).join(", "))))),a=this.state.manifest.name+" "+t;return React.createElement(CollapsibleSection,{title:a,content:n})}}]),t}(),window.PlatformInfoPanel=function(e){function t(e){i(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));n.state={platform:null,browser:null};var a=n;return browser.runtime.getBrowserInfo&&browser.runtime.getBrowserInfo().then(function(e){a.setState({browser:e})}),browser.runtime.getPlatformInfo().then(function(e){a.setState({platform:e})}),n}return r(t,React.Component),a(t,[{key:"capitalize",value:function(e){return e.substring(0,1).toUpperCase()+e.substring(1)}},{key:"render",value:function(){var e=weh._("platform"),t=React.createElement("div",null,this.state.platform&&React.createElement("div",null,weh._("platform_info",[this.capitalize(this.state.platform.os),this.state.platform.arch])),this.state.browser&&React.createElement("div",null,weh._("browser_info",[this.state.browser.vendor,this.state.browser.name,this.state.browser.version]))||React.createElement("div",null,navigator.userAgent));return React.createElement(CollapsibleSection,{title:e,content:t})}}]),t}(),window.CoAppInfoPanel=function(e){function t(e){i(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={status:null,info:null,error:null},n}return r(t,React.Component),a(t,[{key:"componentWillMount",value:function(){this.check()}},{key:"check",value:function(e){var t=this;t.setState({status:null,info:null,error:null}),Promise.resolve().then(function(){if(e)return weh.rpc.call("coappProxy","quit").catch(function(){}).then(function(){return new Promise(function(e,t){setTimeout(function(){e()},weh.prefs.coappRestartDelay)})})}).then(function(){weh.rpc.call("checkCoApp").then(function(e){t.setState(Object.assign({status:null,info:null,error:null},e))})})}},{key:"isMinimumVersion",value:function(e,t){for(var n=e.split(".").map(function(e){return parseInt(e)}),a=t.split(".").map(function(e){return parseInt(e)}),i=0;i<n.length;i++){if(void 0===a[i])return!0;if(n[i]>a[i])return!0;if(n[i]<a[i])return!1}return!0}},{key:"render",value:function(){var e,t=!1;null===this.state.status?e=weh._("coapp_unchecked"):this.state.status?this.isMinimumVersion(this.state.info.version,c.lastVersion)?e=weh._("coapp_installed"):(e=weh._("coapp_outdated"),t=!0):e=weh._("coapp_not_installed");var n=React.createElement("div",null,this.state.error&&React.createElement("div",null,weh._("coapp_error")," "," ",React.createElement("em",null,this.state.error.message||this.state.error)),this.state.status&&React.createElement("div",null,React.createElement("div",null,weh._("coapp_found")," "," ",React.createElement("em",null,this.state.info.displayName," ",this.state.info.version)),t&&React.createElement("div",null,weh._("coapp_latest_version",c.lastVersion)),React.createElement("div",null,weh._("coapp_path")," "," ",React.createElement("em",null,this.state.info.binary))),React.createElement("br",null),React.createElement("div",{className:"btn-toolbar float-right"},React.createElement("button",{className:"btn btn-outline-secondary",onClick:this.check.bind(this,!0)},weh._("coapp_recheck")),!this.state.status&&React.createElement("button",{className:"btn btn-outline-primary",onClick:function(){return weh.rpc.call("installCoApp")}},weh._("coapp_install")),t&&React.createElement("button",{className:"btn btn-outline-primary",onClick:function(){return weh.rpc.call("installCoApp")}},weh._("coapp_update"))));return React.createElement("div",null,React.createElement(CollapsibleSection,{title:e,content:n}))}}]),t}()},352:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.info={lastVersion:"1.6.0"}},353:function(e,t,n){"use strict";var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var a=t[n];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,a.key,a)}}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}();var i=n(10);window.LicInfoPanel=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={status:"verifying",customStatus:"",customLicense:!1,email:null,key:null,editing:!1,editKey:"",chromeStatus:"",skus:null,purchases:null,premium:null,unneeded:!1,notSigned:!1,chromeMigrationRequired:!1},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,React.Component),a(t,[{key:"componentWillMount",value:function(){this.check()}},{key:"check",value:function(){var e=this;e.setState({status:"verifying",email:null,key:null}),weh.rpc.call("checkLicense").then(function(t){e.setState(t)}).catch(function(e){console.error("Error checking license",e)})}},{key:"onLicKeyChanged",value:function(){var e=this;return function(t){e.setState({editKey:t.target.value})}}},{key:"onLicKeyPressed",value:function(){var e=this;return function(t){"Enter"==t.key?e.register():"Escape"==t.key&&e.setState({editing:!1})}}},{key:"registerEdit",value:function(){var e=this;return function(){e.setState({editing:!0,editKey:""})}}},{key:"getLicense",value:function(){return function(){weh.rpc.call("goto","https://www.downloadhelper.net/convert"+(i.buildOptions.browser?"?browser="+encodeURIComponent(i.buildOptions.browser):""))}}},{key:"aboutChromeLicenses",value:function(){return function(){weh.rpc.call("goto","https://www.downloadhelper.net/chrome-licenses")}}},{key:"cancelRegister",value:function(){var e=this;return function(){e.setState({editing:!1})}}},{key:"register",value:function(){var e=this;this.setState({editing:!1,status:"verifying"}),this.validate(this.state.editKey.trim()).catch(function(t){e.setState({status:"error",error:t.message})})}},{key:"validate",value:function(e){var t=this;return weh.rpc.call("validateLicense",e).then(function(e){e&&"nocoapp"==e.status?t.setState({status:"nocoapp",key:e.key}):t.check()})}},{key:"render",value:function(){var e,t=React.createElement("div",{className:"lic-info-panel"},"accepted"==this.state.chromeStatus&&React.createElement("div",null,React.createElement("strong",null,weh._("chrome_license_webstore_accepted")),React.createElement("br",null),React.createElement("br",null)),this.state.editing&&React.createElement("div",{className:"input-license"},React.createElement("label",null,weh._("license_key")),React.createElement("input",{value:this.state.editKey,onChange:this.onLicKeyChanged(),onKeyDown:this.onLicKeyPressed()})),!this.state.editing&&{unverified:1,locked:1,accepted:1,blocked:1,nocoapp:1,error:1,mismatch:1}[this.state.status]&&this.state.key&&React.createElement("div",{className:"license-details"},React.createElement("table",null,React.createElement("tbody",null,this.state.email&&this.state.key&&React.createElement("tr",null,React.createElement("td",null,weh._("registered_email")),React.createElement("td",null,this.state.email)),this.state.key&&this.state.email&&React.createElement("tr",null,React.createElement("td",null,weh._("registered_key")),React.createElement("td",null,this.state.key))))),"unneeded"==this.state.status&&React.createElement("div",null,weh._("lic_not_needed_linux")),!this.state.editing&&"unset"==this.state.status&&React.createElement("div",null,weh._("no_license_registered")),!this.state.editing&&"nocoapp"==this.state.status&&React.createElement("div",null,weh._("no_coapp_license_unverified")),!this.state.editing&&"mismatch"==this.state.status&&this.state.brExt&&React.createElement("div",null,weh._("lic_mismatch2",[this.state.brLicense,this.state.brExt])),!this.state.editing&&"mismatch"==this.state.status&&!this.state.brExt&&React.createElement("div",null,weh._("lic_mismatch1",[this.state.brLicense])),!this.state.editing&&"error"==this.state.status&&React.createElement("div",null,this.state.error),React.createElement("div",{className:"btn-toolbar"},React.createElement("div",{className:"lnk-group"},!this.state.editing&&"unneeded"!=this.state.status&&this.state.key&&React.createElement("a",{href:"#",onClick:this.validate.bind(this,this.state.key)},weh._("recheck_license")),!this.state.editing&&"nocoapp"==this.state.status&&this.state.key&&React.createElement("button",{className:"btn btn-outline-secondary",onClick:function(){return weh.rpc.call("installCoApp")}},weh._("coapp_install")),!this.state.editing&&"unneeded"!=this.state.status&&"nocoapp"!=this.state.status&&React.createElement("a",{href:"#",onClick:this.registerEdit()},weh._("register_existing_license")),!this.state.editing&&"unneeded"!=this.state.status&&"accepted"!=this.state.status&&"nocoapp"!=this.state.status&&React.createElement("a",{href:"#",onClick:this.getLicense()},weh._("get_conversion_license")),!this.state.editing&&React.createElement("a",{href:"#",onClick:this.aboutChromeLicenses()},weh._("about_chrome_licenses")),this.state.editing&&React.createElement("div",null,React.createElement("button",{className:"btn btn-outline-secondary",onClick:this.cancelRegister()},weh._("cancel")),React.createElement("button",{className:"btn btn-outline-primary",disabled:0===this.state.editKey.trim().length,onClick:this.register.bind(this)},weh._("validate_license"))))));switch(this.state.status){case"unneeded":e=weh._("lic_status_unneeded");break;case"accepted":e=weh._("lic_status_accepted");break;default:e=weh._("lic_status_"+this.state.status)}return React.createElement("div",null,React.createElement(CollapsibleSection,{title:e,content:t,open:this.props.open}))}}]),t}()}});"
Extensiones.jpg

mig

unread,
Feb 23, 2021, 5:48:41 AM2/23/21
to Video DownloadHelper Q&A
That is useful ! We are tracking a related issue for a few users  and you just provided an important clue.

Could you provide one more information ? In the picture you sent, there is a line with an orange triangle. Can you click on it to open the section and send the result ? What we are looking for is the detail of the [object Object] reference.

Fulcanelly Hri

unread,
Feb 23, 2021, 7:45:29 AM2/23/21
to Video DownloadHelper Q&A
I think this is what you ask of me:

"!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=251)}([,function(e,t,n){"use strict";var r=n(2),i=r.browser,o={};r.rpc=n(3),r.rpc.setUseTarget(!0),r.rpc.setPost(function(e,t){var n=o[e];n&&n.port&&n.port.postMessage(t)}),r.rpc.listen({appStarted:function(e){},appReady:function(e){},closePanel:function(e){r.ui.close(e)}}),i.runtime.onConnect.addListener(function(e){/^weh:(.*?):(.*)/.exec(e.name)&&(e.onMessage.addListener(function(t){if(void 0!==t._method&&("appStarted"===t._method||"appReady"===t._method)){var n=t._args[0]&&t._args[0].uiName||null,i=o[n]||{ready:!1};if(o[n]=i,Object.assign(i,t._args[0],{port:e}),"appReady"==t._method){i.ready=!0,i.initData&&setTimeout(function(){r.rpc.call(n,"wehInitData",i.initData)},0);var a=p[n];a&&a.timer&&(clearTimeout(a.timer),delete a.timer)}e._weh_app=n}r.rpc.receive(t,e.postMessage.bind(e),e._weh_app)}),e.onDisconnect.addListener(function(){var t=e._weh_app;if(t){delete o[t];var n=p[t];n&&(n.timer&&clearTimeout(n.timer),delete p[t],n.reject(new Error("Disconnected waiting for "+t)))}}))}),r.__declareAppTab=function(e,t){o[e]||(o[e]={}),Object.assign(o[e],t)},r.__closeByTab=function(e){Object.keys(o).forEach(function(t){if(o[t].tab===e){delete o[t];var n=p[t];n&&(n.timer&&clearTimeout(n.timer),delete p[t],n.reject(new Error("Disconnected waiting for "+t)))}})},r._=n(9).getMessage,r.ui=n(253),r.openedContents=function(){return Object.keys(o)};var a=n(25);function s(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}r.prefs=a;var u,c,l=0,d={};try{var f=localStorage.getItem("weh-prefs");null===f?i.storage.local.get("weh-prefs").then(function(e){var t=e["weh-prefs"];t&&a.assign(t)}):(u=f,c={},JSON.parse(u).forEach(function(e){c[e.name]=e.value}),d=c,l=s(f))}catch(e){}a.assign(d),a.on("",{pack:!0},function(e,t){Object.assign(d,e);var n,a=(n=d,JSON.stringify(Object.keys(n).sort().map(function(e){return{name:e,value:n[e]}}))),u=s(a);u!=l&&(l=u,localStorage.setItem("weh-prefs",a),i.storage.local.set({"weh-prefs":d})),Object.keys(o).forEach(function(t){o[t].usePrefs&&r.rpc.call(t,"setPrefs",e)})});var p={};r.wait=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=p[e];return n&&(n.timer&&clearTimeout(n.timer),delete p[e],n.reject(new Error("Waiter for "+e+" overriden"))),new Promise(function(n,r){p[e]={resolve:n,reject:r,timer:setTimeout(function(){delete p[e],r(new Error("Waiter for "+e+" timed out"))},t.timeout||6e4)}})},r.rpc.listen({prefsGetAll:function(){return a.getAll()},prefsGetSpecs:function(){return a.getSpecs()},prefsSet:function(e){return a.assign(e)},trigger:function(e,t){var n=p[e];if(!n)throw new Error("No waiter for",e);n.timer&&(clearTimeout(n.timer),delete n.timer),delete p[e],n.resolve(t)}}),e.exports=r},function(e,t,n){"use strict";var r;t.browser=n(4),r="undefined"==typeof browser&&"undefined"!=typeof chrome&&chrome.runtime?/\bOPR\//.test(navigator.userAgent)?"opera":"chrome":/\bEdge\//.test(navigator.userAgent)?"edge":"firefox",t.browserType=r,t.isBrowser=function(){for(var e=arguments.length,n=Array(e),r=0;r<e;r++)n[r]=arguments[r];for(var i=0;i<n.length;i++)if(n[i]==t.browserType)return!0;return!1},t.error=function(e){console.groupCollapsed(e.message),e.stack&&console.error(e.stack),console.groupEnd()}},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e){return Array.isArray(e)?e:Array.from(e)}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.replyId=0,this.replies={},this.listeners={},this.hook=this.nullHook,this.debugLevel=0,this.useTarget=!1,this.logger=console,this.posts={}}return r(e,[{key:"setPost",value:function(e,t){"string"==typeof e?this.posts[e]=t:this.post=e}},{key:"setUseTarget",value:function(e){this.useTarget=e}},{key:"setDebugLevel",value:function(e){this.debugLevel=e}},{key:"setHook",value:function(e){var t=this,n=Date.now();this.hook=e?function(r){r.timestamp="undefined"!=typeof window&&void 0!==window.performance?window.performance.now():Date.now()-n;try{e(r)}catch(e){t.logger.warn("Hoor error",e)}}:this.nullHook}},{key:"nullHook",value:function(){}},{key:"call",value:function(){var e,t,n,r,a=this,s=Array.prototype.slice.call(arguments);if("function"==typeof s[0]&&(e=s.shift()),a.useTarget){var u=o(s);t=u[0],n=u[1],r=u.slice(2)}else{var c=o(s);n=c[0],r=c.slice(1)}return new Promise(function(o,s){var u=++a.replyId;a.debugLevel>=2&&a.logger.info("rpc #"+u,"call =>",n,r),a.hook({type:"call",callee:t,rid:u,method:n,args:r}),a.replies[u]={resolve:o,reject:s,peer:t};var c=e||a.useTarget&&a.posts[t]||a.post;a.useTarget?c(t,{type:"weh#rpc",_request:u,_method:n,_args:[].concat(i(r))}):c({type:"weh#rpc",_request:u,_method:n,_args:[].concat(i(r))})})}},{key:"receive",value:function(e,t,n){var r=this;if(e._request)Promise.resolve().then(function(){var t=r.listeners[e._method];if("function"==typeof t)return r.debugLevel>=2&&r.logger.info("rpc #"+e._request,"serve <= ",e._method,e._args),r.hook({type:"call",caller:n,rid:e._request,method:e._method,args:e._args}),Promise.resolve(t.apply(null,e._args)).then(function(t){return r.hook({type:"reply",caller:n,rid:e._request,result:t}),t}).catch(function(t){throw r.hook({type:"reply",caller:n,rid:e._request,error:t.message}),t});throw new Error("Method "+e._method+" is not a function")}).then(function(n){r.debugLevel>=2&&r.logger.info("rpc #"+e._request,"serve => ",n),t({type:"weh#rpc",_reply:e._request,_result:n})}).catch(function(n){r.debugLevel>=1&&r.logger.info("rpc #"+e._request,"serve => !",n.message),t({type:"weh#rpc",_reply:e._request,_error:n.message})});else if(e._reply){var i=r.replies[e._reply];delete r.replies[e._reply],i?e._error?(r.debugLevel>=1&&r.logger.info("rpc #"+e._reply,"call <= !",e._error),r.hook({type:"reply",callee:i.peer,rid:e._reply,error:e._error}),i.reject(new Error(e._error))):(r.debugLevel>=2&&r.logger.info("rpc #"+e._reply,"call <= ",e._result),r.hook({type:"reply",callee:i.peer,rid:e._reply,result:e._result}),i.resolve(e._result)):r.logger.error("Missing reply handler")}}},{key:"listen",value:function(e){Object.assign(this.listeners,e)}}]),e}();e.exports=new a},function(e,t,n){var r,i,o,a;a=function(e){"use strict";if("undefined"==typeof browser){const t=()=>{const e={alarms:{clear:{minArgs:0,maxArgs:1},clearAll:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getAll:{minArgs:0,maxArgs:0}},bookmarks:{create:{minArgs:1,maxArgs:1},export:{minArgs:0,maxArgs:0},get:{minArgs:1,maxArgs:1},getChildren:{minArgs:1,maxArgs:1},getRecent:{minArgs:1,maxArgs:1},getTree:{minArgs:0,maxArgs:0},getSubTree:{minArgs:1,maxArgs:1},import:{minArgs:0,maxArgs:0},move:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeTree:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}},browserAction:{getBadgeBackgroundColor:{minArgs:1,maxArgs:1},getBadgeText:{minArgs:1,maxArgs:1},getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},setIcon:{minArgs:1,maxArgs:1}},commands:{getAll:{minArgs:0,maxArgs:0}},contextMenus:{update:{minArgs:2,maxArgs:2},remove:{minArgs:1,maxArgs:1},removeAll:{minArgs:0,maxArgs:0}},cookies:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:1,maxArgs:1},getAllCookieStores:{minArgs:0,maxArgs:0},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},downloads:{download:{minArgs:1,maxArgs:1},cancel:{minArgs:1,maxArgs:1},erase:{minArgs:1,maxArgs:1},getFileIcon:{minArgs:1,maxArgs:2},open:{minArgs:1,maxArgs:1},pause:{minArgs:1,maxArgs:1},removeFile:{minArgs:1,maxArgs:1},resume:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1},show:{minArgs:1,maxArgs:1}},extension:{isAllowedFileSchemeAccess:{minArgs:0,maxArgs:0},isAllowedIncognitoAccess:{minArgs:0,maxArgs:0}},history:{addUrl:{minArgs:1,maxArgs:1},getVisits:{minArgs:1,maxArgs:1},deleteAll:{minArgs:0,maxArgs:0},deleteRange:{minArgs:1,maxArgs:1},deleteUrl:{minArgs:1,maxArgs:1},search:{minArgs:1,maxArgs:1}},i18n:{detectLanguage:{minArgs:1,maxArgs:1},getAcceptLanguages:{minArgs:0,maxArgs:0}},idle:{queryState:{minArgs:1,maxArgs:1}},management:{get:{minArgs:1,maxArgs:1},getAll:{minArgs:0,maxArgs:0},getSelf:{minArgs:0,maxArgs:0},uninstallSelf:{minArgs:0,maxArgs:1}},notifications:{clear:{minArgs:1,maxArgs:1},create:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:0},getPermissionLevel:{minArgs:0,maxArgs:0},update:{minArgs:2,maxArgs:2}},pageAction:{getPopup:{minArgs:1,maxArgs:1},getTitle:{minArgs:1,maxArgs:1},hide:{minArgs:0,maxArgs:0},setIcon:{minArgs:1,maxArgs:1},show:{minArgs:0,maxArgs:0}},runtime:{getBackgroundPage:{minArgs:0,maxArgs:0},getBrowserInfo:{minArgs:0,maxArgs:0},getPlatformInfo:{minArgs:0,maxArgs:0},openOptionsPage:{minArgs:0,maxArgs:0},requestUpdateCheck:{minArgs:0,maxArgs:0},sendMessage:{minArgs:1,maxArgs:3},sendNativeMessage:{minArgs:2,maxArgs:2},setUninstallURL:{minArgs:1,maxArgs:1}},storage:{local:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}},managed:{get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1}},sync:{clear:{minArgs:0,maxArgs:0},get:{minArgs:0,maxArgs:1},getBytesInUse:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},set:{minArgs:1,maxArgs:1}}},tabs:{create:{minArgs:1,maxArgs:1},captureVisibleTab:{minArgs:0,maxArgs:2},detectLanguage:{minArgs:0,maxArgs:1},duplicate:{minArgs:1,maxArgs:1},executeScript:{minArgs:1,maxArgs:2},get:{minArgs:1,maxArgs:1},getCurrent:{minArgs:0,maxArgs:0},getZoom:{minArgs:0,maxArgs:1},getZoomSettings:{minArgs:0,maxArgs:1},highlight:{minArgs:1,maxArgs:1},insertCSS:{minArgs:1,maxArgs:2},move:{minArgs:2,maxArgs:2},reload:{minArgs:0,maxArgs:2},remove:{minArgs:1,maxArgs:1},query:{minArgs:1,maxArgs:1},removeCSS:{minArgs:1,maxArgs:2},sendMessage:{minArgs:2,maxArgs:3},setZoom:{minArgs:1,maxArgs:2},setZoomSettings:{minArgs:1,maxArgs:2},update:{minArgs:1,maxArgs:2}},webNavigation:{getAllFrames:{minArgs:1,maxArgs:1},getFrame:{minArgs:1,maxArgs:1}},webRequest:{handlerBehaviorChanged:{minArgs:0,maxArgs:0}},windows:{create:{minArgs:0,maxArgs:1},get:{minArgs:1,maxArgs:2},getAll:{minArgs:0,maxArgs:1},getCurrent:{minArgs:0,maxArgs:1},getLastFocused:{minArgs:0,maxArgs:1},remove:{minArgs:1,maxArgs:1},update:{minArgs:2,maxArgs:2}}};if(0===Object.keys(e).length)throw new Error("api-metadata.json has not been included in browser-polyfill");const t=(e,t)=>{const n=e=>1==e?"argument":"arguments";return function(r,...i){if(i.length<t.minArgs)throw new Error(`Expected at least ${t.minArgs} ${n(t.minArgs)} for ${e}(), got ${i.length}`);if(i.length>t.maxArgs)throw new Error(`Expected at most ${t.maxArgs} ${n(t.maxArgs)} for ${e}(), got ${i.length}`);return new Promise((t,n)=>{r[e](...i,(e=>(...t)=>{chrome.runtime.lastError?e.reject(chrome.runtime.lastError):1===t.length?e.resolve(t[0]):e.resolve(t)})({resolve:t,reject:n}))})}},n=(e,t,n)=>new Proxy(t,{apply:(t,r,i)=>n.call(r,e,...i)});let r=Function.call.bind(Object.prototype.hasOwnProperty);const i=(e,o={},a={})=>{let s=Object.create(null),u={has:(e,t)=>t in e||t in s,get(e,u,c){if(u in s)return s[u];if(!(u in e))return;let l=e[u];if("function"==typeof l)if("function"==typeof o[u])l=n(e,e[u],o[u]);else if(r(a,u)){let r=t(u,a[u]);l=n(e,e[u],r)}else l=l.bind(e);else{if("object"!=typeof l||null===l||!r(o,u)&&!r(a,u))return Object.defineProperty(s,u,{configurable:!0,enumerable:!0,get:()=>e[u],set(t){e[u]=t}}),l;l=i(l,o[u],a[u])}return s[u]=l,l},set:(e,t,n,r)=>(t in s?s[t]=n:e[t]=n,!0),defineProperty:(e,t,n)=>Reflect.defineProperty(s,t,n),deleteProperty:(e,t)=>Reflect.deleteProperty(s,t)};return new Proxy(e,u)},o={runtime:{onMessage:(e=>({addListener(t,n,...r){t.addListener(e.get(n),...r)},hasListener:(t,n)=>t.hasListener(e.get(n)),removeListener(t,n){t.removeListener(e.get(n))}}))(new class extends WeakMap{constructor(e,t){super(t),this.createItem=e}get(e){return this.has(e)||this.set(e,this.createItem(e)),super.get(e)}}(e=>"function"!=typeof e?e:function(t,n,r){let i=e(t,n);if((e=>e&&"object"==typeof e&&"function"==typeof e.then)(i))return i.then(r,e=>{console.error(e),r(e)}),!0;void 0!==i&&r(i)}))}};return i(chrome,o,e)};e.exports=t()}else e.exports=browser},i=[e],void 0===(o="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=o)},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.hash=c,t.hashHex=function(e){return Math.abs(c(e)).toString(16)},t.gotoTab=l,t.gotoOrOpenTab=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=0;return l(e).then(function(r){return r?Promise.resolve():function r(){return s.windows.getLastFocused({windowTypes:["normal"]}).then(function(e){return"normal"!=e.type?++n<20?new Promise(function(e,t){setTimeout(function(){return r()},100)}):new Promise(function(e,t){s.windows.getAll({windowTypes:["normal"]}).then(function(t){if(t.every(function(t){return"normal"!=t.type||(e(t.id),!1)}))throw new Error("No normal window to open tab")})}):e.id}).then(function(n){var r=null;if(n)return s.tabs.query({active:!0,lastFocusedWindow:!0}).then(function(i){return i.length>0&&(r=i[0].id),new Promise(function(t,r){var i=null,o=function e(n,r,o){n==i&&"complete"===r.status&&(s.tabs.onUpdated.removeListener(e),t(o))};s.tabs.onUpdated.addListener(o),s.tabs.create({url:e,windowId:n}).then(function(e){"complete"===e.status?(s.tabs.onUpdated.removeListener(o),t(e)):i=e.id})}).then(function(e){r&&t&&t(e.id,r)})})})}()})},t.arrayEquals=function(e,t){if(e.length!==t.length)return!1;for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0},t.equals=function(e,t){return u(e,t)},t.request=v,t.downloadToByteArray=function(e,t,n,r,i){v({url:e,headers:t,anonymous:n,responseType:"arraybuffer",onComplete:function(e){if(200!=e.status)return i(new Error("Request response status "+e.status));var t=e.response;if(!t)return i(new Error("Empty/no response"));i(null,new Uint8Array(t))}})},t.bufferToHex=function(e){for(var t=[],n=new DataView(e),r=0;r<n.byteLength;r+=4){var i=n.getUint32(r),o=i.toString(16),a=("00000000"+o).slice(-"00000000".length);t.push(a)}return t.join("")},t.Concurrent=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=new(Function.prototype.bind.apply(y,[null].concat(t)));return r.callFn().bind(r)},t.isMinimumVersion=function(e,t){for(var n=e.split(".").map(function(e){return parseInt(e)}),r=t.split(".").map(function(e){return parseInt(e)}),i=0;i<n.length;i++){if(void 0===r[i])return!0;if(n[i]>r[i])return!0;if(n[i]<r[i])return!1}return!0};var s=n(1).browser,u=n(92);function c(e){var t,n,r=0;if(0===e.length)return r;for(t=0,n=e.length;t<n;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return r}function l(e){return s.tabs.query({url:e}).then(function(e){return e.length>0&&(s.tabs.update(e[0].id,{active:!0}),s.windows.update(e[0].windowId,{focused:!0}),!0)})}var d=function(){var e,t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=[];for(e=0;e<t.length;e++)n[e]=t[e];var r=[];for(e=0;e<t.length;++e)r[t.charCodeAt(e)]=e;r["-".charCodeAt(0)]=62,r["_".charCodeAt(0)]=63;var i="undefined"!=typeof Uint8Array?Uint8Array:Array;function o(e){var t=r[e.charCodeAt(0)];return void 0!==t?t:-1}function a(e){return n[e]}function s(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16)+(e[s+1]<<8)+e[s+2],o.push(a((i=r)>>>18>>>0&63)+a(i>>>12>>>0&63)+a(i>>>6>>>0&63)+a(63&i));return o.join("")}return{toByteArray:function(e){var t,n,r,a,s,u;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.length;s="="===e.charAt(c-2)?2:"="===e.charAt(c-1)?1:0,u=new i(3*e.length/4-s),r=s>0?e.length-4:e.length;var l=0;function d(e){u[l++]=e}for(t=0,n=0;t<r;t+=4,n+=3)d((16711680&(a=o(e.charAt(t))<<18|o(e.charAt(t+1))<<12|o(e.charAt(t+2))<<6|o(e.charAt(t+3))))>>>16>>>0),d((65280&a)>>>8>>>0),d((255&a)>>>0);return 2===s?d(255&(a=o(e.charAt(t))<<2|o(e.charAt(t+1))>>>4>>>0)):1===s&&(d((a=o(e.charAt(t))<<10|o(e.charAt(t+1))<<4|o(e.charAt(t+2))>>>2>>>0)>>>8>>>0&255),d(255&a)),u},fromByteArray:function(e){var t,n,r,i=e.length%3,o="",u=[];for(t=0,r=e.length-i;t<r;t+=16383)u.push(s(e,t,t+16383>r?r:t+16383));switch(i){case 1:o+=a((n=e[e.length-1])>>>2>>>0),o+=a(n<<4&63),o+="==";break;case 2:o+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>>10>>>0),o+=a(n>>>4>>>0&63),o+=a(n<<2&63),o+="="}return u.push(o),u.join("")}}}(),f=d.toByteArray,p=d.fromByteArray;t.toByteArray=f,t.fromByteArray=p;var h=function(){function e(t){a(this,e),this.xhr=t}return r(e,[{key:"url",get:function(){return this.xhr.responseURL}},{key:"text",get:function(){return this.xhr.responseText}},{key:"xml",get:function(){return this.xhr.responseXML}},{key:"response",get:function(){return this.xhr.response}},{key:"json",get:function(){try{return JSON.parse(this.xhr.responseText)}catch(e){return null}}},{key:"status",get:function(){return this.xhr.status}},{key:"statusText",get:function(){return this.xhr.statusText}},{key:"headers",get:function(){return{}}}]),e}(),g=["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via","x-chrome-uma-enabled","x-client-data"].map(function(e){return e.toLowerCase()}),m=["Proxy-","Sec-"].map(function(e){return e.toLowerCase()});function v(e){var t=new XMLHttpRequest({mozAnon:e.anonymous});if(e.responseType&&(t.responseType=e.responseType),t.onreadystatechange=function(){4==t.readyState&&e.onComplete&&e.onComplete(new h(t))},t.open(e.method||"GET",e.url),e.headers)for(var n in e.headers)g.indexOf(n.toLowerCase())<0&&m.every(function(e){return!n.toLowerCase().startsWith(e)})&&t.setRequestHeader(n,e.headers[n]);var r=e.contentJSON&&JSON.stringify(e.contentJSON)||e.content||null;t.send(r)}t.Cache=function(){function e(t,n){a(this,e),this.getFn=t,this.setFn=n,this.callbacks=[],this.queried=!1,this.value=void 0}return r(e,[{key:"get",value:function(){var e=this;return function(){return void 0!==e.value?Promise.resolve(e.value):new Promise(function(t,n){if(e.callbacks.push({resolve:t,reject:n}),!e.queried){e.queried=!0;try{Promise.resolve(e.getFn()).then(function(t){for(e.value=t;e.callbacks.length;)e.callbacks.shift().resolve(t)}).catch(function(t){for(;e.callbacks.length;)e.callbacks.shift().reject(t)})}catch(t){for(e.queried=!1;e.callbacks.length;)e.callbacks.shift().reject(t)}}})}}},{key:"set",value:function(e){if(!this.setFn)return Promise.reject(new Error("Value is read-only"));if(void 0===e)return Promise.reject(new Error("Cannot set undefined value"));for(this.value=e;this.callbacks.length;)this.callbacks.shift().resolve(result);return this.setFn(e),Promise.resolve()}}]),e}();var y=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;a(this,e),this.maxFn=t,this.pendings=[],this.count=0}return r(e,[{key:"getMax",value:function(){return Promise.resolve("function"==typeof this.maxFn?this.maxFn():this.maxFn)}},{key:"callFn",value:function(){var e=this;return function(t,n){return e.getMax().then(function(r){return e.count<r?e.doCall(t):new Promise(function(r,i){var o=function(){return Promise.resolve(t()).then(r).catch(i)};e.pendings.push(o),n&&n(function(t){var n=e.pendings.indexOf(o);n>=0&&(e.pendings.splice(n,1),r(t))},function(t){var n=e.pendings.indexOf(o);n>=0&&(e.pendings.splice(n,1),i(t))})})})}}},{key:"attempt",value:function(){if(this.pendings.length>0){var e=this;e.getMax().then(function(t){e.count<t&&e.doCall(e.pendings.shift())})}}},{key:"doCall",value:function(e){var t=this;return this.count++,Promise.resolve(e()).then(function(e){return t.count--,t.attempt(),e}).catch(function(e){throw t.count--,t.attempt(),e})}}]),e}();var b=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.name=n.constructor.name,"function"==typeof Error.captureStackTrace?Error.captureStackTrace(n,n.constructor):n.stack=new Error(e).stack,n}return o(t,Error),t}(),w=t.VDHError=function(e){function t(e,n){a(this,t);var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return Object.assign(r,n),r}return o(t,b),t}();t.DetailsError=function(e){function t(e,n){return a(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,{details:n}))}return o(t,w),r(t,[{key:"details",get:function(){return this.details}}]),t}()},,,function(e,t,n){"use strict";var r=n(2).browser,i={},o=new RegExp("\\$[a-zA-Z]*([0-9]+)\\$","g");function a(){try{null===(i=JSON.parse(window.localStorage.getItem("wehI18nCustom")))&&(i={},r.storage.local.get("wehI18nCustom").then(function(e){var t=e.wehI18nCustom;t&&Object.assign(i,t)}))}catch(e){i={}}}a(),e.exports={getMessage:function(e,t){if(/-/.test(e)){var n=e.replace(/-/g,"_");console.warn("Wrong i18n message name. Should it be",n,"instead of",e,"?"),e=n}var a=i[e];return a&&a.message.length>0?(Array.isArray(t)||(t=[t]),(a.message||"").replace(o,function(e){var n=o.exec(e);return n&&t[parseInt(n[1])-1]||"??"})):r.i18n.getMessage.apply(r.i18n,arguments)},reload:a}},function(e,t){e.exports={buildDate:"Tue Feb 16 2021 16:00:41 GMT+0100 (Central European Standard Time)",buildOptions:{browser:"chrome",noyt:"true"},prod:!0}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dispatch=function(e,t){_.dispatch({type:e,payload:t})},t.getHit=function(e){return _.getState().hits[e]},t.getHits=function(){return _.getState().hits},t.getLogs=function(){return _.getState().logs},t.getF4fHitDataByUrlHint=function(e){var t=_.getState().hits;for(var n in t){var r=t[n];if("f4f"==r.chunked&&r._media&&r._media.urlHint==e)return r}return null};var r=n(53),i=r.createStore,o=r.combineReducers,a=r.applyMiddleware,s=n(113).createLogger,u=n(258),c=n(1),l=n(3),d=n(39),f=n(59),p=n(270),h=(n(62),n(93)),g=n(60),m=n(94),v=n(271),y=n(239),b=n(237),w=n(63),k=n(118);n(40);var x=[];c.prefs.backgroundReduxLogger&&x.push(s({collapsed:function(e,t,n){return!0}}));var A=c.browser,_=i(o({hits:d.reducer,progress:d.progressReducer,logs:h.reducer}),a.apply(void 0,x)),O=u(_.getState,"hits"),I=u(_.getState,"progress"),P=u(_.getState,"logs");function C(){var e=_.getState().hits,t=0,n=0,r=0,i=0;Object.keys(e).forEach(function(o){switch(e[o].status){case"running":i++;break;case"active":t++,n++;break;case"inactive":n++;break;case"pinned":r++}});var o=!1;(0==n||"currenttab"==c.prefs.iconActivation&&0==t)&&(o=!0),A.browserAction.setIcon({path:p.icons({32:"../content/images/icon-32"+(o?"-off":"")+".png",40:"../content/images/icon-40"+(o?"-off":"")+".png",48:"../content/images/icon-48"+(o?"-off":"")+".png",128:"../content/images/icon-128"+(o?"-off":"")+".png"})});var a="",s="#000";switch(c.prefs.iconBadge){case"tasks":s="#00f",a=i||"";break;case"activetab":s="#080",a=t||"";break;case"anytab":s="#b59e32",a=n||"";break;case"pinned":s="#000",a=r||"";break;case"mixed":r>0?(s="#000",a=r):i>0?(s="#00f",a=i):t>0?(s="#080",a=t):n>0&&(s="#b59e32",a=n)}var u=_.getState().logs.filter(function(e){return"error"===e.type});u.length>0&&(a=u.length,s="#f44"),A.browserAction.setBadgeText({text:""+a}),A.browserAction.setBadgeBackgroundColor({color:s})}_.subscribe(O(function(){var e=_.getState().hits;l.call("main","hits",e);try{v.updateHits(e)}catch(e){console.error(e)}C()})),_.subscribe(I(function(){l.call("main","progress",_.getState().progress)})),_.subscribe(P(function(){l.call("main","logs",_.getState().logs),C()})),l.listen({getHits:function(){return _.getState().hits},getHit:function(e){return _.getState().hits[e]},getMainData:function(){return{hits:_.getState().hits,actions:f.describeAll(),logs:_.getState().logs,progress:_.getState().progress}},hitPageData:function(e){d.updateOriginal(e.id,e.data)},closePopup:function(){return l.call("main","close")},closePanel:function(e){return c.ui.close(e)}}),C(),c.rpc.listen({exportSettings:function(){return A.storage.local.get(["blacklist","license","variants","convrules","outputConfigs","smartname"]).then(function(e){var t=Object.assign({blacklist:{},license:null,conversionRules:[],outputConfigs:{}},e,{"weh-prefs":c.prefs.getAll()}),n=new Blob([JSON.stringify(t,null,4)]);A.downloads.download({url:window.URL.createObjectURL(n),filename:"vdh-settings.json",saveAs:!0,conflictAction:"uniquify"})})},importSettings:function(e){return new Promise(function(t,n){e.convrules&&k.set(e.convrules),e.outputConfigs&&g.setOutputConfigs(e.outputConfigs),e.license&&m.setLicense(e.license),e.blacklist&&y.set(e.blacklist),e.variants&&b.setVariants(e.variants),e.smartname&&w.set(e.smartname),t(e["weh-prefs"]||{})})},reloadAddon:function(){A.runtime.reload()}})},,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReadString=function(e,t){var n=[];for(;e[t];)n.push(e[t++]);return{string:String.fromCharCode.apply(null,n),length:n.length+1}},t.ReadInt64=function(e,n){var r=t.ReadInt32(e,n),i=t.ReadInt32(e,n+4);return 4294967296*r+i},t.ReadInt32=function(e,t){return(e[t]<<24)+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3]},t.ReadInt24=function(e,t){return(e[t]<<16)+(e[t+1]<<8)+e[t+2]},t.ReadInt16=function(e,t){return(e[t]<<8)+e[t+1]},t.ReadInt8=function(e,t){return e[t]},t.WriteInt32=function(e,t,n){e[t]=(n>>>24&255)>>>0,e[t+1]=(n>>>16&255)>>>0,e[t+2]=(n>>>8&255)>>>0,e[t+3]=(255&n)>>>0},t.WriteInt24=function(e,t,n){e[t]=(n>>>16&255)>>>0,e[t+1]=(n>>>8&255)>>>0,e[t+2]=(255&n)>>>0},t.WriteInt16=function(e,t,n){e[t]=(n>>>8&255)>>>0,e[t+1]=(255&n)>>>0},t.WriteInt8=function(e,t,n){e[t]=(255&n)>>>0},t.dump=function(e,t,n){t=t||0,n=n||e.length;for(var r=[],i=0;i<n&&i<e.length;i++){i%16==0&&r.push("\n");var o=e[t+i].toString(16).toUpperCase();if(1==o.length&&(o="0"+o),r.push(o),(i+1)%16==0||i==n-1||i==e.length-1){for(var a=i+1;a<(i+15&4294967280);a++)r.push(" ");o="";for(var a=4294967280&i;a<=i;a++){var s=e[t+a];o+=s>=32&&s<127?String.fromCharCode(s):"."}r.push(o)}}return r.join(" ")}},,,,,,,,function(e,t,n){"use strict";var r="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},i=n(9).getMessage;function o(){this.$specs={},this.$values=null,this.$values||(this.$values={}),this.$listeners={}}o.prototype={notify:function(e,t,n,r){for(var i=this,o=e.split("."),a=[],s=o.length;s>=0;s--)a.push(o.slice(0,s).join("."));a.forEach(function(o){var a=i.$listeners[o];a&&a.forEach(function(i){if(i.specs==r)if(i.pack)i.pack[e]=t,void 0===i.old[e]&&(i.old[e]=n),i.timer&&clearTimeout(i.timer),i.timer=setTimeout(function(){delete i.timer;var e=i.pack,t=i.old;i.pack={},i.old={};try{i.callback(e,t)}catch(e){}},0);else try{i.callback(e,t,n)}catch(e){}})})},forceNotify:function(e){void 0===e&&(e=!1);var t=this;Object.keys(t.$specs).forEach(function(n){t.notify(n,t.$values[n],t.$values[n],e)})},declare:function(e){var t=this;Array.isArray(e)||(e=Object.keys(e).map(function(t){var n=e[t];return n.name=t,n})),e.forEach(function(e){if(s[e.name])throw new Error("Forbidden prefs key "+e.name);if(e.hidden)e.label=e.name,e.description="";else{var n=e.name.replace(/[^0-9a-zA-Z_]/g,"_");e.label=e.label||i("weh_prefs_label_"+n)||e.name,e.description=e.description||i("weh_prefs_description_"+n)||""}"choice"==e.type&&(e.choices=(e.choices||[]).map(function(t){if("object"==(void 0===t?"undefined":r(t)))return t;if(e.hidden)return{value:t,name:t};var o=t.replace(/[^0-9a-zA-Z_]/g,"_");return{value:t,name:i("weh_prefs_"+n+"_option_"+o)||t}}));var o,a=null;t.$specs[e.name]||(o=e.name,void 0!==t[e.name]&&(a=t[e.name]),Object.defineProperty(t,o,{set:function(e){var n=t.$values[o];n!==e&&(t.$values[o]=e,t.notify(o,e,n,!1))},get:function(){return void 0!==t.$values[o]?t.$values[o]:t.$specs[o]&&t.$specs[o].defaultValue||void 0}}));var u=t.$specs[e.name];t.$specs[e.name]=e,null!==a?t.$values[e.name]=a:void 0===t.$values[e.name]&&(t.$values[e.name]=e.defaultValue),t.notify(e.name,e,u,!0)})},on:function(){var e="",t={},n=0;"string"==typeof arguments[n]&&(e=arguments[n++]),"object"==r(arguments[n])&&(t=arguments[n++]);var i=arguments[n],o=!!t.pack;this.$listeners[e]||(this.$listeners[e]=[]);var a={callback:i,specs:!!t.specs};o&&(a.pack={},a.old={}),this.$listeners[e].push(a)},off:function(){var e="",t=0;"string"==typeof arguments[t]&&(e=arguments[t++]);var n=arguments[t],r=this.$listeners[e];if(r)for(var i=r.length-1;i>=0;i--)n&&r[i]!=n||r.splice(i,1)},getAll:function(){return Object.assign({},this.$values)},getSpecs:function(){return Object.assign({},this.$specs)},assign:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])},isValid:function(e,t){var n=this.$specs[e];if(n){switch(n.type){case"string":if(n.regexp&&!new RegExp(n.regexp).test(t))return!1;break;case"integer":if(!/^-?[0-9]+$/.test(t))return!1;if(isNaN(parseInt(t)))return!1;case"float":if("float"==n.type){if(!/^-?[0-9]+(\.[0-9]+)?|(\.[0-9]+)$/.test(t))return!1;if(isNaN(parseFloat(t)))return!1}if(void 0!==n.minimum&&t<n.minimum)return!1;if(void 0!==n.maximum&&t>n.maximum)return!1;break;case"choice":var r=!1;if((n.choices||[]).forEach(function(e){t==e.value&&(r=!0)}),!r)return!1}return!0}},reducer:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case"weh.SET_PREFS":e=Object.assign({},e,t.payload)}return e},reduxDispatch:function(e){this.on("",{pack:!0},function(t){e.dispatch({type:"weh.SET_PREFS",payload:t})})}};var a=new o,s={};for(var u in a)a.hasOwnProperty(u)&&(s[u]=!0);e.exports=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.gotoInstall=p,t.call=h,t.listen=function(){return a.listen.apply(a,arguments)},t.check=g,t.isProbablyAvailable=function(){return f},t.request=function(e,t){return new Promise(function(n,r){var i=[];a.call("request",e,t).then(function(e){return f=!0,e}).then(function e(t){i.push(t.data);if(!t.more)return n(i.join(""));a.call("requestExtra",t.id).then(function(t){e(t)}).catch(r)}).catch(r)})},t.requestBinary=function(e,t){return new Promise(function(n,r){var i=0,o=[];a.call("requestBinary",e,t).then(function(e){return f=!0,e}).then(function e(t){t.data&&t.data.data&&(i+=t.data.data.length,o.push(new Uint8Array(t.data.data)));if(!t.more){var s=new Uint8Array(i),u=0;return o.forEach(function(e){s.set(e,u),u+=e.length}),n(s)}a.call("requestExtra",t.id).then(function(t){setTimeout(function(){e(t)})}).catch(r)}).catch(r)})};var r=n(1),i=(r.browser,n(6)),o=n(256),a=n(257)("net.downloadhelper.coapp"),s=n(40),u=i.Concurrent(),c=i.Concurrent(),l=n(10).buildOptions||{},d=null,f=void 0;function p(){u(function(){var e="https://www.downloadhelper.net/install-coapp";return e+="?browser="+(l.browser||""),r.prefs.forcedCoappVersion&&(e+="version="+r.prefs.forcedCoappVersion),s.gotoOrOpenTab(e)})}function h(){return a.call.apply(a,arguments)}function g(){return c(function(){return new Promise(function(e,t){var n=!1;a.callCatchAppNotFound(function(t){f=!1,n=!0,e({status:!1,error:t.message})},"info").then(function(t){f=!0,e({status:!0,info:t})}).catch(function(t){f=!1,n||e({status:!1,error:t.message})})})})}a.onAppNotFound.addListener(function(){p()}),a.onCallCount.addListener(function(e,t){d&&(clearTimeout(d),d=null),0===e&&0===t&&r.prefs.coappIdleExit&&(d=setTimeout(function(){d=null,a.close()},r.prefs.coappIdleExit))});t.downloads=new o.Downloads(a);r.prefs.checkCoappOnStartup&&setTimeout(function(){g()},1e3),r.rpc.listen({coappProxy:h,checkCoApp:g,installCoApp:p})},,,,,,,,,,,,,function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0}),t.reducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];function n(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e;!e.referrer&&t.pageUrl&&(t=Object.assign({},t,{referrer:t.pageUrl})),Object.keys(t).every(function(n){return s.equals(e[n],t[n])})||(e=Object.assign({},e,t));var r=d(e);if("running"!=e.status&&r!=e.status){var o=e.status;if(e===n?e=Object.assign({},e,{status:r}):e.status=r,"orphan"==r&&"orphan"!=o){var c=Date.now(),l=1e3*i.prefs.orphanExpiration;e.orphanT0=c,e.orphanT=c+l,setTimeout(function(){u.dispatch("hit.orphanTimeout",e.id)},l+100)}}var f=a.availableActions(e);return s.equals(f,e.actions)||(e===n?e=Object.assign({},e,{actions:f}):e.actions=f),e}function o(t,i){Array.isArray(t)||(t=[t]),t.forEach(function(t){var o=e[t];if(o){var a=e,s=n(o,i);e===a&&(e=Object.assign({},e,r({},t,s)))}})}switch(t.type){case"hit.new":if(!l.checkHitBlacklisted(t.payload)){var c=t.payload.id,f=e[c],p=n(f||{status:"active"},t.payload);p!==f&&(e=Object.assign({},e,r({},c,p)))}break;case"hits.urlUpdated":var h=e;Object.keys(e).forEach(function(t){var r=e[t],i=n(r);i!==r&&(h===e&&(e=Object.assign({},e)),e[t]=i)});break;case"hit.update":var g=t.payload,m=g.id,v=g.changes;o(m,v);break;case"hit.updateRunning":var y=t.payload,b=y.id,w=y.runningDelta,k=e[b];if(k){var x=k.running||0,A={running:(x||0)+w};0==x&&(A.status="running"),0===A.running&&(A.status="active"),(e=Object.assign({},e))[b]=n(k,A)}break;case"hit.deleteProps":var _=t.payload,O=_.id,I=_.propsToBeDeleted;Array.isArray(O)||(O=[O]),Array.isArray(I)||(I=[I]);var P=e;O.forEach(function(t){var n=e[t];if(n){var r=n;I.forEach(function(t){void 0!==r[t]&&(r===n&&(r=Object.assign({},n),e===P&&(e=Object.assign({},e)),e[r.id]=r),delete r[t])})}});break;case"hit.updateOriginal":var C=t.payload,S=C.id,E=C.changes,j=[];Object.keys(e).forEach(function(t){var n=e[t];t!==S&&S!==n.originalId||j.push(t)}),o(j,E);break;case"hit.delete":var D=e,R=t.payload;Array.isArray(R)||(R=[R]),R.forEach(function(t){var n=e[t];n&&(e===D&&(e=Object.assign({},e)),delete e[t])});break;case"hit.orphanTimeout":var T=t.payload,q=e[T];q&&"orphan"==q.status&&!isNaN(q.orphanT)&&Date.now()>q.orphanT&&delete(e=Object.assign({},e))[T]}return e},t.progressReducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];switch(t.type){case"hit.progress":var n=e[t.payload.id];n!==t.payload.progress&&(e=Object.assign({},e,r({},t.payload.id,t.payload.progress)));break;case"hit.clear-progress":var n=e[t.payload];void 0!==n&&delete(e=Object.assign({},e))[t.payload]}return e},t.statusFromUrl=d,t.create=function(e){u.dispatch("hit.new",e)},t.update=f,t.updateRunning=function(e,t){u.dispatch("hit.updateRunning",{id:e,runningDelta:t})},t.deleteProps=function(e,t){u.dispatch("hit.deleteProps",{id:e,propsToBeDeleted:t})},t.updateOriginal=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u.dispatch("hit.updateOriginal",{id:e,changes:t})},t.updateProgress=function(e,t){null===t?u.dispatch("hit.clear-progress",e):u.dispatch("hit.progress",{id:e,progress:t})},t.setHitOperation=function(e,t){var n=u.getHit(e);n&&n.operation!==t&&f(e,{operation:t})};var i=n(1),o=n(3),a=n(59),s=n(6),u=n(13),c=n(40),l=n(239);function d(e){var t=e.status,n=c.current(),r=n.url,i=n.urls;return"active"==e.status&&e.topUrl!=r?t=e.topUrl in i?"inactive":"orphan":"inactive"!=e.status||e.topUrl in i?"inactive"!=e.status&&"orphan"!=e.status||e.topUrl!=r||(t="active"):t="orphan","orphan"==t&&e.pinned&&(t="pinned"),t}function f(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};u.dispatch("hit.update",{id:e,changes:t})}o.listen({actionCommand:function(e,t){var n=u.getHit(t);return a.execute(e,n)},clearHits:function(e){var t=[],n=u.getHits();for(var r in n){var i=n[r];("all"==e&&"running"!=i.status&&"pinned"!=i.status||"pinned"==e&&"pinned"==i.status||"inactive"==e&&"inactive"==i.status||"orphans"==e&&"orphan"==i.status)&&t.push(r)}u.dispatch("hit.delete",t)}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.update=s,t.current=function(){return{url:u,urls:c}},t.setTransientTab=p,t.gotoOrOpenTab=function(e){return d=null,f=null,o.gotoOrOpenTab(e,p)};var r=n(1).browser,i=n(13),o=n(6),a=null;function s(){a&&clearTimeout(a),a=setTimeout(l,50)}var u="about:blank",c={};function l(){a=null,r.windows.getCurrent().then(function(e){return r.tabs.query({windowId:e.id,active:!0})}).then(function(e){return e.length>0?e[0]:null}).then(function(e){e&&(u=e.url,r.tabs.query({}).then(function(e){for(var t in c={},e)c[e[t].url]=1;i.dispatch("hits.urlUpdated",{url:u,urls:c})}))})}var d=null,f=null;function p(e,t){d=e,f=t}r.windows.onFocusChanged.addListener(s),r.windows.onRemoved.addListener(s),r.tabs.onActivated.addListener(function(e){var t=e.tabId;e.windowId,t!==d&&(d=null,f=null),s()}),r.tabs.onRemoved.addListener(function(e){d===e&&f&&r.tabs.update(f,{active:!0}),d=null,f=null,s()}),r.tabs.onUpdated.addListener(s),r.tabs.onCreated.addListener(function(e){"<next-tab>"===d&&(d=e.id)})},,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(55),i=n(110),o=n(111),a=n(112),s=n(58);n(57);n.d(t,"createStore",function(){return r.b}),n.d(t,"combineReducers",function(){return i.a}),n.d(t,"bindActionCreators",function(){return o.a}),n.d(t,"applyMiddleware",function(){return a.a}),n.d(t,"compose",function(){return s.a})},function(e,t,n){"use strict";var r=n(99),i=n(104),o=n(106),a="[object Object]",s=Function.prototype,u=Object.prototype,c=s.toString,l=u.hasOwnProperty,d=c.call(Object);t.a=function(e){if(!Object(o.a)(e)||Object(r.a)(e)!=a)return!1;var t=Object(i.a)(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==d}},function(e,t,n){"use strict";n.d(t,"a",function(){return o}),t.b=function e(t,n,a){var s;"function"==typeof n&&void 0===a&&(a=n,n=void 0);if(void 0!==a){if("function"!=typeof a)throw new Error("Expected the enhancer to be a function.");return a(e)(t,n)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var u=t;var c=n;var l=[];var d=l;var f=!1;function p(){d===l&&(d=l.slice())}function h(){return c}function g(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return p(),d.push(e),function(){if(t){t=!1,p();var n=d.indexOf(e);d.splice(n,1)}}}function m(e){if(!Object(r.a)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(f)throw new Error("Reducers may not dispatch actions.");try{f=!0,c=u(c,e)}finally{f=!1}for(var t=l=d,n=0;n<t.length;n++){var i=t[n];i()}return e}m({type:o.INIT});return s={dispatch:m,subscribe:g,getState:h,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");u=e,m({type:o.INIT})}},s[i.a]=function(){var e,t=g;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(h())}n();var r=t(n);return{unsubscribe:r}}})[i.a]=function(){return this},e},s};var r=n(54),i=n(107),o={INIT:"@@redux/INIT"}},function(e,t,n){"use strict";var r=n(100).a.Symbol;t.a=r},function(e,t,n){"use strict"},function(e,t,n){"use strict";t.a=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return function(e){return e};if(1===t.length)return t[0];return t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.describeAll=function(){var e={};return Y(function(t){e[t.name]={name:t.name,title:t.title,description:t.description,icon:t.icon,icon18:t.icon.replace(/\-(\d+)\./,"-$1."),catPriority:t.catPriority||0}}),e},t.register=X,t.availableActions=function(e){var t=[];Y(function(n){n.canPerform(e)&&t.push(n.name)});var n=[u.prefs["default-action-0"],u.prefs["default-action-1"],u.prefs["default-action-2"]];return t.sort(function(e,t){var r=Z[e],i=Z[t],o=r.catPriority||0,a=i.catPriority||0;return a!=o?a-o:e==n[o]?-1:t==n[a]?1:i.priority-r.priority}),t},t.execute=function(e,t){var n=Z[e];if(!n)throw new Error("No such action "+e);return new n(t).execute(),n.keepOpen},t.mergeLocal=$,t.convertLocal=ee;var u=n(1),c=u.browser,l=n(3),d=n(39),f=n(93),p=n(13),h=n(6),g=n(114),m=n(26),v=n(94),y=n(261),b=n(60),w=n(234),k=n(235),x=n(268),A=n(63),_=n(118),O=n(62),I=n(10),P=I.buildOptions.noyt||!1,C=n(238).api,S=h.Concurrent(function(){return u.prefs.downloadControlledMax||1/0}),E=h.Concurrent(function(){return u.prefs.convertControlledMax||1/0}),j={},D={},R=0,T=t.Action=function(){function e(t){s(this,e),this.hit=Object.assign({},t),this.reqs={},this.actionId=++R,this.cleanupData={files:[]}}return i(e,[{key:"execute",value:function(){var e=this;e.updateRunning(1),Promise.resolve(e.getReqs()).then(function(){return e.solveAllReqs()}).then(function(){return Promise.resolve(e.doJob())}).then(function(){return Promise.resolve(e.postJob())}).catch(function(t){console.warn("Action error:",t.message),t.noReport||(!t.videoTitle&&e.hit.title&&(t.videoTitle=e.hit.title),t.reportAsLog?f.log(t):f.error(t))}).then(function(){return Promise.resolve(e.cleanup())}).then(function(){e.updateRunning(-1),e.setOperation(null)})}},{key:"getReqs",value:function(){}},{key:"solveReqs",value:function(){}},{key:"solveAllReqs",value:function(){var e=this;return Promise.resolve(e.solveReqs()).then(function(t){if(t)return e.solveAllReqs()})}},{key:"solveCoAppReqs",value:function(){var e=this;return new Promise(function(t,n){m.check().then(function(r){if(delete e.reqs.coapp,r.status){e.hasCoapp=!0;var i=r.info.version;e.reqs.coappMin&&!h.isMinimumVersion(r.info.version,e.reqs.coappMin)?m.call("quit").catch(function(){}).then(function(){return new Promise(function(e,t){setTimeout(function(){e()},u.prefs.coappRestartDelay)})}).then(function(){m.check().then(function(r){r.status&&h.isMinimumVersion(r.info.version,e.reqs.coappMin)?(delete e.reqs.coappMin,t(!0)):(g.alert({title:u._("coapp_outofdate"),text:u._("coapp_outofdate_text",[r.info&&r.info.version||i,e.reqs.coappMin]),buttons:[{text:u._("coapp_update"),className:"btn-success",rpcMethod:"installCoApp"}]}),delete e.reqs.coappMin,n(new h.VDHError("Aborted",{noReport:!0})))})}):(delete e.reqs.coappMin,t(!0))}else g.alert({title:u._("coapp_required"),text:u._("coapp_required_text"),buttons:[{text:u._("coapp_install"),className:"btn-success",rpcMethod:"installCoApp"}]}),n(new h.VDHError("Aborted",{noReport:!0}))})})}},{key:"doJob",value:function(){console.warn("Generic action doJob")}},{key:"postJob",value:function(){}},{key:"cleanup",value:function(){}},{key:"start",value:function(){return console.warn("action.start() is obsolete, use action.execute()"),this.execute()}},{key:"setOperation",value:function(e){d.setHitOperation(this.hit.id,e)}},{key:"setProgress",value:function(e){d.updateProgress(this.hit.id,e)}},{key:"clearProgress",value:function(){d.updateProgress(this.hit.id,null)}},{key:"updateRunning",value:function(e){d.updateRunning(this.hit.id,e)}},{key:"updateHit",value:function(e){d.update(this.hit.id,e)}},{key:"setAbort",value:function(e){var t=j[this.hit.id];t||(t=j[this.hit.id]={}),t[this.actionId]&&console.warn("Overwritting abortable task"),t[this.actionId]=e.bind(this),this.updateHit({})}},{key:"clearAbort",value:function(){var e=j[this.hit.id];e&&(e[this.actionId]&&(delete e[this.actionId],0==Object.keys(e).length&&delete j[this.hit.id]))}},{key:"setStop",value:function(e){var t=D[this.hit.id];t||(t=D[this.hit.id]={}),t[this.actionId]&&console.warn("Overwritting stoppable task"),t[this.actionId]=e.bind(this),this.updateHit({})}},{key:"clearStop",value:function(){var e=D[this.hit.id];e&&(e[this.actionId]&&(delete e[this.actionId],0==Object.keys(e).length&&delete D[this.hit.id]))}}],[{key:"keepOpen",get:function(){return!1}}]),e}(),q=t.DownloadAction=function(e){function t(e){s(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.promptFilename=!0,n.streams={},n.hasCoapp=!1,n}return a(t,T),i(t,[{key:"doJob",value:function(){var e=this;return this.getStreams(),e.solveAllStreamsName().then(function(){return e.ensureOutputDirectory()}).then(function(){return e.downloadAllStreams()}).then(function(){return e.grabInfo()}).then(function(){return e.handleWatermark()}).then(function(){if(e.reqs.aggregate)return e.aggregate()}).then(function(){if(e.reqs.convert)return e.convert()}).then(function(){x.newDownload()}).then(function(){e.watermarked&&e.explainQR()}).then(function(){C&&C.downloadSuccess(e.hit)}).catch(function(t){throw C&&C.downloadError(e.hit,t.message),t})}},{key:"getCoappTmpName",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return m.call("tmp.tmpName",{prefix:e.prefix||"vdh-",postfix:e.postfix||".tmp"})}},{key:"solveStreamName",value:function(e){var t=this;if(t.reqs.aggregate||t.reqs.convert)return t.getCoappTmpName().then(function(n){e.fileName=n.fileName,e.directory=n.directory,e.filePath=n.filePath,t.cleanupData.files.push(n.filePath),t.cleanupData.files.push(n.filePath+".part")});if("coapp"==t.downloadWith){if(t.hit.urls)return new Promise(function(n,r){var i,o=t.hit.type,a=/([^/]*)\.([a-zA-Z0-9]+)(?:\?.*)?$/.exec(e.url);a?(i=a[2],o=a[1]):i=Object.keys(t.hit.extensions)[0];var s=("000000"+e.index).substr(-6);switch(u.prefs.galleryNaming){case"type-index":e.fileName=A.getFilenameFromTitle(t.hit.type+"-"+s,i);break;case"url":e.fileName=A.getFilenameFromTitle(o,i);break;case"index-url":e.fileName=A.getFilenameFromTitle(s+"-"+o,i)}e.directory=t.filePath,m.call("path.homeJoin",e.directory,e.fileName).then(function(t){e.filePath=t,n()}).catch(r)});e.fileName=t.fileName,e.directory=t.directory,e.filePath=t.filePath}else e.fileName=t.getFilename(),t.reqs.needFilename&&(e.saveas=!0)}},{key:"solveAllStreamsName",value:function(){var e=this;return Promise.all(Object.keys(this.streams).map(function(t){return e.solveStreamName(e.streams[t])}))}},{key:"downloadAllStreams",value:function(){var e=this,t=this;return t.setOperation("queued"),S(function(){return t.clearAbort(),t.updateHit({operation:"downloading",opStartDate:Date.now()}),t.hit.chunked?t.downloadAllChunkedStreams():(t.setAbort(t.abortDownload),t.downloadStreamControl=h.Concurrent(function(){return u.prefs.downloadStreamControlledMax||1/0}),Promise.all(Object.keys(e.streams).map(function(e){return t.downloadStream(t.streams[e])})))},function(e,n){t.setAbort(function(){n(new h.VDHError("Aborted",{noReport:!0}))})}).then(function(){t.clearAbort()}).catch(function(e){throw t.clearAbort(),e})}},{key:"downloadStream",value:function(e){var t=this;return t.downloadStreamControl(function(){return t.doDownloadStream(e)})}},{key:"doDownloadStream",value:function(e){var t=this,n={coappDownload:"coapp"===t.downloadWith,proxy:this.hit.proxy,source:{url:e.url,isPrivate:this.hit.isPrivate,headers:e.headers,referrer:e.referrer},target:{filename:e.fileName||this.getFilename(),directory:e.directory,saveAs:!!e.saveas}};return new Promise(function(r,i){e.downloadId=y.download(n,function(n){n&&!t.filePath&&(t.filePath=n),n&&u.prefs.contentRedirectEnabled&&t.hit.possibleContentRedirect&&(void 0===e.contentRedirected&&(e.contentRedirected=3),e.contentRedirect>0)?m.call("fs.stat",n).then(function(o){o.size<2048?m.call("fs.readFile",n,"utf8").then(function(n){f.log({message:"Short content "+o.size,details:n}),/^https?:\/\//.test(n)?(e.contentRedirect--,e.url=n,t.downloadStream(e).then(function(e){r(e)}).catch(function(e){i(e)})):r()}).catch(function(e){i(e)}):r()}).catch(function(e){i(e)}):r()},function(e){i(e)},function(n){e.progress=n;n=0;Object.keys(t.streams).forEach(function(e){n+=t.streams[e].progress||0}),n/=Object.keys(t.streams).length,t.setProgress(n)},t.hit.headers)})}},{key:"downloadAllChunkedStreams",value:function(){var e=this,t=[];Object.keys(e.streams).forEach(function(n){var r=e.streams[n];t.push({fileName:r.filePath,type:n})});var n="hls"==e.hit.chunked;n&&e.setStop(e.stopRecording);var r="dash-adp"==e.hit.chunked;return r&&e.setAbort(e.abortChunkedDownload),new Promise(function(i,o){w.download(e,t,function(){n&&e.clearStop(),r&&e.clearAbort(),i()},function(t){n&&e.clearStop(),r&&e.clearAbort(),o(t)},function(t){e.setProgress(t)})})}},{key:"ensureOutputDirectory",value:function(){var e=this;if(e.directory)return m.call("fs.stat",e.directory).then(function(t){if(!(16384&t.mode))throw new h.DetailsError(u._("error_not_directory",e.directory),"details")},function(t){return new Promise(function(t,n){m.call("fs.mkdirp",e.directory).then(function(){t()})})})}},{key:"grabInfo",value:function(){var e=this,t=e.streams.video||e.streams.full||e.streams.audio;if(t&&t.filePath)return b.info(t.filePath).then(function(t){var n={};t.width&&t.height&&(e.videoInfo=t,n.size=t.width+"x"+t.height),t.duration&&(n.duration=t.duration),t.fps&&(n.fps=t.fps),Object.assign(e.hit,n),e.updateHit(n)}).catch(function(n){var r={file:t.filePath};m.call("fs.stat",t.filePath).then(function(e){r.stat=e}).catch(function(e){r.error=e.message}).then(function(){f.log({message:u._("corrupted_media_file",[e.hit.title,t.filePath]),details:JSON.stringify(r,null,4)+"\n"+n.message})})})}},{key:"handleWatermark",value:function(){var e=this;if(e.videoInfo&&e.license&&"accepted"!=e.license.status&&"unneeded"!=e.license.status)return b.wmForHeight(e.videoInfo.height).then(function(t){e.watermark=t,t&&t.qr&&(e.cleanupData.files.push(t.qr),e.watermarked=!0)})}},{key:"aggregate",value:function(){var e=this;return e.setOperation("converter_queued"),e.setProgress(0),E(function(){return e.doAggregate()},function(t,n){e.setAbort(function(){n(new h.VDHError("Aborted",{noReport:!0}))})}).then(function(){e.clearAbort()}).catch(function(t){throw e.clearAbort(),t})}},{key:"doAggregate",value:function(){var e=this;return e.updateHit({operation:"aggregating",opStartDate:Date.now()}),e.setAbort(function(){e.aborted=!0}),new Promise(function(t,n){b.aggregate({audio:e.streams.audio.filePath,video:e.streams.video.filePath,target:e.intermediateFilePath||e.filePath,wm:e.watermark,videoCodec:e.videoInfo&&e.videoInfo.videoCodec,fps:e.videoInfo&&e.videoInfo.fps},function(t){if(e.aborted)throw new Error("Aborted");var n=e.videoInfo&&e.videoInfo.duration||e.hit.duration;if(n){var r=Math.round(100*t/n);e.setProgress(r)}}).then(t).catch(function(t){n(new h.DetailsError(u._("failed_aggregating",e.hit.title),t.details||t.message||""))})}).then(function(){e.clearAbort(),delete e.watermark}).catch(function(t){throw e.clearAbort(),t})}},{key:"convert",value:function(){var e=this;return e.setOperation("converter_queued"),e.setProgress(0),E(function(){return e.doConvert()},function(t,n){e.setAbort(function(){n(new h.VDHError("Aborted",{noReport:!0}))})}).then(function(){e.clearAbort()}).catch(function(t){throw e.clearAbort(),t})}},{key:"doConvert",value:function(){var e=this;return e.updateHit({operation:"converting",opStartDate:Date.now()}),e.setAbort(function(){e.aborted=!0}),new Promise(function(t,n){var r=e.intermediateFilePath||e.reqs.convert.audioonly&&e.streams.audio&&e.streams.audio.filePath||e.streams.full&&e.streams.full.filePath||e.streams.video&&e.streams.video.filePath||e.streams.audio&&e.streams.video.filePath;if(!r)return n(new Error("Could not determine conversion source"));b.convert({source:r,target:e.filePath,config:e.reqs.convert,wm:e.watermark},function(t){if(e.aborted)throw new Error("Aborted");var n=e.videoInfo&&e.videoInfo.duration||e.hit.duration;if(n){var r=Math.round(100*t/n);e.setProgress(r)}}).then(t).catch(function(t){n(new h.DetailsError(u._("failed_converting",e.hit.title),t.details||t.message||""))})}).then(function(){e.clearAbort()}).catch(function(t){throw e.clearAbort(),t})}},{key:"getStreams",value:function(){var e=this;this.hit.url?this.streams.full={url:this.hit.url}:this.hit.urls?this.hit.urls.forEach(function(t,n){e.streams["doc"+n]={url:new URL(t,e.hit.baseUrl).href,index:n}}):(this.hit.audioUrl&&(this.streams.audio={url:this.hit.audioUrl,contentRedirect:2}),!this.hit.videoUrl||this.reqs.convert&&this.reqs.convert.audioonly||(this.streams.video={url:this.hit.videoUrl,contentRedirect:2})),Object.keys(this.streams).forEach(function(t){var n=e.streams[t];n.type=t,n.headers=e.hit.headers,n.referrer=e.hit.referrer})}},{key:"getReqs",value:function(){var e=this;return P&&O.matchHit(this.hit)?(O.forbidden(),Promise.reject(new h.VDHError("Forbidden",{noReport:!0}))):Promise.resolve(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getReqs",this).call(this)).then(function(){if(!e.reqs.convert)return _.outputConfigForHit(e.hit).then(function(t){t&&(e.hit.extension=t.ext||t.params.f||e.hit.extension),e.reqs.convert=t})}).then(function(){e.promptFilename&&(e.reqs.needFilename=!0),e.hit.convert&&(e.reqs.convert=e.hit.convert),e.hit.urls||e.hit.audioUrl&&e.hit.videoUrl||e.reqs.convert||e.hit.chunked||"coapp"==u.prefs.coappDownloads?(e.reqs.coappMin="1.2.1",e.downloadWith="coapp",e.reqs.promptFilename=e.reqs.needFilename):"ask"==u.prefs.coappDownloads&&(e.reqs.askDownloadMode=!0),!e.hit.audioUrl||!e.hit.videoUrl||e.reqs.convert&&e.reqs.convert.audioonly||(e.reqs.aggregate=!0),e.hit.chunked?(e.reqs.coapp=!0,e.reqs.needFilename&&(e.reqs.promptFilename=!0),"audio-video"==u.prefs.dashOnAdp&&(u.prefs.dashOnAdp="audio_video"),"audio_video"!=u.prefs.dashOnAdp&&delete e.reqs.aggregate,"hls"==e.hit.chunked&&(t.hlsDownloadingCount++,e.hlsDownloadingCounted=!0,v.hlsDownloadLimit&&(e.reqs.checkHlsDownloadLimit=!0))):(e.hit.urls||e.hit.audioUrl&&e.hit.videoUrl)&&(e.reqs.coapp=!0),e.reqs.convert&&e.reqs.convert.audioonly&&(e.reqs.license=!0),(e.reqs.coappMin||e.reqs.aggregate||e.reqs.convert||e.reqs.license)&&(e.reqs.coapp=!0),e.hit.urls&&(delete e.reqs.convert,delete e.reqs.aggregate),(e.reqs.aggregate||e.reqs.convert||e.reqs.license)&&(e.reqs.checkLicense=!0),e.reqs.aggregate&&e.reqs.convert&&(e.reqs.intermediateFilePath=!0),e.reqs.coappMin&&e.hit.proxy&&"http"==e.hit.proxy.type.substr(0,4)&&(e.reqs.coappMin="1.2.1"),e.reqs.coappMin&&e.hit.possibleContentRedirect&&(e.reqs.coappMin="1.2.1"),e.reqs.coappMin&&e.hit.urls&&(e.reqs.coappMin="1.2.2"),"chrome"==I.buildOptions.browser&&e.reqs.coappMin&&!h.isMinimumVersion(e.reqs.coappMin,"1.2.3")&&(e.reqs.coappMin="1.2.3"),"edge"==I.buildOptions.browser&&e.reqs.coappMin&&!h.isMinimumVersion(e.reqs.coappMin,"1.4.0")&&(e.reqs.coappMin="1.4.0"),e.reqs.coappMin&&u.prefs.forcedCoappVersion&&(e.reqs.coappMin=u.prefs.forcedCoappVersion)})}},{key:"solveReqs",value:function(){var e=this;if(e.reqs.askDownloadMode)return new Promise(function(t,n){g.alert({title:u._("download_method"),text:[u._("download_modes1"),u._("download_modes2")],height:350,buttons:[{text:u._("download_with_browser"),className:"btn-primary",close:!0,trigger:{mode:"browser"}},{text:u._("download_with_coapp"),className:"btn-success",close:!0,trigger:{mode:"coapp"}}],notAgain:u._("download_method_not_again")}).then(function(n){e.downloadWith=n.mode,n.notAgain&&(u.prefs.coappDownloads=n.mode),"coapp"==n.mode&&(e.reqs.coappMin="1.2.1",e.reqs.coapp=!0,e.reqs.needFilename&&(e.reqs.promptFilename=!0)),delete e.reqs.askDownloadMode,t(!0)}).catch(function(){n(new h.VDHError("Aborted",{noReport:!0}))})});if(e.reqs.coapp)return e.solveCoAppReqs();if(e.reqs.checkLicense)return new Promise(function(t,n){v.checkLicense().then(function(r){delete e.reqs.checkLicense,e.license=r,e.reqs.license&&"accepted"!=r.status&&"unneeded"!=r.status?(delete e.reqs.license,v.alertAudioNeedsReg(),n(new h.VDHError("Aborted",{noReport:!0}))):t(!0)})});if(e.reqs.checkHlsDownloadLimit){var n=(u.prefs.lastHlsDownload||0)+60*v.hlsDownloadLimit*1e3;if(t.hlsDownloadingCount>1||Date.now()<n)return new Promise(function(t,n){v.checkLicense().then(function(r){delete e.reqs.checkHlsDownloadLimit,e.license=r,"accepted"!=r.status&&"unneeded"!=r.status?(delete e.reqs.license,v.alertHlsDownloadLimit(),n(new h.VDHError("Aborted",{noReport:!0}))):t(!0)})})}return e.reqs.promptFilename?new Promise(function(t,n){delete e.reqs.promptFilename,delete e.reqs.needFilename;var r=e.getFilename({noExtension:!!e.hit.urls});g.saveAs(r,u.prefs.lastDownloadDirectory||"dwhelper",{dirOnly:!!e.hit.urls}).then(function(r){r?(u.prefs.rememberLastDir&&(u.prefs.lastDownloadDirectory=r.directory),e.filePath=r.filePath,e.directory=r.directory,e.fileName=r.fileName,t(!0)):n(new h.VDHError("Aborted",{noReport:!0}))}).catch(n)}):e.fileName||"coapp"!=e.downloadWith?e.reqs.intermediateFilePath?new Promise(function(t,n){delete e.reqs.intermediateFilePath,e.getCoappTmpName({postfix:"."+(e.hit.originalExt||e.hit.extension)}).then(function(n){e.intermediateFilePath=n.filePath,e.cleanupData.files.push(n.filePath),t(!0)}).catch(n)}):void 0:new Promise(function(t,n){delete e.reqs.needFilename;var r=e.getFilename({noExtension:!!e.hit.urls});m.call("makeUniqueFileName",u.prefs.lastDownloadDirectory||"dwhelper",r).then(function(n){e.filePath=n.filePath,e.directory=n.directory,e.fileName=n.fileName,t(!0)}).catch(n)})}},{key:"postJob",value:function(){var e=this;return Promise.resolve(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"postJob",this).call(this)).then(function(){u.prefs.autoPin&&e.updateHit({status:"pinned",pinned:!0})}).then(function(){e.filePath&&e.updateHit({localFilePath:e.filePath,localDirectory:e.directory||void 0})}).then(function(){u.prefs.notifyReady&&(e.hit.isPrivate&&u.prefs.noPrivateNotification||c.notifications.create(e.hit.id,{type:"basic",title:u._("vdh_notification"),message:u._("file_ready",e.filePath||e.hit.title||u._("media")),iconUrl:c.extension.getURL("content/images/icon-36.png")}))}).then(function(){e.hlsDownloadingCounted&&(u.prefs.lastHlsDownload=Date.now())})}},{key:"getFilename",value:function(e){e=e||{};var t=this.hit.title||"video",n=null;return e.noExtension||(n=this.hit.extension||"mp4"),A.getFilenameFromTitle(t,n)}},{key:"getTmpFileName",value:function(){return"vdh-"+Math.round(1e9*Math.random())+".tmp"}},{key:"abortDownload",value:function(){var e=this;Object.keys(e.streams).forEach(function(t){var n=e.streams[t];n.downloadId&&y.abort(n.downloadId)})}},{key:"abortChunkedDownload",value:function(){this.abortChunked?this.abortChunked():console.warn("trying to abort chunked download but not abort function")}},{key:"stopRecording",value:function(){"hls"==this.hit.chunked&&k.stopRecording(this.hit.id)}},{key:"cleanup",value:function(){var e=this;return e.hlsDownloadingCounted&&t.hlsDownloadingCount--,Promise.resolve(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"cleanup",this).call(this)).then(function(){return e.clearProgress(),e.hasCoapp&&!u.prefs.converterKeepTmpFiles&&e.cleanupData.files.forEach(function(e){m.call("fs.unlink",e).catch(function(){})}),Promise.resolve()})}},{key:"explainQR",value:function(){u.prefs.qrMessageNotAgain||u.ui.open("explainqr#"+encodeURIComponent(this.hit.id),{type:u.prefs.alertDialogType,url:"content/explain-qr.html"})}}],[{key:"canPerform",value:function(e){return!(e.running>0)&&(void 0!==e.url||void 0!==e.audioUrl||void 0!==e.videoUrl||void 0!==e.urls)}},{key:"name",get:function(){return"download"}},{key:"title",get:function(){return u._("action_download_title")}},{key:"description",get:function(){return u._("action_download_description")}},{key:"icon",get:function(){return"images/icon-action-download-64.png"}},{key:"priority",get:function(){return 100}}]),t}();q.hlsDownloadingCount=0;var M=function(e){function t(e){s(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.promptFilename=!1,n}return a(t,q),i(t,null,[{key:"canPerform",value:function(e){return!(e.running>0)&&(void 0!==e.url||void 0!==e.audioUrl||void 0!==e.videoUrl||void 0!==e.urls)}},{key:"name",get:function(){return"quickdownload"}},{key:"title",get:function(){return u._("action_quickdownload_title")}},{key:"description",get:function(){return u._("action_quickdownload_description")}},{key:"icon",get:function(){return"images/icon-action-quick-download2-64.png"}},{key:"priority",get:function(){return 90}}]),t}(),F=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){var e=j[this.hit.id]||{};Object.keys(e).forEach(function(t){e[t](),delete e[t]}),0==Object.keys(e).length&&delete j[this.hit.id]}}],[{key:"canPerform",value:function(e){return!!j[e.id]}},{key:"name",get:function(){return"abort"}},{key:"title",get:function(){return u._("action_abort_title")}},{key:"description",get:function(){return u._("action_abort_description")}},{key:"icon",get:function(){return"images/icon-action-abort-64.png"}},{key:"priority",get:function(){return 300}},{key:"catPriority",get:function(){return 2}}]),t}(),U=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){var e=D[this.hit.id]||{};Object.keys(e).forEach(function(t){e[t](),delete e[t]}),0==Object.keys(e).length&&delete D[this.hit.id]}}],[{key:"canPerform",value:function(e){return!!D[e.id]&&!("hls"!=e.chunked||!k.canStop(e.id))}},{key:"name",get:function(){return"stop"}},{key:"title",get:function(){return u._("action_stop_title")}},{key:"description",get:function(){return u._("action_stop_description")}},{key:"icon",get:function(){return"images/icon-action-stoprecord-64.png"}},{key:"priority",get:function(){return 300}},{key:"catPriority",get:function(){return 2}}]),t}(),L=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,q),i(t,[{key:"getReqs",value:function(){var e=this,n=this;return P&&O.matchHit(this.hit)?(O.forbidden(),u.ui.close("main"),Promise.reject(new h.VDHError("Forbidden",{noReport:!0}))):Promise.resolve().then(function(){var t="dlconv#"+e.hit.id;return u.openedContents().indexOf("main")>=0?u.rpc.call("main","embed",c.extension.getURL("content/dlconv-embed.html?panel="+t)).then(function(){return u.wait(t)}).catch(function(e){throw new h.VDHError("Aborted",{noReport:!0})}):b.getOutputConfigs().then(function(e){var t=u.prefs.dlconvLastOutput||"05cb6b27-9167-4d83-833d-218a107d0376",n=e[t];if(!n)throw new Error("No such output configuration");return{outputConfigId:t,outputConfig:n}})}).then(function(e){u.prefs.dlconvLastOutput=e.outputConfigId;var t=e.outputConfig;n.hit.extension&&(n.hit.originalExt=n.hit.extension),n.hit.extension=t.ext||t.params.f||n.hit.extension,n.reqs.convert=e.outputConfig,n.promptFilename=e.prompt}).then(function(){return r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getReqs",e).call(e)})}}],[{key:"canPerform",value:function(e){return!(e.running>0)&&(void 0!==e.url||void 0!==e.audioUrl||void 0!==e.videoUrl)}},{key:"name",get:function(){return"downloadconvert"}},{key:"title",get:function(){return u._("action_downloadconvert_title")}},{key:"description",get:function(){return u._("action_downloadconvert_description")}},{key:"icon",get:function(){return"images/icon-action-download-convert-64.png"}},{key:"priority",get:function(){return 80}},{key:"keepOpen",get:function(){return!0}}]),t}(),N=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return u.ui.open("details#"+encodeURIComponent(this.hit.id),{type:"tab",url:"content/details.html"}),Promise.resolve()}}],[{key:"canPerform",value:function(e){return!0}},{key:"name",get:function(){return"details"}},{key:"title",get:function(){return u._("action_details_title")}},{key:"description",get:function(){return u._("action_details_description")}},{key:"icon",get:function(){return"images/icon-action-details-64.png"}},{key:"priority",get:function(){return 0}}]),t}(),W=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return l.call("main","copyToClipboard",this.hit.url)}}],[{key:"canPerform",value:function(e){return void 0!==e.url}},{key:"name",get:function(){return"copyurl"}},{key:"title",get:function(){return u._("action_copyurl_title")}},{key:"description",get:function(){return u._("action_copyurl_description")}},{key:"icon",get:function(){return"images/icon-action-copy-link-64.png"}},{key:"priority",get:function(){return 30}}]),t}(),z=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return p.dispatch("hit.delete",this.hit.id),Promise.resolve()}}],[{key:"canPerform",value:function(e){return!0}},{key:"name",get:function(){return"deletehit"}},{key:"title",get:function(){return u._("action_deletehit_title")}},{key:"description",get:function(){return u._("action_deletehit_description")}},{key:"icon",get:function(){return"images/icon-action-delete-64.png"}},{key:"priority",get:function(){return 0}}]),t}(),H=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return this.updateHit({pinned:!0}),Promise.resolve()}}],[{key:"canPerform",value:function(e){return!e.pinned}},{key:"name",get:function(){return"pin"}},{key:"title",get:function(){return u._("action_pin_title")}},{key:"description",get:function(){return u._("action_pin_description")}},{key:"icon",get:function(){return"images/icon-action-pin-64.png"}},{key:"priority",get:function(){return 0}}]),t}(),V=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return b.play(this.hit.localFilePath).catch(function(e){throw new h.DetailsError(u._("failed_playing_file"),e.message)})}}],[{key:"canPerform",value:function(e){return!e.urls&&0===e.running&&u.prefs.avplayEnabled&&!e.masked&&!!e.localFilePath}},{key:"name",get:function(){return"cvplay"}},{key:"title",get:function(){return u._("action_avplay_title")}},{key:"description",get:function(){return u._("action_avplay_description")}},{key:"icon",get:function(){return"images/icon-action-avplay-64.png"}},{key:"priority",get:function(){return 180}},{key:"catPriority",get:function(){return 1}}]),t}(),K=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return l.call("main","embed",c.extension.getURL("content/blacklist-embed.html?panel=blacklist#"+encodeURIComponent(this.hit.id))),Promise.resolve()}}],[{key:"canPerform",value:function(e){return void 0!==e.url||void 0!==e.audioUrl||void 0!==e.videoUrl||void 0!==e.topUrl||void 0!==e.pageUrl}},{key:"keepOpen",get:function(){return!0}},{key:"name",get:function(){return"blacklist"}},{key:"title",get:function(){return u._("action_blacklist_title")}},{key:"description",get:function(){return u._("action_blacklist_description")}},{key:"icon",get:function(){return"images/icon-action-blacklist-64.png"}},{key:"priority",get:function(){return 20}}]),t}(),B=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,T),i(t,[{key:"doJob",value:function(){return b.open(this.hit.localFilePath).catch(function(e){throw new h.DetailsError(u._("failed_playing_file"),e.message)})}},{key:"getReqs",value:function(){return this.reqs.coapp=!0,this.reqs.coappMin="1.2.4",Promise.resolve()}},{key:"solveReqs",value:function(){if(this.reqs.coapp)return this.solveCoAppReqs()}}],[{key:"canPerform",value:function(e){return!e.urls&&0==e.running&&!!e.localFilePath}},{key:"name",get:function(){return"openlocalfile"}},{key:"title",get:function(){return u._("action_openlocalfile_title")}},{key:"description",get:function(){return u._("action_openlocalfile_description")}},{key:"icon",get:function(){return"images/icon-action-play-64.png"}},{key:"priority",get:function(){return 200}},{key:"catPriority",get:function(){return 1}}]),t}(),J=function(e){function t(){return s(this,t),o(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return a(t,B),i(t,[{key:"doJob",value:function(){return b.open(this.hit.urls&&this.hit.localFilePath||this.hit.localDirectory).catch(function(e){throw new h.DetailsError(u._("failed_opening_directory"),e.message)})}}],[{key:"canPerform",value:function(e){return!!e.localDirectory||e.urls&&e.localFilePath}},{key:"name",get:function(){return"openlocalcontainer"}},{key:"title",get:function(){return u._("action_openlocalcontainer_title")}},{key:"description",get:function(){return u._("action_openlocalcontainer_description")}},{key:"icon",get:function(){return"images/icon-action-open-dir-64.png"}},{key:"priority",get:function(){return 180}},{key:"catPriority",get:function(){return 1}}]),t}(),Z={};function Y(e){Object.keys(Z).forEach(function(t){var n=Z[t];e(n)})}function X(e){Z[e.name]=e}var G=function(e){function t(e,n){s(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.details=n,d.create(Object.assign(e,{title:n.inFileName})),r}return a(t,M),i(t,[{key:"getReqs",value:function(){return this.reqs.convert=this.details.outputConfig,this.reqs.coappMin="1.2.3",this.downloadWith="coapp",this.reqs.coapp=!0,this.reqs.checkLicense=!0,Promise.resolve()}},{key:"getStreams",value:function(){this.streams.full={type:"full"}}},{key:"solveStreamName",value:function(e){var t=this;return Promise.resolve().then(function(){if(t.details.outFileName)return m.call("path.homeJoin",t.details.outDirectory,t.details.outFileName).then(function(e){t.filePath=e,t.directory=t.details.outDirectory,t.fileName=t.details.outFileName});var e=t.details.inFileName,n=/^(.*)\.([^\.]{1,5})$/.exec(e);return n?e=n[1]+"."+t.details.extension:e+=".mp4",m.call("makeUniqueFileName",t.details.outDirectory,e).then(function(e){t.filePath=e.filePath,t.directory=e.directory,t.fileName=e.fileName})}).then(function(){return m.call("path.homeJoin",t.details.inDirectory,t.details.inFileName).then(function(t){e.filePath=t})})}},{key:"downloadAllStreams",value:function(){return Promise.resolve()}}]),t}();G.idIndex=0;var Q=function(e){function t(e,n){s(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return r.details=n,d.create(e),r}return a(t,M),i(t,[{key:"getReqs",value:function(){this.reqs.coappMin="1.5.0",this.downloadWith,this.reqs.coapp=!0,this.reqs.checkLicense=!0,this.reqs.aggregate=!0}},{key:"getStreams",value:function(){this.streams.audio={type:"audio"},this.streams.video={type:"video"}}},{key:"solveStreamName",value:function(e){e.fileName=this.details[e.type+"FileName"],e.directory=this.details[e.type+"Directory"],e.filePath=this.details[e.type+"FilePath"]}},{key:"downloadAllStreams",value:function(){return Promise.resolve()}},{key:"solveAllReqs",value:function(){var e=this,n=this;return Promise.resolve(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"solveReqs",this).call(this)).then(function(i){return i?r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"solveAllReqs",e).call(e):n.mergePrepare().then(function(){return n.reqs.promptFilename=!0,n.reqs.needFilename=!0,Promise.resolve(r(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"solveReqs",e).call(e))})})}},{key:"mergePrepare",value:function(){var e,n,r,i,o,a,s,c,l=this,d="mkv";return g.selectMergeVideoFile(u.prefs.lastDownloadDirectory||"dwhelper").then(function(t){if(!t)throw new h.VDHError("No video file selected",{noReport:!0});return e=t.fileName,n=t.directory,r=t.filePath,b.info(r,!0)}).then(function(t){var r=t.streams.find(function(e){return"video"==e.codec_type});if(!r)throw new h.VDHError(u._("no_video_in_file",[e]));return s=r.codec_name,g.selectMergeAudioFile(n)}).then(function(e){if(!e)throw new h.VDHError("No audio file selected",{noReport:!0});return i=e.fileName,o=e.directory,a=e.filePath,b.info(a,!0)}).then(function(f){var p={mpeg4:1,h264:1,aac:1,mp3:1},g=f.streams.find(function(e){return"audio"==e.codec_type});if(!g)throw new h.VDHError(u._("no_audio_in_file",[i]));c=g.codec_name,p[s]&&p[c]&&(d="mp4");++t.idIndex;var m=e,v=/^(.*)\.([^\.]{1,5})$/.exec(e);v&&(m=v[1]),l.details={videoFileName:e,videoDirectory:n,videoFilePath:r,audioFileName:i,audioDirectory:o,audioFilePath:a,outFileName:void 0,outDirectory:void 0,outFilePath:void 0,outExtension:d,outputConfig:{format:"mkv"}},l.hit.title=m,l.hit.extension=d}).catch(function(e){throw console.warn("Error merging local",e),e.noReport||g.alert({title:u._("merge_error"),text:e.message}),new h.VDHError("Aborted",{noReport:!0})})}}]),t}();function $(){u.ui.close("main");var e="local-merge:"+ ++Q.idIndex;return new Q({id:e}).execute()}function ee(){var e,t,n,r,i;return u.ui.close("main"),g.selectConvertFiles(u.prefs.lastDownloadDirectory||"dwhelper").then(function(t){if(!t)throw new Error("No file selected");return e=t.selected,r=t.directory,n=t.outputConfig,b.getOutputConfigs().then(function(e){return e[t.outputConfig]})}).then(function(e){if(!e)throw new Error("Unknown output config "+n);if(i=(t=e).ext||t.params.f||"mp4",t.audioonly)return v.checkLicense().then(function(e){if("accepted"!=e.status&&"unneeded"!=e.status)throw v.alertAudioNeedsReg(),new Error("License required for audio conversion")})}).then(function(){if(e.length>1)return g.selectDirectory(r,{titleText:u._("select_output_directory")});var t=e[0],n=/^(.*)\.([^\.]{1,5})$/.exec(t);return n?t=n[1]+"."+i:t+=".mp4",g.saveAs(t,r)}).then(function(o){if(!o)return null;u.prefs.dlconvLastOutput=n,e.forEach(function(e){var n="local-convert:"+ ++G.idIndex;new G({id:n},{inDirectory:r,inFileName:e,outDirectory:o.directory,outFileName:o.fileName,outputConfig:t,extension:i}).execute()})}).catch(function(e){console.warn("Error converting local",e)})}Q.idIndex=0,X(q),X(M),X(F),X(U),X(L),X(N),X(W),X(z),X(H),X(V),X(K),X(B),X(J),l.listen({convertLocal:ee,mergeLocal:$})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateHit=function(e){console.warn("TODO converter.updateHit")},t.info=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=o.call("probe",e,t);return t?n.then(function(e){return JSON.parse(e)}):n},t.play=function(e){return o.call("play",e)},t.open=function(e){return o.call("open",e)},t.wmForHeight=function(e){return new Promise(function(t,n){var r,i,a=1/0,s=null;for(var u in b){var c=parseInt(u),l=Math.abs(e-c);l<a&&(s=u,a=l)}var d=b[s];o.call("tmp.file",{prefix:"vdh-wm-",postfix:".gif"}).then(function(e){var t=e.path,n=e.fd;r=t,i=n;for(var a=atob(d.qr),s=new Array(a.length),u=0;u<a.length;u++)s[u]=a.charCodeAt(u);return o.call("fs.write",i,s)}).then(function(){return o.call("fs.close",i)}).then(function(){t({x:d.x,y:d.y,qr:r})}).catch(n)})},t.makeUniqueFileName=function(e){return o.call("makeUniqueFileName",e)},t.convert=function(e,t){return new Promise(function(n,i){var c=["-y","-i",e.source];e.wm&&e.wm.qr&&!e.config.audioonly&&(c=c.concat(["-i",e.wm.qr,"-filter_complex","[0:v][1:v] overlay="+e.wm.x+":"+e.wm.y]));c.concat([]);for(var l in e.config.params){var d=e.config.params[l];null!==d&&("string"!=typeof d||d.length>0)&&(c.push("-"+l),c.push(""+d))}if(e.config.extra){var f=/^\s*(.*?)\s*$/.exec(e.config.extra)[1].split(/\s+/);f.forEach(function(e){c.push(e)})}e.config.audioonly&&c.push("-vn"),c=c.concat(["-threads",r.prefs.converterThreads,"-strict","experimental"]);var p=++s;u[p]=t,e.config.twopasses?console.warn("TODO implement 2 passes conversion"):(c.push(e.target),o.call("convert",c,{progressTime:""+p}).then(function(t){var o=t.exitCode,s=t.stderr;delete u[p],0!==o?i(new a.DetailsError(r._("failed_converting",e.source),s)):n()}).catch(function(e){delete u[p],i(e)}))})},t.aggregate=function(e,t){return new Promise(function(n,i){var c=["-y","-i",e.audio,"-i",e.video],l=!1;"h264"==e.videoCodec&&r.prefs.converterAggregTuneH264&&(l=!0,e.videoCodec="libx264"),e.wm&&e.videoCodec&&e.fps?c=c.concat(["-i",e.wm.qr,"-filter_complex","[1:v][2:v] overlay="+e.wm.x+":"+e.wm.y,"-c:v",e.videoCodec]):(c.push("-c:v"),l?c.push(e.videoCodec):c.push("copy")),c=c.concat(["-map","0:a","-map","1:v"]),l&&(c=c.concat(["-preset","fast","-tune","film","-profile:v","baseline","-level","30"])),c=(c=c.concat(["-g","9999"])).concat(["-c:a","copy","-threads",r.prefs.converterThreads,"-strict","experimental",e.target]);var d=++s;u[d]=t,o.call("convert",c,{progressTime:""+d}).then(function(e){if(delete u[d],0!==e.exitCode)throw new a.DetailsError("Failed conversion",e.stderr);n()}).catch(function(e){delete u[d],i(e)})})},t.setOutputConfigs=d,t.resetOutputConfigs=f,t.getFormats=p,t.getCodecs=h;var r=n(1),i=r.browser,o=n(26),a=n(6);var s=0,u={};var c=new a.Cache(function(){return i.storage.local.get("outputConfigs").then(function(e){return e.outputConfigs||y})},function(e){return i.storage.local.set({outputConfigs:e})}),l=t.getOutputConfigs=c.get();function d(e){return c.set(Object.assign({},y,e))}function f(){return l().then(function(e){var t=Object.assign({},e);return Object.keys(t).forEach(function(e){t[e].readonly||delete t[e]}),c.set(t)})}function p(){return o.call("formats")}function h(){return o.call("codecs")}r.rpc.listen({getOutputConfigs:l,setOutputConfigs:d,resetOutputConfigs:f,editConverterConfigs:function(e){r.ui.open("convoutput"+(e?"#"+e:""),{type:"tab",url:"content/convoutput.html"})},getFormats:p,getCodecs:h}),o.listen({convertOutput:function(e,t){var n=u[e];n&&n(t)}});var g,m,v,y={"e6587753-4ca5-4d2e-b7ba-beaf1e7f191c":{title:"Re-encoded MP4 (h264/aac)",ext:"mp4",params:{"c:a":"aac",f:"mp4","c:v":"h264"},audioonly:!1,readonly:!0},"249a7d34-3640-4ac3-8300-13827811d2cf":{title:"MPEG (mpeg1+mp2)",ext:"mpg",params:{"c:a":"mp2",f:"mpeg",r:24,"c:v":"mpeg1video"},extra:"-mbd rd -trellis 2 -cmp 2 -subcmp 2 -g 100",audioonly:!1,readonly:!0},"6de4f5ce-8cfe-4f0f-8246-bacb7b0d7624":{title:"WMV 500Kb (Windows Media Player)",ext:"wmv",params:{"c:a":"wmav2",f:"asf","c:v":"wmv2","b:v":"500k"},extra:null,audioonly:!1,readonly:!0},"21a19146-e116-4460-8356-a8eab9cf61ce":{title:"WMV 1Mb (Windows Media Player)",ext:"wmv",params:{"c:a":"wmav2",f:"asf","c:v":"wmv2","b:v":"1000k"},extra:null,audioonly:!1,readonly:!0},"933b1b41-6862-4ce0-9605-10fa5e4b310c":{title:"WMV 2Mb (Windows Media Player)",ext:"wmv",params:{"c:a":"wmav2",f:"asf","c:v":"wmv2","b:v":"2000k"},extra:null,audioonly:!1,readonly:!0},"90195ab2-d891-443c-a164-8f0953ec8975":{title:"WMV 4Mb (Windows Media Player)",ext:"wmv",params:{"c:a":"wmav2",f:"asf","c:v":"wmv2","b:v":"4000k"},extra:null,audioonly:!1,readonly:!0},"3a4cc0a6-6eb0-4cff-90fb-fdf8eb6a9571":{title:"AVI 500Kb (mpeg4/mp3)",ext:"avi",params:{"c:a":"mp3",f:"avi","c:v":"mpeg4","b:v":"500k","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"ebdbb895-7a1e-43e2-bef4-be6e62cb8507":{title:"AVI 1Mb (mpeg4/mp3)",ext:"avi",params:{"c:a":"mp3",f:"avi","c:v":"mpeg4","b:v":"1000k","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"0b6280d3-f8f2-4cb6-8235-a5a4b91488f7":{title:"AVI 2Mb (mpeg4/mp3)",ext:"avi",params:{"c:a":"mp3",f:"avi","c:v":"mpeg4","b:v":"2000k","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"9ea8a22b-5738-4d0f-8494-3037ec568191":{title:"AVI 4Mb (mpeg4/mp3)",ext:"avi",params:(g={"c:a":"mp3",f:"avi","c:v":"mpeg4","b:a":"4000k"},m="b:a",v="128k",m in g?Object.defineProperty(g,m,{value:v,enumerable:!0,configurable:!0,writable:!0}):g[m]=v,g),extra:null,audioonly:!1,readonly:!0},"4174b9dd-c2a0-409d-801d-c84f96be0b76":{title:"MP3",ext:"mp3",params:{"b:a":"128k","c:a":"mp3",f:"mp3"},extra:null,audioonly:!0,readonly:!0},"05cb6b27-9167-4d83-833d-218a107d0376":{title:"MP3 HQ",ext:"mp3",params:{"b:a":"256k","c:a":"mp3",f:"mp3"},extra:null,audioonly:!0,readonly:!0},"69397f64-54f2-4ee4-b47a-b4fc42ee2ec1":{title:"MP4 500Kb",ext:"mp4",params:{"c:v":"mpeg4","c:a":"aac",f:"mp4","b:v":"500k","b:a":"128k",ac:2},extra:"-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300",audioonly:!1,readonly:!0},"16044db3-3b75-4155-b549-c0ba19c18887":{title:"MP4 1Mb",ext:"mp4",params:{"c:v":"mpeg4","c:a":"aac",f:"mp4","b:v":"1000k","b:a":"128k",ac:2},extra:"-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300",audioonly:!1,readonly:!0},"b5535083-bf16-4ae0-a21f-7c637ce0617f":{title:"MP4 2Mb",ext:"mp4",params:{"c:v":"mpeg4","c:a":"aac",f:"mp4","b:v":"2000k","b:a":"128k",ac:2},extra:"-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300",audioonly:!1,readonly:!0},"dfbed97f-46c9-4db8-b5d1-4d19901bc236":{title:"MP4 4Mb",ext:"mp4",params:{"c:v":"mpeg4","c:a":"aac",f:"mp4","b:v":"4000k","b:a":"128k",ac:2},extra:"-mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300",audioonly:!1,readonly:!0},"912806c1-6c43-44ad-ac6e-05f105bade55":{title:"iPhone",ext:"m4v",params:{"c:v":"mpeg4","c:a":"aac",s:"480x320","b:v":"800k",f:"mp4",r:"24","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"2416dcbf-146d-4ca4-b948-f6f702fb043c":{title:"iPod",ext:"m4v",params:{"c:v":"mpeg4","c:a":"aac",s:"320x240","b:v":"500k",f:"mp4",r:"24","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"42fb9cf9-94f9-45c1-954f-1c5879f3d372":{title:"Galaxy Tab",ext:"mp4",params:{"c:a":"aac","b:a":"160k",ac:"2","c:v":"h264",f:"mp4"},extra:"-crf 22",audioonly:!1,readonly:!0},"edf545c2-88fc-4354-b91d-83e2f31d3c14":{title:"MOV (QuickTime player)",ext:"mov",params:{f:"mov","c:v":"h264",preset:"fast","profile:v":"baseline","c:a":"aac","b:a":"128k"},extra:null,audioonly:!1,readonly:!0},"f31ac68e-db3b-4b17-95d7-04456cbc3c26":{title:"Mobile 3GP (Qcif)",ext:"3gp",params:{f:"3gp","c:v":"h263","c:a":"aac","b:a":"12k",s:"176x144","b:v":"64k",ar:"8000",r:"24"},extra:null,audioonly:!1,readonly:!0},"85cd71a0-fb61-45a4-9fed-6f2e6e405bc3":{title:"MPEG-2 DVD (PAL)",ext:"mpeg",params:{f:"mpeg2video",target:"pal-dvd"},extra:null,audioonly:!1,readonly:!0},"47b9b2eb-8fd4-4e10-8993-f7d467ed1928":{title:"MPEG-2 DVD (NTSC)",ext:"mpeg",params:{f:"mpeg2video",target:"ntsc-dvd"},extra:null,audioonly:!1,readonly:!0}},b={240:{x:7,y:7,qr:"R0lGODlhHwAfAKEAAAAAAP///wAAAAAAACH5BAEKAAIALAAAAAAfAB8AAAKejI+pi+DvwksTQgNUZk1jWUlHFWXXZoYhWLLmd7KiK8a1etFpO3cgDKRgLLwXypXj/DY/JTLom9lKpMho0utRt0xatjt8eWDg6PF62nXX2+xIar3CSeG4ln4UL4dvyzOed6Y22CTVtNbBpEjkp5T29gHJyIY4eBYFGanVt4KGBsjZQkk1Ryba8IhipXbjN4nlVqPpc4nUKWua5LSrUAAAOw=="},481:{x:10,y:10,qr:"R0lGODlhXQBdAKEAAAAAAP///wAAAAAAACH5BAEKAAIALAAAAABdAF0AAAL+jI+py+0Po5y02ouz3gr4D4bih4iWeYzquqxuWMIVarw20N5uDJ5yrWN1PD4cJ0KaEYdGSvL4eE6kqaXTCm1Qkdhqc9rNMou5787LK4940rYQ+EV713K4mhbAu1Xp8VyPtZX3NthTV0hn5weXWMgWGIYIaEYouNd4CRnHOPn447go+ZlJuSlqqMg5GkmKCqral3CWerpX5unaive3WorJqvnrS8ibG9wZOvta+1ls66x5q2Rq+YT6fEUdGQWsbXUdPS2dPc42dyjI7U0Wes6Ivu1QHSTsjmivS39Hjw3+bX2MXzeB/QD+O4iLnxh54bTEWwhxWbpDESvSmkjLYkX+bAwwitFRziOTTa6gldrHJ9lDNSNRcjRZ8uLKlrLm1RtpMCUzUy4HMnyY6IVJCcrssXT4Q6iqmB2JvUPKE8LNC/NwaZzKruawmRqwilPZbKFXcmCZYmBq8yfIpQm5mmv3tGmQYm2jyl1H8+4NukO52N3pKVZWiU6X9dwq+KtMnYlx9npJdnEjio6NWc7AsajUnIdbwdwFV10TtDasLtWsddpom5VoKPypNiiye3FjYp2s1/Vsf6vD3AbdmW8q3kbZwgsb3PhwznGFE0Z+XOlO3lXzksZ7Wndp5Y1pe++eL+le7pS9Xye6ErLhygQZw36fMb7W9tLV2S/vkf54i7PpcK9PDd9Gb/iXX3puYTYgcAX+JdIG/SloIIMDtRcbcMfVRaB+dtUHFoYQ6lchdIt5iFyDAIIBVIRHyTWYXxuqmFc56P0VY2jgYWRid2oFKGNzZc0m2odrzRegMiai9hqRSNWlI3sTbqcki32NCNWDvTD545XlfXbQZVMKZmRDneWUWWHhgZkilL+5JxmQFHIpUJGtbTXkdG9Kmd1JcE6ioYj/3bfcgVGiSaN8gL5i1mbdNHkiirEkKlpIbuV4oY8oYvenk3NtWdsW1OmjaZ04MveWnWZqyChxUdKnUauuvgprrLLOSqtGBQAAOw=="},721:{x:15,y:15,qr:"R0lGODlhugC6AKEAAAAAAP///wAAAAAAACH5BAEKAAIALAAAAAC6ALoAAAL+jI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNe2CeT6zvf+D9QtgjscMTc8Kpc/CfMJTR6NUwX0qnRit01rtrSUcsfICPkMEAepRDX6qn1v3V1S2CvHxvNRfBv8lcCnZzbYJxg4codoyLQnBMhz0+HDBglRGVk0uZFp1/NY9inJqeGpCFpIOrpZinEqAtsgC0LrGpqmeflg69F7y5vKuuvwy2EMzIBsKhy8ijDnR2ywHBDN+Ic9bU2oLercCt0t/nxQfU2enb6Nbt5c/E497l4uX688b69OH87/RIeLTiJ/3wjmwpSPWxVvB9c5klZwVjyFhxw2NIhroL7+NRAvbnzIMGBHjRTZTRS40CKtlQnPTWz30WPJiPjgjHyJ02ZIVf1ikmSZEiPCljkrCh3ac+YiiyjvLeMC8Oa+mCIZ/izKcSc4o1SlZmXK06ROsFax0vT69ajKoF2RiuWqtGnSpzDjoq1DdivNukCn2tULMq/Bq/eilvXbN21beESdNk5qeC1is2PC/usoF0hkxnMfvz1jObDawWz/As6Md7TPundTLyY9uTDm1pRRi645VrVSwpBnH1ZsGnZu3HAT3w4u0fFw5LtZ/wZufKnuzSFcyvZGnXm1Vyd9o7ouOPnnvbV1nfUeq7tWvdmjWzq/Pj346RDblx8GP3wt9fr+3dhX3hsl/NEn4HyviUcegOPJ9IF1AR4z4IHEyeQeetVF2FwjFcb30X+daUiSbSB6OB6JCYLol4gamkihgicuiCKGMZa2oUMsqthIRjMuaOKNtK0Y2o48WjiTj8/FqKOQRtpIZHRC5pfMkhRsF2WV+lHZn5VaSjkBllsmU+OUGH5ZZZhdjkkmmPdV4GWapZhZlZs/ltYkmhY4uA2OQ7pFRmjZNShjoMvh2SefLRqYAaEMzrknYFAZ+qcvgj4onGZE6glcnYhyh6iivOXJaKYcMgdop5NeNiqmlp52qaSmvlrcqatKBp1zd9qaJasXSLdabMtx+murut5Ko2eoQpj+UKTDsvnpcY8WGGyqkAJb66C4ipmssJyBaqiTxWZLbLS5bgslgrNW6lqGKe56rYR+ttDsovjJe2WIVsYLr6yHrlvmt5ReCCuMdk6CLwuK2ianui+Wu1/AC6erZcErHNxawhKrQPGR9MJAaJzM5lhxqBt3IqvH2BqCsMgndPwuuyBrrOrKJbcc7iApazzwx/8WSbPONoeM86bUMqxvokDCrPJ7I/M8rcsoA03ruSQLHfSHvnL7ndUP8zrh0jFDTWDWJYq8dJu9Vns1w6VqvS9cyjrqL9pYy8e2qmXnfLbUCj+cr4t2m3ymtXGr7WrdZMtcj6cwcT3i0F47ri26tzH+fnTNhDs9jeL5UP6y5Y9jHpHmw3H+NOifex553seq3jYfRlONurRVT0X6z6Yj3pPoXNXuOuSO88p7662/Lbl/YE89+sW6rUluupSZ3TXwykvIvLnOuwjx7xoF32Pqew9/PDObT68d9kkajnThu5NvHPGsG58+tOsPLjz84xZfX/iAy2G3tztnHLYAUu8N/Xuew+6WuKL1jHXxelbUEPi/eACweQVkW2XuAjjqTNB6FRSYsTbYNe+BkH9k89/c3GUhELKILyQ8UgZTqED1XW55MfTZk0CzthNyKYSmu6EDkbUzTUUQdgz0IZ18FzvZ3S96RhSXDU83wANqr4mrQ57+DoWoQ7NREYcyhGL5pNjDLR4nYizk1xIn9LogvqmMolIiudJ4xTV+sIY2hOMMb/BD1b2QT3b0Yg3yuLc9sgeJaQKkvdxorj5ajI16cx8aCdm8G/bxkMuKYungpqQptrGSX7xkJJ80ySM2rV6d+2Qmw2hGCmKxd90CpSYbucBO2g6TOwplKjm4yjycb0a23KQqR9W4UdItjqBT5NAE+Uux3fFkyySVZZCJy3nhrpnQoyMzmxnLhhHzjPZL5hOVNk0/VhOMtzOPH0NhzGJmc53yw+YzIXlNaPJwdnzL4RhLKEpu5pJ8vYQlPe+JyHk+EE79zN4/uebIFdJPm1VkIhr+5KnQtJ0zaa18KDs5yUh3/nOXFxTmNYXHPrx9r4Fm+VssM1q/VzqrWSb16EjN570Obq2khzvpBxOKTwu2r6YuRSlOD2pAv/EUozeNaU49iL6BjrCoAZUpSGl60P0xVakEPCov4flSCzo1eGI0KFEFp9PKSa6r6aSqVq260q7m05tFPCtQ56hWIlqyoSac5VjFWNa7utWsXORrE/MKsL0KkKFEg2kXwZnLvg2xUUDc5kd3iFg+GtWl9kxpUw/7zstSFrPAFClWu4nCckozsQabmWY5WVnImhOdk6XlVU9LEEfWlZWuRVJrYyvCoHrSepK8bYdyi71g1hZFP2VSQGc4q8sguRK2vz2ubu3K2+XqEzvADWspo3vK6Rr3jMhtYcK+C97wine85C2vec+L3vSqd73sbe96CwAAOw=="},1081:{x:25,y:25,qr:"R0lGODlhNgE2AaEAAAAAAP///wAAAAAAACH5BAEKAAIALAAAAAA2ATYBAAL+jI+py+0Po5y02ouz3rz7D4biSJbmiabqyrbuC8fyTNf2jef6zvf+DwwKh8Si8YhMKpfMpvMJjUqn1KrVAshqt9yu9wsOi8dZCDncO4PN6rb7Td7A5/Q5m56u3+v8/lfuFygIsAeXh/cwqMgHuOjoVvh2aJf4aHnWeKn5V4m4w9i5KbqVOToaCckD6mDaSqjhaoraNmkYGntZivs4q1YrebvrqCus2IupqhdcPEjMHHgcl+zZ8MwLa70YPfabypptjL3WTXr1IuaDLs45zW7Oot7u5ayVjvbeEv95n6Gv448PBUAcAykUtHEw4IiENBhGszdOYQqHMih+i7gPo0T+ExZhdGTw0UXIjRhGwuNXEuU/lSQXsiT40mBMhDNbejC5AucBnRNr2uTAU6DPh+Tq/SQR9ERQh7mWlbvo7oImp76olrHah2i/oU2hzsNKD5pXYGO5bFNW9mlKjQu6VuM6FGvWtFXpXrU7F2/YV3hXvWWrYKnbtmj/RiV8Te+6r30Lg4QLWKYluUwhDwO7uMtZao8jIxA8ubFlxoa1Yd7qeWdoxazXJu5MqTVs07KxjA5XO3Bc0Zx19/Z9GDjt0pozm6X8O0Hl1BGm8g6u/Haz065Jz8ZN/Hhuya8Rx86u9vr07ROWXyavmvnm5Om/iw/vffh7o6ihf14Nnn5+ZPv+71bHPp9/AebV317r2YKeAX7FZ51t3TGoXX8LQghfBebJR6F+A3LT114TClfcc2QVaFyF0T0IYoQbMsRhfRimaOJ9KJ5onwQXApihgDlKI6GHju144IgDGoice0AWWWMALf43HokieuMkkzG29yKNDcJY14Y+skdliBL+iKWOFkoniFZf+rSkVPgNiaSQR7ro5YpcKkhmljvyJaVYCSq55pt5imkljmHiKSdzaTp4XpSFIqgoolcG2iSbT6o4KKGOCgrplHTOKGOSZi7q5qBBxlnplkaK2iaUkv5paaVgZqrhnYNdGqmfoKpqK62a8slpl5S62ueYvW7q6ayowvn+K6x+fCprsNxV2emj0WI6bbLl1bksdbfWKmyiq25rZ67dSutrmdo2O+yotJwL7KnKtvosqe0y+i263uqqZ6PzhvoukZOGe+yZ6aa67p7G9ltirPviGjC4+aqZ7o3cIozsrgdXa7EwptIr7rsfUsyqugCD7HC2FT/cMcYoN4wvoCqbrK/HF9vo7Mvw2vyxzf5m5KlcO9fLctA3gNZzDEQXHbPO7JKcw9HyDr1bjwm7XK7CTAtNk3pLZ420llPfXDXVxJI79tNck80sTFp3+HXaV799ttk0r+1R1F6fLDavxWILdkN2p1yD03I3x7fbSsszuOGB/11q21uH3bfeaFf+xDjci9N9d8iPl20t5BB1DbjfmN/5c+iSJ54UR5UfzvPkbOMducQZj57P6p4XlbfPjhtcOO6REwxO77yrJ7vVOAdfMKvIJw+05ZzPvjfxy8MM8fSvst489qYXb/3I13Y/5+mdP2/87cNHDz7H46bP/PbCJ22+wOyPLzL7ipOfN/ex8z0/6Av3fz/xQQ9t+qtf+jbWv/y9L3vxYyD+Eug6+UEwgAXcnADL90AI0g949rNgBc9HQA3yR3kiVKD0Toi+EKKwhLQ7CuHQlDqpuXCGqoOh7V7YQhrqEIdJOhQIfLjDIMKub0C8SQyFGMQiZrCGOUSiE5f4Opfc8IlCVOL+BTHoISpqMV6Ds2IWtwhG3clQik0MIw2t6MWv/c6MT0TjEUnHxjhCjohvbJwc/7UyLg4wcZQr4xVzh0cewY+Hrigd1i7nP48hkGHOMyCBqqfCROZkimkMpBcFJ4vdDXIGmNwVBwXpQEfmbG4p5KPRKNlJ6pnuk49s2f78qBRUyvJehyRkKwzZyD5Kco6LbF8tRXk9UkYygueY5S4zGMwH9tJcsAugLokJxyEm84/LzOP3SrnBU/qxkhJkpPbWd0tNhvKZphwjJKnVQFe6sWbInCYToSVMaIIzmyS04bCcU7eBRVEE3DynN9s5J3wWU5/mDEE/1cmimf2xlSchaOb++FlHmdmTlsdzZwkUuo13ylOP3gOou+Y4SqE4NJpkPKYjWbnOkRqUnbakpz9ditCJwnOhIY2lShV50YhW1FAKFahIWJrRnE6RlShNKFA1OrFrmlSMJeUXSJPp09rdFGdIhek8O0pTqGK0qtaMZzlf6snWOTWdQzjoL2taxWnqVAVmbSRak6jWoWpzm/xbqxVqaleR0nWFY3UiXuWaz71i05da/Css52pS/bX1KIZdKmI3+k2JHlYijYUsIhNbV8AqpLJfbVoqX/nRNsZ1sgMV7DD7ikTOWhVqxkSdRaOwWLJyFItqLAZRi0paiLZ2tVQV6vRua8m8frGZauSqNYD+203CXtayyiyub5eH3JLFVq+YNS1zgclS1TJzJbsNa0F/2L3o2gu1j+3sL5mq299aEruORcpnh9vU4In3f1glp3lzuc+VWm++klVf3O4bWaVeF7f3HC1Flwtg2Qo4wS3NBn936l8E81bBXp1wg4+7XgIPWJzpnWlWearZn/KVflvdUzVBOd4uCte4oD1tUitM29qGL6TT5eQCU6xcGANSmjPWaoilOlgslniTJ76kj3MLZBfv8cUXXiOPQ+tRstXYvkuuclebbNMDPxXESG5okE2oZSyzWLtYnXJ5rQxmD1uwyIo1apcnOWI0M3S2Tq4nlD/cwxU/17VxvrIzZXz+Zxrr2b19TjM6bSxTBuN5pmR+RpY3TGguVxcXD95yLB6t6DGjN6YF7rF692xhTKu4u6fIcHCPymHWSvq6tjV1cksNau+KeNWKbvWrhbxfFvuOjqQWRaWjHM5Yx7i0ee71Jn696GBHGtLxHV+NbS1d9qo51f919mej2l8lY1jYO551sa2rbBzLGdrNHra3pXztnhoYeaKWNaeh3OgW8/nLdRY3rguNYjh3OtA3PquxjYxvM9sZ3uuet7YNHep4nzSwYVa4B/tNZ4DTW+BgvbLDQWjwWhecxK/tMKM3LmcK/vuDt+62fvcdYQo3F+MJB/m978xtVWY74xzH959LLu/+msN82R/3NL1FDu4crxznZ96uvREe8ocHvb5t/nHEBe3zg+c86U/+ObKpDeGeU/rqJs4vTokLdpxDfeuurni97fhQV+Iy64cm99HPjt/v9jbsZpd2X91OX3Ov0utz1xzd3z72S3OdyHznJdZ1PHVYSzfez/73pq9qcn/vQsOofSvh5W74v0M+8b4+ddTJ23XMQ1HzdLb7P5PNZNS7+7yFH73fX7/4Iwu+7Gp3rujFTHq2MxnvM2/50jHY+N9z/tie53f41tz6ha69J28OsMqDynMWFrLokd/8zdMOXulPnvpwLz3yb89m7R8/5u1+OavzKv7tMzzTSp90e2OfftD+R3/11v8+9j8Q/9kTm/0sp3/fPZ5/2KZvzBZK1zZmAZh6uqaAoXd/RoSAnbd+oQZ07keAefeAp1d+1ed9DEhSAHiB0wZXEdNxe5d7Dvh+mwVUljdOh9cBgwZbKTiCrFeCLeh074BRKkiCsOeBendGMDh+l6eDJ1eB+HCDMRh3QZh9JxgQRfiDKziDQFGD5sCEOweEdbeAbDSFKYd788eD9RdHWSh/ToiE+BeFVwCGGGh/Vkh+cnSGQnd9asiFGmhpE3SATQiHBZhrVUeHMYeDtdd/2zZwexiHc0aGNkd5CVh87FaHVDiGzxdegKZBGUiIJih1pmd07yaI5SZzSVj+iYd4iZsnfZLYh164SY+ohwkkika4gaWYh4GIiouohVBoiIl4aJYIiJo4iTQ4i2KHarz4aYM4iquIh794h57VfJTIf1Xoh8pzhdylhEKYjGJYjKDYjMb4jJwYjTk4jRFXjWpzjYX4jc+3fE3WfYj3OUOIjRKYhstoduW4hc6IjuAYj+LIgtCHi+eYjdCojhzIjurUjao2j7oYjkN3j7ZXkIizj4MoiQtpkDsoh8w3kLIYkcJlgGuIkP7HVmVIkA7pjspnkWKVkAepkP+4YCEpeWFGTdyXi7a4iSWJke8IeBCXkb0Ifyj5ePJIc594hBy5kp7oZzeJjDrnYS4YkyP+p37M+JE12YkRiIi+aJPJN46qN0LSqI9NqZS1CJQCKXUXt39YSYtW2YFVaX61SJQWmG9Pd5TtSJJziIFl2Xtu6JMtiXgd2X5DqZEs+ZBSSXxDtJbA5oZuqXtw+ZU66ZJdWJjDx5VUCYrq9nlC6ZWsKIK7iIsCyJaOaZmEaY5xOXxviIlt53JI95N/KJcbKYOuuHufiZiq6Ig+aHV8yJjGN3GqSZpvOZXuc4x+iZl6uZmaGZVtOJYmaZaBV3mZxYi2iZIkN5mvGYtNV5wnaZeSyZPKOZwBJ5spOZi/SXXAKJ1tSZyxWJdkKZNBmUlE951g6ZzgCZ1iCYHRVp65OYH+zxmbrViUF9iXuomc86l/+ImA9emboNlBTvmA/MmaW2mKVxmAAhqZ8UmMwfmBdCmaK8mc0HWd6Yegx9mdigig+5mU+nmZ2Dk/mql9FQqfBCqfDPqBIoqeCiqhGXqgG2qircmi42mg+VefVOah/umgTPmS1qmM6bijDPmgSRB8MHpuwOmjN7qbRzCkS9mVP4qiHZqXNmqYq3mbnOllTKqY1baj93ml+XikOGqlWjqls+l81OWlOAmlSWoES5qTYyqRAfmmbQqmSMCmaSqlOTqSQUqn77WOX4qnIjmMEalp9QiY9Kijc8qPAHl+6TmAZyqeSBqmEral4WmmNNqnwqimjWjHoTLajiwUqZmZqP/3ovnZmQB0qYf5qR4Zo4rXqSWUqu+pcYlmqqc4qz2KqaUZlrTpaJCYiZlKilmaeTPKqqX6oacKqrYarJs6rIvpqsYKk7iqqaM6fbRarKGKqs6aUpHIq69orccKrK6nrOvZqiL0qu3pptnaq3ekruvKru3qru8Kr/Eqr/NKr/Vqr/eKr/mqr/vKr/3qr/8KsAErsANLsPZaAAA7"}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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};t.finalize=function(e,n,l,d){function h(t){function n(){if(e.masked&&e.action){var t=a.makeFileNames(e.downloadTarget);a.finalize(e.action,t.manifestFilePath,function(n){e.action.hit.data._finalLocalFilePath=t.manifestFilePath,d(n)})}else d(null)}t?n():i.File.move(e.downloadTarget+".part",e.downloadTarget).then(n,d)}function m(){var t=[];e.secDuration=0,n.forEach(function(t){t.scaledDuration=0,t.secDuration=0,(t.stts||[]).forEach(function(e){t.scaledDuration+=e.c*e.d}),e.timeScale&&e.timeScale[t.trackId]&&(t.timeScale=e.timeScale[t.trackId],t.secDuration=t.scaledDuration/t.timeScale),e.secDuration=Math.max(e.secDuration,t.secDuration)}),n.forEach(function(n){var i=function(e,t){if(e.init&&e.init.tkhd&&e.init.tkhd[t.trackId]){var n=e.init.tkhd[t.trackId],r=Math.round(t.secDuration*t.timeScale);return o.WriteInt32(n,20,r),s("tkhd",e.init.tkhd[t.trackId])}var i=new Uint8Array(84);o.WriteInt24(i,1,3),o.WriteInt32(i,4,0),o.WriteInt32(i,8,0),o.WriteInt32(i,12,t.trackId),o.WriteInt32(i,20,e.getTrackDuration(t)),o.WriteInt16(i,32,0),o.WriteInt16(i,34,0),"audio"==t.streamType&&o.WriteInt16(i,36,256);o.WriteInt16(i,38,0),f(i,40),"video"==t.streamType&&(o.WriteInt16(i,76,t.width),o.WriteInt16(i,80,t.height));return s("tkhd",i)}(e,n),a=function(e,t){var n=function(e,t){if(e.init&&e.init.mdhd&&e.init.mdhd[t.trackId]){var n=e.init.mdhd[t.trackId];return o.WriteInt32(n,12,t.timeScale),o.WriteInt32(n,16,Math.round(t.secDuration*t.timeScale)),s("mdhd",n)}var r=new Uint8Array(24);if(o.WriteInt32(r,0,0),o.WriteInt32(r,4,0),o.WriteInt32(r,8,0),"video"==t.streamType){o.WriteInt32(r,12,9e4);var i=90*e.getTrackDuration(t);o.WriteInt32(r,16,i)}else{o.WriteInt32(r,12,t.declaredSampleRate);var i=1024*t.sampleCount;o.WriteInt32(r,16,i)}return o.WriteInt16(r,20,21956),o.WriteInt16(r,22,0),s("mdhd",r)}(e,t),i=function(e,t){if(e.init&&e.init.hdlr&&e.init.hdlr[t.trackId])return s("hdlr",e.init.hdlr[t.trackId]);var n=new Uint8Array(25+"VideoHandler".length);o.WriteInt32(n,0,0),"audio"==t.streamType&&c("mhlr",n,4);"audio"==t.streamType?c("soun",n,8):"video"==t.streamType&&c("vide",n,8);return o.WriteInt32(n,12,0),o.WriteInt32(n,16,0),o.WriteInt32(n,20,0),c("VideoHandler",n,24),s("hdlr",n)}(e,t),a=function(e,t){var n="video"==t.streamType?function(e,t){if(e.init&&e.init.vmhd&&e.init.vmhd[t.trackId])return s("vmhd",e.init.vmhd[t.trackId]);var n=new Uint8Array(12);return o.WriteInt32(n,0,1),o.WriteInt16(n,4,0),o.WriteInt16(n,6,0),o.WriteInt16(n,8,0),o.WriteInt16(n,10,0),s("vmhd",n)}(e,t):[],i="audio"==t.streamType?function(e,t){if(e.init&&e.init.smhd&&e.init.smhd[t.trackId])return s("smhd",e.init.smhd[t.trackId]);var n=new Uint8Array(8);return o.WriteInt32(n,0,0),o.WriteInt16(n,4,0),o.WriteInt16(n,6,0),s("smhd",n)}(e,t):[],a=function(e,t){return e.init&&e.init.dinf&&e.init.dinf[t.trackId]?s("dinf",e.init.dinf[t.trackId]):s("dinf",function(e,t){var n=new Uint8Array(8);o.WriteInt32(n,0,0),o.WriteInt32(n,4,1);var r=function(e,t){var n=new Uint8Array(4);return o.WriteInt32(n,0,1),s("url ",n)}();return s("dref",[n,r])}())}(e,t),c=function(e,t){var n=function(e,t){if(e.init&&e.init.stsd&&e.init.stsd[t.trackId])return s("stsd",e.init.stsd[t.trackId]);var n=new Uint8Array(8);o.WriteInt32(n,0,0),o.WriteInt32(n,4,1);var r=[];"audio"==t.streamType?"mp4a"==t.codec.strTag&&(r=function(e,t){var n=new Uint8Array(28);o.WriteInt32(n,0,0),o.WriteInt32(n,4,1),o.WriteInt32(n,8,0),o.WriteInt32(n,12,0),o.WriteInt16(n,16,2),o.WriteInt16(n,18,16),o.WriteInt16(n,20,0),o.WriteInt16(n,22,0);var r=e.mpd&&e.mpd.sample_rate||t.declaredSampleRate||t.sampleRate||48e3;o.WriteInt16(n,24,r),o.WriteInt16(n,26,0);var i=function(e,t){var n=null;if(void 0!==t.mp4aProfile&&void 0!==t.mp4aRateIndex&&void 0!==t.mp4aChannelCount){var r=0;r|=t.mp4aProfile<<11,r|=t.mp4aRateIndex<<7,r|=t.mp4aChannelCount<<3,n=new Uint8Array(2),o.WriteInt16(n,0,r)}var i=new Uint8Array(36+(n?n.length+5:0));o.WriteInt32(i,0,0),u(i,4,3,27+(n?n.length+5:0)),o.WriteInt16(i,9,t.trackId),o.WriteInt8(i,11,0),u(i,12,4,23),o.WriteInt8(i,17,64),o.WriteInt8(i,18,21),o.WriteInt24(i,19,0);var a=0;if(t.sampleSizes)if(Array.isArray(t.sampleSizes))for(var c=0;c<t.sampleSizes.length;c++)a+=t.sampleSizes[c];else for(var c=0;c<t.sampleSizes.length;c++)a+=o.ReadInt32(t.sampleSizes.data,4*c);else if(Array.isArray(t.dataSizes))for(var c=0;c<t.dataSizes.length;c++)a+=t.dataSizes[c];else for(var l=12;l<t.dataSizes.length;l+=4)a+=o.ReadInt32(t.dataSizes.data,l);var d=Math.round(8*a/t.durationSec);o.WriteInt32(i,22,t.maxBitrate&&Math.round(t.maxBitrate)||2*d),o.WriteInt32(i,26,d),n?(u(i,30,5,n.length),i.set(n,35),u(i,35+n.length,6,1),o.WriteInt8(i,40+n.length,2)):(u(i,30,6,1),o.WriteInt8(i,35,2));return s("esds",i)}(0,t);return s("mp4a",[n,i])}(e,t)):"video"==t.streamType&&"avc1"==t.codec.strTag&&(r=function(e,t){var n=new Uint8Array(78);o.WriteInt32(n,0,0),o.WriteInt16(n,4,0),o.WriteInt16(n,6,1),o.WriteInt16(n,8,0),o.WriteInt16(n,10,0),o.WriteInt32(n,12,0),o.WriteInt32(n,16,0),o.WriteInt32(n,20,0),o.WriteInt16(n,24,t.width),o.WriteInt16(n,26,t.height),o.WriteInt32(n,28,4718592),o.WriteInt32(n,32,4718592),o.WriteInt32(n,36,0),o.WriteInt16(n,40,1),o.WriteInt16(n,74,24),o.WriteInt16(n,76,65535);var r=function(e,t){if(!t.sps||!t.pps)return[];var n=new Uint8Array(t.sps),r=new Uint8Array(t.pps),i=new Uint8Array(11+n.length+r.length);o.WriteInt8(i,0,1),o.WriteInt8(i,1,n[1]),o.WriteInt8(i,2,n[2]),o.WriteInt8(i,3,n[3]),o.WriteInt8(i,4,255),o.WriteInt8(i,5,225),o.WriteInt16(i,6,n.length),i.set(n,8);var a=8+n.length;return o.WriteInt8(i,a,1),o.WriteInt16(i,a+1,r.length),i.set(r,a+3),s("avcC",i)}(0,t);return s("avc1",[n,r])}(0,t));return s("stsd",[n,r])}(e,t),i=function(e,t){if(t.sampleSizes){var n,r,i=!0;if(Array.isArray(t.sampleSizes)){n=t.sampleSizes[0];for(var a=1;a<t.sampleSizes.length;a++)if(t.sampleSizes[a]!=n){i=!1;break}}else{n=o.ReadInt32(t.sampleSizes.data,0);for(var a=1;a<t.sampleSizes.length;a++)if(o.ReadInt32(t.sampleSizes.data,4*a)!=n){i=!1;break}}if(i)r=new Uint8Array(12),o.WriteInt32(r,4,n);else if(r=new Uint8Array(12+4*t.sampleSizes.length),Array.isArray(t.sampleSizes))for(var a=0;a<t.sampleSizes.length;a++)o.WriteInt32(r,12+4*a,t.sampleSizes[a]);else r.set(t.sampleSizes.data.subarray(0,4*t.sampleSizes.length),12);return o.WriteInt32(r,8,t.sampleSizes.length),s("stsz",r)}var u=new Uint8Array(4*t.dataSizes.length+12);if(o.WriteInt32(u,4,0),o.WriteInt32(u,8,t.dataSizes.length),Array.isArray(t.dataSizes))for(var a=0;a<t.dataSizes.length;a++)o.WriteInt32(u,12+4*a,t.dataSizes[a]);else u.set(t.dataSizes.data.subarray(0,4*t.dataSizes.length),12);return s("stsz",u)}(0,t),a=function(e,t){if(t.stts){var n=new Uint8Array(8+8*t.stts.length);o.WriteInt32(n,0,0),o.WriteInt32(n,4,t.stts.length);for(var r=0;r<t.stts.length;r++){var i=t.stts[r];o.WriteInt32(n,8+8*r,i.c),o.WriteInt32(n,8+8*r+4,i.d)}return s("stts",n)}for(var a=[],u=Array.isArray(t.dataTimestamps)?t.dataTimestamps.length:t.dataTimestamps.length/2,r=0;r<u;){var c=0,l=1;if(Array.isArray(t.dataTimestamps))for(;r+l<u&&t.dataTimestamps[r+l]<=t.dataTimestamps[r];l++);else for(;r+l<u&&o.ReadInt64(t.dataTimestamps.data,8*(r+l))<=o.ReadInt64(t.dataTimestamps.data,8*r);l++);r+l<u&&(c=Array.isArray(t.dataTimestamps)?(t.dataTimestamps[r+l]-t.dataTimestamps[r])/l:(o.ReadInt64(t.dataTimestamps.data,8*(r+l))-o.ReadInt64(t.dataTimestamps.data,8*r))/l,t.declaredSampleRate&&(c=Math.round(c*t.declaredSampleRate/9e4))),r+=l,!c||0!=a.length&&a[a.length-1].duration==c?a.length>0&&(a[a.length-1].count+=l):a.push({duration:c,count:l})}var n=new Uint8Array(8+8*a.length);o.WriteInt32(n,0,0),o.WriteInt32(n,4,a.length);for(var r=0;r<a.length;r++)o.WriteInt32(n,8+8*r,a[r].count),o.WriteInt32(n,12+8*r,a[r].duration);return s("stts",n)}(0,t),c="video"==t.streamType?function(e,t){var n=new Uint8Array(8+4*t.keyFrames.length);if(o.WriteInt32(n,0,0),o.WriteInt32(n,4,t.keyFrames.length),Array.isArray(t.keyFrames))for(var r=0;r<t.keyFrames.length;r++)o.WriteInt32(n,8+4*r,t.keyFrames[r]);else n.set(t.keyFrames.data.subarray(0,4*t.keyFrames.length),8);return s("stss",n)}(0,t):[],l=function(e,t){if(t.stsc){var n;if("object"==r(t.stsc[0])){n=t.stsc.length,u=new Uint8Array(8+12*n),o.WriteInt32(u,0,0),o.WriteInt32(u,4,n);for(var i=0;i<t.stsc.length;i++){var a=t.stsc[i];o.WriteInt32(u,8+12*i,a.first_chunk+1),o.WriteInt32(u,8+12*i+4,a.samples_per_chunk),o.WriteInt32(u,8+12*i+8,a.sample_description_index+1)}}else{n=t.stsc.length/3,u=new Uint8Array(8+12*n),o.WriteInt32(u,0,0),o.WriteInt32(u,4,n);for(var i=0;i<t.stsc.length;i++)o.WriteInt32(u,8+12*i,t.stsc[3*i]),o.WriteInt32(u,8+12*i+4,t.stsc[3*i+1]),o.WriteInt32(u,8+12*i+8,t.stsc[3*i+2])}return s("stsc",u)}var u=new Uint8Array(20);return o.WriteInt32(u,0,0),o.WriteInt32(u,4,1),o.WriteInt32(u,8,1),o.WriteInt32(u,12,1),o.WriteInt32(u,16,1),s("stsc",u)}(0,t),d=e.multiMdat?function(e,t){var n="object"==r(t.dataOffsets[0])?t.dataOffsets.length:t.dataOffsets.length/2,i=new Uint8Array(8+8*n);o.WriteInt32(i,0,0),o.WriteInt32(i,4,n);for(var a=0;a<n;a++){var u,c=(u="object"==r(t.dataOffsets[a])?t.dataOffsets[a]:{b:t.dataOffsets[2*a],o:t.dataOffsets[2*a+1]}).o+e.mdatOffsets[u.b];o.WriteInt32(i,8+8*a,Math.floor(c/4294967296)),o.WriteInt32(i,12+8*a,4294967295&c)}return s("co64",i)}(e,t):function(e,t){var n="object"==r(t.dataOffsets[0])?t.dataOffsets.length:t.dataOffsets.length/2,i=new Uint8Array(8+4*n);o.WriteInt32(i,0,0),o.WriteInt32(i,4,n);for(var a=0;a<n;a++){var u,c=(u="object"==r(t.dataOffsets[a])?t.dataOffsets[a]:{b:t.dataOffsets[2*a],o:t.dataOffsets[2*a+1]}).o+e.mdatOffsets[u.b];o.WriteInt32(i,8+4*a,c)}return s("stco",i)}(e,t);return s("stbl",[n,a,c,l,i,d])}(e,t);return s("minf",[n,i,a,c])}(e,t);return s("mdia",[n,i,a])}(e,n),l=function(e,t){var n=e.init&&e.init.edts&&e.init.edts[t.trackId];if(n){var r=g("elst",n);if(r.length>0){var i=o.ReadInt32(r[0].data,12);o.WriteInt32(r[0].data,8,Math.round(1e3*t.secDuration)-i)}return s("edts",n)}return t.shiftTs?s("edts",function(e,t){var n=new Uint8Array(20);return o.WriteInt32(n,0,0),o.WriteInt32(n,4,1),o.WriteInt32(n,8,e.getTrackDuration(t)),o.WriteInt32(n,12,t.shiftTs),o.WriteInt16(n,16,1),o.WriteInt16(n,18,0),s("elst",n)}(e,t)):[]}(e,n),d=s("trak",[i,l,a]);t.push(d)});var l=function(e){if(e.init&&e.init.mvhd){var t=e.init.mvhd;return o.WriteInt32(t,12,1e3),o.WriteInt32(t,16,Math.round(1e3*e.secDuration)),s("mvhd",e.init.mvhd)}var n=new Uint8Array(100);return o.WriteInt8(n,0,0),o.WriteInt24(n,1,0),o.WriteInt32(n,4,0),o.WriteInt32(n,8,0),o.WriteInt32(n,12,1e3),o.WriteInt32(n,16,e.getTotalDuration()),o.WriteInt32(n,20,65536),o.WriteInt16(n,24,256),f(n,36),o.WriteInt32(n,72,0),o.WriteInt32(n,76,0),o.WriteInt32(n,80,0),o.WriteInt32(n,84,0),o.WriteInt32(n,88,0),o.WriteInt32(n,92,0),o.WriteInt32(n,96,e.getNextTrackId()),s("mvhd",n)}(e),m=function(e){if(e.init&&e.init.iods&&e.init.iods)return s("iods",e.init.iods);var t=new Uint8Array(16);return o.WriteInt32(t,0,0),o.WriteInt8(t,4,16),o.WriteInt32(t,5,2155905031),o.WriteInt16(t,9,79),o.WriteInt16(t,11,65535),o.WriteInt16(t,13,65278),o.WriteInt8(t,15,255),s("iods",t)}(e),v=s("moov",[l,m,t]),y=i,b={write:!0,append:!1};e.masked&&(y=a,b.iv=e.biniv,b.key=e.cryptoKey),y.File.open(e.downloadTarget+".part",b).then(function(e){e.setPosition(0,i.File.POS_END).then(function(){p(e,v,function(t){e.close().catch(function(){}).then(function(){return new Promise(function(e,t){setTimeout(e,250)})}).then(function(){t?d(t):h()})})},function(e){d(e)})},function(e){d(e)})}e.rawAppendData?h(!0):e.currentDataBlockSize>0?t.updateMdatLength(e,e.mdatLengthOffset,e.currentDataBlockSize,function(e){if(e)return d(e);m()}):m()},t.mdatBox=function(){return s("mdat",[])};n(1);var i=n(95),o=n(17),a=n(115);function s(e,t){var n=l(t),r=new Uint8Array(4);return o.WriteInt32(r,0,8+n),[r,c(e=(e+" ").substr(0,4)),t]}function u(e,t,n,r){var i=3;for(o.WriteInt8(e,t++,n);i>0;i--)o.WriteInt8(e,t++,(r>>>7*i|128)>>>0);o.WriteInt8(e,t++,127&r)}function c(e,t,n){t=t||new Uint8Array(e.length),n=n||0;for(var r=0,i=e.length;r<i;r++)t[n+r]=255&e.charCodeAt(r);return t}function l(e){if(Array.isArray(e)){for(var t=0,n=0,r=e.length;n<r;n++)t+=l(e[n]);return t}return e.length}function d(e){if(Array.isArray(e)){var t=new Uint8Array(l(e)),n=0;return function e(r){if(Array.isArray(r))for(var i=0,o=r.length;i<o;i++)e(r[i]);else t.set(r,n),n+=r.length}(e),t}return e}function f(e,t){[65536,0,0,0,65536,0,0,0,1073741824].forEach(function(n,r){o.WriteInt32(e,t+4*r,n)})}function p(e,t,n){Date.now(),(t=d(t)).length;e.write(t).then(function(){n(null)},function(e){n(e)})}t.length=l,t.flatten=d,t.firstBuffer=function e(t){return Array.isArray(t)?0==t.length?null:e(t[0]):t};function h(e,t){t=t||e.length;for(var n=0,r=[];;){if(0==t)return r;if(t<8)return null;var i=o.ReadInt32(e,n),a=8;if(1==i&&(i=o.ReadInt64(e,n+8),a=16),i>t||i<8)return null;var s=String.fromCharCode(o.ReadInt8(e,n+4),o.ReadInt8(e,n+5),o.ReadInt8(e,n+6),o.ReadInt8(e,n+7));r.push({name:s,offset:n,length:i,dataOffset:n+a,dataLength:i-a,data:e.subarray(n+a,n+i)}),n+=i,t-=i}}function g(e,t,n){var r=[],i=h(t,n);if(!i)return r;for(var o=0,a=i.length;o<a;o++){var s=i[o];s.name==e&&r.push(s)}return r}t.writeMulti=p,t.writeFileHeader=function(e,t){var n;if(e.init&&e.init.ftyp)n=s("ftyp",e.init.ftyp);else{var r=new Uint8Array(4);o.WriteInt32(r,0,512),n=s("ftyp",[c("isom"),r,c("isomiso2avc1mp41")])}var u=s("free",[]);e.fileSize=e.lastDataIndex=l(n)+l(u);var d=i,f={write:!0,append:!1,truncate:!0};e.masked&&(d=a,f.iv=e.biniv,f.key=e.cryptoKey),d.File.open(e.downloadTarget+".part",f,{unixMode:420}).then(function(e){p(e,[n,u],function(n){e.close().catch(function(){}).then(function(){t(n||null)})})},function(e){t(e)})},t.updateMdatLength=function(e,t,n,r){var s=i,u={write:!0,append:!1};e.masked&&(s=a,u.iv=e.biniv,u.key=e.cryptoKey),s.File.open(e.downloadTarget+".part",u).then(function(e){e.setPosition(t,i.File.POS_START).then(function(){var t=new Uint8Array(4);o.WriteInt32(t,0,n+8),e.write(t).then(function(){e.close().catch(function(){}).then(function(){r(null)})},function(t){e.close().catch(function(){}).then(function(){r(t)})})},function(t){e.close().catch(function(){}).then(function(){r(t)})})},function(e){r(e)})};t.parse=h,t.getTags=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.matchHit=function(e){return![e.url,e.audioUrl,e.videoUrl,e.pageUrl,e.topUrl].every(function(e){return!m.test(e)&&!w.test(e)})},t.forbidden=function(){var e=i._("chrome_noyt_text"),t=u.hash(e),n=i._("chrome_noyt_text3"),r=u.hash(n),o=n;-1960581238==r&&-1126813505!=t&&(o=e);p.alert({title:i._("chrome_warning_yt"),text:[o,i._("chrome_noyt_text2")],height:400,buttons:[{text:i._("chrome_install_firefox"),className:"btn-outline-secondary",close:!0,trigger:{what:"installFirefox"}},{text:i._("chrome_install_fx_vdh"),className:"btn-outline-primary",close:!0,trigger:{what:"vdhForFirefox"}}]}).then(function(e){switch(e.what){case"installFirefox":return c.gotoOrOpenTab("https://getfirefox.com/");case"vdhForFirefox":return c.gotoOrOpenTab("https://addons.mozilla.org/firefox/addon/video-downloadhelper/")}}).catch(function(e){})},t.getVideoMeta=function(e){return O({videoId:e,baseUrl:"https://www.youtube.com",decodeOnly:!0})},t.networkHook=function(e,t){t&&(x=t.proxyInfo||null);if(!w.test(e))return null;var n=y.exec(e);if(!n)return null;var r=n[1];if(!(n=b.exec(e)))return null;var i=n[1],o=k[i];if(!o){var a=s.hasAudioVideo("tbvws:"+r);o=k[i]={variants:{},audio:a.audio,video:a.video,expire:Date.now()+6e4}}return o.variants[r]?null:Promise.resolve(new A({id:i,itag:r,url:e,video:o}))},t.dashManifest=function(e,t,n){if(!n.referrer)return null;var r=v.exec(n.referrer);if(!r)return null;for(var o=r[1],u=(new DOMParser).parseFromString(t,"application/xml").querySelectorAll("AdaptationSet"),c={},l=0,d=[],f=0;f<u.length;f++){for(var p=u[f],h=p.getAttribute("mimeType"),g=p.querySelectorAll(":scope > SegmentList > SegmentTimeline > S"),m=0,y=0;y<g.length;y++)m+=parseInt(g[y].getAttribute("d"))/1e3;l<m&&(l=m);for(var b=p.querySelectorAll("Representation"),y=0;y<b.length;y++){var w=b[y],k=w.getAttribute("id"),x={itag:k,type:h,bandwidth:w.getAttribute("bandwidth"),audioSamplingRate:w.getAttribute("audioSamplingRate")};h.startsWith("audio")?x.audioCodec=w.getAttribute("codecs"):(x.videoCodec=w.getAttribute("codecs"),x.size=w.getAttribute("width")+"x"+w.getAttribute("height"),x.fps=w.getAttribute("frameRate")),d.push(x);var A=w.querySelector("BaseURL");x.url=A.firstChild.nodeValue;var _=w.querySelector("SegmentList"),O=[];c[x.url]={base_url:x.url,init_segment_url:_.querySelector("Initialization").getAttribute("sourceURL"),segments:O};for(var I=_.querySelectorAll("SegmentURL"),P=0;P<I.length;P++){var C=I[P];O.push({url:C.getAttribute("media")})}}}return function(e){var t=s.getHitsFromVariants({videoId:o,originalId:e.id,title:e.title,topUrl:e.topUrl,pageUrl:e.pageUrl,from:"tbvws",group:"grp-"+o,isPrivate:e.isPrivate,extension:"mp4",referrer:e.referrer,thumbnailUrl:e.thumbnailUrl,chunked:"dash-adp",duration:Math.round(l),descrPrefix:i._("dash_streaming"),headers:e.headers,proxy:e.proxy,possibleContentRedirect:!0},d);t.forEach(function(e){e.audioMpd=c[e.audioUrl],e.videoMpd=c[e.videoUrl],e.audioMpd&&e.videoMpd&&a.dispatch("hit.new",e)})}};var i=n(1),o=i.browser,a=n(13),s=n(237),u=n(6),c=n(40),l=(n(60),n(63)),d=n(39),f=n(26),p=n(114),h=n(267),g=new RegExp("^(.*?)=(.*)$"),m=(new RegExp("^([^/;]+)/(?:x-)?([^/;]+)"),new RegExp("^https?://([^/]*\\.)?youtube(\\.co)?.([^./]+)/.*")),v=new RegExp("\\?.*\\bv=([^&]*)"),y=(new RegExp("[?&]signature="),new RegExp("[?&]itag=([^&]+)")),b=new RegExp("[?&]id=([^&]+)"),w=new RegExp("^https?://([^/]*.)?googlevideo\\."),k={},x=null,A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t}return r(e,[{key:"handleHit",value:function(e){!function(e,t){var n=e.url,r=e.id,o=e.itag,u=e.video,c=/^.*?\?(.*)$/.exec(n);if(!c)return null;var l={};c[1].split("&").forEach(function(e){var t=/^(.*?)=(.*)$/.exec(e);t&&(l[t[1]]=t[2])}),u.variants[o]={url:n.replace(/(\?|&)range=[0-9]+\-[0-9]+&?/,"$1"),itag:o,type:decodeURIComponent(l.mime),clen:l.clen},/^audio/.test(l.mime)&&(u.audio=!0);/^video/.test(l.mime)&&(u.video=!0);if(!u.audio||!u.video)return;var d=[];for(var f in u.variants)d.push(u.variants[f]);var p=s.getHitsFromVariants({title:t.title,from:"tbvws",videoId:r,topUrl:t.topUrl,pageUrl:t.pageUrl,originalId:t.originalId,thumbnailUrl:t.thumbnailUrl,duration:l.dur?Math.round(l.dur):void 0,group:"grp-"+r,headers:t.headers,proxy:t.proxy,possibleContentRedirect:!0},d,{audioAndVideo:!0,keepProtected:!0});if(p.length>0&&i.prefs.bulkEnabled&&h.handle(p[0]))return;C(t.tabId,t.frameId,t.originalId),p.forEach(function(e){e._priorityClass=e.adp?-1:1,a.dispatch("hit.new",e)})}(this.data,e)}}]),e}();function O(e,t){return new Promise(function(n,r){var c={referer:e.baseUrl+"/results?search_query="+encodeURIComponent(e.id)};function l(i){var u=!1;if(Array.isArray(i)&&i.forEach(function(e){try{u=u||e.data&&e.data.swfcfg&&!!e.data.swfcfg.args}catch(e){}}),u)try{n(function(e,t){var n=null;if(t.forEach(function(e){if(!n)try{n=e.data&&e.data.swfcfg&&e.data.swfcfg.args}catch(e){}}),!n)return null;var r=null;t.forEach(function(e){r=e.title||r});var i=[],o={videoId:e.videoId,title:n.title||r||e.title||_("video"),topUrl:e.topUrl,pageUrl:e.pageUrl,thumbnailUrl:e.thumbnailUrl,from:"tbvws",maxVariants:e.maxVariants,autoExec:e.autoExec,isPrivate:e.isPrivate,group:"grp-"+e.videoId,headers:e.headers,proxy:e.proxy,possibleContentRedirect:!0};if(n.thumbnail_url&&(o.thumbnail=n.thumbnail_url),n.pageUrl&&(o.pageUrl=n.pageUrl),e.decodeOnly)return o;if(n.player_response)try{var u=JSON.parse(n.player_response),c=u.streamingData;if(c&&["adaptiveFormats","formats"].forEach(function(e){var t=c[e];Array.isArray(t)&&t.forEach(function(e){e.url&&i.push(e)})}),u.videoDetails&&u.videoDetails.thumbnail&&u.videoDetails.thumbnail.thumbnails){var l=u.videoDetails.thumbnail.thumbnails;if(Array.isArray(l)&&l.length>0){var d=l[l.length-1];d.url&&(o.thumbnailUrl=d.url)}}}catch(e){}["url_encoded_fmt_stream_map","adaptive_fmts"].forEach(function(e){n[e]&&n[e].split(",").forEach(function(e){var t={};e.split("&").forEach(function(e){var n=g.exec(e);n&&(t[decodeURIComponent(n[1])]=decodeURIComponent(n[2]))}),t.url&&i.push(t)})}),s.getHitsFromVariants(o,i).forEach(function(e){a.dispatch("hit.new",e)})}(e,i))}catch(e){r(e)}else if(t)1==t?O(e,2).then(n,r):r(new Error("failed retrieving meta data"));else{var c={SID:1,SSID:1,LOGIN_INFO:1};o.cookies.getAll({url:e.baseUrl}).then(function(t){t.forEach(function(e){e.name in c&&t.push(e.name+"="+e.value)}),e.cookie=t.join("; "),O(e,1).then(n,r)},r)}}e.cookie&&(c.cookie=e.cookie);var d=e.baseUrl+"/watch?v="+e.videoId+"&spf=navigate";i.prefs.chunkedCoappManifestsRequests||f.isProbablyAvailable()?f.request(d,{headers:c&&Object.keys(c).map(function(e){return{name:e,value:c[e]}})||[],proxy:i.prefs.coappUseProxy&&x||null}).then(function(e){try{l(JSON.parse(e))}catch(e){return r(new Error("could not parse response meta-data"))}}).catch(function(e){r(e)}):u.request({url:d,onComplete:function(e){if(!e.json)return r(new Error("no response meta-data"));l(e.json)},headers:c,anonymous:!!t})})}var I=!1;function P(e){C(e.tabId,e.frameId,null,0)}function C(e,t,n,r){void 0===r&&(r=i.prefs.tbvwsGrabDelay);var a=3;!function i(){o.tabs.sendMessage(e,{type:"DelayedGetInfo",delay:r,hitId:n},{frameId:t}).catch(function(e){--a>=0&&setTimeout(i,100)})}()}function S(e){C(e.tabId,e.frameId,null)}function E(e){var t=["var _$vdhData = "+JSON.stringify({tabId:e.tabId})+";","var _$vdhSmartNameSpecs = "+JSON.stringify(l.getSpecs(e.url))+";"];if(o.tabs.executeScript(e.tabId,{code:t.join("\n"),frameId:e.frameId}).then(function(){return o.tabs.executeScript(e.tabId,{file:"/content/tbvws-script.js",frameId:e.frameId})}).catch(function(e){}),i.prefs.bulkEnabled)return o.tabs.executeScript(e.tabId,{file:"/content/tbvws-bulk-script.js",frameId:e.frameId,runAt:"document_start"}).catch(function(e){})}function j(){var e=i.prefs.tbvwsEnabled;e&&!I?(I=!0,o.webNavigation.onDOMContentLoaded.addListener(P,{url:[{urlMatches:m.source}]}),o.webNavigation.onHistoryStateUpdated.addListener(S,{url:[{urlMatches:m.source}]}),o.webNavigation.onCommitted.addListener(E,{url:[{urlMatches:m.source}]})):!e&&I&&(o.webNavigation.onDOMContentLoaded.removeListener(P),o.webNavigation.onCommitted.removeListener(E),I=!1)}j(),i.prefs.on("tbvwsEnabled",j);if(setInterval(function(){var e=Date.now();for(var t in k)e>k[t].expire&&delete k[t]},6e4),i.rpc.listen({tbvwsDetectedVideo:function(e){i.prefs.bulkEnabled&&!h.isBulkDetector(e.pageUrl)&&e.hasVideo&&(e.hitId?d.updateOriginal(e.hitId,{title:e.title,pageUrl:e.pageUrl,topUrl:e.topUrl}):o.tabs.get(e.tabId).then(function(t){if(t){e.topUrl=t.url,e.isPrivate=t.incognito;var n=null,r=a.getHits(),i=new URL(e.pageUrl).host;Object.keys(r).every(function(e){var t=r[e];if(t.pageUrl&&new URL(t.pageUrl).host===i)return n=t,!1;return!0}),n&&(e.headers=n.headers,e.proxy=n.proxy),O(e)}}))}}),o.proxy){var D=function(){o.proxy.settings.get({},function(e){if(e.value){var t,n,r=null;switch(e.value.mode){case"fixed_servers":Object.keys(e.value.rules||{}).forEach(function(i){var o=e.value.rules[i];"https"==o.scheme?(r=o.host,t=o.port||443,n="https"):r||"http"!=o.scheme||(r=o.host,t=o.port||80,n="http")})}x=r&&{host:r,port:t,type:n}||null}})};D(),setInterval(D,2e4)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.set=function(e){o=e,a()},t.defineInPage=function(){var e="smartname-page-"+Math.round(1e9*Math.random());i.tabs.executeScript({code:'var _wehPanelName = "'+e+'";'}).then(function(){i.tabs.executeScript({file:"/content/smartname-script.js"})})},t.getSpecs=function(e){for(var t=new URL(e).hostname.split("."),n=0;n<t.length-1;n++){var r=o[t.slice(n).join(".")];if(r)return r}return null},t.getFilenameFromTitle=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n={keep:" ",remove:"",hyphen:"-",underscore:"_"};t&&(t=(t=t.replace(s,"")).replace(u,n[r.prefs.smartnamerFnameSpaces]));e=(e=e.replace(s,"")).replace(u,n[r.prefs.smartnamerFnameSpaces]);var i=r.prefs.smartnamerFnameMaxlen;if(t)return e.length+t.length+1>i&&(e=e.substr(0,i-t.length-1)),e+"."+t;e.length>i&&(e=e.substr(0,i));return e};var r=n(1),i=r.browser,o={};function a(){i.storage.local.set({smartname:o}).catch(function(e){console.error("Cannot write smartname storage")})}i.storage.local.get({smartname:{}}).then(function(e){o=e.smartname}).catch(function(e){console.error("Cannot read smartname storage")});var s=new RegExp('[/?<>\\:*|":]|[\0- €-Ÿ]|\\\\',"g"),u=new RegExp(" +","g");new RegExp("\\.","g");r.rpc.listen({openSmartNameDefiner:function(){return r.ui.open("smartname-definer",{url:"content/smartname-define.html",type:"panel",width:600,height:400})},closeSmartNameDefiner:function(){return r.ui.close("smartname-definer")},setSmartNameData:function(e){return r.rpc.call("smartname-definer","setData",e)},evaluateSmartName:function(e,t){return r.rpc.call(e,"evaluate",t)},addSmartNameRule:function(e){o[e.domain]=e,a()},selectSmartNameXPath:function(e,t){return r.rpc.call(e,"select",t)},setSmartName:function(e){o={},a()},getSmartNameRules:function(){return o},editSmartName:function(){r.ui.open("smartname-edit",{type:"tab",url:"content/smartname-edit.html"})},removeFromSmartName:function(e){delete o[e],a()}})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){var r=Array.prototype.slice,i=n(97),o=n(98),a=e.exports=function(e,t,n){return n||(n={}),e===t||(e instanceof Date&&t instanceof Date?e.getTime()===t.getTime():!e||!t||"object"!=typeof e&&"object"!=typeof t?n.strict?e===t:e==t:function(e,t,n){var c,l;if(s(e)||s(t))return!1;if(e.prototype!==t.prototype)return!1;if(o(e))return!!o(t)&&(e=r.call(e),t=r.call(t),a(e,t,n));if(u(e)){if(!u(t))return!1;if(e.length!==t.length)return!1;for(c=0;c<e.length;c++)if(e[c]!==t[c])return!1;return!0}try{var d=i(e),f=i(t)}catch(e){return!1}if(d.length!=f.length)return!1;for(d.sort(),f.sort(),c=d.length-1;c>=0;c--)if(d[c]!=f[c])return!1;for(c=d.length-1;c>=0;c--)if(l=d[c],!a(e[l],t[l],n))return!1;return typeof e==typeof t}(e,t,n))};function s(e){return null===e||void 0===e}function u(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reducer=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1];switch(t.type){case"log.new":e=e.concat([Object.assign({key:++a},t.payload)]);break;case"log.clear":e=[]}return e},t.error=function(e){s(e,"error")},t.log=s,t.clear=u,t.logDetails=c,t.getEntry=l;var r=n(1),i=r.browser,o=n(13),a=0;function s(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"log";if(e instanceof Error){var n="";e.fileName&&e.lineNumber&&((n=e.fileName+":"+e.lineNumber).columnNumber&&(n+=":"+e.columnNumber),n+="\n"),e.stack&&(n+=e.stack),e={message:e.message,details:e.details||n||void 0,videoTitle:e.videoTitle||void 0}}else e="string"==typeof e?{message:e}:{message:e.message||""+e,details:e.details||void 0};o.dispatch("log.new",Object.assign(e,{type:t}))}function u(){o.dispatch("log.clear")}function c(e){r.rpc.call("main","embed",i.extension.getURL("content/logdetails-embed.html?panel=logdetails#"+encodeURIComponent(e)))}function l(e){var t=null;if(o.getLogs().forEach(function(n){n.key==e&&(t=n)}),t)return t;throw new Error("Log entry not found")}r.rpc.listen({clearLogs:u,logDetails:c,getLogEntry:l})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.validateLicense=h,t.setLicense=g,t.alertAudioNeedsReg=function(){u.alert({title:i._("converter_needs_reg"),text:i._("converter_reg_audio"),buttons:[{text:i._("get_conversion_license"),className:"btn-success",rpcMethod:"goto",rpcArgs:["https://www.downloadhelper.net/convert"+(l.buildOptions.browser?"?browser="+encodeURIComponent(l.buildOptions.browser):"")]}]})},t.alertHlsDownloadLimit=function(){u.alert({title:i._("chrome_premium_required"),text:i._("chrome_premium_hls",[m]),buttons:[{text:i._("continue"),className:"btn-success",rpcMethod:"goto",rpcArgs:["https://www.downloadhelper.net/convert"+(l.buildOptions.browser?"?browser="+encodeURIComponent(l.buildOptions.browser):"")]}]})},t.checkLicense=v;var i=n(1),o=i.browser,a=n(26),s=n(233),u=n(114),c=n(6),l=n(10);var d=new c.Cache(function(){return o.storage.local.get("license").then(function(e){return e.license||null})},function(e){return o.storage.local.set({license:e})}),f=d.get();function p(e,t){var n=new TextEncoder("utf-8").encode(t+e.key+e.email);return crypto.subtle.digest("SHA-256",n).then(function(e){return c.bufferToHex(e)})}function h(e){var t;return a.check().then(function(n){return n.status?(t=n.info.home,new Promise(function(t,n){c.request({url:"https://www.downloadhelper.net/license-check.json",onComplete:function(e){if(e)if(200!=e.status)n(new Error(i._("network_error_status",e.status+" "+e.statusText)));else{var r=l.buildOptions.browser,o=(a=r)&&a.substring(0,1).toUpperCase()+a.substring(1)||"";"fx"==e.json.target&&"firefox"!=r?e={json:Object.assign({},e.json,{status:"mismatch",brLicense:"Firefox",brExt:o})}:"edge"==e.json.target&&"edge"!=r?e={json:Object.assign({},e.json,{status:"mismatch",brLicense:"Edge",brExt:o})}:"chrome"==e.json.target&&"chrome"!=r&&(e={json:Object.assign({},e.json,{status:"mismatch",brLicense:"Chrome",brExt:o})}),t(e.json)}else n(new Error(i._("network_error_no_response")));var a},content:"key="+encodeURIComponent(e)+"&product=converthelper",headers:{"Content-type":"application/x-www-form-urlencoded"},method:"POST"})}).then(function(n){var r={key:e,remoteStatus:n.status,last:Date.now()};return r.name=n.name||r.name,r.email=n.email||r.email,n.brLicense&&(r.brLicense=n.brLicense),n.brExt&&(r.brExt=n.brExt),r.status=n.status,"accepted"==n.status?p(r,t).then(function(e){return r.sign=e,r}):r}).then(function(e){return d.set(e).then(function(){return e})})):{key:e,last:Date.now(),status:"nocoapp"}})}function g(e){return d.set(e)}var m=t.hlsDownloadLimit="edge"===l.buildOptions.browser||"chrome"===l.buildOptions.browser?120:0;function v(){return Promise.all([new Promise(function(e,t){o.runtime.getPlatformInfo().then(function(n){if("linux"==n.os&&!i.prefs.linuxLicense)return e({status:"unneeded"});s.getInApp(!0).then(function(t){t.notSigned?e(Object.assign({status:"unset"},t)):t.premium?e(Object.assign({status:"accepted"},t)):e(Object.assign({status:"unset"},t))}).catch(t)})}),new Promise(function(e,t){o.runtime.getPlatformInfo().then(function(n){if("linux"==n.os&&!i.prefs.linuxLicense)return e({status:"unneeded"});f().then(function(n){if(null===n)return e({status:"unset"});var r={status:"unset"};if(n.email&&(r.email=n.email),n.key&&(r.key=n.key),n.name&&(r.name=n.name),"mismatch"==n.status)return r.status="mismatch",r.brLicense=n.brLicense,r.brExt=n.brExt,e(r);a.check().then(function(t){return t.status?p(n,t.info.home):(r.status="nocoapp",e(r),null)}).then(function(e){if(e)return!n.remoteStatus&&r.key?new Promise(function(t,i){h(r.key).then(function(r){n=r,t(e)}).catch(function(e){i(e)})}):e}).then(function(t){t&&("accepted"==n.remoteStatus&&t===n.sign?r.status="accepted":"blocked"==n.remoteStatus?r.status="blocked":"locked"==n.remoteStatus&&(r.status="locked"),e(r))}).catch(t)}).catch(t)}).catch(t)})]).then(function(e){var t=r(e,2),n=t[0],i=t[1],o=Object.assign({},n,i);return"accepted"!=n.status&&"accepted"!=i.status||(o.status="accepted"),o.customStatus=i.status,o.chromeStatus=n.status,o.chromeMigrationRequired="accepted"==n.status&&"accepted"!=i.status,o}).catch(function(e){throw console.info("checkLicense error",e),e})}i.rpc.listen({checkLicense:v,validateLicense:h,setLicense:g})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(26),o=n(6),a=2e5;t.File=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.fd=t,this.position=0,this.fileLength=0,this.writeControl=o.Concurrent(1)}return r(e,[{key:"_close",value:function(){return i.call("fs.close",this.fd)}},{key:"_write",value:function(e){var t=this;return new Promise(function(n,r){var o=0;!function s(u,c){var l=e.subarray(u,c).toString();i.call("fs.write",t.fd,l,0,c-u,t.position).then(function(r){o+=r,t.position+=r,t.fileLength=Math.max(t.fileLength,t.position),o>=e.length?n(o):s(o,o+Math.min(e.length-o,a))}).catch(r)}(0,Math.min(e.length,a))})}},{key:"_setPosition",value:function(t){switch(arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.POS_START){case e.POS_START:this.position=t;break;case e.POS_END:this.position=this.fileLength-t;break;case e.POS_CUR:this.position+=t}return Promise.resolve()}},{key:"write",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this;return r.writeControl(function(){return r._write.apply(r,t)})}},{key:"close",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this;return r.writeControl(function(){return r._close.apply(r,t)})}},{key:"setPosition",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=this;return r.writeControl(function(){return r._setPosition.apply(r,t)})}}],[{key:"open",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};arguments[2];return new Promise(function(r,o){var a="r";n.write&&(a="r+",n.truncate&&(a="w+")),i.call("fs.open",t,a).catch(function(e){if("r+"==a)return i.call("fs.open",t,"w").then(function(e){return i.call("fs.close",e)}).then(function(){return i.call("fs.open",t,a)});throw e}).then(function(a){var s=new e(a);n.truncate?r(s):i.call("fs.stat",t).then(function(e){s.fileLength=e.size,s.position=e.size,r(s)}).catch(o)}).catch(o)})}},{key:"move",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.call.apply(i,["fs.rename"].concat(t))}},{key:"remove",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.call.apply(i,["fs.unlink"].concat(t))}},{key:"POS_START",get:function(){return 0}},{key:"POS_CUR",get:function(){return 1}},{key:"POS_END",get:function(){return 2}}]),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(1),o=n(61),a=n(39),s=n(93),u=n(6),c=n(115),l=n(95),d=n(13),f=n(26);t.Codecs={27:{id:27,type:"video",name:"h264",strTag:"avc1",tag:1635148593,captureRaw:!0},15:{id:15,type:"audio",name:"aac",strTag:"mp4a",tag:1836069985,captureRaw:!0}},t.Chunkset=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var n=t&&t.url&&u.hashHex(t.url)||"nohash";this.id="chunked:"+n,this.chunks=[],this.hash=n,this.recording=!1,this.lastDlingIndex=-1,this.lastDledIndex=-1,this.lastProcedIndex=-1,this.downloadingCount=0,this.nextTrackId=1,this.lastProgress=-1,this.processedChunksCount=0,this.dataWritten=0,this.currentDataBlockSize=-1,this.fileSize=0,this.mdatOffsets=[],this.multiMdat=!1,this.rawAppendData=!1,this.hit=Object.assign({},t,{id:this.id,length:0,url:t&&t.url||null})}return r(e,[{key:"updateHit",value:function(e){this.hit.length=(this.hit.length||0)+(e.length||0),a.newData(this.hit),this.chunks.push({url:e.url,index:this.chunks.length})}},{key:"handle",value:function(){if(this.recording){for(;this.downloadingCount<i.prefs.chunksConcurrentDownloads&&this.lastDlingIndex+1<this.chunks.length&&this.lastDledIndex-this.lastProcedIndex<i.prefs.chunksPrefetchCount;)this.progressFn&&this.lastProgress<0&&(this.lastProgress=0,this.progressFn(0)),this.downloadingCount++,this.downloadChunk.call(this,this.chunks[++this.lastDlingIndex],function(e,t){if(this.downloadingCount--,e){if(!this.recording)return;this.stopDownloadingOnChunkError?(this.noMoreChunkToDownload=!0,t.index<this.chunks.length&&(this.chunks.splice(t.index),t.index>0?null===this.chunks[t.index-1]&&(this.recording=!1,this.finalize(null)):this.recording&&(this.recording=!1,this.finalize(new Error("No chunk received")))),this.handle()):(this.recording=!1,this.lastDlingIndex=this.lastDledIndex,this.doNotReportDownloadChunkErrors&&this.lastDledIndex>=0?this.finalize(null,function(){}):(console.warn("Error downloading chunk:",e.message||e),s.error(e),this.aborted=!0,this.finalize(e,function(){})))}else for(t.downloading=!1,t.downloaded=!0;this.lastDledIndex+1<this.chunks.length&&this.chunks[this.lastDledIndex+1].downloaded;)this.lastDledIndex++;this.aborted?t.path&&(l.File.remove(t.path),delete t.path):this.handle()});this.recording&&this.lastProcedIndex<this.lastDledIndex&&this.lastProcedIndex<this.chunks.length-1&&!this.chunks[this.lastProcedIndex+1].processing&&this.processChunk.call(this,this.chunks[this.lastProcedIndex+1],function(e,t){e&&console.warn("Error processing chunk: move to next chunk",e),t.processing=!1,this.lastProcedIndex=t.index,t.path&&l.File.remove(t.path),this.handle(),this.chunks[t.index]=null})}}},{key:"downloadChunk",value:function(e,t){if(e.downloaded)return t.call(this,null,e);e.downloading=!0;var n=this;function r(t){i.prefs.chunkedCoappDataRequests?f.requestBinary(e.url,{headers:n.hit.headers||[],proxy:i.prefs.coappUseProxy&&n.hit.proxy||null}).then(function(r){e.data=r,t.call(n,null,e)}).catch(function(r){t.call(n,r,e)}):u.downloadToByteArray(e.url,n.hit.headers||null,n.hit.isPrivate,!!n.masked,function(r,i){r||(e.data=i),t.call(n,r,e)})}e.downloadRetries=0,r(function e(o,a){o&&a.downloadRetries++<=i.prefs.downloadRetries?setTimeout(function(){n.recording&&r(e)},i.prefs.downloadRetryDelay):(delete a.downloadRetries,t.call(n,o,a))})}},{key:"processChunkData",value:function(e,t){t.call(this,null,e)}},{key:"processChunk",value:function(e,t){var n=this;function r(r){function i(){n.processChunkData(r,function(r,i){r?t.call(n,r,e):n.appendDataToOutputFile(i,function(r){if(r||(n.dataWritten+=o.length(i)),n.processedSegmentsCount++,n.processedSegmentsCount>=n.segmentsCount)n.outOfChunks();else if(n.progressFn&&!n.aborted){var a=Math.round(100*n.processedSegmentsCount/(n.segmentsCount||n.chunks.length||1));a!=n.lastProgress&&n.progressFn(a),n.lastProgress=a}t.call(n,r,e)})})}n.endsOnSeenChunk?crypto.subtle.digest({name:"SHA-256"},r).then(function(e){for(var t=[],r=new DataView(e),o=0;o<r.byteLength;o+=4){var a=("00000000"+r.getUint32(o).toString(16)).slice(-"00000000".length);t.push(a)}var s=t.join("");if(n.seenChunks=n.seenChunks||{},n.seenChunks[s])return n.recording=!1,void n.finalize(null);n.seenChunks[s]=!0,i()}):i()}e.processing=!0,e.data?r(e.data):l.File.read(e.path).then(function(e){r(e)},function(r){t.call(n,r,e)})}},{key:"outOfChunks",value:function(){this.recording=!1,this.finalize(null)}},{key:"download",value:function(e,t,n,r,i){var a=this;this.downloadTarget=t[0].fileName,this.aborted=!1,this.action=e,o.writeFileHeader(this,function(e){e?r(e):(a.recording=!0,a.handle())})}},{key:"getNextTrackId",value:function(){return this.nextTrackId}},{key:"setNewId",value:function(){for(var e=1;d.getHit(this.id+"-"+e);)e++;this.id=this.id+"-"+e,this.hit&&(this.hit.id=this.id),this.action&&this.action.hit&&(this.action.hit.id=this.id)}},{key:"finalize",value:function(e,t){if(this.cleanupChunkFiles(),this.progressFn&&this.progressFn(100),e&&this.errorFn?this.errorFn(e):!e&&this.successFn&&this.successFn(),!e){var n=d.getHit(this.id);if(n){var r=Object.assign({},n);this.hit=r,delete r.url,d.dispatch("hit.delete",this.id),this.setNewId(),r.id=this.id,d.dispatch("hit.new",r)}}t&&t(e)}},{key:"appendDataToOutputFile",value:function(e,t){var n=this,r=o.length(e);function i(){n.currentDataBlockSize+=r,n.appendToOutputFile(e,function(e){if(e)return t(e);t(null)})}function a(){n.mdatOffsets.push(n.lastDataIndex+8);var e=o.mdatBox();n.appendToOutputFile(e,function(e,o){if(e)return t(e);n.lastDataIndex=o+r,n.mdatLengthOffset=o-8,n.currentDataBlockSize=0,i()})}this.rawAppendData?(this.mdatOffsets.push(this.lastDataIndex),i(),this.lastDataIndex+=r):this.currentDataBlockSize<0?a():this.currentDataBlockSize+r>1e9?(this.multiMdat=!0,o.updateMdatLength(this,this.mdatLengthOffset,this.currentDataBlockSize,function(e){if(e)return t(e);a()})):(this.mdatOffsets.push(this.lastDataIndex),i(),this.lastDataIndex+=r)}},{key:"appendToOutputFile",value:function(e,t){var n=this;if(this.aborted)return t(null);function r(){if(n.aborted)for(;n.pendingAppend.length>0;){(r=n.pendingAppend.shift()).callback(null)}else{n.appendFileTimer&&clearTimeout(n.appendFileTimer),n.appendFileTimer=setTimeout(function(){n.file.close(),n.file=null},5e3);for(var t=0;n.pendingAppend.length>0;){var r=n.pendingAppend.shift();t++,function(r){o.writeMulti(n.file,r.data,function(i){var a=o.length(e);if(n.fileSize+=a,r.callback(i,n.fileSize),0==--t&&n.waitingDataWritten)for(;n.waitingDataWritten.length;)n.waitingDataWritten.shift()()})}(r)}}}if(this.pendingAppend=this.pendingAppend||[],this.pendingAppend.push({data:e,callback:t}),this.file)r();else if(!this.openingAppendFile){this.openingAppendFile=!0;var i=l,a={write:!0,append:!0};n.masked&&(i=c,a.iv=n.biniv,a.key=n.cryptoKey);var s=n.downloadTarget;this.rawAppendData||(s+=".part"),i.File.open(s,a).then(function(e){n.openingAppendFile=!1,n.file=e,r()},function(e){for(n.openingAppendFile=!1;n.pendingAppend.length>0;){n.pendingAppend.shift().callback(e)}})}}},{key:"waitForWrittenData",value:function(e){this.aborted?e():this.pendingAppend&&this.pendingAppend.length?(this.waitingDataWritten=this.waitingDataWritten||[],this.waitingDataWritten.push(e)):e()}},{key:"cleanupChunkFiles",value:function(){for(var e=Math.max(0,this.lastProcedIndex);e<Math.max(0,this.lastDledIndex);e++){var t=this.chunks[e];t&&t.path&&(l.File.remove(t.path),t=null)}}},{key:"actionAbortFn",value:function(){this.recording=!1,this.aborted=!0}}]),e}()},function(e,t){function n(e){var t=[];for(var n in e)t.push(n);return t}(e.exports="function"==typeof Object.keys?Object.keys:n).shim=n},function(e,t){var n="[object Arguments]"==function(){return Object.prototype.toString.call(arguments)}();function r(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function i(e){return e&&"object"==typeof e&&"number"==typeof e.length&&Object.prototype.hasOwnProperty.call(e,"callee")&&!Object.prototype.propertyIsEnumerable.call(e,"callee")||!1}(t=e.exports=n?r:i).supported=r,t.unsupported=i},function(e,t,n){"use strict";var r=n(56),i=n(102),o=n(103),a="[object Null]",s="[object Undefined]",u=r.a?r.a.toStringTag:void 0;t.a=function(e){return null==e?void 0===e?s:a:u&&u in Object(e)?Object(i.a)(e):Object(o.a)(e)}},function(e,t,n){"use strict";var r=n(101),i="object"==typeof self&&self&&self.Object===Object&&self,o=r.a||i||Function("return this")();t.a=o},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(11))},function(e,t,n){"use strict";var r=n(56),i=Object.prototype,o=i.hasOwnProperty,a=i.toString,s=r.a?r.a.toStringTag:void 0;t.a=function(e){var t=o.call(e,s),n=e[s];try{e[s]=void 0;var r=!0}catch(e){}var i=a.call(e);return r&&(t?e[s]=n:delete e[s]),i}},function(e,t,n){"use strict";var r=Object.prototype.toString;t.a=function(e){return r.call(e)}},function(e,t,n){"use strict";var r=n(105),i=Object(r.a)(Object.getPrototypeOf,Object);t.a=i},function(e,t,n){"use strict";t.a=function(e,t){return function(n){return e(t(n))}}},function(e,t,n){"use strict";t.a=function(e){return null!=e&&"object"==typeof e}},function(e,t,n){"use strict";(function(e,r){var i,o=n(109);i="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:r;var a=Object(o.a)(i);t.a=a}).call(t,n(11),n(108)(e))},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";t.a=function(e){var t,n=e.Symbol;"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable";return t}},function(e,t,n){"use strict";t.a=function(e){for(var t=Object.keys(e),n={},o=0;o<t.length;o++){var a=t[o];0,"function"==typeof e[a]&&(n[a]=e[a])}var s=Object.keys(n);0;var u=void 0;try{!function(e){Object.keys(e).forEach(function(t){var n=e[t],i=n(void 0,{type:r.a.INIT});if(void 0===i)throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");var o="@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".");if(void 0===n(void 0,{type:o}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+r.a.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(n)}catch(e){u=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(u)throw u;for(var r=!1,o={},a=0;a<s.length;a++){var c=s[a],l=n[c],d=e[c],f=l(d,t);if(void 0===f){var p=i(c,t);throw new Error(p)}o[c]=f,r=r||f!==d}return r?o:e}};var r=n(55);n(54),n(57);function i(e,t){var n=t&&t.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}},function(e,t,n){"use strict";function r(e,t){return function(){return t(e.apply(void 0,arguments))}}t.a=function(e,t){if("function"==typeof e)return r(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),i={},o=0;o<n.length;o++){var a=n[o],s=e[a];"function"==typeof s&&(i[a]=r(s,t))}return i}},function(e,t,n){"use strict";t.a=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(n,o,a){var s=e(n,o,a),u=s.dispatch,c=[],l={getState:s.getState,dispatch:function(e){return u(e)}};return c=t.map(function(e){return e(l)}),u=r.a.apply(void 0,c)(s.dispatch),i({},s,{dispatch:u})}}};var r=n(58),i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}},function(e,t,n){(function(e){(function(t){"use strict";function n(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function r(e,t){Object.defineProperty(this,"kind",{value:e,enumerable:!0}),t&&t.length&&Object.defineProperty(this,"path",{value:t,enumerable:!0})}function i(e,t,n){i.super_.call(this,"E",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0}),Object.defineProperty(this,"rhs",{value:n,enumerable:!0})}function o(e,t){o.super_.call(this,"N",e),Object.defineProperty(this,"rhs",{value:t,enumerable:!0})}function a(e,t){a.super_.call(this,"D",e),Object.defineProperty(this,"lhs",{value:t,enumerable:!0})}function s(e,t,n){s.super_.call(this,"A",e),Object.defineProperty(this,"index",{value:t,enumerable:!0}),Object.defineProperty(this,"item",{value:n,enumerable:!0})}function u(e,t,n){var r=e.slice((n||t)+1||e.length);return e.length=t<0?e.length+t:t,e.push.apply(e,r),e}function c(e){var t=void 0===e?"undefined":x(e);return"object"!==t?t:e===Math?"math":null===e?"null":Array.isArray(e)?"array":"[object Date]"===Object.prototype.toString.call(e)?"date":"function"==typeof e.toString&&/^\/.*\//.test(e.toString())?"regexp":"object"}function l(e,t,n,r,d,f,p){d=d||[],p=p||[];var h=d.slice(0);if(void 0!==f){if(r){if("function"==typeof r&&r(h,f))return;if("object"===(void 0===r?"undefined":x(r))){if(r.prefilter&&r.prefilter(h,f))return;if(r.normalize){var g=r.normalize(h,f,e,t);g&&(e=g[0],t=g[1])}}}h.push(f)}"regexp"===c(e)&&"regexp"===c(t)&&(e=e.toString(),t=t.toString());var m=void 0===e?"undefined":x(e),v=void 0===t?"undefined":x(t),y="undefined"!==m||p&&p[p.length-1].lhs&&p[p.length-1].lhs.hasOwnProperty(f),b="undefined"!==v||p&&p[p.length-1].rhs&&p[p.length-1].rhs.hasOwnProperty(f);if(!y&&b)n(new o(h,t));else if(!b&&y)n(new a(h,e));else if(c(e)!==c(t))n(new i(h,e,t));else if("date"===c(e)&&e-t!=0)n(new i(h,e,t));else if("object"===m&&null!==e&&null!==t)if(p.filter(function(t){return t.lhs===e}).length)e!==t&&n(new i(h,e,t));else{if(p.push({lhs:e,rhs:t}),Array.isArray(e)){var w;for(e.length,w=0;w<e.length;w++)w>=t.length?n(new s(h,w,new a(void 0,e[w]))):l(e[w],t[w],n,r,h,w,p);for(;w<t.length;)n(new s(h,w,new o(void 0,t[w++])))}else{var k=Object.keys(e),A=Object.keys(t);k.forEach(function(i,o){var a=A.indexOf(i);a>=0?(l(e[i],t[i],n,r,h,i,p),A=u(A,a)):l(e[i],void 0,n,r,h,i,p)}),A.forEach(function(e){l(void 0,t[e],n,r,h,e,p)})}p.length=p.length-1}else e!==t&&("number"===m&&isNaN(e)&&isNaN(t)||n(new i(h,e,t)))}function d(e,t,n,r){return r=r||[],l(e,t,function(e){e&&r.push(e)},n),r.length?r:void 0}function f(e,t,n){if(e&&t&&n&&n.kind){for(var r=e,i=-1,o=n.path?n.path.length-1:0;++i<o;)void 0===r[n.path[i]]&&(r[n.path[i]]="number"==typeof n.path[i]?[]:{}),r=r[n.path[i]];switch(n.kind){case"A":!function e(t,n,r){if(r.path&&r.path.length){var i,o=t[n],a=r.path.length-1;for(i=0;i<a;i++)o=o[r.path[i]];switch(r.kind){case"A":e(o[r.path[i]],r.index,r.item);break;case"D":delete o[r.path[i]];break;case"E":case"N":o[r.path[i]]=r.rhs}}else switch(r.kind){case"A":e(t[n],r.index,r.item);break;case"D":t=u(t,n);break;case"E":case"N":t[n]=r.rhs}return t}(n.path?r[n.path[i]]:r,n.index,n.item);break;case"D":delete r[n.path[i]];break;case"E":case"N":r[n.path[i]]=n.rhs}}}function p(e,t,n,r){var i=d(e,t);try{r?n.groupCollapsed("diff"):n.group("diff")}catch(e){n.log("diff")}i?i.forEach(function(e){var t=e.kind,r=function(e){var t=e.kind,n=e.path,r=e.lhs,i=e.rhs,o=e.index,a=e.item;switch(t){case"E":return[n.join("."),r,"→",i];case"N":return[n.join("."),i];case"D":return[n.join(".")];case"A":return[n.join(".")+"["+o+"]",a];default:return[]}}(e);n.log.apply(n,["%c "+O[t].text,function(e){return"color: "+O[e].color+"; font-weight: bold"}(t)].concat(A(r)))}):n.log("—— no diff ——");try{n.groupEnd()}catch(e){n.log("—— diff end —— ")}}function h(e,t,n,r){switch(void 0===e?"undefined":x(e)){case"object":return"function"==typeof e[r]?e[r].apply(e,A(n)):e[r];case"function":return e(t);default:return e}}function g(e,t){var n=t.logger,r=t.actionTransformer,i=t.titleFormatter,o=void 0===i?function(e){var t=e.timestamp,n=e.duration;return function(e,r,i){var o=["action"];return o.push("%c"+String(e.type)),t&&o.push("%c@ "+r),n&&o.push("%c(in "+i.toFixed(2)+" ms)"),o.join(" ")}}(t):i,a=t.collapsed,s=t.colors,u=t.level,c=t.diff,l=void 0===t.titleFormatter;e.forEach(function(i,d){var f=i.started,g=i.startedTime,m=i.action,v=i.prevState,y=i.error,b=i.took,k=i.nextState,x=e[d+1];x&&(k=x.prevState,b=x.started-f);var A=r(m),_="function"==typeof a?a(function(){return k},m,i):a,O=w(g),I=s.title?"color: "+s.title(A)+";":"",P=["color: gray; font-weight: lighter;"];P.push(I),t.timestamp&&P.push("color: gray; font-weight: lighter;"),t.duration&&P.push("color: gray; font-weight: lighter;");var C=o(A,O,b);try{_?s.title&&l?n.groupCollapsed.apply(n,["%c "+C].concat(P)):n.groupCollapsed(C):s.title&&l?n.group.apply(n,["%c "+C].concat(P)):n.group(C)}catch(e){n.log(C)}var S=h(u,A,[v],"prevState"),E=h(u,A,[A],"action"),j=h(u,A,[y,v],"error"),D=h(u,A,[k],"nextState");if(S)if(s.prevState){var R="color: "+s.prevState(v)+"; font-weight: bold";n[S]("%c prev state",R,v)}else n[S]("prev state",v);if(E)if(s.action){var T="color: "+s.action(A)+"; font-weight: bold";n[E]("%c action ",T,A)}else n[E]("action ",A);if(y&&j)if(s.error){var q="color: "+s.error(y,v)+"; font-weight: bold;";n[j]("%c error ",q,y)}else n[j]("error ",y);if(D)if(s.nextState){var M="color: "+s.nextState(k)+"; font-weight: bold";n[D]("%c next state",M,k)}else n[D]("next state",k);c&&p(v,k,n,_);try{n.groupEnd()}catch(e){n.log("—— log end ——")}})}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=Object.assign({},I,e),n=t.logger,r=t.stateTransformer,i=t.errorTransformer,o=t.predicate,a=t.logErrors,s=t.diffPredicate;if(void 0===n)return function(){return function(e){return function(t){return e(t)}}};if(e.getState&&e.dispatch)return console.error("[redux-logger] redux-logger not installed. Make sure to pass logger instance as middleware:\n// Logger with default options\nimport { logger } from 'redux-logger'\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n// Or you can create your own logger with custom options http://bit.ly/redux-logger-options\nimport createLogger from 'redux-logger'\nconst logger = createLogger({\n // ...options\n});\nconst store = createStore(\n reducer,\n applyMiddleware(logger)\n)\n"),function(){return function(e){return function(t){return e(t)}}};var u=[];return function(e){var n=e.getState;return function(e){return function(c){if("function"==typeof o&&!o(n,c))return e(c);var l={};u.push(l),l.started=k.now(),l.startedTime=new Date,l.prevState=r(n()),l.action=c;var d=void 0;if(a)try{d=e(c)}catch(e){l.error=i(e)}else d=e(c);l.took=k.now()-l.started,l.nextState=r(n());var f=t.diff&&"function"==typeof s?s(n,c):t.diff;if(g(u,Object.assign({},t,{diff:f})),u.length=0,l.error)throw l.error;return d}}}}var v,y,b=function(e,t){return function(e,t){return new Array(t+1).join(e)}("0",t-e.toString().length)+e},w=function(e){return b(e.getHours(),2)+":"+b(e.getMinutes(),2)+":"+b(e.getSeconds(),2)+"."+b(e.getMilliseconds(),3)},k="undefined"!=typeof performance&&null!==performance&&"function"==typeof performance.now?performance:Date,x="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},A=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},_=[];v="object"===(void 0===e?"undefined":x(e))&&e?e:"undefined"!=typeof window?window:{},(y=v.DeepDiff)&&_.push(function(){void 0!==y&&v.DeepDiff===d&&(v.DeepDiff=y,y=void 0)}),n(i,r),n(o,r),n(a,r),n(s,r),Object.defineProperties(d,{diff:{value:d,enumerable:!0},observableDiff:{value:l,enumerable:!0},applyDiff:{value:function(e,t,n){e&&t&&l(e,t,function(r){n&&!n(e,t,r)||f(e,t,r)})},enumerable:!0},applyChange:{value:f,enumerable:!0},revertChange:{value:function(e,t,n){if(e&&t&&n&&n.kind){var r,i,o=e;for(i=n.path.length-1,r=0;r<i;r++)void 0===o[n.path[r]]&&(o[n.path[r]]={}),o=o[n.path[r]];switch(n.kind){case"A":!function e(t,n,r){if(r.path&&r.path.length){var i,o=t[n],a=r.path.length-1;for(i=0;i<a;i++)o=o[r.path[i]];switch(r.kind){case"A":e(o[r.path[i]],r.index,r.item);break;case"D":case"E":o[r.path[i]]=r.lhs;break;case"N":delete o[r.path[i]]}}else switch(r.kind){case"A":e(t[n],r.index,r.item);break;case"D":case"E":t[n]=r.lhs;break;case"N":t=u(t,n)}return t}(o[n.path[r]],n.index,n.item);break;case"D":case"E":o[n.path[r]]=n.lhs;break;case"N":delete o[n.path[r]]}}},enumerable:!0},isConflict:{value:function(){return void 0!==y},enumerable:!0},noConflict:{value:function(){return _&&(_.forEach(function(e){e()}),_=null),d},enumerable:!0}});var O={E:{color:"#2196F3",text:"CHANGED:"},N:{color:"#4CAF50",text:"ADDED:"},D:{color:"#F44336",text:"DELETED:"},A:{color:"#2196F3",text:"ARRAY:"}},I={level:"log",logger:console,logErrors:!0,collapsed:void 0,predicate:void 0,duration:!1,timestamp:!0,stateTransformer:function(e){return e},actionTransformer:function(e){return e},errorTransformer:function(e){return e},colors:{title:function(){return"inherit"},prevState:function(){return"#9E9E9E"},action:function(){return"#03A9F4"},nextState:function(){return"#4CAF50"},error:function(){return"#F20404"}},diff:!1,diffPredicate:void 0,transformer:void 0},P=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.dispatch,n=e.getState;return"function"==typeof t||"function"==typeof n?m()({dispatch:t,getState:n}):void console.error("\n[redux-logger v3] BREAKING CHANGE\n[redux-logger v3] Since 3.0.0 redux-logger exports by default logger with default settings.\n[redux-logger v3] Change\n[redux-logger v3] import createLogger from 'redux-logger'\n[redux-logger v3] to\n[redux-logger v3] import { createLogger } from 'redux-logger'\n")};t.defaults=I,t.createLogger=m,t.logger=P,t.default=P,Object.defineProperty(t,"__esModule",{value:!0})})(t)}).call(t,n(11))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.dialog=s,t.alert=u,t.fileDialog=c,t.saveAs=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return c(Object.assign({filename:e,directory:t,uniqueFilename:!0,titleText:r._("save_file_as"),noSizeColumn:!1,dirOnly:!1,upDir:!1,editFileInput:!0,readonlyDir:!1,showDir:!0,okText:r._("save"),confirmOverwrite:!0,newDir:!0,createDir:!0},n))},t.selectDirectory=l,t.selectConvertFiles=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(Object.assign({directory:e,uniqueFilename:!1,titleText:r._("select_files_to_convert"),noSizeColumn:!1,dirOnly:!1,upDir:!0,readonlyDir:!0,editFileInput:!1,showDir:!1,okText:r._("convert"),confirmOverwrite:!1,newDir:!1,createDir:!1,selectMultiple:!0,outputConfigs:!0},t))},t.selectMergeVideoFile=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(Object.assign({directory:e,uniqueFilename:!1,titleText:r._("select_video_file_to_merge"),noSizeColumn:!1,dirOnly:!1,upDir:!0,readonlyDir:!0,editFileInput:!1,showDir:!1,okText:r._("next"),confirmOverwrite:!1,newDir:!1,createDir:!1,selectMultiple:!1,outputConfigs:!1},t))},t.selectMergeAudioFile=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(Object.assign({directory:e,uniqueFilename:!1,titleText:r._("select_audio_file_to_merge"),noSizeColumn:!1,dirOnly:!1,upDir:!0,readonlyDir:!0,editFileInput:!1,showDir:!1,okText:r._("next"),confirmOverwrite:!1,newDir:!1,createDir:!1,selectMultiple:!1,outputConfigs:!1},t))};var r=n(1),i=r.browser,o=n(40),a=0;function s(e){var t=Promise.resolve();"tab"===e.type&&(t=t.then(function(){return i.tabs.query({active:!0,lastFocusedWindow:!0}).then(function(e){e.length>0&&o.setTransientTab("<next-tab>",e[0].id)})}));var n="dialog"+ ++a;return(t=t.then(function(){r.ui.open(n,e)}).then(function(){return r.wait(n)})).__dialogName=n,t}function u(e){var t={autoResize:!0};return"tab"==r.prefs.alertDialogType&&(t={bodyClass:"dialog-in-tab",autoResize:!1}),s({url:"content/alert.html",type:r.prefs.alertDialogType,height:e.height||200,autoClose:r.prefs.dialogAutoClose,initData:Object.assign(t,e)})}function c(e){var t=s({type:r.prefs.fileDialogType,url:"content/file-dialog.html",height:500,width:750,autoClose:r.prefs.dialogAutoClose,initData:Object.assign({filename:null,directory:null,uniqueFilename:!0,titleText:"",noSizeColumn:!1,dirOnly:!1,upDir:!0,editFileInput:!0,readonlyDir:!1,showDir:!0,okText:"OK",confirmOverwrite:!1,newDir:!1,createDir:!0},e)});return t.then(function(e){return r.ui.close(t.__dialogName),e}).catch(function(e){return r.ui.close(t.__dialogName),null})}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return c(Object.assign({directory:e,uniqueFilename:!1,titleText:r._("weh_prefs_label_lastDownloadDirectory"),noSizeColumn:!0,dirOnly:!0,upDir:!0,editFileInput:!1,readonlyDir:!0,showDir:!1,okText:r._("ok"),confirmOverwrite:!1,newDir:!0,createDir:!1},t))}r.rpc.listen({alert:u,selectDirectory:l})},function(e,t,n){"use strict"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.extractMeta=function(e,t){var n,i=e.previous||{},o={previous:{}},a=i.unconfirmedUnit||null;if(a)if(0==t[0]&&0==t[1]&&(1==t[2]||0==t[2]&&1==t[3]))(n=c(t,0,t.length)).unshift(a);else{var s=new Uint8Array(a.s+3+t.length);s.set(a.data.subarray(a.o-3,a.o+a.s),0),s.set(t,a.s+3),n=c(t=s,0,t.length)}else n=c(t,0,t.length);i.confirmedUnusedUnits&&(n=[].concat(i.confirmedUnusedUnits,n));var u=e.flush?n.length:n.length-1;if(e.sps||e.pps||e.width||e.height)for(var d=0;d<u;d++){var f=n[d],p=31&f.data[f.o];if(7==p){if(e.sps&&!o.sps){o.sps=new ArrayBuffer(f.s);var h=new Uint8Array(o.sps);h.set(f.data.subarray(f.o,f.o+f.s))}if(e.width&&!o.width||e.height&&!o.height){var g=l(f.data,f.o+1,f.s);o.width=g.width,o.height=g.height}}else if(8==p&&e.pps&&!o.pps){o.pps=new ArrayBuffer(f.s);var m=new Uint8Array(o.pps);m.set(f.data.subarray(f.o,f.o+f.s))}}for(var v=i.gotUnitStart||!1,y=i.keyFrame||!1,b=i.frameUnit||!1,w=i.avccData||[],k=i.avccSize||0,x=!1,d=0;d<u;d++){var f=n[d];if(0!=f.s){var p=31&f.data[f.o];if(9==p){if(v){x=!0,o.previous.confirmedUnusedUnits=n.slice(d,u);break}v=!0}else 5==p?(0!=f.data[f.o+1]&&(y=!0),b=!0):1==p&&(b=!0);if(v){var A=new Uint8Array(4);r.WriteInt32(A,0,f.s),w.push(A),w.push(f.data.subarray(f.o,f.o+f.s)),k+=f.s+4}}}(x||e.flush)&&v&&b?(o.avccData=w,o.frame={size:k,key:y}):(o.previous.gotUnitStart=v,o.previous.avccData=w,o.previous.avccSize=k,o.previous.keyFrame=y,o.previous.frameUnit=b);e.flush||(o.previous.unconfirmedUnit=n[n.length-1]);return o};var r=n(17);function i(e){!function(e){if(!e)throw new Error("ASSERT")}(e.m_nCurrentBit<=8*e.m_nLength);var t=e.m_nCurrentBit>>>3>>>0,n=e.m_nCurrentBit%8+1;return e.m_nCurrentBit++,(e.m_pStart[e.offset+t]>>>8-n&1)>>>0}function o(e,t){for(var n=0,r=0;r<t;r++)n|=i(e)<<t-r-1;return n}function a(e){for(var t=0,n=0;0==i(e)&&n<32;)n++;return t=o(e,n),t+=(1<<n)-1}function s(e){var t=a(e);return t=1&t?(t+1)/2:-t/2}function u(e,t,n){var i=function(e,t,n){var i=4-(3&t);for(n-=3;t<i&&t<n;t++)if(0==e[t]&&0==e[t+1]&&1==e[t+2])return t;for(n-=3;t<n;t+=4){var o=r.ReadInt32(e,t);if(o-16843009&~o&2155905152){if(0==e[t+1]){if(0==e[t]&&1==e[t+2])return t;if(0==e[t+2]&&1==e[t+3])return t+1}if(0==e[t+3]){if(0==e[t+2]&&1==e[t+4])return t+2;if(0==e[t+4]&&1==e[t+5])return t+3}}}for(n+=3;t<n;t++)if(0==e[t]&&0==e[t+1]&&1==e[t+2])return t;return n+3}(e,t,n);return t<i&&i<n&&!e[i-1]&&i--,i}function c(e,t,n){for(var r=[],i=u(e,t,n);;){for(;i<n&&!e[i++];);if(i==n)break;var o=u(e,i,n);r.push({o:i,s:o-i,data:e}),i=o}return r}function l(e,t,n){var r={m_pStart:e,m_nLength:n,m_nCurrentBit:0,offset:t},u=0,c=0,l=0,d=0,f=o(r,8);i(r),i(r),i(r),i(r),i(r),i(r),o(r,2),o(r,8),a(r);if(100==f||110==f||122==f||244==f||44==f||83==f||86==f||118==f){if(3==a(r))i(r);a(r),a(r),i(r);if(i(r))for(var p=0;p<8;p++){if(i(r))for(var h=p<6?16:64,g=8,m=8,v=0;v<h;v++){if(0!=m)m=(g+s(r)+256)%256;g=0==m?g:m}}}a(r);var y=a(r);if(0==y)a(r);else if(1==y){i(r),s(r),s(r);var b=a(r),w=[];for(p=0;p<b;p++)w.push(s(r))}a(r),i(r);var k=a(r),x=a(r),A=i(r);if(!A)i(r);i(r);if(i(r)&&(u=a(r),c=a(r),l=a(r),d=a(r)),i(r)){if(i(r))if(255==o(r,8))o(r,8),o(r,8);if(i(r))i(r);if(i(r)){o(r,3),i(r);if(i(r))i(r),i(r),i(r)}i(r)}var _=16*(k+1)-2*d-2*l,O=(2-A)*(x+1)*16-2*c-2*u;return{width:8*Math.floor((_+7)/8),height:O}}},function(e,t,n){"use strict";var r=n(17),i={0:96e3,1:88200,2:64e3,3:48e3,4:44100,5:32e3,6:24e3,7:22050,8:16e3,9:12e3,10:11025,11:8e3,12:7350};t.extractMeta=function(e,t){var n=t.length-7,o={start:-1,end:0,maxBitrate:0,durationSec:0};e.frames&&(o.frames=[]);for(var a=0;a<n;)if(255==t[a]&&240==(246&t[a+1])){o.start<0&&(o.start=a);var s=1&t[a+1],u=(67100672&r.ReadInt32(t,a+3))>>>13>>>0;if(u<=0)break;var c=s?7:9;if(e.frames&&o.frames.push({o:a+c,s:u-c}),e.rate){var l=r.ReadInt24(t,a+1),d=(15360&l)>>>10>>>0;o.rate=Math.round(i[d]),o.mp4aRateIndex=d,o.maxBitrate=Math.max(o.maxBitrate,8*u*o.rate/1024),o.durationSec+=1024/o.rate;var f=(49152&l)>>>14>>>0;o.mp4aProfile=f+1;var p=(448&l)>>>6>>>0;o.mp4aChannelCount=p}a+=u,o.end=a}else a++;return o}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.set=function(e){a=e,s()},t.outputConfigForHit=function(e){var t=(e.url||e.videoUrl||e.audioUrl)&&e.topUrl;if(!t)return Promise.resolve(null);for(var n=[],r=new URL(t).hostname.split("."),i=0;i<r.length-1;i++)n.push(r.slice(i).join("."));var s=null;return a.every(function(t){var r=!0;return t.extension&&e.extension!==t.extension&&(r=!1),r&&t.domain&&(r=!n.every(function(e){return e!==t.domain})),r&&(s=t),!r})?Promise.resolve(null):s.convert?o.getOutputConfigs().then(function(e){return e[s.format]||null}):Promise.resolve(null)};var r=n(1),i=r.browser,o=n(60),a=[];function s(){return i.storage.local.set({convrules:a}).catch(function(e){console.error("Cannot write conversion rules storage")})}r.rpc.listen({editConversionRules:function(){r.ui.open("convrules-edit",{type:"tab",url:"content/convrules-edit.html"})},getConversionRules:function(){return a},setConversionRules:function(e){return a=e,s()}}),i.storage.local.get({convrules:[]}).then(function(e){a=e.convrules}).catch(function(e){console.error("Cannot read conversion rules storage")})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();t.getInApp=a,t.inAppBuy=s;var i=n(1),o=(n(260),n(6).Concurrent());function a(){arguments.length>0&&void 0!==arguments[0]&&arguments[0];return o(function(){return Promise.all([new Promise(function(e,t){google.payments.inapp.getSkuDetails({parameters:{env:"prod"},success:function(n){n&&n.response&&n.response.details&&n.response.details.inAppProducts,e(n.response.details.inAppProducts)||t(new Error("Invalid response"))},failure:function(e){t(e)}})}),new Promise(function(e,t){google.payments.inapp.getPurchases({parameters:{env:"prod"},success:function(n){n&&n.response&&n.response.details&&e(n.response.details)||t(new Error("Invalid response"))},failure:function(e){t(e)}})})]).then(function(e){var t=r(e,2),n=t[0],i=t[1];n=n.filter(function(e){return/lifetime/.test(e.sku||"")});var o=null;return i.forEach(function(e){"ACTIVE"!=e.state&&"PENDING"!=e.state||(n.forEach(function(t){e.sku===t.sku&&(o=t)}),o||(console.warn("Unknown purchase",e,"assuming lifetime"),n.forEach(function(e){"premium_lifetime"===e.sku&&(o=e)})))}),{skus:n,purchases:i,premium:o,notSigned:!1}}).catch(function(e){if(e.response&&"TOKEN_MISSING_ERROR"==e.response.errorType)return{notSigned:!0};throw console.warn("Error accessing in-app",e),new Error("Error accessing in-app")})})}function s(e){return o(function(){return new Promise(function(t,n){google.payments.inapp.buy({parameters:{env:"prod"},sku:e,success:function(e){t(e)},failure:function(e){n(e)}})})}).then(function(){return a(!0)})}i.rpc.listen({getInApp:a,inAppBuy:s})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}t.networkHook=function(e,t){if(!u.prefs.chunksEnabled)return null;var n=null;u.prefs.dashEnabled&&(b.test(e.url)?n=new I(e.url,"json",t):t.contentType&&w.test(t.contentType.toLowerCase())&&(n=new I(e.url,"xml",t)));u.prefs.hlsEnabled&&(k.test(e.url)?n=new P(e.url):x.test(e.url)?n=new P(e.url,"json"):t.contentType&&t.contentType.toLowerCase().indexOf("mpegurl")>=0&&(n=new P(e.url)));!n&&u.prefs.f4fEnabled&&(n=S.getProbe(e));return n&&!n.skipManifest?new Promise(function(r,i){if("GET"!=e.method)return i(new Error("Not a GET request getting chunks manifest"));u.prefs.chunkedCoappManifestsRequests||v.isProbablyAvailable()?v.request(e.url,{headers:t.headers,proxy:u.prefs.coappUseProxy&&t.proxy||null}).then(function(e){n.handleManifest(e),n.checkReady(),r(n)}).catch(i):m.request({url:e.url,onComplete:function(t){t&&200==t.status?(n.handleManifest(t.text),n.checkReady(),r(n)):(console.warn("Error retrieving manifest from",e.url),r(null))}})}):null},t.download=function(e,t,n,i,o){t.ignoreSpecs=!0;var a=null;switch(e.hit.chunked){case"hls":a=l.getChunkSet(e.hit);break;case"dash-adp":if(t.length>1)return void function(e,t,n,i,o){var a=e.hit,s={audio:0,video:0},c={audio:!1,video:!1},l=!1;function d(e){l||(l=!0,i(e))}var f={},p=!1;t.forEach(function(t){var i=t.type;function l(){c[i]=!0,c.audio&&c.video&&n()}function g(e){s[i]=e,p||o(Math.round((s.audio+s.video)/2))}try{var y,b=function(n){var r=a.url||a[i+"Url"];a._mpdCommonBaseUrl&&(r=new URL(a._mpdCommonBaseUrl,r).href),w.base_url&&(r=new URL(w.base_url,r).href),y=new h.DashChunkset({url:r,headers:e.hit.headers||[],proxy:u.prefs.coappUseProxy&&e.hit.proxy||null}),f[i]={chunkset:y,target:t.fileName},y.downloadFile(t.fileName,{init_segment:n,segments:w.segments},r,l,d,g)},w=a[i+"Mpd"];if("string"==typeof w.init_segment)b(m.toByteArray(w.init_segment));else if("object"==r(w.init_segment))b(w.init_segment);else{var k=new URL(w.init_segment_url,a[i+"Url"]).href;u.prefs.chunkedCoappDataRequests?v.requestBinary(k,{headers:a.headers||[],proxy:u.prefs.coappUseProxy&&a.proxy||null}).then(function(e){b(e)}).catch(function(e){d(e.message)}):m.downloadToByteArray(k,a.headers,a.isPrivate,!1,function(e,t){if(e)return d(e.message);b(t)})}}catch(e){console.warn("Error",e),d(new Error("Dash ADP: "+e.message))}}),e.abortChunked=function(){for(var e in p=!0,f)f[e].chunkset.actionAbortFn();i(new m.VDHError("User abort",{noReport:!0}))}}(e,t,n,i,o);case"dash":a=new h.DashChunkset(e.hit);break;case"f4f":a=new p.F4fChunkset(e.hit)}if(!a)return void y.error("Requested download of chunked stream, but no chunkset found");a.download(e,t,n,i,o)};var u=n(1),c=n(13),l=n(235),d=n(236),f=n(264),p=n(265),h=n(266),g=n(62),m=n(6),v=n(26),y=n(93),b=(u.browser,new RegExp("^https?://.*/master\\.json")),w=new RegExp("dash.*mpd"),k=new RegExp("^https?://.*\\.m3u8(?:\\?|$)"),x=new RegExp("^https?://api\\.periscope\\.tv/api/v2/getAccessPublic"),A=new RegExp("^https?://.*\\.f4m(?:\\?|$)"),_=new RegExp("^(https?://.*)Seg1\\-Frag([0-9]+)(\\?.*)?$");var O=function(){function e(t){s(this,e),this.type=t,this.receivedChunks=[]}return i(e,[{key:"handleHit",value:function(e){this.hitData=e,this.checkReady()}},{key:"checkReady",value:function(){}},{key:"handleManifest",value:function(){}},{key:"handle",value:function(){}}]),e}(),I=function(e){function t(e,n,r){s(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"dash"));return i.format=n,i.manifestUrl=e,i.meta=r,i}return a(t,O),i(t,[{key:"handleManifest",value:function(e){try{if("json"==this.format){var t=JSON.parse(e);t&&Array.isArray(t.video)&&t.video.length>0&&Array.isArray(t.video[0].segments)&&t.video[0].segments.length>0&&(this.mpd=t)}else"xml"==this.format&&(this.handler=g.dashManifest(this.manifestUrl,e,this.meta))}catch(e){console.error("Error parsing DASH manifest",e.message||e)}}},{key:"checkReady",value:function(){this.hitData&&(this.mpd||this.handler)&&this.handle()}},{key:"pickAudioMpd",value:function(){var e=[{field:"codecs",pref:"mp4a.40.2"},{field:"format",pref:"mp42"},{field:"mime_type",pref:"audio/mp4"},{field:"channels",pref:"@max"},{field:"bitrate",pref:"@max"},{field:"sample_rate",pref:"@max"}],t=[].concat(this.mpd.audio);return t.sort(function(t,n){for(var r=0;r<e.length;r++){var i=e[r];if(t[i.field]!=n[i.field]){if("@max"==i.pref)return n[i.field]-t[i.field];if(t[i.field]==i.pref)return-1;if(n[i.field]==i.pref)return 1}}return 0}),t[0]}},{key:"handle",value:function(){var e=m.hashHex(this.hitData.url),t=this;if(this.handler)this.handler(this.hitData);else if(this.mpd){var n=t.mpd.audio&&t.mpd.audio.length>0&&Array.isArray(t.mpd.audio[0].segments)&&t.mpd.audio[0].segments.length>0,r=t.mpd.video&&t.mpd.video.length>0&&Array.isArray(t.mpd.video[0].segments)&&t.mpd.video[0].segments.length>0,i=this.mpd.video,o=this.mpd.audio;!r||n&&"audio"==u.prefs.dashOnAdp?(i=this.mpd.audio,o=null):(!n||r&&"video"==u.prefs.dashOnAdp)&&(o=null),i.forEach(function(n,r){var i={};o?(i.chunked="dash-adp",i.audioMpd=t.pickAudioMpd(),i.videoMpd=n,i.audioUrl=new URL("dash-audio.mp4",t.hitData.url).href,i.videoUrl=new URL("dash-video.mp4",t.hitData.url).href,i.url=void 0):i._mpd=n;var a=Object.assign({},t.hitData,{id:"dash:"+e+"-"+r,extension:"mp4",bitrate:n.bitrate||n.avg_bitrate||null,length:null,chunked:"dash",descrPrefix:u._("dash_streaming"),group:"grp-"+e},i);a._mpdCommonBaseUrl=t.mpd.base_url,n.width&&n.height&&(a.size=n.width+"x"+n.height),n.duration&&(a.duration=Math.round(n.duration)),c.dispatch("hit.new",a)})}}}]),t}(),P=function(e){function t(e,n){s(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"hls"));return r.masterFormat=n||"m3u8",r.mediaUrl=e,r}return a(t,O),i(t,[{key:"handleHit",value:function(e){e.group="grp-"+m.hashHex(e.url),e.masterManifest=e.url,O.prototype.handleHit.call(this,e)}},{key:"handleManifest",value:function(e){var t=null;"m3u8"==this.masterFormat?t=d.get(e,this.mediaUrl):"json"==this.masterFormat&&(t=d.getPsJson(e,this.mediaUrl)),t&&(t.isMaster()?this.master=t:t.isMedia()&&(this.media=t))}},{key:"checkReady",value:function(){this.hitData&&(this.master||this.media)&&this.handle()}},{key:"handle",value:function(){this.master?l.handleMaster(this.master,this.hitData):this.media&&l.handleMedia(this.media,this.hitData,this.mediaUrl)}}]),t}(),C={},S=function(e){function t(e){s(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,"f4f"));n.f4fUrl=e;var r=new URL(e),i=/^([^\?]*?)([^\/]*\?.*|[^\/]*)$/.exec(r.protocol+"//"+r.host+r.pathname)[1];return t.waitingForFrag[i]=n,n}return a(t,O),i(t,[{key:"checkReady",value:function(){this.hitData&&this.medias&&this.startFrag&&this.handle()}},{key:"handleManifest",value:function(e){var t=(new DOMParser).parseFromString(e,"application/xml"),n=t.querySelector("duration");n&&(this.duration=parseInt(n.firstChild.nodeValue));var r=t.querySelectorAll("bootstrapInfo");this.medias={};for(var i=0;i<r.length;i++){var o=r.item(i),a=o.getAttribute("id"),s=o.firstChild&&m.toByteArray(o.firstChild.nodeValue)||null;this.medias[a]={bootstrap:s}}var u=t.querySelectorAll("media");for(i=0;i<u.length;i++){var c=u.item(i),l=c.getAttribute("bootstrapInfoId"),d=this.medias[l];if(d){d.bitrate=1e3*parseInt(c.getAttribute("bitrate")),d.urlHint=new URL(c.getAttribute("url"),this.f4fUrl).href;var p=c.querySelector("metadata");if(p){var h=p.firstChild&&m.toByteArray(p.firstChild.nodeValue)||null;if(h){var g=f.decode(h);g&&g.length>=2&&"onMetaData"==g[0]&&(d.meta=g[1])}}}}}},{key:"handle",value:function(){var e="grp-"+m.hashHex(this.rootUrl||this.hitData.url);for(var t in this.medias){var n=this.medias[t];if(this.skipManifest)if(c.getF4fHitDataByUrlHint(n.urlHint))continue;this.hitData.url=this.rootUrl||this.hitData.url;var r=m.hashHex(this.hitData.url+t),i=Object.assign({},this.hitData,{id:"f4f:"+r,extension:"flv",bitrate:n.bitrate,_media:n,length:null,chunked:"f4f",descrPrefix:u._("f4f_streaming"),startFrag:this.startFrag,postFrag:this.postFrag||"",group:e});if(this.duration&&(i.duration=this.duration),n.meta){var o=n.meta;o.duration&&(i.duration=Math.round(o.duration)),o.width&&o.height&&(i.size=o.width+"x"+o.height),o.filesize&&(i.length=o.filesize),o.framerate&&(i.fps=o.framerate)}c.dispatch("hit.new",i)}}}],[{key:"getProbe",value:function(e){if(A.test(e.url))return new t(e.url);var n=_.exec(e.url);if(n)for(var r=e.url;;){var i=new URL(r);if(!(r=/^(https?:\/\/[^\/]+\/.*?)(\/|[^\/]+)$/.exec(i.protocol+"//"+i.host+i.pathname))){var o=new t(e.url);return o.startFrag=1,o.postFrag=n[3],o.skipManifest=!0,o.rootUrl=n[1],o.medias={},o.medias[n[1]]={urlHint:n[1]},o}r=r[1];var a=t.waitingForFrag[r];if(a)delete t.waitingForFrag[r];else for(var s in t.waitingForFrag){var u=t.waitingForFrag[s];for(var l in u.medias){if(u.medias[l].urlHint==r){delete t.waitingForFrag[s],a=u;break}}if(a)break}if(a)return c.getF4fHitDataByUrlHint(n[1])?null:(a.startFrag||(a.startFrag=parseInt(n[2])),a.postFrag||(a.postFrag=n[3]),a.checkReady(),null)}return null}},{key:"waitingForFrag",get:function(){return C}}]),t}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r="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},i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.canStop=function(e){var t=g[e];return!!t&&t.recording},t.stopRecording=function(e){var t=g[e];if(!t)return;t.endRecording()},t.handleMaster=function(e,t){e.walkThrough(function(e,n){var r=u.hashHex(e),i="hls:"+r,o=g[i];o||(o=m(t,r,e,n),g[i]=o)})},t.handleMedia=v,t.getChunkSet=function(e){return g["hls:"+u.hashHex(e.url)]||null};var o=n(1),a=n(13),s=n(39),u=(n(59),n(6)),c=n(61),l=n(262),d=n(236),f=n(17),p=n(26),h=n(96),g=(h.Chunkset,h.Codecs,{});setInterval(function(){var e=[];for(var t in g){a.getHit(t)?e.push(g[t].chunks.length):delete g[t]}},6e4);function m(e,t,n,r){var i="hls:"+t,s=Object.assign({},e,{id:i,extension:o.prefs.hlsDownloadAsM2ts?"m2ts":"mp4",hls:r,url:n,length:null,chunked:"hls",durationFloat:0});s.mediaManifest=n;var u=r["EXT-X-MEDIA"];u&&(s.quality=u.NAME||s.quality);var c=r["EXT-X-STREAM-INF"];return c&&(s.size=c.RESOLUTION||s.size,s.bitrate=parseInt(c.BANDWIDTH)||s.bitrate),a.dispatch("hit.new",s),new y(s)}function v(e,t,n){var r=u.hashHex(n),i=g["hls:"+r];i||(i=m(t,r,n,{}),g["hls:"+r]=i);var c=a.getHit("hls:"+r);if(c){var l=0;i.chunkDuration=1e3,i.recording||o.prefs.hlsRememberPrevLiveChunks||(i.chunks=[],i.chunksMap={},i.segmentsCount=0),e.walkThrough(function(t,n){var r=n.EXTINF;if(r){var o=Math.round(1e3*parseFloat(r));o>i.chunkDuration&&(i.chunkDuration=o)}var a=u.hashHex(t);if(!(a in i.chunksMap)){l++,i.chunksMap[a]=1;var s={url:t,index:i.chunks.length},d=n["EXT-X-KEY"];d&&"NONE"!=d.METHOD&&(s.encrypt=d,s.iv=parseInt(e.tags["EXT-X-MEDIA-SEQUENCE"]||"0")+s.index),i.chunks.push(s),r&&(c.durationFloat+=parseFloat(r),c.duration=Math.round(c.durationFloat))}}),s.update(c.id,{durationFloat:c.durationFloat,duration:c.duration}),l>0&&(i.segmentsCount+=l,i.handle())}}var y=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),r=u.hashHex(e.url);return n.id="hls:"+r,n.hit=Object.assign({},e,{chunked:"hls",descrPrefix:o._("hls_streaming")}),n.chunksMap={},n.chunks=[],n.segmentsCount=0,n.doNotReportDownloadChunkErrors=!0,a.dispatch("hit.new",n.hit),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,l.MP2TChunkset),i(t,[{key:"download",value:function(e,t,n,r,i){var a=this;this.aborted=!1,this.action=e,this.specs=t,this.successFn=function(){n.apply(a,arguments)},this.errorFn=function(){r.apply(a,arguments)},this.progressFn=i,this.downloadTarget=t[0].fileName,this.nextTrackId=1,this.processedSegmentsCount=0,this.recording=!0,this.masked=!!e.masked,this.masked&&(this.biniv=e.biniv,this.cryptoKey=e.cryptoKey),this.segmentsCount||this.requestMediaManifest(),o.prefs.hlsDownloadAsM2ts?(a.recording=!0,a.handle()):c.writeFileHeader(this,function(e){e?r(e):(a.recording=!0,a.handle())}),e.hit.abortFn=function(){a.actionAbortFn(a.downloadTarget+".part")}}},{key:"downloadChunk",value:function(e,t){e.encrypt?this.downloadEncryptedChunk(e,t):l.MP2TChunkset.prototype.downloadChunk.call(this,e,t)}},{key:"downloadEncryptedChunk",value:function(e,t){var n=this;function i(r,i,o){if(r)return t.call(n,r,e);l.MP2TChunkset.prototype.downloadChunk.call(n,e,function(r){if(r)return t.call(n,r,e);crypto.subtle.decrypt({name:"AES-CBC",iv:o},i,e.data).then(function(r){e.data=new Uint8Array(r),t.call(n,null,e)}).catch(function(r){t.call(n,r,e)})})}if("AES-128"!=e.encrypt.METHOD)return t.call(this,new Error("HLS encryption method "+e.encrypt.METHOD+" is not supported"),e);if(!e.encrypt.URI)return t.call(this,new Error("HLS encryption missing key URI"),e);var a=parseInt(e.encrypt.IV||e.iv),s=new Uint8Array(16);f.WriteInt32(s,12,a),this.keys||(this.keys={}),Array.isArray(this.keys[e.encrypt.URI])?this.keys[e.encrypt.URI].push(function(e,t){i.call(n,e,t,s)}):"object"==r(this.keys[e.encrypt.URI])?i(null,this.keys[e.encrypt.URI],s):(this.keys[e.encrypt.URI]=[function(e,t){i.call(n,e,t,s)}],o.prefs.chunkedCoappDataRequests?p.requestBinary(e.encrypt.URI,{headers:n.hit.headers||[],proxy:o.prefs.coappUseProxy&&n.hit.proxy||null}).then(function(r){crypto.subtle.importKey("raw",r,"aes-cbc",!0,["decrypt"]).then(function(t){var r=n.keys[e.encrypt.URI];n.keys[e.encrypt.URI]=t,r.forEach(function(e){e(null,t)})}).catch(function(r){t.call(n,r,e)})}).catch(function(r){t.call(n,r,e)}):u.downloadToByteArray(e.encrypt.URI,{},!0,!1,function(r,i){if(r)return t.call(n,r,e);crypto.subtle.importKey("raw",i,"aes-cbc",!0,["decrypt"]).then(function(t){var r=n.keys[e.encrypt.URI];n.keys[e.encrypt.URI]=t,r.forEach(function(e){e(null,t)})}).catch(function(r){t.call(n,r,e)})}))}},{key:"outOfChunks",value:function(){var e,t=this,n=2*Math.max(t.chunkDuration,5e3);this.requestMediaManifest(),setTimeout(function(){t.requestMediaManifest()},n/2),this.endTimer&&clearTimeout(this.endTimer),e=this.segmentsCount,t.endTimer=setTimeout(function(){t.recording&&e==t.segmentsCount&&l.MP2TChunkset.prototype.outOfChunks.call(t)},n)}},{key:"requestMediaManifest",value:function(){if(this.hit&&this.recording){var e=this;o.prefs.chunkedCoappManifestsRequests||p.isProbablyAvailable()?p.request(e.hit.url,{headers:e.hit.headers||[],proxy:o.prefs.coappUseProxy&&e.hit.proxy||null}).then(function(t){var n=d.get(t,e.hit.url);n&&n.isMedia()&&v(n,e.hit,e.hit.url)}).catch(function(t){console.warn("media manifest request for",e.hit.url,"failed:",t.message),e.endRecording()}):u.request({url:e.hit.url,isPrivate:e.hit.isPrivate,headers:e.hit.headers||null,onComplete:function(t){if(200==t.status&&e.hit.url){var n=d.get(t.text,e.hit.url);if(n&&n.isMedia())return void v(n,e.hit,e.hit.url)}}})}}},{key:"endRecording",value:function(e){this.recording&&(this.recording=!1,this.finalize(e||null,function(e){}))}},{key:"finalize",value:function(e,t){l.MP2TChunkset.prototype.finalize.call(this,e,t),delete g[this.id]}},{key:"mediaTimeoutTriggered",value:function(){this.endRecording()}},{key:"setNewId",value:function(){this.id;delete g[this.id],l.MP2TChunkset.prototype.setNewId.call(this),g[this.id]=this,this.requestMediaManifest()}}]),t}()},function(e,t,n){"use strict";var r=new RegExp("^#(EXT[^\\s:]+)(?::(.*))"),i=new RegExp('^\\s*([^=\\s]+)\\s*=\\s*(?:"([^"]*?)"|([^,]*)),?s*(.*?)s*$'),o=new RegExp('^\\s*"(.*)"\\s*$');function a(){}function s(){}a.prototype={init:function(){this.tags={},this.segments=[],this.valid=!1},parse:function(e,t){var n=e.split(/[\r\n]+/);if(0!=n.length&&"#EXTM3U"==n[0].trim()){this.master=!0;for(var i=[],o={},a=1;a<n.length;a++){var s=n[a].trim();if(""!=s)if("#"==s[0]){if(0!=s.indexOf("#EXT"))continue;var u=r.exec(s);if(!u)continue;"EXTINF"==u[1]&&(this.master=!1),o[u[1]]=u[2]}else i.push({url:new URL(s,t).href,tags:Object.assign({},o)})}if(0!=i.length){for(var c in i[0].tags){var l=i[0].tags[c],d=!0;for(a=1;a<i.length;a++){if((f=i[a]).tags[c]!==l){d=!1;break}}d&&(this.tags[c]=this.parseAttrs(l))}for(a=0;a<i.length;a++){var f,p={url:(f=i[a]).url,tags:{}};for(var c in f.tags)void 0===this.tags[c]&&(p.tags[c]=this.parseAttrs(f.tags[c]));this.segments.push(p)}this.valid=!0}}},parseAttrs:function(e){if(r=o.exec(e))return r[1];if(e.indexOf("=")<0)return e;for(var t={},n=e;n.length>0;){var r;if(!(r=i.exec(n)))break;var a=r[1],s=r[2]||r[3];t[a]=s,n=r[4]}return t},isMaster:function(){return this.valid&&this.master},isMedia:function(){return this.valid&&!this.master},walkThrough:function(e){var t=this;this.segments.forEach(function(n,r){e(n.url,Object.assign({},t.tags,n.tags),r)})}},s.prototype=new a,s.prototype.parse=function(e,t){try{var n=0==t.indexOf("https"),r=JSON.parse(e);r.hls_url&&!n&&this.segments.push({url:r.hls_url,tags:{}}),r.https_hls_url&&n&&this.segments.push({url:r.https_hls_url,tags:{}}),this.segments.length>0&&(this.valid=!0,this.master=!0)}catch(e){}},t.get=function(e,t){var n=new a;return n.init(),n.parse(e,t),n.valid&&n.tags&&n.tags["EXT-X-KEY"]&&n.tags["EXT-X-KEY"].URI&&(n.tags["EXT-X-KEY"].URI=new URL(n.tags["EXT-X-KEY"].URI,t).href),n.valid&&n||null},t.getPsJson=function(e,t){var n=new s;return n.init(),n.parse(e,t),n.valid&&n||null}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getHitsFromVariants=function(e,t,n){n=n||{};var i={},s={},u=r.prefs.ignoreProtectedVariants,c=!0;t.forEach(function(t){if(t.url&&!(u&&!n.keepProtected&&t.s&&t.s.length>0)){i[t.itag]=t;var a=e.from+":"+t.itag,d="audio/video",f=null,p=null,h=null,g=l.variants.full[a];if(g){if(!g.enabled)return;g.audioCodec&&(f=g.audioCodec,d="audio"),g.videoCodec&&(p=g.videoCodec,d=f?"audio/video":"video"),h=g.extension}else if(void 0!==t.type||void 0!==t.mimeType){var m=o.exec(t.type||t.mimeType);if(m)if(h=m[2],"audio"==m[1])d="audio",f=m[3]||null,/vorbis|opus/i.test(f)&&(h="webm");else if(m[3]){var v=m[3].split(",");1==v.length?(d="video",p=v[0],/vp8|vp9/i.test(p)&&(h="webm")):(p=v[0],f=v[1])}else"video"==m[1]&&(d="video")}if(h=h||"mp4","audio/video"===d){var y={id:e.from+":"+e.videoId+":"+t.itag,url:t.url,extension:h};t.quality&&(y.quality=t.quality),f&&(y.audioCodec=f),p&&(y.videoCodec=p),t.size&&(y.size=t.size),t.fps&&(y.fps=t.fps),t.s&&(y._signature=t.s),s[a]=y;var g=l.variants.full[a];if(void 0===g){l.variants.full[a]={extension:h,quality:t.quality,audioCodec:f,videoCodec:p,enabled:!0},c=!0;var b=[];if(b.push("("+a+")"),t.quality){var w="quality_"+t.quality,k=r._(w);k==w&&(k=t.quality.toUpperCase()),b.push(k)}t.size&&b.push(t.size),b.push(h.toUpperCase()),p&&b.push("V/"+p),f&&b.push("A/"+f),l.variants.full[a].label=b.join(" - "),l.variants.full_list.push(a)}else!t.size&&g.size&&(y.size=g.size)}else{var x,A;if("audio"==d?(x="adp_audio",A="adp_video"):(x="adp_video",A="adp_audio"),void 0===l.variants[x][t.itag]){var _={extension:h};for(var O in t.size&&(_.size=t.size),t.bitrate&&(_.bitRate=t.bitrate),t.fps&&(_.fps=t.fps),c=!0,l.variants[x][t.itag]=_,l.variants[A])"audio"==d?l.variants.adp_list.push(O+"/"+t.itag):l.variants.adp_list.push(t.itag+"/"+O);"audio"==d?(l.variants[x][t.itag].codec=f,l.variants.adp_list.push("/"+t.itag)):(l.variants[x][t.itag].codec=p,l.variants.adp_list.push(t.itag+"/"))}}}});for(var f=e.maxVariants||r.prefs.qualitiesMax,p=0,h=[],g=null,m=0;m<l.variants.full_list.length&&(!f||p<f);m++){var v=l.variants.full_list[m],y=/^adp:([0-9]+)$/.exec(v);if(y){if(r.prefs.adpHide)continue;g||(g=[],l.variants.adp_list.forEach(function(t){if(!n.audioAndVideo||/^\d+\/\d+$/.test(t)){var r=a.exec(t);if((!(r[1].length>0)||i[r[1]])&&(!(r[1].length>0&&l.variants.adp_video[r[1]]&&"vp9"==l.variants.adp_video[r[1]].codec&&l.converter)||l.converter.vp9support)&&(!(r[2].length>0)||i[r[2]])){var o=i[r[1]],s=i[r[2]],u={id:e.from+":"+e.videoId+":"+t,_signature:[]},c=0,d=null,f=null;o&&(u.videoUrl=o.url,o.clen&&(c+=parseInt(o.clen)),s||(u.url=u.videoUrl),o.s&&u._signature.push(o.s),d=l.variants.adp_video[r[1]],u.extension=o.extension||(d?d.extension:void 0),o.size&&(u.size=o.size),!u.size&&d&&d.size&&(u.size=d.size),o.fps&&(u.fps=o.fps),!u.fps&&d&&d.fps&&(u.fps=d.fps)),s&&(f=l.variants.adp_audio[r[2]],u.audioUrl=s.url,s.clen&&(c+=parseInt(s.clen)),o||(u.url=u.audioUrl,u.extension=s.extension),s.s&&u._signature.push(s.s)),f&&d&&f.extension!=d.extension&&(u.extension="mkv"),c&&(u.length=c),u.group=e.group,g.push(u)}}}));var b=parseInt(y[1])-1;b<g.length&&(h[p++]=Object.assign({order:p,adp:!0},e,g[b]))}else s[v]&&(h[p++]=Object.assign({order:p},e,s[v]))}c&&d();return h},t.getVariantsList=f,t.setVariantsList=p,t.setVariants=function(e){l.variants=e,d()},t.getAdpVariantsList=h,t.setAdpVariantsList=g,t.orderAdaptative=function(){l.variants.adp_list.sort(function(e,t){var n=s.exec(e),r=s.exec(t),i=l.variants.adp_video[n[1]],o=l.variants.adp_video[r[1]],a=l.variants.adp_audio[n[2]],u=l.variants.adp_audio[r[2]],c=i&&parseInt(i.size)||0,d=o&&parseInt(o.size)||0,f=a?1:0,p=u?1:0;return d*p-c*f})},t.hasAudioVideo=function(e){var t={audio:!1,video:!1},n=l.variants.full[e];n&&(t.audio=!!n.audioCodec,t.video=!!n.videoCodec);return t};var r=n(1),i=r.browser,o=new RegExp('^(audio|video)/(?:x\\-)?([^;]+)(?:;(?:\\+| )codecs="(.+)")?$'),a=new RegExp("^([0-9]*)/([0-9]*)$"),s=new RegExp("^(.*)/(.*)$"),u=new RegExp("^adp:[0-9]+$");r.rpc.listen({editVariants:function(){r.ui.open("variants-edit",{type:"tab",url:"content/variants-edit.html"})},getVariantsLists:function(){return{full:f(),adp:h()}},setVariantsLists:function(e){return e.full&&p(e.full),e.adp&&g(e.adp),d()},resetVariants:function(){return l.variants=c,d()}});var c={full:{"tbvws:22":{extension:"mp4",quality:"hd720",audioCodec:"+mp4a.40.2",videoCodec:"avc1.64001F",enabled:!0,label:"MP4 - 1280x720",size:"1280x720"},"tbvws:18":{extension:"mp4",quality:"medium",audioCodec:"+mp4a.40.2",videoCodec:"avc1.42001E",enabled:!0,label:"MP4 - 480x360",size:"480x360"},"tbvws:43":{extension:"webm",quality:"medium",audioCodec:"+vorbis",videoCodec:"vp8.0",enabled:!0,label:"WEBM - 480x360",size:"480x360"},"tbvws:5":{extension:"flv",quality:"small",audioCodec:null,videoCodec:null,enabled:!0,label:"FLV - 320x240",size:"320x240"},"tbvws:36":{extension:"3gpp",quality:"small",audioCodec:"+mp4a.40.2",videoCodec:"mp4v.20.3",enabled:!0,label:"3GPP - 320x240",size:"320x240"},"tbvws:17":{extension:"3gpp",quality:"small",audioCodec:"+mp4a.40.2",videoCodec:"mp4v.20.3",enabled:!0,label:"3GPP - 176x144",size:"176x144"},"tfvws:1080-0":{extension:"mp4",audioCodec:null,videoCodec:null,enabled:!0,size:"1920x1080",label:"H264_1920x1080 -MP4"},"tfvws:720-0":{extension:"mp4",audioCodec:null,videoCodec:null,enabled:!0,size:"1280x720",label:"H264_1280x720 -MP4"},"tfvws:480-0":{extension:"mp4",audioCodec:null,videoCodec:null,enabled:!0,size:"848x480",label:"H264_848x480 -MP4"},"tfvws:380-0":{extension:"mp4",audioCodec:null,videoCodec:null,enabled:!0,size:"512x384",label:"H264_512x384 -MP4"},"tfvws:240-0":{extension:"mp4",audioCodec:null,videoCodec:null,enabled:!0,size:"320x240",label:"H264_320x240 -MP4"}},full_list:["tbvws:22","tbvws:18","adp:1","tbvws:5","tbvws:17","adp:2","tbvws:43","tbvws:36","tfvws:1080-0","tfvws:720-0","tfvws:480-0","tfvws:380-0","tfvws:240-0","adp:3","adp:4"],adp_audio:{139:{extension:"mp4",bitRate:"48429",codec:"mp4a.40.5"},140:{extension:"mp4",bitRate:"127856",codec:"mp4a.40.2"},171:{extension:"webm",bitRate:"133658",fps:"1",codec:"vorbis"}},adp_video:{133:{extension:"mp4",size:"320x240",bitRate:"248086",fps:"30",codec:"avc1.4d400d"},134:{extension:"mp4",size:"640x360",bitRate:"338730",fps:"30",codec:"avc1.4d401e"},135:{extension:"mp4",size:"854x480",bitRate:"721213",fps:"30",codec:"avc1.4d401f"},136:{extension:"mp4",size:"1280x720",bitRate:"1124376",fps:"30",codec:"avc1.4d401f"},137:{extension:"mp4",size:"1920x1080",bitRate:"4137966",fps:"30",codec:"avc1.640028"},160:{extension:"mp4",size:"192x144",bitRate:"111449",fps:"15",codec:"avc1.4d400c"},242:{extension:"webm",size:"320x240",bitRate:"180842",fps:"1",codec:"vp9"},243:{extension:"webm",size:"320x240",bitRate:"332350",fps:"1",codec:"vp9"},244:{extension:"webm",size:"854x480",bitRate:"419080",fps:"30",codec:"vp9"},247:{extension:"webm",size:"1280x720",bitRate:"877134",fps:"30",codec:"vp9"},248:{extension:"webm",size:"1920x1080",bitRate:"2835123",fps:"30",codec:"vp9"},264:{extension:"mp4",size:"2560x1440",bitRate:"9957081",fps:"25",codec:"avc1.640032"},266:{extension:"mp4",size:"3840x2160",bitRate:"22215059",fps:"25",codec:"avc1.640033"},271:{extension:"webm",size:"2560x1440",bitRate:"9227182",fps:"25",codec:"vp9"},278:{extension:"webm",size:"256x144",bitRate:"96779",fps:"1",codec:"vp9"},298:{extension:"mp4",size:"1280x720",bitRate:"3317977",fps:"60",codec:"avc1.4d4020"},299:{extension:"mp4",size:"1920x1080",bitRate:"5546416",fps:"60",codec:"avc1.64002a"},302:{extension:"webm",size:"1280x720",bitRate:"3752347",fps:"60",codec:"vp9"},303:{extension:"webm",size:"1920x1080",bitRate:"6088401",fps:"60",codec:"vp9"},313:{extension:"webm",size:"3840x2160",bitRate:"22856955",fps:"25",codec:"vp9"}},adp_list:["266/140","264/140","137/140","136/140","266/171","264/171","137/171","136/171","248/140","248/171","299/140","299/171","303/140","303/171","247/140","247/171","298/140","298/171","302/140","302/171","135/140","135/171","244/140","244/171","134/140","134/171","133/140","243/171","242/140","243/140","242/171","133/171","278/140","278/171","160/140","160/171","264/","133/","242/","243/","160/","/140","/171","136/","247/","135/","244/","134/","137/","248/","278/","299/","303/","298/","302/","266/","313/140","313/171","313/","271/140","271/171","271/"]},l={variants:{}};function d(){return i.storage.local.set({variants:l.variants}).catch(function(e){console.error("Cannot write variants storage")})}function f(){var e=[],t=r.prefs.adaptativeCount,n=1;for(l.variants.full_list.forEach(function(i){if(u.test(i)){if(n>t)return;e.push({id:"adp:"+n,label:r._("adaptative",n)}),n++}else{var o=l.variants.full[i];o&&e.push({id:i,label:o.label,enabled:o.enabled})}});n<=t;n++)e.push({id:"adp:"+n,label:r._("adaptative",n)});return e}function p(e){l.variants.full_list=[],e.forEach(function(e){l.variants.full_list.push(e.id),u.test(e.id)||(l.variants.full[e.id].enabled=e.enabled)})}function h(){var e=[];return l.variants.adp_list.forEach(function(t){var n=s.exec(t);if(t){var i=l.variants.adp_video[n[1]],o=l.variants.adp_audio[n[2]];if(i||o){var a=[];i&&!o?(a.push(r._("video_only")),a.push(i.extension.toUpperCase())):!i&&o?(a.push(r._("audio_only")),a.push(o.extension.toUpperCase())):a.push(i.extension.toUpperCase()),i&&(i.size&&a.push(i.size),i.fps&&a.push(i.fps+" fps"),i.codec&&a.push(i.codec)),o&&o.codec&&a.push(o.codec),e.push({id:t,label:a.join(" - ")})}}}),e}function g(e){l.variants.adp_list=[],e.forEach(function(e){l.variants.adp_list.push(e.id)})}i.storage.local.get({variants:c}).then(function(e){l.variants=e.variants}).catch(function(e){console.error("Cannot read variants storage")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const r=n(269);t.api=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.domainsFromHit=h,t.getAllDomains=function(){return Object.keys(u)},t.addToBlacklist=g,t.removeFromBlacklist=m,t.checkHitBlacklisted=v,t.set=y;var r=n(1),i=r.browser,o=n(13),a=n(238).api,s=new RegExp("^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"),u={};i.storage.local.get({blacklist:{}}).then(function(e){u=e.blacklist}).catch(function(e){console.error("Cannot read blacklist storage")});var c=null;function l(){c=null,i.storage.local.set({blacklist:u}).catch(function(e){console.error("Cannot write blacklist storage")})}function d(){c&&clearTimeout(c),c=setTimeout(l,100)}function f(e){var t=[],n=/^https?:\/\/([^\/:]+)/.exec(e);if(n)if(s.test(n[1]))t.push(n[1]);else for(var r=n[1].split(".");r.length>1&&("co"!=r[0]||r.length>2);)t.push(r.join(".")),r.shift();return t}function p(e){var t=[];e.url&&(t=t.concat(f(e.url))),e.audioUrl&&(t=t.concat(f(e.audioUrl))),e.videoUrl&&(t=t.concat(f(e.videoUrl))),e.topUrl&&(t=t.concat(f(e.topUrl))),e.pageUrl&&(t=t.concat(f(e.pageUrl)));var n={};return t.forEach(function(e){n[e]=1}),n}function h(e){return function(e){var t=Object.keys(e);return t.sort(function(e,t){for(var n=e.split(".").reverse(),r=t.split(".").reverse();;){if(n.length&&!r.length)return-1;if(!n.length&&r.length)return 1;if(!n.length&&!r.length)return 0;var i=n.shift(),o=r.shift();if(i!=o)return i<o?-1:1}}),t}(p(e))}function g(e){e.forEach(function(e){u[e]=!0,a&&a.blacklistAdded(e)});var t=[],n=o.getHits();Object.keys(n).forEach(function(e){v(n[e])&&t.push(e)}),t.length>0&&o.dispatch("hit.delete",t),d()}function m(e){e.forEach(function(e){delete u[e]}),d()}function v(e){if(!r.prefs.blacklistEnabled)return!1;var t=p(e);for(var n in t)if(u[n])return!0;return!1}function y(e){u=e||{},d()}r.rpc.listen({domainsFromHitId:function(e){var t=o.getHit(e);return t&&h(t)||[]},addToBlacklist:g,removeFromBlacklist:m,setBlacklist:function(e){return y(e)},getBlacklist:function(){return Object.keys(u).filter(function(e){return!!u[e]})},editBlacklist:function(){r.ui.open("blacklist-edit",{type:"tab",url:"content/blacklist-edit.html"})}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),i=r.browser,o=n(13),a=n(6),s=n(241),u=".vdh-mask { position: absolute; display: none; background-color: rgba(255,0,0,0.5); z-index: 2147483647; }";function c(e){var t,n={extensions:r.prefs.medialinkExtensions,maxHits:r.prefs.medialinkMaxHits,minFilesPerGroup:r.prefs.medialinkMinFilesPerGroup,minImgSize:r.prefs.medialinkMinImgSize,scanImages:r.prefs.medialinkScanImages,scanLinks:r.prefs.medialinkScanLinks},o=[{code:"var _$vdhParams = "+JSON.stringify(n)}];e&&o.unshift(e),(t=i.tabs).executeScript.apply(t,o).then(function(){return i.tabs.insertCSS({code:u})}).then(function(){return i.tabs.executeScript({file:"/content/gallery-script.js"})}).catch(function(e){console.error("analyzePage error",e)})}function l(e){return".vdh-mask."+e+" { display: block; }"}t.analyzePage=c,r.rpc.listen({analyzePage:function(){c()},galleryGroups:function(e){Object.keys(e.groups).forEach(function(t){var n=e.groups[t],i="??",u="??";try{u=new URL(n.baseUrl).hostname}catch(e){}switch(n.type){case"image":i=r._("gallery_from_domain",u);break;case"link":i=r._("gallery_links_from_domain",u)}var c=void 0;if(n.extensions){var l=Object.keys(n.extensions);l.sort(function(e,t){return n.extensions[e]-n.extensions[t]});var d=[];l.forEach(function(e){var t=r._("number_type",[""+n.extensions[e],e.toUpperCase()]);d.push(t)}),c=r._("gallery_files_types",d.length>0&&d.join(", ")||""+n.urls.length)}var f="gallery:"+a.hashHex(e.pageUrl)+":"+t;o.dispatch("hit.new",Object.assign({},n,{id:f,topUrl:e.pageUrl,title:i,description:c,mouseTrack:!0})),s.getProxyHeaders(e.pageUrl).then(function(e){o.dispatch("hit.update",{id:f,changes:e})})})},galleryHighlight:function(e,t){var n=o.getHit(t);n&&i.tabs.insertCSS(n.tabId,{frameId:n.frameId,code:l(e)})},galleryUnhighlight:function(e,t){var n=o.getHit(t);n&&(i.tabs.removeCSS?i.tabs.removeCSS(n.tabId,{frameId:n.frameId,code:l(e)}):i.tabs.insertCSS(n.tabId,{frameId:n.frameId,code:function(e){return".vdh-mask."+e+" { display: none; }"}(e)}))}}),i.tabs.onUpdated.addListener(function(e,t,n){"complete"===t.status&&r.prefs.medialinkAutoDetect&&c(e)})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getProxyHeaders=function(e){function t(){var t=U[e];t&&(t.handlers.forEach(function(e){e.reject(new Error("timeout monitoring proxyHeaders"))}),delete U[e])}var n=U[e];n?clearTimeout(n.timer):n=U[e]={handlers:[]};return new Promise(function(r,i){n.handlers.push({resolve:r,reject:i}),n.timer=setTimeout(t,3e4);var o=new XMLHttpRequest;o.open("HEAD",e),o.send()})};var r=n(1),i=n(13),o=n(39),a=n(6),s=n(63),u=n(234),c=n(62),l=n(272),d=r.browser,f=new RegExp("^bytes [0-9]+-[0-9]+/([0-9]+)$"),p=new RegExp("^(audio|video)/(?:x-)?([^; ]+)"),h=new RegExp('filename\\s*=\\s*"\\s*([^"]+?)\\s*"'),g=new RegExp("/([^/]+?)(?:\\.([a-z0-9]{1,5}))?(?:\\?|#|$)","i"),m=new RegExp("\\.([a-z0-9]{1,5})(?:\\?|#|$)","i"),v=new RegExp("\\bsource=yt_otf\\b"),y=new RegExp("/ptracking\\b"),b=new RegExp("^https://www.gstatic.com/youtube/doodle\\b"),w=new RegExp("^https?://[^/]*\\bfbcdn\\b.*bytestart="),k=new RegExp("^(https?)://v[^\\/]*\\.tumblr\\.com/(tumblr_[0-9a-zA-Z_]+)\\.(?:mp4|mov)"),x={},A={host:!0,range:!0};function _(){x={},r.prefs.mediaExtensions.split("|").forEach(function(e){x[e]=1})}_(),r.prefs.on("mediaExtensions",_);var O=null;function I(){O=null;var e=r.prefs.networkFilterOut;if(e)try{O=new RegExp(e,"i")}catch(e){}}I(),r.prefs.on("networkFilterOut",I);var P=function(e){var t;if(E&&(t=E[e.requestId])&&delete E[e.requestId],!(e.tabId<0)){var n=c.networkHook(e.url,e)||l.networkHook(e.url,e,t,T&&T[e.requestId]),_=!!n;if(_||!(v.test(e.url)||y.test(e.url)||b.test(e.url)||O&&O.test(e.url))){var I={};(e.responseHeaders||[]).forEach(function(e){I[e.name.toLowerCase()]=e.value});var P=I["content-type"],C=p.exec(P),S=parseInt(I["content-length"])||null;if(_||"0"!==S){var j=null,D=I["content-range"];if(D){var R=f.exec(D);R&&(j=R[1])}j||(j=S),j=parseInt(j);var q=m.exec(e.url),M=null;if(q){if("m4s"==(M=q[1].toLowerCase())&&r.prefs.dashHideM4s)return;if("ts"==M&&r.prefs.mpegtsHideTs)return;if("f4f"==M)return;x[q[1]]||(q=null)}!C||"audio"!=C[1]&&"video"!=C[1]||(_=!0);var F=e.originUrl||e.documentUrl||void 0;(n=n||u.networkHook(e,{contentType:P,referrer:F,headers:t,proxy:e.proxyInfo}))?(_=!0,n.then(U).catch(function(e){})):U(null)}}}function U(n){if(_||!(!C&&isNaN(j)&&!q||!C&&!q&&(isNaN(j)||0===r.prefs.mediaweightThreshold||j<r.prefs.mediaweightThreshold)||!isNaN(j)&&j<r.prefs.mediaweightMinSize||C&&"ms-asf"==C[2].toLowerCase()||C&&"f4f"==C[2].toLowerCase())){var u={id:"network-probe:"+a.hashHex(e.url),status:"active",url:e.url,tabId:e.tabId,frameId:e.frameId,fromCache:!0,referrer:F};if(isNaN(j)||(u.length=j),e.proxyInfo&&"http"==e.proxyInfo.type.substr(0,4)&&(u.proxy=e.proxyInfo),!r.prefs.tbsnFilterOut||!w.test(e.url)){var c=I["content-disposition"];if(c){var l=h.exec(c);l&&l[1]&&(u.headerFilename=l[1])}var f=g.exec(e.url);f&&(u.urlFilename=f[1]),u.title=u.headerFilename||u.urlFilename||r._("media");var p=k.exec(e.url);p&&(u.thumbnailUrl=p[1]+"://media.tumblr.com/"+p[2]+"_frame1.jpg"),q?(u.type="video",u.extension=q[1]):C?(u.type=C[1],u.extension=C[2]):u.extension=M,u.headers=t&&t.filter(function(e){return void 0===A[e.name.toLowerCase()]})||[],d.tabs.get(e.tabId).then(function(e){if(e){u.topUrl=e.url,u.isPrivate=e.incognito,u.title=u.headerFilename||e.title||u.urlFilename||r._("media");var t=s.getSpecs(e.url);t&&(t.headerFilename=u.headerFilename,t.urlFilename=u.urlFilename);var a=["var _$vdhHitId = "+JSON.stringify(u.id)+";","var _$vdhSmartNameSpecs = "+JSON.stringify(t)+";"];d.tabs.executeScript(e.id,{code:a.join("\n"),frameId:0}).then(function(){return d.tabs.executeScript(e.id,{file:"/content/pagedata-script.js",frameId:0})}).catch(function(t){d.webNavigation.getFrame({tabId:e.id,frameId:u.frameId}).then(function(n){n&&(console.warn("pagedata-script execution error",t.message),o.updateOriginal(u.id,{title:e.title||u.title,pageUrl:n.url,topUrl:e.url}))})})}n?(u.originalId=u.id,n.handleHit(u)):i.dispatch("hit.new",u)})}}}};"firefox"==r.browserType&&["main_frame","sub_frame","xmlhttprequest","object","media"].push("object_subrequest");var C=function(){};function S(){d.webRequest.onHeadersReceived.addListener(P,{urls:["<all_urls>"]},["responseHeaders"]),d.webRequest.onBeforeRedirect.addListener(C,{urls:["<all_urls>"]})}r.prefs.on("networkProbe",function(e,t){t?S():(d.webRequest.onHeadersReceived.removeListener(P),d.webRequest.onBeforeRedirect.removeListener(C))}),r.prefs.networkProbe&&S();var E=null,j=function(e){L(e),E&&(E[e.requestId]=e.requestHeaders)},D=function(e){L(e),E&&delete E[e.requestId]};function R(){E={},d.webRequest.onSendHeaders.addListener(j,{urls:["<all_urls>"]},["requestHeaders"]),d.webRequest.onErrorOccurred.addListener(D,{urls:["<all_urls>"]})}r.prefs.on("monitorNetworkRequests",function(e,t){t?R():(d.webRequest.onSendHeaders.removeListener(j),d.webRequest.onErrorOccurred.removeListener(D),E=null)}),r.prefs.monitorNetworkRequests&&R();var T=null,q=function(e){T&&"POST"===e.method&&e.requestBody&&e.requestBody.formData&&(T[e.requestId]=e.requestBody.formData)},M=function(e){T&&delete T[e.requestId]};function F(){T={},d.webRequest.onBeforeRequest.addListener(q,{urls:["https://*.facebook.com/video/*"]},["requestBody"]),d.webRequest.onErrorOccurred.addListener(M,{urls:["https://*.facebook.com/video/tahoe/async/*"]})}r.prefs.on("tbsnEnabled",function(e,t){t?F():(d.webRequest.onBeforeRequest.removeListener(q),d.webRequest.onErrorOccurred.removeListener(M),T=null)}),r.prefs.tbsnEnabled&&F();var U={};function L(e){var t=U[e.url];if(t){clearTimeout(t.timer),delete U[e.url];var n=e.requestHeaders.filter(function(e){return void 0===A[e.name.toLowerCase()]});t.handlers.forEach(function(t){t.resolve({proxy:e.proxyInfo,headers:n})})}}},,,,,,,,,,function(e,t,n){e.exports=n(252)},function(e,t,n){"use strict";var r=n(1),i=r.browser,o=n(10),a=o.buildOptions||{};o.prod||console.info("=========== VDH started",(new Date).toLocaleTimeString(),"==========");var s=i.runtime.getManifest();r.prefs.declare(n(254)),n(255),n(26),n(94),n(241),n(240),n(118),JSON.parse(a.linuxlic||"false")&&(r.prefs.linuxLicense=!0);var u=n(40);r.rpc.listen({openSettings:function(){r.ui.open("settings",{type:"tab",url:"content/settings.html"}),r.ui.close("main")},openTranslation:function(){r.ui.open("translation",{type:"tab",url:"content/translation.html"}),r.ui.close("main")},openSites:function(){return u.gotoOrOpenTab("https://www.downloadhelper.net/sites")},openForum:function(){return u.gotoOrOpenTab("https://groups.google.com/forum/#!forum/video-downloadhelper-q-and-a")},openHomepage:function(){return u.gotoOrOpenTab("https://www.downloadhelper.net/")},openTranslationForum:function(){return u.gotoOrOpenTab("https://groups.google.com/forum/#!forum/video-downloadhelper-internationalization")},openWeh:function(){return u.gotoOrOpenTab("https://github.com/mi-g/weh")},openAbout:function(){r.ui.open("about",{type:"panel",url:"content/about.html"}),r.ui.close("main")},openCoapp:function(){r.ui.open("coappShell",{type:"tab",url:"content/coapp-shell.html"}),r.ui.close("main")},goto:function(e){return u.gotoOrOpenTab(e)},getBuild:function(){return o},updateLastFocusedWindowHeight:function(e,t){i.windows.getLastFocused().then(function(n){if(n){var r=n.height-t;i.windows.update(n.id,{height:e+r})}})}}),i.runtime.onInstalled.addListener(function(e){"install"==e.reason?u.gotoOrOpenTab("https://www.downloadhelper.net/welcome?browser="+(a.browser||"")+"&version="+s.version):"update"!=e.reason||e.previousVersion==i.runtime.getManifest().version||"7.2.1"==s.version||"7.2.2"==s.version||"7.3.1"==s.version&&"7.3.0"==e.previousVersion||"7.3.3.0"==s.version&&"7.3.3.1"==e.previousVersion||"7.3.3.1"==s.version&&"7.3.3.2"==e.previousVersion||"7.4.0.1"==s.version&&"7.4.0.0"==e.previousVersion||"7.5.0.0"==s.version||/^7\.3\.7(\.\d+)?$/.test(s.version)||u.gotoOrOpenTab("https://www.downloadhelper.net/update?browser="+(a.browser||"")+"&from="+e.previousVersion+"&to="+s.version)})},function(e,t,n){"use strict";var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=n(2),o=n(3),a=i.browser,s={},u={};function c(e,t){var n=!1;return new Promise(function(t,r){return a.tabs.query({}).then(function(r){r.forEach(function(t){t.url===e&&(a.tabs.update(t.id,{active:!0}),a.windows.update(t.windowId,{focused:!0}),n=!0)}),t(n)})})}a.tabs.onRemoved.addListener(function(e){i.__closeByTab(e);var t=u[e];t&&(delete u[e],delete s[t])}),e.exports={open:function(e,t){switch(t.type){case"panel":return function(e,t){return new Promise(function(n,o){var l=a.extension.getURL(t.url+"?panel="+e);c(l).then(function(n){if(!n)return function(e,t){return new Promise(function(n,o){var c=a.extension.getURL(t.url+"?panel="+e);a.windows.getCurrent().then(function(l){var d=t.width||500,f=t.height||400,p={url:c,width:d,height:f,type:"popup",left:Math.round((l.width-d)/2+l.left),top:Math.round((l.height-f)/2+l.top)};return i.isBrowser("chrome","opera")&&(p.focused=!0),a.windows.create(p).then(function(t){return s[e]={type:"window",windowId:t.id},Promise.all([t,a.windows.update(t.id,{focused:!0})])}).then(function(s){var c=r(s,1),l=c[0];function d(e){e!=l.id&&t.autoClose&&a.windows.getCurrent().then(function(e){e.id!=l.id&&a.windows.remove(l.id).then(function(){},function(){})})}Promise.resolve().then(function(){return t.initData&&t.initData.autoResize?void 0:a.windows.update(l.id,{height:l.height+1}).then(function(){return a.windows.update(l.id,{height:l.height-1})})}).then(function(){var e=new Promise(function(e,t){var n=setTimeout(function(){a.tabs.onCreated.removeListener(r),t(new Error("Tab did not open"))},5e3);function r(t){t.windowId==l.id&&(clearTimeout(n),a.tabs.onCreated.removeListener(r),e(t))}a.tabs.onCreated.addListener(r)}),t=a.tabs.query({windowId:l.id}).then(function(e){return new Promise(function(t,n){e.length>0&&t(e[0])})});return Promise.race([e,t])}).then(function(e){return"loading"==e.status?new Promise(function(t,n){var r=setTimeout(function(){a.tabs.onUpdated.removeListener(i),n(new Error("Tab did not complete"))},6e4);function i(n,o,s){n==e.id&&"complete"==s.status&&(clearTimeout(r),a.tabs.onUpdated.removeListener(i),t(s))}a.tabs.onUpdated.addListener(i)}):e}).then(function(n){i.__declareAppTab(e,{tab:n.id,initData:t.initData}),u[n.id]=e}).then(n).catch(o),a.windows.onFocusChanged.addListener(d),a.windows.onRemoved.addListener(function e(t){t==l.id&&(a.windows.onFocusChanged.removeListener(d),a.windows.onFocusChanged.removeListener(e))})}).catch(o)}).catch(o)})}(e,t)}).then(n).catch(o)})}(e,t);case"tab":default:return function(e,t){return new Promise(function(n,r){var o=a.extension.getURL(t.url+"?panel="+e);c(o).then(function(n){if(!n)return a.tabs.create({url:o}).then(function(n){i.__declareAppTab(e,{tab:n.id,initData:t.initData}),s[e]={type:"tab",tabId:n.id},u[n.id]=e})}).then(n).catch(r)})}(e,t)}},close:function(e){var t=s[e];t&&"tab"==t.type?a.tabs.remove(t.tabId):t&&"window"==t.type?a.windows.remove(t.windowId):o.call(e,"close")},isOpen:function(e){return!!s[e]}}},function(e,t,n){"use strict";e.exports=[{name:"networkProbe",type:"boolean",defaultValue:!0},{name:"titleMode",type:"choice",defaultValue:"right",choices:["right","left","multiline"]},{name:"iconActivation",type:"choice",defaultValue:"currenttab",choices:["currenttab","anytab"]},{name:"iconBadge",type:"choice",defaultValue:"tasks",choices:["none","tasks","activetab","anytab","pinned","mixed"]},{name:"hitsGotoTab",type:"boolean",defaultValue:!0},{name:"default-action-0",type:"string",defaultValue:"quickdownload",hidden:!0},{name:"default-action-1",type:"string",defaultValue:"openlocalfile",hidden:!0},{name:"default-action-2",type:"string",defaultValue:"abort",hidden:!0},{name:"smartnamerFnameSpaces",type:"choice",defaultValue:"keep",choices:["keep","remove","hyphen","underscore"]},{name:"smartnamerFnameMaxlen",type:"integer",defaultValue:64,minimum:12,maximum:256},{name:"downloadControlledMax",type:"integer",defaultValue:6,minimum:0},{name:"downloadStreamControlledMax",type:"integer",defaultValue:6,minimum:0},{name:"autoPin",type:"boolean",defaultValue:!1},{name:"mediaExtensions",type:"string",defaultValue:"flv|ram|mpg|mpeg|avi|rm|wmv|mov|asf|mp3|rar|movie|divx|rbs|mp4|mpeg4"},{name:"dashHideM4s",type:"boolean",defaultValue:!0},{name:"mpegtsHideTs",type:"boolean",defaultValue:!0},{name:"orphanExpiration",type:"integer",defaultValue:60,minimum:0},{name:"chunksEnabled",type:"boolean",defaultValue:!0},{name:"hlsEnabled",type:"boolean",defaultValue:!0},{name:"dashEnabled",type:"boolean",defaultValue:!0},{name:"f4fEnabled",type:"boolean",defaultValue:!0},{name:"dashOnAdp",type:"choice",defaultValue:"audio_video",choices:["audio","video","audio_video"]},{name:"hlsDownloadAsM2ts",type:"boolean",defaultValue:!1},{name:"networkFilterOut",type:"string",defaultValue:"/frag\\\\([0-9]+\\\\)/|[&\\\\?]range=[0-9]+-[0-9]+|/silverlight/"},{name:"mediaweightThreshold",type:"integer",defaultValue:1048576},{name:"mediaweightMinSize",type:"integer",defaultValue:4096},{name:"tbvwsEnabled",type:"boolean",defaultValue:!0,hidden:!0},{name:"ignoreProtectedVariants",type:"boolean",defaultValue:!0},{name:"qualitiesMaxVariants",type:"integer",defaultValue:6},{name:"adpHide",type:"boolean",defaultValue:!1},{name:"adaptativeCount",type:"integer",defaultValue:4,hidden:!0},{name:"converterThreads",type:"string",defaultValue:"auto"},{name:"converterAggregTuneH264",type:"boolean",defaultValue:!1},{name:"notifyReady",type:"boolean",defaultValue:!0},{name:"noPrivateNotification",type:"boolean",defaultValue:!0},{name:"avplayEnabled",type:"boolean",defaultValue:!0},{name:"blacklistEnabled",type:"boolean",defaultValue:!0},{name:"chunksConcurrentDownloads",type:"integer",defaultValue:4},{name:"chunksPrefetchCount",type:"integer",defaultValue:4},{name:"downloadRetries",type:"integer",defaultValue:3},{name:"downloadRetryDelay",type:"integer",defaultValue:1e3},{name:"mpegtsSaveRaw",type:"boolean",defaultValue:!1,hidden:!0},{name:"mpegtsSaveRawStreams",type:"boolean",defaultValue:!1,hidden:!0},{name:"mpegtsEndsOnSeenChunk",type:"boolean",defaultValue:!0,hidden:!0},{name:"converterKeepTmpFiles",type:"boolean",defaultValue:!1},{name:"f4fFragPostUrl",type:"boolean",defaultValue:!0,hidden:!0},{name:"f4fFragIndex",type:"boolean",defaultValue:!0,hidden:!0},{name:"backgroundReduxLogger",type:"boolean",defaultValue:!1,hidden:!0},{name:"dlconvLastOutput",type:"string",defaultValue:"",hidden:!0},{name:"linuxLicense",type:"boolean",defaultValue:!1,hidden:!0},{name:"qrMessageNotAgain",type:"boolean",defaultValue:!1,hidden:!0},{name:"coappShellEnabled",type:"boolean",defaultValue:!1,hidden:!0},{name:"tbsnFilterOut",type:"boolean",defaultValue:!0,hidden:!0},{name:"downloadCount",type:"integer",defaultValue:0,hidden:!0},{name:"donateNotAgainExpire",type:"integer",defaultValue:0,hidden:!0},{name:"popupHeightLeftOver",type:"integer",defaultValue:100,hidden:!0},{name:"coappDownloads",type:"choice",defaultValue:"ask",choices:["ask","coapp","browser"]},{name:"lastDownloadDirectory",type:"string",defaultValue:"dwhelper"},{name:"fileDialogType",type:"choice",defaultValue:"tab",choices:["tab","panel"]},{name:"alertDialogType",type:"choice",defaultValue:"tab",choices:["tab","panel"]},{name:"monitorNetworkRequests",type:"boolean",defaultValue:!0},{name:"chunkedCoappManifestsRequests",type:"boolean",defaultValue:!1},{name:"chunkedCoappDataRequests",type:"boolean",defaultValue:!0},{name:"coappRestartDelay",type:"integer",defaultValue:1e3},{name:"rememberLastDir",type:"boolean",defaultValue:!0},{name:"coappIdleExit",type:"integer",defaultValue:6e4},{name:"dialogAutoClose",type:"boolean",defaultValue:!1},{name:"convertControlledMax",type:"integer",defaultValue:1},{name:"checkCoappOnStartup",type:"boolean",defaultValue:!0},{name:"coappUseProxy",type:"boolean",defaultValue:!0},{name:"downloadCompleteDelay",type:"integer",defaultValue:1e3},{name:"contentRedirectEnabled",type:"boolean",defaultValue:!0},{name:"contextMenuEnabled",type:"boolean",defaultValue:!0},{name:"toolsMenuEnabled",type:"boolean",defaultValue:!1},{name:"medialinkExtensions",type:"string",defaultValue:"jpg|jpeg|gif|png|mpg|mpeg|avi|rm|wmv|mov|flv|mp3|mp4"},{name:"medialinkMaxHits",type:"integer",defaultValue:50},{name:"medialinkMinFilesPerGroup",type:"integer",defaultValue:6},{name:"medialinkMinImgSize",type:"integer",defaultValue:80},{name:"medialinkAutoDetect",type:"boolean",defaultValue:!1},{name:"medialinkScanImages",type:"boolean",defaultValue:!0},{name:"medialinkScanLinks",type:"boolean",defaultValue:!0},{name:"bulkEnabled",type:"boolean",defaultValue:!0},{name:"tbvwsGrabDelay",type:"integer",defaultValue:2e3},{name:"forcedCoappVersion",type:"string",regexp:"^$|^\\d+\\.\\d+\\.\\d+$",defaultValue:""},{name:"lastHlsDownload",type:"integer",defaultValue:0,hidden:!0},{name:"tbsnEnabled",type:"boolean",defaultValue:!0},{name:"galleryNaming",type:"choice",choices:["type-index","url","index-url"],defaultValue:"type-index"},{name:"hlsRememberPrevLiveChunks",type:"boolean",defaultValue:!1}]},function(e,t,n){"use strict";var r=n(2),i=n(3),o=n(25),a=r.browser,s=null,u=null,c=!1;a.runtime.onMessageExternal&&(a.runtime.onMessageExternal.addListener(function(e,t,n){switch(e.type){case"weh#inspect-ping":s=t.id,n({type:"weh#inspect-pong",version:1,manifest:a.runtime.getManifest()});break;case"weh#inspect":s=t.id,(c=e.inspected)?i.setHook(function(e){c&&s&&a.runtime.sendMessage(s,{type:"weh#inspect-message",message:e}).catch(function(e){console.info("Error sending message",e),c=!1})}):i.setHook(null),n({type:"weh#inspect",version:1,inspected:c});break;case"weh#get-prefs":s=t.id,n({type:"weh#prefs",prefs:o.getAll(),specs:o.getSpecs()});break;case"weh#set-pref":o[e.pref]=e.value,n(!0);break;case"weh#get-storage":s=t.id,new Promise(function(e,t){var n={};["localStorage","sessionStorage"].forEach(function(e){try{var t=window[e];if(t){for(var r={},i=0;i<t.length;i++){var o=t.key(i),a=t.getItem(o);try{r[o]=JSON.parse(a)}catch(e){r[o]=a}}n[e]=r}}catch(e){}});var r=[];["local","sync","managed"].forEach(function(e){try{var t=a.storage&&a.storage[e];if(t)return new Promise(function(i,o){var a=t.get(null).then(function(t){n[e]=t}).catch(function(e){});r.push(a)})}catch(e){}}),Promise.all(r).then(function(){e(n)}).catch(t)}).then(function(e){a.runtime.sendMessage(s,{type:"weh#storage",storage:e})}).catch(function(e){console.error("Error get storage data",e)}),n({type:"weh#storage-pending"})}}),u={send:function(){console.info("TODO implement inspect.send")}}),e.exports=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();n(1),t.Downloads=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.coapp=t}return r(e,[{key:"download",value:function(e){return this.coapp.call("downloads.download",e)}},{key:"search",value:function(e){return this.coapp.call("downloads.search",e)}},{key:"cancel",value:function(e){return this.coapp.call("downloads.cancel",e)}}]),e}()},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var a=n(2).browser,s=n(3),u=function(){function e(){o(this,e),this.listeners=[]}return r(e,[{key:"addListener",value:function(e){this.listeners.push(e)}},{key:"removeListener",value:function(e){this.listeners=this.listeners.filter(function(t){return e!==t})}},{key:"removeAllListeners",value:function(){this.listeners=[]}},{key:"notify",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.listeners.forEach(function(e){try{e.apply(void 0,t)}catch(e){console.warn(e)}})}}]),e}(),c=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};o(this,e),this.appId=t,this.name=n.name||t,this.appPort=null,this.pendingCalls=[],this.runningCalls=[],this.state="idle",this.postFn=this.post.bind(this),this.postMessageFn=this.postMessage.bind(this),this.onAppNotFound=new u,this.onAppNotFoundCheck=new u,this.onCallCount=new u,this.appStatus="unknown",this.app2AddonCallCount=0,this.addon2AppCallCount=0}return r(e,[{key:"post",value:function(e,t){this.appPort.postMessage(t)}},{key:"postMessage",value:function(e){this.appPort.postMessage(e)}},{key:"updateCallCount",value:function(e,t){switch(e){case 2:this.app2AddonCallCount+=t;break;case 1:this.addon2AppCallCount+=t}this.onCallCount.notify(this.addon2AppCallCount,this.app2AddonCallCount)}},{key:"close",value:function(){if(this.appPort)try{this.appPort.disconnect(),this.cleanup()}catch(e){}}},{key:"call",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return this.callCatchAppNotFound.apply(this,[null].concat(t))}},{key:"callCatchAppNotFound",value:function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=this;function u(e){for(var t;t=o.pendingCalls.shift();)e?t.reject(e):function(){o.runningCalls.push(t);var e=t;s.call.apply(s,[o.postFn,o.name].concat(i(t.params))).then(function(t){return o.runningCalls.splice(o.runningCalls.indexOf(e),1),t}).then(e.resolve).catch(function(t){o.runningCalls.splice(o.runningCalls.indexOf(e),1),e.reject(t)})}()}switch(!e||"unknown"!=o.appStatus&&"checking"!=o.appStatus||o.onAppNotFoundCheck.addListener(e),o.updateCallCount(1,1),this.state){case"running":return new Promise(function(e,t){var r={resolve:e,reject:t,params:[].concat(n)};o.runningCalls.push(r),s.call.apply(s,[o.postFn,o.name].concat(n)).then(function(e){return o.runningCalls.splice(o.runningCalls.indexOf(r),1),e}).then(r.resolve).catch(function(e){o.runningCalls.splice(o.runningCalls.indexOf(r),1),r.reject(e)})}).then(function(e){return o.updateCallCount(1,-1),e}).catch(function(e){throw o.updateCallCount(1,-1),e});case"idle":return o.state="pending",new Promise(function(t,r){o.pendingCalls.push({resolve:t,reject:r,params:[].concat(n)});var i=a.runtime.connectNative(o.appId);o.appStatus="checking",o.appPort=i,i.onMessage.addListener(function(e){"checking"==o.appStatus&&(o.appStatus="ok",o.onAppNotFoundCheck.removeAllListeners()),s.receive(e,o.postMessageFn,o.name)}),i.onDisconnect.addListener(function(){u(new Error("Disconnected")),o.cleanup(),"checking"!=o.appStatus||e||o.onAppNotFound.notify(o.appPort&&o.appPort.error||a.runtime.lastError)}),o.state="running",u()}).then(function(e){return o.updateCallCount(1,-1),e}).catch(function(e){throw o.updateCallCount(1,-1),e});case"pending":return new Promise(function(e,t){o.pendingCalls.push({resolve:e,reject:t,params:[].concat(n)})}).then(function(e){return o.updateCallCount(1,-1),e}).catch(function(e){throw o.updateCallCount(1,-1),e})}}},{key:"listen",value:function(e){var t=this,n={};return Object.keys(e).forEach(function(r){n[r]=function(){return t.updateCallCount(2,1),Promise.resolve(e[r].apply(e,arguments)).then(function(e){return t.updateCallCount(2,-1),e}).catch(function(e){throw t.updateCallCount(2,-1),e})}}),s.listen(n)}},{key:"cleanup",value:function(){var e;for("checking"==this.appStatus&&(this.onAppNotFoundCheck.notify(this.appPort&&this.appPort.error||a.runtime.lastError),this.onAppNotFoundCheck.removeAllListeners());e=this.runningCalls.shift();)e.reject(new Error("Native port disconnected"));this.state="idle",this.appStatus="unknown",this.appPort=null}}]),e}();e.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(c,[null].concat(t)))}},function(e,t,n){"use strict";var r=n(259).get;function i(e,t){return e===t}e.exports=function(e,t,n){n=n||i;var o=r(e(),t);return function(i){return function(){var a=r(e(),t);if(!n(o,a)){var s=o;o=a,i(a,s,t)}}}}},function(e,t,n){var r,i,o;!function(n,a){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=a():(i=[],void 0===(o="function"==typeof(r=a)?r.apply(t,i):r)||(e.exports=o))}(0,function(){"use strict";var e=Object.prototype.toString;function t(e,t){return null!=e&&Object.prototype.hasOwnProperty.call(e,t)}function n(e){if(!e)return!0;if(i(e)&&0===e.length)return!0;if("string"!=typeof e){for(var n in e)if(t(e,n))return!1;return!0}return!1}function r(t){return e.call(t)}var i=Array.isArray||function(t){return"[object Array]"===e.call(t)};function o(e){var t=parseInt(e);return t.toString()===e?t:e}function a(e){var a,s=function(e){return Object.keys(s).reduce(function(t,n){return"create"===n?t:("function"==typeof s[n]&&(t[n]=s[n].bind(s,e)),t)},{})};function u(e,t){if(a(e,t))return e[t]}function c(t,n,r,i){if("number"==typeof n&&(n=[n]),!n||0===n.length)return t;if("string"==typeof n)return c(t,n.split(".").map(o),r,i);var a=n[0],s=u(t,a);if(e.includeInheritedProps&&("__proto__"===a||"constructor"===a&&"function"==typeof s))throw new Error("For security reasons, object's magic properties cannot be set");return 1===n.length?(void 0!==s&&i||(t[a]=r),s):(void 0===s&&("number"==typeof n[1]?t[a]=[]:t[a]={}),c(t[a],n.slice(1),r,i))}return a=(e=e||{}).includeInheritedProps?function(){return!0}:function(e,n){return"number"==typeof n&&Array.isArray(e)||t(e,n)},s.has=function(n,r){if("number"==typeof r?r=[r]:"string"==typeof r&&(r=r.split(".")),!r||0===r.length)return!!n;for(var a=0;a<r.length;a++){var s=o(r[a]);if(!("number"==typeof s&&i(n)&&s<n.length||(e.includeInheritedProps?s in Object(n):t(n,s))))return!1;n=n[s]}return!0},s.ensureExists=function(e,t,n){return c(e,t,n,!0)},s.set=function(e,t,n,r){return c(e,t,n,r)},s.insert=function(e,t,n,r){var o=s.get(e,t);r=~~r,i(o)||(o=[],s.set(e,t,o)),o.splice(r,0,n)},s.empty=function(e,t){var o,u;if(!n(t)&&(null!=e&&(o=s.get(e,t)))){if("string"==typeof o)return s.set(e,t,"");if(function(e){return"boolean"==typeof e||"[object Boolean]"===r(e)}(o))return s.set(e,t,!1);if("number"==typeof o)return s.set(e,t,0);if(i(o))o.length=0;else{if(!function(e){return"object"==typeof e&&"[object Object]"===r(e)}(o))return s.set(e,t,null);for(u in o)a(o,u)&&delete o[u]}}},s.push=function(e,t){var n=s.get(e,t);i(n)||(n=[],s.set(e,t,n)),n.push.apply(n,Array.prototype.slice.call(arguments,2))},s.coalesce=function(e,t,n){for(var r,i=0,o=t.length;i<o;i++)if(void 0!==(r=s.get(e,t[i])))return r;return n},s.get=function(e,t,n){if("number"==typeof t&&(t=[t]),!t||0===t.length)return e;if(null==e)return n;if("string"==typeof t)return s.get(e,t.split("."),n);var r=o(t[0]),i=u(e,r);return void 0===i?n:1===t.length?i:s.get(e[r],t.slice(1),n)},s.del=function(e,t){if("number"==typeof t&&(t=[t]),null==e)return e;if(n(t))return e;if("string"==typeof t)return s.del(e,t.split("."));var r=o(t[0]);return a(e,r)?1!==t.length?s.del(e[r],t.slice(1)):(i(e)?e.splice(r,1):delete e[r],e):e},s}var s=a();return s.create=a,s.withInheritedProps=a({includeInheritedProps:!0}),s})},function(e,t,n){"use strict";!function(){var e=this,t=function(t,n){var r,i=t.split("."),o=window||e;i[0]in o||!o.execScript||o.execScript("var "+i[0]);for(;i.length&&(r=i.shift());)i.length||void 0===n?o=o[r]?o[r]:o[r]={}:o[r]=n},n=function(e){var t=chrome.runtime.connect("nmmhkkegccagdldgiimedpiccmgmieda",{}),n=!1;t.onMessage.addListener(function(t){n=!0,"response"in t&&!("errorType"in t.response)?e.success&&e.success(t):e.failure&&e.failure(t)}),t.onDisconnect.addListener(function(){!n&&e.failure&&e.failure({request:{},response:{errorType:"INTERNAL_SERVER_ERROR"}})}),t.postMessage(e)};t("google.payments.inapp.buy",function(e){e.method="buy",n(e)}),t("google.payments.inapp.consumePurchase",function(e){e.method="consumePurchase",n(e)}),t("google.payments.inapp.getPurchases",function(e){e.method="getPurchases",n(e)}),t("google.payments.inapp.getSkuDetails",function(e){e.method="getSkuDetails",n(e)})}()},function(e,t,n){"use strict";var r=n(1),i=r.browser,o=n(6),a=n(26),s=1e3,u=0,c={},l=null,d=null;function f(e){if(e&&e.coappDownload)return a.downloads;if(d)return d;var t=(d=Object.assign({},i.downloads)).download;return d.download=function(e){return e.headers&&(e.headers=[]),delete e.directory,delete e.proxy,t(e)},d}function p(){var e=Object.keys(c).length;l&&0==e?(clearInterval(l),l=null):!l&&e>0&&(l=setInterval(h,s))}function h(){var e=function(e){var t=c[e];f(t.data).search({id:t.downloadId}).then(function(n){if(n.length>0){var i=n[0];if("in_progress"==i.state){var a=Math.floor(100*i.bytesReceived/i.totalBytes);a!=t.lastProgress&&(t.lastProgress=a,t.progress(a)),i.error&&(f(t.data).cancel(i.id),t.failure(new o.DetailsError(r._("download_error"),i.error)),delete c[e],p())}else delete c[e],p(),"complete"==i.state?setTimeout(function(){t.success(i.filename)},r.prefs.downloadCompleteDelay):"Aborted"==i.error?t.failure(new o.VDHError(r._("download_error"),{noReport:!0})):t.failure(new o.DetailsError(r._("download_error"),i.error))}else console.warn("Not found download",e)})};for(var t in c)e(t)}function g(){}function m(e,t){p(),e.failure(t)}t.download=function(e,t,n,a){var s=++u,l={id:s,data:e,success:t||g,failure:n||g,progress:a||g};p(),l.lastProgress=-1;var d={url:l.data.source.url,conflictAction:"uniquify",filename:l.data.target.filename,directory:l.data.target.directory,saveAs:l.data.target.saveAs||!1,incognito:!!l.data.source.isPrivate};return l.data.source.headers?d.headers=l.data.source.headers:l.data.source.referrer&&(d.headers=[{name:"Referer",value:l.data.source.referrer}]),l.data.proxy&&r.prefs.coappUseProxy&&(d.proxy=l.data.proxy),Promise.resolve(i.runtime.getBrowserInfo&&i.runtime.getBrowserInfo()||null).then(function(e){return(!e||"Firefox"!=e.name||parseInt(e.version)<=56)&&delete d.incognito,f(l.data).download(d)}).then(function(e){if(!e)return m(l,new Error(r._("aborted"))),void p();l.downloadId=e,c[l.id]=l,p()}).catch(function(e){m(l,new o.DetailsError(r._("download_error"),e.message))}),s},t.abort=function(e){c[e]&&f(c[e].data).cancel(c[e].downloadId)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(1),o=(n(17),n(61)),a=(n(116),n(117),n(39)),s=n(96),u=s.Chunkset,c=s.Codecs,l=n(263)("background/mp2t-worker.js",{name:"MP2TWorker",autoKill:6e4});t.MP2TChunkset=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.rawAppendData=i.prefs.hlsDownloadAsM2ts,n.codecs=c,n.captureRaw=i.prefs.mpegtsSaveRaw,n.captureRawStreams=i.prefs.mpegtsSaveRawStreams,n.endsOnSeenChunk=i.prefs.mpegtsEndsOnSeenChunk,n.pesTable={},n.processQueue=[],n.workerWorking=!1,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,u),r(t,[{key:"toUint8ArrayArray",value:function(e){var t=[];return function e(n){if(Array.isArray(n))for(var r=0;r<n.length;r++)e(n[r]);else n.byteLength>0&&t.push(new Uint8Array(n))}(e),t}},{key:"processChunkData",value:function(e,t){if(i.prefs.hlsDownloadAsM2ts)return t(null,e);var n=this;this.processQueue.push({data:e,callback:t}),function e(){if(!n.workerWorking){var t=n.processQueue.shift();if(t){n.workerWorking=!0;var r={processedChunksCount:n.processedChunksCount,codecs:n.codecs,pidTable:n.pidTable,pesTable:n.pesTable,pmtTable:n.pmtTable,dataOffset:n.dataOffset,nextTrackId:n.nextTrackId};l.call("processData",r,t.data).then(function(i){Object.keys(r).forEach(function(e){n[e]=i.meta[e]}),i.data&&t.callback(null,n.toUint8ArrayArray(i.data)),n.workerWorking=!1,e()},function(r){t.callback(r),n.workerWorking=!1,e()})}}}()}},{key:"finalize",value:function(e,t){this.aborted&&(e=new Error("Aborted"));var n=this;if(e)u.prototype.finalize.call(this,e,t);else if(i.prefs.hlsDownloadAsM2ts)this.waitForWrittenData(function(){o.finalize(n,null,n.downloadTarget,function(e){u.prototype.finalize.call(n,e,t)})});else{var r=1/0,s=[];if(this.walkThroughAvailPes(function(e){s.push(e),e.tsMin<r&&(r=e.tsMin)}),0==s.length)return void u.prototype.finalize.call(this,new Error("MP2T - No data received"),t);s.forEach(function(e){e.shiftTs=e.tsMin-r}),this.action&&this.action.hit&&a.setHitOperation(this.action.hit.id,"finalizing"),this.waitForWrittenData(function(){o.finalize(n,s,n.downloadTarget,function(e){u.prototype.finalize.call(n,e,t)})})}}},{key:"getTrackDuration",value:function(e){return e.durationSec?Math.round(1e3*e.durationSec):e.declaredSampleRate?Math.round(1e3*e.sampleCount/(1024*e.declaredSampleRate)):e.sampleRate?Math.round(1e3*e.sampleCount/e.sampleRate):Math.round(e.tsMax-e.tsMin)}},{key:"getTotalDuration",value:function(){var e=0;return this.walkThroughAvailPes(function(t){var n=this.getTrackDuration(t);n>e&&(e=n)}),e}},{key:"walkThroughAvailPes",value:function(e){for(var t in this.pesTable){var n=this.pesTable[t];"started"==n.state&&e.call(this,n)}}}]),t}()},function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(3),o=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.name=n.name||t,this.autoKill=void 0!==n.autoKill&&n.autoKill,this.autoKillTimer=null,this.file=t,this.callsInProgress=0,this.postFn=this.post.bind(this),this.worker=null,n.startNow&&this.ensureWorkerStarted()}return r(e,[{key:"ensureWorkerStarted",value:function(){if(!this.worker){var e=this;this.startKillTimer(),this.worker=new Worker(this.file),this.worker.onmessage=function(t){i.receive(t.data,e.postFn,e.name)}}}},{key:"post",value:function(e,t){this.ensureWorkerStarted(),this.worker.postMessage(t)}},{key:"endKillTimer",value:function(){this.autoKillTimer&&(clearTimeout(this.autoKillTimer),this.autoKillTimer=null)}},{key:"startKillTimer",value:function(){if(this.endKillTimer(),!1!==this.autoKill){var e=this;this.autoKillTimer=setTimeout(function(){e.worker.terminate(),e.worker=null},this.autoKill)}}},{key:"callEnded",value:function(){this.callsInProgress--,0===this.callsInProgress&&this.startKillTimer()}},{key:"call",value:function(){var e=this;this.callsInProgress++,this.endKillTimer();for(var t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];return i.call.apply(i,[this.postFn,this.name].concat(n)).then(function(t){return e.callEnded(),t}).catch(function(t){throw e.callEnded(),t})}}]),e}();e.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(o,[null].concat(t)))}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.decode=function(e){try{for(var t=[],n=0;n>=0&&n<e.length;){var r=i(e,n);t.push(r.value),n=r.offset}return t}catch(e){return console.error("decode error",e.message||e),null}};var r=n(17);function i(e,t,n){if(void 0===n){if(t>=e.length)throw new Error("End of structure");n=e[t]}switch(n){case 2:var o=r.ReadInt16(e,t+1);return{offset:t+3+o,value:String.fromCharCode.apply(null,e.subarray(t+3,t+3+o))};case 3:var a={};for(t+=1;9!=r.ReadInt24(e,t);){var s=(d=i(e,t-1,2)).value,u=(d=i(e,t=d.offset)).value;t=d.offset,a[s]=u}return{offset:t+3,value:a};case 8:var c=r.ReadInt32(e,t+1);a={};for(t+=5;9!=r.ReadInt24(e,t);){s=(d=i(e,t-1,2)).value,u=(d=i(e,t=d.offset)).value;t=d.offset,a[s]=u}return{offset:t+3,value:a};case 10:c=r.ReadInt32(e,t+1),a=[];t+=5;for(var l=0;l<c;l++){var d;u=(d=i(e,t)).value;t=d.offset,a.push(u)}return{offset:t,value:a};case 0:return{offset:t+9,value:new DataView(e.buffer).getFloat64(t+1)};case 1:return{offset:t+2,value:!!e[t+1]};default:throw new Error("AMF not supported type 0x"+n.toString(16))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(1),o=n(96).Chunkset,a=n(17),s=n(61),u=(n(6),n(115)),c=n(95);t.F4fChunkset=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return e.descrPrefix=i._("f4f_streaming"),n.stopDownloadingOnChunkError=!0,n.startFrag=e.startFrag,n.postFrag=e.postFrag,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,o),r(t,[{key:"download",value:function(e,t,n,r,i){var o=this;this.aborted=!1,this.action=e,this.specs=t,this.successFn=n,this.errorFn=r,this.progressFn=i,this.downloadTarget=t[0].fileName,this.chunks=[],this.processedSegmentsCount=0,this.dataSize=0,console.warn("TODO f4f hit.updateActions"),this.masked=!!e.masked,this.masked&&(this.biniv=e.biniv,this.cryptoKey=e.cryptoKey),this.openFile(function(e){if(e)return r(e);var t=new Uint8Array([70,76,86,1,5,0,0,0,9,0,0,0,0]);o.file.write(t).then(function(){o.fetchChunks(),o.recording=!0,o.handle()},function(e){r(e)})}),e.hit.abortFn=function(){o.actionAbortFn(o.downloadTarget)}}},{key:"processChunk",value:function(e,t){var n=this;e.processing=!0,n.processChunkData(e.data,function(r,i){if(r)return t.call(n,r,e);var o=i.length;n.isNotFirstDataPacket||(n.isNotFirstDataPacket=!0,a.WriteInt8(i,0,0)),n.file.write(i).then(function(){if(n.processedSegmentsCount++,n.dataSize+=o,n.processedSegmentsCount>=n.chunks.length)n.recording&&(n.recording=!1,n.finalize(null));else if(n.progressFn&&!n.aborted){var r;(r=n.action.hit.length?Math.min(Math.round(100*n.dataSize/n.action.hit.length),100):Math.round(100*n.processedSegmentsCount/(n.segmentsCount||n.chunks.length||1)))!=n.lastProgress&&n.progressFn(r),n.lastProgress=r}n.fetchChunks(),t.call(n,null,e)},function(r){t.call(n,r,e)})})}},{key:"processChunkData",value:function(e,t){for(var n=s.getTags("mdat",e),r=[],i=0;i<n.length;i++)for(var o=n[i].data,u=0;u<e.length;){var c=u,l=a.ReadInt8(o,u++),d=a.ReadInt24(o,u);u+=10;var f=o.subarray(c,u+d+4);8!=l&&9!=l||r.push(f),u+=d,u+=4}var p=s.flatten(r);t.call(this,null,p)}},{key:"fetchChunks",value:function(){if(!this.noMoreChunkToDownload)for(var e=this.action.hit;this.chunks.length-this.lastProcedIndex<=i.prefs.chunksPrefetchCount;){var t;t=i.prefs.f4fFragIndex?new URL(e._media.urlHint+"Seg1-Frag"+(this.chunks.length+this.startFrag),e.url).href:new URL(e._media.urlHint+"Seg1-Frag"+(this.chunks.length+1),e.url).href,i.prefs.f4fFragPostUrl&&(t+=this.postFrag),this.chunks.push({url:t,index:this.chunks.length})}}},{key:"openFile",value:function(e){var t=this,n=(this.action,c),r={write:!0,truncate:!0};this.masked&&(n=u,r.iv=this.biniv,r.key=this.cryptoKey),n.File.open(this.downloadTarget,r).then(function(n){t.file=n,e(null)},function(t){e(t)})}},{key:"finalize",value:function(e,t){var n=this;if(this.file&&(this.file.close(),delete this.file),this.masked&&!e){var r=u.makeFileNames(this.downloadTarget);u.finalize(this.action,r.manifestFilePath,function(e){n.action.hit._finalLocalFilePath=r.manifestFilePath,o.prototype.finalize.call(n,e,t)})}else o.prototype.finalize.call(this,e,t)}}]),t}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();var i=n(1),o=(n(95),n(96)),a=o.Chunkset,s=n(17),u=n(61),c=n(6);t.DashChunkset=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var n=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return e.descrPrefix=i._("dash_streaming"),n.endsWhenNoMoreSegment=!0,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,a),r(t,[{key:"processChunkData",value:function(e,t){this.chunkIndex=(this.chunkIndex||0)+1;var n=0,r=u.getTags("moof",e);if(r.length<1)return t(new Error("No moof in fragment"));var i=r[0].offset,a=u.getTags("mfhd",r[0].data);if(a.length<1)return t(new Error("No mfhd in fragment"));var c=s.ReadInt32(a[0].data,4);this.seqNum=c;var l=0;for(var d in this.esis)this.esis[d].sampleGroups=[];for(var f=u.getTags("traf",r[0].data),p=0,h=f.length;p<h;p++){var g=f[p],m=u.getTags("tfhd",g.data);if(m.length<1)return t(new Error("No tfhd in track fragment"));var v=m[0].data,y=s.ReadInt32(v,4);y>=this.nextTrackId&&(this.nextTrackId=y+1);var b=this.esis[y]=this.esis[y]||{trackId:y,dataOffsets:[],dataSizes:[],keyFrames:[],sampleGroups:[],sampleCount:0,chunkNumber:0,sampleSizes:[],duration:0,streamType:this.init.streamTypes[y]};if(this.mpd.codecs){var w=this.mpd.codecs.split(",");if(y<=w.length)for(var k in o.Codecs){var x=o.Codecs[k];0==w[y-1].indexOf(x.strTag)&&(b.codecId=k,b.codec=x,b.streamType=x.type)}}var A=(1&(q=s.ReadInt24(v,1)))>>>0,_=(2&q)>>>1>>>0,O=(8&q)>>>3>>>0,I=(16&q)>>>4>>>0,P=(32&q)>>>5>>>0;b.durationIsEmpty=(65536&q)>>>16>>>0;var C=(131072&q)>>>17>>>0,S=8;A?(l=s.ReadInt64(v,S)-this.globalOffset,S+=8):(C||0==l)&&(l=i),_&&(b.sampleDescriptionIndex=s.ReadInt32(v,S),S+=4),O&&(b.defaultSampleDuration=s.ReadInt32(v,S),S+=4),I&&(b.defaultSampleSize=s.ReadInt32(v,S),S+=4),P&&(b.defaultSampleFlags=s.ReadInt32(v,S),S+=4);for(var E=u.getTags("trun",g.data),j=0,D=E.length;j<D;j++){var R=E[j],T={s:0,o:0,d:0};b.sampleGroups.push(T);var q,M=R.data,F=1&(q=s.ReadInt24(M,1)),U=(4&q)>>>2>>>0,L=(256&q)>>>8>>>0,N=(512&q)>>>9>>>0,W=(1024&q)>>>10>>>0,z=(2048&q)>>>11>>>0,H=s.ReadInt32(M,4),V=8;if(F){var K=s.ReadInt32(M,V);V+=4,T.o=l+K}else 0==l&&(T.o=l);if(U){s.ReadInt32(M,V);V+=4}for(var B=0;B<H;B++){var J={};L?(J.d=s.ReadInt32(M,V),V+=4):J.d=b.defaultSampleDuration,N?(J.s=s.ReadInt32(M,V),V+=4):J.s=b.defaultSampleSize,W?(J.f=s.ReadInt32(M,V),V+=4):J.f=b.defaultSampleFlags,33554432&J.f&&b.keyFrames.push(b.sampleCount+B),z&&(J.C=s.ReadInt32(M,V),V+=4),T.s+=J.s,T.d+=J.d,b.sampleSizes.push(J.s),b.duration+=J.s,b.stts=b.stts||[],0==b.stts.length||b.stts[b.stts.length-1].d!=J.d?b.stts.push({c:1,d:J.d}):b.stts[b.stts.length-1].c++}T.c=H,l=T.o+T.s,b.sampleCount+=H,b.stsc=b.stsc||[],0!=b.stsc.length&&b.stsc[b.stsc.length-1].samples_per_chunk==H||b.stsc.push({first_chunk:b.chunkNumber,samples_per_chunk:H,sample_description_index:0}),b.chunkNumber++}}this.globalOffset+=e.length;var Z=[];for(var d in this.esis){b=this.esis[d];for(var Y=0;Y<b.sampleGroups.length;Y++){T=b.sampleGroups[Y];Z.push(e.subarray(T.o,T.o+T.s)),b.dataOffsets.push({b:this.chunkIndex-1,o:n}),b.dataSizes.push(T.s),this.dataOffset+=T.s,n+=T.s}}t.call(this,null,Z)}},{key:"getTrackDuration",value:function(e){return this.getTotalDuration()}},{key:"getTotalDuration",value:function(){return Math.round(1e3*this.mpd.duration)}},{key:"finalize",value:function(e,n){var r=this,i=[];for(var o in this.esis){var a=this.esis[o];i.push(a)}var s=this,c=function(){for(var e,n=arguments.length,i=Array(n),o=0;o<n;o++)i[o]=arguments[o];(e=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0}(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"finalize",r)).call.apply(e,[r].concat(i))}.bind(this);this.waitForWrittenData(function(){u.finalize(s,i,s.downloadTarget,function(e){c(e,n)})})}},{key:"handleInitSegment",value:function(e){if(this.mpd=e,this.init={},this.segmentsCount=e.segments.length,e.init_segment)try{var t;t="string"==typeof e.init_segment?utils.toByteArray(e.init_segment):e.init_segment,this.globalOffset=t.length;var n=u.getTags("ftyp",t);this.init.ftyp=n[0].data;var r=u.getTags("moov",t);this.init.stsd={},this.init.tkhd={},this.init.vmhd={},this.init.smhd={},this.init.edts={},this.init.hdlr={},this.init.streamTypes={},this.init.mdhd={},this.init.dinf={},this.init.edts={},this.timeScale={};var i=u.getTags("mvhd",r[0].data);this.init.mvhd=i[0].data,this.init.timescale=s.ReadInt32(i[0].data,12),this.init.duration=s.ReadInt32(i[0].data,16),0==this.init.duration&&(this.init.duration=Math.round((e.duration||0)*this.init.timescale),s.WriteInt32(i[0].data,16,this.init.duration));var o=u.getTags("iods",r[0].data);o.length>0&&(this.init.iods=o[0].data);for(var a=u.getTags("trak",r[0].data),c=0;c<a.length;c++){var l=a[c],d=u.getTags("tkhd",l.data),f=s.ReadInt32(d[0].data,12),p=d[0].data;this.init.tkhd[f]=p;var h=s.ReadInt32(p,20);0==h&&(h=this.init.duration,s.WriteInt32(p,20,h));var g=u.getTags("edts",l.data);g.length>0&&(this.init.edts[f]=g[0].data);var m=u.getTags("mdia",l.data),v=u.getTags("hdlr",m[0].data);this.init.hdlr[f]=v[0].data;var y=s.ReadInt32(this.init.hdlr[f],8);this.init.streamTypes[f]=1936684398===y?"audio":1986618469===y?"video":void 0;var b=u.getTags("dinf",m[0].data);b.length>0&&(this.init.dinf[f]=b[0].data);var w=u.getTags("minf",m[0].data),k=u.getTags("mdhd",m[0].data)[0].data;this.init.mdhd[f]=k;var x=s.ReadInt32(k,16),A=s.ReadInt32(k,12);this.timeScale[f]=A,0==x&&(x=Math.round(this.init.duration*A/this.init.timescale),s.WriteInt32(k,16,x));var _=u.getTags("vmhd",w[0].data);_.length>0&&(this.init.vmhd[f]=_[0].data);var O=u.getTags("smhd",w[0].data);O.length>0&&(this.init.smhd[f]=O[0].data);var I=u.getTags("stbl",w[0].data),P=u.getTags("stsd",I[0].data);this.init.stsd[f]=P[0].data}}catch(e){console.warn("Error decoding DASH init segment")}}},{key:"download",value:function(e,t,n,r,i){var o=this;this.action=e,this.downloadTarget=t[0].fileName,function(t,n,r,i,a,s){var u=new URL(e.hit._mpdCommonBaseUrl,e.hit.url||e.hit.audioUrl).href;u=new URL(t.base_url,u).href,n&&(o.masked=!!e.masked,o.masked&&(o.biniv=e.biniv,o.cryptoKey=e.cryptoKey)),o.downloadFile(r,t,u,i,a,s)}(e.hit._mpd||e.hit.audioMpd,!0,t[0].fileName,n,r,i),e.abortChunked=function(){o.actionAbortFn()}}},{key:"downloadFile",value:function(e,t,n,r,i,o){var a=this;this.aborted=!1,this.successFn=r,this.errorFn=i,this.progressFn=o,this.downloadTarget=e,this.dataOffset=0,this.nextTrackId=1,this.chunks=[],this.dataOffset=0,this.globalOffset=0,this.esis={},this.seqNum=0,this.processedSegmentsCount=0,"string"==typeof t.init_segment&&(t.init_segment=c.toByteArray(t.init_segment)),this.handleInitSegment(t),this.mpd.segments.forEach(function(e){var t=new URL(e.url,n).href;a.chunks.push({url:t,index:a.chunks.length})}),u.writeFileHeader(this,function(e){e?i(e):(a.recording=!0,a.handle())})}}]),t}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),i=function e(t,n,r){null===t&&(t=Function.prototype);var i=Object.getOwnPropertyDescriptor(t,n);if(void 0===i){var o=Object.getPrototypeOf(t);return null===o?void 0:e(o,n,r)}if("value"in i)return i.value;var a=i.get;return void 0!==a?a.call(r):void 0};function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}t.handle=function(e){var t=v.exec(e.topUrl);if(!t)return!1;var n=t[1];if(e.referrer&&e.referrer.indexOf(n)<0)return console.error("Wrong referrer"),!1;var r=decodeURIComponent(t[2]),i=k[r],o=i&&i.ids[n],a=Object.assign({},e,{title:o.title,thumbnail:o.thumbnailUrl},i.hitData);a.extension=i.extension||a.extension,l.getHit(e.id)?f.update(e.id,a):(e=Object.assign({},e,a),l.dispatch("hit.new",e),d.execute("quickdownload",e));return A(r,n),!0},t.isBulkDetector=_;var u=n(1),c=u.browser,l=n(13),d=n(59),f=n(39),p=n(6),h=n(62),g=n(60),m=n(10).buildOptions.noyt||!1,v=new RegExp("^https://www.youtube.com/watch\\?.*\\bv=([^&]+).*&vdh-bulk=([^&]+)"),y=p.Concurrent(),b={};function w(e){return c.tabs.query({}).then(function(t){var n=null;return t.every(function(t){var r=v.exec(t.url);return!r||decodeURIComponent(r[2])!=e||(n=t,!1)}),n})}var k={};function x(e,t){var n=k[e];if(!n||n.aborted)return Promise.resolve();var r=new Promise(function(e,t){n.resolve=e,n.reject=t});return n.timer=setTimeout(function(){console.error("Timeout collecting info on video",t),A(e,t)},6e4),h.getVideoMeta(t).then(function(r){if(!r)throw new Error("no metadata for bulk video");return n.ids[t]=r,function(e,t){var n="https://www.youtube.com/watch?v="+t+"&version=3&vq=auto&vdh-bulk="+encodeURIComponent(e);return w(e).then(function(e){return e?new Promise(function(t,r){c.tabs.update(e.id,{url:n}).then(t,r)}):c.tabs.create({url:n,active:!1}).then(function(e){return b[e.id]=1,c.tabs.update(e.id,{muted:!0})})})}(e,t)}).catch(function(n){console.error("DoBulkDownload !!!",n),A(e,t)}).then(function(){return r})}function A(e,t){var n=k[e];if(n){if(n.ids[t]){n.timer&&(clearTimeout(n.timer),delete n.timer);var r=n.resolve;if(delete n.resolve,delete n.reject,delete n.ids[t],n.count>0){var i=Math.round(100*(n.count-Object.keys(n.ids).length)/n.count);f.updateProgress(e,i)}if(0===Object.keys(n.ids).length||n.aborted){delete k[e],w(e).then(function(e){e&&(delete b[e.id],c.tabs.remove(e.id))});var o=n.actionResolve;o&&(delete n.actionResolve,o())}r()}}else console.error("Bulk not found")}function _(e){return v.test(e)}u.rpc.listen({tbvwsSelectedIds:function(e){var t=[],n=l.getHits();if(Object.keys(n).forEach(function(r){var i=n[r];"tbvws-bulk"!=i.from||i.topUrl!=e.topUrl||i.running||t.push(i.id)}),t.length>0&&l.dispatch("hit.delete",t),e.ids.length>0){var r={id:"tbvws-bulk:"+Math.floor(1e9*Math.random()),title:u._("selected_media"),descrPrefix:u._("bulk_n_videos",""+e.ids.length),from:"tbvws-bulk",ids:e.ids,pageUrl:e.pageUrl,topUrl:e.topUrl,thumbnailUrl:c.extension.getURL("/content/images/tbvws.png")};l.dispatch("hit.new",r)}}}),setTimeout(function(){var e=function(e){function t(){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,d.DownloadAction),r(t,[{key:"doJob",value:function(){var e=this;f.update(this.hit.id,{operation:"collecting",opStartDate:Date.now()});var t=Object.assign({aborted:!1,count:this.hit.ids.length,ids:{}},e.bulkExtra||{});k[this.hit.id]=t;var n=new Promise(function(n,r){t.actionResolve=n,t.actionReject=r,e.setAbort(function(){t.aborted=!0,r(new p.VDHError("Aborted",{noReport:!0}))})});return this.hit.ids.forEach(function(n){var r,i;t.ids[n]={title:"bulk-downloaded"},r=e.hit.id,i=n,y(function(){return x(r,i)}).catch(function(e){console.error("BulkDownload !!!",e.message)})}),n}},{key:"getReqs",value:function(){if(m&&h.matchHit(this.hit))return h.forbidden(),Promise.reject(new p.VDHError("Forbidden",{noReport:!0}));this.reqs.coapp=!0,this.reqs.coappMin="1.2.1"}},{key:"postJob",value:function(){}},{key:"cleanup",value:function(){return this.clearAbort(),l.dispatch("hit.delete",this.hit.id),i(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"cleanup",this).call(this)}}],[{key:"canPerform",value:function(e){return!(e.running>0)&&"tbvws-bulk"==e.from}},{key:"name",get:function(){return"bulkdownload"}},{key:"title",get:function(){return u._("action_bulkdownload_title")}},{key:"description",get:function(){return u._("action_bulkdownload_description")}},{key:"icon",get:function(){return"images/icon-action-quick-download2-64.png"}},{key:"priority",get:function(){return 300}},{key:"catPriority",get:function(){return 2}}]),t}();d.register(e);var t=function(t){function n(){return o(this,n),a(this,(n.__proto__||Object.getPrototypeOf(n)).apply(this,arguments))}return s(n,e),r(n,[{key:"getReqs",value:function(){var e=this,t=this;return Promise.resolve().then(function(){var t="dlconv#"+e.hit.id;return u.openedContents().indexOf("main")>=0?u.rpc.call("main","embed",c.extension.getURL("content/dlconv-embed.html?nosaveas=1&panel="+t)).then(function(){return u.wait(t)}).catch(function(e){throw new p.VDHError("Aborted",{noReport:!0})}):g.getOutputConfigs().then(function(e){var t=u.prefs.dlconvLastOutput||"05cb6b27-9167-4d83-833d-218a107d0376",n=e[t];if(!n)throw new Error("No such output configuration");return{outputConfigId:t,outputConfig:n}})}).then(function(e){u.prefs.dlconvLastOutput=e.outputConfigId;var n=e.outputConfig;t.hit.convert=n,t.bulkExtra={hitData:{convert:n}};var r=n.ext||n.params.f;r&&(t.bulkExtra.extension=r)}).then(function(){return i(n.prototype.__proto__||Object.getPrototypeOf(n.prototype),"getReqs",e).call(e)})}}],[{key:"canPerform",value:function(e){return!(e.running>0)&&"tbvws-bulk"==e.from}},{key:"name",get:function(){return"bulkdownloadconvert"}},{key:"title",get:function(){return u._("action_bulkdownloadconvert_title")}},{key:"description",get:function(){return u._("action_bulkdownloadconvert_description")}},{key:"icon",get:function(){return"images/icon-action-download-convert-64.png"}},{key:"priority",get:function(){return 80}},{key:"keepOpen",get:function(){return!0}}]),n}();d.register(t)},0);var O=function(e){var t=!1;return b[e.tabId]&&(e.url.indexOf("googleads")>=0||e.url.indexOf("pagead")>=0||e.url.indexOf("doubleclick")>=0||e.url.indexOf("get_video_info")>=0)&&(t=!0),{cancel:t}},I=!1;function P(){return c.tabs.query({}).then(function(e){return!e.every(function(e){return!_(e.url)})})}c.tabs.onUpdated.addListener(function(e){b[e]&&!I&&P().then(function(e){e&&!I&&(I=!0,c.webRequest.onBeforeRequest.addListener(O,{urls:["<all_urls>"]},["blocking"]))})}),c.tabs.onRemoved.addListener(function(){I&&P().then(function(e){e||(I=!1,c.webRequest.onBeforeRequest.removeListener(O))})}),c.runtime.getBackgroundPage().then(function(e){c.tabs.query({}).then(function(e){e.forEach(function(e){v.exec(e.url)&&c.tabs.remove(e.id)})})})},function(e,t,n){"use strict";var r=n(1),i=(r.browser,n(94));t.newDownload=function(){var e=r.prefs.downloadCount;e++,r.prefs.downloadCount=e,e>0&&e%100==0&&(Math.round(Date.now()/1e3)<r.prefs.donateNotAgainExpire||i.checkLicense().then(function(e){e&&"accepted"==e.status||r.ui.open("funding",{type:r.prefs.alertDialogType,url:"content/funding.html",height:550})}))},r.rpc.listen({fundingLater:function(){r.prefs.donateNotAgainExpire=Math.round(Date.now()/1e3)+2592e3}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=r||[];r.push(["_setAccount","UA-1041911-53"]),function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://ssl.google-analytics.com/ga.js";var t=document.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)}();var i=new RegExp("//([^:/]*)"),o=new RegExp("([^\\.]+).(?:co\\.)?[^\\.]+$");t.downloadSuccess=function(e){if(!(Math.floor(100*Math.random())>0))try{var t=i.exec(e.topUrl)[1],n=i.exec(e.url||e.mediaManifest||e.videoUrl||e.audioUrl||e.masterManifest||e.baseUrl)[1],a=t+"/";e.isPrivate&&(a+="P");try{o.exec(t)[1]==o.exec(n)[1]&&(a+="H")}catch(e){}r.push(["_trackEvent","Video","download",a])}catch(e){}},t.downloadError=function(e,t){try{var n=i.exec(e.topUrl)[1];r.push(["_trackEvent","Video","fail",n+":"+(t||"UNSPECIFIED")])}catch(e){}},t.blacklistAdded=function(e){try{r.push(["_trackEvent","Blacklist","added",e])}catch(e){}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.icons=function(e){return e},n(233)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.updateHits=b,t.ExecuteDefault=w;var r=n(92),i=n(1),o=i.browser,a=n(59),s=n(13),u=n(6),c=n(240),l=n(63),d=n(40),f=new RegExp("(\\d+)x(\\d+)"),p=o.menus||o.contextMenus;function h(e,t){if(e.bitrate&&t.bitrate&&e.bitrate!=t.bitrate)return t.bitrate-e.bitrate;var n=f.exec(e.size);if(n){var r=f.exec(t.size);if(r&&(n[1]!=r[1]||n[2]!=r[2]))return parseInt(r[1])*parseInt(r[2])-parseInt(n[1])*parseInt(n[2])}return 0}function g(e){if(e.description)return e.description;var t,n,r,o,a=[];if(e.descrPrefix&&a.push(e.descrPrefix),e.adp&&a.push("ADP"),e.size&&a.push(e.size),e.duration&&a.push((t=e.duration,n=Math.floor(t/3600),r=Math.floor(t%3600/60),o=t%60,n>0?n+":"+("00"+r).substr(-2)+":"+("00"+o).substr(-2):r+":"+("00"+o).substr(-2))),e.quality){var s=i._("quality_"+e.quality);""==s&&(s=e.quality.toUpperCase()),a.push(s)}if(e.tbsnQuality){var u=i._("tbsn_quality_"+e.tbsnQuality);""==u&&(u=e.tbsnQuality.toUpperCase()),a.push(u)}if(e.bitrate){var c=e.bitrate,l="bps";e.bitrate>1e7?(l="Mbps",c=Math.round(e.bitrate/1e6)):e.bitrate>1e6?(l="Mbps",c=Math.round(e.bitrate/1e5)/10):e.bitrate>1e4?(l="Kbps",c=Math.round(e.bitrate/1e3)):e.bitrate>1e3&&(l="Kbps",c=Math.round(e.bitrate/100)/10),a.push(c+l)}var d=function(e){return e.length?e.length>1048576?i._("MB",[Math.round(10*e.length/1048576)/10]):e.length>1024?i._("KB",[Math.round(10*e.length/1024)/10]):i._("Bytes",[e.length]):null}(e);return d&&a.push(d),e.mediaDomain&&a.push(i._("from_domain",[e.mediaDomain])),"audio"==e.type&&a.push(i._("audio_only")),e.extension&&(e.originalExt&&e.originalExt!=e.extension&&a.push(e.originalExt.toUpperCase()+">"+e.extension.toUpperCase()),a.push(e.extension.toUpperCase())),a.join(" - ")}var m=[],v=null,y=u.Concurrent();function b(e){v=null;var t={};Object.keys(e).map(function(t){return e[t]}).filter(function(e){return"active"==e.status}).forEach(function(e){var n=e.group||e.id;void 0===t[n]&&(t[n]=[]),t[n].push(e)});var n=[],s=a.describeAll();function u(e){return new Promise(function(t,n){p.create(e,function(){t()})})}Object.keys(t).forEach(function(e){var r=t[e];r[0].urls?n.push({id:e,title:r[0].title}):(r.sort(h),n.push({id:"group-"+e,title:r[0].title,enabled:!1}),r.forEach(function(e){v||(v=e.id),n.push({id:e.id,title:g(e),icons:{18:"content/"+s[e.actions[0]].icon18}})}))}),0==n.length&&n.push({id:"vdh-no-media",title:i._("no_media_current_tab"),enabled:!1}),n.push({id:"separator",type:"separator"}),n.push({id:"vdh-smartnaming",title:i._("smartnaming_rule")}),n.push({id:"separator2",type:"separator"}),n.push({id:"vdh-settings",title:i._("settings"),icons:{64:"content/images/icon-settings-64.png"}}),n.push({id:"vdh-about",title:i._("about"),icons:{64:"content/images/icon-about-64.png"}}),n.push({id:"vdh-sites",title:i._("supported_sites"),icons:{64:"content/images/icon-sites-list-64.png"}}),n.push({id:"vdh-convert",title:i._("convert_local_files"),icons:{64:"content/images/icon-action-convert-b-64.png"}}),n.push({id:"vdh-merge",title:i._("merge_local_files"),icons:{64:"content/images/icon-merger-64.png"}}),n.push({id:"vdh-analyze",title:i._("analyze_page"),icons:{64:"content/images/icon-photo-64.png"}}),i.prefs.contextMenuEnabled||i.isBrowser("firefox")&&i.prefs.toolsMenuEnabled?r(n,m)||(m=n,y(function(){return p.removeAll().then(function(){var e=[];return i.prefs.contextMenuEnabled&&e.push(u({id:"vdh-main",title:i._("title"),contexts:["all"]}).then(function(){return Promise.all(n.map(function(e){var t=Object.assign({parentId:"vdh-main"},e);return o.menus||(delete t.icons,(t.contexts||[]).indexOf("selection")<0&&(t.contexts=(t.contexts||[]).concat(["all"]))),u(t)}))})),i.isBrowser("firefox")&&i.prefs.toolsMenuEnabled&&e.push(u({id:"vdh-main-tools",title:i._("title"),contexts:["tools_menu"]}).then(function(){return Promise.all(n.map(function(e){return u(Object.assign({parentId:"vdh-main-tools"},e,{id:e.id+"-tools"}))}))})),Promise.all(e)})})):m.length&&(p.removeAll(),m=[])}function w(){if(v){var e=s.getHit(v);e&&a.execute(e.actions[0],e)}}b({}),i.prefs.on("contextMenuEnabled",function(){b(s.getHits())}),i.prefs.on("toolsMenuEnabled",function(){b(s.getHits())}),p.onClicked.addListener(function(e,t){switch(e.menuItemId){case"vdh-settings":case"vdh-settings-tools":i.ui.open("settings",{type:"tab",url:"content/settings.html"});break;case"vdh-about":case"vdh-about-tools":i.ui.open("about",{type:"panel",url:"content/about.html"});break;case"vdh-sites":case"vdh-sites-tools":d.gotoOrOpenTab("https://www.downloadhelper.net/sites");break;case"vdh-convert":case"vdh-convert-tools":a.convertLocal();break;case"vdh-merge":a.mergeLocal();break;case"vdh-analyze":case"vdh-analyze-tools":c.analyzePage();break;case"vdh-smartnaming":case"vdh-smartnaming-tools":l.defineInPage();break;default:var n=/^(.*)\-tools$/.exec(e.menuItemId),r=s.getHit(n&&n[1]||e.menuItemId);r&&a.execute(r.actions[0],r)}}),o.commands.onCommand.addListener(function(e){"default-action"==e&&w()})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{!r&&s.return&&s.return()}finally{if(i)throw o}}return n}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();t.networkHook=function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2];var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!o.prefs.tbsnEnabled)return null;return c.test(e)?new Promise(function(t,n){u.request({url:e,onComplete:function(e){var r=f(e.text);r&&t(new d(r))||n(new Error("Manifest not avail"))}})}):l.test(e)&&n&&!/_vdh_/.test(e)?a.tabs.executeScript(t.tabId,{code:'var _wehPanelName = "tbsn";'}).then(function(){return a.tabs.executeScript(t.tabId,{file:"/content/tbsn-script.js"})}).then(function(){return a.tabs.sendMessage(t.tabId,{type:"vdhPostRequest",url:e,formData:n})}).then(function(e){var t=f(e);if(t)return new d(t);throw new Error("Manifest not avail")}):null};var o=n(1),a=o.browser,s=n(13),u=n(6),c=new RegExp("^https?://[^/]*\\.facebook\\.com/ajax/pagelet/generic\\.php/LitestandTailLoadPagelet"),l=new RegExp("^https?://[^/]*\\.facebook\\.com/video/tahoe/async/"),d=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.data=t,this.dashProbes=[]}return i(e,[{key:"handleHit",value:function(e){this.data.forEach(function(t){u.request({url:"https://www.facebook.com/plugins/post/oembed.json/?url="+encodeURIComponent(new URL(t.video_url,"https://www.facebook.com").href),onComplete:function(n){var i="https://graph.facebook.com/"+t.video_id+"/picture?type=small";u.request({url:i,onComplete:function(o){var a=200==n.status&&n.json&&n.json.author_name||"Facebook";if(200!==o.status&&(i=null),[[t.hd_src_no_ratelimit||t.hd_src,"hd"],[t.sd_src_no_ratelimit||t.sd_src,"sd"]].forEach(function(n){var o=r(n,2),c=o[0],l=o[1];if(c){var d=Object.assign({},e,{id:"tbsn:"+u.hashHex(c),group:"tbsn:"+t.video_id,url:c,title:a,tbsnQuality:l,extension:"mp4",thumbnailUrl:i});s.dispatch("hit.new",d)}}),t.dash_manifest){var c={video:[],audio:[]};(new DOMParser).parseFromString(t.dash_manifest,"application/xml").querySelectorAll("Representation").forEach(function(e){e.getAttribute("mimeType").startsWith("audio")?c.audio.push(e):c.video.push(e)}),c.video.sort(function(e,t){return parseInt(e.getAttribute("width"))*parseInt(e.getAttribute("height"))-parseInt(t.getAttribute("width"))*parseInt(t.getAttribute("height"))}),c.audio.sort(function(e,t){return parseInt(e.getAttribute("audioSamplingRate"))-parseInt(t.getAttribute("audioSamplingRate"))});var l=c.audio.length>0&&c.audio[0].querySelector("BaseURL").textContent||null,d=c.audio.length>0&&parseInt(c.audio[0].getAttribute("bandwidth"))||0;c.video.forEach(function(n){var r=/vp[1-9]+/.test(n.getAttribute("codecs")),o=n.querySelector("BaseURL").textContent,c=Object.assign({},e,{id:"tbsn-dash:"+u.hashHex(o),group:"tbsn:"+t.video_id,bitrate:parseInt(n.getAttribute("bandwidth"))+d,size:n.getAttribute("width")+"x"+n.getAttribute("height"),title:a,extension:r?"webm":"mp4",thumbnailUrl:i});delete c.url,l?(c.audioUrl=l,c.videoUrl=o,c.adp=!0,c.extension=r?"mkv":"mp4"):c.url=o,s.dispatch("hit.new",c)})}}})}})})}}]),e}();function f(e){var t,n=[],r=new RegExp('"videoData"\\s*:\\s*(\\[\\{.*?\\}\\])',"gm");do{if(t=r.exec(e))try{n=n.concat(JSON.parse(t[1]))}catch(e){console.info("Failed parsing videoData",t[1])}}while(t);return n}}]); "
Extensiones 2.jpg

mig

unread,
Feb 23, 2021, 1:10:25 PM2/23/21
to Video DownloadHelper Q&A
Many thanks for the feedback. Unfortunately, it does not contain the information i was hoping to get.

What is happening is that Google just closed the service that handles purchases in Chrome extensions. We replaced this in version 7.5.0.0 with  our own licensing system that we used for Firefox and Edge. For details, check https://www.downloadhelper.net/chrome-licenses

To move on, i suggest that i refund your (old) VDH/Chrome license and you purchase one with the new system (from https://www.downloadhelper.net/convert ). So no Google black box anymore and we keep control of licenses. If this is OK with you, can you send me the reference of the December purchase so i can locate and refund it ?
Reply all
Reply to author
Forward
0 new messages