window.requestFileSystem||(window.requestFileSystem=window.webkitRequestFileSystem);window.BlobBuilder||(window.BlobBuilder=window.WebKitBlobBuilder);
Registry.require("promise layout xmlhttprequest convert crcrc curtain layout/default/tabview layout/default/htmlutil helper i18n parser statistics layout/default/layout_helper".split(" "),function(){var z=rea.FEATURES,D=Registry.get("promise"),p=Registry.get("crcrc").cr,c=Registry.get("crcrc").crc,d=Registry.get("i18n"),E=Registry.get("curtain"),w=Registry.get("helper"),M=Registry.get("layout/default/tabview"),u=Registry.get("layout/default/htmlutil"),X=Registry.get("statistics"),H=Registry.get("layout"),
N=Registry.get("layout/default/layout_helper"),A=N.images;H.render(function(){var k=null,t={},O="???",F=null,P="0.0.0",B=function(){var a=c("div","content_wrapper","ask","main");$(document.body).append(a).addClass("main");var b=c("div","head_container","ask","head_container"),f=c("div","tv_container_fit","ask","tv_container"),h=p("a","head_link","ask","head_link");h.href="https://www.tampermonkey.net";h.target="_blank";var e=c("div","float","ask","head1"),g=c("img","banner","ask");g.src=A.brand("tampermonkey");
var d=c("div","float head","ask","head2"),l=c("div","header_title","heading"),m=c("div","version","version","version");m.textContent=" by Jan Biniok";var G=p("div","search","box","");l.innerHTML="Tampermonkey<sup>&reg;</sup>";e.appendChild(g);d.appendChild(l);d.appendChild(m);h.appendChild(e);h.appendChild(d);b.appendChild(h);b.appendChild(G);a.appendChild(b);a.appendChild(f);a=M.create("_main",f);b=p("div","main","main","tab_content_h");b.textContent=O;f=p("div","main","main","tab_content");a.appendTab(w.createUniqueId("main",
"main"),b,f).select();E.hide();return f},H=function(a){var b=a.script,f=a.oldscript,h=c("div","viewer_bottom_tab","bottom","");a={tv:"tv tv_alt",tv_table:"tv_table tv_table_alt",tr_tabs:"tr_tabs tr_tabs_alt",tr_content:"tr_content tr_content_alt",td_content:"td_content td_content_alt",td_tabs:"td_tabs td_tabs_alt",tv_tabs_align:"tv_tabs_align tv_tabs_align_alt",tv_tabs_fill:"tv_tabs_fill tv_tabs_fill_alt",tv_tabs_table:"tv_tabs_table tv_tabs_table_alt",tv_contents:"tv_contents tv_contents_alt",tv_tab_selected:"tv_tab tv_selected tv_tab_alt tv_selected_alt",
tv_tab_close:"",tv_tab:"tv_tab tv_tab_alt",tv_content:"tv_content tv_content_alt"};if(t.editor_enabled){var e=M.create("_source"+b.uuid,h,a),g,n=function(b,a){var h=c("div","tv_content tv_content_alt",b.uuid,a+"container_o"),f=c("table","editor_container_o editor_400p_container_o p100100 noborder",b.uuid,a+"container_o"),g=c("tr","editor_container p100100",b.uuid,a+"container");h.appendChild(f);f.appendChild(g);var f=c("td","editor_outer editor_400p_outer",b.uuid,a+"edit"),e=c("div","editor_100 editor_border",
b.uuid,a+"edit");g.appendChild(f);f.appendChild(e);return{c:h,e:e}},l=function(){var b=D();rea.page.addStyle("vendor/cm/mode/diff/diff.css");Registry.vendor(["vendor/jsdiff/diff","vendor/cm/mode/diff/diff"],function(){l=D.Pledge;b.resolve()});return b.promise()};(function(){return f&&f.textContent!=b.textContent?l().then(function(){var a=p("div",b.uuid,"diff_h");a.textContent=d.getMessage("Changes");var c=n(b,"diff");h.diff=new MirrorFrame(c.e,{theme:"diff",fontSize:t.editor_fontSize,value:d.getMessage("Please_wait___"),
noButtons:!0,mode:"diff",readOnly:!0});g=e.appendTab("diff",a,c.c,function(){window.setTimeout(function(){h.diff.refresh();h.diff.mirror.focus()},1)});window.setTimeout(function(){var a;try{a=window.JsDiff.createTwoFilesPatch(d.getMessage("Current_Version"),d.getMessage("New_Version"),f.textContent,b.textContent,void 0,void 0,{timeout:4E3})}catch(c){console.warn(c)}a||(a=d.getMessage("The_diff_for_this_script_is_too_large_to_render"));h.diff.mirror.setValue(a)},500)}):D.Pledge()})().then(function(){var a=
p("div",b.uuid,"source_h");a.textContent=d.getMessage("Source_Code");var c=n(b,"source");h.editor=new MirrorFrame(c.e,{theme:t.editor_theme,fontSize:t.editor_fontSize,value:b.textContent,noButtons:!0,matchBrackets:!0,readOnly:!0});a=e.appendTab("source",a,c.c,function(){window.setTimeout(function(){h.editor.refresh();h.editor.mirror.focus()},1)});g=g||a}).then(function(){g.select()})}else{var m=c("div","editor_400p_outer","editor",b.name);a=c("div","editor_400p editor_border","editor",b.name);h.appendChild(m);
m.appendChild(a);m=c("textarea","editorta","editor",b.name);m.setAttribute("wrap","off");a.appendChild(m);m.value=b.textContent}return h},Y=function(){var a={};window.addEventListener("keydown",function(b){var c=!1;if("keydown"==b.type&&(a[b.keyCode]&&(c=a[b.keyCode](b)),c))return b.stopPropagation(),b.preventDefault(),!1},!0);return{registerListener:function(b,c){a[b]=c}}}(),x=function(a,b,c){w.select(c,function(b){return b.label}).forEach(function(c){var f=c.icon?u.createImageTextButton(c.id,c.id,
c.label,c.icon,c.fn):u.createButton(c.label,c.id,c.label,c.fn),g=$(f);g.addClass(b);c.id&&g.attr("data-btn-id",c.id);a.appendChild(f);c.focus&&window.setTimeout(function(){g.focus()},300);c.keyDown&&Y.registerListener(c.keyDown.keyCode?c.keyDown.keyCode:c.keyDown,c.keyDown.cb?c.keyDown.cb:c.fn)})},aa=function(a){var b=a.script,f=c("div","viewer_last","install"),h=c("div","viewer_content","install_content"),e=c("div","ask_action_buttons","install_buttons"),g=[];g.push({label:a.messages.action,fn:function(){q(k.aid,
"install")},focus:!0});z.RUNTIME.CHROME&&21>z.RUNTIME.BROWSER_VERSION&&g.push({label:a.messages.flags.install?d.getMessage("Process_with_Chrome"):null,fn:function(){Z(b.fileURL);$(f).hide()}});g.push({label:d.getMessage("Cancel"),fn:y,keyDown:27});x(e,"install",g);h.appendChild(e);f.appendChild(h);return f},ba=function(a){var b=c("div","viewer_last","import"),f=c("div","viewer_content","import_content"),h=c("div","ask_action_buttons import_buttons","import_buttons");x(h,"import",[{label:d.getMessage("Import"),
fn:function(){var b=Object.keys(a.scripts).filter(function(b){return!!$("input[type=checkbox][data-import-id="+b+"]:checked").val()}),c=a.global_settings&&!!$("input[type=checkbox][data-import-id=global_settings]:checked").val();q(k.aid,"import",{data:{import_ids:b,global_settings:c}})},focus:!0},{label:d.getMessage("Cancel"),fn:y,keyDown:27}]);f.appendChild(h);b.appendChild(f);f=c("div","section","btn");f.appendChild(b);return f},ca=function(a){a=c("div","viewer_last","ok");var b=c("div","viewer_content",
"ok_content"),f=c("div","ask_action_buttons","ok_buttons");x(f,"import",[{label:d.getMessage("Ok"),fn:y,focus:!0}]);b.appendChild(f);a.appendChild(b);return a},da=function(a,b){var f=c("div","viewer_last","ok"),h=c("div","viewer_content","ok_content"),e=c("div","ask_action_buttons","ok_buttons");x(e,"permission",[{label:d.getMessage("Ok"),fn:function(){var a={permissions:b.permissions,origins:b.origins};rea.permissions.request(a,function(b){var c;rea.runtime.lastError&&(c=rea.runtime.lastError.message,
console.warn("notify: error on getting permission",a,"reason:",c));q(k.aid,"permission",{data:{granted:b,permissions:a.permissions,origins:a.origins,error:c}})})},focus:!0},{label:d.getMessage("Cancel"),fn:y,keyDown:27}]);h.appendChild(e);f.appendChild(h);var h=c("div","viewer_upper","permission"),e=c("div","viewer_info viewer_info_wide","general","permission"),g=c("div","viewer_content","general_content","permission"),n=p("h3","install","heading","permission"),l=p("span","install","heading_span",
"permission"),m=c("span","message","heading","permission");document.title=l.textContent=b.title;m.innerHTML=u.safeTagsReplace(b.message).replace(/\n/g,"<br>");n.appendChild(l);g.appendChild(m);e.appendChild(n);e.appendChild(g);h.appendChild(e);e=c("div","section","perm_src","permission");e.appendChild(h);e.appendChild(f);a.appendChild(e)},fa=function(a,b){var f=Date.now(),h,e;b.timeout&&(h=window.setTimeout(function(){y();g()},b.timeout));var g=function(){var b;e&&window.clearInterval(e);h&&window.clearTimeout(h);
e=h=null;(b=$("input[data-btn-id]")[0])&&b.parentNode.removeChild(b)},n=c("div","viewer_last","ok"),l=c("div","viewer_content","ok_content"),m=c("div","ask_action_buttons","ok_buttons"),G=c("div","ask_action_buttons","ok_buttons"),r=c("div","ask_action_buttons","ok_buttons");x(m,"connect",[{label:d.getMessage("Allow_once"),icon:"button_ok",fn:function(){return q(k.aid,"connect",{data:{ok:!0,allow:!0,once:!0}})},focus:!0},{label:d.getMessage("Temporarily_allow"),icon:"clock",fn:function(){return q(k.aid,
"connect",{data:{ok:!0,allow:!0,temporary:!0}})}},{label:b.hostname!=b.domain?d.getMessage("Always_allow"):d.getMessage("Always_allow_domain"),icon:"yes_domain",fn:function(){return q(k.aid,"connect",{data:{ok:!0,allow:!0}})}},function(){return b.domain&&b.hostname!=b.domain?{label:d.getMessage("Always_allow_domain"),icon:"yes_domain",fn:function(){return q(k.aid,"connect",{data:{ok:!0,allow:!0,whole_domain:!0}})}}:null}(),function(){return b.all_domains?{label:d.getMessage("Always_allow_all_domains"),
icon:"critical",fn:function(){g();if(window.confirm(d.getMessage("This_gives_this_script_the_permission_to_retrieve_and_send_data_from_and_to_every_webpage__This_is_potentially_unsafe__Are_you_sure_you_want_to_continue_")))return q(k.aid,"connect",{data:{ok:!0,allow:!0,all_domains:!0}})}}:null}()].filter(function(b){return b}));x(G,"connect",[{label:d.getMessage("Forbid_once"),icon:"cancel",fn:function(){return q(k.aid,"connect",{data:{ok:!0,deny:!0,once:!0}})},keyDown:27},{label:b.hostname!=b.domain?
d.getMessage("Always_forbid"):d.getMessage("Always_forbid_domain"),icon:"no_domain",fn:function(){return q(k.aid,"connect",{data:{ok:!0,deny:!0}})}},function(){return b.domain&&b.hostname!=b.domain?{label:d.getMessage("Always_forbid_domain"),icon:"no",fn:function(){return q(k.aid,"connect",{data:{ok:!0,deny:!0,whole_domain:!0}})}}:null}(),{label:d.getMessage("Dont_ask_again"),icon:"no",fn:function(){return q(k.aid,"connect",{data:{ok:!0,deny:!0,all_domains:!0}})}}].filter(function(b){return b}));
x(r,"connect_misc",[function(){return b.tabid?{label:d.getMessage("Focus_tab"),icon:"windowlist",fn:function(){ea("focus_tab",{tabid:b.tabid})}}:null}(),function(){if(b.timeout)return e=window.setInterval(function(){var a;(a=$("input[data-btn-id]")[0])&&$(a).attr("value",d.getMessage("Skip_timeout__0seconds0_seconds_",Math.round((b.timeout+f-Date.now())/1E3)))},1E3),{label:d.getMessage("Skip_timeout__0seconds0_seconds_",Math.round(b.timeout/1E3)),id:"skip_timeout_button",fn:g}}()].filter(function(b){return b}));
var t=c("div","viewer_upper","connect"),I=c("div","viewer_info viewer_info_wide","general","connect"),v=c("div","viewer_content","general_content","connect"),Q=p("h3","install","heading","connect"),J=p("span","install","heading_span","connect"),R=c("span","message","heading","connect");if(b.script.icon){var C=p("img","version","heading","connect");C.src=b.script.icon;J.appendChild(C)}document.title=J.textContent=d.getMessage("A_userscript_wants_to_access_a_cross_origin_resource_");var C=c("div","ask_action_buttons message",
"help","connect"),S=p("div","help","connect"),K=d.getMessage("A_request_to_a_cross_origin_resource_is_nothing_unusual__You_just_have_to_check_whether_this_script_has_a_good_reason_to_access_this_domain__For_example_there_are_only_a_very_few_reasons_for_a_userscript_to_contact_your_bank__Please_note_that_userscript_authors_can_avoid_this_dialog_by_adding_@connect_tags_to_their_scripts__You_can_change_your_opinion_at_any_time_at_the_scripts_settings_tab_",b.connect_url,b.settings_url),K=u.safeTagsReplace(K).replace(/\[url=([^\]]+)\](.*)\[\/url\]/g,
'<a target="_blank" href="$1">$2 &#x2B00;</a>').replace(/\n/g,"<br>");S.innerHTML=K+"<br><br>";C.appendChild(S);Q.appendChild(J);l.appendChild([r,C,m,G]);n.appendChild(l);var T=c("table","script_desc","connect");[{prop:"name",label:d.getMessage("Name")},{prop:"src_url",label:d.getMessage("Tab_URL")},b.domain?{prop:"hostname",label:d.getMessage("Destination_domain")}:null,{prop:"url",label:d.getMessage("Destination_URL")}].forEach(function(a){if(a){var f=b[a.prop]||b.script[a.prop]||a.value,g=c("tr",
"script_desc",a.prop,"connect"),h=c("td","script_desc",a.prop,"connectdt"),e=c("td","script_desc",a.prop,"connectdd");h.textContent=a.label?a.label:"";e.textContent=f||d.getMessage("_not_set_");g.appendChild(h);g.appendChild(e);T.appendChild(g)}});R.appendChild(T);v.appendChild(R);I.appendChild(Q);I.appendChild(v);t.appendChild(I);l=c("div","section","connect_src","connect");l.appendChild(t);l.appendChild(n);a.appendChild(l)},ha=function(a,b){document.title=d.getMessage("Import");a.appendChild(ba(b));
if(b.global_settings){var f=c("div","viewer_upper","");ga({content:f,checkbox:"import",key:"global_settings"});a.appendChild(f)}b.scripts&&Object.keys(b.scripts).forEach(function(f){var e=b.scripts[f],g=c("div","viewer_upper",f);L({content:g,preparat:e,checkbox:"import",key:f},!0);a.appendChild(g)})},U=function(a,b){var c=p("input",a+"_",b,"",!0);c.setAttribute("data-import-id",b);c.checked=!0;c.type="checkbox";c.addEventListener("click",function(a){(a.ctrlKey||a.metaKey)&&$("input[type=checkbox][data-import-id!="+
b+"]").prop("checked",c.checked)});return c},ga=function(a){var b=a.key,f=a.content,h=c("div","viewer_upper",b),e=c("div","viewer_info viewer_info_wide","general",b),g=c("div","viewer_content","general_content",b),n=p("h3","install","heading",b);a.checkbox&&n.appendChild(U(a.checkbox,a.key));a=p("img","version","heading",b);a.src=A.brand("tampermonkey");n.appendChild(a);a=p("span","name","heading",b);a.textContent=d.getMessage("Global_Settings");n.appendChild(a);e.appendChild(n);n=c("table","script_desc",
b);a=c("tr","settings_desc","action",b);var l=c("td","settings_desc","action",b+"dt"),m=c("td","settings_desc","action",b+"dd");l.textContent=d.getMessage("Action");m.textContent=d.getMessage("Global_settings_import");a.appendChild(l);a.appendChild(m);n.appendChild(a);a=c("tr","settings_desc","warning",b);l=c("td","settings_desc","warning",b+"dt");m=c("td","settings_desc","warning",b+"dd");b='<i class="far fa-'+A.get("critical")+'"></i>&nbsp;';z.RUNTIME.MOBILE||(l.innerHTML=b,b="");m.innerHTML=b+
u.safeTagsReplace(d.getMessage("This_will_overwrite_your_global_settings_"));a.appendChild(l);a.appendChild(m);n.appendChild(a);g.appendChild(n);e.appendChild(g);h.appendChild(e);e=c("div","section","settings_src");e.appendChild(h);f.appendChild(e)},L=function(a,b){var f=a.preparat,h=a.content,e=f.script||{},g=e.uuid||e.id||e.name;f.short_info||(f.short_info=[]);var n=c("div","viewer_upper",g),l=c("div","viewer_info "+(b?"viewer_info_wide":"viewer_info_multiple"),"general",g),m=c("div","viewer_content",
"general_content",g),k=p("h3","install","heading",g);a.checkbox&&k.appendChild(U(a.checkbox,a.key));if(e.icon||e.icon64){var r=p("img","version","heading",g);r.src=e.icon||e.icon64;k.appendChild(r)}r=p("span","name","heading",g);r.textContent=f.heading||e.name||"";k.appendChild(r);e.version&&(r=c("span","view_version","heading",g),r.textContent="v"==e.version[0]?"":"v",r.textContent+=e.version,k.appendChild(r));l.appendChild(k);b&&f.short_info.unshift({prop:"heading",value:f.messages.heading,label:d.getMessage("Action")});
var q=c("table","script_desc",g);f.short_info.forEach(function(a){var f=e[a.prop]||a.value;if(f||!b){var h=c("tr","script_desc",a.prop,g),l=c("td","script_desc",a.prop,g+"dt"),k=c("td","script_desc",a.prop,g+"dd");l.textContent=a.label?a.label:"";k.textContent=f||d.getMessage("_not_set_");h.appendChild(l);h.appendChild(k);q.appendChild(h)}});m.appendChild(q);var k=c("div","viewer_info viewer_info_multiple","info",g),t;b?t=m:(t=c("div","viewer_content","info_content",g),r=p("h4","action","heading",
g),document.title=r.textContent=f.messages.heading,t.appendChild(r));var v=0;["errors","warnings","info"].forEach(function(a){var b=p("table",a,g+v);(f.messages[a]||[]).forEach(function(c){v++;var f=p("tr",a,g+v),e=p("td",a,g+"dt"+v),h=p("td",a,g+"dd"+v);if("info"==a)if(c.label&&c.value)e.textContent=c.label,h.textContent=c.value;else{var d='<i class="far fa-'+A.get("info")+'"></i>&nbsp;';z.RUNTIME.MOBILE||(e.innerHTML=d,d="");h.innerHTML=d+u.safeTagsReplace(c).replace(/\n/g,"<br />")}else"warnings"==
a?(d='<i class="far fa-'+A.get("critical")+'"></i>&nbsp;',z.RUNTIME.MOBILE||(e.innerHTML=d,d=""),h.innerHTML=d+u.safeTagsReplace(c).replace(/\n/g,"<br />")):"errors"==a&&(d='<i class="far fa-'+A.get("error")+'"></i>&nbsp;',z.RUNTIME.MOBILE||(e.innerHTML=d,d=""),h.innerHTML=d+u.safeTagsReplace(c).replace(/\n/g,"<br />"));f.appendChild(e);f.appendChild(h);b.appendChild(f)});t.appendChild(b)});r=function(a,b,f,h){var l=p("table",a,g),k=0,m={};b.forEach(function(b){if(!(k>h||m[b])){m[b]=!0;var e=c("tr",
a+"desc",b,g+k),d=c("td",a+"desc",b,g+k+"dt"),n=c("td",a+"desc",b,g+k+"dd");d.innerHTML=0==k?u.safeTagsReplace(f.label):"&nbsp;";n.innerHTML=k==h?'<span title="'+u.safeTagsReplace(f.warning)+'">...!</span>':u.safeTagsReplace(b);e.appendChild(d);e.appendChild(n);l.appendChild(e);k++}});if(e.options&&(b=e.options.override&&e.options.override["use_"+a])&&b.length){b=c("tr",a+"desc","ovverride",g+k);var n=c("td",a+"desc","ovverride",g+k+"dt"),q=c("td",a+"desc","ovverride",g+k+"dd");n.innerHTML=0==k?u.safeTagsReplace(f.label):
"&nbsp;";q.innerHTML=u.safeTagsReplace(" ("+d.getMessage("overwritten_by_user")+")");b.appendChild(n);b.appendChild(q);l.appendChild(b)}t.appendChild(l)};r("includes",(e.includes||[]).concat(e.matches||[]),{label:d.getMessage("Include_s__"),warning:d.getMessage("Attention_Can_not_display_all_includes_")},5);r("excludes",e.excludes||[],{label:d.getMessage("Exclude_s__"),warning:d.getMessage("Attention_Can_not_display_all_excludes_")},3);l.appendChild(m);k.appendChild(t);n.appendChild(l);n.appendChild(k);
l=c("div","section",g,"install_src");l.appendChild(n);a.install&&l.appendChild(a.install(f));a.editor&&l.appendChild(a.editor(f));h.appendChild(l)},Z=function(a){q(k.aid,"abort");window.setTimeout(function(){window.location=a+"#bypass=true"},10)},y=function(a){q(k.aid,"abort");window.setTimeout(function(){window.close()},3E3)},V=function(a,b){q(k.aid,"unload");F&&(window.clearInterval(F),F=null);window.removeEventListener("unload",V)};window.addEventListener("unload",V);var W=function(){window.location.search||
window.location.hash?(k=w.getUrlArgs(),k.aid?(q(k.aid,"preparat").done(function(a){a.ext&&a.ext.version&&(P=a.ext.version);if(a.options&&(a.options.statistics_enabled&&X.init("ask",P,!0),a.options.layout_user_css)){var b=document.createElement("style");b.innerHTML=a.options.layout_user_css;(document.head||document.body||document.documentElement||document).appendChild(b)}O=d.getMessage("Install");b=null;a.preparat&&("install"==a.type?b=function(){L({content:B(),preparat:a.preparat,install:aa,editor:H})}:
"install_error"==a.type?b=function(){L({content:B(),preparat:a.preparat,install:ca},!0)}:"import"==a.type?b=function(){ha(B(),a.preparat)}:"permission"==a.type?b=function(){da(B(),a.preparat)}:"connect"==a.type&&(b=function(){fa(B(),a.preparat)}),F=window.setInterval(ia,3E3),b&&window.setTimeout(b,1))}).fail(function(){y()}),E.wait(d.getMessage("Please_wait___"))):y()):window.onhashchange=function(){W()}},ia=function(){return q(k.aid,"ping",{bg:!0})},q=function(a,b,c){c=c||{};var h=D();try{var e=
{aid:a,method:b};c.data&&w.each(c.data,function(a,b){e[b]=c.data[b]});sendMessage({method:"askCom",data:e},function(a){c.bg||E.hide();t=a.options||t;a.error?(a.please_close&&window.setTimeout(window.close,100),h.reject(a)):h.resolve(a)});c.bg||E.wait(d.getMessage("Please_wait___"))}catch(g){console.warn("sS: "+g.message),h.reject()}return h.promise()},ea=function(a,b,c){try{sendMessage(w.assign({method:"buttonPress",name:a},b),function(a){c&&c(a)})}catch(d){console.log("button: "+d.message)}};rea.extension.onMessage.addListener(function(a,
b,c){t=a.options||t;if("confirm"==a.method)w.confirm(a.msg,function(a){c({confirm:a})});else if("showMsg"==a.method)w.alert(a.msg),c({});else return!1;return!0});N.addStyle(W)})});
