(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
"use strict";var _message=require(5),_videoDownload=require(4),_dom=require(3);"/"==window.location.pathname?setInterval(function(){"/watch"==window.location.pathname&&window.location.reload()},1e3):!function(){var e=function(){var e=(0,_dom.$)("video");e&&e.addEventListener("loadstart",r),r(),document.addEventListener("click",function(e){v&&e.target!==v&&e.target!==m&&v.classList.remove("open")},!0)},o=function(){(0,_dom.removeNodeFromParent)(v),(0,_dom.removeNodeFromParent)(m),(0,_dom.removeNodeFromParent)(w)},n=function(e){function o(e){var o=e.target,n=o.getAttribute("data-seq");if(null!==n){var t=r[n],a=i[n],d=s[n].quality,c=s[n].downloadPlugin;(0,_message.sendMessageAsync)(_videoDownload.MSG_EVENT_VIDEO_DOWNLOAD_CHROME_DOWNLOAD,{filename:t,url:a,href:location.href,quality:d,downloadPlugin:c},{noReply:1})}}var n=e.title,i=[],r=[],s=e.files.sort(function(e,o){return t(o)-t(e)});d(),w.innerHTML=s.map(function(e,o){return i[o]=""+e.link,r[o]=n+"_("+e.width+"x"+e.height+")."+e.format,'<p data-seq="'+o+'" class="download-item" title="'+u(e)+'">\n                    '+e.quality+" ("+e.format+')\n                    <span class="'+a(e)+' icon"></span>\n                  </p>'}).join("")+l(),w.onclick=o},t=function f(e){var f=0,o=(e.quality.match(/^\d+/)||[0])[0]/1e4;return e.acodec&&(f+=1),e.vcodec&&(f+=2),f+o},a=function(e){return e.acodec?e.vcodec?"hide":"icon-music":"icon-mute"},i=function(e,o){o.classList.contains(e)?o.classList.remove(e):o.classList.add(e)},d=function(){var e,n=(0,_dom.$)("#watch-header");(0,_dom.$)(".wow-video-downloader-holder",n)||(m=document.createElement("div"),w=document.createElement("div"),v=document.createElement("div"),n.insertBefore(m,(0,_dom.$)("#watch7-user-header",n)),n.appendChild(v),v.innerHTML='<div class="arrow"></div>',v.appendChild(w),v.className="wow-video-downloader-list-holder",w.className="wow-video-downloader-list",m.classList.add("wow-video-downloader-holder"),m.innerHTML='<button class="download-btn">\n            <span>'+c("downloadBtn")+'</span><span class="icon-close icon"></span>\n        </button>',e=(0,_dom.$)(".download-btn",m),m.onclick=function(n){n.target.classList.contains("icon-close")?o():(i("open",v),e.classList.remove("wow-video-downloader-shadow"))},setTimeout(function(){e.classList.add("wow-video-downloader-shadow")},1e3))},r=function _(){if(!(0,_dom.$)("#eow-title"))return setTimeout(_,1e3);var e=s();e&&(0,_message.sendMessageAsync)(_videoDownload.MSG_EVENT_VIDEO_DOWNLOAD_CRAWL_URL,{url:window.location.href}).then(n)},s=function(){var e=location.search.match(/v=([\w-]+)[$&]?/);return e?e[1]:null},c=function h(e){if(h[e])return h[e];var o=chrome.i18n.getMessage(e);return o?h[e]=o:void 0},l=function(){return'<p class="support">'+c("powerBy")+' \n                    <a href="http://www.vidmate.mobi/?from=UC_PC" target="_blank">Vidmate</a>\n                </p>'},u=function(e){return e.acodec?e.vcodec?"":c("pureAudio"):c("muteVideo")};(0,_message.sendMessageAsync)(_videoDownload.MSG_EVENT_PAGE_INJECTION_ENABLED,{url:location.href}).then(function(o){var n=o.enabled;n&&e()});var m=void 0,w=void 0,v=void 0}();


},{"3":3,"4":4,"5":5}],2:[function(require,module,exports){
"use strict";function defer(){var e=void 0,r=void 0,n=new Promise(function(n,o){e=n,r=o});return{resolve:function(r){e(r)},reject:function(e){r(e)},promise:n}}exports.defer=defer;


},{}],3:[function(require,module,exports){
"use strict";function $(e,o){return e instanceof HTMLElement?e:(o||document).querySelector(e)}function _$(e,o){return(o||document).shadowRoot.querySelector(e)}function _$$(e,o){return slice.call((o||document).shadowRoot.querySelectorAll(e))}function $$(e,o){return slice.call((o||document).querySelectorAll(e))}function toggleClass(e,o,t){var r=2==arguments.length?e.classList.contains(o):!t;e.classList[r?"remove":"add"](o)}function removeNodeFromParent(e){return e&&e.parentNode?(e.parentNode.removeChild(e),!0):!1}exports.$=$,exports._$=_$,exports._$$=_$$,exports.$$=$$,exports.toggleClass=toggleClass,exports.removeNodeFromParent=removeNodeFromParent;var slice=Array.prototype.slice;


},{}],4:[function(require,module,exports){
"use strict";var MSG_EVENT_VIDEO_DOWNLOAD_CRAWL_URL=exports.MSG_EVENT_VIDEO_DOWNLOAD_CRAWL_URL="VD-crawl-url",MSG_EVENT_VIDEO_DOWNLOAD_CHROME_DOWNLOAD=exports.MSG_EVENT_VIDEO_DOWNLOAD_CHROME_DOWNLOAD="VD-chrome-download",MSG_EVENT_VIDEO_DOWNLOAD_EXTERNAL_CRAWL_URL=exports.MSG_EVENT_VIDEO_DOWNLOAD_EXTERNAL_CRAWL_URL="VD-external-crawl-url",MSG_EVENT_PAGE_INJECTION_ENABLED=exports.MSG_EVENT_PAGE_INJECTION_ENABLED="page-injection-enabled",MSG_EVENT_WOW_DOWNLOAD_IMAGES=exports.MSG_EVENT_WOW_DOWNLOAD_IMAGES="wow-download-images",MSG_EVENT_WOW_IMAGE_DOWNLOAD_FORMAT=exports.MSG_EVENT_WOW_IMAGE_DOWNLOAD_FORMAT="wow-download-image-format";


},{}],5:[function(require,module,exports){
"use strict";function sendMessageAsync(e,r){var t=arguments.length<=2||void 0===arguments[2]?{}:arguments[2],n=t.noReply,o=t.extId,s={type:e,data:r,sync:!1,noReply:n,d:"req"};if(n)return sendMsg(o,s),Promise.resolve();var c=guid(),d=(0,_defer.defer)();return s.guid=c,deferCache[c]=d,sendMsg(o,s),d.promise["catch"](noop)}function initPort(){deferCache=Object.create(null);try{extPort=chrome.runtime.connect({name:"page:connect"}),extPort.onMessage.addListener(onMsg),extPort.onDisconnect.addListener(function(){disposePort(),setTimeout(initPort,0)})}catch(e){console.log(e)}}function disposePort(){for(var e in deferCache){var r=deferCache[e];r&&r.reject&&r.reject("disconnect")}deferCache=Object.create(null),extPort=null}function onMsg(e){var r=e.guid,t=e.d,n=deferCache[r];if("postTab"===t){var o=bkMsgHandlers[e.type];o&&o(e.data)}else n&&"res"===t&&(e.success?n.resolve(e.data):n.reject(e.error),delete deferCache[r])}function registerMsgHandler(e,r){"function"==typeof r&&(bkMsgHandlers[e]=r)}function sendMsg(e,r){if(e&&r)throw Error("not support external");r&&(extPort?extPort.postMessage(r):chrome.runtime.sendMessage(r))}function noop(){}function guid(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+Date.now()}exports.sendMessageAsync=sendMessageAsync,exports.registerMsgHandler=registerMsgHandler;var _defer=require(2),deferCache=void 0,bkMsgHandlers=Object.create(null),extPort=void 0;"object"==typeof chrome&&chrome.runtime&&chrome.runtime.onMessage&&chrome.runtime.onMessage.addListener(onMsg),window.addEventListener("unload",function(){extPort.disconnect(),disposePort()}),initPort();


},{"2":2}]},{},[1]);
