From 87947b3de65add9d324a60858a95496e49b263ce Mon Sep 17 00:00:00 2001 From: or-else Date: Wed, 6 Feb 2019 20:08:50 +0300 Subject: [PATCH] archiving works, refactored UNSAFE_componentWillReceiveProps in chips-input --- css/base.css | 6 +- css/base.min.css | 2 +- src/views/contacts-view.jsx | 7 +- src/views/messages-view.jsx | 54 +++++----- src/views/tinode-web.jsx | 11 ++ src/widgets/chip-input.jsx | 26 ++--- src/widgets/contact-action.jsx | 2 +- src/widgets/context-menu.jsx | 191 +++++++++++++++++++++++---------- umd/index.dev.js | 150 +++++++++++++++++++------- umd/index.dev.js.map | 2 +- umd/index.prod.js | 2 +- umd/index.prod.js.map | 2 +- 12 files changed, 313 insertions(+), 142 deletions(-) diff --git a/css/base.css b/css/base.css index 6e8ed19a..598b706d 100644 --- a/css/base.css +++ b/css/base.css @@ -727,6 +727,10 @@ i.search { .contact-box > li.selected { background-color: #cfd8dc; /* blue-gray 100 highlight */ } +.contact-box > li.action { + min-height: 2.5rem; + border-bottom: none; +} .contact-box .text-box { overflow-x: hidden; @@ -778,7 +782,7 @@ i.search { .contact-box .action-text { text-align: center; font-size: 0.95rem; - line-height: 3.5rem; + line-height: 2.5rem; margin: 0 auto 0 auto; cursor: pointer; } diff --git a/css/base.min.css b/css/base.min.css index 2acc4d10..5bbcee2e 100644 --- a/css/base.min.css +++ b/css/base.min.css @@ -1 +1 @@ -*{box-sizing:border-box;padding:0;margin:0;font-family:Roboto,Arial,sans-serif;text-rendering:optimizeLegibility}body,html{height:100%;width:100%;font-size:10pt;color:#666;overflow:hidden;background-color:silver;box-shadow:inset 0 10rem #3949ab}tt{font-family:Roboto Mono,Courier,monospace}a{color:#2196f3;text-decoration:none}a:focus,a:hover{color:#0a6ebd;text-decoration:underline}a.red:focus,a.red:hover{color:#f44336}a.flat-button{display:flex;align-items:center;margin:.15rem .35rem;height:2em;line-height:2em;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;white-space:nowrap;text-transform:uppercase}a.flat-button:focus,a.flat-button:hover{text-decoration:none}form{padding:.5rem .75rem;line-height:1.5}form,label{font-size:1.1rem}label{margin-right:auto}label.small{color:#1e88e5;font-size:.95rem}img.avatar{width:100%;height:100%;border-radius:50%}button{display:inline-block;font-family:inherit;font-size:1.1rem;height:2.2em;line-height:2.2em;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;border:1px solid transparent;white-space:nowrap;padding-left:2rem;padding-right:2rem;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.25);text-transform:uppercase}button[disabled],html input[disabled]{cursor:default;opacity:.65;box-shadow:none}button.round{border-radius:50%;width:3rem;height:3rem;padding:0;margin:0;line-height:3.5rem;outline:none;box-shadow:0 2px .5rem 0 rgba(0,0,0,.25);z-index:2}button.round.small{width:2rem;height:2rem;line-height:2rem;box-shadow:0 2px .35rem 0 rgba(0,0,0,.25)}button:active,button:focus,button:hover{color:#fff}button:active{box-shadow:inset 0 3px .5rem rgba(0,0,0,.125)}button:active.round.small{box-shadow:inset 0 2px .35rem rgba(0,0,0,.125)}button.blue{background-color:#1e88e5;color:#fff}button.blue:active,button.blue:focus,button.blue:hover{background-color:#1976d2}button.white{background-color:#fff;color:#2196f3}button.blue:active,button.white:focus,button.white:hover{background-color:#e3f2fd}input,textarea{font-family:inherit;font-size:1.1rem;background:transparent;border:none;margin:.25rem 0;padding:0 .125rem;outline:none;color:#666}textarea{resize:none}input[type=email],input[type=password],input[type=search],input[type=text],textarea{height:2.5rem;border-bottom:1px solid #ccc;box-shadow:0 1px 0 rgba(0,0,0,.1);transition:all .1s ease-in-out}input[type=email],input[type=password],input[type=text],textarea{width:100%}input[type=email]:focus,input[type=password]:focus,input[type=search]:focus,input[type=text]:focus,textarea:focus{border-bottom:1px solid #2196f3;box-shadow:0 1px 0 rgba(33,150,243,.25)}input[type=email]::placeholder,input[type=password]::placeholder,input[type=search]::placeholder,input[type=text]::placeholder,textarea::placeholder{color:#bbb}input[type=password].with-visibility,input[type=text].with-visibility{margin-right:-2rem;padding-right:2rem}::-webkit-scrollbar{width:.6rem}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.2);background-color:hsla(0,0%,100%,.1)}::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3)}ul.menu{position:absolute;list-style:none;width:12rem;border-radius:.2rem;padding-top:.35rem;padding-bottom:.35rem;box-shadow:0 1px 6px rgba(0,0,0,.45);background-color:#fff;z-index:4}ul.menu>li{padding:.75rem .75rem .75rem 1.25rem}ul.menu>li:hover{background-color:#f5f5f5}ul.menu>li.separator{padding:0;margin:2px;height:1px}ul.menu>li.separator,ul.menu>li.separator:hover{background-color:#ccc}li .menuTrigger{position:absolute;top:.25rem;right:.25rem;width:1.5rem;height:1.2rem;line-height:1.2rem;border-radius:.6rem;text-align:center;opacity:0}li:hover .menuTrigger{opacity:1}li:hover .menuTrigger a{color:#757575}li.left:hover .menuTrigger{-text-shadow:#c5e1a5 0 0 15px,#c5e1a5 0 0 5px;background-image:radial-gradient(#c5e1a5 40%,transparent 75%)}li.right:hover .menuTrigger{-text-shadow:#fafafa 0 0 15px,#fafafa 0 0 5px;background-image:radial-gradient(#fafafa 40%,transparent 75%)}.blue{color:#2196f3}.red{color:#d32f2f}.gray{color:#757575}.light-gray{color:#bbb}.small{font-size:90%}.hr{display:block;width:100%;height:.6rem;min-height:.3rem;background-color:#f0f0f0;box-shadow:inset 0 .25rem .25rem -.25rem rgba(0,0,0,.15),inset 0 -.25rem .25rem -.25rem rgba(0,0,0,.15)}.group-focus{outline:none}#mountPoint{height:100%;padding-top:1rem;padding-bottom:3rem}#noscript-alertbox{position:relative;display:flex;flex-direction:column;max-width:30rem;overflow:hidden;margin-top:5rem;margin-left:auto;margin-right:auto;border-radius:.25rem;box-shadow:1px 2px .3rem grey;background-color:#fff}#noscript-title{padding:1rem;font-size:120%;font-weight:bolder;background-color:#2196f3;color:#bbdefb}#noscript-content{padding:1rem}#app-container{max-width:80rem;overflow:hidden;margin-left:auto;margin-right:auto;border-radius:.25rem;box-shadow:1px 2px .3rem grey;background-color:#fff}#app-container,#sidepanel{position:relative;display:flex;height:100%}#sidepanel{flex-direction:column;flex-grow:0;flex-shrink:0.3;width:24rem;min-width:18rem}#topic-view{width:100%}#info-view,#topic-view{display:flex;flex-direction:column;height:100%}#info-view{flex-grow:0;flex-shrink:0.3;width:24rem;min-width:18rem}@media (max-width:960px){#mountPoint{padding:0}}@media (max-width:640px){#app-container{width:100%;border-radius:0;box-shadow:none}#info-view,#sidepanel{width:100%}}.center-medium-text{width:100%;height:100%;display:flex;align-items:center;justify-content:center;text-align:center;font-size:1.4rem}.nodisplay{display:none!important}.quoted{margin-left:1.5rem}.in-place-edit{display:inline-block;font-family:inherit;font-size:1.1rem;height:2.5rem;line-height:2.25;margin:.25rem .125rem;width:100%;vertical-align:baseline;border-bottom:1px dashed #ddd;cursor:pointer}.in-place-edit.disabled{border-bottom:none;cursor:default}.in-place-edit.placeholder{color:#bbb}.in-place-edit .content{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}table.permission-editor{width:100%}table.permission-editor td{margin:.35rem 0;font-size:1.1rem;vertical-align:middle}table.permission-editor td.checkbox{text-align:center;color:#999}.permission-editor .material-icons{font-size:1.1rem;line-height:1.1rem}.material-icons.clickable{cursor:pointer;border-bottom:none}.clickable{border-bottom:1px dashed #ddd}.clickable,.image-clickable{cursor:pointer}.panel-title{font-size:1.4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.caption-panel{display:flex;align-items:center;flex:none;padding:.5rem;height:4rem;white-space:nowrap;box-shadow:0 1px 2px grey;z-index:1}.dialog-buttons{display:flex;padding:.5rem;justify-content:flex-end}.dialog-buttons button{margin:0 .5rem}.avatar-box{position:relative;flex-grow:0;flex-shrink:0}.bot-form{display:flex;flex-direction:column;overflow:hidden;min-width:8rem;line-height:2rem}.bot-form div{min-height:2rem;vertical-align:middle}.bot-form button{display:inline-block;margin:0;width:100%;background-color:#eef;color:#2196f3;font-size:inherit;text-transform:none;height:2rem;line-height:2rem}.bot-form>div>button{width:auto}.bot-form button:focus,button:active,button:hover{outline:0;background-color:#e3f2fd}#side-caption-panel{background-color:#2196f3;color:#bbdefb}#side-caption-panel a{color:#bbdefb;padding-left:.5rem;line-height:1}#side-caption-panel :hover{color:#fff}#sidepanel-title{margin-right:auto;margin-left:.5rem}#self-avatar{width:3rem;min-width:3rem;height:3rem;flex:none;border-radius:50%}#self-avatar.avatar-box{font-size:1.8rem}#settings-form ul{list-style:none}#settings-form li{vertical-align:middle}#settings-form label{display:inline-block;padding-left:.5rem}input.search{text-indent:1.4rem}i.search{position:absolute;left:.6rem}.alert-box{position:relative;display:none;overflow:hidden;padding:1rem 1.5rem 1rem .5rem}.alert-box .cancel{position:absolute;right:.25rem;top:.5rem}.alert-box.error{display:flex;background-color:#ffcdd2;border-bottom:1px solid #ffbfc8;color:#b71c1c}.alert-box.warning{display:flex;background-color:#fff9c4;border-bottom:1px solid #fff59d;color:#6d4c41}.alert-box.info{display:flex;background-color:#e1f5fe;border-bottom:1px solid #b3e5fc;color:#0288d1}.alert-box .cancel .material-icons{font-size:1rem;color:#757575}.alert-box.error .cancel .material-icons{color:#b71c1c}.alert-box .icon{display:block;margin-right:.5rem}.alert-box .icon .material-icons{font-size:1.5rem}.alert-box.warning .icon .material-icons{color:#fbc02d}.alert-box.error .icon .material-icons{color:#ef5350}.alert-box.info .icon .material-icons{color:#0288d1}.flex-column{display:flex;flex-direction:column;height:100%;overflow:hidden}.scrollable-panel{overflow-y:auto;margin-top:.25rem;margin-bottom:auto;height:100%}.contact-box{list-style:none;overflow-x:hidden}.contact-box>li{display:flex;position:relative;padding:.35rem .25rem .5rem .35rem;min-height:3.5rem;flex-grow:0;flex-shrink:0;border-bottom:1px solid #eee;border-collapse:collapse;overflow-x:hidden}.contact-box>li:hover{background-color:#eceff1}.contact-box>li.selected{background-color:#cfd8dc}.contact-box .text-box{overflow-x:hidden}.contact-box .contact-title{font-size:1.05rem;text-overflow:ellipsis;overflow:hidden}.contact-box .contact-comment{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-weight:lighter}.contact-box .avatar-box{margin-right:.35rem;position:relative;width:3rem;min-width:3rem;height:3rem;min-height:3rem;font-size:1.8rem;overflow:hidden;padding:0}.contact-box .avatar{width:3rem;height:3rem;border-radius:50%}.contact-box .avatar-box>.material-icons{font-size:2.4rem;line-height:3rem}.contact-box .avatar-box>.material-icons,.contact-box .text-box{display:flex;flex-direction:column;justify-content:space-around}.contact-box .action-text{text-align:center;font-size:.95rem;line-height:3.5rem;margin:0 auto;cursor:pointer}.avatar-box .online,.offline{display:inline-block;width:.75rem;min-width:.75rem;height:.75rem;min-height:.75rem;flex-shrink:0;border-radius:50%;position:absolute;right:0;bottom:.1rem}.avatar-box .online{background-color:#4caf50}.avatar-box .offline{background-color:silver}.online.typing{animation:typing .5s infinite}@keyframes typing{0%,to{transform:translateX(0)}50%{transform:translateX(-.3rem)}}.contact-box .checkmark.material-icons{display:inline-block;width:1.5rem;height:1.5rem;font-size:1.5rem;line-height:1.5rem;color:#0097a7;position:absolute;right:.05rem;bottom:.05rem;background-color:#fff;overflow:visible;border:0 solid transparent}#add-topic{position:absolute;right:1rem;bottom:1rem}.panel-form{display:flex;flex-direction:column;padding:0}.panel-form-row{justify-content:flex-start;align-items:center}.panel-form-column,.panel-form-row{display:flex;padding:.5rem .75rem;line-height:1.5;flex-grow:0;flex-shrink:0}.panel-form-column{flex-direction:column}.panel-form-column>.panel-form-column,.panel-form-row>.panel-form-column{padding:0!important;flex-grow:1}.panel-form-column>.panel-form-row,.panel-form-row>.panel-form-row{padding:0!important}.avatar-upload{display:flex;position:relative;flex-direction:column;flex-shrink:0;width:7rem;height:9rem;margin-left:.5rem;font-size:4.5rem;padding:0}.avatar-upload .clear-avatar{position:absolute;font-size:1rem;top:0;right:0;opacity:0;background-image:radial-gradient(#fff 40%,transparent 75%)}.avatar-upload:hover .clear-avatar{opacity:1}.avatar-upload .avatar-box{position:relative;width:7rem;height:7rem}.avatar-upload .avatar-box>.material-icons{position:relative;font-size:4rem;line-height:7rem;vertical-align:middle}.avatar-upload:after{content:".";display:block;height:0;clear:both;visibility:hidden}.avatar-upload .blank{text-align:center;vertical-align:middle;border:1px dashed #999;font-size:1rem;flex-shrink:0;width:7rem;height:7rem;overflow:hidden;color:#999;line-height:7rem;border-radius:50%}.avatar-upload .preview{width:7rem;height:7rem;overflow:hidden;border-radius:50%}.avatar-upload .inputfile.hidden{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute}.avatar-upload .inputfile+label.round{display:flex;align-items:center;justify-content:center;cursor:pointer;width:3rem;height:3rem;line-height:3rem;border-radius:50%;box-shadow:0 1px 4px rgba(0,0,0,.4);margin-left:auto;margin-right:auto;margin-top:-1rem;bottom:0;background-color:#fafafa}.avatar-upload .inputfile:focus+label.round{outline:none}.avatar-upload .inputfile+label:hover,.avatar-upload .inputfile:focus+label{background-color:#e3f2fd;color:#42a5f5}#topic-view{position:relative}#topic-caption-panel{background-color:#b0bec5}#topic-caption-panel a{color:#757575;text-decoration:none}#topic-caption-panel :hover{color:#000}#topic-caption-panel .avatar-box{position:relative;width:3rem;min-width:3rem;height:3rem;font-size:1.8rem;margin-right:.35rem}#topic-caption-panel .avatar-box>.material-icons{font-size:2.4rem;line-height:3rem}#hide-message-view{display:block;margin-right:.35rem}#topic-users{margin-left:auto;margin-right:1rem}#topic-users .avatar-box{display:inline-block;width:1.8rem;min-width:1.8rem;height:1.8rem;min-height:1.8rem;font-size:1rem;margin-right:.2rem}#messages-panel{position:relative;padding:.75rem;overflow-y:scroll;background-color:#eceff1;height:100%;background-image:url(../img/ignasi_pattern_s.png)}#messages-container{position:relative;overflow-y:hidden;height:100%}#write-only-background{position:absolute;top:0;left:0;height:100%;width:100%;background-image:repeating-linear-gradient(45deg,hsla(0,0%,100%,.5),hsla(0,0%,100%,.5) .5rem,hsla(0,0%,100%,.8) 0,hsla(0,0%,100%,.8) 1rem)}#write-only-note{position:absolute;background-color:#fff;color:#666;height:auto;width:auto;line-height:2rem;text-align:center;top:50%;left:50%;transform:translate(-50%,-50%);padding:.25rem 1.5rem;box-shadow:.1rem .1rem .1rem rgba(0,0,0,.2)}#send-message-panel{display:flex;align-items:center;flex:none;padding:.4rem .4rem .4rem .6rem;background-color:#eceff1;box-shadow:0 -1px rgba(0,0,0,.1);z-index:2;height:4rem}#sendMessage{overflow:hidden;overflow-wrap:break-word}#send-message-panel .material-icons{min-width:1.75rem}#send-message-panel .material-icons.secondary,.material-icons.disabled{color:#999!important}#send-message-panel .material-icons.secondary:hover{color:#2196f3!important}#dummy-view{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#e0f7fa}#dummy-view a{text-decoration:none;display:block;text-align:center;vertical-align:middle}#image-preview{position:absolute;display:flex;flex-direction:column;top:0;left:0;width:100%;height:100%;z-index:2;background-color:hsla(0,0%,100%,.9)}#image-preview-caption-panel{display:flex;justify-content:space-between;background-color:transparent;line-height:2.5rem;height:3.5rem;padding:1rem .75rem 0}#image-preview-caption-panel a{color:#757575;text-decoration:none}#image-preview-caption-panel a:hover{color:#000}#image-preview-container{margin:auto;overflow:hidden}#image-preview-footer{display:flex;justify-content:space-around;height:3.2rem;line-height:1.5rem;background-color:transparent}.chat-box{list-style:none;padding:0 0 3.5rem;margin:0 .5rem}.chat-box.group{margin-left:-.4rem}.chat-box li{display:flex;margin:0;padding:0;align-items:flex-end}.chat-box .right{justify-content:flex-end}.chat-box .bubble{display:flex;position:relative;max-width:40rem;min-width:12rem;height:auto;padding:.75rem .5rem .75rem 1.25rem;margin:0;text-align:left;border-radius:.5rem}.chat-box li.single{margin-top:.25rem;margin-bottom:.75rem}.chat-box li.first{margin-top:.25rem;margin-bottom:.15rem}.chat-box li.middle{margin-top:.15rem;margin-bottom:.15rem}.chat-box li.last{margin-top:.15rem;margin-bottom:.75rem}.chat-box .left .bubble{background-color:#c5e1a5}.chat-box .right .bubble{background-color:#fafafa}.chat-box .left .tip:before{right:auto;left:-10px;color:#c5e1a5}.chat-box .left .tip:before,.chat-box .right .tip:before{content:"";position:absolute;width:0;height:0;top:auto;bottom:0;border:10px solid transparent;border-bottom-color:currentcolor}.chat-box .right .tip:before{display:flex;justify-content:space-between;left:auto;right:-10px;color:#fafafa}.chat-box .avatar-box{position:relative;width:1.4rem;min-width:1.4rem;height:1.4rem;min-height:1.4rem;font-size:.8rem;margin-bottom:.8rem;margin-right:.8rem}.chat-box .bubble div.message-content{color:#212121;margin:0;max-width:36rem;overflow-wrap:break-word}.chat-box .bubble div.message-content:after{content:".";display:block;height:0;clear:both;visibility:hidden}.chat-box .timestamp{display:inline-block;position:relative;font-size:80%;color:#777;padding-left:1rem;top:.5rem;float:right;white-space:nowrap}.chat-box .typing{display:inline-block;border-radius:.5rem;width:2rem;padding:.25rem .35rem;vertical-align:middle;text-align:center;color:#aaa;margin-top:.75rem}.chat-box .author{font-size:80%;color:#777}.inline-image{max-width:36rem;max-height:24rem;overflow:hidden;border-radius:.1rem;display:block}.attachment{display:flex}.attachment:last-of-type{margin-bottom:-.45rem}#info-caption-panel{background-color:#b0bec5}#info-caption-panel a{color:#757575;line-height:1;text-decoration:none}#info-caption-panel :hover{color:#000}#info-title{margin-right:auto}#group-manager{position:relative;display:flex;flex-direction:column;height:100%}#group-manager-buttons{display:flex;background-color:#eceff1;box-shadow:0 -1px rgba(0,0,0,.1);z-index:2;justify-content:space-around;padding:.4rem;height:4rem;border-left:1px solid #ccc}.dialog-overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:hsla(0,0%,100%,.9)}.dialog-overlay,.modal-dialog{display:flex;flex-direction:column}.modal-dialog{justify-content:space-between;background-color:#fff;min-width:24rem;min-height:16rem;margin:auto;border-radius:.3rem;box-shadow:0 .5rem 1rem 0 rgba(0,0,0,.25)}.modal-dialog .title-panel{display:flex;justify-content:space-between;font-size:1.4rem;padding:1rem}.modal-dialog .body-panel{margin:auto .5rem}.modal-dialog .dialog-buttons{border-top:1px solid #f5f5f5;background-color:#fafafa}.modal-dialog .dialog-buttons a{display:inline-block;text-transform:uppercase;text-decoration:none;font-size:1.1rem;padding:.35rem 1.5rem}ul.tabbar{flex-shrink:0;flex-grow:0;background:#eee;list-style:none;margin:0;width:100%;overflow:hidden;padding:0 0 0 1rem}ul.tabbar>li{float:left}ul.tabbar>li>a{position:relative;padding-top:.75rem;padding-left:1rem;padding-right:1rem;display:block;text-align:center;line-height:2rem;font-weight:400;font-size:1.3rem;font-variant:small-caps;text-decoration:none;color:rgba(33,150,243,.6);overflow:hidden;box-shadow:inset 0 -2px 2.5px -1px rgba(0,0,0,.25)}ul.tabbar li.active>a{color:#2196f3}ul.tabbar li.active>a:after{height:.15rem;display:block;content:"";bottom:0;left:0;position:absolute;background:#2196f3;animation:tabbar-border-expand .2s cubic-bezier(.4,0,.4,1) 0s alternate forwards}@keyframes tabbar-border-expand{0%{opacity:0;width:0}to{opacity:1;width:100%}}.unread{font-weight:bolder;background-color:#0097a7;color:#fff;border-radius:50%;width:1.35rem;height:1.35rem;margin-left:.5rem;line-height:1.35rem;text-align:center;vertical-align:middle}.badge,.unread{display:inline-block;font-size:.75rem}.badge{font-family:Roboto Mono,Courier,monospace,sans-serif;border:1px solid #666;background-color:#eee;color:#666;padding:0 .15rem;margin-left:.1rem;margin-right:.1rem;margin-bottom:.1rem;border-radius:.15rem;align-self:flex-start}.badge.green{border-color:#383;background-color:#efe;color:#383}.badge.yellow{border-color:#660;background-color:#ffe;color:#660}.badge.blue{border-color:#339;background-color:#eef;color:#339}.badge.red{border-color:#933;background-color:#fee;color:#933}.badge.magenta{border-color:#939;background-color:#fef;color:#939}.lettertile{width:100%;padding-bottom:100%;border-radius:50%}.lettertile>div{display:flex;flex-shrink:0;flex-grow:0;position:absolute;top:0;bottom:0;left:0;right:0;text-transform:uppercase;align-items:center;justify-content:center;text-align:center;border-radius:50%;line-height:1;color:hsla(0,0%,98%,.8)}.lettertile:hover{color:#fff}.lettertile.color0{background-color:#ef9a9a}.lettertile.color1{background-color:#90caf9}.lettertile.color2{background-color:#b0bec5}.lettertile.color3{background-color:#b39ddb}.lettertile.color4{background-color:#ffab91}.lettertile.color5{background-color:#a5d6a7}.lettertile.color6{background-color:#eee}.lettertile.color7{background-color:#e6ee9c}.lettertile.color8{background-color:#c5e1a5}.lettertile.color9{background-color:#f0e57d}.lettertile.color10{background-color:#f48fb1}.lettertile.color11{background-color:#9fa8da}.lettertile.color12{background-color:#ffe082}.lettertile.color13{background-color:#bcaaa4}.lettertile.color14{background-color:#80deea}.lettertile.color15{background-color:#ce93d8}.lettertile.dark-color0{background-color:#c62828}.lettertile.dark-color1{background-color:#ad1457}.lettertile.dark-color2{background-color:#6a1b9a}.lettertile.dark-color3{background-color:#4527a0}.lettertile.dark-color4{background-color:#283593}.lettertile.dark-color5{background-color:#1565c0}.lettertile.dark-color6{background-color:#0277bd}.lettertile.dark-color7{background-color:#00838f}.lettertile.dark-color8{background-color:#00695c}.lettertile.dark-color9{background-color:#2e7d32}.lettertile.dark-color10{background-color:#558b2f}.lettertile.dark-color11{background-color:#9e9d24}.lettertile.dark-color12{background-color:#f9a825}.lettertile.dark-color13{background-color:#ff8f00}.lettertile.dark-color14{background-color:#ef6c00}.lettertile.dark-color15{background-color:#d84315}.material-icons{font-size:1.4rem;line-height:1;vertical-align:middle;text-align:center}.material-icons.small{font-size:1rem}.material-icons.big{font-size:2.4rem}#self-avatar .material-icons{font-size:2.4rem;line-height:3rem}.avatar-box .material-icons{color:hsla(0,0%,98%,.8);background-color:silver;border-radius:50%;width:inherit;height:inherit}.chip-input{display:flex;flex-wrap:wrap;flex-grow:1;cursor:text;font-size:1.1rem;font-weight:400;background:transparent;border-bottom:1px solid #ccc;box-shadow:0 1px 0 rgba(0,0,0,.1);transition:all .1s ease-in-out;max-height:10rem;min-height:4rem;overflow-y:scroll;margin:.25rem 0;outline:none;color:#666;align-items:center;justify-content:flex-start;text-align:center}.chip-input.focused{border-bottom:1px solid #2196f3;box-shadow:0 1px 0 rgba(33,150,243,.25)}.chip-input>input[type=text]{display:inline-block;width:auto;border:none;box-shadow:none;min-width:4rem;flex:1 0 auto}.chip,.chip-input>input[type=text]{line-height:1.8;height:1.8rem;margin:.125rem}.chip{display:flex;flex:0 0 auto;align-items:center;border-radius:.9rem;background-color:#eee;white-space:nowrap;font-size:90%}.chip>a{display:inline-block;color:#ccc;background-color:#aaa;border-radius:50%;margin:.3rem;width:1.175rem;height:1.175rem;line-height:1.15;text-decoration:none}.chip>a:focus,.chip>a:hover{text-decoration:none;color:#ddd;background-color:#bbb}.chip .avatar-box{position:relative;width:1.8rem;min-width:1.8rem;height:1.8rem;min-height:1.8rem;font-size:1rem;margin-right:.2rem}.chip .avatar-box .material-icons{font-size:1.4rem;line-height:1.8rem}.chip .spacer{display:inline-block;margin:.3rem;width:.25rem;height:1.175rem}.load-spinner-box{position:absolute;box-shadow:.1rem .1rem .15rem 1px rgba(0,0,0,.25);border-radius:50%;padding:.25rem;width:2.5rem;height:2.5rem;left:0;right:0;top:5rem;margin-left:auto;margin-right:auto;background-color:#fff;z-index:2}.loader-spinner{border-radius:50%;border:.35rem solid #f3f3f3;border-top-color:#1e88e5;width:2rem;height:2rem;animation:spin 1.5s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.uploader{display:flex}.uploader>div{position:relative;height:.6rem;padding:.15rem;margin:.35rem;width:6rem;line-height:0;border-radius:.1rem;background-color:#cfd8dc}.uploader>div>span{display:inline-block;height:.3rem;background-color:#1e88e5;border-radius:.08rem} \ No newline at end of file +*{box-sizing:border-box;padding:0;margin:0;font-family:Roboto,Arial,sans-serif;text-rendering:optimizeLegibility}body,html{height:100%;width:100%;font-size:10pt;color:#666;overflow:hidden;background-color:silver;box-shadow:inset 0 10rem #3949ab}tt{font-family:Roboto Mono,Courier,monospace}a{color:#2196f3;text-decoration:none}a:focus,a:hover{color:#0a6ebd;text-decoration:underline}a.red:focus,a.red:hover{color:#f44336}a.flat-button{display:flex;align-items:center;margin:.15rem .35rem;height:2em;line-height:2em;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;white-space:nowrap;text-transform:uppercase}a.flat-button:focus,a.flat-button:hover{text-decoration:none}form{padding:.5rem .75rem;line-height:1.5}form,label{font-size:1.1rem}label{margin-right:auto}label.small{color:#1e88e5;font-size:.95rem}img.avatar{width:100%;height:100%;border-radius:50%}button{display:inline-block;font-family:inherit;font-size:1.1rem;height:2.2em;line-height:2.2em;font-weight:400;text-align:center;vertical-align:middle;touch-action:manipulation;cursor:pointer;border:1px solid transparent;white-space:nowrap;padding-left:2rem;padding-right:2rem;border-radius:2px;box-shadow:0 2px 5px 0 rgba(0,0,0,.25);text-transform:uppercase}button[disabled],html input[disabled]{cursor:default;opacity:.65;box-shadow:none}button.round{border-radius:50%;width:3rem;height:3rem;padding:0;margin:0;line-height:3.5rem;outline:none;box-shadow:0 2px .5rem 0 rgba(0,0,0,.25);z-index:2}button.round.small{width:2rem;height:2rem;line-height:2rem;box-shadow:0 2px .35rem 0 rgba(0,0,0,.25)}button:active,button:focus,button:hover{color:#fff}button:active{box-shadow:inset 0 3px .5rem rgba(0,0,0,.125)}button:active.round.small{box-shadow:inset 0 2px .35rem rgba(0,0,0,.125)}button.blue{background-color:#1e88e5;color:#fff}button.blue:active,button.blue:focus,button.blue:hover{background-color:#1976d2}button.white{background-color:#fff;color:#2196f3}button.blue:active,button.white:focus,button.white:hover{background-color:#e3f2fd}input,textarea{font-family:inherit;font-size:1.1rem;background:transparent;border:none;margin:.25rem 0;padding:0 .125rem;outline:none;color:#666}textarea{resize:none}input[type=email],input[type=password],input[type=search],input[type=text],textarea{height:2.5rem;border-bottom:1px solid #ccc;box-shadow:0 1px 0 rgba(0,0,0,.1);transition:all .1s ease-in-out}input[type=email],input[type=password],input[type=text],textarea{width:100%}input[type=email]:focus,input[type=password]:focus,input[type=search]:focus,input[type=text]:focus,textarea:focus{border-bottom:1px solid #2196f3;box-shadow:0 1px 0 rgba(33,150,243,.25)}input[type=email]::placeholder,input[type=password]::placeholder,input[type=search]::placeholder,input[type=text]::placeholder,textarea::placeholder{color:#bbb}input[type=password].with-visibility,input[type=text].with-visibility{margin-right:-2rem;padding-right:2rem}::-webkit-scrollbar{width:.6rem}::-webkit-scrollbar-track{-webkit-box-shadow:inset 0 0 6px rgba(0,0,0,.2);background-color:hsla(0,0%,100%,.1)}::-webkit-scrollbar-thumb{background-color:rgba(0,0,0,.3)}ul.menu{position:absolute;list-style:none;width:12rem;border-radius:.2rem;padding-top:.35rem;padding-bottom:.35rem;box-shadow:0 1px 6px rgba(0,0,0,.45);background-color:#fff;z-index:4}ul.menu>li{padding:.75rem .75rem .75rem 1.25rem}ul.menu>li:hover{background-color:#f5f5f5}ul.menu>li.separator{padding:0;margin:2px;height:1px}ul.menu>li.separator,ul.menu>li.separator:hover{background-color:#ccc}li .menuTrigger{position:absolute;top:.25rem;right:.25rem;width:1.5rem;height:1.2rem;line-height:1.2rem;border-radius:.6rem;text-align:center;opacity:0}li:hover .menuTrigger{opacity:1}li:hover .menuTrigger a{color:#757575}li.left:hover .menuTrigger{-text-shadow:#c5e1a5 0 0 15px,#c5e1a5 0 0 5px;background-image:radial-gradient(#c5e1a5 40%,transparent 75%)}li.right:hover .menuTrigger{-text-shadow:#fafafa 0 0 15px,#fafafa 0 0 5px;background-image:radial-gradient(#fafafa 40%,transparent 75%)}.blue{color:#2196f3}.red{color:#d32f2f}.gray{color:#757575}.light-gray{color:#bbb}.small{font-size:90%}.hr{display:block;width:100%;height:.6rem;min-height:.3rem;background-color:#f0f0f0;box-shadow:inset 0 .25rem .25rem -.25rem rgba(0,0,0,.15),inset 0 -.25rem .25rem -.25rem rgba(0,0,0,.15)}.group-focus{outline:none}#mountPoint{height:100%;padding-top:1rem;padding-bottom:3rem}#noscript-alertbox{position:relative;display:flex;flex-direction:column;max-width:30rem;overflow:hidden;margin-top:5rem;margin-left:auto;margin-right:auto;border-radius:.25rem;box-shadow:1px 2px .3rem grey;background-color:#fff}#noscript-title{padding:1rem;font-size:120%;font-weight:bolder;background-color:#2196f3;color:#bbdefb}#noscript-content{padding:1rem}#app-container{max-width:80rem;overflow:hidden;margin-left:auto;margin-right:auto;border-radius:.25rem;box-shadow:1px 2px .3rem grey;background-color:#fff}#app-container,#sidepanel{position:relative;display:flex;height:100%}#sidepanel{flex-direction:column;flex-grow:0;flex-shrink:0.3;width:24rem;min-width:18rem}#topic-view{width:100%}#info-view,#topic-view{display:flex;flex-direction:column;height:100%}#info-view{flex-grow:0;flex-shrink:0.3;width:24rem;min-width:18rem}@media (max-width:960px){#mountPoint{padding:0}}@media (max-width:640px){#app-container{width:100%;border-radius:0;box-shadow:none}#info-view,#sidepanel{width:100%}}.center-medium-text{width:100%;height:100%;display:flex;align-items:center;justify-content:center;text-align:center;font-size:1.4rem}.nodisplay{display:none!important}.quoted{margin-left:1.5rem}.in-place-edit{display:inline-block;font-family:inherit;font-size:1.1rem;height:2.5rem;line-height:2.25;margin:.25rem .125rem;width:100%;vertical-align:baseline;border-bottom:1px dashed #ddd;cursor:pointer}.in-place-edit.disabled{border-bottom:none;cursor:default}.in-place-edit.placeholder{color:#bbb}.in-place-edit .content{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden}table.permission-editor{width:100%}table.permission-editor td{margin:.35rem 0;font-size:1.1rem;vertical-align:middle}table.permission-editor td.checkbox{text-align:center;color:#999}.permission-editor .material-icons{font-size:1.1rem;line-height:1.1rem}.material-icons.clickable{cursor:pointer;border-bottom:none}.clickable{border-bottom:1px dashed #ddd}.clickable,.image-clickable{cursor:pointer}.panel-title{font-size:1.4rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.caption-panel{display:flex;align-items:center;flex:none;padding:.5rem;height:4rem;white-space:nowrap;box-shadow:0 1px 2px grey;z-index:1}.dialog-buttons{display:flex;padding:.5rem;justify-content:flex-end}.dialog-buttons button{margin:0 .5rem}.avatar-box{position:relative;flex-grow:0;flex-shrink:0}.bot-form{display:flex;flex-direction:column;overflow:hidden;min-width:8rem;line-height:2rem}.bot-form div{min-height:2rem;vertical-align:middle}.bot-form button{display:inline-block;margin:0;width:100%;background-color:#eef;color:#2196f3;font-size:inherit;text-transform:none;height:2rem;line-height:2rem}.bot-form>div>button{width:auto}.bot-form button:focus,button:active,button:hover{outline:0;background-color:#e3f2fd}#side-caption-panel{background-color:#2196f3;color:#bbdefb}#side-caption-panel a{color:#bbdefb;padding-left:.5rem;line-height:1}#side-caption-panel :hover{color:#fff}#sidepanel-title{margin-right:auto;margin-left:.5rem}#self-avatar{width:3rem;min-width:3rem;height:3rem;flex:none;border-radius:50%}#self-avatar.avatar-box{font-size:1.8rem}#settings-form ul{list-style:none}#settings-form li{vertical-align:middle}#settings-form label{display:inline-block;padding-left:.5rem}input.search{text-indent:1.4rem}i.search{position:absolute;left:.6rem}.alert-box{position:relative;display:none;overflow:hidden;padding:1rem 1.5rem 1rem .5rem}.alert-box .cancel{position:absolute;right:.25rem;top:.5rem}.alert-box.error{display:flex;background-color:#ffcdd2;border-bottom:1px solid #ffbfc8;color:#b71c1c}.alert-box.warning{display:flex;background-color:#fff9c4;border-bottom:1px solid #fff59d;color:#6d4c41}.alert-box.info{display:flex;background-color:#e1f5fe;border-bottom:1px solid #b3e5fc;color:#0288d1}.alert-box .cancel .material-icons{font-size:1rem;color:#757575}.alert-box.error .cancel .material-icons{color:#b71c1c}.alert-box .icon{display:block;margin-right:.5rem}.alert-box .icon .material-icons{font-size:1.5rem}.alert-box.warning .icon .material-icons{color:#fbc02d}.alert-box.error .icon .material-icons{color:#ef5350}.alert-box.info .icon .material-icons{color:#0288d1}.flex-column{display:flex;flex-direction:column;height:100%;overflow:hidden}.scrollable-panel{overflow-y:auto;margin-top:.25rem;margin-bottom:auto;height:100%}.contact-box{list-style:none;overflow-x:hidden}.contact-box>li{display:flex;position:relative;padding:.35rem .25rem .5rem .35rem;min-height:3.5rem;flex-grow:0;flex-shrink:0;border-bottom:1px solid #eee;border-collapse:collapse;overflow-x:hidden}.contact-box>li:hover{background-color:#eceff1}.contact-box>li.selected{background-color:#cfd8dc}.contact-box>li.action{min-height:2.5rem;border-bottom:none}.contact-box .text-box{overflow-x:hidden}.contact-box .contact-title{font-size:1.05rem;text-overflow:ellipsis;overflow:hidden}.contact-box .contact-comment{text-overflow:ellipsis;overflow:hidden;white-space:nowrap;font-weight:lighter}.contact-box .avatar-box{margin-right:.35rem;position:relative;width:3rem;min-width:3rem;height:3rem;min-height:3rem;font-size:1.8rem;overflow:hidden;padding:0}.contact-box .avatar{width:3rem;height:3rem;border-radius:50%}.contact-box .avatar-box>.material-icons{font-size:2.4rem;line-height:3rem}.contact-box .avatar-box>.material-icons,.contact-box .text-box{display:flex;flex-direction:column;justify-content:space-around}.contact-box .action-text{text-align:center;font-size:.95rem;line-height:2.5rem;margin:0 auto;cursor:pointer}.avatar-box .online,.offline{display:inline-block;width:.75rem;min-width:.75rem;height:.75rem;min-height:.75rem;flex-shrink:0;border-radius:50%;position:absolute;right:0;bottom:.1rem}.avatar-box .online{background-color:#4caf50}.avatar-box .offline{background-color:silver}.online.typing{animation:typing .5s infinite}@keyframes typing{0%,to{transform:translateX(0)}50%{transform:translateX(-.3rem)}}.contact-box .checkmark.material-icons{display:inline-block;width:1.5rem;height:1.5rem;font-size:1.5rem;line-height:1.5rem;color:#0097a7;position:absolute;right:.05rem;bottom:.05rem;background-color:#fff;overflow:visible;border:0 solid transparent}#add-topic{position:absolute;right:1rem;bottom:1rem}.panel-form{display:flex;flex-direction:column;padding:0}.panel-form-row{justify-content:flex-start;align-items:center}.panel-form-column,.panel-form-row{display:flex;padding:.5rem .75rem;line-height:1.5;flex-grow:0;flex-shrink:0}.panel-form-column{flex-direction:column}.panel-form-column>.panel-form-column,.panel-form-row>.panel-form-column{padding:0!important;flex-grow:1}.panel-form-column>.panel-form-row,.panel-form-row>.panel-form-row{padding:0!important}.avatar-upload{display:flex;position:relative;flex-direction:column;flex-shrink:0;width:7rem;height:9rem;margin-left:.5rem;font-size:4.5rem;padding:0}.avatar-upload .clear-avatar{position:absolute;font-size:1rem;top:0;right:0;opacity:0;background-image:radial-gradient(#fff 40%,transparent 75%)}.avatar-upload:hover .clear-avatar{opacity:1}.avatar-upload .avatar-box{position:relative;width:7rem;height:7rem}.avatar-upload .avatar-box>.material-icons{position:relative;font-size:4rem;line-height:7rem;vertical-align:middle}.avatar-upload:after{content:".";display:block;height:0;clear:both;visibility:hidden}.avatar-upload .blank{text-align:center;vertical-align:middle;border:1px dashed #999;font-size:1rem;flex-shrink:0;width:7rem;height:7rem;overflow:hidden;color:#999;line-height:7rem;border-radius:50%}.avatar-upload .preview{width:7rem;height:7rem;overflow:hidden;border-radius:50%}.avatar-upload .inputfile.hidden{width:.1px;height:.1px;opacity:0;overflow:hidden;position:absolute}.avatar-upload .inputfile+label.round{display:flex;align-items:center;justify-content:center;cursor:pointer;width:3rem;height:3rem;line-height:3rem;border-radius:50%;box-shadow:0 1px 4px rgba(0,0,0,.4);margin-left:auto;margin-right:auto;margin-top:-1rem;bottom:0;background-color:#fafafa}.avatar-upload .inputfile:focus+label.round{outline:none}.avatar-upload .inputfile+label:hover,.avatar-upload .inputfile:focus+label{background-color:#e3f2fd;color:#42a5f5}#topic-view{position:relative}#topic-caption-panel{background-color:#b0bec5}#topic-caption-panel a{color:#757575;text-decoration:none}#topic-caption-panel :hover{color:#000}#topic-caption-panel .avatar-box{position:relative;width:3rem;min-width:3rem;height:3rem;font-size:1.8rem;margin-right:.35rem}#topic-caption-panel .avatar-box>.material-icons{font-size:2.4rem;line-height:3rem}#hide-message-view{display:block;margin-right:.35rem}#topic-users{margin-left:auto;margin-right:1rem}#topic-users .avatar-box{display:inline-block;width:1.8rem;min-width:1.8rem;height:1.8rem;min-height:1.8rem;font-size:1rem;margin-right:.2rem}#messages-panel{position:relative;padding:.75rem;overflow-y:scroll;background-color:#eceff1;height:100%;background-image:url(../img/ignasi_pattern_s.png)}#messages-container{position:relative;overflow-y:hidden;height:100%}#write-only-background{position:absolute;top:0;left:0;height:100%;width:100%;background-image:repeating-linear-gradient(45deg,hsla(0,0%,100%,.5),hsla(0,0%,100%,.5) .5rem,hsla(0,0%,100%,.8) 0,hsla(0,0%,100%,.8) 1rem)}#write-only-note{position:absolute;background-color:#fff;color:#666;height:auto;width:auto;line-height:2rem;text-align:center;top:50%;left:50%;transform:translate(-50%,-50%);padding:.25rem 1.5rem;box-shadow:.1rem .1rem .1rem rgba(0,0,0,.2)}#send-message-panel{display:flex;align-items:center;flex:none;padding:.4rem .4rem .4rem .6rem;background-color:#eceff1;box-shadow:0 -1px rgba(0,0,0,.1);z-index:2;height:4rem}#sendMessage{overflow:hidden;overflow-wrap:break-word}#send-message-panel .material-icons{min-width:1.75rem}#send-message-panel .material-icons.secondary,.material-icons.disabled{color:#999!important}#send-message-panel .material-icons.secondary:hover{color:#2196f3!important}#dummy-view{width:100%;height:100%;display:flex;align-items:center;justify-content:center;background-color:#e0f7fa}#dummy-view a{text-decoration:none;display:block;text-align:center;vertical-align:middle}#image-preview{position:absolute;display:flex;flex-direction:column;top:0;left:0;width:100%;height:100%;z-index:2;background-color:hsla(0,0%,100%,.9)}#image-preview-caption-panel{display:flex;justify-content:space-between;background-color:transparent;line-height:2.5rem;height:3.5rem;padding:1rem .75rem 0}#image-preview-caption-panel a{color:#757575;text-decoration:none}#image-preview-caption-panel a:hover{color:#000}#image-preview-container{margin:auto;overflow:hidden}#image-preview-footer{display:flex;justify-content:space-around;height:3.2rem;line-height:1.5rem;background-color:transparent}.chat-box{list-style:none;padding:0 0 3.5rem;margin:0 .5rem}.chat-box.group{margin-left:-.4rem}.chat-box li{display:flex;margin:0;padding:0;align-items:flex-end}.chat-box .right{justify-content:flex-end}.chat-box .bubble{display:flex;position:relative;max-width:40rem;min-width:12rem;height:auto;padding:.75rem .5rem .75rem 1.25rem;margin:0;text-align:left;border-radius:.5rem}.chat-box li.single{margin-top:.25rem;margin-bottom:.75rem}.chat-box li.first{margin-top:.25rem;margin-bottom:.15rem}.chat-box li.middle{margin-top:.15rem;margin-bottom:.15rem}.chat-box li.last{margin-top:.15rem;margin-bottom:.75rem}.chat-box .left .bubble{background-color:#c5e1a5}.chat-box .right .bubble{background-color:#fafafa}.chat-box .left .tip:before{right:auto;left:-10px;color:#c5e1a5}.chat-box .left .tip:before,.chat-box .right .tip:before{content:"";position:absolute;width:0;height:0;top:auto;bottom:0;border:10px solid transparent;border-bottom-color:currentcolor}.chat-box .right .tip:before{display:flex;justify-content:space-between;left:auto;right:-10px;color:#fafafa}.chat-box .avatar-box{position:relative;width:1.4rem;min-width:1.4rem;height:1.4rem;min-height:1.4rem;font-size:.8rem;margin-bottom:.8rem;margin-right:.8rem}.chat-box .bubble div.message-content{color:#212121;margin:0;max-width:36rem;overflow-wrap:break-word}.chat-box .bubble div.message-content:after{content:".";display:block;height:0;clear:both;visibility:hidden}.chat-box .timestamp{display:inline-block;position:relative;font-size:80%;color:#777;padding-left:1rem;top:.5rem;float:right;white-space:nowrap}.chat-box .typing{display:inline-block;border-radius:.5rem;width:2rem;padding:.25rem .35rem;vertical-align:middle;text-align:center;color:#aaa;margin-top:.75rem}.chat-box .author{font-size:80%;color:#777}.inline-image{max-width:36rem;max-height:24rem;overflow:hidden;border-radius:.1rem;display:block}.attachment{display:flex}.attachment:last-of-type{margin-bottom:-.45rem}#info-caption-panel{background-color:#b0bec5}#info-caption-panel a{color:#757575;line-height:1;text-decoration:none}#info-caption-panel :hover{color:#000}#info-title{margin-right:auto}#group-manager{position:relative;display:flex;flex-direction:column;height:100%}#group-manager-buttons{display:flex;background-color:#eceff1;box-shadow:0 -1px rgba(0,0,0,.1);z-index:2;justify-content:space-around;padding:.4rem;height:4rem;border-left:1px solid #ccc}.dialog-overlay{position:absolute;top:0;left:0;width:100%;height:100%;z-index:10;background-color:hsla(0,0%,100%,.9)}.dialog-overlay,.modal-dialog{display:flex;flex-direction:column}.modal-dialog{justify-content:space-between;background-color:#fff;min-width:24rem;min-height:16rem;margin:auto;border-radius:.3rem;box-shadow:0 .5rem 1rem 0 rgba(0,0,0,.25)}.modal-dialog .title-panel{display:flex;justify-content:space-between;font-size:1.4rem;padding:1rem}.modal-dialog .body-panel{margin:auto .5rem}.modal-dialog .dialog-buttons{border-top:1px solid #f5f5f5;background-color:#fafafa}.modal-dialog .dialog-buttons a{display:inline-block;text-transform:uppercase;text-decoration:none;font-size:1.1rem;padding:.35rem 1.5rem}ul.tabbar{flex-shrink:0;flex-grow:0;background:#eee;list-style:none;margin:0;width:100%;overflow:hidden;padding:0 0 0 1rem}ul.tabbar>li{float:left}ul.tabbar>li>a{position:relative;padding-top:.75rem;padding-left:1rem;padding-right:1rem;display:block;text-align:center;line-height:2rem;font-weight:400;font-size:1.3rem;font-variant:small-caps;text-decoration:none;color:rgba(33,150,243,.6);overflow:hidden;box-shadow:inset 0 -2px 2.5px -1px rgba(0,0,0,.25)}ul.tabbar li.active>a{color:#2196f3}ul.tabbar li.active>a:after{height:.15rem;display:block;content:"";bottom:0;left:0;position:absolute;background:#2196f3;animation:tabbar-border-expand .2s cubic-bezier(.4,0,.4,1) 0s alternate forwards}@keyframes tabbar-border-expand{0%{opacity:0;width:0}to{opacity:1;width:100%}}.unread{font-weight:bolder;background-color:#0097a7;color:#fff;border-radius:50%;width:1.35rem;height:1.35rem;margin-left:.5rem;line-height:1.35rem;text-align:center;vertical-align:middle}.badge,.unread{display:inline-block;font-size:.75rem}.badge{font-family:Roboto Mono,Courier,monospace,sans-serif;border:1px solid #666;background-color:#eee;color:#666;padding:0 .15rem;margin-left:.1rem;margin-right:.1rem;margin-bottom:.1rem;border-radius:.15rem;align-self:flex-start}.badge.green{border-color:#383;background-color:#efe;color:#383}.badge.yellow{border-color:#660;background-color:#ffe;color:#660}.badge.blue{border-color:#339;background-color:#eef;color:#339}.badge.red{border-color:#933;background-color:#fee;color:#933}.badge.magenta{border-color:#939;background-color:#fef;color:#939}.lettertile{width:100%;padding-bottom:100%;border-radius:50%}.lettertile>div{display:flex;flex-shrink:0;flex-grow:0;position:absolute;top:0;bottom:0;left:0;right:0;text-transform:uppercase;align-items:center;justify-content:center;text-align:center;border-radius:50%;line-height:1;color:hsla(0,0%,98%,.8)}.lettertile:hover{color:#fff}.lettertile.color0{background-color:#ef9a9a}.lettertile.color1{background-color:#90caf9}.lettertile.color2{background-color:#b0bec5}.lettertile.color3{background-color:#b39ddb}.lettertile.color4{background-color:#ffab91}.lettertile.color5{background-color:#a5d6a7}.lettertile.color6{background-color:#eee}.lettertile.color7{background-color:#e6ee9c}.lettertile.color8{background-color:#c5e1a5}.lettertile.color9{background-color:#f0e57d}.lettertile.color10{background-color:#f48fb1}.lettertile.color11{background-color:#9fa8da}.lettertile.color12{background-color:#ffe082}.lettertile.color13{background-color:#bcaaa4}.lettertile.color14{background-color:#80deea}.lettertile.color15{background-color:#ce93d8}.lettertile.dark-color0{background-color:#c62828}.lettertile.dark-color1{background-color:#ad1457}.lettertile.dark-color2{background-color:#6a1b9a}.lettertile.dark-color3{background-color:#4527a0}.lettertile.dark-color4{background-color:#283593}.lettertile.dark-color5{background-color:#1565c0}.lettertile.dark-color6{background-color:#0277bd}.lettertile.dark-color7{background-color:#00838f}.lettertile.dark-color8{background-color:#00695c}.lettertile.dark-color9{background-color:#2e7d32}.lettertile.dark-color10{background-color:#558b2f}.lettertile.dark-color11{background-color:#9e9d24}.lettertile.dark-color12{background-color:#f9a825}.lettertile.dark-color13{background-color:#ff8f00}.lettertile.dark-color14{background-color:#ef6c00}.lettertile.dark-color15{background-color:#d84315}.material-icons{font-size:1.4rem;line-height:1;vertical-align:middle;text-align:center}.material-icons.small{font-size:1rem}.material-icons.big{font-size:2.4rem}#self-avatar .material-icons{font-size:2.4rem;line-height:3rem}.avatar-box .material-icons{color:hsla(0,0%,98%,.8);background-color:silver;border-radius:50%;width:inherit;height:inherit}.chip-input{display:flex;flex-wrap:wrap;flex-grow:1;cursor:text;font-size:1.1rem;font-weight:400;background:transparent;border-bottom:1px solid #ccc;box-shadow:0 1px 0 rgba(0,0,0,.1);transition:all .1s ease-in-out;max-height:10rem;min-height:4rem;overflow-y:scroll;margin:.25rem 0;outline:none;color:#666;align-items:center;justify-content:flex-start;text-align:center}.chip-input.focused{border-bottom:1px solid #2196f3;box-shadow:0 1px 0 rgba(33,150,243,.25)}.chip-input>input[type=text]{display:inline-block;width:auto;border:none;box-shadow:none;min-width:4rem;flex:1 0 auto}.chip,.chip-input>input[type=text]{line-height:1.8;height:1.8rem;margin:.125rem}.chip{display:flex;flex:0 0 auto;align-items:center;border-radius:.9rem;background-color:#eee;white-space:nowrap;font-size:90%}.chip>a{display:inline-block;color:#ccc;background-color:#aaa;border-radius:50%;margin:.3rem;width:1.175rem;height:1.175rem;line-height:1.15;text-decoration:none}.chip>a:focus,.chip>a:hover{text-decoration:none;color:#ddd;background-color:#bbb}.chip .avatar-box{position:relative;width:1.8rem;min-width:1.8rem;height:1.8rem;min-height:1.8rem;font-size:1rem;margin-right:.2rem}.chip .avatar-box .material-icons{font-size:1.4rem;line-height:1.8rem}.chip .spacer{display:inline-block;margin:.3rem;width:.25rem;height:1.175rem}.load-spinner-box{position:absolute;box-shadow:.1rem .1rem .15rem 1px rgba(0,0,0,.25);border-radius:50%;padding:.25rem;width:2.5rem;height:2.5rem;left:0;right:0;top:5rem;margin-left:auto;margin-right:auto;background-color:#fff;z-index:2}.loader-spinner{border-radius:50%;border:.35rem solid #f3f3f3;border-top-color:#1e88e5;width:2rem;height:2rem;animation:spin 1.5s linear infinite}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.uploader{display:flex}.uploader>div{position:relative;height:.6rem;padding:.15rem;margin:.35rem;width:6rem;line-height:0;border-radius:.1rem;background-color:#cfd8dc}.uploader>div>span{display:inline-block;height:.3rem;background-color:#1e88e5;border-radius:.08rem} \ No newline at end of file diff --git a/src/views/contacts-view.jsx b/src/views/contacts-view.jsx index 8e8509ca..213f3360 100644 --- a/src/views/contacts-view.jsx +++ b/src/views/contacts-view.jsx @@ -53,10 +53,13 @@ export default class ContactsView extends React.Component { updateFavicon(unreadThreads); - return {contactList: contacts, archivedCount: archivedCount}; + return { + contactList: contacts, + archivedCount: archivedCount + }; } - handleAction(action) { + handleAction(action_ignored) { this.props.onShowArchive(); } diff --git a/src/views/messages-view.jsx b/src/views/messages-view.jsx index f047fa58..53175a8e 100644 --- a/src/views/messages-view.jsx +++ b/src/views/messages-view.jsx @@ -69,18 +69,6 @@ class MessagesView extends React.Component { this.handleBackNavigation = this.handleBackNavigation.bind(this); } - // Scroll last message into view on component update e.g. on message received - // or vertical shrinking. - componentDidUpdate(prevProps, prevState) { - if (this.messagesScroller) { - if (prevState.title != this.state.title || prevState.messages.length != this.state.messages.length) { - this.messagesScroller.scrollTop = this.messagesScroller.scrollHeight - this.state.scrollPosition; - } else if (prevProps.viewportHeight > this.props.viewportHeight) { - this.messagesScroller.scrollTop += prevProps.viewportHeight - this.props.viewportHeight; - } - } - } - componentDidMount() { this.propsChange(this.props); if (this.messagesScroller) { @@ -95,13 +83,31 @@ class MessagesView extends React.Component { } } - UNSAFE_componentWillReceiveProps(nextProps) { - this.propsChange(nextProps); + // Scroll last message into view on component update e.g. on message received + // or vertical shrinking. + componentDidUpdate(prevProps, prevState) { + if (this.messagesScroller) { + if (prevState.title != this.state.title || prevState.messages.length != this.state.messages.length) { + this.messagesScroller.scrollTop = this.messagesScroller.scrollHeight - this.state.scrollPosition; + } else if (prevProps.viewportHeight > this.props.viewportHeight) { + this.messagesScroller.scrollTop += prevProps.viewportHeight - this.props.viewportHeight; + } + } } - propsChange(props) { + //static getDerivedStateFromProps(nextProps, prevState) { + // + //} + + // Deprecated! + UNSAFE_componentWillReceiveProps(nextProps) { + this.propsChange(nextProps, this.state); + } + + propsChange(props, state) { + const nextState = {}; if (!props || !props.topic) { - let oldTopic = this.state.topic; + const oldTopic = state.topic; this.setState({messages: [], onlineSubs: [], topic: null}, this.leave(oldTopic)); return; } @@ -112,15 +118,15 @@ class MessagesView extends React.Component { return; } - let topic = this.props.tinode.getTopic(props.topic); + const topic = props.tinode.getTopic(props.topic); if (!topic) { return; } let newGroupTopic = Tinode.isNewGroupTopicName(props.topic); - let tryToResubscribe = !this.props.connected && props.connected; + let tryToResubscribe = !props.connected && props.connected; - if (props.topic != this.state.topic) { + if (props.topic != state.topic) { let msgs = []; let subs = []; @@ -132,11 +138,11 @@ class MessagesView extends React.Component { topic.onSubsUpdated = this.handleSubsUpdated; topic.onPres = this.handleSubsUpdated; // Unbind the previous topic from this component. - this.leave(this.state.topic); + this.leave(state.topic); this.handleDescChange(topic); topic.subscribers((sub) => { - if (sub.online && sub.user != this.props.myUserId) { + if (sub.online && sub.user != props.myUserId) { subs.push(sub); } }); @@ -180,7 +186,7 @@ class MessagesView extends React.Component { topic.subscribe(getQuery.build(), setQuery) .then((ctrl) => { this.setState({topic: ctrl.topic}); - this.props.onNewTopicCreated(props.topic, ctrl.topic); + props.onNewTopicCreated(props.topic, ctrl.topic); // If there are unsent messages, try sending them now. topic.queuedMessages((pub) => { if (!pub._sending && topic.isSubscribed()) { @@ -189,8 +195,8 @@ class MessagesView extends React.Component { }); }) .catch((err) => { - this.props.onError(err.message, 'err'); - const {formatMessage} = this.props.intl; + props.onError(err.message, 'err'); + const {formatMessage} = props.intl; this.setState({ title: formatMessage(messages.not_found), avatar: null, diff --git a/src/views/tinode-web.jsx b/src/views/tinode-web.jsx index 75e0a16e..511f3b4c 100644 --- a/src/views/tinode-web.jsx +++ b/src/views/tinode-web.jsx @@ -104,6 +104,7 @@ class TinodeWeb extends React.Component { this.handleValidateCredentialsRequest = this.handleValidateCredentialsRequest.bind(this); this.handlePasswordResetRequest = this.handlePasswordResetRequest.bind(this); this.handleResetPassword = this.handleResetPassword.bind(this); + this.handleContextMenuAction = this.handleContextMenuAction.bind(this); } getBlankState() { @@ -1049,6 +1050,16 @@ class TinodeWeb extends React.Component { }); } + handleContextMenuAction(action, promise, params) { + if (action == 'topic_archive') { + if (promise && params.topicName && params.topicName == this.state.topicSelected) { + promise.then(() => { + this.handleTopicSelected(null); + }); + } + } + } + handleShowInfoView() { HashNavigation.navigateTo(HashNavigation.addUrlParam(window.location.hash, 'info', true)); this.setState({showInfoPanel: true}); diff --git a/src/widgets/chip-input.jsx b/src/widgets/chip-input.jsx index 685b39d7..433954da 100644 --- a/src/widgets/chip-input.jsx +++ b/src/widgets/chip-input.jsx @@ -9,13 +9,7 @@ export default class ChipInput extends React.Component { constructor(props) { super(props); - this.state = { - placeholder: props.chips ? '' : props.prompt, - sortedChips: ChipInput.sortChips(props.chips, props.required), - chipIndex: ChipInput.indexChips(props.chips), - input: '', - focused: false - }; + this.state = ChipInput.getDerivedStateFromProps(props); this.handleTextInput = this.handleTextInput.bind(this); this.removeChipAt = this.removeChipAt.bind(this); @@ -25,15 +19,21 @@ export default class ChipInput extends React.Component { this.handleKeyDown = this.handleKeyDown.bind(this); } - UNSAFE_componentWillReceiveProps(nextProps) { - this.setState({ + static getDerivedStateFromProps(nextProps, prevState) { + const state = { + placeholder: nextProps.chips ? '' : nextProps.prompt, sortedChips: ChipInput.sortChips(nextProps.chips, nextProps.required), - chipIndex: ChipInput.indexChips(nextProps.chips) - }); - if (nextProps.chips.length > this.props.chips.length) { + chipIndex: ChipInput.indexChips(nextProps.chips), + input: '', + focused: prevState && prevState.focused + }; + + if (!prevState || nextProps.chips.length > prevState.sortedChips.length) { // Chip added: clear input. - this.setState({input: ''}); + state.input =''; } + + return state; } // Map chip index to user name diff --git a/src/widgets/contact-action.jsx b/src/widgets/contact-action.jsx index b3c369ab..2636d866 100644 --- a/src/widgets/contact-action.jsx +++ b/src/widgets/contact-action.jsx @@ -18,7 +18,7 @@ class ContactAction extends React.PureComponent { render() { const {formatMessage} = this.props.intl; return ( -
  • +
  • {formatMessage(this.props.title, this.props.values)}
  • ); diff --git a/src/widgets/context-menu.jsx b/src/widgets/context-menu.jsx index 689e6e5b..138a4646 100644 --- a/src/widgets/context-menu.jsx +++ b/src/widgets/context-menu.jsx @@ -80,66 +80,133 @@ class ContextMenu extends React.Component { // Preconfigured menu items. this.MenuItems = { - 'topic_info': {title: formatMessage(messages.info), handler: null}, - - 'messages_clear': {title: formatMessage(messages.clear_messages), handler: (params, errorHandler) => { - this.deleteMessages(true, false, params, errorHandler); - }}, - 'messages_clear_hard': {title: formatMessage(messages.clear_for_all), handler: (params, errorHandler) => { - this.deleteMessages(true, true, params, errorHandler); - }}, - 'message_delete': {title: formatMessage(messages.delete), handler: (params, errorHandler) => { - this.deleteMessages(false, false, params, errorHandler); - }}, - 'message_delete_hard': {title: formatMessage(messages.delete_for_all), handler: (params, errorHandler) => { - this.deleteMessages(false, true, params, errorHandler); - }}, - 'topic_unmute': {title: formatMessage(messages.unmute), handler: this.topicPermissionSetter.bind(this, '+P')}, - 'topic_mute': {title: formatMessage(messages.mute), handler: this.topicPermissionSetter.bind(this, '-P')}, - 'topic_unblock': {title: formatMessage(messages.unblock), handler: this.topicPermissionSetter.bind(this, '+J')}, - 'topic_block': {title: formatMessage(messages.block), handler: this.topicPermissionSetter.bind(this, '-J')}, - 'topic_delete': {title: formatMessage(messages.topic_delete), handler: (params, errorHandler) => { - const topic = this.props.tinode.getTopic(params.topicName); - if (!topic) { - console.log("Topic not found: ", params.topicName); - return; + 'topic_info': { + id: 'topic_info', + title: formatMessage(messages.info), + handler: null + }, + 'messages_clear': { + id: 'messages_clear', + title: formatMessage(messages.clear_messages), + handler: (params, errorHandler) => { + return this.deleteMessages(true, false, params, errorHandler); } - topic.delTopic().catch((err) => { - if (errorHandler) { - errorHandler(err.message, 'err'); - } - }); - }}, - 'topic_archive': {title: formatMessage(messages.archive), handler: (params, errorHandler) => { - const topic = this.props.tinode.getTopic(params.topicName); - if (!topic) { - console.log("Topic not found: ", params.topicName); - return; + }, + 'messages_clear_hard': { + id: 'messages_clear_hard', + title: formatMessage(messages.clear_for_all), + handler: (params, errorHandler) => { + return this.deleteMessages(true, true, params, errorHandler); } - topic.archive(true).catch((err) => { - if (errorHandler) { - errorHandler(err.message, 'err'); + }, + 'message_delete': { + id: 'message_delete', + title: formatMessage(messages.delete), + handler: (params, errorHandler) => { + return this.deleteMessages(false, false, params, errorHandler); + } + }, + 'message_delete_hard': { + id: 'message_delete_hard', + title: formatMessage(messages.delete_for_all), + handler: (params, errorHandler) => { + return this.deleteMessages(false, true, params, errorHandler); + } + }, + 'topic_unmute': { + id: 'topic_unmute', + title: formatMessage(messages.unmute), + handler: this.topicPermissionSetter.bind(this, '+P') + }, + 'topic_mute': { + id: 'topic_mute', + title: formatMessage(messages.mute), + handler: this.topicPermissionSetter.bind(this, '-P') + }, + 'topic_unblock': { + id: 'topic_unblock', + title: formatMessage(messages.unblock), + handler: this.topicPermissionSetter.bind(this, '+J') + }, + 'topic_block': { + id: 'topic_block', + title: formatMessage(messages.block), + handler: this.topicPermissionSetter.bind(this, '-J') + }, + 'topic_delete': { + id: 'topic_delete', + title: formatMessage(messages.topic_delete), + handler: (params, errorHandler) => { + const topic = this.props.tinode.getTopic(params.topicName); + if (!topic) { + console.log("Topic not found: ", params.topicName); + return; } - }); - }}, + return topic.delTopic().catch((err) => { + if (errorHandler) { + errorHandler(err.message, 'err'); + } + }); + } + }, + 'topic_archive': { + id: 'topic_archive', + title: formatMessage(messages.archive), + handler: (params, errorHandler) => { + const topic = this.props.tinode.getTopic(params.topicName); + if (!topic) { + console.log("Topic not found: ", params.topicName); + return; + } + return topic.archive(true).catch((err) => { + if (errorHandler) { + errorHandler(err.message, 'err'); + } + }); + } + }, // menu_item_edit_permissions is defined elsewhere. - 'permissions': {title: formatMessage({id: 'menu_item_edit_permissions'}), handler: null}, - 'member_delete': {title: formatMessage(messages.member_delete), handler: (params, errorHandler) => { - const topic = this.props.tinode.getTopic(params.topicName); - if (!topic || !params.user) { - console.log("Topic or user not found: '" + params.topicName + "', '" + params.user + "'"); - return; - } - topic.delSubscription(params.user).catch((err) => { - if (errorHandler) { - errorHandler(err.message, 'err'); + 'permissions': { + id: 'permissions', + title: formatMessage({id: 'menu_item_edit_permissions'}), + handler: null + }, + 'member_delete': { + id: 'member_delete', + title: formatMessage(messages.member_delete), + handler: (params, errorHandler) => { + const topic = this.props.tinode.getTopic(params.topicName); + if (!topic || !params.user) { + console.log("Topic or user not found: '" + params.topicName + "', '" + params.user + "'"); + return; } - }); - }}, - 'member_mute': {title: formatMessage(messages.mute), handler: this.topicPermissionSetter.bind(this, '-P')}, - 'member_unmute': {title: formatMessage(messages.unmute), handler: this.topicPermissionSetter.bind(this, '+P')}, - 'member_block': {title: formatMessage(messages.block), handler: this.topicPermissionSetter.bind(this, '-J')}, - 'member_unblock': {title: formatMessage(messages.unblock), handler: this.topicPermissionSetter.bind(this, '+J')}, + return topic.delSubscription(params.user).catch((err) => { + if (errorHandler) { + errorHandler(err.message, 'err'); + } + }); + } + }, + 'member_mute': { + id: 'member_mute', + title: formatMessage(messages.mute), + handler: this.topicPermissionSetter.bind(this, '-P') + }, + 'member_unmute': { + id: 'member_unmute', + title: formatMessage(messages.unmute), + handler: this.topicPermissionSetter.bind(this, '+P') + }, + 'member_block': { + id: 'member_block', + title: formatMessage(messages.block), + handler: this.topicPermissionSetter.bind(this, '-J') + }, + 'member_unblock': { + id: 'member_unblock', + title: formatMessage(messages.unblock), + handler: this.topicPermissionSetter.bind(this, '+J') + }, }; } @@ -176,7 +243,15 @@ class ContextMenu extends React.Component { if (typeof item == 'string') { item = this.MenuItems[item]; } - item.handler(this.props.params, this.props.onError); + + if (!item) { + console.log("Invalid menu item ID", e.currentTarget.dataset.id); + } else { + this.props.onAction( + item.id, + item.handler(this.props.params, this.props.onError), + this.props.params); + } } // Menu Actions @@ -200,7 +275,7 @@ class ContextMenu extends React.Component { topic.delMessagesAll(hard) : topic.delMessagesList([params.seq], hard); - promise.catch((err) => { + return promise.catch((err) => { if (errorHandler) { errorHandler(err.message, 'err'); } @@ -227,7 +302,7 @@ class ContextMenu extends React.Component { am = topic.getAccessMode().updateWant(mode).getWant(); } - topic.setMeta({sub: {user: params.user, mode: am}}).catch((err) => { + return topic.setMeta({sub: {user: params.user, mode: am}}).catch((err) => { if (errorHandler) { errorHandler(err.message, 'err'); } diff --git a/umd/index.dev.js b/umd/index.dev.js index 03f5bc97..bbc24a00 100644 --- a/umd/index.dev.js +++ b/umd/index.dev.js @@ -93,7 +93,7 @@ /*! no static exports found */ /***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(global) {!function(e){if(true)module.exports=e();else {}}(function(){var e={exports:{}},t=[{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)/}],n=[{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}],i={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},FM:{name:"div",isVoid:!1},RW:{name:"div",isVoid:!1},BN:{name:"button",isVoid:!1},HD:{name:"",isVoid:!1}};function s(e,t){var n;try{for(var i=(n=atob(e)).length,s=new ArrayBuffer(i),r=new Uint8Array(s),o=0;o"},close:function(){return""}},EM:{open:function(){return""},close:function(){return""}},DL:{open:function(){return""},close:function(){return""}},CO:{open:function(){return""},close:function(){return""}},BR:{open:function(){return"
    "},close:function(){return""}},HD:{open:function(){return""},close:function(){return""}},LN:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{href:e.url,target:"_blank"}:null}},MN:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{name:e.val}:null}},HT:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{name:e.val}:null}},BN:{open:function(e){return""},props:function(e){return e?{"data-act":e.act,"data-val":e.val,"data-name":e.name,"data-ref":e.ref}:null}},IM:{open:function(e){var t=s(e.val,e.mime),n=e.ref?e.ref:t;return(e.name?'':"")+''},close:function(e){return e.name?"":""},props:function(e){return e?{src:s(e.val,e.mime),title:e.name,"data-width":e.width,"data-height":e.height,"data-name":e.name,"data-size":e.val?.75*e.val.length|0:0,"data-mime":e.mime}:null}},FM:{open:function(e){return"
    "},close:function(e){return"
    "}},RW:{open:function(e){return"
    "},close:function(e){return"
    "}}},o=function(){};o.parse=function(e){if("string"!=typeof e)return null;var i=e.split(/\r?\n/),s=[],r={},o=[];i.map(function(e){var i,a,c=[];if(t.map(function(t){c=c.concat(function(e,t,n,i){for(var s=[],r=0,o=e.slice(0);o.length>0;){var a=t.exec(o);if(null==a)break;var c=a.index+a[0].lastIndexOf(a[1]);o=o.slice(c+1),r=(c+=r)+1;var u=n?n.exec(o):null;if(null==u)break;var h=u.index+u[0].indexOf(u[1]);o=o.slice(h+1),r=(h+=r)+1,s.push({text:e.slice(c+1,h),children:[],start:c,end:h,type:i})}return s}(e,t.start,t.end,t.name))}),0==c.length)a={txt:e};else{c.sort(function(e,t){return e.start-t.start}),c=function e(t){if(0==t.length)return[];for(var n=[t[0]],i=t[0],s=1;si.end?(n.push(t[s]),i=t[s]):t[s].endn&&r.push({text:t.slice(n,a.start)});var c={type:a.type},u=e(t,a.start+1,a.end-1,a.children);u.length>0?c.children=u:c.text=a.text,r.push(c),n=a.end+1}return ns;return s=e.offset+e.len,t})}(a.txt)).length>0){var h=[];for(var l in i){var d=i[l],f=r[d.unique];f||(f=s.length,r[d.unique]=f,s.push({tp:d.type,data:d.data})),h.push({at:d.offset,len:d.len,key:f})}a.ent=h}o.push(a)});var a={txt:""};if(o.length>0){a.txt=o[0].txt,a.fmt=(o[0].fmt||[]).concat(o[0].ent||[]);for(var c=1;c0&&(a.ent=s)}return a},o.insertImage=function(e,t,n,i,s,r,o,a,c){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:i,width:s,height:r,name:o,ref:c,size:0|a}}),e},o.appendImage=function(e,t,n,i,s,r,a,c){return(e=e||{txt:""}).txt+=" ",o.insertImage(e,e.txt.length-1,t,n,i,s,r,a,c)},o.attachFile=function(e,t,n,i,s,r){(e=e||{txt:""}).ent=e.ent||[],e.fmt=e.fmt||[],e.fmt.push({at:-1,len:0,key:e.ent.length});var o={tp:"EX",data:{mime:t,val:n,name:i,ref:r,size:0|s}};return r instanceof Promise&&(o.data.ref=r.then(function(e){o.data.ref=e},function(e){})),e.ent.push(o),e},o.wrapAsForm=function(e,t,n){return"string"==typeof e&&(e={txt:e}),e.fmt=e.fmt||[],e.fmt.push({at:t,len:n,tp:"FM"}),e},o.insertButton=function(e,t,n,i,s,r,o){return"string"==typeof e&&(e={txt:e}),!e||!e.txt||e.txt.length0)for(var t in e.ent)if(e.ent[t]&&"EX"==e.ent[t].tp)return!0;return!1},o.attachments=function(e,t,n){if(e.ent&&e.ent.length>0)for(var i in e.ent)e.ent[i]&&"EX"==e.ent[i].tp&&t.call(n,e.ent[i].data,i)},o.getDownloadUrl=function(e){var t=null;return"application/json"!=e.mime&&e.val?t=s(e.val,e.mime):"string"==typeof e.ref&&(t=e.ref),t},o.isUploading=function(e){return e.ref instanceof Promise},o.getPreviewUrl=function(e){return e.val?s(e.val,e.mime):null},o.getEntitySize=function(e){return e.size?e.size:e.val?.75*e.val.length|0:0},o.getEntityMimeType=function(e){return e.mime||"text/plain"},o.tagName=function(e){return i[e]?i[e].name:void 0},o.attrValue=function(e,t){if(t&&r[e])return r[e].props(t)},o.getContentType=function(){return"text/x-drafty"},e.exports=o,e=e.exports;var a="0.15.12",c={exports:{}};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)}if(true)var i=a;var s;"undefined"!=typeof WebSocket&&(s=WebSocket),"undefined"==typeof btoa&&(t.btoa=function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n="",i=0,s=0,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(0|s)||(r="=",s%1);n+=r.charAt(63&i>>8-s%1*8)){if((e=t.charCodeAt(s+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i=i<<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,i=0,s=0,r=0;n=e.charAt(r++);~n&&(s=i%4?64*s+n:n,i++%4)?t+=String.fromCharCode(255&s>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return t}),"undefined"==typeof window&&(t.window={WebSocket:s,URL:{createObjectURL:function(){throw new Error("Unable to use window.URL in a non browser application")}}});var r="0",o=i||"0.15",u="tinodejs/"+o,h=503,l="Connection failed",d=418,f="Disconnected by client";function p(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}function g(e,t,i){if("object"!=n(t)){if(t===M.DEL_CHAR)return;return t}if(null===t)return t;if(t instanceof Date)return t;if(t instanceof T)return new T(t);if(t instanceof Array)return t;for(var s in e&&e!==M.DEL_CHAR||(e=t.constructor()),t)!t.hasOwnProperty(s)||i&&i[s]||"_generated"==s||(e[s]=g(e[s],t[s]));return e}function v(e,t,n,i){return e[t]=g(e[t],n,i),e[t]}function m(){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 _(e,t){if("ts"===e&&"string"==typeof t&&t.length>=20&&t.length<=24){var i=new Date(t);if(i)return i}else if("acs"===e&&"object"===n(t))return new T(t);return t}function b(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 w(e,t,n){var i=null;return"http"!==t&&"https"!==t&&"ws"!==t&&"wss"!==t||(i=t+"://","/"!==(i+=e).charAt(i.length-1)&&(i+="/"),i+="v"+r+"/channels","http"!==t&&"https"!==t||(i+="/lp"),i+="?apikey="+n),i}var S=function(e,t,i,r,o){var a=this,c=e,u=r,p=t,g=o,v=2e3,b=10,S=.3,M=null,y=0,T=!1,D=function(e){a.logger&&a.logger(e)};function x(){var e=this;clearTimeout(M);var t=v*(Math.pow(2,y)*(1+S*Math.random()));y=y>=b?y:y+1,this.onAutoreconnectIteration&&this.onAutoreconnectIteration(t),M=setTimeout(function(){if(D("Reconnecting, iter="+y+", timeout="+t),T)e.onAutoreconnectIteration&&e.onAutoreconnectIteration(-1);else{var n=e.connect();e.onAutoreconnectIteration?e.onAutoreconnectIteration(0,n):n.catch(function(){})}},t)}function E(){clearTimeout(M),M=null,y=0}function A(e){var t=null;e.connect=function(n){return T=!1,t&&t.readyState==t.OPEN?Promise.resolve():(n&&(c=n),new Promise(function(n,i){var r=w(c,u?"wss":"ws",p);D("Connecting to: "+r);var o=new s(r);o.onopen=function(t){e.onOpen&&e.onOpen(),n(),g&&E()},o.onclose=function(n){if(t=null,e.onDisconnect){var i=T?d:h;e.onDisconnect(new Error(T?f:l+" ("+i+")"),i)}!T&&g&&x.call(e)},o.onerror=function(e){i(e)},o.onmessage=function(t){e.onMessage&&e.onMessage(t.data)},t=o}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,t&&(E(),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&&t.readyState==t.OPEN},e.transport=function(){return"ws"},e.probe=function(){e.sendText("1")}}function R(e){var t=null,n=null,i=null;e.connect=function(i){return T=!1,n?Promise.resolve():(i&&(c=i),new Promise(function(i,s){var r=w(c,u?"https":"http",p);D("Connecting to: "+r),(n=function n(i,s,r){var o=m(),a=!1;return o.onreadystatechange=function(c){if(4==o.readyState)if(201==o.status){var u=JSON.parse(o.responseText,_);t=i+"&sid="+u.ctrl.params.sid,(o=n(t)).send(null),e.onOpen&&e.onOpen(),s&&(a=!0,s()),g&&E()}else if(o.status<400)e.onMessage&&e.onMessage(o.responseText),(o=n(t)).send(null);else{if(r&&!a&&(a=!0,r(o.responseText)),e.onMessage&&o.responseText&&e.onMessage(o.responseText),e.onDisconnect){var p=o.status||(T?d:h),v=o.responseText||(T?f:l);e.onDisconnect(new Error(v+" ("+p+")"),p)}o=null,!T&&g&&x.call(e)}},o.open("GET",i,!0),o}(r,i,s)).send(null)}).catch(function(){}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,E(),i&&(i.onreadystatechange=void 0,i.abort(),i=null),n&&(n.onreadystatechange=void 0,n.abort(),n=null),e.onDisconnect&&e.onDisconnect(new Error(f+" ("+d+")"),d),t=null},e.sendText=function(e){var n,s;if(n=t,(s=m()).onreadystatechange=function(e){if(4==s.readyState&&s.status>=400)throw new Error("LP sender failed, "+s.status)},s.open("POST",n,!0),!(i=s)||1!=i.readyState)throw new Error("Long poller failed to connect");i.send(e)},e.isConnected=function(){return n&&!0},e.transport=function(){return"lp"},e.probe=function(){e.sendText("1")}}"lp"===i?R(this):"ws"===i?A(this):"object"==("undefined"==typeof window?"undefined":n(window))&&window.WebSocket?A(this):R(this),this.onMessage=void 0,this.onDisconnect=void 0,this.onOpen=void 0,this.onAutoreconnectIteration=void 0,this.logger=void 0},M=function(e,t,i,s,r,a){var c=this;this._appName=e||"Undefined",this._apiKey=i,this._browser="",this._platform=a,this._hwos="undefined",this._humanLanguage="xx","undefined"!=typeof navigator&&(this._browser=function(e,t){e=e||"";var n="";/reactnative/i.test(t)&&(n="ReactNative; ");var i,s=(e=e.replace(" (KHTML, like Gecko)","")).match(/(AppleWebKit\/[.\d]+)/i);if(s){for(var r=["chrome","safari","mobile","version"],o=e.substr(s.index+s[0].length).split(" "),a=[],c=function(e){var t=/([\w.]+)[\/]([\.\d]+)/.exec(o[e]);t&&a.push([t[1],t[2],r.findIndex(function(e){return e==t[1].toLowerCase()})])},u=0;u0?a[0][0]+"/"+a[0][1]:s[1]}else i=/trident/i.test(e)?(s=/(?:\brv[ :]+([.\d]+))|(?:\bMSIE ([.\d]+))/g.exec(e))?"MSIE/"+(s[1]||s[2]):"MSIE/?":/firefox/i.test(e)?(s=/Firefox\/([.\d]+)/g.exec(e))?"Firefox/"+s[1]:"Firefox/?":/presto/i.test(e)?(s=/Opera\/([.\d]+)/g.exec(e))?"Opera/"+s[1]:"Opera/?":(s=/([\w.]+)\/([.\d]+)/.exec(e))?s[1]+"/"+s[2]:(s=e.split(" "))[0];if((s=i.split("/")).length>1){var h=s[1].split(".");i=s[0]+"/"+h[0]+(h[1]?"."+h[1]:"")}return n+i}(navigator.userAgent,navigator.product),this._hwos=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 S(t,i,s,r,!0),this.logger=function(e){if(c._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 l=this.cachePut=function(e,t,n){c._cache[e+":"+t]=n},d=this.cacheGet=function(e,t){return c._cache[e+":"+t]},f=this.cacheDel=function(e,t){delete c._cache[e+":"+t]},p=this.cacheMap=function(e,t){for(var n in c._cache)if(e(c._cache[n],n,t))break};this.attachCacheToTopic=function(e){e._tinode=c,e._cacheGetUser=function(e){var t=d("user",e);if(t)return{user:e,public:g({},t)}},e._cachePutUser=function(e,t){return l("user",e,g({},t.public))},e._cacheDelUser=function(e){return f("user",e)},e._cachePutSelf=function(){return l("topic",e.name,e)},e._cacheDelSelf=function(){return f("topic",e.name)}};var v=function(e,t,n,i){var s=c._pendingPromises[e];s&&(delete c._pendingPromises[e],t>=200&&t<400?s.resolve&&s.resolve(n):s.reject&&s.reject(new Error("Error: "+i+" ("+t+")")))},m=this.getNextUniqueId=function(){return 0!=c._messageId?""+c._messageId++:void 0};this.initPacket=function(e,t){switch(e){case"hi":return{hi:{id:m(),ver:o,ua:c._appName+" ("+(c._browser?c._browser+"; ":"")+c._hwos+"); "+u,dev:c._deviceToken,lang:c._humanLanguage,platf:c._platform}};case"acc":return{acc:{id:m(),user:null,scheme:null,secret:null,login:!1,tags:null,desc:{},cred:{}}};case"login":return{login:{id:m(),scheme:null,secret:null}};case"sub":return{sub:{id:m(),topic:t,set:{},get:{}}};case"leave":return{leave:{id:m(),topic:t,unsub:!1}};case"pub":return{pub:{id:m(),topic:t,noecho:!1,head:null,content:{}}};case"get":return{get:{id:m(),topic:t,what:null,desc:{},sub:{},data:{}}};case"set":return{set:{id:m(),topic:t,desc:{},sub:{},tags:[]}};case"del":return{del:{id:m(),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 i;t&&(i=function(e){var t=null;return e&&(t=new Promise(function(t,n){c._pendingPromises[e]={resolve:t,reject:n}})),t}(t)),e=function e(t){return Object.keys(t).forEach(function(i){"_"==i[0]?delete t[i]:t[i]?Array.isArray(t[i])&&0==t[i].length?delete t[i]:t[i]?"object"!=n(t[i])||t[i]instanceof Date||(e(t[i]),0==Object.getOwnPropertyNames(t[i]).length&&delete t[i]):delete t[i]:delete t[i]}),t}(e);var s=JSON.stringify(e);c.logger("out: "+(c._trimLongStrings?JSON.stringify(e,b):s));try{c._connection.sendText(s)}catch(e){if(!t)throw e;v(t,h,null,e.message)}return i},this.loginSuccessful=function(e){e.params&&e.params.user&&(c._myUID=e.params.user,c._authenticated=e&&e.code>=200&&e.code<300,e.params&&e.params.token&&e.params.expires?c._authToken={token:e.params.token,expires:new Date(e.params.expires)}:c._authToken=null,c.onLogin&&c.onLogin(e.code,e.text))},this._connection.onMessage=function(e){if(e)if(c._inPacketCount++,c.onRawMessage&&c.onRawMessage(e),"0"!==e){var t=JSON.parse(e,_);if(t)if(c.logger("in: "+(c._trimLongStrings?JSON.stringify(t,b):e)),c.onMessage&&c.onMessage(t),t.ctrl){if(c.onCtrlMessage&&c.onCtrlMessage(t.ctrl),t.ctrl.id&&v(t.ctrl.id,t.ctrl.code,t.ctrl,t.ctrl.text),t.ctrl.params&&"data"==t.ctrl.params.what){var n=d("topic",t.ctrl.topic);n&&n._allMessagesReceived(t.ctrl.params.count)}}else if(t.meta){var i=d("topic",t.meta.topic);i&&i._routeMeta(t.meta),c.onMetaMessage&&c.onMetaMessage(t.meta)}else if(t.data){var s=d("topic",t.data.topic);s&&s._routeData(t.data),c.onDataMessage&&c.onDataMessage(t.data)}else if(t.pres){var r=d("topic",t.pres.topic);r&&r._routePres(t.pres),c.onPresMessage&&c.onPresMessage(t.pres)}else if(t.info){var o=d("topic",t.info.topic);o&&o._routeInfo(t.info),c.onInfoMessage&&c.onInfoMessage(t.info)}else c.logger("ERROR: Unknown packet received.");else c.logger("in: "+e),c.logger("ERROR: failed to parse data")}else c.onNetworkProbe&&c.onNetworkProbe()},this._connection.onOpen=function(){c.hello()},this._connection.onAutoreconnectIteration=function(e,t){c.onAutoreconnectIteration&&c.onAutoreconnectIteration(e,t)},this._connection.onDisconnect=function(e,t){for(var n in c._inPacketCount=0,c._serverInfo=null,c._authenticated=!1,c._pendingPromises){var i=c._pendingPromises[n];i&&i.reject&&i.reject(e)}c._pendingPromises={},p(function(e,t){0===t.lastIndexOf("topic:",0)&&e._resetSub()}),c.onDisconnect&&c.onDisconnect(e)}};M.credential=function(e,t,i,s){if("object"==n(e)){var r=e;t=r.val,i=r.params,s=r.resp,e=r.meth}return e&&(t||s)?[{meth:e,val:t,resp:s,params:i}]:null},M.topicType=function(e){return{me:"me",fnd:"fnd",grp:"grp",new:"grp",usr:"p2p"}["string"==typeof e?e.substring(0,3):"xxx"]},M.isNewGroupTopicName=function(e){return"string"==typeof e&&"new"==e.substring(0,3)},M.getVersion=function(){return o},M.setWebSocketProvider=function(e){s=e},M.getLibrary=function(){return u},M.MESSAGE_STATUS_NONE=0,M.MESSAGE_STATUS_QUEUED=1,M.MESSAGE_STATUS_SENDING=2,M.MESSAGE_STATUS_FAILED=3,M.MESSAGE_STATUS_SENT=4,M.MESSAGE_STATUS_RECEIVED=5,M.MESSAGE_STATUS_READ=6,M.MESSAGE_STATUS_TO_ME=7,M.DEL_CHAR="\u2421",M.prototype={connect:function(e){return this._connection.connect(e)},reconnect:function(){this._connection.reconnect()},disconnect:function(){this._connection.disconnect()},networkProbe:function(){this._connection.probe()},isConnected:function(){return this._connection.isConnected()},isAuthenticated:function(){return this._authenticated},account:function(e,t,n,i,s){var r=this.initPacket("acc");return r.acc.user=e,r.acc.scheme=t,r.acc.secret=n,r.acc.login=i,s&&(r.acc.desc.defacs=s.defacs,r.acc.desc.public=s.public,r.acc.desc.private=s.private,r.acc.tags=s.tags,r.acc.cred=s.cred,r.acc.token=s.token),this.send(r,r.acc.id)},createAccount:function(e,t,n,i){var s=this,r=this.account("new",e,t,n,i);return n&&(r=r.then(function(e){return s.loginSuccessful(e),e})),r},createAccountBasic:function(e,t,n){return e=e||"",t=t||"",this.createAccount("basic",p(e+":"+t),!0,n)},updateAccountBasic:function(e,t,n,i){return t=t||"",n=n||"",this.account(e,"basic",p(t+":"+n),!1,i)},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 i=this,s=this.initPacket("login");return s.login.scheme=e,s.login.secret=t,s.login.cred=n,this.send(s,s.login.id).then(function(e){return i.loginSuccessful(e),e})},loginBasic:function(e,t,n){var i=this;return this.login("basic",p(e+":"+t),n).then(function(t){return i._login=e,t})},loginToken:function(e,t){return this.login("token",e,t)},requestResetAuthSecret:function(e,t,n){return this.login("reset",p(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 i=this.initPacket("sub",e);return e||(e="new"),i.sub.get=t,n&&(n.sub&&(i.sub.set.sub=n.sub),M.isNewGroupTopicName(e)&&n.desc&&(i.sub.set.desc=n.desc),n.tags&&(i.sub.set.tags=n.tags)),this.send(i,i.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,i){var s=this.initPacket("pub",t),r="string"==typeof n?e.parse(n):n;return r&&!e.isPlainText(r)&&(s.pub.head={mime:e.getContentType()},n=r),s.pub.noecho=i,s.pub.content=n,s.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=g(n.get,t),this.send(n,n.get.id)},setMeta:function(e,t){var n=this.initPacket("set",e),i=[];return t&&["desc","sub","tags"].map(function(e){t.hasOwnProperty(e)&&(i.push(e),n.set[e]=t[e])}),0==i.length?Promise.reject(new Error("Invalid {set} parameters")):this.send(n,n.set.id)},delMessages:function(e,t,n){var i=this.initPacket("del",e);return i.del.what="msg",i.del.delseq=t,i.del.hard=n,this.send(i,i.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 i=this.initPacket("note",e);i.note.what=t,i.note.seq=n,this.send(i)},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 x:"fnd"==e?new E:new D(e),this.cachePut("topic",e,t),this.attachCacheToTopic(t)),t},newTopic:function(e){var t=new D("new",e);return this.attachCacheToTopic(t),t},newGroupTopicName:function(){return"new"+this.getNextUniqueId()},newTopicWith:function(e,t){var n=new D(e,t);return this.attachCacheToTopic(n),n},getMeTopic:function(){return this.getTopic("me")},getFndTopic:function(){return this.getTopic("fnd")},getLargeFileHelper:function(){return new A(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,onNetworkProbe:void 0,onAutoreconnectIteration:void 0};var y=function(e){this.topic=e;var t=e._tinode.getMeTopic();this.contact=t&&t.getContact(e.name),this.what={}};y.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 i={ims:e,limit:t};return"me"==this.topic.getType()?i.topic=n:i.user=n,this.what.sub=i,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=this,n={};return["data","sub","desc","tags","del"].map(function(i){t.what.hasOwnProperty(i)&&(e.push(i),Object.getOwnPropertyNames(t.what[i]).length>0&&(n[i]=t.what[i]))}),e.length>0?n.what=e.join(" "):n=void 0,n}};var T=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)};T._NONE=0,T._JOIN=1,T._READ=2,T._WRITE=4,T._PRES=8,T._APPROVE=16,T._SHARE=32,T._DELETE=64,T._OWNER=128,T._BITMASK=T._JOIN|T._READ|T._WRITE|T._PRES|T._APPROVE|T._SHARE|T._DELETE|T._OWNER,T._INVALID=1048576,T.decode=function(e){if(!e)return null;if("number"==typeof e)return e&T._BITMASK;if("N"===e||"n"===e)return T._NONE;for(var t={J:T._JOIN,R:T._READ,W:T._WRITE,P:T._PRES,A:T._APPROVE,S:T._SHARE,D:T._DELETE,O:T._OWNER},n=T._NONE,i=0;i0)){c=!0;break}r=o-1}return c?o:i?-1:a<0?o+1:o}return e=e||function(e,t){return e===t?0:e0)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,i,s){n|=0,i=i||t.length;for(var r=n;r=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 i=n._tinode.getMeTopic();i&&i._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 i=[];e.attachments(t.content,function(e){i.push(e.ref)}),t.head.attachments=i}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 i=e.seq||this._getQueuedSeqId();return e._generated||(e._generated=!0,e.seq=i,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,i=this.startMetaQuery();t?i.withLaterData(e):i.withEarlierData(e);var s=this.getMeta(i.build());return t||(s=s.then(function(e){e&&e.params&&!e.params.count&&(n._noEarlierMsgs=!0)})),s},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,i=e.length;n1&&t.push(s)}t.sort().filter(function(e,t,n){return!t||e!=n[t-1]})}return 0==t.length&&t.push(M.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}})},archive:function(e){return this.setMeta({desc:{private:{arch:!!e||M.DEL_CHAR}}})},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.hi)});var i=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(i.length>0?this._tinode.delMessages(this.name,i,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]0){var i=this._tinode.getCurrentUserID();for(var s in this._users){var r=this._users[s];r.user!==i&&r[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),i=this.msgStatus(n);if(1==i||3==i)return n._cancelled=!0,this._messages.delAt(t),this.onData&&this.onData(),!0}return!1},getType:function(){return M.topicType(this.name)},getAccessMode:function(){return this.acs},getDefaultAccess:function(){return this.defacs},startMetaQuery:function(){return new y(this)},isArchived:function(){return!(!this.private||!this.private.arch)},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.touchedthis._maxSeq&&(this._maxSeq=e.seq),(e.seq0&&(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!=T._NONE||("p2p"==this.getType()&&this.leave(),this._processMetaSub([{user:n,deleted:new Date,_generated:!0}]));else{var i=(new T).updateAll(e.dacs);i&&i.mode!=T._NONE&&((t=this._cacheGetUser(n))?t.acs=i:(t={user:n,acs:i},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);var n=this._tinode.getMeTopic();n&&n.setMsgReadRecv(e.from,e.what,e.seq)}this.onInfo&&this.onInfo(e)},_processMetaDesc:function(e,t){if(g(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){console.log("_processMetaDesc routing to 'me'",this.private);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 i=e[n];if(i.user){i.updated=new Date(i.updated),i.deleted=i.deleted?new Date(i.deleted):null;var s=null;i.deleted?(delete this._users[i.user],s=i):s=this._updateCachedUser(i.user,i,i._generated),this.onMetaSub&&this.onMetaSub(s)}else i._generated||(t=i)}t&&this.onMetaDesc&&this.onMetaDesc(t),this.onSubsUpdated&&this.onSubsUpdated(Object.keys(this._users))},_processMetaTags:function(e){1==e.length&&e[0]==M.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,i=0;Array.isArray(t)&&t.map(function(e){if(e.hi)for(var t=e.low;t0&&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 T(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 i=this._cacheGetUser(e);return i?i=g(i,t):(n&&this.getMeta(this.startMetaQuery().withLaterOneSub(e).build()),i=g({},t)),this._cachePutUser(e,i),v(this._users,e,i)},_getQueuedSeqId:function(){return this._queuedSeqId++}};var x=function(e){D.call(this,"me",e),this._contacts={},e&&(this.onContactUpdate=e.onContactUpdate)};x.prototype=Object.create(D.prototype,{_processMetaSub:{value:function(e){var t=0;for(var n in e){var i=e[n],s=i.topic;if("fnd"!=s&&"me"!=s){i.updated=new Date(i.updated),i.touched=i.touched?new Date(i.touched):null,i.deleted=i.deleted?new Date(i.deleted):null,i.seq=0|i.seq,i.recv=0|i.recv,i.read=0|i.read,i.unread=i.seq-i.read;var r=null;if(i.deleted)r=i,delete this._contacts[s];else if(i.seen&&i.seen.when&&(i.seen.when=new Date(i.seen.when)),r=v(this._contacts,s,i),"p2p"==M.topicType(s)&&this._cachePutUser(s,r),!i._generated){var o=this._tinode.getTopic(s);o&&o._processMetaDesc(i,!0)}t++,this.onMetaSub&&this.onMetaSub(r)}}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 T).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 T(e.dacs);if(!n||n.mode==T._INVALID)return void this._tinode.logger("Invalid access mode update",e.src,e.dacs);if(n.mode==T._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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0},setMsgReadRecv:{value:function(e,t,n,i){var s,r=this._contacts[e],o=!1;if(r){switch(n|=0,t){case"recv":s=r.recv,r.recv=r.recv?Math.max(r.recv,n):n,o=s!=r.recv;break;case"read":s=r.read,r.read=r.read?Math.max(r.read,n):n,r.unread=r.seq-r.read,o=s!=r.read,r.recv0&&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(E.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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0}}),E.prototype.constructor=E;var A=function(e){this._tinode=e,this._apiKey=e._apiKey,this._authToken=e.getAuthToken(),this._msgId=e.getNextUniqueId(),this.xhr=m(),this.toResolve=null,this.toReject=null,this.onProgress=null,this.onSuccess=null,this.onFailure=null};A.prototype={upload:function(e,t,n,i){var s=this;if(!this._authToken)throw new Error("Must authenticate first");var o=this;this.xhr.open("POST","/v"+r+"/file/u/",!0),this.xhr.setRequestHeader("X-Tinode-APIKey",this._apiKey),this.xhr.setRequestHeader("X-Tinode-Auth","Token "+this._authToken.token);var a=new Promise(function(e,t){s.toResolve=e,s.toReject=t});this.onProgress=t,this.onSuccess=n,this.onFailure=i,this.xhr.upload.onprogress=function(e){e.lengthComputable&&o.onProgress&&o.onProgress(e.loaded/e.total)},this.xhr.onload=function(){var e;try{e=JSON.parse(this.response,_)}catch(e){o._tinode.logger("Invalid server response in LargeFileHelper",this.response)}this.status>=200&&this.status<300?(o.toResolve&&o.toResolve(e.ctrl.params.url),o.onSuccess&&o.onSuccess(e.ctrl)):this.status>=400?(o.toReject&&o.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")")),o.onFailure&&o.onFailure(e.ctrl)):o._tinode.logger("Unexpected server response status",this.status,this.response)},this.xhr.onerror=function(e){o.toReject&&o.toReject(new Error("failed")),o.onFailure&&o.onFailure(null)},this.xhr.onabort=function(e){o.toReject&&o.toReject(new Error("upload cancelled by user")),o.onFailure&&o.onFailure(null)};try{var c=new FormData;c.append("file",e),c.set("id",this._msgId),this.xhr.send(c)}catch(e){this.toReject&&this.toReject(e),this.onFailure&&this.onFailure(null)}return a},download:function(e,t,n,i){var s=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 r=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=i,this.xhr.onprogress=function(e){r.onProgress&&r.onProgress(e.loaded)};var o=new Promise(function(e,t){s.toResolve=e,s.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),r.toResolve&&r.toResolve()}else if(this.status>=400&&r.toReject){var i=new FileReader;i.onload=function(){try{var e=JSON.parse(this.result,_);r.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")"))}catch(e){r._tinode.logger("Invalid server response in LargeFileHelper",this.result),r.toReject(e)}},i.readAsText(this.response)}},this.xhr.onerror=function(e){r.toReject&&r.toReject(new Error("failed"))},this.xhr.onabort=function(){r.toReject&&r.toReject(null)};try{this.xhr.send()}catch(e){this.toReject&&this.toReject(e)}return o},cancel:function(){this.xhr&&this.xhr.readyState<4&&this.xhr.abort()},getId:function(){return this._msgId}};var R=function e(t,n){this.status=e.STATUS_NONE,this.topic=t,this.content=n};R.STATUS_NONE=0,R.STATUS_QUEUED=1,R.STATUS_SENDING=2,R.STATUS_FAILED=3,R.STATUS_SENT=4,R.STATUS_RECEIVED=5,R.STATUS_READ=6,R.STATUS_TO_ME=7,(R.prototype={toJSON:function(){},fromJSON:function(e){}}).constructor=R,c.exports=M,c.exports.Drafty=e}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),c=c.exports}); +/* WEBPACK VAR INJECTION */(function(global) {!function(e){if(true)module.exports=e();else {}}(function(){var e={exports:{}},t=[{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)/}],n=[{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}],i={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},FM:{name:"div",isVoid:!1},RW:{name:"div",isVoid:!1},BN:{name:"button",isVoid:!1},HD:{name:"",isVoid:!1}};function s(e,t){var n;try{for(var i=(n=atob(e)).length,s=new ArrayBuffer(i),r=new Uint8Array(s),o=0;o"},close:function(){return""}},EM:{open:function(){return""},close:function(){return""}},DL:{open:function(){return""},close:function(){return""}},CO:{open:function(){return""},close:function(){return""}},BR:{open:function(){return"
    "},close:function(){return""}},HD:{open:function(){return""},close:function(){return""}},LN:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{href:e.url,target:"_blank"}:null}},MN:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{name:e.val}:null}},HT:{open:function(e){return''},close:function(e){return""},props:function(e){return e?{name:e.val}:null}},BN:{open:function(e){return""},props:function(e){return e?{"data-act":e.act,"data-val":e.val,"data-name":e.name,"data-ref":e.ref}:null}},IM:{open:function(e){var t=s(e.val,e.mime),n=e.ref?e.ref:t;return(e.name?'':"")+''},close:function(e){return e.name?"":""},props:function(e){return e?{src:s(e.val,e.mime),title:e.name,"data-width":e.width,"data-height":e.height,"data-name":e.name,"data-size":e.val?.75*e.val.length|0:0,"data-mime":e.mime}:null}},FM:{open:function(e){return"
    "},close:function(e){return"
    "}},RW:{open:function(e){return"
    "},close:function(e){return"
    "}}},o=function(){};o.parse=function(e){if("string"!=typeof e)return null;var i=e.split(/\r?\n/),s=[],r={},o=[];i.map(function(e){var i,a,c=[];if(t.map(function(t){c=c.concat(function(e,t,n,i){for(var s=[],r=0,o=e.slice(0);o.length>0;){var a=t.exec(o);if(null==a)break;var c=a.index+a[0].lastIndexOf(a[1]);o=o.slice(c+1),r=(c+=r)+1;var u=n?n.exec(o):null;if(null==u)break;var h=u.index+u[0].indexOf(u[1]);o=o.slice(h+1),r=(h+=r)+1,s.push({text:e.slice(c+1,h),children:[],start:c,end:h,type:i})}return s}(e,t.start,t.end,t.name))}),0==c.length)a={txt:e};else{c.sort(function(e,t){return e.start-t.start}),c=function e(t){if(0==t.length)return[];for(var n=[t[0]],i=t[0],s=1;si.end?(n.push(t[s]),i=t[s]):t[s].endn&&r.push({text:t.slice(n,a.start)});var c={type:a.type},u=e(t,a.start+1,a.end-1,a.children);u.length>0?c.children=u:c.text=a.text,r.push(c),n=a.end+1}return ns;return s=e.offset+e.len,t})}(a.txt)).length>0){var h=[];for(var l in i){var d=i[l],f=r[d.unique];f||(f=s.length,r[d.unique]=f,s.push({tp:d.type,data:d.data})),h.push({at:d.offset,len:d.len,key:f})}a.ent=h}o.push(a)});var a={txt:""};if(o.length>0){a.txt=o[0].txt,a.fmt=(o[0].fmt||[]).concat(o[0].ent||[]);for(var c=1;c0&&(a.ent=s)}return a},o.insertImage=function(e,t,n,i,s,r,o,a,c){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:i,width:s,height:r,name:o,ref:c,size:0|a}}),e},o.appendImage=function(e,t,n,i,s,r,a,c){return(e=e||{txt:""}).txt+=" ",o.insertImage(e,e.txt.length-1,t,n,i,s,r,a,c)},o.attachFile=function(e,t,n,i,s,r){(e=e||{txt:""}).ent=e.ent||[],e.fmt=e.fmt||[],e.fmt.push({at:-1,len:0,key:e.ent.length});var o={tp:"EX",data:{mime:t,val:n,name:i,ref:r,size:0|s}};return r instanceof Promise&&(o.data.ref=r.then(function(e){o.data.ref=e},function(e){})),e.ent.push(o),e},o.wrapAsForm=function(e,t,n){return"string"==typeof e&&(e={txt:e}),e.fmt=e.fmt||[],e.fmt.push({at:t,len:n,tp:"FM"}),e},o.insertButton=function(e,t,n,i,s,r,o){return"string"==typeof e&&(e={txt:e}),!e||!e.txt||e.txt.length0)for(var t in e.ent)if(e.ent[t]&&"EX"==e.ent[t].tp)return!0;return!1},o.attachments=function(e,t,n){if(e.ent&&e.ent.length>0)for(var i in e.ent)e.ent[i]&&"EX"==e.ent[i].tp&&t.call(n,e.ent[i].data,i)},o.getDownloadUrl=function(e){var t=null;return"application/json"!=e.mime&&e.val?t=s(e.val,e.mime):"string"==typeof e.ref&&(t=e.ref),t},o.isUploading=function(e){return e.ref instanceof Promise},o.getPreviewUrl=function(e){return e.val?s(e.val,e.mime):null},o.getEntitySize=function(e){return e.size?e.size:e.val?.75*e.val.length|0:0},o.getEntityMimeType=function(e){return e.mime||"text/plain"},o.tagName=function(e){return i[e]?i[e].name:void 0},o.attrValue=function(e,t){if(t&&r[e])return r[e].props(t)},o.getContentType=function(){return"text/x-drafty"},e.exports=o,e=e.exports;var a="0.15.12",c={exports:{}};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)}if(true)var i=a;var s;"undefined"!=typeof WebSocket&&(s=WebSocket),"undefined"==typeof btoa&&(t.btoa=function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n="",i=0,s=0,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.charAt(0|s)||(r="=",s%1);n+=r.charAt(63&i>>8-s%1*8)){if((e=t.charCodeAt(s+=.75))>255)throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i=i<<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,i=0,s=0,r=0;n=e.charAt(r++);~n&&(s=i%4?64*s+n:n,i++%4)?t+=String.fromCharCode(255&s>>(-2*i&6)):0)n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(n);return t}),"undefined"==typeof window&&(t.window={WebSocket:s,URL:{createObjectURL:function(){throw new Error("Unable to use window.URL in a non browser application")}}});var r="0",o=i||"0.15",u="tinodejs/"+o,h=503,l="Connection failed",d=418,f="Disconnected by client";function p(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}function g(e,t,i){if("object"!=n(t)){if(t===M.DEL_CHAR)return;return t}if(null===t)return t;if(t instanceof Date)return t;if(t instanceof T)return new T(t);if(t instanceof Array)return t;for(var s in e&&e!==M.DEL_CHAR||(e=t.constructor()),t)!t.hasOwnProperty(s)||i&&i[s]||"_generated"==s||(e[s]=g(e[s],t[s]));return e}function v(e,t,n,i){return e[t]=g(e[t],n,i),e[t]}function m(){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 _(e,t){if("ts"===e&&"string"==typeof t&&t.length>=20&&t.length<=24){var i=new Date(t);if(i)return i}else if("acs"===e&&"object"===n(t))return new T(t);return t}function b(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 w(e,t,n){var i=null;return"http"!==t&&"https"!==t&&"ws"!==t&&"wss"!==t||(i=t+"://","/"!==(i+=e).charAt(i.length-1)&&(i+="/"),i+="v"+r+"/channels","http"!==t&&"https"!==t||(i+="/lp"),i+="?apikey="+n),i}var S=function(e,t,i,r,o){var a=this,c=e,u=r,p=t,g=o,v=2e3,b=10,S=.3,M=null,y=0,T=!1,D=function(e){a.logger&&a.logger(e)};function x(){var e=this;clearTimeout(M);var t=v*(Math.pow(2,y)*(1+S*Math.random()));y=y>=b?y:y+1,this.onAutoreconnectIteration&&this.onAutoreconnectIteration(t),M=setTimeout(function(){if(D("Reconnecting, iter="+y+", timeout="+t),T)e.onAutoreconnectIteration&&e.onAutoreconnectIteration(-1);else{var n=e.connect();e.onAutoreconnectIteration?e.onAutoreconnectIteration(0,n):n.catch(function(){})}},t)}function E(){clearTimeout(M),M=null,y=0}function A(e){var t=null;e.connect=function(n){return T=!1,t&&t.readyState==t.OPEN?Promise.resolve():(n&&(c=n),new Promise(function(n,i){var r=w(c,u?"wss":"ws",p);D("Connecting to: "+r);var o=new s(r);o.onopen=function(t){e.onOpen&&e.onOpen(),n(),g&&E()},o.onclose=function(n){if(t=null,e.onDisconnect){var i=T?d:h;e.onDisconnect(new Error(T?f:l+" ("+i+")"),i)}!T&&g&&x.call(e)},o.onerror=function(e){i(e)},o.onmessage=function(t){e.onMessage&&e.onMessage(t.data)},t=o}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,t&&(E(),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&&t.readyState==t.OPEN},e.transport=function(){return"ws"},e.probe=function(){e.sendText("1")}}function R(e){var t=null,n=null,i=null;e.connect=function(i){return T=!1,n?Promise.resolve():(i&&(c=i),new Promise(function(i,s){var r=w(c,u?"https":"http",p);D("Connecting to: "+r),(n=function n(i,s,r){var o=m(),a=!1;return o.onreadystatechange=function(c){if(4==o.readyState)if(201==o.status){var u=JSON.parse(o.responseText,_);t=i+"&sid="+u.ctrl.params.sid,(o=n(t)).send(null),e.onOpen&&e.onOpen(),s&&(a=!0,s()),g&&E()}else if(o.status<400)e.onMessage&&e.onMessage(o.responseText),(o=n(t)).send(null);else{if(r&&!a&&(a=!0,r(o.responseText)),e.onMessage&&o.responseText&&e.onMessage(o.responseText),e.onDisconnect){var p=o.status||(T?d:h),v=o.responseText||(T?f:l);e.onDisconnect(new Error(v+" ("+p+")"),p)}o=null,!T&&g&&x.call(e)}},o.open("GET",i,!0),o}(r,i,s)).send(null)}).catch(function(){}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,E(),i&&(i.onreadystatechange=void 0,i.abort(),i=null),n&&(n.onreadystatechange=void 0,n.abort(),n=null),e.onDisconnect&&e.onDisconnect(new Error(f+" ("+d+")"),d),t=null},e.sendText=function(e){var n,s;if(n=t,(s=m()).onreadystatechange=function(e){if(4==s.readyState&&s.status>=400)throw new Error("LP sender failed, "+s.status)},s.open("POST",n,!0),!(i=s)||1!=i.readyState)throw new Error("Long poller failed to connect");i.send(e)},e.isConnected=function(){return n&&!0},e.transport=function(){return"lp"},e.probe=function(){e.sendText("1")}}"lp"===i?R(this):"ws"===i?A(this):"object"==("undefined"==typeof window?"undefined":n(window))&&window.WebSocket?A(this):R(this),this.onMessage=void 0,this.onDisconnect=void 0,this.onOpen=void 0,this.onAutoreconnectIteration=void 0,this.logger=void 0},M=function(e,t,i,s,r,a){var c=this;this._appName=e||"Undefined",this._apiKey=i,this._browser="",this._platform=a,this._hwos="undefined",this._humanLanguage="xx","undefined"!=typeof navigator&&(this._browser=function(e,t){e=e||"";var n="";/reactnative/i.test(t)&&(n="ReactNative; ");var i,s=(e=e.replace(" (KHTML, like Gecko)","")).match(/(AppleWebKit\/[.\d]+)/i);if(s){for(var r=["chrome","safari","mobile","version"],o=e.substr(s.index+s[0].length).split(" "),a=[],c=function(e){var t=/([\w.]+)[\/]([\.\d]+)/.exec(o[e]);t&&a.push([t[1],t[2],r.findIndex(function(e){return e==t[1].toLowerCase()})])},u=0;u0?a[0][0]+"/"+a[0][1]:s[1]}else i=/trident/i.test(e)?(s=/(?:\brv[ :]+([.\d]+))|(?:\bMSIE ([.\d]+))/g.exec(e))?"MSIE/"+(s[1]||s[2]):"MSIE/?":/firefox/i.test(e)?(s=/Firefox\/([.\d]+)/g.exec(e))?"Firefox/"+s[1]:"Firefox/?":/presto/i.test(e)?(s=/Opera\/([.\d]+)/g.exec(e))?"Opera/"+s[1]:"Opera/?":(s=/([\w.]+)\/([.\d]+)/.exec(e))?s[1]+"/"+s[2]:(s=e.split(" "))[0];if((s=i.split("/")).length>1){var h=s[1].split(".");i=s[0]+"/"+h[0]+(h[1]?"."+h[1]:"")}return n+i}(navigator.userAgent,navigator.product),this._hwos=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 S(t,i,s,r,!0),this.logger=function(e){if(c._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 l=this.cachePut=function(e,t,n){c._cache[e+":"+t]=n},d=this.cacheGet=function(e,t){return c._cache[e+":"+t]},f=this.cacheDel=function(e,t){delete c._cache[e+":"+t]},p=this.cacheMap=function(e,t){for(var n in c._cache)if(e(c._cache[n],n,t))break};this.attachCacheToTopic=function(e){e._tinode=c,e._cacheGetUser=function(e){var t=d("user",e);if(t)return{user:e,public:g({},t)}},e._cachePutUser=function(e,t){return l("user",e,g({},t.public))},e._cacheDelUser=function(e){return f("user",e)},e._cachePutSelf=function(){return l("topic",e.name,e)},e._cacheDelSelf=function(){return f("topic",e.name)}};var v=function(e,t,n,i){var s=c._pendingPromises[e];s&&(delete c._pendingPromises[e],t>=200&&t<400?s.resolve&&s.resolve(n):s.reject&&s.reject(new Error("Error: "+i+" ("+t+")")))},m=this.getNextUniqueId=function(){return 0!=c._messageId?""+c._messageId++:void 0};this.initPacket=function(e,t){switch(e){case"hi":return{hi:{id:m(),ver:o,ua:c._appName+" ("+(c._browser?c._browser+"; ":"")+c._hwos+"); "+u,dev:c._deviceToken,lang:c._humanLanguage,platf:c._platform}};case"acc":return{acc:{id:m(),user:null,scheme:null,secret:null,login:!1,tags:null,desc:{},cred:{}}};case"login":return{login:{id:m(),scheme:null,secret:null}};case"sub":return{sub:{id:m(),topic:t,set:{},get:{}}};case"leave":return{leave:{id:m(),topic:t,unsub:!1}};case"pub":return{pub:{id:m(),topic:t,noecho:!1,head:null,content:{}}};case"get":return{get:{id:m(),topic:t,what:null,desc:{},sub:{},data:{}}};case"set":return{set:{id:m(),topic:t,desc:{},sub:{},tags:[]}};case"del":return{del:{id:m(),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 i;t&&(i=function(e){var t=null;return e&&(t=new Promise(function(t,n){c._pendingPromises[e]={resolve:t,reject:n}})),t}(t)),e=function e(t){return Object.keys(t).forEach(function(i){"_"==i[0]?delete t[i]:t[i]?Array.isArray(t[i])&&0==t[i].length?delete t[i]:t[i]?"object"!=n(t[i])||t[i]instanceof Date||(e(t[i]),0==Object.getOwnPropertyNames(t[i]).length&&delete t[i]):delete t[i]:delete t[i]}),t}(e);var s=JSON.stringify(e);c.logger("out: "+(c._trimLongStrings?JSON.stringify(e,b):s));try{c._connection.sendText(s)}catch(e){if(!t)throw e;v(t,h,null,e.message)}return i},this.loginSuccessful=function(e){e.params&&e.params.user&&(c._myUID=e.params.user,c._authenticated=e&&e.code>=200&&e.code<300,e.params&&e.params.token&&e.params.expires?c._authToken={token:e.params.token,expires:new Date(e.params.expires)}:c._authToken=null,c.onLogin&&c.onLogin(e.code,e.text))},this._connection.onMessage=function(e){if(e)if(c._inPacketCount++,c.onRawMessage&&c.onRawMessage(e),"0"!==e){var t=JSON.parse(e,_);if(t)if(c.logger("in: "+(c._trimLongStrings?JSON.stringify(t,b):e)),c.onMessage&&c.onMessage(t),t.ctrl){if(c.onCtrlMessage&&c.onCtrlMessage(t.ctrl),t.ctrl.id&&v(t.ctrl.id,t.ctrl.code,t.ctrl,t.ctrl.text),t.ctrl.params&&"data"==t.ctrl.params.what){var n=d("topic",t.ctrl.topic);n&&n._allMessagesReceived(t.ctrl.params.count)}}else if(t.meta){var i=d("topic",t.meta.topic);i&&i._routeMeta(t.meta),c.onMetaMessage&&c.onMetaMessage(t.meta)}else if(t.data){var s=d("topic",t.data.topic);s&&s._routeData(t.data),c.onDataMessage&&c.onDataMessage(t.data)}else if(t.pres){var r=d("topic",t.pres.topic);r&&r._routePres(t.pres),c.onPresMessage&&c.onPresMessage(t.pres)}else if(t.info){var o=d("topic",t.info.topic);o&&o._routeInfo(t.info),c.onInfoMessage&&c.onInfoMessage(t.info)}else c.logger("ERROR: Unknown packet received.");else c.logger("in: "+e),c.logger("ERROR: failed to parse data")}else c.onNetworkProbe&&c.onNetworkProbe()},this._connection.onOpen=function(){c.hello()},this._connection.onAutoreconnectIteration=function(e,t){c.onAutoreconnectIteration&&c.onAutoreconnectIteration(e,t)},this._connection.onDisconnect=function(e,t){for(var n in c._inPacketCount=0,c._serverInfo=null,c._authenticated=!1,c._pendingPromises){var i=c._pendingPromises[n];i&&i.reject&&i.reject(e)}c._pendingPromises={},p(function(e,t){0===t.lastIndexOf("topic:",0)&&e._resetSub()}),c.onDisconnect&&c.onDisconnect(e)}};M.credential=function(e,t,i,s){if("object"==n(e)){var r=e;t=r.val,i=r.params,s=r.resp,e=r.meth}return e&&(t||s)?[{meth:e,val:t,resp:s,params:i}]:null},M.topicType=function(e){return{me:"me",fnd:"fnd",grp:"grp",new:"grp",usr:"p2p"}["string"==typeof e?e.substring(0,3):"xxx"]},M.isNewGroupTopicName=function(e){return"string"==typeof e&&"new"==e.substring(0,3)},M.getVersion=function(){return o},M.setWebSocketProvider=function(e){s=e},M.getLibrary=function(){return u},M.MESSAGE_STATUS_NONE=0,M.MESSAGE_STATUS_QUEUED=1,M.MESSAGE_STATUS_SENDING=2,M.MESSAGE_STATUS_FAILED=3,M.MESSAGE_STATUS_SENT=4,M.MESSAGE_STATUS_RECEIVED=5,M.MESSAGE_STATUS_READ=6,M.MESSAGE_STATUS_TO_ME=7,M.DEL_CHAR="\u2421",M.prototype={connect:function(e){return this._connection.connect(e)},reconnect:function(){this._connection.reconnect()},disconnect:function(){this._connection.disconnect()},networkProbe:function(){this._connection.probe()},isConnected:function(){return this._connection.isConnected()},isAuthenticated:function(){return this._authenticated},account:function(e,t,n,i,s){var r=this.initPacket("acc");return r.acc.user=e,r.acc.scheme=t,r.acc.secret=n,r.acc.login=i,s&&(r.acc.desc.defacs=s.defacs,r.acc.desc.public=s.public,r.acc.desc.private=s.private,r.acc.tags=s.tags,r.acc.cred=s.cred,r.acc.token=s.token),this.send(r,r.acc.id)},createAccount:function(e,t,n,i){var s=this,r=this.account("new",e,t,n,i);return n&&(r=r.then(function(e){return s.loginSuccessful(e),e})),r},createAccountBasic:function(e,t,n){return e=e||"",t=t||"",this.createAccount("basic",p(e+":"+t),!0,n)},updateAccountBasic:function(e,t,n,i){return t=t||"",n=n||"",this.account(e,"basic",p(t+":"+n),!1,i)},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 i=this,s=this.initPacket("login");return s.login.scheme=e,s.login.secret=t,s.login.cred=n,this.send(s,s.login.id).then(function(e){return i.loginSuccessful(e),e})},loginBasic:function(e,t,n){var i=this;return this.login("basic",p(e+":"+t),n).then(function(t){return i._login=e,t})},loginToken:function(e,t){return this.login("token",e,t)},requestResetAuthSecret:function(e,t,n){return this.login("reset",p(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 i=this.initPacket("sub",e);return e||(e="new"),i.sub.get=t,n&&(n.sub&&(i.sub.set.sub=n.sub),M.isNewGroupTopicName(e)&&n.desc&&(i.sub.set.desc=n.desc),n.tags&&(i.sub.set.tags=n.tags)),this.send(i,i.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,i){var s=this.initPacket("pub",t),r="string"==typeof n?e.parse(n):n;return r&&!e.isPlainText(r)&&(s.pub.head={mime:e.getContentType()},n=r),s.pub.noecho=i,s.pub.content=n,s.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=g(n.get,t),this.send(n,n.get.id)},setMeta:function(e,t){var n=this.initPacket("set",e),i=[];return t&&["desc","sub","tags"].map(function(e){t.hasOwnProperty(e)&&(i.push(e),n.set[e]=t[e])}),0==i.length?Promise.reject(new Error("Invalid {set} parameters")):this.send(n,n.set.id)},delMessages:function(e,t,n){var i=this.initPacket("del",e);return i.del.what="msg",i.del.delseq=t,i.del.hard=n,this.send(i,i.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 i=this.initPacket("note",e);i.note.what=t,i.note.seq=n,this.send(i)},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 x:"fnd"==e?new E:new D(e),this.cachePut("topic",e,t),this.attachCacheToTopic(t)),t},newTopic:function(e){var t=new D("new",e);return this.attachCacheToTopic(t),t},newGroupTopicName:function(){return"new"+this.getNextUniqueId()},newTopicWith:function(e,t){var n=new D(e,t);return this.attachCacheToTopic(n),n},getMeTopic:function(){return this.getTopic("me")},getFndTopic:function(){return this.getTopic("fnd")},getLargeFileHelper:function(){return new A(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,onNetworkProbe:void 0,onAutoreconnectIteration:void 0};var y=function(e){this.topic=e;var t=e._tinode.getMeTopic();this.contact=t&&t.getContact(e.name),this.what={}};y.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 i={ims:e,limit:t};return"me"==this.topic.getType()?i.topic=n:i.user=n,this.what.sub=i,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=this,n={};return["data","sub","desc","tags","del"].map(function(i){t.what.hasOwnProperty(i)&&(e.push(i),Object.getOwnPropertyNames(t.what[i]).length>0&&(n[i]=t.what[i]))}),e.length>0?n.what=e.join(" "):n=void 0,n}};var T=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)};T._NONE=0,T._JOIN=1,T._READ=2,T._WRITE=4,T._PRES=8,T._APPROVE=16,T._SHARE=32,T._DELETE=64,T._OWNER=128,T._BITMASK=T._JOIN|T._READ|T._WRITE|T._PRES|T._APPROVE|T._SHARE|T._DELETE|T._OWNER,T._INVALID=1048576,T.decode=function(e){if(!e)return null;if("number"==typeof e)return e&T._BITMASK;if("N"===e||"n"===e)return T._NONE;for(var t={J:T._JOIN,R:T._READ,W:T._WRITE,P:T._PRES,A:T._APPROVE,S:T._SHARE,D:T._DELETE,O:T._OWNER},n=T._NONE,i=0;i0)){c=!0;break}r=o-1}return c?o:i?-1:a<0?o+1:o}return e=e||function(e,t){return e===t?0:e0)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,i,s){n|=0,i=i||t.length;for(var r=n;r=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 i=n._tinode.getMeTopic();i&&i._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 i=[];e.attachments(t.content,function(e){i.push(e.ref)}),t.head.attachments=i}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 i=e.seq||this._getQueuedSeqId();return e._generated||(e._generated=!0,e.seq=i,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,i=this.startMetaQuery();t?i.withLaterData(e):i.withEarlierData(e);var s=this.getMeta(i.build());return t||(s=s.then(function(e){e&&e.params&&!e.params.count&&(n._noEarlierMsgs=!0)})),s},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,i=e.length;n1&&t.push(s)}t.sort().filter(function(e,t,n){return!t||e!=n[t-1]})}return 0==t.length&&t.push(M.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}})},archive:function(e){return this.private&&this.private.arch==e?Promise.resolve(e):this.setMeta({desc:{private:{arch:!!e||M.DEL_CHAR}}})},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.hi)});var i=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(i.length>0?this._tinode.delMessages(this.name,i,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]0){var i=this._tinode.getCurrentUserID();for(var s in this._users){var r=this._users[s];r.user!==i&&r[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),i=this.msgStatus(n);if(1==i||3==i)return n._cancelled=!0,this._messages.delAt(t),this.onData&&this.onData(),!0}return!1},getType:function(){return M.topicType(this.name)},getAccessMode:function(){return this.acs},getDefaultAccess:function(){return this.defacs},startMetaQuery:function(){return new y(this)},isArchived:function(){return!(!this.private||!this.private.arch)},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.touchedthis._maxSeq&&(this._maxSeq=e.seq),(e.seq0&&(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!=T._NONE||("p2p"==this.getType()&&this.leave(),this._processMetaSub([{user:n,deleted:new Date,_generated:!0}]));else{var i=(new T).updateAll(e.dacs);i&&i.mode!=T._NONE&&((t=this._cacheGetUser(n))?t.acs=i:(t={user:n,acs:i},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,t.recv0&&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 T(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 i=this._cacheGetUser(e);return i?i=g(i,t):(n&&this.getMeta(this.startMetaQuery().withLaterOneSub(e).build()),i=g({},t)),this._cachePutUser(e,i),v(this._users,e,i)},_getQueuedSeqId:function(){return this._queuedSeqId++}};var x=function(e){D.call(this,"me",e),this._contacts={},e&&(this.onContactUpdate=e.onContactUpdate)};x.prototype=Object.create(D.prototype,{_processMetaSub:{value:function(e){var t=0;for(var n in e){var i=e[n],s=i.topic;if("fnd"!=s&&"me"!=s){i.updated=new Date(i.updated),i.touched=i.touched?new Date(i.touched):null,i.deleted=i.deleted?new Date(i.deleted):null,i.seq=0|i.seq,i.recv=0|i.recv,i.read=0|i.read,i.unread=i.seq-i.read;var r=null;if(i.deleted)r=i,delete this._contacts[s];else if(i.seen&&i.seen.when&&(i.seen.when=new Date(i.seen.when)),r=v(this._contacts,s,i),"p2p"==M.topicType(s)&&this._cachePutUser(s,r),!i._generated){var o=this._tinode.getTopic(s);o&&o._processMetaDesc(i,!0)}t++,this.onMetaSub&&this.onMetaSub(r)}}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 T).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 T(e.dacs);if(!n||n.mode==T._INVALID)return void this._tinode.logger("Invalid access mode update",e.src,e.dacs);if(n.mode==T._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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0},setMsgReadRecv:{value:function(e,t,n,i){var s,r=this._contacts[e],o=!1;if(r){switch(n|=0,t){case"recv":s=r.recv,r.recv=r.recv?Math.max(r.recv,n):n,o=s!=r.recv;break;case"read":s=r.read,r.read=r.read?Math.max(r.read,n):n,r.unread=r.seq-r.read,o=s!=r.read,r.recv0&&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(E.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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0}}),E.prototype.constructor=E;var A=function(e){this._tinode=e,this._apiKey=e._apiKey,this._authToken=e.getAuthToken(),this._msgId=e.getNextUniqueId(),this.xhr=m(),this.toResolve=null,this.toReject=null,this.onProgress=null,this.onSuccess=null,this.onFailure=null};A.prototype={upload:function(e,t,n,i){var s=this;if(!this._authToken)throw new Error("Must authenticate first");var o=this;this.xhr.open("POST","/v"+r+"/file/u/",!0),this.xhr.setRequestHeader("X-Tinode-APIKey",this._apiKey),this.xhr.setRequestHeader("X-Tinode-Auth","Token "+this._authToken.token);var a=new Promise(function(e,t){s.toResolve=e,s.toReject=t});this.onProgress=t,this.onSuccess=n,this.onFailure=i,this.xhr.upload.onprogress=function(e){e.lengthComputable&&o.onProgress&&o.onProgress(e.loaded/e.total)},this.xhr.onload=function(){var e;try{e=JSON.parse(this.response,_)}catch(e){o._tinode.logger("Invalid server response in LargeFileHelper",this.response)}this.status>=200&&this.status<300?(o.toResolve&&o.toResolve(e.ctrl.params.url),o.onSuccess&&o.onSuccess(e.ctrl)):this.status>=400?(o.toReject&&o.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")")),o.onFailure&&o.onFailure(e.ctrl)):o._tinode.logger("Unexpected server response status",this.status,this.response)},this.xhr.onerror=function(e){o.toReject&&o.toReject(new Error("failed")),o.onFailure&&o.onFailure(null)},this.xhr.onabort=function(e){o.toReject&&o.toReject(new Error("upload cancelled by user")),o.onFailure&&o.onFailure(null)};try{var c=new FormData;c.append("file",e),c.set("id",this._msgId),this.xhr.send(c)}catch(e){this.toReject&&this.toReject(e),this.onFailure&&this.onFailure(null)}return a},download:function(e,t,n,i){var s=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 r=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=i,this.xhr.onprogress=function(e){r.onProgress&&r.onProgress(e.loaded)};var o=new Promise(function(e,t){s.toResolve=e,s.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),r.toResolve&&r.toResolve()}else if(this.status>=400&&r.toReject){var i=new FileReader;i.onload=function(){try{var e=JSON.parse(this.result,_);r.toReject(new Error(e.ctrl.text+" ("+e.ctrl.code+")"))}catch(e){r._tinode.logger("Invalid server response in LargeFileHelper",this.result),r.toReject(e)}},i.readAsText(this.response)}},this.xhr.onerror=function(e){r.toReject&&r.toReject(new Error("failed"))},this.xhr.onabort=function(){r.toReject&&r.toReject(null)};try{this.xhr.send()}catch(e){this.toReject&&this.toReject(e)}return o},cancel:function(){this.xhr&&this.xhr.readyState<4&&this.xhr.abort()},getId:function(){return this._msgId}};var R=function e(t,n){this.status=e.STATUS_NONE,this.topic=t,this.content=n};R.STATUS_NONE=0,R.STATUS_QUEUED=1,R.STATUS_SENDING=2,R.STATUS_FAILED=3,R.STATUS_SENT=4,R.STATUS_RECEIVED=5,R.STATUS_READ=6,R.STATUS_TO_ME=7,(R.prototype={toJSON:function(){},fromJSON:function(e){}}).constructor=R,c.exports=M,c.exports.Drafty=e}.call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),c=c.exports}); /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webapp/node_modules/webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js"))) /***/ }), @@ -739,27 +739,29 @@ __webpack_require__.r(__webpack_exports__); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "updateFavicon", function() { return updateFavicon; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "vcard", function() { return vcard; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "arrayEqual", function() { return arrayEqual; }); +function _readOnlyError(name) { throw new Error("\"" + name + "\" is read-only"); } + function updateFavicon(count) { var oldIcon = document.getElementById('shortcut-icon'); + var head = document.head || document.getElementsByTagName('head')[0]; + var newIcon = document.createElement('link'); + newIcon.type = 'image/png'; + newIcon.id = 'shortcut-icon'; + newIcon.rel = 'shortcut icon'; + newIcon.href = 'img/logo32x32' + (count > 0 ? 'a' : '') + '.png'; if (oldIcon) { - var head = document.head || document.getElementsByTagName('head')[0]; - var newIcon = document.createElement('link'); - newIcon.type = 'image/png'; - newIcon.id = 'shortcut-icon'; - newIcon.rel = 'shortcut icon'; - newIcon.href = 'img/logo32x32' + (count > 0 ? 'a' : '') + '.png'; head.removeChild(oldIcon); - head.appendChild(newIcon); } + head.appendChild(newIcon); document.title = (count > 0 ? '(' + count + ') ' : '') + 'Tinode'; } function vcard(fn, imageDataUrl) { var card = null; if (fn && fn.trim() || imageDataUrl) { - card = {}; + card = (_readOnlyError("card"), {}); if (fn) { card.fn = fn.trim(); @@ -777,6 +779,14 @@ function vcard(fn, imageDataUrl) { return card; } function arrayEqual(a, b) { + if (a === b) { + return true; + } + + if (!Array.isArray(a) || !Array.isArray(b)) { + return false; + } + if (a.length != b.length) { return false; } @@ -881,7 +891,7 @@ var ContactsView = function (_React$Component) { _createClass(ContactsView, [{ key: "handleAction", - value: function handleAction(action) { + value: function handleAction(action_ignored) { this.props.onShowArchive(); } }, { @@ -913,16 +923,27 @@ var ContactsView = function (_React$Component) { var contacts = []; var unreadThreads = 0; var archivedCount = 0; + var selectionVisible = false; nextProps.chatList.map(function (c) { + var key = c.topic ? c.topic : c.user; + if (c.private && c.private.arch) { if (nextProps.archive) { contacts.push(c); + + if (key == nextProps.topicSelected) { + selectionVisible = true; + } } else { archivedCount++; } } else if (!nextProps.archive) { contacts.push(c); unreadThreads += c.unread > 0 ? 1 : 0; + + if (key == nextProps.topicSelected) { + selectionVisible = true; + } } }); contacts.sort(function (a, b) { @@ -942,7 +963,8 @@ var ContactsView = function (_React$Component) { Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_3__["updateFavicon"])(unreadThreads); return { contactList: contacts, - archivedCount: archivedCount + archivedCount: archivedCount, + selectionVisible: selectionVisible }; } }]); @@ -1306,7 +1328,7 @@ var EditAccountView = function (_React$Component) { this.setState({ fullName: fn }); - this.props.onUpdateAccount(undefined, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_8__["vcard"])(fn, this.state.avatar)); + this.props.onUpdateAccount(undefined, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_8__["vcard"])(fn, null)); } }, { key: "handlePasswordUpdate", @@ -1322,7 +1344,7 @@ var EditAccountView = function (_React$Component) { this.setState({ avatar: img }); - this.props.onUpdateAccount(undefined, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_8__["vcard"])(this.state.fullName, img)); + this.props.onUpdateAccount(undefined, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_8__["vcard"])(null, img)); } }, { key: "handleCheckboxClick", @@ -1806,7 +1828,7 @@ var InfoView = function (_React$Component) { this.setState({ fullName: fn }); - this.props.onTopicDescUpdate(this.props.topic, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_14__["vcard"])(fn, this.state.avatar), null); + this.props.onTopicDescUpdate(this.props.topic, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_14__["vcard"])(fn, null), null); } } }, { @@ -1825,7 +1847,7 @@ var InfoView = function (_React$Component) { this.setState({ avatar: img }); - this.props.onTopicDescUpdate(this.props.topic, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_14__["vcard"])(this.state.fullName, img), null); + this.props.onTopicDescUpdate(this.props.topic, Object(_lib_utils_js__WEBPACK_IMPORTED_MODULE_14__["vcard"])(null, img), null); } }, { key: "handleMuted", @@ -4025,6 +4047,7 @@ var TinodeWeb = function (_React$Component) { _this.handleValidateCredentialsRequest = _this.handleValidateCredentialsRequest.bind(_assertThisInitialized(_assertThisInitialized(_this))); _this.handlePasswordResetRequest = _this.handlePasswordResetRequest.bind(_assertThisInitialized(_assertThisInitialized(_this))); _this.handleResetPassword = _this.handleResetPassword.bind(_assertThisInitialized(_assertThisInitialized(_this))); + _this.handleContextMenuAction = _this.handleContextMenuAction.bind(_assertThisInitialized(_assertThisInitialized(_this))); return _this; } @@ -4688,11 +4711,18 @@ var TinodeWeb = function (_React$Component) { var _this14 = this; if (pub || defacs) { + var params = {}; + + if (pub) { + params.public = pub; + } + + if (defacs) { + params.defacs = defacs; + } + this.tinode.getMeTopic().setMeta({ - desc: { - public: pub, - defacs: defacs - } + desc: params }).catch(function (err) { _this14.handleError(err.message, 'err'); }); @@ -5079,6 +5109,26 @@ var TinodeWeb = function (_React$Component) { contextMenuBounds: null }); } + }, { + key: "handleContextMenuAction", + value: function handleContextMenuAction(action, promise, params) { + var _this24 = this; + + console.log("handleContextMenuAction", action, params, this.state.topicSelected); + + if (action == 'topic_archive') { + console.log("handleContextMenuAction - 2"); + + if (promise && params.topicName && params.topicName == this.state.topicSelected) { + console.log("handleContextMenuAction - 3"); + promise.then(function () { + console.log("handleContextMenuAction - 4"); + + _this24.handleTopicSelected(null); + }); + } + } + } }, { key: "handleShowInfoView", value: function handleShowInfoView() { @@ -5098,7 +5148,7 @@ var TinodeWeb = function (_React$Component) { }, { key: "handleMemberUpdateRequest", value: function handleMemberUpdateRequest(topicName, added, removed) { - var _this24 = this; + var _this25 = this; if (!topicName) { return; @@ -5113,7 +5163,7 @@ var TinodeWeb = function (_React$Component) { if (added && added.length > 0) { added.map(function (uid) { topic.invite(uid, null).catch(function (err) { - _this24.handleError(err.message, 'err'); + _this25.handleError(err.message, 'err'); }); }); } @@ -5121,7 +5171,7 @@ var TinodeWeb = function (_React$Component) { if (removed && removed.length > 0) { removed.map(function (uid) { topic.delSubscription(uid).catch(function (err) { - _this24.handleError(err.message, 'err'); + _this25.handleError(err.message, 'err'); }); }); } @@ -5141,18 +5191,18 @@ var TinodeWeb = function (_React$Component) { }, { key: "handlePasswordResetRequest", value: function handlePasswordResetRequest(method, value) { - var _this25 = this; + var _this26 = this; this.tinode.connect().then(function () { - return _this25.tinode.requestResetAuthSecret('basic', method, value); + return _this26.tinode.requestResetAuthSecret('basic', method, value); }).catch(function (err) { - _this25.handleError(err.message, 'err'); + _this26.handleError(err.message, 'err'); }); } }, { key: "handleResetPassword", value: function handleResetPassword(scheme, newPassword, token) { - var _this26 = this; + var _this27 = this; token = base64ReEncode(token); @@ -5160,11 +5210,11 @@ var TinodeWeb = function (_React$Component) { this.handleError("Invalid security token", 'err'); } else { this.tinode.connect().then(function () { - return _this26.tinode.updateAccountBasic(null, null, newPassword, { + return _this27.tinode.updateAccountBasic(null, null, newPassword, { token: token }); }).catch(function (err) { - _this26.handleError(err.message, 'err'); + _this27.handleError(err.message, 'err'); }); } } @@ -6485,7 +6535,8 @@ var ContactAction = function (_React$PureComponent) { value: function render() { var formatMessage = this.props.intl.formatMessage; return react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", { - onClick: this.handleClick + onClick: this.handleClick, + className: "action" }, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", { className: "action-text" }, formatMessage(this.props.title, this.props.values))); @@ -6977,50 +7028,60 @@ var ContextMenu = function (_React$Component) { _this.handleClick = _this.handleClick.bind(_assertThisInitialized(_assertThisInitialized(_this))); _this.MenuItems = { 'topic_info': { + id: 'topic_info', title: formatMessage(messages.info), handler: null }, 'messages_clear': { + id: 'messages_clear', title: formatMessage(messages.clear_messages), handler: function handler(params, errorHandler) { - _this.deleteMessages(true, false, params, errorHandler); + return _this.deleteMessages(true, false, params, errorHandler); } }, 'messages_clear_hard': { + id: 'messages_clear_hard', title: formatMessage(messages.clear_for_all), handler: function handler(params, errorHandler) { - _this.deleteMessages(true, true, params, errorHandler); + return _this.deleteMessages(true, true, params, errorHandler); } }, 'message_delete': { + id: 'message_delete', title: formatMessage(messages.delete), handler: function handler(params, errorHandler) { - _this.deleteMessages(false, false, params, errorHandler); + return _this.deleteMessages(false, false, params, errorHandler); } }, 'message_delete_hard': { + id: 'message_delete_hard', title: formatMessage(messages.delete_for_all), handler: function handler(params, errorHandler) { - _this.deleteMessages(false, true, params, errorHandler); + return _this.deleteMessages(false, true, params, errorHandler); } }, 'topic_unmute': { + id: 'topic_unmute', title: formatMessage(messages.unmute), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '+P') }, 'topic_mute': { + id: 'topic_mute', title: formatMessage(messages.mute), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '-P') }, 'topic_unblock': { + id: 'topic_unblock', title: formatMessage(messages.unblock), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '+J') }, 'topic_block': { + id: 'topic_block', title: formatMessage(messages.block), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '-J') }, 'topic_delete': { + id: 'topic_delete', title: formatMessage(messages.topic_delete), handler: function handler(params, errorHandler) { var topic = _this.props.tinode.getTopic(params.topicName); @@ -7030,7 +7091,7 @@ var ContextMenu = function (_React$Component) { return; } - topic.delTopic().catch(function (err) { + return topic.delTopic().catch(function (err) { if (errorHandler) { errorHandler(err.message, 'err'); } @@ -7038,6 +7099,7 @@ var ContextMenu = function (_React$Component) { } }, 'topic_archive': { + id: 'topic_archive', title: formatMessage(messages.archive), handler: function handler(params, errorHandler) { var topic = _this.props.tinode.getTopic(params.topicName); @@ -7047,7 +7109,7 @@ var ContextMenu = function (_React$Component) { return; } - topic.archive(true).catch(function (err) { + return topic.archive(true).catch(function (err) { if (errorHandler) { errorHandler(err.message, 'err'); } @@ -7055,12 +7117,14 @@ var ContextMenu = function (_React$Component) { } }, 'permissions': { + id: 'permissions', title: formatMessage({ id: 'menu_item_edit_permissions' }), handler: null }, 'member_delete': { + id: 'member_delete', title: formatMessage(messages.member_delete), handler: function handler(params, errorHandler) { var topic = _this.props.tinode.getTopic(params.topicName); @@ -7070,7 +7134,7 @@ var ContextMenu = function (_React$Component) { return; } - topic.delSubscription(params.user).catch(function (err) { + return topic.delSubscription(params.user).catch(function (err) { if (errorHandler) { errorHandler(err.message, 'err'); } @@ -7078,18 +7142,22 @@ var ContextMenu = function (_React$Component) { } }, 'member_mute': { + id: 'member_mute', title: formatMessage(messages.mute), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '-P') }, 'member_unmute': { + id: 'member_unmute', title: formatMessage(messages.unmute), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '+P') }, 'member_block': { + id: 'member_block', title: formatMessage(messages.block), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '-J') }, 'member_unblock': { + id: 'member_unblock', title: formatMessage(messages.unblock), handler: _this.topicPermissionSetter.bind(_assertThisInitialized(_assertThisInitialized(_this)), '+J') } @@ -7139,7 +7207,11 @@ var ContextMenu = function (_React$Component) { item = this.MenuItems[item]; } - item.handler(this.props.params, this.props.onError); + if (!item) { + console.log("Invalid menu item ID", e.currentTarget.dataset.id); + } else { + this.props.onAction(item.id, item.handler(this.props.params, this.props.onError), this.props.params); + } } }, { key: "deleteMessages", @@ -7156,7 +7228,7 @@ var ContextMenu = function (_React$Component) { } var promise = all ? topic.delMessagesAll(hard) : topic.delMessagesList([params.seq], hard); - promise.catch(function (err) { + return promise.catch(function (err) { if (errorHandler) { errorHandler(err.message, 'err'); } @@ -7187,7 +7259,7 @@ var ContextMenu = function (_React$Component) { am = topic.getAccessMode().updateWant(mode).getWant(); } - topic.setMeta({ + return topic.setMeta({ sub: { user: params.user, mode: am diff --git a/umd/index.dev.js.map b/umd/index.dev.js.map index df6950f0..c269aba5 100644 --- a/umd/index.dev.js.map +++ b/umd/index.dev.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///../tinode-js/umd/tinode.prod.js","webpack:///./node_modules/react-intl/locale-data/ru.js","webpack:///(webpack)/buildin/global.js","webpack:///./src/config.js","webpack:///./src/index.js","webpack:///./src/lib/blob-helpers.js","webpack:///./src/lib/host-name.js","webpack:///./src/lib/local-storage.js","webpack:///./src/lib/navigation.js","webpack:///./src/lib/strformat.js","webpack:///./src/lib/utils.js","webpack:///./src/version.js","webpack:///./src/views/contacts-view.jsx","webpack:///./src/views/create-account-view.jsx","webpack:///./src/views/edit-account-view.jsx","webpack:///./src/views/info-view.jsx","webpack:///./src/views/login-view.jsx","webpack:///./src/views/logo-view.jsx","webpack:///./src/views/messages-view.jsx","webpack:///./src/views/new-topic-view.jsx","webpack:///./src/views/password-reset-view.jsx","webpack:///./src/views/settings-view.jsx","webpack:///./src/views/sidepanel-view.jsx","webpack:///./src/views/tinode-web.jsx","webpack:///./src/views/validation-view.jsx","webpack:///./src/widgets/attachment.jsx","webpack:///./src/widgets/avatar-upload.jsx","webpack:///./src/widgets/chat-message.jsx","webpack:///./src/widgets/checkbox.jsx","webpack:///./src/widgets/chip-input.jsx","webpack:///./src/widgets/chip.jsx","webpack:///./src/widgets/contact-action.jsx","webpack:///./src/widgets/contact-badges.jsx","webpack:///./src/widgets/contact-list.jsx","webpack:///./src/widgets/contact.jsx","webpack:///./src/widgets/context-menu.jsx","webpack:///./src/widgets/error-panel.jsx","webpack:///./src/widgets/file-progress.jsx","webpack:///./src/widgets/group-manager.jsx","webpack:///./src/widgets/group-subs.jsx","webpack:///./src/widgets/host-selector.jsx","webpack:///./src/widgets/image-preview.jsx","webpack:///./src/widgets/in-place-edit.jsx","webpack:///./src/widgets/letter-tile.jsx","webpack:///./src/widgets/load-spinner.jsx","webpack:///./src/widgets/menu-cancel.jsx","webpack:///./src/widgets/menu-contacts.jsx","webpack:///./src/widgets/menu-start.jsx","webpack:///./src/widgets/more-button.jsx","webpack:///./src/widgets/new-topic-by-id.jsx","webpack:///./src/widgets/new-topic-group.jsx","webpack:///./src/widgets/permissions-editor.jsx","webpack:///./src/widgets/received-marker.jsx","webpack:///./src/widgets/search-contacts.jsx","webpack:///./src/widgets/send-message.jsx","webpack:///./src/widgets/side-navbar.jsx","webpack:///./src/widgets/tag-manager.jsx","webpack:///./src/widgets/unread-badge.jsx","webpack:///./src/widgets/visible-password.jsx","webpack:///external \"firebase\"","webpack:///external [\"firebase\",\"messaging\"]","webpack:///external \"React\"","webpack:///external \"ReactDOM\"","webpack:///external \"ReactIntl\""],"names":["APP_NAME","PACKAGE_VERSION","API_KEY","KNOWN_HOSTS","hosted","local","DEFAULT_HOST","KEYPRESS_DELAY","RECEIVED_DELAY","READ_DELAY","MIN_TAG_LENGTH","MEDIA_BREAKPOINT","REM_SIZE","AVATAR_SIZE","BROKEN_IMAGE_SIZE","MESSAGES_PAGE","MAX_INBAND_ATTACHMENT_SIZE","MAX_EXTERN_ATTACHMENT_SIZE","MAX_IMAGE_DIM","addLocaleData","ruData","HashNavigation","parseUrlHash","window","location","hash","params","language","hl","navigator","languages","userLanguage","baseLanguage","toLowerCase","split","messages","allMessages","en","ReactDOM","render","React","Fragment","document","getElementById","SUPPORTED_IMAGE_FORMATS","MIME_EXTENSIONS","makeImageUrl","photo","type","data","fitImageSize","width","height","maxWidth","maxHeight","forceSquare","Math","min","scale","size","dstWidth","dstHeight","srcWidth","srcHeight","xoffset","yoffset","fileNameForMime","fname","mime","idx","indexOf","ext","at","lastIndexOf","substring","imageFileScaledToBase64","file","onSuccess","onError","img","Image","crossOrigin","onerror","err","onload","dim","canvas","createElement","ctx","getContext","imageSmoothingEnabled","drawImage","imageBits","toDataURL","parts","getMimeType","quality","base64DecodedLen","length","bytesToHumanSize","name","src","URL","createObjectURL","imageFileToBase64","reader","FileReader","addEventListener","result","readAsDataURL","fileToBase64","filePasted","event","onImageSuccess","onAttachmentSuccess","items","clipboardData","originalEvent","i","item","kind","getAsFile","console","log","header","exec","base64EncodedLen","n","floor","base64ReEncode","str","replace","btoa","atob","detectServerAddress","host","protocol","hostname","port","isSecureConnection","isLocalHost","LocalStorageUtil","key","value","localStorage","setItem","JSON","stringify","getItem","parse","oldVal","getObject","setObject","Object","assign","removeItem","path","substr","forEach","part","decodeURIComponent","url","join","args","hasOwnProperty","push","parsed","composeUrlHash","sidepanel","topic","info","shortDateFormat","then","locale","now","Date","getFullYear","getMonth","getDate","toLocaleTimeString","hour12","hour","minute","toLocaleDateString","month","day","year","bytes","sizes","bucket","log2","count","pow","round","toFixed","stringHash","charCodeAt","updateFavicon","oldIcon","head","getElementsByTagName","newIcon","id","rel","href","removeChild","appendChild","title","vcard","fn","imageDataUrl","card","trim","dataStart","arrayEqual","a","b","sort","l","defineMessages","archived_contacts_title","ContactsView","props","handleAction","bind","state","getDerivedStateFromProps","action","onShowArchive","no_contacts","connected","contactList","topicSelected","myUserId","onTopicSelected","showContextMenu","nextProps","prevState","contacts","unreadThreads","archivedCount","chatList","map","c","private","arch","archive","unread","touched","values","Component","CreateAccountView","login","password","email","errorCleared","saveToken","handleLoginChange","handlePasswordChange","handleEmailChange","handleFnChange","handleImageChanged","handleToggleSaveToken","handleSubmit","e","setState","target","preventDefault","onCreateAccount","submitClasses","disabled","login_prompt","password_prompt","full_name_prompt","email_prompt","stay_logged_in","PureComponent","EditAccountView","me","tinode","getMeTopic","defacs","getDefaultAccess","fnd","getFndTopic","fullName","public","undefined","avatar","auth","anon","tags","showPermissionEditorFor","previousOnTags","onTagsUpdated","tnNewTags","handleFullNameUpdate","handlePasswordUpdate","handleCheckboxClick","handleLaunchPermissionsEditor","handleHidePermissionsEditor","handlePermissionsChanged","handleTagsUpdated","isSubscribed","subscribe","startMetaQuery","withLaterDesc","withTags","build","catch","message","onUpdateAccount","pwd","what","checked","onToggleMessageSounds","onTogglePushNotifications","which","editedPermissions","perm","newState","slice","onUpdateTags","tag","full_name_placeholder","password_unchanged","messageSounds","desktopAlertsEnabled","desktopAlerts","title_tag_manager","onLogout","requested","granted","edit_permissions","other_user","InfoView","owner","admin","sharer","muted","address","groupTopic","selectedContact","access","modeGiven","modeWant","modeGiven2","modeWant2","showMemberPanel","moreInfoExpanded","previousMetaDesc","previousSubsUpdated","previousTagsUpdated","resetSubs","resetDesc","onMetaDesc","onSubsUpdated","handlePrivateUpdate","handleMuted","handleShowAddMembers","handleHideAddMembers","handleMemberUpdateRequest","handleLeave","handleMemberSelected","handleMoreInfo","handleContextMenu","getTopic","getType","user2","subscriber","acs","getGiven","getWant","subscribers","sub","getAccessMode","isOwner","isAdmin","isSharer","isMuted","comment","getMode","getMeta","desc","onTopicDescUpdate","priv","Tinode","DEL_CHAR","ignored","onChangePermissions","userPermissionsEdited","uid","formatMessage","intl","toEdit","toCompare","toSkip","titleEdit","titleCompare","userTitle","userAvatar","user","userPermissionsTitle","userPermissionsAvatar","immutablePermissions","editedPermissionsTitle","immutablePermissionsTitle","editedPermissionsSkipped","onInitFind","members","added","removed","onMemberUpdateRequest","onLeaveTopic","open","onTopicTagsUpdate","instance","topicName","menuItems","handler","isJoiner","x","y","onCancel","displayMobile","errorLevel","errorText","searchableContacts","private_placeholder","more","no_members","injectIntl","LoginView","hostName","serverAddress","onLogin","LogoView","version","getLibrary","hideSelf","serverVersion","Drafty","online_now","last_seen","MessagesView","onlineSubs","scrollPosition","readOnly","isWriter","writeOnly","isReader","typingIndicator","imagePreview","propsChange","leave","handleScrollReference","handleScrollEvent","handleDescChange","handleSubsUpdated","handleNewMessage","handleAllMessagesReceived","handleInfoReceipt","handleImagePreview","handleCloseImagePreview","handleFormResponse","handleContextClick","handleShowContextMenuMessage","handleBackNavigation","prevProps","messagesScroller","scrollTop","scrollHeight","viewportHeight","removeEventListener","oldTopic","newGroupTopic","isNewGroupTopicName","tryToResubscribe","msgs","subs","onData","onAllMessagesReceived","onInfo","onPres","online","msg","deleted","concat","readTimerHandler","getQuery","withLaterSub","withLaterData","withLaterDel","setQuery","newGroupTopicParams","fetchingMessages","ctrl","onNewTopicCreated","queuedMessages","pub","_sending","publishMessage","not_found","oldTopicName","finally","node","msgHasMoreMessages","getMessagesPage","m","isNewMessage","seq","status","msgStatus","MESSAGE_STATUS_SENT","noteRead","clearTimeout","keyPressTimer","setTimeout","forceUpdate","content","text","sendMessage","attachJSON","ref","searchParams","resp","set","search","stopPropagation","pageY","pageX","isDeleter","onHideMessagesView","component","messageNodes","previousFrom","chatBoxClass","nextFrom","from","sequence","isReply","deliveryStatus","userName","userFrom","userDesc","ts","_uploader","viewportWidth","lastSeen","cont","getContact","topicType","seen","when","NewTopicView","tabSelected","handleTabClick","handleContactSelected","handleNewGroupSubmit","handleGroupByID","navigateTo","addUrlParam","currentTarget","dataset","sel","removeUrlParam","onCreateTopic","dataUrl","onSearchContacts","search_for_contacts","searchResults","PasswordResetView","token","scheme","onReset","onRequest","reset","placeholder","SettingsView","transport","handleTransportSelected","handleServerAddressChange","onUpdate","names","def","ws","lp","transportOptions","SidepanelView","handleLoginRequested","onLoginRequest","view","onSignUp","onSettings","onNewTopic","errorAction","errorActionText","loginDisabled","onGlobalSettings","onUpdateAccountTags","credCode","credMethod","onValidateCredentials","onPasswordResetRequest","onResetPassword","POP_SOUND","Audio","update_available","reconnect_countdown","reconnect_now","TinodeWeb","getBlankState","handleResize","handleHashRoute","handleOnline","checkForAppUpdate","handleAppVisibility","handleReadTimer","handleVisibilityEvent","handleError","handleLoginRequest","handleConnected","handleAutoreconnectIteration","doLogin","handleCredentialsRequest","handleLoginSuccessful","handleDisconnect","tnMeMetaDesc","tnMeContactUpdate","tnMeSubsUpdated","resetContactList","tnData","tnInitFind","tnFndSubsUpdated","handleSearchContacts","handleTopicSelected","handleHideMessagesView","handleSendMessage","handleNewAccount","handleNewAccountRequest","handleUpdateAccountRequest","handleUpdateAccountTagsRequest","handleSettings","handleGlobalSettings","handleShowArchive","handleToggleMessageSounds","initDesktopAlerts","togglePushToken","requestPushToken","handleSidepanelCancel","handleNewTopic","handleNewTopicRequest","handleNewTopicCreated","handleTopicUpdateRequest","handleChangePermissions","handleLogout","handleLeaveUnsubRequest","handleDialogCancel","handleShowContextMenu","defaultTopicContextMenu","handleHideContextMenu","handleShowInfoView","handleHideInfoView","handleValidateCredentialsRequest","handlePasswordResetRequest","handleResetPassword","settings","messageSoundsOff","firebase","FIREBASE_INIT","firebaseToken","sidePanelSelected","sidePanelTitle","sidePanelAvatar","dialogSelected","contextMenuVisible","liveConnection","onLine","topicSelectedOnline","topicSelectedAcs","innerWidth","showInfoPanel","mobilePanel","documentElement","clientWidth","clientHeight","tnSetup","onConnect","onDisconnect","onAutoreconnectIteration","fbPush","messaging","usePublicVapidKey","messagingVapidKey","serviceWorker","register","reg","useServiceWorker","setDeviceToken","parsedNav","expires","setAuthToken","connect","tab","readTimer","readTimerCallback","mobile","formatHTMLMessage","onupdatefound","installingWorker","installing","onstatechange","controller","includes","method","code","newTopicTabSelected","visible","callback","hidden","level","actionText","isConnected","meth","getServerInfo","ver","sec","prom","clearInterval","reconnectCountdown","setInterval","seconds","reconnect","cred","isAuthenticated","credential","promise","getAuthToken","loginBasic","loginToken","onContactUpdate","getCurrentUserID","withDesc","setUrlSidePanel","play","unused","prepareSearchableContacts","receivedTimer","noteRecv","withSub","foundContacts","s","query","setMeta","unused_index","setUrlTopic","uploader","createMessage","Promise","resolve","publishDraft","isArchived","login_","password_","public_","cred_","tags_","createAccountBasic","updateAccountBasic","getCurrentLogin","disconnect","onTokenRefresh","onMessage","payload","enabled","requestPermission","updateObject","deleteToken","sendToServer","getToken","refreshedToken","peerName","newGroupTopicName","oldName","newName","permissions","mode","am","updateGiven","updateWant","contextMenuClickAt","contextMenuParams","contextMenuItems","contextMenuBounds","findDOMNode","getBoundingClientRect","blocked","subscribed","deleter","archived","invite","delSubscription","requestResetAuthSecret","newPassword","handleContextMenuAction","handleManageGroupMembers","enableLogging","merged","updated","phone","ValidationView","handleChange","handleKeyPress","onSubmit","methods","numbers_only","Attachment","downloader","progress","downloadFile","handleCancel","filename","mimetype","getLargeFileHelper","download","loaded","onCancelUpload","cancel","helperFunc","test","downloadUrl","AvatarUpload","handleFileUpload","handleClear","files","base64bits","du","onImageChanged","randId","random","ChatMessage","onProgress","handleProgress","handlePreviewImage","handleFormButtonClick","handleCancelUpload","onImagePreview","val","act","onFormResponse","ratio","sideClass","response","bubbleClass","fullDisplay","attachments","mimeType","getContentType","att","getDownloadUrl","isUploading","getEntitySize","format","draftyFormatter","timestamp","received","notFound","style","el","tagName","attr","attrValue","className","onClick","inner","Children","child","CheckBox","onChange","ChipInput","chips","prompt","sortedChips","sortChips","required","chipIndex","indexChips","input","focused","handleTextInput","removeChipAt","handleChipCancel","handleFocusGained","handleFocusLost","handleKeyDown","filterFunc","onChipRemoved","onFocusLost","onEnter","avatarDisabled","index","keep","normal","Chip","noAvatar","ContactAction","handleClick","onAction","ContactBadges","badges","color","badge_you","badge_owner","ContactList","showCheckmark","Array","isArray","contactNodes","contactsCount","filter","selected","showMode","showUnread","showOnline","noScroll","__html","emptyListMessage","Contact","onSelected","clear_messages","clear_for_all","delete_for_all","mute","unmute","topic_delete","unblock","block","member_delete","ContextMenu","handlePageClick","handleEscapeKey","MenuItems","errorHandler","deleteMessages","delete","topicPermissionSetter","delTopic","contains","hide","keyCode","all","hard","cancelSend","delMessagesAll","delMessagesList","menu","hSize","vSize","left","bounds","right","clickAt","top","bottom","position","ErrorPanel","show","onClearError","icons","warn","FileProgress","contacts_not_found","GroupManager","indexMembers","contactFilter","noContactsMessage","selectedContacts","handleMemberRemoved","handleContactFilter","userId","present","delta","splice","keys","k","requiredMember","doContactFiltering","GroupSubs","usersOnline","HostSelector","changed","handleHostNameChange","handleEditingFinished","onServerAddressChange","hostOptions","ImagePreview","container","maxlength","onClose","InPlaceEdit","active","initialValue","handeTextChange","handleStartEditing","handlePasswordFinished","focus","checkValidity","onFinished","fieldType","spanText","spanClass","autoComplete","LetterTile","letter","charAt","abs","LoadSpinner","MenuCancel","MenuContacts","MenuStart","MoreButton","handleToggle","onToggle","invalid_id","NewTopicById","groupId","NewTopicGroup","handlePrivateChange","handleTagsChanged","PermissionsEditor","before","joiner","writer","preser","approver","skip","compare","modeTitle","compareTitle","ReceivedMarker","MESSAGE_STATUS_SENDING","sending","MESSAGE_STATUS_FAILED","failed","marker","MESSAGE_STATUS_RECEIVED","MESSAGE_STATUS_READ","SearchContacts","edited","handleSearchChange","handleSearch","search_placeholder","SendMessage","keypressTimestamp","getTime","handlePasteEvent","handleAttachImage","handleAttachFile","handleSend","handleMessageTyping","messageEditArea","bits","insertImage","attachFile","file_attachment_too_large","limit","cannot_initiate_upload","uploadCompletionPromise","upload","shiftKey","noteKeyPress","messaging_disabled","type_new_message","attachImage","click","display","SideNavbar","TagManager","tagInput","activated","handleShowTagManager","handleTagInput","handleAddTag","handleRemoveTag","last","onTagsChanged","inp","add_tags_prompt","UnreadBadge","showUnreadBadge","VisiblePassword","handleVisibility","activeElement","autoFocus"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA,kDAA0C,gCAAgC;AAC1E;AACA;;AAEA;AACA;AACA;AACA,gEAAwD,kBAAkB;AAC1E;AACA,yDAAiD,cAAc;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iDAAy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AArB,GAA8B,UADtC;AAEE,aAAK,EAAE,KAAK5e,KAAL,CAAWlF,KAFpB;AAGE,mBAAW,EAAE,KAAK+E,KAAL,CAAWmW,WAH1B;AAIE,gBAAQ,EAAE,KAAKnW,KAAL,CAAWspB,QAAX,GAAsB,UAAtB,GAAmC,EAJ/C;AAKE,iBAAS,EAAE,KAAKtpB,KAAL,CAAWu2B,SAAX,GAAuB,WAAvB,GAAqC,EALlD;AAME,oBAAY,EAAE,KAAKv2B,KAAL,CAAWqxB,YAN3B;AAOE,gBAAQ,EAAE,KAAKT,eAPjB;AAQE,iBAAS,EAAE,KAAK5G;AARlB,QAFF,EAWE;AAAM,eAAO,EAAE,KAAKqM;AAApB,SACE;AAAG,iBAAS,EAAC;AAAb,SACG,KAAKl2B,KAAL,CAAW4e,OAAX,GAAqB,YAArB,GAAoC,gBADvC,CADF,CAXF,CADF;AAmBD;;;;EA3E0CrqB,4CAAK,CAAC4O,a;;;;;;;;;;;;;;;;;;;;;;;;;ACHnD,0B;;;;;;;;;;;ACAA,uC;;;;;;;;;;;ACAA,uB;;;;;;;;;;;ACAA,0B;;;;;;;;;;;ACAA,2B","file":"index.dev.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","!function(e){if(\"object\"==typeof exports&&\"undefined\"!=typeof module)module.exports=e();else if(\"function\"==typeof define&&define.amd)define([],e);else{(\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:this).Tinode=e()}}(function(){var e={exports:{}},t=[{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)/}],n=[{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}],i={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},FM:{name:\"div\",isVoid:!1},RW:{name:\"div\",isVoid:!1},BN:{name:\"button\",isVoid:!1},HD:{name:\"\",isVoid:!1}};function s(e,t){var n;try{for(var i=(n=atob(e)).length,s=new ArrayBuffer(i),r=new Uint8Array(s),o=0;o\"},close:function(){return\"\"}},EM:{open:function(){return\"\"},close:function(){return\"\"}},DL:{open:function(){return\"\"},close:function(){return\"\"}},CO:{open:function(){return\"\"},close:function(){return\"\"}},BR:{open:function(){return\"
    \"},close:function(){return\"\"}},HD:{open:function(){return\"\"},close:function(){return\"\"}},LN:{open:function(e){return''},close:function(e){return\"\"},props:function(e){return e?{href:e.url,target:\"_blank\"}:null}},MN:{open:function(e){return''},close:function(e){return\"\"},props:function(e){return e?{name:e.val}:null}},HT:{open:function(e){return''},close:function(e){return\"\"},props:function(e){return e?{name:e.val}:null}},BN:{open:function(e){return\"\"},props:function(e){return e?{\"data-act\":e.act,\"data-val\":e.val,\"data-name\":e.name,\"data-ref\":e.ref}:null}},IM:{open:function(e){var t=s(e.val,e.mime),n=e.ref?e.ref:t;return(e.name?'':\"\")+''},close:function(e){return e.name?\"\":\"\"},props:function(e){return e?{src:s(e.val,e.mime),title:e.name,\"data-width\":e.width,\"data-height\":e.height,\"data-name\":e.name,\"data-size\":e.val?.75*e.val.length|0:0,\"data-mime\":e.mime}:null}},FM:{open:function(e){return\"
    \"},close:function(e){return\"
    \"}},RW:{open:function(e){return\"
    \"},close:function(e){return\"
    \"}}},o=function(){};o.parse=function(e){if(\"string\"!=typeof e)return null;var i=e.split(/\\r?\\n/),s=[],r={},o=[];i.map(function(e){var i,a,c=[];if(t.map(function(t){c=c.concat(function(e,t,n,i){for(var s=[],r=0,o=e.slice(0);o.length>0;){var a=t.exec(o);if(null==a)break;var c=a.index+a[0].lastIndexOf(a[1]);o=o.slice(c+1),r=(c+=r)+1;var u=n?n.exec(o):null;if(null==u)break;var h=u.index+u[0].indexOf(u[1]);o=o.slice(h+1),r=(h+=r)+1,s.push({text:e.slice(c+1,h),children:[],start:c,end:h,type:i})}return s}(e,t.start,t.end,t.name))}),0==c.length)a={txt:e};else{c.sort(function(e,t){return e.start-t.start}),c=function e(t){if(0==t.length)return[];for(var n=[t[0]],i=t[0],s=1;si.end?(n.push(t[s]),i=t[s]):t[s].endn&&r.push({text:t.slice(n,a.start)});var c={type:a.type},u=e(t,a.start+1,a.end-1,a.children);u.length>0?c.children=u:c.text=a.text,r.push(c),n=a.end+1}return ns;return s=e.offset+e.len,t})}(a.txt)).length>0){var h=[];for(var l in i){var d=i[l],f=r[d.unique];f||(f=s.length,r[d.unique]=f,s.push({tp:d.type,data:d.data})),h.push({at:d.offset,len:d.len,key:f})}a.ent=h}o.push(a)});var a={txt:\"\"};if(o.length>0){a.txt=o[0].txt,a.fmt=(o[0].fmt||[]).concat(o[0].ent||[]);for(var c=1;c0&&(a.ent=s)}return a},o.insertImage=function(e,t,n,i,s,r,o,a,c){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:i,width:s,height:r,name:o,ref:c,size:0|a}}),e},o.appendImage=function(e,t,n,i,s,r,a,c){return(e=e||{txt:\"\"}).txt+=\" \",o.insertImage(e,e.txt.length-1,t,n,i,s,r,a,c)},o.attachFile=function(e,t,n,i,s,r){(e=e||{txt:\"\"}).ent=e.ent||[],e.fmt=e.fmt||[],e.fmt.push({at:-1,len:0,key:e.ent.length});var o={tp:\"EX\",data:{mime:t,val:n,name:i,ref:r,size:0|s}};return r instanceof Promise&&(o.data.ref=r.then(function(e){o.data.ref=e},function(e){})),e.ent.push(o),e},o.wrapAsForm=function(e,t,n){return\"string\"==typeof e&&(e={txt:e}),e.fmt=e.fmt||[],e.fmt.push({at:t,len:n,tp:\"FM\"}),e},o.insertButton=function(e,t,n,i,s,r,o){return\"string\"==typeof e&&(e={txt:e}),!e||!e.txt||e.txt.length0)for(var t in e.ent)if(e.ent[t]&&\"EX\"==e.ent[t].tp)return!0;return!1},o.attachments=function(e,t,n){if(e.ent&&e.ent.length>0)for(var i in e.ent)e.ent[i]&&\"EX\"==e.ent[i].tp&&t.call(n,e.ent[i].data,i)},o.getDownloadUrl=function(e){var t=null;return\"application/json\"!=e.mime&&e.val?t=s(e.val,e.mime):\"string\"==typeof e.ref&&(t=e.ref),t},o.isUploading=function(e){return e.ref instanceof Promise},o.getPreviewUrl=function(e){return e.val?s(e.val,e.mime):null},o.getEntitySize=function(e){return e.size?e.size:e.val?.75*e.val.length|0:0},o.getEntityMimeType=function(e){return e.mime||\"text/plain\"},o.tagName=function(e){return i[e]?i[e].name:void 0},o.attrValue=function(e,t){if(t&&r[e])return r[e].props(t)},o.getContentType=function(){return\"text/x-drafty\"},e.exports=o,e=e.exports;var a=\"0.15.12\",c={exports:{}};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)}if(\"function\"==typeof require)var i=a;var s;\"undefined\"!=typeof WebSocket&&(s=WebSocket),\"undefined\"==typeof btoa&&(t.btoa=function(){for(var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:\"\",n=\"\",i=0,s=0,r=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";t.charAt(0|s)||(r=\"=\",s%1);n+=r.charAt(63&i>>8-s%1*8)){if((e=t.charCodeAt(s+=.75))>255)throw new Error(\"'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.\");i=i<<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,i=0,s=0,r=0;n=e.charAt(r++);~n&&(s=i%4?64*s+n:n,i++%4)?t+=String.fromCharCode(255&s>>(-2*i&6)):0)n=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\".indexOf(n);return t}),\"undefined\"==typeof window&&(t.window={WebSocket:s,URL:{createObjectURL:function(){throw new Error(\"Unable to use window.URL in a non browser application\")}}});var r=\"0\",o=i||\"0.15\",u=\"tinodejs/\"+o,h=503,l=\"Connection failed\",d=418,f=\"Disconnected by client\";function p(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode(\"0x\"+t)}))}function g(e,t,i){if(\"object\"!=n(t)){if(t===M.DEL_CHAR)return;return t}if(null===t)return t;if(t instanceof Date)return t;if(t instanceof T)return new T(t);if(t instanceof Array)return t;for(var s in e&&e!==M.DEL_CHAR||(e=t.constructor()),t)!t.hasOwnProperty(s)||i&&i[s]||\"_generated\"==s||(e[s]=g(e[s],t[s]));return e}function v(e,t,n,i){return e[t]=g(e[t],n,i),e[t]}function m(){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 _(e,t){if(\"ts\"===e&&\"string\"==typeof t&&t.length>=20&&t.length<=24){var i=new Date(t);if(i)return i}else if(\"acs\"===e&&\"object\"===n(t))return new T(t);return t}function b(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 w(e,t,n){var i=null;return\"http\"!==t&&\"https\"!==t&&\"ws\"!==t&&\"wss\"!==t||(i=t+\"://\",\"/\"!==(i+=e).charAt(i.length-1)&&(i+=\"/\"),i+=\"v\"+r+\"/channels\",\"http\"!==t&&\"https\"!==t||(i+=\"/lp\"),i+=\"?apikey=\"+n),i}var S=function(e,t,i,r,o){var a=this,c=e,u=r,p=t,g=o,v=2e3,b=10,S=.3,M=null,y=0,T=!1,D=function(e){a.logger&&a.logger(e)};function x(){var e=this;clearTimeout(M);var t=v*(Math.pow(2,y)*(1+S*Math.random()));y=y>=b?y:y+1,this.onAutoreconnectIteration&&this.onAutoreconnectIteration(t),M=setTimeout(function(){if(D(\"Reconnecting, iter=\"+y+\", timeout=\"+t),T)e.onAutoreconnectIteration&&e.onAutoreconnectIteration(-1);else{var n=e.connect();e.onAutoreconnectIteration?e.onAutoreconnectIteration(0,n):n.catch(function(){})}},t)}function E(){clearTimeout(M),M=null,y=0}function A(e){var t=null;e.connect=function(n){return T=!1,t&&t.readyState==t.OPEN?Promise.resolve():(n&&(c=n),new Promise(function(n,i){var r=w(c,u?\"wss\":\"ws\",p);D(\"Connecting to: \"+r);var o=new s(r);o.onopen=function(t){e.onOpen&&e.onOpen(),n(),g&&E()},o.onclose=function(n){if(t=null,e.onDisconnect){var i=T?d:h;e.onDisconnect(new Error(T?f:l+\" (\"+i+\")\"),i)}!T&&g&&x.call(e)},o.onerror=function(e){i(e)},o.onmessage=function(t){e.onMessage&&e.onMessage(t.data)},t=o}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,t&&(E(),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&&t.readyState==t.OPEN},e.transport=function(){return\"ws\"},e.probe=function(){e.sendText(\"1\")}}function R(e){var t=null,n=null,i=null;e.connect=function(i){return T=!1,n?Promise.resolve():(i&&(c=i),new Promise(function(i,s){var r=w(c,u?\"https\":\"http\",p);D(\"Connecting to: \"+r),(n=function n(i,s,r){var o=m(),a=!1;return o.onreadystatechange=function(c){if(4==o.readyState)if(201==o.status){var u=JSON.parse(o.responseText,_);t=i+\"&sid=\"+u.ctrl.params.sid,(o=n(t)).send(null),e.onOpen&&e.onOpen(),s&&(a=!0,s()),g&&E()}else if(o.status<400)e.onMessage&&e.onMessage(o.responseText),(o=n(t)).send(null);else{if(r&&!a&&(a=!0,r(o.responseText)),e.onMessage&&o.responseText&&e.onMessage(o.responseText),e.onDisconnect){var p=o.status||(T?d:h),v=o.responseText||(T?f:l);e.onDisconnect(new Error(v+\" (\"+p+\")\"),p)}o=null,!T&&g&&x.call(e)}},o.open(\"GET\",i,!0),o}(r,i,s)).send(null)}).catch(function(){}))},e.reconnect=function(){E(),e.connect()},e.disconnect=function(){T=!0,E(),i&&(i.onreadystatechange=void 0,i.abort(),i=null),n&&(n.onreadystatechange=void 0,n.abort(),n=null),e.onDisconnect&&e.onDisconnect(new Error(f+\" (\"+d+\")\"),d),t=null},e.sendText=function(e){var n,s;if(n=t,(s=m()).onreadystatechange=function(e){if(4==s.readyState&&s.status>=400)throw new Error(\"LP sender failed, \"+s.status)},s.open(\"POST\",n,!0),!(i=s)||1!=i.readyState)throw new Error(\"Long poller failed to connect\");i.send(e)},e.isConnected=function(){return n&&!0},e.transport=function(){return\"lp\"},e.probe=function(){e.sendText(\"1\")}}\"lp\"===i?R(this):\"ws\"===i?A(this):\"object\"==(\"undefined\"==typeof window?\"undefined\":n(window))&&window.WebSocket?A(this):R(this),this.onMessage=void 0,this.onDisconnect=void 0,this.onOpen=void 0,this.onAutoreconnectIteration=void 0,this.logger=void 0},M=function(e,t,i,s,r,a){var c=this;this._appName=e||\"Undefined\",this._apiKey=i,this._browser=\"\",this._platform=a,this._hwos=\"undefined\",this._humanLanguage=\"xx\",\"undefined\"!=typeof navigator&&(this._browser=function(e,t){e=e||\"\";var n=\"\";/reactnative/i.test(t)&&(n=\"ReactNative; \");var i,s=(e=e.replace(\" (KHTML, like Gecko)\",\"\")).match(/(AppleWebKit\\/[.\\d]+)/i);if(s){for(var r=[\"chrome\",\"safari\",\"mobile\",\"version\"],o=e.substr(s.index+s[0].length).split(\" \"),a=[],c=function(e){var t=/([\\w.]+)[\\/]([\\.\\d]+)/.exec(o[e]);t&&a.push([t[1],t[2],r.findIndex(function(e){return e==t[1].toLowerCase()})])},u=0;u0?a[0][0]+\"/\"+a[0][1]:s[1]}else i=/trident/i.test(e)?(s=/(?:\\brv[ :]+([.\\d]+))|(?:\\bMSIE ([.\\d]+))/g.exec(e))?\"MSIE/\"+(s[1]||s[2]):\"MSIE/?\":/firefox/i.test(e)?(s=/Firefox\\/([.\\d]+)/g.exec(e))?\"Firefox/\"+s[1]:\"Firefox/?\":/presto/i.test(e)?(s=/Opera\\/([.\\d]+)/g.exec(e))?\"Opera/\"+s[1]:\"Opera/?\":(s=/([\\w.]+)\\/([.\\d]+)/.exec(e))?s[1]+\"/\"+s[2]:(s=e.split(\" \"))[0];if((s=i.split(\"/\")).length>1){var h=s[1].split(\".\");i=s[0]+\"/\"+h[0]+(h[1]?\".\"+h[1]:\"\")}return n+i}(navigator.userAgent,navigator.product),this._hwos=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 S(t,i,s,r,!0),this.logger=function(e){if(c._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 l=this.cachePut=function(e,t,n){c._cache[e+\":\"+t]=n},d=this.cacheGet=function(e,t){return c._cache[e+\":\"+t]},f=this.cacheDel=function(e,t){delete c._cache[e+\":\"+t]},p=this.cacheMap=function(e,t){for(var n in c._cache)if(e(c._cache[n],n,t))break};this.attachCacheToTopic=function(e){e._tinode=c,e._cacheGetUser=function(e){var t=d(\"user\",e);if(t)return{user:e,public:g({},t)}},e._cachePutUser=function(e,t){return l(\"user\",e,g({},t.public))},e._cacheDelUser=function(e){return f(\"user\",e)},e._cachePutSelf=function(){return l(\"topic\",e.name,e)},e._cacheDelSelf=function(){return f(\"topic\",e.name)}};var v=function(e,t,n,i){var s=c._pendingPromises[e];s&&(delete c._pendingPromises[e],t>=200&&t<400?s.resolve&&s.resolve(n):s.reject&&s.reject(new Error(\"Error: \"+i+\" (\"+t+\")\")))},m=this.getNextUniqueId=function(){return 0!=c._messageId?\"\"+c._messageId++:void 0};this.initPacket=function(e,t){switch(e){case\"hi\":return{hi:{id:m(),ver:o,ua:c._appName+\" (\"+(c._browser?c._browser+\"; \":\"\")+c._hwos+\"); \"+u,dev:c._deviceToken,lang:c._humanLanguage,platf:c._platform}};case\"acc\":return{acc:{id:m(),user:null,scheme:null,secret:null,login:!1,tags:null,desc:{},cred:{}}};case\"login\":return{login:{id:m(),scheme:null,secret:null}};case\"sub\":return{sub:{id:m(),topic:t,set:{},get:{}}};case\"leave\":return{leave:{id:m(),topic:t,unsub:!1}};case\"pub\":return{pub:{id:m(),topic:t,noecho:!1,head:null,content:{}}};case\"get\":return{get:{id:m(),topic:t,what:null,desc:{},sub:{},data:{}}};case\"set\":return{set:{id:m(),topic:t,desc:{},sub:{},tags:[]}};case\"del\":return{del:{id:m(),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 i;t&&(i=function(e){var t=null;return e&&(t=new Promise(function(t,n){c._pendingPromises[e]={resolve:t,reject:n}})),t}(t)),e=function e(t){return Object.keys(t).forEach(function(i){\"_\"==i[0]?delete t[i]:t[i]?Array.isArray(t[i])&&0==t[i].length?delete t[i]:t[i]?\"object\"!=n(t[i])||t[i]instanceof Date||(e(t[i]),0==Object.getOwnPropertyNames(t[i]).length&&delete t[i]):delete t[i]:delete t[i]}),t}(e);var s=JSON.stringify(e);c.logger(\"out: \"+(c._trimLongStrings?JSON.stringify(e,b):s));try{c._connection.sendText(s)}catch(e){if(!t)throw e;v(t,h,null,e.message)}return i},this.loginSuccessful=function(e){e.params&&e.params.user&&(c._myUID=e.params.user,c._authenticated=e&&e.code>=200&&e.code<300,e.params&&e.params.token&&e.params.expires?c._authToken={token:e.params.token,expires:new Date(e.params.expires)}:c._authToken=null,c.onLogin&&c.onLogin(e.code,e.text))},this._connection.onMessage=function(e){if(e)if(c._inPacketCount++,c.onRawMessage&&c.onRawMessage(e),\"0\"!==e){var t=JSON.parse(e,_);if(t)if(c.logger(\"in: \"+(c._trimLongStrings?JSON.stringify(t,b):e)),c.onMessage&&c.onMessage(t),t.ctrl){if(c.onCtrlMessage&&c.onCtrlMessage(t.ctrl),t.ctrl.id&&v(t.ctrl.id,t.ctrl.code,t.ctrl,t.ctrl.text),t.ctrl.params&&\"data\"==t.ctrl.params.what){var n=d(\"topic\",t.ctrl.topic);n&&n._allMessagesReceived(t.ctrl.params.count)}}else if(t.meta){var i=d(\"topic\",t.meta.topic);i&&i._routeMeta(t.meta),c.onMetaMessage&&c.onMetaMessage(t.meta)}else if(t.data){var s=d(\"topic\",t.data.topic);s&&s._routeData(t.data),c.onDataMessage&&c.onDataMessage(t.data)}else if(t.pres){var r=d(\"topic\",t.pres.topic);r&&r._routePres(t.pres),c.onPresMessage&&c.onPresMessage(t.pres)}else if(t.info){var o=d(\"topic\",t.info.topic);o&&o._routeInfo(t.info),c.onInfoMessage&&c.onInfoMessage(t.info)}else c.logger(\"ERROR: Unknown packet received.\");else c.logger(\"in: \"+e),c.logger(\"ERROR: failed to parse data\")}else c.onNetworkProbe&&c.onNetworkProbe()},this._connection.onOpen=function(){c.hello()},this._connection.onAutoreconnectIteration=function(e,t){c.onAutoreconnectIteration&&c.onAutoreconnectIteration(e,t)},this._connection.onDisconnect=function(e,t){for(var n in c._inPacketCount=0,c._serverInfo=null,c._authenticated=!1,c._pendingPromises){var i=c._pendingPromises[n];i&&i.reject&&i.reject(e)}c._pendingPromises={},p(function(e,t){0===t.lastIndexOf(\"topic:\",0)&&e._resetSub()}),c.onDisconnect&&c.onDisconnect(e)}};M.credential=function(e,t,i,s){if(\"object\"==n(e)){var r=e;t=r.val,i=r.params,s=r.resp,e=r.meth}return e&&(t||s)?[{meth:e,val:t,resp:s,params:i}]:null},M.topicType=function(e){return{me:\"me\",fnd:\"fnd\",grp:\"grp\",new:\"grp\",usr:\"p2p\"}[\"string\"==typeof e?e.substring(0,3):\"xxx\"]},M.isNewGroupTopicName=function(e){return\"string\"==typeof e&&\"new\"==e.substring(0,3)},M.getVersion=function(){return o},M.setWebSocketProvider=function(e){s=e},M.getLibrary=function(){return u},M.MESSAGE_STATUS_NONE=0,M.MESSAGE_STATUS_QUEUED=1,M.MESSAGE_STATUS_SENDING=2,M.MESSAGE_STATUS_FAILED=3,M.MESSAGE_STATUS_SENT=4,M.MESSAGE_STATUS_RECEIVED=5,M.MESSAGE_STATUS_READ=6,M.MESSAGE_STATUS_TO_ME=7,M.DEL_CHAR=\"\\u2421\",M.prototype={connect:function(e){return this._connection.connect(e)},reconnect:function(){this._connection.reconnect()},disconnect:function(){this._connection.disconnect()},networkProbe:function(){this._connection.probe()},isConnected:function(){return this._connection.isConnected()},isAuthenticated:function(){return this._authenticated},account:function(e,t,n,i,s){var r=this.initPacket(\"acc\");return r.acc.user=e,r.acc.scheme=t,r.acc.secret=n,r.acc.login=i,s&&(r.acc.desc.defacs=s.defacs,r.acc.desc.public=s.public,r.acc.desc.private=s.private,r.acc.tags=s.tags,r.acc.cred=s.cred,r.acc.token=s.token),this.send(r,r.acc.id)},createAccount:function(e,t,n,i){var s=this,r=this.account(\"new\",e,t,n,i);return n&&(r=r.then(function(e){return s.loginSuccessful(e),e})),r},createAccountBasic:function(e,t,n){return e=e||\"\",t=t||\"\",this.createAccount(\"basic\",p(e+\":\"+t),!0,n)},updateAccountBasic:function(e,t,n,i){return t=t||\"\",n=n||\"\",this.account(e,\"basic\",p(t+\":\"+n),!1,i)},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 i=this,s=this.initPacket(\"login\");return s.login.scheme=e,s.login.secret=t,s.login.cred=n,this.send(s,s.login.id).then(function(e){return i.loginSuccessful(e),e})},loginBasic:function(e,t,n){var i=this;return this.login(\"basic\",p(e+\":\"+t),n).then(function(t){return i._login=e,t})},loginToken:function(e,t){return this.login(\"token\",e,t)},requestResetAuthSecret:function(e,t,n){return this.login(\"reset\",p(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 i=this.initPacket(\"sub\",e);return e||(e=\"new\"),i.sub.get=t,n&&(n.sub&&(i.sub.set.sub=n.sub),M.isNewGroupTopicName(e)&&n.desc&&(i.sub.set.desc=n.desc),n.tags&&(i.sub.set.tags=n.tags)),this.send(i,i.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,i){var s=this.initPacket(\"pub\",t),r=\"string\"==typeof n?e.parse(n):n;return r&&!e.isPlainText(r)&&(s.pub.head={mime:e.getContentType()},n=r),s.pub.noecho=i,s.pub.content=n,s.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=g(n.get,t),this.send(n,n.get.id)},setMeta:function(e,t){var n=this.initPacket(\"set\",e),i=[];return t&&[\"desc\",\"sub\",\"tags\"].map(function(e){t.hasOwnProperty(e)&&(i.push(e),n.set[e]=t[e])}),0==i.length?Promise.reject(new Error(\"Invalid {set} parameters\")):this.send(n,n.set.id)},delMessages:function(e,t,n){var i=this.initPacket(\"del\",e);return i.del.what=\"msg\",i.del.delseq=t,i.del.hard=n,this.send(i,i.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 i=this.initPacket(\"note\",e);i.note.what=t,i.note.seq=n,this.send(i)},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 x:\"fnd\"==e?new E:new D(e),this.cachePut(\"topic\",e,t),this.attachCacheToTopic(t)),t},newTopic:function(e){var t=new D(\"new\",e);return this.attachCacheToTopic(t),t},newGroupTopicName:function(){return\"new\"+this.getNextUniqueId()},newTopicWith:function(e,t){var n=new D(e,t);return this.attachCacheToTopic(n),n},getMeTopic:function(){return this.getTopic(\"me\")},getFndTopic:function(){return this.getTopic(\"fnd\")},getLargeFileHelper:function(){return new A(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,onNetworkProbe:void 0,onAutoreconnectIteration:void 0};var y=function(e){this.topic=e;var t=e._tinode.getMeTopic();this.contact=t&&t.getContact(e.name),this.what={}};y.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 i={ims:e,limit:t};return\"me\"==this.topic.getType()?i.topic=n:i.user=n,this.what.sub=i,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=this,n={};return[\"data\",\"sub\",\"desc\",\"tags\",\"del\"].map(function(i){t.what.hasOwnProperty(i)&&(e.push(i),Object.getOwnPropertyNames(t.what[i]).length>0&&(n[i]=t.what[i]))}),e.length>0?n.what=e.join(\" \"):n=void 0,n}};var T=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)};T._NONE=0,T._JOIN=1,T._READ=2,T._WRITE=4,T._PRES=8,T._APPROVE=16,T._SHARE=32,T._DELETE=64,T._OWNER=128,T._BITMASK=T._JOIN|T._READ|T._WRITE|T._PRES|T._APPROVE|T._SHARE|T._DELETE|T._OWNER,T._INVALID=1048576,T.decode=function(e){if(!e)return null;if(\"number\"==typeof e)return e&T._BITMASK;if(\"N\"===e||\"n\"===e)return T._NONE;for(var t={J:T._JOIN,R:T._READ,W:T._WRITE,P:T._PRES,A:T._APPROVE,S:T._SHARE,D:T._DELETE,O:T._OWNER},n=T._NONE,i=0;i0)){c=!0;break}r=o-1}return c?o:i?-1:a<0?o+1:o}return e=e||function(e,t){return e===t?0:e0)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,i,s){n|=0,i=i||t.length;for(var r=n;r=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 i=n._tinode.getMeTopic();i&&i._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 i=[];e.attachments(t.content,function(e){i.push(e.ref)}),t.head.attachments=i}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 i=e.seq||this._getQueuedSeqId();return e._generated||(e._generated=!0,e.seq=i,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,i=this.startMetaQuery();t?i.withLaterData(e):i.withEarlierData(e);var s=this.getMeta(i.build());return t||(s=s.then(function(e){e&&e.params&&!e.params.count&&(n._noEarlierMsgs=!0)})),s},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,i=e.length;n1&&t.push(s)}t.sort().filter(function(e,t,n){return!t||e!=n[t-1]})}return 0==t.length&&t.push(M.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}})},archive:function(e){return this.setMeta({desc:{private:{arch:!!e||M.DEL_CHAR}}})},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.hi)});var i=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(i.length>0?this._tinode.delMessages(this.name,i,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]0){var i=this._tinode.getCurrentUserID();for(var s in this._users){var r=this._users[s];r.user!==i&&r[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),i=this.msgStatus(n);if(1==i||3==i)return n._cancelled=!0,this._messages.delAt(t),this.onData&&this.onData(),!0}return!1},getType:function(){return M.topicType(this.name)},getAccessMode:function(){return this.acs},getDefaultAccess:function(){return this.defacs},startMetaQuery:function(){return new y(this)},isArchived:function(){return!(!this.private||!this.private.arch)},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.touchedthis._maxSeq&&(this._maxSeq=e.seq),(e.seq0&&(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!=T._NONE||(\"p2p\"==this.getType()&&this.leave(),this._processMetaSub([{user:n,deleted:new Date,_generated:!0}]));else{var i=(new T).updateAll(e.dacs);i&&i.mode!=T._NONE&&((t=this._cacheGetUser(n))?t.acs=i:(t={user:n,acs:i},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);var n=this._tinode.getMeTopic();n&&n.setMsgReadRecv(e.from,e.what,e.seq)}this.onInfo&&this.onInfo(e)},_processMetaDesc:function(e,t){if(g(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){console.log(\"_processMetaDesc routing to 'me'\",this.private);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 i=e[n];if(i.user){i.updated=new Date(i.updated),i.deleted=i.deleted?new Date(i.deleted):null;var s=null;i.deleted?(delete this._users[i.user],s=i):s=this._updateCachedUser(i.user,i,i._generated),this.onMetaSub&&this.onMetaSub(s)}else i._generated||(t=i)}t&&this.onMetaDesc&&this.onMetaDesc(t),this.onSubsUpdated&&this.onSubsUpdated(Object.keys(this._users))},_processMetaTags:function(e){1==e.length&&e[0]==M.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,i=0;Array.isArray(t)&&t.map(function(e){if(e.hi)for(var t=e.low;t0&&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 T(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 i=this._cacheGetUser(e);return i?i=g(i,t):(n&&this.getMeta(this.startMetaQuery().withLaterOneSub(e).build()),i=g({},t)),this._cachePutUser(e,i),v(this._users,e,i)},_getQueuedSeqId:function(){return this._queuedSeqId++}};var x=function(e){D.call(this,\"me\",e),this._contacts={},e&&(this.onContactUpdate=e.onContactUpdate)};x.prototype=Object.create(D.prototype,{_processMetaSub:{value:function(e){var t=0;for(var n in e){var i=e[n],s=i.topic;if(\"fnd\"!=s&&\"me\"!=s){i.updated=new Date(i.updated),i.touched=i.touched?new Date(i.touched):null,i.deleted=i.deleted?new Date(i.deleted):null,i.seq=0|i.seq,i.recv=0|i.recv,i.read=0|i.read,i.unread=i.seq-i.read;var r=null;if(i.deleted)r=i,delete this._contacts[s];else if(i.seen&&i.seen.when&&(i.seen.when=new Date(i.seen.when)),r=v(this._contacts,s,i),\"p2p\"==M.topicType(s)&&this._cachePutUser(s,r),!i._generated){var o=this._tinode.getTopic(s);o&&o._processMetaDesc(i,!0)}t++,this.onMetaSub&&this.onMetaSub(r)}}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 T).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 T(e.dacs);if(!n||n.mode==T._INVALID)return void this._tinode.logger(\"Invalid access mode update\",e.src,e.dacs);if(n.mode==T._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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0},setMsgReadRecv:{value:function(e,t,n,i){var s,r=this._contacts[e],o=!1;if(r){switch(n|=0,t){case\"recv\":s=r.recv,r.recv=r.recv?Math.max(r.recv,n):n,o=s!=r.recv;break;case\"read\":s=r.read,r.read=r.read?Math.max(r.read,n):n,r.unread=r.seq-r.read,o=s!=r.read,r.recv0&&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(E.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 i in this._contacts)n.call(t,this._contacts[i],i,this._contacts)},enumerable:!0,configurable:!0,writable:!0}}),E.prototype.constructor=E;var A=function(e){this._tinode=e,this._apiKey=e._apiKey,this._authToken=e.getAuthToken(),this._msgId=e.getNextUniqueId(),this.xhr=m(),this.toResolve=null,this.toReject=null,this.onProgress=null,this.onSuccess=null,this.onFailure=null};A.prototype={upload:function(e,t,n,i){var s=this;if(!this._authToken)throw new Error(\"Must authenticate first\");var o=this;this.xhr.open(\"POST\",\"/v\"+r+\"/file/u/\",!0),this.xhr.setRequestHeader(\"X-Tinode-APIKey\",this._apiKey),this.xhr.setRequestHeader(\"X-Tinode-Auth\",\"Token \"+this._authToken.token);var a=new Promise(function(e,t){s.toResolve=e,s.toReject=t});this.onProgress=t,this.onSuccess=n,this.onFailure=i,this.xhr.upload.onprogress=function(e){e.lengthComputable&&o.onProgress&&o.onProgress(e.loaded/e.total)},this.xhr.onload=function(){var e;try{e=JSON.parse(this.response,_)}catch(e){o._tinode.logger(\"Invalid server response in LargeFileHelper\",this.response)}this.status>=200&&this.status<300?(o.toResolve&&o.toResolve(e.ctrl.params.url),o.onSuccess&&o.onSuccess(e.ctrl)):this.status>=400?(o.toReject&&o.toReject(new Error(e.ctrl.text+\" (\"+e.ctrl.code+\")\")),o.onFailure&&o.onFailure(e.ctrl)):o._tinode.logger(\"Unexpected server response status\",this.status,this.response)},this.xhr.onerror=function(e){o.toReject&&o.toReject(new Error(\"failed\")),o.onFailure&&o.onFailure(null)},this.xhr.onabort=function(e){o.toReject&&o.toReject(new Error(\"upload cancelled by user\")),o.onFailure&&o.onFailure(null)};try{var c=new FormData;c.append(\"file\",e),c.set(\"id\",this._msgId),this.xhr.send(c)}catch(e){this.toReject&&this.toReject(e),this.onFailure&&this.onFailure(null)}return a},download:function(e,t,n,i){var s=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 r=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=i,this.xhr.onprogress=function(e){r.onProgress&&r.onProgress(e.loaded)};var o=new Promise(function(e,t){s.toResolve=e,s.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),r.toResolve&&r.toResolve()}else if(this.status>=400&&r.toReject){var i=new FileReader;i.onload=function(){try{var e=JSON.parse(this.result,_);r.toReject(new Error(e.ctrl.text+\" (\"+e.ctrl.code+\")\"))}catch(e){r._tinode.logger(\"Invalid server response in LargeFileHelper\",this.result),r.toReject(e)}},i.readAsText(this.response)}},this.xhr.onerror=function(e){r.toReject&&r.toReject(new Error(\"failed\"))},this.xhr.onabort=function(){r.toReject&&r.toReject(null)};try{this.xhr.send()}catch(e){this.toReject&&this.toReject(e)}return o},cancel:function(){this.xhr&&this.xhr.readyState<4&&this.xhr.abort()},getId:function(){return this._msgId}};var R=function e(t,n){this.status=e.STATUS_NONE,this.topic=t,this.content=n};R.STATUS_NONE=0,R.STATUS_QUEUED=1,R.STATUS_SENDING=2,R.STATUS_FAILED=3,R.STATUS_SENT=4,R.STATUS_RECEIVED=5,R.STATUS_READ=6,R.STATUS_TO_ME=7,(R.prototype={toJSON:function(){},fromJSON:function(e){}}).constructor=R,c.exports=M,c.exports.Drafty=e}.call(this,\"undefined\"!=typeof global?global:\"undefined\"!=typeof self?self:\"undefined\"!=typeof window?window:{}),c=c.exports});","!function(e,a){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=a():\"function\"==typeof define&&define.amd?define(a):(e.ReactIntlLocaleData=e.ReactIntlLocaleData||{},e.ReactIntlLocaleData.ru=a())}(this,function(){\"use strict\";return[{locale:\"ru\",pluralRuleFunction:function(e,a){var t=String(e).split(\".\"),r=t[0],o=!t[1],n=r.slice(-1),l=r.slice(-2);return a?\"other\":o&&1==n&&11!=l?\"one\":o&&n>=2&&n<=4&&(l<12||l>14)?\"few\":o&&0==n||o&&n>=5&&n<=9||o&&l>=11&&l<=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} года назад\"}}},\"year-short\":{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} месяца назад\"}}},\"month-short\":{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} дня назад\"}}},\"day-short\":{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} часа назад\"}}},\"hour-short\":{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} минуты назад\"}}},\"minute-short\":{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} секунды назад\"}}},\"second-short\":{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\"}]});\n","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || new Function(\"return this\")();\n} catch (e) {\n\t// This works if the window reference is available\n\tif (typeof window === \"object\") g = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n","import { PACKAGE_VERSION } from './version.js';\n\n// Name of this application, used in the User-Agent.\nexport const APP_NAME = 'TinodeWeb/' + (PACKAGE_VERSION || '0.15');\n\n// API key. Use https://github.com/tinode/chat/tree/master/keygen to generate your own\nexport const API_KEY = 'AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K';\n\n// The array of possible hosts to connect to.\nexport const KNOWN_HOSTS = {hosted: 'api.tinode.co', local: 'localhost:6060'};\n\n// Default host name and port to connect to.\nexport const DEFAULT_HOST = KNOWN_HOSTS.hosted;\n\n// Minimum time between two keypress notifications, milliseconds.\nexport const KEYPRESS_DELAY = 3*1000;\n// Delay before sending a {note} for reciving a message, milliseconds.\nexport const RECEIVED_DELAY = 500;\n// Delay before sending a read notification, milliseconds.\nexport const READ_DELAY = 1000;\n\n// The shortest allowed tag length. Matches the value on the server.\nexport const MIN_TAG_LENGTH = 4;\n\n// Mediaquery breakpoint between desktop and mobile, in px. Should match the value\n// in @media (max-size: 640px) in base.css\nexport const MEDIA_BREAKPOINT = 640;\n// Size of css 'rem' unit in pixels. Default 1rem = 10pt = 13px.\nexport const REM_SIZE = 13;\n\n// Size of the avatar image: When an avatar image is uploaded, it's resized to\n// a square of this size.\nexport const AVATAR_SIZE = 128;\n\n// Size of the broken_image shown in MessagesView\nexport const BROKEN_IMAGE_SIZE = 32;\n\n// Number of chat messages to fetch in one call.\nexport const MESSAGES_PAGE = 24;\n\n// Maximum in-band (included directly into the message) attachment size which fits into\n// a message of 256K in size, assuming base64 encoding and 1024 bytes of overhead.\n// This is size of an object *before* base64 encoding is applied.\n// Increase this limit to a greater value in production, if desired. Also increase\n// max_message_size in server config.\n// MAX_INBAND_ATTACHMENT_SIZE = base64DecodedLen(max_message_size - overhead);\nexport const MAX_INBAND_ATTACHMENT_SIZE = 195840;\n\n// Absolute maximum attachment size to be used with the server = 8MB. Increase to\n// something like 100MB in production.\nexport const MAX_EXTERN_ATTACHMENT_SIZE = 1 << 23;\n\n// Maximum allowed linear dimension of an inline image in pixels. You may want\n// to adjust it to 1600 or 2400 for production.\nexport const MAX_IMAGE_DIM = 768;\n","// Put all packages together.\n// Used to generate umd/index.prod.js\n\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { IntlProvider, addLocaleData } from 'react-intl';\nimport ruData from 'react-intl/locale-data/ru';\naddLocaleData(ruData);\nimport allMessages from './messages.json';\n\nimport TinodeWeb from './views/tinode-web.jsx';\n\nimport HashNavigation from './lib/navigation.js';\n\nconst {params} = HashNavigation.parseUrlHash(window.location.hash);\nconst language = (params && params.hl) ||\n (navigator.languages && navigator.languages[0]) ||\n navigator.language ||\n navigator.userLanguage;\n\nconst baseLanguage = language.toLowerCase().split(/[-_]+/)[0];\n\n// Try full locale, try locale without region code, fallback to 'en'\nconst messages =\n allMessages[language] ||\n allMessages[baseLanguage] ||\n allMessages.en;\n\nReactDOM.render(\n \n \n ,\n document.getElementById('mountPoint')\n);\n","// File and image helper functions.\nimport { MAX_INBAND_ATTACHMENT_SIZE, MAX_IMAGE_DIM } from '../config.js';\n\n// Supported image MIME types and corresponding file extensions.\nexport const SUPPORTED_IMAGE_FORMATS = ['image/jpeg', 'image/gif', 'image/png', 'image/svg', 'image/svg+xml'];\nexport const MIME_EXTENSIONS = ['jpg', 'gif', 'png', 'svg', 'svg'];\n\n// Make a data URL from public.photo\nexport function makeImageUrl(photo) {\n return (photo && photo.type && photo.data) ?\n 'data:image/' + photo.type + ';base64,' + photo.data : null;\n}\n\n// Calculate linear dimensions for scaling image down to fit under a certain size.\n// Returns an object which contains destination sizes, source sizes, and offsets\n// into source (when making square images).\nexport function fitImageSize(width, height, maxWidth, maxHeight, forceSquare) {\n // Sanitize input\n width = width | 0;\n height = height | 0;\n maxWidth = maxWidth | 0;\n maxHeight = maxHeight | 0;\n\n if (width <= 0 || height <= 0 || maxWidth <= 0 || maxHeight <= 0) {\n return null;\n }\n\n if (forceSquare) {\n maxWidth = maxHeight = Math.min(maxWidth, maxHeight);\n }\n\n let scale = Math.min(\n Math.min(width, maxWidth) / width,\n Math.min(height, maxHeight) / height\n );\n\n let size = {\n dstWidth: (width * scale) | 0,\n dstHeight: (height * scale) | 0,\n };\n\n if (forceSquare) {\n // Also calculate parameters for making the image square.\n size.dstWidth = size.dstHeight = Math.min(size.dstWidth, size.dstHeight);\n size.srcWidth = size.srcHeight = Math.min(width, height);\n size.xoffset = ((width - size.srcWidth) / 2) | 0;\n size.yoffset = ((height - size.srcWidth) / 2) | 0;\n } else {\n size.xoffset = size.yoffset = 0;\n size.srcWidth = width;\n size.srcHeight = height;\n }\n return size;\n}\n\n// Ensure file's extension matches mime content type\nexport function fileNameForMime(fname, mime) {\n var idx = SUPPORTED_IMAGE_FORMATS.indexOf(mime);\n var ext = MIME_EXTENSIONS[idx];\n\n var at = fname.lastIndexOf('.');\n if (at >= 0) {\n fname = fname.substring(0, at);\n }\n return fname + '.' + ext;\n}\n\n// Convert uploaded image into a base64-encoded string possibly scaling\n// linear dimensions or constraining to a square.\nexport function imageFileScaledToBase64(file, width, height, forceSquare, onSuccess, onError) {\n var img = new Image();\n img.crossOrigin = 'Anonymous';\n img.onerror = function(err) {\n onError(\"Image format unrecognized\");\n }\n img.onload = function() {\n var dim = fitImageSize(this.width, this.height, width, height, forceSquare);\n if (!dim) {\n onError(\"Invalid image\");\n return;\n }\n var canvas = document.createElement('canvas');\n canvas.width = dim.dstWidth;\n canvas.height = dim.dstHeight;\n var ctx = canvas.getContext('2d');\n ctx.imageSmoothingEnabled = true;\n ctx.drawImage(this, dim.xoffset, dim.yoffset, dim.srcWidth, dim.srcHeight,\n 0, 0, dim.dstWidth, dim.dstHeight);\n\n var mime = (this.width != dim.dstWidth ||\n this.height != dim.dstHeight ||\n SUPPORTED_IMAGE_FORMATS.indexOf(file.type) < 0) ? 'image/jpeg' : file.type;\n var imageBits = canvas.toDataURL(mime);\n var parts = imageBits.split(',');\n // Get actual image type: 'data:image/png;base64,'\n mime = getMimeType(parts[0]);\n if (!mime) {\n onError(\"Unsupported image format\");\n return;\n }\n // Ensure the image is not too large\n var quality = 0.78;\n if (base64DecodedLen(imageBits.length) > MAX_INBAND_ATTACHMENT_SIZE) {\n mime = 'image/jpeg';\n }\n if (mime == 'image/jpeg') {\n // Reduce size of the jpeg by reducing image quality\n while (base64DecodedLen(imageBits.length) > MAX_INBAND_ATTACHMENT_SIZE && quality > 0.45) {\n imageBits = canvas.toDataURL(mime, quality);\n quality *= 0.84;\n }\n }\n if (base64DecodedLen(imageBits.length) > MAX_INBAND_ATTACHMENT_SIZE) {\n onError(\"The image size \" + bytesToHumanSize(base64DecodedLen(imageBits.length)) +\n \" exceeds the \" + bytesToHumanSize(MAX_INBAND_ATTACHMENT_SIZE) + \" limit.\", \"err\");\n return;\n }\n canvas = null;\n onSuccess(imageBits.split(',')[1], mime, dim.dstWidth, dim.dstHeight, fileNameForMime(file.name, mime));\n };\n img.src = URL.createObjectURL(file);\n}\n\n// Convert uploaded image file to base64-encoded string without scaling/converting the image\nexport function imageFileToBase64(file, onSuccess, onError) {\n var reader = new FileReader();\n reader.addEventListener('load', function() {\n var parts = reader.result.split(',');\n var mime = getMimeType(parts[0]);\n if (!mime) {\n onError(\"Failed to process image file\");\n return;\n }\n\n // Get image size.\n var img = new Image();\n img.crossOrigin = 'Anonymous';\n img.onload = function() {\n onSuccess(parts[1], mime, this.width, this.height, fileNameForMime(file.name, mime));\n }\n img.onerror = function(err) {\n onError(\"Image format not recognized\");\n }\n img.src = URL.createObjectURL(file);\n }, false);\n reader.readAsDataURL(file);\n}\n\nexport function fileToBase64(file, onSuccess, onError) {\n var reader = new FileReader();\n reader.addEventListener('load', function() {\n onSuccess(file.type, reader.result.split(',')[1], file.name);\n });\n reader.readAsDataURL(file);\n}\n\n// File pasted from the clipboard. It's either an inline image or a file attachment.\n// FIXME: handle large files out of band.\nexport function filePasted(event, onImageSuccess, onAttachmentSuccess, onError) {\n var items = (event.clipboardData || event.originalEvent.clipboardData || {}).items;\n for (var i in items) {\n var item = items[i];\n if (item.kind === 'file') {\n var file = item.getAsFile();\n if (!file) {\n console.log(\"Failed to get file object from pasted file item\", item.kind, item.type);\n continue;\n }\n if (file.type && file.type.split('/')[0] == 'image') {\n // Handle inline image\n if (file.size > MAX_INBAND_ATTACHMENT_SIZE || SUPPORTED_IMAGE_FORMATS.indexOf(file.type) < 0) {\n imageFileScaledToBase64(file, MAX_IMAGE_DIM, MAX_IMAGE_DIM, false, onImageSuccess, onError);\n } else {\n imageFileToBase64(file, onImageSuccess, onError);\n }\n } else {\n // Handle file attachment\n fileToBase64(file, onAttachmentSuccess, onError)\n }\n // Indicate that the pasted data contains a file.\n return true;\n }\n }\n // No file found.\n return false;\n}\n\n// Get mime type from data URL header.\nexport function getMimeType(header) {\n var mime = /^data:(image\\/[-+a-z0-9.]+);base64/.exec(header);\n return (mime && mime.length > 1) ? mime[1] : null;\n}\n\n// Given length of a binary object in bytes, calculate the length after\n// base64 encoding.\nexport function base64EncodedLen(n) {\n return Math.floor((n + 2) / 3) * 4;\n}\n\n// Given length of a base64-encoded object, calculate decoded size of the\n// pbject in bytes.\nexport function base64DecodedLen(n) {\n return Math.floor(n / 4) * 3;\n}\n\n// Re-encode string to standard base64 encoding with padding.\n// The string may be base64-URL encoded without the padding.\nexport function base64ReEncode(str) {\n if (str) {\n str = str.replace('-', '+').replace('_', '/');\n try {\n str = btoa(atob(str));\n } catch(err) {\n console.log(\"Failed to base64 re-encode string\");\n str = null;\n }\n }\n return str;\n}\n","import { KNOWN_HOSTS, DEFAULT_HOST } from '../config.js';\n\n// Detect server address from the URL\nexport function detectServerAddress() {\n let host = DEFAULT_HOST;\n if (typeof window.location == 'object') {\n if (window.location.protocol == 'file:' || window.location.hostname == 'localhost') {\n host = KNOWN_HOSTS.local;\n } else if (window.location.hostname) {\n host = window.location.hostname + (window.location.port ? ':' + window.location.port : '');\n }\n }\n return host;\n}\n\n// Detect if the page is served over HTTPS.\nexport function isSecureConnection() {\n if (typeof window.location == 'object') {\n return window.location.protocol == 'https:';\n }\n return false;\n}\n\nexport function isLocalHost() {\n if (typeof window.location == 'object') {\n return window.location.hostname == 'localhost';\n }\n return false;\n}\n","// Helper functions for storing values in localStorage.\n// By default localStorage can store only strings, not objects or other types.\n\nexport default class LocalStorageUtil {\n // Replace old object with the new one.\n static setObject(key, value) {\n localStorage.setItem(key, JSON.stringify(value));\n }\n\n // Get stored object.\n static getObject(key) {\n let value = localStorage.getItem(key);\n return value && JSON.parse(value);\n }\n\n // Partially or wholly update stored object.\n static updateObject(key, value) {\n let oldVal = this.getObject(key);\n this.setObject(key, Object.assign(oldVal || {}, value));\n }\n\n // Just a wrapper.\n static removeItem(key) {\n localStorage.removeItem(key);\n }\n}\n","// Utility class for hash navigation.\n\n// Parse hash as in http://www.example.com/path#hash as if it were\n// path and arguments.\nexport default class HashNavigation {\n static parseUrlHash(hash) {\n // Split path from args, path -> parts[0], args->path[1]\n let parts = hash.split('?', 2);\n let params = {};\n let path = [];\n if (parts[0]) {\n path = parts[0].substr(1).split('/');\n }\n if (parts[1]) {\n parts[1].split('&').forEach(function(part) {\n let item = part.split('=');\n if (item[0]) {\n params[decodeURIComponent(item[0])] = decodeURIComponent(item[1]);\n }\n });\n }\n return {path: path, params: params};\n }\n\n static navigateTo(url) {\n window.location.hash = url;\n }\n\n static composeUrlHash(path, params) {\n var url = path.join('/');\n var args = [];\n for (var key in params) {\n if (params.hasOwnProperty(key)) {\n args.push(key + '=' + params[key]);\n }\n }\n if (args.length > 0) {\n url += '?' + args.join('&');\n }\n return url;\n }\n\n static addUrlParam(hash, key, value) {\n var parsed = this.parseUrlHash(hash);\n parsed.params[key] = value;\n return this.composeUrlHash(parsed.path, parsed.params);\n }\n\n static removeUrlParam(hash, key) {\n var parsed = this.parseUrlHash(hash);\n delete parsed.params[key];\n return this.composeUrlHash(parsed.path, parsed.params);\n }\n\n static setUrlSidePanel(hash, sidepanel) {\n var parsed = this.parseUrlHash(hash);\n parsed.path[0] = sidepanel;\n return this.composeUrlHash(parsed.path, parsed.params);\n }\n\n static setUrlTopic(hash, topic) {\n var parsed = this.parseUrlHash(hash);\n parsed.path[1] = topic;\n // Close InfoView on topic change.\n delete parsed.params.info;\n return this.composeUrlHash(parsed.path, parsed.params);\n }\n}\n","// Short representation of time in the past.\nexport function shortDateFormat(then, locale) {\n locale = locale || window.navigator.userLanguage || window.navigator.language;\n const now = new Date();\n if (then.getFullYear() == now.getFullYear()) {\n if (then.getMonth() == now.getMonth() && then.getDate() == now.getDate()) {\n\t return then.toLocaleTimeString(locale, {hour12: false, hour: '2-digit', minute: '2-digit'});\n } else {\n\t return then.toLocaleDateString(locale,\n {hour12: false, month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit'});\n }\n }\n return then.toLocaleDateString(locale,\n {hour12: false, year: 'numeric', month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit'});\n}\n\n// Convert a number of bytes to human-readable format.\nexport function bytesToHumanSize(bytes) {\n if (!bytes || bytes == 0) {\n return '0 Bytes';\n }\n\n const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];\n const bucket = Math.min(Math.floor(Math.log2(bytes) / 10) | 0, sizes.length-1);\n const count = bytes / Math.pow(1024, bucket);\n const round = bucket > 0 ? (count < 3 ? 2 : (count < 30 ? 1 : 0)) : 0;\n return count.toFixed(round) + ' ' + sizes[bucket];\n}\n\n// Get 32 bit integer hash value for a string. Ideally it should produce the same value\n// as Java's String#hash().\nexport function stringHash(value) {\n let hash = 0;\n value = '' + value;\n for (let i = 0; i < value.length; i++) {\n hash = ((hash << 5) - hash) + value.charCodeAt(i);\n hash = hash & hash; // Convert to 32bit integer\n }\n return hash;\n}\n","// Odds and ends\n\n// Make shortcut icon appear with a green dot + show unread count in title.\nexport function updateFavicon(count) {\n var oldIcon = document.getElementById('shortcut-icon');\n if (oldIcon) {\n var head = document.head || document.getElementsByTagName('head')[0];\n var newIcon = document.createElement('link');\n newIcon.type = 'image/png';\n newIcon.id = 'shortcut-icon';\n newIcon.rel = 'shortcut icon';\n newIcon.href = 'img/logo32x32' + (count > 0 ? 'a' : '') + '.png';\n head.removeChild(oldIcon);\n head.appendChild(newIcon);\n }\n document.title = (count > 0 ? '('+count+') ' : '') + 'Tinode';\n}\n\n// Create VCard which represents topic 'public' info\nexport function vcard(fn, imageDataUrl) {\n var card = null;\n\n if ((fn && fn.trim()) || imageDataUrl) {\n card = {};\n if (fn) {\n card.fn = fn.trim();\n }\n if (imageDataUrl) {\n var dataStart = imageDataUrl.indexOf(',');\n card.photo = {\n data: imageDataUrl.substring(dataStart+1),\n type: 'jpg'\n };\n }\n }\n return card;\n}\n\n// Deep-shallow compare two arrays: shallow compare each element.\nexport function arrayEqual(a, b) {\n // Compare lengths first.\n if (a.length != b.length) {\n return false;\n }\n // Order of elements is ignored.\n a.sort();\n b.sort();\n for (var i = 0, l = a.length; i < l; i++) {\n if (a[i] !== b[i]) {\n return false;\n }\n }\n return true;\n}\n","// This is a generated file. Don't edit.\n\nexport const PACKAGE_VERSION = \"0.15.12\";\n","/* ContactsView holds all contacts-related stuff */\nimport React from 'react';\nimport { FormattedHTMLMessage, defineMessages } from 'react-intl';\n\nimport ContactList from '../widgets/contact-list.jsx';\n\nimport { updateFavicon } from '../lib/utils.js';\n\nconst messages = defineMessages({\n archived_contacts_title: {\n id: \"archived_contacts\",\n defaultMessage: \"Archived contacts ({count})\",\n description: \"Label for archived chats\"\n }\n});\n\nexport default class ContactsView extends React.Component {\n constructor(props) {\n super(props);\n\n this.handleAction = this.handleAction.bind(this);\n\n this.state = ContactsView.getDerivedStateFromProps(props, {});\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n const contacts = [];\n let unreadThreads = 0;\n let archivedCount = 0;\n nextProps.chatList.map((c) => {\n if (c.private && c.private.arch) {\n if (nextProps.archive) {\n contacts.push(c);\n } else {\n archivedCount ++;\n }\n } else if (!nextProps.archive) {\n contacts.push(c);\n unreadThreads += c.unread > 0 ? 1 : 0;\n }\n });\n contacts.sort(function(a, b) {\n return (b.touched || 0) - (a.touched || 0);\n });\n\n if (archivedCount > 0) {\n contacts.push({\n action: 'archive',\n title: messages.archived_contacts_title,\n values: {count: archivedCount}\n });\n }\n\n updateFavicon(unreadThreads);\n\n return {contactList: contacts, archivedCount: archivedCount};\n }\n\n handleAction(action) {\n this.props.onShowArchive();\n }\n\n render() {\n return (\n ¯∖_(ツ)_/¯\"\n description=\"HTML message shown in ContactList when no contacts are found\">{\n (no_contacts) => \n }\n );\n }\n};\n","// Account registration.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport AvatarUpload from '../widgets/avatar-upload.jsx';\nimport CheckBox from '../widgets/checkbox.jsx';\nimport VisiblePassword from '../widgets/visible-password.jsx';\n\nimport LocalStorageUtil from '../lib/local-storage.js';\nimport { vcard } from '../lib/utils.js';\n\nexport default class CreateAccountView extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n login: '',\n password: '',\n email: '',\n fn: '', // full/formatted name\n imageDataUrl: null,\n errorCleared: false,\n saveToken: LocalStorageUtil.getObject('keep-logged-in')\n };\n\n this.handleLoginChange = this.handleLoginChange.bind(this);\n this.handlePasswordChange = this.handlePasswordChange.bind(this);\n this.handleEmailChange = this.handleEmailChange.bind(this);\n this.handleFnChange = this.handleFnChange.bind(this);\n this.handleImageChanged = this.handleImageChanged.bind(this);\n this.handleToggleSaveToken = this.handleToggleSaveToken.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n }\n\n handleLoginChange(e) {\n this.setState({login: e.target.value});\n }\n\n handlePasswordChange(password) {\n this.setState({password: password});\n }\n\n handleEmailChange(e) {\n this.setState({email: e.target.value})\n }\n\n handleFnChange(e) {\n this.setState({fn: e.target.value});\n }\n\n handleImageChanged(img) {\n this.setState({imageDataUrl: img});\n }\n\n handleToggleSaveToken() {\n LocalStorageUtil.setObject('keep-logged-in', !this.state.saveToken);\n this.setState({saveToken: !this.state.saveToken});\n }\n\n handleSubmit(e) {\n e.preventDefault();\n // TODO: check email for validity\n this.setState({errorCleared: false});\n this.props.onCreateAccount(\n this.state.login.trim(),\n this.state.password.trim(),\n vcard(this.state.fn, this.state.imageDataUrl),\n {'meth': 'email', 'val': this.state.email});\n }\n\n render() {\n let submitClasses = 'blue';\n if (this.props.disabled) {\n submitClasses += ' disabled';\n }\n\n return (\n
    \n
    \n
    \n {\n (login_prompt) => \n }\n {\n (password_prompt) => \n }\n
    \n \n
    \n
    \n {\n (full_name_prompt) => \n }\n
    \n
    \n {\n (email_prompt) => \n }\n
    \n
    \n \n {\n (stay_logged_in) => \n }\n
    \n
    \n \n
    \n
    \n );\n }\n};\n","// Edit account parameters.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport AvatarUpload from '../widgets/avatar-upload.jsx';\nimport CheckBox from '../widgets/checkbox.jsx';\nimport InPlaceEdit from '../widgets/in-place-edit.jsx';\nimport PermissionsEditor from '../widgets/permissions-editor.jsx';\nimport TagManager from '../widgets/tag-manager.jsx';\n\nimport { makeImageUrl } from '../lib/blob-helpers.js';\nimport { vcard } from '../lib/utils.js';\n\nexport default class EditAccountView extends React.Component {\n constructor(props) {\n super(props);\n\n let me = this.props.tinode.getMeTopic();\n let defacs = me.getDefaultAccess();\n let fnd = this.props.tinode.getFndTopic();\n this.state = {\n fullName: me.public ? me.public.fn : undefined,\n avatar: makeImageUrl(me.public ? me.public.photo : null),\n auth: defacs ? defacs.auth : null,\n anon: defacs ? defacs.anon : null,\n tags: fnd.tags(),\n showPermissionEditorFor: undefined,\n previousOnTags: fnd.onTagsUpdated\n };\n\n this.tnNewTags = this.tnNewTags.bind(this);\n this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);\n this.handlePasswordUpdate = this.handlePasswordUpdate.bind(this);\n this.handleImageChanged = this.handleImageChanged.bind(this);\n this.handleCheckboxClick = this.handleCheckboxClick.bind(this);\n this.handleLaunchPermissionsEditor = this.handleLaunchPermissionsEditor.bind(this);\n this.handleHidePermissionsEditor = this.handleHidePermissionsEditor.bind(this);\n this.handlePermissionsChanged = this.handlePermissionsChanged.bind(this);\n this.handleTagsUpdated = this.handleTagsUpdated.bind(this);\n }\n\n componentDidMount() {\n let fnd = this.props.tinode.getFndTopic();\n fnd.onTagsUpdated = this.tnNewTags;\n if (!fnd.isSubscribed()) {\n fnd.subscribe(fnd.startMetaQuery().withLaterDesc().withTags().build()).catch((err) => {\n this.props.onError(err.message, 'err');\n });\n }\n }\n\n componentWillUnmount() {\n var fnd = this.props.tinode.getFndTopic();\n fnd.onTagsUpdated = this.state.previousOnTags;\n }\n\n tnNewTags(tags) {\n this.setState({tags: tags});\n }\n\n handleFullNameUpdate(fn) {\n this.setState({fullName: fn});\n this.props.onUpdateAccount(undefined, vcard(fn, this.state.avatar));\n }\n\n handlePasswordUpdate(pwd) {\n this.setState({password: pwd});\n this.props.onUpdateAccount(pwd);\n }\n\n handleImageChanged(img) {\n this.setState({avatar: img});\n this.props.onUpdateAccount(undefined, vcard(this.state.fullName, img));\n }\n\n handleCheckboxClick(what, checked) {\n if (what == 'sound') {\n this.props.onToggleMessageSounds(checked);\n } else if (what == 'alert') {\n this.props.onTogglePushNotifications(checked);\n }\n }\n\n handleLaunchPermissionsEditor(which) {\n this.setState({\n showPermissionEditorFor: which,\n editedPermissions: this.state[which]\n });\n }\n\n handleHidePermissionsEditor() {\n this.setState({showPermissionEditorFor: undefined});\n }\n\n handlePermissionsChanged(perm) {\n let defacs = {};\n defacs[this.state.showPermissionEditorFor] = perm;\n this.props.onUpdateAccount(undefined, undefined, defacs);\n\n let newState = {showPermissionEditorFor: undefined};\n newState[this.state.showPermissionEditorFor] = perm;\n this.setState(newState);\n }\n\n handleTagsUpdated(tags) {\n // Check if tags have actually changed.\n if (arrayEqual(this.state.tags.slice(0), tags.slice(0))) {\n return;\n }\n this.props.onUpdateTags(tags);\n }\n\n render() {\n var tags = [];\n this.state.tags.map(function(tag) {\n tags.push({tag});\n });\n if (tags.length == 0) {\n tags = ;\n }\n return (\n {this.state.showPermissionEditorFor ?\n \n :\n
    \n
    \n
    \n
    \n
    {\n (full_name_placeholder) => \n }
    \n
    \n
    \n {\n (password_unchanged) => \n }\n
    \n
    \n \n
    \n
    \n
    \n
    \n \n {this.props.myUserId}\n
    \n
    \n \n
    \n
    \n
    Auth: {this.state.auth}
    \n
    Anon: {this.state.anon}
    \n
    \n
    \n
    \n
    \n \n \n
    \n
    \n \n \n
    \n
    \n {\n (title_tag_manager) => \n }\n
    \n \n
    \n }\n );\n }\n};\n","// InfoView: panel with topic/user info.\nimport React from 'react';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\n\nimport Tinode from 'tinode-sdk';\n\nimport AvatarUpload from '../widgets/avatar-upload.jsx';\nimport CheckBox from '../widgets/checkbox.jsx';\nimport ContactList from '../widgets/contact-list.jsx';\nimport ErrorPanel from '../widgets/error-panel.jsx';\nimport GroupManager from '../widgets/group-manager.jsx';\nimport InPlaceEdit from '../widgets/in-place-edit.jsx';\nimport MenuCancel from '../widgets/menu-cancel.jsx';\nimport MoreButton from '../widgets/more-button.jsx';\nimport PermissionsEditor from '../widgets/permissions-editor.jsx';\nimport TagManager from '../widgets/tag-manager.jsx';\n\nimport { makeImageUrl } from '../lib/blob-helpers.js';\nimport { vcard } from '../lib/utils.js';\n\nconst messages = defineMessages({\n requested: {\n id: 'requested_permissions',\n defaultMessage: 'Requested',\n description: 'Title for permissions'\n },\n granted: {\n id: 'granted_permissions',\n defaultMessage: 'Granted',\n description: 'Title for permissions'\n },\n edit_permissions: {\n id: 'menu_item_edit_permissions',\n defaultMessage: 'Edit permissions',\n description: 'Menu item [Edit permissions]'\n },\n other_user: {\n id: 'label_other_user',\n defaultMessage: 'Other',\n description: 'Label for the other user when the user is unnamed'\n }\n});\n\nclass InfoView extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n topic: null,\n owner: false,\n admin: false,\n sharer: false,\n muted: false,\n address: null,\n groupTopic: undefined,\n fullName: undefined,\n avatar: null,\n private: null,\n selectedContact: null,\n access: null,\n modeGiven: null,\n modeWant: null,\n modeGiven2: null, // P2P topic, the other user mode given\n modeWant2: null, // P2P topic, the other user mode want\n auth: null,\n anon: null,\n contactList: [],\n tags: [],\n showMemberPanel: false,\n showPermissionEditorFor: undefined,\n moreInfoExpanded: false,\n previousMetaDesc: undefined,\n previousSubsUpdated: undefined,\n previousTagsUpdated: undefined\n };\n\n this.resetSubs = this.resetSubs.bind(this);\n this.resetDesc = this.resetDesc.bind(this);\n this.onMetaDesc = this.onMetaDesc.bind(this);\n this.onSubsUpdated = this.onSubsUpdated.bind(this);\n this.onTagsUpdated = this.onTagsUpdated.bind(this);\n this.handleFullNameUpdate = this.handleFullNameUpdate.bind(this);\n this.handlePrivateUpdate = this.handlePrivateUpdate.bind(this);\n this.handleImageChanged = this.handleImageChanged.bind(this);\n this.handleMuted = this.handleMuted.bind(this);\n this.handlePermissionsChanged = this.handlePermissionsChanged.bind(this);\n this.handleLaunchPermissionsEditor = this.handleLaunchPermissionsEditor.bind(this);\n this.handleHidePermissionsEditor = this.handleHidePermissionsEditor.bind(this);\n this.handleShowAddMembers = this.handleShowAddMembers.bind(this);\n this.handleHideAddMembers = this.handleHideAddMembers.bind(this);\n this.handleMemberUpdateRequest = this.handleMemberUpdateRequest.bind(this);\n this.handleLeave = this.handleLeave.bind(this);\n this.handleMemberSelected = this.handleMemberSelected.bind(this);\n this.handleMoreInfo = this.handleMoreInfo.bind(this);\n this.handleTagsUpdated = this.handleTagsUpdated.bind(this);\n this.handleContextMenu = this.handleContextMenu.bind(this);\n }\n\n // No need to separately handle component mount.\n componentDidUpdate(props) {\n const topic = this.props.tinode.getTopic(props.topic);\n if (!topic) {\n return;\n }\n\n if (this.onMetaDesc != topic.onMetaDesc) {\n this.previousMetaDesc = topic.onMetaDesc;\n topic.onMetaDesc = this.onMetaDesc;\n\n this.previousSubsUpdated = topic.onSubsUpdated;\n topic.onSubsUpdated = this.onSubsUpdated;\n\n if (topic.getType() == 'grp') {\n this.previousTagsUpdated = topic.onTagsUpdated;\n topic.onTagsUpdated = this.onTagsUpdated;\n } else {\n this.previousTagsUpdated = undefined;\n }\n }\n\n if (this.state.topic != props.topic) {\n this.setState({topic: props.topic});\n this.resetDesc(topic, props);\n this.resetSubs(topic, props);\n }\n }\n\n componentWillUnmount() {\n const topic = this.props.tinode.getTopic(this.props.topic);\n if (!topic) {\n return;\n }\n this.setState({topic: null});\n topic.onMetaDesc = this.previousMetaDesc;\n topic.onSubsUpdated = this.previousSubsUpdated;\n topic.onTagsUpdated = this.previousTagsUpdated;\n }\n\n resetSubs(topic, props) {\n const newState = {contactList: []};\n if (topic.getType() == 'p2p') {\n // Fetch the other party in the p2p conversation.\n // Topic may not be ready yet, so check if user is found.\n const user2 = topic.subscriber(props.topic);\n if (user2) {\n newState.modeGiven2 = user2.acs.getGiven();\n newState.modeWant2 = user2.acs.getWant();\n }\n } else {\n topic.subscribers((sub) => {\n newState.contactList.push(sub);\n }, this);\n }\n\n this.setState(newState);\n }\n\n resetDesc(topic, props) {\n const defacs = topic.getDefaultAccess() || {};\n const acs = topic.getAccessMode();\n\n this.setState({\n owner: acs && acs.isOwner(),\n admin: acs && acs.isAdmin(),\n sharer: acs && acs.isSharer(),\n muted: acs && acs.isMuted(),\n\n fullName: topic.public ? topic.public.fn : undefined,\n avatar: makeImageUrl(topic.public ? topic.public.photo : null),\n private: topic.private ? topic.private.comment : null,\n address: topic.name,\n groupTopic: (topic.getType() == 'grp'),\n showMemberPanel: false,\n access: acs ? acs.getMode() : undefined,\n modeGiven: acs ? acs.getGiven() : undefined,\n modeWant: acs ? acs.getWant() : undefined,\n auth: defacs.auth,\n anon: defacs.anon\n });\n\n if (topic.getType() == 'grp' && acs && acs.isOwner()) {\n // Requesting tags: owner is editing the topic.\n topic.getMeta(topic.startMetaQuery().withTags().build());\n }\n }\n\n onMetaDesc(desc) {\n const topic = this.props.tinode.getTopic(this.props.topic);\n if (!topic) {\n return;\n }\n this.resetDesc(topic, this.props);\n\n if (this.previousMetaDesc && this.previousMetaDesc != this.onMetaDesc) {\n this.previousMetaDesc(desc);\n }\n }\n\n onSubsUpdated() {\n const topic = this.props.tinode.getTopic(this.props.topic);\n if (!topic) {\n return;\n }\n this.resetSubs(topic, this.props);\n\n if (this.previousSubsUpdated && this.previousSubsUpdated != this.onSubsUpdated) {\n this.previousSubsUpdated();\n }\n }\n\n onTagsUpdated(tags) {\n this.setState({tags: tags});\n\n if (this.previousTagsUpdated && this.previousTagsUpdated != this.onTagsUpdated) {\n this.previousTagsUpdated();\n }\n }\n\n handleFullNameUpdate(fn) {\n fn = fn.trim();\n if (this.state.fullName !== fn) {\n this.setState({fullName: fn});\n this.props.onTopicDescUpdate(this.props.topic,\n vcard(fn, this.state.avatar),\n null);\n }\n }\n\n handlePrivateUpdate(priv) {\n if (this.state.priv !== priv) {\n this.setState({private: priv});\n this.props.onTopicDescUpdate(this.props.topic,\n null,\n priv || Tinode.DEL_CHAR);\n }\n }\n\n handleImageChanged(img) {\n this.setState({avatar: img});\n this.props.onTopicDescUpdate(this.props.topic,\n vcard(this.state.fullName, img),\n null);\n }\n\n handleMuted(ignored, checked) {\n this.setState({muted: checked});\n this.props.onChangePermissions(this.props.topic, checked ? '-P' : '+P');\n }\n\n handlePermissionsChanged(perm) {\n switch (this.state.showPermissionEditorFor) {\n case 'auth':\n this.props.onTopicDescUpdate(this.props.topic, null, null, {auth: perm});\n break;\n case 'anon':\n this.props.onTopicDescUpdate(this.props.topic, null, null, {anon: perm});\n break;\n case 'mode':\n case 'want':\n this.props.onChangePermissions(this.props.topic, perm);\n break;\n case 'given':\n this.props.onChangePermissions(this.props.topic, perm, this.props.topic);\n break;\n case 'user':\n this.props.onChangePermissions(this.props.topic, perm, this.state.userPermissionsEdited);\n break;\n }\n\n this.setState({showPermissionEditorFor: undefined});\n }\n\n handleLaunchPermissionsEditor(which, uid) {\n const {formatMessage} = this.props.intl;\n let toEdit, toCompare, toSkip, titleEdit, titleCompare, userTitle, userAvatar;\n switch (which) {\n case 'mode':\n toEdit = this.state.access;\n break;\n case 'want':\n toEdit = this.state.modeWant;\n toCompare = this.state.modeGiven;\n toSkip = this.state.groupTopic ? 'O' : 'ASDO';\n titleEdit = formatMessage(messages.requested);\n titleCompare = formatMessage(messages.granted);\n break;\n case 'given':\n toEdit = this.state.modeGiven2;\n toCompare = this.state.modeWant2;\n toSkip = this.state.groupTopic ? (this.state.owner ? '' : 'O') : 'ASDO';\n titleEdit = formatMessage(messages.granted);\n titleCompare = formatMessage(messages.requested);\n break;\n case 'auth':\n toEdit = this.state.auth;\n toSkip = 'O';\n break;\n case 'anon':\n toEdit = this.state.anon;\n toSkip = 'O';\n break;\n case 'user': {\n let topic = this.props.tinode.getTopic(this.props.topic);\n if (!topic) {\n return;\n }\n var user = topic.subscriber(uid);\n if (!user || !user.acs) {\n return;\n }\n toEdit = user.acs.getGiven();\n toCompare = user.acs.getWant();\n toSkip = this.state.owner ? '' : 'O';\n titleEdit = formatMessage(messages.granted);\n titleCompare = formatMessage(messages.requested);\n if (user.public) {\n userTitle = user.public.fn;\n userAvatar = user.public.photo;\n }\n break;\n }\n default:\n console.log(\"Unknown permission editing mode '\" + which + \"'\");\n break;\n }\n this.setState({\n showPermissionEditorFor: which,\n userPermissionsEdited: uid,\n userPermissionsTitle: userTitle,\n userPermissionsAvatar: userAvatar,\n editedPermissions: toEdit,\n immutablePermissions: toCompare,\n editedPermissionsTitle: titleEdit,\n immutablePermissionsTitle: titleCompare,\n editedPermissionsSkipped: toSkip,\n });\n }\n\n handleHidePermissionsEditor() {\n this.setState({showPermissionEditorFor: undefined});\n }\n\n handleShowAddMembers() {\n this.props.onInitFind();\n this.setState({showMemberPanel: true});\n }\n\n handleHideAddMembers() {\n this.setState({showMemberPanel: false});\n }\n\n handleMemberUpdateRequest(members, added, removed) {\n this.props.onMemberUpdateRequest(this.props.topic, added, removed);\n this.setState({showMemberPanel: false});\n }\n\n handleLeave() {\n this.props.onLeaveTopic(this.props.topic);\n }\n\n handleMemberSelected(uid) {\n this.setState({selectedContact: uid});\n }\n\n handleMoreInfo(open) {\n this.setState({moreInfoExpanded: open});\n }\n\n handleTagsUpdated(tags) {\n if (!arrayEqual(this.state.tags.slice(0), tags.slice(0))) {\n this.props.onTopicTagsUpdate(this.props.topic, tags);\n }\n }\n\n handleContextMenu(params) {\n const {formatMessage} = this.props.intl;\n const instance = this;\n const topic = this.props.tinode.getTopic(this.props.topic);\n if (!topic) {\n return;\n }\n const user = topic.subscriber(params.topicName);\n if (!user || !user.acs) {\n return;\n }\n\n const menuItems = [\n {title: formatMessage(messages.edit_permissions), handler: function() {\n instance.handleLaunchPermissionsEditor('user', params.topicName);\n }},\n 'member_delete',\n user.acs.isMuted() ? 'member_unmute' : 'member_mute',\n user.acs.isJoiner() ? 'member_block' : 'member_unblock'\n ];\n this.props.showContextMenu({\n topicName: this.props.topic,\n x: params.x,\n y: params.y,\n user: params.topicName}, menuItems);\n }\n\n render() {\n const {formatMessage} = this.props.intl;\n\n return (\n
    \n
    \n
    \n \n
    \n
    \n \n
    \n
    \n {this.props.displayMobile ?\n : null}\n {this.state.showMemberPanel ?\n \n :\n this.state.showPermissionEditorFor ?\n \n :\n
    \n
    \n
    \n
    \n
    Unknown}\n readOnly={!this.state.owner}\n value={this.state.fullName}\n required={true}\n onFinished={this.handleFullNameUpdate} />
    \n
    \n \n
    \n
    \n {\n (private_placeholder) => \n }\n
    \n
    \n \n
    \n
    \n
    \n
    \n \n \n
    \n {\n (more) => \n }\n {this.state.moreInfoExpanded ?\n
    \n
    \n \n {this.state.address}\n
    \n {this.state.groupTopic ?\n
    \n \n \n {this.state.access}\n \n
    \n :\n
    \n
    \n \n
    \n
    \n
    \n  \n {this.state.access}\n
    \n
    {this.state.fullName ? this.state.fullName : formatMessage(messages.other_user)}:\n  \n {this.state.modeGiven2}\n \n
    \n
    \n
    \n }\n {this.state.sharer && (this.state.auth || this.state.anon) ?\n
    \n
    \n \n
    \n
    \n
    Auth: {this.state.admin ?\n \n {this.state.auth}\n \n :\n {this.state.auth}\n }\n
    \n
    Anon: {this.state.admin ?\n \n {this.state.anon}\n \n :\n {this.state.anon}\n }\n
    \n
    \n
    \n :\n null\n }\n
    \n :\n null\n }\n
    \n
    \n {this.state.owner ?\n {\n (tags) => \n }\n :\n null\n }\n {this.state.owner ?
    : null }\n {this.state.groupTopic ?\n
    \n
    \n \n
    \n
    \n {this.state.sharer ?\n \n person_add \n \n : null}\n {!this.state.owner ?\n \n exit_to_app \n \n : null}\n
    \n {\n (no_members) => \n }\n
    \n :\n \n }\n
    \n }\n
    \n );\n }\n};\n\nexport default injectIntl(InfoView);\n","// Login form.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport CheckBox from '../widgets/checkbox.jsx';\nimport VisiblePassword from '../widgets/visible-password.jsx';\n\nimport LocalStorageUtil from '../lib/local-storage.js';\n\nexport default class LoginView extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n login: props.login,\n password: '',\n hostName: props.serverAddress,\n saveToken: LocalStorageUtil.getObject('keep-logged-in')\n };\n this.handleLoginChange = this.handleLoginChange.bind(this);\n this.handlePasswordChange = this.handlePasswordChange.bind(this);\n this.handleToggleSaveToken = this.handleToggleSaveToken.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n }\n\n handleLoginChange(e) {\n this.setState({login: e.target.value});\n }\n\n handlePasswordChange(e) {\n this.setState({password: e.target.value});\n }\n\n handleToggleSaveToken() {\n LocalStorageUtil.setObject('keep-logged-in', !this.state.saveToken);\n this.setState({saveToken: !this.state.saveToken});\n }\n\n handleSubmit(e) {\n e.preventDefault();\n this.props.onLogin(this.state.login.trim(), this.state.password.trim());\n }\n\n render() {\n var submitClasses = 'blue';\n if (this.props.disabled) {\n submitClasses += ' disabled';\n }\n\n return (\n
    \n \n {\n (login_prompt) => \n }\n \n \n {\n (password_prompt) => \n }\n \n
    \n \n \n \n \n \n
    \n
    \n \n
    \n
    \n );\n }\n};\n/* END Login */\n","/* This is just a static page to display when no conversation is selected. */\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport Tinode from 'tinode-sdk';\n\nimport { APP_NAME } from '../config.js';\n\nexport default class LogoView extends React.PureComponent {\n render() {\n var version = APP_NAME + ' (' + Tinode.getLibrary() + ')';\n return (\n
    \n
    \n \n \"logo\"\n

    Tinode Web

    \n
    \n

    {version}

    \n

    {this.props.serverVersion} ({this.props.serverAddress})

    \n
    \n
    \n );\n }\n};\n","import React from 'react';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\n\nimport Tinode from 'tinode-sdk';\nconst Drafty = Tinode.Drafty;\n\nimport ChatMessage from '../widgets/chat-message.jsx';\nimport ErrorPanel from '../widgets/error-panel.jsx';\nimport GroupSubs from '../widgets/group-subs.jsx';\nimport ImagePreview from '../widgets/image-preview.jsx';\nimport LetterTile from '../widgets/letter-tile.jsx';\nimport LoadSpinner from '../widgets/load-spinner.jsx';\nimport LogoView from './logo-view.jsx';\nimport SendMessage from '../widgets/send-message.jsx';\n\nimport { KEYPRESS_DELAY, MESSAGES_PAGE } from '../config.js';\nimport { makeImageUrl } from '../lib/blob-helpers.js';\nimport { shortDateFormat } from '../lib/strformat.js';\n\nconst messages = defineMessages({\n online_now: {\n id: 'online_now',\n defaultMessage: 'online now',\n description: 'Indicator that the user or topic is currently online',\n },\n last_seen: {\n id: 'last_seen_timestamp',\n defaultMessage: 'Last seen',\n description: 'Label for the timestamp of when the user or topic was last online'\n },\n 'not_found': {\n id: 'title_not_found',\n defaultMessage: 'Not found',\n description: 'Title shown when topic is not found'\n }\n});\n\nclass MessagesView extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n messages: [],\n onlineSubs: [],\n topic: '',\n title: '',\n avatar: null,\n scrollPosition: 0,\n readOnly: props.acs ? !props.acs.isWriter() : true,\n writeOnly: props.acs ? !props.acs.isReader() : true,\n typingIndicator: false,\n imagePreview: null\n };\n\n this.propsChange = this.propsChange.bind(this);\n this.leave = this.leave.bind(this);\n this.handleScrollReference = this.handleScrollReference.bind(this);\n this.handleScrollEvent = this.handleScrollEvent.bind(this);\n this.handleDescChange = this.handleDescChange.bind(this);\n this.handleSubsUpdated = this.handleSubsUpdated.bind(this);\n this.handleNewMessage = this.handleNewMessage.bind(this);\n this.handleAllMessagesReceived = this.handleAllMessagesReceived.bind(this);\n this.handleInfoReceipt = this.handleInfoReceipt.bind(this);\n this.handleImagePreview = this.handleImagePreview.bind(this);\n this.handleCloseImagePreview = this.handleCloseImagePreview.bind(this);\n this.handleFormResponse = this.handleFormResponse.bind(this);\n this.handleContextClick = this.handleContextClick.bind(this);\n this.handleShowContextMenuMessage = this.handleShowContextMenuMessage.bind(this);\n this.handleBackNavigation = this.handleBackNavigation.bind(this);\n }\n\n // Scroll last message into view on component update e.g. on message received\n // or vertical shrinking.\n componentDidUpdate(prevProps, prevState) {\n if (this.messagesScroller) {\n if (prevState.title != this.state.title || prevState.messages.length != this.state.messages.length) {\n this.messagesScroller.scrollTop = this.messagesScroller.scrollHeight - this.state.scrollPosition;\n } else if (prevProps.viewportHeight > this.props.viewportHeight) {\n this.messagesScroller.scrollTop += prevProps.viewportHeight - this.props.viewportHeight;\n }\n }\n }\n\n componentDidMount() {\n this.propsChange(this.props);\n if (this.messagesScroller) {\n this.messagesScroller.addEventListener('scroll', this.handleScrollEvent);\n }\n }\n\n componentWillUnmount() {\n this.leave(this.state.topic);\n if (this.messagesScroller) {\n this.messagesScroller.removeEventListener('scroll', this.handleScrollEvent);\n }\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.propsChange(nextProps);\n }\n\n propsChange(props) {\n if (!props || !props.topic) {\n let oldTopic = this.state.topic;\n this.setState({messages: [], onlineSubs: [], topic: null}, this.leave(oldTopic));\n return;\n }\n\n if (!props.connected) {\n // connection lost, clear online subs\n this.setState({onlineSubs: []});\n return;\n }\n\n let topic = this.props.tinode.getTopic(props.topic);\n if (!topic) {\n return;\n }\n\n let newGroupTopic = Tinode.isNewGroupTopicName(props.topic);\n let tryToResubscribe = !this.props.connected && props.connected;\n\n if (props.topic != this.state.topic) {\n let msgs = [];\n let subs = [];\n\n // Bind the new topic to component.\n topic.onData = this.handleNewMessage;\n topic.onAllMessagesReceived = this.handleAllMessagesReceived;\n topic.onInfo = this.handleInfoReceipt;\n topic.onMetaDesc = this.handleDescChange;\n topic.onSubsUpdated = this.handleSubsUpdated;\n topic.onPres = this.handleSubsUpdated;\n // Unbind the previous topic from this component.\n this.leave(this.state.topic);\n\n this.handleDescChange(topic);\n topic.subscribers((sub) => {\n if (sub.online && sub.user != this.props.myUserId) {\n subs.push(sub);\n }\n });\n\n topic.messages(function(msg) {\n if (!msg.deleted) {\n msgs = msgs.concat(msg);\n }\n });\n\n this.setState({\n messages: msgs,\n onlineSubs: subs,\n topic: props.topic,\n imagePreview: null,\n scrollPosition: 0\n });\n tryToResubscribe = true;\n\n // The user switched to the new topic before the timer for\n // the previous topic has triggered, kill it.\n this.props.readTimerHandler(null);\n }\n\n this.setState({\n readOnly: props.acs ? !props.acs.isWriter() : true,\n writeOnly: props.acs ? !props.acs.isReader() : true\n });\n\n if (!topic.isSubscribed() && tryToResubscribe) {\n // Don't request the tags. They are useless unless the user\n // is the owner and is editing the topic.\n let getQuery = topic.startMetaQuery()\n .withLaterDesc()\n .withLaterSub()\n .withLaterData(MESSAGES_PAGE)\n .withLaterDel();\n let setQuery = newGroupTopic ? props.newGroupTopicParams : undefined;\n // Show \"loading\" spinner.\n this.setState({ fetchingMessages: true });\n topic.subscribe(getQuery.build(), setQuery)\n .then((ctrl) => {\n this.setState({topic: ctrl.topic});\n this.props.onNewTopicCreated(props.topic, ctrl.topic);\n // If there are unsent messages, try sending them now.\n topic.queuedMessages((pub) => {\n if (!pub._sending && topic.isSubscribed()) {\n topic.publishMessage(pub);\n }\n });\n })\n .catch((err) => {\n this.props.onError(err.message, 'err');\n const {formatMessage} = this.props.intl;\n this.setState({\n title: formatMessage(messages.not_found),\n avatar: null,\n readOnly: true,\n writeOnly: true,\n fetchingMessages: false,\n messages: [],\n onlineSubs: [],\n typingIndicator: false,\n imagePreview: null\n });\n });\n }\n }\n\n leave(oldTopicName) {\n if (!oldTopicName) {\n return;\n }\n let oldTopic = this.props.tinode.getTopic(oldTopicName);\n if (oldTopic && oldTopic.isSubscribed()) {\n oldTopic.leave(false)\n .catch(() => { /* do nothing here */ })\n .finally(() => {\n // We don't care if the request succeeded or failed.\n // The topic is dead regardless.\n this.setState({fetchingMessages: false});\n oldTopic.onData = undefined;\n oldTopic.onAllMessagesReceived = undefined;\n oldTopic.onInfo = undefined;\n oldTopic.onMetaDesc = undefined;\n oldTopic.onSubsUpdated = undefined;\n oldTopic.onPres = undefined;\n });\n }\n }\n\n handleScrollReference(node) {\n if (node) {\n node.addEventListener('scroll', this.handleScrollEvent);\n this.messagesScroller = node;\n }\n }\n\n // Get older messages\n handleScrollEvent(event) {\n this.setState({scrollPosition: event.target.scrollHeight - event.target.scrollTop});\n if (event.target.scrollTop <= 0) {\n this.setState((prevState, props) => {\n let newState = {};\n if (!prevState.fetchingMessages) {\n let topic = this.props.tinode.getTopic(this.state.topic);\n if (topic && topic.isSubscribed() && topic.msgHasMoreMessages()) {\n newState.fetchingMessages = true;\n topic.getMessagesPage(MESSAGES_PAGE).catch((err) => {\n this.setState({fetchingMessages: false});\n this.props.onError(err.message, 'err');\n });\n }\n }\n return newState;\n });\n }\n }\n\n handleDescChange(desc) {\n if (desc.public) {\n this.setState({\n title: desc.public.fn,\n avatar: makeImageUrl(desc.public.photo)\n });\n } else {\n this.setState({\n title: '',\n avatar: null\n });\n }\n if (desc.acs) {\n this.setState({\n readOnly: !desc.acs.isWriter(),\n writeOnly: !desc.acs.isReader()\n });\n }\n }\n\n handleSubsUpdated() {\n if (this.state.topic) {\n var subs = [];\n var topic = this.props.tinode.getTopic(this.state.topic);\n topic.subscribers((sub) => {\n if (sub.online && sub.user != this.props.myUserId) {\n subs.push(sub);\n }\n });\n this.setState({onlineSubs: subs});\n }\n }\n\n handleNewMessage(msg) {\n // Regenerate messages list\n var topic = this.props.tinode.getTopic(this.state.topic);\n var newState = {messages: []};\n topic.messages(function(m) {\n if (!m.deleted) {\n newState.messages = newState.messages.concat(m);\n }\n });\n\n // msg could be null if one or more messages were deleted.\n if (msg && !msg.deleted) {\n // If the message is added to the end of the message list,\n // scroll to the bottom.\n if (topic.isNewMessage(msg.seq)) {\n newState.scrollPosition = 0;\n }\n\n // Aknowledge all messages, including own messages.\n let status = topic.msgStatus(msg);\n if (status >= Tinode.MESSAGE_STATUS_SENT) {\n this.props.readTimerHandler(() => {\n topic.noteRead(msg.seq);\n });\n }\n this.props.onData(msg);\n }\n\n this.setState(newState);\n }\n\n handleAllMessagesReceived(count) {\n this.setState({fetchingMessages: false});\n }\n\n handleInfoReceipt(info) {\n switch (info.what) {\n case 'kp': {\n clearTimeout(this.keyPressTimer);\n var instance = this;\n this.keyPressTimer = setTimeout(function() {\n instance.setState({typingIndicator: false});\n }, KEYPRESS_DELAY + 1000);\n if (!this.state.typingIndicator) {\n this.setState({typingIndicator: true});\n }\n break;\n }\n case 'read':\n case 'recv':\n // Redraw due to changed recv/read status.\n this.forceUpdate();\n break;\n default:\n console.log(\"Other change in topic: \", info.what);\n }\n }\n\n handleImagePreview(content) {\n this.setState({ imagePreview: content });\n }\n\n handleCloseImagePreview() {\n this.setState({ imagePreview: null });\n }\n\n handleFormResponse(action, text, data) {\n if (action == 'pub') {\n this.props.sendMessage(Drafty.attachJSON(Drafty.parse(text), data));\n } else if (action == 'url') {\n const url = new URL(data.ref);\n let params = url.searchParams;\n for (let key in data.resp) {\n if (data.resp.hasOwnProperty(key)) {\n params.set(key, data.resp[key]);\n }\n }\n ['name', 'seq'].map(function(key) {\n if (data[key]) {\n params.set(key, data[key]);\n }\n });\n params.set('uid', this.props.myUserId);\n url.search = params;\n window.open(url, '_blank');\n } else {\n console.log(\"Unknown action in form\", action);\n }\n }\n\n handleContextClick(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.showContextMenu({ topicName: this.state.topic, y: e.pageY, x: e.pageX });\n }\n\n handleShowContextMenuMessage(params) {\n params.topicName = this.state.topic;\n var menuItems = ['message_delete'];\n var topic = this.props.tinode.getTopic(params.topicName);\n if (topic) {\n var acs = topic.getAccessMode();\n if (acs && acs.isDeleter()) {\n menuItems.push('message_delete_hard');\n }\n }\n this.props.showContextMenu(params, menuItems);\n }\n\n handleBackNavigation() {\n this.props.onHideMessagesView();\n }\n\n render() {\n const {formatMessage} = this.props.intl;\n\n let component;\n if (this.state.topic) {\n const topic = this.props.tinode.getTopic(this.state.topic);\n const groupTopic = topic.getType() == 'grp';\n let messageNodes = [];\n let previousFrom = null;\n let chatBoxClass = null;\n for (let i=0; i\n );\n }\n\n let lastSeen = null;\n let cont = this.props.tinode.getMeTopic().getContact(this.state.topic);\n if (cont && Tinode.topicType(cont.topic) == 'p2p') {\n if (cont.online) {\n lastSeen = formatMessage(messages.online_now);\n } else if (cont.seen) {\n lastSeen = formatMessage(messages.last_seen) + \": \" +\n shortDateFormat(cont.seen.when, this.props.intl.locale);\n // TODO: also handle user agent in c.seen.ua\n }\n }\n let avatar = this.state.avatar || true;\n let online = this.props.online ? 'online' + (this.state.typingIndicator ? ' typing' : '') : 'offline';\n\n component = (\n
    \n
    \n {this.props.displayMobile ?\n \n arrow_back\n \n :\n null}\n
    \n \n \n
    \n
    \n
    {\n this.state.title ||\n \n }
    \n
    {lastSeen}
    \n
    \n {groupTopic ?\n :\n
    \n }\n \n
    \n {this.props.displayMobile ?\n \n : null}\n \n
    \n
    \n
      \n {messageNodes}\n
    \n
    \n {this.state.writeOnly ?\n
    \n
    \n \n
    \n
    \n :\n null\n }\n
    \n \n {this.state.imagePreview ?\n : null}\n
    \n );\n } else {\n component = (\n \n );\n }\n return component;\n }\n};\n\nexport default injectIntl(MessagesView);\n","// Create new topic and invite users or send an invite.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport ContactList from '../widgets/contact-list.jsx';\nimport NewTopicById from '../widgets/new-topic-by-id.jsx';\nimport NewTopicGroup from '../widgets/new-topic-group.jsx';\nimport SearchContacts from '../widgets/search-contacts.jsx';\n\nimport HashNavigation from '../lib/navigation.js';\nimport { vcard } from '../lib/utils.js';\n\nexport default class NewTopicView extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n tabSelected: 'p2p'\n };\n\n this.handleTabClick = this.handleTabClick.bind(this);\n this.handleContactSelected = this.handleContactSelected.bind(this);\n this.handleNewGroupSubmit = this.handleNewGroupSubmit.bind(this);\n this.handleGroupByID = this.handleGroupByID.bind(this);\n }\n\n componentDidMount() {\n this.props.onInitFind();\n }\n\n handleTabClick(e) {\n e.preventDefault();\n HashNavigation.navigateTo(HashNavigation.addUrlParam(window.location.hash, 'tab', e.currentTarget.dataset.id));\n this.setState({tabSelected: e.currentTarget.dataset.id});\n }\n\n handleContactSelected(sel) {\n if (this.state.tabSelected === 'p2p') {\n HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));\n this.props.onCreateTopic(sel, undefined);\n }\n }\n\n handleNewGroupSubmit(name, dataUrl, priv, tags) {\n HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));\n this.props.onCreateTopic(undefined, vcard(name, dataUrl), priv, tags);\n }\n\n handleGroupByID(topicName) {\n HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'tab'));\n this.props.onCreateTopic(topicName);\n }\n\n render() {\n return (\n
    \n \n {this.state.tabSelected === 'grp' ?\n :\n this.state.tabSelected === 'byid' ?\n :\n
    \n \n {\n (search_for_contacts) => \n }\n
    }\n
    \n );\n }\n};\n","// A password reset form.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport VisiblePassword from '../widgets/visible-password.jsx';\n\nimport HashNavigation from '../lib/navigation.js';\n\nexport default class PasswordResetView extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n email: '',\n password: ''\n };\n\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleEmailChange = this.handleEmailChange.bind(this);\n this.handlePasswordChange = this.handlePasswordChange.bind(this);\n }\n\n componentDidMount() {\n let parsed = HashNavigation.parseUrlHash(window.location.hash);\n this.setState({token: parsed.params.token, scheme: parsed.params.scheme});\n }\n\n handleSubmit(e) {\n e.preventDefault();\n if (this.state.token) {\n this.props.onReset(this.state.scheme, this.state.password.trim(), this.state.token);\n } else {\n this.props.onRequest('email', this.state.email.trim());\n }\n }\n\n handleEmailChange(e) {\n this.setState({email: e.target.value});\n }\n\n handlePasswordChange(e) {\n this.setState({password: e.target.value});\n }\n\n render() {\n let reset = (this.state.token && this.state.scheme);\n return (\n
    \n {reset ?\n {\n (placeholder) => \n }\n :\n \n \n {\n (placeholder) => \n }\n \n }\n
    \n \n
    \n
    \n );\n }\n}\n","// Tinode config panel.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport HostSelector from '../widgets/host-selector.jsx';\n\nexport default class SettingsView extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n transport: props.transport || 'def',\n serverAddress: props.serverAddress,\n };\n\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleTransportSelected = this.handleTransportSelected.bind(this);\n this.handleServerAddressChange = this.handleServerAddressChange.bind(this);\n }\n\n handleSubmit(e) {\n e.preventDefault();\n this.props.onUpdate({\n transport: this.state.transport,\n serverAddress: this.state.serverAddress\n });\n }\n\n handleTransportSelected(e) {\n this.setState({transport: e.currentTarget.value});\n }\n\n handleServerAddressChange(name) {\n this.setState({serverAddress: name});\n }\n\n render() {\n const names = {def: \"default\", ws: \"websocket\", lp: \"long polling\"};\n var transportOptions = [];\n var instance = this;\n ['def', 'ws', 'lp'].map(function(item) {\n var id = 'transport-' + item;\n var name = names[item];\n transportOptions.push(\n
  • \n \n \n
  • \n );\n });\n\n return (\n
    \n
    \n \n
    \n \n
    \n \n
    \n
    \n
      \n {transportOptions}\n
    \n
    \n
    \n \n
    \n \n );\n }\n};\n","import React from 'react';\nimport { defineMessages, injectIntl } from 'react-intl';\n\nimport SideNavbar from '../widgets/side-navbar.jsx';\nimport ErrorPanel from '../widgets/error-panel.jsx';\n\nimport ContactsView from './contacts-view.jsx';\nimport CreateAccountView from './create-account-view.jsx';\nimport EditAccountView from './edit-account-view.jsx';\nimport LoginView from './login-view.jsx';\nimport NewTopicView from './new-topic-view.jsx';\nimport PasswordResetView from './password-reset-view.jsx';\nimport SettingsView from './settings-view.jsx';\nimport ValidationView from './validation-view.jsx';\n\n// Panel titles for translation.\nconst messages = defineMessages({\n 'login': {\n id: 'sidepanel_title_login',\n description: 'Sidepanel title for LoginView.',\n defaultMessage: 'Sign In'\n },\n 'register': {\n id: 'sidepanel_title_register',\n description: 'Sidepanel title for CreateAccountView.',\n defaultMessage: 'Create Account'\n },\n 'settings': {\n id: 'sidepanel_title_settings',\n description: 'Sidepanel title for SettingsView.',\n defaultMessage: 'Settings'\n },\n 'edit': {\n id: 'sidepanel_title_edit_account',\n description: 'Sidepanel title for EditAccountView.',\n defaultMessage: 'Edit Account'\n },\n 'newtpk': {\n id: 'sidepanel_title_newtpk',\n description: 'Sidepanel title for NewTopicView.',\n defaultMessage: 'Start New Chat'\n },\n 'cred': {\n id: 'sidepanel_title_cred',\n description: 'Sidepanel title for ValidationView.',\n defaultMessage: 'Confirm Credentials'\n },\n 'reset': {\n id: 'sidepanel_title_reset',\n description: 'Sidepanel title for PasswordResetView.',\n defaultMessage: 'Reset Password'\n },\n 'archive': {\n id: 'sidepanel_title_archive',\n description: 'Sidepanel title for ContactsView-Archive.',\n defaultMessage: 'Archived Chats'\n }\n});\n\nclass SidepanelView extends React.Component {\n constructor(props) {\n super(props);\n\n this.handleLoginRequested = this.handleLoginRequested.bind(this);\n }\n\n handleLoginRequested(login, password) {\n this.props.onLoginRequest(login, password);\n }\n\n render() {\n const {formatMessage} = this.props.intl;\n const view = this.props.state || (this.props.myUserId ? 'contacts' : 'login');\n\n let title, avatar;\n if (view == 'contacts') {\n title = this.props.title;\n avatar = this.props.avatar ? this.props.avatar : true;\n } else {\n title = formatMessage(messages[view]);\n avatar = false;\n }\n\n let onCancel;\n if (['login', 'contacts'].indexOf(view) == -1) {\n onCancel = this.props.onCancel;\n }\n\n return (\n
    \n \n\n \n\n {view === 'login' ?\n :\n\n view === 'register' ?\n :\n\n view === 'settings' ?\n :\n\n view === 'edit' ?\n :\n\n (view === 'contacts' || view == 'archive') ?\n :\n\n view === 'newtpk' ?\n :\n\n view === 'cred' ?\n :\n\n view === 'reset' ?\n :\n null}\n
    \n );\n }\n};\n\nexport default injectIntl(SidepanelView);\n","// The top-level class to hold all functionality together.\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { defineMessages, injectIntl } from 'react-intl';\n\nimport * as firebase from 'firebase/app';\nimport 'firebase/messaging';\n\nimport Tinode from 'tinode-sdk';\n\nimport ContextMenu from '../widgets/context-menu.jsx';\n\nimport InfoView from './info-view.jsx';\nimport MessagesView from './messages-view.jsx';\nimport SidepanelView from './sidepanel-view.jsx';\n\nimport { API_KEY, APP_NAME, MEDIA_BREAKPOINT, READ_DELAY, RECEIVED_DELAY } from '../config.js';\nimport { makeImageUrl } from '../lib/blob-helpers.js';\nimport { detectServerAddress, isLocalHost, isSecureConnection } from '../lib/host-name.js';\nimport LocalStorageUtil from '../lib/local-storage.js';\nimport HashNavigation from '../lib/navigation.js';\nimport { updateFavicon } from '../lib/utils.js';\n\n// Sound to play on message received.\nconst POP_SOUND = new Audio('audio/msg.mp3');\n\nconst messages = defineMessages({\n update_available: {\n id: 'update_available',\n defaultMessage: 'Update available. Reload.',\n description: 'Message shown when an app update is available.'\n },\n reconnect_countdown: {\n id: 'reconnect_countdown',\n defaultMessage: 'Disconnected. Reconnecting in {seconds}s…',\n description: 'Message shown when an app update is available.'\n },\n reconnect_now: {\n id: 'reconnect_now',\n defaultMessage: 'Try now',\n description: 'Prompt for reconnecting now'\n }\n});\n\nclass TinodeWeb extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = this.getBlankState();\n\n this.handleResize = this.handleResize.bind(this);\n this.handleHashRoute = this.handleHashRoute.bind(this);\n this.handleOnline = this.handleOnline.bind(this);\n this.checkForAppUpdate = this.checkForAppUpdate.bind(this);\n this.handleAppVisibility = this.handleAppVisibility.bind(this);\n this.handleReadTimer = this.handleReadTimer.bind(this);\n this.handleVisibilityEvent = this.handleVisibilityEvent.bind(this);\n this.handleError = this.handleError.bind(this);\n this.handleLoginRequest = this.handleLoginRequest.bind(this);\n this.handleConnected = this.handleConnected.bind(this);\n this.handleAutoreconnectIteration = this.handleAutoreconnectIteration.bind(this);\n this.doLogin = this.doLogin.bind(this);\n this.handleCredentialsRequest = this.handleCredentialsRequest.bind(this);\n this.handleLoginSuccessful = this.handleLoginSuccessful.bind(this);\n this.handleDisconnect = this.handleDisconnect.bind(this);\n this.tnMeMetaDesc = this.tnMeMetaDesc.bind(this);\n this.tnMeContactUpdate = this.tnMeContactUpdate.bind(this);\n this.tnMeSubsUpdated = this.tnMeSubsUpdated.bind(this);\n this.resetContactList = this.resetContactList.bind(this);\n this.tnData = this.tnData.bind(this);\n this.tnInitFind = this.tnInitFind.bind(this);\n this.tnFndSubsUpdated = this.tnFndSubsUpdated.bind(this);\n this.handleSearchContacts = this.handleSearchContacts.bind(this);\n this.handleTopicSelected = this.handleTopicSelected.bind(this);\n this.handleHideMessagesView = this.handleHideMessagesView.bind(this);\n this.handleSendMessage = this.handleSendMessage.bind(this);\n this.handleNewAccount = this.handleNewAccount.bind(this);\n this.handleNewAccountRequest = this.handleNewAccountRequest.bind(this);\n this.handleUpdateAccountRequest = this.handleUpdateAccountRequest.bind(this);\n this.handleUpdateAccountTagsRequest = this.handleUpdateAccountTagsRequest.bind(this);\n this.handleSettings = this.handleSettings.bind(this);\n this.handleGlobalSettings = this.handleGlobalSettings.bind(this);\n this.handleShowArchive = this.handleShowArchive.bind(this);\n this.handleToggleMessageSounds = this.handleToggleMessageSounds.bind(this);\n this.initDesktopAlerts = this.initDesktopAlerts.bind(this);\n this.togglePushToken = this.togglePushToken.bind(this);\n this.requestPushToken = this.requestPushToken.bind(this);\n this.handleSidepanelCancel = this.handleSidepanelCancel.bind(this);\n this.handleNewTopic = this.handleNewTopic.bind(this);\n this.handleNewTopicRequest = this.handleNewTopicRequest.bind(this);\n this.handleNewTopicCreated = this.handleNewTopicCreated.bind(this);\n this.handleTopicUpdateRequest = this.handleTopicUpdateRequest.bind(this);\n this.handleChangePermissions = this.handleChangePermissions.bind(this);\n this.handleTagsUpdated = this.handleTagsUpdated.bind(this);\n this.handleLogout = this.handleLogout.bind(this);\n this.handleLeaveUnsubRequest = this.handleLeaveUnsubRequest.bind(this);\n this.handleDialogCancel = this.handleDialogCancel.bind(this);\n this.handleShowContextMenu = this.handleShowContextMenu.bind(this);\n this.defaultTopicContextMenu = this.defaultTopicContextMenu.bind(this);\n this.handleHideContextMenu = this.handleHideContextMenu.bind(this);\n this.handleShowInfoView = this.handleShowInfoView.bind(this);\n this.handleHideInfoView = this.handleHideInfoView.bind(this);\n this.handleMemberUpdateRequest = this.handleMemberUpdateRequest.bind(this);\n this.handleValidateCredentialsRequest = this.handleValidateCredentialsRequest.bind(this);\n this.handlePasswordResetRequest = this.handlePasswordResetRequest.bind(this);\n this.handleResetPassword = this.handleResetPassword.bind(this);\n }\n\n getBlankState() {\n const settings = LocalStorageUtil.getObject('settings') || {};\n\n return {\n connected: false,\n transport: settings.transport || null,\n serverAddress: settings.serverAddress || detectServerAddress(),\n serverVersion: \"no connection\",\n // \"On\" is the default, so saving the \"off\" state.\n messageSounds: !settings.messageSoundsOff,\n desktopAlerts: settings.desktopAlerts,\n desktopAlertsEnabled: (isSecureConnection() || isLocalHost()) &&\n (typeof firebase != 'undefined') && (typeof navigator != 'undefined') &&\n (typeof FIREBASE_INIT != 'undefined'),\n firebaseToken: LocalStorageUtil.getObject('firebase-token'),\n\n errorText: '',\n errorLevel: null,\n errorAction: undefined,\n errorActionText: null,\n\n sidePanelSelected: 'login',\n sidePanelTitle: null,\n sidePanelAvatar: null,\n dialogSelected: null,\n contextMenuVisible: false,\n login: '',\n password: '',\n myUserId: null,\n liveConnection: navigator.onLine,\n topicSelected: '',\n topicSelectedOnline: false,\n topicSelectedAcs: null,\n newGroupTopicParams: null,\n loginDisabled: false,\n displayMobile: (window.innerWidth <= MEDIA_BREAKPOINT),\n showInfoPanel: false,\n mobilePanel: 'sidepanel',\n\n contextMenuVisible: false,\n contextMenuBounds: null,\n contextMenuClickAt: null,\n contextMenuParams: null,\n contextMenuItems: [],\n\n // Chats as shown in the ContactsView\n chatList: [],\n // Contacts returned by a search query.\n searchResults: [],\n // Merged results of a search query and p2p chats.\n searchableContacts: [],\n credMethod: undefined,\n credCode: undefined\n };\n }\n\n componentDidMount() {\n window.addEventListener('resize', this.handleResize);\n window.addEventListener('online', (e) => { this.handleOnline(true); });\n window.addEventListener('offline', (e) => { this.handleOnline(false); });\n window.addEventListener('hashchange', this.handleHashRoute);\n // Window/tab visible or invisible for pausing timers.\n document.addEventListener('visibilitychange', this.handleVisibilityEvent);\n\n this.setState({\n viewportWidth: document.documentElement.clientWidth,\n viewportHeight: document.documentElement.clientHeight\n });\n\n this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport);\n this.tinode.onConnect = this.handleConnected;\n this.tinode.onDisconnect = this.handleDisconnect;\n this.tinode.onAutoreconnectIteration = this.handleAutoreconnectIteration;\n\n // Initialize desktop alerts.\n if (this.state.desktopAlertsEnabled) {\n try {\n this.fbPush = firebase.initializeApp(FIREBASE_INIT, APP_NAME).messaging();\n this.fbPush.usePublicVapidKey(FIREBASE_INIT.messagingVapidKey);\n navigator.serviceWorker.register('/service-worker.js').then((reg) => {\n this.checkForAppUpdate(reg);\n this.fbPush.useServiceWorker(reg);\n this.initDesktopAlerts();\n if (this.state.desktopAlerts) {\n if (!this.state.firebaseToken) {\n this.togglePushToken(true);\n } else {\n this.tinode.setDeviceToken(this.state.firebaseToken);\n }\n }\n }).catch((err) => {\n // registration failed :(\n console.log(\"Failed to register service worker:\", err);\n });\n } catch (err) {\n this.handleError(\"Failed to initialize push notifications\", 'err');\n console.log(\"Failed to initialize push notifications\", err);\n this.setState({desktopAlertsEnabled: false});\n }\n }\n\n const token = LocalStorageUtil.getObject('keep-logged-in') ?\n LocalStorageUtil.getObject('auth-token') : undefined;\n\n const parsedNav = HashNavigation.parseUrlHash(window.location.hash);\n if (token) {\n // When reading from storage, date is returned as string.\n token.expires = new Date(token.expires);\n this.tinode.setAuthToken(token);\n this.tinode.connect().catch((err) => {\n // Socket error\n this.handleError(err.message, 'err');\n });\n delete parsedNav.params.info;\n delete parsedNav.params.tab;\n parsedNav.path[0] = '';\n HashNavigation.navigateTo(HashNavigation.composeUrlHash(parsedNav.path, parsedNav.params));\n } else if (!parsedNav.params.token) {\n HashNavigation.navigateTo('');\n }\n\n this.readTimer = null;\n this.readTimerCallback = null;\n\n this.handleHashRoute();\n }\n\n componentWillUnmount() {\n window.removeEventListener('resize', this.handleResize);\n window.removeEventListener('hashchange', this.handleHashRoute);\n document.removeEventListener('visibilitychange', this.handleVisibilityEvent);\n }\n\n // Setup transport (usually websocket) and server address. This will terminate connection with the server.\n static tnSetup(serverAddress, transport) {\n let tinode = new Tinode(APP_NAME, serverAddress, API_KEY, transport, isSecureConnection());\n tinode.enableLogging(true, true);\n return tinode;\n }\n\n handleResize() {\n var mobile = document.documentElement.clientWidth <= MEDIA_BREAKPOINT;\n this.setState({\n viewportWidth: document.documentElement.clientWidth,\n viewportHeight: document.documentElement.clientHeight\n });\n if (this.state.displayMobile != mobile) {\n this.setState({displayMobile: mobile});\n }\n }\n\n // Check if a newer version of TinodeWeb app is available at the server.\n checkForAppUpdate(reg) {\n const {formatHTMLMessage} = this.props.intl;\n reg.onupdatefound = () => {\n const installingWorker = reg.installing;\n installingWorker.onstatechange = () => {\n if (installingWorker.state == 'installed' && navigator.serviceWorker.controller) {\n this.handleError(formatHTMLMessage(messages.update_available), 'info');\n }\n }\n }\n }\n\n // Handle for hashchange event: display appropriate panels.\n handleHashRoute() {\n var hash = HashNavigation.parseUrlHash(window.location.hash);\n if (hash.path && hash.path.length > 0) {\n // Left-side panel selector.\n if (['register','settings','edit','cred','reset','newtpk','archive','contacts',''].includes(hash.path[0])) {\n this.setState({sidePanelSelected: hash.path[0]});\n } else {\n console.log(\"Unknown sidepanel view\", hash.path[0]);\n }\n\n // Topic for MessagesView selector.\n if (hash.path.length > 1 && hash.path[1] != this.state.topicSelected) {\n this.setState({\n topicSelected: Tinode.topicType(hash.path[1]) ? hash.path[1] : null\n });\n }\n } else {\n // Empty hashpath\n this.setState({sidePanelSelected: ''});\n }\n\n // Save validation credentials, if available.\n if (hash.params.method) {\n this.setState({ credMethod: hash.params.method });\n }\n if (hash.params.code) {\n this.setState({ credCode: hash.params.code });\n }\n\n // Additional parameters of panels.\n this.setState({\n showInfoPanel: hash.params.info,\n newTopicTabSelected: hash.params.tab\n });\n }\n\n handleOnline(online) {\n var newState = {liveConnection: online};\n if (online) {\n this.handleError('', null);\n } else {\n this.handleError(\"No connection\", 'warn');\n }\n this.setState({liveConnection: online});\n }\n\n // Handling read notifications here to be able to pause\n // them then the window/tab is not visible.\n handleAppVisibility(visible, callback) {\n clearTimeout(this.readTimer);\n this.readTimerCallback = callback;\n if (visible && callback) {\n this.readTimer = setTimeout(callback, READ_DELAY);\n } else {\n this.readTimer = null;\n }\n }\n\n handleReadTimer(callback) {\n this.handleAppVisibility(!document.hidden, callback);\n }\n\n handleVisibilityEvent() {\n this.handleAppVisibility(!document.hidden, this.readTimerCallback);\n }\n\n handleError(err, level, action, actionText) {\n this.setState({errorText: err, errorLevel: level, errorAction: action, errorActionText: actionText});\n }\n\n // User clicked Login button in the side panel.\n handleLoginRequest(login, password) {\n this.setState({loginDisabled: true, login: login, password: password});\n this.handleError('', null);\n\n if (this.tinode.isConnected()) {\n this.doLogin(login, password, {meth: this.state.credMethod, resp: this.state.credCode});\n } else {\n this.tinode.connect().catch((err) => {\n // Socket error\n this.setState({loginDisabled: false});\n this.handleError(err.message, 'err');\n });\n }\n }\n\n // Connection succeeded.\n handleConnected() {\n var params = this.tinode.getServerInfo();\n this.setState({\n serverVersion: params.ver + ' ' + (params.build ? params.build : 'none') + '; '\n });\n this.doLogin(this.state.login, this.state.password, {meth: this.state.credMethod, resp: this.state.credCode});\n }\n\n // Called for each auto-reconnect iteration.\n handleAutoreconnectIteration(sec, prom) {\n clearInterval(this.reconnectCountdown);\n\n if (sec < 0) {\n // Clear error\n this.handleError();\n return;\n }\n\n if (prom) {\n // Reconnecting now\n prom.then(() => {\n // Reconnected: clear error\n this.handleError();\n }).catch((err) => {\n this.handleError(err.message, 'err');\n });\n return;\n }\n\n const {formatHTMLMessage} = this.props.intl;\n let count = sec / 1000;\n count = count | count;\n this.reconnectCountdown = setInterval(() => {\n this.handleError(\n formatHTMLMessage(messages.reconnect_countdown, {seconds: count}),\n 'warn',\n () => {\n clearInterval(this.reconnectCountdown);\n this.tinode.reconnect();\n },\n formatHTMLMessage(messages.reconnect_now)\n );\n count -= 1;\n }, 1000);\n }\n\n // Connection lost\n handleDisconnect(err) {\n this.setState({\n connected: false,\n topicSelectedOnline: false,\n dialogSelected: null,\n errorText: err && err.message ? err.message : \"Disconnected\",\n errorLevel: err && err.message ? 'err' : 'warn',\n loginDisabled: false,\n contextMenuVisible: false,\n serverVersion: \"no connection\"\n });\n }\n\n doLogin(login, password, cred) {\n if (this.tinode.isAuthenticated()) {\n // Already logged in. Go to default screen.\n HashNavigation.navigateTo('');\n return;\n }\n // Sanitize and package credentail.\n cred = Tinode.credential(cred);\n // Try to login with login/password. If they are not available, try token. If no token, ask for login/password.\n let promise = null;\n let token = this.tinode.getAuthToken();\n if (login && password) {\n this.setState({password: null});\n promise = this.tinode.loginBasic(login, password, cred);\n } else if (token) {\n promise = this.tinode.loginToken(token.token, cred);\n }\n\n if (promise) {\n promise.then((ctrl) => {\n if (ctrl.code >= 300 && ctrl.text === 'validate credentials') {\n if (cred) {\n this.handleError(\"Code does not match\", 'warn');\n }\n this.handleCredentialsRequest(ctrl.params);\n } else {\n this.handleLoginSuccessful();\n }\n }).catch((err) => {\n // Login failed, report error.\n this.setState({loginDisabled: false, credMethod: undefined, credCode: undefined});\n this.handleError(err.message, 'err');\n localStorage.removeItem('auth-token');\n HashNavigation.navigateTo('');\n });\n } else {\n // No login credentials provided.\n // Make sure we are on the login page.\n HashNavigation.navigateTo('');\n this.setState({loginDisabled: false});\n }\n }\n\n handleCredentialsRequest(params) {\n var parsed = HashNavigation.parseUrlHash(window.location.hash);\n parsed.path[0] = 'cred';\n parsed.params['method'] = params.cred[0];\n HashNavigation.navigateTo(HashNavigation.composeUrlHash(parsed.path, parsed.params));\n }\n\n handleLoginSuccessful() {\n this.handleError('', null);\n\n // Refresh authentication token.\n if (LocalStorageUtil.getObject('keep-logged-in')) {\n LocalStorageUtil.setObject('auth-token', this.tinode.getAuthToken());\n }\n // Logged in fine, subscribe to 'me' attaching callbacks from the contacts view.\n var me = this.tinode.getMeTopic();\n me.onMetaDesc = this.tnMeMetaDesc;\n me.onContactUpdate = this.tnMeContactUpdate;\n me.onSubsUpdated = this.tnMeSubsUpdated;\n this.setState({\n connected: true,\n credMethod: undefined,\n credCode: undefined,\n myUserId: this.tinode.getCurrentUserID()\n });\n // Subscribe, fetch topic desc, the list of subscriptions. Messages are not fetched.\n me.subscribe(\n me.startMetaQuery().\n withLaterSub().\n withDesc().\n build()\n ).catch((err) => {\n localStorage.removeItem('auth-token');\n this.handleError(err.message, 'err');\n HashNavigation.navigateTo('');\n });\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash, 'contacts'));\n }\n\n tnMeMetaDesc(desc) {\n if (desc && desc.public) {\n this.setState({\n sidePanelTitle: desc.public.fn,\n sidePanelAvatar: makeImageUrl(desc.public.photo)\n });\n }\n }\n\n // Reactions to updates to the contact list.\n tnMeContactUpdate(what, cont) {\n if (what == 'on' || what == 'off') {\n this.resetContactList();\n if (this.state.topicSelected == cont.topic) {\n this.setState({topicSelectedOnline: (what == 'on')});\n }\n } else if (what == 'read') {\n this.resetContactList();\n } else if (what == 'msg') {\n // New message received\n // Skip update if the topic is currently open, otherwise the badge will annoyingly flash.\n if (this.state.topicSelected != cont.topic) {\n if (this.state.messageSounds) {\n POP_SOUND.play();\n }\n this.resetContactList();\n } else if (document.hidden && this.state.messageSounds) {\n POP_SOUND.play();\n }\n } else if (what == 'recv') {\n // Explicitly ignoring \"recv\" -- it causes no visible updates to contact list.\n } else if (what == 'gone' || what == 'unsub') {\n // Topic deleted or user unsubscribed. Remove topic from view.\n // If the currently selected topic is gone, clear the selection.\n if (this.state.topicSelected == cont.topic) {\n this.handleTopicSelected(null);\n }\n // Redraw without the deleted topic.\n this.resetContactList();\n } else if (what == 'acs') {\n // Permissions changed. If it's for the currently selected topic,\n // update the views.\n if (this.state.topicSelected == cont.topic) {\n this.setState({topicSelectedAcs: cont.acs});\n }\n } else if (what == 'del') {\n // messages deleted (hard or soft) -- update pill counter.\n } else {\n // TODO(gene): handle other types of notifications:\n // * ua -- user agent changes (maybe display a pictogram for mobile/desktop).\n // * upd -- topic 'public' updated, issue getMeta().\n console.log(\"Unsupported (yet) presence update:\" + what + \" in: \" + cont.topic);\n }\n }\n\n tnMeSubsUpdated(unused) {\n this.resetContactList();\n }\n\n // Merge search results and contact list to create a single flat\n // list of kown contacts for GroupManager to use.\n static prepareSearchableContacts(chatList, foundContacts) {\n let merged = {};\n\n // For chatList topics merge only p2p topics and convert them to the\n // same format as foundContacts.\n for (const c of chatList) {\n if (Tinode.topicType(c.topic) == 'p2p') {\n merged[c.topic] = {\n user: c.topic,\n updated: c.updated,\n public: c.public,\n private: c.private,\n acs: c.acs\n };\n }\n }\n\n // Add all foundCountacts if they have not been added already.\n for (const c of foundContacts) {\n if (!merged[c.user]) {\n merged[c.user] = c;\n }\n }\n\n return Object.values(merged);\n }\n\n resetContactList() {\n let newState = {\n chatList: []\n };\n this.tinode.getMeTopic().contacts((c) => {\n newState.chatList.push(c);\n if (this.state.topicSelected == c.topic) {\n newState.topicSelectedOnline = c.online;\n newState.topicSelectedAcs = c.acs;\n }\n });\n // Merge search results and chat list.\n newState.searchableContacts = TinodeWeb.prepareSearchableContacts(newState.chatList, this.state.searchResults);\n this.setState(newState);\n }\n\n // Sending \"received\" notifications\n tnData(data) {\n const topic = this.tinode.getTopic(data.topic);\n if (topic.msgStatus(data) >= Tinode.MESSAGE_STATUS_SENT) {\n clearTimeout(this.receivedTimer);\n this.receivedTimer = setTimeout(() => {\n this.receivedTimer = undefined;\n topic.noteRecv(data.seq);\n }, RECEIVED_DELAY);\n }\n }\n\n /* Fnd topic: find contacts by tokens */\n tnInitFind() {\n const fnd = this.tinode.getFndTopic();\n fnd.onSubsUpdated = this.tnFndSubsUpdated;\n if (fnd.isSubscribed()) {\n this.tnFndSubsUpdated();\n } else {\n fnd.subscribe(fnd.startMetaQuery().withSub().withTags().build()).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n }\n\n tnFndSubsUpdated() {\n const foundContacts = [];\n // Don't attempt to create P2P topics which already exist. Server will reject the duplicates.\n this.tinode.getFndTopic().contacts((s) => {\n foundContacts.push(s);\n });\n this.setState({\n searchResults: foundContacts,\n searchableContacts: TinodeWeb.prepareSearchableContacts(this.state.chatList, foundContacts)\n });\n }\n\n /** Called when the user enters a contact into the contact search field in the NewAccount panel\n @param query {Array} is an array of contacts to search for\n */\n handleSearchContacts(query) {\n const fnd = this.tinode.getFndTopic();\n fnd.setMeta({desc: {public: query}}).then((ctrl) => {\n return fnd.getMeta(fnd.startMetaQuery().withSub().build());\n }).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n // User clicked on a contact in the side panel or deleted a contact.\n handleTopicSelected(topicName, unused_index, online, acs) {\n if (topicName) {\n this.setState({\n errorText: '',\n errorLevel: null,\n mobilePanel: 'topic-view',\n showInfoPanel: false\n });\n // Different contact selected.\n if (this.state.topicSelected != topicName) {\n this.setState({\n topicSelectedOnline: online,\n topicSelectedAcs: acs\n });\n HashNavigation.navigateTo(HashNavigation.setUrlTopic('', topicName));\n }\n } else {\n // Currently selected contact deleted\n this.setState({\n errorText: '',\n errorLevel: null,\n mobilePanel: 'sidepanel',\n topicSelectedOnline: false,\n topicSelectedAcs: null,\n showInfoPanel: false\n });\n if (this.state.topicSelected) {\n HashNavigation.navigateTo(HashNavigation.setUrlTopic('', null));\n }\n }\n }\n\n // In mobile view user requested to show sidepanel\n handleHideMessagesView() {\n this.setState({\n mobilePanel: 'sidepanel'\n });\n HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, null));\n }\n\n // User is sending a message, either plain text or a drafty object, possibly\n // with attachments.\n handleSendMessage(msg, promise, uploader) {\n const topic = this.tinode.getTopic(this.state.topicSelected);\n\n msg = topic.createMessage(msg, false);\n // The uploader is used to show progress.\n msg._uploader = uploader;\n\n if (!topic.isSubscribed()) {\n if (!promise) {\n promise = Promise.resolve();\n }\n promise = promise.then(() => { return topic.subscribe(); });\n }\n\n if (promise) {\n promise = promise.catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n topic.publishDraft(msg, promise)\n .then((ctrl) => {\n if (topic.isArchived()) {\n return topic.archive(false);\n }\n })\n .catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n // User chose a Sign Up menu item.\n handleNewAccount() {\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash, 'register'));\n }\n\n // Actual registration of a new account.\n handleNewAccountRequest(login_, password_, public_, cred_, tags_) {\n this.tinode.connect(this.state.serverAddress)\n .then(() => {\n return this.tinode.createAccountBasic(login_, password_,\n {public: public_, tags: tags_, cred: Tinode.credential(cred_)});\n }).then((ctrl) => {\n if (ctrl.code >= 300 && ctrl.text == 'validate credentials') {\n this.handleCredentialsRequest(ctrl.params);\n } else {\n this.handleLoginSuccessful(this);\n }\n }).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n handleUpdateAccountRequest(password, pub, defacs) {\n if (pub || defacs) {\n this.tinode.getMeTopic().setMeta({desc: {public: pub, defacs: defacs}}).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n if (password) {\n this.tinode.updateAccountBasic(null, this.tinode.getCurrentLogin(), password).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n }\n\n handleUpdateAccountTagsRequest(tags) {\n this.tinode.getFndTopic().setMeta({tags: tags})\n .catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n // User chose Settings menu item.\n handleSettings() {\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash,\n this.state.myUserId ? 'edit' : 'settings'));\n }\n\n // User updated global parameters.\n handleGlobalSettings(settings) {\n let serverAddress = settings.serverAddress || this.state.serverAddress;\n let transport = settings.transport || this.state.transport;\n if (this.tinode) {\n this.tinode.onDisconnect = undefined;\n this.tinode.disconnect();\n }\n this.tinode = TinodeWeb.tnSetup(serverAddress, transport);\n this.tinode.onConnect = this.handleConnected;\n this.tinode.onDisconnect = this.handleDisconnect;\n\n this.setState({\n serverAddress: serverAddress,\n transport: transport\n });\n LocalStorageUtil.setObject('settings', {\n serverAddress: serverAddress,\n transport: transport\n });\n\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash, ''));\n }\n\n // User chose 'Archived chats'.\n handleShowArchive() {\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash,\n this.state.myUserId ? 'archive' : ''));\n }\n\n // Initialize desktop alerts = push notifications.\n initDesktopAlerts() {\n // Google could not be bothered to mention that\n // onTokenRefresh is never called.\n this.fbPush.onTokenRefresh(() => {\n this.requestPushToken(true);\n });\n\n this.fbPush.onMessage((payload) => {\n // No need to do anything about it.\n // All the magic happends in the service worker.\n });\n }\n\n togglePushToken(enabled) {\n if (enabled) {\n if (!this.state.firebaseToken) {\n this.fbPush.requestPermission().then(() => {\n this.requestPushToken(true);\n }).catch((err) => {\n this.handleError(err.message, 'err');\n this.setState({desktopAlerts: false, firebaseToken: null});\n LocalStorageUtil.updateObject('settings', {desktopAlerts: false});\n console.log(\"Failed to get permission to notify.\", err);\n });\n } else {\n this.setState({desktopAlerts: true});\n LocalStorageUtil.updateObject('settings', {desktopAlerts: true});\n }\n } else if (this.state.firebaseToken) {\n this.fbPush.deleteToken(this.state.firebaseToken).catch((err) => {\n console.log(\"Unable to delete token.\", err);\n }).finally(() => {\n LocalStorageUtil.updateObject('settings', {desktopAlerts: false});\n localStorage.removeItem('firebase-token');\n this.setState({desktopAlerts: false, firebaseToken: null});\n });\n } else {\n this.setState({desktopAlerts: false, firebaseToken: null});\n LocalStorageUtil.updateObject('settings', {desktopAlerts: false});\n }\n }\n\n requestPushToken(sendToServer) {\n this.fbPush.getToken().then((refreshedToken) => {\n if (refreshedToken != this.state.firebaseToken) {\n this.tinode.setDeviceToken(refreshedToken, sendToServer);\n LocalStorageUtil.setObject('firebase-token', refreshedToken);\n }\n this.setState({firebaseToken: refreshedToken, desktopAlerts: true});\n LocalStorageUtil.updateObject('settings', {desktopAlerts: true});\n }).catch((err) => {\n this.handleError(err.message, 'err');\n console.log(\"Failed to retrieve firebase token\", err);\n });\n }\n\n handleToggleMessageSounds(enabled) {\n this.setState({messageSounds: enabled});\n LocalStorageUtil.updateObject('settings', {\n messageSoundsOff: !enabled\n });\n }\n\n // User clicked Cancel button in Setting or Sign Up panel.\n handleSidepanelCancel() {\n const parsed = HashNavigation.parseUrlHash(window.location.hash);\n parsed.path[0] = this.state.myUserId ? 'contacts' : '';\n if (parsed.params) {\n delete parsed.params.code;\n delete parsed.params.method;\n delete parsed.params.tab;\n }\n HashNavigation.navigateTo(HashNavigation.composeUrlHash(parsed.path, parsed.params));\n this.setState({errorText: '', errorLevel: null});\n }\n\n // User clicked a (+) menu item.\n handleNewTopic() {\n HashNavigation.navigateTo(HashNavigation.setUrlSidePanel(window.location.hash, 'newtpk'));\n }\n\n // Request to start a new topic. New P2P topic requires peer's name.\n handleNewTopicRequest(peerName, pub, priv, tags) {\n const topicName = peerName || this.tinode.newGroupTopicName();\n if (!peerName) {\n this.setState(\n {newGroupTopicParams: {desc: {public: pub, private: {comment: priv}}, tags: tags}},\n () => {this.handleTopicSelected(topicName)}\n );\n } else {\n this.handleTopicSelected(topicName);\n }\n }\n\n // New topic was creted, here is the new topic name.\n handleNewTopicCreated(oldName, newName) {\n if (this.state.topicSelected == oldName && oldName != newName) {\n // If the current URl contains the old topic name, replace it with new.\n // Update the name of the selected topic first so the navigator doen't clear\n // the state.\n this.setState({topicSelected: newName}, () => {\n HashNavigation.navigateTo(HashNavigation.setUrlTopic('', newName));\n });\n }\n }\n\n handleTopicUpdateRequest(topicName, pub, priv, permissions) {\n const topic = this.tinode.getTopic(topicName);\n if (topic) {\n const params = {};\n if (pub) {\n params.public = pub;\n }\n if (priv) {\n params.private = (priv === Tinode.DEL_CHAR) ?\n Tinode.DEL_CHAR : {comment: priv};\n }\n if (permissions) {\n params.defacs = permissions;\n }\n topic.setMeta({desc: params}).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n }\n\n handleChangePermissions(topicName, mode, uid) {\n const topic = this.tinode.getTopic(topicName);\n if (topic) {\n const am = topic.getAccessMode();\n if (uid) {\n am.updateGiven(mode);\n mode = am.getGiven();\n } else {\n am.updateWant(mode);\n mode = am.getWant();\n }\n topic.setMeta({sub: {user: uid, mode: mode}}).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n }\n\n handleTagsUpdated(topicName, tags) {\n const topic = this.tinode.getTopic(topicName);\n if (topic) {\n topic.setMeta({tags: tags}).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n }\n\n handleLogout() {\n updateFavicon(0);\n\n // Remove stored data.\n localStorage.removeItem('auth-token');\n localStorage.removeItem('firebase-token');\n localStorage.removeItem('settings');\n\n if (this.tinode) {\n this.tinode.onDisconnect = undefined;\n this.tinode.disconnect();\n }\n this.setState(this.getBlankState());\n this.tinode = TinodeWeb.tnSetup(this.state.serverAddress, this.state.transport);\n this.tinode.onConnect = this.handleConnected;\n this.tinode.onDisconnect = this.handleDisconnect;\n HashNavigation.navigateTo('');\n }\n\n handleLeaveUnsubRequest(topicName) {\n const topic = this.tinode.getTopic(topicName);\n if (!topic) {\n return;\n }\n\n topic.leave(true).then((ctrl) => {\n // Hide MessagesView and InfoView panels.\n HashNavigation.navigateTo(HashNavigation.setUrlTopic(window.location.hash, ''));\n }).catch((err) => {\n this.handleError(err.message, 'err');\n });\n }\n\n handleDialogCancel() {\n this.setState({dialogSelected: null});\n }\n\n handleShowContextMenu(params, menuItems) {\n this.setState({\n contextMenuVisible: true,\n contextMenuClickAt: {x: params.x, y: params.y},\n contextMenuParams: params,\n contextMenuItems: menuItems || this.defaultTopicContextMenu(params.topicName),\n contextMenuBounds: ReactDOM.findDOMNode(this).getBoundingClientRect()\n });\n }\n\n defaultTopicContextMenu(topicName) {\n const topic = this.tinode.getTopic(topicName);\n const {formatMessage} = this.props.intl;\n\n let muted = false, blocked = false, subscribed = false, deleter = false, archived = false;\n if (topic) {\n if (topic.isSubscribed()) {\n subscribed = true;\n\n const acs = topic.getAccessMode();\n muted = acs && acs.isMuted();\n blocked = acs && !acs.isJoiner();\n deleter = acs && acs.isDeleter();\n }\n archived = topic.isArchived();\n }\n\n return [\n subscribed ? {title: formatMessage({id: 'menu_item_info'}), handler: this.handleShowInfoView} : null,\n subscribed ? 'messages_clear' : null,\n subscribed && deleter ? 'messages_clear_hard' : null,\n subscribed ? (muted ? 'topic_unmute' : 'topic_mute') : null,\n subscribed ? (blocked ? 'topic_unblock' : 'topic_block') : null,\n subscribed && !archived ? 'topic_archive' : null,\n 'topic_delete'\n ];\n }\n\n handleHideContextMenu() {\n this.setState({\n contextMenuVisible: false,\n contextMenuClickAt: null,\n contextMenuParams: null,\n contextMenuBounds: null\n });\n }\n\n handleShowInfoView() {\n HashNavigation.navigateTo(HashNavigation.addUrlParam(window.location.hash, 'info', true));\n this.setState({showInfoPanel: true});\n }\n\n handleHideInfoView() {\n HashNavigation.navigateTo(HashNavigation.removeUrlParam(window.location.hash, 'info'));\n this.setState({showInfoPanel: false});\n }\n\n handleMemberUpdateRequest(topicName, added, removed) {\n if (!topicName) {\n return;\n }\n\n const topic = this.tinode.getTopic(topicName);\n if (!topic) {\n return;\n }\n\n if (added && added.length > 0) {\n added.map((uid) => {\n topic.invite(uid, null).catch((err) => {\n this.handleError(err.message, 'err');\n });\n });\n }\n\n if (removed && removed.length > 0) {\n removed.map((uid) => {\n topic.delSubscription(uid).catch((err) => {\n this.handleError(err.message, 'err');\n });\n });\n }\n }\n\n handleValidateCredentialsRequest(cred, code) {\n this.setState({credMethod: cred, credCode: code});\n this.doLogin(null, null, {meth: cred, resp: code});\n }\n\n handlePasswordResetRequest(method, value) {\n // If already connected, connnect() will return a resolved promise.\n this.tinode.connect()\n .then(() => {\n return this.tinode.requestResetAuthSecret('basic', method, value)\n })\n .catch((err) => {\n // Socket error\n this.handleError(err.message, 'err');\n });\n }\n\n handleResetPassword(scheme, newPassword, token) {\n token = base64ReEncode(token);\n if (!token) {\n this.handleError(\"Invalid security token\", 'err');\n } else {\n this.tinode.connect()\n .then(() => {\n return this.tinode.updateAccountBasic(null, null, newPassword, {token: token});\n })\n .catch((err) => {\n // Socket error\n this.handleError(err.message, 'err');\n });\n }\n }\n\n render() {\n return (\n
    \n {this.state.contextMenuVisible ?\n \n :\n null\n }\n\n \n\n \n\n {this.state.showInfoPanel ?\n \n :\n null\n }\n
    \n );\n }\n};\n\nexport default injectIntl(TinodeWeb);\n","// ValidationView: panel for confirming credentials, like email or phone.\nimport React from 'react';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\n\nconst messages = defineMessages({\n phone: {\n id: 'phone_dative',\n defaultMessage: 'phone',\n description: \"Dative case of 'phone', i.e. 'phone' in 'by phone'\",\n },\n email: {\n id: 'email_dative',\n defaultMessage: 'email',\n description: \"Dative case of 'email', i.e. 'email' in 'by email'\",\n }\n});\n\nclass ValidationView extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n code: props.credCode || ''\n };\n\n this.handleChange = this.handleChange.bind(this);\n this.handleKeyPress = this.handleKeyPress.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n }\n\n handleChange(e) {\n this.setState({code: e.target.value});\n }\n\n handleKeyPress(e) {\n if (e.key === 'Enter') {\n this.handleSubmit(e);\n }\n }\n\n handleSubmit(e) {\n e.preventDefault();\n if (this.state.code && this.state.code.trim()) {\n this.props.onSubmit(this.props.credMethod, this.state.code.trim());\n }\n }\n\n render() {\n const { formatMessage } = this.props.intl;\n const methods = {'email': formatMessage(messages.email), 'tel': formatMessage(messages.phone)};\n let method = methods[this.props.credMethod] || this.props.credMethod;\n return (\n
    \n
    \n \n
    \n
    \n {\n (numbers_only) => \n }\n
    \n
    \n \n
    \n
    \n );\n }\n};\n\nexport default injectIntl(ValidationView);\n","import React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport FileProgress from './file-progress.jsx';\nimport { bytesToHumanSize } from '../lib/strformat.js';\n\nexport default class Attachment extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n downloader: null,\n progress: 0\n };\n\n this.downloadFile = this.downloadFile.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n }\n\n downloadFile(url, filename, mimetype) {\n var downloader = this.props.tinode.getLargeFileHelper();\n this.setState({downloader: downloader});\n downloader.download(url, filename, mimetype, (loaded) => {\n this.setState({progress: loaded / this.props.size});\n }).then(() => {\n this.setState({downloader: null, progress: 0});\n }).catch((err) => {\n if (err) {\n this.props.onError(\"Error downloading file: \" + err.message, 'err');\n }\n this.setState({downloader: null, progress: 0});\n });\n }\n\n handleCancel() {\n if (this.props.uploader) {\n this.props.onCancelUpload();\n } else if (this.state.downloader) {\n this.state.downloader.cancel();\n }\n }\n\n render() {\n let filename = this.props.filename || 'file_attachment';\n if (filename.length > 36) {\n filename = filename.substr(0, 16) + '...' + filename.substr(-16);\n }\n let size = this.props.size > 0 ?\n ({bytesToHumanSize(this.props.size)}) :\n null;\n\n // Detect if the download URL is relative or absolute.\n // If the URL is relative use LargeFileHelper to attach authentication\n // credentials to the request.\n let url, helperFunc;\n if (!this.props.uploader && !this.state.downloader &&\n !(/^(?:(?:[a-z]+:)?\\/\\/)/i.test(this.props.downloadUrl))) {\n // Relative URL. Use download helper.\n url = \"javascript:;\";\n helperFunc = (e) => {\n this.downloadFile(this.props.downloadUrl, this.props.filename, this.props.mimetype);\n };\n } else {\n url = this.props.downloadUrl;\n helperFunc = null;\n }\n return (\n
    \n
    insert_drive_file
    \n
    \n
    {filename} {size}
    \n {this.props.uploader || this.state.downloader ?\n \n :\n \n }\n
    \n
    \n );\n }\n};\n","import React from 'react';\n\nimport LetterTile from './letter-tile.jsx';\n\nimport { AVATAR_SIZE } from '../config.js';\nimport { imageFileScaledToBase64, makeImageUrl } from '../lib/blob-helpers.js';\n\nexport default class AvatarUpload extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n dataUrl: props.avatar\n };\n\n this.handleFileUpload = this.handleFileUpload.bind(this);\n this.handleClear = this.handleClear.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n if (prevState.dataUrl != nextProps.avatar) {\n return {\n dataUrl: nextProps.avatar\n };\n }\n return null;\n }\n\n handleFileUpload(e) {\n imageFileScaledToBase64(e.target.files[0], AVATAR_SIZE, AVATAR_SIZE, true,\n // Success\n (base64bits, mime) => {\n var du = makeImageUrl({data: base64bits, type: mime});\n this.setState({dataUrl: du});\n this.props.onImageChanged(du);\n },\n // Failure\n (err) => {\n this.props.onError(err, 'err');\n });\n // Clear the value so the same file can be uploaded again.\n e.target.value = '';\n }\n\n handleClear() {\n this.props.onImageChanged(null);\n }\n\n render() {\n // Randomize id value in case more than one AvatarUpload is shown\n // at the same time.\n var randId = \"file-input-avatar-\" + (Math.random() + '').substr(2);\n return (\n
    \n {this.props.readOnly || !this.state.dataUrl ?\n null :\n \n clear\n }\n {this.state.dataUrl ?\n :\n this.props.readOnly && this.props.uid ?\n
    \n \n
    \n :\n
    {AVATAR_SIZE}×{AVATAR_SIZE}
    }\n {this.props.readOnly ? null :\n }\n {this.props.readOnly ? null :\n }\n
    \n );\n }\n};\n","// Single message, sent or received.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\nimport { Drafty } from 'tinode-sdk'\n\nimport Attachment from './attachment.jsx';\nimport LetterTile from './letter-tile.jsx';\nimport ReceivedMarker from './received-marker.jsx'\n\nexport default class ChatMessage extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n progress: 0\n };\n\n if (props.uploader) {\n props.uploader.onProgress = this.handleProgress.bind(this);\n }\n\n this.handlePreviewImage = this.handlePreviewImage.bind(this);\n this.handleFormButtonClick = this.handleFormButtonClick.bind(this);\n this.handleContextClick = this.handleContextClick.bind(this);\n this.handleCancelUpload = this.handleCancelUpload.bind(this);\n }\n\n handlePreviewImage(e) {\n e.preventDefault();\n this.props.onImagePreview({\n url: e.target.src,\n filename: e.target.title,\n width: e.target.dataset.width,\n height: e.target.dataset.height,\n size: e.target.dataset.size,\n type: e.target.dataset.mime\n });\n }\n\n handleFormButtonClick(e) {\n e.preventDefault();\n const data = {\n seq: this.props.seq\n };\n data.resp = {};\n if (e.target.dataset.name) {\n data.resp[e.target.dataset.name] = e.target.dataset.val ? e.target.dataset.val :\n e.target.dataset.val === undefined ? 1 : '' + e.target.dataset.val;\n }\n if (e.target.dataset.act == 'url') {\n data.ref = '' + e.target.dataset.ref;\n }\n const text = e.target.dataset.title || 'unknown';\n this.props.onFormResponse(e.target.dataset.act, text, data);\n }\n\n handleContextClick(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.showContextMenu({ seq: this.props.seq, y: e.pageY, x: e.pageX });\n }\n\n handleProgress(ratio) {\n this.setState({progress: ratio});\n }\n\n handleCancelUpload() {\n this.props.uploader.cancel();\n }\n\n render() {\n const sideClass = this.props.sequence + ' ' + (this.props.response ? 'left' : 'right');\n const bubbleClass = (this.props.sequence == 'single' || this.props.sequence == 'last') ?\n 'bubble tip' : 'bubble';\n const avatar = this.props.userAvatar || true;\n const fullDisplay = (this.props.userFrom && this.props.response &&\n (this.props.sequence == 'single' || this.props.sequence == 'last'));\n\n let content = this.props.content;\n const attachments = [];\n if (this.props.mimeType == Drafty.getContentType()) {\n Drafty.attachments(content, function(att, i) {\n if (att.mime == 'application/json') {\n // Don't show json objects as attachments.\n // They are not meant for users.\n return;\n }\n attachments.push();\n }, this);\n content = React.createElement('span', null, Drafty.format(content, draftyFormatter, this));\n } else if (typeof content != 'string') {\n content = error_outline \n \n \n }\n\n return (\n
  • \n {this.props.userFrom && this.props.response ?\n
    \n {fullDisplay ?\n :\n null}\n
    :\n null}\n
    \n
    \n
    \n {content}\n {attachments}\n \n
    \n \n \n expand_more\n \n \n
    \n {fullDisplay ?\n
    \n {\n (notFound) => {return this.props.userName || {notFound}}\n }\n
    \n : null\n }\n
    \n
  • \n );\n }\n};\n\n// Convert Drafty object to a tree of React elements.\nimport { BROKEN_IMAGE_SIZE, REM_SIZE } from '../config.js';\nimport { fitImageSize } from '../lib/blob-helpers.js';\n\nfunction draftyFormatter(style, data, values, key) {\n let el = Drafty.tagName(style);\n if (el) {\n let attr = Drafty.attrValue(style, data) || {};\n attr.key = key;\n switch (style) {\n case 'IM':\n // Additional processing for images\n if (data) {\n attr.className = 'inline-image';\n let dim = fitImageSize(data.width, data.height,\n Math.min(this.props.viewportWidth - REM_SIZE * 4, REM_SIZE * 36), REM_SIZE * 24, false);\n dim = dim || {dstWidth: BROKEN_IMAGE_SIZE, dstHeight: BROKEN_IMAGE_SIZE};\n attr.style = { width: dim.dstWidth + 'px', height: dim.dstHeight + 'px' };\n if (attr.src) {\n attr.onClick = this.handlePreviewImage;\n attr.className += ' image-clickable';\n } else {\n attr.src = 'img/broken_image.png';\n }\n }\n break;\n case 'BN':\n // Button\n attr.onClick = this.handleFormButtonClick;\n let inner = React.Children.map(values, (child) => {\n return typeof child == 'string' ? child : undefined;\n });\n if (!inner || inner.length == 0) {\n inner = [attr.name]\n }\n // Get text which will be sent back when the button is clicked.\n attr['data-title'] = inner.join('');\n break;\n case 'FM':\n // Form\n attr.className = 'bot-form';\n // console.log(data, attr);\n break;\n case 'FE':\n // Form element formatting is dependent on element content.\n break;\n }\n return React.createElement(el, attr, values);\n } else {\n return values;\n }\n};\n","import React from 'react';\n\n/* BEGIN CheckBox: styled checkbox */\nexport default class CheckBox extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.handleChange = this.handleChange.bind(this);\n }\n\n handleChange() {\n this.props.onChange(this.props.name, !this.props.checked);\n }\n\n render() {\n return (\n this.props.onChange ? (\n this.props.checked ?\n check_box :\n check_box_outline_blank\n ) : (\n this.props.checked ?\n check_box :\n check_box_outline_blank\n )\n );\n }\n}\n/* END CheckBox */\n","import React from 'react';\n\nimport Chip from './chip.jsx';\n\nimport { makeImageUrl } from '../lib/blob-helpers.js';\n\n/* BEGIN ChipInput: group membership widget */\nexport default class ChipInput extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n placeholder: props.chips ? '' : props.prompt,\n sortedChips: ChipInput.sortChips(props.chips, props.required),\n chipIndex: ChipInput.indexChips(props.chips),\n input: '',\n focused: false\n };\n\n this.handleTextInput = this.handleTextInput.bind(this);\n this.removeChipAt = this.removeChipAt.bind(this);\n this.handleChipCancel = this.handleChipCancel.bind(this);\n this.handleFocusGained = this.handleFocusGained.bind(this);\n this.handleFocusLost = this.handleFocusLost.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n }\n\n UNSAFE_componentWillReceiveProps(nextProps) {\n this.setState({\n sortedChips: ChipInput.sortChips(nextProps.chips, nextProps.required),\n chipIndex: ChipInput.indexChips(nextProps.chips)\n });\n if (nextProps.chips.length > this.props.chips.length) {\n // Chip added: clear input.\n this.setState({input: ''});\n }\n }\n\n // Map chip index to user name\n static indexChips(chips) {\n var index = {};\n var count = 0;\n chips.map(function(item) {\n index[item.user] = count;\n count ++;\n });\n return index;\n }\n\n // Have non-removable chips appear before all other chips.\n static sortChips(chips, keep) {\n var required = [];\n var normal = [];\n chips.map(function(item) {\n if (item.user === keep) {\n required.push(item);\n } else {\n normal.push(item);\n }\n });\n return required.concat(normal);\n }\n\n handleTextInput(e) {\n this.setState({input: e.target.value});\n if (this.props.filterFunc) {\n this.props.filterFunc(e.target.value);\n }\n }\n\n removeChipAt(idx) {\n var removed = this.state.sortedChips[idx];\n this.props.onChipRemoved(removed.user, this.state.chipIndex[removed.user]);\n }\n\n handleChipCancel(item, idx) {\n this.removeChipAt(idx);\n }\n\n handleFocusGained() {\n this.setState({focused: true});\n }\n\n handleFocusLost() {\n this.setState({focused: false});\n if (this.props.onFocusLost) {\n this.props.onFocusLost(this.state.input);\n }\n }\n\n handleKeyDown(e) {\n if (e.key === 'Backspace') {\n if (this.state.input.length == 0 && this.state.sortedChips.length > 0) {\n var at = this.state.sortedChips.length - 1;\n if (this.state.sortedChips[at].user !== this.props.required) {\n this.removeChipAt(at);\n }\n }\n } else if (e.key === 'Enter') {\n if (this.props.onEnter) {\n this.props.onEnter(this.state.input);\n }\n } else if (e.key === 'Escape') {\n if (this.props.onCancel) {\n this.props.onCancel();\n }\n }\n }\n\n render() {\n var chips = [];\n var count = 0;\n this.state.sortedChips.map((item) => {\n chips.push(\n \n );\n count++;\n });\n var className = \"chip-input\" + (this.state.focused ? ' focused' : '');\n return (\n
    \n {chips}\n \n
    \n );\n }\n};\n","import React from 'react';\n\nimport LetterTile from './letter-tile.jsx';\n\nexport default class Chip extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.handleCancel = this.handleCancel.bind(this);\n }\n\n handleCancel() {\n this.props.onCancel(this.props.topic, this.props.index);\n }\n\n render() {\n var title = this.props.title || this.props.topic;\n return (\n
    \n {this.props.noAvatar ?\n :\n
    \n \n
    \n }\n {title}\n {this.props.onCancel && !this.props.required ?\n ×\n : }\n
    \n );\n }\n};\n","// A panel included into a list of contacts with an action text.\nimport React from 'react';\nimport { injectIntl } from 'react-intl';\n\nclass ContactAction extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.handleClick = this.handleClick.bind(this);\n }\n\n handleClick(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.onAction(this.props.action);\n }\n\n render() {\n const {formatMessage} = this.props.intl;\n return (\n
  • \n
    {formatMessage(this.props.title, this.props.values)}
    \n
  • \n );\n }\n};\n\nexport default injectIntl(ContactAction);\n","import React from 'react';\n\n/* Contact's labels: [you], [muted], [blocked], etc */\n// FIXME: this class is unused.\nexport default class ContactBadges extends React.PureComponent {\n render() {\n let badges = null;\n if (this.props.badges && this.props.badges.length > 0) {\n badges = [];\n this.props.badges.map(function(b) {\n let style = 'badge' + (b.color ? ' ' + b.color : '');\n badges.push({b.name});\n });\n }\n return {badges};\n }\n};\n","// ContactList: component for showing a list of contacts,\n// such as a list of group members in a group chat.\nimport React from 'react';\nimport { defineMessages, injectIntl } from 'react-intl';\n\nimport Contact from './contact.jsx';\nimport ContactAction from './contact-action.jsx';\n\nimport { makeImageUrl } from '../lib/blob-helpers.js';\n\nconst messages = defineMessages({\n badge_you: {\n id: 'badge_you',\n defaultMessage: 'you',\n description: 'Badge for indicating the current user'\n },\n badge_owner: {\n id: 'badge_owner',\n defaultMessage: 'owner',\n description: 'Badge for indicating the owner'\n }\n});\n\nclass ContactList extends React.Component {\n render() {\n const {formatMessage} = this.props.intl;\n const showCheckmark = Array.isArray(this.props.topicSelected);\n const contactNodes = [];\n let contactsCount = 0;\n if (this.props.contacts && this.props.contacts.length > 0) {\n this.props.contacts.map((c) => {\n if (c.action) {\n // Action item\n contactNodes.push(\n );\n } else {\n // Normal contact\n const key = c.topic ? c.topic : c.user;\n // If filter function is provided, filter out the items\n // which don't satisfy the condition.\n if (this.props.filterFunc && this.props.filter) {\n let content = [key];\n if (c.private && c.private.comment) {\n content.push(('' + c.private.comment).toLowerCase());\n }\n if (c.public && c.public.fn) {\n content.push(('' + c.public.fn).toLowerCase());\n }\n if (!this.props.filterFunc(this.props.filter, content)) {\n return;\n }\n }\n\n const selected = showCheckmark ?\n (this.props.topicSelected.indexOf(key) > -1) :\n (this.props.topicSelected === key);\n const badges = [];\n if (this.props.showMode) {\n if (key === this.props.myUserId) {\n badges.push({name: formatMessage(messages.badge_you), color: 'green'});\n }\n if (c.acs && c.acs.isOwner()) {\n badges.push({name: formatMessage(messages.badge_owner), color: 'blue'});\n }\n }\n const comment = Array.isArray(c.private) ?\n c.private.join(',') : (c.private ? c.private.comment : null);\n\n contactNodes.push(\n \n );\n contactsCount ++;\n }\n }, this);\n }\n\n return (\n
    \n {contactsCount == 0 ?\n
    \n :\n null\n }\n {contactNodes.length > 0 ?\n
      \n {contactNodes}\n
    \n :\n null\n }\n
    \n );\n }\n};\n\nexport default injectIntl(ContactList);\n","// A single topic or user.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nimport LetterTile from './letter-tile.jsx';\nimport ContactBadges from './contact-badges.jsx';\nimport UnreadBadge from './unread-badge.jsx';\n\nexport default class Contact extends React.Component {\n constructor(props) {\n super(props);\n\n this.handleClick = this.handleClick.bind(this);\n this.handleContextClick = this.handleContextClick.bind(this);\n }\n\n handleClick(e) {\n e.preventDefault();\n e.stopPropagation();\n if (this.props.onSelected) {\n this.props.onSelected(this.props.item, this.props.index, this.props.now, this.props.acs);\n }\n }\n\n handleContextClick(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.showContextMenu({ topicName: this.props.item, y: e.pageY, x: e.pageX });\n }\n\n render() {\n let title = this.props.title;\n if (!title) {\n title = ;\n } else if (title.length > 30) {\n // FIXME: this is probably wrong for RTL languages.\n title = title.substring(0, 28) + '...';\n }\n const online = this.props.now ? 'online' : 'offline';\n const avatar = this.props.avatar ? this.props.avatar : true;\n const badges = this.props.badges ? this.props.badges.slice() : [];\n if (this.props.showMode && this.props.acs) {\n badges.push({name: this.props.acs.getMode(), key: 'mode'});\n }\n\n return (\n
  • \n
    \n \n {this.props.showOnline ? :\n (this.props.showCheckmark && this.props.selected ?\n check_circle\n : null)}\n
    \n
    \n
    {title}\n {this.props.unread > 0 ? : null}\n
    \n {this.props.comment ?
    {this.props.comment}
    : null}\n \n
    \n {this.props.showContextMenu ?\n \n \n expand_more\n \n : null}\n
  • \n );\n }\n};\n","// Context Menu: popup/dropdown menu.\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { injectIntl, defineMessages } from 'react-intl';\n\nimport { REM_SIZE } from '../config.js';\n\nconst messages = defineMessages({\n info: {\n id: 'menu_item_info',\n defaultMessage: 'Info',\n description: 'Show extended topic information'\n },\n clear_messages: {\n id: 'menu_item_clear_messages',\n defaultMessage: 'Clear messages',\n description: 'Delete all messages'\n },\n clear_for_all: {\n id: 'menu_item_clear_messages_for_all',\n defaultMessage: 'Clear for All',\n description: 'Delete all message(s) for all members'\n },\n 'delete': {\n id: 'menu_item_delete',\n defaultMessage: 'Delete',\n description: 'Delete selected messages'\n },\n delete_for_all: {\n id: 'menu_item_delete_for_all',\n defaultMessage: 'Delete for All',\n description: 'Delete selected message(s) for all members'\n },\n mute: {\n id: 'menu_item_mute',\n defaultMessage: 'Mute',\n description: 'Turn off notifications'\n },\n unmute: {\n id: 'menu_item_unmute',\n defaultMessage: 'Unmute',\n description: 'Turn notifications on'\n },\n topic_delete: {\n id: 'menu_item_delete_topic',\n defaultMessage: 'Delete',\n description: 'Delete entire topic'\n },\n unblock: {\n id: 'menu_item_unblock',\n defaultMessage: 'Unblock',\n description: 'Unblock user'\n },\n block: {\n id: 'menu_item_block',\n defaultMessage: 'Block',\n description: 'Block user'\n },\n member_delete: {\n id: 'menu_item_member_delete',\n defaultMessage: 'Remove',\n description: 'Remove user from topic'\n },\n archive: {\n id: 'menu_item_archive_topic',\n defaultMessage: 'Archive',\n description: 'Move topic from the list of active chats to archive'\n }\n});\n\nclass ContextMenu extends React.Component {\n constructor(props) {\n super(props);\n\n const {formatMessage} = props.intl;\n\n this.handlePageClick = this.handlePageClick.bind(this);\n this.handleEscapeKey = this.handleEscapeKey.bind(this);\n this.handleClick = this.handleClick.bind(this);\n\n // Preconfigured menu items.\n this.MenuItems = {\n 'topic_info': {title: formatMessage(messages.info), handler: null},\n\n 'messages_clear': {title: formatMessage(messages.clear_messages), handler: (params, errorHandler) => {\n this.deleteMessages(true, false, params, errorHandler);\n }},\n 'messages_clear_hard': {title: formatMessage(messages.clear_for_all), handler: (params, errorHandler) => {\n this.deleteMessages(true, true, params, errorHandler);\n }},\n 'message_delete': {title: formatMessage(messages.delete), handler: (params, errorHandler) => {\n this.deleteMessages(false, false, params, errorHandler);\n }},\n 'message_delete_hard': {title: formatMessage(messages.delete_for_all), handler: (params, errorHandler) => {\n this.deleteMessages(false, true, params, errorHandler);\n }},\n 'topic_unmute': {title: formatMessage(messages.unmute), handler: this.topicPermissionSetter.bind(this, '+P')},\n 'topic_mute': {title: formatMessage(messages.mute), handler: this.topicPermissionSetter.bind(this, '-P')},\n 'topic_unblock': {title: formatMessage(messages.unblock), handler: this.topicPermissionSetter.bind(this, '+J')},\n 'topic_block': {title: formatMessage(messages.block), handler: this.topicPermissionSetter.bind(this, '-J')},\n 'topic_delete': {title: formatMessage(messages.topic_delete), handler: (params, errorHandler) => {\n const topic = this.props.tinode.getTopic(params.topicName);\n if (!topic) {\n console.log(\"Topic not found: \", params.topicName);\n return;\n }\n topic.delTopic().catch((err) => {\n if (errorHandler) {\n errorHandler(err.message, 'err');\n }\n });\n }},\n 'topic_archive': {title: formatMessage(messages.archive), handler: (params, errorHandler) => {\n const topic = this.props.tinode.getTopic(params.topicName);\n if (!topic) {\n console.log(\"Topic not found: \", params.topicName);\n return;\n }\n topic.archive(true).catch((err) => {\n if (errorHandler) {\n errorHandler(err.message, 'err');\n }\n });\n }},\n // menu_item_edit_permissions is defined elsewhere.\n 'permissions': {title: formatMessage({id: 'menu_item_edit_permissions'}), handler: null},\n 'member_delete': {title: formatMessage(messages.member_delete), handler: (params, errorHandler) => {\n const topic = this.props.tinode.getTopic(params.topicName);\n if (!topic || !params.user) {\n console.log(\"Topic or user not found: '\" + params.topicName + \"', '\" + params.user + \"'\");\n return;\n }\n topic.delSubscription(params.user).catch((err) => {\n if (errorHandler) {\n errorHandler(err.message, 'err');\n }\n });\n }},\n 'member_mute': {title: formatMessage(messages.mute), handler: this.topicPermissionSetter.bind(this, '-P')},\n 'member_unmute': {title: formatMessage(messages.unmute), handler: this.topicPermissionSetter.bind(this, '+P')},\n 'member_block': {title: formatMessage(messages.block), handler: this.topicPermissionSetter.bind(this, '-J')},\n 'member_unblock': {title: formatMessage(messages.unblock), handler: this.topicPermissionSetter.bind(this, '+J')},\n };\n }\n\n componentDidMount() {\n document.addEventListener('mousedown', this.handlePageClick, false);\n document.addEventListener('keyup', this.handleEscapeKey, false);\n }\n\n componentWillUnmount() {\n document.removeEventListener('mousedown', this.handlePageClick, false);\n document.removeEventListener('keyup', this.handleEscapeKey, false);\n }\n\n handlePageClick(e) {\n if (ReactDOM.findDOMNode(this).contains(e.target)) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n this.props.hide();\n }\n\n handleEscapeKey(e) {\n if (e.keyCode === 27) {\n this.props.hide();\n }\n }\n\n handleClick(e) {\n e.preventDefault();\n e.stopPropagation();\n this.props.hide();\n let item = this.props.items[e.currentTarget.dataset.id];\n if (typeof item == 'string') {\n item = this.MenuItems[item];\n }\n item.handler(this.props.params, this.props.onError);\n }\n\n // Menu Actions\n\n deleteMessages(all, hard, params, errorHandler) {\n const topic = this.props.tinode.getTopic(params.topicName);\n if (!topic) {\n console.log(\"Topic not found: \", params.topicName);\n return;\n }\n\n // We don't know if the message is still pending (e.g. attachment is being uploaded),\n // so try cancelling first. No harm if we can't cancel.\n // The message can be cancelled if transmission to the server has not\n // started yet or if the message send has failed.\n if (!all && topic.cancelSend(params.seq)) {\n return;\n }\n // Can't cancel. Delete instead.\n let promise = all ?\n topic.delMessagesAll(hard) :\n topic.delMessagesList([params.seq], hard);\n\n promise.catch((err) => {\n if (errorHandler) {\n errorHandler(err.message, 'err');\n }\n });\n }\n\n // Function is used by context menu to set permissions.\n topicPermissionSetter(mode, params, errorHandler) {\n const topic = this.props.tinode.getTopic(params.topicName);\n if (!topic) {\n console.log(\"Topic not found\", params.topicName);\n return;\n }\n\n let am, user;\n if (params.user) {\n user = topic.subscriber(params.user);\n if (!user) {\n console.log(\"Subscriber not found\", params.topicName + \"[\" + params.user + \"]\");\n return;\n }\n am = user.acs.updateGiven(mode).getGiven();\n } else {\n am = topic.getAccessMode().updateWant(mode).getWant();\n }\n\n topic.setMeta({sub: {user: params.user, mode: am}}).catch((err) => {\n if (errorHandler) {\n errorHandler(err.message, 'err');\n }\n });\n }\n\n render() {\n let count = 0;\n let menu = [];\n this.props.items.map((item) => {\n if (typeof item == 'string') {\n item = this.MenuItems[item];\n }\n if (item && item.title) {\n menu.push(\n item.title == '-' ?\n
  • \n :\n
  • {item.title}
  • \n );\n }\n count++;\n });\n\n // Ensure that menu is inside the app-container.\n const hSize = 12 * REM_SIZE;\n const vSize = REM_SIZE * (0.7 + menu.length * 2.5);\n const left = (this.props.bounds.right - this.props.clickAt.x < hSize) ?\n (this.props.clickAt.x - this.props.bounds.left - hSize) :\n (this.props.clickAt.x - this.props.bounds.left);\n const top = (this.props.bounds.bottom - this.props.clickAt.y < vSize) ?\n (this.props.clickAt.y - this.props.bounds.top - vSize) :\n (this.props.clickAt.y - this.props.bounds.top);\n\n const position = {\n left: left + 'px',\n top: top + 'px'\n };\n\n return (\n
      \n {menu}\n
    \n );\n }\n}\n\nexport default injectIntl(ContextMenu);\n","import React from 'react';\n\nimport MenuCancel from './menu-cancel.jsx';\n\nexport default class ErrorPanel extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n show: false,\n };\n\n this.hide = this.hide.bind(this);\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n return {\n show: !(!nextProps.level)\n };\n }\n\n hide() {\n this.setState({show: false});\n if (this.props.onClearError) {\n this.props.onClearError();\n }\n }\n\n render() {\n const icons = {err: 'error', warn: 'warning', info: 'info'}\n const level = icons[this.props.level] || '';\n const className = 'alert-box ' + level;\n return (\n
    \n
    {level}
    \n \n \n {this.props.action ?\n \n {this.props.actionText}\n \n : null}\n \n
    \n
    \n );\n }\n};\n","// File uload/download progress indicator with a cancel inside.\nimport React from 'react';\nimport { FormattedMessage } from 'react-intl';\n\nexport default class FileProgress extends React.PureComponent {\n render() {\n return (\n
    \n
    \n {this.props.progress < 0.999 ?\n \n close \n \n :\n \n }\n
    \n );\n }\n}\n","// GroupMembers: control for managing a list of group members.\nimport React from 'react';\nimport { FormattedMessage, defineMessages, injectIntl } from 'react-intl';\n\nimport ChipInput from './chip-input.jsx';\nimport ContactList from './contact-list.jsx';\n\nconst messages = defineMessages({\n no_contacts: {\n id: 'no_contacts',\n defaultMessage: 'You have no contacts :-(',\n description: 'Shown in ContactsView when the user has no contacts'\n },\n contacts_not_found: {\n id: 'contacts_not_found_short',\n defaultMessage: \"No contacts match '{query}'\",\n description: 'Shown in ContactsView when search returned no results'\n }\n});\n\nclass GroupManager extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n members: props.members,\n index: GroupManager.indexMembers(props.members),\n contactFilter: '',\n noContactsMessage: props.intl.formatMessage(messages.no_contacts),\n selectedContacts: GroupManager.selectedContacts(props.members)\n };\n\n this.handleContactSelected = this.handleContactSelected.bind(this);\n this.handleMemberRemoved = this.handleMemberRemoved.bind(this);\n this.handleContactFilter = this.handleContactFilter.bind(this);\n this.handleSubmit = this.handleSubmit.bind(this);\n this.handleCancel = this.handleCancel.bind(this);\n }\n\n static indexMembers(members) {\n let index = {};\n members.map(function(m) {\n index[m.user] = {delta: 0, present: true}; // Delta: 0 unchanged, +1 added, -1 removed\n });\n return index;\n }\n\n static selectedContacts(members) {\n let sel = [];\n members.map(function(m) {\n sel.push(m.user);\n });\n return sel;\n }\n\n handleContactSelected(userId, index) {\n let status = this.state.index[userId];\n if (status) {\n if (status.present) {\n // Prevent duplicate members\n return;\n }\n status.delta += 1;\n status.present = true;\n } else {\n status = {delta: 1, present: true};\n }\n\n var m = this.state.members.slice();\n m.push(this.props.contacts[index]);\n\n var sel = GroupManager.selectedContacts(m);\n\n var i = this.state.index;\n i[userId] = status;\n\n this.setState({members: m, index: i, selectedContacts: sel});\n }\n\n handleMemberRemoved(userId, index) {\n var status = this.state.index[userId];\n if (!status || !status.present) {\n return;\n }\n status.present = false;\n status.delta -= 1;\n\n var m = this.state.members.slice();\n m.splice(index, 1);\n\n var sel = GroupManager.selectedContacts(m);\n\n var i = this.state.index;\n i[userId] = status;\n\n this.setState({members: m, index: i, selectedContacts: sel});\n }\n\n handleContactFilter(val) {\n const {formatMessage} = this.props.intl;\n const msg = !val ?\n formatMessage(messages.no_contacts) :\n formatMessage(messages.contacts_not_found, {query: val});\n\n this.setState({contactFilter: val, noContactsMessage: msg});\n }\n\n static doContactFiltering(filter, values) {\n if (filter) {\n for (var i=0; i= 0) {\n return true;\n }\n }\n return false;\n }\n return true;\n }\n\n handleSubmit() {\n var instance = this;\n var members = [];\n var added = [];\n var removed = [];\n\n var keys = Object.keys(this.state.index);\n keys.map(function(k) {\n if (instance.state.index[k].present) {\n members.push(k);\n }\n\n if (instance.state.index[k].delta > 0) {\n added.push(k);\n } else if (instance.state.index[k].delta < 0) {\n removed.push(k);\n }\n });\n this.props.onSubmit(members, added, removed);\n }\n\n handleCancel() {\n this.props.onCancel();\n }\n\n render() {\n const {formatMessage} = this.props.intl;\n return (\n
    \n
    \n \n
    \n
    \n \n
    \n
    \n \n
    \n \n
    \n \n \n
    \n
    \n );\n }\n};\n\nexport default injectIntl(GroupManager);\n","/* GroupSubs: a list of group subscribers currently online */\n\nimport React from 'react';\n\nimport LetterTile from './letter-tile.jsx';\nimport { makeImageUrl } from '../lib/blob-helpers.js';\n\nexport default class GroupSubs extends React.Component {\n constructor(props) {\n super(props);\n }\n\n render() {\n const usersOnline = [];\n (this.props.subscribers || []).map((sub) => {\n usersOnline.push(\n
    \n \n
    \n );\n });\n return (\n
    {usersOnline}
    \n );\n }\n};\n","import React from 'react';\n\nimport { KNOWN_HOSTS } from '../config.js';\n\n/* Combobox for selecting host name */\n\nexport default class HostSelector extends React.PureComponent {\n constructor(props) {\n super(props);\n\n this.state = {\n hostName: props.serverAddress,\n changed: false\n };\n\n this.handleHostNameChange = this.handleHostNameChange.bind(this);\n this.handleEditingFinished = this.handleEditingFinished.bind(this);\n }\n\n handleHostNameChange(e) {\n this.setState({hostName: e.target.value, changed: true});\n }\n\n handleEditingFinished() {\n if (this.state.changed) {\n this.setState({changed: false});\n this.props.onServerAddressChange(this.state.hostName.trim());\n }\n }\n\n render() {\n var hostOptions = [];\n for (let key in KNOWN_HOSTS) {\n let item = KNOWN_HOSTS[key];\n hostOptions.push(\n