/* OxJS 0.1.2612 (c) 2013 0x2620, dual-licensed GPL/MIT, see https://oxjs.org for details */'use strict';this.Ox=function(value){return Ox.wrap(value);};Ox.load=function(){var callback=arguments[arguments.length-1],length,loaded=0,modules={},succeeded=0,type=Ox.typeOf(arguments[0]);function done(success){Ox.documentReady(function(){callback(success);});} if(type=='string'){modules=Ox.extend({},arguments[0],Ox.isObject(arguments[1])?arguments[1]:{});}else if(type=='array'){arguments[0].forEach(function(value){if(Ox.isString(value)){modules[value]={};}else{Ox.extend(modules,value)}});}else if(type=='object'){modules=arguments[0];} length=Ox.len(modules);Ox.documentReady(function(){if(!length){callback(true);}else{Ox.forEach(modules,function(options,module){Ox.getFile(Ox.PATH+'Ox.'+module+'/Ox.'+module+'.js',function(){Ox.load[module](options,function(success){succeeded+=success;++loaded==length&&callback(succeeded==length);});});});}});};Ox.localStorage=function(namespace){var localStorage=window.localStorage||{};try{Ox.forEach(localStorage,function(value,key){});}catch(e){localStorage={};} function storage(key,value){var ret;if(arguments.length==0){ret={};Ox.forEach(localStorage,function(value,key){if(Ox.startsWith(key,namespace+'.')){ret[key.slice(namespace.length+1)]=JSON.parse(value);}});}else if(arguments.length==1&&typeof key=='string'){value=localStorage[namespace+'.'+key];ret=value===void 0?void 0:JSON.parse(value);}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){localStorage[namespace+'.'+key]=JSON.stringify(value);});ret=storage;} return ret;};storage['delete']=function(){var keys=arguments.length==0?Object.keys(storage()):Ox.toArray(arguments) keys.forEach(function(key){delete localStorage[namespace+'.'+key];});return storage;};return storage;};Ox.Log=(function(){var storage=Ox.localStorage('Ox'),log=storage('log')||{filter:[],filterEnabled:true},that=function(){var ret;if(arguments.length==0){ret=log;}else{ret=that.log.apply(null,arguments);} return ret;};that.filter=function(value){if(!Ox.isUndefined(value)){that.filter.enable();log.filter=Ox.makeArray(value);storage('log',log);} return log.filter;};that.filter.add=function(value){return that.filter(Ox.unique(log.filter.concat(Ox.makeArray(value))));};that.filter.disable=function(){log.filterEnabled=false;storage('log',log);};that.filter.enable=function(){log.filterEnabled=true;storage('log',log);};that.filter.remove=function(value){value=Ox.makeArray(value);return that.filter(log.filter.filter(function(v){return value.indexOf(v)==-1;}));};that.log=function(){var args=Ox.toArray(arguments),date,ret;if(!log.filterEnabled||log.filter.indexOf(args[0])>-1){date=new Date();args.unshift(Ox.formatDate(date,'%H:%M:%S.')+(+date).toString().slice(-3));window.console&&window.console.log.apply(window.console,args);ret=args.join(' ');} return ret;};return that;}());Ox.loop=function(){var length=arguments.length,start=length>2?arguments[0]:0,stop=arguments[length>2?1:0],step=length==4?arguments[2]:(start<=stop?1:-1),iterator=arguments[length-1],i;for(i=start;step>0?istop;i+=step){if(iterator(i)===false){break;}} return i;};Ox.print=function(){var args=Ox.toArray(arguments),date=new Date();args.unshift(Ox.formatDate(date,'%H:%M:%S.')+(+date).toString().slice(-3));window.console&&window.console.log.apply(window.console,args);return args.join(' ');};Ox.uid=(function(){var uid=0;return function(){return uid++;};}());Ox.wrap=function(value,chained){var wrapper={chain:function(){wrapper.chained=true;return wrapper;},chained:chained||false,value:function(){return value;}};Ox.methods(Ox).filter(function(method){return method[0]==method[0].toLowerCase();}).forEach(function(method){wrapper[method]=function(){var args=Array.prototype.slice.call(arguments),ret;args.unshift(value);ret=Ox[method].apply(Ox,args);return wrapper.chained?Ox.wrap(ret,true):ret;};});return wrapper;};'use strict';Ox.cache=function(fn,options){var cache={},ret=function(){options=Ox.extend({async:false,key:JSON.stringify},options||{});var args=Ox.toArray(arguments),key=options.key(args);function callback(){cache[key]=Ox.toArray(arguments);Ox.last(args).apply(this,arguments);} if(options.async){if(!(key in cache)){fn.apply(this,args.slice(0,-1).concat(callback));}else{callback.apply(this,cache[key])}}else{if(!(key in cache)){cache[key]=fn.apply(this,args);} return cache[key];}};ret.clear=function(){if(arguments.length==0){cache={};}else{Ox.makeArray(arguments).forEach(function(key){delete cache[key];});} return ret;};return ret;};Ox.identity=function(value){return value;};Ox.noop=function(){var callback=Ox.last(arguments);Ox.isFunction(callback)&&callback();};'use strict';Ox.polyfill={};(function(){var digits='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';Ox.polyfill.atob=function(string){var binary='',ret='';String(string).replace(/=/g,'').split('').forEach(function(char){binary+=Ox.pad(digits.indexOf(char).toString(2),'left',6,'0');});while(binary.length>=8){ret+=Ox.char(parseInt(binary.slice(0,8),2));binary=binary.slice(8);} return ret;};Ox.polyfill.btoa=function(string){var binary='',ret='';String(string).split('').forEach(function(char){binary+=Ox.pad(char.charCodeAt(0).toString(2),'left',8,'0');});binary=Ox.pad(binary,Math.ceil(binary.length/6)*6,'0') while(binary){ret+=digits[parseInt(binary.slice(0,6),2)];binary=binary.slice(6);} return Ox.pad(ret,Math.ceil(ret.length/4)*4,'=');};}());(function(window){Ox.polyfill.bind=function(that){if(typeof this!=='function'){throw new TypeError();} var args=Array.prototype.slice.call(arguments,1),fn=function(){},this_=this,ret=function(){return this_.apply(this instanceof fn?this:that||window,args.concat(Array.prototype.slice.call(arguments)));};fn.prototype=this.prototype;ret.prototype=new fn();return ret;};})(this);Ox.polyfill.every=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();} var array=Object(this),i,length=array.length>>>0,ret=true;for(i=0;i>>0,ret=[],value;for(i=0;i>>0;for(i=0;i>>0,ret=-1;for(i=0;i>>0,ret=-1;for(i=length-1;i>=0;i--){if(i in array&&array[i]===value){ret=i;break;}} return ret;};Ox.polyfill.map=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();} var array=Object(this),i,length=array.length>>>0,ret=new Array(length);for(i=0;i=0;i--){if(i in array){ret=iterator.call(void 0,ret,array[i],i,array);}} return ret;};Ox.polyfill.some=function(iterator,that){if(this===void 0||this===null||typeof iterator!=='function'){throw new TypeError();} var array=Object(this),i,length=array.length>>>0,ret=false;for(i=0;i1){keys=[];options.sort=parseSort(options.sort.concat(api.sort)).filter(function(v){var ret=keys.indexOf(v.key)==-1;keys.push(v.key);return ret;});options.sort.forEach(function(v){var key=v.key;if(api.enums[key]){map[key]=function(value){return api.enums[key].indexOf(value.toLowerCase());};}else if(api.map[key]){map[key]=api.map[key];}});if(options.keys||options.positions){result.data.items=sortBy(result.data.items,options.sort,map,options.query);}} if(options.positions){data={positions:{}};options.positions.forEach(function(id){data.positions[id]=Ox.indexOf(result.data.items,function(item){return item[api.unique]==id;});});result.data=data;}else if(!options.keys){data={};api.sums.forEach(function(key){data[key]=result.data.items.map(function(item){return item[key];});data[key]=Ox.isString(data[key][0])?Ox.unique(data[key]).length:Ox.sum(data[key]);});data.items=result.data.items.length;if(api.geo){data.area=data.items==0?{south:-Ox.MAX_LATITUDE,west:-179,north:Ox.MAX_LATITUDE,east:179}:result.data.items.reduce(function(prev,curr){return{south:Math.min(prev.south,curr.south),west:Math.min(prev.west,curr.west),north:Math.max(prev.north,curr.north),east:Math.max(prev.east,curr.east)};},{south:Ox.MAX_LATITUDE,west:180,north:-Ox.MAX_LATITUDE,east:-180});} result.data=data;}else{if(!Ox.isEmpty(options.keys)){if(options.keys.indexOf(api.unique)==-1){options.keys.push(api.unique);} result.data.items=result.data.items.map(function(item){var ret={};options.keys.forEach(function(key){ret[key]=item[key];});return ret;});} if(options.range){result.data.items=result.data.items.slice(options.range[0],options.range[1]);}} callback&&callback(result);return result;},sortBy=Ox.cache(function sortBy(array,by,map,query){return Ox.sortBy(array,by,map);},{key:function(args){return JSON.stringify([args[1],args[3]])}});function parseEnums(enums){return Ox.map(enums,function(values){return values.map(function(value){return value.toLowerCase();});});} function parseConditions(conditions){return conditions.map(function(condition){var key=condition.key,operator=condition.operator,values=Ox.makeArray(condition.value);if(condition.conditions){condition.conditions=parseConditions(condition.conditions);}else{values=values.map(function(value){if(Ox.isString(value)){value=value.toLowerCase();} if(api.enums[key]&&(operator.indexOf('<')>-1||operator.indexOf('>')>-1)){value=api.enums[key].indexOf(value);} return value;});condition.value=Ox.isArray(condition.value)?values:values[0];} return condition;});} function parseSort(sort){return sort.map(function(sort){return Ox.isString(sort)?{key:sort.replace(/^[\+\-]/,''),operator:sort[0]=='-'?'-':'+'}:sort;});} function testCondition(item,condition){var key=condition.key,operator=condition.operator.replace('!',''),value=condition.value,not=condition.operator[0]=='!',itemValue=item[key],test={'=':function(a,b){return Ox.isArray(b)?a>=b[0]&&a-1;}):Ox.isString(a)?a.indexOf(b)>-1:a===b;},'==':function(a,b){return Ox.isArray(a)?a.some(function(value){return value===b;}):a===b;},'<':function(a,b){return a':function(a,b){return a>b;},'>=':function(a,b){return a>=b;},'^':function(a,b){return Ox.startsWith(a,b);},'$':function(a,b){return Ox.endsWith(a,b);}};if(Ox.isString(itemValue)){itemValue=itemValue.toLowerCase();}else if(Ox.isArray(itemValue)&&Ox.isString(itemValue[0])){itemValue=itemValue.map(function(value){return value.toLowerCase();});} if(api.enums[key]&&(operator.indexOf('<')>-1||operator.indexOf('>')>-1)){itemValue=api.enums[key].indexOf(itemValue);} return test[operator](itemValue,value)==!not;} function testQuery(item,query){var match=true;Ox.forEach(query.conditions,function(condition){if(condition.conditions){match=testQuery(item,condition);}else{match=testCondition(item,condition)} if((query.operator=='&'&&!match)||(query.operator=='|'&&match)){return false;}});return match;} return api.cache?Ox.cache(fn,{async:true}):fn;};Ox.compact=function(array){return array.filter(function(value){return value!=null;});};Ox.find=function(array,string,leading){var matches=[[],[]];string=string.toLowerCase();array.forEach(function(value){var lowerCase=value.toLowerCase(),index=lowerCase.indexOf(string);index>-1&&matches[index==0?0:1][lowerCase==string?'unshift':'push'](value);}) return leading?matches[0]:matches[0].concat(matches[1]);};Ox.flatten=function(array){var ret=[];array.forEach(function(value){if(Ox.isArray(value)){ret=ret.concat(Ox.flatten(value));}else{ret.push(value);}});return ret;};Ox.getIndexById=function(array,id){return Ox.indexOf(array,function(obj){return obj.id===id;});};Ox.getObjectById=function(array,id){var index=Ox.getIndexById(array,id);return index>-1?array[index]:null;};Ox.last=function(array,value){var ret;if(arguments.length==1){ret=array[array.length-1];}else{array[array.length-1]=value;ret=array;} return ret;};Ox.makeArray=function(value){var ret,type=Ox.typeOf(value);if(type=='arguments'){ret=Ox.toArray(value);}else if(type=='array'){ret=value;}else{ret=[value];} return ret;};Ox.range=function(){var array=[];Ox.loop.apply(null,Ox.toArray(arguments).concat(function(index){array.push(index);}));return array;};(function(){var getSortValue=Ox.cache(function getSortValue(value){var sortValue=value;function trim(value){return value.replace(/^\W+(?=\w)/,'');} if(Ox.isEmpty(value)||Ox.isNull(value)||Ox.isUndefined(value)){sortValue=null;}else if(Ox.isString(value)){sortValue=trim(value.toLowerCase());Ox.forEach(['a','an','the'],function(article){if(new RegExp('^'+article+' ').test(sortValue)){sortValue=trim(sortValue.slice(article.length+1)) +', '+sortValue.slice(0,article.length);return false;}});sortValue=sortValue.replace(/(\d),(?=(\d{3}))/g,'$1').replace(/\d+/g,function(match){return Ox.pad(match,'left',64,'0');});} return sortValue;},{key:function(args){return Ox.typeOf(args[0])+' '+args[0];}});Ox.sort=function(array,map){return array.sort(function(a,b){a=getSortValue(map?map(a):a);b=getSortValue(map?map(b):b);return ab?1:0;});};Ox.sortBy=function(array,by,map){var sortValues={};by=Ox.makeArray(by).map(function(value){return Ox.isString(value)?{key:value.replace(/^[\+\-]/,''),operator:value[0]=='-'?'-':'+'}:value;});map=map||{};return array.sort(function(a,b){var aValue,bValue,index=0,key,ret=0;while(ret==0&&indexbValue){ret=by[index].operator=='+'?1:-1;}else{index++;}} return ret;});};}());Ox.toArray=function(collection){return Ox.slice(collection);};try{Array.prototype.slice.call(document.getElementsByTagName('a'));}catch(error){Ox.toArray=function(collection){var i,length,ret=[];try{ret=Ox.slice(collection);}catch(error){length=collection.length;for(i=0;i ').map(function(point){return point.replace(',',':').split(':').reduce(function(previous,current,index){return previous+parseInt(current,10)*[3600,60,1,0.001][index];},0);});if(fps){points=points.map(function(point){return Math.round(point*fps)/fps;});} return{'in':points[0],out:points[1],text:lines.join('\n')};});};Ox.parseURL=(function(){var a=document.createElement('a'),keys=['hash','host','hostname','origin','pathname','port','protocol','search'];return function(string){var ret={};a.href=string;keys.forEach(function(key){ret[key]=a[key];});return ret;};}());Ox.parseUserAgent=function(userAgent){var aliases={browser:{'Firefox':/(Fennec|Firebird|Iceweasel|Minefield|Namoroka|Phoenix|SeaMonkey|Shiretoko)/},system:{'BSD':/(FreeBSD|NetBSD|OpenBSD)/,'Linux':/(CrOS|MeeGo|webOS)/,'Unix':/(AIX|HP-UX|IRIX|SunOS)/}},names={browser:{'chromeframe':'Chrome Frame','MSIE':'Internet Explorer'},system:{'CPU OS':'iOS','iPhone OS':'iOS','Macintosh':'Mac OS X'}},regexps={browser:[/(Camino)\/(\d+)/,/(chromeframe)\/(\d+)/,/(Chrome)\/(\d+)/,/(Epiphany)\/(\d+)/,/(Firefox)\/(\d+)/,/(Galeon)\/(\d+)/,/(Googlebot)\/(\d+)/,/(Konqueror)\/(\d+)/,/(MSIE) (\d+)/,/(Netscape)\d?\/(\d+)/,/(NokiaBrowser)\/(\d+)/,/(Opera) (\d+)/,/(Opera)\/.+Version\/(\d+)/,/Version\/(\d+).+(Safari)/],system:[/(Android) (\d+)/,/(BeOS)/,/(BlackBerry) (\d+)/,/(Darwin)/,/(BSD) (FreeBSD|NetBSD|OpenBSD)/,/(CPU OS) (\d+)/,/(iPhone OS) (\d+)/,/(Linux).+(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS)/,/(CentOS|CrOS|Debian|Fedora|Gentoo|Mandriva|MeeGo|Mint|Red Hat|SUSE|Ubuntu|webOS).+(Linux)/,/(Linux)/,/(Mac OS X) (10.\d)/,/(Mac OS X)/,/(Macintosh)/,/(SymbianOS)\/(\d+)/,/(SymbOS)/,/(OS\/2)/,/(Unix) (AIX|HP-UX|IRIX|SunOS)/,/(Unix)/,/(Windows) (NT \d\.\d)/,/(Windows) (95|98|2000|2003|ME|NT|XP)/,/(Windows).+(Win 9x 4\.90)/,/(Windows).+(Win9\d)/,/(Windows).+(WinNT4.0)/]},versions={browser:{},system:{'10.0':'10.0 (Cheetah)','10.1':'10.1 (Puma)','10.2':'10.2 (Jaguar)','10.3':'10.3 (Panther)','10.4':'10.4 (Tiger)','10.5':'10.5 (Leopard)','10.6':'10.6 (Snow Leopard)','10.7':'10.7 (Lion)','10.8':'10.8 (Mountain Lion)','CrOS':'Chrome OS','NT 4.0':'NT 4.0 (Windows NT)','NT 4.1':'NT 4.1 (Windows 98)','Win 9x 4.90':'NT 4.9 (Windows ME)','NT 5.0':'NT 5.0 (Windows 2000)','NT 5.1':'NT 5.1 (Windows XP)','NT 5.2':'NT 5.2 (Windows 2003)','NT 6.0':'NT 6.0 (Windows Vista)','NT 6.1':'NT 6.1 (Windows 7)','NT 6.2':'NT 6.2 (Windows 8)','95':'NT 4.0 (Windows 95)','NT':'NT 4.0 (Windows NT)','98':'NT 4.1 (Windows 98)','ME':'NT 4.9 (Windows ME)','2000':'NT 5.0 (Windows 2000)','2003':'NT 5.2 (Windows 2003)','XP':'NT 5.1 (Windows XP)','Win95':'NT 4.0 (Windows 95)','WinNT4.0':'NT 4.0 (Windows NT)','Win98':'NT 4.1 (Windows 98)'}},userAgentData={};Ox.forEach(regexps,function(regexps,key){userAgentData[key]={name:'',string:'',version:''};Ox.forEach(aliases[key],function(regexp,alias){userAgent=userAgent.replace(regexp,key=='browser'?alias:alias+' $1');});Ox.forEach(regexps,function(regexp){var matches=userAgent.match(regexp),name,string,swap,version;if(matches){matches[2]=matches[2]||'';swap=matches[1].match(/^\d/)||matches[2]=='Linux';name=matches[swap?2:1];version=matches[swap?1:2].replace('_','.');name=names[key][name]||name,version=versions[key][version]||version;string=name;if(version){string+=' '+(['BSD','Linux','Unix'].indexOf(name)>-1?'('+version+')':version)} userAgentData[key]={name:names[name]||name,string:string,version:versions[version]||version};return false;}});});return userAgentData;};Ox.repeat=function(value,times){var ret;if(Ox.isArray(value)){ret=[];Ox.loop(times,function(){ret=ret.concat(value);});}else{ret=times>=1?new Array(times+1).join(value.toString()):'';} return ret;};Ox.splice=function(string,index,remove){var array=string.split('');Array.prototype.splice.apply(array,Ox.slice(arguments,1));return array.join('');};Ox.startsWith=function(string,substring){string=string.toString();substring=substring.toString();return string.slice(0,substring.length)==substring;};Ox.toCamelCase=function(string){return string.replace(/[\-\/_][a-z]/g,function(string){return string[1].toUpperCase();});};Ox.toDashes=function(string){return string.replace(/[A-Z]/g,function(string){return'-'+string.toLowerCase();});};Ox.toSlashes=function(string){return string.replace(/[A-Z]/g,function(string){return'/'+string.toLowerCase();});};Ox.toTitleCase=function(string){return string.split(' ').map(function(value){var substring=value.slice(1),lowercase=substring.toLowerCase();if(substring==lowercase){value=value.slice(0,1).toUpperCase()+lowercase;} return value;}).join(' ');};Ox.toUnderscores=function(string){return string.replace(/[A-Z]/g,function(string){return'_'+string.toLowerCase();});};Ox.truncate=function(string,position,length,padding){var hasPosition=Ox.isString(arguments[1]),last=Ox.last(arguments);position=hasPosition?arguments[1]:'right';length=hasPosition?arguments[2]:arguments[1];padding=Ox.isString(last)?last:'…';if(string.length>length){if(position=='left'){string=padding +string.slice(padding.length+string.length-length);}else if(position=='center'){string=string.slice(0,Math.ceil((length-padding.length)/2)) +padding +string.slice(-Math.floor((length-padding.length)/2));}else if(position=='right'){string=string.slice(0,length-padding.length)+padding;}} return string;};Ox.words=function(string){var array=string.toLowerCase().split(/\b/),length=array.length,startsWithWord=/\w/.test(array[0]);array.forEach(function(v,i){if(i>0&&i1){max=Ox.max(words.map(function(word){return word.length;}));while(length>max){if(Ox.wordwrap(string,--length,newline).split(newline).length>lines.length){length++;break;}}}} lines=[''];words.forEach(function(word){var index;if((lines[lines.length-1]+word).length<=length){lines[lines.length-1]+=word+' ';}else{if(word.length<=length){lines.push(word+' ');}else{index=length-lines[lines.length-1].length;lines[lines.length-1]+=word.slice(0,index);while(index-1;};Ox.count=function(collection,value){var count={};Ox.forEach(collection,function(value){count[value]=(count[value]||0)+1;});return value?count[value]||0:count;};Ox.every=function(collection,iterator){return Ox.filter(Ox.values(collection),iterator||Ox.identity).length==Ox.len(collection);};Ox.filter=function(collection,iterator,that){var ret,type=Ox.typeOf(collection);iterator=iterator||Ox.identity;if(type=='object'||type=='storage'){ret={};Ox.forEach(collection,function(value,key){if(iterator.call(that,value,key,collection)){ret[key]=value;}});}else{ret=Ox.toArray(collection).filter(iterator,that);if(type=='string'){ret=ret.join('');}} return ret;};Ox.forEach=function(collection,iterator,that){var i=0,key,type=Ox.typeOf(collection);if(type=='object'||type=='storage'){for(key in collection){if(Ox.hasOwn(collection,key)&&iterator.call(that,collection[key],key,collection)===false){break;} i++;}}else{collection=Ox.toArray(collection);for(i=0;i0;};Ox.sum=function(collection){var ret=0;collection=arguments.length>1?Ox.toArray(arguments):collection;Ox.forEach(collection,function(value){value=+value;ret+=isFinite(value)?value:0;});return ret;};Ox.values=function(collection){var ret,type=Ox.typeOf(collection);if(type=='array'){ret=Ox.clone(collection);}else if(type=='object'||type=='storage'){ret=[];Ox.forEach(collection,function(value){ret.push(value);});}else if(type=='string'){ret=collection.split('');} return ret;};Ox.walk=function(collection,iterator,that,keys){keys=keys||[];Ox.forEach(collection,function(value,key){var keys_=keys.concat(key);iterator.call(that,value,keys_,collection);Ox.walk(collection[key],iterator,that,keys_);});};'use strict';Ox.acosh=function(x){return Math.log(x+Math.sqrt(x*x-1));};Ox.asinh=function(x){return Math.log(x+Math.sqrt(x*x+1));};Ox.atanh=function(x){return 0.5*Math.log((1+x)/(1-x));};Ox.cosh=function(x){return(Math.exp(x)+Math.exp(-x))/2;};Ox.deg=function(rad){return rad*180/Math.PI;};Ox.hypot=function(x,y,z){z=z||0;return Math.sqrt(x*x+y*y+z*z)||0;};Ox.limit=function(){var number=arguments[0],min=arguments.length==3?arguments[1]:-Infinity,max=arguments[arguments.length-1];return Math.min(Math.max(number,min),max);};Ox.log=function(number,base){return Math.log(number)/Math.log(base||Math.E);};Ox.mod=function(number,by){return(number%by+by)%by;};Ox.rad=function(deg){return deg*Math.PI/180;};Ox.random=function(){var min=arguments.length==2?arguments[0]:0,max=arguments.length?Ox.last(arguments):2;return min+Math.floor(Math.random()*(max-min));};Ox.round=function(number,decimals){var pow=Math.pow(10,decimals||0);return Math.round(number*pow)/pow;};Ox.sign=function(x){x=+x;return x!==x||x===0?x:x<0?-1:1;};Ox.sinh=function(x){return(Math.exp(x)-Math.exp(-x))/2;};Ox.splitInt=function(number,by){var div=Math.floor(number/by),mod=number%by;return Ox.range(by).map(function(i){return div+(i>by-1-mod);});};Ox.tanh=function(x){return(Math.exp(x)-Math.exp(-x))/(Math.exp(x)+Math.exp(-x));};Ox.trunc=function(x){return~~x;};'use strict';(function(){function asyncMap(forEach,collection,iterator,that,callback){var type=Ox.typeOf(collection),results=type=='object'?{}:[];callback=Ox.last(arguments);that=arguments.length==5?that:null;forEach(collection,function(value,key,collection,callback){iterator(value,key,collection,function(value){results[key]=value;callback();});},that,function(){callback(type=='string'?results.join(''):results);});};Ox.asyncMap=function(array,iterator,that,callback){array=Ox.makeArray(array);callback=Ox.last(arguments);that=arguments.length==4?that:null;if(array.some(Ox.isArray)){Ox.serialMap(array,function(value,key,array,callback){Ox.parallelMap(Ox.makeArray(value),iterator,callback);},callback);}else{Ox.parallelMap(array,iterator,callback);}};Ox.nonblockingForEach=function(collection,iterator,that,callback,ms){var i=0,keys,last=Ox.last(arguments),n,time,type=Ox.typeOf(collection);callback=Ox.isFunction(last)?last:arguments[arguments.length-2];collection=type=='array'||type=='object'?collection:Ox.toArray(collection);keys=type=='object'?Object.keys(collection):Ox.range(collection.length);ms=ms||1000;n=Ox.len(collection);that=arguments.length==5||(arguments.length==4&&Ox.isFunction(last))?that:null;time=+new Date();iterate();function iterate(){Ox.forEach(keys.slice(i),function(key){if(key in collection){if(iterator.call(that,collection[key],key,collection)===false){i=n;return false;}} i++;if(+new Date()>=time+ms){return false;}});if(i1){v3--;} if(v3<1/6){rgb[i]=v1+((v2-v1)*6*v3);}else if(v3<0.5){rgb[i]=v2;}else if(v3<2/3){rgb[i]=v1+((v2-v1)*6*(2/3-v3));}else{rgb[i]=v1;}});} return rgb.map(function(value){return Math.round(value*255);});};Ox.toHex=function(rgb){return rgb.map(function(value){return Ox.pad(value.toString(16).toUpperCase(),'left',2,'0');}).join('');};Ox.toRGB=function(hex){return Ox.range(3).map(function(index){return parseInt(hex.substr(index*2,2),16);});};'use strict';Ox.AMPM=['AM','PM'];Ox.BASE_32_ALIASES={'I':'1','L':'1','O':'0','U':'V'},Ox.BASE_32_DIGITS='0123456789ABCDEFGHJKMNPQRSTVWXYZ';Ox.BCAD=['BC','AD'];Ox.EARTH_RADIUS=6378137;Ox.EARTH_CIRCUMFERENCE=2*Math.PI*Ox.EARTH_RADIUS;Ox.EARTH_SURFACE=4*Math.PI*Math.pow(Ox.EARTH_RADIUS,2);Ox.HTML_ENTITIES={'"':'"','&':'&',"'":''','<':'<','>':'>'};Ox.KEYS={0:'section',8:'backspace',9:'tab',12:'clear',13:'enter',16:'shift',17:'control',18:'alt',20:'capslock',27:'escape',32:'space',33:'pageup',34:'pagedown',35:'end',36:'home',37:'left',38:'up',39:'right',40:'down',45:'insert',46:'delete',47:'help',48:'0',49:'1',50:'2',51:'3',52:'4',53:'5',54:'6',55:'7',56:'8',57:'9',65:'a',66:'b',67:'c',68:'d',69:'e',70:'f',71:'g',72:'h',73:'i',74:'j',75:'k',76:'l',77:'m',78:'n',79:'o',80:'p',81:'q',82:'r',83:'s',84:'t',85:'u',86:'v',87:'w',88:'x',89:'y',90:'z',91:'meta.left',92:'meta.right',93:'meta.right',96:'0.numpad',97:'1.numpad',98:'2.numpad',99:'3.numpad',100:'4.numpad',101:'5.numpad',102:'6.numpad',103:'7.numpad',104:'8.numpad',105:'9.numpad',106:'asterisk.numpad',107:'plus.numpad',109:'minus.numpad',108:'enter.numpad',110:'dot.numpad',111:'slash.numpad',112:'f1',113:'f2',114:'f3',115:'f4',116:'f5',117:'f6',118:'f7',119:'f8',120:'f9',121:'f10',122:'f11',123:'f12',124:'f13',125:'f14',126:'f15',127:'f16',128:'f17',129:'f18',130:'f19',131:'f20',144:'numlock',145:'scrolllock',186:'semicolon',187:'equal',188:'comma',189:'minus',190:'dot',191:'slash',192:'backtick',219:'openbracket',220:'backslash',221:'closebracket',222:'quote',224:'meta'},Ox.MAX_LATITUDE=Ox.deg(Math.atan(Ox.sinh(Math.PI)));Ox.MIN_LATITUDE=-Ox.MAX_LATITUDE;Ox.MODIFIER_KEYS={altKey:'alt',ctrlKey:'control',shiftKey:'shift',metaKey:'meta'} Ox.MONTHS=['January','February','March','April','May','June','July','August','September','October','November','December'];Ox.SHORT_MONTHS=Ox.MONTHS.map(function(val){return val.slice(0,3);});Ox.PATH=Ox.toArray(document.getElementsByTagName('script')).reverse().filter(function(element){return/Ox\.js$/.test(element.src);})[0].src.replace(/Ox\.js$/,'');Ox.PREFIXES=['','K','M','G','T','P'];Ox.SEASONS=['Winter','Spring','Summer','Fall'];Ox.STACK_SIZE=65536;Ox.SYMBOLS={DOLLAR:'\u0024',CENT:'\u00A2',POUND:'\u00A3',CURRENCY:'\u00A4',YEN:'\u00A5',BULLET:'\u2022',ELLIPSIS:'\u2026',PERMILLE:'\u2030',COLON:'\u20A1',CRUZEIRO:'\u20A2',FRANC:'\u20A3',LIRA:'\u20A4',NAIRA:'\u20A6',PESETA:'\u20A7',WON:'\u20A9',SHEQEL:'\u20AA',DONG:'\u20AB',EURO:'\u20AC',KIP:'\u20AD',TUGRIK:'\u20AE',DRACHMA:'\u20AF',PESO:'\u20B1',GUARANI:'\u20B2',AUSTRAL:'\u20B3',HRYVNIA:'\u20B4',CEDI:'\u20B5',TENGE:'\u20B8',RUPEE:'\u20B9',CELSIUS:'\u2103',FAHRENHEIT:'\u2109',POUNDS:'\u2114',OUNCE:'\u2125',OHM:'\u2126',KELVIN:'\u212A',ANGSTROM:'\u212B',INFO:'\u2139',LEFT:'\u2190',UP:'\u2191',RIGHT:'\u2192',DOWN:'\u2193',HOME:'\u2196',END:'\u2198',RETURN:'\u21A9',REDO:'\u21BA',UNDO:'\u21BB',PAGEUP:'\u21DE',PAGEDOWN:'\u21DF',CAPSLOCK:'\u21EA',TAB:'\u21E5',SHIFT:'\u21E7',INFINITY:'\u221E',CONTROL:'\u2303',COMMAND:'\u2318',ENTER:'\u2324',ALT:'\u2325',DELETE:'\u2326',CLEAR:'\u2327',BACKSPACE:'\u232B',OPTION:'\u2387',NAVIGATE:'\u2388',ESCAPE:'\u238B',EJECT:'\u23CF',SPACE:'\u2423',DIAMOND:'\u25C6',STAR:'\u2605',SOUND:'\u266B',TRASH:'\u267A',FLAG:'\u2691',ANCHOR:'\u2693',GEAR:'\u2699',ATOM:'\u269B',WARNING:'\u26A0',CUT:'\u2702',BACKUP:'\u2707',FLY:'\u2708',CHECK:'\u2713',CLOSE:'\u2715',BALLOT:'\u2717',WINDOWS:'\u2756',EDIT:'\uF802',CLICK:'\uF803',APPLE:'\uF8FF'};Ox.VERSION='0.1.2612';Ox.WEEKDAYS=['Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'];Ox.SHORT_WEEKDAYS=Ox.WEEKDAYS.map(function(val){return val.slice(0,3);});'use strict';Ox.$=Ox.element=function(value){var element=!Ox.isString(value)?value:value[0]=='<'?document.createElement(value.slice(1,-1)):value[0]=='#'?document.getElementById(value.slice(1)):value[0]=='.'?document.getElementsByClassName(value.slice(1))[0]:document.getElementsByTagName(value)[0];return element?{0:element,addClass:function(string){this[0].className=Ox.unique(((this[0].className?this[0].className+' ':'')+Ox.clean(string)).split(' ')).join(' ');return this;},append:function(){var that=this;Ox.makeArray(arguments[0]).forEach(function(element){that[0].appendChild(element[0]);});return this;},appendTo:function(element){element[0].appendChild(this[0]);return this;},attr:function(){var ret,that=this;if(arguments.length==1&&Ox.isString(arguments[0])){ret=this[0].getAttribute(arguments[0]);if(ret===null){ret=void 0;}}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){that[0].setAttribute(key,value);});ret=this;} return ret;},css:function(){var ret,that=this;if(arguments.length==1&&Ox.isString(arguments[0])){ret=this[0].style[arguments[0]];}else{Ox.forEach(Ox.makeObject(arguments),function(value,key){that[0].style[key]=value;});ret=this;} return ret;},empty:function(){return this.html('');},hasClass:function(string){return this[0].className.split(' ').indexOf(string)>-1;},height:function(){return this[0].offsetHeight;},hide:function(){return this.css({display:'none'});},html:function(string){var ret;if(arguments.length==0){ret=this[0].innerHTML;}else{this[0].innerHTML=string;ret=this;} return ret;},on:function(){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){that[0].addEventListener(event,callback,false);});return this;},one:function(events){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){that.on(event,function fn(){that.off(event,fn);callback();});});return this;},off:function(event,callback){var that=this;Ox.forEach(Ox.makeObject(arguments),function(callback,event){if(callback){that[0].removeEventListener(event,callback,false);}else{that[0]['on'+event]=null;}});return this;},remove:function(){this[0].parentNode.removeChild(this[0]);return this;},removeAttr:function(){var that=this;Ox.makeArray(arguments[0]).forEach(function(key){that[0].removeAttribute(key);});return this;},removeClass:function(string){var array=Ox.clean(string).split(' ');this[0].className=this[0].className.split(' ').filter(function(className){return array.indexOf(className)==-1;}).join(' ');return this;},show:function(){return this.css({display:'block'});},toggleClass:function(string){return this[this.hasClass(string)?'removeClass':'addClass'](string);},trigger:function(event){var e=document.createEvent('MouseEvents');e.initEvent(event,true,true);this[0].dispatchEvent(e);return this;},val:function(value){var ret;if(arguments.length==0){ret=this[0].value;}else{this[0].value=value;ret=this;} return ret;},width:function(){return this[0].offsetWidth;}}:null;};Ox.canvas=function(){var c={},isImage=arguments.length==1,image=isImage?arguments[0]:{width:arguments[0],height:arguments[1]};c.context=(c.canvas=Ox.$('').attr({width:image.width,height:image.height})[0]).getContext('2d');isImage&&c.context.drawImage(image,0,0);c.data=(c.imageData=c.context.getImageData(0,0,image.width,image.height)).data;return c;};Ox.documentReady=(function(){var callbacks=[];document.onreadystatechange=window.onload=function(){if(document.readyState=='complete'){callbacks.forEach(function(callback){callback();});document.onreadystatechange=window.onload=null;}};return function(callback){if(document.readyState=='complete'){callback();return true;}else{callbacks.push(callback);return false;}};}());'use strict';Ox.getDateInWeek=function(date,weekday,utc){date=Ox.makeDate(date);var sourceWeekday=Ox.getISODay(date,utc),targetWeekday=Ox.isNumber(weekday)?weekday:Ox.indexOf(Ox.WEEKDAYS,function(v){return v.slice(0,3)==weekday.slice(0,3);})+1;return Ox.setDate(date,Ox.getDate(date,utc)-sourceWeekday+targetWeekday,utc);} Ox.getDayOfTheYear=function(date,utc){date=Ox.makeDate(date);var month=Ox.getMonth(date,utc),year=Ox.getFullYear(date,utc);return Ox.sum(Ox.range(month).map(function(i){return Ox.getDaysInMonth(year,i+1);}))+Ox.getDate(date,utc);};Ox.getDaysInMonth=function(year,month){year=Ox.makeYear(year);month=Ox.isNumber(month)?month:Ox.indexOf(Ox.MONTHS,function(v){return v.slice(0,3)==month.slice(0,3);})+1;return new Date(year,month,0).getDate();} Ox.getDaysInYear=function(year,utc){return 365+Ox.isLeapYear(Ox.makeYear(year,utc));};Ox.getFirstDayOfTheYear=function(date,utc){date=Ox.makeDate(date);date=Ox.setMonth(date,0,utc);date=Ox.setDate(date,1,utc);return Ox.getDay(date,utc)};Ox.getISODate=function(date,utc){return Ox.formatDate(Ox.makeDate(date),'%FT%TZ',utc);};Ox.getISODay=function(date,utc){return Ox.getDay(Ox.makeDate(date),utc)||7;};Ox.getISOWeek=function(date,utc){date=Ox.makeDate(date);return Math.floor((Ox.getDayOfTheYear(Ox.setDate(date,Ox.getDate(date,utc)-Ox.getISODay(date,utc)+4,utc),utc)-1)/7)+1;};Ox.getISOYear=function(date,utc){date=Ox.makeDate(date);return Ox.getFullYear(Ox.setDate(date,Ox.getDate(date,utc)-Ox.getISODay(date,utc)+4,utc));};Ox.getTime=function(utc){return+new Date()-(utc?Ox.getTimezoneOffset():0);};Ox.getTimezoneOffset=function(date){return Ox.makeDate(date).getTimezoneOffset()*60000;};Ox.getTimezoneOffsetString=function(date){var offset=Ox.makeDate(date).getTimezoneOffset();return(offset<=0?'+':'-') +Ox.pad(Math.floor(Math.abs(offset)/60),2) +Ox.pad(Math.abs(offset)%60,2);};Ox.getWeek=function(date,utc){date=Ox.makeDate(date);return Math.floor((Ox.getDayOfTheYear(date,utc) +Ox.getFirstDayOfTheYear(date,utc)-1)/7);};Ox.isLeapYear=function(year,utc){year=Ox.makeYear(year,utc);return year%4==0&&(year%100!=0||year%400==0);};Ox.makeDate=function(date){return Ox.isUndefined(date)?new Date():new Date(date);};Ox.makeYear=function(date,utc){return Ox.isDate(date)?Ox.getFullYear(date,utc):parseInt(date,10);};Ox.parseDate=function(string,utc){var date,defaults=[,1,1,0,0,0,0],values=/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?\.?(\d+)?/.exec(string);if(values){values.shift();date=new Date();values=values.map(function(v,i){return v?(i==6?Ox.pad(v,3,'0'):v):defaults[i];});values[1]--;['FullYear','Month','Date','Hours','Minutes','Seconds','Milliseconds'].forEach(function(part,i){Ox['set'+part](date,values[i],utc);});}else{date=null;} return date;};['FullYear','Month','Date','Day','Hours','Minutes','Seconds','Milliseconds'].forEach(function(part){Ox['get'+part]=function(date,utc){return Ox.makeDate(date)['get'+(utc?'UTC':'')+part]();} Ox['set'+part]=function(date,num,utc){return(Ox.isDate(date)?date:new Date(date))['set'+(utc?'UTC':'')+part](num);}});'use strict';Ox.encodeBase26=function(number){var string='';while(number){string=String.fromCharCode(65+(number-1)%26)+string;number=Math.floor((number-1)/26);} return string;};Ox.decodeBase26=function(string){return string.toUpperCase().split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)-64)*Math.pow(26,i);},0);};Ox.encodeBase32=function(number){return Ox.map(number.toString(32),function(char){return Ox.BASE_32_DIGITS[parseInt(char,32)];});};Ox.decodeBase32=function(string){return parseInt(Ox.map(string.toUpperCase(),function(char){var index=Ox.BASE_32_DIGITS.indexOf(Ox.BASE_32_ALIASES[char]||char);return index==-1?' ':index.toString(32);}),32);};Ox.encodeBase64=function(number){return btoa(Ox.encodeBase256(number)).replace(/=/g,'');};Ox.decodeBase64=function(string){return Ox.decodeBase256(atob(string));};Ox.encodeBase128=function(number){var string='';while(number){string=Ox.char(number&127)+string;number>>=7;} return string;};Ox.decodeBase128=function(string){return string.split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)<>=8;} return string;};Ox.decodeBase256=function(string){return string.split('').reverse().reduce(function(p,c,i){return p+(c.charCodeAt(0)<>6|192) +String.fromCharCode(code&63|128);}else{string=String.fromCharCode(code>>12|224) +String.fromCharCode(code>>6&63|128) +String.fromCharCode(code&63|128);} return string;});};Ox.decodeUTF8=function(string){var code,i=0,length=string.length,ret='';function error(byte,position){throw new RangeError('UTF-8 codec can\'t decode byte 0x'+byte.toString(16).toUpperCase()+' at position '+position);} while(i=192&&code[0]<240&&i=128&&code[1]<192){if(code[0]<224){ret+=String.fromCharCode((code[0]&31)<<6|code[1]&63);i+=2;}else if(code[2]>=128&&code[2]<192){ret+=String.fromCharCode((code[0]&15)<<12|(code[1]&63)<<6|code[2]&63);i+=3;}else{error(code[2],i+2);}}else{error(code[1],i+1);}}else{error(code[0],i);}} return ret;};'use strict';Ox.formatArea=function(number,decimals){var k=number>=1000000?'k':'';decimals=Ox.isUndefined(decimals)?8:decimals;return Ox.formatNumber((k?number/1000000:number).toPrecision(decimals))+' '+k+'m\u00B2';};Ox.formatCount=function(number,singular,plural){return(number===0?'no':Ox.formatNumber(number))+' ' +(number===1?singular:plural||singular+'s');};Ox.formatCurrency=function(number,string,decimals){return string+Ox.formatNumber(number,decimals);};(function(){var format=[['%',function(){return'%{%}';}],['c',function(){return'%D %r';}],['D',function(){return'%m/%d/%y';}],['F',function(){return'%Y-%m-%d';}],['h',function(){return'%b';}],['R',function(){return'%H:%M';}],['r',function(){return'%I:%M:%S %p';}],['T',function(){return'%H:%M:%S';}],['v',function(){return'%e-%b-%Y';}],['\\+',function(){return'%a %b %e %H:%M:%S %Z %Y';}],['A',function(date,utc){return Ox.WEEKDAYS[(Ox.getDay(date,utc)+6)%7];}],['a',function(date,utc){return Ox.SHORT_WEEKDAYS[(Ox.getDay(date,utc)+6)%7];}],['B',function(date,utc){return Ox.MONTHS[Ox.getMonth(date,utc)];}],['b',function(date,utc){return Ox.SHORT_MONTHS[Ox.getMonth(date,utc)];}],['C',function(date,utc){return Math.floor(Ox.getFullYear(date,utc)/100).toString();}],['d',function(date,utc){return Ox.pad(Ox.getDate(date,utc),2);}],['e',function(date,utc){return Ox.pad(Ox.getDate(date,utc),2,' ');}],['G',function(date,utc){return Ox.getISOYear(date,utc);}],['g',function(date,utc){return Ox.getISOYear(date,utc).toString().slice(-2);}],['H',function(date,utc){return Ox.pad(Ox.getHours(date,utc),2);}],['I',function(date,utc){return Ox.pad((Ox.getHours(date,utc)+11)%12+1,2);}],['j',function(date,utc){return Ox.pad(Ox.getDayOfTheYear(date,utc),3);}],['k',function(date,utc){return Ox.pad(Ox.getHours(date,utc),2,' ');}],['l',function(date,utc){return Ox.pad(((Ox.getHours(date,utc)+11)%12+1),2,' ');}],['M',function(date,utc){return Ox.pad(Ox.getMinutes(date,utc),2);}],['m',function(date,utc){return Ox.pad((Ox.getMonth(date,utc)+1),2);}],['p',function(date,utc){return Ox.AMPM[Math.floor(Ox.getHours(date,utc)/12)];}],['Q',function(date,utc){return Math.floor(Ox.getMonth(date,utc)/4)+1;}],['S',function(date,utc){return Ox.pad(Ox.getSeconds(date,utc),2);}],['s',function(date,utc){return Math.floor((+date-(utc?Ox.getTimezoneOffset(date):0))/1000);}],['U',function(date,utc){return Ox.pad(Ox.getWeek(date,utc),2);}],['u',function(date,utc){return Ox.getISODay(date,utc);}],['V',function(date,utc){return Ox.pad(Ox.getISOWeek(date,utc),2);}],['W',function(date,utc){return Ox.pad(Math.floor((Ox.getDayOfTheYear(date,utc) +(Ox.getFirstDayOfTheYear(date,utc)||7)-2)/7),2);}],['w',function(date,utc){return Ox.getDay(date,utc);}],['X',function(date,utc){var y=Ox.getFullYear(date,utc);return Math.abs(y)+' '+Ox.BCAD[y<0?0:1];}],['x',function(date,utc){var y=Ox.getFullYear(date,utc);return Math.abs(y)+(y<1000?' '+Ox.BCAD[y<0?0:1]:'');}],['Y',function(date,utc){return Ox.getFullYear(date,utc);}],['y',function(date,utc){return Ox.getFullYear(date,utc).toString().slice(-2);}],['Z',function(date,utc){return utc?'UTC':(date.toString().split('(')[1]||'').replace(')','');}],['z',function(date,utc){return utc?'+0000':Ox.getTimezoneOffsetString(date);}],['n',function(){return'\n';}],['t',function(){return'\t';}],['\\{%\\}',function(){return'%';}]].map(function(value){return[new RegExp('%'+value[0],'g'),value[1]];});Ox.formatDate=function(date,string,utc){if(date===''){return'';} date=Ox.makeDate(date);format.forEach(function(value){string=string.replace(value[0],value[1](date,utc));});return string;};}());Ox.formatDateRange=function(start,end,utc){end=end||Ox.formatDate(new Date(),'%Y-%m-%d');var isOneUnit=false,range=[start,end],strings,dates=range.map(function(str){return Ox.parseDate(str,utc);}),parts=range.map(function(str){var parts=Ox.compact(/(-?\d+)-?(\d+)?-?(\d+)? ?(\d+)?:?(\d+)?:?(\d+)?/.exec(str));parts.shift();return parts.map(function(part){return parseInt(part,10);});}),precision=parts.map(function(parts){return parts.length;}),y=parts[0][0]<0?'%X':'%Y',formats=[y,'%B '+y,'%a, %b %e, '+y,'%a, %b %e, '+y+', %H:%M','%a, %b %e, '+y+', %H:%M','%a, %b %e, '+y+', %H:%M:%S',];if(precision[0]==precision[1]){isOneUnit=true;Ox.loop(precision[0],function(i){if((i1?'s':''):'';})).join(' ');};Ox.formatDegrees=function(degrees,mode){var days=0,seconds=Math.round(Math.abs(degrees)*3600),sign=degrees<0?'-':'',array=Ox.formatDuration(seconds).split(':');if(array.length==4){days=parseInt(array.shift(),10);} array[0]=days*24+parseInt(array[0],10);return(!mode?sign:'') +array[0]+'°'+array[1]+"'"+array[2]+'"' +(mode=='lat'?(degrees<0?'S':'N'):mode=='lng'?(degrees<0?'W':'E'):'');};Ox.formatDimensions=Ox.formatResolution=function(array,string){return array.join(' × ')+(string?' '+string:'');};Ox.formatDuration=function(seconds){var last=Ox.last(arguments),format=last=='short'||last=='long'?last:'none',decimals=Ox.isNumber(arguments[1])?arguments[1]:0,seconds=Ox.round(seconds,decimals),values=[Math.floor(seconds/31536000),Math.floor(seconds%31536000/86400),Math.floor(seconds%86400/3600),Math.floor(seconds%3600/60),Ox.formatNumber(seconds%60,decimals)],string=format=='short'?['y','d','h','m','s']:format=='long'?['year','day','hour','minute','second']:[],pad=[values[0].toString().length,values[0]?3:values[1].toString().length,2,2,decimals?decimals+3:2];while(!values[0]&&values.length>(format=='none'?3:1)){values.shift();string.shift();pad.shift();} return Ox.filter(Ox.map(values,function(value,index){var ret;if(format=='none'){ret=Ox.pad(value,'left',pad[index],'0');}else if(Ox.isNumber(value)?value:parseFloat(value)){ret=value+(format=='long'?' ':'')+string[index] +(format=='long'&&value!=1?'s':'');}else{ret='';} return ret;})).join(format=='none'?':':' ');};Ox.formatNumber=function(number,decimals){var array=[],abs=Math.abs(number),split=abs.toFixed(decimals).split('.');while(split[0]){array.unshift(split[0].slice(-3));split[0]=split[0].slice(0,-3);} split[0]=array.join(',');return(number<0?'-':'')+split.join('.');};Ox.formatOrdinal=function(number){var string=Ox.formatNumber(number),length=string.length,last=string[length-1],ten=length>1&&string[length-2]=='1';if(last=='1'&&!ten){string+='st';}else if(last=='2'&&!ten){string+='nd';}else if(last=='3'&&!ten){string+='rd';}else{string+='th';} return string;};Ox.formatPercent=function(number,total,decimals){return Ox.formatNumber(number/total*100,decimals)+'%'};Ox.formatRoman=function(number){var string='';Ox.forEach({M:1000,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1},function(value,roman){while(number>=value){string+=roman;number-=value;}});return string;};Ox.formatString=function(string,collection){return string.replace(/\{([^}]+)\}/g,function(string,match){return collection[match];});};Ox.formatUnit=function(number,string,decimals){return Ox.formatNumber(number,decimals) +(/^[:%]/.test(string)?'':' ')+string;};Ox.formatValue=function(number,string,bin){var base=bin?1024:1000,length=Ox.PREFIXES.length,ret;Ox.forEach(Ox.PREFIXES,function(prefix,index){if(numberpointB.lng;};Ox.getArea=function(pointA,pointB){if(Ox.crossesDateline(pointA,pointB)){pointB.lng+=360;} pointA=rad(pointA);pointB=rad(pointB);return Math.pow(Ox.EARTH_RADIUS,2)*Math.abs(Math.sin(pointA.lat)-Math.sin(pointB.lat))*Math.abs(pointA.lng-pointB.lng);};Ox.getBearing=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB),x=Math.cos(pointA.lat)*Math.sin(pointB.lat) -Math.sin(pointA.lat)*Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng),y=Math.sin(pointB.lng-pointA.lng)*Math.cos(pointB.lat);return(Ox.deg(Math.atan2(y,x))+360)%360;};Ox.getCenter=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB),x=Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng),y=Math.cos(pointB.lat)*Math.sin(pointB.lng-pointA.lng),d=Math.sqrt(Math.pow(Math.cos(pointA.lat)+x,2)+Math.pow(y,2)),lat=Math.atan2(Math.sin(pointA.lat)+Math.sin(pointB.lat),d),lng=pointA.lng+Math.atan2(y,Math.cos(pointA.lat)+x);return deg({lat:lat,lng:lng});};Ox.getCircle=function(center,radius,precision){return Ox.range(0,360,360/Math.pow(2,precision)).map(function(bearing){return Ox.getPoint(center,radius,bearing);});};Ox.getDegreesPerMeter=function(lat){return 360/Ox.EARTH_CIRCUMFERENCE/Math.cos(lat*Math.PI/180);};Ox.getDistance=function(pointA,pointB){var pointA=rad(pointA),pointB=rad(pointB);return Math.acos(Math.sin(pointA.lat)*Math.sin(pointB.lat) +Math.cos(pointA.lat)*Math.cos(pointB.lat)*Math.cos(pointB.lng-pointA.lng))*Ox.EARTH_RADIUS;};Ox.getLatLngByXY=function(xy){function getValue(value){return(value-0.5)*2*Math.PI;} return{lat:-Ox.deg(Math.atan(Ox.sinh(getValue(xy.y)))),lng:Ox.deg(getValue(xy.x))};};Ox.getLine=function(pointA,pointB,precision){var line=[pointA,pointB],points;while(precision>0){points=[line[0]];Ox.loop(line.length-1,function(i){points.push(Ox.getCenter(line[i],line[i+1]),line[i+1]);});line=points;precision--;} return line;};Ox.getMetersPerDegree=function(lat){return Math.cos(lat*Math.PI/180)*Ox.EARTH_CIRCUMFERENCE/360;};Ox.getPoint=function(point,distance,bearing){var pointB={};point=rad(point);distance/=Ox.EARTH_RADIUS;bearing=Ox.rad(bearing);pointB.lat=Math.asin(Math.sin(point.lat)*Math.cos(distance) +Math.cos(point.lat)*Math.sin(distance)*Math.cos(bearing));pointB.lng=point.lng+Math.atan2(Math.sin(bearing)*Math.sin(distance)*Math.cos(point.lat),Math.cos(distance)-Math.sin(point.lat)*Math.sin(pointB.lat));return deg(pointB);};Ox.getXYByLatLng=function(latlng){function getValue(value){return(value/(2*Math.PI)+0.5);} return{x:getValue(Ox.rad(latlng.lng)),y:getValue(Ox.asinh(Math.tan(Ox.rad(-latlng.lat))))};};Ox.isPolar=function(point){return point.latOx.MAX_LATITUDE;};Ox.containsArea=function(areaA,areaB){var areas=[areaA,areaB].map(splitArea),ret;function contains(areaA,areaB){return areaA.sw.lat<=areaB.sw.lat&&areaA.sw.lng<=areaB.sw.lng&&areaA.ne.lat>=areaB.ne.lat&&areaA.ne.lng>=areaB.ne.lng;} Ox.forEach(areas[1],function(area1){Ox.forEach(areas[0],function(area0){ret=contains(area0,area1);return!ret;});return ret;});return ret;};Ox.intersectAreas=function(areas){var intersections,ret;areas=areas.map(splitArea);ret=areas[0];function intersect(areaA,areaB){return areaA.sw.lat>areaB.ne.lat||areaA.sw.lng>areaB.ne.lng||areaA.ne.latret.ne.lat){ret.ne.lat=area.ne.lat;} index=isContainedInGap(area);if(index>-1){gaps.push({sw:gaps[index].sw,ne:{lat:90,lng:area.sw.lng}});gaps.push({sw:{lat:-90,lng:area.ne.lng},ne:gaps[index].ne});gaps.splice(index,1);}else{indices=containsGaps(area);Ox.reverse(indices).forEach(function(index){gaps.splice(index,1);});intersections=intersectsWithGaps(area);Ox.forEach(intersections,function(intersection,index){gaps[index]={sw:{lat:-90,lng:gaps[index].sw.lng==intersection.sw.lng?intersection.ne.lng:gaps[index].sw.lng},ne:{lat:90,lng:gaps[index].ne.lng==intersection.ne.lng?intersection.sw.lng:gaps[index].ne.lng}};});}});if(gaps.length==0){ret.sw.lng=-180;ret.ne.lng=180;}else{gaps.sort(function(a,b){return(b.ne.lng +(Ox.crossesDateline(b.sw,b.ne)?360:0) -b.sw.lng)-(a.ne.lng +(Ox.crossesDateline(a.sw,a.ne)?360:0) -a.sw.lng);});ret.sw.lng=gaps[0].ne.lng;ret.ne.lng=gaps[0].sw.lng;} return ret;};}());'use strict';(function(){var defaultTags=['b','code','em','i','s','strong','sub','sup','u','blockquote','h1','h2','h3','p','pre','li','ol','ul','table','tbody','td','tfoot','th','thead','tr','a','br','img','rtl','[]'],htmlEntities={'"':'"','&':'&',"'":''','<':'<','>':'>'},regexp={entity:/&[^\s]+?;/g,html:/[<&]/,tag:new RegExp('<\\/?('+['a','b','br','code','i','s','span','u'].join('|')+')\\/?>','gi')},replace={a:[[/]*?href="((\/|https?:\/\/|mailto:).+?)".*?>/gi,'',],[/<\/a>/gi,'']],img:[[/]*?src="((\/|https?:\/\/).+?)".*?>/gi,'']],rtl:[[//gi,'
'],[/<\/rtl>/gi,'
']],'*':function(tag){return[[new RegExp('','gi'),'{0}']];}},salt=Ox.range(2).map(function(){return Ox.range(16).map(function(){return Ox.char(65+Ox.random(26));}).join('');});function addLinks(string,obfuscate){return string.replace(/\b((https?:\/\/|www\.).+?)([.,:;!?)\]]*?(\s|$))/gi,function(match,url,prefix,end){prefix=prefix.toLowerCase()=='www.'?'http://':'';return Ox.formatString('{url}{end}',{end:end,prefix:prefix,url:url});}).replace(/\b([0-9A-Z.+\-_]+@(?:[0-9A-Z\-]+\.)+[A-Z]{2,6})\b/gi,obfuscate?function(match,mail){return Ox.encodeEmailAddress(mail);}:'$1');} function decodeHTMLEntities(string){return string.replace(new RegExp('('+Ox.values(htmlEntities).join('|')+')','g'),function(match){return Ox.keyOf(htmlEntities,match);}).replace(/&#([0-9A-FX]+);/gi,function(match,code){return Ox.char(/^X/i.test(code)?parseInt(code.slice(1),16):parseInt(code,10));});}function splitHTMLTags(string,ignore){var isTag=false,ret=[''];ignore=ignore||[];Ox.forEach(string,function(char,i){if(!isTag&&char=='<'&&ignore.indexOf(i)==-1){isTag=true;ret.push('');} ret[ret.length-1]+=char;if(isTag&&char=='>'){isTag=false;ret.push('');}});return ret;};Ox.addLinks=function(string,isHTML){var isLink=false;return isHTML?splitHTMLTags(string).map(function(string,i){var isTag=i%2;if(isTag){if(/^'+parts[1]+'';};Ox.encodeHTMLEntities=function(string,encodeAll){return Ox.map(String(string),function(char){var code=char.charCodeAt(0);if(code<128){char=char in htmlEntities?htmlEntities[char]:char;}else if(encodeAll){char='&#x' +Ox.pad(code.toString(16).toUpperCase(),'left',4,'0') +';';} return char;});};Ox.decodeHTMLEntities=function(string,decodeAll){return decodeAll?Ox.decodeHTMLEntities(Ox.normalizeHTML(string)):decodeHTMLEntities(string);};Ox.highlight=function(string,query,classname,isHTML){if(!query){return string;} var cursor=0,entities=[],matches=[],offset=0,re=Ox.isRegExp(query)?query:new RegExp(Ox.escapeRegExp(query),'gi'),span=['',''],tags=[];function insert(array){array.forEach(function(v){string=Ox.splice(string,v.position,v.length,v.value);matches.forEach(function(match){if(v.position').html(html).html():html;};Ox.parseMarkdown=function(string){var array=[];return string.replace(/\r\n/g,'\n').replace(/\r/g,'\n').replace(/(?:^|\n)```(.*)\n([^`]+)\n```/g,function(match,classname,code){array.push('
'
+code.trim().replace(/
');return salt.join(array.length-1);}).replace(/(^|[^\\])(`+)([^\r]*?[^`])\2(?!`)/gm,function(match,prev,backticks,code,next){array.push(prev+'' +code.trim().replace(/');return salt.join(array.length-1);}).replace(/(\*\*|__)(?=\S)([^\r]*?\S[*_]*)\1/g,'$2').replace(/(\*|_)(?=\S)([^\r]*?\S)\1/g,'$2').replace(/(\[((?:\[[^\]]*\]|[^\[\]])*)\]\([ \t]*()?[ \t]*((['"])(.*?)\6[ \t]*)?\))/g,function(match,all,text,id,url,rest,quote,title){return''+text+'';}).replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,'$1').replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi,function(match,mail){return Ox.encodeEmailAddress(mail);}).replace(/\n\n/g,'

').replace(new RegExp(salt.join('(\\d+)'),'g'),function(match,index){return array[parseInt(index)];});};Ox.sanitizeHTML=function(html,tags){var matches=[];tags=tags||defaultTags;if(tags.indexOf('[]')>-1){html=html.replace(/\[((\/|https?:\/\/|mailto:).+?) (.+?)\]/gi,'$3');tags=tags.filter(function(tag){return tag!='[]';});} tags.forEach(function(tag){var array=replace[tag]||replace['*'](tag);Ox.forEach(array,function(value){html=html.replace(value[0],function(){matches.push(Ox.formatString(value[1],arguments));return salt.join(matches.length-1);});});});html=Ox.encodeHTMLEntities(Ox.decodeHTMLEntities(html));matches.forEach(function(match,i){html=html.replace(new RegExp(salt.join(i)),match);});html=Ox.addLinks(html,true);html=html.replace(/\n\n/g,'

');return Ox.normalizeHTML(html);};Ox.stripTags=function(string){return string.replace(/<.*?>/g,'');};}());'use strict';Ox.oshash=function(file,callback){var hash=fromString(file.size.toString());read(0);function add(A,B){var a,b,c,d;d=A[3]+B[3];c=A[2]+B[2]+(d>>16);d&=0xffff;b=A[1]+B[1]+(c>>16);c&=0xffff;a=A[0]+B[0]+(b>>16);b&=0xffff;a&=0xffff;return[a,b,c,d];} function fromData(s,offset){offset=offset||0;return[s.charCodeAt(offset+6)+(s.charCodeAt(offset+7)<<8),s.charCodeAt(offset+4)+(s.charCodeAt(offset+5)<<8),s.charCodeAt(offset+2)+(s.charCodeAt(offset+3)<<8),s.charCodeAt(offset+0)+(s.charCodeAt(offset+1)<<8)];} function fromString(str){var base=10,blen=1,i,num,pos,r=[0,0,0,0];for(pos=0;pos>>=16;} if(num){blen++;}}while(num);} return r;} function hex(h){return(Ox.pad(h[0].toString(16),'left',4,'0') +Ox.pad(h[1].toString(16),'left',4,'0') +Ox.pad(h[2].toString(16),'left',4,'0') +Ox.pad(h[3].toString(16),'left',4,'0')).toLowerCase();} function read(offset,last){var blob,block=65536,length=8,reader=new FileReader();reader.onload=function(data){var s=data.target.result,s_length=s.length-length,i;for(i=0;i<=s_length;i+=length){hash=add(hash,fromData(s,i));} if(file.size\s+(.+?)$/,multiline:/^\/\*\@.*?\n([\w\W]+)\n.*?\@?\*\/$/,script:/\n(\s*