"use strict";document.webL10n=(function(window,document,undefined){vargL10nData={};vargTextData="";vargTextProp="textContent";vargLanguage="";vargMacros={};vargReadyState="loading";vargAsyncResourceLoading=true;vargDEBUG=1;functionconsoleLog(message){if(gDEBUG>=2){console.log("[l10n] "+message)}}functionconsoleWarn(message){if(gDEBUG){console.warn("[l10n] "+message)}}functiongetL10nResourceLinks(){returndocument.querySelectorAll('link[type="application/l10n"]')}functiongetL10nDictionary(){varscript=document.querySelector('script[type="application/l10n"]');returnscript?JSON.parse(script.innerHTML):null}functiongetTranslatableChildren(element){returnelement?element.querySelectorAll("*[data-l10n-id]"):[]}functiongetL10nAttributes(element){if(!element){return{}}varl10nId=element.getAttribute("data-l10n-id");varl10nArgs=element.getAttribute("data-l10n-args");varargs={};if(l10nArgs){try{args=JSON.parse(l10nArgs)}catch(e){consoleWarn("could not parse arguments for #"+l10nId)}}return{id:l10nId,args:args}}functionfireL10nReadyEvent(lang){varevtObject=document.createEvent("Event");evtObject.initEvent("localized",true,false);evtObject.language=lang;document.dispatchEvent(evtObject)}functionxhrLoadText(url,onSuccess,onFailure){onSuccess=onSuccess||function_onSuccess(data){};onFailure=onFailure||function_onFailure(){consoleWarn(url+" not found.")};varxhr=newXMLHttpRequest();xhr.open("GET",url,gAsyncResourceLoading);if(xhr.overrideMimeType){xhr.overrideMimeType("text/plain; charset=utf-8")}xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200||xhr.status===0){onSuccess(xhr.responseText)}else{onFailure()}}};xhr.onerror=onFailure;xhr.ontimeout=onFailure;try{xhr.send(null)}catch(e){onFailure()}}functionparseResource(href,lang,successCallback,failureCallback){varbaseURL=href.replace(/[^\/]*$/,"")||"./";functionevalString(text){if(text.lastIndexOf("\\")<0){returntext}returntext.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}functionparseProperties(text,parsedPropertiesCallback){vardictionary={};varreBlank=/^\s*|\s*$/;varreComment=/^\s*#|^\s*$/;varreSection=/^\s*\[(.*)\]\s*$/;varreImport=/^\s*@import\s+url\((.*)\)\s*$/i;varreSplit=/^([^=\s]*)\s*=\s*(.+)$/;functionparseRawLines(rawText,extendedSyntax,parsedRawLinesCallback){varentries=rawText.replace(reBlank,"").split(/[\r\n]+/);varcurrentLang="*";vargenericLang=lang.split("-",1)[0];varskipLang=false;varmatch="";functionnextEntry(){while(true){if(!entries.length){parsedRawLinesCallback();return}varline=entries.shift();if(reComment.test(line)){continue}if(extendedSyntax){match=reSection.exec(line);if(match){currentLang=match[1].toLowerCase();skipLang=(currentLang!=="*")&&(currentLang!==lang)&&(currentLang!==genericLang);continue}else{if(skipLang){continue}}match=reImport.exec(line);if(match){loadImport(baseURL+match[1],nextEntry);return}}vartmp=line.match(reSplit);if(tmp&&tmp.length==3){dictionary[tmp[1]]=evalString(tmp[2])}}}nextEntry()}functionloadImport(url,callback){xhrLoadText(url,function(content){parseRawLines(content,false,callback)},null)}parseRawLines(text,true,function(){parsedPropertiesCallback(dictionary)})}xhrLoadText(href,function(response){gTextData+=response;parseProperties(response,function(data){for(varkeyindata){varid,prop,index=key.lastIndexOf(".");if(index>0){id=key.substring(0,index);prop=key.substr(index+1)}else{id=key;prop=gTextProp}if(!gL10nData[id]){gL10nData[id]={}}gL10nData[id][prop]=data[key]}if(successCallback){successCallback()}})},failureCallback)}functionloadLocale(lang,callback){if(lang){lang=lang.toLowerCase()}callback=callback||function_callback(){};clear();gLanguage=lang;varlangLinks=getL10nResourceLinks();varlangCount=langLinks.length;if(langCount===0){vardict=getL10nDictionary();if(dict&&dict.locales&&dict.default_locale){consoleLog("using the embedded JSON directory, early way out");gL10nData=dict.locales[lang];if(!