'use strict';Registry.require(["helper","compat","i18n"],function(){var h=Registry.get("helper"),m=Registry.get("compat"),q=Registry.get("i18n"),p=function(){this.uuid=null;this.observers=[];this.name=this.supportURL=this.updateURL=this.downloadURL=this.fileURL=this.icon64=this.icon=null;this.name_i18n={};this.description=this.homepage=this.namespace=this.version=null;this.description_i18n={};this.system=!1;this.enabled=!0;this.position=0;this.grant=[];this.requires=[];this.includes=[];this.matches=
[];this.excludes=[];this.resources=[];this.lastModified=this.lastUpdated=0;this.version=null;this.sync={imported:!1};this.options={comment:null,compatopts_for_requires:!0,compat_wrappedjsobject:!1,compat_metadata:!1,compat_foreach:!1,compat_arrayleft:!1,compat_prototypes:!1,compat_uW_gmonkey:!1,compat_forvarin:!1,noframes:null,awareOfChrome:!1,run_at:null,user_agent:"",override:{use_includes:[],orig_includes:[],merge_includes:!0,use_matches:[],orig_matches:[],merge_matches:!0,use_excludes:[],orig_excludes:[],
merge_excludes:!0,orig_run_at:null,orig_noframes:null}}},n={Script:p,processMetaHeader:function(a){var c={};a=a.replace(/\t/g,"    ");a=a.replace(/\r/g,"\n");a=a.replace(/\n\n+/g,"\n");a=a.replace(/[^|\n][ \t]+\/\//g,"//");var b,d,g;a=a.split("\n");for(b in a)d=a[b].replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"").replace(/\s\s+/gi," "),h.each({"uso:hash":!1,version:!1},function(a,b){var e=RegExp("^@"+b+"[\\t\\s]","i"),l=a||b;-1!=d.search(e)&&(g=d.replace(e,"").replace(/[ \b\r\n]/gi,"").trim(),
""!==g&&(c[l]=c[l]||g))});return c},processHeader:function(a){var c=new p;a=a.replace(/\t/g,"    ");a=a.replace(/\r/g,"\n");a=a.replace(/\n\n+/g,"\n");a=a.replace(/[^|\n][ \t]+\/\//g,"//");var b,d,g,f;a=a.split("\n");for(d in a){g=a[d].replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"").replace(/\s\s+/gi," ");f=!1;h.each({name:!1,description:!1},function(a,b){var d=a||b,e=null!==c[d],k=g.match(RegExp("^@"+b+"(\\[[a-zA-Z_\\-0-9]+\\]|:[a-zA-Z_\\-0-9]+|#[a-zA-Z_\\-0-9]+"+(e?"| [a-zA-Z_\\-0-9]+":"")+
")?[\\t\\s]+(.*)$"));if(k&&3===k.length&&(f=k[2].replace(/[\r\n]/gi,"").trim(),void 0!==f&&""!==f))if(e){var h,d=d+"_i18n";k[1]&&(h=k[1].match("[a-zA-Z_\\-0-9]+"))&&h[0]&&(k=q.parseLocale(h[0]),c[d][k]=f)}else c[d]=f});h.each({version:!1,updateURL:!1,downloadURL:!1,supportURL:!1,homepage:!1,homepageURL:"homepage",website:"homepage",source:"homepage",icon:!1,iconURL:"icon",defaulticon:"icon",icon64:!1,iconURL64:"icon64",uuid:!1},function(a,b){var d=RegExp("^@"+b+"[\\t\\s]","i"),e=a||b;-1!=g.search(d)&&
(f=g.replace(d,"").replace(/[ \b\r\n]/gi,"").trim(),""!==f&&(c[e]=c[e]||f))});h.each({namespace:!1,author:!1,copyright:!1},function(a,b){var d=RegExp("^@"+b+"[\\t\\s]","i"),e=a||b;-1!=g.search(d)&&(f=g.replace(d,"").replace(/[\b\r\n]/gi,"").trim(),""!==f&&(c[e]=c[e]||f))});h.each({"run-at":"run_at","user-agent":"user_agent"},function(a,b){var d=RegExp("^@"+b+"[\\t\\s]","i"),e=a||b;-1!=g.search(d)&&(f=g.replace(d,"").replace(/[\r\n]/gi,"").trim(),""!==f&&(c.options[e]=c.options[e]||f))});var k=function(a){return a.trim().replace(/ /gi,
"%20").replace(/[\b\r\n]/gi,"")};h.each({include:"includes",match:"matches",exclude:"excludes"},function(a,b){var d=RegExp("^@"+b+"[\\t\\s]","i"),e=a||b;-1!=g.search(d)&&(f=k(g.replace(d,"")).trim())&&c[e].push(f)});-1!=g.search(/^@require[\t\s]/)&&(f=k(g.replace(/^@require[\t\s]*/gi,"")).trim())&&c.requires.push({url:f,loaded:!1,textContent:""});if(-1!=g.search(/^@resource[\t\s]/)&&(f=g.replace(/^@resource[\t\s]*/gi,"").trim(),b=f.split(" "),2<=b.length)){var e=b.shift();b=k(b.join(" "));""!==e&&
b&&c.resources.push({name:e,url:b,loaded:!1})}-1!=g.search(/^@grant[\t\s]/)&&(f=g.replace(/^@grant/gi,"").replace(/[\b\r\n]/gi,"").trim())&&c.grant.push(f);h.each({noframes:!1,nocompat:"awareOfChrome"},function(a,b){var d=a||b;-1!=g.search(RegExp("^@"+b+"[\\t\\s\\r\\n]?"))&&(c.options[d]=!0)})}c.version||(c.version="0.0");return c},getHeaderTags:function(){return{start:"==UserScript==",stop:"==/UserScript=="}},getHeader:function(a){var c=h.getStringBetweenTags(a,"==UserScript==","==/UserScript==");
if(!c)return null;var b=a.search("==UserScript=="),d=a.search("<html>");a=a.search("<body>");return 0<d&&d<b||0<a&&a<b?null:c},createScriptFromSrc:function(a){a=a.replace(/(\r\n|\n|\r)/gm,"\n");var c=n.getHeader(a);if(!c)return{};var b=n.processHeader(c);b.textContent=a;b.header=c;b.options.awareOfChrome||(b.options.compat_wrappedjsobject=a!=m.unWrappedJsObjectify(a),b.options.compat_metadata=a!=m.unMetaDataify(a),b.options.compat_foreach=a!=m.unEachify(a),b.options.compat_arrayleft=a!=m.unArrayOnLeftSideify(a),
b.options.compat_prototypes=m.findPrototypes(a));-1!=a.search("unsafeWindow.gmonkey")&&(b.options.compat_uW_gmonkey=!0);return b},versionCmp:function(){var a=function(a){a=a.split(".");return a.slice(0,3).concat([a.slice(3).join(".")]).concat([0,0,0,0]).slice(0,4).map(function(a){a=a.toString().match(/((?:\-?[0-9]+)?)([^0-9\-]*)((?:\-?[0-9]+)?)(.*)/);return[Number(a[1]),a[2],Number(a[3]),a[4]]}).reduce(function(a,b){return a.concat(b)})},c=function(b,d){for(var g=Array.isArray(b)?b:a(b),f=Array.isArray(d)?
d:a(d),k=0;16>k;k++){var e=g[k],l=f[k];if(1===k%2){if(!e&&l)return c.eNEWER;if(e&&!l)return c.eOLDER;for(var e=e.match(/\w/g)||[],l=l.match(/\w/g)||[],h=0;h<Math.min(e.length,l.length);h++){if(e[h].charCodeAt(0)>l[h].charCodeAt(0))return c.eNEWER;if(e[h].charCodeAt(0)<l[h].charCodeAt(0))return c.eOLDER}if(e.length>l.length)return c.eNEWER;if(e.length<l.length)return c.eOLDER}else{if(Number(e)>Number(l))return c.eNEWER;if(Number(e)<Number(l))return c.eOLDER}}return c.eEQUAL};c.__proto__.eERROR=-2;
c.__proto__.eOLDER=-1;c.__proto__.eEQUAL=0;c.__proto__.eNEWER=1;return c}()};Registry.register("parser","58",n)});
