You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
661 KiB

function BigInteger(e,t,n){null!=e&&("number"==typeof e?this.fromNumber(e,t,n):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function nbi(){return new BigInteger(null)}function am1(e,t,n,i,r,o){for(;--o>=0;){var a=t*this[e++]+n[i]+r;r=Math.floor(a/67108864),n[i++]=67108863&a}return r}function am2(e,t,n,i,r,o){for(var a=32767&t,s=t>>15;--o>=0;){var c=32767&this[e],l=this[e++]>>15,u=s*c+l*a;c=a*c+((32767&u)<<15)+n[i]+(1073741823&r),r=(c>>>30)+(u>>>15)+s*l+(r>>>30),n[i++]=1073741823&c}return r}function am3(e,t,n,i,r,o){for(var a=16383&t,s=t>>14;--o>=0;){var c=16383&this[e],l=this[e++]>>14,u=s*c+l*a;c=a*c+((16383&u)<<14)+n[i]+r,r=(c>>28)+(u>>14)+s*l,n[i++]=268435455&c}return r}function int2char(e){return BI_RM.charAt(e)}function intAt(e,t){var n=BI_RC[e.charCodeAt(t)];return null==n?-1:n}function bnpCopyTo(e){for(var t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s}function bnpFromInt(e){this.t=1,this.s=0>e?-1:0,e>0?this[0]=e:-1>e?this[0]=e+this.DV:this.t=0}function nbv(e){var t=nbi();return t.fromInt(e),t}function bnpFromString(e,t,n){var i;if(16==t)i=4;else if(8==t)i=3;else if(256==t)i=8;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return void this.fromRadix(e,t);i=2}this.t=0,this.s=0;for(var r=e.length,o=!1,a=0;--r>=0;){var s=8==i?255&e[r]:intAt(e,r);0>s?"-"==e.charAt(r)&&(o=!0):(o=!1,0==a?this[this.t++]=s:a+i>this.DB?(this[this.t-1]|=(s&(1<<this.DB-a)-1)<<a,this[this.t++]=s>>this.DB-a):this[this.t-1]|=s<<a,a+=i,a>=this.DB&&(a-=this.DB))}8==i&&0!=(128&e[0])&&n&&(this.s=-1,a>0&&(this[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),o&&BigInteger.ZERO.subTo(this,this)}function bnpClamp(){for(var e=this.s&this.DM;this.t>0&&this[this.t-1]==e;)--this.t}function bnToString(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var n,i=(1<<t)-1,r=!1,o="",a=this.t,s=this.DB-a*this.DB%t;if(a-->0)for(s<this.DB&&(n=this[a]>>s)>0&&(r=!0,o=int2char(n));a>=0;)t>s?(n=(this[a]&(1<<s)-1)<<t-s,n|=this[--a]>>(s+=this.DB-t)):(n=this[a]>>(s-=t)&i,0>=s&&(s+=this.DB,--a)),n>0&&(r=!0),r&&(o+=int2char(n));return r?o:"0"}function bnNegate(){var e=nbi();return BigInteger.ZERO.subTo(this,e),e}function bnAbs(){return this.s<0?this.negate():this}function bnCompareTo(e){var t=this.s-e.s;if(0!=t)return t;var n=this.t;if(t=n-e.t,0!=t)return this.s<0?-t:t;for(;--n>=0;)if(0!=(t=this[n]-e[n]))return t;return 0}function nbits(e){var t,n=1;return 0!=(t=e>>>16)&&(e=t,n+=16),0!=(t=e>>8)&&(e=t,n+=8),0!=(t=e>>4)&&(e=t,n+=4),0!=(t=e>>2)&&(e=t,n+=2),0!=(t=e>>1)&&(e=t,n+=1),n}function bnBitLength(){return this.t<=0?0:this.DB*(this.t-1)+nbits(this[this.t-1]^this.s&this.DM)}function bnpDLShiftTo(e,t){var n;for(n=this.t-1;n>=0;--n)t[n+e]=this[n];for(n=e-1;n>=0;--n)t[n]=0;t.t=this.t+e,t.s=this.s}function bnpDRShiftTo(e,t){for(var n=e;n<this.t;++n)t[n-e]=this[n];t.t=Math.max(this.t-e,0),t.s=this.s}function bnpLShiftTo(e,t){var n,i=e%this.DB,r=this.DB-i,o=(1<<r)-1,a=Math.floor(e/this.DB),s=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)t[n+a+1]=this[n]>>r|s,s=(this[n]&o)<<i;for(n=a-1;n>=0;--n)t[n]=0;t[a]=s,t.t=this.t+a+1,t.s=this.s,t.clamp()}function bnpRShiftTo(e,t){t.s=this.s;var n=Math.floor(e/this.DB);if(n>=this.t)return void(t.t=0);var i=e%this.DB,r=this.DB-i,o=(1<<i)-1;t[0]=this[n]>>i;for(var a=n+1;a<this.t;++a)t[a-n-1]|=(this[a]&o)<<r,t[a-n]=this[a]>>i;i>0&&(t[this.t-n-1]|=(this.s&o)<<r),t.t=this.t-n,t.clamp()}function bnpSubTo(e,t){for(var n=0,i=0,r=Math.min(e.t,this.t);r>n;)i+=this[n]-e[n],t[n++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;n<this.t;)i+=this[n],t[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<e.t;)i-=e[n],t[n++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=0>i?-1:0,-1>i?t[n++]=this.DV+i:i>0&&(t[n++]=i),t.t=n,t.clamp()}function bnpMultiplyTo(e,t){var n=this.abs(),i=e.abs(),r=n.t;for(t.t=r+i.t;--r>=0;)t[r]=0;for(r=0;r<i.t;++r)t[r+n.t]=n.am(0,i[r],t,r,0,n.t);t.s=0,t.clamp(),this.s!=e.s&&BigInteger.ZERO.subTo(t,t)}function bnpSquareTo(e){for(var t=this.abs(),n=e.t=2*t.t;--n>=0;)e[n]=0;for(n=0;n<t.t-1;++n){var i=t.a
if(u[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];for(o=u.shift();o;)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!c&&i&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),c=o,o=u.shift())if("*"===o)o=c;else if("*"!==c&&c!==o){if(a=l[c+" "+o]||l["* "+o],!a)for(r in l)if(s=r.split(" "),s[1]===o&&(a=l[c+" "+s[0]]||l["* "+s[0]])){a===!0?a=l[r]:l[r]!==!0&&(o=s[0],u.unshift(s[1]));break}if(a!==!0)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(p){return{state:"parsererror",error:a?p:"No conversion from "+c+" to "+o}}}return{state:"success",data:t}}function B(){try{return new e.XMLHttpRequest}catch(t){}}function F(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function O(){return setTimeout(function(){Jn=t}),Jn=ut.now()}function U(e,t,n){for(var i,r=(oi[t]||[]).concat(oi["*"]),o=0,a=r.length;a>o;o++)if(i=r[o].call(n,t,e))return i}function R(e,t,n){var i,r,o=0,a=ri.length,s=ut.Deferred().always(function(){delete c.elem}),c=function(){if(r)return!1;for(var t=Jn||O(),n=Math.max(0,l.startTime+l.duration-t),i=n/l.duration||0,o=1-i,a=0,c=l.tweens.length;c>a;a++)l.tweens[a].run(o);return s.notifyWith(e,[l,o,n]),1>o&&c?n:(s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:ut.extend({},t),opts:ut.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Jn||O(),duration:n.duration,tweens:[],createTween:function(t,n){var i=ut.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(i),i},stop:function(t){var n=0,i=t?l.tweens.length:0;if(r)return this;for(r=!0;i>n;n++)l.tweens[n].run(1);return t?s.resolveWith(e,[l,t]):s.rejectWith(e,[l,t]),this}}),u=l.props;for(q(u,l.opts.specialEasing);a>o;o++)if(i=ri[o].call(l,e,u,l.opts))return i;return ut.map(u,U,l),ut.isFunction(l.opts.start)&&l.opts.start.call(e,l),ut.fx.timer(ut.extend(c,{elem:e,anim:l,queue:l.opts.queue})),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always)}function q(e,t){var n,i,r,o,a;for(n in e)if(i=ut.camelCase(n),r=t[i],o=e[n],ut.isArray(o)&&(r=o[1],o=e[n]=o[0]),n!==i&&(e[i]=o,delete e[n]),a=ut.cssHooks[i],a&&"expand"in a){o=a.expand(o),delete e[i];for(n in o)n in e||(e[n]=o[n],t[n]=r)}else t[i]=r}function j(e,t,n){var i,r,o,a,s,c,l=this,u={},p=e.style,d=e.nodeType&&S(e),f=ut._data(e,"fxshow");n.queue||(s=ut._queueHooks(e,"fx"),null==s.unqueued&&(s.unqueued=0,c=s.empty.fire,s.empty.fire=function(){s.unqueued||c()}),s.unqueued++,l.always(function(){l.always(function(){s.unqueued--,ut.queue(e,"fx").length||s.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===ut.css(e,"display")&&"none"===ut.css(e,"float")&&(ut.support.inlineBlockNeedsLayout&&"inline"!==T(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",ut.support.shrinkWrapBlocks||l.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(i in t)if(r=t[i],ti.exec(r)){if(delete t[i],o=o||"toggle"===r,r===(d?"hide":"show"))continue;u[i]=f&&f[i]||ut.style(e,i)}if(!ut.isEmptyObject(u)){f?"hidden"in f&&(d=f.hidden):f=ut._data(e,"fxshow",{}),o&&(f.hidden=!d),d?ut(e).show():l.done(function(){ut(e).hide()}),l.done(function(){var t;ut._removeData(e,"fxshow");for(t in u)ut.style(e,t,u[t])});for(i in u)a=U(d?f[i]:0,i,l),i in f||(f[i]=a.start,d&&(a.end=a.start,a.start="width"===i||"height"===i?1:0))}}function H(e,t,n,i,r){return new H.prototype.init(e,t,n,i,r)}function V(e,t){var n,i={height:e},r=0;for(t=t?1:0;4>r;r+=2-t)n=Cn[r],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function z(e){return ut.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var W,G,K=typeof t,X=e.location,Z=e.document,Y=Z.documentElement,Q=e.jQuery,J=e.$,et={},tt=[],nt="1.10.2",it=tt.concat,rt=tt.push,ot=tt.slice,at=tt.indexOf,st=et.toString,ct=et.hasOwnProperty,lt=nt.trim,ut=function(e,t){return new ut.fn.init(e,t,G)},pt=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,dt=/\S+/g,ft=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,ht=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,gt=/^<
o=Z.createElement("select"),s=o.appendChild(Z.createElement("option")),r=p.getElementsByTagName("input")[0],i.style.cssText="top:1px;float:left;opacity:.5",t.getSetAttribute="t"!==p.className,t.leadingWhitespace=3===p.firstChild.nodeType,t.tbody=!p.getElementsByTagName("tbody").length,t.htmlSerialize=!!p.getElementsByTagName("link").length,t.style=/top/.test(i.getAttribute("style")),t.hrefNormalized="/a"===i.getAttribute("href"),t.opacity=/^0.5/.test(i.style.opacity),t.cssFloat=!!i.style.cssFloat,t.checkOn=!!r.value,t.optSelected=s.selected,t.enctype=!!Z.createElement("form").enctype,t.html5Clone="<:nav></:nav>"!==Z.createElement("nav").cloneNode(!0).outerHTML,t.inlineBlockNeedsLayout=!1,t.shrinkWrapBlocks=!1,t.pixelPosition=!1,t.deleteExpando=!0,t.noCloneEvent=!0,t.reliableMarginRight=!0,t.boxSizingReliable=!0,r.checked=!0,t.noCloneChecked=r.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!s.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}r=Z.createElement("input"),r.setAttribute("value",""),t.input=""===r.getAttribute("value"),r.value="t",r.setAttribute("type","radio"),t.radioValue="t"===r.value,r.setAttribute("checked","t"),r.setAttribute("name","t"),a=Z.createDocumentFragment(),a.appendChild(r),t.appendChecked=r.checked,t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,p.attachEvent&&(p.attachEvent("onclick",function(){t.noCloneEvent=!1}),p.cloneNode(!0).click());for(u in{submit:!0,change:!0,focusin:!0})p.setAttribute(c="on"+u,"t"),t[u+"Bubbles"]=c in e||p.attributes[c].expando===!1;p.style.backgroundClip="content-box",p.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===p.style.backgroundClip;for(u in ut(t))break;return t.ownLast="0"!==u,ut(function(){var n,i,r,o="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",a=Z.getElementsByTagName("body")[0];a&&(n=Z.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",a.appendChild(n).appendChild(p),p.innerHTML="<table><tr><td></td><td>t</td></tr></table>",r=p.getElementsByTagName("td"),r[0].style.cssText="padding:0;margin:0;border:0;display:none",l=0===r[0].offsetHeight,r[0].style.display="",r[1].style.display="none",t.reliableHiddenOffsets=l&&0===r[0].offsetHeight,p.innerHTML="",p.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",ut.swap(a,null!=a.style.zoom?{zoom:1}:{},function(){t.boxSizing=4===p.offsetWidth}),e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(p,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(p,null)||{width:"4px"}).width,i=p.appendChild(Z.createElement("div")),i.style.cssText=p.style.cssText=o,i.style.marginRight=i.style.width="0",p.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),typeof p.style.zoom!==K&&(p.innerHTML="",p.style.cssText=o+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===p.offsetWidth,p.style.display="block",p.innerHTML="<div></div>",p.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==p.offsetWidth,t.inlineBlockNeedsLayout&&(a.style.zoom=1)),a.removeChild(n),n=p=r=i=null)}),n=o=a=s=i=r=null,t}({});var Mt=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,xt=/([A-Z])/g;ut.extend({cache:{},noData:{applet:!0,embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){return e=e.nodeType?ut.cache[e[ut.expando]]:e[ut.expando],!!e&&!s(e)},data:function(e,t,n){return r(e,t,n)},removeData:function(e,t){return o(e,t)},_data:function(e,t,n){return r(e,t,n,!0)},_removeData:function(e,t){return o(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&ut.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),ut.fn.extend({data:function(e,n){var i,r,o=null,s=0,c=this[0];if(e===t){if(this.length&&(o=ut.data(c),1===c.nodeType&&!ut._data(c,"parsedAttrs"))){for(i=c
c[r]&&(delete c[r],l?delete n[s]:typeof n.removeAttribute!==K?n.removeAttribute(s):n[s]=null,tt.push(r))}},_evalUrl:function(e){return ut.ajax({url:e,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})}}),ut.fn.extend({wrapAll:function(e){if(ut.isFunction(e))return this.each(function(t){ut(this).wrapAll(e.call(this,t))});if(this[0]){var t=ut(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return this.each(ut.isFunction(e)?function(t){ut(this).wrapInner(e.call(this,t))}:function(){var t=ut(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=ut.isFunction(e);return this.each(function(n){ut(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){ut.nodeName(this,"body")||ut(this).replaceWith(this.childNodes)}).end()}});var un,pn,dn,fn=/alpha\([^)]*\)/i,hn=/opacity\s*=\s*([^)]*)/,gn=/^(top|right|bottom|left)$/,mn=/^(none|table(?!-c[ea]).+)/,yn=/^margin/,vn=RegExp("^("+pt+")(.*)$","i"),_n=RegExp("^("+pt+")(?!px)[a-z%]+$","i"),bn=RegExp("^([+-])=("+pt+")","i"),wn={BODY:"block"},$n={position:"absolute",visibility:"hidden",display:"block"},Sn={letterSpacing:0,fontWeight:400},Cn=["Top","Right","Bottom","Left"],kn=["Webkit","O","Moz","ms"];ut.fn.extend({css:function(e,n){return ut.access(this,function(e,n,i){var r,o,a={},s=0;if(ut.isArray(n)){for(o=pn(e),r=n.length;r>s;s++)a[n[s]]=ut.css(e,n[s],!1,o);return a}return i!==t?ut.style(e,n,i):ut.css(e,n)},e,n,arguments.length>1)},show:function(){return C(this,!0)},hide:function(){return C(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){S(this)?ut(this).show():ut(this).hide()})}}),ut.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=dn(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":ut.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,i,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,s,c=ut.camelCase(n),l=e.style;if(n=ut.cssProps[c]||(ut.cssProps[c]=$(l,c)),s=ut.cssHooks[n]||ut.cssHooks[c],i===t)return s&&"get"in s&&(o=s.get(e,!1,r))!==t?o:l[n];if(a=typeof i,"string"===a&&(o=bn.exec(i))&&(i=(o[1]+1)*o[2]+parseFloat(ut.css(e,n)),a="number"),!(null==i||"number"===a&&isNaN(i)||("number"!==a||ut.cssNumber[c]||(i+="px"),ut.support.clearCloneStyle||""!==i||0!==n.indexOf("background")||(l[n]="inherit"),s&&"set"in s&&(i=s.set(e,i,r))===t)))try{l[n]=i}catch(u){}}},css:function(e,n,i,r){var o,a,s,c=ut.camelCase(n);return n=ut.cssProps[c]||(ut.cssProps[c]=$(e.style,c)),s=ut.cssHooks[n]||ut.cssHooks[c],s&&"get"in s&&(a=s.get(e,!0,i)),a===t&&(a=dn(e,n,r)),"normal"===a&&n in Sn&&(a=Sn[n]),""===i||i?(o=parseFloat(a),i===!0||ut.isNumeric(o)?o||0:a):a}}),e.getComputedStyle?(pn=function(t){return e.getComputedStyle(t,null)},dn=function(e,n,i){var r,o,a,s=i||pn(e),c=s?s.getPropertyValue(n)||s[n]:t,l=e.style;return s&&(""!==c||ut.contains(e.ownerDocument,e)||(c=ut.style(e,n)),_n.test(c)&&yn.test(n)&&(r=l.width,o=l.minWidth,a=l.maxWidth,l.minWidth=l.maxWidth=l.width=c,c=s.width,l.width=r,l.minWidth=o,l.maxWidth=a)),c}):Z.documentElement.currentStyle&&(pn=function(e){return e.currentStyle},dn=function(e,n,i){var r,o,a,s=i||pn(e),c=s?s[n]:t,l=e.style;return null==c&&l&&l[n]&&(c=l[n]),_n.test(c)&&!gn.test(n)&&(r=l.left,o=e.runtimeStyle,a=o&&o.left,a&&(o.left=e.currentStyle.left),l.left="fontSize"===n?"1em":c,c=l.pixelLeft+"px",l.left=r,a&&(o.left=a)),""===c?"auto":c}),ut.each(["height","width"],function(e,n){ut.cssHooks[n]={get:function(e,i,r){return i?0===e.offsetWidth&&mn.test(ut.css(e,"display"))?ut.swap(e,$n,function(){return x(e,n,r)}):x(e,n,r):t},set:function(e,t,i){var r=i&&pn(e);return k(e,t,i?M(e,n,i,ut.support.boxSizing&&"border-box"===ut.css(e,"boxSizing",!1,r),r):0)}}}),ut.support.opacity||(ut.cssHooks.opacity={get:function(e,t){retu
}catch(e){console.error("CJ protection",e)}if(window.safeConfirm=function(e,t){"string"==typeof e&&(e={message:e});var n=!1;try{n=confirm(e.message)}catch(i){n=!0}setTimeout(function(){t(n)},10)},window.applicationCache&&!Config.Modes.packed&&window.addEventListener){var t=window.applicationCache,n=!1,i=!1,r=function(e){clearTimeout(i),i=setTimeout(function(){try{t.update()}catch(e){console.log("appCache.update: "+e)}},e||3e5)},o=function(){t.addEventListener("updateready",function(){t.status==t.UPDATEREADY&&(n||(safeConfirm({type:"WEBOGRAM_UPDATED_RELOAD",message:"A new version of Webogram is downloaded. Launch it?"},function(e){e?window.location.reload():n=!0}),r()))},!1),t.addEventListener("noupdate",function(){r()},!1),t.addEventListener("error",function(){r()},!1)};r(3e3),window.addEventListener("load",o)}}(),function(e,t,n){"use strict";var i,r,o,a,s,c,l,u,p,d,f,h,g,m,y,v,_,b,w,$,S,C,k,M,x,T,E,A,D;S={paneClass:"nano-pane",sliderClass:"nano-slider",contentClass:"nano-content",iOSNativeScrolling:!1,preventPageScrolling:!1,disableResize:!1,alwaysVisible:!1,flashDelay:1500,sliderMinHeight:20,sliderMaxHeight:null,documentContext:null,windowContext:null},v="scrollbar",y="scroll",u="mousedown",p="mousemove",f="mousewheel",d="mouseup",m="resize",s="drag",b="up",g="panedown",o="DOMMouseScroll",a="down",w="wheel",c="keydown",l="keyup",_="touchmove",i="Microsoft Internet Explorer"===t.navigator.appName&&/msie 7./i.test(t.navigator.appVersion)&&t.ActiveXObject,r=null,x=t.requestAnimationFrame,$=t.cancelAnimationFrame,E=n.createElement("div").style,D=function(){var e,t,n,i,r,o;for(i=["t","webkitT","MozT","msT","OT"],e=r=0,o=i.length;o>r;e=++r)if(n=i[e],t=i[e]+"ransform",t in E)return i[e].substr(0,i[e].length-1);return!1}(),A=function(e){return D===!1?!1:""===D?e:D+e.charAt(0).toUpperCase()+e.substr(1)},T=A("transform"),k=T!==!1,C=function(){var e,t,i;return e=n.createElement("div"),t=e.style,t.position="absolute",t.width="100px",t.height="100px",t.overflow=y,t.top="-9999px",n.body.appendChild(e),i=e.offsetWidth-e.clientWidth,n.body.removeChild(e),i},M=function(){var e,n,i;return n=t.navigator.userAgent,(e=/(?=.+Mac OS X)(?=.+Firefox)/.test(n))?(i=/Firefox\/\d{2}\./.exec(n),i&&(i=i[0].replace(/\D+/g,"")),e&&+i>23):!1},h=function(){function c(i,o){this.el=i,this.options=o,r||(r=C()),this.$el=e(this.el),this.doc=e(this.options.documentContext||n),this.win=e(this.options.windowContext||t),this.$content=this.$el.children("."+o.contentClass),this.$content.attr("tabindex",this.options.tabIndex||0),this.content=this.$content[0],this.previousPosition=0,this.options.iOSNativeScrolling&&null!=this.el.style.WebkitOverflowScrolling?this.nativeScrolling():this.generate(),this.createEvents(),this.addEvents(),this.reset()}return c.prototype.preventScrolling=function(e,t){if(this.isActive)if(e.type===o)(t===a&&e.originalEvent.detail>0||t===b&&e.originalEvent.detail<0)&&e.preventDefault();else if(e.type===f){if(!e.originalEvent||!e.originalEvent.wheelDelta)return;(t===a&&e.originalEvent.wheelDelta<0||t===b&&e.originalEvent.wheelDelta>0)&&e.preventDefault()}},c.prototype.nativeScrolling=function(){this.$content.css({WebkitOverflowScrolling:"touch"}),this.iOSNativeScrolling=!0,this.isActive=!0},c.prototype.updateScrollValues=function(){var e,t;e=this.content,this.maxScrollTop=e.scrollHeight-e.clientHeight,this.prevScrollTop=this.contentScrollTop||0,this.contentScrollTop=e.scrollTop,t=this.contentScrollTop>this.previousPosition?"down":this.contentScrollTop<this.previousPosition?"up":"same",this.previousPosition=this.contentScrollTop,"same"!==t&&this.$el.trigger("update",{position:this.contentScrollTop,maximum:this.maxScrollTop,direction:t}),this.iOSNativeScrolling||(this.maxSliderTop=this.paneHeight-this.sliderHeight,this.sliderTop=0===this.maxScrollTop?0:this.contentScrollTop*this.maxSliderTop/this.maxScrollTop)},c.prototype.setOnScrollStyles=function(){var e;k?(e={},e[T]="translate(0, "+this.sliderTop+"px)"):e={top:this.sliderTop},x?this.scrollRAF||(this.scrollRAF=x(function(t){return function(){t.scrollRAF=null,t.slider.css(e)}}(this))):this.s
c=R(c,n.childNodes),n=s.firstChild,n.textContent=""}return s.textContent="",s.innerHTML="",o(c,function(e){s.appendChild(e)}),s}function mt(e,n){n=n||t;var i;return(i=Zi.exec(e))?[n.createElement(i[1])]:(i=gt(e,n))?i.childNodes:[]}function yt(e){if(e instanceof yt)return e;if(b(e)&&(e=Oi(e)),!(this instanceof yt)){if(b(e)&&"<"!=e.charAt(0))throw Xi("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new yt(e)}b(e)?xt(this,mt(e)):xt(this,e)}function vt(e){return e.cloneNode(!0)}function _t(e){wt(e);for(var t=0,n=e.childNodes||[];t<n.length;t++)_t(n[t])}function bt(e,t,n,i){if(v(i))throw Xi("offargs","jqLite#off() does not support the `selector` argument");var r=$t(e,"events"),a=$t(e,"handle");a&&(y(t)?o(r,function(t,n){Wi(e,n,t),delete r[n]}):o(t.split(" "),function(t){y(n)?(Wi(e,t,r[t]),delete r[t]):L(r[t]||[],n)}))}function wt(e,t){var i=e[Hi],r=ji[i];if(r){if(t)return void delete ji[i].data[t];r.handle&&(r.events.$destroy&&r.handle({},"$destroy"),bt(e)),delete ji[i],e[Hi]=n}}function $t(e,t,n){var i=e[Hi],r=ji[i||-1];return v(n)?(r||(e[Hi]=i=pt(),r=ji[i]={}),void(r[t]=n)):r&&r[t]}function St(e,t,n){var i=$t(e,"data"),r=v(n),o=!r&&v(t),a=o&&!_(t);if(i||a||$t(e,"data",i={}),r)i[t]=n;else{if(!o)return i;if(a)return i&&i[t];p(i,t)}}function Ct(e,t){return e.getAttribute?(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1:!1}function kt(e,t){t&&e.setAttribute&&o(t.split(" "),function(t){e.setAttribute("class",Oi((" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+Oi(t)+" "," ")))})}function Mt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");o(t.split(" "),function(e){e=Oi(e),-1===n.indexOf(" "+e+" ")&&(n+=e+" ")}),e.setAttribute("class",Oi(n))}}function xt(e,t){if(t){t=t.nodeName||!v(t.length)||M(t)?[t]:t;for(var n=0;n<t.length;n++)e.push(t[n])}}function Tt(e,t){return Et(e,"$"+(t||"ngController")+"Controller")}function Et(e,t,i){e=Ti(e),9==e[0].nodeType&&(e=e.find("html"));for(var r=S(t)?t:[t];e.length;){for(var o=e[0],a=0,s=r.length;s>a;a++)if((i=e.data(r[a]))!==n)return i;e=Ti(o.parentNode||11===o.nodeType&&o.host)}}function At(e){for(var t=0,n=e.childNodes;t<n.length;t++)_t(n[t]);for(;e.firstChild;)e.removeChild(e.firstChild)}function Dt(e,t){var n=nr[t.toLowerCase()];return n&&ir[e.nodeName]&&n}function It(e,n){var i=function(i,r){if(i.preventDefault||(i.preventDefault=function(){i.returnValue=!1}),i.stopPropagation||(i.stopPropagation=function(){i.cancelBubble=!0}),i.target||(i.target=i.srcElement||t),y(i.defaultPrevented)){var a=i.preventDefault;i.preventDefault=function(){i.defaultPrevented=!0,a.call(i)},i.defaultPrevented=!1}i.isDefaultPrevented=function(){return i.defaultPrevented||i.returnValue===!1};var s=F(n[r||i.type]||[]);o(s,function(t){t.call(e,i)}),8>=xi?(i.preventDefault=null,i.stopPropagation=null,i.isDefaultPrevented=null):(delete i.preventDefault,delete i.stopPropagation,delete i.isDefaultPrevented)};return i.elem=e,i}function Pt(e){var t,i=typeof e;return"object"==i&&null!==e?"function"==typeof(t=e.$$hashKey)?t=e.$$hashKey():t===n&&(t=e.$$hashKey=l()):t=e,i+":"+t}function Nt(e){o(e,this.put,this)}function Lt(e){var t=e.toString().replace(sr,""),n=t.match(rr);return n?"function("+(n[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Bt(e,t,n){var i,r,a,s;if("function"==typeof e){if(!(i=e.$inject)){if(i=[],e.length){if(t)throw b(n)&&n||(n=e.name||Lt(e)),cr("strictdi","{0} is not using explicit annotation and cannot be invoked in strict mode",n);r=e.toString().replace(sr,""),a=r.match(rr),o(a[1].split(or),function(e){e.replace(ar,function(e,t,n){i.push(n)})})}e.$inject=i}}else S(e)?(s=e.length-1,ot(e[s],"fn"),i=e.slice(0,s)):ot(e,"fn",!0);return i}function Ft(e,t){function i(e){return function(t,n){return _(t)?void o(t,c(e)):e(t,n)}}function r(e,t){if(at(e,"service"),(C(t)||S(t))&&(t=k.instantiate(t)),!t.$get)throw cr("pget","Provider '{0}' must define $get factory method.",e);return $[e+y]=t}function a(e,t){return r(e,{$ge
un(n,this,e),this.$$path||(this.$$path="/"),this.$$compose()},this.$$compose=function(){var e=Z(this.$$search),t=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=cn(this.$$path)+(e?"?"+e:"")+t,this.$$absUrl=i+this.$$url.substr(1)},this.$$rewrite=function(r){var o,a;return(o=pn(e,r))!==n?(a=o,(o=pn(t,o))!==n?i+(pn("/",o)||o):e+a):(o=pn(i,r))!==n?i+o:i==r+"/"?i:void 0}}function mn(e,t){var n=fn(e);ln(e,this,e),this.$$parse=function(i){function r(e,t,n){var i,r=/^\/[A-Z]:(\/.*)/;return 0===t.indexOf(n)&&(t=t.replace(n,"")),r.exec(t)?e:(i=r.exec(e),i?i[1]:e)}var o=pn(e,i)||pn(n,i),a="#"==o.charAt(0)?pn(t,o):this.$$html5?o:"";if(!b(a))throw mr("ihshprfx",'Invalid url "{0}", missing hash prefix "{1}".',i,t);un(a,this,e),this.$$path=r(this.$$path,a,e),this.$$compose()},this.$$compose=function(){var n=Z(this.$$search),i=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=cn(this.$$path)+(n?"?"+n:"")+i,this.$$absUrl=e+(this.$$url?t+this.$$url:"")},this.$$rewrite=function(t){return dn(e)==dn(t)?t:void 0}}function yn(e,t){this.$$html5=!0,mn.apply(this,arguments);var n=fn(e);this.$$rewrite=function(i){var r;return e==dn(i)?i:(r=pn(n,i))?e+t+r:n===i+"/"?n:void 0},this.$$compose=function(){var n=Z(this.$$search),i=this.$$hash?"#"+Y(this.$$hash):"";this.$$url=cn(this.$$path)+(n?"?"+n:"")+i,this.$$absUrl=e+t+this.$$url}}function vn(e){return function(){return this[e]}}function _n(e,t){return function(n){return y(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function bn(){var t="",n=!1;this.hashPrefix=function(e){return v(e)?(t=e,this):t},this.html5Mode=function(e){return v(e)?(n=e,this):n},this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(i,r,o,a){function s(e){i.$broadcast("$locationChangeSuccess",c.absUrl(),e)}var c,l,u,p=r.baseHref(),d=r.url();n?(u=hn(d)+(p||"/"),l=o.history?gn:yn):(u=dn(d),l=mn),c=new l(u,"#"+t),c.$$parse(c.$$rewrite(d)),a.on("click",function(n){if(!n.ctrlKey&&!n.metaKey&&2!=n.which){for(var o=Ti(n.target);"a"!==$i(o[0].nodeName);)if(o[0]===a[0]||!(o=o.parent())[0])return;var s=o.prop("href");if(_(s)&&"[object SVGAnimatedString]"===s.toString()&&(s=jn(s.animVal).href),l===yn){var p=o.attr("href")||o.attr("xlink:href");if(p.indexOf("://")<0){var d="#"+t;if("/"==p[0])s=u+d+p;else if("#"==p[0])s=u+d+(c.path()||"/")+p;else{for(var f=c.path().split("/"),h=p.split("/"),g=0;g<h.length;g++)"."!=h[g]&&(".."==h[g]?f.pop():h[g].length&&f.push(h[g]));s=u+d+f.join("/")}}}var m=c.$$rewrite(s);s&&!o.attr("target")&&m&&!n.isDefaultPrevented()&&(n.preventDefault(),m!=r.url()&&(c.$$parse(m),i.$apply(),e.angular["ff-684208-preventDefault"]=!0))}}),c.absUrl()!=d&&r.url(c.absUrl(),!0),r.onUrlChange(function(e){c.absUrl()!=e&&(i.$evalAsync(function(){var t=c.absUrl();c.$$parse(e),i.$broadcast("$locationChangeStart",e,t).defaultPrevented?(c.$$parse(t),r.url(t)):s(t)}),i.$$phase||i.$digest())});var f=0;return i.$watch(function(){var e=r.url(),t=c.$$replace;return f&&e==c.absUrl()||(f++,i.$evalAsync(function(){i.$broadcast("$locationChangeStart",c.absUrl(),e).defaultPrevented?c.$$parse(e):(r.url(c.absUrl(),t),s(e))})),c.$$replace=!1,f}),c}]}function wn(){var e=!0,t=this;this.debugEnabled=function(t){return v(t)?(e=t,this):e},this.$get=["$window",function(n){function i(e){return e instanceof Error&&(e.stack?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function r(e){var t=n.console||{},r=t[e]||t.log||h,a=!1;try{a=!!r.apply}catch(s){}return a?function(){var e=[];return o(arguments,function(t){e.push(i(t))}),r.apply(t,e)}:function(e,t){r(e,null==t?"":t)}}return{log:r("log"),info:r("info"),warn:r("warn"),error:r("error"),debug:function(){var n=r("debug");return function(){e&&n.apply(t,arguments)}}()}}]}function $n(e,t){if("constructor"===e)throw vr("isecfld",'Referencing "constructor" field in Angular expressions is disallowed! Expression: {0}',t);return e}function Sn(e,t){if(e){if(e.constructor===e)throw vr("isecfn","Referencing Function in Angular expressions is disallowed! Expression: {0}",t);if(e.document&&e.location&&e.alert&&e.se
}),t}return e}return{restrict:"AC",link:function(a,s,c){function l(e){var t=p(e,1);c.$addClass(t)}function u(e){var t=p(e,-1);c.$removeClass(t)}function p(e,t){var n=s.data("$classCounts")||{},i=[];return o(e,function(e){(t>0||n[e])&&(n[e]=(n[e]||0)+t,n[e]===+(t>0)&&i.push(e))}),s.data("$classCounts",n),i.join(" ")}function d(e,t){var r=i(t,e),o=i(e,t);o=p(o,-1),r=p(r,1),0===r.length?n.removeClass(s,o):0===o.length?n.addClass(s,r):n.setClass(s,r,o)}function f(e){if(t===!0||a.$index%2===t){var n=r(e||[]);if(h){if(!O(e,h)){var i=r(h);d(i,n)}}else l(n)}h=B(e)}var h;a.$watch(c[e],f,!0),c.$observe("class",function(){f(a.$eval(c[e]))}),"ngClass"!==e&&a.$watch("$index",function(n,i){var o=1&n;if(o!==i&1){var s=r(a.$eval(c[e]));o===t?l(s):u(s)}})}}}]}var $i=function(e){return b(e)?e.toLowerCase():e},Si=Object.prototype.hasOwnProperty,Ci=function(e){return b(e)?e.toUpperCase():e},ki=function(e){return b(e)?e.replace(/[A-Z]/g,function(e){return String.fromCharCode(32|e.charCodeAt(0))}):e},Mi=function(e){return b(e)?e.replace(/[a-z]/g,function(e){return String.fromCharCode(-33&e.charCodeAt(0))}):e};"i"!=="I".toLowerCase()&&($i=ki,Ci=Mi);var xi,Ti,Ei,Ai,Di,Ii=[].slice,Pi=[].push,Ni=Object.prototype.toString,Li=i("ng"),Bi=e.angular||(e.angular={}),Fi=["0","0","0"];xi=d((/msie (\d+)/.exec($i(navigator.userAgent))||[])[1]),isNaN(xi)&&(xi=d((/trident\/.*; rv:(\d+)/.exec($i(navigator.userAgent))||[])[1])),h.$inject=[],g.$inject=[];var Oi=function(){return String.prototype.trim?function(e){return b(e)?e.trim():e}:function(e){return b(e)?e.replace(/^\s\s*/,"").replace(/\s\s*$/,""):e}}();Di=9>xi?function(e){return e=e.nodeName?e:e[0],e.scopeName&&"HTML"!=e.scopeName?Ci(e.scopeName+":"+e.nodeName):e.nodeName}:function(e){return e.nodeName?e.nodeName:e[0].nodeName};var Ui=["ng-","data-ng-","ng:","x-ng-"],Ri=/[A-Z]/g,qi={full:"1.3.0-beta.8",major:1,minor:3,dot:0,codeName:"accidental-haiku"},ji=yt.cache={},Hi=yt.expando="ng-"+(new Date).getTime(),Vi=1,zi=e.document.addEventListener?function(e,t,n){e.addEventListener(t,n,!1)}:function(e,t,n){e.attachEvent("on"+t,n)},Wi=e.document.removeEventListener?function(e,t,n){e.removeEventListener(t,n,!1)}:function(e,t,n){e.detachEvent("on"+t,n)},Gi=(yt._data=function(e){return this.cache[e[this.expando]]||{}},/([\:\-\_]+(.))/g),Ki=/^moz([A-Z])/,Xi=i("jqLite"),Zi=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Yi=/<|&#?\w+;/,Qi=/<([\w:]+)/,Ji=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,er={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};er.optgroup=er.option,er.tbody=er.tfoot=er.colgroup=er.caption=er.thead,er.th=er.td;var tr=yt.prototype={ready:function(n){function i(){r||(r=!0,n())}var r=!1;"complete"===t.readyState?setTimeout(i):(this.on("DOMContentLoaded",i),yt(e).on("load",i))},toString:function(){var e=[];return o(this,function(t){e.push(""+t)}),"["+e.join(", ")+"]"},eq:function(e){return Ti(e>=0?this[e]:this[this.length+e])},length:0,push:Pi,sort:[].sort,splice:[].splice},nr={};o("multiple,selected,checked,disabled,readOnly,required,open".split(","),function(e){nr[$i(e)]=e});var ir={};o("input,select,option,textarea,button,form,details".split(","),function(e){ir[Ci(e)]=!0}),o({data:St,inheritedData:Et,scope:function(e){return Ti(e).data("$scope")||Et(e.parentNode||e,["$isolateScope","$scope"])},isolateScope:function(e){return Ti(e).data("$isolateScope")||Ti(e).data("$isolateScopeNoTemplate")},controller:Tt,injector:function(e){return Et(e,"$injector")},removeAttr:function(e,t){e.removeAttribute(t)},hasClass:Ct,css:function(e,t,i){if(t=dt(t),!v(i)){var r;return 8>=xi&&(r=e.currentStyle&&e.currentStyle[t],""===r&&(r="auto")),r=r||e.style[t],8>=xi&&(r=""===r?n:r),r}e.style[t]=i},attr:function(e,t,i){var r=$i(t);if(nr[r]){if(!v(i))return e[t]||(e.attributes.getNamedItem(t)||h).specified?r:n;i?(e[t]=!0,e.setAttribute(t,r)):(e[t]=!1,e.removeAttribute(r))}else if(v(i))e.setAttribute(t,i);else if(
a(E)!=h&&n.move(ct(E.clone),null,Ti(D)),D=s(E)}else _=i.$new();_[w]=C,$&&(_[$]=b),_.$index=p,_.$first=0===p,_.$last=p===g-1,_.$middle=!(_.$first||_.$last),_.$odd=!(_.$even=0===(1&p)),E.scope||f(_,function(e){e[e.length++]=t.createComment(" end ngRepeat: "+S+" "),n.enter(e,null,Ti(D)),D=e,E.scope=_,E.clone=e,I[E.id]=E})}M=I})}}}],xo=["$animate",function(e){return function(t,n,i){t.$watch(i.ngShow,function(t){e[W(t)?"removeClass":"addClass"](n,"ng-hide")})}}],To=["$animate",function(e){return function(t,n,i){t.$watch(i.ngHide,function(t){e[W(t)?"addClass":"removeClass"](n,"ng-hide")})}}],Eo=ci(function(e,t,n){e.$watch(n.ngStyle,function(e,n){n&&e!==n&&o(n,function(e,n){t.css(n,"")}),e&&t.css(e)},!0)}),Ao=["$animate",function(e){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(t,n,i,r){var a=i.ngSwitch||i.on,s=[],c=[],l=[],u=[];t.$watch(a,function(n){var a,p;for(a=0,p=l.length;p>a;++a)l[a].remove();for(l.length=0,a=0,p=u.length;p>a;++a){var d=c[a];u[a].$destroy(),l[a]=d,e.leave(d,function(){l.splice(a,1)})}c.length=0,u.length=0,(s=r.cases["!"+n]||r.cases["?"])&&(t.$eval(i.change),o(s,function(n){var i=t.$new();u.push(i),n.transclude(i,function(t){var i=n.element;c.push(t),e.enter(t,i.parent(),i)})}))})}}}],Do=ci({transclude:"element",priority:800,require:"^ngSwitch",link:function(e,t,n,i,r){i.cases["!"+n.ngSwitchWhen]=i.cases["!"+n.ngSwitchWhen]||[],i.cases["!"+n.ngSwitchWhen].push({transclude:r,element:t})}}),Io=ci({transclude:"element",priority:800,require:"^ngSwitch",link:function(e,t,n,i,r){i.cases["?"]=i.cases["?"]||[],i.cases["?"].push({transclude:r,element:t})}}),Po=ci({link:function(e,t,n,r,o){if(!o)throw i("ngTransclude")("orphan","Illegal use of ngTransclude directive in the template! No parent directive that requires a transclusion found. Element: {0}",G(t));o(function(e){t.empty(),t.append(e)})}}),No=["$templateCache",function(e){return{restrict:"E",terminal:!0,compile:function(t,n){if("text/ng-template"==n.type){var i=n.id,r=t[0].text;e.put(i,r)}}}}],Lo=i("ngOptions"),Bo=m({terminal:!0}),Fo=["$compile","$parse",function(e,i){var r=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,s={$setViewValue:h};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(e,t,n){var i,r,o=this,a={},c=s;o.databound=n.ngModel,o.init=function(e,t,n){c=e,i=t,r=n},o.addOption=function(t){at(t,'"option value"'),a[t]=!0,c.$viewValue==t&&(e.val(t),r.parent()&&r.remove())},o.removeOption=function(e){this.hasOption(e)&&(delete a[e],c.$viewValue==e&&this.renderUnknownOption(e))},o.renderUnknownOption=function(t){var n="? "+Pt(t)+" ?";r.val(n),e.prepend(r),e.val(n),r.prop("selected",!0)},o.hasOption=function(e){return a.hasOwnProperty(e)},t.$on("$destroy",function(){o.renderUnknownOption=h})}],link:function(s,c,l,u){function p(e,t,n,i){n.$render=function(){var e=n.$viewValue;i.hasOption(e)?(k.parent()&&k.remove(),t.val(e),""===e&&h.prop("selected",!0)):y(e)&&h?t.val(""):i.renderUnknownOption(e)},t.on("change",function(){e.$apply(function(){k.parent()&&k.remove(),n.$setViewValue(t.val())})})}function d(e,t,n){var i;n.$render=function(){var e=new Nt(n.$viewValue);o(t.find("option"),function(t){t.selected=v(e.get(t.value))})},e.$watch(function(){O(i,n.$viewValue)||(i=B(n.$viewValue),n.$render())}),t.on("change",function(){e.$apply(function(){var e=[];o(t.find("option"),function(t){t.selected&&e.push(t.value)}),n.$setViewValue(e)})})}function f(t,o,s){function c(){var e,n,i,r,c,l,m,b,M,x,T,E,A,D,I,P={"":[]},N=[""],L=s.$modelValue,B=g(t)||[],F=d?a(B):B,O={},U=!1;if(_)if(y&&S(L)){U=new Nt([]);for(var R=0;R<L.length;R++)O[p]=L[R],U.put(y(t,O),L[R])}else U=new Nt(L);for(T=0;M=F.length,M>T;T++){if(m=T,d){if(m=F[T],"$"===m.charAt(0))continue;O[d]=m}if(O[p]=B[m],e=f(t,O)||"",(n=P[e])||(n=P[e]=[],N.push(e)),_)E=v(U.remove(y?y(t,O):h(t,O)));else{if(y){var q={};q[p]=L,E=y(t,q)===y(t,O)}else E=L===h(t,O);U=U||E
},remove:function(t){for(var n=-1,i=0;i<e.length;i++)if(t==e[i].key){n=i;break}return e.splice(n,1)[0]},removeTop:function(){return e.splice(e.length-1,1)[0]},length:function(){return e.length}}}}}).directive("modalBackdrop",["$timeout",function(e){return{restrict:"EA",replace:!0,templateUrl:"template/modal/backdrop.html",link:function(t){t.animate=!1,e(function(){t.animate=!0})}}}]).directive("modalWindow",["$modalStack","$timeout",function(e,t){return{restrict:"EA",scope:{index:"@",animate:"=",nav:"="},replace:!0,transclude:!0,templateUrl:"template/modal/window.html",link:function(n,i,r){n.windowClass=r.windowClass||"",t(function(){n.animate=!0,i[0].focus()}),n.close=function(t){var n=e.getTop();n&&n.value.backdrop&&"static"!=n.value.backdrop&&t.target===t.currentTarget&&(t.preventDefault(),t.stopPropagation(),e.dismiss(n.key,"backdrop click"))}}}}]).factory("$modalStack",["$transition","$timeout","$document","$compile","$rootScope","$$stackedMap",function(e,t,n,i,r,o){function a(){for(var e=-1,t=f.keys(),n=0;n<t.length;n++)f.get(t[n]).value.backdrop&&(e=n);return e}function s(e){var t=n.find("body").eq(0),i=f.get(e).value;f.remove(e),l(i.modalDomEl,i.modalScope,0,c),t.toggleClass(d,f.length()>0)}function c(){if(u&&-1==a()){var e=p;l(u,p,0,function(){e.$destroy(),e=null}),u=void 0,p=void 0}}function l(n,i,r,o){function a(){a.done||(a.done=!0,n.remove(),o&&o())}i.animate=!1;var s=e.transitionEndEventName;if(s){var c=t(a,r);n.bind(s,function(){t.cancel(c),a(),i.$apply()})}else t(a,0)}var u,p,d="modal-open",f=o.createNew(),h={};return r.$watch(a,function(e){p&&(p.index=e)}),n.bind("keydown",function(e){var t;27===e.which&&(t=f.top(),t&&t.value.keyboard&&r.$apply(function(){h.dismiss(t.key)}))}),h.open=function(e,t){f.add(e,{deferred:t.deferred,modalScope:t.scope,backdrop:t.backdrop,keyboard:t.keyboard});var o=n.find("body").eq(0),s=a();s>=0&&!u&&(p=r.$new(!0),p.index=s,u=i("<div modal-backdrop></div>")(p),o.append(u));var c=angular.element("<div modal-window></div>");c.attr("window-class",t.windowClass),c.attr("index",f.length()-1),c.attr("animate","animate"),c.attr("nav","nav"),c.html(t.content);var l=i(c)(t.scope);f.top().value.modalDomEl=l,o.append(l),o.addClass(d)},h.close=function(e,t){var n=f.get(e).value;n&&(n.deferred.resolve(t),s(e))},h.dismiss=function(e,t){var n=f.get(e).value;n&&(n.deferred.reject(t),s(e))},h.dismissAll=function(e){for(var t=this.getTop();t;)this.dismiss(t.key,e),t=this.getTop()},h.getTop=function(){return f.top()},h}]).provider("$modal",function(){var e={options:{backdrop:!0,keyboard:!0},$get:["$injector","$rootScope","$q","$http","$templateCache","$controller","$modalStack",function(t,n,i,r,o,a,s){function c(e){return e.template?i.when(e.template):r.get(e.templateUrl,{cache:o}).then(function(e){return e.data})}function l(e){var n=[];return angular.forEach(e,function(e){(angular.isFunction(e)||angular.isArray(e))&&n.push(i.when(t.invoke(e)))}),n}var u={};return u.open=function(t){var r=i.defer(),o=i.defer(),u={result:r.promise,opened:o.promise,close:function(e){s.close(u,e)},dismiss:function(e){s.dismiss(u,e)}};if(t=angular.extend({},e.options,t),t.resolve=t.resolve||{},!t.template&&!t.templateUrl)throw new Error("One of template or templateUrl options is required.");var p=i.all([c(t)].concat(l(t.resolve)));return p.then(function(e){var i=(t.scope||n).$new();i.$close=u.close,i.$dismiss=u.dismiss;var o,c={},l=1;t.controller&&(c.$scope=i,c.$modalInstance=u,angular.forEach(t.resolve,function(t,n){c[n]=e[l++]}),o=a(t.controller,c)),s.open(u,{scope:i,deferred:r,content:e[0],backdrop:t.backdrop,keyboard:t.keyboard,windowClass:t.windowClass})},function(e){r.reject(e)}),p.then(function(){o.resolve(!0)},function(){o.reject(!1)}),u},u}]};return e}),angular.module("ui.bootstrap.position",[]).factory("$position",["$document","$window",function(e,t){function n(e,n){return e.currentStyle?e.currentStyle[n]:t.getComputedStyle?t.getComputedStyle(e)[n]:e.style[n]}function i(e){return"static"===(n(e,"position")||"static")}var r=function(t){for(var n=e[0],r=t.offsetParent||n;r&&r!==n&&i(r);)r=r.offsetParent;ret
}return e.prototype.get=function(e){return e<<=2,this.bytes[e]*s+(this.bytes[e+1]<<16|this.bytes[e+2]<<8|this.bytes[e+3])},e.prototype.set=function(e,t){var n=Math.floor(t/s),i=t-n*s;e<<=2,this.bytes[e]=n,this.bytes[e+1]=i>>16,this.bytes[e+2]=i>>8&255,this.bytes[e+3]=255&i},e}();e.hash=a}(sha1||(sha1={})),function(){"use strict";function e(e){throw e}function t(e,t){var n=e.split("."),i=p;!(n[0]in i)&&i.execScript&&i.execScript("var "+n[0]);for(var r;n.length&&(r=n.shift());)n.length||t===u?i=i[r]?i[r]:i[r]={}:i[r]=t}function n(e,t,n){var i,r="number"==typeof t?t:t=0,o="number"==typeof n?n:e.length;for(i=-1,r=7&o;r--;++t)i=i>>>8^y[255&(i^e[t])];for(r=o>>3;r--;t+=8)i=i>>>8^y[255&(i^e[t])],i=i>>>8^y[255&(i^e[t+1])],i=i>>>8^y[255&(i^e[t+2])],i=i>>>8^y[255&(i^e[t+3])],i=i>>>8^y[255&(i^e[t+4])],i=i>>>8^y[255&(i^e[t+5])],i=i>>>8^y[255&(i^e[t+6])],i=i>>>8^y[255&(i^e[t+7])];return(4294967295^i)>>>0}function i(){}function r(e){var t,n,i,r,o,a,s,c,l,u=e.length,p=0,f=Number.POSITIVE_INFINITY;for(c=0;u>c;++c)e[c]>p&&(p=e[c]),e[c]<f&&(f=e[c]);for(t=1<<p,n=new(d?Uint32Array:Array)(t),i=1,r=0,o=2;p>=i;){for(c=0;u>c;++c)if(e[c]===i){for(a=0,s=r,l=0;i>l;++l)a=a<<1|1&s,s>>=1;for(l=a;t>l;l+=o)n[l]=i<<16|c;++r}++i,r<<=1,o<<=1}return[n,p,f]}function o(t,n){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=d?new Uint8Array(t):t,this.o=!1,this.k=$,this.w=!1,(n||!(n={}))&&(n.index&&(this.c=n.index),n.bufferSize&&(this.j=n.bufferSize),n.bufferType&&(this.k=n.bufferType),n.resize&&(this.w=n.resize)),this.k){case w:this.a=32768,this.b=new(d?Uint8Array:Array)(32768+this.j+258);break;case $:this.a=0,this.b=new(d?Uint8Array:Array)(this.j),this.e=this.D,this.q=this.A,this.l=this.C;break;default:e(Error("invalid inflate mode"))}}function a(t,n){for(var i,r=t.f,o=t.d,a=t.input,s=t.c;n>o;)i=a[s++],i===u&&e(Error("input buffer is broken")),r|=i<<o,o+=8;return i=r&(1<<n)-1,t.f=r>>>n,t.d=o-n,t.c=s,i}function s(e,t){for(var n,i,r,o=e.f,a=e.d,s=e.input,c=e.c,l=t[0],p=t[1];p>a&&(n=s[c++],n!==u);)o|=n<<a,a+=8;return i=l[o&(1<<p)-1],r=i>>>16,e.f=o>>r,e.d=a-r,e.c=c,65535&i}function c(e){function t(e,t,n){var i,r,o,c;for(c=0;e>c;)switch(i=s(this,t)){case 16:for(o=3+a(this,2);o--;)n[c++]=r;break;case 17:for(o=3+a(this,3);o--;)n[c++]=0;r=0;break;case 18:for(o=11+a(this,7);o--;)n[c++]=0;r=0;break;default:r=n[c++]=i}return n}var n,i,o,c,l=a(e,5)+257,u=a(e,5)+1,p=a(e,4)+4,f=new(d?Uint8Array:Array)(M.length);for(c=0;p>c;++c)f[M[c]]=a(e,3);n=r(f),i=new(d?Uint8Array:Array)(l),o=new(d?Uint8Array:Array)(u),e.l(r(t.call(e,l,n,i)),r(t.call(e,u,n,o)))}function l(e){this.input=e,this.c=0,this.m=[],this.s=!1}var u=void 0,p=this,d="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array;new(d?Uint8Array:Array)(256);var f;for(f=0;256>f;++f)for(var h=f,g=7,h=h>>>1;h;h>>>=1)--g;var m=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,
},t.file?t.file(function(t){e.write(t)},function(e){i.reject(e)}):e.write(t instanceof Blob?t:new Blob([bytesToArrayBuffer(t)])),i.promise}function o(t,i,r){if(!e.chrome||!chrome.fileSystem||!chrome.fileSystem.chooseEntry)return n.reject();var o=n.defer();return chrome.fileSystem.chooseEntry({type:"saveFile",suggestedName:t,accepts:[{mimeTypes:[r],extensions:[i]}]},function(e){o.resolve(e)}),o.promise}function a(e){var t=n.defer();return e.createWriter(function(e){t.resolve(e)},function(e){t.reject(e)}),t.promise}function s(e,n){var i=[],r={write:function(e){i.push(e),t(function(){r.onwriteend&&r.onwriteend()})},truncate:function(){i=[]},finalize:function(){var t;try{t=new Blob(i,{type:e})}catch(r){var o=new BlobBuilder;angular.forEach(i,function(e){o.append(e)}),t=o.getBlob(e)}return n&&n(t),t}};return r}function c(e,t){return void 0!==e.toURL?e.toURL(t):e instanceof Blob?URL.createObjectURL(e):"data:"+t+";base64,"+bytesToBase64(e)}function l(e,n,i){var r=$("<a>Download</a>").css({position:"absolute",top:1,left:1}).attr("href",e).attr("target","_blank").attr("download",i).appendTo("body");r[0].dataset.downloadurl=[n,i,e].join(":"),r[0].click(),t(function(){r.remove()},100)}return e.URL=e.URL||e.webkitURL,e.BlobBuilder=e.BlobBuilder||e.WebKitBlobBuilder||e.MozBlobBuilder,{copy:i,write:r,getFileWriter:a,getFakeFileWriter:s,chooseSave:o,getUrl:c,download:l}}]).service("IdbFileStorage",["$q","$window","FileManager",function(e,t,n){function i(){return d}function r(){if(c)return c;try{var t=indexedDB.open(l,p),n=e.defer(),i=function(e){e.createObjectStore(u)}}catch(r){return d=!1,e.reject(r)}return t.onsuccess=function(){db=t.result,db.onerror=function(e){d=!1,console.error("Error creating/accessing IndexedDB database",e),n.reject(e)},db.setVersion&&db.version!=p?db.setVersion(p).onsuccess=function(){i(db),n.resolve(db)}:n.resolve(db)},t.onerror=function(e){d=!1,console.error("Error creating/accessing IndexedDB database",e),n.reject(e)},t.onupgradeneeded=function(e){i(e.target.result)},c=n.promise}function o(t,n){return r().then(function(i){try{var r=e.defer(),o=i.transaction([u],IDBTransaction.READ_WRITE||"readwrite").objectStore(u),a=o.put(n,t)}catch(s){return d=!1,e.reject(s)}return a.onsuccess=function(){r.resolve(n)},a.onerror=function(e){r.reject(e)},r.promise})}function a(t){return r().then(function(n){var i=e.defer(),r=n.transaction([u],IDBTransaction.READ||"readonly").objectStore(u),o=r.get(t);return o.onsuccess=function(e){void 0===e.target.result?i.reject():i.resolve(e.target.result)},o.onerror=function(e){i.reject(e)},i.promise})}function s(t,i){var r=n.getFakeFileWriter(i,function(e){o(t,e)});return e.when(r)}t.indexedDB=t.indexedDB||t.webkitIndexedDB||t.mozIndexedDB||t.OIndexedDB||t.msIndexedDB,t.IDBTransaction=t.IDBTransaction||t.webkitIDBTransaction||t.OIDBTransaction||t.msIDBTransaction;var c,l="cachedFiles",u="files",p=1,d=void 0!==t.indexedDB&&void 0!==t.IDBTransaction;return r(),{isAvailable:i,saveFile:o,getFile:a,getFileWriter:s}}]).service("TmpfsFileStorage",["$q","$window","FileManager",function(e,t,n){function i(){if(c)return c;if(!t.requestFileSystem)return c=e.reject({type:"FS_BROWSER_UNSUPPORTED",description:"requestFileSystem not present"});var n=e.defer();return t.requestFileSystem(t.TEMPORARY,5242880,function(e){cachedFs=e,n.resolve()},function(e){l=!1,n.reject(e)}),c=n.promise}function r(){return l}function o(t,n){return n=n||1,i().then(function(){var i=e.defer();return cachedFs.root.getFile(t,{create:!1},function(e){e.file(function(t){t.size>=n?i.resolve(e):i.reject(new Error("FILE_NOT_FOUND"))},function(e){console.log(dT(),"error",e),i.reject(e)})},function(){i.reject(new Error("FILE_NOT_FOUND"))}),i.promise})}function a(e,t){return s(e).then(function(e){return n.write(e,t).then(function(){return e.finalize()})})}function s(t){return i().then(function(){var i=e.defer();return cachedFs.root.getFile(t,{create:!0},function(e){n.getFileWriter(e).then(function(t){t.finalize=function(){return e},i.resolve(t)},function(e){i.reject(e)})},function(e){i.reject(e)}),i.promise})}t.requestFileSystem=t.req
return r.push({cb:n,deferred:o,activeDelta:i}),s(e),o.promise}function s(e){var t=_[e];if(b[e]>=w||!t||!t.length)return!1;var n=t.shift(),i=n.activeDelta||1;b[e]+=i;$++;n.cb().then(function(t){b[e]-=i,s(e),n.deferred.resolve(t)},function(t){b[e]-=i,s(e),n.deferred.reject(t)})}function c(e){switch(e._){case"inputVideoFileLocation":return"video"+e.id+".mp4";case"inputDocumentFileLocation":return"doc"+e.id;case"inputAudioFileLocation":return"audio"+e.id}return e.volume_id||console.trace("Empty location",e),e.volume_id+"_"+e.local_id+"_"+e.secret+".jpg"}function l(e){if(!e)return!1;var t=c(e);return v[t]||!1}function u(){return r.isAvailable()?r:i.isAvailable()?i:o}function p(e,t){var i=c(e),r="image/jpeg";return m[i]||(m[i]=u().saveFile(i,t).then(function(e){return v[i]=n.getUrl(e,r)})),m[i]}function d(t){var i=c(t),r="image/jpeg",o=m[i]||y[i];if(o)return o;var s=u();return y[i]=s.getFile(i).then(function(e){return v[i]=n.getUrl(e,r)},function(){var o=a(t.dc_id,function(){return e.invokeApi("upload.getFile",{location:angular.extend({},t,{_:"inputFileLocation"}),offset:0,limit:0},{dcID:t.dc_id,fileDownload:!0,createNetworker:!0})});return s.getFileWriter(i,r).then(function(e){return o.then(function(t){return n.write(e,t.bytes).then(function(){return v[i]=n.getUrl(e.finalize(),r)})})})})}function f(i,r,o,s){s=s||{};var l=c(r),p=s.toFileEntry||null,d=m[l]||y[l],f=u();if(d)return p?d.then(function(){return f.getFile(l).then(function(e){return n.copy(e,p)})}):d;var h,g=t.defer(),_=!1,b=!1,w=s.mime||"image/jpeg",$=function(e){g.reject(e),$=angular.noop,h&&h.truncate(0)};return f.getFile(l).then(function(e){p?n.copy(e,p).then(function(){g.resolve()},$):g.resolve(v[l]=n.getUrl(e,w))},function(){var s=p?n.getFileWriter(p):f.getFileWriter(l,w);s.then(function(s){h=s;for(var c,u=524288,d=t.when(),f=0;o>f;f+=u)c=t.defer(),function(c,d,f,h){return a(i,function(){return _?t.when():e.invokeApi("upload.getFile",{location:r,offset:d,limit:u},{dcID:i,fileDownload:!0,createNetworker:!0})},6).then(function(e){h.then(function(){return _?t.when():n.write(s,e.bytes).then(function(){f.resolve()},$).then(function(){c?(b=!0,p?g.resolve():g.resolve(v[l]=n.getUrl(s.finalize(),w))):g.notify({done:d+u,total:o})})})})}(f+u>=o,f,c,d),d=c.promise})}),g.promise.cancel=function(){_||b||(_=!0,delete y[l],$({type:"DOWNLOAD_CANCELED"}))},p||(y[l]=g.promise),g.promise}function h(n){var i=n.size,r=i>102400?524288:32768,o=i>=10485760,a=Math.ceil(i/r),s=!1,c=!1,l=0;if(a>1500)return t.reject({type:"FILE_TOO_BIG"});var u,p=[nextRandomInt(4294967295),nextRandomInt(4294967295)],d=t.defer(),f=function(e){d.reject(e),f=angular.noop},h=0,m={_:o?"inputFileBig":"inputFile",id:p,parts:a,name:n.name,md5_checksum:""},y=t.when();for(u=0;i>u;u+=r)!function(u,h){y=y.then(function(){var y=t.defer(),v=new FileReader,_=n.slice(u,u+r);return v.onloadend=function(t){if(!s&&t.target.readyState==FileReader.DONE){var n=g=g.then(function(){return e.invokeApi(o?"upload.saveBigFilePart":"upload.saveFilePart",{file_id:p,file_part:h,file_total_parts:a,bytes:bytesFromArrayBuffer(t.target.result)},{startMaxLength:r+256,fileUpload:!0})},f);n.then(function(){l++,y.resolve(),l>=a?(d.resolve(m),c=!0):(console.log(dT(),"Progress",l*r/i),d.notify({done:l*r,total:i}))},f)}},v.readAsArrayBuffer(_),y.promise})}(u,h++);return d.promise.cancel=function(){console.log("cancel upload",s,c),s||c||(s=!0,f({type:"UPLOAD_CANCELED"}))},d.promise}var g=t.when(),m={},y={},v={},_={},b={},w=5,$=0;return{getCachedFile:l,downloadFile:f,downloadSmallFile:d,saveSmallFile:p,uploadFile:h}}]),angular.module("myApp",["ngRoute","ngSanitize","ngTouch","ui.bootstrap","pasvaz.bindonce","izhukov.utils","izhukov.mtproto","izhukov.mtproto.wrapper","myApp.filters","myApp.services","myApp.templates","myApp.directives","myApp.controllers"]).config(["$locationProvider","$routeProvider","$compileProvider","StorageProvider",function(e,t,n,i){var r,o,a,s,c,l,u,p={},d={};for(o=0;o<Config.EmojiCategories.length;o++)for(u=Config.EmojiCategorySpritesheetDimens[o][1],r=0;r<Config.EmojiCategories[o].length;r++)s=Config.Emoji[Config.EmojiCatego
for(var t=[],n=0;n<e.photos.length;n++)c(e.photos[n]),t.push(e.photos[n].id);return{count:e.count||e.photos.length,photos:t}})}function p(e){if(y[e]){var n=y[e],i=$(window).width()-36,r=$(t).height()-150,a=l(n,i,r);a&&!a.preloaded&&(a.preloaded=!0,a.size?o.downloadFile(a.location.dc_id,{_:"inputFileLocation",volume_id:a.location.volume_id,local_id:a.location.local_id,secret:a.location.secret},a.size):o.downloadSmallFile(a.location))}}function d(e){return y[e]||{_:"photoEmpty"}}function f(e){var t=angular.copy(y[e])||{_:"photoEmpty"},n=260,i=260,r=l(t,n,i),o={placeholder:"img/placeholders/PhotoThumbConversation.gif",width:n,height:i};return r&&"photoSizeEmpty"!=r._?(r.w>r.h?o.height=parseInt(r.h*n/r.w):o.width=parseInt(r.w*i/r.h),o.location=r.location,o.size=r.size):(o.width=100,o.height=100),t.thumb=o,t}function h(e){var n=f(e),i=$(window).width()-(Config.Navigator.mobile?20:36),r=$(t).height()-150,o=l(n,i,r),s={placeholder:"img/placeholders/PhotoThumbModal.gif"};return i>800&&(i-=200),s.width=i,s.height=r,o&&"photoSizeEmpty"!=o._&&(o.w/o.h>i/r?s.height=parseInt(o.h*i/o.w):(s.width=parseInt(o.w*r/o.h),s.width>i&&(s.height=parseInt(s.height*i/s.width),s.width=i)),!Config.Navigator.mobile&&s.width>=o.w&&s.height>=o.h&&(s.width=o.w,s.height=o.h),s.modalWidth=Math.max(s.width,Math.min(400,i)),s.location=o.location,s.size=o.size),n.full=s,n.fromUser=a.getUser(n.user_id),n}function g(t,n){if(!t||"0"===t)return!1;var r=i.$new(!0);r.photoID=t,0>n?r.userID=-n:r.messageID=n;e.open({templateUrl:"partials/photo_modal.html",controller:r.userID?"UserpicModalController":"PhotoModalController",scope:r,windowClass:"photo_modal_window"})}function m(e){var n=y[e],i="jpg",r="image/jpeg",a="photo"+e+"."+i,c=$(window).width()-36,u=$(t).height()-150,p=l(n,c,u),d={_:"inputFileLocation",volume_id:p.location.volume_id,local_id:p.location.local_id,secret:p.location.secret};s.chooseSave(a,i,r).then(function(e){o.downloadFile(p.location.dc_id,d,p.size,{mime:r,toFileEntry:e}).then(function(){console.log("file save done")},function(e){console.log("photo download failed",e)})},function(){o.downloadFile(p.location.dc_id,d,p.size,{mime:r}).then(function(e){s.download(e,r,a)},function(e){console.log("photo download failed",e)})})}var y={};return i.preloadPhoto=p,i.openPhoto=g,{savePhoto:c,preloadPhoto:p,getUserPhotos:u,getPhoto:d,wrapForHistory:f,wrapForFull:h,openPhoto:g,downloadPhoto:m}}]).service("AppVideoManager",["$rootScope","$modal","$window","$timeout","MtpApiFileManager","AppUsersManager","FileManager",function(e,t,n,i,r,o,a){function s(e){d[e.id]=e,e.thumb&&"photoCachedSize"==e.thumb._&&(r.saveSmallFile(e.thumb.location,e.thumb.bytes),e.thumb.size=e.thumb.bytes.length,delete e.thumb.bytes,e.thumb._="photoSize")}function c(e){if(void 0!==f[e])return f[e];var t=angular.copy(d[e]),n=200,i=200,r=t.thumb,o={placeholder:"img/placeholders/VideoThumbConversation.gif",width:n,height:i};return r&&"photoSizeEmpty"!=r._&&(r.w>r.h?o.height=parseInt(r.h*n/r.w):o.width=parseInt(r.w*i/r.h),o.location=r.location,o.size=r.size),t.thumb=o,f[e]=t}function l(e){var t=c(e),i=Math.min($(window).width()-60,542),r=$(n).height()-150,a={placeholder:"img/placeholders/VideoThumbModal.gif",width:i,height:r};return t.w&&t.h?t.w>t.h?a.height=parseInt(t.h*i/t.w):(a.width=parseInt(t.w*r/t.h),a.width>i&&(a.height=parseInt(a.height*i/a.width),a.width=i)):a.height=a.width=Math.min(i,r),t.full=a,t.fullThumb=angular.copy(t.thumb),t.fullThumb.width=a.width,t.fullThumb.height=a.height,t.fromUser=o.getUser(t.user_id),t}function u(n,i){var r=e.$new(!0);r.videoID=n,r.messageID=i;t.open({templateUrl:"partials/video_modal.html",controller:"VideoModalController",scope:r,windowClass:"video_modal_window"})}function p(t,n,i){function o(t){console.log("dl progress",t),c.progress.done=t.done,c.progress.percent=Math.max(1,Math.floor(100*t.done/t.total)),e.$broadcast("history_update")}var s=d[t],c=f[t]||s||{},l={_:"inputVideoFileLocation",id:t,access_hash:n||s.access_hash};c.progress={enabled:!0,percent:1,total:s.size};var u="mp4",p="video/mpeg4",h="video"+t+"."+u;a.chooseSave(h,u,p).then(function
break}for(o=a;e.history[o]&&(s=e.history[o].id)!=t;)e.selectedMsgs[s]||(e.selectedMsgs[s]=!0,e.selectedCount++),o+=c?-1:1}}else B=t;e.selectedMsgs[t]=!0,e.selectedCount++,e.selectActions||(e.selectActions=!0,e.$broadcast("ui_panel_update"))}}function C(t){e.selectedMsgs={},e.selectedCount=0,e.selectActions=!1,B=!1,t||e.$broadcast("ui_panel_update")}function k(){f.confirm({type:"HISTORY_FLUSH"}).then(function(){s.flushHistory(e.curDialog.inputPeer).then(function(){C()})})}function M(){if(e.selectedCount>0){var t=[];angular.forEach(e.selectedMsgs,function(e,n){t.push(n)}),s.deleteMessages(t).then(function(){C()})}}function x(){if(e.selectedCount>0){var t=[];angular.forEach(e.selectedMsgs,function(e,n){t.push(n)}),u.selectPeer({confirm_type:"FORWARD_PEER"}).then(function(e){var n=c.getPeerID(e);s.forwardMessages(n,t).then(function(){C(),i.$broadcast("history_focus",{peerString:e})})})}}function T(){e.selectActions?C():(e.selectActions=!0,e.$broadcast("ui_panel_update"))}function E(t){e.historyFilter.mediaType=t||!1,e.history=[],b()}function A(){e.historyFilter.mediaType?E():e.curDialog.messageID?i.$broadcast("history_focus",{peerString:e.curDialog.peer}):b(!0)}e.$watch("curDialog",h),l.attach(),p.start(),d.start(),e.history=[],e.skippedHistory=!1,e.selectedMsgs={},e.selectedCount=0,e.selectActions=!1,e.missedCount=0,e.typing={},e.state={},e.toggleMessage=S,e.selectedDelete=M,e.selectedForward=x,e.selectedCancel=C,e.selectedFlush=k,e.toggleEdit=T,e.toggleMedia=E,e.returnToRecent=A,e.$on("history_edit_toggle",T),e.$on("history_media_toggle",function(e,t){E(t)}),e.$on("history_return_recent",A);var D,I=!1,P=!1,N=0,L=0,B=!1,F={photos:"inputMessagesFilterPhotos",video:"inputMessagesFilterVideo",documents:"inputMessagesFilterDocument",audio:"inputMessagesFilterAudio"},O=0,U=0,R=0,q={};e.$on("history_update",angular.noop),e.$on("history_append",function(t,r){if(r.peerID==e.curDialog.peerID){if(e.historyFilter.mediaType||e.skippedHistory)return void(r.my?A():e.missedCount++);e.history.push(s.wrapForHistory(r.messageID)),m(-3),e.typing={},e.$broadcast("ui_history_append_new",{my:r.my}),r.my&&delete e.historyUnreadAfter,i.idle.isIDLE||n(function(){s.readHistory(e.curDialog.inputPeer)})}}),e.$on("history_delete",function(t,n){if(n.peerID==e.curDialog.peerID){for(var i=[],r=0;r<e.history.length;r++)n.msgs[e.history[r].id]||i.push(e.history[r]);e.history=i,m()}}),e.$on("dialog_flush",function(t,n){n.peerID==e.curDialog.peerID&&(e.history=[])}),e.$on("history_focus",function(){e.historyFilter.mediaType&&E()}),e.$on("apiUpdate",function(t,i){switch(i._){case"updateUserTyping":i.user_id==e.curDialog.peerID&&o.hasUser(i.user_id)&&(e.typing={user:o.getUser(i.user_id)},n.cancel(q[i.user_id]),q[i.user_id]=n(function(){e.typing={}},6e3));break;case"updateChatUserTyping":-i.chat_id==e.curDialog.peerID&&o.hasUser(i.user_id)&&(e.typing={user:o.getUser(i.user_id)},n.cancel(q[i.user_id]),q[i.user_id]=n(function(){e.typing={}},6e3))}}),e.$on("history_need_less",v),e.$on("history_need_more",_),i.$watch("idle.isIDLE",function(t){t||!e.curDialog||!e.curDialog.peerID||e.historyFilter.mediaType||e.skippedHistory||s.readHistory(e.curDialog.inputPeer)})}]).controller("AppImPanelController",["$scope",function(e){e.$on("user_update",angular.noop)}]).controller("AppImSendController",["$scope","$timeout","MtpApiManager","Storage","AppPeersManager","AppMessagesManager","ApiUpdatesManager","MtpApiFileManager",function(e,t,n,i,r,o){function a(n){return e.$broadcast("ui_message_before_send"),t(function(){var t=e.draftMessage.text;if(!angular.isString(t)||!t.length)return!1;t=t.replace(/:([a-z0-9\-\+\*_]+?):/gi,function(e,t){var n=$.emojiarea.reverseIcons[t];return void 0!==n?n:e});var n=0;do!function(e,t,n){setTimeout(function(){o.sendText(e,t)},n)}(e.curDialog.peerID,t.substr(0,4096),n),t=t.substr(4096),n+=100;while(t.length);s(),e.$broadcast("ui_message_send")}),cancelEvent(n)}function s(t){t?i.get("draft"+e.curDialog.peerID).then(function(t){e.draftMessage.text=t||"",e.$broadcast("ui_peer_draft")}):(e.draftMessage.text="",e.$broadcast("ui_peer_draft"))}function
}]),angular.module("myApp.directives",["myApp.filters"]).directive("myHead",function(){return{restrict:"AE",scope:!0,templateUrl:"partials/head.html"}}).directive("myDialog",function(){return{restrict:"AE",scope:!0,translude:!1,templateUrl:"partials/dialog.html"}}).directive("myMessage",function(){return{restrict:"AE",scope:!0,translude:!1,templateUrl:"partials/message.html"}}).directive("myDialogs",["$modalStack","$transition","$window","$timeout",function(e,t,n,i){function r(t,r,o){function a(t){if(!d&&e.getTop())return!0;if(36==t.keyCode&&!t.shiftKey&&!t.ctrlKey&&t.altKey){var n=$(c).find(".im_dialog_wrap a")[0];return n&&(n.click(),c.scrollTop=0,$(s).nanoScroller({flash:!0})),cancelEvent(t)}if(27==t.keyCode||9==t.keyCode&&t.shiftKey&&!t.ctrlKey&&!t.metaKey)return d||(l.focus(),l.value&&l.select()),cancelEvent(t);if(d&&13==t.keyCode){var n=$(c).find(".im_dialog_selected")[0]||$(c).find(".im_dialog_wrap a")[0];return n&&n.click(),cancelEvent(t)}if(38==t.keyCode||40==t.keyCode){var i=!t.shiftKey&&t.altKey;if(!i&&(!d||t.metaKey))return!0;var r,o=40==t.keyCode,n=!i&&$(c).find(".im_dialog_selected")[0]||$(c).find(".active a.im_dialog")[0],a=n&&n.parentNode;if(a){var r=n[o?"nextSibling":"previousSibling"];if(!r||!r.className||-1==r.className.indexOf("im_dialog_wrap")){var u=$(c).find(".im_dialog_wrap"),p=u.index(n.parentNode),f=p+(o?1:-1);r=u[f]}}else{var u=$(c).find(".im_dialog_wrap");r=o?u[0]:u[u.length-1]}if(i?r&&$(r).find("a")[0].click():(a&&r&&$(a).find("a").removeClass("im_dialog_selected"),r&&$(r).find("a").addClass("im_dialog_selected")),r){var h=r.offsetTop,g=r.offsetHeight,m=c.scrollTop,y=c.clientHeight;m>h?(c.scrollTop=h,$(s).nanoScroller({flash:!0})):h+g-y>m&&(c.scrollTop=h+g-y,$(s).nanoScroller({flash:!0}))}return cancelEvent(t)}}var s=$(".im_dialogs_wrap",r)[0],c=$(".im_dialogs_scrollable_wrap",r)[0],l=$(".im_dialogs_search_field",r)[0],u=$(".im_dialogs_panel",r)[0],p=$(".im_dialogs_tabs_wrap",r)[0],d=!1;$(l).on("focus blur",function(e){d="focus"==e.type,d||($(c).find(".im_dialog_selected").removeClass("im_dialog_selected"),l.value||t.$emit("ui_dialogs_search_clear"))}),t.$on("dialogs_search_toggle",function(){$(u).addClass("im_dialogs_panel_search"),t.$broadcast("ui_dialogs_search"),$(n).scrollTop(0),i(function(){l.focus()})}),t.$on("search_clear",function(){$(u).removeClass("im_dialogs_panel_search"),t.$broadcast("ui_dialogs_search")}),o.$observe("hasTabs",function(e){e="true"==e,$(p).toggle(e),t.$broadcast("ui_dialogs_tabs",e)}),$(document).on("keydown",a),t.$on("$destroy",function(){$(document).off("keydown",a)})}return{link:r}}]).directive("myDialogsList",["$window","$timeout",function(e,t){function n(n,i,r){function o(){return r.modal?($(i).css({height:$(e).height()-(Config.Navigator.mobile?100:200)}),void h()):(l&&l.offsetHeight||(l=$(".tg_page_head")[0]),p&&p.offsetHeight||(p=$(".im_page_footer")[0]),u&&u.offsetHeight||(u=$(".im_dialogs_panel")[0]),s&&s.offsetHeight||(s=$(".im_dialogs_col_wrap")[0]),$(i).css({height:$(e).height()-p.offsetHeight-(l?l.offsetHeight:44)-(u?u.offsetHeight:58)-parseInt($(s).css("paddingBottom")||0)}),void h())}var a=$(".im_dialogs_wrap",i)[0],s=$(".im_dialogs_col_wrap")[0],c=$(".im_dialogs_scrollable_wrap",i)[0],l=$(".tg_page_head")[0],u=$(".im_dialogs_panel")[0],p=$(".im_page_footer")[0],d=!1,f=!1;onContentLoaded(function(){$(a).nanoScroller({preventPageScrolling:!0,tabIndex:-1,iOSNativeScrolling:!0})});var h=function(){onContentLoaded(function(){$(a).nanoScroller()})};n.$on("ui_dialogs_prepend",h),n.$on("ui_dialogs_tabs",function(e,t){d=t,o()}),n.$on("ui_dialogs_search",o),n.$on("ui_dialogs_update",o),n.$on("ui_dialogs_append",function(){onContentLoaded(function(){h(),f=!1,t(function(){$(c).trigger("scroll")})})}),n.$on("ui_dialogs_change",function(){onContentLoaded(function(){h(),f=!1,t(function(){$(c).trigger("scroll")})})}),$(c).on("scroll",function(){i.is(":visible")&&!f&&c.scrollTop>=c.scrollHeight-c.clientHeight-300&&(n.$emit("dialogs_need_more"),f=!0)}),$(e).on("resize",o),o(),setTimeout(o,1e3)}return{link:n}}]).directive("myContactsList",["$window","$timeout",func