'use strict';Registry.require(["helper","i18n"],function(){var k=Registry.get("helper"),t=Registry.get("i18n"),n,q=function(){this.name=this.supportURL=this.updateURL=this.downloadURL=this.fileURL=this.icon64=this.icon=this.uuid=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.connects=
[];this.blockers=[];this.lastModified=0;this.webRequest=this.version=null;this.sync={imported:!1};this.options={check_for_updates:!0,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,override:{use_includes:[],orig_includes:[],merge_includes:!0,use_matches:[],orig_matches:[],merge_matches:!0,use_excludes:[],orig_excludes:[],
merge_excludes:!0,use_connects:[],merge_connects:!0,use_blockers:[],orig_run_at:null,orig_noframes:null}}},r={init:function(a){n=a},Script:q,processMetaHeader:function(a){var b={};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 c,e;a.split("\n").forEach(function(a){c=a.replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"").replace(/\s\s+/gi," ");k.each({"uso:hash":!1,version:!1},function(a,l){var g=new RegExp("^@"+l+"[\\t\\s]",
"i"),d=a||l;-1!=c.search(g)&&(e=c.replace(g,"").replace(/[ \b\r\n]/gi,"").trim(),""!==e&&(b[d]=b[d]||e))})});return b},processHeader:function(a){var b=new q;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 c,e,p,f;a.split("\n").forEach(function(a){p=a.replace(/^[\t\s]*\/\//gi,"").replace(/^[\t\s]*/gi,"");e=p.replace(/\s\s+/gi," ");f=!1;k.each({name:!1,description:!1},function(a,c){var m=a||c,g=null!==b[m],d=e.match(new RegExp("^@"+
c+"(\\[[a-zA-Z_\\-0-9]+\\]|:[a-zA-Z_\\-0-9]+|#[a-zA-Z_\\-0-9]+"+(g?"| [a-zA-Z_\\-0-9]+":"")+")?[\\t\\s]+(.*)$"));if(d&&3===d.length&&(f=d[2].replace(/[\r\n]/gi,"").trim(),void 0!==f&&""!==f))if(g){var h,m=m+"_i18n";d[1]&&(h=d[1].match("[a-zA-Z_\\-0-9]+"))&&h[0]&&(d=t.normalizeLocale(h[0]),b[m][d]=f)}else b[m]=f});k.each({version:!1,updateURL:!1,downloadURL:!1,supportURL:!1,homepage:!1,homepageURL:"homepage",website:"homepage",source:"homepage",uuid:!1},function(a,c){var d=new RegExp("^@"+c+"[\\t\\s]",
"i"),g=a||c;-1!=e.search(d)&&(f=e.replace(d,"").replace(/[ \b\r\n]/gi,"").trim(),""!==f&&(b[g]=b[g]||f))});k.each({icon:!1,iconURL:"icon",defaulticon:"icon",icon64:!1,iconURL64:"icon64"},function(a,c){var d=new RegExp("^@"+c+"[\\t\\s]","i"),g=a||c;-1!=e.search(d)&&(f=e.replace(d,"").replace(/[\b\r\n]/gi,"").trim(),""!==f&&(b[g]=b[g]||f))});k.each({namespace:!1,author:!1,copyright:!1},function(a,e){var c=new RegExp("^@"+e+"[\\t\\s]","i"),d=a||e;-1!=p.search(c)&&(f=p.replace(c,"").replace(/[\b\r\n]/gi,
"").trim(),""!==f&&(b[d]=b[d]||f))});k.each({"run-at":"run_at"},function(a,c){var d=new RegExp("^@"+c+"[\\t\\s]","i"),g=a||c;-1!=e.search(d)&&(f=e.replace(d,"").replace(/[\r\n]/gi,"").trim(),""!==f&&(b.options[g]=b.options[g]||f))});var g=function(a){return a.trim().replace(/ /gi,"%20").replace(/[\b\r\n]/gi,"")};k.each({include:"includes",match:"matches",exclude:"excludes",connect:"connects","connect-src":"connects",domain:"connects"},function(a,c){var d=new RegExp("^@"+c+"[\\t\\s]","i"),h=a||c;-1!=
e.search(d)&&(f=g(e.replace(d,"")).trim())&&b[h].push(f)});-1!=e.search(/^@require[\t\s]/)&&(f=g(e.replace(/^@require[\t\s]*/gi,"")).trim())&&b.requires.push({url:f,loaded:!1,textContent:""});if(-1!=e.search(/^@resource[\t\s]/)&&(f=e.replace(/^@resource[\t\s]*/gi,"").trim(),c=f.split(" "),2<=c.length)){a=c.shift();var d=g(c.join(" "));""!==a&&d&&b.resources.push({name:a,url:d,loaded:!1})}-1!=e.search(/^@grant[\t\s]/)&&(f=e.replace(/^@grant/gi,"").replace(/[\b\r\n]/gi,"").trim())&&b.grant.push(f);
k.each({noframes:!1,nocompat:"awareOfChrome"},function(a,c){var d=a||c;-1!=e.search(new RegExp("^@"+c+"[\\t\\s\\r\\n]?"))&&(b.options[d]=!0)});if(-1!=e.search(/^@webRequest[\t\s]/)&&(f=e.replace(/^@webRequest/gi,"").replace(/[\b\r\n]/gi,"").trim())){var h;try{h=JSON.parse(f),b.webRequest=(b.webRequest||[]).concat(h instanceof Array?h:[h])}catch(u){return console.warn("parser: unable to process webRequest header",f),new q}}});b.version||(b.version="0.0");return b},getHeaderTags:function(){return{start:"==UserScript==",
stop:"==/UserScript=="}},getHeader:function(a){var b=k.getStringBetweenTags(a,"==UserScript==","==/UserScript==");if(!b)return null;var c=a.search("==UserScript=="),e=a.search("<html>");a=a.search("<body>");return 0<e&&e<c||0<a&&a<c?null:b},createScriptFromSrc:function(a){a=(a||"").replace(/(\r\n|\n|\r)/gm,"\n");var b=r.getHeader(a);if(!b)return{};var c=r.processHeader(b);c.textContent=a;c.header=b;c.options.awareOfChrome||(c.options.compat_wrappedjsobject=a!=n.unWrappedJsObjectify(a),c.options.compat_metadata=
a!=n.unMetaDataify(a),c.options.compat_prototypes=n.findPrototypes(a));-1!=a.search("unsafeWindow.gmonkey")&&(c.options.compat_uW_gmonkey=!0);return c},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)})},b=function(c,e){for(var k=Array.isArray(c)?
c:a(c),f=Array.isArray(e)?e:a(e),l=0;16>l;l++){var g=k[l],d=f[l];if(1===l%2){if(!g&&d)return b.eNEWER;if(g&&!d)return b.eOLDER;for(var g=g.match(/\w/g)||[],d=d.match(/\w/g)||[],h=0;h<Math.min(g.length,d.length);h++){if(g[h].charCodeAt(0)>d[h].charCodeAt(0))return b.eNEWER;if(g[h].charCodeAt(0)<d[h].charCodeAt(0))return b.eOLDER}if(g.length>d.length)return b.eNEWER;if(g.length<d.length)return b.eOLDER}else{if(Number(g)>Number(d))return b.eNEWER;if(Number(g)<Number(d))return b.eOLDER}}return b.eEQUAL};
b.__proto__.eERROR=-2;b.__proto__.eOLDER=-1;b.__proto__.eEQUAL=0;b.__proto__.eNEWER=1;return b}()};Registry.register("parser","6095",r)});
