-
Notifications
You must be signed in to change notification settings - Fork 0
/
core.min.js
1 lines (1 loc) · 17.1 KB
/
core.min.js
1
"use strict";function adicat(t){if("string"!=typeof t)throw new TypeError("argument must be a string");this.string={raw:t,clean:"",stripped:""},this.chars=t.length,this._processLevel=0,this._processTime={meta:-1,token:-1,cue:-1,cat:-1,display:-1}}var Adicat={patterns:{word_breaks:/\s/g,char:/[A-z0-9?><!@#$%^&*()_+|}{":;'\/.,-=\\\][\]]/,special:/[[\]()\/\\.?$*^]/g,stripped:/[^a-z0-9'\s]/g,filter:/[$#%^*\r\n\t\-~\\—–→\+=[\/({})\]]|\s"(?!\w)|\s\s/g,curly_quote:{s:/[‘’]/g,d:/[“”]/g},emojis:{smile:/(^|\s)(?:[<([{,]+[\s-.,]*[Xx;:8=]+|[Xx;:8=]+[\s-.,]*[>p3)}D\]]+)(?=\s|$)/g,smile_rev:/emjhface/g,frown:/(^|\s)(?:[>p3)}D\]]+[\s-.,]*[Xx;:8=]+|[Xx;:8=]+[\s-.,]*[<([{q]+)(?=\s|$)/g,frown_rev:/emjsface/g},symbols:{and:/\&/g,at:/\@/g},punct:{emdash:/—/g,endash:/–/g,initials:/(\.[A-z0-9]+\.(?=[\s.]))/g,apostrophe:/\.\'s/g,ellipses:/…|\.{3,}|\. +\. +[. ]+/g,titles:/(?:^|\s)(st|rd|ft|feat|dr|drs|mr|ms|mrs|messrs|jr|prof)\./gi,initial_trim:/\.$/g},space:/\s(?=[\s.,?!)}>\]])|^\s|\s$|\.—/g,returns:/[\r\n]/g,boundary:{sentence:/[?!.]+(?:[^A-z0-9]|$)/g,clause:/[.,:;?!(\)<>{}[\]]+(?:[^A-z0-9]|$)/g},cues:{question:/\?|\sw+h+a+[t\s]*\s|\sw+h+e+n+\s|\sw+h+o+\s|\show|\sa+[sk]{2}\s|\sh+u+h/,greeting:/\sh+i+[yi]*\s|\sh+[ae]+[iy]+\s|\sh+e+l+o+\s|\sy+o+\s|\sw+h+a+t+[']*(?:s|\sis)\s(?:shak|up)/,yes:/\sy+[ae]+s+\s|\sy+e+a+h+\s|\ss+u+r+[e\s]+|\su+h+u[hu\s]+\s|\sa+f+i+r+m|\sa+cc+e+p/,no:/\sn+o+\s|\sn+o+p+e+\s|\sd+e+c+l+i|\sr+e+j+e+c/,sad:/\semjsface\s|\sb+a+d+\s|\ss+a+d+\s|\sf+r+u+s+t+r|\sd+e+p+r+e+s|\st+e+r+i+b+l|\sh+o+r+i+b+l/,happy:/\semjhface\s|\sh+a+p+y+\s|\se+x+c+i+t|\sg+oo+d+\s|\sg+r+e+a+t+\s|\se+x+c+e+l+e+n+t|\ss+u+pe+r+\s|\sn+i+c+e+\s/},matches:{},dict:null,dict_cats:[],dict_proc:!1},liwc_means:{overall:{ppron:9.95,ipron:5.26,article:6.51,auxverb:8.53,adverb:5.27,prep:12.93,conj:5.9,negate:1.66,quant:2.02},blogs:{ppron:10.66,ipron:5.53,article:6,auxverb:8.75,adverb:5.88,prep:12.6,conj:6.43,negate:1.81,quant:2.27},expressive:{ppron:12.74,ipron:5.28,article:5.7,auxverb:9.25,adverb:6.02,prep:14.27,conj:7.46,negate:1.69,quant:2.35},novels:{ppron:10.35,ipron:4.79,article:8.35,auxverb:7.77,adverb:4.17,prep:14.27,conj:6.28,negate:1.68,quant:1.8},natural:{ppron:13.37,ipron:7.53,article:4.34,auxverb:12.03,adverb:7.67,prep:10.29,conj:6.21,negate:2.24,quant:1.93},nytimes:{ppron:3.56,ipron:3.84,article:9.08,auxverb:5.11,adverb:2.76,prep:14.27,conj:4.85,negate:.62,quant:1.94},twitter:{ppron:9.02,ipron:4.6,article:5.58,auxverb:8.27,adverb:5.13,prep:11.88,conj:4.19,negate:1.74,quant:1.85}},toRegex:function(t,e){var s,r,i,a,n=e?"\\s":"^",c=e?"\\s":"$",o=/^\^|\$$/g,p=e?/(?=\\s|\s)+\*|\*(?=\\s|\s)+/g:/\^\*|([^)\]])\*\$/g,h=e?"g":"",l=/(^|[^\\])[[(]/,d=/(^|[^\\])[)\]]/,u=/\s/g,m=e?"[^\\s]*":"$1";t&&"object"==typeof t&&(r=t.hasOwnProperty("length")),r&&(t={a:t});for(i in t)if(t.hasOwnProperty(i)&&!t[i].test){for(s||(s={}),s[i]=[],a="string"==typeof t[i]?0:t[i].length;a--;)l.test(t[i][a])+d.test(t[i][a])===1&&(t[i][a]=t[i][a].replace(Adicat.patterns.special,"\\$&")),s[i][a]=(n+t[i][a].replace(o,"")+c).replace(p,m).replace(u,"\\s");s[i]=new RegExp(s[i].join("|"),h)}return Adicat.patterns.dict_proc=!0,r?s.a:s},loadDict:function(t){var e,s=new XMLHttpRequest;s.onreadystatechange=function(){if(4===s.readyState&&200===s.status&&(Adicat.patterns.dict=/^%/.test(s.responseText)?Adicat.read_dic(s.responseText):JSON.parse(s.responseText),Adicat.patterns.dict))for(e in Adicat.patterns.dict)Adicat.patterns.dict.hasOwnProperty(e)&&Adicat.patterns.dict_cats.push(e)},s.open("GET",t,!0),s.send()},read_dic:function(t){var e,s,r,i,a=t.replace(/[\r\n]+/g,"\n").split(/%[^\n]*\n/),n=a.splice(2)[0],c={c:[],i:[]},o={},p={ch:/^[^\d]+|[\t\r\n\s]+$/g,cb:/^[\t\r\n\s]+|[^\d]+$/g,tr:/\t+/,nd:/[^\d]+/g},h=0;if(!(a=a[1].match(/\d+[\t\s]+[^\n]+/g)))throw new TypeError("Unrecognized file type");for(s=a.length;h<s;h++)r=a[h].replace(p.ch,"").split(p.tr),i=r[0].replace(p.nd,""),o[r[1]]=[],c.c.push(r[1]),c.i.push(i);for(n=n.split("\n"),h=n.length;h--;)for(i=n[h].replace(p.cb,"").split(p.tr),r=i.splice(1),i=i[0],a=r.length;a--;)-1!==(e=c.i.indexOf(r[a]))&&o[c.c[e]].push(i);return o},write_dic:function(t){var e,s,r=1,i=["%"],a={};for(e in t)if(t.hasOwnProperty(e)){for(i.push(r+"\t"+e),s=t[e].length;s--;)a.hasOwnProperty(t[e][s])?a[t[e][s]].push(r):a[t[e][s]]=[r];r++}i.push("%");for(e in a)a.hasOwnProperty(e)&&i.push(e+"\t"+a[e].join("\t"));return i.join("\n")},dict_export:function(t,e,s,r){var i=document.createElement("a");if(t=e?Adicat.write_dic(t):JSON.stringify(t).replace(/^{/,"{\n ").replace(/}$/,"\n}").replace(/],/g,"],\n "),s)if(void 0!==i.download)i.setAttribute("href",URL.createObjectURL(new Blob([t],{type:"text/plain"}))),i.setAttribute("download",(r||"adicat_dictionary").replace(/\.\w+$/,"")+(e?".dic":".json")),document.body.appendChild(i),i.click(),document.body.removeChild(i);else{if(!navigator||!navigator.msSaveBlob)throw"Browser does not seem to support downloading.";navigator.msSaveBlob(new Blob([t],{type:"text/plain"}),(r||"adicat_dictionary").replace(/\.\w+$/,"")+(e?".dic":".json"))}return t},bulk_process:function(t,e,s,r,i){function a(){if(void 0!==l[g]){if(l[g]&&_.test(l[g])){if(l[g]=new adicat(l[g]).categorize(i.dict,i.blacklist),v=v+'"'+l[g].string.clean.replace(b,'""')+'"',i.meta){l[g].procmeta(),o={characters:l[g].chars,words:l[g].WC,captured:l[g].captured,unique:l[g].unique};for(c in l[g].meta)l[g].meta.hasOwnProperty(c)&&(o[c]=l[g].meta[c]);l[g].meta=o}if(i.percent&&l[g].toPercent(),i.similarity&&(l[g].similarity(Adicat.hl.texts.comp_values,Adicat.hl.options.sim_metric,"true"===Adicat.hl.options.sim_filter&&Adicat.hl.options.sim_cats),l[g].cats[Adicat.hl.options.sim_metric+"_to_"+i.similarity]=l[g].sim.value),i.comps)for(h in i.comps)i.comps.hasOwnProperty(h)&&i.comps[h].show&&(Adicat.hl.output=l[g].cats,l[g].cats[h]=Adicat.hl.solve(i.comps[h].formula));if(o=l[g].cats,i.meta)for(c in l[g].meta)l[g].meta.hasOwnProperty(c)&&(o[c]=l[g].meta[c]);l[g]=o;for(c in l[g])l[g].hasOwnProperty(c)&&(g&&"text"!=y||(y+=r+c),v+=r+l[g][c])}else v+=l[g];v+="\n"}m<w?g++<m?a():n():((f>=w||f+w<m)&&(d&&(d.style.width=Math.round(Math.min(1e4,(g+1)/m*1e4)/100)+"%"),u&&(u.innerText=d.style.width)),g++<m?f++>w?(f=0,setTimeout(A)):a():n())}function n(){var t=document.createElement("a"),s=new Blob([y+v],{type:"text/"+(","==r?"csv":"plain")});if(u&&(O=(new Date).getTime()-O,u.innerText=O>1e3?Math.round(O/10)/100+" secs":O+" ms"),void 0!==t.download)t.setAttribute("href",URL.createObjectURL(s)),t.setAttribute("download",(e||"adicat_"+(new Date).getTime())+(","==r?".csv":".txt")),document.body.appendChild(t),t.click(),document.body.removeChild(t);else{if(!navigator||!navigator.msSaveBlob)throw"Browser does not seem to support downloading.";navigator.msSaveBlob(s,(e||"adicat_"+(new Date).getTime())+(","==r?".csv":".txt"))}}i||(i={}),i.hasOwnProperty("dict")||(i.dict=Adicat.patterns.dict),Adicat.hasOwnProperty("hl")&&(i.hasOwnProperty("blacklist")||(i.blacklist=Adicat.hl.options.blacklist),i.hasOwnProperty("percent")||(i.percent="percent"===Adicat.hl.options.values),!i.hasOwnProperty("similarity")&&Adicat.hl.texts&&(i.similarity=Adicat.hl.texts.comp),i.hasOwnProperty("comps")||(i.comps=Adicat.hl.options.dict[Adicat.hl.options.use_dict].composites),i.hasOwnProperty("meta")||(i.meta=Adicat.hl.options.meta)),i.hasOwnProperty("meta")||(i.meta=!0),r=Adicat.hasOwnProperty("hl")?Adicat.hl.options.sep:",";var c,o,p,h,l=t,d=document.getElementById("progbar"),u=document.getElementById("progbar_message"),m=l.length,g=0,f=0,w=1e3,y="text",v="\n",A=function(){a()},b=/"/g,_=/[^\s]/,O=(new Date).getTime();if("string"==typeof l){if(p=l.match(/^"[^]*?"$/gm))for(var x=/^"|"$/g,P=/""/g,g=p.length;g--;)l=l.replace(p[g],p[g].replace(Adicat.patterns.returns," ").replace(x,"").replace(P,'"'));l=l.split(s?new RegExp(s,"g"):Adicat.patterns.returns),m=l.length}a()},pnorm:function(t,e,s){if(e=e||0,(s=s||1)<=0)return t<e?0:1;var r=Math.abs((t-e)/s),i=1/(1+.2316419*r),a=.3989423*Math.exp(-r*r/2)*i*(.3193815+i*(i*(1.781478+i*(1.330274*i-1.821256))-.3565638));return t>0?1-a:a},dnorm:function(t,e,s){return e=e||0,s=s||1,s<=0?t<e?0:1:Math.exp(-Math.pow(t-e,2)/(2*Math.pow(s,2)))/(s*Math.sqrt(2*Math.PI))},rand:function(t,e){return e=e||0,Math.floor(Math.random()*(t-e+1)+e)},filterOut:function(t,e){e=e||"";var s=e.test?function(t){return!e.test(t)}:function(t){return t!==e};return t.filter(s)},which:function(t){for(var e in t)if(t.hasOwnProperty(e)&&t[e])return e;return-1},bench:function(t,e){for(var s=(new Date).getTime();t--;)e.call();return(new Date).getTime()-s}};adicat.prototype={constructor:adicat,tokenize:function(){var t,e,s=(new Date).getTime();if(this.string.clean=this.string.raw.replace(Adicat.patterns.word_breaks," ").replace(Adicat.patterns.curly_quote.s,"'").replace(Adicat.patterns.curly_quote.d,'"').replace(Adicat.patterns.emojis.smile," emjhface ").replace(Adicat.patterns.emojis.frown," emjsface ").replace(Adicat.patterns.symbols.and," and ").replace(Adicat.patterns.symbols.at," at ").replace(Adicat.patterns.punct.apostrophe,"'s").replace(Adicat.patterns.punct.ellipses,"... ").replace(Adicat.patterns.punct.endash," -- ").replace(Adicat.patterns.punct.emdash," --- ").replace(Adicat.patterns.punct.titles,"$&—").replace(Adicat.patterns.space,""),t=this.string.clean.match(Adicat.patterns.punct.initials))for(e=t.length;e--;)this.string.clean=this.string.clean.replace(t[e],t[e].replace(Adicat.patterns.punct.initial_trim,""));if(this.string.stripped=this.string.clean.toLowerCase().replace(Adicat.patterns.stripped,""),this.words={token:this.string.stripped.split(Adicat.patterns.word_breaks),print:this.string.clean.replace(Adicat.patterns.emojis.smile_rev,":)").replace(Adicat.patterns.emojis.frown_rev,":(").split(Adicat.patterns.word_breaks)},this.WC=Adicat.filterOut(this.words.token).length,this.words.token.length!==this.words.print.length){if(this._processLevel)throw"InputError: the input text is not parsing properly; check for special characters";return this._processLevel=.5,this.string.raw=this.string.raw.replace(/[^A-z0-9?!'",.-;:[({})\]]/g," "),this.tokenize()}return this.string.stripped=" "+this.string.stripped+" ",this._processLevel=1,this._processTime.token=(new Date).getTime()-s,this},categorize:function(t,e){if(e=e||[],this._processLevel||this.tokenize(),t){for(var s in t)if(t.hasOwnProperty(s)){if(t[s].test)break;t=Adicat.toRegex(t);break}}else Adicat.patterns.dict_proc||(Adicat.patterns.dict=Adicat.toRegex(Adicat.patterns.dict)),t=Adicat.patterns.dict;var r,i,s,a,n=this.words.print.length,c=(new Date).getTime();for(this.words.categories=[],this.vector={},this.cats={},this.cats_type=this.unique=this.captured=0;n--;)if(i=this.words.token[n],this.vector.hasOwnProperty(i)?this.vector[i]++:(this.vector[i]=1,this.unique++),Adicat.patterns.matches.hasOwnProperty(i)){r=Adicat.patterns.matches[i];for(s in t)t.hasOwnProperty(s)&&-1===e.indexOf(s)&&(this.cats.hasOwnProperty(s)||(this.cats[s]=0),-1!==r.indexOf(s)&&this.cats[s]++);this.words.categories[n]=" "+r.join(" ")+" ",this.captured+=1}else{a=!1;for(s in t)t.hasOwnProperty(s)&&-1===e.indexOf(s)&&(this.cats.hasOwnProperty(s)||(this.cats[s]=0),t[s].test(i)&&(Adicat.patterns.matches[i]||(Adicat.patterns.matches[i]=[]),this.cats[s]+=1,Adicat.patterns.matches[i].push(s),a=!0));this.words.categories[n]=Adicat.patterns.matches[i]?" "+Adicat.patterns.matches[i].join(" ")+" ":" none ",a&&(this.captured+=1)}return this._processLevel=2,this._processTime.cat=(new Date).getTime()-c,this},toPercent:function(t){if(this.hasOwnProperty("cats")||this.categorize(),!this.cats_type){this.cats_type=1;for(var e in this.cats)this.cats.hasOwnProperty(e)&&(this.cats[e]=this.WC?this.cats[e]/this.WC*100:0,t&&(this.cats[e]=Math.round(100*this.cats[e])/100))}return this},detect:function(t){t=t||Adicat.patterns.cues,this._processLevel||this.tokenize();var e,s=(new Date).getTime();this.cues={};for(e in t)t.hasOwnProperty(e)&&(t[e].test||(t[e]=Adicat.toRegex(t[e],!0)),this.cues[e]=t[e].test(this.string.stripped)||t[e].test(this.string.raw));return this._processTime.cue=(new Date).getTime()-s,this},display:function(t,e){var s,r,i=(new Date).getTime(),a=0,n=/\s/g,c="";for(this._processLevel<2&&this.categorize(),this.html=[];a<this.words.print.length;a++){if("s"===this.words.categories[a])c=" none ";else{for(c=this.words.categories[a].trim().split(" "),s=c.length;s--;)this.cats.hasOwnProperty(c[s])||c.pop(s);c=c.length?" "+c.join(" ")+" ":" none "}this.html[a]=document.createElement("span"),this.html[a].className=c,this.html[a].title=c.trim().replace(n,", "),this.html[a].innerText=this.words.print[a]}return t&&(r=e?function(t,e){return t.className>e.className?1:-1}:function(t,e){return t.innerText.toUpperCase()>e.innerText.toUpperCase()?1:-1},this.html=this.html.sort(r)),this._processTime.display=(new Date).getTime()-i,this.html},procmeta:function(){var t,e=(new Date).getTime(),s=0,r=0,i=[],a={},n=/a+[eu]*|e+[aiy]*|i+|o+[ui]*|u+|y+[aeiou]*/g,c=/[\u02bc]+|[A-z][\u0027\u0060\u2019]+[A-z]/g,o={puncts:/(^|\s)[^A-z0-9]|[^A-z0-9](\s|$)/g,numbers:/(^|\s)[0-9]/g,periods:/\./g,commas:/,/g,qmarks:/\?/g,exclams:/\!/g,quotes:/(^|\s)['"]+|['"]+(\s|$)/gm,brackets:/[(\){}<>[\]]/g,orgmarks:/[-—–\\\/:;]/g};for(this._processLevel<2&&this.categorize(),this.meta={characters:0,syllables:0,sentences:0,WPS:0,clauses:0,WPC:0,sixltr:0,characters_per_word:0,syllables_per_word:0,type_token_ratio:0,reading_grade:0,numbers:0,puncts:0,periods:0,commas:0,qmarks:0,exclams:0,quotes:0,apostrophes:0,brackets:0,orgmarks:0},this.meta.sentences=Adicat.filterOut(this.string.clean.split(Adicat.patterns.boundary.sentence)),s=this.meta.sentences.length;s--;)for(i=Adicat.filterOut(this.meta.sentences[s].toLowerCase().replace(Adicat.patterns.stripped,"").split(Adicat.patterns.word_breaks)),r=i.length,this.meta.WPS+=r;r--;)a.hasOwnProperty(i[r])||(a[i[r]]=i[r].split(n).length-1,a[i[r]]||(a[i[r]]=1)),this.meta.characters+=i[r].length,i[r].length>5&&(this.meta.sixltr+=1),this.meta.syllables+=a[i[r]];for(this.meta.sentences=this.meta.sentences.length,this.meta.WPS=this.meta.sentences?this.meta.WPS/this.meta.sentences:0,this.WC&&(this.meta.characters_per_word=this.meta.characters/this.WC,this.meta.syllables_per_word=this.meta.syllables/this.WC,this.meta.type_token_ratio=this.unique/this.WC,this.meta.sentences&&(this.meta.reading_grade=.39*this.WC/this.meta.sentences+11.8*this.meta.syllables/this.WC-15.59)),this.meta.clauses=Adicat.filterOut(this.string.clean.split(Adicat.patterns.boundary.clause)),s=this.meta.clauses.length;s--;)this.meta.WPC+=Adicat.filterOut(this.meta.clauses[s].toLowerCase().replace(Adicat.patterns.stripped,"").split(Adicat.patterns.word_breaks)).length;this.meta.clauses=this.meta.clauses.length,this.meta.WPC=this.meta.clauses?this.meta.WPC/this.meta.clauses:0,this.meta.apostrophes=Adicat.filterOut(this.string.clean.split(c)).length-1;for(t in o)o.hasOwnProperty(t)&&(this.meta[t]=this.string.clean.match(o[t]),this.meta[t]=this.meta[t]?this.meta[t].length:0);return this._processTime.meta=(new Date).getTime()-e,this},similarity:function(t,e,s){t||(t="overall"),this.hasOwnProperty("cats")||this.categorize(),"string"==typeof s&&(s=/^[Mm]/.test(s)?"meta":"vector"),"string"==typeof t&&(Adicat.liwc_means.hasOwnProperty(t)?(t=Adicat.liwc_means[t],s=["ppron","ipron","article","adverb","conj","prep","auxverb"]):t="meta"===s?new adicat(t).procmeta():new adicat(t).categorize().toPercent()),s||(s="object"!=typeof t||!t.hasOwnProperty("WPC")&&(t.captured||this.captured)?Adicat.patterns.dict_cats.length?Adicat.patterns.dict_cats:["ppron","ipron","article","adverb","conj","prep","auxverb"]:t.hasOwnProperty("WPC")?"meta":"vector"),this.cats_type||"string"==typeof s||this.toPercent(),"meta"!==s||this.hasOwnProperty("meta")||this.procmeta();var r,i,a="string"==typeof s,n="",c=e&&/^co/i.test(e),o=a?this[s]:this.cats,p=a&&t.hasOwnProperty(s)&&"object"==typeof t[s]?t[s]:t;if(this.sim={value:0,cats:s,comp:p,metric:e},a){s=[];for(r in o)o.hasOwnProperty(r)&&-1===s.indexOf(r)&&s.push(r);for(r in p)p.hasOwnProperty(r)&&-1===s.indexOf(r)&&s.push(r)}for(i=s.length,c&&(this.sim.value=[0,0,0]);i--;)n=s[i],o.hasOwnProperty(n)||(o[n]=0),p.hasOwnProperty(n)||(p[n]=0),c?(this.sim.value[0]+=o[n]*p[n],this.sim.value[1]+=o[n]*o[n],this.sim.value[2]+=p[n]*p[n]):o[n]+p[n]&&(this.sim.value+=Math.abs(o[n]-p[n])/(o[n]+p[n]));return this.sim.value=c?this.sim.value[0]/Math.sqrt(this.sim.value[1])/Math.sqrt(this.sim.value[2]):1-this.sim.value/s.length,isNaN(this.sim.value)&&(this.sim.value=0),this.sim}},Array.prototype.sample=function(t){var e=this.length-1,s=[],r=[],i=0,a=0;if(!t||1===t)return this[Adicat.rand(e)];for(t=Math.min(t,e);i<t;)-1===s.indexOf(a=Adicat.rand(e))&&(s[i]=a,r[i]=this[a],i++);return r},Array.prototype.unique=function(){for(var t=this.length,e=0,s=0,r=[];e<t;e++)-1===r.indexOf(this[e])&&(r[s]=this[e],s++);return r},Array.prototype.grepl=function(t){var e=this.length,s=[];if(this[0].test)for(;e--;)s[e]=this[e].test(t);else{if(!this[0].search)throw new TypeError("the first value does not have a search or test function");for(;e--;)s[e]=-1!==this[e].search(t)}return s},Array.prototype.nmatch=function(t){var e=this.length,s=0;if(this[0].test)for(;e--;)s+=this[e].test(t);else{if(!this[0].search)throw new TypeError("the first value does not have a search or test function");for(;e--;)s+=-1!==this[e].search(t)}return s},Array.prototype.sum=function(){for(var t=this.length,e=0;t--;)e+=this[t];return e},Array.prototype.indexOf||(Array.prototype.indexOf=function(t){for(var e=this.length;e--;)if(t==this[e])return e;return-1});