45 lines
471 KiB
JavaScript
45 lines
471 KiB
JavaScript
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=19)}([function(e,t,n){"use strict";e.exports=n(20)},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",function(){return o}),n.d(t,"__assign",function(){return i}),n.d(t,"__rest",function(){return a}),n.d(t,"__decorate",function(){return s}),n.d(t,"__param",function(){return l}),n.d(t,"__metadata",function(){return u}),n.d(t,"__awaiter",function(){return c}),n.d(t,"__generator",function(){return d}),n.d(t,"__exportStar",function(){return p}),n.d(t,"__values",function(){return f}),n.d(t,"__read",function(){return h}),n.d(t,"__spread",function(){return m}),n.d(t,"__await",function(){return y}),n.d(t,"__asyncGenerator",function(){return v}),n.d(t,"__asyncDelegator",function(){return g}),n.d(t,"__asyncValues",function(){return b}),n.d(t,"__makeTemplateObject",function(){return _}),n.d(t,"__importStar",function(){return w}),n.d(t,"__importDefault",function(){return E});
|
||
/*! *****************************************************************************
|
||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||
this file except in compliance with the License. You may obtain a copy of the
|
||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||
|
||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||
|
||
See the Apache Version 2.0 License for specific language governing permissions
|
||
and limitations under the License.
|
||
***************************************************************************** */
|
||
var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};function o(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]])}return n}function s(e,t,n,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function l(e,t){return function(n,r){t(n,r,e)}}function u(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function c(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){e.done?o(e.value):new n(function(t){t(e.value)}).then(a,s)}l((r=r.apply(e,t||[])).next())})}function d(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=r[2&i[0]?"return":i[0]?"throw":"next"])&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[0,o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function p(e,t){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}function f(e){var t="function"==typeof Symbol&&e[Symbol.iterator],n=0;return t?t.call(e):{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}}}function h(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(h(arguments[t]));return e}function y(e){return this instanceof y?(this.v=e,this):new y(e)}function v(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,o=n.apply(e,t||[]),i=[];return r={},a("next"),a("throw"),a("return"),r[Symbol.asyncIterator]=function(){return this},r;function a(e){o[e]&&(r[e]=function(t){return new Promise(function(n,r){i.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{!function(e){e.value instanceof y?Promise.resolve(e.value.v).then(l,u):c(i[0][2],e)}(o[e](t))}catch(e){c(i[0][3],e)}}function l(e){s("next",e)}function u(e){s("throw",e)}function c(e,t){e(t),i.shift(),i.length&&s(i[0][0],i[0][1])}}function g(e){var t,n;return t={},r("next"),r("throw",function(e){throw e}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(r,o){e[r]&&(t[r]=function(t){return(n=!n)?{value:y(e[r](t)),done:"return"===r}:o?o(t):t})}}function b(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator];return t?t.call(e):f(e)}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function w(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function E(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){(function(t){e.exports=function(){var e={},n=[{name:"ST",start:/(?:^|\W)(\*)[^\s*]/,end:/[^\s*](\*)(?=$|\W)/},{name:"EM",start:/(?:^|[\W_])(_)[^\s_]/,end:/[^\s_](_)(?=$|[\W_])/},{name:"DL",start:/(?:^|\W)(~)[^\s~]/,end:/[^\s~](~)(?=$|\W)/},{name:"CO",start:/(?:^|\W)(`)[^`]/,end:/[^`](`)(?=$|\W)/}],r=[{name:"LN",dataName:"url",pack:function(e){return/^[a-z]+:\/\//i.test(e)||(e="http://"+e),{url:e}},re:/(?:(?:https?|ftp):\/\/|www\.|ftp\.)[-A-Z0-9+&@#\/%=~_|$?!:,.]*[A-Z0-9+&@#\/%=~_|$]/gi},{name:"MN",dataName:"val",pack:function(e){return{val:e.slice(1)}},re:/\B@(\w\w+)/g},{name:"HT",dataName:"val",pack:function(e){return{val:e.slice(1)}},re:/\B#(\w\w+)/g}],o={ST:{name:"b",isVoid:!1},EM:{name:"i",isVoid:!1},DL:{name:"del",isVoid:!1},CO:{name:"tt",isVoid:!1},BR:{name:"br",isVoid:!0},LN:{name:"a",isVoid:!1},MN:{name:"a",isVoid:!1},HT:{name:"a",isVoid:!1},IM:{name:"img",isVoid:!0}};function i(e,t){var n;try{n=atob(e)}catch(e){console.log("Drafty: failed to decode base64-encoded object",e.message),n=atob("")}for(var r=n.length,o=new ArrayBuffer(r),i=new Uint8Array(o),a=0;a<r;a++)i[a]=n.charCodeAt(a);return URL.createObjectURL(new Blob([o],{type:t}))}var a={ST:{open:function(){return"<b>"},close:function(){return"</b>"}},EM:{open:function(){return"<i>"},close:function(){return"</i>"}},DL:{open:function(){return"<del>"},close:function(){return"</del>"}},CO:{open:function(){return"<tt>"},close:function(){return"</tt>"}},BR:{open:function(){return""},close:function(){return"<br/>"}},LN:{open:function(e){return'<a href="'+e.url+'">'},close:function(e){return"</a>"},props:function(e){return{href:e.url,target:"_blank"}}},MN:{open:function(e){return'<a href="#'+e.val+'">'},close:function(e){return"</a>"},props:function(e){return{name:e.val}}},HT:{open:function(e){return'<a href="#'+e.val+'">'},close:function(e){return"</a>"},props:function(e){return{name:e.val}}},IM:{open:function(e){var t=i(e.val,e.mime),n=e.ref?e.ref:t,r=(e.name?'<a href="'+n+'" download="'+e.name+'">':"")+'<img src="'+t+'"'+(e.width?' width="'+e.width+'"':"")+(e.height?' height="'+e.height+'"':"")+' border="0" />';return console.log("open: "+r),r},close:function(e){return e.name?"</a>":""},props:function(e){return{src:i(e.val,e.mime),title:e.name,"data-width":e.width,"data-height":e.height,"data-name":e.name,"data-size":.75*e.val.length|0,"data-mime":e.mime}}}},s=function(){};s.parse=function(e){if("string"!=typeof e)return null;var t=e.split(/\r?\n/),o=[],i={},a=[];t.map(function(e){var t,s,l=[];if(n.map(function(t){l=l.concat(function(e,t,n,r){for(var o=[],i=0,a=e.slice(0);a.length>0;){var s=t.exec(a);if(null==s)break;var l=s.index+s[0].lastIndexOf(s[1]);a=a.slice(l+1),i=(l+=i)+1;var u=n?n.exec(a):null;if(null==u)break;var c=u.index+u[0].indexOf(u[1]);a=a.slice(c+1),i=(c+=i)+1,o.push({text:e.slice(l+1,c),children:[],start:l,end:c,type:r})}return o}(e,t.start,t.end,t.name))}),0==l.length)s={txt:e};else{l.sort(function(e,t){return e.start-t.start}),l=function e(t){if(0==t.length)return[];for(var n=[t[0]],r=t[0],o=1;o<t.length;o++)t[o].start>r.end?(n.push(t[o]),r=t[o]):t[o].end<r.end&&r.children.push(t[o]);for(var o in n)n[o].children=e(n[o].children);return n}(l);var u=function e(t,n){var r="",o=[];for(var i in t){var a=t[i];if(!a.text){var s=e(a.children,r.length+n);a.text=s.txt,o=o.concat(s.fmt)}a.type&&o.push({at:r.length+n,len:a.text.length,tp:a.type}),r+=a.text}return{txt:r,fmt:o}}(function e(t,n,r,o){var i=[];if(0==o.length)return[];for(var a in o){var s=o[a];s.start>n&&i.push({text:t.slice(n,s.start)});var l={type:s.type},u=e(t,s.start+1,s.end-1,s.children);u.length>0?l.children=u:l.text=s.text,i.push(l),n=s.end+1}return n<r&&i.push({text:t.slice(n,r)}),i}(e,0,e.length,l),0);s={txt:u.txt,fmt:u.fmt}}if((t=function(e){var t,n=[];if(r.map(function(r){for(;null!==(t=r.re.exec(e));)n.push({offset:t.index,len:t[0].length,unique:t[0],data:r.pack(t[0]),type:r.name})}),0==n.length)return n;n.sort(function(e,t){return e.offset-t.offset});var o=-1;return n=n.filter(function(e){var t=e.offset>o;return o=e.offset+e.len,t})}(s.txt)).length>0){var c=[];for(var d in t){var p=t[d],f=i[p.unique];f||(f=o.length,i[p.unique]=f,o.push({tp:p.type,data:p.data})),c.push({at:p.offset,len:p.len,key:f})}s.ent=c}a.push(s)});var s={txt:""};if(a.length>0){s.txt=a[0].txt,s.fmt=(a[0].fmt||[]).concat(a[0].ent||[]);for(var l=1;l<a.length;l++){var u=a[l],c=s.txt.length+1;s.fmt.push({tp:"BR",len:1,at:c-1}),s.txt+=" "+u.txt,u.fmt&&(s.fmt=s.fmt.concat(u.fmt.map(function(e){return e.at+=c,e}))),u.ent&&(s.fmt=s.fmt.concat(u.ent.map(function(e){return e.at+=c,e})))}0==s.fmt.length&&delete s.fmt,o.length>0&&(s.ent=o)}return s},s.insertImage=function(e,t,n,r,o,i,a,s,l){return(e=e||{txt:" "}).ent=e.ent||[],e.fmt=e.fmt||[],e.fmt.push({at:t,len:1,key:e.ent.length}),e.ent.push({tp:"IM",data:{mime:n,val:r,width:o,height:i,name:a,ref:l,size:0|s}}),e},s.attachFile=function(e,t,n,r,o,i){(e=e||{txt:""}).ent=e.ent||[],e.fmt=e.fmt||[],e.fmt.push({at:-1,len:0,key:e.ent.length});var a={tp:"EX",data:{mime:t,val:n,name:r,ref:i,size:0|o}};return i instanceof Promise&&(a.data.ref=i.then(function(e){a.data.ref=e},function(e){})),e.ent.push(a),e},s.UNSAFE_toHTML=function(e){var t,n,r,o=e.txt,i=e.fmt,s=e.ent,l=[];if(i)for(var u in i){var c,d=i[u],p=d.tp;if(!p){var f=s[d.key];f&&(p=f.tp,c=f.data)}a[p]&&(l.push({idx:d.at+d.len,what:a[p].close(c)}),l.push({idx:d.at,what:a[p].open(c)}))}for(var u in l.sort(function(e,t){return t.idx-e.idx}),l)l[u].what&&(t=o,n=l[u].idx,r=l[u].what,o=t.slice(0,n)+r+t.slice(n));return o},s.format=function(e,t,n){var r=e.txt,i=e.fmt,a=e.ent;if(r=r||"",!i)return[r];var s=[].concat(i);return s.map(function(e){e.at=e.at||0,e.len=e.len||0}),s.sort(function(e,t){return e.at-t.at==0?t.len-e.len:e.at-t.at}),s=s.map(function(e){var t,n=e.tp;return n||(e.key=e.key||0,t=a[e.key].data,n=a[e.key].tp),{tp:n,data:t,at:e.at,len:e.len}}),function e(t,n,r,i,a,s){for(var l=[],u=0;u<i.length;u++){var c=i[u];n<c.at&&(l.push(a.call(s,null,void 0,t.slice(n,c.at))),n=c.at);for(var d=[],p=u+1;p<i.length&&i[p].at<c.at+c.len;p++)d.push(i[p]),u=p;var f=o[c.tp]||{};l.push(a.call(s,c.tp,c.data,f.isVoid?null:e(t,n,c.at+c.len,d,a,s))),n=c.at+c.len}return n<r&&l.push(a.call(s,null,void 0,t.slice(n,r))),l}(r,0,r.length,s,t,n)},s.toPlainText=function(e){return"string"==typeof e?e:e.txt},s.isPlainText=function(e){return"string"==typeof e||!(e.fmt||e.ent)},s.hasAttachments=function(e){if(e.ent&&e.ent.length>0)for(var t in e.ent)if("EX"==e.ent[t].tp)return!0;return!1},s.attachments=function(e,t,n){if(e.ent&&e.ent.length>0)for(var r in e.ent)"EX"==e.ent[r].tp&&t.call(n,e.ent[r].data,r)},s.getDownloadUrl=function(e){var t=null;return e.val?t=i(e.val,e.mime):"string"==typeof e.ref&&(t=e.ref),t},s.isUploading=function(e){return e.ref instanceof Promise},s.getPreviewUrl=function(e){return e.val?i(e.val,e.mime):null},s.getEntitySize=function(e){return e.size?e.size:e.val?.75*e.val.length|0:0},s.getEntityMimeType=function(e){return e.mime||"text/plain"},s.tagName=function(e){return o[e]?o[e].name:void 0},s.attrValue=function(e,t){if(t&&a[e])return a[e].props(t)},s.getContentType=function(){return"text/x-drafty"},e=s;var l={};return function(t){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var r,o="0.15.8-rc1";"undefined"!=typeof WebSocket&&(r=WebSocket),"undefined"==typeof btoa&&(t.btoa=function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n="",r=0,o=0,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(0|o)||(i="=",o%1);n+=i.charAt(63&r>>8-o%1*8)){if((e=t.charCodeAt(o+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");r=r<<8|e}return n}),"undefined"==typeof atob&&(t.atob=function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(/=+$/,""),t="";if(e.length%4==1)throw new Error("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r=0,o=0,i=0;n=e.charAt(i++);~n&&(o=r%4?64*o+n:n,r++%4)?t+=String.fromCharCode(255&o>>(-2*r&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return t}),"undefined"==typeof window&&(t.window={WebSocket:r,URL:{createObjectURL:function(){throw new Error("Unable to use window.URL in a non browser application")}}});var i="0",a=o||"0.15",s="tinodejs/"+a,u=503,c="Connection failed";function d(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}function p(e,t,r){if(null==t)return e;if("object"!==n(t))return t||e;if(t instanceof Date)return t;if(t instanceof w)return new w(t);if(t instanceof Array)return t.length>0?t:e;for(var o in e||(e=t.constructor()),t)!t.hasOwnProperty(o)||!t[o]&&!1!==t[o]||r&&r[o]||"_generated"==o||(e[o]=p(e[o],t[o]));return e}function f(e,t,n,r){return e[t]=p(e[t],n,r),e[t]}function h(){var e=null;if("withCredentials"in new XMLHttpRequest)e=new XMLHttpRequest;else{if("undefined"==typeof XDomainRequest)throw new Error("browser not supported");e=new XDomainRequest}return e}function m(e,t){if("ts"===e&&"string"==typeof t&&t.length>=20&&t.length<=24){var r=new Date(t);if(r)return r}else if("acs"===e&&"object"===n(t))return new w(t);return t}function y(e,t){return"string"==typeof t&&t.length>128?"<"+t.length+", bytes: "+t.substring(0,12)+"..."+t.substring(t.length-12)+">":function(e,t){if(t instanceof Date)t=function(e){if(e&&0!=e.getTime()){var t=e.getUTCMilliseconds();return e.getUTCFullYear()+"-"+n(e.getUTCMonth()+1)+"-"+n(e.getUTCDate())+"T"+n(e.getUTCHours())+":"+n(e.getUTCMinutes())+":"+n(e.getUTCSeconds())+(t?"."+n(t,3):"")+"Z"}function n(e,t){return"0".repeat((t=t||2)-(""+e).length)+e}}(t);else if(null==t||!1===t||Array.isArray(t)&&0==t.length||"object"===n(t)&&0===Object.keys(t).length)return;return t}(0,t)}function v(e,t,n){var r=null;return"http"!==t&&"https"!==t&&"ws"!==t&&"wss"!==t||(r=t+"://","/"!==(r+=e).charAt(r.length-1)&&(r+="/"),r+="v"+i+"/channels","http"!==t&&"https"!==t||(r+="/lp"),r+="?apikey="+n),r}var g=function(e,t,o,i,a){var s=this,l=e,d=i,p=t,f=a,y=2e3,g=10,b=.3,_=null,w=0,E=!1,S=function(e){s.logger&&s.logger(e)};function T(e){var t=null;e.connect=function(n){return t&&1===t.readyState?Promise.resolve():(n&&(l=n),new Promise(function(n,o){var i=v(l,d?"wss":"ws",p);S("Connecting to: "+i);var a=new r(i);a.onopen=function(t){E=!1,e.onOpen&&e.onOpen(),n(),f&&(clearTimeout(_),_=null,w=0)},a.onclose=function(n){t=null,e.onDisconnect&&e.onDisconnect(null),!E&&f&&function(){var e=this;clearTimeout(_);var t=y*(Math.pow(2,w)*(1+b*Math.random()));w=w>=g?w:w+1,_=setTimeout(function(){S("Reconnecting, iter="+w+", timeout="+t),E||e.connect().catch(function(){})},t)}.call(e)},a.onerror=function(e){o(e)},a.onmessage=function(t){e.onMessage&&e.onMessage(t.data)},t=a}))},e.disconnect=function(){t&&(E=!0,t.close()),t=null},e.sendText=function(e){if(!t||t.readyState!=t.OPEN)throw new Error("Websocket is not connected");t.send(e)},e.isConnected=function(){return t&&1===t.readyState},e.transport=function(){return"ws"}}function k(e){var t=null,n=null,r=null;e.connect=function(r){return n?Promise.resolve():(r&&(l=r),new Promise(function(r,o){var i=v(l,d?"https":"http",p);S("Connecting to: "+i),(n=function n(r,o,i){var a=h();return a.onreadystatechange=function(s){if(4==a.readyState)if(201==a.status){var l=JSON.parse(a.responseText,m);a.responseText,t=r+"&sid="+l.ctrl.params.sid,(a=n(t)).send(null),e.onOpen&&e.onOpen(),o&&o()}else if(200==a.status)e.onMessage&&e.onMessage(a.responseText),(a=n(t)).send(null);else if(i&&i(a.responseText),e.onMessage&&a.responseText&&e.onMessage(a.responseText),e.onDisconnect){var d=a.status||u,p=a.responseText||c;e.onDisconnect(new Error(p+"("+d+")"))}},a.open("GET",r,!0),a}(i,r,o)).send(null)}).catch(function(){}))},e.disconnect=function(){r&&(r.onreadystatechange=void 0,r.abort(),r=null),n&&(n.onreadystatechange=void 0,n.abort(),n=null),e.onDisconnect&&e.onDisconnect(null),t=null},e.sendText=function(e){var n,o;if(n=t,(o=h()).onreadystatechange=function(e){if(4==o.readyState&&o.status>=400)throw new Error("LP sender failed, "+o.status)},o.open("POST",n,!0),!(r=o)||1!=r.readyState)throw new Error("Long poller failed to connect");r.send(e)},e.isConnected=function(){return n&&!0},e.transport=function(){return"lp"}}"lp"===o?k(this):"ws"===o?T(this):"object"==("undefined"==typeof window?"undefined":n(window))&&window.WebSocket?T(this):k(this),this.onMessage=void 0,this.onDisconnect=void 0,this.onOpen=void 0,this.logger=void 0},b=function(e,t,r,o,i){var l=this;this._appName=e||"Undefined",this._apiKey=r,this._browser="",this._platform="undefined",this._humanLanguage="xx","undefined"!=typeof navigator&&(this._browser=function(e){var t,n=(e=(e||"").replace(" (KHTML, like Gecko)","")).match(/(AppleWebKit\/[.\d]+)/i);if(n){for(var r=["chrome","safari","mobile","version"],o=e.substr(n.index+n[0].length).split(" "),i=[],a=0;a<o.length;a++){var s=/([\w.]+)[\/]([\.\d]+)/.exec(o[a]);s&&i.push([s[1],s[2],r.findIndex(function(e){return e==s[1].toLowerCase()})])}i.sort(function(e,t){var n=e[2]-t[2];return 0!=n?n:t[0].length-e[0].length}),t=i.length>0?i[0][0]+"/"+i[0][1]:n[1]}else t=/trident/i.test(e)?(n=/(?:\brv[ :]+([.\d]+))|(?:\bMSIE ([.\d]+))/g.exec(e))?"MSIE/"+(n[1]||n[2]):"MSIE/?":/firefox/i.test(e)?(n=/Firefox\/([.\d]+)/g.exec(e))?"Firefox/"+n[1]:"Firefox/?":/presto/i.test(e)?(n=/Opera\/([.\d]+)/g.exec(e))?"Opera/"+n[1]:"Opera/?":(n=/([\w.]+)\/([.\d]+)/.exec(e))?n[1]+"/"+n[2]:(n=e.split(" "))[0];if((n=t.split("/")).length>1){var l=n[1].split(".");t=n[0]+"/"+l[0]+(l[1]?"."+l[1]:"")}return t}(navigator.userAgent),this._platform=navigator.platform,this._humanLanguage=navigator.language||"en-US"),this._loggingEnabled=!1,this._trimLongStrings=!1,this._myUID=null,this._authenticated=!1,this._login=null,this._authToken=null,this._inPacketCount=0,this._messageId=Math.floor(65535*Math.random()+65535),this._serverInfo=null,this._deviceToken=null,this._pendingPromises={},this._connection=new g(t,r,o,i,!0),this.logger=function(e){if(l._loggingEnabled){var t=new Date,n=("0"+t.getUTCHours()).slice(-2)+":"+("0"+t.getUTCMinutes()).slice(-2)+":"+("0"+t.getUTCSeconds()).slice(-2)+":"+("0"+t.getUTCMilliseconds()).slice(-3);console.log("["+n+"] "+e)}},this._connection.logger=this.logger,this._cache={};var d=this.cachePut=function(e,t,n){l._cache[e+":"+t]=n},f=this.cacheGet=function(e,t){return l._cache[e+":"+t]},h=this.cacheDel=function(e,t){delete l._cache[e+":"+t]},v=this.cacheMap=function(e,t){for(var n in l._cache)if(e(l._cache[n],n,t))break};this.attachCacheToTopic=function(e){e._tinode=l,e._cacheGetUser=function(e){var t=f("user",e);if(t)return{user:e,public:p({},t)}},e._cachePutUser=function(e,t){return d("user",e,p({},t.public))},e._cacheDelUser=function(e){return h("user",e)},e._cachePutSelf=function(){return d("topic",e.name,e)},e._cacheDelSelf=function(){return h("topic",e.name)}};var b=function(e,t,n,r){var o=l._pendingPromises[e];o&&(delete l._pendingPromises[e],t>=200&&t<400?o.resolve&&o.resolve(n):o.reject&&o.reject(new Error("Error: "+r+" ("+t+")")))},_=this.getNextUniqueId=function(){return 0!=l._messageId?""+l._messageId++:void 0};this.initPacket=function(e,t){switch(e){case"hi":return{hi:{id:_(),ver:a,ua:l._appName+" ("+(l._browser?l._browser+"; ":"")+l._platform+"); "+s,dev:l._deviceToken,lang:l._humanLanguage}};case"acc":return{acc:{id:_(),user:null,scheme:null,secret:null,login:!1,tags:null,desc:{},cred:{}}};case"login":return{login:{id:_(),scheme:null,secret:null}};case"sub":return{sub:{id:_(),topic:t,set:{},get:{}}};case"leave":return{leave:{id:_(),topic:t,unsub:!1}};case"pub":return{pub:{id:_(),topic:t,noecho:!1,head:null,content:{}}};case"get":return{get:{id:_(),topic:t,what:null,desc:{},sub:{},data:{}}};case"set":return{set:{id:_(),topic:t,desc:{},sub:{},tags:[]}};case"del":return{del:{id:_(),topic:t,what:null,delseq:null,user:null,hard:!1}};case"note":return{note:{topic:t,what:null,seq:void 0}};default:throw new Error("Unknown packet type requested: "+e)}},this.send=function(e,t){var r;t&&(r=function(e){var t=null;return e&&(t=new Promise(function(t,n){l._pendingPromises[e]={resolve:t,reject:n}})),t}(t)),e=function e(t){return Object.keys(t).forEach(function(r){"_"==r[0]?delete t[r]:t[r]?Array.isArray(t[r])&&0==t[r].length?delete t[r]:t[r]?"object"!=n(t[r])||t[r]instanceof Date||(e(t[r]),0==Object.getOwnPropertyNames(t[r]).length&&delete t[r]):delete t[r]:delete t[r]}),t}(e);var o=JSON.stringify(e);l.logger("out: "+(l._trimLongStrings?JSON.stringify(e,y):o));try{l._connection.sendText(o)}catch(e){if(!t)throw e;b(t,u,null,e.message)}return r},this.loginSuccessful=function(e){e.params&&e.params.user&&(l._myUID=e.params.user,l._authenticated=e&&e.code>=200&&e.code<300,e.params&&e.params.token&&e.params.expires?l._authToken={token:e.params.token,expires:new Date(e.params.expires)}:l._authToken=null,l.onLogin&&l.onLogin(e.code,e.text))},this._connection.onMessage=function(e){if(e){l._inPacketCount++,l.onRawMessage&&l.onRawMessage(e);var t=JSON.parse(e,m);if(t)if(l.logger("in: "+(l._trimLongStrings?JSON.stringify(t,y):e)),l.onMessage&&l.onMessage(t),t.ctrl)l.onCtrlMessage&&l.onCtrlMessage(t.ctrl),t.ctrl.id&&b(t.ctrl.id,t.ctrl.code,t.ctrl,t.ctrl.text),t.ctrl.params&&"data"==t.ctrl.params.what&&(n=f("topic",t.ctrl.topic))&&n._allMessagesReceived(t.ctrl.params.count);else if(t.meta)(n=f("topic",t.meta.topic))&&n._routeMeta(t.meta),l.onMetaMessage&&l.onMetaMessage(t.meta);else if(t.data)(n=f("topic",t.data.topic))&&n._routeData(t.data),l.onDataMessage&&l.onDataMessage(t.data);else if(t.pres)(n=f("topic",t.pres.topic))&&n._routePres(t.pres),l.onPresMessage&&l.onPresMessage(t.pres);else if(t.info){var n;(n=f("topic",t.info.topic))&&n._routeInfo(t.info),l.onInfoMessage&&l.onInfoMessage(t.info)}else l.logger("ERROR: Unknown packet received.");else l.logger("in: "+e),l.logger("ERROR: failed to parse data")}},this._connection.onOpen=function(){l.hello()},this._connection.onDisconnect=function(e){for(var t in l._inPacketCount=0,l._serverInfo=null,l._authenticated=!1,l._pendingPromises){var n=l._pendingPromises[t];n&&n.reject&&n.reject(new Error(c+" ("+u+")"))}l._pendingPromises={},v(function(e,t){0===t.lastIndexOf("topic:",0)&&e._resetSub()}),l.onDisconnect&&l.onDisconnect(e)}};b.credential=function(e,t,r,o){if("object"==n(e)){var i=e;t=i.val,r=i.params,o=i.resp,e=i.meth}return e&&(t||o)?[{meth:e,val:t,resp:o,params:r}]:null},b.topicType=function(e){return{me:"me",fnd:"fnd",grp:"grp",new:"grp",usr:"p2p"}["string"==typeof e?e.substring(0,3):"xxx"]},b.isNewGroupTopicName=function(e){return"string"==typeof e&&"new"==e.substring(0,3)},b.getVersion=function(){return a},b.setWebSocketProvider=function(e){r=e},b.getLibrary=function(){return s},b.MESSAGE_STATUS_NONE=0,b.MESSAGE_STATUS_QUEUED=1,b.MESSAGE_STATUS_SENDING=2,b.MESSAGE_STATUS_FAILED=3,b.MESSAGE_STATUS_SENT=4,b.MESSAGE_STATUS_RECEIVED=5,b.MESSAGE_STATUS_READ=6,b.MESSAGE_STATUS_TO_ME=7,b.DEL_CHAR="␡",b.prototype={connect:function(e){return this._connection.connect(e)},disconnect:function(){this._connection&&this._connection.disconnect()},isConnected:function(){return this._connection&&this._connection.isConnected()},isAuthenticated:function(){return this._authenticated},account:function(e,t,n,r,o){var i=this.initPacket("acc");return i.acc.user=e,i.acc.scheme=t,i.acc.secret=n,i.acc.login=r,o&&(i.acc.desc.defacs=o.defacs,i.acc.desc.public=o.public,i.acc.desc.private=o.private,i.acc.tags=o.tags,i.acc.cred=o.cred,i.acc.token=o.token),this.send(i,i.acc.id)},createAccount:function(e,t,n,r){var o=this,i=this.account("new",e,t,n,r);return n&&(i=i.then(function(e){return o.loginSuccessful(e),e})),i},createAccountBasic:function(e,t,n){return e=e||"",t=t||"",this.createAccount("basic",d(e+":"+t),!0,n)},updateAccountBasic:function(e,t,n,r){return t=t||"",n=n||"",this.account(e,"basic",d(t+":"+n),!1,r)},hello:function(){var e=this,t=this.initPacket("hi");return this.send(t,t.hi.id).then(function(t){return t.params&&(e._serverInfo=t.params),e.onConnect&&e.onConnect(),t}).catch(function(t){e.onDisconnect&&e.onDisconnect(t)})},setDeviceToken:function(e,t){var n=!1;return e&&e!=this._deviceToken&&(this._deviceToken=e,t&&this.isConnected()&&this.isAuthenticated()&&(this.send({hi:{dev:e}}),n=!0)),n},login:function(e,t,n){var r=this,o=this.initPacket("login");return o.login.scheme=e,o.login.secret=t,o.login.cred=n,this.send(o,o.login.id).then(function(e){return r.loginSuccessful(e),e})},loginBasic:function(e,t,n){var r=this;return this.login("basic",d(e+":"+t),n).then(function(t){return r._login=e,t})},loginToken:function(e,t){return this.login("token",e,t)},requestResetAuthSecret:function(e,t,n){return this.login("reset",d(e+":"+t+":"+n))},getAuthToken:function(){return this._authToken&&this._authToken.expires.getTime()>Date.now()?this._authToken:(this._authToken=null,null)},setAuthToken:function(e){this._authToken=e},subscribe:function(e,t,n){var r=this.initPacket("sub",e);return e||(e="new"),r.sub.get=t,n&&(n.sub&&(r.sub.set.sub=n.sub),b.isNewGroupTopicName(e)&&n.desc&&(r.sub.set.desc=n.desc),n.tags&&(r.sub.set.tags=n.tags)),this.send(r,r.sub.id)},leave:function(e,t){var n=this.initPacket("leave",e);return n.leave.unsub=t,this.send(n,n.leave.id)},createMessage:function(t,n,r){var o=this.initPacket("pub",t),i="string"==typeof n?e.parse(n):n;return i&&!e.isPlainText(i)&&(o.pub.head={mime:e.getContentType()},n=i),o.pub.noecho=r,o.pub.content=n,o.pub},publish:function(e,t,n){return this.publishMessage(this.createMessage(e,t,n))},publishMessage:function(e){return(e=Object.assign({},e)).seq=void 0,e.from=void 0,e.ts=void 0,this.send({pub:e},e.id)},getMeta:function(e,t){var n=this.initPacket("get",e);return n.get=p(n.get,t),this.send(n,n.get.id)},setMeta:function(e,t){var n=this.initPacket("set",e),r=[];return t&&["desc","sub","tags"].map(function(e){t.hasOwnProperty(e)&&(r.push(e),n.set[e]=t[e])}),0==r.length?Promise.reject(new Error("Invalid {set} parameters")):this.send(n,n.set.id)},delMessages:function(e,t,n){var r=this.initPacket("del",e);return r.del.what="msg",r.del.delseq=t,r.del.hard=n,this.send(r,r.del.id)},delTopic:function(e){var t=this,n=this.initPacket("del",e);return n.del.what="topic",this.send(n,n.del.id).then(function(n){return t.cacheDel("topic",e),t.ctrl})},delSubscription:function(e,t){var n=this.initPacket("del",e);return n.del.what="sub",n.del.user=t,this.send(n,n.del.id)},note:function(e,t,n){if(n<=0||n>=268435455)throw new Error("Invalid message id "+n);var r=this.initPacket("note",e);r.note.what=t,r.note.seq=n,this.send(r)},noteKeyPress:function(e){var t=this.initPacket("note",e);t.note.what="kp",this.send(t)},getTopic:function(e){var t=this.cacheGet("topic",e);return!t&&e&&(t="me"==e?new S:"fnd"==e?new T:new E(e),this.cachePut("topic",e,t),this.attachCacheToTopic(t)),t},newTopic:function(e){var t=new E("new",e);return this.attachCacheToTopic(t),t},newGroupTopicName:function(){return"new"+this.getNextUniqueId()},newTopicWith:function(e,t){var n=new E(e,t);return this.attachCacheToTopic(n),n},getMeTopic:function(){return this.getTopic("me")},getFndTopic:function(){return this.getTopic("fnd")},getLargeFileHelper:function(){return new k(this)},getCurrentUserID:function(){return this._myUID},getCurrentLogin:function(){return this._login},getServerInfo:function(){return this._serverInfo},enableLogging:function(e,t){this._loggingEnabled=e,this._trimLongStrings=e&&t},isTopicOnline:function(e){var t=this.getMeTopic(),n=t&&t.getContact(e);return n&&n.online},wantAkn:function(e){this._messageId=e?Math.floor(16777215*Math.random()+16777215):0},onWebsocketOpen:void 0,onConnect:void 0,onDisconnect:void 0,onLogin:void 0,onCtrlMessage:void 0,onDataMessage:void 0,onPresMessage:void 0,onMessage:void 0,onRawMessage:void 0};var _=function(e){this.topic=e;var t=e._tinode.getMeTopic();this.contact=t&&t.getContact(e.name),this.what={}};_.prototype={_get_ims:function(){var e=this.contact&&this.contact.updated,t=this.topic._lastDescUpdate||0;return e>t?e:t},withData:function(e,t,n){return this.what.data={since:e,before:t,limit:n},this},withLaterData:function(e){return this.withData(this.topic._maxSeq>0?this.topic._maxSeq+1:void 0,void 0,e)},withEarlierData:function(e){return this.withData(void 0,this.topic._minSeq>0?this.topic._minSeq:void 0,e)},withDesc:function(e){return this.what.desc={ims:e},this},withLaterDesc:function(){return this.withDesc(this._get_ims())},withSub:function(e,t,n){var r={ims:e,limit:t};return"me"==this.topic.getType()?r.topic=n:r.user=n,this.what.sub=r,this},withOneSub:function(e,t){return this.withSub(e,void 0,t)},withLaterOneSub:function(e){return this.withOneSub(this.topic._lastSubsUpdate,e)},withLaterSub:function(e){return this.withSub("p2p"==this.topic.getType()?this._get_ims():this.topic._lastSubsUpdate,e)},withTags:function(){return this.what.tags=!0,this},withDel:function(e,t){return(e||t)&&(this.what.del={since:e,limit:t}),this},withLaterDel:function(e){return this.withDel(this.topic._maxSeq>0?this.topic._maxDel+1:void 0,e)},build:function(){var e={},t=[],n=this;return["data","sub","desc","tags","del"].map(function(r){n.what.hasOwnProperty(r)&&(t.push(r),Object.getOwnPropertyNames(n.what[r]).length>0&&(e[r]=n.what[r]))}),t.length>0?e.what=t.join(" "):e=void 0,e}};var w=function e(t){t&&(this.given="number"==typeof t.given?t.given:e.decode(t.given),this.want="number"==typeof t.want?t.want:e.decode(t.want),this.mode=t.mode?"number"==typeof t.mode?t.mode:e.decode(t.mode):this.given&this.want)};w._NONE=0,w._JOIN=1,w._READ=2,w._WRITE=4,w._PRES=8,w._APPROVE=16,w._SHARE=32,w._DELETE=64,w._OWNER=128,w._BITMASK=w._JOIN|w._READ|w._WRITE|w._PRES|w._APPROVE|w._SHARE|w._DELETE|w._OWNER,w._INVALID=1048576,w.decode=function(e){if(!e)return null;if("number"==typeof e)return e&w._BITMASK;if("N"===e||"n"===e)return w._NONE;for(var t={J:w._JOIN,R:w._READ,W:w._WRITE,P:w._PRES,A:w._APPROVE,S:w._SHARE,D:w._DELETE,O:w._OWNER},n=w._NONE,r=0;r<e.length;r++){var o=t[e.charAt(r).toUpperCase()];o&&(n|=o)}return n},w.encode=function(e){if(null===e||e===w._INVALID)return null;if(e===w._NONE)return"N";for(var t=["J","R","W","P","A","S","D","O"],n="",r=0;r<t.length;r++)0!=(e&1<<r)&&(n+=t[r]);return n},w.update=function(e,t){if(!t||"string"!=typeof t)return e;var n=t.charAt(0);if("+"==n||"-"==n){for(var r=e,o=t.split(/([-+])/),i=1;i<o.length-1;i+=2){n=o[i];var a=w.decode(o[i+1]);if(a==w._INVALID)return e;null!=a&&("+"===n?r|=a:"-"===n&&(r&=~a))}e=r}else(r=w.decode(t))!=w._INVALID&&(e=r);return e},w.prototype={setMode:function(e){return this.mode=w.decode(e),this},updateMode:function(e){return this.mode=w.update(this.mode,e),this},getMode:function(){return w.encode(this.mode)},setGiven:function(e){return this.given=w.decode(e),this},updateGiven:function(e){return this.given=w.update(this.given,e),this},getGiven:function(){return w.encode(this.given)},setWant:function(e){return this.want=w.decode(e),this},updateWant:function(e){return this.want=w.update(this.want,e),this},getWant:function(){return w.encode(this.want)},updateAll:function(e){return e&&(this.updateGiven(e.given),this.updateWant(e.want),this.mode=this.given&this.want),this},isOwner:function(){return 0!=(this.mode&w._OWNER)},isMuted:function(){return 0==(this.mode&w._PRES)},isPresencer:function(){return 0!=(this.mode&w._PRES)},isJoiner:function(){return 0!=(this.mode&w._JOIN)},isReader:function(){return 0!=(this.mode&w._READ)},isWriter:function(){return 0!=(this.mode&w._WRITE)},isApprover:function(){return 0!=(this.mode&w._APPROVE)},isAdmin:function(){return this.isOwner()||this.isApprover()},isSharer:function(){return 0!=(this.mode&w._SHARE)},isDeleter:function(){return 0!=(this.mode&w._DELETE)}};var E=function(e,t){this._tinode=null,this.name=e,this.created=null,this.updated=null,this.touched=null,this.acs=new w(null),this.private=null,this.public=null,this._users={},this._queuedSeqId=268435455,this._maxSeq=0,this._minSeq=0,this._noEarlierMsgs=!1,this._maxDel=0,this._tags=[],this._messages=function(e){var t=[];function n(t,n,r){for(var o=0,i=n.length-1,a=0,s=0,l=!1;o<=i;)if((s=e(n[a=(o+i)/2|0],t))<0)o=a+1;else{if(!(s>0)){l=!0;break}i=a-1}return l?a:r?-1:s<0?a+1:a}function r(e,t){var r=n(e,t,!1);return t.splice(r,0,e),t}return e=e||function(e,t){return e===t?0:e<t?-1:1},{getAt:function(e){return t[e]},put:function(){var e;for(var n in e=1==arguments.length&&Array.isArray(arguments[0])?arguments[0]:arguments)r(e[n],t)},delAt:function(e){var n=t.splice(e,1);if(n&&n.length>0)return n[0]},delRange:function(e,n){return t.splice(e,n-e)},size:function(){return t.length},reset:function(e){t=[]},forEach:function(e,n,r,o){n|=0,r=r||t.length;for(var i=n;i<r;i++)e.call(o,t[i],i)},find:function(e,r){return n(e,t,!r)}}}(function(e,t){return e.seq-t.seq}),this._subscribed=!1,this._lastDescUpdate=null,this._lastSubsUpdate=null,this._new=!0,t&&(this.onData=t.onData,this.onMeta=t.onMeta,this.onPres=t.onPres,this.onInfo=t.onInfo,this.onMetaDesc=t.onMetaDesc,this.onMetaSub=t.onMetaSub,this.onSubsUpdated=t.onSubsUpdated,this.onTagsUpdated=t.onTagsUpdated,this.onDeleteTopic=t.onDeleteTopic,this.onAllMessagesReceived=t.onAllMessagesReceived)};E.prototype={isSubscribed:function(){return this._subscribed},subscribe:function(e,t){var n=this;if(this._subscribed)return Promise.resolve(this);var r=this.name;return this._tinode.subscribe(r||"new",e,t).then(function(e){if(e.code>=300)return e;if(n._subscribed=!0,n.acs=e.params&&e.params.acs?e.params.acs:n.acs,n._new){n._new=!1,n.name=e.topic,n.created=e.ts,n.updated=e.ts,n.touched=e.ts,n._cachePutSelf();var r=n._tinode.getMeTopic();r&&r._processMetaSub([{_generated:!0,topic:n.name,created:e.ts,updated:e.ts,touched:e.ts,acs:n.acs}]),t&&t.desc&&(t.desc._generated=!0,n._processMetaDesc(t.desc))}return e})},createMessage:function(e,t){return this._tinode.createMessage(this.name,e,t)},publish:function(e,t){return this.publishMessage(this.createMessage(e,t))},publishMessage:function(t){var n=this;if(!this._subscribed)return Promise.reject(new Error("Cannot publish on inactive topic"));if(e.hasAttachments(t.content)&&!t.head.attachments){var r=[];e.attachments(t.content,function(e){r.push(e.ref)}),t.head.attachments=r}return t._sending=!0,this._tinode.publishMessage(t).then(function(e){return t._sending=!1,t.seq=e.params.seq,t.ts=e.ts,n._routeData(t),e}).catch(function(e){t._sending=!1,t._failed=!0})},publishDraft:function(e,t){var n=this;if(!t&&!this._subscribed)return Promise.reject(new Error("Cannot publish on inactive topic"));var r=e.seq||this._getQueuedSeqId();return e._generated||(e._generated=!0,e.seq=r,e.ts=new Date,e.from=this._tinode.getCurrentUserID(),e.noecho=!0,this._messages.put(e),this.onData&&this.onData(e)),(t||Promise.resolve()).then(function(){return e._cancelled?{code:300,text:"cancelled"}:n.publishMessage(e)},function(t){e._sending=!1,n._messages.delAt(n._messages.find(e)),n.onData&&n.onData()})},leave:function(e){var t=this;return this._subscribed||e?this._tinode.leave(this.name,e).then(function(n){return t._resetSub(),e&&t._gone(),n}):Promise.reject(new Error("Cannot leave inactive topic"))},getMeta:function(e){return this._subscribed?this._tinode.getMeta(this.name,e):Promise.reject(new Error("Cannot query inactive topic"))},getMessagesPage:function(e,t){var n=this,r=this.startMetaQuery();t?r.withLaterData(e):r.withEarlierData(e);var o=this.getMeta(r.build());return t||(o=o.then(function(e){e&&e.params&&!e.params.count&&(n._noEarlierMsgs=!0)})),o},setMeta:function(e){var t=this;return this._subscribed?(e.tags&&(e.tags=function(e){var t=[];if(Array.isArray(e)){for(var n=0,r=e.length;n<r;n++){var o=e[n];o&&(o=o.trim().toLowerCase()).length>1&&t.push(o)}t.sort().filter(function(e,t,n){return!t||e!=n[t-1]})}return 0==t.length&&t.push(b.DEL_CHAR),t}(e.tags)),this._tinode.setMeta(this.name,e).then(function(n){return n&&n.code>=300?n:(e.sub&&(n.params&&n.params.acs&&(e.sub.acs=n.params.acs,e.sub.updated=n.ts),e.sub.user||(e.sub.user=t._tinode.getCurrentUserID(),e.desc||(e.desc={})),e.sub._generated=!0,t._processMetaSub([e.sub])),e.desc&&(n.params&&n.params.acs&&(e.desc.acs=n.params.acs,e.desc.updated=n.ts),t._processMetaDesc(e.desc)),e.tags&&t._processMetaTags(e.tags),n)})):Promise.reject(new Error("Cannot update inactive topic"))},invite:function(e,t){return this.setMeta({sub:{user:e,mode:t}})},delMessages:function(e,t){var n=this;if(!this._subscribed)return Promise.reject(new Error("Cannot delete messages in inactive topic"));e.sort(function(e,t){return e.low<t.low||e.low==t.low&&(!t.hi||e.hi>=t.hi)});var r=e.reduce(function(e,t){return t.low<268435455&&(!t.hi||t.hi<268435455?e.push(t):e.push({low:t.low,hi:n._maxSeq+1})),e},[]);return(e.length>0?this._tinode.delMessages(this.name,r,t):Promise.resolve({params:{del:0}})).then(function(t){return t.params.del>n._maxDel&&(n._maxDel=t.params.del),e.map(function(e){e.hi?n.flushMessageRange(e.low,e.hi):n.flushMessage(e.low)}),n.onData&&n.onData(),t})},delMessagesAll:function(e){return this.delMessages([{low:1,hi:this._maxSeq+1,_all:!0}],e)},delMessagesList:function(e,t){e.sort(function(e,t){return e-t});var n=e.reduce(function(e,t){if(0==e.length)e.push({low:t});else{var n=e[e.length-1];!n.hi&&t!=n.low+1||t>n.hi?e.push({low:t}):n.hi=n.hi?Math.max(n.hi,t+1):t+1}return e},[]);return this.delMessages(n,t)},delTopic:function(){var e=this;return this._tinode.delTopic(this.name).then(function(t){return e._resetSub(),e._gone(),t})},delSubscription:function(e){var t=this;return this._subscribed?this._tinode.delSubscription(this.name,e).then(function(n){return delete t._users[e],t.onSubsUpdated&&t.onSubsUpdated(Object.keys(t._users)),n}):Promise.reject(new Error("Cannot delete subscription in inactive topic"))},note:function(e,t){var n=this._users[this._tinode.getCurrentUserID()];n?((!n[e]||n[e]<t)&&(this._subscribed?this._tinode.note(this.name,e,t):this._tinode.logger("Not sending {note} on inactive topic")),n[e]=t):this._tinode.logger("note(): user not found "+this._tinode.getCurrentUserID());var r=this._tinode.getMeTopic();r&&r.setMsgReadRecv(this.name,e,t)},noteRecv:function(e){this.note("recv",e)},noteRead:function(e){this.note("read",e)},noteKeyPress:function(){this._subscribed?this._tinode.noteKeyPress(this.name):this._tinode.logger("Cannot send notification in inactive topic")},userDesc:function(e){var t=this._cacheGetUser(e);if(t)return t},subscribers:function(e,t){var n=e||this.onMetaSub;if(n)for(var r in this._users)n.call(t,this._users[r],r,this._users)},tags:function(){return this._tags.slice(0)},subscriber:function(e){return this._users[e]},messages:function(e,t,n,r){var o=e||this.onData;if(o){var i="number"==typeof t?this._messages.find({seq:t}):void 0,a="number"==typeof n?this._messages.find({seq:n},!0):void 0;-1!=i&&-1!=a&&this._messages.forEach(o,i,a,r)}},queuedMessages:function(e,t){if(!e)throw new Error("Callback must be provided");this.messages(e,268435455,void 0,t)},msgReceiptCount:function(e,t){var n=0,r=this._tinode.getCurrentUserID();if(t>0)for(var o in this._users){var i=this._users[o];i.user!==r&&i[e]>=t&&n++}return n},msgReadCount:function(e){return this.msgReceiptCount("read",e)},msgRecvCount:function(e){return this.msgReceiptCount("recv",e)},msgHasMoreMessages:function(e){return e?this.seq>this._maxSeq:this._minSeq>1&&!this._noEarlierMsgs},isNewMessage:function(e){return this._maxSeq<=e},flushMessage:function(e){var t=this._messages.find({seq:e});return t>=0?this._messages.delAt(t):void 0},flushMessageRange:function(e,t){var n=this._messages.find({seq:e});return n>=0?this._messages.delRange(n,this._messages.find({seq:t},!0)):[]},cancelSend:function(e){var t=this._messages.find({seq:e});if(t>=0){var n=this._messages.getAt(t);if(1==this.msgStatus(n))return n._cancelled=!0,this._messages.delAt(t),!0}return!1},getType:function(){return b.topicType(this.name)},getAccessMode:function(){return this.acs},getDefaultAccess:function(){return this.defacs},startMetaQuery:function(){return new _(this)},msgStatus:function(e){var t=0;return e.from==this._tinode.getCurrentUserID()?e._sending?t=2:e._failed?t=3:e.seq>=268435455?t=1:this.msgReadCount(e.seq)>0?t=6:this.msgRecvCount(e.seq)>0?t=5:e.seq>0&&(t=4):t=7,t},_routeData:function(e){e.content&&((!this.touched||this.touched<e.ts)&&(this.touched=e.ts),e._generated||this._messages.put(e)),e.seq>this._maxSeq&&(this._maxSeq=e.seq),(e.seq<this._minSeq||0==this._minSeq)&&(this._minSeq=e.seq),this.onData&&this.onData(e);var t=this._tinode.getMeTopic();t&&t.setMsgReadRecv(this.name,"msg",e.seq,e.ts)},_routeMeta:function(e){e.desc&&(this._lastDescUpdate=e.ts,this._processMetaDesc(e.desc)),e.sub&&e.sub.length>0&&(this._lastSubsUpdate=e.ts,this._processMetaSub(e.sub)),e.del&&this._processDelMessages(e.del.clear,e.del.delseq),e.tags&&this._processMetaTags(e.tags),this.onMeta&&this.onMeta(e)},_routePres:function(e){var t;switch(e.what){case"del":this._processDelMessages(e.clear,e.delseq);break;case"on":case"off":(t=this._users[e.src])?t.online="on"==e.what:this._tinode.logger("Presence update for an unknown user",this.name,e.src);break;case"acs":var n="me"==e.src?this._tinode.getCurrentUserID():e.src;if(t=this._users[n])t.acs.updateAll(e.dacs),n==this._tinode.getCurrentUserID()&&this.acs.updateAll(e.dacs),t.acs&&t.acs.mode!=w._NONE||("p2p"==this.getType()&&this.leave(),this._processMetaSub([{user:n,deleted:new Date,_generated:!0}]));else{var r=(new w).updateAll(e.dacs);r&&r.mode!=w._NONE&&((t=this._cacheGetUser(n))?t.acs=r:(t={user:n,acs:r},this.getMeta(this.startMetaQuery().withOneSub(void 0,n).build())),t._generated=!0,t.updated=new Date,this._processMetaSub([t]))}break;default:this._tinode.logger("Ignored presence update",e.what)}this.onPres&&this.onPres(e)},_routeInfo:function(e){if("kp"!==e.what){var t=this._users[e.from];t&&(t[e.what]=e.seq)}this.onInfo&&this.onInfo(e)},_processMetaDesc:function(e,t){if(p(this,e),"string"==typeof this.created&&(this.created=new Date(this.created)),"string"==typeof this.updated&&(this.updated=new Date(this.updated)),"string"==typeof this.touched&&(this.touched=new Date(this.touched)),"me"!==this.name&&!t&&!e._generated){var n=this._tinode.getMeTopic();n&&n._processMetaSub([{_generated:!0,topic:this.name,updated:this.updated,touched:this.touched,acs:this.acs,public:this.public,private:this.private}])}this.onMetaDesc&&this.onMetaDesc(this)},_processMetaSub:function(e){var t=void 0;for(var n in e){var r=e[n];if(r.user){r.updated=new Date(r.updated),r.deleted=r.deleted?new Date(r.deleted):null;var o=null;r.deleted?(delete this._users[r.user],o=r):((o=this._users[r.user])||(o=this._cacheGetUser(r.user)),o=this._updateCachedUser(r.user,r,r._generated)),this.onMetaSub&&this.onMetaSub(o)}else r._generated||(t=r)}t&&this.onMetaDesc&&this.onMetaDesc(t),this.onSubsUpdated&&this.onSubsUpdated(Object.keys(this._users))},_processMetaTags:function(e){1==e.length&&e[0]==b.DEL_CHAR&&(e=[]),this._tags=e,this.onTagsUpdated&&this.onTagsUpdated(e)},_processDelMessages:function(e,t){this._maxDel=Math.max(e,this._maxDel),this.clear=Math.max(e,this.clear);var n=this,r=0;Array.isArray(t)&&t.map(function(e){if(e.hi)for(var t=e.low;t<e.hi;t++)r++,n.flushMessage(t);else r++,n.flushMessage(e.low)}),r>0&&this.onData&&this.onData()},_allMessagesReceived:function(e){this.onAllMessagesReceived&&this.onAllMessagesReceived(e)},_resetSub:function(){this._subscribed=!1},_gone:function(){this._messages.reset(),this._users={},this.acs=new w(null),this.private=null,this.public=null,this._maxSeq=0,this._minSeq=0,this._subscribed=!1;var e=this._tinode.getMeTopic();e&&e._routePres({_generated:!0,what:"gone",topic:"me",src:this.name}),this.onDeleteTopic&&this.onDeleteTopic()},_updateCachedUser:function(e,t,n){var r=this._cacheGetUser(e);return r?r=p(r,t):(n&&this.getMeta(this.startMetaQuery().withLaterOneSub(e).build()),r=p({},t)),this._cachePutUser(e,r),f(this._users,e,r)},_getQueuedSeqId:function(){return this._queuedSeqId++}};var S=function(e){E.call(this,"me",e),this._contacts={},e&&(this.onContactUpdate=e.onContactUpdate)};S.prototype=Object.create(E.prototype,{_processMetaSub:{value:function(e){var t=0;for(var n in e){var r=e[n],o=r.topic;if("fnd"!=o&&"me"!=o){r.updated=new Date(r.updated),r.touched=r.touched?new Date(r.touched):null,r.deleted=r.deleted?new Date(r.deleted):null,r.seq=0|r.seq,r.recv=0|r.recv,r.read=0|r.read,r.unread=r.seq-r.read;var i=null;if(r.deleted)i=r,delete this._contacts[o];else if(r.seen&&r.seen.when&&(r.seen.when=new Date(r.seen.when)),i=f(this._contacts,o,r),"p2p"==b.topicType(o)&&this._cachePutUser(o,i),!r._generated){var a=this._tinode.getTopic(o);a&&a._processMetaDesc(r,!0)}t++,this.onMetaSub&&this.onMetaSub(i)}}t>0&&this.onSubsUpdated&&this.onSubsUpdated(Object.keys(this._contacts))},enumerable:!0,configurable:!0,writable:!1},_routePres:{value:function(e){var t=this._contacts[e.src];if(t){switch(e.what){case"on":t.online=!0;break;case"off":t.online&&(t.online=!1,t.seen?t.seen.when=new Date:t.seen={when:new Date});break;case"msg":t.touched=new Date,t.seq=0|e.seq,t.unread=t.seq-t.read;break;case"upd":this.getMeta(this.startMetaQuery().withLaterOneSub(e.src).build());break;case"acs":t.acs?t.acs.updateAll(e.dacs):t.acs=(new w).updateAll(e.dacs);break;case"ua":t.seen={when:new Date,ua:e.ua};break;case"recv":t.recv=t.recv?Math.max(t.recv,e.seq):0|e.seq;break;case"read":t.read=t.read?Math.max(t.read,e.seq):0|e.seq,t.unread=t.seq-t.read;break;case"gone":delete this._contacts[e.src]}this.onContactUpdate&&this.onContactUpdate(e.what,t)}else if("acs"==e.what){var n=new w(e.dacs);if(!n||n.mode==w._INVALID)return void this._tinode.logger("Invalid access mode update",e.src,e.dacs);if(n.mode==w._NONE)return void this._tinode.logger("Removing non-existent subscription",e.src,e.dacs);this.getMeta(this.startMetaQuery().withOneSub(void 0,e.src).build()),this._contacts[e.src]={topic:e.src,online:!1,acs:n}}this.onPres&&this.onPres(e)},enumerable:!0,configurable:!0,writable:!1},publish:{value:function(){return Promise.reject(new Error("Publishing to 'me' is not supported"))},enumerable:!0,configurable:!0,writable:!1},contacts:{value:function(e,t){var n=e||this.onMetaSub;if(n)for(var r in this._contacts)n.call(t,this._contacts[r],r,this._contacts)},enumerable:!0,configurable:!0,writable:!0},setMsgReadRecv:{value:function(e,t,n,r){var o,i=this._contacts[e],a=!1;i&&(n|=0,"recv"===t?(o=i.recv,i.recv=i.recv?Math.max(i.recv,n):n,a=o!=i.recv):"read"===t?(o=i.read,i.read=i.read?Math.max(i.read,n):n,i.unread=i.seq-i.read,a=o!=i.read,i.recv<i.read&&(i.recv=i.read,a=!0)):"msg"===t&&(o=i.seq,i.seq=i.seq?Math.max(i.seq,n):n,i.unread=i.seq-i.read,(!i.touched||i.touched<r)&&(i.touched=r),a=o!=i.seq),!a||i.acs&&i.acs.isMuted()||!this.onContactUpdate||this.onContactUpdate(t,i))},enumerable:!0,configurable:!0,writable:!0},getContact:{value:function(e){return this._contacts[e]},enumerable:!0,configurable:!0,writable:!0},getAccessMode:{value:function(e){var t=this._contacts[e];return t?t.acs:null},enumerable:!0,configurable:!0,writable:!0}}),S.prototype.constructor=S;var T=function(e){E.call(this,"fnd",e),this._contacts={}};T.prototype=Object.create(E.prototype,{_processMetaSub:{value:function(e){var t=Object.getOwnPropertyNames(this._contacts).length;for(var n in this._contacts={},e){var r=e[n],o=r.topic?r.topic:r.user;r.updated=new Date(r.updated),r.seen&&r.seen.when&&(r.seen.when=new Date(r.seen.when)),r=f(this._contacts,o,r),t++,this.onMetaSub&&this.onMetaSub(r)}t>0&&this.onSubsUpdated&&this.onSubsUpdated(Object.keys(this._contacts))},enumerable:!0,configurable:!0,writable:!1},publish:{value:function(){return Promise.reject(new Error("Publishing to 'fnd' is not supported"))},enumerable:!0,configurable:!0,writable:!1},setMeta:{value:function(e){var t=this;return Object.getPrototypeOf(T.prototype).setMeta.call(this,e).then(function(){Object.keys(t._contacts).length>0&&(t._contacts={},t.onSubsUpdated&&t.onSubsUpdated([]))})},enumerable:!0,configurable:!0,writable:!1},contacts:{value:function(e,t){var n=e||this.onMetaSub;if(n)for(var r in this._contacts)n.call(t,this._contacts[r],r,this._contacts)},enumerable:!0,configurable:!0,writable:!0}}),T.prototype.constructor=T;var k=function(e){this._tinode=e,this._apiKey=e._apiKey,this._authToken=e.getAuthToken(),this._msgId=e.getNextUniqueId(),this.xhr=h(),this.toResolve=null,this.toReject=null,this.onProgress=null,this.onSuccess=null,this.onFailure=null};k.prototype={upload:function(e,t,n,r){var o=this;if(!this._authToken)throw new Error("Must authenticate first");var a=this;this.xhr.open("POST","/v"+i+"/file/u/",!0),this.xhr.setRequestHeader("X-Tinode-APIKey",this._apiKey),this.xhr.setRequestHeader("X-Tinode-Auth","Token "+this._authToken.token);var s=new Promise(function(e,t){o.toResolve=e,o.toReject=t});this.onProgress=t,this.onSuccess=n,this.onFailure=r,this.xhr.upload.onprogress=function(e){e.lengthComputable&&a.onProgress&&a.onProgress(e.loaded/e.total)},this.xhr.onload=function(){var e;try{e=JSON.parse(this.response,m)}catch(e){a._tinode.logger("Invalid server response in LargeFileHelper",this.response)}this.status>=200&&this.status<300?(a.toResolve&&a.toResolve(e.ctrl.params.url),a.onSuccess&&a.onSuccess(e.ctrl)):this.status>=400?(a.toReject&&a.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")")),a.onFailure&&a.onFailure(e.ctrl)):a._tinode.logger("Unexpected server response status",this.status,this.response)},this.xhr.onerror=function(e){a.toReject&&a.toReject(new Error("failed")),a.onFailure&&a.onFailure(null)},this.xhr.onabort=function(e){a.toReject&&a.toReject(new Error("upload cancelled by user")),a.onFailure&&a.onFailure(null)};try{var l=new FormData;l.append("file",e),l.set("id",this._msgId),this.xhr.send(l)}catch(e){this.toReject&&this.toReject(e),this.onFailure&&this.onFailure(null)}return s},download:function(e,t,n,r){var o=this;if(/^(?:(?:[a-z]+:)?\/\/)/i.test(e))throw new Error("The URL '"+e+"' must be relative, not absolute");if(!this._authToken)throw new Error("Must authenticate first");var i=this;this.xhr.open("GET",e,!0),this.xhr.setRequestHeader("X-Tinode-APIKey",this._apiKey),this.xhr.setRequestHeader("X-Tinode-Auth","Token "+this._authToken.token),this.xhr.responseType="blob",this.onProgress=r,this.xhr.onprogress=function(e){i.onProgress&&i.onProgress(e.loaded)};var a=new Promise(function(e,t){o.toResolve=e,o.toReject=t});this.xhr.onload=function(){if(200==this.status){var e=document.createElement("a");e.href=window.URL.createObjectURL(new Blob([this.response],{type:n})),e.style.display="none",e.setAttribute("download",t),document.body.appendChild(e),e.click(),document.body.removeChild(e),window.URL.revokeObjectURL(e.href),i.toResolve&&i.toResolve()}else if(this.status>=400&&i.toReject){var r=new FileReader;r.onload=function(){try{var e=JSON.parse(this.result,m);i.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")"))}catch(e){i._tinode.logger("Invalid server response in LargeFileHelper",this.result),i.toReject(e)}},r.readAsText(this.response)}},this.xhr.onerror=function(e){i.toReject&&i.toReject(new Error("failed"))},this.xhr.onabort=function(){i.toReject&&i.toReject(null)};try{this.xhr.send()}catch(e){this.toReject&&this.toReject(e)}return a},cancel:function(){this.xhr&&this.xhr.readyState<4&&this.xhr.abort()},getId:function(){return this._msgId}};var C=function e(t,n){this.status=e.STATUS_NONE,this.topic=t,this.content=n};C.STATUS_NONE=0,C.STATUS_QUEUED=1,C.STATUS_SENDING=2,C.STATUS_FAILED=3,C.STATUS_SENT=4,C.STATUS_RECEIVED=5,C.STATUS_READ=6,C.STATUS_TO_ME=7,(C.prototype={toJSON:function(){},fromJSON:function(e){}}).constructor=C,(l=b).Drafty=e}.call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),l}()}).call(this,n(10))},function(e,t,n){e.exports=n(38)()},function(e,t,n){"use strict";!function e(){if("undefined"!=typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(e){console.error(e)}}(),e.exports=n(21)},function(e,t,n){"use strict";var r=n(24).default;n(31),(t=e.exports=r).default=t},function(e,t,n){"use strict";(t=e.exports=n(40).default).default=t},function(e,t,n){"use strict";var r=n(32).default;n(37),(t=e.exports=r).default=t},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},i=function(e,t){if(!e)throw a(t)},a=function(e){return new Error("Firebase Database ("+o.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},s=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var o=e.charCodeAt(r);o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):55296==(64512&o)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++r)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t},l={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],o=0;o<e.length;o+=3){var i=e[o],a=o+1<e.length,s=a?e[o+1]:0,l=o+2<e.length,u=l?e[o+2]:0,c=i>>2,d=(3&i)<<4|s>>4,p=(15&s)<<2|u>>6,f=63&u;l||(f=64,a||(p=64)),r.push(n[c],n[d],n[p],n[f])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n<e.length;){var o=e[n++];if(o<128)t[r++]=String.fromCharCode(o);else if(o>191&&o<224){var i=e[n++];t[r++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){var a=((7&o)<<18|(63&(i=e[n++]))<<12|(63&(s=e[n++]))<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(a>>10)),t[r++]=String.fromCharCode(56320+(1023&a))}else{i=e[n++];var s=e[n++];t[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],o=0;o<e.length;){var i=n[e.charAt(o++)],a=o<e.length?n[e.charAt(o)]:0,s=++o<e.length?n[e.charAt(o)]:64,l=++o<e.length?n[e.charAt(o)]:64;if(++o,null==i||null==a||null==s||null==l)throw Error();var u=i<<2|a>>4;if(r.push(u),64!=s){var c=a<<4&240|s>>2;if(r.push(c),64!=l){var d=s<<6&192|l;r.push(d)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},u=function(e){try{return l.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var n in t)t.hasOwnProperty(n)&&(e[n]=c(e[n],t[n]));return e}var d=function(){function e(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=n})}return e.prototype.wrapCallback=function(e){var t=this;return function(n,r){n?t.reject(n):t.resolve(r),"function"==typeof e&&(t.promise.catch(function(){}),1===e.length?e(n):e(n,r))}},e}(),p=function(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""},f="FirebaseError",h=Error.captureStackTrace;var m=function(){return function(e,t){if(this.code=e,this.message=t,h)h(this,y.prototype.create);else try{throw Error.apply(this,arguments)}catch(e){this.name=f,Object.defineProperty(this,"stack",{get:function(){return e.stack}})}}}();m.prototype=Object.create(Error.prototype),m.prototype.constructor=m,m.prototype.name=f;var y=function(){function e(e,t,n){this.service=e,this.serviceName=t,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return e.prototype.create=function(e,t){void 0===t&&(t={});var n,r=this.errors[e],o=this.service+"/"+e;n=void 0===r?"Error":r.replace(this.pattern,function(e,n){var r=t[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+o+").";var i=new m(o,n);for(var a in t)t.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(i[a]=t[a]);return i},e}();function v(e){return JSON.parse(e)}var g=function(e){var t={},n={},r={},o="";try{var i=e.split(".");t=v(u(i[0])||""),n=v(u(i[1])||""),o=i[2],r=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:o}},b=function(e,t){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])},_=function(e,t){return b(t,function(t,n){e[t]=n}),e},w=function(e,t,n){for(var r in e)if(t.call(n,e[r],r,e))return r},E=function(e){function t(){var t=e.call(this)||this;t.chain_=[],t.buf_=[],t.W_=[],t.pad_=[],t.inbuf_=0,t.total_=0,t.blockSize=64,t.pad_[0]=128;for(var n=1;n<t.blockSize;++n)t.pad_[n]=0;return t.reset(),t}return r.__extends(t,e),t.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},t.prototype.compress_=function(e,t){t||(t=0);var n=this.W_;if("string"==typeof e)for(var r=0;r<16;r++)n[r]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(r=0;r<16;r++)n[r]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(r=16;r<80;r++){var o=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(o<<1|o>>>31)}var i,a,s=this.chain_[0],l=this.chain_[1],u=this.chain_[2],c=this.chain_[3],d=this.chain_[4];for(r=0;r<80;r++){r<40?r<20?(i=c^l&(u^c),a=1518500249):(i=l^u^c,a=1859775393):r<60?(i=l&u|c&(l|u),a=2400959708):(i=l^u^c,a=3395469782);o=(s<<5|s>>>27)+i+d+a+n[r]&4294967295;d=c,c=u,u=4294967295&(l<<30|l>>>2),l=s,s=o}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+l&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+c&4294967295,this.chain_[4]=this.chain_[4]+d&4294967295},t.prototype.update=function(e,t){if(null!=e){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=0,o=this.buf_,i=this.inbuf_;r<t;){if(0==i)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(o[i]=e.charCodeAt(r),++r,++i==this.blockSize){this.compress_(o),i=0;break}}else for(;r<t;)if(o[i]=e[r],++r,++i==this.blockSize){this.compress_(o),i=0;break}}this.inbuf_=i,this.total_+=t}},t.prototype.digest=function(){var e=[],t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&t,t/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var o=24;o>=0;o-=8)e[r]=this.chain_[n]>>o&255,++r;return e},t}(function(){return function(){this.blockSize=-1}}());var S=function(){function e(e,t){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(n)}).catch(function(e){n.error(e)})}return e.prototype.next=function(e){this.forEachObserver(function(t){t.next(e)})},e.prototype.error=function(e){this.forEachObserver(function(t){t.error(e)}),this.close(e)},e.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},e.prototype.subscribe=function(e,t,n){var r,o=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n<r.length;n++){var o=r[n];if(o in e&&"function"==typeof e[o])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:n}).next&&(r.next=T),void 0===r.error&&(r.error=T),void 0===r.complete&&(r.complete=T);var i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{o.finalError?r.error(o.finalError):r.complete()}catch(e){}}),this.observers.push(r),i},e.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},e.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},e.prototype.sendOne=function(e,t){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[e])try{t(n.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},e.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},e}();function T(){}function k(e,t,n){var r="";switch(t){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4. Need to update it?")}var o=e+" failed: ";return o+=r+" argument "}t.assert=i,t.assertionError=a,t.base64=l,t.base64Decode=u,t.base64Encode=function(e){var t=s(e);return l.encodeByteArray(t,!0)},t.CONSTANTS=o,t.deepCopy=function(e){return c(void 0,e)},t.deepExtend=c,t.patchProperty=function(e,t,n){e[t]=n},t.Deferred=d,t.getUA=p,t.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(p())},t.isNodeSdk=function(){return!0===o.NODE_CLIENT||!0===o.NODE_ADMIN},t.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},t.ErrorFactory=y,t.FirebaseError=m,t.patchCapture=function(e){var t=h;return h=e,t},t.jsonEval=v,t.stringify=function(e){return JSON.stringify(e)},t.decode=g,t.isAdmin=function(e){var t=g(e).claims;return"object"==typeof t&&!0===t.admin},t.issuedAtTime=function(e){var t=g(e).claims;return"object"==typeof t&&t.hasOwnProperty("iat")?t.iat:null},t.isValidFormat=function(e){var t=g(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")},t.isValidTimestamp=function(e){var t,n,r=g(e).claims,o=Math.floor((new Date).getTime()/1e3);return"object"==typeof r&&(r.hasOwnProperty("nbf")?t=r.nbf:r.hasOwnProperty("iat")&&(t=r.iat),n=r.hasOwnProperty("exp")?r.exp:t+86400),o&&t&&n&&o>=t&&o<=n},t.clone=function(e){return _({},e)},t.contains=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.every=function(e,t){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!t(n,e[n]))return!1;return!0},t.extend=_,t.findKey=w,t.findValue=function(e,t,n){var r=w(e,t,n);return r&&e[r]},t.forEach=b,t.getAnyKey=function(e){for(var t in e)return t},t.getCount=function(e){var t=0;for(var n in e)t++;return t},t.getValues=function(e){var t=[],n=0;for(var r in e)t[n++]=e[r];return t},t.isEmpty=function(e){for(var t in e)return!1;return!0},t.isNonNullObject=function(e){return"object"==typeof e&&null!==e},t.map=function(e,t,n){var r={};for(var o in e)r[o]=t.call(n,e[o],o,e);return r},t.safeGet=function(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]},t.querystring=function(e){var t=[];return b(e,function(e,n){Array.isArray(n)?n.forEach(function(n){t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}):t.push(encodeURIComponent(e)+"="+encodeURIComponent(n))}),t.length?"&"+t.join("&"):""},t.querystringDecode=function(e){var t={};return e.replace(/^\?/,"").split("&").forEach(function(e){if(e){var n=e.split("=");t[n[0]]=n[1]}}),t},t.Sha1=E,t.async=function(e,t){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];Promise.resolve(!0).then(function(){e.apply(void 0,n)}).catch(function(e){t&&t(e)})}},t.createSubscribe=function(e,t){var n=new S(e,t);return n.subscribe.bind(n)},t.errorPrefix=k,t.validateArgCount=function(e,t,n,r){var o;if(r<t?o="at least "+t:r>n&&(o=0===n?"none":"no more than "+n),o)throw new Error(e+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+o+".")},t.validateCallback=function(e,t,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(k(e,t,r)+"must be a valid function.")},t.validateContextObject=function(e,t,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(k(e,t,r)+"must be a valid context object.")},t.validateNamespace=function(e,t,n,r){if((!r||n)&&"string"!=typeof n)throw new Error(k(e,t,r)+"must be a valid firebase namespace.")},t.stringLength=function(e){for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t},t.stringToByteArray=function(e){for(var t=[],n=0,r=0;r<e.length;r++){var o=e.charCodeAt(r);if(o>=55296&&o<=56319){var a=o-55296;i(++r<e.length,"Surrogate pair missing trail surrogate."),o=65536+(a<<10)+(e.charCodeAt(r)-56320)}o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):o<65536?(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t}},function(e,t,n){"use strict";e.exports=function(e,t,n,r,o,i,a,s){if(!e){var l;if(void 0===t)l=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var u=[n,r,o,i,a,s],c=0;(l=new Error(t.replace(/%s/g,function(){return u[c++]}))).name="Invariant Violation"}throw l.framesToPop=1,l}}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e){e.exports={en:{contacts_not_found:"You have no chats<br />¯\\\\_(ツ)_/¯",full_name_prompt:"Full name, e.g. John Doe",email_prompt:"Email, e.g. jdoe@example.com",button_sign_up:"Sign up",label_your_name:"Your name",label_password:"Password",password_unchanged_prompt:"Unchanged",label_user_id:"Address:",label_default_access_mode:"Default access mode:",label_message_sound:"Message sound:",label_push_notifications:"Notification alerts:",label_push_notifications_disabled:"Notification alerts (requires HTTPS):",title_tag_manager:"Tags (user discovery)",button_logout:"Logout",requested_permissions:"Requested",granted_permissions:"Granted",menu_item_edit_permissions:"Edit permissions",label_other_user:"Other",title_info:"Info",label_topic_name:"Name",label_private:"Private comment",private_editing_placeholder:"Visible to you only",label_muting_topic:"Muted:",action_more:"More",label_your_permissions:"Your permissions:",label_permissions:"Permissions:",label_you:"You:",label_default_access:"Default access mode:",label_group_members:"Group members:",button_add_members:"Add members",button_leave:"Leave",group_has_no_members:"No members",action_leave_chat:"Leave",login_prompt:"Login",password_prompt:"Password",stay_logged_in:"Stay logged in",forgot_password_link:"Forgot password?",button_sign_in:"Sign in",label_client:"Client:",label_server:"Server:",online_now:"online now",last_seen_timestamp:"Last seen",title_not_found:"Not found",unnamed_topic:"Unnamed",messages_not_readable:"no access to messages",tabtitle_find_user:"find",tabtitle_new_group:"new group",tabtitle_group_by_id:"by id",search_for_contacts:"Use search to find contacts",label_server_to_use:"Server to use:",label_wire_transport:"Wire transport:",button_update:"Update",sidepanel_title_login:"Sign In",sidepanel_title_register:"Create Account",sidepanel_title_settings:"Settings",sidepanel_title_edit_account:"Edit Account",sidepanel_title_newtpk:"Start New Chat",sidepanel_title_cred:"Confirm Credentials",sidepanel_title_reset:"Reset Password",phone_dative:"phone",email_dative:"email",enter_confirmation_code_prompt:"Enter confirmation code sent to you by {method}:",numeric_confirmation_code_prompt:"Numbers only",button_confirm:"Confirm",invalid_content:"invalid content",menu_item_info:"Info",menu_item_clear_messages:"Clear messages",menu_item_clear_messages_for_all:"Clear for All",menu_item_delete:"Delete",menu_item_delete_for_all:"Delete for All",menu_item_mute:"Mute",menu_item_unmute:"Unmute",menu_item_delete_topic:"Delete",menu_item_unblock:"Unblock",menu_item_block:"Block",menu_item_member_delete:"Remove",title_group_members:"Group members",button_ok:"OK",button_cancel:"Cancel",download_action:"download",label_file_name:"File name:",label_content_type:"Content type:",label_size:"Size:",permission_join:"Join ({val})",permission_read:"Read ({val})",permission_write:"Write ({val})",permission_pres:"Get notified ({val})",permission_admin:"Approve ({val})",permission_share:"Share ({val})",permission_delete:"Delete ({val})",permission_owner:"Owner ({val})",title_permissions:"Permissions",message_sending:"sending...",message_sending_failed:"failed",search_placeholder:"List like email:alice@example.com, tel:17025550003...",messaging_disabled_prompt:"Messaging disabled",new_message_prompt:"New message",file_attachment_too_large:"The file size {size} exceeds the {limit} limit.",cannot_initiate_file_upload:"Cannot initiate file upload.",tags_not_found:"No tags defined. Add some.",tags_editor_no_tags:"Add some tags",title_manage_tags:"Manage tags"},ru:{contacts_not_found:"Чатов нет<br />¯\\\\_(ツ)_/¯",full_name_prompt:"Полное имя, напр. Иван Петров",email_prompt:"Email, напр. ivan@example.com",button_sign_up:"Создать счет",label_your_name:"Ваше имя",label_password:"Пароль",password_unchanged_prompt:"Не изменен",label_user_id:"Адрес:",label_default_access_mode:"Доступ по умолчанию:",label_message_sound:"Звук нового сообщения:",label_push_notifications:"Уведомления:",label_push_notifications_disabled:"Уведомления (требуют HTTPS):",title_tag_manager:"Таги для поиска",button_logout:"Выйти",login_prompt:"Логин",password_prompt:"Пароль",stay_logged_in:"Запомнить",forgot_password_link:"Напомнить пароль",button_sign_in:"Войти",label_client:"Клиент:",label_server:"Сервер:",online_now:"онлайн",last_seen_timestamp:"Был активен",title_not_found:"Не найден",unnamed_topic:"Без названия",messages_not_readable:"нет доступа к сообщениям",tabtitle_find_user:"найти",tabtitle_new_group:"создать",tabtitle_group_by_id:"по id",label_server_to_use:"Использовать сервер:",label_wire_transport:"Соединение:",button_update:"Применить",sidepanel_title_login:"Авторизация",sidepanel_title_register:"Зарегистрироваться",sidepanel_title_settings:"Настройки",sidepanel_title_edit_account:"Редактировать счет",sidepanel_title_newtpk:"Новый чат",sidepanel_title_cred:"Подтвердить",sidepanel_title_reset:"Сменить пароль",tags_not_found:"Тагов нет. Добавьте",tags_editor_no_tags:"Добавьте таги",title_manage_tags:"Редактор тагов",message_sending:"в пути...",message_sending_failed:"ошибка",search_placeholder:"Список, напр. email:alice@example.com, tel:17025550003...",messaging_disabled_prompt:"Отправка недоступна",new_message_prompt:"Новое сообщение",file_attachment_too_large:"Размер файла {size} превышает {limit} лимит.",cannot_initiate_file_upload:"Ошибка загрузки файла.",search_for_contacts:"Поиск контактов",enter_confirmation_code_prompt:"Код подтверждения, полученный по {method}:",numeric_confirmation_code_prompt:"Только цифры",button_confirm:"Подтвердить",button_ok:"OK",button_cancel:"Отменить",invalid_content:"сообщение не читается",label_file_name:"Имя файла:",label_content_type:"Тип:",label_size:"Размер:",phone_dative:"телефону",email_dative:"емейлу",title_group_members:"Участники",download_action:"скачать",permission_join:"Присоединяться ({val})",permission_read:"Читать ({val})",permission_write:"Писать ({val})",permission_pres:"Уведомлять ({val})",permission_admin:"Подтверждать ({val})",permission_share:"Приглашать ({val})",permission_delete:"Удалять ({val})",permission_owner:"Владелец ({val})",title_permissions:"Права доступа",requested_permissions:"Требуются",granted_permissions:"Получены",menu_item_edit_permissions:"Права доступа",label_other_user:"Второй",label_topic_name:"Название",label_private:"Комментарий",private_editing_placeholder:"Виден только вам",label_muting_topic:"Без уведомлений",action_more:"Ещё",label_your_permissions:"Ваши права доступа:",label_permissions:"Права доступа:",label_you:"Вы:",label_default_access:"Права по умолчанию:",label_group_members:"Участники чата:",button_add_members:"Добавить",button_leave:"Отписаться",group_has_no_members:"Нет участников",action_leave_chat:"Уйти из чата",menu_item_info:"Информация",menu_item_clear_messages:"Удалить сообщения",menu_item_clear_messages_for_all:"Удалить для всех",menu_item_delete:"Удалить",menu_item_delete_for_all:"Удалить для всех",menu_item_mute:"Не уведомлять",menu_item_unmute:"Уведомлять",menu_item_delete_topic:"Удалить",menu_item_unblock:"Разблокировать",menu_item_block:"Заблокировать",menu_item_member_delete:"Отписать",title_info:"Подробности"}}},function(e,t,n){"use strict";n(42);var r=function(e){return e&&"object"==typeof e&&"default"in e?e.default:e}(n(13));e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(8),o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i="[DEFAULT]",a=[],s=function(){function e(e,t,n){this.firebase_=n,this.isDeleted_=!1,this.services_={},this.name_=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled||!1,this.options_=r.deepCopy(e),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(e){a.push(e),setTimeout(function(){return e(null)},0)},removeAuthTokenListener:function(e){a=a.filter(function(t){return t!==e})}}}return Object.defineProperty(e.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed_(),this._automaticDataCollectionEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),e.prototype.delete=function(){var e=this;return new Promise(function(t){e.checkDestroyed_(),t()}).then(function(){e.firebase_.INTERNAL.removeApp(e.name_);var t=[];return Object.keys(e.services_).forEach(function(n){Object.keys(e.services_[n]).forEach(function(r){t.push(e.services_[n][r])})}),Promise.all(t.map(function(e){return e.INTERNAL.delete()}))}).then(function(){e.isDeleted_=!0,e.services_={}})},e.prototype._getService=function(e,t){if(void 0===t&&(t=i),this.checkDestroyed_(),this.services_[e]||(this.services_[e]={}),!this.services_[e][t]){var n=t!==i?t:void 0,r=this.firebase_.INTERNAL.factories[e](this,this.extendApp.bind(this),n);this.services_[e][t]=r}return this.services_[e][t]},e.prototype.extendApp=function(e){var t=this;r.deepExtend(this,e),e.INTERNAL&&e.INTERNAL.addAuthTokenListener&&(a.forEach(function(e){t.INTERNAL.addAuthTokenListener(e)}),a=[])},e.prototype.checkDestroyed_=function(){this.isDeleted_&&l("app-deleted",{name:this.name_})},e}();function l(e,t){throw u.create(e,t)}s.prototype.name&&s.prototype.options||s.prototype.delete||console.log("dc");var u=new r.ErrorFactory("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."}),c=function e(){var t={},n={},a={},u={__esModule:!0,initializeApp:function(e,n){if(void 0===n&&(n={}),"object"!=typeof n||null===n){var r=n;n={name:r}}var a=n;void 0===a.name&&(a.name=i);var c=a.name;"string"==typeof c&&c||l("bad-app-name",{name:c+""}),o(t,c)&&l("duplicate-app",{name:c});var d=new s(e,a,u);return t[c]=d,p(d,"create"),d},app:c,apps:null,Promise:Promise,SDK_VERSION:"5.5.0",INTERNAL:{registerService:function(e,t,o,i,p){n[e]&&l("duplicate-service",{name:e}),n[e]=t,i&&(a[e]=i,d().forEach(function(e){i("create",e)}));var f=function(t){return void 0===t&&(t=c()),"function"!=typeof t[e]&&l("invalid-app-argument",{name:e}),t[e]()};return void 0!==o&&r.deepExtend(f,o),u[e]=f,s.prototype[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._getService.bind(this,e).apply(this,p?t:[])},f},createFirebaseNamespace:e,extendNamespace:function(e){r.deepExtend(u,e)},createSubscribe:r.createSubscribe,ErrorFactory:r.ErrorFactory,removeApp:function(e){p(t[e],"delete"),delete t[e]},factories:n,useAsService:f,Promise:Promise,deepExtend:r.deepExtend}};function c(e){return o(t,e=e||i)||l("no-app",{name:e}),t[e]}function d(){return Object.keys(t).map(function(e){return t[e]})}function p(e,t){Object.keys(n).forEach(function(n){var r=f(e,n);null!==r&&a[r]&&a[r](t,e)})}function f(e,t){if("serverAuth"===t)return null;var n=t;return e.options,n}return r.patchProperty(u,"default",u),Object.defineProperty(u,"apps",{get:d}),r.patchProperty(c,"App",s),u}();t.firebase=c,t.default=c},function(e,t,n){"use strict";
|
||
/*
|
||
object-assign
|
||
(c) Sindre Sorhus
|
||
@license MIT
|
||
*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,s=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),l=1;l<arguments.length;l++){for(var u in n=Object(arguments[l]))o.call(n,u)&&(s[u]=n[u]);if(r){a=r(n);for(var c=0;c<a.length;c++)i.call(n,a[c])&&(s[a[c]]=n[a[c]])}}return s}},function(e,t,n){"use strict";t.extend=function(e){var t,n,o,i,a=Array.prototype.slice.call(arguments,1);for(t=0,n=a.length;t<n;t+=1)if(o=a[t])for(i in o)r.call(o,i)&&(e[i]=o[i]);return e};var r=Object.prototype.hasOwnProperty;t.hop=r},function(e,t){},function(e,t,n){"use strict";var r={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i=Object.defineProperty,a=Object.getOwnPropertyNames,s=Object.getOwnPropertySymbols,l=Object.getOwnPropertyDescriptor,u=Object.getPrototypeOf,c=u&&u(Object);e.exports=function e(t,n,d){if("string"!=typeof n){if(c){var p=u(n);p&&p!==c&&e(t,p,d)}var f=a(n);s&&(f=f.concat(s(n)));for(var h=0;h<f.length;++h){var m=f[h];if(!(r[m]||o[m]||d&&d[m])){var y=l(n,m);try{i(t,m,y)}catch(e){}}}return t}return t}},function(e,t,n){e.exports=function(){"use strict";return[{locale:"ru",pluralRuleFunction:function(e,t){var n=String(e).split("."),r=n[0],o=!n[1],i=r.slice(-1),a=r.slice(-2);return t?"other":o&&1==i&&11!=a?"one":o&&i>=2&&i<=4&&(a<12||a>14)?"few":o&&0==i||o&&i>=5&&i<=9||o&&a>=11&&a<=14?"many":"other"},fields:{year:{displayName:"год",relative:{0:"в этом году",1:"в следующем году","-1":"в прошлом году"},relativeTime:{future:{one:"через {0} год",few:"через {0} года",many:"через {0} лет",other:"через {0} года"},past:{one:"{0} год назад",few:"{0} года назад",many:"{0} лет назад",other:"{0} года назад"}}},month:{displayName:"месяц",relative:{0:"в этом месяце",1:"в следующем месяце","-1":"в прошлом месяце"},relativeTime:{future:{one:"через {0} месяц",few:"через {0} месяца",many:"через {0} месяцев",other:"через {0} месяца"},past:{one:"{0} месяц назад",few:"{0} месяца назад",many:"{0} месяцев назад",other:"{0} месяца назад"}}},day:{displayName:"день",relative:{0:"сегодня",1:"завтра",2:"послезавтра","-2":"позавчера","-1":"вчера"},relativeTime:{future:{one:"через {0} день",few:"через {0} дня",many:"через {0} дней",other:"через {0} дня"},past:{one:"{0} день назад",few:"{0} дня назад",many:"{0} дней назад",other:"{0} дня назад"}}},hour:{displayName:"час",relative:{0:"в этом часе"},relativeTime:{future:{one:"через {0} час",few:"через {0} часа",many:"через {0} часов",other:"через {0} часа"},past:{one:"{0} час назад",few:"{0} часа назад",many:"{0} часов назад",other:"{0} часа назад"}}},minute:{displayName:"минута",relative:{0:"в эту минуту"},relativeTime:{future:{one:"через {0} минуту",few:"через {0} минуты",many:"через {0} минут",other:"через {0} минуты"},past:{one:"{0} минуту назад",few:"{0} минуты назад",many:"{0} минут назад",other:"{0} минуты назад"}}},second:{displayName:"секунда",relative:{0:"сейчас"},relativeTime:{future:{one:"через {0} секунду",few:"через {0} секунды",many:"через {0} секунд",other:"через {0} секунды"},past:{one:"{0} секунду назад",few:"{0} секунды назад",many:"{0} секунд назад",other:"{0} секунды назад"}}}}},{locale:"ru-BY",parentLocale:"ru"},{locale:"ru-KG",parentLocale:"ru"},{locale:"ru-KZ",parentLocale:"ru"},{locale:"ru-MD",parentLocale:"ru"},{locale:"ru-UA",parentLocale:"ru"}]}()},function(e,t,n){e.exports=n(47)},function(e,t,n){"use strict";
|
||
/** @license React v16.5.2
|
||
* react.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var r=n(14),o="function"==typeof Symbol&&Symbol.for,i=o?Symbol.for("react.element"):60103,a=o?Symbol.for("react.portal"):60106,s=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,u=o?Symbol.for("react.profiler"):60114,c=o?Symbol.for("react.provider"):60109,d=o?Symbol.for("react.context"):60110,p=o?Symbol.for("react.async_mode"):60111,f=o?Symbol.for("react.forward_ref"):60112;o&&Symbol.for("react.placeholder");var h="function"==typeof Symbol&&Symbol.iterator;function m(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,o,i,a,s){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,s],u=0;(e=Error(t.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}var y={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},v={};function g(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||y}function b(){}function _(e,t,n){this.props=e,this.context=t,this.refs=v,this.updater=n||y}g.prototype.isReactComponent={},g.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&m("85"),this.updater.enqueueSetState(this,e,t,"setState")},g.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")},b.prototype=g.prototype;var w=_.prototype=new b;w.constructor=_,r(w,g.prototype),w.isPureReactComponent=!0;var E={current:null,currentDispatcher:null},S=Object.prototype.hasOwnProperty,T={key:!0,ref:!0,__self:!0,__source:!0};function k(e,t,n){var r=void 0,o={},a=null,s=null;if(null!=t)for(r in void 0!==t.ref&&(s=t.ref),void 0!==t.key&&(a=""+t.key),t)S.call(t,r)&&!T.hasOwnProperty(r)&&(o[r]=t[r]);var l=arguments.length-2;if(1===l)o.children=n;else if(1<l){for(var u=Array(l),c=0;c<l;c++)u[c]=arguments[c+2];o.children=u}if(e&&e.defaultProps)for(r in l=e.defaultProps)void 0===o[r]&&(o[r]=l[r]);return{$$typeof:i,type:e,key:a,ref:s,props:o,_owner:E.current}}function C(e){return"object"==typeof e&&null!==e&&e.$$typeof===i}var O=/\/+/g,P=[];function N(e,t,n,r){if(P.length){var o=P.pop();return o.result=e,o.keyPrefix=t,o.func=n,o.context=r,o.count=0,o}return{result:e,keyPrefix:t,func:n,context:r,count:0}}function x(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>P.length&&P.push(e)}function M(e,t,n){return null==e?0:function e(t,n,r,o){var s=typeof t;"undefined"!==s&&"boolean"!==s||(t=null);var l=!1;if(null===t)l=!0;else switch(s){case"string":case"number":l=!0;break;case"object":switch(t.$$typeof){case i:case a:l=!0}}if(l)return r(o,t,""===n?"."+A(t,0):n),1;if(l=0,n=""===n?".":n+":",Array.isArray(t))for(var u=0;u<t.length;u++){var c=n+A(s=t[u],u);l+=e(s,c,r,o)}else if(c=null===t||"object"!=typeof t?null:"function"==typeof(c=h&&t[h]||t["@@iterator"])?c:null,"function"==typeof c)for(t=c.call(t),u=0;!(s=t.next()).done;)l+=e(s=s.value,c=n+A(s,u++),r,o);else"object"===s&&m("31","[object Object]"==(r=""+t)?"object with keys {"+Object.keys(t).join(", ")+"}":r,"");return l}(e,"",t,n)}function A(e,t){return"object"==typeof e&&null!==e&&null!=e.key?function(e){var t={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(e){return t[e]})}(e.key):t.toString(36)}function D(e,t){e.func.call(e.context,t,e.count++)}function j(e,t,n){var r=e.result,o=e.keyPrefix;e=e.func.call(e.context,t,e.count++),Array.isArray(e)?I(e,r,n,function(e){return e}):null!=e&&(C(e)&&(e=function(e,t){return{$$typeof:i,type:e.type,key:t,ref:e.ref,props:e.props,_owner:e._owner}}(e,o+(!e.key||t&&t.key===e.key?"":(""+e.key).replace(O,"$&/")+"/")+n)),r.push(e))}function I(e,t,n,r,o){var i="";null!=n&&(i=(""+n).replace(O,"$&/")+"/"),M(e,j,t=N(t,i,r,o)),x(t)}var R={Children:{map:function(e,t,n){if(null==e)return e;var r=[];return I(e,r,null,t,n),r},forEach:function(e,t,n){if(null==e)return e;M(e,D,t=N(null,null,t,n)),x(t)},count:function(e){return M(e,function(){return null},null)},toArray:function(e){var t=[];return I(e,t,null,function(e){return e}),t},only:function(e){return C(e)||m("143"),e}},createRef:function(){return{current:null}},Component:g,PureComponent:_,createContext:function(e,t){return void 0===t&&(t=null),(e={$$typeof:d,_calculateChangedBits:t,_currentValue:e,_currentValue2:e,Provider:null,Consumer:null,unstable_read:null}).Provider={$$typeof:c,_context:e},e.Consumer=e,e.unstable_read=function(e,t){var n=E.currentDispatcher;return null===n&&m("277"),n.readContext(e,t)}.bind(null,e),e},forwardRef:function(e){return{$$typeof:f,render:e}},Fragment:s,StrictMode:l,unstable_AsyncMode:p,unstable_Profiler:u,createElement:k,cloneElement:function(e,t,n){(null===e||void 0===e)&&m("267",e);var o=void 0,a=r({},e.props),s=e.key,l=e.ref,u=e._owner;if(null!=t){void 0!==t.ref&&(l=t.ref,u=E.current),void 0!==t.key&&(s=""+t.key);var c=void 0;for(o in e.type&&e.type.defaultProps&&(c=e.type.defaultProps),t)S.call(t,o)&&!T.hasOwnProperty(o)&&(a[o]=void 0===t[o]&&void 0!==c?c[o]:t[o])}if(1===(o=arguments.length-2))a.children=n;else if(1<o){c=Array(o);for(var d=0;d<o;d++)c[d]=arguments[d+2];a.children=c}return{$$typeof:i,type:e.type,key:s,ref:l,props:a,_owner:u}},createFactory:function(e){var t=k.bind(null,e);return t.type=e,t},isValidElement:C,version:"16.5.2",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:E,assign:r}},U={default:R},F=U&&R||U;e.exports=F.default||F},function(e,t,n){"use strict";
|
||
/** @license React v16.5.2
|
||
* react-dom.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/var r=n(0),o=n(14),i=n(22);function a(e){for(var t=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+e,r=0;r<t;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);!function(e,t,n,r,o,i,a,s){if(!e){if(e=void 0,void 0===t)e=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,i,a,s],u=0;(e=Error(t.replace(/%s/g,function(){return l[u++]}))).name="Invariant Violation"}throw e.framesToPop=1,e}}(!1,"Minified React error #"+e+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}r||a("227");var s=!1,l=null,u=!1,c=null,d={onError:function(e){s=!0,l=e}};function p(e,t,n,r,o,i,a,u,c){s=!1,l=null,function(e,t,n,r,o,i,a,s,l){var u=Array.prototype.slice.call(arguments,3);try{t.apply(n,u)}catch(e){this.onError(e)}}.apply(d,arguments)}var f=null,h={};function m(){if(f)for(var e in h){var t=h[e],n=f.indexOf(e);if(-1<n||a("96",e),!v[n])for(var r in t.extractEvents||a("97",e),v[n]=t,n=t.eventTypes){var o=void 0,i=n[r],s=t,l=r;g.hasOwnProperty(l)&&a("99",l),g[l]=i;var u=i.phasedRegistrationNames;if(u){for(o in u)u.hasOwnProperty(o)&&y(u[o],s,l);o=!0}else i.registrationName?(y(i.registrationName,s,l),o=!0):o=!1;o||a("98",r,e)}}}function y(e,t,n){b[e]&&a("100",e),b[e]=t,_[e]=t.eventTypes[n].dependencies}var v=[],g={},b={},_={},w=null,E=null,S=null;function T(e,t,n,r){t=e.type||"unknown-event",e.currentTarget=S(r),function(e,t,n,r,o,i,d,f,h){if(p.apply(this,arguments),s){if(s){var m=l;s=!1,l=null}else a("198"),m=void 0;u||(u=!0,c=m)}}(t,n,void 0,e),e.currentTarget=null}function k(e,t){return null==t&&a("30"),null==e?t:Array.isArray(e)?Array.isArray(t)?(e.push.apply(e,t),e):(e.push(t),e):Array.isArray(t)?[e].concat(t):[e,t]}function C(e,t,n){Array.isArray(e)?e.forEach(t,n):e&&t.call(n,e)}var O=null;function P(e,t){if(e){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o<n.length&&!e.isPropagationStopped();o++)T(e,t,n[o],r[o]);else n&&T(e,t,n,r);e._dispatchListeners=null,e._dispatchInstances=null,e.isPersistent()||e.constructor.release(e)}}function N(e){return P(e,!0)}function x(e){return P(e,!1)}var M={injectEventPluginOrder:function(e){f&&a("101"),f=Array.prototype.slice.call(e),m()},injectEventPluginsByName:function(e){var t,n=!1;for(t in e)if(e.hasOwnProperty(t)){var r=e[t];h.hasOwnProperty(t)&&h[t]===r||(h[t]&&a("102",t),h[t]=r,n=!0)}n&&m()}};function A(e,t){var n=e.stateNode;if(!n)return null;var r=w(n);if(!r)return null;n=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(r=!r.disabled)||(r=!("button"===(e=e.type)||"input"===e||"select"===e||"textarea"===e)),e=!r;break e;default:e=!1}return e?null:(n&&"function"!=typeof n&&a("231",t,typeof n),n)}function D(e,t){if(null!==e&&(O=k(O,e)),e=O,O=null,e&&(C(e,t?N:x),O&&a("95"),u))throw t=c,u=!1,c=null,t}var j=Math.random().toString(36).slice(2),I="__reactInternalInstance$"+j,R="__reactEventHandlers$"+j;function U(e){if(e[I])return e[I];for(;!e[I];){if(!e.parentNode)return null;e=e.parentNode}return 7===(e=e[I]).tag||8===e.tag?e:null}function F(e){return!(e=e[I])||7!==e.tag&&8!==e.tag?null:e}function L(e){if(7===e.tag||8===e.tag)return e.stateNode;a("33")}function B(e){return e[R]||null}function W(e){do{e=e.return}while(e&&7!==e.tag);return e||null}function q(e,t,n){(t=A(e,n.dispatchConfig.phasedRegistrationNames[t]))&&(n._dispatchListeners=k(n._dispatchListeners,t),n._dispatchInstances=k(n._dispatchInstances,e))}function V(e){if(e&&e.dispatchConfig.phasedRegistrationNames){for(var t=e._targetInst,n=[];t;)n.push(t),t=W(t);for(t=n.length;0<t--;)q(n[t],"captured",e);for(t=0;t<n.length;t++)q(n[t],"bubbled",e)}}function K(e,t,n){e&&n&&n.dispatchConfig.registrationName&&(t=A(e,n.dispatchConfig.registrationName))&&(n._dispatchListeners=k(n._dispatchListeners,t),n._dispatchInstances=k(n._dispatchInstances,e))}function H(e){e&&e.dispatchConfig.registrationName&&K(e._targetInst,null,e)}function z(e){C(e,V)}var G=!("undefined"==typeof window||!window.document||!window.document.createElement);function $(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var Y={animationend:$("Animation","AnimationEnd"),animationiteration:$("Animation","AnimationIteration"),animationstart:$("Animation","AnimationStart"),transitionend:$("Transition","TransitionEnd")},Q={},J={};function X(e){if(Q[e])return Q[e];if(!Y[e])return e;var t,n=Y[e];for(t in n)if(n.hasOwnProperty(t)&&t in J)return Q[e]=n[t];return e}G&&(J=document.createElement("div").style,"AnimationEvent"in window||(delete Y.animationend.animation,delete Y.animationiteration.animation,delete Y.animationstart.animation),"TransitionEvent"in window||delete Y.transitionend.transition);var Z=X("animationend"),ee=X("animationiteration"),te=X("animationstart"),ne=X("transitionend"),re="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),oe=null,ie=null,ae=null;function se(){if(ae)return ae;var e,t,n=ie,r=n.length,o="value"in oe?oe.value:oe.textContent,i=o.length;for(e=0;e<r&&n[e]===o[e];e++);var a=r-e;for(t=1;t<=a&&n[r-t]===o[i-t];t++);return ae=o.slice(e,1<t?1-t:void 0)}function le(){return!0}function ue(){return!1}function ce(e,t,n,r){for(var o in this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n,e=this.constructor.Interface)e.hasOwnProperty(o)&&((t=e[o])?this[o]=t(n):"target"===o?this.target=r:this[o]=n[o]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?le:ue,this.isPropagationStopped=ue,this}function de(e,t,n,r){if(this.eventPool.length){var o=this.eventPool.pop();return this.call(o,e,t,n,r),o}return new this(e,t,n,r)}function pe(e){e instanceof this||a("279"),e.destructor(),10>this.eventPool.length&&this.eventPool.push(e)}function fe(e){e.eventPool=[],e.getPooled=de,e.release=pe}o(ce.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=le)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=le)},persist:function(){this.isPersistent=le},isPersistent:ue,destructor:function(){var e,t=this.constructor.Interface;for(e in t)this[e]=null;this.nativeEvent=this._targetInst=this.dispatchConfig=null,this.isPropagationStopped=this.isDefaultPrevented=ue,this._dispatchInstances=this._dispatchListeners=null}}),ce.Interface={type:null,target:null,currentTarget:function(){return null},eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null},ce.extend=function(e){function t(){}function n(){return r.apply(this,arguments)}var r=this;t.prototype=r.prototype;var i=new t;return o(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=o({},r.Interface,e),n.extend=r.extend,fe(n),n},fe(ce);var he=ce.extend({data:null}),me=ce.extend({data:null}),ye=[9,13,27,32],ve=G&&"CompositionEvent"in window,ge=null;G&&"documentMode"in document&&(ge=document.documentMode);var be=G&&"TextEvent"in window&&!ge,_e=G&&(!ve||ge&&8<ge&&11>=ge),we=String.fromCharCode(32),Ee={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},Se=!1;function Te(e,t){switch(e){case"keyup":return-1!==ye.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function ke(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var Ce=!1;var Oe={eventTypes:Ee,extractEvents:function(e,t,n,r){var o=void 0,i=void 0;if(ve)e:{switch(e){case"compositionstart":o=Ee.compositionStart;break e;case"compositionend":o=Ee.compositionEnd;break e;case"compositionupdate":o=Ee.compositionUpdate;break e}o=void 0}else Ce?Te(e,n)&&(o=Ee.compositionEnd):"keydown"===e&&229===n.keyCode&&(o=Ee.compositionStart);return o?(_e&&"ko"!==n.locale&&(Ce||o!==Ee.compositionStart?o===Ee.compositionEnd&&Ce&&(i=se()):(ie="value"in(oe=r)?oe.value:oe.textContent,Ce=!0)),o=he.getPooled(o,t,n,r),i?o.data=i:null!==(i=ke(n))&&(o.data=i),z(o),i=o):i=null,(e=be?function(e,t){switch(e){case"compositionend":return ke(t);case"keypress":return 32!==t.which?null:(Se=!0,we);case"textInput":return(e=t.data)===we&&Se?null:e;default:return null}}(e,n):function(e,t){if(Ce)return"compositionend"===e||!ve&&Te(e,t)?(e=se(),ae=ie=oe=null,Ce=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return _e&&"ko"!==t.locale?null:t.data;default:return null}}(e,n))?((t=me.getPooled(Ee.beforeInput,t,n,r)).data=e,z(t)):t=null,null===i?t:null===t?i:[i,t]}},Pe=null,Ne=null,xe=null;function Me(e){if(e=E(e)){"function"!=typeof Pe&&a("280");var t=w(e.stateNode);Pe(e.stateNode,e.type,t)}}function Ae(e){Ne?xe?xe.push(e):xe=[e]:Ne=e}function De(){if(Ne){var e=Ne,t=xe;if(xe=Ne=null,Me(e),t)for(e=0;e<t.length;e++)Me(t[e])}}function je(e,t){return e(t)}function Ie(e,t,n){return e(t,n)}function Re(){}var Ue=!1;function Fe(e,t){if(Ue)return e(t);Ue=!0;try{return je(e,t)}finally{Ue=!1,(null!==Ne||null!==xe)&&(Re(),De())}}var Le={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Be(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!Le[e.type]:"textarea"===t}function We(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}function qe(e){if(!G)return!1;var t=(e="on"+e)in document;return t||((t=document.createElement("div")).setAttribute(e,"return;"),t="function"==typeof t[e]),t}function Ve(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function Ke(e){e._valueTracker||(e._valueTracker=function(e){var t=Ve(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var o=n.get,i=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(e){r=""+e,i.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=""+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}(e))}function He(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=Ve(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}var ze=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Ge=/^(.*)[\\\/]/,$e="function"==typeof Symbol&&Symbol.for,Ye=$e?Symbol.for("react.element"):60103,Qe=$e?Symbol.for("react.portal"):60106,Je=$e?Symbol.for("react.fragment"):60107,Xe=$e?Symbol.for("react.strict_mode"):60108,Ze=$e?Symbol.for("react.profiler"):60114,et=$e?Symbol.for("react.provider"):60109,tt=$e?Symbol.for("react.context"):60110,nt=$e?Symbol.for("react.async_mode"):60111,rt=$e?Symbol.for("react.forward_ref"):60112,ot=$e?Symbol.for("react.placeholder"):60113,it="function"==typeof Symbol&&Symbol.iterator;function at(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=it&&e[it]||e["@@iterator"])?e:null}function st(e){if(null==e)return null;if("function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case nt:return"AsyncMode";case Je:return"Fragment";case Qe:return"Portal";case Ze:return"Profiler";case Xe:return"StrictMode";case ot:return"Placeholder"}if("object"==typeof e){switch(e.$$typeof){case tt:return"Context.Consumer";case et:return"Context.Provider";case rt:var t=e.render;return t=t.displayName||t.name||"",e.displayName||(""!==t?"ForwardRef("+t+")":"ForwardRef")}if("function"==typeof e.then&&(e=1===e._reactStatus?e._reactResult:null))return st(e)}return null}function lt(e){var t="";do{e:switch(e.tag){case 4:case 0:case 1:case 2:case 3:case 7:case 10:var n=e._debugOwner,r=e._debugSource,o=st(e.type),i=null;n&&(i=st(n.type)),n=o,o="",r?o=" (at "+r.fileName.replace(Ge,"")+":"+r.lineNumber+")":i&&(o=" (created by "+i+")"),i="\n in "+(n||"Unknown")+o;break e;default:i=""}t+=i,e=e.return}while(e);return t}var ut=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,ct=Object.prototype.hasOwnProperty,dt={},pt={};function ft(e,t,n,r,o){this.acceptsBooleans=2===t||3===t||4===t,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=e,this.type=t}var ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){ht[e]=new ft(e,0,!1,e,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];ht[t]=new ft(t,1,!1,e[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){ht[e]=new ft(e,2,!1,e.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){ht[e]=new ft(e,2,!1,e,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){ht[e]=new ft(e,3,!1,e.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(e){ht[e]=new ft(e,3,!0,e,null)}),["capture","download"].forEach(function(e){ht[e]=new ft(e,4,!1,e,null)}),["cols","rows","size","span"].forEach(function(e){ht[e]=new ft(e,6,!1,e,null)}),["rowSpan","start"].forEach(function(e){ht[e]=new ft(e,5,!1,e.toLowerCase(),null)});var mt=/[\-:]([a-z])/g;function yt(e){return e[1].toUpperCase()}function vt(e,t,n,r){var o=ht.hasOwnProperty(t)?ht[t]:null;(null!==o?0===o.type:!r&&(2<t.length&&("o"===t[0]||"O"===t[0])&&("n"===t[1]||"N"===t[1])))||(function(e,t,n,r){if(null===t||void 0===t||function(e,t,n,r){if(null!==n&&0===n.type)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(e=e.toLowerCase().slice(0,5))&&"aria-"!==e);default:return!1}}(e,t,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}(t,n,o,r)&&(n=null),r||null===o?function(e){return!!ct.call(pt,e)||!ct.call(dt,e)&&(ut.test(e)?pt[e]=!0:(dt[e]=!0,!1))}(t)&&(null===n?e.removeAttribute(t):e.setAttribute(t,""+n)):o.mustUseProperty?e[o.propertyName]=null===n?3!==o.type&&"":n:(t=o.attributeName,r=o.attributeNamespace,null===n?e.removeAttribute(t):(n=3===(o=o.type)||4===o&&!0===n?"":""+n,r?e.setAttributeNS(r,t,n):e.setAttribute(t,n))))}function gt(e){switch(typeof e){case"boolean":case"number":case"object":case"string":case"undefined":return e;default:return""}}function bt(e,t){var n=t.checked;return o({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:e._wrapperState.initialChecked})}function _t(e,t){var n=null==t.defaultValue?"":t.defaultValue,r=null!=t.checked?t.checked:t.defaultChecked;n=gt(null!=t.value?t.value:n),e._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===t.type||"radio"===t.type?null!=t.checked:null!=t.value}}function wt(e,t){null!=(t=t.checked)&&vt(e,"checked",t,!1)}function Et(e,t){wt(e,t);var n=gt(t.value),r=t.type;if(null!=n)"number"===r?(0===n&&""===e.value||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if("submit"===r||"reset"===r)return void e.removeAttribute("value");t.hasOwnProperty("value")?Tt(e,t.type,n):t.hasOwnProperty("defaultValue")&&Tt(e,t.type,gt(t.defaultValue)),null==t.checked&&null!=t.defaultChecked&&(e.defaultChecked=!!t.defaultChecked)}function St(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var r=t.type;if(!("submit"!==r&&"reset"!==r||void 0!==t.value&&null!==t.value))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}""!==(n=e.name)&&(e.name=""),e.defaultChecked=!e.defaultChecked,e.defaultChecked=!!e._wrapperState.initialChecked,""!==n&&(e.name=n)}function Tt(e,t,n){"number"===t&&e.ownerDocument.activeElement===e||(null==n?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(mt,yt);ht[t]=new ft(t,1,!1,e,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(mt,yt);ht[t]=new ft(t,1,!1,e,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(mt,yt);ht[t]=new ft(t,1,!1,e,"http://www.w3.org/XML/1998/namespace")}),ht.tabIndex=new ft("tabIndex",1,!1,"tabindex",null);var kt={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}};function Ct(e,t,n){return(e=ce.getPooled(kt.change,e,t,n)).type="change",Ae(n),z(e),e}var Ot=null,Pt=null;function Nt(e){D(e,!1)}function xt(e){if(He(L(e)))return e}function Mt(e,t){if("change"===e)return t}var At=!1;function Dt(){Ot&&(Ot.detachEvent("onpropertychange",jt),Pt=Ot=null)}function jt(e){"value"===e.propertyName&&xt(Pt)&&Fe(Nt,e=Ct(Pt,e,We(e)))}function It(e,t,n){"focus"===e?(Dt(),Pt=n,(Ot=t).attachEvent("onpropertychange",jt)):"blur"===e&&Dt()}function Rt(e){if("selectionchange"===e||"keyup"===e||"keydown"===e)return xt(Pt)}function Ut(e,t){if("click"===e)return xt(t)}function Ft(e,t){if("input"===e||"change"===e)return xt(t)}G&&(At=qe("input")&&(!document.documentMode||9<document.documentMode));var Lt={eventTypes:kt,_isInputEventSupported:At,extractEvents:function(e,t,n,r){var o=t?L(t):window,i=void 0,a=void 0,s=o.nodeName&&o.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===o.type?i=Mt:Be(o)?At?i=Ft:(i=Rt,a=It):(s=o.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===o.type||"radio"===o.type)&&(i=Ut),i&&(i=i(e,t)))return Ct(i,n,r);a&&a(e,o,t),"blur"===e&&(e=o._wrapperState)&&e.controlled&&"number"===o.type&&Tt(o,"number",o.value)}},Bt=ce.extend({view:null,detail:null}),Wt={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function qt(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):!!(e=Wt[e])&&!!t[e]}function Vt(){return qt}var Kt=0,Ht=0,zt=!1,Gt=!1,$t=Bt.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Vt,button:null,buttons:null,relatedTarget:function(e){return e.relatedTarget||(e.fromElement===e.srcElement?e.toElement:e.fromElement)},movementX:function(e){if("movementX"in e)return e.movementX;var t=Kt;return Kt=e.screenX,zt?"mousemove"===e.type?e.screenX-t:0:(zt=!0,0)},movementY:function(e){if("movementY"in e)return e.movementY;var t=Ht;return Ht=e.screenY,Gt?"mousemove"===e.type?e.screenY-t:0:(Gt=!0,0)}}),Yt=$t.extend({pointerId:null,width:null,height:null,pressure:null,tangentialPressure:null,tiltX:null,tiltY:null,twist:null,pointerType:null,isPrimary:null}),Qt={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},Jt={eventTypes:Qt,extractEvents:function(e,t,n,r){var o="mouseover"===e||"pointerover"===e,i="mouseout"===e||"pointerout"===e;if(o&&(n.relatedTarget||n.fromElement)||!i&&!o)return null;if(o=r.window===r?r:(o=r.ownerDocument)?o.defaultView||o.parentWindow:window,i?(i=t,t=(t=n.relatedTarget||n.toElement)?U(t):null):i=null,i===t)return null;var a=void 0,s=void 0,l=void 0,u=void 0;"mouseout"===e||"mouseover"===e?(a=$t,s=Qt.mouseLeave,l=Qt.mouseEnter,u="mouse"):"pointerout"!==e&&"pointerover"!==e||(a=Yt,s=Qt.pointerLeave,l=Qt.pointerEnter,u="pointer");var c=null==i?o:L(i);if(o=null==t?o:L(t),(e=a.getPooled(s,i,n,r)).type=u+"leave",e.target=c,e.relatedTarget=o,(n=a.getPooled(l,t,n,r)).type=u+"enter",n.target=o,n.relatedTarget=c,r=t,i&&r)e:{for(o=r,u=0,a=t=i;a;a=W(a))u++;for(a=0,l=o;l;l=W(l))a++;for(;0<u-a;)t=W(t),u--;for(;0<a-u;)o=W(o),a--;for(;u--;){if(t===o||t===o.alternate)break e;t=W(t),o=W(o)}t=null}else t=null;for(o=t,t=[];i&&i!==o&&(null===(u=i.alternate)||u!==o);)t.push(i),i=W(i);for(i=[];r&&r!==o&&(null===(u=r.alternate)||u!==o);)i.push(r),r=W(r);for(r=0;r<t.length;r++)K(t[r],"bubbled",e);for(r=i.length;0<r--;)K(i[r],"captured",n);return[e,n]}},Xt=Object.prototype.hasOwnProperty;function Zt(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}function en(e,t){if(Zt(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!Xt.call(t,n[r])||!Zt(e[n[r]],t[n[r]]))return!1;return!0}function tn(e){var t=e;if(e.alternate)for(;t.return;)t=t.return;else{if(0!=(2&t.effectTag))return 1;for(;t.return;)if(0!=(2&(t=t.return).effectTag))return 1}return 5===t.tag?2:3}function nn(e){2!==tn(e)&&a("188")}function rn(e){if(!(e=function(e){var t=e.alternate;if(!t)return 3===(t=tn(e))&&a("188"),1===t?null:e;for(var n=e,r=t;;){var o=n.return,i=o?o.alternate:null;if(!o||!i)break;if(o.child===i.child){for(var s=o.child;s;){if(s===n)return nn(o),e;if(s===r)return nn(o),t;s=s.sibling}a("188")}if(n.return!==r.return)n=o,r=i;else{s=!1;for(var l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}s||a("189")}}n.alternate!==r&&a("190")}return 5!==n.tag&&a("188"),n.stateNode.current===n?e:t}(e)))return null;for(var t=e;;){if(7===t.tag||8===t.tag)return t;if(t.child)t.child.return=t,t=t.child;else{if(t===e)break;for(;!t.sibling;){if(!t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}}return null}var on=ce.extend({animationName:null,elapsedTime:null,pseudoElement:null}),an=ce.extend({clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),sn=Bt.extend({relatedTarget:null});function ln(e){var t=e.keyCode;return"charCode"in e?0===(e=e.charCode)&&13===t&&(e=13):e=t,10===e&&(e=13),32<=e||13===e?e:0}var un={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},cn={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},dn=Bt.extend({key:function(e){if(e.key){var t=un[e.key]||e.key;if("Unidentified"!==t)return t}return"keypress"===e.type?13===(e=ln(e))?"Enter":String.fromCharCode(e):"keydown"===e.type||"keyup"===e.type?cn[e.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Vt,charCode:function(e){return"keypress"===e.type?ln(e):0},keyCode:function(e){return"keydown"===e.type||"keyup"===e.type?e.keyCode:0},which:function(e){return"keypress"===e.type?ln(e):"keydown"===e.type||"keyup"===e.type?e.keyCode:0}}),pn=$t.extend({dataTransfer:null}),fn=Bt.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Vt}),hn=ce.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),mn=$t.extend({deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:null,deltaMode:null}),yn=[["abort","abort"],[Z,"animationEnd"],[ee,"animationIteration"],[te,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[ne,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],vn={},gn={};function bn(e,t){var n=e[0],r="on"+((e=e[1])[0].toUpperCase()+e.slice(1));t={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n],isInteractive:t},vn[e]=t,gn[n]=t}[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["auxclick","auxClick"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(e){bn(e,!0)}),yn.forEach(function(e){bn(e,!1)});var _n={eventTypes:vn,isInteractiveTopLevelEventType:function(e){return void 0!==(e=gn[e])&&!0===e.isInteractive},extractEvents:function(e,t,n,r){var o=gn[e];if(!o)return null;switch(e){case"keypress":if(0===ln(n))return null;case"keydown":case"keyup":e=dn;break;case"blur":case"focus":e=sn;break;case"click":if(2===n.button)return null;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":e=$t;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":e=pn;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":e=fn;break;case Z:case ee:case te:e=on;break;case ne:e=hn;break;case"scroll":e=Bt;break;case"wheel":e=mn;break;case"copy":case"cut":case"paste":e=an;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":e=Yt;break;default:e=ce}return z(t=e.getPooled(o,t,n,r)),t}},wn=_n.isInteractiveTopLevelEventType,En=[];function Sn(e){var t=e.targetInst,n=t;do{if(!n){e.ancestors.push(n);break}var r;for(r=n;r.return;)r=r.return;if(!(r=5!==r.tag?null:r.stateNode.containerInfo))break;e.ancestors.push(n),n=U(r)}while(n);for(n=0;n<e.ancestors.length;n++){t=e.ancestors[n];var o=We(e.nativeEvent);r=e.topLevelType;for(var i=e.nativeEvent,a=null,s=0;s<v.length;s++){var l=v[s];l&&(l=l.extractEvents(r,t,i,o))&&(a=k(a,l))}D(a,!1)}}var Tn=!0;function kn(e,t){if(!t)return null;var n=(wn(e)?On:Pn).bind(null,e);t.addEventListener(e,n,!1)}function Cn(e,t){if(!t)return null;var n=(wn(e)?On:Pn).bind(null,e);t.addEventListener(e,n,!0)}function On(e,t){Ie(Pn,e,t)}function Pn(e,t){if(Tn){var n=We(t);if(null===(n=U(n))||"number"!=typeof n.tag||2===tn(n)||(n=null),En.length){var r=En.pop();r.topLevelType=e,r.nativeEvent=t,r.targetInst=n,e=r}else e={topLevelType:e,nativeEvent:t,targetInst:n,ancestors:[]};try{Fe(Sn,e)}finally{e.topLevelType=null,e.nativeEvent=null,e.targetInst=null,e.ancestors.length=0,10>En.length&&En.push(e)}}}var Nn={},xn=0,Mn="_reactListenersID"+(""+Math.random()).slice(2);function An(e){return Object.prototype.hasOwnProperty.call(e,Mn)||(e[Mn]=xn++,Nn[e[Mn]]={}),Nn[e[Mn]]}function Dn(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}function jn(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function In(e,t){var n,r=jn(e);for(e=0;r;){if(3===r.nodeType){if(n=e+r.textContent.length,e<=t&&n>=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=jn(r)}}function Rn(){for(var e=window,t=Dn();t instanceof e.HTMLIFrameElement;){try{e=t.contentDocument.defaultView}catch(e){break}t=Dn(e.document)}return t}function Un(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var Fn=G&&"documentMode"in document&&11>=document.documentMode,Ln={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu dragend focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Bn=null,Wn=null,qn=null,Vn=!1;function Kn(e,t){var n=t.window===t?t.document:9===t.nodeType?t:t.ownerDocument;return Vn||null==Bn||Bn!==Dn(n)?null:("selectionStart"in(n=Bn)&&Un(n)?n={start:n.selectionStart,end:n.selectionEnd}:n={anchorNode:(n=(n.ownerDocument&&n.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset},qn&&en(qn,n)?null:(qn=n,(e=ce.getPooled(Ln.select,Wn,e,t)).type="select",e.target=Bn,z(e),e))}var Hn={eventTypes:Ln,extractEvents:function(e,t,n,r){var o,i=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(o=!i)){e:{i=An(i),o=_.onSelect;for(var a=0;a<o.length;a++){var s=o[a];if(!i.hasOwnProperty(s)||!i[s]){i=!1;break e}}i=!0}o=!i}if(o)return null;switch(i=t?L(t):window,e){case"focus":(Be(i)||"true"===i.contentEditable)&&(Bn=i,Wn=t,qn=null);break;case"blur":qn=Wn=Bn=null;break;case"mousedown":Vn=!0;break;case"contextmenu":case"mouseup":case"dragend":return Vn=!1,Kn(n,r);case"selectionchange":if(Fn)break;case"keydown":case"keyup":return Kn(n,r)}return null}};function zn(e,t){return e=o({children:void 0},t),(t=function(e){var t="";return r.Children.forEach(e,function(e){null!=e&&(t+=e)}),t}(t.children))&&(e.children=t),e}function Gn(e,t,n,r){if(e=e.options,t){t={};for(var o=0;o<n.length;o++)t["$"+n[o]]=!0;for(n=0;n<e.length;n++)o=t.hasOwnProperty("$"+e[n].value),e[n].selected!==o&&(e[n].selected=o),o&&r&&(e[n].defaultSelected=!0)}else{for(n=""+gt(n),t=null,o=0;o<e.length;o++){if(e[o].value===n)return e[o].selected=!0,void(r&&(e[o].defaultSelected=!0));null!==t||e[o].disabled||(t=e[o])}null!==t&&(t.selected=!0)}}function $n(e,t){return null!=t.dangerouslySetInnerHTML&&a("91"),o({},t,{value:void 0,defaultValue:void 0,children:""+e._wrapperState.initialValue})}function Yn(e,t){var n=t.value;null==n&&(n=t.defaultValue,null!=(t=t.children)&&(null!=n&&a("92"),Array.isArray(t)&&(1>=t.length||a("93"),t=t[0]),n=t),null==n&&(n="")),e._wrapperState={initialValue:gt(n)}}function Qn(e,t){var n=gt(t.value),r=gt(t.defaultValue);null!=n&&((n=""+n)!==e.value&&(e.value=n),null==t.defaultValue&&e.defaultValue!==n&&(e.defaultValue=n)),null!=r&&(e.defaultValue=""+r)}function Jn(e){var t=e.textContent;t===e._wrapperState.initialValue&&(e.value=t)}M.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),w=B,E=F,S=L,M.injectEventPluginsByName({SimpleEventPlugin:_n,EnterLeaveEventPlugin:Jt,ChangeEventPlugin:Lt,SelectEventPlugin:Hn,BeforeInputEventPlugin:Oe});var Xn={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Zn(e){switch(e){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function er(e,t){return null==e||"http://www.w3.org/1999/xhtml"===e?Zn(t):"http://www.w3.org/2000/svg"===e&&"foreignObject"===t?"http://www.w3.org/1999/xhtml":e}var tr=void 0,nr=function(e){return"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction?function(t,n,r,o){MSApp.execUnsafeLocalFunction(function(){return e(t,n)})}:e}(function(e,t){if(e.namespaceURI!==Xn.svg||"innerHTML"in e)e.innerHTML=t;else{for((tr=tr||document.createElement("div")).innerHTML="<svg>"+t+"</svg>",t=tr.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function rr(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType)return void(n.nodeValue=t)}e.textContent=t}var or={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},ir=["Webkit","ms","Moz","O"];function ar(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=0===n.indexOf("--"),o=n,i=t[n];o=null==i||"boolean"==typeof i||""===i?"":r||"number"!=typeof i||0===i||or.hasOwnProperty(o)&&or[o]?(""+i).trim():i+"px","float"===n&&(n="cssFloat"),r?e.setProperty(n,o):e[n]=o}}Object.keys(or).forEach(function(e){ir.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),or[t]=or[e]})});var sr=o({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function lr(e,t){t&&(sr[e]&&(null!=t.children||null!=t.dangerouslySetInnerHTML)&&a("137",e,""),null!=t.dangerouslySetInnerHTML&&(null!=t.children&&a("60"),"object"==typeof t.dangerouslySetInnerHTML&&"__html"in t.dangerouslySetInnerHTML||a("61")),null!=t.style&&"object"!=typeof t.style&&a("62",""))}function ur(e,t){if(-1===e.indexOf("-"))return"string"==typeof t.is;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function cr(e,t){var n=An(e=9===e.nodeType||11===e.nodeType?e:e.ownerDocument);t=_[t];for(var r=0;r<t.length;r++){var o=t[r];if(!n.hasOwnProperty(o)||!n[o]){switch(o){case"scroll":Cn("scroll",e);break;case"focus":case"blur":Cn("focus",e),Cn("blur",e),n.blur=!0,n.focus=!0;break;case"cancel":case"close":qe(o)&&Cn(o,e);break;case"invalid":case"submit":case"reset":break;default:-1===re.indexOf(o)&&kn(o,e)}n[o]=!0}}}function dr(){}var pr=null,fr=null;function hr(e,t){switch(e){case"button":case"input":case"select":case"textarea":return!!t.autoFocus}return!1}function mr(e,t){return"textarea"===e||"option"===e||"noscript"===e||"string"==typeof t.children||"number"==typeof t.children||"object"==typeof t.dangerouslySetInnerHTML&&null!==t.dangerouslySetInnerHTML&&null!=t.dangerouslySetInnerHTML.__html}function yr(e){for(e=e.nextSibling;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e}function vr(e){for(e=e.firstChild;e&&1!==e.nodeType&&3!==e.nodeType;)e=e.nextSibling;return e}new Set;var gr=[],br=-1;function _r(e){0>br||(e.current=gr[br],gr[br]=null,br--)}function wr(e,t){gr[++br]=e.current,e.current=t}var Er={},Sr={current:Er},Tr={current:!1},kr=Er;function Cr(e,t){var n=e.type.contextTypes;if(!n)return Er;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var o,i={};for(o in n)i[o]=t[o];return r&&((e=e.stateNode).__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Or(e){return null!==(e=e.childContextTypes)&&void 0!==e}function Pr(e){_r(Tr),_r(Sr)}function Nr(e){_r(Tr),_r(Sr)}function xr(e,t,n){Sr.current!==Er&&a("168"),wr(Sr,t),wr(Tr,n)}function Mr(e,t,n){var r=e.stateNode;if(e=t.childContextTypes,"function"!=typeof r.getChildContext)return n;for(var i in r=r.getChildContext())i in e||a("108",st(t)||"Unknown",i);return o({},n,r)}function Ar(e){var t=e.stateNode;return t=t&&t.__reactInternalMemoizedMergedChildContext||Er,kr=Sr.current,wr(Sr,t),wr(Tr,Tr.current),!0}function Dr(e,t,n){var r=e.stateNode;r||a("169"),n?(t=Mr(e,t,kr),r.__reactInternalMemoizedMergedChildContext=t,_r(Tr),_r(Sr),wr(Sr,t)):_r(Tr),wr(Tr,n)}var jr=null,Ir=null;function Rr(e){return function(t){try{return e(t)}catch(e){}}}function Ur(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=null,this.index=0,this.ref=null,this.pendingProps=t,this.firstContextDependency=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childExpirationTime=this.expirationTime=0,this.alternate=null}function Fr(e){return!(!(e=e.prototype)||!e.isReactComponent)}function Lr(e,t,n){var r=e.alternate;return null===r?((r=new Ur(e.tag,t,e.key,e.mode)).type=e.type,r.stateNode=e.stateNode,r.alternate=e,e.alternate=r):(r.pendingProps=t,r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.childExpirationTime=e.childExpirationTime,r.expirationTime=t!==e.pendingProps?n:e.expirationTime,r.child=e.child,r.memoizedProps=e.memoizedProps,r.memoizedState=e.memoizedState,r.updateQueue=e.updateQueue,r.firstContextDependency=e.firstContextDependency,r.sibling=e.sibling,r.index=e.index,r.ref=e.ref,r}function Br(e,t,n){var r=e.type,o=e.key;e=e.props;var i=void 0;if("function"==typeof r)i=Fr(r)?2:4;else if("string"==typeof r)i=7;else e:switch(r){case Je:return Wr(e.children,t,n,o);case nt:i=10,t|=3;break;case Xe:i=10,t|=2;break;case Ze:return(r=new Ur(15,e,o,4|t)).type=Ze,r.expirationTime=n,r;case ot:i=16;break;default:if("object"==typeof r&&null!==r)switch(r.$$typeof){case et:i=12;break e;case tt:i=11;break e;case rt:i=13;break e;default:if("function"==typeof r.then){i=4;break e}}a("130",null==r?r:typeof r,"")}return(t=new Ur(i,e,o,t)).type=r,t.expirationTime=n,t}function Wr(e,t,n,r){return(e=new Ur(9,e,r,t)).expirationTime=n,e}function qr(e,t,n){return(e=new Ur(8,e,null,t)).expirationTime=n,e}function Vr(e,t,n){return(t=new Ur(6,null!==e.children?e.children:[],e.key,t)).expirationTime=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function Kr(e,t){e.didError=!1;var n=e.earliestPendingTime;0===n?e.earliestPendingTime=e.latestPendingTime=t:n>t?e.earliestPendingTime=t:e.latestPendingTime<t&&(e.latestPendingTime=t),Hr(t,e)}function Hr(e,t){var n=t.earliestSuspendedTime,r=t.latestSuspendedTime,o=t.earliestPendingTime,i=t.latestPingedTime;0===(o=0!==o?o:i)&&(0===e||r>e)&&(o=r),0!==(e=o)&&0!==n&&n<e&&(e=n),t.nextExpirationTimeToWorkOn=o,t.expirationTime=e}var zr=!1;function Gr(e){return{baseState:e,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function $r(e){return{baseState:e.baseState,firstUpdate:e.firstUpdate,lastUpdate:e.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Yr(e){return{expirationTime:e,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Qr(e,t){null===e.lastUpdate?e.firstUpdate=e.lastUpdate=t:(e.lastUpdate.next=t,e.lastUpdate=t)}function Jr(e,t){var n=e.alternate;if(null===n){var r=e.updateQueue,o=null;null===r&&(r=e.updateQueue=Gr(e.memoizedState))}else r=e.updateQueue,o=n.updateQueue,null===r?null===o?(r=e.updateQueue=Gr(e.memoizedState),o=n.updateQueue=Gr(n.memoizedState)):r=e.updateQueue=$r(o):null===o&&(o=n.updateQueue=$r(r));null===o||r===o?Qr(r,t):null===r.lastUpdate||null===o.lastUpdate?(Qr(r,t),Qr(o,t)):(Qr(r,t),o.lastUpdate=t)}function Xr(e,t){var n=e.updateQueue;null===(n=null===n?e.updateQueue=Gr(e.memoizedState):Zr(e,n)).lastCapturedUpdate?n.firstCapturedUpdate=n.lastCapturedUpdate=t:(n.lastCapturedUpdate.next=t,n.lastCapturedUpdate=t)}function Zr(e,t){var n=e.alternate;return null!==n&&t===n.updateQueue&&(t=e.updateQueue=$r(t)),t}function eo(e,t,n,r,i,a){switch(n.tag){case 1:return"function"==typeof(e=n.payload)?e.call(a,r,i):e;case 3:e.effectTag=-1025&e.effectTag|64;case 0:if(null===(i="function"==typeof(e=n.payload)?e.call(a,r,i):e)||void 0===i)break;return o({},r,i);case 2:zr=!0}return r}function to(e,t,n,r,o){zr=!1;for(var i=(t=Zr(e,t)).baseState,a=null,s=0,l=t.firstUpdate,u=i;null!==l;){var c=l.expirationTime;c>o?(null===a&&(a=l,i=u),(0===s||s>c)&&(s=c)):(u=eo(e,0,l,u,n,r),null!==l.callback&&(e.effectTag|=32,l.nextEffect=null,null===t.lastEffect?t.firstEffect=t.lastEffect=l:(t.lastEffect.nextEffect=l,t.lastEffect=l))),l=l.next}for(c=null,l=t.firstCapturedUpdate;null!==l;){var d=l.expirationTime;d>o?(null===c&&(c=l,null===a&&(i=u)),(0===s||s>d)&&(s=d)):(u=eo(e,0,l,u,n,r),null!==l.callback&&(e.effectTag|=32,l.nextEffect=null,null===t.lastCapturedEffect?t.firstCapturedEffect=t.lastCapturedEffect=l:(t.lastCapturedEffect.nextEffect=l,t.lastCapturedEffect=l))),l=l.next}null===a&&(t.lastUpdate=null),null===c?t.lastCapturedUpdate=null:e.effectTag|=32,null===a&&null===c&&(i=u),t.baseState=i,t.firstUpdate=a,t.firstCapturedUpdate=c,e.expirationTime=s,e.memoizedState=u}function no(e,t,n){null!==t.firstCapturedUpdate&&(null!==t.lastUpdate&&(t.lastUpdate.next=t.firstCapturedUpdate,t.lastUpdate=t.lastCapturedUpdate),t.firstCapturedUpdate=t.lastCapturedUpdate=null),ro(t.firstEffect,n),t.firstEffect=t.lastEffect=null,ro(t.firstCapturedEffect,n),t.firstCapturedEffect=t.lastCapturedEffect=null}function ro(e,t){for(;null!==e;){var n=e.callback;if(null!==n){e.callback=null;var r=t;"function"!=typeof n&&a("191",n),n.call(r)}e=e.nextEffect}}function oo(e,t){return{value:e,source:t,stack:lt(t)}}var io={current:null},ao=null,so=null,lo=null;function uo(e,t){var n=e.type._context;wr(io,n._currentValue),n._currentValue=t}function co(e){var t=io.current;_r(io),e.type._context._currentValue=t}function po(e){ao=e,lo=so=null,e.firstContextDependency=null}function fo(e,t){return lo!==e&&!1!==t&&0!==t&&("number"==typeof t&&1073741823!==t||(lo=e,t=1073741823),t={context:e,observedBits:t,next:null},null===so?(null===ao&&a("277"),ao.firstContextDependency=so=t):so=so.next=t),e._currentValue}var ho={},mo={current:ho},yo={current:ho},vo={current:ho};function go(e){return e===ho&&a("174"),e}function bo(e,t){wr(vo,t),wr(yo,e),wr(mo,ho);var n=t.nodeType;switch(n){case 9:case 11:t=(t=t.documentElement)?t.namespaceURI:er(null,"");break;default:t=er(t=(n=8===n?t.parentNode:t).namespaceURI||null,n=n.tagName)}_r(mo),wr(mo,t)}function _o(e){_r(mo),_r(yo),_r(vo)}function wo(e){go(vo.current);var t=go(mo.current),n=er(t,e.type);t!==n&&(wr(yo,e),wr(mo,n))}function Eo(e){yo.current===e&&(_r(mo),_r(yo))}var So=(new r.Component).refs;function To(e,t,n,r){n=null===(n=n(r,t=e.memoizedState))||void 0===n?t:o({},t,n),e.memoizedState=n,null!==(r=e.updateQueue)&&0===e.expirationTime&&(r.baseState=n)}var ko={isMounted:function(e){return!!(e=e._reactInternalFiber)&&2===tn(e)},enqueueSetState:function(e,t,n){e=e._reactInternalFiber;var r=aa(),o=Yr(r=Ai(r,e));o.payload=t,void 0!==n&&null!==n&&(o.callback=n),Jr(e,o),Di(e,r)},enqueueReplaceState:function(e,t,n){e=e._reactInternalFiber;var r=aa(),o=Yr(r=Ai(r,e));o.tag=1,o.payload=t,void 0!==n&&null!==n&&(o.callback=n),Jr(e,o),Di(e,r)},enqueueForceUpdate:function(e,t){e=e._reactInternalFiber;var n=aa(),r=Yr(n=Ai(n,e));r.tag=2,void 0!==t&&null!==t&&(r.callback=t),Jr(e,r),Di(e,n)}};function Co(e,t,n,r,o,i,a){return"function"==typeof(e=e.stateNode).shouldComponentUpdate?e.shouldComponentUpdate(r,i,a):!t.prototype||!t.prototype.isPureReactComponent||(!en(n,r)||!en(o,i))}function Oo(e,t,n,r){e=t.state,"function"==typeof t.componentWillReceiveProps&&t.componentWillReceiveProps(n,r),"function"==typeof t.UNSAFE_componentWillReceiveProps&&t.UNSAFE_componentWillReceiveProps(n,r),t.state!==e&&ko.enqueueReplaceState(t,t.state,null)}function Po(e,t,n,r){var o=e.stateNode,i=Or(t)?kr:Sr.current;o.props=n,o.state=e.memoizedState,o.refs=So,o.context=Cr(e,i),null!==(i=e.updateQueue)&&(to(e,i,n,o,r),o.state=e.memoizedState),"function"==typeof(i=t.getDerivedStateFromProps)&&(To(e,t,i,n),o.state=e.memoizedState),"function"==typeof t.getDerivedStateFromProps||"function"==typeof o.getSnapshotBeforeUpdate||"function"!=typeof o.UNSAFE_componentWillMount&&"function"!=typeof o.componentWillMount||(t=o.state,"function"==typeof o.componentWillMount&&o.componentWillMount(),"function"==typeof o.UNSAFE_componentWillMount&&o.UNSAFE_componentWillMount(),t!==o.state&&ko.enqueueReplaceState(o,o.state,null),null!==(i=e.updateQueue)&&(to(e,i,n,o,r),o.state=e.memoizedState)),"function"==typeof o.componentDidMount&&(e.effectTag|=4)}var No=Array.isArray;function xo(e,t,n){if(null!==(e=n.ref)&&"function"!=typeof e&&"object"!=typeof e){if(n._owner){var r=void 0;(n=n._owner)&&(2!==n.tag&&3!==n.tag&&a("110"),r=n.stateNode),r||a("147",e);var o=""+e;return null!==t&&null!==t.ref&&"function"==typeof t.ref&&t.ref._stringRef===o?t.ref:((t=function(e){var t=r.refs;t===So&&(t=r.refs={}),null===e?delete t[o]:t[o]=e})._stringRef=o,t)}"string"!=typeof e&&a("284"),n._owner||a("254",e)}return e}function Mo(e,t){"textarea"!==e.type&&a("31","[object Object]"===Object.prototype.toString.call(t)?"object with keys {"+Object.keys(t).join(", ")+"}":t,"")}function Ao(e){function t(t,n){if(e){var r=t.lastEffect;null!==r?(r.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!e)return null;for(;null!==r;)t(n,r),r=r.sibling;return null}function r(e,t){for(e=new Map;null!==t;)null!==t.key?e.set(t.key,t):e.set(t.index,t),t=t.sibling;return e}function o(e,t,n){return(e=Lr(e,t,n)).index=0,e.sibling=null,e}function i(t,n,r){return t.index=r,e?null!==(r=t.alternate)?(r=r.index)<n?(t.effectTag=2,n):r:(t.effectTag=2,n):n}function s(t){return e&&null===t.alternate&&(t.effectTag=2),t}function l(e,t,n,r){return null===t||8!==t.tag?((t=qr(n,e.mode,r)).return=e,t):((t=o(t,n,r)).return=e,t)}function u(e,t,n,r){return null!==t&&t.type===n.type?((r=o(t,n.props,r)).ref=xo(e,t,n),r.return=e,r):((r=Br(n,e.mode,r)).ref=xo(e,t,n),r.return=e,r)}function c(e,t,n,r){return null===t||6!==t.tag||t.stateNode.containerInfo!==n.containerInfo||t.stateNode.implementation!==n.implementation?((t=Vr(n,e.mode,r)).return=e,t):((t=o(t,n.children||[],r)).return=e,t)}function d(e,t,n,r,i){return null===t||9!==t.tag?((t=Wr(n,e.mode,r,i)).return=e,t):((t=o(t,n,r)).return=e,t)}function p(e,t,n){if("string"==typeof t||"number"==typeof t)return(t=qr(""+t,e.mode,n)).return=e,t;if("object"==typeof t&&null!==t){switch(t.$$typeof){case Ye:return(n=Br(t,e.mode,n)).ref=xo(e,null,t),n.return=e,n;case Qe:return(t=Vr(t,e.mode,n)).return=e,t}if(No(t)||at(t))return(t=Wr(t,e.mode,n,null)).return=e,t;Mo(e,t)}return null}function f(e,t,n,r){var o=null!==t?t.key:null;if("string"==typeof n||"number"==typeof n)return null!==o?null:l(e,t,""+n,r);if("object"==typeof n&&null!==n){switch(n.$$typeof){case Ye:return n.key===o?n.type===Je?d(e,t,n.props.children,r,o):u(e,t,n,r):null;case Qe:return n.key===o?c(e,t,n,r):null}if(No(n)||at(n))return null!==o?null:d(e,t,n,r,null);Mo(e,n)}return null}function h(e,t,n,r,o){if("string"==typeof r||"number"==typeof r)return l(t,e=e.get(n)||null,""+r,o);if("object"==typeof r&&null!==r){switch(r.$$typeof){case Ye:return e=e.get(null===r.key?n:r.key)||null,r.type===Je?d(t,e,r.props.children,o,r.key):u(t,e,r,o);case Qe:return c(t,e=e.get(null===r.key?n:r.key)||null,r,o)}if(No(r)||at(r))return d(t,e=e.get(n)||null,r,o,null);Mo(t,r)}return null}function m(o,a,s,l){for(var u=null,c=null,d=a,m=a=0,y=null;null!==d&&m<s.length;m++){d.index>m?(y=d,d=null):y=d.sibling;var v=f(o,d,s[m],l);if(null===v){null===d&&(d=y);break}e&&d&&null===v.alternate&&t(o,d),a=i(v,a,m),null===c?u=v:c.sibling=v,c=v,d=y}if(m===s.length)return n(o,d),u;if(null===d){for(;m<s.length;m++)(d=p(o,s[m],l))&&(a=i(d,a,m),null===c?u=d:c.sibling=d,c=d);return u}for(d=r(o,d);m<s.length;m++)(y=h(d,o,m,s[m],l))&&(e&&null!==y.alternate&&d.delete(null===y.key?m:y.key),a=i(y,a,m),null===c?u=y:c.sibling=y,c=y);return e&&d.forEach(function(e){return t(o,e)}),u}function y(o,s,l,u){var c=at(l);"function"!=typeof c&&a("150"),null==(l=c.call(l))&&a("151");for(var d=c=null,m=s,y=s=0,v=null,g=l.next();null!==m&&!g.done;y++,g=l.next()){m.index>y?(v=m,m=null):v=m.sibling;var b=f(o,m,g.value,u);if(null===b){m||(m=v);break}e&&m&&null===b.alternate&&t(o,m),s=i(b,s,y),null===d?c=b:d.sibling=b,d=b,m=v}if(g.done)return n(o,m),c;if(null===m){for(;!g.done;y++,g=l.next())null!==(g=p(o,g.value,u))&&(s=i(g,s,y),null===d?c=g:d.sibling=g,d=g);return c}for(m=r(o,m);!g.done;y++,g=l.next())null!==(g=h(m,o,y,g.value,u))&&(e&&null!==g.alternate&&m.delete(null===g.key?y:g.key),s=i(g,s,y),null===d?c=g:d.sibling=g,d=g);return e&&m.forEach(function(e){return t(o,e)}),c}return function(e,r,i,l){var u="object"==typeof i&&null!==i&&i.type===Je&&null===i.key;u&&(i=i.props.children);var c="object"==typeof i&&null!==i;if(c)switch(i.$$typeof){case Ye:e:{for(c=i.key,u=r;null!==u;){if(u.key===c){if(9===u.tag?i.type===Je:u.type===i.type){n(e,u.sibling),(r=o(u,i.type===Je?i.props.children:i.props,l)).ref=xo(e,u,i),r.return=e,e=r;break e}n(e,u);break}t(e,u),u=u.sibling}i.type===Je?((r=Wr(i.props.children,e.mode,l,i.key)).return=e,e=r):((l=Br(i,e.mode,l)).ref=xo(e,r,i),l.return=e,e=l)}return s(e);case Qe:e:{for(u=i.key;null!==r;){if(r.key===u){if(6===r.tag&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),(r=o(r,i.children||[],l)).return=e,e=r;break e}n(e,r);break}t(e,r),r=r.sibling}(r=Vr(i,e.mode,l)).return=e,e=r}return s(e)}if("string"==typeof i||"number"==typeof i)return i=""+i,null!==r&&8===r.tag?(n(e,r.sibling),(r=o(r,i,l)).return=e,e=r):(n(e,r),(r=qr(i,e.mode,l)).return=e,e=r),s(e);if(No(i))return m(e,r,i,l);if(at(i))return y(e,r,i,l);if(c&&Mo(e,i),void 0===i&&!u)switch(e.tag){case 2:case 3:case 0:a("152",(l=e.type).displayName||l.name||"Component")}return n(e,r)}}var Do=Ao(!0),jo=Ao(!1),Io=null,Ro=null,Uo=!1;function Fo(e,t){var n=new Ur(7,null,null,0);n.type="DELETED",n.stateNode=t,n.return=e,n.effectTag=8,null!==e.lastEffect?(e.lastEffect.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n}function Lo(e,t){switch(e.tag){case 7:var n=e.type;return null!==(t=1!==t.nodeType||n.toLowerCase()!==t.nodeName.toLowerCase()?null:t)&&(e.stateNode=t,!0);case 8:return null!==(t=""===e.pendingProps||3!==t.nodeType?null:t)&&(e.stateNode=t,!0);default:return!1}}function Bo(e){if(Uo){var t=Ro;if(t){var n=t;if(!Lo(e,t)){if(!(t=yr(n))||!Lo(e,t))return e.effectTag|=2,Uo=!1,void(Io=e);Fo(Io,n)}Io=e,Ro=vr(t)}else e.effectTag|=2,Uo=!1,Io=e}}function Wo(e){for(e=e.return;null!==e&&7!==e.tag&&5!==e.tag;)e=e.return;Io=e}function qo(e){if(e!==Io)return!1;if(!Uo)return Wo(e),Uo=!0,!1;var t=e.type;if(7!==e.tag||"head"!==t&&"body"!==t&&!mr(t,e.memoizedProps))for(t=Ro;t;)Fo(e,t),t=yr(t);return Wo(e),Ro=Io?yr(e.stateNode):null,!0}function Vo(){Ro=Io=null,Uo=!1}var Ko=ze.ReactCurrentOwner;function Ho(e,t,n,r){t.child=null===e?jo(t,null,n,r):Do(t,e.child,n,r)}function zo(e,t,n,r,o){n=n.render;var i=t.ref;return Tr.current||t.memoizedProps!==r||i!==(null!==e?e.ref:null)?(Ho(e,t,n=n(r,i),o),t.memoizedProps=r,t.child):Zo(e,t,o)}function Go(e,t){var n=t.ref;(null===e&&null!==n||null!==e&&e.ref!==n)&&(t.effectTag|=128)}function $o(e,t,n,r,o){var i=Or(n)?kr:Sr.current;return i=Cr(t,i),po(t),n=n(r,i),t.effectTag|=1,Ho(e,t,n,o),t.memoizedProps=r,t.child}function Yo(e,t,n,r,o){if(Or(n)){var i=!0;Ar(t)}else i=!1;if(po(t),null===e)if(null===t.stateNode){var a=Or(n)?kr:Sr.current,s=n.contextTypes,l=null!==s&&void 0!==s,u=new n(r,s=l?Cr(t,a):Er);t.memoizedState=null!==u.state&&void 0!==u.state?u.state:null,u.updater=ko,t.stateNode=u,u._reactInternalFiber=t,l&&((l=t.stateNode).__reactInternalMemoizedUnmaskedChildContext=a,l.__reactInternalMemoizedMaskedChildContext=s),Po(t,n,r,o),r=!0}else{a=t.stateNode,s=t.memoizedProps,a.props=s;var c=a.context;l=Cr(t,l=Or(n)?kr:Sr.current);var d=n.getDerivedStateFromProps;(u="function"==typeof d||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||c!==l)&&Oo(t,a,r,l),zr=!1;var p=t.memoizedState;c=a.state=p;var f=t.updateQueue;null!==f&&(to(t,f,r,a,o),c=t.memoizedState),s!==r||p!==c||Tr.current||zr?("function"==typeof d&&(To(t,n,d,r),c=t.memoizedState),(s=zr||Co(t,n,s,r,p,c,l))?(u||"function"!=typeof a.UNSAFE_componentWillMount&&"function"!=typeof a.componentWillMount||("function"==typeof a.componentWillMount&&a.componentWillMount(),"function"==typeof a.UNSAFE_componentWillMount&&a.UNSAFE_componentWillMount()),"function"==typeof a.componentDidMount&&(t.effectTag|=4)):("function"==typeof a.componentDidMount&&(t.effectTag|=4),t.memoizedProps=r,t.memoizedState=c),a.props=r,a.state=c,a.context=l,r=s):("function"==typeof a.componentDidMount&&(t.effectTag|=4),r=!1)}else a=t.stateNode,s=t.memoizedProps,a.props=s,c=a.context,l=Cr(t,l=Or(n)?kr:Sr.current),(u="function"==typeof(d=n.getDerivedStateFromProps)||"function"==typeof a.getSnapshotBeforeUpdate)||"function"!=typeof a.UNSAFE_componentWillReceiveProps&&"function"!=typeof a.componentWillReceiveProps||(s!==r||c!==l)&&Oo(t,a,r,l),zr=!1,c=t.memoizedState,p=a.state=c,null!==(f=t.updateQueue)&&(to(t,f,r,a,o),p=t.memoizedState),s!==r||c!==p||Tr.current||zr?("function"==typeof d&&(To(t,n,d,r),p=t.memoizedState),(d=zr||Co(t,n,s,r,c,p,l))?(u||"function"!=typeof a.UNSAFE_componentWillUpdate&&"function"!=typeof a.componentWillUpdate||("function"==typeof a.componentWillUpdate&&a.componentWillUpdate(r,p,l),"function"==typeof a.UNSAFE_componentWillUpdate&&a.UNSAFE_componentWillUpdate(r,p,l)),"function"==typeof a.componentDidUpdate&&(t.effectTag|=4),"function"==typeof a.getSnapshotBeforeUpdate&&(t.effectTag|=256)):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=256),t.memoizedProps=r,t.memoizedState=p),a.props=r,a.state=p,a.context=l,r=d):("function"!=typeof a.componentDidUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=4),"function"!=typeof a.getSnapshotBeforeUpdate||s===e.memoizedProps&&c===e.memoizedState||(t.effectTag|=256),r=!1);return Qo(e,t,n,r,i,o)}function Qo(e,t,n,r,o,i){Go(e,t);var a=0!=(64&t.effectTag);if(!r&&!a)return o&&Dr(t,n,!1),Zo(e,t,i);r=t.stateNode,Ko.current=t;var s=a?null:r.render();return t.effectTag|=1,null!==e&&a&&(Ho(e,t,null,i),t.child=null),Ho(e,t,s,i),t.memoizedState=r.state,t.memoizedProps=r.props,o&&Dr(t,n,!0),t.child}function Jo(e){var t=e.stateNode;t.pendingContext?xr(0,t.pendingContext,t.pendingContext!==t.context):t.context&&xr(0,t.context,!1),bo(e,t.containerInfo)}function Xo(e,t){if(e&&e.defaultProps)for(var n in t=o({},t),e=e.defaultProps)void 0===t[n]&&(t[n]=e[n]);return t}function Zo(e,t,n){null!==e&&(t.firstContextDependency=e.firstContextDependency);var r=t.childExpirationTime;if(0===r||r>n)return null;if(null!==e&&t.child!==e.child&&a("153"),null!==t.child){for(n=Lr(e=t.child,e.pendingProps,e.expirationTime),t.child=n,n.return=t;null!==e.sibling;)e=e.sibling,(n=n.sibling=Lr(e,e.pendingProps,e.expirationTime)).return=t;n.sibling=null}return t.child}function ei(e,t,n){var r=t.expirationTime;if(!Tr.current&&(0===r||r>n)){switch(t.tag){case 5:Jo(t),Vo();break;case 7:wo(t);break;case 2:Or(t.type)&&Ar(t);break;case 3:Or(t.type._reactResult)&&Ar(t);break;case 6:bo(t,t.stateNode.containerInfo);break;case 12:uo(t,t.memoizedProps.value)}return Zo(e,t,n)}switch(t.expirationTime=0,t.tag){case 4:return function(e,t,n,r){null!==e&&a("155");var o=t.pendingProps;if("object"==typeof n&&null!==n&&"function"==typeof n.then){var i=n=function(e){switch(e._reactStatus){case 1:return e._reactResult;case 2:throw e._reactResult;case 0:throw e;default:throw e._reactStatus=0,e.then(function(t){if(0===e._reactStatus){if(e._reactStatus=1,"object"==typeof t&&null!==t){var n=t.default;t=void 0!==n&&null!==n?n:t}e._reactResult=t}},function(t){0===e._reactStatus&&(e._reactStatus=2,e._reactResult=t)}),e}}(n);i="function"==typeof i?Fr(i)?3:1:void 0!==i&&null!==i&&i.$$typeof?14:4,i=t.tag=i;var s=Xo(n,o);switch(i){case 1:return $o(e,t,n,s,r);case 3:return Yo(e,t,n,s,r);case 14:return zo(e,t,n,s,r);default:a("283",n)}}if(i=Cr(t,Sr.current),po(t),i=n(o,i),t.effectTag|=1,"object"==typeof i&&null!==i&&"function"==typeof i.render&&void 0===i.$$typeof){t.tag=2,Or(n)?(s=!0,Ar(t)):s=!1,t.memoizedState=null!==i.state&&void 0!==i.state?i.state:null;var l=n.getDerivedStateFromProps;return"function"==typeof l&&To(t,n,l,o),i.updater=ko,t.stateNode=i,i._reactInternalFiber=t,Po(t,n,o,r),Qo(e,t,n,!0,s,r)}return t.tag=0,Ho(e,t,i,r),t.memoizedProps=o,t.child}(e,t,t.type,n);case 0:return $o(e,t,t.type,t.pendingProps,n);case 1:var o=t.type._reactResult;return e=$o(e,t,o,Xo(o,r=t.pendingProps),n),t.memoizedProps=r,e;case 2:return Yo(e,t,t.type,t.pendingProps,n);case 3:return e=Yo(e,t,o=t.type._reactResult,Xo(o,r=t.pendingProps),n),t.memoizedProps=r,e;case 5:return Jo(t),null===(r=t.updateQueue)&&a("282"),o=null!==(o=t.memoizedState)?o.element:null,to(t,r,t.pendingProps,null,n),(r=t.memoizedState.element)===o?(Vo(),t=Zo(e,t,n)):(o=t.stateNode,(o=(null===e||null===e.child)&&o.hydrate)&&(Ro=vr(t.stateNode.containerInfo),Io=t,o=Uo=!0),o?(t.effectTag|=2,t.child=jo(t,null,r,n)):(Ho(e,t,r,n),Vo()),t=t.child),t;case 7:wo(t),null===e&&Bo(t),r=t.type,o=t.pendingProps;var i=null!==e?e.memoizedProps:null,s=o.children;return mr(r,o)?s=null:null!==i&&mr(r,i)&&(t.effectTag|=16),Go(e,t),1073741823!==n&&1&t.mode&&o.hidden?(t.expirationTime=1073741823,t.memoizedProps=o,t=null):(Ho(e,t,s,n),t.memoizedProps=o,t=t.child),t;case 8:return null===e&&Bo(t),t.memoizedProps=t.pendingProps,null;case 16:return null;case 6:return bo(t,t.stateNode.containerInfo),r=t.pendingProps,null===e?t.child=Do(t,null,r,n):Ho(e,t,r,n),t.memoizedProps=r,t.child;case 13:return zo(e,t,t.type,t.pendingProps,n);case 14:return e=zo(e,t,o=t.type._reactResult,Xo(o,r=t.pendingProps),n),t.memoizedProps=r,e;case 9:return Ho(e,t,r=t.pendingProps,n),t.memoizedProps=r,t.child;case 10:return Ho(e,t,r=t.pendingProps.children,n),t.memoizedProps=r,t.child;case 15:return Ho(e,t,(r=t.pendingProps).children,n),t.memoizedProps=r,t.child;case 12:e:{if(r=t.type._context,o=t.pendingProps,s=t.memoizedProps,i=o.value,t.memoizedProps=o,uo(t,i),null!==s){var l=s.value;if(0===(i=l===i&&(0!==l||1/l==1/i)||l!=l&&i!=i?0:0|("function"==typeof r._calculateChangedBits?r._calculateChangedBits(l,i):1073741823))){if(s.children===o.children&&!Tr.current){t=Zo(e,t,n);break e}}else for(null!==(s=t.child)&&(s.return=t);null!==s;){if(null!==(l=s.firstContextDependency))do{if(l.context===r&&0!=(l.observedBits&i)){if(2===s.tag||3===s.tag){var u=Yr(n);u.tag=2,Jr(s,u)}(0===s.expirationTime||s.expirationTime>n)&&(s.expirationTime=n),null!==(u=s.alternate)&&(0===u.expirationTime||u.expirationTime>n)&&(u.expirationTime=n);for(var c=s.return;null!==c;){if(u=c.alternate,0===c.childExpirationTime||c.childExpirationTime>n)c.childExpirationTime=n,null!==u&&(0===u.childExpirationTime||u.childExpirationTime>n)&&(u.childExpirationTime=n);else{if(null===u||!(0===u.childExpirationTime||u.childExpirationTime>n))break;u.childExpirationTime=n}c=c.return}}u=s.child,l=l.next}while(null!==l);else u=12===s.tag&&s.type===t.type?null:s.child;if(null!==u)u.return=s;else for(u=s;null!==u;){if(u===t){u=null;break}if(null!==(s=u.sibling)){s.return=u.return,u=s;break}u=u.return}s=u}}Ho(e,t,o.children,n),t=t.child}return t;case 11:return i=t.type,o=(r=t.pendingProps).children,po(t),o=o(i=fo(i,r.unstable_observedBits)),t.effectTag|=1,Ho(e,t,o,n),t.memoizedProps=r,t.child;default:a("156")}}function ti(e){e.effectTag|=4}var ni=void 0,ri=void 0,oi=void 0;function ii(e,t){var n=t.source,r=t.stack;null===r&&null!==n&&(r=lt(n)),null!==n&&st(n.type),t=t.value,null!==e&&2===e.tag&&st(e.type);try{console.error(t)}catch(e){setTimeout(function(){throw e})}}function ai(e){var t=e.ref;if(null!==t)if("function"==typeof t)try{t(null)}catch(t){Mi(e,t)}else t.current=null}function si(e){switch("function"==typeof Ir&&Ir(e),e.tag){case 2:case 3:ai(e);var t=e.stateNode;if("function"==typeof t.componentWillUnmount)try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(t){Mi(e,t)}break;case 7:ai(e);break;case 6:ci(e)}}function li(e){return 7===e.tag||5===e.tag||6===e.tag}function ui(e){e:{for(var t=e.return;null!==t;){if(li(t)){var n=t;break e}t=t.return}a("160"),n=void 0}var r=t=void 0;switch(n.tag){case 7:t=n.stateNode,r=!1;break;case 5:case 6:t=n.stateNode.containerInfo,r=!0;break;default:a("161")}16&n.effectTag&&(rr(t,""),n.effectTag&=-17);e:t:for(n=e;;){for(;null===n.sibling;){if(null===n.return||li(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;7!==n.tag&&8!==n.tag;){if(2&n.effectTag)continue t;if(null===n.child||6===n.tag)continue t;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break e}}for(var o=e;;){if(7===o.tag||8===o.tag)if(n)if(r){var i=t,s=o.stateNode,l=n;8===i.nodeType?i.parentNode.insertBefore(s,l):i.insertBefore(s,l)}else t.insertBefore(o.stateNode,n);else r?(i=t,s=o.stateNode,8===i.nodeType?(l=i.parentNode).insertBefore(s,i):(l=i).appendChild(s),null===l.onclick&&(l.onclick=dr)):t.appendChild(o.stateNode);else if(6!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===e)break;for(;null===o.sibling;){if(null===o.return||o.return===e)return;o=o.return}o.sibling.return=o.return,o=o.sibling}}function ci(e){for(var t=e,n=!1,r=void 0,o=void 0;;){if(!n){n=t.return;e:for(;;){switch(null===n&&a("160"),n.tag){case 7:r=n.stateNode,o=!1;break e;case 5:case 6:r=n.stateNode.containerInfo,o=!0;break e}n=n.return}n=!0}if(7===t.tag||8===t.tag){e:for(var i=t,s=i;;)if(si(s),null!==s.child&&6!==s.tag)s.child.return=s,s=s.child;else{if(s===i)break;for(;null===s.sibling;){if(null===s.return||s.return===i)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}o?(i=r,s=t.stateNode,8===i.nodeType?i.parentNode.removeChild(s):i.removeChild(s)):r.removeChild(t.stateNode)}else if(6===t.tag?(r=t.stateNode.containerInfo,o=!0):si(t),null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return;6===(t=t.return).tag&&(n=!1)}t.sibling.return=t.return,t=t.sibling}}function di(e,t){switch(t.tag){case 2:case 3:break;case 7:var n=t.stateNode;if(null!=n){var r=t.memoizedProps,o=null!==e?e.memoizedProps:r;e=t.type;var i=t.updateQueue;if(t.updateQueue=null,null!==i){for(n[R]=r,"input"===e&&"radio"===r.type&&null!=r.name&&wt(n,r),ur(e,o),t=ur(e,r),o=0;o<i.length;o+=2){var s=i[o],l=i[o+1];"style"===s?ar(n,l):"dangerouslySetInnerHTML"===s?nr(n,l):"children"===s?rr(n,l):vt(n,s,l,t)}switch(e){case"input":Et(n,r);break;case"textarea":Qn(n,r);break;case"select":e=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,null!=(i=r.value)?Gn(n,!!r.multiple,i,!1):e!==!!r.multiple&&(null!=r.defaultValue?Gn(n,!!r.multiple,r.defaultValue,!0):Gn(n,!!r.multiple,r.multiple?[]:"",!1))}}}break;case 8:null===t.stateNode&&a("162"),t.stateNode.nodeValue=t.memoizedProps;break;case 5:case 15:case 16:break;default:a("163")}}function pi(e,t,n){(n=Yr(n)).tag=3,n.payload={element:null};var r=t.value;return n.callback=function(){fa(r),ii(e,t)},n}function fi(e,t,n){(n=Yr(n)).tag=3;var r=e.stateNode;return null!==r&&"function"==typeof r.componentDidCatch&&(n.callback=function(){null===Ci?Ci=new Set([this]):Ci.add(this);var n=t.value,r=t.stack;ii(e,t),this.componentDidCatch(n,{componentStack:null!==r?r:""})}),n}function hi(e){switch(e.tag){case 2:Or(e.type)&&Pr();var t=e.effectTag;return 1024&t?(e.effectTag=-1025&t|64,e):null;case 3:return Or(e.type._reactResult)&&Pr(),1024&(t=e.effectTag)?(e.effectTag=-1025&t|64,e):null;case 5:return _o(),Nr(),0!=(64&(t=e.effectTag))&&a("285"),e.effectTag=-1025&t|64,e;case 7:return Eo(e),null;case 16:return 1024&(t=e.effectTag)?(e.effectTag=-1025&t|64,e):null;case 6:return _o(),null;case 12:return co(e),null;default:return null}}ni=function(){},ri=function(e,t,n,r,i){var a=e.memoizedProps;if(a!==r){var s=t.stateNode;switch(go(mo.current),e=null,n){case"input":a=bt(s,a),r=bt(s,r),e=[];break;case"option":a=zn(s,a),r=zn(s,r),e=[];break;case"select":a=o({},a,{value:void 0}),r=o({},r,{value:void 0}),e=[];break;case"textarea":a=$n(s,a),r=$n(s,r),e=[];break;default:"function"!=typeof a.onClick&&"function"==typeof r.onClick&&(s.onclick=dr)}lr(n,r),s=n=void 0;var l=null;for(n in a)if(!r.hasOwnProperty(n)&&a.hasOwnProperty(n)&&null!=a[n])if("style"===n){var u=a[n];for(s in u)u.hasOwnProperty(s)&&(l||(l={}),l[s]="")}else"dangerouslySetInnerHTML"!==n&&"children"!==n&&"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&"autoFocus"!==n&&(b.hasOwnProperty(n)?e||(e=[]):(e=e||[]).push(n,null));for(n in r){var c=r[n];if(u=null!=a?a[n]:void 0,r.hasOwnProperty(n)&&c!==u&&(null!=c||null!=u))if("style"===n)if(u){for(s in u)!u.hasOwnProperty(s)||c&&c.hasOwnProperty(s)||(l||(l={}),l[s]="");for(s in c)c.hasOwnProperty(s)&&u[s]!==c[s]&&(l||(l={}),l[s]=c[s])}else l||(e||(e=[]),e.push(n,l)),l=c;else"dangerouslySetInnerHTML"===n?(c=c?c.__html:void 0,u=u?u.__html:void 0,null!=c&&u!==c&&(e=e||[]).push(n,""+c)):"children"===n?u===c||"string"!=typeof c&&"number"!=typeof c||(e=e||[]).push(n,""+c):"suppressContentEditableWarning"!==n&&"suppressHydrationWarning"!==n&&(b.hasOwnProperty(n)?(null!=c&&cr(i,n),e||u===c||(e=[])):(e=e||[]).push(n,c))}l&&(e=e||[]).push("style",l),i=e,(t.updateQueue=i)&&ti(t)}},oi=function(e,t,n,r){n!==r&&ti(t)};var mi={readContext:fo},yi=ze.ReactCurrentOwner,vi=0,gi=0,bi=!1,_i=null,wi=null,Ei=0,Si=!1,Ti=null,ki=!1,Ci=null;function Oi(){if(null!==_i)for(var e=_i.return;null!==e;){var t=e;switch(t.tag){case 2:var n=t.type.childContextTypes;null!==n&&void 0!==n&&Pr();break;case 3:null!==(n=t.type._reactResult.childContextTypes)&&void 0!==n&&Pr();break;case 5:_o(),Nr();break;case 7:Eo(t);break;case 6:_o();break;case 12:co(t)}e=e.return}wi=null,Ei=0,Si=!1,_i=null}function Pi(e){for(;;){var t=e.alternate,n=e.return,r=e.sibling;if(0==(512&e.effectTag)){var i=t,s=(t=e).pendingProps;switch(t.tag){case 0:case 1:break;case 2:Or(t.type)&&Pr();break;case 3:Or(t.type._reactResult)&&Pr();break;case 5:_o(),Nr(),(s=t.stateNode).pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),null!==i&&null!==i.child||(qo(t),t.effectTag&=-3),ni(t);break;case 7:Eo(t);var l=go(vo.current),u=t.type;if(null!==i&&null!=t.stateNode)ri(i,t,u,s,l),i.ref!==t.ref&&(t.effectTag|=128);else if(s){var c=go(mo.current);if(qo(t)){i=(s=t).stateNode;var d=s.type,p=s.memoizedProps,f=l;switch(i[I]=s,i[R]=p,u=void 0,l=d){case"iframe":case"object":kn("load",i);break;case"video":case"audio":for(d=0;d<re.length;d++)kn(re[d],i);break;case"source":kn("error",i);break;case"img":case"image":case"link":kn("error",i),kn("load",i);break;case"form":kn("reset",i),kn("submit",i);break;case"details":kn("toggle",i);break;case"input":_t(i,p),kn("invalid",i),cr(f,"onChange");break;case"select":i._wrapperState={wasMultiple:!!p.multiple},kn("invalid",i),cr(f,"onChange");break;case"textarea":Yn(i,p),kn("invalid",i),cr(f,"onChange")}for(u in lr(l,p),d=null,p)p.hasOwnProperty(u)&&(c=p[u],"children"===u?"string"==typeof c?i.textContent!==c&&(d=["children",c]):"number"==typeof c&&i.textContent!==""+c&&(d=["children",""+c]):b.hasOwnProperty(u)&&null!=c&&cr(f,u));switch(l){case"input":Ke(i),St(i,p,!0);break;case"textarea":Ke(i),Jn(i);break;case"select":case"option":break;default:"function"==typeof p.onClick&&(i.onclick=dr)}u=d,s.updateQueue=u,(s=null!==u)&&ti(t)}else{p=t,i=u,f=s,d=9===l.nodeType?l:l.ownerDocument,c===Xn.html&&(c=Zn(i)),c===Xn.html?"script"===i?((i=d.createElement("div")).innerHTML="<script><\/script>",d=i.removeChild(i.firstChild)):"string"==typeof f.is?d=d.createElement(i,{is:f.is}):(d=d.createElement(i),"select"===i&&f.multiple&&(d.multiple=!0)):d=d.createElementNS(c,i),(i=d)[I]=p,i[R]=s;e:for(p=i,f=t,d=f.child;null!==d;){if(7===d.tag||8===d.tag)p.appendChild(d.stateNode);else if(6!==d.tag&&null!==d.child){d.child.return=d,d=d.child;continue}if(d===f)break;for(;null===d.sibling;){if(null===d.return||d.return===f)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}f=i;var h=l,m=ur(d=u,p=s);switch(d){case"iframe":case"object":kn("load",f),l=p;break;case"video":case"audio":for(l=0;l<re.length;l++)kn(re[l],f);l=p;break;case"source":kn("error",f),l=p;break;case"img":case"image":case"link":kn("error",f),kn("load",f),l=p;break;case"form":kn("reset",f),kn("submit",f),l=p;break;case"details":kn("toggle",f),l=p;break;case"input":_t(f,p),l=bt(f,p),kn("invalid",f),cr(h,"onChange");break;case"option":l=zn(f,p);break;case"select":f._wrapperState={wasMultiple:!!p.multiple},l=o({},p,{value:void 0}),kn("invalid",f),cr(h,"onChange");break;case"textarea":Yn(f,p),l=$n(f,p),kn("invalid",f),cr(h,"onChange");break;default:l=p}lr(d,l),c=void 0;var y=d,v=f,g=l;for(c in g)if(g.hasOwnProperty(c)){var _=g[c];"style"===c?ar(v,_):"dangerouslySetInnerHTML"===c?null!=(_=_?_.__html:void 0)&&nr(v,_):"children"===c?"string"==typeof _?("textarea"!==y||""!==_)&&rr(v,_):"number"==typeof _&&rr(v,""+_):"suppressContentEditableWarning"!==c&&"suppressHydrationWarning"!==c&&"autoFocus"!==c&&(b.hasOwnProperty(c)?null!=_&&cr(h,c):null!=_&&vt(v,c,_,m))}switch(d){case"input":Ke(f),St(f,p,!1);break;case"textarea":Ke(f),Jn(f);break;case"option":null!=p.value&&f.setAttribute("value",""+gt(p.value));break;case"select":(l=f).multiple=!!p.multiple,null!=(f=p.value)?Gn(l,!!p.multiple,f,!1):null!=p.defaultValue&&Gn(l,!!p.multiple,p.defaultValue,!0);break;default:"function"==typeof l.onClick&&(f.onclick=dr)}(s=hr(u,s))&&ti(t),t.stateNode=i}null!==t.ref&&(t.effectTag|=128)}else null===t.stateNode&&a("166");break;case 8:i&&null!=t.stateNode?oi(i,t,i.memoizedProps,s):("string"!=typeof s&&(null===t.stateNode&&a("166")),i=go(vo.current),go(mo.current),qo(t)?(u=(s=t).stateNode,i=s.memoizedProps,u[I]=s,(s=u.nodeValue!==i)&&ti(t)):(u=t,(s=(9===i.nodeType?i:i.ownerDocument).createTextNode(s))[I]=u,t.stateNode=s));break;case 13:case 14:case 16:case 9:case 10:case 15:break;case 6:_o(),ni(t);break;case 12:co(t);break;case 11:break;case 4:a("167");default:a("156")}if(t=_i=null,s=e,1073741823===Ei||1073741823!==s.childExpirationTime){for(u=0,i=s.child;null!==i;)l=i.expirationTime,p=i.childExpirationTime,(0===u||0!==l&&l<u)&&(u=l),(0===u||0!==p&&p<u)&&(u=p),i=i.sibling;s.childExpirationTime=u}if(null!==t)return t;null!==n&&0==(512&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=e.firstEffect),null!==e.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=e.firstEffect),n.lastEffect=e.lastEffect),1<e.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=e:n.firstEffect=e,n.lastEffect=e))}else{if(null!==(e=hi(e)))return e.effectTag&=511,e;null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=512)}if(null!==r)return r;if(null===n)break;e=n}return null}function Ni(e){var t=ei(e.alternate,e,Ei);return null===t&&(t=Pi(e)),yi.current=null,t}function xi(e,t,n){bi&&a("243"),bi=!0,yi.currentDispatcher=mi;var r=e.nextExpirationTimeToWorkOn;r===Ei&&e===wi&&null!==_i||(Oi(),Ei=r,_i=Lr((wi=e).current,null,Ei),e.pendingCommitExpirationTime=0);for(var o=!1;;){try{if(t)for(;null!==_i&&!pa();)_i=Ni(_i);else for(;null!==_i;)_i=Ni(_i)}catch(e){if(null===_i)o=!0,fa(e);else{null===_i&&a("271");var i=_i,s=i.return;if(null!==s){e:{var l=s,u=i,c=e;s=Ei,u.effectTag|=512,u.firstEffect=u.lastEffect=null,Si=!0,c=oo(c,u);do{switch(l.tag){case 5:l.effectTag|=1024,l.expirationTime=s,Xr(l,s=pi(l,c,s));break e;case 2:case 3:u=c;var d=l.stateNode;if(0==(64&l.effectTag)&&null!==d&&"function"==typeof d.componentDidCatch&&(null===Ci||!Ci.has(d))){l.effectTag|=1024,l.expirationTime=s,Xr(l,s=fi(l,u,s));break e}}l=l.return}while(null!==l)}_i=Pi(i);continue}o=!0,fa(e)}}break}if(bi=!1,lo=so=ao=yi.currentDispatcher=null,o)wi=null,e.finishedWork=null;else if(null!==_i)e.finishedWork=null;else{if(null===(t=e.current.alternate)&&a("281"),wi=null,Si){if(o=e.latestPendingTime,i=e.latestSuspendedTime,s=e.latestPingedTime,0!==o&&o>r||0!==i&&i>r||0!==s&&s>r)return e.didError=!1,0!==(n=e.latestPingedTime)&&n<=r&&(e.latestPingedTime=0),n=e.earliestPendingTime,t=e.latestPendingTime,n===r?e.earliestPendingTime=t===r?e.latestPendingTime=0:t:t===r&&(e.latestPendingTime=n),n=e.earliestSuspendedTime,t=e.latestSuspendedTime,0===n?e.earliestSuspendedTime=e.latestSuspendedTime=r:n>r?e.earliestSuspendedTime=r:t<r&&(e.latestSuspendedTime=r),Hr(r,e),void(e.expirationTime=e.expirationTime);if(!e.didError&&!n)return e.didError=!0,e.nextExpirationTimeToWorkOn=r,r=e.expirationTime=1,void(e.expirationTime=r)}e.pendingCommitExpirationTime=r,e.finishedWork=t}}function Mi(e,t){var n;e:{for(bi&&!ki&&a("263"),n=e.return;null!==n;){switch(n.tag){case 2:case 3:var r=n.stateNode;if("function"==typeof n.type.getDerivedStateFromCatch||"function"==typeof r.componentDidCatch&&(null===Ci||!Ci.has(r))){Jr(n,e=fi(n,e=oo(t,e),1)),Di(n,1),n=void 0;break e}break;case 5:Jr(n,e=pi(n,e=oo(t,e),1)),Di(n,1),n=void 0;break e}n=n.return}5===e.tag&&(Jr(e,n=pi(e,n=oo(t,e),1)),Di(e,1)),n=void 0}return n}function Ai(e,t){return 0!==gi?e=gi:bi?e=ki?1:Ei:1&t.mode?(e=Yi?2+10*(1+((e-2+15)/10|0)):2+25*(1+((e-2+500)/25|0)),null!==wi&&e===Ei&&(e+=1)):e=1,Yi&&(0===qi||e>qi)&&(qi=e),e}function Di(e,t){e:{(0===e.expirationTime||e.expirationTime>t)&&(e.expirationTime=t);var n=e.alternate;null!==n&&(0===n.expirationTime||n.expirationTime>t)&&(n.expirationTime=t);var r=e.return;if(null===r&&5===e.tag)e=e.stateNode;else{for(;null!==r;){if(n=r.alternate,(0===r.childExpirationTime||r.childExpirationTime>t)&&(r.childExpirationTime=t),null!==n&&(0===n.childExpirationTime||n.childExpirationTime>t)&&(n.childExpirationTime=t),null===r.return&&5===r.tag){e=r.stateNode;break e}r=r.return}e=null}}null!==e&&(!bi&&0!==Ei&&t<Ei&&Oi(),Kr(e,t),bi&&!ki&&wi===e||(t=e,e=e.expirationTime,null===t.nextScheduledRoot?(t.expirationTime=e,null===Ri?(Ii=Ri=t,t.nextScheduledRoot=t):(Ri=Ri.nextScheduledRoot=t).nextScheduledRoot=Ii):(0===(n=t.expirationTime)||e<n)&&(t.expirationTime=e),Li||(Gi?$i&&(Bi=t,Wi=1,ca(t,1,!0)):1===e?ua(1,null):ia(t,e))),ta>ea&&(ta=0,a("185")))}function ji(e,t,n,r,o){var i=gi;gi=1;try{return e(t,n,r,o)}finally{gi=i}}var Ii=null,Ri=null,Ui=0,Fi=void 0,Li=!1,Bi=null,Wi=0,qi=0,Vi=!1,Ki=!1,Hi=null,zi=null,Gi=!1,$i=!1,Yi=!1,Qi=null,Ji=i.unstable_now(),Xi=2+(Ji/10|0),Zi=Xi,ea=50,ta=0,na=null,ra=1;function oa(){Xi=2+((i.unstable_now()-Ji)/10|0)}function ia(e,t){if(0!==Ui){if(t>Ui)return;null!==Fi&&i.unstable_cancelScheduledWork(Fi)}Ui=t,e=i.unstable_now()-Ji,Fi=i.unstable_scheduleWork(la,{timeout:10*(t-2)-e})}function aa(){return Li?Zi:(sa(),0!==Wi&&1073741823!==Wi||(oa(),Zi=Xi),Zi)}function sa(){var e=0,t=null;if(null!==Ri)for(var n=Ri,r=Ii;null!==r;){var o=r.expirationTime;if(0===o){if((null===n||null===Ri)&&a("244"),r===r.nextScheduledRoot){Ii=Ri=r.nextScheduledRoot=null;break}if(r===Ii)Ii=o=r.nextScheduledRoot,Ri.nextScheduledRoot=o,r.nextScheduledRoot=null;else{if(r===Ri){(Ri=n).nextScheduledRoot=Ii,r.nextScheduledRoot=null;break}n.nextScheduledRoot=r.nextScheduledRoot,r.nextScheduledRoot=null}r=n.nextScheduledRoot}else{if((0===e||o<e)&&(e=o,t=r),r===Ri)break;if(1===e)break;n=r,r=r.nextScheduledRoot}}Bi=t,Wi=e}function la(e){if(e.didTimeout&&null!==Ii){oa();var t=Ii;do{var n=t.expirationTime;0!==n&&Xi>=n&&(t.nextExpirationTimeToWorkOn=Xi),t=t.nextScheduledRoot}while(t!==Ii)}ua(0,e)}function ua(e,t){if(zi=t,sa(),null!==zi)for(oa(),Zi=Xi;null!==Bi&&0!==Wi&&(0===e||e>=Wi)&&(!Vi||Xi>=Wi);)ca(Bi,Wi,Xi>=Wi),sa(),oa(),Zi=Xi;else for(;null!==Bi&&0!==Wi&&(0===e||e>=Wi);)ca(Bi,Wi,!0),sa();if(null!==zi&&(Ui=0,Fi=null),0!==Wi&&ia(Bi,Wi),zi=null,Vi=!1,ta=0,na=null,null!==Qi)for(e=Qi,Qi=null,t=0;t<e.length;t++){var n=e[t];try{n._onComplete()}catch(e){Ki||(Ki=!0,Hi=e)}}if(Ki)throw e=Hi,Hi=null,Ki=!1,e}function ca(e,t,n){if(Li&&a("245"),Li=!0,null===zi||n){var r=e.finishedWork;null!==r?da(e,r,t):(e.finishedWork=null,xi(e,!1,n),null!==(r=e.finishedWork)&&da(e,r,t))}else null!==(r=e.finishedWork)?da(e,r,t):(e.finishedWork=null,xi(e,!0,n),null!==(r=e.finishedWork)&&(pa()?e.finishedWork=r:da(e,r,t)));Li=!1}function da(e,t,n){var r=e.firstBatch;if(null!==r&&r._expirationTime<=n&&(null===Qi?Qi=[r]:Qi.push(r),r._defer))return e.finishedWork=t,void(e.expirationTime=0);e.finishedWork=null,e===na?ta++:(na=e,ta=0),ki=bi=!0,e.current===t&&a("177"),0===(n=e.pendingCommitExpirationTime)&&a("261"),e.pendingCommitExpirationTime=0,r=t.expirationTime;var o=t.childExpirationTime;if(r=0===r||0!==o&&o<r?o:r,e.didError=!1,0===r?(e.earliestPendingTime=0,e.latestPendingTime=0,e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0):(0!==(o=e.latestPendingTime)&&(o<r?e.earliestPendingTime=e.latestPendingTime=0:e.earliestPendingTime<r&&(e.earliestPendingTime=e.latestPendingTime)),0===(o=e.earliestSuspendedTime)?Kr(e,r):r>e.latestSuspendedTime?(e.earliestSuspendedTime=0,e.latestSuspendedTime=0,e.latestPingedTime=0,Kr(e,r)):r<o&&Kr(e,r)),Hr(0,e),yi.current=null,1<t.effectTag?null!==t.lastEffect?(t.lastEffect.nextEffect=t,r=t.firstEffect):r=t:r=t.firstEffect,pr=Tn,Un(o=Rn())){if("selectionStart"in o)var i={start:o.selectionStart,end:o.selectionEnd};else e:{var s=(i=(i=o.ownerDocument)&&i.defaultView||window).getSelection&&i.getSelection();if(s&&0!==s.rangeCount){i=s.anchorNode;var l=s.anchorOffset,u=s.focusNode;s=s.focusOffset;try{i.nodeType,u.nodeType}catch(e){i=null;break e}var c=0,d=-1,p=-1,f=0,h=0,m=o,y=null;t:for(;;){for(var v;m!==i||0!==l&&3!==m.nodeType||(d=c+l),m!==u||0!==s&&3!==m.nodeType||(p=c+s),3===m.nodeType&&(c+=m.nodeValue.length),null!==(v=m.firstChild);)y=m,m=v;for(;;){if(m===o)break t;if(y===i&&++f===l&&(d=c),y===u&&++h===s&&(p=c),null!==(v=m.nextSibling))break;y=(m=y).parentNode}m=v}i=-1===d||-1===p?null:{start:d,end:p}}else i=null}i=i||{start:0,end:0}}else i=null;for(fr={focusedElem:o,selectionRange:i},Tn=!1,Ti=r;null!==Ti;){o=!1,i=void 0;try{for(;null!==Ti;){if(256&Ti.effectTag){var g=Ti.alternate;e:switch(l=Ti,l.tag){case 2:case 3:if(256&l.effectTag&&null!==g){var b=g.memoizedProps,_=g.memoizedState,w=l.stateNode;w.props=l.memoizedProps,w.state=l.memoizedState;var E=w.getSnapshotBeforeUpdate(b,_);w.__reactInternalSnapshotBeforeUpdate=E}break e;case 5:case 7:case 8:case 6:break e;default:a("163")}}Ti=Ti.nextEffect}}catch(e){o=!0,i=e}o&&(null===Ti&&a("178"),Mi(Ti,i),null!==Ti&&(Ti=Ti.nextEffect))}for(Ti=r;null!==Ti;){g=!1,b=void 0;try{for(;null!==Ti;){var S=Ti.effectTag;if(16&S&&rr(Ti.stateNode,""),128&S){var T=Ti.alternate;if(null!==T){var k=T.ref;null!==k&&("function"==typeof k?k(null):k.current=null)}}switch(14&S){case 2:ui(Ti),Ti.effectTag&=-3;break;case 6:ui(Ti),Ti.effectTag&=-3,di(Ti.alternate,Ti);break;case 4:di(Ti.alternate,Ti);break;case 8:ci(_=Ti),_.return=null,_.child=null,_.alternate&&(_.alternate.child=null,_.alternate.return=null)}Ti=Ti.nextEffect}}catch(e){g=!0,b=e}g&&(null===Ti&&a("178"),Mi(Ti,b),null!==Ti&&(Ti=Ti.nextEffect))}if(k=fr,T=Rn(),S=k.focusedElem,b=k.selectionRange,T!==S&&S&&S.ownerDocument&&function e(t,n){return!(!t||!n)&&(t===n||(!t||3!==t.nodeType)&&(n&&3===n.nodeType?e(t,n.parentNode):"contains"in t?t.contains(n):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(n))))}(S.ownerDocument.documentElement,S)){null!==b&&Un(S)&&(T=b.start,void 0===(k=b.end)&&(k=T),"selectionStart"in S?(S.selectionStart=T,S.selectionEnd=Math.min(k,S.value.length)):(T=((g=S.ownerDocument||document)&&g.defaultView||window).getSelection(),_=S.textContent.length,k=Math.min(b.start,_),b=void 0===b.end?k:Math.min(b.end,_),!T.extend&&k>b&&(_=b,b=k,k=_),_=In(S,k),w=In(S,b),_&&w&&(1!==T.rangeCount||T.anchorNode!==_.node||T.anchorOffset!==_.offset||T.focusNode!==w.node||T.focusOffset!==w.offset)&&((g=g.createRange()).setStart(_.node,_.offset),T.removeAllRanges(),k>b?(T.addRange(g),T.extend(w.node,w.offset)):(g.setEnd(w.node,w.offset),T.addRange(g))))),T=[];for(k=S;k=k.parentNode;)1===k.nodeType&&T.push({element:k,left:k.scrollLeft,top:k.scrollTop});for("function"==typeof S.focus&&S.focus(),S=0;S<T.length;S++)(k=T[S]).element.scrollLeft=k.left,k.element.scrollTop=k.top}for(fr=null,Tn=!!pr,pr=null,e.current=t,Ti=r;null!==Ti;){r=!1,S=void 0;try{for(T=n;null!==Ti;){var C=Ti.effectTag;if(36&C){var O=Ti.alternate;switch(g=T,(k=Ti).tag){case 2:case 3:var P=k.stateNode;if(4&k.effectTag)if(null===O)P.props=k.memoizedProps,P.state=k.memoizedState,P.componentDidMount();else{var N=O.memoizedProps,x=O.memoizedState;P.props=k.memoizedProps,P.state=k.memoizedState,P.componentDidUpdate(N,x,P.__reactInternalSnapshotBeforeUpdate)}var M=k.updateQueue;null!==M&&(P.props=k.memoizedProps,P.state=k.memoizedState,no(0,M,P));break;case 5:var A=k.updateQueue;if(null!==A){if(b=null,null!==k.child)switch(k.child.tag){case 7:b=k.child.stateNode;break;case 2:case 3:b=k.child.stateNode}no(0,A,b)}break;case 7:var D=k.stateNode;null===O&&4&k.effectTag&&hr(k.type,k.memoizedProps)&&D.focus();break;case 8:case 6:case 15:case 16:break;default:a("163")}}if(128&C){var j=Ti.ref;if(null!==j){var I=Ti.stateNode;switch(Ti.tag){case 7:var R=I;break;default:R=I}"function"==typeof j?j(R):j.current=R}}var U=Ti.nextEffect;Ti.nextEffect=null,Ti=U}}catch(e){r=!0,S=e}r&&(null===Ti&&a("178"),Mi(Ti,S),null!==Ti&&(Ti=Ti.nextEffect))}bi=ki=!1,"function"==typeof jr&&jr(t.stateNode),C=t.expirationTime,t=t.childExpirationTime,0===(t=0===C||0!==t&&t<C?t:C)&&(Ci=null),e.expirationTime=t,e.finishedWork=null}function pa(){return!!Vi||!(null===zi||zi.timeRemaining()>ra)&&(Vi=!0)}function fa(e){null===Bi&&a("246"),Bi.expirationTime=0,Ki||(Ki=!0,Hi=e)}function ha(e,t){var n=Gi;Gi=!0;try{return e(t)}finally{(Gi=n)||Li||ua(1,null)}}function ma(e,t){if(Gi&&!$i){$i=!0;try{return e(t)}finally{$i=!1}}return e(t)}function ya(e,t,n){if(Yi)return e(t,n);Gi||Li||0===qi||(ua(qi,null),qi=0);var r=Yi,o=Gi;Gi=Yi=!0;try{return e(t,n)}finally{Yi=r,(Gi=o)||Li||ua(1,null)}}function va(e,t,n,r,o){var i=t.current;return n=function(e){if(!e)return Er;e=e._reactInternalFiber;e:{(2!==tn(e)||2!==e.tag&&3!==e.tag)&&a("170");var t=e;do{switch(t.tag){case 5:t=t.stateNode.context;break e;case 2:if(Or(t.type)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}break;case 3:if(Or(t.type._reactResult)){t=t.stateNode.__reactInternalMemoizedMergedChildContext;break e}}t=t.return}while(null!==t);a("171"),t=void 0}if(2===e.tag){var n=e.type;if(Or(n))return Mr(e,n,t)}else if(3===e.tag&&Or(n=e.type._reactResult))return Mr(e,n,t);return t}(n),null===t.context?t.context=n:t.pendingContext=n,t=o,(o=Yr(r)).payload={element:e},null!==(t=void 0===t?null:t)&&(o.callback=t),Jr(i,o),Di(i,r),r}function ga(e,t,n,r){var o=t.current;return va(e,t,n,o=Ai(aa(),o),r)}function ba(e){if(!(e=e.current).child)return null;switch(e.child.tag){case 7:default:return e.child.stateNode}}function _a(e){var t=2+25*(1+((aa()-2+500)/25|0));t<=vi&&(t=vi+1),this._expirationTime=vi=t,this._root=e,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function wa(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function Ea(e,t,n){e={current:t=new Ur(5,null,null,t?3:0),containerInfo:e,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,didError:!1,pendingCommitExpirationTime:0,finishedWork:null,timeoutHandle:-1,context:null,pendingContext:null,hydrate:n,nextExpirationTimeToWorkOn:0,expirationTime:0,firstBatch:null,nextScheduledRoot:null},this._internalRoot=t.stateNode=e}function Sa(e){return!(!e||1!==e.nodeType&&9!==e.nodeType&&11!==e.nodeType&&(8!==e.nodeType||" react-mount-point-unstable "!==e.nodeValue))}function Ta(e,t,n,r,o){Sa(n)||a("200");var i=n._reactRootContainer;if(i){if("function"==typeof o){var s=o;o=function(){var e=ba(i._internalRoot);s.call(e)}}null!=e?i.legacy_renderSubtreeIntoContainer(e,t,o):i.render(t,o)}else{if(i=n._reactRootContainer=function(e,t){if(t||(t=!(!(t=e?9===e.nodeType?e.documentElement:e.firstChild:null)||1!==t.nodeType||!t.hasAttribute("data-reactroot"))),!t)for(var n;n=e.lastChild;)e.removeChild(n);return new Ea(e,!1,t)}(n,r),"function"==typeof o){var l=o;o=function(){var e=ba(i._internalRoot);l.call(e)}}ma(function(){null!=e?i.legacy_renderSubtreeIntoContainer(e,t,o):i.render(t,o)})}return ba(i._internalRoot)}function ka(e,t){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return Sa(t)||a("200"),function(e,t,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:Qe,key:null==r?null:""+r,children:e,containerInfo:t,implementation:n}}(e,t,null,n)}Pe=function(e,t,n){switch(t){case"input":if(Et(e,n),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+t)+'][type="radio"]'),t=0;t<n.length;t++){var r=n[t];if(r!==e&&r.form===e.form){var o=B(r);o||a("90"),He(r),Et(r,o)}}}break;case"textarea":Qn(e,n);break;case"select":null!=(t=n.value)&&Gn(e,!!n.multiple,t,!1)}},_a.prototype.render=function(e){this._defer||a("250"),this._hasChildren=!0,this._children=e;var t=this._root._internalRoot,n=this._expirationTime,r=new wa;return va(e,t,null,n,r._onCommit),r},_a.prototype.then=function(e){if(this._didComplete)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},_a.prototype.commit=function(){var e=this._root._internalRoot,t=e.firstBatch;if(this._defer&&null!==t||a("251"),this._hasChildren){var n=this._expirationTime;if(t!==this){this._hasChildren&&(n=this._expirationTime=t._expirationTime,this.render(this._children));for(var r=null,o=t;o!==this;)r=o,o=o._next;null===r&&a("251"),r._next=o._next,this._next=t,e.firstBatch=this}this._defer=!1,t=n,Li&&a("253"),Bi=e,Wi=t,ca(e,t,!0),ua(1,null),t=this._next,this._next=null,null!==(t=e.firstBatch=t)&&t._hasChildren&&t.render(t._children)}else this._next=null,this._defer=!1},_a.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++)(0,e[t])()}},wa.prototype.then=function(e){if(this._didCommit)e();else{var t=this._callbacks;null===t&&(t=this._callbacks=[]),t.push(e)}},wa.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var e=this._callbacks;if(null!==e)for(var t=0;t<e.length;t++){var n=e[t];"function"!=typeof n&&a("191",n),n()}}},Ea.prototype.render=function(e,t){var n=this._internalRoot,r=new wa;return null!==(t=void 0===t?null:t)&&r.then(t),ga(e,n,null,r._onCommit),r},Ea.prototype.unmount=function(e){var t=this._internalRoot,n=new wa;return null!==(e=void 0===e?null:e)&&n.then(e),ga(null,t,null,n._onCommit),n},Ea.prototype.legacy_renderSubtreeIntoContainer=function(e,t,n){var r=this._internalRoot,o=new wa;return null!==(n=void 0===n?null:n)&&o.then(n),ga(t,r,e,o._onCommit),o},Ea.prototype.createBatch=function(){var e=new _a(this),t=e._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=e,e._next=null;else{for(n=null;null!==r&&r._expirationTime<=t;)n=r,r=r._next;e._next=r,null!==n&&(n._next=e)}return e},je=ha,Ie=ya,Re=function(){Li||0===qi||(ua(qi,null),qi=0)};var Ca={createPortal:ka,findDOMNode:function(e){if(null==e)return null;if(1===e.nodeType)return e;var t=e._reactInternalFiber;return void 0===t&&("function"==typeof e.render?a("188"):a("268",Object.keys(e))),e=null===(e=rn(t))?null:e.stateNode},hydrate:function(e,t,n){return Ta(null,e,t,!0,n)},render:function(e,t,n){return Ta(null,e,t,!1,n)},unstable_renderSubtreeIntoContainer:function(e,t,n,r){return(null==e||void 0===e._reactInternalFiber)&&a("38"),Ta(e,t,n,!1,r)},unmountComponentAtNode:function(e){return Sa(e)||a("40"),!!e._reactRootContainer&&(ma(function(){Ta(null,null,e,!1,function(){e._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return ka.apply(void 0,arguments)},unstable_batchedUpdates:ha,unstable_interactiveUpdates:ya,flushSync:function(e,t){Li&&a("187");var n=Gi;Gi=!0;try{return ji(e,t)}finally{Gi=n,ua(1,null)}},unstable_flushControlled:function(e){var t=Gi;Gi=!0;try{ji(e)}finally{(Gi=t)||Li||ua(1,null)}},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{Events:[F,L,B,M.injectEventPluginsByName,g,z,function(e){C(e,H)},Ae,De,Pn,D]},unstable_createRoot:function(e,t){return Sa(e)||a("278"),new Ea(e,!0,null!=t&&!0===t.hydrate)}};!function(e){var t=e.findFiberByHostInstance;(function(e){if("undefined"==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var t=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(t.isDisabled||!t.supportsFiber)return!0;try{var n=t.inject(e);jr=Rr(function(e){return t.onCommitFiberRoot(n,e)}),Ir=Rr(function(e){return t.onCommitFiberUnmount(n,e)})}catch(e){}})(o({},e,{findHostInstanceByFiber:function(e){return null===(e=rn(e))?null:e.stateNode},findFiberByHostInstance:function(e){return t?t(e):null}}))}({findFiberByHostInstance:U,bundleType:0,version:"16.5.2",rendererPackageName:"react-dom"});var Oa={default:Ca},Pa=Oa&&Ca||Oa;e.exports=Pa.default||Pa},function(e,t,n){"use strict";e.exports=n(23)},function(e,t,n){"use strict";
|
||
/** @license React v16.5.2
|
||
* schedule.production.min.js
|
||
*
|
||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||
*
|
||
* This source code is licensed under the MIT license found in the
|
||
* LICENSE file in the root directory of this source tree.
|
||
*/Object.defineProperty(t,"__esModule",{value:!0});var r=null,o=!1,i=!1,a="object"==typeof performance&&"function"==typeof performance.now,s={timeRemaining:a?function(){var e=m()-performance.now();return 0<e?e:0}:function(){var e=m()-Date.now();return 0<e?e:0},didTimeout:!1};function l(){if(!o){var e=r.timesOutAt;i?h():i=!0,f(c,e)}}function u(){var e=r,t=r.next;if(r===t)r=null;else{var n=r.previous;r=n.next=t,t.previous=n}e.next=e.previous=null,(e=e.callback)(s)}function c(e){o=!0,s.didTimeout=e;try{if(e)for(;null!==r;){var n=t.unstable_now();if(!(r.timesOutAt<=n))break;do{u()}while(null!==r&&r.timesOutAt<=n)}else if(null!==r)do{u()}while(null!==r&&0<m()-t.unstable_now())}finally{o=!1,null!==r?l():i=!1}}var d,p,f,h,m,y=Date,v="function"==typeof setTimeout?setTimeout:void 0,g="function"==typeof clearTimeout?clearTimeout:void 0,b="function"==typeof requestAnimationFrame?requestAnimationFrame:void 0,_="function"==typeof cancelAnimationFrame?cancelAnimationFrame:void 0;function w(e){d=b(function(t){g(p),e(t)}),p=v(function(){_(d),e(t.unstable_now())},100)}if(a){var E=performance;t.unstable_now=function(){return E.now()}}else t.unstable_now=function(){return y.now()};if("undefined"==typeof window){var S=-1;f=function(e){S=setTimeout(e,0,!0)},h=function(){clearTimeout(S)},m=function(){return 0}}else if(window._schedMock){var T=window._schedMock;f=T[0],h=T[1],m=T[2]}else{"undefined"!=typeof console&&("function"!=typeof b&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"),"function"!=typeof _&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://fb.me/react-polyfills"));var k=null,C=!1,O=-1,P=!1,N=!1,x=0,M=33,A=33;m=function(){return x};var D="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(e){if(e.source===window&&e.data===D){C=!1;var n=t.unstable_now();if(e=!1,0>=x-n){if(!(-1!==O&&O<=n))return void(P||(P=!0,w(j)));e=!0}if(O=-1,n=k,k=null,null!==n){N=!0;try{n(e)}finally{N=!1}}}},!1);var j=function(e){P=!1;var t=e-x+A;t<A&&M<A?(8>t&&(t=8),A=t<M?M:t):M=t,x=e+A,C||(C=!0,window.postMessage(D,"*"))};f=function(e,t){k=e,O=t,N?window.postMessage(D,"*"):P||(P=!0,w(j))},h=function(){k=null,C=!1,O=-1}}t.unstable_scheduleWork=function(e,n){var o=t.unstable_now();if(e={callback:e,timesOutAt:n=void 0!==n&&null!==n&&null!==n.timeout&&void 0!==n.timeout?o+n.timeout:o+5e3,next:null,previous:null},null===r)r=e.next=e.previous=e,l();else{o=null;var i=r;do{if(i.timesOutAt>n){o=i;break}i=i.next}while(i!==r);null===o?o=r:o===r&&(r=e,l()),(n=o.previous).next=o.previous=e,e.next=o,e.previous=n}return e},t.unstable_cancelScheduledWork=function(e){var t=e.next;if(null!==t){if(t===e)r=null;else{e===r&&(r=t);var n=e.previous;n.next=t,t.previous=n}e.next=e.previous=null}}},function(e,t,n){"use strict";var r=n(25),o=n(30);r.default.__addLocaleData(o.default),r.default.defaultLocale="en",t.default=r.default},function(e,t,n){"use strict";var r=n(15),o=n(26),i=n(27),a=n(28);function s(e,t,n){var r="string"==typeof e?s.__parse(e):e;if(!r||"messageFormatPattern"!==r.type)throw new TypeError("A message must be provided as a String or AST.");n=this._mergeFormats(s.formats,n),o.defineProperty(this,"_locale",{value:this._resolveLocale(t)});var i=this._findPluralRuleFunction(this._locale),a=this._compilePattern(r,t,n,i),l=this;this.format=function(t){try{return l._format(a,t)}catch(t){throw t.variableId?new Error("The intl string context variable '"+t.variableId+"' was not provided to the string '"+e+"'"):t}}}t.default=s,o.defineProperty(s,"formats",{enumerable:!0,value:{number:{currency:{style:"currency"},percent:{style:"percent"}},date:{short:{month:"numeric",day:"numeric",year:"2-digit"},medium:{month:"short",day:"numeric",year:"numeric"},long:{month:"long",day:"numeric",year:"numeric"},full:{weekday:"long",month:"long",day:"numeric",year:"numeric"}},time:{short:{hour:"numeric",minute:"numeric"},medium:{hour:"numeric",minute:"numeric",second:"numeric"},long:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"},full:{hour:"numeric",minute:"numeric",second:"numeric",timeZoneName:"short"}}}}),o.defineProperty(s,"__localeData__",{value:o.objCreate(null)}),o.defineProperty(s,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlMessageFormat is missing a `locale` property");s.__localeData__[e.locale.toLowerCase()]=e}}),o.defineProperty(s,"__parse",{value:a.default.parse}),o.defineProperty(s,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),s.prototype.resolvedOptions=function(){return{locale:this._locale}},s.prototype._compilePattern=function(e,t,n,r){return new i.default(t,n,r).compile(e)},s.prototype._findPluralRuleFunction=function(e){for(var t=s.__localeData__,n=t[e.toLowerCase()];n;){if(n.pluralRuleFunction)return n.pluralRuleFunction;n=n.parentLocale&&t[n.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlMessageFormat is missing a `pluralRuleFunction` for :"+e)},s.prototype._format=function(e,t){var n,o,i,a,s,l,u="";for(n=0,o=e.length;n<o;n+=1)if("string"!=typeof(i=e[n])){if(a=i.id,!t||!r.hop.call(t,a))throw(l=new Error("A value must be provided for: "+a)).variableId=a,l;s=t[a],i.options?u+=this._format(i.getOption(s),t):u+=i.format(s)}else u+=i;return u},s.prototype._mergeFormats=function(e,t){var n,i,a={};for(n in e)r.hop.call(e,n)&&(a[n]=i=o.objCreate(e[n]),t&&r.hop.call(t,n)&&r.extend(i,t[n]));return a},s.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(s.defaultLocale);var t,n,r,o,i=s.__localeData__;for(t=0,n=e.length;t<n;t+=1)for(r=e[t].toLowerCase().split("-");r.length;){if(o=i[r.join("-")])return o.locale;r.pop()}var a=e.pop();throw new Error("No locale data has been added to IntlMessageFormat for: "+e.join(", ")+", or the default locale: "+a)}},function(e,t,n){"use strict";var r=n(15),o=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),i=(!o&&Object.prototype.__defineGetter__,o?Object.defineProperty:function(e,t,n){"get"in n&&e.__defineGetter__?e.__defineGetter__(t,n.get):(!r.hop.call(e,t)||"value"in n)&&(e[t]=n.value)}),a=Object.create||function(e,t){var n,o;function a(){}for(o in a.prototype=e,n=new a,t)r.hop.call(t,o)&&i(n,o,t[o]);return n};t.defineProperty=i,t.objCreate=a},function(e,t,n){"use strict";function r(e,t,n){this.locales=e,this.formats=t,this.pluralFn=n}function o(e){this.id=e}function i(e,t,n,r,o){this.id=e,this.useOrdinal=t,this.offset=n,this.options=r,this.pluralFn=o}function a(e,t,n,r){this.id=e,this.offset=t,this.numberFormat=n,this.string=r}function s(e,t){this.id=e,this.options=t}t.default=r,r.prototype.compile=function(e){return this.pluralStack=[],this.currentPlural=null,this.pluralNumberFormat=null,this.compileMessage(e)},r.prototype.compileMessage=function(e){if(!e||"messageFormatPattern"!==e.type)throw new Error('Message AST is not of type: "messageFormatPattern"');var t,n,r,o=e.elements,i=[];for(t=0,n=o.length;t<n;t+=1)switch((r=o[t]).type){case"messageTextElement":i.push(this.compileMessageText(r));break;case"argumentElement":i.push(this.compileArgument(r));break;default:throw new Error("Message element does not have a valid type")}return i},r.prototype.compileMessageText=function(e){return this.currentPlural&&/(^|[^\\])#/g.test(e.value)?(this.pluralNumberFormat||(this.pluralNumberFormat=new Intl.NumberFormat(this.locales)),new a(this.currentPlural.id,this.currentPlural.format.offset,this.pluralNumberFormat,e.value)):e.value.replace(/\\#/g,"#")},r.prototype.compileArgument=function(e){var t=e.format;if(!t)return new o(e.id);var n,r=this.formats,a=this.locales,l=this.pluralFn;switch(t.type){case"numberFormat":return n=r.number[t.style],{id:e.id,format:new Intl.NumberFormat(a,n).format};case"dateFormat":return n=r.date[t.style],{id:e.id,format:new Intl.DateTimeFormat(a,n).format};case"timeFormat":return n=r.time[t.style],{id:e.id,format:new Intl.DateTimeFormat(a,n).format};case"pluralFormat":return n=this.compileOptions(e),new i(e.id,t.ordinal,t.offset,n,l);case"selectFormat":return n=this.compileOptions(e),new s(e.id,n);default:throw new Error("Message element does not have a valid format type")}},r.prototype.compileOptions=function(e){var t,n,r,o=e.format,i=o.options,a={};for(this.pluralStack.push(this.currentPlural),this.currentPlural="pluralFormat"===o.type?e:null,t=0,n=i.length;t<n;t+=1)a[(r=i[t]).selector]=this.compileMessage(r.value);return this.currentPlural=this.pluralStack.pop(),a},o.prototype.format=function(e){return e||"number"==typeof e?"string"==typeof e?e:String(e):""},i.prototype.getOption=function(e){var t=this.options;return t["="+e]||t[this.pluralFn(e-this.offset,this.useOrdinal)]||t.other},a.prototype.format=function(e){var t=this.numberFormat.format(e-this.offset);return this.string.replace(/(^|[^\\])#/g,"$1"+t).replace(/\\#/g,"#")},s.prototype.getOption=function(e){var t=this.options;return t[e]||t.other}},function(e,t,n){"use strict";(t=e.exports=n(29).default).default=t},function(e,t,n){"use strict";t.default=function(){function e(t,n,r,o){this.message=t,this.expected=n,this.found=r,this.location=o,this.name="SyntaxError","function"==typeof Error.captureStackTrace&&Error.captureStackTrace(this,e)}return function(e,t){function n(){this.constructor=e}n.prototype=t.prototype,e.prototype=new n}(e,Error),{SyntaxError:e,parse:function(t){var n,r=arguments.length>1?arguments[1]:{},o={},i={start:xe},a=xe,s=function(e){return{type:"messageFormatPattern",elements:e,location:ke()}},l=function(e){var t,n,r,o,i,a="";for(t=0,r=e.length;t<r;t+=1)for(n=0,i=(o=e[t]).length;n<i;n+=1)a+=o[n];return a},u=function(e){return{type:"messageTextElement",value:e,location:ke()}},c=/^[^ \t\n\r,.+={}#]/,d={type:"class",value:"[^ \\t\\n\\r,.+={}#]",description:"[^ \\t\\n\\r,.+={}#]"},p="{",f={type:"literal",value:"{",description:'"{"'},h=",",m={type:"literal",value:",",description:'","'},y="}",v={type:"literal",value:"}",description:'"}"'},g=function(e,t){return{type:"argumentElement",id:e,format:t&&t[2],location:ke()}},b="number",_={type:"literal",value:"number",description:'"number"'},w="date",E={type:"literal",value:"date",description:'"date"'},S="time",T={type:"literal",value:"time",description:'"time"'},k=function(e,t){return{type:e+"Format",style:t&&t[2],location:ke()}},C="plural",O={type:"literal",value:"plural",description:'"plural"'},P=function(e){return{type:e.type,ordinal:!1,offset:e.offset||0,options:e.options,location:ke()}},N="selectordinal",x={type:"literal",value:"selectordinal",description:'"selectordinal"'},M=function(e){return{type:e.type,ordinal:!0,offset:e.offset||0,options:e.options,location:ke()}},A="select",D={type:"literal",value:"select",description:'"select"'},j=function(e){return{type:"selectFormat",options:e,location:ke()}},I="=",R={type:"literal",value:"=",description:'"="'},U=function(e,t){return{type:"optionalFormatPattern",selector:e,value:t,location:ke()}},F="offset:",L={type:"literal",value:"offset:",description:'"offset:"'},B=function(e){return e},W=function(e,t){return{type:"pluralFormat",offset:e,options:t,location:ke()}},q={type:"other",description:"whitespace"},V=/^[ \t\n\r]/,K={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},H={type:"other",description:"optionalWhitespace"},z=/^[0-9]/,G={type:"class",value:"[0-9]",description:"[0-9]"},$=/^[0-9a-f]/i,Y={type:"class",value:"[0-9a-f]i",description:"[0-9a-f]i"},Q="0",J={type:"literal",value:"0",description:'"0"'},X=/^[1-9]/,Z={type:"class",value:"[1-9]",description:"[1-9]"},ee=function(e){return parseInt(e,10)},te=/^[^{}\\\0-\x1F \t\n\r]/,ne={type:"class",value:"[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]",description:"[^{}\\\\\\0-\\x1F\\x7f \\t\\n\\r]"},re="\\\\",oe={type:"literal",value:"\\\\",description:'"\\\\\\\\"'},ie=function(){return"\\"},ae="\\#",se={type:"literal",value:"\\#",description:'"\\\\#"'},le=function(){return"\\#"},ue="\\{",ce={type:"literal",value:"\\{",description:'"\\\\{"'},de=function(){return"{"},pe="\\}",fe={type:"literal",value:"\\}",description:'"\\\\}"'},he=function(){return"}"},me="\\u",ye={type:"literal",value:"\\u",description:'"\\\\u"'},ve=function(e){return String.fromCharCode(parseInt(e,16))},ge=function(e){return e.join("")},be=0,_e=0,we=[{line:1,column:1,seenCR:!1}],Ee=0,Se=[],Te=0;if("startRule"in r){if(!(r.startRule in i))throw new Error("Can't start parsing from rule \""+r.startRule+'".');a=i[r.startRule]}function ke(){return Oe(_e,be)}function Ce(e){var n,r,o=we[e];if(o)return o;for(n=e-1;!we[n];)n--;for(o={line:(o=we[n]).line,column:o.column,seenCR:o.seenCR};n<e;)"\n"===(r=t.charAt(n))?(o.seenCR||o.line++,o.column=1,o.seenCR=!1):"\r"===r||"\u2028"===r||"\u2029"===r?(o.line++,o.column=1,o.seenCR=!0):(o.column++,o.seenCR=!1),n++;return we[e]=o,o}function Oe(e,t){var n=Ce(e),r=Ce(t);return{start:{offset:e,line:n.line,column:n.column},end:{offset:t,line:r.line,column:r.column}}}function Pe(e){be<Ee||(be>Ee&&(Ee=be,Se=[]),Se.push(e))}function Ne(t,n,r,o){return null!==n&&function(e){var t=1;for(e.sort(function(e,t){return e.description<t.description?-1:e.description>t.description?1:0});t<e.length;)e[t-1]===e[t]?e.splice(t,1):t++}(n),new e(null!==t?t:function(e,t){var n,r=new Array(e.length);for(n=0;n<e.length;n++)r[n]=e[n].description;return"Expected "+(e.length>1?r.slice(0,-1).join(", ")+" or "+r[e.length-1]:r[0])+" but "+(t?'"'+function(e){function t(e){return e.charCodeAt(0).toString(16).toUpperCase()}return e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(e){return"\\x0"+t(e)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(e){return"\\x"+t(e)}).replace(/[\u0100-\u0FFF]/g,function(e){return"\\u0"+t(e)}).replace(/[\u1000-\uFFFF]/g,function(e){return"\\u"+t(e)})}(t)+'"':"end of input")+" found."}(n,r),n,r,o)}function xe(){return Me()}function Me(){var e,t,n;for(e=be,t=[],n=Ae();n!==o;)t.push(n),n=Ae();return t!==o&&(_e=e,t=s(t)),e=t}function Ae(){var e;return(e=function(){var e,n;return e=be,(n=function(){var e,n,r,i,a,s;if(e=be,n=[],r=be,(i=Re())!==o&&(a=We())!==o&&(s=Re())!==o?r=i=[i,a,s]:(be=r,r=o),r!==o)for(;r!==o;)n.push(r),r=be,(i=Re())!==o&&(a=We())!==o&&(s=Re())!==o?r=i=[i,a,s]:(be=r,r=o);else n=o;return n!==o&&(_e=e,n=l(n)),(e=n)===o&&(e=be,n=Ie(),e=n!==o?t.substring(e,be):n),e}())!==o&&(_e=e,n=u(n)),e=n}())===o&&(e=function(){var e,n,r,i,a,s,l;return e=be,123===t.charCodeAt(be)?(n=p,be++):(n=o,0===Te&&Pe(f)),n!==o&&Re()!==o&&(r=function(){var e,n,r;if((e=Le())===o){if(e=be,n=[],c.test(t.charAt(be))?(r=t.charAt(be),be++):(r=o,0===Te&&Pe(d)),r!==o)for(;r!==o;)n.push(r),c.test(t.charAt(be))?(r=t.charAt(be),be++):(r=o,0===Te&&Pe(d));else n=o;e=n!==o?t.substring(e,be):n}return e}())!==o&&Re()!==o?(i=be,44===t.charCodeAt(be)?(a=h,be++):(a=o,0===Te&&Pe(m)),a!==o&&(s=Re())!==o&&(l=function(){var e;return(e=function(){var e,n,r,i,a,s;return e=be,t.substr(be,6)===b?(n=b,be+=6):(n=o,0===Te&&Pe(_)),n===o&&(t.substr(be,4)===w?(n=w,be+=4):(n=o,0===Te&&Pe(E)),n===o&&(t.substr(be,4)===S?(n=S,be+=4):(n=o,0===Te&&Pe(T)))),n!==o&&Re()!==o?(r=be,44===t.charCodeAt(be)?(i=h,be++):(i=o,0===Te&&Pe(m)),i!==o&&(a=Re())!==o&&(s=We())!==o?r=i=[i,a,s]:(be=r,r=o),r===o&&(r=null),r!==o?(_e=e,n=k(n,r),e=n):(be=e,e=o)):(be=e,e=o),e}())===o&&(e=function(){var e,n,r,i;return e=be,t.substr(be,6)===C?(n=C,be+=6):(n=o,0===Te&&Pe(O)),n!==o&&Re()!==o?(44===t.charCodeAt(be)?(r=h,be++):(r=o,0===Te&&Pe(m)),r!==o&&Re()!==o&&(i=je())!==o?(_e=e,n=P(i),e=n):(be=e,e=o)):(be=e,e=o),e}())===o&&(e=function(){var e,n,r,i;return e=be,t.substr(be,13)===N?(n=N,be+=13):(n=o,0===Te&&Pe(x)),n!==o&&Re()!==o?(44===t.charCodeAt(be)?(r=h,be++):(r=o,0===Te&&Pe(m)),r!==o&&Re()!==o&&(i=je())!==o?(_e=e,n=M(i),e=n):(be=e,e=o)):(be=e,e=o),e}())===o&&(e=function(){var e,n,r,i,a;if(e=be,t.substr(be,6)===A?(n=A,be+=6):(n=o,0===Te&&Pe(D)),n!==o)if(Re()!==o)if(44===t.charCodeAt(be)?(r=h,be++):(r=o,0===Te&&Pe(m)),r!==o)if(Re()!==o){if(i=[],(a=De())!==o)for(;a!==o;)i.push(a),a=De();else i=o;i!==o?(_e=e,n=j(i),e=n):(be=e,e=o)}else be=e,e=o;else be=e,e=o;else be=e,e=o;else be=e,e=o;return e}()),e}())!==o?i=a=[a,s,l]:(be=i,i=o),i===o&&(i=null),i!==o&&(a=Re())!==o?(125===t.charCodeAt(be)?(s=y,be++):(s=o,0===Te&&Pe(v)),s!==o?(_e=e,n=g(r,i),e=n):(be=e,e=o)):(be=e,e=o)):(be=e,e=o),e}()),e}function De(){var e,n,r,i,a;return e=be,Re()!==o&&(n=function(){var e,n,r,i;return e=be,n=be,61===t.charCodeAt(be)?(r=I,be++):(r=o,0===Te&&Pe(R)),r!==o&&(i=Le())!==o?n=r=[r,i]:(be=n,n=o),(e=n!==o?t.substring(e,be):n)===o&&(e=We()),e}())!==o&&Re()!==o?(123===t.charCodeAt(be)?(r=p,be++):(r=o,0===Te&&Pe(f)),r!==o&&Re()!==o&&(i=Me())!==o&&Re()!==o?(125===t.charCodeAt(be)?(a=y,be++):(a=o,0===Te&&Pe(v)),a!==o?(_e=e,e=U(n,i)):(be=e,e=o)):(be=e,e=o)):(be=e,e=o),e}function je(){var e,n,r,i;if(e=be,(n=function(){var e,n,r;return e=be,t.substr(be,7)===F?(n=F,be+=7):(n=o,0===Te&&Pe(L)),n!==o&&Re()!==o&&(r=Le())!==o?(_e=e,e=n=B(r)):(be=e,e=o),e}())===o&&(n=null),n!==o)if(Re()!==o){if(r=[],(i=De())!==o)for(;i!==o;)r.push(i),i=De();else r=o;r!==o?(_e=e,e=n=W(n,r)):(be=e,e=o)}else be=e,e=o;else be=e,e=o;return e}function Ie(){var e,n;if(Te++,e=[],V.test(t.charAt(be))?(n=t.charAt(be),be++):(n=o,0===Te&&Pe(K)),n!==o)for(;n!==o;)e.push(n),V.test(t.charAt(be))?(n=t.charAt(be),be++):(n=o,0===Te&&Pe(K));else e=o;return Te--,e===o&&(n=o,0===Te&&Pe(q)),e}function Re(){var e,n,r;for(Te++,e=be,n=[],r=Ie();r!==o;)n.push(r),r=Ie();return e=n!==o?t.substring(e,be):n,Te--,e===o&&(n=o,0===Te&&Pe(H)),e}function Ue(){var e;return z.test(t.charAt(be))?(e=t.charAt(be),be++):(e=o,0===Te&&Pe(G)),e}function Fe(){var e;return $.test(t.charAt(be))?(e=t.charAt(be),be++):(e=o,0===Te&&Pe(Y)),e}function Le(){var e,n,r,i,a,s;if(e=be,48===t.charCodeAt(be)?(n=Q,be++):(n=o,0===Te&&Pe(J)),n===o){if(n=be,r=be,X.test(t.charAt(be))?(i=t.charAt(be),be++):(i=o,0===Te&&Pe(Z)),i!==o){for(a=[],s=Ue();s!==o;)a.push(s),s=Ue();a!==o?r=i=[i,a]:(be=r,r=o)}else be=r,r=o;n=r!==o?t.substring(n,be):r}return n!==o&&(_e=e,n=ee(n)),e=n}function Be(){var e,n,r,i,a,s,l,u;return te.test(t.charAt(be))?(e=t.charAt(be),be++):(e=o,0===Te&&Pe(ne)),e===o&&(e=be,t.substr(be,2)===re?(n=re,be+=2):(n=o,0===Te&&Pe(oe)),n!==o&&(_e=e,n=ie()),(e=n)===o&&(e=be,t.substr(be,2)===ae?(n=ae,be+=2):(n=o,0===Te&&Pe(se)),n!==o&&(_e=e,n=le()),(e=n)===o&&(e=be,t.substr(be,2)===ue?(n=ue,be+=2):(n=o,0===Te&&Pe(ce)),n!==o&&(_e=e,n=de()),(e=n)===o&&(e=be,t.substr(be,2)===pe?(n=pe,be+=2):(n=o,0===Te&&Pe(fe)),n!==o&&(_e=e,n=he()),(e=n)===o&&(e=be,t.substr(be,2)===me?(n=me,be+=2):(n=o,0===Te&&Pe(ye)),n!==o?(r=be,i=be,(a=Fe())!==o&&(s=Fe())!==o&&(l=Fe())!==o&&(u=Fe())!==o?i=a=[a,s,l,u]:(be=i,i=o),(r=i!==o?t.substring(r,be):i)!==o?(_e=e,e=n=ve(r)):(be=e,e=o)):(be=e,e=o)))))),e}function We(){var e,t,n;if(e=be,t=[],(n=Be())!==o)for(;n!==o;)t.push(n),n=Be();else t=o;return t!==o&&(_e=e,t=ge(t)),e=t}if((n=a())!==o&&be===t.length)return n;throw n!==o&&be<t.length&&Pe({type:"end",description:"end of input"}),Ne(null,Se,Ee<t.length?t.charAt(Ee):null,Ee<t.length?Oe(Ee,Ee+1):Oe(Ee,Ee))}}}()},function(e,t,n){"use strict";t.default={locale:"en",pluralRuleFunction:function(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),a=o&&n[0].slice(-2);return t?1==i&&11!=a?"one":2==i&&12!=a?"two":3==i&&13!=a?"few":"other":1==e&&r?"one":"other"}}},function(e,t){},function(e,t,n){"use strict";var r=n(33),o=n(36);r.default.__addLocaleData(o.default),r.default.defaultLocale="en",t.default=r.default},function(e,t,n){"use strict";var r=n(5),o=n(34),i=n(35);t.default=l;var a=["second","second-short","minute","minute-short","hour","hour-short","day","day-short","month","month-short","year","year-short"],s=["best fit","numeric"];function l(e,t){t=t||{},i.isArray(e)&&(e=e.concat()),i.defineProperty(this,"_locale",{value:this._resolveLocale(e)}),i.defineProperty(this,"_options",{value:{style:this._resolveStyle(t.style),units:this._isValidUnits(t.units)&&t.units}}),i.defineProperty(this,"_locales",{value:e}),i.defineProperty(this,"_fields",{value:this._findFields(this._locale)}),i.defineProperty(this,"_messages",{value:i.objCreate(null)});var n=this;this.format=function(e,t){return n._format(e,t)}}i.defineProperty(l,"__localeData__",{value:i.objCreate(null)}),i.defineProperty(l,"__addLocaleData",{value:function(e){if(!e||!e.locale)throw new Error("Locale data provided to IntlRelativeFormat is missing a `locale` property value");l.__localeData__[e.locale.toLowerCase()]=e,r.default.__addLocaleData(e)}}),i.defineProperty(l,"defaultLocale",{enumerable:!0,writable:!0,value:void 0}),i.defineProperty(l,"thresholds",{enumerable:!0,value:{second:45,"second-short":45,minute:45,"minute-short":45,hour:22,"hour-short":22,day:26,"day-short":26,month:11,"month-short":11}}),l.prototype.resolvedOptions=function(){return{locale:this._locale,style:this._options.style,units:this._options.units}},l.prototype._compileMessage=function(e){var t,n=this._locales,o=(this._locale,this._fields[e].relativeTime),i="",a="";for(t in o.future)o.future.hasOwnProperty(t)&&(i+=" "+t+" {"+o.future[t].replace("{0}","#")+"}");for(t in o.past)o.past.hasOwnProperty(t)&&(a+=" "+t+" {"+o.past[t].replace("{0}","#")+"}");var s="{when, select, future {{0, plural, "+i+"}}past {{0, plural, "+a+"}}}";return new r.default(s,n)},l.prototype._getMessage=function(e){var t=this._messages;return t[e]||(t[e]=this._compileMessage(e)),t[e]},l.prototype._getRelativeUnits=function(e,t){var n=this._fields[t];if(n.relative)return n.relative[e]},l.prototype._findFields=function(e){for(var t=l.__localeData__,n=t[e.toLowerCase()];n;){if(n.fields)return n.fields;n=n.parentLocale&&t[n.parentLocale.toLowerCase()]}throw new Error("Locale data added to IntlRelativeFormat is missing `fields` for :"+e)},l.prototype._format=function(e,t){var n=t&&void 0!==t.now?t.now:i.dateNow();if(void 0===e&&(e=n),!isFinite(n))throw new RangeError("The `now` option provided to IntlRelativeFormat#format() is not in valid range.");if(!isFinite(e))throw new RangeError("The date value provided to IntlRelativeFormat#format() is not in valid range.");var r=o.default(n,e),a=this._options.units||this._selectUnits(r),s=r[a];if("numeric"!==this._options.style){var l=this._getRelativeUnits(s,a);if(l)return l}return this._getMessage(a).format({0:Math.abs(s),when:s<0?"past":"future"})},l.prototype._isValidUnits=function(e){if(!e||i.arrIndexOf.call(a,e)>=0)return!0;if("string"==typeof e){var t=/s$/.test(e)&&e.substr(0,e.length-1);if(t&&i.arrIndexOf.call(a,t)>=0)throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, did you mean: '+t)}throw new Error('"'+e+'" is not a valid IntlRelativeFormat `units` value, it must be one of: "'+a.join('", "')+'"')},l.prototype._resolveLocale=function(e){"string"==typeof e&&(e=[e]),e=(e||[]).concat(l.defaultLocale);var t,n,r,o,i=l.__localeData__;for(t=0,n=e.length;t<n;t+=1)for(r=e[t].toLowerCase().split("-");r.length;){if(o=i[r.join("-")])return o.locale;r.pop()}var a=e.pop();throw new Error("No locale data has been added to IntlRelativeFormat for: "+e.join(", ")+", or the default locale: "+a)},l.prototype._resolveStyle=function(e){if(!e)return s[0];if(i.arrIndexOf.call(s,e)>=0)return e;throw new Error('"'+e+'" is not a valid IntlRelativeFormat `style` value, it must be one of: "'+s.join('", "')+'"')},l.prototype._selectUnits=function(e){var t,n,r,o=a.filter(function(e){return e.indexOf("-short")<1});for(t=0,n=o.length;t<n&&(r=o[t],!(Math.abs(e[r])<l.thresholds[r]));t+=1);return r}},function(e,t,n){"use strict";var r=Math.round;t.default=function(e,t){var n=r((t=+t)-(e=+e)),o=r(n/1e3),i=r(o/60),a=r(i/60),s=r(a/24),l=r(s/7),u=function(e){return 400*e/146097}(s),c=r(12*u),d=r(u);return{millisecond:n,second:o,"second-short":o,minute:i,"minute-short":i,hour:a,"hour-short":a,day:s,"day-short":s,week:l,"week-short":l,month:c,"month-short":c,year:d,"year-short":d}}},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o=Object.prototype.toString,i=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),a=(!i&&Object.prototype.__defineGetter__,i?Object.defineProperty:function(e,t,n){"get"in n&&e.__defineGetter__?e.__defineGetter__(t,n.get):(!r.call(e,t)||"value"in n)&&(e[t]=n.value)}),s=Object.create||function(e,t){var n,o;function i(){}for(o in i.prototype=e,n=new i,t)r.call(t,o)&&a(n,o,t[o]);return n},l=Array.prototype.indexOf||function(e,t){if(!this.length)return-1;for(var n=t||0,r=this.length;n<r;n++)if(this[n]===e)return n;return-1},u=Array.isArray||function(e){return"[object Array]"===o.call(e)},c=Date.now||function(){return(new Date).getTime()};t.defineProperty=a,t.objCreate=s,t.arrIndexOf=l,t.isArray=u,t.dateNow=c},function(e,t,n){"use strict";t.default={locale:"en",pluralRuleFunction:function(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),a=o&&n[0].slice(-2);return t?1==i&&11!=a?"one":2==i&&12!=a?"two":3==i&&13!=a?"few":"other":1==e&&r?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},"year-short":{displayName:"yr.",relative:{0:"this yr.",1:"next yr.","-1":"last yr."},relativeTime:{future:{one:"in {0} yr.",other:"in {0} yr."},past:{one:"{0} yr. ago",other:"{0} yr. ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},"month-short":{displayName:"mo.",relative:{0:"this mo.",1:"next mo.","-1":"last mo."},relativeTime:{future:{one:"in {0} mo.",other:"in {0} mo."},past:{one:"{0} mo. ago",other:"{0} mo. ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},"day-short":{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relative:{0:"this hour"},relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},"hour-short":{displayName:"hr.",relative:{0:"this hour"},relativeTime:{future:{one:"in {0} hr.",other:"in {0} hr."},past:{one:"{0} hr. ago",other:"{0} hr. ago"}}},minute:{displayName:"minute",relative:{0:"this minute"},relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},"minute-short":{displayName:"min.",relative:{0:"this minute"},relativeTime:{future:{one:"in {0} min.",other:"in {0} min."},past:{one:"{0} min. ago",other:"{0} min. ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}},"second-short":{displayName:"sec.",relative:{0:"now"},relativeTime:{future:{one:"in {0} sec.",other:"in {0} sec."},past:{one:"{0} sec. ago",other:"{0} sec. ago"}}}}}},function(e,t){},function(e,t,n){"use strict";var r=n(39);function o(){}e.exports=function(){function e(e,t,n,o,i,a){if(a!==r){var s=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name="Invariant Violation",s}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return n.checkPropTypes=o,n.PropTypes=n,n}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";var r=n(41);function o(e){var t,n,r,o,i=[],a=[];for(t in e)e.hasOwnProperty(t)&&a.push(t);var s=a.sort();for(n=0,r=s.length;n<r;n+=1)(o={})[t=s[n]]=e[t],i[n]=o;return i}t.default=function(e){var t=r.objCreate(null);return function(){var n=Array.prototype.slice.call(arguments),i=function(e){if("undefined"==typeof JSON)return;var t,n,r,i=[];for(t=0,n=e.length;t<n;t+=1)(r=e[t])&&"object"==typeof r?i.push(o(r)):i.push(r);return JSON.stringify(i)}(n),a=i&&t[i];return a||(a=new(r.bind.apply(e,[null].concat(n))),i&&(t[i]=a)),a}}},function(e,t,n){"use strict";var r=Function.prototype.bind||function(e){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var t=Array.prototype.slice.call(arguments,1),n=this,r=function(){},o=function(){return n.apply(this instanceof r?this:e,t.concat(Array.prototype.slice.call(arguments)))};return this.prototype&&(r.prototype=this.prototype),o.prototype=new r,o},o=Object.prototype.hasOwnProperty,i=function(){try{return!!Object.defineProperty({},"a",{})}catch(e){return!1}}(),a=(!i&&Object.prototype.__defineGetter__,i?Object.defineProperty:function(e,t,n){"get"in n&&e.__defineGetter__?e.__defineGetter__(t,n.get):(!o.call(e,t)||"value"in n)&&(e[t]=n.value)}),s=Object.create||function(e,t){var n,r;function i(){}for(r in i.prototype=e,n=new i,t)o.call(t,r)&&a(n,r,t[r]);return n};t.bind=r,t.defineProperty=a,t.objCreate=s},function(e,t,n){"use strict";n.r(t),function(e,t){n(46);var r=setTimeout;function o(){}function i(e){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof e)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],c(e,this)}function a(e,t){for(;3===e._state;)e=e._value;0!==e._state?(e._handled=!0,i._immediateFn(function(){var n=1===e._state?t.onFulfilled:t.onRejected;if(null!==n){var r;try{r=n(e._value)}catch(e){return void l(t.promise,e)}s(t.promise,r)}else(1===e._state?s:l)(t.promise,e._value)})):e._deferreds.push(t)}function s(e,t){try{if(t===e)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){var n=t.then;if(t instanceof i)return e._state=3,e._value=t,void u(e);if("function"==typeof n)return void c(function(e,t){return function(){e.apply(t,arguments)}}(n,t),e)}e._state=1,e._value=t,u(e)}catch(t){l(e,t)}}function l(e,t){e._state=2,e._value=t,u(e)}function u(e){2===e._state&&0===e._deferreds.length&&i._immediateFn(function(){e._handled||i._unhandledRejectionFn(e._value)});for(var t=0,n=e._deferreds.length;t<n;t++)a(e,e._deferreds[t]);e._deferreds=null}function c(e,t){var n=!1;try{e(function(e){n||(n=!0,s(t,e))},function(e){n||(n=!0,l(t,e))})}catch(e){if(n)return;n=!0,l(t,e)}}i.prototype.catch=function(e){return this.then(null,e)},i.prototype.then=function(e,t){var n=new this.constructor(o);return a(this,new function(e,t,n){this.onFulfilled="function"==typeof e?e:null,this.onRejected="function"==typeof t?t:null,this.promise=n}(e,t,n)),n},i.prototype.finally=function(e){var t=this.constructor;return this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){return t.reject(n)})})},i.all=function(e){return new i(function(t,n){if(!e||void 0===e.length)throw new TypeError("Promise.all accepts an array");var r=Array.prototype.slice.call(e);if(0===r.length)return t([]);var o=r.length;function i(e,a){try{if(a&&("object"==typeof a||"function"==typeof a)){var s=a.then;if("function"==typeof s)return void s.call(a,function(t){i(e,t)},n)}r[e]=a,0==--o&&t(r)}catch(e){n(e)}}for(var a=0;a<r.length;a++)i(a,r[a])})},i.resolve=function(e){return e&&"object"==typeof e&&e.constructor===i?e:new i(function(t){t(e)})},i.reject=function(e){return new i(function(t,n){n(e)})},i.race=function(e){return new i(function(t,n){for(var r=0,o=e.length;r<o;r++)e[r].then(t,n)})},i._immediateFn="function"==typeof e&&function(t){e(t)}||function(e){r(e,0)},i._unhandledRejectionFn=function(e){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",e)};var d=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")}();function p(e,t){return e(t={exports:{}},t.exports),t.exports}d.Promise||(d.Promise=i);var f=p(function(e){var t=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),h=p(function(e){var t=e.exports={version:"2.5.5"};"number"==typeof __e&&(__e=t)}),m=(h.version,function(e){return"object"==typeof e?null!==e:"function"==typeof e}),y=function(e){if(!m(e))throw TypeError(e+" is not an object!");return e},v=function(e){try{return!!e()}catch(e){return!0}},g=!v(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),b=f.document,_=m(b)&&m(b.createElement),w=function(e){return _?b.createElement(e):{}},E=!g&&!v(function(){return 7!=Object.defineProperty(w("div"),"a",{get:function(){return 7}}).a}),S=function(e,t){if(!m(e))return e;var n,r;if(t&&"function"==typeof(n=e.toString)&&!m(r=n.call(e)))return r;if("function"==typeof(n=e.valueOf)&&!m(r=n.call(e)))return r;if(!t&&"function"==typeof(n=e.toString)&&!m(r=n.call(e)))return r;throw TypeError("Can't convert object to primitive value")},T=Object.defineProperty,k={f:g?Object.defineProperty:function(e,t,n){if(y(e),t=S(t,!0),y(n),E)try{return T(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},C=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},O=g?function(e,t,n){return k.f(e,t,C(1,n))}:function(e,t,n){return e[t]=n,e},P={}.hasOwnProperty,N=function(e,t){return P.call(e,t)},x=0,M=Math.random(),A=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++x+M).toString(36))},D=p(function(e){var t=A("src"),n=Function.toString,r=(""+n).split("toString");h.inspectSource=function(e){return n.call(e)},(e.exports=function(e,n,o,i){var a="function"==typeof o;a&&(N(o,"name")||O(o,"name",n)),e[n]!==o&&(a&&(N(o,t)||O(o,t,e[n]?""+e[n]:r.join(String(n)))),e===f?e[n]=o:i?e[n]?e[n]=o:O(e,n,o):(delete e[n],O(e,n,o)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[t]||n.call(this)})}),j=function(e,t,n){if(function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!")}(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}},I=function(e,t,n){var r,o,i,a,s=e&I.F,l=e&I.G,u=e&I.S,c=e&I.P,d=e&I.B,p=l?f:u?f[t]||(f[t]={}):(f[t]||{}).prototype,m=l?h:h[t]||(h[t]={}),y=m.prototype||(m.prototype={});for(r in l&&(n=t),n)i=((o=!s&&p&&void 0!==p[r])?p:n)[r],a=d&&o?j(i,f):c&&"function"==typeof i?j(Function.call,i):i,p&&D(p,r,i,e&I.U),m[r]!=i&&O(m,r,a),c&&y[r]!=i&&(y[r]=i)};f.core=h,I.F=1,I.G=2,I.S=4,I.P=8,I.B=16,I.W=32,I.U=64,I.R=128;var R=I,U={}.toString,F=function(e){return U.call(e).slice(8,-1)},L=Object("z").propertyIsEnumerable(0)?Object:function(e){return"String"==F(e)?e.split(""):Object(e)},B=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e},W=function(e){return Object(B(e))},q=Math.ceil,V=Math.floor,K=function(e){return isNaN(e=+e)?0:(e>0?V:q)(e)},H=Math.min,z=function(e){return e>0?H(K(e),9007199254740991):0},G=Array.isArray||function(e){return"Array"==F(e)},$=f["__core-js_shared__"]||(f["__core-js_shared__"]={}),Y=function(e){return $[e]||($[e]={})},Q=p(function(e){var t=Y("wks"),n=f.Symbol,r="function"==typeof n;(e.exports=function(e){return t[e]||(t[e]=r&&n[e]||(r?n:A)("Symbol."+e))}).store=t}),J=Q("species"),X=function(e,t){return new(function(e){var t;return G(e)&&("function"!=typeof(t=e.constructor)||t!==Array&&!G(t.prototype)||(t=void 0),m(t)&&null===(t=t[J])&&(t=void 0)),void 0===t?Array:t}(e))(t)},Z=function(e,t){var n=1==e,r=2==e,o=3==e,i=4==e,a=6==e,s=5==e||a,l=t||X;return function(t,u,c){for(var d,p,f=W(t),h=L(f),m=j(u,c,3),y=z(h.length),v=0,g=n?l(t,y):r?l(t,0):void 0;y>v;v++)if((s||v in h)&&(p=m(d=h[v],v,f),e))if(n)g[v]=p;else if(p)switch(e){case 3:return!0;case 5:return d;case 6:return v;case 2:g.push(d)}else if(i)return!1;return a?-1:o||i?i:g}},ee=Q("unscopables"),te=Array.prototype;void 0==te[ee]&&O(te,ee,{});var ne=function(e){te[ee][e]=!0},re=Z(5),oe=!0;"find"in[]&&Array(1).find(function(){oe=!1}),R(R.P+R.F*oe,"Array",{find:function(e){return re(this,e,arguments.length>1?arguments[1]:void 0)}}),ne("find");h.Array.find;var ie=Z(6),ae=!0;"findIndex"in[]&&Array(1).findIndex(function(){ae=!1}),R(R.P+R.F*ae,"Array",{findIndex:function(e){return ie(this,e,arguments.length>1?arguments[1]:void 0)}}),ne("findIndex");h.Array.findIndex;var se=function(e){return L(B(e))},le=Math.max,ue=Math.min,ce=Y("keys"),de=function(e){return ce[e]||(ce[e]=A(e))},pe=function(e){return function(t,n,r){var o,i=se(t),a=z(i.length),s=function(e,t){return(e=K(e))<0?le(e+t,0):ue(e,t)}(r,a);if(e&&n!=n){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((e||s in i)&&i[s]===n)return e||s||0;return!e&&-1}}(!1),fe=de("IE_PROTO"),he=function(e,t){var n,r=se(e),o=0,i=[];for(n in r)n!=fe&&N(r,n)&&i.push(n);for(;t.length>o;)N(r,n=t[o++])&&(~pe(i,n)||i.push(n));return i},me="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),ye=Object.keys||function(e){return he(e,me)},ve={f:Object.getOwnPropertySymbols},ge={f:{}.propertyIsEnumerable},be=Object.assign,_e=!be||v(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=be({},e)[n]||Object.keys(be({},t)).join("")!=r})?function(e,t){for(var n=W(e),r=arguments.length,o=1,i=ve.f,a=ge.f;r>o;)for(var s,l=L(arguments[o++]),u=i?ye(l).concat(i(l)):ye(l),c=u.length,d=0;c>d;)a.call(l,s=u[d++])&&(n[s]=l[s]);return n}:be;R(R.S+R.F,"Object",{assign:_e});h.Object.assign;var we=Q("match"),Ee=function(e,t,n){if(function(e){var t;return m(e)&&(void 0!==(t=e[we])?!!t:"RegExp"==F(e))}(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(B(e))},Se=Q("match"),Te="".startsWith;R(R.P+R.F*function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[Se]=!1,!"/./"[e](t)}catch(e){}}return!0}("startsWith"),"String",{startsWith:function(e){var t=Ee(this,e,"startsWith"),n=z(Math.min(arguments.length>1?arguments[1]:void 0,t.length)),r=String(e);return Te?Te.call(t,r,n):t.slice(n,n+r.length)===r}});h.String.startsWith;R(R.P,"String",{repeat:function(e){var t=String(B(this)),n="",r=K(e);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(n+=t);return n}});h.String.repeat;var ke=p(function(e){var t=A("meta"),n=k.f,r=0,o=Object.isExtensible||function(){return!0},i=!v(function(){return o(Object.preventExtensions({}))}),a=function(e){n(e,t,{value:{i:"O"+ ++r,w:{}}})},s=e.exports={KEY:t,NEED:!1,fastKey:function(e,n){if(!m(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!N(e,t)){if(!o(e))return"F";if(!n)return"E";a(e)}return e[t].i},getWeak:function(e,n){if(!N(e,t)){if(!o(e))return!0;if(!n)return!1;a(e)}return e[t].w},onFreeze:function(e){return i&&s.NEED&&o(e)&&!N(e,t)&&a(e),e}}}),Ce=(ke.KEY,ke.NEED,ke.fastKey,ke.getWeak,ke.onFreeze,k.f),Oe=Q("toStringTag"),Pe=function(e,t,n){e&&!N(e=n?e:e.prototype,Oe)&&Ce(e,Oe,{configurable:!0,value:t})},Ne={f:Q},xe=k.f,Me=function(e){var t=h.Symbol||(h.Symbol=f.Symbol||{});"_"==e.charAt(0)||e in t||xe(t,e,{value:Ne.f(e)})},Ae=g?Object.defineProperties:function(e,t){y(e);for(var n,r=ye(t),o=r.length,i=0;o>i;)k.f(e,n=r[i++],t[n]);return e},De=f.document,je=De&&De.documentElement,Ie=de("IE_PROTO"),Re=function(){},Ue=function(){var e,t=w("iframe"),n=me.length;for(t.style.display="none",je.appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),Ue=e.F;n--;)delete Ue.prototype[me[n]];return Ue()},Fe=Object.create||function(e,t){var n;return null!==e?(Re.prototype=y(e),n=new Re,Re.prototype=null,n[Ie]=e):n=Ue(),void 0===t?n:Ae(n,t)},Le=me.concat("length","prototype"),Be={f:Object.getOwnPropertyNames||function(e){return he(e,Le)}},We=Be.f,qe={}.toString,Ve="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],Ke={f:function(e){return Ve&&"[object Window]"==qe.call(e)?function(e){try{return We(e)}catch(e){return Ve.slice()}}(e):We(se(e))}},He=Object.getOwnPropertyDescriptor,ze={f:g?He:function(e,t){if(e=se(e),t=S(t,!0),E)try{return He(e,t)}catch(e){}if(N(e,t))return C(!ge.f.call(e,t),e[t])}},Ge=ke.KEY,$e=ze.f,Ye=k.f,Qe=Ke.f,Je=f.Symbol,Xe=f.JSON,Ze=Xe&&Xe.stringify,et=Q("_hidden"),tt=Q("toPrimitive"),nt={}.propertyIsEnumerable,rt=Y("symbol-registry"),ot=Y("symbols"),it=Y("op-symbols"),at=Object.prototype,st="function"==typeof Je,lt=f.QObject,ut=!lt||!lt.prototype||!lt.prototype.findChild,ct=g&&v(function(){return 7!=Fe(Ye({},"a",{get:function(){return Ye(this,"a",{value:7}).a}})).a})?function(e,t,n){var r=$e(at,t);r&&delete at[t],Ye(e,t,n),r&&e!==at&&Ye(at,t,r)}:Ye,dt=function(e){var t=ot[e]=Fe(Je.prototype);return t._k=e,t},pt=st&&"symbol"==typeof Je.iterator?function(e){return"symbol"==typeof e}:function(e){return e instanceof Je},ft=function(e,t,n){return e===at&&ft(it,t,n),y(e),t=S(t,!0),y(n),N(ot,t)?(n.enumerable?(N(e,et)&&e[et][t]&&(e[et][t]=!1),n=Fe(n,{enumerable:C(0,!1)})):(N(e,et)||Ye(e,et,C(1,{})),e[et][t]=!0),ct(e,t,n)):Ye(e,t,n)},ht=function(e,t){y(e);for(var n,r=function(e){var t=ye(e),n=ve.f;if(n)for(var r,o=n(e),i=ge.f,a=0;o.length>a;)i.call(e,r=o[a++])&&t.push(r);return t}(t=se(t)),o=0,i=r.length;i>o;)ft(e,n=r[o++],t[n]);return e},mt=function(e){var t=nt.call(this,e=S(e,!0));return!(this===at&&N(ot,e)&&!N(it,e))&&(!(t||!N(this,e)||!N(ot,e)||N(this,et)&&this[et][e])||t)},yt=function(e,t){if(e=se(e),t=S(t,!0),e!==at||!N(ot,t)||N(it,t)){var n=$e(e,t);return!n||!N(ot,t)||N(e,et)&&e[et][t]||(n.enumerable=!0),n}},vt=function(e){for(var t,n=Qe(se(e)),r=[],o=0;n.length>o;)N(ot,t=n[o++])||t==et||t==Ge||r.push(t);return r},gt=function(e){for(var t,n=e===at,r=Qe(n?it:se(e)),o=[],i=0;r.length>i;)!N(ot,t=r[i++])||n&&!N(at,t)||o.push(ot[t]);return o};st||(D((Je=function(){if(this instanceof Je)throw TypeError("Symbol is not a constructor!");var e=A(arguments.length>0?arguments[0]:void 0),t=function(n){this===at&&t.call(it,n),N(this,et)&&N(this[et],e)&&(this[et][e]=!1),ct(this,e,C(1,n))};return g&&ut&&ct(at,e,{configurable:!0,set:t}),dt(e)}).prototype,"toString",function(){return this._k}),ze.f=yt,k.f=ft,Be.f=Ke.f=vt,ge.f=mt,ve.f=gt,g&&D(at,"propertyIsEnumerable",mt,!0),Ne.f=function(e){return dt(Q(e))}),R(R.G+R.W+R.F*!st,{Symbol:Je});for(var bt="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),_t=0;bt.length>_t;)Q(bt[_t++]);for(var wt=ye(Q.store),Et=0;wt.length>Et;)Me(wt[Et++]);R(R.S+R.F*!st,"Symbol",{for:function(e){return N(rt,e+="")?rt[e]:rt[e]=Je(e)},keyFor:function(e){if(!pt(e))throw TypeError(e+" is not a symbol!");for(var t in rt)if(rt[t]===e)return t},useSetter:function(){ut=!0},useSimple:function(){ut=!1}}),R(R.S+R.F*!st,"Object",{create:function(e,t){return void 0===t?Fe(e):ht(Fe(e),t)},defineProperty:ft,defineProperties:ht,getOwnPropertyDescriptor:yt,getOwnPropertyNames:vt,getOwnPropertySymbols:gt}),Xe&&R(R.S+R.F*(!st||v(function(){var e=Je();return"[null]"!=Ze([e])||"{}"!=Ze({a:e})||"{}"!=Ze(Object(e))})),"JSON",{stringify:function(e){for(var t,n,r=[e],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=t=r[1],(m(t)||void 0!==e)&&!pt(e))return G(t)||(t=function(e,t){if("function"==typeof n&&(t=n.call(this,e,t)),!pt(t))return t}),r[1]=t,Ze.apply(Xe,r)}}),Je.prototype[tt]||O(Je.prototype,tt,Je.prototype.valueOf),Pe(Je,"Symbol"),Pe(Math,"Math",!0),Pe(f.JSON,"JSON",!0);var St=Q("toStringTag"),Tt="Arguments"==F(function(){return arguments}()),kt={};kt[Q("toStringTag")]="z",kt+""!="[object z]"&&D(Object.prototype,"toString",function(){return"[object "+function(e){var t,n,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),St))?n:Tt?F(t):"Object"==(r=F(t))&&"function"==typeof t.callee?"Arguments":r}(this)+"]"},!0),Me("asyncIterator"),Me("observable");h.Symbol;var Ct={},Ot={};O(Ot,Q("iterator"),function(){return this});var Pt=function(e,t,n){e.prototype=Fe(Ot,{next:C(1,n)}),Pe(e,t+" Iterator")},Nt=de("IE_PROTO"),xt=Object.prototype,Mt=Object.getPrototypeOf||function(e){return e=W(e),N(e,Nt)?e[Nt]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?xt:null},At=Q("iterator"),Dt=!([].keys&&"next"in[].keys()),jt=function(){return this},It=function(e,t,n,r,o,i,a){Pt(n,t,r);var s,l,u,c=function(e){if(!Dt&&e in h)return h[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},d=t+" Iterator",p="values"==o,f=!1,h=e.prototype,m=h[At]||h["@@iterator"]||o&&h[o],y=m||c(o),v=o?p?c("entries"):y:void 0,g="Array"==t&&h.entries||m;if(g&&(u=Mt(g.call(new e)))!==Object.prototype&&u.next&&(Pe(u,d,!0),"function"!=typeof u[At]&&O(u,At,jt)),p&&m&&"values"!==m.name&&(f=!0,y=function(){return m.call(this)}),(Dt||f||!h[At])&&O(h,At,y),Ct[t]=y,Ct[d]=jt,o)if(s={values:p?y:c("values"),keys:i?y:c("keys"),entries:v},a)for(l in s)l in h||D(h,l,s[l]);else R(R.P+R.F*(Dt||f),t,s);return s},Rt=function(e){return function(t,n){var r,o,i=String(B(t)),a=K(n),s=i.length;return a<0||a>=s?e?"":void 0:(r=i.charCodeAt(a))<55296||r>56319||a+1===s||(o=i.charCodeAt(a+1))<56320||o>57343?e?i.charAt(a):r:e?i.slice(a,a+2):o-56320+(r-55296<<10)+65536}}(!0);It(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=Rt(t,n),this._i+=e.length,{value:e,done:!1})});var Ut=function(e,t){return{value:t,done:!!e}},Ft=It(Array,"Array",function(e,t){this._t=se(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,n=this._i++;return!e||n>=e.length?(this._t=void 0,Ut(1)):Ut(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values");Ct.Arguments=Ct.Array,ne("keys"),ne("values"),ne("entries");for(var Lt=Q("iterator"),Bt=Q("toStringTag"),Wt=Ct.Array,qt={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},Vt=ye(qt),Kt=0;Kt<Vt.length;Kt++){var Ht,zt=Vt[Kt],Gt=qt[zt],$t=f[zt],Yt=$t&&$t.prototype;if(Yt&&(Yt[Lt]||O(Yt,Lt,Wt),Yt[Bt]||O(Yt,Bt,zt),Ct[zt]=Wt,Gt))for(Ht in Ft)Yt[Ht]||D(Yt,Ht,Ft[Ht],!0)}Ne.f("iterator")}.call(this,n(43).setImmediate,n(10))},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,o=Function.prototype.apply;function i(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new i(o.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new i(o.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(44),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(10))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o=1,i={},a=!1,s=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){c(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&c(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){c(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){c(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(c,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return i[o]=a,r(o),o++},l.clearImmediate=u}function u(e){delete i[e]}function c(e){if(a)setTimeout(c,0,e);else{var t=i[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{u(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(10),n(45))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var l,u=[],c=!1,d=-1;function p(){c&&l&&(c=!1,l.length?u=l.concat(u):d=-1,u.length&&f())}function f(){if(!c){var e=s(p);c=!0;for(var t=u.length;t;){for(l=u,u=[];++d<t;)l&&l[d].run();d=-1,t=u.length}l=null,c=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new h(e,t)),1!==u.length||c||s(f)},h.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t){!function(e){"use strict";if(!e.fetch){var t={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(t.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],r=function(e){return e&&DataView.prototype.isPrototypeOf(e)},o=ArrayBuffer.isView||function(e){return e&&n.indexOf(Object.prototype.toString.call(e))>-1};c.prototype.append=function(e,t){e=s(e),t=l(t);var n=this.map[e];this.map[e]=n?n+","+t:t},c.prototype.delete=function(e){delete this.map[s(e)]},c.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},c.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},c.prototype.set=function(e,t){this.map[s(e)]=l(t)},c.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},c.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),u(e)},c.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),u(e)},c.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),u(e)},t.iterable&&(c.prototype[Symbol.iterator]=c.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},m.call(y.prototype),m.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new c(this.headers),url:this.url})},g.error=function(){var e=new g(null,{status:0,statusText:""});return e.type="error",e};var a=[301,302,303,307,308];g.redirect=function(e,t){if(-1===a.indexOf(t))throw new RangeError("Invalid status code");return new g(null,{status:t,headers:{location:e}})},e.Headers=c,e.Request=y,e.Response=g,e.fetch=function(e,n){return new Promise(function(r,o){var i=new y(e,n),a=new XMLHttpRequest;a.onload=function(){var e={status:a.status,statusText:a.statusText,headers:function(e){var t=new c;return e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),r=n.shift().trim();if(r){var o=n.join(":").trim();t.append(r,o)}}),t}(a.getAllResponseHeaders()||"")};e.url="responseURL"in a?a.responseURL:e.headers.get("X-Request-URL");var t="response"in a?a.response:a.responseText;r(new g(t,e))},a.onerror=function(){o(new TypeError("Network request failed"))},a.ontimeout=function(){o(new TypeError("Network request failed"))},a.open(i.method,i.url,!0),"include"===i.credentials?a.withCredentials=!0:"omit"===i.credentials&&(a.withCredentials=!1),"responseType"in a&&t.blob&&(a.responseType="blob"),i.headers.forEach(function(e,t){a.setRequestHeader(t,e)}),a.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function u(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function c(e){this.map={},e instanceof c?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function d(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function p(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function f(e){var t=new FileReader,n=p(t);return t.readAsArrayBuffer(e),n}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&r(e))this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?d(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(f)}),this.text=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return function(e){var t=new FileReader,n=p(t);return t.readAsText(e),n}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(v)}),this.json=function(){return this.text().then(JSON.parse)},this}function y(e,t){var n=(t=t||{}).body;if(e instanceof y){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new c(e.headers)),this.method=e.method,this.mode=e.mode,n||null==e._bodyInit||(n=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new c(t.headers)),this.method=function(e){var t=e.toUpperCase();return i.indexOf(t)>-1?t:e}(t.method||this.method||"GET"),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function v(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(o))}}),t}function g(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new c(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},function(e,t,n){"use strict";n.r(t);var r=n(0),o=n.n(r),i=n(4),a=n.n(i),s=n(16),l=n.n(s),u=n(5),c=n.n(u),d=n(7),p=n.n(d),f=n(3),h=n.n(f),m=n(17),y=n.n(m),v=n(9),g=n.n(v),b=n(6),_=n.n(b),w={locale:"en",pluralRuleFunction:function(e,t){var n=String(e).split("."),r=!n[1],o=Number(n[0])==e,i=o&&n[0].slice(-1),a=o&&n[0].slice(-2);return t?1==i&&11!=a?"one":2==i&&12!=a?"two":3==i&&13!=a?"few":"other":1==e&&r?"one":"other"},fields:{year:{displayName:"year",relative:{0:"this year",1:"next year","-1":"last year"},relativeTime:{future:{one:"in {0} year",other:"in {0} years"},past:{one:"{0} year ago",other:"{0} years ago"}}},month:{displayName:"month",relative:{0:"this month",1:"next month","-1":"last month"},relativeTime:{future:{one:"in {0} month",other:"in {0} months"},past:{one:"{0} month ago",other:"{0} months ago"}}},day:{displayName:"day",relative:{0:"today",1:"tomorrow","-1":"yesterday"},relativeTime:{future:{one:"in {0} day",other:"in {0} days"},past:{one:"{0} day ago",other:"{0} days ago"}}},hour:{displayName:"hour",relative:{0:"this hour"},relativeTime:{future:{one:"in {0} hour",other:"in {0} hours"},past:{one:"{0} hour ago",other:"{0} hours ago"}}},minute:{displayName:"minute",relative:{0:"this minute"},relativeTime:{future:{one:"in {0} minute",other:"in {0} minutes"},past:{one:"{0} minute ago",other:"{0} minutes ago"}}},second:{displayName:"second",relative:{0:"now"},relativeTime:{future:{one:"in {0} second",other:"in {0} seconds"},past:{one:"{0} second ago",other:"{0} seconds ago"}}}}};function E(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];(Array.isArray(e)?e:[e]).forEach(function(e){e&&e.locale&&(c.a.__addLocaleData(e),p.a.__addLocaleData(e))})}function S(e){var t=e&&e.toLowerCase();return!(!c.a.__localeData__[t]||!p.a.__localeData__[t])}var T="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k=(function(){function e(e){this.value=e}function t(t){var n,r;function o(n,r){try{var a=t[n](r),s=a.value;s instanceof e?Promise.resolve(s.value).then(function(e){o("next",e)},function(e){o("throw",e)}):i(a.done?"return":"normal",a.value)}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":n.resolve({value:t,done:!0});break;case"throw":n.reject(t);break;default:n.resolve({value:t,done:!1})}(n=n.next)?o(n.key,n.arg):r=null}this._invoke=function(e,t){return new Promise(function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};r?r=r.next=s:(n=r=s,o(e,t))})},"function"!=typeof t.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(t.prototype[Symbol.asyncIterator]=function(){return this}),t.prototype.next=function(e){return this._invoke("next",e)},t.prototype.throw=function(e){return this._invoke("throw",e)},t.prototype.return=function(e){return this._invoke("return",e)}}(),function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}),C=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),O=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},P=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},N=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},x=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t},M=function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)},A=h.a.bool,D=h.a.number,j=h.a.string,I=h.a.func,R=h.a.object,U=h.a.oneOf,F=h.a.shape,L=h.a.any,B=h.a.oneOfType,W=U(["best fit","lookup"]),q=U(["narrow","short","long"]),V=U(["numeric","2-digit"]),K=I.isRequired,H={locale:j,timeZone:j,formats:R,messages:R,textComponent:L,defaultLocale:j,defaultFormats:R,onError:I},z={formatDate:K,formatTime:K,formatRelative:K,formatNumber:K,formatPlural:K,formatMessage:K,formatHTMLMessage:K},G=F(P({},H,z,{formatters:R,now:K})),$=(j.isRequired,B([j,R]),{localeMatcher:W,formatMatcher:U(["basic","best fit"]),timeZone:j,hour12:A,weekday:q,era:q,year:V,month:U(["numeric","2-digit","narrow","short","long"]),day:V,hour:V,minute:V,second:V,timeZoneName:U(["short","long"])}),Y={localeMatcher:W,style:U(["decimal","currency","percent"]),currency:j,currencyDisplay:U(["symbol","code","name"]),useGrouping:A,minimumIntegerDigits:D,minimumFractionDigits:D,maximumFractionDigits:D,minimumSignificantDigits:D,maximumSignificantDigits:D},Q={style:U(["best fit","numeric"]),units:U(["second","minute","hour","day","month","year","second-short","minute-short","hour-short","day-short","month-short","year-short"])},J={style:U(["cardinal","ordinal"])},X=Object.keys(H),Z={"&":"&",">":">","<":"<",'"':""","'":"'"},ee=/[&><"']/g;function te(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.reduce(function(t,r){return e.hasOwnProperty(r)?t[r]=e[r]:n.hasOwnProperty(r)&&(t[r]=n[r]),t},{})}function ne(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).intl;g()(e,"[React Intl] Could not find required `intl` object. <IntlProvider> needs to exist in the component ancestry.")}function re(e,t){if(e===t)return!0;if("object"!==(void 0===e?"undefined":T(e))||null===e||"object"!==(void 0===t?"undefined":T(t))||null===t)return!1;var n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(var o=Object.prototype.hasOwnProperty.bind(t),i=0;i<n.length;i++)if(!o(n[i])||e[n[i]]!==t[n[i]])return!1;return!0}function oe(e,t,n){var r=e.props,o=e.state,i=e.context,a=void 0===i?{}:i,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},l=a.intl,u=void 0===l?{}:l,c=s.intl,d=void 0===c?{}:c;return!re(t,r)||!re(n,o)||!(d===u||re(te(d,X),te(u,X)))}function ie(e,t){return"[React Intl] "+e+(t?"\n"+t:"")}function ae(e){0}function se(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.intlPropName,i=void 0===n?"intl":n,a=t.withRef,s=void 0!==a&&a,l=function(t){function n(e,t){k(this,n);var r=x(this,(n.__proto__||Object.getPrototypeOf(n)).call(this,e,t));return ne(t),r}return N(n,t),C(n,[{key:"getWrappedInstance",value:function(){return g()(s,"[React Intl] To access the wrapped instance, the `{withRef: true}` option must be set when calling: `injectIntl()`"),this.refs.wrappedInstance}},{key:"render",value:function(){return o.a.createElement(e,P({},this.props,O({},i,this.context.intl),{ref:s?"wrappedInstance":null}))}}]),n}(r.Component);return l.displayName="InjectIntl("+function(e){return e.displayName||e.name||"Component"}(e)+")",l.contextTypes={intl:G},l.WrappedComponent=e,y()(l,e)}function le(e){return e}var ue=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k(this,e);var r="ordinal"===n.style,o=function(e){return c.a.prototype._findPluralRuleFunction(e)}(function(e){return c.a.prototype._resolveLocale(e)}(t));this.format=function(e){return o(e,r)}},ce=Object.keys($),de=Object.keys(Y),pe=Object.keys(Q),fe=Object.keys(J),he={second:60,minute:60,hour:24,day:30,month:12};function me(e){var t=p.a.thresholds;t.second=e.second,t.minute=e.minute,t.hour=e.hour,t.day=e.day,t.month=e.month,t["second-short"]=e["second-short"],t["minute-short"]=e["minute-short"],t["hour-short"]=e["hour-short"],t["day-short"]=e["day-short"],t["month-short"]=e["month-short"]}function ye(e,t,n,r){var o=e&&e[t]&&e[t][n];if(o)return o;r(ie("No "+t+" format named: "+n))}function ve(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=e.formats,a=e.messages,s=e.defaultLocale,l=e.defaultFormats,u=n.id,c=n.defaultMessage;g()(u,"[React Intl] An `id` must be provided to format a message.");var d=a&&a[u];if(!(Object.keys(r).length>0))return d||c||u;var p=void 0,f=e.onError||ae;if(d)try{p=t.getMessageFormat(d,o,i).format(r)}catch(e){f(ie('Error formatting message: "'+u+'" for locale: "'+o+'"'+(c?", using default message as fallback.":""),e))}else(!c||o&&o.toLowerCase()!==s.toLowerCase())&&f(ie('Missing message: "'+u+'" for locale: "'+o+'"'+(c?", using default message as fallback.":"")));if(!p&&c)try{p=t.getMessageFormat(c,s,l).format(r)}catch(e){f(ie('Error formatting the default message for: "'+u+'"',e))}return p||f(ie('Cannot format message: "'+u+'", using message '+(d||c?"source":"id")+" as fallback.")),p||d||c||u}var ge=Object.freeze({formatDate:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=e.formats,a=e.timeZone,s=r.format,l=e.onError||ae,u=new Date(n),c=P({},a&&{timeZone:a},s&&ye(i,"date",s,l)),d=te(r,ce,c);try{return t.getDateTimeFormat(o,d).format(u)}catch(e){l(ie("Error formatting date.",e))}return String(u)},formatTime:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=e.formats,a=e.timeZone,s=r.format,l=e.onError||ae,u=new Date(n),c=P({},a&&{timeZone:a},s&&ye(i,"time",s,l)),d=te(r,ce,c);d.hour||d.minute||d.second||(d=P({},d,{hour:"numeric",minute:"numeric"}));try{return t.getDateTimeFormat(o,d).format(u)}catch(e){l(ie("Error formatting time.",e))}return String(u)},formatRelative:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=e.formats,a=r.format,s=e.onError||ae,l=new Date(n),u=new Date(r.now),c=a&&ye(i,"relative",a,s),d=te(r,pe,c),f=P({},p.a.thresholds);me(he);try{return t.getRelativeFormat(o,d).format(l,{now:isFinite(u)?u:t.now()})}catch(e){s(ie("Error formatting relative time.",e))}finally{me(f)}return String(l)},formatNumber:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=e.formats,a=r.format,s=e.onError||ae,l=a&&ye(i,"number",a,s),u=te(r,de,l);try{return t.getNumberFormat(o,u).format(n)}catch(e){s(ie("Error formatting number.",e))}return String(n)},formatPlural:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=e.locale,i=te(r,fe),a=e.onError||ae;try{return t.getPluralFormat(o,i).format(n)}catch(e){a(ie("Error formatting plural.",e))}return"other"},formatMessage:ve,formatHTMLMessage:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return ve(e,t,n,Object.keys(r).reduce(function(e,t){var n=r[t];return e[t]="string"==typeof n?function(e){return(""+e).replace(ee,function(e){return Z[e]})}(n):n,e},{}))}}),be=Object.keys(H),_e=Object.keys(z),we={formats:{},messages:{},timeZone:null,textComponent:"span",defaultLocale:"en",defaultFormats:{},onError:ae},Ee=function(e){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));g()("undefined"!=typeof Intl,"[React Intl] The `Intl` APIs must be available in the runtime, and do not appear to be built-in. An `Intl` polyfill should be loaded.\nSee: http://formatjs.io/guides/runtime-environments/");var o=n.intl,i=void 0;i=isFinite(e.initialNow)?Number(e.initialNow):o?o.now():Date.now();var a=(o||{}).formatters,s=void 0===a?{getDateTimeFormat:_()(Intl.DateTimeFormat),getNumberFormat:_()(Intl.NumberFormat),getMessageFormat:_()(c.a),getRelativeFormat:_()(p.a),getPluralFormat:_()(ue)}:a;return r.state=P({},s,{now:function(){return r._didDisplay?Date.now():i}}),r}return N(t,e),C(t,[{key:"getConfig",value:function(){var e=this.context.intl,t=te(this.props,be,e);for(var n in we)void 0===t[n]&&(t[n]=we[n]);if(!function(e){for(var t=(e||"").split("-");t.length>0;){if(S(t.join("-")))return!0;t.pop()}return!1}(t.locale)){var r=t,o=r.locale,i=r.defaultLocale,a=r.defaultFormats;(0,r.onError)(ie('Missing locale data for locale: "'+o+'". Using default locale: "'+i+'" as fallback.')),t=P({},t,{locale:i,formats:a,messages:we.messages})}return t}},{key:"getBoundFormatFns",value:function(e,t){return _e.reduce(function(n,r){return n[r]=ge[r].bind(null,e,t),n},{})}},{key:"getChildContext",value:function(){var e=this.getConfig(),t=this.getBoundFormatFns(e,this.state),n=this.state,r=n.now,o=function(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}(n,["now"]);return{intl:P({},e,t,{formatters:o,now:r})}}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"componentDidMount",value:function(){this._didDisplay=!0}},{key:"render",value:function(){return r.Children.only(this.props.children)}}]),t}(r.Component);Ee.displayName="IntlProvider",Ee.contextTypes={intl:G},Ee.childContextTypes={intl:G.isRequired};var Se=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatDate,n=e.textComponent,r=this.props,i=r.value,a=r.children,s=t(i,this.props);return"function"==typeof a?a(s):o.a.createElement(n,null,s)}}]),t}(r.Component);Se.displayName="FormattedDate",Se.contextTypes={intl:G};var Te=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatTime,n=e.textComponent,r=this.props,i=r.value,a=r.children,s=t(i,this.props);return"function"==typeof a?a(s):o.a.createElement(n,null,s)}}]),t}(r.Component);Te.displayName="FormattedTime",Te.contextTypes={intl:G};var ke=1e3,Ce=6e4,Oe=36e5,Pe=864e5,Ne=2147483647;var xe=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));ne(n);var o=isFinite(e.initialNow)?Number(e.initialNow):n.intl.now();return r.state={now:o},r}return N(t,e),C(t,[{key:"scheduleNextUpdate",value:function(e,t){var n=this;clearTimeout(this._timer);var r=e.value,o=e.units,i=e.updateInterval,a=new Date(r).getTime();if(i&&isFinite(a)){var s=a-t.now,l=function(e){switch(e){case"second":return ke;case"minute":return Ce;case"hour":return Oe;case"day":return Pe;default:return Ne}}(o||function(e){var t=Math.abs(e);return t<Ce?"second":t<Oe?"minute":t<Pe?"hour":"day"}(s)),u=Math.abs(s%l),c=s<0?Math.max(i,l-u):Math.max(i,u);this._timer=setTimeout(function(){n.setState({now:n.context.intl.now()})},c)}}},{key:"componentDidMount",value:function(){this.scheduleNextUpdate(this.props,this.state)}},{key:"componentWillReceiveProps",value:function(e){(function(e,t){if(e===t)return!0;var n=new Date(e).getTime(),r=new Date(t).getTime();return isFinite(n)&&isFinite(r)&&n===r})(e.value,this.props.value)||this.setState({now:this.context.intl.now()})}},{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"componentWillUpdate",value:function(e,t){this.scheduleNextUpdate(e,t)}},{key:"componentWillUnmount",value:function(){clearTimeout(this._timer)}},{key:"render",value:function(){var e=this.context.intl,t=e.formatRelative,n=e.textComponent,r=this.props,i=r.value,a=r.children,s=t(i,P({},this.props,this.state));return"function"==typeof a?a(s):o.a.createElement(n,null,s)}}]),t}(r.Component);xe.displayName="FormattedRelative",xe.contextTypes={intl:G},xe.defaultProps={updateInterval:1e4};var Me=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatNumber,n=e.textComponent,r=this.props,i=r.value,a=r.children,s=t(i,this.props);return"function"==typeof a?a(s):o.a.createElement(n,null,s)}}]),t}(r.Component);Me.displayName="FormattedNumber",Me.contextTypes={intl:G};var Ae=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return oe.apply(void 0,[this].concat(t))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatPlural,n=e.textComponent,r=this.props,i=r.value,a=r.other,s=r.children,l=t(i,this.props),u=this.props[l]||a;return"function"==typeof s?s(u):o.a.createElement(n,null,u)}}]),t}(r.Component);Ae.displayName="FormattedPlural",Ae.contextTypes={intl:G},Ae.defaultProps={style:"cardinal"};var De=function(e,t){return ve({},{getMessageFormat:_()(c.a)},e,t)},je=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return e.defaultMessage||ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values;if(!re(e.values,t))return!0;for(var n=P({},e,{values:t}),r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return oe.apply(void 0,[this,n].concat(o))}},{key:"render",value:function(){var e=this.context.intl||{},t=e.formatMessage,n=void 0===t?De:t,o=e.textComponent,i=void 0===o?"span":o,a=this.props,s=a.id,l=a.description,u=a.defaultMessage,c=a.values,d=a.tagName,p=void 0===d?i:d,f=a.children,h=void 0,m=void 0,y=void 0;if(c&&Object.keys(c).length>0){var v=Math.floor(1099511627776*Math.random()).toString(16),g=function(){var e=0;return function(){return"ELEMENT-"+v+"-"+(e+=1)}}();h="@__"+v+"__@",m={},y={},Object.keys(c).forEach(function(e){var t=c[e];if(Object(r.isValidElement)(t)){var n=g();m[e]=h+n+h,y[n]=t}else m[e]=t})}var b=n({id:s,description:l,defaultMessage:u},m||c),_=void 0;return _=y&&Object.keys(y).length>0?b.split(h).filter(function(e){return!!e}).map(function(e){return y[e]||e}):[b],"function"==typeof f?f.apply(void 0,M(_)):r.createElement.apply(void 0,[p,null].concat(M(_)))}}]),t}(r.Component);je.displayName="FormattedMessage",je.contextTypes={intl:G},je.defaultProps={values:{}};var Ie=function(e){function t(e,n){k(this,t);var r=x(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n));return ne(n),r}return N(t,e),C(t,[{key:"shouldComponentUpdate",value:function(e){var t=this.props.values;if(!re(e.values,t))return!0;for(var n=P({},e,{values:t}),r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];return oe.apply(void 0,[this,n].concat(o))}},{key:"render",value:function(){var e=this.context.intl,t=e.formatHTMLMessage,n=e.textComponent,r=this.props,i=r.id,a=r.description,s=r.defaultMessage,l=r.values,u=r.tagName,c=void 0===u?n:u,d=r.children,p=t({id:i,description:a,defaultMessage:s},l);if("function"==typeof d)return d(p);var f={__html:p};return o.a.createElement(c,{dangerouslySetInnerHTML:f})}}]),t}(r.Component);Ie.displayName="FormattedHTMLMessage",Ie.contextTypes={intl:G},Ie.defaultProps={values:{}},E(w),E(l.a);var Re,Ue,Fe,Le=n(18),Be=n.n(Le),We=n(11),qe=n(12),Ve=n(8),Ke=n(1),He=n(13),ze=n.n(He),Ge={AVAILABLE_IN_WINDOW:"only-available-in-window",AVAILABLE_IN_SW:"only-available-in-sw",SHOULD_BE_INHERITED:"should-be-overriden",BAD_SENDER_ID:"bad-sender-id",INCORRECT_GCM_SENDER_ID:"incorrect-gcm-sender-id",PERMISSION_DEFAULT:"permission-default",PERMISSION_BLOCKED:"permission-blocked",UNSUPPORTED_BROWSER:"unsupported-browser",NOTIFICATIONS_BLOCKED:"notifications-blocked",FAILED_DEFAULT_REGISTRATION:"failed-serviceworker-registration",SW_REGISTRATION_EXPECTED:"sw-registration-expected",GET_SUBSCRIPTION_FAILED:"get-subscription-failed",INVALID_SAVED_TOKEN:"invalid-saved-token",SW_REG_REDUNDANT:"sw-reg-redundant",TOKEN_SUBSCRIBE_FAILED:"token-subscribe-failed",TOKEN_SUBSCRIBE_NO_TOKEN:"token-subscribe-no-token",TOKEN_SUBSCRIBE_NO_PUSH_SET:"token-subscribe-no-push-set",TOKEN_UNSUBSCRIBE_FAILED:"token-unsubscribe-failed",TOKEN_UPDATE_FAILED:"token-update-failed",TOKEN_UPDATE_NO_TOKEN:"token-update-no-token",USE_SW_BEFORE_GET_TOKEN:"use-sw-before-get-token",INVALID_DELETE_TOKEN:"invalid-delete-token",DELETE_TOKEN_NOT_FOUND:"delete-token-not-found",DELETE_SCOPE_NOT_FOUND:"delete-scope-not-found",BG_HANDLER_FUNCTION_EXPECTED:"bg-handler-function-expected",NO_WINDOW_CLIENT_TO_MSG:"no-window-client-to-msg",UNABLE_TO_RESUBSCRIBE:"unable-to-resubscribe",NO_FCM_TOKEN_FOR_RESUBSCRIBE:"no-fcm-token-for-resubscribe",FAILED_TO_DELETE_TOKEN:"failed-to-delete-token",NO_SW_IN_REG:"no-sw-in-reg",BAD_SCOPE:"bad-scope",BAD_VAPID_KEY:"bad-vapid-key",BAD_SUBSCRIPTION:"bad-subscription",BAD_TOKEN:"bad-token",BAD_PUSH_SET:"bad-push-set",FAILED_DELETE_VAPID_KEY:"failed-delete-vapid-key",INVALID_PUBLIC_VAPID_KEY:"invalid-public-vapid-key",USE_PUBLIC_KEY_BEFORE_GET_TOKEN:"use-public-key-before-get-token",PUBLIC_KEY_DECRYPTION_FAILED:"public-vapid-key-decryption-failed"},$e=((Re={})[Ge.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",Re[Ge.AVAILABLE_IN_SW]="This method is available in a service worker context.",Re[Ge.SHOULD_BE_INHERITED]="This method should be overriden by extended classes.",Re[Ge.BAD_SENDER_ID]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",Re[Ge.PERMISSION_DEFAULT]="The required permissions were not granted and dismissed instead.",Re[Ge.PERMISSION_BLOCKED]="The required permissions were not granted and blocked instead.",Re[Ge.UNSUPPORTED_BROWSER]="This browser doesn't support the API's required to use the firebase SDK.",Re[Ge.NOTIFICATIONS_BLOCKED]="Notifications have been blocked.",Re[Ge.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",Re[Ge.SW_REGISTRATION_EXPECTED]="A service worker registration was the expected input.",Re[Ge.GET_SUBSCRIPTION_FAILED]="There was an error when trying to get any existing Push Subscriptions.",Re[Ge.INVALID_SAVED_TOKEN]="Unable to access details of the saved token.",Re[Ge.SW_REG_REDUNDANT]="The service worker being used for push was made redundant.",Re[Ge.TOKEN_SUBSCRIBE_FAILED]="A problem occured while subscribing the user to FCM: {$message}",Re[Ge.TOKEN_SUBSCRIBE_NO_TOKEN]="FCM returned no token when subscribing the user to push.",Re[Ge.TOKEN_SUBSCRIBE_NO_PUSH_SET]="FCM returned an invalid response when getting an FCM token.",Re[Ge.TOKEN_UNSUBSCRIBE_FAILED]="A problem occured while unsubscribing the user from FCM: {$message}",Re[Ge.TOKEN_UPDATE_FAILED]="A problem occured while updating the user from FCM: {$message}",Re[Ge.TOKEN_UPDATE_NO_TOKEN]="FCM returned no token when updating the user to push.",Re[Ge.USE_SW_BEFORE_GET_TOKEN]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",Re[Ge.INVALID_DELETE_TOKEN]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",Re[Ge.DELETE_TOKEN_NOT_FOUND]="The deletion attempt for token could not be performed as the token was not found.",Re[Ge.DELETE_SCOPE_NOT_FOUND]="The deletion attempt for service worker scope could not be performed as the scope was not found.",Re[Ge.BG_HANDLER_FUNCTION_EXPECTED]="The input to setBackgroundMessageHandler() must be a function.",Re[Ge.NO_WINDOW_CLIENT_TO_MSG]="An attempt was made to message a non-existant window client.",Re[Ge.UNABLE_TO_RESUBSCRIBE]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",Re[Ge.NO_FCM_TOKEN_FOR_RESUBSCRIBE]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",Re[Ge.FAILED_TO_DELETE_TOKEN]="Unable to delete the currently saved token.",Re[Ge.NO_SW_IN_REG]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",Re[Ge.INCORRECT_GCM_SENDER_ID]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",Re[Ge.BAD_SCOPE]="The service worker scope must be a string with at least one character.",Re[Ge.BAD_VAPID_KEY]="The public VAPID key is not a Uint8Array with 65 bytes.",Re[Ge.BAD_SUBSCRIPTION]="The subscription must be a valid PushSubscription.",Re[Ge.BAD_TOKEN]="The FCM Token used for storage / lookup was not a valid token string.",Re[Ge.BAD_PUSH_SET]="The FCM push set used for storage / lookup was not not a valid push set string.",Re[Ge.FAILED_DELETE_VAPID_KEY]="The VAPID key could not be deleted.",Re[Ge.INVALID_PUBLIC_VAPID_KEY]="The public VAPID key must be a string.",Re[Ge.PUBLIC_KEY_DECRYPTION_FAILED]="The public VAPID key did not equal 65 bytes when decrypted.",Re),Ye=new Ve.ErrorFactory("messaging","Messaging",$e),Qe=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),Je="https://fcm.googleapis.com";function Xe(e,t){if(null==e||null==t)return!1;if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(var n=new DataView(e),r=new DataView(t),o=0;o<e.byteLength;o++)if(n.getUint8(o)!==r.getUint8(o))return!1;return!0}function Ze(e){return function(e){var t=new Uint8Array(e);return btoa(String.fromCharCode.apply(null,t))}(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}!function(e){e.TYPE_OF_MSG="firebase-messaging-msg-type",e.DATA="firebase-messaging-msg-data"}(Ue||(Ue={})),function(e){e.PUSH_MSG_RECEIVED="push-msg-received",e.NOTIFICATION_CLICKED="notification-clicked"}(Fe||(Fe={}));var et=function(){function e(){}return e.prototype.getToken=function(e,t,n){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var r,o,i,a,s,l,u,c;return Object(Ke.__generator)(this,function(d){switch(d.label){case 0:r=Ze(t.getKey("p256dh")),o=Ze(t.getKey("auth")),i="authorized_entity="+e+"&endpoint="+t.endpoint+"&encryption_key="+r+"&encryption_auth="+o,Xe(n.buffer,Qe.buffer)||(a=Ze(n),i+="&application_pub_key="+a),(s=new Headers).append("Content-Type","application/x-www-form-urlencoded"),l={method:"POST",headers:s,body:i},d.label=1;case 1:return d.trys.push([1,4,,5]),[4,fetch(Je+"/fcm/connect/subscribe",l)];case 2:return[4,d.sent().json()];case 3:return u=d.sent(),[3,5];case 4:throw d.sent(),Ye.create(Ge.TOKEN_SUBSCRIBE_FAILED);case 5:if(u.error)throw c=u.error.message,Ye.create(Ge.TOKEN_SUBSCRIBE_FAILED,{message:c});if(!u.token)throw Ye.create(Ge.TOKEN_SUBSCRIBE_NO_TOKEN);if(!u.pushSet)throw Ye.create(Ge.TOKEN_SUBSCRIBE_NO_PUSH_SET);return[2,{token:u.token,pushSet:u.pushSet}]}})})},e.prototype.updateToken=function(e,t,n,r,o){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var i,a,s,l,u,c,d,p;return Object(Ke.__generator)(this,function(f){switch(f.label){case 0:i=Ze(r.getKey("p256dh")),a=Ze(r.getKey("auth")),s="push_set="+n+"&token="+t+"&authorized_entity="+e+"&endpoint="+r.endpoint+"&encryption_key="+i+"&encryption_auth="+a,Xe(o.buffer,Qe.buffer)||(l=Ze(o),s+="&application_pub_key="+l),(u=new Headers).append("Content-Type","application/x-www-form-urlencoded"),c={method:"POST",headers:u,body:s},f.label=1;case 1:return f.trys.push([1,4,,5]),[4,fetch(Je+"/fcm/connect/subscribe",c)];case 2:return[4,f.sent().json()];case 3:return d=f.sent(),[3,5];case 4:throw f.sent(),Ye.create(Ge.TOKEN_UPDATE_FAILED);case 5:if(d.error)throw p=d.error.message,Ye.create(Ge.TOKEN_UPDATE_FAILED,{message:p});if(!d.token)throw Ye.create(Ge.TOKEN_UPDATE_NO_TOKEN);return[2,d.token]}})})},e.prototype.deleteToken=function(e,t,n){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var r,o,i,a,s;return Object(Ke.__generator)(this,function(l){switch(l.label){case 0:r="authorized_entity="+e+"&token="+t+"&pushSet="+n,(o=new Headers).append("Content-Type","application/x-www-form-urlencoded"),i={method:"POST",headers:o,body:r},l.label=1;case 1:return l.trys.push([1,4,,5]),[4,fetch(Je+"/fcm/connect/unsubscribe",i)];case 2:return[4,l.sent().json()];case 3:if((a=l.sent()).error)throw s=a.error.message,Ye.create(Ge.TOKEN_UNSUBSCRIBE_FAILED,{message:s});return[3,5];case 4:throw l.sent(),Ye.create(Ge.TOKEN_UNSUBSCRIBE_FAILED);case 5:return[2]}})})},e}();function tt(e){for(var t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),r=new Uint8Array(n.length),o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}var nt="undefined",rt="fcm_token_object_Store";function ot(){var e=indexedDB.open(nt);e.onerror=function(e){},e.onsuccess=function(t){!function(e){if(e.objectStoreNames.contains(rt)){var t=e.transaction(rt).objectStore(rt),n=new et,r=t.openCursor();r.onerror=function(e){console.warn("Unable to cleanup old IDB.",e)},r.onsuccess=function(){var t=r.result;if(t){var o=t.value;n.deleteToken(o.fcmSenderId,o.fcmToken,o.fcmPushSet),t.continue()}else e.close(),indexedDB.deleteDatabase(nt)}}}(e.result)}}var it=function(){function e(){this.dbPromise=null}return e.prototype.get=function(e){return this.createTransaction(function(t){return t.get(e)})},e.prototype.getIndex=function(e,t){return this.createTransaction(function(n){return n.index(e).get(t)})},e.prototype.put=function(e){return this.createTransaction(function(t){return t.put(e)},"readwrite")},e.prototype.delete=function(e){return this.createTransaction(function(t){return t.delete(e)},"readwrite")},e.prototype.closeDatabase=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(e){switch(e.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:e.sent().close(),this.dbPromise=null,e.label=2;case 2:return[2]}})})},e.prototype.createTransaction=function(e,t){return void 0===t&&(t="readonly"),Object(Ke.__awaiter)(this,void 0,void 0,function(){var n,r,o,i;return Object(Ke.__generator)(this,function(a){switch(a.label){case 0:return[4,this.getDb()];case 1:return n=a.sent(),r=n.transaction(this.objectStoreName,t),o=r.objectStore(this.objectStoreName),[4,function(e){return new Promise(function(t,n){e.onsuccess=function(){t(e.result)},e.onerror=function(){n(e.error)}})}(e(o))];case 2:return i=a.sent(),[2,new Promise(function(e,t){r.oncomplete=function(){e(i)},r.onerror=function(){t(r.error)}})]}})})},e.prototype.getDb=function(){var e=this;return this.dbPromise||(this.dbPromise=new Promise(function(t,n){var r=indexedDB.open(e.dbName,e.dbVersion);r.onsuccess=function(){t(r.result)},r.onerror=function(){e.dbPromise=null,n(r.error)},r.onupgradeneeded=function(t){return e.onDbUpgrade(r,t)}})),this.dbPromise},e}();var at=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dbName="fcm_token_details_db",t.dbVersion=3,t.objectStoreName="fcm_token_object_Store",t}return Object(Ke.__extends)(t,e),t.prototype.onDbUpgrade=function(e,t){var n=e.result;switch(t.oldVersion){case 0:(r=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0});case 1:ot();case 2:var r,o=(r=e.transaction.objectStore(this.objectStoreName)).openCursor();o.onsuccess=function(){var e=o.result;if(e){var t=e.value,n=Object(Ke.__assign)({},t);t.createTime||(n.createTime=Date.now()),"string"==typeof t.vapidKey&&(n.vapidKey=tt(t.vapidKey)),"string"==typeof t.auth&&(n.auth=tt(t.auth).buffer),"string"==typeof t.auth&&(n.p256dh=tt(t.p256dh).buffer),e.update(n),e.continue()}}}},t.prototype.getTokenDetailsFromToken=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(t){if(!e)throw Ye.create(Ge.BAD_TOKEN);return st({fcmToken:e}),[2,this.getIndex("fcmToken",e)]})})},t.prototype.getTokenDetailsFromSWScope=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(t){if(!e)throw Ye.create(Ge.BAD_SCOPE);return st({swScope:e}),[2,this.get(e)]})})},t.prototype.saveTokenDetails=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(t){if(!e.swScope)throw Ye.create(Ge.BAD_SCOPE);if(!e.vapidKey)throw Ye.create(Ge.BAD_VAPID_KEY);if(!e.endpoint||!e.auth||!e.p256dh)throw Ye.create(Ge.BAD_SUBSCRIPTION);if(!e.fcmSenderId)throw Ye.create(Ge.BAD_SENDER_ID);if(!e.fcmToken)throw Ye.create(Ge.BAD_TOKEN);if(!e.fcmPushSet)throw Ye.create(Ge.BAD_PUSH_SET);return st(e),[2,this.put(e)]})})},t.prototype.deleteToken=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:return"string"!=typeof e||0===e.length?[2,Promise.reject(Ye.create(Ge.INVALID_DELETE_TOKEN))]:[4,this.getTokenDetailsFromToken(e)];case 1:if(!(t=n.sent()))throw Ye.create(Ge.DELETE_TOKEN_NOT_FOUND);return[4,this.delete(t.swScope)];case 2:return n.sent(),[2,t]}})})},t}(it);function st(e){if(e.fcmToken&&("string"!=typeof e.fcmToken||0===e.fcmToken.length))throw Ye.create(Ge.BAD_TOKEN);if(e.swScope&&("string"!=typeof e.swScope||0===e.swScope.length))throw Ye.create(Ge.BAD_SCOPE);if(e.vapidKey&&(!(e.vapidKey instanceof Uint8Array)||65!==e.vapidKey.length))throw Ye.create(Ge.BAD_VAPID_KEY);if(e.endpoint&&("string"!=typeof e.endpoint||0===e.endpoint.length))throw Ye.create(Ge.BAD_SUBSCRIPTION);if(e.auth&&!(e.auth instanceof ArrayBuffer))throw Ye.create(Ge.BAD_SUBSCRIPTION);if(e.p256dh&&!(e.p256dh instanceof ArrayBuffer))throw Ye.create(Ge.BAD_SUBSCRIPTION);if(e.fcmSenderId&&("string"!=typeof e.fcmSenderId||0===e.fcmSenderId.length))throw Ye.create(Ge.BAD_SENDER_ID);if(e.fcmPushSet&&("string"!=typeof e.fcmPushSet||0===e.fcmPushSet.length))throw Ye.create(Ge.BAD_PUSH_SET)}var lt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.dbName="fcm_vapid_details_db",t.dbVersion=1,t.objectStoreName="fcm_vapid_object_Store",t}return Object(Ke.__extends)(t,e),t.prototype.onDbUpgrade=function(e){e.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},t.prototype.getVapidFromSWScope=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:if("string"!=typeof e||0===e.length)throw Ye.create(Ge.BAD_SCOPE);return[4,this.get(e)];case 1:return[2,(t=n.sent())?t.vapidKey:void 0]}})})},t.prototype.saveVapidDetails=function(e,t){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var n;return Object(Ke.__generator)(this,function(r){if("string"!=typeof e||0===e.length)throw Ye.create(Ge.BAD_SCOPE);if(null===t||65!==t.length)throw Ye.create(Ge.BAD_VAPID_KEY);return n={swScope:e,vapidKey:t},[2,this.put(n)]})})},t.prototype.deleteVapidDetails=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getVapidFromSWScope(e)];case 1:if(!(t=n.sent()))throw Ye.create(Ge.DELETE_SCOPE_NOT_FOUND);return[4,this.delete(e)];case 2:return n.sent(),[2,t]}})})},t}(it),ut="messagingSenderId",ct=function(){function e(e){var t=this;if(!e.options[ut]||"string"!=typeof e.options[ut])throw Ye.create(Ge.BAD_SENDER_ID);this.messagingSenderId=e.options[ut],this.tokenDetailsModel=new at,this.vapidDetailsModel=new lt,this.iidModel=new et,this.app=e,this.INTERNAL={delete:function(){return t.delete()}}}return e.prototype.getToken=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var e,t,n,r,o;return Object(Ke.__generator)(this,function(i){switch(i.label){case 0:if("denied"===(e=this.getNotificationPermission_()))throw Ye.create(Ge.NOTIFICATIONS_BLOCKED);return"granted"!==e?[2,null]:[4,this.getSWRegistration_()];case 1:return t=i.sent(),[4,this.getPublicVapidKey_()];case 2:return n=i.sent(),[4,this.getPushSubscription(t,n)];case 3:return r=i.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(t.scope)];case 4:return(o=i.sent())?[2,this.manageExistingToken(t,r,n,o)]:[2,this.getNewToken(t,r,n)]}})})},e.prototype.manageExistingToken=function(e,t,n,r){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(o){switch(o.label){case 0:return function(e,t,n){if(!n.vapidKey||!Xe(t.buffer,n.vapidKey.buffer))return!1;var r=e.endpoint===n.endpoint,o=Xe(e.getKey("auth"),n.auth),i=Xe(e.getKey("p256dh"),n.p256dh);return r&&o&&i}(t,n,r)?Date.now()<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(e,t,n,r)]:[4,this.deleteTokenFromDB(r.fcmToken)];case 1:return o.sent(),[2,this.getNewToken(e,t,n)]}})})},e.prototype.updateToken=function(e,t,n,r){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var o,i,a;return Object(Ke.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,6]),[4,this.iidModel.updateToken(this.messagingSenderId,r.fcmToken,r.fcmPushSet,t,n)];case 1:return o=s.sent(),i={swScope:e.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:o,fcmPushSet:r.fcmPushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(i)];case 2:return s.sent(),[4,this.vapidDetailsModel.saveVapidDetails(e.scope,n)];case 3:return s.sent(),[2,o];case 4:return a=s.sent(),[4,this.deleteToken(r.fcmToken)];case 5:throw s.sent(),a;case 6:return[2]}})})},e.prototype.getNewToken=function(e,t,n){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var r,o;return Object(Ke.__generator)(this,function(i){switch(i.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,t,n)];case 1:return r=i.sent(),o={swScope:e.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(o)];case 2:return i.sent(),[4,this.vapidDetailsModel.saveVapidDetails(e.scope,n)];case 3:return i.sent(),[2,r.token]}})})},e.prototype.deleteToken=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t,n;return Object(Ke.__generator)(this,function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(e)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return(t=r.sent())?[4,t.pushManager.getSubscription()]:[3,4];case 3:if(n=r.sent())return[2,n.unsubscribe()];r.label=4;case 4:return[2,!0]}})})},e.prototype.deleteTokenFromDB=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:return[4,this.tokenDetailsModel.deleteToken(e)];case 1:return t=n.sent(),[4,this.iidModel.deleteToken(t.fcmSenderId,t.fcmToken,t.fcmPushSet)];case 2:return n.sent(),[2]}})})},e.prototype.getPushSubscription=function(e,t){return e.pushManager.getSubscription().then(function(n){return n||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})})},e.prototype.requestPermission=function(){throw Ye.create(Ge.AVAILABLE_IN_WINDOW)},e.prototype.useServiceWorker=function(e){throw Ye.create(Ge.AVAILABLE_IN_WINDOW)},e.prototype.usePublicVapidKey=function(e){throw Ye.create(Ge.AVAILABLE_IN_WINDOW)},e.prototype.onMessage=function(e,t,n){throw Ye.create(Ge.AVAILABLE_IN_WINDOW)},e.prototype.onTokenRefresh=function(e,t,n){throw Ye.create(Ge.AVAILABLE_IN_WINDOW)},e.prototype.setBackgroundMessageHandler=function(e){throw Ye.create(Ge.AVAILABLE_IN_SW)},e.prototype.delete=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(e){switch(e.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return e.sent(),[2]}})})},e.prototype.getNotificationPermission_=function(){return Notification.permission},e.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},e.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},e.prototype.getIidModel=function(){return this.iidModel},e}();var dt=function(e){function t(t){var n=e.call(this,t)||this;return n.bgMessageHandler=null,self.addEventListener("push",function(e){n.onPush(e)}),self.addEventListener("pushsubscriptionchange",function(e){n.onSubChange(e)}),self.addEventListener("notificationclick",function(e){n.onNotificationClick(e)}),n}return Object(Ke.__extends)(t,e),t.prototype.onPush=function(e){e.waitUntil(this.onPush_(e))},t.prototype.onSubChange=function(e){e.waitUntil(this.onSubChange_(e))},t.prototype.onNotificationClick=function(e){e.waitUntil(this.onNotificationClick_(e))},t.prototype.onPush_=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t,n,r,o,i,a;return Object(Ke.__generator)(this,function(s){switch(s.label){case 0:if(!e.data)return[2];try{t=e.data.json()}catch(e){return[2]}return[4,this.hasVisibleClients_()];case 1:return s.sent()?[2,this.sendMessageToWindowClients_(t)]:(n=this.getNotificationData_(t))?(r=n.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return o=s.sent(),i=n.actions,a=Notification.maxActions,i&&a&&i.length>a&&console.warn("This browser only supports "+a+" actions.The remaining actions will not be displayed."),[2,o.showNotification(r,n)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(t)]:[3,5];case 4:return s.sent(),[2];case 5:return[2]}})})},t.prototype.onSubChange_=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var e,t,n,r;return Object(Ke.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return e=o.sent(),[3,3];case 2:throw t=o.sent(),Ye.create(Ge.UNABLE_TO_RESUBSCRIBE,{message:t});case 3:return o.trys.push([3,5,,8]),[4,e.pushManager.getSubscription()];case 4:return o.sent(),[3,8];case 5:return n=o.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(e.scope)];case 6:if(!(r=o.sent()))throw n;return[4,this.deleteToken(r.fcmToken)];case 7:throw o.sent(),n;case 8:return[2]}})})},t.prototype.onNotificationClick_=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t,n,r,o;return Object(Ke.__generator)(this,function(i){switch(i.label){case 0:return e.notification&&e.notification.data&&e.notification.data.FCM_MSG?e.action?[2]:(e.stopImmediatePropagation(),e.notification.close(),(t=e.notification.data.FCM_MSG).notification&&(n=t.fcmOptions&&t.fcmOptions.link||t.notification.click_action)?[4,this.getWindowClient_(n)]:[2]):[2];case 1:return(r=i.sent())?[3,3]:[4,self.clients.openWindow(n)];case 2:return r=i.sent(),[3,5];case 3:return[4,r.focus()];case 4:r=i.sent(),i.label=5;case 5:return r?(delete t.notification,delete t.fcmOptions,o=ft(Fe.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(r,o)]):[2]}})})},t.prototype.getNotificationData_=function(e){if(e&&"object"==typeof e.notification){var t,n=Object(Ke.__assign)({},e.notification);return n.data=Object(Ke.__assign)({},e.notification.data,((t={}).FCM_MSG=e,t)),n}},t.prototype.setBackgroundMessageHandler=function(e){if(!e||"function"!=typeof e)throw Ye.create(Ge.BG_HANDLER_FUNCTION_EXPECTED);this.bgMessageHandler=e},t.prototype.getWindowClient_=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t,n,r,o;return Object(Ke.__generator)(this,function(i){switch(i.label){case 0:return t=new URL(e,self.location.href).href,[4,pt()];case 1:for(n=i.sent(),r=null,o=0;o<n.length;o++)if(new URL(n[o].url,self.location.href).href===t){r=n[o];break}return[2,r]}})})},t.prototype.attemptToMessageClient_=function(e,t){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(n){if(!e)throw Ye.create(Ge.NO_WINDOW_CLIENT_TO_MSG);return e.postMessage(t),[2]})})},t.prototype.hasVisibleClients_=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(e){switch(e.label){case 0:return[4,pt()];case 1:return[2,e.sent().some(function(e){return"visible"===e.visibilityState})]}})})},t.prototype.sendMessageToWindowClients_=function(e){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var t,n,r=this;return Object(Ke.__generator)(this,function(o){switch(o.label){case 0:return[4,pt()];case 1:return t=o.sent(),n=ft(Fe.PUSH_MSG_RECEIVED,e),[4,Promise.all(t.map(function(e){return r.attemptToMessageClient_(e,n)}))];case 2:return o.sent(),[2]}})})},t.prototype.getSWRegistration_=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(e){return[2,self.registration]})})},t.prototype.getPublicVapidKey_=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var e,t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(e=n.sent()))throw Ye.create(Ge.SW_REGISTRATION_EXPECTED);return[4,this.getVapidDetailsModel().getVapidFromSWScope(e.scope)];case 2:return null==(t=n.sent())?[2,Qe]:[2,t]}})})},t}(ct);function pt(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function ft(e,t){return(n={})[Ue.TYPE_OF_MSG]=e,n[Ue.DATA]=t,n;var n}var ht=function(e){function t(t){var n=e.call(this,t)||this;return n.registrationToUse=null,n.publicVapidKeyToUse=null,n.manifestCheckPromise=null,n.messageObserver=null,n.tokenRefreshObserver=null,n.onMessageInternal=Object(Ve.createSubscribe)(function(e){n.messageObserver=e}),n.onTokenRefreshInternal=Object(Ve.createSubscribe)(function(e){n.tokenRefreshObserver=e}),n.setupSWMessageListener_(),n}return Object(Ke.__extends)(t,e),t.prototype.getToken=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(t){switch(t.label){case 0:return this.manifestCheckPromise||(this.manifestCheckPromise=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var e,t;return Object(Ke.__generator)(this,function(n){switch(n.label){case 0:if(!(e=document.querySelector('link[rel="manifest"]')))return[2];n.label=1;case 1:return n.trys.push([1,4,,5]),[4,fetch(e.href)];case 2:return[4,n.sent().json()];case 3:return t=n.sent(),[3,5];case 4:return n.sent(),[2];case 5:if(!t||!t.gcm_sender_id)return[2];if("103953800507"!==t.gcm_sender_id)throw Ye.create(Ge.INCORRECT_GCM_SENDER_ID);return[2]}})})}()),[4,this.manifestCheckPromise];case 1:return t.sent(),[2,e.prototype.getToken.call(this)]}})})},t.prototype.requestPermission=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){var e;return Object(Ke.__generator)(this,function(t){switch(t.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(e=t.sent()))return[2];throw"denied"===e?Ye.create(Ge.PERMISSION_BLOCKED):Ye.create(Ge.PERMISSION_DEFAULT)}})})},t.prototype.useServiceWorker=function(e){if(!(e instanceof ServiceWorkerRegistration))throw Ye.create(Ge.SW_REGISTRATION_EXPECTED);if(null!=this.registrationToUse)throw Ye.create(Ge.USE_SW_BEFORE_GET_TOKEN);this.registrationToUse=e},t.prototype.usePublicVapidKey=function(e){if("string"!=typeof e)throw Ye.create(Ge.INVALID_PUBLIC_VAPID_KEY);if(null!=this.publicVapidKeyToUse)throw Ye.create(Ge.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);var t=tt(e);if(65!==t.length)throw Ye.create(Ge.PUBLIC_KEY_DECRYPTION_FAILED);this.publicVapidKeyToUse=t},t.prototype.onMessage=function(e,t,n){return"function"==typeof e?this.onMessageInternal(e,t,n):this.onMessageInternal(e)},t.prototype.onTokenRefresh=function(e,t,n){return"function"==typeof e?this.onTokenRefreshInternal(e,t,n):this.onTokenRefreshInternal(e)},t.prototype.waitForRegistrationToActivate_=function(e){var t=e.installing||e.waiting||e.active;return new Promise(function(n,r){if(t)if("activated"!==t.state)if("redundant"!==t.state){var o=function(){if("activated"===t.state)n(e);else{if("redundant"!==t.state)return;r(Ye.create(Ge.SW_REG_REDUNDANT))}t.removeEventListener("statechange",o)};t.addEventListener("statechange",o)}else r(Ye.create(Ge.SW_REG_REDUNDANT));else n(e);else r(Ye.create(Ge.NO_SW_IN_REG))})},t.prototype.getSWRegistration_=function(){var e=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(e){throw Ye.create(Ge.FAILED_DEFAULT_REGISTRATION,{browserErrorMessage:e.message})}).then(function(t){return e.waitForRegistrationToActivate_(t).then(function(){return e.registrationToUse=t,t.update(),t})}))},t.prototype.getPublicVapidKey_=function(){return Object(Ke.__awaiter)(this,void 0,void 0,function(){return Object(Ke.__generator)(this,function(e){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,Qe]})})},t.prototype.setupSWMessageListener_=function(){var e=this;navigator.serviceWorker.addEventListener("message",function(t){if(t.data&&t.data[Ue.TYPE_OF_MSG]){var n=t.data;switch(n[Ue.TYPE_OF_MSG]){case Fe.PUSH_MSG_RECEIVED:case Fe.NOTIFICATION_CLICKED:var r=n[Ue.DATA];e.messageObserver&&e.messageObserver.next(r)}}},!1)},t}(ct);function mt(){return self&&"ServiceWorkerGlobalScope"in self?"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}!function(e){var t={isSupported:mt};e.INTERNAL.registerService("messaging",function(e){if(!mt())throw Ye.create(Ge.UNSUPPORTED_BROWSER);return self&&"ServiceWorkerGlobalScope"in self?new dt(e):new ht(e)},t)}(ze.a);var yt=n(2),vt=n.n(yt),gt="TinodeWeb/0.15.9-rc1",bt={hosted:"api.tinode.co",local:"localhost:6060"},_t=(bt.hosted,3e3),wt=195840,Et=768;function St(e){return(St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Tt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function kt(e){return(kt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ct(e,t){return(Ct=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ot(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Pt=le({info:{id:"menu_item_info",defaultMessage:"Info"},clear_messages:{id:"menu_item_clear_messages",defaultMessage:"Clear messages"},clear_for_all:{id:"menu_item_clear_messages_for_all",defaultMessage:"Clear for All"},delete:{id:"menu_item_delete",defaultMessage:"Delete"},delete_for_all:{id:"menu_item_delete_for_all",defaultMessage:"Delete for All"},mute:{id:"menu_item_mute",defaultMessage:"Mute"},unmute:{id:"menu_item_unmute",defaultMessage:"Unmute"},topic_delete:{id:"menu_item_delete_topic",defaultMessage:"Delete"},unblock:{id:"menu_item_unblock",defaultMessage:"Unblock"},block:{id:"menu_item_block",defaultMessage:"Block"},member_delete:{id:"menu_item_member_delete",defaultMessage:"Remove"}}),Nt=se(function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),n=function(e,t){return!t||"object"!==St(t)&&"function"!=typeof t?Ot(e):t}(this,kt(t).call(this,e));var r=e.intl.formatMessage;return n.handlePageClick=n.handlePageClick.bind(Ot(Ot(n))),n.handleEscapeKey=n.handleEscapeKey.bind(Ot(Ot(n))),n.handleClick=n.handleClick.bind(Ot(Ot(n))),n.MenuItems={topic_info:{title:r(Pt.info),handler:null},messages_clear:{title:r(Pt.clear_messages),handler:function(e,t){n.deleteMessages(!0,!1,e,t)}},messages_clear_hard:{title:r(Pt.clear_for_all),handler:function(e,t){n.deleteMessages(!0,!0,e,t)}},message_delete:{title:r(Pt.delete),handler:function(e,t){n.deleteMessages(!1,!1,e,t)}},message_delete_hard:{title:r(Pt.delete_for_all),handler:function(e,t){n.deleteMessages(!1,!0,e,t)}},topic_unmute:{title:r(Pt.unmute),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"+P")},topic_mute:{title:r(Pt.mute),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"-P")},topic_unblock:{title:r(Pt.unblock),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"+J")},topic_block:{title:r(Pt.block),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"-J")},topic_delete:{title:r(Pt.topic_delete),handler:function(e,t){var r=n.props.tinode.getTopic(e.topicName);r?r.delTopic().catch(function(e){t&&t(e.message,"err")}):console.log("Topic not found: ",e.topicName)}},permissions:{title:r({id:"menu_item_edit_permissions"}),handler:null},member_delete:{title:r(Pt.member_delete),handler:function(e,t){var r=n.props.tinode.getTopic(e.topicName);r&&e.user?r.delSubscription(e.user).catch(function(e){t&&t(e.message,"err")}):console.log("Topic or user not found: '"+e.topicName+"', '"+e.user+"'")}},member_mute:{title:r(Pt.mute),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"-P")},member_unmute:{title:r(Pt.unmute),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"+P")},member_block:{title:r(Pt.block),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"-J")},member_unblock:{title:r(Pt.unblock),handler:n.topicPermissionSetter.bind(Ot(Ot(n)),"+J")}},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ct(e,t)}(t,o.a.Component),function(e,t,n){t&&Tt(e.prototype,t),n&&Tt(e,n)}(t,[{key:"componentDidMount",value:function(){document.addEventListener("mousedown",this.handlePageClick,!1),document.addEventListener("keyup",this.handleEscapeKey,!1)}},{key:"componentWillUnmount",value:function(){document.removeEventListener("mousedown",this.handlePageClick,!1),document.removeEventListener("keyup",this.handleEscapeKey,!1)}},{key:"handlePageClick",value:function(e){a.a.findDOMNode(this).contains(e.target)||(e.preventDefault(),e.stopPropagation(),this.props.hide())}},{key:"handleEscapeKey",value:function(e){27===e.keyCode&&this.props.hide()}},{key:"handleClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.hide();var t=this.props.items[e.currentTarget.dataset.id];"string"==typeof t&&(t=this.MenuItems[t]),t.handler(this.props.params,this.props.onError)}},{key:"deleteMessages",value:function(e,t,n,r){var o=this.props.tinode.getTopic(n.topicName);if(o){if(o.cancelSend(n.seq))return Promise.resolve();(e?o.delMessagesAll(t):o.delMessagesList([n.seq],t)).catch(function(e){r&&r(e.message,"err")})}else console.log("Topic not found: ",n.topicName)}},{key:"topicPermissionSetter",value:function(e,t,n){var r=this.props.tinode.getTopic(t.topicName);if(r){var o,i;if(t.user){if(!(i=r.subscriber(t.user)))return void console.log("Subscriber not found",t.topicName+"["+t.user+"]");o=i.acs.updateGiven(e).getGiven()}else o=r.getAccessMode().updateWant(e).getWant();r.setMeta({sub:{user:t.user,mode:o}}).catch(function(e){n&&n(e.message,"err")})}else console.log("Topic not found",t.topicName)}},{key:"render",value:function(){var e=this,t=0,n=[];this.props.items.map(function(r){"string"==typeof r&&(r=e.MenuItems[r]),r&&r.title&&n.push("-"==r.title?o.a.createElement("li",{className:"separator",key:t}):o.a.createElement("li",{onClick:e.handleClick,"data-id":t,key:t},r.title)),t++});var r=13*(.7+2.5*n.length),i={left:(this.props.bounds.right-this.props.clickAt.x<156?this.props.clickAt.x-this.props.bounds.left-156:this.props.clickAt.x-this.props.bounds.left)+"px",top:(this.props.bounds.bottom-this.props.clickAt.y<r?this.props.clickAt.y-this.props.bounds.top-r:this.props.clickAt.y-this.props.bounds.top)+"px"};return o.a.createElement("ul",{className:"menu",style:i},n)}}]),t}());function xt(e){var t=window.navigator.userLanguage||window.navigator.language,n=new Date;return e.getFullYear()==n.getFullYear()?e.getMonth()==n.getMonth()&&e.getDate()==n.getDate()?e.toLocaleTimeString(t,{hour12:!1,hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Mt(e){if(!e||0==e)return"0 Bytes";var t=["Bytes","KB","MB","GB","TB","PB"],n=Math.min(0|Math.floor(Math.log2(e)/10),t.length-1),r=e/Math.pow(1024,n),o=n>0?r<3?2:r<30?1:0:0;return r.toFixed(o)+" "+t[n]}function At(e){return(At="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Dt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function jt(e,t){return!t||"object"!==At(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function It(e){return(It=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Rt(e,t){return(Rt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ut=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),jt(this,It(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Rt(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Dt(e.prototype,t),n&&Dt(e,n)}(t,[{key:"render",value:function(){var e;if(!0===this.props.avatar)if(this.props.topic&&this.props.title&&this.props.title.trim()){var t=this.props.title.trim().charAt(0),n="lettertile dark-color"+Math.abs(function(e){var t=0;e=""+e;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(this.props.topic))%16;e=o.a.createElement("div",{className:n},o.a.createElement("div",null,t))}else e="grp"==vt.a.topicType(this.props.topic)?o.a.createElement("i",{className:"material-icons"},"group"):o.a.createElement("i",{className:"material-icons"},"person");else e=this.props.avatar?o.a.createElement("img",{className:"avatar",alt:"avatar",src:this.props.avatar}):null;return e}}]),t}(),Ft=["image/jpeg","image/gif","image/png","image/svg","image/svg+xml"],Lt=["jpg","gif","png","svg","svg"];function Bt(e){return e&&e.type&&e.data?"data:image/"+e.type+";base64,"+e.data:null}function Wt(e,t,n,r,o){if(!(e&&t&&n&&r))return null;o&&(n=r=Math.min(n,r));var i=Math.min(Math.min(e,n)/e,Math.min(t,r)/t),a={dstWidth:e*i|0,dstHeight:t*i|0};return o?(a.dstWidth=a.dstHeight=Math.min(a.dstWidth,a.dstHeight),a.srcWidth=a.srcHeight=Math.min(e,t),a.xoffset=(e-a.srcWidth)/2|0,a.yoffset=(t-a.srcWidth)/2|0):(a.xoffset=a.yoffset=0,a.srcWidth=e,a.srcHeight=t),a}function qt(e,t){var n=Ft.indexOf(t),r=Lt[n],o=e.lastIndexOf(".");return o>=0&&(e=e.substring(0,o)),e+"."+r}function Vt(e,t,n,r,o,i){var a=new Image;a.crossOrigin="Anonymous",a.onerror=function(e){i("Image format unrecognized")},a.onload=function(){var a=Wt(this.width,this.height,t,n,r);if(a){var s=document.createElement("canvas");s.width=a.dstWidth,s.height=a.dstHeight;var l=s.getContext("2d");l.imageSmoothingEnabled=!0,l.drawImage(this,a.xoffset,a.yoffset,a.srcWidth,a.srcHeight,0,0,a.dstWidth,a.dstHeight);var u=this.width!=a.dstWidth||this.height!=a.dstHeight||Ft.indexOf(e.type)<0?"image/jpeg":e.type,c=s.toDataURL(u);if(u=zt(c.split(",")[0])){var d=.78;if(Gt(c.length)>wt&&(u="image/jpeg"),"image/jpeg"==u)for(;Gt(c.length)>wt&&d>.45;)c=s.toDataURL(u,d),d*=.84;Gt(c.length)>wt?i("The image size "+bytesToHumanSize(Gt(c.length))+" exceeds the "+bytesToHumanSize(wt)+" limit.","err"):(s=null,o(c.split(",")[1],u,a.dstWidth,a.dstHeight,qt(e.name,u)))}else i("Unsupported image format")}else i("Invalid image")},a.src=URL.createObjectURL(e)}function Kt(e,t,n){var r=new FileReader;r.addEventListener("load",function(){var o=r.result.split(","),i=zt(o[0]);if(i){var a=new Image;a.crossOrigin="Anonymous",a.onload=function(){t(o[1],i,this.width,this.height,qt(e.name,i))},a.onerror=function(e){n("Image format not recognized")},a.src=URL.createObjectURL(e)}else n("Failed to process image file")},!1),r.readAsDataURL(e)}function Ht(e,t,n){var r=new FileReader;r.addEventListener("load",function(){t(e.type,r.result.split(",")[1],e.name)}),r.readAsDataURL(e)}function zt(e){var t=/^data:(image\/[-+a-z0-9.]+);base64/.exec(e);return t&&t.length>1?t[1]:null}function Gt(e){return 3*Math.floor(e/4)}function $t(e){return($t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Yt(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qt(e){return(Qt=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Jt(e,t){return(Jt=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xt(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Zt=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==$t(t)&&"function"!=typeof t?Xt(e):t}(this,Qt(t).call(this,e))).state={dataUrl:e.avatar},n.handleFileUpload=n.handleFileUpload.bind(Xt(Xt(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Jt(e,t)}(t,o.a.Component),function(e,t,n){t&&Yt(e.prototype,t),n&&Yt(e,n)}(t,[{key:"handleFileUpload",value:function(e){var t=this;Vt(e.target.files[0],128,128,!0,function(e,n){var r=Bt({data:e,type:n});t.setState({dataUrl:r}),t.props.onImageChanged(r)},function(e){t.props.onError(e,"err")}),e.target.value=""}},{key:"render",value:function(){var e="file-input-avatar-"+(Math.random()+"").substr(2);return o.a.createElement("div",{className:"avatar-upload"},this.state.dataUrl?o.a.createElement("img",{src:this.state.dataUrl,className:"preview"}):this.props.readOnly&&this.props.uid?o.a.createElement("div",{className:"avatar-box"},o.a.createElement(Ut,{avatar:!0,topic:this.props.uid,title:this.props.title})):o.a.createElement("div",{className:"blank"},128,"×",128),this.props.readOnly?null:o.a.createElement("input",{type:"file",id:e,className:"inputfile hidden",accept:"image/*",onChange:this.handleFileUpload}),this.props.readOnly?null:o.a.createElement("label",{htmlFor:e,className:"round"},o.a.createElement("i",{className:"material-icons"},"file_upload")))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return t.dataUrl!=e.avatar?{dataUrl:e.avatar}:null}}]),t}();function en(e){return(en="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function tn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function nn(e){return(nn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function rn(e,t){return(rn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function on(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var an=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==en(t)&&"function"!=typeof t?on(e):t}(this,nn(t).call(this,e))).handleChange=n.handleChange.bind(on(on(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&rn(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&tn(e.prototype,t),n&&tn(e,n)}(t,[{key:"handleChange",value:function(){this.props.onChange(this.props.name,!this.props.checked)}},{key:"render",value:function(){return this.props.onChange?this.props.checked?o.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box"):o.a.createElement("i",{className:"material-icons blue clickable",onClick:this.handleChange},"check_box_outline_blank"):this.props.checked?o.a.createElement("i",{className:"material-icons"},"check_box"):o.a.createElement("i",{className:"material-icons"},"check_box_outline_blank")}}]),t}();function sn(e){return(sn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ln(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function un(e,t){return!t||"object"!==sn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function cn(e){return(cn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function dn(e,t){return(dn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var pn=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),un(this,cn(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&dn(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ln(e.prototype,t),n&&ln(e,n)}(t,[{key:"render",value:function(){var e=null;if(this.props.count>0){var t=this.props.count>9?"9+":this.props.count;e=o.a.createElement("span",{className:"unread"},t)}return e}}]),t}();function fn(e){return(fn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mn(e){return(mn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yn(e,t){return(yn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var gn=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==fn(t)&&"function"!=typeof t?vn(e):t}(this,mn(t).call(this,e))).handleClick=n.handleClick.bind(vn(vn(n))),n.handleContextClick=n.handleContextClick.bind(vn(vn(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yn(e,t)}(t,o.a.Component),function(e,t,n){t&&hn(e.prototype,t),n&&hn(e,n)}(t,[{key:"handleClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.onSelected&&this.props.onSelected(this.props.item,this.props.index,this.props.now,this.props.acs)}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.props.item,y:e.pageY,x:e.pageX})}},{key:"render",value:function(){var e=this.props.title;e?e.length>30&&(e=e.substring(0,28)+"..."):e=o.a.createElement("i",null,o.a.createElement(je,{id:"unnamed_topic"}));var t=this.props.now?"online":"offline",n=!this.props.avatar||this.props.avatar,r=[];if(this.props.badges&&this.props.badges.length>0){var i=0;this.props.badges.map(function(e){var t="badge"+(e.color?" "+e.color:"");r.push(o.a.createElement("span",{className:t,key:i},e.name)),i++})}return this.props.showMode&&this.props.acs&&r.push(o.a.createElement("span",{className:"badge",key:"mode"},this.props.acs.getMode())),o.a.createElement("li",{className:!this.props.showCheckmark&&this.props.selected?"selected":null,onClick:this.handleClick},o.a.createElement("div",{className:"avatar-box"},o.a.createElement(Ut,{avatar:n,title:this.props.title,topic:this.props.item}),this.props.showOnline?o.a.createElement("span",{className:t}):this.props.showCheckmark&&this.props.selected?o.a.createElement("i",{className:"checkmark material-icons"},"check_circle"):null),o.a.createElement("div",{className:"text-box"},o.a.createElement("div",null,o.a.createElement("span",{className:"contact-title"},e),this.props.unread>0?o.a.createElement(pn,{count:this.props.unread}):null),this.props.comment?o.a.createElement("div",{className:"contact-comment"},this.props.comment):null,o.a.createElement("span",null,r)),this.props.showContextMenu?o.a.createElement("span",{className:"menuTrigger"},o.a.createElement("a",{href:"javascript:;",onClick:this.handleContextClick},o.a.createElement("i",{className:"material-icons"},"expand_more"))):null)}}]),t}();function bn(e){return(bn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wn(e,t){return!t||"object"!==bn(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function En(e){return(En=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Sn(e,t){return(Sn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Tn=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),wn(this,En(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Sn(e,t)}(t,o.a.Component),function(e,t,n){t&&_n(e.prototype,t),n&&_n(e,n)}(t,[{key:"render",value:function(){var e=this,t=[],n=Array.isArray(this.props.topicSelected);return this.props.contacts&&this.props.contacts.length>0&&this.props.contacts.map(function(r){var i=r.topic?r.topic:r.user;if(e.props.filterFunc&&e.props.filter){var a=[i];if(r.private&&r.private.comment&&a.push((""+r.private.comment).toLowerCase()),r.public&&r.public.fn&&a.push((""+r.public.fn).toLowerCase()),!e.props.filterFunc(e.props.filter,a))return}var s=n?e.props.topicSelected.indexOf(i)>-1:e.props.topicSelected===i,l=[];e.props.showMode&&(i===e.props.myUserId&&l.push({name:"you",color:"green"}),r.acs&&r.acs.isOwner()&&l.push({name:"owner"}));var u=Array.isArray(r.private)?r.private.join(", "):r.private?r.private.comment:null;t.push(o.a.createElement(gn,{title:r.public?r.public.fn:null,avatar:Bt(r.public?r.public.photo:null),comment:u,unread:e.props.showUnread?r.unread:0,now:r.online&&e.props.connected,acs:r.acs,showMode:e.props.showMode,badges:l,showCheckmark:n,selected:s,showOnline:e.props.showOnline,onSelected:e.props.onTopicSelected,showContextMenu:e.props.showContextMenu,item:i,index:t.length,key:i}))},this),o.a.createElement("div",{className:this.props.noScroll?null:"scrollable-panel"},t.length>0?o.a.createElement("ul",{className:"contact-box"},t):o.a.createElement("div",{className:"center-medium-text"},this.props.emptyListMessage))}}]),t}();function kn(e){return(kn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Cn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function On(e){return(On=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Pn(e,t){return(Pn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Nn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xn=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==kn(t)&&"function"!=typeof t?Nn(e):t}(this,On(t).call(this,e))).handleCancel=n.handleCancel.bind(Nn(Nn(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pn(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Cn(e.prototype,t),n&&Cn(e,n)}(t,[{key:"handleCancel",value:function(){this.props.onCancel(this.props.topic,this.props.index)}},{key:"render",value:function(){var e=this.props.title||this.props.topic;return o.a.createElement("div",{className:"chip"},this.props.noAvatar?o.a.createElement("span",{className:"spacer"}):o.a.createElement("div",{className:"avatar-box"},o.a.createElement(Ut,{avatar:this.props.avatar||!0,topic:this.props.topic,title:this.props.title})),o.a.createElement("span",null,e),this.props.onCancel&&!this.props.required?o.a.createElement("a",{href:"javascript:;",onClick:this.handleCancel},"×"):o.a.createElement("span",{className:"spacer"}))}}]),t}();function Mn(e){return(Mn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function An(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Dn(e){return(Dn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jn(e,t){return(jn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function In(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Rn=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Mn(t)&&"function"!=typeof t?In(e):t}(this,Dn(t).call(this,e))).state={placeholder:e.chips?"":e.prompt,sortedChips:t.sortChips(e.chips,e.required),chipIndex:t.indexChips(e.chips),input:"",focused:!1},n.handleTextInput=n.handleTextInput.bind(In(In(n))),n.removeChipAt=n.removeChipAt.bind(In(In(n))),n.handleChipCancel=n.handleChipCancel.bind(In(In(n))),n.handleFocusGained=n.handleFocusGained.bind(In(In(n))),n.handleFocusLost=n.handleFocusLost.bind(In(In(n))),n.handleKeyDown=n.handleKeyDown.bind(In(In(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jn(e,t)}(t,o.a.Component),function(e,t,n){t&&An(e.prototype,t),n&&An(e,n)}(t,[{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.setState({sortedChips:t.sortChips(e.chips,e.required),chipIndex:t.indexChips(e.chips)}),e.chips.length>this.props.chips.length&&this.setState({input:""})}},{key:"handleTextInput",value:function(e){this.setState({input:e.target.value}),this.props.filterFunc&&this.props.filterFunc(e.target.value)}},{key:"removeChipAt",value:function(e){var t=this.state.sortedChips[e];this.props.onChipRemoved(t.user,this.state.chipIndex[t.user])}},{key:"handleChipCancel",value:function(e,t){this.removeChipAt(t)}},{key:"handleFocusGained",value:function(){this.setState({focused:!0})}},{key:"handleFocusLost",value:function(){this.setState({focused:!1}),this.props.onFocusLost&&this.props.onFocusLost(this.state.input)}},{key:"handleKeyDown",value:function(e){if("Backspace"===e.key){if(0==this.state.input.length&&this.state.sortedChips.length>0){var t=this.state.sortedChips.length-1;this.state.sortedChips[t].user!==this.props.required&&this.removeChipAt(t)}}else"Enter"===e.key?this.props.onEnter&&this.props.onEnter(this.state.input):"Escape"===e.key&&this.props.onCancel&&this.props.onCancel()}},{key:"render",value:function(){var e=this,t=[],n=0;this.state.sortedChips.map(function(r){t.push(o.a.createElement(xn,{onCancel:e.handleChipCancel,avatar:Bt(r.public?r.public.photo:null),title:r.public?r.public.fn:void 0,noAvatar:e.props.avatarDisabled,topic:r.user,required:r.user===e.props.required,index:n,key:r.user})),n++});var r="chip-input"+(this.state.focused?" focused":"");return o.a.createElement("div",{className:r},t,o.a.createElement("input",{type:"text",placeholder:this.state.placeholder,onChange:this.handleTextInput,onFocus:this.handleFocusGained,onBlur:this.handleFocusLost,onKeyDown:this.handleKeyDown,value:this.state.input,autoFocus:!0}))}}],[{key:"indexChips",value:function(e){var t={},n=0;return e.map(function(e){t[e.user]=n,n++}),t}},{key:"sortChips",value:function(e,t){var n=[],r=[];return e.map(function(e){e.user===t?n.push(e):r.push(e)}),n.concat(r)}}]),t}();function Un(e){return(Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Fn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ln(e){return(Ln=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Bn(e,t){return(Bn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Wn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var qn=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Un(t)&&"function"!=typeof t?Wn(e):t}(this,Ln(t).call(this,e))).state={members:e.members,index:t.indexMembers(e.members),contactFilter:"",noContactsMessage:"You have no contacts :-(",selectedContacts:t.selectedContacts(e.members)},n.handleContactSelected=n.handleContactSelected.bind(Wn(Wn(n))),n.handleMemberRemoved=n.handleMemberRemoved.bind(Wn(Wn(n))),n.handleContactFilter=n.handleContactFilter.bind(Wn(Wn(n))),n.handleSubmit=n.handleSubmit.bind(Wn(Wn(n))),n.handleCancel=n.handleCancel.bind(Wn(Wn(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bn(e,t)}(t,o.a.Component),function(e,t,n){t&&Fn(e.prototype,t),n&&Fn(e,n)}(t,[{key:"handleContactSelected",value:function(e,n){var r=this.state.index[e];if(r){if(r.present)return;r.delta+=1,r.present=!0}else r={delta:1,present:!0};var o=this.state.members.slice();o.push(this.props.contacts[n]);var i=t.selectedContacts(o),a=this.state.index;a[e]=r,this.setState({members:o,index:a,selectedContacts:i})}},{key:"handleMemberRemoved",value:function(e,n){var r=this.state.index[e];if(r&&r.present){r.present=!1,r.delta-=1;var o=this.state.members.slice();o.splice(n,1);var i=t.selectedContacts(o),a=this.state.index;a[e]=r,this.setState({members:o,index:a,selectedContacts:i})}}},{key:"handleContactFilter",value:function(e){this.props.intl.formatMessage;var t=e?"No contacts match '"+e+"'":"You have no contacts :-(";this.setState({contactFilter:e,noContactsMessage:t})}},{key:"handleSubmit",value:function(){var e=this,t=[],n=[],r=[];Object.keys(this.state.index).map(function(o){e.state.index[o].present&&t.push(o),e.state.index[o].delta>0?n.push(o):e.state.index[o].delta<0&&r.push(o)}),this.props.onSubmit(t,n,r)}},{key:"handleCancel",value:function(){this.props.onCancel()}},{key:"render",value:function(){this.props.intl.formatMessage;return o.a.createElement("div",{id:"group-manager"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"title_group_members",defaultMessage:"Group members"}))),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(Rn,{chips:this.state.members,required:this.props.requiredMember,prompt:"add members",filterFunc:this.handleContactFilter,onChipRemoved:this.handleMemberRemoved})),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},"All contacts")),o.a.createElement(Tn,{contacts:this.props.contacts,myUserId:this.props.myUserId,topicSelected:this.state.selectedContacts,filter:this.state.contactFilter,filterFunc:t.doContactFiltering,emptyListMessage:this.state.noContactsMessage,showOnline:!1,showUnread:!1,onTopicSelected:this.handleContactSelected}),o.a.createElement("div",{id:"group-manager-buttons",className:"panel-form-row"},o.a.createElement("button",{className:"blue",onClick:this.handleSubmit},o.a.createElement(je,{id:"button_ok",defaultMessage:"OK"})),o.a.createElement("button",{className:"white",onClick:this.handleCancel},o.a.createElement(je,{id:"button_cancel",defaultMessage:"Cancel"}))))}}],[{key:"indexMembers",value:function(e){var t={};return e.map(function(e){t[e.user]={delta:0,present:!0}}),t}},{key:"selectedContacts",value:function(e){var t=[];return e.map(function(e){t.push(e.user)}),t}},{key:"doContactFiltering",value:function(e,t){if(e){for(var n=0;n<t.length;n++)if(t[n].indexOf(e)>=0)return!0;return!1}return!0}}]),t}());function Vn(e){return(Vn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Kn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Hn(e){return(Hn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function zn(e,t){return(zn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Gn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var $n=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Vn(t)&&"function"!=typeof t?Gn(e):t}(this,Hn(t).call(this,e))).state={value:n.props.value,visible:!1},n.handleVisibility=n.handleVisibility.bind(Gn(Gn(n))),n.handeTextChange=n.handeTextChange.bind(Gn(Gn(n))),n.handleKeyDown=n.handleKeyDown.bind(Gn(Gn(n))),n.handleEditingFinished=n.handleEditingFinished.bind(Gn(Gn(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zn(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Kn(e.prototype,t),n&&Kn(e,n)}(t,[{key:"handeTextChange",value:function(e){this.setState({value:e.target.value}),this.props.onChange&&this.props.onChange(e)}},{key:"handleVisibility",value:function(e){e.preventDefault(),this.setState({visible:!this.state.visible})}},{key:"handleKeyDown",value:function(e){27==e.keyCode?(this.setState({value:this.props.value,visible:!1}),this.props.onFinished&&this.props.onFinished()):13==e.keyCode&&this.handleEditingFinished()}},{key:"handleEditingFinished",value:function(e){var t=this;if(e){var n=e.currentTarget;setTimeout(function(){n.contains(document.activeElement)||t.props.onFinished&&t.props.onFinished(t.state.value)},0)}else this.props.onFinished&&this.props.onFinished(this.state.value.trim())}},{key:"render",value:function(){return o.a.createElement("div",{tabIndex:"-1",className:"group-focus",onBlur:this.handleEditingFinished},o.a.createElement("input",{className:"with-visibility",type:this.state.visible?"text":"password",value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoFocus:this.props.autoFocus?"autoFocus":"",autoComplete:this.props.autoComplete,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown}),o.a.createElement("span",{onClick:this.handleVisibility},o.a.createElement("i",{className:"material-icons clickable light-gray"},this.state.visible?"visibility":"visibility_off")))}}]),t}();function Yn(e){return(Yn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Qn(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Jn(e){return(Jn=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Xn(e,t){return(Xn=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Zn(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var er=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Yn(t)&&"function"!=typeof t?Zn(e):t}(this,Jn(t).call(this,e))).state={active:e.active,initialValue:e.value||"",value:e.value||""},n.handeTextChange=n.handeTextChange.bind(Zn(Zn(n))),n.handleKeyDown=n.handleKeyDown.bind(Zn(Zn(n))),n.handleStartEditing=n.handleStartEditing.bind(Zn(Zn(n))),n.handleEditingFinished=n.handleEditingFinished.bind(Zn(Zn(n))),n.handlePasswordFinished=n.handlePasswordFinished.bind(Zn(Zn(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Xn(e,t)}(t,o.a.Component),function(e,t,n){t&&Qn(e.prototype,t),n&&Qn(e,n)}(t,[{key:"handeTextChange",value:function(e){this.setState({value:e.target.value})}},{key:"handleKeyDown",value:function(e){27===e.keyCode?this.setState({value:this.props.value,active:!1}):13===e.keyCode&&this.handleEditingFinished()}},{key:"handleStartEditing",value:function(){this.props.readOnly||(a.a.findDOMNode(this).focus(),this.setState({active:!0}))}},{key:"handleEditingFinished",value:function(){this.setState({active:!1});var e=this.state.value.trim();(e||this.props.value)&&e!==this.props.value&&this.props.onFinished(e)}},{key:"handlePasswordFinished",value:function(e){this.setState({active:!1}),e&&e!==this.props.value&&this.props.onFinished(e)}},{key:"render",value:function(){if(this.state.active)var e=this.props.type||"text";else{var t="password"==this.props.type?"••••••••":this.state.value,n="in-place-edit"+(this.props.readOnly?" disabled":"");t||(t=this.props.placeholder,n+=" placeholder"),t.length>20&&(t=t.substring(0,19)+"...")}return this.state.active?"password"==e?o.a.createElement($n,{value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoComplete:this.props.autoComplete,autoFocus:!0,onFinished:this.handlePasswordFinished}):o.a.createElement("input",{type:e,value:this.state.value,placeholder:this.props.placeholder,required:this.props.required?"required":"",autoComplete:this.props.autoComplete,autoFocus:!0,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown,onBlur:this.handleEditingFinished}):o.a.createElement("span",{className:n,onClick:this.handleStartEditing},o.a.createElement("span",{className:"content"},t))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return t.initialValue==e.value||t.active?null:{initialValue:e.value||"",value:e.value||""}}}]),t}();function tr(e){return(tr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function nr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function rr(e,t){return!t||"object"!==tr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function or(e){return(or=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ir(e,t){return(ir=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ar=function(e){function t(e){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),rr(this,or(t).call(this,e))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ir(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&nr(e.prototype,t),n&&nr(e,n)}(t,[{key:"render",value:function(){return o.a.createElement("a",{href:"javascript:;",onClick:this.props.onCancel},o.a.createElement("i",{className:"material-icons"},"close"))}}]),t}();function sr(e){return(sr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function lr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ur(e){return(ur=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function cr(e,t){return(cr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function dr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var pr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==sr(t)&&"function"!=typeof t?dr(e):t}(this,ur(t).call(this,e))).state={open:e.open},n.handleToggle=n.handleToggle.bind(dr(dr(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&cr(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&lr(e.prototype,t),n&&lr(e,n)}(t,[{key:"handleToggle",value:function(){var e=!this.state.open;this.setState({open:e}),this.props.onToggle&&this.props.onToggle(e)}},{key:"render",value:function(){return o.a.createElement("label",{className:"small",onClick:this.handleToggle},this.props.title,"...",this.state.open?o.a.createElement("i",{className:"material-icons"},"expand_more"):o.a.createElement("i",{className:"material-icons"},"chevron_right"))}}]),t}();function fr(e){return(fr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function hr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function mr(e){return(mr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yr(e,t){return(yr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function vr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var gr=le({joiner:{id:"permission_join",defaultMessage:"Join ({val})"},reader:{id:"permission_read",defaultMessage:"Read ({val})"},writer:{id:"permission_write",defaultMessage:"Write ({val})"},preser:{id:"permission_pres",defaultMessage:"Get notified ({val})"},approver:{id:"permission_admin",defaultMessage:"Approve ({val})"},sharer:{id:"permission_share",defaultMessage:"Share ({val})"},deleter:{id:"permission_delete",defaultMessage:"Delete ({val})"},owner:{id:"permission_owner",defaultMessage:"Owner ({val})"}}),br=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==fr(t)&&"function"!=typeof t?vr(e):t}(this,mr(t).call(this,e))).state={mode:(e.mode||"").replace("N","")},n.handleChange=n.handleChange.bind(vr(vr(n))),n.handleSubmit=n.handleSubmit.bind(vr(vr(n))),n.handleCancel=n.handleCancel.bind(vr(vr(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yr(e,t)}(t,o.a.Component),function(e,t,n){t&&hr(e.prototype,t),n&&hr(e,n)}(t,[{key:"handleChange",value:function(e){var t=this.state.mode;-1==t.indexOf(e)?t+=e:t=t.replace(e,""),this.setState({mode:t})}},{key:"handleSubmit",value:function(){var e=(this.state.mode||"N").split("").sort().join("");e!==(this.props.mode||"N").split("").sort().join("")?this.props.onSubmit(e):this.props.onCancel()}},{key:"handleCancel",value:function(){this.props.onCancel()}},{key:"render",value:function(){for(var e=this.props.intl.formatMessage,t={J:e(gr.joiner,{val:"J"}),R:e(gr.reader,{val:"R"}),W:e(gr.writer,{val:"W"}),P:e(gr.preser,{val:"P"}),A:e(gr.approver,{val:"A"}),S:e(gr.sharer,{val:"S"}),D:e(gr.deleter,{val:"D"}),O:e(gr.owner,{val:"O"})},n=this.props.skip||"",r=this.state.mode,i=(this.props.compare||"").replace("N",""),a=[],s=0;s<"JRWPASDO".length;s++){var l="JRWPASDO".charAt(s);n.indexOf(l)>=0&&r.indexOf(l)<0||a.push(o.a.createElement("tr",{key:l},o.a.createElement("td",null,t[l]),o.a.createElement("td",{className:"checkbox"},n.indexOf(l)<0?o.a.createElement(an,{name:l,checked:r.indexOf(l)>=0,onChange:this.handleChange}):o.a.createElement(an,{name:l,checked:r.indexOf(l)>=0})),this.props.compare?o.a.createElement("td",{className:"checkbox"},o.a.createElement(an,{name:l,checked:i.indexOf(l)>=0})):null))}return o.a.createElement("div",{className:"panel-form-column"},this.props.userTitle?o.a.createElement("ul",{className:"contact-box"},o.a.createElement(gn,{item:this.props.item,title:this.props.userTitle,avatar:Bt(this.props.userAvatar?this.props.userAvatar:null)})):null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"title_permissions",defaultMessage:"Permissions"})),o.a.createElement("table",{className:"permission-editor"},this.props.compare?o.a.createElement("thead",null,o.a.createElement("tr",null,o.a.createElement("th",null),o.a.createElement("th",null,this.props.modeTitle),o.a.createElement("th",null,this.props.compareTitle))):null,o.a.createElement("tbody",null,a)),o.a.createElement("br",null),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:"blue",onClick:this.handleSubmit},o.a.createElement(je,{id:"button_ok"})),o.a.createElement("button",{className:"white",onClick:this.handleCancel},o.a.createElement(je,{id:"button_cancel"}))))}}]),t}());function _r(e){var t=document.getElementById("shortcut-icon");if(t){var n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("link");r.type="image/png",r.id="shortcut-icon",r.rel="shortcut icon",r.href="img/logo32x32"+(e>0?"a":"")+".png",n.removeChild(t),n.appendChild(r)}document.title=(e>0?"("+e+") ":"")+"Tinode"}function wr(e){return(wr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Er(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Sr(e){return(Sr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Tr(e,t){return(Tr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function kr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Cr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==wr(t)&&"function"!=typeof t?kr(e):t}(this,Sr(t).call(this,e))).state={tags:n.props.tags,tagInput:"",activated:n.props.activated},n.handleShowTagManager=n.handleShowTagManager.bind(kr(kr(n))),n.handleTagInput=n.handleTagInput.bind(kr(kr(n))),n.handleAddTag=n.handleAddTag.bind(kr(kr(n))),n.handleRemoveTag=n.handleRemoveTag.bind(kr(kr(n))),n.handleSubmit=n.handleSubmit.bind(kr(kr(n))),n.handleCancel=n.handleCancel.bind(kr(kr(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Tr(e,t)}(t,o.a.Component),function(e,t,n){t&&Er(e.prototype,t),n&&Er(e,n)}(t,[{key:"handleShowTagManager",value:function(){this.setState({activated:!0})}},{key:"handleTagInput",value:function(e){if(this.setState({tagInput:e}),e.length>0){var t=e[e.length-1];if(","==t||" "==t||";"==t){var n=e.substr(0,e.length-1).trim();n.length>=MIN_TAG_LENGTH&&this.handleAddTag(n)}}}},{key:"handleAddTag",value:function(e){if((e=e.trim()).length>0){var t=this.state.tags.slice(0);t.push(e),this.setState({tags:t,tagInput:""}),this.props.onTagsChanged&&this.props.onTagsChanged(t)}}},{key:"handleRemoveTag",value:function(e,t){var n=this.state.tags.slice(0);n.splice(t,1),this.setState({tags:n}),this.props.onTagsChanged&&this.props.onTagsChanged(n)}},{key:"handleSubmit",value:function(){var e=this.state.tags.slice(0),t=this.state.tagInput.trim();t.length>0&&(e.push(t),this.props.onTagsChanged&&this.props.onTagsChanged(e)),this.props.onSubmit(e),this.setState({activated:!1,tagInput:"",tags:this.props.tags})}},{key:"handleCancel",value:function(){this.setState({activated:!1,tagInput:"",tags:this.props.tags}),this.props.onCancel&&this.props.onCancel()}},{key:"render",value:function(){var e=this,t=[];return this.state.activated?this.state.tags.map(function(e){t.push({user:e})}):(this.state.tags.map(function(e){t.push(o.a.createElement("span",{className:"badge",key:t.length},e))}),0==t.length&&(t=o.a.createElement("i",null,o.a.createElement(je,{id:"tags_not_found",defaultMessage:"No tags defined. Add some."})))),o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},this.props.title)),this.state.activated?o.a.createElement("div",null,o.a.createElement(je,{id:"tags_editor_no_tags",defaultMessage:"Add some tags"},function(n){return o.a.createElement(Rn,{chips:t,avatarDisabled:!0,prompt:n,onEnter:e.handleAddTag,onFocusLost:e.handleAddTag,onCancel:e.handleCancel,onChipRemoved:e.handleRemoveTag,filterFunc:e.handleTagInput})}),this.props.onSubmit||this.props.onCancel?o.a.createElement("div",{id:"tag-manager-buttons",className:"panel-form-row"},o.a.createElement("button",{className:"blue",onClick:this.handleSubmit},o.a.createElement(je,{id:"button_ok",defautMessage:"OK",description:"Confirmation button [OK]"})),o.a.createElement("button",{className:"white",onClick:this.handleCancel},o.a.createElement(je,{id:"button_cancel",defautMessage:"Cancel",description:"Rejection button [Cancel]"}))):null):o.a.createElement("div",null,o.a.createElement("a",{href:"javascript:;",className:"flat-button",onClick:this.handleShowTagManager},o.a.createElement("i",{className:"material-icons"},"edit")," ",o.a.createElement(je,{id:"title_manage_tags",defaultMessage:"Manage tags"})),o.a.createElement("span",null,t)))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return function(e,t){if(e.length!=t.length)return!1;e.sort(),t.sort();for(var n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0}(e.tags,t.tags)||t.activated?null:{tags:e.tags}}}]),t}();function Or(e){return(Or="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Pr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Nr(e){return(Nr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function xr(e,t){return(xr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Mr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Ar=le({requested:{id:"requested_permissions",defaultMessage:"Requested"},granted:{id:"granted_permissions",defaultMessage:"Granted"},edit_permissions:{id:"menu_item_edit_permissions",defaultMessage:"Edit permissions"},other_user:{id:"label_other_user",defaultMessage:"Other"}}),Dr=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Or(t)&&"function"!=typeof t?Mr(e):t}(this,Nr(t).call(this,e))).state={topic:null,owner:!1,admin:!1,sharer:!1,muted:!1,address:null,groupTopic:void 0,fullName:void 0,avatar:null,private:null,selectedContact:null,access:null,modeGiven:null,modeWant:null,modeGiven2:null,modeWant2:null,auth:null,anon:null,contactList:[],tags:[],showMemberPanel:!1,showPermissionEditorFor:void 0,moreInfoExpanded:!1,previousMetaDesc:void 0,previousSubsUpdated:void 0,previousTagsUpdated:void 0},n.resetSubs=n.resetSubs.bind(Mr(Mr(n))),n.resetDesc=n.resetDesc.bind(Mr(Mr(n))),n.onMetaDesc=n.onMetaDesc.bind(Mr(Mr(n))),n.onSubsUpdated=n.onSubsUpdated.bind(Mr(Mr(n))),n.onTagsUpdated=n.onTagsUpdated.bind(Mr(Mr(n))),n.handleFullNameUpdate=n.handleFullNameUpdate.bind(Mr(Mr(n))),n.handlePrivateUpdate=n.handlePrivateUpdate.bind(Mr(Mr(n))),n.handleImageChanged=n.handleImageChanged.bind(Mr(Mr(n))),n.handleMuted=n.handleMuted.bind(Mr(Mr(n))),n.handlePermissionsChanged=n.handlePermissionsChanged.bind(Mr(Mr(n))),n.handleLaunchPermissionsEditor=n.handleLaunchPermissionsEditor.bind(Mr(Mr(n))),n.handleHidePermissionsEditor=n.handleHidePermissionsEditor.bind(Mr(Mr(n))),n.handleShowAddMembers=n.handleShowAddMembers.bind(Mr(Mr(n))),n.handleHideAddMembers=n.handleHideAddMembers.bind(Mr(Mr(n))),n.handleMemberUpdateRequest=n.handleMemberUpdateRequest.bind(Mr(Mr(n))),n.handleLeave=n.handleLeave.bind(Mr(Mr(n))),n.handleMemberSelected=n.handleMemberSelected.bind(Mr(Mr(n))),n.handleMoreInfo=n.handleMoreInfo.bind(Mr(Mr(n))),n.handleTagsUpdated=n.handleTagsUpdated.bind(Mr(Mr(n))),n.handleContextMenu=n.handleContextMenu.bind(Mr(Mr(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&xr(e,t)}(t,o.a.Component),function(e,t,n){t&&Pr(e.prototype,t),n&&Pr(e,n)}(t,[{key:"UNSAFE_componentWillReceiveProps",value:function(e){var t=this.props.tinode.getTopic(e.topic);t&&(this.onMetaDesc!=t.onMetaDesc&&(this.previousMetaDesc=t.onMetaDesc,t.onMetaDesc=this.onMetaDesc,this.previousSubsUpdated=t.onSubsUpdated,t.onSubsUpdated=this.onSubsUpdated,"grp"==t.getType()?(this.previousTagsUpdated=t.onTagsUpdated,t.onTagsUpdated=this.onTagsUpdated):this.previousTagsUpdated=void 0),this.state.topic!=e.topic&&(this.setState({topic:e.topic}),this.resetDesc(t,e),this.resetSubs(t,e)))}},{key:"componentWillUnmount",value:function(){var e=this.props.tinode.getTopic(this.props.topic);e&&(this.setState({topic:null}),e.onMetaDesc=this.previousMetaDesc,e.onSubsUpdated=this.previousSubsUpdated,e.onTagsUpdated=this.previousTagsUpdated)}},{key:"resetSubs",value:function(e,t){var n={contactList:[]};if("p2p"==e.getType()){var r=e.subscriber(t.topic);r&&(n.modeGiven2=r.acs.getGiven(),n.modeWant2=r.acs.getWant())}else e.subscribers(function(e){n.contactList.push(e)},this);this.setState(n)}},{key:"resetDesc",value:function(e,t){var n=e.getDefaultAccess()||{},r=e.getAccessMode();this.setState({owner:r&&r.isOwner(),admin:r&&r.isAdmin(),sharer:r&&(r.isAdmin()||r.isSharer()),muted:r&&r.isMuted(),fullName:e.public?e.public.fn:void 0,avatar:Bt(e.public?e.public.photo:null),private:e.private?e.private.comment:null,address:e.name,groupTopic:"grp"==e.getType(),showMemberPanel:!1,access:r?r.getMode():void 0,modeGiven:r?r.getGiven():void 0,modeWant:r?r.getWant():void 0,auth:n.auth,anon:n.anon}),"grp"==e.getType()&&r&&r.isOwner()&&e.getMeta(e.startMetaQuery().withTags().build())}},{key:"onMetaDesc",value:function(e){var t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetDesc(t,this.props),this.previousMetaDesc&&this.previousMetaDesc!=this.onMetaDesc&&this.previousMetaDesc(e))}},{key:"onSubsUpdated",value:function(){var e=this.props.tinode.getTopic(this.props.topic);e&&(this.resetSubs(e,this.props),this.previousSubsUpdated&&this.previousSubsUpdated!=this.onSubsUpdated&&this.previousSubsUpdated())}},{key:"onTagsUpdated",value:function(e){this.setState({tags:e}),this.previousTagsUpdated&&this.previousTagsUpdated!=this.onTagsUpdated&&this.previousTagsUpdated()}},{key:"handleFullNameUpdate",value:function(e){this.state.fullName!==e&&(this.setState({fullName:e}),this.props.onTopicDescUpdate(this.props.topic,vcard(e,this.state.avatar),null))}},{key:"handlePrivateUpdate",value:function(e){this.state.priv!==e&&(this.setState({private:e}),this.props.onTopicDescUpdate(this.props.topic,null,e))}},{key:"handleImageChanged",value:function(e){this.setState({avatar:e}),this.props.onTopicDescUpdate(this.props.topic,vcard(this.state.fullName,e),null)}},{key:"handleMuted",value:function(e,t){this.setState({muted:t}),this.props.onChangePermissions(this.props.topic,t?"-P":"+P")}},{key:"handlePermissionsChanged",value:function(e){switch(this.state.showPermissionEditorFor){case"auth":this.props.onTopicDescUpdate(this.props.topic,null,null,{auth:e});break;case"anon":this.props.onTopicDescUpdate(this.props.topic,null,null,{anon:e});break;case"mode":case"want":this.props.onChangePermissions(this.props.topic,e);break;case"given":this.props.onChangePermissions(this.props.topic,e,this.props.topic);break;case"user":this.props.onChangePermissions(this.props.topic,e,this.state.userPermissionsEdited)}this.setState({showPermissionEditorFor:void 0})}},{key:"handleLaunchPermissionsEditor",value:function(e,t){var n,r,o,i,a,s,l,u=this.props.intl.formatMessage;switch(e){case"mode":n=this.state.access;break;case"want":n=this.state.modeWant,r=this.state.modeGiven,o=this.state.groupTopic?"O":"ASDO",i=u(Ar.requested),a=u(Ar.granted);break;case"given":n=this.state.modeGiven2,r=this.state.modeWant2,o=this.state.groupTopic?this.state.owner?"":"O":"ASDO",i=u(Ar.granted),a=u(Ar.requested);break;case"auth":n=this.state.auth,o="O";break;case"anon":n=this.state.anon,o="O";break;case"user":var c=this.props.tinode.getTopic(this.props.topic);if(!c)return;var d=c.subscriber(t);if(!d||!d.acs)return;n=d.acs.getGiven(),r=d.acs.getWant(),o=this.state.owner?"":"O",i=u(Ar.granted),a=u(Ar.requested),d.public&&(s=d.public.fn,l=d.public.photo);break;default:console.log("Unknown permission editing mode '"+e+"'")}this.setState({showPermissionEditorFor:e,userPermissionsEdited:t,userPermissionsTitle:s,userPermissionsAvatar:l,editedPermissions:n,immutablePermissions:r,editedPermissionsTitle:i,immutablePermissionsTitle:a,editedPermissionsSkipped:o})}},{key:"handleHidePermissionsEditor",value:function(){this.setState({showPermissionEditorFor:void 0})}},{key:"handleShowAddMembers",value:function(){this.props.onInitFind(),this.setState({showMemberPanel:!0})}},{key:"handleHideAddMembers",value:function(){this.setState({showMemberPanel:!1})}},{key:"handleMemberUpdateRequest",value:function(e,t,n){this.props.onMemberUpdateRequest(this.props.topic,t,n),this.setState({showMemberPanel:!1})}},{key:"handleLeave",value:function(){this.props.onLeaveTopic(this.props.topic)}},{key:"handleMemberSelected",value:function(e){this.setState({selectedContact:e})}},{key:"handleMoreInfo",value:function(e){this.setState({moreInfoExpanded:e})}},{key:"handleTagsUpdated",value:function(e){arrayEqual(this.state.tags.slice(0),e.slice(0))||this.props.onTopicTagsUpdate(this.props.topic,e)}},{key:"handleContextMenu",value:function(e){var t=this.props.intl.formatMessage,n=this,r=this.props.tinode.getTopic(this.props.topic);if(r){var o=r.subscriber(e.topicName);if(o&&o.acs){var i=[{title:t(Ar.edit_permissions),handler:function(){n.handleLaunchPermissionsEditor("user",e.topicName)}},"member_delete",o.acs.isMuted()?"member_unmute":"member_mute",o.acs.isJoiner()?"member_block":"member_unblock"];this.props.showContextMenu({topicName:this.props.topic,x:e.x,y:e.y,user:e.topicName},i)}}}},{key:"render",value:function(){var e=this,t=this.props.intl.formatMessage;return o.a.createElement("div",{id:"info-view"},o.a.createElement("div",{className:"caption-panel",id:"info-caption-panel"},o.a.createElement("div",{className:"panel-title",id:"info-title"},o.a.createElement(je,{id:"title_info",defaultMessage:"Info"})),o.a.createElement("div",null,o.a.createElement(ar,{onCancel:this.props.onCancel}))),this.props.displayMobile?o.a.createElement(ErrorPanel,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,this.state.showMemberPanel?o.a.createElement(qn,{members:this.state.contactList,requiredMember:this.props.myUserId,myUserId:this.props.myUserId,contacts:this.props.searchableContacts,onCancel:this.handleHideAddMembers,onSubmit:this.handleMemberUpdateRequest}):this.state.showPermissionEditorFor?o.a.createElement(br,{mode:this.state.editedPermissions,compare:this.state.immutablePermissions,skip:this.state.editedPermissionsSkipped,modeTitle:this.state.editedPermissionsTitle,compareTitle:this.state.immutablePermissionsTitle,userTitle:this.state.userPermissionsTitle,item:this.state.userPermissionsEdited,userAvatar:this.state.userPermissionsAvatar,onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):o.a.createElement("div",{id:"info-view-content",className:"scrollable-panel"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_topic_name",defaultMessage:"Name"}))),o.a.createElement("div",null,o.a.createElement(er,{placeholder:this.state.groupTopic?"Group name":o.a.createElement("i",null,"Unknown"),readOnly:!this.state.owner,value:this.state.fullName,onFinished:this.handleFullNameUpdate})),o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_private",defaultMessage:"Private comment"}))),o.a.createElement("div",null,o.a.createElement(je,{id:"private_editing_placeholder",defaultMessage:"Visible to you only"},function(t){return o.a.createElement(er,{placeholder:t,value:e.state.private,onFinished:e.handlePrivateUpdate})}))),o.a.createElement(Zt,{avatar:this.state.avatar,readOnly:!this.state.owner,uid:this.props.topic,title:this.state.fullName,onImageChanged:this.handleImageChanged,onError:this.props.onError})),o.a.createElement("div",{className:"hr"}),o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",null,o.a.createElement(je,{id:"label_muting_topic",defaultMessage:"Muted:"})),o.a.createElement(an,{name:"P",checked:this.state.muted,onChange:this.handleMuted})),o.a.createElement(je,{id:"action_more",defaultMessage:"More"},function(t){return o.a.createElement(pr,{title:t,open:e.state.moreInfoExpanded,onToggle:e.handleMoreInfo})}),this.state.moreInfoExpanded?o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",null,o.a.createElement(je,{id:"label_user_id"})),o.a.createElement("tt",null,this.state.address)),this.state.groupTopic?o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",null,o.a.createElement(je,{id:"label_your_permissions",defaultMessage:"Your permissions:"})),o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)):o.a.createElement("div",null,o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_permissions",defaultMessage:"Permissions:"}))),o.a.createElement("div",{className:"quoted"},o.a.createElement("div",null,o.a.createElement(je,{id:"label_you",defaultMessage:"You:"})," ",o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"want")},this.state.access)),o.a.createElement("div",null,this.state.fullName?this.state.fullName:t(Ar.other_user),": ",o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"given")},this.state.modeGiven2)))),this.state.sharer&&(this.state.auth||this.state.anon)?o.a.createElement("div",null,o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_default_access",defaultMessage:"Default access mode:"}))),o.a.createElement("div",{className:"quoted"},o.a.createElement("div",null,"Auth: ",this.state.admin?o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth):o.a.createElement("tt",null,this.state.auth)),o.a.createElement("div",null,"Anon: ",this.state.admin?o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon):o.a.createElement("tt",null,this.state.anon)))):null):null),o.a.createElement("div",{className:"hr"}),this.state.owner?o.a.createElement(je,{id:"title_tag_manager"},function(t){return o.a.createElement(Cr,{title:t,tags:e.state.tags,activated:!1,onSubmit:e.handleTagsUpdated})}):null,this.state.owner?o.a.createElement("div",{className:"hr"}):null,this.state.groupTopic?o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_group_members",defaultMessage:"Group members:"}))),o.a.createElement("div",{className:"panel-form-row"},this.state.sharer?o.a.createElement("a",{href:"javascript:;",className:"flat-button",onClick:this.handleShowAddMembers},o.a.createElement("i",{className:"material-icons"},"person_add")," ",o.a.createElement(je,{id:"button_add_members",defaultMessage:"Add members"})):null,this.state.owner?null:o.a.createElement("a",{href:"javascript:;",className:"red flat-button",onClick:this.handleLeave},o.a.createElement("i",{className:"material-icons"},"exit_to_app")," ",o.a.createElement(je,{id:"button_leave",defaultMessage:"Leave"}))),o.a.createElement(je,{id:"group_has_no_members",defaultMessage:"No members"},function(t){return o.a.createElement(Tn,{contacts:e.state.contactList,myUserId:e.props.myUserId,emptyListMessage:t,topicSelected:e.state.selectedContact,showOnline:!1,showUnread:!1,showMode:!0,noScroll:!0,onTopicSelected:e.handleMemberSelected,showContextMenu:!!e.state.admin&&e.handleContextMenu})})):o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("a",{href:"javascript:;",className:"red flat-button",onClick:this.handleLeave},o.a.createElement("i",{className:"material-icons"},"exit_to_app")," ",o.a.createElement(je,{id:"action_leave_chat",defaultMessage:"Leave"})))))}}]),t}());function jr(e){return(jr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ir(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Rr(e,t){return!t||"object"!==jr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Ur(e){return(Ur=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fr(e,t){return(Fr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Lr=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Rr(this,Ur(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fr(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Ir(e.prototype,t),n&&Ir(e,n)}(t,[{key:"render",value:function(){return o.a.createElement("div",{className:"uploader"},o.a.createElement("div",null,o.a.createElement("span",{style:{width:100*this.props.progress+"%"}})),this.props.progress<.999?o.a.createElement("a",{href:"javascript:;",onClick:this.props.onCancel},o.a.createElement("i",{className:"material-icons"},"close")," cancel"):o.a.createElement("span",null,"finishing..."))}}]),t}();function Br(e){return(Br="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Wr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function qr(e){return(qr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Vr(e,t){return(Vr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Kr(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Hr=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Br(t)&&"function"!=typeof t?Kr(e):t}(this,qr(t).call(this,e))).state={downloader:null,progress:0},n.downloadFile=n.downloadFile.bind(Kr(Kr(n))),n.handleCancel=n.handleCancel.bind(Kr(Kr(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Vr(e,t)}(t,o.a.Component),function(e,t,n){t&&Wr(e.prototype,t),n&&Wr(e,n)}(t,[{key:"downloadFile",value:function(e,t,n){var r=this,o=this.props.tinode.getLargeFileHelper();this.setState({downloader:o}),o.download(e,t,n,function(e){r.setState({progress:e/r.props.size})}).then(function(){r.setState({downloader:null,progress:0})}).catch(function(e){e&&r.props.onError("Error downloading file: "+e.message,"err"),r.setState({downloader:null,progress:0})})}},{key:"handleCancel",value:function(){this.props.uploader?this.props.onCancelUpload():this.state.downloader&&this.state.downloader.cancel()}},{key:"render",value:function(){var e=this,t=this.props.filename||"file_attachment";t.length>36&&(t=t.substr(0,16)+"..."+t.substr(-16));var n,r,i=this.props.size>0?o.a.createElement("span",{className:"small gray"},"(",bytesToHumanSize(this.props.size),")"):null;return this.props.uploader||this.state.downloader||/^(?:(?:[a-z]+:)?\/\/)/i.test(this.props.downloadUrl)?(n=this.props.downloadUrl,r=null):(n="javascript:;",r=function(t){e.downloadFile(e.props.downloadUrl,e.props.filename,e.props.mimetype)}),o.a.createElement("div",{className:"attachment"},o.a.createElement("div",null,o.a.createElement("i",{className:"material-icons big gray"},"insert_drive_file")),o.a.createElement("div",{className:"flex-column"},o.a.createElement("div",null,t," ",i),this.props.uploader||this.state.downloader?o.a.createElement(Lr,{progress:this.props.uploader?this.props.progress:this.state.progress,onCancel:this.handleCancel}):o.a.createElement("div",null,o.a.createElement("a",{href:n,download:this.props.filename,onClick:r},o.a.createElement("i",{className:"material-icons"},"file_download")," save"))))}}]),t}();function zr(e){return(zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Gr(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function $r(e,t){return!t||"object"!==zr(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Yr(e){return(Yr=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qr(e,t){return(Qr=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Jr=le({sending:{id:"message_sending",defaultMessage:"sending..."},failed:{id:"message_sending_failed",defaultMessage:"failed"}}),Xr=se(function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),$r(this,Yr(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qr(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Gr(e.prototype,t),n&&Gr(e,n)}(t,[{key:"render",value:function(){var e,t=this.props.intl.formatMessage;e=this.props.received<=vt.a.MESSAGE_STATUS_SENDING?t(Jr.sending):this.props.received==vt.a.MESSAGE_STATUS_FAILED?t(Jr.failed):xt(this.props.timestamp);var n=null;return this.props.received<=vt.a.MESSAGE_STATUS_SENDING?n=o.a.createElement("i",{className:"material-icons small"},"access_time"):this.props.received==vt.a.MESSAGE_STATUS_FAILED?n=o.a.createElement("i",{className:"material-icons small red"},"error_outline"):this.props.received==vt.a.MESSAGE_STATUS_SENT?n=o.a.createElement("i",{className:"material-icons small"},"done"):this.props.received==vt.a.MESSAGE_STATUS_RECEIVED?n=o.a.createElement("i",{className:"material-icons small"},"done_all"):this.props.received==vt.a.MESSAGE_STATUS_READ&&(n=o.a.createElement("i",{className:"material-icons small blue"},"done_all")),o.a.createElement("span",{className:"timestamp"},e," ",n)}}]),t}());function Zr(e){return(Zr="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function eo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function to(e){return(to=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function no(e,t){return(no=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ro(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var oo=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Zr(t)&&"function"!=typeof t?ro(e):t}(this,to(t).call(this,e))).state={progress:0},e.uploader&&(e.uploader.onProgress=n.handleProgress.bind(ro(ro(n)))),n.handlePreviewImage=n.handlePreviewImage.bind(ro(ro(n))),n.handleContextClick=n.handleContextClick.bind(ro(ro(n))),n.handleCancelUpload=n.handleCancelUpload.bind(ro(ro(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&no(e,t)}(t,o.a.Component),function(e,t,n){t&&eo(e.prototype,t),n&&eo(e,n)}(t,[{key:"handlePreviewImage",value:function(e){e.preventDefault(),this.props.onImagePreview({url:e.target.src,filename:e.target.title,width:e.target.dataset.width,height:e.target.dataset.height,size:e.target.dataset.size,type:e.target.dataset.mime})}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({seq:this.props.seq,y:e.pageY,x:e.pageX})}},{key:"handleProgress",value:function(e){this.setState({progress:e})}},{key:"handleCancelUpload",value:function(){this.props.uploader.cancel()}},{key:"render",value:function(){var e=0,t=this.props.sequence+" "+(this.props.response?"left":"right"),n="single"==this.props.sequence||"last"==this.props.sequence?"bubble tip":"bubble",r=this.props.userAvatar||!0,i=this.props.userFrom&&this.props.response&&("single"==this.props.sequence||"last"==this.props.sequence),a=this.props.content,s=[];return this.props.mimeType==yt.Drafty.getContentType()?(yt.Drafty.attachments(a,function(e,t){s.push(o.a.createElement(Hr,{tinode:this.props.tinode,downloadUrl:yt.Drafty.getDownloadUrl(e),filename:e.name,uploader:yt.Drafty.isUploading(e),mimetype:e.mime,size:yt.Drafty.getEntitySize(e),progress:this.state.progress,onCancelUpload:this.handleCancelUpload,onError:this.props.onError,key:t}))},this),a=o.a.createElement("span",null,yt.Drafty.format(a,function(t,n,r){e+=1;var i=yt.Drafty.tagName(t);if(i){var a=yt.Drafty.attrValue(t,n)||{};if(a.key=e,"IM"==t){var s=Wt(n.width,n.height,Math.min(this.props.viewportWidth-52,468),312,!1);a.className="inline-image",a.style=s?{width:s.dstWidth+"px",height:s.dstHeight+"px"}:null,a.onClick=this.handlePreviewImage}return o.a.createElement(i,a,r)}return r},this))):"string"!=typeof a&&(a=o.a.createElement("span",null,o.a.createElement("i",{className:"material-icons"},"error_outline")," ",o.a.createElement("i",null,o.a.createElement(je,{id:"invalid_content",defaultMessage:"invalid content"})))),o.a.createElement("li",{className:t},this.props.userFrom&&this.props.response?o.a.createElement("div",{className:"avatar-box"},i?o.a.createElement(Ut,{topic:this.props.userFrom,title:this.props.userName,avatar:r}):null):null,o.a.createElement("div",null,o.a.createElement("div",{className:n},o.a.createElement("div",{className:"message-content"},a,s,o.a.createElement(Xr,{timestamp:this.props.timestamp,received:this.props.received})),o.a.createElement("span",{className:"menuTrigger"},o.a.createElement("a",{href:"javascript:;",onClick:this.handleContextClick},o.a.createElement("i",{className:"material-icons"},"expand_more")))),i?o.a.createElement("div",{className:"author"},this.props.userName):null))}}]),t}();function io(e){return(io="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ao(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function so(e){return(so=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function lo(e,t){return(lo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function uo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var co=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==io(t)&&"function"!=typeof t?uo(e):t}(this,so(t).call(this,e))).state={show:!1},n.hide=n.hide.bind(uo(uo(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&lo(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ao(e.prototype,t),n&&ao(e,n)}(t,[{key:"hide",value:function(){this.setState({show:!1}),this.props.onClearError&&this.props.onClearError()}},{key:"render",value:function(){var e="err"==this.props.level?"error":"warning";return o.a.createElement("div",{className:this.state.show?"err"==this.props.level?"alert-box error":"alert-box warning":"alert-box"},o.a.createElement("div",{className:"icon"},o.a.createElement("i",{className:"material-icons"},e)),this.props.text,o.a.createElement("div",{className:"cancel"},o.a.createElement(ar,{onCancel:this.hide})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return{show:!!e.level}}}]),t}();function po(e){return(po="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function fo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ho(e,t){return!t||"object"!==po(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function mo(e){return(mo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function yo(e,t){return(yo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var vo=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ho(this,mo(t).call(this,e))).state={onlineSubs:e.subscribers||[]},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&yo(e,t)}(t,o.a.Component),function(e,t,n){t&&fo(e.prototype,t),n&&fo(e,n)}(t,[{key:"render",value:function(){var e=[];return this.state.onlineSubs.map(function(t){e.push(o.a.createElement("div",{className:"avatar-box",key:t.user},o.a.createElement(Ut,{topic:t.user,avatar:Bt(t.public?t.public.photo:null)||!0,title:t.public?t.public.fn:null})))}),o.a.createElement("div",{id:"topic-users"},e)}}],[{key:"getDerivedStateFromProps",value:function(e,t){return{onlineSubs:e.subscribers?e.subscribers:[]}}}]),t}();function go(e){return(go="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function bo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _o(e,t){return!t||"object"!==go(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function wo(e){return(wo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Eo(e,t){return(Eo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var So=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=_o(this,wo(t).call(this,e))).state={},n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Eo(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&bo(e.prototype,t),n&&bo(e,n)}(t,[{key:"componentDidMount",value:function(){this.setState({width:this.container.clientWidth,height:this.container.clientHeight})}},{key:"render",value:function(){if(!this.props.content)return null;var e=this,t=Wt(this.props.content.width,this.props.content.height,this.state.width,this.state.height,!1),n=t?{width:t.dstWidth+"px",height:t.dstHeight+"px"}:this.props.content.width>this.props.content.height?{width:"100%"}:{height:"100%"};n.maxWidth="100%",n.maxHeight="100%";var r=this.props.content.filename,i=this.props.content.width/13|0;return r.length>i&&(r=r.slice(0,i-2)+"..."+r.slice(2-i)),o.a.createElement("div",{id:"image-preview",onClick:this.props.onClose},o.a.createElement("div",{id:"image-preview-caption-panel"},o.a.createElement("a",{href:this.props.content.url,download:this.props.content.filename},o.a.createElement("i",{className:"material-icons"},"file_download")," ",o.a.createElement(je,{id:"download_action",defaultMessage:"download"})),o.a.createElement("a",{href:"javascript:;",onClick:this.props.onClose},o.a.createElement("i",{className:"material-icons gray"},"close"))),o.a.createElement("div",{id:"image-preview-container",ref:function(t){e.container=t}},o.a.createElement("img",{src:this.props.content.url,style:n})),o.a.createElement("div",{id:"image-preview-footer"},o.a.createElement("div",null,o.a.createElement("div",null,o.a.createElement("b",null,o.a.createElement(je,{id:"label_file_name",defaultMessage:"File name:"}))),o.a.createElement("div",null,o.a.createElement("span",{title:this.props.content.filename},r))),o.a.createElement("div",null,o.a.createElement("div",null,o.a.createElement("b",null,o.a.createElement(je,{id:"label_content_type",defaultMessage:"Content type:"}))),o.a.createElement("div",null,this.props.content.type)),o.a.createElement("div",null,o.a.createElement("div",null,o.a.createElement("b",null,o.a.createElement(je,{id:"label_size",defaultMessage:"Size:"}))),o.a.createElement("div",null,this.props.content.width," × ",this.props.content.height," px; ",Mt(this.props.content.size)))))}}]),t}();function To(e){return(To="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ko(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Co(e,t){return!t||"object"!==To(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Oo(e){return(Oo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Po(e,t){return(Po=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var No=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Co(this,Oo(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Po(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ko(e.prototype,t),n&&ko(e,n)}(t,[{key:"render",value:function(){return this.props.show?o.a.createElement("div",{className:"load-spinner-box"},o.a.createElement("div",{className:"loader-spinner"})):null}}]),t}();function xo(e){return(xo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Mo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ao(e,t){return!t||"object"!==xo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Do(e){return(Do=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function jo(e,t){return(jo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Io=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Ao(this,Do(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&jo(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Mo(e.prototype,t),n&&Mo(e,n)}(t,[{key:"render",value:function(){var e=gt+" ("+vt.a.getLibrary()+")";return o.a.createElement("div",{id:"dummy-view",className:this.props.hideSelf?"nodisplay":null},o.a.createElement("div",null,o.a.createElement("a",{href:"https://github.com/tinode/chat/"},o.a.createElement("img",{id:"logo",alt:"logo",src:"img/logo.svg"}),o.a.createElement("h2",null,"Tinode Web")),o.a.createElement("p",null,o.a.createElement(je,{id:"label_client",defaultMessage:"Client:"})," ",e),o.a.createElement("p",null,o.a.createElement(je,{id:"label_server",defaultMessage:"Server:"})," ",this.props.serverVersion,"(",this.props.serverAddress,")")))}}]),t}();function Ro(e){return(Ro="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Uo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Fo(e){return(Fo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Lo(e,t){return(Lo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Bo(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Wo=le({messaging_disabled:{id:"messaging_disabled_prompt",defaultMessage:"Messaging disabled"},type_new_message:{id:"new_message_prompt",defaultMessage:"New message"},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:"The file size {size} exceeds the {limit} limit."},cannot_initiate_upload:{id:"cannot_initiate_file_upload",defaultMessage:"Cannot initiate file upload."}}),qo=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ro(t)&&"function"!=typeof t?Bo(e):t}(this,Fo(t).call(this,e))).state={message:"",keypressTimestamp:(new Date).getTime()-_t-1},n.handlePasteEvent=n.handlePasteEvent.bind(Bo(Bo(n))),n.handleAttachImage=n.handleAttachImage.bind(Bo(Bo(n))),n.handleAttachFile=n.handleAttachFile.bind(Bo(Bo(n))),n.handleSend=n.handleSend.bind(Bo(Bo(n))),n.handleKeyPress=n.handleKeyPress.bind(Bo(Bo(n))),n.handleMessageTyping=n.handleMessageTyping.bind(Bo(Bo(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Lo(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Uo(e.prototype,t),n&&Uo(e,n)}(t,[{key:"componentDidMount",value:function(){this.pasteFile.addEventListener("paste",this.handlePasteEvent,!1)}},{key:"componentWillUnmount",value:function(){this.pasteFile.removeEventListener("paste",this.handlePasteEvent,!1)}},{key:"handlePasteEvent",value:function(e){var t=this;this.props.disabled||function(e,t,n,r){var o=(e.clipboardData||e.originalEvent.clipboardData||{}).items;for(var i in o){var a=o[i];if("file"===a.kind){var s=a.getAsFile();if(!s){console.log("Failed to get file object from pasted file item",a.kind,a.type);continue}return s.type&&"image"==s.type.split("/")[0]?s.size>wt||Ft.indexOf(s.type)<0?Vt(s,Et,Et,!1,t,r):Kt(s,t,r):Ht(s,n),!0}}return!1}(e,function(e,n,r,o,i){t.props.sendMessage(yt.Drafty.insertImage(null,0,n,e,r,o,i))},function(e,n,r){t.props.sendMessage(yt.Drafty.attachFile(null,e,n,r))},this.props.onError)&&e.preventDefault()}},{key:"handleAttachImage",value:function(e){var t=this;if(e.target.files&&e.target.files.length>0){var n=e.target.files[0];n.size>wt||Ft.indexOf(n.type)<0?Vt(n,Et,Et,!1,function(e,n,r,o,i){t.props.sendMessage(yt.Drafty.insertImage(null,0,n,e,r,o,i))},function(e){t.props.onError(e,"err")}):Kt(n,function(e,n,r,o,i){t.props.sendMessage(yt.Drafty.insertImage(null,0,n,e,r,o,i))},function(e){t.props.onError(e,"err")})}e.target.value=""}},{key:"handleAttachFile",value:function(e){var t=this,n=this.props.intl.formatMessage;if(e.target.files&&e.target.files.length>0){var r=e.target.files[0];if(r.size>1<<23)this.props.onError(n(Wo.file_attachment_too_large,{size:Mt(r.size),limit:Mt(1<<23)}),"err");else if(r.size>wt){var o=this.props.tinode.getLargeFileHelper();if(!o)return void this.props.onError(n(Wo.cannot_initiate_upload));var i=o.upload(r),a=yt.Drafty.attachFile(null,r.type,null,r.name,r.size,i);this.props.sendMessage(a,i,o)}else fileToBase64(r,function(e,n,r){t.props.sendMessage(yt.Drafty.attachFile(null,e,n,r))},this.props.onError)}e.target.value=""}},{key:"handleSend",value:function(){this.state.message.trim()&&(this.props.sendMessage(this.state.message.trim()),this.setState({message:""}))}},{key:"handleKeyPress",value:function(e){"Enter"===e.key&&(e.shiftKey||(e.preventDefault(),e.stopPropagation(),this.handleSend()))}},{key:"handleMessageTyping",value:function(e){var t={message:e.target.value},n=(new Date).getTime();if(n-this.state.keypressTimestamp>_t){var r=this.props.tinode.getTopic(this.props.topic);r.isSubscribed()&&r.noteKeyPress(),t.keypressTimestamp=n}this.setState(t)}},{key:"render",value:function(){var e=this.props.intl.formatMessage,t=this.props.disabled?e(Wo.messaging_disabled):e(Wo.type_new_message),n=this;return o.a.createElement("div",{id:"send-message-panel"},this.props.disabled?o.a.createElement("i",{className:"material-icons disabled"},"photo"):o.a.createElement("a",{href:"javascript:;",onClick:function(e){n.attachImage.click()},title:"Add image"},o.a.createElement("i",{className:"material-icons secondary"},"photo")),this.props.disabled?o.a.createElement("i",{className:"material-icons disabled"},"attach_file"):o.a.createElement("a",{href:"javascript:;",onClick:function(e){n.attachFile.click()},title:"Attach file"},o.a.createElement("i",{className:"material-icons secondary"},"attach_file")),o.a.createElement("textarea",{id:"sendMessage",placeholder:t,disabled:this.props.disabled,value:this.state.message,onChange:this.handleMessageTyping,onKeyPress:this.handleKeyPress,ref:function(e){n.pasteFile=e},autoFocus:!0}),this.props.disabled?o.a.createElement("i",{className:"material-icons disabled"},"send"):o.a.createElement("a",{href:"javascript:;",onClick:this.handleSend,title:"Send"},o.a.createElement("i",{className:"material-icons"},"send")),o.a.createElement("input",{type:"file",ref:function(e){n.attachFile=e},onChange:this.handleAttachFile,style:{display:"none"}}),o.a.createElement("input",{type:"file",ref:function(e){n.attachImage=e},accept:"image/*",onChange:this.handleAttachImage,style:{display:"none"}}))}}]),t}());function Vo(e){return(Vo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ko(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ho(e){return(Ho=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function zo(e,t){return(zo=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Go(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var $o=le({online_now:{id:"online_now",defaultMessage:"online now"},last_seen:{id:"last_seen_timestamp",defaultMessage:"Last seen"},not_found:{id:"title_not_found",defaultMessage:"Not found"}}),Yo=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Vo(t)&&"function"!=typeof t?Go(e):t}(this,Ho(t).call(this,e))).state={messages:[],onlineSubs:[],topic:"",title:"",avatar:null,scrollPosition:0,readOnly:!e.acs||!e.acs.isWriter(),writeOnly:!e.acs||!e.acs.isReader(),typingIndicator:!1,imagePreview:null},n.propsChange=n.propsChange.bind(Go(Go(n))),n.leave=n.leave.bind(Go(Go(n))),n.handleScrollReference=n.handleScrollReference.bind(Go(Go(n))),n.fetchMoreMessages=n.fetchMoreMessages.bind(Go(Go(n))),n.handleDescChange=n.handleDescChange.bind(Go(Go(n))),n.handleSubsUpdated=n.handleSubsUpdated.bind(Go(Go(n))),n.handleNewMessage=n.handleNewMessage.bind(Go(Go(n))),n.handleAllMessagesReceived=n.handleAllMessagesReceived.bind(Go(Go(n))),n.handleInfoReceipt=n.handleInfoReceipt.bind(Go(Go(n))),n.handleImagePreview=n.handleImagePreview.bind(Go(Go(n))),n.handleCloseImagePreview=n.handleCloseImagePreview.bind(Go(Go(n))),n.handleContextClick=n.handleContextClick.bind(Go(Go(n))),n.handleShowContextMenuMessage=n.handleShowContextMenuMessage.bind(Go(Go(n))),n.handleBackNavigation=n.handleBackNavigation.bind(Go(Go(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&zo(e,t)}(t,o.a.Component),function(e,t,n){t&&Ko(e.prototype,t),n&&Ko(e,n)}(t,[{key:"componentDidUpdate",value:function(e,t){!this.messagesScroller||t.title==this.state.title&&t.messages.length==this.state.messages.length||(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition)}},{key:"componentDidMount",value:function(){this.propsChange(this.props),this.messagesScroller&&this.messagesScroller.addEventListener("scroll",this.fetchMoreMessages)}},{key:"componentWillUnmount",value:function(){this.leave(this.state.topic),this.messagesScroller&&this.messagesScroller.removeEventListener("scroll",this.fetchMoreMessages)}},{key:"UNSAFE_componentWillReceiveProps",value:function(e){this.propsChange(e)}},{key:"propsChange",value:function(e){var t=this;if(e&&e.topic)if(e.connected){var n=this.props.tinode.getTopic(e.topic);if(n){var r=vt.a.isNewGroupTopicName(e.topic),o=!this.props.connected&&e.connected;if(e.topic!=this.state.topic){var i=[],a=[];n.onData=this.handleNewMessage,n.onAllMessagesReceived=this.handleAllMessagesReceived,n.onInfo=this.handleInfoReceipt,n.onMetaDesc=this.handleDescChange,n.onSubsUpdated=this.handleSubsUpdated,n.onPres=this.handleSubsUpdated,this.leave(this.state.topic),this.handleDescChange(n),n.subscribers(function(e){e.online&&e.user!=t.props.myUserId&&a.push(e)}),n.messages(function(e){e.deleted||(i=i.concat(e))}),this.setState({messages:i,onlineSubs:a,topic:e.topic,imagePreview:null,scrollPosition:0}),o=!0,this.props.readTimerHandler(null)}if(this.setState({readOnly:!e.acs||!e.acs.isWriter(),writeOnly:!e.acs||!e.acs.isReader()}),!n.isSubscribed()&&o){var s=n.startMetaQuery().withLaterDesc().withLaterSub().withLaterData(24).withLaterDel(),l=r?e.newGroupTopicParams:void 0;this.setState({fetchingMessages:!0}),n.subscribe(s.build(),l).then(function(r){t.setState({topic:r.topic}),t.props.onNewTopicCreated(e.topic,r.topic),n.queuedMessages(function(e){!e._sending&&n.isSubscribed()&&n.publishMessage(e)})}).catch(function(e){t.props.onError(e.message,"err");var n=t.props.intl.formatMessage;t.setState({title:n($o.not_found),avatar:null,readOnly:!0,writeOnly:!0,fetchingMessages:!1,messages:[],onlineSubs:[],typingIndicator:!1,imagePreview:null})})}}}else this.setState({onlineSubs:[]});else{var u=this.state.topic;this.setState({messages:[],onlineSubs:[],topic:null},this.leave(u))}}},{key:"leave",value:function(e){var t=this;if(e){var n=this.props.tinode.getTopic(e);n&&n.isSubscribed()&&n.leave(!1).catch(function(){}).finally(function(){t.setState({fetchingMessages:!1}),n.onData=void 0,n.onAllMessagesReceived=void 0,n.onInfo=void 0,n.onMetaDesc=void 0,n.onSubsUpdated=void 0,n.onPres=void 0})}}},{key:"handleScrollReference",value:function(e){e&&(e.addEventListener("scroll",this.fetchMoreMessages),this.messagesScroller=e)}},{key:"fetchMoreMessages",value:function(e){var t=this;if(e.target.scrollTop<=0){var n={scrollPosition:e.target.scrollHeight-e.target.scrollTop};this.setState(function(e,r){if(!e.fetchingMessages){var o=t.props.tinode.getTopic(t.state.topic);o&&o.isSubscribed()&&o.msgHasMoreMessages()&&(n.fetchingMessages=!0,o.getMessagesPage(24).catch(function(e){t.setState({fetchingMessages:!1}),t.props.onError(e.message,"err")}))}return n})}}},{key:"handleDescChange",value:function(e){e.public?this.setState({title:e.public.fn,avatar:Bt(e.public.photo)}):this.setState({title:"",avatar:null}),e.acs&&this.setState({readOnly:!e.acs.isWriter(),writeOnly:!e.acs.isReader()})}},{key:"handleSubsUpdated",value:function(){var e=this;if(this.state.topic){var t=[];this.props.tinode.getTopic(this.state.topic).subscribers(function(n){n.online&&n.user!=e.props.myUserId&&t.push(n)}),this.setState({onlineSubs:t})}}},{key:"handleNewMessage",value:function(e){var t=this.props.tinode.getTopic(this.state.topic),n={messages:[]};(t.messages(function(e){e.deleted||(n.messages=n.messages.concat(e))}),e&&!e.deleted)&&(t.isNewMessage(e.seq)&&(n.scrollPosition=0),t.msgStatus(e)>=vt.a.MESSAGE_STATUS_SENT&&this.props.readTimerHandler(function(){t.noteRead(e.seq)}),this.props.onData(e));this.setState(n)}},{key:"handleAllMessagesReceived",value:function(e){this.setState({fetchingMessages:!1})}},{key:"handleInfoReceipt",value:function(e){switch(e.what){case"kp":clearTimeout(this.keyPressTimer);var t=this;this.keyPressTimer=setTimeout(function(){t.setState({typingIndicator:!1})},_t+1e3),this.state.typingIndicator||this.setState({typingIndicator:!0});break;case"read":case"recv":this.forceUpdate();break;default:console.log("Other change in topic: ",e.what)}}},{key:"handleImagePreview",value:function(e){this.setState({imagePreview:e})}},{key:"handleCloseImagePreview",value:function(){this.setState({imagePreview:null})}},{key:"handleContextClick",value:function(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.state.topic,y:e.pageY,x:e.pageX})}},{key:"handleShowContextMenuMessage",value:function(e){e.topicName=this.state.topic;var t=["message_delete"],n=this.props.tinode.getTopic(e.topicName);if(n){var r=n.getAccessMode();r&&r.isDeleter()&&t.push("message_delete_hard")}this.props.showContextMenu(e,t)}},{key:"handleBackNavigation",value:function(){this.props.onHideMessagesView()}},{key:"render",value:function(){var e,t=this.props.intl.formatMessage;if(this.state.topic){for(var n=[],r=this.props.tinode.getTopic(this.state.topic),i="grp"==r.getType(),a=null,s=null,l=0;l<this.state.messages.length;l++){var u=this.state.messages[l],c=null;l+1<this.state.messages.length&&(c=this.state.messages[l+1].from);var d="single";u.from==a?d=u.from==c?"middle":"last":u.from==c&&(d="first"),a=u.from;var p=!(u.from==this.props.myUserId),f=r.msgStatus(u),h=void 0,m=void 0,y=void 0;if(i){var v=r.userDesc(u.from);v&&v.public&&(h=v.public.fn,m=Bt(v.public.photo)),y=u.from,s="chat-box group"}else s="chat-box";n.push(o.a.createElement(oo,{tinode:this.props.tinode,content:u.content,mimeType:u.head?u.head.mime:null,timestamp:u.ts,response:p,seq:u.seq,userFrom:y,userName:h,userAvatar:m,sequence:d,received:f,uploader:u._uploader,viewportWidth:this.props.viewportWidth,showContextMenu:this.handleShowContextMenuMessage,onImagePreview:this.handleImagePreview,onError:this.props.onError,key:u.seq}))}var g=null,b=this.props.tinode.getMeTopic().getContact(this.state.topic);b&&"p2p"==vt.a.topicType(b.topic)&&(b.online?g=t($o.online_now):b.seen&&(g=t($o.last_seen)+": "+xt(b.seen.when)));var _=this.state.avatar||!0,w=this.props.online?"online"+(this.state.typingIndicator?" typing":""):"offline";e=o.a.createElement("div",{id:"topic-view",className:this.props.hideSelf?"nodisplay":null},o.a.createElement("div",{id:"topic-caption-panel",className:"caption-panel"},this.props.displayMobile?o.a.createElement("a",{href:"javascript:;",id:"hide-message-view",onClick:this.handleBackNavigation},o.a.createElement("i",{className:"material-icons"},"arrow_back")):null,o.a.createElement("div",{className:"avatar-box"},o.a.createElement(Ut,{avatar:_,topic:this.state.topic,title:this.state.title}),o.a.createElement("span",{className:w})),o.a.createElement("div",{id:"topic-title-group"},o.a.createElement("div",{id:"topic-title",className:"panel-title"},this.state.title||o.a.createElement("i",null,o.a.createElement(je,{id:"unnamed_topic",defaultMessage:"Unnamed"}))),o.a.createElement("div",{id:"topic-last-seen"},g)),i?o.a.createElement(vo,{subscribers:this.state.onlineSubs}):o.a.createElement("div",{id:"topic-users"}),o.a.createElement("div",null,o.a.createElement("a",{href:"javascript:;",onClick:this.handleContextClick},o.a.createElement("i",{className:"material-icons"},"more_vert")))),this.props.displayMobile?o.a.createElement(co,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}):null,o.a.createElement(No,{show:this.state.fetchingMessages}),o.a.createElement("div",{id:"messages-container"},o.a.createElement("div",{id:"messages-panel",ref:this.handleScrollReference},o.a.createElement("ul",{id:"scroller",className:s},n)),this.state.writeOnly?o.a.createElement("div",{id:"write-only-background"},o.a.createElement("div",{id:"write-only-note"},o.a.createElement(je,{id:"messages_not_readable",defaultMessage:"no access to messages"}))):null),o.a.createElement(qo,{tinode:this.props.tinode,topic:this.props.topic,disabled:this.state.readOnly,sendMessage:this.props.sendMessage,onError:this.props.onError}),this.state.imagePreview?o.a.createElement(So,{content:this.state.imagePreview,onClose:this.handleCloseImagePreview}):null)}else e=o.a.createElement(Io,{hideSelf:this.props.hideSelf,serverVersion:this.props.serverVersion,serverAddress:this.props.serverAddress});return e}}]),t}());function Qo(e){return(Qo="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Jo(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Xo(e,t){return!t||"object"!==Qo(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function Zo(e){return(Zo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ti=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Xo(this,Zo(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ei(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Jo(e.prototype,t),n&&Jo(e,n)}(t,[{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("a",{href:"javascript:;",onClick:this.props.onNewTopic},o.a.createElement("i",{className:"material-icons"},"chat"))," ",o.a.createElement("a",{href:"javascript:;",onClick:this.props.onSettings},o.a.createElement("i",{className:"material-icons"},"settings")))}}]),t}();function ni(e){return(ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ri(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function oi(e,t){return!t||"object"!==ni(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ii(e){return(ii=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ai(e,t){return(ai=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var si=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),oi(this,ii(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ai(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ri(e.prototype,t),n&&ri(e,n)}(t,[{key:"render",value:function(){return o.a.createElement("div",null,o.a.createElement("a",{href:"javascript:;",onClick:this.props.onSignUp},o.a.createElement("i",{className:"material-icons"},"person_add"))," ",o.a.createElement("a",{href:"javascript:;",onClick:this.props.onSettings},o.a.createElement("i",{className:"material-icons"},"settings")))}}]),t}();function li(e){return(li="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ui(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ci(e,t){return!t||"object"!==li(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function di(e){return(di=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function pi(e,t){return(pi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var fi=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),ci(this,di(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&pi(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ui(e.prototype,t),n&&ui(e,n)}(t,[{key:"render",value:function(){return o.a.createElement("div",{id:"side-caption-panel",className:"caption-panel"},o.a.createElement("div",{id:"self-avatar",className:"avatar-box"},o.a.createElement(Ut,{avatar:this.props.avatar,topic:this.props.myUserId,title:this.props.title})),o.a.createElement("div",{id:"sidepanel-title",className:"panel-title"},this.props.title),"login"===this.props.state?o.a.createElement(si,{onSignUp:this.props.onSignUp,onSettings:this.props.onSettings}):"contacts"===this.props.state?o.a.createElement(ti,{onNewTopic:this.props.onNewTopic,onSettings:this.props.onSettings}):null,this.props.onCancel?o.a.createElement(ar,{onCancel:this.props.onCancel}):null)}}]),t}();function hi(e){return(hi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function mi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function yi(e,t){return!t||"object"!==hi(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function vi(e){return(vi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function gi(e,t){return(gi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var bi=le({contacts_not_found:{id:"contacts_not_found",defaultMessage:"You have no chats<br />¯\\\\_(ツ)_/¯"}}),_i=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=yi(this,vi(t).call(this,e))).state=t.getDerivedStateFromProps(e,{}),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&gi(e,t)}(t,o.a.Component),function(e,t,n){t&&mi(e.prototype,t),n&&mi(e,n)}(t,[{key:"render",value:function(){var e=this.props.intl.formatHTMLMessage;return o.a.createElement(Tn,{connected:this.props.connected,contacts:this.state.contactList,emptyListMessage:o.a.createElement("span",null,e(bi.contacts_not_found)),topicSelected:this.props.topicSelected,myUserId:this.props.myUserId,showOnline:!0,showUnread:!0,onTopicSelected:this.props.onTopicSelected,showContextMenu:this.props.showContextMenu})}}],[{key:"getDerivedStateFromProps",value:function(e,t){var n=[],r=0;return e.chatList.map(function(e){r+=e.unread>0?1:0,n.push(e)}),n.sort(function(e,t){return(t.touched||0)-(e.touched||0)}),_r(r),{contactList:n}}}]),t}());function wi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var Ei=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,n){t&&wi(e.prototype,t),n&&wi(e,n)}(e,null,[{key:"setObject",value:function(e,t){localStorage.setItem(e,JSON.stringify(t))}},{key:"getObject",value:function(e){var t=localStorage.getItem(e);return t&&JSON.parse(t)}},{key:"updateObject",value:function(e,t){var n=this.getObject(e);this.setObject(e,Object.assign(n||{},t))}},{key:"removeItem",value:function(e){localStorage.removeItem(e)}}]),e}();function Si(e){return(Si="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ti(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ki(e){return(ki=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ci(e,t){return(Ci=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Oi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Pi=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Si(t)&&"function"!=typeof t?Oi(e):t}(this,ki(t).call(this,e))).state={login:"",password:"",email:"",fn:"",imageDataUrl:null,errorCleared:!1,saveToken:Ei.getObject("keep-logged-in")},n.handleLoginChange=n.handleLoginChange.bind(Oi(Oi(n))),n.handlePasswordChange=n.handlePasswordChange.bind(Oi(Oi(n))),n.handleEmailChange=n.handleEmailChange.bind(Oi(Oi(n))),n.handleFnChange=n.handleFnChange.bind(Oi(Oi(n))),n.handleImageChanged=n.handleImageChanged.bind(Oi(Oi(n))),n.handleToggleSaveToken=n.handleToggleSaveToken.bind(Oi(Oi(n))),n.handleSubmit=n.handleSubmit.bind(Oi(Oi(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ci(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Ti(e.prototype,t),n&&Ti(e,n)}(t,[{key:"handleLoginChange",value:function(e){this.setState({login:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e})}},{key:"handleEmailChange",value:function(e){this.setState({email:e.target.value})}},{key:"handleFnChange",value:function(e){this.setState({fn:e.target.value})}},{key:"handleImageChanged",value:function(e){this.setState({imageDataUrl:e})}},{key:"handleToggleSaveToken",value:function(){Ei.setObject("keep-logged-in",!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.setState({errorCleared:!1}),this.props.onCreateAccount(this.state.login.trim(),this.state.password.trim(),function(e,t){var n=null;if((e&&e.trim()||t)&&(n={},e&&(n.fn=e.trim()),t)){var r=t.indexOf(",");n.photo={data:t.substring(r+1),type:"jpg"}}return n}(this.state.fn,this.state.imageDataUrl),{meth:"email",val:this.state.email})}},{key:"render",value:function(){var e=this,t="blue";return this.props.disabled&&(t+=" disabled"),o.a.createElement("form",{className:"panel-form-column",onSubmit:this.handleSubmit},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("div",{className:"panel-form-column"},o.a.createElement(je,{id:"login_prompt"},function(t){return o.a.createElement("input",{type:"text",placeholder:t,autoComplete:"user-name",value:e.state.login,onChange:e.handleLoginChange,required:!0,autoFocus:!0})}),o.a.createElement(je,{id:"password_prompt"},function(t){return o.a.createElement($n,{placeholder:t,autoComplete:"new-password",value:e.state.password,onFinished:e.handlePasswordChange,required:!0})})),o.a.createElement(Zt,{onImageChanged:this.handleImageChanged,onError:this.props.onError})),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(je,{id:"full_name_prompt",defaultMessage:"Full name, e.g. John Doe"},function(t){return o.a.createElement("input",{type:"text",placeholder:t,autoComplete:"name",value:e.state.fn,onChange:e.handleFnChange,required:!0})})),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(je,{id:"email_prompt",defaultMessage:"Email, e.g. jdoe@example.com"},function(t){return o.a.createElement("input",{type:"email",placeholder:t,autoComplete:"email",value:e.state.email,onChange:e.handleEmailChange,required:!0})})),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(an,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),o.a.createElement(je,{id:"stay_logged_in"},function(e){return o.a.createElement("label",{htmlFor:"save-token"}," ",e)})),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:t,type:"submit"},o.a.createElement(je,{id:"button_sign_up",defaultMessage:"Sign up"}))))}}]),t}();function Ni(e){return(Ni="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function xi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Mi(e){return(Mi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ai(e,t){return(Ai=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Di(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var ji=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var r=(n=function(e,t){return!t||"object"!==Ni(t)&&"function"!=typeof t?Di(e):t}(this,Mi(t).call(this,e))).props.tinode.getMeTopic(),o=r.getDefaultAccess(),i=n.props.tinode.getFndTopic();return n.state={fullName:r.public?r.public.fn:void 0,avatar:Bt(r.public?r.public.photo:null),auth:o?o.auth:null,anon:o?o.anon:null,tags:i.tags(),showPermissionEditorFor:void 0,previousOnTags:i.onTagsUpdated},n.tnNewTags=n.tnNewTags.bind(Di(Di(n))),n.handleFullNameUpdate=n.handleFullNameUpdate.bind(Di(Di(n))),n.handlePasswordUpdate=n.handlePasswordUpdate.bind(Di(Di(n))),n.handleImageChanged=n.handleImageChanged.bind(Di(Di(n))),n.handleCheckboxClick=n.handleCheckboxClick.bind(Di(Di(n))),n.handleLaunchPermissionsEditor=n.handleLaunchPermissionsEditor.bind(Di(Di(n))),n.handleHidePermissionsEditor=n.handleHidePermissionsEditor.bind(Di(Di(n))),n.handlePermissionsChanged=n.handlePermissionsChanged.bind(Di(Di(n))),n.handleTagsUpdated=n.handleTagsUpdated.bind(Di(Di(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ai(e,t)}(t,o.a.Component),function(e,t,n){t&&xi(e.prototype,t),n&&xi(e,n)}(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props.tinode.getFndTopic();t.onTagsUpdated=this.tnNewTags,t.isSubscribed()||t.subscribe(t.startMetaQuery().withLaterDesc().withTags().build()).catch(function(t){e.props.onError(t.message,"err")})}},{key:"componentWillUnmount",value:function(){this.props.tinode.getFndTopic().onTagsUpdated=this.state.previousOnTags}},{key:"tnNewTags",value:function(e){this.setState({tags:e})}},{key:"handleFullNameUpdate",value:function(e){this.setState({fullName:e}),this.props.onUpdateAccount(void 0,vcard(e,this.state.avatar))}},{key:"handlePasswordUpdate",value:function(e){this.setState({password:e}),this.props.onUpdateAccount(e)}},{key:"handleImageChanged",value:function(e){this.setState({avatar:e}),this.props.onUpdateAccount(void 0,vcard(this.state.fullName,e))}},{key:"handleCheckboxClick",value:function(e,t){"sound"==e?this.props.onToggleMessageSounds(t):"alert"==e&&this.props.onTogglePushNotifications(t)}},{key:"handleLaunchPermissionsEditor",value:function(e){this.setState({showPermissionEditorFor:e,editedPermissions:this.state[e]})}},{key:"handleHidePermissionsEditor",value:function(){this.setState({showPermissionEditorFor:void 0})}},{key:"handlePermissionsChanged",value:function(e){var t={};t[this.state.showPermissionEditorFor]=e,this.props.onUpdateAccount(void 0,void 0,t);var n={showPermissionEditorFor:void 0};n[this.state.showPermissionEditorFor]=e,this.setState(n)}},{key:"handleTagsUpdated",value:function(e){arrayEqual(this.state.tags.slice(0),e.slice(0))||this.props.onUpdateTags(e)}},{key:"render",value:function(){var e=this,t=[];return this.state.tags.map(function(e){t.push(o.a.createElement("span",{className:"badge",key:t.length},e))}),0==t.length&&(t=o.a.createElement("i",null,o.a.createElement(je,{id:"tags_not_found"}))),o.a.createElement(o.a.Fragment,null,this.state.showPermissionEditorFor?o.a.createElement(br,{mode:this.state.editedPermissions,skip:"O",onSubmit:this.handlePermissionsChanged,onCancel:this.handleHidePermissionsEditor}):o.a.createElement("div",{id:"edit-account",className:"scrollable-panel"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_your_name",defaultMessage:"Your name"}))),o.a.createElement("div",null,o.a.createElement(je,{id:"full_name_prompt"},function(t){return o.a.createElement(er,{placeholder:t,value:e.state.fullName,onFinished:e.handleFullNameUpdate})})),o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_password",defaultMessage:"Password"}))),o.a.createElement("div",null,o.a.createElement(je,{id:"password_unchanged_prompt",defaultMessage:"Unchanged"},function(t){return o.a.createElement(er,{placeholder:t,type:"password",onFinished:e.handlePasswordUpdate})}))),o.a.createElement(Zt,{avatar:this.state.avatar,uid:this.props.myUserId,title:this.state.fullName,onImageChanged:this.handleImageChanged,onError:this.props.onError})),o.a.createElement("div",{className:"hr"}),o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",null,o.a.createElement(je,{id:"label_user_id",defaultMessage:"Address:"})),o.a.createElement("tt",null,this.props.myUserId)),o.a.createElement("div",null,o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_default_access_mode",defaultMessage:"Default access mode:"}))),o.a.createElement("div",{className:"quoted"},o.a.createElement("div",null,"Auth: ",o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"auth")},this.state.auth)),o.a.createElement("div",null,"Anon: ",o.a.createElement("tt",{className:"clickable",onClick:this.handleLaunchPermissionsEditor.bind(this,"anon")},this.state.anon)))),o.a.createElement("div",{className:"hr"}),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{htmlFor:"message-sound"},o.a.createElement(je,{id:"label_message_sound",defaultMessage:"Message sound:"})),o.a.createElement(an,{name:"sound",id:"message-sound",checked:this.props.messageSounds,onChange:this.handleCheckboxClick})),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{htmlFor:"desktop-alerts"},this.props.desktopAlertsEnabled?o.a.createElement(je,{id:"label_push_notifications",defaultMessage:"Notification alerts:"}):o.a.createElement(je,{id:"label_push_notifications_disabled",defaultMessage:"Notification alerts (requires HTTPS):"})),o.a.createElement(an,{name:"alert",id:"desktop-alerts",checked:this.props.desktopAlerts,onChange:this.props.desktopAlertsEnabled?this.handleCheckboxClick:null})),o.a.createElement("div",{className:"hr"}),o.a.createElement(je,{id:"title_tag_manager",defaultMessage:"Tags (user discovery)"},function(t){return o.a.createElement(Cr,{title:t,activated:!1,tags:e.state.tags,onSubmit:e.handleTagsUpdated})}),o.a.createElement("div",{className:"hr"}),o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("a",{href:"javascript:;",className:"red flat-button",onClick:this.props.onLogout},o.a.createElement("i",{className:"material-icons"},"exit_to_app")," ",o.a.createElement(je,{id:"button_logout",defaultMessage:"Logout"})))))}}]),t}();function Ii(e){return(Ii="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ri(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ui(e){return(Ui=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Fi(e,t){return(Fi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Li(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Bi=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ii(t)&&"function"!=typeof t?Li(e):t}(this,Ui(t).call(this,e))).state={login:e.login,password:"",hostName:e.serverAddress,saveToken:Ei.getObject("keep-logged-in")},n.handleLoginChange=n.handleLoginChange.bind(Li(Li(n))),n.handlePasswordChange=n.handlePasswordChange.bind(Li(Li(n))),n.handleToggleSaveToken=n.handleToggleSaveToken.bind(Li(Li(n))),n.handleSubmit=n.handleSubmit.bind(Li(Li(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Fi(e,t)}(t,o.a.Component),function(e,t,n){t&&Ri(e.prototype,t),n&&Ri(e,n)}(t,[{key:"handleLoginChange",value:function(e){this.setState({login:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e.target.value})}},{key:"handleToggleSaveToken",value:function(){Ei.setObject("keep-logged-in",!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.props.onLogin(this.state.login.trim(),this.state.password.trim())}},{key:"render",value:function(){var e=this,t="blue";return this.props.disabled&&(t+=" disabled"),o.a.createElement("form",{id:"login-form",onSubmit:this.handleSubmit},o.a.createElement(je,{id:"login_prompt",defaultMessage:"Login"},function(t){return o.a.createElement("input",{type:"text",id:"inputLogin",placeholder:t,autoComplete:"username",value:e.state.login,onChange:e.handleLoginChange,required:!0,autoFocus:!0})}),o.a.createElement(je,{id:"password_prompt",defaultMessage:"Password"},function(t){return o.a.createElement($n,{type:"password",id:"inputPassword",placeholder:t,autoComplete:"current-password",value:e.state.password,onChange:e.handlePasswordChange,required:!0})}),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(an,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),o.a.createElement("label",{htmlFor:"save-token"}," ",o.a.createElement(je,{id:"stay_logged_in",defaultMessage:"Stay logged in"})),o.a.createElement("a",{href:"#reset"},o.a.createElement(je,{id:"forgot_password_link",defaultMessage:"Forgot password?"}))),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:t,type:"submit"},o.a.createElement(je,{id:"button_sign_in",defaultMessage:"Sign in"}))))}}]),t}();function Wi(e){return(Wi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function qi(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Vi(e){return(Vi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ki(e,t){return(Ki=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Hi(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var zi=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Wi(t)&&"function"!=typeof t?Hi(e):t}(this,Vi(t).call(this,e))).state={groupId:""},n.handleChange=n.handleChange.bind(Hi(Hi(n))),n.handleKeyPress=n.handleKeyPress.bind(Hi(Hi(n))),n.handleSubmit=n.handleSubmit.bind(Hi(Hi(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ki(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&qi(e.prototype,t),n&&qi(e,n)}(t,[{key:"handleChange",value:function(e){this.setState({groupId:e.target.value})}},{key:"handleKeyPress",value:function(e){"Enter"===e.key&&this.handleSubmit(e)}},{key:"handleSubmit",value:function(e){if(e.preventDefault(),this.state.groupId){var t=this.state.groupId.trim();t.length>3&&("usr"==t.substr(0,3)||"grp"==t.substr(0,3))?this.props.onSubmit(t):this.props.onError("Invalid ID","err")}}},{key:"render",value:function(){return o.a.createElement("div",{className:"panel-form"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("input",{type:"text",placeholder:"Group or User ID",value:this.state.groupId,onChange:this.handleChange,onKeyPress:this.handleKeyPress,required:!0})),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:"blue",onClick:this.handleSubmit},"Subscribe")))}}]),t}();function Gi(e){return(Gi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function $i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Yi(e){return(Yi=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Qi(e,t){return(Qi=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ji(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Xi=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Gi(t)&&"function"!=typeof t?Ji(e):t}(this,Yi(t).call(this,e))).state={fn:"",private:"",imageDataUrl:null,tags:[]},n.handleFnChange=n.handleFnChange.bind(Ji(Ji(n))),n.handlePrivateChange=n.handlePrivateChange.bind(Ji(Ji(n))),n.handleImageChanged=n.handleImageChanged.bind(Ji(Ji(n))),n.handleTagsChanged=n.handleTagsChanged.bind(Ji(Ji(n))),n.handleTagsChanged=n.handleTagsChanged.bind(Ji(Ji(n))),n.handleSubmit=n.handleSubmit.bind(Ji(Ji(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Qi(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&$i(e.prototype,t),n&&$i(e,n)}(t,[{key:"handleFnChange",value:function(e){this.setState({fn:e.target.value})}},{key:"handlePrivateChange",value:function(e){this.setState({private:e.target.value})}},{key:"handleImageChanged",value:function(e){this.setState({imageDataUrl:e})}},{key:"handleTagsChanged",value:function(e){this.setState({tags:e})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.state.fn&&this.state.fn.trim()&&this.props.onSubmit(this.state.fn.trim(),this.state.imageDataUrl,this.state.private.trim(),this.state.tags)}},{key:"render",value:function(){var e="blue";return this.props.disabled&&(e+=" disabled"),o.a.createElement("form",{className:"panel-form",onSubmit:this.handleSubmit},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("div",{className:"panel-form-column"},o.a.createElement("label",{className:"small",htmlFor:"new-topic-fn"},"Group name"),o.a.createElement("input",{type:"text",id:"new-topic-fn",placeholder:"Freeform name of the group",value:this.state.fn,onChange:this.handleFnChange,autoFocus:!0,required:!0}),o.a.createElement("br",null),o.a.createElement("label",{className:"small",htmlFor:"new-topic-priv"},"Private comment"),o.a.createElement("input",{type:"text",id:"new-topic-priv",placeholder:"Visible to you only",value:this.state.private,onChange:this.handlePrivateChange})),o.a.createElement(Zt,{onError:this.props.onError,onImageChanged:this.handleImageChanged})),o.a.createElement(Cr,{tags:this.state.tags,activated:!0,onTagsChanged:this.handleTagsChanged,title:"Optional tags (search and discovery)"}),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:e},"Create")))}}]),t}();function Zi(e){return(Zi="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ea(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ta(e){return(ta=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function na(e,t){return(na=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ra(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var oa=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Zi(t)&&"function"!=typeof t?ra(e):t}(this,ta(t).call(this,e))).state={edited:!1,search:""},n.handleSearchChange=n.handleSearchChange.bind(ra(ra(n))),n.handleSearch=n.handleSearch.bind(ra(ra(n))),n.handleClear=n.handleClear.bind(ra(ra(n))),n.handleKeyDown=n.handleKeyDown.bind(ra(ra(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&na(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ea(e.prototype,t),n&&ea(e,n)}(t,[{key:"componentWillUnmount",value:function(){this.state.edited&&(this.setState({search:"",edited:!1}),this.props.onSearchContacts(vt.a.DEL_CHAR))}},{key:"handleSearchChange",value:function(e){this.setState({search:e.target.value})}},{key:"handleSearch",value:function(e){e.preventDefault();var t=this.state.search.trim();this.setState({edited:t.length>0}),this.props.onSearchContacts(t.length>0?t:vt.a.DEL_CHAR)}},{key:"handleClear",value:function(){this.state.edited&&this.props.onSearchContacts(vt.a.DEL_CHAR),this.setState({search:"",edited:!1})}},{key:"handleKeyDown",value:function(e){"Enter"===e.key?this.handleSearch(e):"Escape"===e.key&&this.handleClear()}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"panel-form"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("i",{className:"material-icons search"},"search"),o.a.createElement(je,{id:"search_placeholder",defaultMessage:"List like email:alice@example.com, tel:17025550003..."},function(t){return o.a.createElement("input",{className:"search",type:"text",placeholder:t,value:e.state.search,onChange:e.handleSearchChange,onKeyDown:e.handleKeyDown,required:!0,autoFocus:!0})}),o.a.createElement("a",{href:"javascript:;",onClick:this.handleClear},o.a.createElement("i",{className:"material-icons"},"close"))))}}]),t}();function ia(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var aa=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return function(e,t,n){t&&ia(e.prototype,t),n&&ia(e,n)}(e,null,[{key:"parseUrlHash",value:function(e){var t=e.split("?",2),n={},r=[];return t[0]&&(r=t[0].substr(1).split("/")),t[1]&&t[1].split("&").forEach(function(e){var t=e.split("=");t[0]&&(n[decodeURIComponent(t[0])]=decodeURIComponent(t[1]))}),{path:r,params:n}}},{key:"navigateTo",value:function(e){window.location.hash=e}},{key:"composeUrlHash",value:function(e,t){var n=e.join("/"),r=[];for(var o in t)t.hasOwnProperty(o)&&r.push(o+"="+t[o]);return r.length>0&&(n+="?"+r.join("&")),n}},{key:"addUrlParam",value:function(e,t,n){var r=this.parseUrlHash(e);return r.params[t]=n,this.composeUrlHash(r.path,r.params)}},{key:"removeUrlParam",value:function(e,t){var n=this.parseUrlHash(e);return delete n.params[t],this.composeUrlHash(n.path,n.params)}},{key:"setUrlSidePanel",value:function(e,t){var n=this.parseUrlHash(e);return n.path[0]=t,this.composeUrlHash(n.path,n.params)}},{key:"setUrlTopic",value:function(e,t){var n=this.parseUrlHash(e);return n.path[1]=t,delete n.params.info,this.composeUrlHash(n.path,n.params)}}]),e}();function sa(e){return(sa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function la(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ua(e){return(ua=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ca(e,t){return(ca=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function da(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var pa=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==sa(t)&&"function"!=typeof t?da(e):t}(this,ua(t).call(this,e))).state={tabSelected:"p2p",contactList:e.searchResults},n.handleTabClick=n.handleTabClick.bind(da(da(n))),n.handleContactSelected=n.handleContactSelected.bind(da(da(n))),n.handleNewGroupSubmit=n.handleNewGroupSubmit.bind(da(da(n))),n.handleGroupByID=n.handleGroupByID.bind(da(da(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ca(e,t)}(t,o.a.Component),function(e,t,n){t&&la(e.prototype,t),n&&la(e,n)}(t,[{key:"componentDidMount",value:function(){this.props.onInitFind()}},{key:"handleTabClick",value:function(e){e.preventDefault(),aa.navigateTo(aa.addUrlParam(window.location.hash,"tab",e.currentTarget.dataset.id)),this.setState({tabSelected:e.currentTarget.dataset.id})}},{key:"handleContactSelected",value:function(e){"p2p"===this.state.tabSelected&&(aa.navigateTo(aa.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e,void 0))}},{key:"handleNewGroupSubmit",value:function(e,t,n,r){aa.navigateTo(aa.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(void 0,vcard(e,t),n,r)}},{key:"handleGroupByID",value:function(e){aa.navigateTo(aa.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e)}},{key:"render",value:function(){var e=this;return o.a.createElement("div",{className:"flex-column"},o.a.createElement("ul",{className:"tabbar"},o.a.createElement("li",{className:"p2p"===this.state.tabSelected?"active":null},o.a.createElement("a",{href:"javascript:;","data-id":"p2p",onClick:this.handleTabClick},o.a.createElement(je,{id:"tabtitle_find_user",defaultMessage:"find"}))),o.a.createElement("li",{className:"grp"===this.state.tabSelected?"active":null},o.a.createElement("a",{href:"javascript:;","data-id":"grp",onClick:this.handleTabClick},o.a.createElement(je,{id:"tabtitle_new_group",defaultMessage:"new group"}))),o.a.createElement("li",{className:"byid"===this.state.tabSelected?"active":null},o.a.createElement("a",{href:"javascript:;","data-id":"byid",onClick:this.handleTabClick},o.a.createElement(je,{id:"tabtitle_group_by_id",defaultMessage:"by id"})))),"grp"===this.state.tabSelected?o.a.createElement(Xi,{onSubmit:this.handleNewGroupSubmit}):"byid"===this.state.tabSelected?o.a.createElement(zi,{onSubmit:this.handleGroupByID,onError:this.props.onError}):o.a.createElement("div",{className:"flex-column"},o.a.createElement(oa,{type:"p2p",onSearchContacts:this.props.onSearchContacts}),o.a.createElement(je,{id:"search_for_contacts",defaultMessage:"Use search to find contacts"},function(t){return o.a.createElement(Tn,{contacts:e.state.contactList,myUserId:e.props.myUserId,emptyListMessage:t,topicSelected:e.state.selectedContact,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:e.handleContactSelected})})))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return{contactList:e.searchResults}}}]),t}();function fa(e){return(fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ha(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ma(e){return(ma=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ya(e,t){return(ya=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function va(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var ga=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==fa(t)&&"function"!=typeof t?va(e):t}(this,ma(t).call(this,e))).state={email:"",password:""},n.handleSubmit=n.handleSubmit.bind(va(va(n))),n.handleEmailChange=n.handleEmailChange.bind(va(va(n))),n.handlePasswordChange=n.handlePasswordChange.bind(va(va(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ya(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&ha(e.prototype,t),n&&ha(e,n)}(t,[{key:"componentDidMount",value:function(){var e=aa.parseUrlHash(window.location.hash);this.setState({token:e.params.token,scheme:e.params.scheme})}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.state.token?this.props.onReset(this.state.scheme,this.state.password.trim(),this.state.token):this.props.onRequest("email",this.state.email.trim())}},{key:"handleEmailChange",value:function(e){this.setState({email:e.target.value})}},{key:"handlePasswordChange",value:function(e){this.setState({password:e.target.value})}},{key:"render",value:function(){var e=this.state.token&&this.state.scheme;return o.a.createElement("form",{id:"password-reset-form",onSubmit:this.handleSubmit},e?o.a.createElement($n,{placeholder:"Enter new password",autoComplete:"new-password",value:this.state.password,required:!0,autoFocus:!0,onChange:this.handlePasswordChange}):o.a.createElement(o.a.Fragment,null,o.a.createElement("label",{htmlFor:"inputEmail"},"Send a password reset email:"),o.a.createElement("input",{type:"email",id:"inputEmail",placeholder:"Your registration email",autoComplete:"email",value:this.state.email,onChange:this.handleEmailChange,required:!0,autoFocus:!0})),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:"blue",type:"submit"},e?"Reset":"Send request")))}}]),t}();function ba(e){return(ba="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function wa(e){return(wa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ea(e,t){return(Ea=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Sa(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Ta=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==ba(t)&&"function"!=typeof t?Sa(e):t}(this,wa(t).call(this,e))).state={hostName:e.serverAddress,changed:!1},n.handleHostNameChange=n.handleHostNameChange.bind(Sa(Sa(n))),n.handleEditingFinished=n.handleEditingFinished.bind(Sa(Sa(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ea(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&_a(e.prototype,t),n&&_a(e,n)}(t,[{key:"handleHostNameChange",value:function(e){this.setState({hostName:e.target.value,changed:!0})}},{key:"handleEditingFinished",value:function(){this.state.changed&&(this.setState({changed:!1}),this.props.onServerAddressChange(this.state.hostName.trim()))}},{key:"render",value:function(){var e=[];for(var t in bt){var n=bt[t];e.push(o.a.createElement("option",{key:n,value:n}))}return o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("input",{type:"search",id:"host-name",placeholder:this.props.hostName,list:"known-hosts",className:"quoted",value:this.state.hostName,onChange:this.handleHostNameChange,onBlur:this.handleEditingFinished,required:!0}),o.a.createElement("datalist",{id:"known-hosts"},e))}}]),t}();function ka(e){return(ka="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Ca(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Oa(e){return(Oa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Pa(e,t){return(Pa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Na(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var xa=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==ka(t)&&"function"!=typeof t?Na(e):t}(this,Oa(t).call(this,e))).state={transport:e.transport||"def",serverAddress:e.serverAddress},n.handleSubmit=n.handleSubmit.bind(Na(Na(n))),n.handleTransportSelected=n.handleTransportSelected.bind(Na(Na(n))),n.handleServerAddressChange=n.handleServerAddressChange.bind(Na(Na(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Pa(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Ca(e.prototype,t),n&&Ca(e,n)}(t,[{key:"handleSubmit",value:function(e){e.preventDefault(),this.props.onUpdate({transport:this.state.transport,serverAddress:this.state.serverAddress})}},{key:"handleTransportSelected",value:function(e){this.setState({transport:e.currentTarget.value})}},{key:"handleServerAddressChange",value:function(e){this.setState({serverAddress:e}),this.props.onServerAddressChange(e)}},{key:"render",value:function(){var e={def:"default",ws:"websocket",lp:"long polling"},t=[],n=this;return["def","ws","lp"].map(function(r){var i="transport-"+r,a=e[r];t.push(o.a.createElement("li",{key:r},o.a.createElement("input",{type:"radio",id:i,name:"transport-select",value:r,checked:n.state.transport===r,onChange:n.handleTransportSelected}),o.a.createElement("label",{htmlFor:i},a)))}),o.a.createElement("form",{id:"settings-form",className:"panel-form",onSubmit:this.handleSubmit},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_server_to_use",defaultMessage:"Server to use:"}))),o.a.createElement(Ta,{serverAddress:this.state.serverAddress,onServerAddressChange:this.handleServerAddressChange}),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small"},o.a.createElement(je,{id:"label_wire_transport",defaultMessage:"Wire transport:"}))),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("ul",{className:"quoted"},t)),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{type:"submit",className:"blue"},o.a.createElement(je,{id:"button_update",defaultMessage:"Update"}))))}}]),t}();function Ma(e){return(Ma="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Aa(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Da(e){return(Da=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ja(e,t){return(ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Ia(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Ra=le({phone:{id:"phone_dative",defaultMessage:"phone"},email:{id:"email_dative",defaultMessage:"email"}}),Ua=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Ma(t)&&"function"!=typeof t?Ia(e):t}(this,Da(t).call(this,e))).state={code:e.credCode||""},n.handleChange=n.handleChange.bind(Ia(Ia(n))),n.handleKeyPress=n.handleKeyPress.bind(Ia(Ia(n))),n.handleSubmit=n.handleSubmit.bind(Ia(Ia(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ja(e,t)}(t,o.a.PureComponent),function(e,t,n){t&&Aa(e.prototype,t),n&&Aa(e,n)}(t,[{key:"handleChange",value:function(e){this.setState({code:e.target.value})}},{key:"handleKeyPress",value:function(e){"Enter"===e.key&&this.handleSubmit(e)}},{key:"handleSubmit",value:function(e){e.preventDefault(),this.state.code&&this.state.code.trim()&&this.props.onSubmit(this.props.credMethod,this.state.code.trim())}},{key:"render",value:function(){var e=this,t=this.props.intl.formatMessage,n={email:t(Ra.email),tel:t(Ra.phone)}[this.props.credMethod]||this.props.credMethod;return o.a.createElement("div",{className:"panel-form"},o.a.createElement("div",{className:"panel-form-row"},o.a.createElement("label",{className:"small",htmlFor:"enter-confirmation-code"},o.a.createElement(je,{id:"enter_confirmation_code_prompt",defaultMessage:"Enter confirmation code sent to you by {method}:",values:{method:n}}))),o.a.createElement("div",{className:"panel-form-row"},o.a.createElement(je,{id:"numeric_confirmation_code_prompt",defaultMessage:"Numbers only"},function(t){return o.a.createElement("input",{type:"text",id:"enter-confirmation-code",placeholder:t,value:e.state.code,onChange:e.handleChange,onKeyPress:e.handleKeyPress,required:!0})})),o.a.createElement("div",{className:"dialog-buttons"},o.a.createElement("button",{className:"blue",onClick:this.handleSubmit},o.a.createElement(je,{id:"button_confirm",defaultMessage:"Confirm"}))))}}]),t}());function Fa(e){return(Fa="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function La(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ba(e){return(Ba=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Wa(e,t){return(Wa=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function qa(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var Va=le({login:{id:"sidepanel_title_login",defaultMessage:"Sign In"},register:{id:"sidepanel_title_register",defaultMessage:"Create Account"},settings:{id:"sidepanel_title_settings",defaultMessage:"Settings"},edit:{id:"sidepanel_title_edit_account",defaultMessage:"Edit Account"},newtpk:{id:"sidepanel_title_newtpk",defaultMessage:"Start New Chat"},cred:{id:"sidepanel_title_cred",defaultMessage:"Confirm Credentials"},reset:{id:"sidepanel_title_reset",defaultMessage:"Reset Password"}}),Ka=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Fa(t)&&"function"!=typeof t?qa(e):t}(this,Ba(t).call(this,e))).handleLoginRequested=n.handleLoginRequested.bind(qa(qa(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Wa(e,t)}(t,o.a.Component),function(e,t,n){t&&La(e.prototype,t),n&&La(e,n)}(t,[{key:"handleLoginRequested",value:function(e,t){this.props.onLoginRequest(e,t)}},{key:"render",value:function(){var e,t,n,r=this.props.intl.formatMessage,i=this.props.state||(this.props.myUserId?"contacts":"login");return"contacts"==i?(e=this.props.title,t=!this.props.avatar||this.props.avatar):(e=r(Va[i]),t=!1),"login"!=i&&(n=this.props.onCancel),o.a.createElement("div",{id:"sidepanel",className:this.props.hideSelf?"nodisplay":null},o.a.createElement(fi,{state:i,title:e,avatar:t,myUserId:this.props.myUserId,onSignUp:this.props.onSignUp,onSettings:this.props.onSettings,onNewTopic:this.props.onNewTopic,onCancel:n}),o.a.createElement(co,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError}),"login"===i?o.a.createElement(Bi,{login:this.props.login,disabled:this.props.loginDisabled,onLogin:this.handleLoginRequested}):"register"===i?o.a.createElement(Pi,{onCreateAccount:this.props.onCreateAccount,onCancel:this.props.onCancel,onError:this.props.onError}):"settings"===i?o.a.createElement(xa,{transport:this.props.transport,serverAddress:this.props.serverAddress,onServerAddressChange:this.props.onGlobalSettings,onCancel:this.props.onCancel,onUpdate:this.props.onGlobalSettings}):"edit"===i?o.a.createElement(ji,{tinode:this.props.tinode,myUserId:this.props.myUserId,messageSounds:this.props.messageSounds,desktopAlerts:this.props.desktopAlerts,desktopAlertsEnabled:this.props.desktopAlertsEnabled,onUpdateAccount:this.props.onUpdateAccount,onUpdateTags:this.props.onUpdateAccountTags,onTogglePushNotifications:this.props.onTogglePushNotifications,onToggleMessageSounds:this.props.onToggleMessageSounds,onLogout:this.props.onLogout,onCancel:this.props.onCancel,onError:this.props.onError}):"contacts"===i?o.a.createElement(_i,{tinode:this.props.tinode,myUserId:this.props.myUserId,connected:this.props.connected,topicSelected:this.props.topicSelected,chatList:this.props.chatList,showContextMenu:this.props.showContextMenu,onTopicSelected:this.props.onTopicSelected}):"newtpk"===i?o.a.createElement(pa,{searchResults:this.props.searchResults,onInitFind:this.props.onInitFind,onSearchContacts:this.props.onSearchContacts,onCreateTopic:this.props.onCreateTopic,onError:this.props.onError}):"cred"===i?o.a.createElement(Ua,{credCode:this.props.credCode,credMethod:this.props.credMethod,onSubmit:this.props.onValidateCredentials,onCancel:this.props.onCancel,onError:this.props.onError}):"reset"===i?o.a.createElement(ga,{onRequest:this.props.onPasswordResetRequest,onReset:this.props.onResetPassword}):null)}}]),t}());function Ha(e){return(Ha="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function za(){return"object"==Ha(window.location)&&"https:"==window.location.protocol}function Ga(){return"object"==Ha(window.location)&&"localhost"==window.location.hostname}function $a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Ya(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Qa(e){return(Qa=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Ja(e,t){return(Ja=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function Xa(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Za(e){return(Za="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var es=new Audio("audio/msg.mp3");console.log("desktop alerts: is secure, is localhost, firebase, navigator, fb_init",za(),Ga(),Za(qe),"undefined"==typeof navigator?"undefined":Za(navigator),"undefined"==typeof FIREBASE_INIT?"undefined":Za(FIREBASE_INIT));var ts=se(function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=function(e,t){return!t||"object"!==Za(t)&&"function"!=typeof t?Xa(e):t}(this,Qa(t).call(this,e))).state=n.getBlankState(),n.handleResize=n.handleResize.bind(Xa(Xa(n))),n.handleHashRoute=n.handleHashRoute.bind(Xa(Xa(n))),n.handleOnline=n.handleOnline.bind(Xa(Xa(n))),n.handleAppVisibility=n.handleAppVisibility.bind(Xa(Xa(n))),n.handleReadTimer=n.handleReadTimer.bind(Xa(Xa(n))),n.handleVisibilityEvent=n.handleVisibilityEvent.bind(Xa(Xa(n))),n.handleError=n.handleError.bind(Xa(Xa(n))),n.handleLoginRequest=n.handleLoginRequest.bind(Xa(Xa(n))),n.handleConnected=n.handleConnected.bind(Xa(Xa(n))),n.doLogin=n.doLogin.bind(Xa(Xa(n))),n.handleCredentialsRequest=n.handleCredentialsRequest.bind(Xa(Xa(n))),n.handleLoginSuccessful=n.handleLoginSuccessful.bind(Xa(Xa(n))),n.handleDisconnect=n.handleDisconnect.bind(Xa(Xa(n))),n.tnMeMetaDesc=n.tnMeMetaDesc.bind(Xa(Xa(n))),n.tnMeContactUpdate=n.tnMeContactUpdate.bind(Xa(Xa(n))),n.tnMeSubsUpdated=n.tnMeSubsUpdated.bind(Xa(Xa(n))),n.resetContactList=n.resetContactList.bind(Xa(Xa(n))),n.tnData=n.tnData.bind(Xa(Xa(n))),n.tnInitFind=n.tnInitFind.bind(Xa(Xa(n))),n.tnFndSubsUpdated=n.tnFndSubsUpdated.bind(Xa(Xa(n))),n.handleSearchContacts=n.handleSearchContacts.bind(Xa(Xa(n))),n.handleTopicSelected=n.handleTopicSelected.bind(Xa(Xa(n))),n.handleHideMessagesView=n.handleHideMessagesView.bind(Xa(Xa(n))),n.handleSendMessage=n.handleSendMessage.bind(Xa(Xa(n))),n.handleNewAccount=n.handleNewAccount.bind(Xa(Xa(n))),n.handleNewAccountRequest=n.handleNewAccountRequest.bind(Xa(Xa(n))),n.handleUpdateAccountRequest=n.handleUpdateAccountRequest.bind(Xa(Xa(n))),n.handleUpdateAccountTagsRequest=n.handleUpdateAccountTagsRequest.bind(Xa(Xa(n))),n.handleSettings=n.handleSettings.bind(Xa(Xa(n))),n.handleGlobalSettings=n.handleGlobalSettings.bind(Xa(Xa(n))),n.handleToggleMessageSounds=n.handleToggleMessageSounds.bind(Xa(Xa(n))),n.initDesktopAlerts=n.initDesktopAlerts.bind(Xa(Xa(n))),n.togglePushToken=n.togglePushToken.bind(Xa(Xa(n))),n.requestPushToken=n.requestPushToken.bind(Xa(Xa(n))),n.handleSidepanelCancel=n.handleSidepanelCancel.bind(Xa(Xa(n))),n.handleNewTopic=n.handleNewTopic.bind(Xa(Xa(n))),n.handleNewTopicRequest=n.handleNewTopicRequest.bind(Xa(Xa(n))),n.handleNewTopicCreated=n.handleNewTopicCreated.bind(Xa(Xa(n))),n.handleTopicUpdateRequest=n.handleTopicUpdateRequest.bind(Xa(Xa(n))),n.handleChangePermissions=n.handleChangePermissions.bind(Xa(Xa(n))),n.handleTagsUpdated=n.handleTagsUpdated.bind(Xa(Xa(n))),n.handleLogout=n.handleLogout.bind(Xa(Xa(n))),n.handleLeaveUnsubRequest=n.handleLeaveUnsubRequest.bind(Xa(Xa(n))),n.handleDialogCancel=n.handleDialogCancel.bind(Xa(Xa(n))),n.handleShowContextMenu=n.handleShowContextMenu.bind(Xa(Xa(n))),n.defaultTopicContextMenu=n.defaultTopicContextMenu.bind(Xa(Xa(n))),n.handleHideContextMenu=n.handleHideContextMenu.bind(Xa(Xa(n))),n.handleShowInfoView=n.handleShowInfoView.bind(Xa(Xa(n))),n.handleHideInfoView=n.handleHideInfoView.bind(Xa(Xa(n))),n.handleMemberUpdateRequest=n.handleMemberUpdateRequest.bind(Xa(Xa(n))),n.handleValidateCredentialsRequest=n.handleValidateCredentialsRequest.bind(Xa(Xa(n))),n.handlePasswordResetRequest=n.handlePasswordResetRequest.bind(Xa(Xa(n))),n.handleResetPassword=n.handleResetPassword.bind(Xa(Xa(n))),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Ja(e,t)}(t,o.a.Component),function(e,t,n){t&&Ya(e.prototype,t),n&&Ya(e,n)}(t,[{key:"getBlankState",value:function(){var e,t=Ei.getObject("settings")||{};return $a(e={connected:!1,transport:t.transport||null,serverAddress:t.serverAddress||detectServerAddress(),serverVersion:"no connection",messageSounds:!t.messageSoundsOff,desktopAlerts:t.desktopAlerts,desktopAlertsEnabled:(za()||Ga())&&void 0!==qe&&"undefined"!=typeof navigator&&"undefined"!=typeof FIREBASE_INIT,firebaseToken:Ei.getObject("firebase-token"),errorText:"",errorLevel:null,sidePanelSelected:"login",sidePanelTitle:null,sidePanelAvatar:null,dialogSelected:null,contextMenuVisible:!1,login:"",password:"",myUserId:null,liveConnection:navigator.onLine,topicSelected:"",topicSelectedOnline:!1,topicSelectedAcs:null,newGroupTopicParams:null,loginDisabled:!1,displayMobile:window.innerWidth<=640,showInfoPanel:!1,mobilePanel:"sidepanel"},"contextMenuVisible",!1),$a(e,"contextMenuBounds",null),$a(e,"contextMenuClickAt",null),$a(e,"contextMenuParams",null),$a(e,"contextMenuItems",[]),$a(e,"chatList",[]),$a(e,"searchResults",[]),$a(e,"searchableContacts",[]),$a(e,"credMethod",void 0),$a(e,"credCode",void 0),e}},{key:"componentDidMount",value:function(){var e=this;if(window.addEventListener("resize",this.handleResize),window.addEventListener("online",function(t){e.handleOnline(!0)}),window.addEventListener("offline",function(t){e.handleOnline(!1)}),window.addEventListener("hashchange",this.handleHashRoute),document.addEventListener("visibilitychange",this.handleVisibilityEvent),this.setState({viewportWidth:document.documentElement.clientWidth}),this.tinode=t.tnSetup(this.state.serverAddress,this.state.transport),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.state.desktopAlertsEnabled)try{this.fbPush=qe.initializeApp(FIREBASE_INIT,gt).messaging(),this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey),navigator.serviceWorker.register("/service-worker.js").then(function(t){e.fbPush.useServiceWorker(t),e.initDesktopAlerts(),e.state.desktopAlerts&&(e.state.firebaseToken?e.tinode.setDeviceToken(e.state.firebaseToken):e.togglePushToken(!0))}).catch(function(e){console.log("Failed to register service worker:",e)})}catch(e){this.handleError("Failed to initialize push notifications","err"),console.log("Failed to initialize push notifications",e),this.setState({desktopAlertsEnabled:!1})}var n=Ei.getObject("keep-logged-in")?Ei.getObject("auth-token"):void 0,r=aa.parseUrlHash(window.location.hash);n?(n.expires=new Date(n.expires),this.tinode.setAuthToken(n),this.tinode.connect().catch(function(t){e.handleError(t.message,"err")}),delete r.params.info,delete r.params.tab,r.path[0]="",aa.navigateTo(aa.composeUrlHash(r.path,r.params))):r.params.token||aa.navigateTo(""),this.readTimer=null,this.readTimerCallback=null,this.handleHashRoute()}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("hashchange",this.handleHashRoute),document.removeEventListener("visibilitychange",this.handleVisibilityEvent)}},{key:"handleResize",value:function(){var e=document.documentElement.clientWidth<=640;this.setState({viewportWidth:document.documentElement.clientWidth}),this.state.displayMobile!=e&&this.setState({displayMobile:e})}},{key:"handleHashRoute",value:function(){var e=aa.parseUrlHash(window.location.hash);e.path&&e.path.length>0?(["register","settings","edit","cred","reset","newtpk","contacts",""].includes(e.path[0])?this.setState({sidePanelSelected:e.path[0]}):console.log("Unknown sidepanel view",e.path[0]),e.path.length>1&&e.path[1]!=this.state.topicSelected&&this.setState({topicSelected:vt.a.topicType(e.path[1])?e.path[1]:null})):this.setState({sidePanelSelected:""}),e.params.method&&this.setState({credMethod:e.params.method}),e.params.code&&this.setState({credCode:e.params.code}),this.setState({showInfoPanel:e.params.info,newTopicTabSelected:e.params.tab})}},{key:"handleOnline",value:function(e){e?this.handleError("",null):this.handleError("No connection","warn"),this.setState({liveConnection:e})}},{key:"handleAppVisibility",value:function(e,t){clearTimeout(this.readTimer),this.readTimerCallback=t,this.readTimer=e&&t?setTimeout(t,1e3):null}},{key:"handleReadTimer",value:function(e){this.handleAppVisibility(!document.hidden,e)}},{key:"handleVisibilityEvent",value:function(){this.handleAppVisibility(!document.hidden,this.readTimerCallback)}},{key:"handleError",value:function(e,t){this.setState({errorText:e,errorLevel:t})}},{key:"handleLoginRequest",value:function(e,t){var n=this;this.setState({loginDisabled:!0,login:e,password:t}),this.handleError("",null),this.tinode.isConnected()?this.doLogin(e,t,{meth:this.state.credMethod,resp:this.state.credCode}):this.tinode.connect().catch(function(e){n.setState({loginDisabled:!1}),n.handleError(e.message,"err")})}},{key:"handleConnected",value:function(){var e=this.tinode.getServerInfo();this.setState({serverVersion:e.ver+" "+(e.build?e.build:"none")+"; "}),this.doLogin(this.state.login,this.state.password,{meth:this.state.credMethod,resp:this.state.credCode})}},{key:"doLogin",value:function(e,t,n){var r=this;if(this.tinode.isAuthenticated())aa.navigateTo("");else{n=vt.a.credential(n);var o=null,i=this.tinode.getAuthToken();e&&t?(this.setState({password:null}),o=this.tinode.loginBasic(e,t,n)):i&&(o=this.tinode.loginToken(i.token,n)),o?o.then(function(e){e.code>=300&&"validate credentials"===e.text?(n&&r.handleError("Code does not match","warn"),r.handleCredentialsRequest(e.params)):r.handleLoginSuccessful()}).catch(function(e){r.setState({loginDisabled:!1,credMethod:void 0,credCode:void 0}),r.handleError(e.message,"err"),localStorage.removeItem("auth-token"),aa.navigateTo("")}):(aa.navigateTo(""),this.setState({loginDisabled:!1}))}}},{key:"handleCredentialsRequest",value:function(e){var t=aa.parseUrlHash(window.location.hash);t.path[0]="cred",t.params.method=e.cred[0],aa.navigateTo(aa.composeUrlHash(t.path,t.params))}},{key:"handleLoginSuccessful",value:function(){var e=this;this.handleError("",null),Ei.getObject("keep-logged-in")&&Ei.setObject("auth-token",this.tinode.getAuthToken());var t=this.tinode.getMeTopic();t.onMetaDesc=this.tnMeMetaDesc,t.onContactUpdate=this.tnMeContactUpdate,t.onSubsUpdated=this.tnMeSubsUpdated,this.setState({connected:!0,credMethod:void 0,credCode:void 0,myUserId:this.tinode.getCurrentUserID()}),t.subscribe(t.startMetaQuery().withLaterSub().withDesc().build()).catch(function(t){localStorage.removeItem("auth-token"),e.handleError(t.message,"err"),aa.navigateTo("")}),aa.navigateTo(aa.setUrlSidePanel(window.location.hash,"contacts"))}},{key:"handleDisconnect",value:function(e){this.setState({connected:!1,topicSelectedOnline:!1,dialogSelected:null,errorText:e&&e.message?e.message:"Disconnected",errorLevel:e&&e.message?"err":"warn",loginDisabled:!1,contextMenuVisible:!1,serverVersion:"no connection"})}},{key:"tnMeMetaDesc",value:function(e){e&&e.public&&this.setState({sidePanelTitle:e.public.fn,sidePanelAvatar:Bt(e.public.photo)})}},{key:"tnMeContactUpdate",value:function(e,t){"on"==e||"off"==e?(this.resetContactList(),this.state.topicSelected==t.topic&&this.setState({topicSelectedOnline:"on"==e})):"read"==e?this.resetContactList():"msg"==e?this.state.topicSelected!=t.topic?(this.state.messageSounds&&es.play(),this.resetContactList()):document.hidden&&this.state.messageSounds&&es.play():"recv"==e||("gone"==e||"unsub"==e?(this.state.topicSelected==t.topic&&this.handleTopicSelected(null),this.resetContactList()):"acs"==e?this.state.topicSelected==t.topic&&this.setState({topicSelectedAcs:t.acs}):"del"==e||console.log("Unsupported (yet) presence update:"+e+" in: "+t.topic))}},{key:"tnMeSubsUpdated",value:function(e){this.resetContactList()}},{key:"resetContactList",value:function(){var e=this,n={chatList:[]};this.tinode.getMeTopic().contacts(function(t){n.chatList.push(t),e.state.topicSelected==t.topic&&(n.topicSelectedOnline=t.online,n.topicSelectedAcs=t.acs)}),n.searchableContacts=t.prepareSearchableContacts(n.chatList,this.state.searchResults),this.setState(n)}},{key:"tnData",value:function(e){var t=this,n=this.tinode.getTopic(e.topic);n.msgStatus(e)>=vt.a.MESSAGE_STATUS_SENT&&(clearTimeout(this.receivedTimer),this.receivedTimer=setTimeout(function(){t.receivedTimer=void 0,n.noteRecv(e.seq)},500))}},{key:"tnInitFind",value:function(){var e=this,t=this.tinode.getFndTopic();t.isSubscribed()?this.tnFndSubsUpdated():(t.onSubsUpdated=this.tnFndSubsUpdated,t.subscribe(t.startMetaQuery().withSub().withTags().build()).catch(function(t){e.handleError(t.message,"err")}))}},{key:"tnFndSubsUpdated",value:function(){var e=[];this.tinode.getFndTopic().contacts(function(t){e.push(t)}),this.setState({searchResults:e,searchableContacts:t.prepareSearchableContacts(this.state.chatList,e)})}},{key:"handleSearchContacts",value:function(e){var t=this,n=this.tinode.getFndTopic();n.setMeta({desc:{public:e}}).then(function(e){return n.getMeta(n.startMetaQuery().withSub().build())}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleTopicSelected",value:function(e,t,n,r){e?(this.setState({errorText:"",errorLevel:null,mobilePanel:"topic-view",showInfoPanel:!1}),this.state.topicSelected!=e&&(this.setState({topicSelectedOnline:n,topicSelectedAcs:r}),aa.navigateTo(aa.setUrlTopic("",e)))):(this.setState({errorText:"",errorLevel:null,mobilePanel:"sidepanel",topicSelectedOnline:!1,topicSelectedAcs:null,showInfoPanel:!1}),this.state.topicSelected&&aa.navigateTo(aa.setUrlTopic("",null)))}},{key:"handleHideMessagesView",value:function(){this.setState({mobilePanel:"sidepanel"}),aa.navigateTo(aa.setUrlTopic(window.location.hash,null))}},{key:"handleSendMessage",value:function(e,t,n){var r=this,o=this.tinode.getTopic(this.state.topicSelected);(e=o.createMessage(e,!1))._uploader=n,o.isSubscribed()||(t||(t=Promise.resolve()),t=t.then(function(){return o.subscribe()})),t&&(t=t.catch(function(e){r.handleError(e.message,"err")})),o.publishDraft(e,t).catch(function(e){r.handleError(e.message,"err")})}},{key:"handleNewAccount",value:function(){aa.navigateTo(aa.setUrlSidePanel(window.location.hash,"register"))}},{key:"handleNewAccountRequest",value:function(e,t,n,r,o){var i=this;this.tinode.connect(this.state.serverAddress).then(function(){return i.tinode.createAccountBasic(e,t,{public:n,tags:o,cred:vt.a.credential(r)})}).then(function(e){e.code>=300&&"validate credentials"==e.text?i.handleCredentialsRequest(e.params):i.handleLoginSuccessful(i)}).catch(function(e){i.handleError(e.message,"err")})}},{key:"handleUpdateAccountRequest",value:function(e,t,n){var r=this;(t||n)&&this.tinode.getMeTopic().setMeta({desc:{public:t,defacs:n}}).catch(function(e){r.handleError(e.message,"err")}),e&&this.tinode.updateAccountBasic(null,this.tinode.getCurrentLogin(),e).catch(function(e){r.handleError(e.message,"err")})}},{key:"handleUpdateAccountTagsRequest",value:function(e){var t=this;this.tinode.getFndTopic().setMeta({tags:e}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleSettings",value:function(){aa.navigateTo(aa.setUrlSidePanel(window.location.hash,this.state.myUserId?"edit":"settings"))}},{key:"handleGlobalSettings",value:function(e){var n=e.serverAddress||this.state.serverAddress,r=e.transport||this.state.transport;this.tinode&&(this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.tinode=t.tnSetup(n,r),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.setState({serverAddress:n,transport:r}),Ei.setObject("settings",{serverAddress:n,transport:r}),aa.navigateTo(aa.setUrlSidePanel(window.location.hash,""))}},{key:"initDesktopAlerts",value:function(){var e=this;this.fbPush.onTokenRefresh(function(){e.requestPushToken(!0)}),this.fbPush.onMessage(function(e){})}},{key:"togglePushToken",value:function(e){var t=this;e?this.state.firebaseToken?(this.setState({desktopAlerts:!0}),Ei.updateObject("settings",{desktopAlerts:!0})):this.fbPush.requestPermission().then(function(){t.requestPushToken(!0)}).catch(function(e){t.handleError(e.message,"err"),t.setState({desktopAlerts:!1,firebaseToken:null}),Ei.updateObject("settings",{desktopAlerts:!1}),console.log("Failed to get permission to notify.",e)}):this.state.firebaseToken?this.fbPush.deleteToken(this.state.firebaseToken).catch(function(e){console.log("Unable to delete token.",e)}).finally(function(){Ei.updateObject("settings",{desktopAlerts:!1}),localStorage.removeItem("firebase-token"),t.setState({desktopAlerts:!1,firebaseToken:null})}):(this.setState({desktopAlerts:!1,firebaseToken:null}),Ei.updateObject("settings",{desktopAlerts:!1}))}},{key:"requestPushToken",value:function(e){var t=this;this.fbPush.getToken().then(function(n){n!=t.state.firebaseToken&&(t.tinode.setDeviceToken(n,e),Ei.setObject("firebase-token",n)),t.setState({firebaseToken:n,desktopAlerts:!0}),Ei.updateObject("settings",{desktopAlerts:!0})}).catch(function(e){t.handleError(e.message,"err"),console.log("Failed to retrieve firebase token",e)})}},{key:"handleToggleMessageSounds",value:function(e){this.setState({messageSounds:e}),Ei.updateObject("settings",{messageSoundsOff:!e})}},{key:"handleSidepanelCancel",value:function(){var e=aa.parseUrlHash(window.location.hash);e.path[0]=this.state.myUserId?"contacts":"",e.params&&(delete e.params.code,delete e.params.method,delete e.params.tab),aa.navigateTo(aa.composeUrlHash(e.path,e.params)),this.setState({errorText:"",errorLevel:null})}},{key:"handleNewTopic",value:function(){aa.navigateTo(aa.setUrlSidePanel(window.location.hash,"newtpk"))}},{key:"handleNewTopicRequest",value:function(e,t,n,r){var o=this,i=e||this.tinode.newGroupTopicName();e?this.handleTopicSelected(i):this.setState({newGroupTopicParams:{desc:{public:t,private:{comment:n}},tags:r}},function(){o.handleTopicSelected(i)})}},{key:"handleNewTopicCreated",value:function(e,t){this.state.topicSelected==e&&e!=t&&this.setState({topicSelected:t},function(){aa.navigateTo(aa.setUrlTopic("",t))})}},{key:"handleTopicUpdateRequest",value:function(e,t,n,r){var o=this,i=this.tinode.getTopic(e);if(i){var a={};t&&(a.public=t),n&&(a.private={comment:n}),r&&(a.defacs=r),i.setMeta({desc:a}).catch(function(e){o.handleError(e.message,"err")})}}},{key:"handleChangePermissions",value:function(e,t,n){var r=this,o=this.tinode.getTopic(e);if(o){var i=o.getAccessMode();n?(i.updateGiven(t),t=i.getGiven()):(i.updateWant(t),t=i.getWant()),o.setMeta({sub:{user:n,mode:t}}).catch(function(e){r.handleError(e.message,"err")})}}},{key:"handleTagsUpdated",value:function(e,t){var n=this,r=this.tinode.getTopic(e);if(r){r.setMeta({tags:t}).catch(function(e){n.handleError(e.message,"err")})}}},{key:"handleLogout",value:function(){_r(0),localStorage.removeItem("auth-token"),this.tinode&&(this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.setState(this.getBlankState()),this.tinode=t.tnSetup(this.state.serverAddress,this.state.transport),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,aa.navigateTo("")}},{key:"handleLeaveUnsubRequest",value:function(e){var t=this,n=this.tinode.getTopic(e);n&&n.leave(!0).then(function(e){aa.navigateTo(aa.setUrlTopic(window.location.hash,""))}).catch(function(e){t.handleError(e.message,"err")})}},{key:"handleDialogCancel",value:function(){this.setState({dialogSelected:null})}},{key:"handleShowContextMenu",value:function(e,t){this.setState({contextMenuVisible:!0,contextMenuClickAt:{x:e.x,y:e.y},contextMenuParams:e,contextMenuItems:t||this.defaultTopicContextMenu(e.topicName),contextMenuBounds:a.a.findDOMNode(this).getBoundingClientRect()})}},{key:"defaultTopicContextMenu",value:function(e){var t=this.tinode.getTopic(e),n=this.props.intl.formatMessage,r=!1,o=!1,i=!1,a=!1;if(t&&t.isSubscribed()){i=!0;var s=t.getAccessMode();r=s&&s.isMuted(),o=s&&!s.isJoiner(),a=s&&s.isDeleter()}return[i?{title:n({id:"menu_item_info"}),handler:this.handleShowInfoView}:null,i?"messages_clear":null,i&&a?"messages_clear_hard":null,i?r?"topic_unmute":"topic_mute":null,i?o?"topic_unblock":"topic_block":null,"topic_delete"]}},{key:"handleHideContextMenu",value:function(){this.setState({contextMenuVisible:!1,contextMenuClickAt:null,contextMenuParams:null,contextMenuBounds:null})}},{key:"handleShowInfoView",value:function(){aa.navigateTo(aa.addUrlParam(window.location.hash,"info",!0)),this.setState({showInfoPanel:!0})}},{key:"handleHideInfoView",value:function(){aa.navigateTo(aa.removeUrlParam(window.location.hash,"info")),this.setState({showInfoPanel:!1})}},{key:"handleMemberUpdateRequest",value:function(e,t,n){var r=this;if(e){var o=this.tinode.getTopic(e);o&&(t&&t.length>0&&t.map(function(e){o.invite(e,null).catch(function(e){r.handleError(e.message,"err")})}),n&&n.length>0&&n.map(function(e){o.delSubscription(e).catch(function(e){r.handleError(e.message,"err")})}))}}},{key:"handleValidateCredentialsRequest",value:function(e,t){this.setState({credMethod:e,credCode:t}),this.doLogin(null,null,{meth:e,resp:t})}},{key:"handlePasswordResetRequest",value:function(e,t){var n=this;this.tinode.connect().then(function(){return n.tinode.requestResetAuthSecret("basic",e,t)}).catch(function(e){n.handleError(e.message,"err")})}},{key:"handleResetPassword",value:function(e,t,n){var r=this;(n=base64ReEncode(n))?this.tinode.connect().then(function(){return r.tinode.updateAccountBasic(null,null,t,{token:n})}).catch(function(e){r.handleError(e.message,"err")}):this.handleError("Invalid security token","err")}},{key:"render",value:function(){return o.a.createElement("div",{id:"app-container"},this.state.contextMenuVisible?o.a.createElement(Nt,{tinode:this.tinode,bounds:this.state.contextMenuBounds,clickAt:this.state.contextMenuClickAt,params:this.state.contextMenuParams,items:this.state.contextMenuItems,hide:this.handleHideContextMenu,onAction:this.handleContextMenuAction,onError:this.handleError}):null,o.a.createElement(Ka,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,hideSelf:this.state.displayMobile&&"sidepanel"!==this.state.mobilePanel,state:this.state.sidePanelSelected,title:this.state.sidePanelTitle,avatar:this.state.sidePanelAvatar,login:this.state.login,myUserId:this.state.myUserId,loginDisabled:this.state.loginDisabled,errorText:this.state.errorText,errorLevel:this.state.errorLevel,topicSelected:this.state.topicSelected,chatList:this.state.chatList,credMethod:this.state.credMethod,credCode:this.state.credCode,transport:this.state.transport,messageSounds:this.state.messageSounds,desktopAlerts:this.state.desktopAlerts,desktopAlertsEnabled:this.state.desktopAlertsEnabled,serverAddress:this.state.serverAddress,onGlobalSettings:this.handleGlobalSettings,onSignUp:this.handleNewAccount,onSettings:this.handleSettings,onLoginRequest:this.handleLoginRequest,onCreateAccount:this.handleNewAccountRequest,onUpdateAccount:this.handleUpdateAccountRequest,onUpdateAccountTags:this.handleUpdateAccountTagsRequest,onTogglePushNotifications:this.togglePushToken,onToggleMessageSounds:this.handleToggleMessageSounds,onTopicSelected:this.handleTopicSelected,onCreateTopic:this.handleNewTopicRequest,onNewTopic:this.handleNewTopic,onLogout:this.handleLogout,onCancel:this.handleSidepanelCancel,onError:this.handleError,onValidateCredentials:this.handleValidateCredentialsRequest,onPasswordResetRequest:this.handlePasswordResetRequest,onResetPassword:this.handleResetPassword,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,showContextMenu:this.handleShowContextMenu}),o.a.createElement(Yo,{tinode:this.tinode,connected:this.state.connected,online:this.state.topicSelectedOnline,acs:this.state.topicSelectedAcs,displayMobile:this.state.displayMobile,viewportWidth:this.state.viewportWidth,hideSelf:this.state.displayMobile&&("topic-view"!==this.state.mobilePanel||this.state.showInfoPanel),topic:this.state.topicSelected,myUserId:this.state.myUserId,serverVersion:this.state.serverVersion,serverAddress:this.state.serverAddress,errorText:this.state.errorText,errorLevel:this.state.errorLevel,newGroupTopicParams:this.state.newGroupTopicParams,onHideMessagesView:this.handleHideMessagesView,onData:this.tnData,onError:this.handleError,onNewTopicCreated:this.handleNewTopicCreated,readTimerHandler:this.handleReadTimer,showContextMenu:this.handleShowContextMenu,sendMessage:this.handleSendMessage}),this.state.showInfoPanel?o.a.createElement(Dr,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,topic:this.state.topicSelected,searchableContacts:this.state.searchableContacts,myUserId:this.state.myUserId,errorText:this.state.errorText,errorLevel:this.state.errorLevel,onTopicDescUpdate:this.handleTopicUpdateRequest,onCancel:this.handleHideInfoView,onChangePermissions:this.handleChangePermissions,onMemberUpdateRequest:this.handleMemberUpdateRequest,onLeaveTopic:this.handleLeaveUnsubRequest,onAddMember:this.handleManageGroupMembers,onTopicTagsUpdate:this.handleTagsUpdated,onInitFind:this.tnInitFind,onError:this.handleError,showContextMenu:this.handleShowContextMenu}):null)}}],[{key:"tnSetup",value:function(e,t){var n=new vt.a(gt,e,"AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K",t,za());return n.enableLogging(!0,!0),n}},{key:"prepareSearchableContacts",value:function(e,t){var n={},r=!0,o=!1,i=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done);r=!0){var l=a.value;"p2p"==vt.a.topicType(l.topic)&&(n[l.topic]={user:l.topic,updated:l.updated,public:l.public,private:l.private,acs:l.acs})}}catch(e){o=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(o)throw i}}var u=!0,c=!1,d=void 0;try{for(var p,f=t[Symbol.iterator]();!(u=(p=f.next()).done);u=!0){var h=p.value;n[h.user]||(n[h.user]=h)}}catch(e){c=!0,d=e}finally{try{u||null==f.return||f.return()}finally{if(c)throw d}}return Object.values(n)}}]),t}());E(Be.a);var ns=aa.parseUrlHash(window.location.hash).params,rs=ns&&ns.hl||navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage,os=rs.toLowerCase().split(/[-_]+/)[0],is=We[rs]||We[os]||We.en;a.a.render(o.a.createElement(Ee,{locale:rs,messages:is},o.a.createElement(ts,null)),document.getElementById("mountPoint"))}])}); |