/*! jio v3.4.1 2015-10-28 */functionQuery(){this.onParseStart=emptyFunction,this.onParseSimpleQuery=emptyFunction,this.onParseComplexQuery=emptyFunction,this.onParseEnd=emptyFunction}functionparseStringToObject(a){functionb(a){g+=a+"\n"}functionc(a){varb=0,c=-1,d=0,e=0,f=a.offset+1;do{if(f--,b=0,c=-2,e=f,a.src.length<=e)return19;do{switch(b){case0:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=8||a.src.charCodeAt(f)>=10&&a.src.charCodeAt(f)<=31||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||59==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=63&&a.src.charCodeAt(f)<=64||a.src.charCodeAt(f)>=66&&a.src.charCodeAt(f)<=77||a.src.charCodeAt(f)>=80&&a.src.charCodeAt(f)<=254?1:9==a.src.charCodeAt(f)?2:40==a.src.charCodeAt(f)?3:41==a.src.charCodeAt(f)?4:60==a.src.charCodeAt(f)||62==a.src.charCodeAt(f)?5:33==a.src.charCodeAt(f)?11:79==a.src.charCodeAt(f)?12:32==a.src.charCodeAt(f)?13:61==a.src.charCodeAt(f)?14:34==a.src.charCodeAt(f)?15:65==a.src.charCodeAt(f)?19:78==a.src.charCodeAt(f)?20:-1;break;case1:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:-1,c=10,d=f;break;case2:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:-1,c=1,d=f;break;case3:b=-1,c=3,d=f;break;case4:b=-1,c=4,d=f;break;case5:b=61==a.src.charCodeAt(f)?14:-1,c=11,d=f;break;case6:b=-1,c=8,d=f;break;case7:b=-1,c=9,d=f;break;case8:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:-1,c=6,d=f;break;case9:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:-1,c=5,d=f;break;case10:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:-1,c=7,d=f;break;case11:b=61==a.src.charCodeAt(f)?14:-1;break;case12:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=81||a.src.charCodeAt(f)>=83&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:82==a.src.charCodeAt(f)?8:-1,c=10,d=f;break;case13:b=-1,c=1,d=f;break;case14:b=-1,c=11,d=f;break;case15:b=34==a.src.charCodeAt(f)?7:a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=33||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=91||a.src.charCodeAt(f)>=93&&a.src.charCodeAt(f)<=254||a.src.charCodeAt(f)>255?15:92==a.src.charCodeAt(f)?17:-1;break;case16:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=67||a.src.charCodeAt(f)>=69&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:68==a.src.charCodeAt(f)?9:-1,c=10,d=f;break;case17:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=254?15:-1;break;case18:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=83||a.src.charCodeAt(f)>=85&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:84==a.src.charCodeAt(f)?10:-1,c=10,d=f;break;case19:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=77||a.src.charCodeAt(f)>=79&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:78==a.src.charCodeAt(f)?16:-1,c=10,d=f;break;case20:b=a.src.charCodeAt(f)>=0&&a.src.charCodeAt(f)<=31||33==a.src.charCodeAt(f)||a.src.charCodeAt(f)>=35&&a.src.charCodeAt(f)<=39||a.src.charCodeAt(f)>=42&&a.src.charCodeAt(f)<=57||a.src.charCodeAt(f)>=59&&a.src.charCodeAt(f)<=78||a.src.charCodeAt(f)>=80&&a.src.charCodeAt(f)<=254?1:58==a.src.charCodeAt(f)?6:79==a.src.charCodeAt(f)?18:-1,c=10,d=f}f++}while(b>-1)}while(1==c);returnc>-1?(a.att=a.src.substr(e,d-e),a.offset=d):(a.att=newString,c=-1),c}functiond(a,d,h){varm,n,o,p,q=newArray,r=newArray,s=0,t=newFunction("","var offset; var src; var att;"),u=newt,v=newArray(newArray(0,1),newArray(13,1),newArray(12,1),newArray(12,2),newArray(12,3),newArray(14,1),newArray(14,3),newArray(15,2),newArray(15,1),newArray(16,3),newArray(16,2),newArray(16,1),newArray(17,2),newArray(17,1),newArray(18,1),newArray(18,1)),w=newArray(newArray(7,5,3,7,8,8,11,10,10,12,9,13),newArray(19,0),newArray(19,-1),newArray(6,14,7,5,3,7,8,8,11,10,10,12,9,13,19,-2,4,-2),newArray(5,16,19,-5,7,-5,3,-5,8,-5,11,-5,10,-5,9,-5,6,-5,4,-5),newArray(3,7,8,8,11,10,10,12,9,13),newArray(19,-8,7,-8,3,-8,8,-8,11,-8,10,-8,9,-8,6,-8,5,-8,4,-8),newArray(7,5,3,7,8,8,11,10,10,12,9,13),newArray(3,7,8,8,11,10,10,12,9,13),newArray(19,-11,7,-11,3,-11,8,-11,11,-11,10,-11,9,-11,6,-11,5,-11,4,-11),newArray(10,12,9,13),newArray(19,-13,7,-13,3,-13,8,-13,11,-13,10,-13,9,-13,6,-13,5,-13,4,-13),newArray(19,-14,7,-14,3,-14,8,-14,11,-14,10,-14,9,-14,6,-14,5,-14,4,-14),newArray(19,-15,7,-15,3,-15,8,-15,11,-15,10,-15,9,-15,6,-15,5,-15,4,-15),newArray(7,5,3,7,8,8,11,10,10,12,9,13),newArray(19,-3,4,-3),newArray(7,5,3,7,8,8,11,10,10,12,9,13),newArray(19,-7,7,-7,3,-7,8,-7,11,-7,10,-7,9,-7,6,-7,5,-7,4,-7),newArray(4,23),newArray(19,-10,7,-10,3,-10,8,-10,11,-10,10,-10,9,-10,6,-10,5,-10,4,-10),newArray(19,-12,7,-12,3,-12,8,-12,11,-12,10,-12,9,-12,6,-12,5,-12,4,-12),newArray(19,-4,4,-4),newArray(19,-6,7,-6,3,-6,8,-6,11,-6,10,-6,9,-6,6,-6,4,-6),newArray(19,-9,7,-9,3,-9,8,-9,11,-9,10,-9,9,-9,6,-9,5,-9,4,-9)),x=newArray(newArray(13,1,12,2,14,3,15,4,16,6,17,9,18,11),newArray,newArray,newArray(12,15,14,3,15,4,16,6,17,9,18,11),newArray,newArray(16,17,17,9,18,11),newArray,newArray(12,18,14,3,15,4,16,6,17,9,18,11),newArray(16,19,17,9,18,11),newArray,newArray(18,20),newArray,newArray,newArray,newArray(12,21,14,3,15,4,16,6,17,9,18,11),newArray,newArray(14,22,15,4,16,6,17,9,18,11),newArray,newArray,newArray,newArray,newArray,newArray,newArray),y=newArray("begin'","WHITESPACE","WHITESPACE","LEFT_PARENTHESE","RIGHT_PARENTHESE","AND","OR","NOT","COLUMN","STRING","WORD","OPERATOR","search_text","begin","and_expression","boolean_expression","expression","value","string","$");for(u.offset=0,u.src=a,u.att=newString,d||(d=newArray),h||(h=newArray),q.push(0),r.push(0),o=c(u);;){m=25;for(varz=0;z<w[q[q.length-1]].length;z+=2)if(w[q[q.length-1]][z]==o){m=w[q[q.length-1]][z+1];break}if(f&&q.length>0&&b("\nState "+q[q.length-1]+"\n Lookahead: "+y[o]+' ("'+u.att+'")\n Action: '+m+'\n Source: "'+u.src.substr(u.offset,30)+(u.offset+30<u.src.length?"...":"")+'"\n Stack: '+q.join()+"\n Value stack: "+r.join()+"\n"),25==m){f&&b("Error detected: There is no reduce or shift on the symbol "+y[o]),s++,d.push(u.offset-u.att.length),h.push(newArray);for(varz=0;z<w[q[q.length-1]].length;z+=2)h[h.length-1].push(y[w[q[q.length-1]][z]]);for(varA=newArray,B=newArray,z=0;z<q.length;z++)A[z]=q[z],B[z]=r[z];for(;25==m&&19!=o;){for(f&&b(" Error recovery\nCurrent lookahead: "+y[o]+" ("+u.att+")\nAction: "+m+"\n\n"),-1==o&&u.offset++;25==m&&q.length>0&&(q.pop(),r.pop(),0!=q.length);){m=25;for(varz=0;z<w[q[q.length-1]].length;z+=2)if(w[q[q.length-1]][z]==o){m=w[q[q.length-1]][z+1];break}}if(25!=m)break;for(varz=0;z<A.length;z++)q.push(A[z]),r.push(B[z]);o=c(u)}if(25==m){f&&b(" Error recovery failed, terminating parse process...");break}f&&b(" Error recovery succeeded, continuing")}if(m>0)f&&b("Shifting symbol: "+y[o]+" ("+u.att+")"),q.push(m),r.push(u.att),o=c(u),f&&b(" New lookahead symbol: "+y[o]+" ("+u.att+")");else{switch(m*=-1,f&&b("Reducing by producution: "+m),p=void0,f&&b(" Performing semantic action..."),m){case0:p=r[r.length-1];break;case1:e=r[r.length-1];break;case2:p=r[r.length-1];break;case3:p=k("OR",[r[r.length-2],r[r.length-1]]);break;case4:p=k("OR",[r[r.length-3],r[r.length-1]]);break;case5:p=r[r.length-1];break;case6:p=k("AND",[r[r.length-3],r[r.length-1]]);break;case7:p=j(r[r.length-1]);break;case8:p=r[r.length-1];break;case9:p=r[r.length-2];break;case10:l(r[r.length-1],r[r.length-2].split(":").slice(0,-1).join(":")),p=r[r.length-1];break;case11:p=r[r.length-1];break;case12:r[r.length-1].operator=r[r.length-2],p=r[r.length-1];break;case13:p=r[r.length-1];break;case14:p=i("",r[r.length-1]);break;case15:p=i("",r[r.length-1].split('"').slice(1,-1).join('"'))}f&&b(" Popping "+v[m][1]+" off the stack...");for(varz=0;z<v[m][1];z++)q.pop(),r.pop();n=-1;for(varz=0;z<x[q[q.length-1]].length;z+=2)if(x[q[q.length-1]][z]==v[m][0]){n=x[q[q.length-1]][z+1];break}if(0==m)break;f&&b(" Pushing non-terminal "+y[v[m][0]]),q.push(n),r.push(p)}f&&(alert(g),g=newString)}returnf&&(b("\nParse complete."),alert(g)),s}vare,f=!1,g=newString,h=function(){vara,b,c=[],d=arguments;for(a=0;a<d.length;a+=1)for(b=0;b<d[a].length;b+=1)c.push(d[a][b]);returnc},i=function(a,b,c){vard={type:"simple",key:a,value:b};returnvoid0!==c&&(d.operator=c),d},j=function(a){return"NOT"===a.operator?a.query_list[0]:{type:"complex",operator:"NOT",query_list:[a]}},k=function(a,b){varc,d=[];for(c=0;c<b.length;c+=1)b[c].operator===a?d=h(d,b[c].query_list):d.push(b[c]);return{type:"complex",operator:a,query_list:d}},l=function(a,b){varc;if("complex"===a.type){for(c=0;c<a.query_list.length;++c)l(a.query_list[c],b);return!0}return"simple"!==a.type||a.key?!1:(a.key=b,!0)},m=[],n=[],o=0;if((o=d(a,m,n))>0){varp;for(p=0;o>p;p+=1)thrownewError('Parse error near "'+a.substr(m[p])+'", expecting "'+n[p].join()+'"')}returne}functionComplexQuery(a,b){Query.call(this),this.operator=a.operator,this.query_list=a.query_list||[],this.query_list=this.query_list.map(function(a,c){returnQueryFactory.create(a,b)})}functionQueryFactory(){}functionobjectToSearchText(a){varb=[];if("complex"===a.type)returnb.push("("),(a.query_list||[]).forEach(function(c){b.push(objectToSearchText(c)),b.push(a.operator)}),b.length-=1,b.push(")"),b.join("");if("simple"===a.type)return(a.key?a.key+": ":"")+(a.operator||"")+' "'+a.value+'"';thrownewTypeError("This object is not a query")}functionSimpleQuery(a,b){Query.call(this),checkKeySchema(b),this._key_schema=b||{},this.operator=a.operator,this.key=a.key,this.value=a.value}functionstringEscapeRegexpCharacters(a){if("string"==typeofa)returna.replace(/([\\\.\$\[\]\(\)\{\}\^\?\*\+\-])/g,"\\$1");thrownewTypeError("Query.stringEscapeRegexpCharacters(): Argument no 1 is not of type 'string'")}functionmetadataValueToStringArray(a){varb,c=[];if(void0===a)returnvoid0;for(Array.isArray(a)||(a=[a]),b=0;b<a.length;b+=1)"object"==typeofa[b]?c[b]=a[b].content:c[b]=a[b];returnc}functionsortFunction(a,b){varc;if("descending"===b)c=1;else{if("ascending"!==b)thrownewTypeError("Query.sortFunction(): Argument 2 must be 'ascending' or 'descending'");c=-1}returnfunction(b,d){vare,f;for(b=metadataValueToStringArray(b[a])||[],d=metadataValueToStringArray(d[a])||[],f=b.length>d.length?b.length:d.length,e=0;f>e;e+=1){if(void0===b[e])returnc;if(void0===d[e])return-c;if(b[e]>d[e])return-c;if(b[e]<d[e])returnc}return0}}functioninherits(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{configurable:!0,enumerable:!1,writable:!0,value:a}})}functionemptyFunction(){}functionselect(a,b,c){vard,e,f;if(!Array.isArray(a))thrownewTypeError("jioquery.select(): Argument 1 is not of type Array");if(!Array.isArray(b))thrownewTypeError("jioquery.select(): Argument 2 is not of type Array");for(c===!0&&(b=deepClone(b)),d=0;d<b.length;d+=1){for(f={},e=0;e<a.length;e+=1)b[d].hasOwnProperty([a[e]])&&(f[a[e]]=b[d][a[e]]);for(einf)if(f.hasOwnProperty(e)){b[d]=f;break}}returnb}functionsortOn(a,b,c){vard;if(!Array.isArray(a))thrownewTypeError("jioquery.sortOn(): Argument 1 is not of type 'array'");for(c&&(b=deepClone(b)),d=a.length-1;d>=0;d-=1)b.sort(sortFunction(a[d][0],a[d][1]));returnb}functionlimit(a,b,c){if(!Array.isArray(a))thrownewTypeError("jioquery.limit(): Argument 1 is not of type 'array'");if(!Array.isArray(b))thrownewTypeError("jioquery.limit(): Argument 2 is not of type 'array'");returnc&&(b=deepClone(b)),b.splice(0,a[0]),a[1]&&b.splice(a[1]),b}functionsearchTextToRegExp(a,b){if("string"!=typeofa)thrownewTypeError("jioquery.searchTextToRegExp(): Argument 1 is not of type 'string'");returnb===!1?newRegExp("^"+stringEscapeRegexpCharacters(a)+"$"):newRegExp("^"+stringEscapeRegexpCharacters(a).replace(/%/g,".*").replace(/_/g,".")+"$")}!function(a,b){"object"==typeofexports?module.exports=b():"function"==typeofdefine&&define.amd?define(b):a.IPv6=b(a)}(this,function(a){varb=a&&a.IPv6;return{best:function(a){a=a.toLowerCase().split(":");varb=a.length,c=8;""===a[0]&&""===a[1]&&""===a[2]?(a.shift(),a.shift()):""===a[0]&&""===a[1]?a.shift():""===a[b-1]&&""===a[b-2]&&a.pop(),b=a.length,-1!==a[b-1].indexOf(".")&&(c=7);vard;for(d=0;b>d&&""!==a[d];d++);if(c>d)for(a.splice(d,1,"0000");a.length<c;)a.splice(d,0,"0000");for(d=0;c>d;d++){for(varb=a[d].split(""),e=0;3>e&&("0"===b[0]&&1<b.length);e++)b.splice(0,1);a[d]=b.join("")}varb=-1,f=e=0,g=-1,h=!1;for(d=0;c>d;d++)h?"0"===a[d]?f+=1:(h=!1,f>e&&(b=g,e=f)):"0"==a[d]&&(h=!0,g=d,f=1);for(f>e&&(b=g,e=f),e>1&&a.splice(b,e,""),b=a.length,c="",""===a[0]&&(beststr=":"),d=0;b>d&&(c+=a[d],d!==b-1);d++)c+=":";return""===a[b-1]&&(c+=":"),c},noConflict:function(){returna.IPv6===this&&(a.IPv6=b),this}}}),function(a){functionb(a){throwRangeError(B[a])}functionc(a,b){for(varc=a.length;c--;)a[c]=b(a[c]);returna}functiond(a,b){returnc(a.split(A),b).join(".")}functione(a){for(varb,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);returnd}functionf(a){returnc(a,function(a){varb="";returna>65535&&(a-=65536,b+=E(a>>>10&1023|55296),a=56320|1023&a),b+=E(a)}).join("")}functiong(a,b){returna+22+75*(26>a)-((0!=b)<<5)}functionh(a,b,c){vard=0;for(a=c?D(a/u):a>>1,a+=D(a/b);a>C*s>>1;d+=q)a=D(a/C);returnD(d+(C+1)*a/(a+t))}functioni(a){varc,d,e,g,i,j,k=[],l=a.length,m=0,n=w,o=v;for(d=a.lastIndexOf(x),0>d&&(d=0),e=0;d>e;++e)128<=a.charCodeAt(e)&&b("not-basic"),k.push(a.charCodeAt(e));for(d=d>0?d+1:0;l>d;){for(e=m,c=1,g=q;d>=l&&b("invalid-input"),i=a.charCodeAt(d++),i=10>i-48?i-22:26>i-65?i-65:26>i-97?i-97:q,(i>=q||i>D((p-m)/c))&&b("overflow"),m+=i*c,j=o>=g?r:g>=o+s?s:g-o,!(j>i);g+=q)i=q-j,c>D(p/i)&&b("overflow"),c*=i;c=k.length+1,o=h(m-e,c,0==e),D(m/c)>p-n&&b("overflow"),n+=D(m/c),m%=c,k.splice(m++,0,n)}returnf(k)}functionj(a){varc,d,f,i,j,k,l,m,n,o,t,u,y=[];for(a=e(a),o=a.length,c=w,d=0,j=v,k=0;o>k;++k)n=a[k],128>n&&y.push(E(n));for((f=i=y.length)&&y.push(x);o>f;){for(l=p,k=0;o>k;++k)n=a[k],n>=c&&l>n&&(l=n);for(t=f+1,l-c>D((p-d)/t)&&b("overflow"),d+=(l-c)*t,c=l,k=0;o>k;++k)if(n=a[k],c>n&&++d>p&&b("overflow"),n==c){for(m=d,l=q;n=j>=l?r:l>=j+s?s:l-j,!(n>m);l+=q)u=m-n,m=q-n,y.push(E(g(n+u%m,0))),m=D(u/m);y.push(E(g(m,0))),j=h(d,t,f==i),d=0,++f}++d,++c}returny.join("")}vark="object"==typeofexports&&exports,l="object"==typeofmodule&&module&&module.exports==k&&module,m="object"==typeofglobal&&global;(m.global===m||m.window===m)&&(a=m);varn,o,p=2147483647,q=36,r=1,s=26,t=38,u=700,v=72,w=128,x="-",y=/^xn--/,z=/[^ -~]/,A=/\x2E|\u3002|\uFF0E|\uFF61/g,B={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},C=q-r,D=Math.floor,E=String.fromCharCode;if(n={version:"1.2.3",ucs2:{decode:e,encode:f},decode:i,encode:j,toASCII:function(a){returnd(a,function(a){returnz.test(a)?"xn--"+j(a):a})},toUnicode:function(a){returnd(a,function(a){returny.test(a)?i(a.slice(4).toLowerCase()):a})}},"function"==typeofdefine&&"object"==typeofdefine.amd&&define.amd)define(function(){returnn});elseif(k&&!k.nodeType)if(l)l.exports=n;elsefor(oinn)n.hasOwnProperty(o)&&(k[o]=n[o]);elsea.punycode=n}(this),function(a,b){"object"==typeofexports?module.exports=b():"function"==typeofdefine&&define.amd?define(b):a.SecondLevelDomains=b(a)}(this,function(a){varb=a&&a.SecondLevelDomains,c=Object.prototype.hasOwnProperty,d={list:{ac:"com|gov|mil|net|org",ae:"ac|co|gov|mil|name|net|org|pro|sch",af:"com|edu|gov|net|org",al:"com|edu|gov|mil|net|org",ao:"co|ed|gv|it|og|pb",ar:"com|edu|gob|gov|int|mil|net|org|tur",at:"ac|co|gv|or",au:"asn|com|csiro|edu|gov|id|net|org",ba:"co|com|edu|gov|mil|net|org|rs|unbi|unmo|unsa|untz|unze",bb:"biz|co|com|edu|gov|info|net|org|store|tv",bh:"biz|cc|com|edu|gov|info|net|org",bn:"com|edu|gov|net|org",bo:"com|edu|gob|gov|int|mil|net|org|tv",br:"adm|adv|agr|am|arq|art|ato|b|bio|blog|bmd|cim|cng|cnt|com|coop|ecn|edu|eng|esp|etc|eti|far|flog|fm|fnd|fot|fst|g12|ggf|gov|imb|ind|inf|jor|jus|lel|mat|med|mil|mus|net|nom|not|ntr|odo|org|ppg|pro|psc|psi|qsl|rec|slg|srv|tmp|trd|tur|tv|vet|vlog|wiki|zlg",bs:"com|edu|gov|net|org",bz:"du|et|om|ov|rg",ca:"ab|bc|mb|nb|nf|nl|ns|nt|nu|on|pe|qc|sk|yk",ck:"biz|co|edu|gen|gov|info|net|org",cn:"ac|ah|bj|com|cq|edu|fj|gd|gov|gs|gx|gz|ha|hb|he|hi|hl|hn|jl|js|jx|ln|mil|net|nm|nx|org|qh|sc|sd|sh|sn|sx|tj|tw|xj|xz|yn|zj",co:"com|edu|gov|mil|net|nom|org",cr:"ac|c|co|ed|fi|go|or|sa",cy:"ac|biz|com|ekloges|gov|ltd|name|net|org|parliament|press|pro|tm","do":"art|com|edu|gob|gov|mil|net|org|sld|web",dz:"art|asso|com|edu|gov|net|org|pol",ec:"com|edu|fin|gov|info|med|mil|net|org|pro",eg:"com|edu|eun|gov|mil|name|net|org|sci",er:"com|edu|gov|ind|mil|net|org|rochest|w",es:"com|edu|gob|nom|org",et:"biz|com|edu|gov|info|name|net|org",fj:"ac|biz|com|info|mil|name|net|org|pro",fk:"ac|co|gov|net|nom|org",fr:"asso|com|f|gouv|nom|prd|presse|tm",gg:"co|net|org",gh:"com|edu|gov|mil|org",gn:"ac|com|gov|net|org",gr:"com|edu|gov|mil|net|org",gt:"com|edu|gob|ind|mil|net|org",gu:"com|edu|gov|net|org",hk:"com|edu|gov|idv|net|org",id:"ac|co|go|mil|net|or|sch|web",il:"ac|co|gov|idf|k12|muni|net|org","in":"ac|co|edu|ernet|firm|gen|gov|i|ind|mil|net|nic|org|res",iq:"com|edu|gov|i|mil|net|org",ir:"ac|co|dnssec|gov|i|id|net|org|sch",it:"edu|gov",je:"co|net|org",jo:"com|edu|gov|mil|name|net|org|sch",jp:"ac|ad|co|ed|go|gr|lg|ne|or",ke:"ac|co|go|info|me|mobi|ne|or|sc",kh:"com|edu|gov|mil|net|org|per",ki:"biz|com|de|edu|gov|info|mob|net|org|tel",km:"asso|com|coop|edu|gouv|k|medecin|mil|nom|notaires|pharmaciens|presse|tm|veterinaire",kn:"edu|gov|net|org",kr:"ac|busan|chungbuk|chungnam|co|daegu|daejeon|es|gangwon|go|gwangju|gyeongbuk|gyeonggi|gyeongnam|hs|incheon|jeju|jeonbuk|jeonnam|k|kg|mil|ms|ne|or|pe|re|sc|seoul|ulsan",kw:"com|edu|gov|net|org",ky:"com|edu|gov|net|org",kz:"com|edu|gov|mil|net|org",lb:"com|edu|gov|net|org",lk:"assn|com|edu|gov|grp|hotel|int|ltd|net|ngo|org|sch|soc|web",lr:"com|edu|gov|net|org",lv:"asn|com|conf|edu|gov|id|mil|net|org",ly:"com|edu|gov|id|med|net|org|plc|sch",ma:"ac|co|gov|m|net|org|press",mc:"asso|tm",me:"ac|co|edu|gov|its|net|org|priv",mg:"com|edu|gov|mil|nom|org|prd|tm",mk:"com|edu|gov|inf|name|net|org|pro",ml:"com|edu|gov|net|org|presse",mn:"edu|gov|org",mo:"com|edu|gov|net|org",mt:"com|edu|gov|net|org",mv:"aero|biz|com|coop|edu|gov|info|int|mil|museum|name|net|org|pro",mw:"ac|co|com|coop|edu|gov|int|museum|net|org",mx:"com|edu|gob|net|org",my:"com|edu|gov|mil|name|net|org|sch",nf:"arts|com|firm|info|net|other|per|rec|store|web",ng:"biz|com|edu|gov|mil|mobi|name|net|org|sch",ni:"ac|co|com|edu|gob|mil|net|nom|org",np:"com|edu|gov|mil|net|org",nr:"biz|com|edu|gov|info|net|org",om:"ac|biz|co|com|edu|gov|med|mil|museum|net|org|pro|sch",pe:"com|edu|gob|mil|net|nom|org|sld",ph:"com|edu|gov|i|mil|net|ngo|org",pk:"biz|com|edu|fam|gob|gok|gon|gop|gos|gov|net|org|web",pl:"art|bialystok|biz|com|edu|gda|gdansk|gorzow|gov|info|katowice|krakow|lodz|lublin|mil|net|ngo|olsztyn|org|poznan|pwr|radom|slupsk|szczecin|torun|warszawa|waw|wroc|wroclaw|zgora",pr:"ac|biz|com|edu|est|gov|info|isla|name|net|org|pro|prof",ps:"com|edu|gov|net|org|plo|sec",pw:"belau|co|ed|go|ne|or",ro:"arts|com|firm|info|nom|nt|org|rec|store|tm|www",rs:"ac|co|edu|gov|in|org",sb:"com|edu|gov|net|org",sc:"com|edu|gov|net|org",sh:"co|com|edu|gov|net|nom|org",sl:"com|edu|gov|net|org",st:"co|com|consulado|edu|embaixada|gov|mil|net|org|principe|saotome|store",sv:"com|edu|gob|org|red",sz:"ac|co|org",tr:"av|bbs|bel|biz|com|dr|edu|gen|gov|info|k12|name|net|org|pol|tel|tsk|tv|web",tt:"aero|biz|cat|co|com|coop|edu|gov|info|int|jobs|mil|mobi|museum|name|net|org|pro|tel|travel",tw:"club|com|ebiz|edu|game|gov|idv|mil|net|org",mu:"ac|co|com|gov|net|or|org",mz:"ac|co|edu|gov|org",na:"co|com",nz:"ac|co|cri|geek|gen|govt|health|iwi|maori|mil|net|org|parliament|school",pa:"abo|ac|com|edu|gob|ing|med|net|nom|org|sld",pt:"com|edu|gov|int|net|nome|org|publ",py:"com|edu|gov|mil|net|org",qa:"com|edu|gov|mil|net|org",re:"asso|com|nom",ru:"ac|adygeya|altai|amur|arkhangelsk|astrakhan|bashkiria|belgorod|bir|bryansk|buryatia|cbg|chel|chelyabinsk|chita|chukotka|chuvashia|com|dagestan|e-burg|edu|gov|grozny|int|irkutsk|ivanovo|izhevsk|jar|joshkar-ola|kalmykia|kaluga|kamchatka|karelia|kazan|kchr|kemerovo|khabarovsk|khakassia|khv|kirov|koenig|komi|kostroma|kranoyarsk|kuban|kurgan|kursk|lipetsk|magadan|mari|mari-el|marine|mil|mordovia|mosreg|msk|murmansk|nalchik|net|nnov|nov|novosibirsk|nsk|omsk|orenburg|org|oryol|penza|perm|pp|pskov|ptz|rnd|ryazan|sakhalin|samara|saratov|simbirsk|smolensk|spb|stavropol|stv|surgut|tambov|tatarstan|tom|tomsk|tsaritsyn|tsk|tula|tuva|tver|tyumen|udm|udmurtia|ulan-ude|vladikavkaz|vladimir|vladivostok|volgograd|vologda|voronezh|vrn|vyatka|yakutia|yamal|yekaterinburg|yuzhno-sakhalinsk",rw:"ac|co|com|edu|gouv|gov|int|mil|net",sa:"com|edu|gov|med|net|org|pub|sch",sd:"com|edu|gov|info|med|net|org|tv",se:"a|ac|b|bd|c|d|e|f|g|h|i|k|l|m|n|o|org|p|parti|pp|press|r|s|t|tm|u|w|x|y|z",sg:"com|edu|gov|idn|net|org|per",sn:"art|com|edu|gouv|org|perso|univ",sy:"com|edu|gov|mil|net|news|org",th:"ac|co|go|in|mi|net|or",tj:"ac|biz|co|com|edu|go|gov|info|int|mil|name|net|nic|org|test|web",tn:"agrinet|com|defense|edunet|ens|fin|gov|ind|info|intl|mincom|nat|net|org|perso|rnrt|rns|rnu|tourism",tz:"ac|co|go|ne|or",ua:"biz|cherkassy|chernigov|chernovtsy|ck|cn|co|com|crimea|cv|dn|dnepropetrovsk|donetsk|dp|edu|gov|if|in|ivano-frankivsk|kh|kharkov|kherson|khmelnitskiy|kiev|kirovograd|km|kr|ks|kv|lg|lugansk|lutsk|lviv|me|mk|net|nikolaev|od|odessa|org|pl|poltava|pp|rovno|rv|sebastopol|sumy|te|ternopil|uzhgorod|vinnica|vn|zaporizhzhe|zhitomir|zp|zt",ug:"ac|co|go|ne|or|org|sc",uk:"ac|bl|british-library|co|cym|gov|govt|icnet|jet|lea|ltd|me|mil|mod|national-library-scotland|nel|net|nhs|nic|nls|org|orgn|parliament|plc|police|sch|scot|soc",us:"dni|fed|isa|kids|nsn",uy:"com|edu|gub|mil|net|org",ve:"co|com|edu|gob|info|mil|net|org|web",vi:"co|com|k12|net|org",vn:"ac|biz|com|edu|gov|health|info|int|name|net|org|pro",ye:"co|com|gov|ltd|me|net|org|plc",yu:"ac|co|edu|gov|org",za:"ac|agric|alt|bourse|city|co|cybernet|db|edu|gov|grondar|iaccess|imt|inca|landesign|law|mil|net|ngo|nis|nom|olivetti|org|pix|school|tm|web",zm:"ac|co|com|edu|gov|net|org|sch"},has_expression:null,is_expression:null,has:function(a){return!!a.match(d.has_expression)},is:function(a){return!!a.match(d.is_expression)},get:function(a){return(a=a.match(d.has_expression))&&a[1]||null},noConflict:function(){returna.SecondLevelDomains===this&&(a.SecondLevelDomains=b),this},init:function(){vara,b="";for(aind.list)c.call(d.list,a)&&(b+="|("+("("+d.list[a]+")."+a)+")");d.has_expression=RegExp("\\.("+b.substr(1)+")$","i"),d.is_expression=RegExp("^("+b.substr(1)+")$","i")}};returnd.init(),d}),function(a,b){"object"==typeofexports?module.exports=b(require("./punycode"),require("./IPv6"),require("./SecondLevelDomains")):"function"==typeofdefine&&define.amd?define(["./punycode","./IPv6","./SecondLevelDomains"],b):a.URI=b(a.punycode,a.IPv6,a.SecondLevelDomains,a)}(this,function(a,b,c,d){functione(a,b){returnthisinstanceofe?(void0===a&&(a="undefined"!=typeoflocation?location.href+"":""),this.href(a),void0!==b?this.absoluteTo(b):this):newe(a,b)}functionf(a){returna.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}functiong(a){returnvoid0===a?"Undefined":String(Object.prototype.toString.call(a)).slice(8,-1)}functionh(a){return"Array"===g(a)}functioni(a,b){varc,d;if(h(b)){for(c=0,d=b.length;d>c;c++)if(!i(a,b[c]))return!1;return!0}vare=g(b);for(c=0,d=a.length;d>c;c++)if("RegExp"===e){if("string"==typeofa[c]&&a[c].match(b))return!0}elseif(a[c]===b)return!0;return!1}functionj(a,b){if(!h(a)||!h(b)||a.length!==b.length)return!1;a.sort(),b.sort();for(varc=0,d=a.length;d>c;c++)if(a[c]!==b[c])return!1;return!0}functionk(a){returnescape(a)}functionl(a){returnencodeURIComponent(a).replace(/[!'()*]/g,k).replace(/\*/g,"%2A")}varm=d&&d.URI;e.version="1.12.0";varn=e.prototype,o=Object.prototype.hasOwnProperty;e._parts=function(){return{protocol:null,username:null,password:null,hostname:null,urn:null,port:null,path:null,query:null,fragment:null,duplicateQueryParameters:e.duplicateQueryParameters,escapeQuerySpace:e.escapeQuerySpace}},e.duplicateQueryParameters=!1,e.escapeQuerySpace=!0,e.protocol_expression=/^[a-z][a-z0-9.+-]*$/i,e.idn_expression=/[^a-z0-9\.-]/i,e.punycode_expression=/(xn--)/i,e.ip4_expression=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,e.ip6_expression=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,e.find_uri_expression=/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u2018\u2019]))/gi,e.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?\u00ab\u00bb\u201c\u201d\u201e\u2018\u2019]+$/},e.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},e.invalid_hostname_characters=/[^a-zA-Z0-9\.-]/,e.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src"},e.getDomAttribute=function(a){if(a&&a.nodeName){varb=a.nodeName.toLowerCase();return"input"===b&&"image"!==a.type?void0:e.domAttributes[b]}},e.encode=l,e.decode=decodeURIComponent,e.iso8859=function(){e.encode=escape,e.decode=unescape},e.unicode=function(){e.encode=l,e.decode=decodeURIComponent},e.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/gi,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/gi,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}}},e.encodeQuery=function(a,b){varc=e.encode(a+"");returnb?c.replace(/%20/g,"+"):c},e.decodeQuery=function(a,b){a+="";try{returne.decode(b?a.replace(/\+/g,"%20"):a)}catch(c){returna}},e.recodePath=function(a){a=(a+"").split("/");for(varb=0,c=a.length;c>b;b++)a[b]=e.encodePathSegment(e.decode(a[b]));returna.join("/")},e.decodePath=function(a){a=(a+"").split("/");for(varb=0,c=a.length;c>b;b++)a[b]=e.decodePathSegment(a[b]);returna.join("/")};varp,q={encode:"encode",decode:"decode"},r=function(a,b){returnfunction(c){returne[b](c+"").replace(e.characters[a][b].expression,function(c){returne.characters[a][b].map[c]})}};for(pinq)e[p+"PathSegment"]=r("pathname",q[p]);e.encodeReserved=r("reserved","encode"),e.parse=function(a,b){varc;returnb||(b={}),c=a.indexOf("#"),c>-1&&(b.fragment=a.substring(c+1)||null,a=a.substring(0,c)),c=a.indexOf("?"),c>-1&&(b.query=a.substring(c+1)||null,a=a.substring(0,c)),"//"===a.substring(0,2)?(b.protocol=null,a=a.substring(2),a=e.parseAuthority(a,b)):(c=a.indexOf(":"),c>-1&&(b.protocol=a.substring(0,c)||null,b.protocol&&!b.protocol.match(e.protocol_expression)?b.protocol=void0:"file"===b.protocol?a=a.substring(c+3):"//"===a.substring(c+1,c+3)?(a=a.substring(c+3),a=e.parseAuthority(a,b)):(a=a.substring(c+1),b.urn=!0))),b.path=a,b},e.parseHost=function(a,b){varc,d=a.indexOf("/");return-1===d&&(d=a.length),"["===a.charAt(0)?(c=a.indexOf("]"),b.hostname=a.substring(1,c)||null,b.port=a.substring(c+2,d)||null):a.indexOf(":")!==a.lastIndexOf(":")?(b.hostname=a.substring(0,d)||null,b.port=null):(c=a.substring(0,d).split(":"),b.hostname=c[0]||null,b.port=c[1]||null),b.hostname&&"/"!==a.substring(d).charAt(0)&&(d++,a="/"+a),a.substring(d)||"/"},e.parseAuthority=function(a,b){returna=e.parseUserinfo(a,b),e.parseHost(a,b)},e.parseUserinfo=function(a,b){varc=a.indexOf("/"),d=c>-1?a.lastIndexOf("@",c):a.indexOf("@");returnd>-1&&(-1===c||c>d)?(c=a.substring(0,d).split(":"),b.username=c[0]?e.decode(c[0]):null,c.shift(),b.password=c[0]?e.decode(c.join(":")):null,a=a.substring(d+1)):(b.username=null,b.password=null),a},e.parseQuery=function(a,b){if(!a)return{};if(a=a.replace(/&+/g,"&").replace(/^\?*&*|&+$/g,""),!a)return{};for(varc,d,f={},g=a.split("&"),h=g.length,i=0;h>i;i++)c=g[i].split("="),d=e.decodeQuery(c.shift(),b),c=c.length?e.decodeQuery(c.join("="),b):null,f[d]?("string"==typeoff[d]&&(f[d]=[f[d]]),f[d].push(c)):f[d]=c;returnf},e.build=function(a){varb="";returna.protocol&&(b+=a.protocol+":"),a.urn||!b&&!a.hostname||(b+="//"),b+=e.buildAuthority(a)||"","string"==typeofa.path&&("/"!==a.path.charAt(0)&&"string"==typeofa.hostname&&(b+="/"),b+=a.path),"string"==typeofa.query&&a.query&&(b+="?"+a.query),"string"==typeofa.fragment&&a.fragment&&(b+="#"+a.fragment),b},e.buildHost=function(a){varb="";returna.hostname?(e.ip6_expression.test(a.hostname)?b=a.port?b+("["+a.hostname+"]:"+a.port):b+a.hostname:(b+=a.hostname,a.port&&(b+=":"+a.port)),b):""},e.buildAuthority=function(a){returne.buildUserinfo(a)+e.buildHost(a)},e.buildUserinfo=function(a){varb="";returna.username&&(b+=e.encode(a.username),a.password&&(b+=":"+e.encode(a.password)),b+="@"),b},e.buildQuery=function(a,b,c){vard,f,g,i,j="";for(fina)if(o.call(a,f)&&f)if(h(a[f]))for(d={},g=0,i=a[f].length;i>g;g++)void0!==a[f][g]&&void0===d[a[f][g]+""]&&(j+="&"+e.buildQueryParameter(f,a[f][g],c),!0!==b&&(d[a[f][g]+""]=!0));elsevoid0!==a[f]&&(j+="&"+e.buildQueryParameter(f,a[f],c));returnj.substring(1)},e.buildQueryParameter=function(a,b,c){returne.encodeQuery(a,c)+(null!==b?"="+e.encodeQuery(b,c):"")},e.addQuery=function(a,b,c){if("object"==typeofb)for(vardinb)o.call(b,d)&&e.addQuery(a,d,b[d]);else{if("string"!=typeofb)thrownewTypeError("URI.addQuery() accepts an object, string as the name parameter");void0===a[b]?a[b]=c:("string"==typeofa[b]&&(a[b]=[a[b]]),h(c)||(c=[c]),a[b]=a[b].concat(c))}},e.removeQuery=function(a,b,c){vard;if(h(b))for(c=0,d=b.length;d>c;c++)a[b[c]]=void0;elseif("object"==typeofb)for(dinb)o.call(b,d)&&e.removeQuery(a,d,b[d]);else{if("string"!=typeofb)thrownewTypeError("URI.addQuery() accepts an object, string as the first parameter");if(void0!==c){if(a[b]===c)a[b]=void0;elseif(h(a[b])){d=a[b];varf,g,i={};if(h(c))for(f=0,g=c.length;g>f;f++)i[c[f]]=!0;elsei[c]=!0;for(f=0,g=d.length;g>f;f++)void0!==i[d[f]]&&(d.splice(f,1),g--,f--);a[b]=d}}elsea[b]=void0}},e.hasQuery=function(a,b,c,d){if("object"==typeofb){for(varfinb)if(o.call(b,f)&&!e.hasQuery(a,f,b[f]))return!1;return!0}if("string"!=typeofb)thrownewTypeError("URI.hasQuery() accepts an object, string as the name parameter");switch(g(c)){case"Undefined":returnbina;case"Boolean":returna=Boolean(h(a[b])?a[b].length:a[b]),c===a;case"Function":return!!c(a[b],b,a);case"Array":returnh(a[b])?(d?i:j)(a[b],c):!1;case"RegExp":returnh(a[b])?d?i(a[b],c):!1:Boolean(a[b]&&a[b].match(c));case"Number":c=String(c);case"String":returnh(a[b])?d?i(a[b],c):!1:a[b]===c;default:thrownewTypeError("URI.hasQuery() accepts undefined, boolean, string, number, RegExp, Function as the value parameter")}},e.commonPath=function(a,b){varc,d=Math.min(a.length,b.length);for(c=0;d>c;c++)if(a.charAt(c)!==b.charAt(c)){c--;break}return1>c?a.charAt(0)===b.charAt(0)&&"/"===a.charAt(0)?"/":"":(("/"!==a.charAt(c)||"/"!==b.charAt(c))&&(c=a.substring(0,c).lastIndexOf("/")),a.substring(0,c+1))},e.withinString=function(a,b,c){c||(c={});vard=c.start||e.findUri.start,f=c.end||e.findUri.end,g=c.trim||e.findUri.trim,h=/[a-z0-9-]=["']?$/i;for(d.lastIndex=0;;){vari=d.exec(a);if(!i)break;if(i=i.index,c.ignoreHtml){varj=a.slice(Math.max(i-3,0),i);if(j&&h.test(j))continue}varj=i+a.slice(i).search(f),k=a.slice(i,j).replace(g,"");c.ignore&&c.ignore.test(k)||(j=i+k.length,k=b(k,i,j,a),a=a.slice(0,i)+k+a.slice(j),d.lastIndex=i+k.length)}returnd.lastIndex=0,a},e.ensureValidHostname=function(b){if(b.match(e.invalid_hostname_characters)){if(!a)thrownewTypeError("Hostname '"+b+"' contains characters other than [A-Z0-9.-] and Punycode.js is not available");if(a.toASCII(b).match(e.invalid_hostname_characters))thrownewTypeError("Hostname '"+b+"' contains characters other than [A-Z0-9.-]")}},e.noConflict=function(a){returna?(a={URI:this.noConflict()},URITemplate&&"function"==typeofURITemplate.noConflict&&(a.URITemplate=URITemplate.noConflict()),b&&"function"==typeofb.noConflict&&(a.IPv6=b.noConflict()),SecondLevelDomains&&"function"==typeofSecondLevelDomains.noConflict&&(a.SecondLevelDomains=SecondLevelDomains.noConflict()),a):(d.URI===this&&(d.URI=m),this)},n.build=function(a){return!0===a?this._deferred_build=!0:(void0===a||this._deferred_build)&&(this._string=e.build(this._parts),this._deferred_build=!1),this},n.clone=function(){returnnewe(this)},n.valueOf=n.toString=function(){returnthis.build(!1)._string},q={protocol:"protocol",username:"username",password:"password",hostname:"hostname",port:"port"},r=function(a){returnfunction(b,c){returnvoid0===b?this._parts[a]||"":(this._parts[a]=b||null,this.build(!c),this)}};for(pinq)n[p]=r(q[p]);q={query:"?",fragment:"#"},r=function(a,b){returnfunction(c,d){returnvoid0===c?this._parts[a]||"":(null!==c&&(c+="",c.charAt(0)===b&&(c=c.substring(1))),this._parts[a]=c,this.build(!d),this)}};for(pinq)n[p]=r(p,q[p]);q={search:["?","query"],hash:["#","fragment"]},r=function(a,b){returnfunction(c,d){vare=this[a](c,d);return"string"==typeofe&&e.length?b+e:e}};for(pinq)n[p]=r(q[p][1],q[p][0]);n.pathname=function(a,b){if(void0===a||!0===a){varc=this._parts.path||(this._parts.hostname?"/":"");returna?e.decodePath(c):c}returnthis._parts.path=a?e.recodePath(a):"/",this.build(!b),this},n.path=n.pathname,n.href=function(a,b){varc;if(void0===a)returnthis.toString();this._string="",this._parts=e._parts();vard=ainstanceofe,f="object"==typeofa&&(a.hostname||a.path||a.pathname);if(a.nodeName&&(f=e.getDomAttribute(a),a=a[f]||"",f=!1),!d&&f&&void0!==a.pathname&&(a=a.toString()),"string"==typeofa)this._parts=e.parse(a,this._parts);else{if(!d&&!f)thrownewTypeError("invalid input");for(cind=d?a._parts:a)o.call(this._parts,c)&&(this._parts[c]=d[c])}returnthis.build(!b),this},n.is=function(a){varb=!1,d=!1,f=!1,g=!1,h=!1,i=!1,j=!1,k=!this._parts.urn;switch(this._parts.hostname&&(k=!1,d=e.ip4_expression.test(this._parts.hostname),f=e.ip6_expression.test(this._parts.hostname),b=d||f,h=(g=!b)&&c&&c.has(this._parts.hostname),i=g&&e.idn_expression.test(this._parts.hostname),j=g&&e.punycode_expression.test(this._parts.hostname)),a.toLowerCase()){case"relative":returnk;case"absolute":return!k;case"domain":case"name":returng;case"sld":returnh;case"ip":returnb;case"ip4":case"ipv4":case"inet4":returnd;case"ip6":case"ipv6":case"inet6":returnf;case"idn":returni;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":returnj}returnnull};vars=n.protocol,t=n.port,u=n.hostname;n.protocol=function(a,b){if(void0!==a&&a&&(a=a.replace(/:(\/\/)?$/,""),!a.match(e.protocol_expression)))thrownewTypeError("Protocol '"+a+"' contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]");returns.call(this,a,b)},n.scheme=n.protocol,n.port=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0!==a&&(0===a&&(a=null),a&&(a+="",":"===a.charAt(0)&&(a=a.substring(1)),a.match(/[^0-9]/))))thrownewTypeError("Port '"+a+"' contains characters other than [0-9]");returnt.call(this,a,b)},n.hostname=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0!==a){varc={};e.parseHost(a,c),a=c.hostname}returnu.call(this,a,b)},n.host=function(a,b){returnthis._parts.urn?void0===a?"":this:void0===a?this._parts.hostname?e.buildHost(this._parts):"":(e.parseHost(a,this._parts),this.build(!b),this)},n.authority=function(a,b){returnthis._parts.urn?void0===a?"":this:void0===a?this._parts.hostname?e.buildAuthority(this._parts):"":(e.parseAuthority(a,this._parts),this.build(!b),this)},n.userinfo=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0===a){if(!this._parts.username)return"";varc=e.buildUserinfo(this._parts);returnc.substring(0,c.length-1)}return"@"!==a[a.length-1]&&(a+="@"),e.parseUserinfo(a,this._parts),this.build(!b),this},n.resource=function(a,b){varc;returnvoid0===a?this.path()+this.search()+this.hash():(c=e.parse(a),this._parts.path=c.path,this._parts.query=c.query,this._parts.fragment=c.fragment,this.build(!b),this)},n.subdomain=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0===a){if(!this._parts.hostname||this.is("IP"))return"";varc=this._parts.hostname.length-this.domain().length-1;returnthis._parts.hostname.substring(0,c)||""}returnc=this._parts.hostname.length-this.domain().length,c=this._parts.hostname.substring(0,c),c=RegExp("^"+f(c)),a&&"."!==a.charAt(a.length-1)&&(a+="."),a&&e.ensureValidHostname(a),this._parts.hostname=this._parts.hostname.replace(c,a),this.build(!b),this},n.domain=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if("boolean"==typeofa&&(b=a,a=void0),void0===a){if(!this._parts.hostname||this.is("IP"))return"";varc=this._parts.hostname.match(/\./g);returnc&&2>c.length?this._parts.hostname:(c=this._parts.hostname.length-this.tld(b).length-1,c=this._parts.hostname.lastIndexOf(".",c-1)+1,this._parts.hostname.substring(c)||"")}if(!a)thrownewTypeError("cannot set domain empty");returne.ensureValidHostname(a),!this._parts.hostname||this.is("IP")?this._parts.hostname=a:(c=RegExp(f(this.domain())+"$"),this._parts.hostname=this._parts.hostname.replace(c,a)),this.build(!b),this},n.tld=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if("boolean"==typeofa&&(b=a,a=void0),void0===a){if(!this._parts.hostname||this.is("IP"))return"";vard=this._parts.hostname.lastIndexOf("."),d=this._parts.hostname.substring(d+1);return!0!==b&&c&&c.list[d.toLowerCase()]?c.get(this._parts.hostname)||d:d}if(!a)thrownewTypeError("cannot set TLD empty");if(a.match(/[^a-zA-Z0-9-]/)){if(!c||!c.is(a))thrownewTypeError("TLD '"+a+"' contains characters other than [A-Z0-9]");d=RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a)}else{if(!this._parts.hostname||this.is("IP"))thrownewReferenceError("cannot set TLD on non-domain host");d=RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(d,a)}returnthis.build(!b),this},n.directory=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0===a||!0===a){if(!this._parts.path&&!this._parts.hostname)return"";if("/"===this._parts.path)return"/";varc=this._parts.path.length-this.filename().length-1,c=this._parts.path.substring(0,c)||(this._parts.hostname?"/":"");returna?e.decodePath(c):c}returnc=this._parts.path.length-this.filename().length,c=this._parts.path.substring(0,c),c=RegExp("^"+f(c)),this.is("relative")||(a||(a="/"),"/"!==a.charAt(0)&&(a="/"+a)),a&&"/"!==a.charAt(a.length-1)&&(a+="/"),a=e.recodePath(a),this._parts.path=this._parts.path.replace(c,a),this.build(!b),this},n.filename=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";varc=this._parts.path.lastIndexOf("/"),c=this._parts.path.substring(c+1);returna?e.decodePathSegment(c):c}c=!1,"/"===a.charAt(0)&&(a=a.substring(1)),a.match(/\.?\//)&&(c=!0);vard=RegExp(f(this.filename())+"$");returna=e.recodePath(a),this._parts.path=this._parts.path.replace(d,a),c?this.normalizePath(b):this.build(!b),this},n.suffix=function(a,b){if(this._parts.urn)returnvoid0===a?"":this;if(void0===a||!0===a){if(!this._parts.path||"/"===this._parts.path)return"";varc=this.filename(),d=c.lastIndexOf(".");return-1===d?"":(c=c.substring(d+1),c=/^[a-z0-9%]+$/i.test(c)?c:"",a?e.decodePathSegment(c):c)}if("."===a.charAt(0)&&(a=a.substring(1)),c=this.suffix())d=a?RegExp(f(c)+"$"):RegExp(f("."+c)+"$");else{if(!a)returnthis;this._parts.path+="."+e.recodePath(a)}returnd&&(a=e.recodePath(a),this._parts.path=this._parts.path.replace(d,a)),this.build(!b),this},n.segment=function(a,b,c){vard=this._parts.urn?":":"/",e=this.path(),f="/"===e.substring(0,1),e=e.split(d);if(void0!==a&&"number"!=typeofa&&(c=b,b=a,a=void0),void0!==a&&"number"!=typeofa)throwError("Bad segment '"+a+"', must be 0-based integer");if(f&&e.shift(),0>a&&(a=Math.max(e.length+a,0)),void0===b)returnvoid0===a?e:e[a];if(null===a||void0===e[a])if(h(b)){e=[],a=0;for(varg=b.length;g>a;a++)(b[a].length||e.length&&e[e.length-1].length)&&(e.length&&!e[e.length-1].length&&e.pop(),e.push(b[a]))}else(b||"string"==typeofb)&&(""===e[e.length-1]?e[e.length-1]=b:e.push(b));elseb||"string"==typeofb&&b.length?e[a]=b:e.splice(a,1);returnf&&e.unshift(""),this.path(e.join(d),c)},n.segmentCoded=function(a,b,c){vard,f;if("number"!=typeofa&&(c=b,b=a,a=void0),void0===b){if(a=this.segment(a,b,c),h(a))for(d=0,f=a.length;f>d;d++)a[d]=e.decode(a[d]);elsea=void0!==a?e.decode(a):void0;returna}if(h(b))for(d=0,f=b.length;f>d;d++)b[d]=e.decode(b[d]);elseb="string"==typeofb?e.encode(b):b;returnthis.segment(a,b,c)};varv=n.query;returnn.query=function(a,b){if(!0===a)returne.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("function"==typeofa){varc=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace),d=a.call(this,c);returnthis._parts.query=e.buildQuery(d||c,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this}returnvoid0!==a&&"string"!=typeofa?(this._parts.query=e.buildQuery(a,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),this.build(!b),this):v.call(this,a,b)},n.setQuery=function(a,b,c){vard=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);if("object"==typeofa)for(varfina)o.call(a,f)&&(d[f]=a[f]);else{if("string"!=typeofa)thrownewTypeError("URI.addQuery() accepts an object, string as the name parameter");d[a]=void0!==b?b:null}returnthis._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeofa&&(c=b),this.build(!c),this},n.addQuery=function(a,b,c){vard=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);returne.addQuery(d,a,void0===b?null:b),this._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeofa&&(c=b),this.build(!c),this},n.removeQuery=function(a,b,c){vard=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);returne.removeQuery(d,a,b),this._parts.query=e.buildQuery(d,this._parts.duplicateQueryParameters,this._parts.escapeQuerySpace),"string"!=typeofa&&(c=b),this.build(!c),this},n.hasQuery=function(a,b,c){vard=e.parseQuery(this._parts.query,this._parts.escapeQuerySpace);returne.hasQuery(d,a,b,c)},n.setSearch=n.setQuery,n.addSearch=n.addQuery,n.removeSearch=n.removeQuery,n.hasSearch=n.hasQuery,n.normalize=function(){returnthis._parts.urn?this.normalizeProtocol(!1).normalizeQuery(!1).normalizeFragment(!1).build():this.normalizeProtocol(!1).normalizeHostname(!1).normalizePort(!1).normalizePath(!1).normalizeQuery(!1).normalizeFragment(!1).build()},n.normalizeProtocol=function(a){return"string"==typeofthis._parts.protocol&&(this._parts.protocol=this._parts.protocol.toLowerCase(),this.build(!a)),this},n.normalizeHostname=function(c){returnthis._parts.hostname&&(this.is("IDN")&&a?this._parts.hostname=a.toASCII(this._parts.hostname):this.is("IPv6")&&b&&(this._parts.hostname=b.best(this._parts.hostname)),this._parts.hostname=this._parts.hostname.toLowerCase(),this.build(!c)),this},n.normalizePort=function(a){return"string"==typeofthis._parts.protocol&&this._parts.port===e.defaultPorts[this._parts.protocol]&&(this._parts.port=null,this.build(!a)),this},n.normalizePath=function(a){if(this._parts.urn||!this._parts.path||"/"===this._parts.path)returnthis;varb,c,d,f=this._parts.path,g="";for("/"!==f.charAt(0)&&(b=!0,f="/"+f),f=f.replace(/(\/(\.\/)+)|(\/\.$)/g,"/").replace(/\/{2,}/g,"/"),b&&(g=f.substring(1).match(/^(\.\.\/)+/)||"")&&(g=g[0]);c=f.indexOf("/.."),-1!==c;)0!==c?(d=f.substring(0,c).lastIndexOf("/"),-1===d&&(d=c),f=f.substring(0,d)+f.substring(c+3)):f=f.substring(3);returnb&&this.is("relative")&&(f=g+f.substring(1)),f=e.recodePath(f),this._parts.path=f,this.build(!a),this},n.normalizePathname=n.normalizePath,n.normalizeQuery=function(a){return"string"==typeofthis._parts.query&&(this._parts.query.length?this.query(e.parseQuery(this._parts.query,this._parts.escapeQuerySpace)):this._parts.query=null,this.build(!a)),this},n.normalizeFragment=function(a){returnthis._parts.fragment||(this._parts.fragment=null,this.build(!a)),this},n.normalizeSearch=n.normalizeQuery,n.normalizeHash=n.normalizeFragment,n.iso8859=function(){vara=e.encode,b=e.decode;returne.encode=escape,e.decode=decodeURIComponent,this.normalize(),e.encode=a,e.decode=b,this},n.unicode=function(){vara=e.encode,b=e.decode;returne.encode=l,e.decode=unescape,this.normalize(),e.encode=a,e.decode=b,this},n.readable=function(){varb=this.clone();b.username("").password("").normalize();varc="";if(b._parts.protocol&&(c+=b._parts.protocol+"://"),b._parts.hostname&&(b.is("punycode")&&a?(c+=a.toUnicode(b._parts.hostname),b._parts.port&&(c+=":"+b._parts.port)):c+=b.host()),b._parts.hostname&&b._parts.path&&"/"!==b._parts.path.charAt(0)&&(c+="/"),c+=b.path(!0),b._parts.query){for(vard="",f=0,g=b._parts.query.split("&"),h=g.length;h>f;f++){vari=(g[f]||"").split("="),d=d+("&"+e.decodeQuery(i[0],this._parts.escapeQuerySpace).replace(/&/g,"%26"));void0!==i[1]&&(d+="="+e.decodeQuery(i[1],this._parts.escapeQuerySpace).replace(/&/g,"%26"))}c+="?"+d.substring(1)}returnc+=e.decodeQuery(b.hash(),!0)},n.absoluteTo=function(a){varb,c,d=this.clone(),f=["protocol","username","password","hostname","port"];if(this._parts.urn)throwError("URNs do not have any generally defined hierarchical components");if(ainstanceofe||(a=newe(a)),d._parts.protocol||(d._parts.protocol=a._parts.protocol),this._parts.hostname)returnd;for(b=0;c=f[b];b++)d._parts[c]=a._parts[c];returnd._parts.path?".."===d._parts.path.substring(-2)&&(d._parts.path+="/"):(d._parts.path=a._parts.path,d._parts.query||(d._parts.query=a._parts.query)),"/"!==d.path().charAt(0)&&(a=a.directory(),d._parts.path=(a?a+"/":"")+d._parts.path,d.normalizePath()),d.build(),d},n.relativeTo=function(a){varb,c,d,f,g=this.clone().normalize();if(g._parts.urn)throwError("URNs do not have any generally defined hierarchical components");if(a=newe(a).normalize(),b=g._parts,c=a._parts,d=g.path(),f=a.path(),"/"!==d.charAt(0))throwError("URI is already relative");if("/"!==f.charAt(0))throwError("Cannot calculate a URI relative to another relative URI");returnb.protocol===c.protocol&&(b.protocol=null),b.username!==c.username||b.password!==c.password||null!==b.protocol||null!==b.username||null!==b.password||b.hostname!==c.hostname||b.port!==c.port?g.build():(b.hostname=null,b.port=null,d===f?(b.path="",g.build()):(a=e.commonPath(g.path(),a.path()))?(c=c.path.substring(a.length).replace(/[^\/]*$/,"").replace(/.*?\//g,"../"),b.path=c+b.path.substring(a.length),g.build()):g.build())},n.equals=function(a){varb=this.clone();a=newe(a);varc,d={},f={},g={};if(b.normalize(),a.normalize(),b.toString()===a.toString())return!0;if(d=b.query(),f=a.query(),b.query(""),a.query(""),b.toString()!==a.toString()||d.length!==f.length)return!1;d=e.parseQuery(d,this._parts.escapeQuerySpace),f=e.parseQuery(f,this._parts.escapeQuerySpace);for(cind)if(o.call(d,c)){if(h(d[c])){if(!j(d[c],f[c]))return!1}elseif(d[c]!==f[c])return!1;g[c]=!0}for(cinf)if(o.call(f,c)&&!g[c])return!1;return!0},n.duplicateQueryParameters=function(a){returnthis._parts.duplicateQueryParameters=!!a,this},n.escapeQuerySpace=function(a){returnthis._parts.escapeQuerySpace=!!a,this},e}),function(a,b){"object"==typeofexports?module.exports=b(require("./URI")):"function"==typeofdefine&&define.amd?define(["./URI"],b):b(a.URI)}(this,function(a){varb=a.prototype,c=b.fragment;a.fragmentPrefix="?";vard=a._parts;returna._parts=function(){varb=d();returnb.fragmentPrefix=a.fragmentPrefix,b},b.fragmentPrefix=function(a){returnthis._parts.fragmentPrefix=a,this},b.fragment=function(b,d){vare=this._parts.fragmentPrefix,f=this._parts.fragment||"";return!0===b?f.substring(0,e.length)!==e?{}:a.parseQuery(f.substring(e.length)):void0!==b&&"string"!=typeofb?(this._parts.fragment=e+a.buildQuery(b),this.build(!d),this):c.call(this,b,d)},b.addFragment=function(b,c,d){vare=this._parts.fragmentPrefix,f=a.parseQuery((this._parts.fragment||"").substring(e.length));returna.addQuery(f,b,c),this._parts.fragment=e+a.buildQuery(f),"string"!=typeofb&&(d=c),this.build(!d),this},b.removeFragment=function(b,c,d){vare=this._parts.fragmentPrefix,f=a.parseQuery((this._parts.fragment||"").substring(e.length));returna.removeQuery(f,b,c),this._parts.fragment=e+a.buildQuery(f),"string"!=typeofb&&(d=c),this.build(!d),this},b.addHash=b.addFragment,b.removeHash=b.removeFragment,{}}),function(a){"use strict";functionb(a){varc;if(null===a||void0===a)return!1;if(d.isArray(a))returna.length>0;if("string"==typeofa||"number"==typeofa||"boolean"==typeofa)return!0;for(cina)if(a.hasOwnProperty(c)&&b(a[c]))return!0;return!1}varc=function(){functiona(a){this.options=a}returna.prototype.toString=function(){returnJSON&&JSON.stringify?JSON.stringify(this.options):this.options},a}(),d=function(){functiona(a){return"[object Array]"===Object.prototype.toString.apply(a)}functionb(a){return"[object String]"===Object.prototype.toString.apply(a)}functionc(a){return"[object Number]"===Object.prototype.toString.apply(a)}functiond(a){return"[object Boolean]"===Object.prototype.toString.apply(a)}functione(a,b){varc,d="",e=!0;for(c=0;c<a.length;c+=1)e?e=!1:d+=b,d+=a[c];returnd}functionf(a,b){for(varc=[],d=0;d<a.length;d+=1)c.push(b(a[d]));returnc}functiong(a,b){for(varc=[],d=0;d<a.length;d+=1)b(a[d])&&c.push(a[d]);returnc}functionh(a){if("object"!=typeofa||null===a)returna;Object.freeze(a);varb,c;for(cina)a.hasOwnProperty(c)&&(b=a[c],"object"==typeofb&&i(b));returna}functioni(a){return"function"==typeofObject.freeze?h(a):a}return{isArray:a,isString:b,isNumber:c,isBoolean:d,join:e,map:f,filter:g,deepFreeze:i}}(),e=function(){functiona(a){returna>="a"&&"z">=a||a>="A"&&"Z">=a}functionb(a){returna>="0"&&"9">=a}functionc(a){returnb(a)||a>="a"&&"f">=a||a>="A"&&"F">=a}return{isAlpha:a,isDigit:b,isHexDigit:c}}(),f=function(){functiona(a){varb,c,d="",e=g.encode(a);for(c=0;c<e.length;c+=1)b=e.charCodeAt(c),d+="%"+(16>b?"0":"")+b.toString(16).toUpperCase();returnd}functionb(a,b){return"%"===a.charAt(b)&&e.isHexDigit(a.charAt(b+1))&&e.isHexDigit(a.charAt(b+2))}functionc(a,b){returnparseInt(a.substr(b,2),16)}functiond(a){if(!b(a,0))return!1;vard=c(a,1),e=g.numBytes(d);if(0===e)return!1;for(varf=1;e>f;f+=1)if(!b(a,3*f)||!g.isValidFollowingCharCode(c(a,3*f+1)))return!1;return!0}functionf(a,d){vare=a.charAt(d);if(!b(a,d))returne;varf=c(a,d+1),h=g.numBytes(f);if(0===h)returne;for(vari=1;h>i;i+=1)if(!b(a,d+3*i)||!g.isValidFollowingCharCode(c(a,d+3*i+1)))returne;returna.substr(d,3*h)}varg={encode:function(a){returnunescape(encodeURIComponent(a))},numBytes:function(a){return127>=a?1:a>=194&&223>=a?2:a>=224&&239>=a?3:a>=240&&244>=a?4:0},isValidFollowingCharCode:function(a){returna>=128&&191>=a}};return{encodeCharacter:a,isPctEncoded:d,pctCharAt:f}}(),g=function(){functiona(a){returne.isAlpha(a)||e.isDigit(a)||"_"===a||f.isPctEncoded(a)}functionb(a){returne.isAlpha(a)||e.isDigit(a)||"-"===a||"."===a||"_"===a||"~"===a}functionc(a){return":"===a||"/"===a||"?"===a||"#"===a||"["===a||"]"===a||"@"===a||"!"===a||"$"===a||"&"===a||"("===a||")"===a||"*"===a||"+"===a||","===a||";"===a||"="===a||"'"===a}return{isVarchar:a,isUnreserved:b,isReserved:c}}(),h=function(){functiona(a,b){varc,d="",e="";for(("number"==typeofa||"boolean"==typeofa)&&(a=a.toString()),c=0;c<a.length;c+=e.length)e=a.charAt(c),d+=g.isUnreserved(e)||b&&g.isReserved(e)?e:f.encodeCharacter(e);returnd}functionb(b){returna(b,!0)}functionc(a,b){varc=f.pctCharAt(a,b);returnc.length>1?c:g.isReserved(c)||g.isUnreserved(c)?c:f.encodeCharacter(c)}functiond(a){varb,c="",d="";for(b=0;b<a.length;b+=d.length)d=f.pctCharAt(a,b),c+=d.length>1?d:g.isReserved(d)||g.isUnreserved(d)?d:f.encodeCharacter(d);returnc}return{encode:a,encodePassReserved:b,encodeLiteral:d,encodeLiteralCharacter:c}}(),i=function(){functiona(a){b[a]={symbol:a,separator:"?"===a?"&":""===a||"+"===a||"#"===a?",":a,named:";"===a||"&"===a||"?"===a,ifEmpty:"&"===a||"?"===a?"=":"",first:"+"===a?"":a,encode:"+"===a||"#"===a?h.encodePassReserved:h.encode,toString:function(){returnthis.symbol}}}varb={};returna(""),a("+"),a("#"),a("."),a("/"),a(";"),a("?"),a("&"),{valueOf:function(a){returnb[a]?b[a]:"=,!@|".indexOf(a)>=0?null:b[""]}}}(),j=function(){functiona(a){this.literal=h.encodeLiteral(a)}returna.prototype.expand=function(){returnthis.literal},a.prototype.toString=a.prototype.expand,a}(),k=function(){functiona(a){functionb(){varb=a.substring(n,j);if(0===b.length)thrownewc({expressionText:a,message:"a varname must be specified",position:j});m={varname:b,exploded:!1,maxLength:null},n=null}functiond(){if(o===j)thrownewc({expressionText:a,message:"after a ':' you have to specify the length",position:j});m.maxLength=parseInt(a.substring(o,j),10),o=null}varh,j,k=[],m=null,n=null,o=null,p="";for(h=function(b){vard=i.valueOf(b);if(null===d)thrownewc({expressionText:a,message:"illegal use of reserved operator",position:j,operator:b});returnd}(a.charAt(0)),j=h.symbol.length,n=j;j<a.length;j+=p.length){if(p=f.pctCharAt(a,j),null!==n){if("."===p){if(n===j)thrownewc({expressionText:a,message:"a varname MUST NOT start with a dot",position:j});continue}if(g.isVarchar(p))continue;b()}if(null!==o){if(j===o&&"0"===p)thrownewc({expressionText:a,message:"A :prefix must not start with digit 0",position:j});if(e.isDigit(p)){if(j-o>=4)thrownewc({expressionText:a,message:"A :prefix must have max 4 digits",position:j});continue}d()}if(":"!==p)if("*"!==p){if(","!==p)thrownewc({expressionText:a,message:"illegal character",character:p,position:j});k.push(m),m=null,n=j+1}else{if(null===m)thrownewc({expressionText:a,message:"exploded without varspec",position:j});if(m.exploded)thrownewc({expressionText:a,message:"exploded twice",position:j});if(m.maxLength)thrownewc({expressionText:a,message:"an explode (*) MUST NOT follow to a prefix",position:j});m.exploded=!0}else{if(null!==m.maxLength)thrownewc({expressionText:a,message:"only one :maxLength is allowed per varspec",position:j});if(m.exploded)thrownewc({expressionText:a,message:"an exploeded varspec MUST NOT be varspeced",position:j});o=j+1}}returnnull!==n&&b(),null!==o&&d(),k.push(m),newl(a,h,k)}functionb(a){returna.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}functiond(d){vare,f,g,h=[],i=null,k="",l=!0,n=0;for(e=0;e<d.length;e+=1)if(f=d.charAt(e),null===n){if(null===i)thrownewError("reached unreachable code");if("{"===f)thrownewc({templateText:d,message:"brace already opened",position:e});if("}"===f){if(i+1===e)thrownewc({templateText:d,message:"empty braces",position:i});try{g=a(d.substring(i+1,e))}catch(o){if(o.prototype===c.prototype)thrownewc({templateText:d,message:o.options.message,position:i+o.options.position,details:o.options});throwo}h.push(g),0===g.operator.symbol.length?k+="([^/]+)":l=!1,i=null,n=e+1}}else{if("}"===f)thrownewc({templateText:d,message:"unopened brace closed",position:e});"{"===f&&(e>n&&(g=newj(d.substring(n,e)),h.push(g),k+=b(g.literal)),n=null,i=e)}if(null!==i)thrownewc({templateText:d,message:"unclosed brace",position:i});returnn<d.length&&(g=newj(d.substring(n)),h.push(g),k+=b(g.literal)),l===!1&&(k=void0),newm(d,h,k)}returnd}(),l=function(){functiona(a){returnJSON&&JSON.stringify?JSON.stringify(a):a}functionc(a){if(!b(a))return!0;if(d.isString(a))return""===a;if(d.isNumber(a)||d.isBoolean(a))return!1;if(d.isArray(a))return0===a.length;for(varcina)if(a.hasOwnProperty(c))return!1;return!0}functione(a){varb,c=[];for(bina)a.hasOwnProperty(b)&&c.push({name:b,value:a[b]});returnc}functionf(a,b,c){this.templateText=a,this.operator=b,this.varspecs=c}functiong(a,b,c){vard="";if(c=c.toString(),b.named){if(d+=h.encodeLiteral(a.varname),""===c)returnd+=b.ifEmpty;d+="="}returnnull!==a.maxLength&&(c=c.substr(0,a.maxLength)),d+=b.encode(c)}functioni(a){returnb(a.value)}functionj(a,f,g){varj=[],k="";if(f.named){if(k+=h.encodeLiteral(a.varname),c(g))returnk+=f.ifEmpty;k+="="}returnd.isArray(g)?(j=g,j=d.filter(j,b),j=d.map(j,f.encode),k+=d.join(j,",")):(j=e(g),j=d.filter(j,i),j=d.map(j,function(a){returnf.encode(a.name)+","+f.encode(a.value)}),k+=d.join(j,",")),k}functionk(a,f,g){varj=d.isArray(g),k=[];returnj?(k=g,k=d.filter(k,b),k=d.map(k,function(b){vard=h.encodeLiteral(a.varname);returnd+=c(b)?f.ifEmpty:"="+f.encode(b)})):(k=e(g),k=d.filter(k,i),k=d.map(k,function(a){varb=h.encodeLiteral(a.name);returnb+=c(a.value)?f.ifEmpty:"="+f.encode(a.value)})),d.join(k,f.separator)}functionl(a,c){varf=[],g="";returnd.isArray(c)?(f=c,f=d.filter(f,b),f=d.map(f,a.encode),g+=d.join(f,a.separator)):(f=e(c),f=d.filter(f,function(a){returnb(a.value)}),f=d.map(f,function(b){returna.encode(b.name)+"="+a.encode(b.value)}),g+=d.join(f,a.separator)),g}returnf.prototype.toString=function(){returnthis.templateText},f.prototype.expand=function(e){varf,h,i,m,n=[],o=!1,p=this.operator;for(f=0;f<this.varspecs.length;f+=1)if(h=this.varspecs[f],i=e[h.varname],null!==i&&void0!==i)if(h.exploded&&(o=!0),m=d.isArray(i),"string"==typeofi||"number"==typeofi||"boolean"==typeofi)n.push(g(h,p,i));else{if(h.maxLength&&b(i))thrownewError("Prefix modifiers are not applicable to variables that have composite values. You tried to expand "+this+" with "+a(i));h.exploded?b(i)&&(p.named?n.push(k(h,p,i)):n.push(l(p,i))):(p.named||!c(i))&&n.push(j(h,p,i))}return0===n.length?"":p.first+d.join(n,p.separator)},f}(),m=function(){functiona(a,b,c){this.templateText=a,this.expressions=b,void0!==c&&(this.regexp=newRegExp("^"+c+"$")),d.deepFreeze(this)}returna.prototype.toString=function(){returnthis.templateText},a.prototype.expand=function(a){varb,c="";for(b=0;b<this.expressions.length;b+=1)c+=this.expressions[b].expand(a);returnc},a.prototype.extract=function(a){varb,c,d,e,f=1,g=!0,h={};if(void0!==this.regexp&&this.regexp.test(a)){for(e=this.regexp.exec(a),b=0;b<this.expressions.length;b+=1)c=this.expressions[b],void0===c.literal&&(void0!==c.operator&&0===c.operator.symbol.length&&1===c.varspecs.length?(d=c.varspecs[0],d.exploded===!1&&null===d.maxLength&&-1===e[f].indexOf(",")?(h[d.varname]=decodeURIComponent(e[f]),f+=1):g=!1):g=!1);if(g)returnh}return!1},a.parse=k,a.UriTemplateError=c,a}();a(m)}(function(a){"use strict";"undefined"!=typeofmodule?module.exports=a:"function"==typeofdefine?define([],function(){returna}):"undefined"!=typeofwindow?window.UriTemplate=a:global.UriTemplate=a});varLZString=function(){functiona(a,b){if(!e[a]){e[a]={};for(varc=0;c<a.length;c++)e[a][a.charAt(c)]=c}returne[a][b]}varb=String.fromCharCode,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",e={},f={compressToBase64:function(a){if(null==a)return"";varb=f._compress(a,6,function(a){returnc.charAt(a)});switch(b.length%4){default:case0:returnb;case1:returnb+"===";case2:returnb+"==";case3:returnb+"="}},decompressFromBase64:function(b){returnnull==b?"":""==b?null:f._decompress(b.length,32,function(d){returna(c,b.charAt(d))})},compressToUTF16:function(a){returnnull==a?"":f._compress(a,15,function(a){returnb(a+32)})+""},decompressFromUTF16:function(a){returnnull==a?"":""==a?null:f._decompress(a.length,16384,function(b){returna.charCodeAt(b)-32})},compressToUint8Array:function(a){for(varb=f.compress(a),c=newUint8Array(2*b.length),d=0,e=b.length;e>d;d++){varg=b.charCodeAt(d);c[2*d]=g>>>8,c[2*d+1]=g%256}returnc},decompressFromUint8Array:function(a){if(null===a||void0===a)returnf.decompress(a);for(varc=newArray(a.length/2),d=0,e=c.length;e>d;d++)c[d]=256*a[2*d]+a[2*d+1];varg=[];returnc.forEach(function(a){g.push(b(a))}),f.decompress(g.join(""))},compressToEncodedURIComponent:function(a){returnnull==a?"":f._compress(a,6,function(a){returnd.charAt(a)})},decompressFromEncodedURIComponent:function(b){returnnull==b?"":""==b?null:(b=b.replace(/ /g,"+"),f._decompress(b.length,32,function(c){returna(d,b.charAt(c))}))},compress:function(a){returnf._compress(a,16,function(a){returnb(a)})},_compress:function(a,b,c){if(null==a)return"";vard,e,f,g={},h={},i="",j="",k="",l=2,m=3,n=2,o=[],p=0,q=0;for(f=0;f<a.length;f+=1)if(i=a.charAt(f),Object.prototype.hasOwnProperty.call(g,i)||(g[i]=m++,h[i]=!0),j=k+i,Object.prototype.hasOwnProperty.call(g,j))k=j;else{if(Object.prototype.hasOwnProperty.call(h,k)){if(k.charCodeAt(0)<256){for(d=0;n>d;d++)p<<=1,q==b-1?(q=0,o.push(c(p)),p=0):q++;for(e=k.charCodeAt(0),d=0;8>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}else{for(e=1,d=0;n>d;d++)p=p<<1|e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e=0;for(e=k.charCodeAt(0),d=0;16>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}l--,0==l&&(l=Math.pow(2,n),n++),deleteh[k]}elsefor(e=g[k],d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;l--,0==l&&(l=Math.pow(2,n),n++),g[j]=m++,k=String(i);}if(""!==k){if(Object.prototype.hasOwnProperty.call(h,k)){if(k.charCodeAt(0)<256){for(d=0;n>d;d++)p<<=1,q==b-1?(q=0,o.push(c(p)),p=0):q++;for(e=k.charCodeAt(0),d=0;8>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}else{for(e=1,d=0;n>d;d++)p=p<<1|e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e=0;for(e=k.charCodeAt(0),d=0;16>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1}l--,0==l&&(l=Math.pow(2,n),n++),deleteh[k]}elsefor(e=g[k],d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;l--,0==l&&(l=Math.pow(2,n),n++)}for(e=2,d=0;n>d;d++)p=p<<1|1&e,q==b-1?(q=0,o.push(c(p)),p=0):q++,e>>=1;for(;;){if(p<<=1,q==b-1){o.push(c(p));break}q++}returno.join("")},decompress:function(a){returnnull==a?"":""==a?null:f._decompress(a.length,32768,function(b){returna.charCodeAt(b)})},_decompress:function(a,c,d){vare,f,g,h,i,j,k,l,m=[],n=4,o=4,p=3,q="",r=[],s={val:d(0),position:c,index:1};for(f=0;3>f;f+=1)m[f]=f;for(h=0,j=Math.pow(2,2),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;switch(e=h){case0:for(h=0,j=Math.pow(2,8),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;l=b(h);break;case1:for(h=0,j=Math.pow(2,16),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;l=b(h);break;case2:return""}for(m[3]=l,g=l,r.push(l);;){if(s.index>a)return"";for(h=0,j=Math.pow(2,p),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;switch(l=h){case0:for(h=0,j=Math.pow(2,8),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;m[o++]=b(h),l=o-1,n--;break;case1:for(h=0,j=Math.pow(2,16),k=1;k!=j;)i=s.val&s.position,s.position>>=1,0==s.position&&(s.position=c,s.val=d(s.index++)),h|=(i>0?1:0)*k,k<<=1;m[o++]=b(h),l=o-1,n--;break;case2:returnr.join("")}if(0==n&&(n=Math.pow(2,p),p++),m[l])q=m[l];else{if(l!==o)returnnull;q=g+g.charAt(0)}r.push(q),m[o++]=g+q.charAt(0),n--,g=q,0==n&&(n=Math.pow(2,p),p++)}}};returnf}();"function"==typeofdefine&&define.amd?define(function(){returnLZString}):"undefined"!=typeofmodule&&null!=module&&(module.exports=LZString),function(a){functionb(a,b){returnfunction(c){returni(a.call(this,c),b)}}functionc(a,b){returnfunction(c){returnthis.lang().ordinal(a.call(this,c),b)}}functiond(){}functione(a){u(a),g(this,a)}functionf(a){varb=o(a),c=b.year||0,d=b.month||0,e=b.week||0,f=b.day||0,g=b.hour||0,h=b.minute||0,i=b.second||0,j=b.millisecond||0;this._milliseconds=+j+1e3*i+6e4*h+36e5*g,this._days=+f+7*e,this._months=+d+12*c,this._data={},this._bubble()}functiong(a,b){for(varcinb)b.hasOwnProperty(c)&&(a[c]=b[c]);returnb.hasOwnProperty("toString")&&(a.toString=b.toString),b.hasOwnProperty("valueOf")&&(a.valueOf=b.valueOf),a}functionh(a){return0>a?Math.ceil(a):Math.floor(a)}functioni(a,b,c){for(vard=Math.abs(a)+"",e=a>=0;d.length<b;)d="0"+d;return(e?c?"+":"":"-")+d}functionj(a,b,c,d){vare,f,g=b._milliseconds,h=b._days,i=b._months;g&&a._d.setTime(+a._d+g*c),(h||i)&&(e=a.minute(),f=a.hour()),h&&a.date(a.date()+h*c),i&&a.month(a.month()+i*c),g&&!d&&ca.updateOffset(a),(h||i)&&(a.minute(e),a.hour(f))}functionk(a){return"[object Array]"===Object.prototype.toString.call(a)}functionl(a){return"[object Date]"===Object.prototype.toString.call(a)||ainstanceofDate}functionm(a,b,c){vard,e=Math.min(a.length,b.length),f=Math.abs(a.length-b.length),g=0;for(d=0;e>d;d++)(c&&a[d]!==b[d]||!c&&q(a[d])!==q(b[d]))&&g++;returng+f}functionn(a){if(a){varb=a.toLowerCase().replace(/(.)s$/,"$1");a=Qa[a]||Ra[b]||b}returna}functiono(a){varb,c,d={};for(cina)a.hasOwnProperty(c)&&(b=n(c),b&&(d[b]=a[c]));returnd}functionp(b){varc,d;if(0===b.indexOf("week"))c=7,d="day";else{if(0!==b.indexOf("month"))return;c=12,d="month"}ca[b]=function(e,f){varg,h,i=ca.fn._lang[b],j=[];if("number"==typeofe&&(f=e,e=a),h=function(a){varb=ca().utc().set(d,a);returni.call(ca.fn._lang,b,e||"")},null!=f)returnh(f);for(g=0;c>g;g++)j.push(h(g));returnj}}functionq(a){varb=+a,c=0;return0!==b&&isFinite(b)&&(c=b>=0?Math.floor(b):Math.ceil(b)),c}functionr(a,b){returnnewDate(Date.UTC(a,b+1,0)).getUTCDate()}functions(a){returnt(a)?366:365}functiont(a){returna%4===0&&a%100!==0||a%400===0}functionu(a){varb;a._a&&-2===a._pf.overflow&&(b=a._a[ia]<0||a._a[ia]>11?ia:a._a[ja]<1||a._a[ja]>r(a._a[ha],a._a[ia])?ja:a._a[ka]<0||a._a[ka]>23?ka:a._a[la]<0||a._a[la]>59?la:a._a[ma]<0||a._a[ma]>59?ma:a._a[na]<0||a._a[na]>999?na:-1,a._pf._overflowDayOfYear&&(ha>b||b>ja)&&(b=ja),a._pf.overflow=b)}functionv(a){a._pf={empty:!1,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:!1,invalidMonth:null,invalidFormat:!1,userInvalidated:!1,iso:!1}}functionw(a){returnnull==a._isValid&&(a._isValid=!isNaN(a._d.getTime())&&a._pf.overflow<0&&!a._pf.empty&&!a._pf.invalidMonth&&!a._pf.nullInput&&!a._pf.invalidFormat&&!a._pf.userInvalidated,a._strict&&(a._isValid=a._isValid&&0===a._pf.charsLeftOver&&0===a._pf.unusedTokens.length)),a._isValid}functionx(a){returna?a.toLowerCase().replace("_","-"):a}functiony(a,b){returnb._isUTC?ca(a).zone(b._offset||0):ca(a).local()}functionz(a,b){returnb.abbr=a,oa[a]||(oa[a]=newd),oa[a].set(b),oa[a]}functionA(a){deleteoa[a]}functionB(a){varb,c,d,e,f=0,g=function(a){if(!oa[a]&&pa)try{require("./lang/"+a)}catch(b){}returnoa[a]};if(!a)returnca.fn._lang;if(!k(a)){if(c=g(a))returnc;a=[a]}for(;f<a.length;){for(e=x(a[f]).split("-"),b=e.length,d=x(a[f+1]),d=d?d.split("-"):null;b>0;){if(c=g(e.slice(0,b).join("-")))returnc;if(d&&d.length>=b&&m(e,d,!0)>=b-1)break;b--}f++}returnca.fn._lang}functionC(a){returna.match(/\[[\s\S]/)?a.replace(/^\[|\]$/g,""):a.replace(/\\/g,"")}functionD(a){varb,c,d=a.match(ta);for(b=0,c=d.length;c>b;b++)Va[d[b]]?d[b]=Va[d[b]]:d[b]=C(d[b]);returnfunction(e){varf="";for(b=0;c>b;b++)f+=d[b]instanceofFunction?d[b].call(e,a):d[b];returnf}}functionE(a,b){returna.isValid()?(b=F(b,a.lang()),Sa[b]||(Sa[b]=D(b)),Sa[b](a)):a.lang().invalidDate()}functionF(a,b){functionc(a){returnb.longDateFormat(a)||a}vard=5;for(ua.lastIndex=0;d>=0&&ua.test(a);)a=a.replace(ua,c),ua.lastIndex=0,d-=1;returna}functionG(a,b){varc,d=b._strict;switch(a){case"DDDD":returnGa;case"YYYY":case"GGGG":case"gggg":returnd?Ha:xa;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":returnd?Ia:ya;case"S":if(d)returnEa;case"SS":if(d)returnFa;case"SSS":case"DDD":returnd?Ga:wa;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":returnAa;case"a":case"A":returnB(b._l)._meridiemParse;case"X":returnDa;case"Z":case"ZZ":returnBa;case"T":returnCa;case"SSSS":returnza;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":returnd?Fa:va;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":returnd?Ea:va;default:returnc=newRegExp(O(N(a.replace("\\","")),"i"))}}functionH(a){a=a||"";varb=a.match(Ba)||[],c=b[b.length-1]||[],d=(c+"").match(Na)||["-",0,0],e=+(60*d[1])+q(d[2]);return"+"===d[0]?-e:e}functionI(a,b,c){vard,e=c._a;switch(a){case"M":case"MM":null!=b&&(e[ia]=q(b)-1);break;case"MMM":case"MMMM":d=B(c._l).monthsParse(b),null!=d?e[ia]=d:c._pf.invalidMonth=b;break;case"D":case"DD":null!=b&&(e[ja]=q(b));break;case"DDD":case"DDDD":null!=b&&(c._dayOfYear=q(b));break;case"YY":e[ha]=q(b)+(q(b)>68?1900:2e3);break;case"YYYY":case"YYYYY":case"YYYYYY":e[ha]=q(b);break;case"a":case"A":c._isPm=B(c._l).isPM(b);break;case"H":case"HH":case"h":case"hh":e[ka]=q(b);break;case"m":case"mm":e[la]=q(b);break;case"s":case"ss":e[ma]=q(b);break;case"S":case"SS":case"SSS":case"SSSS":e[na]=q(1e3*("0."+b));break;case"X":c._d=newDate(1e3*parseFloat(b));break;case"Z":case"ZZ":c._useUTC=!0,c._tzm=H(b);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":a=a.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":a=a.substr(0,2),b&&(c._w=c._w||{},c._w[a]=b)}}functionJ(a){varb,c,d,e,f,g,h,i,j,k,l=[];if(!a._d){for(d=L(a),a._w&&null==a._a[ja]&&null==a._a[ia]&&(f=function(b){varc=parseInt(b,10);returnb?b.length<3?c>68?1900+c:2e3+c:c:null==a._a[ha]?ca().weekYear():a._a[ha]},g=a._w,null!=g.GG||null!=g.W||null!=g.E?h=Y(f(g.GG),g.W||1,g.E,4,1):(i=B(a._l),j=null!=g.d?U(g.d,i):null!=g.e?parseInt(g.e,10)+i._week.dow:0,k=parseInt(g.w,10)||1,null!=g.d&&j<i._week.dow&&k++,h=Y(f(g.gg),k,j,i._week.doy,i._week.dow)),a._a[ha]=h.year,a._dayOfYear=h.dayOfYear),a._dayOfYear&&(e=null==a._a[ha]?d[ha]:a._a[ha],a._dayOfYear>s(e)&&(a._pf._overflowDayOfYear=!0),c=T(e,0,a._dayOfYear),a._a[ia]=c.getUTCMonth(),a._a[ja]=c.getUTCDate()),b=0;3>b&&null==a._a[b];++b)a._a[b]=l[b]=d[b];for(;7>b;b++)a._a[b]=l[b]=null==a._a[b]?2===b?1:0:a._a[b];l[ka]+=q((a._tzm||0)/60),l[la]+=q((a._tzm||0)%60),a._d=(a._useUTC?T:S).apply(null,l)}}functionK(a){varb;a._d||(b=o(a._i),a._a=[b.year,b.month,b.day,b.hour,b.minute,b.second,b.millisecond],J(a))}functionL(a){varb=newDate;returna._useUTC?[b.getUTCFullYear(),b.getUTCMonth(),b.getUTCDate()]:[b.getFullYear(),b.getMonth(),b.getDate()]}functionM(a){a._a=[],a._pf.empty=!0;varb,c,d,e,f,g=B(a._l),h=""+a._i,i=h.length,j=0;for(d=F(a._f,g).match(ta)||[],b=0;b<d.length;b++)e=d[b],c=(h.match(G(e,a))||[])[0],c&&(f=h.substr(0,h.indexOf(c)),f.length>0&&a._pf.unusedInput.push(f),h=h.slice(h.indexOf(c)+c.length),j+=c.length),Va[e]?(c?a._pf.empty=!1:a._pf.unusedTokens.push(e),I(e,c,a)):a._strict&&!c&&a._pf.unusedTokens.push(e);a._pf.charsLeftOver=i-j,h.length>0&&a._pf.unusedInput.push(h),a._isPm&&a._a[ka]<12&&(a._a[ka]+=12),a._isPm===!1&&12===a._a[ka]&&(a._a[ka]=0),J(a),u(a)}functionN(a){returna.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(a,b,c,d,e){returnb||c||d||e})}functionO(a){returna.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}functionP(a){varb,c,d,e,f;if(0===a._f.length)returna._pf.invalidFormat=!0,void(a._d=newDate(NaN));for(e=0;e<a._f.length;e++)f=0,b=g({},a),v(b),b._f=a._f[e],M(b),w(b)&&(f+=b._pf.charsLeftOver,f+=10*b._pf.unusedTokens.length,b._pf.score=f,(null==d||d>f)&&(d=f,c=b));g(a,c||b)}functionQ(a){varb,c=a._i,d=Ja.exec(c);if(d){for(a._pf.iso=!0,b=4;b>0;b--)if(d[b]){a._f=La[b-1]+(d[6]||"");break}for(b=0;4>b;b++)if(Ma[b][1].exec(c)){a._f+=Ma[b][0];break}c.match(Ba)&&(a._f+="Z"),M(a)}elsea._d=newDate(c)}functionR(b){varc=b._i,d=qa.exec(c);c===a?b._d=newDate:d?b._d=newDate(+d[1]):"string"==typeofc?Q(b):k(c)?(b._a=c.slice(0),J(b)):l(c)?b._d=newDate(+c):"object"==typeofc?K(b):b._d=newDate(c)}functionS(a,b,c,d,e,f,g){varh=newDate(a,b,c,d,e,f,g);return1970>a&&h.setFullYear(a),h}functionT(a){varb=newDate(Date.UTC.apply(null,arguments));return1970>a&&b.setUTCFullYear(a),b}functionU(a,b){if("string"==typeofa)if(isNaN(a)){if(a=b.weekdaysParse(a),"number"!=typeofa)returnnull}elsea=parseInt(a,10);returna}functionV(a,b,c,d,e){returne.relativeTime(b||1,!!c,a,d)}functionW(a,b,c){vard=ga(Math.abs(a)/1e3),e=ga(d/60),f=ga(e/60),g=ga(f/24),h=ga(g/365),i=45>d&&["s",d]||1===e&&["m"]||45>e&&["mm",e]||1===f&&["h"]||22>f&&["hh",f]||1===g&&["d"]||25>=g&&["dd",g]||45>=g&&["M"]||345>g&&["MM",ga(g/30)]||1===h&&["y"]||["yy",h];returni[2]=b,i[3]=a>0,i[4]=c,V.apply({},i)}functionX(a,b,c){vard,e=c-b,f=c-a.day();returnf>e&&(f-=7),e-7>f&&(f+=7),d=ca(a).add("d",f),{week:Math.ceil(d.dayOfYear()/7),year:d.year()}}functionY(a,b,c,d,e){varf,g,h=newDate(i(a,6,!0)+"-01-01").getUTCDay();returnc=null!=c?c:e,f=e-h+(h>d?7:0),g=7*(b-1)+(c-e)+f+1,{year:g>0?a:a-1,dayOfYear:g>0?g:s(a-1)+g}}functionZ(a){varb=a._i,c=a._f;return"undefined"==typeofa._pf&&v(a),null===b?ca.invalid({nullInput:!0}):("string"==typeofb&&(a._i=b=B().preparse(b)),ca.isMoment(b)?(a=g({},b),a._d=newDate(+b._d)):c?k(c)?P(a):M(a):R(a),newe(a))}function$(a,b){ca.fn[a]=ca.fn[a+"s"]=function(a){varc=this._isUTC?"UTC":"";returnnull!=a?(this._d["set"+c+b](a),ca.updateOffset(this),this):this._d["get"+c+b]()}}function_(a){ca.duration.fn[a]=function(){returnthis._data[a]}}functionaa(a,b){ca.duration.fn["as"+a]=function(){return+this/b}}function ba(a){var b=!1,c=ca;"undefined"==typeof ender&&(a?(fa.moment=function(){return!b&&console&&console.warn&&(b=!0,console.warn("Accessing Moment through the global scope is deprecated, and will be removed in an upcoming release.")),c.apply(null,arguments)},g(fa.moment,c)):fa.moment=ca)}for(var ca,da,ea="2.5.0",fa=this,ga=Math.round,ha=0,ia=1,ja=2,ka=3,la=4,ma=5,na=6,oa={},pa="undefined"!=typeof module&&module.exports&&"undefined"!=typeof require,qa=/^\/?Date\((\-?\d+)/i,ra=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,sa=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,ta=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,ua=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,va=/\d\d?/,wa=/\d{1,3}/,xa=/\d{1,4}/,ya=/[+\-]?\d{1,6}/,za=/\d+/,Aa=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,Ba=/Z|[\+\-]\d\d:?\d\d/gi,Ca=/T/i,Da=/[\+\-]?\d+(\.\d{1,3})?/,Ea=/\d/,Fa=/\d\d/,Ga=/\d{3}/,Ha=/\d{4}/,Ia=/[+\-]?\d{6}/,Ja=/^\s*\d{4}-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,Ka="YYYY-MM-DDTHH:mm:ssZ",La=["YYYY-MM-DD","GGGG-[W]WW","GGGG-[W]WW-E","YYYY-DDD"],Ma=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d{1,3}/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],Na=/([\+\-]|\d\d)/gi,Oa="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),Pa={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},Qa={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},Ra={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},Sa={},Ta="DDD w W M D d".split(""),Ua="M D H h m s w W".split(""),Va={M:function(){returnthis.month()+1},MMM:function(a){returnthis.lang().monthsShort(this,a)},MMMM:function(a){returnthis.lang().months(this,a)},D:function(){returnthis.date()},DDD:function(){returnthis.dayOfYear()},d:function(){returnthis.day()},dd:function(a){returnthis.lang().weekdaysMin(this,a)},ddd:function(a){returnthis.lang().weekdaysShort(this,a)},dddd:function(a){returnthis.lang().weekdays(this,a)},w:function(){returnthis.week()},W:function(){returnthis.isoWeek()},YY:function(){returni(this.year()%100,2)},YYYY:function(){returni(this.year(),4)},YYYYY:function(){returni(this.year(),5)},YYYYYY:function(){vara=this.year(),b=a>=0?"+":"-";returnb+i(Math.abs(a),6)},gg:function(){returni(this.weekYear()%100,2)},gggg:function(){returnthis.weekYear()},ggggg:function(){returni(this.weekYear(),5)},GG:function(){returni(this.isoWeekYear()%100,2)},GGGG:function(){returnthis.isoWeekYear()},GGGGG:function(){returni(this.isoWeekYear(),5)},e:function(){returnthis.weekday()},E:function(){returnthis.isoWeekday()},a:function(){returnthis.lang().meridiem(this.hours(),this.minutes(),!0)},A:function(){returnthis.lang().meridiem(this.hours(),this.minutes(),!1)},H:function(){returnthis.hours()},h:function(){returnthis.hours()%12||12},m:function(){returnthis.minutes()},s:function(){returnthis.seconds()},S:function(){returnq(this.milliseconds()/100)},SS:function(){returni(q(this.milliseconds()/10),2)},SSS:function(){returni(this.milliseconds(),3)},SSSS:function(){returni(this.milliseconds(),3)},Z:function(){vara=-this.zone(),b="+";return0>a&&(a=-a,b="-"),b+i(q(a/60),2)+":"+i(q(a)%60,2)},ZZ:function(){vara=-this.zone(),b="+";return0>a&&(a=-a,b="-"),b+i(q(a/60),2)+i(q(a)%60,2)},z:function(){returnthis.zoneAbbr()},zz:function(){returnthis.zoneName()},X:function(){returnthis.unix()},Q:function(){returnthis.quarter()}},Wa=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];Ta.length;)da=Ta.pop(),Va[da+"o"]=c(Va[da],da);for(;Ua.length;)da=Ua.pop(),Va[da+da]=b(Va[da],2);for(Va.DDDD=b(Va.DDD,3),g(d.prototype,{set:function(a){varb,c;for(cina)b=a[c],"function"==typeofb?this[c]=b:this["_"+c]=b},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(a){returnthis._months[a.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(a){returnthis._monthsShort[a.month()]},monthsParse:function(a){varb,c,d;for(this._monthsParse||(this._monthsParse=[]),b=0;12>b;b++)if(this._monthsParse[b]||(c=ca.utc([2e3,b]),d="^"+this.months(c,"")+"|^"+this.monthsShort(c,""),this._monthsParse[b]=newRegExp(d.replace(".",""),"i")),this._monthsParse[b].test(a))returnb},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(a){returnthis._weekdays[a.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(a){returnthis._weekdaysShort[a.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(a){returnthis._weekdaysMin[a.day()]},weekdaysParse:function(a){varb,c,d;for(this._weekdaysParse||(this._weekdaysParse=[]),b=0;7>b;b++)if(this._weekdaysParse[b]||(c=ca([2e3,1]).day(b),d="^"+this.weekdays(c,"")+"|^"+this.weekdaysShort(c,"")+"|^"+this.weekdaysMin(c,""),this._weekdaysParse[b]=newRegExp(d.replace(".",""),"i")),this._weekdaysParse[b].test(a))returnb},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(a){varb=this._longDateFormat[a];return!b&&this._longDateFormat[a.toUpperCase()]&&(b=this._longDateFormat[a.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(a){returna.slice(1)}),this._longDateFormat[a]=b),b},isPM:function(a){return"p"===(a+"").toLowerCase().charAt(0)},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(a,b,c){returna>11?c?"pm":"PM":c?"am":"AM"},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(a,b){varc=this._calendar[a];return"function"==typeofc?c.apply(b):c},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(a,b,c,d){vare=this._relativeTime[c];return"function"==typeofe?e(a,b,c,d):e.replace(/%d/i,a)},pastFuture:function(a,b){varc=this._relativeTime[a>0?"future":"past"];return"function"==typeofc?c(b):c.replace(/%s/i,b)},ordinal:function(a){returnthis._ordinal.replace("%d",a)},_ordinal:"%d",preparse:function(a){returna},postformat:function(a){returna},week:function(a){returnX(a,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){returnthis._invalidDate}}),ca=function(b,c,d,e){return"boolean"==typeofd&&(e=d,d=a),Z({_i:b,_f:c,_l:d,_strict:e,_isUTC:!1})},ca.utc=function(b,c,d,e){varf;return"boolean"==typeofd&&(e=d,d=a),f=Z({_useUTC:!0,_isUTC:!0,_l:d,_i:b,_f:c,_strict:e}).utc()},ca.unix=function(a){returnca(1e3*a)},ca.duration=function(a,b){varc,d,e,g=a,h=null;returnca.isDuration(a)?g={ms:a._milliseconds,d:a._days,M:a._months}:"number"==typeofa?(g={},b?g[b]=a:g.milliseconds=a):(h=ra.exec(a))?(c="-"===h[1]?-1:1,g={y:0,d:q(h[ja])*c,h:q(h[ka])*c,m:q(h[la])*c,s:q(h[ma])*c,ms:q(h[na])*c}):(h=sa.exec(a))&&(c="-"===h[1]?-1:1,e=function(a){varb=a&&parseFloat(a.replace(",","."));return(isNaN(b)?0:b)*c},g={y:e(h[2]),M:e(h[3]),d:e(h[4]),h:e(h[5]),m:e(h[6]),s:e(h[7]),w:e(h[8])}),d=newf(g),ca.isDuration(a)&&a.hasOwnProperty("_lang")&&(d._lang=a._lang),d},ca.version=ea,ca.defaultFormat=Ka,ca.updateOffset=function(){},ca.lang=function(a,b){varc;returna?(b?z(x(a),b):null===b?(A(a),a="en"):oa[a]||B(a),c=ca.duration.fn._lang=ca.fn._lang=B(a),c._abbr):ca.fn._lang._abbr},ca.langData=function(a){returna&&a._lang&&a._lang._abbr&&(a=a._lang._abbr),B(a)},ca.isMoment=function(a){returnainstanceofe},ca.isDuration=function(a){returnainstanceoff},da=Wa.length-1;da>=0;--da)p(Wa[da]);for(ca.normalizeUnits=function(a){returnn(a)},ca.invalid=function(a){varb=ca.utc(NaN);returnnull!=a?g(b._pf,a):b._pf.userInvalidated=!0,b},ca.parseZone=function(a){returnca(a).parseZone()},g(ca.fn=e.prototype,{clone:function(){returnca(this)},valueOf:function(){return+this._d+6e4*(this._offset||0)},unix:function(){returnMath.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var a=ca(this).utc();return 0<a.year()&&a.year()<=9999?E(a,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]"):E(a,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")},toArray:function(){var a=this;return[a.year(),a.month(),a.date(),a.hours(),a.minutes(),a.seconds(),a.milliseconds()]},isValid:function(){return w(this)},isDSTShifted:function(){return this._a?this.isValid()&&m(this._a,(this._isUTC?ca.utc(this._a):ca(this._a)).toArray())>0:!1},parsingFlags:function(){return g({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){return this.zone(0),this._isUTC=!1,this},format:function(a){var b=E(this,a||ca.defaultFormat);return this.lang().postformat(b)},add:function(a,b){var c;return c="string"==typeof a?ca.duration(+b,a):ca.duration(a,b),j(this,c,1),this},subtract:function(a,b){var c;return c="string"==typeof a?ca.duration(+b,a):ca.duration(a,b),j(this,c,-1),this},diff:function(a,b,c){var d,e,f=y(a,this),g=6e4*(this.zone()-f.zone());return b=n(b),"year"===b||"month"===b?(d=432e5*(this.daysInMonth()+f.daysInMonth()),e=12*(this.year()-f.year())+(this.month()-f.month()),e+=(this-ca(this).startOf("month")-(f-ca(f).startOf("month")))/d,e-=6e4*(this.zone()-ca(this).startOf("month").zone()-(f.zone()-ca(f).startOf("month").zone()))/d,"year"===b&&(e/=12)):(d=this-f,e="second"===b?d/1e3:"minute"===b?d/6e4:"hour"===b?d/36e5:"day"===b?(d-g)/864e5:"week"===b?(d-g)/6048e5:d),c?e:h(e)},from:function(a,b){returnca.duration(this.diff(a)).lang(this.lang()._abbr).humanize(!b)},fromNow:function(a){returnthis.from(ca(),a)},calendar:function(){vara=y(ca(),this).startOf("day"),b=this.diff(a,"days",!0),c=-6>b?"sameElse":-1>b?"lastWeek":0>b?"lastDay":1>b?"sameDay":2>b?"nextDay":7>b?"nextWeek":"sameElse";returnthis.format(this.lang().calendar(c,this))},isLeapYear:function(){returnt(this.year())},isDST:function(){returnthis.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(a){varb=this._isUTC?this._d.getUTCDay():this._d.getDay();returnnull!=a?(a=U(a,this.lang()),this.add({d:a-b})):b},month:function(a){varb,c=this._isUTC?"UTC":"";returnnull!=a?"string"==typeofa&&(a=this.lang().monthsParse(a),"number"!=typeofa)?this:(b=this.date(),this.date(1),this._d["set"+c+"Month"](a),this.date(Math.min(b,this.daysInMonth())),ca.updateOffset(this),this):this._d["get"+c+"Month"]()},startOf:function(a){switch(a=n(a)){case"year":this.month(0);case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}return"week"===a?this.weekday(0):"isoWeek"===a&&this.isoWeekday(1),this},endOf:function(a){returna=n(a),this.startOf(a).add("isoWeek"===a?"week":a,1).subtract("ms",1)},isAfter:function(a,b){returnb="undefined"!=typeofb?b:"millisecond",+this.clone().startOf(b)>+ca(a).startOf(b)},isBefore:function(a,b){returnb="undefined"!=typeofb?b:"millisecond",+this.clone().startOf(b)<+ca(a).startOf(b)},isSame:function(a,b){returnb=b||"ms",+this.clone().startOf(b)===+y(a,this).startOf(b)},min:function(a){returna=ca.apply(null,arguments),this>a?this:a},max:function(a){returna=ca.apply(null,arguments),a>this?this:a},zone:function(a){varb=this._offset||0;returnnull==a?this._isUTC?b:this._d.getTimezoneOffset():("string"==typeofa&&(a=H(a)),Math.abs(a)<16&&(a=60*a),this._offset=a,this._isUTC=!0,b!==a&&j(this,ca.duration(b-a,"m"),1,!0),this)},zoneAbbr:function(){returnthis._isUTC?"UTC":""},zoneName:function(){returnthis._isUTC?"Coordinated Universal Time":""},parseZone:function(){returnthis._tzm?this.zone(this._tzm):"string"==typeofthis._i&&this.zone(this._i),this},hasAlignedHourOffset:function(a){returna=a?ca(a).zone():0,(this.zone()-a)%60===0},daysInMonth:function(){returnr(this.year(),this.month())},dayOfYear:function(a){varb=ga((ca(this).startOf("day")-ca(this).startOf("year"))/864e5)+1;returnnull==a?b:this.add("d",a-b)},quarter:function(){returnMath.ceil((this.month()+1)/3)},weekYear:function(a){varb=X(this,this.lang()._week.dow,this.lang()._week.doy).year;returnnull==a?b:this.add("y",a-b)},isoWeekYear:function(a){varb=X(this,1,4).year;returnnull==a?b:this.add("y",a-b)},week:function(a){varb=this.lang().week(this);returnnull==a?b:this.add("d",7*(a-b))},isoWeek:function(a){varb=X(this,1,4).week;returnnull==a?b:this.add("d",7*(a-b))},weekday:function(a){varb=(this.day()+7-this.lang()._week.dow)%7;returnnull==a?b:this.add("d",a-b)},isoWeekday:function(a){returnnull==a?this.day()||7:this.day(this.day()%7?a:a-7)},get:function(a){returna=n(a),this[a]()},set:function(a,b){returna=n(a),"function"==typeofthis[a]&&this[a](b),this},lang:function(b){returnb===a?this._lang:(this._lang=B(b),this)}}),da=0;da<Oa.length;da++)$(Oa[da].toLowerCase().replace(/s$/,""),Oa[da]);$("year","FullYear"),ca.fn.days=ca.fn.day,ca.fn.months=ca.fn.month,ca.fn.weeks=ca.fn.week,ca.fn.isoWeeks=ca.fn.isoWeek,ca.fn.toJSON=ca.fn.toISOString,g(ca.duration.fn=f.prototype,{_bubble:function(){vara,b,c,d,e=this._milliseconds,f=this._days,g=this._months,i=this._data;i.milliseconds=e%1e3,a=h(e/1e3),i.seconds=a%60,b=h(a/60),i.minutes=b%60,c=h(b/60),i.hours=c%24,f+=h(c/24),i.days=f%30,g+=h(f/30),i.months=g%12,d=h(g/12),i.years=d},weeks:function(){returnh(this.days()/7)},valueOf:function(){returnthis._milliseconds+864e5*this._days+this._months%12*2592e6+31536e6*q(this._months/12)},humanize:function(a){varb=+this,c=W(b,!a,this.lang());returna&&(c=this.lang().pastFuture(b,c)),this.lang().postformat(c)},add:function(a,b){varc=ca.duration(a,b);returnthis._milliseconds+=c._milliseconds,this._days+=c._days,this._months+=c._months,this._bubble(),this},subtract:function(a,b){varc=ca.duration(a,b);returnthis._milliseconds-=c._milliseconds,this._days-=c._days,this._months-=c._months,this._bubble(),this},get:function(a){returna=n(a),this[a.toLowerCase()+"s"]()},as:function(a){returna=n(a),this["as"+a.charAt(0).toUpperCase()+a.slice(1)+"s"]()},lang:ca.fn.lang,toIsoString:function(){vara=Math.abs(this.years()),b=Math.abs(this.months()),c=Math.abs(this.days()),d=Math.abs(this.hours()),e=Math.abs(this.minutes()),f=Math.abs(this.seconds()+this.milliseconds()/1e3);returnthis.asSeconds()?(this.asSeconds()<0?"-":"")+"P"+(a?a+"Y":"")+(b?b+"M":"")+(c?c+"D":"")+(d||e||f?"T":"")+(d?d+"H":"")+(e?e+"M":"")+(f?f+"S":""):"P0D"}});for(dainPa)Pa.hasOwnProperty(da)&&(aa(da,Pa[da]),_(da.toLowerCase()));aa("Weeks",6048e5),ca.duration.fn.asMonths=function(){return(+this-31536e6*this.years())/2592e6+12*this.years()},ca.lang("en",{ordinal:function(a){varb=a%10,c=1===q(a%100/10)?"th":1===b?"st":2===b?"nd":3===b?"rd":"th";returna+c}}),pa?(module.exports=ca,ba(!0)):"function"==typeofdefine&&define.amd?define("moment",function(b,c,d){returnd.config&&d.config()&&d.config().noGlobal!==!0&&ba(d.config().noGlobal===a),ca}):ba()}.call(this);varquery_class_dict={};Query.prototype.exec=function(a,b){varc,d=[];if(!Array.isArray(a))thrownewTypeError("Query().exec(): Argument 1 is not of type 'array'");if(void0===b&&(b={}),"object"!=typeofb)thrownewTypeError("Query().exec(): Optional argument 2 is not of type 'object'");for(c=0;c<a.length;c+=1)a[c]?d.push(this.match(a[c])):d.push(RSVP.resolve(!1));return(newRSVP.Queue).push(function(){returnRSVP.all(d)}).push(function(c){vard;for(d=c.length-1;d>=0;d-=1)c[d]||a.splice(d,1);returnb.sort_on?sortOn(b.sort_on,a):void0}).push(function(){returnb.limit?limit(b.limit,a):void0}).push(function(){returnselect(b.select_list||[],a)}).push(function(){returna})},Query.prototype.match=function(){returnRSVP.resolve(!0)},Query.prototype.parse=function(a){functionb(a,c){functione(d){h.push(function(){returna.parsed=g.query_list[d],b(a,c)}).push(function(){g.query_list[d]=a.parsed})}varf,g=a.parsed,h=newRSVP.Queue;if("complex"===g.type){for(f=0;f<g.query_list.length;f+=1)e(f);returnh.push(function(){returna.parsed=g,d.onParseComplexQuery(a,c)})}return"simple"===g.type?d.onParseSimpleQuery(a,c):void0}varc,d=this;returnc={parsed:JSON.parse(JSON.stringify(d.serialized()))},(newRSVP.Queue).push(function(){returnd.onParseStart(c,a)}).push(function(){returnb(c,a)}).push(function(){returnd.onParseEnd(c,a)}).push(function(){returnc.parsed})},Query.prototype.toString=function(){return""},Query.prototype.serialized=function(){returnvoid0},window.Query=Query,Query.parseStringToObject=parseStringToObject,inherits(ComplexQuery,Query),ComplexQuery.prototype.operator="AND",ComplexQuery.prototype.type="complex",ComplexQuery.prototype.match=function(a){varb=this.operator;return/^(?:AND|OR|NOT)$/i.test(b)||(b="AND"),this[b.toUpperCase()](a)},ComplexQuery.prototype.toString=function(){vara=[],b=this.operator;return"NOT"===this.operator?(a.push("NOT ("),a.push(this.query_list[0].toString()),a.push(")"),a.join("")):(this.query_list.forEach(function(c){a.push("("),a.push(c.toString()),a.push(")"),a.push(b)}),a.length-=1,a.join(""))},ComplexQuery.prototype.serialized=function(){vara={type:"complex",operator:this.operator,query_list:[]};returnthis.query_list.forEach(function(b){a.query_list.push("function"==typeofb.toJSON?b.toJSON():b)}),a},ComplexQuery.prototype.toJSON=ComplexQuery.prototype.serialized,ComplexQuery.prototype.AND=function(a){functionb(f){returnf===!1?f:d.query_list.length===e?!0:voidc.push(function(){varb=d.query_list[e].match(a);returne+=1,b}).push(b)}varc=newRSVP.Queue,d=this,e=0;returnb(!0),c},ComplexQuery.prototype.OR=function(a){functionb(f){returnf===!0?f:d.query_list.length===e?!1:voidc.push(function(){varb=d.query_list[e].match(a);returne+=1,b}).push(b)}varc=newRSVP.Queue,d=this,e=0;returnb(!1),c},ComplexQuery.prototype.NOT=function(a){return(newRSVP.Queue).push(function(){returnthis.query_list[0].match(a)}).push(function(a){return!a})},query_class_dict.complex=ComplexQuery,window.ComplexQuery=ComplexQuery,QueryFactory.create=function(a,b){if(""===a)returnnewQuery;if("string"==typeofa&&(a=parseStringToObject(a)),"string"==typeof(a||{}).type&&query_class_dict[a.type])returnnewquery_class_dict[a.type](a,b);thrownewTypeError("QueryFactory.create(): Argument 1 is not a search text or a parsable object")},window.QueryFactory=QueryFactory,Query.objectToSearchText=objectToSearchText;varcheckKeySchema=function(a){varb;if(void0!==a){if("object"!=typeofa)thrownewTypeError("SimpleQuery().create(): key_schema is not of type 'object'");if(void0===a.key_set)thrownewTypeError("SimpleQuery().create(): key_schema has no 'key_set' property");for(bina)if(a.hasOwnProperty(b))switch(b){case"key_set":case"cast_lookup":case"match_lookup":break;default:thrownewTypeError("SimpleQuery().create(): key_schema has unknown property '"+b+"'")}}};inherits(SimpleQuery,Query),SimpleQuery.prototype.type="simple";varcheckKey=function(a){varb;if(void0===a.read_from)thrownewTypeError("Custom key is missing the read_from property");for(bina)if(a.hasOwnProperty(b))switch(b){case"read_from":case"cast_to":case"equal_match":break;default:thrownewTypeError("Custom key has unknown property '"+b+"'")}};SimpleQuery.prototype.match=function(a){varb=null,c=null,d=null,e=null,f=this.operator,g=null,h=this.key;if(/^(?:!?=|<=?|>=?)$/i.test(f)||(f=/%/.test(this.value)?"like":"="),e=this[f],this._key_schema.key_set&&void0!==this._key_schema.key_set[h]&&(h=this._key_schema.key_set[h]),"object"==typeofh){if(checkKey(h),b=a[h.read_from],c=h.equal_match,"string"==typeofc&&(c=this._key_schema.match_lookup[c]),void0!==c&&(e="="===f||"like"===f?c:e),g=this.value,d=h.cast_to){"string"==typeofd&&(d=this._key_schema.cast_lookup[d]);try{g=d(g)}catch(i){g=void0}try{b=d(b)}catch(i){b=void0}}}elseb=a[h],g=this.value;returnvoid0===b||void0===g?RSVP.resolve(!1):e(b,g)},SimpleQuery.prototype.toString=function(){return(this.key?this.key+":":"")+(this.operator?""+this.operator:"")+' "'+this.value+'"'},SimpleQuery.prototype.serialized=function(){vara={type:"simple",key:this.key,value:this.value};returnvoid0!==this.operator&&(a.operator=this.operator),a},SimpleQuery.prototype.toJSON=SimpleQuery.prototype.serialized,SimpleQuery.prototype["="]=function(a,b){varc,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp)returnRSVP.resolve(0===c.cmp(b));if(searchTextToRegExp(b.toString(),!1).test(c.toString()))returnRSVP.resolve(!0)}returnRSVP.resolve(!1)},SimpleQuery.prototype.like=function(a,b){varc,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp)returnRSVP.resolve(0===c.cmp(b));if(searchTextToRegExp(b.toString()).test(c.toString()))returnRSVP.resolve(!0)}returnRSVP.resolve(!1)},SimpleQuery.prototype["!="]=function(a,b){varc,d;for(Array.isArray(a)||(a=[a]),d=0;d<a.length;d+=1){if(c=a[d],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp)returnRSVP.resolve(0!==c.cmp(b));if(searchTextToRegExp(b.toString(),!1).test(c.toString()))returnRSVP.resolve(!1)}returnRSVP.resolve(!0)},SimpleQuery.prototype["<"]=function(a,b){varc;returnArray.isArray(a)||(a=[a]),c=a[0],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp?RSVP.resolve(c.cmp(b)<0):RSVP.resolve(b>c)},SimpleQuery.prototype["<="]=function(a,b){varc;returnArray.isArray(a)||(a=[a]),c=a[0],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp?RSVP.resolve(c.cmp(b)<=0):RSVP.resolve(b>=c)},SimpleQuery.prototype[">"]=function(a,b){varc;returnArray.isArray(a)||(a=[a]),c=a[0],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp?RSVP.resolve(c.cmp(b)>0):RSVP.resolve(c>b)},SimpleQuery.prototype[">="]=function(a,b){varc;returnArray.isArray(a)||(a=[a]),c=a[0],"object"==typeofc&&c.hasOwnProperty("content")&&(c=c.content),"function"==typeofc.cmp?RSVP.resolve(c.cmp(b)>=0):RSVP.resolve(c>=b)},query_class_dict.simple=SimpleQuery,window.SimpleQuery=SimpleQuery,Query.stringEscapeRegexpCharacters=stringEscapeRegexpCharacters,Query.select=select,Query.sortOn=sortOn,Query.limit=limit,Query.searchTextToRegExp=searchTextToRegExp,function(a,b){"use strict";varc,d="year",e="month",f="day",g="hour",h="minute",i="second",j="millisecond",k={year:0,month:1,day:2,hour:3,minute:4,second:5,millisecond:6},l=function(a,b){returnk[a]<k[b]?a:b};c=function(a){if(!(thisinstanceofc))returnnewc(a);if(ainstanceofc)returnthis.mom=a.mom.clone(),void(this._precision=a._precision);if(void0===a)returnthis.mom=b(),voidthis.setPrecision(j);if(this.mom=null,this._str=a,a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d\d\d:\d\d:\d\d\.\d\d\d/)?(this.mom=b(a),this.setPrecision(j)):a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d\d\d:\d\d:\d\d/)?(this.mom=b(a),this.setPrecision(i)):a.match(/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d([+\-][0-2]\d:[0-5]\d|Z)/)||a.match(/\d\d\d\d-\d\d-\d\d\d\d:\d\d/)?(this.mom=b(a),this.setPrecision(h)):a.match(/\d\d\d\d-\d\d-\d\d\d\d/)?(this.mom=b(a),this.setPrecision(g)):a.match(/\d\d\d\d-\d\d-\d\d/)?(this.mom=b(a),this.setPrecision(f)):a.match(/\d\d\d\d-\d\d/)?(this.mom=b(a),this.setPrecision(e)):a.match(/\d\d\d\d/)&&(this.mom=b(a),this.setPrecision(d)),!this.mom)thrownewError("Cannot parse: "+a)},c.prototype.setPrecision=function(a){this._precision=a},c.prototype.getPrecision=function(){returnthis._precision},c.prototype.cmp=function(a){varb=this.mom,c=a.mom,d=l(this._precision,a._precision);returnb.isBefore(c,d)?-1:b.isSame(c,d)?0:1},c.prototype.toPrecisionString=function(a){varb;if(a=a||this._precision,b={millisecond:"YYYY-MM-DD HH:mm:ss.SSS",second:"YYYY-MM-DD HH:mm:ss",minute:"YYYY-MM-DD HH:mm",hour:"YYYY-MM-DD HH",day:"YYYY-MM-DD",month:"YYYY-MM",year:"YYYY"}[a],!b)thrownewTypeError("Unsupported precision value '"+a+"'");returnthis.mom.format(b)},c.prototype.toString=function(){returnthis._str},a.jiodate={JIODate:c,YEAR:d,MONTH:e,DAY:f,HOUR:g,MIN:h,SEC:i,MSEC:j}}(window,moment),function(a,b,c,d,e,f,g,h,i){"use strict";functionj(a,b){if(void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message",this.status_code=b||500}functionk(a){varc=newXMLHttpRequest;returnnewb.Promise(function(b,d,e){varf;if(c.open(a.type||"GET",a.url,!0),c.responseType=a.dataType||"","object"==typeofa.headers&&null!==a.headers)for(fina.headers)a.headers.hasOwnProperty(f)&&c.setRequestHeader(f,a.headers[f]);if(c.addEventListener("load",function(a){returna.target.status>=400?d(a):voidb(a)}),c.addEventListener("error",d),c.addEventListener("progress",e),"object"==typeofa.xhrFields&&null!==a.xhrFields)for(fina.xhrFields)a.xhrFields.hasOwnProperty(f)&&(c[f]=a.xhrFields[f]);"function"==typeofa.beforeSend&&a.beforeSend(c),c.send(a.data)},function(){c.abort()})}functionl(a){varb,c;if(Array.isArray(a)){for(c=[],b=0;b<a.length;b+=1)c[b]=l(a[b]);returnc}if(null===a)returnnull;if("object"==typeofa){if(Object.getPrototypeOf(a)===Object.prototype){c={};for(bina)a.hasOwnProperty(b)&&(c[b]=l(a[b]));returnc}returnainstanceofDate?isFinite(a.getTime())?newDate(a.toJSON()):newDate("Invalid Date"):"function"==typeofa.toJSON?new(Object.getPrototypeOf(a).constructor)(a.toJSON()):a}returna}functionm(a,c){vard=newg;returnnewb.Promise(function(b,e,f){d.addEventListener("load",b),d.addEventListener("error",e),d.addEventListener("progress",f),d.readAsText(a,c)},function(){d.abort()})}functionn(a){varc=newg;returnnewb.Promise(function(b,d,e){c.addEventListener("load",b),c.addEventListener("error",d),c.addEventListener("progress",e),c.readAsArrayBuffer(a)},function(){c.abort()})}functiono(a){varc=newg;returnnewb.Promise(function(b,d,e){c.addEventListener("load",b),c.addEventListener("error",d),c.addEventListener("progress",e),c.readAsDataURL(a)},function(){c.abort()})}functionp(a){varb,d=f(a.split(",")[1]),e=a.split(",")[0].split(":")[1],g=newh(d.length),j=newi(g);for(e=e.slice(0,e.length-";base64".length),b=0;b<d.length;b+=1)j[b]=d.charCodeAt(b);returnnewc([g],{type:e})}functionq(a,b,c){if("string"!=typeofa[0]||""===a[0])thrownewv.util.jIOError("Document id must be a non empty string on '"+b.__type+"."+c+"'.",400)}functionr(a,b,c){if("string"!=typeofa[1]||""===a[1])thrownewv.util.jIOError("Attachment id must be a non empty string on '"+b.__type+"."+c+"'.",400)}functions(a,c,d,e){returna.prototype[c]=function(){vara,f=arguments,g=this;return(newb.Queue).push(function(){returnvoid0!==d?d.apply(g.__storage,[f,g,c]):void0}).push(function(b){vard=g.__storage[c];if(a=b,void0===d)thrownewv.util.jIOError("Capacity '"+c+"' is not implemented on '"+g.__type+"'",501);returnd.apply(g.__storage,f)}).push(function(b){returnvoid0!==e?e.call(g,f,b,a):b})},this}functiont(a,b){returnthisinstanceoft?(this.__type=a,void(this.__storage=b)):newt}functionu(){returnthisinstanceofu?void(this.__storage_types={}):newu}varv,w={};j.prototype=newError,j.prototype.constructor=j,w.jIOError=j,w.ajax=k,w.deepClone=l,w.readBlobAsText=m,w.readBlobAsArrayBuffer=n,w.readBlobAsDataURL=o,w.dataURItoBlob=p,s(t,"put",q,function(a){returna[0]}),s(t,"get",q),s(t,"bulk"),s(t,"remove",q,function(a){returna[0]}),t.prototype.post=function(){vara=this,c=arguments;return(newb.Queue).push(function(){varb=a.__storage.post;if(void0===b)thrownewv.util.jIOError("Capacity 'post' is not implemented on '"+a.__type+"'",501);returna.__storage.post.apply(a.__storage,c)})},s(t,"putAttachment",function(a,b,d){q(a,b,d),r(a,b,d);vare=a[3]||{};if("string"==typeofa[2])a[2]=newc([a[2]],{type:e._content_type||e._mimetype||"text/plain;charset=utf-8"});elseif(!(a[2]instanceofc))thrownewv.util.jIOError("Attachment content is not a blob",400)}),s(t,"removeAttachment",function(a,b,c){q(a,b,c),r(a,b,c)}),s(t,"getAttachment",function(a,b,c){vard="blob";returnq(a,b,c),r(a,b,c),void0!==a[2]&&(d=a[2].format||d,deletea[2].format),d},function(a,d,e){varf;if(!(dinstanceofc))thrownewv.util.jIOError("'getAttachment' ("+a[0]+" , "+a[1]+") on '"+this.__type+"' does not return a Blob.",501);if("blob"===e)f=d;elseif("data_url"===e)f=(newb.Queue).push(function(){returnv.util.readBlobAsDataURL(d)}).push(function(a){returna.target.result});elseif("array_buffer"===e)f=(newb.Queue).push(function(){returnv.util.readBlobAsArrayBuffer(d)}).push(function(a){returna.target.result});elseif("text"===e)f=(newb.Queue).push(function(){returnv.util.readBlobAsText(d)}).push(function(a){returna.target.result});else{if("json"!==e)thrownewv.util.jIOError(this.__type+".getAttachment format: '"+e+"' is not supported",400);f=(newb.Queue).push(function(){returnv.util.readBlobAsText(d)}).push(function(a){returnJSON.parse(a.target.result)})}returnf}),t.prototype.buildQuery=function(){vara=this.__storage.buildQuery,c=this,d=arguments;if(void0===a)thrownewv.util.jIOError("Capacity 'buildQuery' is not implemented on '"+this.__type+"'",501);return(newb.Queue).push(function(){returna.apply(c.__storage,d)})},t.prototype.hasCapacity=function(a){varb=this.__storage.hasCapacity,c=this.__storage[a];if(void0!==c)return!0;if(void0===b||!b.apply(this.__storage,arguments))thrownewv.util.jIOError("Capacity '"+a+"' is not implemented on '"+this.__type+"'",501);return!0},t.prototype.allDocs=function(a){varc=this;returnvoid0===a&&(a={}),(newb.Queue).push(function(){return!c.hasCapacity("list")||void0!==a.query&&!c.hasCapacity("query")||void0!==a.sort_on&&!c.hasCapacity("sort")||void0!==a.select_list&&!c.hasCapacity("select")||void0!==a.include_docs&&!c.hasCapacity("include")||void0!==a.limit&&!c.hasCapacity("limit")?void0:c.buildQuery(a)}).push(function(a){return{data:{rows:a,total_rows:a.length}}})},s(t,"allAttachments",q),s(t,"repair"),t.prototype.repair=function(){vara=this,c=arguments;return(newb.Queue).push(function(){varb=a.__storage.repair;returnvoid0!==b?a.__storage.repair.apply(a.__storage,c):void0})},u.prototype.createJIO=function(a,b){if("string"!=typeofa.type)thrownewTypeError("Invalid storage description");if(!this.__storage_types[a.type])thrownewTypeError("Unknown storage '"+a.type+"'");returnnewt(a.type,newthis.__storage_types[a.type](a,b))},u.prototype.addStorage=function(a,b){if("string"!=typeofa)thrownewTypeError("jIO.addStorage(): Argument 1 is not of type 'string'");if("function"!=typeofb)thrownewTypeError("jIO.addStorage(): Argument 2 is not of type 'function'");if(void0!==this.__storage_types[a])thrownewTypeError("jIO.addStorage(): Storage type already exists");this.__storage_types[a]=b},u.prototype.util=w,u.prototype.QueryFactory=d,u.prototype.Query=e,v=newu,a.jIO=v}(window,RSVP,Blob,QueryFactory,Query,atob,FileReader,ArrayBuffer,Uint8Array),function(){functiona(a){"use strict";vard={fill:0},f=function(a){for(a+=9;a%64>0;a+=1);returna},g=function(a,b){for(varc=b>>2;c<a.length;c++)a[c]=0},h=function(a,b,c){a[b>>2]|=128<<24-(b%4<<3),a[((b>>2)+2&-16)+14]=c>>29,a[((b>>2)+2&-16)+15]=c<<3},i=function(a,b,c,d,e){varf,g=this,h=e%4,i=d%4,j=d-i;if(j>0)switch(h){case0:a[e+3|0]=g.charCodeAt(c);case1:a[e+2|0]=g.charCodeAt(c+1);case2:a[e+1|0]=g.charCodeAt(c+2);case3:a[0|e]=g.charCodeAt(c+3)}for(f=h;j>f;f=f+4|0)b[e+f>>2]=g.charCodeAt(c+f)<<24|g.charCodeAt(c+f+1)<<16|g.charCodeAt(c+f+2)<<8|g.charCodeAt(c+f+3);switch(i){case3:a[e+j+1|0]=g.charCodeAt(c+j+2);case2:a[e+j+2|0]=g.charCodeAt(c+j+1);case1:a[e+j+3|0]=g.charCodeAt(c+j)}},j=function(a,b,c,d,e){varf,g=this,h=e%4,i=d%4,j=d-i;if(j>0)switch(h){case0:a[e+3|0]=g[c];case1:a[e+2|0]=g[c+1];case2:a[e+1|0]=g[c+2];case3:a[0|e]=g[c+3]}for(f=4-h;j>f;f=f+=4)b[e+f>>2]=g[c+f]<<24|g[c+f+1]<<16|g[c+f+2]<<8|g[c+f+3];switch(i){case3:a[e+j+1|0]=g[c+j+2];case2:a[e+j+2|0]=g[c+j+1];case1:a[e+j+3|0]=g[c+j]}},k=function(a,b,d,e,f){varg,h=this,i=f%4,j=e%4,k=e-j,l=newUint8Array(c.readAsArrayBuffer(h.slice(d,d+e)));if(k>0)switch(i){case0:a[f+3|0]=l[0];case1:a[f+2|0]=l[1];case2:a[f+1|0]=l[2];case3:a[0|f]=l[3]}for(g=4-i;k>g;g=g+=4)b[f+g>>2]=l[g]<<24|l[g+1]<<16|l[g+2]<<8|l[g+3];switch(j){case3:a[f+k+1|0]=l[k+2];case2:a[f+k+2|0]=l[k+1];case1:a[f+k+3|0]=l[k]}},l=function(a){switch(e.getDataType(a)){case"string":returni.bind(a);case"array":returnj.bind(a);case"buffer":returnj.bind(a);case"arraybuffer":returnj.bind(newUint8Array(a));case"view":returnj.bind(newUint8Array(a.buffer,a.byteOffset,a.byteLength));case"blob":returnk.bind(a)}},m=function(a){varb,c,d="0123456789abcdef",e=[],f=newUint8Array(a);for(b=0;b<f.length;b++)c=f[b],e[b]=d.charAt(c>>4&15)+d.charAt(c>>0&15);returne.join("")},n=function(a){varb;if(65536>=a)return65536;if(16777216>a)for(b=1;a>b;b<<=1);elsefor(b=16777216;a>b;b+=16777216);returnb},o=function(a){if(a%64>0)thrownewError("Chunk size must be a multiple of 128 bit");d.maxChunkLen=a,d.padMaxChunkLen=f(a),d.heap=newArrayBuffer(n(d.padMaxChunkLen+320+20)),d.h32=newInt32Array(d.heap),d.h8=newInt8Array(d.heap),d.core=b({Int32Array:Int32Array,DataView:DataView},{},d.heap),d.buffer=null};o(a||65536);varp=function(a,b){varc=newInt32Array(a,b+320,5);c[0]=1732584193,c[1]=-271733879,c[2]=-1732584194,c[3]=271733878,c[4]=-1009589776},q=function(a,b){varc=f(a),e=newInt32Array(d.heap,0,c>>2);returng(e,a),h(e,a,b),c},r=function(a,b,c){l(a)(d.h8,d.h32,b,c,0)},s=function(a,b,c,e,f){varg=c;f&&(g=q(c,e)),r(a,b,c),d.core.hash(g,d.padMaxChunkLen)},t=function(a,b){varc=newInt32Array(a,b+320,5),d=newInt32Array(5),e=newDataView(d.buffer);returne.setInt32(0,c[0],!1),e.setInt32(4,c[1],!1),e.setInt32(8,c[2],!1),e.setInt32(12,c[3],!1),e.setInt32(16,c[4],!1),d},u=this.rawDigest=function(a){varb=a.byteLength||a.length||a.size||0;p(d.heap,d.padMaxChunkLen);varc=0,e=d.maxChunkLen;for(c=0;b>c+e;c+=e)s(a,c,e,b,!1);returns(a,c,b-c,b,!0),t(d.heap,d.padMaxChunkLen)};this.digest=this.digestFromString=this.digestFromBuffer=this.digestFromArrayBuffer=function(a){returnm(u(a).buffer)}}functionb(a,b,c){"use asm";functiond(a,b){a|=0,b|=0;varc=0,d=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,n=0,o=0,p=0,q=0;for(f=e[b+320>>2]|0,h=e[b+324>>2]|0,j=e[b+328>>2]|0,l=e[b+332>>2]|0,n=e[b+336>>2]|0,c=0;(c|0)<(a|0);c=c+64|0){for(g=f,i=h,k=j,m=l,o=n,d=0;(d|0)<64;d=d+4|0)q=e[c+d>>2]|0,p=((f<<5|f>>>27)+(h&j|~h&l)|0)+((q+n|0)+1518500249|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[a+d>>2]=q;for(d=a+64|0;(d|0)<(a+80|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h&j|~h&l)|0)+((q+n|0)+1518500249|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+80|0;(d|0)<(a+160|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h^j^l)|0)+((q+n|0)+1859775393|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+160|0;(d|0)<(a+240|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h&j|h&l|j&l)|0)+((q+n|0)-1894007588|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;for(d=a+240|0;(d|0)<(a+320|0);d=d+4|0)q=(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])<<1|(e[d-12>>2]^e[d-32>>2]^e[d-56>>2]^e[d-64>>2])>>>31,p=((f<<5|f>>>27)+(h^j^l)|0)+((q+n|0)-899497514|0)|0,n=l,l=j,j=h<<30|h>>>2,h=f,f=p,e[d>>2]=q;f=f+g|0,h=h+i|0,j=j+k|0,l=l+m|0,n=n+o|0}e[b+320>>2]=f,e[b+324>>2]=h,e[b+328>>2]=j,e[b+332>>2]=l,e[b+336>>2]=n}vare=newa.Int32Array(c);return{hash:d}}if("undefined"!=typeofmodule?module.exports=a:"undefined"!=typeofwindow&&(window.Rusha=a),"undefined"!=typeofFileReaderSync){varc=newFileReaderSync,d=newa(4194304);self.onmessage=function(a){varb,c=a.data.data;try{b=d.digest(c),self.postMessage({id:a.data.id,hash:b})}catch(e){self.postMessage({id:a.data.id,error:e.name})}}}vare={getDataType:function(a){if("string"==typeofa)return"string";if(ainstanceofArray)return"array";if("undefined"!=typeofglobal&&global.Buffer&&global.Buffer.isBuffer(a))return"buffer";if(ainstanceofArrayBuffer)return"arraybuffer";if(a.bufferinstanceofArrayBuffer)return"view";if(ainstanceofBlob)return"blob";thrownewError("Unsupported data type.")}}}(),function(a,b,c){"use strict";functiond(a){returnf.digestFromString(a)}functione(b){if(this._query_options=b.query||{},this._local_sub_storage=a.createJIO(b.local_sub_storage),this._remote_sub_storage=a.createJIO(b.remote_sub_storage),this._signature_hash="_replicate_"+d(JSON.stringify(b.local_sub_storage)+JSON.stringify(b.remote_sub_storage)+JSON.stringify(this._query_options)),this._signature_sub_storage=a.createJIO({type:"document",document_id:this._signature_hash,sub_storage:b.local_sub_storage}),this._use_remote_post=b.use_remote_post||!1,this._conflict_handling=b.conflict_handling||0,this._conflict_handling!==g&&this._conflict_handling!==h&&this._conflict_handling!==i&&this._conflict_handling!==j)thrownewa.util.jIOError("Unsupported conflict handling: "+this._conflict_handling,400);this._check_local_modification=b.check_local_modification,void0===this._check_local_modification&&(this._check_local_modification=!0),this._check_local_creation=b.check_local_creation,void0===this._check_local_creation&&(this._check_local_creation=!0),this._check_local_deletion=b.check_local_deletion,void0===this._check_local_deletion&&(this._check_local_deletion=!0),this._check_remote_modification=b.check_remote_modification,void0===this._check_remote_modification&&(this._check_remote_modification=!0),this._check_remote_creation=b.check_remote_creation,void0===this._check_remote_creation&&(this._check_remote_creation=!0),this._check_remote_deletion=b.check_remote_deletion,void0===this._check_remote_deletion&&(this._check_remote_deletion=!0)}varf=newc,g=0,h=1,i=2,j=3;e.prototype.remove=function(b){if(b===this._signature_hash)thrownewa.util.jIOError(this._signature_hash+" is frozen",403);returnthis._local_sub_storage.remove.apply(this._local_sub_storage,arguments)},e.prototype.post=function(){returnthis._local_sub_storage.post.apply(this._local_sub_storage,arguments)},e.prototype.put=function(b){if(b===this._signature_hash)thrownewa.util.jIOError(this._signature_hash+" is frozen",403);returnthis._local_sub_storage.put.apply(this._local_sub_storage,arguments)},e.prototype.get=function(){returnthis._local_sub_storage.get.apply(this._local_sub_storage,arguments)},e.prototype.hasCapacity=function(){returnthis._local_sub_storage.hasCapacity.apply(this._local_sub_storage,arguments)},e.prototype.buildQuery=function(){returnthis._local_sub_storage.buildQuery.apply(this._local_sub_storage,arguments)},e.prototype.repair=function(){functionc(a,b,c,d,e,f){varg,h,i=!0;returnvoid0===f&&(f={}),g=f.use_post?b.post(c).push(function(b){returni=!1,h=b,a.put(h,c)}).push(function(){returna.remove(e)}).push(function(){returnm._signature_sub_storage.remove(e)}).push(function(){returni=!0,m._signature_sub_storage.put(h,{hash:d})}).push(function(){o[h]=null}):b.put(e,c).push(function(){returnm._signature_sub_storage.put(e,{hash:d})}),g.push(function(){i&&(o[e]=null)})}functione(b,e,f,g,h,i){varj;b.push(function(){returnf.get(g)}).push(function(a){j=a},function(b){if(!(binstanceofa.util.jIOError&&404===b.status_code))throwb}).push(function(){returni(g)}).push(function(b){vari,k=d(JSON.stringify(b));if(void0===j)returnc(e,f,b,k,g,h);if(i=d(JSON.stringify(j)),k===i)returnm._signature_sub_storage.put(g,{hash:k}).push(function(){o[g]=null});if(h.conflict_ignore!==!0){if(h.conflict_force===!0)returnc(e,f,b,k,g,h);thrownewa.util.jIOError("Conflict on '"+g+"'",409)}})}functionf(a,c,d,f,g){a.push(function(){returnc.bulk(f)}).push(function(a){functionh(b){returnfunction(c){if(c!==f[b].parameter_list[0])thrownewError("Does not access expected ID "+c);returna[b]}}vari,j=newb.Queue;for(i=0;i<a.length;i+=1)e(j,c,d,f[i].parameter_list[0],g,h(i));returnj})}functiong(b,e,f,g){varh;b.push(function(){returnm._signature_sub_storage.get(f)}).push(function(b){returnh=b.hash,e.get(f).push(function(a){varb=d(JSON.stringify(a));returnb===h?e.remove(f).push(function(){returnm._signature_sub_storage.remove(f)}).push(function(){o[f]=null}):c(e,g,a,b,f)},function(b){if(binstanceofa.util.jIOError&&404===b.status_code)returnm._signature_sub_storage.remove(f).push(function(){o[f]=null});throwb})})}functionk(e,f,g,h,i,j){e.push(function(){returnb.all([f.get(h),m._signature_sub_storage.get(h)])}).push(function(b){vare=b[0],k=d(JSON.stringify(e)),l=b[1].hash;returnk!==l?g.get(h).push(function(b){varn=d(JSON.stringify(b));if(n!==l){if(k===n)returnm._signature_sub_storage.put(h,{hash:k}).push(function(){o[h]=null});if(j===!0)return;if(i!==!0)thrownewa.util.jIOError("Conflict on '"+h+"'",409)}returnc(f,g,e,k,h)},function(b){if(binstanceofa.util.jIOError&&404===b.status_code)returnc(f,g,e,k,h);throwb}):void0})}functionl(a,c,d){varh=newb.Queue;returnd.hasOwnProperty("use_post")||(d.use_post=!1),h.push(function(){returnb.all([a.allDocs(m._query_options),m._signature_sub_storage.allDocs()])}).push(function(b){vari,j,l={},m=[],n={};for(i=0;i<b[0].data.total_rows;i+=1)o.hasOwnProperty(b[0].data.rows[i].id)||(l[b[0].data.rows[i].id]=i);for(i=0;i<b[1].data.total_rows;i+=1)o.hasOwnProperty(b[1].data.rows[i].id)||(n[b[1].data.rows[i].id]=i);if(d.check_creation===!0){for(jinl)l.hasOwnProperty(j)&&(n.hasOwnProperty(j)||(d.use_bulk_get===!0?m.push({method:"get",parameter_list:[j]}):e(h,a,c,j,d,a.get.bind(a))));d.use_bulk_get===!0&&0!==m.length&&f(h,a,c,m,d)}for(jinn)n.hasOwnProperty(j)&&(l.hasOwnProperty(j)?d.check_modification===!0&&k(h,a,c,j,d.conflict_force,d.conflict_ignore):d.check_deletion===!0&&g(h,c,j,a))})}varm=this,n=arguments,o={};returno[m._signature_hash]=null,(newb.Queue).push(function(){returnm._signature_sub_storage.__storage._sub_storage.get(m._signature_hash)}).push(void0,function(b){if(binstanceofa.util.jIOError&&404===b.status_code)returnm._signature_sub_storage.__storage._sub_storage.put(m._signature_hash,{});throwb}).push(function(){returnb.all([m._local_sub_storage.repair.apply(m._local_sub_storage,n),m._remote_sub_storage.repair.apply(m._remote_sub_storage,n)])}).push(function(){returnm._check_local_modification||m._check_local_creation||m._check_local_deletion?l(m._local_sub_storage,m._remote_sub_storage,{use_post:m._use_remote_post,conflict_force:m._conflict_handling===h,conflict_ignore:m._conflict_handling===j||m._conflict_handling===i,check_modification:m._check_local_modification,check_creation:m._check_local_creation,check_deletion:m._check_local_deletion}):void0}).push(function(){varb=!1;try{b=m._remote_sub_storage.hasCapacity("bulk")}catch(c){if(!(cinstanceofa.util.jIOError&&501===c.status_code))throwc}returnm._check_remote_modification||m._check_remote_creation||m._check_remote_deletion?l(m._remote_sub_storage,m._local_sub_storage,{use_bulk_get:b,conflict_force:m._conflict_handling===i,conflict_ignore:m._conflict_handling===j,check_modification:m._check_remote_modification,check_creation:m._check_remote_creation,check_deletion:m._check_remote_deletion}):void0})},a.addStorage("replicate",e)}(jIO,RSVP,Rusha),function(a){"use strict";functionb(a){this._sub_storage=jIO.createJIO(a.sub_storage)}varc=newa;b.prototype.post=function(a){returnthis._sub_storage.put(c.digestFromString(JSON.stringify(a)),a)},b.prototype.get=function(){returnthis._sub_storage.get.apply(this._sub_storage,arguments)},b.prototype.remove=function(){returnthis._sub_storage.remove.apply(this._sub_storage,arguments)},b.prototype.hasCapacity=function(){returnthis._sub_storage.hasCapacity.apply(this._sub_storage,arguments)},b.prototype.buildQuery=function(){returnthis._sub_storage.buildQuery.apply(this._sub_storage,arguments)},b.prototype.getAttachment=function(){returnthis._sub_storage.getAttachment.apply(this._sub_storage,arguments)},b.prototype.putAttachment=function(){returnthis._sub_storage.putAttachment.apply(this._sub_storage,arguments)},b.prototype.removeAttachment=function(){returnthis._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},b.prototype.allAttachments=function(){returnthis._sub_storage.allAttachments.apply(this._sub_storage,arguments)},b.prototype.repair=function(){returnthis._sub_storage.repair.apply(this._sub_storage,arguments)},jIO.addStorage("sha",b)}(Rusha),function(a){"use strict";functionb(b){this._sub_storage=a.createJIO(b.sub_storage)}b.prototype.get=function(){returnthis._sub_storage.get.apply(this._sub_storage,arguments)},b.prototype.allAttachments=function(){returnthis._sub_storage.allAttachments.apply(this._sub_storage,arguments)},b.prototype.post=function(a){functionb(){return("0000"+Math.floor(65536*Math.random()).toString(16)).slice(-4)}varc=b()+b()+"-"+b()+"-"+b()+"-"+b()+"-"+b()+b()+b();returnthis.put(c,a)},b.prototype.put=function(){returnthis._sub_storage.put.apply(this._sub_storage,arguments)},b.prototype.remove=function(){returnthis._sub_storage.remove.apply(this._sub_storage,arguments)},b.prototype.getAttachment=function(){returnthis._sub_storage.getAttachment.apply(this._sub_storage,arguments)},b.prototype.putAttachment=function(){returnthis._sub_storage.putAttachment.apply(this._sub_storage,arguments)},b.prototype.removeAttachment=function(){returnthis._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},b.prototype.repair=function(){returnthis._sub_storage.repair.apply(this._sub_storage,arguments)},b.prototype.hasCapacity=function(a){returnthis._sub_storage.hasCapacity(a)},b.prototype.buildQuery=function(){returnthis._sub_storage.buildQuery.apply(this._sub_storage,arguments)},a.addStorage("uuid",b)}(jIO),function(a){"use strict";functionb(){this._database={}}b.prototype.put=function(a,b){returnthis._database.hasOwnProperty(a)||(this._database[a]={attachments:{}}),this._database[a].doc=JSON.stringify(b),a},b.prototype.get=function(b){try{returnJSON.parse(this._database[b].doc)}catch(c){if(cinstanceofTypeError)thrownewa.util.jIOError("Cannot find document: "+b,404);throwc}},b.prototype.allAttachments=function(b){varc,d={};try{for(cinthis._database[b].attachments)this._database[b].attachments.hasOwnProperty(c)&&(d[c]={})}catch(e){if(einstanceofTypeError)thrownewa.util.jIOError("Cannot find document: "+b,404);throwe}returnd},b.prototype.remove=function(a){returndeletethis._database[a],a},b.prototype.getAttachment=function(b,c){try{vard=this._database[b].attachments[c];if(void0===d)thrownewa.util.jIOError("Cannot find attachment: "+b+" , "+c,404);returnd}catch(e){if(einstanceofTypeError)thrownewa.util.jIOError("Cannot find attachment: "+b+" , "+c,404);throwe}},b.prototype.putAttachment=function(b,c,d){vare;try{e=this._database[b].attachments}catch(f){if(finstanceofTypeError)thrownewa.util.jIOError("Cannot find document: "+b,404);throwf}e[c]=d},b.prototype.removeAttachment=function(b,c){try{deletethis._database[b].attachments[c]}catch(d){if(dinstanceofTypeError)thrownewa.util.jIOError("Cannot find document: "+b,404);throwd}},b.prototype.hasCapacity=function(a){return"list"===a},b.prototype.buildQuery=function(){vara,b=[];for(ainthis._database)this._database.hasOwnProperty(a)&&b.push({id:a,value:{}});returnb},a.addStorage("memory",b)}(jIO),function(a,b,c,d){"use strict";functione(a){a.sessiononly===!0?this._storage=b:this._storage=c}functionf(b){if("/"!==b)thrownewa.util.jIOError("id "+b+" is forbidden (!== /)",400)}e.prototype.get=function(a){returnf(a),{}},e.prototype.allAttachments=function(a){f(a);varb,c={};for(binthis._storage)this._storage.hasOwnProperty(b)&&(c[b]={});returnc},e.prototype.getAttachment=function(b,c){f(b);vard=this._storage.getItem(c);if(null===d)thrownewa.util.jIOError("Cannot find attachment "+c,404);returna.util.dataURItoBlob(d)},e.prototype.putAttachment=function(b,c,e){varg=this;returnf(b),(newd.Queue).push(function(){returna.util.readBlobAsDataURL(e)}).push(function(a){g._storage.setItem(c,a.target.result)})},e.prototype.removeAttachment=function(a,b){returnf(a),this._storage.removeItem(b)},e.prototype.hasCapacity=function(a){return"list"===a},e.prototype.buildQuery=function(){return[{id:"/",value:{}}]},a.addStorage("local",e)}(jIO,sessionStorage,localStorage,RSVP),function(a,b,c,d){"use strict";functione(a){this._sub_storage=jIO.createJIO(a.sub_storage)}functionf(a,b){returna.indexOf(b)===a.length-b.length}varg="application/x-jio-utf16_lz_string";e.prototype.get=function(){returnthis._sub_storage.get.apply(this._sub_storage,arguments)},e.prototype.post=function(){returnthis._sub_storage.post.apply(this._sub_storage,arguments)},e.prototype.put=function(){returnthis._sub_storage.put.apply(this._sub_storage,arguments)},e.prototype.remove=function(){returnthis._sub_storage.remove.apply(this._sub_storage,arguments)},e.prototype.hasCapacity=function(){returnthis._sub_storage.hasCapacity.apply(this._sub_storage,arguments)},e.prototype.buildQuery=function(){returnthis._sub_storage.buildQuery.apply(this._sub_storage,arguments)},e.prototype.getAttachment=function(b,e){varf=this;returnf._sub_storage.getAttachment(b,e).push(function(b){returnb.type!==g?b:(newa.Queue).push(function(){returnjIO.util.readBlobAsText(b,"utf16")}).push(function(a){vare=c.decompressFromUTF16(a.target.result);if(""===e)returnb;try{returnjIO.util.dataURItoBlob(e)}catch(f){if(finstanceofd)returnb;throwf}})})},e.prototype.putAttachment=function(d,e,h){vari=this;return0===h.type.indexOf("text/")||f(h.type,"xml")||f(h.type,"json")?(newa.Queue).push(function(){returnjIO.util.readBlobAsDataURL(h)}).push(function(a){varf=c.compressToUTF16(a.target.result);returnh=newb([f],{type:g}),i._sub_storage.putAttachment(d,e,h)}):this._sub_storage.putAttachment.apply(this._sub_storage,arguments)},e.prototype.removeAttachment=function(){returnthis._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},e.prototype.allAttachments=function(){returnthis._sub_storage.allAttachments.apply(this._sub_storage,arguments)},jIO.addStorage("zip",e)}(RSVP,Blob,LZString,DOMException),function(a,b,c,d){"use strict";functione(b){if(0!==b.indexOf("/"))thrownewa.util.jIOError("id "+b+" is forbidden (no begin /)",400);if(b.lastIndexOf("/")!==b.length-1)thrownewa.util.jIOError("id "+b+" is forbidden (no end /)",400);returnb}functionf(b){if(-1!==b.indexOf("/"))thrownewa.util.jIOError("attachment "+b+" is forbidden",400)}functiong(a){if("string"!=typeofa.access_token||!a.access_token)thrownewTypeError("Access Token' must be a string which contains more than one character.");if("string"!=typeofa.root||!a.root||"dropbox"!==a.root&&"sandbox"!==a.root)thrownewTypeError("root must be 'dropbox' or 'sandbox'");this._access_token=a.access_token,this._root=a.root}varh="https://content.dropboxapi.com/1/files_put/{+root}{+id}{+name}{?access_token}",i=d.parse(h),j="https://api.dropboxapi.com/1/fileops/create_folder{?access_token,root,path}",k=d.parse(j),l="https://api.dropboxapi.com/1/fileops/delete/{?access_token,root,path}",m=d.parse(l),n="https://content.dropboxapi.com/1/files{/root,id}{+name}{?access_token}",o=d.parse(n),p="https://api.dropboxapi.com/1/metadata{/root}{+id}{?access_token}",q=d.parse(p);g.prototype.put=function(c,d){varf=this;if(c=e(c),Object.getOwnPropertyNames(d).length>0)thrownewa.util.jIOError("Can not store properties: "+Object.getOwnPropertyNames(d),400);return(newb.Queue).push(function(){returna.util.ajax({type:"POST",url:k.expand({access_token:f._access_token,root:f._root,path:c})})}).push(void0,function(a){if(void0===a.target||405!==a.target.status)throwa})},g.prototype.remove=function(b){returnb=e(b),a.util.ajax({type:"POST",url:m.expand({access_token:this._access_token,root:this._root,path:b})})},g.prototype.get=function(c){vard=this;return"/"===c?{}:(c=e(c),(newb.Queue).push(function(){returna.util.ajax({type:"GET",url:q.expand({access_token:d._access_token,root:d._root,id:c})})}).push(function(b){vard=JSON.parse(b.target.response||b.target.responseText);if(d.is_dir)return{};thrownewa.util.jIOError("Not a directory: "+c,404)},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find document: "+c,404);throwb}))},g.prototype.allAttachments=function(c){vard=this;returnc=e(c),(newb.Queue).push(function(){returna.util.ajax({type:"GET",url:q.expand({access_token:d._access_token,root:d._root,id:c})})}).push(function(b){vard,e=JSON.parse(b.target.response||b.target.responseText),f={};if(!e.is_dir)thrownewa.util.jIOError("Not a directory: "+c,404);for(d=0;d<e.contents.length;d+=1)e.contents[d].is_dir||(f[e.contents[d].path.split("/").pop()]={});returnf},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find document: "+c,404);throwb})},g.prototype.putAttachment=function(b,c,d){returnb=e(b),f(c),a.util.ajax({type:"PUT",url:i.expand({root:this._root,id:b,name:c,access_token:this._access_token}),dataType:d.type,data:d})},g.prototype.getAttachment=function(d,g){varh=this;returnd=e(d),f(g),(newb.Queue).push(function(){returna.util.ajax({type:"GET",dataType:"blob",url:o.expand({root:h._root,id:d,name:g,access_token:h._access_token})})}).push(function(a){returnnewc([a.target.response||a.target.responseText],{type:a.target.getResponseHeader("Content-Type")||"application/octet-stream"})},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find attachment: "+d+", "+g,404);throwb})},g.prototype.removeAttachment=function(c,d){varg=this;returnc=e(c),f(d),(newb.Queue).push(function(){returna.util.ajax({type:"POST",url:m.expand({access_token:g._access_token,root:g._root,path:c+d})})}).push(void0,function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find attachment: "+c+", "+d,404);throwb})},a.addStorage("dropbox",g)}(jIO,RSVP,Blob,UriTemplate),function(a,b,c,d){"use strict";functione(c,d){returnvoid0===d&&(d={}),void0!==c._authorization&&(void0===d.headers&&(d.headers={}),d.headers.Authorization=c._authorization),(newb.Queue).push(function(){returna.util.ajax(d)})}functionf(b){if(0!==b.indexOf("/"))thrownewa.util.jIOError("id "+b+" is forbidden (no begin /)",400);if(b.lastIndexOf("/")!==b.length-1)thrownewa.util.jIOError("id "+b+" is forbidden (no end /)",400);returnb}functiong(b){if(-1!==b.indexOf("/"))thrownewa.util.jIOError("attachment "+b+" is forbidden",400)}functionh(a){if("string"!=typeofa.url)thrownewTypeError("DavStorage 'url' is not of type string");this._url=a.url,"string"==typeofa.basic_login&&(this._authorization="Basic "+a.basic_login)}h.prototype.put=function(c,d){varg=this;if(c=f(c),Object.getOwnPropertyNames(d).length>0)thrownewa.util.jIOError("Can not store properties: "+Object.getOwnPropertyNames(d),400);return(newb.Queue).push(function(){returne(g,{type:"MKCOL",url:g._url+c})}).push(void0,function(a){if(void0===a.target||405!==a.target.status)throwa})},h.prototype.remove=function(a){returna=f(a),e(this,{type:"DELETE",url:this._url+a})},h.prototype.get=function(c){vard=this;returnc=f(c),(newb.Queue).push(function(){returne(d,{type:"PROPFIND",url:d._url+c,dataType:"text",headers:{Depth:"1"}})}).push(function(){return{}},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find document",404);throwb})},h.prototype.allAttachments=function(d){varg=this;returnd=f(d),(newb.Queue).push(function(){returne(g,{type:"PROPFIND",url:g._url+d,dataType:"text",headers:{Depth:"1"}})}).push(function(a){varb,d,e={},f=(newc).parseFromString(a.target.responseText,"text/xml").querySelectorAll("D\\:response, response");for(b=1;b<f.length;b+=1)d=f[b].querySelector("D\\:href, href").textContent.split("/").slice(-1)[0],void0!==d&&""!==d&&(e[d]={});returne},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find document",404);throwb})},h.prototype.putAttachment=function(c,d,h){vari=this;returnc=f(c),g(d),(newb.Queue).push(function(){returne(i,{type:"PUT",url:i._url+c+d,data:h})}).push(void0,function(b){if(403===b.target.status)thrownewa.util.jIOError("Cannot access subdocument",404);throwb})},h.prototype.getAttachment=function(c,h){vari=this;returnc=f(c),g(h),(newb.Queue).push(function(){returne(i,{type:"GET",url:i._url+c+h,dataType:"blob"})}).push(function(a){returnnewd([a.target.response||a.target.responseText],{type:a.target.getResponseHeader("Content-Type")||"application/octet-stream"})},function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find attachment: "+c+" , "+h,404);throwb})},h.prototype.removeAttachment=function(c,d){varh=this;returnc=f(c),g(d),(newb.Queue).push(function(){returne(h,{type:"DELETE",url:h._url+c+d})}).push(void0,function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find attachment: "+c+" , "+d,404);throwb})},a.addStorage("dav",h)}(jIO,RSVP,DOMParser,Blob),function(a,b){"use strict";functionc(b){if(!Array.isArray(b.storage_list))thrownewa.util.jIOError("storage_list is not an Array",400);varc;for(this._storage_list=[],c=0;c<b.storage_list.length;c+=1)this._storage_list.push(a.createJIO(b.storage_list[c]))}c.prototype._getWithStorageIndex=function(){functionb(b){g.push(void0,function(c){if(cinstanceofa.util.jIOError&&404===c.status_code)returne._storage_list[b].get.apply(e._storage_list[b],f).push(function(a){returnd=b,a});throwc})}varc,d=0,e=this,f=arguments,g=this._storage_list[0].get.apply(this._storage_list[0],f);for(c=1;c<this._storage_list.length;c+=1)b(c);returng.push(function(a){return[d,a]})},c.prototype.get=function(){returnthis._getWithStorageIndex.apply(this,arguments).push(function(a){returna[1]})},c.prototype.allAttachments=function(){vara=arguments,b=this;returnthis._getWithStorageIndex.apply(this,arguments).push(function(c){vard=b._storage_list[c[0]];returnd.allAttachments.apply(d,a)})},c.prototype.post=function(){returnthis._storage_list[0].post.apply(this._storage_list[0],arguments)},c.prototype.put=function(){varb=arguments,c=this;returnthis._getWithStorageIndex(b[0]).push(void0,function(b){if(binstanceofa.util.jIOError&&404===b.status_code)return[0];throwb}).push(function(a){vard=c._storage_list[a[0]];returnd.put.apply(d,b)})},c.prototype.remove=function(){vara=arguments,b=this;returnthis._getWithStorageIndex(a[0]).push(function(c){vard=b._storage_list[c[0]];returnd.remove.apply(d,a)})},c.prototype.buildQuery=function(){vara,c,d=[],e={},f=this._storage_list.length;for(a=0;f>a;a+=1)c=this._storage_list[a],d.push(c.buildQuery.apply(c,arguments));return(newb.Queue).push(function(){returnb.all(d)}).push(function(b){varc,d,g,h=[];for(f=b.length,a=0;f>a;a+=1)for(c=b[a],d=c.length,g=0;d>g;g+=1)e.hasOwnProperty(c[g].id)||(e[c[g].id]=null,h.push(c[g]));returnh})},c.prototype.hasCapacity=function(a){varb,c,d,e;if("list"===a||"query"===a||"select"===a){for(d=!0,c=this._storage_list.length,b=0;c>b;b+=1)e=this._storage_list[b],d=d&&e.hasCapacity(a);returnd}return!1},c.prototype.repair=function(){vara,c=[];for(a=0;a<this._storage_list.length;a+=1)c.push(this._storage_list[a].repair.apply(this._storage_list[a],arguments));returnb.all(c)},c.prototype.getAttachment=function(){vara=arguments,b=this;returnthis._getWithStorageIndex.apply(this,arguments).push(function(c){vard=b._storage_list[c[0]];returnd.getAttachment.apply(d,a)})},c.prototype.putAttachment=function(){vara=arguments,b=this;returnthis._getWithStorageIndex.apply(this,arguments).push(function(c){vard=b._storage_list[c[0]];returnd.putAttachment.apply(d,a)})},c.prototype.removeAttachment=function(){vara=arguments,b=this;returnthis._getWithStorageIndex.apply(this,arguments).push(function(c){vard=b._storage_list[c[0]];returnd.removeAttachment.apply(d,a)})},a.addStorage("union",c)}(jIO,RSVP),function(a,b,c,d,e,f){"use strict";functiong(b){return(newd.Queue).push(function(){returna.util.ajax({type:"GET",url:b._url,xhrFields:{withCredentials:!0}})}).push(function(a){returnJSON.parse(a.target.responseText)})}functionh(c,e,f){returnvoid0===f&&(f={}),g(c).push(function(c){return(newd.Queue).push(function(){returna.util.ajax({type:"GET",url:b.parse(c._links.traverse.href).expand({relative_url:e,view:f._view}),xhrFields:{withCredentials:!0}})}).push(void0,function(b){if(void0!==b.target&&404===b.target.status)thrownewa.util.jIOError("Cannot find document: "+e,404);throwb})})}functioni(a){return(newd.Queue).push(function(){varb,c,d,e=a._embedded._view,f={portal_type:a.portal_type},g={};g.form_id={key:[e.form_id.key],"default":e.form_id["default"]};for(cine)e.hasOwnProperty(c)&&(b=e[c],d=0,0===c.indexOf("my_")&&b.editable&&(d=3),0===c.indexOf("your_")&&(d=5),0!==d&&m.hasOwnProperty(b.type)&&(g[c.substring(d)]={"default":b["default"],key:b.key},f[c.substring(d)]=b["default"]));return{action_href:e._actions.put.href,data:f,form_data:g}})}functionj(b,c){returnb.getAttachment(c,"view").push(function(b){returna.util.readBlobAsText(b)}).push(function(a){returnJSON.parse(a.target.result)}).push(function(a){returni(a)})}functionk(a){if("string"!=typeofa.url||!a.url)thrownewTypeError("ERP5 'url' must be a string which contains more than one character.");this._url=a.url,this._default_view_reference=a.default_view_reference}functionl(a){varb,c=a.data;for(binc)c.hasOwnProperty(b)&&(c[b]||deletec[b]);returnc}varm={StringField:null,EmailField:null,IntegerField:null,FloatField:null,TextAreaField:null};k.prototype.get=function(a){returnj(this,a).push(function(a){returnl(a)})},k.prototype.bulk=function(b){vare,f=this,h=[];for(e=0;e<b.length;e+=1){if("get"!==b[e].method)thrownewError("ERP5Storage: not supported "+b[e].method+" in bulk");h.push({relative_url:b[e].parameter_list[0],view:f._default_view_reference})}returng(f).push(function(b){vard=newc;returnd.append("bulk_list",JSON.stringify(h)),a.util.ajax({type:"POST",url:b._actions.bulk.href,data:d,xhrFields:{withCredentials:!0}})}).push(function(a){functionb(a){returna.portal_type=a._links.type.name,i(a).push(function(a){returnl(a)})}varc=[],f=JSON.parse(a.target.responseText);for(e=0;e<f.result_list.length;e+=1)c.push(b(f.result_list[e]));returnd.all(c)})},k.prototype.post=function(b){vard,f=this;returng(this).push(function(d){vare=newc;returne.append("portal_type",b.portal_type),e.append("parent_relative_url",b.parent_relative_url),a.util.ajax({type:"POST",url:d._actions.add.href,data:e,xhrFields:{withCredentials:!0}})}).push(function(a){varc=a.target.getResponseHeader("X-Location"),g=newe(c);returnd=g.segment(2),f.put(d,b)}).push(function(){returnd})},k.prototype.put=function(b,c){vard=this;returnj(d,b).push(function(e){varg,h=e.form_data,i={};i[h.form_id.key]=h.form_id["default"];for(ginc)if(c.hasOwnProperty(g)){if("form_id"===g)thrownewa.util.jIOError("ERP5: forbidden property: "+g,400);if("portal_type"!==g&&"parent_relative_url"!==g){if(!h.hasOwnProperty(g))thrownewa.util.jIOError("ERP5: can not store property: "+g,400);i[h[g].key]=c[g]}}returnd.putAttachment(b,e.action_href,newf([JSON.stringify(i)],{type:"application/json"}))})},k.prototype.allAttachments=function(a){varb=this;returnh(this,a).push(function(){returnvoid0===b._default_view_reference?{links:{}}:{view:{},links:{}}})},k.prototype.getAttachment=function(b,c){if("view"===c){if(void0===this._default_view_reference)thrownewa.util.jIOError("Cannot find attachment view for: "+b,404);returnh(this,b,{_view:this._default_view_reference}).push(function(a){varc=JSON.parse(a.target.responseText);returnc._id=b,c.portal_type=c._links.type.name,newf([JSON.stringify(c)],{type:"application/hal+json"})})}if("links"===c)returnh(this,b).push(function(a){returnnewf([JSON.stringify(JSON.parse(a.target.responseText))],{type:"application/hal+json"})});if(0===c.indexOf(this._url))return(newd.Queue).push(function(){returna.util.ajax({type:"GET",url:c,xhrFields:{withCredentials:!0}})}).push(function(a){varc=JSON.parse(a.target.responseText);returnc._id=b,newf([JSON.stringify(c)],{type:a.target.getResponseHeader("Content-Type")})});thrownewa.util.jIOError("ERP5: not support get attachment: "+c,400)},k.prototype.putAttachment=function(b,e,f){if(0!==e.indexOf(this._url))thrownewa.util.jIOError("Can not store outside ERP5: "+e,400);return(newd.Queue).push(function(){returna.util.readBlobAsText(f)}).push(function(b){vard,f,g=JSON.parse(b.target.result),h=newc;for(fing)if(g.hasOwnProperty(f))if(Array.isArray(g[f]))for(d=0;d<g[f].length;d+=1)h.append(f,g[f][d]);elseh.append(f,g[f]);returna.util.ajax({type:"POST",url:e,data:h,xhrFields:{withCredentials:!0}})})},k.prototype.hasCapacity=function(a){return"list"===a||"query"===a||"select"===a||"limit"===a||"sort"===a},k.prototype.buildQuery=function(c){returng(this).push(function(d){returna.util.ajax({type:"GET",url:b.parse(d._links.raw_search.href).expand({query:c.query,select_list:c.select_list||["title","reference"],limit:c.limit,sort_on:c.sort_on}),xhrFields:{withCredentials:!0}})}).push(function(a){returnJSON.parse(a.target.responseText)}).push(function(a){varb,c,d,f=a._embedded.contents,g=f.length,h=[];for(b=0;g>b;b+=1)d=f[b],c=newe(d._links.self.href),deleted._links,h.push({id:c.segment(2),value:d});returnh})},a.addStorage("erp5",k)}(jIO,UriTemplate,FormData,RSVP,URI,Blob),function(a,b){"use strict";functionc(b){this._sub_storage=a.createJIO(b.sub_storage),this._key_schema=b.key_schema}c.prototype.get=function(){returnthis._sub_storage.get.apply(this._sub_storage,arguments)},c.prototype.allAttachments=function(){returnthis._sub_storage.allAttachments.apply(this._sub_storage,arguments)},c.prototype.post=function(){returnthis._sub_storage.post.apply(this._sub_storage,arguments)},c.prototype.put=function(){returnthis._sub_storage.put.apply(this._sub_storage,arguments)},c.prototype.remove=function(){returnthis._sub_storage.remove.apply(this._sub_storage,arguments)},c.prototype.getAttachment=function(){returnthis._sub_storage.getAttachment.apply(this._sub_storage,arguments)},c.prototype.putAttachment=function(){returnthis._sub_storage.putAttachment.apply(this._sub_storage,arguments)},c.prototype.removeAttachment=function(){returnthis._sub_storage.removeAttachment.apply(this._sub_storage,arguments)},c.prototype.repair=function(){returnthis._sub_storage.repair.apply(this._sub_storage,arguments)},c.prototype.hasCapacity=function(a){return"list"===a?this._sub_storage.hasCapacity(a):!0},c.prototype.buildQuery=function(c){vard=this._sub_storage,e=this,f={},g=!1,h=!1;if(d.hasCapacity("list")){try{void0!==c.query&&!d.hasCapacity("query")||void0!==c.sort_on&&!d.hasCapacity("sort")||void0!==c.select_list&&!d.hasCapacity("select")||void0!==c.limit&&!d.hasCapacity("limit")||(f.query=c.query,f.sort_on=c.sort_on,f.select_list=c.select_list,f.limit=c.limit)}catch(i){if(!(iinstanceofa.util.jIOError&&501===i.status_code))throwi;g=!0}try{(g||c.include_docs===!0)&&d.hasCapacity("include")&&(f.include_docs=!0)}catch(i){if(!(iinstanceofa.util.jIOError&&501===i.status_code))throwi;h=!0}returnd.buildQuery(f).push(function(c){functione(b){vare=c[b].id;returnd.get(e).push(function(a){returna._id=e,a},function(b){if(!(binstanceofa.util.jIOError&&404===b.status_code))throwb})}varf,g,i=[c];if(h){for(f=c.length,g=0;f>g;g+=1)i.push(e(g));c=b.all(i)}returnc}).push(function(a){varb,c,d;if(h){for(b=a[0],c=b.length,d=0;c>d;d+=1)b[d].doc=a[d+1];a=b}returna}).push(function(b){vard,f,h=[];if(g){for(d=b.length,f=0;d>f;f+=1)b[f].doc.__id=b[f].id,h.push(b[f].doc);c.select_list&&c.select_list.push("__id"),b=a.QueryFactory.create(c.query||"",e._key_schema).exec(h,c)}returnb}).push(function(a){varb,d,e,f=[];if(g){for(d=a.length,e=0;d>e;e+=1){if(b={id:a[e].__id,value:c.select_list?a[e]:{},doc:{}},c.select_list&&deleteb.value.__id,c.include_docs)thrownewError("QueryStorage does not support include docs");f.push(b)}a=f}returna})}},a.addStorage("query",c)}(jIO,RSVP),function(a,b,c){"use strict";functiond(b){this._sub_storage=a.createJIO(b.sub_storage)}functione(a,b){return-1!==a.indexOf(b,a.length-b.length)}varf=".json",g="/.jio_documents/",h="/";d.prototype.get=function(c){vard=this;return(newb.Queue).push(function(){returnd._sub_storage.getAttachment(g,c+f,{format:"json"})}).push(void0,function(b){if(binstanceofa.util.jIOError&&404===b.status_code)returnd._sub_storage.allAttachments(h).push(function(b){if(b.hasOwnProperty(c))return{};thrownewa.util.jIOError("Cannot find document "+c,404)});throwb})},d.prototype.allAttachments=function(b){varc=this;returnc._sub_storage.allAttachments(h).push(function(d){returnd.hasOwnProperty(b)?{enclosure:{}}:c._sub_storage.getAttachment(g,b+f).push(function(){return{}},function(c){if(cinstanceofa.util.jIOError&&404===c.status_code)thrownewa.util.jIOError("Cannot find document "+b,404);throwc})})},d.prototype.put=function(b,d){vare=this;returne._sub_storage.putAttachment(g,b+f,newc([JSON.stringify(d)],{type:"application/json"})).push(void0,function(h){if(hinstanceofa.util.jIOError&&404===h.status_code)returne._sub_storage.put(g,{}).push(function(){returne._sub_storage.putAttachment(g,b+f,newc([JSON.stringify(d)],{type:"application/json"}))});throwh}).push(function(){returnb})},d.prototype.remove=function(c){vard=this,e=!1;return(newb.Queue).push(function(){returnd._sub_storage.removeAttachment(h,c)}).push(void0,function(b){if(binstanceofa.util.jIOError&&404===b.status_code)returnvoid(e=!0);throwb}).push(function(){returnd._sub_storage.removeAttachment(g,c+f)}).push(void0,function(b){if(!e&&binstanceofa.util.jIOError&&404===b.status_code)returnc;throwb})},d.prototype.hasCapacity=function(a){return"list"===a},d.prototype.buildQuery=function(){varc={},d=this;return(newb.Queue).push(function(){returnd._sub_storage.allAttachments(g)}).push(function(a){varb;for(bina)a.hasOwnProperty(b)&&e(b,f)&&(c[b.substring(0,b.length-f.length)]=null)},function(b){if(!(binstanceofa.util.jIOError&&404===b.status_code))throwb}).push(function(){returnd._sub_storage.allAttachments(h)}).push(function(a){varb;for(bina)a.hasOwnProperty(b)&&(c[b]=null)}).push(function(){vara,b=[];for(ainc)c.hasOwnProperty(a)&&b.push({id:a,value:{}});returnb})},d.prototype.getAttachment=function(b,c){if("enclosure"!==c)thrownewa.util.jIOError("Only support 'enclosure' attachment",400);returnthis._sub_storage.getAttachment(h,b)},d.prototype.putAttachment=function(b,c,d){if("enclosure"!==c)thrownewa.util.jIOError("Only support 'enclosure' attachment",400);returnthis._sub_storage.putAttachment(h,b,d)},d.prototype.removeAttachment=function(b,c){if("enclosure"!==c)thrownewa.util.jIOError("Only support 'enclosure' attachment",400);returnthis._sub_storage.removeAttachment(h,b)},d.prototype.repair=function(){returnthis._sub_storage.repair.apply(this._sub_storage,arguments)},a.addStorage("drivetojiomapping",d)}(jIO,RSVP,Blob),function(a,b,c,d,e){"use strict";functionf(b){this._sub_storage=a.createJIO(b.sub_storage),this._document_id=b.document_id,this._repair_attachment=b.repair_attachment||!1}functiong(a,b){returnvoid0===b?"jio_document/"+d(a)+h:"jio_attachment/"+d(a)+"/"+d(b)}varh=".json",i=newRegExp("^jio_document/([\\w=]+)"+h+"$"),j=newRegExp("^jio_attachment/([\\w=]+)/([\\w=]+)$");f.prototype.get=function(a){returnthis._sub_storage.getAttachment(this._document_id,g(a),{format:"json"})},f.prototype.allAttachments=function(a){returnthis._sub_storage.allAttachments(this._document_id).push(function(b){vard,e,f={};for(einb)if(b.hasOwnProperty(e)&&j.test(e)){d=j.exec(e);try{c(d[1])===a&&(f[c(d[2])]={})}catch(g){if(!ginstanceofReferenceError)throwg}}returnf})},f.prototype.put=function(a,c){returnthis._sub_storage.putAttachment(this._document_id,g(a),newb([JSON.stringify(c)],{type:"application/json"})).push(function(){returna})},f.prototype.remove=function(a){varb=this;returnthis.allAttachments(a).push(function(c){vard,f=[];for(dinc)c.hasOwnProperty(d)&&f.push(b.removeAttachment(a,d));returne.all(f)}).push(function(){returnb._sub_storage.removeAttachment(b._document_id,g(a))}).push(function(){returna})},f.prototype.repair=function(){vara=this;returnthis._sub_storage.repair.apply(this._sub_storage,arguments).push(function(b){returna._repair_attachment?a._sub_storage.allAttachments(a._document_id).push(function(b){vard,f,g,h,k=[],l={},m={};for(hinb)if(b.hasOwnProperty(h))if(d=void0,f=void0,i.test(h)){try{d=c(i.exec(h)[1])}catch(n){if(!ninstanceofReferenceError)thrown}void0!==d&&(l[d]=null)}elseif(j.test(h)){g=j.exec(h);try{d=c(g[1]),f=c(g[2])}catch(n){if(!ninstanceofReferenceError)thrown}void0!==f&&(l.hasOwnProperty(d)||(m.hasOwnProperty(d)||(m[d]={}),m[d][f]=null))}for(dinm)if(m.hasOwnProperty(d)&&!l.hasOwnProperty(d))for(finm[d])m[d].hasOwnProperty(f)&&k.push(a.removeAttachment(d,f));returne.all(k)}):b})},f.prototype.hasCapacity=function(a){return"list"===a},f.prototype.buildQuery=function(){returnthis._sub_storage.allAttachments(this._document_id).push(function(a){varb,d=[];for(bina)if(a.hasOwnProperty(b)&&i.test(b))try{d.push({id:c(i.exec(b)[1]),value:{}})}catch(e){if(!einstanceofReferenceError)throwe}returnd})},f.prototype.getAttachment=function(a,b){returnthis._sub_storage.getAttachment(this._document_id,g(a,b))},f.prototype.putAttachment=function(a,b,c){returnthis._sub_storage.putAttachment(this._document_id,g(a,b),c)},f.prototype.removeAttachment=function(a,b){returnthis._sub_storage.removeAttachment(this._document_id,g(a,b))},a.addStorage("document",f)}(jIO,Blob,atob,btoa,RSVP),function(a,b,c,d,e,f){"use strict";functiong(a){if("string"!=typeofa.database||""===a.database)thrownewTypeError("IndexedDBStorage 'database' description property must be a non-empty string");this._database_name="jio:"+a.database}functionh(a){returna.join("_")}functioni(a){varb,c=a.target.result;b=c.createObjectStore("metadata",{keyPath:"_id",autoIncrement:!1}),b.createIndex("_id","_id",{unique:!0}),b=c.createObjectStore("attachment",{keyPath:"_key_path",autoIncrement:!1}),b.createIndex("_id","_id",{unique:!1}),b=c.createObjectStore("blob",{keyPath:"_key_path",autoIncrement:!1}),b.createIndex("_id_attachment",["_id","_attachment"],{unique:!1}),b.createIndex("_id","_id",{unique:!1})}functionj(b){functiond(b,c){vard=a.open(e);d.onerror=function(a){d.result&&d.result.close(),c(a)},d.onabort=function(){d.result.close(),c("Aborting connection to: "+e)},d.ontimeout=function(){d.result.close(),c("Connection to: "+e+" timeout")},d.onblocked=function(){d.result.close(),c("Connection to: "+e+" was blocked")},d.onupgradeneeded=i,d.onversionchange=function(){d.result.close(),c(e+" was upgraded")},d.onsuccess=function(){b(d.result)}}vare=b._database_name;return(newc.Queue).push(function(){returnnewc.Promise(d)})}functionk(a,b,c,d){vare=a.transaction(b,c);returnd!==!1&&(e.oncomplete=function(){a.close()}),e.onabort=function(){a.close()},e}functionl(a,b){functiond(c,d){a.onerror=function(b){a.transaction&&a.transaction.abort(),d(b)},a.onsuccess=function(a){vare=a.target.result;if(e){try{b(e)}catch(f){d(f)}e["continue"]()}elsec()}}returnnewc.Promise(d)}functionm(a){functiond(c,d){a.onerror=d,a.onsuccess=function(){a.result&&c(a.result),d(newb.util.jIOError("Cannot find document",404))}}returnnewc.Promise(d)}functionn(a){functionb(b,c){a.onerror=c,a.onsuccess=function(){b(a.result)}}returnnewc.Promise(b)}functiono(a){a["delete"]()}functionp(a,b,d){returnc.all([n(a.objectStore("attachment")["delete"](h([b,d]))),l(a.objectStore("blob").index("_id_attachment").openCursor(f.only([b,d])),o)])}varq=2e6;g.prototype.hasCapacity=function(a){return"list"===a||"include"===a},g.prototype.buildQuery=function(a){functionb(a){d.push({id:a.key,value:{},doc:a.value.doc})}functionc(a){d.push({id:a.key,value:{}})}vard=[];returnj(this).push(function(d){vare=k(d,["metadata"],"readonly");returna.include_docs===!0?l(e.objectStore("metadata").index("_id").openCursor(),b):l(e.objectStore("metadata").index("_id").openKeyCursor(),c)}).push(function(){returnd})},g.prototype.get=function(a){returnj(this).push(function(b){varc=k(b,["metadata"],"readonly");returnm(c.objectStore("metadata").get(a))}).push(function(a){returna.doc})},g.prototype.allAttachments=function(a){functionb(a){d[a.value._attachment]={}}vard={};returnj(this).push(function(d){vare=k(d,["metadata","attachment"],"readonly");returnc.all([m(e.objectStore("metadata").get(a)),l(e.objectStore("attachment").index("_id").openCursor(f.only(a)),b)])}).push(function(){returnd})},g.prototype.put=function(a,b){returnj(this).push(function(c){vard=k(c,["metadata"],"readwrite");returnn(d.objectStore("metadata").put({_id:a,doc:b}))})},g.prototype.remove=function(a){returnj(this).push(function(b){vard=k(b,["metadata","attachment","blob"],"readwrite");returnc.all([n(d.objectStore("metadata")["delete"](a)),l(d.objectStore("attachment").index("_id").openCursor(f.only(a)),o),l(d.objectStore("blob").index("_id").openCursor(f.only(a)),o)])})},g.prototype.getAttachment=function(a,f,g){vari,l,n,o;returnvoid0===g&&(g={}),j(this).push(function(b){returni=k(b,["attachment","blob"],"readonly"),m(i.objectStore("attachment").get(h([a,f])))}).push(function(d){varj,k,p,r=d.info.length,s=[],t=i.objectStore("blob");if(l=d.info.content_type,n=g.start||0,o=g.end||r,o>r&&(o=r),0>n||0>o)thrownewb.util.jIOError("_start and _end must be positive",400);if(n>o)thrownewb.util.jIOError("_start is greater than _end",400);for(k=e.floor(n/q),p=e.floor(o/q),o%q===0&&(p-=1),j=k;p>=j;j+=1)s.push(m(t.get(h([a,f,j]))));returnc.all(s)}).push(function(a){varb,c,e=[],f=a.length;for(c=0;f>c;c+=1)e.push(a[c].blob);returnvoid0===g.start&&void0===g.end?newd(e,{type:l}):(b=newd(e,{type:"application/octet-stream"}),b.slice(n,o,"application/octet-stream"))})},g.prototype.putAttachment=function(a,d,e){varf,g,i=[];returnj(this).push(function(a){returng=a,b.util.readBlobAsArrayBuffer(e)}).push(function(b){for(varc=b.target.result,h=e.size,j=0;h>j;)i.push(c.slice(j,j+q)),j+=q;returnf=k(g,["attachment","blob"],"readwrite"),p(f,a,d)}).push(function(){varb,g=[n(f.objectStore("attachment").put({_key_path:h([a,d]),_id:a,_attachment:d,info:{content_type:e.type,length:e.size}}))],j=i.length,k=f.objectStore("blob");for(b=0;j>b;b+=1)g.push(n(k.put({_key_path:h([a,d,b]),_id:a,_attachment:d,_part:b,blob:i[b]})));returnc.all(g)})},g.prototype.removeAttachment=function(a,b){returnj(this).push(function(c){vard=k(c,["attachment","blob"],"readwrite");returnp(d,a,b)})},b.addStorage("indexeddb",g)}(indexedDB,jIO,RSVP,Blob,Math,IDBKeyRange);